From: support Date: Mon, 24 Oct 2022 15:38:43 +0000 (+0000) Subject: Built motion from commit 1fd437e9.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=b6e2e710c6ea70397294e7f53bfc06674b0b172d;p=motion2.git Built motion from commit 1fd437e9.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1704d8f..565c1bd 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T14:15:10.937Z", + "time": "2022-10-24T15:31:09.882Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b3eccbe..c80ef17 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T14:15:10.937Z", + "time": "2022-10-24T15:31:09.882Z", "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 f8875fb..435ca62 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 _0x7584=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7584,0x10e));var _0x4758=function(_0x168720,_0x38bf6a){_0x168720=_0x168720-0x0;var _0x7eeeb8=_0x7584[_0x168720];return _0x7eeeb8;};'use strict';var Sequelize=require(_0x4758('0x0'));module[_0x4758('0x1')]={'name':{'type':Sequelize[_0x4758('0x2')],'get':function(_0x34622b){return this[_0x4758('0x3')](_0x4758('0x4'));}},'action':{'type':Sequelize[_0x4758('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4758('0x6'),_0x4758('0x7'),_0x4758('0x8'),'jscripty',_0x4758('0x9'),_0x4758('0xa'),_0x4758('0xb'),'script']],'msg':_0x4758('0xc')}},'comment':_0x4758('0xc')},'data1':{'type':Sequelize[_0x4758('0x5')](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[_0x4758('0x5')](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':_0x4758('0xd')},'data5':{'type':Sequelize[_0x4758('0x5')](0x1000),'comments':_0x4758('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x4758('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x4758('0x10')}}; \ No newline at end of file +var _0xc9cb=['urlForward[body]','exports','getDataValue','STRING','integration','motionbar','jscripty','urlForward','bot','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xc9cb,0x91));var _0xbc9c=function(_0x3056bf,_0x10dbef){_0x3056bf=_0x3056bf-0x0;var _0x2adc05=_0xc9cb[_0x3056bf];return _0x2adc05;};'use strict';var Sequelize=require('sequelize');module[_0xbc9c('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4d59a0){return this[_0xbc9c('0x1')]('action');}},'action':{'type':Sequelize[_0xbc9c('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xbc9c('0x3'),_0xbc9c('0x4'),_0xbc9c('0x5'),_0xbc9c('0x6'),'browser',_0xbc9c('0x7'),_0xbc9c('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc9c('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc9c('0xa')},'data3':{'type':Sequelize[_0xbc9c('0x2')](0x1000),'comment':_0xbc9c('0xb')},'data4':{'type':Sequelize[_0xbc9c('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xbc9c('0x2')](0x1000),'comments':_0xbc9c('0xc')},'data6':{'type':Sequelize[_0xbc9c('0x2')],'comments':_0xbc9c('0xd')},'data7':{'type':Sequelize[_0xbc9c('0xe')],'comments':_0xbc9c('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f3cbc75..683d73d 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 _0x739f=['body','Action','find','params','destroy','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x3679bd,_0x44f12){var _0x1d0ed0=function(_0xafdb4a){while(--_0xafdb4a){_0x3679bd['push'](_0x3679bd['shift']());}};_0x1d0ed0(++_0x44f12);}(_0x739f,0x120));var _0xf739=function(_0x150768,_0x2d1aff){_0x150768=_0x150768-0x0;var _0xfed081=_0x739f[_0x150768];return _0xfed081;};'use strict';var emlformat=require(_0xf739('0x0'));var rimraf=require(_0xf739('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf739('0x2'));var rp=require(_0xf739('0x3'));var moment=require(_0xf739('0x4'));var BPromise=require(_0xf739('0x5'));var Mustache=require('mustache');var util=require(_0xf739('0x6'));var path=require('path');var sox=require(_0xf739('0x7'));var csv=require(_0xf739('0x8'));var ejs=require(_0xf739('0x9'));var fs=require('fs');var fs_extra=require(_0xf739('0xa'));var _=require(_0xf739('0xb'));var squel=require(_0xf739('0xc'));var crypto=require(_0xf739('0xd'));var jsforce=require(_0xf739('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf739('0xf'));var Papa=require('papaparse');var Redis=require(_0xf739('0x10'));var authService=require(_0xf739('0x11'));var qs=require(_0xf739('0x12'));var as=require(_0xf739('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf739('0x14'))(_0xf739('0x15'));var utils=require(_0xf739('0x16'));var config=require(_0xf739('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf739('0x18'))['db'];function respondWithStatusCode(_0x16af1d,_0x287b7c){_0x287b7c=_0x287b7c||0xcc;return function(_0x4ea912){if(_0x4ea912){return _0x16af1d['sendStatus'](_0x287b7c);}return _0x16af1d[_0xf739('0x19')](_0x287b7c)['end']();};}function respondWithResult(_0x135d18,_0x1f691f){_0x1f691f=_0x1f691f||0xc8;return function(_0x49a0bd){if(_0x49a0bd){return _0x135d18[_0xf739('0x19')](_0x1f691f)[_0xf739('0x1a')](_0x49a0bd);}};}function respondWithFilteredResult(_0x4d55ca,_0x2601e3){return function(_0x3789a3){if(_0x3789a3){var _0x2936a5=typeof _0x2601e3['offset']===_0xf739('0x1b')&&typeof _0x2601e3['limit']===_0xf739('0x1b');var _0x83ddae=_0x3789a3[_0xf739('0x1c')];var _0x39199c=_0x2936a5?0x0:_0x2601e3[_0xf739('0x1d')];var _0x4be4ed=_0x2936a5?_0x3789a3[_0xf739('0x1c')]:_0x2601e3[_0xf739('0x1d')]+_0x2601e3[_0xf739('0x1e')];var _0x3e863a;if(_0x4be4ed>=_0x83ddae){_0x4be4ed=_0x83ddae;_0x3e863a=0xc8;}else{_0x3e863a=0xce;}_0x4d55ca[_0xf739('0x19')](_0x3e863a);return _0x4d55ca['set'](_0xf739('0x1f'),_0x39199c+'-'+_0x4be4ed+'/'+_0x83ddae)['json'](_0x3789a3);}return null;};}function patchUpdates(_0x2c622f){return function(_0x5b05aa){try{jsonpatch[_0xf739('0x20')](_0x5b05aa,_0x2c622f,!![]);}catch(_0x1ad349){return BPromise['reject'](_0x1ad349);}return _0x5b05aa[_0xf739('0x21')]();};}function saveUpdates(_0x5b7f10,_0x1bab69){return function(_0x564f85){if(_0x564f85){return _0x564f85[_0xf739('0x22')](_0x5b7f10)['then'](function(_0x2c528f){return _0x2c528f;});}return null;};}function removeEntity(_0x34f7a6,_0x5eaf47){return function(_0x15dc5a){if(_0x15dc5a){return _0x15dc5a['destroy']()[_0xf739('0x23')](function(){_0x34f7a6[_0xf739('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x355370,_0xea2ec3){return function(_0x31e2a1){if(!_0x31e2a1){_0x355370[_0xf739('0x24')](0x194);}return _0x31e2a1;};}function handleError(_0x3c53fc,_0x3b7c2d){_0x3b7c2d=_0x3b7c2d||0x1f4;return function(_0x3146bc){logger[_0xf739('0x25')](_0x3146bc[_0xf739('0x26')]);if(_0x3146bc[_0xf739('0x27')]){delete _0x3146bc[_0xf739('0x27')];}_0x3c53fc[_0xf739('0x19')](_0x3b7c2d)[_0xf739('0x28')](_0x3146bc);};}exports[_0xf739('0x22')]=function(_0x318b87,_0x163c45){if(_0x318b87['body']['id']){delete _0x318b87[_0xf739('0x29')]['id'];}return db[_0xf739('0x2a')][_0xf739('0x2b')]({'where':{'id':_0x318b87[_0xf739('0x2c')]['id']}})['then'](handleEntityNotFound(_0x163c45,null))[_0xf739('0x23')](saveUpdates(_0x318b87[_0xf739('0x29')],null))[_0xf739('0x23')](respondWithResult(_0x163c45,null))['catch'](handleError(_0x163c45,null));};exports[_0xf739('0x2d')]=function(_0x48cf56,_0x1d02c8){return db[_0xf739('0x2a')][_0xf739('0x2b')]({'where':{'id':_0x48cf56[_0xf739('0x2c')]['id']}})[_0xf739('0x23')](handleEntityNotFound(_0x1d02c8,null))[_0xf739('0x23')](removeEntity(_0x1d02c8,null))[_0xf739('0x2e')](handleError(_0x1d02c8,null));}; \ No newline at end of file +var _0x4e24=['then','destroy','sendStatus','error','stack','name','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update'];(function(_0x5c7730,_0x39ef25){var _0x3b06ad=function(_0x2c7fb1){while(--_0x2c7fb1){_0x5c7730['push'](_0x5c7730['shift']());}};_0x3b06ad(++_0x39ef25);}(_0x4e24,0x119));var _0x44e2=function(_0x38ca87,_0xc5e59f){_0x38ca87=_0x38ca87-0x0;var _0x1d254e=_0x4e24[_0x38ca87];return _0x1d254e;};'use strict';var emlformat=require(_0x44e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44e2('0x1'));var jsonpatch=require(_0x44e2('0x2'));var rp=require(_0x44e2('0x3'));var moment=require(_0x44e2('0x4'));var BPromise=require(_0x44e2('0x5'));var Mustache=require('mustache');var util=require(_0x44e2('0x6'));var path=require(_0x44e2('0x7'));var sox=require(_0x44e2('0x8'));var csv=require(_0x44e2('0x9'));var ejs=require(_0x44e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44e2('0xb'));var squel=require(_0x44e2('0xc'));var crypto=require(_0x44e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e2('0xe'));var toCsv=require(_0x44e2('0x9'));var querystring=require(_0x44e2('0xf'));var Papa=require(_0x44e2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44e2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x44e2('0x13'));var config=require(_0x44e2('0x14'));var licenseUtil=require(_0x44e2('0x15'));var db=require(_0x44e2('0x16'))['db'];function respondWithStatusCode(_0x399633,_0xc60d73){_0xc60d73=_0xc60d73||0xcc;return function(_0x11a95e){if(_0x11a95e){return _0x399633['sendStatus'](_0xc60d73);}return _0x399633[_0x44e2('0x17')](_0xc60d73)[_0x44e2('0x18')]();};}function respondWithResult(_0x2e77c4,_0x39261e){_0x39261e=_0x39261e||0xc8;return function(_0x42cade){if(_0x42cade){return _0x2e77c4[_0x44e2('0x17')](_0x39261e)[_0x44e2('0x19')](_0x42cade);}};}function respondWithFilteredResult(_0x24bca8,_0x38adf3){return function(_0x212d68){if(_0x212d68){var _0x404d57=typeof _0x38adf3[_0x44e2('0x1a')]===_0x44e2('0x1b')&&typeof _0x38adf3['limit']===_0x44e2('0x1b');var _0x3c4116=_0x212d68[_0x44e2('0x1c')];var _0x2de878=_0x404d57?0x0:_0x38adf3[_0x44e2('0x1a')];var _0x6a2d0c=_0x404d57?_0x212d68[_0x44e2('0x1c')]:_0x38adf3[_0x44e2('0x1a')]+_0x38adf3[_0x44e2('0x1d')];var _0x2525c1;if(_0x6a2d0c>=_0x3c4116){_0x6a2d0c=_0x3c4116;_0x2525c1=0xc8;}else{_0x2525c1=0xce;}_0x24bca8['status'](_0x2525c1);return _0x24bca8['set']('Content-Range',_0x2de878+'-'+_0x6a2d0c+'/'+_0x3c4116)[_0x44e2('0x19')](_0x212d68);}return null;};}function patchUpdates(_0x52b791){return function(_0x432f51){try{jsonpatch[_0x44e2('0x1e')](_0x432f51,_0x52b791,!![]);}catch(_0x4a60ec){return BPromise[_0x44e2('0x1f')](_0x4a60ec);}return _0x432f51[_0x44e2('0x20')]();};}function saveUpdates(_0x4d9762,_0x3f2810){return function(_0x946515){if(_0x946515){return _0x946515[_0x44e2('0x21')](_0x4d9762)[_0x44e2('0x22')](function(_0x485dee){return _0x485dee;});}return null;};}function removeEntity(_0x178c59,_0x59071f){return function(_0xf762c3){if(_0xf762c3){return _0xf762c3[_0x44e2('0x23')]()[_0x44e2('0x22')](function(){_0x178c59[_0x44e2('0x17')](0xcc)[_0x44e2('0x18')]();});}};}function handleEntityNotFound(_0x36f845,_0x4328a6){return function(_0x1ffd9d){if(!_0x1ffd9d){_0x36f845[_0x44e2('0x24')](0x194);}return _0x1ffd9d;};}function handleError(_0x536744,_0x253fd9){_0x253fd9=_0x253fd9||0x1f4;return function(_0x577f4f){logger[_0x44e2('0x25')](_0x577f4f[_0x44e2('0x26')]);if(_0x577f4f[_0x44e2('0x27')]){delete _0x577f4f[_0x44e2('0x27')];}_0x536744[_0x44e2('0x17')](_0x253fd9)['send'](_0x577f4f);};}exports['update']=function(_0x4f0875,_0xaed27){if(_0x4f0875[_0x44e2('0x28')]['id']){delete _0x4f0875[_0x44e2('0x28')]['id'];}return db[_0x44e2('0x29')]['find']({'where':{'id':_0x4f0875[_0x44e2('0x2a')]['id']}})[_0x44e2('0x22')](handleEntityNotFound(_0xaed27,null))[_0x44e2('0x22')](saveUpdates(_0x4f0875[_0x44e2('0x28')],null))[_0x44e2('0x22')](respondWithResult(_0xaed27,null))[_0x44e2('0x2b')](handleError(_0xaed27,null));};exports[_0x44e2('0x23')]=function(_0x5c84ba,_0x2bed80){return db[_0x44e2('0x29')][_0x44e2('0x2c')]({'where':{'id':_0x5c84ba[_0x44e2('0x2a')]['id']}})[_0x44e2('0x22')](handleEntityNotFound(_0x2bed80,null))['then'](removeEntity(_0x2bed80,null))[_0x44e2('0x2b')](handleError(_0x2bed80,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ff63f42..c274030 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 _0xab06=['bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x16f5d5,_0x184bb0){var _0x1b9f8c=function(_0x224d6d){while(--_0x224d6d){_0x16f5d5['push'](_0x16f5d5['shift']());}};_0x1b9f8c(++_0x184bb0);}(_0xab06,0xe5));var _0x6ab0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xab06[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x6ab0('0x0'));var util=require(_0x6ab0('0x1'));var logger=require(_0x6ab0('0x2'))(_0x6ab0('0x3'));var moment=require(_0x6ab0('0x4'));var BPromise=require(_0x6ab0('0x5'));var rp=require(_0x6ab0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ab0('0x7'));var config=require(_0x6ab0('0x8'));var attributes=require(_0x6ab0('0x9'));module[_0x6ab0('0xa')]=function(_0x20f900,_0x2afae6){return _0x20f900['define'](_0x6ab0('0xb'),attributes,{'tableName':_0x6ab0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4333=['define','Action','tools_actions','util','../../config/logger','moment','path','exports'];(function(_0x2bc19d,_0x35474a){var _0xd745b2=function(_0x1508a6){while(--_0x1508a6){_0x2bc19d['push'](_0x2bc19d['shift']());}};_0xd745b2(++_0x35474a);}(_0x4333,0x1eb));var _0x3433=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x4333[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var util=require(_0x3433('0x0'));var logger=require(_0x3433('0x1'))('api');var moment=require(_0x3433('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3433('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x3433('0x4')]=function(_0x439188,_0x583276){return _0x439188[_0x3433('0x5')](_0x3433('0x6'),attributes,{'tableName':_0x3433('0x7'),'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 469cb9b..f796a40 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 _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x34b1da,_0x4ce1d8){_0x34b1da=_0x34b1da-0x0;var _0x136f6c=_0x7a54[_0x34b1da];return _0x136f6c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x155a6c,_0x48b201){var _0x6497d=function(_0x11a6c9){while(--_0x11a6c9){_0x155a6c['push'](_0x155a6c['shift']());}};_0x6497d(++_0x48b201);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index d29baf5..18dd2fb 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 _0x9db5=['/:id','isAuthenticated','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0x9db5,0x1e4));var _0x59db=function(_0x584693,_0x5464c2){_0x584693=_0x584693-0x0;var _0x5e28cd=_0x9db5[_0x584693];return _0x5e28cd;};'use strict';var multer=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var path=require(_0x59db('0x2'));var timeout=require(_0x59db('0x3'));var express=require(_0x59db('0x4'));var router=express[_0x59db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59db('0x6'));var interaction=require(_0x59db('0x7'));var config=require(_0x59db('0x8'));var controller=require(_0x59db('0x9'));router[_0x59db('0xa')](_0x59db('0xb'),auth[_0x59db('0xc')](),controller['update']);router[_0x59db('0xd')](_0x59db('0xb'),auth[_0x59db('0xc')](),controller['destroy']);module[_0x59db('0xe')]=router; \ No newline at end of file +var _0x57ad=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','isAuthenticated','delete','/:id','destroy','exports','multer'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x57ad,0x1cf));var _0xd57a=function(_0x41b66e,_0x103310){_0x41b66e=_0x41b66e-0x0;var _0x390cfa=_0x57ad[_0x41b66e];return _0x390cfa;};'use strict';var multer=require(_0xd57a('0x0'));var util=require(_0xd57a('0x1'));var path=require(_0xd57a('0x2'));var timeout=require(_0xd57a('0x3'));var express=require(_0xd57a('0x4'));var router=express[_0xd57a('0x5')]();var fs_extra=require(_0xd57a('0x6'));var auth=require(_0xd57a('0x7'));var interaction=require(_0xd57a('0x8'));var config=require('../../config/environment');var controller=require(_0xd57a('0x9'));router[_0xd57a('0xa')]('/:id',auth[_0xd57a('0xb')](),controller['update']);router[_0xd57a('0xc')](_0xd57a('0xd'),auth[_0xd57a('0xb')](),controller[_0xd57a('0xe')]);module[_0xd57a('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0886085..a8b62c7 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x5c396c,_0x3b75c3){var _0x514f6c=function(_0x368b1a){while(--_0x368b1a){_0x5c396c['push'](_0x5c396c['shift']());}};_0x514f6c(++_0x3b75c3);}(_0x1883,0xab));var _0x3188=function(_0x2bb3a8,_0x3d3f2e){_0x2bb3a8=_0x2bb3a8-0x0;var _0x3fe3f4=_0x1883[_0x2bb3a8];return _0x3fe3f4;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x5de38f,_0x386782){var _0x19b8ff=function(_0x2a9a84){while(--_0x2a9a84){_0x5de38f['push'](_0x5de38f['shift']());}};_0x19b8ff(++_0x386782);}(_0xabce,0x103));var _0xeabc=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xabce[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9754d6b..5ae5b42 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 _0x6c0d=['dbH','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','get','CustomReports','UserProfileResource','end','error','name','send','map','AnalyticCustomReport','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','rawAttributes','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','order','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','IS\x20NULL','value','DESC','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','runReport','DATE(%s)','metric','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c0d,0x132));var _0xd6c0=function(_0x5eb6d6,_0x2839a0){_0x5eb6d6=_0x5eb6d6-0x0;var _0x588167=_0x6c0d[_0x5eb6d6];return _0x588167;};'use strict';var emlformat=require(_0xd6c0('0x0'));var rimraf=require(_0xd6c0('0x1'));var zipdir=require(_0xd6c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6c0('0x3'));var moment=require(_0xd6c0('0x4'));var BPromise=require(_0xd6c0('0x5'));var Mustache=require('mustache');var util=require(_0xd6c0('0x6'));var path=require(_0xd6c0('0x7'));var sox=require(_0xd6c0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6c0('0x9'));var fs=require('fs');var fs_extra=require(_0xd6c0('0xa'));var _=require(_0xd6c0('0xb'));var squel=require(_0xd6c0('0xc'));var crypto=require(_0xd6c0('0xd'));var jsforce=require(_0xd6c0('0xe'));var deskjs=require(_0xd6c0('0xf'));var toCsv=require(_0xd6c0('0x10'));var querystring=require(_0xd6c0('0x11'));var Papa=require(_0xd6c0('0x12'));var Redis=require('ioredis');var authService=require(_0xd6c0('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6c0('0x14'));var logger=require('../../config/logger')(_0xd6c0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6c0('0x16'));var db=require(_0xd6c0('0x17'))['db'];var dbH=require(_0xd6c0('0x17'))[_0xd6c0('0x18')];function respondWithStatusCode(_0x40658a,_0x588141){_0x588141=_0x588141||0xcc;return function(_0x3483a3){if(_0x3483a3){return _0x40658a[_0xd6c0('0x19')](_0x588141);}return _0x40658a[_0xd6c0('0x1a')](_0x588141)['end']();};}function respondWithResult(_0x179274,_0x56ff84){_0x56ff84=_0x56ff84||0xc8;return function(_0x5a19f0){if(_0x5a19f0){return _0x179274[_0xd6c0('0x1a')](_0x56ff84)[_0xd6c0('0x1b')](_0x5a19f0);}};}function respondWithFilteredResult(_0x3539c9,_0xe8122){return function(_0x4f4870){if(_0x4f4870){var _0x4e5afe=typeof _0xe8122[_0xd6c0('0x1c')]===_0xd6c0('0x1d')&&typeof _0xe8122[_0xd6c0('0x1e')]===_0xd6c0('0x1d');var _0x151d07=_0x4f4870['count'];var _0x3d4157=_0x4e5afe?0x0:_0xe8122[_0xd6c0('0x1c')];var _0x59dc7f=_0x4e5afe?_0x4f4870['count']:_0xe8122[_0xd6c0('0x1c')]+_0xe8122['limit'];var _0x4c3da8;if(_0x59dc7f>=_0x151d07){_0x59dc7f=_0x151d07;_0x4c3da8=0xc8;}else{_0x4c3da8=0xce;}_0x3539c9[_0xd6c0('0x1a')](_0x4c3da8);return _0x3539c9[_0xd6c0('0x1f')]('Content-Range',_0x3d4157+'-'+_0x59dc7f+'/'+_0x151d07)['json'](_0x4f4870);}return null;};}function patchUpdates(_0x286821){return function(_0xf5159d){try{jsonpatch[_0xd6c0('0x20')](_0xf5159d,_0x286821,!![]);}catch(_0x5928de){return BPromise[_0xd6c0('0x21')](_0x5928de);}return _0xf5159d[_0xd6c0('0x22')]();};}function saveUpdates(_0x459c33,_0x3e7ce8){return function(_0x2bab46){if(_0x2bab46){return _0x2bab46[_0xd6c0('0x23')](_0x459c33)[_0xd6c0('0x24')](function(_0x4fa905){return _0x4fa905;});}return null;};}function removeEntity(_0x2cc6c1,_0x49ebc8){return function(_0xf97d4c){if(_0xf97d4c){return _0xf97d4c['destroy']()[_0xd6c0('0x24')](function(){var _0x3e66f2=_0xf97d4c[_0xd6c0('0x25')]({'plain':!![]});var _0x4ac378=_0xd6c0('0x26');return db[_0xd6c0('0x27')]['destroy']({'where':{'type':_0x4ac378,'resourceId':_0x3e66f2['id']}})[_0xd6c0('0x24')](function(){return _0xf97d4c;});})['then'](function(){_0x2cc6c1[_0xd6c0('0x1a')](0xcc)[_0xd6c0('0x28')]();});}};}function handleEntityNotFound(_0x1d6563,_0x310d9f){return function(_0xede467){if(!_0xede467){_0x1d6563[_0xd6c0('0x19')](0x194);}return _0xede467;};}function handleError(_0x5516b7,_0x27b5de){_0x27b5de=_0x27b5de||0x1f4;return function(_0x5a7627){logger[_0xd6c0('0x29')](_0x5a7627['stack']);if(_0x5a7627[_0xd6c0('0x2a')]){delete _0x5a7627['name'];}_0x5516b7['status'](_0x27b5de)[_0xd6c0('0x2b')](_0x5a7627);};}exports['index']=function(_0x1ff7e2,_0x34ada0){var _0x13b092={},_0x3e9edf={},_0x14b86d={'count':0x0,'rows':[]};var _0x45447e=_[_0xd6c0('0x2c')](db[_0xd6c0('0x2d')]['rawAttributes'],function(_0x4ae7c9){return{'name':_0x4ae7c9['fieldName'],'type':_0x4ae7c9[_0xd6c0('0x2e')][_0xd6c0('0x2f')]};});_0x3e9edf[_0xd6c0('0x30')]=_['map'](_0x45447e,_0xd6c0('0x2a'));_0x3e9edf['query']=_[_0xd6c0('0x31')](_0x1ff7e2[_0xd6c0('0x32')]);_0x3e9edf[_0xd6c0('0x33')]=_[_0xd6c0('0x34')](_0x3e9edf[_0xd6c0('0x30')],_0x3e9edf['query']);_0x13b092['attributes']=_[_0xd6c0('0x34')](_0x3e9edf['model'],qs['fields'](_0x1ff7e2[_0xd6c0('0x32')][_0xd6c0('0x35')]));_0x13b092[_0xd6c0('0x36')]=_0x13b092[_0xd6c0('0x36')]['length']?_0x13b092[_0xd6c0('0x36')]:_0x3e9edf[_0xd6c0('0x30')];if(!_0x1ff7e2['query']['hasOwnProperty'](_0xd6c0('0x37'))){_0x13b092[_0xd6c0('0x1e')]=qs[_0xd6c0('0x1e')](_0x1ff7e2[_0xd6c0('0x32')]['limit']);_0x13b092[_0xd6c0('0x1c')]=qs['offset'](_0x1ff7e2['query'][_0xd6c0('0x1c')]);}_0x13b092['order']=qs['sort'](_0x1ff7e2['query']['sort']);_0x13b092[_0xd6c0('0x38')]=qs['filters'](_[_0xd6c0('0x39')](_0x1ff7e2['query'],_0x3e9edf[_0xd6c0('0x33')]),_0x45447e);if(_0x1ff7e2['query'][_0xd6c0('0x3a')]){_0x13b092[_0xd6c0('0x38')]=_[_0xd6c0('0x3b')](_0x13b092[_0xd6c0('0x38')],{'$or':_[_0xd6c0('0x2c')](_0x45447e,function(_0x5eaf1e){if(_0x5eaf1e[_0xd6c0('0x2e')]!==_0xd6c0('0x3c')){var _0x5e622a={};_0x5e622a[_0x5eaf1e[_0xd6c0('0x2a')]]={'$like':'%'+_0x1ff7e2['query'][_0xd6c0('0x3a')]+'%'};return _0x5e622a;}})});}_0x13b092=_[_0xd6c0('0x3b')]({},_0x13b092,_0x1ff7e2[_0xd6c0('0x3d')]);var _0x2e4abc={'where':_0x13b092['where']};return db[_0xd6c0('0x2d')][_0xd6c0('0x3e')](_0x2e4abc)['then'](function(_0xfe9c36){_0x14b86d[_0xd6c0('0x3e')]=_0xfe9c36;if(_0x1ff7e2['query']['includeAll']){_0x13b092[_0xd6c0('0x3f')]=[{'all':!![]}];}return db[_0xd6c0('0x2d')][_0xd6c0('0x40')](_0x13b092);})[_0xd6c0('0x24')](function(_0x57043e){_0x14b86d['rows']=_0x57043e;return _0x14b86d;})[_0xd6c0('0x24')](respondWithFilteredResult(_0x34ada0,_0x13b092))['catch'](handleError(_0x34ada0,null));};exports[_0xd6c0('0x41')]=function(_0x6a6a55,_0x32528c){var _0x1662a0={'raw':![],'where':{'id':_0x6a6a55[_0xd6c0('0x42')]['id']}},_0x402e08={};_0x402e08[_0xd6c0('0x30')]=_[_0xd6c0('0x31')](db[_0xd6c0('0x2d')][_0xd6c0('0x43')]);_0x402e08[_0xd6c0('0x32')]=_['keys'](_0x6a6a55[_0xd6c0('0x32')]);_0x402e08['filters']=_[_0xd6c0('0x34')](_0x402e08[_0xd6c0('0x30')],_0x402e08['query']);_0x1662a0[_0xd6c0('0x36')]=_[_0xd6c0('0x34')](_0x402e08[_0xd6c0('0x30')],qs[_0xd6c0('0x35')](_0x6a6a55[_0xd6c0('0x32')][_0xd6c0('0x35')]));_0x1662a0[_0xd6c0('0x36')]=_0x1662a0[_0xd6c0('0x36')][_0xd6c0('0x44')]?_0x1662a0[_0xd6c0('0x36')]:_0x402e08['model'];if(_0x6a6a55[_0xd6c0('0x32')][_0xd6c0('0x45')]){_0x1662a0['include']=[{'all':!![]}];}_0x1662a0=_[_0xd6c0('0x3b')]({},_0x1662a0,_0x6a6a55[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x1662a0)[_0xd6c0('0x24')](handleEntityNotFound(_0x32528c,null))['then'](respondWithResult(_0x32528c,null))[_0xd6c0('0x47')](handleError(_0x32528c,null));};exports[_0xd6c0('0x48')]=function(_0x54c5e3,_0x131e56){return db['AnalyticCustomReport'][_0xd6c0('0x48')](_0x54c5e3[_0xd6c0('0x49')],{})['then'](function(_0x34c550){var _0x5b341a=_0x54c5e3[_0xd6c0('0x4a')][_0xd6c0('0x25')]({'plain':!![]});if(!_0x5b341a)throw new Error(_0xd6c0('0x4b'));if(_0x5b341a[_0xd6c0('0x4c')]===_0xd6c0('0x4a')){var _0x1f3ba4=_0x34c550[_0xd6c0('0x25')]({'plain':!![]});var _0x3b6fa8='Reports';return db[_0xd6c0('0x4d')][_0xd6c0('0x46')]({'where':{'name':_0x3b6fa8,'userProfileId':_0x5b341a[_0xd6c0('0x4e')]},'raw':!![]})[_0xd6c0('0x24')](function(_0x214b6f){if(_0x214b6f&&_0x214b6f['autoAssociation']===0x0){return db[_0xd6c0('0x27')][_0xd6c0('0x48')]({'name':_0x1f3ba4['name'],'resourceId':_0x1f3ba4['id'],'type':'CustomReports','sectionId':_0x214b6f['id']},{})[_0xd6c0('0x24')](function(){return _0x34c550;});}else{return _0x34c550;}})[_0xd6c0('0x47')](function(_0x223e21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x223e21);throw _0x223e21;});}return _0x34c550;})[_0xd6c0('0x24')](respondWithResult(_0x131e56,0xc9))['catch'](handleError(_0x131e56,null));};exports[_0xd6c0('0x23')]=function(_0x3678f9,_0x49d710){if(_0x3678f9['body']['id']){delete _0x3678f9['body']['id'];}return db[_0xd6c0('0x2d')][_0xd6c0('0x46')]({'where':{'id':_0x3678f9[_0xd6c0('0x42')]['id']}})[_0xd6c0('0x24')](handleEntityNotFound(_0x49d710,null))[_0xd6c0('0x24')](saveUpdates(_0x3678f9['body'],null))['then'](respondWithResult(_0x49d710,null))[_0xd6c0('0x47')](handleError(_0x49d710,null));};exports[_0xd6c0('0x4f')]=function(_0x591b53,_0x4238de){return db[_0xd6c0('0x2d')][_0xd6c0('0x46')]({'where':{'id':_0x591b53['params']['id']}})[_0xd6c0('0x24')](handleEntityNotFound(_0x4238de,null))['then'](removeEntity(_0x4238de,null))[_0xd6c0('0x47')](handleError(_0x4238de,null));};exports[_0xd6c0('0x50')]=function(_0x498ce6,_0x1098a0){var _0x505703=0xa;var _0x29f404=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x5cec3b={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':_0xd6c0('0x58'),'MIN':_0xd6c0('0x59'),'AVG':_0xd6c0('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':_0xd6c0('0x5c')};var _0x6de914={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':'DATE(%s)','HOUR':_0xd6c0('0x5e'),'ROUND':_0xd6c0('0x5f'),'UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x411ed7=function(_0x472f69){return!_['includes'](['IS\x20NULL',_0xd6c0('0x61'),_0xd6c0('0x62'),_0xd6c0('0x63')],_0x472f69);};var _0x36f732=function(_0x44f925){if(!_0x44f925||!_0x44f925[_0xd6c0('0x64')]['length']){return'';}for(var _0x1c4b99='(',_0x44abf7=0x0;_0x44abf7<_0x44f925[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x44abf7+=0x1){_0x44abf7>0x0&&(_0x1c4b99+='\x20'+_0x44f925[_0xd6c0('0x65')]+'\x20');_0x1c4b99+=_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x66')]?_0x36f732(_0x44f925['rules'][_0x44abf7]['group']):_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x67')]+'\x20'+_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x68')]+(_0x411ed7(_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x68')])?'\x20'+_0x44f925[_0xd6c0('0x64')][_0x44abf7]['value']:'');}return _0x1c4b99+')';};var _0x476029={'where':{'id':_0x498ce6[_0xd6c0('0x42')]['id']}},_0x534e89,_0x1f535c,_0x31e22c,_0x32008e,_0x843577;_0x476029=_[_0xd6c0('0x3b')]({},_0x476029,_0x498ce6[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x476029)[_0xd6c0('0x24')](function(_0xdb60ec){if(_0xdb60ec){_0x534e89=_0xdb60ec;return _0xdb60ec[_0xd6c0('0x69')]();}return null;})['then'](function(_0x195c3a){if(_0x195c3a){if(!_0x195c3a[_0xd6c0('0x44')]){throw new db[(_0xd6c0('0x6a'))][(_0xd6c0('0x6b'))](_0xd6c0('0x6c'),0x193);}_0x1f535c=_0x195c3a;return db[_0xd6c0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0x4edf53){if(_0x4edf53){_0x31e22c=_[_0xd6c0('0x6e')](_0x4edf53,'id');var _0x1ae949;var _0x289123=squel[_0xd6c0('0x6f')]();_0x289123[_0xd6c0('0x70')](_0x534e89[_0xd6c0('0x71')]);for(var _0x544b23=0x0;_0x544b23<_0x1f535c[_0xd6c0('0x44')];_0x544b23+=0x1){_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x72')]?_0x31e22c[_0x1f535c[_0x544b23]['MetricId']]['metric']:_0x1f535c[_0x544b23][_0xd6c0('0x67')];_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x73')]?_[_0xd6c0('0x74')](_0x5cec3b[_0x1f535c[_0x544b23][_0xd6c0('0x73')]],'%s',_0x1ae949):_0x1ae949;_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x6de914[_0x1f535c[_0x544b23][_0xd6c0('0x75')]],'%s',_0x1ae949):_0x1ae949;if(_0x1f535c[_0x544b23][_0xd6c0('0x76')]){_0x289123[_0xd6c0('0x66')](_0x1ae949);}_0x1f535c[_0x544b23][_0xd6c0('0x77')]&&_0x289123[_0xd6c0('0x78')](_0x1ae949,_0x1f535c[_0x544b23]['orderBy']==='DESC'?![]:!![]);_0x289123[_0xd6c0('0x67')](_0x1ae949,_0x1f535c[_0x544b23]['alias']||_0x1ae949);}if(_0x534e89[_0xd6c0('0x79')]){_0x534e89[_0xd6c0('0x79')]=JSON['parse'](_0x534e89[_0xd6c0('0x79')]);for(var _0x1a8d4f=0x0;_0x1a8d4f<_0x534e89[_0xd6c0('0x79')]['length'];_0x1a8d4f+=0x1){if(_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x2e')]&&_[_0xd6c0('0x7a')](_0x29f404,_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x2e')])&&_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7b')]&&_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7c')]&&_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['foreignKey']){_0x289123[_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['type']](_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['foreignTable'],null,util['format'](_0xd6c0('0x7d'),_0x534e89['table'],_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7b')],_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x7c')],_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7e')]));}}}if(_0x534e89['conditions']){_0x534e89[_0xd6c0('0x7f')]=JSON[_0xd6c0('0x80')](_0x534e89['conditions']);_0x289123[_0xd6c0('0x38')](_0x36f732(_0x534e89[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x843577=_0x289123[_0xd6c0('0x81')]();_0x289123[_0xd6c0('0x1e')](_0x505703);_0x289123[_0xd6c0('0x1c')](0x0);logger[_0xd6c0('0x82')](_0xd6c0('0x83'),_0x289123[_0xd6c0('0x84')]());return dbH[_0xd6c0('0x85')][_0xd6c0('0x32')](_0x289123['toString'](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')][_0xd6c0('0x87')]});}})[_0xd6c0('0x24')](respondWithResult(_0x1098a0,null))[_0xd6c0('0x47')](handleError(_0x1098a0,null));};function runReport(_0x338ddb,_0x53dca2,_0x482480){var _0x553a2d=_0x53dca2[_0xd6c0('0x2a')];var _0x16afbb=0xa;var _0x2b1b7d=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x52b3ac={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':_0xd6c0('0x58'),'MIN':_0xd6c0('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd6c0('0x88'),'GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x28cca5={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd6c0('0x5f'),'UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x48d850=function(_0x17a723){return!_[_0xd6c0('0x7a')]([_0xd6c0('0x89'),_0xd6c0('0x61'),'IS\x20EMPTY',_0xd6c0('0x63')],_0x17a723);};var _0x2aa196=function(_0x334df0){if(!_0x334df0||!_0x334df0[_0xd6c0('0x64')]['length']){return'';}for(var _0x356e59='(',_0x433495=0x0;_0x433495<_0x334df0[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x433495+=0x1){_0x433495>0x0&&(_0x356e59+='\x20'+_0x334df0['operator']+'\x20');_0x356e59+=_0x334df0[_0xd6c0('0x64')][_0x433495]['group']?_0x2aa196(_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x66')]):_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x67')]+'\x20'+_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x68')]+(_0x48d850(_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x68')])?'\x20'+_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x8a')]:'');}return _0x356e59+')';};var _0x510e9d={'where':{'id':_0x338ddb['id']}},_0x3e8ab7,_0xca6637,_0x5ac4e5,_0x1b31fc,_0x5a3e9e;_0x510e9d=_[_0xd6c0('0x3b')]({},_0x510e9d,_0x482480);return db[_0xd6c0('0x2d')]['find'](_0x510e9d)[_0xd6c0('0x24')](function(_0x32b486){if(_0x32b486){_0x3e8ab7=_0x32b486;return _0x32b486[_0xd6c0('0x69')]();}return null;})['then'](function(_0xf8018b){if(_0xf8018b){if(!_0xf8018b[_0xd6c0('0x44')]){throw new db[(_0xd6c0('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xca6637=_0xf8018b;return db[_0xd6c0('0x6d')][_0xd6c0('0x40')]({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0xea5743){if(_0xea5743){_0x5ac4e5=_['keyBy'](_0xea5743,'id');var _0x229b67;var _0x3d44ae=squel[_0xd6c0('0x6f')]();_0x3d44ae[_0xd6c0('0x70')](_0x3e8ab7[_0xd6c0('0x71')]);for(var _0x4455ca=0x0;_0x4455ca<_0xca6637[_0xd6c0('0x44')];_0x4455ca+=0x1){_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x72')]?_0x5ac4e5[_0xca6637[_0x4455ca][_0xd6c0('0x72')]]['metric']:_0xca6637[_0x4455ca][_0xd6c0('0x67')];_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x73')]?_[_0xd6c0('0x74')](_0x52b3ac[_0xca6637[_0x4455ca][_0xd6c0('0x73')]],'%s',_0x229b67):_0x229b67;_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x28cca5[_0xca6637[_0x4455ca]['format']],'%s',_0x229b67):_0x229b67;if(_0xca6637[_0x4455ca][_0xd6c0('0x76')]){_0x3d44ae[_0xd6c0('0x66')](_0x229b67);}_0xca6637[_0x4455ca][_0xd6c0('0x77')]&&_0x3d44ae[_0xd6c0('0x78')](_0x229b67,_0xca6637[_0x4455ca]['orderBy']===_0xd6c0('0x8b')?![]:!![]);_0x3d44ae['field'](_0x229b67,_0xca6637[_0x4455ca][_0xd6c0('0x8c')]||_0x229b67);}if(_0x3e8ab7['joins']){_0x3e8ab7[_0xd6c0('0x79')]=JSON['parse'](_0x3e8ab7[_0xd6c0('0x79')]);for(var _0xa8c5b=0x0;_0xa8c5b<_0x3e8ab7[_0xd6c0('0x79')][_0xd6c0('0x44')];_0xa8c5b+=0x1){if(_0x3e8ab7['joins'][_0xa8c5b][_0xd6c0('0x2e')]&&_[_0xd6c0('0x7a')](_0x2b1b7d,_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['type'])&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7b')]&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7c')]&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7e')]){_0x3d44ae[_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['type']](_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7c')],null,util[_0xd6c0('0x75')](_0xd6c0('0x7d'),_0x3e8ab7[_0xd6c0('0x71')],_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7b')],_0x3e8ab7['joins'][_0xa8c5b][_0xd6c0('0x7c')],_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['foreignKey']));}}}if(_0x3e8ab7[_0xd6c0('0x7f')]){_0x3e8ab7[_0xd6c0('0x7f')]=JSON['parse'](_0x3e8ab7['conditions']);_0x3d44ae['where'](_0x2aa196(_0x3e8ab7[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x5a3e9e=_0x3d44ae['clone']();_0x3d44ae[_0xd6c0('0x1e')](_0x16afbb);_0x3d44ae[_0xd6c0('0x1c')](0x0);return;}})[_0xd6c0('0x24')](function(){if(_0x53dca2[_0xd6c0('0x8d')]===_0xd6c0('0x8e')){return null;}var _0x4854dc=_[_0xd6c0('0x3b')](_0x53dca2,{'name':_0x53dca2[_0xd6c0('0x8f')]||_0x53dca2[_0xd6c0('0x2a')]||_0x3e8ab7[_0xd6c0('0x2a')],'basename':_0x553a2d,'savename':util['format'](_0xd6c0('0x90'),_0x53dca2[_0xd6c0('0x2a')]||_0x3e8ab7['name'],require(_0xd6c0('0x91'))[_0xd6c0('0x92')](0x4),_0x53dca2['output']||_0xd6c0('0x93')),'reportId':_0x3e8ab7['id'],'reportType':_0xd6c0('0x94')});return db['AnalyticExtractedReport'][_0xd6c0('0x48')](_0x4854dc,{'raw':!![]});})[_0xd6c0('0x24')](function(_0x58b017){if(_0x3e8ab7['table']===_0xd6c0('0x95')){_0x5a3e9e[_0xd6c0('0x38')](_0x3e8ab7['table']+_0xd6c0('0x96'),_0x53dca2[_0xd6c0('0x97')],_0x53dca2[_0xd6c0('0x98')]);}else{_0x5a3e9e[_0xd6c0('0x38')](_0x3e8ab7[_0xd6c0('0x71')]+_0xd6c0('0x99'),_0x53dca2['startDate'],_0x53dca2[_0xd6c0('0x98')]);}if(_0x58b017){logger[_0xd6c0('0x9a')](_0xd6c0('0x9b'),_0x5a3e9e['toString']());require(_0xd6c0('0x9c'))[_0xd6c0('0x9d')](path[_0xd6c0('0x51')](__dirname,_0xd6c0('0x9e'),_0x58b017[_0xd6c0('0x8d')]),[_0x58b017['id'],_0x5a3e9e['toString'](),path[_0xd6c0('0x51')](__dirname,_0xd6c0('0x9f'),_0x58b017[_0xd6c0('0xa0')]),_0x553a2d]);return _0x58b017;}else{var _0x144198=squel[_0xd6c0('0x6f')]();_0x144198['from']('('+_0x5a3e9e[_0xd6c0('0x84')]()+')','countTable');_0x144198[_0xd6c0('0x67')](_0xd6c0('0xa1'),_0xd6c0('0x3e'));_0x5a3e9e['limit'](_0x53dca2['limit']||_0x16afbb);_0x5a3e9e[_0xd6c0('0x1c')](_0x53dca2[_0xd6c0('0x1c')]||0x0);return dbH[_0xd6c0('0x85')][_0xd6c0('0x32')](_0x144198['toString'](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')][_0xd6c0('0x87')]})[_0xd6c0('0x24')](function(_0x50fbfc){if(!_0x50fbfc['length']){_0x1b31fc=0x0;}else{_0x1b31fc=_0x50fbfc[0x0][_0xd6c0('0x3e')]||0x0;}return dbH[_0xd6c0('0x85')]['query'](_0x5a3e9e[_0xd6c0('0x84')](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')]['SELECT']});})[_0xd6c0('0x24')](function(_0x3cb3d7){return{'rows':_0x3cb3d7||[],'count':_0x1b31fc};});}});}exports['run']=function(_0x584735,_0x3ae0e1){return runReport(_0x584735[_0xd6c0('0x42')],_0x584735[_0xd6c0('0x32')],_0x584735['options'])[_0xd6c0('0x24')](respondWithResult(_0x3ae0e1,null))['catch'](handleError(_0x3ae0e1,null));};exports[_0xd6c0('0xa2')]=runReport;exports['query']=function(_0x3ea24a,_0x12ac9c){var _0xf22810=0xa;var _0x500cc5=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x5aa210={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xd6c0('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':_0xd6c0('0x5c')};var _0x253b81={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':_0xd6c0('0xa3'),'HOUR':_0xd6c0('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x302827=function(_0x2edf03){return!_[_0xd6c0('0x7a')](['IS\x20NULL',_0xd6c0('0x61'),'IS\x20EMPTY',_0xd6c0('0x63')],_0x2edf03);};var _0x5e9f76=function(_0x400402){if(!_0x400402||!_0x400402['rules'][_0xd6c0('0x44')]){return'';}for(var _0xee779b='(',_0x224e55=0x0;_0x224e55<_0x400402[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x224e55+=0x1){_0x224e55>0x0&&(_0xee779b+='\x20'+_0x400402[_0xd6c0('0x65')]+'\x20');_0xee779b+=_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x66')]?_0x5e9f76(_0x400402[_0xd6c0('0x64')][_0x224e55]['group']):_0x400402['rules'][_0x224e55]['field']+'\x20'+_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x68')]+(_0x302827(_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x68')])?'\x20'+_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x8a')]:'');}return _0xee779b+')';};var _0x156956={'where':{'id':_0x3ea24a[_0xd6c0('0x42')]['id']}},_0xe3d9c2,_0x282dda,_0x3192ab,_0x49ad70,_0x453263;_0x156956=_[_0xd6c0('0x3b')]({},_0x156956,_0x3ea24a[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x156956)[_0xd6c0('0x24')](function(_0x288243){if(_0x288243){_0xe3d9c2=_0x288243;return _0x288243[_0xd6c0('0x69')]();}return null;})['then'](function(_0x315b3a){if(_0x315b3a){if(!_0x315b3a['length']){throw new db[(_0xd6c0('0x6a'))][(_0xd6c0('0x6b'))](_0xd6c0('0x6c'),0x193);}_0x282dda=_0x315b3a;return db[_0xd6c0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0x44be1f){if(_0x44be1f){_0x3192ab=_['keyBy'](_0x44be1f,'id');var _0x565089;var _0x3c0bef=squel[_0xd6c0('0x6f')]();_0x3c0bef[_0xd6c0('0x70')](_0xe3d9c2['table']);for(var _0x4aebf4=0x0;_0x4aebf4<_0x282dda[_0xd6c0('0x44')];_0x4aebf4+=0x1){_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x72')]?_0x3192ab[_0x282dda[_0x4aebf4][_0xd6c0('0x72')]][_0xd6c0('0xa4')]:_0x282dda[_0x4aebf4][_0xd6c0('0x67')];_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x73')]?_['replace'](_0x5aa210[_0x282dda[_0x4aebf4][_0xd6c0('0x73')]],'%s',_0x565089):_0x565089;_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x253b81[_0x282dda[_0x4aebf4][_0xd6c0('0x75')]],'%s',_0x565089):_0x565089;if(_0x282dda[_0x4aebf4][_0xd6c0('0x76')]){_0x3c0bef[_0xd6c0('0x66')](_0x565089);}_0x282dda[_0x4aebf4][_0xd6c0('0x77')]&&_0x3c0bef[_0xd6c0('0x78')](_0x565089,_0x282dda[_0x4aebf4][_0xd6c0('0x77')]===_0xd6c0('0x8b')?![]:!![]);_0x3c0bef['field'](_0x565089,_0x282dda[_0x4aebf4][_0xd6c0('0x8c')]||_0x565089);}if(_0xe3d9c2[_0xd6c0('0x79')]){_0xe3d9c2[_0xd6c0('0x79')]=JSON[_0xd6c0('0x80')](_0xe3d9c2['joins']);for(var _0x52449e=0x0;_0x52449e<_0xe3d9c2[_0xd6c0('0x79')]['length'];_0x52449e+=0x1){if(_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')]&&_['includes'](_0x500cc5,_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')])&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7b')]&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7c')]&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignKey']){_0x3c0bef[_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')]](_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7c')],null,util[_0xd6c0('0x75')]('%s.%s\x20=\x20%s.%s',_0xe3d9c2['table'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['parentKey'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignTable'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignKey']));}}}if(_0xe3d9c2[_0xd6c0('0x7f')]){_0xe3d9c2[_0xd6c0('0x7f')]=JSON[_0xd6c0('0x80')](_0xe3d9c2['conditions']);_0x3c0bef['where'](_0x5e9f76(_0xe3d9c2[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x453263=_0x3c0bef[_0xd6c0('0x81')]();_0x3c0bef[_0xd6c0('0x1e')](_0xf22810);_0x3c0bef['offset'](0x0);logger['debug'](_0xd6c0('0x83'),_0x3c0bef[_0xd6c0('0x84')]());return dbH['sequelize'][_0xd6c0('0x32')](_0x3c0bef[_0xd6c0('0x84')](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')]['SELECT']});}})[_0xd6c0('0x24')](function(){return{'sql':_0x453263['toString']()};})[_0xd6c0('0x24')](respondWithResult(_0x12ac9c,null))[_0xd6c0('0x47')](handleError(_0x12ac9c,null));}; \ No newline at end of file +var _0x4965=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','ValidationErrorItem','AnalyticMetric','MetricId','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','runReport','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','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','dbH','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','index','map','AnalyticCustomReport','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','pick','where','merge','filter','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','left_join'];(function(_0x4e8b4c,_0x170953){var _0x198b19=function(_0x23ff10){while(--_0x23ff10){_0x4e8b4c['push'](_0x4e8b4c['shift']());}};_0x198b19(++_0x170953);}(_0x4965,0x16e));var _0x5496=function(_0x6c79a9,_0x3218e7){_0x6c79a9=_0x6c79a9-0x0;var _0x1f80a9=_0x4965[_0x6c79a9];return _0x1f80a9;};'use strict';var emlformat=require(_0x5496('0x0'));var rimraf=require(_0x5496('0x1'));var zipdir=require(_0x5496('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5496('0x3'));var Mustache=require('mustache');var util=require(_0x5496('0x4'));var path=require(_0x5496('0x5'));var sox=require(_0x5496('0x6'));var csv=require('to-csv');var ejs=require(_0x5496('0x7'));var fs=require('fs');var fs_extra=require(_0x5496('0x8'));var _=require(_0x5496('0x9'));var squel=require(_0x5496('0xa'));var crypto=require('crypto');var jsforce=require(_0x5496('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5496('0xc'));var querystring=require(_0x5496('0xd'));var Papa=require(_0x5496('0xe'));var Redis=require('ioredis');var authService=require(_0x5496('0xf'));var qs=require(_0x5496('0x10'));var as=require(_0x5496('0x11'));var hardwareService=require(_0x5496('0x12'));var logger=require(_0x5496('0x13'))(_0x5496('0x14'));var utils=require(_0x5496('0x15'));var config=require(_0x5496('0x16'));var licenseUtil=require(_0x5496('0x17'));var db=require(_0x5496('0x18'))['db'];var dbH=require(_0x5496('0x18'))[_0x5496('0x19')];function respondWithStatusCode(_0x39f846,_0x45c7fb){_0x45c7fb=_0x45c7fb||0xcc;return function(_0x30104e){if(_0x30104e){return _0x39f846['sendStatus'](_0x45c7fb);}return _0x39f846[_0x5496('0x1a')](_0x45c7fb)[_0x5496('0x1b')]();};}function respondWithResult(_0x27072e,_0x35520e){_0x35520e=_0x35520e||0xc8;return function(_0x20814f){if(_0x20814f){return _0x27072e[_0x5496('0x1a')](_0x35520e)[_0x5496('0x1c')](_0x20814f);}};}function respondWithFilteredResult(_0x2f746c,_0x4c7317){return function(_0x4bf295){if(_0x4bf295){var _0x1a5deb=typeof _0x4c7317[_0x5496('0x1d')]===_0x5496('0x1e')&&typeof _0x4c7317[_0x5496('0x1f')]===_0x5496('0x1e');var _0x3496fb=_0x4bf295[_0x5496('0x20')];var _0x38a8c3=_0x1a5deb?0x0:_0x4c7317[_0x5496('0x1d')];var _0x512872=_0x1a5deb?_0x4bf295['count']:_0x4c7317[_0x5496('0x1d')]+_0x4c7317[_0x5496('0x1f')];var _0x10599a;if(_0x512872>=_0x3496fb){_0x512872=_0x3496fb;_0x10599a=0xc8;}else{_0x10599a=0xce;}_0x2f746c[_0x5496('0x1a')](_0x10599a);return _0x2f746c['set'](_0x5496('0x21'),_0x38a8c3+'-'+_0x512872+'/'+_0x3496fb)[_0x5496('0x1c')](_0x4bf295);}return null;};}function patchUpdates(_0x58b5a2){return function(_0x4650db){try{jsonpatch[_0x5496('0x22')](_0x4650db,_0x58b5a2,!![]);}catch(_0x3624ee){return BPromise[_0x5496('0x23')](_0x3624ee);}return _0x4650db[_0x5496('0x24')]();};}function saveUpdates(_0x408716,_0x25a988){return function(_0x1fb22a){if(_0x1fb22a){return _0x1fb22a[_0x5496('0x25')](_0x408716)[_0x5496('0x26')](function(_0x394551){return _0x394551;});}return null;};}function removeEntity(_0x1ab3ca,_0x385134){return function(_0x48367e){if(_0x48367e){return _0x48367e[_0x5496('0x27')]()['then'](function(){var _0x482324=_0x48367e['get']({'plain':!![]});var _0xc6e98b=_0x5496('0x28');return db[_0x5496('0x29')][_0x5496('0x27')]({'where':{'type':_0xc6e98b,'resourceId':_0x482324['id']}})[_0x5496('0x26')](function(){return _0x48367e;});})[_0x5496('0x26')](function(){_0x1ab3ca[_0x5496('0x1a')](0xcc)[_0x5496('0x1b')]();});}};}function handleEntityNotFound(_0x100123,_0x2c7a37){return function(_0x542fb2){if(!_0x542fb2){_0x100123[_0x5496('0x2a')](0x194);}return _0x542fb2;};}function handleError(_0x28d7d5,_0x519bd7){_0x519bd7=_0x519bd7||0x1f4;return function(_0x802f78){logger[_0x5496('0x2b')](_0x802f78[_0x5496('0x2c')]);if(_0x802f78['name']){delete _0x802f78['name'];}_0x28d7d5['status'](_0x519bd7)['send'](_0x802f78);};}exports[_0x5496('0x2d')]=function(_0x36a421,_0x33ae26){var _0x37b1f0={},_0x87702b={},_0x3cf590={'count':0x0,'rows':[]};var _0x59811c=_[_0x5496('0x2e')](db[_0x5496('0x2f')]['rawAttributes'],function(_0x2c6514){return{'name':_0x2c6514[_0x5496('0x30')],'type':_0x2c6514[_0x5496('0x31')][_0x5496('0x32')]};});_0x87702b['model']=_['map'](_0x59811c,_0x5496('0x33'));_0x87702b[_0x5496('0x34')]=_[_0x5496('0x35')](_0x36a421[_0x5496('0x34')]);_0x87702b[_0x5496('0x36')]=_[_0x5496('0x37')](_0x87702b[_0x5496('0x38')],_0x87702b['query']);_0x37b1f0['attributes']=_[_0x5496('0x37')](_0x87702b['model'],qs[_0x5496('0x39')](_0x36a421[_0x5496('0x34')][_0x5496('0x39')]));_0x37b1f0[_0x5496('0x3a')]=_0x37b1f0[_0x5496('0x3a')]['length']?_0x37b1f0[_0x5496('0x3a')]:_0x87702b['model'];if(!_0x36a421[_0x5496('0x34')][_0x5496('0x3b')]('nolimit')){_0x37b1f0[_0x5496('0x1f')]=qs[_0x5496('0x1f')](_0x36a421['query'][_0x5496('0x1f')]);_0x37b1f0[_0x5496('0x1d')]=qs[_0x5496('0x1d')](_0x36a421[_0x5496('0x34')]['offset']);}_0x37b1f0['order']=qs['sort'](_0x36a421[_0x5496('0x34')]['sort']);_0x37b1f0['where']=qs[_0x5496('0x36')](_[_0x5496('0x3c')](_0x36a421['query'],_0x87702b[_0x5496('0x36')]),_0x59811c);if(_0x36a421[_0x5496('0x34')]['filter']){_0x37b1f0[_0x5496('0x3d')]=_[_0x5496('0x3e')](_0x37b1f0[_0x5496('0x3d')],{'$or':_[_0x5496('0x2e')](_0x59811c,function(_0x1af21b){if(_0x1af21b['type']!=='VIRTUAL'){var _0x40da58={};_0x40da58[_0x1af21b[_0x5496('0x33')]]={'$like':'%'+_0x36a421['query'][_0x5496('0x3f')]+'%'};return _0x40da58;}})});}_0x37b1f0=_[_0x5496('0x3e')]({},_0x37b1f0,_0x36a421['options']);var _0x348f69={'where':_0x37b1f0[_0x5496('0x3d')]};return db[_0x5496('0x2f')][_0x5496('0x20')](_0x348f69)[_0x5496('0x26')](function(_0x2d98b1){_0x3cf590[_0x5496('0x20')]=_0x2d98b1;if(_0x36a421['query']['includeAll']){_0x37b1f0[_0x5496('0x40')]=[{'all':!![]}];}return db[_0x5496('0x2f')][_0x5496('0x41')](_0x37b1f0);})[_0x5496('0x26')](function(_0x325efb){_0x3cf590[_0x5496('0x42')]=_0x325efb;return _0x3cf590;})[_0x5496('0x26')](respondWithFilteredResult(_0x33ae26,_0x37b1f0))[_0x5496('0x43')](handleError(_0x33ae26,null));};exports[_0x5496('0x44')]=function(_0x29b57a,_0x1fa3f4){var _0x59f3dc={'raw':![],'where':{'id':_0x29b57a[_0x5496('0x45')]['id']}},_0x2fb3e9={};_0x2fb3e9[_0x5496('0x38')]=_[_0x5496('0x35')](db[_0x5496('0x2f')][_0x5496('0x46')]);_0x2fb3e9[_0x5496('0x34')]=_['keys'](_0x29b57a['query']);_0x2fb3e9[_0x5496('0x36')]=_[_0x5496('0x37')](_0x2fb3e9[_0x5496('0x38')],_0x2fb3e9[_0x5496('0x34')]);_0x59f3dc['attributes']=_[_0x5496('0x37')](_0x2fb3e9[_0x5496('0x38')],qs[_0x5496('0x39')](_0x29b57a['query'][_0x5496('0x39')]));_0x59f3dc[_0x5496('0x3a')]=_0x59f3dc[_0x5496('0x3a')][_0x5496('0x47')]?_0x59f3dc[_0x5496('0x3a')]:_0x2fb3e9[_0x5496('0x38')];if(_0x29b57a[_0x5496('0x34')][_0x5496('0x48')]){_0x59f3dc[_0x5496('0x40')]=[{'all':!![]}];}_0x59f3dc=_[_0x5496('0x3e')]({},_0x59f3dc,_0x29b57a['options']);return db[_0x5496('0x2f')][_0x5496('0x49')](_0x59f3dc)[_0x5496('0x26')](handleEntityNotFound(_0x1fa3f4,null))[_0x5496('0x26')](respondWithResult(_0x1fa3f4,null))[_0x5496('0x43')](handleError(_0x1fa3f4,null));};exports[_0x5496('0x4a')]=function(_0x15fbde,_0x3ff5fa){return db['AnalyticCustomReport']['create'](_0x15fbde[_0x5496('0x4b')],{})[_0x5496('0x26')](function(_0x2da752){var _0x186907=_0x15fbde['user'][_0x5496('0x4c')]({'plain':!![]});if(!_0x186907)throw new Error(_0x5496('0x4d'));if(_0x186907[_0x5496('0x4e')]===_0x5496('0x4f')){var _0x395e94=_0x2da752[_0x5496('0x4c')]({'plain':!![]});var _0x39e6b4=_0x5496('0x50');return db[_0x5496('0x51')][_0x5496('0x49')]({'where':{'name':_0x39e6b4,'userProfileId':_0x186907[_0x5496('0x52')]},'raw':!![]})[_0x5496('0x26')](function(_0x5df52b){if(_0x5df52b&&_0x5df52b[_0x5496('0x53')]===0x0){return db[_0x5496('0x29')][_0x5496('0x4a')]({'name':_0x395e94[_0x5496('0x33')],'resourceId':_0x395e94['id'],'type':_0x5496('0x28'),'sectionId':_0x5df52b['id']},{})[_0x5496('0x26')](function(){return _0x2da752;});}else{return _0x2da752;}})[_0x5496('0x43')](function(_0x59fb23){logger[_0x5496('0x2b')](_0x5496('0x54'),_0x59fb23);throw _0x59fb23;});}return _0x2da752;})['then'](respondWithResult(_0x3ff5fa,0xc9))[_0x5496('0x43')](handleError(_0x3ff5fa,null));};exports[_0x5496('0x25')]=function(_0x2959f5,_0x346bfe){if(_0x2959f5[_0x5496('0x4b')]['id']){delete _0x2959f5[_0x5496('0x4b')]['id'];}return db[_0x5496('0x2f')][_0x5496('0x49')]({'where':{'id':_0x2959f5[_0x5496('0x45')]['id']}})[_0x5496('0x26')](handleEntityNotFound(_0x346bfe,null))[_0x5496('0x26')](saveUpdates(_0x2959f5[_0x5496('0x4b')],null))[_0x5496('0x26')](respondWithResult(_0x346bfe,null))[_0x5496('0x43')](handleError(_0x346bfe,null));};exports[_0x5496('0x27')]=function(_0x49bb29,_0x4704f7){return db[_0x5496('0x2f')][_0x5496('0x49')]({'where':{'id':_0x49bb29[_0x5496('0x45')]['id']}})['then'](handleEntityNotFound(_0x4704f7,null))['then'](removeEntity(_0x4704f7,null))[_0x5496('0x43')](handleError(_0x4704f7,null));};exports[_0x5496('0x55')]=function(_0x45dc59,_0x2c692c){var _0x241c0b=0xa;var _0x4306b7=[_0x5496('0x56'),'left_join',_0x5496('0x57'),_0x5496('0x58')];var _0x1989e1={'SUM':_0x5496('0x59'),'COUNT':_0x5496('0x5a'),'COUNT DISTINCT':_0x5496('0x5b'),'MAX':_0x5496('0x5c'),'MIN':_0x5496('0x5d'),'AVG':_0x5496('0x5e'),'GROUP_CONCAT':_0x5496('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x5496('0x60')};var _0x3881ed={'SEC_TO_TIME':_0x5496('0x61'),'DATE':_0x5496('0x62'),'HOUR':_0x5496('0x63'),'ROUND':_0x5496('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x17f5ca=function(_0x22ca99){return!_[_0x5496('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x5496('0x66')],_0x22ca99);};var _0x1b5ff8=function(_0x161e06){if(!_0x161e06||!_0x161e06[_0x5496('0x67')][_0x5496('0x47')]){return'';}for(var _0xe49cfa='(',_0x3d3a9c=0x0;_0x3d3a9c<_0x161e06[_0x5496('0x67')]['length'];_0x3d3a9c+=0x1){_0x3d3a9c>0x0&&(_0xe49cfa+='\x20'+_0x161e06[_0x5496('0x68')]+'\x20');_0xe49cfa+=_0x161e06['rules'][_0x3d3a9c]['group']?_0x1b5ff8(_0x161e06[_0x5496('0x67')][_0x3d3a9c][_0x5496('0x69')]):_0x161e06[_0x5496('0x67')][_0x3d3a9c][_0x5496('0x6a')]+'\x20'+_0x161e06[_0x5496('0x67')][_0x3d3a9c]['condition']+(_0x17f5ca(_0x161e06[_0x5496('0x67')][_0x3d3a9c][_0x5496('0x6b')])?'\x20'+_0x161e06['rules'][_0x3d3a9c][_0x5496('0x6c')]:'');}return _0xe49cfa+')';};var _0x28acc0={'where':{'id':_0x45dc59['params']['id']}},_0x903c49,_0xeb293b,_0x3edb57,_0x4060c0,_0x57320c;_0x28acc0=_[_0x5496('0x3e')]({},_0x28acc0,_0x45dc59[_0x5496('0x6d')]);return db['AnalyticCustomReport']['find'](_0x28acc0)[_0x5496('0x26')](function(_0xb72621){if(_0xb72621){_0x903c49=_0xb72621;return _0xb72621[_0x5496('0x6e')]();}return null;})[_0x5496('0x26')](function(_0x7ca846){if(_0x7ca846){if(!_0x7ca846['length']){throw new db[(_0x5496('0x6f'))]['ValidationErrorItem'](_0x5496('0x70'),0x193);}_0xeb293b=_0x7ca846;return db['AnalyticMetric'][_0x5496('0x41')]({'raw':!![]});}return null;})[_0x5496('0x26')](function(_0x159f83){if(_0x159f83){_0x3edb57=_[_0x5496('0x71')](_0x159f83,'id');var _0x4a9f89;var _0x110dbf=squel[_0x5496('0x72')]();_0x110dbf[_0x5496('0x73')](_0x903c49[_0x5496('0x74')]);for(var _0x2ed9f4=0x0;_0x2ed9f4<_0xeb293b['length'];_0x2ed9f4+=0x1){_0x4a9f89=_0xeb293b[_0x2ed9f4]['MetricId']?_0x3edb57[_0xeb293b[_0x2ed9f4]['MetricId']][_0x5496('0x75')]:_0xeb293b[_0x2ed9f4][_0x5496('0x6a')];_0x4a9f89=_0xeb293b[_0x2ed9f4][_0x5496('0x76')]?_[_0x5496('0x77')](_0x1989e1[_0xeb293b[_0x2ed9f4][_0x5496('0x76')]],'%s',_0x4a9f89):_0x4a9f89;_0x4a9f89=_0xeb293b[_0x2ed9f4]['format']?_[_0x5496('0x77')](_0x3881ed[_0xeb293b[_0x2ed9f4][_0x5496('0x78')]],'%s',_0x4a9f89):_0x4a9f89;if(_0xeb293b[_0x2ed9f4][_0x5496('0x79')]){_0x110dbf['group'](_0x4a9f89);}_0xeb293b[_0x2ed9f4]['orderBy']&&_0x110dbf[_0x5496('0x7a')](_0x4a9f89,_0xeb293b[_0x2ed9f4][_0x5496('0x7b')]===_0x5496('0x7c')?![]:!![]);_0x110dbf[_0x5496('0x6a')](_0x4a9f89,_0xeb293b[_0x2ed9f4][_0x5496('0x7d')]||_0x4a9f89);}if(_0x903c49[_0x5496('0x7e')]){_0x903c49['joins']=JSON[_0x5496('0x7f')](_0x903c49['joins']);for(var _0x26b6a3=0x0;_0x26b6a3<_0x903c49[_0x5496('0x7e')][_0x5496('0x47')];_0x26b6a3+=0x1){if(_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x31')]&&_['includes'](_0x4306b7,_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x31')])&&_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x80')]&&_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x81')]&&_0x903c49['joins'][_0x26b6a3][_0x5496('0x82')]){_0x110dbf[_0x903c49['joins'][_0x26b6a3]['type']](_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x81')],null,util[_0x5496('0x78')]('%s.%s\x20=\x20%s.%s',_0x903c49[_0x5496('0x74')],_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x80')],_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x81')],_0x903c49[_0x5496('0x7e')][_0x26b6a3][_0x5496('0x82')]));}}}if(_0x903c49[_0x5496('0x83')]){_0x903c49[_0x5496('0x83')]=JSON[_0x5496('0x7f')](_0x903c49[_0x5496('0x83')]);_0x110dbf['where'](_0x1b5ff8(_0x903c49['conditions']['group']));}_0x57320c=_0x110dbf[_0x5496('0x84')]();_0x110dbf[_0x5496('0x1f')](_0x241c0b);_0x110dbf[_0x5496('0x1d')](0x0);logger['debug'](_0x5496('0x85'),_0x110dbf[_0x5496('0x86')]());return dbH[_0x5496('0x87')][_0x5496('0x34')](_0x110dbf[_0x5496('0x86')](),{'type':dbH[_0x5496('0x87')]['QueryTypes'][_0x5496('0x88')]});}})[_0x5496('0x26')](respondWithResult(_0x2c692c,null))[_0x5496('0x43')](handleError(_0x2c692c,null));};function runReport(_0x26176b,_0x4dfcfe,_0x192751){var _0x367e83=_0x4dfcfe[_0x5496('0x33')];var _0x3fdb18=0xa;var _0x3fed70=[_0x5496('0x56'),_0x5496('0x89'),_0x5496('0x57'),_0x5496('0x58')];var _0x3b9e05={'SUM':_0x5496('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5496('0x5c'),'MIN':_0x5496('0x5d'),'AVG':_0x5496('0x5e'),'GROUP_CONCAT':_0x5496('0x5f'),'GROUP_CONCAT ASC':_0x5496('0x8a'),'GROUP_CONCAT DESC':_0x5496('0x60')};var _0xecee07={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5496('0x62'),'HOUR':_0x5496('0x63'),'ROUND':_0x5496('0x64'),'UNIX_TIMESTAMP':_0x5496('0x8b')};var _0x192c51=function(_0x3655fd){return!_[_0x5496('0x65')]([_0x5496('0x8c'),'IS\x20NOT\x20NULL',_0x5496('0x8d'),'IS\x20NOT\x20EMPTY'],_0x3655fd);};var _0x1882d9=function(_0x1de82f){if(!_0x1de82f||!_0x1de82f[_0x5496('0x67')][_0x5496('0x47')]){return'';}for(var _0x5e7d34='(',_0x32982c=0x0;_0x32982c<_0x1de82f[_0x5496('0x67')]['length'];_0x32982c+=0x1){_0x32982c>0x0&&(_0x5e7d34+='\x20'+_0x1de82f[_0x5496('0x68')]+'\x20');_0x5e7d34+=_0x1de82f['rules'][_0x32982c]['group']?_0x1882d9(_0x1de82f['rules'][_0x32982c]['group']):_0x1de82f[_0x5496('0x67')][_0x32982c][_0x5496('0x6a')]+'\x20'+_0x1de82f[_0x5496('0x67')][_0x32982c]['condition']+(_0x192c51(_0x1de82f[_0x5496('0x67')][_0x32982c][_0x5496('0x6b')])?'\x20'+_0x1de82f[_0x5496('0x67')][_0x32982c][_0x5496('0x6c')]:'');}return _0x5e7d34+')';};var _0x485cd0={'where':{'id':_0x26176b['id']}},_0x41545d,_0x141227,_0x22db1e,_0x4f5a7f,_0x33cf9c;_0x485cd0=_[_0x5496('0x3e')]({},_0x485cd0,_0x192751);return db[_0x5496('0x2f')][_0x5496('0x49')](_0x485cd0)[_0x5496('0x26')](function(_0x4bb18d){if(_0x4bb18d){_0x41545d=_0x4bb18d;return _0x4bb18d[_0x5496('0x6e')]();}return null;})[_0x5496('0x26')](function(_0xdc4e74){if(_0xdc4e74){if(!_0xdc4e74[_0x5496('0x47')]){throw new db[(_0x5496('0x6f'))][(_0x5496('0x8e'))](_0x5496('0x70'),0x193);}_0x141227=_0xdc4e74;return db[_0x5496('0x8f')][_0x5496('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5cd353){if(_0x5cd353){_0x22db1e=_[_0x5496('0x71')](_0x5cd353,'id');var _0x5c6b0f;var _0x119933=squel[_0x5496('0x72')]();_0x119933[_0x5496('0x73')](_0x41545d[_0x5496('0x74')]);for(var _0x232481=0x0;_0x232481<_0x141227['length'];_0x232481+=0x1){_0x5c6b0f=_0x141227[_0x232481]['MetricId']?_0x22db1e[_0x141227[_0x232481][_0x5496('0x90')]][_0x5496('0x75')]:_0x141227[_0x232481][_0x5496('0x6a')];_0x5c6b0f=_0x141227[_0x232481]['function']?_['replace'](_0x3b9e05[_0x141227[_0x232481][_0x5496('0x76')]],'%s',_0x5c6b0f):_0x5c6b0f;_0x5c6b0f=_0x141227[_0x232481]['format']?_[_0x5496('0x77')](_0xecee07[_0x141227[_0x232481][_0x5496('0x78')]],'%s',_0x5c6b0f):_0x5c6b0f;if(_0x141227[_0x232481]['groupBy']){_0x119933[_0x5496('0x69')](_0x5c6b0f);}_0x141227[_0x232481][_0x5496('0x7b')]&&_0x119933[_0x5496('0x7a')](_0x5c6b0f,_0x141227[_0x232481]['orderBy']===_0x5496('0x7c')?![]:!![]);_0x119933[_0x5496('0x6a')](_0x5c6b0f,_0x141227[_0x232481]['alias']||_0x5c6b0f);}if(_0x41545d[_0x5496('0x7e')]){_0x41545d[_0x5496('0x7e')]=JSON[_0x5496('0x7f')](_0x41545d[_0x5496('0x7e')]);for(var _0x4ff860=0x0;_0x4ff860<_0x41545d['joins'][_0x5496('0x47')];_0x4ff860+=0x1){if(_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x31')]&&_[_0x5496('0x65')](_0x3fed70,_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x31')])&&_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x80')]&&_0x41545d[_0x5496('0x7e')][_0x4ff860]['foreignTable']&&_0x41545d['joins'][_0x4ff860][_0x5496('0x82')]){_0x119933[_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x31')]](_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x81')],null,util[_0x5496('0x78')](_0x5496('0x91'),_0x41545d[_0x5496('0x74')],_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x80')],_0x41545d[_0x5496('0x7e')][_0x4ff860]['foreignTable'],_0x41545d[_0x5496('0x7e')][_0x4ff860][_0x5496('0x82')]));}}}if(_0x41545d['conditions']){_0x41545d[_0x5496('0x83')]=JSON[_0x5496('0x7f')](_0x41545d[_0x5496('0x83')]);_0x119933['where'](_0x1882d9(_0x41545d['conditions'][_0x5496('0x69')]));}_0x33cf9c=_0x119933[_0x5496('0x84')]();_0x119933['limit'](_0x3fdb18);_0x119933[_0x5496('0x1d')](0x0);return;}})[_0x5496('0x26')](function(){if(_0x4dfcfe[_0x5496('0x92')]===_0x5496('0x93')){return null;}var _0x346f91=_[_0x5496('0x3e')](_0x4dfcfe,{'name':_0x4dfcfe[_0x5496('0x94')]||_0x4dfcfe[_0x5496('0x33')]||_0x41545d[_0x5496('0x33')],'basename':_0x367e83,'savename':util[_0x5496('0x78')](_0x5496('0x95'),_0x4dfcfe[_0x5496('0x33')]||_0x41545d[_0x5496('0x33')],require('randomstring')[_0x5496('0x96')](0x4),_0x4dfcfe[_0x5496('0x92')]||_0x5496('0x97')),'reportId':_0x41545d['id'],'reportType':'custom'});return db[_0x5496('0x98')][_0x5496('0x4a')](_0x346f91,{'raw':!![]});})['then'](function(_0x33891f){if(_0x41545d['table']===_0x5496('0x99')){_0x33cf9c[_0x5496('0x3d')](_0x41545d[_0x5496('0x74')]+_0x5496('0x9a'),_0x4dfcfe[_0x5496('0x9b')],_0x4dfcfe['endDate']);}else{_0x33cf9c[_0x5496('0x3d')](_0x41545d['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4dfcfe[_0x5496('0x9b')],_0x4dfcfe[_0x5496('0x9c')]);}if(_0x33891f){logger[_0x5496('0x9d')]('Run\x20Query:',_0x33cf9c['toString']());require(_0x5496('0x9e'))[_0x5496('0x9f')](path['join'](__dirname,_0x5496('0xa0'),_0x33891f['output']),[_0x33891f['id'],_0x33cf9c[_0x5496('0x86')](),path[_0x5496('0x56')](__dirname,_0x5496('0xa1'),_0x33891f[_0x5496('0xa2')]),_0x367e83]);return _0x33891f;}else{var _0x550544=squel[_0x5496('0x72')]();_0x550544[_0x5496('0x73')]('('+_0x33cf9c['toString']()+')',_0x5496('0xa3'));_0x550544[_0x5496('0x6a')](_0x5496('0xa4'),_0x5496('0x20'));_0x33cf9c[_0x5496('0x1f')](_0x4dfcfe['limit']||_0x3fdb18);_0x33cf9c[_0x5496('0x1d')](_0x4dfcfe[_0x5496('0x1d')]||0x0);return dbH[_0x5496('0x87')]['query'](_0x550544[_0x5496('0x86')](),{'type':dbH[_0x5496('0x87')][_0x5496('0xa5')]['SELECT']})[_0x5496('0x26')](function(_0x12071b){if(!_0x12071b[_0x5496('0x47')]){_0x4f5a7f=0x0;}else{_0x4f5a7f=_0x12071b[0x0][_0x5496('0x20')]||0x0;}return dbH[_0x5496('0x87')][_0x5496('0x34')](_0x33cf9c[_0x5496('0x86')](),{'type':dbH[_0x5496('0x87')]['QueryTypes']['SELECT']});})[_0x5496('0x26')](function(_0xf3016a){return{'rows':_0xf3016a||[],'count':_0x4f5a7f};});}});}exports['run']=function(_0x20f65d,_0x2e0327){return runReport(_0x20f65d['params'],_0x20f65d['query'],_0x20f65d[_0x5496('0x6d')])[_0x5496('0x26')](respondWithResult(_0x2e0327,null))[_0x5496('0x43')](handleError(_0x2e0327,null));};exports[_0x5496('0xa6')]=runReport;exports['query']=function(_0x5ce282,_0x5531da){var _0x56010c=0xa;var _0x4ece2b=[_0x5496('0x56'),_0x5496('0x89'),_0x5496('0x57'),_0x5496('0x58')];var _0x231272={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5496('0x5b'),'MAX':_0x5496('0x5c'),'MIN':_0x5496('0x5d'),'AVG':_0x5496('0x5e'),'GROUP_CONCAT':_0x5496('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x200b34={'SEC_TO_TIME':_0x5496('0x61'),'DATE':_0x5496('0x62'),'HOUR':_0x5496('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5496('0x8b')};var _0x1c4ed7=function(_0xc50b3d){return!_[_0x5496('0x65')]([_0x5496('0x8c'),_0x5496('0xa7'),_0x5496('0x8d'),_0x5496('0x66')],_0xc50b3d);};var _0x3538ef=function(_0x3020f1){if(!_0x3020f1||!_0x3020f1[_0x5496('0x67')][_0x5496('0x47')]){return'';}for(var _0x3e3bb1='(',_0x518182=0x0;_0x518182<_0x3020f1[_0x5496('0x67')][_0x5496('0x47')];_0x518182+=0x1){_0x518182>0x0&&(_0x3e3bb1+='\x20'+_0x3020f1[_0x5496('0x68')]+'\x20');_0x3e3bb1+=_0x3020f1[_0x5496('0x67')][_0x518182][_0x5496('0x69')]?_0x3538ef(_0x3020f1['rules'][_0x518182][_0x5496('0x69')]):_0x3020f1['rules'][_0x518182][_0x5496('0x6a')]+'\x20'+_0x3020f1[_0x5496('0x67')][_0x518182][_0x5496('0x6b')]+(_0x1c4ed7(_0x3020f1[_0x5496('0x67')][_0x518182]['condition'])?'\x20'+_0x3020f1[_0x5496('0x67')][_0x518182][_0x5496('0x6c')]:'');}return _0x3e3bb1+')';};var _0x405b70={'where':{'id':_0x5ce282[_0x5496('0x45')]['id']}},_0x62feb6,_0xf0f0a8,_0x1a1faf,_0x1481d9,_0x5e4929;_0x405b70=_[_0x5496('0x3e')]({},_0x405b70,_0x5ce282['options']);return db[_0x5496('0x2f')][_0x5496('0x49')](_0x405b70)['then'](function(_0x24b22e){if(_0x24b22e){_0x62feb6=_0x24b22e;return _0x24b22e[_0x5496('0x6e')]();}return null;})[_0x5496('0x26')](function(_0x3e6c1b){if(_0x3e6c1b){if(!_0x3e6c1b['length']){throw new db[(_0x5496('0x6f'))][(_0x5496('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf0f0a8=_0x3e6c1b;return db['AnalyticMetric'][_0x5496('0x41')]({'raw':!![]});}return null;})[_0x5496('0x26')](function(_0x4a8bbc){if(_0x4a8bbc){_0x1a1faf=_['keyBy'](_0x4a8bbc,'id');var _0x116dee;var _0x8caa9=squel[_0x5496('0x72')]();_0x8caa9[_0x5496('0x73')](_0x62feb6['table']);for(var _0x25792f=0x0;_0x25792f<_0xf0f0a8['length'];_0x25792f+=0x1){_0x116dee=_0xf0f0a8[_0x25792f][_0x5496('0x90')]?_0x1a1faf[_0xf0f0a8[_0x25792f][_0x5496('0x90')]]['metric']:_0xf0f0a8[_0x25792f][_0x5496('0x6a')];_0x116dee=_0xf0f0a8[_0x25792f][_0x5496('0x76')]?_[_0x5496('0x77')](_0x231272[_0xf0f0a8[_0x25792f][_0x5496('0x76')]],'%s',_0x116dee):_0x116dee;_0x116dee=_0xf0f0a8[_0x25792f][_0x5496('0x78')]?_[_0x5496('0x77')](_0x200b34[_0xf0f0a8[_0x25792f][_0x5496('0x78')]],'%s',_0x116dee):_0x116dee;if(_0xf0f0a8[_0x25792f][_0x5496('0x79')]){_0x8caa9[_0x5496('0x69')](_0x116dee);}_0xf0f0a8[_0x25792f]['orderBy']&&_0x8caa9[_0x5496('0x7a')](_0x116dee,_0xf0f0a8[_0x25792f][_0x5496('0x7b')]==='DESC'?![]:!![]);_0x8caa9[_0x5496('0x6a')](_0x116dee,_0xf0f0a8[_0x25792f][_0x5496('0x7d')]||_0x116dee);}if(_0x62feb6['joins']){_0x62feb6[_0x5496('0x7e')]=JSON['parse'](_0x62feb6[_0x5496('0x7e')]);for(var _0x5375c8=0x0;_0x5375c8<_0x62feb6[_0x5496('0x7e')][_0x5496('0x47')];_0x5375c8+=0x1){if(_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x31')]&&_[_0x5496('0x65')](_0x4ece2b,_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x31')])&&_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x80')]&&_0x62feb6['joins'][_0x5375c8][_0x5496('0x81')]&&_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x82')]){_0x8caa9[_0x62feb6[_0x5496('0x7e')][_0x5375c8]['type']](_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x81')],null,util['format'](_0x5496('0x91'),_0x62feb6[_0x5496('0x74')],_0x62feb6[_0x5496('0x7e')][_0x5375c8]['parentKey'],_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x81')],_0x62feb6[_0x5496('0x7e')][_0x5375c8][_0x5496('0x82')]));}}}if(_0x62feb6[_0x5496('0x83')]){_0x62feb6[_0x5496('0x83')]=JSON[_0x5496('0x7f')](_0x62feb6[_0x5496('0x83')]);_0x8caa9[_0x5496('0x3d')](_0x3538ef(_0x62feb6[_0x5496('0x83')][_0x5496('0x69')]));}_0x5e4929=_0x8caa9[_0x5496('0x84')]();_0x8caa9[_0x5496('0x1f')](_0x56010c);_0x8caa9[_0x5496('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x8caa9[_0x5496('0x86')]());return dbH[_0x5496('0x87')][_0x5496('0x34')](_0x8caa9[_0x5496('0x86')](),{'type':dbH['sequelize'][_0x5496('0xa5')]['SELECT']});}})[_0x5496('0x26')](function(){return{'sql':_0x5e4929[_0x5496('0x86')]()};})[_0x5496('0x26')](respondWithResult(_0x5531da,null))[_0x5496('0x43')](handleError(_0x5531da,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 210aecb..799d8e6 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 _0x739a=['exports','define','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','path','./analyticCustomReport.attributes'];(function(_0x49fb2d,_0x34b0ca){var _0x29996c=function(_0x36fcf5){while(--_0x36fcf5){_0x49fb2d['push'](_0x49fb2d['shift']());}};_0x29996c(++_0x34b0ca);}(_0x739a,0xe9));var _0xa739=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x739a[_0x14e393];return _0x5b5ffa;};'use strict';var _=require('lodash');var util=require(_0xa739('0x0'));var logger=require(_0xa739('0x1'))(_0xa739('0x2'));var moment=require(_0xa739('0x3'));var BPromise=require(_0xa739('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa739('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa739('0x6'));module[_0xa739('0x7')]=function(_0x522db8,_0xcde1f5){return _0x522db8[_0xa739('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xa739('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4703=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','analytics_custom_reports','lodash'];(function(_0x4f7269,_0x33cbc1){var _0xc6b419=function(_0x1b3dfe){while(--_0x1b3dfe){_0x4f7269['push'](_0x4f7269['shift']());}};_0xc6b419(++_0x33cbc1);}(_0x4703,0x13a));var _0x3470=function(_0x23200d,_0x15fb6e){_0x23200d=_0x23200d-0x0;var _0x3f8381=_0x4703[_0x23200d];return _0x3f8381;};'use strict';var _=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var logger=require(_0x3470('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3470('0x3'));var rp=require(_0x3470('0x4'));var fs=require('fs');var path=require(_0x3470('0x5'));var rimraf=require(_0x3470('0x6'));var config=require(_0x3470('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x461e9c,_0x1f995c){return _0x461e9c['define']('AnalyticCustomReport',attributes,{'tableName':_0x3470('0x8'),'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 6a9d18d..6790c98 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 _0x8d88=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x26d70d,_0x1c9224){var _0x43d4e3=function(_0x130b27){while(--_0x130b27){_0x26d70d['push'](_0x26d70d['shift']());}};_0x43d4e3(++_0x1c9224);}(_0x8d88,0x7e));var _0x88d8=function(_0x2ba279,_0x4297a0){_0x2ba279=_0x2ba279-0x0;var _0xea4ae1=_0x8d88[_0x2ba279];return _0xea4ae1;};'use strict';var _=require(_0x88d8('0x0'));var util=require(_0x88d8('0x1'));var moment=require('moment');var BPromise=require(_0x88d8('0x2'));var rs=require(_0x88d8('0x3'));var fs=require('fs');var Redis=require(_0x88d8('0x4'));var db=require(_0x88d8('0x5'))['db'];var utils=require(_0x88d8('0x6'));var logger=require(_0x88d8('0x7'))(_0x88d8('0x8'));var config=require(_0x88d8('0x9'));var jayson=require(_0x88d8('0xa'));var client=jayson[_0x88d8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51cc60,_0x5a31a9,_0x1696af){return new BPromise(function(_0x1bdfbb,_0x43bf47){return client[_0x88d8('0xc')](_0x51cc60,_0x1696af)[_0x88d8('0xd')](function(_0x3e9e75){logger['info'](_0x88d8('0xe'),_0x5a31a9,_0x88d8('0xf'));logger[_0x88d8('0x10')](_0x88d8('0x11'),_0x5a31a9,'request\x20sent',JSON[_0x88d8('0x12')](_0x3e9e75));if(_0x3e9e75[_0x88d8('0x13')]){if(_0x3e9e75[_0x88d8('0x13')]['code']===0x1f4){logger[_0x88d8('0x13')](_0x88d8('0xe'),_0x5a31a9,_0x3e9e75[_0x88d8('0x13')]['message']);return _0x43bf47(_0x3e9e75['error'][_0x88d8('0x14')]);}logger[_0x88d8('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a31a9,_0x3e9e75[_0x88d8('0x13')][_0x88d8('0x14')]);return _0x1bdfbb(_0x3e9e75[_0x88d8('0x13')][_0x88d8('0x14')]);}else{logger[_0x88d8('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a31a9,_0x88d8('0xf'));_0x1bdfbb(_0x3e9e75[_0x88d8('0x16')][_0x88d8('0x14')]);}})[_0x88d8('0x17')](function(_0x453714){logger[_0x88d8('0x13')](_0x88d8('0xe'),_0x5a31a9,_0x453714);_0x43bf47(_0x453714);});});} \ No newline at end of file +var _0xa521=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x4a8d56,_0x2c7781){var _0x35a536=function(_0x4fa9fc){while(--_0x4fa9fc){_0x4a8d56['push'](_0x4a8d56['shift']());}};_0x35a536(++_0x2c7781);}(_0xa521,0x130));var _0x1a52=function(_0x507662,_0x3b907d){_0x507662=_0x507662-0x0;var _0x4e266a=_0xa521[_0x507662];return _0x4e266a;};'use strict';var _=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var moment=require('moment');var BPromise=require(_0x1a52('0x2'));var rs=require(_0x1a52('0x3'));var fs=require('fs');var Redis=require(_0x1a52('0x4'));var db=require(_0x1a52('0x5'))['db'];var utils=require(_0x1a52('0x6'));var logger=require('../../config/logger')(_0x1a52('0x7'));var config=require(_0x1a52('0x8'));var jayson=require(_0x1a52('0x9'));var client=jayson[_0x1a52('0xa')][_0x1a52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb2b4,_0x5e50d1,_0x34abc9){return new BPromise(function(_0x1e0e25,_0x3ee25e){return client[_0x1a52('0xc')](_0x1eb2b4,_0x34abc9)[_0x1a52('0xd')](function(_0x1bdafa){logger[_0x1a52('0xe')](_0x1a52('0xf'),_0x5e50d1,_0x1a52('0x10'));logger[_0x1a52('0x11')](_0x1a52('0x12'),_0x5e50d1,'request\x20sent',JSON['stringify'](_0x1bdafa));if(_0x1bdafa[_0x1a52('0x13')]){if(_0x1bdafa[_0x1a52('0x13')]['code']===0x1f4){logger[_0x1a52('0x13')](_0x1a52('0xf'),_0x5e50d1,_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);return _0x3ee25e(_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);}logger[_0x1a52('0x13')](_0x1a52('0xf'),_0x5e50d1,_0x1bdafa[_0x1a52('0x13')]['message']);return _0x1e0e25(_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);}else{logger[_0x1a52('0xe')](_0x1a52('0xf'),_0x5e50d1,_0x1a52('0x10'));_0x1e0e25(_0x1bdafa[_0x1a52('0x15')]['message']);}})['catch'](function(_0x1f0b00){logger[_0x1a52('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e50d1,_0x1f0b00);_0x3ee25e(_0x1f0b00);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 48babc1..3e8a28b 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 _0xca43=['get','isAuthenticated','index','run','/:id/query','query','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0xca43,0x98));var _0x3ca4=function(_0x533b52,_0xe4951d){_0x533b52=_0x533b52-0x0;var _0x57c72d=_0xca43[_0x533b52];return _0x57c72d;};'use strict';var multer=require(_0x3ca4('0x0'));var util=require(_0x3ca4('0x1'));var path=require('path');var timeout=require(_0x3ca4('0x2'));var express=require(_0x3ca4('0x3'));var router=express['Router']();var fs_extra=require(_0x3ca4('0x4'));var auth=require(_0x3ca4('0x5'));var interaction=require(_0x3ca4('0x6'));var config=require('../../config/environment');var controller=require(_0x3ca4('0x7'));router[_0x3ca4('0x8')]('/',auth[_0x3ca4('0x9')](),controller[_0x3ca4('0xa')]);router[_0x3ca4('0x8')]('/:id',auth[_0x3ca4('0x9')](),controller['show']);router[_0x3ca4('0x8')]('/:id/preview',auth[_0x3ca4('0x9')](),controller['preview']);router[_0x3ca4('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x3ca4('0xb')]);router['get'](_0x3ca4('0xc'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0xd')]);router[_0x3ca4('0xe')]('/',auth[_0x3ca4('0x9')](),controller['create']);router[_0x3ca4('0xf')](_0x3ca4('0x10'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0x11')]);router['delete'](_0x3ca4('0x10'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0x12')]);module[_0x3ca4('0x13')]=router; \ No newline at end of file +var _0x2ed4=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5b217c,_0x5772e4){var _0x34a5a7=function(_0x27c81c){while(--_0x27c81c){_0x5b217c['push'](_0x5b217c['shift']());}};_0x34a5a7(++_0x5772e4);}(_0x2ed4,0x1c1));var _0x42ed=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x2ed4[_0x335271];return _0xa9fff8;};'use strict';var multer=require('multer');var util=require(_0x42ed('0x0'));var path=require(_0x42ed('0x1'));var timeout=require(_0x42ed('0x2'));var express=require(_0x42ed('0x3'));var router=express['Router']();var fs_extra=require(_0x42ed('0x4'));var auth=require(_0x42ed('0x5'));var interaction=require(_0x42ed('0x6'));var config=require(_0x42ed('0x7'));var controller=require(_0x42ed('0x8'));router[_0x42ed('0x9')]('/',auth[_0x42ed('0xa')](),controller[_0x42ed('0xb')]);router[_0x42ed('0x9')](_0x42ed('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x42ed('0xd'),auth['isAuthenticated'](),controller[_0x42ed('0xe')]);router[_0x42ed('0x9')](_0x42ed('0xf'),auth['isAuthenticated'](),controller[_0x42ed('0x10')]);router[_0x42ed('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0x42ed('0x11')]);router[_0x42ed('0x12')]('/',auth[_0x42ed('0xa')](),controller['create']);router[_0x42ed('0x13')](_0x42ed('0xc'),auth[_0x42ed('0xa')](),controller[_0x42ed('0x14')]);router[_0x42ed('0x15')]('/:id',auth[_0x42ed('0xa')](),controller[_0x42ed('0x16')]);module[_0x42ed('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 1b844a3..7a56dc1 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(_0x5ebcef,_0x3f589b){var _0x156a55=function(_0x47be86){while(--_0x47be86){_0x5ebcef['push'](_0x5ebcef['shift']());}};_0x156a55(++_0x3f589b);}(_0x33c5,0xe6));var _0x533c=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0x33c5[_0x336df4];return _0x580d8c;};'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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x11899b,_0x5ae021){var _0x471131=function(_0x3cc99d){while(--_0x3cc99d){_0x11899b['push'](_0x11899b['shift']());}};_0x471131(++_0x5ae021);}(_0x5fc3,0xa8));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 30baa99..3bcacea 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 _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x6606cf,_0x3ddf46){var _0x2787e6=function(_0x52e736){while(--_0x52e736){_0x6606cf['push'](_0x6606cf['shift']());}};_0x2787e6(++_0x3ddf46);}(_0x0295,0x1f0));var _0x5029=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0x0295[_0x1f94b0];return _0x5cba72;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x521940,_0x58f663){var _0x4fd0cf=function(_0x3c9b0d){while(--_0x3c9b0d){_0x521940['push'](_0x521940['shift']());}};_0x4fd0cf(++_0x58f663);}(_0x4975,0x86));var _0x5497=function(_0x54e266,_0x2a8bda){_0x54e266=_0x54e266-0x0;var _0x48334f=_0x4975[_0x54e266];return _0x48334f;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 37c5be6..ccb634a 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 _0xca93=['../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','util','../../config/logger','api','moment','path','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xca93,0xae));var _0x3ca9=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xca93[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x3ca9('0x0'));var logger=require(_0x3ca9('0x1'))(_0x3ca9('0x2'));var moment=require(_0x3ca9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca9('0x4'));var rimraf=require(_0x3ca9('0x5'));var config=require(_0x3ca9('0x6'));var attributes=require(_0x3ca9('0x7'));module[_0x3ca9('0x8')]=function(_0x10bfa1,_0x31e32b){return _0x10bfa1['define']('AnalyticDefaultReport',attributes,{'tableName':_0x3ca9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1b7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_default_reports','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1b7,0x134));var _0x7f1b=function(_0x5be16a,_0x145a69){_0x5be16a=_0x5be16a-0x0;var _0x5eb46e=_0xf1b7[_0x5be16a];return _0x5eb46e;};'use strict';var _=require('lodash');var util=require(_0x7f1b('0x0'));var logger=require(_0x7f1b('0x1'))(_0x7f1b('0x2'));var moment=require(_0x7f1b('0x3'));var BPromise=require(_0x7f1b('0x4'));var rp=require(_0x7f1b('0x5'));var fs=require('fs');var path=require(_0x7f1b('0x6'));var rimraf=require(_0x7f1b('0x7'));var config=require(_0x7f1b('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x7f1b('0x9')]=function(_0x45e584,_0x584877){return _0x45e584[_0x7f1b('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x7f1b('0xb'),'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 1d8e83d..2a814b8 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 _0x503b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x503b,0x73));var _0xb503=function(_0x486805,_0x12bd34){_0x486805=_0x486805-0x0;var _0x2e9173=_0x503b[_0x486805];return _0x2e9173;};'use strict';var _=require(_0xb503('0x0'));var util=require(_0xb503('0x1'));var moment=require(_0xb503('0x2'));var BPromise=require(_0xb503('0x3'));var rs=require(_0xb503('0x4'));var fs=require('fs');var Redis=require(_0xb503('0x5'));var db=require(_0xb503('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb503('0x7'));var config=require(_0xb503('0x8'));var jayson=require(_0xb503('0x9'));var client=jayson[_0xb503('0xa')][_0xb503('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a8b7,_0x1d7b1b,_0x34504b){return new BPromise(function(_0x4409de,_0x4e15cd){return client[_0xb503('0xc')](_0x39a8b7,_0x34504b)['then'](function(_0x354eb0){logger['info'](_0xb503('0xd'),_0x1d7b1b,_0xb503('0xe'));logger['debug'](_0xb503('0xf'),_0x1d7b1b,_0xb503('0xe'),JSON[_0xb503('0x10')](_0x354eb0));if(_0x354eb0[_0xb503('0x11')]){if(_0x354eb0[_0xb503('0x11')][_0xb503('0x12')]===0x1f4){logger[_0xb503('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1d7b1b,_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);return _0x4e15cd(_0x354eb0['error'][_0xb503('0x13')]);}logger[_0xb503('0x11')](_0xb503('0xd'),_0x1d7b1b,_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);return _0x4409de(_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);}else{logger[_0xb503('0x14')](_0xb503('0xd'),_0x1d7b1b,'request\x20sent');_0x4409de(_0x354eb0[_0xb503('0x15')][_0xb503('0x13')]);}})[_0xb503('0x16')](function(_0x89df0f){logger[_0xb503('0x11')](_0xb503('0xd'),_0x1d7b1b,_0x89df0f);_0x4e15cd(_0x89df0f);});});} \ No newline at end of file +var _0x756d=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40cded,_0x39ce20){var _0x50fcda=function(_0x15b3ce){while(--_0x15b3ce){_0x40cded['push'](_0x40cded['shift']());}};_0x50fcda(++_0x39ce20);}(_0x756d,0x82));var _0xd756=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x756d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd756('0x0'));var util=require('util');var moment=require(_0xd756('0x1'));var BPromise=require(_0xd756('0x2'));var rs=require(_0xd756('0x3'));var fs=require('fs');var Redis=require(_0xd756('0x4'));var db=require(_0xd756('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd756('0x6'));var jayson=require(_0xd756('0x7'));var client=jayson[_0xd756('0x8')][_0xd756('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2524b5,_0x47b9a1,_0x19727d){return new BPromise(function(_0x6a637d,_0x5e8ac1){return client[_0xd756('0xa')](_0x2524b5,_0x19727d)[_0xd756('0xb')](function(_0x5e809d){logger['info'](_0xd756('0xc'),_0x47b9a1,'request\x20sent');logger['debug'](_0xd756('0xd'),_0x47b9a1,_0xd756('0xe'),JSON[_0xd756('0xf')](_0x5e809d));if(_0x5e809d['error']){if(_0x5e809d[_0xd756('0x10')][_0xd756('0x11')]===0x1f4){logger[_0xd756('0x10')](_0xd756('0xc'),_0x47b9a1,_0x5e809d['error'][_0xd756('0x12')]);return _0x5e8ac1(_0x5e809d[_0xd756('0x10')]['message']);}logger[_0xd756('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x47b9a1,_0x5e809d[_0xd756('0x10')][_0xd756('0x12')]);return _0x6a637d(_0x5e809d[_0xd756('0x10')]['message']);}else{logger['info'](_0xd756('0xc'),_0x47b9a1,'request\x20sent');_0x6a637d(_0x5e809d[_0xd756('0x13')][_0xd756('0x12')]);}})[_0xd756('0x14')](function(_0x2525cf){logger[_0xd756('0x10')](_0xd756('0xc'),_0x47b9a1,_0x2525cf);_0x5e8ac1(_0x2525cf);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f382753..05361e0 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 _0xc97e=['Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','post','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x17dde4,_0x5c5ada){var _0x2a1076=function(_0x2b9df8){while(--_0x2b9df8){_0x17dde4['push'](_0x17dde4['shift']());}};_0x2a1076(++_0x5c5ada);}(_0xc97e,0x19f));var _0xec97=function(_0x291a25,_0x31ae01){_0x291a25=_0x291a25-0x0;var _0x380fab=_0xc97e[_0x291a25];return _0x380fab;};'use strict';var multer=require(_0xec97('0x0'));var util=require('util');var path=require(_0xec97('0x1'));var timeout=require(_0xec97('0x2'));var express=require('express');var router=express[_0xec97('0x3')]();var fs_extra=require(_0xec97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec97('0x5'));var controller=require(_0xec97('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xec97('0x7')]);router[_0xec97('0x8')](_0xec97('0x9'),auth[_0xec97('0xa')](),controller[_0xec97('0xb')]);router[_0xec97('0x8')](_0xec97('0xc'),auth[_0xec97('0xa')](),controller[_0xec97('0xd')]);router['get']('/:id/run',auth[_0xec97('0xa')](),controller[_0xec97('0xe')]);router[_0xec97('0x8')](_0xec97('0xf'),auth['isAuthenticated'](),controller[_0xec97('0x10')]);router[_0xec97('0x11')]('/',auth[_0xec97('0xa')](),controller['create']);router[_0xec97('0x12')](_0xec97('0x9'),auth[_0xec97('0xa')](),controller[_0xec97('0x13')]);router[_0xec97('0x14')](_0xec97('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xec97('0x15')]=router; \ No newline at end of file +var _0xb296=['show','/:id/preview','preview','/:id/run','run','query','post','create','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated'];(function(_0x20b12e,_0x2e7c49){var _0x1772a0=function(_0x5865ce){while(--_0x5865ce){_0x20b12e['push'](_0x20b12e['shift']());}};_0x1772a0(++_0x2e7c49);}(_0xb296,0xa3));var _0x6b29=function(_0x6460fa,_0x322653){_0x6460fa=_0x6460fa-0x0;var _0x4422ac=_0xb296[_0x6460fa];return _0x4422ac;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require(_0x6b29('0x2'));var timeout=require(_0x6b29('0x3'));var express=require(_0x6b29('0x4'));var router=express[_0x6b29('0x5')]();var fs_extra=require(_0x6b29('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6b29('0x7'));var config=require('../../config/environment');var controller=require(_0x6b29('0x8'));router[_0x6b29('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b29('0xa')]);router[_0x6b29('0x9')](_0x6b29('0xb'),auth[_0x6b29('0xc')](),controller[_0x6b29('0xd')]);router['get'](_0x6b29('0xe'),auth[_0x6b29('0xc')](),controller[_0x6b29('0xf')]);router[_0x6b29('0x9')](_0x6b29('0x10'),auth[_0x6b29('0xc')](),controller[_0x6b29('0x11')]);router[_0x6b29('0x9')]('/:id/query',auth[_0x6b29('0xc')](),controller[_0x6b29('0x12')]);router[_0x6b29('0x13')]('/',auth['isAuthenticated'](),controller[_0x6b29('0x14')]);router['put']('/:id',auth[_0x6b29('0xc')](),controller['update']);router['delete'](_0x6b29('0xb'),auth[_0x6b29('0xc')](),controller['destroy']);module[_0x6b29('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index edf937b..4e93e74 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 _0xbae3=['scheduled','sequelize','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xbae3,0x90));var _0x3bae=function(_0x5ddc6a,_0x5aa4ee){_0x5ddc6a=_0x5ddc6a-0x0;var _0x5d297e=_0xbae3[_0x5ddc6a];return _0x5d297e;};'use strict';var Sequelize=require(_0x3bae('0x0'));var moment=require('moment');module[_0x3bae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x3bae('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x3bae('0x3')]('csv',_0x3bae('0x4'),_0x3bae('0x5')),'allowNull':![],'defaultValue':_0x3bae('0x6')},'savename':{'type':Sequelize[_0x3bae('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3bae('0x7')]},'endDate':{'type':Sequelize[_0x3bae('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x3bae('0x8')},'type':{'type':Sequelize[_0x3bae('0x3')](_0x3bae('0x9'),_0x3bae('0xa')),'allowNull':![],'defaultValue':_0x3bae('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea7e=['STRING','ENUM','csv','DATE','Loading','scheduled','INTEGER','UNSIGNED','sequelize','exports'];(function(_0x570acd,_0x4adcde){var _0x1cd437=function(_0x558416){while(--_0x558416){_0x570acd['push'](_0x570acd['shift']());}};_0x1cd437(++_0x4adcde);}(_0xea7e,0x10c));var _0xeea7=function(_0x30e8db,_0x3dab00){_0x30e8db=_0x30e8db-0x0;var _0x1c7a80=_0xea7e[_0x30e8db];return _0x1c7a80;};'use strict';var Sequelize=require(_0xeea7('0x0'));var moment=require('moment');module[_0xeea7('0x1')]={'name':{'type':Sequelize[_0xeea7('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xeea7('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xeea7('0x3')](_0xeea7('0x4'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xeea7('0x4')},'savename':{'type':Sequelize[_0xeea7('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xeea7('0x5')]},'endDate':{'type':Sequelize[_0xeea7('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xeea7('0x6')},'type':{'type':Sequelize[_0xeea7('0x3')]('manual',_0xeea7('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xeea7('0x8')](0xb)[_0xeea7('0x9')]},'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 1949d08..907286c 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 _0x2617=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','root','%s.%s','toLowerCase','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','name','send','AnalyticExtractedReport','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x4a71f0,_0x5a7b6c){var _0x3b169c=function(_0x342d80){while(--_0x342d80){_0x4a71f0['push'](_0x4a71f0['shift']());}};_0x3b169c(++_0x5a7b6c);}(_0x2617,0xd9));var _0x7261=function(_0x10bfbf,_0x1c839e){_0x10bfbf=_0x10bfbf-0x0;var _0xca4140=_0x2617[_0x10bfbf];return _0xca4140;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7261('0x0'));var jsonpatch=require(_0x7261('0x1'));var rp=require('request-promise');var moment=require(_0x7261('0x2'));var BPromise=require(_0x7261('0x3'));var Mustache=require(_0x7261('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7261('0x5'));var csv=require(_0x7261('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7261('0x7'));var crypto=require(_0x7261('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7261('0x9'));var toCsv=require(_0x7261('0x6'));var querystring=require(_0x7261('0xa'));var Papa=require(_0x7261('0xb'));var Redis=require('ioredis');var authService=require(_0x7261('0xc'));var qs=require(_0x7261('0xd'));var as=require(_0x7261('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7261('0xf'))(_0x7261('0x10'));var utils=require('../../config/utils');var config=require(_0x7261('0x11'));var licenseUtil=require(_0x7261('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3273af,_0x74b3e7){_0x74b3e7=_0x74b3e7||0xcc;return function(_0x229233){if(_0x229233){return _0x3273af[_0x7261('0x13')](_0x74b3e7);}return _0x3273af[_0x7261('0x14')](_0x74b3e7)[_0x7261('0x15')]();};}function respondWithResult(_0x58eeb1,_0x4dafb3){_0x4dafb3=_0x4dafb3||0xc8;return function(_0x19cc84){if(_0x19cc84){return _0x58eeb1[_0x7261('0x14')](_0x4dafb3)[_0x7261('0x16')](_0x19cc84);}};}function respondWithFilteredResult(_0x5d0d40,_0x2a421b){return function(_0xe3bb86){if(_0xe3bb86){var _0x2d47e4=typeof _0x2a421b[_0x7261('0x17')]===_0x7261('0x18')&&typeof _0x2a421b['limit']===_0x7261('0x18');var _0x85d3cb=_0xe3bb86[_0x7261('0x19')];var _0x4ad066=_0x2d47e4?0x0:_0x2a421b[_0x7261('0x17')];var _0x4fdefd=_0x2d47e4?_0xe3bb86[_0x7261('0x19')]:_0x2a421b[_0x7261('0x17')]+_0x2a421b['limit'];var _0x3a3db5;if(_0x4fdefd>=_0x85d3cb){_0x4fdefd=_0x85d3cb;_0x3a3db5=0xc8;}else{_0x3a3db5=0xce;}_0x5d0d40[_0x7261('0x14')](_0x3a3db5);return _0x5d0d40[_0x7261('0x1a')](_0x7261('0x1b'),_0x4ad066+'-'+_0x4fdefd+'/'+_0x85d3cb)[_0x7261('0x16')](_0xe3bb86);}return null;};}function patchUpdates(_0x439359){return function(_0x26bb55){try{jsonpatch[_0x7261('0x1c')](_0x26bb55,_0x439359,!![]);}catch(_0x236bb1){return BPromise[_0x7261('0x1d')](_0x236bb1);}return _0x26bb55['save']();};}function saveUpdates(_0x374710,_0x32edc7){return function(_0x1adf45){if(_0x1adf45){return _0x1adf45[_0x7261('0x1e')](_0x374710)[_0x7261('0x1f')](function(_0x374e96){return _0x374e96;});}return null;};}function removeEntity(_0x278022,_0x54d7cd){return function(_0x237dc3){if(_0x237dc3){return _0x237dc3['destroy']()[_0x7261('0x1f')](function(){var _0x2d5587=_0x237dc3[_0x7261('0x20')]({'plain':!![]});var _0x30e5eb='ExtractedReports';return db[_0x7261('0x21')][_0x7261('0x22')]({'where':{'type':_0x30e5eb,'resourceId':_0x2d5587['id']}})['then'](function(){return _0x237dc3;});})['then'](function(){_0x278022[_0x7261('0x14')](0xcc)[_0x7261('0x15')]();});}};}function handleEntityNotFound(_0x1ef32f,_0x365d38){return function(_0x3362b4){if(!_0x3362b4){_0x1ef32f[_0x7261('0x13')](0x194);}return _0x3362b4;};}function handleError(_0x5dec5b,_0x17bef8){_0x17bef8=_0x17bef8||0x1f4;return function(_0x5a3099){logger[_0x7261('0x23')](_0x5a3099['stack']);if(_0x5a3099[_0x7261('0x24')]){delete _0x5a3099[_0x7261('0x24')];}_0x5dec5b[_0x7261('0x14')](_0x17bef8)[_0x7261('0x25')](_0x5a3099);};}exports['index']=function(_0x36350e,_0x386f1d){var _0x5b5d10={},_0x2d32e3={},_0x49f058={'count':0x0,'rows':[]};var _0x49537b=_['map'](db[_0x7261('0x26')][_0x7261('0x27')],function(_0x5a502a){return{'name':_0x5a502a['fieldName'],'type':_0x5a502a[_0x7261('0x28')][_0x7261('0x29')]};});_0x2d32e3['model']=_[_0x7261('0x2a')](_0x49537b,'name');_0x2d32e3[_0x7261('0x2b')]=_[_0x7261('0x2c')](_0x36350e['query']);_0x2d32e3[_0x7261('0x2d')]=_[_0x7261('0x2e')](_0x2d32e3[_0x7261('0x2f')],_0x2d32e3[_0x7261('0x2b')]);_0x5b5d10[_0x7261('0x30')]=_['intersection'](_0x2d32e3['model'],qs['fields'](_0x36350e[_0x7261('0x2b')][_0x7261('0x31')]));_0x5b5d10[_0x7261('0x30')]=_0x5b5d10[_0x7261('0x30')][_0x7261('0x32')]?_0x5b5d10[_0x7261('0x30')]:_0x2d32e3[_0x7261('0x2f')];if(!_0x36350e['query'][_0x7261('0x33')](_0x7261('0x34'))){_0x5b5d10['limit']=qs[_0x7261('0x35')](_0x36350e[_0x7261('0x2b')][_0x7261('0x35')]);_0x5b5d10[_0x7261('0x17')]=qs[_0x7261('0x17')](_0x36350e[_0x7261('0x2b')]['offset']);}_0x5b5d10[_0x7261('0x36')]=qs[_0x7261('0x37')](_0x36350e[_0x7261('0x2b')][_0x7261('0x37')]);_0x5b5d10[_0x7261('0x38')]=qs[_0x7261('0x2d')](_[_0x7261('0x39')](_0x36350e['query'],_0x2d32e3[_0x7261('0x2d')]),_0x49537b);if(_0x36350e[_0x7261('0x2b')][_0x7261('0x3a')]){_0x5b5d10[_0x7261('0x38')]=_[_0x7261('0x3b')](_0x5b5d10[_0x7261('0x38')],{'$or':_[_0x7261('0x2a')](_0x49537b,function(_0xa68837){if(_0xa68837[_0x7261('0x28')]!==_0x7261('0x3c')){var _0x2514cb={};_0x2514cb[_0xa68837[_0x7261('0x24')]]={'$like':'%'+_0x36350e['query'][_0x7261('0x3a')]+'%'};return _0x2514cb;}})});}_0x5b5d10=_['merge']({},_0x5b5d10,_0x36350e[_0x7261('0x3d')]);var _0x2a9a76={'where':_0x5b5d10[_0x7261('0x38')]};return db[_0x7261('0x26')][_0x7261('0x19')](_0x2a9a76)[_0x7261('0x1f')](function(_0x2e995d){_0x49f058[_0x7261('0x19')]=_0x2e995d;if(_0x36350e[_0x7261('0x2b')][_0x7261('0x3e')]){_0x5b5d10[_0x7261('0x3f')]=[{'all':!![]}];}return db[_0x7261('0x26')][_0x7261('0x40')](_0x5b5d10);})[_0x7261('0x1f')](function(_0x47b0b7){_0x49f058[_0x7261('0x41')]=_0x47b0b7;return _0x49f058;})[_0x7261('0x1f')](respondWithFilteredResult(_0x386f1d,_0x5b5d10))[_0x7261('0x42')](handleError(_0x386f1d,null));};exports[_0x7261('0x43')]=function(_0x258bcd,_0x4c95f5){var _0x538e96={'raw':!![],'where':{'id':_0x258bcd['params']['id']}},_0x10b861={};_0x10b861[_0x7261('0x2f')]=_[_0x7261('0x2c')](db[_0x7261('0x26')][_0x7261('0x27')]);_0x10b861[_0x7261('0x2b')]=_[_0x7261('0x2c')](_0x258bcd['query']);_0x10b861[_0x7261('0x2d')]=_[_0x7261('0x2e')](_0x10b861[_0x7261('0x2f')],_0x10b861['query']);_0x538e96[_0x7261('0x30')]=_[_0x7261('0x2e')](_0x10b861['model'],qs[_0x7261('0x31')](_0x258bcd[_0x7261('0x2b')][_0x7261('0x31')]));_0x538e96[_0x7261('0x30')]=_0x538e96[_0x7261('0x30')][_0x7261('0x32')]?_0x538e96[_0x7261('0x30')]:_0x10b861[_0x7261('0x2f')];if(_0x258bcd[_0x7261('0x2b')][_0x7261('0x3e')]){_0x538e96[_0x7261('0x3f')]=[{'all':!![]}];}_0x538e96=_[_0x7261('0x3b')]({},_0x538e96,_0x258bcd['options']);return db[_0x7261('0x26')][_0x7261('0x44')](_0x538e96)[_0x7261('0x1f')](handleEntityNotFound(_0x4c95f5,null))['then'](respondWithResult(_0x4c95f5,null))['catch'](handleError(_0x4c95f5,null));};exports[_0x7261('0x45')]=function(_0xe74cc4,_0x300acf){return db[_0x7261('0x26')][_0x7261('0x45')](_0xe74cc4[_0x7261('0x46')],{})['then'](function(_0xf733e6){var _0x5baebb=_0xe74cc4[_0x7261('0x47')][_0x7261('0x20')]({'plain':!![]});if(!_0x5baebb)throw new Error(_0x7261('0x48'));if(_0x5baebb['role']==='user'){var _0x36f8c7=_0xf733e6['get']({'plain':!![]});var _0x2809c6=_0x7261('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x2809c6,'userProfileId':_0x5baebb[_0x7261('0x4a')]},'raw':!![]})['then'](function(_0x18a7c2){if(_0x18a7c2&&_0x18a7c2[_0x7261('0x4b')]===0x0){return db[_0x7261('0x21')][_0x7261('0x45')]({'name':_0x36f8c7[_0x7261('0x24')],'resourceId':_0x36f8c7['id'],'type':_0x18a7c2[_0x7261('0x24')],'sectionId':_0x18a7c2['id']},{})[_0x7261('0x1f')](function(){return _0xf733e6;});}else{return _0xf733e6;}})[_0x7261('0x42')](function(_0x4aadc6){logger['error'](_0x7261('0x4c'),_0x4aadc6);throw _0x4aadc6;});}return _0xf733e6;})[_0x7261('0x1f')](respondWithResult(_0x300acf,0xc9))[_0x7261('0x42')](handleError(_0x300acf,null));};exports[_0x7261('0x1e')]=function(_0x52f1b5,_0x19db0e){if(_0x52f1b5['body']['id']){delete _0x52f1b5[_0x7261('0x46')]['id'];}return db[_0x7261('0x26')][_0x7261('0x44')]({'where':{'id':_0x52f1b5[_0x7261('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19db0e,null))[_0x7261('0x1f')](saveUpdates(_0x52f1b5[_0x7261('0x46')],null))[_0x7261('0x1f')](respondWithResult(_0x19db0e,null))[_0x7261('0x42')](handleError(_0x19db0e,null));};exports['destroy']=function(_0x5c78ef,_0x470fee){return db['AnalyticExtractedReport'][_0x7261('0x44')]({'where':{'id':_0x5c78ef['params']['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x470fee,null))[_0x7261('0x1f')](removeEntity(_0x470fee,null))[_0x7261('0x42')](handleError(_0x470fee,null));};exports['download']=function(_0x38d838,_0x2611a6,_0x16d818){return db[_0x7261('0x26')][_0x7261('0x44')]({'where':{'id':_0x38d838[_0x7261('0x4d')]['id']},'attributes':[_0x7261('0x24'),_0x7261('0x4e'),_0x7261('0x4f'),_0x7261('0x50')],'raw':!![]})[_0x7261('0x1f')](handleEntityNotFound(_0x2611a6,null))[_0x7261('0x1f')](function(_0x14006f){if(_0x14006f){if(!fs[_0x7261('0x51')](path[_0x7261('0x52')](config['root'],_0x7261('0x53'),_0x14006f[_0x7261('0x4f')]))){throw new db[(_0x7261('0x54'))][(_0x7261('0x55'))](_0x7261('0x56'));}if(_0x38d838[_0x7261('0x2b')]['exists']){return _0x2611a6[_0x7261('0x13')](0xc8);}return _0x2611a6[_0x7261('0x57')](path[_0x7261('0x52')](config[_0x7261('0x58')],_0x7261('0x53'),_0x14006f[_0x7261('0x4f')]),util['format'](_0x7261('0x59'),_0x14006f[_0x7261('0x4e')]||_0x14006f['name'],_0x14006f['output'][_0x7261('0x5a')]()));}})[_0x7261('0x42')](handleError(_0x2611a6,null));}; \ No newline at end of file +var _0x9d87=['join','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','root','server/files/reports','savename','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','sendStatus','error','send','index','map','AnalyticExtractedReport','key','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','params','rawAttributes','length','options','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','download','basename','output'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9d87,0x191));var _0x79d8=function(_0xbc3cf4,_0x34436c){_0xbc3cf4=_0xbc3cf4-0x0;var _0x20f9ea=_0x9d87[_0xbc3cf4];return _0x20f9ea;};'use strict';var emlformat=require(_0x79d8('0x0'));var rimraf=require(_0x79d8('0x1'));var zipdir=require(_0x79d8('0x2'));var jsonpatch=require(_0x79d8('0x3'));var rp=require(_0x79d8('0x4'));var moment=require('moment');var BPromise=require(_0x79d8('0x5'));var Mustache=require(_0x79d8('0x6'));var util=require(_0x79d8('0x7'));var path=require(_0x79d8('0x8'));var sox=require(_0x79d8('0x9'));var csv=require(_0x79d8('0xa'));var ejs=require(_0x79d8('0xb'));var fs=require('fs');var fs_extra=require(_0x79d8('0xc'));var _=require(_0x79d8('0xd'));var squel=require(_0x79d8('0xe'));var crypto=require('crypto');var jsforce=require(_0x79d8('0xf'));var deskjs=require(_0x79d8('0x10'));var toCsv=require(_0x79d8('0xa'));var querystring=require(_0x79d8('0x11'));var Papa=require(_0x79d8('0x12'));var Redis=require('ioredis');var authService=require(_0x79d8('0x13'));var qs=require(_0x79d8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79d8('0x15'));var logger=require(_0x79d8('0x16'))(_0x79d8('0x17'));var utils=require(_0x79d8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x79d8('0x19'))['db'];function respondWithStatusCode(_0x537a4b,_0x5dda50){_0x5dda50=_0x5dda50||0xcc;return function(_0x3b81ef){if(_0x3b81ef){return _0x537a4b['sendStatus'](_0x5dda50);}return _0x537a4b['status'](_0x5dda50)[_0x79d8('0x1a')]();};}function respondWithResult(_0x5dfccf,_0x55e1ae){_0x55e1ae=_0x55e1ae||0xc8;return function(_0x2f7c23){if(_0x2f7c23){return _0x5dfccf['status'](_0x55e1ae)[_0x79d8('0x1b')](_0x2f7c23);}};}function respondWithFilteredResult(_0x160d9a,_0x2b03a2){return function(_0x364c49){if(_0x364c49){var _0x16d678=typeof _0x2b03a2[_0x79d8('0x1c')]===_0x79d8('0x1d')&&typeof _0x2b03a2[_0x79d8('0x1e')]===_0x79d8('0x1d');var _0x202dac=_0x364c49[_0x79d8('0x1f')];var _0xefcbe5=_0x16d678?0x0:_0x2b03a2[_0x79d8('0x1c')];var _0x33b5dc=_0x16d678?_0x364c49[_0x79d8('0x1f')]:_0x2b03a2[_0x79d8('0x1c')]+_0x2b03a2[_0x79d8('0x1e')];var _0x2e780d;if(_0x33b5dc>=_0x202dac){_0x33b5dc=_0x202dac;_0x2e780d=0xc8;}else{_0x2e780d=0xce;}_0x160d9a[_0x79d8('0x20')](_0x2e780d);return _0x160d9a[_0x79d8('0x21')](_0x79d8('0x22'),_0xefcbe5+'-'+_0x33b5dc+'/'+_0x202dac)[_0x79d8('0x1b')](_0x364c49);}return null;};}function patchUpdates(_0x415b9a){return function(_0x23e324){try{jsonpatch[_0x79d8('0x23')](_0x23e324,_0x415b9a,!![]);}catch(_0x302d9a){return BPromise[_0x79d8('0x24')](_0x302d9a);}return _0x23e324[_0x79d8('0x25')]();};}function saveUpdates(_0x4529d1,_0x34f4e5){return function(_0x157256){if(_0x157256){return _0x157256[_0x79d8('0x26')](_0x4529d1)[_0x79d8('0x27')](function(_0x530faf){return _0x530faf;});}return null;};}function removeEntity(_0x386861,_0x403a75){return function(_0x42cf15){if(_0x42cf15){return _0x42cf15[_0x79d8('0x28')]()[_0x79d8('0x27')](function(){var _0x268593=_0x42cf15['get']({'plain':!![]});var _0x4a6626=_0x79d8('0x29');return db['UserProfileResource'][_0x79d8('0x28')]({'where':{'type':_0x4a6626,'resourceId':_0x268593['id']}})[_0x79d8('0x27')](function(){return _0x42cf15;});})[_0x79d8('0x27')](function(){_0x386861[_0x79d8('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca820,_0x5cb41c){return function(_0x1bf512){if(!_0x1bf512){_0x2ca820[_0x79d8('0x2a')](0x194);}return _0x1bf512;};}function handleError(_0x3aa724,_0x46ab55){_0x46ab55=_0x46ab55||0x1f4;return function(_0x1ddac3){logger[_0x79d8('0x2b')](_0x1ddac3['stack']);if(_0x1ddac3['name']){delete _0x1ddac3['name'];}_0x3aa724[_0x79d8('0x20')](_0x46ab55)[_0x79d8('0x2c')](_0x1ddac3);};}exports[_0x79d8('0x2d')]=function(_0x577d96,_0xd3ed6){var _0x1e5216={},_0x4f8f5f={},_0x40729e={'count':0x0,'rows':[]};var _0x9a7967=_[_0x79d8('0x2e')](db[_0x79d8('0x2f')]['rawAttributes'],function(_0x2aac82){return{'name':_0x2aac82['fieldName'],'type':_0x2aac82['type'][_0x79d8('0x30')]};});_0x4f8f5f[_0x79d8('0x31')]=_['map'](_0x9a7967,_0x79d8('0x32'));_0x4f8f5f['query']=_[_0x79d8('0x33')](_0x577d96[_0x79d8('0x34')]);_0x4f8f5f[_0x79d8('0x35')]=_[_0x79d8('0x36')](_0x4f8f5f[_0x79d8('0x31')],_0x4f8f5f[_0x79d8('0x34')]);_0x1e5216['attributes']=_['intersection'](_0x4f8f5f[_0x79d8('0x31')],qs[_0x79d8('0x37')](_0x577d96[_0x79d8('0x34')][_0x79d8('0x37')]));_0x1e5216['attributes']=_0x1e5216[_0x79d8('0x38')]['length']?_0x1e5216[_0x79d8('0x38')]:_0x4f8f5f[_0x79d8('0x31')];if(!_0x577d96[_0x79d8('0x34')][_0x79d8('0x39')](_0x79d8('0x3a'))){_0x1e5216['limit']=qs[_0x79d8('0x1e')](_0x577d96[_0x79d8('0x34')][_0x79d8('0x1e')]);_0x1e5216[_0x79d8('0x1c')]=qs[_0x79d8('0x1c')](_0x577d96[_0x79d8('0x34')][_0x79d8('0x1c')]);}_0x1e5216[_0x79d8('0x3b')]=qs[_0x79d8('0x3c')](_0x577d96[_0x79d8('0x34')][_0x79d8('0x3c')]);_0x1e5216['where']=qs[_0x79d8('0x35')](_[_0x79d8('0x3d')](_0x577d96[_0x79d8('0x34')],_0x4f8f5f[_0x79d8('0x35')]),_0x9a7967);if(_0x577d96[_0x79d8('0x34')][_0x79d8('0x3e')]){_0x1e5216[_0x79d8('0x3f')]=_[_0x79d8('0x40')](_0x1e5216[_0x79d8('0x3f')],{'$or':_['map'](_0x9a7967,function(_0x2990d9){if(_0x2990d9[_0x79d8('0x41')]!==_0x79d8('0x42')){var _0x1de3a7={};_0x1de3a7[_0x2990d9[_0x79d8('0x32')]]={'$like':'%'+_0x577d96[_0x79d8('0x34')][_0x79d8('0x3e')]+'%'};return _0x1de3a7;}})});}_0x1e5216=_[_0x79d8('0x40')]({},_0x1e5216,_0x577d96['options']);var _0x5595c5={'where':_0x1e5216[_0x79d8('0x3f')]};return db['AnalyticExtractedReport'][_0x79d8('0x1f')](_0x5595c5)[_0x79d8('0x27')](function(_0x1c7761){_0x40729e[_0x79d8('0x1f')]=_0x1c7761;if(_0x577d96['query'][_0x79d8('0x43')]){_0x1e5216[_0x79d8('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x1e5216);})[_0x79d8('0x27')](function(_0x40c771){_0x40729e[_0x79d8('0x45')]=_0x40c771;return _0x40729e;})[_0x79d8('0x27')](respondWithFilteredResult(_0xd3ed6,_0x1e5216))['catch'](handleError(_0xd3ed6,null));};exports['show']=function(_0x271acc,_0x571416){var _0x4d9c89={'raw':!![],'where':{'id':_0x271acc[_0x79d8('0x46')]['id']}},_0x3d3eb9={};_0x3d3eb9[_0x79d8('0x31')]=_[_0x79d8('0x33')](db[_0x79d8('0x2f')][_0x79d8('0x47')]);_0x3d3eb9[_0x79d8('0x34')]=_['keys'](_0x271acc[_0x79d8('0x34')]);_0x3d3eb9[_0x79d8('0x35')]=_[_0x79d8('0x36')](_0x3d3eb9[_0x79d8('0x31')],_0x3d3eb9['query']);_0x4d9c89[_0x79d8('0x38')]=_[_0x79d8('0x36')](_0x3d3eb9[_0x79d8('0x31')],qs[_0x79d8('0x37')](_0x271acc[_0x79d8('0x34')][_0x79d8('0x37')]));_0x4d9c89['attributes']=_0x4d9c89[_0x79d8('0x38')][_0x79d8('0x48')]?_0x4d9c89[_0x79d8('0x38')]:_0x3d3eb9[_0x79d8('0x31')];if(_0x271acc['query'][_0x79d8('0x43')]){_0x4d9c89[_0x79d8('0x44')]=[{'all':!![]}];}_0x4d9c89=_[_0x79d8('0x40')]({},_0x4d9c89,_0x271acc[_0x79d8('0x49')]);return db[_0x79d8('0x2f')][_0x79d8('0x4a')](_0x4d9c89)['then'](handleEntityNotFound(_0x571416,null))[_0x79d8('0x27')](respondWithResult(_0x571416,null))[_0x79d8('0x4b')](handleError(_0x571416,null));};exports[_0x79d8('0x4c')]=function(_0x403a68,_0x4513ab){return db[_0x79d8('0x2f')][_0x79d8('0x4c')](_0x403a68['body'],{})['then'](function(_0xcb6302){var _0x17232d=_0x403a68[_0x79d8('0x4d')][_0x79d8('0x4e')]({'plain':!![]});if(!_0x17232d)throw new Error(_0x79d8('0x4f'));if(_0x17232d[_0x79d8('0x50')]===_0x79d8('0x4d')){var _0x3ddcec=_0xcb6302[_0x79d8('0x4e')]({'plain':!![]});var _0x5ef83c=_0x79d8('0x29');return db[_0x79d8('0x51')][_0x79d8('0x4a')]({'where':{'name':_0x5ef83c,'userProfileId':_0x17232d[_0x79d8('0x52')]},'raw':!![]})[_0x79d8('0x27')](function(_0x38dff){if(_0x38dff&&_0x38dff[_0x79d8('0x53')]===0x0){return db['UserProfileResource'][_0x79d8('0x4c')]({'name':_0x3ddcec[_0x79d8('0x32')],'resourceId':_0x3ddcec['id'],'type':_0x38dff[_0x79d8('0x32')],'sectionId':_0x38dff['id']},{})[_0x79d8('0x27')](function(){return _0xcb6302;});}else{return _0xcb6302;}})['catch'](function(_0x2bf397){logger[_0x79d8('0x2b')](_0x79d8('0x54'),_0x2bf397);throw _0x2bf397;});}return _0xcb6302;})[_0x79d8('0x27')](respondWithResult(_0x4513ab,0xc9))[_0x79d8('0x4b')](handleError(_0x4513ab,null));};exports[_0x79d8('0x26')]=function(_0x2ab03e,_0x473456){if(_0x2ab03e[_0x79d8('0x55')]['id']){delete _0x2ab03e['body']['id'];}return db[_0x79d8('0x2f')][_0x79d8('0x4a')]({'where':{'id':_0x2ab03e[_0x79d8('0x46')]['id']}})[_0x79d8('0x27')](handleEntityNotFound(_0x473456,null))[_0x79d8('0x27')](saveUpdates(_0x2ab03e[_0x79d8('0x55')],null))[_0x79d8('0x27')](respondWithResult(_0x473456,null))[_0x79d8('0x4b')](handleError(_0x473456,null));};exports[_0x79d8('0x28')]=function(_0x2d11a2,_0x939508){return db[_0x79d8('0x2f')][_0x79d8('0x4a')]({'where':{'id':_0x2d11a2['params']['id']}})[_0x79d8('0x27')](handleEntityNotFound(_0x939508,null))[_0x79d8('0x27')](removeEntity(_0x939508,null))[_0x79d8('0x4b')](handleError(_0x939508,null));};exports[_0x79d8('0x56')]=function(_0x2dcc95,_0x25b799,_0x38f7ca){return db['AnalyticExtractedReport'][_0x79d8('0x4a')]({'where':{'id':_0x2dcc95[_0x79d8('0x46')]['id']},'attributes':['name',_0x79d8('0x57'),'savename',_0x79d8('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x25b799,null))[_0x79d8('0x27')](function(_0xabd21b){if(_0xabd21b){if(!fs['existsSync'](path[_0x79d8('0x59')](config['root'],'server/files/reports',_0xabd21b['savename']))){throw new db[(_0x79d8('0x5a'))]['ValidationError'](_0x79d8('0x5b'));}if(_0x2dcc95[_0x79d8('0x34')][_0x79d8('0x5c')]){return _0x25b799['sendStatus'](0xc8);}return _0x25b799[_0x79d8('0x56')](path[_0x79d8('0x59')](config[_0x79d8('0x5d')],_0x79d8('0x5e'),_0xabd21b[_0x79d8('0x5f')]),util[_0x79d8('0x60')]('%s.%s',_0xabd21b['basename']||_0xabd21b['name'],_0xabd21b[_0x79d8('0x58')][_0x79d8('0x61')]()));}})[_0x79d8('0x4b')](handleError(_0x25b799,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 608e47b..aef9d36 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 _0x08e4=['analytics_extracted_reports','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x08e4,0xbf));var _0x408e=function(_0x100a26,_0x6df99c){_0x100a26=_0x100a26-0x0;var _0x371ec4=_0x08e4[_0x100a26];return _0x371ec4;};'use strict';var _=require(_0x408e('0x0'));var util=require('util');var logger=require(_0x408e('0x1'))(_0x408e('0x2'));var moment=require('moment');var BPromise=require(_0x408e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x408e('0x4'));var rimraf=require('rimraf');var config=require(_0x408e('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x408e('0x6')]=function(_0x3c1381,_0x3ddc9b){return _0x3c1381[_0x408e('0x7')](_0x408e('0x8'),attributes,{'tableName':_0x408e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc730=['api','moment','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger'];(function(_0x1f904a,_0x28c22f){var _0xc689ba=function(_0x777474){while(--_0x777474){_0x1f904a['push'](_0x1f904a['shift']());}};_0xc689ba(++_0x28c22f);}(_0xc730,0x181));var _0x0c73=function(_0xa02697,_0x1876fa){_0xa02697=_0xa02697-0x0;var _0x3200f2=_0xc730[_0xa02697];return _0x3200f2;};'use strict';var _=require(_0x0c73('0x0'));var util=require('util');var logger=require(_0x0c73('0x1'))(_0x0c73('0x2'));var moment=require(_0x0c73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c73('0x4'));var config=require(_0x0c73('0x5'));var attributes=require(_0x0c73('0x6'));module['exports']=function(_0x25aae6,_0x39b57e){return _0x25aae6['define'](_0x0c73('0x7'),attributes,{'tableName':_0x0c73('0x8'),'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 12ca829..b54426d 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 _0x330c=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xda3cf9,_0x45a4dc){var _0x22e4b3=function(_0x14361f){while(--_0x14361f){_0xda3cf9['push'](_0xda3cf9['shift']());}};_0x22e4b3(++_0x45a4dc);}(_0x330c,0x14e));var _0xc330=function(_0x4a52df,_0x52142d){_0x4a52df=_0x4a52df-0x0;var _0x38aa1a=_0x330c[_0x4a52df];return _0x38aa1a;};'use strict';var _=require('lodash');var util=require(_0xc330('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc330('0x1'));var fs=require('fs');var Redis=require(_0xc330('0x2'));var db=require(_0xc330('0x3'))['db'];var utils=require(_0xc330('0x4'));var logger=require(_0xc330('0x5'))('rpc');var config=require(_0xc330('0x6'));var jayson=require(_0xc330('0x7'));var client=jayson[_0xc330('0x8')][_0xc330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360d53,_0x1d9ffa,_0x560fdb){return new BPromise(function(_0x404a8d,_0x3e19ef){return client[_0xc330('0xa')](_0x360d53,_0x560fdb)[_0xc330('0xb')](function(_0x2a3d7b){logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,_0xc330('0xe'));logger[_0xc330('0xf')](_0xc330('0x10'),_0x1d9ffa,_0xc330('0xe'),JSON[_0xc330('0x11')](_0x2a3d7b));if(_0x2a3d7b[_0xc330('0x12')]){if(_0x2a3d7b['error'][_0xc330('0x13')]===0x1f4){logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);return _0x3e19ef(_0x2a3d7b[_0xc330('0x12')]['message']);}logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b['error'][_0xc330('0x14')]);return _0x404a8d(_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);}else{logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,'request\x20sent');_0x404a8d(_0x2a3d7b[_0xc330('0x15')][_0xc330('0x14')]);}})[_0xc330('0x16')](function(_0x5f5ab7){logger[_0xc330('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d9ffa,_0x5f5ab7);_0x3e19ef(_0x5f5ab7);});});} \ No newline at end of file +var _0x1ebd=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x1ebd,0x64));var _0xd1eb=function(_0x1de13e,_0x3d9150){_0x1de13e=_0x1de13e-0x0;var _0x3642d5=_0x1ebd[_0x1de13e];return _0x3642d5;};'use strict';var _=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var moment=require(_0xd1eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1eb('0x3'));var fs=require('fs');var Redis=require(_0xd1eb('0x4'));var db=require(_0xd1eb('0x5'))['db'];var utils=require(_0xd1eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd1eb('0x7'));var jayson=require(_0xd1eb('0x8'));var client=jayson['client'][_0xd1eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb4c88d,_0x10555e,_0x5ea9bf){return new BPromise(function(_0x33ce51,_0x209954){return client[_0xd1eb('0xa')](_0xb4c88d,_0x5ea9bf)[_0xd1eb('0xb')](function(_0x14a89b){logger[_0xd1eb('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10555e,_0xd1eb('0xd'));logger[_0xd1eb('0xe')](_0xd1eb('0xf'),_0x10555e,'request\x20sent',JSON[_0xd1eb('0x10')](_0x14a89b));if(_0x14a89b['error']){if(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x12')]===0x1f4){logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x14a89b[_0xd1eb('0x11')]['message']);return _0x209954(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);}logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);return _0x33ce51(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);}else{logger['info'](_0xd1eb('0x13'),_0x10555e,_0xd1eb('0xd'));_0x33ce51(_0x14a89b[_0xd1eb('0x15')][_0xd1eb('0x14')]);}})[_0xd1eb('0x16')](function(_0x3c1834){logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x3c1834);_0x209954(_0x3c1834);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0a37384..518fe9f 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 _0x6d47=['put','update','delete','/:id','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show','/:id/download','download','post','create'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x6d47,0x16a));var _0x76d4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6d47[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require('multer');var util=require(_0x76d4('0x0'));var path=require(_0x76d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76d4('0x2'));var router=express[_0x76d4('0x3')]();var fs_extra=require(_0x76d4('0x4'));var auth=require(_0x76d4('0x5'));var interaction=require(_0x76d4('0x6'));var config=require(_0x76d4('0x7'));var controller=require(_0x76d4('0x8'));router[_0x76d4('0x9')]('/',auth[_0x76d4('0xa')](),controller['index']);router[_0x76d4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x76d4('0xb')]);router[_0x76d4('0x9')](_0x76d4('0xc'),auth[_0x76d4('0xa')](),controller[_0x76d4('0xd')]);router[_0x76d4('0xe')]('/',auth[_0x76d4('0xa')](),controller[_0x76d4('0xf')]);router[_0x76d4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x76d4('0x11')]);router[_0x76d4('0x12')](_0x76d4('0x13'),auth[_0x76d4('0xa')](),controller[_0x76d4('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2f31=['show','/:id/download','download','create','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get'];(function(_0x438472,_0x3a446d){var _0x176019=function(_0x1cd9f7){while(--_0x1cd9f7){_0x438472['push'](_0x438472['shift']());}};_0x176019(++_0x3a446d);}(_0x2f31,0xa8));var _0x12f3=function(_0x5615e0,_0x4c6be2){_0x5615e0=_0x5615e0-0x0;var _0x5d3f10=_0x2f31[_0x5615e0];return _0x5d3f10;};'use strict';var multer=require(_0x12f3('0x0'));var util=require(_0x12f3('0x1'));var path=require(_0x12f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x12f3('0x3'));var router=express[_0x12f3('0x4')]();var fs_extra=require(_0x12f3('0x5'));var auth=require(_0x12f3('0x6'));var interaction=require(_0x12f3('0x7'));var config=require(_0x12f3('0x8'));var controller=require(_0x12f3('0x9'));router['get']('/',auth[_0x12f3('0xa')](),controller['index']);router[_0x12f3('0xb')]('/:id',auth[_0x12f3('0xa')](),controller[_0x12f3('0xc')]);router[_0x12f3('0xb')](_0x12f3('0xd'),auth['isAuthenticated'](),controller[_0x12f3('0xe')]);router['post']('/',auth[_0x12f3('0xa')](),controller[_0x12f3('0xf')]);router['put'](_0x12f3('0x10'),auth[_0x12f3('0xa')](),controller[_0x12f3('0x11')]);router[_0x12f3('0x12')]('/:id',auth[_0x12f3('0xa')](),controller[_0x12f3('0x13')]);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 4e746c5..edf86ea 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 _0x3c72=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x150d3d,_0x2cf026){var _0x5943ec=function(_0x179d45){while(--_0x179d45){_0x150d3d['push'](_0x150d3d['shift']());}};_0x5943ec(++_0x2cf026);}(_0x3c72,0x96));var _0x23c7=function(_0x472904,_0x8d115d){_0x472904=_0x472904-0x0;var _0x3335c2=_0x3c72[_0x472904];return _0x3335c2;};'use strict';var Sequelize=require(_0x23c7('0x0'));module[_0x23c7('0x1')]={'field':{'type':Sequelize[_0x23c7('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x23c7('0x3')]},'format':{'type':Sequelize[_0x23c7('0x3')]},'groupBy':{'type':Sequelize[_0x23c7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x23c7('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf203=['BOOLEAN','exports','TEXT','STRING'];(function(_0x338ea7,_0x102b01){var _0x174ac8=function(_0x3a6031){while(--_0x3a6031){_0x338ea7['push'](_0x338ea7['shift']());}};_0x174ac8(++_0x102b01);}(_0xf203,0x91));var _0x3f20=function(_0x5f5cb1,_0x64666e){_0x5f5cb1=_0x5f5cb1-0x0;var _0x52c12d=_0xf203[_0x5f5cb1];return _0x52c12d;};'use strict';var Sequelize=require('sequelize');module[_0x3f20('0x0')]={'field':{'type':Sequelize[_0x3f20('0x1')]},'alias':{'type':Sequelize[_0x3f20('0x2')]},'function':{'type':Sequelize[_0x3f20('0x2')]},'format':{'type':Sequelize[_0x3f20('0x2')]},'groupBy':{'type':Sequelize[_0x3f20('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3f20('0x2')]},'custom':{'type':Sequelize[_0x3f20('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 6d11d3d..984ac1d 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 _0xfc99=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','bulkCreate','body','params','ids','addFields','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x11da29,_0x5402c1){var _0x434192=function(_0x4c2665){while(--_0x4c2665){_0x11da29['push'](_0x11da29['shift']());}};_0x434192(++_0x5402c1);}(_0xfc99,0x139));var _0x9fc9=function(_0x30d6a5,_0x546523){_0x30d6a5=_0x30d6a5-0x0;var _0x3cd234=_0xfc99[_0x30d6a5];return _0x3cd234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fc9('0x0'));var zipdir=require(_0x9fc9('0x1'));var jsonpatch=require(_0x9fc9('0x2'));var rp=require('request-promise');var moment=require(_0x9fc9('0x3'));var BPromise=require(_0x9fc9('0x4'));var Mustache=require(_0x9fc9('0x5'));var util=require(_0x9fc9('0x6'));var path=require(_0x9fc9('0x7'));var sox=require(_0x9fc9('0x8'));var csv=require('to-csv');var ejs=require(_0x9fc9('0x9'));var fs=require('fs');var fs_extra=require(_0x9fc9('0xa'));var _=require(_0x9fc9('0xb'));var squel=require(_0x9fc9('0xc'));var crypto=require(_0x9fc9('0xd'));var jsforce=require(_0x9fc9('0xe'));var deskjs=require(_0x9fc9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9fc9('0x10'));var Papa=require('papaparse');var Redis=require(_0x9fc9('0x11'));var authService=require(_0x9fc9('0x12'));var qs=require(_0x9fc9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fc9('0x14'))(_0x9fc9('0x15'));var utils=require(_0x9fc9('0x16'));var config=require(_0x9fc9('0x17'));var licenseUtil=require(_0x9fc9('0x18'));var db=require(_0x9fc9('0x19'))['db'];function respondWithStatusCode(_0x5d0c2d,_0x17438f){_0x17438f=_0x17438f||0xcc;return function(_0x31bd6d){if(_0x31bd6d){return _0x5d0c2d[_0x9fc9('0x1a')](_0x17438f);}return _0x5d0c2d[_0x9fc9('0x1b')](_0x17438f)[_0x9fc9('0x1c')]();};}function respondWithResult(_0x17b4ef,_0x31cf8e){_0x31cf8e=_0x31cf8e||0xc8;return function(_0x12693e){if(_0x12693e){return _0x17b4ef[_0x9fc9('0x1b')](_0x31cf8e)[_0x9fc9('0x1d')](_0x12693e);}};}function respondWithFilteredResult(_0x46255e,_0x3e4ad9){return function(_0xd245af){if(_0xd245af){var _0x3bac71=typeof _0x3e4ad9['offset']===_0x9fc9('0x1e')&&typeof _0x3e4ad9[_0x9fc9('0x1f')]==='undefined';var _0x405378=_0xd245af[_0x9fc9('0x20')];var _0x4e64b0=_0x3bac71?0x0:_0x3e4ad9['offset'];var _0x24f6ef=_0x3bac71?_0xd245af[_0x9fc9('0x20')]:_0x3e4ad9[_0x9fc9('0x21')]+_0x3e4ad9[_0x9fc9('0x1f')];var _0x57d610;if(_0x24f6ef>=_0x405378){_0x24f6ef=_0x405378;_0x57d610=0xc8;}else{_0x57d610=0xce;}_0x46255e[_0x9fc9('0x1b')](_0x57d610);return _0x46255e['set'](_0x9fc9('0x22'),_0x4e64b0+'-'+_0x24f6ef+'/'+_0x405378)[_0x9fc9('0x1d')](_0xd245af);}return null;};}function patchUpdates(_0xee665c){return function(_0x4a4b67){try{jsonpatch['apply'](_0x4a4b67,_0xee665c,!![]);}catch(_0x3dca58){return BPromise['reject'](_0x3dca58);}return _0x4a4b67[_0x9fc9('0x23')]();};}function saveUpdates(_0x1768dc,_0x927799){return function(_0x193061){if(_0x193061){return _0x193061[_0x9fc9('0x24')](_0x1768dc)[_0x9fc9('0x25')](function(_0x33e529){return _0x33e529;});}return null;};}function removeEntity(_0x15c9a6,_0x459e0c){return function(_0x5386d8){if(_0x5386d8){return _0x5386d8[_0x9fc9('0x26')]()['then'](function(){_0x15c9a6['status'](0xcc)[_0x9fc9('0x1c')]();});}};}function handleEntityNotFound(_0xa2de9,_0x1b0e2b){return function(_0x17f015){if(!_0x17f015){_0xa2de9[_0x9fc9('0x1a')](0x194);}return _0x17f015;};}function handleError(_0x204317,_0x254165){_0x254165=_0x254165||0x1f4;return function(_0xd432a6){logger['error'](_0xd432a6['stack']);if(_0xd432a6[_0x9fc9('0x27')]){delete _0xd432a6[_0x9fc9('0x27')];}_0x204317['status'](_0x254165)[_0x9fc9('0x28')](_0xd432a6);};}exports['index']=function(_0xeca997,_0x1fb709){var _0x145773={},_0x5c9567={},_0x5e5083={'count':0x0,'rows':[]};var _0x60dc6=_[_0x9fc9('0x29')](db[_0x9fc9('0x2a')][_0x9fc9('0x2b')],function(_0xcbc709){return{'name':_0xcbc709[_0x9fc9('0x2c')],'type':_0xcbc709['type'][_0x9fc9('0x2d')]};});_0x5c9567[_0x9fc9('0x2e')]=_[_0x9fc9('0x29')](_0x60dc6,_0x9fc9('0x27'));_0x5c9567[_0x9fc9('0x2f')]=_['keys'](_0xeca997[_0x9fc9('0x2f')]);_0x5c9567[_0x9fc9('0x30')]=_[_0x9fc9('0x31')](_0x5c9567[_0x9fc9('0x2e')],_0x5c9567['query']);_0x145773['attributes']=_['intersection'](_0x5c9567[_0x9fc9('0x2e')],qs[_0x9fc9('0x32')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x32')]));_0x145773[_0x9fc9('0x33')]=_0x145773[_0x9fc9('0x33')][_0x9fc9('0x34')]?_0x145773[_0x9fc9('0x33')]:_0x5c9567[_0x9fc9('0x2e')];if(!_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x35')](_0x9fc9('0x36'))){_0x145773[_0x9fc9('0x1f')]=qs[_0x9fc9('0x1f')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x1f')]);_0x145773[_0x9fc9('0x21')]=qs[_0x9fc9('0x21')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x21')]);}_0x145773['order']=qs['sort'](_0xeca997['query'][_0x9fc9('0x37')]);_0x145773['where']=qs['filters'](_[_0x9fc9('0x38')](_0xeca997[_0x9fc9('0x2f')],_0x5c9567[_0x9fc9('0x30')]),_0x60dc6);if(_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x39')]){_0x145773[_0x9fc9('0x3a')]=_[_0x9fc9('0x3b')](_0x145773['where'],{'$or':_[_0x9fc9('0x29')](_0x60dc6,function(_0x3ac275){if(_0x3ac275[_0x9fc9('0x3c')]!==_0x9fc9('0x3d')){var _0x14f8a5={};_0x14f8a5[_0x3ac275[_0x9fc9('0x27')]]={'$like':'%'+_0xeca997[_0x9fc9('0x2f')]['filter']+'%'};return _0x14f8a5;}})});}_0x145773=_[_0x9fc9('0x3b')]({},_0x145773,_0xeca997[_0x9fc9('0x3e')]);var _0x2e6dce={'where':_0x145773[_0x9fc9('0x3a')]};return db[_0x9fc9('0x2a')][_0x9fc9('0x20')](_0x2e6dce)[_0x9fc9('0x25')](function(_0x1171b2){_0x5e5083[_0x9fc9('0x20')]=_0x1171b2;if(_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x3f')]){_0x145773[_0x9fc9('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x145773);})['then'](function(_0x4294d9){_0x5e5083[_0x9fc9('0x41')]=_0x4294d9;return _0x5e5083;})['then'](respondWithFilteredResult(_0x1fb709,_0x145773))[_0x9fc9('0x42')](handleError(_0x1fb709,null));};exports[_0x9fc9('0x43')]=function(_0x51720f,_0x22b242){var _0x4404bb={'raw':![],'where':{'id':_0x51720f['params']['id']}},_0xa75615={};_0xa75615['model']=_['keys'](db[_0x9fc9('0x2a')][_0x9fc9('0x2b')]);_0xa75615['query']=_[_0x9fc9('0x44')](_0x51720f[_0x9fc9('0x2f')]);_0xa75615[_0x9fc9('0x30')]=_['intersection'](_0xa75615[_0x9fc9('0x2e')],_0xa75615[_0x9fc9('0x2f')]);_0x4404bb['attributes']=_['intersection'](_0xa75615[_0x9fc9('0x2e')],qs['fields'](_0x51720f[_0x9fc9('0x2f')]['fields']));_0x4404bb[_0x9fc9('0x33')]=_0x4404bb[_0x9fc9('0x33')]['length']?_0x4404bb['attributes']:_0xa75615[_0x9fc9('0x2e')];if(_0x51720f['query']['includeAll']){_0x4404bb[_0x9fc9('0x40')]=[{'all':!![]}];}_0x4404bb=_[_0x9fc9('0x3b')]({},_0x4404bb,_0x51720f[_0x9fc9('0x3e')]);return db[_0x9fc9('0x2a')][_0x9fc9('0x45')](_0x4404bb)[_0x9fc9('0x25')](handleEntityNotFound(_0x22b242,null))[_0x9fc9('0x25')](respondWithResult(_0x22b242,null))[_0x9fc9('0x42')](handleError(_0x22b242,null));};exports[_0x9fc9('0x46')]=function(_0x4a5f29,_0x2b9c84){return db[_0x9fc9('0x2a')][_0x9fc9('0x46')](_0x4a5f29['body'],{})[_0x9fc9('0x25')](respondWithResult(_0x2b9c84,0xc9))[_0x9fc9('0x42')](handleError(_0x2b9c84,null));};exports[_0x9fc9('0x47')]=function(_0xc4256c,_0x4365a2){return db[_0x9fc9('0x2a')]['bulkCreate'](_0xc4256c[_0x9fc9('0x48')],{'raw':![],'individualHooks':!![]})[_0x9fc9('0x25')](respondWithResult(_0x4365a2,0xc9))[_0x9fc9('0x42')](handleError(_0x4365a2,null));};exports['update']=function(_0x5bb800,_0x298347){if(_0x5bb800[_0x9fc9('0x48')]['id']){delete _0x5bb800[_0x9fc9('0x48')]['id'];}return db[_0x9fc9('0x2a')][_0x9fc9('0x45')]({'where':{'id':_0x5bb800[_0x9fc9('0x49')]['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x298347,null))[_0x9fc9('0x25')](saveUpdates(_0x5bb800[_0x9fc9('0x48')],null))[_0x9fc9('0x25')](respondWithResult(_0x298347,null))[_0x9fc9('0x42')](handleError(_0x298347,null));};exports['destroy']=function(_0x23b400,_0x3be468){return db['AnalyticFieldReport'][_0x9fc9('0x45')]({'where':{'id':_0x23b400[_0x9fc9('0x49')]['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x3be468,null))[_0x9fc9('0x25')](removeEntity(_0x3be468,null))['catch'](handleError(_0x3be468,null));};exports['bulkDestroy']=function(_0xafb44c,_0x255dac){return db[_0x9fc9('0x2a')][_0x9fc9('0x26')]({'where':{'id':_0xafb44c[_0x9fc9('0x2f')][_0x9fc9('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x9fc9('0x25')](respondWithResult(_0x255dac,0xcc))[_0x9fc9('0x42')](handleError(_0x255dac,null));};exports[_0x9fc9('0x4b')]=function(_0x2d91b8,_0x2be401,_0xb1c2d9){return db['AnalyticCustomReport'][_0x9fc9('0x4c')]({'where':{'id':_0x2d91b8['params']['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x2be401,null))['then'](function(_0x371168){if(_0x371168){return db[_0x9fc9('0x4d')][_0x9fc9('0x4e')](function(_0x506b83){return db[_0x9fc9('0x2a')][_0x9fc9('0x26')]({'where':{'CustomReportId':_0x2d91b8['params']['id']},'transaction':_0x506b83})['then'](function(_0x3846c1){var _0x319378=_[_0x9fc9('0x29')](_0x2d91b8['body'],function(_0x28df42){delete _0x28df42['id'];_0x28df42[_0x9fc9('0x4f')]=_0x2d91b8[_0x9fc9('0x49')]['id'];return _0x28df42;});return db[_0x9fc9('0x2a')][_0x9fc9('0x47')](_0x319378,{'transaction':_0x506b83});});})[_0x9fc9('0x25')](function(){return db[_0x9fc9('0x2a')][_0x9fc9('0x50')]({'where':{'CustomReportId':_0x2d91b8['params']['id']}});});}})[_0x9fc9('0x25')](respondWithResult(_0x2be401,null))[_0x9fc9('0x42')](handleError(_0x2be401,null));}; \ No newline at end of file +var _0x2409=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','bulkCreate','body','bulkDestroy','ids','findOne','sequelize','transaction','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','AnalyticFieldReport','fieldName','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2409,0x1bd));var _0x9240=function(_0x48fb54,_0x27f4ee){_0x48fb54=_0x48fb54-0x0;var _0x9fee11=_0x2409[_0x48fb54];return _0x9fee11;};'use strict';var emlformat=require(_0x9240('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9240('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9240('0x2'));var moment=require('moment');var BPromise=require(_0x9240('0x3'));var Mustache=require(_0x9240('0x4'));var util=require(_0x9240('0x5'));var path=require(_0x9240('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9240('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9240('0x8'));var squel=require('squel');var crypto=require(_0x9240('0x9'));var jsforce=require(_0x9240('0xa'));var deskjs=require(_0x9240('0xb'));var toCsv=require(_0x9240('0xc'));var querystring=require(_0x9240('0xd'));var Papa=require(_0x9240('0xe'));var Redis=require(_0x9240('0xf'));var authService=require(_0x9240('0x10'));var qs=require(_0x9240('0x11'));var as=require(_0x9240('0x12'));var hardwareService=require(_0x9240('0x13'));var logger=require('../../config/logger')(_0x9240('0x14'));var utils=require(_0x9240('0x15'));var config=require(_0x9240('0x16'));var licenseUtil=require(_0x9240('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321764,_0x3fc9ef){_0x3fc9ef=_0x3fc9ef||0xcc;return function(_0x2f301e){if(_0x2f301e){return _0x321764[_0x9240('0x18')](_0x3fc9ef);}return _0x321764[_0x9240('0x19')](_0x3fc9ef)[_0x9240('0x1a')]();};}function respondWithResult(_0x49c130,_0x69771){_0x69771=_0x69771||0xc8;return function(_0x329c2f){if(_0x329c2f){return _0x49c130[_0x9240('0x19')](_0x69771)[_0x9240('0x1b')](_0x329c2f);}};}function respondWithFilteredResult(_0x519bac,_0x4f51b8){return function(_0x6edcb0){if(_0x6edcb0){var _0x1361af=typeof _0x4f51b8['offset']===_0x9240('0x1c')&&typeof _0x4f51b8[_0x9240('0x1d')]===_0x9240('0x1c');var _0x3e13b4=_0x6edcb0['count'];var _0x47d379=_0x1361af?0x0:_0x4f51b8[_0x9240('0x1e')];var _0x37d39d=_0x1361af?_0x6edcb0[_0x9240('0x1f')]:_0x4f51b8[_0x9240('0x1e')]+_0x4f51b8[_0x9240('0x1d')];var _0x5477b8;if(_0x37d39d>=_0x3e13b4){_0x37d39d=_0x3e13b4;_0x5477b8=0xc8;}else{_0x5477b8=0xce;}_0x519bac['status'](_0x5477b8);return _0x519bac[_0x9240('0x20')]('Content-Range',_0x47d379+'-'+_0x37d39d+'/'+_0x3e13b4)['json'](_0x6edcb0);}return null;};}function patchUpdates(_0x3511fb){return function(_0x51a6af){try{jsonpatch[_0x9240('0x21')](_0x51a6af,_0x3511fb,!![]);}catch(_0x4ce8bd){return BPromise[_0x9240('0x22')](_0x4ce8bd);}return _0x51a6af[_0x9240('0x23')]();};}function saveUpdates(_0x3645b4,_0x3b703a){return function(_0x54b7bd){if(_0x54b7bd){return _0x54b7bd[_0x9240('0x24')](_0x3645b4)['then'](function(_0xfe37d7){return _0xfe37d7;});}return null;};}function removeEntity(_0x4f3ca8,_0x3f290c){return function(_0x2ad455){if(_0x2ad455){return _0x2ad455[_0x9240('0x25')]()[_0x9240('0x26')](function(){_0x4f3ca8[_0x9240('0x19')](0xcc)[_0x9240('0x1a')]();});}};}function handleEntityNotFound(_0x2f3f78,_0x578770){return function(_0x1f1fef){if(!_0x1f1fef){_0x2f3f78[_0x9240('0x18')](0x194);}return _0x1f1fef;};}function handleError(_0x44b173,_0x1ca617){_0x1ca617=_0x1ca617||0x1f4;return function(_0x551c86){logger[_0x9240('0x27')](_0x551c86['stack']);if(_0x551c86[_0x9240('0x28')]){delete _0x551c86[_0x9240('0x28')];}_0x44b173[_0x9240('0x19')](_0x1ca617)[_0x9240('0x29')](_0x551c86);};}exports[_0x9240('0x2a')]=function(_0x35ca4c,_0x1f7a0a){var _0x4aec25={},_0x40cacb={},_0x3bfa57={'count':0x0,'rows':[]};var _0x31bef8=_[_0x9240('0x2b')](db[_0x9240('0x2c')]['rawAttributes'],function(_0x7ec7c8){return{'name':_0x7ec7c8[_0x9240('0x2d')],'type':_0x7ec7c8[_0x9240('0x2e')][_0x9240('0x2f')]};});_0x40cacb[_0x9240('0x30')]=_[_0x9240('0x2b')](_0x31bef8,_0x9240('0x28'));_0x40cacb[_0x9240('0x31')]=_[_0x9240('0x32')](_0x35ca4c[_0x9240('0x31')]);_0x40cacb[_0x9240('0x33')]=_[_0x9240('0x34')](_0x40cacb[_0x9240('0x30')],_0x40cacb['query']);_0x4aec25[_0x9240('0x35')]=_[_0x9240('0x34')](_0x40cacb[_0x9240('0x30')],qs['fields'](_0x35ca4c['query'][_0x9240('0x36')]));_0x4aec25[_0x9240('0x35')]=_0x4aec25['attributes'][_0x9240('0x37')]?_0x4aec25[_0x9240('0x35')]:_0x40cacb[_0x9240('0x30')];if(!_0x35ca4c['query']['hasOwnProperty'](_0x9240('0x38'))){_0x4aec25[_0x9240('0x1d')]=qs[_0x9240('0x1d')](_0x35ca4c['query'][_0x9240('0x1d')]);_0x4aec25[_0x9240('0x1e')]=qs['offset'](_0x35ca4c['query'][_0x9240('0x1e')]);}_0x4aec25[_0x9240('0x39')]=qs[_0x9240('0x3a')](_0x35ca4c[_0x9240('0x31')]['sort']);_0x4aec25['where']=qs['filters'](_[_0x9240('0x3b')](_0x35ca4c[_0x9240('0x31')],_0x40cacb['filters']),_0x31bef8);if(_0x35ca4c[_0x9240('0x31')][_0x9240('0x3c')]){_0x4aec25[_0x9240('0x3d')]=_[_0x9240('0x3e')](_0x4aec25[_0x9240('0x3d')],{'$or':_[_0x9240('0x2b')](_0x31bef8,function(_0x1ceb65){if(_0x1ceb65['type']!==_0x9240('0x3f')){var _0x3e6f07={};_0x3e6f07[_0x1ceb65[_0x9240('0x28')]]={'$like':'%'+_0x35ca4c[_0x9240('0x31')][_0x9240('0x3c')]+'%'};return _0x3e6f07;}})});}_0x4aec25=_['merge']({},_0x4aec25,_0x35ca4c['options']);var _0x454ef0={'where':_0x4aec25[_0x9240('0x3d')]};return db[_0x9240('0x2c')][_0x9240('0x1f')](_0x454ef0)[_0x9240('0x26')](function(_0x52f082){_0x3bfa57['count']=_0x52f082;if(_0x35ca4c['query'][_0x9240('0x40')]){_0x4aec25[_0x9240('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9240('0x42')](_0x4aec25);})[_0x9240('0x26')](function(_0x1c5565){_0x3bfa57[_0x9240('0x43')]=_0x1c5565;return _0x3bfa57;})['then'](respondWithFilteredResult(_0x1f7a0a,_0x4aec25))[_0x9240('0x44')](handleError(_0x1f7a0a,null));};exports[_0x9240('0x45')]=function(_0x4fc74f,_0x27c157){var _0xda0429={'raw':![],'where':{'id':_0x4fc74f[_0x9240('0x46')]['id']}},_0x56ec45={};_0x56ec45[_0x9240('0x30')]=_[_0x9240('0x32')](db[_0x9240('0x2c')][_0x9240('0x47')]);_0x56ec45[_0x9240('0x31')]=_[_0x9240('0x32')](_0x4fc74f[_0x9240('0x31')]);_0x56ec45['filters']=_['intersection'](_0x56ec45[_0x9240('0x30')],_0x56ec45['query']);_0xda0429[_0x9240('0x35')]=_[_0x9240('0x34')](_0x56ec45[_0x9240('0x30')],qs[_0x9240('0x36')](_0x4fc74f[_0x9240('0x31')][_0x9240('0x36')]));_0xda0429[_0x9240('0x35')]=_0xda0429['attributes'][_0x9240('0x37')]?_0xda0429[_0x9240('0x35')]:_0x56ec45['model'];if(_0x4fc74f[_0x9240('0x31')]['includeAll']){_0xda0429[_0x9240('0x41')]=[{'all':!![]}];}_0xda0429=_[_0x9240('0x3e')]({},_0xda0429,_0x4fc74f[_0x9240('0x48')]);return db[_0x9240('0x2c')][_0x9240('0x49')](_0xda0429)[_0x9240('0x26')](handleEntityNotFound(_0x27c157,null))[_0x9240('0x26')](respondWithResult(_0x27c157,null))[_0x9240('0x44')](handleError(_0x27c157,null));};exports[_0x9240('0x4a')]=function(_0x1aa4a7,_0x2c6194){return db[_0x9240('0x2c')][_0x9240('0x4a')](_0x1aa4a7['body'],{})[_0x9240('0x26')](respondWithResult(_0x2c6194,0xc9))[_0x9240('0x44')](handleError(_0x2c6194,null));};exports[_0x9240('0x4b')]=function(_0x19f6d9,_0x434543){return db[_0x9240('0x2c')][_0x9240('0x4b')](_0x19f6d9[_0x9240('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x434543,0xc9))[_0x9240('0x44')](handleError(_0x434543,null));};exports['update']=function(_0x374dc4,_0x2f854a){if(_0x374dc4[_0x9240('0x4c')]['id']){delete _0x374dc4[_0x9240('0x4c')]['id'];}return db[_0x9240('0x2c')][_0x9240('0x49')]({'where':{'id':_0x374dc4[_0x9240('0x46')]['id']}})[_0x9240('0x26')](handleEntityNotFound(_0x2f854a,null))['then'](saveUpdates(_0x374dc4['body'],null))['then'](respondWithResult(_0x2f854a,null))[_0x9240('0x44')](handleError(_0x2f854a,null));};exports[_0x9240('0x25')]=function(_0x5bd6da,_0x5d59ec){return db['AnalyticFieldReport'][_0x9240('0x49')]({'where':{'id':_0x5bd6da[_0x9240('0x46')]['id']}})[_0x9240('0x26')](handleEntityNotFound(_0x5d59ec,null))[_0x9240('0x26')](removeEntity(_0x5d59ec,null))[_0x9240('0x44')](handleError(_0x5d59ec,null));};exports[_0x9240('0x4d')]=function(_0x500887,_0x32882b){return db[_0x9240('0x2c')]['destroy']({'where':{'id':_0x500887[_0x9240('0x31')][_0x9240('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x9240('0x26')](respondWithResult(_0x32882b,0xcc))['catch'](handleError(_0x32882b,null));};exports['addFields']=function(_0x196304,_0x4de845,_0xb5326e){return db['AnalyticCustomReport'][_0x9240('0x4f')]({'where':{'id':_0x196304[_0x9240('0x46')]['id']}})['then'](handleEntityNotFound(_0x4de845,null))[_0x9240('0x26')](function(_0x386884){if(_0x386884){return db[_0x9240('0x50')][_0x9240('0x51')](function(_0x126a02){return db['AnalyticFieldReport'][_0x9240('0x25')]({'where':{'CustomReportId':_0x196304[_0x9240('0x46')]['id']},'transaction':_0x126a02})[_0x9240('0x26')](function(_0x35fda2){var _0x3ce51d=_[_0x9240('0x2b')](_0x196304['body'],function(_0x1d8f49){delete _0x1d8f49['id'];_0x1d8f49['CustomReportId']=_0x196304[_0x9240('0x46')]['id'];return _0x1d8f49;});return db[_0x9240('0x2c')][_0x9240('0x4b')](_0x3ce51d,{'transaction':_0x126a02});});})['then'](function(){return db[_0x9240('0x2c')]['findAll']({'where':{'CustomReportId':_0x196304[_0x9240('0x46')]['id']}});});}})[_0x9240('0x26')](respondWithResult(_0x4de845,null))['catch'](handleError(_0x4de845,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9889750..24c050e 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 _0xa26f=['moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api'];(function(_0x4d666c,_0x55ad25){var _0x7fd845=function(_0x2f75c8){while(--_0x2f75c8){_0x4d666c['push'](_0x4d666c['shift']());}};_0x7fd845(++_0x55ad25);}(_0xa26f,0x6b));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa26('0x0'));var util=require('util');var logger=require(_0xfa26('0x1'))(_0xfa26('0x2'));var moment=require(_0xfa26('0x3'));var BPromise=require(_0xfa26('0x4'));var rp=require(_0xfa26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa26('0x6'));module[_0xfa26('0x7')]=function(_0x105ee2,_0x145116){return _0x105ee2[_0xfa26('0x8')](_0xfa26('0x9'),attributes,{'tableName':_0xfa26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d01=['path','rimraf','../../config/environment','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3bcdd2,_0x25d9c0){var _0x5f4a36=function(_0x2b45da){while(--_0x2b45da){_0x3bcdd2['push'](_0x3bcdd2['shift']());}};_0x5f4a36(++_0x25d9c0);}(_0x1d01,0x186));var _0x11d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1d01[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x11d0('0x0'));var util=require(_0x11d0('0x1'));var logger=require(_0x11d0('0x2'))('api');var moment=require(_0x11d0('0x3'));var BPromise=require(_0x11d0('0x4'));var rp=require(_0x11d0('0x5'));var fs=require('fs');var path=require(_0x11d0('0x6'));var rimraf=require(_0x11d0('0x7'));var config=require(_0x11d0('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x11d0('0x9')]=function(_0x55cb62,_0x393fb6){return _0x55cb62['define'](_0x11d0('0xa'),attributes,{'tableName':_0x11d0('0xb'),'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 418e2c4..aa30aae 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 _0x270c=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x36a236,_0x3cc5fc){var _0xa4ab27=function(_0xac60ea){while(--_0xac60ea){_0x36a236['push'](_0x36a236['shift']());}};_0xa4ab27(++_0x3cc5fc);}(_0x270c,0xd8));var _0xc270=function(_0x441d52,_0x4ca1c4){_0x441d52=_0x441d52-0x0;var _0x32f501=_0x270c[_0x441d52];return _0x32f501;};'use strict';var _=require(_0xc270('0x0'));var util=require(_0xc270('0x1'));var moment=require(_0xc270('0x2'));var BPromise=require('bluebird');var rs=require(_0xc270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc270('0x4'))['db'];var utils=require(_0xc270('0x5'));var logger=require(_0xc270('0x6'))(_0xc270('0x7'));var config=require(_0xc270('0x8'));var jayson=require(_0xc270('0x9'));var client=jayson[_0xc270('0xa')][_0xc270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0c690,_0x4dc56c,_0x55f797){return new BPromise(function(_0x419169,_0x3ad41c){return client[_0xc270('0xc')](_0xd0c690,_0x55f797)[_0xc270('0xd')](function(_0x5c25ea){logger[_0xc270('0xe')](_0xc270('0xf'),_0x4dc56c,_0xc270('0x10'));logger[_0xc270('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4dc56c,_0xc270('0x10'),JSON[_0xc270('0x12')](_0x5c25ea));if(_0x5c25ea[_0xc270('0x13')]){if(_0x5c25ea[_0xc270('0x13')][_0xc270('0x14')]===0x1f4){logger['error'](_0xc270('0xf'),_0x4dc56c,_0x5c25ea['error'][_0xc270('0x15')]);return _0x3ad41c(_0x5c25ea[_0xc270('0x13')]['message']);}logger[_0xc270('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4dc56c,_0x5c25ea['error'][_0xc270('0x15')]);return _0x419169(_0x5c25ea[_0xc270('0x13')][_0xc270('0x15')]);}else{logger[_0xc270('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4dc56c,_0xc270('0x10'));_0x419169(_0x5c25ea[_0xc270('0x16')][_0xc270('0x15')]);}})['catch'](function(_0x4b292c){logger[_0xc270('0x13')](_0xc270('0xf'),_0x4dc56c,_0x4b292c);_0x3ad41c(_0x4b292c);});});} \ No newline at end of file +var _0x64f0=['rpc','../../config/environment','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4693ac,_0xb702b7){var _0x4dd543=function(_0x463169){while(--_0x463169){_0x4693ac['push'](_0x4693ac['shift']());}};_0x4dd543(++_0xb702b7);}(_0x64f0,0x19d));var _0x064f=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x64f0[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0x064f('0x0'));var util=require(_0x064f('0x1'));var moment=require(_0x064f('0x2'));var BPromise=require(_0x064f('0x3'));var rs=require(_0x064f('0x4'));var fs=require('fs');var Redis=require(_0x064f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x064f('0x6'));var logger=require('../../config/logger')(_0x064f('0x7'));var config=require(_0x064f('0x8'));var jayson=require(_0x064f('0x9'));var client=jayson[_0x064f('0xa')][_0x064f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f56ba,_0x1d214c,_0x164809){return new BPromise(function(_0x1244ad,_0x3894a1){return client['request'](_0x1f56ba,_0x164809)['then'](function(_0xf49df5){logger[_0x064f('0xc')](_0x064f('0xd'),_0x1d214c,_0x064f('0xe'));logger[_0x064f('0xf')](_0x064f('0x10'),_0x1d214c,_0x064f('0xe'),JSON['stringify'](_0xf49df5));if(_0xf49df5[_0x064f('0x11')]){if(_0xf49df5['error'][_0x064f('0x12')]===0x1f4){logger[_0x064f('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d214c,_0xf49df5[_0x064f('0x11')][_0x064f('0x13')]);return _0x3894a1(_0xf49df5[_0x064f('0x11')][_0x064f('0x13')]);}logger[_0x064f('0x11')](_0x064f('0xd'),_0x1d214c,_0xf49df5['error'][_0x064f('0x13')]);return _0x1244ad(_0xf49df5[_0x064f('0x11')]['message']);}else{logger[_0x064f('0xc')](_0x064f('0xd'),_0x1d214c,'request\x20sent');_0x1244ad(_0xf49df5[_0x064f('0x14')][_0x064f('0x13')]);}})['catch'](function(_0x571e2f){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1d214c,_0x571e2f);_0x3894a1(_0x571e2f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a382724..0589d89 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(_0x4dc5eb,_0x8e2c9a){var _0x55a235=function(_0x4269c4){while(--_0x4269c4){_0x4dc5eb['push'](_0x4dc5eb['shift']());}};_0x55a235(++_0x8e2c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x4aff63,_0x39444b){var _0x4c853b=function(_0x107bd6){while(--_0x107bd6){_0x4aff63['push'](_0x4aff63['shift']());}};_0x4c853b(++_0x39444b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b3f222a..5ae8dbb 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 _0x6c9c=['name','STRING','TEXT','sequelize','exports'];(function(_0x1b1464,_0x59069e){var _0x32d77b=function(_0x19fec5){while(--_0x19fec5){_0x1b1464['push'](_0x1b1464['shift']());}};_0x32d77b(++_0x59069e);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x7246ee,_0x2c46a9){_0x7246ee=_0x7246ee-0x0;var _0x4ae624=_0x6c9c[_0x7246ee];return _0x4ae624;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6c9('0x2')},'table':{'type':Sequelize[_0xc6c9('0x3')]},'metric':{'type':Sequelize[_0xc6c9('0x4')]},'description':{'type':Sequelize[_0xc6c9('0x3')]}}; \ No newline at end of file +var _0xfe9d=['STRING','name','sequelize','exports'];(function(_0x2eb46b,_0x59bb26){var _0x335612=function(_0x3753a2){while(--_0x3753a2){_0x2eb46b['push'](_0x2eb46b['shift']());}};_0x335612(++_0x59bb26);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x107ad0,_0x400f9f){_0x107ad0=_0x107ad0-0x0;var _0xbc6750=_0xfe9d[_0x107ad0];return _0xbc6750;};'use strict';var Sequelize=require(_0xdfe9('0x0'));module[_0xdfe9('0x1')]={'name':{'type':Sequelize[_0xdfe9('0x2')],'allowNull':![],'unique':_0xdfe9('0x3')},'table':{'type':Sequelize[_0xdfe9('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xdfe9('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4894cca..0d3a68b 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 _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x56b9ab,_0x2a36bd){var _0x1fad82=function(_0x377a41){while(--_0x377a41){_0x56b9ab['push'](_0x56b9ab['shift']());}};_0x1fad82(++_0x2a36bd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xf2ca[_0x20f96d];return _0x9a7524;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +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(_0x3f31f8,_0x148a34){var _0x425fb9=function(_0x1f0b56){while(--_0x1f0b56){_0x3f31f8['push'](_0x3f31f8['shift']());}};_0x425fb9(++_0x148a34);}(_0x5fc3,0xa8));var _0x35fc=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5fc3[_0x231e16];return _0x570a7c;};'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 2a190f3..ceff209 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 _0xa63f=['request-promise','path','rimraf','../../config/environment','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d0288,_0x348df1){var _0x45ebd9=function(_0x180208){while(--_0x180208){_0x5d0288['push'](_0x5d0288['shift']());}};_0x45ebd9(++_0x348df1);}(_0xa63f,0x1b6));var _0xfa63=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xa63f[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x975b=['define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x2552e3,_0x577a45){var _0x38ffc9=function(_0x58c77e){while(--_0x58c77e){_0x2552e3['push'](_0x2552e3['shift']());}};_0x38ffc9(++_0x577a45);}(_0x975b,0x1c9));var _0xb975=function(_0x1f0d1d,_0x340a1b){_0x1f0d1d=_0x1f0d1d-0x0;var _0x3a7301=_0x975b[_0x1f0d1d];return _0x3a7301;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var logger=require(_0xb975('0x2'))(_0xb975('0x3'));var moment=require(_0xb975('0x4'));var BPromise=require(_0xb975('0x5'));var rp=require(_0xb975('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb975('0x7'));var config=require(_0xb975('0x8'));var attributes=require(_0xb975('0x9'));module[_0xb975('0xa')]=function(_0x599d95,_0x1729fe){return _0x599d95[_0xb975('0xb')]('AnalyticMetric',attributes,{'tableName':_0xb975('0xc'),'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 25d7d96..8ef3793 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 _0x5976=['catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x4674f7,_0x23a007){var _0x203744=function(_0x368466){while(--_0x368466){_0x4674f7['push'](_0x4674f7['shift']());}};_0x203744(++_0x23a007);}(_0x5976,0xf1));var _0x6597=function(_0x5da675,_0x2ead75){_0x5da675=_0x5da675-0x0;var _0x330a76=_0x5976[_0x5da675];return _0x330a76;};'use strict';var _=require(_0x6597('0x0'));var util=require(_0x6597('0x1'));var moment=require(_0x6597('0x2'));var BPromise=require(_0x6597('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6597('0x4'));var logger=require('../../config/logger')(_0x6597('0x5'));var config=require('../../config/environment');var jayson=require(_0x6597('0x6'));var client=jayson[_0x6597('0x7')][_0x6597('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190136,_0x290224,_0x52cfb5){return new BPromise(function(_0x5640c5,_0x27f70a){return client[_0x6597('0x9')](_0x190136,_0x52cfb5)['then'](function(_0x1f3b05){logger[_0x6597('0xa')](_0x6597('0xb'),_0x290224,_0x6597('0xc'));logger[_0x6597('0xd')](_0x6597('0xe'),_0x290224,_0x6597('0xc'),JSON[_0x6597('0xf')](_0x1f3b05));if(_0x1f3b05['error']){if(_0x1f3b05['error'][_0x6597('0x10')]===0x1f4){logger[_0x6597('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x290224,_0x1f3b05[_0x6597('0x11')]['message']);return _0x27f70a(_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);}logger[_0x6597('0x11')](_0x6597('0xb'),_0x290224,_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);return _0x5640c5(_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);}else{logger[_0x6597('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x290224,_0x6597('0xc'));_0x5640c5(_0x1f3b05['result'][_0x6597('0x12')]);}})[_0x6597('0x13')](function(_0x3f48ce){logger[_0x6597('0x11')](_0x6597('0xb'),_0x290224,_0x3f48ce);_0x27f70a(_0x3f48ce);});});} \ No newline at end of file +var _0x16ba=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4bd293,_0x220feb){var _0x2f3e67=function(_0x527470){while(--_0x527470){_0x4bd293['push'](_0x4bd293['shift']());}};_0x2f3e67(++_0x220feb);}(_0x16ba,0xe2));var _0xa16b=function(_0x1ce88e,_0x3b7c50){_0x1ce88e=_0x1ce88e-0x0;var _0x4e2663=_0x16ba[_0x1ce88e];return _0x4e2663;};'use strict';var _=require(_0xa16b('0x0'));var util=require(_0xa16b('0x1'));var moment=require('moment');var BPromise=require(_0xa16b('0x2'));var rs=require(_0xa16b('0x3'));var fs=require('fs');var Redis=require(_0xa16b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa16b('0x5'));var logger=require('../../config/logger')(_0xa16b('0x6'));var config=require(_0xa16b('0x7'));var jayson=require(_0xa16b('0x8'));var client=jayson[_0xa16b('0x9')][_0xa16b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x423b56,_0x473115,_0x13f36a){return new BPromise(function(_0x193f6d,_0x39b59e){return client['request'](_0x423b56,_0x13f36a)[_0xa16b('0xb')](function(_0x367889){logger[_0xa16b('0xc')](_0xa16b('0xd'),_0x473115,_0xa16b('0xe'));logger[_0xa16b('0xf')](_0xa16b('0x10'),_0x473115,'request\x20sent',JSON[_0xa16b('0x11')](_0x367889));if(_0x367889[_0xa16b('0x12')]){if(_0x367889['error'][_0xa16b('0x13')]===0x1f4){logger[_0xa16b('0x12')](_0xa16b('0xd'),_0x473115,_0x367889[_0xa16b('0x12')][_0xa16b('0x14')]);return _0x39b59e(_0x367889['error'][_0xa16b('0x14')]);}logger[_0xa16b('0x12')](_0xa16b('0xd'),_0x473115,_0x367889[_0xa16b('0x12')]['message']);return _0x193f6d(_0x367889[_0xa16b('0x12')][_0xa16b('0x14')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x473115,_0xa16b('0xe'));_0x193f6d(_0x367889[_0xa16b('0x15')][_0xa16b('0x14')]);}})[_0xa16b('0x16')](function(_0x1cfc8d){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x473115,_0x1cfc8d);_0x39b59e(_0x1cfc8d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index cf9a299..283b5ff 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 _0xbfe8=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get'];(function(_0x13ce0f,_0x354d4c){var _0x1beae8=function(_0x25a40b){while(--_0x25a40b){_0x13ce0f['push'](_0x13ce0f['shift']());}};_0x1beae8(++_0x354d4c);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x5cef78,_0xa9e03f){_0x5cef78=_0x5cef78-0x0;var _0x258f09=_0xbfe8[_0x5cef78];return _0x258f09;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0xa')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1cb9=['get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5ed5d9,_0x4c68d8){_0x5ed5d9=_0x5ed5d9-0x0;var _0x3b962f=_0x1cb9[_0x5ed5d9];return _0x3b962f;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['post']('/',auth[_0x91cb('0x9')](),controller['create']);router[_0x91cb('0xd')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);module[_0x91cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 0fa9e0b..4739a97 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 _0xad72=['sequelize'];(function(_0x2e9dc3,_0x483bc6){var _0x130dd1=function(_0x4edfa9){while(--_0x4edfa9){_0x2e9dc3['push'](_0x2e9dc3['shift']());}};_0x130dd1(++_0x483bc6);}(_0xad72,0x1d8));var _0x2ad7=function(_0x24b5b5,_0x5c6b40){_0x24b5b5=_0x24b5b5-0x0;var _0x30a619=_0xad72[_0x24b5b5];return _0x30a619;};'use strict';var Sequelize=require(_0x2ad7('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x301b=['exports','sequelize'];(function(_0x29709d,_0x34c87b){var _0x21021e=function(_0x5cd659){while(--_0x5cd659){_0x29709d['push'](_0x29709d['shift']());}};_0x21021e(++_0x34c87b);}(_0x301b,0x1a1));var _0xb301=function(_0x1e09b2,_0x3cb5ba){_0x1e09b2=_0x1e09b2-0x0;var _0x5915f2=_0x301b[_0x1e09b2];return _0x5915f2;};'use strict';var Sequelize=require(_0xb301('0x0'));module[_0xb301('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 2a472e0..0c734af 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 _0x6d84=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body'];(function(_0x2836fc,_0x87ccde){var _0x118908=function(_0x13045f){while(--_0x13045f){_0x2836fc['push'](_0x2836fc['shift']());}};_0x118908(++_0x87ccde);}(_0x6d84,0x16d));var _0x46d8=function(_0x37ff05,_0x4c302f){_0x37ff05=_0x37ff05-0x0;var _0x2ea4eb=_0x6d84[_0x37ff05];return _0x2ea4eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46d8('0x1'));var rp=require(_0x46d8('0x2'));var moment=require(_0x46d8('0x3'));var BPromise=require(_0x46d8('0x4'));var Mustache=require(_0x46d8('0x5'));var util=require(_0x46d8('0x6'));var path=require(_0x46d8('0x7'));var sox=require('sox');var csv=require(_0x46d8('0x8'));var ejs=require(_0x46d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46d8('0xa'));var squel=require(_0x46d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x46d8('0xc'));var deskjs=require(_0x46d8('0xd'));var toCsv=require(_0x46d8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46d8('0xe'));var authService=require(_0x46d8('0xf'));var qs=require(_0x46d8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d8('0x11'))(_0x46d8('0x12'));var utils=require(_0x46d8('0x13'));var config=require(_0x46d8('0x14'));var licenseUtil=require(_0x46d8('0x15'));var db=require(_0x46d8('0x16'))['db'];function respondWithStatusCode(_0x21ba9a,_0x5c1dcb){_0x5c1dcb=_0x5c1dcb||0xcc;return function(_0x252883){if(_0x252883){return _0x21ba9a[_0x46d8('0x17')](_0x5c1dcb);}return _0x21ba9a[_0x46d8('0x18')](_0x5c1dcb)[_0x46d8('0x19')]();};}function respondWithResult(_0x41f8c8,_0x4aba5f){_0x4aba5f=_0x4aba5f||0xc8;return function(_0xc865c4){if(_0xc865c4){return _0x41f8c8[_0x46d8('0x18')](_0x4aba5f)[_0x46d8('0x1a')](_0xc865c4);}};}function respondWithFilteredResult(_0x16b13f,_0xeab073){return function(_0x213e0f){if(_0x213e0f){var _0x3d3501=typeof _0xeab073[_0x46d8('0x1b')]==='undefined'&&typeof _0xeab073[_0x46d8('0x1c')]==='undefined';var _0x1654c8=_0x213e0f[_0x46d8('0x1d')];var _0x325fb0=_0x3d3501?0x0:_0xeab073[_0x46d8('0x1b')];var _0x4e9c4=_0x3d3501?_0x213e0f[_0x46d8('0x1d')]:_0xeab073[_0x46d8('0x1b')]+_0xeab073[_0x46d8('0x1c')];var _0x353afd;if(_0x4e9c4>=_0x1654c8){_0x4e9c4=_0x1654c8;_0x353afd=0xc8;}else{_0x353afd=0xce;}_0x16b13f[_0x46d8('0x18')](_0x353afd);return _0x16b13f['set'](_0x46d8('0x1e'),_0x325fb0+'-'+_0x4e9c4+'/'+_0x1654c8)[_0x46d8('0x1a')](_0x213e0f);}return null;};}function patchUpdates(_0x346c6f){return function(_0x2d215f){try{jsonpatch[_0x46d8('0x1f')](_0x2d215f,_0x346c6f,!![]);}catch(_0x1086ab){return BPromise[_0x46d8('0x20')](_0x1086ab);}return _0x2d215f[_0x46d8('0x21')]();};}function saveUpdates(_0x16a9d5,_0x228ea0){return function(_0x26ceae){if(_0x26ceae){return _0x26ceae[_0x46d8('0x22')](_0x16a9d5)[_0x46d8('0x23')](function(_0x5a0a0c){return _0x5a0a0c;});}return null;};}function removeEntity(_0x189b77,_0x2f3abb){return function(_0x4d7bba){if(_0x4d7bba){return _0x4d7bba[_0x46d8('0x24')]()[_0x46d8('0x23')](function(){_0x189b77[_0x46d8('0x18')](0xcc)[_0x46d8('0x19')]();});}};}function handleEntityNotFound(_0x3f3455,_0x552bff){return function(_0x4131e2){if(!_0x4131e2){_0x3f3455[_0x46d8('0x17')](0x194);}return _0x4131e2;};}function handleError(_0xe3cdf7,_0x332319){_0x332319=_0x332319||0x1f4;return function(_0x2c83fe){logger[_0x46d8('0x25')](_0x2c83fe[_0x46d8('0x26')]);if(_0x2c83fe[_0x46d8('0x27')]){delete _0x2c83fe[_0x46d8('0x27')];}_0xe3cdf7['status'](_0x332319)['send'](_0x2c83fe);};}exports[_0x46d8('0x28')]=function(_0x38e54f,_0x1dda95){var _0x356eb4={},_0x2f80d8={},_0x3056c7={'count':0x0,'rows':[]};var _0x46e988=_[_0x46d8('0x29')](db[_0x46d8('0x2a')][_0x46d8('0x2b')],function(_0x5add04){return{'name':_0x5add04[_0x46d8('0x2c')],'type':_0x5add04[_0x46d8('0x2d')][_0x46d8('0x2e')]};});_0x2f80d8[_0x46d8('0x2f')]=_[_0x46d8('0x29')](_0x46e988,'name');_0x2f80d8[_0x46d8('0x30')]=_[_0x46d8('0x31')](_0x38e54f[_0x46d8('0x30')]);_0x2f80d8['filters']=_[_0x46d8('0x32')](_0x2f80d8['model'],_0x2f80d8[_0x46d8('0x30')]);_0x356eb4[_0x46d8('0x33')]=_[_0x46d8('0x32')](_0x2f80d8[_0x46d8('0x2f')],qs[_0x46d8('0x34')](_0x38e54f[_0x46d8('0x30')]['fields']));_0x356eb4[_0x46d8('0x33')]=_0x356eb4[_0x46d8('0x33')][_0x46d8('0x35')]?_0x356eb4[_0x46d8('0x33')]:_0x2f80d8[_0x46d8('0x2f')];if(!_0x38e54f[_0x46d8('0x30')][_0x46d8('0x36')](_0x46d8('0x37'))){_0x356eb4['limit']=qs[_0x46d8('0x1c')](_0x38e54f['query'][_0x46d8('0x1c')]);_0x356eb4[_0x46d8('0x1b')]=qs[_0x46d8('0x1b')](_0x38e54f[_0x46d8('0x30')][_0x46d8('0x1b')]);}_0x356eb4['order']=qs[_0x46d8('0x38')](_0x38e54f[_0x46d8('0x30')]['sort']);_0x356eb4[_0x46d8('0x39')]=qs['filters'](_[_0x46d8('0x3a')](_0x38e54f[_0x46d8('0x30')],_0x2f80d8[_0x46d8('0x3b')]),_0x46e988);if(_0x38e54f[_0x46d8('0x30')][_0x46d8('0x3c')]){_0x356eb4[_0x46d8('0x39')]=_[_0x46d8('0x3d')](_0x356eb4[_0x46d8('0x39')],{'$or':_[_0x46d8('0x29')](_0x46e988,function(_0x191b72){if(_0x191b72[_0x46d8('0x2d')]!=='VIRTUAL'){var _0x909cf2={};_0x909cf2[_0x191b72[_0x46d8('0x27')]]={'$like':'%'+_0x38e54f[_0x46d8('0x30')]['filter']+'%'};return _0x909cf2;}})});}_0x356eb4=_[_0x46d8('0x3d')]({},_0x356eb4,_0x38e54f[_0x46d8('0x3e')]);var _0x3a6a7c={'where':_0x356eb4[_0x46d8('0x39')]};return db[_0x46d8('0x2a')][_0x46d8('0x1d')](_0x3a6a7c)['then'](function(_0x20c2ef){_0x3056c7[_0x46d8('0x1d')]=_0x20c2ef;if(_0x38e54f[_0x46d8('0x30')]['includeAll']){_0x356eb4[_0x46d8('0x3f')]=[{'all':!![]}];}return db[_0x46d8('0x2a')][_0x46d8('0x40')](_0x356eb4);})[_0x46d8('0x23')](function(_0x5cd75b){_0x3056c7[_0x46d8('0x41')]=_0x5cd75b;return _0x3056c7;})[_0x46d8('0x23')](respondWithFilteredResult(_0x1dda95,_0x356eb4))[_0x46d8('0x42')](handleError(_0x1dda95,null));};exports[_0x46d8('0x43')]=function(_0x4904c5,_0xc19889){var _0x376e04={'raw':!![],'where':{'id':_0x4904c5[_0x46d8('0x44')]['id']}},_0x2013b4={};_0x2013b4[_0x46d8('0x2f')]=_[_0x46d8('0x31')](db['AnalyticTreeReport']['rawAttributes']);_0x2013b4[_0x46d8('0x30')]=_['keys'](_0x4904c5['query']);_0x2013b4[_0x46d8('0x3b')]=_[_0x46d8('0x32')](_0x2013b4[_0x46d8('0x2f')],_0x2013b4[_0x46d8('0x30')]);_0x376e04[_0x46d8('0x33')]=_['intersection'](_0x2013b4['model'],qs['fields'](_0x4904c5[_0x46d8('0x30')][_0x46d8('0x34')]));_0x376e04[_0x46d8('0x33')]=_0x376e04[_0x46d8('0x33')][_0x46d8('0x35')]?_0x376e04['attributes']:_0x2013b4[_0x46d8('0x2f')];if(_0x4904c5[_0x46d8('0x30')][_0x46d8('0x45')]){_0x376e04[_0x46d8('0x3f')]=[{'all':!![]}];}_0x376e04=_[_0x46d8('0x3d')]({},_0x376e04,_0x4904c5[_0x46d8('0x3e')]);return db['AnalyticTreeReport'][_0x46d8('0x46')](_0x376e04)[_0x46d8('0x23')](handleEntityNotFound(_0xc19889,null))['then'](respondWithResult(_0xc19889,null))[_0x46d8('0x42')](handleError(_0xc19889,null));};exports[_0x46d8('0x47')]=function(_0x41e1c5,_0x127807){return db[_0x46d8('0x2a')][_0x46d8('0x47')](_0x41e1c5[_0x46d8('0x48')],{})[_0x46d8('0x23')](respondWithResult(_0x127807,0xc9))[_0x46d8('0x42')](handleError(_0x127807,null));};exports[_0x46d8('0x22')]=function(_0x27cb2f,_0x29c7ac){if(_0x27cb2f['body']['id']){delete _0x27cb2f[_0x46d8('0x48')]['id'];}return db[_0x46d8('0x2a')][_0x46d8('0x46')]({'where':{'id':_0x27cb2f[_0x46d8('0x44')]['id']}})[_0x46d8('0x23')](handleEntityNotFound(_0x29c7ac,null))[_0x46d8('0x23')](saveUpdates(_0x27cb2f['body'],null))[_0x46d8('0x23')](respondWithResult(_0x29c7ac,null))['catch'](handleError(_0x29c7ac,null));};exports[_0x46d8('0x24')]=function(_0x5b9dc5,_0x16ee70){return db['AnalyticTreeReport'][_0x46d8('0x46')]({'where':{'id':_0x5b9dc5[_0x46d8('0x44')]['id']}})[_0x46d8('0x23')](handleEntityNotFound(_0x16ee70,null))[_0x46d8('0x23')](removeEntity(_0x16ee70,null))[_0x46d8('0x42')](handleError(_0x16ee70,null));}; \ No newline at end of file +var _0x1231=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','AnalyticTreeReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','keys','fields','include','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x4e33d9,_0xfd0967){var _0x484ba4=function(_0x179ea4){while(--_0x179ea4){_0x4e33d9['push'](_0x4e33d9['shift']());}};_0x484ba4(++_0xfd0967);}(_0x1231,0x100));var _0x1123=function(_0xd6f425,_0x635e80){_0xd6f425=_0xd6f425-0x0;var _0x228cc2=_0x1231[_0xd6f425];return _0x228cc2;};'use strict';var emlformat=require(_0x1123('0x0'));var rimraf=require(_0x1123('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1123('0x2'));var rp=require(_0x1123('0x3'));var moment=require(_0x1123('0x4'));var BPromise=require(_0x1123('0x5'));var Mustache=require('mustache');var util=require(_0x1123('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1123('0x7'));var _=require(_0x1123('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1123('0x9'));var deskjs=require(_0x1123('0xa'));var toCsv=require(_0x1123('0xb'));var querystring=require(_0x1123('0xc'));var Papa=require(_0x1123('0xd'));var Redis=require('ioredis');var authService=require(_0x1123('0xe'));var qs=require(_0x1123('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1123('0x10'));var logger=require(_0x1123('0x11'))(_0x1123('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1123('0x13'));var db=require(_0x1123('0x14'))['db'];function respondWithStatusCode(_0x3d1d71,_0x2237eb){_0x2237eb=_0x2237eb||0xcc;return function(_0x2e58a3){if(_0x2e58a3){return _0x3d1d71[_0x1123('0x15')](_0x2237eb);}return _0x3d1d71['status'](_0x2237eb)[_0x1123('0x16')]();};}function respondWithResult(_0x3a95c0,_0x98a7ec){_0x98a7ec=_0x98a7ec||0xc8;return function(_0x1049a7){if(_0x1049a7){return _0x3a95c0[_0x1123('0x17')](_0x98a7ec)[_0x1123('0x18')](_0x1049a7);}};}function respondWithFilteredResult(_0x2e4b02,_0x3a75d7){return function(_0x3223fd){if(_0x3223fd){var _0x5a5bd2=typeof _0x3a75d7[_0x1123('0x19')]===_0x1123('0x1a')&&typeof _0x3a75d7[_0x1123('0x1b')]==='undefined';var _0x5dc68c=_0x3223fd['count'];var _0x444fc0=_0x5a5bd2?0x0:_0x3a75d7[_0x1123('0x19')];var _0x3c4cc3=_0x5a5bd2?_0x3223fd[_0x1123('0x1c')]:_0x3a75d7[_0x1123('0x19')]+_0x3a75d7[_0x1123('0x1b')];var _0x377c95;if(_0x3c4cc3>=_0x5dc68c){_0x3c4cc3=_0x5dc68c;_0x377c95=0xc8;}else{_0x377c95=0xce;}_0x2e4b02['status'](_0x377c95);return _0x2e4b02[_0x1123('0x1d')](_0x1123('0x1e'),_0x444fc0+'-'+_0x3c4cc3+'/'+_0x5dc68c)[_0x1123('0x18')](_0x3223fd);}return null;};}function patchUpdates(_0x4bb78a){return function(_0x3ce3bb){try{jsonpatch[_0x1123('0x1f')](_0x3ce3bb,_0x4bb78a,!![]);}catch(_0x473aa6){return BPromise[_0x1123('0x20')](_0x473aa6);}return _0x3ce3bb['save']();};}function saveUpdates(_0x5d5c17,_0x1444dd){return function(_0x251d01){if(_0x251d01){return _0x251d01[_0x1123('0x21')](_0x5d5c17)[_0x1123('0x22')](function(_0x3caa0a){return _0x3caa0a;});}return null;};}function removeEntity(_0x457f15,_0x157e03){return function(_0x56acea){if(_0x56acea){return _0x56acea[_0x1123('0x23')]()[_0x1123('0x22')](function(){_0x457f15[_0x1123('0x17')](0xcc)[_0x1123('0x16')]();});}};}function handleEntityNotFound(_0x4a44ea,_0x3b68d4){return function(_0x2191c4){if(!_0x2191c4){_0x4a44ea[_0x1123('0x15')](0x194);}return _0x2191c4;};}function handleError(_0x2ecd47,_0x43b49a){_0x43b49a=_0x43b49a||0x1f4;return function(_0x14e81e){logger[_0x1123('0x24')](_0x14e81e[_0x1123('0x25')]);if(_0x14e81e[_0x1123('0x26')]){delete _0x14e81e[_0x1123('0x26')];}_0x2ecd47['status'](_0x43b49a)['send'](_0x14e81e);};}exports['index']=function(_0x4b4f2f,_0x5f0b2f){var _0x52e918={},_0x5e805d={},_0x57be83={'count':0x0,'rows':[]};var _0x3d6fc7=_['map'](db[_0x1123('0x27')][_0x1123('0x28')],function(_0x3eb9d7){return{'name':_0x3eb9d7[_0x1123('0x29')],'type':_0x3eb9d7[_0x1123('0x2a')]['key']};});_0x5e805d[_0x1123('0x2b')]=_[_0x1123('0x2c')](_0x3d6fc7,_0x1123('0x26'));_0x5e805d[_0x1123('0x2d')]=_['keys'](_0x4b4f2f[_0x1123('0x2d')]);_0x5e805d[_0x1123('0x2e')]=_[_0x1123('0x2f')](_0x5e805d[_0x1123('0x2b')],_0x5e805d[_0x1123('0x2d')]);_0x52e918[_0x1123('0x30')]=_['intersection'](_0x5e805d[_0x1123('0x2b')],qs['fields'](_0x4b4f2f[_0x1123('0x2d')]['fields']));_0x52e918[_0x1123('0x30')]=_0x52e918[_0x1123('0x30')][_0x1123('0x31')]?_0x52e918['attributes']:_0x5e805d['model'];if(!_0x4b4f2f[_0x1123('0x2d')]['hasOwnProperty']('nolimit')){_0x52e918[_0x1123('0x1b')]=qs['limit'](_0x4b4f2f[_0x1123('0x2d')][_0x1123('0x1b')]);_0x52e918[_0x1123('0x19')]=qs[_0x1123('0x19')](_0x4b4f2f[_0x1123('0x2d')]['offset']);}_0x52e918[_0x1123('0x32')]=qs['sort'](_0x4b4f2f['query'][_0x1123('0x33')]);_0x52e918['where']=qs[_0x1123('0x2e')](_[_0x1123('0x34')](_0x4b4f2f[_0x1123('0x2d')],_0x5e805d[_0x1123('0x2e')]),_0x3d6fc7);if(_0x4b4f2f[_0x1123('0x2d')][_0x1123('0x35')]){_0x52e918[_0x1123('0x36')]=_[_0x1123('0x37')](_0x52e918[_0x1123('0x36')],{'$or':_[_0x1123('0x2c')](_0x3d6fc7,function(_0x3baaa5){if(_0x3baaa5['type']!==_0x1123('0x38')){var _0x244592={};_0x244592[_0x3baaa5[_0x1123('0x26')]]={'$like':'%'+_0x4b4f2f[_0x1123('0x2d')][_0x1123('0x35')]+'%'};return _0x244592;}})});}_0x52e918=_['merge']({},_0x52e918,_0x4b4f2f['options']);var _0x34f3c1={'where':_0x52e918[_0x1123('0x36')]};return db[_0x1123('0x27')][_0x1123('0x1c')](_0x34f3c1)[_0x1123('0x22')](function(_0x30b5f5){_0x57be83[_0x1123('0x1c')]=_0x30b5f5;if(_0x4b4f2f['query'][_0x1123('0x39')]){_0x52e918['include']=[{'all':!![]}];}return db[_0x1123('0x27')][_0x1123('0x3a')](_0x52e918);})[_0x1123('0x22')](function(_0x7d4c99){_0x57be83['rows']=_0x7d4c99;return _0x57be83;})[_0x1123('0x22')](respondWithFilteredResult(_0x5f0b2f,_0x52e918))[_0x1123('0x3b')](handleError(_0x5f0b2f,null));};exports[_0x1123('0x3c')]=function(_0x2d1b3e,_0x3a6945){var _0x581c89={'raw':!![],'where':{'id':_0x2d1b3e[_0x1123('0x3d')]['id']}},_0x388d37={};_0x388d37[_0x1123('0x2b')]=_[_0x1123('0x3e')](db[_0x1123('0x27')][_0x1123('0x28')]);_0x388d37[_0x1123('0x2d')]=_[_0x1123('0x3e')](_0x2d1b3e[_0x1123('0x2d')]);_0x388d37['filters']=_[_0x1123('0x2f')](_0x388d37['model'],_0x388d37['query']);_0x581c89[_0x1123('0x30')]=_[_0x1123('0x2f')](_0x388d37[_0x1123('0x2b')],qs['fields'](_0x2d1b3e['query'][_0x1123('0x3f')]));_0x581c89['attributes']=_0x581c89[_0x1123('0x30')][_0x1123('0x31')]?_0x581c89['attributes']:_0x388d37['model'];if(_0x2d1b3e[_0x1123('0x2d')][_0x1123('0x39')]){_0x581c89[_0x1123('0x40')]=[{'all':!![]}];}_0x581c89=_[_0x1123('0x37')]({},_0x581c89,_0x2d1b3e[_0x1123('0x41')]);return db[_0x1123('0x27')]['find'](_0x581c89)[_0x1123('0x22')](handleEntityNotFound(_0x3a6945,null))[_0x1123('0x22')](respondWithResult(_0x3a6945,null))['catch'](handleError(_0x3a6945,null));};exports[_0x1123('0x42')]=function(_0x2261b1,_0x35edb0){return db[_0x1123('0x27')][_0x1123('0x42')](_0x2261b1[_0x1123('0x43')],{})[_0x1123('0x22')](respondWithResult(_0x35edb0,0xc9))[_0x1123('0x3b')](handleError(_0x35edb0,null));};exports['update']=function(_0x8f8704,_0x284b58){if(_0x8f8704[_0x1123('0x43')]['id']){delete _0x8f8704[_0x1123('0x43')]['id'];}return db[_0x1123('0x27')][_0x1123('0x44')]({'where':{'id':_0x8f8704[_0x1123('0x3d')]['id']}})[_0x1123('0x22')](handleEntityNotFound(_0x284b58,null))[_0x1123('0x22')](saveUpdates(_0x8f8704[_0x1123('0x43')],null))[_0x1123('0x22')](respondWithResult(_0x284b58,null))[_0x1123('0x3b')](handleError(_0x284b58,null));};exports[_0x1123('0x23')]=function(_0x303026,_0x462a10){return db[_0x1123('0x27')][_0x1123('0x44')]({'where':{'id':_0x303026[_0x1123('0x3d')]['id']}})['then'](handleEntityNotFound(_0x462a10,null))[_0x1123('0x22')](removeEntity(_0x462a10,null))['catch'](handleError(_0x462a10,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9e5fc1f..708e44d 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 _0x556e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x195a3c,_0x3537a3){var _0x4ed367=function(_0x11878b){while(--_0x11878b){_0x195a3c['push'](_0x195a3c['shift']());}};_0x4ed367(++_0x3537a3);}(_0x556e,0xa5));var _0xe556=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x556e[_0x3e5147];return _0x18c779;};'use strict';var _=require(_0xe556('0x0'));var util=require(_0xe556('0x1'));var logger=require(_0xe556('0x2'))(_0xe556('0x3'));var moment=require(_0xe556('0x4'));var BPromise=require(_0xe556('0x5'));var rp=require(_0xe556('0x6'));var fs=require('fs');var path=require(_0xe556('0x7'));var rimraf=require(_0xe556('0x8'));var config=require(_0xe556('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0xe556('0xa')]=function(_0x4fcda9,_0x23600e){return _0x4fcda9[_0xe556('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xe556('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6bd=['api','moment','bluebird','request-promise','path','rimraf','exports','define','analytics_report_trees','util','../../config/logger'];(function(_0x298b53,_0x3f830d){var _0x370c14=function(_0x16a8d7){while(--_0x16a8d7){_0x298b53['push'](_0x298b53['shift']());}};_0x370c14(++_0x3f830d);}(_0xe6bd,0xf0));var _0xde6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xde6b('0x0'));var logger=require(_0xde6b('0x1'))(_0xde6b('0x2'));var moment=require(_0xde6b('0x3'));var BPromise=require(_0xde6b('0x4'));var rp=require(_0xde6b('0x5'));var fs=require('fs');var path=require(_0xde6b('0x6'));var rimraf=require(_0xde6b('0x7'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xde6b('0x8')]=function(_0x2bd3f4,_0xe38995){return _0x2bd3f4[_0xde6b('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xde6b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index a749e30..f146a7f 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5e3fc1,_0x109138){var _0x5885c0=function(_0x9825b6){while(--_0x9825b6){_0x5e3fc1['push'](_0x5e3fc1['shift']());}};_0x5885c0(++_0x109138);}(_0x1261,0x144));var _0x1126=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x1261[_0xef4cf0];return _0x497ad2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2867b3,_0x1023f3){var _0x297a3a=function(_0x4a0fee){while(--_0x4a0fee){_0x2867b3['push'](_0x2867b3['shift']());}};_0x297a3a(++_0x1023f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1eab69,_0x251f50){_0x1eab69=_0x1eab69-0x0;var _0x4e6d1d=_0x5f2f[_0x1eab69];return _0x4e6d1d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4cd2191..ae7d6e9 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 _0x85ed=['show','post','create','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85ed,0xa6));var _0xd85e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x85ed[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd85e('0x0'));var express=require(_0xd85e('0x1'));var router=express[_0xd85e('0x2')]();var fs_extra=require(_0xd85e('0x3'));var auth=require(_0xd85e('0x4'));var interaction=require(_0xd85e('0x5'));var config=require(_0xd85e('0x6'));var controller=require(_0xd85e('0x7'));router['get']('/',auth[_0xd85e('0x8')](),controller['index']);router['get'](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller[_0xd85e('0xa')]);router[_0xd85e('0xb')]('/',auth[_0xd85e('0x8')](),controller[_0xd85e('0xc')]);router['put'](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller['update']);router[_0xd85e('0xd')](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller[_0xd85e('0xe')]);module[_0xd85e('0xf')]=router; \ No newline at end of file +var _0xa4eb=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1a37ec,_0x2dedfd){var _0x45aea5=function(_0x53ce3a){while(--_0x53ce3a){_0x1a37ec['push'](_0x1a37ec['shift']());}};_0x45aea5(++_0x2dedfd);}(_0xa4eb,0x119));var _0xba4e=function(_0x295f70,_0x17ae04){_0x295f70=_0x295f70-0x0;var _0x208134=_0xa4eb[_0x295f70];return _0x208134;};'use strict';var multer=require(_0xba4e('0x0'));var util=require(_0xba4e('0x1'));var path=require('path');var timeout=require(_0xba4e('0x2'));var express=require(_0xba4e('0x3'));var router=express['Router']();var fs_extra=require(_0xba4e('0x4'));var auth=require(_0xba4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba4e('0x6'));var controller=require(_0xba4e('0x7'));router[_0xba4e('0x8')]('/',auth[_0xba4e('0x9')](),controller[_0xba4e('0xa')]);router['get'](_0xba4e('0xb'),auth['isAuthenticated'](),controller[_0xba4e('0xc')]);router[_0xba4e('0xd')]('/',auth[_0xba4e('0x9')](),controller['create']);router[_0xba4e('0xe')](_0xba4e('0xb'),auth[_0xba4e('0x9')](),controller[_0xba4e('0xf')]);router['delete']('/:id',auth[_0xba4e('0x9')](),controller[_0xba4e('0x10')]);module[_0xba4e('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0a6728f..2920bd3 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 _0xdace=['STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdace,0xc5));var _0xedac=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xdace[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'basename':{'type':Sequelize[_0xedac('0x1')]},'type':{'type':Sequelize[_0xedac('0x1')]}}; \ No newline at end of file +var _0xf4dd=['sequelize','exports','STRING'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x4dfb79,_0x294bb8){_0x4dfb79=_0x4dfb79-0x0;var _0x3d1079=_0xf4dd[_0x4dfb79];return _0x3d1079;};'use strict';var Sequelize=require(_0xdf4d('0x0'));module[_0xdf4d('0x1')]={'name':{'type':Sequelize[_0xdf4d('0x2')]},'basename':{'type':Sequelize[_0xdf4d('0x2')]},'type':{'type':Sequelize[_0xdf4d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8a1695d..e1ac1da 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 _0x5dd4=['catch','params','options','find','clone','merge','omit','createdAt','updatedAt','body','originalname','filename','file','mimetype','create','join','root','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','Attachment','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4b4921,_0x79b24f){var _0x569da4=function(_0x48de87){while(--_0x48de87){_0x4b4921['push'](_0x4b4921['shift']());}};_0x569da4(++_0x79b24f);}(_0x5dd4,0x1c7));var _0x45dd=function(_0x28ae11,_0x12043f){_0x28ae11=_0x28ae11-0x0;var _0x32bb34=_0x5dd4[_0x28ae11];return _0x32bb34;};'use strict';var emlformat=require(_0x45dd('0x0'));var rimraf=require(_0x45dd('0x1'));var zipdir=require(_0x45dd('0x2'));var jsonpatch=require(_0x45dd('0x3'));var rp=require(_0x45dd('0x4'));var moment=require(_0x45dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45dd('0x6'));var util=require(_0x45dd('0x7'));var path=require(_0x45dd('0x8'));var sox=require(_0x45dd('0x9'));var csv=require(_0x45dd('0xa'));var ejs=require(_0x45dd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45dd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45dd('0xd'));var toCsv=require(_0x45dd('0xa'));var querystring=require('querystring');var Papa=require(_0x45dd('0xe'));var Redis=require('ioredis');var authService=require(_0x45dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x45dd('0x10'));var hardwareService=require(_0x45dd('0x11'));var logger=require(_0x45dd('0x12'))(_0x45dd('0x13'));var utils=require(_0x45dd('0x14'));var config=require(_0x45dd('0x15'));var licenseUtil=require(_0x45dd('0x16'));var db=require(_0x45dd('0x17'))['db'];function respondWithStatusCode(_0x32ee1e,_0x3a5386){_0x3a5386=_0x3a5386||0xcc;return function(_0x1d1add){if(_0x1d1add){return _0x32ee1e[_0x45dd('0x18')](_0x3a5386);}return _0x32ee1e[_0x45dd('0x19')](_0x3a5386)[_0x45dd('0x1a')]();};}function respondWithResult(_0x1d77be,_0x3df0e4){_0x3df0e4=_0x3df0e4||0xc8;return function(_0x58f340){if(_0x58f340){return _0x1d77be['status'](_0x3df0e4)[_0x45dd('0x1b')](_0x58f340);}};}function respondWithFilteredResult(_0x506ae8,_0x501fa1){return function(_0x4432e5){if(_0x4432e5){var _0xc669e6=typeof _0x501fa1['offset']===_0x45dd('0x1c')&&typeof _0x501fa1[_0x45dd('0x1d')]==='undefined';var _0x2b2117=_0x4432e5[_0x45dd('0x1e')];var _0x38a0e5=_0xc669e6?0x0:_0x501fa1[_0x45dd('0x1f')];var _0x519e80=_0xc669e6?_0x4432e5[_0x45dd('0x1e')]:_0x501fa1['offset']+_0x501fa1[_0x45dd('0x1d')];var _0x78668;if(_0x519e80>=_0x2b2117){_0x519e80=_0x2b2117;_0x78668=0xc8;}else{_0x78668=0xce;}_0x506ae8[_0x45dd('0x19')](_0x78668);return _0x506ae8['set']('Content-Range',_0x38a0e5+'-'+_0x519e80+'/'+_0x2b2117)[_0x45dd('0x1b')](_0x4432e5);}return null;};}function patchUpdates(_0xb8af59){return function(_0x2c3cf6){try{jsonpatch[_0x45dd('0x20')](_0x2c3cf6,_0xb8af59,!![]);}catch(_0x4b3aa1){return BPromise[_0x45dd('0x21')](_0x4b3aa1);}return _0x2c3cf6[_0x45dd('0x22')]();};}function saveUpdates(_0x42f0cb,_0x21c9bb){return function(_0x2d163e){if(_0x2d163e){return _0x2d163e[_0x45dd('0x23')](_0x42f0cb)[_0x45dd('0x24')](function(_0x1a49b0){return _0x1a49b0;});}return null;};}function removeEntity(_0x4529b9,_0x53dce9){return function(_0x1166f5){if(_0x1166f5){return _0x1166f5[_0x45dd('0x25')]()[_0x45dd('0x24')](function(){_0x4529b9['status'](0xcc)[_0x45dd('0x1a')]();});}};}function handleEntityNotFound(_0xd737e1,_0x16a666){return function(_0x4844bb){if(!_0x4844bb){_0xd737e1[_0x45dd('0x18')](0x194);}return _0x4844bb;};}function handleError(_0x32b4df,_0x16113b){_0x16113b=_0x16113b||0x1f4;return function(_0x3dc351){logger[_0x45dd('0x26')](_0x3dc351[_0x45dd('0x27')]);if(_0x3dc351['name']){delete _0x3dc351[_0x45dd('0x28')];}_0x32b4df[_0x45dd('0x19')](_0x16113b)['send'](_0x3dc351);};}exports[_0x45dd('0x29')]=function(_0x10721f,_0xf10b68){var _0x3a3651={},_0x3d848e={},_0x5ea7dc={'count':0x0,'rows':[]};var _0x2edd22=_['map'](db[_0x45dd('0x2a')][_0x45dd('0x2b')],function(_0x59fed7){return{'name':_0x59fed7[_0x45dd('0x2c')],'type':_0x59fed7['type'][_0x45dd('0x2d')]};});_0x3d848e[_0x45dd('0x2e')]=_[_0x45dd('0x2f')](_0x2edd22,'name');_0x3d848e['query']=_[_0x45dd('0x30')](_0x10721f[_0x45dd('0x31')]);_0x3d848e[_0x45dd('0x32')]=_['intersection'](_0x3d848e['model'],_0x3d848e[_0x45dd('0x31')]);_0x3a3651[_0x45dd('0x33')]=_[_0x45dd('0x34')](_0x3d848e[_0x45dd('0x2e')],qs['fields'](_0x10721f[_0x45dd('0x31')][_0x45dd('0x35')]));_0x3a3651[_0x45dd('0x33')]=_0x3a3651['attributes'][_0x45dd('0x36')]?_0x3a3651[_0x45dd('0x33')]:_0x3d848e[_0x45dd('0x2e')];if(!_0x10721f[_0x45dd('0x31')][_0x45dd('0x37')](_0x45dd('0x38'))){_0x3a3651[_0x45dd('0x1d')]=qs[_0x45dd('0x1d')](_0x10721f[_0x45dd('0x31')]['limit']);_0x3a3651['offset']=qs[_0x45dd('0x1f')](_0x10721f[_0x45dd('0x31')][_0x45dd('0x1f')]);}_0x3a3651[_0x45dd('0x39')]=qs[_0x45dd('0x3a')](_0x10721f[_0x45dd('0x31')][_0x45dd('0x3a')]);_0x3a3651[_0x45dd('0x3b')]=qs[_0x45dd('0x32')](_['pick'](_0x10721f[_0x45dd('0x31')],_0x3d848e[_0x45dd('0x32')]),_0x2edd22);if(_0x10721f[_0x45dd('0x31')][_0x45dd('0x3c')]){_0x3a3651[_0x45dd('0x3b')]=_['merge'](_0x3a3651[_0x45dd('0x3b')],{'$or':_['map'](_0x2edd22,function(_0x3c19ca){if(_0x3c19ca[_0x45dd('0x3d')]!==_0x45dd('0x3e')){var _0x4c68c7={};_0x4c68c7[_0x3c19ca[_0x45dd('0x28')]]={'$like':'%'+_0x10721f['query'][_0x45dd('0x3c')]+'%'};return _0x4c68c7;}})});}_0x3a3651=_['merge']({},_0x3a3651,_0x10721f['options']);var _0x20447a={'where':_0x3a3651[_0x45dd('0x3b')]};return db[_0x45dd('0x2a')]['count'](_0x20447a)[_0x45dd('0x24')](function(_0x4dcd81){_0x5ea7dc[_0x45dd('0x1e')]=_0x4dcd81;if(_0x10721f[_0x45dd('0x31')][_0x45dd('0x3f')]){_0x3a3651[_0x45dd('0x40')]=[{'all':!![]}];}return db[_0x45dd('0x2a')][_0x45dd('0x41')](_0x3a3651);})[_0x45dd('0x24')](function(_0x2db898){_0x5ea7dc[_0x45dd('0x42')]=_0x2db898;return _0x5ea7dc;})[_0x45dd('0x24')](respondWithFilteredResult(_0xf10b68,_0x3a3651))[_0x45dd('0x43')](handleError(_0xf10b68,null));};exports['show']=function(_0x200b1d,_0x2a867c){var _0x467cae={'raw':!![],'where':{'id':_0x200b1d[_0x45dd('0x44')]['id']}},_0x461b73={};_0x461b73[_0x45dd('0x2e')]=_[_0x45dd('0x30')](db[_0x45dd('0x2a')][_0x45dd('0x2b')]);_0x461b73[_0x45dd('0x31')]=_[_0x45dd('0x30')](_0x200b1d[_0x45dd('0x31')]);_0x461b73[_0x45dd('0x32')]=_[_0x45dd('0x34')](_0x461b73[_0x45dd('0x2e')],_0x461b73[_0x45dd('0x31')]);_0x467cae['attributes']=_[_0x45dd('0x34')](_0x461b73['model'],qs['fields'](_0x200b1d['query'][_0x45dd('0x35')]));_0x467cae[_0x45dd('0x33')]=_0x467cae['attributes'][_0x45dd('0x36')]?_0x467cae[_0x45dd('0x33')]:_0x461b73[_0x45dd('0x2e')];if(_0x200b1d['query'][_0x45dd('0x3f')]){_0x467cae[_0x45dd('0x40')]=[{'all':!![]}];}_0x467cae=_['merge']({},_0x467cae,_0x200b1d[_0x45dd('0x45')]);return db[_0x45dd('0x2a')][_0x45dd('0x46')](_0x467cae)[_0x45dd('0x24')](handleEntityNotFound(_0x2a867c,null))['then'](respondWithResult(_0x2a867c,null))[_0x45dd('0x43')](handleError(_0x2a867c,null));};exports[_0x45dd('0x47')]=function(_0x1b47a3,_0x56f2ea){var _0x494aa1={'where':{'id':_0x1b47a3['params']['id']}},_0x1daa8d={};_0x1daa8d[_0x45dd('0x2e')]=_['keys'](db[_0x45dd('0x2a')][_0x45dd('0x2b')]);_0x494aa1[_0x45dd('0x33')]=_[_0x45dd('0x34')](_0x1daa8d[_0x45dd('0x2e')],qs['fields'](_0x1b47a3[_0x45dd('0x31')][_0x45dd('0x35')]));_0x494aa1[_0x45dd('0x33')]=_0x494aa1['attributes'][_0x45dd('0x36')]?_0x494aa1['attributes']:_0x1daa8d['model'];if(_0x1b47a3[_0x45dd('0x31')]['includeAll']){_0x494aa1[_0x45dd('0x40')]=[{'all':!![]}];}_0x494aa1=_[_0x45dd('0x48')]({},_0x494aa1,_0x1b47a3[_0x45dd('0x45')]);return db[_0x45dd('0x2a')][_0x45dd('0x46')](_0x494aa1)[_0x45dd('0x24')](handleEntityNotFound(_0x56f2ea,null))[_0x45dd('0x24')](function(_0x1729ad){if(_0x1729ad){var _0x5631ff=_0x1729ad['get']({'plain':!![]});_0x5631ff=qs[_0x45dd('0x49')](_0x5631ff,['id',_0x45dd('0x4a'),_0x45dd('0x4b')]);_0x1b47a3[_0x45dd('0x4c')]=_[_0x45dd('0x49')](_0x1b47a3['body'],['id',_0x45dd('0x4a'),_0x45dd('0x4b')]);return db[_0x45dd('0x2a')]['create'](_['merge'](_0x5631ff,_0x1b47a3[_0x45dd('0x4c')]),{'include':_0x1b47a3[_0x45dd('0x31')][_0x45dd('0x3f')]?[{'all':!![]}]:undefined});}})[_0x45dd('0x24')](respondWithResult(_0x56f2ea,0xc9))[_0x45dd('0x43')](handleError(_0x56f2ea,null));};exports['update']=function(_0x273c9b,_0xa0b1e6){if(_0x273c9b['body']['id']){delete _0x273c9b[_0x45dd('0x4c')]['id'];}return db[_0x45dd('0x2a')]['find']({'where':{'id':_0x273c9b[_0x45dd('0x44')]['id']}})[_0x45dd('0x24')](handleEntityNotFound(_0xa0b1e6,null))[_0x45dd('0x24')](saveUpdates(_0x273c9b[_0x45dd('0x4c')],null))[_0x45dd('0x24')](respondWithResult(_0xa0b1e6,null))[_0x45dd('0x43')](handleError(_0xa0b1e6,null));};exports[_0x45dd('0x25')]=function(_0x1b1c79,_0x152e9e){return db[_0x45dd('0x2a')][_0x45dd('0x46')]({'where':{'id':_0x1b1c79['params']['id']}})['then'](handleEntityNotFound(_0x152e9e,null))[_0x45dd('0x24')](removeEntity(_0x152e9e,null))[_0x45dd('0x43')](handleError(_0x152e9e,null));};exports['create']=function(_0x5660d8,_0x48dc20,_0x439904){_0x5660d8[_0x45dd('0x4c')]['name']=_0x5660d8['file'][_0x45dd('0x4d')];_0x5660d8[_0x45dd('0x4c')]['basename']=_0x5660d8['file'][_0x45dd('0x4e')];_0x5660d8[_0x45dd('0x4c')][_0x45dd('0x3d')]=_0x5660d8[_0x45dd('0x4f')][_0x45dd('0x50')];return db[_0x45dd('0x2a')][_0x45dd('0x51')](_0x5660d8[_0x45dd('0x4c')])[_0x45dd('0x24')](respondWithResult(_0x48dc20,0xc9))[_0x45dd('0x43')](handleError(_0x48dc20,null));};exports['download']=function(_0x512ea1,_0x310b9e,_0x4601f7){return db[_0x45dd('0x2a')]['findOne']({'where':{'id':_0x512ea1[_0x45dd('0x44')]['id']},'raw':!![]})[_0x45dd('0x24')](handleEntityNotFound(_0x310b9e,null))[_0x45dd('0x24')](function(_0x38647e){if(_0x38647e){var _0x33d1fe=_0x38647e['ChatOfflineMessageId']!==null;var _0x298b06=path[_0x45dd('0x52')](config[_0x45dd('0x53')],'server/files/attachments/');if(_0x33d1fe){_0x298b06=path[_0x45dd('0x52')](_0x298b06,_0x45dd('0x54'));}var _0x545601=path['join'](_0x298b06,_0x38647e[_0x45dd('0x55')]);return _0x310b9e[_0x45dd('0x56')](_0x545601);}})[_0x45dd('0x43')](handleError(_0x310b9e,null));}; \ No newline at end of file +var _0x5f01=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','Attachment','fieldName','type','model','query','filters','intersection','attributes','fields','length','limit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','options','find','clone','get','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x5f01,0x19b));var _0x15f0=function(_0x2f8e3a,_0x433766){_0x2f8e3a=_0x2f8e3a-0x0;var _0x29c4fe=_0x5f01[_0x2f8e3a];return _0x29c4fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15f0('0x0'));var jsonpatch=require(_0x15f0('0x1'));var rp=require('request-promise');var moment=require(_0x15f0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x15f0('0x3'));var util=require(_0x15f0('0x4'));var path=require(_0x15f0('0x5'));var sox=require(_0x15f0('0x6'));var csv=require('to-csv');var ejs=require(_0x15f0('0x7'));var fs=require('fs');var fs_extra=require(_0x15f0('0x8'));var _=require(_0x15f0('0x9'));var squel=require('squel');var crypto=require(_0x15f0('0xa'));var jsforce=require(_0x15f0('0xb'));var deskjs=require(_0x15f0('0xc'));var toCsv=require(_0x15f0('0xd'));var querystring=require(_0x15f0('0xe'));var Papa=require(_0x15f0('0xf'));var Redis=require(_0x15f0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x15f0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15f0('0x12'));var logger=require(_0x15f0('0x13'))(_0x15f0('0x14'));var utils=require(_0x15f0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x15f0('0x16'));var db=require(_0x15f0('0x17'))['db'];function respondWithStatusCode(_0x511d6a,_0x3afb6e){_0x3afb6e=_0x3afb6e||0xcc;return function(_0x4ee15b){if(_0x4ee15b){return _0x511d6a[_0x15f0('0x18')](_0x3afb6e);}return _0x511d6a['status'](_0x3afb6e)['end']();};}function respondWithResult(_0x49a130,_0x325778){_0x325778=_0x325778||0xc8;return function(_0x2929de){if(_0x2929de){return _0x49a130[_0x15f0('0x19')](_0x325778)[_0x15f0('0x1a')](_0x2929de);}};}function respondWithFilteredResult(_0x47105a,_0x11cb29){return function(_0x5668ef){if(_0x5668ef){var _0x490ebc=typeof _0x11cb29[_0x15f0('0x1b')]==='undefined'&&typeof _0x11cb29['limit']===_0x15f0('0x1c');var _0x342276=_0x5668ef['count'];var _0x47021d=_0x490ebc?0x0:_0x11cb29['offset'];var _0x1222a2=_0x490ebc?_0x5668ef[_0x15f0('0x1d')]:_0x11cb29[_0x15f0('0x1b')]+_0x11cb29['limit'];var _0x4bccf8;if(_0x1222a2>=_0x342276){_0x1222a2=_0x342276;_0x4bccf8=0xc8;}else{_0x4bccf8=0xce;}_0x47105a[_0x15f0('0x19')](_0x4bccf8);return _0x47105a['set'](_0x15f0('0x1e'),_0x47021d+'-'+_0x1222a2+'/'+_0x342276)['json'](_0x5668ef);}return null;};}function patchUpdates(_0xee8b4a){return function(_0x476a35){try{jsonpatch[_0x15f0('0x1f')](_0x476a35,_0xee8b4a,!![]);}catch(_0x30831d){return BPromise[_0x15f0('0x20')](_0x30831d);}return _0x476a35[_0x15f0('0x21')]();};}function saveUpdates(_0xd8e828,_0x349a63){return function(_0x3c6b12){if(_0x3c6b12){return _0x3c6b12['update'](_0xd8e828)[_0x15f0('0x22')](function(_0x2fb22c){return _0x2fb22c;});}return null;};}function removeEntity(_0x3ac7f5,_0x1cc392){return function(_0x43ecaa){if(_0x43ecaa){return _0x43ecaa[_0x15f0('0x23')]()[_0x15f0('0x22')](function(){_0x3ac7f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e5746,_0x45ea21){return function(_0x2ffd71){if(!_0x2ffd71){_0x2e5746[_0x15f0('0x18')](0x194);}return _0x2ffd71;};}function handleError(_0x23e4d2,_0x3ac799){_0x3ac799=_0x3ac799||0x1f4;return function(_0x2329c8){logger[_0x15f0('0x24')](_0x2329c8[_0x15f0('0x25')]);if(_0x2329c8['name']){delete _0x2329c8[_0x15f0('0x26')];}_0x23e4d2[_0x15f0('0x19')](_0x3ac799)['send'](_0x2329c8);};}exports['index']=function(_0x4b4ed0,_0x5c8857){var _0x49e1c0={},_0x37905e={},_0x337f7a={'count':0x0,'rows':[]};var _0x4d6ebd=_[_0x15f0('0x27')](db[_0x15f0('0x28')]['rawAttributes'],function(_0x43b6fa){return{'name':_0x43b6fa[_0x15f0('0x29')],'type':_0x43b6fa[_0x15f0('0x2a')]['key']};});_0x37905e[_0x15f0('0x2b')]=_[_0x15f0('0x27')](_0x4d6ebd,_0x15f0('0x26'));_0x37905e[_0x15f0('0x2c')]=_['keys'](_0x4b4ed0[_0x15f0('0x2c')]);_0x37905e[_0x15f0('0x2d')]=_[_0x15f0('0x2e')](_0x37905e['model'],_0x37905e[_0x15f0('0x2c')]);_0x49e1c0[_0x15f0('0x2f')]=_['intersection'](_0x37905e['model'],qs[_0x15f0('0x30')](_0x4b4ed0[_0x15f0('0x2c')][_0x15f0('0x30')]));_0x49e1c0[_0x15f0('0x2f')]=_0x49e1c0[_0x15f0('0x2f')][_0x15f0('0x31')]?_0x49e1c0['attributes']:_0x37905e[_0x15f0('0x2b')];if(!_0x4b4ed0[_0x15f0('0x2c')]['hasOwnProperty']('nolimit')){_0x49e1c0['limit']=qs[_0x15f0('0x32')](_0x4b4ed0[_0x15f0('0x2c')]['limit']);_0x49e1c0[_0x15f0('0x1b')]=qs[_0x15f0('0x1b')](_0x4b4ed0[_0x15f0('0x2c')][_0x15f0('0x1b')]);}_0x49e1c0['order']=qs[_0x15f0('0x33')](_0x4b4ed0[_0x15f0('0x2c')][_0x15f0('0x33')]);_0x49e1c0[_0x15f0('0x34')]=qs['filters'](_['pick'](_0x4b4ed0[_0x15f0('0x2c')],_0x37905e[_0x15f0('0x2d')]),_0x4d6ebd);if(_0x4b4ed0['query'][_0x15f0('0x35')]){_0x49e1c0[_0x15f0('0x34')]=_['merge'](_0x49e1c0[_0x15f0('0x34')],{'$or':_['map'](_0x4d6ebd,function(_0xcbd57){if(_0xcbd57[_0x15f0('0x2a')]!==_0x15f0('0x36')){var _0x3693da={};_0x3693da[_0xcbd57[_0x15f0('0x26')]]={'$like':'%'+_0x4b4ed0['query'][_0x15f0('0x35')]+'%'};return _0x3693da;}})});}_0x49e1c0=_['merge']({},_0x49e1c0,_0x4b4ed0['options']);var _0x32a262={'where':_0x49e1c0[_0x15f0('0x34')]};return db[_0x15f0('0x28')][_0x15f0('0x1d')](_0x32a262)[_0x15f0('0x22')](function(_0x5c2651){_0x337f7a[_0x15f0('0x1d')]=_0x5c2651;if(_0x4b4ed0[_0x15f0('0x2c')][_0x15f0('0x37')]){_0x49e1c0[_0x15f0('0x38')]=[{'all':!![]}];}return db[_0x15f0('0x28')][_0x15f0('0x39')](_0x49e1c0);})[_0x15f0('0x22')](function(_0x30726d){_0x337f7a[_0x15f0('0x3a')]=_0x30726d;return _0x337f7a;})['then'](respondWithFilteredResult(_0x5c8857,_0x49e1c0))[_0x15f0('0x3b')](handleError(_0x5c8857,null));};exports[_0x15f0('0x3c')]=function(_0x45c3b8,_0x19fe75){var _0x517ca1={'raw':!![],'where':{'id':_0x45c3b8[_0x15f0('0x3d')]['id']}},_0x5d38b4={};_0x5d38b4[_0x15f0('0x2b')]=_[_0x15f0('0x3e')](db[_0x15f0('0x28')][_0x15f0('0x3f')]);_0x5d38b4[_0x15f0('0x2c')]=_['keys'](_0x45c3b8[_0x15f0('0x2c')]);_0x5d38b4[_0x15f0('0x2d')]=_[_0x15f0('0x2e')](_0x5d38b4[_0x15f0('0x2b')],_0x5d38b4[_0x15f0('0x2c')]);_0x517ca1['attributes']=_['intersection'](_0x5d38b4[_0x15f0('0x2b')],qs[_0x15f0('0x30')](_0x45c3b8[_0x15f0('0x2c')][_0x15f0('0x30')]));_0x517ca1[_0x15f0('0x2f')]=_0x517ca1[_0x15f0('0x2f')][_0x15f0('0x31')]?_0x517ca1[_0x15f0('0x2f')]:_0x5d38b4[_0x15f0('0x2b')];if(_0x45c3b8['query'][_0x15f0('0x37')]){_0x517ca1[_0x15f0('0x38')]=[{'all':!![]}];}_0x517ca1=_[_0x15f0('0x40')]({},_0x517ca1,_0x45c3b8[_0x15f0('0x41')]);return db['Attachment'][_0x15f0('0x42')](_0x517ca1)[_0x15f0('0x22')](handleEntityNotFound(_0x19fe75,null))['then'](respondWithResult(_0x19fe75,null))['catch'](handleError(_0x19fe75,null));};exports[_0x15f0('0x43')]=function(_0x142a24,_0x29fb12){var _0x4393db={'where':{'id':_0x142a24[_0x15f0('0x3d')]['id']}},_0x41a7c8={};_0x41a7c8[_0x15f0('0x2b')]=_['keys'](db[_0x15f0('0x28')][_0x15f0('0x3f')]);_0x4393db[_0x15f0('0x2f')]=_['intersection'](_0x41a7c8[_0x15f0('0x2b')],qs[_0x15f0('0x30')](_0x142a24[_0x15f0('0x2c')]['fields']));_0x4393db[_0x15f0('0x2f')]=_0x4393db[_0x15f0('0x2f')]['length']?_0x4393db[_0x15f0('0x2f')]:_0x41a7c8[_0x15f0('0x2b')];if(_0x142a24['query'][_0x15f0('0x37')]){_0x4393db[_0x15f0('0x38')]=[{'all':!![]}];}_0x4393db=_[_0x15f0('0x40')]({},_0x4393db,_0x142a24['options']);return db[_0x15f0('0x28')][_0x15f0('0x42')](_0x4393db)[_0x15f0('0x22')](handleEntityNotFound(_0x29fb12,null))['then'](function(_0x2eb206){if(_0x2eb206){var _0x2b7e2d=_0x2eb206[_0x15f0('0x44')]({'plain':!![]});_0x2b7e2d=qs[_0x15f0('0x45')](_0x2b7e2d,['id',_0x15f0('0x46'),_0x15f0('0x47')]);_0x142a24[_0x15f0('0x48')]=_[_0x15f0('0x45')](_0x142a24['body'],['id','createdAt',_0x15f0('0x47')]);return db[_0x15f0('0x28')]['create'](_['merge'](_0x2b7e2d,_0x142a24['body']),{'include':_0x142a24['query'][_0x15f0('0x37')]?[{'all':!![]}]:undefined});}})[_0x15f0('0x22')](respondWithResult(_0x29fb12,0xc9))[_0x15f0('0x3b')](handleError(_0x29fb12,null));};exports[_0x15f0('0x49')]=function(_0x25ab45,_0xa93209){if(_0x25ab45[_0x15f0('0x48')]['id']){delete _0x25ab45[_0x15f0('0x48')]['id'];}return db[_0x15f0('0x28')]['find']({'where':{'id':_0x25ab45[_0x15f0('0x3d')]['id']}})['then'](handleEntityNotFound(_0xa93209,null))[_0x15f0('0x22')](saveUpdates(_0x25ab45[_0x15f0('0x48')],null))['then'](respondWithResult(_0xa93209,null))[_0x15f0('0x3b')](handleError(_0xa93209,null));};exports[_0x15f0('0x23')]=function(_0xfa6699,_0x14164f){return db[_0x15f0('0x28')]['find']({'where':{'id':_0xfa6699[_0x15f0('0x3d')]['id']}})[_0x15f0('0x22')](handleEntityNotFound(_0x14164f,null))[_0x15f0('0x22')](removeEntity(_0x14164f,null))[_0x15f0('0x3b')](handleError(_0x14164f,null));};exports[_0x15f0('0x4a')]=function(_0x57b7a3,_0x132d08,_0x321ae0){_0x57b7a3[_0x15f0('0x48')][_0x15f0('0x26')]=_0x57b7a3[_0x15f0('0x4b')][_0x15f0('0x4c')];_0x57b7a3[_0x15f0('0x48')][_0x15f0('0x4d')]=_0x57b7a3[_0x15f0('0x4b')][_0x15f0('0x4e')];_0x57b7a3[_0x15f0('0x48')][_0x15f0('0x2a')]=_0x57b7a3[_0x15f0('0x4b')][_0x15f0('0x4f')];return db[_0x15f0('0x28')][_0x15f0('0x4a')](_0x57b7a3[_0x15f0('0x48')])[_0x15f0('0x22')](respondWithResult(_0x132d08,0xc9))['catch'](handleError(_0x132d08,null));};exports[_0x15f0('0x50')]=function(_0x4ad608,_0x305185,_0x4e4ced){return db[_0x15f0('0x28')][_0x15f0('0x51')]({'where':{'id':_0x4ad608[_0x15f0('0x3d')]['id']},'raw':!![]})[_0x15f0('0x22')](handleEntityNotFound(_0x305185,null))[_0x15f0('0x22')](function(_0x4c0a81){if(_0x4c0a81){var _0x3e0248=_0x4c0a81[_0x15f0('0x52')]!==null;var _0x4cf29a=path['join'](config[_0x15f0('0x53')],'server/files/attachments/');if(_0x3e0248){_0x4cf29a=path[_0x15f0('0x54')](_0x4cf29a,_0x15f0('0x55'));}var _0x304178=path['join'](_0x4cf29a,_0x4c0a81[_0x15f0('0x4d')]);return _0x305185[_0x15f0('0x50')](_0x304178);}})[_0x15f0('0x3b')](handleError(_0x305185,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1e8a37c..c61ef2b 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 _0x910d=['./attachment.attributes','exports','Attachment','util','../../config/logger','api','moment','request-promise','path'];(function(_0x30ec9b,_0xc6365a){var _0x4c74a6=function(_0x5da73e){while(--_0x5da73e){_0x30ec9b['push'](_0x30ec9b['shift']());}};_0x4c74a6(++_0xc6365a);}(_0x910d,0x93));var _0xd910=function(_0x544765,_0x22fc47){_0x544765=_0x544765-0x0;var _0x2224ee=_0x910d[_0x544765];return _0x2224ee;};'use strict';var _=require('lodash');var util=require(_0xd910('0x0'));var logger=require(_0xd910('0x1'))(_0xd910('0x2'));var moment=require(_0xd910('0x3'));var BPromise=require('bluebird');var rp=require(_0xd910('0x4'));var fs=require('fs');var path=require(_0xd910('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd910('0x6'));module[_0xd910('0x7')]=function(_0x5d796b,_0x40ac58){return _0x5d796b['define'](_0xd910('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger','bluebird'];(function(_0x1d760b,_0x47f9fe){var _0x18fb17=function(_0x312def){while(--_0x312def){_0x1d760b['push'](_0x1d760b['shift']());}};_0x18fb17(++_0x47f9fe);}(_0x9fd4,0x135));var _0x49fd=function(_0x3df31d,_0x5081ff){_0x3df31d=_0x3df31d-0x0;var _0x352dbc=_0x9fd4[_0x3df31d];return _0x352dbc;};'use strict';var _=require('lodash');var util=require(_0x49fd('0x0'));var logger=require(_0x49fd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x49fd('0x2'));var rp=require(_0x49fd('0x3'));var fs=require('fs');var path=require(_0x49fd('0x4'));var rimraf=require(_0x49fd('0x5'));var config=require(_0x49fd('0x6'));var attributes=require(_0x49fd('0x7'));module[_0x49fd('0x8')]=function(_0x216c25,_0x24f6e7){return _0x216c25[_0x49fd('0x9')](_0x49fd('0xa'),attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 04e1b51..88337d5 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 _0x81d5=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x14082b,_0x3672d6){var _0x53a93d=function(_0x514882){while(--_0x514882){_0x14082b['push'](_0x14082b['shift']());}};_0x53a93d(++_0x3672d6);}(_0x81d5,0x1ab));var _0x581d=function(_0x50ec08,_0x9f5571){_0x50ec08=_0x50ec08-0x0;var _0x4824ae=_0x81d5[_0x50ec08];return _0x4824ae;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var moment=require('moment');var BPromise=require(_0x581d('0x2'));var rs=require(_0x581d('0x3'));var fs=require('fs');var Redis=require(_0x581d('0x4'));var db=require(_0x581d('0x5'))['db'];var utils=require(_0x581d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x581d('0x7'));var jayson=require(_0x581d('0x8'));var client=jayson[_0x581d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16067b,_0x2f32bf,_0x43124c){return new BPromise(function(_0x497368,_0xf1a3b6){return client['request'](_0x16067b,_0x43124c)['then'](function(_0x5d8fa3){logger[_0x581d('0xa')](_0x581d('0xb'),_0x2f32bf,_0x581d('0xc'));logger[_0x581d('0xd')](_0x581d('0xe'),_0x2f32bf,'request\x20sent',JSON[_0x581d('0xf')](_0x5d8fa3));if(_0x5d8fa3[_0x581d('0x10')]){if(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x11')]===0x1f4){logger[_0x581d('0x10')](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);return _0xf1a3b6(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);}logger['error'](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')]['message']);return _0x497368(_0x5d8fa3['error']['message']);}else{logger['info'](_0x581d('0xb'),_0x2f32bf,'request\x20sent');_0x497368(_0x5d8fa3[_0x581d('0x13')][_0x581d('0x12')]);}})['catch'](function(_0x1890d0){logger['error'](_0x581d('0xb'),_0x2f32bf,_0x1890d0);_0xf1a3b6(_0x1890d0);});});}exports[_0x581d('0x14')]=function(_0x1e059d){var _0x42f7db=this;return new Promise(function(_0x1f790f,_0x2cff0d){return db[_0x581d('0x15')]['create'](_0x1e059d[_0x581d('0x16')],{'raw':_0x1e059d[_0x581d('0x17')]?_0x1e059d[_0x581d('0x17')][_0x581d('0x18')]===undefined?!![]:![]:!![]})[_0x581d('0x19')](function(_0x2a2aba){logger[_0x581d('0xa')](_0x581d('0x14'),_0x1e059d);logger[_0x581d('0xd')](_0x581d('0x14'),_0x1e059d,JSON[_0x581d('0xf')](_0x2a2aba));_0x1f790f(_0x2a2aba);})[_0x581d('0x1a')](function(_0x5add13){logger[_0x581d('0x10')](_0x581d('0x14'),_0x5add13[_0x581d('0x12')],_0x1e059d);_0x2cff0d(_0x42f7db[_0x581d('0x10')](0x1f4,_0x5add13[_0x581d('0x12')]));});});}; \ No newline at end of file +var _0xc36d=['client','http','request','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','CreateAttachment','Attachment','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x272b7a,_0x1fbe07){var _0x5b788e=function(_0x5866e1){while(--_0x5866e1){_0x272b7a['push'](_0x272b7a['shift']());}};_0x5b788e(++_0x1fbe07);}(_0xc36d,0x7d));var _0xdc36=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0xc36d[_0x47bc5e];return _0x323a59;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6e4753,_0x571311,_0x20ba02){return new BPromise(function(_0x456897,_0x2a0087){return client[_0xdc36('0xc')](_0x6e4753,_0x20ba02)['then'](function(_0x20d00a){logger[_0xdc36('0xd')]('Attachment,\x20%s,\x20%s',_0x571311,_0xdc36('0xe'));logger[_0xdc36('0xf')](_0xdc36('0x10'),_0x571311,'request\x20sent',JSON[_0xdc36('0x11')](_0x20d00a));if(_0x20d00a[_0xdc36('0x12')]){if(_0x20d00a['error']['code']===0x1f4){logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x571311,_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);return _0x2a0087(_0x20d00a['error'][_0xdc36('0x14')]);}logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x571311,_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);return _0x456897(_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);}else{logger[_0xdc36('0xd')]('Attachment,\x20%s,\x20%s',_0x571311,_0xdc36('0xe'));_0x456897(_0x20d00a['result']['message']);}})['catch'](function(_0x64f61e){logger[_0xdc36('0x12')]('Attachment,\x20%s,\x20%s',_0x571311,_0x64f61e);_0x2a0087(_0x64f61e);});});}exports[_0xdc36('0x15')]=function(_0x219a73){var _0x160d70=this;return new Promise(function(_0x225878,_0x183c91){return db[_0xdc36('0x16')]['create'](_0x219a73[_0xdc36('0x17')],{'raw':_0x219a73[_0xdc36('0x18')]?_0x219a73['options'][_0xdc36('0x19')]===undefined?!![]:![]:!![]})[_0xdc36('0x1a')](function(_0x3f25f0){logger['info'](_0xdc36('0x15'),_0x219a73);logger[_0xdc36('0xf')]('CreateAttachment',_0x219a73,JSON[_0xdc36('0x11')](_0x3f25f0));_0x225878(_0x3f25f0);})['catch'](function(_0x5a6e35){logger[_0xdc36('0x12')](_0xdc36('0x15'),_0x5a6e35[_0xdc36('0x14')],_0x219a73);_0x183c91(_0x160d70[_0xdc36('0x12')](0x1f4,_0x5a6e35[_0xdc36('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1309d00..dac0c43 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x5e3d82,_0x97b075){var _0x18b0b7=function(_0x5633c4){while(--_0x5633c4){_0x5e3d82['push'](_0x5e3d82['shift']());}};_0x18b0b7(++_0x97b075);}(_0x757a,0xde));var _0xa757=function(_0x32c68d,_0x3eea58){_0x32c68d=_0x32c68d-0x0;var _0x23a39d=_0x757a[_0x32c68d];return _0x23a39d;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x125238,_0x12dea4){var _0x357419=function(_0x38a531){while(--_0x38a531){_0x125238['push'](_0x125238['shift']());}};_0x357419(++_0x12dea4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x537408,_0x4da70d){_0x537408=_0x537408-0x0;var _0x4a0dc8=_0x5f2f[_0x537408];return _0x4a0dc8;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d09b27e..566e420 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71fd=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','disabled','blocked','blockedAt','admin','user','agent','domain','add','minutes','getLicense','catch','send','message','login','signToken','online','use','ad-login','User','passport-local','moment','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x71fd,0x1c1));var _0xd71f=function(_0x1a2b00,_0x49c0d6){_0x1a2b00=_0x1a2b00-0x0;var _0x5c3cfb=_0x71fd[_0x1a2b00];return _0x5c3cfb;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xd71f('0x0'))['Strategy'];var moment=require(_0xd71f('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xd71f('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0xd71f('0x3'));var utils=require(_0xd71f('0x4'));var config=require(_0xd71f('0x5'));var logger=require(_0xd71f('0x6'))(_0xd71f('0x7'));function isActiveDirectoryConfigured(_0x2be03c){var _0x44073b=![];if(typeof _0x2be03c[_0xd71f('0x8')]!==_0xd71f('0x9')){_0x44073b=_0x2be03c['activedirectory']['baseDN']&&_0x2be03c['activedirectory']['url']&&_0x2be03c[_0xd71f('0x8')]['domain'];}return _0x44073b;}function adAuthenticate(_0x347f92,_0x27be32,_0x1d2ad0){return new BPromise(function(_0x3b4781,_0x5f2ccf){try{var _0xb68675=new ActiveDirectory(_0x347f92);_0xb68675['authenticate'](_0x27be32,_0x1d2ad0,function(_0x19e2f5,_0xcd5619){if(_0x19e2f5){logger[_0xd71f('0xa')]('Error\x20authenticate\x20%s:\x20%s',_0x27be32,util[_0xd71f('0xb')](_0x19e2f5,{'showHidden':![],'depth':null}));_0x5f2ccf(_0xd71f('0xc'));}else if(!_0xcd5619){logger['error'](_0xd71f('0xd'),_0x27be32);_0x5f2ccf(_0xd71f('0xc'));}else{_0x3b4781(_0xcd5619);}});}catch(_0x3672d7){_0x5f2ccf(_0x3672d7);}});}function ActiveDirectoryAuthenticate(_0x48f224,_0x1a571a,_0x970cc6,_0x223177){var _0x39c85e,_0x13cecd;if(!isActiveDirectoryConfigured(config)){logger[_0xd71f('0xa')](_0xd71f('0xe'),_0x1a571a);return _0x223177(null,![],{'message':_0xd71f('0xc')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd71f('0xf'),_0xd71f('0x10')],'raw':!![]})[_0xd71f('0x11')](function(_0x5db4a0){_0x39c85e=_0x5db4a0;if(!_0x39c85e[_0xd71f('0xf')]){logger['error'](_0xd71f('0x12'),_0x1a571a);throw new Error(_0xd71f('0xc'));}return _0x48f224[_0xd71f('0x13')]({'attributes':['id',_0xd71f('0x14'),_0xd71f('0x15'),'salt',_0xd71f('0x16'),_0xd71f('0x17'),_0xd71f('0x18'),_0xd71f('0x19'),'online'],'where':{'name':_0x1a571a,'role':{'$or':[_0xd71f('0x1a'),_0xd71f('0x1b'),_0xd71f('0x1c')]},'adSsoEnabled':!![]}});})[_0xd71f('0x11')](function(_0x33013e){if(!_0x33013e||_0x33013e&&_0x33013e['name']!==_0x1a571a){throw new Error(_0xd71f('0xc'));}_0x13cecd=_0x33013e;var _0x1fc148=_0x13cecd['name']+'@'+config['activedirectory'][_0xd71f('0x1d')];return adAuthenticate(config['activedirectory'],_0x1fc148,_0x970cc6);})[_0xd71f('0x11')](function(_0xdec4bd){if(_0x13cecd[_0xd71f('0x17')]){throw new Error(_0xd71f('0xc'));}if(_0x39c85e[_0xd71f('0x10')]>0x0){if(_0x13cecd[_0xd71f('0x18')]){if(moment(_0x13cecd[_0xd71f('0x19')])[_0xd71f('0x1e')](_0x39c85e['blockDuration'],_0xd71f('0x1f'))>moment()){throw new Error(_0xd71f('0xc'));}return utils['clearBlockUser'](_0x13cecd,0x0,![],null)['then'](function(){return utils[_0xd71f('0x20')](_0x13cecd);})['then'](function(){return _0x223177(null,_0x13cecd);});}else{return utils['getLicense'](_0x13cecd)[_0xd71f('0x11')](function(){return _0x223177(null,_0x13cecd);});}}else{return utils[_0xd71f('0x20')](_0x13cecd)[_0xd71f('0x11')](function(){return _0x223177(null,_0x13cecd);});}})[_0xd71f('0x21')](function(_0x199893){return _0x223177(null,![],_0x199893);});}function handleError(_0x2215fe,_0x4f2a5a,_0x5883c3){return _0x2215fe['status'](_0x4f2a5a||0x1f4)[_0xd71f('0x22')]({'message':_0x5883c3?_0x5883c3[_0xd71f('0x23')]||_0x5883c3:''});}exports[_0xd71f('0x24')]=function(_0x2eb63d,_0x4920b3,_0x597948){passport['authenticate']('ad-login',function(_0x4153a9,_0x397001,_0x2c9005){var _0x5ccd04=_0x4153a9||_0x2c9005;if(_0x5ccd04){return handleError(_0x4920b3,0x191,_0x5ccd04);}if(!_0x397001){return handleError(_0x4920b3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x71403c={'payload':{'id':_0x397001['id'],'role':_0x397001['role']},'options':{'expiresIn':0x15180}};return authService[_0xd71f('0x25')](_0x71403c)[_0xd71f('0x11')](function(_0x5e2aa7){_0x4920b3['json']({'id':_0x397001['id'],'token':_0x5e2aa7,'statusCall':'','isAlreadyLogged':_0x397001[_0xd71f('0x26')]});});}})(_0x2eb63d,_0x4920b3,_0x597948);};passport[_0xd71f('0x27')](_0xd71f('0x28'),new LocalStrategy({'usernameField':_0xd71f('0x14'),'passwordField':_0xd71f('0x15')},function(_0x3661bb,_0x163b00,_0x2e75ea){return ActiveDirectoryAuthenticate(db[_0xd71f('0x29')],_0x3661bb,_0x163b00,_0x2e75ea);})); \ No newline at end of file +var _0xbc96=['user','agent','blockedAt','add','minutes','getLicense','catch','status','send','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked'];(function(_0x350ee9,_0x3ce707){var _0x19ec07=function(_0x1552fc){while(--_0x1552fc){_0x350ee9['push'](_0x350ee9['shift']());}};_0x19ec07(++_0x3ce707);}(_0xbc96,0x1c0));var _0x6bc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc96[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require(_0x6bc9('0x0'));var LocalStrategy=require(_0x6bc9('0x1'))[_0x6bc9('0x2')];var moment=require(_0x6bc9('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x6bc9('0x4'));var util=require(_0x6bc9('0x5'));var db=require(_0x6bc9('0x6'))['db'];var authService=require(_0x6bc9('0x7'));var utils=require('../../config/utils');var config=require(_0x6bc9('0x8'));var logger=require(_0x6bc9('0x9'))('api');function isActiveDirectoryConfigured(_0x4a7033){var _0x2b05bf=![];if(typeof _0x4a7033[_0x6bc9('0xa')]!==_0x6bc9('0xb')){_0x2b05bf=_0x4a7033[_0x6bc9('0xa')][_0x6bc9('0xc')]&&_0x4a7033[_0x6bc9('0xa')]['url']&&_0x4a7033[_0x6bc9('0xa')][_0x6bc9('0xd')];}return _0x2b05bf;}function adAuthenticate(_0x3a37b2,_0x4c1e7b,_0x173369){return new BPromise(function(_0x1107e6,_0x6337c1){try{var _0x243679=new ActiveDirectory(_0x3a37b2);_0x243679['authenticate'](_0x4c1e7b,_0x173369,function(_0x423e97,_0x27c970){if(_0x423e97){logger[_0x6bc9('0xe')](_0x6bc9('0xf'),_0x4c1e7b,util[_0x6bc9('0x10')](_0x423e97,{'showHidden':![],'depth':null}));_0x6337c1(_0x6bc9('0x11'));}else if(!_0x27c970){logger['error'](_0x6bc9('0x12'),_0x4c1e7b);_0x6337c1(_0x6bc9('0x11'));}else{_0x1107e6(_0x27c970);}});}catch(_0x1d0d09){_0x6337c1(_0x1d0d09);}});}function ActiveDirectoryAuthenticate(_0x3695f2,_0x237ab5,_0x451df1,_0x429cdb){var _0x383829,_0x1678af;if(!isActiveDirectoryConfigured(config)){logger[_0x6bc9('0xe')](_0x6bc9('0x13'),_0x237ab5);return _0x429cdb(null,![],{'message':_0x6bc9('0x11')});}return db[_0x6bc9('0x14')][_0x6bc9('0x15')]({'where':{'id':0x1},'attributes':[_0x6bc9('0x16'),_0x6bc9('0x17')],'raw':!![]})[_0x6bc9('0x18')](function(_0x415b68){_0x383829=_0x415b68;if(!_0x383829['adSsoEnabled']){logger['error'](_0x6bc9('0x19'),_0x237ab5);throw new Error(_0x6bc9('0x11'));}return _0x3695f2['findOne']({'attributes':['id',_0x6bc9('0x1a'),_0x6bc9('0x1b'),_0x6bc9('0x1c'),_0x6bc9('0x1d'),_0x6bc9('0x1e'),_0x6bc9('0x1f'),'blockedAt','online'],'where':{'name':_0x237ab5,'role':{'$or':['admin',_0x6bc9('0x20'),_0x6bc9('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x693cb6){if(!_0x693cb6||_0x693cb6&&_0x693cb6[_0x6bc9('0x1a')]!==_0x237ab5){throw new Error(_0x6bc9('0x11'));}_0x1678af=_0x693cb6;var _0x4e0ad5=_0x1678af['name']+'@'+config[_0x6bc9('0xa')][_0x6bc9('0xd')];return adAuthenticate(config[_0x6bc9('0xa')],_0x4e0ad5,_0x451df1);})[_0x6bc9('0x18')](function(_0x4ef328){if(_0x1678af[_0x6bc9('0x1e')]){throw new Error(_0x6bc9('0x11'));}if(_0x383829[_0x6bc9('0x17')]>0x0){if(_0x1678af[_0x6bc9('0x1f')]){if(moment(_0x1678af[_0x6bc9('0x22')])[_0x6bc9('0x23')](_0x383829['blockDuration'],_0x6bc9('0x24'))>moment()){throw new Error(_0x6bc9('0x11'));}return utils['clearBlockUser'](_0x1678af,0x0,![],null)[_0x6bc9('0x18')](function(){return utils[_0x6bc9('0x25')](_0x1678af);})['then'](function(){return _0x429cdb(null,_0x1678af);});}else{return utils[_0x6bc9('0x25')](_0x1678af)['then'](function(){return _0x429cdb(null,_0x1678af);});}}else{return utils[_0x6bc9('0x25')](_0x1678af)[_0x6bc9('0x18')](function(){return _0x429cdb(null,_0x1678af);});}})[_0x6bc9('0x26')](function(_0x372f70){return _0x429cdb(null,![],_0x372f70);});}function handleError(_0x5a0a92,_0x5a9c8c,_0x4574ae){return _0x5a0a92[_0x6bc9('0x27')](_0x5a9c8c||0x1f4)[_0x6bc9('0x28')]({'message':_0x4574ae?_0x4574ae['message']||_0x4574ae:''});}exports['login']=function(_0x57e143,_0xd87173,_0x5b115a){passport[_0x6bc9('0x29')](_0x6bc9('0x2a'),function(_0x255bef,_0x117d5f,_0x21d903){var _0x77f75b=_0x255bef||_0x21d903;if(_0x77f75b){return handleError(_0xd87173,0x191,_0x77f75b);}if(!_0x117d5f){return handleError(_0xd87173,0x194,{'message':_0x6bc9('0x2b')});}else{var _0x558024={'payload':{'id':_0x117d5f['id'],'role':_0x117d5f[_0x6bc9('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x6bc9('0x2c')](_0x558024)['then'](function(_0x3bb60e){_0xd87173[_0x6bc9('0x2d')]({'id':_0x117d5f['id'],'token':_0x3bb60e,'statusCall':'','isAlreadyLogged':_0x117d5f[_0x6bc9('0x2e')]});});}})(_0x57e143,_0xd87173,_0x5b115a);};passport['use'](_0x6bc9('0x2a'),new LocalStrategy({'usernameField':_0x6bc9('0x1a'),'passwordField':_0x6bc9('0x1b')},function(_0x5403b4,_0x527afc,_0x57e980){return ActiveDirectoryAuthenticate(db[_0x6bc9('0x2f')],_0x5403b4,_0x527afc,_0x57e980);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index b26494c..029f09e 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeebb=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x2a526f,_0x1410a1){var _0x2aa6d0=function(_0x3c9690){while(--_0x3c9690){_0x2a526f['push'](_0x2a526f['shift']());}};_0x2aa6d0(++_0x1410a1);}(_0xeebb,0xbf));var _0xbeeb=function(_0xf31126,_0x16ce8c){_0xf31126=_0xf31126-0x0;var _0x1c27b7=_0xeebb[_0xf31126];return _0x1c27b7;};'use strict';var express=require('express');var router=express[_0xbeeb('0x0')]();var controller=require(_0xbeeb('0x1'));router[_0xbeeb('0x2')]('/',controller[_0xbeeb('0x3')]);module[_0xbeeb('0x4')]=router; \ No newline at end of file +var _0x87d5=['express','Router','post','exports'];(function(_0xeb7c0c,_0x38560d){var _0x328ed6=function(_0x31c14d){while(--_0x31c14d){_0xeb7c0c['push'](_0xeb7c0c['shift']());}};_0x328ed6(++_0x38560d);}(_0x87d5,0xdc));var _0x587d=function(_0x293f8a,_0x288371){_0x293f8a=_0x293f8a-0x0;var _0x2e4557=_0x87d5[_0x293f8a];return _0x2e4557;};'use strict';var express=require(_0x587d('0x0'));var router=express[_0x587d('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x587d('0x2')]('/',controller['login']);module[_0x587d('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e1d5e06..2976b0e 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x7a54,0x106));var _0x47a5=function(_0x46c46a,_0x203b08){_0x46c46a=_0x46c46a-0x0;var _0x43bd58=_0x7a54[_0x46c46a];return _0x43bd58;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x2a649d,_0x3894ff){var _0x17ac80=function(_0x15b1e4){while(--_0x15b1e4){_0x2a649d['push'](_0x2a649d['shift']());}};_0x17ac80(++_0x3894ff);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f0f22f6..8a1268b 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 _0x591a=['callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','login','get','/callback'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x591a,0x163));var _0xa591=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x591a[_0xaa0309];return _0x5de7ce;};'use strict';var express=require(_0xa591('0x0'));var passport=require(_0xa591('0x1'));var router=express[_0xa591('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa591('0x3'));var authService=require(_0xa591('0x4'));router['get']('/',controller[_0xa591('0x5')]);router[_0xa591('0x6')](_0xa591('0x7'),controller[_0xa591('0x8')],authService[_0xa591('0x9')],userController[_0xa591('0x5')],authService[_0xa591('0xa')]);module['exports']=router; \ No newline at end of file +var _0xf3ac=['exports','./authGoogle.controller','../user/user.controller.js','get','callback','isMiddleware','login','setTokenCookie'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xf3ac,0x79));var _0xcf3a=function(_0x4dc259,_0x33c454){_0x4dc259=_0x4dc259-0x0;var _0x289719=_0xf3ac[_0x4dc259];return _0x289719;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0xcf3a('0x0'));var userController=require(_0xcf3a('0x1'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0xcf3a('0x2')]('/callback',controller[_0xcf3a('0x3')],authService[_0xcf3a('0x4')],userController[_0xcf3a('0x5')],authService[_0xcf3a('0x6')]);module[_0xcf3a('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 013ec3a..4f54360 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 _0x6ee3=['signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','then','catch','getLicense','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x1d442f,_0x10ca71){var _0x7a2cba=function(_0xde90f0){while(--_0xde90f0){_0x1d442f['push'](_0x1d442f['shift']());}};_0x7a2cba(++_0x10ca71);}(_0x6ee3,0x1bf));var _0x36ee=function(_0x3b7f7a,_0x5d46f3){_0x3b7f7a=_0x3b7f7a-0x0;var _0x169981=_0x6ee3[_0x3b7f7a];return _0x169981;};'use strict';var util=require('util');var passport=require(_0x36ee('0x0'));var LocalStrategy=require(_0x36ee('0x1'))[_0x36ee('0x2')];var jayson=require(_0x36ee('0x3'));var _=require(_0x36ee('0x4'));var rs=require('randomstring');var moment=require(_0x36ee('0x5'));var db=require(_0x36ee('0x6'))['db'];var authService=require(_0x36ee('0x7'));var utils=require(_0x36ee('0x8'));var client=jayson[_0x36ee('0x9')][_0x36ee('0xa')]({'port':0x232b});function localAuthenticate(_0x2a29d7,_0x10ba3d,_0x56355a,_0x9c6aa){var _0x33b487,_0xf7e53;return db['Setting'][_0x36ee('0xb')]({'where':{'id':0x1},'attributes':[_0x36ee('0xc'),_0x36ee('0xd')],'raw':!![]})['then'](function(_0x51f06b){_0x33b487=_0x51f06b;return _0x2a29d7[_0x36ee('0xb')]({'attributes':['id',_0x36ee('0xe'),_0x36ee('0xf'),_0x36ee('0x10'),_0x36ee('0x11'),_0x36ee('0x12'),_0x36ee('0x13'),'blockedAt',_0x36ee('0x14')],'where':{'name':_0x10ba3d,'role':{'$or':['admin',_0x36ee('0x15'),_0x36ee('0x16')]}}});})['then'](function(_0x3fa53c){if(!_0x3fa53c||_0x3fa53c&&_0x3fa53c[_0x36ee('0xe')]!==_0x10ba3d){throw new Error(_0x36ee('0x17'));}else{_0xf7e53=_0x3fa53c;return _0xf7e53;}})['then'](function(){_0xf7e53[_0x36ee('0x18')](_0x56355a,function(_0x98ac6d,_0x525bf2){var _0x5e6138=_0xf7e53[_0x36ee('0x14')]+0x1;if(_0x98ac6d){return _0x9c6aa(_0x98ac6d);}else if(!_0x525bf2){if(_0xf7e53['disabled']){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else if(_0x33b487[_0x36ee('0xc')]>0x0){if(_0xf7e53['blocked']){if(_0x33b487[_0x36ee('0xd')]>0x0){if(moment(_0xf7e53[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x33b487[_0x36ee('0xd')],_0x36ee('0x1b'))>moment()){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1c')](_0xf7e53,_0x5e6138,![],null)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});});}}else{return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}}else{if(_0x5e6138>=_0x33b487[_0x36ee('0xc')]){return utils['clearBlockUser'](_0xf7e53,0x0,!![],moment())['then'](function(){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});});}else{return utils[_0x36ee('0x1c')](_0xf7e53,_0x5e6138,![],null)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}}else{if(_0xf7e53[_0x36ee('0x12')]){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else if(_0x33b487['allowedLoginAttempts']>0x0){if(_0xf7e53['blocked']){if(_0x33b487[_0x36ee('0xd')]>0x0){if(moment(_0xf7e53[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x33b487['blockDuration'],'minutes')>moment()){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1c')](_0xf7e53,0x0,![],null)[_0x36ee('0x1d')](function(){return utils['getLicense'](_0xf7e53);})[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);});}}else{return _0x9c6aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0xf7e53,0x0,![],null)[_0x36ee('0x1d')](function(){return utils['getLicense'](_0xf7e53);})[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);})[_0x36ee('0x1e')](function(_0x1a0c90){return _0x9c6aa(null,![],_0x1a0c90);});}}else{if(_0xf7e53[_0x36ee('0x13')]){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1f')](_0xf7e53)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);});}}}});})['catch'](function(_0x487993){return _0x9c6aa(null,![],_0x487993);});}function sendServiceMail(_0x59dc0e){return db[_0x36ee('0x20')][_0x36ee('0x21')]({'where':{'service':!![]},'attributes':['id',_0x36ee('0xe'),'email'],'include':[{'model':db[_0x36ee('0x22')],'as':_0x36ee('0x23'),'include':[{'model':db[_0x36ee('0x24')],'as':'CloudProvider'}]}]})['then'](function(_0x49b2ad){if(!_0x49b2ad){throw new Error(_0x36ee('0x25'));}var _0x3db155=_0x49b2ad[_0x36ee('0x26')]();var _0x4b16ec={'account':_0x3db155,'message':_['merge']({'from':util[_0x36ee('0x27')](_0x36ee('0x28'),_0x49b2ad[_0x36ee('0xe')],_0x49b2ad[_0x36ee('0x29')]||_0x49b2ad[_0x36ee('0x23')][_0x36ee('0x15')])},_0x59dc0e)};return client[_0x36ee('0x2a')](_0x36ee('0x2b'),_0x4b16ec);})[_0x36ee('0x1d')](function(_0x5b8362){if(_0x5b8362['error']){throw new Error(util[_0x36ee('0x27')](_0x36ee('0x2c'),_0x5b8362[_0x36ee('0x2d')][_0x36ee('0x2e')]||JSON[_0x36ee('0x2f')](_0x5b8362['error'])));}return!![];});}function handleError(_0x233292,_0x191038,_0x286422){return _0x233292[_0x36ee('0x30')](_0x191038||0x1f4)['send']({'message':_0x286422?_0x286422['message']||_0x286422:''});}exports['login']=function(_0x51d1ce,_0x23b951,_0x5d98ec){passport[_0x36ee('0x18')](_0x36ee('0x31'),function(_0x30d572,_0x454f02,_0xe9e918){var _0xa9478a=_0x30d572||_0xe9e918;if(_0xa9478a){return handleError(_0x23b951,0x191,_0xa9478a);}if(!_0x454f02){return handleError(_0x23b951,0x194,{'message':_0x36ee('0x32')});}else{var _0x6d75e8={'payload':{'id':_0x454f02['id'],'role':_0x454f02[_0x36ee('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x36ee('0x33')](_0x6d75e8)[_0x36ee('0x1d')](function(_0x2ea2d9){_0x23b951[_0x36ee('0x34')]({'id':_0x454f02['id'],'token':_0x2ea2d9,'statusCall':'','isAlreadyLogged':_0x454f02[_0x36ee('0x35')]});});}})(_0x51d1ce,_0x23b951,_0x5d98ec);};exports['forgot']=function(_0x293875,_0x3b5626){if(!_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]){return handleError(_0x3b5626,0x1f4,{'message':_0x36ee('0x37')});}var _0x3ead73=rs[_0x36ee('0x38')]();_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]=_0x293875['body'][_0x36ee('0x29')][_0x36ee('0x39')]()[_0x36ee('0x3a')]();var _0x5dd304;return db[_0x36ee('0x3b')][_0x36ee('0xb')]({'where':{'id':0x1},'attributes':[_0x36ee('0xc'),_0x36ee('0xd')],'raw':!![]})[_0x36ee('0x1d')](function(_0xd39078){_0x5dd304=_0xd39078;return db[_0x36ee('0x3c')][_0x36ee('0x21')]({'where':{'email':_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]}});})[_0x36ee('0x1d')](function(_0x12897c){if(!_0x12897c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x12897c[_0x36ee('0x12')]){throw new Error(_0x36ee('0x3d'));}if(_0x12897c['blocked']){if(moment(_0x12897c[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x5dd304[_0x36ee('0xd')],_0x36ee('0x1b'))>moment()){throw new Error(_0x36ee('0x3e'));}else{_0x12897c[_0x36ee('0x13')]=![];_0x12897c['blockedAt']=null;}}_0x12897c[_0x36ee('0x3f')]=_0x3ead73;_0x12897c['resetPasswordExpires']=Date[_0x36ee('0x40')]()+0x36ee80;return _0x12897c[_0x36ee('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x293875['body'][_0x36ee('0x29')],'subject':_0x36ee('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x36ee('0x43')+'https://'+_0x293875['headers']['host']+_0x36ee('0x44')+_0x3ead73+'\x0a\x0a'+_0x36ee('0x45')});})['then'](function(){_0x3b5626[_0x36ee('0x30')](0xc8)[_0x36ee('0x46')]({'message':_0x36ee('0x47')});})[_0x36ee('0x1e')](function(_0x3ddbe1){return handleError(_0x3b5626,0x1f4,_0x3ddbe1);});};exports['reset']=function(_0x1f151b,_0x36e173){return db[_0x36ee('0x3c')]['find']({'where':{'resetPasswordToken':_0x1f151b[_0x36ee('0x48')][_0x36ee('0x49')],'resetPasswordExpires':{'$gt':Date[_0x36ee('0x40')]()}}})[_0x36ee('0x1d')](function(_0x5c7b86){if(!_0x5c7b86){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x36ee('0xb')]({'attributes':['id',_0x36ee('0x4a'),_0x36ee('0x4b'),_0x36ee('0x4c')]})['then'](function(_0x513fcd){if(_0x513fcd[_0x36ee('0x4a')])authService[_0x36ee('0x4d')](_0x1f151b[_0x36ee('0x36')][_0x36ee('0xf')]);if(!_0x513fcd[_0x36ee('0x4b')]||!_0x5c7b86[_0x36ee('0x4e')])return _0x5c7b86;authService[_0x36ee('0x4f')](_0x1f151b['body'][_0x36ee('0xf')],_0x5c7b86[_0x36ee('0x4e')],_0x513fcd[_0x36ee('0x4c')]);return _0x5c7b86;})[_0x36ee('0x1d')](function(){_0x5c7b86[_0x36ee('0xf')]=_0x1f151b[_0x36ee('0x36')][_0x36ee('0xf')];_0x5c7b86[_0x36ee('0x3f')]=null;_0x5c7b86[_0x36ee('0x50')]=null;return _0x5c7b86[_0x36ee('0x41')]();});})[_0x36ee('0x1d')](function(){_0x36e173['status'](0xc8)['send']({'message':_0x36ee('0x51')});})[_0x36ee('0x1e')](function(_0x2ae270){return handleError(_0x36e173,0x1f4,_0x2ae270);});};passport[_0x36ee('0x52')](_0x36ee('0x31'),new LocalStrategy({'usernameField':'name','passwordField':_0x36ee('0xf')},function(_0xe40a70,_0x15a74c,_0x5d2168){return localAuthenticate(db['User'],_0xe40a70,_0x15a74c,_0x5d2168);})); \ No newline at end of file +var _0x57fa=['minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','body','Email\x20parameter\x20is\x20missing','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/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','previousPasswords','resetPasswordToken','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','disabled','blocked','blockedAt','loginAttempts','admin','user','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add'];(function(_0x4d8e27,_0x32bd2b){var _0xa22d59=function(_0x27284e){while(--_0x27284e){_0x4d8e27['push'](_0x4d8e27['shift']());}};_0xa22d59(++_0x32bd2b);}(_0x57fa,0xd0));var _0xa57f=function(_0x127bc8,_0x397b14){_0x127bc8=_0x127bc8-0x0;var _0x1ecaa2=_0x57fa[_0x127bc8];return _0x1ecaa2;};'use strict';var util=require(_0xa57f('0x0'));var passport=require(_0xa57f('0x1'));var LocalStrategy=require(_0xa57f('0x2'))[_0xa57f('0x3')];var jayson=require(_0xa57f('0x4'));var _=require(_0xa57f('0x5'));var rs=require(_0xa57f('0x6'));var moment=require(_0xa57f('0x7'));var db=require(_0xa57f('0x8'))['db'];var authService=require(_0xa57f('0x9'));var utils=require(_0xa57f('0xa'));var client=jayson[_0xa57f('0xb')][_0xa57f('0xc')]({'port':0x232b});function localAuthenticate(_0xd783e1,_0x29ce3,_0x123d2e,_0x57839b){var _0xc8d6bb,_0x5ffa2a;return db[_0xa57f('0xd')][_0xa57f('0xe')]({'where':{'id':0x1},'attributes':[_0xa57f('0xf'),_0xa57f('0x10')],'raw':!![]})[_0xa57f('0x11')](function(_0x5e3dd5){_0xc8d6bb=_0x5e3dd5;return _0xd783e1[_0xa57f('0xe')]({'attributes':['id','name',_0xa57f('0x12'),'salt','role',_0xa57f('0x13'),_0xa57f('0x14'),_0xa57f('0x15'),_0xa57f('0x16')],'where':{'name':_0x29ce3,'role':{'$or':[_0xa57f('0x17'),_0xa57f('0x18'),'agent']}}});})[_0xa57f('0x11')](function(_0x78e227){if(!_0x78e227||_0x78e227&&_0x78e227[_0xa57f('0x19')]!==_0x29ce3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5ffa2a=_0x78e227;return _0x5ffa2a;}})[_0xa57f('0x11')](function(){_0x5ffa2a[_0xa57f('0x1a')](_0x123d2e,function(_0x774a35,_0x11eccb){var _0x49f201=_0x5ffa2a[_0xa57f('0x16')]+0x1;if(_0x774a35){return _0x57839b(_0x774a35);}else if(!_0x11eccb){if(_0x5ffa2a['disabled']){return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}else if(_0xc8d6bb[_0xa57f('0xf')]>0x0){if(_0x5ffa2a[_0xa57f('0x14')]){if(_0xc8d6bb['blockDuration']>0x0){if(moment(_0x5ffa2a[_0xa57f('0x15')])[_0xa57f('0x1c')](_0xc8d6bb[_0xa57f('0x10')],_0xa57f('0x1d'))>moment()){return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}else{return utils['clearBlockUser'](_0x5ffa2a,_0x49f201,![],null)[_0xa57f('0x11')](function(){return _0x57839b(null,![],{'message':_0xa57f('0x1b')});});}}else{return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}}else{if(_0x49f201>=_0xc8d6bb[_0xa57f('0xf')]){return utils[_0xa57f('0x1e')](_0x5ffa2a,0x0,!![],moment())[_0xa57f('0x11')](function(){return _0x57839b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa57f('0x1e')](_0x5ffa2a,_0x49f201,![],null)[_0xa57f('0x11')](function(){return _0x57839b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}}else{if(_0x5ffa2a['disabled']){return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}else if(_0xc8d6bb[_0xa57f('0xf')]>0x0){if(_0x5ffa2a[_0xa57f('0x14')]){if(_0xc8d6bb[_0xa57f('0x10')]>0x0){if(moment(_0x5ffa2a[_0xa57f('0x15')])['add'](_0xc8d6bb[_0xa57f('0x10')],_0xa57f('0x1d'))>moment()){return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}else{return utils[_0xa57f('0x1e')](_0x5ffa2a,0x0,![],null)[_0xa57f('0x11')](function(){return utils[_0xa57f('0x1f')](_0x5ffa2a);})[_0xa57f('0x11')](function(){return _0x57839b(null,_0x5ffa2a);});}}else{return _0x57839b(null,![],{'message':_0xa57f('0x1b')});}}else{return utils['clearBlockUser'](_0x5ffa2a,0x0,![],null)['then'](function(){return utils[_0xa57f('0x1f')](_0x5ffa2a);})['then'](function(){return _0x57839b(null,_0x5ffa2a);})[_0xa57f('0x20')](function(_0x28269c){return _0x57839b(null,![],_0x28269c);});}}else{if(_0x5ffa2a['blocked']){return _0x57839b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa57f('0x1f')](_0x5ffa2a)['then'](function(){return _0x57839b(null,_0x5ffa2a);});}}}});})[_0xa57f('0x20')](function(_0x3545c1){return _0x57839b(null,![],_0x3545c1);});}function sendServiceMail(_0x1a0d3f){return db[_0xa57f('0x21')][_0xa57f('0x22')]({'where':{'service':!![]},'attributes':['id',_0xa57f('0x19'),_0xa57f('0x23')],'include':[{'model':db[_0xa57f('0x24')],'as':_0xa57f('0x25'),'include':[{'model':db[_0xa57f('0x26')],'as':'CloudProvider'}]}]})[_0xa57f('0x11')](function(_0x1ea98e){if(!_0x1ea98e){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4bd4fa=_0x1ea98e[_0xa57f('0x27')]();var _0x3dbb1e={'account':_0x4bd4fa,'message':_['merge']({'from':util[_0xa57f('0x28')]('\x22%s\x22\x20<%s>',_0x1ea98e[_0xa57f('0x19')],_0x1ea98e[_0xa57f('0x23')]||_0x1ea98e['Smtp'][_0xa57f('0x18')])},_0x1a0d3f)};return client[_0xa57f('0x29')](_0xa57f('0x2a'),_0x3dbb1e);})[_0xa57f('0x11')](function(_0x5626cf){if(_0x5626cf[_0xa57f('0x2b')]){throw new Error(util[_0xa57f('0x28')](_0xa57f('0x2c'),_0x5626cf['error'][_0xa57f('0x2d')]||JSON['stringify'](_0x5626cf['error'])));}return!![];});}function handleError(_0x2ad817,_0x911ba7,_0x55ae52){return _0x2ad817[_0xa57f('0x2e')](_0x911ba7||0x1f4)[_0xa57f('0x2f')]({'message':_0x55ae52?_0x55ae52['message']||_0x55ae52:''});}exports[_0xa57f('0x30')]=function(_0x49ce7c,_0x4c8058,_0x169ff9){passport['authenticate'](_0xa57f('0x31'),function(_0x4fd2c6,_0x432a41,_0x2df74c){var _0x29ce10=_0x4fd2c6||_0x2df74c;if(_0x29ce10){return handleError(_0x4c8058,0x191,_0x29ce10);}if(!_0x432a41){return handleError(_0x4c8058,0x194,{'message':_0xa57f('0x32')});}else{var _0x5018dd={'payload':{'id':_0x432a41['id'],'role':_0x432a41[_0xa57f('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0xa57f('0x34')](_0x5018dd)[_0xa57f('0x11')](function(_0x2cea05){_0x4c8058[_0xa57f('0x35')]({'id':_0x432a41['id'],'token':_0x2cea05,'statusCall':'','isAlreadyLogged':_0x432a41[_0xa57f('0x36')]});});}})(_0x49ce7c,_0x4c8058,_0x169ff9);};exports['forgot']=function(_0x2e9741,_0x2088f4){if(!_0x2e9741[_0xa57f('0x37')]['email']){return handleError(_0x2088f4,0x1f4,{'message':_0xa57f('0x38')});}var _0x3a0f66=rs['generate']();_0x2e9741[_0xa57f('0x37')]['email']=_0x2e9741['body'][_0xa57f('0x23')]['trim']()[_0xa57f('0x39')]();var _0x395d95;return db[_0xa57f('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0xa57f('0xf'),_0xa57f('0x10')],'raw':!![]})[_0xa57f('0x11')](function(_0xe8ed0d){_0x395d95=_0xe8ed0d;return db['User'][_0xa57f('0x22')]({'where':{'email':_0x2e9741[_0xa57f('0x37')][_0xa57f('0x23')]}});})[_0xa57f('0x11')](function(_0x12e692){if(!_0x12e692){throw new Error(_0xa57f('0x3a'));}if(_0x12e692['disabled']){throw new Error(_0xa57f('0x3b'));}if(_0x12e692['blocked']){if(moment(_0x12e692[_0xa57f('0x15')])[_0xa57f('0x1c')](_0x395d95[_0xa57f('0x10')],'minutes')>moment()){throw new Error(_0xa57f('0x3c'));}else{_0x12e692[_0xa57f('0x14')]=![];_0x12e692[_0xa57f('0x15')]=null;}}_0x12e692['resetPasswordToken']=_0x3a0f66;_0x12e692[_0xa57f('0x3d')]=Date[_0xa57f('0x3e')]()+0x36ee80;return _0x12e692[_0xa57f('0x3f')]();})[_0xa57f('0x11')](function(){return sendServiceMail({'to':_0x2e9741[_0xa57f('0x37')][_0xa57f('0x23')],'subject':_0xa57f('0x40'),'text':_0xa57f('0x41')+_0xa57f('0x42')+'https://'+_0x2e9741['headers']['host']+_0xa57f('0x43')+_0x3a0f66+'\x0a\x0a'+_0xa57f('0x44')});})[_0xa57f('0x11')](function(){_0x2088f4[_0xa57f('0x2e')](0xc8)[_0xa57f('0x2f')]({'message':_0xa57f('0x45')});})[_0xa57f('0x20')](function(_0x4301fc){return handleError(_0x2088f4,0x1f4,_0x4301fc);});};exports[_0xa57f('0x46')]=function(_0x2dbcd7,_0x47da03){return db['User'][_0xa57f('0x22')]({'where':{'resetPasswordToken':_0x2dbcd7[_0xa57f('0x47')][_0xa57f('0x48')],'resetPasswordExpires':{'$gt':Date[_0xa57f('0x3e')]()}}})[_0xa57f('0x11')](function(_0x45e0df){if(!_0x45e0df){throw new Error(_0xa57f('0x49'));}return db[_0xa57f('0xd')]['findOne']({'attributes':['id',_0xa57f('0x4a'),'enforcePasswordHistory',_0xa57f('0x4b')]})[_0xa57f('0x11')](function(_0x46c8f6){if(_0x46c8f6[_0xa57f('0x4a')])authService['validatePasswordPattern'](_0x2dbcd7['body'][_0xa57f('0x12')]);if(!_0x46c8f6['enforcePasswordHistory']||!_0x45e0df[_0xa57f('0x4c')])return _0x45e0df;authService['validatePasswordHistory'](_0x2dbcd7[_0xa57f('0x37')][_0xa57f('0x12')],_0x45e0df[_0xa57f('0x4c')],_0x46c8f6[_0xa57f('0x4b')]);return _0x45e0df;})['then'](function(){_0x45e0df[_0xa57f('0x12')]=_0x2dbcd7[_0xa57f('0x37')][_0xa57f('0x12')];_0x45e0df[_0xa57f('0x4d')]=null;_0x45e0df[_0xa57f('0x3d')]=null;return _0x45e0df['save']();});})[_0xa57f('0x11')](function(){_0x47da03[_0xa57f('0x2e')](0xc8)['send']({'message':_0xa57f('0x4e')});})[_0xa57f('0x20')](function(_0x279cee){return handleError(_0x47da03,0x1f4,_0x279cee);});};passport['use'](_0xa57f('0x31'),new LocalStrategy({'usernameField':_0xa57f('0x19'),'passwordField':_0xa57f('0x12')},function(_0x19ea0d,_0x25b5c8,_0x1d728b){return localAuthenticate(db['User'],_0x19ea0d,_0x25b5c8,_0x1d728b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 65111be..533b5db 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 _0x840c=['express','Router','./authLocal.controller','login','/forgot','forgot','/reset/:token','reset'];(function(_0x54295c,_0xb3d2f7){var _0x515533=function(_0x550118){while(--_0x550118){_0x54295c['push'](_0x54295c['shift']());}};_0x515533(++_0xb3d2f7);}(_0x840c,0x70));var _0xc840=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x840c[_0x220dbb];return _0x2b77de;};'use strict';var express=require(_0xc840('0x0'));var router=express[_0xc840('0x1')]();var controller=require(_0xc840('0x2'));router['post']('/',controller[_0xc840('0x3')]);router['post'](_0xc840('0x4'),controller[_0xc840('0x5')]);router['post'](_0xc840('0x6'),controller[_0xc840('0x7')]);module['exports']=router; \ No newline at end of file +var _0x5788=['login','/forgot','/reset/:token','reset','exports','express','Router','post'];(function(_0xdb5808,_0x58c067){var _0x111072=function(_0x3c3f27){while(--_0x3c3f27){_0xdb5808['push'](_0xdb5808['shift']());}};_0x111072(++_0x58c067);}(_0x5788,0x14d));var _0x8578=function(_0x41b376,_0x295e7b){_0x41b376=_0x41b376-0x0;var _0x1a01b3=_0x5788[_0x41b376];return _0x1a01b3;};'use strict';var express=require(_0x8578('0x0'));var router=express[_0x8578('0x1')]();var controller=require('./authLocal.controller');router[_0x8578('0x2')]('/',controller[_0x8578('0x3')]);router[_0x8578('0x2')](_0x8578('0x4'),controller['forgot']);router['post'](_0x8578('0x5'),controller[_0x8578('0x6')]);module[_0x8578('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e78f64f..ce9418a 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 _0x824b=['exports','STRING','INTEGER','sequelize'];(function(_0x261357,_0x1e92d1){var _0x20e25d=function(_0x4c48ba){while(--_0x4c48ba){_0x261357['push'](_0x261357['shift']());}};_0x20e25d(++_0x1e92d1);}(_0x824b,0xa7));var _0xb824=function(_0x10fd8f,_0x1dda79){_0x10fd8f=_0x10fd8f-0x0;var _0xaff74a=_0x824b[_0x10fd8f];return _0xaff74a;};'use strict';var Sequelize=require(_0xb824('0x0'));module[_0xb824('0x1')]={'name':{'type':Sequelize[_0xb824('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb824('0x2')]},'description':{'type':Sequelize[_0xb824('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb824('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9662=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x9662,0x77));var _0x2966=function(_0x3395c3,_0x2125a4){_0x3395c3=_0x3395c3-0x0;var _0x2328cc=_0x9662[_0x3395c3];return _0x2328cc;};'use strict';var Sequelize=require(_0x2966('0x0'));module[_0x2966('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x2966('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2966('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 774a638..84bd174 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 _0xa5ea=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','Automation','findAll','catch','show','include','options','find','create','body','params','Condition','addConditions','ids','getConditions','nolimit','addActions','Action','omit','getActions','findOne','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xa5ea,0x186));var _0xaa5e=function(_0x1e63d1,_0x544ce6){_0x1e63d1=_0x1e63d1-0x0;var _0x12d5a8=_0xa5ea[_0x1e63d1];return _0x12d5a8;};'use strict';var emlformat=require(_0xaa5e('0x0'));var rimraf=require(_0xaa5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa5e('0x2'));var BPromise=require(_0xaa5e('0x3'));var Mustache=require(_0xaa5e('0x4'));var util=require('util');var path=require(_0xaa5e('0x5'));var sox=require('sox');var csv=require(_0xaa5e('0x6'));var ejs=require(_0xaa5e('0x7'));var fs=require('fs');var fs_extra=require(_0xaa5e('0x8'));var _=require(_0xaa5e('0x9'));var squel=require('squel');var crypto=require(_0xaa5e('0xa'));var jsforce=require(_0xaa5e('0xb'));var deskjs=require(_0xaa5e('0xc'));var toCsv=require(_0xaa5e('0x6'));var querystring=require(_0xaa5e('0xd'));var Papa=require('papaparse');var Redis=require(_0xaa5e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaa5e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa5e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xaa5e('0x11'));var config=require(_0xaa5e('0x12'));var licenseUtil=require(_0xaa5e('0x13'));var db=require(_0xaa5e('0x14'))['db'];function respondWithStatusCode(_0x24b1fd,_0x4a4057){_0x4a4057=_0x4a4057||0xcc;return function(_0x1a5ed9){if(_0x1a5ed9){return _0x24b1fd['sendStatus'](_0x4a4057);}return _0x24b1fd['status'](_0x4a4057)[_0xaa5e('0x15')]();};}function respondWithResult(_0x4ecc79,_0x27cf09){_0x27cf09=_0x27cf09||0xc8;return function(_0x21d2c3){if(_0x21d2c3){return _0x4ecc79[_0xaa5e('0x16')](_0x27cf09)[_0xaa5e('0x17')](_0x21d2c3);}};}function respondWithFilteredResult(_0xb272a,_0x3f4e16){return function(_0x5171c6){if(_0x5171c6){var _0x397873=typeof _0x3f4e16[_0xaa5e('0x18')]===_0xaa5e('0x19')&&typeof _0x3f4e16[_0xaa5e('0x1a')]===_0xaa5e('0x19');var _0x3df07c=_0x5171c6[_0xaa5e('0x1b')];var _0x12f455=_0x397873?0x0:_0x3f4e16[_0xaa5e('0x18')];var _0x51ec98=_0x397873?_0x5171c6[_0xaa5e('0x1b')]:_0x3f4e16[_0xaa5e('0x18')]+_0x3f4e16[_0xaa5e('0x1a')];var _0x21490d;if(_0x51ec98>=_0x3df07c){_0x51ec98=_0x3df07c;_0x21490d=0xc8;}else{_0x21490d=0xce;}_0xb272a[_0xaa5e('0x16')](_0x21490d);return _0xb272a[_0xaa5e('0x1c')](_0xaa5e('0x1d'),_0x12f455+'-'+_0x51ec98+'/'+_0x3df07c)[_0xaa5e('0x17')](_0x5171c6);}return null;};}function patchUpdates(_0x1a0853){return function(_0x496844){try{jsonpatch['apply'](_0x496844,_0x1a0853,!![]);}catch(_0x46eb83){return BPromise[_0xaa5e('0x1e')](_0x46eb83);}return _0x496844[_0xaa5e('0x1f')]();};}function saveUpdates(_0x3a78e7,_0x2908a2){return function(_0x323963){if(_0x323963){return _0x323963[_0xaa5e('0x20')](_0x3a78e7)[_0xaa5e('0x21')](function(_0x3030c7){return _0x3030c7;});}return null;};}function removeEntity(_0xf696ae,_0x58aded){return function(_0x2757df){if(_0x2757df){return _0x2757df[_0xaa5e('0x22')]()[_0xaa5e('0x21')](function(){_0xf696ae[_0xaa5e('0x16')](0xcc)[_0xaa5e('0x15')]();});}};}function handleEntityNotFound(_0x4af6ea,_0xd10360){return function(_0x250b73){if(!_0x250b73){_0x4af6ea[_0xaa5e('0x23')](0x194);}return _0x250b73;};}function handleError(_0x3212f2,_0x340d78){_0x340d78=_0x340d78||0x1f4;return function(_0x3ef033){logger[_0xaa5e('0x24')](_0x3ef033['stack']);if(_0x3ef033['name']){delete _0x3ef033[_0xaa5e('0x25')];}_0x3212f2[_0xaa5e('0x16')](_0x340d78)[_0xaa5e('0x26')](_0x3ef033);};}exports[_0xaa5e('0x27')]=function(_0x588d56,_0x462c26){var _0x1cd772={},_0x44888d={},_0x2dfc8b={'count':0x0,'rows':[]};var _0x39f3c9=_[_0xaa5e('0x28')](db['Automation'][_0xaa5e('0x29')],function(_0x2ff81c){return{'name':_0x2ff81c[_0xaa5e('0x2a')],'type':_0x2ff81c[_0xaa5e('0x2b')][_0xaa5e('0x2c')]};});_0x44888d[_0xaa5e('0x2d')]=_[_0xaa5e('0x28')](_0x39f3c9,_0xaa5e('0x25'));_0x44888d[_0xaa5e('0x2e')]=_[_0xaa5e('0x2f')](_0x588d56[_0xaa5e('0x2e')]);_0x44888d[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x44888d[_0xaa5e('0x2d')],_0x44888d['query']);_0x1cd772[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0x44888d['model'],qs[_0xaa5e('0x33')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x1cd772[_0xaa5e('0x32')]=_0x1cd772[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0x1cd772[_0xaa5e('0x32')]:_0x44888d[_0xaa5e('0x2d')];if(!_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x35')]('nolimit')){_0x1cd772['limit']=qs['limit'](_0x588d56['query']['limit']);_0x1cd772['offset']=qs[_0xaa5e('0x18')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}_0x1cd772[_0xaa5e('0x36')]=qs[_0xaa5e('0x37')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x37')]);_0x1cd772['where']=qs['filters'](_[_0xaa5e('0x38')](_0x588d56[_0xaa5e('0x2e')],_0x44888d[_0xaa5e('0x30')]),_0x39f3c9);if(_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x39')]){_0x1cd772[_0xaa5e('0x3a')]=_[_0xaa5e('0x3b')](_0x1cd772[_0xaa5e('0x3a')],{'$or':_[_0xaa5e('0x28')](_0x39f3c9,function(_0x223f2c){if(_0x223f2c[_0xaa5e('0x2b')]!==_0xaa5e('0x3c')){var _0x1bc253={};_0x1bc253[_0x223f2c[_0xaa5e('0x25')]]={'$like':'%'+_0x588d56['query'][_0xaa5e('0x39')]+'%'};return _0x1bc253;}})});}_0x1cd772=_[_0xaa5e('0x3b')]({},_0x1cd772,_0x588d56['options']);var _0xde949d={'where':_0x1cd772[_0xaa5e('0x3a')]};return db['Automation'][_0xaa5e('0x1b')](_0xde949d)[_0xaa5e('0x21')](function(_0x5b58bb){_0x2dfc8b['count']=_0x5b58bb;if(_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x3d')]){_0x1cd772['include']=[{'all':!![]}];}return db[_0xaa5e('0x3e')][_0xaa5e('0x3f')](_0x1cd772);})['then'](function(_0x18fdac){_0x2dfc8b['rows']=_0x18fdac;return _0x2dfc8b;})[_0xaa5e('0x21')](respondWithFilteredResult(_0x462c26,_0x1cd772))[_0xaa5e('0x40')](handleError(_0x462c26,null));};exports[_0xaa5e('0x41')]=function(_0x59c162,_0x182fdc){var _0x2be7fd={'raw':![],'where':{'id':_0x59c162['params']['id']}},_0xec50e5={};_0xec50e5[_0xaa5e('0x2d')]=_[_0xaa5e('0x2f')](db[_0xaa5e('0x3e')][_0xaa5e('0x29')]);_0xec50e5[_0xaa5e('0x2e')]=_[_0xaa5e('0x2f')](_0x59c162[_0xaa5e('0x2e')]);_0xec50e5[_0xaa5e('0x30')]=_['intersection'](_0xec50e5[_0xaa5e('0x2d')],_0xec50e5['query']);_0x2be7fd[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0xec50e5[_0xaa5e('0x2d')],qs[_0xaa5e('0x33')](_0x59c162[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x2be7fd[_0xaa5e('0x32')]=_0x2be7fd[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0x2be7fd[_0xaa5e('0x32')]:_0xec50e5['model'];if(_0x59c162[_0xaa5e('0x2e')][_0xaa5e('0x3d')]){_0x2be7fd[_0xaa5e('0x42')]=[{'all':!![]}];}_0x2be7fd=_['merge']({},_0x2be7fd,_0x59c162[_0xaa5e('0x43')]);return db[_0xaa5e('0x3e')][_0xaa5e('0x44')](_0x2be7fd)[_0xaa5e('0x21')](handleEntityNotFound(_0x182fdc,null))[_0xaa5e('0x21')](respondWithResult(_0x182fdc,null))[_0xaa5e('0x40')](handleError(_0x182fdc,null));};exports[_0xaa5e('0x45')]=function(_0x3f6770,_0x457110){return db['Automation']['create'](_0x3f6770['body'],{})[_0xaa5e('0x21')](respondWithResult(_0x457110,0xc9))[_0xaa5e('0x40')](handleError(_0x457110,null));};exports['update']=function(_0x54cf13,_0x21ed5a){if(_0x54cf13[_0xaa5e('0x46')]['id']){delete _0x54cf13[_0xaa5e('0x46')]['id'];}return db[_0xaa5e('0x3e')][_0xaa5e('0x44')]({'where':{'id':_0x54cf13[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x21ed5a,null))[_0xaa5e('0x21')](saveUpdates(_0x54cf13[_0xaa5e('0x46')],null))[_0xaa5e('0x21')](respondWithResult(_0x21ed5a,null))['catch'](handleError(_0x21ed5a,null));};exports['destroy']=function(_0x2167c0,_0x27c1ea){return db[_0xaa5e('0x3e')][_0xaa5e('0x44')]({'where':{'id':_0x2167c0['params']['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x27c1ea,null))['then'](removeEntity(_0x27c1ea,null))['catch'](handleError(_0x27c1ea,null));};exports['addConditions']=function(_0x5c8375,_0x596d56,_0x5e1d33){return db[_0xaa5e('0x48')][_0xaa5e('0x44')]({'where':{'id':_0x5c8375[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x596d56,null))[_0xaa5e('0x21')](function(_0x615eb7){if(_0x615eb7){return _0x615eb7[_0xaa5e('0x49')](_0x5c8375[_0xaa5e('0x46')][_0xaa5e('0x4a')],_['omit'](_0x5c8375[_0xaa5e('0x46')],[_0xaa5e('0x4a'),'id'])||{});}})[_0xaa5e('0x21')](respondWithResult(_0x596d56,null))[_0xaa5e('0x40')](handleError(_0x596d56,null));};exports[_0xaa5e('0x4b')]=function(_0x2130e8,_0x2f372f,_0x43b1d9){var _0x527c08={};var _0x4f2809={};var _0x152851;var _0x4d61c4;return db[_0xaa5e('0x3e')]['findOne']({'where':{'id':_0x2130e8['params']['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x2f372f,null))[_0xaa5e('0x21')](function(_0x35c93a){if(_0x35c93a){_0x152851=_0x35c93a;_0x4f2809['model']=_[_0xaa5e('0x2f')](db[_0xaa5e('0x48')]['rawAttributes']);_0x4f2809[_0xaa5e('0x2e')]=_['keys'](_0x2130e8[_0xaa5e('0x2e')]);_0x4f2809[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x4f2809['model'],_0x4f2809[_0xaa5e('0x2e')]);_0x527c08[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0x4f2809[_0xaa5e('0x2d')],qs['fields'](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x527c08[_0xaa5e('0x32')]=_0x527c08['attributes'][_0xaa5e('0x34')]?_0x527c08[_0xaa5e('0x32')]:_0x4f2809['model'];_0x527c08['order']=qs[_0xaa5e('0x37')](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x37')]);_0x527c08[_0xaa5e('0x3a')]=qs[_0xaa5e('0x30')](_[_0xaa5e('0x38')](_0x2130e8['query'],_0x4f2809[_0xaa5e('0x30')]));if(_0x2130e8[_0xaa5e('0x2e')]['filter']){_0x527c08['where']=_[_0xaa5e('0x3b')](_0x527c08['where'],{'$or':_[_0xaa5e('0x28')](_0x527c08[_0xaa5e('0x32')],function(_0x1bd929){var _0x3ec969={};_0x3ec969[_0x1bd929]={'$like':'%'+_0x2130e8['query'][_0xaa5e('0x39')]+'%'};return _0x3ec969;})});}_0x527c08=_[_0xaa5e('0x3b')]({},_0x527c08,_0x2130e8['options']);return _0x152851[_0xaa5e('0x4b')](_0x527c08);}})[_0xaa5e('0x21')](function(_0x46ed0d){if(_0x46ed0d){_0x4d61c4=_0x46ed0d[_0xaa5e('0x34')];if(!_0x2130e8['query'][_0xaa5e('0x35')](_0xaa5e('0x4c'))){_0x527c08['limit']=qs[_0xaa5e('0x1a')](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x1a')]);_0x527c08[_0xaa5e('0x18')]=qs['offset'](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}return _0x152851['getConditions'](_0x527c08);}})['then'](function(_0x576251){if(_0x576251){return _0x576251?{'count':_0x4d61c4,'rows':_0x576251}:null;}})[_0xaa5e('0x21')](respondWithResult(_0x2f372f,null))[_0xaa5e('0x40')](handleError(_0x2f372f,null));};exports[_0xaa5e('0x4d')]=function(_0x587587,_0x40908a,_0x55289c){return db[_0xaa5e('0x4e')][_0xaa5e('0x44')]({'where':{'id':_0x587587[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x40908a,null))[_0xaa5e('0x21')](function(_0x4cb275){if(_0x4cb275){return _0x4cb275[_0xaa5e('0x4d')](_0x587587['body'][_0xaa5e('0x4a')],_[_0xaa5e('0x4f')](_0x587587[_0xaa5e('0x46')],[_0xaa5e('0x4a'),'id'])||{});}})[_0xaa5e('0x21')](respondWithResult(_0x40908a,null))[_0xaa5e('0x40')](handleError(_0x40908a,null));};exports[_0xaa5e('0x50')]=function(_0x51e283,_0x599aad,_0x1bb708){var _0xd73dc4={};var _0x52f5ee={};var _0x493366;var _0x1f6bda;return db[_0xaa5e('0x3e')][_0xaa5e('0x51')]({'where':{'id':_0x51e283[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x599aad,null))['then'](function(_0x5fc8ab){if(_0x5fc8ab){_0x493366=_0x5fc8ab;_0x52f5ee[_0xaa5e('0x2d')]=_['keys'](db['Action']['rawAttributes']);_0x52f5ee[_0xaa5e('0x2e')]=_['keys'](_0x51e283[_0xaa5e('0x2e')]);_0x52f5ee['filters']=_[_0xaa5e('0x31')](_0x52f5ee[_0xaa5e('0x2d')],_0x52f5ee[_0xaa5e('0x2e')]);_0xd73dc4[_0xaa5e('0x32')]=_['intersection'](_0x52f5ee['model'],qs[_0xaa5e('0x33')](_0x51e283[_0xaa5e('0x2e')]['fields']));_0xd73dc4[_0xaa5e('0x32')]=_0xd73dc4[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0xd73dc4['attributes']:_0x52f5ee[_0xaa5e('0x2d')];_0xd73dc4['order']=qs[_0xaa5e('0x37')](_0x51e283[_0xaa5e('0x2e')]['sort']);_0xd73dc4['where']=qs[_0xaa5e('0x30')](_[_0xaa5e('0x38')](_0x51e283[_0xaa5e('0x2e')],_0x52f5ee[_0xaa5e('0x30')]));if(_0x51e283[_0xaa5e('0x2e')]['filter']){_0xd73dc4['where']=_[_0xaa5e('0x3b')](_0xd73dc4[_0xaa5e('0x3a')],{'$or':_[_0xaa5e('0x28')](_0xd73dc4[_0xaa5e('0x32')],function(_0x291d80){var _0x4b9912={};_0x4b9912[_0x291d80]={'$like':'%'+_0x51e283['query'][_0xaa5e('0x39')]+'%'};return _0x4b9912;})});}_0xd73dc4=_['merge']({},_0xd73dc4,_0x51e283['options']);return _0x493366['getActions'](_0xd73dc4);}})[_0xaa5e('0x21')](function(_0x34bb3f){if(_0x34bb3f){_0x1f6bda=_0x34bb3f[_0xaa5e('0x34')];if(!_0x51e283['query'][_0xaa5e('0x35')](_0xaa5e('0x4c'))){_0xd73dc4[_0xaa5e('0x1a')]=qs['limit'](_0x51e283['query'][_0xaa5e('0x1a')]);_0xd73dc4[_0xaa5e('0x18')]=qs[_0xaa5e('0x18')](_0x51e283[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}return _0x493366[_0xaa5e('0x50')](_0xd73dc4);}})[_0xaa5e('0x21')](function(_0x272c2c){if(_0x272c2c){return _0x272c2c?{'count':_0x1f6bda,'rows':_0x272c2c}:null;}})['then'](respondWithResult(_0x599aad,null))[_0xaa5e('0x40')](handleError(_0x599aad,null));}; \ No newline at end of file +var _0x7548=['limit','count','offset','set','apply','reject','save','then','error','name','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','create','body','update','find','addConditions','ids','getConditions','findOne','Condition','hasOwnProperty','nolimit','Action','addActions','omit','getActions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','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','end','json','undefined'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x7548,0x136));var _0x8754=function(_0x4e1993,_0x89ccae){_0x4e1993=_0x4e1993-0x0;var _0x27f61f=_0x7548[_0x4e1993];return _0x27f61f;};'use strict';var emlformat=require(_0x8754('0x0'));var rimraf=require(_0x8754('0x1'));var zipdir=require(_0x8754('0x2'));var jsonpatch=require(_0x8754('0x3'));var rp=require(_0x8754('0x4'));var moment=require('moment');var BPromise=require(_0x8754('0x5'));var Mustache=require(_0x8754('0x6'));var util=require(_0x8754('0x7'));var path=require(_0x8754('0x8'));var sox=require('sox');var csv=require(_0x8754('0x9'));var ejs=require(_0x8754('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8754('0xb'));var squel=require('squel');var crypto=require(_0x8754('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8754('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8754('0xe'));var Papa=require(_0x8754('0xf'));var Redis=require(_0x8754('0x10'));var authService=require(_0x8754('0x11'));var qs=require(_0x8754('0x12'));var as=require(_0x8754('0x13'));var hardwareService=require(_0x8754('0x14'));var logger=require(_0x8754('0x15'))('api');var utils=require(_0x8754('0x16'));var config=require(_0x8754('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8754('0x18'))['db'];function respondWithStatusCode(_0x9847ae,_0x2564a8){_0x2564a8=_0x2564a8||0xcc;return function(_0xe4e84f){if(_0xe4e84f){return _0x9847ae[_0x8754('0x19')](_0x2564a8);}return _0x9847ae[_0x8754('0x1a')](_0x2564a8)[_0x8754('0x1b')]();};}function respondWithResult(_0x5ad35e,_0x316f19){_0x316f19=_0x316f19||0xc8;return function(_0x3f9457){if(_0x3f9457){return _0x5ad35e[_0x8754('0x1a')](_0x316f19)[_0x8754('0x1c')](_0x3f9457);}};}function respondWithFilteredResult(_0x1b4280,_0x15dd5f){return function(_0x229652){if(_0x229652){var _0x3ea153=typeof _0x15dd5f['offset']===_0x8754('0x1d')&&typeof _0x15dd5f[_0x8754('0x1e')]===_0x8754('0x1d');var _0x293ff9=_0x229652[_0x8754('0x1f')];var _0x4897c5=_0x3ea153?0x0:_0x15dd5f['offset'];var _0x599b02=_0x3ea153?_0x229652['count']:_0x15dd5f[_0x8754('0x20')]+_0x15dd5f[_0x8754('0x1e')];var _0x185cd1;if(_0x599b02>=_0x293ff9){_0x599b02=_0x293ff9;_0x185cd1=0xc8;}else{_0x185cd1=0xce;}_0x1b4280[_0x8754('0x1a')](_0x185cd1);return _0x1b4280[_0x8754('0x21')]('Content-Range',_0x4897c5+'-'+_0x599b02+'/'+_0x293ff9)[_0x8754('0x1c')](_0x229652);}return null;};}function patchUpdates(_0x47f719){return function(_0x3a6ef4){try{jsonpatch[_0x8754('0x22')](_0x3a6ef4,_0x47f719,!![]);}catch(_0x4ed401){return BPromise[_0x8754('0x23')](_0x4ed401);}return _0x3a6ef4[_0x8754('0x24')]();};}function saveUpdates(_0x2ff996,_0x59fbd8){return function(_0x148fad){if(_0x148fad){return _0x148fad['update'](_0x2ff996)[_0x8754('0x25')](function(_0x5543a7){return _0x5543a7;});}return null;};}function removeEntity(_0x58f065,_0x272b7f){return function(_0x4db513){if(_0x4db513){return _0x4db513['destroy']()[_0x8754('0x25')](function(){_0x58f065[_0x8754('0x1a')](0xcc)[_0x8754('0x1b')]();});}};}function handleEntityNotFound(_0x533425,_0x20c1c9){return function(_0x11fd20){if(!_0x11fd20){_0x533425[_0x8754('0x19')](0x194);}return _0x11fd20;};}function handleError(_0x23e780,_0x5d77b2){_0x5d77b2=_0x5d77b2||0x1f4;return function(_0x984fd1){logger[_0x8754('0x26')](_0x984fd1['stack']);if(_0x984fd1[_0x8754('0x27')]){delete _0x984fd1['name'];}_0x23e780[_0x8754('0x1a')](_0x5d77b2)['send'](_0x984fd1);};}exports[_0x8754('0x28')]=function(_0x11290e,_0x57e625){var _0x5b1184={},_0x4376bb={},_0x495716={'count':0x0,'rows':[]};var _0x5a5f84=_[_0x8754('0x29')](db[_0x8754('0x2a')]['rawAttributes'],function(_0x47a2a0){return{'name':_0x47a2a0[_0x8754('0x2b')],'type':_0x47a2a0[_0x8754('0x2c')][_0x8754('0x2d')]};});_0x4376bb[_0x8754('0x2e')]=_[_0x8754('0x29')](_0x5a5f84,_0x8754('0x27'));_0x4376bb[_0x8754('0x2f')]=_[_0x8754('0x30')](_0x11290e[_0x8754('0x2f')]);_0x4376bb[_0x8754('0x31')]=_[_0x8754('0x32')](_0x4376bb[_0x8754('0x2e')],_0x4376bb['query']);_0x5b1184['attributes']=_[_0x8754('0x32')](_0x4376bb[_0x8754('0x2e')],qs['fields'](_0x11290e[_0x8754('0x2f')][_0x8754('0x33')]));_0x5b1184[_0x8754('0x34')]=_0x5b1184[_0x8754('0x34')]['length']?_0x5b1184[_0x8754('0x34')]:_0x4376bb[_0x8754('0x2e')];if(!_0x11290e[_0x8754('0x2f')]['hasOwnProperty']('nolimit')){_0x5b1184[_0x8754('0x1e')]=qs[_0x8754('0x1e')](_0x11290e['query']['limit']);_0x5b1184[_0x8754('0x20')]=qs[_0x8754('0x20')](_0x11290e['query']['offset']);}_0x5b1184['order']=qs['sort'](_0x11290e['query'][_0x8754('0x35')]);_0x5b1184['where']=qs[_0x8754('0x31')](_[_0x8754('0x36')](_0x11290e[_0x8754('0x2f')],_0x4376bb['filters']),_0x5a5f84);if(_0x11290e[_0x8754('0x2f')][_0x8754('0x37')]){_0x5b1184['where']=_[_0x8754('0x38')](_0x5b1184[_0x8754('0x39')],{'$or':_[_0x8754('0x29')](_0x5a5f84,function(_0x566240){if(_0x566240[_0x8754('0x2c')]!==_0x8754('0x3a')){var _0x518851={};_0x518851[_0x566240[_0x8754('0x27')]]={'$like':'%'+_0x11290e[_0x8754('0x2f')][_0x8754('0x37')]+'%'};return _0x518851;}})});}_0x5b1184=_[_0x8754('0x38')]({},_0x5b1184,_0x11290e[_0x8754('0x3b')]);var _0x36288e={'where':_0x5b1184['where']};return db[_0x8754('0x2a')][_0x8754('0x1f')](_0x36288e)[_0x8754('0x25')](function(_0x2f00ac){_0x495716['count']=_0x2f00ac;if(_0x11290e[_0x8754('0x2f')]['includeAll']){_0x5b1184['include']=[{'all':!![]}];}return db[_0x8754('0x2a')][_0x8754('0x3c')](_0x5b1184);})[_0x8754('0x25')](function(_0x972d6a){_0x495716[_0x8754('0x3d')]=_0x972d6a;return _0x495716;})['then'](respondWithFilteredResult(_0x57e625,_0x5b1184))[_0x8754('0x3e')](handleError(_0x57e625,null));};exports[_0x8754('0x3f')]=function(_0x566890,_0x56779b){var _0x4a6258={'raw':![],'where':{'id':_0x566890[_0x8754('0x40')]['id']}},_0x436859={};_0x436859['model']=_['keys'](db['Automation'][_0x8754('0x41')]);_0x436859[_0x8754('0x2f')]=_['keys'](_0x566890[_0x8754('0x2f')]);_0x436859['filters']=_['intersection'](_0x436859[_0x8754('0x2e')],_0x436859[_0x8754('0x2f')]);_0x4a6258[_0x8754('0x34')]=_[_0x8754('0x32')](_0x436859['model'],qs[_0x8754('0x33')](_0x566890[_0x8754('0x2f')][_0x8754('0x33')]));_0x4a6258['attributes']=_0x4a6258['attributes'][_0x8754('0x42')]?_0x4a6258[_0x8754('0x34')]:_0x436859[_0x8754('0x2e')];if(_0x566890['query'][_0x8754('0x43')]){_0x4a6258[_0x8754('0x44')]=[{'all':!![]}];}_0x4a6258=_[_0x8754('0x38')]({},_0x4a6258,_0x566890['options']);return db[_0x8754('0x2a')]['find'](_0x4a6258)[_0x8754('0x25')](handleEntityNotFound(_0x56779b,null))[_0x8754('0x25')](respondWithResult(_0x56779b,null))[_0x8754('0x3e')](handleError(_0x56779b,null));};exports[_0x8754('0x45')]=function(_0x4491b2,_0x3dfd4a){return db['Automation'][_0x8754('0x45')](_0x4491b2[_0x8754('0x46')],{})[_0x8754('0x25')](respondWithResult(_0x3dfd4a,0xc9))[_0x8754('0x3e')](handleError(_0x3dfd4a,null));};exports[_0x8754('0x47')]=function(_0x2bd108,_0x39496e){if(_0x2bd108['body']['id']){delete _0x2bd108[_0x8754('0x46')]['id'];}return db['Automation'][_0x8754('0x48')]({'where':{'id':_0x2bd108[_0x8754('0x40')]['id']}})[_0x8754('0x25')](handleEntityNotFound(_0x39496e,null))['then'](saveUpdates(_0x2bd108[_0x8754('0x46')],null))['then'](respondWithResult(_0x39496e,null))['catch'](handleError(_0x39496e,null));};exports['destroy']=function(_0x4b19c6,_0x2bfcf9){return db[_0x8754('0x2a')]['find']({'where':{'id':_0x4b19c6['params']['id']}})[_0x8754('0x25')](handleEntityNotFound(_0x2bfcf9,null))[_0x8754('0x25')](removeEntity(_0x2bfcf9,null))[_0x8754('0x3e')](handleError(_0x2bfcf9,null));};exports[_0x8754('0x49')]=function(_0x4691f8,_0x4abef3,_0x230352){return db['Condition'][_0x8754('0x48')]({'where':{'id':_0x4691f8[_0x8754('0x40')]['id']}})['then'](handleEntityNotFound(_0x4abef3,null))[_0x8754('0x25')](function(_0x497721){if(_0x497721){return _0x497721[_0x8754('0x49')](_0x4691f8[_0x8754('0x46')]['ids'],_['omit'](_0x4691f8[_0x8754('0x46')],[_0x8754('0x4a'),'id'])||{});}})[_0x8754('0x25')](respondWithResult(_0x4abef3,null))[_0x8754('0x3e')](handleError(_0x4abef3,null));};exports[_0x8754('0x4b')]=function(_0x4a38c3,_0x5684cb,_0x247db0){var _0x5ec383={};var _0x16c704={};var _0x2f2b78;var _0xbfd49d;return db[_0x8754('0x2a')][_0x8754('0x4c')]({'where':{'id':_0x4a38c3['params']['id']}})[_0x8754('0x25')](handleEntityNotFound(_0x5684cb,null))[_0x8754('0x25')](function(_0xbd98ab){if(_0xbd98ab){_0x2f2b78=_0xbd98ab;_0x16c704[_0x8754('0x2e')]=_[_0x8754('0x30')](db[_0x8754('0x4d')]['rawAttributes']);_0x16c704[_0x8754('0x2f')]=_[_0x8754('0x30')](_0x4a38c3[_0x8754('0x2f')]);_0x16c704[_0x8754('0x31')]=_[_0x8754('0x32')](_0x16c704[_0x8754('0x2e')],_0x16c704['query']);_0x5ec383['attributes']=_['intersection'](_0x16c704[_0x8754('0x2e')],qs['fields'](_0x4a38c3['query']['fields']));_0x5ec383[_0x8754('0x34')]=_0x5ec383[_0x8754('0x34')][_0x8754('0x42')]?_0x5ec383[_0x8754('0x34')]:_0x16c704[_0x8754('0x2e')];_0x5ec383['order']=qs['sort'](_0x4a38c3[_0x8754('0x2f')][_0x8754('0x35')]);_0x5ec383[_0x8754('0x39')]=qs[_0x8754('0x31')](_['pick'](_0x4a38c3[_0x8754('0x2f')],_0x16c704['filters']));if(_0x4a38c3[_0x8754('0x2f')][_0x8754('0x37')]){_0x5ec383[_0x8754('0x39')]=_[_0x8754('0x38')](_0x5ec383[_0x8754('0x39')],{'$or':_['map'](_0x5ec383[_0x8754('0x34')],function(_0x1c9cd9){var _0x5a66a9={};_0x5a66a9[_0x1c9cd9]={'$like':'%'+_0x4a38c3[_0x8754('0x2f')][_0x8754('0x37')]+'%'};return _0x5a66a9;})});}_0x5ec383=_['merge']({},_0x5ec383,_0x4a38c3[_0x8754('0x3b')]);return _0x2f2b78[_0x8754('0x4b')](_0x5ec383);}})[_0x8754('0x25')](function(_0x337ca6){if(_0x337ca6){_0xbfd49d=_0x337ca6['length'];if(!_0x4a38c3[_0x8754('0x2f')][_0x8754('0x4e')](_0x8754('0x4f'))){_0x5ec383['limit']=qs[_0x8754('0x1e')](_0x4a38c3['query'][_0x8754('0x1e')]);_0x5ec383[_0x8754('0x20')]=qs[_0x8754('0x20')](_0x4a38c3[_0x8754('0x2f')][_0x8754('0x20')]);}return _0x2f2b78[_0x8754('0x4b')](_0x5ec383);}})['then'](function(_0x181871){if(_0x181871){return _0x181871?{'count':_0xbfd49d,'rows':_0x181871}:null;}})['then'](respondWithResult(_0x5684cb,null))[_0x8754('0x3e')](handleError(_0x5684cb,null));};exports['addActions']=function(_0x235689,_0x3091a2,_0x59d381){return db[_0x8754('0x50')]['find']({'where':{'id':_0x235689['params']['id']}})[_0x8754('0x25')](handleEntityNotFound(_0x3091a2,null))[_0x8754('0x25')](function(_0x481896){if(_0x481896){return _0x481896[_0x8754('0x51')](_0x235689[_0x8754('0x46')][_0x8754('0x4a')],_[_0x8754('0x52')](_0x235689[_0x8754('0x46')],[_0x8754('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x3091a2,null))[_0x8754('0x3e')](handleError(_0x3091a2,null));};exports[_0x8754('0x53')]=function(_0x59ab65,_0x1c7ac2,_0x2cd1bf){var _0x14acde={};var _0x32491a={};var _0x5ed23e;var _0x4f13c2;return db[_0x8754('0x2a')][_0x8754('0x4c')]({'where':{'id':_0x59ab65[_0x8754('0x40')]['id']}})[_0x8754('0x25')](handleEntityNotFound(_0x1c7ac2,null))[_0x8754('0x25')](function(_0xf139a8){if(_0xf139a8){_0x5ed23e=_0xf139a8;_0x32491a[_0x8754('0x2e')]=_['keys'](db[_0x8754('0x50')][_0x8754('0x41')]);_0x32491a[_0x8754('0x2f')]=_[_0x8754('0x30')](_0x59ab65['query']);_0x32491a[_0x8754('0x31')]=_[_0x8754('0x32')](_0x32491a[_0x8754('0x2e')],_0x32491a['query']);_0x14acde[_0x8754('0x34')]=_['intersection'](_0x32491a[_0x8754('0x2e')],qs[_0x8754('0x33')](_0x59ab65['query'][_0x8754('0x33')]));_0x14acde['attributes']=_0x14acde[_0x8754('0x34')]['length']?_0x14acde[_0x8754('0x34')]:_0x32491a[_0x8754('0x2e')];_0x14acde[_0x8754('0x54')]=qs[_0x8754('0x35')](_0x59ab65[_0x8754('0x2f')][_0x8754('0x35')]);_0x14acde[_0x8754('0x39')]=qs[_0x8754('0x31')](_[_0x8754('0x36')](_0x59ab65['query'],_0x32491a['filters']));if(_0x59ab65[_0x8754('0x2f')][_0x8754('0x37')]){_0x14acde[_0x8754('0x39')]=_[_0x8754('0x38')](_0x14acde[_0x8754('0x39')],{'$or':_[_0x8754('0x29')](_0x14acde[_0x8754('0x34')],function(_0x33733a){var _0x5e9865={};_0x5e9865[_0x33733a]={'$like':'%'+_0x59ab65[_0x8754('0x2f')][_0x8754('0x37')]+'%'};return _0x5e9865;})});}_0x14acde=_[_0x8754('0x38')]({},_0x14acde,_0x59ab65[_0x8754('0x3b')]);return _0x5ed23e[_0x8754('0x53')](_0x14acde);}})[_0x8754('0x25')](function(_0x97cd3e){if(_0x97cd3e){_0x4f13c2=_0x97cd3e[_0x8754('0x42')];if(!_0x59ab65['query'][_0x8754('0x4e')](_0x8754('0x4f'))){_0x14acde[_0x8754('0x1e')]=qs[_0x8754('0x1e')](_0x59ab65['query'][_0x8754('0x1e')]);_0x14acde['offset']=qs['offset'](_0x59ab65[_0x8754('0x2f')]['offset']);}return _0x5ed23e[_0x8754('0x53')](_0x14acde);}})[_0x8754('0x25')](function(_0x2e5058){if(_0x2e5058){return _0x2e5058?{'count':_0x4f13c2,'rows':_0x2e5058}:null;}})['then'](respondWithResult(_0x1c7ac2,null))[_0x8754('0x3e')](handleError(_0x1c7ac2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6bcaa7c..44d3ecc 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 _0x1842=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a6d51,_0x46c33a){var _0x3090f2=function(_0x1c5d95){while(--_0x1c5d95){_0x5a6d51['push'](_0x5a6d51['shift']());}};_0x3090f2(++_0x46c33a);}(_0x1842,0x114));var _0x2184=function(_0x429247,_0x4a7289){_0x429247=_0x429247-0x0;var _0x2ef8d5=_0x1842[_0x429247];return _0x2ef8d5;};'use strict';var _=require(_0x2184('0x0'));var util=require(_0x2184('0x1'));var logger=require(_0x2184('0x2'))(_0x2184('0x3'));var moment=require(_0x2184('0x4'));var BPromise=require(_0x2184('0x5'));var rp=require(_0x2184('0x6'));var fs=require('fs');var path=require(_0x2184('0x7'));var rimraf=require(_0x2184('0x8'));var config=require(_0x2184('0x9'));var attributes=require(_0x2184('0xa'));module[_0x2184('0xb')]=function(_0x2bb649,_0x46d357){return _0x2bb649[_0x2184('0xc')](_0x2184('0xd'),attributes,{'tableName':_0x2184('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd38=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd38,0x1e0));var _0x8fd3=function(_0x49d429,_0x27aca8){_0x49d429=_0x49d429-0x0;var _0x5622d9=_0xfd38[_0x49d429];return _0x5622d9;};'use strict';var _=require(_0x8fd3('0x0'));var util=require(_0x8fd3('0x1'));var logger=require(_0x8fd3('0x2'))(_0x8fd3('0x3'));var moment=require(_0x8fd3('0x4'));var BPromise=require(_0x8fd3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8fd3('0x6'));var config=require(_0x8fd3('0x7'));var attributes=require(_0x8fd3('0x8'));module[_0x8fd3('0x9')]=function(_0x7c1045,_0x2e30d3){return _0x7c1045[_0x8fd3('0xa')]('Automation',attributes,{'tableName':_0x8fd3('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 4b59614..5a7bd19 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 _0x1c77=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0x1c77,0xed));var _0x71c7=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x1c77[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71c7('0x5'));var logger=require(_0x71c7('0x6'))(_0x71c7('0x7'));var config=require(_0x71c7('0x8'));var jayson=require(_0x71c7('0x9'));var client=jayson[_0x71c7('0xa')][_0x71c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57fb10,_0x57bbb6,_0x2c25a4){return new BPromise(function(_0x244867,_0x229b00){return client[_0x71c7('0xc')](_0x57fb10,_0x2c25a4)['then'](function(_0x1f5fc9){logger['info']('Automation,\x20%s,\x20%s',_0x57bbb6,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x57bbb6,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x1f5fc9));if(_0x1f5fc9['error']){if(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9['error'][_0x71c7('0x14')]);return _0x229b00(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x14')]);}logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9[_0x71c7('0x11')]['message']);return _0x244867(_0x1f5fc9['error'][_0x71c7('0x14')]);}else{logger[_0x71c7('0x15')](_0x71c7('0x13'),_0x57bbb6,_0x71c7('0xd'));_0x244867(_0x1f5fc9[_0x71c7('0x16')][_0x71c7('0x14')]);}})[_0x71c7('0x17')](function(_0x115262){logger['error'](_0x71c7('0x13'),_0x57bbb6,_0x115262);_0x229b00(_0x115262);});});} \ No newline at end of file +var _0x4325=['http','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x9fabe7,_0x35412a){var _0x910bdd=function(_0x1129f4){while(--_0x1129f4){_0x9fabe7['push'](_0x9fabe7['shift']());}};_0x910bdd(++_0x35412a);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('Automation,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5947e4b..225b30c 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 _0x26bc=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','put'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x26bc,0x162));var _0xc26b=function(_0x534382,_0x286bcc){_0x534382=_0x534382-0x0;var _0x44e48d=_0x26bc[_0x534382];return _0x44e48d;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xb')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xb')](_0xc26b('0xf'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x10')]);router['post']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);router['post'](_0xc26b('0xf'),auth['isAuthenticated'](),controller['addActions']);router[_0xc26b('0x14')](_0xc26b('0x15'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x16')]);router['delete'](_0xc26b('0x15'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x17')]);module[_0xc26b('0x18')]=router; \ No newline at end of file +var _0x0b36=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','destroy','util','path','express','Router'];(function(_0x583419,_0xba8746){var _0xa7d0bf=function(_0x56a6aa){while(--_0x56a6aa){_0x583419['push'](_0x583419['shift']());}};_0xa7d0bf(++_0xba8746);}(_0x0b36,0x80));var _0x60b3=function(_0x3ce796,_0x621939){_0x3ce796=_0x3ce796-0x0;var _0x354e12=_0x0b36[_0x3ce796];return _0x354e12;};'use strict';var multer=require('multer');var util=require(_0x60b3('0x0'));var path=require(_0x60b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x60b3('0x2'));var router=express[_0x60b3('0x3')]();var fs_extra=require(_0x60b3('0x4'));var auth=require(_0x60b3('0x5'));var interaction=require(_0x60b3('0x6'));var config=require(_0x60b3('0x7'));var controller=require(_0x60b3('0x8'));router[_0x60b3('0x9')]('/',auth[_0x60b3('0xa')](),controller['index']);router[_0x60b3('0x9')](_0x60b3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x60b3('0x9')](_0x60b3('0xc'),auth[_0x60b3('0xa')](),controller[_0x60b3('0xd')]);router[_0x60b3('0x9')](_0x60b3('0xe'),auth[_0x60b3('0xa')](),controller[_0x60b3('0xf')]);router[_0x60b3('0x10')]('/',auth[_0x60b3('0xa')](),controller[_0x60b3('0x11')]);router[_0x60b3('0x10')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router['post'](_0x60b3('0xe'),auth[_0x60b3('0xa')](),controller[_0x60b3('0x12')]);router[_0x60b3('0x13')]('/:id',auth[_0x60b3('0xa')](),controller[_0x60b3('0x14')]);router['delete'](_0x60b3('0xb'),auth[_0x60b3('0xa')](),controller[_0x60b3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a85e825..d6fc3c4 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 _0x3cbd=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.'];(function(_0x2f30f8,_0x157438){var _0x91be2b=function(_0x111518){while(--_0x111518){_0x2f30f8['push'](_0x2f30f8['shift']());}};_0x91be2b(++_0x157438);}(_0x3cbd,0xf5));var _0xd3cb=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x3cbd[_0x158cfc];return _0x38baee;};'use strict';var Sequelize=require(_0xd3cb('0x0'));module[_0xd3cb('0x1')]={'name':{'type':Sequelize[_0xd3cb('0x2')],'unique':_0xd3cb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd3cb('0x4')](_0xd3cb('0x5')),'allowNull':![],'defaultValue':_0xd3cb('0x5')},'description':{'type':Sequelize[_0xd3cb('0x2')]},'active':{'type':Sequelize[_0xd3cb('0x6')],'defaultValue':0x0,'comment':_0xd3cb('0x7')},'limitCalls':{'type':Sequelize[_0xd3cb('0x8')](0x4)[_0xd3cb('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd3cb('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd3cb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd3cb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd3cb('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd3cb('0x4')](_0xd3cb('0xf'),'never','onlyIfOpen'),'defaultValue':_0xd3cb('0xf')},'dialAMDActive':{'type':Sequelize[_0xd3cb('0x6')],'defaultValue':0x0,'comment':_0xd3cb('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd3cb('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3cb('0x12')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd3cb('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd3cb('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd3cb('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd3cb('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xd3cb('0x16')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3cb('0x17')},'dialCutDigit':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3cb('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xbc72=['#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc72,0x18e));var _0x2bc7=function(_0x5535ca,_0x2d62cf){_0x5535ca=_0x5535ca-0x0;var _0x461003=_0xbc72[_0x5535ca];return _0x461003;};'use strict';var Sequelize=require(_0x2bc7('0x0'));module['exports']={'name':{'type':Sequelize[_0x2bc7('0x1')],'unique':_0x2bc7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x2bc7('0x3')),'allowNull':![],'defaultValue':_0x2bc7('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2bc7('0x4')],'defaultValue':0x0,'comment':_0x2bc7('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2bc7('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2bc7('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2bc7('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2bc7('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2bc7('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'comment':_0x2bc7('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2bc7('0x8')](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2bc7('0xf')},'dialTimezone':{'type':Sequelize[_0x2bc7('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2bc7('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x2bc7('0x10')](_0x2bc7('0x11'),'never',_0x2bc7('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2bc7('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2bc7('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2bc7('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x2bc7('0x8')](0x9)[_0x2bc7('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2bc7('0x8')](0x9)[_0x2bc7('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2bc7('0x8')](0x9)[_0x2bc7('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2bc7('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x2bc7('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2bc7('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2bc7('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2bc7('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2bc7('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2bc7('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2bc7('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2bc7('0x10')]('DESC',_0x2bc7('0x1a')),'defaultValue':_0x2bc7('0x1b')},'dialPrefix':{'type':Sequelize[_0x2bc7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2bc7('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2bc7('0x1c')},'dialCutDigit':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2bc7('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x2bc7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2bc7('0x8')](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2bc7('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2bc7('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2bc7('0x8')](0x5)[_0x2bc7('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2bc7('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e722bf3..f5b6c09 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 _0xa249=['send','index','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','user','findOne','CmHopper','sort','pick','getHopperHistories','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','select','field','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','fromQuery','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name'];(function(_0x12977a,_0x44a4a7){var _0x3e5bfe=function(_0x10afe8){while(--_0x10afe8){_0x12977a['push'](_0x12977a['shift']());}};_0x3e5bfe(++_0x44a4a7);}(_0xa249,0x183));var _0x9a24=function(_0x4fe6a4,_0x2d05c3){_0x4fe6a4=_0x4fe6a4-0x0;var _0x24fb98=_0xa249[_0x4fe6a4];return _0x24fb98;};'use strict';var emlformat=require(_0x9a24('0x0'));var rimraf=require(_0x9a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a24('0x2'));var rp=require(_0x9a24('0x3'));var moment=require('moment');var BPromise=require(_0x9a24('0x4'));var Mustache=require('mustache');var util=require(_0x9a24('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a24('0x6'));var fs=require('fs');var fs_extra=require(_0x9a24('0x7'));var _=require(_0x9a24('0x8'));var squel=require(_0x9a24('0x9'));var crypto=require(_0x9a24('0xa'));var jsforce=require(_0x9a24('0xb'));var deskjs=require(_0x9a24('0xc'));var toCsv=require(_0x9a24('0xd'));var querystring=require(_0x9a24('0xe'));var Papa=require(_0x9a24('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a24('0x10'));var as=require(_0x9a24('0x11'));var hardwareService=require(_0x9a24('0x12'));var logger=require('../../config/logger')(_0x9a24('0x13'));var utils=require('../../config/utils');var config=require(_0x9a24('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a24('0x15'))['db'];function respondWithStatusCode(_0xf809b7,_0x3d278b){_0x3d278b=_0x3d278b||0xcc;return function(_0x41f522){if(_0x41f522){return _0xf809b7[_0x9a24('0x16')](_0x3d278b);}return _0xf809b7['status'](_0x3d278b)[_0x9a24('0x17')]();};}function respondWithResult(_0x3d166d,_0x2bc767){_0x2bc767=_0x2bc767||0xc8;return function(_0x301a26){if(_0x301a26){return _0x3d166d[_0x9a24('0x18')](_0x2bc767)['json'](_0x301a26);}};}function respondWithFilteredResult(_0x519709,_0x714fd5){return function(_0x306c6d){if(_0x306c6d){var _0x25202f=typeof _0x714fd5['offset']===_0x9a24('0x19')&&typeof _0x714fd5[_0x9a24('0x1a')]===_0x9a24('0x19');var _0x2ffc6b=_0x306c6d[_0x9a24('0x1b')];var _0x402532=_0x25202f?0x0:_0x714fd5[_0x9a24('0x1c')];var _0xa438fe=_0x25202f?_0x306c6d[_0x9a24('0x1b')]:_0x714fd5[_0x9a24('0x1c')]+_0x714fd5[_0x9a24('0x1a')];var _0x164ab2;if(_0xa438fe>=_0x2ffc6b){_0xa438fe=_0x2ffc6b;_0x164ab2=0xc8;}else{_0x164ab2=0xce;}_0x519709['status'](_0x164ab2);return _0x519709[_0x9a24('0x1d')]('Content-Range',_0x402532+'-'+_0xa438fe+'/'+_0x2ffc6b)['json'](_0x306c6d);}return null;};}function patchUpdates(_0x4b775a){return function(_0x114921){try{jsonpatch[_0x9a24('0x1e')](_0x114921,_0x4b775a,!![]);}catch(_0x4d8fa8){return BPromise[_0x9a24('0x1f')](_0x4d8fa8);}return _0x114921[_0x9a24('0x20')]();};}function saveUpdates(_0x69d2e9,_0x430594){return function(_0x101477){if(_0x101477){return _0x101477[_0x9a24('0x21')](_0x69d2e9)[_0x9a24('0x22')](function(_0x390c66){return _0x390c66;});}return null;};}function removeEntity(_0x159f65,_0x5ace5c){return function(_0x1ea7e7){if(_0x1ea7e7){return _0x1ea7e7[_0x9a24('0x23')]()[_0x9a24('0x22')](function(){var _0x5e8c24=_0x1ea7e7[_0x9a24('0x24')]({'plain':!![]});var _0x5b2469=_0x9a24('0x25');return db[_0x9a24('0x26')][_0x9a24('0x23')]({'where':{'type':_0x5b2469,'resourceId':_0x5e8c24['id']}})['then'](function(){return _0x1ea7e7;});})[_0x9a24('0x22')](function(){_0x159f65[_0x9a24('0x18')](0xcc)[_0x9a24('0x17')]();});}};}function handleEntityNotFound(_0x4c6d7f,_0x350276){return function(_0x5e0d10){if(!_0x5e0d10){_0x4c6d7f[_0x9a24('0x16')](0x194);}return _0x5e0d10;};}function handleError(_0x564030,_0x457c9b){_0x457c9b=_0x457c9b||0x1f4;return function(_0x2fa061){logger[_0x9a24('0x27')](_0x2fa061[_0x9a24('0x28')]);if(_0x2fa061[_0x9a24('0x29')]){delete _0x2fa061['name'];}_0x564030['status'](_0x457c9b)[_0x9a24('0x2a')](_0x2fa061);};}exports[_0x9a24('0x2b')]=function(_0xf6b084,_0x1bd06c){var _0x27b5fb={},_0x34d053={},_0x1fe151={'count':0x0,'rows':[]};var _0x26e7c3=_[_0x9a24('0x2c')](db[_0x9a24('0x2d')][_0x9a24('0x2e')],function(_0xab849f){return{'name':_0xab849f['fieldName'],'type':_0xab849f[_0x9a24('0x2f')][_0x9a24('0x30')]};});_0x34d053[_0x9a24('0x31')]=_['map'](_0x26e7c3,'name');_0x34d053[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0xf6b084[_0x9a24('0x32')]);_0x34d053[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x34d053['model'],_0x34d053[_0x9a24('0x32')]);_0x27b5fb[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x34d053[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0xf6b084[_0x9a24('0x32')][_0x9a24('0x37')]));_0x27b5fb[_0x9a24('0x36')]=_0x27b5fb[_0x9a24('0x36')][_0x9a24('0x38')]?_0x27b5fb[_0x9a24('0x36')]:_0x34d053[_0x9a24('0x31')];if(!_0xf6b084['query'][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x27b5fb[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0xf6b084[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x27b5fb[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0xf6b084['query'][_0x9a24('0x1c')]);}_0x27b5fb[_0x9a24('0x3b')]=qs['sort'](_0xf6b084['query']['sort']);_0x27b5fb['where']=qs['filters'](_['pick'](_0xf6b084[_0x9a24('0x32')],_0x34d053['filters']),_0x26e7c3);if(_0xf6b084['query'][_0x9a24('0x3c')]){_0x27b5fb['where']=_[_0x9a24('0x3d')](_0x27b5fb[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x26e7c3,function(_0x5af9b3){if(_0x5af9b3['type']!==_0x9a24('0x3f')){var _0x3695eb={};_0x3695eb[_0x5af9b3[_0x9a24('0x29')]]={'$like':'%'+_0xf6b084[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x3695eb;}})});}_0x27b5fb=_[_0x9a24('0x3d')]({},_0x27b5fb,_0xf6b084['options']);var _0xe964c5={'where':_0x27b5fb[_0x9a24('0x3e')]};return db['Campaign'][_0x9a24('0x1b')](_0xe964c5)[_0x9a24('0x22')](function(_0x4d94f2){_0x1fe151[_0x9a24('0x1b')]=_0x4d94f2;if(_0xf6b084[_0x9a24('0x32')][_0x9a24('0x40')]){_0x27b5fb[_0x9a24('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x9a24('0x42')](_0x27b5fb);})[_0x9a24('0x22')](function(_0x6689c1){_0x1fe151[_0x9a24('0x43')]=_0x6689c1;return _0x1fe151;})['then'](respondWithFilteredResult(_0x1bd06c,_0x27b5fb))[_0x9a24('0x44')](handleError(_0x1bd06c,null));};exports[_0x9a24('0x45')]=function(_0x360a23,_0x390391){var _0x40b480={'raw':![],'where':{'id':_0x360a23[_0x9a24('0x46')]['id']}},_0x5d8e69={};_0x5d8e69['model']=_[_0x9a24('0x33')](db['Campaign'][_0x9a24('0x2e')]);_0x5d8e69[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x360a23[_0x9a24('0x32')]);_0x5d8e69[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x5d8e69[_0x9a24('0x31')],_0x5d8e69[_0x9a24('0x32')]);_0x40b480['attributes']=_[_0x9a24('0x35')](_0x5d8e69[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x360a23['query'][_0x9a24('0x37')]));_0x40b480[_0x9a24('0x36')]=_0x40b480['attributes'][_0x9a24('0x38')]?_0x40b480[_0x9a24('0x36')]:_0x5d8e69[_0x9a24('0x31')];if(_0x360a23[_0x9a24('0x32')]['includeAll']){_0x40b480[_0x9a24('0x41')]=[{'all':!![]}];}_0x40b480=_[_0x9a24('0x3d')]({},_0x40b480,_0x360a23[_0x9a24('0x47')]);return db[_0x9a24('0x2d')][_0x9a24('0x48')](_0x40b480)['then'](handleEntityNotFound(_0x390391,null))['then'](respondWithResult(_0x390391,null))[_0x9a24('0x44')](handleError(_0x390391,null));};exports[_0x9a24('0x49')]=function(_0x107232,_0x107254){return db[_0x9a24('0x2d')]['create'](_0x107232[_0x9a24('0x4a')],{})[_0x9a24('0x22')](function(_0x58da5c){var _0xaaecd9=_0x107232['user'][_0x9a24('0x24')]({'plain':!![]});if(!_0xaaecd9)throw new Error(_0x9a24('0x4b'));if(_0xaaecd9[_0x9a24('0x4c')]==='user'){var _0x2328c3=_0x58da5c[_0x9a24('0x24')]({'plain':!![]});var _0x332ef8=_0x9a24('0x25');return db[_0x9a24('0x4d')][_0x9a24('0x48')]({'where':{'name':_0x332ef8,'userProfileId':_0xaaecd9[_0x9a24('0x4e')]},'raw':!![]})[_0x9a24('0x22')](function(_0x5d0f2a){if(_0x5d0f2a&&_0x5d0f2a[_0x9a24('0x4f')]===0x0){return db['UserProfileResource'][_0x9a24('0x49')]({'name':_0x2328c3[_0x9a24('0x29')],'resourceId':_0x2328c3['id'],'type':_0x5d0f2a[_0x9a24('0x29')],'sectionId':_0x5d0f2a['id']},{})[_0x9a24('0x22')](function(){return _0x58da5c;});}else{return _0x58da5c;}})[_0x9a24('0x44')](function(_0x5ce00b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ce00b);throw _0x5ce00b;});}return _0x58da5c;})[_0x9a24('0x22')](respondWithResult(_0x107254,0xc9))[_0x9a24('0x44')](handleError(_0x107254,null));};exports[_0x9a24('0x50')]=function(_0x2dc6e3,_0x5eca2d){var _0x31b843={'where':{'id':_0x2dc6e3[_0x9a24('0x46')]['id']}},_0x4f33e3={};_0x4f33e3['model']=_[_0x9a24('0x33')](db['Campaign'][_0x9a24('0x2e')]);_0x31b843[_0x9a24('0x36')]=_['intersection'](_0x4f33e3[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x2dc6e3[_0x9a24('0x32')][_0x9a24('0x37')]));_0x31b843[_0x9a24('0x36')]=_0x31b843[_0x9a24('0x36')]['length']?_0x31b843[_0x9a24('0x36')]:_0x4f33e3[_0x9a24('0x31')];if(_0x2dc6e3[_0x9a24('0x32')][_0x9a24('0x40')]){_0x31b843['include']=[{'all':!![]}];}_0x31b843=_[_0x9a24('0x3d')]({},_0x31b843,_0x2dc6e3[_0x9a24('0x47')]);return db[_0x9a24('0x2d')][_0x9a24('0x48')](_0x31b843)[_0x9a24('0x22')](handleEntityNotFound(_0x5eca2d,null))[_0x9a24('0x22')](function(_0x4cd161){if(_0x4cd161){var _0x310574=_0x4cd161[_0x9a24('0x24')]({'plain':!![]});_0x310574=qs[_0x9a24('0x51')](_0x310574,['id','createdAt',_0x9a24('0x52')]);_0x2dc6e3[_0x9a24('0x4a')]=_[_0x9a24('0x51')](_0x2dc6e3[_0x9a24('0x4a')],['id',_0x9a24('0x53'),_0x9a24('0x52')]);return db['Campaign']['create'](_[_0x9a24('0x3d')](_0x310574,_0x2dc6e3[_0x9a24('0x4a')]),{'include':_0x2dc6e3[_0x9a24('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x396228){var _0x1bbdde=_0x2dc6e3[_0x9a24('0x54')]['get']({'plain':!![]});if(!_0x1bbdde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bbdde[_0x9a24('0x4c')]===_0x9a24('0x54')){var _0x4cf532=_0x396228['get']({'plain':!![]});var _0x7d3e6b=_0x9a24('0x25');return db[_0x9a24('0x4d')]['find']({'where':{'name':_0x7d3e6b,'userProfileId':_0x1bbdde[_0x9a24('0x4e')]},'raw':!![]})[_0x9a24('0x22')](function(_0x512751){if(_0x512751&&_0x512751['autoAssociation']===0x0){return db[_0x9a24('0x26')]['create']({'name':_0x4cf532[_0x9a24('0x29')],'resourceId':_0x4cf532['id'],'type':_0x512751[_0x9a24('0x29')],'sectionId':_0x512751['id']},{})[_0x9a24('0x22')](function(){return _0x396228;});}else{return _0x396228;}})[_0x9a24('0x44')](function(_0x33934f){logger[_0x9a24('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33934f);throw _0x33934f;});}return _0x396228;});}})[_0x9a24('0x22')](respondWithResult(_0x5eca2d,0xc9))[_0x9a24('0x44')](handleError(_0x5eca2d,null));};exports[_0x9a24('0x21')]=function(_0x2fc00b,_0x4bc395){if(_0x2fc00b[_0x9a24('0x4a')]['id']){delete _0x2fc00b['body']['id'];}return db['Campaign'][_0x9a24('0x48')]({'where':{'id':_0x2fc00b[_0x9a24('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc395,null))['then'](saveUpdates(_0x2fc00b['body'],null))['then'](respondWithResult(_0x4bc395,null))[_0x9a24('0x44')](handleError(_0x4bc395,null));};exports[_0x9a24('0x23')]=function(_0x16fa6e,_0x5c834f){return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0x16fa6e['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x5c834f,null))[_0x9a24('0x22')](removeEntity(_0x5c834f,null))[_0x9a24('0x44')](handleError(_0x5c834f,null));};exports['getHoppers']=function(_0x5e8f71,_0x32fd4e,_0x105a01){var _0x535319={'raw':!![],'where':{}};var _0x4d7ee7={};var _0x908b2c={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x5e8f71[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x32fd4e,null))[_0x9a24('0x22')](function(_0x50dbd3){if(_0x50dbd3){_0x4d7ee7['model']=_[_0x9a24('0x33')](db[_0x9a24('0x56')][_0x9a24('0x2e')]);_0x4d7ee7[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x5e8f71[_0x9a24('0x32')]);_0x4d7ee7['filters']=_[_0x9a24('0x35')](_0x4d7ee7[_0x9a24('0x31')],_0x4d7ee7['query']);_0x535319[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x4d7ee7['model'],qs[_0x9a24('0x37')](_0x5e8f71['query'][_0x9a24('0x37')]));_0x535319[_0x9a24('0x36')]=_0x535319['attributes'][_0x9a24('0x38')]?_0x535319[_0x9a24('0x36')]:_0x4d7ee7[_0x9a24('0x31')];if(!_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x535319[_0x9a24('0x1a')]=qs['limit'](_0x5e8f71['query'][_0x9a24('0x1a')]);_0x535319[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x535319[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x5e8f71['query'][_0x9a24('0x57')]);_0x535319[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x5e8f71[_0x9a24('0x32')],_0x4d7ee7[_0x9a24('0x34')]));_0x535319[_0x9a24('0x3e')]['CampaignId']=_0x50dbd3['id'];if(_0x5e8f71['query'][_0x9a24('0x3c')]){_0x535319[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x535319[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x535319[_0x9a24('0x36')],function(_0x17e62a){var _0xd31ed7={};_0xd31ed7[_0x17e62a]={'$like':'%'+_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0xd31ed7;})});}_0x535319=_[_0x9a24('0x3d')]({},_0x535319,_0x5e8f71['options']);return db[_0x9a24('0x56')][_0x9a24('0x1b')]({'where':_0x535319[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x1012b4){_0x908b2c[_0x9a24('0x1b')]=_0x1012b4;if(_0x5e8f71['query'][_0x9a24('0x40')]){_0x535319[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x535319);})[_0x9a24('0x22')](function(_0x294029){_0x908b2c[_0x9a24('0x43')]=_0x294029;return _0x908b2c;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x32fd4e,_0x535319))[_0x9a24('0x44')](handleError(_0x32fd4e,null));};exports[_0x9a24('0x59')]=function(_0x3515be,_0x1ad182,_0x205306){var _0x4df613={'raw':!![],'where':{}};var _0x2c7cb1={};var _0x2ab856={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')]['findOne']({'where':{'id':_0x3515be[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x1ad182,null))[_0x9a24('0x22')](function(_0xbbcb07){if(_0xbbcb07){_0x2c7cb1[_0x9a24('0x31')]=_[_0x9a24('0x33')](db['CmHopperHistory'][_0x9a24('0x2e')]);_0x2c7cb1[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x3515be[_0x9a24('0x32')]);_0x2c7cb1[_0x9a24('0x34')]=_['intersection'](_0x2c7cb1[_0x9a24('0x31')],_0x2c7cb1[_0x9a24('0x32')]);_0x4df613[_0x9a24('0x36')]=_['intersection'](_0x2c7cb1[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x3515be['query']['fields']));_0x4df613[_0x9a24('0x36')]=_0x4df613[_0x9a24('0x36')]['length']?_0x4df613[_0x9a24('0x36')]:_0x2c7cb1[_0x9a24('0x31')];if(!_0x3515be[_0x9a24('0x32')][_0x9a24('0x39')]('nolimit')){_0x4df613[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x4df613['offset']=qs[_0x9a24('0x1c')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x4df613[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x57')]);_0x4df613[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x3515be[_0x9a24('0x32')],_0x2c7cb1[_0x9a24('0x34')]));_0x4df613[_0x9a24('0x3e')][_0x9a24('0x5a')]=_0xbbcb07['id'];if(_0x3515be[_0x9a24('0x32')][_0x9a24('0x3c')]){_0x4df613[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x4df613[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4df613[_0x9a24('0x36')],function(_0x495e82){var _0x413be6={};_0x413be6[_0x495e82]={'$like':'%'+_0x3515be[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x413be6;})});}_0x4df613=_[_0x9a24('0x3d')]({},_0x4df613,_0x3515be[_0x9a24('0x47')]);return db['CmHopperHistory'][_0x9a24('0x1b')]({'where':_0x4df613[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x31efa9){_0x2ab856[_0x9a24('0x1b')]=_0x31efa9;if(_0x3515be[_0x9a24('0x32')][_0x9a24('0x40')]){_0x4df613[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9a24('0x42')](_0x4df613);})['then'](function(_0x43d4d3){_0x2ab856[_0x9a24('0x43')]=_0x43d4d3;return _0x2ab856;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x1ad182,_0x4df613))[_0x9a24('0x44')](handleError(_0x1ad182,null));};exports[_0x9a24('0x5b')]=function(_0x3d6b22,_0x195276,_0x37f0d3){var _0x4428fe={'raw':!![],'where':{}};var _0x4cc2db={};var _0x1061cc={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x3d6b22[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x195276,null))[_0x9a24('0x22')](function(_0x2ed0cc){if(_0x2ed0cc){_0x4cc2db[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5c')]['rawAttributes']);_0x4cc2db['query']=_[_0x9a24('0x33')](_0x3d6b22['query']);_0x4cc2db[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x4cc2db[_0x9a24('0x31')],_0x4cc2db['query']);_0x4428fe[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x4cc2db[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x37')]));_0x4428fe[_0x9a24('0x36')]=_0x4428fe[_0x9a24('0x36')]['length']?_0x4428fe[_0x9a24('0x36')]:_0x4cc2db['model'];if(!_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x4428fe[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x4428fe[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x4428fe['order']=qs[_0x9a24('0x57')](_0x3d6b22[_0x9a24('0x32')]['sort']);_0x4428fe[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x3d6b22[_0x9a24('0x32')],_0x4cc2db[_0x9a24('0x34')]));_0x4428fe['where'][_0x9a24('0x5a')]=_0x2ed0cc['id'];if(_0x3d6b22['query'][_0x9a24('0x3c')]){_0x4428fe[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x4428fe[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4428fe[_0x9a24('0x36')],function(_0x1334c6){var _0x4f586e={};_0x4f586e[_0x1334c6]={'$like':'%'+_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x4f586e;})});}_0x4428fe=_[_0x9a24('0x3d')]({},_0x4428fe,_0x3d6b22[_0x9a24('0x47')]);return db['CmHopperFinal']['count']({'where':_0x4428fe[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x49d96e){_0x1061cc[_0x9a24('0x1b')]=_0x49d96e;if(_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x40')]){_0x4428fe[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9a24('0x42')](_0x4428fe);})[_0x9a24('0x22')](function(_0x12694a){_0x1061cc[_0x9a24('0x43')]=_0x12694a;return _0x1061cc;});}})['then'](respondWithFilteredResult(_0x195276,_0x4428fe))[_0x9a24('0x44')](handleError(_0x195276,null));};exports['getHopperBlacks']=function(_0x215fea,_0x3cefd6,_0x3ae878){var _0x39e70e={'raw':!![],'where':{}};var _0x2c31fd={};var _0x3cec8a={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x215fea['params']['id']}})['then'](handleEntityNotFound(_0x3cefd6,null))[_0x9a24('0x22')](function(_0x99271c){if(_0x99271c){_0x2c31fd[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5d')][_0x9a24('0x2e')]);_0x2c31fd[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x215fea[_0x9a24('0x32')]);_0x2c31fd[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x2c31fd[_0x9a24('0x31')],_0x2c31fd['query']);_0x39e70e[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x2c31fd['model'],qs[_0x9a24('0x37')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x37')]));_0x39e70e[_0x9a24('0x36')]=_0x39e70e['attributes'][_0x9a24('0x38')]?_0x39e70e[_0x9a24('0x36')]:_0x2c31fd['model'];if(!_0x215fea[_0x9a24('0x32')]['hasOwnProperty'](_0x9a24('0x3a'))){_0x39e70e[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x39e70e[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x215fea['query']['offset']);}_0x39e70e['order']=qs[_0x9a24('0x57')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x57')]);_0x39e70e[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x215fea[_0x9a24('0x32')],_0x2c31fd[_0x9a24('0x34')]));_0x39e70e[_0x9a24('0x3e')][_0x9a24('0x5a')]=_0x99271c['id'];if(_0x215fea[_0x9a24('0x32')][_0x9a24('0x3c')]){_0x39e70e['where']=_['merge'](_0x39e70e[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x39e70e[_0x9a24('0x36')],function(_0x1b3ab1){var _0x32abba={};_0x32abba[_0x1b3ab1]={'$like':'%'+_0x215fea[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x32abba;})});}_0x39e70e=_[_0x9a24('0x3d')]({},_0x39e70e,_0x215fea['options']);return db[_0x9a24('0x5d')][_0x9a24('0x1b')]({'where':_0x39e70e[_0x9a24('0x3e')]})['then'](function(_0x34362f){_0x3cec8a[_0x9a24('0x1b')]=_0x34362f;if(_0x215fea[_0x9a24('0x32')]['includeAll']){_0x39e70e[_0x9a24('0x41')]=[{'all':!![]}];}return db[_0x9a24('0x5d')]['findAll'](_0x39e70e);})[_0x9a24('0x22')](function(_0x5a0d1d){_0x3cec8a[_0x9a24('0x43')]=_0x5a0d1d;return _0x3cec8a;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x3cefd6,_0x39e70e))['catch'](handleError(_0x3cefd6,null));};exports[_0x9a24('0x5e')]=function(_0x47deba,_0x2ee974,_0x2ab48b){var _0x4266ef={};var _0x6274cb={};var _0x24b278;var _0x4831bc;return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x47deba[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x2ee974,null))[_0x9a24('0x22')](function(_0x5057dc){if(_0x5057dc){_0x24b278=_0x5057dc;_0x6274cb[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5f')][_0x9a24('0x2e')]);_0x6274cb[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x47deba[_0x9a24('0x32')]);_0x6274cb[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x6274cb['model'],_0x6274cb[_0x9a24('0x32')]);_0x4266ef[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x6274cb[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x47deba['query'][_0x9a24('0x37')]));_0x4266ef[_0x9a24('0x36')]=_0x4266ef[_0x9a24('0x36')]['length']?_0x4266ef[_0x9a24('0x36')]:_0x6274cb[_0x9a24('0x31')];_0x4266ef[_0x9a24('0x3b')]=qs['sort'](_0x47deba[_0x9a24('0x32')][_0x9a24('0x57')]);_0x4266ef['where']=qs['filters'](_[_0x9a24('0x58')](_0x47deba[_0x9a24('0x32')],_0x6274cb[_0x9a24('0x34')]));if(_0x47deba['query'][_0x9a24('0x3c')]){_0x4266ef[_0x9a24('0x3e')]=_['merge'](_0x4266ef[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4266ef[_0x9a24('0x36')],function(_0x1b5d66){var _0x38e634={};_0x38e634[_0x1b5d66]={'$like':'%'+_0x47deba['query'][_0x9a24('0x3c')]+'%'};return _0x38e634;})});}_0x4266ef=_[_0x9a24('0x3d')]({},_0x4266ef,_0x47deba[_0x9a24('0x47')]);return _0x24b278[_0x9a24('0x5e')](_0x4266ef);}})[_0x9a24('0x22')](function(_0x23fdc6){if(_0x23fdc6){_0x4831bc=_0x23fdc6['length'];if(!_0x47deba[_0x9a24('0x32')]['hasOwnProperty'](_0x9a24('0x3a'))){_0x4266ef[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x47deba[_0x9a24('0x32')]['limit']);_0x4266ef[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x47deba[_0x9a24('0x32')]['offset']);}return _0x24b278['getLists'](_0x4266ef);}})[_0x9a24('0x22')](function(_0x19f7a9){if(_0x19f7a9){return _0x19f7a9?{'count':_0x4831bc,'rows':_0x19f7a9}:null;}})[_0x9a24('0x22')](respondWithResult(_0x2ee974,null))[_0x9a24('0x44')](handleError(_0x2ee974,null));};exports['addLists']=function(_0xb10d,_0x5d1f90,_0x2515d9){var _0x75249f,_0x12b3ff;var _0x55d4eb=[];var _0x4dc9c1=moment()[_0x9a24('0x60')](_0x9a24('0x61'));return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0xb10d['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x5d1f90,null))[_0x9a24('0x22')](function(_0x3a8349){if(_0x3a8349){_0x12b3ff=_0x3a8349;return _0x3a8349[_0x9a24('0x62')](_0xb10d[_0x9a24('0x4a')][_0x9a24('0x63')],_['omit'](_0xb10d[_0x9a24('0x4a')],[_0x9a24('0x63'),'id'])||{});}return null;})['spread'](function(_0x31dd79){var _0x47142e;var _0x44b0a5;_0x75249f=_0x31dd79||[];var _0xbd051b=[];if(_0x31dd79){for(var _0x26c9eb=0x0;_0x26c9eb<_0x31dd79['length'];_0x26c9eb+=0x1){var _0x3dfaeb=_0x31dd79[_0x26c9eb][_0x9a24('0x24')]({'plain':!![]});_0x12b3ff['dialCheckDuplicateType']=_0xb10d[_0x9a24('0x4a')][_0x9a24('0x64')]?_0xb10d[_0x9a24('0x4a')][_0x9a24('0x64')]:_0x12b3ff[_0x9a24('0x64')];switch(_0x12b3ff[_0x9a24('0x64')]){case _0x9a24('0x65'):_0x47142e=squel['insert']()[_0x9a24('0x66')](_0x9a24('0x67'))['fromQuery']([_0x9a24('0x68'),_0x9a24('0x69'),'ContactId',_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x68'),'phone')['field'](_0x9a24('0x6d'),'scheduledAt')['field']('id',_0x9a24('0x6e'))[_0x9a24('0x6c')](_0x3dfaeb['CmListId'][_0x9a24('0x6f')](),_0x9a24('0x6a'))[_0x9a24('0x6c')](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))['field']('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb['CmListId'][_0x9a24('0x6f')]())[_0x9a24('0x3e')](_0x9a24('0x73'))[_0x9a24('0x3e')](_0x9a24('0x74'),squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x75'))['from'](_0x9a24('0x76'))['where'](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]()))['where'](_0x9a24('0x74'),squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x78'))[_0x9a24('0x79')](_0x9a24('0x67'))[_0x9a24('0x3e')](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id']['toString']())))[_0x9a24('0x6f')]();break;case _0x9a24('0x7a'):_0x47142e=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')]('cm_hopper')[_0x9a24('0x7c')]([_0x9a24('0x68'),'scheduledAt','ContactId',_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x68'),_0x9a24('0x68'))[_0x9a24('0x6c')](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')]('id','ContactId')[_0x9a24('0x6c')](_0x3dfaeb[_0x9a24('0x7d')][_0x9a24('0x6f')](),_0x9a24('0x6a'))[_0x9a24('0x6c')](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))['field']('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))[_0x9a24('0x79')](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb[_0x9a24('0x7d')]['toString']())[_0x9a24('0x3e')](_0x9a24('0x73'))[_0x9a24('0x3e')](_0x9a24('0x74'),squel['select']()[_0x9a24('0x6c')](_0x9a24('0x78'))[_0x9a24('0x79')]('cm_hopper')[_0x9a24('0x3e')](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]())))[_0x9a24('0x6f')]();break;default:_0x47142e=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')](_0x9a24('0x67'))[_0x9a24('0x7c')](['phone',_0x9a24('0x69'),_0x9a24('0x6e'),_0x9a24('0x6a'),'CampaignId',_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()['field'](_0x9a24('0x68'),_0x9a24('0x68'))['field'](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')]('id','ContactId')[_0x9a24('0x6c')](_0x3dfaeb[_0x9a24('0x7d')]['toString'](),'ListId')['field'](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),'CampaignId')['field']('\x27'+_0x4dc9c1+'\x27','createdAt')[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb[_0x9a24('0x7d')][_0x9a24('0x6f')]())['where'](_0x9a24('0x73')))[_0x9a24('0x6f')]();}_0x44b0a5=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')](_0x9a24('0x7e'))['fromQuery']([_0x9a24('0x7f'),_0x9a24('0x69'),_0x9a24('0x68'),_0x9a24('0x80'),_0x9a24('0x53'),'updatedAt'],squel[_0x9a24('0x6b')]()['field'](_0x9a24('0x81'),'id')[_0x9a24('0x6c')](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')](_0x9a24('0x82'),_0x9a24('0x68'))['field'](_0x9a24('0x83'),_0x9a24('0x80'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))[_0x9a24('0x79')]('cm_contact_has_items','ci')[_0x9a24('0x84')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x9a24('0x3e')](_0x9a24('0x85'),_0x3dfaeb['CmListId']['toString']())[_0x9a24('0x3e')]('h.CampaignId=?',_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]())[_0x9a24('0x3e')]('h.createdAt\x20=\x20?',_0x4dc9c1))[_0x9a24('0x6f')]();_0xbd051b[_0x9a24('0x86')](db[_0x9a24('0x87')][_0x9a24('0x32')](_0x47142e));_0x55d4eb['push'](db['sequelize'][_0x9a24('0x32')](_0x44b0a5));}return BPromise[_0x9a24('0x88')](_0xbd051b);}})['then'](function(){return BPromise[_0x9a24('0x88')](_0x55d4eb);})[_0x9a24('0x22')](function(){return _0x75249f;})[_0x9a24('0x22')](respondWithResult(_0x5d1f90,null))[_0x9a24('0x44')](handleError(_0x5d1f90,null));};exports[_0x9a24('0x89')]=function(_0x51e966,_0x47373e,_0x332d7d){return db['Campaign']['find']({'where':{'id':_0x51e966['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x47373e,null))[_0x9a24('0x22')](function(_0x755c02){if(_0x755c02){return _0x755c02[_0x9a24('0x89')](_0x51e966['query'][_0x9a24('0x63')]);}})[_0x9a24('0x22')](function(_0xf4ff27){if(_0xf4ff27){return db[_0x9a24('0x56')][_0x9a24('0x23')]({'where':{'ListId':_0x51e966[_0x9a24('0x32')][_0x9a24('0x63')],'CampaignId':_0x51e966[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](function(){return _0xf4ff27;});}})[_0x9a24('0x22')](respondWithStatusCode(_0x47373e,null))['catch'](handleError(_0x47373e,null));};exports[_0x9a24('0x8a')]=function(_0x4d4d95,_0x27f57a,_0x592c2e){var _0x1a09f1={};var _0xcd0a9d={};var _0x511904;var _0x14f46c;return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x4d4d95[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x27f57a,null))[_0x9a24('0x22')](function(_0x1919b4){if(_0x1919b4){_0x511904=_0x1919b4;_0xcd0a9d[_0x9a24('0x31')]=_['keys'](db[_0x9a24('0x5f')][_0x9a24('0x2e')]);_0xcd0a9d['query']=_[_0x9a24('0x33')](_0x4d4d95[_0x9a24('0x32')]);_0xcd0a9d[_0x9a24('0x34')]=_['intersection'](_0xcd0a9d['model'],_0xcd0a9d['query']);_0x1a09f1[_0x9a24('0x36')]=_['intersection'](_0xcd0a9d[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x4d4d95['query']['fields']));_0x1a09f1[_0x9a24('0x36')]=_0x1a09f1[_0x9a24('0x36')]['length']?_0x1a09f1[_0x9a24('0x36')]:_0xcd0a9d[_0x9a24('0x31')];_0x1a09f1[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x57')]);_0x1a09f1[_0x9a24('0x3e')]=qs['filters'](_[_0x9a24('0x58')](_0x4d4d95[_0x9a24('0x32')],_0xcd0a9d[_0x9a24('0x34')]));if(_0x4d4d95['query'][_0x9a24('0x3c')]){_0x1a09f1[_0x9a24('0x3e')]=_['merge'](_0x1a09f1[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x1a09f1[_0x9a24('0x36')],function(_0x4fe3c6){var _0x5eb669={};_0x5eb669[_0x4fe3c6]={'$like':'%'+_0x4d4d95[_0x9a24('0x32')]['filter']+'%'};return _0x5eb669;})});}_0x1a09f1=_[_0x9a24('0x3d')]({},_0x1a09f1,_0x4d4d95[_0x9a24('0x47')]);return _0x511904[_0x9a24('0x8a')](_0x1a09f1);}})[_0x9a24('0x22')](function(_0x94a4b4){if(_0x94a4b4){_0x14f46c=_0x94a4b4['length'];if(!_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x1a09f1[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x4d4d95[_0x9a24('0x32')]['limit']);_0x1a09f1['offset']=qs['offset'](_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x1c')]);}return _0x511904['getBlackLists'](_0x1a09f1);}})['then'](function(_0x1df19d){if(_0x1df19d){return _0x1df19d?{'count':_0x14f46c,'rows':_0x1df19d}:null;}})['then'](respondWithResult(_0x27f57a,null))['catch'](handleError(_0x27f57a,null));};exports[_0x9a24('0x8b')]=function(_0x367a33,_0xb76f8c,_0x15b2bc){var _0x261e8e,_0x481c99;var _0xca1c3b=[];var _0x207b8a=moment()[_0x9a24('0x60')](_0x9a24('0x61'));return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0x367a33[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0xb76f8c,null))[_0x9a24('0x22')](function(_0x102ddb){if(_0x102ddb){_0x481c99=_0x102ddb;return _0x102ddb[_0x9a24('0x8b')](_0x367a33['body'][_0x9a24('0x63')],_[_0x9a24('0x51')](_0x367a33[_0x9a24('0x4a')],[_0x9a24('0x63'),'id'])||{});}return null;})[_0x9a24('0x8c')](function(_0x3ca726){var _0xcca833;var _0x2e93a5;_0x261e8e=_0x3ca726||[];var _0x1446fd=[];if(_0x3ca726){for(var _0x43d418=0x0;_0x43d418<_0x3ca726[_0x9a24('0x38')];_0x43d418+=0x1){var _0x50be1d=_0x3ca726[_0x43d418][_0x9a24('0x24')]({'plain':!![]});_0xcca833=squel[_0x9a24('0x7b')]()['into'](_0x9a24('0x8d'))['fromQuery']([_0x9a24('0x68'),_0x9a24('0x6e'),_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel['select']()['field'](_0x9a24('0x68'),_0x9a24('0x68'))[_0x9a24('0x6c')]('id',_0x9a24('0x6e'))[_0x9a24('0x6c')](_0x50be1d[_0x9a24('0x7d')][_0x9a24('0x6f')](),'ListId')[_0x9a24('0x6c')](_0x367a33['params']['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))[_0x9a24('0x6c')]('NOW()','createdAt')['field'](_0x9a24('0x6d'),_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x50be1d['CmListId'][_0x9a24('0x6f')]())[_0x9a24('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x9a24('0x6f')]();_0x1446fd[_0x9a24('0x86')](db['sequelize'][_0x9a24('0x32')](_0xcca833));}return BPromise[_0x9a24('0x88')](_0x1446fd);}})[_0x9a24('0x22')](function(){return _0x261e8e;})[_0x9a24('0x22')](respondWithResult(_0xb76f8c,null))[_0x9a24('0x44')](handleError(_0xb76f8c,null));};exports[_0x9a24('0x8e')]=function(_0x3da758,_0x55c1f1,_0x54e9aa){return db['Campaign']['find']({'where':{'id':_0x3da758[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x55c1f1,null))['then'](function(_0x3cfe34){if(_0x3cfe34){return _0x3cfe34[_0x9a24('0x8e')](_0x3da758[_0x9a24('0x32')][_0x9a24('0x63')]);}})[_0x9a24('0x22')](function(_0x2a1135){if(_0x2a1135){return db[_0x9a24('0x5d')][_0x9a24('0x23')]({'where':{'ListId':_0x3da758['query'][_0x9a24('0x63')],'CampaignId':_0x3da758[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](function(){return _0x2a1135;});}})[_0x9a24('0x22')](respondWithStatusCode(_0x55c1f1,null))[_0x9a24('0x44')](handleError(_0x55c1f1,null));}; \ No newline at end of file +var _0x20df=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','destroy','then','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','Campaign','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','user','userProfileId','autoAssociation','update','getHoppers','CmHopper','CampaignId','rows','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','NOW()','ListId\x20=\x20?','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x20df,0x7c));var _0xf20d=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x20df[_0x59befa];return _0x1dd63d;};'use strict';var emlformat=require(_0xf20d('0x0'));var rimraf=require(_0xf20d('0x1'));var zipdir=require(_0xf20d('0x2'));var jsonpatch=require(_0xf20d('0x3'));var rp=require('request-promise');var moment=require(_0xf20d('0x4'));var BPromise=require(_0xf20d('0x5'));var Mustache=require(_0xf20d('0x6'));var util=require(_0xf20d('0x7'));var path=require(_0xf20d('0x8'));var sox=require('sox');var csv=require(_0xf20d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf20d('0xa'));var _=require(_0xf20d('0xb'));var squel=require('squel');var crypto=require(_0xf20d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf20d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf20d('0xe'));var Papa=require(_0xf20d('0xf'));var Redis=require(_0xf20d('0x10'));var authService=require(_0xf20d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf20d('0x12'));var hardwareService=require(_0xf20d('0x13'));var logger=require(_0xf20d('0x14'))(_0xf20d('0x15'));var utils=require(_0xf20d('0x16'));var config=require(_0xf20d('0x17'));var licenseUtil=require(_0xf20d('0x18'));var db=require(_0xf20d('0x19'))['db'];function respondWithStatusCode(_0x5457a3,_0x2fa3f6){_0x2fa3f6=_0x2fa3f6||0xcc;return function(_0x5126e0){if(_0x5126e0){return _0x5457a3[_0xf20d('0x1a')](_0x2fa3f6);}return _0x5457a3[_0xf20d('0x1b')](_0x2fa3f6)['end']();};}function respondWithResult(_0x1dce9d,_0x2e3cf2){_0x2e3cf2=_0x2e3cf2||0xc8;return function(_0x41fc44){if(_0x41fc44){return _0x1dce9d[_0xf20d('0x1b')](_0x2e3cf2)[_0xf20d('0x1c')](_0x41fc44);}};}function respondWithFilteredResult(_0x5c2ff0,_0x5d4244){return function(_0x3a4563){if(_0x3a4563){var _0xcd434c=typeof _0x5d4244[_0xf20d('0x1d')]===_0xf20d('0x1e')&&typeof _0x5d4244['limit']===_0xf20d('0x1e');var _0x4d3bfc=_0x3a4563[_0xf20d('0x1f')];var _0x5322ba=_0xcd434c?0x0:_0x5d4244['offset'];var _0x4b91bc=_0xcd434c?_0x3a4563[_0xf20d('0x1f')]:_0x5d4244[_0xf20d('0x1d')]+_0x5d4244[_0xf20d('0x20')];var _0x2483c4;if(_0x4b91bc>=_0x4d3bfc){_0x4b91bc=_0x4d3bfc;_0x2483c4=0xc8;}else{_0x2483c4=0xce;}_0x5c2ff0[_0xf20d('0x1b')](_0x2483c4);return _0x5c2ff0['set'](_0xf20d('0x21'),_0x5322ba+'-'+_0x4b91bc+'/'+_0x4d3bfc)['json'](_0x3a4563);}return null;};}function patchUpdates(_0x41b8c8){return function(_0x500bc9){try{jsonpatch[_0xf20d('0x22')](_0x500bc9,_0x41b8c8,!![]);}catch(_0x40e359){return BPromise['reject'](_0x40e359);}return _0x500bc9['save']();};}function saveUpdates(_0x3679cc,_0x1f9a62){return function(_0x37e292){if(_0x37e292){return _0x37e292['update'](_0x3679cc)['then'](function(_0x2a8d7e){return _0x2a8d7e;});}return null;};}function removeEntity(_0x96628b,_0x37b480){return function(_0x419b19){if(_0x419b19){return _0x419b19[_0xf20d('0x23')]()[_0xf20d('0x24')](function(){var _0x5a9385=_0x419b19[_0xf20d('0x25')]({'plain':!![]});var _0x486104='IvrCampaigns';return db[_0xf20d('0x26')][_0xf20d('0x23')]({'where':{'type':_0x486104,'resourceId':_0x5a9385['id']}})[_0xf20d('0x24')](function(){return _0x419b19;});})['then'](function(){_0x96628b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41378f,_0x2784ec){return function(_0x2acb21){if(!_0x2acb21){_0x41378f['sendStatus'](0x194);}return _0x2acb21;};}function handleError(_0x191c70,_0x993a3b){_0x993a3b=_0x993a3b||0x1f4;return function(_0x1dfda0){logger[_0xf20d('0x27')](_0x1dfda0[_0xf20d('0x28')]);if(_0x1dfda0[_0xf20d('0x29')]){delete _0x1dfda0[_0xf20d('0x29')];}_0x191c70['status'](_0x993a3b)['send'](_0x1dfda0);};}exports[_0xf20d('0x2a')]=function(_0x3f9451,_0x5ca630){var _0x39468d={},_0x24ca8f={},_0x422944={'count':0x0,'rows':[]};var _0x1f99b0=_[_0xf20d('0x2b')](db['Campaign']['rawAttributes'],function(_0x4aa75d){return{'name':_0x4aa75d[_0xf20d('0x2c')],'type':_0x4aa75d['type'][_0xf20d('0x2d')]};});_0x24ca8f[_0xf20d('0x2e')]=_[_0xf20d('0x2b')](_0x1f99b0,_0xf20d('0x29'));_0x24ca8f['query']=_[_0xf20d('0x2f')](_0x3f9451[_0xf20d('0x30')]);_0x24ca8f[_0xf20d('0x31')]=_[_0xf20d('0x32')](_0x24ca8f[_0xf20d('0x2e')],_0x24ca8f[_0xf20d('0x30')]);_0x39468d[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0x24ca8f[_0xf20d('0x2e')],qs['fields'](_0x3f9451[_0xf20d('0x30')][_0xf20d('0x34')]));_0x39468d[_0xf20d('0x33')]=_0x39468d[_0xf20d('0x33')]['length']?_0x39468d[_0xf20d('0x33')]:_0x24ca8f[_0xf20d('0x2e')];if(!_0x3f9451[_0xf20d('0x30')][_0xf20d('0x35')](_0xf20d('0x36'))){_0x39468d[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x3f9451[_0xf20d('0x30')][_0xf20d('0x20')]);_0x39468d[_0xf20d('0x1d')]=qs['offset'](_0x3f9451[_0xf20d('0x30')]['offset']);}_0x39468d[_0xf20d('0x37')]=qs[_0xf20d('0x38')](_0x3f9451[_0xf20d('0x30')][_0xf20d('0x38')]);_0x39468d[_0xf20d('0x39')]=qs[_0xf20d('0x31')](_[_0xf20d('0x3a')](_0x3f9451['query'],_0x24ca8f['filters']),_0x1f99b0);if(_0x3f9451[_0xf20d('0x30')][_0xf20d('0x3b')]){_0x39468d['where']=_['merge'](_0x39468d[_0xf20d('0x39')],{'$or':_[_0xf20d('0x2b')](_0x1f99b0,function(_0x568d36){if(_0x568d36[_0xf20d('0x3c')]!=='VIRTUAL'){var _0x176641={};_0x176641[_0x568d36[_0xf20d('0x29')]]={'$like':'%'+_0x3f9451['query'][_0xf20d('0x3b')]+'%'};return _0x176641;}})});}_0x39468d=_[_0xf20d('0x3d')]({},_0x39468d,_0x3f9451[_0xf20d('0x3e')]);var _0x2f9fa3={'where':_0x39468d[_0xf20d('0x39')]};return db['Campaign'][_0xf20d('0x1f')](_0x2f9fa3)['then'](function(_0x5761da){_0x422944[_0xf20d('0x1f')]=_0x5761da;if(_0x3f9451[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x39468d[_0xf20d('0x40')]=[{'all':!![]}];}return db[_0xf20d('0x41')]['findAll'](_0x39468d);})[_0xf20d('0x24')](function(_0x5319ca){_0x422944['rows']=_0x5319ca;return _0x422944;})[_0xf20d('0x24')](respondWithFilteredResult(_0x5ca630,_0x39468d))[_0xf20d('0x42')](handleError(_0x5ca630,null));};exports[_0xf20d('0x43')]=function(_0x45cb52,_0x187637){var _0x467426={'raw':![],'where':{'id':_0x45cb52[_0xf20d('0x44')]['id']}},_0x3e1e5f={};_0x3e1e5f[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](db[_0xf20d('0x41')][_0xf20d('0x45')]);_0x3e1e5f['query']=_['keys'](_0x45cb52[_0xf20d('0x30')]);_0x3e1e5f['filters']=_[_0xf20d('0x32')](_0x3e1e5f[_0xf20d('0x2e')],_0x3e1e5f[_0xf20d('0x30')]);_0x467426[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0x3e1e5f['model'],qs[_0xf20d('0x34')](_0x45cb52[_0xf20d('0x30')]['fields']));_0x467426[_0xf20d('0x33')]=_0x467426[_0xf20d('0x33')]['length']?_0x467426[_0xf20d('0x33')]:_0x3e1e5f[_0xf20d('0x2e')];if(_0x45cb52[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x467426[_0xf20d('0x40')]=[{'all':!![]}];}_0x467426=_[_0xf20d('0x3d')]({},_0x467426,_0x45cb52[_0xf20d('0x3e')]);return db[_0xf20d('0x41')][_0xf20d('0x46')](_0x467426)[_0xf20d('0x24')](handleEntityNotFound(_0x187637,null))[_0xf20d('0x24')](respondWithResult(_0x187637,null))['catch'](handleError(_0x187637,null));};exports[_0xf20d('0x47')]=function(_0x5ddbb9,_0x4fe574){return db[_0xf20d('0x41')]['create'](_0x5ddbb9[_0xf20d('0x48')],{})['then'](function(_0x5203c8){var _0x2689d3=_0x5ddbb9['user'][_0xf20d('0x25')]({'plain':!![]});if(!_0x2689d3)throw new Error(_0xf20d('0x49'));if(_0x2689d3[_0xf20d('0x4a')]==='user'){var _0x5a79f4=_0x5203c8[_0xf20d('0x25')]({'plain':!![]});var _0xe29d2a=_0xf20d('0x4b');return db[_0xf20d('0x4c')][_0xf20d('0x46')]({'where':{'name':_0xe29d2a,'userProfileId':_0x2689d3['userProfileId']},'raw':!![]})[_0xf20d('0x24')](function(_0x36101d){if(_0x36101d&&_0x36101d['autoAssociation']===0x0){return db['UserProfileResource'][_0xf20d('0x47')]({'name':_0x5a79f4['name'],'resourceId':_0x5a79f4['id'],'type':_0x36101d['name'],'sectionId':_0x36101d['id']},{})[_0xf20d('0x24')](function(){return _0x5203c8;});}else{return _0x5203c8;}})['catch'](function(_0x530ffc){logger[_0xf20d('0x27')](_0xf20d('0x4d'),_0x530ffc);throw _0x530ffc;});}return _0x5203c8;})[_0xf20d('0x24')](respondWithResult(_0x4fe574,0xc9))[_0xf20d('0x42')](handleError(_0x4fe574,null));};exports[_0xf20d('0x4e')]=function(_0x2aaa10,_0x472346){var _0x3f46b7={'where':{'id':_0x2aaa10['params']['id']}},_0xdc19d7={};_0xdc19d7[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](db[_0xf20d('0x41')]['rawAttributes']);_0x3f46b7[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0xdc19d7['model'],qs[_0xf20d('0x34')](_0x2aaa10[_0xf20d('0x30')]['fields']));_0x3f46b7['attributes']=_0x3f46b7[_0xf20d('0x33')][_0xf20d('0x4f')]?_0x3f46b7[_0xf20d('0x33')]:_0xdc19d7[_0xf20d('0x2e')];if(_0x2aaa10[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x3f46b7['include']=[{'all':!![]}];}_0x3f46b7=_[_0xf20d('0x3d')]({},_0x3f46b7,_0x2aaa10['options']);return db['Campaign'][_0xf20d('0x46')](_0x3f46b7)[_0xf20d('0x24')](handleEntityNotFound(_0x472346,null))[_0xf20d('0x24')](function(_0x3e7b50){if(_0x3e7b50){var _0x197d42=_0x3e7b50['get']({'plain':!![]});_0x197d42=qs[_0xf20d('0x50')](_0x197d42,['id',_0xf20d('0x51'),_0xf20d('0x52')]);_0x2aaa10[_0xf20d('0x48')]=_[_0xf20d('0x50')](_0x2aaa10[_0xf20d('0x48')],['id',_0xf20d('0x51'),_0xf20d('0x52')]);return db[_0xf20d('0x41')][_0xf20d('0x47')](_['merge'](_0x197d42,_0x2aaa10['body']),{'include':_0x2aaa10[_0xf20d('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x84f1a2){var _0x2c855c=_0x2aaa10['user'][_0xf20d('0x25')]({'plain':!![]});if(!_0x2c855c)throw new Error(_0xf20d('0x49'));if(_0x2c855c['role']===_0xf20d('0x53')){var _0x30f28a=_0x84f1a2[_0xf20d('0x25')]({'plain':!![]});var _0x4ce0e7=_0xf20d('0x4b');return db[_0xf20d('0x4c')][_0xf20d('0x46')]({'where':{'name':_0x4ce0e7,'userProfileId':_0x2c855c[_0xf20d('0x54')]},'raw':!![]})[_0xf20d('0x24')](function(_0x28e947){if(_0x28e947&&_0x28e947[_0xf20d('0x55')]===0x0){return db[_0xf20d('0x26')][_0xf20d('0x47')]({'name':_0x30f28a[_0xf20d('0x29')],'resourceId':_0x30f28a['id'],'type':_0x28e947[_0xf20d('0x29')],'sectionId':_0x28e947['id']},{})[_0xf20d('0x24')](function(){return _0x84f1a2;});}else{return _0x84f1a2;}})[_0xf20d('0x42')](function(_0x45077e){logger[_0xf20d('0x27')](_0xf20d('0x4d'),_0x45077e);throw _0x45077e;});}return _0x84f1a2;});}})[_0xf20d('0x24')](respondWithResult(_0x472346,0xc9))['catch'](handleError(_0x472346,null));};exports[_0xf20d('0x56')]=function(_0x256069,_0x186a13){if(_0x256069['body']['id']){delete _0x256069[_0xf20d('0x48')]['id'];}return db[_0xf20d('0x41')][_0xf20d('0x46')]({'where':{'id':_0x256069['params']['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x186a13,null))[_0xf20d('0x24')](saveUpdates(_0x256069[_0xf20d('0x48')],null))['then'](respondWithResult(_0x186a13,null))[_0xf20d('0x42')](handleError(_0x186a13,null));};exports[_0xf20d('0x23')]=function(_0x3c049e,_0x5d9478){return db['Campaign']['find']({'where':{'id':_0x3c049e[_0xf20d('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d9478,null))[_0xf20d('0x24')](removeEntity(_0x5d9478,null))[_0xf20d('0x42')](handleError(_0x5d9478,null));};exports[_0xf20d('0x57')]=function(_0x3fa7e9,_0x2d14c4,_0x598d78){var _0x463d1a={'raw':!![],'where':{}};var _0x717cfe={};var _0x5e4058={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3fa7e9[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x2d14c4,null))[_0xf20d('0x24')](function(_0x58952e){if(_0x58952e){_0x717cfe[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](db[_0xf20d('0x58')]['rawAttributes']);_0x717cfe[_0xf20d('0x30')]=_[_0xf20d('0x2f')](_0x3fa7e9['query']);_0x717cfe[_0xf20d('0x31')]=_['intersection'](_0x717cfe[_0xf20d('0x2e')],_0x717cfe[_0xf20d('0x30')]);_0x463d1a['attributes']=_[_0xf20d('0x32')](_0x717cfe[_0xf20d('0x2e')],qs[_0xf20d('0x34')](_0x3fa7e9[_0xf20d('0x30')]['fields']));_0x463d1a[_0xf20d('0x33')]=_0x463d1a[_0xf20d('0x33')]['length']?_0x463d1a[_0xf20d('0x33')]:_0x717cfe['model'];if(!_0x3fa7e9[_0xf20d('0x30')][_0xf20d('0x35')]('nolimit')){_0x463d1a[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x3fa7e9[_0xf20d('0x30')][_0xf20d('0x20')]);_0x463d1a[_0xf20d('0x1d')]=qs[_0xf20d('0x1d')](_0x3fa7e9[_0xf20d('0x30')][_0xf20d('0x1d')]);}_0x463d1a[_0xf20d('0x37')]=qs[_0xf20d('0x38')](_0x3fa7e9['query'][_0xf20d('0x38')]);_0x463d1a[_0xf20d('0x39')]=qs[_0xf20d('0x31')](_['pick'](_0x3fa7e9[_0xf20d('0x30')],_0x717cfe[_0xf20d('0x31')]));_0x463d1a[_0xf20d('0x39')][_0xf20d('0x59')]=_0x58952e['id'];if(_0x3fa7e9['query'][_0xf20d('0x3b')]){_0x463d1a[_0xf20d('0x39')]=_[_0xf20d('0x3d')](_0x463d1a['where'],{'$or':_[_0xf20d('0x2b')](_0x463d1a[_0xf20d('0x33')],function(_0x3f43e6){var _0x1a708b={};_0x1a708b[_0x3f43e6]={'$like':'%'+_0x3fa7e9[_0xf20d('0x30')][_0xf20d('0x3b')]+'%'};return _0x1a708b;})});}_0x463d1a=_[_0xf20d('0x3d')]({},_0x463d1a,_0x3fa7e9[_0xf20d('0x3e')]);return db['CmHopper'][_0xf20d('0x1f')]({'where':_0x463d1a['where']})[_0xf20d('0x24')](function(_0x3cb325){_0x5e4058[_0xf20d('0x1f')]=_0x3cb325;if(_0x3fa7e9[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x463d1a[_0xf20d('0x40')]=[{'all':!![]}];}return db[_0xf20d('0x58')]['findAll'](_0x463d1a);})[_0xf20d('0x24')](function(_0x1a60a9){_0x5e4058[_0xf20d('0x5a')]=_0x1a60a9;return _0x5e4058;});}})[_0xf20d('0x24')](respondWithFilteredResult(_0x2d14c4,_0x463d1a))['catch'](handleError(_0x2d14c4,null));};exports[_0xf20d('0x5b')]=function(_0x3d3b96,_0x2614ec,_0x51f2cc){var _0x38fb82={'raw':!![],'where':{}};var _0x5d18de={};var _0x25b01e={'count':0x0,'rows':[]};return db[_0xf20d('0x41')][_0xf20d('0x5c')]({'where':{'id':_0x3d3b96['params']['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x2614ec,null))['then'](function(_0x229013){if(_0x229013){_0x5d18de['model']=_[_0xf20d('0x2f')](db[_0xf20d('0x5d')]['rawAttributes']);_0x5d18de[_0xf20d('0x30')]=_[_0xf20d('0x2f')](_0x3d3b96['query']);_0x5d18de[_0xf20d('0x31')]=_[_0xf20d('0x32')](_0x5d18de[_0xf20d('0x2e')],_0x5d18de['query']);_0x38fb82[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0x5d18de[_0xf20d('0x2e')],qs[_0xf20d('0x34')](_0x3d3b96[_0xf20d('0x30')][_0xf20d('0x34')]));_0x38fb82[_0xf20d('0x33')]=_0x38fb82[_0xf20d('0x33')]['length']?_0x38fb82[_0xf20d('0x33')]:_0x5d18de[_0xf20d('0x2e')];if(!_0x3d3b96[_0xf20d('0x30')]['hasOwnProperty'](_0xf20d('0x36'))){_0x38fb82[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x3d3b96[_0xf20d('0x30')][_0xf20d('0x20')]);_0x38fb82[_0xf20d('0x1d')]=qs[_0xf20d('0x1d')](_0x3d3b96['query'][_0xf20d('0x1d')]);}_0x38fb82['order']=qs[_0xf20d('0x38')](_0x3d3b96[_0xf20d('0x30')][_0xf20d('0x38')]);_0x38fb82[_0xf20d('0x39')]=qs[_0xf20d('0x31')](_[_0xf20d('0x3a')](_0x3d3b96[_0xf20d('0x30')],_0x5d18de['filters']));_0x38fb82['where']['CampaignId']=_0x229013['id'];if(_0x3d3b96['query'][_0xf20d('0x3b')]){_0x38fb82[_0xf20d('0x39')]=_[_0xf20d('0x3d')](_0x38fb82[_0xf20d('0x39')],{'$or':_[_0xf20d('0x2b')](_0x38fb82[_0xf20d('0x33')],function(_0x2e14f1){var _0x2d7b7d={};_0x2d7b7d[_0x2e14f1]={'$like':'%'+_0x3d3b96[_0xf20d('0x30')][_0xf20d('0x3b')]+'%'};return _0x2d7b7d;})});}_0x38fb82=_[_0xf20d('0x3d')]({},_0x38fb82,_0x3d3b96['options']);return db[_0xf20d('0x5d')]['count']({'where':_0x38fb82[_0xf20d('0x39')]})[_0xf20d('0x24')](function(_0x571dab){_0x25b01e[_0xf20d('0x1f')]=_0x571dab;if(_0x3d3b96[_0xf20d('0x30')]['includeAll']){_0x38fb82[_0xf20d('0x40')]=[{'all':!![]}];}return db[_0xf20d('0x5d')][_0xf20d('0x5e')](_0x38fb82);})[_0xf20d('0x24')](function(_0x5d2c7d){_0x25b01e[_0xf20d('0x5a')]=_0x5d2c7d;return _0x25b01e;});}})[_0xf20d('0x24')](respondWithFilteredResult(_0x2614ec,_0x38fb82))[_0xf20d('0x42')](handleError(_0x2614ec,null));};exports[_0xf20d('0x5f')]=function(_0xbb3d4d,_0x31bc99,_0x36ba16){var _0x2e8559={'raw':!![],'where':{}};var _0x5168dd={};var _0x5a094f={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xbb3d4d[_0xf20d('0x44')]['id']}})['then'](handleEntityNotFound(_0x31bc99,null))[_0xf20d('0x24')](function(_0xf44464){if(_0xf44464){_0x5168dd['model']=_[_0xf20d('0x2f')](db[_0xf20d('0x60')][_0xf20d('0x45')]);_0x5168dd[_0xf20d('0x30')]=_[_0xf20d('0x2f')](_0xbb3d4d['query']);_0x5168dd[_0xf20d('0x31')]=_['intersection'](_0x5168dd['model'],_0x5168dd['query']);_0x2e8559[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0x5168dd[_0xf20d('0x2e')],qs[_0xf20d('0x34')](_0xbb3d4d['query'][_0xf20d('0x34')]));_0x2e8559[_0xf20d('0x33')]=_0x2e8559[_0xf20d('0x33')]['length']?_0x2e8559[_0xf20d('0x33')]:_0x5168dd['model'];if(!_0xbb3d4d['query'][_0xf20d('0x35')](_0xf20d('0x36'))){_0x2e8559[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0xbb3d4d['query'][_0xf20d('0x20')]);_0x2e8559[_0xf20d('0x1d')]=qs['offset'](_0xbb3d4d[_0xf20d('0x30')]['offset']);}_0x2e8559[_0xf20d('0x37')]=qs[_0xf20d('0x38')](_0xbb3d4d[_0xf20d('0x30')][_0xf20d('0x38')]);_0x2e8559[_0xf20d('0x39')]=qs['filters'](_[_0xf20d('0x3a')](_0xbb3d4d[_0xf20d('0x30')],_0x5168dd['filters']));_0x2e8559[_0xf20d('0x39')][_0xf20d('0x59')]=_0xf44464['id'];if(_0xbb3d4d['query']['filter']){_0x2e8559[_0xf20d('0x39')]=_[_0xf20d('0x3d')](_0x2e8559[_0xf20d('0x39')],{'$or':_[_0xf20d('0x2b')](_0x2e8559['attributes'],function(_0x2a31ac){var _0xe2200b={};_0xe2200b[_0x2a31ac]={'$like':'%'+_0xbb3d4d[_0xf20d('0x30')]['filter']+'%'};return _0xe2200b;})});}_0x2e8559=_['merge']({},_0x2e8559,_0xbb3d4d[_0xf20d('0x3e')]);return db[_0xf20d('0x60')][_0xf20d('0x1f')]({'where':_0x2e8559['where']})[_0xf20d('0x24')](function(_0x33b4df){_0x5a094f[_0xf20d('0x1f')]=_0x33b4df;if(_0xbb3d4d[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x2e8559[_0xf20d('0x40')]=[{'all':!![]}];}return db[_0xf20d('0x60')]['findAll'](_0x2e8559);})['then'](function(_0x165c4b){_0x5a094f[_0xf20d('0x5a')]=_0x165c4b;return _0x5a094f;});}})[_0xf20d('0x24')](respondWithFilteredResult(_0x31bc99,_0x2e8559))[_0xf20d('0x42')](handleError(_0x31bc99,null));};exports[_0xf20d('0x61')]=function(_0x43e01d,_0x4cef26,_0x1b2c46){var _0x3c3adc={'raw':!![],'where':{}};var _0x18c3e6={};var _0x2ab833={'count':0x0,'rows':[]};return db[_0xf20d('0x41')][_0xf20d('0x5c')]({'where':{'id':_0x43e01d[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x4cef26,null))[_0xf20d('0x24')](function(_0x24f2ee){if(_0x24f2ee){_0x18c3e6[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](db[_0xf20d('0x62')]['rawAttributes']);_0x18c3e6[_0xf20d('0x30')]=_[_0xf20d('0x2f')](_0x43e01d[_0xf20d('0x30')]);_0x18c3e6[_0xf20d('0x31')]=_[_0xf20d('0x32')](_0x18c3e6['model'],_0x18c3e6[_0xf20d('0x30')]);_0x3c3adc[_0xf20d('0x33')]=_['intersection'](_0x18c3e6[_0xf20d('0x2e')],qs[_0xf20d('0x34')](_0x43e01d[_0xf20d('0x30')]['fields']));_0x3c3adc[_0xf20d('0x33')]=_0x3c3adc[_0xf20d('0x33')][_0xf20d('0x4f')]?_0x3c3adc[_0xf20d('0x33')]:_0x18c3e6[_0xf20d('0x2e')];if(!_0x43e01d[_0xf20d('0x30')][_0xf20d('0x35')]('nolimit')){_0x3c3adc['limit']=qs[_0xf20d('0x20')](_0x43e01d['query']['limit']);_0x3c3adc['offset']=qs[_0xf20d('0x1d')](_0x43e01d[_0xf20d('0x30')][_0xf20d('0x1d')]);}_0x3c3adc['order']=qs[_0xf20d('0x38')](_0x43e01d[_0xf20d('0x30')][_0xf20d('0x38')]);_0x3c3adc[_0xf20d('0x39')]=qs[_0xf20d('0x31')](_[_0xf20d('0x3a')](_0x43e01d[_0xf20d('0x30')],_0x18c3e6[_0xf20d('0x31')]));_0x3c3adc[_0xf20d('0x39')][_0xf20d('0x59')]=_0x24f2ee['id'];if(_0x43e01d['query']['filter']){_0x3c3adc['where']=_[_0xf20d('0x3d')](_0x3c3adc['where'],{'$or':_['map'](_0x3c3adc['attributes'],function(_0xe19eac){var _0x3566b8={};_0x3566b8[_0xe19eac]={'$like':'%'+_0x43e01d['query']['filter']+'%'};return _0x3566b8;})});}_0x3c3adc=_[_0xf20d('0x3d')]({},_0x3c3adc,_0x43e01d[_0xf20d('0x3e')]);return db[_0xf20d('0x62')][_0xf20d('0x1f')]({'where':_0x3c3adc['where']})['then'](function(_0x2edce3){_0x2ab833[_0xf20d('0x1f')]=_0x2edce3;if(_0x43e01d[_0xf20d('0x30')][_0xf20d('0x3f')]){_0x3c3adc[_0xf20d('0x40')]=[{'all':!![]}];}return db[_0xf20d('0x62')]['findAll'](_0x3c3adc);})[_0xf20d('0x24')](function(_0x2a85d4){_0x2ab833[_0xf20d('0x5a')]=_0x2a85d4;return _0x2ab833;});}})[_0xf20d('0x24')](respondWithFilteredResult(_0x4cef26,_0x3c3adc))[_0xf20d('0x42')](handleError(_0x4cef26,null));};exports[_0xf20d('0x63')]=function(_0x326b84,_0x13ee5b,_0x37293e){var _0x327387={};var _0x1d0d9c={};var _0x1c626d;var _0x54b4c1;return db[_0xf20d('0x41')][_0xf20d('0x5c')]({'where':{'id':_0x326b84[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x13ee5b,null))[_0xf20d('0x24')](function(_0x2fb2e3){if(_0x2fb2e3){_0x1c626d=_0x2fb2e3;_0x1d0d9c[_0xf20d('0x2e')]=_['keys'](db[_0xf20d('0x64')][_0xf20d('0x45')]);_0x1d0d9c[_0xf20d('0x30')]=_[_0xf20d('0x2f')](_0x326b84['query']);_0x1d0d9c[_0xf20d('0x31')]=_[_0xf20d('0x32')](_0x1d0d9c[_0xf20d('0x2e')],_0x1d0d9c[_0xf20d('0x30')]);_0x327387['attributes']=_[_0xf20d('0x32')](_0x1d0d9c['model'],qs[_0xf20d('0x34')](_0x326b84[_0xf20d('0x30')][_0xf20d('0x34')]));_0x327387[_0xf20d('0x33')]=_0x327387['attributes'][_0xf20d('0x4f')]?_0x327387[_0xf20d('0x33')]:_0x1d0d9c[_0xf20d('0x2e')];_0x327387['order']=qs['sort'](_0x326b84['query'][_0xf20d('0x38')]);_0x327387[_0xf20d('0x39')]=qs[_0xf20d('0x31')](_[_0xf20d('0x3a')](_0x326b84[_0xf20d('0x30')],_0x1d0d9c['filters']));if(_0x326b84[_0xf20d('0x30')]['filter']){_0x327387[_0xf20d('0x39')]=_['merge'](_0x327387['where'],{'$or':_['map'](_0x327387[_0xf20d('0x33')],function(_0x352a0d){var _0x416c59={};_0x416c59[_0x352a0d]={'$like':'%'+_0x326b84[_0xf20d('0x30')]['filter']+'%'};return _0x416c59;})});}_0x327387=_['merge']({},_0x327387,_0x326b84[_0xf20d('0x3e')]);return _0x1c626d['getLists'](_0x327387);}})[_0xf20d('0x24')](function(_0x2a7667){if(_0x2a7667){_0x54b4c1=_0x2a7667[_0xf20d('0x4f')];if(!_0x326b84['query']['hasOwnProperty'](_0xf20d('0x36'))){_0x327387[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x326b84[_0xf20d('0x30')][_0xf20d('0x20')]);_0x327387[_0xf20d('0x1d')]=qs[_0xf20d('0x1d')](_0x326b84[_0xf20d('0x30')]['offset']);}return _0x1c626d['getLists'](_0x327387);}})[_0xf20d('0x24')](function(_0x12e3c5){if(_0x12e3c5){return _0x12e3c5?{'count':_0x54b4c1,'rows':_0x12e3c5}:null;}})[_0xf20d('0x24')](respondWithResult(_0x13ee5b,null))[_0xf20d('0x42')](handleError(_0x13ee5b,null));};exports[_0xf20d('0x65')]=function(_0x572a2c,_0x1d863e,_0x3cbc09){var _0x4436de,_0x5cf023;var _0x14a133=[];var _0x5e591f=moment()[_0xf20d('0x66')](_0xf20d('0x67'));return db[_0xf20d('0x41')][_0xf20d('0x46')]({'where':{'id':_0x572a2c[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x1d863e,null))[_0xf20d('0x24')](function(_0x32ef02){if(_0x32ef02){_0x5cf023=_0x32ef02;return _0x32ef02['addLists'](_0x572a2c[_0xf20d('0x48')]['ids'],_[_0xf20d('0x50')](_0x572a2c['body'],[_0xf20d('0x68'),'id'])||{});}return null;})[_0xf20d('0x69')](function(_0x5c9963){var _0x49e347;var _0x4a9ce4;_0x4436de=_0x5c9963||[];var _0x58c510=[];if(_0x5c9963){for(var _0x5098f3=0x0;_0x5098f3<_0x5c9963['length'];_0x5098f3+=0x1){var _0x7a998=_0x5c9963[_0x5098f3][_0xf20d('0x25')]({'plain':!![]});_0x5cf023[_0xf20d('0x6a')]=_0x572a2c[_0xf20d('0x48')][_0xf20d('0x6a')]?_0x572a2c[_0xf20d('0x48')]['dialCheckDuplicateType']:_0x5cf023[_0xf20d('0x6a')];switch(_0x5cf023[_0xf20d('0x6a')]){case'always':_0x49e347=squel[_0xf20d('0x6b')]()[_0xf20d('0x6c')](_0xf20d('0x6d'))['fromQuery']([_0xf20d('0x6e'),_0xf20d('0x6f'),_0xf20d('0x70'),_0xf20d('0x71'),_0xf20d('0x59'),'createdAt','updatedAt'],squel[_0xf20d('0x72')]()[_0xf20d('0x73')]('phone','phone')[_0xf20d('0x73')]('NOW()',_0xf20d('0x6f'))[_0xf20d('0x73')]('id',_0xf20d('0x70'))[_0xf20d('0x73')](_0x7a998[_0xf20d('0x74')][_0xf20d('0x75')](),_0xf20d('0x71'))[_0xf20d('0x73')](_0x572a2c[_0xf20d('0x44')]['id'][_0xf20d('0x75')](),_0xf20d('0x59'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x51'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x52'))[_0xf20d('0x76')](_0xf20d('0x77'))['where'](_0xf20d('0x78'))[_0xf20d('0x39')]('ListId\x20=\x20?',_0x7a998[_0xf20d('0x74')][_0xf20d('0x75')]())['where'](_0xf20d('0x79'))['where'](_0xf20d('0x7a'),squel['select']()[_0xf20d('0x73')](_0xf20d('0x7b'))[_0xf20d('0x76')]('cm_hopper_final')[_0xf20d('0x39')]('CampaignId\x20=\x20?',_0x572a2c[_0xf20d('0x44')]['id']['toString']()))[_0xf20d('0x39')](_0xf20d('0x7a'),squel[_0xf20d('0x72')]()[_0xf20d('0x73')](_0xf20d('0x7c'))[_0xf20d('0x76')](_0xf20d('0x6d'))[_0xf20d('0x39')]('CampaignId\x20=\x20?',_0x572a2c[_0xf20d('0x44')]['id'][_0xf20d('0x75')]())))[_0xf20d('0x75')]();break;case _0xf20d('0x7d'):_0x49e347=squel[_0xf20d('0x6b')]()['into'](_0xf20d('0x6d'))[_0xf20d('0x7e')]([_0xf20d('0x6e'),_0xf20d('0x6f'),_0xf20d('0x70'),_0xf20d('0x71'),'CampaignId','createdAt','updatedAt'],squel[_0xf20d('0x72')]()['field']('phone',_0xf20d('0x6e'))[_0xf20d('0x73')](_0xf20d('0x7f'),'scheduledAt')[_0xf20d('0x73')]('id',_0xf20d('0x70'))['field'](_0x7a998[_0xf20d('0x74')][_0xf20d('0x75')](),_0xf20d('0x71'))[_0xf20d('0x73')](_0x572a2c['params']['id'][_0xf20d('0x75')](),_0xf20d('0x59'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x51'))[_0xf20d('0x73')]('\x27'+_0x5e591f+'\x27',_0xf20d('0x52'))['from']('cm_contacts')['where'](_0xf20d('0x78'))[_0xf20d('0x39')](_0xf20d('0x80'),_0x7a998[_0xf20d('0x74')][_0xf20d('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf20d('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf20d('0x72')]()[_0xf20d('0x73')](_0xf20d('0x7c'))['from'](_0xf20d('0x6d'))[_0xf20d('0x39')]('CampaignId\x20=\x20?',_0x572a2c[_0xf20d('0x44')]['id'][_0xf20d('0x75')]())))[_0xf20d('0x75')]();break;default:_0x49e347=squel[_0xf20d('0x6b')]()[_0xf20d('0x6c')](_0xf20d('0x6d'))[_0xf20d('0x7e')]([_0xf20d('0x6e'),_0xf20d('0x6f'),_0xf20d('0x70'),_0xf20d('0x71'),_0xf20d('0x59'),_0xf20d('0x51'),'updatedAt'],squel[_0xf20d('0x72')]()['field']('phone',_0xf20d('0x6e'))[_0xf20d('0x73')](_0xf20d('0x7f'),_0xf20d('0x6f'))[_0xf20d('0x73')]('id',_0xf20d('0x70'))[_0xf20d('0x73')](_0x7a998['CmListId'][_0xf20d('0x75')](),_0xf20d('0x71'))[_0xf20d('0x73')](_0x572a2c[_0xf20d('0x44')]['id'][_0xf20d('0x75')](),_0xf20d('0x59'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x51'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x52'))[_0xf20d('0x76')]('cm_contacts')[_0xf20d('0x39')](_0xf20d('0x78'))[_0xf20d('0x39')](_0xf20d('0x80'),_0x7a998['CmListId'][_0xf20d('0x75')]())[_0xf20d('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xf20d('0x75')]();}_0x4a9ce4=squel[_0xf20d('0x6b')]()[_0xf20d('0x6c')]('cm_hopper_additional_phones')[_0xf20d('0x7e')](['cmHopperId','scheduledAt',_0xf20d('0x6e'),'OrderBy',_0xf20d('0x51'),_0xf20d('0x52')],squel[_0xf20d('0x72')]()[_0xf20d('0x73')]('h.id','id')['field'](_0xf20d('0x7f'),'scheduledAt')[_0xf20d('0x73')](_0xf20d('0x81'),'phone')[_0xf20d('0x73')](_0xf20d('0x82'),_0xf20d('0x83'))['field']('\x27'+_0x5e591f+'\x27',_0xf20d('0x51'))[_0xf20d('0x73')]('\x27'+_0x5e591f+'\x27',_0xf20d('0x52'))['from'](_0xf20d('0x84'),'ci')[_0xf20d('0x85')](_0xf20d('0x6d'),'h',_0xf20d('0x86'))[_0xf20d('0x39')](_0xf20d('0x87'),_0x7a998['CmListId'][_0xf20d('0x75')]())[_0xf20d('0x39')](_0xf20d('0x88'),_0x572a2c[_0xf20d('0x44')]['id']['toString']())[_0xf20d('0x39')](_0xf20d('0x89'),_0x5e591f))['toString']();_0x58c510[_0xf20d('0x8a')](db['sequelize'][_0xf20d('0x30')](_0x49e347));_0x14a133[_0xf20d('0x8a')](db[_0xf20d('0x8b')][_0xf20d('0x30')](_0x4a9ce4));}return BPromise[_0xf20d('0x8c')](_0x58c510);}})[_0xf20d('0x24')](function(){return BPromise[_0xf20d('0x8c')](_0x14a133);})[_0xf20d('0x24')](function(){return _0x4436de;})[_0xf20d('0x24')](respondWithResult(_0x1d863e,null))[_0xf20d('0x42')](handleError(_0x1d863e,null));};exports[_0xf20d('0x8d')]=function(_0x358638,_0x8c19d5,_0x1a9f53){return db[_0xf20d('0x41')][_0xf20d('0x46')]({'where':{'id':_0x358638[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x8c19d5,null))[_0xf20d('0x24')](function(_0x3fb9b7){if(_0x3fb9b7){return _0x3fb9b7[_0xf20d('0x8d')](_0x358638[_0xf20d('0x30')][_0xf20d('0x68')]);}})[_0xf20d('0x24')](function(_0x363959){if(_0x363959){return db[_0xf20d('0x58')]['destroy']({'where':{'ListId':_0x358638[_0xf20d('0x30')]['ids'],'CampaignId':_0x358638[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](function(){return _0x363959;});}})[_0xf20d('0x24')](respondWithStatusCode(_0x8c19d5,null))['catch'](handleError(_0x8c19d5,null));};exports[_0xf20d('0x8e')]=function(_0x5033b3,_0x5d5102,_0x3388ef){var _0x28a4f9={};var _0x366be5={};var _0x2c9ce4;var _0xc21753;return db[_0xf20d('0x41')][_0xf20d('0x5c')]({'where':{'id':_0x5033b3[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x5d5102,null))[_0xf20d('0x24')](function(_0x5a63dd){if(_0x5a63dd){_0x2c9ce4=_0x5a63dd;_0x366be5[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](db[_0xf20d('0x64')]['rawAttributes']);_0x366be5[_0xf20d('0x30')]=_['keys'](_0x5033b3[_0xf20d('0x30')]);_0x366be5[_0xf20d('0x31')]=_[_0xf20d('0x32')](_0x366be5[_0xf20d('0x2e')],_0x366be5['query']);_0x28a4f9[_0xf20d('0x33')]=_[_0xf20d('0x32')](_0x366be5[_0xf20d('0x2e')],qs[_0xf20d('0x34')](_0x5033b3['query'][_0xf20d('0x34')]));_0x28a4f9[_0xf20d('0x33')]=_0x28a4f9['attributes']['length']?_0x28a4f9['attributes']:_0x366be5['model'];_0x28a4f9[_0xf20d('0x37')]=qs[_0xf20d('0x38')](_0x5033b3[_0xf20d('0x30')][_0xf20d('0x38')]);_0x28a4f9['where']=qs[_0xf20d('0x31')](_[_0xf20d('0x3a')](_0x5033b3['query'],_0x366be5['filters']));if(_0x5033b3['query'][_0xf20d('0x3b')]){_0x28a4f9['where']=_[_0xf20d('0x3d')](_0x28a4f9['where'],{'$or':_[_0xf20d('0x2b')](_0x28a4f9[_0xf20d('0x33')],function(_0x1c8d12){var _0x377bbc={};_0x377bbc[_0x1c8d12]={'$like':'%'+_0x5033b3['query'][_0xf20d('0x3b')]+'%'};return _0x377bbc;})});}_0x28a4f9=_['merge']({},_0x28a4f9,_0x5033b3[_0xf20d('0x3e')]);return _0x2c9ce4['getBlackLists'](_0x28a4f9);}})['then'](function(_0x3b5f22){if(_0x3b5f22){_0xc21753=_0x3b5f22[_0xf20d('0x4f')];if(!_0x5033b3[_0xf20d('0x30')][_0xf20d('0x35')](_0xf20d('0x36'))){_0x28a4f9[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x5033b3[_0xf20d('0x30')][_0xf20d('0x20')]);_0x28a4f9[_0xf20d('0x1d')]=qs[_0xf20d('0x1d')](_0x5033b3['query'][_0xf20d('0x1d')]);}return _0x2c9ce4[_0xf20d('0x8e')](_0x28a4f9);}})[_0xf20d('0x24')](function(_0x7a5368){if(_0x7a5368){return _0x7a5368?{'count':_0xc21753,'rows':_0x7a5368}:null;}})[_0xf20d('0x24')](respondWithResult(_0x5d5102,null))[_0xf20d('0x42')](handleError(_0x5d5102,null));};exports[_0xf20d('0x8f')]=function(_0x3379af,_0x10450b,_0xb97634){var _0x3e8b68,_0x4ea1bf;var _0xfa3b9e=[];var _0x489333=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf20d('0x41')]['find']({'where':{'id':_0x3379af[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x10450b,null))[_0xf20d('0x24')](function(_0xd7b9c9){if(_0xd7b9c9){_0x4ea1bf=_0xd7b9c9;return _0xd7b9c9[_0xf20d('0x8f')](_0x3379af[_0xf20d('0x48')][_0xf20d('0x68')],_[_0xf20d('0x50')](_0x3379af['body'],[_0xf20d('0x68'),'id'])||{});}return null;})[_0xf20d('0x69')](function(_0x1a55e4){var _0x6810aa;var _0x1341a7;_0x3e8b68=_0x1a55e4||[];var _0x262f7f=[];if(_0x1a55e4){for(var _0x18a285=0x0;_0x18a285<_0x1a55e4[_0xf20d('0x4f')];_0x18a285+=0x1){var _0x3b91c1=_0x1a55e4[_0x18a285][_0xf20d('0x25')]({'plain':!![]});_0x6810aa=squel['insert']()['into'](_0xf20d('0x90'))[_0xf20d('0x7e')](['phone',_0xf20d('0x70'),_0xf20d('0x71'),_0xf20d('0x59'),'createdAt',_0xf20d('0x52')],squel['select']()[_0xf20d('0x73')](_0xf20d('0x6e'),'phone')[_0xf20d('0x73')]('id',_0xf20d('0x70'))['field'](_0x3b91c1['CmListId'][_0xf20d('0x75')](),_0xf20d('0x71'))['field'](_0x3379af[_0xf20d('0x44')]['id'][_0xf20d('0x75')](),_0xf20d('0x59'))[_0xf20d('0x73')](_0xf20d('0x7f'),_0xf20d('0x51'))[_0xf20d('0x73')](_0xf20d('0x7f'),_0xf20d('0x52'))[_0xf20d('0x76')](_0xf20d('0x77'))[_0xf20d('0x39')](_0xf20d('0x78'))[_0xf20d('0x39')](_0xf20d('0x80'),_0x3b91c1[_0xf20d('0x74')][_0xf20d('0x75')]())[_0xf20d('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xf20d('0x75')]();_0x262f7f[_0xf20d('0x8a')](db['sequelize']['query'](_0x6810aa));}return BPromise['all'](_0x262f7f);}})['then'](function(){return _0x3e8b68;})['then'](respondWithResult(_0x10450b,null))[_0xf20d('0x42')](handleError(_0x10450b,null));};exports[_0xf20d('0x91')]=function(_0x233bb5,_0x5e637e,_0x6be18b){return db[_0xf20d('0x41')][_0xf20d('0x46')]({'where':{'id':_0x233bb5[_0xf20d('0x44')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x5e637e,null))[_0xf20d('0x24')](function(_0x2083a1){if(_0x2083a1){return _0x2083a1['removeBlackLists'](_0x233bb5[_0xf20d('0x30')][_0xf20d('0x68')]);}})['then'](function(_0x58a142){if(_0x58a142){return db[_0xf20d('0x62')][_0xf20d('0x23')]({'where':{'ListId':_0x233bb5[_0xf20d('0x30')][_0xf20d('0x68')],'CampaignId':_0x233bb5[_0xf20d('0x44')]['id']}})['then'](function(){return _0x58a142;});}})[_0xf20d('0x24')](respondWithStatusCode(_0x5e637e,null))['catch'](handleError(_0x5e637e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 65aaace..30cf74a 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xb2e670,_0x436e56){var _0x598b6b=function(_0x5ecdd8){while(--_0x5ecdd8){_0xb2e670['push'](_0xb2e670['shift']());}};_0x598b6b(++_0x436e56);}(_0x7a54,0x106));var _0x47a5=function(_0x435db1,_0x125741){_0x435db1=_0x435db1-0x0;var _0x15f756=_0x7a54[_0x435db1];return _0x15f756;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c0c74e9..ff04aa5 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 _0x26bc=['message','result','catch','Campaign','findAll','options','raw','where','limit','include','model','map','attributes','GetCampaign','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26bc,0x162));var _0xc26b=function(_0xaf1fb8,_0x2c04c6){_0xaf1fb8=_0xaf1fb8-0x0;var _0x325c52=_0x26bc[_0xaf1fb8];return _0x325c52;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('Campaign,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});}exports['GetCampaign']=function(_0x4802c7){var _0x7e6ed0=this;return new Promise(function(_0x47e75b,_0x47104f){return db[_0xc26b('0x17')][_0xc26b('0x18')]({'raw':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1b')]||null:null,'attributes':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')]['attributes']||null:null,'limit':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1c')]||null:null,'include':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')]?_['map'](_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')],function(_0x176f29){return{'model':db[_0x176f29[_0xc26b('0x1e')]],'as':_0x176f29['as'],'attributes':_0x176f29['attributes'],'include':_0x176f29[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x176f29['include'],function(_0x4c0095){return{'model':db[_0x4c0095[_0xc26b('0x1e')]],'as':_0x4c0095['as'],'attributes':_0x4c0095[_0xc26b('0x20')],'include':_0x4c0095[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x4c0095[_0xc26b('0x1d')],function(_0x20a84f){return{'model':db[_0x20a84f['model']],'as':_0x20a84f['as'],'attributes':_0x20a84f[_0xc26b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e44e2){logger[_0xc26b('0xd')](_0xc26b('0x21'),_0x4802c7);logger['debug'](_0xc26b('0x21'),_0x4802c7,JSON[_0xc26b('0x11')](_0x3e44e2));_0x47e75b(_0x3e44e2);})[_0xc26b('0x16')](function(_0x1dd5d4){logger[_0xc26b('0x12')](_0xc26b('0x21'),_0x1dd5d4['message'],_0x4802c7);_0x47104f(_0x7e6ed0[_0xc26b('0x12')](0x1f4,_0x1dd5d4['message']));});});}; \ No newline at end of file +var _0x00b3=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCampaign','findAll','options','raw','where','attributes','limit','map','include','model','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1d7743,_0x2e45f4){var _0xc6663c=function(_0x95c054){while(--_0x95c054){_0x1d7743['push'](_0x1d7743['shift']());}};_0xc6663c(++_0x2e45f4);}(_0x00b3,0x17a));var _0x300b=function(_0x175d22,_0x538bd3){_0x175d22=_0x175d22-0x0;var _0x448b76=_0x00b3[_0x175d22];return _0x448b76;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});}exports[_0x300b('0x15')]=function(_0x4d2024){var _0x1fbf16=this;return new Promise(function(_0x2a7d96,_0xb4b3fa){return db['Campaign'][_0x300b('0x16')]({'raw':_0x4d2024[_0x300b('0x17')]?_0x4d2024[_0x300b('0x17')][_0x300b('0x18')]===undefined?!![]:![]:!![],'where':_0x4d2024['options']?_0x4d2024[_0x300b('0x17')][_0x300b('0x19')]||null:null,'attributes':_0x4d2024[_0x300b('0x17')]?_0x4d2024['options'][_0x300b('0x1a')]||null:null,'limit':_0x4d2024[_0x300b('0x17')]?_0x4d2024[_0x300b('0x17')][_0x300b('0x1b')]||null:null,'include':_0x4d2024[_0x300b('0x17')]?_0x4d2024['options']['include']?_[_0x300b('0x1c')](_0x4d2024[_0x300b('0x17')][_0x300b('0x1d')],function(_0x3ea40b){return{'model':db[_0x3ea40b[_0x300b('0x1e')]],'as':_0x3ea40b['as'],'attributes':_0x3ea40b[_0x300b('0x1a')],'include':_0x3ea40b[_0x300b('0x1d')]?_[_0x300b('0x1c')](_0x3ea40b[_0x300b('0x1d')],function(_0x544658){return{'model':db[_0x544658[_0x300b('0x1e')]],'as':_0x544658['as'],'attributes':_0x544658[_0x300b('0x1a')],'include':_0x544658[_0x300b('0x1d')]?_[_0x300b('0x1c')](_0x544658['include'],function(_0x4f50b0){return{'model':db[_0x4f50b0['model']],'as':_0x4f50b0['as'],'attributes':_0x4f50b0[_0x300b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1241c7){logger[_0x300b('0x13')](_0x300b('0x15'),_0x4d2024);logger[_0x300b('0xe')](_0x300b('0x15'),_0x4d2024,JSON[_0x300b('0x10')](_0x1241c7));_0x2a7d96(_0x1241c7);})[_0x300b('0x1f')](function(_0x159b63){logger[_0x300b('0x11')](_0x300b('0x15'),_0x159b63['message'],_0x4d2024);_0xb4b3fa(_0x1fbf16['error'](0x1f4,_0x159b63[_0x300b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 791f305..467ad46 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 _0xa39b=['index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','/:id/lists','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated'];(function(_0x4503f6,_0x3babaf){var _0x2277d1=function(_0x1c005a){while(--_0x1c005a){_0x4503f6['push'](_0x4503f6['shift']());}};_0x2277d1(++_0x3babaf);}(_0xa39b,0xee));var _0xba39=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa39b[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xba39('0x0'));var util=require(_0xba39('0x1'));var path=require(_0xba39('0x2'));var timeout=require(_0xba39('0x3'));var express=require(_0xba39('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba39('0x5'));var interaction=require(_0xba39('0x6'));var config=require(_0xba39('0x7'));var controller=require(_0xba39('0x8'));router['get']('/',auth[_0xba39('0x9')](),controller[_0xba39('0xa')]);router[_0xba39('0xb')](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0xd')]);router['get']('/:id/hoppers',auth[_0xba39('0x9')](),controller[_0xba39('0xe')]);router[_0xba39('0xb')]('/:id/hopper_histories',auth[_0xba39('0x9')](),controller[_0xba39('0xf')]);router[_0xba39('0xb')](_0xba39('0x10'),auth[_0xba39('0x9')](),controller['getHopperFinals']);router[_0xba39('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xba39('0x11')]);router[_0xba39('0xb')]('/:id/lists',auth[_0xba39('0x9')](),controller[_0xba39('0x12')]);router[_0xba39('0xb')](_0xba39('0x13'),auth[_0xba39('0x9')](),controller['getBlackLists']);router[_0xba39('0x14')]('/',auth[_0xba39('0x9')](),controller[_0xba39('0x15')]);router[_0xba39('0x14')](_0xba39('0x16'),auth[_0xba39('0x9')](),controller[_0xba39('0x17')]);router[_0xba39('0x14')]('/:id/lists',auth['isAuthenticated'](),controller[_0xba39('0x18')]);router[_0xba39('0x14')](_0xba39('0x13'),auth['isAuthenticated'](),controller[_0xba39('0x19')]);router['put'](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0x1a')]);router[_0xba39('0x1b')](_0xba39('0xc'),auth[_0xba39('0x9')](),controller['destroy']);router['delete'](_0xba39('0x1c'),auth[_0xba39('0x9')](),controller[_0xba39('0x1d')]);router[_0xba39('0x1b')](_0xba39('0x13'),auth['isAuthenticated'](),controller[_0xba39('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x596c=['getBlackLists','post','create','/:id/clone','clone','addBlackLists','/:id','update','delete','destroy','removeBlackLists','express','fs-extra','../../components/auth/service','get','index','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','/:id/blacklists'];(function(_0x43f0be,_0x2c4845){var _0x18af8a=function(_0x36868a){while(--_0x36868a){_0x43f0be['push'](_0x43f0be['shift']());}};_0x18af8a(++_0x2c4845);}(_0x596c,0x1cd));var _0xc596=function(_0x35c3d3,_0x1b50cb){_0x35c3d3=_0x35c3d3-0x0;var _0x2a29f9=_0x596c[_0x35c3d3];return _0x2a29f9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc596('0x0'));var router=express['Router']();var fs_extra=require(_0xc596('0x1'));var auth=require(_0xc596('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xc596('0x3')]('/',auth['isAuthenticated'](),controller[_0xc596('0x4')]);router[_0xc596('0x3')]('/:id',auth[_0xc596('0x5')](),controller['show']);router[_0xc596('0x3')](_0xc596('0x6'),auth['isAuthenticated'](),controller[_0xc596('0x7')]);router[_0xc596('0x3')](_0xc596('0x8'),auth['isAuthenticated'](),controller[_0xc596('0x9')]);router['get'](_0xc596('0xa'),auth['isAuthenticated'](),controller[_0xc596('0xb')]);router['get']('/:id/hopper_black',auth[_0xc596('0x5')](),controller['getHopperBlacks']);router['get'](_0xc596('0xc'),auth[_0xc596('0x5')](),controller['getLists']);router[_0xc596('0x3')](_0xc596('0xd'),auth[_0xc596('0x5')](),controller[_0xc596('0xe')]);router[_0xc596('0xf')]('/',auth[_0xc596('0x5')](),controller[_0xc596('0x10')]);router[_0xc596('0xf')](_0xc596('0x11'),auth['isAuthenticated'](),controller[_0xc596('0x12')]);router[_0xc596('0xf')](_0xc596('0xc'),auth[_0xc596('0x5')](),controller['addLists']);router['post'](_0xc596('0xd'),auth[_0xc596('0x5')](),controller[_0xc596('0x13')]);router['put'](_0xc596('0x14'),auth[_0xc596('0x5')](),controller[_0xc596('0x15')]);router[_0xc596('0x16')](_0xc596('0x14'),auth[_0xc596('0x5')](),controller[_0xc596('0x17')]);router[_0xc596('0x16')](_0xc596('0xc'),auth[_0xc596('0x5')](),controller['removeLists']);router[_0xc596('0x16')](_0xc596('0xd'),auth[_0xc596('0x5')](),controller[_0xc596('0x18')]);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 0fe392e..981922f 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 _0xdecd=['medium','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xdecd,0x7b));var _0xddec=function(_0x55979e,_0x4fb9a6){_0x55979e=_0x55979e-0x0;var _0x1846a3=_0xdecd[_0x55979e];return _0x1846a3;};'use strict';var Sequelize=require(_0xddec('0x0'));module[_0xddec('0x1')]={'key':{'type':Sequelize[_0xddec('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xddec('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xddec('0x2')]},'name':{'type':Sequelize[_0xddec('0x4')],'get':function(){return this[_0xddec('0x5')](_0xddec('0x6'));}}}; \ No newline at end of file +var _0x62a6=['exports','STRING','medium','VIRTUAL','getDataValue','sequelize'];(function(_0x386ce1,_0x444cc3){var _0x1db414=function(_0x428917){while(--_0x428917){_0x386ce1['push'](_0x386ce1['shift']());}};_0x1db414(++_0x444cc3);}(_0x62a6,0x14f));var _0x662a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62a6[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x662a('0x0'));module[_0x662a('0x1')]={'key':{'type':Sequelize[_0x662a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x662a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x662a('0x4')],'get':function(){return this[_0x662a('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 302ba44..1a22fdd 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 _0x5d51=['role','CannedAnswers','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x4c4c55,_0x4d2d85){var _0x281771=function(_0x87abba){while(--_0x87abba){_0x4c4c55['push'](_0x4c4c55['shift']());}};_0x281771(++_0x4d2d85);}(_0x5d51,0x10e));var _0x15d5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5d51[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x15d5('0x0'));var rimraf=require(_0x15d5('0x1'));var zipdir=require(_0x15d5('0x2'));var jsonpatch=require(_0x15d5('0x3'));var rp=require(_0x15d5('0x4'));var moment=require(_0x15d5('0x5'));var BPromise=require(_0x15d5('0x6'));var Mustache=require(_0x15d5('0x7'));var util=require(_0x15d5('0x8'));var path=require(_0x15d5('0x9'));var sox=require(_0x15d5('0xa'));var csv=require('to-csv');var ejs=require(_0x15d5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15d5('0xc'));var squel=require(_0x15d5('0xd'));var crypto=require('crypto');var jsforce=require(_0x15d5('0xe'));var deskjs=require(_0x15d5('0xf'));var toCsv=require(_0x15d5('0x10'));var querystring=require(_0x15d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x15d5('0x12'));var authService=require(_0x15d5('0x13'));var qs=require(_0x15d5('0x14'));var as=require(_0x15d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x15d5('0x16'));var config=require(_0x15d5('0x17'));var licenseUtil=require(_0x15d5('0x18'));var db=require(_0x15d5('0x19'))['db'];function respondWithStatusCode(_0x41fb10,_0x1456c1){_0x1456c1=_0x1456c1||0xcc;return function(_0x2a66fc){if(_0x2a66fc){return _0x41fb10[_0x15d5('0x1a')](_0x1456c1);}return _0x41fb10[_0x15d5('0x1b')](_0x1456c1)[_0x15d5('0x1c')]();};}function respondWithResult(_0x159e1a,_0x53f92f){_0x53f92f=_0x53f92f||0xc8;return function(_0x36451d){if(_0x36451d){return _0x159e1a[_0x15d5('0x1b')](_0x53f92f)['json'](_0x36451d);}};}function respondWithFilteredResult(_0x2d2177,_0x26edc7){return function(_0x40c16a){if(_0x40c16a){var _0x1e6372=typeof _0x26edc7[_0x15d5('0x1d')]==='undefined'&&typeof _0x26edc7[_0x15d5('0x1e')]===_0x15d5('0x1f');var _0x45cdbf=_0x40c16a[_0x15d5('0x20')];var _0x2dce49=_0x1e6372?0x0:_0x26edc7[_0x15d5('0x1d')];var _0x458b56=_0x1e6372?_0x40c16a[_0x15d5('0x20')]:_0x26edc7['offset']+_0x26edc7['limit'];var _0x3dfeb2;if(_0x458b56>=_0x45cdbf){_0x458b56=_0x45cdbf;_0x3dfeb2=0xc8;}else{_0x3dfeb2=0xce;}_0x2d2177[_0x15d5('0x1b')](_0x3dfeb2);return _0x2d2177[_0x15d5('0x21')](_0x15d5('0x22'),_0x2dce49+'-'+_0x458b56+'/'+_0x45cdbf)[_0x15d5('0x23')](_0x40c16a);}return null;};}function patchUpdates(_0x268a07){return function(_0x1ae1e7){try{jsonpatch[_0x15d5('0x24')](_0x1ae1e7,_0x268a07,!![]);}catch(_0x27e8c7){return BPromise['reject'](_0x27e8c7);}return _0x1ae1e7[_0x15d5('0x25')]();};}function saveUpdates(_0x96308b,_0x4ed1df){return function(_0x4ce02f){if(_0x4ce02f){return _0x4ce02f['update'](_0x96308b)[_0x15d5('0x26')](function(_0x5301ce){return _0x5301ce;});}return null;};}function removeEntity(_0x35e5e8,_0xaf1756){return function(_0x167e58){if(_0x167e58){return _0x167e58[_0x15d5('0x27')]()[_0x15d5('0x26')](function(){var _0x2f39aa=_0x167e58[_0x15d5('0x28')]({'plain':!![]});var _0x1c83cd='CannedAnswers';return db[_0x15d5('0x29')][_0x15d5('0x27')]({'where':{'type':_0x1c83cd,'resourceId':_0x2f39aa['id']}})[_0x15d5('0x26')](function(){return _0x167e58;});})[_0x15d5('0x26')](function(){_0x35e5e8[_0x15d5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x315e86,_0xf46229){return function(_0x4d37fb){if(!_0x4d37fb){_0x315e86[_0x15d5('0x1a')](0x194);}return _0x4d37fb;};}function handleError(_0x39c374,_0x77db2f){_0x77db2f=_0x77db2f||0x1f4;return function(_0x2bff18){logger[_0x15d5('0x2a')](_0x2bff18[_0x15d5('0x2b')]);if(_0x2bff18[_0x15d5('0x2c')]){delete _0x2bff18['name'];}_0x39c374[_0x15d5('0x1b')](_0x77db2f)[_0x15d5('0x2d')](_0x2bff18);};}exports['index']=function(_0x52152e,_0x3225c6){var _0x3e55a9={},_0x2e45d2={},_0xf26651={'count':0x0,'rows':[]};var _0x492d57=_[_0x15d5('0x2e')](db[_0x15d5('0x2f')][_0x15d5('0x30')],function(_0x37d70c){return{'name':_0x37d70c[_0x15d5('0x31')],'type':_0x37d70c[_0x15d5('0x32')][_0x15d5('0x33')]};});_0x2e45d2[_0x15d5('0x34')]=_[_0x15d5('0x2e')](_0x492d57,_0x15d5('0x2c'));_0x2e45d2[_0x15d5('0x35')]=_[_0x15d5('0x36')](_0x52152e[_0x15d5('0x35')]);_0x2e45d2['filters']=_['intersection'](_0x2e45d2[_0x15d5('0x34')],_0x2e45d2['query']);_0x3e55a9['attributes']=_['intersection'](_0x2e45d2[_0x15d5('0x34')],qs[_0x15d5('0x37')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x37')]));_0x3e55a9['attributes']=_0x3e55a9[_0x15d5('0x38')][_0x15d5('0x39')]?_0x3e55a9['attributes']:_0x2e45d2[_0x15d5('0x34')];if(!_0x52152e[_0x15d5('0x35')]['hasOwnProperty'](_0x15d5('0x3a'))){_0x3e55a9['limit']=qs[_0x15d5('0x1e')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x1e')]);_0x3e55a9[_0x15d5('0x1d')]=qs['offset'](_0x52152e['query'][_0x15d5('0x1d')]);}_0x3e55a9[_0x15d5('0x3b')]=qs[_0x15d5('0x3c')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x3c')]);_0x3e55a9[_0x15d5('0x3d')]=qs['filters'](_[_0x15d5('0x3e')](_0x52152e[_0x15d5('0x35')],_0x2e45d2[_0x15d5('0x3f')]),_0x492d57);if(_0x52152e['query'][_0x15d5('0x40')]){_0x3e55a9[_0x15d5('0x3d')]=_[_0x15d5('0x41')](_0x3e55a9[_0x15d5('0x3d')],{'$or':[{'key':{'$like':'%'+_0x52152e[_0x15d5('0x35')][_0x15d5('0x40')]+'%'}},{'value':{'$like':'%'+_0x52152e[_0x15d5('0x35')]['filter']+'%'}}]});}_0x3e55a9=_[_0x15d5('0x41')]({},_0x3e55a9,_0x52152e[_0x15d5('0x42')]);var _0x142716={'where':_0x3e55a9['where']};return db[_0x15d5('0x2f')][_0x15d5('0x20')](_0x142716)[_0x15d5('0x26')](function(_0x286155){_0xf26651[_0x15d5('0x20')]=_0x286155;if(_0x52152e[_0x15d5('0x35')]['includeAll']){_0x3e55a9[_0x15d5('0x43')]=[{'all':!![]}];}return db[_0x15d5('0x2f')][_0x15d5('0x44')](_0x3e55a9);})[_0x15d5('0x26')](function(_0x1cb611){_0xf26651[_0x15d5('0x45')]=_0x1cb611;return _0xf26651;})['then'](respondWithFilteredResult(_0x3225c6,_0x3e55a9))['catch'](handleError(_0x3225c6,null));};exports[_0x15d5('0x46')]=function(_0x53a933,_0x16b66c){var _0x45c492={'raw':!![],'where':{'id':_0x53a933[_0x15d5('0x47')]['id']}},_0x2578b0={};_0x2578b0[_0x15d5('0x34')]=_[_0x15d5('0x36')](db[_0x15d5('0x2f')][_0x15d5('0x30')]);_0x2578b0[_0x15d5('0x35')]=_[_0x15d5('0x36')](_0x53a933[_0x15d5('0x35')]);_0x2578b0['filters']=_['intersection'](_0x2578b0[_0x15d5('0x34')],_0x2578b0[_0x15d5('0x35')]);_0x45c492['attributes']=_[_0x15d5('0x48')](_0x2578b0[_0x15d5('0x34')],qs[_0x15d5('0x37')](_0x53a933[_0x15d5('0x35')][_0x15d5('0x37')]));_0x45c492[_0x15d5('0x38')]=_0x45c492['attributes'][_0x15d5('0x39')]?_0x45c492[_0x15d5('0x38')]:_0x2578b0['model'];if(_0x53a933['query'][_0x15d5('0x49')]){_0x45c492[_0x15d5('0x43')]=[{'all':!![]}];}_0x45c492=_[_0x15d5('0x41')]({},_0x45c492,_0x53a933[_0x15d5('0x42')]);return db[_0x15d5('0x2f')][_0x15d5('0x4a')](_0x45c492)[_0x15d5('0x26')](handleEntityNotFound(_0x16b66c,null))[_0x15d5('0x26')](respondWithResult(_0x16b66c,null))[_0x15d5('0x4b')](handleError(_0x16b66c,null));};exports['update']=function(_0x42a30b,_0x330d96){if(_0x42a30b[_0x15d5('0x4c')]['id']){delete _0x42a30b['body']['id'];}return db[_0x15d5('0x2f')][_0x15d5('0x4a')]({'where':{'id':_0x42a30b['params']['id']}})[_0x15d5('0x26')](handleEntityNotFound(_0x330d96,null))[_0x15d5('0x26')](saveUpdates(_0x42a30b[_0x15d5('0x4c')],null))[_0x15d5('0x26')](respondWithResult(_0x330d96,null))['catch'](handleError(_0x330d96,null));};exports['destroy']=function(_0x21b804,_0xfeb15f){return db['CannedAnswer'][_0x15d5('0x4a')]({'where':{'id':_0x21b804['params']['id']}})[_0x15d5('0x26')](handleEntityNotFound(_0xfeb15f,null))[_0x15d5('0x26')](removeEntity(_0xfeb15f,null))['catch'](handleError(_0xfeb15f,null));};exports[_0x15d5('0x4d')]=function(_0x52eaac,_0x35181e){var _0x1dd88e={'key':_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x33')]};if(_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4e')]){_0x1dd88e[_0x15d5('0x4e')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4e')];}else if(_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4f')]){_0x1dd88e[_0x15d5('0x4f')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4f')];}else if(_0x52eaac['body'][_0x15d5('0x50')]){_0x1dd88e[_0x15d5('0x50')]=_0x52eaac[_0x15d5('0x4c')]['OpenchannelAccountId'];}else if(_0x52eaac[_0x15d5('0x4c')]['ChatWebsiteId']){_0x1dd88e[_0x15d5('0x51')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x51')];}return db['CannedAnswer']['find']({'where':_0x1dd88e})['then'](function(_0x540bb9){if(_0x540bb9){throw new db['Sequelize'][(_0x15d5('0x52'))](_0x15d5('0x53'));}return db[_0x15d5('0x2f')]['create'](_0x52eaac[_0x15d5('0x4c')]);})[_0x15d5('0x26')](function(_0x3d0094){var _0x152242=_0x52eaac[_0x15d5('0x54')][_0x15d5('0x28')]({'plain':!![]});if(!_0x152242)throw new Error(_0x15d5('0x55'));if(_0x152242[_0x15d5('0x56')]==='user'){var _0x515453=_0x3d0094[_0x15d5('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x15d5('0x4a')]({'where':{'name':_0x15d5('0x57'),'userProfileId':_0x152242['userProfileId']},'raw':!![]})[_0x15d5('0x26')](function(_0x4131cc){if(_0x4131cc&&_0x4131cc[_0x15d5('0x58')]===0x0){return db[_0x15d5('0x29')][_0x15d5('0x4d')]({'name':_0x515453[_0x15d5('0x2c')],'resourceId':_0x515453['id'],'type':_0x4131cc[_0x15d5('0x2c')],'sectionId':_0x4131cc['id']},{})[_0x15d5('0x26')](function(){return _0x3d0094;});}else{return _0x3d0094;}})['catch'](function(_0x4a428c){logger[_0x15d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a428c);throw _0x4a428c;});}return _0x3d0094;})[_0x15d5('0x26')](respondWithResult(_0x35181e,0xc9))['catch'](handleError(_0x35181e,null));}; \ No newline at end of file +var _0xdfab=['update','body','create','key','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','filter','where','include','rows','catch','params','keys','includeAll','merge','options','find'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdfab,0xbf));var _0xbdfa=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xdfab[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require(_0xbdfa('0x0'));var rimraf=require(_0xbdfa('0x1'));var zipdir=require(_0xbdfa('0x2'));var jsonpatch=require(_0xbdfa('0x3'));var rp=require('request-promise');var moment=require(_0xbdfa('0x4'));var BPromise=require(_0xbdfa('0x5'));var Mustache=require(_0xbdfa('0x6'));var util=require(_0xbdfa('0x7'));var path=require(_0xbdfa('0x8'));var sox=require(_0xbdfa('0x9'));var csv=require(_0xbdfa('0xa'));var ejs=require(_0xbdfa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdfa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdfa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbdfa('0xa'));var querystring=require(_0xbdfa('0xe'));var Papa=require(_0xbdfa('0xf'));var Redis=require(_0xbdfa('0x10'));var authService=require(_0xbdfa('0x11'));var qs=require(_0xbdfa('0x12'));var as=require(_0xbdfa('0x13'));var hardwareService=require(_0xbdfa('0x14'));var logger=require(_0xbdfa('0x15'))(_0xbdfa('0x16'));var utils=require(_0xbdfa('0x17'));var config=require(_0xbdfa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdfa('0x19'))['db'];function respondWithStatusCode(_0xc3b92f,_0x4451b1){_0x4451b1=_0x4451b1||0xcc;return function(_0x429ed5){if(_0x429ed5){return _0xc3b92f[_0xbdfa('0x1a')](_0x4451b1);}return _0xc3b92f[_0xbdfa('0x1b')](_0x4451b1)[_0xbdfa('0x1c')]();};}function respondWithResult(_0x22ec74,_0x72115a){_0x72115a=_0x72115a||0xc8;return function(_0x1d269f){if(_0x1d269f){return _0x22ec74[_0xbdfa('0x1b')](_0x72115a)[_0xbdfa('0x1d')](_0x1d269f);}};}function respondWithFilteredResult(_0x1f58bd,_0x30898a){return function(_0x142183){if(_0x142183){var _0x3eb00e=typeof _0x30898a['offset']===_0xbdfa('0x1e')&&typeof _0x30898a[_0xbdfa('0x1f')]===_0xbdfa('0x1e');var _0x1f35e0=_0x142183[_0xbdfa('0x20')];var _0x4fc7fe=_0x3eb00e?0x0:_0x30898a[_0xbdfa('0x21')];var _0x261abb=_0x3eb00e?_0x142183[_0xbdfa('0x20')]:_0x30898a['offset']+_0x30898a[_0xbdfa('0x1f')];var _0x1087b0;if(_0x261abb>=_0x1f35e0){_0x261abb=_0x1f35e0;_0x1087b0=0xc8;}else{_0x1087b0=0xce;}_0x1f58bd['status'](_0x1087b0);return _0x1f58bd[_0xbdfa('0x22')](_0xbdfa('0x23'),_0x4fc7fe+'-'+_0x261abb+'/'+_0x1f35e0)[_0xbdfa('0x1d')](_0x142183);}return null;};}function patchUpdates(_0x410fdf){return function(_0x58c459){try{jsonpatch[_0xbdfa('0x24')](_0x58c459,_0x410fdf,!![]);}catch(_0xbc2002){return BPromise['reject'](_0xbc2002);}return _0x58c459[_0xbdfa('0x25')]();};}function saveUpdates(_0xb0594a,_0x5e826c){return function(_0x411197){if(_0x411197){return _0x411197['update'](_0xb0594a)[_0xbdfa('0x26')](function(_0x3798b5){return _0x3798b5;});}return null;};}function removeEntity(_0x4c4193,_0x90c233){return function(_0x113967){if(_0x113967){return _0x113967['destroy']()[_0xbdfa('0x26')](function(){var _0x2ce22b=_0x113967[_0xbdfa('0x27')]({'plain':!![]});var _0x3b1bb6=_0xbdfa('0x28');return db[_0xbdfa('0x29')][_0xbdfa('0x2a')]({'where':{'type':_0x3b1bb6,'resourceId':_0x2ce22b['id']}})['then'](function(){return _0x113967;});})['then'](function(){_0x4c4193[_0xbdfa('0x1b')](0xcc)[_0xbdfa('0x1c')]();});}};}function handleEntityNotFound(_0x1ec8cb,_0x4146b4){return function(_0x225f63){if(!_0x225f63){_0x1ec8cb[_0xbdfa('0x1a')](0x194);}return _0x225f63;};}function handleError(_0x18efa5,_0x5623b9){_0x5623b9=_0x5623b9||0x1f4;return function(_0x4c9842){logger[_0xbdfa('0x2b')](_0x4c9842[_0xbdfa('0x2c')]);if(_0x4c9842[_0xbdfa('0x2d')]){delete _0x4c9842[_0xbdfa('0x2d')];}_0x18efa5[_0xbdfa('0x1b')](_0x5623b9)[_0xbdfa('0x2e')](_0x4c9842);};}exports[_0xbdfa('0x2f')]=function(_0x4a9a8b,_0x487da7){var _0x2e47c9={},_0x13bb24={},_0x36abcc={'count':0x0,'rows':[]};var _0x61c38c=_[_0xbdfa('0x30')](db[_0xbdfa('0x31')][_0xbdfa('0x32')],function(_0x2e840e){return{'name':_0x2e840e[_0xbdfa('0x33')],'type':_0x2e840e[_0xbdfa('0x34')]['key']};});_0x13bb24['model']=_[_0xbdfa('0x30')](_0x61c38c,_0xbdfa('0x2d'));_0x13bb24[_0xbdfa('0x35')]=_['keys'](_0x4a9a8b['query']);_0x13bb24[_0xbdfa('0x36')]=_[_0xbdfa('0x37')](_0x13bb24[_0xbdfa('0x38')],_0x13bb24[_0xbdfa('0x35')]);_0x2e47c9[_0xbdfa('0x39')]=_[_0xbdfa('0x37')](_0x13bb24[_0xbdfa('0x38')],qs[_0xbdfa('0x3a')](_0x4a9a8b[_0xbdfa('0x35')]['fields']));_0x2e47c9['attributes']=_0x2e47c9[_0xbdfa('0x39')]['length']?_0x2e47c9[_0xbdfa('0x39')]:_0x13bb24[_0xbdfa('0x38')];if(!_0x4a9a8b[_0xbdfa('0x35')]['hasOwnProperty'](_0xbdfa('0x3b'))){_0x2e47c9[_0xbdfa('0x1f')]=qs[_0xbdfa('0x1f')](_0x4a9a8b[_0xbdfa('0x35')][_0xbdfa('0x1f')]);_0x2e47c9[_0xbdfa('0x21')]=qs[_0xbdfa('0x21')](_0x4a9a8b[_0xbdfa('0x35')][_0xbdfa('0x21')]);}_0x2e47c9[_0xbdfa('0x3c')]=qs[_0xbdfa('0x3d')](_0x4a9a8b[_0xbdfa('0x35')]['sort']);_0x2e47c9['where']=qs[_0xbdfa('0x36')](_['pick'](_0x4a9a8b[_0xbdfa('0x35')],_0x13bb24[_0xbdfa('0x36')]),_0x61c38c);if(_0x4a9a8b[_0xbdfa('0x35')][_0xbdfa('0x3e')]){_0x2e47c9[_0xbdfa('0x3f')]=_['merge'](_0x2e47c9[_0xbdfa('0x3f')],{'$or':[{'key':{'$like':'%'+_0x4a9a8b[_0xbdfa('0x35')]['filter']+'%'}},{'value':{'$like':'%'+_0x4a9a8b['query'][_0xbdfa('0x3e')]+'%'}}]});}_0x2e47c9=_['merge']({},_0x2e47c9,_0x4a9a8b['options']);var _0x29524b={'where':_0x2e47c9[_0xbdfa('0x3f')]};return db[_0xbdfa('0x31')][_0xbdfa('0x20')](_0x29524b)[_0xbdfa('0x26')](function(_0x7cc2d6){_0x36abcc[_0xbdfa('0x20')]=_0x7cc2d6;if(_0x4a9a8b[_0xbdfa('0x35')]['includeAll']){_0x2e47c9[_0xbdfa('0x40')]=[{'all':!![]}];}return db[_0xbdfa('0x31')]['findAll'](_0x2e47c9);})[_0xbdfa('0x26')](function(_0x2b2580){_0x36abcc[_0xbdfa('0x41')]=_0x2b2580;return _0x36abcc;})[_0xbdfa('0x26')](respondWithFilteredResult(_0x487da7,_0x2e47c9))[_0xbdfa('0x42')](handleError(_0x487da7,null));};exports['show']=function(_0x934243,_0x3ca1b9){var _0x30607f={'raw':!![],'where':{'id':_0x934243[_0xbdfa('0x43')]['id']}},_0x192963={};_0x192963['model']=_[_0xbdfa('0x44')](db['CannedAnswer'][_0xbdfa('0x32')]);_0x192963[_0xbdfa('0x35')]=_['keys'](_0x934243[_0xbdfa('0x35')]);_0x192963[_0xbdfa('0x36')]=_[_0xbdfa('0x37')](_0x192963[_0xbdfa('0x38')],_0x192963['query']);_0x30607f['attributes']=_[_0xbdfa('0x37')](_0x192963[_0xbdfa('0x38')],qs[_0xbdfa('0x3a')](_0x934243[_0xbdfa('0x35')][_0xbdfa('0x3a')]));_0x30607f[_0xbdfa('0x39')]=_0x30607f['attributes']['length']?_0x30607f[_0xbdfa('0x39')]:_0x192963[_0xbdfa('0x38')];if(_0x934243[_0xbdfa('0x35')][_0xbdfa('0x45')]){_0x30607f[_0xbdfa('0x40')]=[{'all':!![]}];}_0x30607f=_[_0xbdfa('0x46')]({},_0x30607f,_0x934243[_0xbdfa('0x47')]);return db[_0xbdfa('0x31')][_0xbdfa('0x48')](_0x30607f)['then'](handleEntityNotFound(_0x3ca1b9,null))[_0xbdfa('0x26')](respondWithResult(_0x3ca1b9,null))[_0xbdfa('0x42')](handleError(_0x3ca1b9,null));};exports[_0xbdfa('0x49')]=function(_0xf48b63,_0x1f10ad){if(_0xf48b63[_0xbdfa('0x4a')]['id']){delete _0xf48b63[_0xbdfa('0x4a')]['id'];}return db[_0xbdfa('0x31')]['find']({'where':{'id':_0xf48b63[_0xbdfa('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f10ad,null))['then'](saveUpdates(_0xf48b63[_0xbdfa('0x4a')],null))['then'](respondWithResult(_0x1f10ad,null))['catch'](handleError(_0x1f10ad,null));};exports[_0xbdfa('0x2a')]=function(_0x5784be,_0xc1f640){return db[_0xbdfa('0x31')]['find']({'where':{'id':_0x5784be['params']['id']}})['then'](handleEntityNotFound(_0xc1f640,null))[_0xbdfa('0x26')](removeEntity(_0xc1f640,null))[_0xbdfa('0x42')](handleError(_0xc1f640,null));};exports[_0xbdfa('0x4b')]=function(_0x56735e,_0x3dea58){var _0x21c979={'key':_0x56735e[_0xbdfa('0x4a')][_0xbdfa('0x4c')]};if(_0x56735e[_0xbdfa('0x4a')]['MailAccountId']){_0x21c979['MailAccountId']=_0x56735e['body']['MailAccountId'];}else if(_0x56735e[_0xbdfa('0x4a')][_0xbdfa('0x4d')]){_0x21c979[_0xbdfa('0x4d')]=_0x56735e[_0xbdfa('0x4a')][_0xbdfa('0x4d')];}else if(_0x56735e[_0xbdfa('0x4a')][_0xbdfa('0x4e')]){_0x21c979[_0xbdfa('0x4e')]=_0x56735e['body'][_0xbdfa('0x4e')];}else if(_0x56735e['body']['ChatWebsiteId']){_0x21c979[_0xbdfa('0x4f')]=_0x56735e[_0xbdfa('0x4a')]['ChatWebsiteId'];}return db[_0xbdfa('0x31')][_0xbdfa('0x48')]({'where':_0x21c979})[_0xbdfa('0x26')](function(_0x3cdad1){if(_0x3cdad1){throw new db[(_0xbdfa('0x50'))]['ValidationError'](_0xbdfa('0x51'));}return db['CannedAnswer'][_0xbdfa('0x4b')](_0x56735e['body']);})[_0xbdfa('0x26')](function(_0x982807){var _0x31b0cf=_0x56735e[_0xbdfa('0x52')][_0xbdfa('0x27')]({'plain':!![]});if(!_0x31b0cf)throw new Error(_0xbdfa('0x53'));if(_0x31b0cf[_0xbdfa('0x54')]==='user'){var _0x26d3ec=_0x982807[_0xbdfa('0x27')]({'plain':!![]});return db[_0xbdfa('0x55')]['find']({'where':{'name':_0xbdfa('0x28'),'userProfileId':_0x31b0cf[_0xbdfa('0x56')]},'raw':!![]})[_0xbdfa('0x26')](function(_0x23700b){if(_0x23700b&&_0x23700b[_0xbdfa('0x57')]===0x0){return db[_0xbdfa('0x29')][_0xbdfa('0x4b')]({'name':_0x26d3ec[_0xbdfa('0x2d')],'resourceId':_0x26d3ec['id'],'type':_0x23700b[_0xbdfa('0x2d')],'sectionId':_0x23700b['id']},{})[_0xbdfa('0x26')](function(){return _0x982807;});}else{return _0x982807;}})[_0xbdfa('0x42')](function(_0x4fe93a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe93a);throw _0x4fe93a;});}return _0x982807;})[_0xbdfa('0x26')](respondWithResult(_0x3dea58,0xc9))[_0xbdfa('0x42')](handleError(_0x3dea58,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3a79b70..a1c5840 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 _0x3ccf=['define','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','path','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x3ccf,0x139));var _0xf3cc=function(_0x1f4f6e,_0x17910b){_0x1f4f6e=_0x1f4f6e-0x0;var _0x3f6000=_0x3ccf[_0x1f4f6e];return _0x3f6000;};'use strict';var _=require(_0xf3cc('0x0'));var util=require('util');var logger=require(_0xf3cc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf3cc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cc('0x3'));var rimraf=require('rimraf');var config=require(_0xf3cc('0x4'));var attributes=require(_0xf3cc('0x5'));module[_0xf3cc('0x6')]=function(_0x2af784,_0x320e4f){return _0x2af784[_0xf3cc('0x7')]('CannedAnswer',attributes,{'tableName':_0xf3cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf3cc('0x9')});}; \ No newline at end of file +var _0xd983=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd983,0x10b));var _0x3d98=function(_0xab6c34,_0x47a84b){_0xab6c34=_0xab6c34-0x0;var _0xe47dd5=_0xd983[_0xab6c34];return _0xe47dd5;};'use strict';var _=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var logger=require(_0x3d98('0x2'))(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require(_0x3d98('0x5'));var rp=require(_0x3d98('0x6'));var fs=require('fs');var path=require(_0x3d98('0x7'));var rimraf=require(_0x3d98('0x8'));var config=require(_0x3d98('0x9'));var attributes=require(_0x3d98('0xa'));module['exports']=function(_0x2cebc7,_0x5f2375){return _0x2cebc7[_0x3d98('0xb')](_0x3d98('0xc'),attributes,{'tableName':_0x3d98('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3d98('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index bacb063..adc954b 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(_0x24ca70,_0x2046ae){var _0xaccbd7=function(_0x5293a3){while(--_0x5293a3){_0x24ca70['push'](_0x24ca70['shift']());}};_0xaccbd7(++_0x2046ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2c5c3d,_0x31e77c){var _0x2f8e9f=function(_0xc7a630){while(--_0xc7a630){_0x2c5c3d['push'](_0x2c5c3d['shift']());}};_0x2f8e9f(++_0x31e77c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 aaa61ed..cd9f97a 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 _0xd7c2=['delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','put'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xd7c2,0x112));var _0x2d7c=function(_0xbd2a41,_0x2c3cd8){_0xbd2a41=_0xbd2a41-0x0;var _0x5578fe=_0xd7c2[_0xbd2a41];return _0x5578fe;};'use strict';var multer=require(_0x2d7c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d7c('0x1'));var router=express[_0x2d7c('0x2')]();var fs_extra=require(_0x2d7c('0x3'));var auth=require(_0x2d7c('0x4'));var interaction=require(_0x2d7c('0x5'));var config=require(_0x2d7c('0x6'));var controller=require(_0x2d7c('0x7'));router[_0x2d7c('0x8')]('/',auth[_0x2d7c('0x9')](),controller['index']);router[_0x2d7c('0x8')](_0x2d7c('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2d7c('0xb')](_0x2d7c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2d7c('0xc')](_0x2d7c('0xa'),auth[_0x2d7c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x22f0=['../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x172d58,_0x4e184a){var _0x3c1a30=function(_0x4508db){while(--_0x4508db){_0x172d58['push'](_0x172d58['shift']());}};_0x3c1a30(++_0x4e184a);}(_0x22f0,0x1ed));var _0x022f=function(_0x484a56,_0x18b9d4){_0x484a56=_0x484a56-0x0;var _0x34c796=_0x22f0[_0x484a56];return _0x34c796;};'use strict';var multer=require(_0x022f('0x0'));var util=require(_0x022f('0x1'));var path=require(_0x022f('0x2'));var timeout=require(_0x022f('0x3'));var express=require(_0x022f('0x4'));var router=express[_0x022f('0x5')]();var fs_extra=require(_0x022f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x022f('0x7'));var config=require('../../config/environment');var controller=require(_0x022f('0x8'));router[_0x022f('0x9')]('/',auth[_0x022f('0xa')](),controller[_0x022f('0xb')]);router['get'](_0x022f('0xc'),auth[_0x022f('0xa')](),controller[_0x022f('0xd')]);router[_0x022f('0xe')]('/',auth[_0x022f('0xa')](),controller['create']);router[_0x022f('0xf')]('/:id',auth[_0x022f('0xa')](),controller[_0x022f('0x10')]);router[_0x022f('0x11')](_0x022f('0xc'),auth['isAuthenticated'](),controller[_0x022f('0x12')]);module[_0x022f('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4111ceb..c22f2b6 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 _0x9b5b=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x52578c,_0x51113a){var _0x4e9d7b=function(_0x2e28c0){while(--_0x2e28c0){_0x52578c['push'](_0x52578c['shift']());}};_0x4e9d7b(++_0x51113a);}(_0x9b5b,0x7f));var _0xb9b5=function(_0x3d6b61,_0x5e9be7){_0x3d6b61=_0x3d6b61-0x0;var _0x5a860d=_0x9b5b[_0x3d6b61];return _0x5a860d;};'use strict';var Sequelize=require(_0xb9b5('0x0'));module[_0xb9b5('0x1')]={'calldate':{'type':Sequelize[_0xb9b5('0x2')],'allowNull':![],'defaultValue':_0xb9b5('0x3')},'clid':{'type':Sequelize[_0xb9b5('0x4')]},'src':{'type':Sequelize[_0xb9b5('0x4')]},'dst':{'type':Sequelize[_0xb9b5('0x4')]},'dcontext':{'type':Sequelize[_0xb9b5('0x4')]},'channel':{'type':Sequelize[_0xb9b5('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb9b5('0x4')]},'lastdata':{'type':Sequelize[_0xb9b5('0x4')]},'duration':{'type':Sequelize[_0xb9b5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb9b5('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb9b5('0x4')]},'linkedid':{'type':Sequelize[_0xb9b5('0x4')]},'sequence':{'type':Sequelize[_0xb9b5('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9b5('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f0d=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x1cfd43,_0xfe10a7){var _0x8fd096=function(_0x3b2ea8){while(--_0x3b2ea8){_0x1cfd43['push'](_0x1cfd43['shift']());}};_0x8fd096(++_0xfe10a7);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1d9d69,_0x3fcd1e){_0x1d9d69=_0x1d9d69-0x0;var _0x5ccf91=_0x6f0d[_0x1d9d69];return _0x5ccf91;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'calldate':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![],'defaultValue':_0xd6f0('0x2')},'clid':{'type':Sequelize[_0xd6f0('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd6f0('0x3')]},'dcontext':{'type':Sequelize[_0xd6f0('0x3')]},'channel':{'type':Sequelize[_0xd6f0('0x3')]},'dstchannel':{'type':Sequelize[_0xd6f0('0x3')]},'lastapp':{'type':Sequelize[_0xd6f0('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd6f0('0x3')]},'amaflags':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd6f0('0x3')]},'userfield':{'type':Sequelize[_0xd6f0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd6f0('0x3')]},'peeraccount':{'type':Sequelize[_0xd6f0('0x3')]},'type':{'type':Sequelize[_0xd6f0('0x3')]},'tag':{'type':Sequelize[_0xd6f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 51dafe9..bdd7620 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 _0xc03e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x361ba6,_0x4c37b5){var _0x11ee21=function(_0x1afb1e){while(--_0x1afb1e){_0x361ba6['push'](_0x361ba6['shift']());}};_0x11ee21(++_0x4c37b5);}(_0xc03e,0x15a));var _0xec03=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0xc03e[_0x1a9e78];return _0x113e06;};'use strict';var emlformat=require(_0xec03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec03('0x1'));var rp=require('request-promise');var moment=require(_0xec03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xec03('0x3'));var util=require(_0xec03('0x4'));var path=require(_0xec03('0x5'));var sox=require(_0xec03('0x6'));var csv=require(_0xec03('0x7'));var ejs=require(_0xec03('0x8'));var fs=require('fs');var fs_extra=require(_0xec03('0x9'));var _=require(_0xec03('0xa'));var squel=require(_0xec03('0xb'));var crypto=require('crypto');var jsforce=require(_0xec03('0xc'));var deskjs=require(_0xec03('0xd'));var toCsv=require(_0xec03('0x7'));var querystring=require(_0xec03('0xe'));var Papa=require('papaparse');var Redis=require(_0xec03('0xf'));var authService=require(_0xec03('0x10'));var qs=require(_0xec03('0x11'));var as=require(_0xec03('0x12'));var hardwareService=require(_0xec03('0x13'));var logger=require(_0xec03('0x14'))(_0xec03('0x15'));var utils=require(_0xec03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec03('0x17'));var db=require(_0xec03('0x18'))['db'];function respondWithStatusCode(_0x398720,_0x2f65a1){_0x2f65a1=_0x2f65a1||0xcc;return function(_0x9908ef){if(_0x9908ef){return _0x398720[_0xec03('0x19')](_0x2f65a1);}return _0x398720[_0xec03('0x1a')](_0x2f65a1)[_0xec03('0x1b')]();};}function respondWithResult(_0x4ba43a,_0x555447){_0x555447=_0x555447||0xc8;return function(_0x5ca0e2){if(_0x5ca0e2){return _0x4ba43a[_0xec03('0x1a')](_0x555447)[_0xec03('0x1c')](_0x5ca0e2);}};}function respondWithFilteredResult(_0x3501ab,_0x515680){return function(_0x28bb4f){if(_0x28bb4f){var _0xbe85e6=typeof _0x515680[_0xec03('0x1d')]===_0xec03('0x1e')&&typeof _0x515680['limit']===_0xec03('0x1e');var _0x52f6ae=_0x28bb4f[_0xec03('0x1f')];var _0x5e8ae2=_0xbe85e6?0x0:_0x515680[_0xec03('0x1d')];var _0x5b3e04=_0xbe85e6?_0x28bb4f['count']:_0x515680[_0xec03('0x1d')]+_0x515680[_0xec03('0x20')];var _0xefa268;if(_0x5b3e04>=_0x52f6ae){_0x5b3e04=_0x52f6ae;_0xefa268=0xc8;}else{_0xefa268=0xce;}_0x3501ab[_0xec03('0x1a')](_0xefa268);return _0x3501ab['set'](_0xec03('0x21'),_0x5e8ae2+'-'+_0x5b3e04+'/'+_0x52f6ae)['json'](_0x28bb4f);}return null;};}function patchUpdates(_0x16ade3){return function(_0x253910){try{jsonpatch[_0xec03('0x22')](_0x253910,_0x16ade3,!![]);}catch(_0x33a167){return BPromise[_0xec03('0x23')](_0x33a167);}return _0x253910[_0xec03('0x24')]();};}function saveUpdates(_0x3a44df,_0x3b6ddf){return function(_0x5df6cc){if(_0x5df6cc){return _0x5df6cc[_0xec03('0x25')](_0x3a44df)[_0xec03('0x26')](function(_0xa16d53){return _0xa16d53;});}return null;};}function removeEntity(_0x76b813,_0x33de1e){return function(_0x15ef87){if(_0x15ef87){return _0x15ef87['destroy']()[_0xec03('0x26')](function(){_0x76b813[_0xec03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfcf6,_0xa5b580){return function(_0x26875e){if(!_0x26875e){_0x2bfcf6[_0xec03('0x19')](0x194);}return _0x26875e;};}function handleError(_0x1c6870,_0x581322){_0x581322=_0x581322||0x1f4;return function(_0x73cc4f){logger[_0xec03('0x27')](_0x73cc4f[_0xec03('0x28')]);if(_0x73cc4f[_0xec03('0x29')]){delete _0x73cc4f[_0xec03('0x29')];}_0x1c6870['status'](_0x581322)[_0xec03('0x2a')](_0x73cc4f);};}exports[_0xec03('0x2b')]=function(_0x49f9ab,_0x530251){var _0x2063ba={},_0x12b5c9={},_0x35a9eb={'count':0x0,'rows':[]};var _0x872f98=_[_0xec03('0x2c')](db[_0xec03('0x2d')][_0xec03('0x2e')],function(_0x28753c){return{'name':_0x28753c['fieldName'],'type':_0x28753c[_0xec03('0x2f')][_0xec03('0x30')]};});_0x12b5c9[_0xec03('0x31')]=_[_0xec03('0x2c')](_0x872f98,_0xec03('0x29'));_0x12b5c9[_0xec03('0x32')]=_[_0xec03('0x33')](_0x49f9ab[_0xec03('0x32')]);_0x12b5c9[_0xec03('0x34')]=_['intersection'](_0x12b5c9['model'],_0x12b5c9['query']);_0x2063ba[_0xec03('0x35')]=_[_0xec03('0x36')](_0x12b5c9[_0xec03('0x31')],qs[_0xec03('0x37')](_0x49f9ab['query']['fields']));_0x2063ba['attributes']=_0x2063ba['attributes'][_0xec03('0x38')]?_0x2063ba[_0xec03('0x35')]:_0x12b5c9[_0xec03('0x31')];if(!_0x49f9ab[_0xec03('0x32')][_0xec03('0x39')](_0xec03('0x3a'))){_0x2063ba[_0xec03('0x20')]=qs[_0xec03('0x20')](_0x49f9ab[_0xec03('0x32')][_0xec03('0x20')]);_0x2063ba[_0xec03('0x1d')]=qs[_0xec03('0x1d')](_0x49f9ab['query'][_0xec03('0x1d')]);}_0x2063ba[_0xec03('0x3b')]=qs[_0xec03('0x3c')](_0x49f9ab['query'][_0xec03('0x3c')]);_0x2063ba[_0xec03('0x3d')]=qs[_0xec03('0x34')](_[_0xec03('0x3e')](_0x49f9ab[_0xec03('0x32')],_0x12b5c9[_0xec03('0x34')]),_0x872f98);if(_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]){_0x2063ba[_0xec03('0x3d')]=_[_0xec03('0x40')](_0x2063ba[_0xec03('0x3d')],{'$or':_['map'](_0x872f98,function(_0x25286a){if(_0x25286a[_0xec03('0x2f')]!==_0xec03('0x41')){var _0x3d6d70={};_0x3d6d70[_0x25286a[_0xec03('0x29')]]={'$like':'%'+_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]+'%'};return _0x3d6d70;}})});}_0x2063ba=_[_0xec03('0x40')]({},_0x2063ba,_0x49f9ab['options']);var _0x454e91={'where':_0x2063ba['where']};return db['Cdr'][_0xec03('0x1f')](_0x454e91)['then'](function(_0x548b81){_0x35a9eb[_0xec03('0x1f')]=_0x548b81;if(_0x49f9ab[_0xec03('0x32')]['includeAll']){_0x2063ba[_0xec03('0x42')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x2063ba);})['then'](function(_0x494fec){_0x35a9eb[_0xec03('0x43')]=_0x494fec;return _0x35a9eb;})[_0xec03('0x26')](respondWithFilteredResult(_0x530251,_0x2063ba))[_0xec03('0x44')](handleError(_0x530251,null));};exports['show']=function(_0x1b1aea,_0x3f2522){var _0xe03df3={'raw':!![],'where':{'id':_0x1b1aea[_0xec03('0x45')]['id']}},_0x14a429={};_0x14a429[_0xec03('0x31')]=_[_0xec03('0x33')](db[_0xec03('0x2d')][_0xec03('0x2e')]);_0x14a429['query']=_[_0xec03('0x33')](_0x1b1aea[_0xec03('0x32')]);_0x14a429[_0xec03('0x34')]=_[_0xec03('0x36')](_0x14a429['model'],_0x14a429[_0xec03('0x32')]);_0xe03df3[_0xec03('0x35')]=_[_0xec03('0x36')](_0x14a429[_0xec03('0x31')],qs[_0xec03('0x37')](_0x1b1aea[_0xec03('0x32')]['fields']));_0xe03df3['attributes']=_0xe03df3[_0xec03('0x35')][_0xec03('0x38')]?_0xe03df3[_0xec03('0x35')]:_0x14a429[_0xec03('0x31')];if(_0x1b1aea[_0xec03('0x32')]['includeAll']){_0xe03df3['include']=[{'all':!![]}];}_0xe03df3=_[_0xec03('0x40')]({},_0xe03df3,_0x1b1aea['options']);return db[_0xec03('0x2d')][_0xec03('0x46')](_0xe03df3)[_0xec03('0x26')](handleEntityNotFound(_0x3f2522,null))[_0xec03('0x26')](respondWithResult(_0x3f2522,null))['catch'](handleError(_0x3f2522,null));};exports[_0xec03('0x47')]=function(_0x14a61c,_0x3c7e18){return db[_0xec03('0x2d')]['create'](_0x14a61c[_0xec03('0x48')],{})['then'](respondWithResult(_0x3c7e18,0xc9))[_0xec03('0x44')](handleError(_0x3c7e18,null));};exports[_0xec03('0x25')]=function(_0xdb9a99,_0x1c6b87){if(_0xdb9a99[_0xec03('0x48')]['id']){delete _0xdb9a99[_0xec03('0x48')]['id'];}return db[_0xec03('0x2d')]['find']({'where':{'id':_0xdb9a99[_0xec03('0x45')]['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x1c6b87,null))[_0xec03('0x26')](saveUpdates(_0xdb9a99[_0xec03('0x48')],null))['then'](respondWithResult(_0x1c6b87,null))[_0xec03('0x44')](handleError(_0x1c6b87,null));};exports['destroy']=function(_0xe0e874,_0x3825f9){return db[_0xec03('0x2d')][_0xec03('0x46')]({'where':{'id':_0xe0e874['params']['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x3825f9,null))[_0xec03('0x26')](removeEntity(_0x3825f9,null))[_0xec03('0x44')](handleError(_0x3825f9,null));};exports[_0xec03('0x49')]=function(_0x32a5af,_0x5b1339){return db[_0xec03('0x2d')][_0xec03('0x49')]()[_0xec03('0x26')](respondWithResult(_0x5b1339,null))['catch'](handleError(_0x5b1339,null));}; \ No newline at end of file +var _0x86f4=['bluebird','util','path','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x300487,_0x4c9b23){var _0x222c93=function(_0x5d130d){while(--_0x5d130d){_0x300487['push'](_0x300487['shift']());}};_0x222c93(++_0x4c9b23);}(_0x86f4,0x18a));var _0x486f=function(_0x362e3f,_0x5f0ef2){_0x362e3f=_0x362e3f-0x0;var _0x2a5f3f=_0x86f4[_0x362e3f];return _0x2a5f3f;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['Cdr'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['Cdr'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 90d524b..13cf416 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(_0x3709e3,_0x5ca0a1){var _0x831ec0=function(_0x2efe21){while(--_0x2efe21){_0x3709e3['push'](_0x3709e3['shift']());}};_0x831ec0(++_0x5ca0a1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x5b0c71,_0x516927){var _0x23fd6e=function(_0x385eea){while(--_0x385eea){_0x5b0c71['push'](_0x5b0c71['shift']());}};_0x23fd6e(++_0x516927);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 c3272d2..552b20a 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 _0x7efa=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3266a6,_0x129966){var _0x10ee38=function(_0x516e68){while(--_0x516e68){_0x3266a6['push'](_0x3266a6['shift']());}};_0x10ee38(++_0x129966);}(_0x7efa,0x79));var _0xa7ef=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x7efa[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var moment=require(_0xa7ef('0x2'));var BPromise=require(_0xa7ef('0x3'));var rs=require(_0xa7ef('0x4'));var fs=require('fs');var Redis=require(_0xa7ef('0x5'));var db=require(_0xa7ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7ef('0x7'));var jayson=require(_0xa7ef('0x8'));var client=jayson[_0xa7ef('0x9')][_0xa7ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe9b327,_0x70984f,_0x5632b9){return new BPromise(function(_0x58cc27,_0x4ac528){return client['request'](_0xe9b327,_0x5632b9)[_0xa7ef('0xb')](function(_0x280de6){logger[_0xa7ef('0xc')](_0xa7ef('0xd'),_0x70984f,_0xa7ef('0xe'));logger[_0xa7ef('0xf')](_0xa7ef('0x10'),_0x70984f,_0xa7ef('0xe'),JSON[_0xa7ef('0x11')](_0x280de6));if(_0x280de6['error']){if(_0x280de6[_0xa7ef('0x12')]['code']===0x1f4){logger[_0xa7ef('0x12')]('Cdr,\x20%s,\x20%s',_0x70984f,_0x280de6[_0xa7ef('0x12')][_0xa7ef('0x13')]);return _0x4ac528(_0x280de6[_0xa7ef('0x12')]['message']);}logger[_0xa7ef('0x12')](_0xa7ef('0xd'),_0x70984f,_0x280de6[_0xa7ef('0x12')][_0xa7ef('0x13')]);return _0x58cc27(_0x280de6[_0xa7ef('0x12')]['message']);}else{logger[_0xa7ef('0xc')]('Cdr,\x20%s,\x20%s',_0x70984f,'request\x20sent');_0x58cc27(_0x280de6['result'][_0xa7ef('0x13')]);}})['catch'](function(_0x24b9ff){logger['error'](_0xa7ef('0xd'),_0x70984f,_0x24b9ff);_0x4ac528(_0x24b9ff);});});} \ No newline at end of file +var _0x16f2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x17aa6b,_0x5edff9){var _0x3401ca=function(_0x58404d){while(--_0x58404d){_0x17aa6b['push'](_0x17aa6b['shift']());}};_0x3401ca(++_0x5edff9);}(_0x16f2,0x159));var _0x216f=function(_0x1b1365,_0x205568){_0x1b1365=_0x1b1365-0x0;var _0x5edfd8=_0x16f2[_0x1b1365];return _0x5edfd8;};'use strict';var _=require(_0x216f('0x0'));var util=require(_0x216f('0x1'));var moment=require(_0x216f('0x2'));var BPromise=require('bluebird');var rs=require(_0x216f('0x3'));var fs=require('fs');var Redis=require(_0x216f('0x4'));var db=require(_0x216f('0x5'))['db'];var utils=require(_0x216f('0x6'));var logger=require(_0x216f('0x7'))(_0x216f('0x8'));var config=require(_0x216f('0x9'));var jayson=require(_0x216f('0xa'));var client=jayson[_0x216f('0xb')][_0x216f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x393760,_0x99c163,_0x28ea72){return new BPromise(function(_0x439f72,_0x44b7aa){return client[_0x216f('0xd')](_0x393760,_0x28ea72)['then'](function(_0x49a1fe){logger[_0x216f('0xe')](_0x216f('0xf'),_0x99c163,_0x216f('0x10'));logger[_0x216f('0x11')](_0x216f('0x12'),_0x99c163,'request\x20sent',JSON[_0x216f('0x13')](_0x49a1fe));if(_0x49a1fe[_0x216f('0x14')]){if(_0x49a1fe[_0x216f('0x14')][_0x216f('0x15')]===0x1f4){logger[_0x216f('0x14')](_0x216f('0xf'),_0x99c163,_0x49a1fe[_0x216f('0x14')]['message']);return _0x44b7aa(_0x49a1fe[_0x216f('0x14')][_0x216f('0x16')]);}logger[_0x216f('0x14')](_0x216f('0xf'),_0x99c163,_0x49a1fe[_0x216f('0x14')]['message']);return _0x439f72(_0x49a1fe[_0x216f('0x14')][_0x216f('0x16')]);}else{logger['info'](_0x216f('0xf'),_0x99c163,_0x216f('0x10'));_0x439f72(_0x49a1fe[_0x216f('0x17')]['message']);}})[_0x216f('0x18')](function(_0x1658eb){logger[_0x216f('0x14')](_0x216f('0xf'),_0x99c163,_0x1658eb);_0x44b7aa(_0x1658eb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fbf38d3..4f33974 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x12ce04,_0xe0c750){var _0x34d3a6=function(_0x336e72){while(--_0x336e72){_0x12ce04['push'](_0x12ce04['shift']());}};_0x34d3a6(++_0xe0c750);}(_0xb10b,0x12a));var _0xbb10=function(_0x11435c,_0x436ccf){_0x11435c=_0x11435c-0x0;var _0x556167=_0xb10b[_0x11435c];return _0x556167;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +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(_0x5f3309,_0x37871b){var _0xea65ec=function(_0x4fbe43){while(--_0x4fbe43){_0x5f3309['push'](_0x5f3309['shift']());}};_0xea65ec(++_0x37871b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 76296c4..c6f74ed 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 _0x1f77=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x175e32,_0x2c5bb6){var _0x3886c5=function(_0x29a9fb){while(--_0x29a9fb){_0x175e32['push'](_0x175e32['shift']());}};_0x3886c5(++_0x2c5bb6);}(_0x1f77,0x1b9));var _0x71f7=function(_0x156c21,_0x3d5cf6){_0x156c21=_0x156c21-0x0;var _0x163acf=_0x1f77[_0x156c21];return _0x163acf;};'use strict';var Sequelize=require('sequelize');module[_0x71f7('0x0')]={'priority':{'type':Sequelize[_0x71f7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71f7('0x2')],'allowNull':![],'defaultValue':_0x71f7('0x3')},'appdata':{'type':Sequelize[_0x71f7('0x4')]()},'description':{'type':Sequelize[_0x71f7('0x2')]},'interval':{'type':Sequelize[_0x71f7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x02ba=['TEXT','STRING','*,*,*,*'];(function(_0x4cc7c8,_0x50800a){var _0x2c18eb=function(_0x18d54c){while(--_0x18d54c){_0x4cc7c8['push'](_0x4cc7c8['shift']());}};_0x2c18eb(++_0x50800a);}(_0x02ba,0x93));var _0xa02b=function(_0x27bf1c,_0x4d42d2){_0x27bf1c=_0x27bf1c-0x0;var _0x38d314=_0x02ba[_0x27bf1c];return _0x38d314;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa02b('0x0')]()},'description':{'type':Sequelize[_0xa02b('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa02b('0x2')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5191a78..73bf3d8 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 _0x33a4=['count','limit','set','json','reject','save','update','then','error','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','body','destroy','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0x33a4,0x88));var _0x433a=function(_0xf8d1c7,_0x1f8b56){_0xf8d1c7=_0xf8d1c7-0x0;var _0x5754e9=_0x33a4[_0xf8d1c7];return _0x5754e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x433a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433a('0x1'));var rp=require(_0x433a('0x2'));var moment=require(_0x433a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x433a('0x4'));var sox=require(_0x433a('0x5'));var csv=require(_0x433a('0x6'));var ejs=require(_0x433a('0x7'));var fs=require('fs');var fs_extra=require(_0x433a('0x8'));var _=require('lodash');var squel=require(_0x433a('0x9'));var crypto=require('crypto');var jsforce=require(_0x433a('0xa'));var deskjs=require(_0x433a('0xb'));var toCsv=require(_0x433a('0x6'));var querystring=require(_0x433a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x433a('0xd'));var qs=require(_0x433a('0xe'));var as=require(_0x433a('0xf'));var hardwareService=require(_0x433a('0x10'));var logger=require(_0x433a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x433a('0x12'));var licenseUtil=require(_0x433a('0x13'));var db=require(_0x433a('0x14'))['db'];function respondWithStatusCode(_0xd9260c,_0x5edeaf){_0x5edeaf=_0x5edeaf||0xcc;return function(_0x2d064c){if(_0x2d064c){return _0xd9260c[_0x433a('0x15')](_0x5edeaf);}return _0xd9260c['status'](_0x5edeaf)[_0x433a('0x16')]();};}function respondWithResult(_0x524a57,_0x36d1a6){_0x36d1a6=_0x36d1a6||0xc8;return function(_0x1f6cee){if(_0x1f6cee){return _0x524a57[_0x433a('0x17')](_0x36d1a6)['json'](_0x1f6cee);}};}function respondWithFilteredResult(_0x4ba178,_0x14e3a7){return function(_0x24311f){if(_0x24311f){var _0x35ebaf=typeof _0x14e3a7[_0x433a('0x18')]===_0x433a('0x19')&&typeof _0x14e3a7['limit']==='undefined';var _0x2f6a70=_0x24311f[_0x433a('0x1a')];var _0x4254c4=_0x35ebaf?0x0:_0x14e3a7[_0x433a('0x18')];var _0x255e47=_0x35ebaf?_0x24311f[_0x433a('0x1a')]:_0x14e3a7[_0x433a('0x18')]+_0x14e3a7[_0x433a('0x1b')];var _0x382f45;if(_0x255e47>=_0x2f6a70){_0x255e47=_0x2f6a70;_0x382f45=0xc8;}else{_0x382f45=0xce;}_0x4ba178[_0x433a('0x17')](_0x382f45);return _0x4ba178[_0x433a('0x1c')]('Content-Range',_0x4254c4+'-'+_0x255e47+'/'+_0x2f6a70)[_0x433a('0x1d')](_0x24311f);}return null;};}function patchUpdates(_0x566ae7){return function(_0x2f16a8){try{jsonpatch['apply'](_0x2f16a8,_0x566ae7,!![]);}catch(_0x4fd99){return BPromise[_0x433a('0x1e')](_0x4fd99);}return _0x2f16a8[_0x433a('0x1f')]();};}function saveUpdates(_0xa2dfe5,_0x389b90){return function(_0x1501f2){if(_0x1501f2){return _0x1501f2[_0x433a('0x20')](_0xa2dfe5)['then'](function(_0x5b2ce0){return _0x5b2ce0;});}return null;};}function removeEntity(_0x2a5a13,_0x5a50ff){return function(_0x326785){if(_0x326785){return _0x326785['destroy']()[_0x433a('0x21')](function(){_0x2a5a13[_0x433a('0x17')](0xcc)[_0x433a('0x16')]();});}};}function handleEntityNotFound(_0x3ef4ab,_0x344e26){return function(_0xaea8aa){if(!_0xaea8aa){_0x3ef4ab['sendStatus'](0x194);}return _0xaea8aa;};}function handleError(_0x41136a,_0xcd441b){_0xcd441b=_0xcd441b||0x1f4;return function(_0x4792ff){logger[_0x433a('0x22')](_0x4792ff['stack']);if(_0x4792ff['name']){delete _0x4792ff['name'];}_0x41136a[_0x433a('0x17')](_0xcd441b)['send'](_0x4792ff);};}exports[_0x433a('0x23')]=function(_0x499e8c,_0x49f03e){var _0x46e452={'raw':!![],'where':{'id':_0x499e8c[_0x433a('0x24')]['id']}},_0x1d5d78={};_0x1d5d78['model']=_[_0x433a('0x25')](db[_0x433a('0x26')][_0x433a('0x27')]);_0x1d5d78['query']=_['keys'](_0x499e8c[_0x433a('0x28')]);_0x1d5d78[_0x433a('0x29')]=_[_0x433a('0x2a')](_0x1d5d78[_0x433a('0x2b')],_0x1d5d78[_0x433a('0x28')]);_0x46e452[_0x433a('0x2c')]=_[_0x433a('0x2a')](_0x1d5d78[_0x433a('0x2b')],qs['fields'](_0x499e8c[_0x433a('0x28')][_0x433a('0x2d')]));_0x46e452[_0x433a('0x2c')]=_0x46e452[_0x433a('0x2c')][_0x433a('0x2e')]?_0x46e452[_0x433a('0x2c')]:_0x1d5d78[_0x433a('0x2b')];if(_0x499e8c[_0x433a('0x28')][_0x433a('0x2f')]){_0x46e452[_0x433a('0x30')]=[{'all':!![]}];}_0x46e452=_[_0x433a('0x31')]({},_0x46e452,_0x499e8c['options']);return db[_0x433a('0x26')][_0x433a('0x32')](_0x46e452)[_0x433a('0x21')](handleEntityNotFound(_0x49f03e,null))[_0x433a('0x21')](respondWithResult(_0x49f03e,null))[_0x433a('0x33')](handleError(_0x49f03e,null));};exports[_0x433a('0x20')]=function(_0x475c9a,_0x367875){if(_0x475c9a[_0x433a('0x34')]['id']){delete _0x475c9a[_0x433a('0x34')]['id'];}return db[_0x433a('0x26')]['find']({'where':{'id':_0x475c9a[_0x433a('0x24')]['id']}})[_0x433a('0x21')](handleEntityNotFound(_0x367875,null))['then'](saveUpdates(_0x475c9a['body'],null))[_0x433a('0x21')](respondWithResult(_0x367875,null))['catch'](handleError(_0x367875,null));};exports[_0x433a('0x35')]=function(_0x20fc31,_0x1530b0){return db['ChatApplication']['find']({'where':{'id':_0x20fc31[_0x433a('0x24')]['id']}})[_0x433a('0x21')](handleEntityNotFound(_0x1530b0,null))[_0x433a('0x21')](removeEntity(_0x1530b0,null))[_0x433a('0x33')](handleError(_0x1530b0,null));}; \ No newline at end of file +var _0x2504=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','params','keys','query','filters','model','intersection','fields','attributes','length','includeAll','include','merge','options','ChatApplication','catch','update','body','eml-format','rimraf'];(function(_0x3fb0c0,_0x247d45){var _0x28085c=function(_0x583eaa){while(--_0x583eaa){_0x3fb0c0['push'](_0x3fb0c0['shift']());}};_0x28085c(++_0x247d45);}(_0x2504,0xee));var _0x4250=function(_0x2d893d,_0x5bc2eb){_0x2d893d=_0x2d893d-0x0;var _0x29d16f=_0x2504[_0x2d893d];return _0x29d16f;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){_0x1feb98[_0x4250('0x19')](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x328ffb,_0x5cb4fe){return function(_0x431d01){if(!_0x431d01){_0x328ffb[_0x4250('0x18')](0x194);}return _0x431d01;};}function handleError(_0x3f40dd,_0x559d06){_0x559d06=_0x559d06||0x1f4;return function(_0x5b155e){logger[_0x4250('0x27')](_0x5b155e['stack']);if(_0x5b155e[_0x4250('0x28')]){delete _0x5b155e[_0x4250('0x28')];}_0x3f40dd[_0x4250('0x19')](_0x559d06)[_0x4250('0x29')](_0x5b155e);};}exports[_0x4250('0x2a')]=function(_0x501c5f,_0x395926){var _0x11ca22={'raw':!![],'where':{'id':_0x501c5f[_0x4250('0x2b')]['id']}},_0x48252b={};_0x48252b['model']=_[_0x4250('0x2c')](db['ChatApplication']['rawAttributes']);_0x48252b[_0x4250('0x2d')]=_['keys'](_0x501c5f[_0x4250('0x2d')]);_0x48252b[_0x4250('0x2e')]=_['intersection'](_0x48252b[_0x4250('0x2f')],_0x48252b[_0x4250('0x2d')]);_0x11ca22['attributes']=_[_0x4250('0x30')](_0x48252b[_0x4250('0x2f')],qs['fields'](_0x501c5f[_0x4250('0x2d')][_0x4250('0x31')]));_0x11ca22[_0x4250('0x32')]=_0x11ca22[_0x4250('0x32')][_0x4250('0x33')]?_0x11ca22[_0x4250('0x32')]:_0x48252b[_0x4250('0x2f')];if(_0x501c5f[_0x4250('0x2d')][_0x4250('0x34')]){_0x11ca22[_0x4250('0x35')]=[{'all':!![]}];}_0x11ca22=_[_0x4250('0x36')]({},_0x11ca22,_0x501c5f[_0x4250('0x37')]);return db[_0x4250('0x38')]['find'](_0x11ca22)[_0x4250('0x25')](handleEntityNotFound(_0x395926,null))['then'](respondWithResult(_0x395926,null))[_0x4250('0x39')](handleError(_0x395926,null));};exports[_0x4250('0x3a')]=function(_0x5c30fc,_0xf14c4e){if(_0x5c30fc[_0x4250('0x3b')]['id']){delete _0x5c30fc[_0x4250('0x3b')]['id'];}return db[_0x4250('0x38')]['find']({'where':{'id':_0x5c30fc['params']['id']}})['then'](handleEntityNotFound(_0xf14c4e,null))[_0x4250('0x25')](saveUpdates(_0x5c30fc[_0x4250('0x3b')],null))['then'](respondWithResult(_0xf14c4e,null))[_0x4250('0x39')](handleError(_0xf14c4e,null));};exports[_0x4250('0x26')]=function(_0x3f2ef7,_0x13d997){return db[_0x4250('0x38')]['find']({'where':{'id':_0x3f2ef7[_0x4250('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13d997,null))['then'](removeEntity(_0x13d997,null))[_0x4250('0x39')](handleError(_0x13d997,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index cbccda9..ee8fd18 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 _0x94c6=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cf932,_0x2e81ca){var _0x438329=function(_0x1fdd67){while(--_0x1fdd67){_0x4cf932['push'](_0x4cf932['shift']());}};_0x438329(++_0x2e81ca);}(_0x94c6,0xa2));var _0x694c=function(_0x5d5513,_0x4ee176){_0x5d5513=_0x5d5513-0x0;var _0x1003a1=_0x94c6[_0x5d5513];return _0x1003a1;};'use strict';var _=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var logger=require(_0x694c('0x2'))(_0x694c('0x3'));var moment=require(_0x694c('0x4'));var BPromise=require(_0x694c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x694c('0x6'));var config=require('../../config/environment');var attributes=require(_0x694c('0x7'));module[_0x694c('0x8')]=function(_0x46ce62,_0xa8dfd2){return _0x46ce62[_0x694c('0x9')](_0x694c('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x694c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x40a9=['../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c0953,_0x17b040){var _0x1d900c=function(_0x1f14cf){while(--_0x1f14cf){_0x3c0953['push'](_0x3c0953['shift']());}};_0x1d900c(++_0x17b040);}(_0x40a9,0xd9));var _0x940a=function(_0x388860,_0x2e1858){_0x388860=_0x388860-0x0;var _0x2eab86=_0x40a9[_0x388860];return _0x2eab86;};'use strict';var _=require('lodash');var util=require(_0x940a('0x0'));var logger=require(_0x940a('0x1'))(_0x940a('0x2'));var moment=require(_0x940a('0x3'));var BPromise=require(_0x940a('0x4'));var rp=require(_0x940a('0x5'));var fs=require('fs');var path=require(_0x940a('0x6'));var rimraf=require(_0x940a('0x7'));var config=require(_0x940a('0x8'));var attributes=require('./chatApplication.attributes');module[_0x940a('0x9')]=function(_0x1f40f0,_0x322570){return _0x1f40f0[_0x940a('0xa')](_0x940a('0xb'),attributes,{'tableName':_0x940a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x940a('0xd'),'collate':_0x940a('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9d6f4fe..228a714 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 _0xe694=['stringify','error','message','result','catch','lodash','moment','../../config/utils','rpc','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f636e,_0x4aa8d4){var _0x512431=function(_0x6435c5){while(--_0x6435c5){_0x3f636e['push'](_0x3f636e['shift']());}};_0x512431(++_0x4aa8d4);}(_0xe694,0x1d0));var _0x4e69=function(_0x3bda86,_0x3c45e5){_0x3bda86=_0x3bda86-0x0;var _0x4d7ffa=_0xe694[_0x3bda86];return _0x4d7ffa;};'use strict';var _=require(_0x4e69('0x0'));var util=require('util');var moment=require(_0x4e69('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e69('0x2'));var logger=require('../../config/logger')(_0x4e69('0x3'));var config=require('../../config/environment');var jayson=require(_0x4e69('0x4'));var client=jayson['client'][_0x4e69('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3f74dc,_0xb3b842,_0x27292b){return new BPromise(function(_0xdd9283,_0x131868){return client[_0x4e69('0x6')](_0x3f74dc,_0x27292b)[_0x4e69('0x7')](function(_0x585a01){logger[_0x4e69('0x8')](_0x4e69('0x9'),_0xb3b842,_0x4e69('0xa'));logger[_0x4e69('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0xb3b842,'request\x20sent',JSON[_0x4e69('0xc')](_0x585a01));if(_0x585a01['error']){if(_0x585a01[_0x4e69('0xd')]['code']===0x1f4){logger[_0x4e69('0xd')](_0x4e69('0x9'),_0xb3b842,_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);return _0x131868(_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);}logger[_0x4e69('0xd')](_0x4e69('0x9'),_0xb3b842,_0x585a01['error']['message']);return _0xdd9283(_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);}else{logger[_0x4e69('0x8')]('ChatApplication,\x20%s,\x20%s',_0xb3b842,_0x4e69('0xa'));_0xdd9283(_0x585a01[_0x4e69('0xf')][_0x4e69('0xe')]);}})[_0x4e69('0x10')](function(_0x34dbc1){logger['error'](_0x4e69('0x9'),_0xb3b842,_0x34dbc1);_0x131868(_0x34dbc1);});});} \ No newline at end of file +var _0x53e0=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x53e0,0xd1));var _0x053e=function(_0x42e675,_0x4f24ef){_0x42e675=_0x42e675-0x0;var _0x1e18b9=_0x53e0[_0x42e675];return _0x1e18b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x053e('0x0'));var BPromise=require(_0x053e('0x1'));var rs=require(_0x053e('0x2'));var fs=require('fs');var Redis=require(_0x053e('0x3'));var db=require(_0x053e('0x4'))['db'];var utils=require(_0x053e('0x5'));var logger=require('../../config/logger')(_0x053e('0x6'));var config=require('../../config/environment');var jayson=require(_0x053e('0x7'));var client=jayson[_0x053e('0x8')][_0x053e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x260dd7,_0x119c19,_0x49a3b0){return new BPromise(function(_0x19f1c6,_0x1b04d4){return client[_0x053e('0xa')](_0x260dd7,_0x49a3b0)[_0x053e('0xb')](function(_0x960a3b){logger[_0x053e('0xc')](_0x053e('0xd'),_0x119c19,_0x053e('0xe'));logger['debug'](_0x053e('0xf'),_0x119c19,'request\x20sent',JSON[_0x053e('0x10')](_0x960a3b));if(_0x960a3b[_0x053e('0x11')]){if(_0x960a3b[_0x053e('0x11')][_0x053e('0x12')]===0x1f4){logger[_0x053e('0x11')](_0x053e('0xd'),_0x119c19,_0x960a3b['error'][_0x053e('0x13')]);return _0x1b04d4(_0x960a3b['error'][_0x053e('0x13')]);}logger[_0x053e('0x11')](_0x053e('0xd'),_0x119c19,_0x960a3b[_0x053e('0x11')]['message']);return _0x19f1c6(_0x960a3b[_0x053e('0x11')][_0x053e('0x13')]);}else{logger[_0x053e('0xc')](_0x053e('0xd'),_0x119c19,_0x053e('0xe'));_0x19f1c6(_0x960a3b[_0x053e('0x14')]['message']);}})[_0x053e('0x15')](function(_0xcd0e42){logger['error'](_0x053e('0xd'),_0x119c19,_0xcd0e42);_0x1b04d4(_0xcd0e42);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 331a7ae..05a8d9a 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 _0x1b64=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util'];(function(_0x5cb3a5,_0x3fcfcb){var _0x5de246=function(_0x5d4d75){while(--_0x5d4d75){_0x5cb3a5['push'](_0x5cb3a5['shift']());}};_0x5de246(++_0x3fcfcb);}(_0x1b64,0x6a));var _0x41b6=function(_0x565c85,_0x27256e){_0x565c85=_0x565c85-0x0;var _0x10d353=_0x1b64[_0x565c85];return _0x10d353;};'use strict';var multer=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var path=require(_0x41b6('0x2'));var timeout=require(_0x41b6('0x3'));var express=require(_0x41b6('0x4'));var router=express[_0x41b6('0x5')]();var fs_extra=require(_0x41b6('0x6'));var auth=require(_0x41b6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41b6('0x8'));router[_0x41b6('0x9')](_0x41b6('0xa'),auth[_0x41b6('0xb')](),controller[_0x41b6('0xc')]);router[_0x41b6('0xd')](_0x41b6('0xa'),auth[_0x41b6('0xb')](),controller[_0x41b6('0xe')]);router[_0x41b6('0xf')](_0x41b6('0xa'),auth['isAuthenticated'](),controller[_0x41b6('0x10')]);module[_0x41b6('0x11')]=router; \ No newline at end of file +var _0xdaff=['./chatApplication.controller','show','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xdaff,0xb2));var _0xfdaf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdaff[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xfdaf('0x0'));var util=require(_0xfdaf('0x1'));var path=require('path');var timeout=require(_0xfdaf('0x2'));var express=require(_0xfdaf('0x3'));var router=express[_0xfdaf('0x4')]();var fs_extra=require(_0xfdaf('0x5'));var auth=require(_0xfdaf('0x6'));var interaction=require(_0xfdaf('0x7'));var config=require(_0xfdaf('0x8'));var controller=require(_0xfdaf('0x9'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xfdaf('0xa')]);router[_0xfdaf('0xb')](_0xfdaf('0xc'),auth['isAuthenticated'](),controller[_0xfdaf('0xd')]);router[_0xfdaf('0xe')](_0xfdaf('0xc'),auth['isAuthenticated'](),controller[_0xfdaf('0xf')]);module[_0xfdaf('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1c4b6f4..2da7204 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 _0x01db=['sequelize','STRING','BOOLEAN'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x01db,0x171));var _0xb01d=function(_0x521fcf,_0x33e556){_0x521fcf=_0x521fcf-0x0;var _0x4c5d72=_0x01db[_0x521fcf];return _0x4c5d72;};'use strict';var Sequelize=require(_0xb01d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb01d('0x1')]},'write':{'type':Sequelize[_0xb01d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb4d9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x49fb87,_0x19974d){var _0x2b8796=function(_0x49b3e7){while(--_0x49b3e7){_0x49fb87['push'](_0x49fb87['shift']());}};_0x2b8796(++_0x19974d);}(_0xb4d9,0xce));var _0x9b4d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb4d9[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x9b4d('0x0'));module[_0x9b4d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9b4d('0x2')]},'write':{'type':Sequelize[_0x9b4d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 588e13f..4d7799a 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 _0x3725=['include','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','omit','findOne','User','order','getMembers','hasOwnProperty','removeMembers','ids','ChatGroupId','getMessages','$gte','split','format','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ChatGroup','findAll','catch','show','params','keys','length'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3725,0x1f0));var _0x5372=function(_0x17a932,_0x472274){_0x17a932=_0x17a932-0x0;var _0xb10aef=_0x3725[_0x17a932];return _0xb10aef;};'use strict';var emlformat=require(_0x5372('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5372('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5372('0x2'));var moment=require(_0x5372('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5372('0x4'));var util=require(_0x5372('0x5'));var path=require(_0x5372('0x6'));var sox=require(_0x5372('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5372('0x8'));var _=require(_0x5372('0x9'));var squel=require(_0x5372('0xa'));var crypto=require('crypto');var jsforce=require(_0x5372('0xb'));var deskjs=require(_0x5372('0xc'));var toCsv=require(_0x5372('0xd'));var querystring=require(_0x5372('0xe'));var Papa=require(_0x5372('0xf'));var Redis=require('ioredis');var authService=require(_0x5372('0x10'));var qs=require(_0x5372('0x11'));var as=require(_0x5372('0x12'));var hardwareService=require(_0x5372('0x13'));var logger=require('../../config/logger')(_0x5372('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5372('0x15'));var db=require(_0x5372('0x16'))['db'];config[_0x5372('0x17')]=_['defaults'](config[_0x5372('0x17')],{'host':_0x5372('0x18'),'port':0x18eb});var socket=require(_0x5372('0x19'))(new Redis(config[_0x5372('0x17')]));require('./chatGroup.socket')[_0x5372('0x1a')](socket);function respondWithStatusCode(_0x4bfa9e,_0x2fcae9){_0x2fcae9=_0x2fcae9||0xcc;return function(_0x3d7780){if(_0x3d7780){return _0x4bfa9e['sendStatus'](_0x2fcae9);}return _0x4bfa9e[_0x5372('0x1b')](_0x2fcae9)[_0x5372('0x1c')]();};}function respondWithResult(_0x2ac10f,_0x3309f0){_0x3309f0=_0x3309f0||0xc8;return function(_0x423417){if(_0x423417){return _0x2ac10f[_0x5372('0x1b')](_0x3309f0)[_0x5372('0x1d')](_0x423417);}};}function respondWithFilteredResult(_0x5f43fa,_0x3158b7){return function(_0x58254f){if(_0x58254f){var _0x101273=typeof _0x3158b7['offset']==='undefined'&&typeof _0x3158b7[_0x5372('0x1e')]===_0x5372('0x1f');var _0x183a7b=_0x58254f[_0x5372('0x20')];var _0x156b8c=_0x101273?0x0:_0x3158b7[_0x5372('0x21')];var _0x34a81d=_0x101273?_0x58254f['count']:_0x3158b7[_0x5372('0x21')]+_0x3158b7[_0x5372('0x1e')];var _0x16572c;if(_0x34a81d>=_0x183a7b){_0x34a81d=_0x183a7b;_0x16572c=0xc8;}else{_0x16572c=0xce;}_0x5f43fa['status'](_0x16572c);return _0x5f43fa[_0x5372('0x22')](_0x5372('0x23'),_0x156b8c+'-'+_0x34a81d+'/'+_0x183a7b)[_0x5372('0x1d')](_0x58254f);}return null;};}function patchUpdates(_0x3aae6f){return function(_0x594d70){try{jsonpatch[_0x5372('0x24')](_0x594d70,_0x3aae6f,!![]);}catch(_0x53d382){return BPromise[_0x5372('0x25')](_0x53d382);}return _0x594d70[_0x5372('0x26')]();};}function saveUpdates(_0x39daf4,_0x69ebe8){return function(_0x966c99){if(_0x966c99){return _0x966c99['update'](_0x39daf4)[_0x5372('0x27')](function(_0x147773){return _0x147773;});}return null;};}function removeEntity(_0x38835d,_0x520a4f){return function(_0x132949){if(_0x132949){return _0x132949[_0x5372('0x28')]()['then'](function(){_0x38835d[_0x5372('0x1b')](0xcc)[_0x5372('0x1c')]();});}};}function handleEntityNotFound(_0xe6d220,_0x37302d){return function(_0x3c9d30){if(!_0x3c9d30){_0xe6d220[_0x5372('0x29')](0x194);}return _0x3c9d30;};}function handleError(_0x5afd3b,_0x1a2c7e){_0x1a2c7e=_0x1a2c7e||0x1f4;return function(_0x4a978a){logger[_0x5372('0x2a')](_0x4a978a[_0x5372('0x2b')]);if(_0x4a978a[_0x5372('0x2c')]){delete _0x4a978a[_0x5372('0x2c')];}_0x5afd3b['status'](_0x1a2c7e)[_0x5372('0x2d')](_0x4a978a);};}exports[_0x5372('0x2e')]=function(_0x287c53,_0x635ecf){var _0x3892bd={},_0x3ab642={},_0x287eae={'count':0x0,'rows':[]};var _0x556542=_['map'](db['ChatGroup'][_0x5372('0x2f')],function(_0xab96a9){return{'name':_0xab96a9[_0x5372('0x30')],'type':_0xab96a9[_0x5372('0x31')][_0x5372('0x32')]};});_0x3ab642[_0x5372('0x33')]=_[_0x5372('0x34')](_0x556542,'name');_0x3ab642[_0x5372('0x35')]=_['keys'](_0x287c53[_0x5372('0x35')]);_0x3ab642[_0x5372('0x36')]=_['intersection'](_0x3ab642[_0x5372('0x33')],_0x3ab642[_0x5372('0x35')]);_0x3892bd[_0x5372('0x37')]=_[_0x5372('0x38')](_0x3ab642[_0x5372('0x33')],qs[_0x5372('0x39')](_0x287c53[_0x5372('0x35')][_0x5372('0x39')]));_0x3892bd[_0x5372('0x37')]=_0x3892bd[_0x5372('0x37')]['length']?_0x3892bd[_0x5372('0x37')]:_0x3ab642[_0x5372('0x33')];if(!_0x287c53['query']['hasOwnProperty'](_0x5372('0x3a'))){_0x3892bd[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x287c53[_0x5372('0x35')][_0x5372('0x1e')]);_0x3892bd[_0x5372('0x21')]=qs['offset'](_0x287c53[_0x5372('0x35')][_0x5372('0x21')]);}_0x3892bd['order']=qs[_0x5372('0x3b')](_0x287c53['query'][_0x5372('0x3b')]);_0x3892bd[_0x5372('0x3c')]=qs[_0x5372('0x36')](_[_0x5372('0x3d')](_0x287c53[_0x5372('0x35')],_0x3ab642[_0x5372('0x36')]),_0x556542);if(_0x287c53['query'][_0x5372('0x3e')]){_0x3892bd[_0x5372('0x3c')]=_[_0x5372('0x3f')](_0x3892bd[_0x5372('0x3c')],{'$or':_[_0x5372('0x34')](_0x556542,function(_0x48bd1b){if(_0x48bd1b[_0x5372('0x31')]!==_0x5372('0x40')){var _0x5f4d15={};_0x5f4d15[_0x48bd1b['name']]={'$like':'%'+_0x287c53[_0x5372('0x35')][_0x5372('0x3e')]+'%'};return _0x5f4d15;}})});}_0x3892bd=_[_0x5372('0x3f')]({},_0x3892bd,_0x287c53[_0x5372('0x41')]);var _0x514fc9={'where':_0x3892bd['where']};return db['ChatGroup']['count'](_0x514fc9)[_0x5372('0x27')](function(_0x335a1e){_0x287eae[_0x5372('0x20')]=_0x335a1e;if(_0x287c53[_0x5372('0x35')][_0x5372('0x42')]){_0x3892bd['include']=[{'all':!![]}];}return db[_0x5372('0x43')][_0x5372('0x44')](_0x3892bd);})[_0x5372('0x27')](function(_0x1bd689){_0x287eae['rows']=_0x1bd689;return _0x287eae;})[_0x5372('0x27')](respondWithFilteredResult(_0x635ecf,_0x3892bd))[_0x5372('0x45')](handleError(_0x635ecf,null));};exports[_0x5372('0x46')]=function(_0x39a9aa,_0x3d96b7){var _0x53b085={'raw':!![],'where':{'id':_0x39a9aa[_0x5372('0x47')]['id']}},_0xfc2782={};_0xfc2782[_0x5372('0x33')]=_['keys'](db[_0x5372('0x43')]['rawAttributes']);_0xfc2782[_0x5372('0x35')]=_[_0x5372('0x48')](_0x39a9aa[_0x5372('0x35')]);_0xfc2782['filters']=_[_0x5372('0x38')](_0xfc2782[_0x5372('0x33')],_0xfc2782[_0x5372('0x35')]);_0x53b085[_0x5372('0x37')]=_['intersection'](_0xfc2782[_0x5372('0x33')],qs[_0x5372('0x39')](_0x39a9aa['query'][_0x5372('0x39')]));_0x53b085[_0x5372('0x37')]=_0x53b085[_0x5372('0x37')][_0x5372('0x49')]?_0x53b085[_0x5372('0x37')]:_0xfc2782[_0x5372('0x33')];if(_0x39a9aa[_0x5372('0x35')][_0x5372('0x42')]){_0x53b085[_0x5372('0x4a')]=[{'all':!![]}];}_0x53b085=_[_0x5372('0x3f')]({},_0x53b085,_0x39a9aa[_0x5372('0x41')]);return db[_0x5372('0x43')]['find'](_0x53b085)[_0x5372('0x27')](handleEntityNotFound(_0x3d96b7,null))[_0x5372('0x27')](respondWithResult(_0x3d96b7,null))[_0x5372('0x45')](handleError(_0x3d96b7,null));};exports[_0x5372('0x4b')]=function(_0x387ed1,_0x1562b7){return db[_0x5372('0x43')]['create'](_0x387ed1['body'],{})[_0x5372('0x27')](respondWithResult(_0x1562b7,0xc9))[_0x5372('0x45')](handleError(_0x1562b7,null));};exports['update']=function(_0x4703bf,_0x4388d6){if(_0x4703bf[_0x5372('0x4c')]['id']){delete _0x4703bf[_0x5372('0x4c')]['id'];}return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x4703bf['params']['id']}})['then'](handleEntityNotFound(_0x4388d6,null))[_0x5372('0x27')](saveUpdates(_0x4703bf[_0x5372('0x4c')],null))[_0x5372('0x27')](respondWithResult(_0x4388d6,null))[_0x5372('0x45')](handleError(_0x4388d6,null));};exports[_0x5372('0x28')]=function(_0x470087,_0x1e820c){return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x470087['params']['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x1e820c,null))[_0x5372('0x27')](removeEntity(_0x1e820c,null))[_0x5372('0x45')](handleError(_0x1e820c,null));};exports[_0x5372('0x4e')]=function(_0x1b1453,_0x1b3d61){return db['ChatGroup'][_0x5372('0x4e')]()[_0x5372('0x27')](respondWithResult(_0x1b3d61,null))[_0x5372('0x45')](handleError(_0x1b3d61,null));};exports[_0x5372('0x4f')]=function(_0x5c8fdb,_0x22fd29,_0x4d88e6){return db[_0x5372('0x50')][_0x5372('0x20')]({'where':{'ChatGroupId':_0x5c8fdb[_0x5372('0x47')]['id'],'ToId':_0x5c8fdb['user']['id'],'read':![]}})[_0x5372('0x27')](function(_0x4706ad){return{'id':_[_0x5372('0x51')](_0x5c8fdb[_0x5372('0x47')]['id']),'count':_0x4706ad};})[_0x5372('0x27')](respondWithResult(_0x22fd29,null))[_0x5372('0x45')](handleError(_0x22fd29,null));};exports['addMembers']=function(_0x9fbb9b,_0x3c969f,_0x45fa1c){return db['ChatGroup'][_0x5372('0x4d')]({'where':{'id':_0x9fbb9b[_0x5372('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c969f,null))[_0x5372('0x27')](function(_0x558c44){if(_0x558c44){return _0x558c44['addMembers'](_0x9fbb9b[_0x5372('0x4c')]['ids'],_[_0x5372('0x52')](_0x9fbb9b[_0x5372('0x4c')],['ids','id'])||{});}})[_0x5372('0x27')](respondWithResult(_0x3c969f,null))[_0x5372('0x45')](handleError(_0x3c969f,null));};exports['getMembers']=function(_0x5eaa05,_0x430d37,_0xaef16f){var _0x51be5d={};var _0x6ad3e1={};var _0x182e22;var _0x5332b0;return db[_0x5372('0x43')][_0x5372('0x53')]({'where':{'id':_0x5eaa05[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x430d37,null))[_0x5372('0x27')](function(_0x50e088){if(_0x50e088){_0x182e22=_0x50e088;_0x6ad3e1['model']=_[_0x5372('0x48')](db[_0x5372('0x54')][_0x5372('0x2f')]);_0x6ad3e1[_0x5372('0x35')]=_[_0x5372('0x48')](_0x5eaa05[_0x5372('0x35')]);_0x6ad3e1['filters']=_[_0x5372('0x38')](_0x6ad3e1['model'],_0x6ad3e1[_0x5372('0x35')]);_0x51be5d[_0x5372('0x37')]=_['intersection'](_0x6ad3e1[_0x5372('0x33')],qs['fields'](_0x5eaa05['query'][_0x5372('0x39')]));_0x51be5d[_0x5372('0x37')]=_0x51be5d[_0x5372('0x37')][_0x5372('0x49')]?_0x51be5d[_0x5372('0x37')]:_0x6ad3e1['model'];_0x51be5d[_0x5372('0x55')]=qs['sort'](_0x5eaa05[_0x5372('0x35')][_0x5372('0x3b')]);_0x51be5d['where']=qs['filters'](_[_0x5372('0x3d')](_0x5eaa05['query'],_0x6ad3e1[_0x5372('0x36')]));if(_0x5eaa05['query'][_0x5372('0x3e')]){_0x51be5d['where']=_[_0x5372('0x3f')](_0x51be5d['where'],{'$or':_['map'](_0x51be5d['attributes'],function(_0x3733f7){var _0x312bab={};_0x312bab[_0x3733f7]={'$like':'%'+_0x5eaa05[_0x5372('0x35')][_0x5372('0x3e')]+'%'};return _0x312bab;})});}_0x51be5d=_['merge']({},_0x51be5d,_0x5eaa05[_0x5372('0x41')]);return _0x182e22[_0x5372('0x56')](_0x51be5d);}})[_0x5372('0x27')](function(_0x38aa6c){if(_0x38aa6c){_0x5332b0=_0x38aa6c[_0x5372('0x49')];if(!_0x5eaa05[_0x5372('0x35')][_0x5372('0x57')](_0x5372('0x3a'))){_0x51be5d[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x5eaa05[_0x5372('0x35')][_0x5372('0x1e')]);_0x51be5d[_0x5372('0x21')]=qs[_0x5372('0x21')](_0x5eaa05['query'][_0x5372('0x21')]);}return _0x182e22['getMembers'](_0x51be5d);}})[_0x5372('0x27')](function(_0x10b401){if(_0x10b401){return _0x10b401?{'count':_0x5332b0,'rows':_0x10b401}:null;}})[_0x5372('0x27')](respondWithResult(_0x430d37,null))['catch'](handleError(_0x430d37,null));};exports['removeMembers']=function(_0x31c99e,_0x455759,_0x531705){return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x31c99e[_0x5372('0x47')]['id']}})['then'](handleEntityNotFound(_0x455759,null))['then'](function(_0xc474c1){if(_0xc474c1){return _0xc474c1[_0x5372('0x58')](_0x31c99e[_0x5372('0x35')][_0x5372('0x59')]);}})[_0x5372('0x27')](respondWithStatusCode(_0x455759,null))[_0x5372('0x45')](handleError(_0x455759,null));};exports['addMessage']=function(_0x253917,_0x17dfd1,_0x11023f){if(_0x253917[_0x5372('0x4c')]['id']){delete _0x253917['body']['id'];}return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x253917[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x17dfd1,null))[_0x5372('0x27')](function(_0x3b3e56){if(_0x3b3e56){_0x253917['body'][_0x5372('0x5a')]=_0x3b3e56['id'];return db[_0x5372('0x50')]['create'](_0x253917[_0x5372('0x4c')]);}})[_0x5372('0x27')](respondWithResult(_0x17dfd1,null))[_0x5372('0x45')](handleError(_0x17dfd1,null));};exports[_0x5372('0x5b')]=function(_0x4e2212,_0x2b96bb,_0x598e80){var _0x2d1225={};var _0x3987ec={};var _0x6253b;var _0x512735;return db[_0x5372('0x43')][_0x5372('0x53')]({'where':{'id':_0x4e2212[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x2b96bb,null))['then'](function(_0x2f4762){if(_0x2f4762){_0x6253b=_0x2f4762;_0x3987ec['model']=_[_0x5372('0x48')](db[_0x5372('0x50')][_0x5372('0x2f')]);_0x3987ec[_0x5372('0x35')]=_[_0x5372('0x48')](_0x4e2212[_0x5372('0x35')]);_0x3987ec[_0x5372('0x36')]=_[_0x5372('0x38')](_0x3987ec[_0x5372('0x33')],_0x3987ec[_0x5372('0x35')]);_0x2d1225['attributes']=_[_0x5372('0x38')](_0x3987ec['model'],qs[_0x5372('0x39')](_0x4e2212['query'][_0x5372('0x39')]));_0x2d1225[_0x5372('0x37')]=_0x2d1225['attributes'][_0x5372('0x49')]?_0x2d1225[_0x5372('0x37')]:_0x3987ec['model'];_0x2d1225[_0x5372('0x55')]=qs[_0x5372('0x3b')](_0x4e2212[_0x5372('0x35')][_0x5372('0x3b')]);_0x2d1225[_0x5372('0x3c')]=qs[_0x5372('0x36')](_[_0x5372('0x3d')](_0x4e2212['query'],_0x3987ec[_0x5372('0x36')]));if(_0x4e2212['query'][_0x5372('0x3e')]){_0x2d1225[_0x5372('0x3c')]=_[_0x5372('0x3f')](_0x2d1225['where'],{'$or':_[_0x5372('0x34')](_0x2d1225[_0x5372('0x37')],function(_0x77ec6a){var _0x3e268c={};_0x3e268c[_0x77ec6a]={'$like':'%'+_0x4e2212['query'][_0x5372('0x3e')]+'%'};return _0x3e268c;})});}if(_0x4e2212[_0x5372('0x35')][_0x5372('0x5c')]){var _0x2d3464=_0x4e2212[_0x5372('0x35')]['$gte'][_0x5372('0x5d')](',');var _0xd8d4aa={};_0xd8d4aa[_0x2d3464[0x0]]={'$gte':moment(_0x2d3464[0x1])[_0x5372('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d1225[_0x5372('0x3c')]=_['merge'](_0x2d1225['where'],_0xd8d4aa);}_0x2d1225=_[_0x5372('0x3f')]({},_0x2d1225,_0x4e2212[_0x5372('0x41')]);return _0x6253b[_0x5372('0x5b')](_0x2d1225);}})[_0x5372('0x27')](function(_0x181c7e){if(_0x181c7e){_0x512735=_0x181c7e[_0x5372('0x49')];if(!_0x4e2212['query'][_0x5372('0x57')](_0x5372('0x3a'))){_0x2d1225[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x4e2212[_0x5372('0x35')][_0x5372('0x1e')]);_0x2d1225[_0x5372('0x21')]=qs[_0x5372('0x21')](_0x4e2212[_0x5372('0x35')]['offset']);}return _0x6253b[_0x5372('0x5b')](_0x2d1225);}})[_0x5372('0x27')](function(_0x2bc144){if(_0x2bc144){return _0x2bc144?{'count':_0x512735,'rows':_0x2bc144}:null;}})[_0x5372('0x27')](respondWithResult(_0x2b96bb,null))[_0x5372('0x45')](handleError(_0x2b96bb,null));}; \ No newline at end of file +var _0xd7f3=['getMembers','User','sort','removeMembers','addMessage','ChatGroupId','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','send','index','map','ChatGroup','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','length','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xd7f3,0x65));var _0x3d7f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xd7f3[_0xa990b7];return _0x52c99c;};'use strict';var emlformat=require(_0x3d7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d7f('0x1'));var rp=require('request-promise');var moment=require(_0x3d7f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3d7f('0x3'));var util=require(_0x3d7f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3d7f('0x5'));var ejs=require(_0x3d7f('0x6'));var fs=require('fs');var fs_extra=require(_0x3d7f('0x7'));var _=require(_0x3d7f('0x8'));var squel=require(_0x3d7f('0x9'));var crypto=require(_0x3d7f('0xa'));var jsforce=require(_0x3d7f('0xb'));var deskjs=require(_0x3d7f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3d7f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3d7f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d7f('0xf'));var utils=require(_0x3d7f('0x10'));var config=require(_0x3d7f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d7f('0x12'))['db'];config['redis']=_[_0x3d7f('0x13')](config[_0x3d7f('0x14')],{'host':_0x3d7f('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d7f('0x14')]));require(_0x3d7f('0x16'))[_0x3d7f('0x17')](socket);function respondWithStatusCode(_0x484932,_0x4799dc){_0x4799dc=_0x4799dc||0xcc;return function(_0xddb598){if(_0xddb598){return _0x484932[_0x3d7f('0x18')](_0x4799dc);}return _0x484932['status'](_0x4799dc)[_0x3d7f('0x19')]();};}function respondWithResult(_0xb57615,_0x327cf4){_0x327cf4=_0x327cf4||0xc8;return function(_0x57a635){if(_0x57a635){return _0xb57615[_0x3d7f('0x1a')](_0x327cf4)['json'](_0x57a635);}};}function respondWithFilteredResult(_0x5fd096,_0x4ba9b5){return function(_0x1cddc4){if(_0x1cddc4){var _0x2ac615=typeof _0x4ba9b5[_0x3d7f('0x1b')]===_0x3d7f('0x1c')&&typeof _0x4ba9b5[_0x3d7f('0x1d')]===_0x3d7f('0x1c');var _0x339307=_0x1cddc4[_0x3d7f('0x1e')];var _0x292825=_0x2ac615?0x0:_0x4ba9b5[_0x3d7f('0x1b')];var _0x5bb495=_0x2ac615?_0x1cddc4[_0x3d7f('0x1e')]:_0x4ba9b5[_0x3d7f('0x1b')]+_0x4ba9b5['limit'];var _0x1186e0;if(_0x5bb495>=_0x339307){_0x5bb495=_0x339307;_0x1186e0=0xc8;}else{_0x1186e0=0xce;}_0x5fd096['status'](_0x1186e0);return _0x5fd096[_0x3d7f('0x1f')](_0x3d7f('0x20'),_0x292825+'-'+_0x5bb495+'/'+_0x339307)[_0x3d7f('0x21')](_0x1cddc4);}return null;};}function patchUpdates(_0x1343d7){return function(_0x590409){try{jsonpatch[_0x3d7f('0x22')](_0x590409,_0x1343d7,!![]);}catch(_0x4c472e){return BPromise['reject'](_0x4c472e);}return _0x590409['save']();};}function saveUpdates(_0x14ee18,_0x1ae247){return function(_0x188345){if(_0x188345){return _0x188345['update'](_0x14ee18)[_0x3d7f('0x23')](function(_0x29a567){return _0x29a567;});}return null;};}function removeEntity(_0x899d64,_0x1e3864){return function(_0x1af69d){if(_0x1af69d){return _0x1af69d[_0x3d7f('0x24')]()['then'](function(){_0x899d64[_0x3d7f('0x1a')](0xcc)[_0x3d7f('0x19')]();});}};}function handleEntityNotFound(_0x1fdb6e,_0x7dab0d){return function(_0x5b87cb){if(!_0x5b87cb){_0x1fdb6e[_0x3d7f('0x18')](0x194);}return _0x5b87cb;};}function handleError(_0x3d3ccd,_0x5c64da){_0x5c64da=_0x5c64da||0x1f4;return function(_0x202ce4){logger[_0x3d7f('0x25')](_0x202ce4[_0x3d7f('0x26')]);if(_0x202ce4['name']){delete _0x202ce4['name'];}_0x3d3ccd[_0x3d7f('0x1a')](_0x5c64da)[_0x3d7f('0x27')](_0x202ce4);};}exports[_0x3d7f('0x28')]=function(_0x134ab5,_0x4c12b7){var _0x377de9={},_0x52eaa1={},_0x4b6d5c={'count':0x0,'rows':[]};var _0xcf1a23=_[_0x3d7f('0x29')](db[_0x3d7f('0x2a')][_0x3d7f('0x2b')],function(_0x441558){return{'name':_0x441558[_0x3d7f('0x2c')],'type':_0x441558[_0x3d7f('0x2d')]['key']};});_0x52eaa1['model']=_[_0x3d7f('0x29')](_0xcf1a23,_0x3d7f('0x2e'));_0x52eaa1[_0x3d7f('0x2f')]=_[_0x3d7f('0x30')](_0x134ab5['query']);_0x52eaa1[_0x3d7f('0x31')]=_[_0x3d7f('0x32')](_0x52eaa1[_0x3d7f('0x33')],_0x52eaa1[_0x3d7f('0x2f')]);_0x377de9['attributes']=_[_0x3d7f('0x32')](_0x52eaa1[_0x3d7f('0x33')],qs[_0x3d7f('0x34')](_0x134ab5[_0x3d7f('0x2f')][_0x3d7f('0x34')]));_0x377de9[_0x3d7f('0x35')]=_0x377de9[_0x3d7f('0x35')]['length']?_0x377de9[_0x3d7f('0x35')]:_0x52eaa1['model'];if(!_0x134ab5['query'][_0x3d7f('0x36')](_0x3d7f('0x37'))){_0x377de9[_0x3d7f('0x1d')]=qs[_0x3d7f('0x1d')](_0x134ab5[_0x3d7f('0x2f')][_0x3d7f('0x1d')]);_0x377de9[_0x3d7f('0x1b')]=qs['offset'](_0x134ab5[_0x3d7f('0x2f')][_0x3d7f('0x1b')]);}_0x377de9[_0x3d7f('0x38')]=qs['sort'](_0x134ab5[_0x3d7f('0x2f')]['sort']);_0x377de9[_0x3d7f('0x39')]=qs['filters'](_[_0x3d7f('0x3a')](_0x134ab5[_0x3d7f('0x2f')],_0x52eaa1[_0x3d7f('0x31')]),_0xcf1a23);if(_0x134ab5[_0x3d7f('0x2f')][_0x3d7f('0x3b')]){_0x377de9['where']=_[_0x3d7f('0x3c')](_0x377de9['where'],{'$or':_[_0x3d7f('0x29')](_0xcf1a23,function(_0x5d57d9){if(_0x5d57d9['type']!==_0x3d7f('0x3d')){var _0x3dfe9e={};_0x3dfe9e[_0x5d57d9['name']]={'$like':'%'+_0x134ab5['query'][_0x3d7f('0x3b')]+'%'};return _0x3dfe9e;}})});}_0x377de9=_[_0x3d7f('0x3c')]({},_0x377de9,_0x134ab5[_0x3d7f('0x3e')]);var _0x54a4ff={'where':_0x377de9[_0x3d7f('0x39')]};return db[_0x3d7f('0x2a')][_0x3d7f('0x1e')](_0x54a4ff)[_0x3d7f('0x23')](function(_0x5c23cb){_0x4b6d5c[_0x3d7f('0x1e')]=_0x5c23cb;if(_0x134ab5['query'][_0x3d7f('0x3f')]){_0x377de9['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x377de9);})[_0x3d7f('0x23')](function(_0x4ab32e){_0x4b6d5c['rows']=_0x4ab32e;return _0x4b6d5c;})[_0x3d7f('0x23')](respondWithFilteredResult(_0x4c12b7,_0x377de9))[_0x3d7f('0x40')](handleError(_0x4c12b7,null));};exports[_0x3d7f('0x41')]=function(_0x5bb929,_0x3ce46a){var _0x372c26={'raw':!![],'where':{'id':_0x5bb929[_0x3d7f('0x42')]['id']}},_0xf887be={};_0xf887be[_0x3d7f('0x33')]=_[_0x3d7f('0x30')](db['ChatGroup']['rawAttributes']);_0xf887be[_0x3d7f('0x2f')]=_[_0x3d7f('0x30')](_0x5bb929[_0x3d7f('0x2f')]);_0xf887be[_0x3d7f('0x31')]=_[_0x3d7f('0x32')](_0xf887be['model'],_0xf887be[_0x3d7f('0x2f')]);_0x372c26['attributes']=_[_0x3d7f('0x32')](_0xf887be[_0x3d7f('0x33')],qs[_0x3d7f('0x34')](_0x5bb929[_0x3d7f('0x2f')][_0x3d7f('0x34')]));_0x372c26[_0x3d7f('0x35')]=_0x372c26[_0x3d7f('0x35')][_0x3d7f('0x43')]?_0x372c26['attributes']:_0xf887be[_0x3d7f('0x33')];if(_0x5bb929['query'][_0x3d7f('0x3f')]){_0x372c26['include']=[{'all':!![]}];}_0x372c26=_['merge']({},_0x372c26,_0x5bb929[_0x3d7f('0x3e')]);return db[_0x3d7f('0x2a')][_0x3d7f('0x44')](_0x372c26)['then'](handleEntityNotFound(_0x3ce46a,null))[_0x3d7f('0x23')](respondWithResult(_0x3ce46a,null))[_0x3d7f('0x40')](handleError(_0x3ce46a,null));};exports[_0x3d7f('0x45')]=function(_0x371cef,_0x12f327){return db[_0x3d7f('0x2a')]['create'](_0x371cef[_0x3d7f('0x46')],{})[_0x3d7f('0x23')](respondWithResult(_0x12f327,0xc9))[_0x3d7f('0x40')](handleError(_0x12f327,null));};exports[_0x3d7f('0x47')]=function(_0x511cca,_0x550688){if(_0x511cca[_0x3d7f('0x46')]['id']){delete _0x511cca[_0x3d7f('0x46')]['id'];}return db[_0x3d7f('0x2a')][_0x3d7f('0x44')]({'where':{'id':_0x511cca[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x550688,null))['then'](saveUpdates(_0x511cca[_0x3d7f('0x46')],null))[_0x3d7f('0x23')](respondWithResult(_0x550688,null))['catch'](handleError(_0x550688,null));};exports[_0x3d7f('0x24')]=function(_0x286e4d,_0x118a84){return db[_0x3d7f('0x2a')]['find']({'where':{'id':_0x286e4d[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x118a84,null))[_0x3d7f('0x23')](removeEntity(_0x118a84,null))[_0x3d7f('0x40')](handleError(_0x118a84,null));};exports[_0x3d7f('0x48')]=function(_0x18a107,_0x500b90){return db[_0x3d7f('0x2a')][_0x3d7f('0x48')]()[_0x3d7f('0x23')](respondWithResult(_0x500b90,null))['catch'](handleError(_0x500b90,null));};exports[_0x3d7f('0x49')]=function(_0x4a2b68,_0x31d048,_0x1291ab){return db[_0x3d7f('0x4a')][_0x3d7f('0x1e')]({'where':{'ChatGroupId':_0x4a2b68[_0x3d7f('0x42')]['id'],'ToId':_0x4a2b68[_0x3d7f('0x4b')]['id'],'read':![]}})[_0x3d7f('0x23')](function(_0x2c20fc){return{'id':_['toInteger'](_0x4a2b68[_0x3d7f('0x42')]['id']),'count':_0x2c20fc};})['then'](respondWithResult(_0x31d048,null))[_0x3d7f('0x40')](handleError(_0x31d048,null));};exports[_0x3d7f('0x4c')]=function(_0xadaefb,_0x19e403,_0x578cf6){return db['ChatGroup'][_0x3d7f('0x44')]({'where':{'id':_0xadaefb[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x19e403,null))[_0x3d7f('0x23')](function(_0x29937b){if(_0x29937b){return _0x29937b[_0x3d7f('0x4c')](_0xadaefb[_0x3d7f('0x46')][_0x3d7f('0x4d')],_[_0x3d7f('0x4e')](_0xadaefb[_0x3d7f('0x46')],[_0x3d7f('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x19e403,null))[_0x3d7f('0x40')](handleError(_0x19e403,null));};exports[_0x3d7f('0x4f')]=function(_0x5275a4,_0x37444f,_0x5a31d3){var _0x49639a={};var _0x2c2ffa={};var _0x177142;var _0x1063cc;return db[_0x3d7f('0x2a')]['findOne']({'where':{'id':_0x5275a4[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x37444f,null))[_0x3d7f('0x23')](function(_0x22e147){if(_0x22e147){_0x177142=_0x22e147;_0x2c2ffa[_0x3d7f('0x33')]=_['keys'](db[_0x3d7f('0x50')]['rawAttributes']);_0x2c2ffa[_0x3d7f('0x2f')]=_[_0x3d7f('0x30')](_0x5275a4[_0x3d7f('0x2f')]);_0x2c2ffa['filters']=_['intersection'](_0x2c2ffa['model'],_0x2c2ffa[_0x3d7f('0x2f')]);_0x49639a['attributes']=_[_0x3d7f('0x32')](_0x2c2ffa[_0x3d7f('0x33')],qs[_0x3d7f('0x34')](_0x5275a4['query'][_0x3d7f('0x34')]));_0x49639a['attributes']=_0x49639a[_0x3d7f('0x35')][_0x3d7f('0x43')]?_0x49639a[_0x3d7f('0x35')]:_0x2c2ffa[_0x3d7f('0x33')];_0x49639a[_0x3d7f('0x38')]=qs[_0x3d7f('0x51')](_0x5275a4[_0x3d7f('0x2f')][_0x3d7f('0x51')]);_0x49639a[_0x3d7f('0x39')]=qs[_0x3d7f('0x31')](_[_0x3d7f('0x3a')](_0x5275a4[_0x3d7f('0x2f')],_0x2c2ffa['filters']));if(_0x5275a4[_0x3d7f('0x2f')][_0x3d7f('0x3b')]){_0x49639a[_0x3d7f('0x39')]=_['merge'](_0x49639a[_0x3d7f('0x39')],{'$or':_[_0x3d7f('0x29')](_0x49639a['attributes'],function(_0x569f57){var _0x59e9bd={};_0x59e9bd[_0x569f57]={'$like':'%'+_0x5275a4[_0x3d7f('0x2f')]['filter']+'%'};return _0x59e9bd;})});}_0x49639a=_[_0x3d7f('0x3c')]({},_0x49639a,_0x5275a4[_0x3d7f('0x3e')]);return _0x177142['getMembers'](_0x49639a);}})[_0x3d7f('0x23')](function(_0x367251){if(_0x367251){_0x1063cc=_0x367251[_0x3d7f('0x43')];if(!_0x5275a4[_0x3d7f('0x2f')][_0x3d7f('0x36')](_0x3d7f('0x37'))){_0x49639a[_0x3d7f('0x1d')]=qs[_0x3d7f('0x1d')](_0x5275a4[_0x3d7f('0x2f')][_0x3d7f('0x1d')]);_0x49639a['offset']=qs[_0x3d7f('0x1b')](_0x5275a4[_0x3d7f('0x2f')][_0x3d7f('0x1b')]);}return _0x177142[_0x3d7f('0x4f')](_0x49639a);}})[_0x3d7f('0x23')](function(_0x499a06){if(_0x499a06){return _0x499a06?{'count':_0x1063cc,'rows':_0x499a06}:null;}})[_0x3d7f('0x23')](respondWithResult(_0x37444f,null))[_0x3d7f('0x40')](handleError(_0x37444f,null));};exports[_0x3d7f('0x52')]=function(_0x24ff7d,_0x574ff2,_0x1496d1){return db[_0x3d7f('0x2a')][_0x3d7f('0x44')]({'where':{'id':_0x24ff7d['params']['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x574ff2,null))[_0x3d7f('0x23')](function(_0x1f07c6){if(_0x1f07c6){return _0x1f07c6['removeMembers'](_0x24ff7d[_0x3d7f('0x2f')][_0x3d7f('0x4d')]);}})['then'](respondWithStatusCode(_0x574ff2,null))['catch'](handleError(_0x574ff2,null));};exports[_0x3d7f('0x53')]=function(_0x5f36ca,_0x49abed,_0x2df284){if(_0x5f36ca[_0x3d7f('0x46')]['id']){delete _0x5f36ca['body']['id'];}return db['ChatGroup'][_0x3d7f('0x44')]({'where':{'id':_0x5f36ca[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x49abed,null))[_0x3d7f('0x23')](function(_0x3dadc2){if(_0x3dadc2){_0x5f36ca[_0x3d7f('0x46')][_0x3d7f('0x54')]=_0x3dadc2['id'];return db[_0x3d7f('0x4a')][_0x3d7f('0x45')](_0x5f36ca[_0x3d7f('0x46')]);}})[_0x3d7f('0x23')](respondWithResult(_0x49abed,null))['catch'](handleError(_0x49abed,null));};exports['getMessages']=function(_0x4cc968,_0x315eeb,_0x43477d){var _0x1c44c4={};var _0x10821b={};var _0x4dcca6;var _0xd9f006;return db[_0x3d7f('0x2a')][_0x3d7f('0x55')]({'where':{'id':_0x4cc968[_0x3d7f('0x42')]['id']}})[_0x3d7f('0x23')](handleEntityNotFound(_0x315eeb,null))[_0x3d7f('0x23')](function(_0x526d2b){if(_0x526d2b){_0x4dcca6=_0x526d2b;_0x10821b[_0x3d7f('0x33')]=_[_0x3d7f('0x30')](db[_0x3d7f('0x4a')][_0x3d7f('0x2b')]);_0x10821b[_0x3d7f('0x2f')]=_['keys'](_0x4cc968['query']);_0x10821b[_0x3d7f('0x31')]=_['intersection'](_0x10821b[_0x3d7f('0x33')],_0x10821b[_0x3d7f('0x2f')]);_0x1c44c4[_0x3d7f('0x35')]=_[_0x3d7f('0x32')](_0x10821b[_0x3d7f('0x33')],qs[_0x3d7f('0x34')](_0x4cc968[_0x3d7f('0x2f')]['fields']));_0x1c44c4[_0x3d7f('0x35')]=_0x1c44c4[_0x3d7f('0x35')][_0x3d7f('0x43')]?_0x1c44c4[_0x3d7f('0x35')]:_0x10821b[_0x3d7f('0x33')];_0x1c44c4[_0x3d7f('0x38')]=qs[_0x3d7f('0x51')](_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x51')]);_0x1c44c4[_0x3d7f('0x39')]=qs[_0x3d7f('0x31')](_[_0x3d7f('0x3a')](_0x4cc968[_0x3d7f('0x2f')],_0x10821b[_0x3d7f('0x31')]));if(_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x3b')]){_0x1c44c4[_0x3d7f('0x39')]=_['merge'](_0x1c44c4[_0x3d7f('0x39')],{'$or':_['map'](_0x1c44c4[_0x3d7f('0x35')],function(_0x924173){var _0x46f69c={};_0x46f69c[_0x924173]={'$like':'%'+_0x4cc968['query'][_0x3d7f('0x3b')]+'%'};return _0x46f69c;})});}if(_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x56')]){var _0x510243=_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x56')]['split'](',');var _0x579617={};_0x579617[_0x510243[0x0]]={'$gte':moment(_0x510243[0x1])[_0x3d7f('0x57')](_0x3d7f('0x58'))};_0x1c44c4['where']=_[_0x3d7f('0x3c')](_0x1c44c4[_0x3d7f('0x39')],_0x579617);}_0x1c44c4=_[_0x3d7f('0x3c')]({},_0x1c44c4,_0x4cc968[_0x3d7f('0x3e')]);return _0x4dcca6['getMessages'](_0x1c44c4);}})[_0x3d7f('0x23')](function(_0x40caa4){if(_0x40caa4){_0xd9f006=_0x40caa4[_0x3d7f('0x43')];if(!_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x36')]('nolimit')){_0x1c44c4[_0x3d7f('0x1d')]=qs['limit'](_0x4cc968[_0x3d7f('0x2f')][_0x3d7f('0x1d')]);_0x1c44c4[_0x3d7f('0x1b')]=qs[_0x3d7f('0x1b')](_0x4cc968['query'][_0x3d7f('0x1b')]);}return _0x4dcca6[_0x3d7f('0x59')](_0x1c44c4);}})[_0x3d7f('0x23')](function(_0x23f25e){if(_0x23f25e){return _0x23f25e?{'count':_0xd9f006,'rows':_0x23f25e}:null;}})[_0x3d7f('0x23')](respondWithResult(_0x315eeb,null))['catch'](handleError(_0x315eeb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 598dadf..1a4efc2 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 _0xd237=['emit','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x29f06c,_0x2af734){var _0x4b8359=function(_0x3eeef8){while(--_0x3eeef8){_0x29f06c['push'](_0x29f06c['shift']());}};_0x4b8359(++_0x2af734);}(_0xd237,0x12b));var _0x7d23=function(_0x4b4b1a,_0x276dd5){_0x4b4b1a=_0x4b4b1a-0x0;var _0x5056ec=_0xd237[_0x4b4b1a];return _0x5056ec;};'use strict';var EventEmitter=require(_0x7d23('0x0'));var ChatGroup=require(_0x7d23('0x1'))['db'][_0x7d23('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7d23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x288134){return function(_0x2c0505,_0x2bc609,_0x39ec94){ChatGroupEvents[_0x7d23('0x5')](_0x288134+':'+_0x2c0505['id'],_0x2c0505);ChatGroupEvents['emit'](_0x288134,_0x2c0505);_0x39ec94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x7d23('0x6')](e,emitEvent(event));}}module[_0x7d23('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xb9d9=['../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x3777aa,_0x16229c){var _0x4247f3=function(_0x4f54cc){while(--_0x4f54cc){_0x3777aa['push'](_0x3777aa['shift']());}};_0x4247f3(++_0x16229c);}(_0xb9d9,0x104));var _0x9b9d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb9d9[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x9b9d('0x0'));var ChatGroup=require(_0x9b9d('0x1'))['db'][_0x9b9d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9b9d('0x3')](0x0);var events={'afterCreate':_0x9b9d('0x4'),'afterUpdate':_0x9b9d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ef1dd){return function(_0x1810cf,_0xc8f8ad,_0x3d7109){ChatGroupEvents['emit'](_0x2ef1dd+':'+_0x1810cf['id'],_0x1810cf);ChatGroupEvents[_0x9b9d('0x6')](_0x2ef1dd,_0x1810cf);_0x3d7109(null);};}for(var e in events){if(events[_0x9b9d('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x9b9d('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1d1386e..39973a1 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 _0x09e8=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x2671be,_0x5ce4fa){var _0x386b62=function(_0x5a0f5a){while(--_0x5a0f5a){_0x2671be['push'](_0x2671be['shift']());}};_0x386b62(++_0x5ce4fa);}(_0x09e8,0xf5));var _0x809e=function(_0x394be4,_0x56ca61){_0x394be4=_0x394be4-0x0;var _0x30218e=_0x09e8[_0x394be4];return _0x30218e;};'use strict';var _=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var logger=require(_0x809e('0x2'))(_0x809e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x809e('0x4'));var fs=require('fs');var path=require(_0x809e('0x5'));var rimraf=require(_0x809e('0x6'));var config=require(_0x809e('0x7'));var attributes=require(_0x809e('0x8'));module[_0x809e('0x9')]=function(_0x4d44e6,_0x3f8c1d){return _0x4d44e6[_0x809e('0xa')](_0x809e('0xb'),attributes,{'tableName':_0x809e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c7d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x388280,_0x5f3c13){var _0x1f2dd6=function(_0xeefd97){while(--_0xeefd97){_0x388280['push'](_0x388280['shift']());}};_0x1f2dd6(++_0x5f3c13);}(_0x8c7d,0x1cf));var _0xd8c7=function(_0x1a4971,_0x551027){_0x1a4971=_0x1a4971-0x0;var _0x50326b=_0x8c7d[_0x1a4971];return _0x50326b;};'use strict';var _=require(_0xd8c7('0x0'));var util=require(_0xd8c7('0x1'));var logger=require(_0xd8c7('0x2'))(_0xd8c7('0x3'));var moment=require(_0xd8c7('0x4'));var BPromise=require(_0xd8c7('0x5'));var rp=require(_0xd8c7('0x6'));var fs=require('fs');var path=require(_0xd8c7('0x7'));var rimraf=require(_0xd8c7('0x8'));var config=require(_0xd8c7('0x9'));var attributes=require('./chatGroup.attributes');module[_0xd8c7('0xa')]=function(_0x7c17a5,_0x5826b1){return _0x7c17a5['define'](_0xd8c7('0xb'),attributes,{'tableName':_0xd8c7('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 58eb9c8..cb76684 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 _0xa1f6=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','request\x20sent','debug'];(function(_0xf6b083,_0x49a944){var _0x529170=function(_0x1dd2b9){while(--_0x1dd2b9){_0xf6b083['push'](_0xf6b083['shift']());}};_0x529170(++_0x49a944);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xa1f6[_0x104a84];return _0x4973ff;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));var BPromise=require(_0x6a1f('0x3'));var rs=require(_0x6a1f('0x4'));var fs=require('fs');var Redis=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a1f('0x6'));var client=jayson[_0x6a1f('0x7')][_0x6a1f('0x8')]({'port':0x232a});config[_0x6a1f('0x9')]=_[_0x6a1f('0xa')](config[_0x6a1f('0x9')],{'host':_0x6a1f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a1f('0x9')]));require(_0x6a1f('0xc'))[_0x6a1f('0xd')](socket);function respondWithRpcPromise(_0x287e54,_0x1617b7,_0x5aafd2){return new BPromise(function(_0x30fd4e,_0x17f866){return client[_0x6a1f('0xe')](_0x287e54,_0x5aafd2)[_0x6a1f('0xf')](function(_0x59fc17){logger[_0x6a1f('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1617b7,_0x6a1f('0x11'));logger[_0x6a1f('0x12')](_0x6a1f('0x13'),_0x1617b7,_0x6a1f('0x11'),JSON[_0x6a1f('0x14')](_0x59fc17));if(_0x59fc17[_0x6a1f('0x15')]){if(_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x16')]===0x1f4){logger[_0x6a1f('0x15')](_0x6a1f('0x17'),_0x1617b7,_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);return _0x17f866(_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);}logger[_0x6a1f('0x15')](_0x6a1f('0x17'),_0x1617b7,_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);return _0x30fd4e(_0x59fc17[_0x6a1f('0x15')]['message']);}else{logger[_0x6a1f('0x10')](_0x6a1f('0x17'),_0x1617b7,_0x6a1f('0x11'));_0x30fd4e(_0x59fc17[_0x6a1f('0x19')][_0x6a1f('0x18')]);}})[_0x6a1f('0x1a')](function(_0x19562a){logger[_0x6a1f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1617b7,_0x19562a);_0x17f866(_0x19562a);});});} \ No newline at end of file +var _0x624c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','code','ChatGroup,\x20%s,\x20%s','error','message','result'];(function(_0x1286db,_0x10d323){var _0x3dcbd0=function(_0x30f5ee){while(--_0x30f5ee){_0x1286db['push'](_0x1286db['shift']());}};_0x3dcbd0(++_0x10d323);}(_0x624c,0x1ee));var _0xc624=function(_0x266b0c,_0x4fb269){_0x266b0c=_0x266b0c-0x0;var _0xd1bfa7=_0x624c[_0x266b0c];return _0xd1bfa7;};'use strict';var _=require('lodash');var util=require(_0xc624('0x0'));var moment=require(_0xc624('0x1'));var BPromise=require(_0xc624('0x2'));var rs=require(_0xc624('0x3'));var fs=require('fs');var Redis=require(_0xc624('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc624('0x5'));var logger=require('../../config/logger')(_0xc624('0x6'));var config=require('../../config/environment');var jayson=require(_0xc624('0x7'));var client=jayson[_0xc624('0x8')][_0xc624('0x9')]({'port':0x232a});config[_0xc624('0xa')]=_[_0xc624('0xb')](config[_0xc624('0xa')],{'host':_0xc624('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc624('0xa')]));require(_0xc624('0xd'))[_0xc624('0xe')](socket);function respondWithRpcPromise(_0x542c5e,_0x44e4d9,_0x2ad32e){return new BPromise(function(_0x4a7cf1,_0x313512){return client[_0xc624('0xf')](_0x542c5e,_0x2ad32e)[_0xc624('0x10')](function(_0x113b89){logger[_0xc624('0x11')]('ChatGroup,\x20%s,\x20%s',_0x44e4d9,_0xc624('0x12'));logger[_0xc624('0x13')](_0xc624('0x14'),_0x44e4d9,_0xc624('0x12'),JSON['stringify'](_0x113b89));if(_0x113b89['error']){if(_0x113b89['error'][_0xc624('0x15')]===0x1f4){logger['error'](_0xc624('0x16'),_0x44e4d9,_0x113b89[_0xc624('0x17')][_0xc624('0x18')]);return _0x313512(_0x113b89[_0xc624('0x17')][_0xc624('0x18')]);}logger[_0xc624('0x17')]('ChatGroup,\x20%s,\x20%s',_0x44e4d9,_0x113b89[_0xc624('0x17')][_0xc624('0x18')]);return _0x4a7cf1(_0x113b89[_0xc624('0x17')]['message']);}else{logger[_0xc624('0x11')](_0xc624('0x16'),_0x44e4d9,'request\x20sent');_0x4a7cf1(_0x113b89[_0xc624('0x19')][_0xc624('0x18')]);}})['catch'](function(_0x3dad91){logger['error']('ChatGroup,\x20%s,\x20%s',_0x44e4d9,_0x3dad91);_0x313512(_0x3dad91);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e8c1ef3..56eb209 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 _0x3265=['register','length','chatGroup:','remove','update','emit'];(function(_0x3252f7,_0x1678e5){var _0x591cf0=function(_0x2b3e53){while(--_0x2b3e53){_0x3252f7['push'](_0x3252f7['shift']());}};_0x591cf0(++_0x1678e5);}(_0x3265,0x165));var _0x5326=function(_0x4d804e,_0x33b1ef){_0x4d804e=_0x4d804e-0x0;var _0x645a8e=_0x3265[_0x4d804e];return _0x645a8e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x5326('0x0'),_0x5326('0x1')];function createListener(_0x43d80f,_0x505003){return function(_0x3dbd91){_0x505003[_0x5326('0x2')](_0x43d80f,_0x3dbd91);};}function removeListener(_0x1a81e9,_0x5d6785){return function(){ChatGroupEvents['removeListener'](_0x1a81e9,_0x5d6785);};}exports[_0x5326('0x3')]=function(_0x5b2830){for(var _0x5a1974=0x0,_0x5c130f=events[_0x5326('0x4')];_0x5a1974<_0x5c130f;_0x5a1974++){var _0x4a1241=events[_0x5a1974];var _0x357625=createListener(_0x5326('0x5')+_0x4a1241,_0x5b2830);ChatGroupEvents['on'](_0x4a1241,_0x357625);}}; \ No newline at end of file +var _0x3c36=['save','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3c36,0x1d4));var _0x63c3=function(_0x6f01e4,_0x20f67a){_0x6f01e4=_0x6f01e4-0x0;var _0x15649e=_0x3c36[_0x6f01e4];return _0x15649e;};'use strict';var ChatGroupEvents=require(_0x63c3('0x0'));var events=[_0x63c3('0x1'),'remove','update'];function createListener(_0x5bdc10,_0x121482){return function(_0x358930){_0x121482[_0x63c3('0x2')](_0x5bdc10,_0x358930);};}function removeListener(_0x8b684f,_0x2eeceb){return function(){ChatGroupEvents[_0x63c3('0x3')](_0x8b684f,_0x2eeceb);};}exports[_0x63c3('0x4')]=function(_0x4799e){for(var _0x496551=0x0,_0x2b0899=events[_0x63c3('0x5')];_0x496551<_0x2b0899;_0x496551++){var _0x9f7fab=events[_0x496551];var _0x338ca3=createListener(_0x63c3('0x6')+_0x9f7fab,_0x4799e);ChatGroupEvents['on'](_0x9f7fab,_0x338ca3);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d1f6315..b592a6b 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 _0x5974=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','put','destroy','delete','removeMembers','exports','multer','path'];(function(_0x112595,_0x50b0c2){var _0x4b2ea7=function(_0x42253f){while(--_0x42253f){_0x112595['push'](_0x112595['shift']());}};_0x4b2ea7(++_0x50b0c2);}(_0x5974,0x11c));var _0x4597=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x5974[_0x255c48];return _0xaebda3;};'use strict';var multer=require(_0x4597('0x0'));var util=require('util');var path=require(_0x4597('0x1'));var timeout=require(_0x4597('0x2'));var express=require(_0x4597('0x3'));var router=express['Router']();var fs_extra=require(_0x4597('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4597('0x5'));var config=require(_0x4597('0x6'));var controller=require(_0x4597('0x7'));router[_0x4597('0x8')]('/',auth['isAuthenticated'](),controller[_0x4597('0x9')]);router[_0x4597('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4597('0xa')]);router[_0x4597('0x8')](_0x4597('0xb'),auth[_0x4597('0xc')](),controller[_0x4597('0xd')]);router[_0x4597('0x8')](_0x4597('0xe'),auth[_0x4597('0xc')](),controller[_0x4597('0xf')]);router[_0x4597('0x8')](_0x4597('0x10'),auth['isAuthenticated'](),controller[_0x4597('0x11')]);router[_0x4597('0x8')](_0x4597('0x12'),auth[_0x4597('0xc')](),controller[_0x4597('0x13')]);router[_0x4597('0x14')]('/',auth[_0x4597('0xc')](),controller['create']);router[_0x4597('0x14')](_0x4597('0x10'),auth[_0x4597('0xc')](),controller['addMembers']);router[_0x4597('0x14')]('/:id/messages',auth[_0x4597('0xc')](),controller['addMessage']);router[_0x4597('0x15')](_0x4597('0xb'),auth[_0x4597('0xc')](),controller['update']);router['delete'](_0x4597('0xb'),auth['isAuthenticated'](),controller[_0x4597('0x16')]);router[_0x4597('0x17')](_0x4597('0x10'),auth[_0x4597('0xc')](),controller[_0x4597('0x18')]);module[_0x4597('0x19')]=router; \ No newline at end of file +var _0x76a3=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread'];(function(_0x13ae91,_0x42ec71){var _0x5084c1=function(_0x492fd4){while(--_0x492fd4){_0x13ae91['push'](_0x13ae91['shift']());}};_0x5084c1(++_0x42ec71);}(_0x76a3,0x191));var _0x376a=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x76a3[_0x4191af];return _0x27bebf;};'use strict';var multer=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var path=require(_0x376a('0x2'));var timeout=require(_0x376a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x376a('0x4'));var auth=require(_0x376a('0x5'));var interaction=require(_0x376a('0x6'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x376a('0x7')]('/',auth[_0x376a('0x8')](),controller['index']);router['get'](_0x376a('0x9'),auth[_0x376a('0x8')](),controller[_0x376a('0xa')]);router['get'](_0x376a('0xb'),auth[_0x376a('0x8')](),controller[_0x376a('0xc')]);router['get'](_0x376a('0xd'),auth[_0x376a('0x8')](),controller[_0x376a('0xe')]);router[_0x376a('0x7')](_0x376a('0xf'),auth[_0x376a('0x8')](),controller[_0x376a('0x10')]);router[_0x376a('0x7')](_0x376a('0x11'),auth[_0x376a('0x8')](),controller[_0x376a('0x12')]);router[_0x376a('0x13')]('/',auth['isAuthenticated'](),controller[_0x376a('0x14')]);router[_0x376a('0x13')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x376a('0x13')]('/:id/messages',auth[_0x376a('0x8')](),controller[_0x376a('0x15')]);router['put'](_0x376a('0xb'),auth[_0x376a('0x8')](),controller[_0x376a('0x16')]);router[_0x376a('0x17')]('/:id',auth[_0x376a('0x8')](),controller[_0x376a('0x18')]);router['delete'](_0x376a('0xf'),auth[_0x376a('0x8')](),controller[_0x376a('0x19')]);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 0aaa1ba..e09924a 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 _0xc776=['ENUM','out','sequelize','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING','DATE','long'];(function(_0x211083,_0x14b2ba){var _0x16f197=function(_0x4786df){while(--_0x4786df){_0x211083['push'](_0x211083['shift']());}};_0x16f197(++_0x14b2ba);}(_0xc776,0x19a));var _0x6c77=function(_0x389ec3,_0x54d22c){_0x389ec3=_0x389ec3-0x0;var _0x16ed5a=_0xc776[_0x389ec3];return _0x16ed5a;};'use strict';var Sequelize=require(_0x6c77('0x0'));module[_0x6c77('0x1')]={'closed':{'type':Sequelize[_0x6c77('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6c77('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x6c77('0x4')),'defaultValue':_0x6c77('0x5')},'ratingMessage':{'type':Sequelize[_0x6c77('0x6')]},'pathTranscript':{'type':Sequelize[_0x6c77('0x6')]},'mailTranscript':{'type':Sequelize[_0x6c77('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6c77('0x8')]},'disposition':{'type':Sequelize[_0x6c77('0x7')]},'secondDisposition':{'type':Sequelize[_0x6c77('0x7')]},'thirdDisposition':{'type':Sequelize[_0x6c77('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x6c77('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6c77('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6c77('0x7')]},'deviceType':{'type':Sequelize[_0x6c77('0x7')]},'referer':{'type':Sequelize[_0x6c77('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6c77('0x6')](_0x6c77('0x9'))},'read1stAt':{'type':Sequelize[_0x6c77('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6c77('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6c77('0xa')]('in',_0x6c77('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6c77('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x6c77('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa5bb=['out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x400ac4,_0x2eb641){var _0xda0dc8=function(_0x2a13bb){while(--_0x2a13bb){_0x400ac4['push'](_0x400ac4['shift']());}};_0xda0dc8(++_0x2eb641);}(_0xa5bb,0x18e));var _0xba5b=function(_0x16c3d5,_0x17b09e){_0x16c3d5=_0x16c3d5-0x0;var _0xd8a02a=_0xa5bb[_0x16c3d5];return _0xd8a02a;};'use strict';var Sequelize=require(_0xba5b('0x0'));module[_0xba5b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xba5b('0x2')]},'ratingType':{'type':Sequelize[_0xba5b('0x3')](_0xba5b('0x4'),_0xba5b('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xba5b('0x6')]},'pathTranscript':{'type':Sequelize[_0xba5b('0x6')]},'mailTranscript':{'type':Sequelize[_0xba5b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xba5b('0x8')]},'disposition':{'type':Sequelize[_0xba5b('0x7')]},'secondDisposition':{'type':Sequelize[_0xba5b('0x7')]},'thirdDisposition':{'type':Sequelize[_0xba5b('0x7')]},'note':{'type':Sequelize[_0xba5b('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xba5b('0x7')]},'osName':{'type':Sequelize[_0xba5b('0x7')]},'osVersion':{'type':Sequelize[_0xba5b('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xba5b('0x7')]},'deviceType':{'type':Sequelize[_0xba5b('0x7')]},'referer':{'type':Sequelize[_0xba5b('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xba5b('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xba5b('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xba5b('0x3')]('in',_0xba5b('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xba5b('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xba5b('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xba5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 28ad221..1e42259 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 _0x7280=['originalname','mimetype','Attachment','Unauthorized','attachId','root','join','basename','close','mailTranscript','transcript-%s.txt','now','ChatMessage','Messages','User','format','%s%d','agentAlias','customer','Visitor','ContactId','agentIdentifier','System','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','fields','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','includeAgent','push','alias','addTags','spread','Tag','color','removeTags','download','toString','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','read','Owner','Chat','Account','N.A.','closedAt','browserName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','show','params','model','query','keys','attributes','intersection','length','includeAll','create','find','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file'];(function(_0x285592,_0x98b4f9){var _0x3ee37b=function(_0x4a46b){while(--_0x4a46b){_0x285592['push'](_0x285592['shift']());}};_0x3ee37b(++_0x98b4f9);}(_0x7280,0x12a));var _0x0728=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7280[_0x50a0c2];return _0x5ebadd;};'use strict';var rimraf=require(_0x0728('0x0'));var zipdir=require(_0x0728('0x1'));var rp=require(_0x0728('0x2'));var moment=require(_0x0728('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0728('0x4'));var util=require(_0x0728('0x5'));var path=require(_0x0728('0x6'));var ejs=require(_0x0728('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0728('0x8'));var interaction=require(_0x0728('0x9'));var qs=require(_0x0728('0xa'));var pdf=require(_0x0728('0xb'));var logger=require(_0x0728('0xc'))(_0x0728('0xd'));var config=require(_0x0728('0xe'));var db=require('../../mysqldb')['db'];config[_0x0728('0xf')]=_[_0x0728('0x10')](config[_0x0728('0xf')],{'host':_0x0728('0x11'),'port':0x18eb});var socket=require(_0x0728('0x12'))(new Redis(config[_0x0728('0xf')]));require('./chatInteraction.socket')[_0x0728('0x13')](socket);var jayson=require(_0x0728('0x14'));var client=jayson[_0x0728('0x15')][_0x0728('0x16')]({'port':0x232b});var client9004=jayson['client'][_0x0728('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x1efeaa,_0x121165,_0x4e2c0e,_0x5c90fb){return new BPromise(function(_0x3d10f9,_0x916d3c){var _0x36265c=_0x5c90fb||client;return _0x36265c[_0x0728('0x17')](_0x1efeaa,_0x4e2c0e)[_0x0728('0x18')](function(_0x565ed0){logger[_0x0728('0x19')](_0x0728('0x1a'),_0x121165,_0x0728('0x1b'));logger[_0x0728('0x1c')](_0x0728('0x1d'),_0x121165,_0x0728('0x1b'),JSON[_0x0728('0x1e')](_0x565ed0));if(_0x565ed0['error']){if(_0x565ed0[_0x0728('0x1f')][_0x0728('0x20')]===0x1f4){logger[_0x0728('0x1f')](_0x0728('0x1a'),_0x121165,_0x565ed0['error'][_0x0728('0x21')]);return _0x916d3c(_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);}logger['error'](_0x0728('0x1a'),_0x121165,_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);return _0x3d10f9(_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);}else{logger[_0x0728('0x19')](_0x0728('0x1a'),_0x121165,_0x0728('0x1b'));_0x3d10f9(_0x565ed0[_0x0728('0x22')][_0x0728('0x21')]);}})[_0x0728('0x23')](function(_0x509b67){logger[_0x0728('0x1f')](_0x0728('0x1a'),_0x121165,_0x509b67);_0x916d3c(_0x509b67);});});}function respondWithStatusCode(_0x390d9b,_0x40f572){_0x40f572=_0x40f572||0xcc;return function(_0x1cfcec){if(_0x1cfcec){return _0x390d9b[_0x0728('0x24')](_0x40f572);}return _0x390d9b[_0x0728('0x25')](_0x40f572)[_0x0728('0x26')]();};}function respondWithResult(_0x3dbc4a,_0x1ab55f){_0x1ab55f=_0x1ab55f||0xc8;return function(_0x27bc9e){if(_0x27bc9e){return _0x3dbc4a[_0x0728('0x25')](_0x1ab55f)[_0x0728('0x27')](_0x27bc9e);}};}function respondWithFilteredResult(_0x29091a,_0xa6121a){return function(_0xe3164){if(_0xe3164){var _0x1ccba8=typeof _0xa6121a[_0x0728('0x28')]===_0x0728('0x29')&&typeof _0xa6121a[_0x0728('0x2a')]===_0x0728('0x29');var _0x128a49=_0xe3164[_0x0728('0x2b')];var _0x5d64e6=_0x1ccba8?0x0:_0xa6121a[_0x0728('0x28')];var _0x35a219=_0x1ccba8?_0xe3164['count']:_0xa6121a[_0x0728('0x28')]+_0xa6121a[_0x0728('0x2a')];var _0x559ac3;if(_0x35a219>=_0x128a49){_0x35a219=_0x128a49;_0x559ac3=0xc8;}else{_0x559ac3=0xce;}_0x29091a['status'](_0x559ac3);return _0x29091a[_0x0728('0x2c')](_0x0728('0x2d'),_0x5d64e6+'-'+_0x35a219+'/'+_0x128a49)['json'](_0xe3164);}return null;};}function saveUpdates(_0x5272f6){return function(_0x553253){if(_0x553253){return _0x553253['update'](_0x5272f6)[_0x0728('0x18')](function(_0x1a254f){return _0x1a254f;});}return null;};}function removeEntity(_0x1aed4a){return function(_0x14e0ad){if(_0x14e0ad){return _0x14e0ad[_0x0728('0x2e')]()[_0x0728('0x18')](function(){_0x1aed4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f63d){return function(_0x12117c){if(!_0x12117c){_0x45f63d[_0x0728('0x24')](0x194);}return _0x12117c;};}function handleError(_0x1f30ee,_0x219f1f){_0x219f1f=_0x219f1f||0x1f4;return function(_0x5a8cf2){logger[_0x0728('0x1f')](_0x5a8cf2[_0x0728('0x2f')]);if(_0x5a8cf2[_0x0728('0x30')]){delete _0x5a8cf2['name'];}_0x1f30ee[_0x0728('0x25')](_0x219f1f)[_0x0728('0x31')](_0x5a8cf2);};}function getMustacheRender(_0x2aded2,_0x468a16){return Mustache[_0x0728('0x32')](_0x2aded2,_[_0x0728('0x33')](_0x468a16[_0x0728('0x34')],{'contact':_0x468a16[_0x0728('0x35')],'message':_0x468a16[_0x0728('0x21')],'agent':_0x468a16[_0x0728('0x36')],'interaction':_0x468a16[_0x0728('0x37')],'account':_0x468a16[_0x0728('0x38')]}))||'';}exports[_0x0728('0x39')]=function(_0x276699,_0x45ee49){var _0x77a394={};var _0x3af80b=_[_0x0728('0x3a')](db[_0x0728('0x3b')][_0x0728('0x3c')],function(_0x314042){return{'name':_0x314042[_0x0728('0x3d')],'type':_0x314042[_0x0728('0x3e')]['key']};});_0x77a394=qs[_0x0728('0x3f')](_0x3af80b,_0x276699);return interaction[_0x0728('0x40')](_0x0728('0x41'),_0x276699['query'],_0x276699['user'],_0x77a394,_0x3af80b)[_0x0728('0x18')](respondWithFilteredResult(_0x45ee49,_0x77a394))[_0x0728('0x23')](handleError(_0x45ee49,null));};exports[_0x0728('0x42')]=function(_0x44c475,_0x267f78){var _0x101352={'raw':![],'where':{'id':_0x44c475[_0x0728('0x43')]['id']}},_0x489ae6={};_0x489ae6[_0x0728('0x44')]=_['keys'](db[_0x0728('0x3b')][_0x0728('0x3c')]);_0x489ae6[_0x0728('0x45')]=_[_0x0728('0x46')](_0x44c475[_0x0728('0x45')]);_0x489ae6['filters']=_['intersection'](_0x489ae6[_0x0728('0x44')],_0x489ae6[_0x0728('0x45')]);_0x101352[_0x0728('0x47')]=_[_0x0728('0x48')](_0x489ae6[_0x0728('0x44')],qs['fields'](_0x44c475['query']['fields']));_0x101352[_0x0728('0x47')]=_0x101352[_0x0728('0x47')][_0x0728('0x49')]?_0x101352[_0x0728('0x47')]:_0x489ae6['model'];if(_0x44c475[_0x0728('0x45')][_0x0728('0x4a')]){_0x101352['include']=[{'all':!![]}];}_0x101352=_[_0x0728('0x33')]({},_0x101352,_0x44c475['options']);return db['ChatInteraction']['find'](_0x101352)['then'](handleEntityNotFound(_0x267f78,null))[_0x0728('0x18')](respondWithResult(_0x267f78,null))[_0x0728('0x23')](handleError(_0x267f78,null));};exports['create']=function(_0x330ca0,_0x4ad37a){return db[_0x0728('0x3b')][_0x0728('0x4b')](_0x330ca0[_0x0728('0x34')],{})[_0x0728('0x18')](respondWithResult(_0x4ad37a,0xc9))[_0x0728('0x23')](handleError(_0x4ad37a,null));};exports['update']=function(_0x2f8878,_0x89aabf){if(_0x2f8878[_0x0728('0x34')]['id']){delete _0x2f8878[_0x0728('0x34')]['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x2f8878['params']['id']}})['then'](handleEntityNotFound(_0x89aabf,null))['then'](saveUpdates(_0x2f8878[_0x0728('0x34')],null))[_0x0728('0x18')](respondWithResult(_0x89aabf,null))[_0x0728('0x23')](handleError(_0x89aabf,null));};exports[_0x0728('0x2e')]=function(_0x4112d8,_0x4fd648){return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x4112d8[_0x0728('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fd648,null))[_0x0728('0x18')](removeEntity(_0x4fd648,null))[_0x0728('0x23')](handleError(_0x4fd648,null));};exports[_0x0728('0x4d')]=function(_0xc3124d,_0x2fec06){return db['ChatInteraction'][_0x0728('0x4d')]()[_0x0728('0x18')](respondWithResult(_0x2fec06,null))['catch'](handleError(_0x2fec06,null));};exports['createVidaooSession']=function(_0x5d45db,_0x4c52f1){var _0x3666d5=_0x5d45db['params']['id'];var _0x6f64c2;var _0x21ce97;var _0x3c45d9;return db['ChatInteraction'][_0x0728('0x4e')]({'where':{'id':_0x3666d5}})[_0x0728('0x18')](function(_0xdc657e){_0x6f64c2=_0xdc657e;return db[_0x0728('0x4f')][_0x0728('0x4e')]({'where':{'id':_0xdc657e['ChatWebsiteId']},'attributes':['id',_0x0728('0x50'),_0x0728('0x51'),_0x0728('0x52'),_0x0728('0x53'),_0x0728('0x54')],'raw':!![]});})[_0x0728('0x18')](function(_0x546f86){if(_0x546f86&&_0x546f86[_0x0728('0x50')]&&_0x546f86[_0x0728('0x51')]){_0x21ce97=_0x546f86;var _0x416f42={'interaction':{'id':_0x3666d5},'agent':{'id':_0x5d45db[_0x0728('0x55')]['id'],'name':_0x5d45db[_0x0728('0x55')]['name'],'fullname':_0x5d45db[_0x0728('0x55')][_0x0728('0x56')],'email':_0x5d45db['user'][_0x0728('0x57')]},'contact':_0x5d45db['body'][_0x0728('0x35')],'account':_0x5d45db[_0x0728('0x34')][_0x0728('0x38')]};var _0x411620={'rejectUnauthorized':![],'method':_0x0728('0x58'),'url':_0x0728('0x59'),'headers':{'X-APIKEY':_0x546f86[_0x0728('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5d45db[_0x0728('0x55')][_0x0728('0x57')]],'buttons':null,'topic':_0x21ce97[_0x0728('0x52')],'note':_['isNull'](_0x21ce97[_0x0728('0x53')])?null:getMustacheRender(_0x21ce97[_0x0728('0x53')],_0x416f42),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x21ce97[_0x0728('0x54')])){var _0x2322db=getMustacheRender(_0x21ce97['vidaooMetadata'],_0x416f42);var _0x109ad0=JSON['parse'](_0x2322db);_0x411620['body'][_0x0728('0x5a')]=_0x109ad0;}}catch(_0x953e4e){throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x5d'));}return rp(_0x411620);}else{throw new db['Sequelize'][(_0x0728('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x0728('0x18')](function(_0x35e79c){_0x3c45d9=_0x35e79c;if(_0x3c45d9['id']){var _0x23798b={'body':_0x3c45d9[_0x0728('0x5e')],'ChatWebsiteId':_0x21ce97['id'],'ChatInteractionId':_0x6f64c2['id'],'direction':_0x0728('0x5f'),'UserId':_0x5d45db[_0x0728('0x55')]['id']};return db['ChatMessage']['create'](_0x23798b,{});}else{throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x60'));}})['then'](function(){return _0x6f64c2['updateAttributes']({'vidaooSessionId':_0x3c45d9['id']});})[_0x0728('0x18')](respondWithResult(_0x4c52f1,null))[_0x0728('0x23')](handleError(_0x4c52f1,null));};exports[_0x0728('0x61')]=function(_0xb61dac,_0x74b3ca){if(_0xb61dac[_0x0728('0x34')]['id']){delete _0xb61dac[_0x0728('0x34')]['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0xb61dac[_0x0728('0x43')]['id']},'include':[{'model':db[_0x0728('0x62')],'as':_0x0728('0x63')}]})[_0x0728('0x18')](handleEntityNotFound(_0x74b3ca,null))[_0x0728('0x18')](saveUpdates(_0xb61dac[_0x0728('0x34')],null))['then'](respondWithResult(_0x74b3ca,null))[_0x0728('0x23')](handleError(_0x74b3ca,null));};exports['abandon']=function(_0x58f544,_0x5b4fea){if(_0x58f544[_0x0728('0x34')]['id']){delete _0x58f544['body']['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x58f544[_0x0728('0x43')]['id']}})[_0x0728('0x18')](function(_0x455385){if(!_0x455385){logger[_0x0728('0x1f')](_0x0728('0x64'),_0x0728('0x65'),0x194,_0x0728('0x66'));_0x5b4fea[_0x0728('0x24')](0x194);}else{if(_0x455385[_0x0728('0x67')]){throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x68'));}}return _0x455385;})[_0x0728('0x18')](function(_0x4909d5){if(_0x4909d5){return _0x4909d5['update']({'closed':_0x58f544[_0x0728('0x34')][_0x0728('0x69')],'disposition':_0x58f544[_0x0728('0x34')][_0x0728('0x6a')]})['then'](function(_0x4a881d){return _0x4a881d;});}})[_0x0728('0x18')](function(){return respondWithRpcPromise(_0x0728('0x6b'),_0x0728('0x65'),_0x58f544[_0x0728('0x34')],client9004);})[_0x0728('0x18')](respondWithResult(_0x5b4fea,null))[_0x0728('0x23')](handleError(_0x5b4fea,null));};exports[_0x0728('0x6c')]=function(_0x4e4342,_0xc238be){_0x4e4342[_0x0728('0x34')][_0x0728('0x30')]=_0x4e4342[_0x0728('0x6d')][_0x0728('0x6e')];_0x4e4342['body']['basename']=_0x4e4342[_0x0728('0x6d')]['filename'];_0x4e4342['body'][_0x0728('0x3e')]=_0x4e4342['file'][_0x0728('0x6f')];return db[_0x0728('0x70')]['create'](_0x4e4342[_0x0728('0x34')])[_0x0728('0x18')](respondWithResult(_0xc238be,0xc9))['catch'](handleError(_0xc238be,null));};exports['attachmentDownload']=function(_0x25ce22,_0x33c0cc){return db[_0x0728('0x3b')][_0x0728('0x4e')]({'where':{'id':_0x25ce22['params']['id']},'raw':!![]})[_0x0728('0x18')](handleEntityNotFound(_0x33c0cc,null))[_0x0728('0x18')](function(_0x40cc33){if(_0x40cc33){if(_0x40cc33[_0x0728('0x69')]){return _0x33c0cc['status'](0x193)[_0x0728('0x27')]({'status':0x193,'message':_0x0728('0x71')});}return db[_0x0728('0x70')][_0x0728('0x4e')]({'where':{'id':_0x25ce22['query'][_0x0728('0x72')]},'raw':!![]})[_0x0728('0x18')](handleEntityNotFound(_0x33c0cc,null));}})['then'](function(_0x5707b6){if(_0x5707b6){var _0x27c8b3=_0x5707b6['ChatOfflineMessageId']!==null;var _0x32e4bd=path['join'](config[_0x0728('0x73')],'server/files/attachments/');if(_0x27c8b3){_0x32e4bd=path[_0x0728('0x74')](_0x32e4bd,'offline-chat/');}var _0x3a3f66=path[_0x0728('0x74')](_0x32e4bd,_0x5707b6[_0x0728('0x75')]);return _0x33c0cc['download'](_0x3a3f66);}})['catch'](handleError(_0x33c0cc,null));};exports[_0x0728('0x76')]=function(_0x1bdacd,_0x29a546){var _0x281a67=null;var _0x83fa4c=null;var _0x1a9c5b=null;if(_0x1bdacd[_0x0728('0x34')]['id']){delete _0x1bdacd[_0x0728('0x34')]['id'];}if(_0x1bdacd[_0x0728('0x34')][_0x0728('0x77')]){_0x1a9c5b=path[_0x0728('0x74')](config[_0x0728('0x73')],'server/files/chat/upload/',util['format'](_0x0728('0x78'),Date[_0x0728('0x79')]()));_0x1bdacd[_0x0728('0x34')]['pathTranscript']=_0x1a9c5b;}return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x1bdacd['params']['id']},'include':[{'model':db[_0x0728('0x7a')],'as':_0x0728('0x7b'),'include':[{'model':db[_0x0728('0x7c')],'as':_0x0728('0x7c')}]}]})[_0x0728('0x18')](handleEntityNotFound(_0x29a546,null))[_0x0728('0x18')](saveUpdates(_0x1bdacd['body'],null))[_0x0728('0x18')](function(_0x2e2ea6){if(_0x2e2ea6){_0x281a67=_0x2e2ea6;return db['ChatWebsite'][_0x0728('0x4c')]({'where':{'id':_0x281a67['ChatWebsiteId']}});}})[_0x0728('0x18')](function(_0x1e9789){if(_0x1e9789){_0x83fa4c=_0x1e9789;return db['CmContact'][_0x0728('0x4c')]({'where':{'id':_0x281a67['ContactId']}});}})[_0x0728('0x18')](function(_0x28b9f1){if(_0x28b9f1){if(_0x1a9c5b){var _0x319cf3=null;for(var _0x5230f8=0x1;_0x5230f8<_0x281a67['Messages'][_0x0728('0x49')];++_0x5230f8){_0x319cf3=_0x281a67[_0x0728('0x7b')][_0x5230f8];var _0x4b9beb=_0x319cf3['UserId']?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c[_0x0728('0x7f')],_0x319cf3[_0x0728('0x67')]):'System';var _0x2c4d21=_0x1bdacd[_0x0728('0x34')][_0x0728('0x80')]||util[_0x0728('0x7d')](_0x0728('0x7e'),_0x0728('0x81'),_0x319cf3[_0x0728('0x82')]);switch(_0x83fa4c[_0x0728('0x83')]){case'website_alias':_0x4b9beb=_0x319cf3[_0x0728('0x67')]?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c['agentAlias'],_0x319cf3[_0x0728('0x67')]):_0x0728('0x84');break;case'agent_alias':_0x4b9beb=_0x319cf3[_0x0728('0x67')]?_0x319cf3[_0x0728('0x7c')]['alias']||_0x319cf3[_0x0728('0x7c')]['fullname']:_0x0728('0x84');break;case'agent_fullname':_0x4b9beb=_0x319cf3['UserId']?_0x319cf3[_0x0728('0x7c')][_0x0728('0x56')]:_0x0728('0x84');break;default:_0x4b9beb=_0x319cf3[_0x0728('0x67')]?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c[_0x0728('0x7f')],_0x319cf3[_0x0728('0x67')]):'System';}var _0x4506bf=util[_0x0728('0x7d')](_0x0728('0x85'),moment(_0x319cf3['createdAt'])[_0x0728('0x7d')]('MM/DD/YYYY\x20HH:mm:ss'),_0x319cf3[_0x0728('0x86')]==='in'?_0x2c4d21:_0x4b9beb,_0x319cf3['body']);if(!_0x319cf3[_0x0728('0x87')]){fs[_0x0728('0x88')](_0x1a9c5b,_0x4506bf);}}return db[_0x0728('0x89')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0728('0x8a')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0728('0x8b')],'as':_0x0728('0x8b'),'raw':!![]}]}]});}}})[_0x0728('0x18')](function(_0x394a82){if(!_0x394a82||!_0x394a82[_0x0728('0x8c')]||!_0x1bdacd[_0x0728('0x34')])return _0x281a67;var _0x411c91=_0x394a82['getSmtpOptions']();return respondWithRpcPromise(_0x0728('0x8d'),_0x0728('0x8e'),{'account':_0x411c91,'message':{'from':util[_0x0728('0x7d')](_0x0728('0x8f'),_0x394a82['name'],_0x394a82['email']||_0x394a82[_0x0728('0x8c')][_0x0728('0x55')]),'to':_0x1bdacd[_0x0728('0x34')][_0x0728('0x77')],'subject':_0x0728('0x90'),'text':util[_0x0728('0x7d')](_0x0728('0x91'),_0x1bdacd[_0x0728('0x34')]['mailTranscript']),'attachments':[{'path':_0x1a9c5b}]}})['then'](function(){return _0x281a67;})['catch'](function(_0x2b1bfb){logger[_0x0728('0x1f')](_0x2b1bfb);});})[_0x0728('0x18')](respondWithStatusCode(_0x29a546,0xc8))[_0x0728('0x23')](handleError(_0x29a546,null));};exports[_0x0728('0x92')]=function(_0xd6fded,_0x2a9986){return db['ChatMessage'][_0x0728('0x4c')]({'where':{'id':_0xd6fded[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x2a9986,null))[_0x0728('0x18')](function(_0x1cf1fd){if(_0x1cf1fd){return _0x1cf1fd['addMessage'](_0xd6fded[_0x0728('0x34')][_0x0728('0x93')],_[_0x0728('0x94')](_0xd6fded[_0x0728('0x34')],[_0x0728('0x93'),'id'])||{});}})['then'](respondWithResult(_0x2a9986,null))[_0x0728('0x23')](handleError(_0x2a9986,null));};exports[_0x0728('0x95')]=function(_0x18b07d,_0x2120d4){var _0x197047={'raw':![],'where':{}};var _0x5be074={};var _0x18ecb7={'count':0x0,'rows':[]};return db[_0x0728('0x3b')]['findOne']({'where':{'id':_0x18b07d[_0x0728('0x43')]['id']}})['then'](handleEntityNotFound(_0x2120d4,null))[_0x0728('0x18')](function(_0x375ec4){if(_0x375ec4){_0x5be074['model']=_['keys'](db['ChatMessage']['rawAttributes']);_0x5be074['query']=_[_0x0728('0x46')](_0x18b07d[_0x0728('0x45')]);_0x5be074[_0x0728('0x96')]=_[_0x0728('0x48')](_0x5be074['model'],_0x5be074[_0x0728('0x45')]);_0x197047[_0x0728('0x47')]=_[_0x0728('0x48')](_0x5be074['model'],qs[_0x0728('0x97')](_0x18b07d[_0x0728('0x45')]['fields']));_0x197047[_0x0728('0x47')]=_0x197047[_0x0728('0x47')]['length']?_0x197047[_0x0728('0x47')]:_0x5be074[_0x0728('0x44')];if(!_0x18b07d[_0x0728('0x45')][_0x0728('0x98')](_0x0728('0x99'))){_0x197047[_0x0728('0x2a')]=qs[_0x0728('0x2a')](_0x18b07d[_0x0728('0x45')]['limit']);_0x197047[_0x0728('0x28')]=qs[_0x0728('0x28')](_0x18b07d['query'][_0x0728('0x28')]);}_0x197047[_0x0728('0x9a')]=qs[_0x0728('0x9b')](_0x18b07d[_0x0728('0x45')][_0x0728('0x9b')]);_0x197047['where']=qs[_0x0728('0x96')](_[_0x0728('0x9c')](_0x18b07d['query'],_0x5be074['filters']));_0x197047[_0x0728('0x9d')][_0x0728('0x9e')]=_0x375ec4['id'];if(_0x18b07d[_0x0728('0x45')][_0x0728('0x9f')]){_0x197047[_0x0728('0x9d')]=_[_0x0728('0x33')](_0x197047['where'],{'$or':_[_0x0728('0x3a')](_0x197047[_0x0728('0x47')],function(_0x545a46){var _0x3f1043={};_0x3f1043[_0x545a46]={'$like':'%'+_0x18b07d[_0x0728('0x45')]['filter']+'%'};return _0x3f1043;})});}if(_0x18b07d[_0x0728('0x45')][_0x0728('0xa0')]){var _0x502fad=_0x18b07d[_0x0728('0x45')][_0x0728('0xa0')][_0x0728('0xa1')](',');var _0xc447={};_0xc447[_0x502fad[0x0]]={'$gte':moment(_0x502fad[0x1])['format'](_0x0728('0xa2'))};_0x197047[_0x0728('0x9d')]=_[_0x0728('0x33')](_0x197047['where'],_0xc447);}_0x197047=_[_0x0728('0x33')]({},_0x197047,_0x18b07d[_0x0728('0xa3')]);return db['ChatMessage']['count']({'where':_0x197047['where']})[_0x0728('0x18')](function(_0x10641c){_0x18ecb7[_0x0728('0x2b')]=_0x10641c;if(_0x18b07d[_0x0728('0x45')][_0x0728('0x4a')]){_0x197047[_0x0728('0xa4')]=[{'all':!![]}];}return db[_0x0728('0x7a')][_0x0728('0x40')](_0x197047);})[_0x0728('0x18')](function(_0x5719f8){_0x18ecb7[_0x0728('0xa5')]=_0x5719f8;return _0x18ecb7;});}})['then'](respondWithFilteredResult(_0x2120d4,_0x197047))['catch'](handleError(_0x2120d4,null));};exports[_0x0728('0xa6')]=function(_0x52dcb2,_0x28b6cc){var _0x4ae123={'where':{}},_0xe85fa7={},_0x5540d8={'count':0x0,'rows':[]};return db[_0x0728('0x3b')][_0x0728('0x4e')]({'where':{'id':_0x52dcb2[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x28b6cc,null))[_0x0728('0x18')](function(_0x4272b1){if(_0x4272b1){_0xe85fa7['model']=_['keys'](db[_0x0728('0x7a')]['rawAttributes']);_0xe85fa7[_0x0728('0x45')]=_[_0x0728('0x46')](_0x52dcb2[_0x0728('0x45')]);_0xe85fa7[_0x0728('0x96')]=_[_0x0728('0x48')](_0xe85fa7[_0x0728('0x44')],_0xe85fa7['query']);_0x4ae123[_0x0728('0x47')]=_['intersection'](_0xe85fa7[_0x0728('0x44')],qs['fields'](_0x52dcb2[_0x0728('0x45')][_0x0728('0x97')]));_0x4ae123['attributes']=_0x4ae123[_0x0728('0x47')][_0x0728('0x49')]?_0x4ae123[_0x0728('0x47')]:_0xe85fa7[_0x0728('0x44')];if(!_0x52dcb2['query']['hasOwnProperty']('nolimit')){_0x4ae123[_0x0728('0x2a')]=qs[_0x0728('0x2a')](_0x52dcb2['query']['limit']);_0x4ae123['offset']=qs[_0x0728('0x28')](_0x52dcb2[_0x0728('0x45')][_0x0728('0x28')]);}_0x4ae123[_0x0728('0x9a')]=qs[_0x0728('0x9b')](_0x52dcb2['query'][_0x0728('0x9b')]);_0x4ae123[_0x0728('0x9d')]=qs['filters'](_[_0x0728('0x9c')](_0x52dcb2[_0x0728('0x45')],_0xe85fa7[_0x0728('0x96')]));_0x4ae123['where']['ChatInteractionId']=_0x4272b1['id'];if(_0x52dcb2[_0x0728('0x45')][_0x0728('0x9f')]){_0x4ae123['where']=_[_0x0728('0x33')](_0x4ae123[_0x0728('0x9d')],{'$or':_['map'](_0x4ae123[_0x0728('0x47')],function(_0x5a8cfd){var _0xd37739={};_0xd37739[_0x5a8cfd]={'$like':'%'+_0x52dcb2[_0x0728('0x45')][_0x0728('0x9f')]+'%'};return _0xd37739;})});}_0x4ae123['where'][_0x0728('0x87')]=![];if(_0x52dcb2[_0x0728('0x45')]['id']){_0x4ae123[_0x0728('0x9d')]['id']={'$gt':_0x52dcb2[_0x0728('0x45')]['id']};}_0x4ae123=_['merge']({},_0x4ae123,_0x52dcb2[_0x0728('0xa3')]);return db[_0x0728('0x7a')][_0x0728('0x2b')]({'where':_0x4ae123['where']})[_0x0728('0x18')](function(_0x5b0045){_0x5540d8[_0x0728('0x2b')]=_0x5b0045;_0x4ae123['include']=[];if(_0x52dcb2[_0x0728('0x45')][_0x0728('0xa7')]){_0x4ae123[_0x0728('0xa4')][_0x0728('0xa8')]({'model':db['User'],'as':_0x0728('0x7c'),'attributes':['id',_0x0728('0x56'),_0x0728('0xa9')]});}if(_0x52dcb2[_0x0728('0x45')]['includeAll']){_0x4ae123[_0x0728('0xa4')]=[{'all':!![]}];}return db[_0x0728('0x7a')][_0x0728('0x40')](_0x4ae123);})['then'](function(_0x501fb4){_0x5540d8[_0x0728('0xa5')]=_0x501fb4;return _0x5540d8;});}})[_0x0728('0x18')](respondWithFilteredResult(_0x28b6cc,_0x4ae123))['catch'](handleError(_0x28b6cc,null));};exports[_0x0728('0xaa')]=function(_0x80e853,_0x55ab50){return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x80e853[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x55ab50,null))[_0x0728('0x18')](function(_0x5a94ce){if(_0x5a94ce){return _0x5a94ce['setTags'](_0x80e853[_0x0728('0x34')][_0x0728('0x93')],_['omit'](_0x80e853[_0x0728('0x34')],[_0x0728('0x93'),'id'])||{})[_0x0728('0xab')](function(){return db[_0x0728('0xac')][_0x0728('0x40')]({'attributes':['id','name',_0x0728('0xad')],'where':{'id':_0x80e853['body'][_0x0728('0x93')]}});})[_0x0728('0x18')](function(_0x56c783){socket['emit']('chatInteractionTags:save',{'id':Number(_0x80e853[_0x0728('0x43')]['id']),'tags':_0x56c783||[]});return{'id':Number(_0x80e853[_0x0728('0x43')]['id']),'tags':_0x56c783||[]};});}})[_0x0728('0x18')](respondWithResult(_0x55ab50,null))['catch'](handleError(_0x55ab50,null));};exports['removeTags']=function(_0x5e209a,_0x571f2a){return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x5e209a['params']['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x571f2a,null))[_0x0728('0x18')](function(_0x2032cf){if(_0x2032cf){return _0x2032cf[_0x0728('0xae')](_0x5e209a['query'][_0x0728('0x93')]);}})['then'](respondWithStatusCode(_0x571f2a,null))[_0x0728('0x23')](handleError(_0x571f2a,null));};exports[_0x0728('0xaf')]=function(_0x29b3b2,_0x36f9f0){var _0x13f654=moment()['unix']()[_0x0728('0xb0')]();var _0x4024f6=path[_0x0728('0x74')](config['root'],'server','files',_0x0728('0xb1'));var _0x4bcc4f=path[_0x0728('0x74')](config[_0x0728('0x73')],_0x0728('0xb2'),_0x0728('0xb3'),_0x0728('0xb4'));var _0x283fc3=path[_0x0728('0x74')](_0x4024f6,_0x13f654);var _0x3fb75a=util[_0x0728('0x7d')](_0x0728('0xb5'),_0x29b3b2[_0x0728('0x43')]['id'],_0x13f654);var _0x433fa9=path[_0x0728('0x74')](_0x4024f6,_0x3fb75a);var _0x127f9c=[];_0x127f9c[_0x0728('0xa8')]({'model':db[_0x0728('0x7c')],'as':'User','attributes':['id',_0x0728('0x56')],'raw':!![]});_0x127f9c['push']({'model':db[_0x0728('0x62')],'as':_0x0728('0x63'),'attributes':['id',_0x0728('0xb6'),_0x0728('0xb7')],'raw':!![]});if(_0x29b3b2['query'][_0x0728('0xb4')]){_0x127f9c['push']({'model':db[_0x0728('0x70')],'as':_0x0728('0x70'),'raw':!![]});}var _0x5c90ab=[{'model':db[_0x0728('0x7a')],'as':_0x0728('0x7b'),'attributes':['id','body',_0x0728('0xb8'),_0x0728('0x86'),_0x0728('0x87'),_0x0728('0xb9')],'include':_0x127f9c}];_0x5c90ab[_0x0728('0xa8')]({'model':db[_0x0728('0x4f')],'as':'Account','attributes':['id','name']});_0x5c90ab[_0x0728('0xa8')]({'model':db[_0x0728('0x7c')],'as':_0x0728('0xba'),'attributes':['id',_0x0728('0x56')]});return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x29b3b2[_0x0728('0x43')]['id']},'include':_0x5c90ab})[_0x0728('0x18')](handleEntityNotFound(_0x36f9f0,null))['then'](function(_0x53330a){if(_0x53330a){var _0x456cf1=_0x53330a['get']({'plain':!![]});fs['mkdirSync'](_0x283fc3);var _0x17d636={'channel':_0x0728('0xbb'),'account':_0x456cf1[_0x0728('0xbc')][_0x0728('0x30')],'agent':_0x456cf1[_0x0728('0xba')]?_0x456cf1[_0x0728('0xba')][_0x0728('0x56')]:_0x0728('0xbd'),'createdAt':moment(_0x456cf1[_0x0728('0xb8')])[_0x0728('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x456cf1[_0x0728('0x69')]?moment(_0x456cf1[_0x0728('0xbe')])['format'](_0x0728('0xa2'))[_0x0728('0xb0')]():'','disposition':_0x456cf1[_0x0728('0x6a')],'chatInfo':{'browser':_0x456cf1[_0x0728('0xbf')],'os':_0x456cf1['osName'],'referer':_0x456cf1['referer'],'customerIp':_0x456cf1['customerIp'],'customerPort':_0x456cf1[_0x0728('0xc0')]?_0x456cf1[_0x0728('0xc0')]:_0x0728('0xbd')},'messages':_(_0x456cf1['Messages'])[_0x0728('0xc1')]()[_0x0728('0x9f')]({'secret':![]})[_0x0728('0x3a')](function(_0x40b6ef){if(_0x40b6ef[_0x0728('0x70')]){var _0x3a019c=path[_0x0728('0x74')](_0x4bcc4f,_0x40b6ef[_0x0728('0x70')][_0x0728('0x75')]);if(fs[_0x0728('0xc2')](_0x3a019c)){fs[_0x0728('0xc3')](_0x3a019c)[_0x0728('0xc4')](fs[_0x0728('0xc5')](path[_0x0728('0x74')](_0x283fc3,_0x40b6ef[_0x0728('0x70')]['basename'])));}}return{'date':moment(_0x40b6ef['createdAt'])[_0x0728('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0728('0xb0')](),'sender':_0x40b6ef[_0x0728('0x86')]===_0x0728('0x5f')?_0x40b6ef[_0x0728('0x7c')]?_0x40b6ef[_0x0728('0x7c')][_0x0728('0x56')]:_0x0728('0x84'):_0x40b6ef[_0x0728('0x63')][_0x0728('0xb6')]+(_0x40b6ef[_0x0728('0x63')]['lastName']?'\x20'+_0x40b6ef[_0x0728('0x63')][_0x0728('0xb7')]:''),'body':_0x40b6ef[_0x0728('0x70')]?_0x40b6ef[_0x0728('0x70')][_0x0728('0x75')]:_0x40b6ef['body'],'direction':_0x40b6ef['direction']===_0x0728('0x5f')?'A':'C','secret':_0x40b6ef[_0x0728('0x87')],'read':_0x40b6ef[_0x0728('0xb9')],'attachment':_0x40b6ef['Attachment']};})['value']()};return ejs['renderFile'](path['join'](config[_0x0728('0x73')],_0x0728('0xb2'),_0x0728('0xc6'),'downloadInteraction.ejs'),{'interaction':_0x17d636})[_0x0728('0x18')](function(_0x253265){var _0x141c42=path[_0x0728('0x74')](_0x283fc3,_0x0728('0xc7')+_0x456cf1['id']+'-'+_0x13f654+_0x0728('0xc8'));var _0x302840={'path':_0x141c42,'channel':'Chat','interactionId':_0x456cf1['id']};return pdf[_0x0728('0xc9')](_0x253265,_0x302840);})[_0x0728('0x18')](function(){return new Promise(function(_0x25bb29,_0x3f50a7){zipdir(_0x283fc3,{'saveTo':_0x433fa9},function(_0x4815ee,_0x91aefc){if(_0x4815ee)return _0x3f50a7(_0x4815ee);return _0x25bb29(_0x91aefc);});})[_0x0728('0x18')](function(){return new BPromise(function(_0x45960a,_0x230df5){rimraf(_0x283fc3,function(_0xcc89d){if(_0xcc89d)_0x230df5(_0xcc89d);return _0x45960a();});});})[_0x0728('0x18')](function(){return _0x36f9f0[_0x0728('0xaf')](_0x433fa9,_0x3fb75a,function(_0x49ca46){if(_0x49ca46){logger[_0x0728('0x1f')](_0x0728('0xca'),_0x49ca46);}else{fs[_0x0728('0xcb')](_0x433fa9);}});});});}else{return _0x36f9f0[_0x0728('0x24')](0xc8);}})[_0x0728('0x23')](handleError(_0x36f9f0,null));}; \ No newline at end of file +var _0xa444=['bluebird','mustache','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','offset','undefined','limit','count','set','update','destroy','stack','name','send','render','contact','interaction','account','index','map','ChatInteraction','rawAttributes','getOptions','chat','user','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','sendStatus','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','filename','type','mimetype','attachmentDownload','json','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','format','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','order','sort','pick','where','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','nolimit','filter','addTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','tmp','server','attachments','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','existsSync','createReadStream','pipe','direction','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','moment'];(function(_0x3fdcee,_0x17dbfe){var _0x4a5788=function(_0x2030aa){while(--_0x2030aa){_0x3fdcee['push'](_0x3fdcee['shift']());}};_0x4a5788(++_0x17dbfe);}(_0xa444,0x1a4));var _0x4a44=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa444[_0x19950b];return _0x3c6b41;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x4a44('0x0'));var moment=require(_0x4a44('0x1'));var BPromise=require(_0x4a44('0x2'));var Mustache=require(_0x4a44('0x3'));var util=require(_0x4a44('0x4'));var path=require(_0x4a44('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x4a44('0x6'));var interaction=require(_0x4a44('0x7'));var qs=require(_0x4a44('0x8'));var pdf=require(_0x4a44('0x9'));var logger=require('../../config/logger')(_0x4a44('0xa'));var config=require(_0x4a44('0xb'));var db=require(_0x4a44('0xc'))['db'];config[_0x4a44('0xd')]=_[_0x4a44('0xe')](config[_0x4a44('0xd')],{'host':_0x4a44('0xf'),'port':0x18eb});var socket=require(_0x4a44('0x10'))(new Redis(config[_0x4a44('0xd')]));require(_0x4a44('0x11'))[_0x4a44('0x12')](socket);var jayson=require(_0x4a44('0x13'));var client=jayson[_0x4a44('0x14')]['http']({'port':0x232b});var client9004=jayson['client'][_0x4a44('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x37f069,_0x2ff0fb,_0x4a7fab,_0x18dec6){return new BPromise(function(_0x5c1a81,_0x495f5c){var _0x276b83=_0x18dec6||client;return _0x276b83[_0x4a44('0x16')](_0x37f069,_0x4a7fab)[_0x4a44('0x17')](function(_0x8e66d4){logger[_0x4a44('0x18')](_0x4a44('0x19'),_0x2ff0fb,_0x4a44('0x1a'));logger[_0x4a44('0x1b')](_0x4a44('0x1c'),_0x2ff0fb,_0x4a44('0x1a'),JSON[_0x4a44('0x1d')](_0x8e66d4));if(_0x8e66d4[_0x4a44('0x1e')]){if(_0x8e66d4['error']['code']===0x1f4){logger[_0x4a44('0x1e')](_0x4a44('0x19'),_0x2ff0fb,_0x8e66d4[_0x4a44('0x1e')][_0x4a44('0x1f')]);return _0x495f5c(_0x8e66d4[_0x4a44('0x1e')][_0x4a44('0x1f')]);}logger[_0x4a44('0x1e')](_0x4a44('0x19'),_0x2ff0fb,_0x8e66d4[_0x4a44('0x1e')][_0x4a44('0x1f')]);return _0x5c1a81(_0x8e66d4['error'][_0x4a44('0x1f')]);}else{logger[_0x4a44('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2ff0fb,_0x4a44('0x1a'));_0x5c1a81(_0x8e66d4[_0x4a44('0x20')][_0x4a44('0x1f')]);}})[_0x4a44('0x21')](function(_0x26cf3b){logger[_0x4a44('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x2ff0fb,_0x26cf3b);_0x495f5c(_0x26cf3b);});});}function respondWithStatusCode(_0x77cbe3,_0x576eef){_0x576eef=_0x576eef||0xcc;return function(_0x3ebfa5){if(_0x3ebfa5){return _0x77cbe3['sendStatus'](_0x576eef);}return _0x77cbe3[_0x4a44('0x22')](_0x576eef)[_0x4a44('0x23')]();};}function respondWithResult(_0x1a52bd,_0x47fcdf){_0x47fcdf=_0x47fcdf||0xc8;return function(_0x13ea66){if(_0x13ea66){return _0x1a52bd[_0x4a44('0x22')](_0x47fcdf)['json'](_0x13ea66);}};}function respondWithFilteredResult(_0x477797,_0x2a9040){return function(_0x3ad5b3){if(_0x3ad5b3){var _0x27acd8=typeof _0x2a9040[_0x4a44('0x24')]===_0x4a44('0x25')&&typeof _0x2a9040[_0x4a44('0x26')]==='undefined';var _0x2e2090=_0x3ad5b3[_0x4a44('0x27')];var _0x569f7d=_0x27acd8?0x0:_0x2a9040['offset'];var _0x244d32=_0x27acd8?_0x3ad5b3[_0x4a44('0x27')]:_0x2a9040[_0x4a44('0x24')]+_0x2a9040['limit'];var _0x1c01b1;if(_0x244d32>=_0x2e2090){_0x244d32=_0x2e2090;_0x1c01b1=0xc8;}else{_0x1c01b1=0xce;}_0x477797[_0x4a44('0x22')](_0x1c01b1);return _0x477797[_0x4a44('0x28')]('Content-Range',_0x569f7d+'-'+_0x244d32+'/'+_0x2e2090)['json'](_0x3ad5b3);}return null;};}function saveUpdates(_0x1cd2a8){return function(_0x5c4383){if(_0x5c4383){return _0x5c4383[_0x4a44('0x29')](_0x1cd2a8)['then'](function(_0x56645a){return _0x56645a;});}return null;};}function removeEntity(_0x5a3ce9){return function(_0x112dc9){if(_0x112dc9){return _0x112dc9[_0x4a44('0x2a')]()[_0x4a44('0x17')](function(){_0x5a3ce9[_0x4a44('0x22')](0xcc)[_0x4a44('0x23')]();});}};}function handleEntityNotFound(_0x50bac7){return function(_0x3800ca){if(!_0x3800ca){_0x50bac7['sendStatus'](0x194);}return _0x3800ca;};}function handleError(_0x447656,_0x2979f8){_0x2979f8=_0x2979f8||0x1f4;return function(_0x38f19a){logger[_0x4a44('0x1e')](_0x38f19a[_0x4a44('0x2b')]);if(_0x38f19a['name']){delete _0x38f19a[_0x4a44('0x2c')];}_0x447656[_0x4a44('0x22')](_0x2979f8)[_0x4a44('0x2d')](_0x38f19a);};}function getMustacheRender(_0x46faf3,_0x3f4f9b){return Mustache[_0x4a44('0x2e')](_0x46faf3,_['merge'](_0x3f4f9b['body'],{'contact':_0x3f4f9b[_0x4a44('0x2f')],'message':_0x3f4f9b['message'],'agent':_0x3f4f9b['agent'],'interaction':_0x3f4f9b[_0x4a44('0x30')],'account':_0x3f4f9b[_0x4a44('0x31')]}))||'';}exports[_0x4a44('0x32')]=function(_0x3d5f41,_0x2f3fb9){var _0x4c5ec0={};var _0x478285=_[_0x4a44('0x33')](db[_0x4a44('0x34')][_0x4a44('0x35')],function(_0x1affae){return{'name':_0x1affae['fieldName'],'type':_0x1affae['type']['key']};});_0x4c5ec0=qs[_0x4a44('0x36')](_0x478285,_0x3d5f41);return interaction['findAll'](_0x4a44('0x37'),_0x3d5f41['query'],_0x3d5f41[_0x4a44('0x38')],_0x4c5ec0,_0x478285)[_0x4a44('0x17')](respondWithFilteredResult(_0x2f3fb9,_0x4c5ec0))[_0x4a44('0x21')](handleError(_0x2f3fb9,null));};exports['show']=function(_0x3bd8aa,_0x4fa7d7){var _0x402eea={'raw':![],'where':{'id':_0x3bd8aa[_0x4a44('0x39')]['id']}},_0xb576a0={};_0xb576a0[_0x4a44('0x3a')]=_[_0x4a44('0x3b')](db['ChatInteraction'][_0x4a44('0x35')]);_0xb576a0['query']=_[_0x4a44('0x3b')](_0x3bd8aa[_0x4a44('0x3c')]);_0xb576a0['filters']=_[_0x4a44('0x3d')](_0xb576a0['model'],_0xb576a0['query']);_0x402eea[_0x4a44('0x3e')]=_[_0x4a44('0x3d')](_0xb576a0[_0x4a44('0x3a')],qs['fields'](_0x3bd8aa[_0x4a44('0x3c')][_0x4a44('0x3f')]));_0x402eea['attributes']=_0x402eea['attributes'][_0x4a44('0x40')]?_0x402eea['attributes']:_0xb576a0[_0x4a44('0x3a')];if(_0x3bd8aa[_0x4a44('0x3c')][_0x4a44('0x41')]){_0x402eea[_0x4a44('0x42')]=[{'all':!![]}];}_0x402eea=_[_0x4a44('0x43')]({},_0x402eea,_0x3bd8aa[_0x4a44('0x44')]);return db[_0x4a44('0x34')][_0x4a44('0x45')](_0x402eea)[_0x4a44('0x17')](handleEntityNotFound(_0x4fa7d7,null))[_0x4a44('0x17')](respondWithResult(_0x4fa7d7,null))[_0x4a44('0x21')](handleError(_0x4fa7d7,null));};exports[_0x4a44('0x46')]=function(_0x8afb6d,_0x4daa26){return db['ChatInteraction'][_0x4a44('0x46')](_0x8afb6d[_0x4a44('0x47')],{})[_0x4a44('0x17')](respondWithResult(_0x4daa26,0xc9))[_0x4a44('0x21')](handleError(_0x4daa26,null));};exports[_0x4a44('0x29')]=function(_0x3ade27,_0x3e6703){if(_0x3ade27['body']['id']){delete _0x3ade27[_0x4a44('0x47')]['id'];}return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x3ade27[_0x4a44('0x39')]['id']}})['then'](handleEntityNotFound(_0x3e6703,null))[_0x4a44('0x17')](saveUpdates(_0x3ade27[_0x4a44('0x47')],null))[_0x4a44('0x17')](respondWithResult(_0x3e6703,null))[_0x4a44('0x21')](handleError(_0x3e6703,null));};exports['destroy']=function(_0x5ebce4,_0x48a747){return db['ChatInteraction']['find']({'where':{'id':_0x5ebce4[_0x4a44('0x39')]['id']}})[_0x4a44('0x17')](handleEntityNotFound(_0x48a747,null))[_0x4a44('0x17')](removeEntity(_0x48a747,null))[_0x4a44('0x21')](handleError(_0x48a747,null));};exports[_0x4a44('0x48')]=function(_0x5a75ae,_0x409869){return db['ChatInteraction']['describe']()[_0x4a44('0x17')](respondWithResult(_0x409869,null))[_0x4a44('0x21')](handleError(_0x409869,null));};exports[_0x4a44('0x49')]=function(_0x525794,_0x5f5dc1){var _0x1acea0=_0x525794[_0x4a44('0x39')]['id'];var _0x3901f3;var _0x3d4960;var _0xf6c815;return db[_0x4a44('0x34')][_0x4a44('0x4a')]({'where':{'id':_0x1acea0}})[_0x4a44('0x17')](function(_0x4196e2){_0x3901f3=_0x4196e2;return db[_0x4a44('0x4b')][_0x4a44('0x4a')]({'where':{'id':_0x4196e2[_0x4a44('0x4c')]},'attributes':['id',_0x4a44('0x4d'),_0x4a44('0x4e'),_0x4a44('0x4f'),_0x4a44('0x50'),_0x4a44('0x51')],'raw':!![]});})[_0x4a44('0x17')](function(_0x32b2c3){if(_0x32b2c3&&_0x32b2c3[_0x4a44('0x4d')]&&_0x32b2c3['vidaooEscalation']){_0x3d4960=_0x32b2c3;var _0x425e9b={'interaction':{'id':_0x1acea0},'agent':{'id':_0x525794[_0x4a44('0x38')]['id'],'name':_0x525794[_0x4a44('0x38')][_0x4a44('0x2c')],'fullname':_0x525794[_0x4a44('0x38')]['fullname'],'email':_0x525794[_0x4a44('0x38')][_0x4a44('0x52')]},'contact':_0x525794[_0x4a44('0x47')]['contact'],'account':_0x525794[_0x4a44('0x47')][_0x4a44('0x31')]};var _0x401020={'rejectUnauthorized':![],'method':_0x4a44('0x53'),'url':_0x4a44('0x54'),'headers':{'X-APIKEY':_0x32b2c3['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x525794[_0x4a44('0x38')][_0x4a44('0x52')]],'buttons':null,'topic':_0x3d4960[_0x4a44('0x4f')],'note':_['isNull'](_0x3d4960[_0x4a44('0x50')])?null:getMustacheRender(_0x3d4960['vidaooNote'],_0x425e9b),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x4a44('0x55')](_0x3d4960['vidaooMetadata'])){var _0x545693=getMustacheRender(_0x3d4960[_0x4a44('0x51')],_0x425e9b);var _0x3139=JSON[_0x4a44('0x56')](_0x545693);_0x401020['body'][_0x4a44('0x57')]=_0x3139;}}catch(_0x4a73eb){throw new db[(_0x4a44('0x58'))]['ValidationError'](_0x4a44('0x59'));}return rp(_0x401020);}else{throw new db['Sequelize'][(_0x4a44('0x5a'))](_0x4a44('0x5b'));}})[_0x4a44('0x17')](function(_0x2753c1){_0xf6c815=_0x2753c1;if(_0xf6c815['id']){var _0x5edb6e={'body':_0xf6c815[_0x4a44('0x5c')],'ChatWebsiteId':_0x3d4960['id'],'ChatInteractionId':_0x3901f3['id'],'direction':_0x4a44('0x5d'),'UserId':_0x525794['user']['id']};return db[_0x4a44('0x5e')][_0x4a44('0x46')](_0x5edb6e,{});}else{throw new db[(_0x4a44('0x58'))][(_0x4a44('0x5a'))](_0x4a44('0x5f'));}})[_0x4a44('0x17')](function(){return _0x3901f3[_0x4a44('0x60')]({'vidaooSessionId':_0xf6c815['id']});})[_0x4a44('0x17')](respondWithResult(_0x5f5dc1,null))['catch'](handleError(_0x5f5dc1,null));};exports['customUpdate']=function(_0x3104a9,_0x2e58b5){if(_0x3104a9[_0x4a44('0x47')]['id']){delete _0x3104a9[_0x4a44('0x47')]['id'];}return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x3104a9[_0x4a44('0x39')]['id']},'include':[{'model':db[_0x4a44('0x61')],'as':_0x4a44('0x62')}]})[_0x4a44('0x17')](handleEntityNotFound(_0x2e58b5,null))[_0x4a44('0x17')](saveUpdates(_0x3104a9[_0x4a44('0x47')],null))[_0x4a44('0x17')](respondWithResult(_0x2e58b5,null))[_0x4a44('0x21')](handleError(_0x2e58b5,null));};exports[_0x4a44('0x63')]=function(_0x3d1fd9,_0x14ad2c){if(_0x3d1fd9[_0x4a44('0x47')]['id']){delete _0x3d1fd9[_0x4a44('0x47')]['id'];}return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x3d1fd9['params']['id']}})[_0x4a44('0x17')](function(_0x19f6b6){if(!_0x19f6b6){logger[_0x4a44('0x1e')](_0x4a44('0x64'),_0x4a44('0x63'),0x194,'entity\x20not\x20found');_0x14ad2c[_0x4a44('0x65')](0x194);}else{if(_0x19f6b6[_0x4a44('0x66')]){throw new db['Sequelize']['ValidationError'](_0x4a44('0x67'));}}return _0x19f6b6;})[_0x4a44('0x17')](function(_0x3619cd){if(_0x3619cd){return _0x3619cd[_0x4a44('0x29')]({'closed':_0x3d1fd9['body'][_0x4a44('0x68')],'disposition':_0x3d1fd9[_0x4a44('0x47')]['disposition']})['then'](function(_0xe0a44){return _0xe0a44;});}})[_0x4a44('0x17')](function(){return respondWithRpcPromise(_0x4a44('0x69'),_0x4a44('0x63'),_0x3d1fd9[_0x4a44('0x47')],client9004);})['then'](respondWithResult(_0x14ad2c,null))['catch'](handleError(_0x14ad2c,null));};exports['attachmentUpload']=function(_0x19663d,_0x3af66d){_0x19663d[_0x4a44('0x47')][_0x4a44('0x2c')]=_0x19663d[_0x4a44('0x6a')][_0x4a44('0x6b')];_0x19663d[_0x4a44('0x47')][_0x4a44('0x6c')]=_0x19663d[_0x4a44('0x6a')][_0x4a44('0x6d')];_0x19663d[_0x4a44('0x47')][_0x4a44('0x6e')]=_0x19663d['file'][_0x4a44('0x6f')];return db['Attachment'][_0x4a44('0x46')](_0x19663d['body'])['then'](respondWithResult(_0x3af66d,0xc9))[_0x4a44('0x21')](handleError(_0x3af66d,null));};exports[_0x4a44('0x70')]=function(_0x4bfced,_0x519627){return db[_0x4a44('0x34')][_0x4a44('0x4a')]({'where':{'id':_0x4bfced[_0x4a44('0x39')]['id']},'raw':!![]})[_0x4a44('0x17')](handleEntityNotFound(_0x519627,null))[_0x4a44('0x17')](function(_0x308cc6){if(_0x308cc6){if(_0x308cc6[_0x4a44('0x68')]){return _0x519627[_0x4a44('0x22')](0x193)[_0x4a44('0x71')]({'status':0x193,'message':_0x4a44('0x72')});}return db[_0x4a44('0x73')][_0x4a44('0x4a')]({'where':{'id':_0x4bfced['query'][_0x4a44('0x74')]},'raw':!![]})[_0x4a44('0x17')](handleEntityNotFound(_0x519627,null));}})[_0x4a44('0x17')](function(_0x4cc3ef){if(_0x4cc3ef){var _0x38d495=_0x4cc3ef['ChatOfflineMessageId']!==null;var _0x3df939=path[_0x4a44('0x75')](config[_0x4a44('0x76')],_0x4a44('0x77'));if(_0x38d495){_0x3df939=path['join'](_0x3df939,_0x4a44('0x78'));}var _0x1f3633=path[_0x4a44('0x75')](_0x3df939,_0x4cc3ef[_0x4a44('0x6c')]);return _0x519627[_0x4a44('0x79')](_0x1f3633);}})[_0x4a44('0x21')](handleError(_0x519627,null));};exports[_0x4a44('0x7a')]=function(_0x41b7de,_0x59d460){var _0x124e5c=null;var _0x3893b8=null;var _0x321281=null;if(_0x41b7de['body']['id']){delete _0x41b7de[_0x4a44('0x47')]['id'];}if(_0x41b7de[_0x4a44('0x47')][_0x4a44('0x7b')]){_0x321281=path['join'](config[_0x4a44('0x76')],'server/files/chat/upload/',util['format'](_0x4a44('0x7c'),Date[_0x4a44('0x7d')]()));_0x41b7de[_0x4a44('0x47')][_0x4a44('0x7e')]=_0x321281;}return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x41b7de[_0x4a44('0x39')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x4a44('0x7f')],'as':_0x4a44('0x7f')}]}]})[_0x4a44('0x17')](handleEntityNotFound(_0x59d460,null))[_0x4a44('0x17')](saveUpdates(_0x41b7de['body'],null))[_0x4a44('0x17')](function(_0x4bad3c){if(_0x4bad3c){_0x124e5c=_0x4bad3c;return db[_0x4a44('0x4b')][_0x4a44('0x45')]({'where':{'id':_0x124e5c['ChatWebsiteId']}});}})[_0x4a44('0x17')](function(_0x574d68){if(_0x574d68){_0x3893b8=_0x574d68;return db['CmContact'][_0x4a44('0x45')]({'where':{'id':_0x124e5c[_0x4a44('0x80')]}});}})[_0x4a44('0x17')](function(_0x123d12){if(_0x123d12){if(_0x321281){var _0x38b15b=null;for(var _0x2f488c=0x1;_0x2f488c<_0x124e5c['Messages'][_0x4a44('0x40')];++_0x2f488c){_0x38b15b=_0x124e5c[_0x4a44('0x81')][_0x2f488c];var _0x4de1cc=_0x38b15b[_0x4a44('0x66')]?util[_0x4a44('0x82')](_0x4a44('0x83'),_0x3893b8[_0x4a44('0x84')],_0x38b15b[_0x4a44('0x66')]):_0x4a44('0x85');var _0x655e11=_0x41b7de['body'][_0x4a44('0x86')]||util['format'](_0x4a44('0x83'),_0x4a44('0x87'),_0x38b15b[_0x4a44('0x80')]);switch(_0x3893b8['agentIdentifier']){case _0x4a44('0x88'):_0x4de1cc=_0x38b15b[_0x4a44('0x66')]?util[_0x4a44('0x82')](_0x4a44('0x83'),_0x3893b8[_0x4a44('0x84')],_0x38b15b[_0x4a44('0x66')]):_0x4a44('0x85');break;case _0x4a44('0x89'):_0x4de1cc=_0x38b15b[_0x4a44('0x66')]?_0x38b15b[_0x4a44('0x7f')][_0x4a44('0x8a')]||_0x38b15b[_0x4a44('0x7f')][_0x4a44('0x8b')]:_0x4a44('0x85');break;case _0x4a44('0x8c'):_0x4de1cc=_0x38b15b[_0x4a44('0x66')]?_0x38b15b[_0x4a44('0x7f')][_0x4a44('0x8b')]:_0x4a44('0x85');break;default:_0x4de1cc=_0x38b15b[_0x4a44('0x66')]?util[_0x4a44('0x82')](_0x4a44('0x83'),_0x3893b8[_0x4a44('0x84')],_0x38b15b[_0x4a44('0x66')]):'System';}var _0x429f24=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x38b15b[_0x4a44('0x8d')])['format'](_0x4a44('0x8e')),_0x38b15b['direction']==='in'?_0x655e11:_0x4de1cc,_0x38b15b['body']);if(!_0x38b15b[_0x4a44('0x8f')]){fs[_0x4a44('0x90')](_0x321281,_0x429f24);}}return db[_0x4a44('0x91')][_0x4a44('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4a44('0x92'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4a44('0x93'),'raw':!![]}]}]});}}})[_0x4a44('0x17')](function(_0x395c79){if(!_0x395c79||!_0x395c79[_0x4a44('0x92')]||!_0x41b7de['body'])return _0x124e5c;var _0x574a63=_0x395c79[_0x4a44('0x94')]();return respondWithRpcPromise(_0x4a44('0x95'),_0x4a44('0x96'),{'account':_0x574a63,'message':{'from':util[_0x4a44('0x82')](_0x4a44('0x97'),_0x395c79[_0x4a44('0x2c')],_0x395c79[_0x4a44('0x52')]||_0x395c79['Smtp'][_0x4a44('0x38')]),'to':_0x41b7de['body']['mailTranscript'],'subject':_0x4a44('0x98'),'text':util[_0x4a44('0x82')](_0x4a44('0x99'),_0x41b7de['body'][_0x4a44('0x7b')]),'attachments':[{'path':_0x321281}]}})['then'](function(){return _0x124e5c;})[_0x4a44('0x21')](function(_0x59a55d){logger[_0x4a44('0x1e')](_0x59a55d);});})[_0x4a44('0x17')](respondWithStatusCode(_0x59d460,0xc8))[_0x4a44('0x21')](handleError(_0x59d460,null));};exports['addMessage']=function(_0x3712c9,_0x3a7ce0){return db['ChatMessage'][_0x4a44('0x45')]({'where':{'id':_0x3712c9[_0x4a44('0x39')]['id']}})[_0x4a44('0x17')](handleEntityNotFound(_0x3a7ce0,null))[_0x4a44('0x17')](function(_0x88aadd){if(_0x88aadd){return _0x88aadd[_0x4a44('0x9a')](_0x3712c9[_0x4a44('0x47')][_0x4a44('0x9b')],_[_0x4a44('0x9c')](_0x3712c9[_0x4a44('0x47')],[_0x4a44('0x9b'),'id'])||{});}})[_0x4a44('0x17')](respondWithResult(_0x3a7ce0,null))[_0x4a44('0x21')](handleError(_0x3a7ce0,null));};exports[_0x4a44('0x9d')]=function(_0x2a1925,_0x38104c){var _0x552eae={'raw':![],'where':{}};var _0x24eace={};var _0x2ff325={'count':0x0,'rows':[]};return db[_0x4a44('0x34')][_0x4a44('0x4a')]({'where':{'id':_0x2a1925[_0x4a44('0x39')]['id']}})[_0x4a44('0x17')](handleEntityNotFound(_0x38104c,null))[_0x4a44('0x17')](function(_0xea7d9a){if(_0xea7d9a){_0x24eace[_0x4a44('0x3a')]=_[_0x4a44('0x3b')](db['ChatMessage'][_0x4a44('0x35')]);_0x24eace[_0x4a44('0x3c')]=_[_0x4a44('0x3b')](_0x2a1925[_0x4a44('0x3c')]);_0x24eace[_0x4a44('0x9e')]=_['intersection'](_0x24eace[_0x4a44('0x3a')],_0x24eace[_0x4a44('0x3c')]);_0x552eae['attributes']=_[_0x4a44('0x3d')](_0x24eace['model'],qs['fields'](_0x2a1925[_0x4a44('0x3c')]['fields']));_0x552eae[_0x4a44('0x3e')]=_0x552eae[_0x4a44('0x3e')][_0x4a44('0x40')]?_0x552eae['attributes']:_0x24eace[_0x4a44('0x3a')];if(!_0x2a1925[_0x4a44('0x3c')]['hasOwnProperty']('nolimit')){_0x552eae['limit']=qs['limit'](_0x2a1925[_0x4a44('0x3c')]['limit']);_0x552eae[_0x4a44('0x24')]=qs['offset'](_0x2a1925['query'][_0x4a44('0x24')]);}_0x552eae[_0x4a44('0x9f')]=qs[_0x4a44('0xa0')](_0x2a1925[_0x4a44('0x3c')][_0x4a44('0xa0')]);_0x552eae['where']=qs[_0x4a44('0x9e')](_[_0x4a44('0xa1')](_0x2a1925[_0x4a44('0x3c')],_0x24eace[_0x4a44('0x9e')]));_0x552eae[_0x4a44('0xa2')][_0x4a44('0xa3')]=_0xea7d9a['id'];if(_0x2a1925[_0x4a44('0x3c')]['filter']){_0x552eae[_0x4a44('0xa2')]=_[_0x4a44('0x43')](_0x552eae['where'],{'$or':_['map'](_0x552eae['attributes'],function(_0x4a7b0a){var _0x47c5f6={};_0x47c5f6[_0x4a7b0a]={'$like':'%'+_0x2a1925[_0x4a44('0x3c')]['filter']+'%'};return _0x47c5f6;})});}if(_0x2a1925[_0x4a44('0x3c')]['$gte']){var _0x126046=_0x2a1925[_0x4a44('0x3c')][_0x4a44('0xa4')][_0x4a44('0xa5')](',');var _0x3c25a7={};_0x3c25a7[_0x126046[0x0]]={'$gte':moment(_0x126046[0x1])[_0x4a44('0x82')](_0x4a44('0xa6'))};_0x552eae['where']=_[_0x4a44('0x43')](_0x552eae[_0x4a44('0xa2')],_0x3c25a7);}_0x552eae=_[_0x4a44('0x43')]({},_0x552eae,_0x2a1925[_0x4a44('0x44')]);return db[_0x4a44('0x5e')][_0x4a44('0x27')]({'where':_0x552eae['where']})[_0x4a44('0x17')](function(_0x27da60){_0x2ff325['count']=_0x27da60;if(_0x2a1925['query'][_0x4a44('0x41')]){_0x552eae[_0x4a44('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0x4a44('0xa7')](_0x552eae);})[_0x4a44('0x17')](function(_0x291431){_0x2ff325[_0x4a44('0xa8')]=_0x291431;return _0x2ff325;});}})[_0x4a44('0x17')](respondWithFilteredResult(_0x38104c,_0x552eae))['catch'](handleError(_0x38104c,null));};exports[_0x4a44('0xa9')]=function(_0x251030,_0x31cf58){var _0x1d5fab={'where':{}},_0x2056bf={},_0x29ba34={'count':0x0,'rows':[]};return db[_0x4a44('0x34')][_0x4a44('0x4a')]({'where':{'id':_0x251030[_0x4a44('0x39')]['id']}})['then'](handleEntityNotFound(_0x31cf58,null))[_0x4a44('0x17')](function(_0x56c306){if(_0x56c306){_0x2056bf[_0x4a44('0x3a')]=_[_0x4a44('0x3b')](db[_0x4a44('0x5e')]['rawAttributes']);_0x2056bf[_0x4a44('0x3c')]=_[_0x4a44('0x3b')](_0x251030[_0x4a44('0x3c')]);_0x2056bf[_0x4a44('0x9e')]=_[_0x4a44('0x3d')](_0x2056bf['model'],_0x2056bf[_0x4a44('0x3c')]);_0x1d5fab[_0x4a44('0x3e')]=_[_0x4a44('0x3d')](_0x2056bf[_0x4a44('0x3a')],qs[_0x4a44('0x3f')](_0x251030[_0x4a44('0x3c')][_0x4a44('0x3f')]));_0x1d5fab['attributes']=_0x1d5fab['attributes']['length']?_0x1d5fab[_0x4a44('0x3e')]:_0x2056bf[_0x4a44('0x3a')];if(!_0x251030[_0x4a44('0x3c')]['hasOwnProperty'](_0x4a44('0xaa'))){_0x1d5fab[_0x4a44('0x26')]=qs[_0x4a44('0x26')](_0x251030[_0x4a44('0x3c')][_0x4a44('0x26')]);_0x1d5fab[_0x4a44('0x24')]=qs[_0x4a44('0x24')](_0x251030[_0x4a44('0x3c')][_0x4a44('0x24')]);}_0x1d5fab['order']=qs['sort'](_0x251030['query'][_0x4a44('0xa0')]);_0x1d5fab['where']=qs['filters'](_[_0x4a44('0xa1')](_0x251030[_0x4a44('0x3c')],_0x2056bf[_0x4a44('0x9e')]));_0x1d5fab[_0x4a44('0xa2')][_0x4a44('0xa3')]=_0x56c306['id'];if(_0x251030['query'][_0x4a44('0xab')]){_0x1d5fab[_0x4a44('0xa2')]=_[_0x4a44('0x43')](_0x1d5fab[_0x4a44('0xa2')],{'$or':_[_0x4a44('0x33')](_0x1d5fab[_0x4a44('0x3e')],function(_0x24934a){var _0x10c9d8={};_0x10c9d8[_0x24934a]={'$like':'%'+_0x251030[_0x4a44('0x3c')]['filter']+'%'};return _0x10c9d8;})});}_0x1d5fab[_0x4a44('0xa2')][_0x4a44('0x8f')]=![];if(_0x251030[_0x4a44('0x3c')]['id']){_0x1d5fab[_0x4a44('0xa2')]['id']={'$gt':_0x251030[_0x4a44('0x3c')]['id']};}_0x1d5fab=_[_0x4a44('0x43')]({},_0x1d5fab,_0x251030[_0x4a44('0x44')]);return db[_0x4a44('0x5e')][_0x4a44('0x27')]({'where':_0x1d5fab[_0x4a44('0xa2')]})['then'](function(_0xc22d36){_0x29ba34[_0x4a44('0x27')]=_0xc22d36;_0x1d5fab['include']=[];if(_0x251030[_0x4a44('0x3c')]['includeAgent']){_0x1d5fab[_0x4a44('0x42')]['push']({'model':db[_0x4a44('0x7f')],'as':'User','attributes':['id','fullname',_0x4a44('0x8a')]});}if(_0x251030[_0x4a44('0x3c')][_0x4a44('0x41')]){_0x1d5fab['include']=[{'all':!![]}];}return db[_0x4a44('0x5e')][_0x4a44('0xa7')](_0x1d5fab);})[_0x4a44('0x17')](function(_0x1956a0){_0x29ba34[_0x4a44('0xa8')]=_0x1956a0;return _0x29ba34;});}})[_0x4a44('0x17')](respondWithFilteredResult(_0x31cf58,_0x1d5fab))['catch'](handleError(_0x31cf58,null));};exports[_0x4a44('0xac')]=function(_0x1b575f,_0x59b64d){return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x1b575f['params']['id']}})[_0x4a44('0x17')](handleEntityNotFound(_0x59b64d,null))[_0x4a44('0x17')](function(_0x26e2d3){if(_0x26e2d3){return _0x26e2d3['setTags'](_0x1b575f[_0x4a44('0x47')]['ids'],_[_0x4a44('0x9c')](_0x1b575f['body'],[_0x4a44('0x9b'),'id'])||{})['spread'](function(){return db[_0x4a44('0xad')][_0x4a44('0xa7')]({'attributes':['id','name',_0x4a44('0xae')],'where':{'id':_0x1b575f[_0x4a44('0x47')]['ids']}});})['then'](function(_0x2e5d45){socket[_0x4a44('0xaf')](_0x4a44('0xb0'),{'id':Number(_0x1b575f[_0x4a44('0x39')]['id']),'tags':_0x2e5d45||[]});return{'id':Number(_0x1b575f['params']['id']),'tags':_0x2e5d45||[]};});}})['then'](respondWithResult(_0x59b64d,null))['catch'](handleError(_0x59b64d,null));};exports[_0x4a44('0xb1')]=function(_0x212d32,_0x33a291){return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x212d32['params']['id']}})[_0x4a44('0x17')](handleEntityNotFound(_0x33a291,null))['then'](function(_0x405e72){if(_0x405e72){return _0x405e72[_0x4a44('0xb1')](_0x212d32[_0x4a44('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x33a291,null))[_0x4a44('0x21')](handleError(_0x33a291,null));};exports['download']=function(_0x501062,_0xf54892){var _0x54a40b=moment()[_0x4a44('0xb2')]()[_0x4a44('0xb3')]();var _0x28ef44=path[_0x4a44('0x75')](config[_0x4a44('0x76')],'server',_0x4a44('0xb4'),_0x4a44('0xb5'));var _0x41d6ee=path[_0x4a44('0x75')](config[_0x4a44('0x76')],_0x4a44('0xb6'),_0x4a44('0xb4'),_0x4a44('0xb7'));var _0x57dc73=path[_0x4a44('0x75')](_0x28ef44,_0x54a40b);var _0x15e02e=util[_0x4a44('0x82')]('transcript-%d-%s.zip',_0x501062['params']['id'],_0x54a40b);var _0x45b7ff=path[_0x4a44('0x75')](_0x28ef44,_0x15e02e);var _0x42ecb6=[];_0x42ecb6['push']({'model':db[_0x4a44('0x7f')],'as':_0x4a44('0x7f'),'attributes':['id',_0x4a44('0x8b')],'raw':!![]});_0x42ecb6[_0x4a44('0xb8')]({'model':db[_0x4a44('0x61')],'as':_0x4a44('0x62'),'attributes':['id',_0x4a44('0xb9'),_0x4a44('0xba')],'raw':!![]});if(_0x501062[_0x4a44('0x3c')][_0x4a44('0xb7')]){_0x42ecb6[_0x4a44('0xb8')]({'model':db[_0x4a44('0x73')],'as':_0x4a44('0x73'),'raw':!![]});}var _0x27aea2=[{'model':db['ChatMessage'],'as':_0x4a44('0x81'),'attributes':['id',_0x4a44('0x47'),'createdAt','direction',_0x4a44('0x8f'),_0x4a44('0xbb')],'include':_0x42ecb6}];_0x27aea2[_0x4a44('0xb8')]({'model':db[_0x4a44('0x4b')],'as':_0x4a44('0xbc'),'attributes':['id','name']});_0x27aea2['push']({'model':db['User'],'as':_0x4a44('0xbd'),'attributes':['id','fullname']});return db[_0x4a44('0x34')][_0x4a44('0x45')]({'where':{'id':_0x501062['params']['id']},'include':_0x27aea2})[_0x4a44('0x17')](handleEntityNotFound(_0xf54892,null))[_0x4a44('0x17')](function(_0x230f7e){if(_0x230f7e){var _0x481170=_0x230f7e[_0x4a44('0xbe')]({'plain':!![]});fs[_0x4a44('0xbf')](_0x57dc73);var _0x562026={'channel':_0x4a44('0xc0'),'account':_0x481170[_0x4a44('0xbc')][_0x4a44('0x2c')],'agent':_0x481170[_0x4a44('0xbd')]?_0x481170['Owner']['fullname']:_0x4a44('0xc1'),'createdAt':moment(_0x481170[_0x4a44('0x8d')])[_0x4a44('0x82')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4a44('0xb3')](),'closedAt':_0x481170[_0x4a44('0x68')]?moment(_0x481170[_0x4a44('0xc2')])[_0x4a44('0x82')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x481170[_0x4a44('0xc3')],'chatInfo':{'browser':_0x481170[_0x4a44('0xc4')],'os':_0x481170[_0x4a44('0xc5')],'referer':_0x481170['referer'],'customerIp':_0x481170[_0x4a44('0xc6')],'customerPort':_0x481170[_0x4a44('0xc7')]?_0x481170[_0x4a44('0xc7')]:_0x4a44('0xc1')},'messages':_(_0x481170[_0x4a44('0x81')])['tail']()[_0x4a44('0xab')]({'secret':![]})[_0x4a44('0x33')](function(_0x56dc92){if(_0x56dc92[_0x4a44('0x73')]){var _0x252978=path[_0x4a44('0x75')](_0x41d6ee,_0x56dc92['Attachment']['basename']);if(fs[_0x4a44('0xc8')](_0x252978)){fs[_0x4a44('0xc9')](_0x252978)[_0x4a44('0xca')](fs['createWriteStream'](path[_0x4a44('0x75')](_0x57dc73,_0x56dc92['Attachment']['basename'])));}}return{'date':moment(_0x56dc92[_0x4a44('0x8d')])[_0x4a44('0x82')](_0x4a44('0xa6'))[_0x4a44('0xb3')](),'sender':_0x56dc92['direction']===_0x4a44('0x5d')?_0x56dc92[_0x4a44('0x7f')]?_0x56dc92[_0x4a44('0x7f')][_0x4a44('0x8b')]:_0x4a44('0x85'):_0x56dc92['Contact'][_0x4a44('0xb9')]+(_0x56dc92['Contact'][_0x4a44('0xba')]?'\x20'+_0x56dc92[_0x4a44('0x62')][_0x4a44('0xba')]:''),'body':_0x56dc92[_0x4a44('0x73')]?_0x56dc92[_0x4a44('0x73')]['basename']:_0x56dc92[_0x4a44('0x47')],'direction':_0x56dc92[_0x4a44('0xcb')]===_0x4a44('0x5d')?'A':'C','secret':_0x56dc92[_0x4a44('0x8f')],'read':_0x56dc92[_0x4a44('0xbb')],'attachment':_0x56dc92[_0x4a44('0x73')]};})['value']()};return ejs[_0x4a44('0xcc')](path[_0x4a44('0x75')](config['root'],_0x4a44('0xb6'),'views',_0x4a44('0xcd')),{'interaction':_0x562026})[_0x4a44('0x17')](function(_0x2b516d){var _0xd2fdeb=path[_0x4a44('0x75')](_0x57dc73,_0x4a44('0xce')+_0x481170['id']+'-'+_0x54a40b+_0x4a44('0xcf'));var _0x4df2fb={'path':_0xd2fdeb,'channel':_0x4a44('0xc0'),'interactionId':_0x481170['id']};return pdf[_0x4a44('0xd0')](_0x2b516d,_0x4df2fb);})['then'](function(){return new Promise(function(_0x5e1617,_0x551bd8){zipdir(_0x57dc73,{'saveTo':_0x45b7ff},function(_0x138476,_0x5058a4){if(_0x138476)return _0x551bd8(_0x138476);return _0x5e1617(_0x5058a4);});})[_0x4a44('0x17')](function(){return new BPromise(function(_0x45970c,_0x37887f){rimraf(_0x57dc73,function(_0x413443){if(_0x413443)_0x37887f(_0x413443);return _0x45970c();});});})[_0x4a44('0x17')](function(){return _0xf54892[_0x4a44('0x79')](_0x45b7ff,_0x15e02e,function(_0x4b898d){if(_0x4b898d){logger[_0x4a44('0x1e')](_0x4a44('0xd1'),_0x4b898d);}else{fs[_0x4a44('0xd2')](_0x45b7ff);}});});});}else{return _0xf54892['sendStatus'](0xc8);}})[_0x4a44('0x21')](handleError(_0xf54892,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 7afc7a9..645a203 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 _0x26e8=['length','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x52b507,_0x3edb80){var _0x341497=function(_0x4669c3){while(--_0x4669c3){_0x52b507['push'](_0x52b507['shift']());}};_0x341497(++_0x3edb80);}(_0x26e8,0x1e3));var _0x826e=function(_0x3cf781,_0x3e4bc9){_0x3cf781=_0x3cf781-0x0;var _0x25e4d8=_0x26e8[_0x3cf781];return _0x25e4d8;};'use strict';var EventEmitter=require(_0x826e('0x0'));var ChatInteraction=require(_0x826e('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x826e('0x1'))['db'][_0x826e('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x826e('0x3')](0x0);var events={'afterCreate':_0x826e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3acaab){return function(_0xabaf52,_0x210c37,_0x135381){_0xabaf52[_0x826e('0x5')]({'attributes':['id'],'raw':!![]})[_0x826e('0x6')](function(_0x4ddaec){_0xabaf52[_0x826e('0x7')](_0x826e('0x8'),_0x4ddaec[_0x826e('0x9')](function(_0x1dbc0b){return{'id':_0x1dbc0b['id']};}));return ChatMessage[_0x826e('0xa')]({'where':{'ChatInteractionId':_0xabaf52['id'],'direction':'in','read':![]},'raw':!![]});})[_0x826e('0x6')](function(_0x5db1d5){_0xabaf52[_0x826e('0x7')](_0x826e('0xb'),_0x5db1d5[_0x826e('0xc')]);ChatInteractionEvents[_0x826e('0xd')](_0x3acaab+':'+_0xabaf52['id'],_0xabaf52);ChatInteractionEvents[_0x826e('0xd')](_0x3acaab,_0xabaf52);_0x135381(null);})['catch'](_0x135381(null));};}for(var e in events){if(events[_0x826e('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x6d38=['hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x55ffdc,_0x4a6870){var _0x44b944=function(_0x4fcd57){while(--_0x4fcd57){_0x55ffdc['push'](_0x55ffdc['shift']());}};_0x44b944(++_0x4a6870);}(_0x6d38,0x6e));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0x86d3('0x0'));var ChatInteraction=require(_0x86d3('0x1'))['db'][_0x86d3('0x2')];var ChatMessage=require(_0x86d3('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x86d3('0x3'),'afterUpdate':_0x86d3('0x4'),'afterDestroy':_0x86d3('0x5')};function emitEvent(_0xb8a491){return function(_0x5ca51a,_0xbcb71e,_0x55d1ea){_0x5ca51a[_0x86d3('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x52d893){_0x5ca51a['setDataValue'](_0x86d3('0x7'),_0x52d893['map'](function(_0x278cf5){return{'id':_0x278cf5['id']};}));return ChatMessage[_0x86d3('0x8')]({'where':{'ChatInteractionId':_0x5ca51a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x86d3('0x9')](function(_0x1d59b6){_0x5ca51a[_0x86d3('0xa')](_0x86d3('0xb'),_0x1d59b6[_0x86d3('0xc')]);ChatInteractionEvents[_0x86d3('0xd')](_0xb8a491+':'+_0x5ca51a['id'],_0x5ca51a);ChatInteractionEvents[_0x86d3('0xd')](_0xb8a491,_0x5ca51a);_0x55d1ea(null);})[_0x86d3('0xe')](_0x55d1ea(null));};}for(var e in events){if(events[_0x86d3('0xf')](e)){var event=events[e];ChatInteraction[_0x86d3('0x10')](e,emitEvent(event));}}module[_0x86d3('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 04b048d..b5f4eff 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 _0xb07b=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions'];(function(_0x318b88,_0x146ed7){var _0x1fec14=function(_0x20b3e2){while(--_0x20b3e2){_0x318b88['push'](_0x318b88['shift']());}};_0x1fec14(++_0x146ed7);}(_0xb07b,0x15a));var _0xbb07=function(_0x381543,_0x1aacb5){_0x381543=_0x381543-0x0;var _0x30b94d=_0xb07b[_0x381543];return _0x30b94d;};'use strict';var _=require(_0xbb07('0x0'));var util=require(_0xbb07('0x1'));var logger=require(_0xbb07('0x2'))('api');var moment=require(_0xbb07('0x3'));var BPromise=require(_0xbb07('0x4'));var rp=require(_0xbb07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb07('0x6'));var config=require(_0xbb07('0x7'));var attributes=require(_0xbb07('0x8'));module['exports']=function(_0x49a008,_0x5aa15c){return _0x49a008[_0xbb07('0x9')]('ChatInteraction',attributes,{'tableName':_0xbb07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53ee83,_0x45e63f,_0x54a614){if(_0x53ee83[_0xbb07('0xb')]('closed')){_0x53ee83[_0xbb07('0xc')]=moment()[_0xbb07('0xd')](_0xbb07('0xe'));}_0x54a614(null,_0x53ee83);}},'charset':_0xbb07('0xf'),'collate':_0xbb07('0x10')});}; \ No newline at end of file +var _0x5e58=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt'];(function(_0x547890,_0x593741){var _0x2c8daa=function(_0x1b100d){while(--_0x1b100d){_0x547890['push'](_0x547890['shift']());}};_0x2c8daa(++_0x593741);}(_0x5e58,0x76));var _0x85e5=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0x5e58[_0x4fa2da];return _0xd6958a;};'use strict';var _=require(_0x85e5('0x0'));var util=require(_0x85e5('0x1'));var logger=require('../../config/logger')(_0x85e5('0x2'));var moment=require(_0x85e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x85e5('0x4'));var fs=require('fs');var path=require(_0x85e5('0x5'));var rimraf=require(_0x85e5('0x6'));var config=require(_0x85e5('0x7'));var attributes=require(_0x85e5('0x8'));module[_0x85e5('0x9')]=function(_0x14404d,_0x38fc59){return _0x14404d[_0x85e5('0xa')]('ChatInteraction',attributes,{'tableName':_0x85e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x534e20,_0x3ab2de,_0x52cf7f){if(_0x534e20[_0x85e5('0xc')](_0x85e5('0xd'))){_0x534e20[_0x85e5('0xe')]=moment()[_0x85e5('0xf')](_0x85e5('0x10'));}_0x52cf7f(null,_0x534e20);}},'charset':_0x85e5('0x11'),'collate':_0x85e5('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e6f4892..ce5cfe7 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 _0x8c7b=['AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','addTags','body','ids','omit','spread'];(function(_0x27c401,_0x592dab){var _0x263b74=function(_0x55f9ce){while(--_0x55f9ce){_0x27c401['push'](_0x27c401['shift']());}};_0x263b74(++_0x592dab);}(_0x8c7b,0x79));var _0xb8c7=function(_0x76bdfe,_0x5d2824){_0x76bdfe=_0x76bdfe-0x0;var _0x5084ef=_0x8c7b[_0x76bdfe];return _0x5084ef;};'use strict';var _=require(_0xb8c7('0x0'));var util=require('util');var moment=require(_0xb8c7('0x1'));var BPromise=require(_0xb8c7('0x2'));var rs=require(_0xb8c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8c7('0x4'))['db'];var utils=require(_0xb8c7('0x5'));var logger=require(_0xb8c7('0x6'))('rpc');var config=require(_0xb8c7('0x7'));var jayson=require(_0xb8c7('0x8'));var client=jayson['client'][_0xb8c7('0x9')]({'port':0x232a});config[_0xb8c7('0xa')]=_[_0xb8c7('0xb')](config['redis'],{'host':_0xb8c7('0xc'),'port':0x18eb});var socket=require(_0xb8c7('0xd'))(new Redis(config[_0xb8c7('0xa')]));require(_0xb8c7('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c0248,_0x52630d,_0x16bb94){return new BPromise(function(_0x3ab8b2,_0x4981c0){return client[_0xb8c7('0xf')](_0x5c0248,_0x16bb94)[_0xb8c7('0x10')](function(_0x1365be){logger[_0xb8c7('0x11')](_0xb8c7('0x12'),_0x52630d,_0xb8c7('0x13'));logger[_0xb8c7('0x14')](_0xb8c7('0x15'),_0x52630d,'request\x20sent',JSON[_0xb8c7('0x16')](_0x1365be));if(_0x1365be[_0xb8c7('0x17')]){if(_0x1365be[_0xb8c7('0x17')]['code']===0x1f4){logger[_0xb8c7('0x17')](_0xb8c7('0x12'),_0x52630d,_0x1365be[_0xb8c7('0x17')]['message']);return _0x4981c0(_0x1365be[_0xb8c7('0x17')]['message']);}logger[_0xb8c7('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x52630d,_0x1365be['error'][_0xb8c7('0x18')]);return _0x3ab8b2(_0x1365be[_0xb8c7('0x17')]['message']);}else{logger[_0xb8c7('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x52630d,_0xb8c7('0x13'));_0x3ab8b2(_0x1365be[_0xb8c7('0x19')][_0xb8c7('0x18')]);}})[_0xb8c7('0x1a')](function(_0x4914a9){logger[_0xb8c7('0x17')](_0xb8c7('0x12'),_0x52630d,_0x4914a9);_0x4981c0(_0x4914a9);});});}exports['UpdateChatInteraction']=function(_0x17e925){var _0x101e3b=this;return new Promise(function(_0x4865fc,_0x1debb7){return db['ChatInteraction']['update'](_0x17e925['body'],{'raw':_0x17e925[_0xb8c7('0x1b')]?_0x17e925[_0xb8c7('0x1b')][_0xb8c7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e925[_0xb8c7('0x1b')]?_0x17e925[_0xb8c7('0x1b')][_0xb8c7('0x1d')]||null:null,'attributes':_0x17e925[_0xb8c7('0x1b')]?_0x17e925['options'][_0xb8c7('0x1e')]||null:null,'limit':_0x17e925['options']?_0x17e925['options'][_0xb8c7('0x1f')]||null:null})[_0xb8c7('0x10')](function(_0x1e529c){logger[_0xb8c7('0x11')](_0xb8c7('0x20'),_0x17e925);logger[_0xb8c7('0x14')](_0xb8c7('0x20'),_0x17e925,JSON[_0xb8c7('0x16')](_0x1e529c));_0x4865fc(_0x1e529c);})[_0xb8c7('0x1a')](function(_0x2e0c41){logger[_0xb8c7('0x17')](_0xb8c7('0x20'),_0x2e0c41[_0xb8c7('0x18')],_0x17e925);_0x1debb7(_0x101e3b[_0xb8c7('0x17')](0x1f4,_0x2e0c41['message']));});});};exports[_0xb8c7('0x21')]=function(_0x2cf4a4){return new Promise(function(_0x1be7fb,_0x557375){return db['ChatInteraction']['find']({'where':_0x2cf4a4[_0xb8c7('0x1b')]?_0x2cf4a4[_0xb8c7('0x1b')][_0xb8c7('0x1d')]||null:null})[_0xb8c7('0x10')](function(_0x4df8ec){if(_0x4df8ec){return _0x4df8ec[_0xb8c7('0x22')](_0x2cf4a4[_0xb8c7('0x23')][_0xb8c7('0x24')],_[_0xb8c7('0x25')](_0x2cf4a4[_0xb8c7('0x23')],[_0xb8c7('0x24'),'id'])||{});}})[_0xb8c7('0x26')](function(_0x4f6d75){logger['info'](_0xb8c7('0x27'),_0x2cf4a4);logger[_0xb8c7('0x14')](_0xb8c7('0x27'),_0x2cf4a4,JSON[_0xb8c7('0x16')](_0x4f6d75));_0x1be7fb(_0x4f6d75);})[_0xb8c7('0x1a')](function(_0x3cbe5d){logger[_0xb8c7('0x17')]('AddTags',_0x3cbe5d[_0xb8c7('0x18')],_0x2cf4a4);_0x557375(_this[_0xb8c7('0x17')](0x1f4,_0x3cbe5d[_0xb8c7('0x18')]));});});}; \ No newline at end of file +var _0x1012=['addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','ChatInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1012,0x10e));var _0x2101=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x1012[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0x2101('0x0'));var util=require(_0x2101('0x1'));var moment=require(_0x2101('0x2'));var BPromise=require('bluebird');var rs=require(_0x2101('0x3'));var fs=require('fs');var Redis=require(_0x2101('0x4'));var db=require(_0x2101('0x5'))['db'];var utils=require(_0x2101('0x6'));var logger=require('../../config/logger')(_0x2101('0x7'));var config=require(_0x2101('0x8'));var jayson=require(_0x2101('0x9'));var client=jayson[_0x2101('0xa')][_0x2101('0xb')]({'port':0x232a});config[_0x2101('0xc')]=_[_0x2101('0xd')](config['redis'],{'host':_0x2101('0xe'),'port':0x18eb});var socket=require(_0x2101('0xf'))(new Redis(config[_0x2101('0xc')]));require('./chatInteraction.socket')[_0x2101('0x10')](socket);function respondWithRpcPromise(_0x2e8deb,_0x36cab8,_0x1c44b3){return new BPromise(function(_0x2000db,_0x61ef2){return client[_0x2101('0x11')](_0x2e8deb,_0x1c44b3)[_0x2101('0x12')](function(_0x8cef8a){logger[_0x2101('0x13')](_0x2101('0x14'),_0x36cab8,_0x2101('0x15'));logger[_0x2101('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x36cab8,_0x2101('0x15'),JSON['stringify'](_0x8cef8a));if(_0x8cef8a[_0x2101('0x17')]){if(_0x8cef8a['error'][_0x2101('0x18')]===0x1f4){logger[_0x2101('0x17')](_0x2101('0x14'),_0x36cab8,_0x8cef8a['error']['message']);return _0x61ef2(_0x8cef8a['error'][_0x2101('0x19')]);}logger[_0x2101('0x17')](_0x2101('0x14'),_0x36cab8,_0x8cef8a[_0x2101('0x17')]['message']);return _0x2000db(_0x8cef8a[_0x2101('0x17')][_0x2101('0x19')]);}else{logger[_0x2101('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x36cab8,_0x2101('0x15'));_0x2000db(_0x8cef8a[_0x2101('0x1a')][_0x2101('0x19')]);}})[_0x2101('0x1b')](function(_0x16ab09){logger['error'](_0x2101('0x14'),_0x36cab8,_0x16ab09);_0x61ef2(_0x16ab09);});});}exports[_0x2101('0x1c')]=function(_0x594556){var _0x90732a=this;return new Promise(function(_0x1c07e6,_0x43cf8d){return db['ChatInteraction'][_0x2101('0x1d')](_0x594556['body'],{'raw':_0x594556[_0x2101('0x1e')]?_0x594556[_0x2101('0x1e')][_0x2101('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594556[_0x2101('0x1e')]?_0x594556[_0x2101('0x1e')][_0x2101('0x20')]||null:null,'attributes':_0x594556[_0x2101('0x1e')]?_0x594556['options'][_0x2101('0x21')]||null:null,'limit':_0x594556[_0x2101('0x1e')]?_0x594556[_0x2101('0x1e')][_0x2101('0x22')]||null:null})[_0x2101('0x12')](function(_0x23ce5f){logger[_0x2101('0x13')]('UpdateChatInteraction',_0x594556);logger['debug'](_0x2101('0x1c'),_0x594556,JSON[_0x2101('0x23')](_0x23ce5f));_0x1c07e6(_0x23ce5f);})[_0x2101('0x1b')](function(_0x7beb1){logger[_0x2101('0x17')](_0x2101('0x1c'),_0x7beb1[_0x2101('0x19')],_0x594556);_0x43cf8d(_0x90732a[_0x2101('0x17')](0x1f4,_0x7beb1['message']));});});};exports[_0x2101('0x24')]=function(_0x30a78f){return new Promise(function(_0x59413a,_0x5e5b9e){return db[_0x2101('0x25')]['find']({'where':_0x30a78f[_0x2101('0x1e')]?_0x30a78f[_0x2101('0x1e')][_0x2101('0x20')]||null:null})['then'](function(_0x4aa677){if(_0x4aa677){return _0x4aa677[_0x2101('0x26')](_0x30a78f[_0x2101('0x27')][_0x2101('0x28')],_[_0x2101('0x29')](_0x30a78f[_0x2101('0x27')],[_0x2101('0x28'),'id'])||{});}})[_0x2101('0x2a')](function(_0x232ace){logger[_0x2101('0x13')](_0x2101('0x2b'),_0x30a78f);logger[_0x2101('0x16')](_0x2101('0x2b'),_0x30a78f,JSON[_0x2101('0x23')](_0x232ace));_0x59413a(_0x232ace);})['catch'](function(_0x5efee5){logger[_0x2101('0x17')](_0x2101('0x2b'),_0x5efee5[_0x2101('0x19')],_0x30a78f);_0x5e5b9e(_this[_0x2101('0x17')](0x1f4,_0x5efee5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index dd7be1e..9d50915 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 _0x4403=['length','update','emit','removeListener'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4403,0x179));var _0x3440=function(_0x3b88d1,_0x22075b){_0x3b88d1=_0x3b88d1-0x0;var _0x393ed5=_0x4403[_0x3b88d1];return _0x393ed5;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x3440('0x0')];function createListener(_0x571a63,_0x173448){return function(_0x48ba88){_0x173448[_0x3440('0x1')](_0x571a63,_0x48ba88);};}function removeListener(_0x39386e,_0x4d4dc6){return function(){ChatInteractionEvents[_0x3440('0x2')](_0x39386e,_0x4d4dc6);};}exports['register']=function(_0x5904cb){for(var _0x1e5e8d=0x0,_0x3121bd=events[_0x3440('0x3')];_0x1e5e8d<_0x3121bd;_0x1e5e8d++){var _0x4abc5a=events[_0x1e5e8d];var _0x33a070=createListener('chatInteraction:'+_0x4abc5a,_0x5904cb);ChatInteractionEvents['on'](_0x4abc5a,_0x33a070);}}; \ No newline at end of file +var _0x8f4e=['chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x5510a6,_0x4975b9){var _0x962a10=function(_0x5cca76){while(--_0x5cca76){_0x5510a6['push'](_0x5510a6['shift']());}};_0x962a10(++_0x4975b9);}(_0x8f4e,0x149));var _0xe8f4=function(_0x15d984,_0x4170a0){_0x15d984=_0x15d984-0x0;var _0x3b574d=_0x8f4e[_0x15d984];return _0x3b574d;};'use strict';var ChatInteractionEvents=require(_0xe8f4('0x0'));var events=['save',_0xe8f4('0x1'),_0xe8f4('0x2')];function createListener(_0x42326d,_0x4cbe76){return function(_0x1a9c39){_0x4cbe76[_0xe8f4('0x3')](_0x42326d,_0x1a9c39);};}function removeListener(_0x3f734b,_0x547169){return function(){ChatInteractionEvents[_0xe8f4('0x4')](_0x3f734b,_0x547169);};}exports[_0xe8f4('0x5')]=function(_0x4d2238){for(var _0x37c911=0x0,_0x46e105=events[_0xe8f4('0x6')];_0x37c911<_0x46e105;_0x37c911++){var _0x3dd694=events[_0x37c911];var _0x3d6720=createListener(_0xe8f4('0x7')+_0x3dd694,_0x4d2238);ChatInteractionEvents['on'](_0x3dd694,_0x3d6720);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 42f94c7..19864fb 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 _0xfa20=['%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','root','server/files/attachments/','format'];(function(_0x4cf71f,_0x4354e1){var _0x14c6ab=function(_0x3a8d1c){while(--_0x3a8d1c){_0x4cf71f['push'](_0x4cf71f['shift']());}};_0x14c6ab(++_0x4354e1);}(_0xfa20,0x1b9));var _0x0fa2=function(_0x2608f6,_0x3e467){_0x2608f6=_0x2608f6-0x0;var _0x581a04=_0xfa20[_0x2608f6];return _0x581a04;};'use strict';var multer=require('multer');var util=require(_0x0fa2('0x0'));var path=require(_0x0fa2('0x1'));var timeout=require(_0x0fa2('0x2'));var express=require(_0x0fa2('0x3'));var router=express[_0x0fa2('0x4')]();var fs_extra=require(_0x0fa2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0fa2('0x6'));router[_0x0fa2('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fa2('0x8')]);router[_0x0fa2('0x7')](_0x0fa2('0x9'),auth['isAuthenticated'](),controller[_0x0fa2('0xa')]);router[_0x0fa2('0x7')](_0x0fa2('0xb'),auth[_0x0fa2('0xc')](),controller['show']);router[_0x0fa2('0x7')](_0x0fa2('0xd'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xe')]);router[_0x0fa2('0x7')]('/:id/messages',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x10')]);router['get'](_0x0fa2('0x11'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x12')]);router[_0x0fa2('0x7')](_0x0fa2('0x13'),auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x14')]);router[_0x0fa2('0x15')]('/',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x16')]);router[_0x0fa2('0x15')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0fa2('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4457a4,_0xa3fd52,_0x48b1e4){_0x48b1e4(null,path['join'](config[_0x0fa2('0x18')],_0x0fa2('0x19')));},'filename':function(_0x43e73e,_0x436e42,_0x2c9fe1){_0x2c9fe1(null,util[_0x0fa2('0x1a')](_0x0fa2('0x1b'),Date[_0x0fa2('0x1c')](),_0x436e42[_0x0fa2('0x1d')][_0x0fa2('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0fa2('0x15')](_0x0fa2('0x1f'),upload[_0x0fa2('0x20')](_0x0fa2('0x21')),controller[_0x0fa2('0x22')]);router[_0x0fa2('0x15')](_0x0fa2('0x23'),auth[_0x0fa2('0xc')](),controller['addMessage']);router[_0x0fa2('0x15')]('/:id/tags',auth[_0x0fa2('0xf')](),interaction[_0x0fa2('0x24')](_0x0fa2('0x25'),_0x0fa2('0x26')),controller[_0x0fa2('0x27')]);router[_0x0fa2('0x28')]('/:id',auth[_0x0fa2('0xf')](),interaction['tracked'](_0x0fa2('0x25'),_0x0fa2('0x29')),controller[_0x0fa2('0x2a')]);router[_0x0fa2('0x28')](_0x0fa2('0x2b'),controller['customUpdate']);router[_0x0fa2('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x0fa2('0x2c')]);router[_0x0fa2('0x28')](_0x0fa2('0x2d'),controller[_0x0fa2('0x2e')]);router[_0x0fa2('0x2f')](_0x0fa2('0xb'),auth[_0x0fa2('0xf')](),interaction[_0x0fa2('0x24')](_0x0fa2('0x25'),_0x0fa2('0x30')),controller[_0x0fa2('0x31')]);router[_0x0fa2('0x2f')]('/:id/tags',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x32')]);module[_0x0fa2('0x33')]=router; \ No newline at end of file +var _0x8d86=['abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon'];(function(_0x4dd329,_0x5dcc32){var _0x508d53=function(_0x58a6bf){while(--_0x58a6bf){_0x4dd329['push'](_0x4dd329['shift']());}};_0x508d53(++_0x5dcc32);}(_0x8d86,0xb2));var _0x68d8=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8d86[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x68d8('0x0'));var util=require(_0x68d8('0x1'));var path=require(_0x68d8('0x2'));var timeout=require(_0x68d8('0x3'));var express=require(_0x68d8('0x4'));var router=express[_0x68d8('0x5')]();var fs_extra=require(_0x68d8('0x6'));var auth=require(_0x68d8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x68d8('0x8'));var controller=require(_0x68d8('0x9'));router[_0x68d8('0xa')]('/',auth['isAuthenticated'](),controller[_0x68d8('0xb')]);router['get'](_0x68d8('0xc'),auth[_0x68d8('0xd')](),controller[_0x68d8('0xe')]);router[_0x68d8('0xa')](_0x68d8('0xf'),auth[_0x68d8('0x10')](),controller['show']);router['get']('/:id/attachment_download',auth[_0x68d8('0x10')](),controller[_0x68d8('0x11')]);router[_0x68d8('0xa')](_0x68d8('0x12'),auth['isAuthenticated'](),controller[_0x68d8('0x13')]);router[_0x68d8('0xa')](_0x68d8('0x14'),auth[_0x68d8('0x10')](),controller['getMyMessages']);router[_0x68d8('0xa')](_0x68d8('0x15'),auth[_0x68d8('0xd')](),controller[_0x68d8('0x16')]);router['post']('/',auth[_0x68d8('0xd')](),controller[_0x68d8('0x17')]);router[_0x68d8('0x18')](_0x68d8('0x19'),auth[_0x68d8('0xd')](),controller[_0x68d8('0x1a')]);var upload=multer({'storage':multer[_0x68d8('0x1b')]({'destination':function(_0x5b3107,_0xae59d7,_0x120c6b){_0x120c6b(null,path[_0x68d8('0x1c')](config['root'],_0x68d8('0x1d')));},'filename':function(_0x329831,_0x2b1a56,_0x2186a3){_0x2186a3(null,util[_0x68d8('0x1e')](_0x68d8('0x1f'),Date[_0x68d8('0x20')](),_0x2b1a56[_0x68d8('0x21')][_0x68d8('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x68d8('0x18')](_0x68d8('0x23'),upload[_0x68d8('0x24')](_0x68d8('0x25')),controller[_0x68d8('0x26')]);router[_0x68d8('0x18')]('/:id/messages',auth[_0x68d8('0x10')](),controller[_0x68d8('0x27')]);router[_0x68d8('0x18')](_0x68d8('0x28'),auth[_0x68d8('0xd')](),interaction['tracked']('chat',_0x68d8('0x29')),controller[_0x68d8('0x2a')]);router[_0x68d8('0x2b')](_0x68d8('0xf'),auth['isAuthenticated'](),interaction[_0x68d8('0x2c')](_0x68d8('0x2d'),_0x68d8('0x2e')),controller['update']);router[_0x68d8('0x2b')](_0x68d8('0x2f'),controller[_0x68d8('0x30')]);router['put'](_0x68d8('0x31'),auth[_0x68d8('0x10')](),controller[_0x68d8('0x32')]);router[_0x68d8('0x2b')]('/:id/close',controller[_0x68d8('0x33')]);router[_0x68d8('0x34')]('/:id',auth[_0x68d8('0xd')](),interaction['tracked'](_0x68d8('0x2d'),_0x68d8('0x35')),controller[_0x68d8('0x36')]);router[_0x68d8('0x34')](_0x68d8('0x28'),auth[_0x68d8('0xd')](),controller[_0x68d8('0x37')]);module[_0x68d8('0x38')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index eb47cc9..733f668 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 _0xa7b7=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xa7b7,0xd9));var _0x7a7b=function(_0x302788,_0x19fb7e){_0x302788=_0x302788-0x0;var _0x27297a=_0xa7b7[_0x302788];return _0x27297a;};'use strict';var Sequelize=require(_0x7a7b('0x0'));module[_0x7a7b('0x1')]={'body':{'type':Sequelize[_0x7a7b('0x2')](_0x7a7b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7a7b('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7a7b('0x5')]}}; \ No newline at end of file +var _0x0bee=['medium','BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x560b93,_0x1ef1e5){var _0x19604a=function(_0x46aaa5){while(--_0x46aaa5){_0x560b93['push'](_0x560b93['shift']());}};_0x19604a(++_0x1ef1e5);}(_0x0bee,0x1b6));var _0xe0be=function(_0x24656c,_0xf77cde){_0x24656c=_0x24656c-0x0;var _0x53f07f=_0x0bee[_0x24656c];return _0x53f07f;};'use strict';var Sequelize=require(_0xe0be('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0be('0x1')](_0xe0be('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe0be('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0be('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a903ac4..ac1a9ce 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 _0x7b4d=['find','create','body','update','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','user','fullname','role','internal','online','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','agent','push','messages','FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','then','destroy','error','stack','name','ChatInternalMessage','rawAttributes','fieldName','type','map','keys','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x10e206,_0x289f82){var _0x406fa9=function(_0x4260e8){while(--_0x4260e8){_0x10e206['push'](_0x10e206['shift']());}};_0x406fa9(++_0x289f82);}(_0x7b4d,0xed));var _0xd7b4=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x7b4d[_0x4f5108];return _0x2d56ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7b4('0x0'));var zipdir=require(_0xd7b4('0x1'));var jsonpatch=require(_0xd7b4('0x2'));var rp=require(_0xd7b4('0x3'));var moment=require(_0xd7b4('0x4'));var BPromise=require(_0xd7b4('0x5'));var Mustache=require(_0xd7b4('0x6'));var util=require('util');var path=require(_0xd7b4('0x7'));var sox=require(_0xd7b4('0x8'));var csv=require('to-csv');var ejs=require(_0xd7b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b4('0xa'));var squel=require(_0xd7b4('0xb'));var crypto=require(_0xd7b4('0xc'));var jsforce=require(_0xd7b4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd7b4('0xe'));var querystring=require(_0xd7b4('0xf'));var Papa=require(_0xd7b4('0x10'));var Redis=require(_0xd7b4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7b4('0x12'));var logger=require(_0xd7b4('0x13'))('api');var utils=require(_0xd7b4('0x14'));var config=require(_0xd7b4('0x15'));var licenseUtil=require(_0xd7b4('0x16'));var db=require(_0xd7b4('0x17'))['db'];config[_0xd7b4('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b4('0x19'))(new Redis(config['redis']));require(_0xd7b4('0x1a'))[_0xd7b4('0x1b')](socket);function respondWithStatusCode(_0x3f5d1a,_0x58ae54){_0x58ae54=_0x58ae54||0xcc;return function(_0x431433){if(_0x431433){return _0x3f5d1a[_0xd7b4('0x1c')](_0x58ae54);}return _0x3f5d1a[_0xd7b4('0x1d')](_0x58ae54)[_0xd7b4('0x1e')]();};}function respondWithResult(_0x24f903,_0x2a1066){_0x2a1066=_0x2a1066||0xc8;return function(_0x3d0ffa){if(_0x3d0ffa){return _0x24f903['status'](_0x2a1066)[_0xd7b4('0x1f')](_0x3d0ffa);}};}function respondWithFilteredResult(_0x140773,_0x4cb94c){return function(_0x115ae8){if(_0x115ae8){var _0x3e0394=typeof _0x4cb94c['offset']===_0xd7b4('0x20')&&typeof _0x4cb94c['limit']===_0xd7b4('0x20');var _0xe1e421=_0x115ae8[_0xd7b4('0x21')];var _0x428d39=_0x3e0394?0x0:_0x4cb94c[_0xd7b4('0x22')];var _0x724a70=_0x3e0394?_0x115ae8[_0xd7b4('0x21')]:_0x4cb94c[_0xd7b4('0x22')]+_0x4cb94c[_0xd7b4('0x23')];var _0x4601f9;if(_0x724a70>=_0xe1e421){_0x724a70=_0xe1e421;_0x4601f9=0xc8;}else{_0x4601f9=0xce;}_0x140773[_0xd7b4('0x1d')](_0x4601f9);return _0x140773['set'](_0xd7b4('0x24'),_0x428d39+'-'+_0x724a70+'/'+_0xe1e421)['json'](_0x115ae8);}return null;};}function patchUpdates(_0x57a952){return function(_0x3fd2ab){try{jsonpatch[_0xd7b4('0x25')](_0x3fd2ab,_0x57a952,!![]);}catch(_0x1ab3b4){return BPromise['reject'](_0x1ab3b4);}return _0x3fd2ab[_0xd7b4('0x26')]();};}function saveUpdates(_0x297b62,_0x21e943){return function(_0x154a9b){if(_0x154a9b){return _0x154a9b['update'](_0x297b62)[_0xd7b4('0x27')](function(_0x471e40){return _0x471e40;});}return null;};}function removeEntity(_0x3f2c80,_0x4b2246){return function(_0x504390){if(_0x504390){return _0x504390[_0xd7b4('0x28')]()['then'](function(){_0x3f2c80[_0xd7b4('0x1d')](0xcc)[_0xd7b4('0x1e')]();});}};}function handleEntityNotFound(_0x305643,_0x219229){return function(_0x1b4a40){if(!_0x1b4a40){_0x305643[_0xd7b4('0x1c')](0x194);}return _0x1b4a40;};}function handleError(_0x1cc6c2,_0x3f5cb2){_0x3f5cb2=_0x3f5cb2||0x1f4;return function(_0x567287){logger[_0xd7b4('0x29')](_0x567287[_0xd7b4('0x2a')]);if(_0x567287[_0xd7b4('0x2b')]){delete _0x567287['name'];}_0x1cc6c2[_0xd7b4('0x1d')](_0x3f5cb2)['send'](_0x567287);};}exports['index']=function(_0xafbd88,_0x6cb90d){var _0x33025d={},_0x5063eb={},_0x3af263={'count':0x0,'rows':[]};var _0x1e7f01=_['map'](db[_0xd7b4('0x2c')][_0xd7b4('0x2d')],function(_0x219c1f){return{'name':_0x219c1f[_0xd7b4('0x2e')],'type':_0x219c1f[_0xd7b4('0x2f')]['key']};});_0x5063eb['model']=_[_0xd7b4('0x30')](_0x1e7f01,_0xd7b4('0x2b'));_0x5063eb['query']=_[_0xd7b4('0x31')](_0xafbd88['query']);_0x5063eb[_0xd7b4('0x32')]=_[_0xd7b4('0x33')](_0x5063eb['model'],_0x5063eb[_0xd7b4('0x34')]);_0x33025d['attributes']=_[_0xd7b4('0x33')](_0x5063eb[_0xd7b4('0x35')],qs[_0xd7b4('0x36')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x36')]));_0x33025d[_0xd7b4('0x37')]=_0x33025d['attributes'][_0xd7b4('0x38')]?_0x33025d[_0xd7b4('0x37')]:_0x5063eb[_0xd7b4('0x35')];if(!_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x39')](_0xd7b4('0x3a'))){_0x33025d[_0xd7b4('0x23')]=qs[_0xd7b4('0x23')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x23')]);_0x33025d['offset']=qs['offset'](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x22')]);}_0x33025d['order']=qs[_0xd7b4('0x3b')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x3b')]);_0x33025d[_0xd7b4('0x3c')]=qs[_0xd7b4('0x32')](_[_0xd7b4('0x3d')](_0xafbd88[_0xd7b4('0x34')],_0x5063eb[_0xd7b4('0x32')]),_0x1e7f01);if(_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x3e')]){_0x33025d[_0xd7b4('0x3c')]=_[_0xd7b4('0x3f')](_0x33025d[_0xd7b4('0x3c')],{'$or':_['map'](_0x1e7f01,function(_0x1e7ef7){if(_0x1e7ef7['type']!==_0xd7b4('0x40')){var _0x5b4b91={};_0x5b4b91[_0x1e7ef7['name']]={'$like':'%'+_0xafbd88['query']['filter']+'%'};return _0x5b4b91;}})});}_0x33025d=_['merge']({},_0x33025d,_0xafbd88[_0xd7b4('0x41')]);var _0x46af67={'where':_0x33025d[_0xd7b4('0x3c')]};return db[_0xd7b4('0x2c')]['count'](_0x46af67)['then'](function(_0x229805){_0x3af263[_0xd7b4('0x21')]=_0x229805;if(_0xafbd88['query'][_0xd7b4('0x42')]){_0x33025d[_0xd7b4('0x43')]=[{'all':!![]}];}return db[_0xd7b4('0x2c')][_0xd7b4('0x44')](_0x33025d);})[_0xd7b4('0x27')](function(_0x3535b1){_0x3af263[_0xd7b4('0x45')]=_0x3535b1;return _0x3af263;})['then'](respondWithFilteredResult(_0x6cb90d,_0x33025d))[_0xd7b4('0x46')](handleError(_0x6cb90d,null));};exports['show']=function(_0x168bac,_0x217e30){var _0x2facab={'raw':!![],'where':{'id':_0x168bac[_0xd7b4('0x47')]['id']}},_0x37c62e={};_0x37c62e['model']=_[_0xd7b4('0x31')](db[_0xd7b4('0x2c')][_0xd7b4('0x2d')]);_0x37c62e[_0xd7b4('0x34')]=_['keys'](_0x168bac[_0xd7b4('0x34')]);_0x37c62e[_0xd7b4('0x32')]=_['intersection'](_0x37c62e[_0xd7b4('0x35')],_0x37c62e[_0xd7b4('0x34')]);_0x2facab[_0xd7b4('0x37')]=_[_0xd7b4('0x33')](_0x37c62e['model'],qs['fields'](_0x168bac[_0xd7b4('0x34')][_0xd7b4('0x36')]));_0x2facab['attributes']=_0x2facab['attributes'][_0xd7b4('0x38')]?_0x2facab[_0xd7b4('0x37')]:_0x37c62e[_0xd7b4('0x35')];if(_0x168bac[_0xd7b4('0x34')]['includeAll']){_0x2facab[_0xd7b4('0x43')]=[{'all':!![]}];}_0x2facab=_['merge']({},_0x2facab,_0x168bac[_0xd7b4('0x41')]);return db['ChatInternalMessage'][_0xd7b4('0x48')](_0x2facab)['then'](handleEntityNotFound(_0x217e30,null))[_0xd7b4('0x27')](respondWithResult(_0x217e30,null))[_0xd7b4('0x46')](handleError(_0x217e30,null));};exports[_0xd7b4('0x49')]=function(_0x21c405,_0x58cb71){return db[_0xd7b4('0x2c')][_0xd7b4('0x49')](_0x21c405[_0xd7b4('0x4a')],{})['then'](respondWithResult(_0x58cb71,0xc9))['catch'](handleError(_0x58cb71,null));};exports[_0xd7b4('0x4b')]=function(_0x3252ef,_0x3c4c00){if(_0x3252ef[_0xd7b4('0x4a')]['id']){delete _0x3252ef[_0xd7b4('0x4a')]['id'];}return db[_0xd7b4('0x2c')][_0xd7b4('0x48')]({'where':{'id':_0x3252ef['params']['id']}})[_0xd7b4('0x27')](handleEntityNotFound(_0x3c4c00,null))[_0xd7b4('0x27')](saveUpdates(_0x3252ef[_0xd7b4('0x4a')],null))['then'](respondWithResult(_0x3c4c00,null))[_0xd7b4('0x46')](handleError(_0x3c4c00,null));};exports['destroy']=function(_0x1ec05c,_0x5f58e4){return db[_0xd7b4('0x2c')][_0xd7b4('0x48')]({'where':{'id':_0x1ec05c['params']['id']}})['then'](handleEntityNotFound(_0x5f58e4,null))[_0xd7b4('0x27')](removeEntity(_0x5f58e4,null))[_0xd7b4('0x46')](handleError(_0x5f58e4,null));};exports[_0xd7b4('0x4c')]=function(_0x5aa03a,_0x28269e){return db[_0xd7b4('0x2c')]['describe']()[_0xd7b4('0x27')](respondWithResult(_0x28269e,null))[_0xd7b4('0x46')](handleError(_0x28269e,null));};function wrapUser(_0x56e356){return function(_0x2ab0c6){var _0x18e692=_0x56e356[_0xd7b4('0x4d')]({'plain':!![]});_0x18e692['messages']=[];if(_0x2ab0c6){_0x18e692[_0xd7b4('0x4e')]=_0x2ab0c6[_0xd7b4('0x4f')];_0x18e692['lastMessage']=_0x2ab0c6;}else{_0x18e692[_0xd7b4('0x4e')]=moment(0x0)[_0xd7b4('0x50')](_0xd7b4('0x51'));_0x18e692['lastMessage']={};}return _0x18e692;};}exports[_0xd7b4('0x52')]=function(_0x1ce51a,_0x35d294,_0x37ffe4){var _0x3798de=[];return db['User'][_0xd7b4('0x44')]({'where':{'role':['agent','admin',_0xd7b4('0x53')]},'attributes':['id',_0xd7b4('0x54'),_0xd7b4('0x2b'),_0xd7b4('0x55'),'userpic',_0xd7b4('0x56'),_0xd7b4('0x57'),'lastLoginAt',_0xd7b4('0x58'),_0xd7b4('0x59')],'order':qs[_0xd7b4('0x3b')]('-online'),'include':[{'model':db[_0xd7b4('0x5a')],'as':'VoiceQueues','attributes':['id',_0xd7b4('0x2b'),_0xd7b4('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x56ad88){if(_0x56ad88){var _0x3ddc1b=_0x1ce51a[_0xd7b4('0x53')][_0xd7b4('0x4d')]({'plain':!![]});if(!_0x3ddc1b)throw new Error(_0xd7b4('0x5b'));if(_0x3ddc1b[_0xd7b4('0x55')]===_0xd7b4('0x53')){return db['UserProfileSection'][_0xd7b4('0x48')]({'where':{'name':_0xd7b4('0x5c'),'userProfileId':_0x3ddc1b[_0xd7b4('0x5d')]},'raw':!![]})['then'](function(_0x5612c0){if(_0x5612c0){if(_0x5612c0[_0xd7b4('0x5e')]===0x0){return db['UserProfileResource'][_0xd7b4('0x44')]({'where':{'sectionId':_0x5612c0['id']},'raw':!![]})['then'](function(_0x37a63a){var _0x222abb=[];if(_[_0xd7b4('0x5f')](_0x37a63a)){_0x222abb=_['filter'](_0x56ad88,function(_0xe60cdc){if(_0xe60cdc[_0xd7b4('0x55')]!==_0xd7b4('0x60')){return _0xe60cdc;}});return _0x222abb;}else{for(var _0x4a017d=0x0;_0x4a017d<_0x56ad88[_0xd7b4('0x38')];_0x4a017d++){var _0x2da4e6=_0x56ad88[_0x4a017d];if(_0x2da4e6[_0xd7b4('0x55')]===_0xd7b4('0x60')){var _0x1a0e77=_[_0xd7b4('0x48')](_0x37a63a,function(_0x537eeb){return _0x537eeb['resourceId']===_0x2da4e6['id'];});if(_0x1a0e77)_0x222abb[_0xd7b4('0x61')](_0x2da4e6);}else{_0x222abb[_0xd7b4('0x61')](_0x2da4e6);}}return _0x222abb;}});}else{return _0x56ad88;}}else{var _0x5549b2=_[_0xd7b4('0x3e')](_0x56ad88,function(_0x1ab0c8){if(_0x1ab0c8[_0xd7b4('0x55')]!==_0xd7b4('0x60')){return _0x1ab0c8;}});return _0x5549b2;}});}else{return _0x56ad88;}}})[_0xd7b4('0x27')](function(_0x1cfcdc){var _0x48e7cd=[];if(_0x1cfcdc){_0x3798de=_0x1cfcdc;for(var _0x28ac62=0x0;_0x28ac62<_0x1cfcdc['length'];_0x28ac62+=0x1){_0x3798de[_0x28ac62][_0xd7b4('0x62')]=[];_0x48e7cd[_0xd7b4('0x61')](db[_0xd7b4('0x2c')]['find']({'where':{'FromId':[_0x1ce51a[_0xd7b4('0x53')]['id'],_0x1cfcdc[_0x28ac62]['id']],'ToId':[_0x1ce51a[_0xd7b4('0x53')]['id'],_0x1cfcdc[_0x28ac62]['id']],'ChatGroupId':null},'attributes':['id',_0xd7b4('0x4f'),_0xd7b4('0x63'),'ToId',_0xd7b4('0x64'),_0xd7b4('0x4a')],'order':qs[_0xd7b4('0x3b')](_0xd7b4('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd7b4('0x27')](wrapUser(_0x1cfcdc[_0x28ac62])));}return BPromise[_0xd7b4('0x66')](_0x48e7cd);}return[];})[_0xd7b4('0x27')](function(_0x5a2eba){return{'rows':_0x5a2eba,'count':_0x5a2eba[_0xd7b4('0x38')]};})[_0xd7b4('0x27')](respondWithResult(_0x35d294,null))[_0xd7b4('0x46')](handleError(_0x35d294,null));}; \ No newline at end of file +var _0x2d48=['destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','includeAll','include','create','body','catch','find','params','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','role','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then'];(function(_0x9e56ea,_0x24b70d){var _0x8dc669=function(_0x192796){while(--_0x192796){_0x9e56ea['push'](_0x9e56ea['shift']());}};_0x8dc669(++_0x24b70d);}(_0x2d48,0x189));var _0x82d4=function(_0x1fbc6d,_0x59e4af){_0x1fbc6d=_0x1fbc6d-0x0;var _0x1c702e=_0x2d48[_0x1fbc6d];return _0x1c702e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82d4('0x1'));var rp=require(_0x82d4('0x2'));var moment=require(_0x82d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x82d4('0x4'));var util=require(_0x82d4('0x5'));var path=require(_0x82d4('0x6'));var sox=require('sox');var csv=require(_0x82d4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82d4('0x8'));var _=require('lodash');var squel=require(_0x82d4('0x9'));var crypto=require(_0x82d4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x82d4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x82d4('0xc'));var Redis=require(_0x82d4('0xd'));var authService=require(_0x82d4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x82d4('0xf'));var hardwareService=require(_0x82d4('0x10'));var logger=require(_0x82d4('0x11'))(_0x82d4('0x12'));var utils=require('../../config/utils');var config=require(_0x82d4('0x13'));var licenseUtil=require(_0x82d4('0x14'));var db=require(_0x82d4('0x15'))['db'];config['redis']=_['defaults'](config[_0x82d4('0x16')],{'host':_0x82d4('0x17'),'port':0x18eb});var socket=require(_0x82d4('0x18'))(new Redis(config[_0x82d4('0x16')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x31cb42,_0x28714e){_0x28714e=_0x28714e||0xcc;return function(_0x4faf1f){if(_0x4faf1f){return _0x31cb42[_0x82d4('0x19')](_0x28714e);}return _0x31cb42[_0x82d4('0x1a')](_0x28714e)[_0x82d4('0x1b')]();};}function respondWithResult(_0xc08a01,_0x1defb3){_0x1defb3=_0x1defb3||0xc8;return function(_0x33836e){if(_0x33836e){return _0xc08a01['status'](_0x1defb3)['json'](_0x33836e);}};}function respondWithFilteredResult(_0x4926b9,_0x5893b8){return function(_0x196b5e){if(_0x196b5e){var _0x1bbb1f=typeof _0x5893b8[_0x82d4('0x1c')]===_0x82d4('0x1d')&&typeof _0x5893b8[_0x82d4('0x1e')]===_0x82d4('0x1d');var _0x2516c4=_0x196b5e[_0x82d4('0x1f')];var _0x4c8906=_0x1bbb1f?0x0:_0x5893b8[_0x82d4('0x1c')];var _0x592467=_0x1bbb1f?_0x196b5e['count']:_0x5893b8[_0x82d4('0x1c')]+_0x5893b8[_0x82d4('0x1e')];var _0x52c8d5;if(_0x592467>=_0x2516c4){_0x592467=_0x2516c4;_0x52c8d5=0xc8;}else{_0x52c8d5=0xce;}_0x4926b9['status'](_0x52c8d5);return _0x4926b9[_0x82d4('0x20')](_0x82d4('0x21'),_0x4c8906+'-'+_0x592467+'/'+_0x2516c4)[_0x82d4('0x22')](_0x196b5e);}return null;};}function patchUpdates(_0x2ddbd0){return function(_0x426d7f){try{jsonpatch[_0x82d4('0x23')](_0x426d7f,_0x2ddbd0,!![]);}catch(_0x30955d){return BPromise['reject'](_0x30955d);}return _0x426d7f[_0x82d4('0x24')]();};}function saveUpdates(_0x342d27,_0x1252b5){return function(_0x2ab603){if(_0x2ab603){return _0x2ab603[_0x82d4('0x25')](_0x342d27)[_0x82d4('0x26')](function(_0x1feab5){return _0x1feab5;});}return null;};}function removeEntity(_0x597b72,_0x3e1f2b){return function(_0x176c54){if(_0x176c54){return _0x176c54[_0x82d4('0x27')]()[_0x82d4('0x26')](function(){_0x597b72['status'](0xcc)[_0x82d4('0x1b')]();});}};}function handleEntityNotFound(_0x4242d4,_0x5d3798){return function(_0x57f6cc){if(!_0x57f6cc){_0x4242d4[_0x82d4('0x19')](0x194);}return _0x57f6cc;};}function handleError(_0x186342,_0x30ad3e){_0x30ad3e=_0x30ad3e||0x1f4;return function(_0x2284c1){logger[_0x82d4('0x28')](_0x2284c1[_0x82d4('0x29')]);if(_0x2284c1[_0x82d4('0x2a')]){delete _0x2284c1['name'];}_0x186342[_0x82d4('0x1a')](_0x30ad3e)[_0x82d4('0x2b')](_0x2284c1);};}exports[_0x82d4('0x2c')]=function(_0x353bca,_0x4a2898){var _0xead602={},_0x4e1fbc={},_0x39818c={'count':0x0,'rows':[]};var _0x2db76a=_['map'](db[_0x82d4('0x2d')][_0x82d4('0x2e')],function(_0x5f76b2){return{'name':_0x5f76b2['fieldName'],'type':_0x5f76b2[_0x82d4('0x2f')][_0x82d4('0x30')]};});_0x4e1fbc[_0x82d4('0x31')]=_[_0x82d4('0x32')](_0x2db76a,_0x82d4('0x2a'));_0x4e1fbc['query']=_[_0x82d4('0x33')](_0x353bca['query']);_0x4e1fbc[_0x82d4('0x34')]=_[_0x82d4('0x35')](_0x4e1fbc[_0x82d4('0x31')],_0x4e1fbc[_0x82d4('0x36')]);_0xead602['attributes']=_[_0x82d4('0x35')](_0x4e1fbc[_0x82d4('0x31')],qs[_0x82d4('0x37')](_0x353bca['query']['fields']));_0xead602[_0x82d4('0x38')]=_0xead602['attributes'][_0x82d4('0x39')]?_0xead602['attributes']:_0x4e1fbc[_0x82d4('0x31')];if(!_0x353bca[_0x82d4('0x36')][_0x82d4('0x3a')](_0x82d4('0x3b'))){_0xead602[_0x82d4('0x1e')]=qs[_0x82d4('0x1e')](_0x353bca['query'][_0x82d4('0x1e')]);_0xead602['offset']=qs[_0x82d4('0x1c')](_0x353bca[_0x82d4('0x36')][_0x82d4('0x1c')]);}_0xead602[_0x82d4('0x3c')]=qs[_0x82d4('0x3d')](_0x353bca['query'][_0x82d4('0x3d')]);_0xead602[_0x82d4('0x3e')]=qs[_0x82d4('0x34')](_[_0x82d4('0x3f')](_0x353bca[_0x82d4('0x36')],_0x4e1fbc[_0x82d4('0x34')]),_0x2db76a);if(_0x353bca[_0x82d4('0x36')][_0x82d4('0x40')]){_0xead602[_0x82d4('0x3e')]=_[_0x82d4('0x41')](_0xead602[_0x82d4('0x3e')],{'$or':_['map'](_0x2db76a,function(_0x2e98cb){if(_0x2e98cb[_0x82d4('0x2f')]!==_0x82d4('0x42')){var _0x5c1831={};_0x5c1831[_0x2e98cb[_0x82d4('0x2a')]]={'$like':'%'+_0x353bca[_0x82d4('0x36')][_0x82d4('0x40')]+'%'};return _0x5c1831;}})});}_0xead602=_['merge']({},_0xead602,_0x353bca[_0x82d4('0x43')]);var _0x59a017={'where':_0xead602['where']};return db['ChatInternalMessage'][_0x82d4('0x1f')](_0x59a017)[_0x82d4('0x26')](function(_0x528291){_0x39818c[_0x82d4('0x1f')]=_0x528291;if(_0x353bca[_0x82d4('0x36')]['includeAll']){_0xead602['include']=[{'all':!![]}];}return db[_0x82d4('0x2d')]['findAll'](_0xead602);})[_0x82d4('0x26')](function(_0x48a9ba){_0x39818c[_0x82d4('0x44')]=_0x48a9ba;return _0x39818c;})[_0x82d4('0x26')](respondWithFilteredResult(_0x4a2898,_0xead602))['catch'](handleError(_0x4a2898,null));};exports['show']=function(_0x1fb171,_0x4373a4){var _0x34d0e8={'raw':!![],'where':{'id':_0x1fb171['params']['id']}},_0x2f88f6={};_0x2f88f6[_0x82d4('0x31')]=_[_0x82d4('0x33')](db[_0x82d4('0x2d')][_0x82d4('0x2e')]);_0x2f88f6['query']=_[_0x82d4('0x33')](_0x1fb171['query']);_0x2f88f6['filters']=_[_0x82d4('0x35')](_0x2f88f6[_0x82d4('0x31')],_0x2f88f6[_0x82d4('0x36')]);_0x34d0e8[_0x82d4('0x38')]=_[_0x82d4('0x35')](_0x2f88f6[_0x82d4('0x31')],qs[_0x82d4('0x37')](_0x1fb171[_0x82d4('0x36')][_0x82d4('0x37')]));_0x34d0e8['attributes']=_0x34d0e8['attributes'][_0x82d4('0x39')]?_0x34d0e8[_0x82d4('0x38')]:_0x2f88f6[_0x82d4('0x31')];if(_0x1fb171['query'][_0x82d4('0x45')]){_0x34d0e8[_0x82d4('0x46')]=[{'all':!![]}];}_0x34d0e8=_[_0x82d4('0x41')]({},_0x34d0e8,_0x1fb171[_0x82d4('0x43')]);return db['ChatInternalMessage']['find'](_0x34d0e8)['then'](handleEntityNotFound(_0x4373a4,null))[_0x82d4('0x26')](respondWithResult(_0x4373a4,null))['catch'](handleError(_0x4373a4,null));};exports[_0x82d4('0x47')]=function(_0x57ba21,_0x465c0c){return db[_0x82d4('0x2d')]['create'](_0x57ba21[_0x82d4('0x48')],{})[_0x82d4('0x26')](respondWithResult(_0x465c0c,0xc9))[_0x82d4('0x49')](handleError(_0x465c0c,null));};exports['update']=function(_0x378d5c,_0x360780){if(_0x378d5c['body']['id']){delete _0x378d5c['body']['id'];}return db['ChatInternalMessage'][_0x82d4('0x4a')]({'where':{'id':_0x378d5c[_0x82d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x360780,null))[_0x82d4('0x26')](saveUpdates(_0x378d5c[_0x82d4('0x48')],null))[_0x82d4('0x26')](respondWithResult(_0x360780,null))[_0x82d4('0x49')](handleError(_0x360780,null));};exports[_0x82d4('0x27')]=function(_0x15b66d,_0x25d646){return db['ChatInternalMessage'][_0x82d4('0x4a')]({'where':{'id':_0x15b66d[_0x82d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25d646,null))['then'](removeEntity(_0x25d646,null))[_0x82d4('0x49')](handleError(_0x25d646,null));};exports['describe']=function(_0x41caef,_0x109704){return db[_0x82d4('0x2d')][_0x82d4('0x4c')]()[_0x82d4('0x26')](respondWithResult(_0x109704,null))[_0x82d4('0x49')](handleError(_0x109704,null));};function wrapUser(_0x48300e){return function(_0x133d0e){var _0x120f3f=_0x48300e[_0x82d4('0x4d')]({'plain':!![]});_0x120f3f[_0x82d4('0x4e')]=[];if(_0x133d0e){_0x120f3f[_0x82d4('0x4f')]=_0x133d0e['createdAt'];_0x120f3f[_0x82d4('0x50')]=_0x133d0e;}else{_0x120f3f['lastMessageAt']=moment(0x0)['format'](_0x82d4('0x51'));_0x120f3f['lastMessage']={};}return _0x120f3f;};}exports['getUsers']=function(_0x16d40b,_0x400cff,_0x12600c){var _0x4f0118=[];return db[_0x82d4('0x52')][_0x82d4('0x53')]({'where':{'role':[_0x82d4('0x54'),_0x82d4('0x55'),'user']},'attributes':['id',_0x82d4('0x56'),_0x82d4('0x2a'),_0x82d4('0x57'),_0x82d4('0x58'),_0x82d4('0x59'),'online',_0x82d4('0x5a'),_0x82d4('0x5b'),'showWebBar'],'order':qs[_0x82d4('0x3d')](_0x82d4('0x5c')),'include':[{'model':db['VoiceQueue'],'as':_0x82d4('0x5d'),'attributes':['id',_0x82d4('0x2a'),_0x82d4('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x17b94a){if(_0x17b94a){var _0x3cfb5f=_0x16d40b[_0x82d4('0x5e')][_0x82d4('0x4d')]({'plain':!![]});if(!_0x3cfb5f)throw new Error(_0x82d4('0x5f'));if(_0x3cfb5f[_0x82d4('0x57')]===_0x82d4('0x5e')){return db[_0x82d4('0x60')][_0x82d4('0x4a')]({'where':{'name':_0x82d4('0x61'),'userProfileId':_0x3cfb5f[_0x82d4('0x62')]},'raw':!![]})['then'](function(_0x3b580c){if(_0x3b580c){if(_0x3b580c[_0x82d4('0x63')]===0x0){return db[_0x82d4('0x64')][_0x82d4('0x53')]({'where':{'sectionId':_0x3b580c['id']},'raw':!![]})[_0x82d4('0x26')](function(_0x27a5fd){var _0x29cb36=[];if(_[_0x82d4('0x65')](_0x27a5fd)){_0x29cb36=_[_0x82d4('0x40')](_0x17b94a,function(_0x348394){if(_0x348394[_0x82d4('0x57')]!==_0x82d4('0x54')){return _0x348394;}});return _0x29cb36;}else{for(var _0x299d7c=0x0;_0x299d7c<_0x17b94a[_0x82d4('0x39')];_0x299d7c++){var _0x80da31=_0x17b94a[_0x299d7c];if(_0x80da31[_0x82d4('0x57')]===_0x82d4('0x54')){var _0x2abe2e=_[_0x82d4('0x4a')](_0x27a5fd,function(_0x5b1bff){return _0x5b1bff[_0x82d4('0x66')]===_0x80da31['id'];});if(_0x2abe2e)_0x29cb36['push'](_0x80da31);}else{_0x29cb36[_0x82d4('0x67')](_0x80da31);}}return _0x29cb36;}});}else{return _0x17b94a;}}else{var _0x48d9af=_[_0x82d4('0x40')](_0x17b94a,function(_0x5f31c9){if(_0x5f31c9[_0x82d4('0x57')]!==_0x82d4('0x54')){return _0x5f31c9;}});return _0x48d9af;}});}else{return _0x17b94a;}}})[_0x82d4('0x26')](function(_0x3468b6){var _0x510c7e=[];if(_0x3468b6){_0x4f0118=_0x3468b6;for(var _0x32a38f=0x0;_0x32a38f<_0x3468b6[_0x82d4('0x39')];_0x32a38f+=0x1){_0x4f0118[_0x32a38f][_0x82d4('0x4e')]=[];_0x510c7e[_0x82d4('0x67')](db['ChatInternalMessage'][_0x82d4('0x4a')]({'where':{'FromId':[_0x16d40b[_0x82d4('0x5e')]['id'],_0x3468b6[_0x32a38f]['id']],'ToId':[_0x16d40b[_0x82d4('0x5e')]['id'],_0x3468b6[_0x32a38f]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x82d4('0x68'),_0x82d4('0x69'),'read',_0x82d4('0x48')],'order':qs[_0x82d4('0x3d')](_0x82d4('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x82d4('0x26')](wrapUser(_0x3468b6[_0x32a38f])));}return BPromise[_0x82d4('0x6b')](_0x510c7e);}return[];})[_0x82d4('0x26')](function(_0x4d7e81){return{'rows':_0x4d7e81,'count':_0x4d7e81[_0x82d4('0x39')]};})[_0x82d4('0x26')](respondWithResult(_0x400cff,null))['catch'](handleError(_0x400cff,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index be69a73..edea5b8 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 _0x90ad=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0x90ad,0x195));var _0xd90a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x90ad[_0x45e98e];return _0x374dba;};'use strict';var EventEmitter=require(_0xd90a('0x0'));var ChatInternalMessage=require(_0xd90a('0x1'))['db'][_0xd90a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd90a('0x3')](0x0);var events={'afterCreate':_0xd90a('0x4'),'afterUpdate':'update','afterDestroy':_0xd90a('0x5')};function emitEvent(_0x844190){return function(_0x45e9f3,_0x5e9622,_0x2691eb){ChatInternalMessageEvents['emit'](_0x844190+':'+_0x45e9f3['id'],_0x45e9f3);ChatInternalMessageEvents[_0xd90a('0x6')](_0x844190,_0x45e9f3);_0x2691eb(null);};}for(var e in events){if(events[_0xd90a('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xd90a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x713e=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','emit'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x713e,0x147));var _0xe713=function(_0x4b0be5,_0x1ed1aa){_0x4b0be5=_0x4b0be5-0x0;var _0x4b2c39=_0x713e[_0x4b0be5];return _0x4b2c39;};'use strict';var EventEmitter=require(_0xe713('0x0'));var ChatInternalMessage=require(_0xe713('0x1'))['db'][_0xe713('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe713('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe713('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b445c){return function(_0x2db85b,_0x508928,_0x3d8012){ChatInternalMessageEvents[_0xe713('0x5')](_0x3b445c+':'+_0x2db85b['id'],_0x2db85b);ChatInternalMessageEvents['emit'](_0x3b445c,_0x2db85b);_0x3d8012(null);};}for(var e in events){if(events[_0xe713('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe713('0x7')](e,emitEvent(event));}}module[_0xe713('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f09d21a..a5ae1a4 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 _0x95bf=['define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x19a033,_0x232dca){var _0x4fcc51=function(_0x1a739a){while(--_0x1a739a){_0x19a033['push'](_0x19a033['shift']());}};_0x4fcc51(++_0x232dca);}(_0x95bf,0x154));var _0xf95b=function(_0x18d9ad,_0x43470d){_0x18d9ad=_0x18d9ad-0x0;var _0x3f8261=_0x95bf[_0x18d9ad];return _0x3f8261;};'use strict';var _=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var logger=require(_0xf95b('0x2'))(_0xf95b('0x3'));var moment=require(_0xf95b('0x4'));var BPromise=require('bluebird');var rp=require(_0xf95b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf95b('0x6'));var config=require(_0xf95b('0x7'));var attributes=require(_0xf95b('0x8'));module[_0xf95b('0x9')]=function(_0x2c9c58,_0x22782e){return _0x2c9c58[_0xf95b('0xa')](_0xf95b('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf95b('0xc'),'collate':_0xf95b('0xd')});}; \ No newline at end of file +var _0x265a=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x25e6e9,_0x1a67dd){var _0x10fa00=function(_0x46b348){while(--_0x46b348){_0x25e6e9['push'](_0x25e6e9['shift']());}};_0x10fa00(++_0x1a67dd);}(_0x265a,0x10d));var _0xa265=function(_0x2bf718,_0x505c23){_0x2bf718=_0x2bf718-0x0;var _0x6cc4ef=_0x265a[_0x2bf718];return _0x6cc4ef;};'use strict';var _=require('lodash');var util=require(_0xa265('0x0'));var logger=require(_0xa265('0x1'))('api');var moment=require(_0xa265('0x2'));var BPromise=require(_0xa265('0x3'));var rp=require(_0xa265('0x4'));var fs=require('fs');var path=require(_0xa265('0x5'));var rimraf=require(_0xa265('0x6'));var config=require(_0xa265('0x7'));var attributes=require(_0xa265('0x8'));module[_0xa265('0x9')]=function(_0x5916e2,_0x4ae662){return _0x5916e2[_0xa265('0xa')](_0xa265('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1c45417..281e93d 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 _0xa849=['register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x37f579,_0x394cfe){var _0xdaf138=function(_0x518fa1){while(--_0x518fa1){_0x37f579['push'](_0x37f579['shift']());}};_0xdaf138(++_0x394cfe);}(_0xa849,0x106));var _0x9a84=function(_0x4746be,_0x14d1ec){_0x4746be=_0x4746be-0x0;var _0x3fb821=_0xa849[_0x4746be];return _0x3fb821;};'use strict';var _=require(_0x9a84('0x0'));var util=require(_0x9a84('0x1'));var moment=require('moment');var BPromise=require(_0x9a84('0x2'));var rs=require(_0x9a84('0x3'));var fs=require('fs');var Redis=require(_0x9a84('0x4'));var db=require(_0x9a84('0x5'))['db'];var utils=require(_0x9a84('0x6'));var logger=require(_0x9a84('0x7'))(_0x9a84('0x8'));var config=require(_0x9a84('0x9'));var jayson=require(_0x9a84('0xa'));var client=jayson[_0x9a84('0xb')][_0x9a84('0xc')]({'port':0x232a});config[_0x9a84('0xd')]=_[_0x9a84('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9a84('0xf'))(new Redis(config[_0x9a84('0xd')]));require(_0x9a84('0x10'))[_0x9a84('0x11')](socket);function respondWithRpcPromise(_0x4fe52b,_0x694848,_0x1c0033){return new BPromise(function(_0x45e924,_0xb032b4){return client[_0x9a84('0x12')](_0x4fe52b,_0x1c0033)[_0x9a84('0x13')](function(_0x305bae){logger[_0x9a84('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x694848,_0x9a84('0x15'));logger[_0x9a84('0x16')](_0x9a84('0x17'),_0x694848,_0x9a84('0x15'),JSON[_0x9a84('0x18')](_0x305bae));if(_0x305bae['error']){if(_0x305bae[_0x9a84('0x19')][_0x9a84('0x1a')]===0x1f4){logger[_0x9a84('0x19')](_0x9a84('0x1b'),_0x694848,_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);return _0xb032b4(_0x305bae['error']['message']);}logger[_0x9a84('0x19')](_0x9a84('0x1b'),_0x694848,_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);return _0x45e924(_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);}else{logger[_0x9a84('0x14')](_0x9a84('0x1b'),_0x694848,_0x9a84('0x15'));_0x45e924(_0x305bae[_0x9a84('0x1d')]['message']);}})[_0x9a84('0x1e')](function(_0xff810e){logger[_0x9a84('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x694848,_0xff810e);_0xb032b4(_0xff810e);});});} \ No newline at end of file +var _0x80bf=['redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4a2346,_0x354e69){var _0xdb2753=function(_0x1ecc9b){while(--_0x1ecc9b){_0x4a2346['push'](_0x4a2346['shift']());}};_0xdb2753(++_0x354e69);}(_0x80bf,0x148));var _0xf80b=function(_0x1d451d,_0x19fa31){_0x1d451d=_0x1d451d-0x0;var _0x33805e=_0x80bf[_0x1d451d];return _0x33805e;};'use strict';var _=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var moment=require('moment');var BPromise=require(_0xf80b('0x2'));var rs=require(_0xf80b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf80b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf80b('0x5'))('rpc');var config=require(_0xf80b('0x6'));var jayson=require(_0xf80b('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf80b('0x8')]=_['defaults'](config[_0xf80b('0x8')],{'host':_0xf80b('0x9'),'port':0x18eb});var socket=require(_0xf80b('0xa'))(new Redis(config[_0xf80b('0x8')]));require(_0xf80b('0xb'))[_0xf80b('0xc')](socket);function respondWithRpcPromise(_0x28441e,_0x2c8a31,_0x55cb46){return new BPromise(function(_0x58445e,_0x44edf6){return client[_0xf80b('0xd')](_0x28441e,_0x55cb46)['then'](function(_0x5ed460){logger[_0xf80b('0xe')](_0xf80b('0xf'),_0x2c8a31,_0xf80b('0x10'));logger['debug'](_0xf80b('0x11'),_0x2c8a31,_0xf80b('0x10'),JSON['stringify'](_0x5ed460));if(_0x5ed460[_0xf80b('0x12')]){if(_0x5ed460[_0xf80b('0x12')]['code']===0x1f4){logger[_0xf80b('0x12')](_0xf80b('0xf'),_0x2c8a31,_0x5ed460['error'][_0xf80b('0x13')]);return _0x44edf6(_0x5ed460[_0xf80b('0x12')][_0xf80b('0x13')]);}logger[_0xf80b('0x12')](_0xf80b('0xf'),_0x2c8a31,_0x5ed460[_0xf80b('0x12')][_0xf80b('0x13')]);return _0x58445e(_0x5ed460['error']['message']);}else{logger[_0xf80b('0xe')](_0xf80b('0xf'),_0x2c8a31,'request\x20sent');_0x58445e(_0x5ed460[_0xf80b('0x14')]['message']);}})['catch'](function(_0x6f2d4b){logger[_0xf80b('0x12')](_0xf80b('0xf'),_0x2c8a31,_0x6f2d4b);_0x44edf6(_0x6f2d4b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9ef1d75..b3ff617 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 _0x12a2=['./chatInternalMessage.events','update','emit','removeListener','register'];(function(_0x4873d6,_0x69d7ee){var _0x54d3e9=function(_0x230bd8){while(--_0x230bd8){_0x4873d6['push'](_0x4873d6['shift']());}};_0x54d3e9(++_0x69d7ee);}(_0x12a2,0xb9));var _0x212a=function(_0x5a32ee,_0x5604f1){_0x5a32ee=_0x5a32ee-0x0;var _0x447948=_0x12a2[_0x5a32ee];return _0x447948;};'use strict';var ChatInternalMessageEvents=require(_0x212a('0x0'));var events=['save','remove',_0x212a('0x1')];function createListener(_0x14a895,_0x59db37){return function(_0x977524){_0x59db37[_0x212a('0x2')](_0x14a895,_0x977524);};}function removeListener(_0x12ff77,_0x4769b0){return function(){ChatInternalMessageEvents[_0x212a('0x3')](_0x12ff77,_0x4769b0);};}exports[_0x212a('0x4')]=function(_0x5b082e){for(var _0x34c31e=0x0,_0x254f4b=events['length'];_0x34c31e<_0x254f4b;_0x34c31e++){var _0x371261=events[_0x34c31e];var _0x3aaa21=createListener('chatInternalMessage:'+_0x371261,_0x5b082e);ChatInternalMessageEvents['on'](_0x371261,_0x3aaa21);}}; \ No newline at end of file +var _0xa323=['emit','register','chatInternalMessage:','save','remove','update'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0xa323,0x183));var _0x3a32=function(_0x323413,_0x421d63){_0x323413=_0x323413-0x0;var _0xe2aca0=_0xa323[_0x323413];return _0xe2aca0;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x3a32('0x0'),_0x3a32('0x1'),_0x3a32('0x2')];function createListener(_0x375365,_0x2e7c6d){return function(_0x52da16){_0x2e7c6d[_0x3a32('0x3')](_0x375365,_0x52da16);};}function removeListener(_0x2a24e8,_0xbfe564){return function(){ChatInternalMessageEvents['removeListener'](_0x2a24e8,_0xbfe564);};}exports[_0x3a32('0x4')]=function(_0x27f9fb){for(var _0x449f3c=0x0,_0x11ee52=events['length'];_0x449f3c<_0x11ee52;_0x449f3c++){var _0x199b99=events[_0x449f3c];var _0x5be84b=createListener(_0x3a32('0x5')+_0x199b99,_0x27f9fb);ChatInternalMessageEvents['on'](_0x199b99,_0x5be84b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7575b89..b2c184d 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 _0xc9af=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc9af,0x91));var _0xfc9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc9af[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc9a('0x2')]();var fs_extra=require(_0xfc9a('0x3'));var auth=require(_0xfc9a('0x4'));var interaction=require(_0xfc9a('0x5'));var config=require(_0xfc9a('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xfc9a('0x7')]('/',auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x9')]);router[_0xfc9a('0x7')](_0xfc9a('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfc9a('0xb'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0xc')]);router['get'](_0xfc9a('0xd'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0xe')]);router[_0xfc9a('0xf')]('/',auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x10')]);router[_0xfc9a('0x11')](_0xfc9a('0xd'),controller[_0xfc9a('0x12')]);router[_0xfc9a('0x13')](_0xfc9a('0xd'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x742d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','show','post','create','/:id','delete','destroy','exports','multer','util','path'];(function(_0x291601,_0x17810b){var _0x3f935a=function(_0x53ccb6){while(--_0x53ccb6){_0x291601['push'](_0x291601['shift']());}};_0x3f935a(++_0x17810b);}(_0x742d,0xc3));var _0xd742=function(_0x39d72e,_0xdf39d){_0x39d72e=_0x39d72e-0x0;var _0x317dd5=_0x742d[_0x39d72e];return _0x317dd5;};'use strict';var multer=require(_0xd742('0x0'));var util=require(_0xd742('0x1'));var path=require(_0xd742('0x2'));var timeout=require(_0xd742('0x3'));var express=require(_0xd742('0x4'));var router=express[_0xd742('0x5')]();var fs_extra=require(_0xd742('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd742('0x7'));var config=require('../../config/environment');var controller=require(_0xd742('0x8'));router[_0xd742('0x9')]('/',auth[_0xd742('0xa')](),controller['index']);router['get'](_0xd742('0xb'),auth['isAuthenticated'](),controller[_0xd742('0xc')]);router[_0xd742('0x9')](_0xd742('0xd'),auth[_0xd742('0xa')](),controller[_0xd742('0xe')]);router[_0xd742('0x9')]('/:id',auth[_0xd742('0xa')](),controller[_0xd742('0xf')]);router[_0xd742('0x10')]('/',auth[_0xd742('0xa')](),controller[_0xd742('0x11')]);router['put'](_0xd742('0x12'),controller['update']);router[_0xd742('0x13')](_0xd742('0x12'),auth[_0xd742('0xa')](),controller[_0xd742('0x14')]);module[_0xd742('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 76db648..fdee405 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 _0xa45c=['TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x2de639,_0x3d4562){var _0x47ae92=function(_0x31912f){while(--_0x31912f){_0x2de639['push'](_0x2de639['shift']());}};_0x47ae92(++_0x3d4562);}(_0xa45c,0x6d));var _0xca45=function(_0x3d3cbc,_0x508a41){_0x3d3cbc=_0x3d3cbc-0x0;var _0x17cf61=_0xa45c[_0x3d3cbc];return _0x17cf61;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xca45('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xca45('0x3')]('in','out'),'defaultValue':_0xca45('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xca45('0x5')]}}; \ No newline at end of file +var _0xb84e=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x46edd0,_0xa811c3){var _0x3232d8=function(_0x45f66c){while(--_0x45f66c){_0x46edd0['push'](_0x46edd0['shift']());}};_0x3232d8(++_0xa811c3);}(_0xb84e,0xbf));var _0xeb84=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xb84e[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'body':{'type':Sequelize[_0xeb84('0x1')](_0xeb84('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb84('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xeb84('0x4')),'defaultValue':_0xeb84('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb84('0x5')]},'providerName':{'type':Sequelize[_0xeb84('0x6')]},'providerResponse':{'type':Sequelize[_0xeb84('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e49834b..6efde0c 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 _0x8573=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','ChatInteractionId','isNil','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields'];(function(_0x46ed5c,_0xec3675){var _0x42de09=function(_0x3e9818){while(--_0x3e9818){_0x46ed5c['push'](_0x46ed5c['shift']());}};_0x42de09(++_0xec3675);}(_0x8573,0xc1));var _0x3857=function(_0x256b18,_0x2cbe84){_0x256b18=_0x256b18-0x0;var _0x183933=_0x8573[_0x256b18];return _0x183933;};'use strict';var emlformat=require(_0x3857('0x0'));var rimraf=require(_0x3857('0x1'));var zipdir=require(_0x3857('0x2'));var jsonpatch=require(_0x3857('0x3'));var rp=require(_0x3857('0x4'));var moment=require(_0x3857('0x5'));var BPromise=require(_0x3857('0x6'));var Mustache=require(_0x3857('0x7'));var util=require('util');var path=require(_0x3857('0x8'));var sox=require(_0x3857('0x9'));var csv=require('to-csv');var ejs=require(_0x3857('0xa'));var fs=require('fs');var fs_extra=require(_0x3857('0xb'));var _=require(_0x3857('0xc'));var squel=require(_0x3857('0xd'));var crypto=require(_0x3857('0xe'));var jsforce=require(_0x3857('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3857('0x10'));var querystring=require('querystring');var Papa=require(_0x3857('0x11'));var Redis=require(_0x3857('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3857('0x13'));var as=require(_0x3857('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3857('0x15'))(_0x3857('0x16'));var utils=require(_0x3857('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3857('0x18'));var db=require(_0x3857('0x19'))['db'];config[_0x3857('0x1a')]=_[_0x3857('0x1b')](config['redis'],{'host':_0x3857('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3857('0x1a')]));require(_0x3857('0x1d'))[_0x3857('0x1e')](socket);var jayson=require(_0x3857('0x1f'));var client=jayson[_0x3857('0x20')][_0x3857('0x21')]({'port':0x232c});var client9002=jayson[_0x3857('0x20')][_0x3857('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x460824,_0x230432,_0x53eb7e,_0x1ecb51){return new BPromise(function(_0x8eccf1,_0x1ff31b){var _0x449ebd=_0x1ecb51||client;return _0x449ebd[_0x3857('0x22')](_0x460824,_0x53eb7e)[_0x3857('0x23')](function(_0x42b5cb){logger['info'](_0x3857('0x24'),_0x230432,_0x3857('0x25'));logger[_0x3857('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x230432,'request\x20sent',JSON[_0x3857('0x27')](_0x42b5cb));if(_0x42b5cb['error']){if(_0x42b5cb[_0x3857('0x28')]['code']===0x1f4){logger[_0x3857('0x28')](_0x3857('0x24'),_0x230432,_0x42b5cb[_0x3857('0x28')]['message']);return _0x1ff31b(_0x42b5cb[_0x3857('0x28')][_0x3857('0x29')]);}logger[_0x3857('0x28')](_0x3857('0x24'),_0x230432,_0x42b5cb['error']['message']);return _0x8eccf1(_0x42b5cb[_0x3857('0x28')][_0x3857('0x29')]);}else{logger[_0x3857('0x2a')](_0x3857('0x24'),_0x230432,_0x3857('0x25'));_0x8eccf1(_0x42b5cb[_0x3857('0x2b')]['message']);}})[_0x3857('0x2c')](function(_0x2fd8e7){logger['error'](_0x3857('0x24'),_0x230432,_0x2fd8e7);_0x1ff31b(_0x2fd8e7);});});}function respondWithStatusCode(_0x151fed,_0x355b97){_0x355b97=_0x355b97||0xcc;return function(_0x5055c7){if(_0x5055c7){return _0x151fed[_0x3857('0x2d')](_0x355b97);}return _0x151fed[_0x3857('0x2e')](_0x355b97)['end']();};}function respondWithResult(_0x4cd9e7,_0xa68c60){_0xa68c60=_0xa68c60||0xc8;return function(_0x6bc743){if(_0x6bc743){return _0x4cd9e7[_0x3857('0x2e')](_0xa68c60)[_0x3857('0x2f')](_0x6bc743);}};}function respondWithFilteredResult(_0x399421,_0x3aec40){return function(_0x3edadc){if(_0x3edadc){var _0x59bcbd=typeof _0x3aec40[_0x3857('0x30')]===_0x3857('0x31')&&typeof _0x3aec40['limit']===_0x3857('0x31');var _0x17c8f8=_0x3edadc[_0x3857('0x32')];var _0x535469=_0x59bcbd?0x0:_0x3aec40[_0x3857('0x30')];var _0x10d9cb=_0x59bcbd?_0x3edadc['count']:_0x3aec40['offset']+_0x3aec40['limit'];var _0x3a0a76;if(_0x10d9cb>=_0x17c8f8){_0x10d9cb=_0x17c8f8;_0x3a0a76=0xc8;}else{_0x3a0a76=0xce;}_0x399421[_0x3857('0x2e')](_0x3a0a76);return _0x399421[_0x3857('0x33')](_0x3857('0x34'),_0x535469+'-'+_0x10d9cb+'/'+_0x17c8f8)['json'](_0x3edadc);}return null;};}function patchUpdates(_0x1ada66){return function(_0x536852){try{jsonpatch[_0x3857('0x35')](_0x536852,_0x1ada66,!![]);}catch(_0x22c605){return BPromise[_0x3857('0x36')](_0x22c605);}return _0x536852[_0x3857('0x37')]();};}function saveUpdates(_0x4b456e,_0x115266){return function(_0x18f8a2){if(_0x18f8a2){return _0x18f8a2[_0x3857('0x38')](_0x4b456e)[_0x3857('0x23')](function(_0x289ad1){return _0x289ad1;});}return null;};}function removeEntity(_0x2e643b,_0x4053f5){return function(_0x3a540d){if(_0x3a540d){return _0x3a540d[_0x3857('0x39')]()['then'](function(){_0x2e643b[_0x3857('0x2e')](0xcc)[_0x3857('0x3a')]();});}};}function handleEntityNotFound(_0x3151c6,_0x573f92){return function(_0x1becba){if(!_0x1becba){_0x3151c6[_0x3857('0x2d')](0x194);}return _0x1becba;};}function handleError(_0x5e5297,_0x480ee9){_0x480ee9=_0x480ee9||0x1f4;return function(_0x56ec1b){logger[_0x3857('0x28')](_0x56ec1b[_0x3857('0x3b')]);if(_0x56ec1b[_0x3857('0x3c')]){delete _0x56ec1b['name'];}_0x5e5297['status'](_0x480ee9)[_0x3857('0x3d')](_0x56ec1b);};}exports[_0x3857('0x3e')]=function(_0x125c4e,_0x515f0a){var _0xe805a3={},_0x5930c5={},_0x2b0955={'count':0x0,'rows':[]};var _0x2c61b8=_['map'](db[_0x3857('0x3f')][_0x3857('0x40')],function(_0x148da5){return{'name':_0x148da5[_0x3857('0x41')],'type':_0x148da5[_0x3857('0x42')]['key']};});_0x5930c5[_0x3857('0x43')]=_[_0x3857('0x44')](_0x2c61b8,_0x3857('0x3c'));_0x5930c5['query']=_[_0x3857('0x45')](_0x125c4e['query']);_0x5930c5[_0x3857('0x46')]=_[_0x3857('0x47')](_0x5930c5[_0x3857('0x43')],_0x5930c5[_0x3857('0x48')]);_0xe805a3[_0x3857('0x49')]=_['intersection'](_0x5930c5['model'],qs[_0x3857('0x4a')](_0x125c4e[_0x3857('0x48')][_0x3857('0x4a')]));_0xe805a3['attributes']=_0xe805a3[_0x3857('0x49')][_0x3857('0x4b')]?_0xe805a3[_0x3857('0x49')]:_0x5930c5[_0x3857('0x43')];if(!_0x125c4e[_0x3857('0x48')][_0x3857('0x4c')](_0x3857('0x4d'))){_0xe805a3[_0x3857('0x4e')]=qs[_0x3857('0x4e')](_0x125c4e['query'][_0x3857('0x4e')]);_0xe805a3[_0x3857('0x30')]=qs[_0x3857('0x30')](_0x125c4e['query'][_0x3857('0x30')]);}_0xe805a3[_0x3857('0x4f')]=qs[_0x3857('0x50')](_0x125c4e[_0x3857('0x48')][_0x3857('0x50')]);_0xe805a3[_0x3857('0x51')]=qs[_0x3857('0x46')](_[_0x3857('0x52')](_0x125c4e[_0x3857('0x48')],_0x5930c5[_0x3857('0x46')]),_0x2c61b8);if(_0x125c4e[_0x3857('0x48')][_0x3857('0x53')]){_0xe805a3[_0x3857('0x51')]=_[_0x3857('0x54')](_0xe805a3[_0x3857('0x51')],{'$or':_[_0x3857('0x44')](_0x2c61b8,function(_0x3071c7){if(_0x3071c7[_0x3857('0x42')]!==_0x3857('0x55')){var _0x249853={};_0x249853[_0x3071c7['name']]={'$like':'%'+_0x125c4e[_0x3857('0x48')][_0x3857('0x53')]+'%'};return _0x249853;}})});}_0xe805a3=_['merge']({},_0xe805a3,_0x125c4e[_0x3857('0x56')]);var _0x57f21e={'where':_0xe805a3[_0x3857('0x51')]};return db[_0x3857('0x3f')][_0x3857('0x32')](_0x57f21e)[_0x3857('0x23')](function(_0x2108ba){_0x2b0955['count']=_0x2108ba;if(_0x125c4e[_0x3857('0x48')][_0x3857('0x57')]){_0xe805a3['include']=[{'all':!![]}];}return db[_0x3857('0x3f')][_0x3857('0x58')](_0xe805a3);})[_0x3857('0x23')](function(_0x58cf7f){_0x2b0955[_0x3857('0x59')]=_0x58cf7f;return _0x2b0955;})[_0x3857('0x23')](respondWithFilteredResult(_0x515f0a,_0xe805a3))['catch'](handleError(_0x515f0a,null));};exports[_0x3857('0x5a')]=function(_0x2dae72,_0x397a6d){var _0x5eced9={'raw':!![],'where':{'id':_0x2dae72[_0x3857('0x5b')]['id']}},_0x2aaf3e={};_0x2aaf3e['model']=_[_0x3857('0x45')](db['ChatMessage'][_0x3857('0x40')]);_0x2aaf3e[_0x3857('0x48')]=_[_0x3857('0x45')](_0x2dae72[_0x3857('0x48')]);_0x2aaf3e[_0x3857('0x46')]=_[_0x3857('0x47')](_0x2aaf3e[_0x3857('0x43')],_0x2aaf3e['query']);_0x5eced9[_0x3857('0x49')]=_['intersection'](_0x2aaf3e['model'],qs[_0x3857('0x4a')](_0x2dae72[_0x3857('0x48')][_0x3857('0x4a')]));_0x5eced9['attributes']=_0x5eced9[_0x3857('0x49')][_0x3857('0x4b')]?_0x5eced9['attributes']:_0x2aaf3e['model'];if(_0x2dae72[_0x3857('0x48')][_0x3857('0x57')]){_0x5eced9['include']=[{'all':!![]}];}_0x5eced9=_[_0x3857('0x54')]({},_0x5eced9,_0x2dae72['options']);return db[_0x3857('0x3f')][_0x3857('0x5c')](_0x5eced9)[_0x3857('0x23')](handleEntityNotFound(_0x397a6d,null))['then'](respondWithResult(_0x397a6d,null))[_0x3857('0x2c')](handleError(_0x397a6d,null));};exports['create']=function(_0x28ee96,_0x4950b9){return db[_0x3857('0x3f')][_0x3857('0x5d')](_0x28ee96['body'],{})[_0x3857('0x23')](respondWithResult(_0x4950b9,0xc9))['catch'](handleError(_0x4950b9,null));};exports[_0x3857('0x38')]=function(_0x359dbe,_0x56f196){if(_0x359dbe[_0x3857('0x5e')]['id']){delete _0x359dbe[_0x3857('0x5e')]['id'];}return db[_0x3857('0x3f')][_0x3857('0x5c')]({'where':{'id':_0x359dbe['params']['id']}})[_0x3857('0x23')](handleEntityNotFound(_0x56f196,null))[_0x3857('0x23')](saveUpdates(_0x359dbe[_0x3857('0x5e')],null))[_0x3857('0x23')](respondWithResult(_0x56f196,null))[_0x3857('0x2c')](handleError(_0x56f196,null));};exports[_0x3857('0x39')]=function(_0x411f40,_0x5abe0c){return db[_0x3857('0x3f')][_0x3857('0x5c')]({'where':{'id':_0x411f40[_0x3857('0x5b')]['id']}})[_0x3857('0x23')](handleEntityNotFound(_0x5abe0c,null))[_0x3857('0x23')](removeEntity(_0x5abe0c,null))[_0x3857('0x2c')](handleError(_0x5abe0c,null));};exports[_0x3857('0x5f')]=function(_0x5944a1,_0x32ab2a){return db['ChatMessage'][_0x3857('0x5f')]()[_0x3857('0x23')](respondWithResult(_0x32ab2a,null))[_0x3857('0x2c')](handleError(_0x32ab2a,null));};var interaction_log=require(_0x3857('0x15'))(_0x3857('0x60'));exports[_0x3857('0x61')]=function(_0x5e562d,_0x208a49,_0x3b977e){var _0x2fd1fa={'agent':{},'channel':_0x3857('0x62')};if(_0x5e562d[_0x3857('0x5e')]['id']){delete _0x5e562d[_0x3857('0x5e')]['id'];}_0x5e562d[_0x3857('0x5e')]['read']=!![];_0x5e562d[_0x3857('0x5e')][_0x3857('0x63')]=moment()[_0x3857('0x64')](_0x3857('0x65'));_0x5e562d['body'][_0x3857('0x66')]=_0x5e562d[_0x3857('0x5e')][_0x3857('0x66')]||_0x5e562d['user']['id'];_0x2fd1fa[_0x3857('0x67')]['id']=_0x5e562d[_0x3857('0x5e')][_0x3857('0x66')];return db['ChatMessage'][_0x3857('0x5c')]({'where':{'id':_0x5e562d[_0x3857('0x5b')]['id'],'UserId':null}})[_0x3857('0x23')](handleEntityNotFound(_0x208a49,null))[_0x3857('0x23')](saveUpdates(_0x5e562d['body'],null))[_0x3857('0x23')](function(_0x50fd03){if(_0x50fd03){_0x2fd1fa[_0x3857('0x29')]=_0x50fd03['get']({'plain':!![]});return db[_0x3857('0x68')][_0x3857('0x5c')]({'where':{'id':_0x50fd03[_0x3857('0x69')]}});}return null;})[_0x3857('0x23')](handleEntityNotFound(_0x208a49,null))[_0x3857('0x23')](function(_0xb69f0b){if(_0xb69f0b){return _0xb69f0b['update']({'UserId':_0x5e562d[_0x3857('0x5e')]['UserId'],'read1stAt':_[_0x3857('0x6a')](_0xb69f0b['read1stAt'])?moment()[_0x3857('0x64')](_0x3857('0x65')):undefined});}return null;})[_0x3857('0x23')](function(_0x57ecc1){if(_0x57ecc1){_0x2fd1fa['interaction']=_0x57ecc1['get']({'plain':!![]});interaction_log[_0x3857('0x2a')](_0x3857('0x6b'),_0x5e562d[_0x3857('0x6c')]['id'],_0x5e562d[_0x3857('0x6c')][_0x3857('0x3c')],_0x5e562d[_0x3857('0x6c')][_0x3857('0x6d')],_0x2fd1fa[_0x3857('0x6e')]['id'],_0x5e562d[_0x3857('0x5e')]?JSON[_0x3857('0x27')](_0x5e562d[_0x3857('0x5e')]):'null');return respondWithRpcPromise(_0x3857('0x6f'),_0x3857('0x70'),_0x2fd1fa);}return null;})[_0x3857('0x23')](function(_0x30a689){var _0x285191='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30a689[_0x3857('0x29')][_0x3857('0x71')];return db['sequelize'][_0x3857('0x48')](_0x285191,{'type':db[_0x3857('0x72')][_0x3857('0x73')][_0x3857('0x74')],'raw':!![]})['then'](function(_0x4a7af5){return _0x4a7af5;});})[_0x3857('0x23')](function(_0x5ae12f){if(_0x5ae12f){_0x2fd1fa[_0x3857('0x29')]['contact']=_0x5ae12f[0x0];if(!_0x5e562d['body']['UserId'])return;return db[_0x3857('0x75')][_0x3857('0x5c')]({'where':{'id':_0x5e562d['body']['UserId'],'role':_0x3857('0x67')},'attributes':['id',_0x3857('0x3c'),_0x3857('0x76'),_0x3857('0x77'),_0x3857('0x78')],'raw':!![]});}return null;})[_0x3857('0x23')](function(_0x4ff2b5){if(!_0x4ff2b5)return null;_0x2fd1fa[_0x3857('0x29')][_0x3857('0x67')]=_0x4ff2b5;return _0x2fd1fa;})[_0x3857('0x23')](function(_0x3c67b1){if(_0x3c67b1){if(_0x5e562d[_0x3857('0x5e')]['manual']){_0x2fd1fa['message'][_0x3857('0x79')]=util[_0x3857('0x64')](_0x3857('0x7a'),_0x5e562d[_0x3857('0x6c')]['name']);_0x2fd1fa['message'][_0x3857('0x7b')]=_0x2fd1fa[_0x3857('0x7b')];_0x2fd1fa[_0x3857('0x29')][_0x3857('0x7c')]=_0x2fd1fa[_0x3857('0x7b')];_0x2fd1fa[_0x3857('0x29')][_0x3857('0x7d')]=_0x3857('0x61');return respondWithRpcPromise(_0x3857('0x7e'),_0x3857('0x7e'),{'event':'acceptmessage','message':_[_0x3857('0x54')](_0x2fd1fa[_0x3857('0x29')],JSON[_0x3857('0x7f')](_0x2fd1fa[_0x3857('0x6e')][_0x3857('0x80')]))},client9002)[_0x3857('0x23')](function(){return _0x2fd1fa;});}return _0x2fd1fa;}return null;})[_0x3857('0x23')](respondWithResult(_0x208a49,null))[_0x3857('0x2c')](handleError(_0x208a49,null));};var interaction_log=require(_0x3857('0x15'))(_0x3857('0x60'));exports[_0x3857('0x36')]=function(_0x337f4a,_0x26ccc3,_0x428fd3){var _0xcdfda3={'agent':{},'channel':_0x3857('0x62')};if(_0x337f4a[_0x3857('0x5e')]['id']){delete _0x337f4a['body']['id'];}_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')]=_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')]||_0x337f4a[_0x3857('0x6c')]['id'];_0xcdfda3[_0x3857('0x67')]['id']=_0x337f4a[_0x3857('0x5e')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x337f4a[_0x3857('0x5b')]['id'],'UserId':null}})[_0x3857('0x23')](handleEntityNotFound(_0x26ccc3,null))['then'](function(_0x214b31){if(_0x214b31){_0xcdfda3['message']=_0x214b31['get']({'plain':!![]});return db[_0x3857('0x68')][_0x3857('0x5c')]({'where':{'id':_0x214b31['ChatInteractionId']}});}return null;})[_0x3857('0x23')](handleEntityNotFound(_0x26ccc3,null))[_0x3857('0x23')](function(_0xdb3d9a){if(_0xdb3d9a){_0xcdfda3[_0x3857('0x6e')]=_0xdb3d9a['get']({'plain':!![]});interaction_log[_0x3857('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x337f4a[_0x3857('0x6c')]['id'],_0x337f4a[_0x3857('0x6c')][_0x3857('0x3c')],_0x337f4a['user'][_0x3857('0x6d')],_0xcdfda3[_0x3857('0x6e')]['id'],_0x337f4a[_0x3857('0x5e')]?JSON[_0x3857('0x27')](_0x337f4a['body']):_0x3857('0x81'));return respondWithRpcPromise(_0x3857('0x82'),'rejectMessage',_0xcdfda3);}return null;})[_0x3857('0x23')](function(_0x3ac459){var _0x312ffd=_0x3857('0x83')+_0x3ac459['message'][_0x3857('0x71')];return db[_0x3857('0x84')]['query'](_0x312ffd,{'type':db[_0x3857('0x72')][_0x3857('0x73')]['SELECT'],'raw':!![]})[_0x3857('0x23')](function(_0x54b28c){return _0x54b28c;});})[_0x3857('0x23')](function(_0x16279a){if(_0x16279a){_0xcdfda3[_0x3857('0x29')]['contact']=_0x16279a[0x0];if(!_0x337f4a['body'][_0x3857('0x66')])return;return db[_0x3857('0x75')][_0x3857('0x5c')]({'where':{'id':_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')],'role':_0x3857('0x67')},'attributes':['id',_0x3857('0x3c'),_0x3857('0x76'),_0x3857('0x77'),'internal'],'raw':!![]});}return null;})[_0x3857('0x23')](function(_0x3abffd){if(!_0x3abffd)return null;_0xcdfda3[_0x3857('0x29')]['agent']=_0x3abffd;return _0xcdfda3;})[_0x3857('0x23')](function(_0x209f49){if(_0x209f49){_0x209f49['message'][_0x3857('0x79')]=util[_0x3857('0x64')](_0x3857('0x7a'),_0x337f4a[_0x3857('0x6c')][_0x3857('0x3c')]);_0x209f49['message'][_0x3857('0x7b')]=_0xcdfda3[_0x3857('0x7b')];_0x209f49[_0x3857('0x29')][_0x3857('0x7c')]=_0xcdfda3[_0x3857('0x7b')];_0x209f49[_0x3857('0x29')][_0x3857('0x7d')]='reject';respondWithRpcPromise(_0x3857('0x7e'),_0x3857('0x7e'),{'event':_0x3857('0x85'),'message':_[_0x3857('0x54')](_0xcdfda3['message'],JSON[_0x3857('0x7f')](_0xcdfda3[_0x3857('0x6e')][_0x3857('0x80')]))},client9002);return _0xcdfda3;}return null;})[_0x3857('0x23')](respondWithResult(_0x26ccc3,null))[_0x3857('0x2c')](handleError(_0x26ccc3,null));}; \ No newline at end of file +var _0xaea1=['offset','limit','undefined','count','set','Content-Range','reject','save','update','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','length','find','create','body','destroy','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','../../config/logger','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json'];(function(_0x34a370,_0x37e16f){var _0x39e794=function(_0x2b7c83){while(--_0x2b7c83){_0x34a370['push'](_0x34a370['shift']());}};_0x39e794(++_0x37e16f);}(_0xaea1,0x1df));var _0x1aea=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaea1[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x1aea('0x0'));var rimraf=require(_0x1aea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1aea('0x2'));var rp=require(_0x1aea('0x3'));var moment=require(_0x1aea('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1aea('0x5'));var path=require(_0x1aea('0x6'));var sox=require(_0x1aea('0x7'));var csv=require(_0x1aea('0x8'));var ejs=require(_0x1aea('0x9'));var fs=require('fs');var fs_extra=require(_0x1aea('0xa'));var _=require(_0x1aea('0xb'));var squel=require('squel');var crypto=require(_0x1aea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1aea('0xd'));var toCsv=require(_0x1aea('0x8'));var querystring=require(_0x1aea('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1aea('0xf'));var qs=require(_0x1aea('0x10'));var as=require(_0x1aea('0x11'));var hardwareService=require(_0x1aea('0x12'));var logger=require('../../config/logger')(_0x1aea('0x13'));var utils=require(_0x1aea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1aea('0x15'));var db=require(_0x1aea('0x16'))['db'];config[_0x1aea('0x17')]=_[_0x1aea('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1aea('0x17')]));require(_0x1aea('0x19'))[_0x1aea('0x1a')](socket);var jayson=require(_0x1aea('0x1b'));var client=jayson[_0x1aea('0x1c')][_0x1aea('0x1d')]({'port':0x232c});var client9002=jayson[_0x1aea('0x1c')][_0x1aea('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xea2261,_0x44e186,_0x500054,_0x242211){return new BPromise(function(_0x1a7b4e,_0x50e899){var _0x5b355e=_0x242211||client;return _0x5b355e[_0x1aea('0x1e')](_0xea2261,_0x500054)[_0x1aea('0x1f')](function(_0x422135){logger[_0x1aea('0x20')](_0x1aea('0x21'),_0x44e186,'request\x20sent');logger[_0x1aea('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x44e186,'request\x20sent',JSON[_0x1aea('0x23')](_0x422135));if(_0x422135[_0x1aea('0x24')]){if(_0x422135['error'][_0x1aea('0x25')]===0x1f4){logger[_0x1aea('0x24')](_0x1aea('0x21'),_0x44e186,_0x422135[_0x1aea('0x24')][_0x1aea('0x26')]);return _0x50e899(_0x422135[_0x1aea('0x24')]['message']);}logger[_0x1aea('0x24')]('ChatMessage,\x20%s,\x20%s',_0x44e186,_0x422135[_0x1aea('0x24')][_0x1aea('0x26')]);return _0x1a7b4e(_0x422135[_0x1aea('0x24')]['message']);}else{logger[_0x1aea('0x20')](_0x1aea('0x21'),_0x44e186,_0x1aea('0x27'));_0x1a7b4e(_0x422135[_0x1aea('0x28')][_0x1aea('0x26')]);}})['catch'](function(_0x17361a){logger[_0x1aea('0x24')](_0x1aea('0x21'),_0x44e186,_0x17361a);_0x50e899(_0x17361a);});});}function respondWithStatusCode(_0x2eac19,_0x1a4c05){_0x1a4c05=_0x1a4c05||0xcc;return function(_0x4b8f8d){if(_0x4b8f8d){return _0x2eac19[_0x1aea('0x29')](_0x1a4c05);}return _0x2eac19[_0x1aea('0x2a')](_0x1a4c05)[_0x1aea('0x2b')]();};}function respondWithResult(_0x1b0fe8,_0x213545){_0x213545=_0x213545||0xc8;return function(_0x3a9482){if(_0x3a9482){return _0x1b0fe8[_0x1aea('0x2a')](_0x213545)[_0x1aea('0x2c')](_0x3a9482);}};}function respondWithFilteredResult(_0x4e2a63,_0x32b5b3){return function(_0x10d875){if(_0x10d875){var _0x44b3ff=typeof _0x32b5b3[_0x1aea('0x2d')]==='undefined'&&typeof _0x32b5b3[_0x1aea('0x2e')]===_0x1aea('0x2f');var _0x3b96a7=_0x10d875[_0x1aea('0x30')];var _0x2b5661=_0x44b3ff?0x0:_0x32b5b3[_0x1aea('0x2d')];var _0x1594ba=_0x44b3ff?_0x10d875[_0x1aea('0x30')]:_0x32b5b3[_0x1aea('0x2d')]+_0x32b5b3[_0x1aea('0x2e')];var _0x3e9207;if(_0x1594ba>=_0x3b96a7){_0x1594ba=_0x3b96a7;_0x3e9207=0xc8;}else{_0x3e9207=0xce;}_0x4e2a63[_0x1aea('0x2a')](_0x3e9207);return _0x4e2a63[_0x1aea('0x31')](_0x1aea('0x32'),_0x2b5661+'-'+_0x1594ba+'/'+_0x3b96a7)[_0x1aea('0x2c')](_0x10d875);}return null;};}function patchUpdates(_0x4752cd){return function(_0x34c115){try{jsonpatch['apply'](_0x34c115,_0x4752cd,!![]);}catch(_0x45b4b7){return BPromise[_0x1aea('0x33')](_0x45b4b7);}return _0x34c115[_0x1aea('0x34')]();};}function saveUpdates(_0x20a4b9,_0x4c315c){return function(_0x3bdd19){if(_0x3bdd19){return _0x3bdd19[_0x1aea('0x35')](_0x20a4b9)[_0x1aea('0x1f')](function(_0x35fcc8){return _0x35fcc8;});}return null;};}function removeEntity(_0x54ddcb,_0x7adacf){return function(_0x89704e){if(_0x89704e){return _0x89704e['destroy']()[_0x1aea('0x1f')](function(){_0x54ddcb[_0x1aea('0x2a')](0xcc)[_0x1aea('0x2b')]();});}};}function handleEntityNotFound(_0x5b16a1,_0x2da51c){return function(_0x269b7f){if(!_0x269b7f){_0x5b16a1['sendStatus'](0x194);}return _0x269b7f;};}function handleError(_0x518fc4,_0x26b7c8){_0x26b7c8=_0x26b7c8||0x1f4;return function(_0x4ca332){logger[_0x1aea('0x24')](_0x4ca332[_0x1aea('0x36')]);if(_0x4ca332[_0x1aea('0x37')]){delete _0x4ca332[_0x1aea('0x37')];}_0x518fc4[_0x1aea('0x2a')](_0x26b7c8)[_0x1aea('0x38')](_0x4ca332);};}exports[_0x1aea('0x39')]=function(_0x42ada5,_0x29c90b){var _0x5b5abe={},_0x3cb2dc={},_0x363042={'count':0x0,'rows':[]};var _0x46dcfc=_[_0x1aea('0x3a')](db[_0x1aea('0x3b')][_0x1aea('0x3c')],function(_0x4354cb){return{'name':_0x4354cb[_0x1aea('0x3d')],'type':_0x4354cb[_0x1aea('0x3e')][_0x1aea('0x3f')]};});_0x3cb2dc[_0x1aea('0x40')]=_[_0x1aea('0x3a')](_0x46dcfc,_0x1aea('0x37'));_0x3cb2dc['query']=_[_0x1aea('0x41')](_0x42ada5[_0x1aea('0x42')]);_0x3cb2dc[_0x1aea('0x43')]=_['intersection'](_0x3cb2dc[_0x1aea('0x40')],_0x3cb2dc[_0x1aea('0x42')]);_0x5b5abe[_0x1aea('0x44')]=_[_0x1aea('0x45')](_0x3cb2dc[_0x1aea('0x40')],qs['fields'](_0x42ada5[_0x1aea('0x42')][_0x1aea('0x46')]));_0x5b5abe[_0x1aea('0x44')]=_0x5b5abe['attributes']['length']?_0x5b5abe['attributes']:_0x3cb2dc[_0x1aea('0x40')];if(!_0x42ada5[_0x1aea('0x42')]['hasOwnProperty'](_0x1aea('0x47'))){_0x5b5abe['limit']=qs[_0x1aea('0x2e')](_0x42ada5[_0x1aea('0x42')][_0x1aea('0x2e')]);_0x5b5abe[_0x1aea('0x2d')]=qs[_0x1aea('0x2d')](_0x42ada5[_0x1aea('0x42')][_0x1aea('0x2d')]);}_0x5b5abe[_0x1aea('0x48')]=qs[_0x1aea('0x49')](_0x42ada5[_0x1aea('0x42')][_0x1aea('0x49')]);_0x5b5abe[_0x1aea('0x4a')]=qs[_0x1aea('0x43')](_[_0x1aea('0x4b')](_0x42ada5[_0x1aea('0x42')],_0x3cb2dc[_0x1aea('0x43')]),_0x46dcfc);if(_0x42ada5['query'][_0x1aea('0x4c')]){_0x5b5abe[_0x1aea('0x4a')]=_['merge'](_0x5b5abe[_0x1aea('0x4a')],{'$or':_[_0x1aea('0x3a')](_0x46dcfc,function(_0x3c665f){if(_0x3c665f[_0x1aea('0x3e')]!==_0x1aea('0x4d')){var _0x56046f={};_0x56046f[_0x3c665f[_0x1aea('0x37')]]={'$like':'%'+_0x42ada5[_0x1aea('0x42')]['filter']+'%'};return _0x56046f;}})});}_0x5b5abe=_[_0x1aea('0x4e')]({},_0x5b5abe,_0x42ada5[_0x1aea('0x4f')]);var _0x34c6b9={'where':_0x5b5abe['where']};return db[_0x1aea('0x3b')]['count'](_0x34c6b9)[_0x1aea('0x1f')](function(_0x100362){_0x363042[_0x1aea('0x30')]=_0x100362;if(_0x42ada5[_0x1aea('0x42')][_0x1aea('0x50')]){_0x5b5abe[_0x1aea('0x51')]=[{'all':!![]}];}return db[_0x1aea('0x3b')]['findAll'](_0x5b5abe);})['then'](function(_0x5342bf){_0x363042['rows']=_0x5342bf;return _0x363042;})['then'](respondWithFilteredResult(_0x29c90b,_0x5b5abe))[_0x1aea('0x52')](handleError(_0x29c90b,null));};exports['show']=function(_0x503df3,_0x348edb){var _0x574a11={'raw':!![],'where':{'id':_0x503df3[_0x1aea('0x53')]['id']}},_0x59a89d={};_0x59a89d[_0x1aea('0x40')]=_[_0x1aea('0x41')](db[_0x1aea('0x3b')][_0x1aea('0x3c')]);_0x59a89d[_0x1aea('0x42')]=_['keys'](_0x503df3[_0x1aea('0x42')]);_0x59a89d[_0x1aea('0x43')]=_[_0x1aea('0x45')](_0x59a89d[_0x1aea('0x40')],_0x59a89d['query']);_0x574a11[_0x1aea('0x44')]=_['intersection'](_0x59a89d[_0x1aea('0x40')],qs[_0x1aea('0x46')](_0x503df3['query'][_0x1aea('0x46')]));_0x574a11['attributes']=_0x574a11['attributes'][_0x1aea('0x54')]?_0x574a11[_0x1aea('0x44')]:_0x59a89d[_0x1aea('0x40')];if(_0x503df3[_0x1aea('0x42')][_0x1aea('0x50')]){_0x574a11[_0x1aea('0x51')]=[{'all':!![]}];}_0x574a11=_[_0x1aea('0x4e')]({},_0x574a11,_0x503df3[_0x1aea('0x4f')]);return db[_0x1aea('0x3b')][_0x1aea('0x55')](_0x574a11)[_0x1aea('0x1f')](handleEntityNotFound(_0x348edb,null))[_0x1aea('0x1f')](respondWithResult(_0x348edb,null))[_0x1aea('0x52')](handleError(_0x348edb,null));};exports[_0x1aea('0x56')]=function(_0x47b83a,_0xa23142){return db[_0x1aea('0x3b')][_0x1aea('0x56')](_0x47b83a['body'],{})[_0x1aea('0x1f')](respondWithResult(_0xa23142,0xc9))['catch'](handleError(_0xa23142,null));};exports['update']=function(_0xaa8321,_0x422940){if(_0xaa8321['body']['id']){delete _0xaa8321['body']['id'];}return db['ChatMessage'][_0x1aea('0x55')]({'where':{'id':_0xaa8321['params']['id']}})[_0x1aea('0x1f')](handleEntityNotFound(_0x422940,null))[_0x1aea('0x1f')](saveUpdates(_0xaa8321[_0x1aea('0x57')],null))['then'](respondWithResult(_0x422940,null))['catch'](handleError(_0x422940,null));};exports[_0x1aea('0x58')]=function(_0x396ba7,_0x3a4670){return db['ChatMessage'][_0x1aea('0x55')]({'where':{'id':_0x396ba7[_0x1aea('0x53')]['id']}})[_0x1aea('0x1f')](handleEntityNotFound(_0x3a4670,null))['then'](removeEntity(_0x3a4670,null))[_0x1aea('0x52')](handleError(_0x3a4670,null));};exports[_0x1aea('0x59')]=function(_0x597c91,_0x34d83f){return db[_0x1aea('0x3b')][_0x1aea('0x59')]()[_0x1aea('0x1f')](respondWithResult(_0x34d83f,null))[_0x1aea('0x52')](handleError(_0x34d83f,null));};var interaction_log=require('../../config/logger')(_0x1aea('0x5a'));exports[_0x1aea('0x5b')]=function(_0x592470,_0x457374,_0xb59801){var _0x5b5c78={'agent':{},'channel':_0x1aea('0x5c')};if(_0x592470[_0x1aea('0x57')]['id']){delete _0x592470['body']['id'];}_0x592470[_0x1aea('0x57')]['read']=!![];_0x592470['body'][_0x1aea('0x5d')]=moment()['format'](_0x1aea('0x5e'));_0x592470[_0x1aea('0x57')][_0x1aea('0x5f')]=_0x592470['body'][_0x1aea('0x5f')]||_0x592470[_0x1aea('0x60')]['id'];_0x5b5c78['agent']['id']=_0x592470[_0x1aea('0x57')][_0x1aea('0x5f')];return db[_0x1aea('0x3b')][_0x1aea('0x55')]({'where':{'id':_0x592470[_0x1aea('0x53')]['id'],'UserId':null}})[_0x1aea('0x1f')](handleEntityNotFound(_0x457374,null))[_0x1aea('0x1f')](saveUpdates(_0x592470[_0x1aea('0x57')],null))['then'](function(_0x22d261){if(_0x22d261){_0x5b5c78[_0x1aea('0x26')]=_0x22d261[_0x1aea('0x61')]({'plain':!![]});return db['ChatInteraction'][_0x1aea('0x55')]({'where':{'id':_0x22d261[_0x1aea('0x62')]}});}return null;})[_0x1aea('0x1f')](handleEntityNotFound(_0x457374,null))[_0x1aea('0x1f')](function(_0x53f6fe){if(_0x53f6fe){return _0x53f6fe['update']({'UserId':_0x592470[_0x1aea('0x57')]['UserId'],'read1stAt':_[_0x1aea('0x63')](_0x53f6fe[_0x1aea('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1aea('0x1f')](function(_0x313d4b){if(_0x313d4b){_0x5b5c78[_0x1aea('0x65')]=_0x313d4b[_0x1aea('0x61')]({'plain':!![]});interaction_log[_0x1aea('0x20')](_0x1aea('0x66'),_0x592470[_0x1aea('0x60')]['id'],_0x592470[_0x1aea('0x60')]['name'],_0x592470[_0x1aea('0x60')][_0x1aea('0x67')],_0x5b5c78[_0x1aea('0x65')]['id'],_0x592470[_0x1aea('0x57')]?JSON[_0x1aea('0x23')](_0x592470[_0x1aea('0x57')]):_0x1aea('0x68'));return respondWithRpcPromise(_0x1aea('0x69'),_0x1aea('0x6a'),_0x5b5c78);}return null;})[_0x1aea('0x1f')](function(_0x56e680){var _0x35d970=_0x1aea('0x6b')+_0x56e680[_0x1aea('0x26')][_0x1aea('0x6c')];return db[_0x1aea('0x6d')][_0x1aea('0x42')](_0x35d970,{'type':db['Sequelize'][_0x1aea('0x6e')][_0x1aea('0x6f')],'raw':!![]})[_0x1aea('0x1f')](function(_0x35e82b){return _0x35e82b;});})['then'](function(_0x31c7c3){if(_0x31c7c3){_0x5b5c78[_0x1aea('0x26')]['contact']=_0x31c7c3[0x0];if(!_0x592470['body'][_0x1aea('0x5f')])return;return db[_0x1aea('0x70')][_0x1aea('0x55')]({'where':{'id':_0x592470[_0x1aea('0x57')][_0x1aea('0x5f')],'role':'agent'},'attributes':['id',_0x1aea('0x37'),'fullname',_0x1aea('0x71'),_0x1aea('0x72')],'raw':!![]});}return null;})['then'](function(_0x502fdd){if(!_0x502fdd)return null;_0x5b5c78[_0x1aea('0x26')]['agent']=_0x502fdd;return _0x5b5c78;})[_0x1aea('0x1f')](function(_0x4015ab){if(_0x4015ab){if(_0x592470[_0x1aea('0x57')][_0x1aea('0x73')]){_0x5b5c78['message'][_0x1aea('0x74')]=util[_0x1aea('0x75')](_0x1aea('0x76'),_0x592470[_0x1aea('0x60')][_0x1aea('0x37')]);_0x5b5c78[_0x1aea('0x26')][_0x1aea('0x77')]=_0x5b5c78['channel'];_0x5b5c78[_0x1aea('0x26')][_0x1aea('0x78')]=_0x5b5c78[_0x1aea('0x77')];_0x5b5c78[_0x1aea('0x26')]['event']=_0x1aea('0x5b');return respondWithRpcPromise('EventManager',_0x1aea('0x79'),{'event':_0x1aea('0x7a'),'message':_[_0x1aea('0x4e')](_0x5b5c78['message'],JSON[_0x1aea('0x7b')](_0x5b5c78['interaction'][_0x1aea('0x7c')]))},client9002)[_0x1aea('0x1f')](function(){return _0x5b5c78;});}return _0x5b5c78;}return null;})[_0x1aea('0x1f')](respondWithResult(_0x457374,null))[_0x1aea('0x52')](handleError(_0x457374,null));};var interaction_log=require(_0x1aea('0x7d'))(_0x1aea('0x5a'));exports[_0x1aea('0x33')]=function(_0x5d7234,_0x1abcab,_0x2a69f4){var _0x52397c={'agent':{},'channel':'chat'};if(_0x5d7234[_0x1aea('0x57')]['id']){delete _0x5d7234[_0x1aea('0x57')]['id'];}_0x5d7234[_0x1aea('0x57')]['UserId']=_0x5d7234['body'][_0x1aea('0x5f')]||_0x5d7234[_0x1aea('0x60')]['id'];_0x52397c[_0x1aea('0x7e')]['id']=_0x5d7234[_0x1aea('0x57')][_0x1aea('0x5f')];return db['ChatMessage'][_0x1aea('0x55')]({'where':{'id':_0x5d7234['params']['id'],'UserId':null}})[_0x1aea('0x1f')](handleEntityNotFound(_0x1abcab,null))['then'](function(_0x3b9e53){if(_0x3b9e53){_0x52397c[_0x1aea('0x26')]=_0x3b9e53[_0x1aea('0x61')]({'plain':!![]});return db['ChatInteraction'][_0x1aea('0x55')]({'where':{'id':_0x3b9e53[_0x1aea('0x62')]}});}return null;})[_0x1aea('0x1f')](handleEntityNotFound(_0x1abcab,null))[_0x1aea('0x1f')](function(_0x1c546d){if(_0x1c546d){_0x52397c[_0x1aea('0x65')]=_0x1c546d['get']({'plain':!![]});interaction_log[_0x1aea('0x20')](_0x1aea('0x7f'),_0x5d7234[_0x1aea('0x60')]['id'],_0x5d7234[_0x1aea('0x60')][_0x1aea('0x37')],_0x5d7234[_0x1aea('0x60')]['role'],_0x52397c[_0x1aea('0x65')]['id'],_0x5d7234[_0x1aea('0x57')]?JSON[_0x1aea('0x23')](_0x5d7234[_0x1aea('0x57')]):_0x1aea('0x68'));return respondWithRpcPromise(_0x1aea('0x80'),_0x1aea('0x81'),_0x52397c);}return null;})[_0x1aea('0x1f')](function(_0xd8efe7){var _0x21cd98=_0x1aea('0x6b')+_0xd8efe7[_0x1aea('0x26')][_0x1aea('0x6c')];return db[_0x1aea('0x6d')]['query'](_0x21cd98,{'type':db['Sequelize'][_0x1aea('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x1fef09){return _0x1fef09;});})[_0x1aea('0x1f')](function(_0x451004){if(_0x451004){_0x52397c[_0x1aea('0x26')]['contact']=_0x451004[0x0];if(!_0x5d7234[_0x1aea('0x57')][_0x1aea('0x5f')])return;return db[_0x1aea('0x70')][_0x1aea('0x55')]({'where':{'id':_0x5d7234[_0x1aea('0x57')][_0x1aea('0x5f')],'role':_0x1aea('0x7e')},'attributes':['id',_0x1aea('0x37'),'fullname',_0x1aea('0x71'),_0x1aea('0x72')],'raw':!![]});}return null;})[_0x1aea('0x1f')](function(_0x59b3ff){if(!_0x59b3ff)return null;_0x52397c['message'][_0x1aea('0x7e')]=_0x59b3ff;return _0x52397c;})[_0x1aea('0x1f')](function(_0x28cc73){if(_0x28cc73){_0x28cc73[_0x1aea('0x26')][_0x1aea('0x74')]=util[_0x1aea('0x75')](_0x1aea('0x76'),_0x5d7234[_0x1aea('0x60')][_0x1aea('0x37')]);_0x28cc73['message']['channel']=_0x52397c[_0x1aea('0x77')];_0x28cc73[_0x1aea('0x26')][_0x1aea('0x78')]=_0x52397c[_0x1aea('0x77')];_0x28cc73[_0x1aea('0x26')]['event']='reject';respondWithRpcPromise('EventManager',_0x1aea('0x79'),{'event':_0x1aea('0x82'),'message':_[_0x1aea('0x4e')](_0x52397c[_0x1aea('0x26')],JSON[_0x1aea('0x7b')](_0x52397c['interaction'][_0x1aea('0x7c')]))},client9002);return _0x52397c;}return null;})[_0x1aea('0x1f')](respondWithResult(_0x1abcab,null))['catch'](handleError(_0x1abcab,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9a54468..ad887fc 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 _0xd9f5=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x43a995,_0x283637){var _0x3a27d4=function(_0x333f94){while(--_0x333f94){_0x43a995['push'](_0x43a995['shift']());}};_0x3a27d4(++_0x283637);}(_0xd9f5,0x1a0));var _0x5d9f=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xd9f5[_0x4a7e98];return _0x27d10d;};'use strict';var EventEmitter=require(_0x5d9f('0x0'));var ChatMessage=require(_0x5d9f('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d9f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x204703){return function(_0x4bc6f9,_0x317fea,_0x40c4ba){ChatMessageEvents['emit'](_0x204703+':'+_0x4bc6f9['id'],_0x4bc6f9);ChatMessageEvents[_0x5d9f('0x3')](_0x204703,_0x4bc6f9);_0x40c4ba(null);};}for(var e in events){if(events[_0x5d9f('0x4')](e)){var event=events[e];ChatMessage[_0x5d9f('0x5')](e,emitEvent(event));}}module[_0x5d9f('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x6f5b=['events','ChatMessage','save','update','emit','hasOwnProperty','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6f5b,0x18f));var _0xb6f5=function(_0x165a6a,_0x1be5ae){_0x165a6a=_0x165a6a-0x0;var _0x13c886=_0x6f5b[_0x165a6a];return _0x13c886;};'use strict';var EventEmitter=require(_0xb6f5('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xb6f5('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6f5('0x2'),'afterUpdate':_0xb6f5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x539c2e){return function(_0xfc7fff,_0x3dd676,_0x324825){ChatMessageEvents[_0xb6f5('0x4')](_0x539c2e+':'+_0xfc7fff['id'],_0xfc7fff);ChatMessageEvents['emit'](_0x539c2e,_0xfc7fff);_0x324825(null);};}for(var e in events){if(events[_0xb6f5('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb6f5('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 273fcde..ecea231 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 _0x6131=['chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6131,0xe0));var _0x1613=function(_0x46cd04,_0x32f2da){_0x46cd04=_0x46cd04-0x0;var _0x108808=_0x6131[_0x46cd04];return _0x108808;};'use strict';var _=require(_0x1613('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1613('0x1'));var BPromise=require(_0x1613('0x2'));var rp=require(_0x1613('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1613('0x4'));var config=require(_0x1613('0x5'));var attributes=require(_0x1613('0x6'));module[_0x1613('0x7')]=function(_0x3b7e5b,_0x18c654){return _0x3b7e5b[_0x1613('0x8')](_0x1613('0x9'),attributes,{'tableName':_0x1613('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x1613('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463eef,_0x35bf0e,_0x2da226){var _0x1abf94=_0x3b7e5b[_0x1613('0xc')];var _0x5bd037=_0x463eef[_0x1613('0xd')]({'plain':!![]});if(_0x5bd037[_0x1613('0xe')][_0x1613('0xf')]()==='in'||_0x5bd037['direction']['toLowerCase']()===_0x1613('0x10')&&!_0x5bd037['secret']&&!_['isNil'](_0x5bd037['UserId'])){_0x1abf94[_0x1613('0x11')][_0x1613('0x12')]({'where':{'id':_0x5bd037[_0x1613('0x13')]}})[_0x1613('0x14')](function(_0x8bb50e){if(_0x8bb50e){_0x8bb50e[_0x1613('0x15')]({'lastMsgAt':_0x5bd037[_0x1613('0x16')],'lastMsgDirection':_0x5bd037['direction']['toLowerCase']()});}})[_0x1613('0x17')](function(_0x85272d){console[_0x1613('0x18')](_0x85272d);});}_0x2da226();}},'charset':_0x1613('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbf39=['fti_chat_messages','body','direction','toLowerCase','out','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','define','ChatMessage'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xbf39,0xc5));var _0x9bf3=function(_0x2ffd9c,_0x48afeb){_0x2ffd9c=_0x2ffd9c-0x0;var _0xfef192=_0xbf39[_0x2ffd9c];return _0xfef192;};'use strict';var _=require('lodash');var util=require(_0x9bf3('0x0'));var logger=require(_0x9bf3('0x1'))(_0x9bf3('0x2'));var moment=require(_0x9bf3('0x3'));var BPromise=require(_0x9bf3('0x4'));var rp=require(_0x9bf3('0x5'));var fs=require('fs');var path=require(_0x9bf3('0x6'));var rimraf=require('rimraf');var config=require(_0x9bf3('0x7'));var attributes=require(_0x9bf3('0x8'));module['exports']=function(_0x480b2e,_0x2a672d){return _0x480b2e[_0x9bf3('0x9')](_0x9bf3('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9bf3('0xb'),'fields':[_0x9bf3('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f337e,_0x449dc7,_0x3a423f){var _0xacad6e=_0x480b2e['models'];var _0x3ad126=_0x2f337e['get']({'plain':!![]});if(_0x3ad126[_0x9bf3('0xd')]['toLowerCase']()==='in'||_0x3ad126[_0x9bf3('0xd')][_0x9bf3('0xe')]()===_0x9bf3('0xf')&&!_0x3ad126['secret']&&!_[_0x9bf3('0x10')](_0x3ad126[_0x9bf3('0x11')])){_0xacad6e['ChatInteraction'][_0x9bf3('0x12')]({'where':{'id':_0x3ad126['ChatInteractionId']}})[_0x9bf3('0x13')](function(_0x5441f0){if(_0x5441f0){_0x5441f0[_0x9bf3('0x14')]({'lastMsgAt':_0x3ad126[_0x9bf3('0x15')],'lastMsgDirection':_0x3ad126[_0x9bf3('0xd')]['toLowerCase']()});}})[_0x9bf3('0x16')](function(_0x39b759){console[_0x9bf3('0x17')](_0x39b759);});}_0x3a423f();}},'charset':_0x9bf3('0x18'),'collate':_0x9bf3('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 05f9993..5d074eb 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 _0xb80c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','options','raw','debug','catch','lodash','util','moment'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xb80c,0x147));var _0xcb80=function(_0xd38ef9,_0x498d2b){_0xd38ef9=_0xd38ef9-0x0;var _0x3be30b=_0xb80c[_0xd38ef9];return _0x3be30b;};'use strict';var _=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var moment=require(_0xcb80('0x2'));var BPromise=require(_0xcb80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb80('0x4'));var db=require(_0xcb80('0x5'))['db'];var utils=require(_0xcb80('0x6'));var logger=require(_0xcb80('0x7'))(_0xcb80('0x8'));var config=require(_0xcb80('0x9'));var jayson=require(_0xcb80('0xa'));var client=jayson['client'][_0xcb80('0xb')]({'port':0x232a});config[_0xcb80('0xc')]=_[_0xcb80('0xd')](config[_0xcb80('0xc')],{'host':_0xcb80('0xe'),'port':0x18eb});var socket=require(_0xcb80('0xf'))(new Redis(config[_0xcb80('0xc')]));require('./chatMessage.socket')[_0xcb80('0x10')](socket);function respondWithRpcPromise(_0x53f2d8,_0x40c8c0,_0x5ee568){return new BPromise(function(_0x52a4fb,_0x4661e5){return client['request'](_0x53f2d8,_0x5ee568)[_0xcb80('0x11')](function(_0x441a47){logger[_0xcb80('0x12')](_0xcb80('0x13'),_0x40c8c0,_0xcb80('0x14'));logger['debug'](_0xcb80('0x15'),_0x40c8c0,_0xcb80('0x14'),JSON[_0xcb80('0x16')](_0x441a47));if(_0x441a47[_0xcb80('0x17')]){if(_0x441a47[_0xcb80('0x17')][_0xcb80('0x18')]===0x1f4){logger[_0xcb80('0x17')]('ChatMessage,\x20%s,\x20%s',_0x40c8c0,_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);return _0x4661e5(_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);}logger[_0xcb80('0x17')](_0xcb80('0x13'),_0x40c8c0,_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);return _0x52a4fb(_0x441a47['error'][_0xcb80('0x19')]);}else{logger[_0xcb80('0x12')](_0xcb80('0x13'),_0x40c8c0,_0xcb80('0x14'));_0x52a4fb(_0x441a47[_0xcb80('0x1a')][_0xcb80('0x19')]);}})['catch'](function(_0x136022){logger[_0xcb80('0x17')]('ChatMessage,\x20%s,\x20%s',_0x40c8c0,_0x136022);_0x4661e5(_0x136022);});});}exports[_0xcb80('0x1b')]=function(_0x6b9b22){var _0x28cf7b=this;return new Promise(function(_0x274252,_0x21b3e5){return db['ChatMessage'][_0xcb80('0x1c')](_0x6b9b22['body'],{'raw':_0x6b9b22['options']?_0x6b9b22[_0xcb80('0x1d')][_0xcb80('0x1e')]===undefined?!![]:![]:!![]})[_0xcb80('0x11')](function(_0x477fd2){logger[_0xcb80('0x12')]('CreateChatMessage',_0x6b9b22);logger[_0xcb80('0x1f')](_0xcb80('0x1b'),_0x6b9b22,JSON['stringify'](_0x477fd2));_0x274252(_0x477fd2);})[_0xcb80('0x20')](function(_0xb65236){logger[_0xcb80('0x17')]('CreateChatMessage',_0xb65236[_0xcb80('0x19')],_0x6b9b22);_0x21b3e5(_0x28cf7b[_0xcb80('0x17')](0x1f4,_0xb65236['message']));});});}; \ No newline at end of file +var _0x343b=['redis','localhost','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatMessage','create','options','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x2df9bd,_0x3e001d){var _0x3564eb=function(_0x522f6f){while(--_0x522f6f){_0x2df9bd['push'](_0x2df9bd['shift']());}};_0x3564eb(++_0x3e001d);}(_0x343b,0x147));var _0xb343=function(_0x49700d,_0x104ec2){_0x49700d=_0x49700d-0x0;var _0x4c8bed=_0x343b[_0x49700d];return _0x4c8bed;};'use strict';var _=require(_0xb343('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb343('0x1'));var rs=require(_0xb343('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb343('0x3'))['db'];var utils=require(_0xb343('0x4'));var logger=require(_0xb343('0x5'))(_0xb343('0x6'));var config=require(_0xb343('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb343('0x8')]({'port':0x232a});config[_0xb343('0x9')]=_['defaults'](config['redis'],{'host':_0xb343('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb343('0x9')]));require('./chatMessage.socket')[_0xb343('0xb')](socket);function respondWithRpcPromise(_0x5037de,_0x5b5d35,_0x294291){return new BPromise(function(_0x12389d,_0x5f2d0b){return client[_0xb343('0xc')](_0x5037de,_0x294291)[_0xb343('0xd')](function(_0x532dca){logger['info'](_0xb343('0xe'),_0x5b5d35,_0xb343('0xf'));logger[_0xb343('0x10')](_0xb343('0x11'),_0x5b5d35,_0xb343('0xf'),JSON[_0xb343('0x12')](_0x532dca));if(_0x532dca['error']){if(_0x532dca[_0xb343('0x13')][_0xb343('0x14')]===0x1f4){logger[_0xb343('0x13')](_0xb343('0xe'),_0x5b5d35,_0x532dca[_0xb343('0x13')][_0xb343('0x15')]);return _0x5f2d0b(_0x532dca[_0xb343('0x13')]['message']);}logger[_0xb343('0x13')](_0xb343('0xe'),_0x5b5d35,_0x532dca[_0xb343('0x13')][_0xb343('0x15')]);return _0x12389d(_0x532dca[_0xb343('0x13')]['message']);}else{logger[_0xb343('0x16')](_0xb343('0xe'),_0x5b5d35,_0xb343('0xf'));_0x12389d(_0x532dca[_0xb343('0x17')][_0xb343('0x15')]);}})[_0xb343('0x18')](function(_0x1a7fc1){logger['error'](_0xb343('0xe'),_0x5b5d35,_0x1a7fc1);_0x5f2d0b(_0x1a7fc1);});});}exports['CreateChatMessage']=function(_0x2fd4d0){var _0x26626e=this;return new Promise(function(_0x406b85,_0x5b176b){return db[_0xb343('0x19')][_0xb343('0x1a')](_0x2fd4d0['body'],{'raw':_0x2fd4d0[_0xb343('0x1b')]?_0x2fd4d0[_0xb343('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f2f96){logger[_0xb343('0x16')]('CreateChatMessage',_0x2fd4d0);logger['debug']('CreateChatMessage',_0x2fd4d0,JSON[_0xb343('0x12')](_0x1f2f96));_0x406b85(_0x1f2f96);})[_0xb343('0x18')](function(_0x452381){logger[_0xb343('0x13')]('CreateChatMessage',_0x452381[_0xb343('0x15')],_0x2fd4d0);_0x5b176b(_0x26626e[_0xb343('0x13')](0x1f4,_0x452381[_0xb343('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 20556b8..716ab02 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 _0xcb99=['chatMessage:','./chatMessage.events','remove','emit','removeListener','length'];(function(_0x4fec8b,_0xbf11e3){var _0x2741bb=function(_0x6d951a){while(--_0x6d951a){_0x4fec8b['push'](_0x4fec8b['shift']());}};_0x2741bb(++_0xbf11e3);}(_0xcb99,0x8b));var _0x9cb9=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xcb99[_0x356127];return _0x5d4c75;};'use strict';var ChatMessageEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatMessageEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatMessageEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file +var _0x6aa7=['update','emit','length','chatMessage:','./chatMessage.events','remove'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x6aa7,0x178));var _0x76aa=function(_0x5ea0e1,_0x56f64a){_0x5ea0e1=_0x5ea0e1-0x0;var _0x1132a0=_0x6aa7[_0x5ea0e1];return _0x1132a0;};'use strict';var ChatMessageEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatMessageEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatMessageEvents['on'](_0xa9b695,_0x56d6bc);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6d16ab7..75afea2 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 _0x41cb=['/:id','update','put','accept','/:id/reject','reject','multer','util','path','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','show','chat','chatmessage:create','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x41cb,0xa0));var _0xb41c=function(_0x4043be,_0x33604e){_0x4043be=_0x4043be-0x0;var _0x30e2ae=_0x41cb[_0x4043be];return _0x30e2ae;};'use strict';var multer=require(_0xb41c('0x0'));var util=require(_0xb41c('0x1'));var path=require(_0xb41c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb41c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb41c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb41c('0x5'));var controller=require(_0xb41c('0x6'));router['get']('/',auth[_0xb41c('0x7')](),controller[_0xb41c('0x8')]);router[_0xb41c('0x9')](_0xb41c('0xa'),auth[_0xb41c('0x7')](),controller[_0xb41c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb41c('0xc')]);router['post']('/',auth[_0xb41c('0x7')](),interaction['tracked'](_0xb41c('0xd'),_0xb41c('0xe')),controller[_0xb41c('0xf')]);router['put'](_0xb41c('0x10'),controller[_0xb41c('0x11')]);router[_0xb41c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb41c('0x13')]);router[_0xb41c('0x12')](_0xb41c('0x14'),auth['isAuthenticated'](),controller[_0xb41c('0x15')]);router['delete'](_0xb41c('0x10'),auth[_0xb41c('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x82f5=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy'];(function(_0x34aa52,_0x1d765f){var _0xe82a4b=function(_0x338bd4){while(--_0x338bd4){_0x34aa52['push'](_0x34aa52['shift']());}};_0xe82a4b(++_0x1d765f);}(_0x82f5,0xa2));var _0x582f=function(_0x326eca,_0x4301f3){_0x326eca=_0x326eca-0x0;var _0x308b3e=_0x82f5[_0x326eca];return _0x308b3e;};'use strict';var multer=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var path=require(_0x582f('0x2'));var timeout=require('connect-timeout');var express=require(_0x582f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x582f('0x4'));var interaction=require(_0x582f('0x5'));var config=require(_0x582f('0x6'));var controller=require(_0x582f('0x7'));router[_0x582f('0x8')]('/',auth[_0x582f('0x9')](),controller['index']);router['get']('/describe',auth[_0x582f('0x9')](),controller[_0x582f('0xa')]);router[_0x582f('0x8')](_0x582f('0xb'),auth[_0x582f('0x9')](),controller[_0x582f('0xc')]);router[_0x582f('0xd')]('/',auth[_0x582f('0x9')](),interaction['tracked']('chat','chatmessage:create'),controller[_0x582f('0xe')]);router[_0x582f('0xf')](_0x582f('0xb'),controller[_0x582f('0x10')]);router[_0x582f('0xf')](_0x582f('0x11'),auth[_0x582f('0x9')](),controller[_0x582f('0x12')]);router[_0x582f('0xf')](_0x582f('0x13'),auth[_0x582f('0x9')](),controller[_0x582f('0x14')]);router['delete'](_0x582f('0xb'),auth[_0x582f('0x9')](),controller[_0x582f('0x15')]);module[_0x582f('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f1f5ead..dd2cca2 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0x0b0e[_0x14e1cb];return _0x18a337;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x5a774b,_0x1d38fe){var _0x3a2a39=function(_0x27d527){while(--_0x27d527){_0x5a774b['push'](_0x5a774b['shift']());}};_0x3a2a39(++_0x1d38fe);}(_0xadb5,0xad));var _0x5adb=function(_0x4fdc2d,_0x408750){_0x4fdc2d=_0x4fdc2d-0x0;var _0x2ff331=_0xadb5[_0x4fdc2d];return _0x2ff331;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1faf35d..23e59d3 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(_0x4fe0eb,_0x2cfd55){var _0xf43153=function(_0x3e6502){while(--_0x3e6502){_0x4fe0eb['push'](_0x4fe0eb['shift']());}};_0xf43153(++_0x2cfd55);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x7d1762,_0x172c9c){var _0x252065=function(_0x499745){while(--_0x499745){_0x7d1762['push'](_0x7d1762['shift']());}};_0x252065(++_0x172c9c);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 1b1afc3..5229a6f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19d1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1eb3c6,_0x2cc1e4){var _0x1627e9=function(_0x10aa23){while(--_0x10aa23){_0x1eb3c6['push'](_0x1eb3c6['shift']());}};_0x1627e9(++_0x2cc1e4);}(_0x19d1,0x16c));var _0x119d=function(_0x3f9704,_0x1b2bc3){_0x3f9704=_0x3f9704-0x0;var _0x2ebc59=_0x19d1[_0x3f9704];return _0x2ebc59;};'use strict';var EventEmitter=require(_0x119d('0x0'));var ChatOfflineMessage=require(_0x119d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x119d('0x2')](0x0);var events={'afterCreate':_0x119d('0x3'),'afterUpdate':_0x119d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2bc80e){return function(_0x4dd235,_0x4239d3,_0x336986){ChatOfflineMessageEvents[_0x119d('0x5')](_0x2bc80e+':'+_0x4dd235['id'],_0x4dd235);ChatOfflineMessageEvents[_0x119d('0x5')](_0x2bc80e,_0x4dd235);_0x336986(null);};}for(var e in events){if(events[_0x119d('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x119d('0x7')](e,emitEvent(event));}}module[_0x119d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x9085=['update','emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0x9085,0xaf));var _0x5908=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x9085[_0x3e8270];return _0x1ccde9;};'use strict';var EventEmitter=require(_0x5908('0x0'));var ChatOfflineMessage=require(_0x5908('0x1'))['db'][_0x5908('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5908('0x3')](0x0);var events={'afterCreate':_0x5908('0x4'),'afterUpdate':_0x5908('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa71a41){return function(_0x494add,_0x83e03a,_0x228e8e){ChatOfflineMessageEvents[_0x5908('0x6')](_0xa71a41+':'+_0x494add['id'],_0x494add);ChatOfflineMessageEvents[_0x5908('0x6')](_0xa71a41,_0x494add);_0x228e8e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x5908('0x7')](e,emitEvent(event));}}module[_0x5908('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 36ad84e..48aa39a 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 _0x4758=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x596a17,_0x4ba425){var _0x41319b=function(_0x227715){while(--_0x227715){_0x596a17['push'](_0x596a17['shift']());}};_0x41319b(++_0x4ba425);}(_0x4758,0x8a));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0x8475('0x0'));module['exports']=function(_0x2294fa){return _0x2294fa[_0x8475('0x1')](_0x8475('0x2'),attributes,{'tableName':_0x8475('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8475('0x4')});}; \ No newline at end of file +var _0x9cef=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','utf8mb4'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x9cef,0x131));var _0xf9ce=function(_0xf61586,_0x56b0c4){_0xf61586=_0xf61586-0x0;var _0x2b6eb3=_0x9cef[_0xf61586];return _0x2b6eb3;};'use strict';var attributes=require(_0xf9ce('0x0'));module['exports']=function(_0xf32d5f){return _0xf32d5f[_0xf9ce('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf9ce('0x2'),'collate':_0xf9ce('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8403ef5..8ce78ae 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 _0xd0a2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0xbce40f,_0xd74797){var _0x57326d=function(_0x3605e2){while(--_0x3605e2){_0xbce40f['push'](_0xbce40f['shift']());}};_0x57326d(++_0xd74797);}(_0xd0a2,0x128));var _0x2d0a=function(_0x1c1172,_0x27c3c4){_0x1c1172=_0x1c1172-0x0;var _0x300943=_0xd0a2[_0x1c1172];return _0x300943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d0a('0x0'));var BPromise=require(_0x2d0a('0x1'));var rs=require(_0x2d0a('0x2'));var fs=require('fs');var Redis=require(_0x2d0a('0x3'));var db=require(_0x2d0a('0x4'))['db'];var utils=require(_0x2d0a('0x5'));var logger=require(_0x2d0a('0x6'))(_0x2d0a('0x7'));var config=require(_0x2d0a('0x8'));var jayson=require(_0x2d0a('0x9'));var client=jayson[_0x2d0a('0xa')][_0x2d0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4017a3,_0x2d29d3,_0x3887bf){return new BPromise(function(_0x504776,_0xd487f2){return client[_0x2d0a('0xc')](_0x4017a3,_0x3887bf)[_0x2d0a('0xd')](function(_0x5b17a3){logger[_0x2d0a('0xe')](_0x2d0a('0xf'),_0x2d29d3,_0x2d0a('0x10'));logger[_0x2d0a('0x11')](_0x2d0a('0x12'),_0x2d29d3,_0x2d0a('0x10'),JSON[_0x2d0a('0x13')](_0x5b17a3));if(_0x5b17a3[_0x2d0a('0x14')]){if(_0x5b17a3['error'][_0x2d0a('0x15')]===0x1f4){logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x5b17a3[_0x2d0a('0x14')][_0x2d0a('0x16')]);return _0xd487f2(_0x5b17a3['error'][_0x2d0a('0x16')]);}logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x5b17a3['error'][_0x2d0a('0x16')]);return _0x504776(_0x5b17a3[_0x2d0a('0x14')][_0x2d0a('0x16')]);}else{logger['info'](_0x2d0a('0xf'),_0x2d29d3,_0x2d0a('0x10'));_0x504776(_0x5b17a3[_0x2d0a('0x17')][_0x2d0a('0x16')]);}})[_0x2d0a('0x18')](function(_0x63a465){logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x63a465);_0xd487f2(_0x63a465);});});} \ No newline at end of file +var _0x5010=['../../config/utils','../../config/logger','rpc','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x32c709,_0x15d4ae){var _0x23ec4e=function(_0x5e963d){while(--_0x5e963d){_0x32c709['push'](_0x32c709['shift']());}};_0x23ec4e(++_0x15d4ae);}(_0x5010,0x1c9));var _0x0501=function(_0x2a82fc,_0x22523a){_0x2a82fc=_0x2a82fc-0x0;var _0x427429=_0x5010[_0x2a82fc];return _0x427429;};'use strict';var _=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var moment=require(_0x0501('0x2'));var BPromise=require(_0x0501('0x3'));var rs=require(_0x0501('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0501('0x5'));var logger=require(_0x0501('0x6'))(_0x0501('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0501('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50e612,_0x59cbfe,_0x1630d0){return new BPromise(function(_0x91a886,_0x3fb18d){return client[_0x0501('0x9')](_0x50e612,_0x1630d0)[_0x0501('0xa')](function(_0x4838cd){logger[_0x0501('0xb')](_0x0501('0xc'),_0x59cbfe,_0x0501('0xd'));logger[_0x0501('0xe')](_0x0501('0xf'),_0x59cbfe,'request\x20sent',JSON['stringify'](_0x4838cd));if(_0x4838cd['error']){if(_0x4838cd[_0x0501('0x10')][_0x0501('0x11')]===0x1f4){logger[_0x0501('0x10')](_0x0501('0xc'),_0x59cbfe,_0x4838cd[_0x0501('0x10')][_0x0501('0x12')]);return _0x3fb18d(_0x4838cd[_0x0501('0x10')]['message']);}logger[_0x0501('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x59cbfe,_0x4838cd[_0x0501('0x10')][_0x0501('0x12')]);return _0x91a886(_0x4838cd[_0x0501('0x10')][_0x0501('0x12')]);}else{logger[_0x0501('0xb')](_0x0501('0xc'),_0x59cbfe,_0x0501('0xd'));_0x91a886(_0x4838cd[_0x0501('0x13')][_0x0501('0x12')]);}})[_0x0501('0x14')](function(_0xef187d){logger['error'](_0x0501('0xc'),_0x59cbfe,_0xef187d);_0x3fb18d(_0xef187d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 345c30b..b27fd0f 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 _0x9488=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x2df016,_0x3827c7){var _0x3e9f39=function(_0x2567e9){while(--_0x2567e9){_0x2df016['push'](_0x2df016['shift']());}};_0x3e9f39(++_0x3827c7);}(_0x9488,0x68));var _0x8948=function(_0x4ec891,_0x18a97c){_0x4ec891=_0x4ec891-0x0;var _0x4c158f=_0x9488[_0x4ec891];return _0x4c158f;};'use strict';var multer=require(_0x8948('0x0'));var util=require(_0x8948('0x1'));var path=require(_0x8948('0x2'));var timeout=require(_0x8948('0x3'));var express=require(_0x8948('0x4'));var router=express[_0x8948('0x5')]();var fs_extra=require(_0x8948('0x6'));var auth=require(_0x8948('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8948('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x8948('0x9')](),controller[_0x8948('0xa')]);router['get'](_0x8948('0xb'),auth[_0x8948('0x9')](),controller[_0x8948('0xc')]);router['get'](_0x8948('0xd'),auth[_0x8948('0x9')](),controller[_0x8948('0xe')]);router[_0x8948('0xf')]('/',auth[_0x8948('0x9')](),controller[_0x8948('0x10')]);router[_0x8948('0x11')]('/:id',auth[_0x8948('0x9')](),controller[_0x8948('0x12')]);router[_0x8948('0x13')](_0x8948('0xd'),auth[_0x8948('0x9')](),controller['destroy']);module[_0x8948('0x14')]=router; \ No newline at end of file +var _0xd1bf=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x16f569,_0x23fca5){var _0x28e8c7=function(_0x11e752){while(--_0x11e752){_0x16f569['push'](_0x16f569['shift']());}};_0x28e8c7(++_0x23fca5);}(_0xd1bf,0x1e0));var _0xfd1b=function(_0x2815b1,_0x3b1592){_0x2815b1=_0x2815b1-0x0;var _0x107b89=_0xd1bf[_0x2815b1];return _0x107b89;};'use strict';var multer=require(_0xfd1b('0x0'));var util=require(_0xfd1b('0x1'));var path=require(_0xfd1b('0x2'));var timeout=require(_0xfd1b('0x3'));var express=require(_0xfd1b('0x4'));var router=express[_0xfd1b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfd1b('0x6'));var interaction=require(_0xfd1b('0x7'));var config=require(_0xfd1b('0x8'));var controller=require(_0xfd1b('0x9'));router[_0xfd1b('0xa')]('/',auth[_0xfd1b('0xb')](),controller[_0xfd1b('0xc')]);router[_0xfd1b('0xa')]('/describe',auth[_0xfd1b('0xb')](),controller[_0xfd1b('0xd')]);router[_0xfd1b('0xa')](_0xfd1b('0xe'),auth[_0xfd1b('0xb')](),controller['show']);router[_0xfd1b('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd1b('0x10')]);router[_0xfd1b('0x11')](_0xfd1b('0xe'),auth[_0xfd1b('0xb')](),controller[_0xfd1b('0x12')]);router[_0xfd1b('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd1b('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 33e2753..92da297 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 _0x9df5=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x9df5,0x11c));var _0x59df=function(_0xa2efdb,_0x788be8){_0xa2efdb=_0xa2efdb-0x0;var _0x2b11a0=_0x9df5[_0xa2efdb];return _0x2b11a0;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x59df('0x2')](_0x59df('0x3'),'timeout'),'defaultValue':_0x59df('0x3')},'selector':{'type':Sequelize[_0x59df('0x1')]},'timeout':{'type':Sequelize[_0x59df('0x4')]}}; \ No newline at end of file +var _0xacff=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xacff,0x158));var _0xfacf=function(_0x1d5133,_0xdc49a8){_0x1d5133=_0x1d5133-0x0;var _0x280af7=_0xacff[_0x1d5133];return _0x280af7;};'use strict';var Sequelize=require(_0xfacf('0x0'));module[_0xfacf('0x1')]={'name':{'type':Sequelize[_0xfacf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfacf('0x3')](_0xfacf('0x4'),_0xfacf('0x5')),'defaultValue':_0xfacf('0x4')},'selector':{'type':Sequelize[_0xfacf('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9c2d410..6695937 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 _0x4074=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','include','options','find','catch','create','ChatProactiveAction','body','then'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4074,0xf0));var _0x4407=function(_0x4fe942,_0x422dbc){_0x4fe942=_0x4fe942-0x0;var _0x5287df=_0x4074[_0x4fe942];return _0x5287df;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={'raw':!![],'where':{'id':_0x2feb6b[_0x4407('0x2b')]['id']}},_0x1d6b3d={};_0x1d6b3d[_0x4407('0x2c')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x1d6b3d[_0x4407('0x2d')]=_[_0x4407('0x2e')](_0x2feb6b[_0x4407('0x2d')]);_0x1d6b3d[_0x4407('0x2f')]=_[_0x4407('0x30')](_0x1d6b3d[_0x4407('0x2c')],_0x1d6b3d[_0x4407('0x2d')]);_0x84a8a[_0x4407('0x31')]=_[_0x4407('0x30')](_0x1d6b3d[_0x4407('0x2c')],qs['fields'](_0x2feb6b['query'][_0x4407('0x32')]));_0x84a8a[_0x4407('0x31')]=_0x84a8a[_0x4407('0x31')]['length']?_0x84a8a[_0x4407('0x31')]:_0x1d6b3d[_0x4407('0x2c')];if(_0x2feb6b[_0x4407('0x2d')][_0x4407('0x33')]){_0x84a8a[_0x4407('0x34')]=[{'all':!![]}];}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x35')]);return db['ChatProactiveAction'][_0x4407('0x36')](_0x84a8a)['then'](handleEntityNotFound(_0x1f9828,null))['then'](respondWithResult(_0x1f9828,null))[_0x4407('0x37')](handleError(_0x1f9828,null));};exports[_0x4407('0x38')]=function(_0x3aa619,_0x3a9537){return db[_0x4407('0x39')][_0x4407('0x38')](_0x3aa619[_0x4407('0x3a')],{})['then'](respondWithResult(_0x3a9537,0xc9))[_0x4407('0x37')](handleError(_0x3a9537,null));};exports[_0x4407('0x25')]=function(_0x189dd0,_0x4e068f){if(_0x189dd0[_0x4407('0x3a')]['id']){delete _0x189dd0['body']['id'];}return db[_0x4407('0x39')]['find']({'where':{'id':_0x189dd0[_0x4407('0x2b')]['id']}})[_0x4407('0x3b')](handleEntityNotFound(_0x4e068f,null))[_0x4407('0x3b')](saveUpdates(_0x189dd0[_0x4407('0x3a')],null))['then'](respondWithResult(_0x4e068f,null))[_0x4407('0x37')](handleError(_0x4e068f,null));};exports[_0x4407('0x26')]=function(_0xd31d71,_0x1bf4e2){return db[_0x4407('0x39')][_0x4407('0x36')]({'where':{'id':_0xd31d71[_0x4407('0x2b')]['id']}})[_0x4407('0x3b')](handleEntityNotFound(_0x1bf4e2,null))[_0x4407('0x3b')](removeEntity(_0x1bf4e2,null))['catch'](handleError(_0x1bf4e2,null));}; \ No newline at end of file +var _0x032e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','params','rawAttributes','query','keys','intersection','model','attributes','fields','length','includeAll','merge','ChatProactiveAction','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x425ecd,_0x21e095){var _0xc4f997=function(_0x5e898a){while(--_0x5e898a){_0x425ecd['push'](_0x425ecd['shift']());}};_0xc4f997(++_0x21e095);}(_0x032e,0x124));var _0xe032=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x032e[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['show']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={'raw':!![],'where':{'id':_0x5573e4[_0xe032('0x2b')]['id']}},_0x469290={};_0x469290['model']=_['keys'](db['ChatProactiveAction'][_0xe032('0x2c')]);_0x469290[_0xe032('0x2d')]=_[_0xe032('0x2e')](_0x5573e4[_0xe032('0x2d')]);_0x469290['filters']=_[_0xe032('0x2f')](_0x469290[_0xe032('0x30')],_0x469290[_0xe032('0x2d')]);_0x38e7ea[_0xe032('0x31')]=_[_0xe032('0x2f')](_0x469290['model'],qs[_0xe032('0x32')](_0x5573e4[_0xe032('0x2d')][_0xe032('0x32')]));_0x38e7ea[_0xe032('0x31')]=_0x38e7ea['attributes'][_0xe032('0x33')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x30')];if(_0x5573e4['query'][_0xe032('0x34')]){_0x38e7ea['include']=[{'all':!![]}];}_0x38e7ea=_[_0xe032('0x35')]({},_0x38e7ea,_0x5573e4['options']);return db[_0xe032('0x36')][_0xe032('0x37')](_0x38e7ea)['then'](handleEntityNotFound(_0x3e2575,null))[_0xe032('0x27')](respondWithResult(_0x3e2575,null))[_0xe032('0x38')](handleError(_0x3e2575,null));};exports[_0xe032('0x39')]=function(_0x2620d2,_0x4e222c){return db[_0xe032('0x36')]['create'](_0x2620d2[_0xe032('0x3a')],{})[_0xe032('0x27')](respondWithResult(_0x4e222c,0xc9))['catch'](handleError(_0x4e222c,null));};exports[_0xe032('0x26')]=function(_0x23b790,_0x4a4447){if(_0x23b790[_0xe032('0x3a')]['id']){delete _0x23b790[_0xe032('0x3a')]['id'];}return db[_0xe032('0x36')][_0xe032('0x37')]({'where':{'id':_0x23b790[_0xe032('0x2b')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x4a4447,null))[_0xe032('0x27')](saveUpdates(_0x23b790[_0xe032('0x3a')],null))[_0xe032('0x27')](respondWithResult(_0x4a4447,null))[_0xe032('0x38')](handleError(_0x4a4447,null));};exports[_0xe032('0x3b')]=function(_0x432d39,_0x30571c){return db[_0xe032('0x36')][_0xe032('0x37')]({'where':{'id':_0x432d39[_0xe032('0x2b')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x30571c,null))['then'](removeEntity(_0x30571c,null))[_0xe032('0x38')](handleError(_0x30571c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1408d5a..96e4872 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 _0x27c0=['../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','moment'];(function(_0x58e69d,_0x349893){var _0x2530ac=function(_0x70a89c){while(--_0x70a89c){_0x58e69d['push'](_0x58e69d['shift']());}};_0x2530ac(++_0x349893);}(_0x27c0,0xb5));var _0x027c=function(_0x22c81f,_0x3a3c86){_0x22c81f=_0x22c81f-0x0;var _0x3b897f=_0x27c0[_0x22c81f];return _0x3b897f;};'use strict';var _=require(_0x027c('0x0'));var util=require(_0x027c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x027c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x027c('0x3'));var attributes=require(_0x027c('0x4'));module[_0x027c('0x5')]=function(_0xdccf39,_0x194383){return _0xdccf39['define'](_0x027c('0x6'),attributes,{'tableName':_0x027c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3096=['../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x41e435,_0x56382c){var _0x3dfcf1=function(_0x33a02e){while(--_0x33a02e){_0x41e435['push'](_0x41e435['shift']());}};_0x3dfcf1(++_0x56382c);}(_0x3096,0xa1));var _0x6309=function(_0x25fe4f,_0x74aeaa){_0x25fe4f=_0x25fe4f-0x0;var _0x582605=_0x3096[_0x25fe4f];return _0x582605;};'use strict';var _=require(_0x6309('0x0'));var util=require(_0x6309('0x1'));var logger=require(_0x6309('0x2'))('api');var moment=require(_0x6309('0x3'));var BPromise=require(_0x6309('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6309('0x5'));var rimraf=require(_0x6309('0x6'));var config=require(_0x6309('0x7'));var attributes=require(_0x6309('0x8'));module['exports']=function(_0x47bc7f,_0x2e0f58){return _0x47bc7f[_0x6309('0x9')](_0x6309('0xa'),attributes,{'tableName':_0x6309('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8e5f72d..e24a011 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 _0x6775=['stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x312b37,_0x19f474){var _0x2e5f91=function(_0x19473d){while(--_0x19473d){_0x312b37['push'](_0x312b37['shift']());}};_0x2e5f91(++_0x19f474);}(_0x6775,0xb9));var _0x5677=function(_0x30b91e,_0x2ef4e7){_0x30b91e=_0x30b91e-0x0;var _0x4490c0=_0x6775[_0x30b91e];return _0x4490c0;};'use strict';var _=require(_0x5677('0x0'));var util=require(_0x5677('0x1'));var moment=require(_0x5677('0x2'));var BPromise=require('bluebird');var rs=require(_0x5677('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5677('0x4'));var logger=require(_0x5677('0x5'))(_0x5677('0x6'));var config=require(_0x5677('0x7'));var jayson=require(_0x5677('0x8'));var client=jayson[_0x5677('0x9')][_0x5677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x388f53,_0x2861fd,_0x4e7394){return new BPromise(function(_0x44ef12,_0x38d1ee){return client['request'](_0x388f53,_0x4e7394)[_0x5677('0xb')](function(_0x521d65){logger[_0x5677('0xc')](_0x5677('0xd'),_0x2861fd,_0x5677('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2861fd,_0x5677('0xe'),JSON[_0x5677('0xf')](_0x521d65));if(_0x521d65[_0x5677('0x10')]){if(_0x521d65[_0x5677('0x10')][_0x5677('0x11')]===0x1f4){logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x521d65[_0x5677('0x10')][_0x5677('0x12')]);return _0x38d1ee(_0x521d65[_0x5677('0x10')]['message']);}logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x521d65['error']['message']);return _0x44ef12(_0x521d65['error'][_0x5677('0x12')]);}else{logger[_0x5677('0xc')](_0x5677('0xd'),_0x2861fd,_0x5677('0xe'));_0x44ef12(_0x521d65['result'][_0x5677('0x12')]);}})[_0x5677('0x13')](function(_0x406e01){logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x406e01);_0x38d1ee(_0x406e01);});});} \ No newline at end of file +var _0x62f8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','ChatProactiveAction,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4265ff,_0x2f7805){var _0x4b2e54=function(_0x1c0a1c){while(--_0x1c0a1c){_0x4265ff['push'](_0x4265ff['shift']());}};_0x4b2e54(++_0x2f7805);}(_0x62f8,0x1d4));var _0x862f=function(_0x477126,_0x4c08d2){_0x477126=_0x477126-0x0;var _0x13ff93=_0x62f8[_0x477126];return _0x13ff93;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var moment=require(_0x862f('0x2'));var BPromise=require(_0x862f('0x3'));var rs=require(_0x862f('0x4'));var fs=require('fs');var Redis=require(_0x862f('0x5'));var db=require(_0x862f('0x6'))['db'];var utils=require(_0x862f('0x7'));var logger=require(_0x862f('0x8'))(_0x862f('0x9'));var config=require('../../config/environment');var jayson=require(_0x862f('0xa'));var client=jayson[_0x862f('0xb')][_0x862f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2baa83,_0x55aeca,_0x4b561e){return new BPromise(function(_0x79b1ef,_0x4dc780){return client[_0x862f('0xd')](_0x2baa83,_0x4b561e)[_0x862f('0xe')](function(_0x2201cc){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x55aeca,_0x862f('0xf'));logger['debug'](_0x862f('0x10'),_0x55aeca,_0x862f('0xf'),JSON[_0x862f('0x11')](_0x2201cc));if(_0x2201cc['error']){if(_0x2201cc['error'][_0x862f('0x12')]===0x1f4){logger['error'](_0x862f('0x13'),_0x55aeca,_0x2201cc[_0x862f('0x14')][_0x862f('0x15')]);return _0x4dc780(_0x2201cc[_0x862f('0x14')][_0x862f('0x15')]);}logger['error'](_0x862f('0x13'),_0x55aeca,_0x2201cc[_0x862f('0x14')][_0x862f('0x15')]);return _0x79b1ef(_0x2201cc[_0x862f('0x14')]['message']);}else{logger[_0x862f('0x16')](_0x862f('0x13'),_0x55aeca,_0x862f('0xf'));_0x79b1ef(_0x2201cc[_0x862f('0x17')][_0x862f('0x15')]);}})[_0x862f('0x18')](function(_0x51ec6a){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x55aeca,_0x51ec6a);_0x4dc780(_0x51ec6a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6320354..6e3a893 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 _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x48ec4a,_0x88c5ff){var _0x6561b7=function(_0x14e73c){while(--_0x14e73c){_0x48ec4a['push'](_0x48ec4a['shift']());}};_0x6561b7(++_0x88c5ff);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xeec6[_0x5534fe];return _0x3d1dc2;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file +var _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4a1160,_0x4dcde3){var _0x1963f9=function(_0x22d4fc){while(--_0x22d4fc){_0x4a1160['push'](_0x4a1160['shift']());}};_0x1963f9(++_0x4dcde3);}(_0x6aa7,0x178));var _0x76aa=function(_0x393cf5,_0x50e0db){_0x393cf5=_0x393cf5-0x0;var _0x5c5be5=_0x6aa7[_0x393cf5];return _0x5c5be5;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a184f1b..d4ed627 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 _0x4a93=['beepall','roundrobin','STRING','name','INTEGER','rrmemory'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4a93,0x98));var _0x34a9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x4a93[_0x476bf4];return _0x788ffe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x34a9('0x0')],'unique':_0x34a9('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x34a9('0x0')]},'timeout':{'type':Sequelize[_0x34a9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x34a9('0x3'),_0x34a9('0x4'),_0x34a9('0x5'))}}; \ No newline at end of file +var _0xdad7=['rrmemory','beepall','exports','name','STRING','ENUM'];(function(_0xa3afcd,_0x6f9288){var _0x5e83d3=function(_0x4fe87a){while(--_0x4fe87a){_0xa3afcd['push'](_0xa3afcd['shift']());}};_0x5e83d3(++_0x6f9288);}(_0xdad7,0xce));var _0x7dad=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xdad7[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module[_0x7dad('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7dad('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7dad('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7dad('0x3')](_0x7dad('0x4'),_0x7dad('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f81bbfa..32e578c 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 _0xb739=['ChatQueue','include','query','findAll','rows','params','filters','intersection','model','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','keys','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','order','filter','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where'];(function(_0x170bff,_0x31c89b){var _0xbe234e=function(_0x18a41d){while(--_0x18a41d){_0x170bff['push'](_0x170bff['shift']());}};_0xbe234e(++_0x31c89b);}(_0xb739,0x1c9));var _0x9b73=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xb739[_0x5e0bfe];return _0x6468b8;};'use strict';var BPromise=require('bluebird');var util=require(_0x9b73('0x0'));var _=require(_0x9b73('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x9b73('0x2'));var logger=require(_0x9b73('0x3'))(_0x9b73('0x4'));var config=require('../../config/environment');var db=require(_0x9b73('0x5'))['db'];config[_0x9b73('0x6')]=_[_0x9b73('0x7')](config[_0x9b73('0x6')],{'host':_0x9b73('0x8'),'port':0x18eb});var socket=require(_0x9b73('0x9'))(new Redis(config[_0x9b73('0x6')]));require(_0x9b73('0xa'))[_0x9b73('0xb')](socket);function respondWithStatusCode(_0x4898c5,_0x5a4100){_0x5a4100=_0x5a4100||0xcc;return function(_0x17b966){if(_0x17b966){return _0x4898c5['sendStatus'](_0x5a4100);}return _0x4898c5['status'](_0x5a4100)[_0x9b73('0xc')]();};}function respondWithResult(_0x43daec,_0xa55abb){_0xa55abb=_0xa55abb||0xc8;return function(_0x20dc37){if(_0x20dc37){return _0x43daec[_0x9b73('0xd')](_0xa55abb)[_0x9b73('0xe')](_0x20dc37);}};}function respondWithFilteredResult(_0x27ac3a,_0x21bb8d){return function(_0x3d1a76){if(_0x3d1a76){var _0x5ab05f=typeof _0x21bb8d[_0x9b73('0xf')]===_0x9b73('0x10')&&typeof _0x21bb8d[_0x9b73('0x11')]===_0x9b73('0x10');var _0x4cd027=_0x3d1a76[_0x9b73('0x12')];var _0x400fa4=_0x5ab05f?0x0:_0x21bb8d[_0x9b73('0xf')];var _0x83199c=_0x5ab05f?_0x3d1a76[_0x9b73('0x12')]:_0x21bb8d['offset']+_0x21bb8d['limit'];var _0x35698e;if(_0x83199c>=_0x4cd027){_0x83199c=_0x4cd027;_0x35698e=0xc8;}else{_0x35698e=0xce;}_0x27ac3a[_0x9b73('0xd')](_0x35698e);return _0x27ac3a[_0x9b73('0x13')](_0x9b73('0x14'),_0x400fa4+'-'+_0x83199c+'/'+_0x4cd027)[_0x9b73('0xe')](_0x3d1a76);}return null;};}function saveUpdates(_0xccb9b0){return function(_0x2e844e){if(_0x2e844e){return _0x2e844e[_0x9b73('0x15')](_0xccb9b0)[_0x9b73('0x16')](function(_0x33c703){return _0x33c703;});}return null;};}function removeEntity(_0x5c6f92){return function(_0x4d570a){if(_0x4d570a){return _0x4d570a[_0x9b73('0x17')]()['then'](function(){var _0x35a871=_0x4d570a[_0x9b73('0x18')]({'plain':!![]});var _0x2e76ea='ChatQueues';return db[_0x9b73('0x19')]['destroy']({'where':{'type':_0x2e76ea,'resourceId':_0x35a871['id']}})[_0x9b73('0x16')](function(){return _0x4d570a;});})['then'](function(){_0x5c6f92[_0x9b73('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9518d5){return function(_0x467c91){if(!_0x467c91){_0x9518d5[_0x9b73('0x1a')](0x194);}return _0x467c91;};}function handleError(_0xab1469,_0x4b0ef0){_0x4b0ef0=_0x4b0ef0||0x1f4;return function(_0x478f7e){logger[_0x9b73('0x1b')](_0x478f7e[_0x9b73('0x1c')]);if(_0x478f7e[_0x9b73('0x1d')]){delete _0x478f7e['name'];}_0xab1469[_0x9b73('0xd')](_0x4b0ef0)[_0x9b73('0x1e')](_0x478f7e);};}exports[_0x9b73('0x1f')]=function(_0x4d0b82,_0x28c42e){var _0x1e0694={};var _0x121aa1={'count':0x0,'rows':[]};var _0x54940c=_[_0x9b73('0x20')](db['ChatQueue'][_0x9b73('0x21')],function(_0x58e67f){return{'name':_0x58e67f[_0x9b73('0x22')],'type':_0x58e67f[_0x9b73('0x23')][_0x9b73('0x24')]};});_0x1e0694=qs[_0x9b73('0x25')](_0x54940c,_0x4d0b82);var _0x5ce8b7={'where':_0x1e0694[_0x9b73('0x26')]};return db[_0x9b73('0x27')][_0x9b73('0x12')](_0x5ce8b7)[_0x9b73('0x16')](function(_0x30a40b){_0x121aa1['count']=_0x30a40b;_0x1e0694[_0x9b73('0x28')]=qs['include'](_0x4d0b82[_0x9b73('0x29')]);return db[_0x9b73('0x27')][_0x9b73('0x2a')](_0x1e0694);})[_0x9b73('0x16')](function(_0xc66f96){_0x121aa1[_0x9b73('0x2b')]=_0xc66f96;return _0x121aa1;})[_0x9b73('0x16')](respondWithFilteredResult(_0x28c42e,_0x1e0694))['catch'](handleError(_0x28c42e,null));};exports['show']=function(_0x3c1b6c,_0x1a82d8){var _0x39635f={'raw':!![],'where':{'id':_0x3c1b6c[_0x9b73('0x2c')]['id']}},_0x108686={};_0x108686['model']=_['keys'](db[_0x9b73('0x27')]['rawAttributes']);_0x108686['query']=_['keys'](_0x3c1b6c[_0x9b73('0x29')]);_0x108686[_0x9b73('0x2d')]=_[_0x9b73('0x2e')](_0x108686[_0x9b73('0x2f')],_0x108686[_0x9b73('0x29')]);_0x39635f['attributes']=_['intersection'](_0x108686[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x3c1b6c[_0x9b73('0x29')][_0x9b73('0x30')]));_0x39635f[_0x9b73('0x31')]=_0x39635f[_0x9b73('0x31')][_0x9b73('0x32')]?_0x39635f[_0x9b73('0x31')]:_0x108686[_0x9b73('0x2f')];if(_0x3c1b6c[_0x9b73('0x29')][_0x9b73('0x33')]){_0x39635f[_0x9b73('0x28')]=[{'all':!![]}];}_0x39635f=_[_0x9b73('0x34')]({},_0x39635f,_0x3c1b6c[_0x9b73('0x35')]);return db['ChatQueue'][_0x9b73('0x36')](_0x39635f)[_0x9b73('0x16')](handleEntityNotFound(_0x1a82d8,null))[_0x9b73('0x16')](respondWithResult(_0x1a82d8,null))[_0x9b73('0x37')](handleError(_0x1a82d8,null));};exports['create']=function(_0x1574d1,_0x1da5c0){return db['ChatQueue'][_0x9b73('0x38')](_0x1574d1[_0x9b73('0x39')],{})[_0x9b73('0x16')](function(_0x3ce799){var _0x2fb54d=_0x1574d1[_0x9b73('0x3a')]['get']({'plain':!![]});if(!_0x2fb54d)throw new Error(_0x9b73('0x3b'));if(_0x2fb54d[_0x9b73('0x3c')]==='user'){var _0x424eb0=_0x3ce799[_0x9b73('0x18')]({'plain':!![]});var _0x4bef2c=_0x9b73('0x3d');return db['UserProfileSection']['find']({'where':{'name':_0x4bef2c,'userProfileId':_0x2fb54d[_0x9b73('0x3e')]},'raw':!![]})[_0x9b73('0x16')](function(_0x3d024b){if(_0x3d024b&&_0x3d024b[_0x9b73('0x3f')]===0x0){return db[_0x9b73('0x19')][_0x9b73('0x38')]({'name':_0x424eb0[_0x9b73('0x1d')],'resourceId':_0x424eb0['id'],'type':_0x3d024b[_0x9b73('0x1d')],'sectionId':_0x3d024b['id']},{})['then'](function(){return _0x3ce799;});}else{return _0x3ce799;}})['catch'](function(_0x4e9cfe){logger['error'](_0x9b73('0x40'),_0x4e9cfe);throw _0x4e9cfe;});}return _0x3ce799;})[_0x9b73('0x16')](respondWithResult(_0x1da5c0,0xc9))['catch'](handleError(_0x1da5c0,null));};exports[_0x9b73('0x15')]=function(_0x480f09,_0x1c88e9){if(_0x480f09[_0x9b73('0x39')]['id']){delete _0x480f09[_0x9b73('0x39')]['id'];}return db['ChatQueue'][_0x9b73('0x36')]({'where':{'id':_0x480f09['params']['id']}})['then'](handleEntityNotFound(_0x1c88e9,null))[_0x9b73('0x16')](saveUpdates(_0x480f09['body'],null))[_0x9b73('0x16')](respondWithResult(_0x1c88e9,null))[_0x9b73('0x37')](handleError(_0x1c88e9,null));};exports[_0x9b73('0x17')]=function(_0x283833,_0x3d0bdb){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x283833[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x3d0bdb,null))[_0x9b73('0x16')](removeEntity(_0x3d0bdb,null))[_0x9b73('0x37')](handleError(_0x3d0bdb,null));};exports[_0x9b73('0x41')]=function(_0x11e899,_0x29262a){return db[_0x9b73('0x27')][_0x9b73('0x41')]()['then'](respondWithResult(_0x29262a,null))[_0x9b73('0x37')](handleError(_0x29262a,null));};exports['getMembers']=function(_0x5e3dfd,_0x765a31){var _0x2443d7={'raw':!![],'where':{}},_0x3a099c={},_0xbb3f86;return db['ChatQueue'][_0x9b73('0x42')]({'where':{'id':_0x5e3dfd['params']['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x765a31,null))[_0x9b73('0x16')](function(_0xe19526){if(_0xe19526){_0xbb3f86=_0xe19526['get']({'plain':!![]});_0x3a099c[_0x9b73('0x2f')]=_[_0x9b73('0x43')](db[_0x9b73('0x44')][_0x9b73('0x21')]);_0x3a099c[_0x9b73('0x29')]=_[_0x9b73('0x43')](_0x5e3dfd[_0x9b73('0x29')]);_0x3a099c['filters']=_[_0x9b73('0x2e')](_0x3a099c[_0x9b73('0x2f')],_0x3a099c[_0x9b73('0x29')]);_0x2443d7[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x3a099c['model'],qs[_0x9b73('0x30')](_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x30')]));_0x2443d7[_0x9b73('0x31')]=_0x2443d7[_0x9b73('0x31')][_0x9b73('0x32')]?_0x2443d7['attributes']:_0x3a099c[_0x9b73('0x2f')];if(!_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x45')]('nolimit')){_0x2443d7[_0x9b73('0x11')]=qs[_0x9b73('0x11')](_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x11')]);_0x2443d7[_0x9b73('0xf')]=qs['offset'](_0x5e3dfd[_0x9b73('0x29')]['offset']);}_0x2443d7['order']=qs['sort'](_0x5e3dfd['query'][_0x9b73('0x46')]);_0x2443d7[_0x9b73('0x26')]=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x5e3dfd[_0x9b73('0x29')],_0x3a099c['filters']));_0x2443d7[_0x9b73('0x26')][_0x9b73('0x48')]=_0xe19526['id'];if(_0x5e3dfd[_0x9b73('0x29')]['filter']){_0x2443d7['where']=_[_0x9b73('0x34')](_0x2443d7[_0x9b73('0x26')],{'$or':_[_0x9b73('0x20')](_0x2443d7[_0x9b73('0x31')],function(_0x1f342a){var _0x15d7c2={};_0x15d7c2[_0x1f342a]={'$like':'%'+_0x5e3dfd['query']['filter']+'%'};return _0x15d7c2;})});}_0x2443d7=_[_0x9b73('0x34')]({},_0x2443d7,_0x5e3dfd['options']);return db[_0x9b73('0x44')][_0x9b73('0x2a')](_0x2443d7);}})['then'](function(_0xd48ed4){if(_0xd48ed4){return db[_0x9b73('0x49')][_0x9b73('0x4a')]({'where':{'id':_[_0x9b73('0x20')](_0xd48ed4,'UserId'),'role':'agent'},'attributes':['id',_0x9b73('0x1d'),_0x9b73('0x4b'),_0x9b73('0x4c'),_0x9b73('0x4d')]});}})[_0x9b73('0x16')](function(_0x4eb95a){if(_0x4eb95a){return{'count':_0x4eb95a[_0x9b73('0x12')],'rows':_[_0x9b73('0x20')](_0x4eb95a['rows'],function(_0x15e9e9){return{'membername':_0x15e9e9['name'],'UserId':_0x15e9e9['id'],'queue_name':_0xbb3f86['name'],'ChatQueueId':_0xbb3f86['id'],'interface':util[_0x9b73('0x4e')](_0x9b73('0x4f'),'SIP',_0x15e9e9['name']),'penalty':0x0,'paused':_0x15e9e9['chatPause'],'createdAt':_0x15e9e9[_0x9b73('0x4d')],'updatedAt':_0x15e9e9[_0x9b73('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x765a31,_0x2443d7))[_0x9b73('0x37')](handleError(_0x765a31,null));};exports[_0x9b73('0x50')]=function(_0x55b3a1,_0x4fdbb6){var _0x521b1b={};var _0x1adc09={};var _0x505a4f;var _0x427b3c;return db[_0x9b73('0x27')][_0x9b73('0x42')]({'where':{'id':_0x55b3a1[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x4fdbb6,null))[_0x9b73('0x16')](function(_0x8e0fbd){if(_0x8e0fbd){_0x505a4f=_0x8e0fbd;_0x1adc09['model']=_[_0x9b73('0x43')](db['Team']['rawAttributes']);_0x1adc09[_0x9b73('0x29')]=_[_0x9b73('0x43')](_0x55b3a1['query']);_0x1adc09[_0x9b73('0x2d')]=_[_0x9b73('0x2e')](_0x1adc09[_0x9b73('0x2f')],_0x1adc09[_0x9b73('0x29')]);_0x521b1b[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x1adc09[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x30')]));_0x521b1b['attributes']=_0x521b1b[_0x9b73('0x31')]['length']?_0x521b1b[_0x9b73('0x31')]:_0x1adc09[_0x9b73('0x2f')];_0x521b1b[_0x9b73('0x51')]=qs['sort'](_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x46')]);_0x521b1b[_0x9b73('0x26')]=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x55b3a1[_0x9b73('0x29')],_0x1adc09[_0x9b73('0x2d')]));if(_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x52')]){_0x521b1b[_0x9b73('0x26')]=_[_0x9b73('0x34')](_0x521b1b[_0x9b73('0x26')],{'$or':_['map'](_0x521b1b[_0x9b73('0x31')],function(_0x1b6018){var _0x23c480={};_0x23c480[_0x1b6018]={'$like':'%'+_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x52')]+'%'};return _0x23c480;})});}_0x521b1b=_[_0x9b73('0x34')]({},_0x521b1b,_0x55b3a1[_0x9b73('0x35')]);return _0x505a4f[_0x9b73('0x50')](_0x521b1b);}})[_0x9b73('0x16')](function(_0x3571a9){if(_0x3571a9){_0x427b3c=_0x3571a9[_0x9b73('0x32')];if(!_0x55b3a1[_0x9b73('0x29')]['hasOwnProperty'](_0x9b73('0x53'))){_0x521b1b['limit']=qs[_0x9b73('0x11')](_0x55b3a1[_0x9b73('0x29')]['limit']);_0x521b1b[_0x9b73('0xf')]=qs['offset'](_0x55b3a1['query']['offset']);}return _0x505a4f['getTeams'](_0x521b1b);}})[_0x9b73('0x16')](function(_0x20a160){if(_0x20a160){return _0x20a160?{'count':_0x427b3c,'rows':_0x20a160}:null;}})['then'](respondWithResult(_0x4fdbb6,null))['catch'](handleError(_0x4fdbb6,null));};exports[_0x9b73('0x54')]=function(_0x1311e7,_0x3accee){var _0x424937=_0x1311e7['body'][_0x9b73('0x55')];return db['Team'][_0x9b73('0x2a')]({'where':{'id':_0x424937},'attributes':['id'],'include':[{'model':db[_0x9b73('0x49')],'as':_0x9b73('0x56'),'attributes':['id','name',_0x9b73('0x57'),_0x9b73('0x58'),_0x9b73('0x59')],'raw':!![]}]})[_0x9b73('0x16')](function(_0x10034c){if(_0x10034c){var _0x3cac4a=_[_0x9b73('0x5a')](_0x10034c,function(_0x174691){var _0x320b7e=_0x174691[_0x9b73('0x18')]({'plain':!![]});return _0x320b7e[_0x9b73('0x56')];});return db['ChatQueue'][_0x9b73('0x36')]({'where':{'id':_0x1311e7[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](function(_0x13783c){return db[_0x9b73('0x5b')][_0x9b73('0x5c')](function(_0x2cd54f){return _0x13783c[_0x9b73('0x54')](_0x424937,{'transaction':_0x2cd54f})[_0x9b73('0x16')](function(){return BPromise[_0x9b73('0x5d')](_0x3cac4a,function(_0x43349f){return db['UserChatQueue'][_0x9b73('0x5e')]({'where':{'UserId':_0x43349f['id'],'ChatQueueId':_0x1311e7[_0x9b73('0x2c')]['id']},'transaction':_0x2cd54f});});})[_0x9b73('0x16')](function(){_0x3cac4a['forEach'](function(_0x537327){socket[_0x9b73('0x5f')](_0x9b73('0x60'),{'UserId':_0x537327['id'],'ChatQueueId':_0x13783c['id']});});});});});}})[_0x9b73('0x16')](respondWithStatusCode(_0x3accee,null))[_0x9b73('0x37')](handleError(_0x3accee,null));};exports[_0x9b73('0x61')]=function(_0x2257ee,_0x27fab0){return db[_0x9b73('0x62')][_0x9b73('0x2a')]({'where':{'id':_0x2257ee['query'][_0x9b73('0x55')]},'attributes':['id'],'include':[{'model':db[_0x9b73('0x49')],'as':_0x9b73('0x56'),'attributes':['id'],'raw':!![]}]})[_0x9b73('0x16')](handleEntityNotFound(_0x27fab0,null))['then'](function(_0x36f049){var _0x480781=_['map'](_0x36f049,'id');var _0x52de91=[];var _0x5c3691=[];var _0x175533=squel[_0x9b73('0x63')]();_0x175533[_0x9b73('0x64')](_0x9b73('0x65'))['from']('team_has_chat_queues','tq')[_0x9b73('0x66')](_0x9b73('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9b73('0x68'),_0x2257ee[_0x9b73('0x2c')]['id']);for(var _0x4b211b=0x0;_0x4b211b<_0x36f049[_0x9b73('0x32')];_0x4b211b+=0x1){let _0x2683bb=_0x36f049[_0x4b211b];for(var _0x611874=0x0;_0x611874<_0x2683bb[_0x9b73('0x56')][_0x9b73('0x32')];_0x611874+=0x1){let _0x48e0d4=_0x2683bb[_0x9b73('0x56')][_0x611874];var _0x54749e=_0x175533[_0x9b73('0x69')]();_0x54749e[_0x9b73('0x26')](_0x9b73('0x6a'),_0x48e0d4['id']);_0x5c3691[_0x9b73('0x6b')](db[_0x9b73('0x5b')]['query'](_0x54749e[_0x9b73('0x6c')](),{'type':db[_0x9b73('0x5b')][_0x9b73('0x6d')][_0x9b73('0x6e')]})[_0x9b73('0x16')](function(_0x2f6649){if(_0x2f6649['length']===0x1){return _0x48e0d4['id'];}else{var _0x34e6a0=_[_0x9b73('0x6f')](_['map'](_0x2f6649,'TeamId'),function(_0x327cfa){return _[_0x9b73('0x70')](_0x480781,_0x327cfa);});if(_0x34e6a0){return _0x48e0d4['id'];}}}));}}return BPromise['all'](_0x5c3691)[_0x9b73('0x16')](function(_0x342315){_0x52de91=_(_0x52de91)[_0x9b73('0x71')](_0x342315)[_0x9b73('0x72')]()[_0x9b73('0x73')]();return db[_0x9b73('0x27')]['find']({'where':{'id':_0x2257ee[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](function(_0x32d5c0){return db[_0x9b73('0x5b')][_0x9b73('0x5c')](function(_0x38589f){return _0x32d5c0[_0x9b73('0x61')](_0x2257ee[_0x9b73('0x29')][_0x9b73('0x55')],{'transaction':_0x38589f})[_0x9b73('0x16')](function(){if(!_[_0x9b73('0x74')](_0x52de91)){return _0x32d5c0[_0x9b73('0x75')](_0x52de91,{'transaction':_0x38589f});}})['then'](function(){_0x52de91[_0x9b73('0x76')](function(_0x47c77c){socket['emit'](_0x9b73('0x77'),{'UserId':_0x47c77c,'ChatQueueId':_0x32d5c0['id']});});});});});});})[_0x9b73('0x16')](respondWithStatusCode(_0x27fab0,null))['catch'](handleError(_0x27fab0,null));};exports['addAgents']=function(_0x1a9084,_0x34567f){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x1a9084['params']['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x34567f,null))[_0x9b73('0x16')](function(_0x6c204e){if(_0x6c204e){return _0x6c204e[_0x9b73('0x78')](_0x1a9084[_0x9b73('0x39')]['ids'],_['omit'](_0x1a9084[_0x9b73('0x39')],[_0x9b73('0x55'),'id'])||{})[_0x9b73('0x79')](function(_0x2e8b9b){for(var _0x4b0712=0x0;_0x4b0712<_0x1a9084[_0x9b73('0x39')][_0x9b73('0x55')][_0x9b73('0x32')];_0x4b0712+=0x1){socket[_0x9b73('0x5f')](_0x9b73('0x60'),{'UserId':Number(_0x1a9084[_0x9b73('0x39')][_0x9b73('0x55')][_0x4b0712]),'ChatQueueId':Number(_0x1a9084[_0x9b73('0x2c')]['id'])});}return _0x2e8b9b;});}})[_0x9b73('0x16')](respondWithResult(_0x34567f,null))[_0x9b73('0x37')](handleError(_0x34567f,null));};exports['removeAgents']=function(_0x5c4909,_0x399ff2){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x5c4909[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x399ff2,null))['then'](function(_0x59b4fe){if(_0x59b4fe){return _0x59b4fe[_0x9b73('0x75')](_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')])[_0x9b73('0x16')](function(){if(_[_0x9b73('0x7a')](_0x5c4909[_0x9b73('0x29')]['ids'])){for(var _0x94db3a=0x0;_0x94db3a<_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')][_0x9b73('0x32')];_0x94db3a+=0x1){socket[_0x9b73('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x5c4909[_0x9b73('0x29')]['ids'][_0x94db3a]),'ChatQueueId':Number(_0x5c4909[_0x9b73('0x2c')]['id'])});}}else{socket[_0x9b73('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')]),'ChatQueueId':Number(_0x5c4909[_0x9b73('0x2c')]['id'])});}});}})[_0x9b73('0x16')](respondWithStatusCode(_0x399ff2,null))[_0x9b73('0x37')](handleError(_0x399ff2,null));};exports[_0x9b73('0x7b')]=function(_0x38ca45,_0x2c9b19){var _0x3b709b={};var _0x2388bc={};var _0x49d4fa;var _0x36c083;return db[_0x9b73('0x27')]['findOne']({'where':{'id':_0x38ca45[_0x9b73('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c9b19,null))[_0x9b73('0x16')](function(_0x4e06e7){if(_0x4e06e7){_0x49d4fa=_0x4e06e7;_0x2388bc[_0x9b73('0x2f')]=_[_0x9b73('0x43')](db['User'][_0x9b73('0x21')]);_0x2388bc[_0x9b73('0x29')]=_['keys'](_0x38ca45[_0x9b73('0x29')]);_0x2388bc[_0x9b73('0x2d')]=_['intersection'](_0x2388bc[_0x9b73('0x2f')],_0x2388bc[_0x9b73('0x29')]);_0x3b709b[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x2388bc[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x38ca45[_0x9b73('0x29')]['fields']));_0x3b709b[_0x9b73('0x31')]=_0x3b709b[_0x9b73('0x31')]['length']?_0x3b709b[_0x9b73('0x31')]:_0x2388bc[_0x9b73('0x2f')];_0x3b709b[_0x9b73('0x51')]=qs[_0x9b73('0x46')](_0x38ca45['query'][_0x9b73('0x46')]);_0x3b709b['where']=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x38ca45[_0x9b73('0x29')],_0x2388bc[_0x9b73('0x2d')]));if(_0x38ca45[_0x9b73('0x29')][_0x9b73('0x52')]){_0x3b709b[_0x9b73('0x26')]=_[_0x9b73('0x34')](_0x3b709b[_0x9b73('0x26')],{'$or':_[_0x9b73('0x20')](_0x3b709b['attributes'],function(_0x24bbe6){var _0x470796={};_0x470796[_0x24bbe6]={'$like':'%'+_0x38ca45['query']['filter']+'%'};return _0x470796;})});}_0x3b709b=_[_0x9b73('0x34')]({},_0x3b709b,_0x38ca45[_0x9b73('0x35')]);return _0x49d4fa['getAgents'](_0x3b709b);}})['then'](function(_0x5c46e0){if(_0x5c46e0){_0x36c083=_0x5c46e0[_0x9b73('0x32')];if(!_0x38ca45['query']['hasOwnProperty'](_0x9b73('0x53'))){_0x3b709b[_0x9b73('0x11')]=qs['limit'](_0x38ca45['query'][_0x9b73('0x11')]);_0x3b709b[_0x9b73('0xf')]=qs[_0x9b73('0xf')](_0x38ca45[_0x9b73('0x29')][_0x9b73('0xf')]);}return _0x49d4fa[_0x9b73('0x7b')](_0x3b709b);}})['then'](function(_0x49c08c){if(_0x49c08c){return _0x49c08c?{'count':_0x36c083,'rows':_0x49c08c}:null;}})[_0x9b73('0x16')](respondWithResult(_0x2c9b19,null))[_0x9b73('0x37')](handleError(_0x2c9b19,null));}; \ No newline at end of file +var _0x414e=['removeAgents','addAgents','omit','spread','userChatQueue:remove','getAgents','order','pick','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','then','get','ChatQueues','UserProfileResource','destroy','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','getOptions','include','query','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','limit','sort','filters','where','ChatQueueId','filter','User','UserId','createdAt','format','SIP','chatPause','Team','nolimit','getTeams','addTeams','ids','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','includes','all','union','compact','isEmpty'];(function(_0x50183e,_0xdf79c1){var _0x289ae3=function(_0x316978){while(--_0x316978){_0x50183e['push'](_0x50183e['shift']());}};_0x289ae3(++_0xdf79c1);}(_0x414e,0x83));var _0xe414=function(_0x115cd8,_0x20557d){_0x115cd8=_0x115cd8-0x0;var _0x33f9eb=_0x414e[_0x115cd8];return _0x33f9eb;};'use strict';var BPromise=require(_0xe414('0x0'));var util=require(_0xe414('0x1'));var _=require(_0xe414('0x2'));var squel=require('squel');var Redis=require(_0xe414('0x3'));var qs=require(_0xe414('0x4'));var logger=require(_0xe414('0x5'))(_0xe414('0x6'));var config=require('../../config/environment');var db=require(_0xe414('0x7'))['db'];config[_0xe414('0x8')]=_[_0xe414('0x9')](config['redis'],{'host':_0xe414('0xa'),'port':0x18eb});var socket=require(_0xe414('0xb'))(new Redis(config[_0xe414('0x8')]));require('./chatQueue.socket')[_0xe414('0xc')](socket);function respondWithStatusCode(_0x5ef285,_0x110a9a){_0x110a9a=_0x110a9a||0xcc;return function(_0x102b9d){if(_0x102b9d){return _0x5ef285[_0xe414('0xd')](_0x110a9a);}return _0x5ef285[_0xe414('0xe')](_0x110a9a)[_0xe414('0xf')]();};}function respondWithResult(_0x2fdbd2,_0x308e80){_0x308e80=_0x308e80||0xc8;return function(_0x5b2eb0){if(_0x5b2eb0){return _0x2fdbd2[_0xe414('0xe')](_0x308e80)['json'](_0x5b2eb0);}};}function respondWithFilteredResult(_0x5d26d8,_0x31a190){return function(_0x1a8995){if(_0x1a8995){var _0x22b1d4=typeof _0x31a190[_0xe414('0x10')]===_0xe414('0x11')&&typeof _0x31a190['limit']===_0xe414('0x11');var _0x80720c=_0x1a8995[_0xe414('0x12')];var _0x25986f=_0x22b1d4?0x0:_0x31a190[_0xe414('0x10')];var _0x453d14=_0x22b1d4?_0x1a8995[_0xe414('0x12')]:_0x31a190[_0xe414('0x10')]+_0x31a190['limit'];var _0x369dce;if(_0x453d14>=_0x80720c){_0x453d14=_0x80720c;_0x369dce=0xc8;}else{_0x369dce=0xce;}_0x5d26d8[_0xe414('0xe')](_0x369dce);return _0x5d26d8[_0xe414('0x13')](_0xe414('0x14'),_0x25986f+'-'+_0x453d14+'/'+_0x80720c)[_0xe414('0x15')](_0x1a8995);}return null;};}function saveUpdates(_0x50a4c4){return function(_0x34847d){if(_0x34847d){return _0x34847d[_0xe414('0x16')](_0x50a4c4)[_0xe414('0x17')](function(_0x9fcaf5){return _0x9fcaf5;});}return null;};}function removeEntity(_0x271341){return function(_0x1ece2e){if(_0x1ece2e){return _0x1ece2e['destroy']()[_0xe414('0x17')](function(){var _0x5cc477=_0x1ece2e[_0xe414('0x18')]({'plain':!![]});var _0x4a4324=_0xe414('0x19');return db[_0xe414('0x1a')][_0xe414('0x1b')]({'where':{'type':_0x4a4324,'resourceId':_0x5cc477['id']}})['then'](function(){return _0x1ece2e;});})[_0xe414('0x17')](function(){_0x271341[_0xe414('0xe')](0xcc)[_0xe414('0xf')]();});}};}function handleEntityNotFound(_0x2400a5){return function(_0x41a169){if(!_0x41a169){_0x2400a5['sendStatus'](0x194);}return _0x41a169;};}function handleError(_0x669617,_0x5414f2){_0x5414f2=_0x5414f2||0x1f4;return function(_0x3ace51){logger[_0xe414('0x1c')](_0x3ace51[_0xe414('0x1d')]);if(_0x3ace51[_0xe414('0x1e')]){delete _0x3ace51['name'];}_0x669617['status'](_0x5414f2)[_0xe414('0x1f')](_0x3ace51);};}exports[_0xe414('0x20')]=function(_0x8dd75f,_0x2fbb3f){var _0x3b7a66={};var _0x35f844={'count':0x0,'rows':[]};var _0x2d73e0=_[_0xe414('0x21')](db[_0xe414('0x22')][_0xe414('0x23')],function(_0x844f52){return{'name':_0x844f52[_0xe414('0x24')],'type':_0x844f52['type'][_0xe414('0x25')]};});_0x3b7a66=qs[_0xe414('0x26')](_0x2d73e0,_0x8dd75f);var _0x52feee={'where':_0x3b7a66['where']};return db[_0xe414('0x22')]['count'](_0x52feee)[_0xe414('0x17')](function(_0x3d1e5d){_0x35f844[_0xe414('0x12')]=_0x3d1e5d;_0x3b7a66[_0xe414('0x27')]=qs['include'](_0x8dd75f[_0xe414('0x28')]);return db[_0xe414('0x22')]['findAll'](_0x3b7a66);})[_0xe414('0x17')](function(_0x205c0d){_0x35f844[_0xe414('0x29')]=_0x205c0d;return _0x35f844;})[_0xe414('0x17')](respondWithFilteredResult(_0x2fbb3f,_0x3b7a66))[_0xe414('0x2a')](handleError(_0x2fbb3f,null));};exports[_0xe414('0x2b')]=function(_0x25f597,_0x8046f0){var _0x40877f={'raw':!![],'where':{'id':_0x25f597[_0xe414('0x2c')]['id']}},_0x4e07a7={};_0x4e07a7[_0xe414('0x2d')]=_[_0xe414('0x2e')](db[_0xe414('0x22')][_0xe414('0x23')]);_0x4e07a7['query']=_[_0xe414('0x2e')](_0x25f597['query']);_0x4e07a7['filters']=_[_0xe414('0x2f')](_0x4e07a7[_0xe414('0x2d')],_0x4e07a7[_0xe414('0x28')]);_0x40877f[_0xe414('0x30')]=_['intersection'](_0x4e07a7[_0xe414('0x2d')],qs['fields'](_0x25f597['query'][_0xe414('0x31')]));_0x40877f[_0xe414('0x30')]=_0x40877f[_0xe414('0x30')][_0xe414('0x32')]?_0x40877f[_0xe414('0x30')]:_0x4e07a7['model'];if(_0x25f597[_0xe414('0x28')][_0xe414('0x33')]){_0x40877f[_0xe414('0x27')]=[{'all':!![]}];}_0x40877f=_[_0xe414('0x34')]({},_0x40877f,_0x25f597[_0xe414('0x35')]);return db[_0xe414('0x22')][_0xe414('0x36')](_0x40877f)['then'](handleEntityNotFound(_0x8046f0,null))[_0xe414('0x17')](respondWithResult(_0x8046f0,null))['catch'](handleError(_0x8046f0,null));};exports[_0xe414('0x37')]=function(_0x5d1c53,_0x440a51){return db[_0xe414('0x22')][_0xe414('0x37')](_0x5d1c53[_0xe414('0x38')],{})[_0xe414('0x17')](function(_0x7908d1){var _0x524e75=_0x5d1c53[_0xe414('0x39')][_0xe414('0x18')]({'plain':!![]});if(!_0x524e75)throw new Error(_0xe414('0x3a'));if(_0x524e75[_0xe414('0x3b')]===_0xe414('0x39')){var _0x131d03=_0x7908d1[_0xe414('0x18')]({'plain':!![]});var _0x5c6cab='ChatQueues';return db[_0xe414('0x3c')]['find']({'where':{'name':_0x5c6cab,'userProfileId':_0x524e75[_0xe414('0x3d')]},'raw':!![]})[_0xe414('0x17')](function(_0x5034c7){if(_0x5034c7&&_0x5034c7[_0xe414('0x3e')]===0x0){return db[_0xe414('0x1a')]['create']({'name':_0x131d03[_0xe414('0x1e')],'resourceId':_0x131d03['id'],'type':_0x5034c7[_0xe414('0x1e')],'sectionId':_0x5034c7['id']},{})[_0xe414('0x17')](function(){return _0x7908d1;});}else{return _0x7908d1;}})['catch'](function(_0x440b95){logger[_0xe414('0x1c')](_0xe414('0x3f'),_0x440b95);throw _0x440b95;});}return _0x7908d1;})[_0xe414('0x17')](respondWithResult(_0x440a51,0xc9))['catch'](handleError(_0x440a51,null));};exports[_0xe414('0x16')]=function(_0x3f8e5e,_0x1e953e){if(_0x3f8e5e['body']['id']){delete _0x3f8e5e[_0xe414('0x38')]['id'];}return db['ChatQueue'][_0xe414('0x36')]({'where':{'id':_0x3f8e5e['params']['id']}})[_0xe414('0x17')](handleEntityNotFound(_0x1e953e,null))[_0xe414('0x17')](saveUpdates(_0x3f8e5e[_0xe414('0x38')],null))[_0xe414('0x17')](respondWithResult(_0x1e953e,null))[_0xe414('0x2a')](handleError(_0x1e953e,null));};exports[_0xe414('0x1b')]=function(_0x4a9e29,_0x304237){return db[_0xe414('0x22')]['find']({'where':{'id':_0x4a9e29[_0xe414('0x2c')]['id']}})['then'](handleEntityNotFound(_0x304237,null))[_0xe414('0x17')](removeEntity(_0x304237,null))[_0xe414('0x2a')](handleError(_0x304237,null));};exports['describe']=function(_0x334c87,_0xb6a01f){return db[_0xe414('0x22')][_0xe414('0x40')]()[_0xe414('0x17')](respondWithResult(_0xb6a01f,null))[_0xe414('0x2a')](handleError(_0xb6a01f,null));};exports[_0xe414('0x41')]=function(_0x27a62d,_0x4e78da){var _0xa4b788={'raw':!![],'where':{}},_0x732685={},_0x3942b0;return db[_0xe414('0x22')][_0xe414('0x42')]({'where':{'id':_0x27a62d[_0xe414('0x2c')]['id']}})[_0xe414('0x17')](handleEntityNotFound(_0x4e78da,null))[_0xe414('0x17')](function(_0x2c9780){if(_0x2c9780){_0x3942b0=_0x2c9780[_0xe414('0x18')]({'plain':!![]});_0x732685[_0xe414('0x2d')]=_[_0xe414('0x2e')](db[_0xe414('0x43')][_0xe414('0x23')]);_0x732685[_0xe414('0x28')]=_['keys'](_0x27a62d['query']);_0x732685['filters']=_[_0xe414('0x2f')](_0x732685[_0xe414('0x2d')],_0x732685[_0xe414('0x28')]);_0xa4b788[_0xe414('0x30')]=_[_0xe414('0x2f')](_0x732685[_0xe414('0x2d')],qs[_0xe414('0x31')](_0x27a62d[_0xe414('0x28')][_0xe414('0x31')]));_0xa4b788[_0xe414('0x30')]=_0xa4b788[_0xe414('0x30')][_0xe414('0x32')]?_0xa4b788[_0xe414('0x30')]:_0x732685[_0xe414('0x2d')];if(!_0x27a62d[_0xe414('0x28')][_0xe414('0x44')]('nolimit')){_0xa4b788[_0xe414('0x45')]=qs[_0xe414('0x45')](_0x27a62d[_0xe414('0x28')][_0xe414('0x45')]);_0xa4b788[_0xe414('0x10')]=qs['offset'](_0x27a62d[_0xe414('0x28')][_0xe414('0x10')]);}_0xa4b788['order']=qs['sort'](_0x27a62d[_0xe414('0x28')][_0xe414('0x46')]);_0xa4b788['where']=qs[_0xe414('0x47')](_['pick'](_0x27a62d[_0xe414('0x28')],_0x732685[_0xe414('0x47')]));_0xa4b788[_0xe414('0x48')][_0xe414('0x49')]=_0x2c9780['id'];if(_0x27a62d[_0xe414('0x28')]['filter']){_0xa4b788[_0xe414('0x48')]=_[_0xe414('0x34')](_0xa4b788[_0xe414('0x48')],{'$or':_[_0xe414('0x21')](_0xa4b788['attributes'],function(_0x59a001){var _0x2dd265={};_0x2dd265[_0x59a001]={'$like':'%'+_0x27a62d[_0xe414('0x28')][_0xe414('0x4a')]+'%'};return _0x2dd265;})});}_0xa4b788=_[_0xe414('0x34')]({},_0xa4b788,_0x27a62d[_0xe414('0x35')]);return db[_0xe414('0x43')]['findAll'](_0xa4b788);}})['then'](function(_0x4256c3){if(_0x4256c3){return db[_0xe414('0x4b')]['findAndCountAll']({'where':{'id':_[_0xe414('0x21')](_0x4256c3,_0xe414('0x4c')),'role':'agent'},'attributes':['id',_0xe414('0x1e'),'chatPause','updatedAt',_0xe414('0x4d')]});}})[_0xe414('0x17')](function(_0x31c413){if(_0x31c413){return{'count':_0x31c413['count'],'rows':_[_0xe414('0x21')](_0x31c413[_0xe414('0x29')],function(_0x36e522){return{'membername':_0x36e522[_0xe414('0x1e')],'UserId':_0x36e522['id'],'queue_name':_0x3942b0[_0xe414('0x1e')],'ChatQueueId':_0x3942b0['id'],'interface':util[_0xe414('0x4e')]('%s/%s',_0xe414('0x4f'),_0x36e522['name']),'penalty':0x0,'paused':_0x36e522[_0xe414('0x50')],'createdAt':_0x36e522[_0xe414('0x4d')],'updatedAt':_0x36e522['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e78da,_0xa4b788))[_0xe414('0x2a')](handleError(_0x4e78da,null));};exports['getTeams']=function(_0x5757e9,_0x273c00){var _0x57400f={};var _0x3ace0d={};var _0x68c1bc;var _0x4b9129;return db[_0xe414('0x22')][_0xe414('0x42')]({'where':{'id':_0x5757e9[_0xe414('0x2c')]['id']}})['then'](handleEntityNotFound(_0x273c00,null))[_0xe414('0x17')](function(_0x2911b){if(_0x2911b){_0x68c1bc=_0x2911b;_0x3ace0d[_0xe414('0x2d')]=_['keys'](db[_0xe414('0x51')][_0xe414('0x23')]);_0x3ace0d[_0xe414('0x28')]=_[_0xe414('0x2e')](_0x5757e9[_0xe414('0x28')]);_0x3ace0d[_0xe414('0x47')]=_['intersection'](_0x3ace0d[_0xe414('0x2d')],_0x3ace0d['query']);_0x57400f[_0xe414('0x30')]=_[_0xe414('0x2f')](_0x3ace0d['model'],qs[_0xe414('0x31')](_0x5757e9[_0xe414('0x28')]['fields']));_0x57400f[_0xe414('0x30')]=_0x57400f[_0xe414('0x30')][_0xe414('0x32')]?_0x57400f[_0xe414('0x30')]:_0x3ace0d['model'];_0x57400f['order']=qs[_0xe414('0x46')](_0x5757e9[_0xe414('0x28')]['sort']);_0x57400f[_0xe414('0x48')]=qs[_0xe414('0x47')](_['pick'](_0x5757e9[_0xe414('0x28')],_0x3ace0d[_0xe414('0x47')]));if(_0x5757e9[_0xe414('0x28')][_0xe414('0x4a')]){_0x57400f[_0xe414('0x48')]=_[_0xe414('0x34')](_0x57400f['where'],{'$or':_['map'](_0x57400f[_0xe414('0x30')],function(_0x42f6a7){var _0x48fbdb={};_0x48fbdb[_0x42f6a7]={'$like':'%'+_0x5757e9['query'][_0xe414('0x4a')]+'%'};return _0x48fbdb;})});}_0x57400f=_[_0xe414('0x34')]({},_0x57400f,_0x5757e9[_0xe414('0x35')]);return _0x68c1bc['getTeams'](_0x57400f);}})[_0xe414('0x17')](function(_0x28bce0){if(_0x28bce0){_0x4b9129=_0x28bce0[_0xe414('0x32')];if(!_0x5757e9[_0xe414('0x28')]['hasOwnProperty'](_0xe414('0x52'))){_0x57400f[_0xe414('0x45')]=qs['limit'](_0x5757e9[_0xe414('0x28')][_0xe414('0x45')]);_0x57400f[_0xe414('0x10')]=qs[_0xe414('0x10')](_0x5757e9[_0xe414('0x28')]['offset']);}return _0x68c1bc[_0xe414('0x53')](_0x57400f);}})[_0xe414('0x17')](function(_0xca45fb){if(_0xca45fb){return _0xca45fb?{'count':_0x4b9129,'rows':_0xca45fb}:null;}})[_0xe414('0x17')](respondWithResult(_0x273c00,null))[_0xe414('0x2a')](handleError(_0x273c00,null));};exports[_0xe414('0x54')]=function(_0x10f533,_0x2d6872){var _0x1236ac=_0x10f533[_0xe414('0x38')][_0xe414('0x55')];return db[_0xe414('0x51')][_0xe414('0x56')]({'where':{'id':_0x1236ac},'attributes':['id'],'include':[{'model':db[_0xe414('0x4b')],'as':_0xe414('0x57'),'attributes':['id','name',_0xe414('0x58'),'voicePause','interface'],'raw':!![]}]})[_0xe414('0x17')](function(_0x4d056a){if(_0x4d056a){var _0x50b495=_[_0xe414('0x59')](_0x4d056a,function(_0x2a9ce8){var _0x48ce6a=_0x2a9ce8[_0xe414('0x18')]({'plain':!![]});return _0x48ce6a[_0xe414('0x57')];});return db[_0xe414('0x22')]['find']({'where':{'id':_0x10f533[_0xe414('0x2c')]['id']}})[_0xe414('0x17')](function(_0x1d9502){return db[_0xe414('0x5a')][_0xe414('0x5b')](function(_0x29725c){return _0x1d9502['addTeams'](_0x1236ac,{'transaction':_0x29725c})[_0xe414('0x17')](function(){return BPromise[_0xe414('0x5c')](_0x50b495,function(_0x213509){return db[_0xe414('0x43')][_0xe414('0x5d')]({'where':{'UserId':_0x213509['id'],'ChatQueueId':_0x10f533[_0xe414('0x2c')]['id']},'transaction':_0x29725c});});})[_0xe414('0x17')](function(){_0x50b495[_0xe414('0x5e')](function(_0x30af52){socket[_0xe414('0x5f')](_0xe414('0x60'),{'UserId':_0x30af52['id'],'ChatQueueId':_0x1d9502['id']});});});});});}})[_0xe414('0x17')](respondWithStatusCode(_0x2d6872,null))[_0xe414('0x2a')](handleError(_0x2d6872,null));};exports[_0xe414('0x61')]=function(_0x38c603,_0x8d716f){return db['Team'][_0xe414('0x56')]({'where':{'id':_0x38c603['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe414('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe414('0x17')](handleEntityNotFound(_0x8d716f,null))[_0xe414('0x17')](function(_0x16ae6f){var _0x37bdc2=_[_0xe414('0x21')](_0x16ae6f,'id');var _0x280c55=[];var _0x4646f0=[];var _0x16c74a=squel[_0xe414('0x62')]();_0x16c74a[_0xe414('0x63')](_0xe414('0x64'))[_0xe414('0x65')](_0xe414('0x66'),'tq')[_0xe414('0x67')](_0xe414('0x68'),'ut',_0xe414('0x69'))[_0xe414('0x48')](_0xe414('0x6a'),_0x38c603[_0xe414('0x2c')]['id']);for(var _0x3ca8ee=0x0;_0x3ca8ee<_0x16ae6f[_0xe414('0x32')];_0x3ca8ee+=0x1){let _0x583d49=_0x16ae6f[_0x3ca8ee];for(var _0xd0a01b=0x0;_0xd0a01b<_0x583d49[_0xe414('0x57')][_0xe414('0x32')];_0xd0a01b+=0x1){let _0x19e9fc=_0x583d49[_0xe414('0x57')][_0xd0a01b];var _0x154d02=_0x16c74a[_0xe414('0x6b')]();_0x154d02[_0xe414('0x48')]('ut.UserId\x20=\x20?',_0x19e9fc['id']);_0x4646f0['push'](db[_0xe414('0x5a')][_0xe414('0x28')](_0x154d02[_0xe414('0x6c')](),{'type':db['sequelize'][_0xe414('0x6d')]['SELECT']})[_0xe414('0x17')](function(_0x47dccc){if(_0x47dccc[_0xe414('0x32')]===0x1){return _0x19e9fc['id'];}else{var _0x19905c=_['every'](_[_0xe414('0x21')](_0x47dccc,'TeamId'),function(_0x33e176){return _[_0xe414('0x6e')](_0x37bdc2,_0x33e176);});if(_0x19905c){return _0x19e9fc['id'];}}}));}}return BPromise[_0xe414('0x6f')](_0x4646f0)[_0xe414('0x17')](function(_0x76809f){_0x280c55=_(_0x280c55)[_0xe414('0x70')](_0x76809f)[_0xe414('0x71')]()['value']();return db[_0xe414('0x22')][_0xe414('0x36')]({'where':{'id':_0x38c603[_0xe414('0x2c')]['id']}})[_0xe414('0x17')](function(_0x25dbd8){return db[_0xe414('0x5a')][_0xe414('0x5b')](function(_0x1f9481){return _0x25dbd8[_0xe414('0x61')](_0x38c603['query'][_0xe414('0x55')],{'transaction':_0x1f9481})[_0xe414('0x17')](function(){if(!_[_0xe414('0x72')](_0x280c55)){return _0x25dbd8[_0xe414('0x73')](_0x280c55,{'transaction':_0x1f9481});}})[_0xe414('0x17')](function(){_0x280c55[_0xe414('0x5e')](function(_0x5b44d7){socket[_0xe414('0x5f')]('userChatQueue:remove',{'UserId':_0x5b44d7,'ChatQueueId':_0x25dbd8['id']});});});});});});})[_0xe414('0x17')](respondWithStatusCode(_0x8d716f,null))[_0xe414('0x2a')](handleError(_0x8d716f,null));};exports[_0xe414('0x74')]=function(_0x1b04a1,_0x584b4a){return db['ChatQueue']['find']({'where':{'id':_0x1b04a1['params']['id']}})[_0xe414('0x17')](handleEntityNotFound(_0x584b4a,null))[_0xe414('0x17')](function(_0xf37533){if(_0xf37533){return _0xf37533[_0xe414('0x74')](_0x1b04a1[_0xe414('0x38')][_0xe414('0x55')],_[_0xe414('0x75')](_0x1b04a1[_0xe414('0x38')],['ids','id'])||{})[_0xe414('0x76')](function(_0x9efefa){for(var _0x4b70d9=0x0;_0x4b70d9<_0x1b04a1['body'][_0xe414('0x55')][_0xe414('0x32')];_0x4b70d9+=0x1){socket[_0xe414('0x5f')]('userChatQueue:save',{'UserId':Number(_0x1b04a1[_0xe414('0x38')]['ids'][_0x4b70d9]),'ChatQueueId':Number(_0x1b04a1['params']['id'])});}return _0x9efefa;});}})[_0xe414('0x17')](respondWithResult(_0x584b4a,null))[_0xe414('0x2a')](handleError(_0x584b4a,null));};exports[_0xe414('0x73')]=function(_0x14f2a4,_0x51dbff){return db[_0xe414('0x22')][_0xe414('0x36')]({'where':{'id':_0x14f2a4[_0xe414('0x2c')]['id']}})[_0xe414('0x17')](handleEntityNotFound(_0x51dbff,null))[_0xe414('0x17')](function(_0x951e31){if(_0x951e31){return _0x951e31[_0xe414('0x73')](_0x14f2a4[_0xe414('0x28')][_0xe414('0x55')])[_0xe414('0x17')](function(){if(_['isArray'](_0x14f2a4[_0xe414('0x28')][_0xe414('0x55')])){for(var _0x32dd04=0x0;_0x32dd04<_0x14f2a4[_0xe414('0x28')][_0xe414('0x55')][_0xe414('0x32')];_0x32dd04+=0x1){socket[_0xe414('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x14f2a4[_0xe414('0x28')]['ids'][_0x32dd04]),'ChatQueueId':Number(_0x14f2a4[_0xe414('0x2c')]['id'])});}}else{socket['emit'](_0xe414('0x77'),{'UserId':Number(_0x14f2a4[_0xe414('0x28')][_0xe414('0x55')]),'ChatQueueId':Number(_0x14f2a4[_0xe414('0x2c')]['id'])});}});}})[_0xe414('0x17')](respondWithStatusCode(_0x51dbff,null))[_0xe414('0x2a')](handleError(_0x51dbff,null));};exports[_0xe414('0x78')]=function(_0x519e1d,_0xe4f952){var _0x9bf76d={};var _0x524a6b={};var _0x33e9cc;var _0x39cc66;return db[_0xe414('0x22')][_0xe414('0x42')]({'where':{'id':_0x519e1d[_0xe414('0x2c')]['id']}})[_0xe414('0x17')](handleEntityNotFound(_0xe4f952,null))[_0xe414('0x17')](function(_0x3b410b){if(_0x3b410b){_0x33e9cc=_0x3b410b;_0x524a6b['model']=_[_0xe414('0x2e')](db[_0xe414('0x4b')][_0xe414('0x23')]);_0x524a6b[_0xe414('0x28')]=_[_0xe414('0x2e')](_0x519e1d['query']);_0x524a6b['filters']=_[_0xe414('0x2f')](_0x524a6b['model'],_0x524a6b[_0xe414('0x28')]);_0x9bf76d[_0xe414('0x30')]=_[_0xe414('0x2f')](_0x524a6b[_0xe414('0x2d')],qs['fields'](_0x519e1d['query'][_0xe414('0x31')]));_0x9bf76d[_0xe414('0x30')]=_0x9bf76d[_0xe414('0x30')][_0xe414('0x32')]?_0x9bf76d['attributes']:_0x524a6b[_0xe414('0x2d')];_0x9bf76d[_0xe414('0x79')]=qs[_0xe414('0x46')](_0x519e1d['query'][_0xe414('0x46')]);_0x9bf76d[_0xe414('0x48')]=qs[_0xe414('0x47')](_[_0xe414('0x7a')](_0x519e1d[_0xe414('0x28')],_0x524a6b['filters']));if(_0x519e1d[_0xe414('0x28')][_0xe414('0x4a')]){_0x9bf76d[_0xe414('0x48')]=_[_0xe414('0x34')](_0x9bf76d[_0xe414('0x48')],{'$or':_[_0xe414('0x21')](_0x9bf76d[_0xe414('0x30')],function(_0x2302b8){var _0x1a1aae={};_0x1a1aae[_0x2302b8]={'$like':'%'+_0x519e1d[_0xe414('0x28')]['filter']+'%'};return _0x1a1aae;})});}_0x9bf76d=_['merge']({},_0x9bf76d,_0x519e1d['options']);return _0x33e9cc[_0xe414('0x78')](_0x9bf76d);}})[_0xe414('0x17')](function(_0x263f2f){if(_0x263f2f){_0x39cc66=_0x263f2f[_0xe414('0x32')];if(!_0x519e1d['query'][_0xe414('0x44')](_0xe414('0x52'))){_0x9bf76d[_0xe414('0x45')]=qs[_0xe414('0x45')](_0x519e1d[_0xe414('0x28')][_0xe414('0x45')]);_0x9bf76d[_0xe414('0x10')]=qs[_0xe414('0x10')](_0x519e1d['query']['offset']);}return _0x33e9cc[_0xe414('0x78')](_0x9bf76d);}})[_0xe414('0x17')](function(_0x171b2b){if(_0x171b2b){return _0x171b2b?{'count':_0x39cc66,'rows':_0x171b2b}:null;}})['then'](respondWithResult(_0xe4f952,null))['catch'](handleError(_0xe4f952,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 4096b1c..f9cdd8b 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 _0x0627=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x0627,0x1d8));var _0x7062=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x0627[_0x3a7a9c];return _0x59156e;};'use strict';var EventEmitter=require(_0x7062('0x0'));var ChatQueue=require(_0x7062('0x1'))['db'][_0x7062('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7062('0x3')](0x0);var events={'afterCreate':_0x7062('0x4'),'afterUpdate':_0x7062('0x5'),'afterDestroy':_0x7062('0x6')};function emitEvent(_0xf63df){return function(_0x21b92d,_0xb17aab,_0x73d82a){ChatQueueEvents['emit'](_0xf63df+':'+_0x21b92d['id'],_0x21b92d);ChatQueueEvents[_0x7062('0x7')](_0xf63df,_0x21b92d);_0x73d82a(null);};}for(var e in events){if(events[_0x7062('0x8')](e)){var event=events[e];ChatQueue[_0x7062('0x9')](e,emitEvent(event));}}module[_0x7062('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xa728=['hook','exports','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa728,0xb2));var _0x8a72=function(_0x1c876e,_0x13fb5e){_0x1c876e=_0x1c876e-0x0;var _0x1e73c7=_0xa728[_0x1c876e];return _0x1e73c7;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x8a72('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8a72('0x1')](0x0);var events={'afterCreate':_0x8a72('0x2'),'afterUpdate':_0x8a72('0x3'),'afterDestroy':_0x8a72('0x4')};function emitEvent(_0x4af42e){return function(_0x3806bb,_0x35df15,_0x32ab32){ChatQueueEvents[_0x8a72('0x5')](_0x4af42e+':'+_0x3806bb['id'],_0x3806bb);ChatQueueEvents[_0x8a72('0x5')](_0x4af42e,_0x3806bb);_0x32ab32(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x8a72('0x6')](e,emitEvent(event));}}module[_0x8a72('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 20a1e95..ee9b852 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 _0x70ff=['moment','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0xc25cc1,_0x2a9daa){var _0x544044=function(_0x347750){while(--_0x347750){_0xc25cc1['push'](_0xc25cc1['shift']());}};_0x544044(++_0x2a9daa);}(_0x70ff,0xef));var _0xf70f=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x70ff[_0x1c72b8];return _0x191114;};'use strict';var _=require('lodash');var util=require(_0xf70f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf70f('0x1'));var BPromise=require('bluebird');var rp=require(_0xf70f('0x2'));var fs=require('fs');var path=require(_0xf70f('0x3'));var rimraf=require('rimraf');var config=require(_0xf70f('0x4'));var attributes=require(_0xf70f('0x5'));module[_0xf70f('0x6')]=function(_0x2d256b,_0x5a010f){return _0x2d256b[_0xf70f('0x7')](_0xf70f('0x8'),attributes,{'tableName':_0xf70f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5172=['exports','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatQueue.attributes'];(function(_0x2cce87,_0x5dcf95){var _0x4cb9a5=function(_0x1e31ae){while(--_0x1e31ae){_0x2cce87['push'](_0x2cce87['shift']());}};_0x4cb9a5(++_0x5dcf95);}(_0x5172,0x1e7));var _0x2517=function(_0x3b2f34,_0x31bbf5){_0x3b2f34=_0x3b2f34-0x0;var _0x10a82d=_0x5172[_0x3b2f34];return _0x10a82d;};'use strict';var _=require('lodash');var util=require(_0x2517('0x0'));var logger=require(_0x2517('0x1'))(_0x2517('0x2'));var moment=require(_0x2517('0x3'));var BPromise=require(_0x2517('0x4'));var rp=require(_0x2517('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2517('0x6'));var attributes=require(_0x2517('0x7'));module[_0x2517('0x8')]=function(_0x363df2,_0xfa480f){return _0x363df2['define'](_0x2517('0x9'),attributes,{'tableName':_0x2517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index a4191d8..19b5d8e 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 _0x3f48=['defaults','localhost','socket.io-emitter','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','include','map','model','debug','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x50bfe8,_0x4a9f3c){var _0x3991d3=function(_0x442b20){while(--_0x442b20){_0x50bfe8['push'](_0x50bfe8['shift']());}};_0x3991d3(++_0x4a9f3c);}(_0x3f48,0x17c));var _0x83f4=function(_0x164470,_0x12ae5c){_0x164470=_0x164470-0x0;var _0x1b1afc=_0x3f48[_0x164470];return _0x1b1afc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83f4('0x0'));var BPromise=require(_0x83f4('0x1'));var rs=require(_0x83f4('0x2'));var fs=require('fs');var Redis=require(_0x83f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f4('0x4'));var logger=require(_0x83f4('0x5'))('rpc');var config=require(_0x83f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83f4('0x7')][_0x83f4('0x8')]({'port':0x232a});config[_0x83f4('0x9')]=_[_0x83f4('0xa')](config[_0x83f4('0x9')],{'host':_0x83f4('0xb'),'port':0x18eb});var socket=require(_0x83f4('0xc'))(new Redis(config[_0x83f4('0x9')]));require('./chatQueue.socket')[_0x83f4('0xd')](socket);function respondWithRpcPromise(_0x3b0784,_0x177c28,_0x54c0c1){return new BPromise(function(_0x4cb8bb,_0x589cbe){return client[_0x83f4('0xe')](_0x3b0784,_0x54c0c1)[_0x83f4('0xf')](function(_0x74a994){logger['info'](_0x83f4('0x10'),_0x177c28,_0x83f4('0x11'));logger['debug'](_0x83f4('0x12'),_0x177c28,_0x83f4('0x11'),JSON[_0x83f4('0x13')](_0x74a994));if(_0x74a994[_0x83f4('0x14')]){if(_0x74a994[_0x83f4('0x14')][_0x83f4('0x15')]===0x1f4){logger[_0x83f4('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177c28,_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);return _0x589cbe(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x74a994['error'][_0x83f4('0x16')]);return _0x4cb8bb(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}else{logger[_0x83f4('0x17')](_0x83f4('0x10'),_0x177c28,'request\x20sent');_0x4cb8bb(_0x74a994[_0x83f4('0x18')]['message']);}})[_0x83f4('0x19')](function(_0x3b08d8){logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x3b08d8);_0x589cbe(_0x3b08d8);});});}exports[_0x83f4('0x1a')]=function(_0x9ef4a9){var _0x52452b=this;return new Promise(function(_0x79c248,_0x14575b){return db[_0x83f4('0x1b')][_0x83f4('0x1c')]({'raw':_0x9ef4a9['options']?_0x9ef4a9['options'][_0x83f4('0x1d')]===undefined?!![]:![]:!![],'where':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x1f')]||null:null,'attributes':_0x9ef4a9['options']?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x20')]||null:null,'limit':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')]['limit']||null:null,'include':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9['options'][_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x27623d){return{'model':db[_0x27623d[_0x83f4('0x23')]],'as':_0x27623d['as'],'attributes':_0x27623d[_0x83f4('0x20')],'include':_0x27623d[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x27623d[_0x83f4('0x21')],function(_0x3ab54d){return{'model':db[_0x3ab54d['model']],'as':_0x3ab54d['as'],'attributes':_0x3ab54d[_0x83f4('0x20')],'include':_0x3ab54d['include']?_['map'](_0x3ab54d[_0x83f4('0x21')],function(_0x5f17f5){return{'model':db[_0x5f17f5[_0x83f4('0x23')]],'as':_0x5f17f5['as'],'attributes':_0x5f17f5[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x5429fe){logger['info']('GetChatQueue',_0x9ef4a9);logger[_0x83f4('0x24')](_0x83f4('0x1a'),_0x9ef4a9,JSON[_0x83f4('0x13')](_0x5429fe));_0x79c248(_0x5429fe);})[_0x83f4('0x19')](function(_0x57fd72){logger[_0x83f4('0x14')](_0x83f4('0x1a'),_0x57fd72[_0x83f4('0x16')],_0x9ef4a9);_0x14575b(_0x52452b[_0x83f4('0x14')](0x1f4,_0x57fd72[_0x83f4('0x16')]));});});};exports[_0x83f4('0x25')]=function(_0x37956b){var _0x162f06=this;return new Promise(function(_0x5ca9bc,_0x203d08){return db['ChatQueue'][_0x83f4('0x26')]({'raw':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x37956b[_0x83f4('0x1e')]?_0x37956b[_0x83f4('0x1e')]['where']||null:null,'attributes':_0x37956b[_0x83f4('0x1e')]?_0x37956b['options'][_0x83f4('0x20')]||null:null,'include':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['include']?_[_0x83f4('0x22')](_0x37956b[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x1871e1){return{'model':db[_0x1871e1[_0x83f4('0x23')]],'as':_0x1871e1['as'],'attributes':_0x1871e1[_0x83f4('0x20')],'include':_0x1871e1['include']?_[_0x83f4('0x22')](_0x1871e1[_0x83f4('0x21')],function(_0x3e2d5f){return{'model':db[_0x3e2d5f[_0x83f4('0x23')]],'as':_0x3e2d5f['as'],'attributes':_0x3e2d5f[_0x83f4('0x20')],'include':_0x3e2d5f[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x3e2d5f[_0x83f4('0x21')],function(_0x239c41){return{'model':db[_0x239c41[_0x83f4('0x23')]],'as':_0x239c41['as'],'attributes':_0x239c41[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x3f25e9){logger[_0x83f4('0x17')](_0x83f4('0x25'),_0x37956b);logger[_0x83f4('0x24')](_0x83f4('0x25'),_0x37956b,JSON[_0x83f4('0x13')](_0x3f25e9));_0x5ca9bc(_0x3f25e9);})[_0x83f4('0x19')](function(_0x437853){logger[_0x83f4('0x14')]('ShowChatQueue',_0x437853[_0x83f4('0x16')],_0x37956b);_0x203d08(_0x162f06['error'](0x1f4,_0x437853['message']));});});}; \ No newline at end of file +var _0x8d62=['stringify','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetChatQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8d62,0xf8));var _0x28d6=function(_0x5e7dae,_0x311614){_0x5e7dae=_0x5e7dae-0x0;var _0x2c7f5b=_0x8d62[_0x5e7dae];return _0x2c7f5b;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var moment=require(_0x28d6('0x1'));var BPromise=require(_0x28d6('0x2'));var rs=require(_0x28d6('0x3'));var fs=require('fs');var Redis=require(_0x28d6('0x4'));var db=require(_0x28d6('0x5'))['db'];var utils=require(_0x28d6('0x6'));var logger=require(_0x28d6('0x7'))(_0x28d6('0x8'));var config=require(_0x28d6('0x9'));var jayson=require(_0x28d6('0xa'));var client=jayson[_0x28d6('0xb')][_0x28d6('0xc')]({'port':0x232a});config[_0x28d6('0xd')]=_['defaults'](config[_0x28d6('0xd')],{'host':_0x28d6('0xe'),'port':0x18eb});var socket=require(_0x28d6('0xf'))(new Redis(config['redis']));require(_0x28d6('0x10'))['register'](socket);function respondWithRpcPromise(_0x13eeb6,_0x7726e1,_0x3d9ae7){return new BPromise(function(_0x239297,_0x159578){return client['request'](_0x13eeb6,_0x3d9ae7)[_0x28d6('0x11')](function(_0xe899f2){logger[_0x28d6('0x12')](_0x28d6('0x13'),_0x7726e1,_0x28d6('0x14'));logger[_0x28d6('0x15')](_0x28d6('0x16'),_0x7726e1,_0x28d6('0x14'),JSON['stringify'](_0xe899f2));if(_0xe899f2[_0x28d6('0x17')]){if(_0xe899f2[_0x28d6('0x17')][_0x28d6('0x18')]===0x1f4){logger['error'](_0x28d6('0x13'),_0x7726e1,_0xe899f2['error'][_0x28d6('0x19')]);return _0x159578(_0xe899f2[_0x28d6('0x17')]['message']);}logger[_0x28d6('0x17')](_0x28d6('0x13'),_0x7726e1,_0xe899f2[_0x28d6('0x17')][_0x28d6('0x19')]);return _0x239297(_0xe899f2[_0x28d6('0x17')]['message']);}else{logger[_0x28d6('0x12')]('ChatQueue,\x20%s,\x20%s',_0x7726e1,_0x28d6('0x14'));_0x239297(_0xe899f2[_0x28d6('0x1a')][_0x28d6('0x19')]);}})[_0x28d6('0x1b')](function(_0x50100c){logger[_0x28d6('0x17')](_0x28d6('0x13'),_0x7726e1,_0x50100c);_0x159578(_0x50100c);});});}exports['GetChatQueue']=function(_0x29cfbf){var _0x20f2fd=this;return new Promise(function(_0x53d629,_0x26362e){return db[_0x28d6('0x1c')][_0x28d6('0x1d')]({'raw':_0x29cfbf[_0x28d6('0x1e')]?_0x29cfbf[_0x28d6('0x1e')][_0x28d6('0x1f')]===undefined?!![]:![]:!![],'where':_0x29cfbf[_0x28d6('0x1e')]?_0x29cfbf['options'][_0x28d6('0x20')]||null:null,'attributes':_0x29cfbf['options']?_0x29cfbf[_0x28d6('0x1e')][_0x28d6('0x21')]||null:null,'limit':_0x29cfbf[_0x28d6('0x1e')]?_0x29cfbf[_0x28d6('0x1e')][_0x28d6('0x22')]||null:null,'include':_0x29cfbf[_0x28d6('0x1e')]?_0x29cfbf['options']['include']?_[_0x28d6('0x23')](_0x29cfbf[_0x28d6('0x1e')][_0x28d6('0x24')],function(_0x210bfc){return{'model':db[_0x210bfc['model']],'as':_0x210bfc['as'],'attributes':_0x210bfc[_0x28d6('0x21')],'include':_0x210bfc[_0x28d6('0x24')]?_[_0x28d6('0x23')](_0x210bfc[_0x28d6('0x24')],function(_0x4757b1){return{'model':db[_0x4757b1[_0x28d6('0x25')]],'as':_0x4757b1['as'],'attributes':_0x4757b1[_0x28d6('0x21')],'include':_0x4757b1[_0x28d6('0x24')]?_[_0x28d6('0x23')](_0x4757b1[_0x28d6('0x24')],function(_0x28aaa6){return{'model':db[_0x28aaa6[_0x28d6('0x25')]],'as':_0x28aaa6['as'],'attributes':_0x28aaa6[_0x28d6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x28d6('0x11')](function(_0x4b140e){logger['info'](_0x28d6('0x26'),_0x29cfbf);logger[_0x28d6('0x15')](_0x28d6('0x26'),_0x29cfbf,JSON[_0x28d6('0x27')](_0x4b140e));_0x53d629(_0x4b140e);})[_0x28d6('0x1b')](function(_0x6b156e){logger['error'](_0x28d6('0x26'),_0x6b156e['message'],_0x29cfbf);_0x26362e(_0x20f2fd[_0x28d6('0x17')](0x1f4,_0x6b156e['message']));});});};exports[_0x28d6('0x28')]=function(_0x2594cb){var _0x398c05=this;return new Promise(function(_0x3fd81c,_0x9b9743){return db['ChatQueue']['find']({'raw':_0x2594cb[_0x28d6('0x1e')]?_0x2594cb[_0x28d6('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2594cb[_0x28d6('0x1e')]?_0x2594cb['options'][_0x28d6('0x20')]||null:null,'attributes':_0x2594cb['options']?_0x2594cb[_0x28d6('0x1e')]['attributes']||null:null,'include':_0x2594cb[_0x28d6('0x1e')]?_0x2594cb[_0x28d6('0x1e')][_0x28d6('0x24')]?_[_0x28d6('0x23')](_0x2594cb[_0x28d6('0x1e')][_0x28d6('0x24')],function(_0x37031c){return{'model':db[_0x37031c['model']],'as':_0x37031c['as'],'attributes':_0x37031c[_0x28d6('0x21')],'include':_0x37031c[_0x28d6('0x24')]?_[_0x28d6('0x23')](_0x37031c[_0x28d6('0x24')],function(_0x4f52e3){return{'model':db[_0x4f52e3[_0x28d6('0x25')]],'as':_0x4f52e3['as'],'attributes':_0x4f52e3[_0x28d6('0x21')],'include':_0x4f52e3[_0x28d6('0x24')]?_[_0x28d6('0x23')](_0x4f52e3['include'],function(_0x804c06){return{'model':db[_0x804c06[_0x28d6('0x25')]],'as':_0x804c06['as'],'attributes':_0x804c06[_0x28d6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x28d6('0x11')](function(_0x1fcdcf){logger[_0x28d6('0x12')](_0x28d6('0x28'),_0x2594cb);logger[_0x28d6('0x15')](_0x28d6('0x28'),_0x2594cb,JSON[_0x28d6('0x27')](_0x1fcdcf));_0x3fd81c(_0x1fcdcf);})[_0x28d6('0x1b')](function(_0x25438b){logger[_0x28d6('0x17')](_0x28d6('0x28'),_0x25438b[_0x28d6('0x19')],_0x2594cb);_0x9b9743(_0x398c05[_0x28d6('0x17')](0x1f4,_0x25438b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 59736f5..bf9e033 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 _0x524a=['./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2a29d4,_0x3c7fd1){var _0x5c6f52=function(_0x25a28f){while(--_0x25a28f){_0x2a29d4['push'](_0x2a29d4['shift']());}};_0x5c6f52(++_0x3c7fd1);}(_0x524a,0xf5));var _0xa524=function(_0x3de58c,_0x339ed1){_0x3de58c=_0x3de58c-0x0;var _0x1face2=_0x524a[_0x3de58c];return _0x1face2;};'use strict';var ChatQueueEvents=require(_0xa524('0x0'));var events=[_0xa524('0x1'),_0xa524('0x2'),_0xa524('0x3')];function createListener(_0x53c48c,_0x4a29b7){return function(_0x2ef77c){_0x4a29b7[_0xa524('0x4')](_0x53c48c,_0x2ef77c);};}function removeListener(_0x56ab08,_0x50ec75){return function(){ChatQueueEvents[_0xa524('0x5')](_0x56ab08,_0x50ec75);};}exports[_0xa524('0x6')]=function(_0x16227b){for(var _0x5f472f=0x0,_0x460738=events['length'];_0x5f472f<_0x460738;_0x5f472f++){var _0x3a2dd6=events[_0x5f472f];var _0x11aa98=createListener('chatQueue:'+_0x3a2dd6,_0x16227b);ChatQueueEvents['on'](_0x3a2dd6,_0x11aa98);}}; \ No newline at end of file +var _0xc6d8=['remove','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x35acf0,_0x464ef4){var _0x3cc1c6=function(_0x500fe0){while(--_0x500fe0){_0x35acf0['push'](_0x35acf0['shift']());}};_0x3cc1c6(++_0x464ef4);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x390b7c,_0x43ef0c){_0x390b7c=_0x390b7c-0x0;var _0x30bfc5=_0xc6d8[_0x390b7c];return _0x30bfc5;};'use strict';var ChatQueueEvents=require(_0x8c6d('0x0'));var events=['save',_0x8c6d('0x1'),'update'];function createListener(_0x3b88d1,_0x5974d3){return function(_0x292852){_0x5974d3['emit'](_0x3b88d1,_0x292852);};}function removeListener(_0x5b6b04,_0x352b8c){return function(){ChatQueueEvents[_0x8c6d('0x2')](_0x5b6b04,_0x352b8c);};}exports[_0x8c6d('0x3')]=function(_0x4f5e8f){for(var _0x3c265c=0x0,_0x2dbb52=events[_0x8c6d('0x4')];_0x3c265c<_0x2dbb52;_0x3c265c++){var _0x5529f1=events[_0x3c265c];var _0x1496ba=createListener(_0x8c6d('0x5')+_0x5529f1,_0x4f5e8f);ChatQueueEvents['on'](_0x5529f1,_0x1496ba);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index bc90238..cf0b422 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40108a,_0x17981c){var _0x74318a=function(_0x28ff91){while(--_0x28ff91){_0x40108a['push'](_0x40108a['shift']());}};_0x74318a(++_0x17981c);}(_0x008c,0x188));var _0xc008=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x008c[_0x7d62cb];return _0x3a6266;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x37304d,_0x41b8a9){var _0x1d879b=function(_0x416d68){while(--_0x416d68){_0x37304d['push'](_0x37304d['shift']());}};_0x1d879b(++_0x41b8a9);}(_0x7217,0x19e));var _0x7721=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x7217[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b0bb1c3..2a564bf 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 _0x208b=['DATE','moment','sequelize','exports','STRING'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x208b,0x114));var _0xb208=function(_0x2d169e,_0x23b613){_0x2d169e=_0x2d169e-0x0;var _0x57d75d=_0x208b[_0x2d169e];return _0x57d75d;};'use strict';var moment=require(_0xb208('0x0'));var Sequelize=require(_0xb208('0x1'));module[_0xb208('0x2')]={'uniqueid':{'type':Sequelize[_0xb208('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb208('0x4')]},'leaveAt':{'type':Sequelize[_0xb208('0x4')]},'acceptAt':{'type':Sequelize[_0xb208('0x4')]},'exitAt':{'type':Sequelize[_0xb208('0x4')]},'reason':{'type':Sequelize[_0xb208('0x3')]}}; \ No newline at end of file +var _0xdbb4=['DATE','STRING','moment','sequelize','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdbb4,0x1d8));var _0x4dbb=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0xdbb4[_0xb98d8d];return _0x489b15;};'use strict';var moment=require(_0x4dbb('0x0'));var Sequelize=require(_0x4dbb('0x1'));module[_0x4dbb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4dbb('0x3')]},'leaveAt':{'type':Sequelize[_0x4dbb('0x3')]},'acceptAt':{'type':Sequelize[_0x4dbb('0x3')]},'exitAt':{'type':Sequelize[_0x4dbb('0x3')]},'reason':{'type':Sequelize[_0x4dbb('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9a5d15f..a5c3732 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 _0x014c=['order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','send','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x30cdd7,_0x23f1ae){var _0x5c0a41=function(_0x5e368d){while(--_0x5e368d){_0x30cdd7['push'](_0x30cdd7['shift']());}};_0x5c0a41(++_0x23f1ae);}(_0x014c,0x17b));var _0xc014=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x014c[_0x366388];return _0x41c97e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc014('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc014('0x1'));var rp=require(_0xc014('0x2'));var moment=require(_0xc014('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc014('0x4'));var path=require(_0xc014('0x5'));var sox=require(_0xc014('0x6'));var csv=require(_0xc014('0x7'));var ejs=require(_0xc014('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc014('0x9'));var squel=require(_0xc014('0xa'));var crypto=require('crypto');var jsforce=require(_0xc014('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc014('0x7'));var querystring=require(_0xc014('0xc'));var Papa=require(_0xc014('0xd'));var Redis=require('ioredis');var authService=require(_0xc014('0xe'));var qs=require(_0xc014('0xf'));var as=require(_0xc014('0x10'));var hardwareService=require(_0xc014('0x11'));var logger=require('../../config/logger')(_0xc014('0x12'));var utils=require('../../config/utils');var config=require(_0xc014('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc014('0x14'))['db'];function respondWithStatusCode(_0xcde2d3,_0x2f8ac9){_0x2f8ac9=_0x2f8ac9||0xcc;return function(_0x1686f1){if(_0x1686f1){return _0xcde2d3['sendStatus'](_0x2f8ac9);}return _0xcde2d3[_0xc014('0x15')](_0x2f8ac9)[_0xc014('0x16')]();};}function respondWithResult(_0xe86dd,_0x5ced7d){_0x5ced7d=_0x5ced7d||0xc8;return function(_0x36b26e){if(_0x36b26e){return _0xe86dd['status'](_0x5ced7d)[_0xc014('0x17')](_0x36b26e);}};}function respondWithFilteredResult(_0x1c4d3b,_0x25fdf6){return function(_0x26f264){if(_0x26f264){var _0x9f6a26=typeof _0x25fdf6[_0xc014('0x18')]==='undefined'&&typeof _0x25fdf6[_0xc014('0x19')]===_0xc014('0x1a');var _0x263ad0=_0x26f264[_0xc014('0x1b')];var _0x5a2be0=_0x9f6a26?0x0:_0x25fdf6['offset'];var _0x42f93d=_0x9f6a26?_0x26f264['count']:_0x25fdf6['offset']+_0x25fdf6[_0xc014('0x19')];var _0x4287fe;if(_0x42f93d>=_0x263ad0){_0x42f93d=_0x263ad0;_0x4287fe=0xc8;}else{_0x4287fe=0xce;}_0x1c4d3b['status'](_0x4287fe);return _0x1c4d3b[_0xc014('0x1c')](_0xc014('0x1d'),_0x5a2be0+'-'+_0x42f93d+'/'+_0x263ad0)[_0xc014('0x17')](_0x26f264);}return null;};}function patchUpdates(_0x2dac66){return function(_0x1078c4){try{jsonpatch['apply'](_0x1078c4,_0x2dac66,!![]);}catch(_0xc8b0fb){return BPromise[_0xc014('0x1e')](_0xc8b0fb);}return _0x1078c4[_0xc014('0x1f')]();};}function saveUpdates(_0x3c58cc,_0x450b22){return function(_0x3f28b6){if(_0x3f28b6){return _0x3f28b6[_0xc014('0x20')](_0x3c58cc)['then'](function(_0x1089c6){return _0x1089c6;});}return null;};}function removeEntity(_0x1b905d,_0x16d8f9){return function(_0x174b46){if(_0x174b46){return _0x174b46[_0xc014('0x21')]()[_0xc014('0x22')](function(){_0x1b905d[_0xc014('0x15')](0xcc)[_0xc014('0x16')]();});}};}function handleEntityNotFound(_0xe4c68,_0x2e5c30){return function(_0x4850bb){if(!_0x4850bb){_0xe4c68[_0xc014('0x23')](0x194);}return _0x4850bb;};}function handleError(_0x17b6b4,_0x36b663){_0x36b663=_0x36b663||0x1f4;return function(_0x7f47ef){logger[_0xc014('0x24')](_0x7f47ef['stack']);if(_0x7f47ef[_0xc014('0x25')]){delete _0x7f47ef[_0xc014('0x25')];}_0x17b6b4[_0xc014('0x15')](_0x36b663)[_0xc014('0x26')](_0x7f47ef);};}exports['index']=function(_0x43af57,_0x40cf7c){var _0x151705={},_0x30e97a={},_0x21cd81={'count':0x0,'rows':[]};var _0x289f92=_[_0xc014('0x27')](db[_0xc014('0x28')][_0xc014('0x29')],function(_0x330869){return{'name':_0x330869[_0xc014('0x2a')],'type':_0x330869['type'][_0xc014('0x2b')]};});_0x30e97a['model']=_['map'](_0x289f92,'name');_0x30e97a[_0xc014('0x2c')]=_[_0xc014('0x2d')](_0x43af57['query']);_0x30e97a[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],_0x30e97a[_0xc014('0x2c')]);_0x151705[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],qs[_0xc014('0x32')](_0x43af57[_0xc014('0x2c')][_0xc014('0x32')]));_0x151705[_0xc014('0x31')]=_0x151705[_0xc014('0x31')]['length']?_0x151705[_0xc014('0x31')]:_0x30e97a['model'];if(!_0x43af57[_0xc014('0x2c')][_0xc014('0x33')](_0xc014('0x34'))){_0x151705[_0xc014('0x19')]=qs[_0xc014('0x19')](_0x43af57[_0xc014('0x2c')][_0xc014('0x19')]);_0x151705['offset']=qs[_0xc014('0x18')](_0x43af57['query'][_0xc014('0x18')]);}_0x151705[_0xc014('0x35')]=qs[_0xc014('0x36')](_0x43af57[_0xc014('0x2c')][_0xc014('0x36')]);_0x151705[_0xc014('0x37')]=qs[_0xc014('0x2e')](_['pick'](_0x43af57[_0xc014('0x2c')],_0x30e97a[_0xc014('0x2e')]),_0x289f92);if(_0x43af57[_0xc014('0x2c')]['filter']){_0x151705[_0xc014('0x37')]=_[_0xc014('0x38')](_0x151705[_0xc014('0x37')],{'$or':_['map'](_0x289f92,function(_0x473754){if(_0x473754['type']!==_0xc014('0x39')){var _0x19d374={};_0x19d374[_0x473754[_0xc014('0x25')]]={'$like':'%'+_0x43af57[_0xc014('0x2c')][_0xc014('0x3a')]+'%'};return _0x19d374;}})});}_0x151705=_[_0xc014('0x38')]({},_0x151705,_0x43af57[_0xc014('0x3b')]);var _0xb0149e={'where':_0x151705[_0xc014('0x37')]};return db[_0xc014('0x28')][_0xc014('0x1b')](_0xb0149e)[_0xc014('0x22')](function(_0x565433){_0x21cd81[_0xc014('0x1b')]=_0x565433;if(_0x43af57[_0xc014('0x2c')][_0xc014('0x3c')]){_0x151705[_0xc014('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xc014('0x3e')](_0x151705);})['then'](function(_0x3a7f90){_0x21cd81[_0xc014('0x3f')]=_0x3a7f90;return _0x21cd81;})[_0xc014('0x22')](respondWithFilteredResult(_0x40cf7c,_0x151705))[_0xc014('0x40')](handleError(_0x40cf7c,null));};exports[_0xc014('0x41')]=function(_0x46ea1c,_0x1f7dfb){var _0x2a0265={'raw':!![],'where':{'id':_0x46ea1c[_0xc014('0x42')]['id']}},_0x84720d={};_0x84720d[_0xc014('0x30')]=_['keys'](db[_0xc014('0x28')]['rawAttributes']);_0x84720d['query']=_[_0xc014('0x2d')](_0x46ea1c[_0xc014('0x2c')]);_0x84720d[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x84720d[_0xc014('0x30')],_0x84720d['query']);_0x2a0265[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x84720d['model'],qs[_0xc014('0x32')](_0x46ea1c[_0xc014('0x2c')][_0xc014('0x32')]));_0x2a0265[_0xc014('0x31')]=_0x2a0265[_0xc014('0x31')][_0xc014('0x43')]?_0x2a0265[_0xc014('0x31')]:_0x84720d[_0xc014('0x30')];if(_0x46ea1c[_0xc014('0x2c')]['includeAll']){_0x2a0265[_0xc014('0x3d')]=[{'all':!![]}];}_0x2a0265=_[_0xc014('0x38')]({},_0x2a0265,_0x46ea1c[_0xc014('0x3b')]);return db[_0xc014('0x28')][_0xc014('0x44')](_0x2a0265)[_0xc014('0x22')](handleEntityNotFound(_0x1f7dfb,null))[_0xc014('0x22')](respondWithResult(_0x1f7dfb,null))[_0xc014('0x40')](handleError(_0x1f7dfb,null));};exports[_0xc014('0x45')]=function(_0x541ad6,_0x2ce299){return db['ChatQueueReport']['create'](_0x541ad6[_0xc014('0x46')],{})['then'](respondWithResult(_0x2ce299,0xc9))[_0xc014('0x40')](handleError(_0x2ce299,null));};exports[_0xc014('0x20')]=function(_0x56595e,_0x359c24){if(_0x56595e[_0xc014('0x46')]['id']){delete _0x56595e[_0xc014('0x46')]['id'];}return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x56595e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x359c24,null))[_0xc014('0x22')](saveUpdates(_0x56595e[_0xc014('0x46')],null))[_0xc014('0x22')](respondWithResult(_0x359c24,null))[_0xc014('0x40')](handleError(_0x359c24,null));};exports[_0xc014('0x21')]=function(_0x464d3e,_0x255a3b){return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x464d3e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x255a3b,null))[_0xc014('0x22')](removeEntity(_0x255a3b,null))[_0xc014('0x40')](handleError(_0x255a3b,null));};exports[_0xc014('0x47')]=function(_0x1d37be,_0x53676a){return db[_0xc014('0x28')][_0xc014('0x47')]()[_0xc014('0x22')](respondWithResult(_0x53676a,null))[_0xc014('0x40')](handleError(_0x53676a,null));}; \ No newline at end of file +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','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x53da4f,_0x3e28f1){var _0x25a545=function(_0x44cd2e){while(--_0x44cd2e){_0x53da4f['push'](_0x53da4f['shift']());}};_0x25a545(++_0x3e28f1);}(_0xc2c7,0x134));var _0x7c2c=function(_0x55dcba,_0x2d9373){_0x55dcba=_0x55dcba-0x0;var _0x26a9e8=_0xc2c7[_0x55dcba];return _0x26a9e8;};'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['ChatQueueReport'][_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['ChatQueueReport'][_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['ChatQueueReport'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9e2a5e1..f9f8b60 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x45081a,_0x3ae384){var _0x55bfe2=function(_0xdb8714){while(--_0xdb8714){_0x45081a['push'](_0x45081a['shift']());}};_0x55bfe2(++_0x3ae384);}(_0xe706,0xa3));var _0x6e70=function(_0x2b7442,_0x561591){_0x2b7442=_0x2b7442-0x0;var _0x56e035=_0xe706[_0x2b7442];return _0x56e035;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xb10b,0x12a));var _0xbb10=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0xb10b[_0x4474c2];return _0x435fbb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index af93247..088848b 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 _0xa109=['result','catch','create','body','options','raw','CreateChatQueueReport','update','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1e54c5,_0x415a84){var _0x56247c=function(_0x49ffbb){while(--_0x49ffbb){_0x1e54c5['push'](_0x1e54c5['shift']());}};_0x56247c(++_0x415a84);}(_0xa109,0xf2));var _0x9a10=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa109[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x9a10('0x0'));var util=require('util');var moment=require(_0x9a10('0x1'));var BPromise=require(_0x9a10('0x2'));var rs=require(_0x9a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a10('0x4'))['db'];var utils=require(_0x9a10('0x5'));var logger=require(_0x9a10('0x6'))(_0x9a10('0x7'));var config=require(_0x9a10('0x8'));var jayson=require(_0x9a10('0x9'));var client=jayson[_0x9a10('0xa')][_0x9a10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b3f5,_0x342712,_0x51c0bd){return new BPromise(function(_0xb16a3c,_0x13224c){return client[_0x9a10('0xc')](_0x19b3f5,_0x51c0bd)[_0x9a10('0xd')](function(_0x1ce4b1){logger[_0x9a10('0xe')](_0x9a10('0xf'),_0x342712,_0x9a10('0x10'));logger[_0x9a10('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x342712,_0x9a10('0x10'),JSON[_0x9a10('0x12')](_0x1ce4b1));if(_0x1ce4b1[_0x9a10('0x13')]){if(_0x1ce4b1[_0x9a10('0x13')][_0x9a10('0x14')]===0x1f4){logger['error'](_0x9a10('0xf'),_0x342712,_0x1ce4b1[_0x9a10('0x13')]['message']);return _0x13224c(_0x1ce4b1['error']['message']);}logger[_0x9a10('0x13')](_0x9a10('0xf'),_0x342712,_0x1ce4b1[_0x9a10('0x13')][_0x9a10('0x15')]);return _0xb16a3c(_0x1ce4b1['error'][_0x9a10('0x15')]);}else{logger[_0x9a10('0xe')](_0x9a10('0xf'),_0x342712,_0x9a10('0x10'));_0xb16a3c(_0x1ce4b1[_0x9a10('0x16')][_0x9a10('0x15')]);}})[_0x9a10('0x17')](function(_0x5d0062){logger[_0x9a10('0x13')](_0x9a10('0xf'),_0x342712,_0x5d0062);_0x13224c(_0x5d0062);});});}exports['CreateChatQueueReport']=function(_0x6de1ec){var _0x5bae75=this;return new Promise(function(_0x21ce8d,_0x352a65){return db['ChatQueueReport'][_0x9a10('0x18')](_0x6de1ec[_0x9a10('0x19')],{'raw':_0x6de1ec[_0x9a10('0x1a')]?_0x6de1ec[_0x9a10('0x1a')][_0x9a10('0x1b')]===undefined?!![]:![]:!![]})[_0x9a10('0xd')](function(_0x2aaab1){logger[_0x9a10('0xe')](_0x9a10('0x1c'),_0x6de1ec);logger[_0x9a10('0x11')]('CreateChatQueueReport',_0x6de1ec,JSON[_0x9a10('0x12')](_0x2aaab1));_0x21ce8d(_0x2aaab1);})[_0x9a10('0x17')](function(_0x2ea911){logger[_0x9a10('0x13')](_0x9a10('0x1c'),_0x2ea911[_0x9a10('0x15')],_0x6de1ec);_0x352a65(_0x5bae75[_0x9a10('0x13')](0x1f4,_0x2ea911[_0x9a10('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x4dabee){var _0x3c4275=this;return new Promise(function(_0x500a7d,_0x3b883e){return db['ChatQueueReport'][_0x9a10('0x1d')](_0x4dabee[_0x9a10('0x19')],{'raw':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee[_0x9a10('0x1a')][_0x9a10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee['options'][_0x9a10('0x1e')]||null:null,'attributes':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee[_0x9a10('0x1a')][_0x9a10('0x1f')]||null:null,'limit':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee['options']['limit']||null:null})[_0x9a10('0xd')](function(_0xe83765){logger[_0x9a10('0xe')](_0x9a10('0x20'),_0x4dabee);logger[_0x9a10('0x11')](_0x9a10('0x20'),_0x4dabee,JSON[_0x9a10('0x12')](_0xe83765));_0x500a7d(_0xe83765);})[_0x9a10('0x17')](function(_0x111aca){logger[_0x9a10('0x13')](_0x9a10('0x20'),_0x111aca[_0x9a10('0x15')],_0x4dabee);_0x3b883e(_0x3c4275[_0x9a10('0x13')](0x1f4,_0x111aca[_0x9a10('0x15')]));});});}; \ No newline at end of file +var _0x23bb=['bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','catch','UpdateChatQueueReport','where','attributes','lodash','util','moment'];(function(_0x5c41e6,_0x31ec44){var _0x595f51=function(_0x34ca39){while(--_0x34ca39){_0x5c41e6['push'](_0x5c41e6['shift']());}};_0x595f51(++_0x31ec44);}(_0x23bb,0x10b));var _0xb23b=function(_0x5024c7,_0xd560bd){_0x5024c7=_0x5024c7-0x0;var _0xf2f316=_0x23bb[_0x5024c7];return _0xf2f316;};'use strict';var _=require(_0xb23b('0x0'));var util=require(_0xb23b('0x1'));var moment=require(_0xb23b('0x2'));var BPromise=require(_0xb23b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb23b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb23b('0x5'));var config=require(_0xb23b('0x6'));var jayson=require(_0xb23b('0x7'));var client=jayson[_0xb23b('0x8')][_0xb23b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fddb7,_0x240eb0,_0x5c0b57){return new BPromise(function(_0xf6159c,_0x3d1ff3){return client[_0xb23b('0xa')](_0x1fddb7,_0x5c0b57)['then'](function(_0x5ac98d){logger[_0xb23b('0xb')](_0xb23b('0xc'),_0x240eb0,'request\x20sent');logger[_0xb23b('0xd')](_0xb23b('0xe'),_0x240eb0,_0xb23b('0xf'),JSON[_0xb23b('0x10')](_0x5ac98d));if(_0x5ac98d['error']){if(_0x5ac98d[_0xb23b('0x11')]['code']===0x1f4){logger[_0xb23b('0x11')](_0xb23b('0xc'),_0x240eb0,_0x5ac98d[_0xb23b('0x11')]['message']);return _0x3d1ff3(_0x5ac98d[_0xb23b('0x11')][_0xb23b('0x12')]);}logger[_0xb23b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x240eb0,_0x5ac98d[_0xb23b('0x11')][_0xb23b('0x12')]);return _0xf6159c(_0x5ac98d['error']['message']);}else{logger[_0xb23b('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x240eb0,'request\x20sent');_0xf6159c(_0x5ac98d['result'][_0xb23b('0x12')]);}})['catch'](function(_0xb3fde7){logger['error'](_0xb23b('0xc'),_0x240eb0,_0xb3fde7);_0x3d1ff3(_0xb3fde7);});});}exports[_0xb23b('0x13')]=function(_0xcd7bc1){var _0x45024f=this;return new Promise(function(_0x11e06a,_0x4bede4){return db[_0xb23b('0x14')][_0xb23b('0x15')](_0xcd7bc1[_0xb23b('0x16')],{'raw':_0xcd7bc1[_0xb23b('0x17')]?_0xcd7bc1[_0xb23b('0x17')][_0xb23b('0x18')]===undefined?!![]:![]:!![]})[_0xb23b('0x19')](function(_0x37bb87){logger[_0xb23b('0xb')](_0xb23b('0x13'),_0xcd7bc1);logger[_0xb23b('0xd')](_0xb23b('0x13'),_0xcd7bc1,JSON[_0xb23b('0x10')](_0x37bb87));_0x11e06a(_0x37bb87);})[_0xb23b('0x1a')](function(_0x1b6871){logger[_0xb23b('0x11')](_0xb23b('0x13'),_0x1b6871['message'],_0xcd7bc1);_0x4bede4(_0x45024f[_0xb23b('0x11')](0x1f4,_0x1b6871[_0xb23b('0x12')]));});});};exports[_0xb23b('0x1b')]=function(_0x2ee568){var _0x427042=this;return new Promise(function(_0x520486,_0x3d1fde){return db[_0xb23b('0x14')]['update'](_0x2ee568[_0xb23b('0x16')],{'raw':_0x2ee568[_0xb23b('0x17')]?_0x2ee568[_0xb23b('0x17')][_0xb23b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee568[_0xb23b('0x17')]?_0x2ee568[_0xb23b('0x17')][_0xb23b('0x1c')]||null:null,'attributes':_0x2ee568[_0xb23b('0x17')]?_0x2ee568[_0xb23b('0x17')][_0xb23b('0x1d')]||null:null,'limit':_0x2ee568['options']?_0x2ee568['options']['limit']||null:null})[_0xb23b('0x19')](function(_0x14f4f8){logger[_0xb23b('0xb')]('UpdateChatQueueReport',_0x2ee568);logger[_0xb23b('0xd')](_0xb23b('0x1b'),_0x2ee568,JSON[_0xb23b('0x10')](_0x14f4f8));_0x520486(_0x14f4f8);})['catch'](function(_0x262700){logger[_0xb23b('0x11')](_0xb23b('0x1b'),_0x262700[_0xb23b('0x12')],_0x2ee568);_0x3d1fde(_0x427042[_0xb23b('0x11')](0x1f4,_0x262700[_0xb23b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4cb502a..3da097c 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 _0xf395=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x6964aa,_0x53fb14){var _0x589c46=function(_0x577a9f){while(--_0x577a9f){_0x6964aa['push'](_0x6964aa['shift']());}};_0x589c46(++_0x53fb14);}(_0xf395,0x12a));var _0x5f39=function(_0x280c7a,_0x3f29b4){_0x280c7a=_0x280c7a-0x0;var _0x32ce3b=_0xf395[_0x280c7a];return _0x32ce3b;};'use strict';var multer=require(_0x5f39('0x0'));var util=require(_0x5f39('0x1'));var path=require(_0x5f39('0x2'));var timeout=require(_0x5f39('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5f39('0x4'));var auth=require(_0x5f39('0x5'));var interaction=require(_0x5f39('0x6'));var config=require(_0x5f39('0x7'));var controller=require(_0x5f39('0x8'));router[_0x5f39('0x9')]('/',auth[_0x5f39('0xa')](),controller[_0x5f39('0xb')]);router[_0x5f39('0x9')]('/describe',auth[_0x5f39('0xa')](),controller[_0x5f39('0xc')]);router[_0x5f39('0x9')](_0x5f39('0xd'),auth[_0x5f39('0xa')](),controller['show']);router[_0x5f39('0xe')]('/',auth[_0x5f39('0xa')](),controller[_0x5f39('0xf')]);router[_0x5f39('0x10')](_0x5f39('0xd'),auth[_0x5f39('0xa')](),controller[_0x5f39('0x11')]);router[_0x5f39('0x12')]('/:id',auth[_0x5f39('0xa')](),controller[_0x5f39('0x13')]);module[_0x5f39('0x14')]=router; \ No newline at end of file +var _0x1269=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1269,0xfb));var _0x9126=function(_0x5f265e,_0x5f29c3){_0x5f265e=_0x5f265e-0x0;var _0x197592=_0x1269[_0x5f265e];return _0x197592;};'use strict';var multer=require(_0x9126('0x0'));var util=require('util');var path=require(_0x9126('0x1'));var timeout=require(_0x9126('0x2'));var express=require(_0x9126('0x3'));var router=express[_0x9126('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9126('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9126('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x9126('0x7')](),controller[_0x9126('0x8')]);router['get'](_0x9126('0x9'),auth[_0x9126('0x7')](),controller[_0x9126('0xa')]);router['get']('/:id',auth[_0x9126('0x7')](),controller[_0x9126('0xb')]);router[_0x9126('0xc')]('/',auth[_0x9126('0x7')](),controller[_0x9126('0xd')]);router[_0x9126('0xe')]('/:id',auth[_0x9126('0x7')](),controller[_0x9126('0xf')]);router['delete'](_0x9126('0x10'),auth[_0x9126('0x7')](),controller[_0x9126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0f1ff99..4d53c62 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x38e5ee,_0x3cd0cb){var _0x85812d=function(_0x3715a7){while(--_0x3715a7){_0x38e5ee['push'](_0x38e5ee['shift']());}};_0x85812d(++_0x3cd0cb);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x49eba0,_0x326642){var _0x546d60=function(_0x54080e){while(--_0x54080e){_0x49eba0['push'](_0x49eba0['shift']());}};_0x546d60(++_0x326642);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x4b84[_0x5a26f5];return _0x2e9ef7;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 03fa353..83de297 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 _0x0822=['findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','ChatTransferReport','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0822,0x182));var _0x2082=function(_0x11c639,_0x49997c){_0x11c639=_0x11c639-0x0;var _0xa28500=_0x0822[_0x11c639];return _0xa28500;};'use strict';var emlformat=require(_0x2082('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2082('0x1'));var jsonpatch=require(_0x2082('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2082('0x3'));var Mustache=require(_0x2082('0x4'));var util=require(_0x2082('0x5'));var path=require('path');var sox=require(_0x2082('0x6'));var csv=require(_0x2082('0x7'));var ejs=require(_0x2082('0x8'));var fs=require('fs');var fs_extra=require(_0x2082('0x9'));var _=require(_0x2082('0xa'));var squel=require(_0x2082('0xb'));var crypto=require(_0x2082('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2082('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2082('0xe'));var Papa=require(_0x2082('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2082('0x10'));var as=require(_0x2082('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2082('0x12'))('api');var utils=require(_0x2082('0x13'));var config=require(_0x2082('0x14'));var licenseUtil=require(_0x2082('0x15'));var db=require(_0x2082('0x16'))['db'];function respondWithStatusCode(_0x547a6b,_0x18b7e7){_0x18b7e7=_0x18b7e7||0xcc;return function(_0x31d714){if(_0x31d714){return _0x547a6b['sendStatus'](_0x18b7e7);}return _0x547a6b[_0x2082('0x17')](_0x18b7e7)[_0x2082('0x18')]();};}function respondWithResult(_0x4f4b60,_0x4707e1){_0x4707e1=_0x4707e1||0xc8;return function(_0x682e68){if(_0x682e68){return _0x4f4b60[_0x2082('0x17')](_0x4707e1)['json'](_0x682e68);}};}function respondWithFilteredResult(_0x4e5cdc,_0x528059){return function(_0x1d12eb){if(_0x1d12eb){var _0x4fe301=typeof _0x528059[_0x2082('0x19')]===_0x2082('0x1a')&&typeof _0x528059[_0x2082('0x1b')]===_0x2082('0x1a');var _0x5f2d9f=_0x1d12eb[_0x2082('0x1c')];var _0x2290b9=_0x4fe301?0x0:_0x528059[_0x2082('0x19')];var _0x456967=_0x4fe301?_0x1d12eb[_0x2082('0x1c')]:_0x528059[_0x2082('0x19')]+_0x528059[_0x2082('0x1b')];var _0x58d7ac;if(_0x456967>=_0x5f2d9f){_0x456967=_0x5f2d9f;_0x58d7ac=0xc8;}else{_0x58d7ac=0xce;}_0x4e5cdc['status'](_0x58d7ac);return _0x4e5cdc[_0x2082('0x1d')](_0x2082('0x1e'),_0x2290b9+'-'+_0x456967+'/'+_0x5f2d9f)[_0x2082('0x1f')](_0x1d12eb);}return null;};}function patchUpdates(_0x5858b0){return function(_0x452263){try{jsonpatch[_0x2082('0x20')](_0x452263,_0x5858b0,!![]);}catch(_0x140af0){return BPromise[_0x2082('0x21')](_0x140af0);}return _0x452263['save']();};}function saveUpdates(_0x1e9d32,_0x5b66b4){return function(_0x548fd4){if(_0x548fd4){return _0x548fd4[_0x2082('0x22')](_0x1e9d32)[_0x2082('0x23')](function(_0xc3e897){return _0xc3e897;});}return null;};}function removeEntity(_0x3b45cc,_0x1eef0e){return function(_0x1d5b8c){if(_0x1d5b8c){return _0x1d5b8c[_0x2082('0x24')]()[_0x2082('0x23')](function(){_0x3b45cc[_0x2082('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1f9f,_0x31531e){return function(_0x155c76){if(!_0x155c76){_0x2d1f9f['sendStatus'](0x194);}return _0x155c76;};}function handleError(_0x157e02,_0x2844bd){_0x2844bd=_0x2844bd||0x1f4;return function(_0xc910fb){logger[_0x2082('0x25')](_0xc910fb[_0x2082('0x26')]);if(_0xc910fb[_0x2082('0x27')]){delete _0xc910fb[_0x2082('0x27')];}_0x157e02[_0x2082('0x17')](_0x2844bd)[_0x2082('0x28')](_0xc910fb);};}exports[_0x2082('0x29')]=function(_0x182116,_0x20275f){var _0x1b84bd={},_0xcfba82={},_0x3ac870={'count':0x0,'rows':[]};var _0x411486=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x33a869){return{'name':_0x33a869[_0x2082('0x2a')],'type':_0x33a869[_0x2082('0x2b')][_0x2082('0x2c')]};});_0xcfba82[_0x2082('0x2d')]=_[_0x2082('0x2e')](_0x411486,_0x2082('0x27'));_0xcfba82[_0x2082('0x2f')]=_[_0x2082('0x30')](_0x182116['query']);_0xcfba82[_0x2082('0x31')]=_[_0x2082('0x32')](_0xcfba82[_0x2082('0x2d')],_0xcfba82[_0x2082('0x2f')]);_0x1b84bd['attributes']=_[_0x2082('0x32')](_0xcfba82['model'],qs[_0x2082('0x33')](_0x182116[_0x2082('0x2f')][_0x2082('0x33')]));_0x1b84bd['attributes']=_0x1b84bd[_0x2082('0x34')][_0x2082('0x35')]?_0x1b84bd[_0x2082('0x34')]:_0xcfba82[_0x2082('0x2d')];if(!_0x182116[_0x2082('0x2f')]['hasOwnProperty']('nolimit')){_0x1b84bd[_0x2082('0x1b')]=qs[_0x2082('0x1b')](_0x182116[_0x2082('0x2f')][_0x2082('0x1b')]);_0x1b84bd[_0x2082('0x19')]=qs[_0x2082('0x19')](_0x182116[_0x2082('0x2f')][_0x2082('0x19')]);}_0x1b84bd[_0x2082('0x36')]=qs['sort'](_0x182116[_0x2082('0x2f')][_0x2082('0x37')]);_0x1b84bd[_0x2082('0x38')]=qs[_0x2082('0x31')](_[_0x2082('0x39')](_0x182116['query'],_0xcfba82[_0x2082('0x31')]),_0x411486);if(_0x182116[_0x2082('0x2f')][_0x2082('0x3a')]){_0x1b84bd[_0x2082('0x38')]=_['merge'](_0x1b84bd[_0x2082('0x38')],{'$or':_[_0x2082('0x2e')](_0x411486,function(_0xab7d39){if(_0xab7d39[_0x2082('0x2b')]!==_0x2082('0x3b')){var _0x42ad2a={};_0x42ad2a[_0xab7d39[_0x2082('0x27')]]={'$like':'%'+_0x182116[_0x2082('0x2f')][_0x2082('0x3a')]+'%'};return _0x42ad2a;}})});}_0x1b84bd=_[_0x2082('0x3c')]({},_0x1b84bd,_0x182116['options']);var _0xce7663={'where':_0x1b84bd[_0x2082('0x38')]};return db[_0x2082('0x3d')][_0x2082('0x1c')](_0xce7663)[_0x2082('0x23')](function(_0xeaf228){_0x3ac870[_0x2082('0x1c')]=_0xeaf228;if(_0x182116[_0x2082('0x2f')][_0x2082('0x3e')]){_0x1b84bd[_0x2082('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x2082('0x40')](_0x1b84bd);})[_0x2082('0x23')](function(_0x4304c6){_0x3ac870[_0x2082('0x41')]=_0x4304c6;return _0x3ac870;})[_0x2082('0x23')](respondWithFilteredResult(_0x20275f,_0x1b84bd))[_0x2082('0x42')](handleError(_0x20275f,null));};exports[_0x2082('0x43')]=function(_0x4adab6,_0x509ac5){var _0x3de299={'raw':!![],'where':{'id':_0x4adab6[_0x2082('0x44')]['id']}},_0x12844f={};_0x12844f[_0x2082('0x2d')]=_[_0x2082('0x30')](db['ChatTransferReport'][_0x2082('0x45')]);_0x12844f[_0x2082('0x2f')]=_['keys'](_0x4adab6[_0x2082('0x2f')]);_0x12844f['filters']=_[_0x2082('0x32')](_0x12844f['model'],_0x12844f['query']);_0x3de299[_0x2082('0x34')]=_['intersection'](_0x12844f[_0x2082('0x2d')],qs[_0x2082('0x33')](_0x4adab6[_0x2082('0x2f')][_0x2082('0x33')]));_0x3de299['attributes']=_0x3de299[_0x2082('0x34')]['length']?_0x3de299[_0x2082('0x34')]:_0x12844f['model'];if(_0x4adab6[_0x2082('0x2f')][_0x2082('0x3e')]){_0x3de299[_0x2082('0x3f')]=[{'all':!![]}];}_0x3de299=_['merge']({},_0x3de299,_0x4adab6[_0x2082('0x46')]);return db['ChatTransferReport'][_0x2082('0x47')](_0x3de299)['then'](handleEntityNotFound(_0x509ac5,null))[_0x2082('0x23')](respondWithResult(_0x509ac5,null))['catch'](handleError(_0x509ac5,null));};exports[_0x2082('0x48')]=function(_0x1e167b,_0x2baea7){return db[_0x2082('0x3d')]['create'](_0x1e167b[_0x2082('0x49')],{})[_0x2082('0x23')](respondWithResult(_0x2baea7,0xc9))[_0x2082('0x42')](handleError(_0x2baea7,null));};exports[_0x2082('0x22')]=function(_0x337951,_0x4c8096){if(_0x337951['body']['id']){delete _0x337951[_0x2082('0x49')]['id'];}return db[_0x2082('0x3d')][_0x2082('0x47')]({'where':{'id':_0x337951[_0x2082('0x44')]['id']}})[_0x2082('0x23')](handleEntityNotFound(_0x4c8096,null))['then'](saveUpdates(_0x337951[_0x2082('0x49')],null))[_0x2082('0x23')](respondWithResult(_0x4c8096,null))['catch'](handleError(_0x4c8096,null));};exports['destroy']=function(_0x4ca84e,_0x597d7d){return db['ChatTransferReport'][_0x2082('0x47')]({'where':{'id':_0x4ca84e[_0x2082('0x44')]['id']}})[_0x2082('0x23')](handleEntityNotFound(_0x597d7d,null))[_0x2082('0x23')](removeEntity(_0x597d7d,null))[_0x2082('0x42')](handleError(_0x597d7d,null));};exports[_0x2082('0x4a')]=function(_0x2f3fe9,_0x48b235){return db[_0x2082('0x3d')]['describe']()['then'](respondWithResult(_0x48b235,null))[_0x2082('0x42')](handleError(_0x48b235,null));}; \ No newline at end of file +var _0xf398=['order','sort','where','pick','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','name','keys','query','filters','intersection','model','attributes','fields'];(function(_0x51248d,_0x27f47e){var _0xbbb193=function(_0x20c118){while(--_0x20c118){_0x51248d['push'](_0x51248d['shift']());}};_0xbbb193(++_0x27f47e);}(_0xf398,0x134));var _0x8f39=function(_0x672d4c,_0x246fdc){_0x672d4c=_0x672d4c-0x0;var _0x442494=_0xf398[_0x672d4c];return _0x442494;};'use strict';var emlformat=require(_0x8f39('0x0'));var rimraf=require(_0x8f39('0x1'));var zipdir=require(_0x8f39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f39('0x3'));var Mustache=require(_0x8f39('0x4'));var util=require(_0x8f39('0x5'));var path=require(_0x8f39('0x6'));var sox=require(_0x8f39('0x7'));var csv=require(_0x8f39('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f39('0x9'));var _=require(_0x8f39('0xa'));var squel=require(_0x8f39('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8f39('0xc'));var toCsv=require(_0x8f39('0x8'));var querystring=require(_0x8f39('0xd'));var Papa=require(_0x8f39('0xe'));var Redis=require(_0x8f39('0xf'));var authService=require(_0x8f39('0x10'));var qs=require(_0x8f39('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f39('0x12'));var logger=require(_0x8f39('0x13'))(_0x8f39('0x14'));var utils=require('../../config/utils');var config=require(_0x8f39('0x15'));var licenseUtil=require(_0x8f39('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13655d,_0x1730a8){_0x1730a8=_0x1730a8||0xcc;return function(_0x603a26){if(_0x603a26){return _0x13655d['sendStatus'](_0x1730a8);}return _0x13655d[_0x8f39('0x17')](_0x1730a8)[_0x8f39('0x18')]();};}function respondWithResult(_0x239dba,_0xc1c7c3){_0xc1c7c3=_0xc1c7c3||0xc8;return function(_0x7caa4a){if(_0x7caa4a){return _0x239dba[_0x8f39('0x17')](_0xc1c7c3)[_0x8f39('0x19')](_0x7caa4a);}};}function respondWithFilteredResult(_0x2bbf61,_0x21b27d){return function(_0x22c902){if(_0x22c902){var _0x279892=typeof _0x21b27d['offset']===_0x8f39('0x1a')&&typeof _0x21b27d[_0x8f39('0x1b')]===_0x8f39('0x1a');var _0x45f259=_0x22c902[_0x8f39('0x1c')];var _0x5dc921=_0x279892?0x0:_0x21b27d['offset'];var _0x1600e8=_0x279892?_0x22c902[_0x8f39('0x1c')]:_0x21b27d[_0x8f39('0x1d')]+_0x21b27d['limit'];var _0x24b8ca;if(_0x1600e8>=_0x45f259){_0x1600e8=_0x45f259;_0x24b8ca=0xc8;}else{_0x24b8ca=0xce;}_0x2bbf61[_0x8f39('0x17')](_0x24b8ca);return _0x2bbf61[_0x8f39('0x1e')](_0x8f39('0x1f'),_0x5dc921+'-'+_0x1600e8+'/'+_0x45f259)['json'](_0x22c902);}return null;};}function patchUpdates(_0x12178c){return function(_0x6af6bf){try{jsonpatch[_0x8f39('0x20')](_0x6af6bf,_0x12178c,!![]);}catch(_0x28b47b){return BPromise[_0x8f39('0x21')](_0x28b47b);}return _0x6af6bf[_0x8f39('0x22')]();};}function saveUpdates(_0x3f15e1,_0x52eaf6){return function(_0x31b85e){if(_0x31b85e){return _0x31b85e['update'](_0x3f15e1)[_0x8f39('0x23')](function(_0x3e9d3a){return _0x3e9d3a;});}return null;};}function removeEntity(_0xe338d1,_0x1b2210){return function(_0x466483){if(_0x466483){return _0x466483['destroy']()[_0x8f39('0x23')](function(){_0xe338d1[_0x8f39('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6a23,_0x34ee28){return function(_0x9bd1fe){if(!_0x9bd1fe){_0x4b6a23[_0x8f39('0x24')](0x194);}return _0x9bd1fe;};}function handleError(_0x5da2c6,_0x27b5cb){_0x27b5cb=_0x27b5cb||0x1f4;return function(_0x344042){logger[_0x8f39('0x25')](_0x344042['stack']);if(_0x344042['name']){delete _0x344042['name'];}_0x5da2c6[_0x8f39('0x17')](_0x27b5cb)[_0x8f39('0x26')](_0x344042);};}exports[_0x8f39('0x27')]=function(_0x20e4f9,_0x10c8fb){var _0x3717b2={},_0x373854={},_0x361a68={'count':0x0,'rows':[]};var _0x17a0d1=_[_0x8f39('0x28')](db['ChatTransferReport'][_0x8f39('0x29')],function(_0x472de5){return{'name':_0x472de5[_0x8f39('0x2a')],'type':_0x472de5[_0x8f39('0x2b')]['key']};});_0x373854['model']=_[_0x8f39('0x28')](_0x17a0d1,_0x8f39('0x2c'));_0x373854['query']=_[_0x8f39('0x2d')](_0x20e4f9[_0x8f39('0x2e')]);_0x373854[_0x8f39('0x2f')]=_[_0x8f39('0x30')](_0x373854[_0x8f39('0x31')],_0x373854[_0x8f39('0x2e')]);_0x3717b2[_0x8f39('0x32')]=_[_0x8f39('0x30')](_0x373854[_0x8f39('0x31')],qs[_0x8f39('0x33')](_0x20e4f9[_0x8f39('0x2e')]['fields']));_0x3717b2['attributes']=_0x3717b2[_0x8f39('0x32')]['length']?_0x3717b2['attributes']:_0x373854['model'];if(!_0x20e4f9[_0x8f39('0x2e')]['hasOwnProperty']('nolimit')){_0x3717b2[_0x8f39('0x1b')]=qs[_0x8f39('0x1b')](_0x20e4f9[_0x8f39('0x2e')]['limit']);_0x3717b2[_0x8f39('0x1d')]=qs[_0x8f39('0x1d')](_0x20e4f9['query']['offset']);}_0x3717b2[_0x8f39('0x34')]=qs[_0x8f39('0x35')](_0x20e4f9[_0x8f39('0x2e')][_0x8f39('0x35')]);_0x3717b2[_0x8f39('0x36')]=qs[_0x8f39('0x2f')](_[_0x8f39('0x37')](_0x20e4f9['query'],_0x373854[_0x8f39('0x2f')]),_0x17a0d1);if(_0x20e4f9[_0x8f39('0x2e')]['filter']){_0x3717b2[_0x8f39('0x36')]=_[_0x8f39('0x38')](_0x3717b2[_0x8f39('0x36')],{'$or':_['map'](_0x17a0d1,function(_0x4d753a){if(_0x4d753a[_0x8f39('0x2b')]!==_0x8f39('0x39')){var _0x24687d={};_0x24687d[_0x4d753a[_0x8f39('0x2c')]]={'$like':'%'+_0x20e4f9['query']['filter']+'%'};return _0x24687d;}})});}_0x3717b2=_[_0x8f39('0x38')]({},_0x3717b2,_0x20e4f9[_0x8f39('0x3a')]);var _0x27d2bf={'where':_0x3717b2[_0x8f39('0x36')]};return db[_0x8f39('0x3b')][_0x8f39('0x1c')](_0x27d2bf)['then'](function(_0x4a9826){_0x361a68['count']=_0x4a9826;if(_0x20e4f9[_0x8f39('0x2e')][_0x8f39('0x3c')]){_0x3717b2[_0x8f39('0x3d')]=[{'all':!![]}];}return db[_0x8f39('0x3b')][_0x8f39('0x3e')](_0x3717b2);})[_0x8f39('0x23')](function(_0x5e000c){_0x361a68[_0x8f39('0x3f')]=_0x5e000c;return _0x361a68;})[_0x8f39('0x23')](respondWithFilteredResult(_0x10c8fb,_0x3717b2))[_0x8f39('0x40')](handleError(_0x10c8fb,null));};exports['show']=function(_0x2753b8,_0x2c894d){var _0x481754={'raw':!![],'where':{'id':_0x2753b8['params']['id']}},_0x503145={};_0x503145['model']=_['keys'](db[_0x8f39('0x3b')][_0x8f39('0x29')]);_0x503145[_0x8f39('0x2e')]=_[_0x8f39('0x2d')](_0x2753b8[_0x8f39('0x2e')]);_0x503145[_0x8f39('0x2f')]=_['intersection'](_0x503145[_0x8f39('0x31')],_0x503145[_0x8f39('0x2e')]);_0x481754[_0x8f39('0x32')]=_[_0x8f39('0x30')](_0x503145[_0x8f39('0x31')],qs[_0x8f39('0x33')](_0x2753b8[_0x8f39('0x2e')][_0x8f39('0x33')]));_0x481754['attributes']=_0x481754['attributes'][_0x8f39('0x41')]?_0x481754[_0x8f39('0x32')]:_0x503145[_0x8f39('0x31')];if(_0x2753b8['query'][_0x8f39('0x3c')]){_0x481754[_0x8f39('0x3d')]=[{'all':!![]}];}_0x481754=_[_0x8f39('0x38')]({},_0x481754,_0x2753b8[_0x8f39('0x3a')]);return db[_0x8f39('0x3b')][_0x8f39('0x42')](_0x481754)['then'](handleEntityNotFound(_0x2c894d,null))[_0x8f39('0x23')](respondWithResult(_0x2c894d,null))[_0x8f39('0x40')](handleError(_0x2c894d,null));};exports[_0x8f39('0x43')]=function(_0x1b78ba,_0x5151ee){return db[_0x8f39('0x3b')][_0x8f39('0x43')](_0x1b78ba[_0x8f39('0x44')],{})[_0x8f39('0x23')](respondWithResult(_0x5151ee,0xc9))[_0x8f39('0x40')](handleError(_0x5151ee,null));};exports[_0x8f39('0x45')]=function(_0x5b18b6,_0x5939c8){if(_0x5b18b6[_0x8f39('0x44')]['id']){delete _0x5b18b6[_0x8f39('0x44')]['id'];}return db[_0x8f39('0x3b')]['find']({'where':{'id':_0x5b18b6[_0x8f39('0x46')]['id']}})[_0x8f39('0x23')](handleEntityNotFound(_0x5939c8,null))[_0x8f39('0x23')](saveUpdates(_0x5b18b6[_0x8f39('0x44')],null))[_0x8f39('0x23')](respondWithResult(_0x5939c8,null))[_0x8f39('0x40')](handleError(_0x5939c8,null));};exports['destroy']=function(_0x4bbdf4,_0x519c01){return db[_0x8f39('0x3b')][_0x8f39('0x42')]({'where':{'id':_0x4bbdf4[_0x8f39('0x46')]['id']}})[_0x8f39('0x23')](handleEntityNotFound(_0x519c01,null))[_0x8f39('0x23')](removeEntity(_0x519c01,null))['catch'](handleError(_0x519c01,null));};exports[_0x8f39('0x47')]=function(_0x2154d0,_0x3f4589){return db[_0x8f39('0x3b')][_0x8f39('0x47')]()[_0x8f39('0x23')](respondWithResult(_0x3f4589,null))[_0x8f39('0x40')](handleError(_0x3f4589,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 444d959..c5bb830 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 _0x6c94=['moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api'];(function(_0x312aa3,_0x5967ab){var _0x6375e9=function(_0x5205a7){while(--_0x5205a7){_0x312aa3['push'](_0x312aa3['shift']());}};_0x6375e9(++_0x5967ab);}(_0x6c94,0x1aa));var _0x46c9=function(_0x156d45,_0x7ede56){_0x156d45=_0x156d45-0x0;var _0x50f99d=_0x6c94[_0x156d45];return _0x50f99d;};'use strict';var _=require(_0x46c9('0x0'));var util=require(_0x46c9('0x1'));var logger=require('../../config/logger')(_0x46c9('0x2'));var moment=require(_0x46c9('0x3'));var BPromise=require(_0x46c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46c9('0x5'));var config=require(_0x46c9('0x6'));var attributes=require(_0x46c9('0x7'));module[_0x46c9('0x8')]=function(_0x54cd7a,_0x47427e){return _0x54cd7a[_0x46c9('0x9')](_0x46c9('0xa'),attributes,{'tableName':_0x46c9('0xb'),'paranoid':![],'indexes':[{'name':_0x46c9('0xc'),'fields':[_0x46c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x041d=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x041d,0xe1));var _0xd041=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x041d[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require(_0xd041('0x0'));var logger=require(_0xd041('0x1'))(_0xd041('0x2'));var moment=require(_0xd041('0x3'));var BPromise=require(_0xd041('0x4'));var rp=require(_0xd041('0x5'));var fs=require('fs');var path=require(_0xd041('0x6'));var rimraf=require(_0xd041('0x7'));var config=require(_0xd041('0x8'));var attributes=require(_0xd041('0x9'));module[_0xd041('0xa')]=function(_0x206a55,_0x5f5477){return _0x206a55['define'](_0xd041('0xb'),attributes,{'tableName':_0xd041('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd041('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 406348b..744fd44 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 _0xd2df=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','info'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd2df,0x1b9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd2d('0x0'));var moment=require(_0xfd2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd2d('0x2'));var fs=require('fs');var Redis=require(_0xfd2d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd2d('0x4'));var logger=require(_0xfd2d('0x5'))(_0xfd2d('0x6'));var config=require(_0xfd2d('0x7'));var jayson=require(_0xfd2d('0x8'));var client=jayson[_0xfd2d('0x9')][_0xfd2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1fc2,_0x249367,_0x3d9011){return new BPromise(function(_0x4f8974,_0x52cd8a){return client[_0xfd2d('0xb')](_0x4b1fc2,_0x3d9011)[_0xfd2d('0xc')](function(_0x359fe){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x249367,_0xfd2d('0xd'));logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x249367,_0xfd2d('0xd'),JSON['stringify'](_0x359fe));if(_0x359fe[_0xfd2d('0x10')]){if(_0x359fe['error'][_0xfd2d('0x11')]===0x1f4){logger['error'](_0xfd2d('0x12'),_0x249367,_0x359fe[_0xfd2d('0x10')][_0xfd2d('0x13')]);return _0x52cd8a(_0x359fe['error'][_0xfd2d('0x13')]);}logger[_0xfd2d('0x10')](_0xfd2d('0x12'),_0x249367,_0x359fe['error'][_0xfd2d('0x13')]);return _0x4f8974(_0x359fe[_0xfd2d('0x10')][_0xfd2d('0x13')]);}else{logger[_0xfd2d('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x249367,_0xfd2d('0xd'));_0x4f8974(_0x359fe['result'][_0xfd2d('0x13')]);}})['catch'](function(_0x2d1864){logger[_0xfd2d('0x10')](_0xfd2d('0x12'),_0x249367,_0x2d1864);_0x52cd8a(_0x2d1864);});});} \ No newline at end of file +var _0x3a9e=['ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x3a9e,0x7a));var _0xe3a9=function(_0x311c35,_0x54a2b0){_0x311c35=_0x311c35-0x0;var _0x31ff65=_0x3a9e[_0x311c35];return _0x31ff65;};'use strict';var _=require('lodash');var util=require(_0xe3a9('0x0'));var moment=require(_0xe3a9('0x1'));var BPromise=require(_0xe3a9('0x2'));var rs=require(_0xe3a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3a9('0x5'))(_0xe3a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe3a9('0x7'));var client=jayson[_0xe3a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272fa7,_0x22df52,_0x63082b){return new BPromise(function(_0x571bec,_0xb9a000){return client[_0xe3a9('0x9')](_0x272fa7,_0x63082b)[_0xe3a9('0xa')](function(_0x240dfc){logger['info'](_0xe3a9('0xb'),_0x22df52,'request\x20sent');logger['debug'](_0xe3a9('0xc'),_0x22df52,_0xe3a9('0xd'),JSON[_0xe3a9('0xe')](_0x240dfc));if(_0x240dfc[_0xe3a9('0xf')]){if(_0x240dfc[_0xe3a9('0xf')][_0xe3a9('0x10')]===0x1f4){logger[_0xe3a9('0xf')](_0xe3a9('0xb'),_0x22df52,_0x240dfc['error']['message']);return _0xb9a000(_0x240dfc['error'][_0xe3a9('0x11')]);}logger[_0xe3a9('0xf')](_0xe3a9('0xb'),_0x22df52,_0x240dfc[_0xe3a9('0xf')][_0xe3a9('0x11')]);return _0x571bec(_0x240dfc[_0xe3a9('0xf')]['message']);}else{logger['info'](_0xe3a9('0xb'),_0x22df52,_0xe3a9('0xd'));_0x571bec(_0x240dfc['result']['message']);}})[_0xe3a9('0x12')](function(_0x3ed0a0){logger[_0xe3a9('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x22df52,_0x3ed0a0);_0xb9a000(_0x3ed0a0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 47a5cb7..d99a3bf 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 _0x4caa=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x547bd6,_0x2abe0c){var _0x5ad6d7=function(_0x209bbf){while(--_0x209bbf){_0x547bd6['push'](_0x547bd6['shift']());}};_0x5ad6d7(++_0x2abe0c);}(_0x4caa,0x1ef));var _0xa4ca=function(_0xe5cac7,_0x6c2f84){_0xe5cac7=_0xe5cac7-0x0;var _0x50df20=_0x4caa[_0xe5cac7];return _0x50df20;};'use strict';var multer=require(_0xa4ca('0x0'));var util=require(_0xa4ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4ca('0x2'));var router=express[_0xa4ca('0x3')]();var fs_extra=require(_0xa4ca('0x4'));var auth=require(_0xa4ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa4ca('0x6'));var controller=require(_0xa4ca('0x7'));router[_0xa4ca('0x8')]('/',auth[_0xa4ca('0x9')](),controller[_0xa4ca('0xa')]);router[_0xa4ca('0x8')](_0xa4ca('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa4ca('0x8')](_0xa4ca('0xc'),auth[_0xa4ca('0x9')](),controller[_0xa4ca('0xd')]);router[_0xa4ca('0xe')]('/',auth['isAuthenticated'](),controller[_0xa4ca('0xf')]);router[_0xa4ca('0x10')]('/:id',auth[_0xa4ca('0x9')](),controller[_0xa4ca('0x11')]);router[_0xa4ca('0x12')](_0xa4ca('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa4ca('0x13')]=router; \ No newline at end of file +var _0x36ab=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','put'];(function(_0x517b09,_0x167924){var _0x51b6b2=function(_0x4446dc){while(--_0x4446dc){_0x517b09['push'](_0x517b09['shift']());}};_0x51b6b2(++_0x167924);}(_0x36ab,0xb3));var _0xb36a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x36ab[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xb36a('0x0'));var util=require(_0xb36a('0x1'));var path=require(_0xb36a('0x2'));var timeout=require(_0xb36a('0x3'));var express=require(_0xb36a('0x4'));var router=express[_0xb36a('0x5')]();var fs_extra=require(_0xb36a('0x6'));var auth=require(_0xb36a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb36a('0x8'));var controller=require(_0xb36a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb36a('0xa')]);router['get'](_0xb36a('0xb'),auth[_0xb36a('0xc')](),controller[_0xb36a('0xd')]);router[_0xb36a('0xe')](_0xb36a('0xf'),auth[_0xb36a('0xc')](),controller[_0xb36a('0x10')]);router[_0xb36a('0x11')]('/',auth[_0xb36a('0xc')](),controller['create']);router[_0xb36a('0x12')](_0xb36a('0xf'),auth[_0xb36a('0xc')](),controller['update']);router[_0xb36a('0x13')]('/:id',auth[_0xb36a('0xc')](),controller[_0xb36a('0x14')]);module[_0xb36a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 344abd1..427c3f3 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 _0x0273=['Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','input','text','name','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x3f94bd,_0x897298){var _0x2ef8e9=function(_0x409d8c){while(--_0x409d8c){_0x3f94bd['push'](_0x3f94bd['shift']());}};_0x2ef8e9(++_0x897298);}(_0x0273,0x91));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3027('0x0'));var rs=require(_0x3027('0x1'));module[_0x3027('0x2')]={'name':{'type':Sequelize[_0x3027('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x3027('0x3')]},'mapKey':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x4')},'key':{'type':Sequelize[_0x3027('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x5')},'customerAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3027('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3027('0xa')](_0x3027('0xb'),_0x3027('0xc')),'defaultValue':_0x3027('0xb')},'header_online':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xd')},'start_chat_button':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xe')},'header_offline':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xf')},'download_transcript':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3027('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x13')},'placeholderMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x14')},'closingMessageButton':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x3027('0x16'),_0x3027('0x17')),'defaultValue':_0x3027('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3027('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x3027('0x19'),'required':!![]},'props':{'title':_0x3027('0x1a'),'helpText':''}},{'type':_0x3027('0x18'),'props':{'title':_0x3027('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3027('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3027('0x1b')](_0x3027('0x1c'))?JSON['parse'](this[_0x3027('0x1b')](_0x3027('0x1c'))):{};},'set':function(_0xcd766f){return this[_0x3027('0x1d')](_0x3027('0x1c'),JSON[_0x3027('0x1e')](_0xcd766f));}},'offlineForm':{'type':Sequelize[_0x3027('0x10')],'defaultValue':function(){return JSON[_0x3027('0x1e')]({'items':[{'type':'input','props':{'title':_0x3027('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3027('0x4')},'variable':null},{'type':_0x3027('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x3027('0x20'),'helpText':_0x3027('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x3027('0x1b')](_0x3027('0x22'))?JSON[_0x3027('0x23')](this[_0x3027('0x1b')](_0x3027('0x22'))):{};},'set':function(_0x5ce006){return this[_0x3027('0x1d')](_0x3027('0x22'),JSON[_0x3027('0x1e')](_0x5ce006));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3027('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3027('0x3')]},'forwardOffline':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3027('0x3')]},'waitingTitle':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x25')},'waitingMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x28')},'skipUnmanaged':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x29')},'sendUnmanaged':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3027('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3027('0x3')]},'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['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x2c')},'messagesAlignment':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2d')},'defaultTitle':{'type':Sequelize[_0x3027('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3027('0x8')],'comment':_0x3027('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3027('0x31'),'set':function(_0x51d791){if(!_0x51d791)this[_0x3027('0x1d')]('mandatoryDispositionPauseId',null);this[_0x3027('0x1d')](_0x3027('0x32'),_0x51d791);}},'vidaooEscalation':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3027('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x3027('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3027('0x10')]}}; \ No newline at end of file +var _0x8cfd=['Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','getDataValue','parse','onlineForm','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email'];(function(_0x497fea,_0x15a2cd){var _0x3cdc4c=function(_0x350c50){while(--_0x350c50){_0x497fea['push'](_0x497fea['shift']());}};_0x3cdc4c(++_0x15a2cd);}(_0x8cfd,0x14c));var _0xd8cf=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8cfd[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xd8cf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'unique':_0xd8cf('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0x4')},'customerAlias':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'defaultValue':_0xd8cf('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'defaultValue':_0xd8cf('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd8cf('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd8cf('0x8')](_0xd8cf('0x9'),_0xd8cf('0xa')),'defaultValue':_0xd8cf('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0xb')},'start_chat_button':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0xc')},'offline_chat_button':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0xd')},'header_offline':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0xe')},'download_transcript':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd8cf('0x10')]},'closingQuestion':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x12')},'noteTitle':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x13')},'placeholderMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x14')},'closingMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0xd')},'skipMessageButton':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x16')},'conditionAgreement':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x17')},'ratingType':{'type':Sequelize[_0xd8cf('0x8')](_0xd8cf('0x18'),_0xd8cf('0x19')),'defaultValue':_0xd8cf('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xd8cf('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd8cf('0x10')],'defaultValue':function(){return JSON[_0xd8cf('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xd8cf('0x1b'),'type':_0xd8cf('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd8cf('0x3'),'type':_0xd8cf('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd8cf('0x1d')]('onlineForm')?JSON[_0xd8cf('0x1e')](this[_0xd8cf('0x1d')](_0xd8cf('0x1f'))):{};},'set':function(_0x384c95){return this[_0xd8cf('0x20')](_0xd8cf('0x1f'),JSON[_0xd8cf('0x1a')](_0x384c95));}},'offlineForm':{'type':Sequelize[_0xd8cf('0x10')],'defaultValue':function(){return JSON[_0xd8cf('0x1a')]({'items':[{'type':_0xd8cf('0x21'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd8cf('0x3'),'type':_0xd8cf('0x3')},'variable':null},{'type':_0xd8cf('0x22'),'config':{'placeholder':_0xd8cf('0x23')},'props':{'title':_0xd8cf('0x23'),'helpText':_0xd8cf('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xd8cf('0x1d')]('offlineForm')?JSON[_0xd8cf('0x1e')](this[_0xd8cf('0x1d')](_0xd8cf('0x25'))):{};},'set':function(_0xa9cd6d){return this[_0xd8cf('0x20')](_0xd8cf('0x25'),JSON[_0xd8cf('0x1a')](_0xa9cd6d));}},'token':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':function(){return rs[_0xd8cf('0x26')]();}},'autoclose':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd8cf('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd8cf('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0x27')},'waitingMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xd8cf('0x29')},'offlineMessageBody':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd8cf('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd8cf('0x2b');}},'notificationSound':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd8cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x2d')},'verticalAlignment':{'type':Sequelize[_0xd8cf('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x2e')},'messagesAlignment':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x2f')},'defaultTitle':{'type':Sequelize[_0xd8cf('0x1')]},'customerAvatar':{'type':Sequelize[_0xd8cf('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'defaultValue':_0xd8cf('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd8cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':_0xd8cf('0x31')},'systemAvatar':{'type':Sequelize[_0xd8cf('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8cf('0x6')],'comment':_0xd8cf('0x32')},'mandatoryDisposition':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![],'comment':_0xd8cf('0x33'),'set':function(_0x1d9bb5){if(!_0x1d9bb5)this[_0xd8cf('0x20')](_0xd8cf('0x34'),null);this['setDataValue'](_0xd8cf('0x35'),_0x1d9bb5);}},'vidaooEscalation':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd8cf('0x1')]},'vidaooTopic':{'type':Sequelize[_0xd8cf('0x1')],'allowNull':![],'defaultValue':_0xd8cf('0x36')},'vidaooNote':{'type':Sequelize[_0xd8cf('0x1')],'defaultValue':function(){return _0xd8cf('0x37');}},'vidaooMetadata':{'type':Sequelize[_0xd8cf('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd8cf('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd8cf('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ad374ff..7b96b83 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 _0xb1b6=['updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','asc','ListId','contact','threadId','ChatInteraction','externalUrl','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','openNewInteraction','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','Tag','Tags','color','tag','virtual','License','readFileSync','server/files/chat/iframe.ejs','URL','3.5.0','remote','headers','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','backgroundColor','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','handleError','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Interval','Intervals','all','some','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','ChatWebsite','includeAll','findAll','show','params','include','merge','options','create','body','user','userProfileId','find','describe','addDisposition','Disposition','getDispositions','nolimit','ChatWebsiteId','rows','removeDispositions','findOne','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x49fd27,_0x2c0345){var _0x4517d3=function(_0x3a78b9){while(--_0x3a78b9){_0x49fd27['push'](_0x49fd27['shift']());}};_0x4517d3(++_0x2c0345);}(_0xb1b6,0x87));var _0x6b1b=function(_0xc00fcd,_0x50f6d4){_0xc00fcd=_0xc00fcd-0x0;var _0x583013=_0xb1b6[_0xc00fcd];return _0x583013;};'use strict';var Mustache=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var path=require(_0x6b1b('0x2'));var ejs=require(_0x6b1b('0x3'));var fs=require('fs');var fs_extra=require(_0x6b1b('0x4'));var _=require(_0x6b1b('0x5'));var querystring=require(_0x6b1b('0x6'));var htmlToText=require(_0x6b1b('0x7'));var Redis=require(_0x6b1b('0x8'));var jayson=require('jayson/promise');var url=require(_0x6b1b('0x9'));var qs=require(_0x6b1b('0xa'));var logger=require(_0x6b1b('0xb'))(_0x6b1b('0xc'));var config=require(_0x6b1b('0xd'));var APIOutOfIntervalError=require(_0x6b1b('0xe'))['APIOutOfIntervalError'];var APINotFoundError=require(_0x6b1b('0xe'))['APINotFoundError'];var APIHandleError=require(_0x6b1b('0xe'))[_0x6b1b('0xf')];var db=require(_0x6b1b('0x10'))['db'];config[_0x6b1b('0x11')]=_[_0x6b1b('0x12')](config['redis'],{'host':_0x6b1b('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b1b('0x11')]));require(_0x6b1b('0x14'))[_0x6b1b('0x15')](socket);var client=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x232c});var client9002=jayson['client'][_0x6b1b('0x17')]({'port':0x232a});var client9003=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x232b});var client9001=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x4be6c1,_0x4e2097,_0x91c9ba,_0x1fa4e5){return new Promise(function(_0x4d5d50,_0x34eed0){var _0x3fa59f=_0x1fa4e5||client;return _0x3fa59f[_0x6b1b('0x18')](_0x4be6c1,_0x91c9ba)[_0x6b1b('0x19')](function(_0x10119b){logger[_0x6b1b('0x1a')](_0x6b1b('0x1b'),_0x4e2097,_0x6b1b('0x1c'));logger['debug'](_0x6b1b('0x1d'),_0x4e2097,_0x6b1b('0x1c'),JSON[_0x6b1b('0x1e')](_0x10119b));if(_0x10119b[_0x6b1b('0x1f')]){if(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x20')]===0x1f4){logger['error'](_0x6b1b('0x1b'),_0x4e2097,_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);return _0x34eed0(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);}logger[_0x6b1b('0x1f')](_0x6b1b('0x1b'),_0x4e2097,_0x10119b[_0x6b1b('0x1f')]['message']);return _0x4d5d50(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);}else{logger['info'](_0x6b1b('0x1b'),_0x4e2097,_0x6b1b('0x1c'));_0x4d5d50(_0x10119b[_0x6b1b('0x22')][_0x6b1b('0x21')]);}})[_0x6b1b('0x23')](function(_0x1b1206){logger['error'](_0x6b1b('0x1b'),_0x4e2097,_0x1b1206);_0x34eed0(_0x1b1206);});});}function respondWithStatusCode(_0xcc32ff,_0x16b94b){_0x16b94b=_0x16b94b||0xcc;return function(_0x2f3bde){if(_0x2f3bde){return _0xcc32ff[_0x6b1b('0x24')](_0x16b94b);}return _0xcc32ff[_0x6b1b('0x25')](_0x16b94b)['end']();};}function respondWithResult(_0xf5b1f7,_0x1eaa50){_0x1eaa50=_0x1eaa50||0xc8;return function(_0x25e7ea){if(_0x25e7ea){return _0xf5b1f7[_0x6b1b('0x25')](_0x1eaa50)[_0x6b1b('0x26')](_0x25e7ea);}};}function respondWithFilteredResult(_0x48a758,_0x55c6f0){return function(_0x48419d){if(_0x48419d){var _0xb35e2e=typeof _0x55c6f0[_0x6b1b('0x27')]===_0x6b1b('0x28')&&typeof _0x55c6f0[_0x6b1b('0x29')]===_0x6b1b('0x28');var _0x32c3d7=_0x48419d[_0x6b1b('0x2a')];var _0x1c8fbf=_0xb35e2e?0x0:_0x55c6f0['offset'];var _0x483cb2=_0xb35e2e?_0x48419d['count']:_0x55c6f0[_0x6b1b('0x27')]+_0x55c6f0[_0x6b1b('0x29')];var _0x3390c1;if(_0x483cb2>=_0x32c3d7){_0x483cb2=_0x32c3d7;_0x3390c1=0xc8;}else{_0x3390c1=0xce;}_0x48a758['status'](_0x3390c1);return _0x48a758[_0x6b1b('0x2b')](_0x6b1b('0x2c'),_0x1c8fbf+'-'+_0x483cb2+'/'+_0x32c3d7)[_0x6b1b('0x26')](_0x48419d);}return null;};}function saveUpdates(_0x942dd4){return function(_0x308b6e){if(_0x308b6e){return _0x308b6e[_0x6b1b('0x2d')](_0x942dd4)[_0x6b1b('0x19')](function(_0x57bd12){return _0x57bd12;});}return null;};}function removeEntity(_0x4927c1){return function(_0xbc8031){if(_0xbc8031){return _0xbc8031[_0x6b1b('0x2e')]()[_0x6b1b('0x19')](function(){var _0x4de5bb=_0xbc8031[_0x6b1b('0x2f')]({'plain':!![]});var _0x224d20=_0x6b1b('0x30');return db[_0x6b1b('0x31')]['destroy']({'where':{'type':_0x224d20,'resourceId':_0x4de5bb['id']}})[_0x6b1b('0x19')](function(){return _0xbc8031;});})[_0x6b1b('0x19')](function(){_0x4927c1[_0x6b1b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee522){return function(_0x31cb08){if(!_0x31cb08){_0x1ee522['sendStatus'](0x194);}return _0x31cb08;};}function handleError(_0x486e8a,_0x12e6d5){_0x12e6d5=_0x12e6d5||0x1f4;return function(_0x1e34aa){logger[_0x6b1b('0x1f')](_0x1e34aa['stack']);if(_0x1e34aa[_0x6b1b('0x32')]){delete _0x1e34aa[_0x6b1b('0x32')];}_0x486e8a['status'](_0x12e6d5)[_0x6b1b('0x33')](_0x1e34aa);};}function iftimePromise(_0x2e4815,_0x5b30cf){return respondWithRpcPromise(_0x6b1b('0x34'),_0x6b1b('0x35'),{'command':_0x5b30cf[_0x6b1b('0x36')]?util[_0x6b1b('0x37')](_0x6b1b('0x38'),_0x2e4815[_0x6b1b('0x39')],_0x5b30cf['timezone']):util['format'](_0x6b1b('0x3a'),_0x2e4815[_0x6b1b('0x39')])},client9002)[_0x6b1b('0x19')](function(_0x6379a5){var _0x309273=_0x6379a5&&_0x6379a5['indexOf']('true')>=0x0?!![]:![];logger[_0x6b1b('0x1a')](_0x6b1b('0x3b'),_0x5b30cf['id'],_0x2e4815['id'],_0x2e4815[_0x6b1b('0x39')],_0x309273?_0x6b1b('0x3c'):_0x6b1b('0x3d'),_0x5b30cf[_0x6b1b('0x36')]?_0x5b30cf[_0x6b1b('0x36')]:_0x6b1b('0x3e'));return _0x309273;})['catch'](function(_0x388413){logger[_0x6b1b('0x1f')](_0x6b1b('0x3b'),_0x5b30cf['id'],_0x2e4815['id'],_0x2e4815[_0x6b1b('0x39')],util[_0x6b1b('0x3f')](_0x388413,{'showHidden':![],'depth':null}),_0x5b30cf[_0x6b1b('0x36')]?_0x5b30cf[_0x6b1b('0x36')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x38a964){var _0x1ca343=_[_0x6b1b('0x40')](_0x38a964[_0x6b1b('0x41')][_0x6b1b('0x42')],function(_0x3d30ca){var _0xaa0b76=_0x3d30ca[_0x6b1b('0x2f')]({'plain':!![]});return iftimePromise(_0xaa0b76,_0x38a964);});return Promise[_0x6b1b('0x43')](_0x1ca343)[_0x6b1b('0x19')](function(_0x17957f){return _[_0x6b1b('0x44')](_0x17957f);});}function createInteractionObject(_0x48447a,_0x22720b,_0x34e172,_0x5422cc){var _0x5d67dd=require(_0x6b1b('0x45'));var _0x442532=new _0x5d67dd();var _0xfdc4a5=_0x442532[_0x6b1b('0x46')](_0x34e172[_0x6b1b('0x47')])['getResult']();var _0x30902c=_0x22720b[_0x6b1b('0x48')];if(_0x34e172[_0x6b1b('0x49')]){_0x30902c=_0x34e172[_0x6b1b('0x49')];}else if(_0x34e172['x-forwarded-for']){_0x30902c=_[_0x6b1b('0x4a')](_0x34e172[_0x6b1b('0x4b')]['split'](','));}return{'ContactId':_0x5422cc['id'],'ChatWebsiteId':_0x48447a,'from':(_0x5422cc['firstName']||'')+'\x20'+(_0x5422cc[_0x6b1b('0x4c')]||''),'customerIp':_0x30902c,'customerPort':_0x34e172['x-real-port']?_0x34e172[_0x6b1b('0x4d')]:null,'referer':_0x22720b[_0x6b1b('0x4e')],'browserName':_0xfdc4a5[_0x6b1b('0x4f')]['name']&&_0xfdc4a5[_0x6b1b('0x4f')][_0x6b1b('0x50')]?util[_0x6b1b('0x37')](_0x6b1b('0x51'),_0xfdc4a5[_0x6b1b('0x4f')]['name'],_0xfdc4a5['browser'][_0x6b1b('0x50')]):_0x6b1b('0x52'),'browserVersion':_0xfdc4a5[_0x6b1b('0x4f')][_0x6b1b('0x50')]||_0x6b1b('0x52'),'osName':util[_0x6b1b('0x37')](_0x6b1b('0x51'),_0xfdc4a5['os'][_0x6b1b('0x32')],_0xfdc4a5['os'][_0x6b1b('0x50')]),'osVersion':_0xfdc4a5['os'][_0x6b1b('0x50')],'deviceModel':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x54')]&&_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x55')]?util[_0x6b1b('0x37')]('%s\x20%s\x20%s',_0xfdc4a5[_0x6b1b('0x53')]['model'],_0xfdc4a5[_0x6b1b('0x53')]['vendor'],_0xfdc4a5[_0x6b1b('0x53')]['type']):null,'deviceVendor':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x55')],'deviceType':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x56')],'formData':JSON['stringify'](_0x22720b)};}exports['index']=function(_0x21b24f,_0x333ca5){var _0x7e4582={'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]},_0x50e290={},_0x265f2f={'count':0x0,'rows':[]};var _0x497b1d=_[_0x6b1b('0x40')](db['ChatWebsite'][_0x6b1b('0x59')],function(_0x49d39d){return{'name':_0x49d39d[_0x6b1b('0x5a')],'type':_0x49d39d[_0x6b1b('0x56')][_0x6b1b('0x5b')]};});_0x50e290['model']=_['map'](_0x497b1d,'name');_0x50e290[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x21b24f[_0x6b1b('0x5c')]);_0x50e290[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x50e290[_0x6b1b('0x54')],_0x50e290[_0x6b1b('0x5c')]);_0x7e4582['attributes']=_[_0x6b1b('0x5f')](_0x50e290['model'],qs[_0x6b1b('0x60')](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x7e4582[_0x6b1b('0x61')]=_0x7e4582[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x7e4582[_0x6b1b('0x61')]:_0x50e290[_0x6b1b('0x54')];if(!_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x63')]('nolimit')){_0x7e4582['limit']=qs['limit'](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x7e4582[_0x6b1b('0x27')]=qs['offset'](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}_0x7e4582[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x21b24f['query'][_0x6b1b('0x65')]);_0x7e4582[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x21b24f[_0x6b1b('0x5c')],_0x50e290['filters']),_0x497b1d);if(_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x7e4582[_0x6b1b('0x66')]=_['merge'](_0x7e4582[_0x6b1b('0x66')],{'$or':_['map'](_0x497b1d,function(_0x8bdf71){if(_0x8bdf71[_0x6b1b('0x56')]!=='VIRTUAL'){var _0x580632={};_0x580632[_0x8bdf71[_0x6b1b('0x32')]]={'$like':'%'+_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x580632;}})});}_0x7e4582=_['merge']({},_0x7e4582,_0x21b24f['options']);var _0x2cce3c={'where':_0x7e4582[_0x6b1b('0x66')]};return db[_0x6b1b('0x69')]['count'](_0x2cce3c)['then'](function(_0x104c6b){_0x265f2f['count']=_0x104c6b;if(_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x6a')]){_0x7e4582['include']=[{'all':!![]}];}return db[_0x6b1b('0x69')][_0x6b1b('0x6b')](_0x7e4582);})[_0x6b1b('0x19')](function(_0x46448a){_0x265f2f['rows']=_0x46448a;return _0x265f2f;})['then'](respondWithFilteredResult(_0x333ca5,_0x7e4582))[_0x6b1b('0x23')](handleError(_0x333ca5,null));};exports[_0x6b1b('0x6c')]=function(_0x2a828b,_0x329f4f){var _0x44c0da={'raw':![],'where':{'id':_0x2a828b[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]},_0x289ba8={};_0x289ba8['model']=_[_0x6b1b('0x5d')](db[_0x6b1b('0x69')][_0x6b1b('0x59')]);_0x289ba8[_0x6b1b('0x5c')]=_['keys'](_0x2a828b['query']);_0x289ba8[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x289ba8[_0x6b1b('0x54')],_0x289ba8['query']);_0x44c0da[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x289ba8[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x2a828b['query'][_0x6b1b('0x60')]));_0x44c0da[_0x6b1b('0x61')]=_0x44c0da[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x44c0da[_0x6b1b('0x61')]:_0x289ba8['model'];if(_0x2a828b[_0x6b1b('0x5c')][_0x6b1b('0x6a')]){_0x44c0da[_0x6b1b('0x6e')]=[{'all':!![]}];}_0x44c0da=_[_0x6b1b('0x6f')]({},_0x44c0da,_0x2a828b[_0x6b1b('0x70')]);return db[_0x6b1b('0x69')]['find'](_0x44c0da)[_0x6b1b('0x19')](handleEntityNotFound(_0x329f4f,null))[_0x6b1b('0x19')](respondWithResult(_0x329f4f,null))['catch'](handleError(_0x329f4f,null));};exports[_0x6b1b('0x71')]=function(_0xb385,_0x20818b){return db[_0x6b1b('0x69')][_0x6b1b('0x71')](_0xb385[_0x6b1b('0x72')],{})[_0x6b1b('0x19')](function(_0x20c990){var _0x45c9a4=_0xb385['user']['get']({'plain':!![]});if(!_0x45c9a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45c9a4['role']===_0x6b1b('0x73')){var _0x4c63d7=_0x20c990[_0x6b1b('0x2f')]({'plain':!![]});var _0x1771cd=_0x6b1b('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x1771cd,'userProfileId':_0x45c9a4[_0x6b1b('0x74')]},'raw':!![]})[_0x6b1b('0x19')](function(_0x2e9754){if(_0x2e9754&&_0x2e9754['autoAssociation']===0x0){return db[_0x6b1b('0x31')][_0x6b1b('0x71')]({'name':_0x4c63d7[_0x6b1b('0x32')],'resourceId':_0x4c63d7['id'],'type':_0x2e9754[_0x6b1b('0x32')],'sectionId':_0x2e9754['id']},{})[_0x6b1b('0x19')](function(){return _0x20c990;});}else{return _0x20c990;}})[_0x6b1b('0x23')](function(_0x36b1b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36b1b3);throw _0x36b1b3;});}return _0x20c990;})['then'](respondWithResult(_0x20818b,0xc9))[_0x6b1b('0x23')](handleError(_0x20818b,null));};exports['update']=function(_0x1e2807,_0x5b87e3){if(_0x1e2807[_0x6b1b('0x72')]['id']){delete _0x1e2807['body']['id'];}return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x1e2807['params']['id']},'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]})[_0x6b1b('0x19')](handleEntityNotFound(_0x5b87e3,null))[_0x6b1b('0x19')](saveUpdates(_0x1e2807[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x5b87e3,null))['catch'](handleError(_0x5b87e3,null));};exports[_0x6b1b('0x2e')]=function(_0x58eb59,_0x3405d4){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x58eb59[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3405d4,null))[_0x6b1b('0x19')](removeEntity(_0x3405d4,null))[_0x6b1b('0x23')](handleError(_0x3405d4,null));};exports[_0x6b1b('0x76')]=function(_0x4e24a6,_0x3ed706){return db[_0x6b1b('0x69')]['describe']()['then'](respondWithResult(_0x3ed706,null))[_0x6b1b('0x23')](handleError(_0x3ed706,null));};exports[_0x6b1b('0x77')]=function(_0x366bc8,_0x1a7bf1){if(_0x366bc8[_0x6b1b('0x72')]['id']){delete _0x366bc8['body']['id'];}return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x366bc8[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x1a7bf1,null))[_0x6b1b('0x19')](function(_0xda6932){if(_0xda6932){_0x366bc8[_0x6b1b('0x72')]['ChatWebsiteId']=_0xda6932['id'];return db[_0x6b1b('0x78')][_0x6b1b('0x71')](_0x366bc8[_0x6b1b('0x72')]);}})[_0x6b1b('0x19')](respondWithResult(_0x1a7bf1,null))[_0x6b1b('0x23')](handleError(_0x1a7bf1,null));};exports[_0x6b1b('0x79')]=function(_0x3a962f,_0x4e60c3){var _0x59dfe4={'raw':![],'where':{}};var _0x982261={};var _0x2bfb26={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')]['findOne']({'where':{'id':_0x3a962f[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x4e60c3,null))['then'](function(_0x5ed350){if(_0x5ed350){_0x982261[_0x6b1b('0x54')]=_['keys'](db[_0x6b1b('0x78')]['rawAttributes']);_0x982261[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x3a962f[_0x6b1b('0x5c')]);_0x982261[_0x6b1b('0x5e')]=_['intersection'](_0x982261['model'],_0x982261[_0x6b1b('0x5c')]);_0x59dfe4[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x982261[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x3a962f['query'][_0x6b1b('0x60')]));_0x59dfe4[_0x6b1b('0x61')]=_0x59dfe4[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x59dfe4[_0x6b1b('0x61')]:_0x982261['model'];if(!_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x59dfe4[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x59dfe4[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x3a962f['query'][_0x6b1b('0x27')]);}_0x59dfe4[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x3a962f['query'][_0x6b1b('0x65')]);_0x59dfe4[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x3a962f[_0x6b1b('0x5c')],_0x982261[_0x6b1b('0x5e')]));_0x59dfe4[_0x6b1b('0x66')][_0x6b1b('0x7b')]=_0x5ed350['id'];if(_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x59dfe4[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x59dfe4[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x59dfe4['attributes'],function(_0x377429){var _0x2d906d={};_0x2d906d[_0x377429]={'$like':'%'+_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x2d906d;})});}_0x59dfe4=_[_0x6b1b('0x6f')]({},_0x59dfe4,_0x3a962f['options']);return db['Disposition'][_0x6b1b('0x2a')]({'where':_0x59dfe4[_0x6b1b('0x66')]})['then'](function(_0xd35359){_0x2bfb26['count']=_0xd35359;if(_0x3a962f[_0x6b1b('0x5c')]['includeAll']){_0x59dfe4[_0x6b1b('0x6e')]=[{'all':!![]}];}return db[_0x6b1b('0x78')][_0x6b1b('0x6b')](_0x59dfe4);})[_0x6b1b('0x19')](function(_0x562d3e){_0x2bfb26[_0x6b1b('0x7c')]=_0x562d3e;return _0x2bfb26;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x4e60c3,_0x59dfe4))[_0x6b1b('0x23')](handleError(_0x4e60c3,null));};exports['removeDispositions']=function(_0x2bb7ed,_0x56346e){return db['ChatWebsite']['find']({'where':{'id':_0x2bb7ed[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x56346e,null))[_0x6b1b('0x19')](function(_0x55ba13){if(_0x55ba13){return _0x55ba13[_0x6b1b('0x7d')](_0x2bb7ed[_0x6b1b('0x5c')]['ids']);}})[_0x6b1b('0x19')](respondWithStatusCode(_0x56346e,null))[_0x6b1b('0x23')](handleError(_0x56346e,null));};exports['addAnswer']=function(_0x1cd25f,_0x2dd03c){if(_0x1cd25f[_0x6b1b('0x72')]['id']){delete _0x1cd25f[_0x6b1b('0x72')]['id'];}return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x1cd25f[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2dd03c,null))[_0x6b1b('0x19')](function(_0x422d9f){if(_0x422d9f){_0x1cd25f['body'][_0x6b1b('0x7b')]=_0x422d9f['id'];return db['CannedAnswer']['create'](_0x1cd25f[_0x6b1b('0x72')]);}})['then'](respondWithResult(_0x2dd03c,null))[_0x6b1b('0x23')](handleError(_0x2dd03c,null));};exports['getAnswers']=function(_0x5f3052,_0x1414aa){var _0xb90330={'raw':![],'where':{}};var _0x41e3e5={};var _0x3b9079={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x5f3052[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x1414aa,null))[_0x6b1b('0x19')](function(_0x1d6a9c){if(_0x1d6a9c){_0x41e3e5[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0x7f')][_0x6b1b('0x59')]);_0x41e3e5[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x5f3052[_0x6b1b('0x5c')]);_0x41e3e5[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x41e3e5['model'],_0x41e3e5['query']);_0xb90330[_0x6b1b('0x61')]=_['intersection'](_0x41e3e5[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x5f3052['query'][_0x6b1b('0x60')]));_0xb90330[_0x6b1b('0x61')]=_0xb90330['attributes'][_0x6b1b('0x62')]?_0xb90330[_0x6b1b('0x61')]:_0x41e3e5[_0x6b1b('0x54')];if(!_0x5f3052['query'][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0xb90330[_0x6b1b('0x29')]=qs['limit'](_0x5f3052[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0xb90330[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x5f3052['query'][_0x6b1b('0x27')]);}_0xb90330[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x5f3052['query'][_0x6b1b('0x65')]);_0xb90330[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x5f3052['query'],_0x41e3e5['filters']));_0xb90330['where'][_0x6b1b('0x7b')]=_0x1d6a9c['id'];if(_0x5f3052[_0x6b1b('0x5c')]['filter']){_0xb90330['where']=_[_0x6b1b('0x6f')](_0xb90330[_0x6b1b('0x66')],{'$or':_['map'](_0xb90330[_0x6b1b('0x61')],function(_0x27e4ed){var _0x1d7473={};_0x1d7473[_0x27e4ed]={'$like':'%'+_0x5f3052['query'][_0x6b1b('0x68')]+'%'};return _0x1d7473;})});}_0xb90330=_['merge']({},_0xb90330,_0x5f3052['options']);return db[_0x6b1b('0x7f')]['count']({'where':_0xb90330[_0x6b1b('0x66')]})['then'](function(_0x541833){_0x3b9079[_0x6b1b('0x2a')]=_0x541833;if(_0x5f3052['query'][_0x6b1b('0x6a')]){_0xb90330['include']=[{'all':!![]}];}return db[_0x6b1b('0x7f')][_0x6b1b('0x6b')](_0xb90330);})[_0x6b1b('0x19')](function(_0x488726){_0x3b9079[_0x6b1b('0x7c')]=_0x488726;return _0x3b9079;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x1414aa,_0xb90330))[_0x6b1b('0x23')](handleError(_0x1414aa,null));};exports['removeAnswers']=function(_0x2a7345,_0x3a9639){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x2a7345[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x3a9639,null))[_0x6b1b('0x19')](function(_0x4c4a06){if(_0x4c4a06){return _0x4c4a06[_0x6b1b('0x80')](_0x2a7345['query'][_0x6b1b('0x81')]);}})[_0x6b1b('0x19')](respondWithStatusCode(_0x3a9639,null))[_0x6b1b('0x23')](handleError(_0x3a9639,null));};exports[_0x6b1b('0x82')]=function(_0x1267a,_0x314ab2){_0x1267a[_0x6b1b('0x72')][_0x6b1b('0x83')]=_0x1267a[_0x6b1b('0x84')][_0x6b1b('0x85')];return db['ChatWebsite']['find']({'where':{'id':_0x1267a[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x314ab2,null))[_0x6b1b('0x19')](saveUpdates(_0x1267a[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x314ab2,null))[_0x6b1b('0x23')](handleError(_0x314ab2,null));};exports['addAvatar']=function(_0x4fff0a,_0x47c4cc){_0x4fff0a[_0x6b1b('0x72')][_0x6b1b('0x86')]=_0x4fff0a[_0x6b1b('0x84')]['filename'];return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x4fff0a[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x47c4cc,null))['then'](saveUpdates(_0x4fff0a['body'],null))[_0x6b1b('0x19')](respondWithResult(_0x47c4cc,null))['catch'](handleError(_0x47c4cc,null));};exports[_0x6b1b('0x87')]=function(_0x2547ef,_0x16ea40){_0x2547ef[_0x6b1b('0x72')][_0x6b1b('0x88')]=_0x2547ef['file'][_0x6b1b('0x85')];return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x2547ef['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x16ea40,null))['then'](saveUpdates(_0x2547ef[_0x6b1b('0x72')],null))['then'](respondWithResult(_0x16ea40,null))['catch'](handleError(_0x16ea40,null));};exports[_0x6b1b('0x89')]=function(_0x3e2ae5,_0x104f1e){_0x3e2ae5[_0x6b1b('0x72')][_0x6b1b('0x8a')]=_0x3e2ae5['file'][_0x6b1b('0x85')];return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x3e2ae5[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x104f1e,null))[_0x6b1b('0x19')](saveUpdates(_0x3e2ae5[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x104f1e,null))['catch'](handleError(_0x104f1e,null));};exports['getLogo']=function(_0x50810e,_0x43a5d1){var _0x48fb08=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x8d'));var _0x16313e={'where':{'id':_0x50810e['params']['id']},'attributes':['id',_0x6b1b('0x83')],'raw':!![]};var _0x436892=![];return require(_0x6b1b('0x8e'))[_0x6b1b('0x8f')]()[_0x6b1b('0x19')](function(_0x1f6964){if(_0x1f6964){_0x436892=_0x1f6964[_0x6b1b('0x90')];}})[_0x6b1b('0x19')](function(){return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x16313e);})[_0x6b1b('0x19')](handleEntityNotFound(_0x43a5d1,null))[_0x6b1b('0x19')](function(_0x3886ee){if(_0x3886ee){if(!_[_0x6b1b('0x91')](_0x3886ee[_0x6b1b('0x83')])){if(fs[_0x6b1b('0x92')](path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x93'),_0x3886ee[_0x6b1b('0x83')]))&&_0x436892){_0x48fb08=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x93'),_0x3886ee[_0x6b1b('0x83')]);}}return _0x43a5d1[_0x6b1b('0x94')](_0x48fb08);}})[_0x6b1b('0x23')](handleError(_0x43a5d1,null));};exports[_0x6b1b('0x95')]=function(_0x55e30f,_0x25d34a){var _0x58e092=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/default_avatar.png');var _0x3f9d54={'where':{'id':_0x55e30f[_0x6b1b('0x6d')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x3f9d54)['then'](handleEntityNotFound(_0x25d34a,null))['then'](function(_0x2d024a){if(_0x2d024a){if(!_[_0x6b1b('0x91')](_0x2d024a[_0x6b1b('0x86')])){if(fs['existsSync'](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/',_0x2d024a['agentAvatar']))){_0x58e092=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x2d024a['agentAvatar']);}}return _0x25d34a['download'](_0x58e092);}})[_0x6b1b('0x23')](handleError(_0x25d34a,null));};exports[_0x6b1b('0x97')]=function(_0x23d2a9,_0x566cef){var _0x1c8291=path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x98'));var _0x4ed518={'where':{'id':_0x23d2a9[_0x6b1b('0x6d')]['id']},'attributes':['id',_0x6b1b('0x88'),'showCustomerAvatar'],'raw':!![]};return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x4ed518)[_0x6b1b('0x19')](handleEntityNotFound(_0x566cef,null))[_0x6b1b('0x19')](function(_0x381fdc){if(_0x381fdc){if(!_[_0x6b1b('0x91')](_0x381fdc[_0x6b1b('0x88')])){if(fs[_0x6b1b('0x92')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x381fdc[_0x6b1b('0x88')]))&&_0x381fdc[_0x6b1b('0x99')]){_0x1c8291=path[_0x6b1b('0x8b')](config['root'],_0x6b1b('0x96'),_0x381fdc['customerAvatar']);}}return _0x566cef[_0x6b1b('0x94')](_0x1c8291);}})[_0x6b1b('0x23')](handleError(_0x566cef,null));};exports[_0x6b1b('0x9a')]=function(_0x10b4c3,_0x3a0d4a){var _0x2bdbff=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x9b'));var _0x577d3c={'where':{'id':_0x10b4c3[_0x6b1b('0x6d')]['id']},'attributes':['id',_0x6b1b('0x8a')],'raw':!![]};return db[_0x6b1b('0x69')]['find'](_0x577d3c)[_0x6b1b('0x19')](handleEntityNotFound(_0x3a0d4a,null))[_0x6b1b('0x19')](function(_0x2fc576){if(_0x2fc576){if(!_[_0x6b1b('0x91')](_0x2fc576[_0x6b1b('0x8a')])){if(fs[_0x6b1b('0x92')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/',_0x2fc576[_0x6b1b('0x8a')]))){_0x2bdbff=path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x2fc576['systemAvatar']);}}return _0x3a0d4a['download'](_0x2bdbff);}})[_0x6b1b('0x23')](handleError(_0x3a0d4a,null));};exports[_0x6b1b('0x9c')]=function(_0x3c19fe,_0x518087){var _0x2c418b={'body':_0x3c19fe[_0x6b1b('0x72')],'channel':'chat'};var _0x170710=[];var _0x5732c8=[];var _0x3e9bf3={};var _0x33bb90=![];return db[_0x6b1b('0x9d')][_0x6b1b('0x76')]()[_0x6b1b('0x19')](function(_0xb82426){if(!_0xb82426){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa0'));}_0x170710=_[_0x6b1b('0xa1')](_[_0x6b1b('0x5d')](_0xb82426),[_0x6b1b('0xa2'),'updatedAt']);_0x5732c8=_[_0x6b1b('0xa1')](_[_0x6b1b('0x5d')](_0xb82426),[_0x6b1b('0xa2'),_0x6b1b('0xa3'),_0x6b1b('0xa4'),'ListId']);if(_0x3c19fe[_0x6b1b('0x72')]['id']){delete _0x3c19fe[_0x6b1b('0x72')]['id'];}if(_[_0x6b1b('0x91')](_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')])){throw new db[(_0x6b1b('0x9e'))]['ValidationError'](_0x6b1b('0xa6'));}if(_[_0x6b1b('0x91')](_0x3c19fe['body'][_0x6b1b('0x72')])||_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0x72')]===''){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa7'));}if(_[_0x6b1b('0x91')](_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')])){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5732c8);}if(!_[_0x6b1b('0xa9')](_0x5732c8,_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')])){throw new db['Sequelize'][(_0x6b1b('0x9f'))](_0x6b1b('0xaa')+_0x5732c8);}_0x3e9bf3[_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')]]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')];})[_0x6b1b('0x19')](function(){return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x3c19fe[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0xab')],'as':_0x6b1b('0xac'),'include':[{'model':db[_0x6b1b('0x9d')],'as':_0x6b1b('0xad'),'where':_0x3e9bf3,'limit':0x1,'order':[[_0x6b1b('0xa3'),_0x6b1b('0xae')]]}]},{'model':db[_0x6b1b('0xaf')],'as':_0x6b1b('0xb0')},{'model':db[_0x6b1b('0x41')],'as':'Interval','include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x42'),'attributes':['id',_0x6b1b('0x39')],'raw':!![]}]}]});})[_0x6b1b('0x19')](function(_0x4e13e5){if(!_0x4e13e5)throw new APINotFoundError(util['format'](_0x6b1b('0xb1'),_0x3c19fe[_0x6b1b('0x6d')]['id']));if(!_0x4e13e5[_0x6b1b('0x41')]||!_0x4e13e5[_0x6b1b('0x41')]['Intervals'])return[_0x4e13e5,!![]];return[_0x4e13e5,checkWebsiteIntervals(_0x4e13e5)];})[_0x6b1b('0xb2')](function(_0x562692,_0x2a2440){if(!_0x2a2440)throw new APIOutOfIntervalError();if(!_0x562692['List'])return;_0x2c418b[_0x6b1b('0xb3')]=_0x562692;_0x2c418b[_0x6b1b('0xb4')]=_0x562692[_0x6b1b('0xac')];_0x2c418b[_0x6b1b('0xb5')]=_[_0x6b1b('0xb6')](_0x562692[_0x6b1b('0xb0')],[_0x6b1b('0xb7')],[_0x6b1b('0xb8')]);if(_0x2c418b['account']['Applications']){delete _0x2c418b[_0x6b1b('0xb3')]['Applications'];}if(_0x2c418b['account'][_0x6b1b('0xac')]&&_0x2c418b['account'][_0x6b1b('0xac')][_0x6b1b('0xad')][_0x6b1b('0x62')]){return _0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xac')]['Contacts'][0x0];}var _0x571826=_[_0x6b1b('0x12')](_0x3c19fe[_0x6b1b('0x72')],{'firstName':_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')],'ListId':_0x562692[_0x6b1b('0xb9')]});_0x571826[_0x3c19fe['body'][_0x6b1b('0xa8')]]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')];return db['CmContact'][_0x6b1b('0x71')](_0x571826,{'fields':_0x170710,'raw':!![]});})[_0x6b1b('0x19')](function(_0x301a9e){_0x2c418b[_0x6b1b('0xba')]=_0x301a9e;var _0x4fbaf3=createInteractionObject(_0x3c19fe[_0x6b1b('0x6d')]['id'],_0x3c19fe[_0x6b1b('0x72')],_0x3c19fe['headers'],_0x301a9e);var _0x27e237={'ChatWebsiteId':_0x3c19fe[_0x6b1b('0x6d')]['id'],'closed':![]};if(_0x3c19fe['body'][_0x6b1b('0xbb')]){_0x27e237[_0x6b1b('0xbb')]=_0x3c19fe['body'][_0x6b1b('0xbb')];return db[_0x6b1b('0xbc')][_0x6b1b('0x75')]({'where':_0x27e237})[_0x6b1b('0x19')](function(_0x1a545d){if(_0x1a545d){_0x33bb90=!![];return _0x1a545d;}_0x4fbaf3[_0x6b1b('0xbb')]=_0x3c19fe['body'][_0x6b1b('0xbb')];_0x4fbaf3[_0x6b1b('0xbd')]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbd')];return db['ChatInteraction'][_0x6b1b('0x71')](_0x4fbaf3);});}_0x27e237['ContactId']=_0x301a9e['id'];if(_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbe')]&&_0x3c19fe['body'][_0x6b1b('0xbe')]['id']){_0x27e237['id']=_0x3c19fe['body'][_0x6b1b('0xbe')]['id'];return db[_0x6b1b('0xbc')][_0x6b1b('0x75')]({'where':_0x27e237})['then'](function(_0x28224b){if(_0x28224b){_0x33bb90=!![];return _0x28224b;}return db[_0x6b1b('0xbc')][_0x6b1b('0x71')](_0x4fbaf3);});}return db[_0x6b1b('0xbc')]['create'](_0x4fbaf3);})[_0x6b1b('0x19')](function(_0x29f472){if(!_0x33bb90)return _0x29f472;var _0x16b250={'from':(_0x2c418b[_0x6b1b('0xba')][_0x6b1b('0xbf')]||'')+'\x20'+(_0x2c418b[_0x6b1b('0xba')][_0x6b1b('0x4c')]||'')};if(_0x3c19fe['body'][_0x6b1b('0xbb')]&&_0x3c19fe['body']['messageId']&&_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbb')]!=_0x3c19fe[_0x6b1b('0x72')]['messageId']){_0x16b250['threadId']=_0x3c19fe['body'][_0x6b1b('0xc0')];}return _0x29f472[_0x6b1b('0x2d')](_0x16b250);})['then'](function(_0x25006e){_0x2c418b[_0x6b1b('0xbe')]=_0x25006e[_0x6b1b('0x2f')]({'plain':!![]});_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc1')]=!_0x33bb90;if(_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc1')]){if(_0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xc2')]){_0x2c418b[_0x6b1b('0xb5')][_0x6b1b('0xc3')]({'id':0x0,'priority':_0x2c418b[_0x6b1b('0xb5')]['length']+0x1,'app':_0x6b1b('0xc4'),'appdata':_0x6b1b('0xc5'),'interval':_0x6b1b('0xc6')});}}return db['ChatMessage']['create']({'body':_0x3c19fe[_0x6b1b('0x72')]['body'],'ChatWebsiteId':_0x3c19fe['params']['id'],'ChatInteractionId':_0x25006e['id'],'direction':'in','ContactId':_0x2c418b['contact']['id'],'AttachmentId':_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xc7')]});})[_0x6b1b('0x19')](function(_0x39b546){_0x2c418b[_0x6b1b('0x21')]=_0x39b546;if(!_0x2c418b['interaction']['UserId']){return;}return db['User'][_0x6b1b('0x75')]({'attributes':['id',_0x6b1b('0x32')],'where':{'id':_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc8')]}});})[_0x6b1b('0x19')](function(_0x1305e1){if(_0x1305e1){_0x2c418b['applications'][_0x6b1b('0xc9')]({'id':0x0,'priority':0x0,'app':_0x6b1b('0xca'),'appdata':_0x1305e1[_0x6b1b('0x32')]+','+(_0x2c418b['account'][_0x6b1b('0xcb')]||0xa),'interval':_0x6b1b('0xc6')});_0x2c418b[_0x6b1b('0xcc')]=!![];}if(!_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xcd')]){return;}return db[_0x6b1b('0xce')][_0x6b1b('0x75')]({'attributes':['id','name'],'where':{'id':_0x2c418b['interaction'][_0x6b1b('0xcd')]}});})[_0x6b1b('0x19')](function(_0x567ae4){if(_0x567ae4){_0x2c418b[_0x6b1b('0xb5')][_0x6b1b('0xc9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x567ae4[_0x6b1b('0x32')]+','+(_0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xcf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6b1b('0xd0'),_0x6b1b('0xd1'),_0x2c418b);})[_0x6b1b('0x19')](function(_0x50988d){respondWithRpcPromise(_0x6b1b('0xd2'),_0x6b1b('0xd2'),{'event':_0x6b1b('0x9c'),'message':_0x50988d},client9002);return _0x50988d;})[_0x6b1b('0x19')](respondWithResult(_0x518087,null))[_0x6b1b('0x23')](APIHandleError(_0x518087));};exports[_0x6b1b('0xd3')]=function(_0x55a58f,_0x3e9f1b){var _0x17ab68,_0x2e09e7,_0x450434;var _0xe50eea=[];var _0xa9a8e9={};var _0x4d7c2f=_0x55a58f[_0x6b1b('0xd4')]||[];var _0x347586=[];var _0x29ba28;return db[_0x6b1b('0x9d')][_0x6b1b('0x76')]()[_0x6b1b('0x19')](function(_0x41b975){if(!_0x41b975){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa0'));}_0xe50eea=_[_0x6b1b('0xa1')](_['keys'](_0x41b975),[_0x6b1b('0xa2'),'updatedAt',_0x6b1b('0xa4'),_0x6b1b('0xb9')]);if(_0x55a58f[_0x6b1b('0x72')]['id']){delete _0x55a58f[_0x6b1b('0x72')]['id'];}if(_['isNil'](_0x55a58f['body'][_0x6b1b('0xa5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db[(_0x6b1b('0x9e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x6b1b('0x91')](_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0x72')])||_0x55a58f['body'][_0x6b1b('0x72')]===''){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db[(_0x6b1b('0x9e'))]['ValidationError'](_0x6b1b('0xa7')));}if(_[_0x6b1b('0x91')](_0x55a58f['body'][_0x6b1b('0xd5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe50eea));}if(!_[_0x6b1b('0xa9')](_0xe50eea,_0x55a58f['body'][_0x6b1b('0xd5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)[_0x6b1b('0x33')](new db['Sequelize'][(_0x6b1b('0x9f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe50eea));}_0xa9a8e9[_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xd5')]]=_0x55a58f['body'][_0x6b1b('0xa5')];})['then'](function(){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x55a58f['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x6b1b('0xd6')],'as':_0x6b1b('0xd6')}]});})['then'](handleEntityNotFound(_0x3e9f1b,null))[_0x6b1b('0x19')](function(_0x2761fe){if(_0x2761fe&&_0x2761fe[_0x6b1b('0xac')]){_0x2e09e7=_0x2761fe;var _0xa0b9a6=_['defaults'](_0x55a58f['body'],{'firstName':_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')],'phone':_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')],'ListId':_0x2761fe['ListId']});_0xa0b9a6[_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xd5')]]=_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')];return db[_0x6b1b('0x9d')][_0x6b1b('0xd7')]({'where':_0xa9a8e9,'defaults':_0xa0b9a6});}})['spread'](function(_0x5cb777){if(_0x5cb777){_0x450434=_0x5cb777;var _0xcf4b3=fs['readFileSync'](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0xd8')),_0x6b1b('0xd9'));var _0x1c62db=ejs[_0x6b1b('0xda')](_0xcf4b3,{'body':_[_0x6b1b('0xdb')](_0x55a58f['body'][_0x6b1b('0x72')]),'bodyTitle':_0x2e09e7[_0x6b1b('0xdc')]});return db[_0x6b1b('0xdd')][_0x6b1b('0x71')]({'body':_0x1c62db,'plainBody':htmlToText['fromString'](_0x1c62db),'ContactId':_0x5cb777['id'],'ChatWebsiteId':_0x2e09e7['id']});}})[_0x6b1b('0x19')](function(_0x8a51cc){_0x29ba28=_0x8a51cc;if(_0x4d7c2f['length']){var _0x51a5aa=_0x4d7c2f[_0x6b1b('0x40')](function(_0x1999cc){return{'name':_0x1999cc['originalname'],'basename':_0x1999cc['filename'],'type':_0x1999cc[_0x6b1b('0xde')],'ChatOfflineMessageId':_0x8a51cc['id']};});_0x347586=_0x51a5aa[_0x6b1b('0x40')](_0x2ac12c=>{var _0x3d0c90={'filename':_0x2ac12c['name'],'path':path[_0x6b1b('0x8b')](config['root'],_0x6b1b('0xdf'),_0x6b1b('0xd4'),_0x6b1b('0xe0'),_0x6b1b('0xe1'),_0x2ac12c[_0x6b1b('0xe2')])};return _0x3d0c90;});if(!_0x2e09e7[_0x6b1b('0xe3')]){return db['sequelize']['transaction'](function(_0x25acb2){return db['Attachment']['bulkCreate'](_0x51a5aa,{'transaction':_0x25acb2});});}}})[_0x6b1b('0x19')](function(){if(_0x29ba28){_0x17ab68=_0x29ba28;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6b1b('0xe4')],'as':_0x6b1b('0xe5'),'raw':!![],'include':[{'model':db[_0x6b1b('0xe6')],'as':_0x6b1b('0xe6'),'raw':!![]}]}]});}})[_0x6b1b('0x19')](function(_0x27dc8d){if(_0x27dc8d&&_0x27dc8d[_0x6b1b('0xe5')]&&_0x2e09e7['forwardOffline']&&_0x2e09e7[_0x6b1b('0xe7')]){var _0x48822c=_0x27dc8d[_0x6b1b('0xe8')]();return respondWithRpcPromise('SendMail',_0x6b1b('0xe9'),{'account':_0x48822c,'message':{'from':util[_0x6b1b('0x37')](_0x6b1b('0xea'),_0x27dc8d[_0x6b1b('0x32')],_0x27dc8d[_0x6b1b('0xeb')]||_0x27dc8d[_0x6b1b('0xe5')]['user']),'to':_0x2e09e7[_0x6b1b('0xe7')],'subject':_0x2e09e7['offlineMessageSubject'],'html':_0x17ab68['body'],'attachments':_0x347586}},client9003)['then'](function(){return _0x17ab68;})['catch'](function(_0x15480a){logger[_0x6b1b('0x1f')](_0x15480a);});}})['then'](function(){if(_0x2e09e7&&_0x2e09e7[_0x6b1b('0xe3')]&&_0x2e09e7[_0x6b1b('0xec')]){var _0x3c90d1=[];if(_0x4d7c2f[_0x6b1b('0x62')]){_0x3c90d1=_0x4d7c2f['map'](function(_0x571663){return{'name':_0x571663[_0x6b1b('0xed')],'basename':_0x571663[_0x6b1b('0x85')],'type':_0x571663[_0x6b1b('0xde')],'ChatOfflineMessageId':_0x29ba28['id']};});}var _0x31769c;if(!_[_0x6b1b('0x91')](_0x2e09e7[_0x6b1b('0xee')])){var _0x3521df=_[_0x6b1b('0x40')](_0x55a58f[_0x6b1b('0x72')],function(_0x45a3fb){return _0x45a3fb;});var _0xbdda13=_[_0x6b1b('0xef')](_0x3521df)[0x0];var _0x2b80ea=_[_0x6b1b('0xf0')](_0xbdda13,function(_0x2c7641){return _0x2c7641;});_0x31769c=_0x2b80ea[0x1][_0x2e09e7['subjectOffline']];}var _0x46a19a={'from':_0x450434[_0x6b1b('0xeb')],'firstName':_0x450434[_0x6b1b('0xbf')],'lastName':_0x450434[_0x6b1b('0x4c')],'mapKey':_0x6b1b('0xeb'),'message':{'from':_0x450434[_0x6b1b('0xeb')],'to':_0x2e09e7[_0x6b1b('0xd6')][_0x6b1b('0xeb')],'cc':'','subject':_[_0x6b1b('0x91')](_0x31769c)?_0x2e09e7[_0x6b1b('0xf1')]:_0x31769c,'messageId':'','sentAt':new Date(),'attach':_0x3c90d1[_0x6b1b('0x62')],'attachments':_0x3c90d1,'originChannel':_0x6b1b('0xf2'),'ChatWebsiteId':_0x2e09e7['id'],'ChatOfflineMessageId':_0x17ab68['id'],'originTo':_0x2e09e7['MailAccount'][_0x6b1b('0xeb')]},'body':_0x17ab68[_0x6b1b('0x72')]};var _0x383c79={'account':{'id':_0x2e09e7[_0x6b1b('0xec')]},'body':_0x46a19a,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x6b1b('0xf3'),_0x6b1b('0xf4'),_0x383c79,client9001)[_0x6b1b('0x19')](function(){return _0x17ab68;})[_0x6b1b('0x23')](function(_0x404f80){logger[_0x6b1b('0x1f')](_0x404f80);});}return;})['then'](function(){if(_0x17ab68){return _0x17ab68;}})[_0x6b1b('0x19')](respondWithResult(_0x3e9f1b,null))[_0x6b1b('0x23')](function(){for(var _0x547317 of _0x4d7c2f){var _0x50b970=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0xdf'),_0x6b1b('0xd4'),_0x6b1b('0xe0'),_0x6b1b('0xe1'),_0x547317['filename']);fs_extra['remove'](_0x50b970)[_0x6b1b('0x23')](function(_0x32d319){logger[_0x6b1b('0x1f')](_0x6b1b('0xf5'),_0x50b970,_0x32d319);});}});};exports[_0x6b1b('0xf6')]=function(_0x29d6c4,_0x59bf56){return db['ChatInteraction'][_0x6b1b('0x75')]({'where':{'id':_0x29d6c4[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x59bf56,null))[_0x6b1b('0x19')](function(_0x1839e7){if(_0x1839e7){return _0x1839e7['addInteraction'](_0x29d6c4[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x29d6c4[_0x6b1b('0x72')],['ids','id'])||{});}})[_0x6b1b('0x19')](respondWithResult(_0x59bf56,null))[_0x6b1b('0x23')](handleError(_0x59bf56,null));};exports[_0x6b1b('0xf8')]=function(_0xfa4faf,_0x51b5c6){var _0x70c0e3={'raw':![],'where':{}};var _0x49c27d={};var _0x12a399={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0xfa4faf[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x51b5c6,null))[_0x6b1b('0x19')](function(_0x4afd36){if(_0x4afd36){_0x49c27d[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xbc')][_0x6b1b('0x59')]);_0x49c27d[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0xfa4faf[_0x6b1b('0x5c')]);_0x49c27d[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x49c27d[_0x6b1b('0x54')],_0x49c27d[_0x6b1b('0x5c')]);_0x70c0e3[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x49c27d[_0x6b1b('0x54')],qs['fields'](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x70c0e3[_0x6b1b('0x61')]=_0x70c0e3['attributes'][_0x6b1b('0x62')]?_0x70c0e3[_0x6b1b('0x61')]:_0x49c27d[_0x6b1b('0x54')];if(!_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x70c0e3['limit']=qs[_0x6b1b('0x29')](_0xfa4faf['query'][_0x6b1b('0x29')]);_0x70c0e3['offset']=qs['offset'](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}_0x70c0e3[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x70c0e3['where']=qs[_0x6b1b('0x5e')](_['pick'](_0xfa4faf[_0x6b1b('0x5c')],_0x49c27d['filters']));_0x70c0e3[_0x6b1b('0x66')]['ChatWebsiteId']=_0x4afd36['id'];if(_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x70c0e3['where']=_['merge'](_0x70c0e3[_0x6b1b('0x66')],{'$or':_['map'](_0x70c0e3['attributes'],function(_0x12a9f5){var _0x3b1b64={};_0x3b1b64[_0x12a9f5]={'$like':'%'+_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x3b1b64;})});}_0x70c0e3=_['merge']({},_0x70c0e3,_0xfa4faf[_0x6b1b('0x70')]);return db[_0x6b1b('0xbc')][_0x6b1b('0x2a')]({'where':_0x70c0e3[_0x6b1b('0x66')]})[_0x6b1b('0x19')](function(_0xe2697d){_0x12a399[_0x6b1b('0x2a')]=_0xe2697d;if(_0xfa4faf['query'][_0x6b1b('0x6a')]){_0x70c0e3['include']=[{'model':db[_0x6b1b('0x9d')],'as':'Contact','required':![]},{'model':db[_0x6b1b('0xf9')],'as':_0x6b1b('0xfa'),'attributes':[_0x6b1b('0x32'),'fullname','internal'],'required':![]},{'model':db[_0x6b1b('0xfb')],'as':_0x6b1b('0xfc'),'attributes':['id',_0x6b1b('0x32'),_0x6b1b('0xfd')],'where':_0xfa4faf['query'][_0x6b1b('0xfe')]?{'id':_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0xfe')]}:undefined,'required':_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0xfe')]?!![]:![]}];}return db[_0x6b1b('0xbc')][_0x6b1b('0x6b')](_0x70c0e3);})[_0x6b1b('0x19')](function(_0x585555){_0x12a399[_0x6b1b('0x7c')]=_0x585555;return _0x12a399;});}})['then'](respondWithFilteredResult(_0x51b5c6,_0x70c0e3))[_0x6b1b('0x23')](handleError(_0x51b5c6,null));};exports['getSnippet']=function(_0x189fae,_0x5b2c7d){var _0x30a760=0x0;var _0x43b0ce=0x0;var _0x154a4c=![];var _0x331d0b;var _0x360db4;return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x189fae[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x41'),'include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x42'),'attributes':['id',_0x6b1b('0x39')]}]}]})[_0x6b1b('0x19')](handleEntityNotFound(_0x5b2c7d,null))[_0x6b1b('0x19')](function(_0x26c84a){if(_0x26c84a){_0x331d0b=_0x26c84a;return _0x26c84a['getProactiveActions']({'raw':!![]});}})[_0x6b1b('0x19')](function(_0x103aa2){if(_0x331d0b){if(_0x103aa2){_0x360db4=_0x103aa2;}}return require(_0x6b1b('0x8e'))[_0x6b1b('0x8f')]();})[_0x6b1b('0x19')](function(_0x11a2d7){if(_0x11a2d7){_0x43b0ce=_0x11a2d7[_0x6b1b('0xff')];_0x154a4c=_0x11a2d7[_0x6b1b('0x90')];}})['then'](function(){return db[_0x6b1b('0xbc')]['count']({'where':{'closed':![]}});})[_0x6b1b('0x19')](function(_0x1286f6){_0x30a760=_0x1286f6;if(_0x43b0ce&&_0x1286f6>_0x43b0ce){return db[_0x6b1b('0x100')][_0x6b1b('0x7e')]({'where':{'id':0x1}})[_0x6b1b('0x19')](function(_0x53991a){if(_0x53991a){_0x53991a['increment']('chatLicenseExceeded');}});}})['then'](function(){if(!_0x331d0b[_0x6b1b('0x41')]||!_0x331d0b[_0x6b1b('0x41')][_0x6b1b('0x42')])return!![];return checkWebsiteIntervals(_0x331d0b);})[_0x6b1b('0x19')](function(_0x6e5b9a){var _0x5c0584=fs[_0x6b1b('0x101')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x102')),_0x6b1b('0xd9'));var _0x442193=new url[(_0x6b1b('0x103'))](_0x331d0b['address'])['origin'];var _0x57dc59=_0x6b1b('0x104');var _0x5708c1=![];var _0x5946d0={'chatVersion':_0x57dc59,'chatWebsiteAddressOrigin':_0x442193,'remote':_0x331d0b[_0x6b1b('0x105')],'query':querystring['stringify'](_['merge'](_0x331d0b[_0x6b1b('0x2f')]({'plain':!![]}),{'customerIp':_0x189fae[_0x6b1b('0x106')][_0x6b1b('0x4b')]||_0x189fae[_0x6b1b('0x106')][_0x6b1b('0x107')]||_0x189fae[_0x6b1b('0x108')][_0x6b1b('0x109')]||_0x189fae['ip'],'referer':_0x189fae['headers'][_0x6b1b('0x4e')],'openedInteractions':_0x30a760,'maxInteractions':_0x43b0ce,'virtual':_0x154a4c[_0x6b1b('0xff')],'online':_0x6e5b9a,'custom':_0x154a4c}))[_0x6b1b('0x10a')](/'/g,'\x5c\x27')};_0x5b2c7d[_0x6b1b('0x33')](ejs[_0x6b1b('0xda')](Mustache[_0x6b1b('0xda')](_0x5c0584,_0x5946d0),{'proactiveActions':_0x360db4,'alignment':_0x331d0b[_0x6b1b('0x10b')],'verticalAlignment':_0x331d0b[_0x6b1b('0x10c')],'div_color':_0x331d0b[_0x6b1b('0xfd')],'labelText':_0x331d0b[_0x6b1b('0x10d')],'text_color':_0x331d0b['textColor'],'text_button_color':_0x331d0b['textButtonColor'],'button_color':_0x331d0b['color_button'],'background_color':_0x331d0b[_0x6b1b('0x10e')],'hideWhenOffline':_0x331d0b['hideWhenOffline'],'intervalId':_0x331d0b['IntervalId'],'isDevelopment':_0x5708c1,'chatVersion':_0x57dc59}));})[_0x6b1b('0x23')](handleError(_0x5b2c7d,null));};exports[_0x6b1b('0x10f')]=function(_0x141457,_0x549e50){var _0x1b0f3a=_0x141457['params']['id'];var _0xb0dbf1=_0x141457[_0x6b1b('0x72')];var _0x261aee=0xc8;var _0x50fd12=null;return db[_0x6b1b('0x110')]['transaction']({'isolationLevel':db['sequelize'][_0x6b1b('0x111')][_0x6b1b('0x112')][_0x6b1b('0x113')]},function(_0x3e8034){return db[_0x6b1b('0x69')]['findOne']({'where':{'id':_0x1b0f3a},'transaction':_0x3e8034})['then'](function(_0x1183ca){if(_0x1183ca){return db['ChatApplication'][_0x6b1b('0x2e')]({'where':{'ChatWebsiteId':_0x1b0f3a},'transaction':_0x3e8034})[_0x6b1b('0x19')](function(){var _0x51e6ef=_[_0x6b1b('0x40')](_0xb0dbf1,function(_0x6b706c){_0x6b706c[_0x6b1b('0x7b')]=_0x1b0f3a;return _0x6b706c;});return db[_0x6b1b('0xaf')][_0x6b1b('0x114')](_0x51e6ef,{'transaction':_0x3e8034});});}else{_0x261aee=0x194;_0x50fd12=[];}});})[_0x6b1b('0x19')](function(){if(_0x261aee!==0x194){return db[_0x6b1b('0xaf')][_0x6b1b('0x115')]({'where':{'ChatWebsiteId':_0x1b0f3a},'order':_0x6b1b('0xb7')})[_0x6b1b('0x19')](function(_0x3143f2){_0x50fd12=_0x3143f2;});}})[_0x6b1b('0x23')](function(_0x3ff800){_0x261aee=0x1f4;logger[_0x6b1b('0x1f')](_0x3ff800[_0x6b1b('0x116')]);if(_0x3ff800['name']){delete _0x3ff800[_0x6b1b('0x32')];}_0x50fd12=_0x3ff800;})[_0x6b1b('0x117')](function(){if(_0x50fd12===null){_0x549e50['sendStatus'](_0x261aee);}else{if(_0x261aee===0x1f4){_0x549e50[_0x6b1b('0x25')](_0x261aee)['send'](_0x50fd12);}else{_0x549e50[_0x6b1b('0x25')](_0x261aee)[_0x6b1b('0x26')](_0x50fd12);}}});};exports['getApplications']=function(_0x3b5853,_0x4d0556){var _0x376e18={};var _0x453f93={};var _0x5643e1;var _0x1d1d59;return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x3b5853['params']['id']}})['then'](handleEntityNotFound(_0x4d0556,null))[_0x6b1b('0x19')](function(_0x312b54){if(_0x312b54){_0x5643e1=_0x312b54;_0x453f93[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xaf')][_0x6b1b('0x59')]);_0x453f93['query']=_[_0x6b1b('0x5d')](_0x3b5853[_0x6b1b('0x5c')]);_0x453f93['filters']=_[_0x6b1b('0x5f')](_0x453f93[_0x6b1b('0x54')],_0x453f93[_0x6b1b('0x5c')]);_0x376e18['attributes']=_[_0x6b1b('0x5f')](_0x453f93[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x376e18[_0x6b1b('0x61')]=_0x376e18['attributes']['length']?_0x376e18[_0x6b1b('0x61')]:_0x453f93[_0x6b1b('0x54')];_0x376e18[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x376e18[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x3b5853['query'],_0x453f93['filters']));if(_0x3b5853[_0x6b1b('0x5c')]['filter']){_0x376e18[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x376e18[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x376e18[_0x6b1b('0x61')],function(_0x5377b5){var _0x54e7be={};_0x54e7be[_0x5377b5]={'$like':'%'+_0x3b5853[_0x6b1b('0x5c')]['filter']+'%'};return _0x54e7be;})});}_0x376e18=_[_0x6b1b('0x6f')]({},_0x376e18,_0x3b5853[_0x6b1b('0x70')]);return _0x5643e1['getApplications'](_0x376e18);}})[_0x6b1b('0x19')](function(_0x2119b8){if(_0x2119b8){_0x1d1d59=_0x2119b8[_0x6b1b('0x62')];if(!_0x3b5853[_0x6b1b('0x5c')]['hasOwnProperty'](_0x6b1b('0x7a'))){_0x376e18[_0x6b1b('0x29')]=qs['limit'](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x376e18[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}return _0x5643e1['getApplications'](_0x376e18);}})[_0x6b1b('0x19')](function(_0x2185b0){if(_0x2185b0){return _0x2185b0?{'count':_0x1d1d59,'rows':_0x2185b0}:null;}})[_0x6b1b('0x19')](respondWithResult(_0x4d0556,null))['catch'](handleError(_0x4d0556,null));};exports[_0x6b1b('0x118')]=function(_0x30471b,_0x459d0a){return db['chatProactiveAction']['find']({'where':{'id':_0x30471b[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x459d0a,null))[_0x6b1b('0x19')](function(_0x549261){if(_0x549261){return _0x549261['addProactiveActions'](_0x30471b[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x30471b[_0x6b1b('0x72')],[_0x6b1b('0x81'),'id'])||{});}})[_0x6b1b('0x19')](respondWithResult(_0x459d0a,null))[_0x6b1b('0x23')](handleError(_0x459d0a,null));};exports['getProactiveActions']=function(_0x57cc0a,_0xd182d8){var _0x3047e5={};var _0x3349b7={};var _0x5c9497;var _0x36e8a5;return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x57cc0a['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0xd182d8,null))[_0x6b1b('0x19')](function(_0x4b4b72){if(_0x4b4b72){_0x5c9497=_0x4b4b72;_0x3349b7[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0x119')][_0x6b1b('0x59')]);_0x3349b7[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x57cc0a[_0x6b1b('0x5c')]);_0x3349b7[_0x6b1b('0x5e')]=_['intersection'](_0x3349b7[_0x6b1b('0x54')],_0x3349b7['query']);_0x3047e5[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x3349b7['model'],qs['fields'](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x3047e5[_0x6b1b('0x61')]=_0x3047e5['attributes']['length']?_0x3047e5[_0x6b1b('0x61')]:_0x3349b7[_0x6b1b('0x54')];_0x3047e5[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x3047e5[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x57cc0a[_0x6b1b('0x5c')],_0x3349b7[_0x6b1b('0x5e')]));if(_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x3047e5[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x3047e5['where'],{'$or':_['map'](_0x3047e5[_0x6b1b('0x61')],function(_0x26d45f){var _0x27381b={};_0x27381b[_0x26d45f]={'$like':'%'+_0x57cc0a['query'][_0x6b1b('0x68')]+'%'};return _0x27381b;})});}_0x3047e5=_['merge']({},_0x3047e5,_0x57cc0a[_0x6b1b('0x70')]);return _0x5c9497['getProactiveActions'](_0x3047e5);}})[_0x6b1b('0x19')](function(_0x516894){if(_0x516894){_0x36e8a5=_0x516894[_0x6b1b('0x62')];if(!_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x63')]('nolimit')){_0x3047e5[_0x6b1b('0x29')]=qs['limit'](_0x57cc0a['query'][_0x6b1b('0x29')]);_0x3047e5['offset']=qs['offset'](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}return _0x5c9497['getProactiveActions'](_0x3047e5);}})[_0x6b1b('0x19')](function(_0x187b55){if(_0x187b55){return _0x187b55?{'count':_0x36e8a5,'rows':_0x187b55}:null;}})[_0x6b1b('0x19')](respondWithResult(_0xd182d8,null))['catch'](handleError(_0xd182d8,null));};exports[_0x6b1b('0x11a')]=function(_0x4adad3,_0x125a3f){var _0x2ccf04=_0x4adad3[_0x6b1b('0x5c')][_0x6b1b('0x11b')]===_0x6b1b('0x11c')?_0x6b1b('0x11d'):_0x6b1b('0x11e');return db['ChatWebsite'][_0x6b1b('0x75')]({'attributes':['id',_0x2ccf04],'where':{'id':_0x4adad3[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x125a3f,null))['then'](function(_0x2b65d2){if(_0x2b65d2){var _0x489839=_0x2b65d2[_0x2ccf04];var _0x1f4ead=_0x489839&&_0x489839[_0x6b1b('0x11f')]?_0x489839[_0x6b1b('0x11f')]:[];_0x125a3f['send']({'fromKey':_[_0x6b1b('0x91')](_0x489839[_0x6b1b('0x120')])?undefined:_0x489839['fromKey'],'count':_0x1f4ead[_0x6b1b('0x62')],'rows':_0x1f4ead});}})[_0x6b1b('0x23')](handleError(_0x125a3f,null));};exports[_0x6b1b('0x121')]=function(_0x2cce36,_0x13e2a9){var _0x42547c={'raw':![],'where':{}};var _0xa8e337={};var _0x3e4214={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x2cce36['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x13e2a9,null))[_0x6b1b('0x19')](function(_0x51744a){if(_0x51744a){_0xa8e337[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xdd')][_0x6b1b('0x59')]);_0xa8e337[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x2cce36[_0x6b1b('0x5c')]);_0xa8e337['filters']=_[_0x6b1b('0x5f')](_0xa8e337[_0x6b1b('0x54')],_0xa8e337[_0x6b1b('0x5c')]);_0x42547c[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0xa8e337['model'],qs[_0x6b1b('0x60')](_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x42547c['attributes']=_0x42547c[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x42547c['attributes']:_0xa8e337['model'];if(!_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x42547c[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x2cce36['query']['limit']);_0x42547c[_0x6b1b('0x27')]=qs['offset'](_0x2cce36[_0x6b1b('0x5c')]['offset']);}_0x42547c[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x2cce36['query'][_0x6b1b('0x65')]);_0x42547c[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x2cce36[_0x6b1b('0x5c')],_0xa8e337[_0x6b1b('0x5e')]));_0x42547c[_0x6b1b('0x66')][_0x6b1b('0x7b')]=_0x51744a['id'];if(_0x2cce36[_0x6b1b('0x5c')]['filter']){_0x42547c[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x42547c[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x42547c[_0x6b1b('0x61')],function(_0x32de72){var _0x54429a={};_0x54429a[_0x32de72]={'$like':'%'+_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x54429a;})});}_0x42547c=_[_0x6b1b('0x6f')]({},_0x42547c,_0x2cce36[_0x6b1b('0x70')]);return db[_0x6b1b('0xdd')][_0x6b1b('0x2a')]({'where':_0x42547c[_0x6b1b('0x66')]})['then'](function(_0xb3b02e){_0x3e4214[_0x6b1b('0x2a')]=_0xb3b02e;if(_0x2cce36[_0x6b1b('0x5c')]['includeAll']){_0x42547c[_0x6b1b('0x6e')]=[{'all':!![]}];}else{_0x42547c['include']=[{'model':db['CmContact'],'as':_0x6b1b('0x122'),'required':![]},{'model':db[_0x6b1b('0x123')],'as':'Attachments','required':![]}];}return db[_0x6b1b('0xdd')][_0x6b1b('0x6b')](_0x42547c);})['then'](function(_0x87a703){_0x3e4214[_0x6b1b('0x7c')]=_0x87a703;return _0x3e4214;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x13e2a9,_0x42547c))[_0x6b1b('0x23')](handleError(_0x13e2a9,null));};exports['addAgents']=function(_0x543ad4,_0x22b0ae){return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x543ad4[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x22b0ae,null))[_0x6b1b('0x19')](function(_0x38c3c0){if(_0x38c3c0){return _0x38c3c0[_0x6b1b('0x124')](_0x543ad4[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x543ad4['body'],['ids','id'])||{})[_0x6b1b('0xb2')](function(_0x4ce305){for(var _0x205e08=0x0;_0x205e08<_0x543ad4[_0x6b1b('0x72')][_0x6b1b('0x81')][_0x6b1b('0x62')];_0x205e08+=0x1){socket[_0x6b1b('0x125')](_0x6b1b('0x126'),{'UserId':Number(_0x543ad4[_0x6b1b('0x72')]['ids'][_0x205e08]),'ChatWebsiteId':Number(_0x543ad4[_0x6b1b('0x6d')]['id'])});}return _0x4ce305;});}})['then'](respondWithResult(_0x22b0ae,null))['catch'](handleError(_0x22b0ae,null));};exports['removeAgents']=function(_0x555c1d,_0x16db6f){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x555c1d[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x16db6f,null))[_0x6b1b('0x19')](function(_0x3cb482){if(_0x3cb482){return _0x3cb482['removeAgents'](_0x555c1d['query']['ids'])['then'](function(){if(_[_0x6b1b('0x127')](_0x555c1d['query'][_0x6b1b('0x81')])){for(var _0x4eae43=0x0;_0x4eae43<_0x555c1d[_0x6b1b('0x5c')][_0x6b1b('0x81')][_0x6b1b('0x62')];_0x4eae43+=0x1){socket[_0x6b1b('0x125')](_0x6b1b('0x128'),{'UserId':Number(_0x555c1d['query'][_0x6b1b('0x81')][_0x4eae43]),'ChatWebsiteId':Number(_0x555c1d[_0x6b1b('0x6d')]['id'])});}}else{socket[_0x6b1b('0x125')](_0x6b1b('0x128'),{'UserId':Number(_0x555c1d[_0x6b1b('0x5c')][_0x6b1b('0x81')]),'ChatWebsiteId':Number(_0x555c1d[_0x6b1b('0x6d')]['id'])});}});}})['then'](respondWithStatusCode(_0x16db6f,null))[_0x6b1b('0x23')](handleError(_0x16db6f,null));};exports['getAgents']=function(_0x363859,_0x4a5b53){var _0x31fc30={};var _0x48bdff={};var _0x4fc237;var _0xa127c0;return db['ChatWebsite'][_0x6b1b('0x7e')]({'where':{'id':_0x363859[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4a5b53,null))['then'](function(_0x16be0c){if(_0x16be0c){_0x4fc237=_0x16be0c;_0x48bdff['model']=_[_0x6b1b('0x5d')](db[_0x6b1b('0xf9')][_0x6b1b('0x59')]);_0x48bdff[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x363859[_0x6b1b('0x5c')]);_0x48bdff[_0x6b1b('0x5e')]=_['intersection'](_0x48bdff[_0x6b1b('0x54')],_0x48bdff[_0x6b1b('0x5c')]);_0x31fc30['attributes']=_[_0x6b1b('0x5f')](_0x48bdff[_0x6b1b('0x54')],qs['fields'](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x31fc30[_0x6b1b('0x61')]=_0x31fc30[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x31fc30[_0x6b1b('0x61')]:_0x48bdff[_0x6b1b('0x54')];_0x31fc30[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x31fc30[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_['pick'](_0x363859[_0x6b1b('0x5c')],_0x48bdff[_0x6b1b('0x5e')]));if(_0x363859[_0x6b1b('0x5c')]['filter']){_0x31fc30[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x31fc30[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x31fc30[_0x6b1b('0x61')],function(_0x5f3a25){var _0x2b4ffc={};_0x2b4ffc[_0x5f3a25]={'$like':'%'+_0x363859['query'][_0x6b1b('0x68')]+'%'};return _0x2b4ffc;})});}_0x31fc30=_[_0x6b1b('0x6f')]({},_0x31fc30,_0x363859[_0x6b1b('0x70')]);return _0x4fc237[_0x6b1b('0x129')](_0x31fc30);}})['then'](function(_0x2de54e){if(_0x2de54e){_0xa127c0=_0x2de54e[_0x6b1b('0x62')];if(!_0x363859[_0x6b1b('0x5c')]['hasOwnProperty'](_0x6b1b('0x7a'))){_0x31fc30[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x31fc30['offset']=qs[_0x6b1b('0x27')](_0x363859[_0x6b1b('0x5c')]['offset']);}return _0x4fc237[_0x6b1b('0x129')](_0x31fc30);}})[_0x6b1b('0x19')](function(_0x3906d8){if(_0x3906d8){return _0x3906d8?{'count':_0xa127c0,'rows':_0x3906d8}:null;}})[_0x6b1b('0x19')](respondWithResult(_0x4a5b53,null))['catch'](handleError(_0x4a5b53,null));}; \ No newline at end of file +var _0x68d3=['created','autoclose','applications','push','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','mapValues','firstName','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','tag','getSnippet','getProactiveActions','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','address','3.5.0','remoteAddress','virtual','verticalAlignment','color','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','ioredis','../../config/logger','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','timezone','format','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','map','Interval','Intervals','get','some','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','browser','%s\x20%s','version','unknown','device','model','vendor','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','sitepic','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','orderBy','priority','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x68d3,0x197));var _0x368d=function(_0x2e78cb,_0x111663){_0x2e78cb=_0x2e78cb-0x0;var _0x10176a=_0x68d3[_0x2e78cb];return _0x10176a;};'use strict';var Mustache=require(_0x368d('0x0'));var util=require(_0x368d('0x1'));var path=require(_0x368d('0x2'));var ejs=require(_0x368d('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x368d('0x4'));var querystring=require(_0x368d('0x5'));var htmlToText=require('html-to-text');var Redis=require(_0x368d('0x6'));var jayson=require('jayson/promise');var url=require('url');var qs=require('../../components/parsers/qs');var logger=require(_0x368d('0x7'))('api');var config=require('../../config/environment');var APIOutOfIntervalError=require(_0x368d('0x8'))['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')[_0x368d('0x9')];var APIHandleError=require(_0x368d('0x8'))[_0x368d('0xa')];var db=require(_0x368d('0xb'))['db'];config[_0x368d('0xc')]=_[_0x368d('0xd')](config[_0x368d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x368d('0xe'))(new Redis(config['redis']));require(_0x368d('0xf'))[_0x368d('0x10')](socket);var client=jayson[_0x368d('0x11')][_0x368d('0x12')]({'port':0x232c});var client9002=jayson[_0x368d('0x11')][_0x368d('0x12')]({'port':0x232a});var client9003=jayson[_0x368d('0x11')][_0x368d('0x12')]({'port':0x232b});var client9001=jayson[_0x368d('0x11')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3156b6,_0x3cfa0d,_0x568483,_0x4933c6){return new Promise(function(_0xe76048,_0x2bf4bb){var _0x2342eb=_0x4933c6||client;return _0x2342eb['request'](_0x3156b6,_0x568483)[_0x368d('0x13')](function(_0x5d9fb8){logger[_0x368d('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x3cfa0d,_0x368d('0x15'));logger[_0x368d('0x16')](_0x368d('0x17'),_0x3cfa0d,_0x368d('0x15'),JSON[_0x368d('0x18')](_0x5d9fb8));if(_0x5d9fb8[_0x368d('0x19')]){if(_0x5d9fb8[_0x368d('0x19')][_0x368d('0x1a')]===0x1f4){logger[_0x368d('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x3cfa0d,_0x5d9fb8[_0x368d('0x19')][_0x368d('0x1b')]);return _0x2bf4bb(_0x5d9fb8[_0x368d('0x19')][_0x368d('0x1b')]);}logger[_0x368d('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x3cfa0d,_0x5d9fb8[_0x368d('0x19')][_0x368d('0x1b')]);return _0xe76048(_0x5d9fb8['error'][_0x368d('0x1b')]);}else{logger[_0x368d('0x14')](_0x368d('0x1c'),_0x3cfa0d,_0x368d('0x15'));_0xe76048(_0x5d9fb8[_0x368d('0x1d')]['message']);}})[_0x368d('0x1e')](function(_0x4e8867){logger['error'](_0x368d('0x1c'),_0x3cfa0d,_0x4e8867);_0x2bf4bb(_0x4e8867);});});}function respondWithStatusCode(_0x2f0c27,_0x3045ce){_0x3045ce=_0x3045ce||0xcc;return function(_0x511369){if(_0x511369){return _0x2f0c27['sendStatus'](_0x3045ce);}return _0x2f0c27[_0x368d('0x1f')](_0x3045ce)[_0x368d('0x20')]();};}function respondWithResult(_0x58188b,_0x57f535){_0x57f535=_0x57f535||0xc8;return function(_0x4a78be){if(_0x4a78be){return _0x58188b['status'](_0x57f535)[_0x368d('0x21')](_0x4a78be);}};}function respondWithFilteredResult(_0x5a74dc,_0x11ea62){return function(_0x392e85){if(_0x392e85){var _0x83f367=typeof _0x11ea62['offset']===_0x368d('0x22')&&typeof _0x11ea62['limit']===_0x368d('0x22');var _0x3892b7=_0x392e85[_0x368d('0x23')];var _0x7a0d3a=_0x83f367?0x0:_0x11ea62[_0x368d('0x24')];var _0x7b395a=_0x83f367?_0x392e85[_0x368d('0x23')]:_0x11ea62[_0x368d('0x24')]+_0x11ea62[_0x368d('0x25')];var _0x22fb16;if(_0x7b395a>=_0x3892b7){_0x7b395a=_0x3892b7;_0x22fb16=0xc8;}else{_0x22fb16=0xce;}_0x5a74dc['status'](_0x22fb16);return _0x5a74dc[_0x368d('0x26')](_0x368d('0x27'),_0x7a0d3a+'-'+_0x7b395a+'/'+_0x3892b7)[_0x368d('0x21')](_0x392e85);}return null;};}function saveUpdates(_0x5765f1){return function(_0x40fcc9){if(_0x40fcc9){return _0x40fcc9[_0x368d('0x28')](_0x5765f1)['then'](function(_0x574131){return _0x574131;});}return null;};}function removeEntity(_0x4a36c6){return function(_0x25d15e){if(_0x25d15e){return _0x25d15e[_0x368d('0x29')]()[_0x368d('0x13')](function(){var _0x226605=_0x25d15e['get']({'plain':!![]});var _0x2270e8=_0x368d('0x2a');return db[_0x368d('0x2b')][_0x368d('0x29')]({'where':{'type':_0x2270e8,'resourceId':_0x226605['id']}})['then'](function(){return _0x25d15e;});})['then'](function(){_0x4a36c6[_0x368d('0x1f')](0xcc)[_0x368d('0x20')]();});}};}function handleEntityNotFound(_0xfbc710){return function(_0x47f3b6){if(!_0x47f3b6){_0xfbc710[_0x368d('0x2c')](0x194);}return _0x47f3b6;};}function handleError(_0x34eca9,_0x5dfc26){_0x5dfc26=_0x5dfc26||0x1f4;return function(_0x24e989){logger[_0x368d('0x19')](_0x24e989[_0x368d('0x2d')]);if(_0x24e989['name']){delete _0x24e989[_0x368d('0x2e')];}_0x34eca9[_0x368d('0x1f')](_0x5dfc26)['send'](_0x24e989);};}function iftimePromise(_0x6dee69,_0x5b3bf1){return respondWithRpcPromise('Command','getSnippet',{'command':_0x5b3bf1[_0x368d('0x2f')]?util[_0x368d('0x30')]('iftime\x20%s,%s',_0x6dee69[_0x368d('0x31')],_0x5b3bf1[_0x368d('0x2f')]):util[_0x368d('0x30')](_0x368d('0x32'),_0x6dee69[_0x368d('0x31')])},client9002)['then'](function(_0x5a5cd5){var _0x59b915=_0x5a5cd5&&_0x5a5cd5['indexOf'](_0x368d('0x33'))>=0x0?!![]:![];logger[_0x368d('0x14')](_0x368d('0x34'),_0x5b3bf1['id'],_0x6dee69['id'],_0x6dee69[_0x368d('0x31')],_0x59b915?_0x368d('0x35'):'OFFLINE',_0x5b3bf1[_0x368d('0x2f')]?_0x5b3bf1[_0x368d('0x2f')]:_0x368d('0x36'));return _0x59b915;})[_0x368d('0x1e')](function(_0x1c8f95){logger[_0x368d('0x19')](_0x368d('0x34'),_0x5b3bf1['id'],_0x6dee69['id'],_0x6dee69[_0x368d('0x31')],util[_0x368d('0x37')](_0x1c8f95,{'showHidden':![],'depth':null}),_0x5b3bf1[_0x368d('0x2f')]?_0x5b3bf1['timezone']:_0x368d('0x36'));return![];});}function checkWebsiteIntervals(_0xba6d4b){var _0x3997d0=_[_0x368d('0x38')](_0xba6d4b[_0x368d('0x39')][_0x368d('0x3a')],function(_0xe8fee0){var _0x818a08=_0xe8fee0[_0x368d('0x3b')]({'plain':!![]});return iftimePromise(_0x818a08,_0xba6d4b);});return Promise['all'](_0x3997d0)[_0x368d('0x13')](function(_0x4140a4){return _[_0x368d('0x3c')](_0x4140a4);});}function createInteractionObject(_0x37cdea,_0x5a9fba,_0x4ee179,_0x51b7bb){var _0x44886d=require(_0x368d('0x3d'));var _0x3fdad7=new _0x44886d();var _0x5dcbae=_0x3fdad7[_0x368d('0x3e')](_0x4ee179[_0x368d('0x3f')])['getResult']();var _0x2b3c21=_0x5a9fba[_0x368d('0x40')];if(_0x4ee179[_0x368d('0x41')]){_0x2b3c21=_0x4ee179[_0x368d('0x41')];}else if(_0x4ee179[_0x368d('0x42')]){_0x2b3c21=_[_0x368d('0x43')](_0x4ee179[_0x368d('0x42')][_0x368d('0x44')](','));}return{'ContactId':_0x51b7bb['id'],'ChatWebsiteId':_0x37cdea,'from':(_0x51b7bb['firstName']||'')+'\x20'+(_0x51b7bb[_0x368d('0x45')]||''),'customerIp':_0x2b3c21,'customerPort':_0x4ee179['x-real-port']?_0x4ee179['x-real-port']:null,'referer':_0x5a9fba['referer'],'browserName':_0x5dcbae[_0x368d('0x46')][_0x368d('0x2e')]&&_0x5dcbae[_0x368d('0x46')]['version']?util[_0x368d('0x30')](_0x368d('0x47'),_0x5dcbae[_0x368d('0x46')][_0x368d('0x2e')],_0x5dcbae[_0x368d('0x46')][_0x368d('0x48')]):_0x368d('0x49'),'browserVersion':_0x5dcbae[_0x368d('0x46')][_0x368d('0x48')]||_0x368d('0x49'),'osName':util['format']('%s\x20%s',_0x5dcbae['os'][_0x368d('0x2e')],_0x5dcbae['os'][_0x368d('0x48')]),'osVersion':_0x5dcbae['os'][_0x368d('0x48')],'deviceModel':_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4b')]&&_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4c')]?util[_0x368d('0x30')]('%s\x20%s\x20%s',_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4b')],_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4c')],_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4d')]):null,'deviceVendor':_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4c')],'deviceType':_0x5dcbae[_0x368d('0x4a')][_0x368d('0x4d')],'formData':JSON[_0x368d('0x18')](_0x5a9fba)};}exports[_0x368d('0x4e')]=function(_0x47e1c8,_0x1600a3){var _0x351aa7={'include':[{'model':db[_0x368d('0x4f')],'as':_0x368d('0x50')}]},_0x4fd438={},_0x192de5={'count':0x0,'rows':[]};var _0x14cf2a=_[_0x368d('0x38')](db[_0x368d('0x51')][_0x368d('0x52')],function(_0x192253){return{'name':_0x192253['fieldName'],'type':_0x192253[_0x368d('0x4d')][_0x368d('0x53')]};});_0x4fd438[_0x368d('0x4b')]=_[_0x368d('0x38')](_0x14cf2a,_0x368d('0x2e'));_0x4fd438[_0x368d('0x54')]=_[_0x368d('0x55')](_0x47e1c8['query']);_0x4fd438['filters']=_[_0x368d('0x56')](_0x4fd438[_0x368d('0x4b')],_0x4fd438[_0x368d('0x54')]);_0x351aa7[_0x368d('0x57')]=_[_0x368d('0x56')](_0x4fd438[_0x368d('0x4b')],qs[_0x368d('0x58')](_0x47e1c8[_0x368d('0x54')][_0x368d('0x58')]));_0x351aa7[_0x368d('0x57')]=_0x351aa7[_0x368d('0x57')]['length']?_0x351aa7[_0x368d('0x57')]:_0x4fd438[_0x368d('0x4b')];if(!_0x47e1c8[_0x368d('0x54')][_0x368d('0x59')](_0x368d('0x5a'))){_0x351aa7[_0x368d('0x25')]=qs[_0x368d('0x25')](_0x47e1c8['query'][_0x368d('0x25')]);_0x351aa7[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x47e1c8['query'][_0x368d('0x24')]);}_0x351aa7[_0x368d('0x5b')]=qs['sort'](_0x47e1c8[_0x368d('0x54')][_0x368d('0x5c')]);_0x351aa7['where']=qs[_0x368d('0x5d')](_[_0x368d('0x5e')](_0x47e1c8[_0x368d('0x54')],_0x4fd438[_0x368d('0x5d')]),_0x14cf2a);if(_0x47e1c8['query'][_0x368d('0x5f')]){_0x351aa7[_0x368d('0x60')]=_[_0x368d('0x61')](_0x351aa7[_0x368d('0x60')],{'$or':_[_0x368d('0x38')](_0x14cf2a,function(_0x31f756){if(_0x31f756['type']!==_0x368d('0x62')){var _0xf89911={};_0xf89911[_0x31f756[_0x368d('0x2e')]]={'$like':'%'+_0x47e1c8[_0x368d('0x54')]['filter']+'%'};return _0xf89911;}})});}_0x351aa7=_['merge']({},_0x351aa7,_0x47e1c8[_0x368d('0x63')]);var _0x53874a={'where':_0x351aa7[_0x368d('0x60')]};return db[_0x368d('0x51')][_0x368d('0x23')](_0x53874a)['then'](function(_0x425241){_0x192de5[_0x368d('0x23')]=_0x425241;if(_0x47e1c8[_0x368d('0x54')][_0x368d('0x64')]){_0x351aa7[_0x368d('0x65')]=[{'all':!![]}];}return db['ChatWebsite'][_0x368d('0x66')](_0x351aa7);})[_0x368d('0x13')](function(_0xd0b09a){_0x192de5[_0x368d('0x67')]=_0xd0b09a;return _0x192de5;})[_0x368d('0x13')](respondWithFilteredResult(_0x1600a3,_0x351aa7))[_0x368d('0x1e')](handleError(_0x1600a3,null));};exports['show']=function(_0x284a0a,_0xee339a){var _0x11b87b={'raw':![],'where':{'id':_0x284a0a[_0x368d('0x68')]['id']},'include':[{'model':db[_0x368d('0x4f')],'as':_0x368d('0x50')}]},_0x13cce4={};_0x13cce4[_0x368d('0x4b')]=_[_0x368d('0x55')](db['ChatWebsite']['rawAttributes']);_0x13cce4['query']=_[_0x368d('0x55')](_0x284a0a[_0x368d('0x54')]);_0x13cce4['filters']=_[_0x368d('0x56')](_0x13cce4[_0x368d('0x4b')],_0x13cce4[_0x368d('0x54')]);_0x11b87b['attributes']=_[_0x368d('0x56')](_0x13cce4[_0x368d('0x4b')],qs['fields'](_0x284a0a[_0x368d('0x54')][_0x368d('0x58')]));_0x11b87b[_0x368d('0x57')]=_0x11b87b['attributes']['length']?_0x11b87b[_0x368d('0x57')]:_0x13cce4[_0x368d('0x4b')];if(_0x284a0a['query'][_0x368d('0x64')]){_0x11b87b[_0x368d('0x65')]=[{'all':!![]}];}_0x11b87b=_['merge']({},_0x11b87b,_0x284a0a[_0x368d('0x63')]);return db[_0x368d('0x51')][_0x368d('0x69')](_0x11b87b)[_0x368d('0x13')](handleEntityNotFound(_0xee339a,null))[_0x368d('0x13')](respondWithResult(_0xee339a,null))['catch'](handleError(_0xee339a,null));};exports[_0x368d('0x6a')]=function(_0x53574b,_0x4a69f7){return db[_0x368d('0x51')][_0x368d('0x6a')](_0x53574b[_0x368d('0x6b')],{})[_0x368d('0x13')](function(_0x19107b){var _0x44b56a=_0x53574b[_0x368d('0x6c')][_0x368d('0x3b')]({'plain':!![]});if(!_0x44b56a)throw new Error(_0x368d('0x6d'));if(_0x44b56a[_0x368d('0x6e')]===_0x368d('0x6c')){var _0x305c97=_0x19107b[_0x368d('0x3b')]({'plain':!![]});var _0x3cef94='ChatWebsites';return db['UserProfileSection'][_0x368d('0x69')]({'where':{'name':_0x3cef94,'userProfileId':_0x44b56a['userProfileId']},'raw':!![]})[_0x368d('0x13')](function(_0x1fc582){if(_0x1fc582&&_0x1fc582['autoAssociation']===0x0){return db[_0x368d('0x2b')][_0x368d('0x6a')]({'name':_0x305c97[_0x368d('0x2e')],'resourceId':_0x305c97['id'],'type':_0x1fc582[_0x368d('0x2e')],'sectionId':_0x1fc582['id']},{})[_0x368d('0x13')](function(){return _0x19107b;});}else{return _0x19107b;}})[_0x368d('0x1e')](function(_0x757833){logger[_0x368d('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x757833);throw _0x757833;});}return _0x19107b;})[_0x368d('0x13')](respondWithResult(_0x4a69f7,0xc9))[_0x368d('0x1e')](handleError(_0x4a69f7,null));};exports[_0x368d('0x28')]=function(_0x5390e1,_0x32d358){if(_0x5390e1['body']['id']){delete _0x5390e1['body']['id'];}return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x5390e1[_0x368d('0x68')]['id']},'include':[{'model':db['Pause'],'as':_0x368d('0x50')}]})['then'](handleEntityNotFound(_0x32d358,null))[_0x368d('0x13')](saveUpdates(_0x5390e1[_0x368d('0x6b')],null))['then'](respondWithResult(_0x32d358,null))[_0x368d('0x1e')](handleError(_0x32d358,null));};exports[_0x368d('0x29')]=function(_0x2c4409,_0x801ef9){return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x2c4409[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x801ef9,null))['then'](removeEntity(_0x801ef9,null))['catch'](handleError(_0x801ef9,null));};exports[_0x368d('0x6f')]=function(_0x54b186,_0x33ed7e){return db[_0x368d('0x51')][_0x368d('0x6f')]()[_0x368d('0x13')](respondWithResult(_0x33ed7e,null))[_0x368d('0x1e')](handleError(_0x33ed7e,null));};exports[_0x368d('0x70')]=function(_0x33de20,_0xd32b9f){if(_0x33de20['body']['id']){delete _0x33de20[_0x368d('0x6b')]['id'];}return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x33de20[_0x368d('0x68')]['id']}})['then'](handleEntityNotFound(_0xd32b9f,null))['then'](function(_0x570f7a){if(_0x570f7a){_0x33de20[_0x368d('0x6b')][_0x368d('0x71')]=_0x570f7a['id'];return db[_0x368d('0x72')][_0x368d('0x6a')](_0x33de20[_0x368d('0x6b')]);}})['then'](respondWithResult(_0xd32b9f,null))[_0x368d('0x1e')](handleError(_0xd32b9f,null));};exports[_0x368d('0x73')]=function(_0x277519,_0x129ebd){var _0x2e22bc={'raw':![],'where':{}};var _0x5750c5={};var _0x3dbcdb={'count':0x0,'rows':[]};return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x277519['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x129ebd,null))['then'](function(_0x2c4b5a){if(_0x2c4b5a){_0x5750c5[_0x368d('0x4b')]=_[_0x368d('0x55')](db[_0x368d('0x72')][_0x368d('0x52')]);_0x5750c5[_0x368d('0x54')]=_[_0x368d('0x55')](_0x277519['query']);_0x5750c5['filters']=_[_0x368d('0x56')](_0x5750c5[_0x368d('0x4b')],_0x5750c5[_0x368d('0x54')]);_0x2e22bc[_0x368d('0x57')]=_[_0x368d('0x56')](_0x5750c5[_0x368d('0x4b')],qs[_0x368d('0x58')](_0x277519['query'][_0x368d('0x58')]));_0x2e22bc[_0x368d('0x57')]=_0x2e22bc[_0x368d('0x57')][_0x368d('0x75')]?_0x2e22bc[_0x368d('0x57')]:_0x5750c5[_0x368d('0x4b')];if(!_0x277519[_0x368d('0x54')]['hasOwnProperty'](_0x368d('0x5a'))){_0x2e22bc[_0x368d('0x25')]=qs['limit'](_0x277519[_0x368d('0x54')][_0x368d('0x25')]);_0x2e22bc['offset']=qs[_0x368d('0x24')](_0x277519[_0x368d('0x54')]['offset']);}_0x2e22bc[_0x368d('0x5b')]=qs[_0x368d('0x5c')](_0x277519[_0x368d('0x54')]['sort']);_0x2e22bc[_0x368d('0x60')]=qs['filters'](_[_0x368d('0x5e')](_0x277519[_0x368d('0x54')],_0x5750c5[_0x368d('0x5d')]));_0x2e22bc[_0x368d('0x60')]['ChatWebsiteId']=_0x2c4b5a['id'];if(_0x277519[_0x368d('0x54')]['filter']){_0x2e22bc[_0x368d('0x60')]=_[_0x368d('0x61')](_0x2e22bc[_0x368d('0x60')],{'$or':_[_0x368d('0x38')](_0x2e22bc[_0x368d('0x57')],function(_0x118013){var _0x2cd49c={};_0x2cd49c[_0x118013]={'$like':'%'+_0x277519['query'][_0x368d('0x5f')]+'%'};return _0x2cd49c;})});}_0x2e22bc=_[_0x368d('0x61')]({},_0x2e22bc,_0x277519[_0x368d('0x63')]);return db[_0x368d('0x72')][_0x368d('0x23')]({'where':_0x2e22bc[_0x368d('0x60')]})['then'](function(_0x276409){_0x3dbcdb[_0x368d('0x23')]=_0x276409;if(_0x277519[_0x368d('0x54')]['includeAll']){_0x2e22bc['include']=[{'all':!![]}];}return db[_0x368d('0x72')][_0x368d('0x66')](_0x2e22bc);})[_0x368d('0x13')](function(_0x4f70c5){_0x3dbcdb['rows']=_0x4f70c5;return _0x3dbcdb;});}})[_0x368d('0x13')](respondWithFilteredResult(_0x129ebd,_0x2e22bc))[_0x368d('0x1e')](handleError(_0x129ebd,null));};exports[_0x368d('0x76')]=function(_0x5cbce1,_0x1ae904){return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0x5cbce1['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x1ae904,null))[_0x368d('0x13')](function(_0x500b11){if(_0x500b11){return _0x500b11[_0x368d('0x76')](_0x5cbce1[_0x368d('0x54')][_0x368d('0x77')]);}})[_0x368d('0x13')](respondWithStatusCode(_0x1ae904,null))['catch'](handleError(_0x1ae904,null));};exports[_0x368d('0x78')]=function(_0x44c431,_0x565408){if(_0x44c431[_0x368d('0x6b')]['id']){delete _0x44c431[_0x368d('0x6b')]['id'];}return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0x44c431['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x565408,null))['then'](function(_0x2121c7){if(_0x2121c7){_0x44c431[_0x368d('0x6b')][_0x368d('0x71')]=_0x2121c7['id'];return db[_0x368d('0x79')][_0x368d('0x6a')](_0x44c431[_0x368d('0x6b')]);}})['then'](respondWithResult(_0x565408,null))[_0x368d('0x1e')](handleError(_0x565408,null));};exports[_0x368d('0x7a')]=function(_0x20d396,_0x571e8a){var _0x261f93={'raw':![],'where':{}};var _0x1eb4ea={};var _0x1bfa8f={'count':0x0,'rows':[]};return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x20d396['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x571e8a,null))['then'](function(_0x8ca809){if(_0x8ca809){_0x1eb4ea[_0x368d('0x4b')]=_[_0x368d('0x55')](db[_0x368d('0x79')][_0x368d('0x52')]);_0x1eb4ea[_0x368d('0x54')]=_[_0x368d('0x55')](_0x20d396[_0x368d('0x54')]);_0x1eb4ea['filters']=_[_0x368d('0x56')](_0x1eb4ea[_0x368d('0x4b')],_0x1eb4ea[_0x368d('0x54')]);_0x261f93['attributes']=_[_0x368d('0x56')](_0x1eb4ea[_0x368d('0x4b')],qs['fields'](_0x20d396['query'][_0x368d('0x58')]));_0x261f93[_0x368d('0x57')]=_0x261f93['attributes'][_0x368d('0x75')]?_0x261f93['attributes']:_0x1eb4ea[_0x368d('0x4b')];if(!_0x20d396[_0x368d('0x54')][_0x368d('0x59')](_0x368d('0x5a'))){_0x261f93[_0x368d('0x25')]=qs[_0x368d('0x25')](_0x20d396[_0x368d('0x54')][_0x368d('0x25')]);_0x261f93['offset']=qs[_0x368d('0x24')](_0x20d396[_0x368d('0x54')][_0x368d('0x24')]);}_0x261f93[_0x368d('0x5b')]=qs[_0x368d('0x5c')](_0x20d396[_0x368d('0x54')]['sort']);_0x261f93['where']=qs['filters'](_['pick'](_0x20d396[_0x368d('0x54')],_0x1eb4ea[_0x368d('0x5d')]));_0x261f93[_0x368d('0x60')][_0x368d('0x71')]=_0x8ca809['id'];if(_0x20d396[_0x368d('0x54')][_0x368d('0x5f')]){_0x261f93[_0x368d('0x60')]=_['merge'](_0x261f93[_0x368d('0x60')],{'$or':_['map'](_0x261f93[_0x368d('0x57')],function(_0xb47839){var _0x5ee08a={};_0x5ee08a[_0xb47839]={'$like':'%'+_0x20d396[_0x368d('0x54')]['filter']+'%'};return _0x5ee08a;})});}_0x261f93=_[_0x368d('0x61')]({},_0x261f93,_0x20d396[_0x368d('0x63')]);return db[_0x368d('0x79')][_0x368d('0x23')]({'where':_0x261f93[_0x368d('0x60')]})['then'](function(_0x40e99d){_0x1bfa8f[_0x368d('0x23')]=_0x40e99d;if(_0x20d396[_0x368d('0x54')][_0x368d('0x64')]){_0x261f93[_0x368d('0x65')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x261f93);})[_0x368d('0x13')](function(_0x5c1237){_0x1bfa8f[_0x368d('0x67')]=_0x5c1237;return _0x1bfa8f;});}})[_0x368d('0x13')](respondWithFilteredResult(_0x571e8a,_0x261f93))[_0x368d('0x1e')](handleError(_0x571e8a,null));};exports['removeAnswers']=function(_0x95f640,_0x10dc03){return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0x95f640[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x10dc03,null))[_0x368d('0x13')](function(_0x5f2ff6){if(_0x5f2ff6){return _0x5f2ff6[_0x368d('0x7b')](_0x95f640[_0x368d('0x54')]['ids']);}})['then'](respondWithStatusCode(_0x10dc03,null))['catch'](handleError(_0x10dc03,null));};exports['addLogo']=function(_0x406878,_0x2bef6f){_0x406878[_0x368d('0x6b')]['sitepic']=_0x406878[_0x368d('0x7c')][_0x368d('0x7d')];return db[_0x368d('0x51')]['find']({'where':{'id':_0x406878[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x2bef6f,null))[_0x368d('0x13')](saveUpdates(_0x406878[_0x368d('0x6b')],null))[_0x368d('0x13')](respondWithResult(_0x2bef6f,null))[_0x368d('0x1e')](handleError(_0x2bef6f,null));};exports[_0x368d('0x7e')]=function(_0x37641d,_0x3fa229){_0x37641d[_0x368d('0x6b')][_0x368d('0x7f')]=_0x37641d[_0x368d('0x7c')][_0x368d('0x7d')];return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x37641d['params']['id']}})['then'](handleEntityNotFound(_0x3fa229,null))[_0x368d('0x13')](saveUpdates(_0x37641d[_0x368d('0x6b')],null))[_0x368d('0x13')](respondWithResult(_0x3fa229,null))[_0x368d('0x1e')](handleError(_0x3fa229,null));};exports[_0x368d('0x80')]=function(_0xf5db50,_0x334c98){_0xf5db50['body'][_0x368d('0x81')]=_0xf5db50['file']['filename'];return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0xf5db50[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x334c98,null))[_0x368d('0x13')](saveUpdates(_0xf5db50['body'],null))['then'](respondWithResult(_0x334c98,null))[_0x368d('0x1e')](handleError(_0x334c98,null));};exports[_0x368d('0x82')]=function(_0x27a450,_0x253d31){_0x27a450['body'][_0x368d('0x83')]=_0x27a450[_0x368d('0x7c')][_0x368d('0x7d')];return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0x27a450[_0x368d('0x68')]['id']}})['then'](handleEntityNotFound(_0x253d31,null))[_0x368d('0x13')](saveUpdates(_0x27a450['body'],null))[_0x368d('0x13')](respondWithResult(_0x253d31,null))[_0x368d('0x1e')](handleError(_0x253d31,null));};exports[_0x368d('0x84')]=function(_0x1dae78,_0x2128a6){var _0x1a5456=path[_0x368d('0x85')](config[_0x368d('0x86')],'server/files/images/logos/default_logo.svg');var _0x5a3445={'where':{'id':_0x1dae78[_0x368d('0x68')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1ec1d=![];return require(_0x368d('0x87'))[_0x368d('0x88')]()[_0x368d('0x13')](function(_0x16ba6e){if(_0x16ba6e){_0x1ec1d=_0x16ba6e['custom'];}})['then'](function(){return db[_0x368d('0x51')][_0x368d('0x69')](_0x5a3445);})[_0x368d('0x13')](handleEntityNotFound(_0x2128a6,null))[_0x368d('0x13')](function(_0x20d11a){if(_0x20d11a){if(!_[_0x368d('0x89')](_0x20d11a[_0x368d('0x8a')])){if(fs[_0x368d('0x8b')](path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0x8c'),_0x20d11a[_0x368d('0x8a')]))&&_0x1ec1d){_0x1a5456=path['join'](config[_0x368d('0x86')],_0x368d('0x8c'),_0x20d11a[_0x368d('0x8a')]);}}return _0x2128a6[_0x368d('0x8d')](_0x1a5456);}})[_0x368d('0x1e')](handleError(_0x2128a6,null));};exports[_0x368d('0x8e')]=function(_0x1758d1,_0x3ea983){var _0x2ebf24=path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0x8f'));var _0x1855d7={'where':{'id':_0x1758d1[_0x368d('0x68')]['id']},'attributes':['id',_0x368d('0x7f')],'raw':!![]};return db[_0x368d('0x51')]['find'](_0x1855d7)[_0x368d('0x13')](handleEntityNotFound(_0x3ea983,null))[_0x368d('0x13')](function(_0x595924){if(_0x595924){if(!_[_0x368d('0x89')](_0x595924[_0x368d('0x7f')])){if(fs[_0x368d('0x8b')](path['join'](config[_0x368d('0x86')],'server/files/images/avatars/',_0x595924[_0x368d('0x7f')]))){_0x2ebf24=path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0x90'),_0x595924['agentAvatar']);}}return _0x3ea983[_0x368d('0x8d')](_0x2ebf24);}})[_0x368d('0x1e')](handleError(_0x3ea983,null));};exports[_0x368d('0x91')]=function(_0xf20d97,_0x2c9841){var _0x342451=path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0x92'));var _0x5d6880={'where':{'id':_0xf20d97[_0x368d('0x68')]['id']},'attributes':['id',_0x368d('0x81'),_0x368d('0x93')],'raw':!![]};return db[_0x368d('0x51')][_0x368d('0x69')](_0x5d6880)[_0x368d('0x13')](handleEntityNotFound(_0x2c9841,null))[_0x368d('0x13')](function(_0x5c21fc){if(_0x5c21fc){if(!_[_0x368d('0x89')](_0x5c21fc[_0x368d('0x81')])){if(fs[_0x368d('0x8b')](path['join'](config[_0x368d('0x86')],_0x368d('0x90'),_0x5c21fc[_0x368d('0x81')]))&&_0x5c21fc['showCustomerAvatar']){_0x342451=path[_0x368d('0x85')](config[_0x368d('0x86')],'server/files/images/avatars/',_0x5c21fc[_0x368d('0x81')]);}}return _0x2c9841[_0x368d('0x8d')](_0x342451);}})[_0x368d('0x1e')](handleError(_0x2c9841,null));};exports['getSystemAvatar']=function(_0x12740d,_0x4c4b58){var _0x435ed0=path[_0x368d('0x85')](config['root'],_0x368d('0x94'));var _0x416a5c={'where':{'id':_0x12740d['params']['id']},'attributes':['id',_0x368d('0x83')],'raw':!![]};return db[_0x368d('0x51')][_0x368d('0x69')](_0x416a5c)['then'](handleEntityNotFound(_0x4c4b58,null))[_0x368d('0x13')](function(_0x4339f1){if(_0x4339f1){if(!_[_0x368d('0x89')](_0x4339f1['systemAvatar'])){if(fs['existsSync'](path['join'](config[_0x368d('0x86')],_0x368d('0x90'),_0x4339f1[_0x368d('0x83')]))){_0x435ed0=path[_0x368d('0x85')](config['root'],'server/files/images/avatars/',_0x4339f1['systemAvatar']);}}return _0x4c4b58[_0x368d('0x8d')](_0x435ed0);}})['catch'](handleError(_0x4c4b58,null));};exports[_0x368d('0x95')]=function(_0xe98bd0,_0x165968){var _0x194f2b={'body':_0xe98bd0['body'],'channel':_0x368d('0x96')};var _0x255010=[];var _0x447a37=[];var _0x365c23={};var _0x5d1336=![];return db[_0x368d('0x97')][_0x368d('0x6f')]()['then'](function(_0x1f2ac1){if(!_0x1f2ac1){throw new db[(_0x368d('0x98'))][(_0x368d('0x99'))](_0x368d('0x9a'));}_0x255010=_[_0x368d('0x9b')](_['keys'](_0x1f2ac1),['createdAt',_0x368d('0x9c')]);_0x447a37=_[_0x368d('0x9b')](_['keys'](_0x1f2ac1),[_0x368d('0x9d'),'updatedAt',_0x368d('0x9e'),_0x368d('0x9f')]);if(_0xe98bd0['body']['id']){delete _0xe98bd0['body']['id'];}if(_[_0x368d('0x89')](_0xe98bd0[_0x368d('0x6b')][_0x368d('0xa0')])){throw new db[(_0x368d('0x98'))][(_0x368d('0x99'))](_0x368d('0xa1'));}if(_[_0x368d('0x89')](_0xe98bd0[_0x368d('0x6b')][_0x368d('0x6b')])||_0xe98bd0[_0x368d('0x6b')][_0x368d('0x6b')]===''){throw new db['Sequelize'][(_0x368d('0x99'))](_0x368d('0xa2'));}if(_['isNil'](_0xe98bd0[_0x368d('0x6b')][_0x368d('0xa3')])){throw new db[(_0x368d('0x98'))][(_0x368d('0x99'))](_0x368d('0xa4')+_0x447a37);}if(!_[_0x368d('0xa5')](_0x447a37,_0xe98bd0[_0x368d('0x6b')][_0x368d('0xa3')])){throw new db[(_0x368d('0x98'))][(_0x368d('0x99'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x447a37);}_0x365c23[_0xe98bd0[_0x368d('0x6b')]['mapKey']]=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xa0')];})[_0x368d('0x13')](function(){return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0xe98bd0[_0x368d('0x68')]['id']},'include':[{'model':db[_0x368d('0xa6')],'as':_0x368d('0xa7'),'include':[{'model':db[_0x368d('0x97')],'as':_0x368d('0xa8'),'where':_0x365c23,'limit':0x1,'order':[[_0x368d('0x9c'),_0x368d('0xa9')]]}]},{'model':db[_0x368d('0xaa')],'as':_0x368d('0xab')},{'model':db[_0x368d('0x39')],'as':'Interval','include':[{'model':db[_0x368d('0x39')],'as':_0x368d('0x3a'),'attributes':['id',_0x368d('0x31')],'raw':!![]}]}]});})[_0x368d('0x13')](function(_0x560b0f){if(!_0x560b0f)throw new APINotFoundError(util[_0x368d('0x30')](_0x368d('0xac'),_0xe98bd0[_0x368d('0x68')]['id']));if(!_0x560b0f[_0x368d('0x39')]||!_0x560b0f[_0x368d('0x39')][_0x368d('0x3a')])return[_0x560b0f,!![]];return[_0x560b0f,checkWebsiteIntervals(_0x560b0f)];})[_0x368d('0xad')](function(_0x36fc61,_0x38a053){if(!_0x38a053)throw new APIOutOfIntervalError();if(!_0x36fc61['List'])return;_0x194f2b[_0x368d('0xae')]=_0x36fc61;_0x194f2b['list']=_0x36fc61[_0x368d('0xa7')];_0x194f2b['applications']=_[_0x368d('0xaf')](_0x36fc61[_0x368d('0xab')],[_0x368d('0xb0')],['asc']);if(_0x194f2b['account'][_0x368d('0xab')]){delete _0x194f2b['account']['Applications'];}if(_0x194f2b[_0x368d('0xae')][_0x368d('0xa7')]&&_0x194f2b['account'][_0x368d('0xa7')]['Contacts'][_0x368d('0x75')]){return _0x194f2b['account']['List']['Contacts'][0x0];}var _0x234eef=_[_0x368d('0xd')](_0xe98bd0['body'],{'firstName':_0xe98bd0['body'][_0x368d('0xa0')],'ListId':_0x36fc61[_0x368d('0x9f')]});_0x234eef[_0xe98bd0[_0x368d('0x6b')][_0x368d('0xa3')]]=_0xe98bd0['body'][_0x368d('0xa0')];return db['CmContact']['create'](_0x234eef,{'fields':_0x255010,'raw':!![]});})['then'](function(_0x323b05){_0x194f2b['contact']=_0x323b05;var _0x1510b3=createInteractionObject(_0xe98bd0['params']['id'],_0xe98bd0[_0x368d('0x6b')],_0xe98bd0[_0x368d('0xb1')],_0x323b05);var _0x6169d4={'ChatWebsiteId':_0xe98bd0[_0x368d('0x68')]['id'],'closed':![]};if(_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb2')]){_0x6169d4[_0x368d('0xb2')]=_0xe98bd0['body'][_0x368d('0xb2')];return db[_0x368d('0xb3')][_0x368d('0x69')]({'where':_0x6169d4})['then'](function(_0xef4bc7){if(_0xef4bc7){_0x5d1336=!![];return _0xef4bc7;}_0x1510b3[_0x368d('0xb2')]=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb2')];_0x1510b3[_0x368d('0xb4')]=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb4')];return db[_0x368d('0xb3')][_0x368d('0x6a')](_0x1510b3);});}_0x6169d4[_0x368d('0xb5')]=_0x323b05['id'];if(_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb6')]&&_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb6')]['id']){_0x6169d4['id']=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb6')]['id'];return db['ChatInteraction'][_0x368d('0x69')]({'where':_0x6169d4})[_0x368d('0x13')](function(_0x2f2f49){if(_0x2f2f49){_0x5d1336=!![];return _0x2f2f49;}return db[_0x368d('0xb3')]['create'](_0x1510b3);});}return db[_0x368d('0xb3')]['create'](_0x1510b3);})[_0x368d('0x13')](function(_0x5eb216){if(!_0x5d1336)return _0x5eb216;var _0x13a446={'from':(_0x194f2b[_0x368d('0xb7')]['firstName']||'')+'\x20'+(_0x194f2b[_0x368d('0xb7')][_0x368d('0x45')]||'')};if(_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb2')]&&_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb8')]&&_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb2')]!=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb8')]){_0x13a446[_0x368d('0xb2')]=_0xe98bd0[_0x368d('0x6b')][_0x368d('0xb8')];}return _0x5eb216['update'](_0x13a446);})[_0x368d('0x13')](function(_0x3746a3){_0x194f2b[_0x368d('0xb6')]=_0x3746a3[_0x368d('0x3b')]({'plain':!![]});_0x194f2b[_0x368d('0xb6')][_0x368d('0xb9')]=!_0x5d1336;if(_0x194f2b['interaction'][_0x368d('0xb9')]){if(_0x194f2b['account'][_0x368d('0xba')]){_0x194f2b[_0x368d('0xbb')][_0x368d('0xbc')]({'id':0x0,'priority':_0x194f2b['applications'][_0x368d('0x75')]+0x1,'app':'close','appdata':_0x368d('0xbd'),'interval':'*,*,*,*'});}}return db[_0x368d('0xbe')][_0x368d('0x6a')]({'body':_0xe98bd0[_0x368d('0x6b')]['body'],'ChatWebsiteId':_0xe98bd0[_0x368d('0x68')]['id'],'ChatInteractionId':_0x3746a3['id'],'direction':'in','ContactId':_0x194f2b[_0x368d('0xb7')]['id'],'AttachmentId':_0xe98bd0['body'][_0x368d('0xbf')]});})[_0x368d('0x13')](function(_0x2ce761){_0x194f2b['message']=_0x2ce761;if(!_0x194f2b['interaction'][_0x368d('0xc0')]){return;}return db[_0x368d('0xc1')][_0x368d('0x69')]({'attributes':['id','name'],'where':{'id':_0x194f2b[_0x368d('0xb6')][_0x368d('0xc0')]}});})[_0x368d('0x13')](function(_0x521c69){if(_0x521c69){_0x194f2b['applications'][_0x368d('0xc2')]({'id':0x0,'priority':0x0,'app':_0x368d('0xc3'),'appdata':_0x521c69[_0x368d('0x2e')]+','+(_0x194f2b[_0x368d('0xae')][_0x368d('0xc4')]||0xa),'interval':_0x368d('0xc5')});_0x194f2b[_0x368d('0xc6')]=!![];}if(!_0x194f2b['interaction']['queueId']){return;}return db[_0x368d('0xc7')]['find']({'attributes':['id',_0x368d('0x2e')],'where':{'id':_0x194f2b[_0x368d('0xb6')][_0x368d('0xc8')]}});})[_0x368d('0x13')](function(_0x856bb0){if(_0x856bb0){_0x194f2b[_0x368d('0xbb')][_0x368d('0xc2')]({'id':0x0,'priority':0x1,'app':_0x368d('0xc9'),'appdata':_0x856bb0[_0x368d('0x2e')]+','+(_0x194f2b['account'][_0x368d('0xca')]||0x12c),'interval':_0x368d('0xc5')});}return respondWithRpcPromise(_0x368d('0xcb'),'startRouting',_0x194f2b);})[_0x368d('0x13')](function(_0x116886){respondWithRpcPromise(_0x368d('0xcc'),'EventManager',{'event':_0x368d('0x95'),'message':_0x116886},client9002);return _0x116886;})[_0x368d('0x13')](respondWithResult(_0x165968,null))[_0x368d('0x1e')](APIHandleError(_0x165968));};exports['offline']=function(_0x3c9811,_0x23411b){var _0x48d290,_0x16afc3,_0x18e559;var _0x4c855e=[];var _0x4f3429={};var _0x15a495=_0x3c9811['files']||[];var _0xe00e05=[];var _0x46a844;return db[_0x368d('0x97')][_0x368d('0x6f')]()[_0x368d('0x13')](function(_0x157b87){if(!_0x157b87){throw new db['Sequelize']['ValidationError'](_0x368d('0x9a'));}_0x4c855e=_[_0x368d('0x9b')](_['keys'](_0x157b87),[_0x368d('0x9d'),'updatedAt',_0x368d('0x9e'),_0x368d('0x9f')]);if(_0x3c9811['body']['id']){delete _0x3c9811[_0x368d('0x6b')]['id'];}if(_[_0x368d('0x89')](_0x3c9811[_0x368d('0x6b')][_0x368d('0xa0')])){throw _0x23411b[_0x368d('0x1f')](0x1f4)[_0x368d('0xcd')](new db[(_0x368d('0x98'))]['ValidationError'](_0x368d('0xa1')));}if(_[_0x368d('0x89')](_0x3c9811[_0x368d('0x6b')][_0x368d('0x6b')])||_0x3c9811[_0x368d('0x6b')]['body']===''){throw _0x23411b['status'](0x1f4)[_0x368d('0xcd')](new db['Sequelize'][(_0x368d('0x99'))](_0x368d('0xa2')));}if(_[_0x368d('0x89')](_0x3c9811['body'][_0x368d('0xce')])){throw _0x23411b['status'](0x1f4)[_0x368d('0xcd')](new db[(_0x368d('0x98'))]['ValidationError'](_0x368d('0xcf')+_0x4c855e));}if(!_[_0x368d('0xa5')](_0x4c855e,_0x3c9811[_0x368d('0x6b')][_0x368d('0xce')])){throw _0x23411b[_0x368d('0x1f')](0x1f4)['send'](new db[(_0x368d('0x98'))][(_0x368d('0x99'))](_0x368d('0xd0')+_0x4c855e));}_0x4f3429[_0x3c9811['body'][_0x368d('0xce')]]=_0x3c9811[_0x368d('0x6b')]['from'];})[_0x368d('0x13')](function(){return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x3c9811[_0x368d('0x68')]['id']},'include':[{'model':db[_0x368d('0xa6')],'as':_0x368d('0xa7')},{'model':db[_0x368d('0xd1')],'as':_0x368d('0xd1')}]});})[_0x368d('0x13')](handleEntityNotFound(_0x23411b,null))[_0x368d('0x13')](function(_0x485a26){if(_0x485a26&&_0x485a26[_0x368d('0xa7')]){_0x16afc3=_0x485a26;var _0x31af7b=_[_0x368d('0xd')](_0x3c9811[_0x368d('0x6b')],{'firstName':_0x3c9811[_0x368d('0x6b')][_0x368d('0xa0')],'phone':_0x3c9811['body'][_0x368d('0xa0')],'ListId':_0x485a26['ListId']});_0x31af7b[_0x3c9811[_0x368d('0x6b')][_0x368d('0xce')]]=_0x3c9811[_0x368d('0x6b')][_0x368d('0xa0')];return db[_0x368d('0x97')]['findOrCreate']({'where':_0x4f3429,'defaults':_0x31af7b});}})[_0x368d('0xad')](function(_0x30a2a4){if(_0x30a2a4){_0x18e559=_0x30a2a4;var _0x3dcd76=fs[_0x368d('0xd2')](path['join'](config['root'],_0x368d('0xd3')),'utf8');var _0x25e698=ejs[_0x368d('0xd4')](_0x3dcd76,{'body':_[_0x368d('0xd5')](_0x3c9811[_0x368d('0x6b')][_0x368d('0x6b')]),'bodyTitle':_0x16afc3['offlineMessageBody']});return db[_0x368d('0xd6')][_0x368d('0x6a')]({'body':_0x25e698,'plainBody':htmlToText[_0x368d('0xd7')](_0x25e698),'ContactId':_0x30a2a4['id'],'ChatWebsiteId':_0x16afc3['id']});}})[_0x368d('0x13')](function(_0x4e96e9){_0x46a844=_0x4e96e9;if(_0x15a495[_0x368d('0x75')]){var _0x4072ee=_0x15a495[_0x368d('0x38')](function(_0x58a4bb){return{'name':_0x58a4bb[_0x368d('0xd8')],'basename':_0x58a4bb[_0x368d('0x7d')],'type':_0x58a4bb[_0x368d('0xd9')],'ChatOfflineMessageId':_0x4e96e9['id']};});_0xe00e05=_0x4072ee['map'](_0x2f4357=>{var _0xf9b1ad={'filename':_0x2f4357['name'],'path':path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0xda'),_0x368d('0xdb'),_0x368d('0xdc'),_0x368d('0xdd'),_0x2f4357['basename'])};return _0xf9b1ad;});if(!_0x16afc3[_0x368d('0xde')]){return db['sequelize'][_0x368d('0xdf')](function(_0x441d28){return db[_0x368d('0xe0')]['bulkCreate'](_0x4072ee,{'transaction':_0x441d28});});}}})['then'](function(){if(_0x46a844){_0x48d290=_0x46a844;return db[_0x368d('0xd1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x368d('0xe1')],'as':_0x368d('0xe2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x368d('0xe3'),'raw':!![]}]}]});}})[_0x368d('0x13')](function(_0x4151e4){if(_0x4151e4&&_0x4151e4['Smtp']&&_0x16afc3['forwardOffline']&&_0x16afc3[_0x368d('0xe4')]){var _0x49818f=_0x4151e4[_0x368d('0xe5')]();return respondWithRpcPromise(_0x368d('0xe6'),_0x368d('0xe7'),{'account':_0x49818f,'message':{'from':util[_0x368d('0x30')](_0x368d('0xe8'),_0x4151e4[_0x368d('0x2e')],_0x4151e4[_0x368d('0xe9')]||_0x4151e4[_0x368d('0xe2')][_0x368d('0x6c')]),'to':_0x16afc3[_0x368d('0xe4')],'subject':_0x16afc3[_0x368d('0xea')],'html':_0x48d290[_0x368d('0x6b')],'attachments':_0xe00e05}},client9003)[_0x368d('0x13')](function(){return _0x48d290;})[_0x368d('0x1e')](function(_0x7106c7){logger[_0x368d('0x19')](_0x7106c7);});}})['then'](function(){if(_0x16afc3&&_0x16afc3['openNewInteraction']&&_0x16afc3['MailAccountId']){var _0x517e25=[];if(_0x15a495[_0x368d('0x75')]){_0x517e25=_0x15a495[_0x368d('0x38')](function(_0x42947b){return{'name':_0x42947b['originalname'],'basename':_0x42947b[_0x368d('0x7d')],'type':_0x42947b[_0x368d('0xd9')],'ChatOfflineMessageId':_0x46a844['id']};});}var _0x243a16;if(!_[_0x368d('0x89')](_0x16afc3[_0x368d('0xeb')])){var _0x5dce8b=_[_0x368d('0x38')](_0x3c9811[_0x368d('0x6b')],function(_0x494f63){return _0x494f63;});var _0x27bf4e=_['toPairsIn'](_0x5dce8b)[0x0];var _0x430c7c=_[_0x368d('0xec')](_0x27bf4e,function(_0x564a9f){return _0x564a9f;});_0x243a16=_0x430c7c[0x1][_0x16afc3['subjectOffline']];}var _0xad0dd7={'from':_0x18e559['email'],'firstName':_0x18e559[_0x368d('0xed')],'lastName':_0x18e559[_0x368d('0x45')],'mapKey':_0x368d('0xe9'),'message':{'from':_0x18e559[_0x368d('0xe9')],'to':_0x16afc3[_0x368d('0xd1')][_0x368d('0xe9')],'cc':'','subject':_[_0x368d('0x89')](_0x243a16)?_0x16afc3['offlineMessageSubject']:_0x243a16,'messageId':'','sentAt':new Date(),'attach':_0x517e25[_0x368d('0x75')],'attachments':_0x517e25,'originChannel':'Chat','ChatWebsiteId':_0x16afc3['id'],'ChatOfflineMessageId':_0x48d290['id'],'originTo':_0x16afc3[_0x368d('0xd1')][_0x368d('0xe9')]},'body':_0x48d290[_0x368d('0x6b')]};var _0x725a73={'account':{'id':_0x16afc3[_0x368d('0xee')]},'body':_0xad0dd7,'log':_0x368d('0xef')};return respondWithRpcPromise(_0x368d('0xef'),_0x368d('0xf0'),_0x725a73,client9001)[_0x368d('0x13')](function(){return _0x48d290;})['catch'](function(_0x115006){logger['error'](_0x115006);});}return;})[_0x368d('0x13')](function(){if(_0x48d290){return _0x48d290;}})[_0x368d('0x13')](respondWithResult(_0x23411b,null))[_0x368d('0x1e')](function(){for(var _0x326ad4 of _0x15a495){var _0x5d1eb9=path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0xda'),'files',_0x368d('0xdc'),_0x368d('0xdd'),_0x326ad4['filename']);fs_extra[_0x368d('0xf1')](_0x5d1eb9)[_0x368d('0x1e')](function(_0x6a377f){logger[_0x368d('0x19')](_0x368d('0xf2'),_0x5d1eb9,_0x6a377f);});}});};exports[_0x368d('0xf3')]=function(_0x3f262a,_0x48b934){return db[_0x368d('0xb3')][_0x368d('0x69')]({'where':{'id':_0x3f262a[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x48b934,null))[_0x368d('0x13')](function(_0x5e025f){if(_0x5e025f){return _0x5e025f['addInteraction'](_0x3f262a['body'][_0x368d('0x77')],_[_0x368d('0xf4')](_0x3f262a[_0x368d('0x6b')],[_0x368d('0x77'),'id'])||{});}})['then'](respondWithResult(_0x48b934,null))[_0x368d('0x1e')](handleError(_0x48b934,null));};exports[_0x368d('0xf5')]=function(_0x98f340,_0x1dc7d9){var _0x427cad={'raw':![],'where':{}};var _0x55298a={};var _0x2aff4b={'count':0x0,'rows':[]};return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x98f340[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x1dc7d9,null))[_0x368d('0x13')](function(_0x46d86b){if(_0x46d86b){_0x55298a['model']=_[_0x368d('0x55')](db[_0x368d('0xb3')][_0x368d('0x52')]);_0x55298a[_0x368d('0x54')]=_['keys'](_0x98f340[_0x368d('0x54')]);_0x55298a[_0x368d('0x5d')]=_[_0x368d('0x56')](_0x55298a[_0x368d('0x4b')],_0x55298a[_0x368d('0x54')]);_0x427cad[_0x368d('0x57')]=_[_0x368d('0x56')](_0x55298a[_0x368d('0x4b')],qs[_0x368d('0x58')](_0x98f340[_0x368d('0x54')][_0x368d('0x58')]));_0x427cad[_0x368d('0x57')]=_0x427cad[_0x368d('0x57')][_0x368d('0x75')]?_0x427cad[_0x368d('0x57')]:_0x55298a[_0x368d('0x4b')];if(!_0x98f340[_0x368d('0x54')][_0x368d('0x59')]('nolimit')){_0x427cad['limit']=qs[_0x368d('0x25')](_0x98f340[_0x368d('0x54')][_0x368d('0x25')]);_0x427cad[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x98f340[_0x368d('0x54')][_0x368d('0x24')]);}_0x427cad[_0x368d('0x5b')]=qs[_0x368d('0x5c')](_0x98f340['query'][_0x368d('0x5c')]);_0x427cad['where']=qs[_0x368d('0x5d')](_['pick'](_0x98f340[_0x368d('0x54')],_0x55298a['filters']));_0x427cad['where'][_0x368d('0x71')]=_0x46d86b['id'];if(_0x98f340[_0x368d('0x54')][_0x368d('0x5f')]){_0x427cad['where']=_[_0x368d('0x61')](_0x427cad[_0x368d('0x60')],{'$or':_[_0x368d('0x38')](_0x427cad[_0x368d('0x57')],function(_0x1af941){var _0x3b3f3c={};_0x3b3f3c[_0x1af941]={'$like':'%'+_0x98f340[_0x368d('0x54')][_0x368d('0x5f')]+'%'};return _0x3b3f3c;})});}_0x427cad=_[_0x368d('0x61')]({},_0x427cad,_0x98f340[_0x368d('0x63')]);return db[_0x368d('0xb3')][_0x368d('0x23')]({'where':_0x427cad[_0x368d('0x60')]})[_0x368d('0x13')](function(_0x3b6324){_0x2aff4b[_0x368d('0x23')]=_0x3b6324;if(_0x98f340[_0x368d('0x54')][_0x368d('0x64')]){_0x427cad['include']=[{'model':db['CmContact'],'as':_0x368d('0xf6'),'required':![]},{'model':db['User'],'as':_0x368d('0xf7'),'attributes':[_0x368d('0x2e'),'fullname',_0x368d('0xf8')],'required':![]},{'model':db[_0x368d('0xf9')],'as':_0x368d('0xfa'),'attributes':['id',_0x368d('0x2e'),'color'],'where':_0x98f340['query']['tag']?{'id':_0x98f340[_0x368d('0x54')][_0x368d('0xfb')]}:undefined,'required':_0x98f340[_0x368d('0x54')][_0x368d('0xfb')]?!![]:![]}];}return db[_0x368d('0xb3')]['findAll'](_0x427cad);})[_0x368d('0x13')](function(_0xa9579a){_0x2aff4b['rows']=_0xa9579a;return _0x2aff4b;});}})['then'](respondWithFilteredResult(_0x1dc7d9,_0x427cad))[_0x368d('0x1e')](handleError(_0x1dc7d9,null));};exports[_0x368d('0xfc')]=function(_0x5b1872,_0x5a2262){var _0x1a45e6=0x0;var _0x19e97b=0x0;var _0x6df64e=![];var _0x5aec8f;var _0x1343d4;return db[_0x368d('0x51')][_0x368d('0x69')]({'where':{'id':_0x5b1872['params']['id']},'include':[{'model':db[_0x368d('0x39')],'as':_0x368d('0x39'),'include':[{'model':db['Interval'],'as':_0x368d('0x3a'),'attributes':['id',_0x368d('0x31')]}]}]})[_0x368d('0x13')](handleEntityNotFound(_0x5a2262,null))[_0x368d('0x13')](function(_0x4acc37){if(_0x4acc37){_0x5aec8f=_0x4acc37;return _0x4acc37[_0x368d('0xfd')]({'raw':!![]});}})[_0x368d('0x13')](function(_0x28e8d2){if(_0x5aec8f){if(_0x28e8d2){_0x1343d4=_0x28e8d2;}}return require(_0x368d('0x87'))['getLicense']();})[_0x368d('0x13')](function(_0x3c13d6){if(_0x3c13d6){_0x19e97b=_0x3c13d6['virtual'];_0x6df64e=_0x3c13d6[_0x368d('0xfe')];}})['then'](function(){return db[_0x368d('0xb3')][_0x368d('0x23')]({'where':{'closed':![]}});})[_0x368d('0x13')](function(_0x45f960){_0x1a45e6=_0x45f960;if(_0x19e97b&&_0x45f960>_0x19e97b){return db[_0x368d('0xff')][_0x368d('0x74')]({'where':{'id':0x1}})[_0x368d('0x13')](function(_0x4ca354){if(_0x4ca354){_0x4ca354[_0x368d('0x100')](_0x368d('0x101'));}});}})[_0x368d('0x13')](function(){if(!_0x5aec8f[_0x368d('0x39')]||!_0x5aec8f['Interval'][_0x368d('0x3a')])return!![];return checkWebsiteIntervals(_0x5aec8f);})[_0x368d('0x13')](function(_0x32521d){var _0x3edcdf=fs[_0x368d('0xd2')](path[_0x368d('0x85')](config[_0x368d('0x86')],_0x368d('0x102')),_0x368d('0x103'));var _0x5228a5=new url['URL'](_0x5aec8f[_0x368d('0x104')])['origin'];var _0x2ed7a8=_0x368d('0x105');var _0xdf9ed2=![];var _0x42886c={'chatVersion':_0x2ed7a8,'chatWebsiteAddressOrigin':_0x5228a5,'remote':_0x5aec8f['remote'],'query':querystring['stringify'](_[_0x368d('0x61')](_0x5aec8f['get']({'plain':!![]}),{'customerIp':_0x5b1872[_0x368d('0xb1')]['x-forwarded-for']||_0x5b1872['headers']['x-real-ip']||_0x5b1872['connection'][_0x368d('0x106')]||_0x5b1872['ip'],'referer':_0x5b1872[_0x368d('0xb1')]['referer'],'openedInteractions':_0x1a45e6,'maxInteractions':_0x19e97b,'virtual':_0x6df64e[_0x368d('0x107')],'online':_0x32521d,'custom':_0x6df64e}))['replace'](/'/g,'\x5c\x27')};_0x5a2262[_0x368d('0xcd')](ejs[_0x368d('0xd4')](Mustache['render'](_0x3edcdf,_0x42886c),{'proactiveActions':_0x1343d4,'alignment':_0x5aec8f['alignment'],'verticalAlignment':_0x5aec8f[_0x368d('0x108')],'div_color':_0x5aec8f[_0x368d('0x109')],'labelText':_0x5aec8f['labelText'],'text_color':_0x5aec8f[_0x368d('0x10a')],'text_button_color':_0x5aec8f[_0x368d('0x10b')],'button_color':_0x5aec8f['color_button'],'background_color':_0x5aec8f[_0x368d('0x10c')],'hideWhenOffline':_0x5aec8f[_0x368d('0x10d')],'intervalId':_0x5aec8f[_0x368d('0x10e')],'isDevelopment':_0xdf9ed2,'chatVersion':_0x2ed7a8}));})[_0x368d('0x1e')](handleError(_0x5a2262,null));};exports['addApplications']=function(_0x2e022a,_0x41f8ec){var _0x5cff33=_0x2e022a[_0x368d('0x68')]['id'];var _0x4934a3=_0x2e022a['body'];var _0x236e55=0xc8;var _0x2145fd=null;return db[_0x368d('0x10f')]['transaction']({'isolationLevel':db['sequelize'][_0x368d('0x110')][_0x368d('0x111')][_0x368d('0x112')]},function(_0x179932){return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x5cff33},'transaction':_0x179932})[_0x368d('0x13')](function(_0x5f2adc){if(_0x5f2adc){return db[_0x368d('0xaa')][_0x368d('0x29')]({'where':{'ChatWebsiteId':_0x5cff33},'transaction':_0x179932})['then'](function(){var _0x52a19b=_[_0x368d('0x38')](_0x4934a3,function(_0x75dd16){_0x75dd16['ChatWebsiteId']=_0x5cff33;return _0x75dd16;});return db[_0x368d('0xaa')]['bulkCreate'](_0x52a19b,{'transaction':_0x179932});});}else{_0x236e55=0x194;_0x2145fd=[];}});})[_0x368d('0x13')](function(){if(_0x236e55!==0x194){return db[_0x368d('0xaa')][_0x368d('0x113')]({'where':{'ChatWebsiteId':_0x5cff33},'order':_0x368d('0xb0')})[_0x368d('0x13')](function(_0x1ea042){_0x2145fd=_0x1ea042;});}})[_0x368d('0x1e')](function(_0x8c77a7){_0x236e55=0x1f4;logger['error'](_0x8c77a7[_0x368d('0x2d')]);if(_0x8c77a7['name']){delete _0x8c77a7[_0x368d('0x2e')];}_0x2145fd=_0x8c77a7;})['finally'](function(){if(_0x2145fd===null){_0x41f8ec[_0x368d('0x2c')](_0x236e55);}else{if(_0x236e55===0x1f4){_0x41f8ec[_0x368d('0x1f')](_0x236e55)[_0x368d('0xcd')](_0x2145fd);}else{_0x41f8ec['status'](_0x236e55)[_0x368d('0x21')](_0x2145fd);}}});};exports['getApplications']=function(_0x399c96,_0x20f87e){var _0x182e84={};var _0x59286f={};var _0x19d477;var _0x4e623c;return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x399c96['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x20f87e,null))[_0x368d('0x13')](function(_0x3d19f6){if(_0x3d19f6){_0x19d477=_0x3d19f6;_0x59286f[_0x368d('0x4b')]=_[_0x368d('0x55')](db[_0x368d('0xaa')][_0x368d('0x52')]);_0x59286f[_0x368d('0x54')]=_[_0x368d('0x55')](_0x399c96['query']);_0x59286f[_0x368d('0x5d')]=_[_0x368d('0x56')](_0x59286f[_0x368d('0x4b')],_0x59286f[_0x368d('0x54')]);_0x182e84[_0x368d('0x57')]=_[_0x368d('0x56')](_0x59286f[_0x368d('0x4b')],qs[_0x368d('0x58')](_0x399c96[_0x368d('0x54')]['fields']));_0x182e84[_0x368d('0x57')]=_0x182e84['attributes'][_0x368d('0x75')]?_0x182e84[_0x368d('0x57')]:_0x59286f[_0x368d('0x4b')];_0x182e84[_0x368d('0x5b')]=qs[_0x368d('0x5c')](_0x399c96[_0x368d('0x54')][_0x368d('0x5c')]);_0x182e84[_0x368d('0x60')]=qs['filters'](_[_0x368d('0x5e')](_0x399c96[_0x368d('0x54')],_0x59286f[_0x368d('0x5d')]));if(_0x399c96[_0x368d('0x54')][_0x368d('0x5f')]){_0x182e84[_0x368d('0x60')]=_[_0x368d('0x61')](_0x182e84[_0x368d('0x60')],{'$or':_[_0x368d('0x38')](_0x182e84[_0x368d('0x57')],function(_0x32eb6e){var _0x2bfa2d={};_0x2bfa2d[_0x32eb6e]={'$like':'%'+_0x399c96['query'][_0x368d('0x5f')]+'%'};return _0x2bfa2d;})});}_0x182e84=_['merge']({},_0x182e84,_0x399c96['options']);return _0x19d477[_0x368d('0x114')](_0x182e84);}})[_0x368d('0x13')](function(_0x4777e2){if(_0x4777e2){_0x4e623c=_0x4777e2['length'];if(!_0x399c96[_0x368d('0x54')][_0x368d('0x59')]('nolimit')){_0x182e84[_0x368d('0x25')]=qs[_0x368d('0x25')](_0x399c96[_0x368d('0x54')][_0x368d('0x25')]);_0x182e84[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x399c96[_0x368d('0x54')][_0x368d('0x24')]);}return _0x19d477['getApplications'](_0x182e84);}})[_0x368d('0x13')](function(_0x8072f6){if(_0x8072f6){return _0x8072f6?{'count':_0x4e623c,'rows':_0x8072f6}:null;}})['then'](respondWithResult(_0x20f87e,null))[_0x368d('0x1e')](handleError(_0x20f87e,null));};exports[_0x368d('0x115')]=function(_0x263af9,_0x4c54aa){return db[_0x368d('0x116')][_0x368d('0x69')]({'where':{'id':_0x263af9[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x4c54aa,null))[_0x368d('0x13')](function(_0x14ecac){if(_0x14ecac){return _0x14ecac[_0x368d('0x115')](_0x263af9[_0x368d('0x6b')][_0x368d('0x77')],_[_0x368d('0xf4')](_0x263af9[_0x368d('0x6b')],[_0x368d('0x77'),'id'])||{});}})['then'](respondWithResult(_0x4c54aa,null))[_0x368d('0x1e')](handleError(_0x4c54aa,null));};exports['getProactiveActions']=function(_0x2190a8,_0x166537){var _0x48cde9={};var _0x28c809={};var _0x49b14e;var _0x12acf4;return db[_0x368d('0x51')]['findOne']({'where':{'id':_0x2190a8['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x166537,null))[_0x368d('0x13')](function(_0x11372c){if(_0x11372c){_0x49b14e=_0x11372c;_0x28c809[_0x368d('0x4b')]=_['keys'](db[_0x368d('0x117')][_0x368d('0x52')]);_0x28c809[_0x368d('0x54')]=_[_0x368d('0x55')](_0x2190a8[_0x368d('0x54')]);_0x28c809[_0x368d('0x5d')]=_[_0x368d('0x56')](_0x28c809[_0x368d('0x4b')],_0x28c809[_0x368d('0x54')]);_0x48cde9[_0x368d('0x57')]=_[_0x368d('0x56')](_0x28c809['model'],qs[_0x368d('0x58')](_0x2190a8['query'][_0x368d('0x58')]));_0x48cde9[_0x368d('0x57')]=_0x48cde9['attributes'][_0x368d('0x75')]?_0x48cde9[_0x368d('0x57')]:_0x28c809[_0x368d('0x4b')];_0x48cde9['order']=qs[_0x368d('0x5c')](_0x2190a8[_0x368d('0x54')][_0x368d('0x5c')]);_0x48cde9[_0x368d('0x60')]=qs['filters'](_['pick'](_0x2190a8[_0x368d('0x54')],_0x28c809[_0x368d('0x5d')]));if(_0x2190a8[_0x368d('0x54')][_0x368d('0x5f')]){_0x48cde9[_0x368d('0x60')]=_[_0x368d('0x61')](_0x48cde9['where'],{'$or':_[_0x368d('0x38')](_0x48cde9[_0x368d('0x57')],function(_0x1ab243){var _0x5bc53d={};_0x5bc53d[_0x1ab243]={'$like':'%'+_0x2190a8['query'][_0x368d('0x5f')]+'%'};return _0x5bc53d;})});}_0x48cde9=_[_0x368d('0x61')]({},_0x48cde9,_0x2190a8['options']);return _0x49b14e[_0x368d('0xfd')](_0x48cde9);}})[_0x368d('0x13')](function(_0x25472b){if(_0x25472b){_0x12acf4=_0x25472b[_0x368d('0x75')];if(!_0x2190a8['query'][_0x368d('0x59')](_0x368d('0x5a'))){_0x48cde9[_0x368d('0x25')]=qs['limit'](_0x2190a8[_0x368d('0x54')][_0x368d('0x25')]);_0x48cde9[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x2190a8[_0x368d('0x54')][_0x368d('0x24')]);}return _0x49b14e[_0x368d('0xfd')](_0x48cde9);}})['then'](function(_0x417699){if(_0x417699){return _0x417699?{'count':_0x12acf4,'rows':_0x417699}:null;}})[_0x368d('0x13')](respondWithResult(_0x166537,null))[_0x368d('0x1e')](handleError(_0x166537,null));};exports[_0x368d('0x118')]=function(_0x4b11e7,_0x1d848e){var _0x4344af=_0x4b11e7[_0x368d('0x54')][_0x368d('0x119')]===_0x368d('0x11a')?_0x368d('0x11b'):_0x368d('0x11c');return db['ChatWebsite'][_0x368d('0x69')]({'attributes':['id',_0x4344af],'where':{'id':_0x4b11e7[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x1d848e,null))[_0x368d('0x13')](function(_0x225b03){if(_0x225b03){var _0x5c2f11=_0x225b03[_0x4344af];var _0x71598c=_0x5c2f11&&_0x5c2f11['items']?_0x5c2f11[_0x368d('0x11d')]:[];_0x1d848e[_0x368d('0xcd')]({'fromKey':_[_0x368d('0x89')](_0x5c2f11[_0x368d('0x11e')])?undefined:_0x5c2f11[_0x368d('0x11e')],'count':_0x71598c[_0x368d('0x75')],'rows':_0x71598c});}})[_0x368d('0x1e')](handleError(_0x1d848e,null));};exports[_0x368d('0x11f')]=function(_0x3ad386,_0x1d3b0f){var _0x19c891={'raw':![],'where':{}};var _0x58c06c={};var _0x54d99b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x368d('0x74')]({'where':{'id':_0x3ad386[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x1d3b0f,null))[_0x368d('0x13')](function(_0x2d74cc){if(_0x2d74cc){_0x58c06c['model']=_['keys'](db[_0x368d('0xd6')][_0x368d('0x52')]);_0x58c06c[_0x368d('0x54')]=_[_0x368d('0x55')](_0x3ad386['query']);_0x58c06c[_0x368d('0x5d')]=_['intersection'](_0x58c06c['model'],_0x58c06c[_0x368d('0x54')]);_0x19c891['attributes']=_[_0x368d('0x56')](_0x58c06c['model'],qs[_0x368d('0x58')](_0x3ad386[_0x368d('0x54')][_0x368d('0x58')]));_0x19c891[_0x368d('0x57')]=_0x19c891[_0x368d('0x57')][_0x368d('0x75')]?_0x19c891[_0x368d('0x57')]:_0x58c06c[_0x368d('0x4b')];if(!_0x3ad386[_0x368d('0x54')][_0x368d('0x59')](_0x368d('0x5a'))){_0x19c891['limit']=qs[_0x368d('0x25')](_0x3ad386[_0x368d('0x54')][_0x368d('0x25')]);_0x19c891[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x3ad386[_0x368d('0x54')][_0x368d('0x24')]);}_0x19c891['order']=qs['sort'](_0x3ad386[_0x368d('0x54')][_0x368d('0x5c')]);_0x19c891['where']=qs[_0x368d('0x5d')](_[_0x368d('0x5e')](_0x3ad386['query'],_0x58c06c[_0x368d('0x5d')]));_0x19c891[_0x368d('0x60')][_0x368d('0x71')]=_0x2d74cc['id'];if(_0x3ad386[_0x368d('0x54')][_0x368d('0x5f')]){_0x19c891[_0x368d('0x60')]=_[_0x368d('0x61')](_0x19c891[_0x368d('0x60')],{'$or':_[_0x368d('0x38')](_0x19c891[_0x368d('0x57')],function(_0x32a591){var _0x386743={};_0x386743[_0x32a591]={'$like':'%'+_0x3ad386['query'][_0x368d('0x5f')]+'%'};return _0x386743;})});}_0x19c891=_['merge']({},_0x19c891,_0x3ad386[_0x368d('0x63')]);return db['ChatOfflineMessage'][_0x368d('0x23')]({'where':_0x19c891['where']})[_0x368d('0x13')](function(_0x1346b5){_0x54d99b['count']=_0x1346b5;if(_0x3ad386[_0x368d('0x54')][_0x368d('0x64')]){_0x19c891[_0x368d('0x65')]=[{'all':!![]}];}else{_0x19c891['include']=[{'model':db[_0x368d('0x97')],'as':_0x368d('0xf6'),'required':![]},{'model':db[_0x368d('0xe0')],'as':_0x368d('0x120'),'required':![]}];}return db[_0x368d('0xd6')]['findAll'](_0x19c891);})[_0x368d('0x13')](function(_0x3df1c4){_0x54d99b[_0x368d('0x67')]=_0x3df1c4;return _0x54d99b;});}})[_0x368d('0x13')](respondWithFilteredResult(_0x1d3b0f,_0x19c891))[_0x368d('0x1e')](handleError(_0x1d3b0f,null));};exports[_0x368d('0x121')]=function(_0x35b229,_0x11dd88){return db['ChatWebsite'][_0x368d('0x69')]({'where':{'id':_0x35b229['params']['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x11dd88,null))['then'](function(_0x3eec2d){if(_0x3eec2d){return _0x3eec2d['addAgents'](_0x35b229[_0x368d('0x6b')][_0x368d('0x77')],_[_0x368d('0xf4')](_0x35b229[_0x368d('0x6b')],['ids','id'])||{})[_0x368d('0xad')](function(_0x1b38c3){for(var _0x2643b1=0x0;_0x2643b1<_0x35b229[_0x368d('0x6b')][_0x368d('0x77')][_0x368d('0x75')];_0x2643b1+=0x1){socket[_0x368d('0x122')](_0x368d('0x123'),{'UserId':Number(_0x35b229[_0x368d('0x6b')][_0x368d('0x77')][_0x2643b1]),'ChatWebsiteId':Number(_0x35b229[_0x368d('0x68')]['id'])});}return _0x1b38c3;});}})[_0x368d('0x13')](respondWithResult(_0x11dd88,null))[_0x368d('0x1e')](handleError(_0x11dd88,null));};exports[_0x368d('0x124')]=function(_0x292fe4,_0x73fc48){return db[_0x368d('0x51')]['find']({'where':{'id':_0x292fe4[_0x368d('0x68')]['id']}})[_0x368d('0x13')](handleEntityNotFound(_0x73fc48,null))[_0x368d('0x13')](function(_0x42a423){if(_0x42a423){return _0x42a423[_0x368d('0x124')](_0x292fe4['query'][_0x368d('0x77')])[_0x368d('0x13')](function(){if(_[_0x368d('0x125')](_0x292fe4[_0x368d('0x54')][_0x368d('0x77')])){for(var _0xab9d79=0x0;_0xab9d79<_0x292fe4['query']['ids'][_0x368d('0x75')];_0xab9d79+=0x1){socket[_0x368d('0x122')](_0x368d('0x126'),{'UserId':Number(_0x292fe4[_0x368d('0x54')]['ids'][_0xab9d79]),'ChatWebsiteId':Number(_0x292fe4[_0x368d('0x68')]['id'])});}}else{socket[_0x368d('0x122')](_0x368d('0x126'),{'UserId':Number(_0x292fe4[_0x368d('0x54')][_0x368d('0x77')]),'ChatWebsiteId':Number(_0x292fe4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x73fc48,null))[_0x368d('0x1e')](handleError(_0x73fc48,null));};exports[_0x368d('0x127')]=function(_0x560642,_0x22539a){var _0x4a10e4={};var _0x1d691f={};var _0xf0637f;var _0x335ad1;return db[_0x368d('0x51')][_0x368d('0x74')]({'where':{'id':_0x560642[_0x368d('0x68')]['id']}})['then'](handleEntityNotFound(_0x22539a,null))[_0x368d('0x13')](function(_0x41f8f5){if(_0x41f8f5){_0xf0637f=_0x41f8f5;_0x1d691f[_0x368d('0x4b')]=_[_0x368d('0x55')](db[_0x368d('0xc1')]['rawAttributes']);_0x1d691f[_0x368d('0x54')]=_[_0x368d('0x55')](_0x560642[_0x368d('0x54')]);_0x1d691f['filters']=_[_0x368d('0x56')](_0x1d691f[_0x368d('0x4b')],_0x1d691f['query']);_0x4a10e4[_0x368d('0x57')]=_[_0x368d('0x56')](_0x1d691f[_0x368d('0x4b')],qs[_0x368d('0x58')](_0x560642['query']['fields']));_0x4a10e4[_0x368d('0x57')]=_0x4a10e4[_0x368d('0x57')][_0x368d('0x75')]?_0x4a10e4[_0x368d('0x57')]:_0x1d691f['model'];_0x4a10e4[_0x368d('0x5b')]=qs[_0x368d('0x5c')](_0x560642[_0x368d('0x54')]['sort']);_0x4a10e4[_0x368d('0x60')]=qs[_0x368d('0x5d')](_[_0x368d('0x5e')](_0x560642[_0x368d('0x54')],_0x1d691f['filters']));if(_0x560642[_0x368d('0x54')]['filter']){_0x4a10e4[_0x368d('0x60')]=_['merge'](_0x4a10e4[_0x368d('0x60')],{'$or':_['map'](_0x4a10e4[_0x368d('0x57')],function(_0xc3a44a){var _0x207627={};_0x207627[_0xc3a44a]={'$like':'%'+_0x560642[_0x368d('0x54')][_0x368d('0x5f')]+'%'};return _0x207627;})});}_0x4a10e4=_[_0x368d('0x61')]({},_0x4a10e4,_0x560642[_0x368d('0x63')]);return _0xf0637f['getAgents'](_0x4a10e4);}})[_0x368d('0x13')](function(_0x272355){if(_0x272355){_0x335ad1=_0x272355[_0x368d('0x75')];if(!_0x560642['query'][_0x368d('0x59')](_0x368d('0x5a'))){_0x4a10e4[_0x368d('0x25')]=qs['limit'](_0x560642['query'][_0x368d('0x25')]);_0x4a10e4[_0x368d('0x24')]=qs[_0x368d('0x24')](_0x560642[_0x368d('0x54')]['offset']);}return _0xf0637f[_0x368d('0x127')](_0x4a10e4);}})[_0x368d('0x13')](function(_0x244738){if(_0x244738){return _0x244738?{'count':_0x335ad1,'rows':_0x244738}:null;}})['then'](respondWithResult(_0x22539a,null))['catch'](handleError(_0x22539a,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 77e1798..3a5d46e 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 _0xff3c=['../../mysqldb','setMaxListeners','save','emit','exports','events'];(function(_0x4c353f,_0xd09ca6){var _0x37b0b6=function(_0x419c0f){while(--_0x419c0f){_0x4c353f['push'](_0x4c353f['shift']());}};_0x37b0b6(++_0xd09ca6);}(_0xff3c,0x179));var _0xcff3=function(_0x1eb359,_0x4cda30){_0x1eb359=_0x1eb359-0x0;var _0x3fdf23=_0xff3c[_0x1eb359];return _0x3fdf23;};'use strict';var EventEmitter=require(_0xcff3('0x0'));var ChatWebsite=require(_0xcff3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcff3('0x2')](0x0);var events={'afterCreate':_0xcff3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28f6e0){return function(_0x17ae92,_0x45c7f6,_0x312858){ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0+':'+_0x17ae92['id'],_0x17ae92);ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0,_0x17ae92);_0x312858(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xcff3('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf3ff=['emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xf3ff,0xae));var _0xff3f=function(_0x43d21c,_0x404a65){_0x43d21c=_0x43d21c-0x0;var _0x470922=_0xf3ff[_0x43d21c];return _0x470922;};'use strict';var EventEmitter=require(_0xff3f('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xff3f('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xff3f('0x2')](0x0);var events={'afterCreate':_0xff3f('0x3'),'afterUpdate':_0xff3f('0x4'),'afterDestroy':_0xff3f('0x5')};function emitEvent(_0x262446){return function(_0x4aa1dc,_0x2c62cc,_0x30f58e){ChatWebsiteEvents[_0xff3f('0x6')](_0x262446+':'+_0x4aa1dc['id'],_0x4aa1dc);ChatWebsiteEvents['emit'](_0x262446,_0x4aa1dc);_0x30f58e(null);};}for(var e in events){if(events[_0xff3f('0x7')](e)){var event=events[e];ChatWebsite[_0xff3f('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 54075f5..459f6c6 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 _0x5c5f=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xc3c0fd,_0x210520){var _0x36d3e0=function(_0x27bdff){while(--_0x27bdff){_0xc3c0fd['push'](_0xc3c0fd['shift']());}};_0x36d3e0(++_0x210520);}(_0x5c5f,0x1dd));var _0xf5c5=function(_0x76c02d,_0x56edfa){_0x76c02d=_0x76c02d-0x0;var _0x43acda=_0x5c5f[_0x76c02d];return _0x43acda;};'use strict';var _=require(_0xf5c5('0x0'));var util=require('util');var logger=require(_0xf5c5('0x1'))(_0xf5c5('0x2'));var moment=require(_0xf5c5('0x3'));var BPromise=require(_0xf5c5('0x4'));var rp=require(_0xf5c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5c5('0x7'));module[_0xf5c5('0x8')]=function(_0x4fa7b1,_0x531b1f){return _0x4fa7b1['define'](_0xf5c5('0x9'),attributes,{'tableName':_0xf5c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x377d=['exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x5aebdc,_0x54d387){var _0x3ec5c6=function(_0x456186){while(--_0x456186){_0x5aebdc['push'](_0x5aebdc['shift']());}};_0x3ec5c6(++_0x54d387);}(_0x377d,0xff));var _0xd377=function(_0x53f3e9,_0x43ad34){_0x53f3e9=_0x53f3e9-0x0;var _0x531871=_0x377d[_0x53f3e9];return _0x531871;};'use strict';var _=require(_0xd377('0x0'));var util=require(_0xd377('0x1'));var logger=require(_0xd377('0x2'))(_0xd377('0x3'));var moment=require(_0xd377('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd377('0x5'));var rimraf=require(_0xd377('0x6'));var config=require(_0xd377('0x7'));var attributes=require(_0xd377('0x8'));module[_0xd377('0x9')]=function(_0x3e70fe,_0x120c43){return _0x3e70fe['define'](_0xd377('0xa'),attributes,{'tableName':_0xd377('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 25fddbf..0363cc2 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 _0x2aa6=['result','catch','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3a2d30,_0x24f0f6){var _0x49ec55=function(_0x206969){while(--_0x206969){_0x3a2d30['push'](_0x3a2d30['shift']());}};_0x49ec55(++_0x24f0f6);}(_0x2aa6,0x116));var _0x62aa=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x2aa6[_0x5c38cd];return _0xc985ef;};'use strict';var _=require('lodash');var util=require(_0x62aa('0x0'));var moment=require('moment');var BPromise=require(_0x62aa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62aa('0x2'));var db=require(_0x62aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x62aa('0x4'));var config=require(_0x62aa('0x5'));var jayson=require(_0x62aa('0x6'));var client=jayson[_0x62aa('0x7')][_0x62aa('0x8')]({'port':0x232a});config['redis']=_[_0x62aa('0x9')](config[_0x62aa('0xa')],{'host':_0x62aa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62aa('0xa')]));require(_0x62aa('0xc'))[_0x62aa('0xd')](socket);function respondWithRpcPromise(_0x1a380b,_0x562073,_0x281e8a){return new BPromise(function(_0x23849c,_0x1e0dee){return client[_0x62aa('0xe')](_0x1a380b,_0x281e8a)['then'](function(_0x1ec3dd){logger[_0x62aa('0xf')](_0x62aa('0x10'),_0x562073,_0x62aa('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x562073,_0x62aa('0x11'),JSON['stringify'](_0x1ec3dd));if(_0x1ec3dd[_0x62aa('0x12')]){if(_0x1ec3dd[_0x62aa('0x12')][_0x62aa('0x13')]===0x1f4){logger[_0x62aa('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x562073,_0x1ec3dd['error'][_0x62aa('0x14')]);return _0x1e0dee(_0x1ec3dd[_0x62aa('0x12')]['message']);}logger[_0x62aa('0x12')](_0x62aa('0x10'),_0x562073,_0x1ec3dd['error'][_0x62aa('0x14')]);return _0x23849c(_0x1ec3dd[_0x62aa('0x12')][_0x62aa('0x14')]);}else{logger[_0x62aa('0xf')](_0x62aa('0x10'),_0x562073,_0x62aa('0x11'));_0x23849c(_0x1ec3dd[_0x62aa('0x15')][_0x62aa('0x14')]);}})[_0x62aa('0x16')](function(_0x1741fe){logger[_0x62aa('0x12')](_0x62aa('0x10'),_0x562073,_0x1741fe);_0x1e0dee(_0x1741fe);});});} \ No newline at end of file +var _0xb024=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b4cd6,_0x3b8574){var _0x10c3ba=function(_0x3d52e5){while(--_0x3d52e5){_0x4b4cd6['push'](_0x4b4cd6['shift']());}};_0x10c3ba(++_0x3b8574);}(_0xb024,0x11a));var _0x4b02=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb024[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4b02('0x0'));var util=require(_0x4b02('0x1'));var moment=require(_0x4b02('0x2'));var BPromise=require(_0x4b02('0x3'));var rs=require(_0x4b02('0x4'));var fs=require('fs');var Redis=require(_0x4b02('0x5'));var db=require(_0x4b02('0x6'))['db'];var utils=require(_0x4b02('0x7'));var logger=require(_0x4b02('0x8'))(_0x4b02('0x9'));var config=require('../../config/environment');var jayson=require(_0x4b02('0xa'));var client=jayson[_0x4b02('0xb')][_0x4b02('0xc')]({'port':0x232a});config['redis']=_[_0x4b02('0xd')](config[_0x4b02('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b02('0xf'))(new Redis(config[_0x4b02('0xe')]));require(_0x4b02('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ee60f,_0x1751f9,_0x39fd52){return new BPromise(function(_0x326e00,_0x2db515){return client['request'](_0x3ee60f,_0x39fd52)['then'](function(_0x4052a8){logger[_0x4b02('0x11')](_0x4b02('0x12'),_0x1751f9,_0x4b02('0x13'));logger[_0x4b02('0x14')](_0x4b02('0x15'),_0x1751f9,_0x4b02('0x13'),JSON[_0x4b02('0x16')](_0x4052a8));if(_0x4052a8['error']){if(_0x4052a8[_0x4b02('0x17')][_0x4b02('0x18')]===0x1f4){logger[_0x4b02('0x17')](_0x4b02('0x12'),_0x1751f9,_0x4052a8[_0x4b02('0x17')][_0x4b02('0x19')]);return _0x2db515(_0x4052a8[_0x4b02('0x17')]['message']);}logger['error'](_0x4b02('0x12'),_0x1751f9,_0x4052a8[_0x4b02('0x17')][_0x4b02('0x19')]);return _0x326e00(_0x4052a8['error'][_0x4b02('0x19')]);}else{logger[_0x4b02('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x1751f9,_0x4b02('0x13'));_0x326e00(_0x4052a8[_0x4b02('0x1a')]['message']);}})[_0x4b02('0x1b')](function(_0x183dc5){logger[_0x4b02('0x17')](_0x4b02('0x12'),_0x1751f9,_0x183dc5);_0x2db515(_0x183dc5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d597088..07aff59 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 _0x7897=['save','remove','update','register','length','./chatWebsite.events'];(function(_0x46f0fc,_0x15bc89){var _0x20984c=function(_0x2e3393){while(--_0x2e3393){_0x46f0fc['push'](_0x46f0fc['shift']());}};_0x20984c(++_0x15bc89);}(_0x7897,0x65));var _0x7789=function(_0x5a3e03,_0x13e29b){_0x5a3e03=_0x5a3e03-0x0;var _0x5b0e87=_0x7897[_0x5a3e03];return _0x5b0e87;};'use strict';var ChatWebsiteEvents=require(_0x7789('0x0'));var events=[_0x7789('0x1'),_0x7789('0x2'),_0x7789('0x3')];function createListener(_0x3d9c27,_0x3496d9){return function(_0x57c335){_0x3496d9['emit'](_0x3d9c27,_0x57c335);};}function removeListener(_0x5f5f49,_0x598fd9){return function(){ChatWebsiteEvents['removeListener'](_0x5f5f49,_0x598fd9);};}exports[_0x7789('0x4')]=function(_0xb07ba7){for(var _0x1bd6e2=0x0,_0x26c1b5=events[_0x7789('0x5')];_0x1bd6e2<_0x26c1b5;_0x1bd6e2++){var _0x111e53=events[_0x1bd6e2];var _0x44d14f=createListener('chatWebsite:'+_0x111e53,_0xb07ba7);ChatWebsiteEvents['on'](_0x111e53,_0x44d14f);}}; \ No newline at end of file +var _0x8adc=['./chatWebsite.events','remove','update','emit','removeListener','register','chatWebsite:'];(function(_0x687dd4,_0x365099){var _0x248b7b=function(_0x393e36){while(--_0x393e36){_0x687dd4['push'](_0x687dd4['shift']());}};_0x248b7b(++_0x365099);}(_0x8adc,0x165));var _0xc8ad=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x8adc[_0x3c4dad];return _0x1a4f49;};'use strict';var ChatWebsiteEvents=require(_0xc8ad('0x0'));var events=['save',_0xc8ad('0x1'),_0xc8ad('0x2')];function createListener(_0x23a799,_0x228807){return function(_0x178a9c){_0x228807[_0xc8ad('0x3')](_0x23a799,_0x178a9c);};}function removeListener(_0x2b5cf7,_0x2f7ba0){return function(){ChatWebsiteEvents[_0xc8ad('0x4')](_0x2b5cf7,_0x2f7ba0);};}exports[_0xc8ad('0x5')]=function(_0x2b8a74){for(var _0x117a5a=0x0,_0x3588e1=events['length'];_0x117a5a<_0x3588e1;_0x117a5a++){var _0x2c2663=events[_0x117a5a];var _0x33e63e=createListener(_0xc8ad('0x6')+_0x2c2663,_0x2b8a74);ChatWebsiteEvents['on'](_0x2c2663,_0x33e63e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c141ad4..66786fe 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 _0xcc6c=['join','server/files/images/logos/','format','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','root','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','getAnswers','/:id/logo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer'];(function(_0x570294,_0x139ae4){var _0x41b542=function(_0xea92ff){while(--_0xea92ff){_0x570294['push'](_0x570294['shift']());}};_0x41b542(++_0x139ae4);}(_0xcc6c,0x1ae));var _0xccc6=function(_0x2d274d,_0x50b97){_0x2d274d=_0x2d274d-0x0;var _0x268a48=_0xcc6c[_0x2d274d];return _0x268a48;};'use strict';var multer=require(_0xccc6('0x0'));var util=require(_0xccc6('0x1'));var path=require(_0xccc6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xccc6('0x3')]();var fs_extra=require(_0xccc6('0x4'));var auth=require(_0xccc6('0x5'));var interaction=require(_0xccc6('0x6'));var config=require(_0xccc6('0x7'));var controller=require(_0xccc6('0x8'));router[_0xccc6('0x9')]('/',auth[_0xccc6('0xa')](),controller['index']);router[_0xccc6('0x9')](_0xccc6('0xb'),auth[_0xccc6('0xa')](),controller[_0xccc6('0xc')]);router['get'](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller['show']);router['get']('/:id/dispositions',auth[_0xccc6('0xa')](),controller[_0xccc6('0xe')]);router['get']('/:id/canned_answers',auth[_0xccc6('0xa')](),controller[_0xccc6('0xf')]);router[_0xccc6('0x9')](_0xccc6('0x10'),controller['getLogo']);router[_0xccc6('0x9')](_0xccc6('0x11'),controller['getAvatar']);router[_0xccc6('0x9')]('/:id/customer_avatar',controller[_0xccc6('0x12')]);router[_0xccc6('0x9')](_0xccc6('0x13'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xccc6('0xa')](),controller[_0xccc6('0x14')]);router[_0xccc6('0x9')]('/:id/snippet',controller[_0xccc6('0x15')]);router[_0xccc6('0x9')](_0xccc6('0x16'),auth[_0xccc6('0xa')](),controller['getApplications']);router[_0xccc6('0x9')](_0xccc6('0x17'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xccc6('0x9')](_0xccc6('0x18'),controller['getFields']);router[_0xccc6('0x9')](_0xccc6('0x19'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x1a')]);router[_0xccc6('0x9')](_0xccc6('0x1b'),auth['isAuthenticated'](),controller[_0xccc6('0x1c')]);router[_0xccc6('0x1d')]('/',auth[_0xccc6('0xa')](),controller['create']);router[_0xccc6('0x1d')]('/:id/dispositions',auth[_0xccc6('0xa')](),controller['addDisposition']);router[_0xccc6('0x1d')](_0xccc6('0x1e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24970a,_0x1e2d98,_0x38c111){_0x38c111(null,path[_0xccc6('0x20')](config['root'],_0xccc6('0x21')));},'filename':function(_0x2c5157,_0xb64b43,_0x463511){_0x463511(null,util[_0xccc6('0x22')]('%s-%s',Date[_0xccc6('0x23')](),_0xb64b43[_0xccc6('0x24')]));}})});router[_0xccc6('0x1d')]('/:id/logo',upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x27')]);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x22f1db,_0x4563fb,_0x8ada51){_0x8ada51(null,path['join'](config['root'],_0xccc6('0x29')));},'filename':function(_0x2da4ae,_0x2bb745,_0x4cb274){_0x4cb274(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x2bb745[_0xccc6('0x24')]));}})});router['post']('/:id/avatar',upload[_0xccc6('0x25')](_0xccc6('0x26')),controller['addAvatar']);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x5db382,_0x3d3c57,_0x5ca40a){_0x5ca40a(null,path[_0xccc6('0x20')](config[_0xccc6('0x2b')],_0xccc6('0x29')));},'filename':function(_0x56c868,_0x5c2c5d,_0x2005c4){_0x2005c4(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x5c2c5d[_0xccc6('0x24')]));}})});router[_0xccc6('0x1d')](_0xccc6('0x2c'),upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x2d')]);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x45f424,_0x244fda,_0x44da83){_0x44da83(null,path[_0xccc6('0x20')](config[_0xccc6('0x2b')],_0xccc6('0x29')));},'filename':function(_0x378680,_0x384033,_0x2bad3b){_0x2bad3b(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x384033['originalname']));}})});router[_0xccc6('0x1d')](_0xccc6('0x13'),upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x2e')]);router[_0xccc6('0x1d')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x54ac83,_0x1e6f04,_0x3619cc){const _0x399d98=path['join'](config[_0xccc6('0x2b')],_0xccc6('0x2f'),_0xccc6('0x30'),_0xccc6('0x31'));fs_extra['ensureDir'](_0x399d98,function(){_0x3619cc(null,_0x399d98);});},'filename':function(_0x1e1c37,_0x1c0b60,_0x403fa6){const _0x17b54e=_0x1c0b60[_0xccc6('0x24')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xc1eb14=path[_0xccc6('0x32')](_0x17b54e);const _0x3c00be=Date[_0xccc6('0x23')]()+'-'+_0x17b54e['replace'](_0xc1eb14,'')+_0xc1eb14;_0x403fa6(null,_0x3c00be);}})});router[_0xccc6('0x1d')](_0xccc6('0x33'),offlineUploadMulter[_0xccc6('0x34')](),controller[_0xccc6('0x35')]);router[_0xccc6('0x1d')](_0xccc6('0x36'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x37')]);router[_0xccc6('0x1d')](_0xccc6('0x16'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x38')]);router[_0xccc6('0x1d')](_0xccc6('0x17'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x39')]);router['post'](_0xccc6('0x1b'),auth[_0xccc6('0xa')](),controller['addAgents']);router[_0xccc6('0x3a')](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3b')]);router[_0xccc6('0x3c')](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3d')]);router[_0xccc6('0x3c')](_0xccc6('0x3e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3f')]);router['delete'](_0xccc6('0x1e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x40')]);router[_0xccc6('0x3c')](_0xccc6('0x1b'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x41')]);module['exports']=router; \ No newline at end of file +var _0xa2ba=['removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','join','server/files/images/avatars/','single','addAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeDispositions'];(function(_0x2991d8,_0x1c96d4){var _0x26d2ce=function(_0x58bb32){while(--_0x58bb32){_0x2991d8['push'](_0x2991d8['shift']());}};_0x26d2ce(++_0x1c96d4);}(_0xa2ba,0x147));var _0xaa2b=function(_0x10bcb4,_0xc27fa){_0x10bcb4=_0x10bcb4-0x0;var _0x43c569=_0xa2ba[_0x10bcb4];return _0x43c569;};'use strict';var multer=require(_0xaa2b('0x0'));var util=require(_0xaa2b('0x1'));var path=require(_0xaa2b('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa2b('0x3'));var router=express[_0xaa2b('0x4')]();var fs_extra=require(_0xaa2b('0x5'));var auth=require(_0xaa2b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa2b('0x7'));router[_0xaa2b('0x8')]('/',auth[_0xaa2b('0x9')](),controller[_0xaa2b('0xa')]);router[_0xaa2b('0x8')]('/describe',auth[_0xaa2b('0x9')](),controller[_0xaa2b('0xb')]);router[_0xaa2b('0x8')](_0xaa2b('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xaa2b('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xaa2b('0x8')](_0xaa2b('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xaa2b('0x8')](_0xaa2b('0xf'),controller[_0xaa2b('0x10')]);router[_0xaa2b('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xaa2b('0x8')](_0xaa2b('0x11'),controller[_0xaa2b('0x12')]);router[_0xaa2b('0x8')](_0xaa2b('0x13'),controller[_0xaa2b('0x14')]);router[_0xaa2b('0x8')](_0xaa2b('0x15'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x16')]);router[_0xaa2b('0x8')](_0xaa2b('0x17'),controller['getSnippet']);router[_0xaa2b('0x8')](_0xaa2b('0x18'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x19')]);router[_0xaa2b('0x8')](_0xaa2b('0x1a'),auth[_0xaa2b('0x9')](),controller['getProactiveActions']);router[_0xaa2b('0x8')](_0xaa2b('0x1b'),controller['getFields']);router[_0xaa2b('0x8')](_0xaa2b('0x1c'),auth['isAuthenticated'](),controller[_0xaa2b('0x1d')]);router[_0xaa2b('0x8')](_0xaa2b('0x1e'),auth['isAuthenticated'](),controller[_0xaa2b('0x1f')]);router[_0xaa2b('0x20')]('/',auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x21')]);router[_0xaa2b('0x20')](_0xaa2b('0xd'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x22')]);router[_0xaa2b('0x20')]('/:id/canned_answers',auth[_0xaa2b('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xaa2b('0x23')]({'destination':function(_0x1330ef,_0x11bb4f,_0x4b930c){_0x4b930c(null,path['join'](config[_0xaa2b('0x24')],_0xaa2b('0x25')));},'filename':function(_0x553d03,_0x3ba68e,_0x160efc){_0x160efc(null,util[_0xaa2b('0x26')](_0xaa2b('0x27'),Date[_0xaa2b('0x28')](),_0x3ba68e[_0xaa2b('0x29')]));}})});router[_0xaa2b('0x20')](_0xaa2b('0xf'),upload['single'](_0xaa2b('0x2a')),controller[_0xaa2b('0x2b')]);var upload=multer({'storage':multer[_0xaa2b('0x23')]({'destination':function(_0x4d5ad8,_0x48c88e,_0xbc652a){_0xbc652a(null,path[_0xaa2b('0x2c')](config[_0xaa2b('0x24')],_0xaa2b('0x2d')));},'filename':function(_0x4cf429,_0x52d2ff,_0x3f6205){_0x3f6205(null,util[_0xaa2b('0x26')](_0xaa2b('0x27'),Date[_0xaa2b('0x28')](),_0x52d2ff[_0xaa2b('0x29')]));}})});router['post']('/:id/avatar',upload[_0xaa2b('0x2e')](_0xaa2b('0x2a')),controller[_0xaa2b('0x2f')]);var upload=multer({'storage':multer[_0xaa2b('0x23')]({'destination':function(_0x4b12fb,_0x5ea21e,_0x7fb7b9){_0x7fb7b9(null,path[_0xaa2b('0x2c')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x14eb5c,_0x14bb86,_0x4fbe5b){_0x4fbe5b(null,util['format'](_0xaa2b('0x27'),Date['now'](),_0x14bb86[_0xaa2b('0x29')]));}})});router[_0xaa2b('0x20')]('/:id/customer_avatar',upload[_0xaa2b('0x2e')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xaa2b('0x23')]({'destination':function(_0x5c34e1,_0x4258c7,_0x55a0fd){_0x55a0fd(null,path[_0xaa2b('0x2c')](config[_0xaa2b('0x24')],_0xaa2b('0x2d')));},'filename':function(_0x271067,_0x5a79cb,_0x3ed3ad){_0x3ed3ad(null,util['format']('%s-%s',Date['now'](),_0x5a79cb['originalname']));}})});router[_0xaa2b('0x20')](_0xaa2b('0x13'),upload[_0xaa2b('0x2e')](_0xaa2b('0x2a')),controller[_0xaa2b('0x30')]);router['post'](_0xaa2b('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xaa2b('0x23')]({'destination':function(_0x4b75e3,_0x5758d8,_0x31f007){const _0x4da911=path[_0xaa2b('0x2c')](config[_0xaa2b('0x24')],_0xaa2b('0x32'),_0xaa2b('0x33'),_0xaa2b('0x34'));fs_extra[_0xaa2b('0x35')](_0x4da911,function(){_0x31f007(null,_0x4da911);});},'filename':function(_0x590f70,_0x462441,_0x5b8a00){const _0x1b7fc1=_0x462441[_0xaa2b('0x29')][_0xaa2b('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x397ff=path['extname'](_0x1b7fc1);const _0x3b92eb=Date[_0xaa2b('0x28')]()+'-'+_0x1b7fc1[_0xaa2b('0x36')](_0x397ff,'')+_0x397ff;_0x5b8a00(null,_0x3b92eb);}})});router['post'](_0xaa2b('0x37'),offlineUploadMulter['any'](),controller['offline']);router[_0xaa2b('0x20')](_0xaa2b('0x15'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x38')]);router[_0xaa2b('0x20')]('/:id/applications',auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x39')]);router['post'](_0xaa2b('0x1a'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x3a')]);router['post']('/:id/users',auth[_0xaa2b('0x9')](),controller['addAgents']);router[_0xaa2b('0x3b')](_0xaa2b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xaa2b('0x3c')](_0xaa2b('0xc'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x3d')]);router[_0xaa2b('0x3c')]('/:id/dispositions',auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x3e')]);router['delete'](_0xaa2b('0xe'),auth[_0xaa2b('0x9')](),controller['removeAnswers']);router[_0xaa2b('0x3c')](_0xaa2b('0x1e'),auth[_0xaa2b('0x9')](),controller[_0xaa2b('0x3f')]);module[_0xaa2b('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 6e9fb10..16c357d 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e46=['/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x20efc3,_0x1d2191){var _0x49d176=function(_0x5a886f){while(--_0x5a886f){_0x20efc3['push'](_0x20efc3['shift']());}};_0x49d176(++_0x1d2191);}(_0x7e46,0x7c));var _0x67e4=function(_0x5c16fc,_0x282348){_0x5c16fc=_0x5c16fc-0x0;var _0x3bceb4=_0x7e46[_0x5c16fc];return _0x3bceb4;};var beaverLogger=require(_0x67e4('0x0'));var express=require(_0x67e4('0x1'));var auth=require(_0x67e4('0x2'));var config=require(_0x67e4('0x3'));var router=express['Router']();var isProduction=config[_0x67e4('0x4')]==='production'||![];function clientSideLogs(_0x4a6687,_0x55afab,_0x4c9196){var _0x205cf2=_0x4a6687[_0x67e4('0x5')]['get'](_0x67e4('0x6'));if(!_0x205cf2){throw new Error(_0x67e4('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x67e4('0x8'),'logger':_0x205cf2,'enableCors':!isProduction})(_0x4a6687,_0x55afab,_0x4c9196);}router[_0x67e4('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x67e4('0xa')]=router; \ No newline at end of file +var _0x6c8a=['Router','env','client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','../components/auth/service'];(function(_0x321b98,_0x4c7b2b){var _0x22948f=function(_0x12ac50){while(--_0x12ac50){_0x321b98['push'](_0x321b98['shift']());}};_0x22948f(++_0x4c7b2b);}(_0x6c8a,0x1c1));var _0xa6c8=function(_0x52db7d,_0x344fce){_0x52db7d=_0x52db7d-0x0;var _0x4a6946=_0x6c8a[_0x52db7d];return _0x4a6946;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xa6c8('0x0'));var config=require('../config/environment');var router=express[_0xa6c8('0x1')]();var isProduction=config[_0xa6c8('0x2')]==='production'||![];function clientSideLogs(_0x417e52,_0x322dc7,_0x15aef2){var _0x5a4b4a=_0x417e52['app']['get'](_0xa6c8('0x3'));if(!_0x5a4b4a){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xa6c8('0x4')]({'uri':_0xa6c8('0x5'),'logger':_0x5a4b4a,'enableCors':!isProduction})(_0x417e52,_0x322dc7,_0x15aef2);}router[_0xa6c8('0x6')](auth[_0xa6c8('0x7')](),clientSideLogs);module[_0xa6c8('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1fc1b7e..d3d7719 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 _0x5de5=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x5cbcb3,_0x3a025d){var _0x4e334c=function(_0x171866){while(--_0x171866){_0x5cbcb3['push'](_0x5cbcb3['shift']());}};_0x4e334c(++_0x3a025d);}(_0x5de5,0x153));var _0x55de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5de5[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x55de('0x0')]={'name':{'type':Sequelize[_0x55de('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x55de('0x2')](_0x55de('0x3'),_0x55de('0x4'),_0x55de('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x55de('0x2')]('Outlook365',_0x55de('0x6'))},'data1':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x7')},'data2':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x8')},'data3':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x9')},'data4':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0xa')},'data5':{'type':Sequelize[_0x55de('0xb')],'comment':_0x55de('0xc')},'data6':{'type':Sequelize[_0x55de('0xb')],'comment':_0x55de('0xd')},'data7':{'type':Sequelize[_0x55de('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x66f6=['AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x66f6,0x184));var _0x666f=function(_0x1c2838,_0x1dffa8){_0x1c2838=_0x1c2838-0x0;var _0x25d5af=_0x66f6[_0x1c2838];return _0x25d5af;};'use strict';var Sequelize=require(_0x666f('0x0'));module[_0x666f('0x1')]={'name':{'type':Sequelize[_0x666f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x666f('0x3')](_0x666f('0x4'),_0x666f('0x5'),_0x666f('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x666f('0x3')]('Outlook365',_0x666f('0x7'))},'data1':{'type':Sequelize[_0x666f('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x666f('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x666f('0x2')],'comment':_0x666f('0x8')},'data4':{'type':Sequelize[_0x666f('0x2')],'comment':_0x666f('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x666f('0xa')},'data6':{'type':Sequelize[_0x666f('0xb')],'comment':_0x666f('0xc')},'data7':{'type':Sequelize[_0x666f('0xb')],'comment':_0x666f('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 013993c..331036d 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 _0x936c=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','fields','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','error','stack','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x936c,0x1c7));var _0xc936=function(_0x5d42f4,_0x4b7188){_0x5d42f4=_0x5d42f4-0x0;var _0x4cf05c=_0x936c[_0x5d42f4];return _0x4cf05c;};'use strict';var _=require(_0xc936('0x0'));var Redis=require(_0xc936('0x1'));var qs=require(_0xc936('0x2'));var encryptor=require(_0xc936('0x3'));var config=require(_0xc936('0x4'));var logger=require(_0xc936('0x5'))(_0xc936('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc936('0x7'));config[_0xc936('0x8')]=_[_0xc936('0x9')](config['redis'],{'host':_0xc936('0xa'),'port':0x18eb});var socket=require(_0xc936('0xb'))(new Redis(config[_0xc936('0x8')]));var redis=new Redis(config[_0xc936('0x8')]);function respondWithStatusCode(_0x2de10a,_0x38c7da){_0x38c7da=_0x38c7da||0xcc;return function(_0x2ffb3c){if(_0x2ffb3c){return _0x2de10a[_0xc936('0xc')](_0x38c7da);}return _0x2de10a[_0xc936('0xd')](_0x38c7da)[_0xc936('0xe')]();};}function respondWithResult(_0x26b887,_0x3556df){_0x3556df=_0x3556df||0xc8;return function(_0x29a008){if(_0x29a008){return _0x26b887['status'](_0x3556df)[_0xc936('0xf')](_0x29a008);}};}function respondWithFilteredResult(_0x2837fd,_0x4702ed){return function(_0x5637ad){if(_0x5637ad){var _0x714c7=typeof _0x4702ed['offset']==='undefined'&&typeof _0x4702ed[_0xc936('0x10')]===_0xc936('0x11');var _0x2c79f7=_0x5637ad[_0xc936('0x12')];var _0x5643ca=_0x714c7?0x0:_0x4702ed['offset'];var _0x1a8223=_0x714c7?_0x5637ad[_0xc936('0x12')]:_0x4702ed[_0xc936('0x13')]+_0x4702ed[_0xc936('0x10')];var _0x9fce11;if(_0x1a8223>=_0x2c79f7){_0x1a8223=_0x2c79f7;_0x9fce11=0xc8;}else{_0x9fce11=0xce;}_0x2837fd['status'](_0x9fce11);return _0x2837fd[_0xc936('0x14')](_0xc936('0x15'),_0x5643ca+'-'+_0x1a8223+'/'+_0x2c79f7)[_0xc936('0xf')](_0x5637ad);}return null;};}function saveUpdates(_0x54f34d){return function(_0x14b126){if(_0x14b126){return _0x14b126[_0xc936('0x16')](_0x54f34d)['then'](function(_0x19921a){return _0x19921a;});}return null;};}function removeEntity(_0x375776){return function(_0x244bfe){if(_0x244bfe){return _0x244bfe[_0xc936('0x17')]()['then'](function(){_0x375776[_0xc936('0xd')](0xcc)[_0xc936('0xe')]();});}};}function handleEntityNotFound(_0x4ac351){return function(_0x15bb2e){if(!_0x15bb2e){_0x4ac351[_0xc936('0xc')](0x194);}return _0x15bb2e;};}function handleError(_0x43bb25,_0x37c561){_0x37c561=_0x37c561||0x1f4;return function(_0x2a4e43){logger[_0xc936('0x18')](_0x2a4e43[_0xc936('0x19')]);if(_0x2a4e43['name']){delete _0x2a4e43[_0xc936('0x1a')];}_0x43bb25['status'](_0x37c561)['send'](_0x2a4e43);};}function maskClientSecret(_0x35ed80){return _['padEnd'](_0x35ed80[_0xc936('0x1b')](0x0,0x3),0x14,'*');}exports[_0xc936('0x1c')]=function(_0x47f9fb,_0x2db42f){var _0x317514={},_0x33520c={},_0x2456a2={'count':0x0,'rows':[]};var _0x43d6b7=_[_0xc936('0x1d')](db[_0xc936('0x1e')][_0xc936('0x1f')],function(_0x5264e0){return{'name':_0x5264e0[_0xc936('0x20')],'type':_0x5264e0[_0xc936('0x21')][_0xc936('0x22')]};});_0x33520c[_0xc936('0x23')]=_[_0xc936('0x1d')](_0x43d6b7,_0xc936('0x1a'));_0x33520c[_0xc936('0x24')]=_[_0xc936('0x25')](_0x47f9fb[_0xc936('0x24')]);_0x33520c[_0xc936('0x26')]=_[_0xc936('0x27')](_0x33520c[_0xc936('0x23')],_0x33520c[_0xc936('0x24')]);_0x317514[_0xc936('0x28')]=_[_0xc936('0x27')](_0x33520c[_0xc936('0x23')],qs['fields'](_0x47f9fb[_0xc936('0x24')]['fields']));_0x317514[_0xc936('0x28')]=_0x317514[_0xc936('0x28')][_0xc936('0x29')]?_0x317514[_0xc936('0x28')]:_0x33520c[_0xc936('0x23')];if(!_0x47f9fb[_0xc936('0x24')][_0xc936('0x2a')](_0xc936('0x2b'))){_0x317514[_0xc936('0x10')]=qs['limit'](_0x47f9fb['query']['limit']);_0x317514[_0xc936('0x13')]=qs[_0xc936('0x13')](_0x47f9fb['query']['offset']);}_0x317514[_0xc936('0x2c')]=qs[_0xc936('0x2d')](_0x47f9fb[_0xc936('0x24')][_0xc936('0x2d')]);_0x317514[_0xc936('0x2e')]=qs['filters'](_[_0xc936('0x2f')](_0x47f9fb[_0xc936('0x24')],_0x33520c[_0xc936('0x26')]),_0x43d6b7);if(_0x47f9fb[_0xc936('0x24')][_0xc936('0x30')]){_0x317514[_0xc936('0x2e')]=_[_0xc936('0x31')](_0x317514[_0xc936('0x2e')],{'$or':_[_0xc936('0x1d')](_0x43d6b7,function(_0xe22cf6){if(_0xe22cf6[_0xc936('0x21')]!==_0xc936('0x32')){var _0x5ce3c1={};_0x5ce3c1[_0xe22cf6[_0xc936('0x1a')]]={'$like':'%'+_0x47f9fb[_0xc936('0x24')][_0xc936('0x30')]+'%'};return _0x5ce3c1;}})});}_0x317514=_['merge']({},_0x317514,_0x47f9fb[_0xc936('0x33')]);var _0x253c95={'where':_0x317514[_0xc936('0x2e')]};return db[_0xc936('0x1e')][_0xc936('0x12')](_0x253c95)[_0xc936('0x34')](function(_0x4f04c6){_0x2456a2[_0xc936('0x12')]=_0x4f04c6;if(_0x47f9fb[_0xc936('0x24')][_0xc936('0x35')]){_0x317514[_0xc936('0x36')]=[{'all':!![]}];}return db[_0xc936('0x1e')][_0xc936('0x37')](_0x317514);})[_0xc936('0x34')](function(_0x370b2c){_0x2456a2[_0xc936('0x38')]=_[_0xc936('0x1d')](_0x370b2c,function(_0x4e1a5d){if(_0x4e1a5d[_0xc936('0x39')]===_0xc936('0x3a')){var _0x18d38b=encryptor[_0xc936('0x3b')](_0x4e1a5d['data3']);_0x4e1a5d[_0xc936('0x3c')]=maskClientSecret(_0x18d38b);}return _0x4e1a5d;});return _0x2456a2;})[_0xc936('0x34')](respondWithFilteredResult(_0x2db42f,_0x317514))[_0xc936('0x3d')](handleError(_0x2db42f,null));};exports['show']=function(_0x315892,_0xf5e74d){var _0x5ef564={'raw':!![],'where':{'id':_0x315892[_0xc936('0x3e')]['id']}},_0x3c6e7e={};_0x3c6e7e[_0xc936('0x23')]=_[_0xc936('0x25')](db[_0xc936('0x1e')][_0xc936('0x1f')]);_0x3c6e7e[_0xc936('0x24')]=_['keys'](_0x315892['query']);_0x3c6e7e[_0xc936('0x26')]=_['intersection'](_0x3c6e7e[_0xc936('0x23')],_0x3c6e7e['query']);_0x5ef564[_0xc936('0x28')]=_['intersection'](_0x3c6e7e[_0xc936('0x23')],qs[_0xc936('0x3f')](_0x315892['query'][_0xc936('0x3f')]));_0x5ef564[_0xc936('0x28')]=_0x5ef564[_0xc936('0x28')][_0xc936('0x29')]?_0x5ef564[_0xc936('0x28')]:_0x3c6e7e[_0xc936('0x23')];if(_0x315892['query'][_0xc936('0x35')]){_0x5ef564[_0xc936('0x36')]=[{'all':!![]}];}_0x5ef564=_[_0xc936('0x31')]({},_0x5ef564,_0x315892[_0xc936('0x33')]);return db['CloudProvider']['find'](_0x5ef564)[_0xc936('0x34')](handleEntityNotFound(_0xf5e74d,null))['then'](function(_0x4cea0a){if(_0x4cea0a['service']===_0xc936('0x3a')){var _0x56321d=encryptor['decryptString'](_0x4cea0a[_0xc936('0x3c')]);_0x4cea0a['data3']=maskClientSecret(_0x56321d);}return _0x4cea0a;})[_0xc936('0x34')](respondWithResult(_0xf5e74d,null))[_0xc936('0x3d')](handleError(_0xf5e74d,null));};exports['create']=function(_0x54c993,_0x5b165f){if(!_0x54c993[_0xc936('0x40')]['name'])throw new Error(_0xc936('0x41'));if(!_0x54c993[_0xc936('0x40')][_0xc936('0x39')])throw new Error(_0xc936('0x42'));var _0x3f5157=db[_0xc936('0x1e')]['rawAttributes'][_0xc936('0x39')]['values'];if(!_0x3f5157[_0xc936('0x43')](_0x54c993['body']['service']))throw new Error(_0xc936('0x44')+_0x3f5157['join'](',\x20'));if(_0x54c993['body']['service']===_0xc936('0x3a')&&_0x54c993[_0xc936('0x40')][_0xc936('0x3c')]){_0x54c993[_0xc936('0x40')]['data3']=encryptor[_0xc936('0x45')](_0x54c993[_0xc936('0x40')][_0xc936('0x3c')]);}return db[_0xc936('0x1e')][_0xc936('0x46')](_0x54c993[_0xc936('0x40')],{})['then'](respondWithResult(_0x5b165f,0xc9))[_0xc936('0x3d')](handleError(_0x5b165f,null));};exports['update']=function(_0x26e809,_0x9674ce){if(_0x26e809['body']['id']){delete _0x26e809[_0xc936('0x40')]['id'];}return db[_0xc936('0x1e')][_0xc936('0x47')]({'where':{'id':_0x26e809['params']['id']}})[_0xc936('0x34')](handleEntityNotFound(_0x9674ce,null))[_0xc936('0x34')](function(_0x2ded5b){if(_0x2ded5b['service']===_0xc936('0x3a')&&_0x26e809['body'][_0xc936('0x3c')]){_0x26e809[_0xc936('0x40')][_0xc936('0x3c')]=encryptor['encryptString'](_0x26e809[_0xc936('0x40')][_0xc936('0x3c')]);}return _0x2ded5b;})['then'](saveUpdates(_0x26e809[_0xc936('0x40')],null))[_0xc936('0x34')](respondWithResult(_0x9674ce,null))[_0xc936('0x3d')](handleError(_0x9674ce,null));};exports[_0xc936('0x17')]=function(_0x1981bd,_0x567e71){return db[_0xc936('0x1e')][_0xc936('0x47')]({'where':{'id':_0x1981bd['params']['id']}})[_0xc936('0x34')](handleEntityNotFound(_0x567e71,null))['then'](removeEntity(_0x567e71,null))[_0xc936('0x3d')](handleError(_0x567e71,null));};exports[_0xc936('0x48')]=function(_0x25fd86,_0x35c109){return db[_0xc936('0x1e')][_0xc936('0x49')]({'where':{'id':_0x25fd86[_0xc936('0x3e')]['id']},'raw':!![]})['then'](function(_0x47043d){if(!_0x47043d)return _0x35c109[_0xc936('0xc')](0x194);return{'url':oauth[_0xc936('0x4a')](_0x47043d,_0x25fd86[_0xc936('0x4b')]['id'])};})[_0xc936('0x34')](respondWithResult(_0x35c109,null))[_0xc936('0x3d')](handleError(_0x35c109,null));};exports['oauth2MicrosoftCallback']=function(_0x561c65,_0x105756){var _0x5c54d0=_0x561c65[_0xc936('0x40')];var _0x379eab;var _0x3bb4a6;if(_0x5c54d0[_0xc936('0x18')])throw _0x5c54d0;redis[_0xc936('0x4c')](_0x5c54d0[_0xc936('0x4d')])[_0xc936('0x34')](function(_0x11e0cd){if(!_0x11e0cd)throw new Error(_0xc936('0x4e'));_0x379eab=JSON[_0xc936('0x4f')](_0x11e0cd);var _0x49fd5b=Buffer[_0xc936('0x50')](_0x5c54d0['state'],_0xc936('0x51'))[_0xc936('0x52')](_0xc936('0x53'));_0x3bb4a6=JSON[_0xc936('0x4f')](_0x49fd5b);if(!oauth[_0xc936('0x54')](_0x5c54d0['id_token'],_0x379eab['oauth2Claims']))throw new Error(_0xc936('0x55'));redis[_0xc936('0x56')](_0x5c54d0[_0xc936('0x4d')]);return oauth[_0xc936('0x57')](_0x5c54d0[_0xc936('0x58')],_0x379eab);})[_0xc936('0x34')](function(_0x26a1d2){_0x379eab[_0xc936('0x59')]=_0x26a1d2['access_token'];_0x379eab['data6']=_0x26a1d2[_0xc936('0x5a')];return db['CloudProvider']['update']({'data5':_0x379eab['data5'],'data6':_0x379eab[_0xc936('0x5b')]},{'where':{'id':_0x379eab['id']}});})['then'](function(){oauth[_0xc936('0x5c')](_0x379eab);socket[_0xc936('0x5d')](_0xc936('0x5e'),{'id':_0x3bb4a6['id']});return;})[_0xc936('0x34')](respondWithStatusCode(_0x105756,null))[_0xc936('0x3d')](function(_0x1879e3){if(_0x3bb4a6){socket[_0xc936('0x5d')](_0xc936('0x5f'),{'id':_0x3bb4a6['id']});}if(!_0x379eab){logger['error'](_0xc936('0x60'),_0x1879e3);return _0x105756[_0xc936('0xd')](0x1f4)['send'](_0x1879e3[_0xc936('0x61')]);}logger[_0xc936('0x18')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x379eab['id'],JSON[_0xc936('0x62')](_0x1879e3));});}; \ No newline at end of file +var _0x3423=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','params','intersection','find','decryptString','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','./cloudProvider.oauth','redis','localhost','socket.io-emitter'];(function(_0x5f1207,_0x224664){var _0x14b9d6=function(_0x2a4917){while(--_0x2a4917){_0x5f1207['push'](_0x5f1207['shift']());}};_0x14b9d6(++_0x224664);}(_0x3423,0x15e));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var Redis=require(_0x3342('0x1'));var qs=require(_0x3342('0x2'));var encryptor=require(_0x3342('0x3'));var config=require(_0x3342('0x4'));var logger=require('../../config/logger')(_0x3342('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x3342('0x6'));config[_0x3342('0x7')]=_['defaults'](config['redis'],{'host':_0x3342('0x8'),'port':0x18eb});var socket=require(_0x3342('0x9'))(new Redis(config[_0x3342('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x380c75,_0x13b45a){_0x13b45a=_0x13b45a||0xcc;return function(_0x4512db){if(_0x4512db){return _0x380c75[_0x3342('0xa')](_0x13b45a);}return _0x380c75[_0x3342('0xb')](_0x13b45a)[_0x3342('0xc')]();};}function respondWithResult(_0x43909b,_0x4e2ecb){_0x4e2ecb=_0x4e2ecb||0xc8;return function(_0x12cbab){if(_0x12cbab){return _0x43909b[_0x3342('0xb')](_0x4e2ecb)['json'](_0x12cbab);}};}function respondWithFilteredResult(_0x55d6d8,_0x54929d){return function(_0x3d16f0){if(_0x3d16f0){var _0x35a35a=typeof _0x54929d[_0x3342('0xd')]===_0x3342('0xe')&&typeof _0x54929d[_0x3342('0xf')]===_0x3342('0xe');var _0x26588c=_0x3d16f0[_0x3342('0x10')];var _0x19d0c3=_0x35a35a?0x0:_0x54929d['offset'];var _0xb887ce=_0x35a35a?_0x3d16f0[_0x3342('0x10')]:_0x54929d['offset']+_0x54929d[_0x3342('0xf')];var _0x3912eb;if(_0xb887ce>=_0x26588c){_0xb887ce=_0x26588c;_0x3912eb=0xc8;}else{_0x3912eb=0xce;}_0x55d6d8[_0x3342('0xb')](_0x3912eb);return _0x55d6d8[_0x3342('0x11')](_0x3342('0x12'),_0x19d0c3+'-'+_0xb887ce+'/'+_0x26588c)['json'](_0x3d16f0);}return null;};}function saveUpdates(_0x4d8915){return function(_0x3ee71e){if(_0x3ee71e){return _0x3ee71e[_0x3342('0x13')](_0x4d8915)[_0x3342('0x14')](function(_0xe16eb1){return _0xe16eb1;});}return null;};}function removeEntity(_0x5b1cab){return function(_0x7e69de){if(_0x7e69de){return _0x7e69de[_0x3342('0x15')]()[_0x3342('0x14')](function(){_0x5b1cab[_0x3342('0xb')](0xcc)[_0x3342('0xc')]();});}};}function handleEntityNotFound(_0x246ce9){return function(_0x3b2785){if(!_0x3b2785){_0x246ce9[_0x3342('0xa')](0x194);}return _0x3b2785;};}function handleError(_0x330c73,_0x372cf3){_0x372cf3=_0x372cf3||0x1f4;return function(_0x592564){logger[_0x3342('0x16')](_0x592564[_0x3342('0x17')]);if(_0x592564['name']){delete _0x592564[_0x3342('0x18')];}_0x330c73[_0x3342('0xb')](_0x372cf3)[_0x3342('0x19')](_0x592564);};}function maskClientSecret(_0xa113be){return _['padEnd'](_0xa113be['slice'](0x0,0x3),0x14,'*');}exports[_0x3342('0x1a')]=function(_0x3dfa08,_0x219fe2){var _0x2759bc={},_0x590e76={},_0x4258cc={'count':0x0,'rows':[]};var _0x5a40c9=_['map'](db[_0x3342('0x1b')][_0x3342('0x1c')],function(_0x1b378e){return{'name':_0x1b378e[_0x3342('0x1d')],'type':_0x1b378e[_0x3342('0x1e')][_0x3342('0x1f')]};});_0x590e76['model']=_['map'](_0x5a40c9,_0x3342('0x18'));_0x590e76[_0x3342('0x20')]=_[_0x3342('0x21')](_0x3dfa08[_0x3342('0x20')]);_0x590e76[_0x3342('0x22')]=_['intersection'](_0x590e76[_0x3342('0x23')],_0x590e76[_0x3342('0x20')]);_0x2759bc[_0x3342('0x24')]=_['intersection'](_0x590e76[_0x3342('0x23')],qs[_0x3342('0x25')](_0x3dfa08['query']['fields']));_0x2759bc[_0x3342('0x24')]=_0x2759bc[_0x3342('0x24')][_0x3342('0x26')]?_0x2759bc[_0x3342('0x24')]:_0x590e76[_0x3342('0x23')];if(!_0x3dfa08[_0x3342('0x20')][_0x3342('0x27')](_0x3342('0x28'))){_0x2759bc['limit']=qs[_0x3342('0xf')](_0x3dfa08[_0x3342('0x20')][_0x3342('0xf')]);_0x2759bc[_0x3342('0xd')]=qs[_0x3342('0xd')](_0x3dfa08[_0x3342('0x20')][_0x3342('0xd')]);}_0x2759bc[_0x3342('0x29')]=qs[_0x3342('0x2a')](_0x3dfa08['query']['sort']);_0x2759bc[_0x3342('0x2b')]=qs[_0x3342('0x22')](_[_0x3342('0x2c')](_0x3dfa08[_0x3342('0x20')],_0x590e76['filters']),_0x5a40c9);if(_0x3dfa08[_0x3342('0x20')][_0x3342('0x2d')]){_0x2759bc['where']=_[_0x3342('0x2e')](_0x2759bc[_0x3342('0x2b')],{'$or':_[_0x3342('0x2f')](_0x5a40c9,function(_0x3f2add){if(_0x3f2add[_0x3342('0x1e')]!==_0x3342('0x30')){var _0x5ab314={};_0x5ab314[_0x3f2add[_0x3342('0x18')]]={'$like':'%'+_0x3dfa08[_0x3342('0x20')][_0x3342('0x2d')]+'%'};return _0x5ab314;}})});}_0x2759bc=_[_0x3342('0x2e')]({},_0x2759bc,_0x3dfa08['options']);var _0xdf7fba={'where':_0x2759bc[_0x3342('0x2b')]};return db[_0x3342('0x1b')][_0x3342('0x10')](_0xdf7fba)['then'](function(_0x33c27f){_0x4258cc[_0x3342('0x10')]=_0x33c27f;if(_0x3dfa08[_0x3342('0x20')][_0x3342('0x31')]){_0x2759bc[_0x3342('0x32')]=[{'all':!![]}];}return db[_0x3342('0x1b')][_0x3342('0x33')](_0x2759bc);})['then'](function(_0xf131c2){_0x4258cc['rows']=_[_0x3342('0x2f')](_0xf131c2,function(_0x53f857){if(_0x53f857[_0x3342('0x34')]===_0x3342('0x35')){var _0x2d4866=encryptor['decryptString'](_0x53f857[_0x3342('0x36')]);_0x53f857[_0x3342('0x36')]=maskClientSecret(_0x2d4866);}return _0x53f857;});return _0x4258cc;})[_0x3342('0x14')](respondWithFilteredResult(_0x219fe2,_0x2759bc))[_0x3342('0x37')](handleError(_0x219fe2,null));};exports['show']=function(_0x2c1bf8,_0x5cf142){var _0x2d42b2={'raw':!![],'where':{'id':_0x2c1bf8[_0x3342('0x38')]['id']}},_0x5e3daa={};_0x5e3daa['model']=_[_0x3342('0x21')](db[_0x3342('0x1b')][_0x3342('0x1c')]);_0x5e3daa[_0x3342('0x20')]=_['keys'](_0x2c1bf8['query']);_0x5e3daa[_0x3342('0x22')]=_[_0x3342('0x39')](_0x5e3daa[_0x3342('0x23')],_0x5e3daa['query']);_0x2d42b2[_0x3342('0x24')]=_[_0x3342('0x39')](_0x5e3daa[_0x3342('0x23')],qs[_0x3342('0x25')](_0x2c1bf8[_0x3342('0x20')][_0x3342('0x25')]));_0x2d42b2[_0x3342('0x24')]=_0x2d42b2[_0x3342('0x24')][_0x3342('0x26')]?_0x2d42b2[_0x3342('0x24')]:_0x5e3daa[_0x3342('0x23')];if(_0x2c1bf8[_0x3342('0x20')][_0x3342('0x31')]){_0x2d42b2[_0x3342('0x32')]=[{'all':!![]}];}_0x2d42b2=_[_0x3342('0x2e')]({},_0x2d42b2,_0x2c1bf8['options']);return db[_0x3342('0x1b')][_0x3342('0x3a')](_0x2d42b2)[_0x3342('0x14')](handleEntityNotFound(_0x5cf142,null))['then'](function(_0x1b6065){if(_0x1b6065['service']===_0x3342('0x35')){var _0x567331=encryptor[_0x3342('0x3b')](_0x1b6065[_0x3342('0x36')]);_0x1b6065[_0x3342('0x36')]=maskClientSecret(_0x567331);}return _0x1b6065;})[_0x3342('0x14')](respondWithResult(_0x5cf142,null))[_0x3342('0x37')](handleError(_0x5cf142,null));};exports[_0x3342('0x3c')]=function(_0x5b5b7d,_0x2e4799){if(!_0x5b5b7d['body']['name'])throw new Error(_0x3342('0x3d'));if(!_0x5b5b7d[_0x3342('0x3e')][_0x3342('0x34')])throw new Error(_0x3342('0x3f'));var _0x50316d=db['CloudProvider']['rawAttributes'][_0x3342('0x34')][_0x3342('0x40')];if(!_0x50316d['includes'](_0x5b5b7d['body'][_0x3342('0x34')]))throw new Error(_0x3342('0x41')+_0x50316d['join'](',\x20'));if(_0x5b5b7d['body'][_0x3342('0x34')]===_0x3342('0x35')&&_0x5b5b7d[_0x3342('0x3e')][_0x3342('0x36')]){_0x5b5b7d[_0x3342('0x3e')][_0x3342('0x36')]=encryptor[_0x3342('0x42')](_0x5b5b7d[_0x3342('0x3e')][_0x3342('0x36')]);}return db[_0x3342('0x1b')][_0x3342('0x3c')](_0x5b5b7d[_0x3342('0x3e')],{})['then'](respondWithResult(_0x2e4799,0xc9))[_0x3342('0x37')](handleError(_0x2e4799,null));};exports['update']=function(_0x4b7e4d,_0x1726cc){if(_0x4b7e4d['body']['id']){delete _0x4b7e4d[_0x3342('0x3e')]['id'];}return db[_0x3342('0x1b')][_0x3342('0x3a')]({'where':{'id':_0x4b7e4d['params']['id']}})[_0x3342('0x14')](handleEntityNotFound(_0x1726cc,null))['then'](function(_0x42affc){if(_0x42affc[_0x3342('0x34')]==='MicrosoftAzure'&&_0x4b7e4d['body'][_0x3342('0x36')]){_0x4b7e4d['body'][_0x3342('0x36')]=encryptor[_0x3342('0x42')](_0x4b7e4d[_0x3342('0x3e')][_0x3342('0x36')]);}return _0x42affc;})['then'](saveUpdates(_0x4b7e4d[_0x3342('0x3e')],null))[_0x3342('0x14')](respondWithResult(_0x1726cc,null))[_0x3342('0x37')](handleError(_0x1726cc,null));};exports[_0x3342('0x15')]=function(_0x3e5bcf,_0x233dd4){return db[_0x3342('0x1b')]['find']({'where':{'id':_0x3e5bcf[_0x3342('0x38')]['id']}})[_0x3342('0x14')](handleEntityNotFound(_0x233dd4,null))[_0x3342('0x14')](removeEntity(_0x233dd4,null))[_0x3342('0x37')](handleError(_0x233dd4,null));};exports['oauth2MicrosoftAuthorize']=function(_0x1326a8,_0x28090b){return db[_0x3342('0x1b')]['findOne']({'where':{'id':_0x1326a8[_0x3342('0x38')]['id']},'raw':!![]})[_0x3342('0x14')](function(_0x530e0f){if(!_0x530e0f)return _0x28090b[_0x3342('0xa')](0x194);return{'url':oauth[_0x3342('0x43')](_0x530e0f,_0x1326a8[_0x3342('0x44')]['id'])};})['then'](respondWithResult(_0x28090b,null))[_0x3342('0x37')](handleError(_0x28090b,null));};exports[_0x3342('0x45')]=function(_0x2d6b9e,_0x308261){var _0x379bc4=_0x2d6b9e[_0x3342('0x3e')];var _0xffedf1;var _0x59e3e0;if(_0x379bc4[_0x3342('0x16')])throw _0x379bc4;redis[_0x3342('0x46')](_0x379bc4[_0x3342('0x47')])[_0x3342('0x14')](function(_0x5f288f){if(!_0x5f288f)throw new Error(_0x3342('0x48'));_0xffedf1=JSON[_0x3342('0x49')](_0x5f288f);var _0x465321=Buffer['from'](_0x379bc4[_0x3342('0x47')],_0x3342('0x4a'))[_0x3342('0x4b')](_0x3342('0x4c'));_0x59e3e0=JSON[_0x3342('0x49')](_0x465321);if(!oauth[_0x3342('0x4d')](_0x379bc4['id_token'],_0xffedf1[_0x3342('0x4e')]))throw new Error(_0x3342('0x4f'));redis[_0x3342('0x50')](_0x379bc4[_0x3342('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0x379bc4['code'],_0xffedf1);})[_0x3342('0x14')](function(_0x473eca){_0xffedf1['data5']=_0x473eca[_0x3342('0x51')];_0xffedf1[_0x3342('0x52')]=_0x473eca[_0x3342('0x53')];return db[_0x3342('0x1b')][_0x3342('0x13')]({'data5':_0xffedf1['data5'],'data6':_0xffedf1[_0x3342('0x52')]},{'where':{'id':_0xffedf1['id']}});})[_0x3342('0x14')](function(){oauth['startRefreshInterval'](_0xffedf1);socket[_0x3342('0x54')](_0x3342('0x55'),{'id':_0x59e3e0['id']});return;})['then'](respondWithStatusCode(_0x308261,null))[_0x3342('0x37')](function(_0x7a4cfe){if(_0x59e3e0){socket[_0x3342('0x54')](_0x3342('0x56'),{'id':_0x59e3e0['id']});}if(!_0xffedf1){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x7a4cfe);return _0x308261[_0x3342('0xb')](0x1f4)['send'](_0x7a4cfe[_0x3342('0x57')]);}logger['error'](_0x3342('0x58'),_0xffedf1['id'],JSON[_0x3342('0x59')](_0x7a4cfe));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fca3c03..8a1de72 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 _0xe91b=['define','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x218577,_0x1c0704){var _0x4c6b7c=function(_0x17900d){while(--_0x17900d){_0x218577['push'](_0x218577['shift']());}};_0x4c6b7c(++_0x1c0704);}(_0xe91b,0x161));var _0xbe91=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xe91b[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xbe91('0x0'));var util=require('util');var logger=require(_0xbe91('0x1'))(_0xbe91('0x2'));var moment=require(_0xbe91('0x3'));var BPromise=require(_0xbe91('0x4'));var rp=require(_0xbe91('0x5'));var fs=require('fs');var path=require(_0xbe91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x116ffb,_0x4bb44c){return _0x116ffb[_0xbe91('0x7')]('CloudProvider',attributes,{'tableName':_0xbe91('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae99=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider'];(function(_0x6cf1fa,_0x63a63e){var _0x246ae8=function(_0x4ed3fb){while(--_0x4ed3fb){_0x6cf1fa['push'](_0x6cf1fa['shift']());}};_0x246ae8(++_0x63a63e);}(_0xae99,0x172));var _0x9ae9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xae99[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9ae9('0x2'));var rp=require(_0x9ae9('0x3'));var fs=require('fs');var path=require(_0x9ae9('0x4'));var rimraf=require(_0x9ae9('0x5'));var config=require(_0x9ae9('0x6'));var attributes=require(_0x9ae9('0x7'));module[_0x9ae9('0x8')]=function(_0x49066e,_0x5a1ba5){return _0x49066e['define'](_0x9ae9('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 8e0761e..c5c8acd 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12e3=['https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','from','stringify','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','prompt','key','value','oauth2Claims','replace','oauth2/','payload','iss','aud','audience','nonce','isAfter','exp','resolve','data3','findOne','then','refresh_token','decryptString','POST','data5','access_token','CloudProvider','update','data6','catch','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0x3a2a33,_0x29372a){var _0x10d6d2=function(_0x2c63b7){while(--_0x2c63b7){_0x3a2a33['push'](_0x3a2a33['shift']());}};_0x10d6d2(++_0x29372a);}(_0x12e3,0x127));var _0x312e=function(_0x4cdcb8,_0x44fc53){_0x4cdcb8=_0x4cdcb8-0x0;var _0x29996d=_0x12e3[_0x4cdcb8];return _0x29996d;};'use strict';var _=require(_0x312e('0x0'));var crypto=require(_0x312e('0x1'));var jwt=require(_0x312e('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x312e('0x3'));var util=require('util');var encryptor=require(_0x312e('0x4'));var config=require(_0x312e('0x5'));var logger=require(_0x312e('0x6'))(_0x312e('0x7'));var schedule=require(_0x312e('0x8'));var db=require(_0x312e('0x9'))['db'];config[_0x312e('0xa')]=_[_0x312e('0xb')](config[_0x312e('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x312e('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x312e('0xc'),_0x312e('0xd'),_0x312e('0xe'),_0x312e('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x312e('0x10'),_0x312e('0x11')],'Dynamics365':[_0x312e('0xc'),_0x312e('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x312e('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x312e('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d2ef5){var _0x2587a9=_[_0x312e('0x14')](AZURE_AUTH_SCOPES[_0x5d2ef5[_0x312e('0x15')]]);if(_0x5d2ef5[_0x312e('0x15')]===_0x312e('0x16'))_0x2587a9[_0x312e('0x17')](_0x5d2ef5[_0x312e('0x18')]+_0x312e('0x19'));return _0x2587a9[_0x312e('0x1a')]('\x20');}function getAccessTokenScope(_0x478998){if(_0x478998['type']===_0x312e('0x1b'))return _0x312e('0x1c');if(_0x478998[_0x312e('0x15')]===_0x312e('0x16'))return _0x478998[_0x312e('0x18')]+_0x312e('0x19');}function generateMicrosoftAuthorizationUrl(_0x3c2386,_0x437c10){var _0x26f61a=MICROSOFT_AUTH_URL['replace'](_0x312e('0x1d'),_0x3c2386['data2']);var _0x4aafb9=['code','id_token'];var _0x2dc6b0=Buffer[_0x312e('0x1e')](JSON[_0x312e('0x1f')]({'id':_0x437c10}))['toString'](_0x312e('0x20'));var _0x407ac9=crypto[_0x312e('0x21')](0x10)['toString'](_0x312e('0x22'));var _0x4966a3=getAuthorizationScopes(_0x3c2386);var _0x534a5b=[{'key':_0x312e('0x23'),'value':_0x3c2386[_0x312e('0x24')]},{'key':_0x312e('0x25'),'value':encodeURIComponent(_0x4aafb9[_0x312e('0x1a')]('\x20'))},{'key':_0x312e('0x26'),'value':_0x3c2386['data4']},{'key':_0x312e('0x27'),'value':_0x312e('0x28')},{'key':_0x312e('0x29'),'value':encodeURIComponent(_0x4966a3)},{'key':_0x312e('0x2a'),'value':_0x2dc6b0},{'key':'nonce','value':_0x407ac9},{'key':_0x312e('0x2b'),'value':'login'}];var _0x27e400=_0x26f61a+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x534a5b,function(_0x19e520){return _0x19e520[_0x312e('0x2c')]+'='+_0x19e520[_0x312e('0x2d')];})[_0x312e('0x1a')]('&');_0x3c2386[_0x312e('0x2e')]={'issuer':_0x26f61a[_0x312e('0x2f')](_0x312e('0x30'),''),'audience':_0x3c2386[_0x312e('0x24')],'state':_0x2dc6b0,'nonce':_0x407ac9};redis['set'](_0x2dc6b0,JSON[_0x312e('0x1f')](_0x3c2386));return _0x27e400;}function isValidIdToken(_0x1aebd6,_0x22e69c){try{var _0x423929=jwt['decode'](_0x1aebd6,{'complete':!![]});var _0x48da9a=_0x423929[_0x312e('0x31')];if(_0x48da9a[_0x312e('0x32')]!==_0x22e69c['issuer'])return![];if(_0x48da9a[_0x312e('0x33')]!==_0x22e69c[_0x312e('0x34')])return![];if(_0x48da9a[_0x312e('0x35')]!==_0x22e69c[_0x312e('0x35')])return![];if(moment()[_0x312e('0x36')](moment['unix'](_0x48da9a[_0x312e('0x37')])))return![];return!![];}catch(_0x34f221){throw _0x34f221;}}function refreshOauth2MicrosoftAccessToken(_0x138942){return Promise[_0x312e('0x38')]()['then'](function(){if(_0x138942[_0x312e('0x39')])return _0x138942;return db['CloudProvider'][_0x312e('0x3a')]({'where':{'id':_0x138942['id']},'raw':!![]});})[_0x312e('0x3b')](function(_0x5c88e5){var _0x597184={'grant_type':_0x312e('0x3c'),'refresh_token':_0x5c88e5['data6'],'scope':getAccessTokenScope(_0x5c88e5),'redirect_uri':_0x5c88e5['data4'],'client_id':_0x5c88e5[_0x312e('0x24')],'client_secret':encryptor[_0x312e('0x3d')](_0x5c88e5['data3'])};var _0x2a2a7e={'method':_0x312e('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x312e('0x2f')](_0x312e('0x1d'),_0x5c88e5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x597184,'json':!![]};return rp(_0x2a2a7e);})[_0x312e('0x3b')](function(_0x52d233){_0x138942[_0x312e('0x3f')]=_0x52d233[_0x312e('0x40')];_0x138942['data6']=_0x52d233[_0x312e('0x3c')];return db[_0x312e('0x41')][_0x312e('0x42')]({'data5':_0x138942['data5'],'data6':_0x138942[_0x312e('0x43')]},{'where':{'id':_0x138942['id']}});})[_0x312e('0x3b')](function(){return _0x138942;})[_0x312e('0x44')](function(_0xc3ba3f){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x138942['id'],_0xc3ba3f);});}function getOauth2MicrosoftAccessToken(_0x57c1e4,_0x1552fb){var _0x48db42={'grant_type':_0x312e('0x45'),'code':_0x57c1e4,'scope':getAccessTokenScope(_0x1552fb),'redirect_uri':_0x1552fb['data4'],'client_id':_0x1552fb['data1'],'client_secret':encryptor[_0x312e('0x3d')](_0x1552fb[_0x312e('0x39')])};var _0x53a3df={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x312e('0x2f')](_0x312e('0x1d'),_0x1552fb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48db42,'json':!![]};return rp(_0x53a3df);}function startRefreshInterval(_0x3f053e){var _0x57f3bd=schedule[_0x312e('0x46')];if(_0x57f3bd[_0x3f053e['id']])clearInterval(_0x57f3bd[_0x3f053e['id']]);_0x57f3bd[_0x3f053e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x312e('0x47')](this,{'id':_0x3f053e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x57f3bd;}function startAllRefreshIntervals(){return db[_0x312e('0x41')][_0x312e('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x312e('0x3b')](function(_0x254260){var _0x3e447e=_0x254260[_0x312e('0x14')](function(_0x291d3f){return refreshOauth2MicrosoftAccessToken(_0x291d3f)[_0x312e('0x3b')](function(_0x46e2fc){startRefreshInterval(_0x46e2fc);});});return Promise[_0x312e('0x49')](_0x3e447e);})['catch'](function(_0x1b441d){var _0x5d09a3=_0x1b441d?util[_0x312e('0x4a')](_0x1b441d,{'showHidden':![],'depth':null}):'';logger[_0x312e('0x4b')](_0x312e('0x4c'),_0x5d09a3);});}module[_0x312e('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4210=['iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','data6','decryptString','POST','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4','intervals','bind','findAll','all','inspect','exports','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','redirect_uri','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','data1','set','decode'];(function(_0x1d19c9,_0x145c6d){var _0x416e6a=function(_0x47bd3d){while(--_0x47bd3d){_0x1d19c9['push'](_0x1d19c9['shift']());}};_0x416e6a(++_0x145c6d);}(_0x4210,0x10e));var _0x0421=function(_0x2dac64,_0x538523){_0x2dac64=_0x2dac64-0x0;var _0x111fc4=_0x4210[_0x2dac64];return _0x111fc4;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x0421('0x0'));var moment=require(_0x0421('0x1'));var Redis=require('ioredis');var rp=require(_0x0421('0x2'));var util=require(_0x0421('0x3'));var encryptor=require(_0x0421('0x4'));var config=require(_0x0421('0x5'));var logger=require(_0x0421('0x6'))(_0x0421('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x0421('0x8'))['db'];config[_0x0421('0x9')]=_['defaults'](config[_0x0421('0x9')],{'host':_0x0421('0xa'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x0421('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0421('0xc'),_0x0421('0xd'),_0x0421('0xe'),_0x0421('0xf'),_0x0421('0x10'),_0x0421('0x11'),_0x0421('0x12')],'Dynamics365':[_0x0421('0xc'),_0x0421('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x0421('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x223328){var _0x528269=_[_0x0421('0x14')](AZURE_AUTH_SCOPES[_0x223328[_0x0421('0x15')]]);if(_0x223328[_0x0421('0x15')]===_0x0421('0x16'))_0x528269['push'](_0x223328[_0x0421('0x17')]+_0x0421('0x18'));return _0x528269[_0x0421('0x19')]('\x20');}function getAccessTokenScope(_0x1eeb71){if(_0x1eeb71[_0x0421('0x15')]===_0x0421('0x1a'))return _0x0421('0x10');if(_0x1eeb71['type']===_0x0421('0x16'))return _0x1eeb71[_0x0421('0x17')]+_0x0421('0x18');}function generateMicrosoftAuthorizationUrl(_0x3bbcc5,_0x5db597){var _0x2a32ba=MICROSOFT_AUTH_URL[_0x0421('0x1b')](_0x0421('0x1c'),_0x3bbcc5[_0x0421('0x1d')]);var _0x4df3d1=[_0x0421('0x1e'),'id_token'];var _0x401304=Buffer[_0x0421('0x1f')](JSON[_0x0421('0x20')]({'id':_0x5db597}))[_0x0421('0x21')](_0x0421('0x22'));var _0x3f2707=crypto[_0x0421('0x23')](0x10)[_0x0421('0x21')]('hex');var _0x499b6f=getAuthorizationScopes(_0x3bbcc5);var _0x55b5a1=[{'key':'client_id','value':_0x3bbcc5['data1']},{'key':'response_type','value':encodeURIComponent(_0x4df3d1[_0x0421('0x19')]('\x20'))},{'key':_0x0421('0x24'),'value':_0x3bbcc5['data4']},{'key':'response_mode','value':_0x0421('0x25')},{'key':_0x0421('0x26'),'value':encodeURIComponent(_0x499b6f)},{'key':_0x0421('0x27'),'value':_0x401304},{'key':_0x0421('0x28'),'value':_0x3f2707},{'key':_0x0421('0x29'),'value':_0x0421('0x2a')}];var _0x4bfa99=_0x2a32ba+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0421('0x14')](_0x55b5a1,function(_0x204261){return _0x204261[_0x0421('0x2b')]+'='+_0x204261[_0x0421('0x2c')];})[_0x0421('0x19')]('&');_0x3bbcc5[_0x0421('0x2d')]={'issuer':_0x2a32ba[_0x0421('0x1b')](_0x0421('0x2e'),''),'audience':_0x3bbcc5[_0x0421('0x2f')],'state':_0x401304,'nonce':_0x3f2707};redis[_0x0421('0x30')](_0x401304,JSON[_0x0421('0x20')](_0x3bbcc5));return _0x4bfa99;}function isValidIdToken(_0x51f819,_0x407c3f){try{var _0x1a9012=jwt[_0x0421('0x31')](_0x51f819,{'complete':!![]});var _0x4768e6=_0x1a9012['payload'];if(_0x4768e6[_0x0421('0x32')]!==_0x407c3f[_0x0421('0x33')])return![];if(_0x4768e6[_0x0421('0x34')]!==_0x407c3f[_0x0421('0x35')])return![];if(_0x4768e6['nonce']!==_0x407c3f[_0x0421('0x28')])return![];if(moment()[_0x0421('0x36')](moment[_0x0421('0x37')](_0x4768e6[_0x0421('0x38')])))return![];return!![];}catch(_0x14a947){throw _0x14a947;}}function refreshOauth2MicrosoftAccessToken(_0x5f4308){return Promise[_0x0421('0x39')]()['then'](function(){if(_0x5f4308[_0x0421('0x3a')])return _0x5f4308;return db[_0x0421('0x3b')][_0x0421('0x3c')]({'where':{'id':_0x5f4308['id']},'raw':!![]});})[_0x0421('0x3d')](function(_0x2b9a50){var _0x2cf242={'grant_type':'refresh_token','refresh_token':_0x2b9a50[_0x0421('0x3e')],'scope':getAccessTokenScope(_0x2b9a50),'redirect_uri':_0x2b9a50['data4'],'client_id':_0x2b9a50[_0x0421('0x2f')],'client_secret':encryptor[_0x0421('0x3f')](_0x2b9a50['data3'])};var _0x59e769={'method':_0x0421('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0x0421('0x1c'),_0x2b9a50[_0x0421('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2cf242,'json':!![]};return rp(_0x59e769);})['then'](function(_0x34f516){_0x5f4308[_0x0421('0x41')]=_0x34f516[_0x0421('0x42')];_0x5f4308[_0x0421('0x3e')]=_0x34f516[_0x0421('0x43')];return db['CloudProvider'][_0x0421('0x44')]({'data5':_0x5f4308['data5'],'data6':_0x5f4308[_0x0421('0x3e')]},{'where':{'id':_0x5f4308['id']}});})[_0x0421('0x3d')](function(){return _0x5f4308;})[_0x0421('0x45')](function(_0x499c2c){logger[_0x0421('0x46')](_0x0421('0x47'),_0x5f4308['id'],_0x499c2c);});}function getOauth2MicrosoftAccessToken(_0x5a0ee,_0x9ec771){var _0x153aea={'grant_type':_0x0421('0x48'),'code':_0x5a0ee,'scope':getAccessTokenScope(_0x9ec771),'redirect_uri':_0x9ec771[_0x0421('0x49')],'client_id':_0x9ec771['data1'],'client_secret':encryptor[_0x0421('0x3f')](_0x9ec771[_0x0421('0x3a')])};var _0x2c877b={'method':_0x0421('0x40'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x9ec771[_0x0421('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x153aea,'json':!![]};return rp(_0x2c877b);}function startRefreshInterval(_0x1d0370){var _0x478079=schedule[_0x0421('0x4a')];if(_0x478079[_0x1d0370['id']])clearInterval(_0x478079[_0x1d0370['id']]);_0x478079[_0x1d0370['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0421('0x4b')](this,{'id':_0x1d0370['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0421('0x4a')]=_0x478079;}function startAllRefreshIntervals(){return db[_0x0421('0x3b')][_0x0421('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0421('0x3d')](function(_0x1881eb){var _0x39366a=_0x1881eb[_0x0421('0x14')](function(_0x15aad9){return refreshOauth2MicrosoftAccessToken(_0x15aad9)[_0x0421('0x3d')](function(_0x10c69a){startRefreshInterval(_0x10c69a);});});return Promise[_0x0421('0x4d')](_0x39366a);})['catch'](function(_0x57fba5){var _0x50dc90=_0x57fba5?util[_0x0421('0x4e')](_0x57fba5,{'showHidden':![],'depth':null}):'';logger[_0x0421('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x50dc90);});}module[_0x0421('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 52dae85..bfa5e6b 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 _0xfd58=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','CloudProvider,\x20%s,\x20%s','message'];(function(_0x345bd6,_0x1e2919){var _0x3c22cb=function(_0x430250){while(--_0x430250){_0x345bd6['push'](_0x345bd6['shift']());}};_0x3c22cb(++_0x1e2919);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var moment=require('moment');var BPromise=require(_0x8fd5('0x2'));var rs=require(_0x8fd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd5('0x4'))['db'];var utils=require(_0x8fd5('0x5'));var logger=require(_0x8fd5('0x6'))(_0x8fd5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8fd5('0x8'));var client=jayson[_0x8fd5('0x9')][_0x8fd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e4,_0x16ac3f,_0x32bad9){return new BPromise(function(_0x273344,_0x1042a1){return client[_0x8fd5('0xb')](_0x4e10e4,_0x32bad9)['then'](function(_0x462ac4){logger['info']('CloudProvider,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'));logger[_0x8fd5('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'),JSON[_0x8fd5('0xe')](_0x462ac4));if(_0x462ac4['error']){if(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x10')]===0x1f4){logger['error'](_0x8fd5('0x11'),_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x1042a1(_0x462ac4[_0x8fd5('0xf')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x273344(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);}else{logger[_0x8fd5('0x13')](_0x8fd5('0x11'),_0x16ac3f,_0x8fd5('0xc'));_0x273344(_0x462ac4[_0x8fd5('0x14')][_0x8fd5('0x12')]);}})[_0x8fd5('0x15')](function(_0x53b2dd){logger[_0x8fd5('0xf')](_0x8fd5('0x11'),_0x16ac3f,_0x53b2dd);_0x1042a1(_0x53b2dd);});});} \ No newline at end of file +var _0xb5fa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xa2ac9,_0xf07f28){var _0x690e9b=function(_0x5b2582){while(--_0x5b2582){_0xa2ac9['push'](_0xa2ac9['shift']());}};_0x690e9b(++_0xf07f28);}(_0xb5fa,0xf8));var _0xab5f=function(_0x572083,_0x175a28){_0x572083=_0x572083-0x0;var _0x1add20=_0xb5fa[_0x572083];return _0x1add20;};'use strict';var _=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var moment=require(_0xab5f('0x2'));var BPromise=require(_0xab5f('0x3'));var rs=require(_0xab5f('0x4'));var fs=require('fs');var Redis=require(_0xab5f('0x5'));var db=require(_0xab5f('0x6'))['db'];var utils=require(_0xab5f('0x7'));var logger=require(_0xab5f('0x8'))(_0xab5f('0x9'));var config=require(_0xab5f('0xa'));var jayson=require(_0xab5f('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x489cd2,_0x1e5941,_0x401d4e){return new BPromise(function(_0x530a4a,_0x298d75){return client[_0xab5f('0xc')](_0x489cd2,_0x401d4e)[_0xab5f('0xd')](function(_0x177190){logger[_0xab5f('0xe')]('CloudProvider,\x20%s,\x20%s',_0x1e5941,_0xab5f('0xf'));logger['debug'](_0xab5f('0x10'),_0x1e5941,'request\x20sent',JSON[_0xab5f('0x11')](_0x177190));if(_0x177190[_0xab5f('0x12')]){if(_0x177190['error']['code']===0x1f4){logger['error'](_0xab5f('0x13'),_0x1e5941,_0x177190[_0xab5f('0x12')]['message']);return _0x298d75(_0x177190[_0xab5f('0x12')][_0xab5f('0x14')]);}logger[_0xab5f('0x12')](_0xab5f('0x13'),_0x1e5941,_0x177190[_0xab5f('0x12')][_0xab5f('0x14')]);return _0x530a4a(_0x177190[_0xab5f('0x12')][_0xab5f('0x14')]);}else{logger[_0xab5f('0xe')](_0xab5f('0x13'),_0x1e5941,_0xab5f('0xf'));_0x530a4a(_0x177190[_0xab5f('0x15')][_0xab5f('0x14')]);}})[_0xab5f('0x16')](function(_0x3d5485){logger[_0xab5f('0x12')](_0xab5f('0x13'),_0x1e5941,_0x3d5485);_0x298d75(_0x3d5485);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c2183c7..a01df5f 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x55a668,_0x495c0f){var _0x369e87=function(_0xc897e3){while(--_0xc897e3){_0x55a668['push'](_0x55a668['shift']());}};_0x369e87(++_0x495c0f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x52015d,_0x22648f){var _0x26d2bb=function(_0xcd6b13){while(--_0xcd6b13){_0x52015d['push'](_0x52015d['shift']());}};_0x26d2bb(++_0x22648f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c365b,_0x2cd0d5){_0x4c365b=_0x4c365b-0x0;var _0x4a2e10=_0x2ef3[_0x4c365b];return _0x4a2e10;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b14fdb6..8c20c41 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 _0xfe1b=['sequelize','exports','STRING','name'];(function(_0x45b380,_0x478cbd){var _0x4cdb76=function(_0x1b6a75){while(--_0x1b6a75){_0x45b380['push'](_0x45b380['shift']());}};_0x4cdb76(++_0x478cbd);}(_0xfe1b,0xa8));var _0xbfe1=function(_0x46a199,_0x4a169e){_0x46a199=_0x46a199-0x0;var _0xd62514=_0xfe1b[_0x46a199];return _0xd62514;};'use strict';var Sequelize=require(_0xbfe1('0x0'));module[_0xbfe1('0x1')]={'name':{'type':Sequelize[_0xbfe1('0x2')],'unique':_0xbfe1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbfe1('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xbfe1('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbfe1('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbfe1('0x2')]},'postalCode':{'type':Sequelize[_0xbfe1('0x2')]},'city':{'type':Sequelize[_0xbfe1('0x2')]},'country':{'type':Sequelize[_0xbfe1('0x2')]},'email':{'type':Sequelize[_0xbfe1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbfe1('0x2')]},'sStreet':{'type':Sequelize[_0xbfe1('0x2')]},'sPostalCode':{'type':Sequelize[_0xbfe1('0x2')]},'sCity':{'type':Sequelize[_0xbfe1('0x2')]},'sCountry':{'type':Sequelize[_0xbfe1('0x2')]},'description':{'type':Sequelize[_0xbfe1('0x2')]}}; \ No newline at end of file +var _0xbb02=['name','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb02,0xe3));var _0x2bb0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbb02[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x2bb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2bb0('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2bb0('0x2')]},'companyId':{'type':Sequelize[_0x2bb0('0x2')]},'website':{'type':Sequelize[_0x2bb0('0x2')]},'phone':{'type':Sequelize[_0x2bb0('0x2')]},'fax':{'type':Sequelize[_0x2bb0('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2bb0('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2bb0('0x2')]},'email':{'type':Sequelize[_0x2bb0('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2bb0('0x2')]},'sStreet':{'type':Sequelize[_0x2bb0('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x2bb0('0x2')]},'sCountry':{'type':Sequelize[_0x2bb0('0x2')]},'description':{'type':Sequelize[_0x2bb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 434c668..8ee113b 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 _0x43bf=['findOne','CmContact','getContacts','nolimit','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','options','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','addContacts','ids','omit'];(function(_0x1c7e71,_0x3980fe){var _0x261281=function(_0x47f42b){while(--_0x47f42b){_0x1c7e71['push'](_0x1c7e71['shift']());}};_0x261281(++_0x3980fe);}(_0x43bf,0xfd));var _0xf43b=function(_0x2e28a3,_0x4678c2){_0x2e28a3=_0x2e28a3-0x0;var _0x54ec2e=_0x43bf[_0x2e28a3];return _0x54ec2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf43b('0x0'));var zipdir=require(_0xf43b('0x1'));var jsonpatch=require(_0xf43b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf43b('0x3'));var Mustache=require(_0xf43b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf43b('0x5'));var csv=require(_0xf43b('0x6'));var ejs=require(_0xf43b('0x7'));var fs=require('fs');var fs_extra=require(_0xf43b('0x8'));var _=require(_0xf43b('0x9'));var squel=require(_0xf43b('0xa'));var crypto=require('crypto');var jsforce=require(_0xf43b('0xb'));var deskjs=require(_0xf43b('0xc'));var toCsv=require(_0xf43b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf43b('0xd'));var authService=require(_0xf43b('0xe'));var qs=require(_0xf43b('0xf'));var as=require(_0xf43b('0x10'));var hardwareService=require(_0xf43b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf43b('0x12'));var config=require(_0xf43b('0x13'));var licenseUtil=require(_0xf43b('0x14'));var db=require(_0xf43b('0x15'))['db'];function respondWithStatusCode(_0x1d7cb5,_0x531459){_0x531459=_0x531459||0xcc;return function(_0x2997b){if(_0x2997b){return _0x1d7cb5[_0xf43b('0x16')](_0x531459);}return _0x1d7cb5[_0xf43b('0x17')](_0x531459)[_0xf43b('0x18')]();};}function respondWithResult(_0x2ba839,_0x8d85b9){_0x8d85b9=_0x8d85b9||0xc8;return function(_0x572109){if(_0x572109){return _0x2ba839['status'](_0x8d85b9)[_0xf43b('0x19')](_0x572109);}};}function respondWithFilteredResult(_0x5387a6,_0x54b6ea){return function(_0x1c11e6){if(_0x1c11e6){var _0x4ba2bc=typeof _0x54b6ea[_0xf43b('0x1a')]===_0xf43b('0x1b')&&typeof _0x54b6ea[_0xf43b('0x1c')]===_0xf43b('0x1b');var _0x50bc9f=_0x1c11e6[_0xf43b('0x1d')];var _0x4efaf5=_0x4ba2bc?0x0:_0x54b6ea[_0xf43b('0x1a')];var _0x43cf32=_0x4ba2bc?_0x1c11e6[_0xf43b('0x1d')]:_0x54b6ea['offset']+_0x54b6ea[_0xf43b('0x1c')];var _0x56ec33;if(_0x43cf32>=_0x50bc9f){_0x43cf32=_0x50bc9f;_0x56ec33=0xc8;}else{_0x56ec33=0xce;}_0x5387a6[_0xf43b('0x17')](_0x56ec33);return _0x5387a6[_0xf43b('0x1e')](_0xf43b('0x1f'),_0x4efaf5+'-'+_0x43cf32+'/'+_0x50bc9f)[_0xf43b('0x19')](_0x1c11e6);}return null;};}function patchUpdates(_0x5ba23f){return function(_0x566b27){try{jsonpatch[_0xf43b('0x20')](_0x566b27,_0x5ba23f,!![]);}catch(_0x434a3d){return BPromise[_0xf43b('0x21')](_0x434a3d);}return _0x566b27[_0xf43b('0x22')]();};}function saveUpdates(_0x52221d,_0x156204){return function(_0x189743){if(_0x189743){return _0x189743[_0xf43b('0x23')](_0x52221d)['then'](function(_0x42ddb7){return _0x42ddb7;});}return null;};}function removeEntity(_0x280ba4,_0x2cb4d2){return function(_0x3568c0){if(_0x3568c0){return _0x3568c0[_0xf43b('0x24')]()[_0xf43b('0x25')](function(){var _0x2c0738=_0x3568c0['get']({'plain':!![]});var _0xca3af=_0xf43b('0x26');return db[_0xf43b('0x27')][_0xf43b('0x24')]({'where':{'type':_0xca3af,'resourceId':_0x2c0738['id']}})['then'](function(){return _0x3568c0;});})[_0xf43b('0x25')](function(){_0x280ba4[_0xf43b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d68c2,_0x382f46){return function(_0x354951){if(!_0x354951){_0x3d68c2[_0xf43b('0x16')](0x194);}return _0x354951;};}function handleError(_0x551a86,_0x503693){_0x503693=_0x503693||0x1f4;return function(_0x112105){logger[_0xf43b('0x28')](_0x112105[_0xf43b('0x29')]);if(_0x112105[_0xf43b('0x2a')]){delete _0x112105[_0xf43b('0x2a')];}_0x551a86[_0xf43b('0x17')](_0x503693)[_0xf43b('0x2b')](_0x112105);};}exports['index']=function(_0x178356,_0x5546da){var _0x45d946={},_0x251ad0={},_0x21bee8={'count':0x0,'rows':[]};return db[_0xf43b('0x2c')][_0xf43b('0x2d')]()['then'](function(_0x36fee5){_0x251ad0[_0xf43b('0x2e')]=_['keys'](_0x36fee5);_0x251ad0[_0xf43b('0x2f')]=_[_0xf43b('0x30')](_0x178356['query']);_0x251ad0['filters']=_[_0xf43b('0x31')](_0x251ad0[_0xf43b('0x2e')],_0x251ad0[_0xf43b('0x2f')]);_0x45d946[_0xf43b('0x32')]=_[_0xf43b('0x31')](_0x251ad0['model'],qs[_0xf43b('0x33')](_0x178356[_0xf43b('0x2f')]['fields']));_0x45d946[_0xf43b('0x32')]=_0x45d946['attributes'][_0xf43b('0x34')]?_0x45d946[_0xf43b('0x32')]:_0x251ad0[_0xf43b('0x2e')];if(!_0x178356[_0xf43b('0x2f')][_0xf43b('0x35')]('nolimit')){_0x45d946['limit']=qs[_0xf43b('0x1c')](_0x178356[_0xf43b('0x2f')]['limit']);_0x45d946['offset']=qs[_0xf43b('0x1a')](_0x178356['query'][_0xf43b('0x1a')]);}_0x45d946['order']=qs[_0xf43b('0x36')](_0x178356['query'][_0xf43b('0x36')]);_0x45d946[_0xf43b('0x37')]=qs[_0xf43b('0x38')](_[_0xf43b('0x39')](_0x178356[_0xf43b('0x2f')],_0x251ad0[_0xf43b('0x38')]),_0x36fee5);if(_0x178356['query'][_0xf43b('0x3a')]){_0x45d946['where']=_[_0xf43b('0x3b')](_0x45d946[_0xf43b('0x37')],{'$or':_[_0xf43b('0x3c')](_0x45d946[_0xf43b('0x32')],function(_0x51f7a4){var _0x122a61={};_0x122a61[_0x51f7a4]={'$like':'%'+_0x178356[_0xf43b('0x2f')]['filter']+'%'};return _0x122a61;})});}_0x45d946=_[_0xf43b('0x3b')]({},_0x45d946,_0x178356[_0xf43b('0x3d')]);var _0x49130f={'where':_0x45d946[_0xf43b('0x37')]};return db[_0xf43b('0x2c')]['count'](_0x49130f)[_0xf43b('0x25')](function(_0x399778){_0x21bee8[_0xf43b('0x1d')]=_0x399778;if(_0x178356[_0xf43b('0x2f')]['includeAll']){_0x45d946[_0xf43b('0x3e')]=[{'all':!![]}];}return db[_0xf43b('0x2c')]['findAll'](_0x45d946);})[_0xf43b('0x25')](function(_0x1ed2a6){_0x21bee8[_0xf43b('0x3f')]=_0x1ed2a6;return _0x21bee8;})['then'](respondWithFilteredResult(_0x5546da,_0x45d946))[_0xf43b('0x40')](handleError(_0x5546da,null));})['catch'](handleError(_0x5546da,null));};exports[_0xf43b('0x41')]=function(_0x22a7e6,_0x303669){var _0x1dbcc7={'raw':![],'where':{'id':_0x22a7e6['params']['id']}},_0x31c95c={};_0x31c95c[_0xf43b('0x2e')]=_[_0xf43b('0x30')](db[_0xf43b('0x2c')]['rawAttributes']);_0x31c95c[_0xf43b('0x2f')]=_['keys'](_0x22a7e6[_0xf43b('0x2f')]);_0x31c95c['filters']=_[_0xf43b('0x31')](_0x31c95c['model'],_0x31c95c[_0xf43b('0x2f')]);_0x1dbcc7[_0xf43b('0x32')]=_[_0xf43b('0x31')](_0x31c95c['model'],qs[_0xf43b('0x33')](_0x22a7e6[_0xf43b('0x2f')]['fields']));_0x1dbcc7[_0xf43b('0x32')]=_0x1dbcc7[_0xf43b('0x32')]['length']?_0x1dbcc7['attributes']:_0x31c95c[_0xf43b('0x2e')];if(_0x22a7e6[_0xf43b('0x2f')]['includeAll']){_0x1dbcc7[_0xf43b('0x3e')]=[{'all':!![]}];}_0x1dbcc7=_[_0xf43b('0x3b')]({},_0x1dbcc7,_0x22a7e6[_0xf43b('0x3d')]);return db[_0xf43b('0x2c')][_0xf43b('0x42')](_0x1dbcc7)['then'](handleEntityNotFound(_0x303669,null))[_0xf43b('0x25')](respondWithResult(_0x303669,null))[_0xf43b('0x40')](handleError(_0x303669,null));};exports[_0xf43b('0x43')]=function(_0x52f2d5,_0x2dc21c){return db[_0xf43b('0x2c')]['create'](_0x52f2d5[_0xf43b('0x44')],{})[_0xf43b('0x25')](function(_0x1d8d93){var _0x21b2bc=_0x52f2d5[_0xf43b('0x45')][_0xf43b('0x46')]({'plain':!![]});if(!_0x21b2bc)throw new Error(_0xf43b('0x47'));if(_0x21b2bc[_0xf43b('0x48')]===_0xf43b('0x45')){var _0xc327d=_0x1d8d93[_0xf43b('0x46')]({'plain':!![]});var _0x5971df=_0xf43b('0x26');return db[_0xf43b('0x49')][_0xf43b('0x42')]({'where':{'name':_0x5971df,'userProfileId':_0x21b2bc['userProfileId']},'raw':!![]})[_0xf43b('0x25')](function(_0x36222e){if(_0x36222e&&_0x36222e[_0xf43b('0x4a')]===0x0){return db['UserProfileResource'][_0xf43b('0x43')]({'name':_0xc327d[_0xf43b('0x2a')],'resourceId':_0xc327d['id'],'type':_0x36222e[_0xf43b('0x2a')],'sectionId':_0x36222e['id']},{})[_0xf43b('0x25')](function(){return _0x1d8d93;});}else{return _0x1d8d93;}})[_0xf43b('0x40')](function(_0x25baf3){logger[_0xf43b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25baf3);throw _0x25baf3;});}return _0x1d8d93;})[_0xf43b('0x25')](respondWithResult(_0x2dc21c,0xc9))['catch'](handleError(_0x2dc21c,null));};exports[_0xf43b('0x23')]=function(_0x3460c4,_0x5da273){if(_0x3460c4[_0xf43b('0x44')]['id']){delete _0x3460c4[_0xf43b('0x44')]['id'];}return db[_0xf43b('0x2c')][_0xf43b('0x42')]({'where':{'id':_0x3460c4['params']['id']}})['then'](handleEntityNotFound(_0x5da273,null))[_0xf43b('0x25')](saveUpdates(_0x3460c4[_0xf43b('0x44')],null))['then'](respondWithResult(_0x5da273,null))['catch'](handleError(_0x5da273,null));};exports[_0xf43b('0x24')]=function(_0x532bc6,_0x49d1a2){return db[_0xf43b('0x2c')][_0xf43b('0x42')]({'where':{'id':_0x532bc6[_0xf43b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49d1a2,null))[_0xf43b('0x25')](removeEntity(_0x49d1a2,null))[_0xf43b('0x40')](handleError(_0x49d1a2,null));};exports[_0xf43b('0x2d')]=function(_0x4234da,_0x1658c2){return db[_0xf43b('0x2c')][_0xf43b('0x2d')]()[_0xf43b('0x25')](respondWithResult(_0x1658c2,null))[_0xf43b('0x40')](handleError(_0x1658c2,null));};exports[_0xf43b('0x4c')]=function(_0x32a1ab,_0x1f7588,_0x40e6a8){return db['CmContact']['find']({'where':{'id':_0x32a1ab[_0xf43b('0x4b')]['id']}})[_0xf43b('0x25')](handleEntityNotFound(_0x1f7588,null))['then'](function(_0xf13ddc){if(_0xf13ddc){return _0xf13ddc['addContacts'](_0x32a1ab[_0xf43b('0x44')][_0xf43b('0x4d')],_[_0xf43b('0x4e')](_0x32a1ab['body'],[_0xf43b('0x4d'),'id'])||{});}})[_0xf43b('0x25')](respondWithResult(_0x1f7588,null))['catch'](handleError(_0x1f7588,null));};exports['getContacts']=function(_0xc27942,_0x157e62,_0x3b83bc){var _0x2ed86c={};var _0x1a27a0={};var _0x296f36;var _0x249e66;return db[_0xf43b('0x2c')][_0xf43b('0x4f')]({'where':{'id':_0xc27942[_0xf43b('0x4b')]['id']}})[_0xf43b('0x25')](handleEntityNotFound(_0x157e62,null))[_0xf43b('0x25')](function(_0x3a20b9){if(_0x3a20b9){_0x296f36=_0x3a20b9;_0x1a27a0[_0xf43b('0x2e')]=_['keys'](db[_0xf43b('0x50')]['rawAttributes']);_0x1a27a0['query']=_[_0xf43b('0x30')](_0xc27942[_0xf43b('0x2f')]);_0x1a27a0[_0xf43b('0x38')]=_[_0xf43b('0x31')](_0x1a27a0[_0xf43b('0x2e')],_0x1a27a0[_0xf43b('0x2f')]);_0x2ed86c['attributes']=_[_0xf43b('0x31')](_0x1a27a0[_0xf43b('0x2e')],qs[_0xf43b('0x33')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x33')]));_0x2ed86c[_0xf43b('0x32')]=_0x2ed86c[_0xf43b('0x32')][_0xf43b('0x34')]?_0x2ed86c['attributes']:_0x1a27a0[_0xf43b('0x2e')];_0x2ed86c['order']=qs[_0xf43b('0x36')](_0xc27942['query'][_0xf43b('0x36')]);_0x2ed86c[_0xf43b('0x37')]=qs[_0xf43b('0x38')](_[_0xf43b('0x39')](_0xc27942[_0xf43b('0x2f')],_0x1a27a0[_0xf43b('0x38')]));if(_0xc27942['query']['filter']){_0x2ed86c['where']=_[_0xf43b('0x3b')](_0x2ed86c[_0xf43b('0x37')],{'$or':_[_0xf43b('0x3c')](_0x2ed86c[_0xf43b('0x32')],function(_0x11f74e){var _0x86d5d2={};_0x86d5d2[_0x11f74e]={'$like':'%'+_0xc27942[_0xf43b('0x2f')][_0xf43b('0x3a')]+'%'};return _0x86d5d2;})});}_0x2ed86c=_['merge']({},_0x2ed86c,_0xc27942['options']);return _0x296f36[_0xf43b('0x51')](_0x2ed86c);}})[_0xf43b('0x25')](function(_0x49ba3e){if(_0x49ba3e){_0x249e66=_0x49ba3e[_0xf43b('0x34')];if(!_0xc27942['query'][_0xf43b('0x35')](_0xf43b('0x52'))){_0x2ed86c[_0xf43b('0x1c')]=qs[_0xf43b('0x1c')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x1c')]);_0x2ed86c[_0xf43b('0x1a')]=qs[_0xf43b('0x1a')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x1a')]);}return _0x296f36['getContacts'](_0x2ed86c);}})['then'](function(_0xa44b29){if(_0xa44b29){return _0xa44b29?{'count':_0x249e66,'rows':_0xa44b29}:null;}})[_0xf43b('0x25')](respondWithResult(_0x157e62,null))[_0xf43b('0x40')](handleError(_0x157e62,null));}; \ No newline at end of file +var _0x27f3=['stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','catch','params','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','CmContact','addContacts','ids','omit','getContacts','findOne','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','reject','save','then','get','Companies','UserProfileResource','destroy','sendStatus','error'];(function(_0xaab2f5,_0x58463f){var _0x3b28ea=function(_0xcbc73c){while(--_0xcbc73c){_0xaab2f5['push'](_0xaab2f5['shift']());}};_0x3b28ea(++_0x58463f);}(_0x27f3,0xd8));var _0x327f=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x27f3[_0x39d39d];return _0x577ac3;};'use strict';var emlformat=require(_0x327f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x327f('0x1'));var moment=require(_0x327f('0x2'));var BPromise=require(_0x327f('0x3'));var Mustache=require(_0x327f('0x4'));var util=require(_0x327f('0x5'));var path=require(_0x327f('0x6'));var sox=require(_0x327f('0x7'));var csv=require(_0x327f('0x8'));var ejs=require(_0x327f('0x9'));var fs=require('fs');var fs_extra=require(_0x327f('0xa'));var _=require(_0x327f('0xb'));var squel=require(_0x327f('0xc'));var crypto=require(_0x327f('0xd'));var jsforce=require(_0x327f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x327f('0x8'));var querystring=require('querystring');var Papa=require(_0x327f('0xf'));var Redis=require(_0x327f('0x10'));var authService=require(_0x327f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x327f('0x12'));var hardwareService=require(_0x327f('0x13'));var logger=require('../../config/logger')(_0x327f('0x14'));var utils=require(_0x327f('0x15'));var config=require(_0x327f('0x16'));var licenseUtil=require(_0x327f('0x17'));var db=require(_0x327f('0x18'))['db'];function respondWithStatusCode(_0x288edc,_0x141388){_0x141388=_0x141388||0xcc;return function(_0x3c2424){if(_0x3c2424){return _0x288edc['sendStatus'](_0x141388);}return _0x288edc['status'](_0x141388)[_0x327f('0x19')]();};}function respondWithResult(_0x11acab,_0x4e5017){_0x4e5017=_0x4e5017||0xc8;return function(_0x181060){if(_0x181060){return _0x11acab[_0x327f('0x1a')](_0x4e5017)[_0x327f('0x1b')](_0x181060);}};}function respondWithFilteredResult(_0x5a9b7a,_0x2830a6){return function(_0x9ce1f7){if(_0x9ce1f7){var _0xbc503f=typeof _0x2830a6[_0x327f('0x1c')]===_0x327f('0x1d')&&typeof _0x2830a6[_0x327f('0x1e')]===_0x327f('0x1d');var _0x253864=_0x9ce1f7[_0x327f('0x1f')];var _0x1af46c=_0xbc503f?0x0:_0x2830a6[_0x327f('0x1c')];var _0x55ac8e=_0xbc503f?_0x9ce1f7[_0x327f('0x1f')]:_0x2830a6[_0x327f('0x1c')]+_0x2830a6[_0x327f('0x1e')];var _0x1c1d52;if(_0x55ac8e>=_0x253864){_0x55ac8e=_0x253864;_0x1c1d52=0xc8;}else{_0x1c1d52=0xce;}_0x5a9b7a['status'](_0x1c1d52);return _0x5a9b7a['set']('Content-Range',_0x1af46c+'-'+_0x55ac8e+'/'+_0x253864)[_0x327f('0x1b')](_0x9ce1f7);}return null;};}function patchUpdates(_0x4fb0a0){return function(_0x3bacc6){try{jsonpatch[_0x327f('0x20')](_0x3bacc6,_0x4fb0a0,!![]);}catch(_0x82e3c6){return BPromise[_0x327f('0x21')](_0x82e3c6);}return _0x3bacc6[_0x327f('0x22')]();};}function saveUpdates(_0x2a2c30,_0x8cbe31){return function(_0x10eae7){if(_0x10eae7){return _0x10eae7['update'](_0x2a2c30)[_0x327f('0x23')](function(_0x621ad0){return _0x621ad0;});}return null;};}function removeEntity(_0x504211,_0x5f1bd7){return function(_0x7610d3){if(_0x7610d3){return _0x7610d3['destroy']()[_0x327f('0x23')](function(){var _0x295311=_0x7610d3[_0x327f('0x24')]({'plain':!![]});var _0x311889=_0x327f('0x25');return db[_0x327f('0x26')][_0x327f('0x27')]({'where':{'type':_0x311889,'resourceId':_0x295311['id']}})['then'](function(){return _0x7610d3;});})['then'](function(){_0x504211[_0x327f('0x1a')](0xcc)[_0x327f('0x19')]();});}};}function handleEntityNotFound(_0x2f27aa,_0x1f93a7){return function(_0x3a6a7c){if(!_0x3a6a7c){_0x2f27aa[_0x327f('0x28')](0x194);}return _0x3a6a7c;};}function handleError(_0x2471b6,_0xd2eb1){_0xd2eb1=_0xd2eb1||0x1f4;return function(_0x5b1c78){logger[_0x327f('0x29')](_0x5b1c78[_0x327f('0x2a')]);if(_0x5b1c78['name']){delete _0x5b1c78[_0x327f('0x2b')];}_0x2471b6[_0x327f('0x1a')](_0xd2eb1)[_0x327f('0x2c')](_0x5b1c78);};}exports[_0x327f('0x2d')]=function(_0x4254de,_0x3cad03){var _0x5c029e={},_0x539abd={},_0x338a20={'count':0x0,'rows':[]};return db[_0x327f('0x2e')][_0x327f('0x2f')]()['then'](function(_0x2a0d9e){_0x539abd['model']=_[_0x327f('0x30')](_0x2a0d9e);_0x539abd[_0x327f('0x31')]=_[_0x327f('0x30')](_0x4254de[_0x327f('0x31')]);_0x539abd[_0x327f('0x32')]=_[_0x327f('0x33')](_0x539abd[_0x327f('0x34')],_0x539abd['query']);_0x5c029e[_0x327f('0x35')]=_[_0x327f('0x33')](_0x539abd[_0x327f('0x34')],qs['fields'](_0x4254de[_0x327f('0x31')]['fields']));_0x5c029e[_0x327f('0x35')]=_0x5c029e['attributes'][_0x327f('0x36')]?_0x5c029e['attributes']:_0x539abd['model'];if(!_0x4254de[_0x327f('0x31')][_0x327f('0x37')](_0x327f('0x38'))){_0x5c029e['limit']=qs['limit'](_0x4254de['query'][_0x327f('0x1e')]);_0x5c029e[_0x327f('0x1c')]=qs['offset'](_0x4254de[_0x327f('0x31')][_0x327f('0x1c')]);}_0x5c029e[_0x327f('0x39')]=qs[_0x327f('0x3a')](_0x4254de['query'][_0x327f('0x3a')]);_0x5c029e[_0x327f('0x3b')]=qs[_0x327f('0x32')](_[_0x327f('0x3c')](_0x4254de[_0x327f('0x31')],_0x539abd[_0x327f('0x32')]),_0x2a0d9e);if(_0x4254de[_0x327f('0x31')][_0x327f('0x3d')]){_0x5c029e[_0x327f('0x3b')]=_['merge'](_0x5c029e[_0x327f('0x3b')],{'$or':_[_0x327f('0x3e')](_0x5c029e['attributes'],function(_0x39d756){var _0x318787={};_0x318787[_0x39d756]={'$like':'%'+_0x4254de[_0x327f('0x31')][_0x327f('0x3d')]+'%'};return _0x318787;})});}_0x5c029e=_[_0x327f('0x3f')]({},_0x5c029e,_0x4254de[_0x327f('0x40')]);var _0x3bb0ea={'where':_0x5c029e['where']};return db[_0x327f('0x2e')][_0x327f('0x1f')](_0x3bb0ea)[_0x327f('0x23')](function(_0x211ec5){_0x338a20['count']=_0x211ec5;if(_0x4254de[_0x327f('0x31')][_0x327f('0x41')]){_0x5c029e[_0x327f('0x42')]=[{'all':!![]}];}return db[_0x327f('0x2e')]['findAll'](_0x5c029e);})['then'](function(_0x1f7182){_0x338a20['rows']=_0x1f7182;return _0x338a20;})['then'](respondWithFilteredResult(_0x3cad03,_0x5c029e))[_0x327f('0x43')](handleError(_0x3cad03,null));})[_0x327f('0x43')](handleError(_0x3cad03,null));};exports['show']=function(_0x3760bd,_0x4a8f6c){var _0x2febd9={'raw':![],'where':{'id':_0x3760bd[_0x327f('0x44')]['id']}},_0x4e3baf={};_0x4e3baf['model']=_['keys'](db[_0x327f('0x2e')][_0x327f('0x45')]);_0x4e3baf[_0x327f('0x31')]=_[_0x327f('0x30')](_0x3760bd[_0x327f('0x31')]);_0x4e3baf['filters']=_[_0x327f('0x33')](_0x4e3baf[_0x327f('0x34')],_0x4e3baf[_0x327f('0x31')]);_0x2febd9['attributes']=_[_0x327f('0x33')](_0x4e3baf[_0x327f('0x34')],qs[_0x327f('0x46')](_0x3760bd[_0x327f('0x31')][_0x327f('0x46')]));_0x2febd9[_0x327f('0x35')]=_0x2febd9['attributes']['length']?_0x2febd9[_0x327f('0x35')]:_0x4e3baf[_0x327f('0x34')];if(_0x3760bd[_0x327f('0x31')]['includeAll']){_0x2febd9[_0x327f('0x42')]=[{'all':!![]}];}_0x2febd9=_[_0x327f('0x3f')]({},_0x2febd9,_0x3760bd['options']);return db[_0x327f('0x2e')]['find'](_0x2febd9)[_0x327f('0x23')](handleEntityNotFound(_0x4a8f6c,null))[_0x327f('0x23')](respondWithResult(_0x4a8f6c,null))[_0x327f('0x43')](handleError(_0x4a8f6c,null));};exports[_0x327f('0x47')]=function(_0x220f59,_0x57b3c1){return db[_0x327f('0x2e')][_0x327f('0x47')](_0x220f59[_0x327f('0x48')],{})[_0x327f('0x23')](function(_0x2d84f6){var _0x7a19e=_0x220f59[_0x327f('0x49')][_0x327f('0x24')]({'plain':!![]});if(!_0x7a19e)throw new Error(_0x327f('0x4a'));if(_0x7a19e['role']===_0x327f('0x49')){var _0x2094f5=_0x2d84f6['get']({'plain':!![]});var _0x32e460=_0x327f('0x25');return db[_0x327f('0x4b')][_0x327f('0x4c')]({'where':{'name':_0x32e460,'userProfileId':_0x7a19e[_0x327f('0x4d')]},'raw':!![]})[_0x327f('0x23')](function(_0x3073aa){if(_0x3073aa&&_0x3073aa[_0x327f('0x4e')]===0x0){return db[_0x327f('0x26')][_0x327f('0x47')]({'name':_0x2094f5[_0x327f('0x2b')],'resourceId':_0x2094f5['id'],'type':_0x3073aa[_0x327f('0x2b')],'sectionId':_0x3073aa['id']},{})[_0x327f('0x23')](function(){return _0x2d84f6;});}else{return _0x2d84f6;}})[_0x327f('0x43')](function(_0x2ac2fb){logger[_0x327f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac2fb);throw _0x2ac2fb;});}return _0x2d84f6;})[_0x327f('0x23')](respondWithResult(_0x57b3c1,0xc9))[_0x327f('0x43')](handleError(_0x57b3c1,null));};exports[_0x327f('0x4f')]=function(_0x1e6bcc,_0x477943){if(_0x1e6bcc['body']['id']){delete _0x1e6bcc[_0x327f('0x48')]['id'];}return db[_0x327f('0x2e')]['find']({'where':{'id':_0x1e6bcc['params']['id']}})[_0x327f('0x23')](handleEntityNotFound(_0x477943,null))[_0x327f('0x23')](saveUpdates(_0x1e6bcc[_0x327f('0x48')],null))['then'](respondWithResult(_0x477943,null))[_0x327f('0x43')](handleError(_0x477943,null));};exports[_0x327f('0x27')]=function(_0x1e2cd8,_0x180898){return db[_0x327f('0x2e')]['find']({'where':{'id':_0x1e2cd8[_0x327f('0x44')]['id']}})[_0x327f('0x23')](handleEntityNotFound(_0x180898,null))[_0x327f('0x23')](removeEntity(_0x180898,null))[_0x327f('0x43')](handleError(_0x180898,null));};exports['describe']=function(_0x212c9a,_0x579aab){return db[_0x327f('0x2e')][_0x327f('0x2f')]()[_0x327f('0x23')](respondWithResult(_0x579aab,null))['catch'](handleError(_0x579aab,null));};exports['addContacts']=function(_0x57f6f3,_0x40a271,_0x49a669){return db[_0x327f('0x50')][_0x327f('0x4c')]({'where':{'id':_0x57f6f3['params']['id']}})[_0x327f('0x23')](handleEntityNotFound(_0x40a271,null))['then'](function(_0x33f610){if(_0x33f610){return _0x33f610[_0x327f('0x51')](_0x57f6f3[_0x327f('0x48')][_0x327f('0x52')],_[_0x327f('0x53')](_0x57f6f3[_0x327f('0x48')],[_0x327f('0x52'),'id'])||{});}})[_0x327f('0x23')](respondWithResult(_0x40a271,null))['catch'](handleError(_0x40a271,null));};exports[_0x327f('0x54')]=function(_0x596d2e,_0x14e2f3,_0x3350ee){var _0x566204={};var _0x27aebc={};var _0x3b420c;var _0x4eabdb;return db['CmCompany'][_0x327f('0x55')]({'where':{'id':_0x596d2e[_0x327f('0x44')]['id']}})['then'](handleEntityNotFound(_0x14e2f3,null))[_0x327f('0x23')](function(_0x3eb3da){if(_0x3eb3da){_0x3b420c=_0x3eb3da;_0x27aebc['model']=_[_0x327f('0x30')](db[_0x327f('0x50')][_0x327f('0x45')]);_0x27aebc['query']=_['keys'](_0x596d2e[_0x327f('0x31')]);_0x27aebc[_0x327f('0x32')]=_[_0x327f('0x33')](_0x27aebc[_0x327f('0x34')],_0x27aebc['query']);_0x566204['attributes']=_[_0x327f('0x33')](_0x27aebc['model'],qs[_0x327f('0x46')](_0x596d2e[_0x327f('0x31')][_0x327f('0x46')]));_0x566204['attributes']=_0x566204[_0x327f('0x35')][_0x327f('0x36')]?_0x566204[_0x327f('0x35')]:_0x27aebc[_0x327f('0x34')];_0x566204[_0x327f('0x39')]=qs[_0x327f('0x3a')](_0x596d2e[_0x327f('0x31')][_0x327f('0x3a')]);_0x566204[_0x327f('0x3b')]=qs[_0x327f('0x32')](_[_0x327f('0x3c')](_0x596d2e[_0x327f('0x31')],_0x27aebc['filters']));if(_0x596d2e[_0x327f('0x31')][_0x327f('0x3d')]){_0x566204[_0x327f('0x3b')]=_[_0x327f('0x3f')](_0x566204[_0x327f('0x3b')],{'$or':_[_0x327f('0x3e')](_0x566204['attributes'],function(_0x1eac45){var _0x395ce7={};_0x395ce7[_0x1eac45]={'$like':'%'+_0x596d2e[_0x327f('0x31')][_0x327f('0x3d')]+'%'};return _0x395ce7;})});}_0x566204=_[_0x327f('0x3f')]({},_0x566204,_0x596d2e[_0x327f('0x40')]);return _0x3b420c[_0x327f('0x54')](_0x566204);}})[_0x327f('0x23')](function(_0xa3578f){if(_0xa3578f){_0x4eabdb=_0xa3578f[_0x327f('0x36')];if(!_0x596d2e['query']['hasOwnProperty'](_0x327f('0x38'))){_0x566204['limit']=qs['limit'](_0x596d2e[_0x327f('0x31')][_0x327f('0x1e')]);_0x566204[_0x327f('0x1c')]=qs[_0x327f('0x1c')](_0x596d2e['query'][_0x327f('0x1c')]);}return _0x3b420c[_0x327f('0x54')](_0x566204);}})[_0x327f('0x23')](function(_0x51297c){if(_0x51297c){return _0x51297c?{'count':_0x4eabdb,'rows':_0x51297c}:null;}})[_0x327f('0x23')](respondWithResult(_0x14e2f3,null))['catch'](handleError(_0x14e2f3,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ef7ea03..f028ba8 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 _0x8c18=['../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b9ba5,_0x34b868){var _0x292a7b=function(_0x18bf6f){while(--_0x18bf6f){_0x4b9ba5['push'](_0x4b9ba5['shift']());}};_0x292a7b(++_0x34b868);}(_0x8c18,0x11d));var _0x88c1=function(_0xacae67,_0x5572c4){_0xacae67=_0xacae67-0x0;var _0x5a07f5=_0x8c18[_0xacae67];return _0x5a07f5;};'use strict';var _=require(_0x88c1('0x0'));var util=require(_0x88c1('0x1'));var logger=require(_0x88c1('0x2'))(_0x88c1('0x3'));var moment=require(_0x88c1('0x4'));var BPromise=require(_0x88c1('0x5'));var rp=require(_0x88c1('0x6'));var fs=require('fs');var path=require(_0x88c1('0x7'));var rimraf=require(_0x88c1('0x8'));var config=require(_0x88c1('0x9'));var attributes=require(_0x88c1('0xa'));module[_0x88c1('0xb')]=function(_0x393bea,_0x4d2683){return _0x393bea['define'](_0x88c1('0xc'),attributes,{'tableName':_0x88c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb8=['rimraf','../../config/environment','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfdb8,0x70));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8fdb('0x0'));var util=require(_0x8fdb('0x1'));var logger=require(_0x8fdb('0x2'))(_0x8fdb('0x3'));var moment=require(_0x8fdb('0x4'));var BPromise=require(_0x8fdb('0x5'));var rp=require(_0x8fdb('0x6'));var fs=require('fs');var path=require(_0x8fdb('0x7'));var rimraf=require(_0x8fdb('0x8'));var config=require(_0x8fdb('0x9'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x33d670,_0xefc77c){return _0x33d670[_0x8fdb('0xa')](_0x8fdb('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 79d5988..cbed507 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 _0xce02=['jayson/promise','client','http','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4509db,_0x2111ce){var _0x267328=function(_0x587a97){while(--_0x587a97){_0x4509db['push'](_0x4509db['shift']());}};_0x267328(++_0x2111ce);}(_0xce02,0x146));var _0x2ce0=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xce02[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x2ce0('0x0'));var util=require(_0x2ce0('0x1'));var moment=require(_0x2ce0('0x2'));var BPromise=require(_0x2ce0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ce0('0x4'));var db=require(_0x2ce0('0x5'))['db'];var utils=require(_0x2ce0('0x6'));var logger=require(_0x2ce0('0x7'))(_0x2ce0('0x8'));var config=require(_0x2ce0('0x9'));var jayson=require(_0x2ce0('0xa'));var client=jayson[_0x2ce0('0xb')][_0x2ce0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x418751,_0x56c29c,_0x522b3a){return new BPromise(function(_0x98f346,_0x47b98e){return client['request'](_0x418751,_0x522b3a)[_0x2ce0('0xd')](function(_0x18ed4c){logger[_0x2ce0('0xe')]('CmCompany,\x20%s,\x20%s',_0x56c29c,_0x2ce0('0xf'));logger[_0x2ce0('0x10')](_0x2ce0('0x11'),_0x56c29c,_0x2ce0('0xf'),JSON['stringify'](_0x18ed4c));if(_0x18ed4c[_0x2ce0('0x12')]){if(_0x18ed4c['error'][_0x2ce0('0x13')]===0x1f4){logger[_0x2ce0('0x12')]('CmCompany,\x20%s,\x20%s',_0x56c29c,_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);return _0x47b98e(_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);}logger[_0x2ce0('0x12')](_0x2ce0('0x15'),_0x56c29c,_0x18ed4c['error'][_0x2ce0('0x14')]);return _0x98f346(_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);}else{logger[_0x2ce0('0xe')](_0x2ce0('0x15'),_0x56c29c,_0x2ce0('0xf'));_0x98f346(_0x18ed4c[_0x2ce0('0x16')][_0x2ce0('0x14')]);}})[_0x2ce0('0x17')](function(_0x366962){logger[_0x2ce0('0x12')](_0x2ce0('0x15'),_0x56c29c,_0x366962);_0x47b98e(_0x366962);});});} \ No newline at end of file +var _0xe1aa=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x3204b2,_0x72c42e){var _0x248361=function(_0x504464){while(--_0x504464){_0x3204b2['push'](_0x3204b2['shift']());}};_0x248361(++_0x72c42e);}(_0xe1aa,0x6c));var _0xae1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe1aa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var moment=require(_0xae1a('0x2'));var BPromise=require(_0xae1a('0x3'));var rs=require(_0xae1a('0x4'));var fs=require('fs');var Redis=require(_0xae1a('0x5'));var db=require(_0xae1a('0x6'))['db'];var utils=require(_0xae1a('0x7'));var logger=require(_0xae1a('0x8'))(_0xae1a('0x9'));var config=require(_0xae1a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xae1a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ab86,_0x59c1a9,_0x578d4c){return new BPromise(function(_0x3d5fe6,_0x263a9d){return client['request'](_0x5ab86,_0x578d4c)[_0xae1a('0xc')](function(_0x2fb944){logger[_0xae1a('0xd')](_0xae1a('0xe'),_0x59c1a9,_0xae1a('0xf'));logger[_0xae1a('0x10')](_0xae1a('0x11'),_0x59c1a9,_0xae1a('0xf'),JSON['stringify'](_0x2fb944));if(_0x2fb944[_0xae1a('0x12')]){if(_0x2fb944[_0xae1a('0x12')]['code']===0x1f4){logger[_0xae1a('0x12')](_0xae1a('0xe'),_0x59c1a9,_0x2fb944[_0xae1a('0x12')][_0xae1a('0x13')]);return _0x263a9d(_0x2fb944[_0xae1a('0x12')][_0xae1a('0x13')]);}logger[_0xae1a('0x12')](_0xae1a('0xe'),_0x59c1a9,_0x2fb944[_0xae1a('0x12')][_0xae1a('0x13')]);return _0x3d5fe6(_0x2fb944[_0xae1a('0x12')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x59c1a9,_0xae1a('0xf'));_0x3d5fe6(_0x2fb944[_0xae1a('0x14')][_0xae1a('0x13')]);}})['catch'](function(_0x52c2e3){logger[_0xae1a('0x12')](_0xae1a('0xe'),_0x59c1a9,_0x52c2e3);_0x263a9d(_0x52c2e3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0689383..5cc5451 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 _0xcdf2=['../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','/describe','describe','show','/:id/contacts','getContacts','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x40f279,_0xb9d09f){var _0x4f866e=function(_0x182f3d){while(--_0x182f3d){_0x40f279['push'](_0x40f279['shift']());}};_0x4f866e(++_0xb9d09f);}(_0xcdf2,0x9b));var _0x2cdf=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xcdf2[_0x1d1219];return _0x5b5b89;};'use strict';var multer=require(_0x2cdf('0x0'));var util=require(_0x2cdf('0x1'));var path=require(_0x2cdf('0x2'));var timeout=require(_0x2cdf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2cdf('0x4'));var interaction=require(_0x2cdf('0x5'));var config=require(_0x2cdf('0x6'));var controller=require(_0x2cdf('0x7'));router['get']('/',auth[_0x2cdf('0x8')](),controller['index']);router['get'](_0x2cdf('0x9'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2cdf('0xb')]);router['get'](_0x2cdf('0xc'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0xd')]);router[_0x2cdf('0xe')]('/',auth['isAuthenticated'](),controller[_0x2cdf('0xf')]);router['post'](_0x2cdf('0xc'),auth[_0x2cdf('0x8')](),controller['addContacts']);router[_0x2cdf('0x10')](_0x2cdf('0x11'),auth[_0x2cdf('0x8')](),controller['update']);router['delete'](_0x2cdf('0x11'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0x12')]);module[_0x2cdf('0x13')]=router; \ No newline at end of file +var _0x969e=['/:id/contacts','getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmCompany.controller','get','index','/describe','/:id','isAuthenticated','show'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x969e,0x134));var _0xe969=function(_0x10356a,_0x526f4a){_0x10356a=_0x10356a-0x0;var _0x38d1e8=_0x969e[_0x10356a];return _0x38d1e8;};'use strict';var multer=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var path=require(_0xe969('0x2'));var timeout=require(_0xe969('0x3'));var express=require(_0xe969('0x4'));var router=express[_0xe969('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe969('0x6'));var config=require('../../config/environment');var controller=require(_0xe969('0x7'));router[_0xe969('0x8')]('/',auth['isAuthenticated'](),controller[_0xe969('0x9')]);router['get'](_0xe969('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe969('0x8')](_0xe969('0xb'),auth[_0xe969('0xc')](),controller[_0xe969('0xd')]);router[_0xe969('0x8')](_0xe969('0xe'),auth[_0xe969('0xc')](),controller[_0xe969('0xf')]);router[_0xe969('0x10')]('/',auth[_0xe969('0xc')](),controller[_0xe969('0x11')]);router[_0xe969('0x10')]('/:id/contacts',auth[_0xe969('0xc')](),controller[_0xe969('0x12')]);router[_0xe969('0x13')](_0xe969('0xb'),auth[_0xe969('0xc')](),controller['update']);router[_0xe969('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe969('0x15')]);module[_0xe969('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6cdae4a..c87209f 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 _0x4d8f=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x2a8809,_0x121836){var _0x166dab=function(_0x2bd619){while(--_0x2bd619){_0x2a8809['push'](_0x2a8809['shift']());}};_0x166dab(++_0x121836);}(_0x4d8f,0x147));var _0xf4d8=function(_0x15dbdf,_0x2bd8ce){_0x15dbdf=_0x15dbdf-0x0;var _0x40c804=_0x4d8f[_0x15dbdf];return _0x40c804;};'use strict';var _=require(_0xf4d8('0x0'));var Sequelize=require(_0xf4d8('0x1'));module[_0xf4d8('0x2')]={'firstName':{'type':Sequelize[_0xf4d8('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf4d8('0x3')]},'city':{'type':Sequelize[_0xf4d8('0x3')]},'country':{'type':Sequelize[_0xf4d8('0x3')]},'dateOfBirth':{'type':Sequelize[_0xf4d8('0x3')]},'description':{'type':Sequelize[_0xf4d8('0x4')]},'phone':{'type':Sequelize[_0xf4d8('0x3')]},'mobile':{'type':Sequelize[_0xf4d8('0x3')]},'fax':{'type':Sequelize[_0xf4d8('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xf4d8('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf4d8('0x3')]},'twitter':{'type':Sequelize[_0xf4d8('0x3')]},'skype':{'type':Sequelize[_0xf4d8('0x3')]},'teams':{'type':Sequelize[_0xf4d8('0x3')]},'viber':{'type':Sequelize[_0xf4d8('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xf4d8('0x3')]},'telegram':{'type':Sequelize[_0xf4d8('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf4d8('0x5')](0x2)[_0xf4d8('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf4d8('0x7')],'defaultValue':Sequelize[_0xf4d8('0x8')]},'dialTimezone':{'type':Sequelize[_0xf4d8('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3544=['DATE','NOW','lodash','sequelize','STRING','INTEGER','UNSIGNED'];(function(_0x39ff0d,_0x2df101){var _0x4d63eb=function(_0x35f7c1){while(--_0x35f7c1){_0x39ff0d['push'](_0x39ff0d['shift']());}};_0x4d63eb(++_0x2df101);}(_0x3544,0xbf));var _0x4354=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x3544[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x4354('0x0'));var Sequelize=require(_0x4354('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4354('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4354('0x2')]},'street':{'type':Sequelize[_0x4354('0x2')]},'postalCode':{'type':Sequelize[_0x4354('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x4354('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4354('0x2')]},'mobile':{'type':Sequelize[_0x4354('0x2')]},'fax':{'type':Sequelize[_0x4354('0x2')]},'email':{'type':Sequelize[_0x4354('0x2')]},'url':{'type':Sequelize[_0x4354('0x2')]},'facebook':{'type':Sequelize[_0x4354('0x2')]},'fb_data':{'type':Sequelize[_0x4354('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4354('0x2')]},'teams':{'type':Sequelize[_0x4354('0x2')]},'viber':{'type':Sequelize[_0x4354('0x2')]},'line':{'type':Sequelize[_0x4354('0x2')]},'wechat':{'type':Sequelize[_0x4354('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x4354('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x4354('0x2')]},'priority':{'type':Sequelize[_0x4354('0x3')](0x2)[_0x4354('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4354('0x5')],'defaultValue':Sequelize[_0x4354('0x6')]},'dialTimezone':{'type':Sequelize[_0x4354('0x2')]},'utcOffset':{'type':Sequelize[_0x4354('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0fe9c79..09b4978 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 _0x37bc=['rawAttributes','pick','ContactId','include','CmHopperHistory','includeAll','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','file','meta','agent','binding','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','firstName','../../components/import/cm/csvUpdates','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','duration','note','createdAt','userSecondDisposition','UserId','fullname','alias','DESC','Website','closed','disposition','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','reverse','slice','moment','bluebird','util','path','lodash','squel','ioredis','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','sendStatus','stack','name','index','describe','getOptions','findAll','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','columnName','query','analytics','CmCustomField','length','custom','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','push','where','ListId','spread','hasOwnProperty','contact','all','show','Tag','Tags','color','tag','Phones','ContactItemType','literal','Phones.OrderBy','$and','omit','pickBy','format','cf_%d','isEmpty','cm_contacts','setFields','toParam','text','values','phone','findOne','filters','intersection','model','fields','attributes','order','sort','filter','map','options','getTags','nolimit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','ItemType','getAdditionalPhones','sequelize','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers'];(function(_0x45406b,_0x5d1136){var _0x4e3cdd=function(_0x253a1e){while(--_0x253a1e){_0x45406b['push'](_0x45406b['shift']());}};_0x4e3cdd(++_0x5d1136);}(_0x37bc,0x15f));var _0xc37b=function(_0x192ed5,_0x1b3974){_0x192ed5=_0x192ed5-0x0;var _0x3f178b=_0x37bc[_0x192ed5];return _0x3f178b;};'use strict';var moment=require(_0xc37b('0x0'));var BPromise=require(_0xc37b('0x1'));var util=require(_0xc37b('0x2'));var path=require(_0xc37b('0x3'));var fs=require('fs');var _=require(_0xc37b('0x4'));var squel=require(_0xc37b('0x5'));var Papa=require('papaparse');var Redis=require(_0xc37b('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc37b('0x7'));var config=require('../../config/environment');var shared=require(_0xc37b('0x8'));var db=require(_0xc37b('0x9'))['db'];config[_0xc37b('0xa')]=_[_0xc37b('0xb')](config['redis'],{'host':_0xc37b('0xc'),'port':0x18eb});var socket=require(_0xc37b('0xd'))(new Redis(config[_0xc37b('0xa')]));require(_0xc37b('0xe'))['register'](socket);function respondWithResult(_0xea9e81,_0xc4234f){_0xc4234f=_0xc4234f||0xc8;return function(_0x60e9a5){if(_0x60e9a5){return _0xea9e81[_0xc37b('0xf')](_0xc4234f)[_0xc37b('0x10')](_0x60e9a5);}};}function respondWithFilteredResult(_0x2684de,_0x4aeeb5){return function(_0x209585){if(_0x209585){var _0x52085d=typeof _0x4aeeb5[_0xc37b('0x11')]===_0xc37b('0x12')&&typeof _0x4aeeb5['limit']===_0xc37b('0x12');var _0x204c7c=_0x209585[_0xc37b('0x13')];var _0xb09fa2=_0x52085d?0x0:_0x4aeeb5[_0xc37b('0x11')];var _0xaa4bfa=_0x52085d?_0x209585[_0xc37b('0x13')]:_0x4aeeb5[_0xc37b('0x11')]+_0x4aeeb5[_0xc37b('0x14')];var _0x2f2bd1;if(_0xaa4bfa>=_0x204c7c){_0xaa4bfa=_0x204c7c;_0x2f2bd1=0xc8;}else{_0x2f2bd1=0xce;}_0x2684de[_0xc37b('0xf')](_0x2f2bd1);return _0x2684de[_0xc37b('0x15')](_0xc37b('0x16'),_0xb09fa2+'-'+_0xaa4bfa+'/'+_0x204c7c)[_0xc37b('0x10')](_0x209585);}return null;};}function saveUpdates(_0x3ddfb8){return function(_0x89c8a8){if(_0x89c8a8){return _0x89c8a8['update'](_0x3ddfb8)['then'](function(_0x587f99){return _0x587f99;});}return null;};}function removeEntity(_0x12a776){return function(_0x471054){if(_0x471054){return _0x471054[_0xc37b('0x17')]()[_0xc37b('0x18')](function(){_0x12a776[_0xc37b('0xf')](0xcc)[_0xc37b('0x19')]();});}};}function handleEntityNotFound(_0x425a77){return function(_0x31ae38){if(!_0x31ae38){_0x425a77[_0xc37b('0x1a')](0x194);}return _0x31ae38;};}function handleError(_0xc15854,_0x2bde68){_0x2bde68=_0x2bde68||0x1f4;return function(_0x5a3188){logger['error'](_0x5a3188[_0xc37b('0x1b')]);if(_0x5a3188[_0xc37b('0x1c')]){delete _0x5a3188[_0xc37b('0x1c')];}_0xc15854[_0xc37b('0xf')](_0x2bde68)['send'](_0x5a3188);};}exports[_0xc37b('0x1d')]=function(_0x251d65,_0xe4449){var _0x29234e={};return contacts[_0xc37b('0x1e')]()[_0xc37b('0x18')](function(_0x4fc52c){_0x29234e=qs[_0xc37b('0x1f')](_0x4fc52c,_0x251d65);return contacts[_0xc37b('0x20')](_0x251d65['query'],_0x251d65[_0xc37b('0x21')],_0x29234e,_0x4fc52c);})[_0xc37b('0x18')](respondWithFilteredResult(_0xe4449,_0x29234e))[_0xc37b('0x22')](handleError(_0xe4449,null));};exports[_0xc37b('0x17')]=function(_0x3da7b8,_0x27b0ed){return db[_0xc37b('0x23')][_0xc37b('0x24')]({'where':{'id':_0x3da7b8[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x27b0ed,null))['then'](removeEntity(_0x27b0ed,null))['catch'](handleError(_0x27b0ed,null));};exports[_0xc37b('0x1e')]=function(_0x30f0bf,_0x56acf8){return db[_0xc37b('0x23')]['describe']()[_0xc37b('0x18')](function(_0x682ae7){delete _0x682ae7[_0xc37b('0x26')];for(var _0x5e0de8=0x0;_0x5e0de80x0){return new Promise(function(_0xf53dbe){var _0x3642c0=[];for(var _0x166ac6=0x0;_0x166ac6<_0x3fdfe4['length'];_0x166ac6++){_0x3642c0[_0xc37b('0x5d')](insertAdditionalPhones(_0x3fdfe4[_0x166ac6][_0xc37b('0x62')],_0x3fdfe4[_0x166ac6]['additionalPhones']));}Promise[_0xc37b('0x63')](_0x3642c0)[_0xc37b('0x18')](function(){_0xf53dbe(0x1);});})[_0xc37b('0x18')](function(){return{'success':_0x1a8cbc,'failure':_0x25d6c2,'duplicates':_0x4e9efe};});}else{return{'success':_0x1a8cbc,'failure':_0x25d6c2,'duplicates':_0x4e9efe};}}})['then'](respondWithResult(_0x10600a,0xc9))[_0xc37b('0x22')](handleError(_0x10600a,null));};exports[_0xc37b('0x64')]=function(_0x13dd90,_0x18bbd9){var _0x198e91;return db[_0xc37b('0x23')][_0xc37b('0x1e')]()[_0xc37b('0x18')](function(_0x26b08c){return db['CmContact'][_0xc37b('0x24')]({'where':{'id':_0x13dd90[_0xc37b('0x25')]['id']},'include':[{'model':db[_0xc37b('0x65')],'as':_0xc37b('0x66'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0x67')],'required':_0x13dd90[_0xc37b('0x2b')][_0xc37b('0x68')]?!![]:![]},{'model':db[_0xc37b('0x47')],'as':_0xc37b('0x69'),'where':{'CmContactId':_0x13dd90[_0xc37b('0x25')]['id']},'required':![],'include':[{'model':db[_0xc37b('0x6a')],'as':'ItemType'}]}],'order':[db['sequelize'][_0xc37b('0x6b')](_0xc37b('0x6c'))],'attributes':_[_0xc37b('0x27')](_0x26b08c)});})[_0xc37b('0x18')](function(_0x33c091){if(!_[_0xc37b('0x55')](_0x33c091)){_0x198e91=_0x33c091[_0xc37b('0x35')]({'plain':!![]});var _0x4f2b86={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33c091&&_0x33c091[_0xc37b('0x5f')]){if(_0x33c091[_0xc37b('0x5f')]){_0x4f2b86[_0xc37b('0x5e')][_0xc37b('0x6d')][_0xc37b('0x5d')]({'ListId':{'$ne':_0x33c091['ListId']}});}}return db['CmCustomField'][_0xc37b('0x20')](_0x4f2b86);}})['then'](function(_0x4b4f20){if(!_[_0xc37b('0x55')](_0x4b4f20)){return _[_0xc37b('0x6e')](_0x198e91,_['map'](_0x4b4f20,function(_0x434901){return util['format']('cf_%d',_0x434901['id']);}));}})[_0xc37b('0x18')](handleEntityNotFound(_0x18bbd9,null))[_0xc37b('0x18')](respondWithResult(_0x18bbd9,null))[_0xc37b('0x22')](handleError(_0x18bbd9,null));};exports[_0xc37b('0x3f')]=function(_0x379324,_0x42b1d7){var _0x237a2b;if(_0x379324['body']['id']){delete _0x379324['body']['id'];}if(!_['isNil'](_0x379324[_0xc37b('0x34')][_0xc37b('0x56')])){var _0xdd88d3=_0x379324[_0xc37b('0x34')]['dialTimezone'];if(!_[_0xc37b('0x55')](shared['timezones'][_0xdd88d3]))_0x379324[_0xc37b('0x34')][_0xc37b('0x58')]=shared['timezones'][_0xdd88d3][_0xc37b('0x58')];}return db['CmContact'][_0xc37b('0x24')]({'where':{'id':_0x379324['params']['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x42b1d7,null))[_0xc37b('0x18')](saveUpdates(_0x379324[_0xc37b('0x34')],null))[_0xc37b('0x18')](function(_0x3e8808){_0x237a2b=_0x3e8808;var _0x503daa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3e8808&&_0x3e8808[_0xc37b('0x5f')]){if(_0x3e8808['ListId']){_0x503daa['where'][_0xc37b('0x6d')][_0xc37b('0x5d')]({'ListId':{'$ne':_0x3e8808['ListId']}});}}return db[_0xc37b('0x2d')][_0xc37b('0x20')](_0x503daa);})[_0xc37b('0x18')](function(_0x204780){if(_0x204780){return _['omit'](_[_0xc37b('0x6f')](_0x379324[_0xc37b('0x34')],function(_0x123cb4,_0x2e341c){return _[_0xc37b('0x28')](_0x2e341c,'cf_');}),_['map'](_0x204780,function(_0x2ed46e){return util[_0xc37b('0x70')](_0xc37b('0x71'),_0x2ed46e['id']);}));}})[_0xc37b('0x18')](function(_0x459516){if(_0x459516&&!_[_0xc37b('0x72')](_0x459516)){var _0x1716f7=squel[_0xc37b('0x3f')]()['table'](_0xc37b('0x73'))[_0xc37b('0x74')](_0x459516)[_0xc37b('0x5e')]('id\x20=\x20?',_0x379324['params']['id'])[_0xc37b('0x75')]();return db['sequelize'][_0xc37b('0x2b')](_0x1716f7[_0xc37b('0x76')],{'replacements':_0x1716f7[_0xc37b('0x77')]});}})[_0xc37b('0x18')](function(){if(_0x379324['body'][_0xc37b('0x78')]&&_0x237a2b){return db[_0xc37b('0x3a')][_0xc37b('0x3f')]({'phone':_0x379324[_0xc37b('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x237a2b['id']}});}})[_0xc37b('0x18')](function(){return _0x237a2b;})[_0xc37b('0x18')](respondWithResult(_0x42b1d7,null))[_0xc37b('0x22')](handleError(_0x42b1d7,null));};exports['getTags']=function(_0x38b6c7,_0x50a517){var _0x2cb6ca={};var _0x7354b7={};var _0x1d5824;var _0x122fbc;return db['CmContact'][_0xc37b('0x79')]({'where':{'id':_0x38b6c7[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x50a517,null))[_0xc37b('0x18')](function(_0x8bfb5c){if(_0x8bfb5c){_0x1d5824=_0x8bfb5c;_0x7354b7['model']=_[_0xc37b('0x27')](db['Tag']['rawAttributes']);_0x7354b7['query']=_[_0xc37b('0x27')](_0x38b6c7['query']);_0x7354b7[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x7354b7[_0xc37b('0x7c')],_0x7354b7['query']);_0x2cb6ca['attributes']=_['intersection'](_0x7354b7[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x2cb6ca[_0xc37b('0x7e')]=_0x2cb6ca[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x2cb6ca['attributes']:_0x7354b7[_0xc37b('0x7c')];_0x2cb6ca[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x80')]);_0x2cb6ca['where']=qs['filters'](_['pick'](_0x38b6c7[_0xc37b('0x2b')],_0x7354b7[_0xc37b('0x7a')]));if(_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x2cb6ca['where']=_[_0xc37b('0x33')](_0x2cb6ca[_0xc37b('0x5e')],{'$or':_[_0xc37b('0x82')](_0x2cb6ca[_0xc37b('0x7e')],function(_0x1ae472){var _0x27a7fe={};_0x27a7fe[_0x1ae472]={'$like':'%'+_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x81')]+'%'};return _0x27a7fe;})});}_0x2cb6ca=_[_0xc37b('0x33')]({},_0x2cb6ca,_0x38b6c7[_0xc37b('0x83')]);return _0x1d5824[_0xc37b('0x84')](_0x2cb6ca);}})[_0xc37b('0x18')](function(_0x5f473a){if(_0x5f473a){_0x122fbc=_0x5f473a[_0xc37b('0x2e')];if(!_0x38b6c7[_0xc37b('0x2b')]['hasOwnProperty'](_0xc37b('0x85'))){_0x2cb6ca[_0xc37b('0x14')]=qs[_0xc37b('0x14')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x2cb6ca[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x11')]);}return _0x1d5824['getTags'](_0x2cb6ca);}})['then'](function(_0x2db0f2){if(_0x2db0f2){return _0x2db0f2?{'count':_0x122fbc,'rows':_0x2db0f2}:null;}})[_0xc37b('0x18')](respondWithResult(_0x50a517,null))[_0xc37b('0x22')](handleError(_0x50a517,null));};exports[_0xc37b('0x86')]=function(_0x48ef56,_0x236f82){if(_0x48ef56[_0xc37b('0x34')]['id']){delete _0x48ef56[_0xc37b('0x34')]['id'];}return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x48ef56[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x236f82,null))['then'](function(_0x22e854){if(_0x22e854){return _0x22e854[_0xc37b('0x86')](_0x48ef56[_0xc37b('0x34')][_0xc37b('0x87')]||[]);}return null;})[_0xc37b('0x18')](respondWithResult(_0x236f82,null))[_0xc37b('0x22')](handleError(_0x236f82,null));};exports[_0xc37b('0x88')]=function(_0x224bc7,_0x1414b5){var _0x45b624=[];_0x45b624['push'](addAdditionalPhones(_0x224bc7[_0xc37b('0x34')]));Promise['all'](_0x45b624)['then'](function(){_0x45b624=[];_0x45b624['push'](deleteCmHopperPhones(_0x224bc7[_0xc37b('0x34')]['id']));_0x45b624[_0xc37b('0x5d')](addCmHopperPhones(_0x224bc7[_0xc37b('0x34')]['id']));Promise[_0xc37b('0x63')](_0x45b624)[_0xc37b('0x18')](function(){return[0x1];})[_0xc37b('0x18')](respondWithResult(_0x1414b5,null));});};function addAdditionalPhones(_0x42e82b){var _0x283b18;return new Promise(function(_0x1b3fc6){return db[_0xc37b('0x47')]['destroy']({'where':{'CmContactId':_0x42e82b['id']}})[_0xc37b('0x18')](function(){db[_0xc37b('0x6a')][_0xc37b('0x20')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x451017){var _0x663457=[];for(var _0x39dcdc=0x0;_0x39dcdc<_0x42e82b[_0xc37b('0x89')]['length'];_0x39dcdc++){var _0x100068=_0x42e82b[_0xc37b('0x8a')]?_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x8a')][_0x39dcdc])?'':_0x42e82b[_0xc37b('0x8a')][_0x39dcdc]:_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8b')]?_0x42e82b['items'][_0x39dcdc][_0xc37b('0x8b')]:'';var _0x423969=_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8c')])?'':_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8c')];var _0x1d8936=_0x100068+':'+_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x78')]+'§'+_0x423969;if(_[_0xc37b('0x55')](_0x283b18))_0x283b18=_0x1d8936;else _0x283b18+=';'+_0x1d8936;var _0x8c7c98=null;var _0x4882f9=null;if(_0x42e82b[_0xc37b('0x8a')]){if(!_[_0xc37b('0x55')](_0x42e82b['item_types'][_0x39dcdc])){_0x4882f9=_[_0xc37b('0x24')](_0x451017,function(_0x41443f){return _0x41443f['id']===_0x42e82b[_0xc37b('0x8a')][_0x39dcdc];});if(!_[_0xc37b('0x55')](_0x4882f9)){_0x8c7c98=_0x4882f9[_0xc37b('0x8d')];}}}else{if(!_['isNil'](_0x42e82b[_0xc37b('0x89')][_0x39dcdc])){_0x4882f9=_[_0xc37b('0x24')](_0x451017,function(_0x55e78a){return _0x55e78a['id']===_0x42e82b[_0xc37b('0x89')][_0x39dcdc]['ItemTypeId'];});if(!_[_0xc37b('0x55')](_0x4882f9)){_0x8c7c98=_0x39dcdc;}}}if(_[_0xc37b('0x55')](_0x8c7c98)){_0x8c7c98=0x64;}_0x663457[_0xc37b('0x5d')](addAdditionalPhone(_0x42e82b['id'],_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x78')],_0x42e82b[_0xc37b('0x8a')]?_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x8a')][_0x39dcdc])?null:_0x42e82b[_0xc37b('0x8a')][_0x39dcdc]:_0x42e82b['items'][_0x39dcdc][_0xc37b('0x8b')]?_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8b')]:null,_0x8c7c98,_0x423969));}Promise[_0xc37b('0x63')](_0x663457)['then'](function(){db[_0xc37b('0x23')][_0xc37b('0x3f')]({'AdditionalPhones':_0x283b18},{'where':{'id':_0x42e82b['id']}})[_0xc37b('0x18')](function(){_0x1b3fc6(0x1);});});});});});}function addAdditionalPhone(_0x502c0b,_0x1d18df,_0x3a2255,_0x3c9069,_0x22bd7b){return db[_0xc37b('0x47')][_0xc37b('0x24')]({'where':{'CmContactId':_0x502c0b,'item':_0x1d18df}})[_0xc37b('0x18')](function(_0x455cbd){if(_0x455cbd)logger[_0xc37b('0x37')]('contact\x20phone\x20exists',_0x455cbd);else{db['CmContactHasItem']['create']({'CmContactId':_0x502c0b,'item':_0x1d18df,'ItemTypeId':_0x3a2255,'OrderBy':_0x3c9069,'ItemClass':_0xc37b('0x8e'),'description':_0x22bd7b});}});}function deleteCmHopperPhones(_0x665cf4){return new Promise(function(_0x3c052e){return db[_0xc37b('0x3a')][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x665cf4}})[_0xc37b('0x18')](function(_0x23bdd8){db[_0xc37b('0x8f')][_0xc37b('0x17')]({'where':{'CmHopperId':{'$in':_['map'](_0x23bdd8,'id')}}});})[_0xc37b('0x18')](function(){_0x3c052e(0x1);});});}function addCmHopperPhones(_0x20f858){return new Promise(function(_0x1c93c2){return db['CmHopper'][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x20f858}})[_0xc37b('0x18')](function(_0x2e1df5){var _0x38f227=[];_[_0xc37b('0x82')](_0x2e1df5,function(_0x32c319){_0x38f227[_0xc37b('0x5d')](createCmHopperPhone(_0x20f858,_0x32c319['id']));});Promise[_0xc37b('0x63')](_0x38f227)['then'](function(){_0x1c93c2(0x1);});});});}function createCmHopperPhone(_0x491906,_0x17b36c){return new Promise(function(_0x249fc4){db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'attributes':['item',_0xc37b('0x8d')],'where':{'CmContactId':_0x491906,'ItemClass':_0xc37b('0x8e')},'include':[{'model':db[_0xc37b('0x6a')],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xc37b('0x8d'),db['sequelize'][_0xc37b('0x6b')](_0xc37b('0x90'))]})[_0xc37b('0x18')](function(_0x3bbb31){var _0x164e90=0x1;var _0x317817=_['map'](_0x3bbb31,function(_0x440b4c){_0x440b4c[_0xc37b('0x91')]=_0x17b36c;_0x440b4c[_0xc37b('0x78')]=_0x440b4c[_0xc37b('0x92')];_0x440b4c['OrderBy']=_0x164e90;delete _0x440b4c[_0xc37b('0x93')];_0x164e90=_0x164e90+0x1;return _0x440b4c;});return db['CmHopperAdditionalPhone'][_0xc37b('0x5a')](_0x317817,{});})[_0xc37b('0x18')](function(){_0x249fc4(0x1);});});}function insertAdditionalPhones(_0x3986f7,_0x5a3c11){return new Promise(function(_0x2603af){var _0x4de61f=[];for(var _0x742969=0x0;_0x742969<_0x5a3c11['length'];_0x742969++){var _0x393c0f=_0x5a3c11[_0x742969];_0x4de61f[_0xc37b('0x5d')](parseContactItemType(_0x393c0f));}Promise['all'](_0x4de61f)[_0xc37b('0x18')](function(){var _0x48a08b={'id':_0x3986f7['id'],'items':_0x5a3c11};return addAdditionalPhones(_0x48a08b)[_0xc37b('0x18')](function(){return addCmHopperPhones(_0x3986f7['id']);});})[_0xc37b('0x18')](function(){_0x2603af(_0x3986f7);});});}function parseContactItemType(_0x3f0e83){return new Promise(function(_0x3cb31d){if(_0x3f0e83['hasOwnProperty']('ItemTypeId')){_0x3cb31d(_0x3f0e83);}else{return db[_0xc37b('0x6a')][_0xc37b('0x24')]({'where':{'name':_0x3f0e83[_0xc37b('0x94')]}})['then'](function(_0xba54aa){if(_[_0xc37b('0x55')](_0xba54aa))_0x3f0e83[_0xc37b('0x8b')]=null;else _0x3f0e83[_0xc37b('0x8b')]=_0xba54aa['id'];_0x3cb31d(_0x3f0e83);});}});}exports[_0xc37b('0x95')]=function(_0x19b476,_0x30e664){return db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'where':{'CmContactId':_0x19b476[_0xc37b('0x25')]['id'],'ItemClass':_0xc37b('0x8e')},'include':[{'model':db[_0xc37b('0x6a')],'as':_0xc37b('0x94')}],'order':[[_0xc37b('0x8d')],[db[_0xc37b('0x96')][_0xc37b('0x6b')]('`ItemType`.OrderBy')]]})[_0xc37b('0x18')](function(_0x121302){return _0x121302;})[_0xc37b('0x18')](respondWithResult(_0x30e664,null))[_0xc37b('0x22')](handleError(_0x30e664,null));};exports['duplicateAdditionalPhones']=function(_0x43b933,_0x2e257a){return db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'where':{'CmContactId':_0x43b933[_0xc37b('0x34')][_0xc37b('0x97')]}})[_0xc37b('0x18')](function(_0x24fd76){var _0x3bfc81=_[_0xc37b('0x82')](_0x24fd76,function(_0x264a85){_0x264a85[_0xc37b('0x98')]=_0x43b933[_0xc37b('0x34')]['toContactId'];return _0x264a85;});return db[_0xc37b('0x47')]['bulkCreate'](_0x3bfc81,{});})['then'](function(){return addCmHopperPhones(_0x43b933['body'][_0xc37b('0x99')]);})[_0xc37b('0x18')](function(){return['ok'];})[_0xc37b('0x18')](respondWithResult(_0x2e257a,null))[_0xc37b('0x22')](handleError(_0x2e257a,null));};exports[_0xc37b('0x9a')]=function(_0x701ed4,_0x4e0d62){var _0x201d9e=[];_0x201d9e[_0xc37b('0x5d')](createCmHopperPhone(_0x701ed4[_0xc37b('0x34')]['id'],_0x701ed4[_0xc37b('0x34')][_0xc37b('0x9b')]));Promise[_0xc37b('0x63')](_0x201d9e)[_0xc37b('0x18')](function(){return[0x1];})[_0xc37b('0x18')](respondWithResult(_0x4e0d62,null));};exports[_0xc37b('0x9c')]=function(_0x25acec,_0xb68ecc){var _0x3a56c3={'raw':![],'where':{}};var _0x4af625={};var _0x3c08c5={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x25acec[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0xb68ecc,null))[_0xc37b('0x18')](function(_0x2c49f4){if(_0x2c49f4){_0x4af625[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db[_0xc37b('0x3a')][_0xc37b('0x9d')]);_0x4af625[_0xc37b('0x2b')]=_['keys'](_0x25acec[_0xc37b('0x2b')]);_0x4af625[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x4af625[_0xc37b('0x7c')],_0x4af625['query']);_0x3a56c3[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x4af625[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x25acec[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x3a56c3[_0xc37b('0x7e')]=_0x3a56c3['attributes'][_0xc37b('0x2e')]?_0x3a56c3[_0xc37b('0x7e')]:_0x4af625[_0xc37b('0x7c')];if(!_0x25acec['query'][_0xc37b('0x61')]('nolimit')){_0x3a56c3[_0xc37b('0x14')]=qs['limit'](_0x25acec[_0xc37b('0x2b')]['limit']);_0x3a56c3[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x25acec[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x3a56c3[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x25acec['query'][_0xc37b('0x80')]);_0x3a56c3[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0x25acec['query'],_0x4af625[_0xc37b('0x7a')]));_0x3a56c3[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x2c49f4['id'];if(_0x25acec[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x3a56c3[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x3a56c3[_0xc37b('0x5e')],{'$or':_[_0xc37b('0x82')](_0x3a56c3[_0xc37b('0x7e')],function(_0x34594d){var _0x388505={};_0x388505[_0x34594d]={'$like':'%'+_0x25acec[_0xc37b('0x2b')][_0xc37b('0x81')]+'%'};return _0x388505;})});}_0x3a56c3=_['merge']({},_0x3a56c3,_0x25acec['options']);return db[_0xc37b('0x3a')][_0xc37b('0x13')]({'where':_0x3a56c3[_0xc37b('0x5e')]})[_0xc37b('0x18')](function(_0x83ada){_0x3c08c5[_0xc37b('0x13')]=_0x83ada;if(_0x25acec['query']['includeAll']){_0x3a56c3[_0xc37b('0xa0')]=[{'all':!![]}];}return db['CmHopper'][_0xc37b('0x20')](_0x3a56c3);})[_0xc37b('0x18')](function(_0x4fb384){_0x3c08c5['rows']=_0x4fb384;return _0x3c08c5;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0xb68ecc,_0x3a56c3))[_0xc37b('0x22')](handleError(_0xb68ecc,null));};exports['getHopperHistories']=function(_0x4c3f1b,_0x1e3099){var _0x34823e={'raw':!![],'where':{}};var _0x51e1d2={};var _0x32a805={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x4c3f1b[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0x1e3099,null))[_0xc37b('0x18')](function(_0x2f415d){if(_0x2f415d){_0x51e1d2[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db[_0xc37b('0xa1')][_0xc37b('0x9d')]);_0x51e1d2[_0xc37b('0x2b')]=_['keys'](_0x4c3f1b['query']);_0x51e1d2[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x51e1d2[_0xc37b('0x7c')],_0x51e1d2['query']);_0x34823e[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x51e1d2[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x34823e[_0xc37b('0x7e')]=_0x34823e[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x34823e['attributes']:_0x51e1d2['model'];if(!_0x4c3f1b[_0xc37b('0x2b')]['hasOwnProperty'](_0xc37b('0x85'))){_0x34823e['limit']=qs['limit'](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x34823e[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x34823e[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x4c3f1b['query']['sort']);_0x34823e[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0x4c3f1b[_0xc37b('0x2b')],_0x51e1d2['filters']));_0x34823e[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x2f415d['id'];if(_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x34823e[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x34823e[_0xc37b('0x5e')],{'$or':_['map'](_0x34823e[_0xc37b('0x7e')],function(_0x9daf36){var _0x42dce6={};_0x42dce6[_0x9daf36]={'$like':'%'+_0x4c3f1b[_0xc37b('0x2b')]['filter']+'%'};return _0x42dce6;})});}_0x34823e=_[_0xc37b('0x33')]({},_0x34823e,_0x4c3f1b[_0xc37b('0x83')]);return db[_0xc37b('0xa1')]['count']({'where':_0x34823e[_0xc37b('0x5e')]})['then'](function(_0x4031b0){_0x32a805[_0xc37b('0x13')]=_0x4031b0;if(_0x4c3f1b[_0xc37b('0x2b')]['includeAll']){_0x34823e['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xc37b('0x20')](_0x34823e);})[_0xc37b('0x18')](function(_0x1b764b){_0x32a805['rows']=_0x1b764b;return _0x32a805;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0x1e3099,_0x34823e))[_0xc37b('0x22')](handleError(_0x1e3099,null));};exports['getHopperFinals']=function(_0x5bd4f5,_0x5c2cd1){var _0x51d57b={'raw':!![],'where':{}};var _0x2e8deb={};var _0x214c05={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x5bd4f5[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0x5c2cd1,null))[_0xc37b('0x18')](function(_0x225b13){if(_0x225b13){_0x2e8deb['model']=_['keys'](db[_0xc37b('0x48')][_0xc37b('0x9d')]);_0x2e8deb[_0xc37b('0x2b')]=_[_0xc37b('0x27')](_0x5bd4f5['query']);_0x2e8deb[_0xc37b('0x7a')]=_['intersection'](_0x2e8deb[_0xc37b('0x7c')],_0x2e8deb[_0xc37b('0x2b')]);_0x51d57b[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x2e8deb[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x5bd4f5['query'][_0xc37b('0x7d')]));_0x51d57b[_0xc37b('0x7e')]=_0x51d57b[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x51d57b[_0xc37b('0x7e')]:_0x2e8deb[_0xc37b('0x7c')];if(!_0x5bd4f5['query'][_0xc37b('0x61')](_0xc37b('0x85'))){_0x51d57b[_0xc37b('0x14')]=qs[_0xc37b('0x14')](_0x5bd4f5['query'][_0xc37b('0x14')]);_0x51d57b['offset']=qs[_0xc37b('0x11')](_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x51d57b[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x80')]);_0x51d57b[_0xc37b('0x5e')]=qs['filters'](_[_0xc37b('0x9e')](_0x5bd4f5[_0xc37b('0x2b')],_0x2e8deb[_0xc37b('0x7a')]));_0x51d57b[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x225b13['id'];if(_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x51d57b[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x51d57b[_0xc37b('0x5e')],{'$or':_['map'](_0x51d57b[_0xc37b('0x7e')],function(_0x2ae823){var _0x1f334f={};_0x1f334f[_0x2ae823]={'$like':'%'+_0x5bd4f5['query'][_0xc37b('0x81')]+'%'};return _0x1f334f;})});}_0x51d57b=_[_0xc37b('0x33')]({},_0x51d57b,_0x5bd4f5['options']);return db[_0xc37b('0x48')][_0xc37b('0x13')]({'where':_0x51d57b[_0xc37b('0x5e')]})['then'](function(_0x2283d8){_0x214c05['count']=_0x2283d8;if(_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0xa2')]){_0x51d57b[_0xc37b('0xa0')]=[{'all':!![]}];}return db[_0xc37b('0x48')][_0xc37b('0x20')](_0x51d57b);})[_0xc37b('0x18')](function(_0x113ca2){_0x214c05[_0xc37b('0xa3')]=_0x113ca2;return _0x214c05;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0x5c2cd1,_0x51d57b))[_0xc37b('0x22')](handleError(_0x5c2cd1,null));};exports[_0xc37b('0xa4')]=function(_0xf9a0e4,_0x3aac97){var _0x177ba8={'raw':!![],'where':{}};var _0x1460e8={};var _0x43e449={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0xf9a0e4[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x3aac97,null))[_0xc37b('0x18')](function(_0x28d6fb){if(_0x28d6fb){_0x1460e8[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db['JscriptySessionReport']['rawAttributes']);_0x1460e8[_0xc37b('0x2b')]=_[_0xc37b('0x27')](_0xf9a0e4['query']);_0x1460e8[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x1460e8[_0xc37b('0x7c')],_0x1460e8[_0xc37b('0x2b')]);_0x177ba8[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x1460e8[_0xc37b('0x7c')],qs['fields'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x177ba8[_0xc37b('0x7e')]=_0x177ba8[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x177ba8['attributes']:_0x1460e8['model'];if(!_0xf9a0e4['query']['hasOwnProperty'](_0xc37b('0x85'))){_0x177ba8[_0xc37b('0x14')]=qs['limit'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x177ba8[_0xc37b('0x11')]=qs['offset'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x177ba8[_0xc37b('0x7f')]=qs['sort'](_0xf9a0e4['query'][_0xc37b('0x80')]);_0x177ba8[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0xf9a0e4[_0xc37b('0x2b')],_0x1460e8[_0xc37b('0x7a')]));_0x177ba8[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x28d6fb['id'];if(_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x177ba8[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x177ba8[_0xc37b('0x5e')],{'$or':_['map'](_0x177ba8['attributes'],function(_0x24780a){var _0x3a6dee={};_0x3a6dee[_0x24780a]={'$like':'%'+_0xf9a0e4['query'][_0xc37b('0x81')]+'%'};return _0x3a6dee;})});}_0x177ba8=_['merge']({},_0x177ba8,_0xf9a0e4[_0xc37b('0x83')]);return db[_0xc37b('0x4f')][_0xc37b('0x13')]({'where':_0x177ba8[_0xc37b('0x5e')]})[_0xc37b('0x18')](function(_0x4de853){_0x43e449['count']=_0x4de853;if(_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0xa2')]){_0x177ba8[_0xc37b('0xa0')]=[{'all':!![]}];}return db[_0xc37b('0x4f')][_0xc37b('0x20')](_0x177ba8);})[_0xc37b('0x18')](function(_0x49b2a7){_0x43e449[_0xc37b('0xa3')]=_0x49b2a7;return _0x43e449;});}})['then'](respondWithFilteredResult(_0x3aac97,_0x177ba8))['catch'](handleError(_0x3aac97,null));};exports[_0xc37b('0xa5')]=function(_0x942a5f,_0x2b6651){try{if(!_0x942a5f['body'][_0xc37b('0x5f')]){throw new Error(_0xc37b('0xa6'));}if(!_0x942a5f[_0xc37b('0x34')]['binding_keys']){throw new Error(_0xc37b('0xa7'));}if(!_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')]){throw new Error(_0xc37b('0xa9'));}if(!_0x942a5f['body']['socket_timestamp']){throw new Error(_0xc37b('0xaa'));}var _0xb97b9a=_0x942a5f[_0xc37b('0x34')][_0xc37b('0xab')][_0xc37b('0xac')](',');var _0x111626=_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')][_0xc37b('0xac')](',');if(!_0xb97b9a[_0xc37b('0x2e')]||!_0x111626[_0xc37b('0x2e')]||_0xb97b9a['length']!==_0x111626[_0xc37b('0x2e')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x942a5f[_0xc37b('0x34')][_0xc37b('0x7d')]=_['zipObject'](_0xb97b9a,_0x111626);if(!_0x942a5f['body'][_0xc37b('0x7d')][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x942a5f[_0xc37b('0x34')]['fields']['firstName']){throw new Error(_0xc37b('0xae'));}var _0xf1a5da=path['join'](config[_0xc37b('0xaf')],_0xc37b('0xb0'),_0x942a5f['file'][_0xc37b('0xb1')]);fs[_0xc37b('0xb2')](_0xf1a5da,parseInt(_0xc37b('0xb3'),0x8));var _0x47739c=require(_0xc37b('0xb4'))[_0xc37b('0xb5')](path[_0xc37b('0x54')](__dirname,_0xc37b('0xb6')),[_0xf1a5da,_0x942a5f['body'][_0xc37b('0xab')],_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')],_0x942a5f[_0xc37b('0x34')]['ListId'],_0x942a5f[_0xc37b('0x34')][_0xc37b('0xb7')],_0x942a5f[_0xc37b('0x34')][_0xc37b('0x5c')],_0x942a5f[_0xc37b('0x34')]['socket_timestamp']]);return _0x2b6651[_0xc37b('0xf')](0xc8)['json']({'message':_0xc37b('0xb8'),'pid':_0x47739c[_0xc37b('0xb9')]});}catch(_0x22989a){return _0x2b6651[_0xc37b('0xf')](0x1f4)[_0xc37b('0xba')](_0x22989a);}};exports[_0xc37b('0xbb')]=function(_0x18d673,_0x35ed5d){var _0x2455e2=fs[_0xc37b('0xbc')](_0x18d673['file'][_0xc37b('0x3')]);Papa[_0xc37b('0xbd')](_0x2455e2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x55e121){return _0x35ed5d[_0xc37b('0xf')](0xc8)[_0xc37b('0x10')]({'file':_0x18d673[_0xc37b('0xbe')],'fields':_0x55e121[_0xc37b('0xbf')][_0xc37b('0x7d')]});}});};exports['import']=function(_0x299587,_0x28353a){return db['User'][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc37b('0xc0')}})[_0xc37b('0x18')](function(_0x5966e7){var _0x106482=![];if(!_0x299587[_0xc37b('0x34')][_0xc37b('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x299587[_0xc37b('0x34')][_0xc37b('0xc1')][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x299587['body'][_0xc37b('0xc1')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x299587['body'][_0xc37b('0xc2')]){throw new Error(_0xc37b('0xaa'));}var _0x2f5c30=require(_0xc37b('0xb4'))[_0xc37b('0xb5')](path['join'](__dirname,_0xc37b('0xc3')),[_0x299587[_0xc37b('0x25')]['id'],JSON[_0xc37b('0xc4')](_0x299587[_0xc37b('0x34')]),JSON[_0xc37b('0xc4')](_0x5966e7)]);_0x2f5c30['on'](_0xc37b('0xc5'),function(){_0x106482=!![];return _0x28353a[_0xc37b('0xf')](0xc8)[_0xc37b('0x10')]({'message':_0xc37b('0xc6'),'pid':_0x2f5c30['pid']});});_0x2f5c30['on'](_0xc37b('0xc7'),function(_0xc0ff3b){if(_0xc0ff3b&&!_0x106482){return _0x28353a[_0xc37b('0xf')](0x1f4)[_0xc37b('0x10')]({'message':_0xc37b('0xc8'),'pid':_0x2f5c30[_0xc37b('0xb9')]});}});})[_0xc37b('0x22')](handleError(_0x28353a,null));};exports[_0xc37b('0xc9')]=function(_0x1c417d,_0x3dfb81){return db[_0xc37b('0xca')][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc37b('0xc0')}})['then'](function(_0x1808a0){var _0x1fc781=![];if(!_0x1c417d['body'][_0xc37b('0x5f')]){throw new Error(_0xc37b('0xa6'));}if(!_0x1c417d[_0xc37b('0x34')]['binding'][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x1c417d[_0xc37b('0x34')]['binding'][_0xc37b('0xcb')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1c417d[_0xc37b('0x34')][_0xc37b('0xc2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3cd718=require('child_process')[_0xc37b('0xb5')](path['join'](__dirname,_0xc37b('0xcc')),[_0x1c417d['params']['id'],JSON['stringify'](_0x1c417d[_0xc37b('0x34')]),JSON['stringify'](_0x1808a0)]);_0x3cd718['on']('message',function(){_0x1fc781=!![];return _0x3dfb81[_0xc37b('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x3cd718['pid']});});_0x3cd718['on'](_0xc37b('0xc7'),function(_0x4bb266){if(_0x4bb266&&!_0x1fc781){return _0x3dfb81[_0xc37b('0xf')](0x1f4)[_0xc37b('0x10')]({'message':'error\x20child\x20process','pid':_0x3cd718[_0xc37b('0xb9')]});}});})[_0xc37b('0x22')](handleError(_0x3dfb81,null));};exports['getJourney']=function(_0x3185b4,_0x8e5a3e){var _0x470996=[_0xc37b('0xcd'),_0xc37b('0xce'),_0xc37b('0xcf'),'openchannel',_0xc37b('0xd0'),_0xc37b('0xd1'),_0xc37b('0xd2')];var _0x4f5e8f={'offset':0x0,'order':qs['sort'](_0xc37b('0xd3'))},_0x1d5c1f={'count':0x0,'rows':[]};Promise[_0xc37b('0xd4')]()[_0xc37b('0x18')](function(){if(_0x3185b4[_0xc37b('0x2b')]['channel']){if(!_[_0xc37b('0xd5')](_0x470996,_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd6')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x470996=[_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd6')][_0xc37b('0xd7')]()];}if(_0x3185b4['query'][_0xc37b('0xd8')]){try{var _0x2064e=JSON['parse'](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd8')]);if(!moment(_0x2064e[_0xc37b('0x39')])[_0xc37b('0xd9')]()){throw new Error(_0xc37b('0xda'));}if(!moment(_0x2064e['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x929578){throw new Error(_0xc37b('0xdb'));}}if(!_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x61')]('nolimit')){_0x4f5e8f['limit']=qs['limit'](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x14')]||0xa);_0x4f5e8f['offset']=qs[_0xc37b('0x11')](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x11')]);}var _0x2a810=_0x470996[_0xc37b('0x82')](function(_0x3d98e2){if(_0x3d98e2==='voice'){var _0x4ad989={'attributes':['id','uniqueid',_0xc37b('0x30'),_0xc37b('0xdc'),_0xc37b('0xdd'),_0xc37b('0xde'),'starttime','endtime',_0xc37b('0xdf'),_0xc37b('0xe0'),_0xc37b('0xe1'),'userDisposition',_0xc37b('0xe2'),'userThirdDisposition',_0xc37b('0xe3')],'where':{'ContactId':_0x3185b4['params']['id']},'include':[{'model':db[_0xc37b('0xca')],'as':_0xc37b('0xca'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0xe4'),_0xc37b('0xe5')]}],'order':[[_0xc37b('0xe1'),_0xc37b('0xe6')]]};if(_0x3185b4['query'][_0xc37b('0xd8')]){_0x4ad989['where']['createdAt']={'$gte':_0x2064e[_0xc37b('0x39')],'$lte':_0x2064e['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4ad989)[_0xc37b('0x18')](function(_0x240176){_0x1d5c1f['count']+=_0x240176['count'];return _[_0xc37b('0x82')](_0x240176[_0xc37b('0xa3')],function(_0x12439d){var _0x2b3e19=_0x12439d['get']({'plain':!![]});_0x2b3e19['channel']=_0x3d98e2;if(_0x2b3e19[_0xc37b('0xca')]){_0x2b3e19['User']={'id':_0x2b3e19[_0xc37b('0xca')]['id'],'name':_0x2b3e19[_0xc37b('0xca')]['name'],'fullname':_0x2b3e19[_0xc37b('0xca')]['fullname'],'alias':_0x2b3e19[_0xc37b('0xca')][_0xc37b('0xe5')]};}return _0x2b3e19;});});}else{var _0x52be15=_['startCase'](_0x3d98e2)+(_0x3d98e2==='chat'?_0xc37b('0xe7'):'Account');var _0x4e91d4={'attributes':['id',_0xc37b('0xe8'),'closedAt','createdAt',_0xc37b('0xe0'),_0xc37b('0xe9'),_0xc37b('0xea'),_0xc37b('0xeb'),_0xc37b('0xe3'),_0x52be15+'Id'],'where':{'ContactId':_0x3185b4[_0xc37b('0x25')]['id']},'include':[{'model':db[_0x52be15],'as':_0xc37b('0xec'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0xed')]},{'model':db[_0xc37b('0xca')],'as':_0xc37b('0xee'),'attributes':['id','name',_0xc37b('0xe4')]},{'model':db[_0xc37b('0x65')],'as':_0xc37b('0x66'),'attributes':['id',_0xc37b('0x1c'),'color'],'through':{'attributes':[]}}],'order':[[_0xc37b('0xe1'),_0xc37b('0xe6')]]};if(_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd8')]){_0x4e91d4[_0xc37b('0x5e')][_0xc37b('0xe1')]={'$gte':_0x2064e['from'],'$lte':_0x2064e['to']};}switch(_0x3d98e2){case _0xc37b('0xce'):_0x4e91d4[_0xc37b('0x7e')][_0xc37b('0x5d')](_0xc37b('0xef'),_0xc37b('0xf0'),'customerPort',_0xc37b('0xf1'),_0xc37b('0xf2'),_0xc37b('0xf3'),'ratingType',_0xc37b('0xf4'),_0xc37b('0xf5'));break;case _0xc37b('0xcd'):_0x4e91d4[_0xc37b('0x7e')]['push'](_0xc37b('0xf6'),_0xc37b('0xf7'));break;case _0xc37b('0xf8'):_0x4e91d4[_0xc37b('0x7e')]['push'](_0xc37b('0xf9'),_0xc37b('0xfa'));break;}return db[_[_0xc37b('0xfb')](_0x3d98e2)+'Interaction']['findAndCountAll'](_0x4e91d4)[_0xc37b('0x18')](function(_0x4fb5c5){_0x1d5c1f[_0xc37b('0x13')]+=_0x4fb5c5[_0xc37b('0x13')];return _[_0xc37b('0x82')](_0x4fb5c5[_0xc37b('0xa3')],function(_0x72df41){var _0xb90297=_0x72df41[_0xc37b('0x35')]({'plain':!![]});_0xb90297[_0xc37b('0xd6')]=_0x3d98e2;if(_0xb90297['Owner']){_0xb90297[_0xc37b('0xee')]={'id':_0xb90297[_0xc37b('0xee')]['id'],'name':_0xb90297[_0xc37b('0xee')][_0xc37b('0x1c')],'fullname':_0xb90297[_0xc37b('0xee')][_0xc37b('0xe4')]};}return _0xb90297;});});}});return Promise[_0xc37b('0x63')](_0x2a810);})[_0xc37b('0x18')](function(_0x1c8014){return _(_0x1c8014)['flatten']()['sortBy'](_0xc37b('0xe1'))[_0xc37b('0xfc')]()['value']();})[_0xc37b('0x18')](function(_0x4e0bdb){_0x1d5c1f[_0xc37b('0xa3')]=_0x4f5e8f[_0xc37b('0x14')]?_0x4e0bdb[_0xc37b('0xfd')](_0x4f5e8f['offset'],_0x4f5e8f[_0xc37b('0x11')]+_0x4f5e8f['limit']):_0x4e0bdb;return _0x1d5c1f;})[_0xc37b('0x18')](respondWithFilteredResult(_0x8e5a3e,_0x4f5e8f))[_0xc37b('0x22')](handleError(_0x8e5a3e,null));}; \ No newline at end of file +var _0x78b4=['CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','server/files/tmp','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','file','path','parse','meta','User','agent','binding','No\x20phone\x20column\x20specified','fork','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','message','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20createdAt\x20filter','destination','callerid','endtime','note','userDisposition','userSecondDisposition','UserId','fullname','alias','createdAt','DESC','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerIp','deviceModel','ratingMessage','ratingType','subject','externalUrl','threadId','Interaction','findAndCountAll','Owner','flatten','reverse','value','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','register','status','offset','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','params','tags','keys','length','startsWith','cf_','displayName','analytics','columnName','custom','type','values','info','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','find','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','CmCustomField','map','format','cf_%d','omit','pickBy','isEmpty','table','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','`ItemType`.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','includeAll','include','rows','getHopperHistories'];(function(_0x106cd2,_0x9a3c43){var _0x2dd0f5=function(_0x4560a8){while(--_0x4560a8){_0x106cd2['push'](_0x106cd2['shift']());}};_0x2dd0f5(++_0x9a3c43);}(_0x78b4,0x158));var _0x478b=function(_0x55e7e7,_0x20e396){_0x55e7e7=_0x55e7e7-0x0;var _0xc800d3=_0x78b4[_0x55e7e7];return _0xc800d3;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x478b('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x478b('0x1'));var squel=require(_0x478b('0x2'));var Papa=require(_0x478b('0x3'));var Redis=require(_0x478b('0x4'));var contacts=require(_0x478b('0x5'));var qs=require(_0x478b('0x6'));var logger=require('../../config/logger')(_0x478b('0x7'));var config=require(_0x478b('0x8'));var shared=require(_0x478b('0x9'));var db=require(_0x478b('0xa'))['db'];config[_0x478b('0xb')]=_[_0x478b('0xc')](config[_0x478b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x478b('0xd'))(new Redis(config[_0x478b('0xb')]));require('./cmContact.socket')[_0x478b('0xe')](socket);function respondWithResult(_0x5ed7bb,_0x3641aa){_0x3641aa=_0x3641aa||0xc8;return function(_0x144697){if(_0x144697){return _0x5ed7bb[_0x478b('0xf')](_0x3641aa)['json'](_0x144697);}};}function respondWithFilteredResult(_0x3d6e27,_0xeb50f7){return function(_0x143769){if(_0x143769){var _0x254a7c=typeof _0xeb50f7[_0x478b('0x10')]==='undefined'&&typeof _0xeb50f7[_0x478b('0x11')]==='undefined';var _0xe77870=_0x143769[_0x478b('0x12')];var _0x1c5994=_0x254a7c?0x0:_0xeb50f7[_0x478b('0x10')];var _0x40d78c=_0x254a7c?_0x143769['count']:_0xeb50f7[_0x478b('0x10')]+_0xeb50f7[_0x478b('0x11')];var _0xd8abed;if(_0x40d78c>=_0xe77870){_0x40d78c=_0xe77870;_0xd8abed=0xc8;}else{_0xd8abed=0xce;}_0x3d6e27['status'](_0xd8abed);return _0x3d6e27[_0x478b('0x13')](_0x478b('0x14'),_0x1c5994+'-'+_0x40d78c+'/'+_0xe77870)[_0x478b('0x15')](_0x143769);}return null;};}function saveUpdates(_0x3d48f9){return function(_0x2ea150){if(_0x2ea150){return _0x2ea150[_0x478b('0x16')](_0x3d48f9)[_0x478b('0x17')](function(_0x31fe0c){return _0x31fe0c;});}return null;};}function removeEntity(_0x371c18){return function(_0x1ef435){if(_0x1ef435){return _0x1ef435[_0x478b('0x18')]()[_0x478b('0x17')](function(){_0x371c18[_0x478b('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2241){return function(_0x496543){if(!_0x496543){_0x1f2241['sendStatus'](0x194);}return _0x496543;};}function handleError(_0x834c22,_0x15d4ea){_0x15d4ea=_0x15d4ea||0x1f4;return function(_0x3904fd){logger[_0x478b('0x19')](_0x3904fd[_0x478b('0x1a')]);if(_0x3904fd[_0x478b('0x1b')]){delete _0x3904fd[_0x478b('0x1b')];}_0x834c22['status'](_0x15d4ea)[_0x478b('0x1c')](_0x3904fd);};}exports[_0x478b('0x1d')]=function(_0x504a1b,_0x4863ab){var _0xd58f7c={};return contacts[_0x478b('0x1e')]()[_0x478b('0x17')](function(_0x32caa8){_0xd58f7c=qs[_0x478b('0x1f')](_0x32caa8,_0x504a1b);return contacts[_0x478b('0x20')](_0x504a1b[_0x478b('0x21')],_0x504a1b[_0x478b('0x22')],_0xd58f7c,_0x32caa8);})[_0x478b('0x17')](respondWithFilteredResult(_0x4863ab,_0xd58f7c))[_0x478b('0x23')](handleError(_0x4863ab,null));};exports['destroy']=function(_0x2bbfba,_0x5e06eb){return db[_0x478b('0x24')]['find']({'where':{'id':_0x2bbfba[_0x478b('0x25')]['id']}})['then'](handleEntityNotFound(_0x5e06eb,null))[_0x478b('0x17')](removeEntity(_0x5e06eb,null))[_0x478b('0x23')](handleError(_0x5e06eb,null));};exports[_0x478b('0x1e')]=function(_0x1997a0,_0xd1da7d){return db[_0x478b('0x24')][_0x478b('0x1e')]()[_0x478b('0x17')](function(_0x445e34){delete _0x445e34[_0x478b('0x26')];for(var _0x34cce5=0x0;_0x34cce50x0){return new Promise(function(_0x2a18af){var _0x1c7e01=[];for(var _0x567456=0x0;_0x567456<_0x3e8e98[_0x478b('0x28')];_0x567456++){_0x1c7e01['push'](insertAdditionalPhones(_0x3e8e98[_0x567456]['contact'],_0x3e8e98[_0x567456][_0x478b('0x55')]));}Promise[_0x478b('0x5f')](_0x1c7e01)[_0x478b('0x17')](function(){_0x2a18af(0x1);});})['then'](function(){return{'success':_0x4e3a6d,'failure':_0x1708e1,'duplicates':_0x579106};});}else{return{'success':_0x4e3a6d,'failure':_0x1708e1,'duplicates':_0x579106};}}})['then'](respondWithResult(_0x4a4e0e,0xc9))[_0x478b('0x23')](handleError(_0x4a4e0e,null));};exports[_0x478b('0x60')]=function(_0x2c9b4e,_0x57caa8){var _0x28fcc5;return db[_0x478b('0x24')][_0x478b('0x1e')]()[_0x478b('0x17')](function(_0x4b9ac0){return db['CmContact'][_0x478b('0x61')]({'where':{'id':_0x2c9b4e[_0x478b('0x25')]['id']},'include':[{'model':db[_0x478b('0x62')],'as':_0x478b('0x63'),'attributes':['id',_0x478b('0x1b'),_0x478b('0x64')],'required':_0x2c9b4e[_0x478b('0x21')][_0x478b('0x65')]?!![]:![]},{'model':db[_0x478b('0x47')],'as':_0x478b('0x66'),'where':{'CmContactId':_0x2c9b4e[_0x478b('0x25')]['id']},'required':![],'include':[{'model':db[_0x478b('0x67')],'as':_0x478b('0x68')}]}],'order':[db[_0x478b('0x69')][_0x478b('0x6a')](_0x478b('0x6b'))],'attributes':_[_0x478b('0x27')](_0x4b9ac0)});})[_0x478b('0x17')](function(_0x21fb59){if(!_['isNil'](_0x21fb59)){_0x28fcc5=_0x21fb59[_0x478b('0x35')]({'plain':!![]});var _0xe3dbaa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x21fb59&&_0x21fb59['ListId']){if(_0x21fb59[_0x478b('0x5c')]){_0xe3dbaa[_0x478b('0x59')]['$and'][_0x478b('0x5b')]({'ListId':{'$ne':_0x21fb59[_0x478b('0x5c')]}});}}return db[_0x478b('0x6c')][_0x478b('0x20')](_0xe3dbaa);}})['then'](function(_0x54f4c4){if(!_[_0x478b('0x51')](_0x54f4c4)){return _['omit'](_0x28fcc5,_[_0x478b('0x6d')](_0x54f4c4,function(_0x162997){return util[_0x478b('0x6e')](_0x478b('0x6f'),_0x162997['id']);}));}})[_0x478b('0x17')](handleEntityNotFound(_0x57caa8,null))['then'](respondWithResult(_0x57caa8,null))['catch'](handleError(_0x57caa8,null));};exports[_0x478b('0x16')]=function(_0x3b4225,_0x1c9ba4){var _0x5db54a;if(_0x3b4225['body']['id']){delete _0x3b4225[_0x478b('0x34')]['id'];}if(!_[_0x478b('0x51')](_0x3b4225[_0x478b('0x34')][_0x478b('0x52')])){var _0x5a39df=_0x3b4225[_0x478b('0x34')][_0x478b('0x52')];if(!_[_0x478b('0x51')](shared[_0x478b('0x53')][_0x5a39df]))_0x3b4225['body'][_0x478b('0x54')]=shared[_0x478b('0x53')][_0x5a39df]['utcOffset'];}return db[_0x478b('0x24')][_0x478b('0x61')]({'where':{'id':_0x3b4225['params']['id']}})[_0x478b('0x17')](handleEntityNotFound(_0x1c9ba4,null))[_0x478b('0x17')](saveUpdates(_0x3b4225[_0x478b('0x34')],null))[_0x478b('0x17')](function(_0x2c274e){_0x5db54a=_0x2c274e;var _0x378a4c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2c274e&&_0x2c274e[_0x478b('0x5c')]){if(_0x2c274e[_0x478b('0x5c')]){_0x378a4c[_0x478b('0x59')]['$and'][_0x478b('0x5b')]({'ListId':{'$ne':_0x2c274e['ListId']}});}}return db[_0x478b('0x6c')][_0x478b('0x20')](_0x378a4c);})[_0x478b('0x17')](function(_0x4c20ca){if(_0x4c20ca){return _[_0x478b('0x70')](_[_0x478b('0x71')](_0x3b4225[_0x478b('0x34')],function(_0x42cb74,_0x19853a){return _['startsWith'](_0x19853a,_0x478b('0x2a'));}),_[_0x478b('0x6d')](_0x4c20ca,function(_0x45fcce){return util[_0x478b('0x6e')]('cf_%d',_0x45fcce['id']);}));}})[_0x478b('0x17')](function(_0x4865d9){if(_0x4865d9&&!_[_0x478b('0x72')](_0x4865d9)){var _0x47a9d0=squel[_0x478b('0x16')]()[_0x478b('0x73')]('cm_contacts')['setFields'](_0x4865d9)['where'](_0x478b('0x74'),_0x3b4225['params']['id'])[_0x478b('0x75')]();return db['sequelize'][_0x478b('0x21')](_0x47a9d0[_0x478b('0x76')],{'replacements':_0x47a9d0['values']});}})['then'](function(){if(_0x3b4225['body'][_0x478b('0x77')]&&_0x5db54a){return db[_0x478b('0x3a')][_0x478b('0x16')]({'phone':_0x3b4225[_0x478b('0x34')][_0x478b('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x5db54a['id']}});}})['then'](function(){return _0x5db54a;})['then'](respondWithResult(_0x1c9ba4,null))['catch'](handleError(_0x1c9ba4,null));};exports[_0x478b('0x78')]=function(_0x28fcf8,_0x35046c){var _0x3d8fee={};var _0x239309={};var _0x1f8e9d;var _0x43d3cf;return db[_0x478b('0x24')][_0x478b('0x79')]({'where':{'id':_0x28fcf8['params']['id']}})['then'](handleEntityNotFound(_0x35046c,null))['then'](function(_0x1413dd){if(_0x1413dd){_0x1f8e9d=_0x1413dd;_0x239309[_0x478b('0x7a')]=_[_0x478b('0x27')](db[_0x478b('0x62')]['rawAttributes']);_0x239309['query']=_[_0x478b('0x27')](_0x28fcf8[_0x478b('0x21')]);_0x239309[_0x478b('0x7b')]=_[_0x478b('0x7c')](_0x239309[_0x478b('0x7a')],_0x239309[_0x478b('0x21')]);_0x3d8fee[_0x478b('0x7d')]=_[_0x478b('0x7c')](_0x239309[_0x478b('0x7a')],qs[_0x478b('0x7e')](_0x28fcf8['query'][_0x478b('0x7e')]));_0x3d8fee[_0x478b('0x7d')]=_0x3d8fee[_0x478b('0x7d')][_0x478b('0x28')]?_0x3d8fee['attributes']:_0x239309[_0x478b('0x7a')];_0x3d8fee[_0x478b('0x7f')]=qs[_0x478b('0x80')](_0x28fcf8[_0x478b('0x21')][_0x478b('0x80')]);_0x3d8fee['where']=qs[_0x478b('0x7b')](_[_0x478b('0x81')](_0x28fcf8[_0x478b('0x21')],_0x239309['filters']));if(_0x28fcf8[_0x478b('0x21')][_0x478b('0x82')]){_0x3d8fee[_0x478b('0x59')]=_['merge'](_0x3d8fee[_0x478b('0x59')],{'$or':_[_0x478b('0x6d')](_0x3d8fee[_0x478b('0x7d')],function(_0x20d45d){var _0x1f2ede={};_0x1f2ede[_0x20d45d]={'$like':'%'+_0x28fcf8['query'][_0x478b('0x82')]+'%'};return _0x1f2ede;})});}_0x3d8fee=_[_0x478b('0x33')]({},_0x3d8fee,_0x28fcf8[_0x478b('0x83')]);return _0x1f8e9d['getTags'](_0x3d8fee);}})[_0x478b('0x17')](function(_0x59dd8e){if(_0x59dd8e){_0x43d3cf=_0x59dd8e[_0x478b('0x28')];if(!_0x28fcf8[_0x478b('0x21')][_0x478b('0x32')](_0x478b('0x84'))){_0x3d8fee[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x28fcf8[_0x478b('0x21')][_0x478b('0x11')]);_0x3d8fee[_0x478b('0x10')]=qs['offset'](_0x28fcf8[_0x478b('0x21')][_0x478b('0x10')]);}return _0x1f8e9d[_0x478b('0x78')](_0x3d8fee);}})[_0x478b('0x17')](function(_0x3ebc8a){if(_0x3ebc8a){return _0x3ebc8a?{'count':_0x43d3cf,'rows':_0x3ebc8a}:null;}})[_0x478b('0x17')](respondWithResult(_0x35046c,null))['catch'](handleError(_0x35046c,null));};exports[_0x478b('0x85')]=function(_0x43f12e,_0x5dfe40){if(_0x43f12e[_0x478b('0x34')]['id']){delete _0x43f12e['body']['id'];}return db[_0x478b('0x24')][_0x478b('0x79')]({'where':{'id':_0x43f12e[_0x478b('0x25')]['id']}})[_0x478b('0x17')](handleEntityNotFound(_0x5dfe40,null))['then'](function(_0x2655ad){if(_0x2655ad){return _0x2655ad['setTags'](_0x43f12e['body'][_0x478b('0x86')]||[]);}return null;})[_0x478b('0x17')](respondWithResult(_0x5dfe40,null))[_0x478b('0x23')](handleError(_0x5dfe40,null));};exports[_0x478b('0x87')]=function(_0x484aaa,_0xeb83f3){var _0x2cce35=[];_0x2cce35['push'](addAdditionalPhones(_0x484aaa['body']));Promise['all'](_0x2cce35)[_0x478b('0x17')](function(){_0x2cce35=[];_0x2cce35[_0x478b('0x5b')](deleteCmHopperPhones(_0x484aaa[_0x478b('0x34')]['id']));_0x2cce35[_0x478b('0x5b')](addCmHopperPhones(_0x484aaa[_0x478b('0x34')]['id']));Promise['all'](_0x2cce35)[_0x478b('0x17')](function(){return[0x1];})[_0x478b('0x17')](respondWithResult(_0xeb83f3,null));});};function addAdditionalPhones(_0x216928){var _0x3efcac;return new Promise(function(_0x5150a8){return db[_0x478b('0x47')][_0x478b('0x18')]({'where':{'CmContactId':_0x216928['id']}})['then'](function(){db[_0x478b('0x67')][_0x478b('0x20')]({'raw':!![],'attributes':['id',_0x478b('0x88')]})['then'](function(_0x3738fc){var _0x42d045=[];for(var _0x136cc9=0x0;_0x136cc9<_0x216928[_0x478b('0x89')][_0x478b('0x28')];_0x136cc9++){var _0x245190=_0x216928['item_types']?_[_0x478b('0x51')](_0x216928[_0x478b('0x8a')][_0x136cc9])?'':_0x216928['item_types'][_0x136cc9]:_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x8b')]?_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x8b')]:'';var _0x425363=_[_0x478b('0x51')](_0x216928['items'][_0x136cc9]['description'])?'':_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x8c')];var _0x1e8887=_0x245190+':'+_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x77')]+'§'+_0x425363;if(_[_0x478b('0x51')](_0x3efcac))_0x3efcac=_0x1e8887;else _0x3efcac+=';'+_0x1e8887;var _0x13fc1f=null;var _0x263833=null;if(_0x216928[_0x478b('0x8a')]){if(!_[_0x478b('0x51')](_0x216928['item_types'][_0x136cc9])){_0x263833=_[_0x478b('0x61')](_0x3738fc,function(_0x335bc8){return _0x335bc8['id']===_0x216928['item_types'][_0x136cc9];});if(!_[_0x478b('0x51')](_0x263833)){_0x13fc1f=_0x263833[_0x478b('0x88')];}}}else{if(!_[_0x478b('0x51')](_0x216928['items'][_0x136cc9])){_0x263833=_[_0x478b('0x61')](_0x3738fc,function(_0x222003){return _0x222003['id']===_0x216928['items'][_0x136cc9][_0x478b('0x8b')];});if(!_['isNil'](_0x263833)){_0x13fc1f=_0x136cc9;}}}if(_[_0x478b('0x51')](_0x13fc1f)){_0x13fc1f=0x64;}_0x42d045[_0x478b('0x5b')](addAdditionalPhone(_0x216928['id'],_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x77')],_0x216928['item_types']?_[_0x478b('0x51')](_0x216928[_0x478b('0x8a')][_0x136cc9])?null:_0x216928[_0x478b('0x8a')][_0x136cc9]:_0x216928[_0x478b('0x89')][_0x136cc9][_0x478b('0x8b')]?_0x216928['items'][_0x136cc9][_0x478b('0x8b')]:null,_0x13fc1f,_0x425363));}Promise['all'](_0x42d045)[_0x478b('0x17')](function(){db[_0x478b('0x24')][_0x478b('0x16')]({'AdditionalPhones':_0x3efcac},{'where':{'id':_0x216928['id']}})[_0x478b('0x17')](function(){_0x5150a8(0x1);});});});});});}function addAdditionalPhone(_0x17c8a1,_0x477d3b,_0x1dc88e,_0x29c98a,_0x2b7dce){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x17c8a1,'item':_0x477d3b}})[_0x478b('0x17')](function(_0x5ca537){if(_0x5ca537)logger[_0x478b('0x31')](_0x478b('0x8d'),_0x5ca537);else{db[_0x478b('0x47')]['create']({'CmContactId':_0x17c8a1,'item':_0x477d3b,'ItemTypeId':_0x1dc88e,'OrderBy':_0x29c98a,'ItemClass':_0x478b('0x8e'),'description':_0x2b7dce});}});}function deleteCmHopperPhones(_0x157f5a){return new Promise(function(_0x3fd430){return db[_0x478b('0x3a')][_0x478b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x157f5a}})[_0x478b('0x17')](function(_0x68e4a1){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x478b('0x6d')](_0x68e4a1,'id')}}});})['then'](function(){_0x3fd430(0x1);});});}function addCmHopperPhones(_0x4696cf){return new Promise(function(_0x3edc60){return db[_0x478b('0x3a')][_0x478b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4696cf}})[_0x478b('0x17')](function(_0x105353){var _0x83e16e=[];_[_0x478b('0x6d')](_0x105353,function(_0xc58b8e){_0x83e16e['push'](createCmHopperPhone(_0x4696cf,_0xc58b8e['id']));});Promise[_0x478b('0x5f')](_0x83e16e)[_0x478b('0x17')](function(){_0x3edc60(0x1);});});});}function createCmHopperPhone(_0x4384e3,_0x553efa){return new Promise(function(_0x4d7903){db[_0x478b('0x47')][_0x478b('0x20')]({'raw':!![],'attributes':[_0x478b('0x8f'),_0x478b('0x88')],'where':{'CmContactId':_0x4384e3,'ItemClass':_0x478b('0x8e')},'include':[{'model':db['ContactItemType'],'attributes':[_0x478b('0x88')],'as':_0x478b('0x68')}],'order':['OrderBy',db[_0x478b('0x69')][_0x478b('0x6a')](_0x478b('0x90'))]})[_0x478b('0x17')](function(_0x2e307c){var _0x457a30=0x1;var _0x469f66=_['map'](_0x2e307c,function(_0x1b69f3){_0x1b69f3['CmHopperId']=_0x553efa;_0x1b69f3[_0x478b('0x77')]=_0x1b69f3[_0x478b('0x8f')];_0x1b69f3[_0x478b('0x88')]=_0x457a30;delete _0x1b69f3['ItemType.OrderBy'];_0x457a30=_0x457a30+0x1;return _0x1b69f3;});return db['CmHopperAdditionalPhone'][_0x478b('0x56')](_0x469f66,{});})[_0x478b('0x17')](function(){_0x4d7903(0x1);});});}function insertAdditionalPhones(_0x446b66,_0x5eae8e){return new Promise(function(_0x552dfd){var _0x189f68=[];for(var _0x17ca1a=0x0;_0x17ca1a<_0x5eae8e[_0x478b('0x28')];_0x17ca1a++){var _0x537276=_0x5eae8e[_0x17ca1a];_0x189f68[_0x478b('0x5b')](parseContactItemType(_0x537276));}Promise[_0x478b('0x5f')](_0x189f68)['then'](function(){var _0x1383de={'id':_0x446b66['id'],'items':_0x5eae8e};return addAdditionalPhones(_0x1383de)['then'](function(){return addCmHopperPhones(_0x446b66['id']);});})[_0x478b('0x17')](function(){_0x552dfd(_0x446b66);});});}function parseContactItemType(_0x2366c3){return new Promise(function(_0x2c0f99){if(_0x2366c3['hasOwnProperty'](_0x478b('0x8b'))){_0x2c0f99(_0x2366c3);}else{return db[_0x478b('0x67')][_0x478b('0x61')]({'where':{'name':_0x2366c3[_0x478b('0x68')]}})[_0x478b('0x17')](function(_0x41f179){if(_[_0x478b('0x51')](_0x41f179))_0x2366c3[_0x478b('0x8b')]=null;else _0x2366c3[_0x478b('0x8b')]=_0x41f179['id'];_0x2c0f99(_0x2366c3);});}});}exports[_0x478b('0x91')]=function(_0x3287ca,_0x5e9bda){return db[_0x478b('0x47')][_0x478b('0x20')]({'raw':!![],'where':{'CmContactId':_0x3287ca[_0x478b('0x25')]['id'],'ItemClass':_0x478b('0x8e')},'include':[{'model':db[_0x478b('0x67')],'as':'ItemType'}],'order':[[_0x478b('0x88')],[db[_0x478b('0x69')][_0x478b('0x6a')](_0x478b('0x90'))]]})[_0x478b('0x17')](function(_0xa478ec){return _0xa478ec;})[_0x478b('0x17')](respondWithResult(_0x5e9bda,null))[_0x478b('0x23')](handleError(_0x5e9bda,null));};exports[_0x478b('0x92')]=function(_0x2f9036,_0xfad762){return db[_0x478b('0x47')][_0x478b('0x20')]({'raw':!![],'where':{'CmContactId':_0x2f9036[_0x478b('0x34')][_0x478b('0x93')]}})[_0x478b('0x17')](function(_0x177bec){var _0x20934c=_[_0x478b('0x6d')](_0x177bec,function(_0x304e13){_0x304e13['CmContactId']=_0x2f9036[_0x478b('0x34')]['toContactId'];return _0x304e13;});return db[_0x478b('0x47')][_0x478b('0x56')](_0x20934c,{});})[_0x478b('0x17')](function(){return addCmHopperPhones(_0x2f9036[_0x478b('0x34')][_0x478b('0x94')]);})[_0x478b('0x17')](function(){return['ok'];})[_0x478b('0x17')](respondWithResult(_0xfad762,null))[_0x478b('0x23')](handleError(_0xfad762,null));};exports[_0x478b('0x95')]=function(_0x312c16,_0x31b8b4){var _0x33bb2c=[];_0x33bb2c[_0x478b('0x5b')](createCmHopperPhone(_0x312c16[_0x478b('0x34')]['id'],_0x312c16[_0x478b('0x34')][_0x478b('0x96')]));Promise[_0x478b('0x5f')](_0x33bb2c)[_0x478b('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x31b8b4,null));};exports[_0x478b('0x97')]=function(_0x524eb5,_0x4c518c){var _0x5c1a6d={'raw':![],'where':{}};var _0x435006={};var _0x299fe5={'count':0x0,'rows':[]};return db[_0x478b('0x24')][_0x478b('0x79')]({'where':{'id':_0x524eb5[_0x478b('0x25')]['id']}})[_0x478b('0x17')](handleEntityNotFound(_0x4c518c,null))[_0x478b('0x17')](function(_0x76c0ce){if(_0x76c0ce){_0x435006['model']=_['keys'](db[_0x478b('0x3a')][_0x478b('0x98')]);_0x435006[_0x478b('0x21')]=_['keys'](_0x524eb5[_0x478b('0x21')]);_0x435006[_0x478b('0x7b')]=_[_0x478b('0x7c')](_0x435006[_0x478b('0x7a')],_0x435006[_0x478b('0x21')]);_0x5c1a6d[_0x478b('0x7d')]=_[_0x478b('0x7c')](_0x435006[_0x478b('0x7a')],qs['fields'](_0x524eb5['query']['fields']));_0x5c1a6d['attributes']=_0x5c1a6d[_0x478b('0x7d')][_0x478b('0x28')]?_0x5c1a6d['attributes']:_0x435006[_0x478b('0x7a')];if(!_0x524eb5[_0x478b('0x21')][_0x478b('0x32')]('nolimit')){_0x5c1a6d[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x524eb5[_0x478b('0x21')][_0x478b('0x11')]);_0x5c1a6d[_0x478b('0x10')]=qs['offset'](_0x524eb5[_0x478b('0x21')]['offset']);}_0x5c1a6d[_0x478b('0x7f')]=qs[_0x478b('0x80')](_0x524eb5['query']['sort']);_0x5c1a6d[_0x478b('0x59')]=qs[_0x478b('0x7b')](_[_0x478b('0x81')](_0x524eb5['query'],_0x435006[_0x478b('0x7b')]));_0x5c1a6d[_0x478b('0x59')][_0x478b('0x99')]=_0x76c0ce['id'];if(_0x524eb5[_0x478b('0x21')]['filter']){_0x5c1a6d[_0x478b('0x59')]=_[_0x478b('0x33')](_0x5c1a6d['where'],{'$or':_[_0x478b('0x6d')](_0x5c1a6d['attributes'],function(_0x4a57a2){var _0x2f48f9={};_0x2f48f9[_0x4a57a2]={'$like':'%'+_0x524eb5[_0x478b('0x21')][_0x478b('0x82')]+'%'};return _0x2f48f9;})});}_0x5c1a6d=_[_0x478b('0x33')]({},_0x5c1a6d,_0x524eb5[_0x478b('0x83')]);return db[_0x478b('0x3a')][_0x478b('0x12')]({'where':_0x5c1a6d[_0x478b('0x59')]})[_0x478b('0x17')](function(_0x2d0415){_0x299fe5[_0x478b('0x12')]=_0x2d0415;if(_0x524eb5[_0x478b('0x21')][_0x478b('0x9a')]){_0x5c1a6d[_0x478b('0x9b')]=[{'all':!![]}];}return db['CmHopper'][_0x478b('0x20')](_0x5c1a6d);})[_0x478b('0x17')](function(_0x3c476d){_0x299fe5[_0x478b('0x9c')]=_0x3c476d;return _0x299fe5;});}})[_0x478b('0x17')](respondWithFilteredResult(_0x4c518c,_0x5c1a6d))[_0x478b('0x23')](handleError(_0x4c518c,null));};exports[_0x478b('0x9d')]=function(_0x284095,_0x19142b){var _0x469902={'raw':!![],'where':{}};var _0x11fddd={};var _0x3c595b={'count':0x0,'rows':[]};return db[_0x478b('0x24')]['findOne']({'where':{'id':_0x284095['params']['id']}})['then'](handleEntityNotFound(_0x19142b,null))[_0x478b('0x17')](function(_0x14e4d9){if(_0x14e4d9){_0x11fddd['model']=_[_0x478b('0x27')](db[_0x478b('0x9e')]['rawAttributes']);_0x11fddd[_0x478b('0x21')]=_['keys'](_0x284095[_0x478b('0x21')]);_0x11fddd[_0x478b('0x7b')]=_[_0x478b('0x7c')](_0x11fddd[_0x478b('0x7a')],_0x11fddd[_0x478b('0x21')]);_0x469902[_0x478b('0x7d')]=_[_0x478b('0x7c')](_0x11fddd[_0x478b('0x7a')],qs['fields'](_0x284095[_0x478b('0x21')][_0x478b('0x7e')]));_0x469902['attributes']=_0x469902['attributes'][_0x478b('0x28')]?_0x469902[_0x478b('0x7d')]:_0x11fddd[_0x478b('0x7a')];if(!_0x284095[_0x478b('0x21')][_0x478b('0x32')](_0x478b('0x84'))){_0x469902[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x284095[_0x478b('0x21')][_0x478b('0x11')]);_0x469902[_0x478b('0x10')]=qs[_0x478b('0x10')](_0x284095[_0x478b('0x21')][_0x478b('0x10')]);}_0x469902[_0x478b('0x7f')]=qs[_0x478b('0x80')](_0x284095[_0x478b('0x21')][_0x478b('0x80')]);_0x469902[_0x478b('0x59')]=qs[_0x478b('0x7b')](_[_0x478b('0x81')](_0x284095[_0x478b('0x21')],_0x11fddd[_0x478b('0x7b')]));_0x469902[_0x478b('0x59')][_0x478b('0x99')]=_0x14e4d9['id'];if(_0x284095[_0x478b('0x21')][_0x478b('0x82')]){_0x469902[_0x478b('0x59')]=_[_0x478b('0x33')](_0x469902[_0x478b('0x59')],{'$or':_[_0x478b('0x6d')](_0x469902[_0x478b('0x7d')],function(_0x3c9c0f){var _0x5729ff={};_0x5729ff[_0x3c9c0f]={'$like':'%'+_0x284095[_0x478b('0x21')][_0x478b('0x82')]+'%'};return _0x5729ff;})});}_0x469902=_[_0x478b('0x33')]({},_0x469902,_0x284095['options']);return db[_0x478b('0x9e')][_0x478b('0x12')]({'where':_0x469902[_0x478b('0x59')]})[_0x478b('0x17')](function(_0x51c739){_0x3c595b[_0x478b('0x12')]=_0x51c739;if(_0x284095[_0x478b('0x21')]['includeAll']){_0x469902['include']=[{'all':!![]}];}return db[_0x478b('0x9e')][_0x478b('0x20')](_0x469902);})[_0x478b('0x17')](function(_0x4d2e4b){_0x3c595b[_0x478b('0x9c')]=_0x4d2e4b;return _0x3c595b;});}})[_0x478b('0x17')](respondWithFilteredResult(_0x19142b,_0x469902))['catch'](handleError(_0x19142b,null));};exports[_0x478b('0x9f')]=function(_0x2911a8,_0x1432da){var _0x3dad18={'raw':!![],'where':{}};var _0x425e53={};var _0x1f898={'count':0x0,'rows':[]};return db['CmContact'][_0x478b('0x79')]({'where':{'id':_0x2911a8[_0x478b('0x25')]['id']}})[_0x478b('0x17')](handleEntityNotFound(_0x1432da,null))[_0x478b('0x17')](function(_0x5c8336){if(_0x5c8336){_0x425e53[_0x478b('0x7a')]=_[_0x478b('0x27')](db[_0x478b('0xa0')][_0x478b('0x98')]);_0x425e53['query']=_[_0x478b('0x27')](_0x2911a8['query']);_0x425e53[_0x478b('0x7b')]=_[_0x478b('0x7c')](_0x425e53[_0x478b('0x7a')],_0x425e53[_0x478b('0x21')]);_0x3dad18['attributes']=_[_0x478b('0x7c')](_0x425e53[_0x478b('0x7a')],qs[_0x478b('0x7e')](_0x2911a8[_0x478b('0x21')][_0x478b('0x7e')]));_0x3dad18[_0x478b('0x7d')]=_0x3dad18[_0x478b('0x7d')][_0x478b('0x28')]?_0x3dad18[_0x478b('0x7d')]:_0x425e53[_0x478b('0x7a')];if(!_0x2911a8[_0x478b('0x21')][_0x478b('0x32')](_0x478b('0x84'))){_0x3dad18[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x2911a8['query'][_0x478b('0x11')]);_0x3dad18[_0x478b('0x10')]=qs[_0x478b('0x10')](_0x2911a8[_0x478b('0x21')][_0x478b('0x10')]);}_0x3dad18[_0x478b('0x7f')]=qs[_0x478b('0x80')](_0x2911a8[_0x478b('0x21')]['sort']);_0x3dad18[_0x478b('0x59')]=qs[_0x478b('0x7b')](_[_0x478b('0x81')](_0x2911a8['query'],_0x425e53['filters']));_0x3dad18[_0x478b('0x59')][_0x478b('0x99')]=_0x5c8336['id'];if(_0x2911a8[_0x478b('0x21')][_0x478b('0x82')]){_0x3dad18['where']=_[_0x478b('0x33')](_0x3dad18['where'],{'$or':_[_0x478b('0x6d')](_0x3dad18[_0x478b('0x7d')],function(_0x4dec56){var _0x7c767e={};_0x7c767e[_0x4dec56]={'$like':'%'+_0x2911a8[_0x478b('0x21')][_0x478b('0x82')]+'%'};return _0x7c767e;})});}_0x3dad18=_[_0x478b('0x33')]({},_0x3dad18,_0x2911a8[_0x478b('0x83')]);return db['CmHopperFinal']['count']({'where':_0x3dad18[_0x478b('0x59')]})['then'](function(_0x45b9ca){_0x1f898[_0x478b('0x12')]=_0x45b9ca;if(_0x2911a8['query'][_0x478b('0x9a')]){_0x3dad18[_0x478b('0x9b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3dad18);})[_0x478b('0x17')](function(_0x939387){_0x1f898[_0x478b('0x9c')]=_0x939387;return _0x1f898;});}})[_0x478b('0x17')](respondWithFilteredResult(_0x1432da,_0x3dad18))['catch'](handleError(_0x1432da,null));};exports[_0x478b('0xa1')]=function(_0x6254dc,_0x5eeb75){var _0x26ead2={'raw':!![],'where':{}};var _0x1b687d={};var _0x1fd84c={'count':0x0,'rows':[]};return db[_0x478b('0x24')]['findOne']({'where':{'id':_0x6254dc[_0x478b('0x25')]['id']}})[_0x478b('0x17')](handleEntityNotFound(_0x5eeb75,null))[_0x478b('0x17')](function(_0x3ade99){if(_0x3ade99){_0x1b687d['model']=_[_0x478b('0x27')](db[_0x478b('0x4e')][_0x478b('0x98')]);_0x1b687d[_0x478b('0x21')]=_[_0x478b('0x27')](_0x6254dc[_0x478b('0x21')]);_0x1b687d[_0x478b('0x7b')]=_['intersection'](_0x1b687d[_0x478b('0x7a')],_0x1b687d[_0x478b('0x21')]);_0x26ead2[_0x478b('0x7d')]=_['intersection'](_0x1b687d[_0x478b('0x7a')],qs[_0x478b('0x7e')](_0x6254dc[_0x478b('0x21')][_0x478b('0x7e')]));_0x26ead2[_0x478b('0x7d')]=_0x26ead2['attributes']['length']?_0x26ead2[_0x478b('0x7d')]:_0x1b687d[_0x478b('0x7a')];if(!_0x6254dc[_0x478b('0x21')][_0x478b('0x32')]('nolimit')){_0x26ead2[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x6254dc['query']['limit']);_0x26ead2[_0x478b('0x10')]=qs['offset'](_0x6254dc['query']['offset']);}_0x26ead2[_0x478b('0x7f')]=qs[_0x478b('0x80')](_0x6254dc[_0x478b('0x21')][_0x478b('0x80')]);_0x26ead2[_0x478b('0x59')]=qs[_0x478b('0x7b')](_[_0x478b('0x81')](_0x6254dc[_0x478b('0x21')],_0x1b687d[_0x478b('0x7b')]));_0x26ead2[_0x478b('0x59')][_0x478b('0x99')]=_0x3ade99['id'];if(_0x6254dc['query'][_0x478b('0x82')]){_0x26ead2['where']=_[_0x478b('0x33')](_0x26ead2[_0x478b('0x59')],{'$or':_[_0x478b('0x6d')](_0x26ead2[_0x478b('0x7d')],function(_0x125168){var _0x52f5f9={};_0x52f5f9[_0x125168]={'$like':'%'+_0x6254dc[_0x478b('0x21')]['filter']+'%'};return _0x52f5f9;})});}_0x26ead2=_[_0x478b('0x33')]({},_0x26ead2,_0x6254dc[_0x478b('0x83')]);return db[_0x478b('0x4e')][_0x478b('0x12')]({'where':_0x26ead2[_0x478b('0x59')]})[_0x478b('0x17')](function(_0x4510b6){_0x1fd84c[_0x478b('0x12')]=_0x4510b6;if(_0x6254dc[_0x478b('0x21')][_0x478b('0x9a')]){_0x26ead2['include']=[{'all':!![]}];}return db[_0x478b('0x4e')]['findAll'](_0x26ead2);})[_0x478b('0x17')](function(_0x4a80bf){_0x1fd84c[_0x478b('0x9c')]=_0x4a80bf;return _0x1fd84c;});}})[_0x478b('0x17')](respondWithFilteredResult(_0x5eeb75,_0x26ead2))[_0x478b('0x23')](handleError(_0x5eeb75,null));};exports[_0x478b('0xa2')]=function(_0x46290c,_0x55bd2b){try{if(!_0x46290c[_0x478b('0x34')][_0x478b('0x5c')]){throw new Error(_0x478b('0xa3'));}if(!_0x46290c[_0x478b('0x34')]['binding_keys']){throw new Error(_0x478b('0xa4'));}if(!_0x46290c['body'][_0x478b('0xa5')]){throw new Error(_0x478b('0xa6'));}if(!_0x46290c[_0x478b('0x34')][_0x478b('0xa7')]){throw new Error(_0x478b('0xa8'));}var _0x410349=_0x46290c['body'][_0x478b('0xa9')][_0x478b('0xaa')](',');var _0x14d72f=_0x46290c['body'][_0x478b('0xa5')]['split'](',');if(!_0x410349[_0x478b('0x28')]||!_0x14d72f[_0x478b('0x28')]||_0x410349[_0x478b('0x28')]!==_0x14d72f['length']){throw new Error(_0x478b('0xab'));}_0x46290c[_0x478b('0x34')]['fields']=_[_0x478b('0xac')](_0x410349,_0x14d72f);if(!_0x46290c['body'][_0x478b('0x7e')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x46290c['body'][_0x478b('0x7e')][_0x478b('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2dc44d=path['join'](config['root'],_0x478b('0xae'),_0x46290c['file'][_0x478b('0xaf')]);fs[_0x478b('0xb0')](_0x2dc44d,parseInt(_0x478b('0xb1'),0x8));var _0x59f275=require(_0x478b('0xb2'))['fork'](path[_0x478b('0x38')](__dirname,_0x478b('0xb3')),[_0x2dc44d,_0x46290c[_0x478b('0x34')][_0x478b('0xa9')],_0x46290c['body'][_0x478b('0xa5')],_0x46290c[_0x478b('0x34')]['ListId'],_0x46290c[_0x478b('0x34')][_0x478b('0xb4')],_0x46290c[_0x478b('0x34')][_0x478b('0x58')],_0x46290c['body'][_0x478b('0xa7')]]);return _0x55bd2b[_0x478b('0xf')](0xc8)[_0x478b('0x15')]({'message':_0x478b('0xb5'),'pid':_0x59f275['pid']});}catch(_0x2062d1){return _0x55bd2b[_0x478b('0xf')](0x1f4)[_0x478b('0x1c')](_0x2062d1);}};exports['upload']=function(_0x502dec,_0x48ffcc){var _0x2db10c=fs[_0x478b('0xb6')](_0x502dec[_0x478b('0xb7')][_0x478b('0xb8')]);Papa[_0x478b('0xb9')](_0x2db10c,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x38d70f){return _0x48ffcc['status'](0xc8)[_0x478b('0x15')]({'file':_0x502dec['file'],'fields':_0x38d70f[_0x478b('0xba')][_0x478b('0x7e')]});}});};exports['import']=function(_0x52c51f,_0x1e4eb2){return db[_0x478b('0xbb')][_0x478b('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x478b('0xbc')}})[_0x478b('0x17')](function(_0x53e69d){var _0x5ed43a=![];if(!_0x52c51f[_0x478b('0x34')][_0x478b('0x5c')]){throw new Error(_0x478b('0xa3'));}if(!_0x52c51f[_0x478b('0x34')][_0x478b('0xbd')][_0x478b('0x77')]){throw new Error(_0x478b('0xbe'));}if(!_0x52c51f[_0x478b('0x34')][_0x478b('0xbd')][_0x478b('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x52c51f[_0x478b('0x34')][_0x478b('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3526a6=require('child_process')[_0x478b('0xbf')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x52c51f[_0x478b('0x25')]['id'],JSON[_0x478b('0xc0')](_0x52c51f[_0x478b('0x34')]),JSON[_0x478b('0xc0')](_0x53e69d)]);_0x3526a6['on']('message',function(){_0x5ed43a=!![];return _0x1e4eb2['status'](0xc8)[_0x478b('0x15')]({'message':_0x478b('0xc1'),'pid':_0x3526a6[_0x478b('0xc2')]});});_0x3526a6['on'](_0x478b('0xc3'),function(_0x51a846){if(_0x51a846&&!_0x5ed43a){return _0x1e4eb2[_0x478b('0xf')](0x1f4)['json']({'message':_0x478b('0xc4'),'pid':_0x3526a6['pid']});}});})[_0x478b('0x23')](handleError(_0x1e4eb2,null));};exports[_0x478b('0xc5')]=function(_0x434806,_0x11b7f){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x478b('0xbc')}})[_0x478b('0x17')](function(_0x35359c){var _0x296636=![];if(!_0x434806[_0x478b('0x34')][_0x478b('0x5c')]){throw new Error(_0x478b('0xa3'));}if(!_0x434806[_0x478b('0x34')]['binding']['phone']){throw new Error(_0x478b('0xbe'));}if(!_0x434806[_0x478b('0x34')][_0x478b('0xbd')][_0x478b('0xad')]){throw new Error(_0x478b('0xc6'));}if(!_0x434806[_0x478b('0x34')]['socket_timestamp']){throw new Error(_0x478b('0xa8'));}var _0x4eff19=require('child_process')['fork'](path[_0x478b('0x38')](__dirname,_0x478b('0xc7')),[_0x434806[_0x478b('0x25')]['id'],JSON[_0x478b('0xc0')](_0x434806[_0x478b('0x34')]),JSON[_0x478b('0xc0')](_0x35359c)]);_0x4eff19['on'](_0x478b('0xc8'),function(){_0x296636=!![];return _0x11b7f[_0x478b('0xf')](0xc8)[_0x478b('0x15')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4eff19[_0x478b('0xc2')]});});_0x4eff19['on'](_0x478b('0xc3'),function(_0x47c982){if(_0x47c982&&!_0x296636){return _0x11b7f[_0x478b('0xf')](0x1f4)[_0x478b('0x15')]({'message':_0x478b('0xc4'),'pid':_0x4eff19[_0x478b('0xc2')]});}});})[_0x478b('0x23')](handleError(_0x11b7f,null));};exports['getJourney']=function(_0x5d96f0,_0x5d046e){var _0x184238=[_0x478b('0xc9'),_0x478b('0xca'),_0x478b('0xcb'),_0x478b('0xcc'),_0x478b('0xcd'),_0x478b('0xce'),_0x478b('0xcf')];var _0x25a6c9={'offset':0x0,'order':qs['sort'](_0x478b('0xd0'))},_0x5ba3f6={'count':0x0,'rows':[]};Promise[_0x478b('0xd1')]()[_0x478b('0x17')](function(){if(_0x5d96f0[_0x478b('0x21')]['channel']){if(!_[_0x478b('0xd2')](_0x184238,_0x5d96f0[_0x478b('0x21')][_0x478b('0xd3')][_0x478b('0xd4')]())){throw new Error(_0x478b('0xd5'));}_0x184238=[_0x5d96f0[_0x478b('0x21')][_0x478b('0xd3')][_0x478b('0xd4')]()];}if(_0x5d96f0['query'][_0x478b('0xd6')]){try{var _0xf7e1d2=JSON['parse'](_0x5d96f0[_0x478b('0x21')][_0x478b('0xd6')]);if(!moment(_0xf7e1d2[_0x478b('0x3b')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0xf7e1d2['to'])[_0x478b('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x68a31e){throw new Error(_0x478b('0xd8'));}}if(!_0x5d96f0[_0x478b('0x21')][_0x478b('0x32')](_0x478b('0x84'))){_0x25a6c9[_0x478b('0x11')]=qs[_0x478b('0x11')](_0x5d96f0[_0x478b('0x21')]['limit']||0xa);_0x25a6c9['offset']=qs['offset'](_0x5d96f0[_0x478b('0x21')][_0x478b('0x10')]);}var _0x372e4a=_0x184238['map'](function(_0x40cfb7){if(_0x40cfb7===_0x478b('0xcf')){var _0xb15b83={'attributes':['id','uniqueid',_0x478b('0x2f'),'source',_0x478b('0xd9'),_0x478b('0xda'),'starttime',_0x478b('0xdb'),'duration',_0x478b('0xdc'),'createdAt',_0x478b('0xdd'),_0x478b('0xde'),'userThirdDisposition',_0x478b('0xdf')],'where':{'ContactId':_0x5d96f0[_0x478b('0x25')]['id']},'include':[{'model':db[_0x478b('0xbb')],'as':_0x478b('0xbb'),'attributes':['id',_0x478b('0x1b'),_0x478b('0xe0'),_0x478b('0xe1')]}],'order':[[_0x478b('0xe2'),_0x478b('0xe3')]]};if(_0x5d96f0[_0x478b('0x21')][_0x478b('0xd6')]){_0xb15b83[_0x478b('0x59')][_0x478b('0xe2')]={'$gte':_0xf7e1d2[_0x478b('0x3b')],'$lte':_0xf7e1d2['to']};}return db[_0x478b('0x49')]['findAndCountAll'](_0xb15b83)[_0x478b('0x17')](function(_0x5ccd8e){_0x5ba3f6[_0x478b('0x12')]+=_0x5ccd8e['count'];return _[_0x478b('0x6d')](_0x5ccd8e[_0x478b('0x9c')],function(_0x1ea9c3){var _0x4c5011=_0x1ea9c3[_0x478b('0x35')]({'plain':!![]});_0x4c5011[_0x478b('0xd3')]=_0x40cfb7;if(_0x4c5011[_0x478b('0xbb')]){_0x4c5011[_0x478b('0xbb')]={'id':_0x4c5011[_0x478b('0xbb')]['id'],'name':_0x4c5011[_0x478b('0xbb')]['name'],'fullname':_0x4c5011[_0x478b('0xbb')]['fullname'],'alias':_0x4c5011[_0x478b('0xbb')][_0x478b('0xe1')]};}return _0x4c5011;});});}else{var _0x37561f=_[_0x478b('0xe4')](_0x40cfb7)+(_0x40cfb7===_0x478b('0xca')?_0x478b('0xe5'):'Account');var _0x5f36dc={'attributes':['id',_0x478b('0xe6'),_0x478b('0xe7'),_0x478b('0xe2'),_0x478b('0xdc'),_0x478b('0xe8'),_0x478b('0xe9'),_0x478b('0xea'),'UserId',_0x37561f+'Id'],'where':{'ContactId':_0x5d96f0[_0x478b('0x25')]['id']},'include':[{'model':db[_0x37561f],'as':_0x478b('0xeb'),'attributes':['id',_0x478b('0x1b'),_0x478b('0xec')]},{'model':db[_0x478b('0xbb')],'as':'Owner','attributes':['id',_0x478b('0x1b'),_0x478b('0xe0')]},{'model':db[_0x478b('0x62')],'as':_0x478b('0x63'),'attributes':['id',_0x478b('0x1b'),_0x478b('0x64')],'through':{'attributes':[]}}],'order':[[_0x478b('0xe2'),_0x478b('0xe3')]]};if(_0x5d96f0[_0x478b('0x21')]['range']){_0x5f36dc[_0x478b('0x59')][_0x478b('0xe2')]={'$gte':_0xf7e1d2[_0x478b('0x3b')],'$lte':_0xf7e1d2['to']};}switch(_0x40cfb7){case _0x478b('0xca'):_0x5f36dc[_0x478b('0x7d')][_0x478b('0x5b')](_0x478b('0xed'),_0x478b('0xee'),'customerPort',_0x478b('0xef'),'osName',_0x478b('0xf0'),_0x478b('0xf1'),'ratingValue','referer');break;case _0x478b('0xc9'):_0x5f36dc[_0x478b('0x7d')]['push'](_0x478b('0xf2'),'substatus');break;case _0x478b('0xcc'):_0x5f36dc[_0x478b('0x7d')][_0x478b('0x5b')](_0x478b('0xf3'),_0x478b('0xf4'));break;}return db[_[_0x478b('0xe4')](_0x40cfb7)+_0x478b('0xf5')][_0x478b('0xf6')](_0x5f36dc)['then'](function(_0x4ff4d2){_0x5ba3f6['count']+=_0x4ff4d2[_0x478b('0x12')];return _[_0x478b('0x6d')](_0x4ff4d2[_0x478b('0x9c')],function(_0x5886e4){var _0xe35bd=_0x5886e4[_0x478b('0x35')]({'plain':!![]});_0xe35bd[_0x478b('0xd3')]=_0x40cfb7;if(_0xe35bd[_0x478b('0xf7')]){_0xe35bd['Owner']={'id':_0xe35bd['Owner']['id'],'name':_0xe35bd[_0x478b('0xf7')][_0x478b('0x1b')],'fullname':_0xe35bd[_0x478b('0xf7')][_0x478b('0xe0')]};}return _0xe35bd;});});}});return Promise['all'](_0x372e4a);})[_0x478b('0x17')](function(_0x38cc5b){return _(_0x38cc5b)[_0x478b('0xf8')]()['sortBy'](_0x478b('0xe2'))[_0x478b('0xf9')]()[_0x478b('0xfa')]();})[_0x478b('0x17')](function(_0x24cdba){_0x5ba3f6[_0x478b('0x9c')]=_0x25a6c9['limit']?_0x24cdba['slice'](_0x25a6c9[_0x478b('0x10')],_0x25a6c9[_0x478b('0x10')]+_0x25a6c9[_0x478b('0x11')]):_0x24cdba;return _0x5ba3f6;})[_0x478b('0x17')](respondWithFilteredResult(_0x5d046e,_0x25a6c9))[_0x478b('0x23')](handleError(_0x5d046e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 279ec91..5c7da14 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8585=['hook','exports','events','../../mysqldb','CmContact','save','update','emit','hasOwnProperty'];(function(_0x2be717,_0x4acca2){var _0x29efec=function(_0x12a0f3){while(--_0x12a0f3){_0x2be717['push'](_0x2be717['shift']());}};_0x29efec(++_0x4acca2);}(_0x8585,0x9b));var _0x5858=function(_0x136753,_0x5ddc8a){_0x136753=_0x136753-0x0;var _0x1524de=_0x8585[_0x136753];return _0x1524de;};'use strict';var EventEmitter=require(_0x5858('0x0'));var CmContact=require(_0x5858('0x1'))['db'][_0x5858('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5858('0x3'),'afterUpdate':_0x5858('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1777e0){return function(_0x3ad041,_0x1b3454,_0x55237e){CmContactEvents[_0x5858('0x5')](_0x1777e0+':'+_0x3ad041['id'],_0x3ad041);CmContactEvents[_0x5858('0x5')](_0x1777e0,_0x3ad041);_0x55237e(null);};}for(var e in events){if(events[_0x5858('0x6')](e)){var event=events[e];CmContact[_0x5858('0x7')](e,emitEvent(event));}}module[_0x5858('0x8')]=CmContactEvents; \ No newline at end of file +var _0x12bf=['exports','events','../../mysqldb','CmContact','save','update','remove','emit','hook'];(function(_0x4fd9dd,_0x172f8f){var _0x5db6f3=function(_0x4c8edc){while(--_0x4c8edc){_0x4fd9dd['push'](_0x4fd9dd['shift']());}};_0x5db6f3(++_0x172f8f);}(_0x12bf,0x1e7));var _0xf12b=function(_0x58ae4c,_0x27c3bb){_0x58ae4c=_0x58ae4c-0x0;var _0x1406b6=_0x12bf[_0x58ae4c];return _0x1406b6;};'use strict';var EventEmitter=require(_0xf12b('0x0'));var CmContact=require(_0xf12b('0x1'))['db'][_0xf12b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf12b('0x3'),'afterUpdate':_0xf12b('0x4'),'afterDestroy':_0xf12b('0x5')};function emitEvent(_0x35e447){return function(_0x5cd366,_0x545c40,_0x13cd0e){CmContactEvents[_0xf12b('0x6')](_0x35e447+':'+_0x5cd366['id'],_0x5cd366);CmContactEvents['emit'](_0x35e447,_0x5cd366);_0x13cd0e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xf12b('0x7')](e,emitEvent(event));}}module[_0xf12b('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7c633fc..77fc8b8 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb3c=['findOne','timezones','utcOffset','minutes','then','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','format','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','util','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue'];(function(_0x5d0ee3,_0x32bb4f){var _0x2b36a5=function(_0x3da252){while(--_0x3da252){_0x5d0ee3['push'](_0x5d0ee3['shift']());}};_0x2b36a5(++_0x32bb4f);}(_0xfb3c,0x152));var _0xcfb3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfb3c[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xcfb3('0x0'));var logger=require('../../config/logger')(_0xcfb3('0x1'));var moment=require(_0xcfb3('0x2'));var BPromise=require(_0xcfb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfb3('0x4'));var rimraf=require(_0xcfb3('0x5'));var config=require(_0xcfb3('0x6'));var shared=require(_0xcfb3('0x7'));var attributes=require(_0xcfb3('0x8'));module[_0xcfb3('0x9')]=function(_0x381824,_0x45631c){return _0x381824[_0xcfb3('0xa')](_0xcfb3('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xcfb3('0xc'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0xcfb3('0xd'),_0xcfb3('0xe'),'phone',_0xcfb3('0xf'),_0xcfb3('0x10'),_0xcfb3('0x11')],'type':_0xcfb3('0x12')}],'timestamps':!![],'charset':_0xcfb3('0x13'),'collate':_0xcfb3('0x14'),'hooks':{'afterCreate':function(_0x26fcc5,_0x5e64a0,_0x33e6a6){var _0x3fc95d=_0x381824[_0xcfb3('0x15')];var _0x4fb596=_0x26fcc5[_0xcfb3('0x16')]({'plain':!![]});function _0x4fefb2(){return function(_0x9cfb8a){logger[_0xcfb3('0x17')](_0xcfb3('0x18'),_0xcfb3('0x19'),util[_0xcfb3('0x1a')](_0x9cfb8a,{'showHidden':![],'depth':null}));};}function _0x5c0485(_0x1f36e9,_0x4ddd25){var _0x53948a=_0x4ddd25[_0xcfb3('0x1b')]?_0x4ddd25[_0xcfb3('0x1b')]:moment()['format'](_0xcfb3('0x1c'));return new BPromise(function(_0x23568f,_0x2def44){if(_[_0xcfb3('0x1d')](_0x4ddd25[_0xcfb3('0x1e')])){_0x23568f({'ret':_0x53948a});}else{_0x3fc95d[_0xcfb3('0x1f')][_0xcfb3('0x20')]({'where':{'id':_0x1f36e9['id']}})['then'](function(_0x474edf){if(!_[_0xcfb3('0x1d')](_0x474edf)){var _0x25d50b=_0x474edf['dialTimezone'];if(!_['isNil'](_0x25d50b)){var _0x18f85e=shared[_0xcfb3('0x21')];var _0x33f37e=_0x18f85e[_0x25d50b];var _0xf370f3=_0x18f85e[_0x4ddd25[_0xcfb3('0x1e')]];if(!_['isNil'](_0x33f37e)&&!_[_0xcfb3('0x1d')](_0xf370f3)){var _0x30ab0c=_0x33f37e[_0xcfb3('0x22')]-_0xf370f3[_0xcfb3('0x22')];_0x53948a=_0x4ddd25[_0xcfb3('0x1b')]?_0x4ddd25[_0xcfb3('0x1b')]:moment();var _0x82d62b=moment(_0x53948a)['add'](_0x30ab0c,_0xcfb3('0x23'));_0x23568f({'ret':_0x82d62b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x23568f({'ret':_0x53948a});}else _0x23568f({'ret':_0x53948a});}else{_0x23568f({'ret':_0x53948a});}});}});return 0xa;}var _0x9ff2ad=function(_0xe200b0){return new BPromise(function(_0x34dd73,_0xb3ec6e){_0x5c0485(_0xe200b0,_0x4fb596)[_0xcfb3('0x24')](function(_0x10e09b){_0x4fb596[_0xcfb3('0x1b')]=_0x10e09b[_0xcfb3('0x25')];_0x3fc95d['CmHopper'][_0xcfb3('0x20')]({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0xe200b0['id']}})['then'](function(_0x5d8eb5){if(!_[_0xcfb3('0x1d')](_0x5d8eb5)){throw new Error(_0xcfb3('0x26')+_0x4fb596[_0xcfb3('0xc')]+_0xcfb3('0x27')+_0xe200b0['id']);}return _0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596['priority']?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596['callbackUniqueid']:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xe200b0['id']});})[_0xcfb3('0x2e')](function(_0xb12262){_0xb3ec6e(_0xb12262);});});});};var _0x313876=function(_0x372139){return new BPromise(function(_0x2845ea,_0x29e3eb){_0x5c0485(_0x372139,_0x4fb596)['then'](function(_0x2fec0d){_0x4fb596[_0xcfb3('0x1b')]=_0x2fec0d[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')]['findOne']({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0x372139['id']}})[_0xcfb3('0x24')](function(_0x18ae7e){if(!_[_0xcfb3('0x1d')](_0x18ae7e)){throw new Error(_0xcfb3('0x26')+_0x4fb596[_0xcfb3('0xc')]+_0xcfb3('0x2f')+_0x372139['id']);}return _0x3fc95d[_0xcfb3('0x30')][_0xcfb3('0x20')]({'where':{'calleridnum':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0x372139['id']}});})[_0xcfb3('0x24')](function(_0x15d0b9){if(!_['isNil'](_0x15d0b9)){throw new Error(_0xcfb3('0x31')+_0x4fb596[_0xcfb3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x372139['id']);}return _0x3fc95d['CmHopper'][_0xcfb3('0x29')]({'phone':_0x4fb596['phone'],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()['format'](_0xcfb3('0x1c')),'callback':_0x4fb596['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()['format'](_0xcfb3('0x1c')):undefined,'VoiceQueueId':_0x372139['id']});})[_0xcfb3('0x2e')](function(_0x489b66){_0x29e3eb(_0x489b66);});});});};function _0x25e370(){return function(_0x1e2995){logger[_0xcfb3('0x17')](_0xcfb3('0x18'),_0xcfb3('0x19'),util[_0xcfb3('0x1a')](_0x1e2995,{'showHidden':![],'depth':null}));};}function _0x456ae2(_0x4865e8,_0x1cc492){var _0x4afbef=_0x1cc492['scheduledat']?_0x1cc492[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x50f76d,_0x52f9c8){if(_[_0xcfb3('0x1d')](_0x1cc492[_0xcfb3('0x1e')])){_0x50f76d({'ret':_0x4afbef});}else{_0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x20')]({'where':{'id':_0x4865e8['id']}})[_0xcfb3('0x24')](function(_0x5ee33d){if(!_[_0xcfb3('0x1d')](_0x5ee33d)){var _0x2f3068=_0x5ee33d['dialTimezone'];if(!_['isNil'](_0x2f3068)){var _0x12c5d3=shared[_0xcfb3('0x21')];var _0x3fe00c=_0x12c5d3[_0x2f3068];var _0x554ccf=_0x12c5d3[_0x1cc492['dialTimezone']];if(!_[_0xcfb3('0x1d')](_0x3fe00c)&&!_[_0xcfb3('0x1d')](_0x554ccf)){var _0x1f3333=_0x3fe00c[_0xcfb3('0x22')]-_0x554ccf['utcOffset'];_0x4afbef=_0x1cc492['scheduledat']?_0x1cc492[_0xcfb3('0x1b')]:moment();var _0x23c196=moment(_0x4afbef)['add'](_0x1f3333,_0xcfb3('0x23'));_0x50f76d({'ret':_0x23c196[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x50f76d({'ret':_0x4afbef});}else _0x50f76d({'ret':_0x4afbef});}else{_0x50f76d({'ret':_0x4afbef});}});}});return 0xa;}var _0x3ba2f3=function(_0x3d735d){return new BPromise(function(_0x59387f,_0xb3ea54){_0x456ae2(_0x3d735d,_0x4fb596)[_0xcfb3('0x24')](function(_0x368197){_0x4fb596[_0xcfb3('0x1b')]=_0x368197[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')]['findOne']({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x3d735d['id']}})[_0xcfb3('0x24')](function(_0x53ecc3){if(!_[_0xcfb3('0x1d')](_0x53ecc3)){throw new Error(_0xcfb3('0x26')+_0x4fb596['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3d735d['id']);}return _0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596['callbackUniqueid']?_0x4fb596['callbackUniqueid']:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3d735d['id']});})['catch'](function(_0x5532bf){_0xb3ea54(_0x5532bf);});});});};var _0x5f5208=function(_0x2bae60){return new BPromise(function(_0x365bca,_0x47b8ed){_0x456ae2(_0x2bae60,_0x4fb596)[_0xcfb3('0x24')](function(_0x48cef3){_0x4fb596[_0xcfb3('0x1b')]=_0x48cef3[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x20')]({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x2bae60['id']}})[_0xcfb3('0x24')](function(_0x223d53){if(!_[_0xcfb3('0x1d')](_0x223d53)){throw new Error(_0xcfb3('0x26')+_0x4fb596['phone']+_0xcfb3('0x33')+_0x2bae60['id']);}return _0x3fc95d[_0xcfb3('0x30')][_0xcfb3('0x20')]({'where':{'calleridnum':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x2bae60['id']}});})[_0xcfb3('0x24')](function(_0x151367){if(!_[_0xcfb3('0x1d')](_0x151367)){throw new Error(_0xcfb3('0x31')+_0x4fb596[_0xcfb3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x2bae60['id']);}return _0x3fc95d['CmHopper'][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596['ListId'],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()['format'](_0xcfb3('0x1c')):undefined,'CampaignId':_0x2bae60['id']});})[_0xcfb3('0x2e')](function(_0xbcac90){_0x47b8ed(_0xbcac90);});});});};if(_0x4fb596[_0xcfb3('0x2a')]){_0x3fc95d[_0xcfb3('0x1f')][_0xcfb3('0x34')]({'where':{'type':_0xcfb3('0x35')},'attributes':['id',_0xcfb3('0x36'),_0xcfb3('0x1e')],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x38'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0x3e52ab){if(_0x3e52ab){var _0x4ddc26=[];for(var _0x11e33c=0x0,_0x50c3c9;_0x11e33c<_0x3e52ab['length'];_0x11e33c+=0x1){_0x50c3c9=_0x3e52ab[_0x11e33c][_0xcfb3('0x16')]({'plain':!![]});switch(_0x50c3c9['dialCheckDuplicateType']){case _0xcfb3('0x39'):_0x313876(_0x50c3c9)[_0xcfb3('0x2e')](_0x4fefb2());break;case _0xcfb3('0x3a'):_0x9ff2ad(_0x50c3c9)[_0xcfb3('0x2e')](_0x4fefb2());break;default:_0x456ae2(_0x50c3c9,_0x4fb596)[_0xcfb3('0x24')](function(_0x20b458){_0x4fb596[_0xcfb3('0x1b')]=_0x20b458[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596['scheduledat']:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4fb596['priority']?_0x4fb596['priority']:0x2,'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')):undefined,'VoiceQueueId':_0x50c3c9['id']})[_0xcfb3('0x2e')](_0x4fefb2());});}}}})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x1f')]['findAll']({'where':{'type':_0xcfb3('0x35')},'attributes':['id'],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x3b'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0xc26853){if(_0xc26853){var _0x4f1212=[];for(var _0x4c7c42=0x0,_0x558629;_0x4c7c42<_0xc26853[_0xcfb3('0x3c')];_0x4c7c42+=0x1){_0x558629=_0xc26853[_0x4c7c42][_0xcfb3('0x16')]({'plain':!![]});_0x3fc95d[_0xcfb3('0x3d')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'VoiceQueueId':_0x558629['id']})[_0xcfb3('0x2e')](function(_0x4c0cf6){logger[_0xcfb3('0x17')](_0xcfb3('0x3e'),'afterCreate',_0x4c0cf6['message']);});}}});})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x34')]({'attributes':['id',_0xcfb3('0x36'),_0xcfb3('0x1e')],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x38'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})['then'](function(_0x457101){if(_0x457101){var _0x35d878=[];for(var _0x2ce3e4=0x0,_0x33bec4;_0x2ce3e4<_0x457101[_0xcfb3('0x3c')];_0x2ce3e4+=0x1){_0x33bec4=_0x457101[_0x2ce3e4][_0xcfb3('0x16')]({'plain':!![]});switch(_0x33bec4[_0xcfb3('0x36')]){case _0xcfb3('0x39'):_0x5f5208(_0x33bec4)[_0xcfb3('0x2e')](_0x25e370());break;case'onlyIfOpen':_0x3ba2f3(_0x33bec4)[_0xcfb3('0x2e')](_0x25e370());break;default:_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596['phone'],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596['ListId'],'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596['scheduledat']:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'priority':_0x4fb596['priority']?_0x4fb596['priority']:0x2,'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596['callbackUniqueid']?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x33bec4['id']})[_0xcfb3('0x2e')](_0x25e370());}}}});})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x34')]({'attributes':['id'],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x3b'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0x9525bf){if(_0x9525bf){var _0x255ff8=[];for(var _0x6a4b2e=0x0,_0x2dd4eb;_0x6a4b2e<_0x9525bf[_0xcfb3('0x3c')];_0x6a4b2e+=0x1){_0x2dd4eb=_0x9525bf[_0x6a4b2e][_0xcfb3('0x16')]({'plain':!![]});_0x3fc95d[_0xcfb3('0x3d')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'CampaignId':_0x2dd4eb['id']})[_0xcfb3('0x2e')](function(_0x3586e5){logger[_0xcfb3('0x17')](_0xcfb3('0x3e'),_0xcfb3('0x19'),_0x3586e5[_0xcfb3('0x3f')]);});}}});})[_0xcfb3('0x24')](function(){_0x33e6a6();})[_0xcfb3('0x2e')](function(_0x314cb2){logger['error'](_0xcfb3('0x3e'),_0xcfb3('0x19'),_0x314cb2['message']);_0x33e6a6(_0x314cb2);});}else{_0x33e6a6(new Error(_0xcfb3('0x40')));}},'afterDestroy':function(_0x56008e,_0x178cb8,_0x37514f){var _0xccbbc8=_0x381824[_0xcfb3('0x15')];var _0x1efdb7=_0x56008e[_0xcfb3('0x16')]({'plain':!![]});return _0xccbbc8[_0xcfb3('0x28')][_0xcfb3('0x34')]({'raw':!![],'where':{'ListId':_0x1efdb7[_0xcfb3('0x2a')],'ContactId':_0x1efdb7['id']}})[_0xcfb3('0x24')](function(_0x5d5903){if(!_[_0xcfb3('0x41')](_0x5d5903)){var _0x5231a8=[];for(var _0x15b5a3=0x0;_0x15b5a3<_0x5d5903['length'];_0x15b5a3+=0x1){var _0x4c91c7=_0xccbbc8[_0xcfb3('0x28')][_0xcfb3('0x42')]({'where':{'ListId':_0x5d5903[_0x15b5a3][_0xcfb3('0x2a')],'ContactId':_0x5d5903[_0x15b5a3][_0xcfb3('0x43')],'VoiceQueueId':_0x5d5903[_0x15b5a3][_0xcfb3('0x44')],'CampaignId':_0x5d5903[_0x15b5a3][_0xcfb3('0x45')]}});_0x5231a8[_0xcfb3('0x46')](_0x4c91c7);}return BPromise[_0xcfb3('0x47')](_0x5231a8);}})[_0xcfb3('0x24')](function(_0x4713a3){logger[_0xcfb3('0x48')](_0xcfb3('0x49'),util[_0xcfb3('0x1a')](_0x4713a3,{'showHidden':![],'depth':null}));_0x37514f();})[_0xcfb3('0x2e')](function(_0x23d877){logger[_0xcfb3('0x17')]('[CmContact][afterDestroy][Error]',util[_0xcfb3('0x1a')](_0x23d877,{'showHidden':![],'depth':null}));_0x37514f(_0x23d877);});}}});}; \ No newline at end of file +var _0x1cc3=['lastName','mobile','fax','email','FULLTEXT','utf8mb4','models','get','error','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','timezones','add','minutes','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','format','callbackUniqueid','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','create','priority','catch','cmContact','Campaign','utcOffset','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','findAll','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','phone','fti_cm_contacts','firstName'];(function(_0x4a156b,_0x1fd2b1){var _0x51db6f=function(_0x32adbb){while(--_0x32adbb){_0x4a156b['push'](_0x4a156b['shift']());}};_0x51db6f(++_0x1fd2b1);}(_0x1cc3,0x110));var _0x31cc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1cc3[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x31cc('0x0'));var logger=require(_0x31cc('0x1'))(_0x31cc('0x2'));var moment=require(_0x31cc('0x3'));var BPromise=require(_0x31cc('0x4'));var rp=require(_0x31cc('0x5'));var fs=require('fs');var path=require(_0x31cc('0x6'));var rimraf=require(_0x31cc('0x7'));var config=require(_0x31cc('0x8'));var shared=require(_0x31cc('0x9'));var attributes=require(_0x31cc('0xa'));module[_0x31cc('0xb')]=function(_0x32dfac,_0x114e34){return _0x32dfac[_0x31cc('0xc')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x31cc('0xd')]},{'name':_0x31cc('0xe'),'fields':[_0x31cc('0xf'),_0x31cc('0x10'),'phone',_0x31cc('0x11'),_0x31cc('0x12'),_0x31cc('0x13')],'type':_0x31cc('0x14')}],'timestamps':!![],'charset':_0x31cc('0x15'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xf55753,_0x1db169,_0x293af3){var _0x1ee1b8=_0x32dfac[_0x31cc('0x16')];var _0x297b18=_0xf55753[_0x31cc('0x17')]({'plain':!![]});function _0x376da9(){return function(_0x10d2e5){logger[_0x31cc('0x18')]('cmContact',_0x31cc('0x19'),util[_0x31cc('0x1a')](_0x10d2e5,{'showHidden':![],'depth':null}));};}function _0x42ce0c(_0x53b182,_0x5a8097){var _0x1d08e8=_0x5a8097['scheduledat']?_0x5a8097[_0x31cc('0x1b')]:moment()['format'](_0x31cc('0x1c'));return new BPromise(function(_0x1d20ce,_0x59b479){if(_[_0x31cc('0x1d')](_0x5a8097[_0x31cc('0x1e')])){_0x1d20ce({'ret':_0x1d08e8});}else{_0x1ee1b8['VoiceQueue'][_0x31cc('0x1f')]({'where':{'id':_0x53b182['id']}})[_0x31cc('0x20')](function(_0x2a8055){if(!_[_0x31cc('0x1d')](_0x2a8055)){var _0x353ae6=_0x2a8055[_0x31cc('0x1e')];if(!_['isNil'](_0x353ae6)){var _0xeb759f=shared[_0x31cc('0x21')];var _0x2f0f55=_0xeb759f[_0x353ae6];var _0x47c14c=_0xeb759f[_0x5a8097[_0x31cc('0x1e')]];if(!_[_0x31cc('0x1d')](_0x2f0f55)&&!_[_0x31cc('0x1d')](_0x47c14c)){var _0x1c0b57=_0x2f0f55['utcOffset']-_0x47c14c['utcOffset'];_0x1d08e8=_0x5a8097[_0x31cc('0x1b')]?_0x5a8097[_0x31cc('0x1b')]:moment();var _0x4054cb=moment(_0x1d08e8)[_0x31cc('0x22')](_0x1c0b57,_0x31cc('0x23'));_0x1d20ce({'ret':_0x4054cb['format'](_0x31cc('0x1c'))});}else _0x1d20ce({'ret':_0x1d08e8});}else _0x1d20ce({'ret':_0x1d08e8});}else{_0x1d20ce({'ret':_0x1d08e8});}});}});return 0xa;}var _0x11c223=function(_0x3765cc){return new BPromise(function(_0x1df65a,_0x193e79){_0x42ce0c(_0x3765cc,_0x297b18)[_0x31cc('0x20')](function(_0x5b4acd){_0x297b18[_0x31cc('0x1b')]=_0x5b4acd[_0x31cc('0x24')];_0x1ee1b8['CmHopper']['findOne']({'where':{'phone':_0x297b18['phone'],'VoiceQueueId':_0x3765cc['id']}})[_0x31cc('0x20')](function(_0x131fb7){if(!_['isNil'](_0x131fb7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x297b18[_0x31cc('0xd')]+_0x31cc('0x25')+_0x3765cc['id']);}return _0x1ee1b8[_0x31cc('0x26')]['create']({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18[_0x31cc('0x27')],'priority':_0x297b18['priority']?_0x297b18['priority']:0x2,'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18['scheduledat']:moment()[_0x31cc('0x28')](_0x31cc('0x1c')),'callback':_0x297b18[_0x31cc('0x29')]?!![]:![],'callbackuniqueid':_0x297b18['callbackUniqueid']?_0x297b18[_0x31cc('0x29')]:undefined,'callbackat':_0x297b18['callbackUniqueid']?moment()['format'](_0x31cc('0x1c')):undefined,'VoiceQueueId':_0x3765cc['id']});})['catch'](function(_0x152c8a){_0x193e79(_0x152c8a);});});});};var _0x1fd66f=function(_0xdca68d){return new BPromise(function(_0x131b2c,_0x23fd2f){_0x42ce0c(_0xdca68d,_0x297b18)[_0x31cc('0x20')](function(_0x2f668e){_0x297b18[_0x31cc('0x1b')]=_0x2f668e[_0x31cc('0x24')];_0x1ee1b8['CmHopper']['findOne']({'where':{'phone':_0x297b18['phone'],'VoiceQueueId':_0xdca68d['id']}})[_0x31cc('0x20')](function(_0x576625){if(!_[_0x31cc('0x1d')](_0x576625)){throw new Error(_0x31cc('0x2a')+_0x297b18[_0x31cc('0xd')]+_0x31cc('0x2b')+_0xdca68d['id']);}return _0x1ee1b8[_0x31cc('0x2c')][_0x31cc('0x1f')]({'where':{'calleridnum':_0x297b18[_0x31cc('0xd')],'VoiceQueueId':_0xdca68d['id']}});})[_0x31cc('0x20')](function(_0x16f125){if(!_['isNil'](_0x16f125)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x297b18[_0x31cc('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xdca68d['id']);}return _0x1ee1b8[_0x31cc('0x26')][_0x31cc('0x2d')]({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18[_0x31cc('0x27')],'priority':_0x297b18[_0x31cc('0x2e')]?_0x297b18[_0x31cc('0x2e')]:0x2,'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x297b18[_0x31cc('0x29')]?!![]:![],'callbackuniqueid':_0x297b18[_0x31cc('0x29')]?_0x297b18[_0x31cc('0x29')]:undefined,'callbackat':_0x297b18[_0x31cc('0x29')]?moment()[_0x31cc('0x28')](_0x31cc('0x1c')):undefined,'VoiceQueueId':_0xdca68d['id']});})[_0x31cc('0x2f')](function(_0x2463db){_0x23fd2f(_0x2463db);});});});};function _0x12f913(){return function(_0x313363){logger[_0x31cc('0x18')](_0x31cc('0x30'),_0x31cc('0x19'),util[_0x31cc('0x1a')](_0x313363,{'showHidden':![],'depth':null}));};}function _0x8a9bfe(_0xefa690,_0x3df1d7){var _0x48e8cf=_0x3df1d7[_0x31cc('0x1b')]?_0x3df1d7[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x90be12,_0x5a02e8){if(_['isNil'](_0x3df1d7[_0x31cc('0x1e')])){_0x90be12({'ret':_0x48e8cf});}else{_0x1ee1b8[_0x31cc('0x31')][_0x31cc('0x1f')]({'where':{'id':_0xefa690['id']}})[_0x31cc('0x20')](function(_0x4b4ba7){if(!_[_0x31cc('0x1d')](_0x4b4ba7)){var _0x2aeae2=_0x4b4ba7[_0x31cc('0x1e')];if(!_[_0x31cc('0x1d')](_0x2aeae2)){var _0x24b13b=shared[_0x31cc('0x21')];var _0x169acd=_0x24b13b[_0x2aeae2];var _0x3190f7=_0x24b13b[_0x3df1d7[_0x31cc('0x1e')]];if(!_[_0x31cc('0x1d')](_0x169acd)&&!_[_0x31cc('0x1d')](_0x3190f7)){var _0x2a96f6=_0x169acd[_0x31cc('0x32')]-_0x3190f7[_0x31cc('0x32')];_0x48e8cf=_0x3df1d7[_0x31cc('0x1b')]?_0x3df1d7['scheduledat']:moment();var _0x17761c=moment(_0x48e8cf)[_0x31cc('0x22')](_0x2a96f6,_0x31cc('0x23'));_0x90be12({'ret':_0x17761c['format'](_0x31cc('0x1c'))});}else _0x90be12({'ret':_0x48e8cf});}else _0x90be12({'ret':_0x48e8cf});}else{_0x90be12({'ret':_0x48e8cf});}});}});return 0xa;}var _0x2e2d25=function(_0x1d5cb9){return new BPromise(function(_0x728918,_0x16abe2){_0x8a9bfe(_0x1d5cb9,_0x297b18)[_0x31cc('0x20')](function(_0x299044){_0x297b18['scheduledat']=_0x299044[_0x31cc('0x24')];_0x1ee1b8[_0x31cc('0x26')][_0x31cc('0x1f')]({'where':{'phone':_0x297b18[_0x31cc('0xd')],'CampaignId':_0x1d5cb9['id']}})[_0x31cc('0x20')](function(_0x1ade62){if(!_[_0x31cc('0x1d')](_0x1ade62)){throw new Error(_0x31cc('0x2a')+_0x297b18[_0x31cc('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1d5cb9['id']);}return _0x1ee1b8['CmHopper'][_0x31cc('0x2d')]({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18['ListId'],'priority':_0x297b18['priority']?_0x297b18['priority']:0x2,'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x297b18['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x297b18['callbackUniqueid']?_0x297b18[_0x31cc('0x29')]:undefined,'callbackat':_0x297b18[_0x31cc('0x29')]?moment()[_0x31cc('0x28')](_0x31cc('0x1c')):undefined,'CampaignId':_0x1d5cb9['id']});})[_0x31cc('0x2f')](function(_0x29f9c3){_0x16abe2(_0x29f9c3);});});});};var _0x16cb27=function(_0x17fcb6){return new BPromise(function(_0x103635,_0x10cacb){_0x8a9bfe(_0x17fcb6,_0x297b18)[_0x31cc('0x20')](function(_0x1879ef){_0x297b18[_0x31cc('0x1b')]=_0x1879ef['ret'];_0x1ee1b8['CmHopper'][_0x31cc('0x1f')]({'where':{'phone':_0x297b18[_0x31cc('0xd')],'CampaignId':_0x17fcb6['id']}})[_0x31cc('0x20')](function(_0xe0e779){if(!_[_0x31cc('0x1d')](_0xe0e779)){throw new Error(_0x31cc('0x2a')+_0x297b18[_0x31cc('0xd')]+_0x31cc('0x33')+_0x17fcb6['id']);}return _0x1ee1b8[_0x31cc('0x2c')][_0x31cc('0x1f')]({'where':{'calleridnum':_0x297b18[_0x31cc('0xd')],'CampaignId':_0x17fcb6['id']}});})['then'](function(_0x24a1ab){if(!_[_0x31cc('0x1d')](_0x24a1ab)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x297b18[_0x31cc('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x17fcb6['id']);}return _0x1ee1b8[_0x31cc('0x26')][_0x31cc('0x2d')]({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18['ListId'],'priority':_0x297b18['priority']?_0x297b18[_0x31cc('0x2e')]:0x2,'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')](_0x31cc('0x1c')),'callback':_0x297b18[_0x31cc('0x29')]?!![]:![],'callbackuniqueid':_0x297b18[_0x31cc('0x29')]?_0x297b18['callbackUniqueid']:undefined,'callbackat':_0x297b18['callbackUniqueid']?moment()[_0x31cc('0x28')](_0x31cc('0x1c')):undefined,'CampaignId':_0x17fcb6['id']});})[_0x31cc('0x2f')](function(_0x5d0756){_0x10cacb(_0x5d0756);});});});};if(_0x297b18[_0x31cc('0x27')]){_0x1ee1b8[_0x31cc('0x34')]['findAll']({'where':{'type':_0x31cc('0x35')},'attributes':['id',_0x31cc('0x36'),'dialTimezone'],'include':[{'model':_0x1ee1b8['CmList'],'as':_0x31cc('0x37'),'where':{'id':_0x297b18[_0x31cc('0x27')]}}]})['then'](function(_0x572785){if(_0x572785){var _0x5900da=[];for(var _0x5855ee=0x0,_0x4e1606;_0x5855ee<_0x572785[_0x31cc('0x38')];_0x5855ee+=0x1){_0x4e1606=_0x572785[_0x5855ee][_0x31cc('0x17')]({'plain':!![]});switch(_0x4e1606['dialCheckDuplicateType']){case _0x31cc('0x39'):_0x1fd66f(_0x4e1606)['catch'](_0x376da9());break;case _0x31cc('0x3a'):_0x11c223(_0x4e1606)['catch'](_0x376da9());break;default:_0x8a9bfe(_0x4e1606,_0x297b18)[_0x31cc('0x20')](function(_0x47100a){_0x297b18[_0x31cc('0x1b')]=_0x47100a[_0x31cc('0x24')];_0x1ee1b8[_0x31cc('0x26')][_0x31cc('0x2d')]({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18['ListId'],'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x297b18['priority']?_0x297b18[_0x31cc('0x2e')]:0x2,'callback':_0x297b18[_0x31cc('0x29')]?!![]:![],'callbackuniqueid':_0x297b18[_0x31cc('0x29')]?_0x297b18[_0x31cc('0x29')]:undefined,'callbackat':_0x297b18['callbackUniqueid']?moment()['format'](_0x31cc('0x1c')):undefined,'VoiceQueueId':_0x4e1606['id']})[_0x31cc('0x2f')](_0x376da9());});}}}})[_0x31cc('0x20')](function(){return _0x1ee1b8[_0x31cc('0x34')][_0x31cc('0x3b')]({'where':{'type':_0x31cc('0x35')},'attributes':['id'],'include':[{'model':_0x1ee1b8[_0x31cc('0x3c')],'as':_0x31cc('0x3d'),'where':{'id':_0x297b18['ListId']}}]})[_0x31cc('0x20')](function(_0x5bce06){if(_0x5bce06){var _0x3e9b6a=[];for(var _0x4feba5=0x0,_0x1b9350;_0x4feba5<_0x5bce06[_0x31cc('0x38')];_0x4feba5+=0x1){_0x1b9350=_0x5bce06[_0x4feba5][_0x31cc('0x17')]({'plain':!![]});_0x1ee1b8[_0x31cc('0x3e')]['create']({'phone':_0x297b18['phone'],'ContactId':_0x297b18['id'],'ListId':_0x297b18[_0x31cc('0x27')],'VoiceQueueId':_0x1b9350['id']})[_0x31cc('0x2f')](function(_0x754ab8){logger[_0x31cc('0x18')]('cmContact,\x20%s,\x20%s',_0x31cc('0x19'),_0x754ab8['message']);});}}});})[_0x31cc('0x20')](function(){return _0x1ee1b8[_0x31cc('0x31')][_0x31cc('0x3b')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1ee1b8[_0x31cc('0x3c')],'as':_0x31cc('0x37'),'where':{'id':_0x297b18[_0x31cc('0x27')]}}]})[_0x31cc('0x20')](function(_0x20fa1e){if(_0x20fa1e){var _0x4cc973=[];for(var _0x5a1a84=0x0,_0xd2527d;_0x5a1a84<_0x20fa1e[_0x31cc('0x38')];_0x5a1a84+=0x1){_0xd2527d=_0x20fa1e[_0x5a1a84]['get']({'plain':!![]});switch(_0xd2527d[_0x31cc('0x36')]){case _0x31cc('0x39'):_0x16cb27(_0xd2527d)[_0x31cc('0x2f')](_0x12f913());break;case _0x31cc('0x3a'):_0x2e2d25(_0xd2527d)[_0x31cc('0x2f')](_0x12f913());break;default:_0x1ee1b8['CmHopper']['create']({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18[_0x31cc('0x27')],'scheduledat':_0x297b18[_0x31cc('0x1b')]?_0x297b18[_0x31cc('0x1b')]:moment()[_0x31cc('0x28')](_0x31cc('0x1c')),'priority':_0x297b18['priority']?_0x297b18[_0x31cc('0x2e')]:0x2,'callback':_0x297b18[_0x31cc('0x29')]?!![]:![],'callbackuniqueid':_0x297b18['callbackUniqueid']?_0x297b18[_0x31cc('0x29')]:undefined,'callbackat':_0x297b18[_0x31cc('0x29')]?moment()[_0x31cc('0x28')](_0x31cc('0x1c')):undefined,'CampaignId':_0xd2527d['id']})[_0x31cc('0x2f')](_0x12f913());}}}});})[_0x31cc('0x20')](function(){return _0x1ee1b8[_0x31cc('0x31')][_0x31cc('0x3b')]({'attributes':['id'],'include':[{'model':_0x1ee1b8['CmList'],'as':_0x31cc('0x3d'),'where':{'id':_0x297b18[_0x31cc('0x27')]}}]})['then'](function(_0x5272b3){if(_0x5272b3){var _0x5b809a=[];for(var _0x138667=0x0,_0x130049;_0x138667<_0x5272b3[_0x31cc('0x38')];_0x138667+=0x1){_0x130049=_0x5272b3[_0x138667][_0x31cc('0x17')]({'plain':!![]});_0x1ee1b8['CmHopperBlack'][_0x31cc('0x2d')]({'phone':_0x297b18[_0x31cc('0xd')],'ContactId':_0x297b18['id'],'ListId':_0x297b18[_0x31cc('0x27')],'CampaignId':_0x130049['id']})[_0x31cc('0x2f')](function(_0x2ef884){logger[_0x31cc('0x18')](_0x31cc('0x3f'),_0x31cc('0x19'),_0x2ef884['message']);});}}});})[_0x31cc('0x20')](function(){_0x293af3();})['catch'](function(_0x5f9a8b){logger['error']('cmContact,\x20%s,\x20%s',_0x31cc('0x19'),_0x5f9a8b[_0x31cc('0x40')]);_0x293af3(_0x5f9a8b);});}else{_0x293af3(new Error(_0x31cc('0x41')));}},'afterDestroy':function(_0x4c2bbc,_0x2f8da0,_0x5cc6a0){var _0x5a0a15=_0x32dfac[_0x31cc('0x16')];var _0x1f9796=_0x4c2bbc['get']({'plain':!![]});return _0x5a0a15[_0x31cc('0x26')][_0x31cc('0x3b')]({'raw':!![],'where':{'ListId':_0x1f9796[_0x31cc('0x27')],'ContactId':_0x1f9796['id']}})['then'](function(_0x5a8e3f){if(!_['isEmpty'](_0x5a8e3f)){var _0x20a595=[];for(var _0x103db3=0x0;_0x103db3<_0x5a8e3f[_0x31cc('0x38')];_0x103db3+=0x1){var _0x15ccf7=_0x5a0a15[_0x31cc('0x26')][_0x31cc('0x42')]({'where':{'ListId':_0x5a8e3f[_0x103db3][_0x31cc('0x27')],'ContactId':_0x5a8e3f[_0x103db3]['ContactId'],'VoiceQueueId':_0x5a8e3f[_0x103db3][_0x31cc('0x43')],'CampaignId':_0x5a8e3f[_0x103db3][_0x31cc('0x44')]}});_0x20a595[_0x31cc('0x45')](_0x15ccf7);}return BPromise[_0x31cc('0x46')](_0x20a595);}})[_0x31cc('0x20')](function(_0x36864e){logger['info'](_0x31cc('0x47'),util['inspect'](_0x36864e,{'showHidden':![],'depth':null}));_0x5cc6a0();})[_0x31cc('0x2f')](function(_0x3163ce){logger['error']('[CmContact][afterDestroy][Error]',util[_0x31cc('0x1a')](_0x3163ce,{'showHidden':![],'depth':null}));_0x5cc6a0(_0x3163ce);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f4e10a4..f96986f 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x4690c5,_0x99a638){var _0x256e6e=function(_0x12526a){while(--_0x12526a){_0x4690c5['push'](_0x4690c5['shift']());}};_0x256e6e(++_0x99a638);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3092a1,_0x53fc0b){var _0x4f8c8b=function(_0x5ae563){while(--_0x5ae563){_0x3092a1['push'](_0x3092a1['shift']());}};_0x4f8c8b(++_0x53fc0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 3d3568b..a4138b7 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf95=['INTEGER','sequelize','exports','STRING','PHONE'];(function(_0x32331c,_0x21515b){var _0x58319f=function(_0x52d27c){while(--_0x52d27c){_0x32331c['push'](_0x32331c['shift']());}};_0x58319f(++_0x21515b);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cf9('0x0'));module[_0x5cf9('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5cf9('0x2')],'defaultValue':_0x5cf9('0x3')},'OrderBy':{'type':Sequelize[_0x5cf9('0x4')],'defaultValue':null},'description':{'type':Sequelize[_0x5cf9('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x342e=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x342e,0xde));var _0xe342=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x342e[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0xe342('0x0'));module[_0xe342('0x1')]={'CmContactId':{'type':Sequelize[_0xe342('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe342('0x3')],'defaultValue':_0xe342('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 88a8d61..a439263 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc0=['key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','catch','params','include','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type'];(function(_0x541f1e,_0x13a0d1){var _0x1b25d4=function(_0x5bc54c){while(--_0x5bc54c){_0x541f1e['push'](_0x541f1e['shift']());}};_0x1b25d4(++_0x13a0d1);}(_0x4fc0,0x118));var _0x04fc=function(_0x112590,_0x4fef60){_0x112590=_0x112590-0x0;var _0x163543=_0x4fc0[_0x112590];return _0x163543;};'use strict';var emlformat=require(_0x04fc('0x0'));var rimraf=require(_0x04fc('0x1'));var zipdir=require(_0x04fc('0x2'));var jsonpatch=require(_0x04fc('0x3'));var rp=require(_0x04fc('0x4'));var moment=require('moment');var BPromise=require(_0x04fc('0x5'));var Mustache=require(_0x04fc('0x6'));var util=require(_0x04fc('0x7'));var path=require(_0x04fc('0x8'));var sox=require(_0x04fc('0x9'));var csv=require(_0x04fc('0xa'));var ejs=require(_0x04fc('0xb'));var fs=require('fs');var fs_extra=require(_0x04fc('0xc'));var _=require(_0x04fc('0xd'));var squel=require('squel');var crypto=require(_0x04fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04fc('0xf'));var toCsv=require(_0x04fc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x04fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x04fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04fc('0x12'));var logger=require(_0x04fc('0x13'))(_0x04fc('0x14'));var utils=require('../../config/utils');var config=require(_0x04fc('0x15'));var licenseUtil=require(_0x04fc('0x16'));var db=require(_0x04fc('0x17'))['db'];function respondWithStatusCode(_0x2ec7d7,_0x23e5d6){_0x23e5d6=_0x23e5d6||0xcc;return function(_0x1f6a03){if(_0x1f6a03){return _0x2ec7d7[_0x04fc('0x18')](_0x23e5d6);}return _0x2ec7d7[_0x04fc('0x19')](_0x23e5d6)[_0x04fc('0x1a')]();};}function respondWithResult(_0x41eff0,_0x149add){_0x149add=_0x149add||0xc8;return function(_0x8067d8){if(_0x8067d8){return _0x41eff0[_0x04fc('0x19')](_0x149add)['json'](_0x8067d8);}};}function respondWithFilteredResult(_0x242bdd,_0x3eb3c9){return function(_0x49c9a7){if(_0x49c9a7){var _0x192dc2=typeof _0x3eb3c9[_0x04fc('0x1b')]===_0x04fc('0x1c')&&typeof _0x3eb3c9[_0x04fc('0x1d')]==='undefined';var _0x4b6ae1=_0x49c9a7[_0x04fc('0x1e')];var _0x46d53c=_0x192dc2?0x0:_0x3eb3c9[_0x04fc('0x1b')];var _0x52508a=_0x192dc2?_0x49c9a7['count']:_0x3eb3c9[_0x04fc('0x1b')]+_0x3eb3c9[_0x04fc('0x1d')];var _0x28bfd3;if(_0x52508a>=_0x4b6ae1){_0x52508a=_0x4b6ae1;_0x28bfd3=0xc8;}else{_0x28bfd3=0xce;}_0x242bdd[_0x04fc('0x19')](_0x28bfd3);return _0x242bdd[_0x04fc('0x1f')](_0x04fc('0x20'),_0x46d53c+'-'+_0x52508a+'/'+_0x4b6ae1)[_0x04fc('0x21')](_0x49c9a7);}return null;};}function patchUpdates(_0x40578f){return function(_0x965529){try{jsonpatch['apply'](_0x965529,_0x40578f,!![]);}catch(_0x459a28){return BPromise['reject'](_0x459a28);}return _0x965529['save']();};}function saveUpdates(_0x3796ef,_0x3930df){return function(_0x4a2c1d){if(_0x4a2c1d){return _0x4a2c1d[_0x04fc('0x22')](_0x3796ef)[_0x04fc('0x23')](function(_0x304bb7){return _0x304bb7;});}return null;};}function removeEntity(_0x3a68bd,_0x9aca77){return function(_0x59fbfa){if(_0x59fbfa){return _0x59fbfa[_0x04fc('0x24')]()[_0x04fc('0x23')](function(){var _0x32f01c=_0x59fbfa[_0x04fc('0x25')]({'plain':!![]});var _0x204455='CmContactHasItems';return db[_0x04fc('0x26')]['destroy']({'where':{'type':_0x204455,'resourceId':_0x32f01c['id']}})['then'](function(){return _0x59fbfa;});})['then'](function(){_0x3a68bd[_0x04fc('0x19')](0xcc)[_0x04fc('0x1a')]();});}};}function handleEntityNotFound(_0x1131b5,_0x80ff7){return function(_0x577a08){if(!_0x577a08){_0x1131b5['sendStatus'](0x194);}return _0x577a08;};}function handleError(_0x47f8a0,_0x157291){_0x157291=_0x157291||0x1f4;return function(_0x57220a){logger['error'](_0x57220a[_0x04fc('0x27')]);if(_0x57220a[_0x04fc('0x28')]){delete _0x57220a[_0x04fc('0x28')];}_0x47f8a0[_0x04fc('0x19')](_0x157291)[_0x04fc('0x29')](_0x57220a);};}exports[_0x04fc('0x2a')]=function(_0x42e516,_0x5c4250){var _0x1aab0a={},_0x13b582={},_0x270a56={'count':0x0,'rows':[]};var _0x477b8c=_[_0x04fc('0x2b')](db[_0x04fc('0x2c')][_0x04fc('0x2d')],function(_0x4dce03){return{'name':_0x4dce03[_0x04fc('0x2e')],'type':_0x4dce03[_0x04fc('0x2f')][_0x04fc('0x30')]};});_0x13b582['model']=_['map'](_0x477b8c,_0x04fc('0x28'));_0x13b582['query']=_[_0x04fc('0x31')](_0x42e516['query']);_0x13b582['filters']=_[_0x04fc('0x32')](_0x13b582[_0x04fc('0x33')],_0x13b582[_0x04fc('0x34')]);_0x1aab0a[_0x04fc('0x35')]=_[_0x04fc('0x32')](_0x13b582[_0x04fc('0x33')],qs['fields'](_0x42e516[_0x04fc('0x34')][_0x04fc('0x36')]));_0x1aab0a['attributes']=_0x1aab0a[_0x04fc('0x35')][_0x04fc('0x37')]?_0x1aab0a[_0x04fc('0x35')]:_0x13b582['model'];if(!_0x42e516[_0x04fc('0x34')][_0x04fc('0x38')](_0x04fc('0x39'))){_0x1aab0a[_0x04fc('0x1d')]=qs['limit'](_0x42e516[_0x04fc('0x34')]['limit']);_0x1aab0a[_0x04fc('0x1b')]=qs[_0x04fc('0x1b')](_0x42e516[_0x04fc('0x34')][_0x04fc('0x1b')]);}_0x1aab0a[_0x04fc('0x3a')]=qs[_0x04fc('0x3b')](_0x42e516[_0x04fc('0x34')][_0x04fc('0x3b')]);_0x1aab0a[_0x04fc('0x3c')]=qs[_0x04fc('0x3d')](_[_0x04fc('0x3e')](_0x42e516['query'],_0x13b582['filters']),_0x477b8c);if(_0x42e516[_0x04fc('0x34')][_0x04fc('0x3f')]){_0x1aab0a['where']=_['merge'](_0x1aab0a[_0x04fc('0x3c')],{'$or':_[_0x04fc('0x2b')](_0x477b8c,function(_0x360bc6){if(_0x360bc6[_0x04fc('0x2f')]!==_0x04fc('0x40')){var _0x3985c6={};_0x3985c6[_0x360bc6[_0x04fc('0x28')]]={'$like':'%'+_0x42e516['query'][_0x04fc('0x3f')]+'%'};return _0x3985c6;}})});}_0x1aab0a=_['merge']({},_0x1aab0a,_0x42e516[_0x04fc('0x41')]);var _0x56ccba={'where':_0x1aab0a[_0x04fc('0x3c')]};return db[_0x04fc('0x2c')]['count'](_0x56ccba)[_0x04fc('0x23')](function(_0x204a38){_0x270a56['count']=_0x204a38;if(_0x42e516[_0x04fc('0x34')][_0x04fc('0x42')]){_0x1aab0a['include']=[{'all':!![]}];}return db[_0x04fc('0x2c')]['findAll'](_0x1aab0a);})[_0x04fc('0x23')](function(_0x5895a4){_0x270a56[_0x04fc('0x43')]=_0x5895a4;return _0x270a56;})[_0x04fc('0x23')](respondWithFilteredResult(_0x5c4250,_0x1aab0a))[_0x04fc('0x44')](handleError(_0x5c4250,null));};exports['show']=function(_0x23fd08,_0x385296){var _0x81e040={'raw':!![],'where':{'id':_0x23fd08[_0x04fc('0x45')]['id']}},_0x9426d={};_0x9426d['model']=_['keys'](db[_0x04fc('0x2c')][_0x04fc('0x2d')]);_0x9426d['query']=_[_0x04fc('0x31')](_0x23fd08['query']);_0x9426d[_0x04fc('0x3d')]=_[_0x04fc('0x32')](_0x9426d[_0x04fc('0x33')],_0x9426d[_0x04fc('0x34')]);_0x81e040[_0x04fc('0x35')]=_[_0x04fc('0x32')](_0x9426d['model'],qs[_0x04fc('0x36')](_0x23fd08['query'][_0x04fc('0x36')]));_0x81e040['attributes']=_0x81e040[_0x04fc('0x35')][_0x04fc('0x37')]?_0x81e040['attributes']:_0x9426d[_0x04fc('0x33')];if(_0x23fd08[_0x04fc('0x34')][_0x04fc('0x42')]){_0x81e040[_0x04fc('0x46')]=[{'all':!![]}];}_0x81e040=_['merge']({},_0x81e040,_0x23fd08[_0x04fc('0x41')]);return db[_0x04fc('0x2c')][_0x04fc('0x47')](_0x81e040)[_0x04fc('0x23')](handleEntityNotFound(_0x385296,null))[_0x04fc('0x23')](respondWithResult(_0x385296,null))[_0x04fc('0x44')](handleError(_0x385296,null));};exports['create']=function(_0x19bca2,_0x599195){return db[_0x04fc('0x2c')][_0x04fc('0x48')](_0x19bca2[_0x04fc('0x49')],{})[_0x04fc('0x23')](function(_0x2dc1b4){var _0x3d745d=_0x19bca2[_0x04fc('0x4a')]['get']({'plain':!![]});if(!_0x3d745d)throw new Error(_0x04fc('0x4b'));if(_0x3d745d[_0x04fc('0x4c')]===_0x04fc('0x4a')){var _0x4583d1=_0x2dc1b4[_0x04fc('0x25')]({'plain':!![]});var _0xadd99e='CmContactHasItems';return db[_0x04fc('0x4d')]['find']({'where':{'name':_0xadd99e,'userProfileId':_0x3d745d[_0x04fc('0x4e')]},'raw':!![]})['then'](function(_0xc0537b){if(_0xc0537b&&_0xc0537b[_0x04fc('0x4f')]===0x0){return db[_0x04fc('0x26')][_0x04fc('0x48')]({'name':_0x4583d1[_0x04fc('0x28')],'resourceId':_0x4583d1['id'],'type':_0xc0537b[_0x04fc('0x28')],'sectionId':_0xc0537b['id']},{})[_0x04fc('0x23')](function(){return _0x2dc1b4;});}else{return _0x2dc1b4;}})['catch'](function(_0x5a4a25){logger[_0x04fc('0x50')](_0x04fc('0x51'),_0x5a4a25);throw _0x5a4a25;});}return _0x2dc1b4;})[_0x04fc('0x23')](respondWithResult(_0x599195,0xc9))[_0x04fc('0x44')](handleError(_0x599195,null));};exports['update']=function(_0x3b29f2,_0x5f271c){if(_0x3b29f2['body']['id']){delete _0x3b29f2['body']['id'];}return db[_0x04fc('0x2c')][_0x04fc('0x47')]({'where':{'id':_0x3b29f2['params']['id']}})[_0x04fc('0x23')](handleEntityNotFound(_0x5f271c,null))[_0x04fc('0x23')](saveUpdates(_0x3b29f2[_0x04fc('0x49')],null))[_0x04fc('0x23')](respondWithResult(_0x5f271c,null))['catch'](handleError(_0x5f271c,null));};exports['destroy']=function(_0x3fd66d,_0x20b615){return db[_0x04fc('0x2c')]['find']({'where':{'id':_0x3fd66d[_0x04fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x20b615,null))['then'](removeEntity(_0x20b615,null))[_0x04fc('0x44')](handleError(_0x20b615,null));}; \ No newline at end of file +var _0x6d5f=['save','update','then','destroy','get','CmContactHasItems','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','util','path','sox','fs-extra','lodash','squel','jsforce','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3d728b,_0x4df88c){var _0x51c91e=function(_0x590b62){while(--_0x590b62){_0x3d728b['push'](_0x3d728b['shift']());}};_0x51c91e(++_0x4df88c);}(_0x6d5f,0x129));var _0xf6d5=function(_0xdfe3bd,_0x2e52e5){_0xdfe3bd=_0xdfe3bd-0x0;var _0x3ddcd2=_0x6d5f[_0xdfe3bd];return _0x3ddcd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf6d5('0x0'));var jsonpatch=require(_0xf6d5('0x1'));var rp=require(_0xf6d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6d5('0x3'));var path=require(_0xf6d5('0x4'));var sox=require(_0xf6d5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6d5('0x6'));var _=require(_0xf6d5('0x7'));var squel=require(_0xf6d5('0x8'));var crypto=require('crypto');var jsforce=require(_0xf6d5('0x9'));var deskjs=require(_0xf6d5('0xa'));var toCsv=require(_0xf6d5('0xb'));var querystring=require('querystring');var Papa=require(_0xf6d5('0xc'));var Redis=require(_0xf6d5('0xd'));var authService=require(_0xf6d5('0xe'));var qs=require(_0xf6d5('0xf'));var as=require(_0xf6d5('0x10'));var hardwareService=require(_0xf6d5('0x11'));var logger=require(_0xf6d5('0x12'))(_0xf6d5('0x13'));var utils=require(_0xf6d5('0x14'));var config=require(_0xf6d5('0x15'));var licenseUtil=require(_0xf6d5('0x16'));var db=require(_0xf6d5('0x17'))['db'];function respondWithStatusCode(_0x4fddb0,_0x5545bc){_0x5545bc=_0x5545bc||0xcc;return function(_0x366a9c){if(_0x366a9c){return _0x4fddb0[_0xf6d5('0x18')](_0x5545bc);}return _0x4fddb0['status'](_0x5545bc)['end']();};}function respondWithResult(_0x22a2a4,_0x5856d6){_0x5856d6=_0x5856d6||0xc8;return function(_0x56fe7e){if(_0x56fe7e){return _0x22a2a4[_0xf6d5('0x19')](_0x5856d6)[_0xf6d5('0x1a')](_0x56fe7e);}};}function respondWithFilteredResult(_0x367a34,_0x37a746){return function(_0x6f48d8){if(_0x6f48d8){var _0xd81bbf=typeof _0x37a746[_0xf6d5('0x1b')]===_0xf6d5('0x1c')&&typeof _0x37a746[_0xf6d5('0x1d')]===_0xf6d5('0x1c');var _0x1a73d1=_0x6f48d8['count'];var _0x270689=_0xd81bbf?0x0:_0x37a746[_0xf6d5('0x1b')];var _0x413756=_0xd81bbf?_0x6f48d8[_0xf6d5('0x1e')]:_0x37a746[_0xf6d5('0x1b')]+_0x37a746['limit'];var _0x245e21;if(_0x413756>=_0x1a73d1){_0x413756=_0x1a73d1;_0x245e21=0xc8;}else{_0x245e21=0xce;}_0x367a34[_0xf6d5('0x19')](_0x245e21);return _0x367a34[_0xf6d5('0x1f')](_0xf6d5('0x20'),_0x270689+'-'+_0x413756+'/'+_0x1a73d1)[_0xf6d5('0x1a')](_0x6f48d8);}return null;};}function patchUpdates(_0x55ed68){return function(_0x1298e0){try{jsonpatch[_0xf6d5('0x21')](_0x1298e0,_0x55ed68,!![]);}catch(_0x40bed7){return BPromise[_0xf6d5('0x22')](_0x40bed7);}return _0x1298e0[_0xf6d5('0x23')]();};}function saveUpdates(_0x2554de,_0x50ac61){return function(_0x5d17a8){if(_0x5d17a8){return _0x5d17a8[_0xf6d5('0x24')](_0x2554de)[_0xf6d5('0x25')](function(_0x408f52){return _0x408f52;});}return null;};}function removeEntity(_0x4a6846,_0x2af448){return function(_0x2d9057){if(_0x2d9057){return _0x2d9057[_0xf6d5('0x26')]()[_0xf6d5('0x25')](function(){var _0x1fb086=_0x2d9057[_0xf6d5('0x27')]({'plain':!![]});var _0x299b9e=_0xf6d5('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x299b9e,'resourceId':_0x1fb086['id']}})[_0xf6d5('0x25')](function(){return _0x2d9057;});})[_0xf6d5('0x25')](function(){_0x4a6846[_0xf6d5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eaf86,_0x554769){return function(_0x1a97d8){if(!_0x1a97d8){_0x2eaf86[_0xf6d5('0x18')](0x194);}return _0x1a97d8;};}function handleError(_0x262ff5,_0x198651){_0x198651=_0x198651||0x1f4;return function(_0x3556cb){logger['error'](_0x3556cb['stack']);if(_0x3556cb[_0xf6d5('0x29')]){delete _0x3556cb[_0xf6d5('0x29')];}_0x262ff5[_0xf6d5('0x19')](_0x198651)[_0xf6d5('0x2a')](_0x3556cb);};}exports['index']=function(_0x410825,_0x49a0a2){var _0x2e55a5={},_0x43e1d0={},_0x3ef214={'count':0x0,'rows':[]};var _0x21cea9=_[_0xf6d5('0x2b')](db[_0xf6d5('0x2c')][_0xf6d5('0x2d')],function(_0x56bbc1){return{'name':_0x56bbc1[_0xf6d5('0x2e')],'type':_0x56bbc1[_0xf6d5('0x2f')][_0xf6d5('0x30')]};});_0x43e1d0[_0xf6d5('0x31')]=_[_0xf6d5('0x2b')](_0x21cea9,_0xf6d5('0x29'));_0x43e1d0[_0xf6d5('0x32')]=_[_0xf6d5('0x33')](_0x410825[_0xf6d5('0x32')]);_0x43e1d0[_0xf6d5('0x34')]=_['intersection'](_0x43e1d0[_0xf6d5('0x31')],_0x43e1d0[_0xf6d5('0x32')]);_0x2e55a5[_0xf6d5('0x35')]=_[_0xf6d5('0x36')](_0x43e1d0[_0xf6d5('0x31')],qs[_0xf6d5('0x37')](_0x410825[_0xf6d5('0x32')][_0xf6d5('0x37')]));_0x2e55a5[_0xf6d5('0x35')]=_0x2e55a5[_0xf6d5('0x35')][_0xf6d5('0x38')]?_0x2e55a5[_0xf6d5('0x35')]:_0x43e1d0[_0xf6d5('0x31')];if(!_0x410825['query']['hasOwnProperty'](_0xf6d5('0x39'))){_0x2e55a5[_0xf6d5('0x1d')]=qs[_0xf6d5('0x1d')](_0x410825[_0xf6d5('0x32')]['limit']);_0x2e55a5[_0xf6d5('0x1b')]=qs[_0xf6d5('0x1b')](_0x410825[_0xf6d5('0x32')]['offset']);}_0x2e55a5[_0xf6d5('0x3a')]=qs[_0xf6d5('0x3b')](_0x410825[_0xf6d5('0x32')][_0xf6d5('0x3b')]);_0x2e55a5[_0xf6d5('0x3c')]=qs['filters'](_[_0xf6d5('0x3d')](_0x410825[_0xf6d5('0x32')],_0x43e1d0[_0xf6d5('0x34')]),_0x21cea9);if(_0x410825[_0xf6d5('0x32')]['filter']){_0x2e55a5[_0xf6d5('0x3c')]=_[_0xf6d5('0x3e')](_0x2e55a5['where'],{'$or':_[_0xf6d5('0x2b')](_0x21cea9,function(_0x2e30a4){if(_0x2e30a4[_0xf6d5('0x2f')]!==_0xf6d5('0x3f')){var _0x3f73c3={};_0x3f73c3[_0x2e30a4['name']]={'$like':'%'+_0x410825[_0xf6d5('0x32')][_0xf6d5('0x40')]+'%'};return _0x3f73c3;}})});}_0x2e55a5=_[_0xf6d5('0x3e')]({},_0x2e55a5,_0x410825[_0xf6d5('0x41')]);var _0x50f2ec={'where':_0x2e55a5[_0xf6d5('0x3c')]};return db[_0xf6d5('0x2c')][_0xf6d5('0x1e')](_0x50f2ec)[_0xf6d5('0x25')](function(_0x4f0be6){_0x3ef214[_0xf6d5('0x1e')]=_0x4f0be6;if(_0x410825[_0xf6d5('0x32')][_0xf6d5('0x42')]){_0x2e55a5[_0xf6d5('0x43')]=[{'all':!![]}];}return db[_0xf6d5('0x2c')][_0xf6d5('0x44')](_0x2e55a5);})[_0xf6d5('0x25')](function(_0x49687c){_0x3ef214[_0xf6d5('0x45')]=_0x49687c;return _0x3ef214;})[_0xf6d5('0x25')](respondWithFilteredResult(_0x49a0a2,_0x2e55a5))['catch'](handleError(_0x49a0a2,null));};exports[_0xf6d5('0x46')]=function(_0x3c8990,_0x31f182){var _0x9fb4c9={'raw':!![],'where':{'id':_0x3c8990[_0xf6d5('0x47')]['id']}},_0x30ec83={};_0x30ec83[_0xf6d5('0x31')]=_[_0xf6d5('0x33')](db[_0xf6d5('0x2c')][_0xf6d5('0x2d')]);_0x30ec83[_0xf6d5('0x32')]=_['keys'](_0x3c8990['query']);_0x30ec83[_0xf6d5('0x34')]=_[_0xf6d5('0x36')](_0x30ec83[_0xf6d5('0x31')],_0x30ec83[_0xf6d5('0x32')]);_0x9fb4c9[_0xf6d5('0x35')]=_[_0xf6d5('0x36')](_0x30ec83[_0xf6d5('0x31')],qs[_0xf6d5('0x37')](_0x3c8990[_0xf6d5('0x32')]['fields']));_0x9fb4c9[_0xf6d5('0x35')]=_0x9fb4c9[_0xf6d5('0x35')][_0xf6d5('0x38')]?_0x9fb4c9[_0xf6d5('0x35')]:_0x30ec83[_0xf6d5('0x31')];if(_0x3c8990[_0xf6d5('0x32')][_0xf6d5('0x42')]){_0x9fb4c9[_0xf6d5('0x43')]=[{'all':!![]}];}_0x9fb4c9=_['merge']({},_0x9fb4c9,_0x3c8990[_0xf6d5('0x41')]);return db[_0xf6d5('0x2c')]['find'](_0x9fb4c9)['then'](handleEntityNotFound(_0x31f182,null))['then'](respondWithResult(_0x31f182,null))['catch'](handleError(_0x31f182,null));};exports['create']=function(_0x160628,_0x35b920){return db[_0xf6d5('0x2c')][_0xf6d5('0x48')](_0x160628[_0xf6d5('0x49')],{})[_0xf6d5('0x25')](function(_0x27f14b){var _0x410617=_0x160628['user'][_0xf6d5('0x27')]({'plain':!![]});if(!_0x410617)throw new Error(_0xf6d5('0x4a'));if(_0x410617[_0xf6d5('0x4b')]==='user'){var _0x3a2f97=_0x27f14b[_0xf6d5('0x27')]({'plain':!![]});var _0x46e853=_0xf6d5('0x28');return db[_0xf6d5('0x4c')]['find']({'where':{'name':_0x46e853,'userProfileId':_0x410617['userProfileId']},'raw':!![]})[_0xf6d5('0x25')](function(_0x15eb07){if(_0x15eb07&&_0x15eb07[_0xf6d5('0x4d')]===0x0){return db[_0xf6d5('0x4e')][_0xf6d5('0x48')]({'name':_0x3a2f97['name'],'resourceId':_0x3a2f97['id'],'type':_0x15eb07[_0xf6d5('0x29')],'sectionId':_0x15eb07['id']},{})['then'](function(){return _0x27f14b;});}else{return _0x27f14b;}})[_0xf6d5('0x4f')](function(_0x3e6ca9){logger[_0xf6d5('0x50')](_0xf6d5('0x51'),_0x3e6ca9);throw _0x3e6ca9;});}return _0x27f14b;})[_0xf6d5('0x25')](respondWithResult(_0x35b920,0xc9))['catch'](handleError(_0x35b920,null));};exports[_0xf6d5('0x24')]=function(_0x323937,_0x4f1fee){if(_0x323937[_0xf6d5('0x49')]['id']){delete _0x323937[_0xf6d5('0x49')]['id'];}return db[_0xf6d5('0x2c')][_0xf6d5('0x52')]({'where':{'id':_0x323937[_0xf6d5('0x47')]['id']}})[_0xf6d5('0x25')](handleEntityNotFound(_0x4f1fee,null))['then'](saveUpdates(_0x323937['body'],null))[_0xf6d5('0x25')](respondWithResult(_0x4f1fee,null))[_0xf6d5('0x4f')](handleError(_0x4f1fee,null));};exports[_0xf6d5('0x26')]=function(_0x385ad7,_0x4f6917){return db['CmContactHasItem'][_0xf6d5('0x52')]({'where':{'id':_0x385ad7[_0xf6d5('0x47')]['id']}})[_0xf6d5('0x25')](handleEntityNotFound(_0x4f6917,null))[_0xf6d5('0x25')](removeEntity(_0x4f6917,null))[_0xf6d5('0x4f')](handleError(_0x4f6917,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2bc41d9..e717834 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb62=['define','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x5f108e,_0x4bfd98){var _0x54a18c=function(_0x8be94){while(--_0x8be94){_0x5f108e['push'](_0x5f108e['shift']());}};_0x54a18c(++_0x4bfd98);}(_0xfb62,0xec));var _0x2fb6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfb62[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2fb6('0x0'));var util=require(_0x2fb6('0x1'));var logger=require(_0x2fb6('0x2'))(_0x2fb6('0x3'));var moment=require(_0x2fb6('0x4'));var BPromise=require(_0x2fb6('0x5'));var rp=require(_0x2fb6('0x6'));var fs=require('fs');var path=require(_0x2fb6('0x7'));var rimraf=require(_0x2fb6('0x8'));var config=require(_0x2fb6('0x9'));var attributes=require(_0x2fb6('0xa'));module['exports']=function(_0xa8185e,_0x1fdf53){return _0xa8185e[_0x2fb6('0xb')]('CmContactHasItem',attributes,{'tableName':_0x2fb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35cf=['bluebird','path','rimraf','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','../../config/logger','moment'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x35cf,0x16f));var _0xf35c=function(_0x42546d,_0x4b060a){_0x42546d=_0x42546d-0x0;var _0x5cac5b=_0x35cf[_0x42546d];return _0x5cac5b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf35c('0x0'))('api');var moment=require(_0xf35c('0x1'));var BPromise=require(_0xf35c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf35c('0x3'));var rimraf=require(_0xf35c('0x4'));var config=require('../../config/environment');var attributes=require(_0xf35c('0x5'));module[_0xf35c('0x6')]=function(_0x19314c,_0x275e88){return _0x19314c[_0xf35c('0x7')]('CmContactHasItem',attributes,{'tableName':_0xf35c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 5032295..c646cf2 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x573c=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x573c,0x1b4));var _0xc573=function(_0x1bcf1f,_0x4bbe6a){_0x1bcf1f=_0x1bcf1f-0x0;var _0x479e97=_0x573c[_0x1bcf1f];return _0x479e97;};'use strict';var _=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var moment=require(_0xc573('0x2'));var BPromise=require(_0xc573('0x3'));var rs=require(_0xc573('0x4'));var fs=require('fs');var Redis=require(_0xc573('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc573('0x6'));var logger=require(_0xc573('0x7'))(_0xc573('0x8'));var config=require(_0xc573('0x9'));var jayson=require(_0xc573('0xa'));var client=jayson['client'][_0xc573('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9275,_0x29091d,_0x17a331){return new BPromise(function(_0x44e538,_0x255fe2){return client[_0xc573('0xc')](_0x2a9275,_0x17a331)[_0xc573('0xd')](function(_0x24c8f6){logger[_0xc573('0xe')](_0xc573('0xf'),_0x29091d,_0xc573('0x10'));logger[_0xc573('0x11')](_0xc573('0x12'),_0x29091d,_0xc573('0x10'),JSON[_0xc573('0x13')](_0x24c8f6));if(_0x24c8f6['error']){if(_0x24c8f6['error'][_0xc573('0x14')]===0x1f4){logger[_0xc573('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x29091d,_0x24c8f6[_0xc573('0x15')][_0xc573('0x16')]);return _0x255fe2(_0x24c8f6[_0xc573('0x15')][_0xc573('0x16')]);}logger[_0xc573('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x29091d,_0x24c8f6['error']['message']);return _0x44e538(_0x24c8f6['error'][_0xc573('0x16')]);}else{logger[_0xc573('0xe')](_0xc573('0xf'),_0x29091d,_0xc573('0x10'));_0x44e538(_0x24c8f6[_0xc573('0x17')][_0xc573('0x16')]);}})[_0xc573('0x18')](function(_0x3c4377){logger[_0xc573('0x15')](_0xc573('0xf'),_0x29091d,_0x3c4377);_0x255fe2(_0x3c4377);});});} \ No newline at end of file +var _0x61ac=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x275121,_0x4911b8){var _0x377f1c=function(_0x114fe7){while(--_0x114fe7){_0x275121['push'](_0x275121['shift']());}};_0x377f1c(++_0x4911b8);}(_0x61ac,0x115));var _0xc61a=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0x61ac[_0x28e71a];return _0x268fed;};'use strict';var _=require(_0xc61a('0x0'));var util=require(_0xc61a('0x1'));var moment=require(_0xc61a('0x2'));var BPromise=require(_0xc61a('0x3'));var rs=require(_0xc61a('0x4'));var fs=require('fs');var Redis=require(_0xc61a('0x5'));var db=require(_0xc61a('0x6'))['db'];var utils=require(_0xc61a('0x7'));var logger=require(_0xc61a('0x8'))(_0xc61a('0x9'));var config=require(_0xc61a('0xa'));var jayson=require(_0xc61a('0xb'));var client=jayson[_0xc61a('0xc')][_0xc61a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3dd37c,_0x18fc93,_0xd8e955){return new BPromise(function(_0x2511a4,_0x26e581){return client[_0xc61a('0xe')](_0x3dd37c,_0xd8e955)[_0xc61a('0xf')](function(_0x53ae80){logger[_0xc61a('0x10')](_0xc61a('0x11'),_0x18fc93,_0xc61a('0x12'));logger[_0xc61a('0x13')](_0xc61a('0x14'),_0x18fc93,_0xc61a('0x12'),JSON[_0xc61a('0x15')](_0x53ae80));if(_0x53ae80['error']){if(_0x53ae80['error'][_0xc61a('0x16')]===0x1f4){logger[_0xc61a('0x17')]('CmContactHasItem,\x20%s,\x20%s',_0x18fc93,_0x53ae80[_0xc61a('0x17')][_0xc61a('0x18')]);return _0x26e581(_0x53ae80['error'][_0xc61a('0x18')]);}logger[_0xc61a('0x17')](_0xc61a('0x11'),_0x18fc93,_0x53ae80[_0xc61a('0x17')]['message']);return _0x2511a4(_0x53ae80['error'][_0xc61a('0x18')]);}else{logger[_0xc61a('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x18fc93,'request\x20sent');_0x2511a4(_0x53ae80[_0xc61a('0x19')][_0xc61a('0x18')]);}})[_0xc61a('0x1a')](function(_0x4a14f0){logger[_0xc61a('0x17')](_0xc61a('0x11'),_0x18fc93,_0x4a14f0);_0x26e581(_0x4a14f0);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1914227..d1d3481 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e2=['post','create','put','update','delete','util','path','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ae4ab,_0x1829bf){var _0x1ae9b1=function(_0x334ea0){while(--_0x334ea0){_0x4ae4ab['push'](_0x4ae4ab['shift']());}};_0x1ae9b1(++_0x1829bf);}(_0xa9e2,0x1e5));var _0x2a9e=function(_0x130d5a,_0x28ab74){_0x130d5a=_0x130d5a-0x0;var _0x3f73a7=_0xa9e2[_0x130d5a];return _0x3f73a7;};'use strict';var multer=require('multer');var util=require(_0x2a9e('0x0'));var path=require(_0x2a9e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2a9e('0x3'));var config=require(_0x2a9e('0x4'));var controller=require(_0x2a9e('0x5'));router[_0x2a9e('0x6')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0x8')]);router['get'](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xa')]);router[_0x2a9e('0xb')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xc')]);router[_0x2a9e('0xd')](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xe')]);router[_0x2a9e('0xf')]('/:id',auth[_0x2a9e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c07=['isAuthenticated','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index'];(function(_0x4b7fa3,_0x37b15b){var _0x2b9ad5=function(_0x3f5c73){while(--_0x3f5c73){_0x4b7fa3['push'](_0x4b7fa3['shift']());}};_0x2b9ad5(++_0x37b15b);}(_0x0c07,0x8b));var _0x70c0=function(_0xac3b20,_0x48e68c){_0xac3b20=_0xac3b20-0x0;var _0x580caf=_0x0c07[_0xac3b20];return _0x580caf;};'use strict';var multer=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var path=require(_0x70c0('0x2'));var timeout=require(_0x70c0('0x3'));var express=require(_0x70c0('0x4'));var router=express[_0x70c0('0x5')]();var fs_extra=require(_0x70c0('0x6'));var auth=require(_0x70c0('0x7'));var interaction=require(_0x70c0('0x8'));var config=require(_0x70c0('0x9'));var controller=require(_0x70c0('0xa'));router[_0x70c0('0xb')]('/',auth['isAuthenticated'](),controller[_0x70c0('0xc')]);router['get']('/:id',auth[_0x70c0('0xd')](),controller[_0x70c0('0xe')]);router[_0x70c0('0xf')]('/',auth[_0x70c0('0xd')](),controller['create']);router[_0x70c0('0x10')]('/:id',auth[_0x70c0('0xd')](),controller['update']);router[_0x70c0('0x11')]('/:id',auth[_0x70c0('0xd')](),controller[_0x70c0('0x12')]);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 4ff3aa9..a0b5582 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 _0xfd9a=['STRING','TEXT','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','exports','VIRTUAL','getDataValue','alias','name'];(function(_0x5f4172,_0x3e100c){var _0x394ab7=function(_0x19f1a6){while(--_0x19f1a6){_0x5f4172['push'](_0x5f4172['shift']());}};_0x394ab7(++_0x3e100c);}(_0xfd9a,0x93));var _0xafd9=function(_0x291dd7,_0x35f002){_0x291dd7=_0x291dd7-0x0;var _0x37cefc=_0xfd9a[_0x291dd7];return _0x37cefc;};'use strict';var Sequelize=require(_0xafd9('0x0'));var _=require('lodash');module[_0xafd9('0x1')]={'name':{'type':Sequelize[_0xafd9('0x2')],'get':function(_0x3b081e){return this[_0xafd9('0x3')](_0xafd9('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x284e3b){this['setDataValue'](_0xafd9('0x4'),_0x284e3b?_0x284e3b:this['getDataValue'](_0xafd9('0x5')));}},'type':{'type':Sequelize[_0xafd9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xafd9('0x7')]('long'),'get':function(){if(this[_0xafd9('0x3')](_0xafd9('0x8'))===_0xafd9('0x9')){return JSON[_0xafd9('0xa')](this[_0xafd9('0x3')](_0xafd9('0xb')));}else{return this[_0xafd9('0x3')](_0xafd9('0xb'));}},'set':function(_0x18a43b){if(Array[_0xafd9('0xc')](_0x18a43b)){this[_0xafd9('0xd')](_0xafd9('0xb'),JSON[_0xafd9('0xe')](_0x18a43b));}else{this[_0xafd9('0xd')]('values',_0x18a43b);}}},'required':{'type':Sequelize[_0xafd9('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xafd9('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xafd9('0x10'))}}; \ No newline at end of file +var _0x5c1c=['name','TEXT','long','type','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias'];(function(_0x203e56,_0x4342b8){var _0xaa6c=function(_0x515a15){while(--_0x515a15){_0x203e56['push'](_0x203e56['shift']());}};_0xaa6c(++_0x4342b8);}(_0x5c1c,0x94));var _0xc5c1=function(_0x1f5021,_0x1a4d42){_0x1f5021=_0x1f5021-0x0;var _0x9ae616=_0x5c1c[_0x1f5021];return _0x9ae616;};'use strict';var Sequelize=require(_0xc5c1('0x0'));var _=require('lodash');module[_0xc5c1('0x1')]={'name':{'type':Sequelize[_0xc5c1('0x2')],'get':function(_0x511ae9){return this[_0xc5c1('0x3')](_0xc5c1('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3e61d4){this['setDataValue'](_0xc5c1('0x4'),_0x3e61d4?_0x3e61d4:this[_0xc5c1('0x3')](_0xc5c1('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc5c1('0x6')](_0xc5c1('0x7')),'get':function(){if(this['getDataValue'](_0xc5c1('0x8'))===_0xc5c1('0x9')){return JSON['parse'](this['getDataValue'](_0xc5c1('0xa')));}else{return this[_0xc5c1('0x3')](_0xc5c1('0xa'));}},'set':function(_0x4af8fd){if(Array[_0xc5c1('0xb')](_0x4af8fd)){this[_0xc5c1('0xc')]('values',JSON[_0xc5c1('0xd')](_0x4af8fd));}else{this[_0xc5c1('0xc')]('values',_0x4af8fd);}}},'required':{'type':Sequelize[_0xc5c1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc5c1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc5c1('0xf')](_0xc5c1('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0f1d8b9..d09c7da 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 _0x2858=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','apply','reject','save','update','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','then','rows','show','params','model','keys','length','includeAll','options','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x7cf3f,_0xe55dd5){var _0x2ccb8f=function(_0x112ba7){while(--_0x112ba7){_0x7cf3f['push'](_0x7cf3f['shift']());}};_0x2ccb8f(++_0xe55dd5);}(_0x2858,0x1ef));var _0x8285=function(_0x5ed928,_0x2dbbdc){_0x5ed928=_0x5ed928-0x0;var _0x2effcc=_0x2858[_0x5ed928];return _0x2effcc;};'use strict';var emlformat=require(_0x8285('0x0'));var rimraf=require(_0x8285('0x1'));var zipdir=require(_0x8285('0x2'));var jsonpatch=require(_0x8285('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8285('0x4'));var path=require(_0x8285('0x5'));var sox=require(_0x8285('0x6'));var csv=require('to-csv');var ejs=require(_0x8285('0x7'));var fs=require('fs');var fs_extra=require(_0x8285('0x8'));var _=require(_0x8285('0x9'));var squel=require('squel');var crypto=require(_0x8285('0xa'));var jsforce=require(_0x8285('0xb'));var deskjs=require(_0x8285('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8285('0xd'));var Redis=require(_0x8285('0xe'));var authService=require(_0x8285('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8285('0x10'));var hardwareService=require(_0x8285('0x11'));var logger=require(_0x8285('0x12'))(_0x8285('0x13'));var utils=require(_0x8285('0x14'));var config=require(_0x8285('0x15'));var licenseUtil=require(_0x8285('0x16'));var db=require(_0x8285('0x17'))['db'];function respondWithStatusCode(_0x123d05,_0x104335){_0x104335=_0x104335||0xcc;return function(_0x11fe23){if(_0x11fe23){return _0x123d05['sendStatus'](_0x104335);}return _0x123d05[_0x8285('0x18')](_0x104335)[_0x8285('0x19')]();};}function respondWithResult(_0x33aa0f,_0x37c370){_0x37c370=_0x37c370||0xc8;return function(_0x5bce91){if(_0x5bce91){return _0x33aa0f[_0x8285('0x18')](_0x37c370)[_0x8285('0x1a')](_0x5bce91);}};}function respondWithFilteredResult(_0x553e70,_0x27ff85){return function(_0x5893eb){if(_0x5893eb){var _0x223f9f=typeof _0x27ff85['offset']==='undefined'&&typeof _0x27ff85[_0x8285('0x1b')]==='undefined';var _0x580cc7=_0x5893eb[_0x8285('0x1c')];var _0x2d44ce=_0x223f9f?0x0:_0x27ff85['offset'];var _0x31da80=_0x223f9f?_0x5893eb[_0x8285('0x1c')]:_0x27ff85['offset']+_0x27ff85[_0x8285('0x1b')];var _0x585a2f;if(_0x31da80>=_0x580cc7){_0x31da80=_0x580cc7;_0x585a2f=0xc8;}else{_0x585a2f=0xce;}_0x553e70[_0x8285('0x18')](_0x585a2f);return _0x553e70['set']('Content-Range',_0x2d44ce+'-'+_0x31da80+'/'+_0x580cc7)[_0x8285('0x1a')](_0x5893eb);}return null;};}function patchUpdates(_0x372dcd){return function(_0x333c9d){try{jsonpatch[_0x8285('0x1d')](_0x333c9d,_0x372dcd,!![]);}catch(_0x10a7a2){return BPromise[_0x8285('0x1e')](_0x10a7a2);}return _0x333c9d[_0x8285('0x1f')]();};}function saveUpdates(_0x29dfaa,_0x4924cf){return function(_0x4a3379){if(_0x4a3379){return _0x4a3379[_0x8285('0x20')](_0x29dfaa)['then'](function(_0x3d9a5c){return _0x3d9a5c;});}return null;};}function removeEntity(_0x59955d,_0x45b2fb){return function(_0x5cc814){if(_0x5cc814){return _0x5cc814[_0x8285('0x21')]()['then'](function(){_0x59955d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167c8c,_0x4ced8d){return function(_0x3ab6df){if(!_0x3ab6df){_0x167c8c['sendStatus'](0x194);}return _0x3ab6df;};}function handleError(_0x2b7dfe,_0x4d666f){_0x4d666f=_0x4d666f||0x1f4;return function(_0xdead27){logger[_0x8285('0x22')](_0xdead27[_0x8285('0x23')]);if(_0xdead27['name']){delete _0xdead27[_0x8285('0x24')];}_0x2b7dfe[_0x8285('0x18')](_0x4d666f)[_0x8285('0x25')](_0xdead27);};}exports[_0x8285('0x26')]=function(_0x3d47df,_0x2bdf86){var _0x505aae={},_0x5820aa={},_0xc1cdf2={'count':0x0,'rows':[]};var _0x5e2d32=_[_0x8285('0x27')](db[_0x8285('0x28')][_0x8285('0x29')],function(_0x53059e){return{'name':_0x53059e[_0x8285('0x2a')],'type':_0x53059e[_0x8285('0x2b')]['key']};});_0x5820aa['model']=_[_0x8285('0x2c')](_[_0x8285('0x27')](_0x5e2d32,_0x8285('0x24')),[_0x8285('0x24')]);_0x5820aa[_0x8285('0x2d')]=_['keys'](_0x3d47df[_0x8285('0x2d')]);_0x5820aa[_0x8285('0x2e')]=_[_0x8285('0x2f')](_0x5820aa['model'],_0x5820aa[_0x8285('0x2d')]);_0x505aae[_0x8285('0x30')]=_[_0x8285('0x2f')](_0x5820aa['model'],qs[_0x8285('0x31')](_0x3d47df[_0x8285('0x2d')]['fields']));_0x505aae[_0x8285('0x30')]=_0x505aae[_0x8285('0x30')]['length']?_0x505aae[_0x8285('0x30')]:_0x5820aa['model'];if(!_0x3d47df[_0x8285('0x2d')][_0x8285('0x32')](_0x8285('0x33'))){_0x505aae[_0x8285('0x1b')]=qs[_0x8285('0x1b')](_0x3d47df[_0x8285('0x2d')][_0x8285('0x1b')]);_0x505aae[_0x8285('0x34')]=qs['offset'](_0x3d47df[_0x8285('0x2d')][_0x8285('0x34')]);}_0x505aae[_0x8285('0x35')]=qs[_0x8285('0x36')](_0x3d47df[_0x8285('0x2d')]['sort']);_0x505aae[_0x8285('0x37')]=qs[_0x8285('0x2e')](_[_0x8285('0x38')](_0x3d47df[_0x8285('0x2d')],_0x5820aa[_0x8285('0x2e')]),_0x5e2d32);if(_0x3d47df['query'][_0x8285('0x39')]){_0x505aae['where']=_[_0x8285('0x3a')](_0x505aae['where'],{'$or':_[_0x8285('0x27')](_0x5e2d32,function(_0x103df2){if(_0x103df2['type']!=='VIRTUAL'){var _0x5641f0={};_0x5641f0[_0x103df2['name']]={'$like':'%'+_0x3d47df[_0x8285('0x2d')][_0x8285('0x39')]+'%'};return _0x5641f0;}})});}_0x505aae=_[_0x8285('0x3a')]({},_0x505aae,_0x3d47df['options']);var _0x466d64={'where':_0x505aae[_0x8285('0x37')]};return db['CmCustomField'][_0x8285('0x1c')](_0x466d64)[_0x8285('0x3b')](function(_0x5c0508){_0xc1cdf2[_0x8285('0x1c')]=_0x5c0508;if(_0x3d47df[_0x8285('0x2d')]['includeAll']){_0x505aae['include']=[{'all':!![]}];}return db[_0x8285('0x28')]['findAll'](_0x505aae);})[_0x8285('0x3b')](function(_0x48b501){_0xc1cdf2[_0x8285('0x3c')]=_0x48b501;return _0xc1cdf2;})[_0x8285('0x3b')](respondWithFilteredResult(_0x2bdf86,_0x505aae))['catch'](handleError(_0x2bdf86,null));};exports[_0x8285('0x3d')]=function(_0x2a4133,_0x47d61c){var _0x375b8c={'raw':!![],'where':{'id':_0x2a4133[_0x8285('0x3e')]['id']}},_0x22b3bb={};_0x22b3bb[_0x8285('0x3f')]=_[_0x8285('0x40')](db[_0x8285('0x28')]['rawAttributes']);_0x22b3bb[_0x8285('0x2d')]=_['keys'](_0x2a4133[_0x8285('0x2d')]);_0x22b3bb[_0x8285('0x2e')]=_[_0x8285('0x2f')](_0x22b3bb[_0x8285('0x3f')],_0x22b3bb['query']);_0x375b8c[_0x8285('0x30')]=_['intersection'](_0x22b3bb[_0x8285('0x3f')],qs[_0x8285('0x31')](_0x2a4133['query'][_0x8285('0x31')]));_0x375b8c[_0x8285('0x30')]=_0x375b8c[_0x8285('0x30')][_0x8285('0x41')]?_0x375b8c[_0x8285('0x30')]:_0x22b3bb[_0x8285('0x3f')];if(_0x2a4133[_0x8285('0x2d')][_0x8285('0x42')]){_0x375b8c['include']=[{'all':!![]}];}_0x375b8c=_[_0x8285('0x3a')]({},_0x375b8c,_0x2a4133[_0x8285('0x43')]);return db[_0x8285('0x28')]['find'](_0x375b8c)['then'](handleEntityNotFound(_0x47d61c,null))[_0x8285('0x3b')](respondWithResult(_0x47d61c,null))[_0x8285('0x44')](handleError(_0x47d61c,null));};exports[_0x8285('0x20')]=function(_0x331e8a,_0x9d02eb){if(_0x331e8a['body']['id']){delete _0x331e8a[_0x8285('0x45')]['id'];}return db[_0x8285('0x28')][_0x8285('0x46')]({'where':{'id':_0x331e8a[_0x8285('0x3e')]['id']}})['then'](handleEntityNotFound(_0x9d02eb,null))[_0x8285('0x3b')](saveUpdates(_0x331e8a[_0x8285('0x45')],null))['then'](respondWithResult(_0x9d02eb,null))[_0x8285('0x44')](handleError(_0x9d02eb,null));};exports[_0x8285('0x21')]=function(_0x268a54,_0x56a6eb){return db[_0x8285('0x28')][_0x8285('0x46')]({'where':{'id':_0x268a54[_0x8285('0x3e')]['id']}})[_0x8285('0x3b')](handleEntityNotFound(_0x56a6eb,null))[_0x8285('0x3b')](removeEntity(_0x56a6eb,null))['catch'](handleError(_0x56a6eb,null));};exports[_0x8285('0x47')]=function(_0x15b360,_0x10b6a9){var _0x368359;return db[_0x8285('0x48')][_0x8285('0x49')](function(_0x1addfa){return db['CmCustomField'][_0x8285('0x47')](_0x15b360[_0x8285('0x45')],{'transaction':_0x1addfa})[_0x8285('0x3b')](function(_0x5cd542){_0x368359=_0x5cd542;var _0x38c1d5={'type':db[_0x8285('0x4a')][_0x8285('0x4b')],'transaction':_0x1addfa};switch(_0x15b360[_0x8285('0x45')][_0x8285('0x2b')]){case _0x8285('0x4c'):_0x38c1d5['type']=db[_0x8285('0x4a')]['TEXT'];break;case _0x8285('0x4d'):_0x38c1d5[_0x8285('0x2b')]=db['Sequelize'][_0x8285('0x4e')];break;case _0x8285('0x4f'):_0x38c1d5['type']=db['Sequelize'][_0x8285('0x50')];_0x38c1d5[_0x8285('0x51')]=![];break;default:}return db[_0x8285('0x48')]['queryInterface'][_0x8285('0x52')](_0x8285('0x53'),util[_0x8285('0x54')](_0x8285('0x55'),_0x368359['id']),_0x38c1d5);})[_0x8285('0x3b')](function(){return _0x368359;});})[_0x8285('0x3b')](respondWithResult(_0x10b6a9,0xc9))[_0x8285('0x44')](handleError(_0x10b6a9,null));}; \ No newline at end of file +var _0x6747=['update','then','destroy','end','sendStatus','error','name','index','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','CmCustomField','includeAll','include','rows','catch','show','find','body','params','Sequelize','TEXT','type','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6747,0x8a));var _0x7674=function(_0x1c66d8,_0x16d85d){_0x1c66d8=_0x1c66d8-0x0;var _0xf1cc0a=_0x6747[_0x1c66d8];return _0xf1cc0a;};'use strict';var emlformat=require(_0x7674('0x0'));var rimraf=require(_0x7674('0x1'));var zipdir=require(_0x7674('0x2'));var jsonpatch=require(_0x7674('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7674('0x4'));var Mustache=require(_0x7674('0x5'));var util=require(_0x7674('0x6'));var path=require(_0x7674('0x7'));var sox=require(_0x7674('0x8'));var csv=require(_0x7674('0x9'));var ejs=require(_0x7674('0xa'));var fs=require('fs');var fs_extra=require(_0x7674('0xb'));var _=require('lodash');var squel=require(_0x7674('0xc'));var crypto=require(_0x7674('0xd'));var jsforce=require(_0x7674('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7674('0x9'));var querystring=require('querystring');var Papa=require(_0x7674('0xf'));var Redis=require('ioredis');var authService=require(_0x7674('0x10'));var qs=require(_0x7674('0x11'));var as=require(_0x7674('0x12'));var hardwareService=require(_0x7674('0x13'));var logger=require(_0x7674('0x14'))('api');var utils=require(_0x7674('0x15'));var config=require(_0x7674('0x16'));var licenseUtil=require(_0x7674('0x17'));var db=require(_0x7674('0x18'))['db'];function respondWithStatusCode(_0x533443,_0x5ea727){_0x5ea727=_0x5ea727||0xcc;return function(_0x5000ba){if(_0x5000ba){return _0x533443['sendStatus'](_0x5ea727);}return _0x533443['status'](_0x5ea727)['end']();};}function respondWithResult(_0x3418c1,_0x45abdc){_0x45abdc=_0x45abdc||0xc8;return function(_0x51150d){if(_0x51150d){return _0x3418c1[_0x7674('0x19')](_0x45abdc)[_0x7674('0x1a')](_0x51150d);}};}function respondWithFilteredResult(_0x589f26,_0x343df3){return function(_0x1cf514){if(_0x1cf514){var _0xde3bef=typeof _0x343df3[_0x7674('0x1b')]===_0x7674('0x1c')&&typeof _0x343df3[_0x7674('0x1d')]===_0x7674('0x1c');var _0x1631be=_0x1cf514[_0x7674('0x1e')];var _0x4fadee=_0xde3bef?0x0:_0x343df3[_0x7674('0x1b')];var _0x583d94=_0xde3bef?_0x1cf514['count']:_0x343df3['offset']+_0x343df3[_0x7674('0x1d')];var _0x53dab6;if(_0x583d94>=_0x1631be){_0x583d94=_0x1631be;_0x53dab6=0xc8;}else{_0x53dab6=0xce;}_0x589f26[_0x7674('0x19')](_0x53dab6);return _0x589f26[_0x7674('0x1f')](_0x7674('0x20'),_0x4fadee+'-'+_0x583d94+'/'+_0x1631be)[_0x7674('0x1a')](_0x1cf514);}return null;};}function patchUpdates(_0x17e65d){return function(_0x10eafe){try{jsonpatch[_0x7674('0x21')](_0x10eafe,_0x17e65d,!![]);}catch(_0x51a318){return BPromise[_0x7674('0x22')](_0x51a318);}return _0x10eafe[_0x7674('0x23')]();};}function saveUpdates(_0x5a797e,_0x27b306){return function(_0x55dee0){if(_0x55dee0){return _0x55dee0[_0x7674('0x24')](_0x5a797e)[_0x7674('0x25')](function(_0x54490f){return _0x54490f;});}return null;};}function removeEntity(_0x5e03de,_0x9ab998){return function(_0x3783ae){if(_0x3783ae){return _0x3783ae[_0x7674('0x26')]()[_0x7674('0x25')](function(){_0x5e03de[_0x7674('0x19')](0xcc)[_0x7674('0x27')]();});}};}function handleEntityNotFound(_0x382ad4,_0x5d4562){return function(_0x26eac0){if(!_0x26eac0){_0x382ad4[_0x7674('0x28')](0x194);}return _0x26eac0;};}function handleError(_0x368cf9,_0x34685b){_0x34685b=_0x34685b||0x1f4;return function(_0x37acdf){logger[_0x7674('0x29')](_0x37acdf['stack']);if(_0x37acdf[_0x7674('0x2a')]){delete _0x37acdf[_0x7674('0x2a')];}_0x368cf9['status'](_0x34685b)['send'](_0x37acdf);};}exports[_0x7674('0x2b')]=function(_0x53f28b,_0x18a5e6){var _0x49a2cd={},_0x2ceec0={},_0x43857e={'count':0x0,'rows':[]};var _0x2ff5f7=_[_0x7674('0x2c')](db['CmCustomField'][_0x7674('0x2d')],function(_0x3f75a8){return{'name':_0x3f75a8[_0x7674('0x2e')],'type':_0x3f75a8['type'][_0x7674('0x2f')]};});_0x2ceec0[_0x7674('0x30')]=_[_0x7674('0x31')](_['map'](_0x2ff5f7,_0x7674('0x2a')),['name']);_0x2ceec0[_0x7674('0x32')]=_[_0x7674('0x33')](_0x53f28b[_0x7674('0x32')]);_0x2ceec0['filters']=_['intersection'](_0x2ceec0[_0x7674('0x30')],_0x2ceec0[_0x7674('0x32')]);_0x49a2cd['attributes']=_[_0x7674('0x34')](_0x2ceec0[_0x7674('0x30')],qs[_0x7674('0x35')](_0x53f28b[_0x7674('0x32')][_0x7674('0x35')]));_0x49a2cd[_0x7674('0x36')]=_0x49a2cd[_0x7674('0x36')][_0x7674('0x37')]?_0x49a2cd['attributes']:_0x2ceec0[_0x7674('0x30')];if(!_0x53f28b[_0x7674('0x32')][_0x7674('0x38')](_0x7674('0x39'))){_0x49a2cd[_0x7674('0x1d')]=qs[_0x7674('0x1d')](_0x53f28b[_0x7674('0x32')][_0x7674('0x1d')]);_0x49a2cd[_0x7674('0x1b')]=qs[_0x7674('0x1b')](_0x53f28b['query']['offset']);}_0x49a2cd[_0x7674('0x3a')]=qs[_0x7674('0x3b')](_0x53f28b[_0x7674('0x32')][_0x7674('0x3b')]);_0x49a2cd['where']=qs['filters'](_[_0x7674('0x3c')](_0x53f28b[_0x7674('0x32')],_0x2ceec0[_0x7674('0x3d')]),_0x2ff5f7);if(_0x53f28b['query'][_0x7674('0x3e')]){_0x49a2cd[_0x7674('0x3f')]=_[_0x7674('0x40')](_0x49a2cd[_0x7674('0x3f')],{'$or':_['map'](_0x2ff5f7,function(_0x3e931b){if(_0x3e931b['type']!==_0x7674('0x41')){var _0x27281e={};_0x27281e[_0x3e931b[_0x7674('0x2a')]]={'$like':'%'+_0x53f28b[_0x7674('0x32')]['filter']+'%'};return _0x27281e;}})});}_0x49a2cd=_[_0x7674('0x40')]({},_0x49a2cd,_0x53f28b[_0x7674('0x42')]);var _0x284775={'where':_0x49a2cd[_0x7674('0x3f')]};return db[_0x7674('0x43')][_0x7674('0x1e')](_0x284775)[_0x7674('0x25')](function(_0x11dbf2){_0x43857e[_0x7674('0x1e')]=_0x11dbf2;if(_0x53f28b[_0x7674('0x32')][_0x7674('0x44')]){_0x49a2cd[_0x7674('0x45')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x49a2cd);})[_0x7674('0x25')](function(_0x360ea9){_0x43857e[_0x7674('0x46')]=_0x360ea9;return _0x43857e;})[_0x7674('0x25')](respondWithFilteredResult(_0x18a5e6,_0x49a2cd))[_0x7674('0x47')](handleError(_0x18a5e6,null));};exports[_0x7674('0x48')]=function(_0x2c52bf,_0x5a6a96){var _0x36951a={'raw':!![],'where':{'id':_0x2c52bf['params']['id']}},_0x3bd143={};_0x3bd143['model']=_[_0x7674('0x33')](db['CmCustomField'][_0x7674('0x2d')]);_0x3bd143[_0x7674('0x32')]=_[_0x7674('0x33')](_0x2c52bf[_0x7674('0x32')]);_0x3bd143[_0x7674('0x3d')]=_[_0x7674('0x34')](_0x3bd143[_0x7674('0x30')],_0x3bd143[_0x7674('0x32')]);_0x36951a[_0x7674('0x36')]=_[_0x7674('0x34')](_0x3bd143[_0x7674('0x30')],qs[_0x7674('0x35')](_0x2c52bf['query'][_0x7674('0x35')]));_0x36951a[_0x7674('0x36')]=_0x36951a[_0x7674('0x36')][_0x7674('0x37')]?_0x36951a[_0x7674('0x36')]:_0x3bd143[_0x7674('0x30')];if(_0x2c52bf[_0x7674('0x32')][_0x7674('0x44')]){_0x36951a[_0x7674('0x45')]=[{'all':!![]}];}_0x36951a=_[_0x7674('0x40')]({},_0x36951a,_0x2c52bf[_0x7674('0x42')]);return db[_0x7674('0x43')][_0x7674('0x49')](_0x36951a)[_0x7674('0x25')](handleEntityNotFound(_0x5a6a96,null))[_0x7674('0x25')](respondWithResult(_0x5a6a96,null))[_0x7674('0x47')](handleError(_0x5a6a96,null));};exports[_0x7674('0x24')]=function(_0x580ad8,_0x38c8e8){if(_0x580ad8['body']['id']){delete _0x580ad8[_0x7674('0x4a')]['id'];}return db[_0x7674('0x43')][_0x7674('0x49')]({'where':{'id':_0x580ad8[_0x7674('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38c8e8,null))[_0x7674('0x25')](saveUpdates(_0x580ad8[_0x7674('0x4a')],null))[_0x7674('0x25')](respondWithResult(_0x38c8e8,null))['catch'](handleError(_0x38c8e8,null));};exports[_0x7674('0x26')]=function(_0x148879,_0x20aa0e){return db['CmCustomField'][_0x7674('0x49')]({'where':{'id':_0x148879[_0x7674('0x4b')]['id']}})[_0x7674('0x25')](handleEntityNotFound(_0x20aa0e,null))[_0x7674('0x25')](removeEntity(_0x20aa0e,null))['catch'](handleError(_0x20aa0e,null));};exports['create']=function(_0x413e9e,_0x562ec5){var _0x36ec2b;return db['sequelize']['transaction'](function(_0x29ad07){return db[_0x7674('0x43')]['create'](_0x413e9e[_0x7674('0x4a')],{'transaction':_0x29ad07})[_0x7674('0x25')](function(_0x14bcef){_0x36ec2b=_0x14bcef;var _0x1411b8={'type':db[_0x7674('0x4c')][_0x7674('0x4d')],'transaction':_0x29ad07};switch(_0x413e9e[_0x7674('0x4a')][_0x7674('0x4e')]){case'text':_0x1411b8[_0x7674('0x4e')]=db['Sequelize'][_0x7674('0x4d')];break;case'number':_0x1411b8[_0x7674('0x4e')]=db['Sequelize'][_0x7674('0x4f')];break;case _0x7674('0x50'):_0x1411b8['type']=db[_0x7674('0x4c')]['BOOLEAN'];_0x1411b8[_0x7674('0x51')]=![];break;default:}return db['sequelize'][_0x7674('0x52')][_0x7674('0x53')](_0x7674('0x54'),util[_0x7674('0x55')](_0x7674('0x56'),_0x36ec2b['id']),_0x1411b8);})[_0x7674('0x25')](function(){return _0x36ec2b;});})['then'](respondWithResult(_0x562ec5,0xc9))[_0x7674('0x47')](handleError(_0x562ec5,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 01946bd..6447910 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 _0xfd68=['moment','bluebird','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd68,0xed));var _0x8fd6=function(_0x1e6579,_0x595c18){_0x1e6579=_0x1e6579-0x0;var _0x2f8541=_0xfd68[_0x1e6579];return _0x2f8541;};'use strict';var _=require(_0x8fd6('0x0'));var util=require(_0x8fd6('0x1'));var logger=require(_0x8fd6('0x2'))('api');var moment=require(_0x8fd6('0x3'));var BPromise=require(_0x8fd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fd6('0x5'));var rimraf=require(_0x8fd6('0x6'));var config=require(_0x8fd6('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x8fd6('0x8')]=function(_0x461792,_0x45b563){return _0x461792[_0x8fd6('0x9')](_0x8fd6('0xa'),attributes,{'tableName':_0x8fd6('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d09=['cm_custom_fields','lodash','api','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x322499,_0xf266e3){var _0x1c1745=function(_0xbe7bbe){while(--_0xbe7bbe){_0x322499['push'](_0x322499['shift']());}};_0x1c1745(++_0xf266e3);}(_0x9d09,0x90));var _0x99d0=function(_0x59df9a,_0x2743b7){_0x59df9a=_0x59df9a-0x0;var _0x286372=_0x9d09[_0x59df9a];return _0x286372;};'use strict';var _=require(_0x99d0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x99d0('0x1'));var moment=require('moment');var BPromise=require(_0x99d0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99d0('0x3'));var rimraf=require(_0x99d0('0x4'));var config=require(_0x99d0('0x5'));var attributes=require(_0x99d0('0x6'));module[_0x99d0('0x7')]=function(_0x4cba98,_0x21f13e){return _0x4cba98[_0x99d0('0x8')](_0x99d0('0x9'),attributes,{'tableName':_0x99d0('0xa'),'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 3d21834..25e2a4a 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 _0xa92d=['lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3cf71b,_0x4c322d){var _0x13794b=function(_0x1e8ace){while(--_0x1e8ace){_0x3cf71b['push'](_0x3cf71b['shift']());}};_0x13794b(++_0x4c322d);}(_0xa92d,0xb4));var _0xda92=function(_0x141ede,_0x11da0f){_0x141ede=_0x141ede-0x0;var _0x3e9b5f=_0xa92d[_0x141ede];return _0x3e9b5f;};'use strict';var _=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var moment=require('moment');var BPromise=require(_0xda92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda92('0x3'))['db'];var utils=require(_0xda92('0x4'));var logger=require('../../config/logger')(_0xda92('0x5'));var config=require('../../config/environment');var jayson=require(_0xda92('0x6'));var client=jayson[_0xda92('0x7')][_0xda92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23e73f,_0x2684ba,_0x596c62){return new BPromise(function(_0x8a468c,_0x522272){return client[_0xda92('0x9')](_0x23e73f,_0x596c62)['then'](function(_0x183464){logger[_0xda92('0xa')](_0xda92('0xb'),_0x2684ba,_0xda92('0xc'));logger[_0xda92('0xd')](_0xda92('0xe'),_0x2684ba,_0xda92('0xc'),JSON[_0xda92('0xf')](_0x183464));if(_0x183464[_0xda92('0x10')]){if(_0x183464[_0xda92('0x10')][_0xda92('0x11')]===0x1f4){logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x183464['error'][_0xda92('0x12')]);return _0x522272(_0x183464[_0xda92('0x10')][_0xda92('0x12')]);}logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x183464[_0xda92('0x10')][_0xda92('0x12')]);return _0x8a468c(_0x183464[_0xda92('0x10')][_0xda92('0x12')]);}else{logger[_0xda92('0xa')](_0xda92('0xb'),_0x2684ba,'request\x20sent');_0x8a468c(_0x183464[_0xda92('0x13')][_0xda92('0x12')]);}})['catch'](function(_0x3c73ca){logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x3c73ca);_0x522272(_0x3c73ca);});});} \ No newline at end of file +var _0x693d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x56d252,_0x55848b){var _0x564a40=function(_0x143ce9){while(--_0x143ce9){_0x56d252['push'](_0x56d252['shift']());}};_0x564a40(++_0x55848b);}(_0x693d,0x19f));var _0xd693=function(_0x31ad0c,_0x52c3d6){_0x31ad0c=_0x31ad0c-0x0;var _0x1f6a81=_0x693d[_0x31ad0c];return _0x1f6a81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd693('0x0'));var BPromise=require(_0xd693('0x1'));var rs=require(_0xd693('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd693('0x3'))['db'];var utils=require(_0xd693('0x4'));var logger=require(_0xd693('0x5'))(_0xd693('0x6'));var config=require(_0xd693('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd693('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ad02,_0x3e1d8e,_0x10db61){return new BPromise(function(_0x5e4a33,_0x485486){return client['request'](_0x18ad02,_0x10db61)[_0xd693('0x9')](function(_0x257e6c){logger[_0xd693('0xa')]('CmCustomField,\x20%s,\x20%s',_0x3e1d8e,_0xd693('0xb'));logger['debug'](_0xd693('0xc'),_0x3e1d8e,_0xd693('0xb'),JSON[_0xd693('0xd')](_0x257e6c));if(_0x257e6c[_0xd693('0xe')]){if(_0x257e6c['error'][_0xd693('0xf')]===0x1f4){logger[_0xd693('0xe')](_0xd693('0x10'),_0x3e1d8e,_0x257e6c['error'][_0xd693('0x11')]);return _0x485486(_0x257e6c[_0xd693('0xe')][_0xd693('0x11')]);}logger[_0xd693('0xe')](_0xd693('0x10'),_0x3e1d8e,_0x257e6c[_0xd693('0xe')][_0xd693('0x11')]);return _0x5e4a33(_0x257e6c[_0xd693('0xe')][_0xd693('0x11')]);}else{logger[_0xd693('0xa')](_0xd693('0x10'),_0x3e1d8e,_0xd693('0xb'));_0x5e4a33(_0x257e6c[_0xd693('0x12')][_0xd693('0x11')]);}})['catch'](function(_0x1f3dbf){logger[_0xd693('0xe')](_0xd693('0x10'),_0x3e1d8e,_0x1f3dbf);_0x485486(_0x1f3dbf);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 52392a8..acc23b5 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 _0x1670=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x528bf0,_0x12f62f){var _0x40b086=function(_0x517bbb){while(--_0x517bbb){_0x528bf0['push'](_0x528bf0['shift']());}};_0x40b086(++_0x12f62f);}(_0x1670,0x9a));var _0x0167=function(_0x818b0f,_0xaf6fa5){_0x818b0f=_0x818b0f-0x0;var _0x4220a9=_0x1670[_0x818b0f];return _0x4220a9;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var fs_extra=require(_0x0167('0x4'));var auth=require(_0x0167('0x5'));var interaction=require(_0x0167('0x6'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x0167('0x7')]('/',auth[_0x0167('0x8')](),controller[_0x0167('0x9')]);router[_0x0167('0x7')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0xb')]);router[_0x0167('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0167('0xd')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0xe')]);router[_0x0167('0xf')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0x10')]);module[_0x0167('0x11')]=router; \ No newline at end of file +var _0xb66c=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0xfa847c,_0x444a8c){var _0x3b22bf=function(_0x32de11){while(--_0x32de11){_0xfa847c['push'](_0xfa847c['shift']());}};_0x3b22bf(++_0x444a8c);}(_0xb66c,0x175));var _0xcb66=function(_0x204c06,_0x1c48a3){_0x204c06=_0x204c06-0x0;var _0x146e36=_0xb66c[_0x204c06];return _0x146e36;};'use strict';var multer=require(_0xcb66('0x0'));var util=require('util');var path=require(_0xcb66('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb66('0x2'));var router=express[_0xcb66('0x3')]();var fs_extra=require(_0xcb66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var controller=require(_0xcb66('0x7'));router[_0xcb66('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb66('0x8')](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0xb')]);router[_0xcb66('0xc')]('/',auth['isAuthenticated'](),controller[_0xcb66('0xd')]);router[_0xcb66('0xe')](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0xf')]);router['delete'](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0x10')]);module[_0xcb66('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2a6208f..7124bd3 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 _0x809a=['STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0xe3be75,_0x27bae4){var _0x1a2477=function(_0x43e917){while(--_0x43e917){_0xe3be75['push'](_0xe3be75['shift']());}};_0x1a2477(++_0x27bae4);}(_0x809a,0x1b5));var _0xa809=function(_0x439e90,_0x449bef){_0x439e90=_0x439e90-0x0;var _0x13c857=_0x809a[_0x439e90];return _0x13c857;};'use strict';var moment=require(_0xa809('0x0'));var Sequelize=require(_0xa809('0x1'));module[_0xa809('0x2')]={'phone':{'type':Sequelize[_0xa809('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xa809('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa809('0x5')],'defaultValue':moment()[_0xa809('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa809('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xa809('0x7')](0x2)[_0xa809('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'ListId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'UserId':{'type':Sequelize[_0xa809('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'CampaignId':{'type':Sequelize[_0xa809('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa809('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa809('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa809('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3e0a=['STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','moment','sequelize'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x3e0a,0xde));var _0xa3e0=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x3e0a[_0x65c0bb];return _0x320bd5;};'use strict';var moment=require(_0xa3e0('0x0'));var Sequelize=require(_0xa3e0('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa3e0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xa3e0('0x4'))},'countbusyretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa3e0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa3e0('0x6')]},'priority':{'type':Sequelize[_0xa3e0('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa3e0('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa3e0('0x5')],'unique':_0xa3e0('0x7')},'ListId':{'type':Sequelize[_0xa3e0('0x5')],'unique':_0xa3e0('0x7')},'UserId':{'type':Sequelize[_0xa3e0('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xa3e0('0x5')],'unique':_0xa3e0('0x7')},'CampaignId':{'type':Sequelize[_0xa3e0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa3e0('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa3e0('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa3e0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 51d71b5..71039c7 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 _0x4b84=['campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','List','Queue','getPreviewRecall','sequelize','LOCK','Company','dialActive','getOpenContacts','preview','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','moment','lodash','api','undefined','count','offset','limit','status','set','json','then','error','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','concat','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','CmHopper','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x5cc655,_0x4b6145){var _0x244379=function(_0x30d2c5){while(--_0x30d2c5){_0x5cc655['push'](_0x5cc655['shift']());}};_0x244379(++_0x4b6145);}(_0x4b84,0x1cc));var _0x44b8=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4b84[_0x12d033];return _0x3b4e80;};'use strict';var moment=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x44b8('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3b26c7,_0x31282a){_0x31282a=_0x31282a||0xc8;return function(_0x39ad16){if(_0x39ad16){return _0x3b26c7['status'](_0x31282a)['json'](_0x39ad16);}};}function respondWithFilteredResult(_0x55f25d,_0x996a8b){return function(_0x54274b){if(_0x54274b){var _0x327f59=typeof _0x996a8b['offset']===_0x44b8('0x3')&&typeof _0x996a8b['limit']==='undefined';var _0x41d515=_0x54274b[_0x44b8('0x4')];var _0x30ebc3=_0x327f59?0x0:_0x996a8b['offset'];var _0xc650ec=_0x327f59?_0x54274b[_0x44b8('0x4')]:_0x996a8b[_0x44b8('0x5')]+_0x996a8b[_0x44b8('0x6')];var _0x24dd10;if(_0xc650ec>=_0x41d515){_0xc650ec=_0x41d515;_0x24dd10=0xc8;}else{_0x24dd10=0xce;}_0x55f25d[_0x44b8('0x7')](_0x24dd10);return _0x55f25d[_0x44b8('0x8')]('Content-Range',_0x30ebc3+'-'+_0xc650ec+'/'+_0x41d515)[_0x44b8('0x9')](_0x54274b);}return null;};}function saveUpdates(_0x4301a6,_0x4bcc43){return function(_0x194230){if(_0x194230){return _0x194230['update'](_0x4301a6)[_0x44b8('0xa')](function(_0x18d642){return _0x18d642;});}return null;};}function handleEntityNotFound(_0x4df670,_0x63e8f6){return function(_0x4be54c){if(!_0x4be54c){_0x4df670['sendStatus'](0x194);}return _0x4be54c;};}function handleError(_0x2a3e4c,_0x2af0ad){_0x2af0ad=_0x2af0ad||0x1f4;return function(_0x1722da){logger[_0x44b8('0xb')](_0x1722da['stack']);if(_0x1722da['name']){delete _0x1722da['name'];}_0x2a3e4c[_0x44b8('0x7')](_0x2af0ad)['send'](_0x1722da);};}exports[_0x44b8('0xc')]=function(_0x31651b,_0x55e258){var _0x36743e={},_0xe3de8f={},_0x5103f5={'count':0x0,'rows':[]};var _0x89bc30=_[_0x44b8('0xd')](db['CmHopper'][_0x44b8('0xe')],function(_0x8b4301){return{'name':_0x8b4301[_0x44b8('0xf')],'type':_0x8b4301[_0x44b8('0x10')][_0x44b8('0x11')]};});_0xe3de8f[_0x44b8('0x12')]=_[_0x44b8('0xd')](_0x89bc30,_0x44b8('0x13'));_0xe3de8f[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x31651b[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_['intersection'](_0xe3de8f[_0x44b8('0x12')],_0xe3de8f[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_[_0x44b8('0x17')](_0xe3de8f[_0x44b8('0x16')],['$and',_0x44b8('0x18'),'$gt',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),_0x44b8('0x1d'),'$not',_0x44b8('0x1e'),'$notBetween',_0x44b8('0x1f'),_0x44b8('0x20'),'$like',_0x44b8('0x21'),_0x44b8('0x22'),_0x44b8('0x23'),'$like',_0x44b8('0x24'),_0x44b8('0x25'),'$contained',_0x44b8('0x26')]);_0x36743e['attributes']=_[_0x44b8('0x27')](_0xe3de8f['model'],qs['fields'](_0x31651b['query'][_0x44b8('0x28')]));_0x36743e[_0x44b8('0x29')]=_0x36743e[_0x44b8('0x29')][_0x44b8('0x2a')]?_0x36743e[_0x44b8('0x29')]:_0xe3de8f[_0x44b8('0x12')];if(!_0x31651b[_0x44b8('0x14')][_0x44b8('0x2b')](_0x44b8('0x2c'))){_0x36743e[_0x44b8('0x6')]=qs[_0x44b8('0x6')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x6')]);_0x36743e['offset']=qs[_0x44b8('0x5')](_0x31651b['query'][_0x44b8('0x5')]);}_0x36743e[_0x44b8('0x2d')]=qs[_0x44b8('0x2e')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x2e')]);_0x36743e['where']=qs[_0x44b8('0x16')](_[_0x44b8('0x2f')](_0x31651b[_0x44b8('0x14')],_0xe3de8f[_0x44b8('0x16')]),_0x89bc30);if(_0x31651b[_0x44b8('0x14')]['filter']){_0x36743e[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x36743e[_0x44b8('0x30')],{'$or':_[_0x44b8('0xd')](_0x89bc30,function(_0x140a79){if(_0x140a79[_0x44b8('0x10')]!==_0x44b8('0x32')){var _0x14a9d7={};_0x14a9d7[_0x140a79[_0x44b8('0x13')]]={'$like':'%'+_0x31651b[_0x44b8('0x14')][_0x44b8('0x33')]+'%'};return _0x14a9d7;}})});}_0x36743e=_[_0x44b8('0x31')]({},_0x36743e,_0x31651b[_0x44b8('0x34')]);var _0xae15f4={'where':_0x36743e[_0x44b8('0x30')]};return db[_0x44b8('0x35')][_0x44b8('0x4')](_0xae15f4)[_0x44b8('0xa')](function(_0x28faa9){_0x5103f5[_0x44b8('0x4')]=_0x28faa9;if(_0x31651b[_0x44b8('0x14')][_0x44b8('0x36')]){_0x36743e['include']=[{'all':!![]}];}return db[_0x44b8('0x35')][_0x44b8('0x37')](_0x36743e);})['then'](function(_0x25688b){_0x5103f5[_0x44b8('0x38')]=_0x25688b;return _0x5103f5;})[_0x44b8('0xa')](respondWithFilteredResult(_0x55e258,_0x36743e))[_0x44b8('0x39')](handleError(_0x55e258,null));};exports['show']=function(_0x221543,_0x11e4e3){var _0x3611b4={'raw':!![],'where':{'id':_0x221543[_0x44b8('0x3a')]['id']}},_0x1ee3cc={};_0x1ee3cc[_0x44b8('0x12')]=_[_0x44b8('0x15')](db[_0x44b8('0x35')][_0x44b8('0xe')]);_0x1ee3cc[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x221543[_0x44b8('0x14')]);_0x1ee3cc[_0x44b8('0x16')]=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],_0x1ee3cc[_0x44b8('0x14')]);_0x3611b4['attributes']=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],qs[_0x44b8('0x28')](_0x221543['query'][_0x44b8('0x28')]));_0x3611b4[_0x44b8('0x29')]=_0x3611b4[_0x44b8('0x29')]['length']?_0x3611b4[_0x44b8('0x29')]:_0x1ee3cc[_0x44b8('0x12')];if(_0x221543[_0x44b8('0x14')][_0x44b8('0x36')]){_0x3611b4[_0x44b8('0x3b')]=[{'all':!![]}];}_0x3611b4=_['merge']({},_0x3611b4,_0x221543['options']);return db[_0x44b8('0x35')][_0x44b8('0x3c')](_0x3611b4)[_0x44b8('0xa')](handleEntityNotFound(_0x11e4e3,null))[_0x44b8('0xa')](respondWithResult(_0x11e4e3,null))[_0x44b8('0x39')](handleError(_0x11e4e3,null));};exports[_0x44b8('0x3d')]=function(_0x3fc41b,_0x457348){return db[_0x44b8('0x35')][_0x44b8('0x3d')](_0x3fc41b[_0x44b8('0x3e')],{})[_0x44b8('0xa')](respondWithResult(_0x457348,0xc9))[_0x44b8('0x39')](handleError(_0x457348,null));};exports[_0x44b8('0x3f')]=function(_0x149731,_0x60eeb2){if(_0x149731[_0x44b8('0x3e')]['id']){delete _0x149731[_0x44b8('0x3e')]['id'];}return db[_0x44b8('0x35')]['find']({'where':{'id':_0x149731['params']['id']}})[_0x44b8('0xa')](handleEntityNotFound(_0x60eeb2,null))[_0x44b8('0xa')](saveUpdates(_0x149731[_0x44b8('0x3e')],null))[_0x44b8('0xa')](respondWithResult(_0x60eeb2,null))[_0x44b8('0x39')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x40')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x35')]['describe']()[_0x44b8('0xa')](respondWithResult(_0x4fe73f,null))[_0x44b8('0x39')](handleError(_0x4fe73f,null));};exports[_0x44b8('0x41')]=function(_0x9207bf,_0x103d57){var _0x35ca19;var _0x491600=_0x9207bf[_0x44b8('0x3a')]['id'];return db[_0x44b8('0x35')][_0x44b8('0x3c')]({'where':{'id':_0x9207bf[_0x44b8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x103d57,null))[_0x44b8('0xa')](function(_0x2f549d){if(_0x2f549d){return _0x2f549d[_0x44b8('0x41')]()[_0x44b8('0xa')](function(_0x44ec23){return _0x44ec23;});}})[_0x44b8('0xa')](function(_0x500bad){_0x35ca19=_0x500bad;if(_0x500bad){if(_0x500bad[_0x44b8('0x42')]||_0x500bad[_0x44b8('0x43')]){return db[_0x500bad[_0x44b8('0x42')]?_0x44b8('0x44'):_0x44b8('0x45')]['find']({'where':{'id':_0x500bad['VoiceQueueId']?_0x500bad[_0x44b8('0x42')]:_0x500bad['CampaignId']},'attributes':['id',_0x44b8('0x13')],'raw':!![]});}}})['then'](function(_0x40164d){var _0x434d6a={};if(_0x40164d){_[_0x44b8('0x31')](_0x434d6a,_[_0x44b8('0x46')](_0x35ca19[_0x44b8('0x47')],[_0x44b8('0x48'),_0x44b8('0x49'),'id']));_0x434d6a['state']=0x15;_0x434d6a[_0x44b8('0x4a')]=_0x44b8('0x4b');_0x434d6a[_0x44b8('0x4c')]=_0x40164d['name'];_0x434d6a[_0x44b8('0x4d')]=_0x9207bf[_0x44b8('0x4e')][_0x44b8('0x13')];_0x434d6a[_0x44b8('0x4f')]=_0x9207bf['user']['id'];_0x434d6a[_0x44b8('0x4b')]=!![];_0x434d6a[_0x44b8('0x50')]=moment()['format'](_0x44b8('0x51'));_0x434d6a[_0x44b8('0x52')]=_0x35ca19[_0x44b8('0x53')];_0x434d6a[_0x44b8('0x54')]=_0x35ca19[_0x44b8('0x42')]?'queue':'ivr';return db[_0x44b8('0x55')][_0x44b8('0x3c')]({'where':{'id':_0x434d6a[_0x44b8('0x56')]},'attributes':[_0x44b8('0x57'),_0x44b8('0x58')]})[_0x44b8('0xa')](function(_0x3c9534){if(!_[_0x44b8('0x59')](_0x103d57)&&!_[_0x44b8('0x59')](_0x3c9534[_0x44b8('0x57')])){_0x434d6a[_0x44b8('0x5a')]=_0x3c9534[_0x44b8('0x57')];if(!_['isNil'](_0x3c9534[_0x44b8('0x58')])){_0x434d6a[_0x44b8('0x5a')]+='\x20'+_0x3c9534[_0x44b8('0x58')];}}})[_0x44b8('0x5b')](function(){return db[_0x44b8('0x5c')][_0x44b8('0x3d')](_0x434d6a);});}})[_0x44b8('0xa')](function(_0x172ff3){return db[_0x44b8('0x5d')][_0x44b8('0x41')]({'where':{'CmHopperId':_0x491600}});})[_0x44b8('0xa')](function(){return _0x103d57[_0x44b8('0x7')](0xcc)[_0x44b8('0x5e')]();})[_0x44b8('0x39')](handleError(_0x103d57,null));};exports[_0x44b8('0x5f')]=function(_0x293c2e,_0x25f91c){var _0x20e563=[];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0x10e519){_0x20e563=_[_0x44b8('0x15')](_0x10e519);return _0x293c2e[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':_0x44b8('0x61'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x44b8('0x62'),_0x44b8('0x63')],'raw':!![]});})['then'](function(_0x2a95f6){if(_0x2a95f6&&_0x2a95f6[_0x44b8('0x2a')]){return db['sequelize'][_0x44b8('0x64')](function(_0x454fe6){var _0x370618={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x2a95f6,'id')},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x5161ea={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a95f6)[_0x44b8('0x33')]([_0x44b8('0x63'),0x0])[_0x44b8('0xd')]('id')[_0x44b8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x230b6a={'$or':[_0x370618,_0x5161ea]};var _0x4c7edd=[];if(_0x293c2e[_0x44b8('0x3e')]['direction']&&_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x66')]==='prev'){if(!_[_0x44b8('0x67')](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$in':_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6a')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]===_0x44b8('0x6a')?_0x44b8('0x6c'):_0x44b8('0x6a')],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6e')),['id',_0x44b8('0x6c')]];}else{if(!_['isEmpty'](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$notIn':_0x293c2e['body'][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6c')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6f')),['id',_0x44b8('0x6a')]];}return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x53'),_0x44b8('0x72')],'where':_0x230b6a,'order':_0x4c7edd,'transaction':_0x454fe6,'lock':_0x454fe6['LOCK'][_0x44b8('0x73')],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x20e563,'include':[{'model':db[_0x44b8('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id',_0x44b8('0x13')]},{'model':db[_0x44b8('0x44')],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),'dialActive']}]})[_0x44b8('0xa')](function(_0x58180f){if(_0x58180f){return _0x58180f[_0x44b8('0x3f')]({'UserId':_0x293c2e[_0x44b8('0x4e')]['id']},{'transaction':_0x454fe6});}});});}})[_0x44b8('0xa')](handleEntityNotFound(_0x25f91c,null))['then'](respondWithResult(_0x25f91c,null))['catch'](handleError(_0x25f91c,null));};exports[_0x44b8('0x78')]=function(_0x1964b2,_0x248e6c,_0x536734){var _0x1f5277=[];var _0x36f217=_0x1964b2[_0x44b8('0x3a')]['id'];var _0x15b209=_0x1964b2[_0x44b8('0x4e')]['id'];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0xbbdab9){_0x1f5277=_[_0x44b8('0x15')](_0xbbdab9);return db[_0x44b8('0x79')]['transaction'](function(_0x40571c){const _0x4c7cdf={'id':_0x36f217};return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x72')],'where':_0x4c7cdf,'transaction':_0x40571c,'lock':_0x40571c[_0x44b8('0x7a')]['UPDATE'],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x1f5277,'include':[{'model':db['CmCompany'],'as':_0x44b8('0x7b'),'attributes':['id',_0x44b8('0x13')]}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),_0x44b8('0x7c')]}]})['then'](function(_0x510760){if(_0x510760){return _0x510760['update']({'UserId':_0x15b209},{'transaction':_0x40571c});}});});})[_0x44b8('0xa')](handleEntityNotFound(_0x248e6c,null))[_0x44b8('0xa')](respondWithResult(_0x248e6c,null))[_0x44b8('0x39')](handleError(_0x248e6c,null));};exports[_0x44b8('0x7d')]=function(_0x1a5621,_0x221e65){return _0x1a5621[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x44b8('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x59e7b4){if(_0x59e7b4&&_0x59e7b4['length']){return db[_0x44b8('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x44b8('0x7f')](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_[_0x44b8('0xd')](_0x59e7b4,'id')},'$or':[{'UserId':null},{'UserId':_0x1a5621[_0x44b8('0x4e')]['id']}]}});}return 0x0;})[_0x44b8('0xa')](function(_0x245ba3){if(!_[_0x44b8('0x59')](_0x245ba3)&&_[_0x44b8('0x80')](_0x245ba3)){return _0x221e65['status'](0xc8)[_0x44b8('0x9')]({'contacts':_0x245ba3});}else{logger[_0x44b8('0xb')](_0x44b8('0x81'),_0x44b8('0x7d'),0x194,_0x44b8('0x82'));_0x221e65[_0x44b8('0x83')](0x194);}})[_0x44b8('0x39')](handleError(_0x221e65,null));};exports[_0x44b8('0x84')]=function(_0x40fec3,_0x5f4734){var _0x4b45a7=shared[_0x44b8('0x85')];var _0x553aa9=[];_[_0x44b8('0xd')](_0x4b45a7,function(_0x444419){_0x553aa9[_0x44b8('0x86')]({'id':_0x444419['name'],'name':_0x444419['name'],'utcOffset':_0x444419['utcOffset']});});return _0x5f4734[_0x44b8('0x7')](0xc8)['json']({'tz':_0x553aa9});};exports[_0x44b8('0x87')]=function(_0x2812da,_0xf18cb2){var _0x322a49=shared[_0x44b8('0x85')];var _0xf643d3={};if(!_[_0x44b8('0x59')](_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']]))_0xf643d3=_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']];return _0xf18cb2[_0x44b8('0x7')](0xc8)[_0x44b8('0x9')](_0xf643d3);}; \ No newline at end of file +var _0x44e8=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','end','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','List','Queue','dialActive','getPreviewRecall','recallme','Contact','CmCompany','Company','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','moment','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','keys','query','filters','intersection','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$contains','$contained','$any','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e8,0xd7));var _0x844e=function(_0x19876a,_0x1cfa8c){_0x19876a=_0x19876a-0x0;var _0x1b4b9a=_0x44e8[_0x19876a];return _0x1b4b9a;};'use strict';var moment=require(_0x844e('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x844e('0x1'))(_0x844e('0x2'));var shared=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];function respondWithResult(_0x49ce1b,_0x3a8b3c){_0x3a8b3c=_0x3a8b3c||0xc8;return function(_0x167368){if(_0x167368){return _0x49ce1b[_0x844e('0x5')](_0x3a8b3c)[_0x844e('0x6')](_0x167368);}};}function respondWithFilteredResult(_0x5c8f67,_0x2f6539){return function(_0x238796){if(_0x238796){var _0x1706b3=typeof _0x2f6539[_0x844e('0x7')]==='undefined'&&typeof _0x2f6539[_0x844e('0x8')]===_0x844e('0x9');var _0x336881=_0x238796[_0x844e('0xa')];var _0x32c6c7=_0x1706b3?0x0:_0x2f6539[_0x844e('0x7')];var _0x536601=_0x1706b3?_0x238796[_0x844e('0xa')]:_0x2f6539[_0x844e('0x7')]+_0x2f6539[_0x844e('0x8')];var _0x285a64;if(_0x536601>=_0x336881){_0x536601=_0x336881;_0x285a64=0xc8;}else{_0x285a64=0xce;}_0x5c8f67[_0x844e('0x5')](_0x285a64);return _0x5c8f67[_0x844e('0xb')](_0x844e('0xc'),_0x32c6c7+'-'+_0x536601+'/'+_0x336881)['json'](_0x238796);}return null;};}function saveUpdates(_0x8d3bea,_0x23df3f){return function(_0x52ac76){if(_0x52ac76){return _0x52ac76[_0x844e('0xd')](_0x8d3bea)[_0x844e('0xe')](function(_0x492094){return _0x492094;});}return null;};}function handleEntityNotFound(_0x1f48e2,_0x6b542d){return function(_0x1c1689){if(!_0x1c1689){_0x1f48e2['sendStatus'](0x194);}return _0x1c1689;};}function handleError(_0x6cc6fb,_0x465e49){_0x465e49=_0x465e49||0x1f4;return function(_0x380eb4){logger[_0x844e('0xf')](_0x380eb4[_0x844e('0x10')]);if(_0x380eb4[_0x844e('0x11')]){delete _0x380eb4[_0x844e('0x11')];}_0x6cc6fb[_0x844e('0x5')](_0x465e49)['send'](_0x380eb4);};}exports[_0x844e('0x12')]=function(_0x56791b,_0x3c307f){var _0x4b0c6c={},_0x315c50={},_0x55bcd6={'count':0x0,'rows':[]};var _0x43f05d=_[_0x844e('0x13')](db[_0x844e('0x14')][_0x844e('0x15')],function(_0x3ea7da){return{'name':_0x3ea7da[_0x844e('0x16')],'type':_0x3ea7da[_0x844e('0x17')][_0x844e('0x18')]};});_0x315c50['model']=_[_0x844e('0x13')](_0x43f05d,'name');_0x315c50['query']=_[_0x844e('0x19')](_0x56791b[_0x844e('0x1a')]);_0x315c50[_0x844e('0x1b')]=_[_0x844e('0x1c')](_0x315c50['model'],_0x315c50[_0x844e('0x1a')]);_0x315c50[_0x844e('0x1b')]=_['concat'](_0x315c50[_0x844e('0x1b')],[_0x844e('0x1d'),_0x844e('0x1e'),_0x844e('0x1f'),_0x844e('0x20'),_0x844e('0x21'),'$lte',_0x844e('0x22'),_0x844e('0x23'),_0x844e('0x24'),_0x844e('0x25'),_0x844e('0x26'),'$in',_0x844e('0x27'),'$like','$notLike',_0x844e('0x28'),_0x844e('0x29'),_0x844e('0x2a'),'$overlap',_0x844e('0x2b'),_0x844e('0x2c'),_0x844e('0x2d')]);_0x4b0c6c['attributes']=_[_0x844e('0x1c')](_0x315c50[_0x844e('0x2e')],qs[_0x844e('0x2f')](_0x56791b[_0x844e('0x1a')][_0x844e('0x2f')]));_0x4b0c6c[_0x844e('0x30')]=_0x4b0c6c[_0x844e('0x30')][_0x844e('0x31')]?_0x4b0c6c[_0x844e('0x30')]:_0x315c50[_0x844e('0x2e')];if(!_0x56791b['query'][_0x844e('0x32')](_0x844e('0x33'))){_0x4b0c6c[_0x844e('0x8')]=qs[_0x844e('0x8')](_0x56791b[_0x844e('0x1a')][_0x844e('0x8')]);_0x4b0c6c[_0x844e('0x7')]=qs['offset'](_0x56791b[_0x844e('0x1a')][_0x844e('0x7')]);}_0x4b0c6c[_0x844e('0x34')]=qs['sort'](_0x56791b[_0x844e('0x1a')][_0x844e('0x35')]);_0x4b0c6c['where']=qs[_0x844e('0x1b')](_[_0x844e('0x36')](_0x56791b['query'],_0x315c50[_0x844e('0x1b')]),_0x43f05d);if(_0x56791b[_0x844e('0x1a')][_0x844e('0x37')]){_0x4b0c6c[_0x844e('0x38')]=_[_0x844e('0x39')](_0x4b0c6c[_0x844e('0x38')],{'$or':_[_0x844e('0x13')](_0x43f05d,function(_0x4f3768){if(_0x4f3768[_0x844e('0x17')]!==_0x844e('0x3a')){var _0x29637e={};_0x29637e[_0x4f3768[_0x844e('0x11')]]={'$like':'%'+_0x56791b[_0x844e('0x1a')][_0x844e('0x37')]+'%'};return _0x29637e;}})});}_0x4b0c6c=_[_0x844e('0x39')]({},_0x4b0c6c,_0x56791b[_0x844e('0x3b')]);var _0x10dc63={'where':_0x4b0c6c[_0x844e('0x38')]};return db[_0x844e('0x14')]['count'](_0x10dc63)['then'](function(_0x3ad6d5){_0x55bcd6[_0x844e('0xa')]=_0x3ad6d5;if(_0x56791b[_0x844e('0x1a')][_0x844e('0x3c')]){_0x4b0c6c[_0x844e('0x3d')]=[{'all':!![]}];}return db[_0x844e('0x14')][_0x844e('0x3e')](_0x4b0c6c);})[_0x844e('0xe')](function(_0x16fc54){_0x55bcd6['rows']=_0x16fc54;return _0x55bcd6;})[_0x844e('0xe')](respondWithFilteredResult(_0x3c307f,_0x4b0c6c))['catch'](handleError(_0x3c307f,null));};exports[_0x844e('0x3f')]=function(_0x535e21,_0x286eb6){var _0x5dc530={'raw':!![],'where':{'id':_0x535e21[_0x844e('0x40')]['id']}},_0x240199={};_0x240199[_0x844e('0x2e')]=_[_0x844e('0x19')](db[_0x844e('0x14')][_0x844e('0x15')]);_0x240199[_0x844e('0x1a')]=_[_0x844e('0x19')](_0x535e21[_0x844e('0x1a')]);_0x240199[_0x844e('0x1b')]=_[_0x844e('0x1c')](_0x240199['model'],_0x240199[_0x844e('0x1a')]);_0x5dc530[_0x844e('0x30')]=_[_0x844e('0x1c')](_0x240199['model'],qs['fields'](_0x535e21[_0x844e('0x1a')][_0x844e('0x2f')]));_0x5dc530[_0x844e('0x30')]=_0x5dc530['attributes']['length']?_0x5dc530['attributes']:_0x240199['model'];if(_0x535e21[_0x844e('0x1a')][_0x844e('0x3c')]){_0x5dc530[_0x844e('0x3d')]=[{'all':!![]}];}_0x5dc530=_[_0x844e('0x39')]({},_0x5dc530,_0x535e21[_0x844e('0x3b')]);return db['CmHopper'][_0x844e('0x41')](_0x5dc530)['then'](handleEntityNotFound(_0x286eb6,null))['then'](respondWithResult(_0x286eb6,null))[_0x844e('0x42')](handleError(_0x286eb6,null));};exports[_0x844e('0x43')]=function(_0x2a57c7,_0x121ebf){return db['CmHopper'][_0x844e('0x43')](_0x2a57c7[_0x844e('0x44')],{})[_0x844e('0xe')](respondWithResult(_0x121ebf,0xc9))['catch'](handleError(_0x121ebf,null));};exports[_0x844e('0xd')]=function(_0x1bcbda,_0x558f21){if(_0x1bcbda[_0x844e('0x44')]['id']){delete _0x1bcbda[_0x844e('0x44')]['id'];}return db[_0x844e('0x14')][_0x844e('0x41')]({'where':{'id':_0x1bcbda[_0x844e('0x40')]['id']}})[_0x844e('0xe')](handleEntityNotFound(_0x558f21,null))['then'](saveUpdates(_0x1bcbda[_0x844e('0x44')],null))[_0x844e('0xe')](respondWithResult(_0x558f21,null))[_0x844e('0x42')](handleError(_0x558f21,null));};exports[_0x844e('0x45')]=function(_0x1dcfcb,_0x165078){return db[_0x844e('0x14')][_0x844e('0x45')]()[_0x844e('0xe')](respondWithResult(_0x165078,null))[_0x844e('0x42')](handleError(_0x165078,null));};exports['destroy']=function(_0x32e097,_0x694791){var _0x40410d;var _0x510089=_0x32e097[_0x844e('0x40')]['id'];return db[_0x844e('0x14')][_0x844e('0x41')]({'where':{'id':_0x32e097[_0x844e('0x40')]['id']}})[_0x844e('0xe')](handleEntityNotFound(_0x694791,null))[_0x844e('0xe')](function(_0x2c2c46){if(_0x2c2c46){return _0x2c2c46['destroy']()[_0x844e('0xe')](function(_0x3c680c){return _0x3c680c;});}})[_0x844e('0xe')](function(_0x1f2d5c){_0x40410d=_0x1f2d5c;if(_0x1f2d5c){if(_0x1f2d5c[_0x844e('0x46')]||_0x1f2d5c[_0x844e('0x47')]){return db[_0x1f2d5c[_0x844e('0x46')]?_0x844e('0x48'):_0x844e('0x49')][_0x844e('0x41')]({'where':{'id':_0x1f2d5c[_0x844e('0x46')]?_0x1f2d5c[_0x844e('0x46')]:_0x1f2d5c[_0x844e('0x47')]},'attributes':['id','name'],'raw':!![]});}}})[_0x844e('0xe')](function(_0x3d4a20){var _0x5dca66={};if(_0x3d4a20){_[_0x844e('0x39')](_0x5dca66,_[_0x844e('0x4a')](_0x40410d[_0x844e('0x4b')],['createdAt',_0x844e('0x4c'),'id']));_0x5dca66[_0x844e('0x4d')]=0x15;_0x5dca66['statedesc']=_0x844e('0x4e');_0x5dca66[_0x844e('0x4f')]=_0x3d4a20[_0x844e('0x11')];_0x5dca66[_0x844e('0x50')]=_0x32e097[_0x844e('0x51')][_0x844e('0x11')];_0x5dca66[_0x844e('0x52')]=_0x32e097[_0x844e('0x51')]['id'];_0x5dca66[_0x844e('0x4e')]=!![];_0x5dca66[_0x844e('0x53')]=moment()[_0x844e('0x54')](_0x844e('0x55'));_0x5dca66[_0x844e('0x56')]=_0x40410d[_0x844e('0x57')];_0x5dca66['campaigntype']=_0x40410d[_0x844e('0x46')]?_0x844e('0x58'):'ivr';return db[_0x844e('0x59')]['find']({'where':{'id':_0x5dca66[_0x844e('0x5a')]},'attributes':[_0x844e('0x5b'),_0x844e('0x5c')]})['then'](function(_0x48202c){if(!_[_0x844e('0x5d')](_0x694791)&&!_[_0x844e('0x5d')](_0x48202c[_0x844e('0x5b')])){_0x5dca66[_0x844e('0x5e')]=_0x48202c[_0x844e('0x5b')];if(!_['isNil'](_0x48202c[_0x844e('0x5c')])){_0x5dca66[_0x844e('0x5e')]+='\x20'+_0x48202c[_0x844e('0x5c')];}}})[_0x844e('0x5f')](function(){return db['CmHopperFinal'][_0x844e('0x43')](_0x5dca66);});}})[_0x844e('0xe')](function(_0x2fe55d){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x510089}});})[_0x844e('0xe')](function(){return _0x694791[_0x844e('0x5')](0xcc)[_0x844e('0x60')]();})['catch'](handleError(_0x694791,null));};exports['getPreview']=function(_0x33798f,_0xd36868){var _0xd73b00=[];return db['CmContact'][_0x844e('0x45')]()[_0x844e('0xe')](function(_0x210a37){_0xd73b00=_['keys'](_0x210a37);return _0x33798f[_0x844e('0x51')][_0x844e('0x61')]({'where':{'type':_0x844e('0x62'),'dialActive':!![],'dialMethod':_0x844e('0x63')},'attributes':['id','dialOrderByScheduledAt',_0x844e('0x64')],'raw':!![]});})[_0x844e('0xe')](function(_0x3ca50f){if(_0x3ca50f&&_0x3ca50f[_0x844e('0x31')]){return db[_0x844e('0x65')][_0x844e('0x66')](function(_0x42d335){var _0x651093={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x844e('0x13')](_0x3ca50f,'id')},'$or':[{'UserId':null},{'UserId':_0x33798f['user']['id']}]};var _0x252ff9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3ca50f)[_0x844e('0x37')]([_0x844e('0x64'),0x0])[_0x844e('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x33798f['user']['id']}]};var _0x4ff698={'$or':[_0x651093,_0x252ff9]};var _0x4e4ece=[];if(_0x33798f['body']['direction']&&_0x33798f[_0x844e('0x44')][_0x844e('0x67')]===_0x844e('0x68')){if(!_['isEmpty'](_0x33798f[_0x844e('0x44')][_0x844e('0x69')])){_0x4ff698['id']={'$in':_0x33798f['body'][_0x844e('0x69')]};}_0x4e4ece=[['priority',_0x844e('0x6a')],[_0x844e('0x6b'),_0x3ca50f[0x0][_0x844e('0x6c')]===_0x844e('0x6a')?'DESC':'ASC'],db['sequelize'][_0x844e('0x6d')](_0x844e('0x6e')),['id',_0x844e('0x6f')]];}else{if(!_[_0x844e('0x70')](_0x33798f[_0x844e('0x44')]['hopperIds'])){_0x4ff698['id']={'$notIn':_0x33798f['body'][_0x844e('0x69')]};}_0x4e4ece=[[_0x844e('0x71'),_0x844e('0x6f')],[_0x844e('0x6b'),_0x3ca50f[0x0][_0x844e('0x6c')]],db[_0x844e('0x65')]['literal'](_0x844e('0x72')),['id',_0x844e('0x6a')]];}return db['CmHopper'][_0x844e('0x73')]({'attributes':['id',_0x844e('0x74'),'phone','recallme'],'where':_0x4ff698,'order':_0x4e4ece,'transaction':_0x42d335,'lock':_0x42d335[_0x844e('0x75')][_0x844e('0x76')],'include':[{'model':db[_0x844e('0x59')],'as':'Contact','attributes':_0xd73b00,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x844e('0x11')]}]},{'model':db['CmList'],'as':_0x844e('0x77'),'attributes':['id',_0x844e('0x11')]},{'model':db[_0x844e('0x48')],'as':_0x844e('0x78'),'attributes':['id',_0x844e('0x11'),_0x844e('0x79')]}]})['then'](function(_0x1e8663){if(_0x1e8663){return _0x1e8663[_0x844e('0xd')]({'UserId':_0x33798f['user']['id']},{'transaction':_0x42d335});}});});}})[_0x844e('0xe')](handleEntityNotFound(_0xd36868,null))[_0x844e('0xe')](respondWithResult(_0xd36868,null))[_0x844e('0x42')](handleError(_0xd36868,null));};exports[_0x844e('0x7a')]=function(_0x36ec29,_0x5c53b8,_0x48b7df){var _0x304e7b=[];var _0x14b226=_0x36ec29[_0x844e('0x40')]['id'];var _0xfc0fb3=_0x36ec29[_0x844e('0x51')]['id'];return db[_0x844e('0x59')][_0x844e('0x45')]()['then'](function(_0x24862f){_0x304e7b=_[_0x844e('0x19')](_0x24862f);return db['sequelize'][_0x844e('0x66')](function(_0x3a0b58){const _0x78bf8f={'id':_0x14b226};return db['CmHopper']['findOne']({'attributes':['id',_0x844e('0x74'),_0x844e('0x7b')],'where':_0x78bf8f,'transaction':_0x3a0b58,'lock':_0x3a0b58['LOCK'][_0x844e('0x76')],'include':[{'model':db[_0x844e('0x59')],'as':_0x844e('0x7c'),'attributes':_0x304e7b,'include':[{'model':db[_0x844e('0x7d')],'as':_0x844e('0x7e'),'attributes':['id',_0x844e('0x11')]}]},{'model':db[_0x844e('0x7f')],'as':'List','attributes':['id',_0x844e('0x11')]},{'model':db['VoiceQueue'],'as':_0x844e('0x78'),'attributes':['id','name',_0x844e('0x79')]}]})['then'](function(_0x396c72){if(_0x396c72){return _0x396c72[_0x844e('0xd')]({'UserId':_0xfc0fb3},{'transaction':_0x3a0b58});}});});})['then'](handleEntityNotFound(_0x5c53b8,null))[_0x844e('0xe')](respondWithResult(_0x5c53b8,null))[_0x844e('0x42')](handleError(_0x5c53b8,null));};exports[_0x844e('0x80')]=function(_0x1a9c64,_0x4508af){return _0x1a9c64['user'][_0x844e('0x61')]({'where':{'type':_0x844e('0x62'),'dialActive':!![],'dialMethod':_0x844e('0x63')},'attributes':['id'],'raw':!![]})[_0x844e('0xe')](function(_0x220b2c){if(_0x220b2c&&_0x220b2c[_0x844e('0x31')]){return db[_0x844e('0x14')][_0x844e('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x844e('0x54')](_0x844e('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x220b2c,'id')},'$or':[{'UserId':null},{'UserId':_0x1a9c64[_0x844e('0x51')]['id']}]}});}return 0x0;})[_0x844e('0xe')](function(_0x264d2d){if(!_[_0x844e('0x5d')](_0x264d2d)&&_[_0x844e('0x81')](_0x264d2d)){return _0x4508af[_0x844e('0x5')](0xc8)[_0x844e('0x6')]({'contacts':_0x264d2d});}else{logger[_0x844e('0xf')](_0x844e('0x82'),_0x844e('0x80'),0x194,_0x844e('0x83'));_0x4508af[_0x844e('0x84')](0x194);}})[_0x844e('0x42')](handleError(_0x4508af,null));};exports[_0x844e('0x85')]=function(_0xa16879,_0x5320cb){var _0x3f8c41=shared['timezones'];var _0x2b975b=[];_[_0x844e('0x13')](_0x3f8c41,function(_0x2df9ac){_0x2b975b[_0x844e('0x86')]({'id':_0x2df9ac[_0x844e('0x11')],'name':_0x2df9ac['name'],'utcOffset':_0x2df9ac[_0x844e('0x87')]});});return _0x5320cb[_0x844e('0x5')](0xc8)[_0x844e('0x6')]({'tz':_0x2b975b});};exports['getTimezone']=function(_0x5a8ac3,_0x2e4bcb){var _0x29fd78=shared['timezones'];var _0x2d5c5f={};if(!_[_0x844e('0x5d')](_0x29fd78[_0x5a8ac3[_0x844e('0x44')]['id']]))_0x2d5c5f=_0x29fd78[_0x5a8ac3[_0x844e('0x44')]['id']];return _0x2e4bcb[_0x844e('0x5')](0xc8)[_0x844e('0x6')](_0x2d5c5f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6389d06..8e8b7b9 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x138b2b,_0x211633){var _0x9c6e22=function(_0x969c){while(--_0x969c){_0x138b2b['push'](_0x138b2b['shift']());}};_0x9c6e22(++_0x211633);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x0295,0x1f0));var _0x5029=function(_0x58c56a,_0x40d9e4){_0x58c56a=_0x58c56a-0x0;var _0x4f83d0=_0x0295[_0x58c56a];return _0x4f83d0;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index fe373f6..10b6e9b 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 _0x505d=['dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','transaction','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length'];(function(_0x3a3343,_0x14acc5){var _0x318e34=function(_0x556045){while(--_0x556045){_0x3a3343['push'](_0x3a3343['shift']());}};_0x318e34(++_0x14acc5);}(_0x505d,0xb9));var _0xd505=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x505d[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xd505('0x0'));var util=require(_0xd505('0x1'));var moment=require('moment');var BPromise=require(_0xd505('0x2'));var db=require(_0xd505('0x3'))['db'];var logger=require(_0xd505('0x4'))(_0xd505('0x5'));exports[_0xd505('0x6')]=function(_0x20880b){var _0x299d3e=this;return new Promise(function(_0x2ce572,_0x3f94e9){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x20880b[_0xd505('0x9')]?_0x20880b['options'][_0xd505('0xb')]||null:null,'attributes':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x20880b['options']?_0x20880b[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x20880b['options'][_0xd505('0xf')],function(_0x1c6751){return{'model':db[_0x1c6751[_0xd505('0x10')]],'as':_0x1c6751['as'],'attributes':_0x1c6751['attributes'],'include':_0x1c6751[_0xd505('0xf')]?_['map'](_0x1c6751[_0xd505('0xf')],function(_0x1dd011){return{'model':db[_0x1dd011[_0xd505('0x10')]],'as':_0x1dd011['as'],'attributes':_0x1dd011[_0xd505('0xc')],'include':_0x1dd011['include']?_[_0xd505('0xe')](_0x1dd011['include'],function(_0x32c6f7){return{'model':db[_0x32c6f7[_0xd505('0x10')]],'as':_0x32c6f7['as'],'attributes':_0x32c6f7[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x5d3aa2){logger[_0xd505('0x12')](_0xd505('0x6'),_0x20880b);logger[_0xd505('0x13')]('GetCmHopper',_0x20880b,JSON[_0xd505('0x14')](_0x5d3aa2));_0x2ce572(_0x5d3aa2);})[_0xd505('0x15')](function(_0x1b558a){logger[_0xd505('0x16')](_0xd505('0x6'),_0x1b558a['message'],_0x20880b);_0x3f94e9(_0x299d3e[_0xd505('0x16')](0x1f4,_0x1b558a[_0xd505('0x17')]));});});};exports['ShowCmHopper']=function(_0x31b03f){var _0x3f6da0=this;return new Promise(function(_0x5285ac,_0x214c44){return db[_0xd505('0x7')][_0xd505('0x18')]({'raw':_0x31b03f[_0xd505('0x9')]?_0x31b03f['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x31b03f['options']?_0x31b03f[_0xd505('0x9')][_0xd505('0xc')]||null:null,'include':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xf')]?_['map'](_0x31b03f['options'][_0xd505('0xf')],function(_0x485166){return{'model':db[_0x485166[_0xd505('0x10')]],'as':_0x485166['as'],'attributes':_0x485166[_0xd505('0xc')],'include':_0x485166[_0xd505('0xf')]?_[_0xd505('0xe')](_0x485166[_0xd505('0xf')],function(_0x983885){return{'model':db[_0x983885['model']],'as':_0x983885['as'],'attributes':_0x983885[_0xd505('0xc')],'include':_0x983885[_0xd505('0xf')]?_[_0xd505('0xe')](_0x983885[_0xd505('0xf')],function(_0x57038a){return{'model':db[_0x57038a['model']],'as':_0x57038a['as'],'attributes':_0x57038a[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x55ad93){logger['info'](_0xd505('0x19'),_0x31b03f);logger[_0xd505('0x13')](_0xd505('0x19'),_0x31b03f,JSON['stringify'](_0x55ad93));_0x5285ac(_0x55ad93);})[_0xd505('0x15')](function(_0x2809d7){logger['error']('ShowCmHopper',_0x2809d7[_0xd505('0x17')],_0x31b03f);_0x214c44(_0x3f6da0[_0xd505('0x16')](0x1f4,_0x2809d7[_0xd505('0x17')]));});});};exports[_0xd505('0x1a')]=function(_0x487625){var _0x49a677=this;return new Promise(function(_0x5ec4a1,_0x1682ec){return db[_0xd505('0x7')][_0xd505('0x1b')](_0x487625[_0xd505('0x1c')],{'raw':_0x487625[_0xd505('0x9')]?_0x487625[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![]})[_0xd505('0x11')](function(_0x1a93c7){logger['info']('CreateCmHopper',_0x487625);logger[_0xd505('0x13')](_0xd505('0x1a'),_0x487625,JSON['stringify'](_0x1a93c7));_0x5ec4a1(_0x1a93c7);})[_0xd505('0x15')](function(_0x5e341a){logger[_0xd505('0x16')]('CreateCmHopper',_0x5e341a[_0xd505('0x17')],_0x487625);_0x1682ec(_0x49a677[_0xd505('0x16')](0x1f4,_0x5e341a['message']));});});};exports['UpdateCmHopper']=function(_0x223246){var _0x21d4c9=this;return new Promise(function(_0xb0127e,_0x3cc8db){return db[_0xd505('0x7')][_0xd505('0x1d')](_0x223246[_0xd505('0x1c')],{'raw':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')]['where']||null:null,'attributes':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')][_0xd505('0xd')]||null:null})[_0xd505('0x11')](function(_0x2c509d){logger[_0xd505('0x12')](_0xd505('0x1e'),_0x223246);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd505('0x14')](_0x223246['options'][_0xd505('0xb')]),_0x223246[_0xd505('0x1c')][_0xd505('0x1f')]);logger['debug']('UpdateCmHopper',_0x223246,JSON[_0xd505('0x14')](_0x2c509d));_0xb0127e(_0x2c509d);})[_0xd505('0x15')](function(_0x389b39){logger[_0xd505('0x16')](_0xd505('0x1e'),_0x389b39[_0xd505('0x17')],_0x223246);_0x3cc8db(_0x21d4c9[_0xd505('0x16')](0x1f4,_0x389b39['message']));});});};exports[_0xd505('0x20')]=function(_0x4a2b84){var _0x2f2206=this;return new Promise(function(_0x5ebe3b,_0x205444){return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x4a2b84[_0xd505('0x9')]?_0x4a2b84[_0xd505('0x9')][_0xd505('0xb')]||null:null})['then'](function(_0x354cba){logger[_0xd505('0x12')](_0xd505('0x20'),_0x4a2b84);logger[_0xd505('0x13')](_0xd505('0x20'),_0x4a2b84,JSON[_0xd505('0x14')](_0x354cba));_0x5ebe3b(_0x354cba);})[_0xd505('0x15')](function(_0x59936d){logger[_0xd505('0x16')](_0xd505('0x20'),_0x59936d[_0xd505('0x17')],_0x4a2b84);_0x205444(_0x2f2206['error'](0x1f4,_0x59936d[_0xd505('0x17')]));});});};exports[_0xd505('0x22')]=function(_0x531359){var _0x6ee653=this;return new Promise(function(_0x28cfec,_0x5ebd36){return db['CmContact'][_0xd505('0x23')]()[_0xd505('0x11')](function(_0x4710e6){return db[_0xd505('0x24')]['transaction'](function(_0x281e2e){return db[_0xd505('0x7')]['findAll']({'where':_0x531359['options']?_0x531359['options'][_0xd505('0xb')]||null:null,'attributes':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')]['attributes']||null:null,'limit':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')][_0xd505('0xd')]||null:null,'order':_0x531359['options']?_0x531359['options'][_0xd505('0x25')]||null:null,'transaction':_0x281e2e,'lock':_0x281e2e[_0xd505('0x26')][_0xd505('0x27')],'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29'),'attributes':_[_0xd505('0x2a')](_0x4710e6)},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id',_0xd505('0x2d'),_0xd505('0x2e')]}]})[_0xd505('0x11')](function(_0x34a3c6){var _0x31b885=[];var _0x4540e2=[];for(var _0x3f110a=0x0;_0x3f110a<_0x34a3c6['length'];_0x3f110a+=0x1){var _0x3281df=_0x34a3c6[_0x3f110a][_0xd505('0x2f')];if(_0x3281df===null){_0x31b885[_0xd505('0x30')](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}else if(!_0x4540e2[_0xd505('0x31')](_0x3281df)){_0x4540e2['push'](_0x3281df);_0x31b885['push'](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}}return BPromise[_0xd505('0x32')](_0x31b885);});})[_0xd505('0x11')](function(_0x227212){logger[_0xd505('0x12')]('GetContactDialer',_0x531359);if(_0x227212[_0xd505('0x33')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x227212[0x0][_0xd505('0x34')]['id'],_0x227212[0x0][_0xd505('0x34')]['ContactId'],_0x227212[0x0][_0xd505('0x34')][_0xd505('0x1f')]);}logger[_0xd505('0x13')](_0xd505('0x22'),_0x531359,JSON[_0xd505('0x14')](_0x227212));_0x28cfec(_0x227212);})[_0xd505('0x15')](function(_0x1ebcf4){logger[_0xd505('0x16')](_0xd505('0x22'),_0x1ebcf4['message'],_0x531359);_0x5ebd36(_0x6ee653[_0xd505('0x16')](0x1f4,_0x1ebcf4[_0xd505('0x17')]));});});});};exports[_0xd505('0x35')]=function(_0x1cf21c){var _0x3b0cd7=this;return new Promise(function(_0x27a668,_0x29e381){return db['sequelize']['transaction'](function(_0x5874a3){return db[_0xd505('0x36')][_0xd505('0x1b')](_0x1cf21c[_0xd505('0x1c')],{'raw':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'transaction':_0x5874a3})[_0xd505('0x11')](function(){logger[_0xd505('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1cf21c[_0xd505('0x9')]['where']),_0x1cf21c[_0xd505('0x9')]['where']['active']);return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xb')]||null:null,'transaction':_0x5874a3});});})[_0xd505('0x11')](function(_0x1819fe){logger[_0xd505('0x12')](_0xd505('0x35'),_0x1cf21c);logger['debug']('MoveContactManagedDialer',_0x1cf21c,JSON[_0xd505('0x14')](_0x1819fe));_0x27a668(_0x1819fe);})[_0xd505('0x15')](function(_0x95fbc1){logger[_0xd505('0x16')](_0xd505('0x35'),_0x95fbc1['message'],_0x1cf21c);_0x29e381(_0x3b0cd7[_0xd505('0x16')](0x1f4,_0x95fbc1['message']));});});};exports[_0xd505('0x37')]=function(_0x406c1c){var _0x354771=this;return new Promise(function(_0x2e02c0,_0x2275a3){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x406c1c[_0xd505('0x9')]?_0x406c1c[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x406c1c['options']?_0x406c1c[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':[[db[_0xd505('0x24')]['fn'](_0xd505('0x38'),db[_0xd505('0x24')]['fn']('IF',db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x3a')+util[_0xd505('0x3b')](_0xd505('0x3c'),moment()[_0xd505('0x3b')](_0xd505('0x3d')))+_0xd505('0x3e')))),_0xd505('0x3f')]]})[_0xd505('0x11')](function(_0x16efc8){logger['info'](_0xd505('0x37'),_0x406c1c);logger[_0xd505('0x13')](_0xd505('0x37'),_0x406c1c,JSON[_0xd505('0x14')](_0x16efc8));_0x2e02c0(_0x16efc8);})[_0xd505('0x15')](function(_0x190175){logger['error'](_0xd505('0x37'),_0x190175[_0xd505('0x17')],_0x406c1c);_0x2275a3(_0x354771[_0xd505('0x16')](0x1f4,_0x190175['message']));});});};exports['GetContactRecallMe']=function(_0xe1a363){var _0x5eacf9=this;return new Promise(function(_0x510a4a,_0x99cef3){return db[_0xd505('0x28')][_0xd505('0x23')]()[_0xd505('0x11')](function(){return db[_0xd505('0x24')]['transaction'](function(_0x598bfc){return db[_0xd505('0x7')]['findAll']({'where':_0xe1a363['options']?_0xe1a363['options']['where']||null:null,'attributes':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':0x1,'order':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0x25')]||null:null,'group':db[_0xd505('0x7')][_0xd505('0x2f')],'transaction':_0x598bfc,'lock':_0x598bfc[_0xd505('0x26')][_0xd505('0x27')],'include':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0xe1a363[_0xd505('0x9')][_0xd505('0xf')],function(_0x1477f5){return{'model':db[_0x1477f5[_0xd505('0x10')]],'as':_0x1477f5['as'],'attributes':_0x1477f5[_0xd505('0xc')],'include':_0x1477f5[_0xd505('0xf')]?_[_0xd505('0xe')](_0x1477f5[_0xd505('0xf')],function(_0x346bce){return{'model':db[_0x346bce[_0xd505('0x10')]],'as':_0x346bce['as'],'attributes':_0x346bce['attributes'],'include':_0x346bce[_0xd505('0xf')]?_[_0xd505('0xe')](_0x346bce['include'],function(_0x342311){return{'model':db[_0x342311['model']],'as':_0x342311['as'],'attributes':_0x342311['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e63e){var _0x545e06=[];for(var _0x9b90e3=0x0;_0x9b90e3<_0x35e63e[_0xd505('0x33')];_0x9b90e3+=0x1){_0x545e06['push'](_0x35e63e[_0x9b90e3]['update'](_0xe1a363['body'],{'transaction':_0x598bfc}));}return BPromise[_0xd505('0x32')](_0x545e06);});})[_0xd505('0x11')](function(_0x1e4a1d){logger['info']('GetContactRecallMe',_0xe1a363);logger[_0xd505('0x13')]('GetContactRecallMe',_0xe1a363,JSON[_0xd505('0x14')](_0x1e4a1d));_0x510a4a(_0x1e4a1d);})['catch'](function(_0x31d1c2){logger[_0xd505('0x16')](_0xd505('0x40'),_0x31d1c2[_0xd505('0x17')],_0xe1a363);_0x99cef3(_0x5eacf9[_0xd505('0x16')](0x1f4,_0x31d1c2[_0xd505('0x17')]));});});});};exports[_0xd505('0x41')]=function(_0x5129c1){var _0x345e41=this;return new Promise(function(_0x3142ff,_0x495ca1){db['CmContact']['describe']()[_0xd505('0x11')](function(_0x30475b){return db[_0xd505('0x7')]['findAll']({'raw':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x5129c1['options']?_0x5129c1['options']['attributes']||null:null,'limit':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x5129c1['options']['include'],function(_0x580b31){return{'model':db[_0x580b31['model']],'as':_0x580b31['as'],'attributes':_0x580b31['as']===_0xd505('0x29')?_[_0xd505('0x2a')](_0x30475b):_0x580b31[_0xd505('0xc')],'include':_0x580b31[_0xd505('0xf')]?_['map'](_0x580b31[_0xd505('0xf')],function(_0x4c4f4c){return{'model':db[_0x4c4f4c[_0xd505('0x10')]],'as':_0x4c4f4c['as'],'attributes':_0x4c4f4c[_0xd505('0xc')],'include':_0x4c4f4c['include']?_[_0xd505('0xe')](_0x4c4f4c[_0xd505('0xf')],function(_0x2e8641){return{'model':db[_0x2e8641[_0xd505('0x10')]],'as':_0x2e8641['as'],'attributes':_0x2e8641[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x2d6997){logger[_0xd505('0x12')](_0xd505('0x6'),_0x5129c1);logger[_0xd505('0x13')](_0xd505('0x6'),_0x5129c1,JSON[_0xd505('0x14')](_0x2d6997));_0x3142ff(_0x2d6997);})[_0xd505('0x15')](function(_0x494092){logger[_0xd505('0x16')]('GetCmHopper',_0x494092['message'],_0x5129c1);_0x495ca1(_0x345e41[_0xd505('0x16')](0x1f4,_0x494092[_0xd505('0x17')]));});});});};exports[_0xd505('0x42')]=function(_0x57610d){var _0x54e260=this;return new Promise(function(_0x4e7100,_0x419d72){return db[_0xd505('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x57610d[_0xd505('0x9')][_0xd505('0xb')]['phone']},'attributes':['id',_0xd505('0x43')],'order':[['id',_0xd505('0x44')]]})[_0xd505('0x11')](function(_0x1e4d4a){logger[_0xd505('0x12')](_0xd505('0x45'),_0x57610d);logger[_0xd505('0x13')]('getContactByPhone',_0x57610d,JSON[_0xd505('0x14')](_0x1e4d4a));_0x4e7100(_0x1e4d4a);})['catch'](function(_0x4fc79f){logger['error'](_0xd505('0x45'),_0x4fc79f[_0xd505('0x17')],_0x57610d);_0x419d72(_0x54e260[_0xd505('0x16')](0x1f4,_0x4fc79f[_0xd505('0x17')]));});});};exports['ResetActiveCalls']=function(_0x34fac9){var _0x5c9175=this;return new Promise(function(_0x38ddc8,_0x20dabf){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x32ccf3){var _0x848404=_0x34fac9[_0xd505('0x9')]&&_0x34fac9['options'][_0xd505('0xb')]?_0x34fac9[_0xd505('0x9')]['where']:{};return db['CmHopper'][_0xd505('0x1d')](_0x34fac9[_0xd505('0x1c')],{'where':_0x848404,'transaction':_0x32ccf3})['then'](function(_0x5f157a){logger['info'](_0xd505('0x47'),_0x34fac9);logger['debug'](_0xd505('0x47'),_0x34fac9,JSON[_0xd505('0x14')](_0x5f157a));_0x38ddc8(_0x5f157a);})[_0xd505('0x15')](function(_0x360bda){logger[_0xd505('0x16')]('ResetActiveCalls',_0x360bda['message'],_0x34fac9);_0x20dabf(_0x5c9175[_0xd505('0x16')](0x1f4,_0x360bda['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x22c0f4){var _0x29f040=this;var _0x389084=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')]['voiceQueueIds'];var _0x3469b1=_0x22c0f4['body'][_0xd505('0xb')][_0xd505('0x48')];var _0x2cd4d7=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')][_0xd505('0x49')];return new Promise(function(_0x5b37b4,_0x38410d){return db[_0xd505('0x7')][_0xd505('0x8')]({'where':{'voiceQueueId':{'$in':_0x389084},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x4a')+_0x3469b1+_0xd505('0x4b')),'$gt':db['sequelize'][_0xd505('0x39')](_0xd505('0x4c'))}},'UserId':{'$in':_0x2cd4d7}},'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29')},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id','name',_0xd505('0x2e')]},{'model':db[_0xd505('0x4d')],'as':'List'}]})[_0xd505('0x11')](function(_0x3697cd){if(_0x3697cd[_0xd505('0x33')]>0x0){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x2566e4){return db['CmHopper'][_0xd505('0x1d')]({'recallmeNotifiedDate':db[_0xd505('0x24')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0xd505('0xe')](_0x3697cd,'id')}},'transaction':_0x2566e4})[_0xd505('0x11')](function(){_0x5b37b4(_0x3697cd);})[_0xd505('0x15')](function(_0x22cc7e){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x22cc7e['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x22cc7e[_0xd505('0x17')]));});})[_0xd505('0x15')](function(_0x3eb873){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x3eb873['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x3eb873[_0xd505('0x17')]));});}else{_0x5b37b4(_0x3697cd);}});});}; \ No newline at end of file +var _0xdc7e=['CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','\x20MINUTE','NOW()','Agent','name','CmList','List','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','options','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','CmHopper','raw','CreateCmHopper','create','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','Contact','keys','User','voicePause','length','UserId','push','includes','update','all','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls'];(function(_0x3cb662,_0x5eb919){var _0x4e2048=function(_0x4c08ad){while(--_0x4c08ad){_0x3cb662['push'](_0x3cb662['shift']());}};_0x4e2048(++_0x5eb919);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x53b917,_0x1879d1){_0x53b917=_0x53b917-0x0;var _0x4d593e=_0xdc7e[_0x53b917];return _0x4d593e;};'use strict';var _=require(_0xedc7('0x0'));var util=require(_0xedc7('0x1'));var moment=require('moment');var BPromise=require(_0xedc7('0x2'));var db=require(_0xedc7('0x3'))['db'];var logger=require(_0xedc7('0x4'))(_0xedc7('0x5'));exports[_0xedc7('0x6')]=function(_0x5571b7){var _0x2a59a2=this;return new Promise(function(_0x5766cc,_0x4b5b64){return db['CmHopper'][_0xedc7('0x7')]({'raw':_0x5571b7[_0xedc7('0x8')]?_0x5571b7[_0xedc7('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5571b7[_0xedc7('0x8')]?_0x5571b7[_0xedc7('0x8')][_0xedc7('0x9')]||null:null,'attributes':_0x5571b7[_0xedc7('0x8')]?_0x5571b7[_0xedc7('0x8')][_0xedc7('0xa')]||null:null,'limit':_0x5571b7[_0xedc7('0x8')]?_0x5571b7[_0xedc7('0x8')][_0xedc7('0xb')]||null:null,'include':_0x5571b7[_0xedc7('0x8')]?_0x5571b7[_0xedc7('0x8')]['include']?_[_0xedc7('0xc')](_0x5571b7['options'][_0xedc7('0xd')],function(_0x2acbdc){return{'model':db[_0x2acbdc[_0xedc7('0xe')]],'as':_0x2acbdc['as'],'attributes':_0x2acbdc[_0xedc7('0xa')],'include':_0x2acbdc['include']?_['map'](_0x2acbdc[_0xedc7('0xd')],function(_0x5b9b1e){return{'model':db[_0x5b9b1e[_0xedc7('0xe')]],'as':_0x5b9b1e['as'],'attributes':_0x5b9b1e[_0xedc7('0xa')],'include':_0x5b9b1e[_0xedc7('0xd')]?_[_0xedc7('0xc')](_0x5b9b1e[_0xedc7('0xd')],function(_0x57bf4f){return{'model':db[_0x57bf4f[_0xedc7('0xe')]],'as':_0x57bf4f['as'],'attributes':_0x57bf4f[_0xedc7('0xa')]};}):[]};}):[]};}):[]:[]})[_0xedc7('0xf')](function(_0x32a4be){logger[_0xedc7('0x10')](_0xedc7('0x6'),_0x5571b7);logger[_0xedc7('0x11')]('GetCmHopper',_0x5571b7,JSON[_0xedc7('0x12')](_0x32a4be));_0x5766cc(_0x32a4be);})[_0xedc7('0x13')](function(_0x810fae){logger['error'](_0xedc7('0x6'),_0x810fae[_0xedc7('0x14')],_0x5571b7);_0x4b5b64(_0x2a59a2[_0xedc7('0x15')](0x1f4,_0x810fae[_0xedc7('0x14')]));});});};exports[_0xedc7('0x16')]=function(_0xc78561){var _0x296063=this;return new Promise(function(_0x2cbb99,_0x1d43dc){return db[_0xedc7('0x17')]['find']({'raw':_0xc78561[_0xedc7('0x8')]?_0xc78561['options'][_0xedc7('0x18')]===undefined?!![]:![]:!![],'where':_0xc78561[_0xedc7('0x8')]?_0xc78561[_0xedc7('0x8')]['where']||null:null,'attributes':_0xc78561['options']?_0xc78561['options'][_0xedc7('0xa')]||null:null,'include':_0xc78561[_0xedc7('0x8')]?_0xc78561[_0xedc7('0x8')][_0xedc7('0xd')]?_[_0xedc7('0xc')](_0xc78561[_0xedc7('0x8')][_0xedc7('0xd')],function(_0x17c9eb){return{'model':db[_0x17c9eb['model']],'as':_0x17c9eb['as'],'attributes':_0x17c9eb[_0xedc7('0xa')],'include':_0x17c9eb[_0xedc7('0xd')]?_[_0xedc7('0xc')](_0x17c9eb[_0xedc7('0xd')],function(_0x5ca12f){return{'model':db[_0x5ca12f[_0xedc7('0xe')]],'as':_0x5ca12f['as'],'attributes':_0x5ca12f[_0xedc7('0xa')],'include':_0x5ca12f[_0xedc7('0xd')]?_[_0xedc7('0xc')](_0x5ca12f['include'],function(_0x4f8a07){return{'model':db[_0x4f8a07[_0xedc7('0xe')]],'as':_0x4f8a07['as'],'attributes':_0x4f8a07[_0xedc7('0xa')]};}):[]};}):[]};}):[]:[]})[_0xedc7('0xf')](function(_0x3fa98d){logger[_0xedc7('0x10')](_0xedc7('0x16'),_0xc78561);logger[_0xedc7('0x11')](_0xedc7('0x16'),_0xc78561,JSON[_0xedc7('0x12')](_0x3fa98d));_0x2cbb99(_0x3fa98d);})[_0xedc7('0x13')](function(_0x540e68){logger[_0xedc7('0x15')](_0xedc7('0x16'),_0x540e68[_0xedc7('0x14')],_0xc78561);_0x1d43dc(_0x296063[_0xedc7('0x15')](0x1f4,_0x540e68[_0xedc7('0x14')]));});});};exports[_0xedc7('0x19')]=function(_0x142ffc){var _0x366674=this;return new Promise(function(_0x3fa137,_0x3eba23){return db[_0xedc7('0x17')][_0xedc7('0x1a')](_0x142ffc['body'],{'raw':_0x142ffc[_0xedc7('0x8')]?_0x142ffc['options'][_0xedc7('0x18')]===undefined?!![]:![]:!![]})[_0xedc7('0xf')](function(_0x546b41){logger[_0xedc7('0x10')](_0xedc7('0x19'),_0x142ffc);logger['debug'](_0xedc7('0x19'),_0x142ffc,JSON[_0xedc7('0x12')](_0x546b41));_0x3fa137(_0x546b41);})['catch'](function(_0x189ca8){logger[_0xedc7('0x15')](_0xedc7('0x19'),_0x189ca8['message'],_0x142ffc);_0x3eba23(_0x366674[_0xedc7('0x15')](0x1f4,_0x189ca8[_0xedc7('0x14')]));});});};exports[_0xedc7('0x1b')]=function(_0x5d6061){var _0xec0ed8=this;return new Promise(function(_0x47821d,_0x130ee2){return db[_0xedc7('0x17')]['update'](_0x5d6061['body'],{'raw':_0x5d6061['options']?_0x5d6061[_0xedc7('0x8')][_0xedc7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6061[_0xedc7('0x8')]?_0x5d6061['options'][_0xedc7('0x9')]||null:null,'attributes':_0x5d6061[_0xedc7('0x8')]?_0x5d6061[_0xedc7('0x8')]['attributes']||null:null,'limit':_0x5d6061[_0xedc7('0x8')]?_0x5d6061['options']['limit']||null:null})[_0xedc7('0xf')](function(_0x572a0e){logger['info']('UpdateCmHopper',_0x5d6061);logger[_0xedc7('0x10')](_0xedc7('0x1c'),JSON[_0xedc7('0x12')](_0x5d6061[_0xedc7('0x8')][_0xedc7('0x9')]),_0x5d6061[_0xedc7('0x1d')][_0xedc7('0x1e')]);logger['debug'](_0xedc7('0x1b'),_0x5d6061,JSON['stringify'](_0x572a0e));_0x47821d(_0x572a0e);})['catch'](function(_0x8504d3){logger['error'](_0xedc7('0x1b'),_0x8504d3['message'],_0x5d6061);_0x130ee2(_0xec0ed8[_0xedc7('0x15')](0x1f4,_0x8504d3[_0xedc7('0x14')]));});});};exports[_0xedc7('0x1f')]=function(_0x457afd){var _0x11f6d4=this;return new Promise(function(_0x330040,_0x30ef34){return db[_0xedc7('0x17')][_0xedc7('0x20')]({'where':_0x457afd[_0xedc7('0x8')]?_0x457afd[_0xedc7('0x8')][_0xedc7('0x9')]||null:null})[_0xedc7('0xf')](function(_0x12ee4d){logger[_0xedc7('0x10')](_0xedc7('0x1f'),_0x457afd);logger['debug'](_0xedc7('0x1f'),_0x457afd,JSON[_0xedc7('0x12')](_0x12ee4d));_0x330040(_0x12ee4d);})['catch'](function(_0x47ce61){logger[_0xedc7('0x15')](_0xedc7('0x1f'),_0x47ce61[_0xedc7('0x14')],_0x457afd);_0x30ef34(_0x11f6d4[_0xedc7('0x15')](0x1f4,_0x47ce61[_0xedc7('0x14')]));});});};exports[_0xedc7('0x21')]=function(_0x355744){var _0x56bb6b=this;return new Promise(function(_0x4b17b7,_0xdf6caf){return db[_0xedc7('0x22')][_0xedc7('0x23')]()['then'](function(_0x12982b){return db[_0xedc7('0x24')][_0xedc7('0x25')](function(_0x197395){return db['CmHopper'][_0xedc7('0x7')]({'where':_0x355744[_0xedc7('0x8')]?_0x355744[_0xedc7('0x8')][_0xedc7('0x9')]||null:null,'attributes':_0x355744[_0xedc7('0x8')]?_0x355744[_0xedc7('0x8')][_0xedc7('0xa')]||null:null,'limit':_0x355744[_0xedc7('0x8')]?_0x355744[_0xedc7('0x8')][_0xedc7('0xb')]||null:null,'order':_0x355744['options']?_0x355744[_0xedc7('0x8')][_0xedc7('0x26')]||null:null,'transaction':_0x197395,'lock':_0x197395['LOCK']['UPDATE'],'include':[{'model':db[_0xedc7('0x22')],'as':_0xedc7('0x27'),'attributes':_[_0xedc7('0x28')](_0x12982b)},{'model':db[_0xedc7('0x29')],'as':'Agent','attributes':['id','name',_0xedc7('0x2a')]}]})['then'](function(_0x2d3921){var _0x2769d1=[];var _0x38d47a=[];for(var _0x4b9abc=0x0;_0x4b9abc<_0x2d3921[_0xedc7('0x2b')];_0x4b9abc+=0x1){var _0x1f1f9d=_0x2d3921[_0x4b9abc][_0xedc7('0x2c')];if(_0x1f1f9d===null){_0x2769d1[_0xedc7('0x2d')](_0x2d3921[_0x4b9abc]['update'](_0x355744['body'],{'transaction':_0x197395}));}else if(!_0x38d47a[_0xedc7('0x2e')](_0x1f1f9d)){_0x38d47a[_0xedc7('0x2d')](_0x1f1f9d);_0x2769d1[_0xedc7('0x2d')](_0x2d3921[_0x4b9abc][_0xedc7('0x2f')](_0x355744[_0xedc7('0x1d')],{'transaction':_0x197395}));}}return BPromise[_0xedc7('0x30')](_0x2769d1);});})['then'](function(_0x1584cf){logger['info']('GetContactDialer',_0x355744);if(_0x1584cf[_0xedc7('0x2b')]>0x0){logger[_0xedc7('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1584cf[0x0][_0xedc7('0x31')]['id'],_0x1584cf[0x0][_0xedc7('0x31')][_0xedc7('0x32')],_0x1584cf[0x0][_0xedc7('0x31')][_0xedc7('0x1e')]);}logger[_0xedc7('0x11')]('GetContactDialer',_0x355744,JSON['stringify'](_0x1584cf));_0x4b17b7(_0x1584cf);})['catch'](function(_0x1d47de){logger[_0xedc7('0x15')](_0xedc7('0x21'),_0x1d47de['message'],_0x355744);_0xdf6caf(_0x56bb6b['error'](0x1f4,_0x1d47de[_0xedc7('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x1075e2){var _0x3499f7=this;return new Promise(function(_0x2cdb5f,_0x45a25e){return db['sequelize'][_0xedc7('0x25')](function(_0x404725){return db[_0xedc7('0x33')][_0xedc7('0x1a')](_0x1075e2[_0xedc7('0x1d')],{'raw':_0x1075e2[_0xedc7('0x8')]?_0x1075e2[_0xedc7('0x8')][_0xedc7('0x18')]===undefined?!![]:![]:!![],'transaction':_0x404725})[_0xedc7('0xf')](function(){logger[_0xedc7('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1075e2['options'][_0xedc7('0x9')]),_0x1075e2[_0xedc7('0x8')][_0xedc7('0x9')]['active']);return db[_0xedc7('0x17')][_0xedc7('0x20')]({'where':_0x1075e2['options']?_0x1075e2[_0xedc7('0x8')][_0xedc7('0x9')]||null:null,'transaction':_0x404725});});})[_0xedc7('0xf')](function(_0x26f442){logger[_0xedc7('0x10')](_0xedc7('0x34'),_0x1075e2);logger[_0xedc7('0x11')](_0xedc7('0x34'),_0x1075e2,JSON['stringify'](_0x26f442));_0x2cdb5f(_0x26f442);})['catch'](function(_0x2e57a4){logger['error'](_0xedc7('0x34'),_0x2e57a4['message'],_0x1075e2);_0x45a25e(_0x3499f7[_0xedc7('0x15')](0x1f4,_0x2e57a4[_0xedc7('0x14')]));});});};exports[_0xedc7('0x35')]=function(_0x17b18c){var _0x522569=this;return new Promise(function(_0x54d6c0,_0x248583){return db['CmHopper'][_0xedc7('0x7')]({'raw':_0x17b18c[_0xedc7('0x8')]?_0x17b18c[_0xedc7('0x8')][_0xedc7('0x18')]===undefined?!![]:![]:!![],'where':_0x17b18c[_0xedc7('0x8')]?_0x17b18c['options'][_0xedc7('0x9')]||null:null,'attributes':[[db[_0xedc7('0x24')]['fn'](_0xedc7('0x36'),db[_0xedc7('0x24')]['fn']('IF',db['sequelize'][_0xedc7('0x37')](_0xedc7('0x38')+util['format'](_0xedc7('0x39'),moment()[_0xedc7('0x3a')](_0xedc7('0x3b')))+_0xedc7('0x3c')))),_0xedc7('0x3d')]]})[_0xedc7('0xf')](function(_0x484f4a){logger[_0xedc7('0x10')](_0xedc7('0x35'),_0x17b18c);logger['debug']('CountReScheduled',_0x17b18c,JSON['stringify'](_0x484f4a));_0x54d6c0(_0x484f4a);})['catch'](function(_0x1f0856){logger[_0xedc7('0x15')](_0xedc7('0x35'),_0x1f0856[_0xedc7('0x14')],_0x17b18c);_0x248583(_0x522569['error'](0x1f4,_0x1f0856[_0xedc7('0x14')]));});});};exports[_0xedc7('0x3e')]=function(_0x1c3a64){var _0xd5c1eb=this;return new Promise(function(_0x1a7897,_0x67183e){return db[_0xedc7('0x22')]['describe']()[_0xedc7('0xf')](function(){return db[_0xedc7('0x24')][_0xedc7('0x25')](function(_0x3b9cb2){return db[_0xedc7('0x17')][_0xedc7('0x7')]({'where':_0x1c3a64[_0xedc7('0x8')]?_0x1c3a64[_0xedc7('0x8')][_0xedc7('0x9')]||null:null,'attributes':_0x1c3a64['options']?_0x1c3a64[_0xedc7('0x8')][_0xedc7('0xa')]||null:null,'limit':0x1,'order':_0x1c3a64[_0xedc7('0x8')]?_0x1c3a64[_0xedc7('0x8')]['order']||null:null,'group':db[_0xedc7('0x17')][_0xedc7('0x2c')],'transaction':_0x3b9cb2,'lock':_0x3b9cb2[_0xedc7('0x3f')]['UPDATE'],'include':_0x1c3a64[_0xedc7('0x8')]?_0x1c3a64['options']['include']?_[_0xedc7('0xc')](_0x1c3a64[_0xedc7('0x8')][_0xedc7('0xd')],function(_0x2069aa){return{'model':db[_0x2069aa[_0xedc7('0xe')]],'as':_0x2069aa['as'],'attributes':_0x2069aa['attributes'],'include':_0x2069aa[_0xedc7('0xd')]?_[_0xedc7('0xc')](_0x2069aa[_0xedc7('0xd')],function(_0x137024){return{'model':db[_0x137024[_0xedc7('0xe')]],'as':_0x137024['as'],'attributes':_0x137024['attributes'],'include':_0x137024[_0xedc7('0xd')]?_['map'](_0x137024[_0xedc7('0xd')],function(_0x22a6e4){return{'model':db[_0x22a6e4[_0xedc7('0xe')]],'as':_0x22a6e4['as'],'attributes':_0x22a6e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xedc7('0xf')](function(_0xe30111){var _0x594125=[];for(var _0x55f869=0x0;_0x55f869<_0xe30111[_0xedc7('0x2b')];_0x55f869+=0x1){_0x594125[_0xedc7('0x2d')](_0xe30111[_0x55f869]['update'](_0x1c3a64[_0xedc7('0x1d')],{'transaction':_0x3b9cb2}));}return BPromise[_0xedc7('0x30')](_0x594125);});})['then'](function(_0x495d68){logger[_0xedc7('0x10')](_0xedc7('0x3e'),_0x1c3a64);logger[_0xedc7('0x11')](_0xedc7('0x3e'),_0x1c3a64,JSON[_0xedc7('0x12')](_0x495d68));_0x1a7897(_0x495d68);})[_0xedc7('0x13')](function(_0x3500f2){logger[_0xedc7('0x15')](_0xedc7('0x3e'),_0x3500f2[_0xedc7('0x14')],_0x1c3a64);_0x67183e(_0xd5c1eb[_0xedc7('0x15')](0x1f4,_0x3500f2[_0xedc7('0x14')]));});});});};exports[_0xedc7('0x40')]=function(_0x5cea67){var _0x15edcd=this;return new Promise(function(_0x265380,_0x47e237){db[_0xedc7('0x22')][_0xedc7('0x23')]()[_0xedc7('0xf')](function(_0x4638c5){return db[_0xedc7('0x17')]['findAll']({'raw':_0x5cea67['options']?_0x5cea67['options'][_0xedc7('0x18')]===undefined?!![]:![]:!![],'where':_0x5cea67[_0xedc7('0x8')]?_0x5cea67[_0xedc7('0x8')][_0xedc7('0x9')]||null:null,'attributes':_0x5cea67['options']?_0x5cea67[_0xedc7('0x8')][_0xedc7('0xa')]||null:null,'limit':_0x5cea67[_0xedc7('0x8')]?_0x5cea67[_0xedc7('0x8')]['limit']||null:null,'include':_0x5cea67[_0xedc7('0x8')]?_0x5cea67[_0xedc7('0x8')][_0xedc7('0xd')]?_['map'](_0x5cea67[_0xedc7('0x8')]['include'],function(_0x126541){return{'model':db[_0x126541[_0xedc7('0xe')]],'as':_0x126541['as'],'attributes':_0x126541['as']==='Contact'?_['keys'](_0x4638c5):_0x126541[_0xedc7('0xa')],'include':_0x126541['include']?_[_0xedc7('0xc')](_0x126541[_0xedc7('0xd')],function(_0x530239){return{'model':db[_0x530239[_0xedc7('0xe')]],'as':_0x530239['as'],'attributes':_0x530239[_0xedc7('0xa')],'include':_0x530239[_0xedc7('0xd')]?_[_0xedc7('0xc')](_0x530239[_0xedc7('0xd')],function(_0x114150){return{'model':db[_0x114150[_0xedc7('0xe')]],'as':_0x114150['as'],'attributes':_0x114150[_0xedc7('0xa')]};}):[]};}):[]};}):[]:[]})[_0xedc7('0xf')](function(_0x2f75fc){logger[_0xedc7('0x10')](_0xedc7('0x6'),_0x5cea67);logger[_0xedc7('0x11')](_0xedc7('0x6'),_0x5cea67,JSON['stringify'](_0x2f75fc));_0x265380(_0x2f75fc);})[_0xedc7('0x13')](function(_0xf27ec9){logger[_0xedc7('0x15')](_0xedc7('0x6'),_0xf27ec9[_0xedc7('0x14')],_0x5cea67);_0x47e237(_0x15edcd[_0xedc7('0x15')](0x1f4,_0xf27ec9[_0xedc7('0x14')]));});});});};exports[_0xedc7('0x41')]=function(_0x200c28){var _0x39f2fc=this;return new Promise(function(_0x10cc70,_0x27c9ca){return db[_0xedc7('0x22')][_0xedc7('0x42')]({'raw':!![],'where':{'phone':_0x200c28[_0xedc7('0x8')][_0xedc7('0x9')]['phone']},'attributes':['id',_0xedc7('0x43')],'order':[['id',_0xedc7('0x44')]]})[_0xedc7('0xf')](function(_0x3cb2f9){logger[_0xedc7('0x10')](_0xedc7('0x45'),_0x200c28);logger[_0xedc7('0x11')]('getContactByPhone',_0x200c28,JSON[_0xedc7('0x12')](_0x3cb2f9));_0x10cc70(_0x3cb2f9);})[_0xedc7('0x13')](function(_0x5b60b0){logger[_0xedc7('0x15')](_0xedc7('0x45'),_0x5b60b0[_0xedc7('0x14')],_0x200c28);_0x27c9ca(_0x39f2fc[_0xedc7('0x15')](0x1f4,_0x5b60b0[_0xedc7('0x14')]));});});};exports['ResetActiveCalls']=function(_0x4982cd){var _0x588747=this;return new Promise(function(_0x417290,_0x2e590f){return db[_0xedc7('0x24')]['transaction'](function(_0x1de27e){var _0x167117=_0x4982cd[_0xedc7('0x8')]&&_0x4982cd['options'][_0xedc7('0x9')]?_0x4982cd[_0xedc7('0x8')][_0xedc7('0x9')]:{};return db[_0xedc7('0x17')][_0xedc7('0x2f')](_0x4982cd['body'],{'where':_0x167117,'transaction':_0x1de27e})[_0xedc7('0xf')](function(_0x1cdfb3){logger[_0xedc7('0x10')](_0xedc7('0x46'),_0x4982cd);logger['debug']('ResetActiveCalls',_0x4982cd,JSON['stringify'](_0x1cdfb3));_0x417290(_0x1cdfb3);})[_0xedc7('0x13')](function(_0x33c348){logger['error'](_0xedc7('0x46'),_0x33c348[_0xedc7('0x14')],_0x4982cd);_0x2e590f(_0x588747[_0xedc7('0x15')](0x1f4,_0x33c348[_0xedc7('0x14')]));});});});};exports[_0xedc7('0x47')]=function(_0x5944a3){var _0x5b9e13=this;var _0x361519=_0x5944a3[_0xedc7('0x1d')][_0xedc7('0x9')][_0xedc7('0x48')];var _0x48b60f=_0x5944a3[_0xedc7('0x1d')]['where']['interval'];var _0x152ac7=_0x5944a3[_0xedc7('0x1d')]['where'][_0xedc7('0x49')];return new Promise(function(_0x5de265,_0x47ab32){return db[_0xedc7('0x17')]['findAll']({'where':{'voiceQueueId':{'$in':_0x361519},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xedc7('0x24')][_0xedc7('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x48b60f+_0xedc7('0x4a')),'$gt':db[_0xedc7('0x24')]['literal'](_0xedc7('0x4b'))}},'UserId':{'$in':_0x152ac7}},'include':[{'model':db[_0xedc7('0x22')],'as':_0xedc7('0x27')},{'model':db[_0xedc7('0x29')],'as':_0xedc7('0x4c'),'attributes':['id',_0xedc7('0x4d'),_0xedc7('0x2a')]},{'model':db[_0xedc7('0x4e')],'as':_0xedc7('0x4f')}]})[_0xedc7('0xf')](function(_0x553c33){if(_0x553c33[_0xedc7('0x2b')]>0x0){return db['sequelize'][_0xedc7('0x25')](function(_0x57878d){return db[_0xedc7('0x17')]['update']({'recallmeNotifiedDate':db[_0xedc7('0x24')]['literal'](_0xedc7('0x4b'))},{'where':{'id':{'$in':_[_0xedc7('0xc')](_0x553c33,'id')}},'transaction':_0x57878d})[_0xedc7('0xf')](function(){_0x5de265(_0x553c33);})['catch'](function(_0x16f302){logger[_0xedc7('0x15')](_0xedc7('0x47'),_0x16f302[_0xedc7('0x14')],_0x5944a3);_0x47ab32(_0x5b9e13['error'](0x1f4,_0x16f302['message']));});})[_0xedc7('0x13')](function(_0x477fcd){logger[_0xedc7('0x15')](_0xedc7('0x47'),_0x477fcd[_0xedc7('0x14')],_0x5944a3);_0x47ab32(_0x5b9e13['error'](0x1f4,_0x477fcd[_0xedc7('0x14')]));});}else{_0x5de265(_0x553c33);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f78bb33..8226c4f 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 _0x4924=['get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x414916,_0x492063){var _0x328139=function(_0x69bd8c){while(--_0x69bd8c){_0x414916['push'](_0x414916['shift']());}};_0x328139(++_0x492063);}(_0x4924,0x1f1));var _0x4492=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x4924[_0x29b609];return _0x54c952;};'use strict';var express=require('express');var router=express[_0x4492('0x0')]();var auth=require(_0x4492('0x1'));var controller=require(_0x4492('0x2'));router[_0x4492('0x3')]('/',auth[_0x4492('0x4')](),controller[_0x4492('0x5')]);router[_0x4492('0x3')](_0x4492('0x6'),auth['isAuthenticated'](),controller[_0x4492('0x7')]);router['get'](_0x4492('0x8'),auth[_0x4492('0x4')](),controller[_0x4492('0x9')]);router[_0x4492('0x3')](_0x4492('0xa'),auth[_0x4492('0x4')](),controller[_0x4492('0xb')]);router['get'](_0x4492('0xc'),auth[_0x4492('0x4')](),controller[_0x4492('0xd')]);router['get']('/:id/previewrecall',auth[_0x4492('0x4')](),controller[_0x4492('0xe')]);router[_0x4492('0xf')]('/',auth[_0x4492('0x4')](),controller[_0x4492('0x10')]);router[_0x4492('0xf')](_0x4492('0x11'),auth[_0x4492('0x4')](),controller[_0x4492('0x12')]);router[_0x4492('0xf')](_0x4492('0x13'),auth[_0x4492('0x4')](),controller[_0x4492('0x14')]);router['put'](_0x4492('0xc'),auth['isAuthenticated'](),controller[_0x4492('0x15')]);router[_0x4492('0x16')](_0x4492('0xc'),auth[_0x4492('0x4')](),controller[_0x4492('0x17')]);module[_0x4492('0x18')]=router; \ No newline at end of file +var _0xefcb=['getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','create','post','/preview','getPreview','getTimezone','put','/:id','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe'];(function(_0x1c1b74,_0xbf81f7){var _0x22a2b0=function(_0x5e3d2e){while(--_0x5e3d2e){_0x1c1b74['push'](_0x1c1b74['shift']());}};_0x22a2b0(++_0xbf81f7);}(_0xefcb,0x131));var _0xbefc=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xefcb[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0xbefc('0x0'));var router=express[_0xbefc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbefc('0x2'));router[_0xbefc('0x3')]('/',auth[_0xbefc('0x4')](),controller[_0xbefc('0x5')]);router[_0xbefc('0x3')](_0xbefc('0x6'),auth[_0xbefc('0x4')](),controller['describe']);router[_0xbefc('0x3')]('/opencontacts',auth[_0xbefc('0x4')](),controller[_0xbefc('0x7')]);router[_0xbefc('0x3')](_0xbefc('0x8'),auth[_0xbefc('0x4')](),controller[_0xbefc('0x9')]);router[_0xbefc('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xbefc('0xa')]);router[_0xbefc('0x3')](_0xbefc('0xb'),auth[_0xbefc('0x4')](),controller[_0xbefc('0xc')]);router['post']('/',auth[_0xbefc('0x4')](),controller[_0xbefc('0xd')]);router[_0xbefc('0xe')](_0xbefc('0xf'),auth[_0xbefc('0x4')](),controller[_0xbefc('0x10')]);router[_0xbefc('0xe')]('/timezone',auth[_0xbefc('0x4')](),controller[_0xbefc('0x11')]);router[_0xbefc('0x12')](_0xbefc('0x13'),auth['isAuthenticated'](),controller[_0xbefc('0x14')]);router[_0xbefc('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbefc('0x16')]);module[_0xbefc('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 334ae13..baaa28e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4efd=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER'];(function(_0xd97b73,_0xce94b1){var _0xefe357=function(_0x48bc4b){while(--_0x48bc4b){_0xd97b73['push'](_0xd97b73['shift']());}};_0xefe357(++_0xce94b1);}(_0x4efd,0x1ca));var _0xd4ef=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x4efd[_0x2bddf9];return _0x3f3ae9;};'use strict';var moment=require(_0xd4ef('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xd4ef('0x1')]},'phone':{'type':Sequelize[_0xd4ef('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd4ef('0x3')](_0xd4ef('0x4'))},'countbusyretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9ad=['STRING','DATE','moment','sequelize','exports','INTEGER'];(function(_0x4cc263,_0x38e47e){var _0x4acd76=function(_0x45e537){while(--_0x45e537){_0x4cc263['push'](_0x4cc263['shift']());}};_0x4acd76(++_0x38e47e);}(_0xa9ad,0x8c));var _0xda9a=function(_0x7d34a5,_0x56c5a8){_0x7d34a5=_0x7d34a5-0x0;var _0x7854d6=_0xa9ad[_0x7d34a5];return _0x7854d6;};'use strict';var moment=require(_0xda9a('0x0'));var Sequelize=require(_0xda9a('0x1'));module[_0xda9a('0x2')]={'CmHopperId':{'type':Sequelize[_0xda9a('0x3')]},'phone':{'type':Sequelize[_0xda9a('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xda9a('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda9a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 8f51b26..a3cab27 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb888=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','CmHopperAdditionalPhones','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmHopperAdditionalPhone','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2c9f33,_0x5a90df){var _0x20bf15=function(_0x12ecb2){while(--_0x12ecb2){_0x2c9f33['push'](_0x2c9f33['shift']());}};_0x20bf15(++_0x5a90df);}(_0xb888,0xe7));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8b88('0x0'));var rimraf=require(_0x8b88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b88('0x2'));var rp=require(_0x8b88('0x3'));var moment=require(_0x8b88('0x4'));var BPromise=require(_0x8b88('0x5'));var Mustache=require(_0x8b88('0x6'));var util=require(_0x8b88('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8b88('0x8'));var ejs=require(_0x8b88('0x9'));var fs=require('fs');var fs_extra=require(_0x8b88('0xa'));var _=require(_0x8b88('0xb'));var squel=require('squel');var crypto=require(_0x8b88('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b88('0xd'));var toCsv=require(_0x8b88('0x8'));var querystring=require(_0x8b88('0xe'));var Papa=require(_0x8b88('0xf'));var Redis=require(_0x8b88('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b88('0x11'));var hardwareService=require(_0x8b88('0x12'));var logger=require(_0x8b88('0x13'))(_0x8b88('0x14'));var utils=require(_0x8b88('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b88('0x16'));var db=require(_0x8b88('0x17'))['db'];function respondWithStatusCode(_0x3858eb,_0x2119d6){_0x2119d6=_0x2119d6||0xcc;return function(_0x543aea){if(_0x543aea){return _0x3858eb[_0x8b88('0x18')](_0x2119d6);}return _0x3858eb[_0x8b88('0x19')](_0x2119d6)[_0x8b88('0x1a')]();};}function respondWithResult(_0x1f25d6,_0x427934){_0x427934=_0x427934||0xc8;return function(_0x235080){if(_0x235080){return _0x1f25d6[_0x8b88('0x19')](_0x427934)[_0x8b88('0x1b')](_0x235080);}};}function respondWithFilteredResult(_0x1ada87,_0x3743eb){return function(_0xe4d4a5){if(_0xe4d4a5){var _0x1ca958=typeof _0x3743eb[_0x8b88('0x1c')]==='undefined'&&typeof _0x3743eb['limit']==='undefined';var _0x39ba0a=_0xe4d4a5[_0x8b88('0x1d')];var _0x385b00=_0x1ca958?0x0:_0x3743eb['offset'];var _0xdac038=_0x1ca958?_0xe4d4a5[_0x8b88('0x1d')]:_0x3743eb['offset']+_0x3743eb[_0x8b88('0x1e')];var _0x15e72b;if(_0xdac038>=_0x39ba0a){_0xdac038=_0x39ba0a;_0x15e72b=0xc8;}else{_0x15e72b=0xce;}_0x1ada87[_0x8b88('0x19')](_0x15e72b);return _0x1ada87[_0x8b88('0x1f')](_0x8b88('0x20'),_0x385b00+'-'+_0xdac038+'/'+_0x39ba0a)[_0x8b88('0x1b')](_0xe4d4a5);}return null;};}function patchUpdates(_0x561dfc){return function(_0x34025f){try{jsonpatch[_0x8b88('0x21')](_0x34025f,_0x561dfc,!![]);}catch(_0x19f2e9){return BPromise['reject'](_0x19f2e9);}return _0x34025f[_0x8b88('0x22')]();};}function saveUpdates(_0x38dcec,_0x5f0070){return function(_0x8c1d0f){if(_0x8c1d0f){return _0x8c1d0f[_0x8b88('0x23')](_0x38dcec)[_0x8b88('0x24')](function(_0x5ce118){return _0x5ce118;});}return null;};}function removeEntity(_0x163b5c,_0x1ca889){return function(_0xe08adb){if(_0xe08adb){return _0xe08adb[_0x8b88('0x25')]()['then'](function(){var _0x512078=_0xe08adb['get']({'plain':!![]});var _0x188410=_0x8b88('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x188410,'resourceId':_0x512078['id']}})[_0x8b88('0x24')](function(){return _0xe08adb;});})[_0x8b88('0x24')](function(){_0x163b5c[_0x8b88('0x19')](0xcc)[_0x8b88('0x1a')]();});}};}function handleEntityNotFound(_0x50f30b,_0x47ead0){return function(_0x2f9f86){if(!_0x2f9f86){_0x50f30b[_0x8b88('0x18')](0x194);}return _0x2f9f86;};}function handleError(_0x18c05a,_0x4a2a1a){_0x4a2a1a=_0x4a2a1a||0x1f4;return function(_0x1386ab){logger[_0x8b88('0x27')](_0x1386ab[_0x8b88('0x28')]);if(_0x1386ab[_0x8b88('0x29')]){delete _0x1386ab['name'];}_0x18c05a[_0x8b88('0x19')](_0x4a2a1a)[_0x8b88('0x2a')](_0x1386ab);};}exports[_0x8b88('0x2b')]=function(_0x3ffab3,_0x15d807){var _0x30ea17={},_0x54e3ab={},_0xe55701={'count':0x0,'rows':[]};var _0x40de61=_[_0x8b88('0x2c')](db['CmHopperAdditionalPhone'][_0x8b88('0x2d')],function(_0xd1c3db){return{'name':_0xd1c3db[_0x8b88('0x2e')],'type':_0xd1c3db['type'][_0x8b88('0x2f')]};});_0x54e3ab[_0x8b88('0x30')]=_[_0x8b88('0x2c')](_0x40de61,_0x8b88('0x29'));_0x54e3ab[_0x8b88('0x31')]=_[_0x8b88('0x32')](_0x3ffab3[_0x8b88('0x31')]);_0x54e3ab[_0x8b88('0x33')]=_['intersection'](_0x54e3ab[_0x8b88('0x30')],_0x54e3ab[_0x8b88('0x31')]);_0x30ea17[_0x8b88('0x34')]=_[_0x8b88('0x35')](_0x54e3ab[_0x8b88('0x30')],qs[_0x8b88('0x36')](_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x36')]));_0x30ea17['attributes']=_0x30ea17[_0x8b88('0x34')][_0x8b88('0x37')]?_0x30ea17['attributes']:_0x54e3ab[_0x8b88('0x30')];if(!_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x38')]('nolimit')){_0x30ea17[_0x8b88('0x1e')]=qs[_0x8b88('0x1e')](_0x3ffab3['query']['limit']);_0x30ea17[_0x8b88('0x1c')]=qs[_0x8b88('0x1c')](_0x3ffab3['query'][_0x8b88('0x1c')]);}_0x30ea17[_0x8b88('0x39')]=qs[_0x8b88('0x3a')](_0x3ffab3[_0x8b88('0x31')]['sort']);_0x30ea17[_0x8b88('0x3b')]=qs[_0x8b88('0x33')](_[_0x8b88('0x3c')](_0x3ffab3[_0x8b88('0x31')],_0x54e3ab[_0x8b88('0x33')]),_0x40de61);if(_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x3d')]){_0x30ea17[_0x8b88('0x3b')]=_[_0x8b88('0x3e')](_0x30ea17[_0x8b88('0x3b')],{'$or':_[_0x8b88('0x2c')](_0x40de61,function(_0x21b029){if(_0x21b029['type']!==_0x8b88('0x3f')){var _0x3a858f={};_0x3a858f[_0x21b029['name']]={'$like':'%'+_0x3ffab3[_0x8b88('0x31')]['filter']+'%'};return _0x3a858f;}})});}_0x30ea17=_['merge']({},_0x30ea17,_0x3ffab3[_0x8b88('0x40')]);var _0x4b2ff9={'where':_0x30ea17['where']};return db['CmHopperAdditionalPhone'][_0x8b88('0x1d')](_0x4b2ff9)[_0x8b88('0x24')](function(_0x52c845){_0xe55701['count']=_0x52c845;if(_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x41')]){_0x30ea17[_0x8b88('0x42')]=[{'all':!![]}];}return db[_0x8b88('0x43')][_0x8b88('0x44')](_0x30ea17);})[_0x8b88('0x24')](function(_0x338929){_0xe55701[_0x8b88('0x45')]=_0x338929;return _0xe55701;})['then'](respondWithFilteredResult(_0x15d807,_0x30ea17))['catch'](handleError(_0x15d807,null));};exports[_0x8b88('0x46')]=function(_0x26d839,_0x5e5145){var _0x3e4a5a={'raw':!![],'where':{'id':_0x26d839[_0x8b88('0x47')]['id']}},_0x330c51={};_0x330c51['model']=_[_0x8b88('0x32')](db[_0x8b88('0x43')][_0x8b88('0x2d')]);_0x330c51[_0x8b88('0x31')]=_['keys'](_0x26d839[_0x8b88('0x31')]);_0x330c51[_0x8b88('0x33')]=_[_0x8b88('0x35')](_0x330c51[_0x8b88('0x30')],_0x330c51[_0x8b88('0x31')]);_0x3e4a5a[_0x8b88('0x34')]=_[_0x8b88('0x35')](_0x330c51[_0x8b88('0x30')],qs[_0x8b88('0x36')](_0x26d839[_0x8b88('0x31')][_0x8b88('0x36')]));_0x3e4a5a[_0x8b88('0x34')]=_0x3e4a5a[_0x8b88('0x34')][_0x8b88('0x37')]?_0x3e4a5a[_0x8b88('0x34')]:_0x330c51['model'];if(_0x26d839[_0x8b88('0x31')][_0x8b88('0x41')]){_0x3e4a5a['include']=[{'all':!![]}];}_0x3e4a5a=_[_0x8b88('0x3e')]({},_0x3e4a5a,_0x26d839[_0x8b88('0x40')]);return db[_0x8b88('0x43')][_0x8b88('0x48')](_0x3e4a5a)[_0x8b88('0x24')](handleEntityNotFound(_0x5e5145,null))['then'](respondWithResult(_0x5e5145,null))['catch'](handleError(_0x5e5145,null));};exports[_0x8b88('0x49')]=function(_0x502e2c,_0x4dc80d){return db['CmHopperAdditionalPhone']['create'](_0x502e2c[_0x8b88('0x4a')],{})[_0x8b88('0x24')](function(_0x1e1dce){var _0x4df4b0=_0x502e2c[_0x8b88('0x4b')][_0x8b88('0x4c')]({'plain':!![]});if(!_0x4df4b0)throw new Error(_0x8b88('0x4d'));if(_0x4df4b0[_0x8b88('0x4e')]==='user'){var _0x2fd5eb=_0x1e1dce[_0x8b88('0x4c')]({'plain':!![]});var _0x378171=_0x8b88('0x26');return db['UserProfileSection'][_0x8b88('0x48')]({'where':{'name':_0x378171,'userProfileId':_0x4df4b0[_0x8b88('0x4f')]},'raw':!![]})['then'](function(_0x17581f){if(_0x17581f&&_0x17581f[_0x8b88('0x50')]===0x0){return db[_0x8b88('0x51')][_0x8b88('0x49')]({'name':_0x2fd5eb['name'],'resourceId':_0x2fd5eb['id'],'type':_0x17581f['name'],'sectionId':_0x17581f['id']},{})[_0x8b88('0x24')](function(){return _0x1e1dce;});}else{return _0x1e1dce;}})['catch'](function(_0x3445f4){logger[_0x8b88('0x27')](_0x8b88('0x52'),_0x3445f4);throw _0x3445f4;});}return _0x1e1dce;})[_0x8b88('0x24')](respondWithResult(_0x4dc80d,0xc9))['catch'](handleError(_0x4dc80d,null));};exports[_0x8b88('0x23')]=function(_0x5957a5,_0x729a59){if(_0x5957a5[_0x8b88('0x4a')]['id']){delete _0x5957a5[_0x8b88('0x4a')]['id'];}return db[_0x8b88('0x43')][_0x8b88('0x48')]({'where':{'id':_0x5957a5['params']['id']}})[_0x8b88('0x24')](handleEntityNotFound(_0x729a59,null))[_0x8b88('0x24')](saveUpdates(_0x5957a5['body'],null))['then'](respondWithResult(_0x729a59,null))[_0x8b88('0x53')](handleError(_0x729a59,null));};exports[_0x8b88('0x25')]=function(_0x326abc,_0x5efdd5){return db[_0x8b88('0x43')][_0x8b88('0x48')]({'where':{'id':_0x326abc[_0x8b88('0x47')]['id']}})[_0x8b88('0x24')](handleEntityNotFound(_0x5efdd5,null))[_0x8b88('0x24')](removeEntity(_0x5efdd5,null))[_0x8b88('0x53')](handleError(_0x5efdd5,null));}; \ No newline at end of file +var _0xbf9f=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x279212,_0x57f5e1){var _0x57a315=function(_0x5a49bb){while(--_0x5a49bb){_0x279212['push'](_0x279212['shift']());}};_0x57a315(++_0x57f5e1);}(_0xbf9f,0x153));var _0xfbf9=function(_0x3471ff,_0xf5bf1f){_0x3471ff=_0x3471ff-0x0;var _0x13dc25=_0xbf9f[_0x3471ff];return _0x13dc25;};'use strict';var emlformat=require(_0xfbf9('0x0'));var rimraf=require(_0xfbf9('0x1'));var zipdir=require(_0xfbf9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbf9('0x3'));var moment=require(_0xfbf9('0x4'));var BPromise=require(_0xfbf9('0x5'));var Mustache=require(_0xfbf9('0x6'));var util=require(_0xfbf9('0x7'));var path=require(_0xfbf9('0x8'));var sox=require('sox');var csv=require(_0xfbf9('0x9'));var ejs=require(_0xfbf9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbf9('0xb'));var squel=require(_0xfbf9('0xc'));var crypto=require(_0xfbf9('0xd'));var jsforce=require(_0xfbf9('0xe'));var deskjs=require(_0xfbf9('0xf'));var toCsv=require(_0xfbf9('0x9'));var querystring=require('querystring');var Papa=require(_0xfbf9('0x10'));var Redis=require(_0xfbf9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfbf9('0x12'));var as=require(_0xfbf9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbf9('0x14'))('api');var utils=require(_0xfbf9('0x15'));var config=require(_0xfbf9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbf9('0x17'))['db'];function respondWithStatusCode(_0xd5c963,_0xb31f48){_0xb31f48=_0xb31f48||0xcc;return function(_0x38c43e){if(_0x38c43e){return _0xd5c963['sendStatus'](_0xb31f48);}return _0xd5c963[_0xfbf9('0x18')](_0xb31f48)[_0xfbf9('0x19')]();};}function respondWithResult(_0x10d061,_0x24c699){_0x24c699=_0x24c699||0xc8;return function(_0x51fd4c){if(_0x51fd4c){return _0x10d061['status'](_0x24c699)[_0xfbf9('0x1a')](_0x51fd4c);}};}function respondWithFilteredResult(_0xe88573,_0x510733){return function(_0xc61fb0){if(_0xc61fb0){var _0x4aceb=typeof _0x510733[_0xfbf9('0x1b')]===_0xfbf9('0x1c')&&typeof _0x510733['limit']===_0xfbf9('0x1c');var _0x3358b8=_0xc61fb0[_0xfbf9('0x1d')];var _0x4fa66a=_0x4aceb?0x0:_0x510733[_0xfbf9('0x1b')];var _0x3e9754=_0x4aceb?_0xc61fb0[_0xfbf9('0x1d')]:_0x510733[_0xfbf9('0x1b')]+_0x510733[_0xfbf9('0x1e')];var _0x295649;if(_0x3e9754>=_0x3358b8){_0x3e9754=_0x3358b8;_0x295649=0xc8;}else{_0x295649=0xce;}_0xe88573[_0xfbf9('0x18')](_0x295649);return _0xe88573[_0xfbf9('0x1f')]('Content-Range',_0x4fa66a+'-'+_0x3e9754+'/'+_0x3358b8)[_0xfbf9('0x1a')](_0xc61fb0);}return null;};}function patchUpdates(_0x5e8e30){return function(_0x2cf24f){try{jsonpatch[_0xfbf9('0x20')](_0x2cf24f,_0x5e8e30,!![]);}catch(_0x306906){return BPromise['reject'](_0x306906);}return _0x2cf24f['save']();};}function saveUpdates(_0x56fe63,_0x14729d){return function(_0x2607f4){if(_0x2607f4){return _0x2607f4['update'](_0x56fe63)[_0xfbf9('0x21')](function(_0xe2f397){return _0xe2f397;});}return null;};}function removeEntity(_0x184ddb,_0x1621c7){return function(_0x5b8463){if(_0x5b8463){return _0x5b8463[_0xfbf9('0x22')]()[_0xfbf9('0x21')](function(){var _0x3b891c=_0x5b8463['get']({'plain':!![]});var _0x3270a2='CmHopperAdditionalPhones';return db[_0xfbf9('0x23')]['destroy']({'where':{'type':_0x3270a2,'resourceId':_0x3b891c['id']}})['then'](function(){return _0x5b8463;});})['then'](function(){_0x184ddb[_0xfbf9('0x18')](0xcc)[_0xfbf9('0x19')]();});}};}function handleEntityNotFound(_0x252fe2,_0x48ea73){return function(_0x184942){if(!_0x184942){_0x252fe2[_0xfbf9('0x24')](0x194);}return _0x184942;};}function handleError(_0x1999c1,_0x51f753){_0x51f753=_0x51f753||0x1f4;return function(_0x14b70e){logger[_0xfbf9('0x25')](_0x14b70e[_0xfbf9('0x26')]);if(_0x14b70e[_0xfbf9('0x27')]){delete _0x14b70e[_0xfbf9('0x27')];}_0x1999c1[_0xfbf9('0x18')](_0x51f753)[_0xfbf9('0x28')](_0x14b70e);};}exports[_0xfbf9('0x29')]=function(_0x56bf6f,_0x1aebba){var _0x2fd3bc={},_0x2031f7={},_0x5cb145={'count':0x0,'rows':[]};var _0x296705=_[_0xfbf9('0x2a')](db[_0xfbf9('0x2b')][_0xfbf9('0x2c')],function(_0x5758bb){return{'name':_0x5758bb[_0xfbf9('0x2d')],'type':_0x5758bb[_0xfbf9('0x2e')][_0xfbf9('0x2f')]};});_0x2031f7[_0xfbf9('0x30')]=_[_0xfbf9('0x2a')](_0x296705,_0xfbf9('0x27'));_0x2031f7[_0xfbf9('0x31')]=_['keys'](_0x56bf6f[_0xfbf9('0x31')]);_0x2031f7[_0xfbf9('0x32')]=_[_0xfbf9('0x33')](_0x2031f7[_0xfbf9('0x30')],_0x2031f7[_0xfbf9('0x31')]);_0x2fd3bc[_0xfbf9('0x34')]=_[_0xfbf9('0x33')](_0x2031f7[_0xfbf9('0x30')],qs[_0xfbf9('0x35')](_0x56bf6f[_0xfbf9('0x31')]['fields']));_0x2fd3bc[_0xfbf9('0x34')]=_0x2fd3bc[_0xfbf9('0x34')]['length']?_0x2fd3bc[_0xfbf9('0x34')]:_0x2031f7['model'];if(!_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x36')](_0xfbf9('0x37'))){_0x2fd3bc[_0xfbf9('0x1e')]=qs['limit'](_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x1e')]);_0x2fd3bc['offset']=qs[_0xfbf9('0x1b')](_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x1b')]);}_0x2fd3bc[_0xfbf9('0x38')]=qs[_0xfbf9('0x39')](_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x39')]);_0x2fd3bc[_0xfbf9('0x3a')]=qs[_0xfbf9('0x32')](_['pick'](_0x56bf6f['query'],_0x2031f7['filters']),_0x296705);if(_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x3b')]){_0x2fd3bc[_0xfbf9('0x3a')]=_[_0xfbf9('0x3c')](_0x2fd3bc['where'],{'$or':_[_0xfbf9('0x2a')](_0x296705,function(_0xe9803){if(_0xe9803[_0xfbf9('0x2e')]!==_0xfbf9('0x3d')){var _0x3a5ed2={};_0x3a5ed2[_0xe9803[_0xfbf9('0x27')]]={'$like':'%'+_0x56bf6f['query'][_0xfbf9('0x3b')]+'%'};return _0x3a5ed2;}})});}_0x2fd3bc=_[_0xfbf9('0x3c')]({},_0x2fd3bc,_0x56bf6f[_0xfbf9('0x3e')]);var _0x212a43={'where':_0x2fd3bc[_0xfbf9('0x3a')]};return db[_0xfbf9('0x2b')][_0xfbf9('0x1d')](_0x212a43)[_0xfbf9('0x21')](function(_0x1e2cf9){_0x5cb145['count']=_0x1e2cf9;if(_0x56bf6f[_0xfbf9('0x31')][_0xfbf9('0x3f')]){_0x2fd3bc[_0xfbf9('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xfbf9('0x41')](_0x2fd3bc);})[_0xfbf9('0x21')](function(_0x47f641){_0x5cb145['rows']=_0x47f641;return _0x5cb145;})[_0xfbf9('0x21')](respondWithFilteredResult(_0x1aebba,_0x2fd3bc))[_0xfbf9('0x42')](handleError(_0x1aebba,null));};exports['show']=function(_0x35a46a,_0xa96ca0){var _0x19feed={'raw':!![],'where':{'id':_0x35a46a[_0xfbf9('0x43')]['id']}},_0x41958b={};_0x41958b['model']=_['keys'](db[_0xfbf9('0x2b')][_0xfbf9('0x2c')]);_0x41958b[_0xfbf9('0x31')]=_[_0xfbf9('0x44')](_0x35a46a['query']);_0x41958b[_0xfbf9('0x32')]=_[_0xfbf9('0x33')](_0x41958b['model'],_0x41958b[_0xfbf9('0x31')]);_0x19feed[_0xfbf9('0x34')]=_[_0xfbf9('0x33')](_0x41958b[_0xfbf9('0x30')],qs[_0xfbf9('0x35')](_0x35a46a['query'][_0xfbf9('0x35')]));_0x19feed[_0xfbf9('0x34')]=_0x19feed[_0xfbf9('0x34')][_0xfbf9('0x45')]?_0x19feed[_0xfbf9('0x34')]:_0x41958b['model'];if(_0x35a46a[_0xfbf9('0x31')]['includeAll']){_0x19feed[_0xfbf9('0x40')]=[{'all':!![]}];}_0x19feed=_[_0xfbf9('0x3c')]({},_0x19feed,_0x35a46a['options']);return db[_0xfbf9('0x2b')][_0xfbf9('0x46')](_0x19feed)[_0xfbf9('0x21')](handleEntityNotFound(_0xa96ca0,null))['then'](respondWithResult(_0xa96ca0,null))[_0xfbf9('0x42')](handleError(_0xa96ca0,null));};exports['create']=function(_0x2b6394,_0x4d324d){return db['CmHopperAdditionalPhone'][_0xfbf9('0x47')](_0x2b6394['body'],{})[_0xfbf9('0x21')](function(_0x1727f2){var _0x514120=_0x2b6394['user'][_0xfbf9('0x48')]({'plain':!![]});if(!_0x514120)throw new Error(_0xfbf9('0x49'));if(_0x514120[_0xfbf9('0x4a')]==='user'){var _0x26b8f7=_0x1727f2[_0xfbf9('0x48')]({'plain':!![]});var _0x193d14='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xfbf9('0x46')]({'where':{'name':_0x193d14,'userProfileId':_0x514120['userProfileId']},'raw':!![]})[_0xfbf9('0x21')](function(_0x58a9dd){if(_0x58a9dd&&_0x58a9dd[_0xfbf9('0x4b')]===0x0){return db[_0xfbf9('0x23')][_0xfbf9('0x47')]({'name':_0x26b8f7[_0xfbf9('0x27')],'resourceId':_0x26b8f7['id'],'type':_0x58a9dd['name'],'sectionId':_0x58a9dd['id']},{})['then'](function(){return _0x1727f2;});}else{return _0x1727f2;}})['catch'](function(_0x47236d){logger[_0xfbf9('0x25')](_0xfbf9('0x4c'),_0x47236d);throw _0x47236d;});}return _0x1727f2;})[_0xfbf9('0x21')](respondWithResult(_0x4d324d,0xc9))['catch'](handleError(_0x4d324d,null));};exports['update']=function(_0x459607,_0x6cb976){if(_0x459607[_0xfbf9('0x4d')]['id']){delete _0x459607[_0xfbf9('0x4d')]['id'];}return db[_0xfbf9('0x2b')][_0xfbf9('0x46')]({'where':{'id':_0x459607['params']['id']}})[_0xfbf9('0x21')](handleEntityNotFound(_0x6cb976,null))[_0xfbf9('0x21')](saveUpdates(_0x459607[_0xfbf9('0x4d')],null))[_0xfbf9('0x21')](respondWithResult(_0x6cb976,null))[_0xfbf9('0x42')](handleError(_0x6cb976,null));};exports[_0xfbf9('0x22')]=function(_0x2a1240,_0x20cdfc){return db[_0xfbf9('0x2b')]['find']({'where':{'id':_0x2a1240[_0xfbf9('0x43')]['id']}})[_0xfbf9('0x21')](handleEntityNotFound(_0x20cdfc,null))[_0xfbf9('0x21')](removeEntity(_0x20cdfc,null))['catch'](handleError(_0x20cdfc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7982749..cab6978 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e1b=['cm_hopper_additional_phones','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x14033f,_0x4402f2){var _0x136994=function(_0x3d3c1c){while(--_0x3d3c1c){_0x14033f['push'](_0x14033f['shift']());}};_0x136994(++_0x4402f2);}(_0x7e1b,0x79));var _0xb7e1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x7e1b[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0xb7e1('0x0'));var logger=require('../../config/logger')(_0xb7e1('0x1'));var moment=require(_0xb7e1('0x2'));var BPromise=require(_0xb7e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7e1('0x4'));var rimraf=require(_0xb7e1('0x5'));var config=require(_0xb7e1('0x6'));var attributes=require(_0xb7e1('0x7'));module[_0xb7e1('0x8')]=function(_0x5df795,_0x23963d){return _0x5df795['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0xb7e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util'];(function(_0x5ee08e,_0x19127){var _0x12ce20=function(_0x326d3d){while(--_0x326d3d){_0x5ee08e['push'](_0x5ee08e['shift']());}};_0x12ce20(++_0x19127);}(_0xdaf0,0xb2));var _0x0daf=function(_0xb88b5e,_0xf1e044){_0xb88b5e=_0xb88b5e-0x0;var _0x4f2962=_0xdaf0[_0xb88b5e];return _0x4f2962;};'use strict';var _=require(_0x0daf('0x0'));var util=require(_0x0daf('0x1'));var logger=require(_0x0daf('0x2'))(_0x0daf('0x3'));var moment=require(_0x0daf('0x4'));var BPromise=require(_0x0daf('0x5'));var rp=require(_0x0daf('0x6'));var fs=require('fs');var path=require(_0x0daf('0x7'));var rimraf=require(_0x0daf('0x8'));var config=require(_0x0daf('0x9'));var attributes=require(_0x0daf('0xa'));module[_0x0daf('0xb')]=function(_0x413efc,_0x1f7120){return _0x413efc[_0x0daf('0xc')](_0x0daf('0xd'),attributes,{'tableName':_0x0daf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9440e28..36bb8ca 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f1e=['activateAdditionalPhone','IncrementPreviewCounters','field','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','CmHopperAdditionalPhone','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update'];(function(_0x30381e,_0x2a1f30){var _0x9fb2f3=function(_0x467138){while(--_0x467138){_0x30381e['push'](_0x30381e['shift']());}};_0x9fb2f3(++_0x2a1f30);}(_0x2f1e,0x1d3));var _0xe2f1=function(_0x21a534,_0x1f8347){_0x21a534=_0x21a534-0x0;var _0x3b9e98=_0x2f1e[_0x21a534];return _0x3b9e98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe2f1('0x0'));var BPromise=require('bluebird');var rs=require(_0xe2f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2f1('0x2'))['db'];var utils=require(_0xe2f1('0x3'));var logger=require(_0xe2f1('0x4'))(_0xe2f1('0x5'));var config=require(_0xe2f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe2f1('0x7')][_0xe2f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fd40f,_0x51e0ab,_0x5f5ba4){return new BPromise(function(_0x5e50c0,_0x3ae64a){return client[_0xe2f1('0x9')](_0x4fd40f,_0x5f5ba4)[_0xe2f1('0xa')](function(_0x9b766e){logger['info'](_0xe2f1('0xb'),_0x51e0ab,_0xe2f1('0xc'));logger[_0xe2f1('0xd')](_0xe2f1('0xe'),_0x51e0ab,'request\x20sent',JSON[_0xe2f1('0xf')](_0x9b766e));if(_0x9b766e[_0xe2f1('0x10')]){if(_0x9b766e[_0xe2f1('0x10')][_0xe2f1('0x11')]===0x1f4){logger[_0xe2f1('0x10')](_0xe2f1('0xb'),_0x51e0ab,_0x9b766e[_0xe2f1('0x10')]['message']);return _0x3ae64a(_0x9b766e[_0xe2f1('0x10')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51e0ab,_0x9b766e['error'][_0xe2f1('0x12')]);return _0x5e50c0(_0x9b766e[_0xe2f1('0x10')][_0xe2f1('0x12')]);}else{logger[_0xe2f1('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51e0ab,_0xe2f1('0xc'));_0x5e50c0(_0x9b766e[_0xe2f1('0x14')][_0xe2f1('0x12')]);}})[_0xe2f1('0x15')](function(_0x2e0e98){logger['error'](_0xe2f1('0xb'),_0x51e0ab,_0x2e0e98);_0x3ae64a(_0x2e0e98);});});}exports[_0xe2f1('0x16')]=function(_0x5c1b60){var _0x4a890d=this;return new Promise(function(_0x382061,_0x2e7625){return db[_0xe2f1('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5c1b60[_0xe2f1('0x18')]['ContactId'],'ListId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x19')],'VoiceQueueId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1a')]===undefined?null:_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1a')],'CampaignId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1b')]===undefined?null:_0x5c1b60['body']['CampaignId']}})[_0xe2f1('0xa')](function(_0x15c95b){if(_0x15c95b!=null){return db['CmHopperAdditionalPhone'][_0xe2f1('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x15c95b['id'],'OrderBy':{'$gt':_0x15c95b[_0xe2f1('0x1d')]}},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x576389){var _0x4e3172=0x0;if(_0x576389){if(_0x576389[_0xe2f1('0x1f')]+_0x576389['countcongestionretry']+_0x576389[_0xe2f1('0x20')]+_0x576389[_0xe2f1('0x21')]+_0x576389[_0xe2f1('0x22')]+_0x576389[_0xe2f1('0x23')]+_0x576389[_0xe2f1('0x24')]+_0x576389[_0xe2f1('0x25')]<_0x5c1b60[_0xe2f1('0x26')][_0xe2f1('0x27')])_0x4e3172=0x1;_0x382061({'additional':_0x4e3172});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x15c95b['id']},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x2b3dfc){var _0x6952aa=0x0;if(_0x2b3dfc){if(_0x2b3dfc[_0xe2f1('0x1f')]+_0x2b3dfc[_0xe2f1('0x28')]+_0x2b3dfc[_0xe2f1('0x20')]+_0x2b3dfc[_0xe2f1('0x21')]+_0x2b3dfc[_0xe2f1('0x22')]+_0x2b3dfc[_0xe2f1('0x23')]+_0x2b3dfc[_0xe2f1('0x24')]+_0x2b3dfc[_0xe2f1('0x25')]<_0x5c1b60['entity'][_0xe2f1('0x27')])_0x6952aa=0x1;_0x382061({'additional':_0x6952aa});}else{_0x382061({'additional':0x0});}})['catch'](function(_0x4234cc){logger['error'](_0xe2f1('0x16'),_0x4234cc[_0xe2f1('0x12')]);_0x2e7625(_0x4a890d[_0xe2f1('0x10')](0x1f4,_0x4234cc['message']));});}})['catch'](function(_0xa848d){logger['error'](_0xe2f1('0x16'),_0xa848d[_0xe2f1('0x12')]);_0x2e7625(_0x4a890d[_0xe2f1('0x10')](0x1f4,_0xa848d[_0xe2f1('0x12')]));});}else _0x382061({'additional':0x0});});});};exports[_0xe2f1('0x29')]=function(_0x3562fd){var _0x33c99e=this;return new Promise(function(_0x3d8c2a,_0x2613dd){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x3562fd['body']['ContactId'],'ListId':_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x19')],'VoiceQueueId':_0x3562fd['body'][_0xe2f1('0x1a')]===undefined?null:_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1a')],'CampaignId':_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1b')]===undefined?null:_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1b')]}})[_0xe2f1('0xa')](function(_0x1d696c){if(_0x1d696c!=null){return db[_0xe2f1('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d696c['id'],'OrderBy':{'$gte':_0x1d696c[_0xe2f1('0x1d')]}},'order':[['OrderBy',_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x28787a){if(_0x28787a)return activateAdditionalPhone(_0x1d696c,_0x3562fd['body'],_0x28787a,_0x3562fd['duration'],_0x3562fd[_0xe2f1('0x2b')])[_0xe2f1('0xa')](function(_0x57f1fe){_0x3d8c2a(_0x57f1fe);});else{return db['CmHopperAdditionalPhone'][_0xe2f1('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x1d696c['id']},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x266683){if(_0x266683)return activateAdditionalPhone(_0x1d696c,_0x3562fd[_0xe2f1('0x18')],_0x266683,_0x3562fd[_0xe2f1('0x2c')],_0x3562fd[_0xe2f1('0x2b')])['then'](function(_0x11c173){_0x3d8c2a(_0x11c173);});else{_0x3d8c2a({'id':_0x1d696c['id'],'phone':''});}})[_0xe2f1('0x15')](function(_0x330bb2){logger[_0xe2f1('0x10')](_0xe2f1('0x16'),_0x330bb2['message']);_0x2613dd(_0x33c99e['error'](0x1f4,_0x330bb2['message']));});}})['catch'](function(_0x344dbb){logger['error']('VerifyAdditionalPhones',_0x344dbb[_0xe2f1('0x12')]);_0x2613dd(_0x33c99e[_0xe2f1('0x10')](0x1f4,_0x344dbb[_0xe2f1('0x12')]));});}else _0x3d8c2a(0x1);});});};function activateAdditionalPhone(_0x33c3d2,_0x8037f3,_0x4b759b,_0x3fa9ad,_0x5ad2d7){return new Promise(function(_0x1a92ca,_0x3f720f){var _0x23efa1;if(_[_0xe2f1('0x2d')](_0x4b759b[_0xe2f1('0x2e')])){_0x4b759b[_0xe2f1('0x2e')]=moment();}if(moment()>moment(_0x4b759b[_0xe2f1('0x2e')])){_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}else{if(_0x4b759b['OrderBy']==0x0){_0x23efa1=moment(_0x4b759b['scheduledat']);}else{_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}}if(_[_0xe2f1('0x2d')](_0x23efa1)){_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}var _0x435636={'phone':_0x33c3d2[_0xe2f1('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x33c3d2[_0xe2f1('0x1d')])?0x0:_0x33c3d2['OrderBy'],'scheduledat':moment()[_0xe2f1('0x2f')](_0x3fa9ad||0x1,_0xe2f1('0x30')),'countbusyretry':_0x8037f3[_0xe2f1('0x1f')],'countcongestionretry':_0x8037f3[_0xe2f1('0x28')],'countnoanswerretry':_0x8037f3['countnoanswerretry'],'countnosuchnumberretry':_0x8037f3[_0xe2f1('0x21')],'countdropretry':_0x8037f3[_0xe2f1('0x22')],'countabandonedretry':_0x8037f3[_0xe2f1('0x23')],'countmachineretry':_0x8037f3[_0xe2f1('0x24')],'countagentrejectretry':_0x8037f3['countagentrejectretry'],'createdAt':_0x8037f3[_0xe2f1('0x32')],'updatedAt':_0x8037f3['updatedAt']};var _0x4769c5={'CmHopperId':_0x33c3d2['id'],'phone':_0x4b759b[_0xe2f1('0x31')],'active':0x0,'OrderBy':_[_0xe2f1('0x2d')](_0x4b759b[_0xe2f1('0x1d')])?0x0:_0x4b759b[_0xe2f1('0x1d')],'scheduledat':_0x23efa1,'countbusyretry':_0x4b759b[_0xe2f1('0x1f')],'countcongestionretry':_0x4b759b[_0xe2f1('0x28')],'countnoanswerretry':_0x4b759b[_0xe2f1('0x20')],'countnosuchnumberretry':_0x4b759b[_0xe2f1('0x21')],'countdropretry':_0x4b759b['countdropretry'],'countabandonedretry':_0x4b759b[_0xe2f1('0x23')],'countmachineretry':_0x4b759b['countmachineretry'],'countagentrejectretry':_0x4b759b[_0xe2f1('0x25')],'createdAt':_0x4b759b['createdAt'],'updatedAt':_0x4b759b[_0xe2f1('0x33')]};return db[_0xe2f1('0x34')][_0xe2f1('0x35')](function(_0x355e1c){return db[_0xe2f1('0x2a')][_0xe2f1('0x36')](_0x435636,{'where':{'id':_0x4b759b['id']}},{'transaction':_0x355e1c})[_0xe2f1('0xa')](function(){return db[_0xe2f1('0x17')][_0xe2f1('0x36')](_0x4769c5,{'where':{'id':_0x33c3d2['id']}},{'transaction':_0x355e1c});});})['then'](function(_0x3ce985){_0x1a92ca({'id':_0x33c3d2['id'],'phone':_0x4b759b['phone']});})['catch'](function(_0x4063b3){logger[_0xe2f1('0x10')](_0xe2f1('0x37'),_0x4063b3['message']);_0x3f720f({'error':_0x4063b3['message']});});});}exports[_0xe2f1('0x38')]=function(_0x504040){var _0x106327=this;return new Promise(function(_0x2ce8f5,_0x2c8c80){return db[_0xe2f1('0x17')][_0xe2f1('0x36')](_0x504040[_0xe2f1('0x18')][_0xe2f1('0x39')],{'where':{'id':_0x504040[_0xe2f1('0x18')]['id']}})[_0xe2f1('0xa')](function(_0xaeefd2){_0x2ce8f5(_0xaeefd2);})[_0xe2f1('0x15')](function(_0x3a2ebb){logger[_0xe2f1('0x10')](_0xe2f1('0x38'),_0x3a2ebb[_0xe2f1('0x12')]);_0x2c8c80(_0x106327[_0xe2f1('0x10')](0x1f4,_0x3a2ebb['message']));});});}; \ No newline at end of file +var _0x232f=['then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countbusyretry','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','updatedAt','phone','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x232f,0xa0));var _0xf232=function(_0xa3fa3,_0x328285){_0xa3fa3=_0xa3fa3-0x0;var _0x488dd4=_0x232f[_0xa3fa3];return _0x488dd4;};'use strict';var _=require(_0xf232('0x0'));var util=require(_0xf232('0x1'));var moment=require(_0xf232('0x2'));var BPromise=require(_0xf232('0x3'));var rs=require(_0xf232('0x4'));var fs=require('fs');var Redis=require(_0xf232('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf232('0x6'));var logger=require(_0xf232('0x7'))(_0xf232('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf232('0x9')][_0xf232('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dacd2,_0x5d86b5,_0x393ef9){return new BPromise(function(_0x493e2f,_0x304afe){return client['request'](_0x3dacd2,_0x393ef9)[_0xf232('0xb')](function(_0x1000f4){logger[_0xf232('0xc')](_0xf232('0xd'),_0x5d86b5,_0xf232('0xe'));logger['debug'](_0xf232('0xf'),_0x5d86b5,'request\x20sent',JSON[_0xf232('0x10')](_0x1000f4));if(_0x1000f4[_0xf232('0x11')]){if(_0x1000f4['error']['code']===0x1f4){logger[_0xf232('0x11')](_0xf232('0xd'),_0x5d86b5,_0x1000f4[_0xf232('0x11')][_0xf232('0x12')]);return _0x304afe(_0x1000f4['error'][_0xf232('0x12')]);}logger['error'](_0xf232('0xd'),_0x5d86b5,_0x1000f4[_0xf232('0x11')][_0xf232('0x12')]);return _0x493e2f(_0x1000f4['error']['message']);}else{logger[_0xf232('0xc')](_0xf232('0xd'),_0x5d86b5,_0xf232('0xe'));_0x493e2f(_0x1000f4['result']['message']);}})[_0xf232('0x13')](function(_0x4463da){logger[_0xf232('0x11')](_0xf232('0xd'),_0x5d86b5,_0x4463da);_0x304afe(_0x4463da);});});}exports[_0xf232('0x14')]=function(_0x2bb899){var _0x415809=this;return new Promise(function(_0x5e0222,_0x2a8b1d){return db[_0xf232('0x15')][_0xf232('0x16')]({'raw':!![],'where':{'ContactId':_0x2bb899['body'][_0xf232('0x17')],'ListId':_0x2bb899[_0xf232('0x18')]['ListId'],'VoiceQueueId':_0x2bb899[_0xf232('0x18')][_0xf232('0x19')]===undefined?null:_0x2bb899[_0xf232('0x18')]['VoiceQueueId'],'CampaignId':_0x2bb899[_0xf232('0x18')][_0xf232('0x1a')]===undefined?null:_0x2bb899[_0xf232('0x18')]['CampaignId']}})[_0xf232('0xb')](function(_0x2ce5b8){if(_0x2ce5b8!=null){return db[_0xf232('0x1b')][_0xf232('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2ce5b8['id'],'OrderBy':{'$gt':_0x2ce5b8[_0xf232('0x1c')]}},'order':[[_0xf232('0x1c'),_0xf232('0x1d')]]})[_0xf232('0xb')](function(_0x2cd480){var _0x48dfb9=0x0;if(_0x2cd480){if(_0x2cd480['countbusyretry']+_0x2cd480[_0xf232('0x1e')]+_0x2cd480[_0xf232('0x1f')]+_0x2cd480[_0xf232('0x20')]+_0x2cd480[_0xf232('0x21')]+_0x2cd480[_0xf232('0x22')]+_0x2cd480[_0xf232('0x23')]+_0x2cd480[_0xf232('0x24')]<_0x2bb899[_0xf232('0x25')]['dialGlobalMaxRetry'])_0x48dfb9=0x1;_0x5e0222({'additional':_0x48dfb9});}else{return db[_0xf232('0x1b')][_0xf232('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2ce5b8['id']},'order':[[_0xf232('0x1c'),_0xf232('0x1d')]]})[_0xf232('0xb')](function(_0x3f80f3){var _0x4fb290=0x0;if(_0x3f80f3){if(_0x3f80f3[_0xf232('0x26')]+_0x3f80f3[_0xf232('0x1e')]+_0x3f80f3[_0xf232('0x1f')]+_0x3f80f3[_0xf232('0x20')]+_0x3f80f3[_0xf232('0x21')]+_0x3f80f3[_0xf232('0x22')]+_0x3f80f3[_0xf232('0x23')]+_0x3f80f3[_0xf232('0x24')]<_0x2bb899[_0xf232('0x25')][_0xf232('0x27')])_0x4fb290=0x1;_0x5e0222({'additional':_0x4fb290});}else{_0x5e0222({'additional':0x0});}})[_0xf232('0x13')](function(_0x4290fd){logger['error']('VerifyAdditionalPhones',_0x4290fd['message']);_0x2a8b1d(_0x415809[_0xf232('0x11')](0x1f4,_0x4290fd[_0xf232('0x12')]));});}})['catch'](function(_0x4f19d7){logger[_0xf232('0x11')]('VerifyAdditionalPhones',_0x4f19d7['message']);_0x2a8b1d(_0x415809['error'](0x1f4,_0x4f19d7[_0xf232('0x12')]));});}else _0x5e0222({'additional':0x0});});});};exports[_0xf232('0x28')]=function(_0x1f0fd2){var _0x2ed84a=this;return new Promise(function(_0x2f3231,_0xc01a9){return db['CmHopper'][_0xf232('0x16')]({'raw':!![],'where':{'ContactId':_0x1f0fd2[_0xf232('0x18')][_0xf232('0x17')],'ListId':_0x1f0fd2[_0xf232('0x18')][_0xf232('0x29')],'VoiceQueueId':_0x1f0fd2[_0xf232('0x18')][_0xf232('0x19')]===undefined?null:_0x1f0fd2[_0xf232('0x18')][_0xf232('0x19')],'CampaignId':_0x1f0fd2[_0xf232('0x18')][_0xf232('0x1a')]===undefined?null:_0x1f0fd2['body'][_0xf232('0x1a')]}})['then'](function(_0x310392){if(_0x310392!=null){return db['CmHopperAdditionalPhone'][_0xf232('0x16')]({'raw':!![],'where':{'CmHopperId':_0x310392['id'],'OrderBy':{'$gte':_0x310392['OrderBy']}},'order':[[_0xf232('0x1c'),'ASC']]})[_0xf232('0xb')](function(_0x24d59e){if(_0x24d59e)return activateAdditionalPhone(_0x310392,_0x1f0fd2[_0xf232('0x18')],_0x24d59e,_0x1f0fd2['duration'],_0x1f0fd2['waitTime'])[_0xf232('0xb')](function(_0x498ed3){_0x2f3231(_0x498ed3);});else{return db[_0xf232('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x310392['id']},'order':[[_0xf232('0x1c'),_0xf232('0x1d')]]})[_0xf232('0xb')](function(_0x1ff9a1){if(_0x1ff9a1)return activateAdditionalPhone(_0x310392,_0x1f0fd2[_0xf232('0x18')],_0x1ff9a1,_0x1f0fd2[_0xf232('0x2a')],_0x1f0fd2[_0xf232('0x2b')])['then'](function(_0x46194b){_0x2f3231(_0x46194b);});else{_0x2f3231({'id':_0x310392['id'],'phone':''});}})[_0xf232('0x13')](function(_0x571942){logger[_0xf232('0x11')](_0xf232('0x14'),_0x571942[_0xf232('0x12')]);_0xc01a9(_0x2ed84a[_0xf232('0x11')](0x1f4,_0x571942[_0xf232('0x12')]));});}})[_0xf232('0x13')](function(_0x1a4496){logger[_0xf232('0x11')](_0xf232('0x14'),_0x1a4496[_0xf232('0x12')]);_0xc01a9(_0x2ed84a[_0xf232('0x11')](0x1f4,_0x1a4496['message']));});}else _0x2f3231(0x1);});});};function activateAdditionalPhone(_0x2d4c54,_0x132cb7,_0x818b59,_0x3170f3,_0x4fdd00){return new Promise(function(_0x3013e9,_0x173b0a){var _0x5d8b97;if(_[_0xf232('0x2c')](_0x818b59['scheduledat'])){_0x818b59['scheduledat']=moment();}if(moment()>moment(_0x818b59[_0xf232('0x2d')])){_0x5d8b97=moment()[_0xf232('0x2e')](_0x4fdd00||0x3,_0xf232('0x2f'));}else{if(_0x818b59['OrderBy']==0x0){_0x5d8b97=moment(_0x818b59['scheduledat']);}else{_0x5d8b97=moment()[_0xf232('0x2e')](_0x4fdd00||0x3,_0xf232('0x2f'));}}if(_[_0xf232('0x2c')](_0x5d8b97)){_0x5d8b97=moment()[_0xf232('0x2e')](_0x4fdd00||0x3,_0xf232('0x2f'));}var _0xfcdff={'phone':_0x2d4c54['phone'],'active':0x0,'OrderBy':_[_0xf232('0x2c')](_0x2d4c54[_0xf232('0x1c')])?0x0:_0x2d4c54[_0xf232('0x1c')],'scheduledat':moment()['add'](_0x3170f3||0x1,_0xf232('0x2f')),'countbusyretry':_0x132cb7['countbusyretry'],'countcongestionretry':_0x132cb7[_0xf232('0x1e')],'countnoanswerretry':_0x132cb7[_0xf232('0x1f')],'countnosuchnumberretry':_0x132cb7[_0xf232('0x20')],'countdropretry':_0x132cb7[_0xf232('0x21')],'countabandonedretry':_0x132cb7[_0xf232('0x22')],'countmachineretry':_0x132cb7[_0xf232('0x23')],'countagentrejectretry':_0x132cb7[_0xf232('0x24')],'createdAt':_0x132cb7['createdAt'],'updatedAt':_0x132cb7[_0xf232('0x30')]};var _0x17fdb8={'CmHopperId':_0x2d4c54['id'],'phone':_0x818b59[_0xf232('0x31')],'active':0x0,'OrderBy':_[_0xf232('0x2c')](_0x818b59[_0xf232('0x1c')])?0x0:_0x818b59['OrderBy'],'scheduledat':_0x5d8b97,'countbusyretry':_0x818b59['countbusyretry'],'countcongestionretry':_0x818b59['countcongestionretry'],'countnoanswerretry':_0x818b59[_0xf232('0x1f')],'countnosuchnumberretry':_0x818b59[_0xf232('0x20')],'countdropretry':_0x818b59['countdropretry'],'countabandonedretry':_0x818b59[_0xf232('0x22')],'countmachineretry':_0x818b59[_0xf232('0x23')],'countagentrejectretry':_0x818b59[_0xf232('0x24')],'createdAt':_0x818b59[_0xf232('0x32')],'updatedAt':_0x818b59[_0xf232('0x30')]};return db[_0xf232('0x33')][_0xf232('0x34')](function(_0x25e02d){return db['CmHopperAdditionalPhone'][_0xf232('0x35')](_0xfcdff,{'where':{'id':_0x818b59['id']}},{'transaction':_0x25e02d})[_0xf232('0xb')](function(){return db[_0xf232('0x15')][_0xf232('0x35')](_0x17fdb8,{'where':{'id':_0x2d4c54['id']}},{'transaction':_0x25e02d});});})[_0xf232('0xb')](function(_0x2b10aa){_0x3013e9({'id':_0x2d4c54['id'],'phone':_0x818b59[_0xf232('0x31')]});})[_0xf232('0x13')](function(_0x2deb9e){logger[_0xf232('0x11')](_0xf232('0x36'),_0x2deb9e[_0xf232('0x12')]);_0x173b0a({'error':_0x2deb9e[_0xf232('0x12')]});});});}exports[_0xf232('0x37')]=function(_0x83ae96){var _0x51091e=this;return new Promise(function(_0x5619eb,_0xe10eb9){return db['CmHopper'][_0xf232('0x35')](_0x83ae96[_0xf232('0x18')][_0xf232('0x38')],{'where':{'id':_0x83ae96[_0xf232('0x18')]['id']}})[_0xf232('0xb')](function(_0x15bd35){_0x5619eb(_0x15bd35);})[_0xf232('0x13')](function(_0x24bbb2){logger[_0xf232('0x11')]('IncrementPreviewCounters',_0x24bbb2[_0xf232('0x12')]);_0xe10eb9(_0x51091e[_0xf232('0x11')](0x1f4,_0x24bbb2[_0xf232('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1943f4d..cf1e9e1 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x644e=['show','post','create','put','update','delete','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x644e,0x97));var _0xe644=function(_0x4ff2a3,_0x164f75){_0x4ff2a3=_0x4ff2a3-0x0;var _0x51a8c0=_0x644e[_0x4ff2a3];return _0x51a8c0;};'use strict';var multer=require('multer');var util=require(_0xe644('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe644('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe644('0x2'));var interaction=require(_0xe644('0x3'));var config=require(_0xe644('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe644('0x5')]('/',auth[_0xe644('0x6')](),controller[_0xe644('0x7')]);router[_0xe644('0x5')](_0xe644('0x8'),auth[_0xe644('0x6')](),controller[_0xe644('0x9')]);router[_0xe644('0xa')]('/',auth['isAuthenticated'](),controller[_0xe644('0xb')]);router[_0xe644('0xc')]('/:id',auth[_0xe644('0x6')](),controller[_0xe644('0xd')]);router[_0xe644('0xe')](_0xe644('0x8'),auth[_0xe644('0x6')](),controller['destroy']);module[_0xe644('0xf')]=router; \ No newline at end of file +var _0x638f=['index','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x30cc02,_0x49f186){var _0x52ca28=function(_0x2ea9a7){while(--_0x2ea9a7){_0x30cc02['push'](_0x30cc02['shift']());}};_0x52ca28(++_0x49f186);}(_0x638f,0xe5));var _0xf638=function(_0x1680a8,_0xdc661e){_0x1680a8=_0x1680a8-0x0;var _0x534303=_0x638f[_0x1680a8];return _0x534303;};'use strict';var multer=require(_0xf638('0x0'));var util=require(_0xf638('0x1'));var path=require(_0xf638('0x2'));var timeout=require(_0xf638('0x3'));var express=require('express');var router=express[_0xf638('0x4')]();var fs_extra=require(_0xf638('0x5'));var auth=require(_0xf638('0x6'));var interaction=require(_0xf638('0x7'));var config=require(_0xf638('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xf638('0x9')]('/',auth[_0xf638('0xa')](),controller[_0xf638('0xb')]);router[_0xf638('0x9')]('/:id',auth[_0xf638('0xa')](),controller['show']);router[_0xf638('0xc')]('/',auth[_0xf638('0xa')](),controller[_0xf638('0xd')]);router[_0xf638('0xe')]('/:id',auth[_0xf638('0xa')](),controller[_0xf638('0xf')]);router[_0xf638('0x10')](_0xf638('0x11'),auth[_0xf638('0xa')](),controller[_0xf638('0x12')]);module[_0xf638('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3336a12..383415d 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 _0x35e2=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x30593d,_0x333ab7){var _0x35c405=function(_0x524d46){while(--_0x524d46){_0x30593d['push'](_0x30593d['shift']());}};_0x35c405(++_0x333ab7);}(_0x35e2,0x1ed));var _0x235e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35e2[_0x422905];return _0x33dc6c;};'use strict';var moment=require(_0x235e('0x0'));var Sequelize=require('sequelize');module[_0x235e('0x1')]={'phone':{'type':Sequelize[_0x235e('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x235e('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')}}; \ No newline at end of file +var _0x63f1=['sequelize','STRING','contactListQueue','INTEGER','moment'];(function(_0x2fab67,_0x510e24){var _0x3b0237=function(_0x418a3d){while(--_0x418a3d){_0x2fab67['push'](_0x2fab67['shift']());}};_0x3b0237(++_0x510e24);}(_0x63f1,0x1da));var _0x163f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x63f1[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x163f('0x0'));var Sequelize=require(_0x163f('0x1'));module['exports']={'phone':{'type':Sequelize[_0x163f('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x163f('0x3')},'ListId':{'type':Sequelize[_0x163f('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x163f('0x4')],'unique':_0x163f('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 971252f..c6ca299 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 _0x6c6f=['apply','reject','save','update','then','sendStatus','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x6c6f,0x10b));var _0xf6c6=function(_0x418134,_0x32bc8b){_0x418134=_0x418134-0x0;var _0x4fb44a=_0x6c6f[_0x418134];return _0x4fb44a;};'use strict';var emlformat=require(_0xf6c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6c6('0x1'));var rp=require(_0xf6c6('0x2'));var moment=require(_0xf6c6('0x3'));var BPromise=require(_0xf6c6('0x4'));var Mustache=require(_0xf6c6('0x5'));var util=require('util');var path=require(_0xf6c6('0x6'));var sox=require(_0xf6c6('0x7'));var csv=require(_0xf6c6('0x8'));var ejs=require(_0xf6c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6c6('0xa'));var squel=require(_0xf6c6('0xb'));var crypto=require(_0xf6c6('0xc'));var jsforce=require(_0xf6c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf6c6('0x8'));var querystring=require(_0xf6c6('0xe'));var Papa=require(_0xf6c6('0xf'));var Redis=require(_0xf6c6('0x10'));var authService=require(_0xf6c6('0x11'));var qs=require(_0xf6c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6c6('0x13'));var logger=require(_0xf6c6('0x14'))('api');var utils=require(_0xf6c6('0x15'));var config=require(_0xf6c6('0x16'));var licenseUtil=require(_0xf6c6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc477,_0x59d81){_0x59d81=_0x59d81||0xcc;return function(_0x4ddc25){if(_0x4ddc25){return _0x4bc477['sendStatus'](_0x59d81);}return _0x4bc477[_0xf6c6('0x18')](_0x59d81)[_0xf6c6('0x19')]();};}function respondWithResult(_0x590d6d,_0x26fc30){_0x26fc30=_0x26fc30||0xc8;return function(_0x36694e){if(_0x36694e){return _0x590d6d[_0xf6c6('0x18')](_0x26fc30)[_0xf6c6('0x1a')](_0x36694e);}};}function respondWithFilteredResult(_0x869fea,_0x271df3){return function(_0x2482f9){if(_0x2482f9){var _0x4b8258=typeof _0x271df3[_0xf6c6('0x1b')]===_0xf6c6('0x1c')&&typeof _0x271df3[_0xf6c6('0x1d')]===_0xf6c6('0x1c');var _0x55429f=_0x2482f9['count'];var _0x2473da=_0x4b8258?0x0:_0x271df3[_0xf6c6('0x1b')];var _0x4a2d3a=_0x4b8258?_0x2482f9[_0xf6c6('0x1e')]:_0x271df3['offset']+_0x271df3[_0xf6c6('0x1d')];var _0x45eefa;if(_0x4a2d3a>=_0x55429f){_0x4a2d3a=_0x55429f;_0x45eefa=0xc8;}else{_0x45eefa=0xce;}_0x869fea[_0xf6c6('0x18')](_0x45eefa);return _0x869fea[_0xf6c6('0x1f')](_0xf6c6('0x20'),_0x2473da+'-'+_0x4a2d3a+'/'+_0x55429f)['json'](_0x2482f9);}return null;};}function patchUpdates(_0x5e36a1){return function(_0x1cd0b8){try{jsonpatch[_0xf6c6('0x21')](_0x1cd0b8,_0x5e36a1,!![]);}catch(_0x2ddf50){return BPromise[_0xf6c6('0x22')](_0x2ddf50);}return _0x1cd0b8[_0xf6c6('0x23')]();};}function saveUpdates(_0x2ecf7c,_0x30fd57){return function(_0x17d84e){if(_0x17d84e){return _0x17d84e[_0xf6c6('0x24')](_0x2ecf7c)[_0xf6c6('0x25')](function(_0x4e0414){return _0x4e0414;});}return null;};}function removeEntity(_0x26c0de,_0x44ba79){return function(_0x3c82a1){if(_0x3c82a1){return _0x3c82a1['destroy']()[_0xf6c6('0x25')](function(){_0x26c0de[_0xf6c6('0x18')](0xcc)[_0xf6c6('0x19')]();});}};}function handleEntityNotFound(_0x2a6d83,_0x522ee8){return function(_0x2b512b){if(!_0x2b512b){_0x2a6d83[_0xf6c6('0x26')](0x194);}return _0x2b512b;};}function handleError(_0x1cd78f,_0x2d94a9){_0x2d94a9=_0x2d94a9||0x1f4;return function(_0x19c980){logger['error'](_0x19c980['stack']);if(_0x19c980[_0xf6c6('0x27')]){delete _0x19c980[_0xf6c6('0x27')];}_0x1cd78f[_0xf6c6('0x18')](_0x2d94a9)[_0xf6c6('0x28')](_0x19c980);};}exports[_0xf6c6('0x29')]=function(_0x27e5fd,_0x458b29){var _0x4df77f={},_0x5cfe69={},_0x822662={'count':0x0,'rows':[]};var _0x5494c0=_[_0xf6c6('0x2a')](db[_0xf6c6('0x2b')]['rawAttributes'],function(_0x2fba3c){return{'name':_0x2fba3c[_0xf6c6('0x2c')],'type':_0x2fba3c[_0xf6c6('0x2d')][_0xf6c6('0x2e')]};});_0x5cfe69[_0xf6c6('0x2f')]=_[_0xf6c6('0x2a')](_0x5494c0,_0xf6c6('0x27'));_0x5cfe69[_0xf6c6('0x30')]=_[_0xf6c6('0x31')](_0x27e5fd[_0xf6c6('0x30')]);_0x5cfe69[_0xf6c6('0x32')]=_[_0xf6c6('0x33')](_0x5cfe69[_0xf6c6('0x2f')],_0x5cfe69[_0xf6c6('0x30')]);_0x4df77f[_0xf6c6('0x34')]=_[_0xf6c6('0x33')](_0x5cfe69['model'],qs[_0xf6c6('0x35')](_0x27e5fd['query'][_0xf6c6('0x35')]));_0x4df77f[_0xf6c6('0x34')]=_0x4df77f[_0xf6c6('0x34')][_0xf6c6('0x36')]?_0x4df77f[_0xf6c6('0x34')]:_0x5cfe69[_0xf6c6('0x2f')];if(!_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x37')]('nolimit')){_0x4df77f[_0xf6c6('0x1d')]=qs[_0xf6c6('0x1d')](_0x27e5fd[_0xf6c6('0x30')]['limit']);_0x4df77f[_0xf6c6('0x1b')]=qs['offset'](_0x27e5fd['query'][_0xf6c6('0x1b')]);}_0x4df77f[_0xf6c6('0x38')]=qs['sort'](_0x27e5fd['query'][_0xf6c6('0x39')]);_0x4df77f[_0xf6c6('0x3a')]=qs['filters'](_[_0xf6c6('0x3b')](_0x27e5fd[_0xf6c6('0x30')],_0x5cfe69[_0xf6c6('0x32')]),_0x5494c0);if(_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x3c')]){_0x4df77f['where']=_[_0xf6c6('0x3d')](_0x4df77f['where'],{'$or':_[_0xf6c6('0x2a')](_0x5494c0,function(_0x4366cd){if(_0x4366cd[_0xf6c6('0x2d')]!==_0xf6c6('0x3e')){var _0x19a092={};_0x19a092[_0x4366cd[_0xf6c6('0x27')]]={'$like':'%'+_0x27e5fd['query'][_0xf6c6('0x3c')]+'%'};return _0x19a092;}})});}_0x4df77f=_['merge']({},_0x4df77f,_0x27e5fd['options']);var _0x249d8b={'where':_0x4df77f[_0xf6c6('0x3a')]};return db[_0xf6c6('0x2b')]['count'](_0x249d8b)[_0xf6c6('0x25')](function(_0x3783ba){_0x822662['count']=_0x3783ba;if(_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x3f')]){_0x4df77f[_0xf6c6('0x40')]=[{'all':!![]}];}return db[_0xf6c6('0x2b')][_0xf6c6('0x41')](_0x4df77f);})[_0xf6c6('0x25')](function(_0x34e283){_0x822662[_0xf6c6('0x42')]=_0x34e283;return _0x822662;})[_0xf6c6('0x25')](respondWithFilteredResult(_0x458b29,_0x4df77f))[_0xf6c6('0x43')](handleError(_0x458b29,null));};exports[_0xf6c6('0x44')]=function(_0x157915,_0x2f61a0){var _0x41d602={'raw':!![],'where':{'id':_0x157915[_0xf6c6('0x45')]['id']}},_0x1c0b6f={};_0x1c0b6f[_0xf6c6('0x2f')]=_[_0xf6c6('0x31')](db['CmHopperBlack']['rawAttributes']);_0x1c0b6f[_0xf6c6('0x30')]=_[_0xf6c6('0x31')](_0x157915[_0xf6c6('0x30')]);_0x1c0b6f[_0xf6c6('0x32')]=_[_0xf6c6('0x33')](_0x1c0b6f[_0xf6c6('0x2f')],_0x1c0b6f[_0xf6c6('0x30')]);_0x41d602[_0xf6c6('0x34')]=_[_0xf6c6('0x33')](_0x1c0b6f[_0xf6c6('0x2f')],qs[_0xf6c6('0x35')](_0x157915[_0xf6c6('0x30')]['fields']));_0x41d602[_0xf6c6('0x34')]=_0x41d602[_0xf6c6('0x34')]['length']?_0x41d602[_0xf6c6('0x34')]:_0x1c0b6f[_0xf6c6('0x2f')];if(_0x157915[_0xf6c6('0x30')][_0xf6c6('0x3f')]){_0x41d602[_0xf6c6('0x40')]=[{'all':!![]}];}_0x41d602=_[_0xf6c6('0x3d')]({},_0x41d602,_0x157915[_0xf6c6('0x46')]);return db['CmHopperBlack'][_0xf6c6('0x47')](_0x41d602)[_0xf6c6('0x25')](handleEntityNotFound(_0x2f61a0,null))[_0xf6c6('0x25')](respondWithResult(_0x2f61a0,null))[_0xf6c6('0x43')](handleError(_0x2f61a0,null));};exports[_0xf6c6('0x24')]=function(_0x5e2e3a,_0x59806a){if(_0x5e2e3a[_0xf6c6('0x48')]['id']){delete _0x5e2e3a[_0xf6c6('0x48')]['id'];}return db[_0xf6c6('0x2b')][_0xf6c6('0x47')]({'where':{'id':_0x5e2e3a['params']['id']}})[_0xf6c6('0x25')](handleEntityNotFound(_0x59806a,null))[_0xf6c6('0x25')](saveUpdates(_0x5e2e3a[_0xf6c6('0x48')],null))[_0xf6c6('0x25')](respondWithResult(_0x59806a,null))[_0xf6c6('0x43')](handleError(_0x59806a,null));};exports[_0xf6c6('0x49')]=function(_0x3415d5,_0x55994e){return db['CmHopperBlack']['find']({'where':{'id':_0x3415d5['params']['id']}})[_0xf6c6('0x25')](handleEntityNotFound(_0x55994e,null))[_0xf6c6('0x25')](removeEntity(_0x55994e,null))[_0xf6c6('0x43')](handleError(_0x55994e,null));};exports[_0xf6c6('0x4a')]=function(_0x3798bf,_0x160ed1){return db['CmHopperBlack'][_0xf6c6('0x4a')]()[_0xf6c6('0x25')](respondWithResult(_0x160ed1,null))[_0xf6c6('0x43')](handleError(_0x160ed1,null));}; \ No newline at end of file +var _0x3e8e=['fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','params','find','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','attributes','intersection'];(function(_0x4ef2e0,_0xce4bc4){var _0x4c1071=function(_0x26129d){while(--_0x26129d){_0x4ef2e0['push'](_0x4ef2e0['shift']());}};_0x4c1071(++_0xce4bc4);}(_0x3e8e,0xe9));var _0xe3e8=function(_0x335ee8,_0x3788eb){_0x335ee8=_0x335ee8-0x0;var _0x1312f5=_0x3e8e[_0x335ee8];return _0x1312f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3e8('0x0'));var zipdir=require(_0xe3e8('0x1'));var jsonpatch=require(_0xe3e8('0x2'));var rp=require('request-promise');var moment=require(_0xe3e8('0x3'));var BPromise=require(_0xe3e8('0x4'));var Mustache=require('mustache');var util=require(_0xe3e8('0x5'));var path=require(_0xe3e8('0x6'));var sox=require('sox');var csv=require(_0xe3e8('0x7'));var ejs=require(_0xe3e8('0x8'));var fs=require('fs');var fs_extra=require(_0xe3e8('0x9'));var _=require(_0xe3e8('0xa'));var squel=require('squel');var crypto=require(_0xe3e8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe3e8('0xc'));var toCsv=require(_0xe3e8('0x7'));var querystring=require(_0xe3e8('0xd'));var Papa=require(_0xe3e8('0xe'));var Redis=require(_0xe3e8('0xf'));var authService=require(_0xe3e8('0x10'));var qs=require(_0xe3e8('0x11'));var as=require(_0xe3e8('0x12'));var hardwareService=require(_0xe3e8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe3e8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe3e8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646762,_0x57457e){_0x57457e=_0x57457e||0xcc;return function(_0x2d633a){if(_0x2d633a){return _0x646762[_0xe3e8('0x16')](_0x57457e);}return _0x646762[_0xe3e8('0x17')](_0x57457e)[_0xe3e8('0x18')]();};}function respondWithResult(_0x54160c,_0x2563f4){_0x2563f4=_0x2563f4||0xc8;return function(_0x543e9c){if(_0x543e9c){return _0x54160c[_0xe3e8('0x17')](_0x2563f4)[_0xe3e8('0x19')](_0x543e9c);}};}function respondWithFilteredResult(_0x583f88,_0x2c7596){return function(_0xa5d254){if(_0xa5d254){var _0x1477f4=typeof _0x2c7596[_0xe3e8('0x1a')]===_0xe3e8('0x1b')&&typeof _0x2c7596[_0xe3e8('0x1c')]===_0xe3e8('0x1b');var _0x19e836=_0xa5d254[_0xe3e8('0x1d')];var _0x2e5ca0=_0x1477f4?0x0:_0x2c7596[_0xe3e8('0x1a')];var _0x15ca28=_0x1477f4?_0xa5d254[_0xe3e8('0x1d')]:_0x2c7596[_0xe3e8('0x1a')]+_0x2c7596[_0xe3e8('0x1c')];var _0x84bbf;if(_0x15ca28>=_0x19e836){_0x15ca28=_0x19e836;_0x84bbf=0xc8;}else{_0x84bbf=0xce;}_0x583f88[_0xe3e8('0x17')](_0x84bbf);return _0x583f88[_0xe3e8('0x1e')](_0xe3e8('0x1f'),_0x2e5ca0+'-'+_0x15ca28+'/'+_0x19e836)[_0xe3e8('0x19')](_0xa5d254);}return null;};}function patchUpdates(_0x195920){return function(_0x194d84){try{jsonpatch[_0xe3e8('0x20')](_0x194d84,_0x195920,!![]);}catch(_0x30f5ae){return BPromise[_0xe3e8('0x21')](_0x30f5ae);}return _0x194d84[_0xe3e8('0x22')]();};}function saveUpdates(_0x597755,_0x1a161e){return function(_0x92463f){if(_0x92463f){return _0x92463f[_0xe3e8('0x23')](_0x597755)[_0xe3e8('0x24')](function(_0x3c1436){return _0x3c1436;});}return null;};}function removeEntity(_0x54eee9,_0x68cc48){return function(_0xbdcf33){if(_0xbdcf33){return _0xbdcf33[_0xe3e8('0x25')]()[_0xe3e8('0x24')](function(){_0x54eee9[_0xe3e8('0x17')](0xcc)[_0xe3e8('0x18')]();});}};}function handleEntityNotFound(_0x84dbc7,_0xef8854){return function(_0x35520e){if(!_0x35520e){_0x84dbc7[_0xe3e8('0x16')](0x194);}return _0x35520e;};}function handleError(_0x398dcf,_0x243fd4){_0x243fd4=_0x243fd4||0x1f4;return function(_0x10fc88){logger[_0xe3e8('0x26')](_0x10fc88[_0xe3e8('0x27')]);if(_0x10fc88[_0xe3e8('0x28')]){delete _0x10fc88[_0xe3e8('0x28')];}_0x398dcf[_0xe3e8('0x17')](_0x243fd4)[_0xe3e8('0x29')](_0x10fc88);};}exports['index']=function(_0x3a325c,_0x2039fc){var _0x29ce93={},_0x50b7ce={},_0x494460={'count':0x0,'rows':[]};var _0x4c1563=_[_0xe3e8('0x2a')](db['CmHopperBlack'][_0xe3e8('0x2b')],function(_0x3624b9){return{'name':_0x3624b9['fieldName'],'type':_0x3624b9[_0xe3e8('0x2c')][_0xe3e8('0x2d')]};});_0x50b7ce[_0xe3e8('0x2e')]=_[_0xe3e8('0x2a')](_0x4c1563,'name');_0x50b7ce['query']=_[_0xe3e8('0x2f')](_0x3a325c[_0xe3e8('0x30')]);_0x50b7ce['filters']=_['intersection'](_0x50b7ce[_0xe3e8('0x2e')],_0x50b7ce[_0xe3e8('0x30')]);_0x29ce93[_0xe3e8('0x31')]=_[_0xe3e8('0x32')](_0x50b7ce[_0xe3e8('0x2e')],qs[_0xe3e8('0x33')](_0x3a325c[_0xe3e8('0x30')][_0xe3e8('0x33')]));_0x29ce93['attributes']=_0x29ce93[_0xe3e8('0x31')]['length']?_0x29ce93[_0xe3e8('0x31')]:_0x50b7ce['model'];if(!_0x3a325c['query'][_0xe3e8('0x34')](_0xe3e8('0x35'))){_0x29ce93['limit']=qs[_0xe3e8('0x1c')](_0x3a325c['query'][_0xe3e8('0x1c')]);_0x29ce93[_0xe3e8('0x1a')]=qs[_0xe3e8('0x1a')](_0x3a325c[_0xe3e8('0x30')][_0xe3e8('0x1a')]);}_0x29ce93['order']=qs[_0xe3e8('0x36')](_0x3a325c[_0xe3e8('0x30')]['sort']);_0x29ce93[_0xe3e8('0x37')]=qs[_0xe3e8('0x38')](_['pick'](_0x3a325c['query'],_0x50b7ce[_0xe3e8('0x38')]),_0x4c1563);if(_0x3a325c[_0xe3e8('0x30')][_0xe3e8('0x39')]){_0x29ce93['where']=_[_0xe3e8('0x3a')](_0x29ce93[_0xe3e8('0x37')],{'$or':_['map'](_0x4c1563,function(_0x4f45f7){if(_0x4f45f7[_0xe3e8('0x2c')]!==_0xe3e8('0x3b')){var _0x2c59c6={};_0x2c59c6[_0x4f45f7[_0xe3e8('0x28')]]={'$like':'%'+_0x3a325c[_0xe3e8('0x30')][_0xe3e8('0x39')]+'%'};return _0x2c59c6;}})});}_0x29ce93=_[_0xe3e8('0x3a')]({},_0x29ce93,_0x3a325c[_0xe3e8('0x3c')]);var _0x11fd90={'where':_0x29ce93['where']};return db[_0xe3e8('0x3d')]['count'](_0x11fd90)[_0xe3e8('0x24')](function(_0x3cb5c2){_0x494460[_0xe3e8('0x1d')]=_0x3cb5c2;if(_0x3a325c[_0xe3e8('0x30')][_0xe3e8('0x3e')]){_0x29ce93[_0xe3e8('0x3f')]=[{'all':!![]}];}return db[_0xe3e8('0x3d')][_0xe3e8('0x40')](_0x29ce93);})['then'](function(_0x273135){_0x494460[_0xe3e8('0x41')]=_0x273135;return _0x494460;})[_0xe3e8('0x24')](respondWithFilteredResult(_0x2039fc,_0x29ce93))[_0xe3e8('0x42')](handleError(_0x2039fc,null));};exports['show']=function(_0x54a8d8,_0x5ebc7b){var _0x5bd464={'raw':!![],'where':{'id':_0x54a8d8[_0xe3e8('0x43')]['id']}},_0x57c20f={};_0x57c20f[_0xe3e8('0x2e')]=_['keys'](db[_0xe3e8('0x3d')][_0xe3e8('0x2b')]);_0x57c20f[_0xe3e8('0x30')]=_[_0xe3e8('0x2f')](_0x54a8d8[_0xe3e8('0x30')]);_0x57c20f[_0xe3e8('0x38')]=_['intersection'](_0x57c20f[_0xe3e8('0x2e')],_0x57c20f[_0xe3e8('0x30')]);_0x5bd464[_0xe3e8('0x31')]=_[_0xe3e8('0x32')](_0x57c20f['model'],qs['fields'](_0x54a8d8[_0xe3e8('0x30')][_0xe3e8('0x33')]));_0x5bd464['attributes']=_0x5bd464[_0xe3e8('0x31')]['length']?_0x5bd464[_0xe3e8('0x31')]:_0x57c20f[_0xe3e8('0x2e')];if(_0x54a8d8[_0xe3e8('0x30')]['includeAll']){_0x5bd464[_0xe3e8('0x3f')]=[{'all':!![]}];}_0x5bd464=_[_0xe3e8('0x3a')]({},_0x5bd464,_0x54a8d8[_0xe3e8('0x3c')]);return db[_0xe3e8('0x3d')][_0xe3e8('0x44')](_0x5bd464)[_0xe3e8('0x24')](handleEntityNotFound(_0x5ebc7b,null))[_0xe3e8('0x24')](respondWithResult(_0x5ebc7b,null))[_0xe3e8('0x42')](handleError(_0x5ebc7b,null));};exports['update']=function(_0x7788d6,_0x286ffb){if(_0x7788d6['body']['id']){delete _0x7788d6[_0xe3e8('0x45')]['id'];}return db[_0xe3e8('0x3d')]['find']({'where':{'id':_0x7788d6[_0xe3e8('0x43')]['id']}})['then'](handleEntityNotFound(_0x286ffb,null))['then'](saveUpdates(_0x7788d6[_0xe3e8('0x45')],null))[_0xe3e8('0x24')](respondWithResult(_0x286ffb,null))[_0xe3e8('0x42')](handleError(_0x286ffb,null));};exports[_0xe3e8('0x25')]=function(_0xe3a2b7,_0x417c18){return db[_0xe3e8('0x3d')][_0xe3e8('0x44')]({'where':{'id':_0xe3a2b7['params']['id']}})['then'](handleEntityNotFound(_0x417c18,null))[_0xe3e8('0x24')](removeEntity(_0x417c18,null))['catch'](handleError(_0x417c18,null));};exports['describe']=function(_0x5cbeec,_0x538c49){return db['CmHopperBlack'][_0xe3e8('0x46')]()[_0xe3e8('0x24')](respondWithResult(_0x538c49,null))[_0xe3e8('0x42')](handleError(_0x538c49,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 434651a..6d12e53 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 _0x515e=['../../config/environment','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x26241d,_0x31709d){var _0x48df2e=function(_0x2cf229){while(--_0x2cf229){_0x26241d['push'](_0x26241d['shift']());}};_0x48df2e(++_0x31709d);}(_0x515e,0x10c));var _0xe515=function(_0x1ebe2f,_0x523227){_0x1ebe2f=_0x1ebe2f-0x0;var _0xdeb06f=_0x515e[_0x1ebe2f];return _0xdeb06f;};'use strict';var _=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var logger=require(_0xe515('0x2'))(_0xe515('0x3'));var moment=require(_0xe515('0x4'));var BPromise=require('bluebird');var rp=require(_0xe515('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe515('0x6'));var config=require(_0xe515('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xe515('0x8')]=function(_0xcf40aa,_0x5529e8){return _0xcf40aa[_0xe515('0x9')]('CmHopperBlack',attributes,{'tableName':_0xe515('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8176=['util','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','lodash'];(function(_0x40a2a6,_0x32e7c4){var _0x57dd52=function(_0xed6c3f){while(--_0xed6c3f){_0x40a2a6['push'](_0x40a2a6['shift']());}};_0x57dd52(++_0x32e7c4);}(_0x8176,0x1d5));var _0x6817=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8176[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x6817('0x0'));var util=require(_0x6817('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6817('0x2'));var BPromise=require(_0x6817('0x3'));var rp=require(_0x6817('0x4'));var fs=require('fs');var path=require(_0x6817('0x5'));var rimraf=require('rimraf');var config=require(_0x6817('0x6'));var attributes=require(_0x6817('0x7'));module[_0x6817('0x8')]=function(_0x3b21b1,_0x22e1f0){return _0x3b21b1['define'](_0x6817('0x9'),attributes,{'tableName':'cm_hopper_black','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 5397633..24ed028 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 _0xa1f8=['include','model','map','then','UpdateCmHopperBlack','CmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit'];(function(_0x22d33b,_0x15491a){var _0x80b3ab=function(_0x4425de){while(--_0x4425de){_0x22d33b['push'](_0x22d33b['shift']());}};_0x80b3ab(++_0x15491a);}(_0xa1f8,0x1eb));var _0x8a1f=function(_0x4acfb0,_0x1c142d){_0x4acfb0=_0x4acfb0-0x0;var _0x3bf37b=_0xa1f8[_0x4acfb0];return _0x3bf37b;};'use strict';var _=require(_0x8a1f('0x0'));var util=require(_0x8a1f('0x1'));var moment=require(_0x8a1f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a1f('0x3'));var db=require(_0x8a1f('0x4'))['db'];var utils=require(_0x8a1f('0x5'));var logger=require(_0x8a1f('0x6'))('rpc');var config=require(_0x8a1f('0x7'));var jayson=require(_0x8a1f('0x8'));var client=jayson[_0x8a1f('0x9')][_0x8a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552750,_0x388acf,_0x337e5d){return new BPromise(function(_0x511532,_0x83f792){return client['request'](_0x552750,_0x337e5d)['then'](function(_0x188c8d){logger[_0x8a1f('0xb')](_0x8a1f('0xc'),_0x388acf,_0x8a1f('0xd'));logger[_0x8a1f('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x388acf,_0x8a1f('0xd'),JSON[_0x8a1f('0xf')](_0x188c8d));if(_0x188c8d[_0x8a1f('0x10')]){if(_0x188c8d['error'][_0x8a1f('0x11')]===0x1f4){logger[_0x8a1f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x388acf,_0x188c8d[_0x8a1f('0x10')]['message']);return _0x83f792(_0x188c8d[_0x8a1f('0x10')][_0x8a1f('0x12')]);}logger[_0x8a1f('0x10')](_0x8a1f('0xc'),_0x388acf,_0x188c8d[_0x8a1f('0x10')][_0x8a1f('0x12')]);return _0x511532(_0x188c8d['error'][_0x8a1f('0x12')]);}else{logger['info'](_0x8a1f('0xc'),_0x388acf,'request\x20sent');_0x511532(_0x188c8d[_0x8a1f('0x13')][_0x8a1f('0x12')]);}})[_0x8a1f('0x14')](function(_0x519c17){logger[_0x8a1f('0x10')](_0x8a1f('0xc'),_0x388acf,_0x519c17);_0x83f792(_0x519c17);});});}exports[_0x8a1f('0x15')]=function(_0x3cc4bb){var _0x4208bb=this;return new Promise(function(_0x3ba2d6,_0x1ff8a2){return db['CmHopperBlack']['findAll']({'raw':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x17')]===undefined?!![]:![]:!![],'where':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb['options'][_0x8a1f('0x18')]||null:null,'attributes':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x19')]||null:null,'limit':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb['options'][_0x8a1f('0x1a')]||null:null,'include':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x1b')]?_['map'](_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x1b')],function(_0x36231b){return{'model':db[_0x36231b[_0x8a1f('0x1c')]],'as':_0x36231b['as'],'attributes':_0x36231b['attributes'],'include':_0x36231b['include']?_[_0x8a1f('0x1d')](_0x36231b['include'],function(_0x4bc3b1){return{'model':db[_0x4bc3b1[_0x8a1f('0x1c')]],'as':_0x4bc3b1['as'],'attributes':_0x4bc3b1[_0x8a1f('0x19')],'include':_0x4bc3b1['include']?_[_0x8a1f('0x1d')](_0x4bc3b1[_0x8a1f('0x1b')],function(_0x195e49){return{'model':db[_0x195e49['model']],'as':_0x195e49['as'],'attributes':_0x195e49[_0x8a1f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8a1f('0x1e')](function(_0x4d97e0){logger[_0x8a1f('0xb')]('GetCmHopperBlack',_0x3cc4bb);logger[_0x8a1f('0xe')](_0x8a1f('0x15'),_0x3cc4bb,JSON['stringify'](_0x4d97e0));_0x3ba2d6(_0x4d97e0);})[_0x8a1f('0x14')](function(_0x11817a){logger[_0x8a1f('0x10')](_0x8a1f('0x15'),_0x11817a[_0x8a1f('0x12')],_0x3cc4bb);_0x1ff8a2(_0x4208bb['error'](0x1f4,_0x11817a[_0x8a1f('0x12')]));});});};exports[_0x8a1f('0x1f')]=function(_0x4acbf4){var _0x3558f1=this;return new Promise(function(_0x57a7f6,_0xaec1a5){return db[_0x8a1f('0x20')][_0x8a1f('0x21')](_0x4acbf4[_0x8a1f('0x22')],{'raw':_0x4acbf4[_0x8a1f('0x16')]?_0x4acbf4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4acbf4[_0x8a1f('0x16')]?_0x4acbf4[_0x8a1f('0x16')][_0x8a1f('0x18')]||null:null,'attributes':_0x4acbf4['options']?_0x4acbf4[_0x8a1f('0x16')]['attributes']||null:null,'limit':_0x4acbf4['options']?_0x4acbf4[_0x8a1f('0x16')]['limit']||null:null})[_0x8a1f('0x1e')](function(_0x104102){logger['info']('UpdateCmHopperBlack',_0x4acbf4);logger[_0x8a1f('0xe')](_0x8a1f('0x1f'),_0x4acbf4,JSON[_0x8a1f('0xf')](_0x104102));_0x57a7f6(_0x104102);})[_0x8a1f('0x14')](function(_0x30d8f6){logger[_0x8a1f('0x10')]('UpdateCmHopperBlack',_0x30d8f6[_0x8a1f('0x12')],_0x4acbf4);_0xaec1a5(_0x3558f1[_0x8a1f('0x10')](0x1f4,_0x30d8f6[_0x8a1f('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x86dd94){var _0x55b642=this;return new Promise(function(_0x37f02b,_0x4eafae){return db[_0x8a1f('0x20')][_0x8a1f('0x23')]({'where':_0x86dd94[_0x8a1f('0x16')]?_0x86dd94['options'][_0x8a1f('0x18')]||null:null})[_0x8a1f('0x1e')](function(_0x17760b){logger[_0x8a1f('0xb')](_0x8a1f('0x24'),_0x86dd94);logger[_0x8a1f('0xe')]('DestroyCmHopperBlack',_0x86dd94,JSON[_0x8a1f('0xf')](_0x17760b));_0x37f02b(_0x17760b);})[_0x8a1f('0x14')](function(_0x2872e7){logger[_0x8a1f('0x10')](_0x8a1f('0x24'),_0x2872e7[_0x8a1f('0x12')],_0x86dd94);_0x4eafae(_0x55b642[_0x8a1f('0x10')](0x1f4,_0x2872e7[_0x8a1f('0x12')]));});});}; \ No newline at end of file +var _0xf34f=['util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xf34f,0xe0));var _0xff34=function(_0x1e7c92,_0x1401ee){_0x1e7c92=_0x1e7c92-0x0;var _0x26651a=_0xf34f[_0x1e7c92];return _0x26651a;};'use strict';var _=require('lodash');var util=require(_0xff34('0x0'));var moment=require(_0xff34('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff34('0x2'));var db=require(_0xff34('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xff34('0x4'))(_0xff34('0x5'));var config=require('../../config/environment');var jayson=require(_0xff34('0x6'));var client=jayson[_0xff34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14dfc7,_0x592cb0,_0x1d6426){return new BPromise(function(_0x2fbf1e,_0x3ea9df){return client['request'](_0x14dfc7,_0x1d6426)[_0xff34('0x8')](function(_0x1cc48b){logger[_0xff34('0x9')](_0xff34('0xa'),_0x592cb0,_0xff34('0xb'));logger[_0xff34('0xc')](_0xff34('0xd'),_0x592cb0,'request\x20sent',JSON[_0xff34('0xe')](_0x1cc48b));if(_0x1cc48b[_0xff34('0xf')]){if(_0x1cc48b[_0xff34('0xf')]['code']===0x1f4){logger[_0xff34('0xf')](_0xff34('0xa'),_0x592cb0,_0x1cc48b['error'][_0xff34('0x10')]);return _0x3ea9df(_0x1cc48b[_0xff34('0xf')][_0xff34('0x10')]);}logger[_0xff34('0xf')](_0xff34('0xa'),_0x592cb0,_0x1cc48b['error'][_0xff34('0x10')]);return _0x2fbf1e(_0x1cc48b[_0xff34('0xf')][_0xff34('0x10')]);}else{logger[_0xff34('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x592cb0,_0xff34('0xb'));_0x2fbf1e(_0x1cc48b['result'][_0xff34('0x10')]);}})[_0xff34('0x11')](function(_0x4a1c5f){logger['error'](_0xff34('0xa'),_0x592cb0,_0x4a1c5f);_0x3ea9df(_0x4a1c5f);});});}exports[_0xff34('0x12')]=function(_0x4cb7f1){var _0x332577=this;return new Promise(function(_0x3f2b97,_0x392937){return db[_0xff34('0x13')]['findAll']({'raw':_0x4cb7f1[_0xff34('0x14')]?_0x4cb7f1[_0xff34('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4cb7f1[_0xff34('0x14')]?_0x4cb7f1['options'][_0xff34('0x15')]||null:null,'attributes':_0x4cb7f1[_0xff34('0x14')]?_0x4cb7f1[_0xff34('0x14')][_0xff34('0x16')]||null:null,'limit':_0x4cb7f1[_0xff34('0x14')]?_0x4cb7f1[_0xff34('0x14')][_0xff34('0x17')]||null:null,'include':_0x4cb7f1[_0xff34('0x14')]?_0x4cb7f1['options'][_0xff34('0x18')]?_[_0xff34('0x19')](_0x4cb7f1[_0xff34('0x14')][_0xff34('0x18')],function(_0x147b30){return{'model':db[_0x147b30[_0xff34('0x1a')]],'as':_0x147b30['as'],'attributes':_0x147b30['attributes'],'include':_0x147b30[_0xff34('0x18')]?_[_0xff34('0x19')](_0x147b30['include'],function(_0x5d45c6){return{'model':db[_0x5d45c6[_0xff34('0x1a')]],'as':_0x5d45c6['as'],'attributes':_0x5d45c6[_0xff34('0x16')],'include':_0x5d45c6[_0xff34('0x18')]?_[_0xff34('0x19')](_0x5d45c6[_0xff34('0x18')],function(_0x1a438b){return{'model':db[_0x1a438b['model']],'as':_0x1a438b['as'],'attributes':_0x1a438b[_0xff34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xff34('0x8')](function(_0x4433dd){logger[_0xff34('0x9')](_0xff34('0x12'),_0x4cb7f1);logger[_0xff34('0xc')](_0xff34('0x12'),_0x4cb7f1,JSON[_0xff34('0xe')](_0x4433dd));_0x3f2b97(_0x4433dd);})[_0xff34('0x11')](function(_0x2f565e){logger['error'](_0xff34('0x12'),_0x2f565e[_0xff34('0x10')],_0x4cb7f1);_0x392937(_0x332577[_0xff34('0xf')](0x1f4,_0x2f565e[_0xff34('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x776dc3){var _0x455bfe=this;return new Promise(function(_0x372db3,_0x152b91){return db[_0xff34('0x13')]['update'](_0x776dc3[_0xff34('0x1b')],{'raw':_0x776dc3[_0xff34('0x14')]?_0x776dc3['options'][_0xff34('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x776dc3[_0xff34('0x14')]?_0x776dc3['options'][_0xff34('0x15')]||null:null,'attributes':_0x776dc3[_0xff34('0x14')]?_0x776dc3[_0xff34('0x14')][_0xff34('0x16')]||null:null,'limit':_0x776dc3[_0xff34('0x14')]?_0x776dc3['options'][_0xff34('0x17')]||null:null})['then'](function(_0x17e405){logger[_0xff34('0x9')](_0xff34('0x1d'),_0x776dc3);logger[_0xff34('0xc')]('UpdateCmHopperBlack',_0x776dc3,JSON[_0xff34('0xe')](_0x17e405));_0x372db3(_0x17e405);})[_0xff34('0x11')](function(_0x3b4d77){logger['error'](_0xff34('0x1d'),_0x3b4d77[_0xff34('0x10')],_0x776dc3);_0x152b91(_0x455bfe[_0xff34('0xf')](0x1f4,_0x3b4d77['message']));});});};exports[_0xff34('0x1e')]=function(_0x3950a0){var _0x15eb7e=this;return new Promise(function(_0x211b4f,_0x240be1){return db[_0xff34('0x13')][_0xff34('0x1f')]({'where':_0x3950a0[_0xff34('0x14')]?_0x3950a0[_0xff34('0x14')][_0xff34('0x15')]||null:null})['then'](function(_0x25619f){logger[_0xff34('0x9')](_0xff34('0x1e'),_0x3950a0);logger[_0xff34('0xc')]('DestroyCmHopperBlack',_0x3950a0,JSON[_0xff34('0xe')](_0x25619f));_0x211b4f(_0x25619f);})[_0xff34('0x11')](function(_0xdd0a0f){logger[_0xff34('0xf')](_0xff34('0x1e'),_0xdd0a0f[_0xff34('0x10')],_0x3950a0);_0x240be1(_0x15eb7e[_0xff34('0xf')](0x1f4,_0xdd0a0f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 07225f7..b37ba59 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 _0x5162=['/:id','show','update','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe'];(function(_0x2326f2,_0x310b27){var _0xb699c4=function(_0x26bb04){while(--_0x26bb04){_0x2326f2['push'](_0x2326f2['shift']());}};_0xb699c4(++_0x310b27);}(_0x5162,0x103));var _0x2516=function(_0x6b1c9e,_0x322a1){_0x6b1c9e=_0x6b1c9e-0x0;var _0x4fb0d5=_0x5162[_0x6b1c9e];return _0x4fb0d5;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['put'](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2516('0xe')]=router; \ No newline at end of file +var _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc2c7,0x134));var _0x7c2c=function(_0x35d0fb,_0x2ce591){_0x35d0fb=_0x35d0fb-0x0;var _0x2927f0=_0xc2c7[_0x35d0fb];return _0x2927f0;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 55e2580..12f5e6d 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 _0x2c78=['INTEGER','STRING','DATE','followuptime','diff','BOOLEAN','moment','exports'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0x2c78,0x19e));var _0x82c7=function(_0x1c0e91,_0xd8625e){_0x1c0e91=_0x1c0e91-0x0;var _0x34322c=_0x2c78[_0x1c0e91];return _0x34322c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82c7('0x0'));module[_0x82c7('0x1')]={'state':{'type':Sequelize[_0x82c7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x82c7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x82c7('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x82c7('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x82c7('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x82c7('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x82c7('0x4')]},'endtime':{'type':Sequelize[_0x82c7('0x4')]},'ringtime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x82c7('0x3')]},'campaign':{'type':Sequelize[_0x82c7('0x3')]},'campaigntype':{'type':Sequelize[_0x82c7('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x82c7('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x82c7('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5950f3){var _0x8ca7d4=this['getDataValue']('endtime');if(_0x8ca7d4&&_0x5950f3){this['setDataValue'](_0x82c7('0x5'),moment(_0x5950f3)[_0x82c7('0x6')](moment(_0x8ca7d4),'seconds'));}}},'amd':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x82c7('0x4')]},'callback':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x82c7('0x4')]},'deleted':{'type':Sequelize[_0x82c7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x82c7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89aa=['STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x27e067,_0x3737e2){var _0x38319f=function(_0x29411a){while(--_0x29411a){_0x27e067['push'](_0x27e067['shift']());}};_0x38319f(++_0x3737e2);}(_0x89aa,0x97));var _0xa89a=function(_0x458d4c,_0x36ce0f){_0x458d4c=_0x458d4c-0x0;var _0x1a1855=_0x89aa[_0x458d4c];return _0x1a1855;};'use strict';var Sequelize=require(_0xa89a('0x0'));var moment=require('moment');module[_0xa89a('0x1')]={'state':{'type':Sequelize[_0xa89a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa89a('0x3')]},'scheduledat':{'type':Sequelize[_0xa89a('0x4')]},'countbusyretry':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa89a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa89a('0x3')]},'calleridnum':{'type':Sequelize[_0xa89a('0x3')]},'calleridname':{'type':Sequelize[_0xa89a('0x3')]},'starttime':{'type':Sequelize[_0xa89a('0x4')]},'responsetime':{'type':Sequelize[_0xa89a('0x4')]},'answertime':{'type':Sequelize[_0xa89a('0x4')]},'droptime':{'type':Sequelize[_0xa89a('0x4')]},'endtime':{'type':Sequelize[_0xa89a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa89a('0x3')]},'campaign':{'type':Sequelize[_0xa89a('0x3')]},'campaigntype':{'type':Sequelize[_0xa89a('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa89a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa89a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa89a('0x3')]},'dispositionat':{'type':Sequelize[_0xa89a('0x4')],'set':function(_0xfb319b){var _0x8ace5d=this['getDataValue'](_0xa89a('0x5'));if(_0x8ace5d&&_0xfb319b){this[_0xa89a('0x6')](_0xa89a('0x7'),moment(_0xfb319b)[_0xa89a('0x8')](moment(_0x8ace5d),_0xa89a('0x9')));}}},'amd':{'type':Sequelize[_0xa89a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa89a('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa89a('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa89a('0x4')]},'callback':{'type':Sequelize[_0xa89a('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xa89a('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa89a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa89a('0x2')],'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 cb66e53..9fe849b 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 _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x130b39,_0x4602be){var _0x140593=function(_0x5dd117){while(--_0x5dd117){_0x130b39['push'](_0x130b39['shift']());}};_0x140593(++_0x4602be);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x323a7e,_0x45b58a){_0x323a7e=_0x323a7e-0x0;var _0x46cd2c=_0xbd51[_0x323a7e];return _0x46cd2c;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file +var _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x814b,0x1a2));var _0xb814=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x814b[_0x574d9b];return _0x31d2a5;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cee627a..abb4197 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 _0x02db=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x3f74e6,_0x5d0b06){var _0x5d2fd2=function(_0x10bb97){while(--_0x10bb97){_0x3f74e6['push'](_0x3f74e6['shift']());}};_0x5d2fd2(++_0x5d0b06);}(_0x02db,0x1dc));var _0xb02d=function(_0x568ae4,_0xa2e52a){_0x568ae4=_0x568ae4-0x0;var _0x20c5ca=_0x02db[_0x568ae4];return _0x20c5ca;};'use strict';var _=require(_0xb02d('0x0'));var util=require(_0xb02d('0x1'));var logger=require(_0xb02d('0x2'))('api');var moment=require(_0xb02d('0x3'));var BPromise=require('bluebird');var rp=require(_0xb02d('0x4'));var fs=require('fs');var path=require(_0xb02d('0x5'));var rimraf=require(_0xb02d('0x6'));var config=require(_0xb02d('0x7'));var attributes=require(_0xb02d('0x8'));module[_0xb02d('0x9')]=function(_0x3f4df1,_0x472e2c){return _0x3f4df1[_0xb02d('0xa')]('CmHopperFinal',attributes,{'tableName':_0xb02d('0xb'),'paranoid':![],'indexes':[{'name':_0xb02d('0xc'),'fields':[_0xb02d('0xc')]},{'name':_0xb02d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x189b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x49bb91,_0x86ecf3){var _0x2b4339=function(_0x4fb062){while(--_0x4fb062){_0x49bb91['push'](_0x49bb91['shift']());}};_0x2b4339(++_0x86ecf3);}(_0x189b,0x186));var _0xb189=function(_0x286fcd,_0x46781e){_0x286fcd=_0x286fcd-0x0;var _0x2a8de8=_0x189b[_0x286fcd];return _0x2a8de8;};'use strict';var _=require(_0xb189('0x0'));var util=require('util');var logger=require(_0xb189('0x1'))(_0xb189('0x2'));var moment=require(_0xb189('0x3'));var BPromise=require(_0xb189('0x4'));var rp=require(_0xb189('0x5'));var fs=require('fs');var path=require(_0xb189('0x6'));var rimraf=require(_0xb189('0x7'));var config=require(_0xb189('0x8'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x572a6e,_0x421623){return _0x572a6e[_0xb189('0x9')]('CmHopperFinal',attributes,{'tableName':_0xb189('0xa'),'paranoid':![],'indexes':[{'name':_0xb189('0xb'),'fields':['calleridnum']},{'name':_0xb189('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a77973f..ef946b5 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x308036,_0x50b87a){var _0xe62cfb=function(_0xd04046){while(--_0xd04046){_0x308036['push'](_0x308036['shift']());}};_0xe62cfb(++_0x50b87a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32d1a9,_0x1b470c){_0x32d1a9=_0x32d1a9-0x0;var _0x50eaf1=_0xb10b[_0x32d1a9];return _0x50eaf1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x472047,_0x500121){var _0x78fd3d=function(_0x207b8d){while(--_0x207b8d){_0x472047['push'](_0x472047['shift']());}};_0x78fd3d(++_0x500121);}(_0x7a54,0x106));var _0x47a5=function(_0x1b2a47,_0x5a0c21){_0x1b2a47=_0x1b2a47-0x0;var _0x248c4c=_0x7a54[_0x1b2a47];return _0x248c4c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 75825b5..529431a 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 _0x36ff=['countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id'];(function(_0x334888,_0xae285){var _0x1e60ba=function(_0xb4ad88){while(--_0xb4ad88){_0x334888['push'](_0x334888['shift']());}};_0x1e60ba(++_0xae285);}(_0x36ff,0xb8));var _0xf36f=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x36ff[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xf36f('0x0'));var util=require(_0xf36f('0x1'));var path=require(_0xf36f('0x2'));var timeout=require(_0xf36f('0x3'));var express=require(_0xf36f('0x4'));var router=express[_0xf36f('0x5')]();var fs_extra=require(_0xf36f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf36f('0x7'));var config=require(_0xf36f('0x8'));var controller=require(_0xf36f('0x9'));router[_0xf36f('0xa')]('/',auth[_0xf36f('0xb')](),controller[_0xf36f('0xc')]);router[_0xf36f('0xa')](_0xf36f('0xd'),auth[_0xf36f('0xb')](),controller['describe']);router[_0xf36f('0xa')](_0xf36f('0xe'),auth[_0xf36f('0xb')](),controller['show']);router[_0xf36f('0xa')](_0xf36f('0xf'),auth[_0xf36f('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf36f('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xf36f('0x10')]);router['post'](_0xf36f('0x11'),auth['isAuthenticated'](),controller[_0xf36f('0x12')]);router[_0xf36f('0x13')](_0xf36f('0x14'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x15')]);router[_0xf36f('0x13')](_0xf36f('0x16'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x17')]);router['put'](_0xf36f('0xe'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc4b8=['post','/voice/campaign/moveContacts/:id','checkContactHopper','put','/:id','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x3184db,_0x43ec5f){var _0x2316bf=function(_0x3e8dc4){while(--_0x3e8dc4){_0x3184db['push'](_0x3184db['shift']());}};_0x2316bf(++_0x43ec5f);}(_0xc4b8,0x1ed));var _0x8c4b=function(_0x5629ca,_0x5101a9){_0x5629ca=_0x5629ca-0x0;var _0x135f1d=_0xc4b8[_0x5629ca];return _0x135f1d;};'use strict';var multer=require(_0x8c4b('0x0'));var util=require(_0x8c4b('0x1'));var path=require('path');var timeout=require(_0x8c4b('0x2'));var express=require('express');var router=express[_0x8c4b('0x3')]();var fs_extra=require(_0x8c4b('0x4'));var auth=require(_0x8c4b('0x5'));var interaction=require(_0x8c4b('0x6'));var config=require(_0x8c4b('0x7'));var controller=require(_0x8c4b('0x8'));router[_0x8c4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8c4b('0xa')]);router[_0x8c4b('0x9')]('/describe',auth[_0x8c4b('0xb')](),controller[_0x8c4b('0xc')]);router[_0x8c4b('0x9')]('/:id',auth[_0x8c4b('0xb')](),controller[_0x8c4b('0xd')]);router['get'](_0x8c4b('0xe'),auth[_0x8c4b('0xb')](),controller[_0x8c4b('0xf')]);router[_0x8c4b('0x9')](_0x8c4b('0x10'),auth[_0x8c4b('0xb')](),controller[_0x8c4b('0x11')]);router['post'](_0x8c4b('0x12'),auth[_0x8c4b('0xb')](),controller[_0x8c4b('0x13')]);router[_0x8c4b('0x14')](_0x8c4b('0x15'),auth[_0x8c4b('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8c4b('0x14')]('/checkContactHopper',auth[_0x8c4b('0xb')](),controller[_0x8c4b('0x16')]);router[_0x8c4b('0x17')](_0x8c4b('0x18'),auth['isAuthenticated'](),controller[_0x8c4b('0x19')]);module[_0x8c4b('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 3314f8f..62e24fd 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 _0xe321=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x191890,_0xe7979f){var _0x3d8b48=function(_0x294c37){while(--_0x294c37){_0x191890['push'](_0x191890['shift']());}};_0x3d8b48(++_0xe7979f);}(_0xe321,0x194));var _0x1e32=function(_0x4a9bdd,_0x5098f5){_0x4a9bdd=_0x4a9bdd-0x0;var _0x1ba3a4=_0xe321[_0x4a9bdd];return _0x1ba3a4;};'use strict';var Sequelize=require('sequelize');module[_0x1e32('0x0')]={'state':{'type':Sequelize[_0x1e32('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1e32('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1e32('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x1e32('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1e32('0x2')]},'calleridnum':{'type':Sequelize[_0x1e32('0x2')]},'calleridname':{'type':Sequelize[_0x1e32('0x2')]},'starttime':{'type':Sequelize[_0x1e32('0x3')]},'responsetime':{'type':Sequelize[_0x1e32('0x3')]},'answertime':{'type':Sequelize[_0x1e32('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1e32('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1e32('0x2')]},'campaigntype':{'type':Sequelize[_0x1e32('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1e32('0x2')]},'amd':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1e32('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1e32('0x2')]}}; \ No newline at end of file +var _0x1e82=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e82,0x8b));var _0x21e8=function(_0x70f3f2,_0x568ba0){_0x70f3f2=_0x70f3f2-0x0;var _0x396db5=_0x1e82[_0x70f3f2];return _0x396db5;};'use strict';var Sequelize=require(_0x21e8('0x0'));module[_0x21e8('0x1')]={'state':{'type':Sequelize[_0x21e8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x21e8('0x3')]},'scheduledat':{'type':Sequelize[_0x21e8('0x4')]},'countbusyretry':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x21e8('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x21e8('0x3')]},'calleridname':{'type':Sequelize[_0x21e8('0x3')]},'starttime':{'type':Sequelize[_0x21e8('0x4')]},'responsetime':{'type':Sequelize[_0x21e8('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x21e8('0x4')]},'endtime':{'type':Sequelize[_0x21e8('0x4')]},'ringtime':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x21e8('0x3')]},'campaign':{'type':Sequelize[_0x21e8('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x21e8('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x21e8('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x21e8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x21e8('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x21e8('0x4')]},'edited':{'type':Sequelize[_0x21e8('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x21e8('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x21e8('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0893087..f270b8e 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 _0x5594=['limit','count','apply','reject','update','then','destroy','end','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','catch','describe','uniqueid','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x5594,0xb8));var _0x4559=function(_0x2b4c7f,_0xd3a731){_0x2b4c7f=_0x2b4c7f-0x0;var _0xaa17cd=_0x5594[_0x2b4c7f];return _0xaa17cd;};'use strict';var emlformat=require(_0x4559('0x0'));var rimraf=require(_0x4559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4559('0x2'));var rp=require('request-promise');var moment=require(_0x4559('0x3'));var BPromise=require(_0x4559('0x4'));var Mustache=require(_0x4559('0x5'));var util=require(_0x4559('0x6'));var path=require(_0x4559('0x7'));var sox=require('sox');var csv=require(_0x4559('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4559('0x9'));var _=require('lodash');var squel=require(_0x4559('0xa'));var crypto=require(_0x4559('0xb'));var jsforce=require(_0x4559('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4559('0x8'));var querystring=require(_0x4559('0xd'));var Papa=require(_0x4559('0xe'));var Redis=require(_0x4559('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4559('0x10'));var as=require(_0x4559('0x11'));var hardwareService=require(_0x4559('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4559('0x13'));var config=require(_0x4559('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4559('0x15'))['db'];function respondWithStatusCode(_0x398fc1,_0x2ba371){_0x2ba371=_0x2ba371||0xcc;return function(_0xbf99a4){if(_0xbf99a4){return _0x398fc1[_0x4559('0x16')](_0x2ba371);}return _0x398fc1[_0x4559('0x17')](_0x2ba371)['end']();};}function respondWithResult(_0x18ba3b,_0x208e4b){_0x208e4b=_0x208e4b||0xc8;return function(_0x592212){if(_0x592212){return _0x18ba3b[_0x4559('0x17')](_0x208e4b)[_0x4559('0x18')](_0x592212);}};}function respondWithFilteredResult(_0x490876,_0x5a90e3){return function(_0x37deed){if(_0x37deed){var _0x4228b2=typeof _0x5a90e3[_0x4559('0x19')]==='undefined'&&typeof _0x5a90e3[_0x4559('0x1a')]==='undefined';var _0xe8018f=_0x37deed[_0x4559('0x1b')];var _0x21b1b2=_0x4228b2?0x0:_0x5a90e3['offset'];var _0x41080a=_0x4228b2?_0x37deed['count']:_0x5a90e3[_0x4559('0x19')]+_0x5a90e3['limit'];var _0x50d47d;if(_0x41080a>=_0xe8018f){_0x41080a=_0xe8018f;_0x50d47d=0xc8;}else{_0x50d47d=0xce;}_0x490876[_0x4559('0x17')](_0x50d47d);return _0x490876['set']('Content-Range',_0x21b1b2+'-'+_0x41080a+'/'+_0xe8018f)['json'](_0x37deed);}return null;};}function patchUpdates(_0xf91d18){return function(_0x7bae1){try{jsonpatch[_0x4559('0x1c')](_0x7bae1,_0xf91d18,!![]);}catch(_0x37b84e){return BPromise[_0x4559('0x1d')](_0x37b84e);}return _0x7bae1['save']();};}function saveUpdates(_0x518690,_0x2e702e){return function(_0x41061b){if(_0x41061b){return _0x41061b[_0x4559('0x1e')](_0x518690)[_0x4559('0x1f')](function(_0x404e13){return _0x404e13;});}return null;};}function removeEntity(_0x2da31d,_0x56304b){return function(_0x3998ab){if(_0x3998ab){return _0x3998ab[_0x4559('0x20')]()[_0x4559('0x1f')](function(){_0x2da31d[_0x4559('0x17')](0xcc)[_0x4559('0x21')]();});}};}function handleEntityNotFound(_0x12f763,_0x109a2e){return function(_0x1aa585){if(!_0x1aa585){_0x12f763['sendStatus'](0x194);}return _0x1aa585;};}function handleError(_0x5299e7,_0x8306c4){_0x8306c4=_0x8306c4||0x1f4;return function(_0x141fc2){logger[_0x4559('0x22')](_0x141fc2[_0x4559('0x23')]);if(_0x141fc2[_0x4559('0x24')]){delete _0x141fc2[_0x4559('0x24')];}_0x5299e7[_0x4559('0x17')](_0x8306c4)[_0x4559('0x25')](_0x141fc2);};}exports['index']=function(_0x4d7ae8,_0x1324f3){var _0x2e31c3={},_0x316d26={},_0x54c30a={'count':0x0,'rows':[]};var _0xf60d5b=_[_0x4559('0x26')](db[_0x4559('0x27')][_0x4559('0x28')],function(_0x17e94d){return{'name':_0x17e94d[_0x4559('0x29')],'type':_0x17e94d[_0x4559('0x2a')][_0x4559('0x2b')]};});_0x316d26[_0x4559('0x2c')]=_[_0x4559('0x26')](_0xf60d5b,_0x4559('0x24'));_0x316d26[_0x4559('0x2d')]=_[_0x4559('0x2e')](_0x4d7ae8['query']);_0x316d26[_0x4559('0x2f')]=_[_0x4559('0x30')](_0x316d26[_0x4559('0x2c')],_0x316d26[_0x4559('0x2d')]);_0x2e31c3[_0x4559('0x31')]=_[_0x4559('0x30')](_0x316d26[_0x4559('0x2c')],qs[_0x4559('0x32')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x32')]));_0x2e31c3[_0x4559('0x31')]=_0x2e31c3[_0x4559('0x31')][_0x4559('0x33')]?_0x2e31c3[_0x4559('0x31')]:_0x316d26[_0x4559('0x2c')];if(!_0x4d7ae8[_0x4559('0x2d')]['hasOwnProperty'](_0x4559('0x34'))){_0x2e31c3['limit']=qs['limit'](_0x4d7ae8[_0x4559('0x2d')]['limit']);_0x2e31c3['offset']=qs[_0x4559('0x19')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x19')]);}_0x2e31c3[_0x4559('0x35')]=qs[_0x4559('0x36')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x36')]);_0x2e31c3[_0x4559('0x37')]=qs[_0x4559('0x2f')](_[_0x4559('0x38')](_0x4d7ae8[_0x4559('0x2d')],_0x316d26[_0x4559('0x2f')]),_0xf60d5b);if(_0x4d7ae8['query']['filter']){_0x2e31c3[_0x4559('0x37')]=_[_0x4559('0x39')](_0x2e31c3[_0x4559('0x37')],{'$or':_['map'](_0xf60d5b,function(_0x49723d){if(_0x49723d[_0x4559('0x2a')]!==_0x4559('0x3a')){var _0x3691a4={};_0x3691a4[_0x49723d[_0x4559('0x24')]]={'$like':'%'+_0x4d7ae8[_0x4559('0x2d')]['filter']+'%'};return _0x3691a4;}})});}_0x2e31c3=_['merge']({},_0x2e31c3,_0x4d7ae8[_0x4559('0x3b')]);var _0x334c93={'where':_0x2e31c3[_0x4559('0x37')]};return db[_0x4559('0x27')]['count'](_0x334c93)[_0x4559('0x1f')](function(_0x25ff34){_0x54c30a[_0x4559('0x1b')]=_0x25ff34;if(_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x3c')]){_0x2e31c3[_0x4559('0x3d')]=[{'all':!![]}];}return db[_0x4559('0x27')][_0x4559('0x3e')](_0x2e31c3);})[_0x4559('0x1f')](function(_0x2dfa0a){_0x54c30a['rows']=_0x2dfa0a;return _0x54c30a;})[_0x4559('0x1f')](respondWithFilteredResult(_0x1324f3,_0x2e31c3))['catch'](handleError(_0x1324f3,null));};exports['show']=function(_0x1eaac6,_0x228f56){var _0x59790a={'raw':!![],'where':{'id':_0x1eaac6[_0x4559('0x3f')]['id']}},_0x5e6c05={};_0x5e6c05[_0x4559('0x2c')]=_['keys'](db[_0x4559('0x27')]['rawAttributes']);_0x5e6c05[_0x4559('0x2d')]=_[_0x4559('0x2e')](_0x1eaac6[_0x4559('0x2d')]);_0x5e6c05[_0x4559('0x2f')]=_['intersection'](_0x5e6c05[_0x4559('0x2c')],_0x5e6c05[_0x4559('0x2d')]);_0x59790a[_0x4559('0x31')]=_['intersection'](_0x5e6c05[_0x4559('0x2c')],qs[_0x4559('0x32')](_0x1eaac6['query']['fields']));_0x59790a[_0x4559('0x31')]=_0x59790a[_0x4559('0x31')]['length']?_0x59790a[_0x4559('0x31')]:_0x5e6c05[_0x4559('0x2c')];if(_0x1eaac6[_0x4559('0x2d')]['includeAll']){_0x59790a[_0x4559('0x3d')]=[{'all':!![]}];}_0x59790a=_[_0x4559('0x39')]({},_0x59790a,_0x1eaac6[_0x4559('0x3b')]);return db['CmHopperHistory'][_0x4559('0x40')](_0x59790a)['then'](handleEntityNotFound(_0x228f56,null))[_0x4559('0x1f')](respondWithResult(_0x228f56,null))['catch'](handleError(_0x228f56,null));};exports['create']=function(_0x58746a,_0x5e8837){return db['CmHopperHistory'][_0x4559('0x41')](_0x58746a[_0x4559('0x42')],{})[_0x4559('0x1f')](respondWithResult(_0x5e8837,0xc9))[_0x4559('0x43')](handleError(_0x5e8837,null));};exports[_0x4559('0x44')]=function(_0x11cc24,_0x3a9700){return db['CmHopperHistory'][_0x4559('0x44')]()[_0x4559('0x1f')](respondWithResult(_0x3a9700,null))[_0x4559('0x43')](handleError(_0x3a9700,null));};exports['update']=function(_0x1ffd9d,_0x21588b){if(_0x1ffd9d[_0x4559('0x42')][_0x4559('0x45')]){delete _0x1ffd9d[_0x4559('0x42')][_0x4559('0x45')];}return db[_0x4559('0x27')][_0x4559('0x40')]({'where':{'uniqueid':_0x1ffd9d[_0x4559('0x3f')]['id']}})[_0x4559('0x1f')](handleEntityNotFound(_0x21588b,null))[_0x4559('0x1f')](saveUpdates(_0x1ffd9d['body'],null))[_0x4559('0x1f')](respondWithResult(_0x21588b,null))[_0x4559('0x43')](handleError(_0x21588b,null));}; \ No newline at end of file +var _0x9ba0=['status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','intersection','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x35428e,_0x5e0a47){var _0xb504c8=function(_0x2ca991){while(--_0x2ca991){_0x35428e['push'](_0x35428e['shift']());}};_0xb504c8(++_0x5e0a47);}(_0x9ba0,0x7b));var _0x09ba=function(_0x51c4a4,_0x57383a){_0x51c4a4=_0x51c4a4-0x0;var _0x393e9a=_0x9ba0[_0x51c4a4];return _0x393e9a;};'use strict';var emlformat=require(_0x09ba('0x0'));var rimraf=require(_0x09ba('0x1'));var zipdir=require(_0x09ba('0x2'));var jsonpatch=require(_0x09ba('0x3'));var rp=require(_0x09ba('0x4'));var moment=require('moment');var BPromise=require(_0x09ba('0x5'));var Mustache=require(_0x09ba('0x6'));var util=require('util');var path=require('path');var sox=require(_0x09ba('0x7'));var csv=require(_0x09ba('0x8'));var ejs=require(_0x09ba('0x9'));var fs=require('fs');var fs_extra=require(_0x09ba('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x09ba('0xb'));var jsforce=require(_0x09ba('0xc'));var deskjs=require(_0x09ba('0xd'));var toCsv=require(_0x09ba('0x8'));var querystring=require(_0x09ba('0xe'));var Papa=require('papaparse');var Redis=require(_0x09ba('0xf'));var authService=require(_0x09ba('0x10'));var qs=require(_0x09ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ba('0x12'));var logger=require(_0x09ba('0x13'))('api');var utils=require(_0x09ba('0x14'));var config=require(_0x09ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x09ba('0x16'))['db'];function respondWithStatusCode(_0x25ab22,_0x486417){_0x486417=_0x486417||0xcc;return function(_0x5ef794){if(_0x5ef794){return _0x25ab22['sendStatus'](_0x486417);}return _0x25ab22[_0x09ba('0x17')](_0x486417)[_0x09ba('0x18')]();};}function respondWithResult(_0x2a1d61,_0x19717e){_0x19717e=_0x19717e||0xc8;return function(_0x13aaf4){if(_0x13aaf4){return _0x2a1d61[_0x09ba('0x17')](_0x19717e)[_0x09ba('0x19')](_0x13aaf4);}};}function respondWithFilteredResult(_0x1468b7,_0xf7d3d0){return function(_0x282a61){if(_0x282a61){var _0x5dabdb=typeof _0xf7d3d0['offset']===_0x09ba('0x1a')&&typeof _0xf7d3d0[_0x09ba('0x1b')]==='undefined';var _0x4b73f4=_0x282a61[_0x09ba('0x1c')];var _0xe74950=_0x5dabdb?0x0:_0xf7d3d0[_0x09ba('0x1d')];var _0x11e9eb=_0x5dabdb?_0x282a61[_0x09ba('0x1c')]:_0xf7d3d0['offset']+_0xf7d3d0[_0x09ba('0x1b')];var _0x491522;if(_0x11e9eb>=_0x4b73f4){_0x11e9eb=_0x4b73f4;_0x491522=0xc8;}else{_0x491522=0xce;}_0x1468b7['status'](_0x491522);return _0x1468b7['set'](_0x09ba('0x1e'),_0xe74950+'-'+_0x11e9eb+'/'+_0x4b73f4)[_0x09ba('0x19')](_0x282a61);}return null;};}function patchUpdates(_0x31e8b9){return function(_0x465090){try{jsonpatch[_0x09ba('0x1f')](_0x465090,_0x31e8b9,!![]);}catch(_0x2762b0){return BPromise[_0x09ba('0x20')](_0x2762b0);}return _0x465090[_0x09ba('0x21')]();};}function saveUpdates(_0x208a32,_0xad70b5){return function(_0x5dbf98){if(_0x5dbf98){return _0x5dbf98[_0x09ba('0x22')](_0x208a32)[_0x09ba('0x23')](function(_0x597565){return _0x597565;});}return null;};}function removeEntity(_0x3a6961,_0xad227a){return function(_0x30615e){if(_0x30615e){return _0x30615e['destroy']()[_0x09ba('0x23')](function(){_0x3a6961[_0x09ba('0x17')](0xcc)[_0x09ba('0x18')]();});}};}function handleEntityNotFound(_0x4d90ce,_0x41c8dc){return function(_0xe1c7ca){if(!_0xe1c7ca){_0x4d90ce[_0x09ba('0x24')](0x194);}return _0xe1c7ca;};}function handleError(_0x2b7463,_0x375a2f){_0x375a2f=_0x375a2f||0x1f4;return function(_0x55dd5d){logger['error'](_0x55dd5d[_0x09ba('0x25')]);if(_0x55dd5d[_0x09ba('0x26')]){delete _0x55dd5d[_0x09ba('0x26')];}_0x2b7463['status'](_0x375a2f)[_0x09ba('0x27')](_0x55dd5d);};}exports['index']=function(_0x553c7f,_0x1a7d3f){var _0x4a8df2={},_0x2b767d={},_0x4c6ba2={'count':0x0,'rows':[]};var _0x4b1035=_['map'](db[_0x09ba('0x28')][_0x09ba('0x29')],function(_0x4b0ef3){return{'name':_0x4b0ef3[_0x09ba('0x2a')],'type':_0x4b0ef3[_0x09ba('0x2b')]['key']};});_0x2b767d[_0x09ba('0x2c')]=_[_0x09ba('0x2d')](_0x4b1035,_0x09ba('0x26'));_0x2b767d[_0x09ba('0x2e')]=_[_0x09ba('0x2f')](_0x553c7f[_0x09ba('0x2e')]);_0x2b767d[_0x09ba('0x30')]=_['intersection'](_0x2b767d['model'],_0x2b767d[_0x09ba('0x2e')]);_0x4a8df2[_0x09ba('0x31')]=_['intersection'](_0x2b767d['model'],qs[_0x09ba('0x32')](_0x553c7f[_0x09ba('0x2e')][_0x09ba('0x32')]));_0x4a8df2[_0x09ba('0x31')]=_0x4a8df2[_0x09ba('0x31')][_0x09ba('0x33')]?_0x4a8df2[_0x09ba('0x31')]:_0x2b767d[_0x09ba('0x2c')];if(!_0x553c7f[_0x09ba('0x2e')][_0x09ba('0x34')](_0x09ba('0x35'))){_0x4a8df2[_0x09ba('0x1b')]=qs[_0x09ba('0x1b')](_0x553c7f[_0x09ba('0x2e')][_0x09ba('0x1b')]);_0x4a8df2['offset']=qs['offset'](_0x553c7f[_0x09ba('0x2e')][_0x09ba('0x1d')]);}_0x4a8df2['order']=qs[_0x09ba('0x36')](_0x553c7f['query'][_0x09ba('0x36')]);_0x4a8df2[_0x09ba('0x37')]=qs[_0x09ba('0x30')](_[_0x09ba('0x38')](_0x553c7f[_0x09ba('0x2e')],_0x2b767d[_0x09ba('0x30')]),_0x4b1035);if(_0x553c7f['query']['filter']){_0x4a8df2['where']=_[_0x09ba('0x39')](_0x4a8df2[_0x09ba('0x37')],{'$or':_['map'](_0x4b1035,function(_0x581e8d){if(_0x581e8d['type']!==_0x09ba('0x3a')){var _0x3dc7fd={};_0x3dc7fd[_0x581e8d['name']]={'$like':'%'+_0x553c7f[_0x09ba('0x2e')][_0x09ba('0x3b')]+'%'};return _0x3dc7fd;}})});}_0x4a8df2=_['merge']({},_0x4a8df2,_0x553c7f[_0x09ba('0x3c')]);var _0x312a96={'where':_0x4a8df2[_0x09ba('0x37')]};return db[_0x09ba('0x28')]['count'](_0x312a96)[_0x09ba('0x23')](function(_0x36dd52){_0x4c6ba2[_0x09ba('0x1c')]=_0x36dd52;if(_0x553c7f[_0x09ba('0x2e')]['includeAll']){_0x4a8df2[_0x09ba('0x3d')]=[{'all':!![]}];}return db[_0x09ba('0x28')][_0x09ba('0x3e')](_0x4a8df2);})[_0x09ba('0x23')](function(_0xc3819c){_0x4c6ba2[_0x09ba('0x3f')]=_0xc3819c;return _0x4c6ba2;})[_0x09ba('0x23')](respondWithFilteredResult(_0x1a7d3f,_0x4a8df2))[_0x09ba('0x40')](handleError(_0x1a7d3f,null));};exports[_0x09ba('0x41')]=function(_0x3de03a,_0x93e373){var _0x10cf10={'raw':!![],'where':{'id':_0x3de03a[_0x09ba('0x42')]['id']}},_0x9a2e74={};_0x9a2e74[_0x09ba('0x2c')]=_[_0x09ba('0x2f')](db[_0x09ba('0x28')][_0x09ba('0x29')]);_0x9a2e74[_0x09ba('0x2e')]=_[_0x09ba('0x2f')](_0x3de03a[_0x09ba('0x2e')]);_0x9a2e74[_0x09ba('0x30')]=_[_0x09ba('0x43')](_0x9a2e74[_0x09ba('0x2c')],_0x9a2e74[_0x09ba('0x2e')]);_0x10cf10['attributes']=_[_0x09ba('0x43')](_0x9a2e74[_0x09ba('0x2c')],qs['fields'](_0x3de03a[_0x09ba('0x2e')][_0x09ba('0x32')]));_0x10cf10[_0x09ba('0x31')]=_0x10cf10[_0x09ba('0x31')][_0x09ba('0x33')]?_0x10cf10[_0x09ba('0x31')]:_0x9a2e74[_0x09ba('0x2c')];if(_0x3de03a[_0x09ba('0x2e')]['includeAll']){_0x10cf10[_0x09ba('0x3d')]=[{'all':!![]}];}_0x10cf10=_['merge']({},_0x10cf10,_0x3de03a[_0x09ba('0x3c')]);return db['CmHopperHistory']['find'](_0x10cf10)[_0x09ba('0x23')](handleEntityNotFound(_0x93e373,null))['then'](respondWithResult(_0x93e373,null))[_0x09ba('0x40')](handleError(_0x93e373,null));};exports[_0x09ba('0x44')]=function(_0x55d712,_0x22c92f){return db[_0x09ba('0x28')][_0x09ba('0x44')](_0x55d712[_0x09ba('0x45')],{})[_0x09ba('0x23')](respondWithResult(_0x22c92f,0xc9))[_0x09ba('0x40')](handleError(_0x22c92f,null));};exports[_0x09ba('0x46')]=function(_0x483b9d,_0x223205){return db[_0x09ba('0x28')]['describe']()[_0x09ba('0x23')](respondWithResult(_0x223205,null))['catch'](handleError(_0x223205,null));};exports['update']=function(_0x438e4b,_0x3b3836){if(_0x438e4b[_0x09ba('0x45')][_0x09ba('0x47')]){delete _0x438e4b[_0x09ba('0x45')]['uniqueid'];}return db[_0x09ba('0x28')][_0x09ba('0x48')]({'where':{'uniqueid':_0x438e4b[_0x09ba('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b3836,null))[_0x09ba('0x23')](saveUpdates(_0x438e4b['body'],null))[_0x09ba('0x23')](respondWithResult(_0x3b3836,null))[_0x09ba('0x40')](handleError(_0x3b3836,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index dd71ef5..bf4d729 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 _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xc113,0x1ab));var _0x3c11=function(_0xc6c10,_0x4d5df5){_0xc6c10=_0xc6c10-0x0;var _0x4ed900=_0xc113[_0xc6c10];return _0x4ed900;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36d8fd,_0x38c63e){var _0x40b607=function(_0xf2386d){while(--_0xf2386d){_0x36d8fd['push'](_0x36d8fd['shift']());}};_0x40b607(++_0x38c63e);}(_0x4991,0xf7));var _0x1499=function(_0x399368,_0x420246){_0x399368=_0x399368-0x0;var _0x88bd98=_0x4991[_0x399368];return _0x88bd98;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[{'name':_0x1499('0xd'),'fields':[_0x1499('0xd')]},{'name':_0x1499('0xe'),'fields':[_0x1499('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9b0010d..fea22c9 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 _0x7aad=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird'];(function(_0x111517,_0x5e9886){var _0x48236f=function(_0x23a151){while(--_0x23a151){_0x111517['push'](_0x111517['shift']());}};_0x48236f(++_0x5e9886);}(_0x7aad,0x160));var _0xd7aa=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7aad[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var moment=require(_0xd7aa('0x1'));var BPromise=require(_0xd7aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7aa('0x3'));var db=require(_0xd7aa('0x4'))['db'];var utils=require(_0xd7aa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7aa('0x6'));var jayson=require(_0xd7aa('0x7'));var client=jayson[_0xd7aa('0x8')][_0xd7aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df120,_0x59023c,_0x2613dd){return new BPromise(function(_0x4bc884,_0x1e4dea){return client[_0xd7aa('0xa')](_0x4df120,_0x2613dd)['then'](function(_0x31d416){logger[_0xd7aa('0xb')](_0xd7aa('0xc'),_0x59023c,_0xd7aa('0xd'));logger[_0xd7aa('0xe')](_0xd7aa('0xf'),_0x59023c,'request\x20sent',JSON['stringify'](_0x31d416));if(_0x31d416[_0xd7aa('0x10')]){if(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x11')]===0x1f4){logger[_0xd7aa('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x59023c,_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);return _0x1e4dea(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);}logger[_0xd7aa('0x10')](_0xd7aa('0xc'),_0x59023c,_0x31d416['error'][_0xd7aa('0x12')]);return _0x4bc884(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);}else{logger[_0xd7aa('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x59023c,_0xd7aa('0xd'));_0x4bc884(_0x31d416[_0xd7aa('0x13')][_0xd7aa('0x12')]);}})[_0xd7aa('0x14')](function(_0x3b23b7){logger[_0xd7aa('0x10')](_0xd7aa('0xc'),_0x59023c,_0x3b23b7);_0x1e4dea(_0x3b23b7);});});}exports[_0xd7aa('0x15')]=function(_0xf43135){var _0x34a232=this;return new Promise(function(_0x4d842,_0x5300b5){return db[_0xd7aa('0x16')][_0xd7aa('0x17')](_0xf43135[_0xd7aa('0x18')],{'raw':_0xf43135[_0xd7aa('0x19')]?_0xf43135[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5825a6){logger[_0xd7aa('0xb')]('CreateCmHopperHistory',_0xf43135);logger[_0xd7aa('0xe')](_0xd7aa('0x15'),_0xf43135,JSON[_0xd7aa('0x1b')](_0x5825a6));_0x4d842(_0x5825a6);})[_0xd7aa('0x14')](function(_0x3ff6e5){logger[_0xd7aa('0x10')]('CreateCmHopperHistory',_0x3ff6e5[_0xd7aa('0x12')],_0xf43135);_0x5300b5(_0x34a232[_0xd7aa('0x10')](0x1f4,_0x3ff6e5[_0xd7aa('0x12')]));});});};exports[_0xd7aa('0x1c')]=function(_0x5afc21){var _0x25f575=this;return new Promise(function(_0x11d594,_0x350fa6){return db[_0xd7aa('0x16')][_0xd7aa('0x1d')]({'raw':_0x5afc21[_0xd7aa('0x19')]?_0x5afc21[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x5afc21[_0xd7aa('0x19')]?_0x5afc21[_0xd7aa('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')][_0xd7aa('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x22')))),_0xd7aa('0x23')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x24')))),_0xd7aa('0x25')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xd7aa('0x26')],[db[_0xd7aa('0x1f')]['fn']('AVG',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x27')))),_0xd7aa('0x28')],[db[_0xd7aa('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x29')))),_0xd7aa('0x2a')]]})[_0xd7aa('0x2b')](function(_0x1e0dc6){logger[_0xd7aa('0xb')](_0xd7aa('0x1c'),_0x5afc21);logger['debug']('AvgHandleTime',_0x5afc21,JSON[_0xd7aa('0x1b')](_0x1e0dc6));_0x11d594(_0x1e0dc6);})[_0xd7aa('0x14')](function(_0x3d30c1){logger[_0xd7aa('0x10')](_0xd7aa('0x1c'),_0x3d30c1[_0xd7aa('0x12')],_0x5afc21);_0x350fa6(_0x25f575[_0xd7aa('0x10')](0x1f4,_0x3d30c1['message']));});});};exports[_0xd7aa('0x2c')]=function(_0x2a44a5){var _0x47135e=this;return new Promise(function(_0x3941c6,_0x58bdfa){return db[_0xd7aa('0x16')][_0xd7aa('0x1d')]({'raw':_0x2a44a5[_0xd7aa('0x19')]?_0x2a44a5['options'][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a44a5[_0xd7aa('0x19')]?_0x2a44a5['options'][_0xd7aa('0x2d')]||null:null,'attributes':[[_0xd7aa('0x2e'),_0xd7aa('0x2f')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x30')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xd7aa('0x31')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x22')))),_0xd7aa('0x32')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x33')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize'][_0xd7aa('0x21')](_0xd7aa('0x34')))),_0xd7aa('0x35')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x36')))),_0xd7aa('0x37')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x38')))),_0xd7aa('0x39')],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize'][_0xd7aa('0x21')](_0xd7aa('0x3a')))),'outboundBlacklistCallsDay'],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3b')))),_0xd7aa('0x3c')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3d')))),_0xd7aa('0x3e')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3f')))),_0xd7aa('0x40')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x41')))),_0xd7aa('0x3e')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x42')))),_0xd7aa('0x43')]],'group':['campaign']})['then'](function(_0x5f01e7){logger['info']('GetVoiceQueueHopperHistory',_0x2a44a5);logger['debug'](_0xd7aa('0x2c'),_0x2a44a5,JSON[_0xd7aa('0x1b')](_0x5f01e7));_0x3941c6(_0x5f01e7);})[_0xd7aa('0x14')](function(_0x3e61cf){logger[_0xd7aa('0x10')]('GetVoiceQueueHopperHistory',_0x3e61cf[_0xd7aa('0x12')],_0x2a44a5);_0x58bdfa(_0x47135e['error'](0x1f4,_0x3e61cf[_0xd7aa('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1f186c){var _0x3e9465=this;return new Promise(function(_0x4bec5e,_0x56037a){return db[_0xd7aa('0x16')]['findAll']({'raw':_0x1f186c['options']?_0x1f186c[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f186c['options']?_0x1f186c[_0xd7aa('0x19')][_0xd7aa('0x2d')]||null:null,'attributes':[[_0xd7aa('0x2e'),_0xd7aa('0x2f')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')][_0xd7aa('0x20')]('id')),_0xd7aa('0x44')],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xd7aa('0x22')))),_0xd7aa('0x45')]],'group':[_0xd7aa('0x2e')]})['then'](function(_0x284ce9){logger['info']('GetCampaignHopperHistory',_0x1f186c);logger[_0xd7aa('0xe')](_0xd7aa('0x46'),_0x1f186c,JSON[_0xd7aa('0x1b')](_0x284ce9));_0x4bec5e(_0x284ce9);})['catch'](function(_0x47dbb6){logger[_0xd7aa('0x10')](_0xd7aa('0x46'),_0x47dbb6[_0xd7aa('0x12')],_0x1f186c);_0x56037a(_0x3e9465[_0xd7aa('0x10')](0x1f4,_0x47dbb6[_0xd7aa('0x12')]));});});}; \ No newline at end of file +var _0x5699=['body','options','debug','stringify','AvgHandleTime','findAll','raw','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x561e73,_0x13a224){var _0x2dc60d=function(_0xe87c37){while(--_0xe87c37){_0x561e73['push'](_0x561e73['shift']());}};_0x2dc60d(++_0x13a224);}(_0x5699,0xaf));var _0x9569=function(_0x4b92d6,_0x9cf54c){_0x4b92d6=_0x4b92d6-0x0;var _0x2acf2d=_0x5699[_0x4b92d6];return _0x2acf2d;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var moment=require(_0x9569('0x2'));var BPromise=require('bluebird');var rs=require(_0x9569('0x3'));var fs=require('fs');var Redis=require(_0x9569('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9569('0x5'));var logger=require(_0x9569('0x6'))('rpc');var config=require(_0x9569('0x7'));var jayson=require(_0x9569('0x8'));var client=jayson[_0x9569('0x9')][_0x9569('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5014f8,_0xd77df2,_0x587c8b){return new BPromise(function(_0x1a24e2,_0x3bf8f4){return client['request'](_0x5014f8,_0x587c8b)[_0x9569('0xb')](function(_0x752433){logger[_0x9569('0xc')](_0x9569('0xd'),_0xd77df2,_0x9569('0xe'));logger['debug'](_0x9569('0xf'),_0xd77df2,'request\x20sent',JSON['stringify'](_0x752433));if(_0x752433[_0x9569('0x10')]){if(_0x752433['error'][_0x9569('0x11')]===0x1f4){logger[_0x9569('0x10')](_0x9569('0xd'),_0xd77df2,_0x752433['error']['message']);return _0x3bf8f4(_0x752433[_0x9569('0x10')]['message']);}logger['error'](_0x9569('0xd'),_0xd77df2,_0x752433[_0x9569('0x10')]['message']);return _0x1a24e2(_0x752433['error'][_0x9569('0x12')]);}else{logger[_0x9569('0xc')](_0x9569('0xd'),_0xd77df2,_0x9569('0xe'));_0x1a24e2(_0x752433['result']['message']);}})[_0x9569('0x13')](function(_0x589d34){logger[_0x9569('0x10')](_0x9569('0xd'),_0xd77df2,_0x589d34);_0x3bf8f4(_0x589d34);});});}exports[_0x9569('0x14')]=function(_0x1da4a2){var _0x563f6c=this;return new Promise(function(_0x364a07,_0x479c8b){return db[_0x9569('0x15')][_0x9569('0x16')](_0x1da4a2[_0x9569('0x17')],{'raw':_0x1da4a2[_0x9569('0x18')]?_0x1da4a2[_0x9569('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9569('0xb')](function(_0xfc0d24){logger[_0x9569('0xc')](_0x9569('0x14'),_0x1da4a2);logger[_0x9569('0x19')](_0x9569('0x14'),_0x1da4a2,JSON[_0x9569('0x1a')](_0xfc0d24));_0x364a07(_0xfc0d24);})[_0x9569('0x13')](function(_0x337bd3){logger['error'](_0x9569('0x14'),_0x337bd3['message'],_0x1da4a2);_0x479c8b(_0x563f6c[_0x9569('0x10')](0x1f4,_0x337bd3[_0x9569('0x12')]));});});};exports[_0x9569('0x1b')]=function(_0x28a9cc){var _0x2b6613=this;return new Promise(function(_0x4c4ed9,_0x12476c){return db[_0x9569('0x15')][_0x9569('0x1c')]({'raw':_0x28a9cc[_0x9569('0x18')]?_0x28a9cc[_0x9569('0x18')][_0x9569('0x1d')]===undefined?!![]:![]:!![],'where':_0x28a9cc['options']?_0x28a9cc[_0x9569('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9569('0x1e'),db['sequelize'][_0x9569('0x1f')]('id')),_0x9569('0x20')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x23')))),_0x9569('0x24')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')]['literal'](_0x9569('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db['sequelize'][_0x9569('0x22')](_0x9569('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x9569('0x21')]['fn']('AVG',db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x27')))),_0x9569('0x28')],[db[_0x9569('0x21')]['fn']('AVG',db[_0x9569('0x21')]['fn']('IF',db['sequelize'][_0x9569('0x22')](_0x9569('0x29')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x5ae647){logger['info']('AvgHandleTime',_0x28a9cc);logger[_0x9569('0x19')](_0x9569('0x1b'),_0x28a9cc,JSON['stringify'](_0x5ae647));_0x4c4ed9(_0x5ae647);})[_0x9569('0x13')](function(_0x16c2d7){logger[_0x9569('0x10')](_0x9569('0x1b'),_0x16c2d7['message'],_0x28a9cc);_0x12476c(_0x2b6613[_0x9569('0x10')](0x1f4,_0x16c2d7[_0x9569('0x12')]));});});};exports[_0x9569('0x2a')]=function(_0x1cf14b){var _0x473b32=this;return new Promise(function(_0x111764,_0x157ddc){return db[_0x9569('0x15')]['findAll']({'raw':_0x1cf14b[_0x9569('0x18')]?_0x1cf14b[_0x9569('0x18')][_0x9569('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cf14b['options']?_0x1cf14b[_0x9569('0x18')][_0x9569('0x2b')]||null:null,'attributes':[[_0x9569('0x2c'),_0x9569('0x2d')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db['sequelize']['fn']('IF',db[_0x9569('0x21')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x9569('0x2e')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x2f')))),_0x9569('0x30')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x23')))),_0x9569('0x31')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x9569('0x22')](_0x9569('0x32')))),_0x9569('0x33')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x34')))),_0x9569('0x35')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x9569('0x21')]['fn']('COUNT',db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x37')))),_0x9569('0x38')],[db['sequelize']['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x9569('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x39')))),'outboundBlacklistCallsDay'],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x9569('0x3a')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')]['literal'](_0x9569('0x3b')))),_0x9569('0x3c')],[db['sequelize']['fn'](_0x9569('0x1e'),db['sequelize']['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')](_0x9569('0x3d')))),_0x9569('0x3a')],[db[_0x9569('0x21')]['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x9569('0x3e')]],'group':['campaign']})['then'](function(_0x43a484){logger['info'](_0x9569('0x2a'),_0x1cf14b);logger[_0x9569('0x19')](_0x9569('0x2a'),_0x1cf14b,JSON[_0x9569('0x1a')](_0x43a484));_0x111764(_0x43a484);})['catch'](function(_0x11b133){logger[_0x9569('0x10')](_0x9569('0x2a'),_0x11b133[_0x9569('0x12')],_0x1cf14b);_0x157ddc(_0x473b32[_0x9569('0x10')](0x1f4,_0x11b133[_0x9569('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x5d2605){var _0x454d73=this;return new Promise(function(_0x2f5e6f,_0x4741be){return db[_0x9569('0x15')][_0x9569('0x1c')]({'raw':_0x5d2605['options']?_0x5d2605[_0x9569('0x18')][_0x9569('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d2605[_0x9569('0x18')]?_0x5d2605[_0x9569('0x18')]['where']||null:null,'attributes':[['campaign',_0x9569('0x2d')],[db[_0x9569('0x21')]['fn']('COUNT',db[_0x9569('0x21')][_0x9569('0x1f')]('id')),_0x9569('0x3f')],[db['sequelize']['fn'](_0x9569('0x1e'),db[_0x9569('0x21')]['fn']('IF',db[_0x9569('0x21')][_0x9569('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x9569('0x40')]],'group':['campaign']})[_0x9569('0xb')](function(_0xb0aa81){logger[_0x9569('0xc')](_0x9569('0x41'),_0x5d2605);logger['debug'](_0x9569('0x41'),_0x5d2605,JSON[_0x9569('0x1a')](_0xb0aa81));_0x2f5e6f(_0xb0aa81);})[_0x9569('0x13')](function(_0x4d7e19){logger[_0x9569('0x10')](_0x9569('0x41'),_0x4d7e19[_0x9569('0x12')],_0x5d2605);_0x4741be(_0x454d73[_0x9569('0x10')](0x1f4,_0x4d7e19[_0x9569('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 39bead3..efca338 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 _0x8b19=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer'];(function(_0x18c9d8,_0x1e1a31){var _0x49a2ec=function(_0x46f889){while(--_0x46f889){_0x18c9d8['push'](_0x18c9d8['shift']());}};_0x49a2ec(++_0x1e1a31);}(_0x8b19,0x155));var _0x98b1=function(_0xceb1ce,_0x542e89){_0xceb1ce=_0xceb1ce-0x0;var _0x2a7d2a=_0x8b19[_0xceb1ce];return _0x2a7d2a;};'use strict';var multer=require(_0x98b1('0x0'));var util=require('util');var path=require(_0x98b1('0x1'));var timeout=require(_0x98b1('0x2'));var express=require(_0x98b1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98b1('0x4'));var interaction=require(_0x98b1('0x5'));var config=require(_0x98b1('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x98b1('0x7')]('/',auth['isAuthenticated'](),controller[_0x98b1('0x8')]);router['get'](_0x98b1('0x9'),auth['isAuthenticated'](),controller[_0x98b1('0xa')]);router[_0x98b1('0x7')](_0x98b1('0xb'),auth['isAuthenticated'](),controller[_0x98b1('0xc')]);router[_0x98b1('0xd')]('/',auth[_0x98b1('0xe')](),controller[_0x98b1('0xf')]);router[_0x98b1('0x10')](_0x98b1('0xb'),auth[_0x98b1('0xe')](),controller[_0x98b1('0x11')]);module[_0x98b1('0x12')]=router; \ No newline at end of file +var _0x4454=['../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','exports','connect-timeout','Router','../../components/auth/service'];(function(_0x2cc437,_0x1b4c3f){var _0x2e163a=function(_0x2db7dc){while(--_0x2db7dc){_0x2cc437['push'](_0x2cc437['shift']());}};_0x2e163a(++_0x1b4c3f);}(_0x4454,0x1ea));var _0x4445=function(_0x176f66,_0x26639a){_0x176f66=_0x176f66-0x0;var _0x3b8c9b=_0x4454[_0x176f66];return _0x3b8c9b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4445('0x0'));var express=require('express');var router=express[_0x4445('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x4445('0x2'));var interaction=require(_0x4445('0x3'));var config=require('../../config/environment');var controller=require(_0x4445('0x4'));router[_0x4445('0x5')]('/',auth[_0x4445('0x6')](),controller[_0x4445('0x7')]);router[_0x4445('0x5')](_0x4445('0x8'),auth[_0x4445('0x6')](),controller[_0x4445('0x9')]);router[_0x4445('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x4445('0xa')]);router[_0x4445('0xb')]('/',auth['isAuthenticated'](),controller[_0x4445('0xc')]);router[_0x4445('0xd')](_0x4445('0xe'),auth['isAuthenticated'](),controller[_0x4445('0xf')]);module[_0x4445('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b70dbdf..5dff457 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 _0xec46=['sequelize','exports','STRING','name'];(function(_0x42f94b,_0x383b68){var _0x39ff1f=function(_0x330755){while(--_0x330755){_0x42f94b['push'](_0x42f94b['shift']());}};_0x39ff1f(++_0x383b68);}(_0xec46,0x19c));var _0x6ec4=function(_0x3ed26c,_0xab6b81){_0x3ed26c=_0x3ed26c-0x0;var _0x20074a=_0xec46[_0x3ed26c];return _0x20074a;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')],'unique':_0x6ec4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6379=['sequelize','exports','STRING','name'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0x6379,0x84));var _0x9637=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0x6379[_0x4dda69];return _0x9014a9;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'name':{'type':Sequelize[_0x9637('0x2')],'unique':_0x9637('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9637('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1629b7e..af0c3c2 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 _0x068a=['item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','type','Sequelize','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','rows','catch','params','find','create','body','role','error','describe','ListId','pick','Disposition','findAll','removeDispositions','ids','tags','isArray','join','push','each','CmContact','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','alias','select'];(function(_0x474489,_0x460f1f){var _0x37f52f=function(_0x83f753){while(--_0x83f753){_0x474489['push'](_0x474489['shift']());}};_0x37f52f(++_0x460f1f);}(_0x068a,0x15c));var _0xa068=function(_0x1a8f3f,_0x1f452e){_0x1a8f3f=_0x1a8f3f-0x0;var _0x5f41eb=_0x068a[_0x1a8f3f];return _0x5f41eb;};'use strict';var emlformat=require(_0xa068('0x0'));var rimraf=require(_0xa068('0x1'));var zipdir=require(_0xa068('0x2'));var jsonpatch=require(_0xa068('0x3'));var rp=require(_0xa068('0x4'));var moment=require('moment');var BPromise=require(_0xa068('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa068('0x6'));var fs=require('fs');var fs_extra=require(_0xa068('0x7'));var _=require(_0xa068('0x8'));var squel=require(_0xa068('0x9'));var crypto=require('crypto');var jsforce=require(_0xa068('0xa'));var deskjs=require(_0xa068('0xb'));var toCsv=require(_0xa068('0xc'));var querystring=require(_0xa068('0xd'));var Papa=require('papaparse');var Redis=require(_0xa068('0xe'));var authService=require(_0xa068('0xf'));var qs=require(_0xa068('0x10'));var as=require(_0xa068('0x11'));var hardwareService=require(_0xa068('0x12'));var logger=require(_0xa068('0x13'))(_0xa068('0x14'));var utils=require(_0xa068('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa068('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xa068('0x17')]=_[_0xa068('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa068('0x19'))(new Redis(config[_0xa068('0x17')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x398e14,_0x17e9ab){_0x17e9ab=_0x17e9ab||0xcc;return function(_0x3ef799){if(_0x3ef799){return _0x398e14[_0xa068('0x1a')](_0x17e9ab);}return _0x398e14[_0xa068('0x1b')](_0x17e9ab)[_0xa068('0x1c')]();};}function respondWithResult(_0x39dc86,_0x144062){_0x144062=_0x144062||0xc8;return function(_0x3aceb9){if(_0x3aceb9){return _0x39dc86[_0xa068('0x1b')](_0x144062)[_0xa068('0x1d')](_0x3aceb9);}};}function respondWithFilteredResult(_0x201e55,_0xd19a5e){return function(_0x172de5){if(_0x172de5){var _0xffd32=typeof _0xd19a5e['offset']===_0xa068('0x1e')&&typeof _0xd19a5e['limit']===_0xa068('0x1e');var _0x1d7eb7=_0x172de5[_0xa068('0x1f')];var _0x87ffe5=_0xffd32?0x0:_0xd19a5e[_0xa068('0x20')];var _0x2a7441=_0xffd32?_0x172de5['count']:_0xd19a5e[_0xa068('0x20')]+_0xd19a5e[_0xa068('0x21')];var _0x170a32;if(_0x2a7441>=_0x1d7eb7){_0x2a7441=_0x1d7eb7;_0x170a32=0xc8;}else{_0x170a32=0xce;}_0x201e55[_0xa068('0x1b')](_0x170a32);return _0x201e55[_0xa068('0x22')](_0xa068('0x23'),_0x87ffe5+'-'+_0x2a7441+'/'+_0x1d7eb7)[_0xa068('0x1d')](_0x172de5);}return null;};}function patchUpdates(_0x222dda){return function(_0x249014){try{jsonpatch[_0xa068('0x24')](_0x249014,_0x222dda,!![]);}catch(_0x4c8c46){return BPromise[_0xa068('0x25')](_0x4c8c46);}return _0x249014[_0xa068('0x26')]();};}function saveUpdates(_0x47bab1,_0x583649){return function(_0x3f536c){if(_0x3f536c){return _0x3f536c[_0xa068('0x27')](_0x47bab1)[_0xa068('0x28')](function(_0x1459b6){return _0x1459b6;});}return null;};}function removeEntity(_0x10e16c,_0x513172){return function(_0x41b52c){if(_0x41b52c){return _0x41b52c[_0xa068('0x29')]()[_0xa068('0x28')](function(){var _0x4dacff=_0x41b52c[_0xa068('0x2a')]({'plain':!![]});var _0x152a32='Lists';return db[_0xa068('0x2b')][_0xa068('0x29')]({'where':{'type':_0x152a32,'resourceId':_0x4dacff['id']}})[_0xa068('0x28')](function(){return _0x41b52c;});})[_0xa068('0x28')](function(){_0x10e16c[_0xa068('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aef1,_0x1c1da5){return function(_0x27a2fd){if(!_0x27a2fd){_0x38aef1[_0xa068('0x1a')](0x194);}return _0x27a2fd;};}function handleError(_0x1041a9,_0x593a0e){_0x593a0e=_0x593a0e||0x1f4;return function(_0x10ea14){logger['error'](_0x10ea14['stack']);if(_0x10ea14[_0xa068('0x2c')]){delete _0x10ea14[_0xa068('0x2c')];}_0x1041a9[_0xa068('0x1b')](_0x593a0e)['send'](_0x10ea14);};}exports[_0xa068('0x2d')]=function(_0x715d42,_0x48b49c){var _0xe6a519={},_0x887b37={},_0x2e4aa7={'count':0x0,'rows':[]};var _0x4b5de6=_['map'](db['CmList'][_0xa068('0x2e')],function(_0x269831){return{'name':_0x269831[_0xa068('0x2f')],'type':_0x269831['type'][_0xa068('0x30')]};});_0x887b37[_0xa068('0x31')]=_[_0xa068('0x32')](_0x4b5de6,'name');_0x887b37[_0xa068('0x33')]=_[_0xa068('0x34')](_0x715d42[_0xa068('0x33')]);_0x887b37[_0xa068('0x35')]=_[_0xa068('0x36')](_0x887b37[_0xa068('0x31')],_0x887b37[_0xa068('0x33')]);_0xe6a519[_0xa068('0x37')]=_[_0xa068('0x36')](_0x887b37['model'],qs['fields'](_0x715d42[_0xa068('0x33')][_0xa068('0x38')]));_0xe6a519['attributes']=_0xe6a519[_0xa068('0x37')][_0xa068('0x39')]?_0xe6a519['attributes']:_0x887b37[_0xa068('0x31')];if(!_0x715d42[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0xe6a519[_0xa068('0x21')]=qs[_0xa068('0x21')](_0x715d42['query']['limit']);_0xe6a519[_0xa068('0x20')]=qs['offset'](_0x715d42[_0xa068('0x33')]['offset']);}_0xe6a519[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x715d42['query'][_0xa068('0x3d')]);_0xe6a519[_0xa068('0x3e')]=qs[_0xa068('0x35')](_['pick'](_0x715d42['query'],_0x887b37['filters']),_0x4b5de6);if(_0x715d42[_0xa068('0x33')][_0xa068('0x3f')]){_0xe6a519[_0xa068('0x3e')]=_[_0xa068('0x40')](_0xe6a519[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x4b5de6,function(_0x4358f0){if(_0x4358f0['type']!==_0xa068('0x41')){var _0x2fed2b={};_0x2fed2b[_0x4358f0[_0xa068('0x2c')]]={'$like':'%'+_0x715d42[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x2fed2b;}})});}_0xe6a519=_['merge']({},_0xe6a519,_0x715d42[_0xa068('0x42')]);var _0x355674={'where':_0xe6a519[_0xa068('0x3e')]};return db[_0xa068('0x43')]['count'](_0x355674)[_0xa068('0x28')](function(_0x4e248d){_0x2e4aa7[_0xa068('0x1f')]=_0x4e248d;if(_0x715d42[_0xa068('0x33')][_0xa068('0x44')]){_0xe6a519[_0xa068('0x45')]=[{'all':!![]}];}return db[_0xa068('0x43')]['findAll'](_0xe6a519);})[_0xa068('0x28')](function(_0x656b8e){_0x2e4aa7[_0xa068('0x46')]=_0x656b8e;return _0x2e4aa7;})[_0xa068('0x28')](respondWithFilteredResult(_0x48b49c,_0xe6a519))[_0xa068('0x47')](handleError(_0x48b49c,null));};exports['show']=function(_0x4f0b81,_0x5adcab){var _0x2a1d41={'raw':![],'where':{'id':_0x4f0b81[_0xa068('0x48')]['id']}},_0x5817c5={};_0x5817c5[_0xa068('0x31')]=_[_0xa068('0x34')](db[_0xa068('0x43')][_0xa068('0x2e')]);_0x5817c5[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4f0b81[_0xa068('0x33')]);_0x5817c5['filters']=_['intersection'](_0x5817c5[_0xa068('0x31')],_0x5817c5['query']);_0x2a1d41[_0xa068('0x37')]=_[_0xa068('0x36')](_0x5817c5[_0xa068('0x31')],qs[_0xa068('0x38')](_0x4f0b81[_0xa068('0x33')]['fields']));_0x2a1d41[_0xa068('0x37')]=_0x2a1d41[_0xa068('0x37')][_0xa068('0x39')]?_0x2a1d41[_0xa068('0x37')]:_0x5817c5['model'];if(_0x4f0b81[_0xa068('0x33')][_0xa068('0x44')]){_0x2a1d41[_0xa068('0x45')]=[{'all':!![]}];}_0x2a1d41=_[_0xa068('0x40')]({},_0x2a1d41,_0x4f0b81[_0xa068('0x42')]);return db[_0xa068('0x43')][_0xa068('0x49')](_0x2a1d41)['then'](handleEntityNotFound(_0x5adcab,null))[_0xa068('0x28')](respondWithResult(_0x5adcab,null))[_0xa068('0x47')](handleError(_0x5adcab,null));};exports['create']=function(_0x13d818,_0x3aff7e){return db['CmList'][_0xa068('0x4a')](_0x13d818[_0xa068('0x4b')],{})[_0xa068('0x28')](function(_0x2e8606){var _0xf422ee=_0x13d818['user'][_0xa068('0x2a')]({'plain':!![]});if(!_0xf422ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf422ee[_0xa068('0x4c')]==='user'){var _0x96b5be=_0x2e8606[_0xa068('0x2a')]({'plain':!![]});var _0x44ed26='Lists';return db['UserProfileSection'][_0xa068('0x49')]({'where':{'name':_0x44ed26,'userProfileId':_0xf422ee['userProfileId']},'raw':!![]})['then'](function(_0x558f2a){if(_0x558f2a&&_0x558f2a['autoAssociation']===0x0){return db[_0xa068('0x2b')]['create']({'name':_0x96b5be[_0xa068('0x2c')],'resourceId':_0x96b5be['id'],'type':_0x558f2a['name'],'sectionId':_0x558f2a['id']},{})[_0xa068('0x28')](function(){return _0x2e8606;});}else{return _0x2e8606;}})[_0xa068('0x47')](function(_0x2c77d8){logger[_0xa068('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c77d8);throw _0x2c77d8;});}return _0x2e8606;})[_0xa068('0x28')](respondWithResult(_0x3aff7e,0xc9))[_0xa068('0x47')](handleError(_0x3aff7e,null));};exports['update']=function(_0x3f3d25,_0x425794){if(_0x3f3d25[_0xa068('0x4b')]['id']){delete _0x3f3d25[_0xa068('0x4b')]['id'];}return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x3f3d25['params']['id']}})['then'](handleEntityNotFound(_0x425794,null))[_0xa068('0x28')](saveUpdates(_0x3f3d25[_0xa068('0x4b')],null))[_0xa068('0x28')](respondWithResult(_0x425794,null))[_0xa068('0x47')](handleError(_0x425794,null));};exports[_0xa068('0x29')]=function(_0x53477f,_0x41d4f8){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x53477f[_0xa068('0x48')]['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x41d4f8,null))[_0xa068('0x28')](removeEntity(_0x41d4f8,null))['catch'](handleError(_0x41d4f8,null));};exports[_0xa068('0x4e')]=function(_0x277641,_0x2f6902){return db[_0xa068('0x43')][_0xa068('0x4e')]()[_0xa068('0x28')](respondWithResult(_0x2f6902,null))[_0xa068('0x47')](handleError(_0x2f6902,null));};exports['addDisposition']=function(_0x3890b6,_0x5257ff,_0x155d3e){if(_0x3890b6[_0xa068('0x4b')]['id']){delete _0x3890b6['body']['id'];}return db['CmList'][_0xa068('0x49')]({'where':{'id':_0x3890b6['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x5257ff,null))[_0xa068('0x28')](function(_0x3955fb){if(_0x3955fb){_0x3890b6[_0xa068('0x4b')][_0xa068('0x4f')]=_0x3955fb['id'];return db['Disposition'][_0xa068('0x4a')](_0x3890b6[_0xa068('0x4b')]);}})[_0xa068('0x28')](respondWithResult(_0x5257ff,null))[_0xa068('0x47')](handleError(_0x5257ff,null));};exports['getDispositions']=function(_0x1eb6ad,_0x54a9dd,_0x488d72){var _0x595fc2={'raw':![],'where':{}};var _0x54bc6d={};var _0x559c56={'count':0x0,'rows':[]};return db[_0xa068('0x43')]['findOne']({'where':{'id':_0x1eb6ad['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x54a9dd,null))[_0xa068('0x28')](function(_0x46d601){if(_0x46d601){_0x54bc6d[_0xa068('0x31')]=_[_0xa068('0x34')](db['Disposition']['rawAttributes']);_0x54bc6d[_0xa068('0x33')]=_[_0xa068('0x34')](_0x1eb6ad[_0xa068('0x33')]);_0x54bc6d[_0xa068('0x35')]=_[_0xa068('0x36')](_0x54bc6d[_0xa068('0x31')],_0x54bc6d['query']);_0x595fc2[_0xa068('0x37')]=_[_0xa068('0x36')](_0x54bc6d[_0xa068('0x31')],qs[_0xa068('0x38')](_0x1eb6ad[_0xa068('0x33')]['fields']));_0x595fc2[_0xa068('0x37')]=_0x595fc2[_0xa068('0x37')]['length']?_0x595fc2[_0xa068('0x37')]:_0x54bc6d['model'];if(!_0x1eb6ad[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0x595fc2['limit']=qs[_0xa068('0x21')](_0x1eb6ad[_0xa068('0x33')][_0xa068('0x21')]);_0x595fc2[_0xa068('0x20')]=qs[_0xa068('0x20')](_0x1eb6ad[_0xa068('0x33')][_0xa068('0x20')]);}_0x595fc2[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x1eb6ad['query'][_0xa068('0x3d')]);_0x595fc2[_0xa068('0x3e')]=qs['filters'](_[_0xa068('0x50')](_0x1eb6ad[_0xa068('0x33')],_0x54bc6d[_0xa068('0x35')]));_0x595fc2[_0xa068('0x3e')][_0xa068('0x4f')]=_0x46d601['id'];if(_0x1eb6ad[_0xa068('0x33')]['filter']){_0x595fc2[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x595fc2['where'],{'$or':_[_0xa068('0x32')](_0x595fc2[_0xa068('0x37')],function(_0x225271){var _0x185de8={};_0x185de8[_0x225271]={'$like':'%'+_0x1eb6ad[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x185de8;})});}_0x595fc2=_[_0xa068('0x40')]({},_0x595fc2,_0x1eb6ad[_0xa068('0x42')]);return db[_0xa068('0x51')]['count']({'where':_0x595fc2['where']})[_0xa068('0x28')](function(_0x23372f){_0x559c56[_0xa068('0x1f')]=_0x23372f;if(_0x1eb6ad['query'][_0xa068('0x44')]){_0x595fc2[_0xa068('0x45')]=[{'all':!![]}];}return db[_0xa068('0x51')][_0xa068('0x52')](_0x595fc2);})['then'](function(_0xfa9531){_0x559c56[_0xa068('0x46')]=_0xfa9531;return _0x559c56;});}})[_0xa068('0x28')](respondWithFilteredResult(_0x54a9dd,_0x595fc2))[_0xa068('0x47')](handleError(_0x54a9dd,null));};exports[_0xa068('0x53')]=function(_0x6b7946,_0x49571d,_0x1845ad){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x6b7946[_0xa068('0x48')]['id']}})['then'](handleEntityNotFound(_0x49571d,null))[_0xa068('0x28')](function(_0x12ee9b){if(_0x12ee9b){return _0x12ee9b[_0xa068('0x53')](_0x6b7946[_0xa068('0x33')][_0xa068('0x54')]);}})[_0xa068('0x28')](respondWithStatusCode(_0x49571d,null))[_0xa068('0x47')](handleError(_0x49571d,null));};exports['addContacts']=function(_0x4d3670,_0x2de2ed,_0x2df2ee){return db['CmList'][_0xa068('0x49')]({'where':{'id':_0x4d3670[_0xa068('0x48')]['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x2de2ed,null))['then'](function(_0x3be9a2){if(_0x3be9a2){var _0x5a506f=[];var _0x4a3b94={'success':[],'errors':[]};return db['CmContact'][_0xa068('0x4e')]()[_0xa068('0x28')](function(_0x664aa3){if(_0x4d3670['body'][_0xa068('0x55')]&&_[_0xa068('0x56')](_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')])){if(_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')][_0xa068('0x39')]){_0x4d3670['body'][_0xa068('0x55')]=_0x4d3670[_0xa068('0x4b')]['tags'][_0xa068('0x57')](';')+';';}else{_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')]=null;}}else{_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')]=null;}if(_0x4d3670['body']&&_[_0xa068('0x56')](_0x4d3670[_0xa068('0x4b')])){for(var _0xee760b=0x0;_0xee760b<_0x4d3670[_0xa068('0x4b')][_0xa068('0x39')];_0xee760b+=0x1){_0x4d3670['body'][_0xee760b][_0xa068('0x4f')]=_0x4d3670[_0xa068('0x48')]['id'];_0x5a506f[_0xa068('0x58')](_0x4d3670[_0xa068('0x4b')][_0xee760b]);}return BPromise[_0xa068('0x59')](_0x5a506f,function(_0x23d84b){return db[_0xa068('0x5a')][_0xa068('0x4a')](_[_0xa068('0x5b')](_0x23d84b,['ids','id'])||{},{'fields':_[_0xa068('0x34')](_0x664aa3),'raw':!![]})[_0xa068('0x28')](function(_0x4c9555){_0x4a3b94['success'][_0xa068('0x58')](_0x4c9555[_0xa068('0x5c')]);})[_0xa068('0x47')](function(_0x4a78dd){_0x4a3b94[_0xa068('0x5d')][_0xa068('0x58')]({'data':_0x23d84b,'error':_0x4a78dd[_0xa068('0x5e')]});});})[_0xa068('0x28')](function(_0x3603fd){return _0x4a3b94;})[_0xa068('0x47')](function(_0x3ac7b7){return _0x3ac7b7;});}else{_0x2de2ed['status'](0x190)[_0xa068('0x1d')]({'message':_0xa068('0x5f')});}});}})[_0xa068('0x28')](respondWithResult(_0x2de2ed,null))[_0xa068('0x47')](handleError(_0x2de2ed,null));};exports[_0xa068('0x60')]=function(_0x4d0e20,_0x171edc,_0x3d60f7){var _0x1c3561;return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x4d0e20['params']['id']},'include':[{'model':db[_0xa068('0x61')],'as':'CustomFields'}]})[_0xa068('0x28')](handleEntityNotFound(_0x171edc,null))['then'](function(_0x81729c){if(_0x81729c){_0x1c3561=_0x81729c;return db['CmContact'][_0xa068('0x2e')];}})[_0xa068('0x28')](function(_0x46c46f){if(_0x46c46f){var _0x5bdda2={};var _0x438ba1={};_0x438ba1['model']=_[_0xa068('0x62')](_[_0xa068('0x34')](_0x46c46f),_['map'](_0x1c3561[_0xa068('0x63')],function(_0x4bdbc2){return util[_0xa068('0x64')](_0xa068('0x65'),_0x4bdbc2['id']);}));_0x438ba1[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4d0e20[_0xa068('0x33')]);_0x438ba1[_0xa068('0x35')]=_[_0xa068('0x36')](_0x438ba1['model'],_0x438ba1[_0xa068('0x33')]);_0x5bdda2[_0xa068('0x37')]=_[_0xa068('0x36')](_0x438ba1['model'],qs[_0xa068('0x38')](_0x4d0e20['query']['fields']));_0x5bdda2[_0xa068('0x37')]=_0x5bdda2[_0xa068('0x37')][_0xa068('0x39')]?_0x5bdda2['attributes']:_0x438ba1[_0xa068('0x31')];if(!_0x4d0e20[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0x5bdda2['limit']=qs[_0xa068('0x21')](_0x4d0e20[_0xa068('0x33')][_0xa068('0x21')]);_0x5bdda2['offset']=qs['offset'](_0x4d0e20[_0xa068('0x33')][_0xa068('0x20')]);}_0x5bdda2[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x4d0e20['query']['sort']);_0x5bdda2['where']=qs[_0xa068('0x35')](_['pick'](_0x4d0e20[_0xa068('0x33')],_0x438ba1[_0xa068('0x35')]));_0x5bdda2[_0xa068('0x66')]=!![];if(_0x4d0e20['query'][_0xa068('0x3f')]){_0x5bdda2[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x5bdda2[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x5bdda2[_0xa068('0x37')],function(_0x43eaaf){var _0x354207={};_0x354207[_0x43eaaf]={'$like':'%'+_0x4d0e20[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x354207;})});}_0x5bdda2=_[_0xa068('0x40')]({},_0x5bdda2,_0x4d0e20[_0xa068('0x42')]);return _0x1c3561[_0xa068('0x60')](_0x5bdda2);}})[_0xa068('0x28')](respondWithResult(_0x171edc,null))['catch'](handleError(_0x171edc,null));};exports[_0xa068('0x67')]=function(_0x10108b,_0xfc19cc,_0x16156a){var _0x216920;var _0x15a8d8;var _0x4ba2ad;var _0x485e8b=_0x10108b[_0xa068('0x48')]['id'];csv_results=[];return db[_0xa068('0x68')][_0xa068('0x52')]({'attributes':['id',_0xa068('0x2c')],'raw':!![],'order':[_0xa068('0x69')]})[_0xa068('0x28')](function(_0x4934cc){_0x216920=_0x4934cc;var _0x2ee78a=_[_0xa068('0x34')](db[_0xa068('0x5a')]['rawAttributes']);return db['CmCustomField'][_0xa068('0x52')]({'raw':!![],'attributes':['id','alias']})[_0xa068('0x28')](function(_0x2fcfc2){_0x15a8d8=_0x2fcfc2;var _0xb259bd=squel['select']()['fields'](_0x2ee78a)[_0xa068('0x6a')](_0xa068('0x6b'),'c')[_0xa068('0x3e')]('c.ListId\x20=\x20?',_0x485e8b)[_0xa068('0x3e')](_0xa068('0x6c'))[_0xa068('0x6d')]();for(var _0x1ae4a0=0x0;_0x1ae4a0<_0x15a8d8[_0xa068('0x39')];_0x1ae4a0++){_0xb259bd[_0xa068('0x6e')](_0xa068('0x6f')+_0x15a8d8[_0x1ae4a0]['id'],'customField_'+_0x15a8d8[_0x1ae4a0][_0xa068('0x70')]);}for(var _0x1ae4a0=0x0;_0x1ae4a0<_0x216920[_0xa068('0x39')];_0x1ae4a0++){_0xb259bd['field'](squel[_0xa068('0x71')]()['field'](_0xa068('0x72'))[_0xa068('0x6a')](_0xa068('0x73'))[_0xa068('0x3e')](_0xa068('0x74'),_0x216920[_0x1ae4a0]['id'])[_0xa068('0x3e')](_0xa068('0x75')),_0xa068('0x76')+_0x216920[_0x1ae4a0]['name']);_0xb259bd[_0xa068('0x6e')](squel['select']()[_0xa068('0x6e')](_0xa068('0x77'))[_0xa068('0x6a')]('cm_contact_has_items')[_0xa068('0x3e')](_0xa068('0x74'),_0x216920[_0x1ae4a0]['id'])[_0xa068('0x3e')](_0xa068('0x75')),'description_additionalPhone_'+_0x216920[_0x1ae4a0][_0xa068('0x2c')]);}var _0x4897ba=[];_0x4897ba[_0xa068('0x58')](_0xb259bd['toString']());BPromise[_0xa068('0x59')](_0x4897ba,handleQuery)[_0xa068('0x28')](function(_0x1344b3){handleQuery(_0xb259bd[_0xa068('0x78')]());var _0x4d4555=csv_results[0x0];if(!_[_0xa068('0x79')](_0x4d4555)){var _0x20213f=toCsv(_0x4d4555);var _0x2dcded=Date['now']();fs[_0xa068('0x7a')](util[_0xa068('0x64')]('/tmp/list_%d_%s.csv',_0x485e8b,_0x2dcded),_0x20213f);_0xfc19cc[_0xa068('0x7b')](_0xa068('0x7c'),_0xa068('0x7d')+util[_0xa068('0x64')](_0xa068('0x7e'),_0x485e8b,_0x2dcded));_0xfc19cc['setHeader'](_0xa068('0x7f'),_0xa068('0x80'));return _0xfc19cc[_0xa068('0x81')](util[_0xa068('0x64')](_0xa068('0x82'),_0x485e8b,_0x2dcded));}else{return _0xfc19cc[_0xa068('0x1a')](0xcc);}});});});};exports[_0xa068('0x83')]=function(_0x19be94,_0x33390e,_0x3134cf){var _0x29acc6;delete _0x19be94['body']['id'];return db[_0xa068('0x43')]['findOne']({'where':{'id':_0x19be94['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x33390e,null))[_0xa068('0x28')](function(_0x23049b){if(_0x23049b){return db[_0xa068('0x84')][_0xa068('0x85')](function(_0x5adc3e){return db['CmCustomField'][_0xa068('0x4a')](_0x19be94['body'],{'transaction':_0x5adc3e})[_0xa068('0x28')](function(_0x25211b){_0x29acc6=_0x25211b;return _0x23049b[_0xa068('0x86')](_0x25211b,{'transaction':_0x5adc3e});})[_0xa068('0x28')](function(){var _0x5a2053={'type':db['Sequelize']['TEXT'],'transaction':_0x5adc3e};switch(_0x19be94[_0xa068('0x4b')]['type']){case'text':_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['TEXT'];break;case _0xa068('0x89'):_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['INTEGER'];break;case _0xa068('0x8a'):_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['BOOLEAN'];_0x5a2053[_0xa068('0x8b')]=![];break;default:}return db['sequelize'][_0xa068('0x8c')]['addColumn'](_0xa068('0x6b'),util[_0xa068('0x64')](_0xa068('0x8d'),_0x29acc6['id']),_0x5a2053);})[_0xa068('0x28')](function(){return _0x29acc6;});});}})['then'](respondWithResult(_0x33390e,null))[_0xa068('0x47')](handleError(_0x33390e,null));};exports[_0xa068('0x8e')]=function(_0x4ef31a,_0x3f720d,_0x5ce406){var _0x4d5c22={};var _0x123bbb={};var _0x26a83d;var _0x38b220;return db[_0xa068('0x43')][_0xa068('0x8f')]({'where':{'id':_0x4ef31a[_0xa068('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f720d,null))[_0xa068('0x28')](function(_0x26466f){if(_0x26466f){_0x26a83d=_0x26466f;_0x123bbb['model']=_['keys'](db[_0xa068('0x61')][_0xa068('0x2e')]);_0x123bbb[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4ef31a[_0xa068('0x33')]);_0x123bbb[_0xa068('0x35')]=_[_0xa068('0x36')](_0x123bbb[_0xa068('0x31')],_0x123bbb['query']);_0x4d5c22[_0xa068('0x37')]=_[_0xa068('0x36')](_0x123bbb[_0xa068('0x31')],qs[_0xa068('0x38')](_0x4ef31a[_0xa068('0x33')][_0xa068('0x38')]));_0x4d5c22[_0xa068('0x37')]=_0x4d5c22[_0xa068('0x37')][_0xa068('0x39')]?_0x4d5c22[_0xa068('0x37')]:_0x123bbb[_0xa068('0x31')];_0x4d5c22[_0xa068('0x3c')]=qs['sort'](_0x4ef31a['query']['sort']);_0x4d5c22[_0xa068('0x3e')]=qs[_0xa068('0x35')](_[_0xa068('0x50')](_0x4ef31a['query'],_0x123bbb[_0xa068('0x35')]));_0x4d5c22['where']=_[_0xa068('0x40')](_0x4d5c22[_0xa068('0x3e')],{'$or':[{'ListId':_0x26466f['id']},{'ListId':null}]});if(_0x4ef31a[_0xa068('0x33')][_0xa068('0x3f')]){_0x4d5c22[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x4d5c22[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x4d5c22[_0xa068('0x37')],function(_0x37c22e){var _0x12e35a={};_0x12e35a[_0x37c22e]={'$like':'%'+_0x4ef31a[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x12e35a;})});}_0x4d5c22=_['merge']({},_0x4d5c22,_0x4ef31a[_0xa068('0x42')]);return db[_0xa068('0x61')][_0xa068('0x90')](_0x4d5c22);}})['then'](respondWithResult(_0x3f720d,null))['catch'](handleError(_0x3f720d,null));};exports[_0xa068('0x91')]=function(_0xaf9f6a,_0x449ef9){return db[_0xa068('0x61')]['findAndCountAll']({'where':{'ListId':null}})[_0xa068('0x28')](handleEntityNotFound(_0x449ef9,null))[_0xa068('0x28')](function(_0x56cdb4){return _0x56cdb4;})[_0xa068('0x28')](respondWithResult(_0x449ef9,null))['catch'](handleError(_0x449ef9,null));};exports[_0xa068('0x92')]=function(_0x5834f5,_0x2a88e5,_0xafa3c9){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x5834f5['params']['id']}})['then'](handleEntityNotFound(_0x2a88e5,null))[_0xa068('0x28')](function(_0xa3485f){if(_0xa3485f){return _0xa3485f[_0xa068('0x92')](_0x5834f5[_0xa068('0x4b')][_0xa068('0x54')],_[_0xa068('0x5b')](_0x5834f5[_0xa068('0x4b')],[_0xa068('0x54'),'id'])||{})[_0xa068('0x93')](function(_0x37ea85){for(var _0x4e9fc2=0x0;_0x4e9fc2<_0x5834f5['body']['ids'][_0xa068('0x39')];_0x4e9fc2+=0x1){socket[_0xa068('0x94')](_0xa068('0x95'),{'UserId':Number(_0x5834f5[_0xa068('0x4b')][_0xa068('0x54')][_0x4e9fc2]),'CmListId':Number(_0x5834f5[_0xa068('0x48')]['id'])});}return _0x37ea85;});}})[_0xa068('0x28')](respondWithResult(_0x2a88e5,null))[_0xa068('0x47')](handleError(_0x2a88e5,null));};exports['removeAgents']=function(_0x34dd87,_0x5d84c0,_0x15f1c0){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x34dd87['params']['id']}})['then'](handleEntityNotFound(_0x5d84c0,null))[_0xa068('0x28')](function(_0x4341a6){if(_0x4341a6){return _0x4341a6['removeAgents'](_0x34dd87[_0xa068('0x33')]['ids'])[_0xa068('0x28')](function(){if(_[_0xa068('0x56')](_0x34dd87[_0xa068('0x33')][_0xa068('0x54')])){for(var _0x5d0c28=0x0;_0x5d0c28<_0x34dd87[_0xa068('0x33')]['ids']['length'];_0x5d0c28+=0x1){socket[_0xa068('0x94')]('userCmList:remove',{'UserId':Number(_0x34dd87[_0xa068('0x33')][_0xa068('0x54')][_0x5d0c28]),'CmListId':Number(_0x34dd87[_0xa068('0x48')]['id'])});}}else{socket[_0xa068('0x94')](_0xa068('0x96'),{'UserId':Number(_0x34dd87[_0xa068('0x33')][_0xa068('0x54')]),'CmListId':Number(_0x34dd87['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5d84c0,null))[_0xa068('0x47')](handleError(_0x5d84c0,null));};exports['getAgents']=function(_0x2e3476,_0x9b51f4,_0x35ed5f){var _0x1a30ab={};var _0x3ff76d={};var _0x11c183;var _0x18d107;return db[_0xa068('0x43')][_0xa068('0x8f')]({'where':{'id':_0x2e3476['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x9b51f4,null))['then'](function(_0x45f0f0){if(_0x45f0f0){_0x11c183=_0x45f0f0;_0x3ff76d[_0xa068('0x31')]=_['keys'](db[_0xa068('0x97')]['rawAttributes']);_0x3ff76d[_0xa068('0x33')]=_[_0xa068('0x34')](_0x2e3476[_0xa068('0x33')]);_0x3ff76d[_0xa068('0x35')]=_[_0xa068('0x36')](_0x3ff76d[_0xa068('0x31')],_0x3ff76d[_0xa068('0x33')]);_0x1a30ab['attributes']=_['intersection'](_0x3ff76d[_0xa068('0x31')],qs['fields'](_0x2e3476[_0xa068('0x33')][_0xa068('0x38')]));_0x1a30ab['attributes']=_0x1a30ab[_0xa068('0x37')][_0xa068('0x39')]?_0x1a30ab[_0xa068('0x37')]:_0x3ff76d[_0xa068('0x31')];_0x1a30ab[_0xa068('0x3c')]=qs['sort'](_0x2e3476[_0xa068('0x33')][_0xa068('0x3d')]);_0x1a30ab[_0xa068('0x3e')]=qs[_0xa068('0x35')](_['pick'](_0x2e3476[_0xa068('0x33')],_0x3ff76d[_0xa068('0x35')]));if(_0x2e3476[_0xa068('0x33')][_0xa068('0x3f')]){_0x1a30ab['where']=_[_0xa068('0x40')](_0x1a30ab[_0xa068('0x3e')],{'$or':_['map'](_0x1a30ab[_0xa068('0x37')],function(_0x1029e7){var _0x43062e={};_0x43062e[_0x1029e7]={'$like':'%'+_0x2e3476[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x43062e;})});}_0x1a30ab=_['merge']({},_0x1a30ab,_0x2e3476['options']);return _0x11c183[_0xa068('0x98')](_0x1a30ab);}})[_0xa068('0x28')](function(_0x145a4d){if(_0x145a4d){_0x18d107=_0x145a4d[_0xa068('0x39')];if(!_0x2e3476[_0xa068('0x33')][_0xa068('0x3a')]('nolimit')){_0x1a30ab[_0xa068('0x21')]=qs[_0xa068('0x21')](_0x2e3476[_0xa068('0x33')][_0xa068('0x21')]);_0x1a30ab[_0xa068('0x20')]=qs[_0xa068('0x20')](_0x2e3476[_0xa068('0x33')][_0xa068('0x20')]);}return _0x11c183[_0xa068('0x98')](_0x1a30ab);}})[_0xa068('0x28')](function(_0x5c35ba){if(_0x5c35ba){return _0x5c35ba?{'count':_0x18d107,'rows':_0x5c35ba}:null;}})[_0xa068('0x28')](respondWithResult(_0x9b51f4,null))[_0xa068('0x47')](handleError(_0x9b51f4,null));};function handleQuery(_0x23b913){logger[_0xa068('0x99')](_0x23b913);return db[_0xa068('0x84')][_0xa068('0x33')](_0x23b913)[_0xa068('0x93')](function(_0x22e141){csv_results[_0xa068('0x58')](_0x22e141);})[_0xa068('0x47')](function(_0x3d8ad6){logger[_0xa068('0x4d')](_0x3d8ad6[_0xa068('0x5e')]);});} \ No newline at end of file +var _0x7aef=['omit','emit','userCmList:save','removeAgents','userCmList:remove','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Lists','sendStatus','stack','name','map','CmList','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','find','create','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addContacts','tags','isArray','join','push','each','CmContact','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','cf_%d','raw','ContactItemType','OrderBy','CmCustomField','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','from','description_additionalPhone_','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x7aef,0x149));var _0xf7ae=function(_0x4a4086,_0x4545d3){_0x4a4086=_0x4a4086-0x0;var _0xeb9ace=_0x7aef[_0x4a4086];return _0xeb9ace;};'use strict';var emlformat=require(_0xf7ae('0x0'));var rimraf=require(_0xf7ae('0x1'));var zipdir=require(_0xf7ae('0x2'));var jsonpatch=require(_0xf7ae('0x3'));var rp=require('request-promise');var moment=require(_0xf7ae('0x4'));var BPromise=require(_0xf7ae('0x5'));var Mustache=require(_0xf7ae('0x6'));var util=require(_0xf7ae('0x7'));var path=require(_0xf7ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7ae('0x9'));var fs=require('fs');var fs_extra=require(_0xf7ae('0xa'));var _=require(_0xf7ae('0xb'));var squel=require(_0xf7ae('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7ae('0xd'));var deskjs=require(_0xf7ae('0xe'));var toCsv=require(_0xf7ae('0xf'));var querystring=require(_0xf7ae('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7ae('0x11'));var qs=require(_0xf7ae('0x12'));var as=require(_0xf7ae('0x13'));var hardwareService=require(_0xf7ae('0x14'));var logger=require('../../config/logger')(_0xf7ae('0x15'));var utils=require(_0xf7ae('0x16'));var config=require(_0xf7ae('0x17'));var licenseUtil=require(_0xf7ae('0x18'));var db=require(_0xf7ae('0x19'))['db'];var csv_results;config[_0xf7ae('0x1a')]=_[_0xf7ae('0x1b')](config[_0xf7ae('0x1a')],{'host':_0xf7ae('0x1c'),'port':0x18eb});var socket=require(_0xf7ae('0x1d'))(new Redis(config[_0xf7ae('0x1a')]));require('./cmList.socket')[_0xf7ae('0x1e')](socket);function respondWithStatusCode(_0x23c179,_0x58c139){_0x58c139=_0x58c139||0xcc;return function(_0x301f72){if(_0x301f72){return _0x23c179['sendStatus'](_0x58c139);}return _0x23c179[_0xf7ae('0x1f')](_0x58c139)[_0xf7ae('0x20')]();};}function respondWithResult(_0x4ab32d,_0x726eed){_0x726eed=_0x726eed||0xc8;return function(_0x51b2ba){if(_0x51b2ba){return _0x4ab32d[_0xf7ae('0x1f')](_0x726eed)[_0xf7ae('0x21')](_0x51b2ba);}};}function respondWithFilteredResult(_0x297d40,_0x3f94ad){return function(_0x205fc5){if(_0x205fc5){var _0x5d9b69=typeof _0x3f94ad[_0xf7ae('0x22')]===_0xf7ae('0x23')&&typeof _0x3f94ad['limit']===_0xf7ae('0x23');var _0x35124c=_0x205fc5[_0xf7ae('0x24')];var _0x30f1ac=_0x5d9b69?0x0:_0x3f94ad['offset'];var _0x3df9eb=_0x5d9b69?_0x205fc5[_0xf7ae('0x24')]:_0x3f94ad[_0xf7ae('0x22')]+_0x3f94ad[_0xf7ae('0x25')];var _0x2af5ac;if(_0x3df9eb>=_0x35124c){_0x3df9eb=_0x35124c;_0x2af5ac=0xc8;}else{_0x2af5ac=0xce;}_0x297d40[_0xf7ae('0x1f')](_0x2af5ac);return _0x297d40[_0xf7ae('0x26')](_0xf7ae('0x27'),_0x30f1ac+'-'+_0x3df9eb+'/'+_0x35124c)[_0xf7ae('0x21')](_0x205fc5);}return null;};}function patchUpdates(_0x713620){return function(_0x3eb260){try{jsonpatch[_0xf7ae('0x28')](_0x3eb260,_0x713620,!![]);}catch(_0xc91d9d){return BPromise[_0xf7ae('0x29')](_0xc91d9d);}return _0x3eb260[_0xf7ae('0x2a')]();};}function saveUpdates(_0x41ece1,_0x25e549){return function(_0x194e99){if(_0x194e99){return _0x194e99[_0xf7ae('0x2b')](_0x41ece1)[_0xf7ae('0x2c')](function(_0x40a7f2){return _0x40a7f2;});}return null;};}function removeEntity(_0x173879,_0x3b94d1){return function(_0x5bf947){if(_0x5bf947){return _0x5bf947['destroy']()[_0xf7ae('0x2c')](function(){var _0x17a2e3=_0x5bf947[_0xf7ae('0x2d')]({'plain':!![]});var _0x183731=_0xf7ae('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x183731,'resourceId':_0x17a2e3['id']}})[_0xf7ae('0x2c')](function(){return _0x5bf947;});})[_0xf7ae('0x2c')](function(){_0x173879['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa946,_0x31a651){return function(_0x11f7f5){if(!_0x11f7f5){_0x3aa946[_0xf7ae('0x2f')](0x194);}return _0x11f7f5;};}function handleError(_0x1a65b1,_0x5b3e46){_0x5b3e46=_0x5b3e46||0x1f4;return function(_0x3a96aa){logger['error'](_0x3a96aa[_0xf7ae('0x30')]);if(_0x3a96aa[_0xf7ae('0x31')]){delete _0x3a96aa[_0xf7ae('0x31')];}_0x1a65b1[_0xf7ae('0x1f')](_0x5b3e46)['send'](_0x3a96aa);};}exports['index']=function(_0x2164e2,_0x4ef57c){var _0x5598e6={},_0x88e5bc={},_0x2b4f66={'count':0x0,'rows':[]};var _0x42b767=_[_0xf7ae('0x32')](db[_0xf7ae('0x33')]['rawAttributes'],function(_0x36d696){return{'name':_0x36d696['fieldName'],'type':_0x36d696[_0xf7ae('0x34')][_0xf7ae('0x35')]};});_0x88e5bc[_0xf7ae('0x36')]=_['map'](_0x42b767,_0xf7ae('0x31'));_0x88e5bc[_0xf7ae('0x37')]=_[_0xf7ae('0x38')](_0x2164e2[_0xf7ae('0x37')]);_0x88e5bc[_0xf7ae('0x39')]=_['intersection'](_0x88e5bc[_0xf7ae('0x36')],_0x88e5bc[_0xf7ae('0x37')]);_0x5598e6['attributes']=_['intersection'](_0x88e5bc[_0xf7ae('0x36')],qs[_0xf7ae('0x3a')](_0x2164e2[_0xf7ae('0x37')][_0xf7ae('0x3a')]));_0x5598e6[_0xf7ae('0x3b')]=_0x5598e6[_0xf7ae('0x3b')][_0xf7ae('0x3c')]?_0x5598e6[_0xf7ae('0x3b')]:_0x88e5bc[_0xf7ae('0x36')];if(!_0x2164e2['query']['hasOwnProperty'](_0xf7ae('0x3d'))){_0x5598e6['limit']=qs[_0xf7ae('0x25')](_0x2164e2[_0xf7ae('0x37')]['limit']);_0x5598e6['offset']=qs['offset'](_0x2164e2[_0xf7ae('0x37')][_0xf7ae('0x22')]);}_0x5598e6[_0xf7ae('0x3e')]=qs['sort'](_0x2164e2[_0xf7ae('0x37')][_0xf7ae('0x3f')]);_0x5598e6[_0xf7ae('0x40')]=qs[_0xf7ae('0x39')](_['pick'](_0x2164e2[_0xf7ae('0x37')],_0x88e5bc[_0xf7ae('0x39')]),_0x42b767);if(_0x2164e2[_0xf7ae('0x37')][_0xf7ae('0x41')]){_0x5598e6[_0xf7ae('0x40')]=_[_0xf7ae('0x42')](_0x5598e6[_0xf7ae('0x40')],{'$or':_['map'](_0x42b767,function(_0x51aa05){if(_0x51aa05[_0xf7ae('0x34')]!==_0xf7ae('0x43')){var _0x4163f0={};_0x4163f0[_0x51aa05['name']]={'$like':'%'+_0x2164e2[_0xf7ae('0x37')][_0xf7ae('0x41')]+'%'};return _0x4163f0;}})});}_0x5598e6=_[_0xf7ae('0x42')]({},_0x5598e6,_0x2164e2[_0xf7ae('0x44')]);var _0x1f0c8a={'where':_0x5598e6['where']};return db[_0xf7ae('0x33')][_0xf7ae('0x24')](_0x1f0c8a)[_0xf7ae('0x2c')](function(_0x221264){_0x2b4f66['count']=_0x221264;if(_0x2164e2[_0xf7ae('0x37')]['includeAll']){_0x5598e6[_0xf7ae('0x45')]=[{'all':!![]}];}return db['CmList'][_0xf7ae('0x46')](_0x5598e6);})[_0xf7ae('0x2c')](function(_0x392b88){_0x2b4f66[_0xf7ae('0x47')]=_0x392b88;return _0x2b4f66;})[_0xf7ae('0x2c')](respondWithFilteredResult(_0x4ef57c,_0x5598e6))[_0xf7ae('0x48')](handleError(_0x4ef57c,null));};exports[_0xf7ae('0x49')]=function(_0x69ca05,_0x1b723a){var _0x18baaf={'raw':![],'where':{'id':_0x69ca05['params']['id']}},_0xbcdc0c={};_0xbcdc0c[_0xf7ae('0x36')]=_[_0xf7ae('0x38')](db[_0xf7ae('0x33')][_0xf7ae('0x4a')]);_0xbcdc0c['query']=_['keys'](_0x69ca05[_0xf7ae('0x37')]);_0xbcdc0c['filters']=_[_0xf7ae('0x4b')](_0xbcdc0c[_0xf7ae('0x36')],_0xbcdc0c[_0xf7ae('0x37')]);_0x18baaf[_0xf7ae('0x3b')]=_['intersection'](_0xbcdc0c[_0xf7ae('0x36')],qs[_0xf7ae('0x3a')](_0x69ca05[_0xf7ae('0x37')][_0xf7ae('0x3a')]));_0x18baaf[_0xf7ae('0x3b')]=_0x18baaf[_0xf7ae('0x3b')][_0xf7ae('0x3c')]?_0x18baaf[_0xf7ae('0x3b')]:_0xbcdc0c[_0xf7ae('0x36')];if(_0x69ca05[_0xf7ae('0x37')][_0xf7ae('0x4c')]){_0x18baaf[_0xf7ae('0x45')]=[{'all':!![]}];}_0x18baaf=_[_0xf7ae('0x42')]({},_0x18baaf,_0x69ca05[_0xf7ae('0x44')]);return db['CmList'][_0xf7ae('0x4d')](_0x18baaf)[_0xf7ae('0x2c')](handleEntityNotFound(_0x1b723a,null))[_0xf7ae('0x2c')](respondWithResult(_0x1b723a,null))[_0xf7ae('0x48')](handleError(_0x1b723a,null));};exports[_0xf7ae('0x4e')]=function(_0x2b211e,_0x29fb73){return db[_0xf7ae('0x33')][_0xf7ae('0x4e')](_0x2b211e['body'],{})[_0xf7ae('0x2c')](function(_0x8f473c){var _0x530519=_0x2b211e['user'][_0xf7ae('0x2d')]({'plain':!![]});if(!_0x530519)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x530519[_0xf7ae('0x4f')]==='user'){var _0x1cb31e=_0x8f473c[_0xf7ae('0x2d')]({'plain':!![]});var _0x377a13='Lists';return db[_0xf7ae('0x50')][_0xf7ae('0x4d')]({'where':{'name':_0x377a13,'userProfileId':_0x530519[_0xf7ae('0x51')]},'raw':!![]})[_0xf7ae('0x2c')](function(_0x439d50){if(_0x439d50&&_0x439d50[_0xf7ae('0x52')]===0x0){return db['UserProfileResource'][_0xf7ae('0x4e')]({'name':_0x1cb31e[_0xf7ae('0x31')],'resourceId':_0x1cb31e['id'],'type':_0x439d50[_0xf7ae('0x31')],'sectionId':_0x439d50['id']},{})[_0xf7ae('0x2c')](function(){return _0x8f473c;});}else{return _0x8f473c;}})['catch'](function(_0x49c171){logger[_0xf7ae('0x53')](_0xf7ae('0x54'),_0x49c171);throw _0x49c171;});}return _0x8f473c;})['then'](respondWithResult(_0x29fb73,0xc9))[_0xf7ae('0x48')](handleError(_0x29fb73,null));};exports[_0xf7ae('0x2b')]=function(_0x24a5c8,_0x8b9922){if(_0x24a5c8['body']['id']){delete _0x24a5c8[_0xf7ae('0x55')]['id'];}return db['CmList'][_0xf7ae('0x4d')]({'where':{'id':_0x24a5c8[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x8b9922,null))[_0xf7ae('0x2c')](saveUpdates(_0x24a5c8[_0xf7ae('0x55')],null))[_0xf7ae('0x2c')](respondWithResult(_0x8b9922,null))[_0xf7ae('0x48')](handleError(_0x8b9922,null));};exports[_0xf7ae('0x57')]=function(_0x2deeae,_0x4d75e2){return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x2deeae[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x4d75e2,null))['then'](removeEntity(_0x4d75e2,null))[_0xf7ae('0x48')](handleError(_0x4d75e2,null));};exports['describe']=function(_0x329aa2,_0xb5ee95){return db[_0xf7ae('0x33')][_0xf7ae('0x58')]()[_0xf7ae('0x2c')](respondWithResult(_0xb5ee95,null))['catch'](handleError(_0xb5ee95,null));};exports[_0xf7ae('0x59')]=function(_0x25f7d2,_0x5f2d85,_0x1844f1){if(_0x25f7d2['body']['id']){delete _0x25f7d2[_0xf7ae('0x55')]['id'];}return db[_0xf7ae('0x33')]['find']({'where':{'id':_0x25f7d2[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x5f2d85,null))[_0xf7ae('0x2c')](function(_0x49429c){if(_0x49429c){_0x25f7d2['body'][_0xf7ae('0x5a')]=_0x49429c['id'];return db[_0xf7ae('0x5b')][_0xf7ae('0x4e')](_0x25f7d2['body']);}})[_0xf7ae('0x2c')](respondWithResult(_0x5f2d85,null))[_0xf7ae('0x48')](handleError(_0x5f2d85,null));};exports['getDispositions']=function(_0x245485,_0x57085b,_0xa14c6e){var _0x4e99b8={'raw':![],'where':{}};var _0x3f9ec8={};var _0x2ac850={'count':0x0,'rows':[]};return db[_0xf7ae('0x33')][_0xf7ae('0x5c')]({'where':{'id':_0x245485['params']['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x57085b,null))[_0xf7ae('0x2c')](function(_0x240af4){if(_0x240af4){_0x3f9ec8[_0xf7ae('0x36')]=_['keys'](db[_0xf7ae('0x5b')][_0xf7ae('0x4a')]);_0x3f9ec8[_0xf7ae('0x37')]=_[_0xf7ae('0x38')](_0x245485['query']);_0x3f9ec8[_0xf7ae('0x39')]=_[_0xf7ae('0x4b')](_0x3f9ec8[_0xf7ae('0x36')],_0x3f9ec8['query']);_0x4e99b8[_0xf7ae('0x3b')]=_['intersection'](_0x3f9ec8[_0xf7ae('0x36')],qs['fields'](_0x245485[_0xf7ae('0x37')][_0xf7ae('0x3a')]));_0x4e99b8[_0xf7ae('0x3b')]=_0x4e99b8[_0xf7ae('0x3b')][_0xf7ae('0x3c')]?_0x4e99b8[_0xf7ae('0x3b')]:_0x3f9ec8[_0xf7ae('0x36')];if(!_0x245485[_0xf7ae('0x37')][_0xf7ae('0x5d')]('nolimit')){_0x4e99b8[_0xf7ae('0x25')]=qs[_0xf7ae('0x25')](_0x245485[_0xf7ae('0x37')]['limit']);_0x4e99b8['offset']=qs['offset'](_0x245485[_0xf7ae('0x37')][_0xf7ae('0x22')]);}_0x4e99b8[_0xf7ae('0x3e')]=qs[_0xf7ae('0x3f')](_0x245485[_0xf7ae('0x37')][_0xf7ae('0x3f')]);_0x4e99b8[_0xf7ae('0x40')]=qs[_0xf7ae('0x39')](_['pick'](_0x245485[_0xf7ae('0x37')],_0x3f9ec8[_0xf7ae('0x39')]));_0x4e99b8[_0xf7ae('0x40')][_0xf7ae('0x5a')]=_0x240af4['id'];if(_0x245485[_0xf7ae('0x37')][_0xf7ae('0x41')]){_0x4e99b8[_0xf7ae('0x40')]=_[_0xf7ae('0x42')](_0x4e99b8[_0xf7ae('0x40')],{'$or':_['map'](_0x4e99b8['attributes'],function(_0x1a447e){var _0x4e0c5b={};_0x4e0c5b[_0x1a447e]={'$like':'%'+_0x245485['query'][_0xf7ae('0x41')]+'%'};return _0x4e0c5b;})});}_0x4e99b8=_[_0xf7ae('0x42')]({},_0x4e99b8,_0x245485[_0xf7ae('0x44')]);return db[_0xf7ae('0x5b')]['count']({'where':_0x4e99b8[_0xf7ae('0x40')]})[_0xf7ae('0x2c')](function(_0x55de88){_0x2ac850[_0xf7ae('0x24')]=_0x55de88;if(_0x245485['query'][_0xf7ae('0x4c')]){_0x4e99b8['include']=[{'all':!![]}];}return db[_0xf7ae('0x5b')][_0xf7ae('0x46')](_0x4e99b8);})[_0xf7ae('0x2c')](function(_0x21608e){_0x2ac850[_0xf7ae('0x47')]=_0x21608e;return _0x2ac850;});}})[_0xf7ae('0x2c')](respondWithFilteredResult(_0x57085b,_0x4e99b8))[_0xf7ae('0x48')](handleError(_0x57085b,null));};exports[_0xf7ae('0x5e')]=function(_0x2d1ce5,_0x148f21,_0x5bfcdb){return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x2d1ce5['params']['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x148f21,null))['then'](function(_0x15456e){if(_0x15456e){return _0x15456e[_0xf7ae('0x5e')](_0x2d1ce5['query'][_0xf7ae('0x5f')]);}})[_0xf7ae('0x2c')](respondWithStatusCode(_0x148f21,null))['catch'](handleError(_0x148f21,null));};exports[_0xf7ae('0x60')]=function(_0x59b568,_0x5d4a01,_0x1f7642){return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x59b568[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x5d4a01,null))['then'](function(_0x20ce7d){if(_0x20ce7d){var _0x34b3fe=[];var _0x28705e={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xf7ae('0x2c')](function(_0x1232ec){if(_0x59b568['body'][_0xf7ae('0x61')]&&_[_0xf7ae('0x62')](_0x59b568[_0xf7ae('0x55')][_0xf7ae('0x61')])){if(_0x59b568['body']['tags'][_0xf7ae('0x3c')]){_0x59b568[_0xf7ae('0x55')][_0xf7ae('0x61')]=_0x59b568[_0xf7ae('0x55')][_0xf7ae('0x61')][_0xf7ae('0x63')](';')+';';}else{_0x59b568[_0xf7ae('0x55')][_0xf7ae('0x61')]=null;}}else{_0x59b568['body'][_0xf7ae('0x61')]=null;}if(_0x59b568['body']&&_[_0xf7ae('0x62')](_0x59b568[_0xf7ae('0x55')])){for(var _0x106653=0x0;_0x106653<_0x59b568[_0xf7ae('0x55')]['length'];_0x106653+=0x1){_0x59b568[_0xf7ae('0x55')][_0x106653][_0xf7ae('0x5a')]=_0x59b568['params']['id'];_0x34b3fe[_0xf7ae('0x64')](_0x59b568[_0xf7ae('0x55')][_0x106653]);}return BPromise[_0xf7ae('0x65')](_0x34b3fe,function(_0x16a9f2){return db[_0xf7ae('0x66')][_0xf7ae('0x4e')](_['omit'](_0x16a9f2,[_0xf7ae('0x5f'),'id'])||{},{'fields':_[_0xf7ae('0x38')](_0x1232ec),'raw':!![]})[_0xf7ae('0x2c')](function(_0x3f9afb){_0x28705e[_0xf7ae('0x67')]['push'](_0x3f9afb[_0xf7ae('0x68')]);})[_0xf7ae('0x48')](function(_0x1a6fb5){_0x28705e['errors'][_0xf7ae('0x64')]({'data':_0x16a9f2,'error':_0x1a6fb5[_0xf7ae('0x69')]});});})[_0xf7ae('0x2c')](function(_0x23c4e5){return _0x28705e;})['catch'](function(_0x55be99){return _0x55be99;});}else{_0x5d4a01[_0xf7ae('0x1f')](0x190)['json']({'message':_0xf7ae('0x6a')});}});}})[_0xf7ae('0x2c')](respondWithResult(_0x5d4a01,null))[_0xf7ae('0x48')](handleError(_0x5d4a01,null));};exports[_0xf7ae('0x6b')]=function(_0x4a27e6,_0x35602e,_0x30e226){var _0x4c3f78;return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x4a27e6[_0xf7ae('0x56')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xf7ae('0x6c')}]})[_0xf7ae('0x2c')](handleEntityNotFound(_0x35602e,null))[_0xf7ae('0x2c')](function(_0x5d9cb0){if(_0x5d9cb0){_0x4c3f78=_0x5d9cb0;return db[_0xf7ae('0x66')][_0xf7ae('0x4a')];}})['then'](function(_0x2038b4){if(_0x2038b4){var _0x4718b6={};var _0x9993f2={};_0x9993f2['model']=_['concat'](_['keys'](_0x2038b4),_['map'](_0x4c3f78[_0xf7ae('0x6c')],function(_0x1a55f8){return util['format'](_0xf7ae('0x6d'),_0x1a55f8['id']);}));_0x9993f2[_0xf7ae('0x37')]=_[_0xf7ae('0x38')](_0x4a27e6[_0xf7ae('0x37')]);_0x9993f2[_0xf7ae('0x39')]=_[_0xf7ae('0x4b')](_0x9993f2[_0xf7ae('0x36')],_0x9993f2[_0xf7ae('0x37')]);_0x4718b6[_0xf7ae('0x3b')]=_[_0xf7ae('0x4b')](_0x9993f2[_0xf7ae('0x36')],qs['fields'](_0x4a27e6['query']['fields']));_0x4718b6[_0xf7ae('0x3b')]=_0x4718b6[_0xf7ae('0x3b')]['length']?_0x4718b6['attributes']:_0x9993f2['model'];if(!_0x4a27e6[_0xf7ae('0x37')][_0xf7ae('0x5d')](_0xf7ae('0x3d'))){_0x4718b6[_0xf7ae('0x25')]=qs[_0xf7ae('0x25')](_0x4a27e6[_0xf7ae('0x37')][_0xf7ae('0x25')]);_0x4718b6[_0xf7ae('0x22')]=qs[_0xf7ae('0x22')](_0x4a27e6['query'][_0xf7ae('0x22')]);}_0x4718b6[_0xf7ae('0x3e')]=qs[_0xf7ae('0x3f')](_0x4a27e6['query']['sort']);_0x4718b6['where']=qs[_0xf7ae('0x39')](_['pick'](_0x4a27e6[_0xf7ae('0x37')],_0x9993f2[_0xf7ae('0x39')]));_0x4718b6[_0xf7ae('0x6e')]=!![];if(_0x4a27e6[_0xf7ae('0x37')][_0xf7ae('0x41')]){_0x4718b6['where']=_[_0xf7ae('0x42')](_0x4718b6[_0xf7ae('0x40')],{'$or':_[_0xf7ae('0x32')](_0x4718b6['attributes'],function(_0x20be15){var _0x2dfe03={};_0x2dfe03[_0x20be15]={'$like':'%'+_0x4a27e6[_0xf7ae('0x37')][_0xf7ae('0x41')]+'%'};return _0x2dfe03;})});}_0x4718b6=_[_0xf7ae('0x42')]({},_0x4718b6,_0x4a27e6[_0xf7ae('0x44')]);return _0x4c3f78['getContacts'](_0x4718b6);}})[_0xf7ae('0x2c')](respondWithResult(_0x35602e,null))[_0xf7ae('0x48')](handleError(_0x35602e,null));};exports['getContactsCsv']=function(_0x4f97a1,_0x7edeca,_0x36c27f){var _0x305771;var _0x196d3a;var _0x24c17e;var _0x172779=_0x4f97a1[_0xf7ae('0x56')]['id'];csv_results=[];return db[_0xf7ae('0x6f')][_0xf7ae('0x46')]({'attributes':['id',_0xf7ae('0x31')],'raw':!![],'order':[_0xf7ae('0x70')]})[_0xf7ae('0x2c')](function(_0x23cf61){_0x305771=_0x23cf61;var _0x2cd40f=_[_0xf7ae('0x38')](db['CmContact'][_0xf7ae('0x4a')]);return db[_0xf7ae('0x71')][_0xf7ae('0x46')]({'raw':!![],'attributes':['id',_0xf7ae('0x72')]})[_0xf7ae('0x2c')](function(_0x12fbb8){_0x196d3a=_0x12fbb8;var _0x58776b=squel[_0xf7ae('0x73')]()[_0xf7ae('0x3a')](_0x2cd40f)['from'](_0xf7ae('0x74'),'c')[_0xf7ae('0x40')](_0xf7ae('0x75'),_0x172779)[_0xf7ae('0x40')](_0xf7ae('0x76'))[_0xf7ae('0x77')]();for(var _0x2a95b7=0x0;_0x2a95b7<_0x196d3a[_0xf7ae('0x3c')];_0x2a95b7++){_0x58776b['field'](_0xf7ae('0x78')+_0x196d3a[_0x2a95b7]['id'],_0xf7ae('0x79')+_0x196d3a[_0x2a95b7][_0xf7ae('0x72')]);}for(var _0x2a95b7=0x0;_0x2a95b7<_0x305771[_0xf7ae('0x3c')];_0x2a95b7++){_0x58776b[_0xf7ae('0x7a')](squel[_0xf7ae('0x73')]()[_0xf7ae('0x7a')](_0xf7ae('0x7b'))['from'](_0xf7ae('0x7c'))['where'](_0xf7ae('0x7d'),_0x305771[_0x2a95b7]['id'])[_0xf7ae('0x40')]('CmContactId\x20=\x20c.id'),_0xf7ae('0x7e')+_0x305771[_0x2a95b7][_0xf7ae('0x31')]);_0x58776b[_0xf7ae('0x7a')](squel[_0xf7ae('0x73')]()[_0xf7ae('0x7a')](_0xf7ae('0x7f'))[_0xf7ae('0x80')](_0xf7ae('0x7c'))[_0xf7ae('0x40')](_0xf7ae('0x7d'),_0x305771[_0x2a95b7]['id'])['where']('CmContactId\x20=\x20c.id'),_0xf7ae('0x81')+_0x305771[_0x2a95b7][_0xf7ae('0x31')]);}var _0x476626=[];_0x476626[_0xf7ae('0x64')](_0x58776b['toString']());BPromise['each'](_0x476626,handleQuery)[_0xf7ae('0x2c')](function(_0x19677d){handleQuery(_0x58776b['toString']());var _0x1ab05b=csv_results[0x0];if(!_[_0xf7ae('0x82')](_0x1ab05b)){var _0x48ceba=toCsv(_0x1ab05b);var _0x5156e3=Date['now']();fs[_0xf7ae('0x83')](util[_0xf7ae('0x84')](_0xf7ae('0x85'),_0x172779,_0x5156e3),_0x48ceba);_0x7edeca[_0xf7ae('0x86')](_0xf7ae('0x87'),_0xf7ae('0x88')+util[_0xf7ae('0x84')](_0xf7ae('0x89'),_0x172779,_0x5156e3));_0x7edeca[_0xf7ae('0x86')](_0xf7ae('0x8a'),_0xf7ae('0x8b'));return _0x7edeca['download'](util['format']('/tmp/list_%d_%s.csv',_0x172779,_0x5156e3));}else{return _0x7edeca['sendStatus'](0xcc);}});});});};exports[_0xf7ae('0x8c')]=function(_0x19a799,_0x4a4931,_0x5774f4){var _0x14df76;delete _0x19a799[_0xf7ae('0x55')]['id'];return db[_0xf7ae('0x33')][_0xf7ae('0x5c')]({'where':{'id':_0x19a799[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x4a4931,null))[_0xf7ae('0x2c')](function(_0x5b2942){if(_0x5b2942){return db['sequelize']['transaction'](function(_0x3a7a5e){return db[_0xf7ae('0x71')][_0xf7ae('0x4e')](_0x19a799[_0xf7ae('0x55')],{'transaction':_0x3a7a5e})[_0xf7ae('0x2c')](function(_0x59d9df){_0x14df76=_0x59d9df;return _0x5b2942['addCustomFields'](_0x59d9df,{'transaction':_0x3a7a5e});})[_0xf7ae('0x2c')](function(){var _0x6661a8={'type':db[_0xf7ae('0x8d')][_0xf7ae('0x8e')],'transaction':_0x3a7a5e};switch(_0x19a799[_0xf7ae('0x55')][_0xf7ae('0x34')]){case _0xf7ae('0x8f'):_0x6661a8[_0xf7ae('0x34')]=db[_0xf7ae('0x8d')]['TEXT'];break;case'number':_0x6661a8[_0xf7ae('0x34')]=db[_0xf7ae('0x8d')][_0xf7ae('0x90')];break;case'switch':_0x6661a8['type']=db['Sequelize'][_0xf7ae('0x91')];_0x6661a8[_0xf7ae('0x92')]=![];break;default:}return db[_0xf7ae('0x93')][_0xf7ae('0x94')][_0xf7ae('0x95')](_0xf7ae('0x74'),util[_0xf7ae('0x84')]('cf_%s',_0x14df76['id']),_0x6661a8);})[_0xf7ae('0x2c')](function(){return _0x14df76;});});}})[_0xf7ae('0x2c')](respondWithResult(_0x4a4931,null))[_0xf7ae('0x48')](handleError(_0x4a4931,null));};exports[_0xf7ae('0x96')]=function(_0x1379c1,_0x405a1c,_0x3b1261){var _0xc4d7f={};var _0x290fef={};var _0x1325e5;var _0x36cadf;return db[_0xf7ae('0x33')][_0xf7ae('0x5c')]({'where':{'id':_0x1379c1[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x405a1c,null))['then'](function(_0x2a4bc2){if(_0x2a4bc2){_0x1325e5=_0x2a4bc2;_0x290fef[_0xf7ae('0x36')]=_[_0xf7ae('0x38')](db[_0xf7ae('0x71')][_0xf7ae('0x4a')]);_0x290fef[_0xf7ae('0x37')]=_[_0xf7ae('0x38')](_0x1379c1[_0xf7ae('0x37')]);_0x290fef[_0xf7ae('0x39')]=_[_0xf7ae('0x4b')](_0x290fef['model'],_0x290fef[_0xf7ae('0x37')]);_0xc4d7f['attributes']=_[_0xf7ae('0x4b')](_0x290fef['model'],qs[_0xf7ae('0x3a')](_0x1379c1['query']['fields']));_0xc4d7f['attributes']=_0xc4d7f[_0xf7ae('0x3b')]['length']?_0xc4d7f['attributes']:_0x290fef['model'];_0xc4d7f['order']=qs[_0xf7ae('0x3f')](_0x1379c1[_0xf7ae('0x37')][_0xf7ae('0x3f')]);_0xc4d7f[_0xf7ae('0x40')]=qs[_0xf7ae('0x39')](_['pick'](_0x1379c1['query'],_0x290fef[_0xf7ae('0x39')]));_0xc4d7f[_0xf7ae('0x40')]=_[_0xf7ae('0x42')](_0xc4d7f[_0xf7ae('0x40')],{'$or':[{'ListId':_0x2a4bc2['id']},{'ListId':null}]});if(_0x1379c1['query'][_0xf7ae('0x41')]){_0xc4d7f['where']=_[_0xf7ae('0x42')](_0xc4d7f['where'],{'$or':_[_0xf7ae('0x32')](_0xc4d7f[_0xf7ae('0x3b')],function(_0x17ec1f){var _0x130d42={};_0x130d42[_0x17ec1f]={'$like':'%'+_0x1379c1['query'][_0xf7ae('0x41')]+'%'};return _0x130d42;})});}_0xc4d7f=_['merge']({},_0xc4d7f,_0x1379c1['options']);return db[_0xf7ae('0x71')][_0xf7ae('0x97')](_0xc4d7f);}})[_0xf7ae('0x2c')](respondWithResult(_0x405a1c,null))[_0xf7ae('0x48')](handleError(_0x405a1c,null));};exports[_0xf7ae('0x98')]=function(_0x35c031,_0x246bb3){return db['CmCustomField'][_0xf7ae('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x246bb3,null))[_0xf7ae('0x2c')](function(_0x57e797){return _0x57e797;})['then'](respondWithResult(_0x246bb3,null))[_0xf7ae('0x48')](handleError(_0x246bb3,null));};exports[_0xf7ae('0x99')]=function(_0x3d7e40,_0x584975,_0xae51c8){return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x3d7e40['params']['id']}})['then'](handleEntityNotFound(_0x584975,null))[_0xf7ae('0x2c')](function(_0xbe9df9){if(_0xbe9df9){return _0xbe9df9[_0xf7ae('0x99')](_0x3d7e40[_0xf7ae('0x55')][_0xf7ae('0x5f')],_[_0xf7ae('0x9a')](_0x3d7e40[_0xf7ae('0x55')],[_0xf7ae('0x5f'),'id'])||{})['spread'](function(_0x49766f){for(var _0x408c2e=0x0;_0x408c2e<_0x3d7e40[_0xf7ae('0x55')][_0xf7ae('0x5f')]['length'];_0x408c2e+=0x1){socket[_0xf7ae('0x9b')](_0xf7ae('0x9c'),{'UserId':Number(_0x3d7e40[_0xf7ae('0x55')][_0xf7ae('0x5f')][_0x408c2e]),'CmListId':Number(_0x3d7e40[_0xf7ae('0x56')]['id'])});}return _0x49766f;});}})['then'](respondWithResult(_0x584975,null))[_0xf7ae('0x48')](handleError(_0x584975,null));};exports[_0xf7ae('0x9d')]=function(_0x3a0f90,_0x7acf0,_0x158676){return db[_0xf7ae('0x33')][_0xf7ae('0x4d')]({'where':{'id':_0x3a0f90[_0xf7ae('0x56')]['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x7acf0,null))['then'](function(_0x16b969){if(_0x16b969){return _0x16b969[_0xf7ae('0x9d')](_0x3a0f90[_0xf7ae('0x37')][_0xf7ae('0x5f')])['then'](function(){if(_['isArray'](_0x3a0f90[_0xf7ae('0x37')]['ids'])){for(var _0x58600b=0x0;_0x58600b<_0x3a0f90[_0xf7ae('0x37')][_0xf7ae('0x5f')][_0xf7ae('0x3c')];_0x58600b+=0x1){socket[_0xf7ae('0x9b')](_0xf7ae('0x9e'),{'UserId':Number(_0x3a0f90[_0xf7ae('0x37')][_0xf7ae('0x5f')][_0x58600b]),'CmListId':Number(_0x3a0f90[_0xf7ae('0x56')]['id'])});}}else{socket[_0xf7ae('0x9b')](_0xf7ae('0x9e'),{'UserId':Number(_0x3a0f90[_0xf7ae('0x37')]['ids']),'CmListId':Number(_0x3a0f90[_0xf7ae('0x56')]['id'])});}});}})[_0xf7ae('0x2c')](respondWithStatusCode(_0x7acf0,null))['catch'](handleError(_0x7acf0,null));};exports['getAgents']=function(_0x120466,_0x16bb1e,_0x22b355){var _0x157f10={};var _0x116f01={};var _0x22f579;var _0x1dab48;return db[_0xf7ae('0x33')][_0xf7ae('0x5c')]({'where':{'id':_0x120466['params']['id']}})[_0xf7ae('0x2c')](handleEntityNotFound(_0x16bb1e,null))[_0xf7ae('0x2c')](function(_0x16d412){if(_0x16d412){_0x22f579=_0x16d412;_0x116f01[_0xf7ae('0x36')]=_[_0xf7ae('0x38')](db[_0xf7ae('0x9f')][_0xf7ae('0x4a')]);_0x116f01[_0xf7ae('0x37')]=_[_0xf7ae('0x38')](_0x120466[_0xf7ae('0x37')]);_0x116f01['filters']=_[_0xf7ae('0x4b')](_0x116f01[_0xf7ae('0x36')],_0x116f01[_0xf7ae('0x37')]);_0x157f10[_0xf7ae('0x3b')]=_[_0xf7ae('0x4b')](_0x116f01[_0xf7ae('0x36')],qs[_0xf7ae('0x3a')](_0x120466[_0xf7ae('0x37')][_0xf7ae('0x3a')]));_0x157f10[_0xf7ae('0x3b')]=_0x157f10[_0xf7ae('0x3b')][_0xf7ae('0x3c')]?_0x157f10[_0xf7ae('0x3b')]:_0x116f01[_0xf7ae('0x36')];_0x157f10[_0xf7ae('0x3e')]=qs['sort'](_0x120466['query'][_0xf7ae('0x3f')]);_0x157f10[_0xf7ae('0x40')]=qs[_0xf7ae('0x39')](_[_0xf7ae('0xa0')](_0x120466[_0xf7ae('0x37')],_0x116f01['filters']));if(_0x120466[_0xf7ae('0x37')][_0xf7ae('0x41')]){_0x157f10[_0xf7ae('0x40')]=_['merge'](_0x157f10['where'],{'$or':_[_0xf7ae('0x32')](_0x157f10[_0xf7ae('0x3b')],function(_0x3a6f01){var _0x12dff9={};_0x12dff9[_0x3a6f01]={'$like':'%'+_0x120466[_0xf7ae('0x37')][_0xf7ae('0x41')]+'%'};return _0x12dff9;})});}_0x157f10=_[_0xf7ae('0x42')]({},_0x157f10,_0x120466[_0xf7ae('0x44')]);return _0x22f579['getAgents'](_0x157f10);}})['then'](function(_0x284df6){if(_0x284df6){_0x1dab48=_0x284df6[_0xf7ae('0x3c')];if(!_0x120466[_0xf7ae('0x37')][_0xf7ae('0x5d')](_0xf7ae('0x3d'))){_0x157f10[_0xf7ae('0x25')]=qs[_0xf7ae('0x25')](_0x120466[_0xf7ae('0x37')][_0xf7ae('0x25')]);_0x157f10['offset']=qs[_0xf7ae('0x22')](_0x120466[_0xf7ae('0x37')][_0xf7ae('0x22')]);}return _0x22f579['getAgents'](_0x157f10);}})[_0xf7ae('0x2c')](function(_0x100302){if(_0x100302){return _0x100302?{'count':_0x1dab48,'rows':_0x100302}:null;}})[_0xf7ae('0x2c')](respondWithResult(_0x16bb1e,null))[_0xf7ae('0x48')](handleError(_0x16bb1e,null));};function handleQuery(_0x509f3a){logger['info'](_0x509f3a);return db[_0xf7ae('0x93')][_0xf7ae('0x37')](_0x509f3a)['spread'](function(_0x5b2ff4){csv_results[_0xf7ae('0x64')](_0x5b2ff4);})[_0xf7ae('0x48')](function(_0x4b7595){logger[_0xf7ae('0x53')](_0x4b7595[_0xf7ae('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d5c3b6c..ef12405 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x15ebfd,_0xbc1af8){var _0x268375=function(_0x32992b){while(--_0x32992b){_0x15ebfd['push'](_0x15ebfd['shift']());}};_0x268375(++_0xbc1af8);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x5a77eb,_0x10aef){var _0x5d9502=function(_0x8424ea){while(--_0x8424ea){_0x5a77eb['push'](_0x5a77eb['shift']());}};_0x5d9502(++_0x10aef);}(_0x814b,0x1a2));var _0xb814=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x814b[_0x111494];return _0x1d0d8b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cdc1c7c..eeaacc2 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 _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x3c13d0,_0x3647d9){var _0x204375=function(_0x25cde7){while(--_0x25cde7){_0x3c13d0['push'](_0x3c13d0['shift']());}};_0x204375(++_0x3647d9);}(_0x22fb,0x192));var _0xb22f=function(_0x2c3c66,_0x24c17e){_0x2c3c66=_0x2c3c66-0x0;var _0x1eee04=_0x22fb[_0x2c3c66];return _0x1eee04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x48f940,_0x31ce22){var _0x5457db=function(_0x2c8dc8){while(--_0x2c8dc8){_0x48f940['push'](_0x48f940['shift']());}};_0x5457db(++_0x31ce22);}(_0xa8a8,0xec));var _0x8a8a=function(_0x557bc6,_0x16ea8f){_0x557bc6=_0x557bc6-0x0;var _0x5cd2aa=_0xa8a8[_0x557bc6];return _0x5cd2aa;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c44d459..f7fd6f2 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 _0xd4e4=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','CmList,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22db62,_0x38bcea){var _0x9d8595=function(_0xa5a852){while(--_0xa5a852){_0x22db62['push'](_0x22db62['shift']());}};_0x9d8595(++_0x38bcea);}(_0xd4e4,0xa5));var _0x4d4e=function(_0x3de0a4,_0x298a6f){_0x3de0a4=_0x3de0a4-0x0;var _0x10b1a0=_0xd4e4[_0x3de0a4];return _0x10b1a0;};'use strict';var _=require(_0x4d4e('0x0'));var util=require(_0x4d4e('0x1'));var moment=require(_0x4d4e('0x2'));var BPromise=require(_0x4d4e('0x3'));var rs=require(_0x4d4e('0x4'));var fs=require('fs');var Redis=require(_0x4d4e('0x5'));var db=require(_0x4d4e('0x6'))['db'];var utils=require(_0x4d4e('0x7'));var logger=require(_0x4d4e('0x8'))(_0x4d4e('0x9'));var config=require(_0x4d4e('0xa'));var jayson=require(_0x4d4e('0xb'));var client=jayson[_0x4d4e('0xc')][_0x4d4e('0xd')]({'port':0x232a});config[_0x4d4e('0xe')]=_[_0x4d4e('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d4e('0xe')]));require(_0x4d4e('0x10'))[_0x4d4e('0x11')](socket);function respondWithRpcPromise(_0x39733d,_0x5e508a,_0x9446c6){return new BPromise(function(_0x6bbeaf,_0xe085df){return client[_0x4d4e('0x12')](_0x39733d,_0x9446c6)[_0x4d4e('0x13')](function(_0xc40761){logger[_0x4d4e('0x14')]('CmList,\x20%s,\x20%s',_0x5e508a,_0x4d4e('0x15'));logger[_0x4d4e('0x16')](_0x4d4e('0x17'),_0x5e508a,_0x4d4e('0x15'),JSON[_0x4d4e('0x18')](_0xc40761));if(_0xc40761[_0x4d4e('0x19')]){if(_0xc40761[_0x4d4e('0x19')]['code']===0x1f4){logger[_0x4d4e('0x19')]('CmList,\x20%s,\x20%s',_0x5e508a,_0xc40761['error'][_0x4d4e('0x1a')]);return _0xe085df(_0xc40761[_0x4d4e('0x19')][_0x4d4e('0x1a')]);}logger[_0x4d4e('0x19')](_0x4d4e('0x1b'),_0x5e508a,_0xc40761[_0x4d4e('0x19')][_0x4d4e('0x1a')]);return _0x6bbeaf(_0xc40761['error'][_0x4d4e('0x1a')]);}else{logger[_0x4d4e('0x14')](_0x4d4e('0x1b'),_0x5e508a,_0x4d4e('0x15'));_0x6bbeaf(_0xc40761[_0x4d4e('0x1c')][_0x4d4e('0x1a')]);}})['catch'](function(_0x4e0151){logger[_0x4d4e('0x19')](_0x4d4e('0x1b'),_0x5e508a,_0x4e0151);_0xe085df(_0x4e0151);});});} \ No newline at end of file +var _0xf2aa=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','CmList,\x20%s,\x20%s'];(function(_0x3d0e29,_0x59de74){var _0x182de2=function(_0x538711){while(--_0x538711){_0x3d0e29['push'](_0x3d0e29['shift']());}};_0x182de2(++_0x59de74);}(_0xf2aa,0x1d1));var _0xaf2a=function(_0x2cc656,_0x4f500e){_0x2cc656=_0x2cc656-0x0;var _0x297ef9=_0xf2aa[_0x2cc656];return _0x297ef9;};'use strict';var _=require('lodash');var util=require(_0xaf2a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf2a('0x1'))['db'];var utils=require(_0xaf2a('0x2'));var logger=require(_0xaf2a('0x3'))(_0xaf2a('0x4'));var config=require(_0xaf2a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaf2a('0x6')][_0xaf2a('0x7')]({'port':0x232a});config[_0xaf2a('0x8')]=_[_0xaf2a('0x9')](config[_0xaf2a('0x8')],{'host':_0xaf2a('0xa'),'port':0x18eb});var socket=require(_0xaf2a('0xb'))(new Redis(config[_0xaf2a('0x8')]));require(_0xaf2a('0xc'))[_0xaf2a('0xd')](socket);function respondWithRpcPromise(_0x3b3c5f,_0x5dc6f9,_0x47d0a6){return new BPromise(function(_0x50de39,_0x28253d){return client['request'](_0x3b3c5f,_0x47d0a6)['then'](function(_0x5c60e2){logger['info'](_0xaf2a('0xe'),_0x5dc6f9,_0xaf2a('0xf'));logger[_0xaf2a('0x10')](_0xaf2a('0x11'),_0x5dc6f9,_0xaf2a('0xf'),JSON[_0xaf2a('0x12')](_0x5c60e2));if(_0x5c60e2[_0xaf2a('0x13')]){if(_0x5c60e2[_0xaf2a('0x13')][_0xaf2a('0x14')]===0x1f4){logger[_0xaf2a('0x13')](_0xaf2a('0xe'),_0x5dc6f9,_0x5c60e2['error'][_0xaf2a('0x15')]);return _0x28253d(_0x5c60e2['error']['message']);}logger[_0xaf2a('0x13')](_0xaf2a('0xe'),_0x5dc6f9,_0x5c60e2[_0xaf2a('0x13')][_0xaf2a('0x15')]);return _0x50de39(_0x5c60e2[_0xaf2a('0x13')][_0xaf2a('0x15')]);}else{logger[_0xaf2a('0x16')](_0xaf2a('0xe'),_0x5dc6f9,_0xaf2a('0xf'));_0x50de39(_0x5c60e2['result'][_0xaf2a('0x15')]);}})[_0xaf2a('0x17')](function(_0x524e00){logger['error'](_0xaf2a('0xe'),_0x5dc6f9,_0x524e00);_0x28253d(_0x524e00);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f517e53..59122e1 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 _0xc932=['register','length','./cmList.events','remove','update','emit','removeListener'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xc932,0x95));var _0x2c93=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0xc932[_0xe1269d];return _0x261ca1;};'use strict';var CmListEvents=require(_0x2c93('0x0'));var events=['save',_0x2c93('0x1'),_0x2c93('0x2')];function createListener(_0x48b538,_0x6ec755){return function(_0x254b29){_0x6ec755[_0x2c93('0x3')](_0x48b538,_0x254b29);};}function removeListener(_0x36c9ea,_0x2cf17c){return function(){CmListEvents[_0x2c93('0x4')](_0x36c9ea,_0x2cf17c);};}exports[_0x2c93('0x5')]=function(_0x1bc3d5){for(var _0x167550=0x0,_0xcd146a=events[_0x2c93('0x6')];_0x167550<_0xcd146a;_0x167550++){var _0x297801=events[_0x167550];var _0x22a8a9=createListener('cmList:'+_0x297801,_0x1bc3d5);CmListEvents['on'](_0x297801,_0x22a8a9);}}; \ No newline at end of file +var _0x8c49=['./cmList.events','save','remove','update','removeListener','register','length','cmList:'];(function(_0x8c6eee,_0x21f601){var _0x5a03b5=function(_0x55599d){while(--_0x55599d){_0x8c6eee['push'](_0x8c6eee['shift']());}};_0x5a03b5(++_0x21f601);}(_0x8c49,0xf8));var _0x98c4=function(_0x358db6,_0x12291e){_0x358db6=_0x358db6-0x0;var _0x3a945e=_0x8c49[_0x358db6];return _0x3a945e;};'use strict';var CmListEvents=require(_0x98c4('0x0'));var events=[_0x98c4('0x1'),_0x98c4('0x2'),_0x98c4('0x3')];function createListener(_0x4cf72c,_0x2cb5e6){return function(_0x3292c5){_0x2cb5e6['emit'](_0x4cf72c,_0x3292c5);};}function removeListener(_0x5e5317,_0xbdc354){return function(){CmListEvents[_0x98c4('0x4')](_0x5e5317,_0xbdc354);};}exports[_0x98c4('0x5')]=function(_0x3be3c8){for(var _0x4d6dde=0x0,_0x4b9032=events[_0x98c4('0x6')];_0x4d6dde<_0x4b9032;_0x4d6dde++){var _0x218b40=events[_0x4d6dde];var _0x110845=createListener(_0x98c4('0x7')+_0x218b40,_0x3be3c8);CmListEvents['on'](_0x218b40,_0x110845);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8244942..b1268a8 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 _0xe6c4=['getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','/describe','get','isAuthenticated','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x24b897,_0x38df26){var _0x522698=function(_0x1757a3){while(--_0x1757a3){_0x24b897['push'](_0x24b897['shift']());}};_0x522698(++_0x38df26);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x5e6f4d,_0x545ebc){_0x5e6f4d=_0x5e6f4d-0x0;var _0x15fcfd=_0xe6c4[_0x5e6f4d];return _0x15fcfd;};'use strict';var multer=require(_0x4e6c('0x0'));var util=require(_0x4e6c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e6c('0x2'));var router=express[_0x4e6c('0x3')]();var fs_extra=require(_0x4e6c('0x4'));var auth=require(_0x4e6c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e6c('0x6'));var controller=require(_0x4e6c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4e6c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x4e6c('0x9')]('/global_fields',auth[_0x4e6c('0xa')](),controller[_0x4e6c('0xb')]);router[_0x4e6c('0x9')](_0x4e6c('0xc'),auth['isAuthenticated'](),controller[_0x4e6c('0xd')]);router[_0x4e6c('0x9')]('/:id/dispositions',auth[_0x4e6c('0xa')](),controller['getDispositions']);router[_0x4e6c('0x9')](_0x4e6c('0xe'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0xf')]);router[_0x4e6c('0x9')](_0x4e6c('0x10'),auth['isAuthenticated'](),controller[_0x4e6c('0x11')]);router[_0x4e6c('0x9')](_0x4e6c('0x12'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x13')]);router[_0x4e6c('0x9')](_0x4e6c('0x14'),auth['isAuthenticated'](),controller[_0x4e6c('0x15')]);router[_0x4e6c('0x16')]('/',auth['isAuthenticated'](),controller[_0x4e6c('0x17')]);router[_0x4e6c('0x16')](_0x4e6c('0x18'),auth[_0x4e6c('0xa')](),controller['addDisposition']);router[_0x4e6c('0x16')](_0x4e6c('0xe'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x19')]);router['post'](_0x4e6c('0x12'),auth[_0x4e6c('0xa')](),controller['addCustomField']);router[_0x4e6c('0x16')](_0x4e6c('0x14'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1a')]);router['put'](_0x4e6c('0xc'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1b')]);router[_0x4e6c('0x1c')]('/:id',auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1d')]);router[_0x4e6c('0x1c')](_0x4e6c('0x18'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1e')]);router[_0x4e6c('0x1c')](_0x4e6c('0x14'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1f')]);module[_0x4e6c('0x20')]=router; \ No newline at end of file +var _0x58ea=['describe','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index'];(function(_0xa7707e,_0x317da7){var _0x49879c=function(_0x1a0d0c){while(--_0x1a0d0c){_0xa7707e['push'](_0xa7707e['shift']());}};_0x49879c(++_0x317da7);}(_0x58ea,0xa7));var _0xa58e=function(_0x47209f,_0x82f03d){_0x47209f=_0x47209f-0x0;var _0x3b2bd0=_0x58ea[_0x47209f];return _0x3b2bd0;};'use strict';var multer=require('multer');var util=require(_0xa58e('0x0'));var path=require(_0xa58e('0x1'));var timeout=require(_0xa58e('0x2'));var express=require(_0xa58e('0x3'));var router=express[_0xa58e('0x4')]();var fs_extra=require(_0xa58e('0x5'));var auth=require(_0xa58e('0x6'));var interaction=require(_0xa58e('0x7'));var config=require(_0xa58e('0x8'));var controller=require(_0xa58e('0x9'));router[_0xa58e('0xa')]('/',auth[_0xa58e('0xb')](),controller[_0xa58e('0xc')]);router[_0xa58e('0xa')]('/describe',auth[_0xa58e('0xb')](),controller[_0xa58e('0xd')]);router[_0xa58e('0xa')]('/global_fields',auth[_0xa58e('0xb')](),controller[_0xa58e('0xe')]);router[_0xa58e('0xa')](_0xa58e('0xf'),auth['isAuthenticated'](),controller[_0xa58e('0x10')]);router[_0xa58e('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa58e('0xa')](_0xa58e('0x11'),auth[_0xa58e('0xb')](),controller[_0xa58e('0x12')]);router[_0xa58e('0xa')](_0xa58e('0x13'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xa58e('0xa')](_0xa58e('0x14'),auth['isAuthenticated'](),controller[_0xa58e('0x15')]);router[_0xa58e('0xa')](_0xa58e('0x16'),auth[_0xa58e('0xb')](),controller[_0xa58e('0x17')]);router[_0xa58e('0x18')]('/',auth[_0xa58e('0xb')](),controller[_0xa58e('0x19')]);router[_0xa58e('0x18')](_0xa58e('0x1a'),auth[_0xa58e('0xb')](),controller['addDisposition']);router[_0xa58e('0x18')]('/:id/contacts',auth[_0xa58e('0xb')](),controller[_0xa58e('0x1b')]);router['post']('/:id/fields',auth[_0xa58e('0xb')](),controller[_0xa58e('0x1c')]);router[_0xa58e('0x18')](_0xa58e('0x16'),auth[_0xa58e('0xb')](),controller[_0xa58e('0x1d')]);router[_0xa58e('0x1e')](_0xa58e('0xf'),auth['isAuthenticated'](),controller[_0xa58e('0x1f')]);router[_0xa58e('0x20')](_0xa58e('0xf'),auth['isAuthenticated'](),controller[_0xa58e('0x21')]);router[_0xa58e('0x20')](_0xa58e('0x1a'),auth[_0xa58e('0xb')](),controller[_0xa58e('0x22')]);router[_0xa58e('0x20')](_0xa58e('0x16'),auth[_0xa58e('0xb')](),controller['removeAgents']);module[_0xa58e('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 49a4ac2..91ba846 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 _0x9718=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x30ead1,_0x320313){var _0x1a4986=function(_0x22c5c0){while(--_0x22c5c0){_0x30ead1['push'](_0x30ead1['shift']());}};_0x1a4986(++_0x320313);}(_0x9718,0xe5));var _0x8971=function(_0x25835c,_0x222e79){_0x25835c=_0x25835c-0x0;var _0x4ba62b=_0x9718[_0x25835c];return _0x4ba62b;};'use strict';var Sequelize=require(_0x8971('0x0'));module[_0x8971('0x1')]={'name':{'type':Sequelize[_0x8971('0x2')],'get':function(_0x22a19f){return this['getDataValue'](_0x8971('0x3'));}},'field':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x3265=['exports','getDataValue','STRING','sequelize'];(function(_0x5e2a2b,_0x25abe0){var _0x326d1c=function(_0xf77a58){while(--_0xf77a58){_0x5e2a2b['push'](_0x5e2a2b['shift']());}};_0x326d1c(++_0x25abe0);}(_0x3265,0x137));var _0x5326=function(_0x3882e4,_0x2cd2cd){_0x3882e4=_0x3882e4-0x0;var _0x359fea=_0x3265[_0x3882e4];return _0x359fea;};'use strict';var Sequelize=require(_0x5326('0x0'));module[_0x5326('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x395876){return this[_0x5326('0x2')]('field');}},'field':{'type':Sequelize[_0x5326('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x5326('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x5326('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 29902c5..3d721be 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x590232,_0x481605){var _0x55ee1c=function(_0x12d76e){while(--_0x12d76e){_0x590232['push'](_0x590232['shift']());}};_0x55ee1c(++_0x481605);}(_0x7a54,0x106));var _0x47a5=function(_0x1ab96b,_0x31c69f){_0x1ab96b=_0x1ab96b-0x0;var _0x134de7=_0x7a54[_0x1ab96b];return _0x134de7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x4184f0,_0x389b3f){var _0x390e43=function(_0x2eedfa){while(--_0x2eedfa){_0x4184f0['push'](_0x4184f0['shift']());}};_0x390e43(++_0x389b3f);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a23e679..c29ca75 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 _0x9d43=['moment','bluebird','request-promise','rimraf','./condition.attributes','define','Condition','lodash','util'];(function(_0x4cb834,_0x5d48ee){var _0xaf9993=function(_0x16f815){while(--_0x16f815){_0x4cb834['push'](_0x4cb834['shift']());}};_0xaf9993(++_0x5d48ee);}(_0x9d43,0x139));var _0x39d4=function(_0x1b7b4c,_0x32cfdb){_0x1b7b4c=_0x1b7b4c-0x0;var _0x5e1a0e=_0x9d43[_0x1b7b4c];return _0x5e1a0e;};'use strict';var _=require(_0x39d4('0x0'));var util=require(_0x39d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x39d4('0x2'));var BPromise=require(_0x39d4('0x3'));var rp=require(_0x39d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39d4('0x5'));var config=require('../../config/environment');var attributes=require(_0x39d4('0x6'));module['exports']=function(_0x5bdcf4,_0x41af0c){return _0x5bdcf4[_0x39d4('0x7')](_0x39d4('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6976=['api','bluebird','request-promise','path','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x129aa7,_0x52e3f8){var _0x5cd9a3=function(_0x4fd523){while(--_0x4fd523){_0x129aa7['push'](_0x129aa7['shift']());}};_0x5cd9a3(++_0x52e3f8);}(_0x6976,0xe1));var _0x6697=function(_0x5f53d6,_0x111ab9){_0x5f53d6=_0x5f53d6-0x0;var _0x12fd20=_0x6976[_0x5f53d6];return _0x12fd20;};'use strict';var _=require(_0x6697('0x0'));var util=require(_0x6697('0x1'));var logger=require(_0x6697('0x2'))(_0x6697('0x3'));var moment=require('moment');var BPromise=require(_0x6697('0x4'));var rp=require(_0x6697('0x5'));var fs=require('fs');var path=require(_0x6697('0x6'));var rimraf=require('rimraf');var config=require(_0x6697('0x7'));var attributes=require(_0x6697('0x8'));module['exports']=function(_0x228413,_0x46d9db){return _0x228413[_0x6697('0x9')](_0x6697('0xa'),attributes,{'tableName':_0x6697('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 c25b0b6..0ab33ec 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 _0x3d39=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x41da6a,_0x2b22c7){var _0x5d37c6=function(_0x16f113){while(--_0x16f113){_0x41da6a['push'](_0x41da6a['shift']());}};_0x5d37c6(++_0x2b22c7);}(_0x3d39,0x80));var _0x93d3=function(_0x51041f,_0x159fcd){_0x51041f=_0x51041f-0x0;var _0x42581c=_0x3d39[_0x51041f];return _0x42581c;};'use strict';var _=require(_0x93d3('0x0'));var util=require(_0x93d3('0x1'));var moment=require('moment');var BPromise=require(_0x93d3('0x2'));var rs=require(_0x93d3('0x3'));var fs=require('fs');var Redis=require(_0x93d3('0x4'));var db=require(_0x93d3('0x5'))['db'];var utils=require(_0x93d3('0x6'));var logger=require(_0x93d3('0x7'))(_0x93d3('0x8'));var config=require(_0x93d3('0x9'));var jayson=require(_0x93d3('0xa'));var client=jayson[_0x93d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5187,_0x1f927a,_0x42461a){return new BPromise(function(_0x13b5a0,_0x8aad03){return client[_0x93d3('0xc')](_0x1e5187,_0x42461a)[_0x93d3('0xd')](function(_0x56d8f1){logger[_0x93d3('0xe')]('Condition,\x20%s,\x20%s',_0x1f927a,'request\x20sent');logger[_0x93d3('0xf')](_0x93d3('0x10'),_0x1f927a,_0x93d3('0x11'),JSON[_0x93d3('0x12')](_0x56d8f1));if(_0x56d8f1[_0x93d3('0x13')]){if(_0x56d8f1[_0x93d3('0x13')][_0x93d3('0x14')]===0x1f4){logger[_0x93d3('0x13')]('Condition,\x20%s,\x20%s',_0x1f927a,_0x56d8f1[_0x93d3('0x13')]['message']);return _0x8aad03(_0x56d8f1[_0x93d3('0x13')]['message']);}logger[_0x93d3('0x13')](_0x93d3('0x15'),_0x1f927a,_0x56d8f1[_0x93d3('0x13')]['message']);return _0x13b5a0(_0x56d8f1[_0x93d3('0x13')][_0x93d3('0x16')]);}else{logger[_0x93d3('0xe')](_0x93d3('0x15'),_0x1f927a,'request\x20sent');_0x13b5a0(_0x56d8f1[_0x93d3('0x17')][_0x93d3('0x16')]);}})[_0x93d3('0x18')](function(_0x5061b8){logger[_0x93d3('0x13')]('Condition,\x20%s,\x20%s',_0x1f927a,_0x5061b8);_0x8aad03(_0x5061b8);});});} \ No newline at end of file +var _0xf49b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2596f8,_0x2eed9d){var _0x1d9b1e=function(_0x82cc2f){while(--_0x82cc2f){_0x2596f8['push'](_0x2596f8['shift']());}};_0x1d9b1e(++_0x2eed9d);}(_0xf49b,0x1c8));var _0xbf49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf49b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbf49('0x0'));var util=require(_0xbf49('0x1'));var moment=require('moment');var BPromise=require(_0xbf49('0x2'));var rs=require(_0xbf49('0x3'));var fs=require('fs');var Redis=require(_0xbf49('0x4'));var db=require(_0xbf49('0x5'))['db'];var utils=require(_0xbf49('0x6'));var logger=require(_0xbf49('0x7'))('rpc');var config=require(_0xbf49('0x8'));var jayson=require(_0xbf49('0x9'));var client=jayson[_0xbf49('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fb7a4,_0x124c93,_0x2bbbb9){return new BPromise(function(_0x335864,_0x404f11){return client['request'](_0x4fb7a4,_0x2bbbb9)['then'](function(_0x1ef4d4){logger['info'](_0xbf49('0xb'),_0x124c93,_0xbf49('0xc'));logger[_0xbf49('0xd')](_0xbf49('0xe'),_0x124c93,_0xbf49('0xc'),JSON[_0xbf49('0xf')](_0x1ef4d4));if(_0x1ef4d4[_0xbf49('0x10')]){if(_0x1ef4d4[_0xbf49('0x10')][_0xbf49('0x11')]===0x1f4){logger['error'](_0xbf49('0xb'),_0x124c93,_0x1ef4d4[_0xbf49('0x10')][_0xbf49('0x12')]);return _0x404f11(_0x1ef4d4[_0xbf49('0x10')][_0xbf49('0x12')]);}logger[_0xbf49('0x10')]('Condition,\x20%s,\x20%s',_0x124c93,_0x1ef4d4[_0xbf49('0x10')][_0xbf49('0x12')]);return _0x335864(_0x1ef4d4[_0xbf49('0x10')][_0xbf49('0x12')]);}else{logger[_0xbf49('0x13')](_0xbf49('0xb'),_0x124c93,_0xbf49('0xc'));_0x335864(_0x1ef4d4[_0xbf49('0x14')][_0xbf49('0x12')]);}})[_0xbf49('0x15')](function(_0x5bbb9d){logger['error'](_0xbf49('0xb'),_0x124c93,_0x5bbb9d);_0x404f11(_0x5bbb9d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 572b0a2..1f7c79a 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 _0x2212=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','destroy'];(function(_0x1be43f,_0x400360){var _0x345586=function(_0x5e2a6f){while(--_0x5e2a6f){_0x1be43f['push'](_0x1be43f['shift']());}};_0x345586(++_0x400360);}(_0x2212,0x1e2));var _0x2221=function(_0x3cb658,_0x5289fc){_0x3cb658=_0x3cb658-0x0;var _0x529770=_0x2212[_0x3cb658];return _0x529770;};'use strict';var multer=require('multer');var util=require(_0x2221('0x0'));var path=require(_0x2221('0x1'));var timeout=require(_0x2221('0x2'));var express=require('express');var router=express[_0x2221('0x3')]();var fs_extra=require(_0x2221('0x4'));var auth=require(_0x2221('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2221('0x6'));var controller=require(_0x2221('0x7'));router[_0x2221('0x8')]('/:id',auth[_0x2221('0x9')](),controller['update']);router[_0x2221('0xa')]('/:id',auth[_0x2221('0x9')](),controller[_0x2221('0xb')]);module[_0x2221('0xc')]=router; \ No newline at end of file +var _0xdf75=['express','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0x3161f4,_0x8e7b45){var _0x1b2b59=function(_0x2adbfd){while(--_0x2adbfd){_0x3161f4['push'](_0x3161f4['shift']());}};_0x1b2b59(++_0x8e7b45);}(_0xdf75,0x14d));var _0x5df7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdf75[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x5df7('0x0'));var util=require(_0x5df7('0x1'));var path=require(_0x5df7('0x2'));var timeout=require('connect-timeout');var express=require(_0x5df7('0x3'));var router=express['Router']();var fs_extra=require(_0x5df7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5df7('0x5'));var config=require(_0x5df7('0x6'));var controller=require(_0x5df7('0x7'));router[_0x5df7('0x8')](_0x5df7('0x9'),auth[_0x5df7('0xa')](),controller['update']);router[_0x5df7('0xb')](_0x5df7('0x9'),auth[_0x5df7('0xa')](),controller[_0x5df7('0xc')]);module[_0x5df7('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4af0fb0..57e9418 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b6c=['sequelize','name','STRING'];(function(_0x38b1ff,_0xc7a100){var _0x51f5e2=function(_0x254551){while(--_0x254551){_0x38b1ff['push'](_0x38b1ff['shift']());}};_0x51f5e2(++_0xc7a100);}(_0x4b6c,0x123));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc4b6('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc4b6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe2af=['sequelize','STRING','name','INTEGER'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe2af,0x178));var _0xfe2a=function(_0x357006,_0x570981){_0x357006=_0x357006-0x0;var _0x3dd9b0=_0xe2af[_0x357006];return _0x3dd9b0;};'use strict';var Sequelize=require(_0xfe2a('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe2a('0x1')],'allowNull':![],'unique':_0xfe2a('0x2')},'OrderBy':{'type':Sequelize[_0xfe2a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfe2a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index a293fd5..29c6d13 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5af=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','error','CmContactHasItem'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2322bf,_0x213d13){_0x2322bf=_0x2322bf-0x0;var _0x125f0f=_0xe5af[_0x2322bf];return _0x125f0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){var _0x578d3e=_0x494df3[_0xfe5a('0x23')]({'plain':!![]});var _0x3a4f3c=_0xfe5a('0x24');return db[_0xfe5a('0x25')]['destroy']({'where':{'type':_0x3a4f3c,'resourceId':_0x578d3e['id']}})[_0xfe5a('0x22')](function(){return _0x494df3;});})[_0xfe5a('0x22')](function(){_0x247be4[_0xfe5a('0x17')](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x36bf20,_0x222490){return function(_0xdbf1e0){if(!_0xdbf1e0){_0x36bf20[_0xfe5a('0x15')](0x194);}return _0xdbf1e0;};}function handleError(_0x55d89e,_0x4df546){_0x4df546=_0x4df546||0x1f4;return function(_0x712b44){logger['error'](_0x712b44[_0xfe5a('0x26')]);if(_0x712b44[_0xfe5a('0x27')]){delete _0x712b44[_0xfe5a('0x27')];}_0x55d89e['status'](_0x4df546)['send'](_0x712b44);};}exports['index']=function(_0x32d31e,_0x582f2d){var _0x51d1f4={},_0x498b64={},_0x3b6e4d={'count':0x0,'rows':[]};var _0x14c66d=_[_0xfe5a('0x28')](db[_0xfe5a('0x29')][_0xfe5a('0x2a')],function(_0x286f27){return{'name':_0x286f27[_0xfe5a('0x2b')],'type':_0x286f27[_0xfe5a('0x2c')][_0xfe5a('0x2d')]};});_0x498b64[_0xfe5a('0x2e')]=_[_0xfe5a('0x28')](_0x14c66d,'name');_0x498b64[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x32d31e['query']);_0x498b64[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x498b64[_0xfe5a('0x2e')],_0x498b64[_0xfe5a('0x2f')]);_0x51d1f4[_0xfe5a('0x33')]=_['intersection'](_0x498b64['model'],qs[_0xfe5a('0x34')](_0x32d31e['query'][_0xfe5a('0x34')]));_0x51d1f4[_0xfe5a('0x33')]=_0x51d1f4[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x51d1f4['attributes']:_0x498b64[_0xfe5a('0x2e')];if(!_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x36')]('nolimit')){_0x51d1f4[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x1b')]);_0x51d1f4['offset']=qs[_0xfe5a('0x19')](_0x32d31e['query'][_0xfe5a('0x19')]);}_0x51d1f4[_0xfe5a('0x37')]=qs['sort'](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x38')]);_0x51d1f4[_0xfe5a('0x39')]=qs[_0xfe5a('0x31')](_['pick'](_0x32d31e[_0xfe5a('0x2f')],_0x498b64[_0xfe5a('0x31')]),_0x14c66d);if(_0x32d31e[_0xfe5a('0x2f')]['filter']){_0x51d1f4[_0xfe5a('0x39')]=_[_0xfe5a('0x3a')](_0x51d1f4[_0xfe5a('0x39')],{'$or':_[_0xfe5a('0x28')](_0x14c66d,function(_0xec56ad){if(_0xec56ad[_0xfe5a('0x2c')]!==_0xfe5a('0x3b')){var _0x243271={};_0x243271[_0xec56ad[_0xfe5a('0x27')]]={'$like':'%'+_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3c')]+'%'};return _0x243271;}})});}_0x51d1f4=_['merge']({},_0x51d1f4,_0x32d31e[_0xfe5a('0x3d')]);var _0x315396={'where':_0x51d1f4[_0xfe5a('0x39')]};return db[_0xfe5a('0x29')][_0xfe5a('0x1c')](_0x315396)[_0xfe5a('0x22')](function(_0x3475fb){_0x3b6e4d['count']=_0x3475fb;if(_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x51d1f4['include']=[{'all':!![]}];}return db['ContactItemType'][_0xfe5a('0x3f')](_0x51d1f4);})['then'](function(_0x54096d){_0x3b6e4d[_0xfe5a('0x40')]=_0x54096d;return _0x3b6e4d;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x582f2d,_0x51d1f4))['catch'](handleError(_0x582f2d,null));};exports[_0xfe5a('0x41')]=function(_0x5a9c92,_0x5112a9){var _0x1dbb2c={'raw':!![],'where':{'id':_0x5a9c92[_0xfe5a('0x42')]['id']}},_0x1a92ef={};_0x1a92ef[_0xfe5a('0x2e')]=_[_0xfe5a('0x30')](db['ContactItemType'][_0xfe5a('0x2a')]);_0x1a92ef[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x5a9c92[_0xfe5a('0x2f')]);_0x1a92ef[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],_0x1a92ef[_0xfe5a('0x2f')]);_0x1dbb2c[_0xfe5a('0x33')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],qs[_0xfe5a('0x34')](_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x34')]));_0x1dbb2c['attributes']=_0x1dbb2c[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x1dbb2c['attributes']:_0x1a92ef['model'];if(_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x1dbb2c[_0xfe5a('0x43')]=[{'all':!![]}];}_0x1dbb2c=_[_0xfe5a('0x3a')]({},_0x1dbb2c,_0x5a9c92[_0xfe5a('0x3d')]);return db[_0xfe5a('0x29')][_0xfe5a('0x44')](_0x1dbb2c)['then'](handleEntityNotFound(_0x5112a9,null))[_0xfe5a('0x22')](respondWithResult(_0x5112a9,null))['catch'](handleError(_0x5112a9,null));};exports[_0xfe5a('0x45')]=function(_0x5a807e,_0x433562){return db[_0xfe5a('0x29')][_0xfe5a('0x45')](_0x5a807e[_0xfe5a('0x46')],{})['then'](function(_0x394073){var _0x3f8447=_0x5a807e['user'][_0xfe5a('0x23')]({'plain':!![]});if(!_0x3f8447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8447['role']===_0xfe5a('0x47')){var _0x4e02c9=_0x394073[_0xfe5a('0x23')]({'plain':!![]});var _0x4536ba=_0xfe5a('0x24');return db[_0xfe5a('0x48')]['find']({'where':{'name':_0x4536ba,'userProfileId':_0x3f8447[_0xfe5a('0x49')]},'raw':!![]})['then'](function(_0x34247f){if(_0x34247f&&_0x34247f[_0xfe5a('0x4a')]===0x0){return db[_0xfe5a('0x25')]['create']({'name':_0x4e02c9[_0xfe5a('0x27')],'resourceId':_0x4e02c9['id'],'type':_0x34247f[_0xfe5a('0x27')],'sectionId':_0x34247f['id']},{})['then'](function(){return _0x394073;});}else{return _0x394073;}})[_0xfe5a('0x4b')](function(_0x42f2e2){logger[_0xfe5a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f2e2);throw _0x42f2e2;});}return _0x394073;})[_0xfe5a('0x22')](respondWithResult(_0x433562,0xc9))[_0xfe5a('0x4b')](handleError(_0x433562,null));};exports[_0xfe5a('0x20')]=function(_0x4d3bd8,_0x36395a){if(_0x4d3bd8[_0xfe5a('0x46')]['id']){delete _0x4d3bd8['body']['id'];}return db[_0xfe5a('0x29')]['find']({'where':{'id':_0x4d3bd8[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x36395a,null))[_0xfe5a('0x22')](saveUpdates(_0x4d3bd8[_0xfe5a('0x46')],null))[_0xfe5a('0x22')](respondWithResult(_0x36395a,null))[_0xfe5a('0x4b')](handleError(_0x36395a,null));};exports[_0xfe5a('0x21')]=function(_0x3432d1,_0x127a9f){return db[_0xfe5a('0x29')][_0xfe5a('0x44')]({'where':{'id':_0x3432d1[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x127a9f,null))[_0xfe5a('0x22')](db[_0xfe5a('0x4d')][_0xfe5a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3432d1['params']['id']}}))[_0xfe5a('0x22')](removeEntity(_0x127a9f,null))[_0xfe5a('0x4b')](handleError(_0x127a9f,null));}; \ No newline at end of file +var _0xfff0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x44f66e,_0x1bbc27){var _0xc8ee3b=function(_0x5c25fe){while(--_0x5c25fe){_0x44f66e['push'](_0x44f66e['shift']());}};_0xc8ee3b(++_0x1bbc27);}(_0xfff0,0x139));var _0x0fff=function(_0x4fc45e,_0x29351c){_0x4fc45e=_0x4fc45e-0x0;var _0x21d01c=_0xfff0[_0x4fc45e];return _0x21d01c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x24cd18=_0x6a116c[_0x0fff('0x28')]({'plain':!![]});var _0x23d9f8='ContactItemTypes';return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x23d9f8,'resourceId':_0x24cd18['id']}})[_0x0fff('0x26')](function(){return _0x6a116c;});})[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x27bd76,_0x3e6fef){return function(_0x44e54a){if(!_0x44e54a){_0x27bd76[_0x0fff('0x2a')](0x194);}return _0x44e54a;};}function handleError(_0x40651c,_0x2c39e3){_0x2c39e3=_0x2c39e3||0x1f4;return function(_0x495734){logger[_0x0fff('0x2b')](_0x495734[_0x0fff('0x2c')]);if(_0x495734[_0x0fff('0x2d')]){delete _0x495734[_0x0fff('0x2d')];}_0x40651c[_0x0fff('0x19')](_0x2c39e3)[_0x0fff('0x2e')](_0x495734);};}exports['index']=function(_0x31f9a4,_0xa16c29){var _0x351102={},_0x48f1d1={},_0x1016fa={'count':0x0,'rows':[]};var _0x3fa6fc=_['map'](db[_0x0fff('0x2f')][_0x0fff('0x30')],function(_0x15bb46){return{'name':_0x15bb46[_0x0fff('0x31')],'type':_0x15bb46[_0x0fff('0x32')][_0x0fff('0x33')]};});_0x48f1d1[_0x0fff('0x34')]=_[_0x0fff('0x35')](_0x3fa6fc,_0x0fff('0x2d'));_0x48f1d1[_0x0fff('0x36')]=_['keys'](_0x31f9a4[_0x0fff('0x36')]);_0x48f1d1[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x48f1d1[_0x0fff('0x34')],_0x48f1d1[_0x0fff('0x36')]);_0x351102['attributes']=_['intersection'](_0x48f1d1[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x39')]));_0x351102['attributes']=_0x351102[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x351102[_0x0fff('0x3a')]:_0x48f1d1[_0x0fff('0x34')];if(!_0x31f9a4['query'][_0x0fff('0x3c')](_0x0fff('0x3d'))){_0x351102[_0x0fff('0x1d')]=qs[_0x0fff('0x1d')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1d')]);_0x351102[_0x0fff('0x1c')]=qs[_0x0fff('0x1c')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1c')]);}_0x351102[_0x0fff('0x3e')]=qs[_0x0fff('0x3f')](_0x31f9a4['query'][_0x0fff('0x3f')]);_0x351102[_0x0fff('0x40')]=qs[_0x0fff('0x37')](_[_0x0fff('0x41')](_0x31f9a4[_0x0fff('0x36')],_0x48f1d1[_0x0fff('0x37')]),_0x3fa6fc);if(_0x31f9a4['query'][_0x0fff('0x42')]){_0x351102[_0x0fff('0x40')]=_[_0x0fff('0x43')](_0x351102[_0x0fff('0x40')],{'$or':_[_0x0fff('0x35')](_0x3fa6fc,function(_0x101151){if(_0x101151[_0x0fff('0x32')]!==_0x0fff('0x44')){var _0x28e0aa={};_0x28e0aa[_0x101151['name']]={'$like':'%'+_0x31f9a4[_0x0fff('0x36')]['filter']+'%'};return _0x28e0aa;}})});}_0x351102=_[_0x0fff('0x43')]({},_0x351102,_0x31f9a4[_0x0fff('0x45')]);var _0x126f6a={'where':_0x351102['where']};return db['ContactItemType'][_0x0fff('0x1f')](_0x126f6a)[_0x0fff('0x26')](function(_0x311348){_0x1016fa['count']=_0x311348;if(_0x31f9a4['query'][_0x0fff('0x46')]){_0x351102['include']=[{'all':!![]}];}return db[_0x0fff('0x2f')][_0x0fff('0x47')](_0x351102);})[_0x0fff('0x26')](function(_0x309d75){_0x1016fa[_0x0fff('0x48')]=_0x309d75;return _0x1016fa;})[_0x0fff('0x26')](respondWithFilteredResult(_0xa16c29,_0x351102))['catch'](handleError(_0xa16c29,null));};exports[_0x0fff('0x49')]=function(_0x39b829,_0x2a8c5e){var _0x41b4d5={'raw':!![],'where':{'id':_0x39b829[_0x0fff('0x4a')]['id']}},_0x7157e5={};_0x7157e5[_0x0fff('0x34')]=_['keys'](db[_0x0fff('0x2f')][_0x0fff('0x30')]);_0x7157e5[_0x0fff('0x36')]=_['keys'](_0x39b829[_0x0fff('0x36')]);_0x7157e5[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],_0x7157e5[_0x0fff('0x36')]);_0x41b4d5[_0x0fff('0x3a')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x39b829[_0x0fff('0x36')][_0x0fff('0x39')]));_0x41b4d5['attributes']=_0x41b4d5[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x41b4d5['attributes']:_0x7157e5[_0x0fff('0x34')];if(_0x39b829[_0x0fff('0x36')][_0x0fff('0x46')]){_0x41b4d5['include']=[{'all':!![]}];}_0x41b4d5=_['merge']({},_0x41b4d5,_0x39b829[_0x0fff('0x45')]);return db['ContactItemType']['find'](_0x41b4d5)[_0x0fff('0x26')](handleEntityNotFound(_0x2a8c5e,null))[_0x0fff('0x26')](respondWithResult(_0x2a8c5e,null))[_0x0fff('0x4b')](handleError(_0x2a8c5e,null));};exports[_0x0fff('0x4c')]=function(_0x3b4b8e,_0x1a7677){return db['ContactItemType'][_0x0fff('0x4c')](_0x3b4b8e[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x32568a){var _0x30c4d6=_0x3b4b8e[_0x0fff('0x4e')]['get']({'plain':!![]});if(!_0x30c4d6)throw new Error(_0x0fff('0x4f'));if(_0x30c4d6[_0x0fff('0x50')]==='user'){var _0x1fc872=_0x32568a['get']({'plain':!![]});var _0x5f1943='ContactItemTypes';return db[_0x0fff('0x51')][_0x0fff('0x52')]({'where':{'name':_0x5f1943,'userProfileId':_0x30c4d6[_0x0fff('0x53')]},'raw':!![]})[_0x0fff('0x26')](function(_0x579291){if(_0x579291&&_0x579291['autoAssociation']===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x1fc872[_0x0fff('0x2d')],'resourceId':_0x1fc872['id'],'type':_0x579291[_0x0fff('0x2d')],'sectionId':_0x579291['id']},{})[_0x0fff('0x26')](function(){return _0x32568a;});}else{return _0x32568a;}})['catch'](function(_0x3b401c){logger[_0x0fff('0x2b')](_0x0fff('0x54'),_0x3b401c);throw _0x3b401c;});}return _0x32568a;})[_0x0fff('0x26')](respondWithResult(_0x1a7677,0xc9))[_0x0fff('0x4b')](handleError(_0x1a7677,null));};exports[_0x0fff('0x25')]=function(_0x1af59f,_0x236da3){if(_0x1af59f[_0x0fff('0x4d')]['id']){delete _0x1af59f[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x2f')][_0x0fff('0x52')]({'where':{'id':_0x1af59f[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x236da3,null))[_0x0fff('0x26')](saveUpdates(_0x1af59f[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x236da3,null))[_0x0fff('0x4b')](handleError(_0x236da3,null));};exports[_0x0fff('0x27')]=function(_0x398513,_0x18c853){return db['ContactItemType'][_0x0fff('0x52')]({'where':{'id':_0x398513[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x18c853,null))[_0x0fff('0x26')](db['CmContactHasItem'][_0x0fff('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x398513['params']['id']}}))[_0x0fff('0x26')](removeEntity(_0x18c853,null))[_0x0fff('0x4b')](handleError(_0x18c853,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1b84184..8f763de 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77c9=['moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77c9,0x15a));var _0x977c=function(_0x11df66,_0x9eabf){_0x11df66=_0x11df66-0x0;var _0xc2dca1=_0x77c9[_0x11df66];return _0xc2dca1;};'use strict';var _=require(_0x977c('0x0'));var util=require(_0x977c('0x1'));var logger=require(_0x977c('0x2'))(_0x977c('0x3'));var moment=require(_0x977c('0x4'));var BPromise=require(_0x977c('0x5'));var rp=require(_0x977c('0x6'));var fs=require('fs');var path=require(_0x977c('0x7'));var rimraf=require('rimraf');var config=require(_0x977c('0x8'));var attributes=require(_0x977c('0x9'));module[_0x977c('0xa')]=function(_0x4c0d59,_0xc315f2){return _0x4c0d59[_0x977c('0xb')](_0x977c('0xc'),attributes,{'tableName':_0x977c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb84=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x4ecbbc,_0x473214){var _0x2b7bda=function(_0x561b08){while(--_0x561b08){_0x4ecbbc['push'](_0x4ecbbc['shift']());}};_0x2b7bda(++_0x473214);}(_0xcb84,0xfa));var _0x4cb8=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0xcb84[_0xb1174e];return _0x285bac;};'use strict';var _=require(_0x4cb8('0x0'));var util=require(_0x4cb8('0x1'));var logger=require(_0x4cb8('0x2'))(_0x4cb8('0x3'));var moment=require(_0x4cb8('0x4'));var BPromise=require(_0x4cb8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cb8('0x6'));var rimraf=require('rimraf');var config=require(_0x4cb8('0x7'));var attributes=require(_0x4cb8('0x8'));module[_0x4cb8('0x9')]=function(_0x5914f1,_0xfc084d){return _0x5914f1[_0x4cb8('0xa')](_0x4cb8('0xb'),attributes,{'tableName':_0x4cb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 896db23..bda5bad 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7312=['lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xd8c401,_0x5e99e4){var _0x4c481c=function(_0x2723bb){while(--_0x2723bb){_0xd8c401['push'](_0xd8c401['shift']());}};_0x4c481c(++_0x5e99e4);}(_0x7312,0xd2));var _0x2731=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7312[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x2731('0x0'));var util=require(_0x2731('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2731('0x2'));var fs=require('fs');var Redis=require(_0x2731('0x3'));var db=require(_0x2731('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2731('0x5'));var config=require(_0x2731('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2731('0x7')][_0x2731('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c53e0,_0xdfc86e,_0x37958b){return new BPromise(function(_0x2eaacb,_0x1f6ad0){return client[_0x2731('0x9')](_0x1c53e0,_0x37958b)['then'](function(_0x202491){logger[_0x2731('0xa')](_0x2731('0xb'),_0xdfc86e,_0x2731('0xc'));logger[_0x2731('0xd')](_0x2731('0xe'),_0xdfc86e,_0x2731('0xc'),JSON[_0x2731('0xf')](_0x202491));if(_0x202491['error']){if(_0x202491[_0x2731('0x10')][_0x2731('0x11')]===0x1f4){logger[_0x2731('0x10')]('ContactItemType,\x20%s,\x20%s',_0xdfc86e,_0x202491[_0x2731('0x10')][_0x2731('0x12')]);return _0x1f6ad0(_0x202491[_0x2731('0x10')][_0x2731('0x12')]);}logger[_0x2731('0x10')](_0x2731('0xb'),_0xdfc86e,_0x202491['error'][_0x2731('0x12')]);return _0x2eaacb(_0x202491[_0x2731('0x10')][_0x2731('0x12')]);}else{logger[_0x2731('0xa')](_0x2731('0xb'),_0xdfc86e,'request\x20sent');_0x2eaacb(_0x202491[_0x2731('0x13')][_0x2731('0x12')]);}})[_0x2731('0x14')](function(_0x432b2e){logger[_0x2731('0x10')](_0x2731('0xb'),_0xdfc86e,_0x432b2e);_0x1f6ad0(_0x432b2e);});});} \ No newline at end of file +var _0x484a=['stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x1fed98,_0xd2d528){var _0x33b99e=function(_0x4e1575){while(--_0x4e1575){_0x1fed98['push'](_0x1fed98['shift']());}};_0x33b99e(++_0xd2d528);}(_0x484a,0x191));var _0xa484=function(_0x481525,_0x3c9229){_0x481525=_0x481525-0x0;var _0x1dd0c0=_0x484a[_0x481525];return _0x1dd0c0;};'use strict';var _=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var moment=require('moment');var BPromise=require(_0xa484('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa484('0x3'));var db=require(_0xa484('0x4'))['db'];var utils=require(_0xa484('0x5'));var logger=require(_0xa484('0x6'))('rpc');var config=require(_0xa484('0x7'));var jayson=require(_0xa484('0x8'));var client=jayson[_0xa484('0x9')][_0xa484('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4891d8,_0x3f0ed8,_0x47ce1a){return new BPromise(function(_0x184ff1,_0x24251d){return client[_0xa484('0xb')](_0x4891d8,_0x47ce1a)[_0xa484('0xc')](function(_0x58b1f3){logger[_0xa484('0xd')](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));logger['debug'](_0xa484('0x10'),_0x3f0ed8,'request\x20sent',JSON[_0xa484('0x11')](_0x58b1f3));if(_0x58b1f3[_0xa484('0x12')]){if(_0x58b1f3[_0xa484('0x12')]['code']===0x1f4){logger['error'](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3['error'][_0xa484('0x13')]);return _0x24251d(_0x58b1f3[_0xa484('0x12')]['message']);}logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3[_0xa484('0x12')][_0xa484('0x13')]);return _0x184ff1(_0x58b1f3['error'][_0xa484('0x13')]);}else{logger['info'](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));_0x184ff1(_0x58b1f3[_0xa484('0x14')][_0xa484('0x13')]);}})[_0xa484('0x15')](function(_0x2a4c2a){logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x2a4c2a);_0x24251d(_0x2a4c2a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 47e88e0..46a7642 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ba4=['Router','fs-extra','../../components/auth/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','util','connect-timeout'];(function(_0x21b6f0,_0x3c948){var _0x1ec11a=function(_0x5d6656){while(--_0x5d6656){_0x21b6f0['push'](_0x21b6f0['shift']());}};_0x1ec11a(++_0x3c948);}(_0x1ba4,0x17e));var _0x41ba=function(_0x2b88f2,_0x408c2f){_0x2b88f2=_0x2b88f2-0x0;var _0xbf82a2=_0x1ba4[_0x2b88f2];return _0xbf82a2;};'use strict';var multer=require('multer');var util=require(_0x41ba('0x0'));var path=require('path');var timeout=require(_0x41ba('0x1'));var express=require('express');var router=express[_0x41ba('0x2')]();var fs_extra=require(_0x41ba('0x3'));var auth=require(_0x41ba('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41ba('0x5'));router['get']('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0x7')]);router[_0x41ba('0x8')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller[_0x41ba('0xa')]);router[_0x41ba('0xb')]('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0xc')]);router[_0x41ba('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x41ba('0xe')]('/:id',auth[_0x41ba('0x6')](),controller[_0x41ba('0xf')]);module['exports']=router; \ No newline at end of file +var _0xba5f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x344e95,_0x55b113){var _0x2761b4=function(_0x1b0f49){while(--_0x1b0f49){_0x344e95['push'](_0x344e95['shift']());}};_0x2761b4(++_0x55b113);}(_0xba5f,0xbb));var _0xfba5=function(_0x4acecd,_0x2092df){_0x4acecd=_0x4acecd-0x0;var _0x5b414f=_0xba5f[_0x4acecd];return _0x5b414f;};'use strict';var multer=require(_0xfba5('0x0'));var util=require(_0xfba5('0x1'));var path=require(_0xfba5('0x2'));var timeout=require('connect-timeout');var express=require(_0xfba5('0x3'));var router=express[_0xfba5('0x4')]();var fs_extra=require(_0xfba5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfba5('0x6'));var config=require(_0xfba5('0x7'));var controller=require(_0xfba5('0x8'));router[_0xfba5('0x9')]('/',auth[_0xfba5('0xa')](),controller[_0xfba5('0xb')]);router[_0xfba5('0x9')](_0xfba5('0xc'),auth[_0xfba5('0xa')](),controller['show']);router[_0xfba5('0xd')]('/',auth[_0xfba5('0xa')](),controller[_0xfba5('0xe')]);router[_0xfba5('0xf')](_0xfba5('0xc'),auth[_0xfba5('0xa')](),controller[_0xfba5('0x10')]);router[_0xfba5('0x11')](_0xfba5('0xc'),auth[_0xfba5('0xa')](),controller[_0xfba5('0x12')]);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 dee3e40..54f418f 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 _0x2032=['name','exports','STRING'];(function(_0x6be126,_0x26d157){var _0x107b3b=function(_0x2506a8){while(--_0x2506a8){_0x6be126['push'](_0x6be126['shift']());}};_0x107b3b(++_0x26d157);}(_0x2032,0xd9));var _0x2203=function(_0x9a1389,_0x3cc13a){_0x9a1389=_0x9a1389-0x0;var _0x2f0e7e=_0x2032[_0x9a1389];return _0x2f0e7e;};'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 +var _0xe706=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe706,0xa3));var _0x6e70=function(_0xada87a,_0x16223c){_0xada87a=_0xada87a-0x0;var _0x7ad44c=_0xe706[_0xada87a];return _0x7ad44c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 342cf1c..39f6324 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 _0x31fe=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','user','autoAssociation','create','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rawAttributes','eml-format'];(function(_0x1e1037,_0xd863ef){var _0x156a1a=function(_0x523269){while(--_0x523269){_0x1e1037['push'](_0x1e1037['shift']());}};_0x156a1a(++_0xd863ef);}(_0x31fe,0x173));var _0xe31f=function(_0x1a485b,_0x239fc5){_0x1a485b=_0x1a485b-0x0;var _0x5e17d4=_0x31fe[_0x1a485b];return _0x5e17d4;};'use strict';var emlformat=require(_0xe31f('0x0'));var rimraf=require(_0xe31f('0x1'));var zipdir=require(_0xe31f('0x2'));var jsonpatch=require(_0xe31f('0x3'));var rp=require('request-promise');var moment=require(_0xe31f('0x4'));var BPromise=require(_0xe31f('0x5'));var Mustache=require(_0xe31f('0x6'));var util=require(_0xe31f('0x7'));var path=require(_0xe31f('0x8'));var sox=require(_0xe31f('0x9'));var csv=require('to-csv');var ejs=require(_0xe31f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe31f('0xb'));var squel=require(_0xe31f('0xc'));var crypto=require(_0xe31f('0xd'));var jsforce=require(_0xe31f('0xe'));var deskjs=require(_0xe31f('0xf'));var toCsv=require(_0xe31f('0x10'));var querystring=require('querystring');var Papa=require(_0xe31f('0x11'));var Redis=require(_0xe31f('0x12'));var authService=require(_0xe31f('0x13'));var qs=require(_0xe31f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe31f('0x15'));var licenseUtil=require(_0xe31f('0x16'));var db=require('../../mysqldb')['db'];config[_0xe31f('0x17')]=_['defaults'](config[_0xe31f('0x17')],{'host':_0xe31f('0x18'),'port':0x18eb});var socket=require(_0xe31f('0x19'))(new Redis(config[_0xe31f('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x28b6a2,_0x118528){_0x118528=_0x118528||0xcc;return function(_0x481317){if(_0x481317){return _0x28b6a2[_0xe31f('0x1a')](_0x118528);}return _0x28b6a2[_0xe31f('0x1b')](_0x118528)[_0xe31f('0x1c')]();};}function respondWithResult(_0x440374,_0x2fe3c9){_0x2fe3c9=_0x2fe3c9||0xc8;return function(_0x5b8b4a){if(_0x5b8b4a){return _0x440374[_0xe31f('0x1b')](_0x2fe3c9)[_0xe31f('0x1d')](_0x5b8b4a);}};}function respondWithFilteredResult(_0x5b730f,_0x5ce481){return function(_0x2739b9){if(_0x2739b9){var _0x2eec8e=typeof _0x5ce481[_0xe31f('0x1e')]===_0xe31f('0x1f')&&typeof _0x5ce481[_0xe31f('0x20')]===_0xe31f('0x1f');var _0x45df0a=_0x2739b9[_0xe31f('0x21')];var _0x2cf02c=_0x2eec8e?0x0:_0x5ce481[_0xe31f('0x1e')];var _0x2d8fa7=_0x2eec8e?_0x2739b9['count']:_0x5ce481['offset']+_0x5ce481['limit'];var _0x26fed7;if(_0x2d8fa7>=_0x45df0a){_0x2d8fa7=_0x45df0a;_0x26fed7=0xc8;}else{_0x26fed7=0xce;}_0x5b730f[_0xe31f('0x1b')](_0x26fed7);return _0x5b730f[_0xe31f('0x22')](_0xe31f('0x23'),_0x2cf02c+'-'+_0x2d8fa7+'/'+_0x45df0a)[_0xe31f('0x1d')](_0x2739b9);}return null;};}function patchUpdates(_0x3aecf2){return function(_0x143595){try{jsonpatch[_0xe31f('0x24')](_0x143595,_0x3aecf2,!![]);}catch(_0xd18f03){return BPromise['reject'](_0xd18f03);}return _0x143595[_0xe31f('0x25')]();};}function saveUpdates(_0x52c269,_0x1bda16){return function(_0x15f78f){if(_0x15f78f){return _0x15f78f[_0xe31f('0x26')](_0x52c269)[_0xe31f('0x27')](function(_0x4248a4){return _0x4248a4;});}return null;};}function removeEntity(_0x4b0ac4,_0x117230){return function(_0x33d0db){if(_0x33d0db){return _0x33d0db[_0xe31f('0x28')]()['then'](function(){var _0x5d620f=_0x33d0db[_0xe31f('0x29')]({'plain':!![]});var _0xa1ffe=_0xe31f('0x2a');return db[_0xe31f('0x2b')]['destroy']({'where':{'type':_0xa1ffe,'resourceId':_0x5d620f['id']}})['then'](function(){return _0x33d0db;});})[_0xe31f('0x27')](function(){_0x4b0ac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcf11,_0x1fce1d){return function(_0xcb080a){if(!_0xcb080a){_0x4bcf11[_0xe31f('0x1a')](0x194);}return _0xcb080a;};}function handleError(_0x451094,_0x1ba397){_0x1ba397=_0x1ba397||0x1f4;return function(_0x4c6b03){logger[_0xe31f('0x2c')](_0x4c6b03['stack']);if(_0x4c6b03[_0xe31f('0x2d')]){delete _0x4c6b03[_0xe31f('0x2d')];}_0x451094['status'](_0x1ba397)[_0xe31f('0x2e')](_0x4c6b03);};}exports[_0xe31f('0x2f')]=function(_0x317cc0,_0x3b5ea7){var _0x2871f7={},_0x417d9c={},_0x484857={'count':0x0,'rows':[]};var _0x250075=_[_0xe31f('0x30')](db[_0xe31f('0x31')]['rawAttributes'],function(_0x4c8358){return{'name':_0x4c8358[_0xe31f('0x32')],'type':_0x4c8358[_0xe31f('0x33')][_0xe31f('0x34')]};});_0x417d9c[_0xe31f('0x35')]=_[_0xe31f('0x30')](_0x250075,'name');_0x417d9c[_0xe31f('0x36')]=_[_0xe31f('0x37')](_0x317cc0[_0xe31f('0x36')]);_0x417d9c[_0xe31f('0x38')]=_[_0xe31f('0x39')](_0x417d9c['model'],_0x417d9c[_0xe31f('0x36')]);_0x2871f7['attributes']=_[_0xe31f('0x39')](_0x417d9c[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0x317cc0[_0xe31f('0x36')]['fields']));_0x2871f7[_0xe31f('0x3b')]=_0x2871f7[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x2871f7[_0xe31f('0x3b')]:_0x417d9c[_0xe31f('0x35')];if(!_0x317cc0['query'][_0xe31f('0x3d')]('nolimit')){_0x2871f7['limit']=qs[_0xe31f('0x20')](_0x317cc0[_0xe31f('0x36')]['limit']);_0x2871f7[_0xe31f('0x1e')]=qs[_0xe31f('0x1e')](_0x317cc0[_0xe31f('0x36')][_0xe31f('0x1e')]);}_0x2871f7[_0xe31f('0x3e')]=qs[_0xe31f('0x3f')](_0x317cc0[_0xe31f('0x36')]['sort']);_0x2871f7[_0xe31f('0x40')]=qs['filters'](_['pick'](_0x317cc0['query'],_0x417d9c['filters']),_0x250075);if(_0x317cc0[_0xe31f('0x36')][_0xe31f('0x41')]){_0x2871f7[_0xe31f('0x40')]=_[_0xe31f('0x42')](_0x2871f7[_0xe31f('0x40')],{'$or':_['map'](_0x250075,function(_0x49905f){if(_0x49905f[_0xe31f('0x33')]!=='VIRTUAL'){var _0x9ed25b={};_0x9ed25b[_0x49905f[_0xe31f('0x2d')]]={'$like':'%'+_0x317cc0['query'][_0xe31f('0x41')]+'%'};return _0x9ed25b;}})});}_0x2871f7=_[_0xe31f('0x42')]({},_0x2871f7,_0x317cc0[_0xe31f('0x43')]);var _0x1109e5={'where':_0x2871f7[_0xe31f('0x40')]};return db[_0xe31f('0x31')]['count'](_0x1109e5)['then'](function(_0x23e44e){_0x484857['count']=_0x23e44e;if(_0x317cc0['query'][_0xe31f('0x44')]){_0x2871f7[_0xe31f('0x45')]=[{'all':!![]}];}return db[_0xe31f('0x31')][_0xe31f('0x46')](_0x2871f7);})['then'](function(_0x5676a2){_0x484857[_0xe31f('0x47')]=_0x5676a2;return _0x484857;})[_0xe31f('0x27')](respondWithFilteredResult(_0x3b5ea7,_0x2871f7))[_0xe31f('0x48')](handleError(_0x3b5ea7,null));};exports[_0xe31f('0x49')]=function(_0x5743ab,_0x305030){var _0x1a24d5={'raw':![],'where':{'id':_0x5743ab[_0xe31f('0x4a')]['id']}},_0x426ddd={};_0x426ddd[_0xe31f('0x35')]=_['keys'](db['Dashboard']['rawAttributes']);_0x426ddd[_0xe31f('0x36')]=_[_0xe31f('0x37')](_0x5743ab[_0xe31f('0x36')]);_0x426ddd[_0xe31f('0x38')]=_['intersection'](_0x426ddd['model'],_0x426ddd[_0xe31f('0x36')]);_0x1a24d5[_0xe31f('0x3b')]=_[_0xe31f('0x39')](_0x426ddd[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0x5743ab[_0xe31f('0x36')]['fields']));_0x1a24d5[_0xe31f('0x3b')]=_0x1a24d5[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x1a24d5[_0xe31f('0x3b')]:_0x426ddd[_0xe31f('0x35')];if(_0x5743ab[_0xe31f('0x36')][_0xe31f('0x44')]){_0x1a24d5[_0xe31f('0x45')]=[{'all':!![]}];}_0x1a24d5=_['merge']({},_0x1a24d5,_0x5743ab[_0xe31f('0x43')]);return db[_0xe31f('0x31')][_0xe31f('0x4b')](_0x1a24d5)[_0xe31f('0x27')](handleEntityNotFound(_0x305030,null))['then'](respondWithResult(_0x305030,null))[_0xe31f('0x48')](handleError(_0x305030,null));};exports['create']=function(_0x1d8af7,_0x286cc6){return db[_0xe31f('0x31')]['create'](_0x1d8af7[_0xe31f('0x4c')],{})['then'](function(_0x30abf3){var _0x28248e=_0x1d8af7['user']['get']({'plain':!![]});if(!_0x28248e)throw new Error(_0xe31f('0x4d'));if(_0x28248e[_0xe31f('0x4e')]==='user'){var _0x5c5e56=_0x30abf3[_0xe31f('0x29')]({'plain':!![]});var _0x3fa614=_0xe31f('0x2a');return db[_0xe31f('0x4f')]['find']({'where':{'name':_0x3fa614,'userProfileId':_0x28248e[_0xe31f('0x50')]},'raw':!![]})[_0xe31f('0x27')](function(_0x5e6b85){if(_0x5e6b85&&_0x5e6b85['autoAssociation']===0x0){return db[_0xe31f('0x2b')]['create']({'name':_0x5c5e56[_0xe31f('0x2d')],'resourceId':_0x5c5e56['id'],'type':_0x5e6b85[_0xe31f('0x2d')],'sectionId':_0x5e6b85['id']},{})[_0xe31f('0x27')](function(){return _0x30abf3;});}else{return _0x30abf3;}})['catch'](function(_0x3abcdd){logger[_0xe31f('0x2c')](_0xe31f('0x51'),_0x3abcdd);throw _0x3abcdd;});}return _0x30abf3;})[_0xe31f('0x27')](respondWithResult(_0x286cc6,0xc9))[_0xe31f('0x48')](handleError(_0x286cc6,null));};exports[_0xe31f('0x52')]=function(_0x3c3e61,_0x2fe9a8){var _0x44d142={'where':{'id':_0x3c3e61['params']['id']}},_0x4402eb={};_0x4402eb['model']=_[_0xe31f('0x37')](db[_0xe31f('0x31')]['rawAttributes']);_0x44d142['attributes']=_[_0xe31f('0x39')](_0x4402eb['model'],qs[_0xe31f('0x3a')](_0x3c3e61[_0xe31f('0x36')][_0xe31f('0x3a')]));_0x44d142[_0xe31f('0x3b')]=_0x44d142[_0xe31f('0x3b')]['length']?_0x44d142[_0xe31f('0x3b')]:_0x4402eb['model'];if(_0x3c3e61[_0xe31f('0x36')]['includeAll']){_0x44d142[_0xe31f('0x45')]=[{'all':!![]}];}_0x44d142=_[_0xe31f('0x42')]({},_0x44d142,_0x3c3e61[_0xe31f('0x43')]);return db[_0xe31f('0x31')][_0xe31f('0x4b')](_0x44d142)[_0xe31f('0x27')](handleEntityNotFound(_0x2fe9a8,null))[_0xe31f('0x27')](function(_0x52e0e5){if(_0x52e0e5){var _0x1cf5f2=_0x52e0e5[_0xe31f('0x29')]({'plain':!![]});_0x1cf5f2=qs['omit'](_0x1cf5f2,['id',_0xe31f('0x53'),_0xe31f('0x54')]);_0x3c3e61[_0xe31f('0x4c')]=_['omit'](_0x3c3e61[_0xe31f('0x4c')],['id',_0xe31f('0x53'),_0xe31f('0x54')]);return db['Dashboard']['create'](_[_0xe31f('0x42')](_0x1cf5f2,_0x3c3e61[_0xe31f('0x4c')]),{'include':_0x3c3e61['query'][_0xe31f('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0xbccf96){var _0x5679fc=_0x3c3e61[_0xe31f('0x55')][_0xe31f('0x29')]({'plain':!![]});if(!_0x5679fc)throw new Error(_0xe31f('0x4d'));if(_0x5679fc[_0xe31f('0x4e')]===_0xe31f('0x55')){var _0x12e72d=_0xbccf96['get']({'plain':!![]});var _0x3e1e2d=_0xe31f('0x2a');return db[_0xe31f('0x4f')]['find']({'where':{'name':_0x3e1e2d,'userProfileId':_0x5679fc['userProfileId']},'raw':!![]})[_0xe31f('0x27')](function(_0x295f3c){if(_0x295f3c&&_0x295f3c[_0xe31f('0x56')]===0x0){return db['UserProfileResource'][_0xe31f('0x57')]({'name':_0x12e72d['name'],'resourceId':_0x12e72d['id'],'type':_0x295f3c[_0xe31f('0x2d')],'sectionId':_0x295f3c['id']},{})['then'](function(){return _0xbccf96;});}else{return _0xbccf96;}})[_0xe31f('0x48')](function(_0x508099){logger[_0xe31f('0x2c')](_0xe31f('0x51'),_0x508099);throw _0x508099;});}return _0xbccf96;});}})['then'](respondWithResult(_0x2fe9a8,0xc9))[_0xe31f('0x48')](handleError(_0x2fe9a8,null));};exports[_0xe31f('0x26')]=function(_0x54402e,_0x22d9e7){if(_0x54402e[_0xe31f('0x4c')]['id']){delete _0x54402e['body']['id'];}return db[_0xe31f('0x31')][_0xe31f('0x4b')]({'where':{'id':_0x54402e[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x22d9e7,null))['then'](saveUpdates(_0x54402e[_0xe31f('0x4c')],null))[_0xe31f('0x27')](respondWithResult(_0x22d9e7,null))['catch'](handleError(_0x22d9e7,null));};exports[_0xe31f('0x28')]=function(_0x50894f,_0x17a6ca){return db['Dashboard'][_0xe31f('0x4b')]({'where':{'id':_0x50894f[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x17a6ca,null))['then'](removeEntity(_0x17a6ca,null))[_0xe31f('0x48')](handleError(_0x17a6ca,null));};function widgetAttributes(_0x53d774){try{switch(_0x53d774['type']){case'iframe':return[{'name':_0xe31f('0x58'),'value':_0x53d774[_0xe31f('0x58')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||'https://'}];case _0xe31f('0x5b'):return[{'name':_0xe31f('0x5c'),'value':_0x53d774[_0xe31f('0x5c')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x0]?_0x53d774['attrs'][0x0][_0xe31f('0x5a')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x53d774[_0xe31f('0x5d')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||'HH:mm:ss'},{'name':_0xe31f('0x5e'),'value':_0x53d774[_0xe31f('0x5e')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||_0xe31f('0x5f')},{'name':'attrFontSize','value':_0x53d774[_0xe31f('0x60')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774[_0xe31f('0x59')][0x2][_0xe31f('0x5a')]:undefined)||0xc}];case'counter':return[{'name':_0xe31f('0x61'),'value':_0x53d774[_0xe31f('0x61')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||_0xe31f('0x62')},{'name':'attrVoiceQueues','value':_0x53d774[_0xe31f('0x63')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x1]?_0x53d774['attrs'][0x1][_0xe31f('0x5a')]:undefined)||[]},{'name':_0xe31f('0x60'),'value':_0x53d774['attrFontSize']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774['attrs'][0x2][_0xe31f('0x5a')]:undefined)||0x14},{'name':_0xe31f('0x64'),'value':_0x53d774[_0xe31f('0x64')]||(_0x53d774['attrs']&&_0x53d774['attrs'][0x3]?_0x53d774['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0xe31f('0x65'),'value':_0x53d774[_0xe31f('0x65')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x4]?_0x53d774[_0xe31f('0x59')][0x4][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x66'),'value':_0x53d774[_0xe31f('0x66')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x5]?_0x53d774[_0xe31f('0x59')][0x5]['value']:undefined)||''},{'name':_0xe31f('0x67'),'value':_0x53d774['attrSmsAccounts']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x6]?_0x53d774['attrs'][0x6][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x68'),'value':_0x53d774[_0xe31f('0x68')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x7]?_0x53d774[_0xe31f('0x59')][0x7][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x69'),'value':_0x53d774[_0xe31f('0x69')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x8]?_0x53d774[_0xe31f('0x59')][0x8][_0xe31f('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x53d774[_0xe31f('0x6a')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x9]?_0x53d774[_0xe31f('0x59')][0x9][_0xe31f('0x5a')]:undefined)||''}];case _0xe31f('0x6b'):case _0xe31f('0x6c'):return[{'name':_0xe31f('0x6d'),'value':_0x53d774['attrSerie1']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||_0xe31f('0x62')},{'name':_0xe31f('0x6e'),'value':_0x53d774[_0xe31f('0x6e')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||null},{'name':_0xe31f('0x6f'),'value':_0x53d774[_0xe31f('0x6f')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774[_0xe31f('0x59')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x53d774[_0xe31f('0x63')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x3]?_0x53d774['attrs'][0x3][_0xe31f('0x5a')]:undefined)||[]},{'name':_0xe31f('0x64'),'value':_0x53d774[_0xe31f('0x64')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x4]?_0x53d774['attrs'][0x4][_0xe31f('0x5a')]:undefined)||_0xe31f('0x70')},{'name':'attrEmailAccounts','value':_0x53d774[_0xe31f('0x65')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x5]?_0x53d774[_0xe31f('0x59')][0x5][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x66'),'value':_0x53d774[_0xe31f('0x66')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x6]?_0x53d774[_0xe31f('0x59')][0x6][_0xe31f('0x5a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x53d774[_0xe31f('0x67')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x7]?_0x53d774[_0xe31f('0x59')][0x7][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x68'),'value':_0x53d774[_0xe31f('0x68')]||(_0x53d774['attrs']&&_0x53d774['attrs'][0x8]?_0x53d774[_0xe31f('0x59')][0x8][_0xe31f('0x5a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x53d774['attrWhatsappAccounts']||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x9]?_0x53d774[_0xe31f('0x59')][0x9]['value']:undefined)||''},{'name':_0xe31f('0x6a'),'value':_0x53d774[_0xe31f('0x6a')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0xa]?_0x53d774[_0xe31f('0x59')][0xa][_0xe31f('0x5a')]:undefined)||''}];case _0xe31f('0x71'):return[{'name':'attrReport','type':_0x53d774[_0xe31f('0x72')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x33')]:undefined)||null,'value':_0x53d774[_0xe31f('0x73')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x0]?_0x53d774[_0xe31f('0x59')][0x0]['value']:undefined)||null},{'name':_0xe31f('0x74'),'value':_0x53d774[_0xe31f('0x74')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x5f0db2){logger[_0xe31f('0x2c')](_0xe31f('0x75'),JSON[_0xe31f('0x76')](_0x5f0db2));return[];}}exports[_0xe31f('0x77')]=function(_0x2fd048,_0x7993ee,_0x1301fc){if(_0x2fd048[_0xe31f('0x4c')]['id']){delete _0x2fd048[_0xe31f('0x4c')]['id'];}return db[_0xe31f('0x31')]['find']({'where':{'id':_0x2fd048['params']['id']}})['then'](handleEntityNotFound(_0x7993ee,null))['then'](function(_0x32844b){if(_0x32844b){_0x2fd048['body']['DashboardId']=_0x32844b['id'];_0x2fd048[_0xe31f('0x4c')][_0xe31f('0x59')]=widgetAttributes(_0x2fd048[_0xe31f('0x4c')]);return db[_0xe31f('0x78')][_0xe31f('0x57')](_0x2fd048['body']);}})[_0xe31f('0x27')](respondWithResult(_0x7993ee,null))[_0xe31f('0x48')](handleError(_0x7993ee,null));};exports[_0xe31f('0x79')]=function(_0xb3d13f,_0x3f05f7,_0x2878e1){var _0x36db0f={};var _0x481891={};var _0x41f098;var _0xa1ecc4;return db[_0xe31f('0x31')][_0xe31f('0x7a')]({'where':{'id':_0xb3d13f[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x3f05f7,null))['then'](function(_0x6cb8d5){if(_0x6cb8d5){_0x41f098=_0x6cb8d5;_0x481891[_0xe31f('0x35')]=_[_0xe31f('0x37')](db[_0xe31f('0x78')][_0xe31f('0x7b')]);_0x481891['query']=_[_0xe31f('0x37')](_0xb3d13f[_0xe31f('0x36')]);_0x481891['filters']=_[_0xe31f('0x39')](_0x481891['model'],_0x481891[_0xe31f('0x36')]);_0x36db0f['attributes']=_[_0xe31f('0x39')](_0x481891[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0xb3d13f[_0xe31f('0x36')]['fields']));_0x36db0f[_0xe31f('0x3b')]=_0x36db0f[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x36db0f['attributes']:_0x481891['model'];_0x36db0f[_0xe31f('0x3e')]=qs[_0xe31f('0x3f')](_0xb3d13f[_0xe31f('0x36')]['sort']);_0x36db0f[_0xe31f('0x40')]=qs[_0xe31f('0x38')](_['pick'](_0xb3d13f[_0xe31f('0x36')],_0x481891[_0xe31f('0x38')]));if(_0xb3d13f['query'][_0xe31f('0x41')]){_0x36db0f[_0xe31f('0x40')]=_[_0xe31f('0x42')](_0x36db0f[_0xe31f('0x40')],{'$or':_[_0xe31f('0x30')](_0x36db0f[_0xe31f('0x3b')],function(_0x2d195c){var _0x452a7d={};_0x452a7d[_0x2d195c]={'$like':'%'+_0xb3d13f['query']['filter']+'%'};return _0x452a7d;})});}_0x36db0f=_[_0xe31f('0x42')]({},_0x36db0f,_0xb3d13f['options']);return _0x41f098[_0xe31f('0x79')](_0x36db0f);}})[_0xe31f('0x27')](function(_0x474224){if(_0x474224){_0xa1ecc4=_0x474224['length'];if(!_0xb3d13f[_0xe31f('0x36')]['hasOwnProperty']('nolimit')){_0x36db0f[_0xe31f('0x20')]=qs['limit'](_0xb3d13f[_0xe31f('0x36')][_0xe31f('0x20')]);_0x36db0f[_0xe31f('0x1e')]=qs['offset'](_0xb3d13f['query'][_0xe31f('0x1e')]);}return _0x41f098['getItems'](_0x36db0f);}})['then'](function(_0x2eff98){if(_0x2eff98){return _0x2eff98?{'count':_0xa1ecc4,'rows':_0x2eff98}:null;}})[_0xe31f('0x27')](respondWithResult(_0x3f05f7,null))[_0xe31f('0x48')](handleError(_0x3f05f7,null));}; \ No newline at end of file +var _0x8617=['attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','Dashboard','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrUrl'];(function(_0x557660,_0x55cea9){var _0x469bd7=function(_0x3292ba){while(--_0x3292ba){_0x557660['push'](_0x557660['shift']());}};_0x469bd7(++_0x55cea9);}(_0x8617,0x132));var _0x7861=function(_0x1f2de0,_0x225cca){_0x1f2de0=_0x1f2de0-0x0;var _0x54a476=_0x8617[_0x1f2de0];return _0x54a476;};'use strict';var emlformat=require(_0x7861('0x0'));var rimraf=require(_0x7861('0x1'));var zipdir=require(_0x7861('0x2'));var jsonpatch=require(_0x7861('0x3'));var rp=require(_0x7861('0x4'));var moment=require('moment');var BPromise=require(_0x7861('0x5'));var Mustache=require(_0x7861('0x6'));var util=require(_0x7861('0x7'));var path=require(_0x7861('0x8'));var sox=require(_0x7861('0x9'));var csv=require('to-csv');var ejs=require(_0x7861('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7861('0xb'));var squel=require(_0x7861('0xc'));var crypto=require(_0x7861('0xd'));var jsforce=require(_0x7861('0xe'));var deskjs=require(_0x7861('0xf'));var toCsv=require(_0x7861('0x10'));var querystring=require('querystring');var Papa=require(_0x7861('0x11'));var Redis=require(_0x7861('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7861('0x13'));var as=require(_0x7861('0x14'));var hardwareService=require(_0x7861('0x15'));var logger=require(_0x7861('0x16'))(_0x7861('0x17'));var utils=require(_0x7861('0x18'));var config=require(_0x7861('0x19'));var licenseUtil=require(_0x7861('0x1a'));var db=require(_0x7861('0x1b'))['db'];config[_0x7861('0x1c')]=_['defaults'](config[_0x7861('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7861('0x1c')]));require(_0x7861('0x1d'))[_0x7861('0x1e')](socket);function respondWithStatusCode(_0x11891a,_0x3332e9){_0x3332e9=_0x3332e9||0xcc;return function(_0x472107){if(_0x472107){return _0x11891a[_0x7861('0x1f')](_0x3332e9);}return _0x11891a[_0x7861('0x20')](_0x3332e9)[_0x7861('0x21')]();};}function respondWithResult(_0x4bf909,_0x177e21){_0x177e21=_0x177e21||0xc8;return function(_0x28ad0d){if(_0x28ad0d){return _0x4bf909[_0x7861('0x20')](_0x177e21)['json'](_0x28ad0d);}};}function respondWithFilteredResult(_0x4c17a9,_0x2d063f){return function(_0x38feca){if(_0x38feca){var _0x37fd6d=typeof _0x2d063f[_0x7861('0x22')]===_0x7861('0x23')&&typeof _0x2d063f['limit']===_0x7861('0x23');var _0x10a004=_0x38feca[_0x7861('0x24')];var _0x4ce68c=_0x37fd6d?0x0:_0x2d063f[_0x7861('0x22')];var _0x187577=_0x37fd6d?_0x38feca['count']:_0x2d063f[_0x7861('0x22')]+_0x2d063f[_0x7861('0x25')];var _0x6b778f;if(_0x187577>=_0x10a004){_0x187577=_0x10a004;_0x6b778f=0xc8;}else{_0x6b778f=0xce;}_0x4c17a9['status'](_0x6b778f);return _0x4c17a9[_0x7861('0x26')](_0x7861('0x27'),_0x4ce68c+'-'+_0x187577+'/'+_0x10a004)[_0x7861('0x28')](_0x38feca);}return null;};}function patchUpdates(_0x44c989){return function(_0x592904){try{jsonpatch[_0x7861('0x29')](_0x592904,_0x44c989,!![]);}catch(_0xdbee41){return BPromise[_0x7861('0x2a')](_0xdbee41);}return _0x592904['save']();};}function saveUpdates(_0x4fd9a3,_0x4b982a){return function(_0x4d6a2b){if(_0x4d6a2b){return _0x4d6a2b[_0x7861('0x2b')](_0x4fd9a3)['then'](function(_0x285b51){return _0x285b51;});}return null;};}function removeEntity(_0x566ac1,_0x63ed90){return function(_0x463f24){if(_0x463f24){return _0x463f24['destroy']()[_0x7861('0x2c')](function(){var _0x9a27a2=_0x463f24['get']({'plain':!![]});var _0x48217c=_0x7861('0x2d');return db[_0x7861('0x2e')][_0x7861('0x2f')]({'where':{'type':_0x48217c,'resourceId':_0x9a27a2['id']}})[_0x7861('0x2c')](function(){return _0x463f24;});})[_0x7861('0x2c')](function(){_0x566ac1[_0x7861('0x20')](0xcc)[_0x7861('0x21')]();});}};}function handleEntityNotFound(_0x3de040,_0x11b59c){return function(_0x8aab68){if(!_0x8aab68){_0x3de040['sendStatus'](0x194);}return _0x8aab68;};}function handleError(_0x4fb678,_0x12865e){_0x12865e=_0x12865e||0x1f4;return function(_0x187158){logger[_0x7861('0x30')](_0x187158[_0x7861('0x31')]);if(_0x187158[_0x7861('0x32')]){delete _0x187158[_0x7861('0x32')];}_0x4fb678['status'](_0x12865e)[_0x7861('0x33')](_0x187158);};}exports[_0x7861('0x34')]=function(_0x2625bd,_0x30c543){var _0x106a66={},_0x225178={},_0x228194={'count':0x0,'rows':[]};var _0x305a6a=_[_0x7861('0x35')](db['Dashboard'][_0x7861('0x36')],function(_0x2bce21){return{'name':_0x2bce21[_0x7861('0x37')],'type':_0x2bce21[_0x7861('0x38')][_0x7861('0x39')]};});_0x225178[_0x7861('0x3a')]=_['map'](_0x305a6a,_0x7861('0x32'));_0x225178[_0x7861('0x3b')]=_[_0x7861('0x3c')](_0x2625bd[_0x7861('0x3b')]);_0x225178[_0x7861('0x3d')]=_[_0x7861('0x3e')](_0x225178[_0x7861('0x3a')],_0x225178[_0x7861('0x3b')]);_0x106a66[_0x7861('0x3f')]=_['intersection'](_0x225178[_0x7861('0x3a')],qs[_0x7861('0x40')](_0x2625bd[_0x7861('0x3b')][_0x7861('0x40')]));_0x106a66[_0x7861('0x3f')]=_0x106a66['attributes'][_0x7861('0x41')]?_0x106a66['attributes']:_0x225178[_0x7861('0x3a')];if(!_0x2625bd[_0x7861('0x3b')][_0x7861('0x42')](_0x7861('0x43'))){_0x106a66[_0x7861('0x25')]=qs[_0x7861('0x25')](_0x2625bd[_0x7861('0x3b')][_0x7861('0x25')]);_0x106a66[_0x7861('0x22')]=qs[_0x7861('0x22')](_0x2625bd[_0x7861('0x3b')]['offset']);}_0x106a66[_0x7861('0x44')]=qs['sort'](_0x2625bd[_0x7861('0x3b')][_0x7861('0x45')]);_0x106a66[_0x7861('0x46')]=qs[_0x7861('0x3d')](_['pick'](_0x2625bd[_0x7861('0x3b')],_0x225178[_0x7861('0x3d')]),_0x305a6a);if(_0x2625bd[_0x7861('0x3b')][_0x7861('0x47')]){_0x106a66[_0x7861('0x46')]=_[_0x7861('0x48')](_0x106a66[_0x7861('0x46')],{'$or':_[_0x7861('0x35')](_0x305a6a,function(_0x5addf0){if(_0x5addf0[_0x7861('0x38')]!==_0x7861('0x49')){var _0x9fec7d={};_0x9fec7d[_0x5addf0['name']]={'$like':'%'+_0x2625bd[_0x7861('0x3b')]['filter']+'%'};return _0x9fec7d;}})});}_0x106a66=_[_0x7861('0x48')]({},_0x106a66,_0x2625bd[_0x7861('0x4a')]);var _0x20b3b9={'where':_0x106a66[_0x7861('0x46')]};return db['Dashboard'][_0x7861('0x24')](_0x20b3b9)[_0x7861('0x2c')](function(_0xeebd5f){_0x228194[_0x7861('0x24')]=_0xeebd5f;if(_0x2625bd['query'][_0x7861('0x4b')]){_0x106a66[_0x7861('0x4c')]=[{'all':!![]}];}return db['Dashboard'][_0x7861('0x4d')](_0x106a66);})['then'](function(_0xa006ba){_0x228194['rows']=_0xa006ba;return _0x228194;})[_0x7861('0x2c')](respondWithFilteredResult(_0x30c543,_0x106a66))[_0x7861('0x4e')](handleError(_0x30c543,null));};exports[_0x7861('0x4f')]=function(_0x35578c,_0x55cea1){var _0x5b40e0={'raw':![],'where':{'id':_0x35578c[_0x7861('0x50')]['id']}},_0x35710a={};_0x35710a['model']=_[_0x7861('0x3c')](db[_0x7861('0x51')][_0x7861('0x36')]);_0x35710a[_0x7861('0x3b')]=_[_0x7861('0x3c')](_0x35578c[_0x7861('0x3b')]);_0x35710a['filters']=_[_0x7861('0x3e')](_0x35710a['model'],_0x35710a[_0x7861('0x3b')]);_0x5b40e0[_0x7861('0x3f')]=_[_0x7861('0x3e')](_0x35710a['model'],qs[_0x7861('0x40')](_0x35578c[_0x7861('0x3b')]['fields']));_0x5b40e0[_0x7861('0x3f')]=_0x5b40e0['attributes'][_0x7861('0x41')]?_0x5b40e0[_0x7861('0x3f')]:_0x35710a[_0x7861('0x3a')];if(_0x35578c['query']['includeAll']){_0x5b40e0[_0x7861('0x4c')]=[{'all':!![]}];}_0x5b40e0=_[_0x7861('0x48')]({},_0x5b40e0,_0x35578c[_0x7861('0x4a')]);return db[_0x7861('0x51')][_0x7861('0x52')](_0x5b40e0)[_0x7861('0x2c')](handleEntityNotFound(_0x55cea1,null))[_0x7861('0x2c')](respondWithResult(_0x55cea1,null))[_0x7861('0x4e')](handleError(_0x55cea1,null));};exports[_0x7861('0x53')]=function(_0x436667,_0x252ed0){return db[_0x7861('0x51')][_0x7861('0x53')](_0x436667[_0x7861('0x54')],{})['then'](function(_0x47e367){var _0x23e0d2=_0x436667[_0x7861('0x55')][_0x7861('0x56')]({'plain':!![]});if(!_0x23e0d2)throw new Error(_0x7861('0x57'));if(_0x23e0d2[_0x7861('0x58')]===_0x7861('0x55')){var _0xb5b00a=_0x47e367[_0x7861('0x56')]({'plain':!![]});var _0x51d3ca=_0x7861('0x2d');return db[_0x7861('0x59')][_0x7861('0x52')]({'where':{'name':_0x51d3ca,'userProfileId':_0x23e0d2[_0x7861('0x5a')]},'raw':!![]})[_0x7861('0x2c')](function(_0x509309){if(_0x509309&&_0x509309[_0x7861('0x5b')]===0x0){return db[_0x7861('0x2e')][_0x7861('0x53')]({'name':_0xb5b00a[_0x7861('0x32')],'resourceId':_0xb5b00a['id'],'type':_0x509309[_0x7861('0x32')],'sectionId':_0x509309['id']},{})[_0x7861('0x2c')](function(){return _0x47e367;});}else{return _0x47e367;}})[_0x7861('0x4e')](function(_0x504b60){logger[_0x7861('0x30')](_0x7861('0x5c'),_0x504b60);throw _0x504b60;});}return _0x47e367;})[_0x7861('0x2c')](respondWithResult(_0x252ed0,0xc9))['catch'](handleError(_0x252ed0,null));};exports[_0x7861('0x5d')]=function(_0x1b45a9,_0x505b08){var _0x5ddc83={'where':{'id':_0x1b45a9[_0x7861('0x50')]['id']}},_0x38579d={};_0x38579d[_0x7861('0x3a')]=_[_0x7861('0x3c')](db[_0x7861('0x51')]['rawAttributes']);_0x5ddc83[_0x7861('0x3f')]=_['intersection'](_0x38579d[_0x7861('0x3a')],qs[_0x7861('0x40')](_0x1b45a9[_0x7861('0x3b')][_0x7861('0x40')]));_0x5ddc83[_0x7861('0x3f')]=_0x5ddc83['attributes'][_0x7861('0x41')]?_0x5ddc83[_0x7861('0x3f')]:_0x38579d[_0x7861('0x3a')];if(_0x1b45a9[_0x7861('0x3b')][_0x7861('0x4b')]){_0x5ddc83[_0x7861('0x4c')]=[{'all':!![]}];}_0x5ddc83=_[_0x7861('0x48')]({},_0x5ddc83,_0x1b45a9[_0x7861('0x4a')]);return db['Dashboard'][_0x7861('0x52')](_0x5ddc83)['then'](handleEntityNotFound(_0x505b08,null))['then'](function(_0x4bcf84){if(_0x4bcf84){var _0x1651f3=_0x4bcf84[_0x7861('0x56')]({'plain':!![]});_0x1651f3=qs[_0x7861('0x5e')](_0x1651f3,['id',_0x7861('0x5f'),'updatedAt']);_0x1b45a9[_0x7861('0x54')]=_[_0x7861('0x5e')](_0x1b45a9[_0x7861('0x54')],['id','createdAt',_0x7861('0x60')]);return db[_0x7861('0x51')]['create'](_[_0x7861('0x48')](_0x1651f3,_0x1b45a9['body']),{'include':_0x1b45a9[_0x7861('0x3b')][_0x7861('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x225f2e){var _0x19fb2e=_0x1b45a9[_0x7861('0x55')][_0x7861('0x56')]({'plain':!![]});if(!_0x19fb2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19fb2e[_0x7861('0x58')]===_0x7861('0x55')){var _0x7c422b=_0x225f2e[_0x7861('0x56')]({'plain':!![]});var _0x54d5a9='CustomDashboards';return db[_0x7861('0x59')][_0x7861('0x52')]({'where':{'name':_0x54d5a9,'userProfileId':_0x19fb2e[_0x7861('0x5a')]},'raw':!![]})[_0x7861('0x2c')](function(_0x131a43){if(_0x131a43&&_0x131a43[_0x7861('0x5b')]===0x0){return db[_0x7861('0x2e')][_0x7861('0x53')]({'name':_0x7c422b[_0x7861('0x32')],'resourceId':_0x7c422b['id'],'type':_0x131a43[_0x7861('0x32')],'sectionId':_0x131a43['id']},{})[_0x7861('0x2c')](function(){return _0x225f2e;});}else{return _0x225f2e;}})[_0x7861('0x4e')](function(_0x47e4ec){logger[_0x7861('0x30')](_0x7861('0x5c'),_0x47e4ec);throw _0x47e4ec;});}return _0x225f2e;});}})[_0x7861('0x2c')](respondWithResult(_0x505b08,0xc9))[_0x7861('0x4e')](handleError(_0x505b08,null));};exports[_0x7861('0x2b')]=function(_0x4dcce7,_0x22afaa){if(_0x4dcce7[_0x7861('0x54')]['id']){delete _0x4dcce7[_0x7861('0x54')]['id'];}return db['Dashboard'][_0x7861('0x52')]({'where':{'id':_0x4dcce7['params']['id']}})[_0x7861('0x2c')](handleEntityNotFound(_0x22afaa,null))[_0x7861('0x2c')](saveUpdates(_0x4dcce7[_0x7861('0x54')],null))['then'](respondWithResult(_0x22afaa,null))['catch'](handleError(_0x22afaa,null));};exports['destroy']=function(_0xdde62b,_0x3ef008){return db[_0x7861('0x51')][_0x7861('0x52')]({'where':{'id':_0xdde62b['params']['id']}})['then'](handleEntityNotFound(_0x3ef008,null))[_0x7861('0x2c')](removeEntity(_0x3ef008,null))['catch'](handleError(_0x3ef008,null));};function widgetAttributes(_0x3b812a){try{switch(_0x3b812a[_0x7861('0x38')]){case _0x7861('0x61'):return[{'name':_0x7861('0x62'),'value':_0x3b812a[_0x7861('0x62')]||(_0x3b812a['attrs']&&_0x3b812a['attrs'][0x0]?_0x3b812a[_0x7861('0x63')][0x0]['value']:undefined)||_0x7861('0x64')}];case'custom':return[{'name':'attrPath','value':_0x3b812a[_0x7861('0x65')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a['attrs'][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x66')]:undefined)||''}];case _0x7861('0x67'):return[{'name':_0x7861('0x68'),'value':_0x3b812a[_0x7861('0x68')]||(_0x3b812a['attrs']&&_0x3b812a['attrs'][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x66')]:undefined)||_0x7861('0x69')},{'name':'attrTimezone','value':_0x3b812a[_0x7861('0x6a')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x1]?_0x3b812a[_0x7861('0x63')][0x1][_0x7861('0x66')]:undefined)||'0.00'},{'name':_0x7861('0x6b'),'value':_0x3b812a[_0x7861('0x6b')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x2]?_0x3b812a['attrs'][0x2][_0x7861('0x66')]:undefined)||0xc}];case _0x7861('0x6c'):return[{'name':_0x7861('0x6d'),'value':_0x3b812a[_0x7861('0x6d')]||(_0x3b812a['attrs']&&_0x3b812a['attrs'][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x66')]:undefined)||_0x7861('0x6e')},{'name':_0x7861('0x6f'),'value':_0x3b812a[_0x7861('0x6f')]||(_0x3b812a['attrs']&&_0x3b812a[_0x7861('0x63')][0x1]?_0x3b812a[_0x7861('0x63')][0x1][_0x7861('0x66')]:undefined)||[]},{'name':_0x7861('0x6b'),'value':_0x3b812a[_0x7861('0x6b')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x2]?_0x3b812a[_0x7861('0x63')][0x2]['value']:undefined)||0x14},{'name':_0x7861('0x70'),'value':_0x3b812a[_0x7861('0x70')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x3]?_0x3b812a[_0x7861('0x63')][0x3][_0x7861('0x66')]:undefined)||_0x7861('0x71')},{'name':_0x7861('0x72'),'value':_0x3b812a[_0x7861('0x72')]||(_0x3b812a['attrs']&&_0x3b812a[_0x7861('0x63')][0x4]?_0x3b812a[_0x7861('0x63')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3b812a[_0x7861('0x73')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x5]?_0x3b812a[_0x7861('0x63')][0x5][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x74'),'value':_0x3b812a[_0x7861('0x74')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x6]?_0x3b812a['attrs'][0x6][_0x7861('0x66')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3b812a[_0x7861('0x75')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x7]?_0x3b812a[_0x7861('0x63')][0x7][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x76'),'value':_0x3b812a['attrWhatsappAccounts']||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x8]?_0x3b812a[_0x7861('0x63')][0x8]['value']:undefined)||''},{'name':_0x7861('0x77'),'value':_0x3b812a['attrChatWebsites']||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a['attrs'][0x9]?_0x3b812a[_0x7861('0x63')][0x9]['value']:undefined)||''}];case _0x7861('0x78'):case _0x7861('0x79'):return[{'name':_0x7861('0x7a'),'value':_0x3b812a[_0x7861('0x7a')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x66')]:undefined)||_0x7861('0x6e')},{'name':_0x7861('0x7b'),'value':_0x3b812a[_0x7861('0x7b')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x1]?_0x3b812a['attrs'][0x1][_0x7861('0x66')]:undefined)||null},{'name':'attrSerie3','value':_0x3b812a['attrSerie3']||(_0x3b812a['attrs']&&_0x3b812a['attrs'][0x2]?_0x3b812a[_0x7861('0x63')][0x2][_0x7861('0x66')]:undefined)||null},{'name':_0x7861('0x6f'),'value':_0x3b812a['attrVoiceQueues']||(_0x3b812a['attrs']&&_0x3b812a[_0x7861('0x63')][0x3]?_0x3b812a[_0x7861('0x63')][0x3][_0x7861('0x66')]:undefined)||[]},{'name':_0x7861('0x70'),'value':_0x3b812a[_0x7861('0x70')]||(_0x3b812a['attrs']&&_0x3b812a[_0x7861('0x63')][0x4]?_0x3b812a[_0x7861('0x63')][0x4][_0x7861('0x66')]:undefined)||'voice'},{'name':_0x7861('0x72'),'value':_0x3b812a[_0x7861('0x72')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a['attrs'][0x5]?_0x3b812a[_0x7861('0x63')][0x5][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x73'),'value':_0x3b812a[_0x7861('0x73')]||(_0x3b812a['attrs']&&_0x3b812a[_0x7861('0x63')][0x6]?_0x3b812a['attrs'][0x6][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x74'),'value':_0x3b812a['attrSmsAccounts']||(_0x3b812a['attrs']&&_0x3b812a['attrs'][0x7]?_0x3b812a[_0x7861('0x63')][0x7][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x75'),'value':_0x3b812a[_0x7861('0x75')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x8]?_0x3b812a[_0x7861('0x63')][0x8][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x76'),'value':_0x3b812a[_0x7861('0x76')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x9]?_0x3b812a['attrs'][0x9][_0x7861('0x66')]:undefined)||''},{'name':_0x7861('0x77'),'value':_0x3b812a[_0x7861('0x77')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0xa]?_0x3b812a[_0x7861('0x63')][0xa]['value']:undefined)||''}];case _0x7861('0x7c'):return[{'name':_0x7861('0x7d'),'type':_0x3b812a[_0x7861('0x7e')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a['attrs'][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x38')]:undefined)||null,'value':_0x3b812a['attrReport']||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x0]?_0x3b812a[_0x7861('0x63')][0x0][_0x7861('0x66')]:undefined)||null},{'name':_0x7861('0x7f'),'value':_0x3b812a[_0x7861('0x7f')]||(_0x3b812a[_0x7861('0x63')]&&_0x3b812a[_0x7861('0x63')][0x1]?_0x3b812a['attrs'][0x1][_0x7861('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x4282a3){logger[_0x7861('0x30')](_0x7861('0x80'),JSON['stringify'](_0x4282a3));return[];}}exports[_0x7861('0x81')]=function(_0x36a3ee,_0x9d4571,_0x9f0d74){if(_0x36a3ee[_0x7861('0x54')]['id']){delete _0x36a3ee[_0x7861('0x54')]['id'];}return db[_0x7861('0x51')]['find']({'where':{'id':_0x36a3ee[_0x7861('0x50')]['id']}})[_0x7861('0x2c')](handleEntityNotFound(_0x9d4571,null))[_0x7861('0x2c')](function(_0x5567a4){if(_0x5567a4){_0x36a3ee[_0x7861('0x54')][_0x7861('0x82')]=_0x5567a4['id'];_0x36a3ee[_0x7861('0x54')][_0x7861('0x63')]=widgetAttributes(_0x36a3ee[_0x7861('0x54')]);return db[_0x7861('0x83')]['create'](_0x36a3ee[_0x7861('0x54')]);}})[_0x7861('0x2c')](respondWithResult(_0x9d4571,null))['catch'](handleError(_0x9d4571,null));};exports[_0x7861('0x84')]=function(_0x461850,_0x4b8521,_0x4c9e39){var _0x4f3b65={};var _0x4fe774={};var _0x1da8ff;var _0x2efdc9;return db['Dashboard'][_0x7861('0x85')]({'where':{'id':_0x461850[_0x7861('0x50')]['id']}})[_0x7861('0x2c')](handleEntityNotFound(_0x4b8521,null))['then'](function(_0x50867b){if(_0x50867b){_0x1da8ff=_0x50867b;_0x4fe774[_0x7861('0x3a')]=_[_0x7861('0x3c')](db[_0x7861('0x83')][_0x7861('0x36')]);_0x4fe774[_0x7861('0x3b')]=_[_0x7861('0x3c')](_0x461850['query']);_0x4fe774[_0x7861('0x3d')]=_[_0x7861('0x3e')](_0x4fe774[_0x7861('0x3a')],_0x4fe774[_0x7861('0x3b')]);_0x4f3b65[_0x7861('0x3f')]=_[_0x7861('0x3e')](_0x4fe774['model'],qs['fields'](_0x461850[_0x7861('0x3b')][_0x7861('0x40')]));_0x4f3b65[_0x7861('0x3f')]=_0x4f3b65[_0x7861('0x3f')][_0x7861('0x41')]?_0x4f3b65[_0x7861('0x3f')]:_0x4fe774[_0x7861('0x3a')];_0x4f3b65[_0x7861('0x44')]=qs[_0x7861('0x45')](_0x461850['query']['sort']);_0x4f3b65[_0x7861('0x46')]=qs[_0x7861('0x3d')](_[_0x7861('0x86')](_0x461850[_0x7861('0x3b')],_0x4fe774[_0x7861('0x3d')]));if(_0x461850[_0x7861('0x3b')][_0x7861('0x47')]){_0x4f3b65[_0x7861('0x46')]=_['merge'](_0x4f3b65[_0x7861('0x46')],{'$or':_[_0x7861('0x35')](_0x4f3b65['attributes'],function(_0x33df0c){var _0x4844c2={};_0x4844c2[_0x33df0c]={'$like':'%'+_0x461850[_0x7861('0x3b')][_0x7861('0x47')]+'%'};return _0x4844c2;})});}_0x4f3b65=_[_0x7861('0x48')]({},_0x4f3b65,_0x461850[_0x7861('0x4a')]);return _0x1da8ff['getItems'](_0x4f3b65);}})[_0x7861('0x2c')](function(_0x15f4ea){if(_0x15f4ea){_0x2efdc9=_0x15f4ea[_0x7861('0x41')];if(!_0x461850[_0x7861('0x3b')][_0x7861('0x42')](_0x7861('0x43'))){_0x4f3b65[_0x7861('0x25')]=qs[_0x7861('0x25')](_0x461850[_0x7861('0x3b')][_0x7861('0x25')]);_0x4f3b65['offset']=qs[_0x7861('0x22')](_0x461850[_0x7861('0x3b')][_0x7861('0x22')]);}return _0x1da8ff[_0x7861('0x84')](_0x4f3b65);}})[_0x7861('0x2c')](function(_0x40a935){if(_0x40a935){return _0x40a935?{'count':_0x2efdc9,'rows':_0x40a935}:null;}})[_0x7861('0x2c')](respondWithResult(_0x4b8521,null))[_0x7861('0x4e')](handleError(_0x4b8521,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 24f74d0..ba65e3a 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 _0x3784=['../../mysqldb','Dashboard','setMaxListeners','save','remove','hasOwnProperty','exports','events'];(function(_0x5d4eff,_0x5ae22c){var _0xc4a902=function(_0x490247){while(--_0x490247){_0x5d4eff['push'](_0x5d4eff['shift']());}};_0xc4a902(++_0x5ae22c);}(_0x3784,0x16f));var _0x4378=function(_0x15039,_0x30581f){_0x15039=_0x15039-0x0;var _0x33f410=_0x3784[_0x15039];return _0x33f410;};'use strict';var EventEmitter=require(_0x4378('0x0'));var Dashboard=require(_0x4378('0x1'))['db'][_0x4378('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4378('0x3')](0x0);var events={'afterCreate':_0x4378('0x4'),'afterUpdate':'update','afterDestroy':_0x4378('0x5')};function emitEvent(_0x2e4a13){return function(_0x13c237,_0x9f63f4,_0x5e7920){DashboardEvents['emit'](_0x2e4a13+':'+_0x13c237['id'],_0x13c237);DashboardEvents['emit'](_0x2e4a13,_0x13c237);_0x5e7920(null);};}for(var e in events){if(events[_0x4378('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x4378('0x7')]=DashboardEvents; \ No newline at end of file +var _0x281c=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2c825c,_0x4f2d92){var _0x3fc887=function(_0x505f8b){while(--_0x505f8b){_0x2c825c['push'](_0x2c825c['shift']());}};_0x3fc887(++_0x4f2d92);}(_0x281c,0x82));var _0xc281=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x281c[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xc281('0x0'));var Dashboard=require(_0xc281('0x1'))['db'][_0xc281('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc281('0x3')](0x0);var events={'afterCreate':_0xc281('0x4'),'afterUpdate':_0xc281('0x5'),'afterDestroy':_0xc281('0x6')};function emitEvent(_0x10ec8f){return function(_0x137409,_0x42fc38,_0x50d647){DashboardEvents['emit'](_0x10ec8f+':'+_0x137409['id'],_0x137409);DashboardEvents[_0xc281('0x7')](_0x10ec8f,_0x137409);_0x50d647(null);};}for(var e in events){if(events[_0xc281('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc281('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 0567488..988a66e 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 _0x5e28=['define','Dashboard','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x3f8a6b,_0x1412b0){var _0x467399=function(_0x3959c7){while(--_0x3959c7){_0x3f8a6b['push'](_0x3f8a6b['shift']());}};_0x467399(++_0x1412b0);}(_0x5e28,0x157));var _0x85e2=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x5e28[_0x31b5b2];return _0x364f13;};'use strict';var _=require('lodash');var util=require(_0x85e2('0x0'));var logger=require(_0x85e2('0x1'))(_0x85e2('0x2'));var moment=require('moment');var BPromise=require(_0x85e2('0x3'));var rp=require(_0x85e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85e2('0x5'));var config=require(_0x85e2('0x6'));var attributes=require(_0x85e2('0x7'));module[_0x85e2('0x8')]=function(_0x1ce7ac,_0x4f06bd){return _0x1ce7ac[_0x85e2('0x9')](_0x85e2('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae59=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dashboard','dashboards'];(function(_0x584043,_0x3f19bc){var _0x2e4ec6=function(_0x138c3b){while(--_0x138c3b){_0x584043['push'](_0x584043['shift']());}};_0x2e4ec6(++_0x3f19bc);}(_0xae59,0xea));var _0x9ae5=function(_0x3e834d,_0x57ea65){_0x3e834d=_0x3e834d-0x0;var _0x1ce3cc=_0xae59[_0x3e834d];return _0x1ce3cc;};'use strict';var _=require(_0x9ae5('0x0'));var util=require(_0x9ae5('0x1'));var logger=require(_0x9ae5('0x2'))(_0x9ae5('0x3'));var moment=require('moment');var BPromise=require(_0x9ae5('0x4'));var rp=require(_0x9ae5('0x5'));var fs=require('fs');var path=require(_0x9ae5('0x6'));var rimraf=require(_0x9ae5('0x7'));var config=require(_0x9ae5('0x8'));var attributes=require('./dashboard.attributes');module[_0x9ae5('0x9')]=function(_0x4c04cf,_0x394e5c){return _0x4c04cf[_0x9ae5('0xa')](_0x9ae5('0xb'),attributes,{'tableName':_0x9ae5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 20ff827..dcd903c 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 _0xe5b9=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xe5b9,0x7b));var _0x9e5b=function(_0x5de383,_0xec2e74){_0x5de383=_0x5de383-0x0;var _0x2024fb=_0xe5b9[_0x5de383];return _0x2024fb;};'use strict';var _=require(_0x9e5b('0x0'));var util=require(_0x9e5b('0x1'));var moment=require('moment');var BPromise=require(_0x9e5b('0x2'));var rs=require(_0x9e5b('0x3'));var fs=require('fs');var Redis=require(_0x9e5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e5b('0x5'));var logger=require('../../config/logger')(_0x9e5b('0x6'));var config=require(_0x9e5b('0x7'));var jayson=require(_0x9e5b('0x8'));var client=jayson[_0x9e5b('0x9')][_0x9e5b('0xa')]({'port':0x232a});config[_0x9e5b('0xb')]=_[_0x9e5b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e5b('0xd'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4500c9,_0x6ea3c9,_0x412253){return new BPromise(function(_0x2ea5fd,_0x2de380){return client[_0x9e5b('0xe')](_0x4500c9,_0x412253)[_0x9e5b('0xf')](function(_0x3358ba){logger[_0x9e5b('0x10')](_0x9e5b('0x11'),_0x6ea3c9,_0x9e5b('0x12'));logger[_0x9e5b('0x13')](_0x9e5b('0x14'),_0x6ea3c9,'request\x20sent',JSON[_0x9e5b('0x15')](_0x3358ba));if(_0x3358ba[_0x9e5b('0x16')]){if(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x17')]===0x1f4){logger['error'](_0x9e5b('0x11'),_0x6ea3c9,_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);return _0x2de380(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);}logger['error'](_0x9e5b('0x11'),_0x6ea3c9,_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);return _0x2ea5fd(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);}else{logger[_0x9e5b('0x10')](_0x9e5b('0x11'),_0x6ea3c9,_0x9e5b('0x12'));_0x2ea5fd(_0x3358ba[_0x9e5b('0x19')][_0x9e5b('0x18')]);}})['catch'](function(_0x4e0185){logger[_0x9e5b('0x16')](_0x9e5b('0x11'),_0x6ea3c9,_0x4e0185);_0x2de380(_0x4e0185);});});} \ No newline at end of file +var _0x28c8=['Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','./dashboard.socket','register','then','info'];(function(_0xae7bc4,_0x355383){var _0x2155cb=function(_0x511743){while(--_0x511743){_0xae7bc4['push'](_0xae7bc4['shift']());}};_0x2155cb(++_0x355383);}(_0x28c8,0x127));var _0x828c=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x28c8[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var util=require(_0x828c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x828c('0x1'));var db=require(_0x828c('0x2'))['db'];var utils=require(_0x828c('0x3'));var logger=require('../../config/logger')(_0x828c('0x4'));var config=require(_0x828c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x828c('0x6')]['http']({'port':0x232a});config[_0x828c('0x7')]=_[_0x828c('0x8')](config[_0x828c('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x828c('0x9'))[_0x828c('0xa')](socket);function respondWithRpcPromise(_0xb1db49,_0x1f6881,_0x294906){return new BPromise(function(_0x2a3a15,_0x16663d){return client['request'](_0xb1db49,_0x294906)[_0x828c('0xb')](function(_0x27211a){logger[_0x828c('0xc')](_0x828c('0xd'),_0x1f6881,_0x828c('0xe'));logger['debug'](_0x828c('0xf'),_0x1f6881,_0x828c('0xe'),JSON[_0x828c('0x10')](_0x27211a));if(_0x27211a['error']){if(_0x27211a[_0x828c('0x11')][_0x828c('0x12')]===0x1f4){logger['error'](_0x828c('0xd'),_0x1f6881,_0x27211a['error'][_0x828c('0x13')]);return _0x16663d(_0x27211a['error'][_0x828c('0x13')]);}logger[_0x828c('0x11')](_0x828c('0xd'),_0x1f6881,_0x27211a[_0x828c('0x11')][_0x828c('0x13')]);return _0x2a3a15(_0x27211a['error'][_0x828c('0x13')]);}else{logger[_0x828c('0xc')](_0x828c('0xd'),_0x1f6881,_0x828c('0xe'));_0x2a3a15(_0x27211a[_0x828c('0x14')][_0x828c('0x13')]);}})[_0x828c('0x15')](function(_0xfc79f7){logger[_0x828c('0x11')](_0x828c('0xd'),_0x1f6881,_0xfc79f7);_0x16663d(_0xfc79f7);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index de787ec..fd96266 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 _0x81ee=['emit','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x1f507f,_0x4b3542){var _0x58d038=function(_0x688d71){while(--_0x688d71){_0x1f507f['push'](_0x1f507f['shift']());}};_0x58d038(++_0x4b3542);}(_0x81ee,0x161));var _0xe81e=function(_0x4f8e3e,_0xbea39){_0x4f8e3e=_0x4f8e3e-0x0;var _0x40b0eb=_0x81ee[_0x4f8e3e];return _0x40b0eb;};'use strict';var DashboardEvents=require(_0xe81e('0x0'));var events=[_0xe81e('0x1'),_0xe81e('0x2'),_0xe81e('0x3')];function createListener(_0x1f30a5,_0x2a4f95){return function(_0x29db74){_0x2a4f95[_0xe81e('0x4')](_0x1f30a5,_0x29db74);};}function removeListener(_0x4975a0,_0x76a77d){return function(){DashboardEvents['removeListener'](_0x4975a0,_0x76a77d);};}exports['register']=function(_0x5e2c94){for(var _0xa09feb=0x0,_0x22a878=events[_0xe81e('0x5')];_0xa09feb<_0x22a878;_0xa09feb++){var _0x4f5152=events[_0xa09feb];var _0xc9eb1e=createListener(_0xe81e('0x6')+_0x4f5152,_0x5e2c94);DashboardEvents['on'](_0x4f5152,_0xc9eb1e);}}; \ No newline at end of file +var _0x76b3=['update','emit','removeListener','length','dashboard:'];(function(_0x40116a,_0x405d69){var _0x4f180a=function(_0x6dcae7){while(--_0x6dcae7){_0x40116a['push'](_0x40116a['shift']());}};_0x4f180a(++_0x405d69);}(_0x76b3,0x12c));var _0x376b=function(_0xaa5ced,_0x2b4cde){_0xaa5ced=_0xaa5ced-0x0;var _0x1c276c=_0x76b3[_0xaa5ced];return _0x1c276c;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0x376b('0x0')];function createListener(_0x303e6a,_0x25e601){return function(_0x3bde2f){_0x25e601[_0x376b('0x1')](_0x303e6a,_0x3bde2f);};}function removeListener(_0x5e0049,_0x27f7e6){return function(){DashboardEvents[_0x376b('0x2')](_0x5e0049,_0x27f7e6);};}exports['register']=function(_0xf5b72a){for(var _0x1b75ae=0x0,_0x457c1d=events[_0x376b('0x3')];_0x1b75ae<_0x457c1d;_0x1b75ae++){var _0x14e1dc=events[_0x1b75ae];var _0x28dfb6=createListener(_0x376b('0x4')+_0x14e1dc,_0xf5b72a);DashboardEvents['on'](_0x14e1dc,_0x28dfb6);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f51990d..5fc0638 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 _0x5fbb=['isAuthenticated','show','getItems','create','post','/:id/clone','clone','/:id/items','addItem','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x5fbb,0xd2));var _0xb5fb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5fbb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb5fb('0x0'));var util=require('util');var path=require(_0xb5fb('0x1'));var timeout=require(_0xb5fb('0x2'));var express=require(_0xb5fb('0x3'));var router=express[_0xb5fb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb5fb('0x5'));var config=require(_0xb5fb('0x6'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb5fb('0x7')]);router[_0xb5fb('0x8')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xb')]);router['get']('/:id/items',auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xc')]);router['post']('/',auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xd')]);router[_0xb5fb('0xe')](_0xb5fb('0xf'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0x10')]);router[_0xb5fb('0xe')](_0xb5fb('0x11'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0x12')]);router[_0xb5fb('0x13')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller['update']);router[_0xb5fb('0x14')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller['destroy']);module[_0xb5fb('0x15')]=router; \ No newline at end of file +var _0x4ead=['/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x45e0af,_0x21d092){var _0xcb0471=function(_0x72feb0){while(--_0x72feb0){_0x45e0af['push'](_0x45e0af['shift']());}};_0xcb0471(++_0x21d092);}(_0x4ead,0x152));var _0xd4ea=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x4ead[_0x450689];return _0x46ffb0;};'use strict';var multer=require(_0xd4ea('0x0'));var util=require(_0xd4ea('0x1'));var path=require(_0xd4ea('0x2'));var timeout=require(_0xd4ea('0x3'));var express=require(_0xd4ea('0x4'));var router=express[_0xd4ea('0x5')]();var fs_extra=require(_0xd4ea('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd4ea('0x7'));var config=require(_0xd4ea('0x8'));var controller=require('./dashboard.controller');router[_0xd4ea('0x9')]('/',auth[_0xd4ea('0xa')](),controller[_0xd4ea('0xb')]);router[_0xd4ea('0x9')](_0xd4ea('0xc'),auth[_0xd4ea('0xa')](),controller['show']);router['get'](_0xd4ea('0xd'),auth[_0xd4ea('0xa')](),controller[_0xd4ea('0xe')]);router[_0xd4ea('0xf')]('/',auth[_0xd4ea('0xa')](),controller[_0xd4ea('0x10')]);router[_0xd4ea('0xf')](_0xd4ea('0x11'),auth[_0xd4ea('0xa')](),controller[_0xd4ea('0x12')]);router[_0xd4ea('0xf')](_0xd4ea('0xd'),auth[_0xd4ea('0xa')](),controller[_0xd4ea('0x13')]);router[_0xd4ea('0x14')]('/:id',auth[_0xd4ea('0xa')](),controller[_0xd4ea('0x15')]);router[_0xd4ea('0x16')](_0xd4ea('0xc'),auth[_0xd4ea('0xa')](),controller[_0xd4ea('0x17')]);module[_0xd4ea('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 87f7436..c772eba 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 _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x53fa52,_0x265b56){var _0x58e010=function(_0x576649){while(--_0x576649){_0x53fa52['push'](_0x53fa52['shift']());}};_0x58e010(++_0x265b56);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5496,0x175));var _0x6549=function(_0x38fe3f,_0x26bbdf){_0x38fe3f=_0x38fe3f-0x0;var _0x56862e=_0x5496[_0x38fe3f];return _0x56862e;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('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 945a198..f5d6e93 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 _0xab3f=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','stack','name','send','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','DashboardItem','find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x1d4f5c,_0x293cdc){var _0x1e7e7c=function(_0x30f7fd){while(--_0x30f7fd){_0x1d4f5c['push'](_0x1d4f5c['shift']());}};_0x1e7e7c(++_0x293cdc);}(_0xab3f,0x72));var _0xfab3=function(_0x1d87a7,_0x5b6526){_0x1d87a7=_0x1d87a7-0x0;var _0xd46ae0=_0xab3f[_0x1d87a7];return _0xd46ae0;};'use strict';var emlformat=require(_0xfab3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab3('0x1'));var jsonpatch=require(_0xfab3('0x2'));var rp=require(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));var Mustache=require(_0xfab3('0x6'));var util=require(_0xfab3('0x7'));var path=require(_0xfab3('0x8'));var sox=require(_0xfab3('0x9'));var csv=require(_0xfab3('0xa'));var ejs=require(_0xfab3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfab3('0xc'));var squel=require(_0xfab3('0xd'));var crypto=require(_0xfab3('0xe'));var jsforce=require(_0xfab3('0xf'));var deskjs=require(_0xfab3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfab3('0x11'));var Redis=require('ioredis');var authService=require(_0xfab3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfab3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfab3('0x14'))(_0xfab3('0x15'));var utils=require(_0xfab3('0x16'));var config=require(_0xfab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfab3('0x18')](config[_0xfab3('0x19')],{'host':_0xfab3('0x1a'),'port':0x18eb});var socket=require(_0xfab3('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xfab3('0x1c')](socket);function respondWithStatusCode(_0x21b629,_0x5912b6){_0x5912b6=_0x5912b6||0xcc;return function(_0x237685){if(_0x237685){return _0x21b629[_0xfab3('0x1d')](_0x5912b6);}return _0x21b629[_0xfab3('0x1e')](_0x5912b6)[_0xfab3('0x1f')]();};}function respondWithResult(_0xd76ff9,_0x5d9ea1){_0x5d9ea1=_0x5d9ea1||0xc8;return function(_0x584115){if(_0x584115){return _0xd76ff9[_0xfab3('0x1e')](_0x5d9ea1)[_0xfab3('0x20')](_0x584115);}};}function respondWithFilteredResult(_0x3d3d77,_0xaac714){return function(_0x3d08b1){if(_0x3d08b1){var _0x23cd33=typeof _0xaac714[_0xfab3('0x21')]===_0xfab3('0x22')&&typeof _0xaac714[_0xfab3('0x23')]==='undefined';var _0x516fcc=_0x3d08b1[_0xfab3('0x24')];var _0x129e58=_0x23cd33?0x0:_0xaac714[_0xfab3('0x21')];var _0x4944c5=_0x23cd33?_0x3d08b1[_0xfab3('0x24')]:_0xaac714[_0xfab3('0x21')]+_0xaac714[_0xfab3('0x23')];var _0x1200f7;if(_0x4944c5>=_0x516fcc){_0x4944c5=_0x516fcc;_0x1200f7=0xc8;}else{_0x1200f7=0xce;}_0x3d3d77[_0xfab3('0x1e')](_0x1200f7);return _0x3d3d77['set']('Content-Range',_0x129e58+'-'+_0x4944c5+'/'+_0x516fcc)['json'](_0x3d08b1);}return null;};}function patchUpdates(_0x41f624){return function(_0x1d6de4){try{jsonpatch[_0xfab3('0x25')](_0x1d6de4,_0x41f624,!![]);}catch(_0x2e6fd3){return BPromise['reject'](_0x2e6fd3);}return _0x1d6de4[_0xfab3('0x26')]();};}function saveUpdates(_0x3f1688,_0x37265e){return function(_0x10699f){if(_0x10699f){return _0x10699f[_0xfab3('0x27')](_0x3f1688)['then'](function(_0x56516e){return _0x56516e;});}return null;};}function removeEntity(_0x4765fb,_0x1d6394){return function(_0x53de31){if(_0x53de31){return _0x53de31['destroy']()[_0xfab3('0x28')](function(){_0x4765fb[_0xfab3('0x1e')](0xcc)[_0xfab3('0x1f')]();});}};}function handleEntityNotFound(_0x55689d,_0x133d2b){return function(_0x2383bb){if(!_0x2383bb){_0x55689d[_0xfab3('0x1d')](0x194);}return _0x2383bb;};}function handleError(_0x2a189a,_0x504444){_0x504444=_0x504444||0x1f4;return function(_0x215105){logger[_0xfab3('0x29')](_0x215105[_0xfab3('0x2a')]);if(_0x215105[_0xfab3('0x2b')]){delete _0x215105[_0xfab3('0x2b')];}_0x2a189a[_0xfab3('0x1e')](_0x504444)[_0xfab3('0x2c')](_0x215105);};}exports['show']=function(_0xb6b6ce,_0xdb1d59){var _0x1ae467={'raw':![],'where':{'id':_0xb6b6ce[_0xfab3('0x2d')]['id']}},_0x43fdab={};_0x43fdab['model']=_[_0xfab3('0x2e')](db['DashboardItem'][_0xfab3('0x2f')]);_0x43fdab[_0xfab3('0x30')]=_['keys'](_0xb6b6ce[_0xfab3('0x30')]);_0x43fdab[_0xfab3('0x31')]=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],_0x43fdab[_0xfab3('0x30')]);_0x1ae467['attributes']=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],qs[_0xfab3('0x34')](_0xb6b6ce[_0xfab3('0x30')][_0xfab3('0x34')]));_0x1ae467[_0xfab3('0x35')]=_0x1ae467[_0xfab3('0x35')][_0xfab3('0x36')]?_0x1ae467[_0xfab3('0x35')]:_0x43fdab['model'];if(_0xb6b6ce['query'][_0xfab3('0x37')]){_0x1ae467[_0xfab3('0x38')]=[{'all':!![]}];}_0x1ae467=_['merge']({},_0x1ae467,_0xb6b6ce[_0xfab3('0x39')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')](_0x1ae467)[_0xfab3('0x28')](handleEntityNotFound(_0xdb1d59,null))[_0xfab3('0x28')](respondWithResult(_0xdb1d59,null))['catch'](handleError(_0xdb1d59,null));};exports[_0xfab3('0x3c')]=function(_0xcc2b6c,_0x6d9ba3){return db['DashboardItem']['find']({'where':{'id':_0xcc2b6c['params']['id']}})['then'](handleEntityNotFound(_0x6d9ba3,null))[_0xfab3('0x28')](removeEntity(_0x6d9ba3,null))[_0xfab3('0x3d')](handleError(_0x6d9ba3,null));};function widgetAttributes(_0x2438a0){try{switch(_0x2438a0[_0xfab3('0x3e')]){case _0xfab3('0x3f'):return[{'name':_0xfab3('0x40'),'value':_0x2438a0[_0xfab3('0x40')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x43')}];case _0xfab3('0x44'):return[{'name':_0xfab3('0x45'),'value':_0x2438a0['attrPath']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x46'):return[{'name':_0xfab3('0x47'),'value':_0x2438a0[_0xfab3('0x47')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||'HH:mm:ss'},{'name':_0xfab3('0x48'),'value':_0x2438a0[_0xfab3('0x48')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||'0.00'},{'name':_0xfab3('0x49'),'value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x2]?_0x2438a0['attrs'][0x2][_0xfab3('0x42')]:undefined)||0xc}];case _0xfab3('0x4a'):return[{'name':_0xfab3('0x4b'),'value':_0x2438a0['attrMetric']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':'attrVoiceQueues','value':_0x2438a0['attrVoiceQueues']||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||0x14},{'name':_0xfab3('0x4d'),'value':_0x2438a0['attrChannel']||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0[_0xfab3('0x41')][0x3][_0xfab3('0x42')]:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0['attrs'][0x5][_0xfab3('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0[_0xfab3('0x52')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x7]?_0x2438a0['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0['attrChatWebsites']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9]['value']:undefined)||''}];case _0xfab3('0x55'):case'pie-chart':return[{'name':_0xfab3('0x56'),'value':_0x2438a0['attrSerie1']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':_0xfab3('0x57'),'value':_0x2438a0['attrSerie2']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x58'),'value':_0x2438a0['attrSerie3']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x59'),'value':_0x2438a0[_0xfab3('0x59')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0['attrs'][0x3]['value']:undefined)||[]},{'name':_0xfab3('0x4d'),'value':_0x2438a0[_0xfab3('0x4d')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4]['value']:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0[_0xfab3('0x41')][0x5][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x51'),'value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x7]?_0x2438a0[_0xfab3('0x41')][0x7][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0['attrOpenchannelAccounts']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x53'),'value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0[_0xfab3('0x54')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0xa]?_0x2438a0['attrs'][0xa][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x5a'):return[{'name':_0xfab3('0x5b'),'type':_0x2438a0[_0xfab3('0x5c')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x3e')]:undefined)||null,'value':_0x2438a0[_0xfab3('0x5b')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0]['value']:undefined)||null},{'name':_0xfab3('0x5d'),'value':_0x2438a0[_0xfab3('0x5d')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x231489){logger['error'](_0xfab3('0x5e'),JSON[_0xfab3('0x5f')](_0x231489));return[];}}exports[_0xfab3('0x60')]=function(_0x1bccc0,_0x12141b){if(_0x1bccc0['body']){_0x1bccc0[_0xfab3('0x61')][_0xfab3('0x41')]=widgetAttributes(_0x1bccc0[_0xfab3('0x61')]);}return db['DashboardItem'][_0xfab3('0x60')](_0x1bccc0[_0xfab3('0x61')],{})[_0xfab3('0x28')](respondWithResult(_0x12141b,0xc9))['catch'](handleError(_0x12141b,null));};exports[_0xfab3('0x27')]=function(_0x3fdc2b,_0x36f011){if(_0x3fdc2b[_0xfab3('0x61')]['id']){delete _0x3fdc2b['body']['id'];}_0x3fdc2b['body'][_0xfab3('0x41')]=widgetAttributes(_0x3fdc2b[_0xfab3('0x61')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')]({'where':{'id':_0x3fdc2b['params']['id']}})[_0xfab3('0x28')](handleEntityNotFound(_0x36f011,null))[_0xfab3('0x28')](saveUpdates(_0x3fdc2b[_0xfab3('0x61')],null))['then'](respondWithResult(_0x36f011,null))[_0xfab3('0x3d')](handleError(_0x36f011,null));}; \ No newline at end of file +var _0x2eb2=['0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','status','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','merge','options','DashboardItem','destroy','find','type','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','value'];(function(_0x33f45f,_0x13afc8){var _0x345098=function(_0x29549f){while(--_0x29549f){_0x33f45f['push'](_0x33f45f['shift']());}};_0x345098(++_0x13afc8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x2eb2[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x22eb('0x16')]=_[_0x22eb('0x17')](config[_0x22eb('0x16')],{'host':_0x22eb('0x18'),'port':0x18eb});var socket=require(_0x22eb('0x19'))(new Redis(config['redis']));require(_0x22eb('0x1a'))['register'](socket);function respondWithStatusCode(_0x1f5089,_0x55ede8){_0x55ede8=_0x55ede8||0xcc;return function(_0x40c8cb){if(_0x40c8cb){return _0x1f5089[_0x22eb('0x1b')](_0x55ede8);}return _0x1f5089['status'](_0x55ede8)['end']();};}function respondWithResult(_0x4bc29a,_0x2ed8a7){_0x2ed8a7=_0x2ed8a7||0xc8;return function(_0x5245fe){if(_0x5245fe){return _0x4bc29a['status'](_0x2ed8a7)[_0x22eb('0x1c')](_0x5245fe);}};}function respondWithFilteredResult(_0x4d9a71,_0x4d9b09){return function(_0xb7a73a){if(_0xb7a73a){var _0x2a55e4=typeof _0x4d9b09[_0x22eb('0x1d')]===_0x22eb('0x1e')&&typeof _0x4d9b09[_0x22eb('0x1f')]==='undefined';var _0x4182a8=_0xb7a73a[_0x22eb('0x20')];var _0x10d182=_0x2a55e4?0x0:_0x4d9b09[_0x22eb('0x1d')];var _0x36be50=_0x2a55e4?_0xb7a73a['count']:_0x4d9b09[_0x22eb('0x1d')]+_0x4d9b09[_0x22eb('0x1f')];var _0x2fc36e;if(_0x36be50>=_0x4182a8){_0x36be50=_0x4182a8;_0x2fc36e=0xc8;}else{_0x2fc36e=0xce;}_0x4d9a71['status'](_0x2fc36e);return _0x4d9a71['set'](_0x22eb('0x21'),_0x10d182+'-'+_0x36be50+'/'+_0x4182a8)[_0x22eb('0x1c')](_0xb7a73a);}return null;};}function patchUpdates(_0x434ecb){return function(_0x44639a){try{jsonpatch[_0x22eb('0x22')](_0x44639a,_0x434ecb,!![]);}catch(_0x3e8c1c){return BPromise[_0x22eb('0x23')](_0x3e8c1c);}return _0x44639a['save']();};}function saveUpdates(_0x2e8f7c,_0x11edbd){return function(_0x3ffa9e){if(_0x3ffa9e){return _0x3ffa9e[_0x22eb('0x24')](_0x2e8f7c)[_0x22eb('0x25')](function(_0x4da252){return _0x4da252;});}return null;};}function removeEntity(_0x12c133,_0x6f8ff3){return function(_0x2f3b39){if(_0x2f3b39){return _0x2f3b39['destroy']()[_0x22eb('0x25')](function(){_0x12c133[_0x22eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a4b6,_0x222ef3){return function(_0x1e3015){if(!_0x1e3015){_0x32a4b6[_0x22eb('0x1b')](0x194);}return _0x1e3015;};}function handleError(_0x2da5c6,_0x4f4f56){_0x4f4f56=_0x4f4f56||0x1f4;return function(_0x49dd59){logger[_0x22eb('0x27')](_0x49dd59[_0x22eb('0x28')]);if(_0x49dd59[_0x22eb('0x29')]){delete _0x49dd59[_0x22eb('0x29')];}_0x2da5c6[_0x22eb('0x26')](_0x4f4f56)[_0x22eb('0x2a')](_0x49dd59);};}exports[_0x22eb('0x2b')]=function(_0x13814f,_0x382784){var _0x39cec1={'raw':![],'where':{'id':_0x13814f[_0x22eb('0x2c')]['id']}},_0x24e9dc={};_0x24e9dc['model']=_[_0x22eb('0x2d')](db['DashboardItem'][_0x22eb('0x2e')]);_0x24e9dc[_0x22eb('0x2f')]=_[_0x22eb('0x2d')](_0x13814f[_0x22eb('0x2f')]);_0x24e9dc[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x24e9dc[_0x22eb('0x32')],_0x24e9dc[_0x22eb('0x2f')]);_0x39cec1[_0x22eb('0x33')]=_[_0x22eb('0x31')](_0x24e9dc['model'],qs['fields'](_0x13814f[_0x22eb('0x2f')]['fields']));_0x39cec1['attributes']=_0x39cec1[_0x22eb('0x33')][_0x22eb('0x34')]?_0x39cec1[_0x22eb('0x33')]:_0x24e9dc[_0x22eb('0x32')];if(_0x13814f[_0x22eb('0x2f')][_0x22eb('0x35')]){_0x39cec1[_0x22eb('0x36')]=[{'all':!![]}];}_0x39cec1=_[_0x22eb('0x37')]({},_0x39cec1,_0x13814f[_0x22eb('0x38')]);return db[_0x22eb('0x39')]['find'](_0x39cec1)[_0x22eb('0x25')](handleEntityNotFound(_0x382784,null))['then'](respondWithResult(_0x382784,null))['catch'](handleError(_0x382784,null));};exports[_0x22eb('0x3a')]=function(_0x2b5cb5,_0x48e47e){return db[_0x22eb('0x39')][_0x22eb('0x3b')]({'where':{'id':_0x2b5cb5[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x48e47e,null))[_0x22eb('0x25')](removeEntity(_0x48e47e,null))['catch'](handleError(_0x48e47e,null));};function widgetAttributes(_0x25f140){try{switch(_0x25f140[_0x22eb('0x3c')]){case'iframe':return[{'name':_0x22eb('0x3d'),'value':_0x25f140[_0x22eb('0x3d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x22eb('0x3f'):return[{'name':_0x22eb('0x40'),'value':_0x25f140['attrPath']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||''}];case _0x22eb('0x41'):return[{'name':_0x22eb('0x42'),'value':_0x25f140[_0x22eb('0x42')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x43')},{'name':_0x22eb('0x44'),'value':_0x25f140['attrTimezone']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||_0x22eb('0x46')},{'name':_0x22eb('0x47'),'value':_0x25f140[_0x22eb('0x47')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||0xc}];case _0x22eb('0x48'):return[{'name':_0x22eb('0x49'),'value':_0x25f140[_0x22eb('0x49')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x45')]:undefined)||'total'},{'name':_0x22eb('0x4a'),'value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x25f140['attrFontSize']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||_0x22eb('0x4c')},{'name':_0x22eb('0x4d'),'value':_0x25f140['attrEmailAccounts']||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140['attrs'][0x4][_0x22eb('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x5]?_0x25f140['attrs'][0x5]['value']:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140['attrSmsAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140['attrs'][0x6][_0x22eb('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x51'),'value':_0x25f140[_0x22eb('0x51')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x8]?_0x25f140['attrs'][0x8][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140['attrChatWebsites']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''}];case'multibar-chart':case _0x22eb('0x53'):return[{'name':_0x22eb('0x54'),'value':_0x25f140[_0x22eb('0x54')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x55')},{'name':'attrSerie2','value':_0x25f140[_0x22eb('0x56')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||null},{'name':_0x22eb('0x57'),'value':_0x25f140[_0x22eb('0x57')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||[]},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140[_0x22eb('0x3e')][0x4][_0x22eb('0x45')]:undefined)||'voice'},{'name':_0x22eb('0x4d'),'value':_0x25f140[_0x22eb('0x4d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x5]?_0x25f140[_0x22eb('0x3e')][0x5][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4e'),'value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140[_0x22eb('0x3e')][0x6][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140[_0x22eb('0x4f')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x50'),'value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x8]?_0x25f140[_0x22eb('0x3e')][0x8][_0x22eb('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x25f140['attrWhatsappAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140[_0x22eb('0x52')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0xa]?_0x25f140[_0x22eb('0x3e')][0xa][_0x22eb('0x45')]:undefined)||''}];case _0x22eb('0x58'):return[{'name':_0x22eb('0x59'),'type':_0x25f140[_0x22eb('0x5a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x3c')]:undefined)||null,'value':_0x25f140[_0x22eb('0x59')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140['attrs'][0x0][_0x22eb('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x25f140[_0x22eb('0x5b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x538bc0){logger['error'](_0x22eb('0x5c'),JSON[_0x22eb('0x5d')](_0x538bc0));return[];}}exports[_0x22eb('0x5e')]=function(_0x344064,_0x3468ca){if(_0x344064[_0x22eb('0x5f')]){_0x344064['body'][_0x22eb('0x3e')]=widgetAttributes(_0x344064['body']);}return db['DashboardItem'][_0x22eb('0x5e')](_0x344064[_0x22eb('0x5f')],{})[_0x22eb('0x25')](respondWithResult(_0x3468ca,0xc9))[_0x22eb('0x60')](handleError(_0x3468ca,null));};exports[_0x22eb('0x24')]=function(_0x797700,_0x400dbe){if(_0x797700[_0x22eb('0x5f')]['id']){delete _0x797700['body']['id'];}_0x797700['body'][_0x22eb('0x3e')]=widgetAttributes(_0x797700[_0x22eb('0x5f')]);return db['DashboardItem'][_0x22eb('0x3b')]({'where':{'id':_0x797700[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x400dbe,null))[_0x22eb('0x25')](saveUpdates(_0x797700[_0x22eb('0x5f')],null))[_0x22eb('0x25')](respondWithResult(_0x400dbe,null))['catch'](handleError(_0x400dbe,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e46627d..018f8d2 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 _0x4972=['../../mysqldb','DashboardItem','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x27b7d2,_0x56c091){var _0x3ef6be=function(_0x6e8a35){while(--_0x6e8a35){_0x27b7d2['push'](_0x27b7d2['shift']());}};_0x3ef6be(++_0x56c091);}(_0x4972,0x130));var _0x2497=function(_0x2b6229,_0xdaf11c){_0x2b6229=_0x2b6229-0x0;var _0x11321b=_0x4972[_0x2b6229];return _0x11321b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x2497('0x0'))['db'][_0x2497('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2497('0x2'),'afterUpdate':_0x2497('0x3'),'afterDestroy':_0x2497('0x4')};function emitEvent(_0x41ee40){return function(_0x2ecf2e,_0x1b4216,_0x3b1662){DashboardItemEvents['emit'](_0x41ee40+':'+_0x2ecf2e['id'],_0x2ecf2e);DashboardItemEvents[_0x2497('0x5')](_0x41ee40,_0x2ecf2e);_0x3b1662(null);};}for(var e in events){if(events[_0x2497('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x2497('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xbdc0=['hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x5ba379,_0x9b8c20){var _0x5b7b73=function(_0x434de2){while(--_0x434de2){_0x5ba379['push'](_0x5ba379['shift']());}};_0x5b7b73(++_0x9b8c20);}(_0xbdc0,0x124));var _0x0bdc=function(_0x3d7012,_0x1049c0){_0x3d7012=_0x3d7012-0x0;var _0x16c750=_0xbdc0[_0x3d7012];return _0x16c750;};'use strict';var EventEmitter=require(_0x0bdc('0x0'));var DashboardItem=require(_0x0bdc('0x1'))['db'][_0x0bdc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0bdc('0x3')](0x0);var events={'afterCreate':_0x0bdc('0x4'),'afterUpdate':_0x0bdc('0x5'),'afterDestroy':_0x0bdc('0x6')};function emitEvent(_0x4f2062){return function(_0x587f89,_0x16ef2b,_0x5cd07e){DashboardItemEvents[_0x0bdc('0x7')](_0x4f2062+':'+_0x587f89['id'],_0x587f89);DashboardItemEvents[_0x0bdc('0x7')](_0x4f2062,_0x587f89);_0x5cd07e(null);};}for(var e in events){if(events[_0x0bdc('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x0bdc('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 6a3fada..49708f1 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 _0x3d6f=['request-promise','path','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21ea6f,_0x4416ad){var _0x30b29b=function(_0x24fc45){while(--_0x24fc45){_0x21ea6f['push'](_0x21ea6f['shift']());}};_0x30b29b(++_0x4416ad);}(_0x3d6f,0x13f));var _0xf3d6=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x3d6f[_0x2bc1fe];return _0x1a47a5;};'use strict';var _=require(_0xf3d6('0x0'));var util=require(_0xf3d6('0x1'));var logger=require(_0xf3d6('0x2'))(_0xf3d6('0x3'));var moment=require(_0xf3d6('0x4'));var BPromise=require(_0xf3d6('0x5'));var rp=require(_0xf3d6('0x6'));var fs=require('fs');var path=require(_0xf3d6('0x7'));var rimraf=require('rimraf');var config=require(_0xf3d6('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xf3d6('0x9')]=function(_0x397de7,_0x45cd0d){return _0x397de7[_0xf3d6('0xa')](_0xf3d6('0xb'),attributes,{'tableName':_0xf3d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d4f=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboardItem.attributes'];(function(_0x17d173,_0x1470ef){var _0x89e20b=function(_0x20c033){while(--_0x20c033){_0x17d173['push'](_0x17d173['shift']());}};_0x89e20b(++_0x1470ef);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0x3d4f[_0x53d0f2];return _0x4039fe;};'use strict';var _=require(_0xf3d4('0x0'));var util=require(_0xf3d4('0x1'));var logger=require(_0xf3d4('0x2'))(_0xf3d4('0x3'));var moment=require(_0xf3d4('0x4'));var BPromise=require(_0xf3d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3d4('0x6'));var rimraf=require('rimraf');var config=require(_0xf3d4('0x7'));var attributes=require(_0xf3d4('0x8'));module['exports']=function(_0x315c0b,_0x4b21bf){return _0x315c0b[_0xf3d4('0x9')](_0xf3d4('0xa'),attributes,{'tableName':_0xf3d4('0xb'),'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 ee255d7..ad4de30 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 _0x459f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xde3de2,_0x61f4f){var _0x5591ad=function(_0x341d22){while(--_0x341d22){_0xde3de2['push'](_0xde3de2['shift']());}};_0x5591ad(++_0x61f4f);}(_0x459f,0xda));var _0xf459=function(_0x36310e,_0xd836f){_0x36310e=_0x36310e-0x0;var _0x4ee38d=_0x459f[_0x36310e];return _0x4ee38d;};'use strict';var _=require(_0xf459('0x0'));var util=require(_0xf459('0x1'));var moment=require(_0xf459('0x2'));var BPromise=require(_0xf459('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf459('0x4'));var db=require(_0xf459('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf459('0x6'))(_0xf459('0x7'));var config=require(_0xf459('0x8'));var jayson=require(_0xf459('0x9'));var client=jayson[_0xf459('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf459('0xb')](config[_0xf459('0xc')],{'host':_0xf459('0xd'),'port':0x18eb});var socket=require(_0xf459('0xe'))(new Redis(config[_0xf459('0xc')]));require(_0xf459('0xf'))[_0xf459('0x10')](socket);function respondWithRpcPromise(_0x3b394a,_0x5b07e0,_0x6753be){return new BPromise(function(_0x6e515a,_0x3b56ef){return client['request'](_0x3b394a,_0x6753be)['then'](function(_0x45c0f2){logger[_0xf459('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0xf459('0x12'));logger[_0xf459('0x13')](_0xf459('0x14'),_0x5b07e0,'request\x20sent',JSON[_0xf459('0x15')](_0x45c0f2));if(_0x45c0f2[_0xf459('0x16')]){if(_0x45c0f2[_0xf459('0x16')][_0xf459('0x17')]===0x1f4){logger[_0xf459('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);return _0x3b56ef(_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);}logger['error'](_0xf459('0x19'),_0x5b07e0,_0x45c0f2['error'][_0xf459('0x18')]);return _0x6e515a(_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);}else{logger[_0xf459('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0xf459('0x12'));_0x6e515a(_0x45c0f2[_0xf459('0x1a')][_0xf459('0x18')]);}})[_0xf459('0x1b')](function(_0x8a6bfd){logger[_0xf459('0x16')](_0xf459('0x19'),_0x5b07e0,_0x8a6bfd);_0x3b56ef(_0x8a6bfd);});});} \ No newline at end of file +var _0x39b2=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request'];(function(_0x1867a3,_0x2bcb7f){var _0x26497e=function(_0xb8bbf8){while(--_0xb8bbf8){_0x1867a3['push'](_0x1867a3['shift']());}};_0x26497e(++_0x2bcb7f);}(_0x39b2,0xd7));var _0x239b=function(_0x40746c,_0x1b9216){_0x40746c=_0x40746c-0x0;var _0x323385=_0x39b2[_0x40746c];return _0x323385;};'use strict';var _=require(_0x239b('0x0'));var util=require(_0x239b('0x1'));var moment=require('moment');var BPromise=require(_0x239b('0x2'));var rs=require(_0x239b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x239b('0x4'))['db'];var utils=require(_0x239b('0x5'));var logger=require(_0x239b('0x6'))(_0x239b('0x7'));var config=require(_0x239b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x239b('0x9')][_0x239b('0xa')]({'port':0x232a});config[_0x239b('0xb')]=_[_0x239b('0xc')](config[_0x239b('0xb')],{'host':_0x239b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x239b('0xb')]));require(_0x239b('0xe'))[_0x239b('0xf')](socket);function respondWithRpcPromise(_0x54ee19,_0x5af785,_0x310878){return new BPromise(function(_0x146738,_0x163ed2){return client[_0x239b('0x10')](_0x54ee19,_0x310878)[_0x239b('0x11')](function(_0x10d741){logger[_0x239b('0x12')](_0x239b('0x13'),_0x5af785,_0x239b('0x14'));logger[_0x239b('0x15')](_0x239b('0x16'),_0x5af785,_0x239b('0x14'),JSON[_0x239b('0x17')](_0x10d741));if(_0x10d741[_0x239b('0x18')]){if(_0x10d741['error'][_0x239b('0x19')]===0x1f4){logger[_0x239b('0x18')](_0x239b('0x13'),_0x5af785,_0x10d741[_0x239b('0x18')]['message']);return _0x163ed2(_0x10d741['error'][_0x239b('0x1a')]);}logger[_0x239b('0x18')]('DashboardItem,\x20%s,\x20%s',_0x5af785,_0x10d741['error'][_0x239b('0x1a')]);return _0x146738(_0x10d741[_0x239b('0x18')][_0x239b('0x1a')]);}else{logger[_0x239b('0x12')](_0x239b('0x13'),_0x5af785,_0x239b('0x14'));_0x146738(_0x10d741[_0x239b('0x1b')]['message']);}})[_0x239b('0x1c')](function(_0x514c1a){logger['error']('DashboardItem,\x20%s,\x20%s',_0x5af785,_0x514c1a);_0x163ed2(_0x514c1a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 66f9fff..b0f941f 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 _0xeae2=['emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x55a4f4,_0x24d74d){var _0x1a8078=function(_0x469e64){while(--_0x469e64){_0x55a4f4['push'](_0x55a4f4['shift']());}};_0x1a8078(++_0x24d74d);}(_0xeae2,0x162));var _0x2eae=function(_0x3c84eb,_0x1e0acb){_0x3c84eb=_0x3c84eb-0x0;var _0x22c628=_0xeae2[_0x3c84eb];return _0x22c628;};'use strict';var DashboardItemEvents=require(_0x2eae('0x0'));var events=[_0x2eae('0x1'),'remove',_0x2eae('0x2')];function createListener(_0x1444cb,_0x1a6afd){return function(_0x8b6dc9){_0x1a6afd[_0x2eae('0x3')](_0x1444cb,_0x8b6dc9);};}function removeListener(_0x1c4630,_0x283f76){return function(){DashboardItemEvents[_0x2eae('0x4')](_0x1c4630,_0x283f76);};}exports['register']=function(_0x44d89b){for(var _0x369d9c=0x0,_0x1c0d89=events[_0x2eae('0x5')];_0x369d9c<_0x1c0d89;_0x369d9c++){var _0x326024=events[_0x369d9c];var _0x585a2c=createListener(_0x2eae('0x6')+_0x326024,_0x44d89b);DashboardItemEvents['on'](_0x326024,_0x585a2c);}}; \ No newline at end of file +var _0x955a=['update','removeListener','register','./dashboardItem.events','save','remove'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x955a,0x105));var _0xa955=function(_0xc31769,_0x74f4fe){_0xc31769=_0xc31769-0x0;var _0x263b0b=_0x955a[_0xc31769];return _0x263b0b;};'use strict';var DashboardItemEvents=require(_0xa955('0x0'));var events=[_0xa955('0x1'),_0xa955('0x2'),_0xa955('0x3')];function createListener(_0x447c8d,_0x14b487){return function(_0xba3e47){_0x14b487['emit'](_0x447c8d,_0xba3e47);};}function removeListener(_0x211b4b,_0x2e9dbf){return function(){DashboardItemEvents[_0xa955('0x4')](_0x211b4b,_0x2e9dbf);};}exports[_0xa955('0x5')]=function(_0x50acd8){for(var _0x3a59d5=0x0,_0x13454d=events['length'];_0x3a59d5<_0x13454d;_0x3a59d5++){var _0x2ff20c=events[_0x3a59d5];var _0x616d64=createListener('dashboardItem:'+_0x2ff20c,_0x50acd8);DashboardItemEvents['on'](_0x2ff20c,_0x616d64);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2f891e8..c21fbd8 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 _0x5fa4=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put'];(function(_0x460e71,_0x5cf74f){var _0x1d48f0=function(_0x4adfcf){while(--_0x4adfcf){_0x460e71['push'](_0x460e71['shift']());}};_0x1d48f0(++_0x5cf74f);}(_0x5fa4,0x153));var _0x45fa=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5fa4[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x45fa('0x0'));var util=require('util');var path=require(_0x45fa('0x1'));var timeout=require(_0x45fa('0x2'));var express=require(_0x45fa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x45fa('0x4'));var interaction=require(_0x45fa('0x5'));var config=require(_0x45fa('0x6'));var controller=require('./dashboardItem.controller');router[_0x45fa('0x7')](_0x45fa('0x8'),auth[_0x45fa('0x9')](),controller[_0x45fa('0xa')]);router[_0x45fa('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x45fa('0xc')]('/:id',auth[_0x45fa('0x9')](),controller['update']);router[_0x45fa('0xd')](_0x45fa('0x8'),auth[_0x45fa('0x9')](),controller[_0x45fa('0xe')]);module[_0x45fa('0xf')]=router; \ No newline at end of file +var _0x137d=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','update','exports','multer','path'];(function(_0x1bb370,_0xa8b067){var _0x335fe5=function(_0x5ab655){while(--_0x5ab655){_0x1bb370['push'](_0x1bb370['shift']());}};_0x335fe5(++_0xa8b067);}(_0x137d,0x6e));var _0xd137=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x137d[_0x229128];return _0x1875b9;};'use strict';var multer=require(_0xd137('0x0'));var util=require('util');var path=require(_0xd137('0x1'));var timeout=require(_0xd137('0x2'));var express=require('express');var router=express[_0xd137('0x3')]();var fs_extra=require(_0xd137('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd137('0x5'));var config=require(_0xd137('0x6'));var controller=require('./dashboardItem.controller');router['get'](_0xd137('0x7'),auth[_0xd137('0x8')](),controller[_0xd137('0x9')]);router[_0xd137('0xa')]('/',auth[_0xd137('0x8')](),controller[_0xd137('0xb')]);router['put'](_0xd137('0x7'),auth[_0xd137('0x8')](),controller[_0xd137('0xc')]);router['delete']('/:id',auth[_0xd137('0x8')](),controller['destroy']);module[_0xd137('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 56a4635..1fad6ed 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 _0xe4e5=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x1e1463,_0x237529){var _0x3b842b=function(_0xb540d0){while(--_0xb540d0){_0x1e1463['push'](_0x1e1463['shift']());}};_0x3b842b(++_0x237529);}(_0xe4e5,0x122));var _0x5e4e=function(_0x5108cd,_0x5d9634){_0x5108cd=_0x5108cd-0x0;var _0x5e4186=_0xe4e5[_0x5108cd];return _0x5e4186;};'use strict';var Sequelize=require(_0x5e4e('0x0'));module[_0x5e4e('0x1')]={'name':{'type':Sequelize[_0x5e4e('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5e4e('0x3')](_0x5e4e('0x4'),_0x5e4e('0x5'),_0x5e4e('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5e4e('0x2')]}}; \ No newline at end of file +var _0x2763=['third','STRING','ENUM','first','second'];(function(_0x531280,_0x283c1b){var _0x389585=function(_0x22960a){while(--_0x22960a){_0x531280['push'](_0x531280['shift']());}};_0x389585(++_0x283c1b);}(_0x2763,0x1b4));var _0x3276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2763[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3276('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x3276('0x1')](_0x3276('0x2'),_0x3276('0x3'),_0x3276('0x4')),'allowNull':![],'defaultValue':_0x3276('0x2')},'description':{'type':Sequelize[_0x3276('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f630c48..d65bdb0 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 _0x75d2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','user','role','Dispositions','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','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x75d2,0x152));var _0x275d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x75d2[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x275d('0x0'));var rimraf=require(_0x275d('0x1'));var zipdir=require(_0x275d('0x2'));var jsonpatch=require(_0x275d('0x3'));var rp=require(_0x275d('0x4'));var moment=require(_0x275d('0x5'));var BPromise=require(_0x275d('0x6'));var Mustache=require('mustache');var util=require(_0x275d('0x7'));var path=require('path');var sox=require(_0x275d('0x8'));var csv=require(_0x275d('0x9'));var ejs=require(_0x275d('0xa'));var fs=require('fs');var fs_extra=require(_0x275d('0xb'));var _=require(_0x275d('0xc'));var squel=require(_0x275d('0xd'));var crypto=require('crypto');var jsforce=require(_0x275d('0xe'));var deskjs=require(_0x275d('0xf'));var toCsv=require(_0x275d('0x9'));var querystring=require(_0x275d('0x10'));var Papa=require('papaparse');var Redis=require(_0x275d('0x11'));var authService=require(_0x275d('0x12'));var qs=require(_0x275d('0x13'));var as=require(_0x275d('0x14'));var hardwareService=require(_0x275d('0x15'));var logger=require(_0x275d('0x16'))(_0x275d('0x17'));var utils=require(_0x275d('0x18'));var config=require(_0x275d('0x19'));var licenseUtil=require(_0x275d('0x1a'));var db=require(_0x275d('0x1b'))['db'];function respondWithStatusCode(_0xab607c,_0x2c8bad){_0x2c8bad=_0x2c8bad||0xcc;return function(_0x3d9658){if(_0x3d9658){return _0xab607c[_0x275d('0x1c')](_0x2c8bad);}return _0xab607c['status'](_0x2c8bad)[_0x275d('0x1d')]();};}function respondWithResult(_0x586ba9,_0xa0633a){_0xa0633a=_0xa0633a||0xc8;return function(_0x2ac584){if(_0x2ac584){return _0x586ba9[_0x275d('0x1e')](_0xa0633a)[_0x275d('0x1f')](_0x2ac584);}};}function respondWithFilteredResult(_0x214b3d,_0x3a44d6){return function(_0x31aeee){if(_0x31aeee){var _0x3f5ff9=typeof _0x3a44d6[_0x275d('0x20')]==='undefined'&&typeof _0x3a44d6['limit']===_0x275d('0x21');var _0x375c57=_0x31aeee[_0x275d('0x22')];var _0x498c6a=_0x3f5ff9?0x0:_0x3a44d6['offset'];var _0x48e1bf=_0x3f5ff9?_0x31aeee[_0x275d('0x22')]:_0x3a44d6['offset']+_0x3a44d6['limit'];var _0x34e4b9;if(_0x48e1bf>=_0x375c57){_0x48e1bf=_0x375c57;_0x34e4b9=0xc8;}else{_0x34e4b9=0xce;}_0x214b3d['status'](_0x34e4b9);return _0x214b3d[_0x275d('0x23')](_0x275d('0x24'),_0x498c6a+'-'+_0x48e1bf+'/'+_0x375c57)['json'](_0x31aeee);}return null;};}function patchUpdates(_0xaf5453){return function(_0x3ba469){try{jsonpatch[_0x275d('0x25')](_0x3ba469,_0xaf5453,!![]);}catch(_0x13fd44){return BPromise[_0x275d('0x26')](_0x13fd44);}return _0x3ba469[_0x275d('0x27')]();};}function saveUpdates(_0x1339a4,_0x2c4aa9){return function(_0x745f88){if(_0x745f88){return _0x745f88[_0x275d('0x28')](_0x1339a4)[_0x275d('0x29')](function(_0x26c528){return _0x26c528;});}return null;};}function removeEntity(_0x24c11e,_0x18a45e){return function(_0x54d6e9){if(_0x54d6e9){return _0x54d6e9[_0x275d('0x2a')]()[_0x275d('0x29')](function(){var _0x35d06f=_0x54d6e9[_0x275d('0x2b')]({'plain':!![]});var _0x54a257='Dispositions';return db[_0x275d('0x2c')]['destroy']({'where':{'type':_0x54a257,'resourceId':_0x35d06f['id']}})[_0x275d('0x29')](function(){return _0x54d6e9;});})[_0x275d('0x29')](function(){_0x24c11e[_0x275d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c861a,_0x4122b0){return function(_0x138087){if(!_0x138087){_0x2c861a['sendStatus'](0x194);}return _0x138087;};}function handleError(_0x52baa2,_0x579c9b){_0x579c9b=_0x579c9b||0x1f4;return function(_0x2fb9b9){logger[_0x275d('0x2d')](_0x2fb9b9[_0x275d('0x2e')]);if(_0x2fb9b9[_0x275d('0x2f')]){delete _0x2fb9b9[_0x275d('0x2f')];}_0x52baa2[_0x275d('0x1e')](_0x579c9b)[_0x275d('0x30')](_0x2fb9b9);};}exports[_0x275d('0x31')]=function(_0x355186,_0x24f781){var _0x14cf8c={},_0x591c2c={},_0xee2671={'count':0x0,'rows':[]};var _0x5a7cb3=_[_0x275d('0x32')](db[_0x275d('0x33')][_0x275d('0x34')],function(_0x386380){return{'name':_0x386380[_0x275d('0x35')],'type':_0x386380['type'][_0x275d('0x36')]};});_0x591c2c[_0x275d('0x37')]=_[_0x275d('0x32')](_0x5a7cb3,_0x275d('0x2f'));_0x591c2c[_0x275d('0x38')]=_[_0x275d('0x39')](_0x355186['query']);_0x591c2c[_0x275d('0x3a')]=_['intersection'](_0x591c2c[_0x275d('0x37')],_0x591c2c['query']);_0x14cf8c[_0x275d('0x3b')]=_[_0x275d('0x3c')](_0x591c2c[_0x275d('0x37')],qs[_0x275d('0x3d')](_0x355186['query']['fields']));_0x14cf8c[_0x275d('0x3b')]=_0x14cf8c[_0x275d('0x3b')][_0x275d('0x3e')]?_0x14cf8c[_0x275d('0x3b')]:_0x591c2c['model'];if(!_0x355186[_0x275d('0x38')]['hasOwnProperty'](_0x275d('0x3f'))){_0x14cf8c[_0x275d('0x40')]=qs[_0x275d('0x40')](_0x355186[_0x275d('0x38')]['limit']);_0x14cf8c[_0x275d('0x20')]=qs[_0x275d('0x20')](_0x355186[_0x275d('0x38')][_0x275d('0x20')]);}_0x14cf8c[_0x275d('0x41')]=qs['sort'](_0x355186[_0x275d('0x38')][_0x275d('0x42')]);_0x14cf8c[_0x275d('0x43')]=qs[_0x275d('0x3a')](_[_0x275d('0x44')](_0x355186['query'],_0x591c2c[_0x275d('0x3a')]),_0x5a7cb3);if(_0x355186['query'][_0x275d('0x45')]){_0x14cf8c[_0x275d('0x43')]=_[_0x275d('0x46')](_0x14cf8c['where'],{'$or':_[_0x275d('0x32')](_0x5a7cb3,function(_0x1a3e43){if(_0x1a3e43[_0x275d('0x47')]!=='VIRTUAL'){var _0x2c16bd={};_0x2c16bd[_0x1a3e43[_0x275d('0x2f')]]={'$like':'%'+_0x355186[_0x275d('0x38')][_0x275d('0x45')]+'%'};return _0x2c16bd;}})});}_0x14cf8c=_[_0x275d('0x46')]({},_0x14cf8c,_0x355186['options']);var _0x1cc3f9={'where':_0x14cf8c[_0x275d('0x43')]};return db[_0x275d('0x33')]['count'](_0x1cc3f9)[_0x275d('0x29')](function(_0x173ab4){_0xee2671[_0x275d('0x22')]=_0x173ab4;if(_0x355186[_0x275d('0x38')]['includeAll']){_0x14cf8c['include']=[{'all':!![]}];}return db[_0x275d('0x33')][_0x275d('0x48')](_0x14cf8c);})[_0x275d('0x29')](function(_0x3de7ba){_0xee2671[_0x275d('0x49')]=_0x3de7ba;return _0xee2671;})['then'](respondWithFilteredResult(_0x24f781,_0x14cf8c))[_0x275d('0x4a')](handleError(_0x24f781,null));};exports[_0x275d('0x4b')]=function(_0x2454b5,_0x50a5e6){var _0x2f9e3d={'raw':!![],'where':{'id':_0x2454b5[_0x275d('0x4c')]['id']}},_0x495881={};_0x495881[_0x275d('0x37')]=_[_0x275d('0x39')](db[_0x275d('0x33')]['rawAttributes']);_0x495881['query']=_['keys'](_0x2454b5['query']);_0x495881[_0x275d('0x3a')]=_[_0x275d('0x3c')](_0x495881['model'],_0x495881[_0x275d('0x38')]);_0x2f9e3d['attributes']=_[_0x275d('0x3c')](_0x495881['model'],qs[_0x275d('0x3d')](_0x2454b5[_0x275d('0x38')][_0x275d('0x3d')]));_0x2f9e3d[_0x275d('0x3b')]=_0x2f9e3d[_0x275d('0x3b')][_0x275d('0x3e')]?_0x2f9e3d[_0x275d('0x3b')]:_0x495881[_0x275d('0x37')];if(_0x2454b5[_0x275d('0x38')][_0x275d('0x4d')]){_0x2f9e3d[_0x275d('0x4e')]=[{'all':!![]}];}_0x2f9e3d=_[_0x275d('0x46')]({},_0x2f9e3d,_0x2454b5[_0x275d('0x4f')]);return db[_0x275d('0x33')][_0x275d('0x50')](_0x2f9e3d)[_0x275d('0x29')](handleEntityNotFound(_0x50a5e6,null))['then'](respondWithResult(_0x50a5e6,null))[_0x275d('0x4a')](handleError(_0x50a5e6,null));};exports[_0x275d('0x51')]=function(_0x4c2133,_0xb6616b){return db[_0x275d('0x33')][_0x275d('0x51')](_0x4c2133[_0x275d('0x52')],{})[_0x275d('0x29')](function(_0x527d19){var _0x483991=_0x4c2133[_0x275d('0x53')][_0x275d('0x2b')]({'plain':!![]});if(!_0x483991)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x483991[_0x275d('0x54')]===_0x275d('0x53')){var _0x3f9784=_0x527d19[_0x275d('0x2b')]({'plain':!![]});var _0x4c3519=_0x275d('0x55');return db[_0x275d('0x56')][_0x275d('0x50')]({'where':{'name':_0x4c3519,'userProfileId':_0x483991['userProfileId']},'raw':!![]})[_0x275d('0x29')](function(_0xc611ef){if(_0xc611ef&&_0xc611ef[_0x275d('0x57')]===0x0){return db[_0x275d('0x2c')][_0x275d('0x51')]({'name':_0x3f9784[_0x275d('0x2f')],'resourceId':_0x3f9784['id'],'type':_0xc611ef[_0x275d('0x2f')],'sectionId':_0xc611ef['id']},{})['then'](function(){return _0x527d19;});}else{return _0x527d19;}})[_0x275d('0x4a')](function(_0x27ba3e){logger[_0x275d('0x2d')](_0x275d('0x58'),_0x27ba3e);throw _0x27ba3e;});}return _0x527d19;})[_0x275d('0x29')](respondWithResult(_0xb6616b,0xc9))[_0x275d('0x4a')](handleError(_0xb6616b,null));};exports['update']=function(_0xbf0b64,_0x1ed49e){if(_0xbf0b64[_0x275d('0x52')]['id']){delete _0xbf0b64[_0x275d('0x52')]['id'];}return db[_0x275d('0x33')][_0x275d('0x50')]({'where':{'id':_0xbf0b64['params']['id']}})[_0x275d('0x29')](handleEntityNotFound(_0x1ed49e,null))[_0x275d('0x29')](saveUpdates(_0xbf0b64['body'],null))[_0x275d('0x29')](respondWithResult(_0x1ed49e,null))[_0x275d('0x4a')](handleError(_0x1ed49e,null));};exports[_0x275d('0x2a')]=function(_0x287ab2,_0x555d39){return db[_0x275d('0x33')][_0x275d('0x50')]({'where':{'id':_0x287ab2[_0x275d('0x4c')]['id']}})[_0x275d('0x29')](handleEntityNotFound(_0x555d39,null))[_0x275d('0x29')](removeEntity(_0x555d39,null))['catch'](handleError(_0x555d39,null));}; \ No newline at end of file +var _0x1e05=['limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Disposition','findAll','rows','catch','params','create','body','user','role','userProfileId','autoAssociation','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2964aa,_0x54f943){var _0x33e9e7=function(_0x11b99c){while(--_0x11b99c){_0x2964aa['push'](_0x2964aa['shift']());}};_0x33e9e7(++_0x54f943);}(_0x1e05,0x170));var _0x51e0=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0x1e05[_0x456a84];return _0x1117d6;};'use strict';var emlformat=require(_0x51e0('0x0'));var rimraf=require(_0x51e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51e0('0x2'));var moment=require(_0x51e0('0x3'));var BPromise=require(_0x51e0('0x4'));var Mustache=require(_0x51e0('0x5'));var util=require('util');var path=require(_0x51e0('0x6'));var sox=require(_0x51e0('0x7'));var csv=require(_0x51e0('0x8'));var ejs=require(_0x51e0('0x9'));var fs=require('fs');var fs_extra=require(_0x51e0('0xa'));var _=require(_0x51e0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51e0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51e0('0xd'));var Papa=require(_0x51e0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51e0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51e0('0x10'))('api');var utils=require(_0x51e0('0x11'));var config=require(_0x51e0('0x12'));var licenseUtil=require(_0x51e0('0x13'));var db=require(_0x51e0('0x14'))['db'];function respondWithStatusCode(_0x1a74ab,_0x3a0c4c){_0x3a0c4c=_0x3a0c4c||0xcc;return function(_0x5cc4e1){if(_0x5cc4e1){return _0x1a74ab[_0x51e0('0x15')](_0x3a0c4c);}return _0x1a74ab[_0x51e0('0x16')](_0x3a0c4c)[_0x51e0('0x17')]();};}function respondWithResult(_0x1c8e7c,_0x4bdce1){_0x4bdce1=_0x4bdce1||0xc8;return function(_0x2a2532){if(_0x2a2532){return _0x1c8e7c['status'](_0x4bdce1)[_0x51e0('0x18')](_0x2a2532);}};}function respondWithFilteredResult(_0x970347,_0x5a2c15){return function(_0x40ef54){if(_0x40ef54){var _0x280aba=typeof _0x5a2c15[_0x51e0('0x19')]===_0x51e0('0x1a')&&typeof _0x5a2c15[_0x51e0('0x1b')]===_0x51e0('0x1a');var _0x279229=_0x40ef54[_0x51e0('0x1c')];var _0x598a0a=_0x280aba?0x0:_0x5a2c15[_0x51e0('0x19')];var _0x29ae88=_0x280aba?_0x40ef54[_0x51e0('0x1c')]:_0x5a2c15[_0x51e0('0x19')]+_0x5a2c15[_0x51e0('0x1b')];var _0x4bbc21;if(_0x29ae88>=_0x279229){_0x29ae88=_0x279229;_0x4bbc21=0xc8;}else{_0x4bbc21=0xce;}_0x970347[_0x51e0('0x16')](_0x4bbc21);return _0x970347[_0x51e0('0x1d')](_0x51e0('0x1e'),_0x598a0a+'-'+_0x29ae88+'/'+_0x279229)[_0x51e0('0x18')](_0x40ef54);}return null;};}function patchUpdates(_0x4ae272){return function(_0x101c1b){try{jsonpatch[_0x51e0('0x1f')](_0x101c1b,_0x4ae272,!![]);}catch(_0x3a3923){return BPromise[_0x51e0('0x20')](_0x3a3923);}return _0x101c1b[_0x51e0('0x21')]();};}function saveUpdates(_0x358fc0,_0x2a6cf5){return function(_0x597127){if(_0x597127){return _0x597127[_0x51e0('0x22')](_0x358fc0)['then'](function(_0x3f853d){return _0x3f853d;});}return null;};}function removeEntity(_0x2f80c0,_0x512b9d){return function(_0x253b85){if(_0x253b85){return _0x253b85[_0x51e0('0x23')]()['then'](function(){var _0x5e7d23=_0x253b85[_0x51e0('0x24')]({'plain':!![]});var _0x218e6d='Dispositions';return db[_0x51e0('0x25')][_0x51e0('0x23')]({'where':{'type':_0x218e6d,'resourceId':_0x5e7d23['id']}})[_0x51e0('0x26')](function(){return _0x253b85;});})['then'](function(){_0x2f80c0[_0x51e0('0x16')](0xcc)[_0x51e0('0x17')]();});}};}function handleEntityNotFound(_0x91512e,_0x24790a){return function(_0x2add3f){if(!_0x2add3f){_0x91512e[_0x51e0('0x15')](0x194);}return _0x2add3f;};}function handleError(_0x3f8101,_0x53bd3d){_0x53bd3d=_0x53bd3d||0x1f4;return function(_0x4f4ce9){logger[_0x51e0('0x27')](_0x4f4ce9[_0x51e0('0x28')]);if(_0x4f4ce9[_0x51e0('0x29')]){delete _0x4f4ce9[_0x51e0('0x29')];}_0x3f8101[_0x51e0('0x16')](_0x53bd3d)[_0x51e0('0x2a')](_0x4f4ce9);};}exports[_0x51e0('0x2b')]=function(_0x1c7e88,_0x255754){var _0x7150b={},_0x384b60={},_0x579ff3={'count':0x0,'rows':[]};var _0x31cccb=_[_0x51e0('0x2c')](db['Disposition'][_0x51e0('0x2d')],function(_0x5f1297){return{'name':_0x5f1297['fieldName'],'type':_0x5f1297[_0x51e0('0x2e')][_0x51e0('0x2f')]};});_0x384b60[_0x51e0('0x30')]=_[_0x51e0('0x2c')](_0x31cccb,'name');_0x384b60[_0x51e0('0x31')]=_[_0x51e0('0x32')](_0x1c7e88[_0x51e0('0x31')]);_0x384b60[_0x51e0('0x33')]=_[_0x51e0('0x34')](_0x384b60[_0x51e0('0x30')],_0x384b60[_0x51e0('0x31')]);_0x7150b[_0x51e0('0x35')]=_[_0x51e0('0x34')](_0x384b60[_0x51e0('0x30')],qs[_0x51e0('0x36')](_0x1c7e88['query'][_0x51e0('0x36')]));_0x7150b[_0x51e0('0x35')]=_0x7150b['attributes'][_0x51e0('0x37')]?_0x7150b[_0x51e0('0x35')]:_0x384b60[_0x51e0('0x30')];if(!_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x38')](_0x51e0('0x39'))){_0x7150b[_0x51e0('0x1b')]=qs['limit'](_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x1b')]);_0x7150b[_0x51e0('0x19')]=qs[_0x51e0('0x19')](_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x19')]);}_0x7150b[_0x51e0('0x3a')]=qs[_0x51e0('0x3b')](_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x3b')]);_0x7150b[_0x51e0('0x3c')]=qs['filters'](_[_0x51e0('0x3d')](_0x1c7e88[_0x51e0('0x31')],_0x384b60[_0x51e0('0x33')]),_0x31cccb);if(_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x3e')]){_0x7150b[_0x51e0('0x3c')]=_[_0x51e0('0x3f')](_0x7150b[_0x51e0('0x3c')],{'$or':_['map'](_0x31cccb,function(_0x564a48){if(_0x564a48[_0x51e0('0x2e')]!=='VIRTUAL'){var _0x180ebd={};_0x180ebd[_0x564a48[_0x51e0('0x29')]]={'$like':'%'+_0x1c7e88[_0x51e0('0x31')]['filter']+'%'};return _0x180ebd;}})});}_0x7150b=_[_0x51e0('0x3f')]({},_0x7150b,_0x1c7e88[_0x51e0('0x40')]);var _0x20b7a9={'where':_0x7150b[_0x51e0('0x3c')]};return db['Disposition'][_0x51e0('0x1c')](_0x20b7a9)[_0x51e0('0x26')](function(_0xd585e4){_0x579ff3[_0x51e0('0x1c')]=_0xd585e4;if(_0x1c7e88[_0x51e0('0x31')][_0x51e0('0x41')]){_0x7150b[_0x51e0('0x42')]=[{'all':!![]}];}return db[_0x51e0('0x43')][_0x51e0('0x44')](_0x7150b);})[_0x51e0('0x26')](function(_0xd4842){_0x579ff3[_0x51e0('0x45')]=_0xd4842;return _0x579ff3;})[_0x51e0('0x26')](respondWithFilteredResult(_0x255754,_0x7150b))[_0x51e0('0x46')](handleError(_0x255754,null));};exports['show']=function(_0x386df8,_0x5db13a){var _0x2db877={'raw':!![],'where':{'id':_0x386df8[_0x51e0('0x47')]['id']}},_0xe0558b={};_0xe0558b[_0x51e0('0x30')]=_[_0x51e0('0x32')](db[_0x51e0('0x43')][_0x51e0('0x2d')]);_0xe0558b[_0x51e0('0x31')]=_['keys'](_0x386df8[_0x51e0('0x31')]);_0xe0558b[_0x51e0('0x33')]=_['intersection'](_0xe0558b['model'],_0xe0558b[_0x51e0('0x31')]);_0x2db877[_0x51e0('0x35')]=_[_0x51e0('0x34')](_0xe0558b[_0x51e0('0x30')],qs[_0x51e0('0x36')](_0x386df8[_0x51e0('0x31')][_0x51e0('0x36')]));_0x2db877[_0x51e0('0x35')]=_0x2db877[_0x51e0('0x35')][_0x51e0('0x37')]?_0x2db877[_0x51e0('0x35')]:_0xe0558b[_0x51e0('0x30')];if(_0x386df8[_0x51e0('0x31')][_0x51e0('0x41')]){_0x2db877[_0x51e0('0x42')]=[{'all':!![]}];}_0x2db877=_['merge']({},_0x2db877,_0x386df8[_0x51e0('0x40')]);return db[_0x51e0('0x43')]['find'](_0x2db877)[_0x51e0('0x26')](handleEntityNotFound(_0x5db13a,null))[_0x51e0('0x26')](respondWithResult(_0x5db13a,null))[_0x51e0('0x46')](handleError(_0x5db13a,null));};exports['create']=function(_0x20cc3f,_0x5a9252){return db[_0x51e0('0x43')][_0x51e0('0x48')](_0x20cc3f[_0x51e0('0x49')],{})[_0x51e0('0x26')](function(_0x3d55e7){var _0x49baee=_0x20cc3f[_0x51e0('0x4a')][_0x51e0('0x24')]({'plain':!![]});if(!_0x49baee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49baee[_0x51e0('0x4b')]==='user'){var _0x388328=_0x3d55e7[_0x51e0('0x24')]({'plain':!![]});var _0x3aa470='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x3aa470,'userProfileId':_0x49baee[_0x51e0('0x4c')]},'raw':!![]})['then'](function(_0x35ff3b){if(_0x35ff3b&&_0x35ff3b[_0x51e0('0x4d')]===0x0){return db[_0x51e0('0x25')]['create']({'name':_0x388328[_0x51e0('0x29')],'resourceId':_0x388328['id'],'type':_0x35ff3b['name'],'sectionId':_0x35ff3b['id']},{})['then'](function(){return _0x3d55e7;});}else{return _0x3d55e7;}})[_0x51e0('0x46')](function(_0x27b88d){logger[_0x51e0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27b88d);throw _0x27b88d;});}return _0x3d55e7;})['then'](respondWithResult(_0x5a9252,0xc9))[_0x51e0('0x46')](handleError(_0x5a9252,null));};exports[_0x51e0('0x22')]=function(_0x1ce03e,_0x296c36){if(_0x1ce03e[_0x51e0('0x49')]['id']){delete _0x1ce03e[_0x51e0('0x49')]['id'];}return db['Disposition'][_0x51e0('0x4e')]({'where':{'id':_0x1ce03e[_0x51e0('0x47')]['id']}})[_0x51e0('0x26')](handleEntityNotFound(_0x296c36,null))['then'](saveUpdates(_0x1ce03e[_0x51e0('0x49')],null))['then'](respondWithResult(_0x296c36,null))['catch'](handleError(_0x296c36,null));};exports[_0x51e0('0x23')]=function(_0x345e8c,_0x37c297){return db[_0x51e0('0x43')][_0x51e0('0x4e')]({'where':{'id':_0x345e8c['params']['id']}})[_0x51e0('0x26')](handleEntityNotFound(_0x37c297,null))[_0x51e0('0x26')](removeEntity(_0x37c297,null))['catch'](handleError(_0x37c297,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2ce1755..ed1085c 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 _0x9476=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId'];(function(_0x440335,_0xf76c4a){var _0x1e8aa1=function(_0x1ed00a){while(--_0x1ed00a){_0x440335['push'](_0x440335['shift']());}};_0x1e8aa1(++_0xf76c4a);}(_0x9476,0x1ec));var _0x6947=function(_0x259422,_0x2b59e0){_0x259422=_0x259422-0x0;var _0x2b0ae3=_0x9476[_0x259422];return _0x2b0ae3;};'use strict';var _=require(_0x6947('0x0'));var util=require(_0x6947('0x1'));var logger=require(_0x6947('0x2'))('api');var moment=require(_0x6947('0x3'));var BPromise=require(_0x6947('0x4'));var rp=require(_0x6947('0x5'));var fs=require('fs');var path=require(_0x6947('0x6'));var rimraf=require(_0x6947('0x7'));var config=require(_0x6947('0x8'));var attributes=require(_0x6947('0x9'));module[_0x6947('0xa')]=function(_0x265b0c,_0x467de1){return _0x265b0c['define'](_0x6947('0xb'),attributes,{'tableName':_0x6947('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6947('0xd'),'fields':[_0x6947('0xe'),_0x6947('0xf')]},{'unique':!![],'name':_0x6947('0x10'),'fields':[_0x6947('0xe'),_0x6947('0x11')]},{'unique':!![],'name':_0x6947('0x12'),'fields':['name',_0x6947('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0x6947('0xe'),_0x6947('0x14')]},{'unique':!![],'name':_0x6947('0x15'),'fields':['name',_0x6947('0x16')]},{'unique':!![],'name':_0x6947('0x17'),'fields':[_0x6947('0xe'),_0x6947('0x18')]},{'unique':!![],'name':_0x6947('0x19'),'fields':[_0x6947('0xe'),_0x6947('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c8=['ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','name','name_chat'];(function(_0x3d8627,_0x34e543){var _0x557c0d=function(_0x467fcb){while(--_0x467fcb){_0x3d8627['push'](_0x3d8627['shift']());}};_0x557c0d(++_0x34e543);}(_0xe9c8,0x10b));var _0x8e9c=function(_0x19288f,_0x593b58){_0x19288f=_0x19288f-0x0;var _0x280b73=_0xe9c8[_0x19288f];return _0x280b73;};'use strict';var _=require(_0x8e9c('0x0'));var util=require(_0x8e9c('0x1'));var logger=require(_0x8e9c('0x2'))(_0x8e9c('0x3'));var moment=require(_0x8e9c('0x4'));var BPromise=require(_0x8e9c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e9c('0x6'));var config=require(_0x8e9c('0x7'));var attributes=require(_0x8e9c('0x8'));module[_0x8e9c('0x9')]=function(_0x25eb44,_0xa40583){return _0x25eb44['define'](_0x8e9c('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x8e9c('0xb'),'ListId']},{'unique':!![],'name':_0x8e9c('0xc'),'fields':[_0x8e9c('0xb'),_0x8e9c('0xd')]},{'unique':!![],'name':_0x8e9c('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x8e9c('0xf'),'fields':[_0x8e9c('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x8e9c('0x10'),'fields':[_0x8e9c('0xb'),_0x8e9c('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0x8e9c('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x8e9c('0x12'),'fields':[_0x8e9c('0xb'),_0x8e9c('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 90bf36e..9a8778a 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(_0xa9b1ef,_0x2a5454){var _0x2330a2=function(_0x1152ba){while(--_0x1152ba){_0xa9b1ef['push'](_0xa9b1ef['shift']());}};_0x2330a2(++_0x2a5454);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x5cedb9,_0x35bea3){var _0x453d10=function(_0x43d8c2){while(--_0x43d8c2){_0x5cedb9['push'](_0x5cedb9['shift']());}};_0x453d10(++_0x35bea3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a575306..a587b3e 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 _0xde58=['update','delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x2d3ccf,_0x1dd3a0){var _0x3c8333=function(_0x4febd8){while(--_0x4febd8){_0x2d3ccf['push'](_0x2d3ccf['shift']());}};_0x3c8333(++_0x1dd3a0);}(_0xde58,0x17a));var _0x8de5=function(_0x367710,_0x2ea312){_0x367710=_0x367710-0x0;var _0x16178d=_0xde58[_0x367710];return _0x16178d;};'use strict';var multer=require('multer');var util=require(_0x8de5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8de5('0x1')]();var fs_extra=require(_0x8de5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8de5('0x3'));var config=require(_0x8de5('0x4'));var controller=require(_0x8de5('0x5'));router[_0x8de5('0x6')]('/',auth[_0x8de5('0x7')](),controller[_0x8de5('0x8')]);router[_0x8de5('0x6')](_0x8de5('0x9'),auth[_0x8de5('0x7')](),controller[_0x8de5('0xa')]);router['post']('/',auth[_0x8de5('0x7')](),controller[_0x8de5('0xb')]);router[_0x8de5('0xc')](_0x8de5('0x9'),auth[_0x8de5('0x7')](),controller[_0x8de5('0xd')]);router[_0x8de5('0xe')](_0x8de5('0x9'),auth['isAuthenticated'](),controller[_0x8de5('0xf')]);module[_0x8de5('0x10')]=router; \ No newline at end of file +var _0x4f9f=['/:id','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','get','show','post','create'];(function(_0x522a17,_0xda5277){var _0xafaa0c=function(_0x5d63b2){while(--_0x5d63b2){_0x522a17['push'](_0x522a17['shift']());}};_0xafaa0c(++_0xda5277);}(_0x4f9f,0x144));var _0xf4f9=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0x4f9f[_0x3eef60];return _0x569efe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf4f9('0x0'));var timeout=require(_0xf4f9('0x1'));var express=require(_0xf4f9('0x2'));var router=express[_0xf4f9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf4f9('0x4'));var interaction=require(_0xf4f9('0x5'));var config=require('../../config/environment');var controller=require(_0xf4f9('0x6'));router['get']('/',auth[_0xf4f9('0x7')](),controller['index']);router[_0xf4f9('0x8')]('/:id',auth[_0xf4f9('0x7')](),controller[_0xf4f9('0x9')]);router[_0xf4f9('0xa')]('/',auth['isAuthenticated'](),controller[_0xf4f9('0xb')]);router['put'](_0xf4f9('0xc'),auth[_0xf4f9('0x7')](),controller['update']);router[_0xf4f9('0xd')](_0xf4f9('0xc'),auth['isAuthenticated'](),controller[_0xf4f9('0xe')]);module[_0xf4f9('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f4ba8ac..5d6bb05 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 _0x6363=['7200','9600','14400','12000','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x22a877,_0x4b42a1){var _0x1eee1e=function(_0x2bde98){while(--_0x2bde98){_0x22a877['push'](_0x22a877['shift']());}};_0x1eee1e(++_0x4b42a1);}(_0x6363,0x13a));var _0x3636=function(_0x4f4557,_0x3b9231){_0x4f4557=_0x4f4557-0x0;var _0x44297c=_0x6363[_0x4f4557];return _0x44297c;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3636('0x1')]},'ecm':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x3'),'no'),'defaultValue':_0x3636('0x3')},'headerinfo':{'type':Sequelize[_0x3636('0x1')],'defaultValue':_0x3636('0x4')},'localstationid':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x5')},'minrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),'12000',_0x3636('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),_0x3636('0xb'),_0x3636('0xa')),'defaultValue':_0x3636('0xa')},'modem':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3636('0x2')](_0x3636('0xc'),_0x3636('0xd'),_0x3636('0xe'),_0x3636('0xf')),'defaultValue':_0x3636('0xc')},'key':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3636('0x10')],'defaultValue':function(){return _0x3636('0x11');}},'notificationSound':{'type':Sequelize[_0x3636('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3636('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xe3be56){if(!_0xe3be56)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3636('0x15')](_0x3636('0x16'),_0xe3be56);}}}; \ No newline at end of file +var _0x3e24=['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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','INTEGER','SIP','IAX','DADHI'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3e24,0x167));var _0x43e2=function(_0x14a05c,_0x304800){_0x14a05c=_0x14a05c-0x0;var _0x4199e=_0x3e24[_0x14a05c];return _0x4199e;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43e2('0x2')]},'ecm':{'type':Sequelize[_0x43e2('0x3')]('yes','no'),'defaultValue':_0x43e2('0x4')},'headerinfo':{'type':Sequelize[_0x43e2('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x43e2('0x2')],'unique':_0x43e2('0x5')},'minrate':{'type':Sequelize[_0x43e2('0x3')](_0x43e2('0x6'),_0x43e2('0x7'),_0x43e2('0x8'),_0x43e2('0x9'),'12000',_0x43e2('0xa')),'defaultValue':_0x43e2('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x43e2('0x6'),_0x43e2('0x7'),'7200',_0x43e2('0x9'),_0x43e2('0xb'),'14400'),'defaultValue':_0x43e2('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x43e2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x43e2('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x43e2('0x3')](_0x43e2('0xd'),_0x43e2('0xe'),_0x43e2('0xf'),_0x43e2('0x10')),'defaultValue':_0x43e2('0xd')},'key':{'type':Sequelize[_0x43e2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x43e2('0x11')],'defaultValue':function(){return _0x43e2('0x12');}},'notificationSound':{'type':Sequelize[_0x43e2('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x43e2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x43e2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x43e2('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43e2('0xc')],'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[_0x43e2('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x43e2('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x43e2('0x13')],'defaultValue':![],'comment':_0x43e2('0x15'),'set':function(_0x105cb8){if(!_0x105cb8)this[_0x43e2('0x16')](_0x43e2('0x17'),null);this[_0x43e2('0x16')](_0x43e2('0x18'),_0x105cb8);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e6347f0..587781f 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 _0xa5b2=['out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','then','get','FaxAccounts','UserProfileResource','name','send','index','Pause','map','FaxAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','include','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed'];(function(_0xfd196b,_0x45130c){var _0x141fad=function(_0x54c16b){while(--_0x54c16b){_0xfd196b['push'](_0xfd196b['shift']());}};_0x141fad(++_0x45130c);}(_0xa5b2,0x1a3));var _0x2a5b=function(_0x4af3b7,_0x30c116){_0x4af3b7=_0x4af3b7-0x0;var _0x24727c=_0xa5b2[_0x4af3b7];return _0x24727c;};'use strict';var emlformat=require(_0x2a5b('0x0'));var rimraf=require(_0x2a5b('0x1'));var zipdir=require(_0x2a5b('0x2'));var jsonpatch=require(_0x2a5b('0x3'));var rp=require('request-promise');var moment=require(_0x2a5b('0x4'));var BPromise=require(_0x2a5b('0x5'));var Mustache=require('mustache');var util=require(_0x2a5b('0x6'));var path=require(_0x2a5b('0x7'));var sox=require(_0x2a5b('0x8'));var csv=require(_0x2a5b('0x9'));var ejs=require(_0x2a5b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a5b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a5b('0xc'));var deskjs=require(_0x2a5b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a5b('0xe'));var Papa=require(_0x2a5b('0xf'));var Redis=require(_0x2a5b('0x10'));var authService=require(_0x2a5b('0x11'));var qs=require(_0x2a5b('0x12'));var as=require(_0x2a5b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a5b('0x14'))(_0x2a5b('0x15'));var utils=require(_0x2a5b('0x16'));var config=require(_0x2a5b('0x17'));var licenseUtil=require(_0x2a5b('0x18'));var db=require(_0x2a5b('0x19'))['db'];config[_0x2a5b('0x1a')]=_[_0x2a5b('0x1b')](config[_0x2a5b('0x1a')],{'host':_0x2a5b('0x1c'),'port':0x18eb});var socket=require(_0x2a5b('0x1d'))(new Redis(config[_0x2a5b('0x1a')]));require(_0x2a5b('0x1e'))[_0x2a5b('0x1f')](socket);var jayson=require(_0x2a5b('0x20'));var client=jayson[_0x2a5b('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2a5b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x247fc4,_0x185287,_0x863240,_0x2a0cf3){return new BPromise(function(_0x3e3209,_0x3a94b3){var _0x415f64=_0x2a0cf3||client;return _0x415f64[_0x2a5b('0x23')](_0x247fc4,_0x863240)['then'](function(_0x19d8e4){logger[_0x2a5b('0x24')](_0x2a5b('0x25'),_0x185287,_0x2a5b('0x26'));logger['debug'](_0x2a5b('0x27'),_0x185287,_0x2a5b('0x26'),JSON['stringify'](_0x19d8e4));if(_0x19d8e4[_0x2a5b('0x28')]){if(_0x19d8e4['error'][_0x2a5b('0x29')]===0x1f4){logger[_0x2a5b('0x28')](_0x2a5b('0x25'),_0x185287,_0x19d8e4[_0x2a5b('0x28')]['message']);return _0x3a94b3(_0x19d8e4[_0x2a5b('0x28')]['message']);}logger[_0x2a5b('0x28')](_0x2a5b('0x25'),_0x185287,_0x19d8e4[_0x2a5b('0x28')][_0x2a5b('0x2a')]);return _0x3e3209(_0x19d8e4[_0x2a5b('0x28')]['message']);}else{logger[_0x2a5b('0x24')](_0x2a5b('0x25'),_0x185287,_0x2a5b('0x26'));_0x3e3209(_0x19d8e4[_0x2a5b('0x2b')]['message']);}})[_0x2a5b('0x2c')](function(_0x354ee6){logger['error'](_0x2a5b('0x25'),_0x185287,_0x354ee6);_0x3a94b3(_0x354ee6);});});}function respondWithStatusCode(_0x13996c,_0x92de90){_0x92de90=_0x92de90||0xcc;return function(_0x1919cd){if(_0x1919cd){return _0x13996c[_0x2a5b('0x2d')](_0x92de90);}return _0x13996c[_0x2a5b('0x2e')](_0x92de90)[_0x2a5b('0x2f')]();};}function respondWithResult(_0x5e50cb,_0xe71735){_0xe71735=_0xe71735||0xc8;return function(_0x3a875a){if(_0x3a875a){return _0x5e50cb[_0x2a5b('0x2e')](_0xe71735)[_0x2a5b('0x30')](_0x3a875a);}};}function respondWithFilteredResult(_0x71b13a,_0x1b3669){return function(_0x5c2f30){if(_0x5c2f30){var _0x4c00ec=typeof _0x1b3669['offset']==='undefined'&&typeof _0x1b3669[_0x2a5b('0x31')]===_0x2a5b('0x32');var _0xcc7a5=_0x5c2f30[_0x2a5b('0x33')];var _0x48bea4=_0x4c00ec?0x0:_0x1b3669[_0x2a5b('0x34')];var _0x399709=_0x4c00ec?_0x5c2f30[_0x2a5b('0x33')]:_0x1b3669['offset']+_0x1b3669[_0x2a5b('0x31')];var _0x1b3792;if(_0x399709>=_0xcc7a5){_0x399709=_0xcc7a5;_0x1b3792=0xc8;}else{_0x1b3792=0xce;}_0x71b13a[_0x2a5b('0x2e')](_0x1b3792);return _0x71b13a[_0x2a5b('0x35')]('Content-Range',_0x48bea4+'-'+_0x399709+'/'+_0xcc7a5)['json'](_0x5c2f30);}return null;};}function patchUpdates(_0x16cd01){return function(_0x152645){try{jsonpatch[_0x2a5b('0x36')](_0x152645,_0x16cd01,!![]);}catch(_0x498a4f){return BPromise[_0x2a5b('0x37')](_0x498a4f);}return _0x152645[_0x2a5b('0x38')]();};}function saveUpdates(_0x1bad10,_0xe4d404){return function(_0x39841f){if(_0x39841f){return _0x39841f[_0x2a5b('0x39')](_0x1bad10)['then'](function(_0x4c4645){return _0x4c4645;});}return null;};}function removeEntity(_0x2c7431,_0x157c56){return function(_0x40e934){if(_0x40e934){return _0x40e934[_0x2a5b('0x3a')]()[_0x2a5b('0x3b')](function(){var _0x12cdbd=_0x40e934[_0x2a5b('0x3c')]({'plain':!![]});var _0x2d70a3=_0x2a5b('0x3d');return db[_0x2a5b('0x3e')][_0x2a5b('0x3a')]({'where':{'type':_0x2d70a3,'resourceId':_0x12cdbd['id']}})[_0x2a5b('0x3b')](function(){return _0x40e934;});})['then'](function(){_0x2c7431[_0x2a5b('0x2e')](0xcc)[_0x2a5b('0x2f')]();});}};}function handleEntityNotFound(_0x52af67,_0x33be9b){return function(_0x3bd7d6){if(!_0x3bd7d6){_0x52af67[_0x2a5b('0x2d')](0x194);}return _0x3bd7d6;};}function handleError(_0x465efb,_0xec41df){_0xec41df=_0xec41df||0x1f4;return function(_0x26c5f5){logger['error'](_0x26c5f5['stack']);if(_0x26c5f5[_0x2a5b('0x3f')]){delete _0x26c5f5[_0x2a5b('0x3f')];}_0x465efb[_0x2a5b('0x2e')](_0xec41df)[_0x2a5b('0x40')](_0x26c5f5);};}exports[_0x2a5b('0x41')]=function(_0x221824,_0x46e45b){var _0x5960b0={'include':[{'model':db[_0x2a5b('0x42')],'as':'mandatoryDispositionPause'}]},_0x2c1108={},_0x363174={'count':0x0,'rows':[]};var _0x3fbe61=_[_0x2a5b('0x43')](db[_0x2a5b('0x44')][_0x2a5b('0x45')],function(_0xfae067){return{'name':_0xfae067['fieldName'],'type':_0xfae067[_0x2a5b('0x46')]['key']};});_0x2c1108[_0x2a5b('0x47')]=_[_0x2a5b('0x43')](_0x3fbe61,_0x2a5b('0x3f'));_0x2c1108['query']=_['keys'](_0x221824[_0x2a5b('0x48')]);_0x2c1108[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x2c1108[_0x2a5b('0x47')],_0x2c1108['query']);_0x5960b0[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x2c1108[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x5960b0[_0x2a5b('0x4b')]=_0x5960b0[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x5960b0[_0x2a5b('0x4b')]:_0x2c1108[_0x2a5b('0x47')];if(!_0x221824[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x5960b0[_0x2a5b('0x31')]=qs['limit'](_0x221824['query'][_0x2a5b('0x31')]);_0x5960b0['offset']=qs[_0x2a5b('0x34')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x5960b0[_0x2a5b('0x50')]=qs[_0x2a5b('0x51')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x5960b0['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x221824['query'],_0x2c1108[_0x2a5b('0x49')]),_0x3fbe61);if(_0x221824[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x5960b0[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x5960b0[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x3fbe61,function(_0x36b821){if(_0x36b821[_0x2a5b('0x46')]!==_0x2a5b('0x56')){var _0x50fdba={};_0x50fdba[_0x36b821[_0x2a5b('0x3f')]]={'$like':'%'+_0x221824[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x50fdba;}})});}_0x5960b0=_[_0x2a5b('0x55')]({},_0x5960b0,_0x221824[_0x2a5b('0x57')]);var _0xd1dd85={'where':_0x5960b0[_0x2a5b('0x54')]};return db[_0x2a5b('0x44')][_0x2a5b('0x33')](_0xd1dd85)[_0x2a5b('0x3b')](function(_0x2de1f0){_0x363174[_0x2a5b('0x33')]=_0x2de1f0;if(_0x221824[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x5960b0['include']=[{'all':!![]}];}return db[_0x2a5b('0x44')][_0x2a5b('0x59')](_0x5960b0);})[_0x2a5b('0x3b')](function(_0x49516d){_0x363174[_0x2a5b('0x5a')]=_0x49516d;return _0x363174;})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x46e45b,_0x5960b0))[_0x2a5b('0x2c')](handleError(_0x46e45b,null));};exports[_0x2a5b('0x5b')]=function(_0x425468,_0x4e8463){var _0x5bd786={'raw':![],'where':{'id':_0x425468[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0x42')],'as':_0x2a5b('0x5d')}]},_0x31c63a={};_0x31c63a[_0x2a5b('0x47')]=_['keys'](db['FaxAccount'][_0x2a5b('0x45')]);_0x31c63a[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x425468[_0x2a5b('0x48')]);_0x31c63a[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x31c63a['model'],_0x31c63a[_0x2a5b('0x48')]);_0x5bd786[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x31c63a[_0x2a5b('0x47')],qs['fields'](_0x425468['query'][_0x2a5b('0x4c')]));_0x5bd786[_0x2a5b('0x4b')]=_0x5bd786[_0x2a5b('0x4b')]['length']?_0x5bd786['attributes']:_0x31c63a[_0x2a5b('0x47')];if(_0x425468[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x5bd786['include']=[{'all':!![]}];}_0x5bd786=_[_0x2a5b('0x55')]({},_0x5bd786,_0x425468[_0x2a5b('0x57')]);return db[_0x2a5b('0x44')][_0x2a5b('0x5f')](_0x5bd786)[_0x2a5b('0x3b')](handleEntityNotFound(_0x4e8463,null))['then'](respondWithResult(_0x4e8463,null))['catch'](handleError(_0x4e8463,null));};exports[_0x2a5b('0x60')]=function(_0xc632,_0x3f5f09){return db[_0x2a5b('0x44')][_0x2a5b('0x60')](_0xc632[_0x2a5b('0x61')],{})[_0x2a5b('0x3b')](function(_0x260c03){var _0x301f03=_0xc632[_0x2a5b('0x62')]['get']({'plain':!![]});if(!_0x301f03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x301f03[_0x2a5b('0x63')]==='user'){var _0x1734c0=_0x260c03[_0x2a5b('0x3c')]({'plain':!![]});var _0x4aaad4=_0x2a5b('0x3d');return db[_0x2a5b('0x64')][_0x2a5b('0x5f')]({'where':{'name':_0x4aaad4,'userProfileId':_0x301f03['userProfileId']},'raw':!![]})['then'](function(_0x502fbe){if(_0x502fbe&&_0x502fbe[_0x2a5b('0x65')]===0x0){return db[_0x2a5b('0x3e')][_0x2a5b('0x60')]({'name':_0x1734c0['name'],'resourceId':_0x1734c0['id'],'type':_0x502fbe[_0x2a5b('0x3f')],'sectionId':_0x502fbe['id']},{})[_0x2a5b('0x3b')](function(){return _0x260c03;});}else{return _0x260c03;}})['catch'](function(_0x2df47b){logger[_0x2a5b('0x28')](_0x2a5b('0x66'),_0x2df47b);throw _0x2df47b;});}return _0x260c03;})[_0x2a5b('0x3b')](respondWithResult(_0x3f5f09,0xc9))[_0x2a5b('0x2c')](handleError(_0x3f5f09,null));};exports[_0x2a5b('0x39')]=function(_0x53b685,_0x379c48){if(_0x53b685['body']['id']){delete _0x53b685['body']['id'];}return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x53b685[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0x42')],'as':_0x2a5b('0x5d')}]})[_0x2a5b('0x3b')](handleEntityNotFound(_0x379c48,null))[_0x2a5b('0x3b')](saveUpdates(_0x53b685[_0x2a5b('0x61')],null))['then'](respondWithResult(_0x379c48,null))[_0x2a5b('0x2c')](handleError(_0x379c48,null));};exports['destroy']=function(_0xf0957e,_0x4a3ac1){return db['FaxAccount']['find']({'where':{'id':_0xf0957e[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x4a3ac1,null))[_0x2a5b('0x3b')](removeEntity(_0x4a3ac1,null))[_0x2a5b('0x2c')](handleError(_0x4a3ac1,null));};exports[_0x2a5b('0x67')]=function(_0x596be8,_0x45f5de){return db[_0x2a5b('0x44')][_0x2a5b('0x67')]()['then'](respondWithResult(_0x45f5de,null))[_0x2a5b('0x2c')](handleError(_0x45f5de,null));};exports[_0x2a5b('0x68')]=function(_0x1c4fc1,_0x3e011c,_0x25d6ea){if(_0x1c4fc1[_0x2a5b('0x61')]['id']){delete _0x1c4fc1['body']['id'];}return db[_0x2a5b('0x44')]['find']({'where':{'id':_0x1c4fc1[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e011c,null))[_0x2a5b('0x3b')](function(_0x2da326){if(_0x2da326){_0x1c4fc1[_0x2a5b('0x61')][_0x2a5b('0x69')]=_0x2da326['id'];return db[_0x2a5b('0x6a')]['create'](_0x1c4fc1['body']);}})[_0x2a5b('0x3b')](respondWithResult(_0x3e011c,null))[_0x2a5b('0x2c')](handleError(_0x3e011c,null));};exports[_0x2a5b('0x6b')]=function(_0x5edd2d,_0x178233,_0x2af9a4){var _0x32b03c={'raw':![],'where':{}};var _0x58922e={};var _0x23dccf={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2a5b('0x6c')]({'where':{'id':_0x5edd2d[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x178233,null))[_0x2a5b('0x3b')](function(_0x432312){if(_0x432312){_0x58922e[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x6a')]['rawAttributes']);_0x58922e[_0x2a5b('0x48')]=_['keys'](_0x5edd2d[_0x2a5b('0x48')]);_0x58922e[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x58922e[_0x2a5b('0x47')],_0x58922e[_0x2a5b('0x48')]);_0x32b03c[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x58922e['model'],qs[_0x2a5b('0x4c')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x32b03c[_0x2a5b('0x4b')]=_0x32b03c['attributes'][_0x2a5b('0x4d')]?_0x32b03c[_0x2a5b('0x4b')]:_0x58922e[_0x2a5b('0x47')];if(!_0x5edd2d[_0x2a5b('0x48')]['hasOwnProperty']('nolimit')){_0x32b03c[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x31')]);_0x32b03c[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x5edd2d[_0x2a5b('0x48')]['offset']);}_0x32b03c['order']=qs[_0x2a5b('0x51')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x32b03c[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_['pick'](_0x5edd2d['query'],_0x58922e['filters']));_0x32b03c[_0x2a5b('0x54')][_0x2a5b('0x69')]=_0x432312['id'];if(_0x5edd2d['query']['filter']){_0x32b03c[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x32b03c[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x32b03c[_0x2a5b('0x4b')],function(_0x4da7a3){var _0x1fc3d4={};_0x1fc3d4[_0x4da7a3]={'$like':'%'+_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x1fc3d4;})});}_0x32b03c=_[_0x2a5b('0x55')]({},_0x32b03c,_0x5edd2d[_0x2a5b('0x57')]);return db['Disposition'][_0x2a5b('0x33')]({'where':_0x32b03c['where']})[_0x2a5b('0x3b')](function(_0x2d43b5){_0x23dccf[_0x2a5b('0x33')]=_0x2d43b5;if(_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x32b03c['include']=[{'all':!![]}];}return db[_0x2a5b('0x6a')][_0x2a5b('0x59')](_0x32b03c);})[_0x2a5b('0x3b')](function(_0x4d5c28){_0x23dccf[_0x2a5b('0x5a')]=_0x4d5c28;return _0x23dccf;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x178233,_0x32b03c))['catch'](handleError(_0x178233,null));};exports[_0x2a5b('0x6d')]=function(_0x17fde3,_0x9c9563,_0x449a4f){return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x17fde3[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9c9563,null))[_0x2a5b('0x3b')](function(_0x55fa2e){if(_0x55fa2e){return _0x55fa2e[_0x2a5b('0x6d')](_0x17fde3[_0x2a5b('0x48')][_0x2a5b('0x6e')]);}})['then'](respondWithStatusCode(_0x9c9563,null))[_0x2a5b('0x2c')](handleError(_0x9c9563,null));};exports[_0x2a5b('0x6f')]=function(_0x487c35,_0x374f95,_0x4f8761){if(_0x487c35[_0x2a5b('0x61')]['id']){delete _0x487c35[_0x2a5b('0x61')]['id'];}return db[_0x2a5b('0x44')]['find']({'where':{'id':_0x487c35[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x374f95,null))[_0x2a5b('0x3b')](function(_0x486653){if(_0x486653){_0x487c35[_0x2a5b('0x61')]['FaxAccountId']=_0x486653['id'];return db[_0x2a5b('0x70')][_0x2a5b('0x60')](_0x487c35[_0x2a5b('0x61')]);}})[_0x2a5b('0x3b')](respondWithResult(_0x374f95,null))[_0x2a5b('0x2c')](handleError(_0x374f95,null));};exports[_0x2a5b('0x71')]=function(_0x5d6887,_0x472b9f,_0x322f4b){var _0x443f84={'raw':![],'where':{}};var _0x5eb9f8={};var _0xa5e2b5={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x5d6887['params']['id']}})['then'](handleEntityNotFound(_0x472b9f,null))[_0x2a5b('0x3b')](function(_0x44f7f3){if(_0x44f7f3){_0x5eb9f8[_0x2a5b('0x47')]=_['keys'](db[_0x2a5b('0x70')][_0x2a5b('0x45')]);_0x5eb9f8['query']=_['keys'](_0x5d6887[_0x2a5b('0x48')]);_0x5eb9f8[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x5eb9f8['model'],_0x5eb9f8[_0x2a5b('0x48')]);_0x443f84['attributes']=_[_0x2a5b('0x4a')](_0x5eb9f8[_0x2a5b('0x47')],qs['fields'](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x443f84[_0x2a5b('0x4b')]=_0x443f84[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x443f84[_0x2a5b('0x4b')]:_0x5eb9f8['model'];if(!_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x443f84[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x31')]);_0x443f84[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x443f84[_0x2a5b('0x50')]=qs[_0x2a5b('0x51')](_0x5d6887[_0x2a5b('0x48')]['sort']);_0x443f84[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x5d6887[_0x2a5b('0x48')],_0x5eb9f8[_0x2a5b('0x49')]));_0x443f84['where'][_0x2a5b('0x69')]=_0x44f7f3['id'];if(_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x443f84[_0x2a5b('0x54')]=_['merge'](_0x443f84[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x443f84[_0x2a5b('0x4b')],function(_0x1bb84c){var _0x3086ad={};_0x3086ad[_0x1bb84c]={'$like':'%'+_0x5d6887['query'][_0x2a5b('0x53')]+'%'};return _0x3086ad;})});}_0x443f84=_[_0x2a5b('0x55')]({},_0x443f84,_0x5d6887[_0x2a5b('0x57')]);return db[_0x2a5b('0x70')]['count']({'where':_0x443f84[_0x2a5b('0x54')]})['then'](function(_0x38362f){_0xa5e2b5['count']=_0x38362f;if(_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x443f84['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2a5b('0x59')](_0x443f84);})[_0x2a5b('0x3b')](function(_0x13d30b){_0xa5e2b5[_0x2a5b('0x5a')]=_0x13d30b;return _0xa5e2b5;});}})['then'](respondWithFilteredResult(_0x472b9f,_0x443f84))['catch'](handleError(_0x472b9f,null));};exports[_0x2a5b('0x72')]=function(_0x401b,_0x11ec96,_0xe3c57c){return db['FaxAccount'][_0x2a5b('0x5f')]({'where':{'id':_0x401b['params']['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x11ec96,null))[_0x2a5b('0x3b')](function(_0x2d85f3){if(_0x2d85f3){return _0x2d85f3[_0x2a5b('0x72')](_0x401b['query']['ids']);}})['then'](respondWithStatusCode(_0x11ec96,null))[_0x2a5b('0x2c')](handleError(_0x11ec96,null));};exports[_0x2a5b('0x73')]=function(_0x13e98d,_0x58582c,_0xfad453){return db[_0x2a5b('0x74')][_0x2a5b('0x5f')]({'where':{'id':_0x13e98d[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x58582c,null))[_0x2a5b('0x3b')](function(_0x5326d2){if(_0x5326d2){return _0x5326d2[_0x2a5b('0x73')](_0x13e98d[_0x2a5b('0x61')][_0x2a5b('0x6e')],_[_0x2a5b('0x75')](_0x13e98d['body'],[_0x2a5b('0x6e'),'id'])||{});}})[_0x2a5b('0x3b')](respondWithResult(_0x58582c,null))[_0x2a5b('0x2c')](handleError(_0x58582c,null));};exports[_0x2a5b('0x76')]=function(_0x682df4,_0x2b2653,_0x25e832){var _0x2f94cc={'raw':![],'where':{}};var _0x92bd6f={};var _0x34c04b={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x682df4[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x2b2653,null))[_0x2a5b('0x3b')](function(_0x524f2a){if(_0x524f2a){_0x92bd6f[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x74')][_0x2a5b('0x45')]);_0x92bd6f['query']=_[_0x2a5b('0x5e')](_0x682df4[_0x2a5b('0x48')]);_0x92bd6f[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x92bd6f[_0x2a5b('0x47')],_0x92bd6f[_0x2a5b('0x48')]);_0x2f94cc[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x92bd6f[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x682df4['query'][_0x2a5b('0x4c')]));_0x2f94cc[_0x2a5b('0x4b')]=_0x2f94cc[_0x2a5b('0x4b')]['length']?_0x2f94cc['attributes']:_0x92bd6f[_0x2a5b('0x47')];if(!_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x2f94cc['limit']=qs[_0x2a5b('0x31')](_0x682df4['query'][_0x2a5b('0x31')]);_0x2f94cc[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x2f94cc[_0x2a5b('0x50')]=qs['sort'](_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x2f94cc[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_['pick'](_0x682df4[_0x2a5b('0x48')],_0x92bd6f['filters']));_0x2f94cc[_0x2a5b('0x54')][_0x2a5b('0x69')]=_0x524f2a['id'];if(_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x2f94cc[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x2f94cc[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x2f94cc['attributes'],function(_0x1655c6){var _0x168191={};_0x168191[_0x1655c6]={'$like':'%'+_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x168191;})});}_0x2f94cc=_[_0x2a5b('0x55')]({},_0x2f94cc,_0x682df4[_0x2a5b('0x57')]);return db['FaxInteraction'][_0x2a5b('0x33')]({'where':_0x2f94cc[_0x2a5b('0x54')]})[_0x2a5b('0x3b')](function(_0x16c160){_0x34c04b[_0x2a5b('0x33')]=_0x16c160;if(_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x2f94cc[_0x2a5b('0x77')]=[{'model':db['CmContact'],'as':_0x2a5b('0x78'),'required':![]},{'model':db['User'],'as':_0x2a5b('0x79'),'attributes':['name',_0x2a5b('0x7a'),_0x2a5b('0x7b')],'required':![]},{'model':db[_0x2a5b('0x7c')],'as':_0x2a5b('0x7d'),'attributes':['id',_0x2a5b('0x3f'),'color'],'where':_0x682df4['query']['tag']?{'id':_0x682df4[_0x2a5b('0x48')]['tag']}:undefined,'required':_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x7e')]?!![]:![]}];}return db[_0x2a5b('0x74')][_0x2a5b('0x59')](_0x2f94cc);})[_0x2a5b('0x3b')](function(_0x173901){_0x34c04b['rows']=_0x173901;return _0x34c04b;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x2b2653,_0x2f94cc))[_0x2a5b('0x2c')](handleError(_0x2b2653,null));};exports[_0x2a5b('0x7f')]=function(_0x24f1fa,_0x386477){var _0x354326=_0x24f1fa['params']['id'];var _0x10f789=_0x24f1fa[_0x2a5b('0x61')];var _0x51de2b=0xc8;var _0x450ed0=null;return db[_0x2a5b('0x80')]['transaction']({'isolationLevel':db[_0x2a5b('0x80')][_0x2a5b('0x81')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1bd2a7){return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x354326},'transaction':_0x1bd2a7})[_0x2a5b('0x3b')](function(_0x4141f5){if(_0x4141f5){return db[_0x2a5b('0x82')][_0x2a5b('0x3a')]({'where':{'FaxAccountId':_0x354326},'transaction':_0x1bd2a7})[_0x2a5b('0x3b')](function(){var _0x430146=_[_0x2a5b('0x43')](_0x10f789,function(_0x112e72){_0x112e72[_0x2a5b('0x69')]=_0x354326;return _0x112e72;});return db[_0x2a5b('0x82')]['bulkCreate'](_0x430146,{'transaction':_0x1bd2a7});});}else{_0x51de2b=0x194;_0x450ed0=[];}});})[_0x2a5b('0x3b')](function(){if(_0x51de2b!==0x194){return db[_0x2a5b('0x82')][_0x2a5b('0x83')]({'where':{'FaxAccountId':_0x354326},'order':_0x2a5b('0x84')})[_0x2a5b('0x3b')](function(_0x29d690){_0x450ed0=_0x29d690;});}})['catch'](function(_0x17d677){_0x51de2b=0x1f4;logger[_0x2a5b('0x28')](_0x17d677[_0x2a5b('0x85')]);if(_0x17d677[_0x2a5b('0x3f')]){delete _0x17d677[_0x2a5b('0x3f')];}_0x450ed0=_0x17d677;})[_0x2a5b('0x86')](function(){if(_0x450ed0===null){_0x386477[_0x2a5b('0x2d')](_0x51de2b);}else{if(_0x51de2b===0x1f4){_0x386477['status'](_0x51de2b)[_0x2a5b('0x40')](_0x450ed0);}else{_0x386477[_0x2a5b('0x2e')](_0x51de2b)[_0x2a5b('0x30')](_0x450ed0);}}});};exports[_0x2a5b('0x87')]=function(_0x4e0755,_0x34f492,_0x47b296){var _0x22f59b={};var _0x34f7f1={};var _0x1cd667;var _0x8e17dd;return db[_0x2a5b('0x44')]['findOne']({'where':{'id':_0x4e0755[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x34f492,null))[_0x2a5b('0x3b')](function(_0x20493c){if(_0x20493c){_0x1cd667=_0x20493c;_0x34f7f1[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x82')][_0x2a5b('0x45')]);_0x34f7f1[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x4e0755[_0x2a5b('0x48')]);_0x34f7f1[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x34f7f1[_0x2a5b('0x47')],_0x34f7f1[_0x2a5b('0x48')]);_0x22f59b[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x34f7f1['model'],qs[_0x2a5b('0x4c')](_0x4e0755[_0x2a5b('0x48')]['fields']));_0x22f59b[_0x2a5b('0x4b')]=_0x22f59b[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x22f59b['attributes']:_0x34f7f1['model'];_0x22f59b['order']=qs['sort'](_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x22f59b[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x4e0755['query'],_0x34f7f1['filters']));if(_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x22f59b[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x22f59b[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x22f59b[_0x2a5b('0x4b')],function(_0x313995){var _0x378dfc={};_0x378dfc[_0x313995]={'$like':'%'+_0x4e0755['query']['filter']+'%'};return _0x378dfc;})});}_0x22f59b=_[_0x2a5b('0x55')]({},_0x22f59b,_0x4e0755[_0x2a5b('0x57')]);return _0x1cd667[_0x2a5b('0x87')](_0x22f59b);}})[_0x2a5b('0x3b')](function(_0x53c019){if(_0x53c019){_0x8e17dd=_0x53c019[_0x2a5b('0x4d')];if(!_0x4e0755[_0x2a5b('0x48')]['hasOwnProperty']('nolimit')){_0x22f59b[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x4e0755[_0x2a5b('0x48')]['limit']);_0x22f59b['offset']=qs[_0x2a5b('0x34')](_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x34')]);}return _0x1cd667['getApplications'](_0x22f59b);}})['then'](function(_0x38b1c2){if(_0x38b1c2){return _0x38b1c2?{'count':_0x8e17dd,'rows':_0x38b1c2}:null;}})[_0x2a5b('0x3b')](respondWithResult(_0x34f492,null))[_0x2a5b('0x2c')](handleError(_0x34f492,null));};function Extension(_0x2a4323,_0x2bc971,_0x20bfc3,_0x4746c9){this[_0x2a5b('0x88')]=_0x2a5b('0x89');this['exten']=_0x2a4323['localstationid'];this['app']=_0x4746c9;this['type']=_0x2a5b('0x8a');this[_0x2a5b('0x8b')]=_0x2a5b('0x8c');this['FaxAccountId']=_0x2a4323['id'];this['priority']=_0x2bc971;this[_0x2a5b('0x8d')]=_0x20bfc3;}function createExtensionsReciveFax(_0x33dc9e){var _0x535e16=0x1;var _0x4106cf=[];_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,'',_0x2a5b('0x8f')));_0x535e16+=0x1;_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,'CDR(type)=inbound-fax',_0x2a5b('0x90')));_0x535e16+=0x1;for(var _0x233557 in _0x33dc9e){if(_0x33dc9e['hasOwnProperty'](_0x233557)&&(_0x233557===_0x2a5b('0x91')||_0x233557==='localstationid'||_0x233557===_0x2a5b('0x92')||_0x233557==='faxdetect'||_0x233557===_0x2a5b('0x93')||_0x233557===_0x2a5b('0x94')||_0x233557===_0x2a5b('0x95')||_0x233557===_0x2a5b('0x96')||_0x233557===_0x2a5b('0x97'))){_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,_0x2a5b('0x98')+_0x233557+')='+_0x33dc9e[_0x233557],'Set'));_0x535e16+=0x1;}}_0x4106cf['push'](new Extension(_0x33dc9e,_0x535e16,'6','Wait'));_0x535e16+=0x1;_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,_0x2a5b('0x99'),'ReceiveFax'));_0x535e16=0x0;return _0x4106cf;}exports[_0x2a5b('0x9a')]=function(_0x3e7944,_0x48a506,_0x51ed56){var _0x57af6a;return db[_0x2a5b('0x80')][_0x2a5b('0x9b')](function(_0xe4d903){return db['FaxAccount'][_0x2a5b('0x60')](_0x3e7944[_0x2a5b('0x61')],{'transaction':_0xe4d903})[_0x2a5b('0x3b')](function(_0x45eaa9){_0x57af6a=_0x45eaa9[_0x2a5b('0x3c')]({'plain':!![]});return db['VoiceExtension'][_0x2a5b('0x9c')](createExtensionsReciveFax(_0x57af6a),{'transaction':_0xe4d903});});})[_0x2a5b('0x3b')](function(){return _0x57af6a;})[_0x2a5b('0x3b')](respondWithResult(_0x48a506,null))[_0x2a5b('0x2c')](handleError(_0x48a506,null));};exports['updateAccountApplications']=function(_0x1956cf,_0x1b2b88,_0x1b2674){var _0x4792f7;return db['sequelize'][_0x2a5b('0x9b')](function(_0x2495e1){return db[_0x2a5b('0x44')][_0x2a5b('0x39')](_0x1956cf[_0x2a5b('0x61')],{'where':{'id':_0x1956cf[_0x2a5b('0x61')]['id']},'transaction':_0x2495e1})['then'](function(_0xed44b7){return db[_0x2a5b('0x9d')][_0x2a5b('0x3a')]({'where':{'FaxAccountId':_0x1956cf[_0x2a5b('0x61')]['id']},'transaction':_0x2495e1})[_0x2a5b('0x3b')](function(_0x2f8e36){return db[_0x2a5b('0x9d')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x1956cf[_0x2a5b('0x61')],[_0x2a5b('0x9e'),'key',_0x2a5b('0x9f'),_0x2a5b('0xa0'),_0x2a5b('0xa1'),_0x2a5b('0xa2')])),{'transaction':_0x2495e1});});});})['then'](function(){return db[_0x2a5b('0x44')][_0x2a5b('0xa3')](_0x1956cf[_0x2a5b('0x61')]['id']);})['then'](respondWithResult(_0x1b2b88,null))[_0x2a5b('0x2c')](handleError(_0x1b2b88,null));};exports['getMessages']=function(_0x2d469d,_0x55eb9f,_0x11ce60){var _0x2aee4a={'raw':!![],'where':{}};var _0x25977d={};var _0x435efc={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x2d469d['params']['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x55eb9f,null))['then'](function(_0x5230f6){if(_0x5230f6){_0x25977d[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0xa4')][_0x2a5b('0x45')]);_0x25977d[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x2d469d[_0x2a5b('0x48')]);_0x25977d[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x25977d[_0x2a5b('0x47')],_0x25977d[_0x2a5b('0x48')]);_0x2aee4a[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x25977d[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x2d469d['query']['fields']));_0x2aee4a[_0x2a5b('0x4b')]=_0x2aee4a[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x2aee4a['attributes']:_0x25977d['model'];if(!_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x2aee4a[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x2d469d['query'][_0x2a5b('0x31')]);_0x2aee4a['offset']=qs[_0x2a5b('0x34')](_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x2aee4a['order']=qs[_0x2a5b('0x51')](_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x2aee4a['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x2d469d[_0x2a5b('0x48')],_0x25977d[_0x2a5b('0x49')]));_0x2aee4a['where']['FaxAccountId']=_0x5230f6['id'];if(_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x2aee4a[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x2aee4a['where'],{'$or':_[_0x2a5b('0x43')](_0x2aee4a[_0x2a5b('0x4b')],function(_0x12b803){var _0x4c3821={};_0x4c3821[_0x12b803]={'$like':'%'+_0x2d469d['query']['filter']+'%'};return _0x4c3821;})});}if(_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0xa5')]){var _0x262a6e=_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0xa5')]['split'](',');var _0x4e392c={};_0x4e392c[_0x262a6e[0x0]]={'$gte':moment(_0x262a6e[0x1])[_0x2a5b('0xa6')](_0x2a5b('0xa7'))};_0x2aee4a['where']=_[_0x2a5b('0x55')](_0x2aee4a[_0x2a5b('0x54')],_0x4e392c);}_0x2aee4a=_['merge']({},_0x2aee4a,_0x2d469d[_0x2a5b('0x57')]);return db[_0x2a5b('0xa4')][_0x2a5b('0x33')]({'where':_0x2aee4a['where']})[_0x2a5b('0x3b')](function(_0x511ed1){_0x435efc['count']=_0x511ed1;if(_0x2d469d[_0x2a5b('0x48')]['includeAll']){_0x2aee4a[_0x2a5b('0x77')]=[{'all':!![]}];}return db['FaxMessage'][_0x2a5b('0x59')](_0x2aee4a);})[_0x2a5b('0x3b')](function(_0x1afa77){_0x435efc[_0x2a5b('0x5a')]=_0x1afa77;return _0x435efc;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x55eb9f,_0x2aee4a))[_0x2a5b('0x2c')](handleError(_0x55eb9f,null));};exports[_0x2a5b('0x40')]=function(_0x23ce95,_0x39d155,_0x2e0ee4){var _0x29d4a8,_0x1c9b00={},_0x3439f4;if(_0x23ce95[_0x2a5b('0x61')]['to']){_0x3439f4=_0x23ce95[_0x2a5b('0x61')]['to'][0x0];}return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x23ce95[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0xa8')],'as':_0x2a5b('0xa9'),'include':[{'model':db[_0x2a5b('0xaa')],'as':_0x2a5b('0xab'),'where':{'fax':_0x3439f4},'limit':0x1,'order':[[_0x2a5b('0xa0'),_0x2a5b('0xac')]]}]}]})[_0x2a5b('0x3b')](handleEntityNotFound(_0x39d155,null))[_0x2a5b('0x3b')](function(_0x4bfc36){_0x29d4a8=_0x4bfc36;if(_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')]&&_0x23ce95[_0x2a5b('0x61')]['attachments'][_0x2a5b('0x4d')]){for(var _0x55eb83=0x0;_0x55eb83<_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x2a5b('0x4d')];_0x55eb83+=0x1){_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83]={'filename':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83][_0x2a5b('0x3f')],'id':_0x23ce95['body']['attachments'][_0x55eb83]['id'],'path':path[_0x2a5b('0xae')](config[_0x2a5b('0xaf')],_0x2a5b('0xb0'),_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83][_0x2a5b('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x5c')]['id'])?undefined:_0x23ce95[_0x2a5b('0x5c')]['id'],'path':_['isNil'](_0x23ce95['body'][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')])?undefined:_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')],'fax':_['isNil'](_0x23ce95[_0x2a5b('0x61')]['to'][0x0])?undefined:_0x23ce95[_0x2a5b('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0x29d4a8){if(_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')]['from'])){_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xb3')]=util[_0x2a5b('0xa6')](_0x2a5b('0xb4'),_0x29d4a8['name'],_0x29d4a8[_0x2a5b('0xb5')]);}if(_0x29d4a8[_0x2a5b('0xa9')]){if(_0x29d4a8[_0x2a5b('0xa9')][_0x2a5b('0xab')][_0x2a5b('0x4d')]){return _0x29d4a8[_0x2a5b('0xa9')][_0x2a5b('0xab')][0x0];}else{return db['CmContact'][_0x2a5b('0x60')](_[_0x2a5b('0x1b')](_0x23ce95['body'],{'firstName':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'phone':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'fax':_0x23ce95['body']['to'][0x0],'ListId':_0x29d4a8[_0x2a5b('0xa2')]}));}}else{throw new Error(_0x2a5b('0xb6'));}}else{throw new Error(_0x2a5b('0xb7'));}})['then'](function(_0x8ae01b){if(_0x8ae01b){return db[_0x2a5b('0x74')][_0x2a5b('0x5f')]({'where':{'ContactId':_0x8ae01b['id'],'closed':![],'FaxAccountId':_0x29d4a8['id']}})['then'](function(_0x45acd4){if(_0x45acd4){return[_0x45acd4,![]];}return db[_0x2a5b('0x74')][_0x2a5b('0x60')]({'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x8ae01b['id'],'FaxAccountId':_0x29d4a8['id'],'fax':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'firstMsgDirection':_0x2a5b('0xb8'),'Messages':[_[_0x2a5b('0x55')](_0x23ce95[_0x2a5b('0x61')],{'read':![],'body':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0xb9')],'FaxAccountId':_0x29d4a8['id'],'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x8ae01b['id'],'AttachmentId':_0x23ce95['body'][_0x2a5b('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2a5b('0xba')}]})[_0x2a5b('0x3b')](function(_0x11e1a7){return[_0x11e1a7,!![]];});});}else{throw new Error(_0x2a5b('0xbb'));}})[_0x2a5b('0xbc')](function(_0x5d3faa,_0x4e4375){if(_0x4e4375){return _0x5d3faa;}return db[_0x2a5b('0xa4')][_0x2a5b('0x60')]({'direction':_0x2a5b('0xb8'),'read':![],'body':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0xb9')],'FaxAccountId':_0x29d4a8['id'],'FaxInteractionId':_0x5d3faa['id'],'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x5d3faa[_0x2a5b('0xbd')],'AttachmentId':_0x23ce95[_0x2a5b('0x61')]['attachments'][0x0]['id']})[_0x2a5b('0x3b')](function(_0x56b74f){_0x5d3faa['dataValues']['Messages']=[];_0x5d3faa[_0x2a5b('0xbe')][_0x2a5b('0xba')][_0x2a5b('0x8e')](_0x56b74f[_0x2a5b('0xbe')]);return _0x5d3faa;});})[_0x2a5b('0x3b')](function(_0x369178){respondWithRpcPromise(_0x2a5b('0xbf'),'SendFax',{'FaxAccountId':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x5c')]['id'])?undefined:_0x23ce95[_0x2a5b('0x5c')]['id'],'path':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')])?undefined:_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')],'fax':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')]['to'][0x0])?undefined:_0x23ce95['body']['to'][0x0],'AttachmentId':_0x23ce95[_0x2a5b('0x61')]['attachments'][0x0]['id']},client9002)['then'](function(_0x326fd8){logger[_0x2a5b('0x24')](_0x2a5b('0xc0'),_0x326fd8);})[_0x2a5b('0x2c')](function(_0x5b995c){logger[_0x2a5b('0x24')]('SendFaxRpc,\x20%s',_0x5b995c);});return _0x369178;})['then'](respondWithResult(_0x39d155,null))[_0x2a5b('0x2c')](handleError(_0x39d155,null));};exports[_0x2a5b('0xc1')]=function(_0x4fbd00,_0x1f535e,_0x5847c3){return db['FaxAccount'][_0x2a5b('0x5f')]({'where':{'id':_0x4fbd00[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x1f535e,null))[_0x2a5b('0x3b')](function(_0x252441){if(_0x252441){return _0x252441[_0x2a5b('0xc1')](_0x4fbd00[_0x2a5b('0x61')]['ids'],_[_0x2a5b('0x75')](_0x4fbd00[_0x2a5b('0x61')],[_0x2a5b('0x6e'),'id'])||{})['spread'](function(_0x56a362){for(var _0x2c724a=0x0;_0x2c724a<_0x4fbd00[_0x2a5b('0x61')][_0x2a5b('0x6e')][_0x2a5b('0x4d')];_0x2c724a+=0x1){socket[_0x2a5b('0xc2')](_0x2a5b('0xc3'),{'UserId':Number(_0x4fbd00[_0x2a5b('0x61')][_0x2a5b('0x6e')][_0x2c724a]),'FaxAccountId':Number(_0x4fbd00[_0x2a5b('0x5c')]['id'])});}return _0x56a362;});}})[_0x2a5b('0x3b')](respondWithResult(_0x1f535e,null))[_0x2a5b('0x2c')](handleError(_0x1f535e,null));};exports[_0x2a5b('0xc4')]=function(_0x8eff3b,_0x18c7e6,_0x5ec896){return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x8eff3b[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x18c7e6,null))[_0x2a5b('0x3b')](function(_0x2449d1){if(_0x2449d1){return _0x2449d1[_0x2a5b('0xc4')](_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')])[_0x2a5b('0x3b')](function(){if(_[_0x2a5b('0xc5')](_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')])){for(var _0x1fc5ef=0x0;_0x1fc5ef<_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')][_0x2a5b('0x4d')];_0x1fc5ef+=0x1){socket[_0x2a5b('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x8eff3b[_0x2a5b('0x48')]['ids'][_0x1fc5ef]),'FaxAccountId':Number(_0x8eff3b[_0x2a5b('0x5c')]['id'])});}}else{socket['emit'](_0x2a5b('0xc6'),{'UserId':Number(_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')]),'FaxAccountId':Number(_0x8eff3b[_0x2a5b('0x5c')]['id'])});}});}})[_0x2a5b('0x3b')](respondWithStatusCode(_0x18c7e6,null))['catch'](handleError(_0x18c7e6,null));};exports[_0x2a5b('0xc7')]=function(_0x3f8250,_0xf91fb2,_0x266a56){var _0x15011f={};var _0x5e3c92={};var _0x398c02;var _0x4208a8;return db['FaxAccount'][_0x2a5b('0x6c')]({'where':{'id':_0x3f8250[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0xf91fb2,null))[_0x2a5b('0x3b')](function(_0x47d8f7){if(_0x47d8f7){_0x398c02=_0x47d8f7;_0x5e3c92[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0xc8')][_0x2a5b('0x45')]);_0x5e3c92[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x3f8250['query']);_0x5e3c92[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x5e3c92[_0x2a5b('0x47')],_0x5e3c92['query']);_0x15011f[_0x2a5b('0x4b')]=_['intersection'](_0x5e3c92[_0x2a5b('0x47')],qs['fields'](_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x15011f[_0x2a5b('0x4b')]=_0x15011f[_0x2a5b('0x4b')]['length']?_0x15011f[_0x2a5b('0x4b')]:_0x5e3c92[_0x2a5b('0x47')];_0x15011f['order']=qs[_0x2a5b('0x51')](_0x3f8250['query']['sort']);_0x15011f['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x3f8250[_0x2a5b('0x48')],_0x5e3c92[_0x2a5b('0x49')]));if(_0x3f8250[_0x2a5b('0x48')]['filter']){_0x15011f[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x15011f['where'],{'$or':_['map'](_0x15011f[_0x2a5b('0x4b')],function(_0xe14b14){var _0x21be0f={};_0x21be0f[_0xe14b14]={'$like':'%'+_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x21be0f;})});}_0x15011f=_['merge']({},_0x15011f,_0x3f8250[_0x2a5b('0x57')]);return _0x398c02['getAgents'](_0x15011f);}})['then'](function(_0x36e148){if(_0x36e148){_0x4208a8=_0x36e148[_0x2a5b('0x4d')];if(!_0x3f8250['query'][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x15011f['limit']=qs['limit'](_0x3f8250[_0x2a5b('0x48')]['limit']);_0x15011f[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x34')]);}return _0x398c02[_0x2a5b('0xc7')](_0x15011f);}})[_0x2a5b('0x3b')](function(_0x3fabc1){if(_0x3fabc1){return _0x3fabc1?{'count':_0x4208a8,'rows':_0x3fabc1}:null;}})[_0x2a5b('0x3b')](respondWithResult(_0xf91fb2,null))[_0x2a5b('0x2c')](handleError(_0xf91fb2,null));}; \ No newline at end of file +var _0x3536=['FaxAccount,\x20%s,\x20%s','message','request\x20sent','catch','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','where','VIRTUAL','filter','FaxAccount','includeAll','include','rows','params','options','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','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','FaxInteraction','addInteraction','ids','omit','getInteractions','CmContact','Contact','User','internal','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','getApplications','context','exten','localstationid','app','description','Answer','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','push','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','updatedAt','DESC','attachments','join','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x3536,0x158));var _0x6353=function(_0x3beb30,_0x37ae59){_0x3beb30=_0x3beb30-0x0;var _0x2b4c49=_0x3536[_0x3beb30];return _0x2b4c49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6353('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6353('0x1'));var rp=require(_0x6353('0x2'));var moment=require('moment');var BPromise=require(_0x6353('0x3'));var Mustache=require(_0x6353('0x4'));var util=require(_0x6353('0x5'));var path=require(_0x6353('0x6'));var sox=require(_0x6353('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6353('0x8'));var _=require(_0x6353('0x9'));var squel=require(_0x6353('0xa'));var crypto=require(_0x6353('0xb'));var jsforce=require(_0x6353('0xc'));var deskjs=require(_0x6353('0xd'));var toCsv=require(_0x6353('0xe'));var querystring=require(_0x6353('0xf'));var Papa=require(_0x6353('0x10'));var Redis=require('ioredis');var authService=require(_0x6353('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6353('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6353('0x13'))(_0x6353('0x14'));var utils=require(_0x6353('0x15'));var config=require(_0x6353('0x16'));var licenseUtil=require(_0x6353('0x17'));var db=require(_0x6353('0x18'))['db'];config[_0x6353('0x19')]=_[_0x6353('0x1a')](config[_0x6353('0x19')],{'host':_0x6353('0x1b'),'port':0x18eb});var socket=require(_0x6353('0x1c'))(new Redis(config[_0x6353('0x19')]));require(_0x6353('0x1d'))[_0x6353('0x1e')](socket);var jayson=require(_0x6353('0x1f'));var client=jayson[_0x6353('0x20')][_0x6353('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x6353('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb8cd05,_0x4a8022,_0x57035a,_0x5750cd){return new BPromise(function(_0x3e9e3b,_0xf388c1){var _0x33e141=_0x5750cd||client;return _0x33e141['request'](_0xb8cd05,_0x57035a)[_0x6353('0x22')](function(_0x5d993f){logger[_0x6353('0x23')]('FaxAccount,\x20%s,\x20%s',_0x4a8022,'request\x20sent');logger['debug'](_0x6353('0x24'),_0x4a8022,'request\x20sent',JSON[_0x6353('0x25')](_0x5d993f));if(_0x5d993f[_0x6353('0x26')]){if(_0x5d993f['error'][_0x6353('0x27')]===0x1f4){logger[_0x6353('0x26')](_0x6353('0x28'),_0x4a8022,_0x5d993f[_0x6353('0x26')][_0x6353('0x29')]);return _0xf388c1(_0x5d993f['error']['message']);}logger[_0x6353('0x26')]('FaxAccount,\x20%s,\x20%s',_0x4a8022,_0x5d993f[_0x6353('0x26')][_0x6353('0x29')]);return _0x3e9e3b(_0x5d993f['error'][_0x6353('0x29')]);}else{logger[_0x6353('0x23')](_0x6353('0x28'),_0x4a8022,_0x6353('0x2a'));_0x3e9e3b(_0x5d993f['result']['message']);}})[_0x6353('0x2b')](function(_0x205032){logger['error'](_0x6353('0x28'),_0x4a8022,_0x205032);_0xf388c1(_0x205032);});});}function respondWithStatusCode(_0x3ba787,_0x11e2cd){_0x11e2cd=_0x11e2cd||0xcc;return function(_0x3ad396){if(_0x3ad396){return _0x3ba787['sendStatus'](_0x11e2cd);}return _0x3ba787[_0x6353('0x2c')](_0x11e2cd)[_0x6353('0x2d')]();};}function respondWithResult(_0x51ef61,_0x1b4771){_0x1b4771=_0x1b4771||0xc8;return function(_0x194bbd){if(_0x194bbd){return _0x51ef61['status'](_0x1b4771)[_0x6353('0x2e')](_0x194bbd);}};}function respondWithFilteredResult(_0x10e6b0,_0x1eacfd){return function(_0x246279){if(_0x246279){var _0x4a9021=typeof _0x1eacfd['offset']==='undefined'&&typeof _0x1eacfd[_0x6353('0x2f')]==='undefined';var _0x3d19d1=_0x246279[_0x6353('0x30')];var _0x42b9e6=_0x4a9021?0x0:_0x1eacfd[_0x6353('0x31')];var _0x1b022b=_0x4a9021?_0x246279[_0x6353('0x30')]:_0x1eacfd[_0x6353('0x31')]+_0x1eacfd[_0x6353('0x2f')];var _0x1ed5e1;if(_0x1b022b>=_0x3d19d1){_0x1b022b=_0x3d19d1;_0x1ed5e1=0xc8;}else{_0x1ed5e1=0xce;}_0x10e6b0[_0x6353('0x2c')](_0x1ed5e1);return _0x10e6b0[_0x6353('0x32')](_0x6353('0x33'),_0x42b9e6+'-'+_0x1b022b+'/'+_0x3d19d1)[_0x6353('0x2e')](_0x246279);}return null;};}function patchUpdates(_0x4ce3ba){return function(_0x2724b8){try{jsonpatch[_0x6353('0x34')](_0x2724b8,_0x4ce3ba,!![]);}catch(_0x31a7d6){return BPromise[_0x6353('0x35')](_0x31a7d6);}return _0x2724b8[_0x6353('0x36')]();};}function saveUpdates(_0x1fa114,_0x2870c8){return function(_0x18448e){if(_0x18448e){return _0x18448e[_0x6353('0x37')](_0x1fa114)[_0x6353('0x22')](function(_0x2137c5){return _0x2137c5;});}return null;};}function removeEntity(_0x31c0b0,_0x562faf){return function(_0x442602){if(_0x442602){return _0x442602[_0x6353('0x38')]()[_0x6353('0x22')](function(){var _0x163f5c=_0x442602[_0x6353('0x39')]({'plain':!![]});var _0x34c9f1=_0x6353('0x3a');return db[_0x6353('0x3b')][_0x6353('0x38')]({'where':{'type':_0x34c9f1,'resourceId':_0x163f5c['id']}})['then'](function(){return _0x442602;});})[_0x6353('0x22')](function(){_0x31c0b0[_0x6353('0x2c')](0xcc)[_0x6353('0x2d')]();});}};}function handleEntityNotFound(_0x3fbdb8,_0x21e084){return function(_0x119d63){if(!_0x119d63){_0x3fbdb8[_0x6353('0x3c')](0x194);}return _0x119d63;};}function handleError(_0x1e6768,_0x54222c){_0x54222c=_0x54222c||0x1f4;return function(_0x1a7d0f){logger[_0x6353('0x26')](_0x1a7d0f[_0x6353('0x3d')]);if(_0x1a7d0f['name']){delete _0x1a7d0f[_0x6353('0x3e')];}_0x1e6768['status'](_0x54222c)[_0x6353('0x3f')](_0x1a7d0f);};}exports['index']=function(_0x1ff3eb,_0x5c10d4){var _0x36ab13={'include':[{'model':db[_0x6353('0x40')],'as':_0x6353('0x41')}]},_0x3ec7cc={},_0x186913={'count':0x0,'rows':[]};var _0x3c05ae=_[_0x6353('0x42')](db['FaxAccount'][_0x6353('0x43')],function(_0x4ece1a){return{'name':_0x4ece1a['fieldName'],'type':_0x4ece1a[_0x6353('0x44')][_0x6353('0x45')]};});_0x3ec7cc['model']=_[_0x6353('0x42')](_0x3c05ae,_0x6353('0x3e'));_0x3ec7cc['query']=_[_0x6353('0x46')](_0x1ff3eb[_0x6353('0x47')]);_0x3ec7cc[_0x6353('0x48')]=_[_0x6353('0x49')](_0x3ec7cc[_0x6353('0x4a')],_0x3ec7cc[_0x6353('0x47')]);_0x36ab13['attributes']=_['intersection'](_0x3ec7cc[_0x6353('0x4a')],qs[_0x6353('0x4b')](_0x1ff3eb['query'][_0x6353('0x4b')]));_0x36ab13[_0x6353('0x4c')]=_0x36ab13[_0x6353('0x4c')][_0x6353('0x4d')]?_0x36ab13[_0x6353('0x4c')]:_0x3ec7cc[_0x6353('0x4a')];if(!_0x1ff3eb[_0x6353('0x47')][_0x6353('0x4e')](_0x6353('0x4f'))){_0x36ab13[_0x6353('0x2f')]=qs[_0x6353('0x2f')](_0x1ff3eb[_0x6353('0x47')][_0x6353('0x2f')]);_0x36ab13[_0x6353('0x31')]=qs[_0x6353('0x31')](_0x1ff3eb[_0x6353('0x47')][_0x6353('0x31')]);}_0x36ab13['order']=qs[_0x6353('0x50')](_0x1ff3eb[_0x6353('0x47')][_0x6353('0x50')]);_0x36ab13['where']=qs[_0x6353('0x48')](_['pick'](_0x1ff3eb['query'],_0x3ec7cc['filters']),_0x3c05ae);if(_0x1ff3eb[_0x6353('0x47')]['filter']){_0x36ab13['where']=_[_0x6353('0x51')](_0x36ab13[_0x6353('0x52')],{'$or':_[_0x6353('0x42')](_0x3c05ae,function(_0x36b815){if(_0x36b815[_0x6353('0x44')]!==_0x6353('0x53')){var _0x2f5eb3={};_0x2f5eb3[_0x36b815[_0x6353('0x3e')]]={'$like':'%'+_0x1ff3eb[_0x6353('0x47')][_0x6353('0x54')]+'%'};return _0x2f5eb3;}})});}_0x36ab13=_[_0x6353('0x51')]({},_0x36ab13,_0x1ff3eb['options']);var _0x2db76d={'where':_0x36ab13[_0x6353('0x52')]};return db[_0x6353('0x55')][_0x6353('0x30')](_0x2db76d)['then'](function(_0x278281){_0x186913[_0x6353('0x30')]=_0x278281;if(_0x1ff3eb[_0x6353('0x47')][_0x6353('0x56')]){_0x36ab13[_0x6353('0x57')]=[{'all':!![]}];}return db[_0x6353('0x55')]['findAll'](_0x36ab13);})[_0x6353('0x22')](function(_0x120ae4){_0x186913[_0x6353('0x58')]=_0x120ae4;return _0x186913;})[_0x6353('0x22')](respondWithFilteredResult(_0x5c10d4,_0x36ab13))[_0x6353('0x2b')](handleError(_0x5c10d4,null));};exports['show']=function(_0x3c6740,_0x10ccfe){var _0x351285={'raw':![],'where':{'id':_0x3c6740[_0x6353('0x59')]['id']},'include':[{'model':db[_0x6353('0x40')],'as':'mandatoryDispositionPause'}]},_0x24e84b={};_0x24e84b[_0x6353('0x4a')]=_[_0x6353('0x46')](db['FaxAccount'][_0x6353('0x43')]);_0x24e84b[_0x6353('0x47')]=_[_0x6353('0x46')](_0x3c6740[_0x6353('0x47')]);_0x24e84b[_0x6353('0x48')]=_[_0x6353('0x49')](_0x24e84b[_0x6353('0x4a')],_0x24e84b[_0x6353('0x47')]);_0x351285['attributes']=_['intersection'](_0x24e84b['model'],qs['fields'](_0x3c6740['query'][_0x6353('0x4b')]));_0x351285[_0x6353('0x4c')]=_0x351285[_0x6353('0x4c')][_0x6353('0x4d')]?_0x351285['attributes']:_0x24e84b[_0x6353('0x4a')];if(_0x3c6740['query'][_0x6353('0x56')]){_0x351285[_0x6353('0x57')]=[{'all':!![]}];}_0x351285=_['merge']({},_0x351285,_0x3c6740[_0x6353('0x5a')]);return db[_0x6353('0x55')][_0x6353('0x5b')](_0x351285)[_0x6353('0x22')](handleEntityNotFound(_0x10ccfe,null))['then'](respondWithResult(_0x10ccfe,null))[_0x6353('0x2b')](handleError(_0x10ccfe,null));};exports[_0x6353('0x5c')]=function(_0xcd4513,_0x3d24ac){return db[_0x6353('0x55')][_0x6353('0x5c')](_0xcd4513['body'],{})[_0x6353('0x22')](function(_0x4a1d52){var _0x3b8b56=_0xcd4513[_0x6353('0x5d')]['get']({'plain':!![]});if(!_0x3b8b56)throw new Error(_0x6353('0x5e'));if(_0x3b8b56[_0x6353('0x5f')]==='user'){var _0x1d1a25=_0x4a1d52[_0x6353('0x39')]({'plain':!![]});var _0x379ba1=_0x6353('0x3a');return db[_0x6353('0x60')]['find']({'where':{'name':_0x379ba1,'userProfileId':_0x3b8b56[_0x6353('0x61')]},'raw':!![]})['then'](function(_0x146adf){if(_0x146adf&&_0x146adf[_0x6353('0x62')]===0x0){return db['UserProfileResource'][_0x6353('0x5c')]({'name':_0x1d1a25[_0x6353('0x3e')],'resourceId':_0x1d1a25['id'],'type':_0x146adf[_0x6353('0x3e')],'sectionId':_0x146adf['id']},{})['then'](function(){return _0x4a1d52;});}else{return _0x4a1d52;}})[_0x6353('0x2b')](function(_0x5b7aba){logger['error'](_0x6353('0x63'),_0x5b7aba);throw _0x5b7aba;});}return _0x4a1d52;})['then'](respondWithResult(_0x3d24ac,0xc9))[_0x6353('0x2b')](handleError(_0x3d24ac,null));};exports[_0x6353('0x37')]=function(_0x286b34,_0x4436ca){if(_0x286b34[_0x6353('0x64')]['id']){delete _0x286b34['body']['id'];}return db[_0x6353('0x55')][_0x6353('0x5b')]({'where':{'id':_0x286b34[_0x6353('0x59')]['id']},'include':[{'model':db[_0x6353('0x40')],'as':_0x6353('0x41')}]})[_0x6353('0x22')](handleEntityNotFound(_0x4436ca,null))[_0x6353('0x22')](saveUpdates(_0x286b34[_0x6353('0x64')],null))['then'](respondWithResult(_0x4436ca,null))['catch'](handleError(_0x4436ca,null));};exports[_0x6353('0x38')]=function(_0x5da08a,_0x43ba6d){return db[_0x6353('0x55')]['find']({'where':{'id':_0x5da08a[_0x6353('0x59')]['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x43ba6d,null))[_0x6353('0x22')](removeEntity(_0x43ba6d,null))[_0x6353('0x2b')](handleError(_0x43ba6d,null));};exports['describe']=function(_0x2c4c00,_0x40deb4){return db[_0x6353('0x55')]['describe']()[_0x6353('0x22')](respondWithResult(_0x40deb4,null))[_0x6353('0x2b')](handleError(_0x40deb4,null));};exports[_0x6353('0x65')]=function(_0x1321d3,_0xe0b084,_0x4693c7){if(_0x1321d3[_0x6353('0x64')]['id']){delete _0x1321d3[_0x6353('0x64')]['id'];}return db[_0x6353('0x55')][_0x6353('0x5b')]({'where':{'id':_0x1321d3[_0x6353('0x59')]['id']}})[_0x6353('0x22')](handleEntityNotFound(_0xe0b084,null))[_0x6353('0x22')](function(_0x554c34){if(_0x554c34){_0x1321d3[_0x6353('0x64')][_0x6353('0x66')]=_0x554c34['id'];return db[_0x6353('0x67')][_0x6353('0x5c')](_0x1321d3[_0x6353('0x64')]);}})['then'](respondWithResult(_0xe0b084,null))[_0x6353('0x2b')](handleError(_0xe0b084,null));};exports[_0x6353('0x68')]=function(_0x16687f,_0x3d8791,_0x4a3e0a){var _0x5f40bc={'raw':![],'where':{}};var _0x41a9c9={};var _0x2b4033={'count':0x0,'rows':[]};return db[_0x6353('0x55')][_0x6353('0x69')]({'where':{'id':_0x16687f[_0x6353('0x59')]['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x3d8791,null))[_0x6353('0x22')](function(_0x2483f5){if(_0x2483f5){_0x41a9c9[_0x6353('0x4a')]=_[_0x6353('0x46')](db[_0x6353('0x67')]['rawAttributes']);_0x41a9c9['query']=_[_0x6353('0x46')](_0x16687f[_0x6353('0x47')]);_0x41a9c9[_0x6353('0x48')]=_[_0x6353('0x49')](_0x41a9c9['model'],_0x41a9c9[_0x6353('0x47')]);_0x5f40bc[_0x6353('0x4c')]=_[_0x6353('0x49')](_0x41a9c9[_0x6353('0x4a')],qs['fields'](_0x16687f[_0x6353('0x47')][_0x6353('0x4b')]));_0x5f40bc['attributes']=_0x5f40bc[_0x6353('0x4c')][_0x6353('0x4d')]?_0x5f40bc[_0x6353('0x4c')]:_0x41a9c9['model'];if(!_0x16687f[_0x6353('0x47')][_0x6353('0x4e')](_0x6353('0x4f'))){_0x5f40bc[_0x6353('0x2f')]=qs['limit'](_0x16687f['query'][_0x6353('0x2f')]);_0x5f40bc[_0x6353('0x31')]=qs[_0x6353('0x31')](_0x16687f[_0x6353('0x47')][_0x6353('0x31')]);}_0x5f40bc[_0x6353('0x6a')]=qs[_0x6353('0x50')](_0x16687f[_0x6353('0x47')][_0x6353('0x50')]);_0x5f40bc[_0x6353('0x52')]=qs[_0x6353('0x48')](_['pick'](_0x16687f[_0x6353('0x47')],_0x41a9c9[_0x6353('0x48')]));_0x5f40bc[_0x6353('0x52')][_0x6353('0x66')]=_0x2483f5['id'];if(_0x16687f['query'][_0x6353('0x54')]){_0x5f40bc[_0x6353('0x52')]=_[_0x6353('0x51')](_0x5f40bc[_0x6353('0x52')],{'$or':_[_0x6353('0x42')](_0x5f40bc[_0x6353('0x4c')],function(_0x232c05){var _0x4cce7d={};_0x4cce7d[_0x232c05]={'$like':'%'+_0x16687f[_0x6353('0x47')][_0x6353('0x54')]+'%'};return _0x4cce7d;})});}_0x5f40bc=_[_0x6353('0x51')]({},_0x5f40bc,_0x16687f[_0x6353('0x5a')]);return db[_0x6353('0x67')][_0x6353('0x30')]({'where':_0x5f40bc[_0x6353('0x52')]})[_0x6353('0x22')](function(_0x200734){_0x2b4033[_0x6353('0x30')]=_0x200734;if(_0x16687f[_0x6353('0x47')][_0x6353('0x56')]){_0x5f40bc[_0x6353('0x57')]=[{'all':!![]}];}return db[_0x6353('0x67')][_0x6353('0x6b')](_0x5f40bc);})[_0x6353('0x22')](function(_0x533ff4){_0x2b4033[_0x6353('0x58')]=_0x533ff4;return _0x2b4033;});}})['then'](respondWithFilteredResult(_0x3d8791,_0x5f40bc))[_0x6353('0x2b')](handleError(_0x3d8791,null));};exports[_0x6353('0x6c')]=function(_0x4ad34e,_0x3445a1,_0x26975d){return db['FaxAccount'][_0x6353('0x5b')]({'where':{'id':_0x4ad34e['params']['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x3445a1,null))['then'](function(_0x36c3cd){if(_0x36c3cd){return _0x36c3cd[_0x6353('0x6c')](_0x4ad34e[_0x6353('0x47')]['ids']);}})[_0x6353('0x22')](respondWithStatusCode(_0x3445a1,null))[_0x6353('0x2b')](handleError(_0x3445a1,null));};exports[_0x6353('0x6d')]=function(_0x436fd1,_0x1e5643,_0x301378){if(_0x436fd1[_0x6353('0x64')]['id']){delete _0x436fd1['body']['id'];}return db['FaxAccount'][_0x6353('0x5b')]({'where':{'id':_0x436fd1[_0x6353('0x59')]['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x1e5643,null))['then'](function(_0x1253d4){if(_0x1253d4){_0x436fd1['body'][_0x6353('0x66')]=_0x1253d4['id'];return db[_0x6353('0x6e')]['create'](_0x436fd1[_0x6353('0x64')]);}})[_0x6353('0x22')](respondWithResult(_0x1e5643,null))[_0x6353('0x2b')](handleError(_0x1e5643,null));};exports[_0x6353('0x6f')]=function(_0xbb7f1e,_0x28845f,_0x5a0cd8){var _0x8c8d6e={'raw':![],'where':{}};var _0x477dbe={};var _0x2b7bb6={'count':0x0,'rows':[]};return db[_0x6353('0x55')][_0x6353('0x69')]({'where':{'id':_0xbb7f1e[_0x6353('0x59')]['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x28845f,null))[_0x6353('0x22')](function(_0x29a602){if(_0x29a602){_0x477dbe[_0x6353('0x4a')]=_[_0x6353('0x46')](db['CannedAnswer'][_0x6353('0x43')]);_0x477dbe['query']=_[_0x6353('0x46')](_0xbb7f1e['query']);_0x477dbe[_0x6353('0x48')]=_[_0x6353('0x49')](_0x477dbe[_0x6353('0x4a')],_0x477dbe['query']);_0x8c8d6e[_0x6353('0x4c')]=_[_0x6353('0x49')](_0x477dbe['model'],qs['fields'](_0xbb7f1e[_0x6353('0x47')][_0x6353('0x4b')]));_0x8c8d6e[_0x6353('0x4c')]=_0x8c8d6e[_0x6353('0x4c')][_0x6353('0x4d')]?_0x8c8d6e['attributes']:_0x477dbe['model'];if(!_0xbb7f1e[_0x6353('0x47')][_0x6353('0x4e')](_0x6353('0x4f'))){_0x8c8d6e[_0x6353('0x2f')]=qs[_0x6353('0x2f')](_0xbb7f1e[_0x6353('0x47')][_0x6353('0x2f')]);_0x8c8d6e[_0x6353('0x31')]=qs['offset'](_0xbb7f1e[_0x6353('0x47')][_0x6353('0x31')]);}_0x8c8d6e[_0x6353('0x6a')]=qs[_0x6353('0x50')](_0xbb7f1e['query'][_0x6353('0x50')]);_0x8c8d6e[_0x6353('0x52')]=qs[_0x6353('0x48')](_[_0x6353('0x70')](_0xbb7f1e[_0x6353('0x47')],_0x477dbe['filters']));_0x8c8d6e[_0x6353('0x52')][_0x6353('0x66')]=_0x29a602['id'];if(_0xbb7f1e[_0x6353('0x47')][_0x6353('0x54')]){_0x8c8d6e[_0x6353('0x52')]=_[_0x6353('0x51')](_0x8c8d6e[_0x6353('0x52')],{'$or':_['map'](_0x8c8d6e['attributes'],function(_0xadbe9c){var _0x457a9e={};_0x457a9e[_0xadbe9c]={'$like':'%'+_0xbb7f1e['query'][_0x6353('0x54')]+'%'};return _0x457a9e;})});}_0x8c8d6e=_[_0x6353('0x51')]({},_0x8c8d6e,_0xbb7f1e['options']);return db['CannedAnswer']['count']({'where':_0x8c8d6e['where']})[_0x6353('0x22')](function(_0xbf043e){_0x2b7bb6['count']=_0xbf043e;if(_0xbb7f1e[_0x6353('0x47')][_0x6353('0x56')]){_0x8c8d6e[_0x6353('0x57')]=[{'all':!![]}];}return db[_0x6353('0x6e')][_0x6353('0x6b')](_0x8c8d6e);})[_0x6353('0x22')](function(_0x12be4a){_0x2b7bb6[_0x6353('0x58')]=_0x12be4a;return _0x2b7bb6;});}})[_0x6353('0x22')](respondWithFilteredResult(_0x28845f,_0x8c8d6e))[_0x6353('0x2b')](handleError(_0x28845f,null));};exports[_0x6353('0x71')]=function(_0x1f6c3c,_0x3c911e,_0x148e40){return db[_0x6353('0x55')][_0x6353('0x5b')]({'where':{'id':_0x1f6c3c['params']['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x3c911e,null))[_0x6353('0x22')](function(_0x3d5bf0){if(_0x3d5bf0){return _0x3d5bf0['removeAnswers'](_0x1f6c3c[_0x6353('0x47')]['ids']);}})[_0x6353('0x22')](respondWithStatusCode(_0x3c911e,null))[_0x6353('0x2b')](handleError(_0x3c911e,null));};exports['addInteraction']=function(_0x487f1e,_0x3b5915,_0x1ea3f3){return db[_0x6353('0x72')][_0x6353('0x5b')]({'where':{'id':_0x487f1e['params']['id']}})['then'](handleEntityNotFound(_0x3b5915,null))['then'](function(_0x5a9bb7){if(_0x5a9bb7){return _0x5a9bb7[_0x6353('0x73')](_0x487f1e[_0x6353('0x64')][_0x6353('0x74')],_[_0x6353('0x75')](_0x487f1e[_0x6353('0x64')],[_0x6353('0x74'),'id'])||{});}})[_0x6353('0x22')](respondWithResult(_0x3b5915,null))['catch'](handleError(_0x3b5915,null));};exports[_0x6353('0x76')]=function(_0x557049,_0x418b50,_0xc0783a){var _0x4368b2={'raw':![],'where':{}};var _0x241f50={};var _0x18a76b={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x557049[_0x6353('0x59')]['id']}})['then'](handleEntityNotFound(_0x418b50,null))[_0x6353('0x22')](function(_0x135b9f){if(_0x135b9f){_0x241f50['model']=_[_0x6353('0x46')](db[_0x6353('0x72')][_0x6353('0x43')]);_0x241f50[_0x6353('0x47')]=_['keys'](_0x557049['query']);_0x241f50[_0x6353('0x48')]=_[_0x6353('0x49')](_0x241f50[_0x6353('0x4a')],_0x241f50['query']);_0x4368b2[_0x6353('0x4c')]=_['intersection'](_0x241f50[_0x6353('0x4a')],qs['fields'](_0x557049['query'][_0x6353('0x4b')]));_0x4368b2[_0x6353('0x4c')]=_0x4368b2[_0x6353('0x4c')][_0x6353('0x4d')]?_0x4368b2[_0x6353('0x4c')]:_0x241f50['model'];if(!_0x557049[_0x6353('0x47')]['hasOwnProperty'](_0x6353('0x4f'))){_0x4368b2[_0x6353('0x2f')]=qs[_0x6353('0x2f')](_0x557049[_0x6353('0x47')]['limit']);_0x4368b2[_0x6353('0x31')]=qs[_0x6353('0x31')](_0x557049[_0x6353('0x47')][_0x6353('0x31')]);}_0x4368b2['order']=qs[_0x6353('0x50')](_0x557049['query'][_0x6353('0x50')]);_0x4368b2['where']=qs['filters'](_[_0x6353('0x70')](_0x557049[_0x6353('0x47')],_0x241f50[_0x6353('0x48')]));_0x4368b2[_0x6353('0x52')]['FaxAccountId']=_0x135b9f['id'];if(_0x557049[_0x6353('0x47')][_0x6353('0x54')]){_0x4368b2[_0x6353('0x52')]=_[_0x6353('0x51')](_0x4368b2[_0x6353('0x52')],{'$or':_['map'](_0x4368b2[_0x6353('0x4c')],function(_0x3b62d8){var _0x4e1965={};_0x4e1965[_0x3b62d8]={'$like':'%'+_0x557049['query'][_0x6353('0x54')]+'%'};return _0x4e1965;})});}_0x4368b2=_[_0x6353('0x51')]({},_0x4368b2,_0x557049[_0x6353('0x5a')]);return db[_0x6353('0x72')][_0x6353('0x30')]({'where':_0x4368b2['where']})[_0x6353('0x22')](function(_0x1aff14){_0x18a76b[_0x6353('0x30')]=_0x1aff14;if(_0x557049[_0x6353('0x47')][_0x6353('0x56')]){_0x4368b2['include']=[{'model':db[_0x6353('0x77')],'as':_0x6353('0x78'),'required':![]},{'model':db[_0x6353('0x79')],'as':'Owner','attributes':['name','fullname',_0x6353('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x6353('0x7b'),'attributes':['id',_0x6353('0x3e'),_0x6353('0x7c')],'where':_0x557049[_0x6353('0x47')][_0x6353('0x7d')]?{'id':_0x557049[_0x6353('0x47')]['tag']}:undefined,'required':_0x557049['query'][_0x6353('0x7d')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x4368b2);})[_0x6353('0x22')](function(_0x25c6e9){_0x18a76b[_0x6353('0x58')]=_0x25c6e9;return _0x18a76b;});}})[_0x6353('0x22')](respondWithFilteredResult(_0x418b50,_0x4368b2))['catch'](handleError(_0x418b50,null));};exports[_0x6353('0x7e')]=function(_0x2fc87f,_0x3f7eb3){var _0x13b8ea=_0x2fc87f[_0x6353('0x59')]['id'];var _0x596800=_0x2fc87f[_0x6353('0x64')];var _0x445418=0xc8;var _0x2c50f9=null;return db[_0x6353('0x7f')][_0x6353('0x80')]({'isolationLevel':db[_0x6353('0x7f')]['Transaction'][_0x6353('0x81')][_0x6353('0x82')]},function(_0x5e4de3){return db[_0x6353('0x55')][_0x6353('0x69')]({'where':{'id':_0x13b8ea},'transaction':_0x5e4de3})['then'](function(_0x1b38ea){if(_0x1b38ea){return db[_0x6353('0x83')][_0x6353('0x38')]({'where':{'FaxAccountId':_0x13b8ea},'transaction':_0x5e4de3})[_0x6353('0x22')](function(){var _0x1cdfb3=_[_0x6353('0x42')](_0x596800,function(_0x5bc988){_0x5bc988[_0x6353('0x66')]=_0x13b8ea;return _0x5bc988;});return db[_0x6353('0x83')][_0x6353('0x84')](_0x1cdfb3,{'transaction':_0x5e4de3});});}else{_0x445418=0x194;_0x2c50f9=[];}});})[_0x6353('0x22')](function(){if(_0x445418!==0x194){return db[_0x6353('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x13b8ea},'order':_0x6353('0x85')})[_0x6353('0x22')](function(_0x2eedf1){_0x2c50f9=_0x2eedf1;});}})[_0x6353('0x2b')](function(_0x46310b){_0x445418=0x1f4;logger[_0x6353('0x26')](_0x46310b[_0x6353('0x3d')]);if(_0x46310b['name']){delete _0x46310b['name'];}_0x2c50f9=_0x46310b;})['finally'](function(){if(_0x2c50f9===null){_0x3f7eb3[_0x6353('0x3c')](_0x445418);}else{if(_0x445418===0x1f4){_0x3f7eb3[_0x6353('0x2c')](_0x445418)[_0x6353('0x3f')](_0x2c50f9);}else{_0x3f7eb3['status'](_0x445418)['json'](_0x2c50f9);}}});};exports[_0x6353('0x86')]=function(_0x2f9d09,_0x4c8e1d,_0x4a1113){var _0x55bfa3={};var _0x46d883={};var _0x5beef9;var _0x48ef79;return db[_0x6353('0x55')][_0x6353('0x69')]({'where':{'id':_0x2f9d09[_0x6353('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c8e1d,null))[_0x6353('0x22')](function(_0x20a219){if(_0x20a219){_0x5beef9=_0x20a219;_0x46d883[_0x6353('0x4a')]=_[_0x6353('0x46')](db[_0x6353('0x83')][_0x6353('0x43')]);_0x46d883[_0x6353('0x47')]=_[_0x6353('0x46')](_0x2f9d09[_0x6353('0x47')]);_0x46d883[_0x6353('0x48')]=_[_0x6353('0x49')](_0x46d883[_0x6353('0x4a')],_0x46d883[_0x6353('0x47')]);_0x55bfa3[_0x6353('0x4c')]=_['intersection'](_0x46d883['model'],qs['fields'](_0x2f9d09[_0x6353('0x47')]['fields']));_0x55bfa3[_0x6353('0x4c')]=_0x55bfa3['attributes']['length']?_0x55bfa3[_0x6353('0x4c')]:_0x46d883[_0x6353('0x4a')];_0x55bfa3[_0x6353('0x6a')]=qs[_0x6353('0x50')](_0x2f9d09[_0x6353('0x47')][_0x6353('0x50')]);_0x55bfa3[_0x6353('0x52')]=qs[_0x6353('0x48')](_[_0x6353('0x70')](_0x2f9d09['query'],_0x46d883[_0x6353('0x48')]));if(_0x2f9d09['query'][_0x6353('0x54')]){_0x55bfa3[_0x6353('0x52')]=_['merge'](_0x55bfa3[_0x6353('0x52')],{'$or':_[_0x6353('0x42')](_0x55bfa3['attributes'],function(_0x3bb869){var _0x4842aa={};_0x4842aa[_0x3bb869]={'$like':'%'+_0x2f9d09[_0x6353('0x47')][_0x6353('0x54')]+'%'};return _0x4842aa;})});}_0x55bfa3=_['merge']({},_0x55bfa3,_0x2f9d09['options']);return _0x5beef9[_0x6353('0x86')](_0x55bfa3);}})['then'](function(_0x16fc31){if(_0x16fc31){_0x48ef79=_0x16fc31[_0x6353('0x4d')];if(!_0x2f9d09[_0x6353('0x47')][_0x6353('0x4e')](_0x6353('0x4f'))){_0x55bfa3[_0x6353('0x2f')]=qs[_0x6353('0x2f')](_0x2f9d09[_0x6353('0x47')]['limit']);_0x55bfa3['offset']=qs[_0x6353('0x31')](_0x2f9d09[_0x6353('0x47')][_0x6353('0x31')]);}return _0x5beef9[_0x6353('0x86')](_0x55bfa3);}})[_0x6353('0x22')](function(_0x20768a){if(_0x20768a){return _0x20768a?{'count':_0x48ef79,'rows':_0x20768a}:null;}})[_0x6353('0x22')](respondWithResult(_0x4c8e1d,null))[_0x6353('0x2b')](handleError(_0x4c8e1d,null));};function Extension(_0x3527fc,_0x4e77d5,_0x1fa7a0,_0x499fea){this[_0x6353('0x87')]='from-voip-provider';this[_0x6353('0x88')]=_0x3527fc[_0x6353('0x89')];this[_0x6353('0x8a')]=_0x499fea;this[_0x6353('0x44')]='system';this[_0x6353('0x8b')]='Fax\x20Extension';this[_0x6353('0x66')]=_0x3527fc['id'];this[_0x6353('0x85')]=_0x4e77d5;this['appdata']=_0x1fa7a0;}function createExtensionsReciveFax(_0x32d54a){var _0xd27107=0x1;var _0x3eabfb=[];_0x3eabfb['push'](new Extension(_0x32d54a,_0xd27107,'',_0x6353('0x8c')));_0xd27107+=0x1;_0x3eabfb['push'](new Extension(_0x32d54a,_0xd27107,'CDR(type)=inbound-fax',_0x6353('0x8d')));_0xd27107+=0x1;for(var _0x38cbb5 in _0x32d54a){if(_0x32d54a[_0x6353('0x4e')](_0x38cbb5)&&(_0x38cbb5===_0x6353('0x8e')||_0x38cbb5==='localstationid'||_0x38cbb5===_0x6353('0x8f')||_0x38cbb5===_0x6353('0x90')||_0x38cbb5===_0x6353('0x91')||_0x38cbb5==='maxrate'||_0x38cbb5===_0x6353('0x92')||_0x38cbb5===_0x6353('0x93')||_0x38cbb5==='t38timeout')){_0x3eabfb[_0x6353('0x94')](new Extension(_0x32d54a,_0xd27107,_0x6353('0x95')+_0x38cbb5+')='+_0x32d54a[_0x38cbb5],'Set'));_0xd27107+=0x1;}}_0x3eabfb[_0x6353('0x94')](new Extension(_0x32d54a,_0xd27107,'6',_0x6353('0x96')));_0xd27107+=0x1;_0x3eabfb[_0x6353('0x94')](new Extension(_0x32d54a,_0xd27107,_0x6353('0x97'),_0x6353('0x98')));_0xd27107=0x0;return _0x3eabfb;}exports['addAccountApplications']=function(_0x32c3eb,_0x2a753d,_0x2bd417){var _0x28a310;return db[_0x6353('0x7f')][_0x6353('0x80')](function(_0x2fc883){return db[_0x6353('0x55')][_0x6353('0x5c')](_0x32c3eb['body'],{'transaction':_0x2fc883})[_0x6353('0x22')](function(_0x2ee366){_0x28a310=_0x2ee366[_0x6353('0x39')]({'plain':!![]});return db[_0x6353('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x28a310),{'transaction':_0x2fc883});});})[_0x6353('0x22')](function(){return _0x28a310;})['then'](respondWithResult(_0x2a753d,null))[_0x6353('0x2b')](handleError(_0x2a753d,null));};exports[_0x6353('0x9a')]=function(_0x3371b3,_0x49fecd,_0x1cd03f){var _0x9211fc;return db[_0x6353('0x7f')][_0x6353('0x80')](function(_0x3665fc){return db[_0x6353('0x55')]['update'](_0x3371b3['body'],{'where':{'id':_0x3371b3[_0x6353('0x64')]['id']},'transaction':_0x3665fc})[_0x6353('0x22')](function(_0x403047){return db[_0x6353('0x99')]['destroy']({'where':{'FaxAccountId':_0x3371b3[_0x6353('0x64')]['id']},'transaction':_0x3665fc})[_0x6353('0x22')](function(_0x19f571){return db[_0x6353('0x99')][_0x6353('0x84')](createExtensionsReciveFax(_['omit'](_0x3371b3['body'],['tech',_0x6353('0x45'),'createdAt','updatedAt',_0x6353('0x9b'),'ListId'])),{'transaction':_0x3665fc});});});})['then'](function(){return db[_0x6353('0x55')][_0x6353('0x9c')](_0x3371b3[_0x6353('0x64')]['id']);})['then'](respondWithResult(_0x49fecd,null))['catch'](handleError(_0x49fecd,null));};exports['getMessages']=function(_0x2cd59d,_0x12b50e,_0x28d288){var _0x45dba2={'raw':!![],'where':{}};var _0x1f8a6b={};var _0x3fa591={'count':0x0,'rows':[]};return db[_0x6353('0x55')]['findOne']({'where':{'id':_0x2cd59d[_0x6353('0x59')]['id']}})['then'](handleEntityNotFound(_0x12b50e,null))['then'](function(_0x159a8d){if(_0x159a8d){_0x1f8a6b[_0x6353('0x4a')]=_['keys'](db[_0x6353('0x9d')][_0x6353('0x43')]);_0x1f8a6b['query']=_[_0x6353('0x46')](_0x2cd59d[_0x6353('0x47')]);_0x1f8a6b['filters']=_['intersection'](_0x1f8a6b['model'],_0x1f8a6b[_0x6353('0x47')]);_0x45dba2[_0x6353('0x4c')]=_['intersection'](_0x1f8a6b['model'],qs[_0x6353('0x4b')](_0x2cd59d['query'][_0x6353('0x4b')]));_0x45dba2['attributes']=_0x45dba2['attributes'][_0x6353('0x4d')]?_0x45dba2[_0x6353('0x4c')]:_0x1f8a6b[_0x6353('0x4a')];if(!_0x2cd59d[_0x6353('0x47')]['hasOwnProperty'](_0x6353('0x4f'))){_0x45dba2['limit']=qs[_0x6353('0x2f')](_0x2cd59d['query'][_0x6353('0x2f')]);_0x45dba2[_0x6353('0x31')]=qs[_0x6353('0x31')](_0x2cd59d['query'][_0x6353('0x31')]);}_0x45dba2[_0x6353('0x6a')]=qs[_0x6353('0x50')](_0x2cd59d[_0x6353('0x47')][_0x6353('0x50')]);_0x45dba2[_0x6353('0x52')]=qs['filters'](_[_0x6353('0x70')](_0x2cd59d['query'],_0x1f8a6b[_0x6353('0x48')]));_0x45dba2['where']['FaxAccountId']=_0x159a8d['id'];if(_0x2cd59d[_0x6353('0x47')][_0x6353('0x54')]){_0x45dba2[_0x6353('0x52')]=_[_0x6353('0x51')](_0x45dba2['where'],{'$or':_[_0x6353('0x42')](_0x45dba2[_0x6353('0x4c')],function(_0x440c1e){var _0x3e50ee={};_0x3e50ee[_0x440c1e]={'$like':'%'+_0x2cd59d[_0x6353('0x47')][_0x6353('0x54')]+'%'};return _0x3e50ee;})});}if(_0x2cd59d['query'][_0x6353('0x9e')]){var _0x27a7bd=_0x2cd59d[_0x6353('0x47')][_0x6353('0x9e')][_0x6353('0x9f')](',');var _0x7bb4f4={};_0x7bb4f4[_0x27a7bd[0x0]]={'$gte':moment(_0x27a7bd[0x1])[_0x6353('0xa0')](_0x6353('0xa1'))};_0x45dba2['where']=_[_0x6353('0x51')](_0x45dba2[_0x6353('0x52')],_0x7bb4f4);}_0x45dba2=_[_0x6353('0x51')]({},_0x45dba2,_0x2cd59d['options']);return db[_0x6353('0x9d')][_0x6353('0x30')]({'where':_0x45dba2[_0x6353('0x52')]})[_0x6353('0x22')](function(_0x3aaa51){_0x3fa591[_0x6353('0x30')]=_0x3aaa51;if(_0x2cd59d[_0x6353('0x47')]['includeAll']){_0x45dba2[_0x6353('0x57')]=[{'all':!![]}];}return db[_0x6353('0x9d')]['findAll'](_0x45dba2);})['then'](function(_0x58259c){_0x3fa591[_0x6353('0x58')]=_0x58259c;return _0x3fa591;});}})['then'](respondWithFilteredResult(_0x12b50e,_0x45dba2))[_0x6353('0x2b')](handleError(_0x12b50e,null));};exports['send']=function(_0x2c4234,_0x23964d,_0x38a5e2){var _0x37f248,_0x3806f9={},_0x5a3771;if(_0x2c4234[_0x6353('0x64')]['to']){_0x5a3771=_0x2c4234['body']['to'][0x0];}return db[_0x6353('0x55')]['find']({'where':{'id':_0x2c4234[_0x6353('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6353('0x77')],'as':_0x6353('0xa2'),'where':{'fax':_0x5a3771},'limit':0x1,'order':[[_0x6353('0xa3'),_0x6353('0xa4')]]}]}]})[_0x6353('0x22')](handleEntityNotFound(_0x23964d,null))[_0x6353('0x22')](function(_0x3ddf87){_0x37f248=_0x3ddf87;if(_0x2c4234['body'][_0x6353('0xa5')]&&_0x2c4234['body'][_0x6353('0xa5')]['length']){for(var _0x598266=0x0;_0x598266<_0x2c4234[_0x6353('0x64')]['attachments'][_0x6353('0x4d')];_0x598266+=0x1){_0x2c4234['body'][_0x6353('0xa5')][_0x598266]={'filename':_0x2c4234[_0x6353('0x64')][_0x6353('0xa5')][_0x598266][_0x6353('0x3e')],'id':_0x2c4234['body'][_0x6353('0xa5')][_0x598266]['id'],'path':path[_0x6353('0xa6')](config['root'],'server/files/attachments',_0x2c4234[_0x6353('0x64')]['attachments'][_0x598266][_0x6353('0xa7')])};}}return respondWithRpcPromise(_0x6353('0xa8'),_0x6353('0xa8'),{'FaxAccountId':_[_0x6353('0xa9')](_0x2c4234['params']['id'])?undefined:_0x2c4234['params']['id'],'path':_[_0x6353('0xa9')](_0x2c4234['body'][_0x6353('0xa5')][0x0][_0x6353('0x6')])?undefined:_0x2c4234[_0x6353('0x64')][_0x6353('0xa5')][0x0][_0x6353('0x6')],'fax':_[_0x6353('0xa9')](_0x2c4234[_0x6353('0x64')]['to'][0x0])?undefined:_0x2c4234[_0x6353('0x64')]['to'][0x0]},client9002);})[_0x6353('0x22')](function(){if(_0x37f248){if(_['isNil'](_0x2c4234[_0x6353('0x64')][_0x6353('0xaa')])){_0x2c4234[_0x6353('0x64')][_0x6353('0xaa')]=util[_0x6353('0xa0')](_0x6353('0xab'),_0x37f248[_0x6353('0x3e')],_0x37f248[_0x6353('0xac')]);}if(_0x37f248[_0x6353('0xad')]){if(_0x37f248['List']['Contacts'][_0x6353('0x4d')]){return _0x37f248[_0x6353('0xad')]['Contacts'][0x0];}else{return db[_0x6353('0x77')][_0x6353('0x5c')](_[_0x6353('0x1a')](_0x2c4234[_0x6353('0x64')],{'firstName':_0x2c4234[_0x6353('0x64')]['to'][0x0],'phone':_0x2c4234[_0x6353('0x64')]['to'][0x0],'fax':_0x2c4234[_0x6353('0x64')]['to'][0x0],'ListId':_0x37f248[_0x6353('0xae')]}));}}else{throw new Error(_0x6353('0xaf'));}}else{throw new Error(_0x6353('0xb0'));}})[_0x6353('0x22')](function(_0x1fbc0d){if(_0x1fbc0d){return db['FaxInteraction'][_0x6353('0x5b')]({'where':{'ContactId':_0x1fbc0d['id'],'closed':![],'FaxAccountId':_0x37f248['id']}})[_0x6353('0x22')](function(_0x5589f5){if(_0x5589f5){return[_0x5589f5,![]];}return db[_0x6353('0x72')]['create']({'UserId':_0x2c4234[_0x6353('0x5d')]['id'],'ContactId':_0x1fbc0d['id'],'FaxAccountId':_0x37f248['id'],'fax':_0x2c4234[_0x6353('0x64')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x6353('0x51')](_0x2c4234[_0x6353('0x64')],{'read':![],'body':_0x2c4234[_0x6353('0x64')]['attachments'][0x0][_0x6353('0xb1')],'FaxAccountId':_0x37f248['id'],'UserId':_0x2c4234[_0x6353('0x5d')]['id'],'ContactId':_0x1fbc0d['id'],'AttachmentId':_0x2c4234['body'][_0x6353('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x6353('0x9d')],'as':_0x6353('0xb2')}]})[_0x6353('0x22')](function(_0x3c6605){return[_0x3c6605,!![]];});});}else{throw new Error(_0x6353('0xb3'));}})[_0x6353('0xb4')](function(_0x58736e,_0x1b1b35){if(_0x1b1b35){return _0x58736e;}return db[_0x6353('0x9d')][_0x6353('0x5c')]({'direction':_0x6353('0xb5'),'read':![],'body':_0x2c4234[_0x6353('0x64')][_0x6353('0xa5')][0x0][_0x6353('0xb1')],'FaxAccountId':_0x37f248['id'],'FaxInteractionId':_0x58736e['id'],'UserId':_0x2c4234[_0x6353('0x5d')]['id'],'ContactId':_0x58736e[_0x6353('0xb6')],'AttachmentId':_0x2c4234[_0x6353('0x64')]['attachments'][0x0]['id']})[_0x6353('0x22')](function(_0x4ea4eb){_0x58736e[_0x6353('0xb7')][_0x6353('0xb2')]=[];_0x58736e['dataValues'][_0x6353('0xb2')][_0x6353('0x94')](_0x4ea4eb[_0x6353('0xb7')]);return _0x58736e;});})['then'](function(_0x97075d){respondWithRpcPromise('SendFax',_0x6353('0xb8'),{'FaxAccountId':_[_0x6353('0xa9')](_0x2c4234[_0x6353('0x59')]['id'])?undefined:_0x2c4234[_0x6353('0x59')]['id'],'path':_[_0x6353('0xa9')](_0x2c4234[_0x6353('0x64')][_0x6353('0xa5')][0x0][_0x6353('0x6')])?undefined:_0x2c4234['body'][_0x6353('0xa5')][0x0]['path'],'fax':_[_0x6353('0xa9')](_0x2c4234[_0x6353('0x64')]['to'][0x0])?undefined:_0x2c4234[_0x6353('0x64')]['to'][0x0],'AttachmentId':_0x2c4234[_0x6353('0x64')][_0x6353('0xa5')][0x0]['id']},client9002)[_0x6353('0x22')](function(_0x477358){logger['info'](_0x6353('0xb9'),_0x477358);})['catch'](function(_0x2e3193){logger['info']('SendFaxRpc,\x20%s',_0x2e3193);});return _0x97075d;})[_0x6353('0x22')](respondWithResult(_0x23964d,null))[_0x6353('0x2b')](handleError(_0x23964d,null));};exports['addAgents']=function(_0x64ba69,_0x27c9cb,_0x4e316b){return db[_0x6353('0x55')][_0x6353('0x5b')]({'where':{'id':_0x64ba69['params']['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x27c9cb,null))['then'](function(_0x4439e0){if(_0x4439e0){return _0x4439e0[_0x6353('0xba')](_0x64ba69['body'][_0x6353('0x74')],_[_0x6353('0x75')](_0x64ba69['body'],[_0x6353('0x74'),'id'])||{})[_0x6353('0xb4')](function(_0x212283){for(var _0x427264=0x0;_0x427264<_0x64ba69[_0x6353('0x64')][_0x6353('0x74')]['length'];_0x427264+=0x1){socket[_0x6353('0xbb')]('userFaxAccount:save',{'UserId':Number(_0x64ba69[_0x6353('0x64')][_0x6353('0x74')][_0x427264]),'FaxAccountId':Number(_0x64ba69[_0x6353('0x59')]['id'])});}return _0x212283;});}})[_0x6353('0x22')](respondWithResult(_0x27c9cb,null))[_0x6353('0x2b')](handleError(_0x27c9cb,null));};exports[_0x6353('0xbc')]=function(_0x52f178,_0x1d4d8f,_0x1f7743){return db[_0x6353('0x55')][_0x6353('0x5b')]({'where':{'id':_0x52f178['params']['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x1d4d8f,null))[_0x6353('0x22')](function(_0x5a2816){if(_0x5a2816){return _0x5a2816['removeAgents'](_0x52f178[_0x6353('0x47')][_0x6353('0x74')])[_0x6353('0x22')](function(){if(_[_0x6353('0xbd')](_0x52f178[_0x6353('0x47')][_0x6353('0x74')])){for(var _0x24ef43=0x0;_0x24ef43<_0x52f178[_0x6353('0x47')][_0x6353('0x74')][_0x6353('0x4d')];_0x24ef43+=0x1){socket['emit'](_0x6353('0xbe'),{'UserId':Number(_0x52f178[_0x6353('0x47')][_0x6353('0x74')][_0x24ef43]),'FaxAccountId':Number(_0x52f178[_0x6353('0x59')]['id'])});}}else{socket[_0x6353('0xbb')](_0x6353('0xbe'),{'UserId':Number(_0x52f178[_0x6353('0x47')][_0x6353('0x74')]),'FaxAccountId':Number(_0x52f178[_0x6353('0x59')]['id'])});}});}})[_0x6353('0x22')](respondWithStatusCode(_0x1d4d8f,null))[_0x6353('0x2b')](handleError(_0x1d4d8f,null));};exports['getAgents']=function(_0xce96b9,_0x303ae0,_0x2a9764){var _0x232349={};var _0xb324f0={};var _0x44dd78;var _0x4b8b17;return db[_0x6353('0x55')]['findOne']({'where':{'id':_0xce96b9['params']['id']}})[_0x6353('0x22')](handleEntityNotFound(_0x303ae0,null))['then'](function(_0x5b425e){if(_0x5b425e){_0x44dd78=_0x5b425e;_0xb324f0[_0x6353('0x4a')]=_[_0x6353('0x46')](db[_0x6353('0x79')][_0x6353('0x43')]);_0xb324f0['query']=_['keys'](_0xce96b9['query']);_0xb324f0[_0x6353('0x48')]=_[_0x6353('0x49')](_0xb324f0[_0x6353('0x4a')],_0xb324f0[_0x6353('0x47')]);_0x232349[_0x6353('0x4c')]=_['intersection'](_0xb324f0[_0x6353('0x4a')],qs[_0x6353('0x4b')](_0xce96b9['query']['fields']));_0x232349[_0x6353('0x4c')]=_0x232349[_0x6353('0x4c')]['length']?_0x232349[_0x6353('0x4c')]:_0xb324f0['model'];_0x232349[_0x6353('0x6a')]=qs[_0x6353('0x50')](_0xce96b9[_0x6353('0x47')]['sort']);_0x232349[_0x6353('0x52')]=qs[_0x6353('0x48')](_[_0x6353('0x70')](_0xce96b9[_0x6353('0x47')],_0xb324f0[_0x6353('0x48')]));if(_0xce96b9[_0x6353('0x47')][_0x6353('0x54')]){_0x232349[_0x6353('0x52')]=_[_0x6353('0x51')](_0x232349[_0x6353('0x52')],{'$or':_[_0x6353('0x42')](_0x232349[_0x6353('0x4c')],function(_0x2f8c7a){var _0x19b91b={};_0x19b91b[_0x2f8c7a]={'$like':'%'+_0xce96b9[_0x6353('0x47')][_0x6353('0x54')]+'%'};return _0x19b91b;})});}_0x232349=_[_0x6353('0x51')]({},_0x232349,_0xce96b9['options']);return _0x44dd78[_0x6353('0xbf')](_0x232349);}})[_0x6353('0x22')](function(_0x1cc8f1){if(_0x1cc8f1){_0x4b8b17=_0x1cc8f1['length'];if(!_0xce96b9['query']['hasOwnProperty']('nolimit')){_0x232349[_0x6353('0x2f')]=qs['limit'](_0xce96b9[_0x6353('0x47')][_0x6353('0x2f')]);_0x232349['offset']=qs[_0x6353('0x31')](_0xce96b9[_0x6353('0x47')]['offset']);}return _0x44dd78[_0x6353('0xbf')](_0x232349);}})[_0x6353('0x22')](function(_0x1bcf36){if(_0x1bcf36){return _0x1bcf36?{'count':_0x4b8b17,'rows':_0x1bcf36}:null;}})[_0x6353('0x22')](respondWithResult(_0x303ae0,null))[_0x6353('0x2b')](handleError(_0x303ae0,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 45f240d..a15806f 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 _0x8555=['exports','events','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x27eb4d,_0x1b486f){var _0x5babe5=function(_0x321fbd){while(--_0x321fbd){_0x27eb4d['push'](_0x27eb4d['shift']());}};_0x5babe5(++_0x1b486f);}(_0x8555,0x13c));var _0x5855=function(_0x35efbd,_0x421380){_0x35efbd=_0x35efbd-0x0;var _0x12579f=_0x8555[_0x35efbd];return _0x12579f;};'use strict';var EventEmitter=require(_0x5855('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5855('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5855('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5855('0x3'),'afterDestroy':_0x5855('0x4')};function emitEvent(_0x578012){return function(_0x5950ae,_0x2ce221,_0x35ea5e){FaxAccountEvents[_0x5855('0x5')](_0x578012+':'+_0x5950ae['id'],_0x5950ae);FaxAccountEvents[_0x5855('0x5')](_0x578012,_0x5950ae);_0x35ea5e(null);};}for(var e in events){if(events[_0x5855('0x6')](e)){var event=events[e];FaxAccount[_0x5855('0x7')](e,emitEvent(event));}}module[_0x5855('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x032e=['update','emit','hasOwnProperty','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x408263,_0x4ec6ec){var _0xa12723=function(_0x589151){while(--_0x589151){_0x408263['push'](_0x408263['shift']());}};_0xa12723(++_0x4ec6ec);}(_0x032e,0x1cc));var _0xe032=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x032e[_0x187ee1];return _0x388160;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xe032('0x0'))['db'][_0xe032('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe032('0x2')](0x0);var events={'afterCreate':_0xe032('0x3'),'afterUpdate':_0xe032('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3aa0cb){return function(_0x3c0e0a,_0x3d33f8,_0x15430e){FaxAccountEvents[_0xe032('0x5')](_0x3aa0cb+':'+_0x3c0e0a['id'],_0x3c0e0a);FaxAccountEvents[_0xe032('0x5')](_0x3aa0cb,_0x3c0e0a);_0x15430e(null);};}for(var e in events){if(events[_0xe032('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xe032('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 43b23ba..691f699 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 _0x4125=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','FaxAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4125,0x1c2));var _0x5412=function(_0x48d430,_0x3e6f1c){_0x48d430=_0x48d430-0x0;var _0x1fdbd8=_0x4125[_0x48d430];return _0x1fdbd8;};'use strict';var _=require(_0x5412('0x0'));var util=require(_0x5412('0x1'));var logger=require(_0x5412('0x2'))('api');var moment=require(_0x5412('0x3'));var BPromise=require(_0x5412('0x4'));var rp=require(_0x5412('0x5'));var fs=require('fs');var path=require(_0x5412('0x6'));var rimraf=require(_0x5412('0x7'));var config=require('../../config/environment');var attributes=require(_0x5412('0x8'));module['exports']=function(_0x42f532,_0xe21785){return _0x42f532['define'](_0x5412('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bab=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x3a9707,_0x3d19c8){var _0x2fb6aa=function(_0x51947b){while(--_0x51947b){_0x3a9707['push'](_0x3a9707['shift']());}};_0x2fb6aa(++_0x3d19c8);}(_0x4bab,0x1a0));var _0xb4ba=function(_0x46fc41,_0x1ed375){_0x46fc41=_0x46fc41-0x0;var _0x42351c=_0x4bab[_0x46fc41];return _0x42351c;};'use strict';var _=require(_0xb4ba('0x0'));var util=require('util');var logger=require(_0xb4ba('0x1'))(_0xb4ba('0x2'));var moment=require(_0xb4ba('0x3'));var BPromise=require('bluebird');var rp=require(_0xb4ba('0x4'));var fs=require('fs');var path=require(_0xb4ba('0x5'));var rimraf=require(_0xb4ba('0x6'));var config=require(_0xb4ba('0x7'));var attributes=require(_0xb4ba('0x8'));module[_0xb4ba('0x9')]=function(_0x3e6aac,_0x3b6606){return _0x3e6aac[_0xb4ba('0xa')](_0xb4ba('0xb'),attributes,{'tableName':_0xb4ba('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 6845f01..5e14130 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 _0xcbc6=['asc','length','ListId','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','create','ContactId','AttachmentId','name','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','raw','options','where','include','map','model','attributes','debug','catch','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','Contacts','Applications','get','applications','list','priority'];(function(_0x55e54c,_0x3697bf){var _0x33ec5f=function(_0xc47d5f){while(--_0xc47d5f){_0x55e54c['push'](_0x55e54c['shift']());}};_0x33ec5f(++_0x3697bf);}(_0xcbc6,0x12f));var _0x6cbc=function(_0x29f6f8,_0x3bd3e4){_0x29f6f8=_0x29f6f8-0x0;var _0x6c4589=_0xcbc6[_0x29f6f8];return _0x6c4589;};'use strict';var _=require(_0x6cbc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6cbc('0x1'));var rs=require(_0x6cbc('0x2'));var fs=require('fs');var Redis=require(_0x6cbc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cbc('0x4'));var logger=require(_0x6cbc('0x5'))(_0x6cbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cbc('0x7'));var client=jayson['client'][_0x6cbc('0x8')]({'port':0x232c});config[_0x6cbc('0x9')]=_['defaults'](config[_0x6cbc('0x9')],{'host':_0x6cbc('0xa'),'port':0x18eb});var socket=require(_0x6cbc('0xb'))(new Redis(config[_0x6cbc('0x9')]));require(_0x6cbc('0xc'))[_0x6cbc('0xd')](socket);function respondWithRpcPromise(_0x195311,_0x221804,_0x13bfe2){return new BPromise(function(_0x2b69eb,_0x1f0c45){return client[_0x6cbc('0xe')](_0x195311,_0x13bfe2)[_0x6cbc('0xf')](function(_0x2fa8b1){logger[_0x6cbc('0x10')](_0x6cbc('0x11'),_0x221804,'request\x20sent');logger['debug'](_0x6cbc('0x12'),_0x221804,_0x6cbc('0x13'),JSON[_0x6cbc('0x14')](_0x2fa8b1));if(_0x2fa8b1[_0x6cbc('0x15')]){if(_0x2fa8b1[_0x6cbc('0x15')][_0x6cbc('0x16')]===0x1f4){logger[_0x6cbc('0x15')](_0x6cbc('0x11'),_0x221804,_0x2fa8b1['error'][_0x6cbc('0x17')]);return _0x1f0c45(_0x2fa8b1['error'][_0x6cbc('0x17')]);}logger[_0x6cbc('0x15')](_0x6cbc('0x11'),_0x221804,_0x2fa8b1['error'][_0x6cbc('0x17')]);return _0x2b69eb(_0x2fa8b1[_0x6cbc('0x15')][_0x6cbc('0x17')]);}else{logger[_0x6cbc('0x10')](_0x6cbc('0x11'),_0x221804,_0x6cbc('0x13'));_0x2b69eb(_0x2fa8b1[_0x6cbc('0x18')]['message']);}})['catch'](function(_0xa9c9fe){logger['error'](_0x6cbc('0x11'),_0x221804,_0xa9c9fe);_0x1f0c45(_0xa9c9fe);});});}exports[_0x6cbc('0x19')]=function(_0x57c596){var _0x5f4186=this;return new Promise(function(_0x697197,_0x40894a){return db[_0x6cbc('0x1a')][_0x6cbc('0x1b')]({'raw':_0x57c596['options']?_0x57c596['options'][_0x6cbc('0x1c')]===undefined?!![]:![]:!![],'where':_0x57c596['options']?_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1e')]||null:null,'attributes':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')]['attributes']||null:null,'limit':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')]['limit']||null:null,'include':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1f')]?_[_0x6cbc('0x20')](_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1f')],function(_0x2dff63){return{'model':db[_0x2dff63[_0x6cbc('0x21')]],'as':_0x2dff63['as'],'attributes':_0x2dff63[_0x6cbc('0x22')],'include':_0x2dff63[_0x6cbc('0x1f')]?_[_0x6cbc('0x20')](_0x2dff63[_0x6cbc('0x1f')],function(_0x488b52){return{'model':db[_0x488b52[_0x6cbc('0x21')]],'as':_0x488b52['as'],'attributes':_0x488b52[_0x6cbc('0x22')],'include':_0x488b52['include']?_[_0x6cbc('0x20')](_0x488b52[_0x6cbc('0x1f')],function(_0x7d7a41){return{'model':db[_0x7d7a41[_0x6cbc('0x21')]],'as':_0x7d7a41['as'],'attributes':_0x7d7a41[_0x6cbc('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d6063){logger[_0x6cbc('0x10')]('GetFaxAccount',_0x57c596);logger[_0x6cbc('0x23')](_0x6cbc('0x19'),_0x57c596,JSON[_0x6cbc('0x14')](_0x3d6063));_0x697197(_0x3d6063);})[_0x6cbc('0x24')](function(_0x1fb561){logger[_0x6cbc('0x15')]('GetFaxAccount',_0x1fb561['message'],_0x57c596);_0x40894a(_0x5f4186[_0x6cbc('0x15')](0x1f4,_0x1fb561[_0x6cbc('0x17')]));});});};exports[_0x6cbc('0x25')]=function(_0x55fd1a,_0x35e223,_0x4ff68e){var _0x615d88=this;return new Promise(function(_0x47d638,_0x523c07){var _0x4e985a={'body':_0x55fd1a[_0x6cbc('0x26')],'channel':_0x6cbc('0x27')};var _0x2301fa=[];var _0x49fa1a=[];var _0x3edcae={};return db[_0x6cbc('0x28')][_0x6cbc('0x29')]()['then'](function(_0x30c71d){if(!_0x30c71d){throw new db['Sequelize'][(_0x6cbc('0x2a'))](_0x6cbc('0x2b'));}_0x2301fa=_['difference'](_[_0x6cbc('0x2c')](_0x30c71d),[_0x6cbc('0x2d'),'updatedAt']);_0x49fa1a=_[_0x6cbc('0x2e')](_[_0x6cbc('0x2c')](_0x30c71d),[_0x6cbc('0x2d'),_0x6cbc('0x2f'),'CompanyId','ListId']);if(_0x55fd1a['body']['id']){delete _0x55fd1a[_0x6cbc('0x26')]['id'];}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')])){throw new db[(_0x6cbc('0x32'))]['ValidationError'](_0x6cbc('0x33'));}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x26')])||_0x55fd1a['body']['body']===''){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x34')])){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))](_0x6cbc('0x35')+_0x49fa1a);}if(!_[_0x6cbc('0x36')](_0x49fa1a,_0x55fd1a['body'][_0x6cbc('0x34')])){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49fa1a);}_0x3edcae[_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x34')]]=_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')];})[_0x6cbc('0xf')](function(){return db[_0x6cbc('0x1a')][_0x6cbc('0x37')]({'where':{'id':_0x55fd1a[_0x6cbc('0x38')]['id']},'include':[{'model':db[_0x6cbc('0x39')],'as':_0x6cbc('0x3a'),'include':[{'model':db[_0x6cbc('0x28')],'as':_0x6cbc('0x3b'),'where':_0x3edcae,'limit':0x1,'order':[[_0x6cbc('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x6cbc('0x3c')}]});})[_0x6cbc('0xf')](function(_0x49f4a8){if(_0x49f4a8&&_0x49f4a8[_0x6cbc('0x3a')]){var _0x38eac1=_0x49f4a8[_0x6cbc('0x3d')]({'plain':!![]});_0x4e985a['account']=_0x38eac1;_0x4e985a[_0x6cbc('0x3e')]=_0x38eac1[_0x6cbc('0x3c')];_0x4e985a[_0x6cbc('0x3f')]=_0x38eac1[_0x6cbc('0x3a')];_0x4e985a['applications']=_['orderBy'](_0x4e985a[_0x6cbc('0x3e')],[_0x6cbc('0x40')],[_0x6cbc('0x41')]);if(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3c')]){delete _0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3c')];}if(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')]&&_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')][_0x6cbc('0x3b')][_0x6cbc('0x42')]){return _0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')]['Contacts'][0x0];}var _0x49c097=_['defaults'](_0x55fd1a[_0x6cbc('0x26')],{'firstName':_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')],'ListId':_0x38eac1[_0x6cbc('0x43')]});_0x49c097[_0x55fd1a['body'][_0x6cbc('0x34')]]=_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')];return db['CmContact']['create'](_0x49c097,{'fields':_0x2301fa,'raw':!![]});}})[_0x6cbc('0xf')](function(_0x249f81){_0x4e985a[_0x6cbc('0x44')]=_0x249f81;if(_0x249f81){var _0x2eb263={'ContactId':_0x249f81['id'],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id'],'fax':_0x249f81[_0x6cbc('0x27')]};return db[_0x6cbc('0x45')][_0x6cbc('0x37')]({'where':{'ContactId':_0x249f81['id'],'closed':![],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id']}})['then'](function(_0x1b0abd){if(_0x1b0abd){return[_0x1b0abd,![]];}return db['FaxInteraction']['create'](_0x2eb263)[_0x6cbc('0xf')](function(_0x7a9e){return[_0x7a9e,!![]];});});}else{throw new Error(_0x6cbc('0x46'));}})[_0x6cbc('0x47')](function(_0x2b1cae,_0x4ac795){var _0x23d6b1=_0x2b1cae[_0x6cbc('0x3d')]({'plain':!![]});if(_0x4ac795){if(_0x4e985a['account'][_0x6cbc('0x48')]){_0x4e985a[_0x6cbc('0x3e')][_0x6cbc('0x49')]({'id':0x0,'priority':_0x4e985a[_0x6cbc('0x3e')][_0x6cbc('0x42')]+0x1,'app':_0x6cbc('0x4a'),'appdata':_0x6cbc('0x4b'),'interval':'*,*,*,*'});}_0x23d6b1[_0x6cbc('0x4c')]=!![];}else{_0x23d6b1[_0x6cbc('0x4c')]=![];}_0x4e985a[_0x6cbc('0x4d')]=_0x23d6b1;return db[_0x6cbc('0x4e')][_0x6cbc('0x4f')]({'body':_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x26')],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id'],'FaxInteractionId':_0x2b1cae['id'],'direction':'in','ContactId':_0x2b1cae[_0x6cbc('0x50')],'AttachmentId':_0x55fd1a['body'][_0x6cbc('0x51')]});})[_0x6cbc('0xf')](function(_0x266ab0){_0x4e985a['message']=_0x266ab0;if(!_0x4e985a[_0x6cbc('0x4d')]['UserId'])return;return db['User']['find']({'attributes':['id',_0x6cbc('0x52')],'where':{'id':_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x53')]}});})['then'](function(_0x185958){if(_0x185958){_0x4e985a[_0x6cbc('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6cbc('0x54'),'appdata':_0x185958['name']+','+(_0x4e985a['account'][_0x6cbc('0x55')]||0xa),'interval':_0x6cbc('0x56')});}if(!_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x57')])return;return db['FaxQueue'][_0x6cbc('0x37')]({'attributes':['id',_0x6cbc('0x52')],'where':{'id':_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x57')]}});})[_0x6cbc('0xf')](function(_0xe39039){if(_0xe39039){_0x4e985a['applications'][_0x6cbc('0x58')]({'id':0x0,'priority':0x1,'app':_0x6cbc('0x59'),'appdata':_0xe39039[_0x6cbc('0x52')]+','+(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x5a')]||0x12c),'interval':_0x6cbc('0x56')});}return respondWithRpcPromise('Start',_0x6cbc('0x5b'),_0x4e985a);})[_0x6cbc('0xf')](function(_0x19404d){_0x47d638(_0x19404d);})[_0x6cbc('0x24')](function(_0x19a5a5){_0x523c07(_0x615d88[_0x6cbc('0x15')](0x1f4,_0x19a5a5[_0x6cbc('0x17')]));});});}; \ No newline at end of file +var _0x5a85=['code','message','result','GetFaxAccount','FaxAccount','options','where','limit','include','map','model','attributes','catch','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','find','CmList','Contacts','updatedAt','DESC','FaxApplication','get','Applications','list','List','applications','orderBy','priority','asc','account','length','defaults','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','unmanaged','*,*,*,*','created','interaction','FaxMessage','User','UserId','agent','waitForTheAssignedAgent','queueId','name','unshift','queue','waitForTheAssignedQueue','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x557ca6,_0x544840){var _0x31048e=function(_0x3a846f){while(--_0x3a846f){_0x557ca6['push'](_0x557ca6['shift']());}};_0x31048e(++_0x544840);}(_0x5a85,0xfc));var _0x55a8=function(_0x1db588,_0x3aac39){_0x1db588=_0x1db588-0x0;var _0x33e6a1=_0x5a85[_0x1db588];return _0x33e6a1;};'use strict';var _=require(_0x55a8('0x0'));var util=require(_0x55a8('0x1'));var moment=require(_0x55a8('0x2'));var BPromise=require(_0x55a8('0x3'));var rs=require(_0x55a8('0x4'));var fs=require('fs');var Redis=require(_0x55a8('0x5'));var db=require(_0x55a8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x55a8('0x7'));var config=require(_0x55a8('0x8'));var jayson=require(_0x55a8('0x9'));var client=jayson['client'][_0x55a8('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x55a8('0xb')],{'host':_0x55a8('0xc'),'port':0x18eb});var socket=require(_0x55a8('0xd'))(new Redis(config[_0x55a8('0xb')]));require(_0x55a8('0xe'))['register'](socket);function respondWithRpcPromise(_0x5e127b,_0x2e910a,_0x2f6680){return new BPromise(function(_0x27193c,_0x4cd40e){return client[_0x55a8('0xf')](_0x5e127b,_0x2f6680)[_0x55a8('0x10')](function(_0x2efbd5){logger[_0x55a8('0x11')](_0x55a8('0x12'),_0x2e910a,_0x55a8('0x13'));logger[_0x55a8('0x14')](_0x55a8('0x15'),_0x2e910a,_0x55a8('0x13'),JSON[_0x55a8('0x16')](_0x2efbd5));if(_0x2efbd5['error']){if(_0x2efbd5[_0x55a8('0x17')][_0x55a8('0x18')]===0x1f4){logger[_0x55a8('0x17')](_0x55a8('0x12'),_0x2e910a,_0x2efbd5[_0x55a8('0x17')][_0x55a8('0x19')]);return _0x4cd40e(_0x2efbd5[_0x55a8('0x17')][_0x55a8('0x19')]);}logger[_0x55a8('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2e910a,_0x2efbd5[_0x55a8('0x17')][_0x55a8('0x19')]);return _0x27193c(_0x2efbd5[_0x55a8('0x17')][_0x55a8('0x19')]);}else{logger[_0x55a8('0x11')](_0x55a8('0x12'),_0x2e910a,_0x55a8('0x13'));_0x27193c(_0x2efbd5[_0x55a8('0x1a')]['message']);}})['catch'](function(_0x6deb1e){logger[_0x55a8('0x17')](_0x55a8('0x12'),_0x2e910a,_0x6deb1e);_0x4cd40e(_0x6deb1e);});});}exports[_0x55a8('0x1b')]=function(_0x55706c){var _0x2707bb=this;return new Promise(function(_0x41dd31,_0xd234c1){return db[_0x55a8('0x1c')]['findAll']({'raw':_0x55706c[_0x55a8('0x1d')]?_0x55706c[_0x55a8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x55706c['options']?_0x55706c['options'][_0x55a8('0x1e')]||null:null,'attributes':_0x55706c['options']?_0x55706c['options']['attributes']||null:null,'limit':_0x55706c[_0x55a8('0x1d')]?_0x55706c[_0x55a8('0x1d')][_0x55a8('0x1f')]||null:null,'include':_0x55706c[_0x55a8('0x1d')]?_0x55706c[_0x55a8('0x1d')][_0x55a8('0x20')]?_[_0x55a8('0x21')](_0x55706c[_0x55a8('0x1d')][_0x55a8('0x20')],function(_0x1f2d79){return{'model':db[_0x1f2d79[_0x55a8('0x22')]],'as':_0x1f2d79['as'],'attributes':_0x1f2d79['attributes'],'include':_0x1f2d79[_0x55a8('0x20')]?_[_0x55a8('0x21')](_0x1f2d79['include'],function(_0x412914){return{'model':db[_0x412914[_0x55a8('0x22')]],'as':_0x412914['as'],'attributes':_0x412914['attributes'],'include':_0x412914[_0x55a8('0x20')]?_[_0x55a8('0x21')](_0x412914[_0x55a8('0x20')],function(_0x4f6c14){return{'model':db[_0x4f6c14[_0x55a8('0x22')]],'as':_0x4f6c14['as'],'attributes':_0x4f6c14[_0x55a8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x55a8('0x10')](function(_0x2f4731){logger['info'](_0x55a8('0x1b'),_0x55706c);logger[_0x55a8('0x14')](_0x55a8('0x1b'),_0x55706c,JSON[_0x55a8('0x16')](_0x2f4731));_0x41dd31(_0x2f4731);})[_0x55a8('0x24')](function(_0x3bfaa5){logger[_0x55a8('0x17')]('GetFaxAccount',_0x3bfaa5['message'],_0x55706c);_0xd234c1(_0x2707bb[_0x55a8('0x17')](0x1f4,_0x3bfaa5[_0x55a8('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x4e6409,_0x1a0769,_0x3f82da){var _0xbb6273=this;return new Promise(function(_0x2f49ee,_0x25dd0a){var _0x3a1db9={'body':_0x4e6409[_0x55a8('0x25')],'channel':_0x55a8('0x26')};var _0x314f18=[];var _0x3ce4a1=[];var _0x3d1dac={};return db[_0x55a8('0x27')][_0x55a8('0x28')]()[_0x55a8('0x10')](function(_0x278762){if(!_0x278762){throw new db[(_0x55a8('0x29'))]['ValidationError'](_0x55a8('0x2a'));}_0x314f18=_[_0x55a8('0x2b')](_['keys'](_0x278762),['createdAt','updatedAt']);_0x3ce4a1=_[_0x55a8('0x2b')](_[_0x55a8('0x2c')](_0x278762),[_0x55a8('0x2d'),'updatedAt',_0x55a8('0x2e'),'ListId']);if(_0x4e6409[_0x55a8('0x25')]['id']){delete _0x4e6409['body']['id'];}if(_[_0x55a8('0x2f')](_0x4e6409[_0x55a8('0x25')]['from'])){throw new db[(_0x55a8('0x29'))][(_0x55a8('0x30'))](_0x55a8('0x31'));}if(_[_0x55a8('0x2f')](_0x4e6409[_0x55a8('0x25')][_0x55a8('0x25')])||_0x4e6409[_0x55a8('0x25')][_0x55a8('0x25')]===''){throw new db[(_0x55a8('0x29'))][(_0x55a8('0x30'))](_0x55a8('0x32'));}if(_[_0x55a8('0x2f')](_0x4e6409[_0x55a8('0x25')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x55a8('0x33')+_0x3ce4a1);}if(!_['includes'](_0x3ce4a1,_0x4e6409[_0x55a8('0x25')]['mapKey'])){throw new db[(_0x55a8('0x29'))][(_0x55a8('0x30'))](_0x55a8('0x34')+_0x3ce4a1);}_0x3d1dac[_0x4e6409[_0x55a8('0x25')][_0x55a8('0x35')]]=_0x4e6409[_0x55a8('0x25')][_0x55a8('0x36')];})['then'](function(){return db[_0x55a8('0x1c')][_0x55a8('0x37')]({'where':{'id':_0x4e6409['account']['id']},'include':[{'model':db[_0x55a8('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0x55a8('0x39'),'where':_0x3d1dac,'limit':0x1,'order':[[_0x55a8('0x3a'),_0x55a8('0x3b')]]}]},{'model':db[_0x55a8('0x3c')],'as':'Applications'}]});})['then'](function(_0x531a60){if(_0x531a60&&_0x531a60['List']){var _0x58fe3d=_0x531a60[_0x55a8('0x3d')]({'plain':!![]});_0x3a1db9['account']=_0x58fe3d;_0x3a1db9['applications']=_0x58fe3d[_0x55a8('0x3e')];_0x3a1db9[_0x55a8('0x3f')]=_0x58fe3d[_0x55a8('0x40')];_0x3a1db9[_0x55a8('0x41')]=_[_0x55a8('0x42')](_0x3a1db9[_0x55a8('0x41')],[_0x55a8('0x43')],[_0x55a8('0x44')]);if(_0x3a1db9[_0x55a8('0x45')][_0x55a8('0x3e')]){delete _0x3a1db9[_0x55a8('0x45')][_0x55a8('0x3e')];}if(_0x3a1db9[_0x55a8('0x45')]['List']&&_0x3a1db9[_0x55a8('0x45')][_0x55a8('0x40')][_0x55a8('0x39')][_0x55a8('0x46')]){return _0x3a1db9[_0x55a8('0x45')]['List']['Contacts'][0x0];}var _0x42ace4=_[_0x55a8('0x47')](_0x4e6409[_0x55a8('0x25')],{'firstName':_0x4e6409[_0x55a8('0x25')][_0x55a8('0x36')],'ListId':_0x58fe3d[_0x55a8('0x48')]});_0x42ace4[_0x4e6409['body']['mapKey']]=_0x4e6409[_0x55a8('0x25')][_0x55a8('0x36')];return db[_0x55a8('0x27')][_0x55a8('0x49')](_0x42ace4,{'fields':_0x314f18,'raw':!![]});}})[_0x55a8('0x10')](function(_0x64b06a){_0x3a1db9[_0x55a8('0x4a')]=_0x64b06a;if(_0x64b06a){var _0x190674={'ContactId':_0x64b06a['id'],'FaxAccountId':_0x4e6409[_0x55a8('0x45')]['id'],'fax':_0x64b06a[_0x55a8('0x26')]};return db['FaxInteraction'][_0x55a8('0x37')]({'where':{'ContactId':_0x64b06a['id'],'closed':![],'FaxAccountId':_0x4e6409[_0x55a8('0x45')]['id']}})['then'](function(_0x514a1f){if(_0x514a1f){return[_0x514a1f,![]];}return db[_0x55a8('0x4b')]['create'](_0x190674)[_0x55a8('0x10')](function(_0x50c5cb){return[_0x50c5cb,!![]];});});}else{throw new Error(_0x55a8('0x4c'));}})['spread'](function(_0x1978a6,_0x269335){var _0x19045e=_0x1978a6[_0x55a8('0x3d')]({'plain':!![]});if(_0x269335){if(_0x3a1db9[_0x55a8('0x45')]['autoclose']){_0x3a1db9[_0x55a8('0x41')]['push']({'id':0x0,'priority':_0x3a1db9[_0x55a8('0x41')]['length']+0x1,'app':'close','appdata':_0x55a8('0x4d'),'interval':_0x55a8('0x4e')});}_0x19045e[_0x55a8('0x4f')]=!![];}else{_0x19045e[_0x55a8('0x4f')]=![];}_0x3a1db9[_0x55a8('0x50')]=_0x19045e;return db[_0x55a8('0x51')][_0x55a8('0x49')]({'body':_0x4e6409[_0x55a8('0x25')]['body'],'FaxAccountId':_0x4e6409[_0x55a8('0x45')]['id'],'FaxInteractionId':_0x1978a6['id'],'direction':'in','ContactId':_0x1978a6['ContactId'],'AttachmentId':_0x4e6409['body']['AttachmentId']});})['then'](function(_0x3ba7da){_0x3a1db9[_0x55a8('0x19')]=_0x3ba7da;if(!_0x3a1db9[_0x55a8('0x50')]['UserId'])return;return db[_0x55a8('0x52')]['find']({'attributes':['id','name'],'where':{'id':_0x3a1db9[_0x55a8('0x50')][_0x55a8('0x53')]}});})['then'](function(_0x458059){if(_0x458059){_0x3a1db9['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x55a8('0x54'),'appdata':_0x458059['name']+','+(_0x3a1db9['account'][_0x55a8('0x55')]||0xa),'interval':_0x55a8('0x4e')});}if(!_0x3a1db9['interaction'][_0x55a8('0x56')])return;return db['FaxQueue'][_0x55a8('0x37')]({'attributes':['id',_0x55a8('0x57')],'where':{'id':_0x3a1db9[_0x55a8('0x50')][_0x55a8('0x56')]}});})[_0x55a8('0x10')](function(_0x153b61){if(_0x153b61){_0x3a1db9['applications'][_0x55a8('0x58')]({'id':0x0,'priority':0x1,'app':_0x55a8('0x59'),'appdata':_0x153b61[_0x55a8('0x57')]+','+(_0x3a1db9['account'][_0x55a8('0x5a')]||0x12c),'interval':_0x55a8('0x4e')});}return respondWithRpcPromise(_0x55a8('0x5b'),'startRouting',_0x3a1db9);})[_0x55a8('0x10')](function(_0x519cee){_0x2f49ee(_0x519cee);})['catch'](function(_0x51bbc9){_0x25dd0a(_0xbb6273[_0x55a8('0x17')](0x1f4,_0x51bbc9[_0x55a8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cb7319a..ed52e34 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 _0xc67a=['register','length','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0xc67a,0x1ed));var _0xac67=function(_0x220c6d,_0xbda2d1){_0x220c6d=_0x220c6d-0x0;var _0x173b5e=_0xc67a[_0x220c6d];return _0x173b5e;};'use strict';var FaxAccountEvents=require(_0xac67('0x0'));var events=['save',_0xac67('0x1'),_0xac67('0x2')];function createListener(_0x6833b3,_0x59adb4){return function(_0x3acfb1){_0x59adb4[_0xac67('0x3')](_0x6833b3,_0x3acfb1);};}function removeListener(_0x5531cb,_0x18e732){return function(){FaxAccountEvents['removeListener'](_0x5531cb,_0x18e732);};}exports[_0xac67('0x4')]=function(_0x2e8b54){for(var _0x1b414f=0x0,_0x193eb5=events[_0xac67('0x5')];_0x1b414f<_0x193eb5;_0x1b414f++){var _0x2e5157=events[_0x1b414f];var _0x10b765=createListener(_0xac67('0x6')+_0x2e5157,_0x2e8b54);FaxAccountEvents['on'](_0x2e5157,_0x10b765);}}; \ No newline at end of file +var _0xbc7d=['removeListener','register','length','faxAccount:','update','emit'];(function(_0x383523,_0x262138){var _0x29c502=function(_0x3e64cd){while(--_0x3e64cd){_0x383523['push'](_0x383523['shift']());}};_0x29c502(++_0x262138);}(_0xbc7d,0x1ea));var _0xdbc7=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xbc7d[_0x37e845];return _0x59e55b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0xdbc7('0x0')];function createListener(_0x45f5c3,_0x464a3c){return function(_0x542788){_0x464a3c[_0xdbc7('0x1')](_0x45f5c3,_0x542788);};}function removeListener(_0x2174fc,_0x1f130e){return function(){FaxAccountEvents[_0xdbc7('0x2')](_0x2174fc,_0x1f130e);};}exports[_0xdbc7('0x3')]=function(_0x2af8f9){for(var _0x35b96e=0x0,_0x22cc5d=events[_0xdbc7('0x4')];_0x35b96e<_0x22cc5d;_0x35b96e++){var _0x248eb6=events[_0x35b96e];var _0x145e19=createListener(_0xdbc7('0x5')+_0x248eb6,_0x2af8f9);FaxAccountEvents['on'](_0x248eb6,_0x145e19);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 5933fb4..b4135a3 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 _0x52cb=['express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addAccountApplications','updateAccountApplications','send','addAgents','put','destroy','delete','removeDispositions','removeAgents','exports','path','connect-timeout'];(function(_0x666eb9,_0x5a9e90){var _0x3fc80b=function(_0x4ec6ff){while(--_0x4ec6ff){_0x666eb9['push'](_0x666eb9['shift']());}};_0x3fc80b(++_0x5a9e90);}(_0x52cb,0x1d2));var _0xb52c=function(_0x23bd05,_0x409ba8){_0x23bd05=_0x23bd05-0x0;var _0x2ea842=_0x52cb[_0x23bd05];return _0x2ea842;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb52c('0x0'));var timeout=require(_0xb52c('0x1'));var express=require(_0xb52c('0x2'));var router=express[_0xb52c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb52c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb52c('0x5'));var controller=require(_0xb52c('0x6'));router[_0xb52c('0x7')]('/',auth[_0xb52c('0x8')](),controller[_0xb52c('0x9')]);router[_0xb52c('0x7')](_0xb52c('0xa'),auth[_0xb52c('0x8')](),controller[_0xb52c('0xb')]);router[_0xb52c('0x7')](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller[_0xb52c('0xd')]);router[_0xb52c('0x7')](_0xb52c('0xe'),auth['isAuthenticated'](),controller[_0xb52c('0xf')]);router[_0xb52c('0x7')](_0xb52c('0x10'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x11')]);router['get'](_0xb52c('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb52c('0x7')](_0xb52c('0x13'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x14')]);router[_0xb52c('0x7')](_0xb52c('0x15'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x16')]);router[_0xb52c('0x7')](_0xb52c('0x17'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x18')]);router[_0xb52c('0x19')]('/',auth['isAuthenticated'](),controller[_0xb52c('0x1a')]);router[_0xb52c('0x19')](_0xb52c('0xe'),auth['isAuthenticated'](),controller[_0xb52c('0x1b')]);router[_0xb52c('0x19')]('/:id/canned_answers',auth[_0xb52c('0x8')](),controller['addAnswer']);router['post'](_0xb52c('0x12'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x1c')]);router[_0xb52c('0x19')](_0xb52c('0x13'),auth[_0xb52c('0x8')](),controller['addApplications']);router[_0xb52c('0x19')]('/addaccountapplications',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1d')]);router[_0xb52c('0x19')]('/updateaccountapplications',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1e')]);router[_0xb52c('0x19')]('/:id/send',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1f')]);router[_0xb52c('0x19')]('/:id/users',auth[_0xb52c('0x8')](),controller[_0xb52c('0x20')]);router[_0xb52c('0x21')](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller['update']);router['delete'](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x22')]);router[_0xb52c('0x23')]('/:id/dispositions',auth[_0xb52c('0x8')](),controller[_0xb52c('0x24')]);router['delete'](_0xb52c('0x10'),auth[_0xb52c('0x8')](),controller['removeAnswers']);router['delete'](_0xb52c('0x17'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x25')]);module[_0xb52c('0x26')]=router; \ No newline at end of file +var _0xe396=['removeDispositions','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','update','destroy'];(function(_0x2e2717,_0x583b45){var _0x2b6c7e=function(_0x3fb7d5){while(--_0x3fb7d5){_0x2e2717['push'](_0x2e2717['shift']());}};_0x2b6c7e(++_0x583b45);}(_0xe396,0xa3));var _0x6e39=function(_0x5de550,_0x23d8c9){_0x5de550=_0x5de550-0x0;var _0x8ba2cc=_0xe396[_0x5de550];return _0x8ba2cc;};'use strict';var multer=require(_0x6e39('0x0'));var util=require(_0x6e39('0x1'));var path=require(_0x6e39('0x2'));var timeout=require(_0x6e39('0x3'));var express=require(_0x6e39('0x4'));var router=express[_0x6e39('0x5')]();var fs_extra=require(_0x6e39('0x6'));var auth=require(_0x6e39('0x7'));var interaction=require(_0x6e39('0x8'));var config=require('../../config/environment');var controller=require(_0x6e39('0x9'));router[_0x6e39('0xa')]('/',auth[_0x6e39('0xb')](),controller[_0x6e39('0xc')]);router[_0x6e39('0xa')](_0x6e39('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x6e39('0xa')](_0x6e39('0xe'),auth[_0x6e39('0xb')](),controller[_0x6e39('0xf')]);router[_0x6e39('0xa')](_0x6e39('0x10'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x11')]);router[_0x6e39('0xa')](_0x6e39('0x12'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x13')]);router[_0x6e39('0xa')](_0x6e39('0x14'),auth['isAuthenticated'](),controller[_0x6e39('0x15')]);router[_0x6e39('0xa')](_0x6e39('0x16'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x17')]);router[_0x6e39('0xa')](_0x6e39('0x18'),auth['isAuthenticated'](),controller['getMessages']);router[_0x6e39('0xa')](_0x6e39('0x19'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x1a')]);router[_0x6e39('0x1b')]('/',auth[_0x6e39('0xb')](),controller['create']);router[_0x6e39('0x1b')](_0x6e39('0x10'),auth[_0x6e39('0xb')](),controller['addDisposition']);router[_0x6e39('0x1b')]('/:id/canned_answers',auth[_0x6e39('0xb')](),controller['addAnswer']);router[_0x6e39('0x1b')](_0x6e39('0x14'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x1c')]);router['post'](_0x6e39('0x16'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x1d')]);router['post'](_0x6e39('0x1e'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x1f')]);router[_0x6e39('0x1b')](_0x6e39('0x20'),auth[_0x6e39('0xb')](),controller['updateAccountApplications']);router[_0x6e39('0x1b')](_0x6e39('0x21'),auth[_0x6e39('0xb')](),controller['send']);router[_0x6e39('0x1b')](_0x6e39('0x19'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x22')]);router['put'](_0x6e39('0xe'),auth[_0x6e39('0xb')](),controller[_0x6e39('0x23')]);router['delete']('/:id',auth[_0x6e39('0xb')](),controller[_0x6e39('0x24')]);router['delete']('/:id/dispositions',auth[_0x6e39('0xb')](),controller[_0x6e39('0x25')]);router[_0x6e39('0x26')]('/:id/canned_answers',auth[_0x6e39('0xb')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6e39('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7345654..7b42763 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 _0xb253=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x54f859,_0x59d463){var _0x17a08b=function(_0x3f8e49){while(--_0x3f8e49){_0x54f859['push'](_0x54f859['shift']());}};_0x17a08b(++_0x59d463);}(_0xb253,0x191));var _0x3b25=function(_0x507527,_0x3d1f6e){_0x507527=_0x507527-0x0;var _0x2dec80=_0xb253[_0x507527];return _0x2dec80;};'use strict';var Sequelize=require(_0x3b25('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3b25('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3b25('0x2')],'allowNull':![],'defaultValue':_0x3b25('0x3')},'appdata':{'type':Sequelize[_0x3b25('0x4')]()},'description':{'type':Sequelize[_0x3b25('0x2')]},'interval':{'type':Sequelize[_0x3b25('0x2')],'defaultValue':_0x3b25('0x5')}}; \ No newline at end of file +var _0xb5f8=['*,*,*,*','INTEGER','noop','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb5f8,0xa5));var _0x8b5f=function(_0x2d96c9,_0x2ec931){_0x2d96c9=_0x2d96c9-0x0;var _0x49626f=_0xb5f8[_0x2d96c9];return _0x49626f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8b5f('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8b5f('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8b5f('0x2')]},'interval':{'type':Sequelize[_0x8b5f('0x2')],'defaultValue':_0x8b5f('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d8c43a1..2d5762d 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 _0x3678=['options','includeAll','include','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0xceecee,_0x4955f4){var _0x105021=function(_0x1f1e9a){while(--_0x1f1e9a){_0xceecee['push'](_0xceecee['shift']());}};_0x105021(++_0x4955f4);}(_0x3678,0xa2));var _0x8367=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0x3678[_0x3871d7];return _0x28ec09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8367('0x0'));var jsonpatch=require(_0x8367('0x1'));var rp=require(_0x8367('0x2'));var moment=require(_0x8367('0x3'));var BPromise=require(_0x8367('0x4'));var Mustache=require(_0x8367('0x5'));var util=require(_0x8367('0x6'));var path=require(_0x8367('0x7'));var sox=require(_0x8367('0x8'));var csv=require(_0x8367('0x9'));var ejs=require(_0x8367('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8367('0xb'));var squel=require(_0x8367('0xc'));var crypto=require(_0x8367('0xd'));var jsforce=require(_0x8367('0xe'));var deskjs=require(_0x8367('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8367('0x10'));var Redis=require('ioredis');var authService=require(_0x8367('0x11'));var qs=require(_0x8367('0x12'));var as=require(_0x8367('0x13'));var hardwareService=require(_0x8367('0x14'));var logger=require(_0x8367('0x15'))(_0x8367('0x16'));var utils=require(_0x8367('0x17'));var config=require(_0x8367('0x18'));var licenseUtil=require(_0x8367('0x19'));var db=require(_0x8367('0x1a'))['db'];function respondWithStatusCode(_0x55d782,_0x1e0412){_0x1e0412=_0x1e0412||0xcc;return function(_0x336ab2){if(_0x336ab2){return _0x55d782[_0x8367('0x1b')](_0x1e0412);}return _0x55d782['status'](_0x1e0412)[_0x8367('0x1c')]();};}function respondWithResult(_0x3f11aa,_0x380910){_0x380910=_0x380910||0xc8;return function(_0x4b800f){if(_0x4b800f){return _0x3f11aa[_0x8367('0x1d')](_0x380910)[_0x8367('0x1e')](_0x4b800f);}};}function respondWithFilteredResult(_0xcbc1c4,_0x3b3bf3){return function(_0x28400e){if(_0x28400e){var _0x9919bd=typeof _0x3b3bf3[_0x8367('0x1f')]===_0x8367('0x20')&&typeof _0x3b3bf3[_0x8367('0x21')]===_0x8367('0x20');var _0x5493bb=_0x28400e['count'];var _0x56d541=_0x9919bd?0x0:_0x3b3bf3[_0x8367('0x1f')];var _0x380422=_0x9919bd?_0x28400e[_0x8367('0x22')]:_0x3b3bf3[_0x8367('0x1f')]+_0x3b3bf3[_0x8367('0x21')];var _0x10da89;if(_0x380422>=_0x5493bb){_0x380422=_0x5493bb;_0x10da89=0xc8;}else{_0x10da89=0xce;}_0xcbc1c4['status'](_0x10da89);return _0xcbc1c4['set'](_0x8367('0x23'),_0x56d541+'-'+_0x380422+'/'+_0x5493bb)[_0x8367('0x1e')](_0x28400e);}return null;};}function patchUpdates(_0x2d9d88){return function(_0x4f04c8){try{jsonpatch['apply'](_0x4f04c8,_0x2d9d88,!![]);}catch(_0x565eb7){return BPromise[_0x8367('0x24')](_0x565eb7);}return _0x4f04c8[_0x8367('0x25')]();};}function saveUpdates(_0xa943bb,_0x335196){return function(_0x41bde4){if(_0x41bde4){return _0x41bde4[_0x8367('0x26')](_0xa943bb)[_0x8367('0x27')](function(_0xbef9c5){return _0xbef9c5;});}return null;};}function removeEntity(_0x5b609d,_0x3df626){return function(_0x1b0238){if(_0x1b0238){return _0x1b0238[_0x8367('0x28')]()['then'](function(){_0x5b609d[_0x8367('0x1d')](0xcc)[_0x8367('0x1c')]();});}};}function handleEntityNotFound(_0x454682,_0x16f050){return function(_0x50df09){if(!_0x50df09){_0x454682['sendStatus'](0x194);}return _0x50df09;};}function handleError(_0x42ce57,_0x4d92dc){_0x4d92dc=_0x4d92dc||0x1f4;return function(_0x5b781f){logger[_0x8367('0x29')](_0x5b781f[_0x8367('0x2a')]);if(_0x5b781f[_0x8367('0x2b')]){delete _0x5b781f[_0x8367('0x2b')];}_0x42ce57[_0x8367('0x1d')](_0x4d92dc)[_0x8367('0x2c')](_0x5b781f);};}exports['index']=function(_0x4bd06c,_0x4dcde3){var _0x21d8e8={},_0x5739b9={},_0x1bdffc={'count':0x0,'rows':[]};var _0x389f35=_[_0x8367('0x2d')](db[_0x8367('0x2e')][_0x8367('0x2f')],function(_0x2a1123){return{'name':_0x2a1123[_0x8367('0x30')],'type':_0x2a1123['type'][_0x8367('0x31')]};});_0x5739b9[_0x8367('0x32')]=_['map'](_0x389f35,'name');_0x5739b9['query']=_[_0x8367('0x33')](_0x4bd06c[_0x8367('0x34')]);_0x5739b9[_0x8367('0x35')]=_['intersection'](_0x5739b9[_0x8367('0x32')],_0x5739b9[_0x8367('0x34')]);_0x21d8e8[_0x8367('0x36')]=_[_0x8367('0x37')](_0x5739b9[_0x8367('0x32')],qs['fields'](_0x4bd06c[_0x8367('0x34')][_0x8367('0x38')]));_0x21d8e8['attributes']=_0x21d8e8['attributes'][_0x8367('0x39')]?_0x21d8e8[_0x8367('0x36')]:_0x5739b9['model'];if(!_0x4bd06c[_0x8367('0x34')]['hasOwnProperty'](_0x8367('0x3a'))){_0x21d8e8[_0x8367('0x21')]=qs['limit'](_0x4bd06c[_0x8367('0x34')][_0x8367('0x21')]);_0x21d8e8['offset']=qs[_0x8367('0x1f')](_0x4bd06c[_0x8367('0x34')][_0x8367('0x1f')]);}_0x21d8e8['order']=qs[_0x8367('0x3b')](_0x4bd06c[_0x8367('0x34')][_0x8367('0x3b')]);_0x21d8e8[_0x8367('0x3c')]=qs[_0x8367('0x35')](_[_0x8367('0x3d')](_0x4bd06c[_0x8367('0x34')],_0x5739b9[_0x8367('0x35')]),_0x389f35);if(_0x4bd06c['query']['filter']){_0x21d8e8[_0x8367('0x3c')]=_[_0x8367('0x3e')](_0x21d8e8[_0x8367('0x3c')],{'$or':_[_0x8367('0x2d')](_0x389f35,function(_0x2a04f5){if(_0x2a04f5[_0x8367('0x3f')]!==_0x8367('0x40')){var _0x72f849={};_0x72f849[_0x2a04f5[_0x8367('0x2b')]]={'$like':'%'+_0x4bd06c[_0x8367('0x34')][_0x8367('0x41')]+'%'};return _0x72f849;}})});}_0x21d8e8=_[_0x8367('0x3e')]({},_0x21d8e8,_0x4bd06c[_0x8367('0x42')]);var _0x4b00de={'where':_0x21d8e8[_0x8367('0x3c')]};return db['FaxApplication']['count'](_0x4b00de)[_0x8367('0x27')](function(_0x4e7e10){_0x1bdffc[_0x8367('0x22')]=_0x4e7e10;if(_0x4bd06c[_0x8367('0x34')][_0x8367('0x43')]){_0x21d8e8[_0x8367('0x44')]=[{'all':!![]}];}return db[_0x8367('0x2e')]['findAll'](_0x21d8e8);})[_0x8367('0x27')](function(_0x49a5f9){_0x1bdffc[_0x8367('0x45')]=_0x49a5f9;return _0x1bdffc;})['then'](respondWithFilteredResult(_0x4dcde3,_0x21d8e8))[_0x8367('0x46')](handleError(_0x4dcde3,null));};exports[_0x8367('0x47')]=function(_0x268e11,_0x5bd170){var _0xfecb4f={'raw':!![],'where':{'id':_0x268e11[_0x8367('0x48')]['id']}},_0xfc03f3={};_0xfc03f3[_0x8367('0x32')]=_['keys'](db[_0x8367('0x2e')][_0x8367('0x2f')]);_0xfc03f3[_0x8367('0x34')]=_[_0x8367('0x33')](_0x268e11[_0x8367('0x34')]);_0xfc03f3[_0x8367('0x35')]=_[_0x8367('0x37')](_0xfc03f3[_0x8367('0x32')],_0xfc03f3[_0x8367('0x34')]);_0xfecb4f[_0x8367('0x36')]=_[_0x8367('0x37')](_0xfc03f3[_0x8367('0x32')],qs[_0x8367('0x38')](_0x268e11['query']['fields']));_0xfecb4f[_0x8367('0x36')]=_0xfecb4f[_0x8367('0x36')][_0x8367('0x39')]?_0xfecb4f['attributes']:_0xfc03f3[_0x8367('0x32')];if(_0x268e11[_0x8367('0x34')][_0x8367('0x43')]){_0xfecb4f[_0x8367('0x44')]=[{'all':!![]}];}_0xfecb4f=_[_0x8367('0x3e')]({},_0xfecb4f,_0x268e11[_0x8367('0x42')]);return db[_0x8367('0x2e')][_0x8367('0x49')](_0xfecb4f)[_0x8367('0x27')](handleEntityNotFound(_0x5bd170,null))[_0x8367('0x27')](respondWithResult(_0x5bd170,null))[_0x8367('0x46')](handleError(_0x5bd170,null));};exports[_0x8367('0x4a')]=function(_0x1b471a,_0x1ff877){return db[_0x8367('0x2e')][_0x8367('0x4a')](_0x1b471a[_0x8367('0x4b')],{})[_0x8367('0x27')](respondWithResult(_0x1ff877,0xc9))['catch'](handleError(_0x1ff877,null));};exports[_0x8367('0x26')]=function(_0x4d7ef0,_0x5d35aa){if(_0x4d7ef0['body']['id']){delete _0x4d7ef0['body']['id'];}return db[_0x8367('0x2e')]['find']({'where':{'id':_0x4d7ef0[_0x8367('0x48')]['id']}})[_0x8367('0x27')](handleEntityNotFound(_0x5d35aa,null))[_0x8367('0x27')](saveUpdates(_0x4d7ef0[_0x8367('0x4b')],null))['then'](respondWithResult(_0x5d35aa,null))[_0x8367('0x46')](handleError(_0x5d35aa,null));};exports[_0x8367('0x28')]=function(_0x3f87a9,_0x15e986){return db[_0x8367('0x2e')][_0x8367('0x49')]({'where':{'id':_0x3f87a9[_0x8367('0x48')]['id']}})[_0x8367('0x27')](handleEntityNotFound(_0x15e986,null))[_0x8367('0x27')](removeEntity(_0x15e986,null))[_0x8367('0x46')](handleError(_0x15e986,null));}; \ No newline at end of file +var _0x8f4e=['then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update'];(function(_0x5c5505,_0x573773){var _0x47b3f6=function(_0x4d2e6d){while(--_0x4d2e6d){_0x5c5505['push'](_0x5c5505['shift']());}};_0x47b3f6(++_0x573773);}(_0x8f4e,0xf7));var _0xe8f4=function(_0x5967c7,_0x257bfb){_0x5967c7=_0x5967c7-0x0;var _0x2fa23d=_0x8f4e[_0x5967c7];return _0x2fa23d;};'use strict';var emlformat=require(_0xe8f4('0x0'));var rimraf=require(_0xe8f4('0x1'));var zipdir=require(_0xe8f4('0x2'));var jsonpatch=require(_0xe8f4('0x3'));var rp=require('request-promise');var moment=require(_0xe8f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe8f4('0x5'));var util=require(_0xe8f4('0x6'));var path=require(_0xe8f4('0x7'));var sox=require('sox');var csv=require(_0xe8f4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8f4('0x9'));var _=require(_0xe8f4('0xa'));var squel=require('squel');var crypto=require(_0xe8f4('0xb'));var jsforce=require(_0xe8f4('0xc'));var deskjs=require(_0xe8f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8f4('0xe'));var Papa=require('papaparse');var Redis=require(_0xe8f4('0xf'));var authService=require(_0xe8f4('0x10'));var qs=require(_0xe8f4('0x11'));var as=require(_0xe8f4('0x12'));var hardwareService=require(_0xe8f4('0x13'));var logger=require(_0xe8f4('0x14'))(_0xe8f4('0x15'));var utils=require(_0xe8f4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe8f4('0x17'));var db=require(_0xe8f4('0x18'))['db'];function respondWithStatusCode(_0x4dab98,_0x3987b9){_0x3987b9=_0x3987b9||0xcc;return function(_0x504494){if(_0x504494){return _0x4dab98[_0xe8f4('0x19')](_0x3987b9);}return _0x4dab98[_0xe8f4('0x1a')](_0x3987b9)[_0xe8f4('0x1b')]();};}function respondWithResult(_0x5efd6e,_0x504969){_0x504969=_0x504969||0xc8;return function(_0x20cb2e){if(_0x20cb2e){return _0x5efd6e[_0xe8f4('0x1a')](_0x504969)[_0xe8f4('0x1c')](_0x20cb2e);}};}function respondWithFilteredResult(_0x1c50fb,_0xe9c43f){return function(_0x77a8de){if(_0x77a8de){var _0x13a3b8=typeof _0xe9c43f[_0xe8f4('0x1d')]===_0xe8f4('0x1e')&&typeof _0xe9c43f['limit']==='undefined';var _0x488f0e=_0x77a8de['count'];var _0x1a6220=_0x13a3b8?0x0:_0xe9c43f[_0xe8f4('0x1d')];var _0x519b63=_0x13a3b8?_0x77a8de['count']:_0xe9c43f[_0xe8f4('0x1d')]+_0xe9c43f[_0xe8f4('0x1f')];var _0x4cb394;if(_0x519b63>=_0x488f0e){_0x519b63=_0x488f0e;_0x4cb394=0xc8;}else{_0x4cb394=0xce;}_0x1c50fb[_0xe8f4('0x1a')](_0x4cb394);return _0x1c50fb[_0xe8f4('0x20')]('Content-Range',_0x1a6220+'-'+_0x519b63+'/'+_0x488f0e)[_0xe8f4('0x1c')](_0x77a8de);}return null;};}function patchUpdates(_0x585081){return function(_0x2d474a){try{jsonpatch[_0xe8f4('0x21')](_0x2d474a,_0x585081,!![]);}catch(_0x1539d4){return BPromise[_0xe8f4('0x22')](_0x1539d4);}return _0x2d474a[_0xe8f4('0x23')]();};}function saveUpdates(_0x39c5a3,_0x119a32){return function(_0x45c507){if(_0x45c507){return _0x45c507[_0xe8f4('0x24')](_0x39c5a3)[_0xe8f4('0x25')](function(_0x5c6173){return _0x5c6173;});}return null;};}function removeEntity(_0x3dcfea,_0x1f7727){return function(_0x1981ce){if(_0x1981ce){return _0x1981ce[_0xe8f4('0x26')]()[_0xe8f4('0x25')](function(){_0x3dcfea[_0xe8f4('0x1a')](0xcc)[_0xe8f4('0x1b')]();});}};}function handleEntityNotFound(_0x403da7,_0x126b43){return function(_0x56d4d0){if(!_0x56d4d0){_0x403da7[_0xe8f4('0x19')](0x194);}return _0x56d4d0;};}function handleError(_0x155b3d,_0x22fbf9){_0x22fbf9=_0x22fbf9||0x1f4;return function(_0x23b750){logger[_0xe8f4('0x27')](_0x23b750[_0xe8f4('0x28')]);if(_0x23b750[_0xe8f4('0x29')]){delete _0x23b750[_0xe8f4('0x29')];}_0x155b3d[_0xe8f4('0x1a')](_0x22fbf9)[_0xe8f4('0x2a')](_0x23b750);};}exports['index']=function(_0x13ed40,_0xa5defd){var _0x1292db={},_0xde987={},_0x16889f={'count':0x0,'rows':[]};var _0x1dc251=_[_0xe8f4('0x2b')](db[_0xe8f4('0x2c')][_0xe8f4('0x2d')],function(_0x1357e4){return{'name':_0x1357e4['fieldName'],'type':_0x1357e4[_0xe8f4('0x2e')]['key']};});_0xde987['model']=_[_0xe8f4('0x2b')](_0x1dc251,_0xe8f4('0x29'));_0xde987[_0xe8f4('0x2f')]=_[_0xe8f4('0x30')](_0x13ed40[_0xe8f4('0x2f')]);_0xde987[_0xe8f4('0x31')]=_[_0xe8f4('0x32')](_0xde987[_0xe8f4('0x33')],_0xde987[_0xe8f4('0x2f')]);_0x1292db[_0xe8f4('0x34')]=_[_0xe8f4('0x32')](_0xde987[_0xe8f4('0x33')],qs['fields'](_0x13ed40[_0xe8f4('0x2f')][_0xe8f4('0x35')]));_0x1292db['attributes']=_0x1292db['attributes'][_0xe8f4('0x36')]?_0x1292db[_0xe8f4('0x34')]:_0xde987[_0xe8f4('0x33')];if(!_0x13ed40['query'][_0xe8f4('0x37')]('nolimit')){_0x1292db['limit']=qs['limit'](_0x13ed40['query'][_0xe8f4('0x1f')]);_0x1292db[_0xe8f4('0x1d')]=qs['offset'](_0x13ed40[_0xe8f4('0x2f')]['offset']);}_0x1292db['order']=qs[_0xe8f4('0x38')](_0x13ed40[_0xe8f4('0x2f')][_0xe8f4('0x38')]);_0x1292db[_0xe8f4('0x39')]=qs[_0xe8f4('0x31')](_[_0xe8f4('0x3a')](_0x13ed40[_0xe8f4('0x2f')],_0xde987[_0xe8f4('0x31')]),_0x1dc251);if(_0x13ed40['query'][_0xe8f4('0x3b')]){_0x1292db[_0xe8f4('0x39')]=_[_0xe8f4('0x3c')](_0x1292db[_0xe8f4('0x39')],{'$or':_['map'](_0x1dc251,function(_0x59145d){if(_0x59145d[_0xe8f4('0x2e')]!==_0xe8f4('0x3d')){var _0x3f83a2={};_0x3f83a2[_0x59145d[_0xe8f4('0x29')]]={'$like':'%'+_0x13ed40[_0xe8f4('0x2f')][_0xe8f4('0x3b')]+'%'};return _0x3f83a2;}})});}_0x1292db=_['merge']({},_0x1292db,_0x13ed40[_0xe8f4('0x3e')]);var _0x7d3053={'where':_0x1292db[_0xe8f4('0x39')]};return db[_0xe8f4('0x2c')]['count'](_0x7d3053)[_0xe8f4('0x25')](function(_0x3998d0){_0x16889f[_0xe8f4('0x3f')]=_0x3998d0;if(_0x13ed40[_0xe8f4('0x2f')]['includeAll']){_0x1292db[_0xe8f4('0x40')]=[{'all':!![]}];}return db[_0xe8f4('0x2c')][_0xe8f4('0x41')](_0x1292db);})[_0xe8f4('0x25')](function(_0x2ca4ac){_0x16889f['rows']=_0x2ca4ac;return _0x16889f;})['then'](respondWithFilteredResult(_0xa5defd,_0x1292db))[_0xe8f4('0x42')](handleError(_0xa5defd,null));};exports['show']=function(_0x1d63f0,_0x3e88bf){var _0x2ce6df={'raw':!![],'where':{'id':_0x1d63f0['params']['id']}},_0x4f150c={};_0x4f150c[_0xe8f4('0x33')]=_[_0xe8f4('0x30')](db['FaxApplication'][_0xe8f4('0x2d')]);_0x4f150c['query']=_['keys'](_0x1d63f0[_0xe8f4('0x2f')]);_0x4f150c[_0xe8f4('0x31')]=_[_0xe8f4('0x32')](_0x4f150c[_0xe8f4('0x33')],_0x4f150c['query']);_0x2ce6df[_0xe8f4('0x34')]=_[_0xe8f4('0x32')](_0x4f150c[_0xe8f4('0x33')],qs[_0xe8f4('0x35')](_0x1d63f0['query'][_0xe8f4('0x35')]));_0x2ce6df[_0xe8f4('0x34')]=_0x2ce6df[_0xe8f4('0x34')]['length']?_0x2ce6df[_0xe8f4('0x34')]:_0x4f150c['model'];if(_0x1d63f0[_0xe8f4('0x2f')]['includeAll']){_0x2ce6df['include']=[{'all':!![]}];}_0x2ce6df=_[_0xe8f4('0x3c')]({},_0x2ce6df,_0x1d63f0[_0xe8f4('0x3e')]);return db[_0xe8f4('0x2c')][_0xe8f4('0x43')](_0x2ce6df)[_0xe8f4('0x25')](handleEntityNotFound(_0x3e88bf,null))[_0xe8f4('0x25')](respondWithResult(_0x3e88bf,null))[_0xe8f4('0x42')](handleError(_0x3e88bf,null));};exports[_0xe8f4('0x44')]=function(_0x2b9c34,_0x2d4802){return db[_0xe8f4('0x2c')][_0xe8f4('0x44')](_0x2b9c34[_0xe8f4('0x45')],{})[_0xe8f4('0x25')](respondWithResult(_0x2d4802,0xc9))[_0xe8f4('0x42')](handleError(_0x2d4802,null));};exports['update']=function(_0x3b6b4f,_0x5bf00){if(_0x3b6b4f[_0xe8f4('0x45')]['id']){delete _0x3b6b4f[_0xe8f4('0x45')]['id'];}return db[_0xe8f4('0x2c')][_0xe8f4('0x43')]({'where':{'id':_0x3b6b4f[_0xe8f4('0x46')]['id']}})[_0xe8f4('0x25')](handleEntityNotFound(_0x5bf00,null))[_0xe8f4('0x25')](saveUpdates(_0x3b6b4f['body'],null))[_0xe8f4('0x25')](respondWithResult(_0x5bf00,null))[_0xe8f4('0x42')](handleError(_0x5bf00,null));};exports[_0xe8f4('0x26')]=function(_0x80537c,_0x435a9e){return db[_0xe8f4('0x2c')][_0xe8f4('0x43')]({'where':{'id':_0x80537c[_0xe8f4('0x46')]['id']}})[_0xe8f4('0x25')](handleEntityNotFound(_0x435a9e,null))[_0xe8f4('0x25')](removeEntity(_0x435a9e,null))[_0xe8f4('0x42')](handleError(_0x435a9e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 16392e9..98070d9 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 _0x81e8=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x6e48ec,_0xa0031b){var _0x2f69a0=function(_0x223786){while(--_0x223786){_0x6e48ec['push'](_0x6e48ec['shift']());}};_0x2f69a0(++_0xa0031b);}(_0x81e8,0x1d5));var _0x881e=function(_0x86d59e,_0x122714){_0x86d59e=_0x86d59e-0x0;var _0x4ec5fa=_0x81e8[_0x86d59e];return _0x4ec5fa;};'use strict';var _=require(_0x881e('0x0'));var util=require(_0x881e('0x1'));var logger=require(_0x881e('0x2'))(_0x881e('0x3'));var moment=require('moment');var BPromise=require(_0x881e('0x4'));var rp=require(_0x881e('0x5'));var fs=require('fs');var path=require(_0x881e('0x6'));var rimraf=require('rimraf');var config=require(_0x881e('0x7'));var attributes=require(_0x881e('0x8'));module['exports']=function(_0x2bc482,_0x46ee7d){return _0x2bc482[_0x881e('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x881e('0xa')});}; \ No newline at end of file +var _0x032c=['rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x032c,0x1b5));var _0xc032=function(_0x3e8395,_0x106091){_0x3e8395=_0x3e8395-0x0;var _0x45bf35=_0x032c[_0x3e8395];return _0x45bf35;};'use strict';var _=require('lodash');var util=require(_0xc032('0x0'));var logger=require(_0xc032('0x1'))('api');var moment=require(_0xc032('0x2'));var BPromise=require('bluebird');var rp=require(_0xc032('0x3'));var fs=require('fs');var path=require(_0xc032('0x4'));var rimraf=require(_0xc032('0x5'));var config=require(_0xc032('0x6'));var attributes=require(_0xc032('0x7'));module['exports']=function(_0x24afc9,_0x4a5b48){return _0x24afc9[_0xc032('0x8')](_0xc032('0x9'),attributes,{'tableName':_0xc032('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc032('0xb'),'collate':_0xc032('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f6c68d2..0f96016 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 _0x72d2=['http','request','then','info','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x59ad89,_0x41cdbd){var _0x463e97=function(_0x4bc593){while(--_0x4bc593){_0x59ad89['push'](_0x59ad89['shift']());}};_0x463e97(++_0x41cdbd);}(_0x72d2,0xb9));var _0x272d=function(_0x4e96a4,_0x207e09){_0x4e96a4=_0x4e96a4-0x0;var _0x1beafa=_0x72d2[_0x4e96a4];return _0x1beafa;};'use strict';var _=require(_0x272d('0x0'));var util=require(_0x272d('0x1'));var moment=require(_0x272d('0x2'));var BPromise=require(_0x272d('0x3'));var rs=require(_0x272d('0x4'));var fs=require('fs');var Redis=require(_0x272d('0x5'));var db=require(_0x272d('0x6'))['db'];var utils=require(_0x272d('0x7'));var logger=require(_0x272d('0x8'))(_0x272d('0x9'));var config=require(_0x272d('0xa'));var jayson=require(_0x272d('0xb'));var client=jayson[_0x272d('0xc')][_0x272d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x405da5,_0x2bce44,_0x31c825){return new BPromise(function(_0x1dd6ce,_0x36fb25){return client[_0x272d('0xe')](_0x405da5,_0x31c825)[_0x272d('0xf')](function(_0x50e181){logger[_0x272d('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2bce44,'request\x20sent');logger[_0x272d('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2bce44,'request\x20sent',JSON[_0x272d('0x12')](_0x50e181));if(_0x50e181[_0x272d('0x13')]){if(_0x50e181['error'][_0x272d('0x14')]===0x1f4){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x36fb25(_0x50e181[_0x272d('0x13')]['message']);}logger['error'](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x1dd6ce(_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);}else{logger[_0x272d('0x10')](_0x272d('0x15'),_0x2bce44,_0x272d('0x17'));_0x1dd6ce(_0x50e181['result'][_0x272d('0x16')]);}})[_0x272d('0x18')](function(_0x35f01f){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x35f01f);_0x36fb25(_0x35f01f);});});}exports[_0x272d('0x19')]=function(_0x36b8aa){var _0x5c54d3=this;return new Promise(function(_0x53a004,_0xa3c5e5){return db[_0x272d('0x1a')][_0x272d('0x1b')](_0x36b8aa[_0x272d('0x1c')],{'raw':_0x36b8aa[_0x272d('0x1d')]?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b8aa['options']?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x1f')]||null:null,'attributes':_0x36b8aa[_0x272d('0x1d')]?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x20')]||null:null,'limit':_0x36b8aa['options']?_0x36b8aa[_0x272d('0x1d')]['limit']||null:null})[_0x272d('0xf')](function(_0x55be56){logger['info']('UpdateFaxApplication',_0x36b8aa);logger[_0x272d('0x11')](_0x272d('0x19'),_0x36b8aa,JSON[_0x272d('0x12')](_0x55be56));_0x53a004(_0x55be56);})[_0x272d('0x18')](function(_0x4cf7d1){logger[_0x272d('0x13')](_0x272d('0x19'),_0x4cf7d1['message'],_0x36b8aa);_0xa3c5e5(_0x5c54d3[_0x272d('0x13')](0x1f4,_0x4cf7d1['message']));});});}; \ No newline at end of file +var _0x7e46=['then','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','body','options','raw','attributes','limit'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x7e46,0x1a6));var _0x67e4=function(_0x207f34,_0x2abf2e){_0x207f34=_0x207f34-0x0;var _0x4496cd=_0x7e46[_0x207f34];return _0x4496cd;};'use strict';var _=require(_0x67e4('0x0'));var util=require(_0x67e4('0x1'));var moment=require(_0x67e4('0x2'));var BPromise=require(_0x67e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67e4('0x4'));var db=require(_0x67e4('0x5'))['db'];var utils=require(_0x67e4('0x6'));var logger=require('../../config/logger')(_0x67e4('0x7'));var config=require(_0x67e4('0x8'));var jayson=require(_0x67e4('0x9'));var client=jayson[_0x67e4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289a62,_0x176aff,_0x34ce8a){return new BPromise(function(_0x3b1cd3,_0x35ad69){return client['request'](_0x289a62,_0x34ce8a)['then'](function(_0x2e56f5){logger['info'](_0x67e4('0xb'),_0x176aff,_0x67e4('0xc'));logger['debug'](_0x67e4('0xd'),_0x176aff,_0x67e4('0xc'),JSON[_0x67e4('0xe')](_0x2e56f5));if(_0x2e56f5['error']){if(_0x2e56f5[_0x67e4('0xf')][_0x67e4('0x10')]===0x1f4){logger[_0x67e4('0xf')]('FaxApplication,\x20%s,\x20%s',_0x176aff,_0x2e56f5[_0x67e4('0xf')][_0x67e4('0x11')]);return _0x35ad69(_0x2e56f5['error'][_0x67e4('0x11')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x176aff,_0x2e56f5[_0x67e4('0xf')][_0x67e4('0x11')]);return _0x3b1cd3(_0x2e56f5[_0x67e4('0xf')][_0x67e4('0x11')]);}else{logger['info'](_0x67e4('0xb'),_0x176aff,_0x67e4('0xc'));_0x3b1cd3(_0x2e56f5[_0x67e4('0x12')][_0x67e4('0x11')]);}})[_0x67e4('0x13')](function(_0x446d90){logger[_0x67e4('0xf')](_0x67e4('0xb'),_0x176aff,_0x446d90);_0x35ad69(_0x446d90);});});}exports[_0x67e4('0x14')]=function(_0x562fbc){var _0x1226a3=this;return new Promise(function(_0x329b32,_0x126ed6){return db['FaxApplication']['update'](_0x562fbc[_0x67e4('0x15')],{'raw':_0x562fbc[_0x67e4('0x16')]?_0x562fbc['options'][_0x67e4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562fbc['options']?_0x562fbc[_0x67e4('0x16')]['where']||null:null,'attributes':_0x562fbc[_0x67e4('0x16')]?_0x562fbc['options'][_0x67e4('0x18')]||null:null,'limit':_0x562fbc[_0x67e4('0x16')]?_0x562fbc[_0x67e4('0x16')][_0x67e4('0x19')]||null:null})[_0x67e4('0x1a')](function(_0x217099){logger[_0x67e4('0x1b')](_0x67e4('0x14'),_0x562fbc);logger['debug']('UpdateFaxApplication',_0x562fbc,JSON[_0x67e4('0xe')](_0x217099));_0x329b32(_0x217099);})[_0x67e4('0x13')](function(_0x349a88){logger[_0x67e4('0xf')]('UpdateFaxApplication',_0x349a88[_0x67e4('0x11')],_0x562fbc);_0x126ed6(_0x1226a3['error'](0x1f4,_0x349a88['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 33ee78b..8c32f97 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 _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4bfd67,_0x584e60){var _0xec4d84=function(_0xf54268){while(--_0xf54268){_0x4bfd67['push'](_0x4bfd67['shift']());}};_0xec4d84(++_0x584e60);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xe5b5[_0x28fbbf];return _0x543af6;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file +var _0x8f4c=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3bfbc7,_0x1aa44f){var _0x41df69=function(_0x42cecc){while(--_0x42cecc){_0x3bfbc7['push'](_0x3bfbc7['shift']());}};_0x41df69(++_0x1aa44f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2e986c,_0x90e194){_0x2e986c=_0x2e986c-0x0;var _0x165169=_0x8f4c[_0x2e986c];return _0x165169;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./faxApplication.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0xc')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router[_0xc8f4('0xf')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index be782dd..203a5e7 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 _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0xb5de7a,_0x175e7f){var _0x1bc995=function(_0x4f9356){while(--_0x4f9356){_0xb5de7a['push'](_0xb5de7a['shift']());}};_0x1bc995(++_0x175e7f);}(_0x8aad,0x146));var _0xd8aa=function(_0x14e67a,_0xd2cc18){_0x14e67a=_0x14e67a-0x0;var _0x4a2be3=_0x8aad[_0x14e67a];return _0x4a2be3;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8aa('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd8aa('0x4')]('in',_0xd8aa('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6a95=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x287622,_0x20258b){var _0x4c2c61=function(_0x4fa516){while(--_0x4fa516){_0x287622['push'](_0x287622['shift']());}};_0x4c2c61(++_0x20258b);}(_0x6a95,0x1db));var _0x56a9=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x6a95[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'closed':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x56a9('0x3')]},'disposition':{'type':Sequelize[_0x56a9('0x4')]},'secondDisposition':{'type':Sequelize[_0x56a9('0x4')]},'thirdDisposition':{'type':Sequelize[_0x56a9('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x56a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56a9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x56a9('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f3d42ad..c4d963c 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 _0xb0b2=['unlinkSync','rimraf','moment','bluebird','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','omit','getMessages','findOne','params','hasOwnProperty','nolimit','order','sort','FaxInteractionId','filter','where','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','ids','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log'];(function(_0xa0f797,_0x9b2fa7){var _0x14acd7=function(_0x3f814a){while(--_0x3f814a){_0xa0f797['push'](_0xa0f797['shift']());}};_0x14acd7(++_0x9b2fa7);}(_0xb0b2,0x139));var _0x2b0b=function(_0x26793d,_0x45eac2){_0x26793d=_0x26793d-0x0;var _0x1203b8=_0xb0b2[_0x26793d];return _0x1203b8;};'use strict';var rimraf=require(_0x2b0b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2b0b('0x1'));var BPromise=require(_0x2b0b('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x2b0b('0x3'));var interaction=require(_0x2b0b('0x4'));var qs=require(_0x2b0b('0x5'));var logger=require(_0x2b0b('0x6'))(_0x2b0b('0x7'));var config=require(_0x2b0b('0x8'));var db=require('../../mysqldb')['db'];config[_0x2b0b('0x9')]=_[_0x2b0b('0xa')](config[_0x2b0b('0x9')],{'host':_0x2b0b('0xb'),'port':0x18eb});var socket=require(_0x2b0b('0xc'))(new Redis(config[_0x2b0b('0x9')]));require(_0x2b0b('0xd'))[_0x2b0b('0xe')](socket);function respondWithStatusCode(_0x1a2c12,_0x87a94f){_0x87a94f=_0x87a94f||0xcc;return function(_0x5d4a35){if(_0x5d4a35){return _0x1a2c12[_0x2b0b('0xf')](_0x87a94f);}return _0x1a2c12[_0x2b0b('0x10')](_0x87a94f)[_0x2b0b('0x11')]();};}function respondWithResult(_0x340b7f,_0x5b3e58){_0x5b3e58=_0x5b3e58||0xc8;return function(_0x238708){if(_0x238708){return _0x340b7f[_0x2b0b('0x10')](_0x5b3e58)['json'](_0x238708);}};}function respondWithFilteredResult(_0x25688a,_0x54ccec){return function(_0x3ea046){if(_0x3ea046){var _0x447d34=typeof _0x54ccec[_0x2b0b('0x12')]===_0x2b0b('0x13')&&typeof _0x54ccec[_0x2b0b('0x14')]===_0x2b0b('0x13');var _0x1a17c1=_0x3ea046[_0x2b0b('0x15')];var _0xfbd7f6=_0x447d34?0x0:_0x54ccec['offset'];var _0x4956dd=_0x447d34?_0x3ea046['count']:_0x54ccec[_0x2b0b('0x12')]+_0x54ccec[_0x2b0b('0x14')];var _0x2ca2a9;if(_0x4956dd>=_0x1a17c1){_0x4956dd=_0x1a17c1;_0x2ca2a9=0xc8;}else{_0x2ca2a9=0xce;}_0x25688a['status'](_0x2ca2a9);return _0x25688a[_0x2b0b('0x16')](_0x2b0b('0x17'),_0xfbd7f6+'-'+_0x4956dd+'/'+_0x1a17c1)['json'](_0x3ea046);}return null;};}function saveUpdates(_0x2f7f18){return function(_0x1c844f){if(_0x1c844f){return _0x1c844f[_0x2b0b('0x18')](_0x2f7f18)[_0x2b0b('0x19')](function(_0x1b8b6d){return _0x1b8b6d;});}return null;};}function removeEntity(_0x36b67a){return function(_0x458021){if(_0x458021){return _0x458021[_0x2b0b('0x1a')]()[_0x2b0b('0x19')](function(){_0x36b67a['status'](0xcc)[_0x2b0b('0x11')]();});}};}function handleEntityNotFound(_0x134ade){return function(_0x246eec){if(!_0x246eec){_0x134ade[_0x2b0b('0xf')](0x194);}return _0x246eec;};}function handleError(_0x5c669a,_0x4b9301){_0x4b9301=_0x4b9301||0x1f4;return function(_0x1f6d63){logger[_0x2b0b('0x1b')](_0x1f6d63[_0x2b0b('0x1c')]);if(_0x1f6d63[_0x2b0b('0x1d')]){delete _0x1f6d63[_0x2b0b('0x1d')];}_0x5c669a[_0x2b0b('0x10')](_0x4b9301)[_0x2b0b('0x1e')](_0x1f6d63);};}exports[_0x2b0b('0x1f')]=function(_0x5009c1,_0x13fd22){var _0x2c8258={};var _0xb57d8c=_[_0x2b0b('0x20')](db[_0x2b0b('0x21')][_0x2b0b('0x22')],function(_0x1c46f2){return{'name':_0x1c46f2[_0x2b0b('0x23')],'type':_0x1c46f2[_0x2b0b('0x24')][_0x2b0b('0x25')]};});_0x2c8258=qs[_0x2b0b('0x26')](_0xb57d8c,_0x5009c1);return interaction[_0x2b0b('0x27')]('fax',_0x5009c1[_0x2b0b('0x28')],_0x5009c1[_0x2b0b('0x29')],_0x2c8258,_0xb57d8c)[_0x2b0b('0x19')](respondWithFilteredResult(_0x13fd22,_0x2c8258))[_0x2b0b('0x2a')](handleError(_0x13fd22,null));};exports[_0x2b0b('0x2b')]=function(_0x56bfc7,_0x41d2fa){var _0x55eeae={'raw':![],'where':{'id':_0x56bfc7['params']['id']}},_0x31472c={};_0x31472c[_0x2b0b('0x2c')]=_[_0x2b0b('0x2d')](db[_0x2b0b('0x21')]['rawAttributes']);_0x31472c[_0x2b0b('0x28')]=_[_0x2b0b('0x2d')](_0x56bfc7[_0x2b0b('0x28')]);_0x31472c[_0x2b0b('0x2e')]=_[_0x2b0b('0x2f')](_0x31472c[_0x2b0b('0x2c')],_0x31472c['query']);_0x55eeae[_0x2b0b('0x30')]=_[_0x2b0b('0x2f')](_0x31472c['model'],qs[_0x2b0b('0x31')](_0x56bfc7[_0x2b0b('0x28')][_0x2b0b('0x31')]));_0x55eeae[_0x2b0b('0x30')]=_0x55eeae[_0x2b0b('0x30')][_0x2b0b('0x32')]?_0x55eeae[_0x2b0b('0x30')]:_0x31472c[_0x2b0b('0x2c')];if(_0x56bfc7[_0x2b0b('0x28')][_0x2b0b('0x33')]){_0x55eeae[_0x2b0b('0x34')]=[{'all':!![]}];}_0x55eeae=_[_0x2b0b('0x35')]({},_0x55eeae,_0x56bfc7[_0x2b0b('0x36')]);return db[_0x2b0b('0x21')][_0x2b0b('0x37')](_0x55eeae)[_0x2b0b('0x19')](handleEntityNotFound(_0x41d2fa,null))[_0x2b0b('0x19')](respondWithResult(_0x41d2fa,null))[_0x2b0b('0x2a')](handleError(_0x41d2fa,null));};exports[_0x2b0b('0x38')]=function(_0x48378e,_0x46dc8b){return db['FaxInteraction'][_0x2b0b('0x38')](_0x48378e[_0x2b0b('0x39')],{})['then'](respondWithResult(_0x46dc8b,0xc9))['catch'](handleError(_0x46dc8b,null));};exports[_0x2b0b('0x18')]=function(_0xf878f9,_0xf57ead){if(_0xf878f9[_0x2b0b('0x39')]['id']){delete _0xf878f9['body']['id'];}return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0xf878f9['params']['id']}})['then'](handleEntityNotFound(_0xf57ead,null))[_0x2b0b('0x19')](saveUpdates(_0xf878f9['body'],null))[_0x2b0b('0x19')](respondWithResult(_0xf57ead,null))['catch'](handleError(_0xf57ead,null));};exports[_0x2b0b('0x1a')]=function(_0x592c78,_0x90860e){return db['FaxInteraction'][_0x2b0b('0x37')]({'where':{'id':_0x592c78['params']['id']}})['then'](handleEntityNotFound(_0x90860e,null))[_0x2b0b('0x19')](removeEntity(_0x90860e,null))[_0x2b0b('0x2a')](handleError(_0x90860e,null));};exports[_0x2b0b('0x3a')]=function(_0x52034d,_0x5717f5){return db[_0x2b0b('0x21')][_0x2b0b('0x3a')]()[_0x2b0b('0x19')](respondWithResult(_0x5717f5,null))[_0x2b0b('0x2a')](handleError(_0x5717f5,null));};exports[_0x2b0b('0x3b')]=function(_0x42d82b,_0x9d1398){return db[_0x2b0b('0x3c')][_0x2b0b('0x37')]({'where':{'id':_0x42d82b['params']['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x9d1398,null))[_0x2b0b('0x19')](function(_0x59f508){if(_0x59f508){return _0x59f508[_0x2b0b('0x3b')](_0x42d82b[_0x2b0b('0x39')]['ids'],_[_0x2b0b('0x3d')](_0x42d82b[_0x2b0b('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x9d1398,null))[_0x2b0b('0x2a')](handleError(_0x9d1398,null));};exports[_0x2b0b('0x3e')]=function(_0xd1b515,_0x4e0304){var _0x2415dc={'raw':![],'where':{}};var _0x92eef3={};var _0xbc4399={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x2b0b('0x3f')]({'where':{'id':_0xd1b515[_0x2b0b('0x40')]['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x4e0304,null))['then'](function(_0x4c08a9){if(_0x4c08a9){_0x92eef3[_0x2b0b('0x2c')]=_[_0x2b0b('0x2d')](db[_0x2b0b('0x3c')][_0x2b0b('0x22')]);_0x92eef3[_0x2b0b('0x28')]=_[_0x2b0b('0x2d')](_0xd1b515[_0x2b0b('0x28')]);_0x92eef3[_0x2b0b('0x2e')]=_[_0x2b0b('0x2f')](_0x92eef3[_0x2b0b('0x2c')],_0x92eef3[_0x2b0b('0x28')]);_0x2415dc[_0x2b0b('0x30')]=_[_0x2b0b('0x2f')](_0x92eef3[_0x2b0b('0x2c')],qs[_0x2b0b('0x31')](_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x31')]));_0x2415dc['attributes']=_0x2415dc[_0x2b0b('0x30')][_0x2b0b('0x32')]?_0x2415dc[_0x2b0b('0x30')]:_0x92eef3[_0x2b0b('0x2c')];if(!_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x41')](_0x2b0b('0x42'))){_0x2415dc['limit']=qs[_0x2b0b('0x14')](_0xd1b515['query'][_0x2b0b('0x14')]);_0x2415dc[_0x2b0b('0x12')]=qs[_0x2b0b('0x12')](_0xd1b515[_0x2b0b('0x28')]['offset']);}_0x2415dc[_0x2b0b('0x43')]=qs[_0x2b0b('0x44')](_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x44')]);_0x2415dc['where']=qs[_0x2b0b('0x2e')](_['pick'](_0xd1b515[_0x2b0b('0x28')],_0x92eef3[_0x2b0b('0x2e')]));_0x2415dc['where'][_0x2b0b('0x45')]=_0x4c08a9['id'];if(_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x46')]){_0x2415dc['where']=_[_0x2b0b('0x35')](_0x2415dc[_0x2b0b('0x47')],{'$or':_[_0x2b0b('0x20')](_0x2415dc[_0x2b0b('0x30')],function(_0x737cc3){var _0x19675c={};_0x19675c[_0x737cc3]={'$like':'%'+_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x46')]+'%'};return _0x19675c;})});}if(_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x48')]){var _0x463152=_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x48')][_0x2b0b('0x49')](',');var _0x233b22={};_0x233b22[_0x463152[0x0]]={'$gte':moment(_0x463152[0x1])['format'](_0x2b0b('0x4a'))};_0x2415dc[_0x2b0b('0x47')]=_[_0x2b0b('0x35')](_0x2415dc['where'],_0x233b22);}_0x2415dc=_[_0x2b0b('0x35')]({},_0x2415dc,_0xd1b515[_0x2b0b('0x36')]);return db[_0x2b0b('0x3c')][_0x2b0b('0x15')]({'where':_0x2415dc['where']})[_0x2b0b('0x19')](function(_0x126fad){_0xbc4399[_0x2b0b('0x15')]=_0x126fad;if(_0xd1b515['query'][_0x2b0b('0x33')]){_0x2415dc[_0x2b0b('0x34')]=[{'all':!![]}];}return db['FaxMessage'][_0x2b0b('0x27')](_0x2415dc);})[_0x2b0b('0x19')](function(_0x428a84){_0xbc4399[_0x2b0b('0x4b')]=_0x428a84;return _0xbc4399;});}})['then'](respondWithFilteredResult(_0x4e0304,_0x2415dc))[_0x2b0b('0x2a')](handleError(_0x4e0304,null));};exports['addTags']=function(_0x80d3d7,_0x488b63){return db[_0x2b0b('0x21')]['find']({'where':{'id':_0x80d3d7['params']['id']}})['then'](handleEntityNotFound(_0x488b63,null))[_0x2b0b('0x19')](function(_0x4f0f54){if(_0x4f0f54){return _0x4f0f54['setTags'](_0x80d3d7['body']['ids'],_[_0x2b0b('0x3d')](_0x80d3d7[_0x2b0b('0x39')],[_0x2b0b('0x4c'),'id'])||{})['spread'](function(){return db[_0x2b0b('0x4d')][_0x2b0b('0x27')]({'attributes':['id',_0x2b0b('0x1d'),_0x2b0b('0x4e')],'where':{'id':_0x80d3d7[_0x2b0b('0x39')][_0x2b0b('0x4c')]}});})['then'](function(_0xc352a1){socket[_0x2b0b('0x4f')]('faxInteractionTags:save',{'id':Number(_0x80d3d7[_0x2b0b('0x40')]['id']),'tags':_0xc352a1||[]});return{'id':Number(_0x80d3d7[_0x2b0b('0x40')]['id']),'tags':_0xc352a1||[]};});}})['then'](respondWithResult(_0x488b63,null))[_0x2b0b('0x2a')](handleError(_0x488b63,null));};exports[_0x2b0b('0x50')]=function(_0x58d8e6,_0x37c1e8){return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0x58d8e6[_0x2b0b('0x40')]['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x37c1e8,null))[_0x2b0b('0x19')](function(_0x2461ee){if(_0x2461ee){return _0x2461ee[_0x2b0b('0x50')](_0x58d8e6[_0x2b0b('0x28')][_0x2b0b('0x4c')]);}})[_0x2b0b('0x19')](respondWithStatusCode(_0x37c1e8,null))['catch'](handleError(_0x37c1e8,null));};exports[_0x2b0b('0x51')]=function(_0x5841c5,_0x45f249){var _0x2b524f=moment()[_0x2b0b('0x52')]()[_0x2b0b('0x53')]();var _0x521bfe=path[_0x2b0b('0x54')](config[_0x2b0b('0x55')],_0x2b0b('0x56'),_0x2b0b('0x57'),_0x2b0b('0x58'));var _0x58c9c1=path['join'](config[_0x2b0b('0x55')],_0x2b0b('0x56'),_0x2b0b('0x57'),_0x2b0b('0x59'));var _0x5ff137=path[_0x2b0b('0x54')](_0x521bfe,_0x2b524f);var _0xfa9978=util[_0x2b0b('0x5a')](_0x2b0b('0x5b'),_0x5841c5['params']['id'],_0x2b524f);var _0x4aff60=path['join'](_0x521bfe,_0xfa9978);var _0xdf984c=[];_0xdf984c[_0x2b0b('0x5c')]({'model':db[_0x2b0b('0x5d')],'as':_0x2b0b('0x5d'),'raw':!![]});var _0x3c4d97=[{'model':db[_0x2b0b('0x3c')],'as':_0x2b0b('0x5e'),'attributes':['id',_0x2b0b('0x39'),'createdAt'],'include':_0xdf984c}];return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0x5841c5[_0x2b0b('0x40')]['id']},'include':_0x3c4d97})[_0x2b0b('0x19')](handleEntityNotFound(_0x45f249,null))[_0x2b0b('0x19')](function(_0x697b9d){if(_0x697b9d&&_0x697b9d[_0x2b0b('0x5e')]){var _0x357e1f=_0x697b9d[_0x2b0b('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x5ff137);for(var _0xe115ba=0x0;_0xe115ba<_0x357e1f[_0x2b0b('0x5e')][_0x2b0b('0x32')];_0xe115ba++){var _0x5ed980=_0x357e1f[_0x2b0b('0x5e')][_0xe115ba][_0x2b0b('0x5d')];if(_0x5ed980){var _0x3d7d8d=path[_0x2b0b('0x54')](_0x58c9c1,_0x5ed980[_0x2b0b('0x60')]);if(fs[_0x2b0b('0x61')](_0x3d7d8d)){fs[_0x2b0b('0x62')](_0x3d7d8d)[_0x2b0b('0x63')](fs[_0x2b0b('0x64')](path[_0x2b0b('0x54')](_0x5ff137,_0x5ed980[_0x2b0b('0x60')])));}}}return BPromise[_0x2b0b('0x65')]()[_0x2b0b('0x19')](function(){return new BPromise(function(_0x340745,_0x1f6514){zipdir(_0x5ff137,{'saveTo':_0x4aff60},function(_0xdfb28,_0x3e376c){if(_0xdfb28)return _0x1f6514(_0xdfb28);return _0x340745(_0x3e376c);});})[_0x2b0b('0x19')](function(){return new BPromise(function(_0x3bd9ff,_0x49f4d1){rimraf(_0x5ff137,function(_0x4cb61d){if(_0x4cb61d)_0x49f4d1(_0x4cb61d);return _0x3bd9ff();});});})[_0x2b0b('0x19')](function(){return _0x45f249['download'](_0x4aff60,_0xfa9978,function(_0x45861b){if(_0x45861b){console[_0x2b0b('0x66')]('err',_0x45861b);}else{fs[_0x2b0b('0x67')](_0x4aff60);}});});});}else{return _0x45f249['sendStatus'](0xc8);}})[_0x2b0b('0x2a')](handleError(_0x45f249,null));}; \ No newline at end of file +var _0xd084=['key','getOptions','fax','query','user','show','params','model','keys','intersection','fields','attributes','length','include','merge','find','catch','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','rawAttributes','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','findAll','rows','addTags','setTags','Tag','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','mkdirSync','basename','existsSync','pipe','resolve','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','map','FaxInteraction','fieldName','type'];(function(_0x3d230b,_0x28a714){var _0x278d0f=function(_0x31b221){while(--_0x31b221){_0x3d230b['push'](_0x3d230b['shift']());}};_0x278d0f(++_0x28a714);}(_0xd084,0xa8));var _0x4d08=function(_0x278d6d,_0x576f51){_0x278d6d=_0x278d6d-0x0;var _0x104369=_0xd084[_0x278d6d];return _0x104369;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4d08('0x0'));var moment=require(_0x4d08('0x1'));var BPromise=require('bluebird');var util=require(_0x4d08('0x2'));var path=require(_0x4d08('0x3'));var fs=require('fs');var _=require(_0x4d08('0x4'));var Redis=require(_0x4d08('0x5'));var interaction=require(_0x4d08('0x6'));var qs=require(_0x4d08('0x7'));var logger=require(_0x4d08('0x8'))(_0x4d08('0x9'));var config=require(_0x4d08('0xa'));var db=require('../../mysqldb')['db'];config[_0x4d08('0xb')]=_[_0x4d08('0xc')](config[_0x4d08('0xb')],{'host':_0x4d08('0xd'),'port':0x18eb});var socket=require(_0x4d08('0xe'))(new Redis(config[_0x4d08('0xb')]));require(_0x4d08('0xf'))[_0x4d08('0x10')](socket);function respondWithStatusCode(_0x48ede5,_0x4be87f){_0x4be87f=_0x4be87f||0xcc;return function(_0x3d27f6){if(_0x3d27f6){return _0x48ede5[_0x4d08('0x11')](_0x4be87f);}return _0x48ede5[_0x4d08('0x12')](_0x4be87f)[_0x4d08('0x13')]();};}function respondWithResult(_0x4ecb5b,_0x3230cb){_0x3230cb=_0x3230cb||0xc8;return function(_0x33eb0f){if(_0x33eb0f){return _0x4ecb5b['status'](_0x3230cb)[_0x4d08('0x14')](_0x33eb0f);}};}function respondWithFilteredResult(_0x10ff14,_0x9b40cd){return function(_0x5551e3){if(_0x5551e3){var _0x4d4319=typeof _0x9b40cd[_0x4d08('0x15')]===_0x4d08('0x16')&&typeof _0x9b40cd[_0x4d08('0x17')]==='undefined';var _0x50e579=_0x5551e3['count'];var _0x5a055e=_0x4d4319?0x0:_0x9b40cd[_0x4d08('0x15')];var _0x37fac3=_0x4d4319?_0x5551e3['count']:_0x9b40cd['offset']+_0x9b40cd[_0x4d08('0x17')];var _0x594d2f;if(_0x37fac3>=_0x50e579){_0x37fac3=_0x50e579;_0x594d2f=0xc8;}else{_0x594d2f=0xce;}_0x10ff14[_0x4d08('0x12')](_0x594d2f);return _0x10ff14[_0x4d08('0x18')](_0x4d08('0x19'),_0x5a055e+'-'+_0x37fac3+'/'+_0x50e579)[_0x4d08('0x14')](_0x5551e3);}return null;};}function saveUpdates(_0x339d46){return function(_0x11911b){if(_0x11911b){return _0x11911b[_0x4d08('0x1a')](_0x339d46)[_0x4d08('0x1b')](function(_0x2afa48){return _0x2afa48;});}return null;};}function removeEntity(_0x322753){return function(_0x5335b1){if(_0x5335b1){return _0x5335b1[_0x4d08('0x1c')]()[_0x4d08('0x1b')](function(){_0x322753['status'](0xcc)[_0x4d08('0x13')]();});}};}function handleEntityNotFound(_0x34fd2d){return function(_0x1f1ae5){if(!_0x1f1ae5){_0x34fd2d[_0x4d08('0x11')](0x194);}return _0x1f1ae5;};}function handleError(_0x16cefb,_0x2a9666){_0x2a9666=_0x2a9666||0x1f4;return function(_0x114794){logger[_0x4d08('0x1d')](_0x114794[_0x4d08('0x1e')]);if(_0x114794[_0x4d08('0x1f')]){delete _0x114794[_0x4d08('0x1f')];}_0x16cefb[_0x4d08('0x12')](_0x2a9666)['send'](_0x114794);};}exports['index']=function(_0x1ca88d,_0x4339bf){var _0x173548={};var _0x3759e9=_[_0x4d08('0x20')](db[_0x4d08('0x21')]['rawAttributes'],function(_0x2a458f){return{'name':_0x2a458f[_0x4d08('0x22')],'type':_0x2a458f[_0x4d08('0x23')][_0x4d08('0x24')]};});_0x173548=qs[_0x4d08('0x25')](_0x3759e9,_0x1ca88d);return interaction['findAll'](_0x4d08('0x26'),_0x1ca88d[_0x4d08('0x27')],_0x1ca88d[_0x4d08('0x28')],_0x173548,_0x3759e9)[_0x4d08('0x1b')](respondWithFilteredResult(_0x4339bf,_0x173548))['catch'](handleError(_0x4339bf,null));};exports[_0x4d08('0x29')]=function(_0x56fe4a,_0x30a30f){var _0x3446cc={'raw':![],'where':{'id':_0x56fe4a[_0x4d08('0x2a')]['id']}},_0x39f679={};_0x39f679[_0x4d08('0x2b')]=_[_0x4d08('0x2c')](db['FaxInteraction']['rawAttributes']);_0x39f679[_0x4d08('0x27')]=_[_0x4d08('0x2c')](_0x56fe4a['query']);_0x39f679['filters']=_[_0x4d08('0x2d')](_0x39f679[_0x4d08('0x2b')],_0x39f679[_0x4d08('0x27')]);_0x3446cc['attributes']=_['intersection'](_0x39f679[_0x4d08('0x2b')],qs[_0x4d08('0x2e')](_0x56fe4a[_0x4d08('0x27')][_0x4d08('0x2e')]));_0x3446cc[_0x4d08('0x2f')]=_0x3446cc['attributes'][_0x4d08('0x30')]?_0x3446cc[_0x4d08('0x2f')]:_0x39f679[_0x4d08('0x2b')];if(_0x56fe4a[_0x4d08('0x27')]['includeAll']){_0x3446cc[_0x4d08('0x31')]=[{'all':!![]}];}_0x3446cc=_[_0x4d08('0x32')]({},_0x3446cc,_0x56fe4a['options']);return db[_0x4d08('0x21')][_0x4d08('0x33')](_0x3446cc)[_0x4d08('0x1b')](handleEntityNotFound(_0x30a30f,null))[_0x4d08('0x1b')](respondWithResult(_0x30a30f,null))[_0x4d08('0x34')](handleError(_0x30a30f,null));};exports['create']=function(_0x202555,_0x5135c8){return db[_0x4d08('0x21')][_0x4d08('0x35')](_0x202555['body'],{})[_0x4d08('0x1b')](respondWithResult(_0x5135c8,0xc9))['catch'](handleError(_0x5135c8,null));};exports[_0x4d08('0x1a')]=function(_0x2908bd,_0x502007){if(_0x2908bd[_0x4d08('0x36')]['id']){delete _0x2908bd[_0x4d08('0x36')]['id'];}return db['FaxInteraction'][_0x4d08('0x33')]({'where':{'id':_0x2908bd['params']['id']}})[_0x4d08('0x1b')](handleEntityNotFound(_0x502007,null))[_0x4d08('0x1b')](saveUpdates(_0x2908bd['body'],null))[_0x4d08('0x1b')](respondWithResult(_0x502007,null))[_0x4d08('0x34')](handleError(_0x502007,null));};exports[_0x4d08('0x1c')]=function(_0xee6741,_0xd1bdd3){return db[_0x4d08('0x21')][_0x4d08('0x33')]({'where':{'id':_0xee6741[_0x4d08('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd1bdd3,null))[_0x4d08('0x1b')](removeEntity(_0xd1bdd3,null))[_0x4d08('0x34')](handleError(_0xd1bdd3,null));};exports[_0x4d08('0x37')]=function(_0x4fbb69,_0x3803f7){return db[_0x4d08('0x21')][_0x4d08('0x37')]()[_0x4d08('0x1b')](respondWithResult(_0x3803f7,null))[_0x4d08('0x34')](handleError(_0x3803f7,null));};exports[_0x4d08('0x38')]=function(_0x12e733,_0x2090b0){return db[_0x4d08('0x39')][_0x4d08('0x33')]({'where':{'id':_0x12e733['params']['id']}})['then'](handleEntityNotFound(_0x2090b0,null))['then'](function(_0x35d01b){if(_0x35d01b){return _0x35d01b[_0x4d08('0x38')](_0x12e733[_0x4d08('0x36')][_0x4d08('0x3a')],_[_0x4d08('0x3b')](_0x12e733['body'],[_0x4d08('0x3a'),'id'])||{});}})[_0x4d08('0x1b')](respondWithResult(_0x2090b0,null))[_0x4d08('0x34')](handleError(_0x2090b0,null));};exports[_0x4d08('0x3c')]=function(_0x1565cb,_0x441715){var _0x30077e={'raw':![],'where':{}};var _0x23b0df={};var _0x12601b={'count':0x0,'rows':[]};return db[_0x4d08('0x21')]['findOne']({'where':{'id':_0x1565cb['params']['id']}})[_0x4d08('0x1b')](handleEntityNotFound(_0x441715,null))[_0x4d08('0x1b')](function(_0x25cc12){if(_0x25cc12){_0x23b0df['model']=_[_0x4d08('0x2c')](db[_0x4d08('0x39')][_0x4d08('0x3d')]);_0x23b0df['query']=_[_0x4d08('0x2c')](_0x1565cb[_0x4d08('0x27')]);_0x23b0df['filters']=_[_0x4d08('0x2d')](_0x23b0df[_0x4d08('0x2b')],_0x23b0df[_0x4d08('0x27')]);_0x30077e['attributes']=_['intersection'](_0x23b0df[_0x4d08('0x2b')],qs[_0x4d08('0x2e')](_0x1565cb[_0x4d08('0x27')]['fields']));_0x30077e[_0x4d08('0x2f')]=_0x30077e['attributes'][_0x4d08('0x30')]?_0x30077e['attributes']:_0x23b0df[_0x4d08('0x2b')];if(!_0x1565cb[_0x4d08('0x27')]['hasOwnProperty'](_0x4d08('0x3e'))){_0x30077e[_0x4d08('0x17')]=qs[_0x4d08('0x17')](_0x1565cb[_0x4d08('0x27')][_0x4d08('0x17')]);_0x30077e[_0x4d08('0x15')]=qs['offset'](_0x1565cb[_0x4d08('0x27')][_0x4d08('0x15')]);}_0x30077e[_0x4d08('0x3f')]=qs[_0x4d08('0x40')](_0x1565cb[_0x4d08('0x27')][_0x4d08('0x40')]);_0x30077e[_0x4d08('0x41')]=qs[_0x4d08('0x42')](_[_0x4d08('0x43')](_0x1565cb[_0x4d08('0x27')],_0x23b0df[_0x4d08('0x42')]));_0x30077e[_0x4d08('0x41')][_0x4d08('0x44')]=_0x25cc12['id'];if(_0x1565cb[_0x4d08('0x27')][_0x4d08('0x45')]){_0x30077e[_0x4d08('0x41')]=_[_0x4d08('0x32')](_0x30077e[_0x4d08('0x41')],{'$or':_['map'](_0x30077e[_0x4d08('0x2f')],function(_0x35f184){var _0x5c9e03={};_0x5c9e03[_0x35f184]={'$like':'%'+_0x1565cb[_0x4d08('0x27')][_0x4d08('0x45')]+'%'};return _0x5c9e03;})});}if(_0x1565cb[_0x4d08('0x27')][_0x4d08('0x46')]){var _0x2848f7=_0x1565cb['query'][_0x4d08('0x46')]['split'](',');var _0xdaf347={};_0xdaf347[_0x2848f7[0x0]]={'$gte':moment(_0x2848f7[0x1])[_0x4d08('0x47')](_0x4d08('0x48'))};_0x30077e[_0x4d08('0x41')]=_[_0x4d08('0x32')](_0x30077e[_0x4d08('0x41')],_0xdaf347);}_0x30077e=_[_0x4d08('0x32')]({},_0x30077e,_0x1565cb['options']);return db[_0x4d08('0x39')]['count']({'where':_0x30077e[_0x4d08('0x41')]})[_0x4d08('0x1b')](function(_0x4b7bd1){_0x12601b[_0x4d08('0x49')]=_0x4b7bd1;if(_0x1565cb[_0x4d08('0x27')][_0x4d08('0x4a')]){_0x30077e[_0x4d08('0x31')]=[{'all':!![]}];}return db[_0x4d08('0x39')][_0x4d08('0x4b')](_0x30077e);})['then'](function(_0x1061f8){_0x12601b[_0x4d08('0x4c')]=_0x1061f8;return _0x12601b;});}})[_0x4d08('0x1b')](respondWithFilteredResult(_0x441715,_0x30077e))['catch'](handleError(_0x441715,null));};exports[_0x4d08('0x4d')]=function(_0x345cc4,_0x123ca3){return db[_0x4d08('0x21')][_0x4d08('0x33')]({'where':{'id':_0x345cc4[_0x4d08('0x2a')]['id']}})[_0x4d08('0x1b')](handleEntityNotFound(_0x123ca3,null))[_0x4d08('0x1b')](function(_0x2dcf9d){if(_0x2dcf9d){return _0x2dcf9d[_0x4d08('0x4e')](_0x345cc4['body']['ids'],_[_0x4d08('0x3b')](_0x345cc4['body'],['ids','id'])||{})['spread'](function(){return db[_0x4d08('0x4f')][_0x4d08('0x4b')]({'attributes':['id',_0x4d08('0x1f'),'color'],'where':{'id':_0x345cc4[_0x4d08('0x36')]['ids']}});})[_0x4d08('0x1b')](function(_0xa77a81){socket[_0x4d08('0x50')](_0x4d08('0x51'),{'id':Number(_0x345cc4[_0x4d08('0x2a')]['id']),'tags':_0xa77a81||[]});return{'id':Number(_0x345cc4[_0x4d08('0x2a')]['id']),'tags':_0xa77a81||[]};});}})[_0x4d08('0x1b')](respondWithResult(_0x123ca3,null))[_0x4d08('0x34')](handleError(_0x123ca3,null));};exports[_0x4d08('0x52')]=function(_0x6441bc,_0x1b8b4c){return db[_0x4d08('0x21')][_0x4d08('0x33')]({'where':{'id':_0x6441bc['params']['id']}})[_0x4d08('0x1b')](handleEntityNotFound(_0x1b8b4c,null))[_0x4d08('0x1b')](function(_0x50b3d1){if(_0x50b3d1){return _0x50b3d1['removeTags'](_0x6441bc['query'][_0x4d08('0x3a')]);}})['then'](respondWithStatusCode(_0x1b8b4c,null))[_0x4d08('0x34')](handleError(_0x1b8b4c,null));};exports[_0x4d08('0x53')]=function(_0x5d5886,_0x32f381){var _0x47cc81=moment()[_0x4d08('0x54')]()[_0x4d08('0x55')]();var _0x36aa6b=path['join'](config[_0x4d08('0x56')],_0x4d08('0x57'),_0x4d08('0x58'),'tmp');var _0x1b0fb4=path[_0x4d08('0x59')](config[_0x4d08('0x56')],'server','files',_0x4d08('0x5a'));var _0x12b9f3=path['join'](_0x36aa6b,_0x47cc81);var _0x50164f=util[_0x4d08('0x47')](_0x4d08('0x5b'),_0x5d5886['params']['id'],_0x47cc81);var _0x50bd67=path['join'](_0x36aa6b,_0x50164f);var _0x5bea7a=[];_0x5bea7a[_0x4d08('0x5c')]({'model':db['Attachment'],'as':_0x4d08('0x5d'),'raw':!![]});var _0x485d22=[{'model':db[_0x4d08('0x39')],'as':'Messages','attributes':['id','body',_0x4d08('0x5e')],'include':_0x5bea7a}];return db[_0x4d08('0x21')]['find']({'where':{'id':_0x5d5886[_0x4d08('0x2a')]['id']},'include':_0x485d22})[_0x4d08('0x1b')](handleEntityNotFound(_0x32f381,null))[_0x4d08('0x1b')](function(_0x1c6fc3){if(_0x1c6fc3&&_0x1c6fc3[_0x4d08('0x5f')]){var _0x134da6=_0x1c6fc3['get']({'plain':!![]});fs[_0x4d08('0x60')](_0x12b9f3);for(var _0x29d39f=0x0;_0x29d39f<_0x134da6[_0x4d08('0x5f')]['length'];_0x29d39f++){var _0x287e43=_0x134da6[_0x4d08('0x5f')][_0x29d39f][_0x4d08('0x5d')];if(_0x287e43){var _0x74595b=path[_0x4d08('0x59')](_0x1b0fb4,_0x287e43[_0x4d08('0x61')]);if(fs[_0x4d08('0x62')](_0x74595b)){fs['createReadStream'](_0x74595b)[_0x4d08('0x63')](fs['createWriteStream'](path[_0x4d08('0x59')](_0x12b9f3,_0x287e43[_0x4d08('0x61')])));}}}return BPromise[_0x4d08('0x64')]()[_0x4d08('0x1b')](function(){return new BPromise(function(_0x25683e,_0x1543bf){zipdir(_0x12b9f3,{'saveTo':_0x50bd67},function(_0x46257e,_0x274e75){if(_0x46257e)return _0x1543bf(_0x46257e);return _0x25683e(_0x274e75);});})[_0x4d08('0x1b')](function(){return new BPromise(function(_0x553c93,_0x14d100){rimraf(_0x12b9f3,function(_0x121360){if(_0x121360)_0x14d100(_0x121360);return _0x553c93();});});})['then'](function(){return _0x32f381[_0x4d08('0x53')](_0x50bd67,_0x50164f,function(_0x1c35cc){if(_0x1c35cc){console['log']('err',_0x1c35cc);}else{fs[_0x4d08('0x65')](_0x50bd67);}});});});}else{return _0x32f381[_0x4d08('0x11')](0xc8);}})[_0x4d08('0x34')](handleError(_0x32f381,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2a150cd..ea23c8d 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 _0x63c7=['catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','map','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x51f1ee,_0x241374){var _0x251e83=function(_0x35802d){while(--_0x35802d){_0x51f1ee['push'](_0x51f1ee['shift']());}};_0x251e83(++_0x241374);}(_0x63c7,0x74));var _0x763c=function(_0x3288a2,_0x4ac4be){_0x3288a2=_0x3288a2-0x0;var _0x319f4a=_0x63c7[_0x3288a2];return _0x319f4a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x763c('0x0'))['db'][_0x763c('0x1')];var FaxMessage=require(_0x763c('0x0'))['db'][_0x763c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x763c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x763c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13137b){return function(_0x5b2f3f,_0x5edd01,_0xd7cf96){_0x5b2f3f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5b1ac2){_0x5b2f3f['setDataValue']('Users',_0x5b1ac2[_0x763c('0x5')](function(_0x2300f7){return{'id':_0x2300f7['id']};}));return FaxMessage[_0x763c('0x6')]({'where':{'FaxInteractionId':_0x5b2f3f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x763c('0x7')](function(_0x43f7e0){_0x5b2f3f[_0x763c('0x8')](_0x763c('0x9'),_0x43f7e0[_0x763c('0xa')]);FaxInteractionEvents[_0x763c('0xb')](_0x13137b+':'+_0x5b2f3f['id'],_0x5b2f3f);FaxInteractionEvents['emit'](_0x13137b,_0x5b2f3f);_0xd7cf96(null);})[_0x763c('0xc')](_0xd7cf96(null));};}for(var e in events){if(events[_0x763c('0xd')](e)){var event=events[e];FaxInteraction[_0x763c('0xe')](e,emitEvent(event));}}module[_0x763c('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x2daf=['length','emit','catch','hook','exports','events','FaxInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x489e14,_0x3ba298){var _0x10cb9c=function(_0x49c87d){while(--_0x49c87d){_0x489e14['push'](_0x489e14['shift']());}};_0x10cb9c(++_0x3ba298);}(_0x2daf,0xd5));var _0xf2da=function(_0x2db055,_0x5bde11){_0x2db055=_0x2db055-0x0;var _0xb2f3a4=_0x2daf[_0x2db055];return _0xb2f3a4;};'use strict';var EventEmitter=require(_0xf2da('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xf2da('0x1')];var FaxMessage=require(_0xf2da('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf2da('0x3')](0x0);var events={'afterCreate':_0xf2da('0x4'),'afterUpdate':_0xf2da('0x5'),'afterDestroy':_0xf2da('0x6')};function emitEvent(_0x312899){return function(_0xc9f359,_0x2f8c19,_0x4996e9){_0xc9f359[_0xf2da('0x7')]({'attributes':['id'],'raw':!![]})[_0xf2da('0x8')](function(_0x3200cf){_0xc9f359[_0xf2da('0x9')](_0xf2da('0xa'),_0x3200cf['map'](function(_0x2df847){return{'id':_0x2df847['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xc9f359['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf2da('0x8')](function(_0x32f8a0){_0xc9f359['setDataValue']('unreadMessages',_0x32f8a0[_0xf2da('0xb')]);FaxInteractionEvents[_0xf2da('0xc')](_0x312899+':'+_0xc9f359['id'],_0xc9f359);FaxInteractionEvents['emit'](_0x312899,_0xc9f359);_0x4996e9(null);})[_0xf2da('0xd')](_0x4996e9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xf2da('0xe')](e,emitEvent(event));}}module[_0xf2da('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b8a61ad..df1dbab 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 _0x3b13=['changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','fax_interactions'];(function(_0x3c26d6,_0x2f8190){var _0x48e3b2=function(_0x57d283){while(--_0x57d283){_0x3c26d6['push'](_0x3c26d6['shift']());}};_0x48e3b2(++_0x2f8190);}(_0x3b13,0x189));var _0x33b1=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x3b13[_0x8a0140];return _0x1be8a8;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var logger=require(_0x33b1('0x2'))(_0x33b1('0x3'));var moment=require(_0x33b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x33b1('0x5'));var fs=require('fs');var path=require(_0x33b1('0x6'));var rimraf=require(_0x33b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x33b1('0x8'));module[_0x33b1('0x9')]=function(_0x5d837c,_0x3a8972){return _0x5d837c[_0x33b1('0xa')]('FaxInteraction',attributes,{'tableName':_0x33b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33e010,_0x1fb561,_0x5d8781){if(_0x33e010[_0x33b1('0xc')]('closed')){_0x33e010['closedAt']=moment()[_0x33b1('0xd')](_0x33b1('0xe'));}_0x5d8781(null,_0x33e010);}}});}; \ No newline at end of file +var _0xd82c=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./faxInteraction.attributes','define','FaxInteraction'];(function(_0x321e0d,_0x2c4375){var _0x157be5=function(_0x51d449){while(--_0x51d449){_0x321e0d['push'](_0x321e0d['shift']());}};_0x157be5(++_0x2c4375);}(_0xd82c,0x66));var _0xcd82=function(_0xb6da90,_0x397938){_0xb6da90=_0xb6da90-0x0;var _0x591ad0=_0xd82c[_0xb6da90];return _0x591ad0;};'use strict';var _=require(_0xcd82('0x0'));var util=require(_0xcd82('0x1'));var logger=require(_0xcd82('0x2'))('api');var moment=require(_0xcd82('0x3'));var BPromise=require(_0xcd82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd82('0x5'));var rimraf=require(_0xcd82('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd82('0x7'));module['exports']=function(_0x5d10c7,_0x12dddc){return _0x5d10c7[_0xcd82('0x8')](_0xcd82('0x9'),attributes,{'tableName':_0xcd82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b4336,_0x152513,_0x3cbd5c){if(_0x3b4336[_0xcd82('0xb')](_0xcd82('0xc'))){_0x3b4336[_0xcd82('0xd')]=moment()[_0xcd82('0xe')](_0xcd82('0xf'));}_0x3cbd5c(null,_0x3b4336);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dbf0a48..1995b09 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 _0xdb2a=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','UpdateFaxInteraction','update','body','options','where','attributes','limit','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15f897,_0x12eaf0){var _0x25489b=function(_0x32d52e){while(--_0x32d52e){_0x15f897['push'](_0x15f897['shift']());}};_0x25489b(++_0x12eaf0);}(_0xdb2a,0x17f));var _0xadb2=function(_0x3e5cf3,_0x310e7c){_0x3e5cf3=_0x3e5cf3-0x0;var _0x40fac7=_0xdb2a[_0x3e5cf3];return _0x40fac7;};'use strict';var _=require('lodash');var util=require(_0xadb2('0x0'));var moment=require(_0xadb2('0x1'));var BPromise=require(_0xadb2('0x2'));var rs=require(_0xadb2('0x3'));var fs=require('fs');var Redis=require(_0xadb2('0x4'));var db=require(_0xadb2('0x5'))['db'];var utils=require(_0xadb2('0x6'));var logger=require(_0xadb2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadb2('0x8'));var client=jayson[_0xadb2('0x9')][_0xadb2('0xa')]({'port':0x232a});config[_0xadb2('0xb')]=_[_0xadb2('0xc')](config['redis'],{'host':_0xadb2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadb2('0xb')]));require('./faxInteraction.socket')[_0xadb2('0xe')](socket);function respondWithRpcPromise(_0x55ea84,_0x18e062,_0x11649f){return new BPromise(function(_0xcefc4,_0x3d201e){return client['request'](_0x55ea84,_0x11649f)[_0xadb2('0xf')](function(_0x212a99){logger[_0xadb2('0x10')](_0xadb2('0x11'),_0x18e062,_0xadb2('0x12'));logger[_0xadb2('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x18e062,'request\x20sent',JSON[_0xadb2('0x14')](_0x212a99));if(_0x212a99['error']){if(_0x212a99[_0xadb2('0x15')]['code']===0x1f4){logger['error'](_0xadb2('0x11'),_0x18e062,_0x212a99['error'][_0xadb2('0x16')]);return _0x3d201e(_0x212a99[_0xadb2('0x15')][_0xadb2('0x16')]);}logger[_0xadb2('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x18e062,_0x212a99['error'][_0xadb2('0x16')]);return _0xcefc4(_0x212a99[_0xadb2('0x15')][_0xadb2('0x16')]);}else{logger[_0xadb2('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x18e062,_0xadb2('0x12'));_0xcefc4(_0x212a99['result'][_0xadb2('0x16')]);}})['catch'](function(_0x5c282e){logger['error'](_0xadb2('0x11'),_0x18e062,_0x5c282e);_0x3d201e(_0x5c282e);});});}exports[_0xadb2('0x17')]=function(_0x4e2fed){var _0x166f6a=this;return new Promise(function(_0x5b950f,_0x5487b1){return db['FaxInteraction'][_0xadb2('0x18')](_0x4e2fed[_0xadb2('0x19')],{'raw':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')][_0xadb2('0x1b')]||null:null,'attributes':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed['options'][_0xadb2('0x1c')]||null:null,'limit':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')][_0xadb2('0x1d')]||null:null})['then'](function(_0x5d89b2){logger[_0xadb2('0x10')](_0xadb2('0x17'),_0x4e2fed);logger[_0xadb2('0x13')](_0xadb2('0x17'),_0x4e2fed,JSON[_0xadb2('0x14')](_0x5d89b2));_0x5b950f(_0x5d89b2);})[_0xadb2('0x1e')](function(_0xac2f28){logger[_0xadb2('0x15')]('UpdateFaxInteraction',_0xac2f28[_0xadb2('0x16')],_0x4e2fed);_0x5487b1(_0x166f6a['error'](0x1f4,_0xac2f28[_0xadb2('0x16')]));});});};exports[_0xadb2('0x1f')]=function(_0x347935){return new Promise(function(_0x39fbf5,_0x4aede5){return db[_0xadb2('0x20')][_0xadb2('0x21')]({'where':_0x347935[_0xadb2('0x1a')]?_0x347935[_0xadb2('0x1a')][_0xadb2('0x1b')]||null:null})[_0xadb2('0xf')](function(_0x4b7b8a){if(_0x4b7b8a){return _0x4b7b8a[_0xadb2('0x22')](_0x347935[_0xadb2('0x19')]['ids'],_[_0xadb2('0x23')](_0x347935['body'],[_0xadb2('0x24'),'id'])||{});}})[_0xadb2('0x25')](function(_0xc8c6f1){logger[_0xadb2('0x10')](_0xadb2('0x26'),_0x347935);logger[_0xadb2('0x13')]('AddTags',_0x347935,JSON[_0xadb2('0x14')](_0xc8c6f1));_0x39fbf5(_0xc8c6f1);})['catch'](function(_0x817ad9){logger[_0xadb2('0x15')](_0xadb2('0x26'),_0x817ad9[_0xadb2('0x16')],_0x347935);_0x4aede5(_this[_0xadb2('0x15')](0x1f4,_0x817ad9[_0xadb2('0x16')]));});});}; \ No newline at end of file +var _0xe8f3=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0xe8f3,0x118));var _0x3e8f=function(_0x5e804f,_0xd2ba4){_0x5e804f=_0x5e804f-0x0;var _0x215ac2=_0xe8f3[_0x5e804f];return _0x215ac2;};'use strict';var _=require(_0x3e8f('0x0'));var util=require(_0x3e8f('0x1'));var moment=require(_0x3e8f('0x2'));var BPromise=require(_0x3e8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e8f('0x4'))['db'];var utils=require(_0x3e8f('0x5'));var logger=require(_0x3e8f('0x6'))(_0x3e8f('0x7'));var config=require(_0x3e8f('0x8'));var jayson=require(_0x3e8f('0x9'));var client=jayson[_0x3e8f('0xa')][_0x3e8f('0xb')]({'port':0x232a});config[_0x3e8f('0xc')]=_[_0x3e8f('0xd')](config[_0x3e8f('0xc')],{'host':_0x3e8f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e8f('0xf'))[_0x3e8f('0x10')](socket);function respondWithRpcPromise(_0x3031fe,_0x2ba188,_0x3d6593){return new BPromise(function(_0x4fa637,_0x538fc2){return client[_0x3e8f('0x11')](_0x3031fe,_0x3d6593)[_0x3e8f('0x12')](function(_0x3cd3eb){logger[_0x3e8f('0x13')](_0x3e8f('0x14'),_0x2ba188,_0x3e8f('0x15'));logger[_0x3e8f('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2ba188,_0x3e8f('0x15'),JSON[_0x3e8f('0x17')](_0x3cd3eb));if(_0x3cd3eb[_0x3e8f('0x18')]){if(_0x3cd3eb['error'][_0x3e8f('0x19')]===0x1f4){logger[_0x3e8f('0x18')](_0x3e8f('0x14'),_0x2ba188,_0x3cd3eb[_0x3e8f('0x18')][_0x3e8f('0x1a')]);return _0x538fc2(_0x3cd3eb[_0x3e8f('0x18')][_0x3e8f('0x1a')]);}logger['error'](_0x3e8f('0x14'),_0x2ba188,_0x3cd3eb[_0x3e8f('0x18')][_0x3e8f('0x1a')]);return _0x4fa637(_0x3cd3eb[_0x3e8f('0x18')][_0x3e8f('0x1a')]);}else{logger[_0x3e8f('0x13')](_0x3e8f('0x14'),_0x2ba188,_0x3e8f('0x15'));_0x4fa637(_0x3cd3eb[_0x3e8f('0x1b')]['message']);}})[_0x3e8f('0x1c')](function(_0x7a7e87){logger[_0x3e8f('0x18')](_0x3e8f('0x14'),_0x2ba188,_0x7a7e87);_0x538fc2(_0x7a7e87);});});}exports[_0x3e8f('0x1d')]=function(_0x5c29b0){var _0x1e7210=this;return new Promise(function(_0x5802ff,_0x2b8b94){return db[_0x3e8f('0x1e')][_0x3e8f('0x1f')](_0x5c29b0[_0x3e8f('0x20')],{'raw':_0x5c29b0[_0x3e8f('0x21')]?_0x5c29b0[_0x3e8f('0x21')][_0x3e8f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c29b0['options']?_0x5c29b0[_0x3e8f('0x21')][_0x3e8f('0x23')]||null:null,'attributes':_0x5c29b0[_0x3e8f('0x21')]?_0x5c29b0[_0x3e8f('0x21')]['attributes']||null:null,'limit':_0x5c29b0[_0x3e8f('0x21')]?_0x5c29b0[_0x3e8f('0x21')][_0x3e8f('0x24')]||null:null})['then'](function(_0x156799){logger[_0x3e8f('0x13')]('UpdateFaxInteraction',_0x5c29b0);logger['debug'](_0x3e8f('0x1d'),_0x5c29b0,JSON[_0x3e8f('0x17')](_0x156799));_0x5802ff(_0x156799);})[_0x3e8f('0x1c')](function(_0x3fb3bf){logger[_0x3e8f('0x18')](_0x3e8f('0x1d'),_0x3fb3bf[_0x3e8f('0x1a')],_0x5c29b0);_0x2b8b94(_0x1e7210[_0x3e8f('0x18')](0x1f4,_0x3fb3bf[_0x3e8f('0x1a')]));});});};exports[_0x3e8f('0x25')]=function(_0xa7b058){return new Promise(function(_0x561301,_0x3adcc8){return db[_0x3e8f('0x1e')][_0x3e8f('0x26')]({'where':_0xa7b058[_0x3e8f('0x21')]?_0xa7b058['options'][_0x3e8f('0x23')]||null:null})['then'](function(_0x4d8ffd){if(_0x4d8ffd){return _0x4d8ffd[_0x3e8f('0x27')](_0xa7b058[_0x3e8f('0x20')][_0x3e8f('0x28')],_[_0x3e8f('0x29')](_0xa7b058[_0x3e8f('0x20')],[_0x3e8f('0x28'),'id'])||{});}})[_0x3e8f('0x2a')](function(_0x53b9a8){logger['info'](_0x3e8f('0x2b'),_0xa7b058);logger['debug'](_0x3e8f('0x2b'),_0xa7b058,JSON['stringify'](_0x53b9a8));_0x561301(_0x53b9a8);})[_0x3e8f('0x1c')](function(_0x39b414){logger[_0x3e8f('0x18')]('AddTags',_0x39b414[_0x3e8f('0x1a')],_0xa7b058);_0x3adcc8(_this[_0x3e8f('0x18')](0x1f4,_0x39b414[_0x3e8f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d74b4ec..c28fb93 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 _0x1e54=['faxInteraction:','./faxInteraction.events','update','emit','removeListener','register','length'];(function(_0x64389c,_0x3dbc8e){var _0x2add7f=function(_0x5e3a97){while(--_0x5e3a97){_0x64389c['push'](_0x64389c['shift']());}};_0x2add7f(++_0x3dbc8e);}(_0x1e54,0x1c8));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x41e5('0x0'));var events=['save','remove',_0x41e5('0x1')];function createListener(_0x9ed386,_0x4f2832){return function(_0x450206){_0x4f2832[_0x41e5('0x2')](_0x9ed386,_0x450206);};}function removeListener(_0x59e875,_0xe47560){return function(){FaxInteractionEvents[_0x41e5('0x3')](_0x59e875,_0xe47560);};}exports[_0x41e5('0x4')]=function(_0x5089f2){for(var _0x467e7b=0x0,_0x50b50e=events[_0x41e5('0x5')];_0x467e7b<_0x50b50e;_0x467e7b++){var _0x144fb0=events[_0x467e7b];var _0x45ede7=createListener(_0x41e5('0x6')+_0x144fb0,_0x5089f2);FaxInteractionEvents['on'](_0x144fb0,_0x45ede7);}}; \ No newline at end of file +var _0x7a32=['register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x20e2d7,_0x150650){var _0x1806a1=function(_0x49a598){while(--_0x49a598){_0x20e2d7['push'](_0x20e2d7['shift']());}};_0x1806a1(++_0x150650);}(_0x7a32,0xe3));var _0x27a3=function(_0x5a5080,_0x125db5){_0x5a5080=_0x5a5080-0x0;var _0x573ec9=_0x7a32[_0x5a5080];return _0x573ec9;};'use strict';var FaxInteractionEvents=require(_0x27a3('0x0'));var events=[_0x27a3('0x1'),'remove',_0x27a3('0x2')];function createListener(_0x29939e,_0x177d8b){return function(_0x3cc9b8){_0x177d8b[_0x27a3('0x3')](_0x29939e,_0x3cc9b8);};}function removeListener(_0x3e3505,_0x929b8d){return function(){FaxInteractionEvents['removeListener'](_0x3e3505,_0x929b8d);};}exports[_0x27a3('0x4')]=function(_0x1ee295){for(var _0x291dd7=0x0,_0x2fe114=events[_0x27a3('0x5')];_0x291dd7<_0x2fe114;_0x291dd7++){var _0xc12d31=events[_0x291dd7];var _0x5ba572=createListener(_0x27a3('0x6')+_0xc12d31,_0x1ee295);FaxInteractionEvents['on'](_0xc12d31,_0x5ba572);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1ea206b..b18157d 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 _0xf186=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/tags','tracked','fax','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf186,0xea));var _0x6f18=function(_0x1b995e,_0x206b36){_0x1b995e=_0x1b995e-0x0;var _0x382407=_0xf186[_0x1b995e];return _0x382407;};'use strict';var multer=require(_0x6f18('0x0'));var util=require(_0x6f18('0x1'));var path=require(_0x6f18('0x2'));var timeout=require(_0x6f18('0x3'));var express=require(_0x6f18('0x4'));var router=express[_0x6f18('0x5')]();var fs_extra=require(_0x6f18('0x6'));var auth=require(_0x6f18('0x7'));var interaction=require(_0x6f18('0x8'));var config=require(_0x6f18('0x9'));var controller=require('./faxInteraction.controller');router[_0x6f18('0xa')]('/',auth[_0x6f18('0xb')](),controller[_0x6f18('0xc')]);router[_0x6f18('0xa')](_0x6f18('0xd'),auth['isAuthenticated'](),controller[_0x6f18('0xe')]);router['get'](_0x6f18('0xf'),auth['isAuthenticated'](),controller[_0x6f18('0x10')]);router[_0x6f18('0xa')]('/:id/messages',auth[_0x6f18('0xb')](),controller['getMessages']);router[_0x6f18('0xa')](_0x6f18('0x11'),auth[_0x6f18('0xb')](),controller[_0x6f18('0x12')]);router[_0x6f18('0x13')]('/',auth[_0x6f18('0xb')](),controller[_0x6f18('0x14')]);router['post']('/:id/messages',auth[_0x6f18('0xb')](),controller['addMessage']);router['post'](_0x6f18('0x15'),auth[_0x6f18('0xb')](),interaction[_0x6f18('0x16')](_0x6f18('0x17'),'faxinteraction:addtags'),controller[_0x6f18('0x18')]);router['put'](_0x6f18('0xf'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x6f18('0x19')),controller[_0x6f18('0x1a')]);router[_0x6f18('0x1b')](_0x6f18('0xf'),auth['isAuthenticated'](),interaction[_0x6f18('0x16')](_0x6f18('0x17'),_0x6f18('0x1c')),controller['destroy']);router[_0x6f18('0x1b')](_0x6f18('0x15'),auth['isAuthenticated'](),controller[_0x6f18('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x05de=['addMessage','fax','faxinteraction:addtags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','/describe','describe','/:id','get','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x50f641,_0x110357){var _0x4ee4e4=function(_0x3b176e){while(--_0x3b176e){_0x50f641['push'](_0x50f641['shift']());}};_0x4ee4e4(++_0x110357);}(_0x05de,0x135));var _0xe05d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x05de[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe05d('0x0'));var util=require(_0xe05d('0x1'));var path=require(_0xe05d('0x2'));var timeout=require(_0xe05d('0x3'));var express=require(_0xe05d('0x4'));var router=express[_0xe05d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe05d('0x6'));var interaction=require(_0xe05d('0x7'));var config=require(_0xe05d('0x8'));var controller=require(_0xe05d('0x9'));router['get']('/',auth[_0xe05d('0xa')](),controller['index']);router['get'](_0xe05d('0xb'),auth[_0xe05d('0xa')](),controller[_0xe05d('0xc')]);router['get'](_0xe05d('0xd'),auth[_0xe05d('0xa')](),controller['show']);router[_0xe05d('0xe')](_0xe05d('0xf'),auth[_0xe05d('0xa')](),controller[_0xe05d('0x10')]);router[_0xe05d('0xe')](_0xe05d('0x11'),auth['isAuthenticated'](),controller[_0xe05d('0x12')]);router[_0xe05d('0x13')]('/',auth['isAuthenticated'](),controller[_0xe05d('0x14')]);router[_0xe05d('0x13')](_0xe05d('0xf'),auth[_0xe05d('0xa')](),controller[_0xe05d('0x15')]);router['post']('/:id/tags',auth[_0xe05d('0xa')](),interaction['tracked'](_0xe05d('0x16'),_0xe05d('0x17')),controller['addTags']);router['put'](_0xe05d('0xd'),auth['isAuthenticated'](),interaction[_0xe05d('0x18')](_0xe05d('0x16'),_0xe05d('0x19')),controller[_0xe05d('0x1a')]);router[_0xe05d('0x1b')](_0xe05d('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe05d('0x16'),_0xe05d('0x1c')),controller[_0xe05d('0x1d')]);router[_0xe05d('0x1b')](_0xe05d('0x1e'),auth[_0xe05d('0xa')](),controller[_0xe05d('0x1f')]);module[_0xe05d('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 1b5bc76..31b57dc 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 _0x34e5=['BOOLEAN','ENUM','out','DATE','exports','medium'];(function(_0xac21df,_0x4f3ba2){var _0x1faa60=function(_0x591aa7){while(--_0x591aa7){_0xac21df['push'](_0xac21df['shift']());}};_0x1faa60(++_0x4f3ba2);}(_0x34e5,0x172));var _0x534e=function(_0x16c2a8,_0x12cebd){_0x16c2a8=_0x16c2a8-0x0;var _0x4f45f4=_0x34e5[_0x16c2a8];return _0x4f45f4;};'use strict';var Sequelize=require('sequelize');module[_0x534e('0x0')]={'body':{'type':Sequelize['TEXT'](_0x534e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x534e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x534e('0x3')]('in',_0x534e('0x4')),'defaultValue':_0x534e('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x534e('0x5')]}}; \ No newline at end of file +var _0x644a=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x40672d,_0x316df5){var _0x731e51=function(_0x103e27){while(--_0x103e27){_0x40672d['push'](_0x40672d['shift']());}};_0x731e51(++_0x316df5);}(_0x644a,0xfd));var _0xa644=function(_0x34145e,_0x689e31){_0x34145e=_0x34145e-0x0;var _0x27ed04=_0x644a[_0x34145e];return _0x27ed04;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 84029d6..d2e5d9e 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 _0x1758=['AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','FaxMessage','options','find','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','agent','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','motionChannel','event','rejectmessage','create','CmContact','findOne','fax','Attachment'];(function(_0x23a7e7,_0x2f8f30){var _0x30a210=function(_0x48594c){while(--_0x48594c){_0x23a7e7['push'](_0x23a7e7['shift']());}};_0x30a210(++_0x2f8f30);}(_0x1758,0x1a2));var _0x8175=function(_0x29baf8,_0x3af357){_0x29baf8=_0x29baf8-0x0;var _0x37a6fa=_0x1758[_0x29baf8];return _0x37a6fa;};'use strict';var emlformat=require(_0x8175('0x0'));var rimraf=require(_0x8175('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8175('0x2'));var rp=require(_0x8175('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8175('0x4'));var sox=require(_0x8175('0x5'));var csv=require(_0x8175('0x6'));var ejs=require(_0x8175('0x7'));var fs=require('fs');var fs_extra=require(_0x8175('0x8'));var _=require(_0x8175('0x9'));var squel=require('squel');var crypto=require(_0x8175('0xa'));var jsforce=require(_0x8175('0xb'));var deskjs=require(_0x8175('0xc'));var toCsv=require(_0x8175('0x6'));var querystring=require(_0x8175('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8175('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8175('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8175('0x10'))(_0x8175('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8175('0x12'))['db'];config['redis']=_['defaults'](config[_0x8175('0x13')],{'host':_0x8175('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8175('0x13')]));require(_0x8175('0x15'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8175('0x16')][_0x8175('0x17')]({'port':0x232c});var client9002=jayson[_0x8175('0x16')][_0x8175('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1aec9c,_0x143ea7,_0x2240e4,_0x24d0ae){return new BPromise(function(_0x149a7c,_0x1707b6){var _0x1a3a7f=_0x24d0ae||client;return _0x1a3a7f[_0x8175('0x18')](_0x1aec9c,_0x2240e4)[_0x8175('0x19')](function(_0x28bfea){logger[_0x8175('0x1a')](_0x8175('0x1b'),_0x143ea7,_0x8175('0x1c'));logger['debug'](_0x8175('0x1d'),_0x143ea7,_0x8175('0x1c'),JSON[_0x8175('0x1e')](_0x28bfea));if(_0x28bfea['error']){if(_0x28bfea[_0x8175('0x1f')][_0x8175('0x20')]===0x1f4){logger[_0x8175('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x143ea7,_0x28bfea[_0x8175('0x1f')][_0x8175('0x21')]);return _0x1707b6(_0x28bfea[_0x8175('0x1f')][_0x8175('0x21')]);}logger['error'](_0x8175('0x1b'),_0x143ea7,_0x28bfea[_0x8175('0x1f')]['message']);return _0x149a7c(_0x28bfea['error'][_0x8175('0x21')]);}else{logger[_0x8175('0x1a')](_0x8175('0x1b'),_0x143ea7,_0x8175('0x1c'));_0x149a7c(_0x28bfea[_0x8175('0x22')][_0x8175('0x21')]);}})[_0x8175('0x23')](function(_0x2bbc61){logger[_0x8175('0x1f')](_0x8175('0x1b'),_0x143ea7,_0x2bbc61);_0x1707b6(_0x2bbc61);});});}function respondWithStatusCode(_0x45c5cd,_0x23a6f1){_0x23a6f1=_0x23a6f1||0xcc;return function(_0x3bd9bc){if(_0x3bd9bc){return _0x45c5cd[_0x8175('0x24')](_0x23a6f1);}return _0x45c5cd[_0x8175('0x25')](_0x23a6f1)[_0x8175('0x26')]();};}function respondWithResult(_0x6170f5,_0x50e380){_0x50e380=_0x50e380||0xc8;return function(_0x42c893){if(_0x42c893){return _0x6170f5[_0x8175('0x25')](_0x50e380)[_0x8175('0x27')](_0x42c893);}};}function respondWithFilteredResult(_0xc7f1fc,_0x5ca046){return function(_0x59da54){if(_0x59da54){var _0x8b2c79=typeof _0x5ca046[_0x8175('0x28')]===_0x8175('0x29')&&typeof _0x5ca046[_0x8175('0x2a')]===_0x8175('0x29');var _0x9918c0=_0x59da54[_0x8175('0x2b')];var _0x1fe94a=_0x8b2c79?0x0:_0x5ca046['offset'];var _0x22ad29=_0x8b2c79?_0x59da54[_0x8175('0x2b')]:_0x5ca046[_0x8175('0x28')]+_0x5ca046[_0x8175('0x2a')];var _0x22caf0;if(_0x22ad29>=_0x9918c0){_0x22ad29=_0x9918c0;_0x22caf0=0xc8;}else{_0x22caf0=0xce;}_0xc7f1fc[_0x8175('0x25')](_0x22caf0);return _0xc7f1fc[_0x8175('0x2c')](_0x8175('0x2d'),_0x1fe94a+'-'+_0x22ad29+'/'+_0x9918c0)[_0x8175('0x27')](_0x59da54);}return null;};}function patchUpdates(_0x1c75ae){return function(_0x3c08e2){try{jsonpatch[_0x8175('0x2e')](_0x3c08e2,_0x1c75ae,!![]);}catch(_0x296a59){return BPromise[_0x8175('0x2f')](_0x296a59);}return _0x3c08e2[_0x8175('0x30')]();};}function saveUpdates(_0x27a5de,_0x591f1d){return function(_0x1b3371){if(_0x1b3371){return _0x1b3371[_0x8175('0x31')](_0x27a5de)[_0x8175('0x19')](function(_0x5e6a7d){return _0x5e6a7d;});}return null;};}function removeEntity(_0x162d9d,_0x1b541b){return function(_0x349d83){if(_0x349d83){return _0x349d83[_0x8175('0x32')]()[_0x8175('0x19')](function(){_0x162d9d[_0x8175('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x537e94,_0x34db6e){return function(_0x49bb7f){if(!_0x49bb7f){_0x537e94['sendStatus'](0x194);}return _0x49bb7f;};}function handleError(_0x41c01e,_0x34e8d3){_0x34e8d3=_0x34e8d3||0x1f4;return function(_0x5d63e7){logger[_0x8175('0x1f')](_0x5d63e7[_0x8175('0x33')]);if(_0x5d63e7[_0x8175('0x34')]){delete _0x5d63e7[_0x8175('0x34')];}_0x41c01e['status'](_0x34e8d3)[_0x8175('0x35')](_0x5d63e7);};}exports[_0x8175('0x36')]=function(_0x2b7197,_0x2e05df){var _0x292efe={},_0x323bad={},_0xc089c2={'count':0x0,'rows':[]};var _0x38ea43=_['map'](db['FaxMessage'][_0x8175('0x37')],function(_0x2dec02){return{'name':_0x2dec02['fieldName'],'type':_0x2dec02[_0x8175('0x38')][_0x8175('0x39')]};});_0x323bad[_0x8175('0x3a')]=_[_0x8175('0x3b')](_0x38ea43,_0x8175('0x34'));_0x323bad['query']=_[_0x8175('0x3c')](_0x2b7197[_0x8175('0x3d')]);_0x323bad[_0x8175('0x3e')]=_[_0x8175('0x3f')](_0x323bad[_0x8175('0x3a')],_0x323bad[_0x8175('0x3d')]);_0x292efe[_0x8175('0x40')]=_[_0x8175('0x3f')](_0x323bad['model'],qs[_0x8175('0x41')](_0x2b7197['query'][_0x8175('0x41')]));_0x292efe[_0x8175('0x40')]=_0x292efe[_0x8175('0x40')][_0x8175('0x42')]?_0x292efe[_0x8175('0x40')]:_0x323bad[_0x8175('0x3a')];if(!_0x2b7197[_0x8175('0x3d')][_0x8175('0x43')](_0x8175('0x44'))){_0x292efe['limit']=qs[_0x8175('0x2a')](_0x2b7197[_0x8175('0x3d')][_0x8175('0x2a')]);_0x292efe[_0x8175('0x28')]=qs['offset'](_0x2b7197['query'][_0x8175('0x28')]);}_0x292efe['order']=qs[_0x8175('0x45')](_0x2b7197[_0x8175('0x3d')][_0x8175('0x45')]);_0x292efe[_0x8175('0x46')]=qs[_0x8175('0x3e')](_[_0x8175('0x47')](_0x2b7197[_0x8175('0x3d')],_0x323bad[_0x8175('0x3e')]),_0x38ea43);if(_0x2b7197['query'][_0x8175('0x48')]){_0x292efe[_0x8175('0x46')]=_[_0x8175('0x49')](_0x292efe[_0x8175('0x46')],{'$or':_[_0x8175('0x3b')](_0x38ea43,function(_0x3c0630){if(_0x3c0630[_0x8175('0x38')]!==_0x8175('0x4a')){var _0x2fbd16={};_0x2fbd16[_0x3c0630[_0x8175('0x34')]]={'$like':'%'+_0x2b7197['query'][_0x8175('0x48')]+'%'};return _0x2fbd16;}})});}_0x292efe=_[_0x8175('0x49')]({},_0x292efe,_0x2b7197['options']);var _0x52790f={'where':_0x292efe[_0x8175('0x46')]};return db['FaxMessage']['count'](_0x52790f)[_0x8175('0x19')](function(_0x3cac9c){_0xc089c2[_0x8175('0x2b')]=_0x3cac9c;if(_0x2b7197['query'][_0x8175('0x4b')]){_0x292efe['include']=[{'all':!![]}];}return db['FaxMessage'][_0x8175('0x4c')](_0x292efe);})[_0x8175('0x19')](function(_0x7715b8){_0xc089c2[_0x8175('0x4d')]=_0x7715b8;return _0xc089c2;})[_0x8175('0x19')](respondWithFilteredResult(_0x2e05df,_0x292efe))['catch'](handleError(_0x2e05df,null));};exports[_0x8175('0x4e')]=function(_0x43510b,_0x8f8fb9){var _0x55f903={'raw':!![],'where':{'id':_0x43510b[_0x8175('0x4f')]['id']}},_0x5cc6a2={};_0x5cc6a2['model']=_[_0x8175('0x3c')](db[_0x8175('0x50')][_0x8175('0x37')]);_0x5cc6a2[_0x8175('0x3d')]=_[_0x8175('0x3c')](_0x43510b[_0x8175('0x3d')]);_0x5cc6a2[_0x8175('0x3e')]=_[_0x8175('0x3f')](_0x5cc6a2['model'],_0x5cc6a2[_0x8175('0x3d')]);_0x55f903[_0x8175('0x40')]=_[_0x8175('0x3f')](_0x5cc6a2[_0x8175('0x3a')],qs[_0x8175('0x41')](_0x43510b[_0x8175('0x3d')]['fields']));_0x55f903[_0x8175('0x40')]=_0x55f903['attributes'][_0x8175('0x42')]?_0x55f903[_0x8175('0x40')]:_0x5cc6a2['model'];if(_0x43510b[_0x8175('0x3d')][_0x8175('0x4b')]){_0x55f903['include']=[{'all':!![]}];}_0x55f903=_['merge']({},_0x55f903,_0x43510b[_0x8175('0x51')]);return db[_0x8175('0x50')][_0x8175('0x52')](_0x55f903)[_0x8175('0x19')](handleEntityNotFound(_0x8f8fb9,null))[_0x8175('0x19')](respondWithResult(_0x8f8fb9,null))[_0x8175('0x23')](handleError(_0x8f8fb9,null));};exports[_0x8175('0x31')]=function(_0x1b96e3,_0x273573){if(_0x1b96e3[_0x8175('0x53')]['id']){delete _0x1b96e3['body']['id'];}return db[_0x8175('0x50')]['find']({'where':{'id':_0x1b96e3[_0x8175('0x4f')]['id']}})[_0x8175('0x19')](handleEntityNotFound(_0x273573,null))['then'](saveUpdates(_0x1b96e3['body'],null))['then'](respondWithResult(_0x273573,null))[_0x8175('0x23')](handleError(_0x273573,null));};exports['destroy']=function(_0x1b76a6,_0x42644d){return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x1b76a6[_0x8175('0x4f')]['id']}})[_0x8175('0x19')](handleEntityNotFound(_0x42644d,null))['then'](removeEntity(_0x42644d,null))[_0x8175('0x23')](handleError(_0x42644d,null));};exports[_0x8175('0x54')]=function(_0x15f9a8,_0x3ac8d3){return db['FaxMessage'][_0x8175('0x54')]()[_0x8175('0x19')](respondWithResult(_0x3ac8d3,null))[_0x8175('0x23')](handleError(_0x3ac8d3,null));};var interaction_log=require(_0x8175('0x10'))('fax-interactions');exports[_0x8175('0x55')]=function(_0x373eb0,_0x455c6,_0x223390){var _0x40e7d3={'agent':{},'channel':'fax'};if(_0x373eb0[_0x8175('0x53')]['id']){delete _0x373eb0[_0x8175('0x53')]['id'];}_0x373eb0[_0x8175('0x53')][_0x8175('0x56')]=!![];_0x373eb0['body'][_0x8175('0x57')]=moment()[_0x8175('0x58')](_0x8175('0x59'));_0x373eb0[_0x8175('0x53')][_0x8175('0x5a')]=_0x373eb0['body'][_0x8175('0x5a')]||_0x373eb0[_0x8175('0x5b')]['id'];_0x40e7d3['agent']['id']=_0x373eb0[_0x8175('0x53')][_0x8175('0x5a')];return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x373eb0[_0x8175('0x4f')]['id'],'UserId':null}})[_0x8175('0x19')](handleEntityNotFound(_0x455c6,null))[_0x8175('0x19')](saveUpdates(_0x373eb0[_0x8175('0x53')],null))[_0x8175('0x19')](function(_0x5d0a31){if(_0x5d0a31){_0x40e7d3[_0x8175('0x21')]=_0x5d0a31[_0x8175('0x5c')]({'plain':!![]});return db[_0x8175('0x5d')][_0x8175('0x52')]({'where':{'id':_0x5d0a31[_0x8175('0x5e')]}});}return null;})[_0x8175('0x19')](handleEntityNotFound(_0x455c6,null))[_0x8175('0x19')](function(_0x376036){if(_0x376036){return _0x376036[_0x8175('0x31')]({'UserId':_0x373eb0[_0x8175('0x53')]['UserId'],'read1stAt':_[_0x8175('0x5f')](_0x376036[_0x8175('0x60')])?moment()[_0x8175('0x58')](_0x8175('0x59')):undefined});}return null;})['then'](function(_0x3a4078){if(_0x3a4078){_0x40e7d3[_0x8175('0x61')]=_0x3a4078['get']({'plain':!![]});interaction_log[_0x8175('0x1a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x373eb0[_0x8175('0x5b')]['id'],_0x373eb0[_0x8175('0x5b')][_0x8175('0x34')],_0x373eb0[_0x8175('0x5b')][_0x8175('0x62')],_0x40e7d3[_0x8175('0x61')]['id'],_0x373eb0[_0x8175('0x53')]?JSON[_0x8175('0x1e')](_0x373eb0[_0x8175('0x53')]):_0x8175('0x63'));return respondWithRpcPromise(_0x8175('0x64'),_0x8175('0x65'),_0x40e7d3);}return null;})[_0x8175('0x19')](function(_0x4e4bf4){var _0x337ce3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e4bf4[_0x8175('0x21')][_0x8175('0x66')];return db[_0x8175('0x67')][_0x8175('0x3d')](_0x337ce3,{'type':db[_0x8175('0x68')]['QueryTypes'][_0x8175('0x69')],'raw':!![]})['then'](function(_0x47a249){return _0x47a249;});})[_0x8175('0x19')](function(_0x328c97){if(_0x328c97){_0x40e7d3['message'][_0x8175('0x6a')]=_0x328c97[0x0];if(!_0x373eb0['body'][_0x8175('0x5a')])return;return db[_0x8175('0x6b')][_0x8175('0x52')]({'where':{'id':_0x373eb0['body'][_0x8175('0x5a')],'role':'agent'},'attributes':['id',_0x8175('0x34'),_0x8175('0x6c'),'email',_0x8175('0x6d')],'raw':!![]});}return null;})[_0x8175('0x19')](function(_0x4a6a6d){if(!_0x4a6a6d)return null;_0x40e7d3[_0x8175('0x21')][_0x8175('0x6e')]=_0x4a6a6d;return _0x40e7d3;})[_0x8175('0x19')](function(_0x4165fd){if(_0x4165fd){if(_0x373eb0[_0x8175('0x53')][_0x8175('0x6f')]){_0x40e7d3[_0x8175('0x21')][_0x8175('0x70')]=util[_0x8175('0x58')](_0x8175('0x71'),_0x373eb0[_0x8175('0x5b')][_0x8175('0x34')]);_0x40e7d3[_0x8175('0x21')][_0x8175('0x72')]=_0x40e7d3[_0x8175('0x72')];_0x40e7d3[_0x8175('0x21')]['motionChannel']=_0x40e7d3[_0x8175('0x72')];_0x40e7d3[_0x8175('0x21')]['event']=_0x8175('0x55');return respondWithRpcPromise(_0x8175('0x73'),_0x8175('0x73'),{'event':_0x8175('0x74'),'message':_0x40e7d3[_0x8175('0x21')]},client9002)[_0x8175('0x19')](function(){return _0x40e7d3;});}return _0x40e7d3;}return null;})['then'](respondWithResult(_0x455c6,null))[_0x8175('0x23')](handleError(_0x455c6,null));};var interaction_log=require('../../config/logger')(_0x8175('0x75'));exports[_0x8175('0x2f')]=function(_0x1c67ea,_0x2d877e,_0x180c0a){var _0x143f79={'agent':{},'channel':'fax'};if(_0x1c67ea[_0x8175('0x53')]['id']){delete _0x1c67ea[_0x8175('0x53')]['id'];}_0x1c67ea[_0x8175('0x53')][_0x8175('0x5a')]=_0x1c67ea[_0x8175('0x53')][_0x8175('0x5a')]||_0x1c67ea[_0x8175('0x5b')]['id'];_0x143f79[_0x8175('0x6e')]['id']=_0x1c67ea['body'][_0x8175('0x5a')];return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x1c67ea['params']['id'],'UserId':null}})[_0x8175('0x19')](handleEntityNotFound(_0x2d877e,null))[_0x8175('0x19')](function(_0x42756c){if(_0x42756c){_0x143f79['message']=_0x42756c['get']({'plain':!![]});return db[_0x8175('0x5d')]['find']({'where':{'id':_0x42756c[_0x8175('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x2d877e,null))[_0x8175('0x19')](function(_0x1333f0){if(_0x1333f0){_0x143f79[_0x8175('0x61')]=_0x1333f0[_0x8175('0x5c')]({'plain':!![]});interaction_log['info'](_0x8175('0x76'),_0x1c67ea[_0x8175('0x5b')]['id'],_0x1c67ea['user'][_0x8175('0x34')],_0x1c67ea[_0x8175('0x5b')][_0x8175('0x62')],_0x143f79[_0x8175('0x61')]['id'],_0x1c67ea[_0x8175('0x53')]?JSON[_0x8175('0x1e')](_0x1c67ea[_0x8175('0x53')]):_0x8175('0x63'));return respondWithRpcPromise('RejectMessage',_0x8175('0x77'),_0x143f79);}return null;})[_0x8175('0x19')](function(_0xf28630){var _0x1753db=_0x8175('0x78')+_0xf28630[_0x8175('0x21')]['ContactId'];return db[_0x8175('0x67')]['query'](_0x1753db,{'type':db[_0x8175('0x68')]['QueryTypes'][_0x8175('0x69')],'raw':!![]})[_0x8175('0x19')](function(_0x175e46){return _0x175e46;});})['then'](function(_0x4cf1bc){if(_0x4cf1bc){_0x143f79['message'][_0x8175('0x6a')]=_0x4cf1bc[0x0];if(!_0x1c67ea[_0x8175('0x53')]['UserId'])return;return db[_0x8175('0x6b')]['find']({'where':{'id':_0x1c67ea['body'][_0x8175('0x5a')],'role':_0x8175('0x6e')},'attributes':['id',_0x8175('0x34'),_0x8175('0x6c'),_0x8175('0x79'),_0x8175('0x6d')],'raw':!![]});}return null;})['then'](function(_0x4d9c07){if(!_0x4d9c07)return null;_0x143f79[_0x8175('0x21')][_0x8175('0x6e')]=_0x4d9c07;return _0x143f79;})[_0x8175('0x19')](function(_0x24c69d){if(_0x24c69d){_0x24c69d['message'][_0x8175('0x70')]=util['format'](_0x8175('0x71'),_0x1c67ea['user'][_0x8175('0x34')]);_0x24c69d[_0x8175('0x21')]['channel']=_0x143f79[_0x8175('0x72')];_0x24c69d[_0x8175('0x21')][_0x8175('0x7a')]=_0x143f79['channel'];_0x24c69d['message'][_0x8175('0x7b')]=_0x8175('0x2f');respondWithRpcPromise('EventManager',_0x8175('0x73'),{'event':_0x8175('0x7c'),'message':_0x24c69d[_0x8175('0x21')]},client9002);return _0x143f79;}return null;})[_0x8175('0x19')](respondWithResult(_0x2d877e,null))[_0x8175('0x23')](handleError(_0x2d877e,null));};exports[_0x8175('0x7d')]=function(_0x354d0c,_0x4d55a5){var _0x5a6247;return db[_0x8175('0x50')][_0x8175('0x7d')](_0x354d0c[_0x8175('0x53')],{})['then'](function(_0x28f12b){_0x5a6247=_0x28f12b;return db[_0x8175('0x7e')][_0x8175('0x7f')]({'where':{'id':_0x5a6247[_0x8175('0x66')]}});})['then'](function(_0x5f5032){if(_[_0x8175('0x5f')](_0x5f5032)){return;}else{_0x5a6247[_0x8175('0x80')]=_0x5f5032[_0x8175('0x80')];return db[_0x8175('0x81')][_0x8175('0x7f')]({'where':{'id':_0x5a6247[_0x8175('0x82')]}});}})[_0x8175('0x19')](function(_0x4bd858){return respondWithRpcPromise('SendFax',_0x8175('0x83'),{'FaxAccountId':_['isNil'](_0x354d0c[_0x8175('0x53')])?undefined:_0x354d0c[_0x8175('0x53')][_0x8175('0x84')],'path':_[_0x8175('0x5f')](_0x4bd858)?undefined:util[_0x8175('0x58')](_0x8175('0x85'),_0x4bd858[_0x8175('0x86')]),'fax':_[_0x8175('0x5f')](_0x5a6247[_0x8175('0x80')])?undefined:_0x5a6247['fax'],'AttachmentId':_0x5a6247[_0x8175('0x82')]},client9002);})[_0x8175('0x19')](respondWithResult(_0x4d55a5,0xc9))[_0x8175('0x23')](handleError(_0x4d55a5,null));};exports['download']=function(_0x3fd6eb,_0x4c5afb){var _0x354ec7=path['join'](config[_0x8175('0x87')],_0x8175('0x88'),'files','attachments');return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x3fd6eb[_0x8175('0x4f')]['id']},'include':[{'model':db[_0x8175('0x81')],'as':_0x8175('0x81')}]})['then'](handleEntityNotFound(_0x4c5afb,null))[_0x8175('0x19')](function(_0x4460b9){if(_0x4460b9){return _0x4c5afb['download'](path['join'](_0x354ec7,_0x4460b9[_0x8175('0x81')][_0x8175('0x86')]));}})[_0x8175('0x23')](handleError(_0x4c5afb,null));}; \ No newline at end of file +var _0xa880=['show','params','keys','length','find','catch','body','describe','accept','fax','readAt','format','UserId','user','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','acceptmessage','fax-interactions','get','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','SELECT','User','EventManager','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','send','index','map','FaxMessage','rawAttributes','fieldName','type','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include'];(function(_0x4ffd20,_0x1e83b6){var _0x49b5e2=function(_0xfdd1a6){while(--_0xfdd1a6){_0x4ffd20['push'](_0x4ffd20['shift']());}};_0x49b5e2(++_0x1e83b6);}(_0xa880,0x1ee));var _0x0a88=function(_0x4008de,_0x15f2e9){_0x4008de=_0x4008de-0x0;var _0x596738=_0xa880[_0x4008de];return _0x596738;};'use strict';var emlformat=require(_0x0a88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a88('0x1'));var jsonpatch=require(_0x0a88('0x2'));var rp=require(_0x0a88('0x3'));var moment=require(_0x0a88('0x4'));var BPromise=require(_0x0a88('0x5'));var Mustache=require(_0x0a88('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0a88('0x7'));var csv=require(_0x0a88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a88('0x9'));var _=require('lodash');var squel=require(_0x0a88('0xa'));var crypto=require(_0x0a88('0xb'));var jsforce=require(_0x0a88('0xc'));var deskjs=require(_0x0a88('0xd'));var toCsv=require(_0x0a88('0x8'));var querystring=require('querystring');var Papa=require(_0x0a88('0xe'));var Redis=require(_0x0a88('0xf'));var authService=require(_0x0a88('0x10'));var qs=require(_0x0a88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a88('0x12'));var logger=require(_0x0a88('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a88('0x14'));var db=require(_0x0a88('0x15'))['db'];config['redis']=_[_0x0a88('0x16')](config[_0x0a88('0x17')],{'host':_0x0a88('0x18'),'port':0x18eb});var socket=require(_0x0a88('0x19'))(new Redis(config[_0x0a88('0x17')]));require(_0x0a88('0x1a'))[_0x0a88('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0a88('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a88('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1956d2,_0x273e88,_0x2033c1,_0x33a089){return new BPromise(function(_0x506ee0,_0x1401ed){var _0x94df9e=_0x33a089||client;return _0x94df9e[_0x0a88('0x1e')](_0x1956d2,_0x2033c1)[_0x0a88('0x1f')](function(_0x3cb292){logger['info'](_0x0a88('0x20'),_0x273e88,_0x0a88('0x21'));logger[_0x0a88('0x22')](_0x0a88('0x23'),_0x273e88,_0x0a88('0x21'),JSON['stringify'](_0x3cb292));if(_0x3cb292[_0x0a88('0x24')]){if(_0x3cb292[_0x0a88('0x24')][_0x0a88('0x25')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x273e88,_0x3cb292[_0x0a88('0x24')][_0x0a88('0x26')]);return _0x1401ed(_0x3cb292[_0x0a88('0x24')][_0x0a88('0x26')]);}logger[_0x0a88('0x24')](_0x0a88('0x20'),_0x273e88,_0x3cb292['error'][_0x0a88('0x26')]);return _0x506ee0(_0x3cb292[_0x0a88('0x24')]['message']);}else{logger[_0x0a88('0x27')](_0x0a88('0x20'),_0x273e88,_0x0a88('0x21'));_0x506ee0(_0x3cb292[_0x0a88('0x28')][_0x0a88('0x26')]);}})['catch'](function(_0x16abaa){logger['error'](_0x0a88('0x20'),_0x273e88,_0x16abaa);_0x1401ed(_0x16abaa);});});}function respondWithStatusCode(_0x3f5bdd,_0x53db0c){_0x53db0c=_0x53db0c||0xcc;return function(_0x2b41e7){if(_0x2b41e7){return _0x3f5bdd['sendStatus'](_0x53db0c);}return _0x3f5bdd['status'](_0x53db0c)[_0x0a88('0x29')]();};}function respondWithResult(_0x2b7ff2,_0x26a817){_0x26a817=_0x26a817||0xc8;return function(_0x34ffa1){if(_0x34ffa1){return _0x2b7ff2[_0x0a88('0x2a')](_0x26a817)[_0x0a88('0x2b')](_0x34ffa1);}};}function respondWithFilteredResult(_0x17b5aa,_0x4c7e86){return function(_0x126769){if(_0x126769){var _0x26aed6=typeof _0x4c7e86[_0x0a88('0x2c')]===_0x0a88('0x2d')&&typeof _0x4c7e86[_0x0a88('0x2e')]===_0x0a88('0x2d');var _0x2e4cd0=_0x126769[_0x0a88('0x2f')];var _0x35c08d=_0x26aed6?0x0:_0x4c7e86[_0x0a88('0x2c')];var _0x50f7ec=_0x26aed6?_0x126769[_0x0a88('0x2f')]:_0x4c7e86['offset']+_0x4c7e86[_0x0a88('0x2e')];var _0x3a5edc;if(_0x50f7ec>=_0x2e4cd0){_0x50f7ec=_0x2e4cd0;_0x3a5edc=0xc8;}else{_0x3a5edc=0xce;}_0x17b5aa[_0x0a88('0x2a')](_0x3a5edc);return _0x17b5aa[_0x0a88('0x30')](_0x0a88('0x31'),_0x35c08d+'-'+_0x50f7ec+'/'+_0x2e4cd0)[_0x0a88('0x2b')](_0x126769);}return null;};}function patchUpdates(_0x4abc19){return function(_0x58b221){try{jsonpatch[_0x0a88('0x32')](_0x58b221,_0x4abc19,!![]);}catch(_0x1abd9a){return BPromise[_0x0a88('0x33')](_0x1abd9a);}return _0x58b221[_0x0a88('0x34')]();};}function saveUpdates(_0x2b5fa8,_0x94ab7a){return function(_0x4f9762){if(_0x4f9762){return _0x4f9762[_0x0a88('0x35')](_0x2b5fa8)[_0x0a88('0x1f')](function(_0x31a99e){return _0x31a99e;});}return null;};}function removeEntity(_0x147632,_0x10c533){return function(_0x88568){if(_0x88568){return _0x88568[_0x0a88('0x36')]()[_0x0a88('0x1f')](function(){_0x147632['status'](0xcc)[_0x0a88('0x29')]();});}};}function handleEntityNotFound(_0x1610dd,_0x25e454){return function(_0xa9ae52){if(!_0xa9ae52){_0x1610dd[_0x0a88('0x37')](0x194);}return _0xa9ae52;};}function handleError(_0x226262,_0x101f5e){_0x101f5e=_0x101f5e||0x1f4;return function(_0x3d87c9){logger[_0x0a88('0x24')](_0x3d87c9[_0x0a88('0x38')]);if(_0x3d87c9['name']){delete _0x3d87c9['name'];}_0x226262[_0x0a88('0x2a')](_0x101f5e)[_0x0a88('0x39')](_0x3d87c9);};}exports[_0x0a88('0x3a')]=function(_0x3314b6,_0x5d6764){var _0x118d49={},_0x3f87e7={},_0x3f3807={'count':0x0,'rows':[]};var _0x579a0d=_[_0x0a88('0x3b')](db[_0x0a88('0x3c')][_0x0a88('0x3d')],function(_0x10b3ca){return{'name':_0x10b3ca[_0x0a88('0x3e')],'type':_0x10b3ca[_0x0a88('0x3f')]['key']};});_0x3f87e7['model']=_['map'](_0x579a0d,_0x0a88('0x40'));_0x3f87e7[_0x0a88('0x41')]=_['keys'](_0x3314b6[_0x0a88('0x41')]);_0x3f87e7[_0x0a88('0x42')]=_[_0x0a88('0x43')](_0x3f87e7[_0x0a88('0x44')],_0x3f87e7['query']);_0x118d49['attributes']=_[_0x0a88('0x43')](_0x3f87e7[_0x0a88('0x44')],qs[_0x0a88('0x45')](_0x3314b6[_0x0a88('0x41')][_0x0a88('0x45')]));_0x118d49['attributes']=_0x118d49[_0x0a88('0x46')]['length']?_0x118d49[_0x0a88('0x46')]:_0x3f87e7[_0x0a88('0x44')];if(!_0x3314b6['query'][_0x0a88('0x47')](_0x0a88('0x48'))){_0x118d49[_0x0a88('0x2e')]=qs[_0x0a88('0x2e')](_0x3314b6[_0x0a88('0x41')]['limit']);_0x118d49['offset']=qs[_0x0a88('0x2c')](_0x3314b6['query'][_0x0a88('0x2c')]);}_0x118d49[_0x0a88('0x49')]=qs[_0x0a88('0x4a')](_0x3314b6[_0x0a88('0x41')]['sort']);_0x118d49['where']=qs['filters'](_[_0x0a88('0x4b')](_0x3314b6[_0x0a88('0x41')],_0x3f87e7[_0x0a88('0x42')]),_0x579a0d);if(_0x3314b6[_0x0a88('0x41')][_0x0a88('0x4c')]){_0x118d49['where']=_[_0x0a88('0x4d')](_0x118d49[_0x0a88('0x4e')],{'$or':_[_0x0a88('0x3b')](_0x579a0d,function(_0x48ef39){if(_0x48ef39[_0x0a88('0x3f')]!=='VIRTUAL'){var _0x1c4f8e={};_0x1c4f8e[_0x48ef39[_0x0a88('0x40')]]={'$like':'%'+_0x3314b6[_0x0a88('0x41')]['filter']+'%'};return _0x1c4f8e;}})});}_0x118d49=_[_0x0a88('0x4d')]({},_0x118d49,_0x3314b6[_0x0a88('0x4f')]);var _0x2b6bc1={'where':_0x118d49[_0x0a88('0x4e')]};return db[_0x0a88('0x3c')]['count'](_0x2b6bc1)[_0x0a88('0x1f')](function(_0x533055){_0x3f3807[_0x0a88('0x2f')]=_0x533055;if(_0x3314b6[_0x0a88('0x41')][_0x0a88('0x50')]){_0x118d49[_0x0a88('0x51')]=[{'all':!![]}];}return db[_0x0a88('0x3c')]['findAll'](_0x118d49);})['then'](function(_0x438156){_0x3f3807['rows']=_0x438156;return _0x3f3807;})['then'](respondWithFilteredResult(_0x5d6764,_0x118d49))['catch'](handleError(_0x5d6764,null));};exports[_0x0a88('0x52')]=function(_0x1082cf,_0x136e73){var _0xb7c63e={'raw':!![],'where':{'id':_0x1082cf[_0x0a88('0x53')]['id']}},_0x4a531a={};_0x4a531a[_0x0a88('0x44')]=_[_0x0a88('0x54')](db[_0x0a88('0x3c')][_0x0a88('0x3d')]);_0x4a531a[_0x0a88('0x41')]=_[_0x0a88('0x54')](_0x1082cf['query']);_0x4a531a[_0x0a88('0x42')]=_[_0x0a88('0x43')](_0x4a531a[_0x0a88('0x44')],_0x4a531a[_0x0a88('0x41')]);_0xb7c63e[_0x0a88('0x46')]=_[_0x0a88('0x43')](_0x4a531a[_0x0a88('0x44')],qs[_0x0a88('0x45')](_0x1082cf[_0x0a88('0x41')]['fields']));_0xb7c63e[_0x0a88('0x46')]=_0xb7c63e[_0x0a88('0x46')][_0x0a88('0x55')]?_0xb7c63e[_0x0a88('0x46')]:_0x4a531a[_0x0a88('0x44')];if(_0x1082cf[_0x0a88('0x41')][_0x0a88('0x50')]){_0xb7c63e['include']=[{'all':!![]}];}_0xb7c63e=_[_0x0a88('0x4d')]({},_0xb7c63e,_0x1082cf['options']);return db[_0x0a88('0x3c')][_0x0a88('0x56')](_0xb7c63e)[_0x0a88('0x1f')](handleEntityNotFound(_0x136e73,null))[_0x0a88('0x1f')](respondWithResult(_0x136e73,null))[_0x0a88('0x57')](handleError(_0x136e73,null));};exports[_0x0a88('0x35')]=function(_0x4919e5,_0x51c555){if(_0x4919e5[_0x0a88('0x58')]['id']){delete _0x4919e5[_0x0a88('0x58')]['id'];}return db[_0x0a88('0x3c')][_0x0a88('0x56')]({'where':{'id':_0x4919e5[_0x0a88('0x53')]['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0x51c555,null))[_0x0a88('0x1f')](saveUpdates(_0x4919e5[_0x0a88('0x58')],null))['then'](respondWithResult(_0x51c555,null))[_0x0a88('0x57')](handleError(_0x51c555,null));};exports[_0x0a88('0x36')]=function(_0x3a36ef,_0x42837a){return db[_0x0a88('0x3c')][_0x0a88('0x56')]({'where':{'id':_0x3a36ef[_0x0a88('0x53')]['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0x42837a,null))[_0x0a88('0x1f')](removeEntity(_0x42837a,null))[_0x0a88('0x57')](handleError(_0x42837a,null));};exports['describe']=function(_0x2e67b3,_0x7559d3){return db['FaxMessage'][_0x0a88('0x59')]()[_0x0a88('0x1f')](respondWithResult(_0x7559d3,null))[_0x0a88('0x57')](handleError(_0x7559d3,null));};var interaction_log=require(_0x0a88('0x13'))('fax-interactions');exports[_0x0a88('0x5a')]=function(_0x5db226,_0x2ec4e5,_0x1eb1af){var _0x4378e9={'agent':{},'channel':_0x0a88('0x5b')};if(_0x5db226['body']['id']){delete _0x5db226[_0x0a88('0x58')]['id'];}_0x5db226[_0x0a88('0x58')]['read']=!![];_0x5db226[_0x0a88('0x58')][_0x0a88('0x5c')]=moment()[_0x0a88('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5db226[_0x0a88('0x58')][_0x0a88('0x5e')]=_0x5db226['body'][_0x0a88('0x5e')]||_0x5db226[_0x0a88('0x5f')]['id'];_0x4378e9['agent']['id']=_0x5db226[_0x0a88('0x58')][_0x0a88('0x5e')];return db[_0x0a88('0x3c')][_0x0a88('0x56')]({'where':{'id':_0x5db226[_0x0a88('0x53')]['id'],'UserId':null}})[_0x0a88('0x1f')](handleEntityNotFound(_0x2ec4e5,null))['then'](saveUpdates(_0x5db226[_0x0a88('0x58')],null))['then'](function(_0x440aa9){if(_0x440aa9){_0x4378e9[_0x0a88('0x26')]=_0x440aa9['get']({'plain':!![]});return db[_0x0a88('0x60')][_0x0a88('0x56')]({'where':{'id':_0x440aa9['FaxInteractionId']}});}return null;})[_0x0a88('0x1f')](handleEntityNotFound(_0x2ec4e5,null))[_0x0a88('0x1f')](function(_0x15a92f){if(_0x15a92f){return _0x15a92f[_0x0a88('0x35')]({'UserId':_0x5db226[_0x0a88('0x58')]['UserId'],'read1stAt':_[_0x0a88('0x61')](_0x15a92f[_0x0a88('0x62')])?moment()[_0x0a88('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x56cef3){if(_0x56cef3){_0x4378e9[_0x0a88('0x63')]=_0x56cef3['get']({'plain':!![]});interaction_log[_0x0a88('0x27')](_0x0a88('0x64'),_0x5db226[_0x0a88('0x5f')]['id'],_0x5db226[_0x0a88('0x5f')]['name'],_0x5db226[_0x0a88('0x5f')][_0x0a88('0x65')],_0x4378e9[_0x0a88('0x63')]['id'],_0x5db226[_0x0a88('0x58')]?JSON[_0x0a88('0x66')](_0x5db226[_0x0a88('0x58')]):_0x0a88('0x67'));return respondWithRpcPromise('AcceptMessage',_0x0a88('0x68'),_0x4378e9);}return null;})[_0x0a88('0x1f')](function(_0x43ef6c){var _0x2a9b8b=_0x0a88('0x69')+_0x43ef6c[_0x0a88('0x26')]['ContactId'];return db['sequelize'][_0x0a88('0x41')](_0x2a9b8b,{'type':db[_0x0a88('0x6a')][_0x0a88('0x6b')]['SELECT'],'raw':!![]})[_0x0a88('0x1f')](function(_0x4c35ef){return _0x4c35ef;});})[_0x0a88('0x1f')](function(_0x5a5537){if(_0x5a5537){_0x4378e9[_0x0a88('0x26')][_0x0a88('0x6c')]=_0x5a5537[0x0];if(!_0x5db226[_0x0a88('0x58')][_0x0a88('0x5e')])return;return db['User'][_0x0a88('0x56')]({'where':{'id':_0x5db226[_0x0a88('0x58')][_0x0a88('0x5e')],'role':_0x0a88('0x6d')},'attributes':['id','name',_0x0a88('0x6e'),_0x0a88('0x6f'),_0x0a88('0x70')],'raw':!![]});}return null;})[_0x0a88('0x1f')](function(_0x453cce){if(!_0x453cce)return null;_0x4378e9[_0x0a88('0x26')][_0x0a88('0x6d')]=_0x453cce;return _0x4378e9;})[_0x0a88('0x1f')](function(_0x26f089){if(_0x26f089){if(_0x5db226[_0x0a88('0x58')]['manual']){_0x4378e9[_0x0a88('0x26')][_0x0a88('0x71')]=util[_0x0a88('0x5d')](_0x0a88('0x72'),_0x5db226[_0x0a88('0x5f')][_0x0a88('0x40')]);_0x4378e9[_0x0a88('0x26')]['channel']=_0x4378e9[_0x0a88('0x73')];_0x4378e9[_0x0a88('0x26')][_0x0a88('0x74')]=_0x4378e9[_0x0a88('0x73')];_0x4378e9[_0x0a88('0x26')][_0x0a88('0x75')]=_0x0a88('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0a88('0x76'),'message':_0x4378e9['message']},client9002)[_0x0a88('0x1f')](function(){return _0x4378e9;});}return _0x4378e9;}return null;})[_0x0a88('0x1f')](respondWithResult(_0x2ec4e5,null))['catch'](handleError(_0x2ec4e5,null));};var interaction_log=require(_0x0a88('0x13'))(_0x0a88('0x77'));exports[_0x0a88('0x33')]=function(_0x4c540c,_0x1c902b,_0x547925){var _0x1f33ac={'agent':{},'channel':_0x0a88('0x5b')};if(_0x4c540c['body']['id']){delete _0x4c540c['body']['id'];}_0x4c540c['body'][_0x0a88('0x5e')]=_0x4c540c[_0x0a88('0x58')][_0x0a88('0x5e')]||_0x4c540c[_0x0a88('0x5f')]['id'];_0x1f33ac[_0x0a88('0x6d')]['id']=_0x4c540c['body'][_0x0a88('0x5e')];return db[_0x0a88('0x3c')][_0x0a88('0x56')]({'where':{'id':_0x4c540c['params']['id'],'UserId':null}})[_0x0a88('0x1f')](handleEntityNotFound(_0x1c902b,null))[_0x0a88('0x1f')](function(_0x1e5dbe){if(_0x1e5dbe){_0x1f33ac[_0x0a88('0x26')]=_0x1e5dbe[_0x0a88('0x78')]({'plain':!![]});return db['FaxInteraction'][_0x0a88('0x56')]({'where':{'id':_0x1e5dbe[_0x0a88('0x79')]}});}return null;})[_0x0a88('0x1f')](handleEntityNotFound(_0x1c902b,null))[_0x0a88('0x1f')](function(_0x50b878){if(_0x50b878){_0x1f33ac[_0x0a88('0x63')]=_0x50b878[_0x0a88('0x78')]({'plain':!![]});interaction_log['info'](_0x0a88('0x7a'),_0x4c540c[_0x0a88('0x5f')]['id'],_0x4c540c[_0x0a88('0x5f')][_0x0a88('0x40')],_0x4c540c[_0x0a88('0x5f')][_0x0a88('0x65')],_0x1f33ac[_0x0a88('0x63')]['id'],_0x4c540c[_0x0a88('0x58')]?JSON[_0x0a88('0x66')](_0x4c540c[_0x0a88('0x58')]):_0x0a88('0x67'));return respondWithRpcPromise(_0x0a88('0x7b'),_0x0a88('0x7c'),_0x1f33ac);}return null;})['then'](function(_0x41f4d4){var _0x3b014f=_0x0a88('0x69')+_0x41f4d4[_0x0a88('0x26')][_0x0a88('0x7d')];return db[_0x0a88('0x7e')][_0x0a88('0x41')](_0x3b014f,{'type':db[_0x0a88('0x6a')][_0x0a88('0x6b')][_0x0a88('0x7f')],'raw':!![]})['then'](function(_0x32ce78){return _0x32ce78;});})[_0x0a88('0x1f')](function(_0x28edcc){if(_0x28edcc){_0x1f33ac[_0x0a88('0x26')][_0x0a88('0x6c')]=_0x28edcc[0x0];if(!_0x4c540c['body']['UserId'])return;return db[_0x0a88('0x80')][_0x0a88('0x56')]({'where':{'id':_0x4c540c[_0x0a88('0x58')]['UserId'],'role':_0x0a88('0x6d')},'attributes':['id',_0x0a88('0x40'),_0x0a88('0x6e'),'email',_0x0a88('0x70')],'raw':!![]});}return null;})['then'](function(_0x4c51f6){if(!_0x4c51f6)return null;_0x1f33ac[_0x0a88('0x26')][_0x0a88('0x6d')]=_0x4c51f6;return _0x1f33ac;})[_0x0a88('0x1f')](function(_0x18a8b2){if(_0x18a8b2){_0x18a8b2[_0x0a88('0x26')][_0x0a88('0x71')]=util[_0x0a88('0x5d')](_0x0a88('0x72'),_0x4c540c[_0x0a88('0x5f')][_0x0a88('0x40')]);_0x18a8b2['message'][_0x0a88('0x73')]=_0x1f33ac[_0x0a88('0x73')];_0x18a8b2['message'][_0x0a88('0x74')]=_0x1f33ac[_0x0a88('0x73')];_0x18a8b2[_0x0a88('0x26')]['event']=_0x0a88('0x33');respondWithRpcPromise(_0x0a88('0x81'),'EventManager',{'event':'rejectmessage','message':_0x18a8b2['message']},client9002);return _0x1f33ac;}return null;})[_0x0a88('0x1f')](respondWithResult(_0x1c902b,null))['catch'](handleError(_0x1c902b,null));};exports[_0x0a88('0x82')]=function(_0x567059,_0x4c2cd3){var _0x5caf63;return db[_0x0a88('0x3c')][_0x0a88('0x82')](_0x567059[_0x0a88('0x58')],{})[_0x0a88('0x1f')](function(_0x165f35){_0x5caf63=_0x165f35;return db[_0x0a88('0x83')]['findOne']({'where':{'id':_0x5caf63[_0x0a88('0x7d')]}});})[_0x0a88('0x1f')](function(_0x3e0a0b){if(_[_0x0a88('0x61')](_0x3e0a0b)){return;}else{_0x5caf63[_0x0a88('0x5b')]=_0x3e0a0b[_0x0a88('0x5b')];return db[_0x0a88('0x84')][_0x0a88('0x85')]({'where':{'id':_0x5caf63[_0x0a88('0x86')]}});}})[_0x0a88('0x1f')](function(_0x5d441f){return respondWithRpcPromise('SendFax',_0x0a88('0x87'),{'FaxAccountId':_[_0x0a88('0x61')](_0x567059[_0x0a88('0x58')])?undefined:_0x567059['body'][_0x0a88('0x88')],'path':_[_0x0a88('0x61')](_0x5d441f)?undefined:util[_0x0a88('0x5d')](_0x0a88('0x89'),_0x5d441f[_0x0a88('0x8a')]),'fax':_['isNil'](_0x5caf63[_0x0a88('0x5b')])?undefined:_0x5caf63[_0x0a88('0x5b')],'AttachmentId':_0x5caf63[_0x0a88('0x86')]},client9002);})['then'](respondWithResult(_0x4c2cd3,0xc9))['catch'](handleError(_0x4c2cd3,null));};exports[_0x0a88('0x8b')]=function(_0x5a90cf,_0x3810b8){var _0x167561=path[_0x0a88('0x8c')](config[_0x0a88('0x8d')],_0x0a88('0x8e'),'files',_0x0a88('0x8f'));return db[_0x0a88('0x3c')][_0x0a88('0x56')]({'where':{'id':_0x5a90cf[_0x0a88('0x53')]['id']},'include':[{'model':db[_0x0a88('0x84')],'as':'Attachment'}]})[_0x0a88('0x1f')](handleEntityNotFound(_0x3810b8,null))[_0x0a88('0x1f')](function(_0x8704f7){if(_0x8704f7){return _0x3810b8[_0x0a88('0x8b')](path[_0x0a88('0x8c')](_0x167561,_0x8704f7['Attachment'][_0x0a88('0x8a')]));}})[_0x0a88('0x57')](handleError(_0x3810b8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1f09221..d4040e2 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 _0xae35=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x17005a,_0x28cba0){var _0x620aeb=function(_0x5dfb5b){while(--_0x5dfb5b){_0x17005a['push'](_0x17005a['shift']());}};_0x620aeb(++_0x28cba0);}(_0xae35,0x172));var _0x5ae3=function(_0x26c790,_0x1962bb){_0x26c790=_0x26c790-0x0;var _0x369b9a=_0xae35[_0x26c790];return _0x369b9a;};'use strict';var EventEmitter=require(_0x5ae3('0x0'));var FaxMessage=require(_0x5ae3('0x1'))['db'][_0x5ae3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5ae3('0x3')](0x0);var events={'afterCreate':_0x5ae3('0x4'),'afterUpdate':_0x5ae3('0x5'),'afterDestroy':_0x5ae3('0x6')};function emitEvent(_0x39d9b7){return function(_0x54c0f2,_0x6dffe3,_0x4d1536){FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7+':'+_0x54c0f2['id'],_0x54c0f2);FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7,_0x54c0f2);_0x4d1536(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x5ae3('0x8')](e,emitEvent(event));}}module[_0x5ae3('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x4cff=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x4cff,0x14a));var _0xf4cf=function(_0x3ff5bd,_0x4944d8){_0x3ff5bd=_0x3ff5bd-0x0;var _0x77b66d=_0x4cff[_0x3ff5bd];return _0x77b66d;};'use strict';var EventEmitter=require(_0xf4cf('0x0'));var FaxMessage=require(_0xf4cf('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf4cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4cf('0x3'),'afterDestroy':_0xf4cf('0x4')};function emitEvent(_0x548b62){return function(_0x3d5ddc,_0x1c1936,_0x9bcfbe){FaxMessageEvents[_0xf4cf('0x5')](_0x548b62+':'+_0x3d5ddc['id'],_0x3d5ddc);FaxMessageEvents[_0xf4cf('0x5')](_0x548b62,_0x3d5ddc);_0x9bcfbe(null);};}for(var e in events){if(events[_0xf4cf('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xf4cf('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0ae9a5b..dba13e6 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 _0xfab0=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xfab0,0x1e7));var _0x0fab=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xfab0[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var logger=require(_0x0fab('0x2'))(_0x0fab('0x3'));var moment=require(_0x0fab('0x4'));var BPromise=require(_0x0fab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fab('0x6'));var rimraf=require('rimraf');var config=require(_0x0fab('0x7'));var attributes=require(_0x0fab('0x8'));module[_0x0fab('0x9')]=function(_0x53a4db,_0x3a6b3c){return _0x53a4db[_0x0fab('0xa')]('FaxMessage',attributes,{'tableName':_0x0fab('0xb'),'paranoid':![],'indexes':[{'name':_0x0fab('0xc'),'fields':['body'],'type':_0x0fab('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x277bb5,_0x49d6f4,_0x220968){var _0x464f19=_0x53a4db[_0x0fab('0xe')];var _0xae5537=_0x277bb5['get']({'plain':!![]});if(_0xae5537[_0x0fab('0xf')][_0x0fab('0x10')]()==='in'||_0xae5537['direction'][_0x0fab('0x10')]()==='out'&&!_0xae5537['secret']&&!_[_0x0fab('0x11')](_0xae5537[_0x0fab('0x12')])){_0x464f19['FaxInteraction'][_0x0fab('0x13')]({'where':{'id':_0xae5537[_0x0fab('0x14')]}})[_0x0fab('0x15')](function(_0x23410e){if(_0x23410e){_0x23410e[_0x0fab('0x16')]({'lastMsgAt':_0xae5537[_0x0fab('0x17')],'lastMsgDirection':_0xae5537['direction'][_0x0fab('0x10')]()});}})[_0x0fab('0x18')](function(_0x135de2){console['error'](_0x135de2);});}_0x220968();}},'charset':_0x0fab('0x19'),'collate':_0x0fab('0x1a')});}; \ No newline at end of file +var _0x6409=['FaxInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne'];(function(_0x4f54bb,_0x1d2930){var _0x56e9dd=function(_0x3714bc){while(--_0x3714bc){_0x4f54bb['push'](_0x4f54bb['shift']());}};_0x56e9dd(++_0x1d2930);}(_0x6409,0xe6));var _0x9640=function(_0x122043,_0x4711bf){_0x122043=_0x122043-0x0;var _0x150fa1=_0x6409[_0x122043];return _0x150fa1;};'use strict';var _=require(_0x9640('0x0'));var util=require(_0x9640('0x1'));var logger=require(_0x9640('0x2'))(_0x9640('0x3'));var moment=require(_0x9640('0x4'));var BPromise=require(_0x9640('0x5'));var rp=require(_0x9640('0x6'));var fs=require('fs');var path=require(_0x9640('0x7'));var rimraf=require(_0x9640('0x8'));var config=require('../../config/environment');var attributes=require(_0x9640('0x9'));module[_0x9640('0xa')]=function(_0x5b26db,_0xcf179){return _0x5b26db[_0x9640('0xb')](_0x9640('0xc'),attributes,{'tableName':_0x9640('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9640('0xe')],'type':_0x9640('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1888b2,_0x5e1c87,_0x41042f){var _0x36a374=_0x5b26db[_0x9640('0x10')];var _0xcb57d5=_0x1888b2[_0x9640('0x11')]({'plain':!![]});if(_0xcb57d5[_0x9640('0x12')][_0x9640('0x13')]()==='in'||_0xcb57d5['direction'][_0x9640('0x13')]()===_0x9640('0x14')&&!_0xcb57d5[_0x9640('0x15')]&&!_[_0x9640('0x16')](_0xcb57d5[_0x9640('0x17')])){_0x36a374[_0x9640('0x18')][_0x9640('0x19')]({'where':{'id':_0xcb57d5[_0x9640('0x1a')]}})[_0x9640('0x1b')](function(_0xe1e646){if(_0xe1e646){_0xe1e646[_0x9640('0x1c')]({'lastMsgAt':_0xcb57d5[_0x9640('0x1d')],'lastMsgDirection':_0xcb57d5[_0x9640('0x12')][_0x9640('0x13')]()});}})['catch'](function(_0x5811e9){console['error'](_0x5811e9);});}_0x41042f();}},'charset':_0x9640('0x1e'),'collate':_0x9640('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5571a06..6fa6d16 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x1a8183,_0x370a2c){var _0x43fe66=function(_0x4c9666){while(--_0x4c9666){_0x1a8183['push'](_0x1a8183['shift']());}};_0x43fe66(++_0x370a2c);}(_0x9f62,0x154));var _0x29f6=function(_0x51383f,_0x115bfc){_0x51383f=_0x51383f-0x0;var _0x1f54d2=_0x9f62[_0x51383f];return _0x1f54d2;};'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});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0x8d0e=['http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','debug','UpdateFaxMessage','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2aaf60,_0x45c7aa){var _0x161a87=function(_0x28ba6a){while(--_0x28ba6a){_0x2aaf60['push'](_0x2aaf60['shift']());}};_0x161a87(++_0x45c7aa);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x203aa8,_0x24572c){_0x203aa8=_0x203aa8-0x0;var _0x437472=_0x8d0e[_0x203aa8];return _0x437472;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});config[_0xe8d0('0xb')]=_[_0xe8d0('0xc')](config[_0xe8d0('0xb')],{'host':_0xe8d0('0xd'),'port':0x18eb});var socket=require(_0xe8d0('0xe'))(new Redis(config[_0xe8d0('0xb')]));require(_0xe8d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x10e56c,_0x19c3d0,_0x463159){return new BPromise(function(_0x599bc3,_0x580aab){return client[_0xe8d0('0x10')](_0x10e56c,_0x463159)[_0xe8d0('0x11')](function(_0x3da047){logger[_0xe8d0('0x12')](_0xe8d0('0x13'),_0x19c3d0,_0xe8d0('0x14'));logger['debug'](_0xe8d0('0x15'),_0x19c3d0,_0xe8d0('0x14'),JSON['stringify'](_0x3da047));if(_0x3da047[_0xe8d0('0x16')]){if(_0x3da047['error']['code']===0x1f4){logger[_0xe8d0('0x16')](_0xe8d0('0x13'),_0x19c3d0,_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);return _0x580aab(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}logger['error'](_0xe8d0('0x13'),_0x19c3d0,_0x3da047['error'][_0xe8d0('0x17')]);return _0x599bc3(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x19c3d0,'request\x20sent');_0x599bc3(_0x3da047[_0xe8d0('0x18')][_0xe8d0('0x17')]);}})[_0xe8d0('0x19')](function(_0x44bbe4){logger[_0xe8d0('0x16')]('FaxMessage,\x20%s,\x20%s',_0x19c3d0,_0x44bbe4);_0x580aab(_0x44bbe4);});});}exports[_0xe8d0('0x1a')]=function(_0x12ebf4){var _0x524b00=this;return new Promise(function(_0x5ce284,_0x554402){return db[_0xe8d0('0x1b')][_0xe8d0('0x1c')](_0x12ebf4[_0xe8d0('0x1d')],{'raw':_0x12ebf4[_0xe8d0('0x1e')]?_0x12ebf4[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![]})[_0xe8d0('0x11')](function(_0x28a6b5){logger[_0xe8d0('0x12')]('CreateFaxMessage',_0x12ebf4);logger[_0xe8d0('0x20')](_0xe8d0('0x1a'),_0x12ebf4,JSON['stringify'](_0x28a6b5));_0x5ce284(_0x28a6b5);})[_0xe8d0('0x19')](function(_0x2e69d1){logger[_0xe8d0('0x16')](_0xe8d0('0x1a'),_0x2e69d1[_0xe8d0('0x17')],_0x12ebf4);_0x554402(_0x524b00[_0xe8d0('0x16')](0x1f4,_0x2e69d1[_0xe8d0('0x17')]));});});};exports[_0xe8d0('0x21')]=function(_0xfa3527){var _0x2dee67=this;return new Promise(function(_0x264de4,_0x539548){return db[_0xe8d0('0x1b')][_0xe8d0('0x22')](_0xfa3527[_0xe8d0('0x1d')],{'raw':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x23')]||null:null,'attributes':_0xfa3527[_0xe8d0('0x1e')]?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x24')]||null:null,'limit':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')]['limit']||null:null})['then'](function(_0x50ad3c){logger[_0xe8d0('0x12')](_0xe8d0('0x21'),_0xfa3527);logger[_0xe8d0('0x20')]('UpdateFaxMessage',_0xfa3527,JSON['stringify'](_0x50ad3c));_0x264de4(_0x50ad3c);})[_0xe8d0('0x19')](function(_0x551999){logger[_0xe8d0('0x16')](_0xe8d0('0x21'),_0x551999[_0xe8d0('0x17')],_0xfa3527);_0x539548(_0x2dee67[_0xe8d0('0x16')](0x1f4,_0x551999[_0xe8d0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index dc84f61..5159e70 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 _0x6071=['faxMessage:','./faxMessage.events','removeListener','register','length'];(function(_0x334444,_0x20403c){var _0x303741=function(_0x2c7753){while(--_0x2c7753){_0x334444['push'](_0x334444['shift']());}};_0x303741(++_0x20403c);}(_0x6071,0x1eb));var _0x1607=function(_0x13e4b0,_0xf4825a){_0x13e4b0=_0x13e4b0-0x0;var _0x240b14=_0x6071[_0x13e4b0];return _0x240b14;};'use strict';var FaxMessageEvents=require(_0x1607('0x0'));var events=['save','remove','update'];function createListener(_0x409d2c,_0x156d3b){return function(_0x397c7c){_0x156d3b['emit'](_0x409d2c,_0x397c7c);};}function removeListener(_0x49cd17,_0x2f34f1){return function(){FaxMessageEvents[_0x1607('0x1')](_0x49cd17,_0x2f34f1);};}exports[_0x1607('0x2')]=function(_0x464c4d){for(var _0x4e4f09=0x0,_0x659a6b=events[_0x1607('0x3')];_0x4e4f09<_0x659a6b;_0x4e4f09++){var _0x16215e=events[_0x4e4f09];var _0x2ba854=createListener(_0x1607('0x4')+_0x16215e,_0x464c4d);FaxMessageEvents['on'](_0x16215e,_0x2ba854);}}; \ No newline at end of file +var _0xdd0b=['./faxMessage.events','save','remove','update','emit','removeListener','length','faxMessage:'];(function(_0x576833,_0x265cf5){var _0xa24fb2=function(_0x1a9707){while(--_0x1a9707){_0x576833['push'](_0x576833['shift']());}};_0xa24fb2(++_0x265cf5);}(_0xdd0b,0x78));var _0xbdd0=function(_0x284545,_0x19e59d){_0x284545=_0x284545-0x0;var _0x1fb723=_0xdd0b[_0x284545];return _0x1fb723;};'use strict';var FaxMessageEvents=require(_0xbdd0('0x0'));var events=[_0xbdd0('0x1'),_0xbdd0('0x2'),_0xbdd0('0x3')];function createListener(_0x391e7b,_0x71ceb4){return function(_0x1d5a0d){_0x71ceb4[_0xbdd0('0x4')](_0x391e7b,_0x1d5a0d);};}function removeListener(_0x55bf2c,_0x344aef){return function(){FaxMessageEvents[_0xbdd0('0x5')](_0x55bf2c,_0x344aef);};}exports['register']=function(_0x56f05c){for(var _0x1dda57=0x0,_0x47d068=events[_0xbdd0('0x6')];_0x1dda57<_0x47d068;_0x1dda57++){var _0x4f3a5b=events[_0x1dda57];var _0x2fa88=createListener(_0xbdd0('0x7')+_0x4f3a5b,_0x56f05c);FaxMessageEvents['on'](_0x4f3a5b,_0x2fa88);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a02dd8a..7a921aa 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 _0x96cc=['/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4485c9,_0x89680f){var _0x241963=function(_0xfe6dfc){while(--_0xfe6dfc){_0x4485c9['push'](_0x4485c9['shift']());}};_0x241963(++_0x89680f);}(_0x96cc,0x16c));var _0xc96c=function(_0x231be4,_0x2954a5){_0x231be4=_0x231be4-0x0;var _0x50ca1f=_0x96cc[_0x231be4];return _0x50ca1f;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc96c('0x10')]('fax',_0xc96c('0x11')),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0x15'),auth[_0xc96c('0xa')](),controller['accept']);router[_0xc96c('0x13')](_0xc96c('0x16'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x17')]);router[_0xc96c('0x18')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x19')]);module[_0xc96c('0x1a')]=router; \ No newline at end of file +var _0xb332=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','reject','delete','destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb332,0xd9));var _0x2b33=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xb332[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./faxMessage.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2b33('0x9')]);router['get'](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller[_0x2b33('0xb')]);router[_0x2b33('0x6')]('/:id/download',auth[_0x2b33('0x7')](),controller[_0x2b33('0xc')]);router[_0x2b33('0xd')]('/',auth[_0x2b33('0x7')](),interaction[_0x2b33('0xe')](_0x2b33('0xf'),_0x2b33('0x10')),controller[_0x2b33('0x11')]);router[_0x2b33('0x12')](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller['update']);router[_0x2b33('0x12')](_0x2b33('0x13'),auth[_0x2b33('0x7')](),controller['accept']);router[_0x2b33('0x12')]('/:id/reject',auth[_0x2b33('0x7')](),controller[_0x2b33('0x14')]);router[_0x2b33('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2b33('0x16')]);module[_0x2b33('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3c35ad1..e10cb6a 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 _0x3249=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x556bca,_0x573fb9){var _0x16c8fd=function(_0x469625){while(--_0x469625){_0x556bca['push'](_0x556bca['shift']());}};_0x16c8fd(++_0x573fb9);}(_0x3249,0xdf));var _0x9324=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3249[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x9324('0x0'));module[_0x9324('0x1')]={'name':{'type':Sequelize[_0x9324('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9324('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9324('0x3')]('rrmemory',_0x9324('0x4'),_0x9324('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf693=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xf693,0x181));var _0x3f69=function(_0x3cc694,_0x2e60ca){_0x3cc694=_0x3cc694-0x0;var _0x275cbc=_0xf693[_0x3cc694];return _0x275cbc;};'use strict';var Sequelize=require('sequelize');module[_0x3f69('0x0')]={'name':{'type':Sequelize[_0x3f69('0x1')],'unique':_0x3f69('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3f69('0x1')]},'timeout':{'type':Sequelize[_0x3f69('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f69('0x4')](_0x3f69('0x5'),'beepall',_0x3f69('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3f69('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 616f58d..600ffca 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 _0x7bd0=['select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','stack','send','index','map','FaxQueue','rawAttributes','fieldName','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','fields','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','UserFaxQueue','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','updatedAt','format','SIP','createdAt','getTeams','order','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','userFaxQueue:save','removeTeams','ids'];(function(_0x3ac3b6,_0x400dee){var _0x32b400=function(_0x5dae6a){while(--_0x5dae6a){_0x3ac3b6['push'](_0x3ac3b6['shift']());}};_0x32b400(++_0x400dee);}(_0x7bd0,0x111));var _0x07bd=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x7bd0[_0x516ffb];return _0x319667;};'use strict';var BPromise=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var _=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var qs=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));var config=require('../../config/environment');var db=require(_0x07bd('0x8'))['db'];config[_0x07bd('0x9')]=_[_0x07bd('0xa')](config[_0x07bd('0x9')],{'host':_0x07bd('0xb'),'port':0x18eb});var socket=require(_0x07bd('0xc'))(new Redis(config[_0x07bd('0x9')]));require('./faxQueue.socket')[_0x07bd('0xd')](socket);function respondWithStatusCode(_0x5cd446,_0x8032dc){_0x8032dc=_0x8032dc||0xcc;return function(_0xb10241){if(_0xb10241){return _0x5cd446[_0x07bd('0xe')](_0x8032dc);}return _0x5cd446['status'](_0x8032dc)[_0x07bd('0xf')]();};}function respondWithResult(_0x141e8b,_0x324a46){_0x324a46=_0x324a46||0xc8;return function(_0x169b07){if(_0x169b07){return _0x141e8b['status'](_0x324a46)[_0x07bd('0x10')](_0x169b07);}};}function respondWithFilteredResult(_0x313ca5,_0x1b067a){return function(_0x222efa){if(_0x222efa){var _0x456ecd=typeof _0x1b067a[_0x07bd('0x11')]===_0x07bd('0x12')&&typeof _0x1b067a[_0x07bd('0x13')]==='undefined';var _0x51eb2a=_0x222efa[_0x07bd('0x14')];var _0x3fe523=_0x456ecd?0x0:_0x1b067a[_0x07bd('0x11')];var _0x247f3f=_0x456ecd?_0x222efa[_0x07bd('0x14')]:_0x1b067a[_0x07bd('0x11')]+_0x1b067a[_0x07bd('0x13')];var _0x49d962;if(_0x247f3f>=_0x51eb2a){_0x247f3f=_0x51eb2a;_0x49d962=0xc8;}else{_0x49d962=0xce;}_0x313ca5[_0x07bd('0x15')](_0x49d962);return _0x313ca5['set'](_0x07bd('0x16'),_0x3fe523+'-'+_0x247f3f+'/'+_0x51eb2a)[_0x07bd('0x10')](_0x222efa);}return null;};}function saveUpdates(_0x31655a){return function(_0x1713ca){if(_0x1713ca){return _0x1713ca[_0x07bd('0x17')](_0x31655a)['then'](function(_0x3f9f0b){return _0x3f9f0b;});}return null;};}function removeEntity(_0xc4cf4c){return function(_0x4948f4){if(_0x4948f4){return _0x4948f4[_0x07bd('0x18')]()[_0x07bd('0x19')](function(){var _0x758fd5=_0x4948f4[_0x07bd('0x1a')]({'plain':!![]});var _0x36ccec=_0x07bd('0x1b');return db[_0x07bd('0x1c')][_0x07bd('0x18')]({'where':{'type':_0x36ccec,'resourceId':_0x758fd5['id']}})[_0x07bd('0x19')](function(){return _0x4948f4;});})['then'](function(){_0xc4cf4c[_0x07bd('0x15')](0xcc)[_0x07bd('0xf')]();});}};}function handleEntityNotFound(_0xcb8b23){return function(_0x11684d){if(!_0x11684d){_0xcb8b23[_0x07bd('0xe')](0x194);}return _0x11684d;};}function handleError(_0x47bd50,_0x4c673a){_0x4c673a=_0x4c673a||0x1f4;return function(_0xbb7117){logger['error'](_0xbb7117[_0x07bd('0x1d')]);if(_0xbb7117['name']){delete _0xbb7117['name'];}_0x47bd50[_0x07bd('0x15')](_0x4c673a)[_0x07bd('0x1e')](_0xbb7117);};}exports[_0x07bd('0x1f')]=function(_0xdb47ba,_0x28bd91){var _0x43cbc8={};var _0x557042={'count':0x0,'rows':[]};var _0x180b43=_[_0x07bd('0x20')](db[_0x07bd('0x21')][_0x07bd('0x22')],function(_0x12ce26){return{'name':_0x12ce26[_0x07bd('0x23')],'type':_0x12ce26['type']['key']};});_0x43cbc8=qs['getOptions'](_0x180b43,_0xdb47ba);var _0x335d61={'where':_0x43cbc8[_0x07bd('0x24')]};return db[_0x07bd('0x21')]['count'](_0x335d61)[_0x07bd('0x19')](function(_0x400cc0){_0x557042[_0x07bd('0x14')]=_0x400cc0;_0x43cbc8[_0x07bd('0x25')]=qs[_0x07bd('0x25')](_0xdb47ba[_0x07bd('0x26')]);return db['FaxQueue'][_0x07bd('0x27')](_0x43cbc8);})[_0x07bd('0x19')](function(_0x4182b9){_0x557042[_0x07bd('0x28')]=_0x4182b9;return _0x557042;})[_0x07bd('0x19')](respondWithFilteredResult(_0x28bd91,_0x43cbc8))[_0x07bd('0x29')](handleError(_0x28bd91,null));};exports[_0x07bd('0x2a')]=function(_0x456004,_0x4ff162){var _0x594967={'raw':!![],'where':{'id':_0x456004[_0x07bd('0x2b')]['id']}},_0x3fe506={};_0x3fe506[_0x07bd('0x2c')]=_['keys'](db[_0x07bd('0x21')][_0x07bd('0x22')]);_0x3fe506[_0x07bd('0x26')]=_['keys'](_0x456004['query']);_0x3fe506[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],_0x3fe506[_0x07bd('0x26')]);_0x594967['attributes']=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x456004['query'][_0x07bd('0x2f')]));_0x594967[_0x07bd('0x30')]=_0x594967['attributes'][_0x07bd('0x31')]?_0x594967[_0x07bd('0x30')]:_0x3fe506[_0x07bd('0x2c')];if(_0x456004[_0x07bd('0x26')]['includeAll']){_0x594967['include']=[{'all':!![]}];}_0x594967=_[_0x07bd('0x32')]({},_0x594967,_0x456004['options']);return db[_0x07bd('0x21')][_0x07bd('0x33')](_0x594967)[_0x07bd('0x19')](handleEntityNotFound(_0x4ff162,null))[_0x07bd('0x19')](respondWithResult(_0x4ff162,null))[_0x07bd('0x29')](handleError(_0x4ff162,null));};exports[_0x07bd('0x34')]=function(_0x3e63b3,_0x333ac2){return db[_0x07bd('0x21')][_0x07bd('0x34')](_0x3e63b3[_0x07bd('0x35')],{})[_0x07bd('0x19')](function(_0x33067c){var _0x51e8e2=_0x3e63b3[_0x07bd('0x36')][_0x07bd('0x1a')]({'plain':!![]});if(!_0x51e8e2)throw new Error(_0x07bd('0x37'));if(_0x51e8e2[_0x07bd('0x38')]==='user'){var _0x2d2b71=_0x33067c[_0x07bd('0x1a')]({'plain':!![]});var _0x456948=_0x07bd('0x1b');return db[_0x07bd('0x39')]['find']({'where':{'name':_0x456948,'userProfileId':_0x51e8e2['userProfileId']},'raw':!![]})[_0x07bd('0x19')](function(_0x88e174){if(_0x88e174&&_0x88e174[_0x07bd('0x3a')]===0x0){return db[_0x07bd('0x1c')]['create']({'name':_0x2d2b71[_0x07bd('0x3b')],'resourceId':_0x2d2b71['id'],'type':_0x88e174[_0x07bd('0x3b')],'sectionId':_0x88e174['id']},{})[_0x07bd('0x19')](function(){return _0x33067c;});}else{return _0x33067c;}})[_0x07bd('0x29')](function(_0x318b7c){logger[_0x07bd('0x3c')](_0x07bd('0x3d'),_0x318b7c);throw _0x318b7c;});}return _0x33067c;})['then'](respondWithResult(_0x333ac2,0xc9))[_0x07bd('0x29')](handleError(_0x333ac2,null));};exports[_0x07bd('0x17')]=function(_0x33389b,_0x3a5827){if(_0x33389b[_0x07bd('0x35')]['id']){delete _0x33389b['body']['id'];}return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x33389b[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3a5827,null))[_0x07bd('0x19')](saveUpdates(_0x33389b['body'],null))[_0x07bd('0x19')](respondWithResult(_0x3a5827,null))[_0x07bd('0x29')](handleError(_0x3a5827,null));};exports[_0x07bd('0x18')]=function(_0x3954a7,_0x5acb1d){return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0x3954a7[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x5acb1d,null))[_0x07bd('0x19')](removeEntity(_0x5acb1d,null))[_0x07bd('0x29')](handleError(_0x5acb1d,null));};exports[_0x07bd('0x3e')]=function(_0x2d929b,_0x3cc593){return db[_0x07bd('0x21')]['describe']()['then'](respondWithResult(_0x3cc593,null))[_0x07bd('0x29')](handleError(_0x3cc593,null));};exports[_0x07bd('0x3f')]=function(_0x171db8,_0xaa85c5){var _0x44274b={'raw':!![],'where':{}},_0xe534c0={},_0x4f5183;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x171db8[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0xaa85c5,null))[_0x07bd('0x19')](function(_0x4155df){if(_0x4155df){_0x4f5183=_0x4155df['get']({'plain':!![]});_0xe534c0[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db[_0x07bd('0x42')][_0x07bd('0x22')]);_0xe534c0[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x171db8[_0x07bd('0x26')]);_0xe534c0[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0xe534c0[_0x07bd('0x2c')],_0xe534c0[_0x07bd('0x26')]);_0x44274b[_0x07bd('0x30')]=_['intersection'](_0xe534c0[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x171db8[_0x07bd('0x26')]['fields']));_0x44274b['attributes']=_0x44274b[_0x07bd('0x30')]['length']?_0x44274b[_0x07bd('0x30')]:_0xe534c0[_0x07bd('0x2c')];if(!_0x171db8[_0x07bd('0x26')][_0x07bd('0x43')](_0x07bd('0x44'))){_0x44274b[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x171db8[_0x07bd('0x26')]['limit']);_0x44274b[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x171db8[_0x07bd('0x26')]['offset']);}_0x44274b['order']=qs['sort'](_0x171db8[_0x07bd('0x26')][_0x07bd('0x45')]);_0x44274b[_0x07bd('0x24')]=qs['filters'](_[_0x07bd('0x46')](_0x171db8[_0x07bd('0x26')],_0xe534c0[_0x07bd('0x2d')]));_0x44274b[_0x07bd('0x24')][_0x07bd('0x47')]=_0x4155df['id'];if(_0x171db8[_0x07bd('0x26')]['filter']){_0x44274b['where']=_[_0x07bd('0x32')](_0x44274b['where'],{'$or':_['map'](_0x44274b[_0x07bd('0x30')],function(_0x2d6eae){var _0xf12249={};_0xf12249[_0x2d6eae]={'$like':'%'+_0x171db8['query'][_0x07bd('0x48')]+'%'};return _0xf12249;})});}_0x44274b=_[_0x07bd('0x32')]({},_0x44274b,_0x171db8[_0x07bd('0x49')]);return db[_0x07bd('0x42')][_0x07bd('0x27')](_0x44274b);}})[_0x07bd('0x19')](function(_0x1982be){if(_0x1982be){return db[_0x07bd('0x4a')][_0x07bd('0x4b')]({'where':{'id':_['map'](_0x1982be,_0x07bd('0x4c')),'role':'agent'},'attributes':['id',_0x07bd('0x3b'),_0x07bd('0x4d'),_0x07bd('0x4e'),'createdAt']});}})[_0x07bd('0x19')](function(_0x5cb398){if(_0x5cb398){return{'count':_0x5cb398[_0x07bd('0x14')],'rows':_[_0x07bd('0x20')](_0x5cb398[_0x07bd('0x28')],function(_0xdde48d){return{'membername':_0xdde48d['name'],'UserId':_0xdde48d['id'],'queue_name':_0x4f5183['name'],'FaxQueueId':_0x4f5183['id'],'interface':util[_0x07bd('0x4f')]('%s/%s',_0x07bd('0x50'),_0xdde48d[_0x07bd('0x3b')]),'penalty':0x0,'paused':_0xdde48d[_0x07bd('0x4d')],'createdAt':_0xdde48d[_0x07bd('0x51')],'updatedAt':_0xdde48d[_0x07bd('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07bd('0x19')](respondWithFilteredResult(_0xaa85c5,_0x44274b))['catch'](handleError(_0xaa85c5,null));};exports[_0x07bd('0x52')]=function(_0x23103c,_0x3d154d){var _0x15573d={};var _0xe086={};var _0x493175;var _0x2837ab;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x23103c['params']['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d154d,null))['then'](function(_0x230053){if(_0x230053){_0x493175=_0x230053;_0xe086[_0x07bd('0x2c')]=_['keys'](db['Team'][_0x07bd('0x22')]);_0xe086[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x23103c[_0x07bd('0x26')]);_0xe086[_0x07bd('0x2d')]=_['intersection'](_0xe086[_0x07bd('0x2c')],_0xe086['query']);_0x15573d[_0x07bd('0x30')]=_['intersection'](_0xe086[_0x07bd('0x2c')],qs['fields'](_0x23103c['query'][_0x07bd('0x2f')]));_0x15573d[_0x07bd('0x30')]=_0x15573d[_0x07bd('0x30')][_0x07bd('0x31')]?_0x15573d[_0x07bd('0x30')]:_0xe086[_0x07bd('0x2c')];_0x15573d[_0x07bd('0x53')]=qs[_0x07bd('0x45')](_0x23103c[_0x07bd('0x26')][_0x07bd('0x45')]);_0x15573d['where']=qs[_0x07bd('0x2d')](_['pick'](_0x23103c[_0x07bd('0x26')],_0xe086[_0x07bd('0x2d')]));if(_0x23103c[_0x07bd('0x26')]['filter']){_0x15573d[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x15573d[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x15573d[_0x07bd('0x30')],function(_0x28ec9e){var _0x307cf7={};_0x307cf7[_0x28ec9e]={'$like':'%'+_0x23103c['query'][_0x07bd('0x48')]+'%'};return _0x307cf7;})});}_0x15573d=_[_0x07bd('0x32')]({},_0x15573d,_0x23103c[_0x07bd('0x49')]);return _0x493175['getTeams'](_0x15573d);}})[_0x07bd('0x19')](function(_0xa83eb9){if(_0xa83eb9){_0x2837ab=_0xa83eb9[_0x07bd('0x31')];if(!_0x23103c[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x15573d[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x23103c[_0x07bd('0x26')]['limit']);_0x15573d[_0x07bd('0x11')]=qs['offset'](_0x23103c[_0x07bd('0x26')][_0x07bd('0x11')]);}return _0x493175[_0x07bd('0x52')](_0x15573d);}})[_0x07bd('0x19')](function(_0x5be4ef){if(_0x5be4ef){return _0x5be4ef?{'count':_0x2837ab,'rows':_0x5be4ef}:null;}})[_0x07bd('0x19')](respondWithResult(_0x3d154d,null))[_0x07bd('0x29')](handleError(_0x3d154d,null));};exports[_0x07bd('0x54')]=function(_0xb83fd2,_0x388962){var _0x40a6b9=_0xb83fd2[_0x07bd('0x35')]['ids'];return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x40a6b9},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':_0x07bd('0x56'),'attributes':['id',_0x07bd('0x3b'),'online',_0x07bd('0x57'),_0x07bd('0x58')],'raw':!![]}]})[_0x07bd('0x19')](function(_0x50aad3){if(_0x50aad3){var _0xadb15b=_[_0x07bd('0x59')](_0x50aad3,function(_0x6a958e){var _0x2deb53=_0x6a958e[_0x07bd('0x1a')]({'plain':!![]});return _0x2deb53['Agents'];});return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0xb83fd2[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x2582ec){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0x2e79a8){return _0x2582ec[_0x07bd('0x54')](_0x40a6b9,{'transaction':_0x2e79a8})[_0x07bd('0x19')](function(){return BPromise['each'](_0xadb15b,function(_0x16f902){return db[_0x07bd('0x42')][_0x07bd('0x5c')]({'where':{'UserId':_0x16f902['id'],'FaxQueueId':_0xb83fd2[_0x07bd('0x2b')]['id']},'transaction':_0x2e79a8});});})[_0x07bd('0x19')](function(){_0xadb15b['forEach'](function(_0x38f316){socket['emit'](_0x07bd('0x5d'),{'UserId':_0x38f316['id'],'FaxQueueId':_0x2582ec['id']});});});});});}})[_0x07bd('0x19')](respondWithStatusCode(_0x388962,null))['catch'](handleError(_0x388962,null));};exports[_0x07bd('0x5e')]=function(_0x51c697,_0x4a79c6){return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07bd('0x19')](handleEntityNotFound(_0x4a79c6,null))[_0x07bd('0x19')](function(_0x193c87){var _0x591fc3=_[_0x07bd('0x20')](_0x193c87,'id');var _0x3d9964=[];var _0x5a9ef5=[];var _0x1f892d=squel[_0x07bd('0x60')]();_0x1f892d['field'](_0x07bd('0x61'))[_0x07bd('0x62')](_0x07bd('0x63'),'tq')[_0x07bd('0x64')](_0x07bd('0x65'),'ut',_0x07bd('0x66'))[_0x07bd('0x24')](_0x07bd('0x67'),_0x51c697['params']['id']);for(var _0x780517=0x0;_0x780517<_0x193c87[_0x07bd('0x31')];_0x780517+=0x1){let _0x4e331d=_0x193c87[_0x780517];for(var _0x31a9ac=0x0;_0x31a9ac<_0x4e331d[_0x07bd('0x56')][_0x07bd('0x31')];_0x31a9ac+=0x1){let _0x7d85c2=_0x4e331d['Agents'][_0x31a9ac];var _0x3307dc=_0x1f892d[_0x07bd('0x68')]();_0x3307dc[_0x07bd('0x24')](_0x07bd('0x69'),_0x7d85c2['id']);_0x5a9ef5['push'](db[_0x07bd('0x5a')][_0x07bd('0x26')](_0x3307dc[_0x07bd('0x6a')](),{'type':db[_0x07bd('0x5a')][_0x07bd('0x6b')][_0x07bd('0x6c')]})[_0x07bd('0x19')](function(_0x27fa8b){if(_0x27fa8b[_0x07bd('0x31')]===0x1){return _0x7d85c2['id'];}else{var _0x179e1d=_[_0x07bd('0x6d')](_[_0x07bd('0x20')](_0x27fa8b,_0x07bd('0x6e')),function(_0x3cd40c){return _[_0x07bd('0x6f')](_0x591fc3,_0x3cd40c);});if(_0x179e1d){return _0x7d85c2['id'];}}}));}}return BPromise[_0x07bd('0x70')](_0x5a9ef5)[_0x07bd('0x19')](function(_0xd02a4e){_0x3d9964=_(_0x3d9964)['union'](_0xd02a4e)[_0x07bd('0x71')]()[_0x07bd('0x72')]();return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x51c697[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x13c81f){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0xdc66d1){return _0x13c81f['removeTeams'](_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')],{'transaction':_0xdc66d1})[_0x07bd('0x19')](function(){if(!_[_0x07bd('0x73')](_0x3d9964)){return _0x13c81f[_0x07bd('0x74')](_0x3d9964,{'transaction':_0xdc66d1});}})[_0x07bd('0x19')](function(){_0x3d9964[_0x07bd('0x75')](function(_0x3a39df){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':_0x3a39df,'FaxQueueId':_0x13c81f['id']});});});});});});})[_0x07bd('0x19')](respondWithStatusCode(_0x4a79c6,null))[_0x07bd('0x29')](handleError(_0x4a79c6,null));};exports[_0x07bd('0x78')]=function(_0x2af323,_0x3d1c9b){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x2af323[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d1c9b,null))[_0x07bd('0x19')](function(_0x4546da){if(_0x4546da){return _0x4546da[_0x07bd('0x78')](_0x2af323['body'][_0x07bd('0x5f')],_[_0x07bd('0x79')](_0x2af323['body'],[_0x07bd('0x5f'),'id'])||{})['spread'](function(_0x335398){for(var _0x5adf01=0x0;_0x5adf01<_0x2af323[_0x07bd('0x35')][_0x07bd('0x5f')]['length'];_0x5adf01+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x5d'),{'UserId':Number(_0x2af323['body'][_0x07bd('0x5f')][_0x5adf01]),'FaxQueueId':Number(_0x2af323['params']['id'])});}return _0x335398;});}})[_0x07bd('0x19')](respondWithResult(_0x3d1c9b,null))[_0x07bd('0x29')](handleError(_0x3d1c9b,null));};exports[_0x07bd('0x74')]=function(_0x349e55,_0xaac9a4){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x349e55['params']['id']}})['then'](handleEntityNotFound(_0xaac9a4,null))[_0x07bd('0x19')](function(_0x663616){if(_0x663616){return _0x663616[_0x07bd('0x74')](_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')])[_0x07bd('0x19')](function(){if(_['isArray'](_0x349e55[_0x07bd('0x26')]['ids'])){for(var _0x3af55a=0x0;_0x3af55a<_0x349e55['query'][_0x07bd('0x5f')][_0x07bd('0x31')];_0x3af55a+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')]['ids'][_0x3af55a]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}}else{socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}});}})[_0x07bd('0x19')](respondWithStatusCode(_0xaac9a4,null))[_0x07bd('0x29')](handleError(_0xaac9a4,null));};exports[_0x07bd('0x7a')]=function(_0x59b954,_0x95eeb8){var _0x3ca8ed={};var _0x1d8d26={};var _0x576e89;var _0x234fb4;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x59b954[_0x07bd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x95eeb8,null))[_0x07bd('0x19')](function(_0x337d52){if(_0x337d52){_0x576e89=_0x337d52;_0x1d8d26[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db['User'][_0x07bd('0x22')]);_0x1d8d26[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x59b954['query']);_0x1d8d26[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x1d8d26[_0x07bd('0x2c')],_0x1d8d26[_0x07bd('0x26')]);_0x3ca8ed['attributes']=_['intersection'](_0x1d8d26[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x59b954[_0x07bd('0x26')][_0x07bd('0x2f')]));_0x3ca8ed[_0x07bd('0x30')]=_0x3ca8ed[_0x07bd('0x30')][_0x07bd('0x31')]?_0x3ca8ed['attributes']:_0x1d8d26['model'];_0x3ca8ed[_0x07bd('0x53')]=qs['sort'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x45')]);_0x3ca8ed['where']=qs[_0x07bd('0x2d')](_[_0x07bd('0x46')](_0x59b954[_0x07bd('0x26')],_0x1d8d26[_0x07bd('0x2d')]));if(_0x59b954['query']['filter']){_0x3ca8ed[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x3ca8ed[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x3ca8ed[_0x07bd('0x30')],function(_0x4505d6){var _0xc0e79f={};_0xc0e79f[_0x4505d6]={'$like':'%'+_0x59b954[_0x07bd('0x26')]['filter']+'%'};return _0xc0e79f;})});}_0x3ca8ed=_[_0x07bd('0x32')]({},_0x3ca8ed,_0x59b954['options']);return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})['then'](function(_0x2c5b0e){if(_0x2c5b0e){_0x234fb4=_0x2c5b0e[_0x07bd('0x31')];if(!_0x59b954[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x3ca8ed[_0x07bd('0x13')]=qs['limit'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x13')]);_0x3ca8ed[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x59b954['query'][_0x07bd('0x11')]);}return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})[_0x07bd('0x19')](function(_0x40b94a){if(_0x40b94a){return _0x40b94a?{'count':_0x234fb4,'rows':_0x40b94a}:null;}})[_0x07bd('0x19')](respondWithResult(_0x95eeb8,null))['catch'](handleError(_0x95eeb8,null));}; \ No newline at end of file +var _0x7f94=['name','send','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','body','describe','getMembers','findOne','nolimit','order','sort','pick','FaxQueueId','filter','map','UserFaxQueue','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','hasOwnProperty','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','destroy','then','get','FaxQueues','UserProfileResource','error','stack'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f94,0x65));var _0x47f9=function(_0x472d19,_0x30320c){_0x472d19=_0x472d19-0x0;var _0x3cf613=_0x7f94[_0x472d19];return _0x3cf613;};'use strict';var BPromise=require(_0x47f9('0x0'));var util=require('util');var _=require(_0x47f9('0x1'));var squel=require(_0x47f9('0x2'));var Redis=require(_0x47f9('0x3'));var qs=require(_0x47f9('0x4'));var logger=require('../../config/logger')(_0x47f9('0x5'));var config=require(_0x47f9('0x6'));var db=require(_0x47f9('0x7'))['db'];config[_0x47f9('0x8')]=_[_0x47f9('0x9')](config[_0x47f9('0x8')],{'host':_0x47f9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47f9('0x8')]));require(_0x47f9('0xb'))[_0x47f9('0xc')](socket);function respondWithStatusCode(_0x3240cf,_0x1e38fc){_0x1e38fc=_0x1e38fc||0xcc;return function(_0x2ced9c){if(_0x2ced9c){return _0x3240cf[_0x47f9('0xd')](_0x1e38fc);}return _0x3240cf['status'](_0x1e38fc)['end']();};}function respondWithResult(_0x56ebcf,_0x578fbe){_0x578fbe=_0x578fbe||0xc8;return function(_0x2f4e9d){if(_0x2f4e9d){return _0x56ebcf[_0x47f9('0xe')](_0x578fbe)[_0x47f9('0xf')](_0x2f4e9d);}};}function respondWithFilteredResult(_0x32cb8f,_0x2923af){return function(_0x1da330){if(_0x1da330){var _0x5aecd3=typeof _0x2923af['offset']===_0x47f9('0x10')&&typeof _0x2923af['limit']==='undefined';var _0x5bb313=_0x1da330[_0x47f9('0x11')];var _0x43e4db=_0x5aecd3?0x0:_0x2923af['offset'];var _0x166860=_0x5aecd3?_0x1da330[_0x47f9('0x11')]:_0x2923af[_0x47f9('0x12')]+_0x2923af[_0x47f9('0x13')];var _0x48cc81;if(_0x166860>=_0x5bb313){_0x166860=_0x5bb313;_0x48cc81=0xc8;}else{_0x48cc81=0xce;}_0x32cb8f[_0x47f9('0xe')](_0x48cc81);return _0x32cb8f[_0x47f9('0x14')](_0x47f9('0x15'),_0x43e4db+'-'+_0x166860+'/'+_0x5bb313)[_0x47f9('0xf')](_0x1da330);}return null;};}function saveUpdates(_0x27ad5e){return function(_0x4b22d1){if(_0x4b22d1){return _0x4b22d1['update'](_0x27ad5e)['then'](function(_0xd80474){return _0xd80474;});}return null;};}function removeEntity(_0x429f94){return function(_0x32bb57){if(_0x32bb57){return _0x32bb57[_0x47f9('0x16')]()[_0x47f9('0x17')](function(){var _0x13a097=_0x32bb57[_0x47f9('0x18')]({'plain':!![]});var _0x22b4a7=_0x47f9('0x19');return db[_0x47f9('0x1a')][_0x47f9('0x16')]({'where':{'type':_0x22b4a7,'resourceId':_0x13a097['id']}})[_0x47f9('0x17')](function(){return _0x32bb57;});})[_0x47f9('0x17')](function(){_0x429f94['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x151686){return function(_0x4ed062){if(!_0x4ed062){_0x151686[_0x47f9('0xd')](0x194);}return _0x4ed062;};}function handleError(_0x29b7f8,_0x2ecf99){_0x2ecf99=_0x2ecf99||0x1f4;return function(_0x50bf58){logger[_0x47f9('0x1b')](_0x50bf58[_0x47f9('0x1c')]);if(_0x50bf58[_0x47f9('0x1d')]){delete _0x50bf58[_0x47f9('0x1d')];}_0x29b7f8['status'](_0x2ecf99)[_0x47f9('0x1e')](_0x50bf58);};}exports[_0x47f9('0x1f')]=function(_0x528ab1,_0x5b3d90){var _0x26bd84={};var _0x4c16e0={'count':0x0,'rows':[]};var _0x76077d=_['map'](db[_0x47f9('0x20')][_0x47f9('0x21')],function(_0x5dbdda){return{'name':_0x5dbdda[_0x47f9('0x22')],'type':_0x5dbdda[_0x47f9('0x23')][_0x47f9('0x24')]};});_0x26bd84=qs[_0x47f9('0x25')](_0x76077d,_0x528ab1);var _0x25694e={'where':_0x26bd84[_0x47f9('0x26')]};return db[_0x47f9('0x20')]['count'](_0x25694e)['then'](function(_0x4c37d2){_0x4c16e0['count']=_0x4c37d2;_0x26bd84[_0x47f9('0x27')]=qs['include'](_0x528ab1[_0x47f9('0x28')]);return db[_0x47f9('0x20')][_0x47f9('0x29')](_0x26bd84);})[_0x47f9('0x17')](function(_0x35c86c){_0x4c16e0[_0x47f9('0x2a')]=_0x35c86c;return _0x4c16e0;})['then'](respondWithFilteredResult(_0x5b3d90,_0x26bd84))['catch'](handleError(_0x5b3d90,null));};exports[_0x47f9('0x2b')]=function(_0x36be30,_0x4c4367){var _0x1e22b1={'raw':!![],'where':{'id':_0x36be30[_0x47f9('0x2c')]['id']}},_0x25de3f={};_0x25de3f[_0x47f9('0x2d')]=_[_0x47f9('0x2e')](db[_0x47f9('0x20')][_0x47f9('0x21')]);_0x25de3f[_0x47f9('0x28')]=_[_0x47f9('0x2e')](_0x36be30[_0x47f9('0x28')]);_0x25de3f[_0x47f9('0x2f')]=_[_0x47f9('0x30')](_0x25de3f[_0x47f9('0x2d')],_0x25de3f['query']);_0x1e22b1[_0x47f9('0x31')]=_[_0x47f9('0x30')](_0x25de3f['model'],qs[_0x47f9('0x32')](_0x36be30[_0x47f9('0x28')]['fields']));_0x1e22b1[_0x47f9('0x31')]=_0x1e22b1['attributes'][_0x47f9('0x33')]?_0x1e22b1[_0x47f9('0x31')]:_0x25de3f[_0x47f9('0x2d')];if(_0x36be30['query'][_0x47f9('0x34')]){_0x1e22b1[_0x47f9('0x27')]=[{'all':!![]}];}_0x1e22b1=_[_0x47f9('0x35')]({},_0x1e22b1,_0x36be30[_0x47f9('0x36')]);return db[_0x47f9('0x20')]['find'](_0x1e22b1)['then'](handleEntityNotFound(_0x4c4367,null))['then'](respondWithResult(_0x4c4367,null))[_0x47f9('0x37')](handleError(_0x4c4367,null));};exports[_0x47f9('0x38')]=function(_0x2373ed,_0x49ffbf){return db['FaxQueue'][_0x47f9('0x38')](_0x2373ed['body'],{})[_0x47f9('0x17')](function(_0x5d5616){var _0x563492=_0x2373ed[_0x47f9('0x39')]['get']({'plain':!![]});if(!_0x563492)throw new Error(_0x47f9('0x3a'));if(_0x563492[_0x47f9('0x3b')]===_0x47f9('0x39')){var _0x27195b=_0x5d5616[_0x47f9('0x18')]({'plain':!![]});var _0x3f7ef6=_0x47f9('0x19');return db['UserProfileSection']['find']({'where':{'name':_0x3f7ef6,'userProfileId':_0x563492[_0x47f9('0x3c')]},'raw':!![]})[_0x47f9('0x17')](function(_0x118db1){if(_0x118db1&&_0x118db1[_0x47f9('0x3d')]===0x0){return db[_0x47f9('0x1a')]['create']({'name':_0x27195b[_0x47f9('0x1d')],'resourceId':_0x27195b['id'],'type':_0x118db1[_0x47f9('0x1d')],'sectionId':_0x118db1['id']},{})[_0x47f9('0x17')](function(){return _0x5d5616;});}else{return _0x5d5616;}})[_0x47f9('0x37')](function(_0x3128bc){logger[_0x47f9('0x1b')](_0x47f9('0x3e'),_0x3128bc);throw _0x3128bc;});}return _0x5d5616;})[_0x47f9('0x17')](respondWithResult(_0x49ffbf,0xc9))['catch'](handleError(_0x49ffbf,null));};exports[_0x47f9('0x3f')]=function(_0xc61254,_0x55443d){if(_0xc61254['body']['id']){delete _0xc61254['body']['id'];}return db[_0x47f9('0x20')][_0x47f9('0x40')]({'where':{'id':_0xc61254[_0x47f9('0x2c')]['id']}})[_0x47f9('0x17')](handleEntityNotFound(_0x55443d,null))[_0x47f9('0x17')](saveUpdates(_0xc61254[_0x47f9('0x41')],null))[_0x47f9('0x17')](respondWithResult(_0x55443d,null))[_0x47f9('0x37')](handleError(_0x55443d,null));};exports[_0x47f9('0x16')]=function(_0x1e08bc,_0x562765){return db['FaxQueue']['find']({'where':{'id':_0x1e08bc[_0x47f9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x562765,null))[_0x47f9('0x17')](removeEntity(_0x562765,null))[_0x47f9('0x37')](handleError(_0x562765,null));};exports['describe']=function(_0x25ee9d,_0xd46be4){return db['FaxQueue'][_0x47f9('0x42')]()[_0x47f9('0x17')](respondWithResult(_0xd46be4,null))['catch'](handleError(_0xd46be4,null));};exports[_0x47f9('0x43')]=function(_0x258384,_0xe48c89){var _0x3c4584={'raw':!![],'where':{}},_0x10d099={},_0x416372;return db[_0x47f9('0x20')][_0x47f9('0x44')]({'where':{'id':_0x258384[_0x47f9('0x2c')]['id']}})[_0x47f9('0x17')](handleEntityNotFound(_0xe48c89,null))[_0x47f9('0x17')](function(_0x12c69e){if(_0x12c69e){_0x416372=_0x12c69e[_0x47f9('0x18')]({'plain':!![]});_0x10d099[_0x47f9('0x2d')]=_[_0x47f9('0x2e')](db['UserFaxQueue'][_0x47f9('0x21')]);_0x10d099[_0x47f9('0x28')]=_['keys'](_0x258384[_0x47f9('0x28')]);_0x10d099[_0x47f9('0x2f')]=_[_0x47f9('0x30')](_0x10d099['model'],_0x10d099['query']);_0x3c4584[_0x47f9('0x31')]=_['intersection'](_0x10d099[_0x47f9('0x2d')],qs['fields'](_0x258384['query'][_0x47f9('0x32')]));_0x3c4584[_0x47f9('0x31')]=_0x3c4584[_0x47f9('0x31')][_0x47f9('0x33')]?_0x3c4584['attributes']:_0x10d099[_0x47f9('0x2d')];if(!_0x258384['query']['hasOwnProperty'](_0x47f9('0x45'))){_0x3c4584[_0x47f9('0x13')]=qs[_0x47f9('0x13')](_0x258384[_0x47f9('0x28')][_0x47f9('0x13')]);_0x3c4584[_0x47f9('0x12')]=qs['offset'](_0x258384[_0x47f9('0x28')][_0x47f9('0x12')]);}_0x3c4584[_0x47f9('0x46')]=qs[_0x47f9('0x47')](_0x258384[_0x47f9('0x28')][_0x47f9('0x47')]);_0x3c4584[_0x47f9('0x26')]=qs[_0x47f9('0x2f')](_[_0x47f9('0x48')](_0x258384[_0x47f9('0x28')],_0x10d099['filters']));_0x3c4584[_0x47f9('0x26')][_0x47f9('0x49')]=_0x12c69e['id'];if(_0x258384['query'][_0x47f9('0x4a')]){_0x3c4584[_0x47f9('0x26')]=_[_0x47f9('0x35')](_0x3c4584[_0x47f9('0x26')],{'$or':_[_0x47f9('0x4b')](_0x3c4584[_0x47f9('0x31')],function(_0x913c3b){var _0x165a42={};_0x165a42[_0x913c3b]={'$like':'%'+_0x258384[_0x47f9('0x28')][_0x47f9('0x4a')]+'%'};return _0x165a42;})});}_0x3c4584=_[_0x47f9('0x35')]({},_0x3c4584,_0x258384['options']);return db[_0x47f9('0x4c')][_0x47f9('0x29')](_0x3c4584);}})[_0x47f9('0x17')](function(_0x21c457){if(_0x21c457){return db['User'][_0x47f9('0x4d')]({'where':{'id':_['map'](_0x21c457,'UserId'),'role':_0x47f9('0x4e')},'attributes':['id',_0x47f9('0x1d'),_0x47f9('0x4f'),_0x47f9('0x50'),'createdAt']});}})['then'](function(_0x4efe6a){if(_0x4efe6a){return{'count':_0x4efe6a[_0x47f9('0x11')],'rows':_[_0x47f9('0x4b')](_0x4efe6a[_0x47f9('0x2a')],function(_0x1c9ed8){return{'membername':_0x1c9ed8[_0x47f9('0x1d')],'UserId':_0x1c9ed8['id'],'queue_name':_0x416372['name'],'FaxQueueId':_0x416372['id'],'interface':util[_0x47f9('0x51')](_0x47f9('0x52'),_0x47f9('0x53'),_0x1c9ed8[_0x47f9('0x1d')]),'penalty':0x0,'paused':_0x1c9ed8[_0x47f9('0x4f')],'createdAt':_0x1c9ed8[_0x47f9('0x54')],'updatedAt':_0x1c9ed8[_0x47f9('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x47f9('0x17')](respondWithFilteredResult(_0xe48c89,_0x3c4584))[_0x47f9('0x37')](handleError(_0xe48c89,null));};exports[_0x47f9('0x55')]=function(_0x592de0,_0x2ef58b){var _0x48a8b3={};var _0x51e0d2={};var _0x45dbed;var _0x535ddf;return db[_0x47f9('0x20')][_0x47f9('0x44')]({'where':{'id':_0x592de0[_0x47f9('0x2c')]['id']}})[_0x47f9('0x17')](handleEntityNotFound(_0x2ef58b,null))[_0x47f9('0x17')](function(_0x266b94){if(_0x266b94){_0x45dbed=_0x266b94;_0x51e0d2[_0x47f9('0x2d')]=_[_0x47f9('0x2e')](db[_0x47f9('0x56')][_0x47f9('0x21')]);_0x51e0d2[_0x47f9('0x28')]=_['keys'](_0x592de0[_0x47f9('0x28')]);_0x51e0d2[_0x47f9('0x2f')]=_[_0x47f9('0x30')](_0x51e0d2[_0x47f9('0x2d')],_0x51e0d2[_0x47f9('0x28')]);_0x48a8b3[_0x47f9('0x31')]=_[_0x47f9('0x30')](_0x51e0d2[_0x47f9('0x2d')],qs['fields'](_0x592de0['query'][_0x47f9('0x32')]));_0x48a8b3[_0x47f9('0x31')]=_0x48a8b3[_0x47f9('0x31')][_0x47f9('0x33')]?_0x48a8b3[_0x47f9('0x31')]:_0x51e0d2[_0x47f9('0x2d')];_0x48a8b3[_0x47f9('0x46')]=qs[_0x47f9('0x47')](_0x592de0['query']['sort']);_0x48a8b3[_0x47f9('0x26')]=qs[_0x47f9('0x2f')](_['pick'](_0x592de0[_0x47f9('0x28')],_0x51e0d2[_0x47f9('0x2f')]));if(_0x592de0['query'][_0x47f9('0x4a')]){_0x48a8b3['where']=_[_0x47f9('0x35')](_0x48a8b3[_0x47f9('0x26')],{'$or':_[_0x47f9('0x4b')](_0x48a8b3[_0x47f9('0x31')],function(_0x57200c){var _0x99382={};_0x99382[_0x57200c]={'$like':'%'+_0x592de0[_0x47f9('0x28')][_0x47f9('0x4a')]+'%'};return _0x99382;})});}_0x48a8b3=_[_0x47f9('0x35')]({},_0x48a8b3,_0x592de0[_0x47f9('0x36')]);return _0x45dbed[_0x47f9('0x55')](_0x48a8b3);}})[_0x47f9('0x17')](function(_0x59c7a2){if(_0x59c7a2){_0x535ddf=_0x59c7a2[_0x47f9('0x33')];if(!_0x592de0['query'][_0x47f9('0x57')](_0x47f9('0x45'))){_0x48a8b3[_0x47f9('0x13')]=qs[_0x47f9('0x13')](_0x592de0['query']['limit']);_0x48a8b3[_0x47f9('0x12')]=qs['offset'](_0x592de0[_0x47f9('0x28')][_0x47f9('0x12')]);}return _0x45dbed[_0x47f9('0x55')](_0x48a8b3);}})[_0x47f9('0x17')](function(_0x2a73e9){if(_0x2a73e9){return _0x2a73e9?{'count':_0x535ddf,'rows':_0x2a73e9}:null;}})[_0x47f9('0x17')](respondWithResult(_0x2ef58b,null))[_0x47f9('0x37')](handleError(_0x2ef58b,null));};exports[_0x47f9('0x58')]=function(_0x1207f4,_0x56d329){var _0x363818=_0x1207f4[_0x47f9('0x41')][_0x47f9('0x59')];return db[_0x47f9('0x56')][_0x47f9('0x29')]({'where':{'id':_0x363818},'attributes':['id'],'include':[{'model':db[_0x47f9('0x5a')],'as':'Agents','attributes':['id',_0x47f9('0x1d'),_0x47f9('0x5b'),_0x47f9('0x5c'),_0x47f9('0x5d')],'raw':!![]}]})[_0x47f9('0x17')](function(_0x3cbc90){if(_0x3cbc90){var _0x3ddb8b=_[_0x47f9('0x5e')](_0x3cbc90,function(_0x5c0b3f){var _0x27b004=_0x5c0b3f[_0x47f9('0x18')]({'plain':!![]});return _0x27b004[_0x47f9('0x5f')];});return db['FaxQueue'][_0x47f9('0x40')]({'where':{'id':_0x1207f4[_0x47f9('0x2c')]['id']}})[_0x47f9('0x17')](function(_0x1cca1c){return db[_0x47f9('0x60')][_0x47f9('0x61')](function(_0x288880){return _0x1cca1c[_0x47f9('0x58')](_0x363818,{'transaction':_0x288880})['then'](function(){return BPromise[_0x47f9('0x62')](_0x3ddb8b,function(_0x2b213a){return db['UserFaxQueue'][_0x47f9('0x63')]({'where':{'UserId':_0x2b213a['id'],'FaxQueueId':_0x1207f4[_0x47f9('0x2c')]['id']},'transaction':_0x288880});});})[_0x47f9('0x17')](function(){_0x3ddb8b[_0x47f9('0x64')](function(_0x233d7e){socket[_0x47f9('0x65')](_0x47f9('0x66'),{'UserId':_0x233d7e['id'],'FaxQueueId':_0x1cca1c['id']});});});});});}})[_0x47f9('0x17')](respondWithStatusCode(_0x56d329,null))[_0x47f9('0x37')](handleError(_0x56d329,null));};exports[_0x47f9('0x67')]=function(_0x976ee0,_0x186735){return db['Team']['findAll']({'where':{'id':_0x976ee0['query'][_0x47f9('0x59')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x47f9('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x47f9('0x17')](handleEntityNotFound(_0x186735,null))[_0x47f9('0x17')](function(_0x192d0c){var _0x13df66=_[_0x47f9('0x4b')](_0x192d0c,'id');var _0x172bd9=[];var _0x97bddc=[];var _0x6e1d91=squel[_0x47f9('0x68')]();_0x6e1d91[_0x47f9('0x69')](_0x47f9('0x6a'))[_0x47f9('0x6b')](_0x47f9('0x6c'),'tq')[_0x47f9('0x6d')](_0x47f9('0x6e'),'ut',_0x47f9('0x6f'))[_0x47f9('0x26')]('FaxQueueId\x20=\x20?',_0x976ee0[_0x47f9('0x2c')]['id']);for(var _0x483ed9=0x0;_0x483ed9<_0x192d0c[_0x47f9('0x33')];_0x483ed9+=0x1){let _0x3d91c7=_0x192d0c[_0x483ed9];for(var _0x219629=0x0;_0x219629<_0x3d91c7[_0x47f9('0x5f')][_0x47f9('0x33')];_0x219629+=0x1){let _0x22cdd4=_0x3d91c7[_0x47f9('0x5f')][_0x219629];var _0x5f2876=_0x6e1d91[_0x47f9('0x70')]();_0x5f2876[_0x47f9('0x26')](_0x47f9('0x71'),_0x22cdd4['id']);_0x97bddc[_0x47f9('0x72')](db[_0x47f9('0x60')][_0x47f9('0x28')](_0x5f2876['toString'](),{'type':db[_0x47f9('0x60')][_0x47f9('0x73')][_0x47f9('0x74')]})['then'](function(_0x4cb084){if(_0x4cb084['length']===0x1){return _0x22cdd4['id'];}else{var _0x1ecf43=_[_0x47f9('0x75')](_[_0x47f9('0x4b')](_0x4cb084,_0x47f9('0x76')),function(_0x40fe03){return _[_0x47f9('0x77')](_0x13df66,_0x40fe03);});if(_0x1ecf43){return _0x22cdd4['id'];}}}));}}return BPromise['all'](_0x97bddc)[_0x47f9('0x17')](function(_0x587ce9){_0x172bd9=_(_0x172bd9)[_0x47f9('0x78')](_0x587ce9)[_0x47f9('0x79')]()['value']();return db[_0x47f9('0x20')][_0x47f9('0x40')]({'where':{'id':_0x976ee0['params']['id']}})[_0x47f9('0x17')](function(_0x45d2c1){return db[_0x47f9('0x60')][_0x47f9('0x61')](function(_0x5890c0){return _0x45d2c1['removeTeams'](_0x976ee0[_0x47f9('0x28')][_0x47f9('0x59')],{'transaction':_0x5890c0})[_0x47f9('0x17')](function(){if(!_[_0x47f9('0x7a')](_0x172bd9)){return _0x45d2c1['removeAgents'](_0x172bd9,{'transaction':_0x5890c0});}})[_0x47f9('0x17')](function(){_0x172bd9[_0x47f9('0x64')](function(_0x34b297){socket[_0x47f9('0x65')]('userFaxQueue:remove',{'UserId':_0x34b297,'FaxQueueId':_0x45d2c1['id']});});});});});});})[_0x47f9('0x17')](respondWithStatusCode(_0x186735,null))[_0x47f9('0x37')](handleError(_0x186735,null));};exports[_0x47f9('0x7b')]=function(_0x489809,_0x32ba0f){return db[_0x47f9('0x20')][_0x47f9('0x40')]({'where':{'id':_0x489809[_0x47f9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x32ba0f,null))[_0x47f9('0x17')](function(_0x6d3eab){if(_0x6d3eab){return _0x6d3eab[_0x47f9('0x7b')](_0x489809[_0x47f9('0x41')][_0x47f9('0x59')],_[_0x47f9('0x7c')](_0x489809[_0x47f9('0x41')],[_0x47f9('0x59'),'id'])||{})[_0x47f9('0x7d')](function(_0x239852){for(var _0x1678fe=0x0;_0x1678fe<_0x489809['body'][_0x47f9('0x59')]['length'];_0x1678fe+=0x1){socket[_0x47f9('0x65')](_0x47f9('0x66'),{'UserId':Number(_0x489809[_0x47f9('0x41')][_0x47f9('0x59')][_0x1678fe]),'FaxQueueId':Number(_0x489809[_0x47f9('0x2c')]['id'])});}return _0x239852;});}})['then'](respondWithResult(_0x32ba0f,null))[_0x47f9('0x37')](handleError(_0x32ba0f,null));};exports['removeAgents']=function(_0x4f3719,_0x6f6918){return db[_0x47f9('0x20')][_0x47f9('0x40')]({'where':{'id':_0x4f3719[_0x47f9('0x2c')]['id']}})[_0x47f9('0x17')](handleEntityNotFound(_0x6f6918,null))['then'](function(_0x3102b3){if(_0x3102b3){return _0x3102b3[_0x47f9('0x7e')](_0x4f3719[_0x47f9('0x28')][_0x47f9('0x59')])['then'](function(){if(_[_0x47f9('0x7f')](_0x4f3719[_0x47f9('0x28')]['ids'])){for(var _0x853b99=0x0;_0x853b99<_0x4f3719[_0x47f9('0x28')][_0x47f9('0x59')][_0x47f9('0x33')];_0x853b99+=0x1){socket[_0x47f9('0x65')](_0x47f9('0x80'),{'UserId':Number(_0x4f3719[_0x47f9('0x28')][_0x47f9('0x59')][_0x853b99]),'FaxQueueId':Number(_0x4f3719[_0x47f9('0x2c')]['id'])});}}else{socket[_0x47f9('0x65')](_0x47f9('0x80'),{'UserId':Number(_0x4f3719['query'][_0x47f9('0x59')]),'FaxQueueId':Number(_0x4f3719['params']['id'])});}});}})[_0x47f9('0x17')](respondWithStatusCode(_0x6f6918,null))[_0x47f9('0x37')](handleError(_0x6f6918,null));};exports[_0x47f9('0x81')]=function(_0x5d2e84,_0x41f7aa){var _0x3a040e={};var _0x3730d1={};var _0x561ed0;var _0x546614;return db[_0x47f9('0x20')]['findOne']({'where':{'id':_0x5d2e84['params']['id']}})[_0x47f9('0x17')](handleEntityNotFound(_0x41f7aa,null))[_0x47f9('0x17')](function(_0x580e74){if(_0x580e74){_0x561ed0=_0x580e74;_0x3730d1['model']=_['keys'](db[_0x47f9('0x5a')][_0x47f9('0x21')]);_0x3730d1[_0x47f9('0x28')]=_[_0x47f9('0x2e')](_0x5d2e84[_0x47f9('0x28')]);_0x3730d1[_0x47f9('0x2f')]=_[_0x47f9('0x30')](_0x3730d1[_0x47f9('0x2d')],_0x3730d1['query']);_0x3a040e[_0x47f9('0x31')]=_[_0x47f9('0x30')](_0x3730d1[_0x47f9('0x2d')],qs[_0x47f9('0x32')](_0x5d2e84[_0x47f9('0x28')][_0x47f9('0x32')]));_0x3a040e[_0x47f9('0x31')]=_0x3a040e[_0x47f9('0x31')]['length']?_0x3a040e[_0x47f9('0x31')]:_0x3730d1['model'];_0x3a040e[_0x47f9('0x46')]=qs[_0x47f9('0x47')](_0x5d2e84['query'][_0x47f9('0x47')]);_0x3a040e[_0x47f9('0x26')]=qs['filters'](_[_0x47f9('0x48')](_0x5d2e84[_0x47f9('0x28')],_0x3730d1[_0x47f9('0x2f')]));if(_0x5d2e84[_0x47f9('0x28')][_0x47f9('0x4a')]){_0x3a040e[_0x47f9('0x26')]=_[_0x47f9('0x35')](_0x3a040e[_0x47f9('0x26')],{'$or':_[_0x47f9('0x4b')](_0x3a040e['attributes'],function(_0x595621){var _0x8ba365={};_0x8ba365[_0x595621]={'$like':'%'+_0x5d2e84[_0x47f9('0x28')]['filter']+'%'};return _0x8ba365;})});}_0x3a040e=_['merge']({},_0x3a040e,_0x5d2e84[_0x47f9('0x36')]);return _0x561ed0['getAgents'](_0x3a040e);}})[_0x47f9('0x17')](function(_0x53c22c){if(_0x53c22c){_0x546614=_0x53c22c[_0x47f9('0x33')];if(!_0x5d2e84[_0x47f9('0x28')][_0x47f9('0x57')]('nolimit')){_0x3a040e[_0x47f9('0x13')]=qs[_0x47f9('0x13')](_0x5d2e84['query'][_0x47f9('0x13')]);_0x3a040e[_0x47f9('0x12')]=qs[_0x47f9('0x12')](_0x5d2e84[_0x47f9('0x28')][_0x47f9('0x12')]);}return _0x561ed0[_0x47f9('0x81')](_0x3a040e);}})[_0x47f9('0x17')](function(_0x5b562f){if(_0x5b562f){return _0x5b562f?{'count':_0x546614,'rows':_0x5b562f}:null;}})[_0x47f9('0x17')](respondWithResult(_0x41f7aa,null))['catch'](handleError(_0x41f7aa,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e39b6ca..eeb54c4 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 _0xeb31=['remove','emit','hasOwnProperty','hook','exports','events','save'];(function(_0x4065c6,_0x53dd4e){var _0x21b71c=function(_0x15d9db){while(--_0x15d9db){_0x4065c6['push'](_0x4065c6['shift']());}};_0x21b71c(++_0x53dd4e);}(_0xeb31,0xa6));var _0x1eb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb31[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1eb3('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1eb3('0x1'),'afterUpdate':'update','afterDestroy':_0x1eb3('0x2')};function emitEvent(_0x3fc04d){return function(_0x68d17c,_0x44eabc,_0x147462){FaxQueueEvents[_0x1eb3('0x3')](_0x3fc04d+':'+_0x68d17c['id'],_0x68d17c);FaxQueueEvents[_0x1eb3('0x3')](_0x3fc04d,_0x68d17c);_0x147462(null);};}for(var e in events){if(events[_0x1eb3('0x4')](e)){var event=events[e];FaxQueue[_0x1eb3('0x5')](e,emitEvent(event));}}module[_0x1eb3('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xb9e8=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1e1cbd,_0x28d837){var _0x17bc26=function(_0x3ffff6){while(--_0x3ffff6){_0x1e1cbd['push'](_0x1e1cbd['shift']());}};_0x17bc26(++_0x28d837);}(_0xb9e8,0xae));var _0x8b9e=function(_0x1f32cb,_0x10774e){_0x1f32cb=_0x1f32cb-0x0;var _0xff2722=_0xb9e8[_0x1f32cb];return _0xff2722;};'use strict';var EventEmitter=require(_0x8b9e('0x0'));var FaxQueue=require(_0x8b9e('0x1'))['db'][_0x8b9e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8b9e('0x3')](0x0);var events={'afterCreate':_0x8b9e('0x4'),'afterUpdate':_0x8b9e('0x5'),'afterDestroy':_0x8b9e('0x6')};function emitEvent(_0x12d42a){return function(_0x286903,_0x3b5d39,_0xa16216){FaxQueueEvents[_0x8b9e('0x7')](_0x12d42a+':'+_0x286903['id'],_0x286903);FaxQueueEvents[_0x8b9e('0x7')](_0x12d42a,_0x286903);_0xa16216(null);};}for(var e in events){if(events[_0x8b9e('0x8')](e)){var event=events[e];FaxQueue[_0x8b9e('0x9')](e,emitEvent(event));}}module[_0x8b9e('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4af7421..16f6574 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 _0x5939=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash'];(function(_0x1ef4d0,_0x5dfe85){var _0xd3fcea=function(_0x42df34){while(--_0x42df34){_0x1ef4d0['push'](_0x1ef4d0['shift']());}};_0xd3fcea(++_0x5dfe85);}(_0x5939,0x149));var _0x9593=function(_0x44923d,_0x35ecb5){_0x44923d=_0x44923d-0x0;var _0x18cc58=_0x5939[_0x44923d];return _0x18cc58;};'use strict';var _=require(_0x9593('0x0'));var util=require(_0x9593('0x1'));var logger=require(_0x9593('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9593('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9593('0x4'));var rimraf=require(_0x9593('0x5'));var config=require(_0x9593('0x6'));var attributes=require(_0x9593('0x7'));module[_0x9593('0x8')]=function(_0x33b7b6,_0x220f71){return _0x33b7b6[_0x9593('0x9')]('FaxQueue',attributes,{'tableName':_0x9593('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa856=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues'];(function(_0x19fa39,_0x2de46b){var _0xb21667=function(_0x4cec3f){while(--_0x4cec3f){_0x19fa39['push'](_0x19fa39['shift']());}};_0xb21667(++_0x2de46b);}(_0xa856,0x68));var _0x6a85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a85('0x0'));var util=require(_0x6a85('0x1'));var logger=require(_0x6a85('0x2'))(_0x6a85('0x3'));var moment=require(_0x6a85('0x4'));var BPromise=require(_0x6a85('0x5'));var rp=require(_0x6a85('0x6'));var fs=require('fs');var path=require(_0x6a85('0x7'));var rimraf=require('rimraf');var config=require(_0x6a85('0x8'));var attributes=require(_0x6a85('0x9'));module[_0x6a85('0xa')]=function(_0x463553,_0x96b99e){return _0x463553[_0x6a85('0xb')]('FaxQueue',attributes,{'tableName':_0x6a85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ebc3d72..df8f380 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 _0x9300=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x9300,0xe5));var _0x0930=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0x9300[_0x244e2d];return _0x3df084;};'use strict';var _=require(_0x0930('0x0'));var util=require(_0x0930('0x1'));var moment=require(_0x0930('0x2'));var BPromise=require(_0x0930('0x3'));var rs=require(_0x0930('0x4'));var fs=require('fs');var Redis=require(_0x0930('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0930('0x6'));var logger=require(_0x0930('0x7'))(_0x0930('0x8'));var config=require('../../config/environment');var jayson=require(_0x0930('0x9'));var client=jayson[_0x0930('0xa')][_0x0930('0xb')]({'port':0x232a});config[_0x0930('0xc')]=_[_0x0930('0xd')](config['redis'],{'host':_0x0930('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0930('0xc')]));require('./faxQueue.socket')[_0x0930('0xf')](socket);function respondWithRpcPromise(_0x160a94,_0x2fac12,_0x1be0c9){return new BPromise(function(_0x5a1a1e,_0x291260){return client[_0x0930('0x10')](_0x160a94,_0x1be0c9)[_0x0930('0x11')](function(_0x332aa8){logger[_0x0930('0x12')](_0x0930('0x13'),_0x2fac12,_0x0930('0x14'));logger[_0x0930('0x15')](_0x0930('0x16'),_0x2fac12,_0x0930('0x14'),JSON[_0x0930('0x17')](_0x332aa8));if(_0x332aa8[_0x0930('0x18')]){if(_0x332aa8[_0x0930('0x18')]['code']===0x1f4){logger[_0x0930('0x18')](_0x0930('0x13'),_0x2fac12,_0x332aa8[_0x0930('0x18')][_0x0930('0x19')]);return _0x291260(_0x332aa8[_0x0930('0x18')]['message']);}logger[_0x0930('0x18')](_0x0930('0x13'),_0x2fac12,_0x332aa8[_0x0930('0x18')][_0x0930('0x19')]);return _0x5a1a1e(_0x332aa8['error'][_0x0930('0x19')]);}else{logger[_0x0930('0x12')](_0x0930('0x13'),_0x2fac12,_0x0930('0x14'));_0x5a1a1e(_0x332aa8[_0x0930('0x1a')][_0x0930('0x19')]);}})[_0x0930('0x1b')](function(_0x256986){logger[_0x0930('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2fac12,_0x256986);_0x291260(_0x256986);});});}exports[_0x0930('0x1c')]=function(_0x19a687){var _0x488af4=this;return new Promise(function(_0x4dd5f4,_0xc33dd4){return db[_0x0930('0x1d')][_0x0930('0x1e')]({'raw':_0x19a687[_0x0930('0x1f')]?_0x19a687[_0x0930('0x1f')][_0x0930('0x20')]===undefined?!![]:![]:!![],'where':_0x19a687[_0x0930('0x1f')]?_0x19a687[_0x0930('0x1f')][_0x0930('0x21')]||null:null,'attributes':_0x19a687['options']?_0x19a687[_0x0930('0x1f')][_0x0930('0x22')]||null:null,'limit':_0x19a687[_0x0930('0x1f')]?_0x19a687['options'][_0x0930('0x23')]||null:null,'include':_0x19a687[_0x0930('0x1f')]?_0x19a687['options']['include']?_['map'](_0x19a687[_0x0930('0x1f')][_0x0930('0x24')],function(_0x1efab4){return{'model':db[_0x1efab4[_0x0930('0x25')]],'as':_0x1efab4['as'],'attributes':_0x1efab4[_0x0930('0x22')],'include':_0x1efab4[_0x0930('0x24')]?_[_0x0930('0x26')](_0x1efab4[_0x0930('0x24')],function(_0x39c2fb){return{'model':db[_0x39c2fb[_0x0930('0x25')]],'as':_0x39c2fb['as'],'attributes':_0x39c2fb[_0x0930('0x22')],'include':_0x39c2fb[_0x0930('0x24')]?_[_0x0930('0x26')](_0x39c2fb[_0x0930('0x24')],function(_0xe34ae4){return{'model':db[_0xe34ae4[_0x0930('0x25')]],'as':_0xe34ae4['as'],'attributes':_0xe34ae4[_0x0930('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0930('0x11')](function(_0x35852e){logger[_0x0930('0x12')](_0x0930('0x1c'),_0x19a687);logger['debug'](_0x0930('0x1c'),_0x19a687,JSON[_0x0930('0x17')](_0x35852e));_0x4dd5f4(_0x35852e);})[_0x0930('0x1b')](function(_0xbb4954){logger[_0x0930('0x18')]('GetFaxQueue',_0xbb4954[_0x0930('0x19')],_0x19a687);_0xc33dd4(_0x488af4[_0x0930('0x18')](0x1f4,_0xbb4954[_0x0930('0x19')]));});});};exports[_0x0930('0x27')]=function(_0xe0e115){var _0x54524b=this;return new Promise(function(_0x5f11e6,_0x310270){return db[_0x0930('0x1d')][_0x0930('0x28')]({'raw':_0xe0e115[_0x0930('0x1f')]?_0xe0e115[_0x0930('0x1f')][_0x0930('0x20')]===undefined?!![]:![]:!![],'where':_0xe0e115[_0x0930('0x1f')]?_0xe0e115['options']['where']||null:null,'attributes':_0xe0e115[_0x0930('0x1f')]?_0xe0e115[_0x0930('0x1f')][_0x0930('0x22')]||null:null,'include':_0xe0e115[_0x0930('0x1f')]?_0xe0e115['options']['include']?_['map'](_0xe0e115['options'][_0x0930('0x24')],function(_0x54e1bf){return{'model':db[_0x54e1bf['model']],'as':_0x54e1bf['as'],'attributes':_0x54e1bf[_0x0930('0x22')],'include':_0x54e1bf[_0x0930('0x24')]?_[_0x0930('0x26')](_0x54e1bf[_0x0930('0x24')],function(_0xe17596){return{'model':db[_0xe17596['model']],'as':_0xe17596['as'],'attributes':_0xe17596[_0x0930('0x22')],'include':_0xe17596[_0x0930('0x24')]?_[_0x0930('0x26')](_0xe17596[_0x0930('0x24')],function(_0x563b61){return{'model':db[_0x563b61[_0x0930('0x25')]],'as':_0x563b61['as'],'attributes':_0x563b61[_0x0930('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0930('0x11')](function(_0x22fa26){logger[_0x0930('0x12')]('ShowFaxQueue',_0xe0e115);logger[_0x0930('0x15')](_0x0930('0x27'),_0xe0e115,JSON[_0x0930('0x17')](_0x22fa26));_0x5f11e6(_0x22fa26);})[_0x0930('0x1b')](function(_0x3dbb3c){logger[_0x0930('0x18')](_0x0930('0x27'),_0x3dbb3c[_0x0930('0x19')],_0xe0e115);_0x310270(_0x54524b[_0x0930('0x18')](0x1f4,_0x3dbb3c['message']));});});}; \ No newline at end of file +var _0x9f08=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','find','ShowFaxQueue','lodash','util'];(function(_0x25a80e,_0x3564cf){var _0x33e704=function(_0x42df20){while(--_0x42df20){_0x25a80e['push'](_0x25a80e['shift']());}};_0x33e704(++_0x3564cf);}(_0x9f08,0xcb));var _0x89f0=function(_0x404c45,_0x8e0568){_0x404c45=_0x404c45-0x0;var _0x4fe4c2=_0x9f08[_0x404c45];return _0x4fe4c2;};'use strict';var _=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var moment=require(_0x89f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x89f0('0x3'));var fs=require('fs');var Redis=require(_0x89f0('0x4'));var db=require(_0x89f0('0x5'))['db'];var utils=require(_0x89f0('0x6'));var logger=require(_0x89f0('0x7'))(_0x89f0('0x8'));var config=require(_0x89f0('0x9'));var jayson=require(_0x89f0('0xa'));var client=jayson['client'][_0x89f0('0xb')]({'port':0x232a});config[_0x89f0('0xc')]=_[_0x89f0('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x89f0('0xe'))(new Redis(config[_0x89f0('0xc')]));require(_0x89f0('0xf'))[_0x89f0('0x10')](socket);function respondWithRpcPromise(_0x4f4faf,_0x36c064,_0x39f596){return new BPromise(function(_0x3144b1,_0x16e92b){return client[_0x89f0('0x11')](_0x4f4faf,_0x39f596)[_0x89f0('0x12')](function(_0x524467){logger[_0x89f0('0x13')](_0x89f0('0x14'),_0x36c064,'request\x20sent');logger[_0x89f0('0x15')](_0x89f0('0x16'),_0x36c064,'request\x20sent',JSON[_0x89f0('0x17')](_0x524467));if(_0x524467[_0x89f0('0x18')]){if(_0x524467[_0x89f0('0x18')][_0x89f0('0x19')]===0x1f4){logger[_0x89f0('0x18')](_0x89f0('0x14'),_0x36c064,_0x524467['error'][_0x89f0('0x1a')]);return _0x16e92b(_0x524467[_0x89f0('0x18')][_0x89f0('0x1a')]);}logger[_0x89f0('0x18')](_0x89f0('0x14'),_0x36c064,_0x524467['error'][_0x89f0('0x1a')]);return _0x3144b1(_0x524467[_0x89f0('0x18')][_0x89f0('0x1a')]);}else{logger[_0x89f0('0x13')](_0x89f0('0x14'),_0x36c064,'request\x20sent');_0x3144b1(_0x524467[_0x89f0('0x1b')][_0x89f0('0x1a')]);}})[_0x89f0('0x1c')](function(_0x1a35c7){logger[_0x89f0('0x18')]('FaxQueue,\x20%s,\x20%s',_0x36c064,_0x1a35c7);_0x16e92b(_0x1a35c7);});});}exports[_0x89f0('0x1d')]=function(_0x36189c){var _0x5c9222=this;return new Promise(function(_0x4465ba,_0x1dfd5d){return db[_0x89f0('0x1e')]['findAll']({'raw':_0x36189c[_0x89f0('0x1f')]?_0x36189c[_0x89f0('0x1f')][_0x89f0('0x20')]===undefined?!![]:![]:!![],'where':_0x36189c[_0x89f0('0x1f')]?_0x36189c[_0x89f0('0x1f')][_0x89f0('0x21')]||null:null,'attributes':_0x36189c['options']?_0x36189c[_0x89f0('0x1f')][_0x89f0('0x22')]||null:null,'limit':_0x36189c[_0x89f0('0x1f')]?_0x36189c[_0x89f0('0x1f')][_0x89f0('0x23')]||null:null,'include':_0x36189c[_0x89f0('0x1f')]?_0x36189c['options'][_0x89f0('0x24')]?_[_0x89f0('0x25')](_0x36189c[_0x89f0('0x1f')][_0x89f0('0x24')],function(_0x4beea1){return{'model':db[_0x4beea1['model']],'as':_0x4beea1['as'],'attributes':_0x4beea1['attributes'],'include':_0x4beea1[_0x89f0('0x24')]?_[_0x89f0('0x25')](_0x4beea1['include'],function(_0x443ce6){return{'model':db[_0x443ce6['model']],'as':_0x443ce6['as'],'attributes':_0x443ce6[_0x89f0('0x22')],'include':_0x443ce6['include']?_['map'](_0x443ce6['include'],function(_0x11e9f0){return{'model':db[_0x11e9f0[_0x89f0('0x26')]],'as':_0x11e9f0['as'],'attributes':_0x11e9f0['attributes']};}):[]};}):[]};}):[]:[]})[_0x89f0('0x12')](function(_0x42e8f6){logger[_0x89f0('0x13')](_0x89f0('0x1d'),_0x36189c);logger['debug'](_0x89f0('0x1d'),_0x36189c,JSON[_0x89f0('0x17')](_0x42e8f6));_0x4465ba(_0x42e8f6);})[_0x89f0('0x1c')](function(_0x473596){logger['error'](_0x89f0('0x1d'),_0x473596[_0x89f0('0x1a')],_0x36189c);_0x1dfd5d(_0x5c9222[_0x89f0('0x18')](0x1f4,_0x473596[_0x89f0('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x1289cb){var _0x46e446=this;return new Promise(function(_0x4c06df,_0x8c56ff){return db['FaxQueue'][_0x89f0('0x27')]({'raw':_0x1289cb[_0x89f0('0x1f')]?_0x1289cb['options'][_0x89f0('0x20')]===undefined?!![]:![]:!![],'where':_0x1289cb[_0x89f0('0x1f')]?_0x1289cb[_0x89f0('0x1f')]['where']||null:null,'attributes':_0x1289cb[_0x89f0('0x1f')]?_0x1289cb['options'][_0x89f0('0x22')]||null:null,'include':_0x1289cb[_0x89f0('0x1f')]?_0x1289cb[_0x89f0('0x1f')][_0x89f0('0x24')]?_['map'](_0x1289cb[_0x89f0('0x1f')]['include'],function(_0x3f0089){return{'model':db[_0x3f0089[_0x89f0('0x26')]],'as':_0x3f0089['as'],'attributes':_0x3f0089[_0x89f0('0x22')],'include':_0x3f0089[_0x89f0('0x24')]?_['map'](_0x3f0089[_0x89f0('0x24')],function(_0x205d25){return{'model':db[_0x205d25[_0x89f0('0x26')]],'as':_0x205d25['as'],'attributes':_0x205d25[_0x89f0('0x22')],'include':_0x205d25['include']?_['map'](_0x205d25[_0x89f0('0x24')],function(_0x53c419){return{'model':db[_0x53c419[_0x89f0('0x26')]],'as':_0x53c419['as'],'attributes':_0x53c419[_0x89f0('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3153ca){logger[_0x89f0('0x13')](_0x89f0('0x28'),_0x1289cb);logger[_0x89f0('0x15')](_0x89f0('0x28'),_0x1289cb,JSON[_0x89f0('0x17')](_0x3153ca));_0x4c06df(_0x3153ca);})['catch'](function(_0x462c71){logger['error']('ShowFaxQueue',_0x462c71[_0x89f0('0x1a')],_0x1289cb);_0x8c56ff(_0x46e446[_0x89f0('0x18')](0x1f4,_0x462c71[_0x89f0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d28d6d4..eb9288b 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 _0x6386=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x6386,0x1cf));var _0x6638=function(_0x3fad86,_0x425d92){_0x3fad86=_0x3fad86-0x0;var _0x51cdf3=_0x6386[_0x3fad86];return _0x51cdf3;};'use strict';var FaxQueueEvents=require(_0x6638('0x0'));var events=[_0x6638('0x1'),_0x6638('0x2'),_0x6638('0x3')];function createListener(_0x1146f1,_0x22b8d7){return function(_0x28331f){_0x22b8d7[_0x6638('0x4')](_0x1146f1,_0x28331f);};}function removeListener(_0x1bef1a,_0x1e0ea6){return function(){FaxQueueEvents[_0x6638('0x5')](_0x1bef1a,_0x1e0ea6);};}exports[_0x6638('0x6')]=function(_0x45de5a){for(var _0x3b6cba=0x0,_0x7668db=events[_0x6638('0x7')];_0x3b6cba<_0x7668db;_0x3b6cba++){var _0xfb8f3f=events[_0x3b6cba];var _0x41a09f=createListener(_0x6638('0x8')+_0xfb8f3f,_0x45de5a);FaxQueueEvents['on'](_0xfb8f3f,_0x41a09f);}}; \ No newline at end of file +var _0x2d6b=['length','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x129d4b,_0x268aff){var _0x546be0=function(_0x1e5ead){while(--_0x1e5ead){_0x129d4b['push'](_0x129d4b['shift']());}};_0x546be0(++_0x268aff);}(_0x2d6b,0xf1));var _0xb2d6=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x2d6b[_0x1f36bb];return _0xaf97fa;};'use strict';var FaxQueueEvents=require(_0xb2d6('0x0'));var events=[_0xb2d6('0x1'),_0xb2d6('0x2'),_0xb2d6('0x3')];function createListener(_0x4365da,_0x6c6368){return function(_0x22fb8a){_0x6c6368[_0xb2d6('0x4')](_0x4365da,_0x22fb8a);};}function removeListener(_0x5911a1,_0x295523){return function(){FaxQueueEvents[_0xb2d6('0x5')](_0x5911a1,_0x295523);};}exports[_0xb2d6('0x6')]=function(_0x5bf830){for(var _0x12e724=0x0,_0x35d830=events[_0xb2d6('0x7')];_0x12e724<_0x35d830;_0x12e724++){var _0x5461f5=events[_0x12e724];var _0x5ade4c=createListener('faxQueue:'+_0x5461f5,_0x5bf830);FaxQueueEvents['on'](_0x5461f5,_0x5ade4c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 47b4f47..107b733 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 _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(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa9fc,0x19f));var _0xca9f=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xa9fc[_0x36c6eb];return _0x30675b;};'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 +var _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x44ac9a,_0x181bc4){var _0xbbeec9=function(_0x1e996e){while(--_0x1e996e){_0x44ac9a['push'](_0x44ac9a['shift']());}};_0xbbeec9(++_0x181bc4);}(_0x8aad,0x146));var _0xd8aa=function(_0x1e0791,_0x394394){_0x1e0791=_0x1e0791-0x0;var _0x576708=_0x8aad[_0x1e0791];return _0x576708;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2f5a75b..95e61b7 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 _0xc03a=['exports','STRING','DATE','moment','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc03a,0x1e3));var _0xac03=function(_0x4579e0,_0x5d02ac){_0x4579e0=_0x4579e0-0x0;var _0x14f17e=_0xc03a[_0x4579e0];return _0x14f17e;};'use strict';var moment=require(_0xac03('0x0'));var Sequelize=require(_0xac03('0x1'));module[_0xac03('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xac03('0x3')]},'joinAt':{'type':Sequelize[_0xac03('0x4')]},'leaveAt':{'type':Sequelize[_0xac03('0x4')]},'acceptAt':{'type':Sequelize[_0xac03('0x4')]},'exitAt':{'type':Sequelize[_0xac03('0x4')]},'reason':{'type':Sequelize[_0xac03('0x3')]}}; \ No newline at end of file +var _0x1c76=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c76,0x11a));var _0x61c7=function(_0x271154,_0x1b5022){_0x271154=_0x271154-0x0;var _0x1b598a=_0x1c76[_0x271154];return _0x1b598a;};'use strict';var moment=require('moment');var Sequelize=require(_0x61c7('0x0'));module[_0x61c7('0x1')]={'uniqueid':{'type':Sequelize[_0x61c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x61c7('0x2')]},'joinAt':{'type':Sequelize[_0x61c7('0x3')]},'leaveAt':{'type':Sequelize[_0x61c7('0x3')]},'acceptAt':{'type':Sequelize[_0x61c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3444b43..423f80a 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 _0x81d5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81d5,0x1ab));var _0x581d=function(_0x10ed50,_0x11533b){_0x10ed50=_0x10ed50-0x0;var _0x4017ee=_0x81d5[_0x10ed50];return _0x4017ee;};'use strict';var emlformat=require(_0x581d('0x0'));var rimraf=require(_0x581d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x581d('0x2'));var rp=require(_0x581d('0x3'));var moment=require(_0x581d('0x4'));var BPromise=require(_0x581d('0x5'));var Mustache=require(_0x581d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x581d('0x7'));var csv=require(_0x581d('0x8'));var ejs=require(_0x581d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x581d('0xa'));var squel=require(_0x581d('0xb'));var crypto=require(_0x581d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x581d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x581d('0xe'));var authService=require(_0x581d('0xf'));var qs=require(_0x581d('0x10'));var as=require(_0x581d('0x11'));var hardwareService=require(_0x581d('0x12'));var logger=require('../../config/logger')(_0x581d('0x13'));var utils=require(_0x581d('0x14'));var config=require(_0x581d('0x15'));var licenseUtil=require(_0x581d('0x16'));var db=require(_0x581d('0x17'))['db'];function respondWithStatusCode(_0x271bd1,_0x1fb6ed){_0x1fb6ed=_0x1fb6ed||0xcc;return function(_0x3329cc){if(_0x3329cc){return _0x271bd1[_0x581d('0x18')](_0x1fb6ed);}return _0x271bd1[_0x581d('0x19')](_0x1fb6ed)['end']();};}function respondWithResult(_0x338c88,_0xfab29f){_0xfab29f=_0xfab29f||0xc8;return function(_0x51a035){if(_0x51a035){return _0x338c88['status'](_0xfab29f)['json'](_0x51a035);}};}function respondWithFilteredResult(_0x4deffa,_0x110e13){return function(_0x550365){if(_0x550365){var _0x1d609f=typeof _0x110e13[_0x581d('0x1a')]==='undefined'&&typeof _0x110e13[_0x581d('0x1b')]==='undefined';var _0x3172f6=_0x550365[_0x581d('0x1c')];var _0x1e059d=_0x1d609f?0x0:_0x110e13[_0x581d('0x1a')];var _0x1f790f=_0x1d609f?_0x550365[_0x581d('0x1c')]:_0x110e13[_0x581d('0x1a')]+_0x110e13['limit'];var _0x2be45b;if(_0x1f790f>=_0x3172f6){_0x1f790f=_0x3172f6;_0x2be45b=0xc8;}else{_0x2be45b=0xce;}_0x4deffa[_0x581d('0x19')](_0x2be45b);return _0x4deffa[_0x581d('0x1d')](_0x581d('0x1e'),_0x1e059d+'-'+_0x1f790f+'/'+_0x3172f6)[_0x581d('0x1f')](_0x550365);}return null;};}function patchUpdates(_0x2a2aba){return function(_0x4635a8){try{jsonpatch[_0x581d('0x20')](_0x4635a8,_0x2a2aba,!![]);}catch(_0x468543){return BPromise[_0x581d('0x21')](_0x468543);}return _0x4635a8[_0x581d('0x22')]();};}function saveUpdates(_0xf74d2b,_0x5add13){return function(_0xb96c3d){if(_0xb96c3d){return _0xb96c3d[_0x581d('0x23')](_0xf74d2b)[_0x581d('0x24')](function(_0x2a4cd9){return _0x2a4cd9;});}return null;};}function removeEntity(_0x2addd8,_0x4f7420){return function(_0x36cc8a){if(_0x36cc8a){return _0x36cc8a[_0x581d('0x25')]()['then'](function(){_0x2addd8[_0x581d('0x19')](0xcc)[_0x581d('0x26')]();});}};}function handleEntityNotFound(_0x2c8fdb,_0x5a3fd7){return function(_0x190545){if(!_0x190545){_0x2c8fdb[_0x581d('0x18')](0x194);}return _0x190545;};}function handleError(_0x146323,_0xc270bc){_0xc270bc=_0xc270bc||0x1f4;return function(_0x38f213){logger[_0x581d('0x27')](_0x38f213['stack']);if(_0x38f213[_0x581d('0x28')]){delete _0x38f213[_0x581d('0x28')];}_0x146323[_0x581d('0x19')](_0xc270bc)['send'](_0x38f213);};}exports['index']=function(_0x504f71,_0x489682){var _0x355efe={},_0x266a2b={},_0x337361={'count':0x0,'rows':[]};var _0x408cce=_[_0x581d('0x29')](db[_0x581d('0x2a')][_0x581d('0x2b')],function(_0x298953){return{'name':_0x298953[_0x581d('0x2c')],'type':_0x298953[_0x581d('0x2d')][_0x581d('0x2e')]};});_0x266a2b['model']=_[_0x581d('0x29')](_0x408cce,'name');_0x266a2b[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x504f71[_0x581d('0x2f')]);_0x266a2b[_0x581d('0x31')]=_[_0x581d('0x32')](_0x266a2b[_0x581d('0x33')],_0x266a2b['query']);_0x355efe[_0x581d('0x34')]=_[_0x581d('0x32')](_0x266a2b['model'],qs['fields'](_0x504f71['query'][_0x581d('0x35')]));_0x355efe[_0x581d('0x34')]=_0x355efe[_0x581d('0x34')][_0x581d('0x36')]?_0x355efe[_0x581d('0x34')]:_0x266a2b[_0x581d('0x33')];if(!_0x504f71[_0x581d('0x2f')]['hasOwnProperty'](_0x581d('0x37'))){_0x355efe[_0x581d('0x1b')]=qs['limit'](_0x504f71[_0x581d('0x2f')][_0x581d('0x1b')]);_0x355efe[_0x581d('0x1a')]=qs[_0x581d('0x1a')](_0x504f71[_0x581d('0x2f')]['offset']);}_0x355efe[_0x581d('0x38')]=qs['sort'](_0x504f71[_0x581d('0x2f')][_0x581d('0x39')]);_0x355efe['where']=qs['filters'](_['pick'](_0x504f71['query'],_0x266a2b[_0x581d('0x31')]),_0x408cce);if(_0x504f71['query'][_0x581d('0x3a')]){_0x355efe['where']=_[_0x581d('0x3b')](_0x355efe[_0x581d('0x3c')],{'$or':_[_0x581d('0x29')](_0x408cce,function(_0x393b2e){if(_0x393b2e[_0x581d('0x2d')]!==_0x581d('0x3d')){var _0x28f091={};_0x28f091[_0x393b2e[_0x581d('0x28')]]={'$like':'%'+_0x504f71[_0x581d('0x2f')][_0x581d('0x3a')]+'%'};return _0x28f091;}})});}_0x355efe=_['merge']({},_0x355efe,_0x504f71['options']);var _0x47668c={'where':_0x355efe[_0x581d('0x3c')]};return db[_0x581d('0x2a')]['count'](_0x47668c)[_0x581d('0x24')](function(_0x1b6aee){_0x337361[_0x581d('0x1c')]=_0x1b6aee;if(_0x504f71['query'][_0x581d('0x3e')]){_0x355efe[_0x581d('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x581d('0x40')](_0x355efe);})[_0x581d('0x24')](function(_0x211c64){_0x337361[_0x581d('0x41')]=_0x211c64;return _0x337361;})[_0x581d('0x24')](respondWithFilteredResult(_0x489682,_0x355efe))[_0x581d('0x42')](handleError(_0x489682,null));};exports[_0x581d('0x43')]=function(_0x5550b4,_0x3cadb3){var _0x283743={'raw':!![],'where':{'id':_0x5550b4['params']['id']}},_0x20fbf1={};_0x20fbf1[_0x581d('0x33')]=_[_0x581d('0x30')](db['FaxQueueReport']['rawAttributes']);_0x20fbf1[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x5550b4[_0x581d('0x2f')]);_0x20fbf1['filters']=_[_0x581d('0x32')](_0x20fbf1[_0x581d('0x33')],_0x20fbf1['query']);_0x283743[_0x581d('0x34')]=_['intersection'](_0x20fbf1[_0x581d('0x33')],qs['fields'](_0x5550b4[_0x581d('0x2f')]['fields']));_0x283743['attributes']=_0x283743[_0x581d('0x34')]['length']?_0x283743['attributes']:_0x20fbf1['model'];if(_0x5550b4[_0x581d('0x2f')][_0x581d('0x3e')]){_0x283743[_0x581d('0x3f')]=[{'all':!![]}];}_0x283743=_['merge']({},_0x283743,_0x5550b4[_0x581d('0x44')]);return db[_0x581d('0x2a')]['find'](_0x283743)['then'](handleEntityNotFound(_0x3cadb3,null))[_0x581d('0x24')](respondWithResult(_0x3cadb3,null))['catch'](handleError(_0x3cadb3,null));};exports[_0x581d('0x45')]=function(_0x5a5c30,_0x32eed9){return db[_0x581d('0x2a')]['create'](_0x5a5c30[_0x581d('0x46')],{})[_0x581d('0x24')](respondWithResult(_0x32eed9,0xc9))[_0x581d('0x42')](handleError(_0x32eed9,null));};exports[_0x581d('0x23')]=function(_0x3b8b5e,_0x4dca9e){if(_0x3b8b5e[_0x581d('0x46')]['id']){delete _0x3b8b5e[_0x581d('0x46')]['id'];}return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3b8b5e[_0x581d('0x48')]['id']}})[_0x581d('0x24')](handleEntityNotFound(_0x4dca9e,null))[_0x581d('0x24')](saveUpdates(_0x3b8b5e['body'],null))[_0x581d('0x24')](respondWithResult(_0x4dca9e,null))[_0x581d('0x42')](handleError(_0x4dca9e,null));};exports[_0x581d('0x25')]=function(_0x3e95c6,_0xba6b00){return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3e95c6['params']['id']}})[_0x581d('0x24')](handleEntityNotFound(_0xba6b00,null))[_0x581d('0x24')](removeEntity(_0xba6b00,null))['catch'](handleError(_0xba6b00,null));};exports[_0x581d('0x49')]=function(_0x508d4c,_0x29f36e){return db[_0x581d('0x2a')][_0x581d('0x49')]()[_0x581d('0x24')](respondWithResult(_0x29f36e,null))['catch'](handleError(_0x29f36e,null));}; \ No newline at end of file +var _0x5d31=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','FaxQueueReport','include','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes'];(function(_0x3b8170,_0x3f8a3f){var _0xbd0a3b=function(_0x54fe63){while(--_0x54fe63){_0x3b8170['push'](_0x3b8170['shift']());}};_0xbd0a3b(++_0x3f8a3f);}(_0x5d31,0xf7));var _0x15d3=function(_0x203451,_0x36cdd9){_0x203451=_0x203451-0x0;var _0x23dc34=_0x5d31[_0x203451];return _0x23dc34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15d3('0x0'));var zipdir=require(_0x15d3('0x1'));var jsonpatch=require(_0x15d3('0x2'));var rp=require('request-promise');var moment=require(_0x15d3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15d3('0x4'));var path=require(_0x15d3('0x5'));var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d3('0x8'));var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var licenseUtil=require(_0x15d3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219867,_0x1397d8){_0x1397d8=_0x1397d8||0xcc;return function(_0x2811b5){if(_0x2811b5){return _0x219867[_0x15d3('0x15')](_0x1397d8);}return _0x219867[_0x15d3('0x16')](_0x1397d8)[_0x15d3('0x17')]();};}function respondWithResult(_0x24eb07,_0x1658cf){_0x1658cf=_0x1658cf||0xc8;return function(_0x44b5a4){if(_0x44b5a4){return _0x24eb07[_0x15d3('0x16')](_0x1658cf)[_0x15d3('0x18')](_0x44b5a4);}};}function respondWithFilteredResult(_0x4af3a7,_0x304a13){return function(_0x17401b){if(_0x17401b){var _0x5bbfef=typeof _0x304a13[_0x15d3('0x19')]===_0x15d3('0x1a')&&typeof _0x304a13[_0x15d3('0x1b')]===_0x15d3('0x1a');var _0x1b7b3f=_0x17401b[_0x15d3('0x1c')];var _0x46f9ce=_0x5bbfef?0x0:_0x304a13[_0x15d3('0x19')];var _0x46e18b=_0x5bbfef?_0x17401b[_0x15d3('0x1c')]:_0x304a13[_0x15d3('0x19')]+_0x304a13['limit'];var _0x41c358;if(_0x46e18b>=_0x1b7b3f){_0x46e18b=_0x1b7b3f;_0x41c358=0xc8;}else{_0x41c358=0xce;}_0x4af3a7[_0x15d3('0x16')](_0x41c358);return _0x4af3a7['set']('Content-Range',_0x46f9ce+'-'+_0x46e18b+'/'+_0x1b7b3f)['json'](_0x17401b);}return null;};}function patchUpdates(_0x4ebc97){return function(_0x39bb05){try{jsonpatch[_0x15d3('0x1d')](_0x39bb05,_0x4ebc97,!![]);}catch(_0x40a327){return BPromise[_0x15d3('0x1e')](_0x40a327);}return _0x39bb05[_0x15d3('0x1f')]();};}function saveUpdates(_0x2fa13c,_0x4da198){return function(_0x49eb89){if(_0x49eb89){return _0x49eb89[_0x15d3('0x20')](_0x2fa13c)[_0x15d3('0x21')](function(_0x444075){return _0x444075;});}return null;};}function removeEntity(_0x72852f,_0x5b06cc){return function(_0x232078){if(_0x232078){return _0x232078[_0x15d3('0x22')]()[_0x15d3('0x21')](function(){_0x72852f[_0x15d3('0x16')](0xcc)[_0x15d3('0x17')]();});}};}function handleEntityNotFound(_0x240cf4,_0x4a499a){return function(_0x514380){if(!_0x514380){_0x240cf4['sendStatus'](0x194);}return _0x514380;};}function handleError(_0x31706f,_0x1cd5bc){_0x1cd5bc=_0x1cd5bc||0x1f4;return function(_0x23e1f8){logger[_0x15d3('0x23')](_0x23e1f8[_0x15d3('0x24')]);if(_0x23e1f8[_0x15d3('0x25')]){delete _0x23e1f8[_0x15d3('0x25')];}_0x31706f[_0x15d3('0x16')](_0x1cd5bc)[_0x15d3('0x26')](_0x23e1f8);};}exports['index']=function(_0x5f445a,_0x164aa1){var _0x4e5840={},_0x6a9c0c={},_0x5a2ccf={'count':0x0,'rows':[]};var _0x314c27=_[_0x15d3('0x27')](db['FaxQueueReport'][_0x15d3('0x28')],function(_0x29a947){return{'name':_0x29a947[_0x15d3('0x29')],'type':_0x29a947[_0x15d3('0x2a')][_0x15d3('0x2b')]};});_0x6a9c0c[_0x15d3('0x2c')]=_[_0x15d3('0x27')](_0x314c27,_0x15d3('0x25'));_0x6a9c0c[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x5f445a['query']);_0x6a9c0c[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x6a9c0c[_0x15d3('0x2c')],_0x6a9c0c[_0x15d3('0x2d')]);_0x4e5840[_0x15d3('0x31')]=_[_0x15d3('0x30')](_0x6a9c0c[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x5f445a['query'][_0x15d3('0x32')]));_0x4e5840['attributes']=_0x4e5840[_0x15d3('0x31')][_0x15d3('0x33')]?_0x4e5840[_0x15d3('0x31')]:_0x6a9c0c[_0x15d3('0x2c')];if(!_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x34')](_0x15d3('0x35'))){_0x4e5840[_0x15d3('0x1b')]=qs[_0x15d3('0x1b')](_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x1b')]);_0x4e5840[_0x15d3('0x19')]=qs[_0x15d3('0x19')](_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x19')]);}_0x4e5840['order']=qs[_0x15d3('0x36')](_0x5f445a[_0x15d3('0x2d')]['sort']);_0x4e5840[_0x15d3('0x37')]=qs[_0x15d3('0x2f')](_[_0x15d3('0x38')](_0x5f445a['query'],_0x6a9c0c[_0x15d3('0x2f')]),_0x314c27);if(_0x5f445a['query'][_0x15d3('0x39')]){_0x4e5840[_0x15d3('0x37')]=_['merge'](_0x4e5840[_0x15d3('0x37')],{'$or':_[_0x15d3('0x27')](_0x314c27,function(_0x357073){if(_0x357073[_0x15d3('0x2a')]!==_0x15d3('0x3a')){var _0x3d1803={};_0x3d1803[_0x357073['name']]={'$like':'%'+_0x5f445a[_0x15d3('0x2d')]['filter']+'%'};return _0x3d1803;}})});}_0x4e5840=_[_0x15d3('0x3b')]({},_0x4e5840,_0x5f445a[_0x15d3('0x3c')]);var _0x1b24c5={'where':_0x4e5840[_0x15d3('0x37')]};return db[_0x15d3('0x3d')][_0x15d3('0x1c')](_0x1b24c5)[_0x15d3('0x21')](function(_0x19749b){_0x5a2ccf[_0x15d3('0x1c')]=_0x19749b;if(_0x5f445a[_0x15d3('0x2d')]['includeAll']){_0x4e5840[_0x15d3('0x3e')]=[{'all':!![]}];}return db[_0x15d3('0x3d')]['findAll'](_0x4e5840);})['then'](function(_0x108254){_0x5a2ccf[_0x15d3('0x3f')]=_0x108254;return _0x5a2ccf;})[_0x15d3('0x21')](respondWithFilteredResult(_0x164aa1,_0x4e5840))[_0x15d3('0x40')](handleError(_0x164aa1,null));};exports[_0x15d3('0x41')]=function(_0x473dae,_0x1240e5){var _0x442faf={'raw':!![],'where':{'id':_0x473dae[_0x15d3('0x42')]['id']}},_0x25fa1d={};_0x25fa1d['model']=_[_0x15d3('0x2e')](db[_0x15d3('0x3d')]['rawAttributes']);_0x25fa1d[_0x15d3('0x2d')]=_['keys'](_0x473dae['query']);_0x25fa1d[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x25fa1d[_0x15d3('0x2c')],_0x25fa1d['query']);_0x442faf[_0x15d3('0x31')]=_['intersection'](_0x25fa1d[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x473dae[_0x15d3('0x2d')][_0x15d3('0x32')]));_0x442faf[_0x15d3('0x31')]=_0x442faf['attributes']['length']?_0x442faf['attributes']:_0x25fa1d[_0x15d3('0x2c')];if(_0x473dae['query'][_0x15d3('0x43')]){_0x442faf[_0x15d3('0x3e')]=[{'all':!![]}];}_0x442faf=_[_0x15d3('0x3b')]({},_0x442faf,_0x473dae['options']);return db[_0x15d3('0x3d')][_0x15d3('0x44')](_0x442faf)[_0x15d3('0x21')](handleEntityNotFound(_0x1240e5,null))[_0x15d3('0x21')](respondWithResult(_0x1240e5,null))[_0x15d3('0x40')](handleError(_0x1240e5,null));};exports[_0x15d3('0x45')]=function(_0x62ccb9,_0x46a39a){return db[_0x15d3('0x3d')][_0x15d3('0x45')](_0x62ccb9[_0x15d3('0x46')],{})[_0x15d3('0x21')](respondWithResult(_0x46a39a,0xc9))['catch'](handleError(_0x46a39a,null));};exports['update']=function(_0x264487,_0x446929){if(_0x264487[_0x15d3('0x46')]['id']){delete _0x264487['body']['id'];}return db['FaxQueueReport'][_0x15d3('0x44')]({'where':{'id':_0x264487['params']['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0x446929,null))['then'](saveUpdates(_0x264487[_0x15d3('0x46')],null))[_0x15d3('0x21')](respondWithResult(_0x446929,null))['catch'](handleError(_0x446929,null));};exports['destroy']=function(_0x480c9d,_0x5222bf){return db['FaxQueueReport'][_0x15d3('0x44')]({'where':{'id':_0x480c9d[_0x15d3('0x42')]['id']}})['then'](handleEntityNotFound(_0x5222bf,null))[_0x15d3('0x21')](removeEntity(_0x5222bf,null))[_0x15d3('0x40')](handleError(_0x5222bf,null));};exports[_0x15d3('0x47')]=function(_0x51997f,_0x19d713){return db[_0x15d3('0x3d')][_0x15d3('0x47')]()[_0x15d3('0x21')](respondWithResult(_0x19d713,null))[_0x15d3('0x40')](handleError(_0x19d713,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a671588..51082c9 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x814b,0x1a2));var _0xb814=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x814b[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x6b216,_0x52c56f){var _0x39a397=function(_0xf24cc9){while(--_0xf24cc9){_0x6b216['push'](_0x6b216['shift']());}};_0x39a397(++_0x52c56f);}(_0x326f,0xd1));var _0xf326=function(_0x1a0ac2,_0x5a82c7){_0x1a0ac2=_0x1a0ac2-0x0;var _0x948f38=_0x326f[_0x1a0ac2];return _0x948f38;};'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/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index cd9486f..40dd245 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 _0xc584=['debug','catch','UpdateFaxQueueReport','where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0xc8552d,_0x171ccd){var _0xad7dcf=function(_0xf2fd61){while(--_0xf2fd61){_0xc8552d['push'](_0xc8552d['shift']());}};_0xad7dcf(++_0x171ccd);}(_0xc584,0x1a5));var _0x4c58=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xc584[_0x202c61];return _0x540691;};'use strict';var _=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var moment=require(_0x4c58('0x2'));var BPromise=require(_0x4c58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c58('0x5'));var logger=require('../../config/logger')(_0x4c58('0x6'));var config=require(_0x4c58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4c58('0x8')][_0x4c58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e66c4,_0x5aa392,_0x2e2a1c){return new BPromise(function(_0xc10f1,_0x4326e6){return client[_0x4c58('0xa')](_0x4e66c4,_0x2e2a1c)[_0x4c58('0xb')](function(_0xd067b5){logger[_0x4c58('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5aa392,'request\x20sent');logger['debug'](_0x4c58('0xd'),_0x5aa392,_0x4c58('0xe'),JSON[_0x4c58('0xf')](_0xd067b5));if(_0xd067b5[_0x4c58('0x10')]){if(_0xd067b5[_0x4c58('0x10')][_0x4c58('0x11')]===0x1f4){logger['error'](_0x4c58('0x12'),_0x5aa392,_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);return _0x4326e6(_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);}logger['error'](_0x4c58('0x12'),_0x5aa392,_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);return _0xc10f1(_0xd067b5['error']['message']);}else{logger[_0x4c58('0xc')](_0x4c58('0x12'),_0x5aa392,'request\x20sent');_0xc10f1(_0xd067b5[_0x4c58('0x14')]['message']);}})['catch'](function(_0x19b4db){logger['error'](_0x4c58('0x12'),_0x5aa392,_0x19b4db);_0x4326e6(_0x19b4db);});});}exports[_0x4c58('0x15')]=function(_0x5bf902){var _0x4f1c93=this;return new Promise(function(_0x5e3c56,_0x2f7f23){return db[_0x4c58('0x16')][_0x4c58('0x17')](_0x5bf902[_0x4c58('0x18')],{'raw':_0x5bf902['options']?_0x5bf902[_0x4c58('0x19')][_0x4c58('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x6bbd82){logger[_0x4c58('0xc')](_0x4c58('0x15'),_0x5bf902);logger[_0x4c58('0x1b')]('CreateFaxQueueReport',_0x5bf902,JSON[_0x4c58('0xf')](_0x6bbd82));_0x5e3c56(_0x6bbd82);})[_0x4c58('0x1c')](function(_0x3a1006){logger['error'](_0x4c58('0x15'),_0x3a1006['message'],_0x5bf902);_0x2f7f23(_0x4f1c93[_0x4c58('0x10')](0x1f4,_0x3a1006[_0x4c58('0x13')]));});});};exports[_0x4c58('0x1d')]=function(_0x5551c8){var _0x453c75=this;return new Promise(function(_0x2d8815,_0x1740cf){return db[_0x4c58('0x16')]['update'](_0x5551c8[_0x4c58('0x18')],{'raw':_0x5551c8[_0x4c58('0x19')]?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5551c8['options']?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1e')]||null:null,'attributes':_0x5551c8[_0x4c58('0x19')]?_0x5551c8['options']['attributes']||null:null,'limit':_0x5551c8[_0x4c58('0x19')]?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1f')]||null:null})['then'](function(_0x4db6ab){logger['info'](_0x4c58('0x1d'),_0x5551c8);logger['debug']('UpdateFaxQueueReport',_0x5551c8,JSON['stringify'](_0x4db6ab));_0x2d8815(_0x4db6ab);})[_0x4c58('0x1c')](function(_0x39a132){logger[_0x4c58('0x10')](_0x4c58('0x1d'),_0x39a132[_0x4c58('0x13')],_0x5551c8);_0x1740cf(_0x453c75[_0x4c58('0x10')](0x1f4,_0x39a132[_0x4c58('0x13')]));});});}; \ No newline at end of file +var _0xe096=['update','raw','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateFaxQueueReport','create','body','options','then','stringify','UpdateFaxQueueReport'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe096,0x1d2));var _0x6e09=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0xe096[_0x1081a3];return _0x5696a2;};'use strict';var _=require('lodash');var util=require(_0x6e09('0x0'));var moment=require(_0x6e09('0x1'));var BPromise=require(_0x6e09('0x2'));var rs=require(_0x6e09('0x3'));var fs=require('fs');var Redis=require(_0x6e09('0x4'));var db=require(_0x6e09('0x5'))['db'];var utils=require(_0x6e09('0x6'));var logger=require(_0x6e09('0x7'))(_0x6e09('0x8'));var config=require('../../config/environment');var jayson=require(_0x6e09('0x9'));var client=jayson[_0x6e09('0xa')][_0x6e09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40e65d,_0x5ae837,_0x42f385){return new BPromise(function(_0x32c764,_0x4cfb5f){return client[_0x6e09('0xc')](_0x40e65d,_0x42f385)['then'](function(_0xd6f4a){logger[_0x6e09('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x5ae837,'request\x20sent');logger[_0x6e09('0xe')](_0x6e09('0xf'),_0x5ae837,'request\x20sent',JSON['stringify'](_0xd6f4a));if(_0xd6f4a['error']){if(_0xd6f4a[_0x6e09('0x10')]['code']===0x1f4){logger[_0x6e09('0x10')](_0x6e09('0x11'),_0x5ae837,_0xd6f4a[_0x6e09('0x10')][_0x6e09('0x12')]);return _0x4cfb5f(_0xd6f4a['error'][_0x6e09('0x12')]);}logger[_0x6e09('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5ae837,_0xd6f4a['error'][_0x6e09('0x12')]);return _0x32c764(_0xd6f4a['error'][_0x6e09('0x12')]);}else{logger[_0x6e09('0xd')](_0x6e09('0x11'),_0x5ae837,_0x6e09('0x13'));_0x32c764(_0xd6f4a[_0x6e09('0x14')][_0x6e09('0x12')]);}})[_0x6e09('0x15')](function(_0x31e45e){logger['error'](_0x6e09('0x11'),_0x5ae837,_0x31e45e);_0x4cfb5f(_0x31e45e);});});}exports[_0x6e09('0x16')]=function(_0x25e563){var _0x3568a0=this;return new Promise(function(_0x414b30,_0x40c558){return db['FaxQueueReport'][_0x6e09('0x17')](_0x25e563[_0x6e09('0x18')],{'raw':_0x25e563['options']?_0x25e563[_0x6e09('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6e09('0x1a')](function(_0x494b4b){logger['info'](_0x6e09('0x16'),_0x25e563);logger[_0x6e09('0xe')]('CreateFaxQueueReport',_0x25e563,JSON[_0x6e09('0x1b')](_0x494b4b));_0x414b30(_0x494b4b);})[_0x6e09('0x15')](function(_0x894ad0){logger[_0x6e09('0x10')]('CreateFaxQueueReport',_0x894ad0[_0x6e09('0x12')],_0x25e563);_0x40c558(_0x3568a0['error'](0x1f4,_0x894ad0[_0x6e09('0x12')]));});});};exports[_0x6e09('0x1c')]=function(_0x482a8e){var _0x5c0b4b=this;return new Promise(function(_0x1d77fb,_0x2a95d8){return db['FaxQueueReport'][_0x6e09('0x1d')](_0x482a8e['body'],{'raw':_0x482a8e[_0x6e09('0x19')]?_0x482a8e['options'][_0x6e09('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482a8e[_0x6e09('0x19')]?_0x482a8e[_0x6e09('0x19')][_0x6e09('0x1f')]||null:null,'attributes':_0x482a8e['options']?_0x482a8e[_0x6e09('0x19')][_0x6e09('0x20')]||null:null,'limit':_0x482a8e[_0x6e09('0x19')]?_0x482a8e[_0x6e09('0x19')]['limit']||null:null})['then'](function(_0x297256){logger['info'](_0x6e09('0x1c'),_0x482a8e);logger['debug'](_0x6e09('0x1c'),_0x482a8e,JSON['stringify'](_0x297256));_0x1d77fb(_0x297256);})[_0x6e09('0x15')](function(_0x6c30ee){logger['error']('UpdateFaxQueueReport',_0x6c30ee[_0x6e09('0x12')],_0x482a8e);_0x2a95d8(_0x5c0b4b['error'](0x1f4,_0x6c30ee[_0x6e09('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9d50f4c..1116a92 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 _0x9f91=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5c7b29,_0x5ac661){var _0x34ab1b=function(_0x38452e){while(--_0x38452e){_0x5c7b29['push'](_0x5c7b29['shift']());}};_0x34ab1b(++_0x5ac661);}(_0x9f91,0x13a));var _0x19f9=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x9f91[_0x30182f];return _0x5207db;};'use strict';var multer=require(_0x19f9('0x0'));var util=require('util');var path=require(_0x19f9('0x1'));var timeout=require(_0x19f9('0x2'));var express=require(_0x19f9('0x3'));var router=express[_0x19f9('0x4')]();var fs_extra=require(_0x19f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x19f9('0x6'));var config=require(_0x19f9('0x7'));var controller=require(_0x19f9('0x8'));router[_0x19f9('0x9')]('/',auth[_0x19f9('0xa')](),controller[_0x19f9('0xb')]);router['get'](_0x19f9('0xc'),auth['isAuthenticated'](),controller[_0x19f9('0xd')]);router[_0x19f9('0x9')](_0x19f9('0xe'),auth[_0x19f9('0xa')](),controller[_0x19f9('0xf')]);router['post']('/',auth[_0x19f9('0xa')](),controller[_0x19f9('0x10')]);router[_0x19f9('0x11')](_0x19f9('0xe'),auth['isAuthenticated'](),controller[_0x19f9('0x12')]);router[_0x19f9('0x13')](_0x19f9('0xe'),auth[_0x19f9('0xa')](),controller[_0x19f9('0x14')]);module[_0x19f9('0x15')]=router; \ No newline at end of file +var _0x3b22=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete','destroy','util','path','connect-timeout','Router'];(function(_0x55a15b,_0x1593a7){var _0x4bd6ca=function(_0x5ededb){while(--_0x5ededb){_0x55a15b['push'](_0x55a15b['shift']());}};_0x4bd6ca(++_0x1593a7);}(_0x3b22,0x119));var _0x23b2=function(_0x53758c,_0x5664af){_0x53758c=_0x53758c-0x0;var _0x425eff=_0x3b22[_0x53758c];return _0x425eff;};'use strict';var multer=require('multer');var util=require(_0x23b2('0x0'));var path=require(_0x23b2('0x1'));var timeout=require(_0x23b2('0x2'));var express=require('express');var router=express[_0x23b2('0x3')]();var fs_extra=require(_0x23b2('0x4'));var auth=require(_0x23b2('0x5'));var interaction=require(_0x23b2('0x6'));var config=require(_0x23b2('0x7'));var controller=require('./faxQueueReport.controller');router[_0x23b2('0x8')]('/',auth[_0x23b2('0x9')](),controller[_0x23b2('0xa')]);router[_0x23b2('0x8')]('/describe',auth[_0x23b2('0x9')](),controller[_0x23b2('0xb')]);router[_0x23b2('0x8')]('/:id',auth[_0x23b2('0x9')](),controller[_0x23b2('0xc')]);router[_0x23b2('0xd')]('/',auth['isAuthenticated'](),controller[_0x23b2('0xe')]);router[_0x23b2('0xf')](_0x23b2('0x10'),auth[_0x23b2('0x9')](),controller['update']);router[_0x23b2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x23b2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 15a0d4b..a9ab211 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2f3067,_0x3bd93d){var _0x63e41e=function(_0x474bba){while(--_0x474bba){_0x2f3067['push'](_0x2f3067['shift']());}};_0x63e41e(++_0x3bd93d);}(_0x008c,0x188));var _0xc008=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x008c[_0x306626];return _0x466728;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x20be35,_0x93ee7f){var _0x56118c=function(_0x33b92){while(--_0x33b92){_0x20be35['push'](_0x20be35['shift']());}};_0x56118c(++_0x93ee7f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xf3cd[_0x261e29];return _0x25ef43;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e1a3881..d9cb2c2 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 _0x1ab7=['to-csv','ejs','fs-extra','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','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','send','index','FaxTransferReport','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','intersection','find','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x5450d0,_0x325280){var _0x71cbb5=function(_0x2907f4){while(--_0x2907f4){_0x5450d0['push'](_0x5450d0['shift']());}};_0x71cbb5(++_0x325280);}(_0x1ab7,0x106));var _0x71ab=function(_0xe25ee9,_0x1f6d98){_0xe25ee9=_0xe25ee9-0x0;var _0x56c669=_0x1ab7[_0xe25ee9];return _0x56c669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71ab('0x1'));var rp=require(_0x71ab('0x2'));var moment=require(_0x71ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71ab('0x4'));var util=require('util');var path=require(_0x71ab('0x5'));var sox=require('sox');var csv=require(_0x71ab('0x6'));var ejs=require(_0x71ab('0x7'));var fs=require('fs');var fs_extra=require(_0x71ab('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71ab('0x9'));var deskjs=require(_0x71ab('0xa'));var toCsv=require(_0x71ab('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71ab('0xb'));var authService=require(_0x71ab('0xc'));var qs=require(_0x71ab('0xd'));var as=require(_0x71ab('0xe'));var hardwareService=require(_0x71ab('0xf'));var logger=require(_0x71ab('0x10'))(_0x71ab('0x11'));var utils=require('../../config/utils');var config=require(_0x71ab('0x12'));var licenseUtil=require(_0x71ab('0x13'));var db=require(_0x71ab('0x14'))['db'];function respondWithStatusCode(_0x3eccae,_0x18d731){_0x18d731=_0x18d731||0xcc;return function(_0x52ddda){if(_0x52ddda){return _0x3eccae[_0x71ab('0x15')](_0x18d731);}return _0x3eccae[_0x71ab('0x16')](_0x18d731)['end']();};}function respondWithResult(_0x3b7241,_0x59961a){_0x59961a=_0x59961a||0xc8;return function(_0x3fcf8d){if(_0x3fcf8d){return _0x3b7241['status'](_0x59961a)[_0x71ab('0x17')](_0x3fcf8d);}};}function respondWithFilteredResult(_0x194f75,_0x21f881){return function(_0x2a97d8){if(_0x2a97d8){var _0x482731=typeof _0x21f881[_0x71ab('0x18')]===_0x71ab('0x19')&&typeof _0x21f881[_0x71ab('0x1a')]==='undefined';var _0x44f519=_0x2a97d8[_0x71ab('0x1b')];var _0x17e243=_0x482731?0x0:_0x21f881[_0x71ab('0x18')];var _0x44848f=_0x482731?_0x2a97d8[_0x71ab('0x1b')]:_0x21f881['offset']+_0x21f881['limit'];var _0x21b960;if(_0x44848f>=_0x44f519){_0x44848f=_0x44f519;_0x21b960=0xc8;}else{_0x21b960=0xce;}_0x194f75[_0x71ab('0x16')](_0x21b960);return _0x194f75[_0x71ab('0x1c')]('Content-Range',_0x17e243+'-'+_0x44848f+'/'+_0x44f519)[_0x71ab('0x17')](_0x2a97d8);}return null;};}function patchUpdates(_0x483868){return function(_0x56ec6b){try{jsonpatch['apply'](_0x56ec6b,_0x483868,!![]);}catch(_0x546390){return BPromise[_0x71ab('0x1d')](_0x546390);}return _0x56ec6b[_0x71ab('0x1e')]();};}function saveUpdates(_0x53c887,_0x34559e){return function(_0x24fa9e){if(_0x24fa9e){return _0x24fa9e[_0x71ab('0x1f')](_0x53c887)[_0x71ab('0x20')](function(_0x4e1269){return _0x4e1269;});}return null;};}function removeEntity(_0x3703a5,_0x54c26e){return function(_0x275901){if(_0x275901){return _0x275901[_0x71ab('0x21')]()['then'](function(){_0x3703a5[_0x71ab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495682,_0x5a7954){return function(_0x493ea1){if(!_0x493ea1){_0x495682[_0x71ab('0x15')](0x194);}return _0x493ea1;};}function handleError(_0x33b0b1,_0x136fb3){_0x136fb3=_0x136fb3||0x1f4;return function(_0x111011){logger['error'](_0x111011[_0x71ab('0x22')]);if(_0x111011[_0x71ab('0x23')]){delete _0x111011[_0x71ab('0x23')];}_0x33b0b1[_0x71ab('0x16')](_0x136fb3)[_0x71ab('0x24')](_0x111011);};}exports[_0x71ab('0x25')]=function(_0x4ad0aa,_0x553b88){var _0x149155={},_0xf7527f={},_0x4b2cf0={'count':0x0,'rows':[]};var _0x14678a=_['map'](db[_0x71ab('0x26')][_0x71ab('0x27')],function(_0x2dcbd6){return{'name':_0x2dcbd6['fieldName'],'type':_0x2dcbd6['type'][_0x71ab('0x28')]};});_0xf7527f[_0x71ab('0x29')]=_[_0x71ab('0x2a')](_0x14678a,'name');_0xf7527f[_0x71ab('0x2b')]=_[_0x71ab('0x2c')](_0x4ad0aa['query']);_0xf7527f[_0x71ab('0x2d')]=_['intersection'](_0xf7527f[_0x71ab('0x29')],_0xf7527f[_0x71ab('0x2b')]);_0x149155[_0x71ab('0x2e')]=_['intersection'](_0xf7527f[_0x71ab('0x29')],qs[_0x71ab('0x2f')](_0x4ad0aa[_0x71ab('0x2b')][_0x71ab('0x2f')]));_0x149155[_0x71ab('0x2e')]=_0x149155['attributes'][_0x71ab('0x30')]?_0x149155[_0x71ab('0x2e')]:_0xf7527f[_0x71ab('0x29')];if(!_0x4ad0aa[_0x71ab('0x2b')]['hasOwnProperty'](_0x71ab('0x31'))){_0x149155[_0x71ab('0x1a')]=qs['limit'](_0x4ad0aa[_0x71ab('0x2b')]['limit']);_0x149155[_0x71ab('0x18')]=qs[_0x71ab('0x18')](_0x4ad0aa[_0x71ab('0x2b')][_0x71ab('0x18')]);}_0x149155['order']=qs[_0x71ab('0x32')](_0x4ad0aa['query'][_0x71ab('0x32')]);_0x149155['where']=qs[_0x71ab('0x2d')](_[_0x71ab('0x33')](_0x4ad0aa['query'],_0xf7527f['filters']),_0x14678a);if(_0x4ad0aa[_0x71ab('0x2b')]['filter']){_0x149155[_0x71ab('0x34')]=_['merge'](_0x149155['where'],{'$or':_[_0x71ab('0x2a')](_0x14678a,function(_0x261fab){if(_0x261fab[_0x71ab('0x35')]!==_0x71ab('0x36')){var _0x418bf5={};_0x418bf5[_0x261fab[_0x71ab('0x23')]]={'$like':'%'+_0x4ad0aa['query'][_0x71ab('0x37')]+'%'};return _0x418bf5;}})});}_0x149155=_[_0x71ab('0x38')]({},_0x149155,_0x4ad0aa[_0x71ab('0x39')]);var _0x1ad8c5={'where':_0x149155[_0x71ab('0x34')]};return db[_0x71ab('0x26')][_0x71ab('0x1b')](_0x1ad8c5)[_0x71ab('0x20')](function(_0x8db3df){_0x4b2cf0['count']=_0x8db3df;if(_0x4ad0aa['query'][_0x71ab('0x3a')]){_0x149155[_0x71ab('0x3b')]=[{'all':!![]}];}return db[_0x71ab('0x26')][_0x71ab('0x3c')](_0x149155);})['then'](function(_0xd82929){_0x4b2cf0['rows']=_0xd82929;return _0x4b2cf0;})[_0x71ab('0x20')](respondWithFilteredResult(_0x553b88,_0x149155))[_0x71ab('0x3d')](handleError(_0x553b88,null));};exports[_0x71ab('0x3e')]=function(_0x298f6e,_0x211527){var _0x61bff8={'raw':!![],'where':{'id':_0x298f6e['params']['id']}},_0xb71e89={};_0xb71e89[_0x71ab('0x29')]=_[_0x71ab('0x2c')](db[_0x71ab('0x26')]['rawAttributes']);_0xb71e89[_0x71ab('0x2b')]=_['keys'](_0x298f6e[_0x71ab('0x2b')]);_0xb71e89[_0x71ab('0x2d')]=_[_0x71ab('0x3f')](_0xb71e89[_0x71ab('0x29')],_0xb71e89['query']);_0x61bff8[_0x71ab('0x2e')]=_[_0x71ab('0x3f')](_0xb71e89[_0x71ab('0x29')],qs[_0x71ab('0x2f')](_0x298f6e['query'][_0x71ab('0x2f')]));_0x61bff8['attributes']=_0x61bff8[_0x71ab('0x2e')]['length']?_0x61bff8[_0x71ab('0x2e')]:_0xb71e89['model'];if(_0x298f6e[_0x71ab('0x2b')]['includeAll']){_0x61bff8['include']=[{'all':!![]}];}_0x61bff8=_['merge']({},_0x61bff8,_0x298f6e[_0x71ab('0x39')]);return db[_0x71ab('0x26')][_0x71ab('0x40')](_0x61bff8)[_0x71ab('0x20')](handleEntityNotFound(_0x211527,null))[_0x71ab('0x20')](respondWithResult(_0x211527,null))[_0x71ab('0x3d')](handleError(_0x211527,null));};exports['create']=function(_0x4a81fa,_0x52af41){return db[_0x71ab('0x26')]['create'](_0x4a81fa[_0x71ab('0x41')],{})['then'](respondWithResult(_0x52af41,0xc9))['catch'](handleError(_0x52af41,null));};exports[_0x71ab('0x1f')]=function(_0x1ca7dc,_0x1c3c65){if(_0x1ca7dc[_0x71ab('0x41')]['id']){delete _0x1ca7dc[_0x71ab('0x41')]['id'];}return db['FaxTransferReport'][_0x71ab('0x40')]({'where':{'id':_0x1ca7dc['params']['id']}})[_0x71ab('0x20')](handleEntityNotFound(_0x1c3c65,null))[_0x71ab('0x20')](saveUpdates(_0x1ca7dc[_0x71ab('0x41')],null))['then'](respondWithResult(_0x1c3c65,null))[_0x71ab('0x3d')](handleError(_0x1c3c65,null));};exports[_0x71ab('0x21')]=function(_0x1c01f2,_0x520db3){return db['FaxTransferReport'][_0x71ab('0x40')]({'where':{'id':_0x1c01f2['params']['id']}})[_0x71ab('0x20')](handleEntityNotFound(_0x520db3,null))[_0x71ab('0x20')](removeEntity(_0x520db3,null))[_0x71ab('0x3d')](handleError(_0x520db3,null));};exports[_0x71ab('0x42')]=function(_0x3bb40f,_0x4821dc){return db[_0x71ab('0x26')][_0x71ab('0x42')]()[_0x71ab('0x20')](respondWithResult(_0x4821dc,null))['catch'](handleError(_0x4821dc,null));}; \ No newline at end of file +var _0x8a6f=['json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end'];(function(_0x22e9e2,_0x66a078){var _0x348df0=function(_0x3fb060){while(--_0x3fb060){_0x22e9e2['push'](_0x22e9e2['shift']());}};_0x348df0(++_0x66a078);}(_0x8a6f,0x84));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf8a6('0x0'));var rimraf=require(_0xf8a6('0x1'));var zipdir=require(_0xf8a6('0x2'));var jsonpatch=require(_0xf8a6('0x3'));var rp=require(_0xf8a6('0x4'));var moment=require(_0xf8a6('0x5'));var BPromise=require(_0xf8a6('0x6'));var Mustache=require(_0xf8a6('0x7'));var util=require(_0xf8a6('0x8'));var path=require(_0xf8a6('0x9'));var sox=require(_0xf8a6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8a6('0xb'));var _=require(_0xf8a6('0xc'));var squel=require(_0xf8a6('0xd'));var crypto=require(_0xf8a6('0xe'));var jsforce=require(_0xf8a6('0xf'));var deskjs=require(_0xf8a6('0x10'));var toCsv=require(_0xf8a6('0x11'));var querystring=require(_0xf8a6('0x12'));var Papa=require(_0xf8a6('0x13'));var Redis=require(_0xf8a6('0x14'));var authService=require(_0xf8a6('0x15'));var qs=require(_0xf8a6('0x16'));var as=require(_0xf8a6('0x17'));var hardwareService=require(_0xf8a6('0x18'));var logger=require('../../config/logger')(_0xf8a6('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf8a6('0x1a'));var db=require(_0xf8a6('0x1b'))['db'];function respondWithStatusCode(_0x1f7568,_0x5aed4b){_0x5aed4b=_0x5aed4b||0xcc;return function(_0x3decfc){if(_0x3decfc){return _0x1f7568['sendStatus'](_0x5aed4b);}return _0x1f7568[_0xf8a6('0x1c')](_0x5aed4b)[_0xf8a6('0x1d')]();};}function respondWithResult(_0x27170f,_0x4b0833){_0x4b0833=_0x4b0833||0xc8;return function(_0x52e049){if(_0x52e049){return _0x27170f[_0xf8a6('0x1c')](_0x4b0833)[_0xf8a6('0x1e')](_0x52e049);}};}function respondWithFilteredResult(_0x461f79,_0x472cd5){return function(_0x2242ef){if(_0x2242ef){var _0x439c94=typeof _0x472cd5['offset']===_0xf8a6('0x1f')&&typeof _0x472cd5[_0xf8a6('0x20')]===_0xf8a6('0x1f');var _0x35b7d2=_0x2242ef['count'];var _0x187df1=_0x439c94?0x0:_0x472cd5[_0xf8a6('0x21')];var _0x4d5218=_0x439c94?_0x2242ef[_0xf8a6('0x22')]:_0x472cd5[_0xf8a6('0x21')]+_0x472cd5['limit'];var _0x239a1c;if(_0x4d5218>=_0x35b7d2){_0x4d5218=_0x35b7d2;_0x239a1c=0xc8;}else{_0x239a1c=0xce;}_0x461f79['status'](_0x239a1c);return _0x461f79[_0xf8a6('0x23')](_0xf8a6('0x24'),_0x187df1+'-'+_0x4d5218+'/'+_0x35b7d2)[_0xf8a6('0x1e')](_0x2242ef);}return null;};}function patchUpdates(_0xd9f54f){return function(_0x14ba14){try{jsonpatch[_0xf8a6('0x25')](_0x14ba14,_0xd9f54f,!![]);}catch(_0x8442e8){return BPromise['reject'](_0x8442e8);}return _0x14ba14[_0xf8a6('0x26')]();};}function saveUpdates(_0x1bbe5e,_0x3a9cdd){return function(_0x8ffcad){if(_0x8ffcad){return _0x8ffcad[_0xf8a6('0x27')](_0x1bbe5e)[_0xf8a6('0x28')](function(_0x3111bd){return _0x3111bd;});}return null;};}function removeEntity(_0x683f10,_0x40b2ea){return function(_0xbad5ff){if(_0xbad5ff){return _0xbad5ff[_0xf8a6('0x29')]()[_0xf8a6('0x28')](function(){_0x683f10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58d7ec,_0x2e6d8c){return function(_0x42a27f){if(!_0x42a27f){_0x58d7ec[_0xf8a6('0x2a')](0x194);}return _0x42a27f;};}function handleError(_0x4fa168,_0x780bbb){_0x780bbb=_0x780bbb||0x1f4;return function(_0x509352){logger[_0xf8a6('0x2b')](_0x509352[_0xf8a6('0x2c')]);if(_0x509352[_0xf8a6('0x2d')]){delete _0x509352[_0xf8a6('0x2d')];}_0x4fa168[_0xf8a6('0x1c')](_0x780bbb)[_0xf8a6('0x2e')](_0x509352);};}exports[_0xf8a6('0x2f')]=function(_0x489983,_0x5875ba){var _0x1edb90={},_0x1ed473={},_0x5668f6={'count':0x0,'rows':[]};var _0x57880c=_[_0xf8a6('0x30')](db[_0xf8a6('0x31')][_0xf8a6('0x32')],function(_0x4fa084){return{'name':_0x4fa084[_0xf8a6('0x33')],'type':_0x4fa084[_0xf8a6('0x34')][_0xf8a6('0x35')]};});_0x1ed473[_0xf8a6('0x36')]=_[_0xf8a6('0x30')](_0x57880c,_0xf8a6('0x2d'));_0x1ed473[_0xf8a6('0x37')]=_[_0xf8a6('0x38')](_0x489983['query']);_0x1ed473[_0xf8a6('0x39')]=_[_0xf8a6('0x3a')](_0x1ed473[_0xf8a6('0x36')],_0x1ed473[_0xf8a6('0x37')]);_0x1edb90[_0xf8a6('0x3b')]=_['intersection'](_0x1ed473[_0xf8a6('0x36')],qs[_0xf8a6('0x3c')](_0x489983[_0xf8a6('0x37')]['fields']));_0x1edb90['attributes']=_0x1edb90['attributes'][_0xf8a6('0x3d')]?_0x1edb90[_0xf8a6('0x3b')]:_0x1ed473['model'];if(!_0x489983[_0xf8a6('0x37')][_0xf8a6('0x3e')](_0xf8a6('0x3f'))){_0x1edb90[_0xf8a6('0x20')]=qs[_0xf8a6('0x20')](_0x489983[_0xf8a6('0x37')]['limit']);_0x1edb90[_0xf8a6('0x21')]=qs['offset'](_0x489983[_0xf8a6('0x37')]['offset']);}_0x1edb90[_0xf8a6('0x40')]=qs['sort'](_0x489983[_0xf8a6('0x37')][_0xf8a6('0x41')]);_0x1edb90[_0xf8a6('0x42')]=qs[_0xf8a6('0x39')](_[_0xf8a6('0x43')](_0x489983[_0xf8a6('0x37')],_0x1ed473[_0xf8a6('0x39')]),_0x57880c);if(_0x489983[_0xf8a6('0x37')][_0xf8a6('0x44')]){_0x1edb90[_0xf8a6('0x42')]=_[_0xf8a6('0x45')](_0x1edb90['where'],{'$or':_['map'](_0x57880c,function(_0x1d9a0c){if(_0x1d9a0c[_0xf8a6('0x34')]!==_0xf8a6('0x46')){var _0x128bc3={};_0x128bc3[_0x1d9a0c[_0xf8a6('0x2d')]]={'$like':'%'+_0x489983[_0xf8a6('0x37')][_0xf8a6('0x44')]+'%'};return _0x128bc3;}})});}_0x1edb90=_[_0xf8a6('0x45')]({},_0x1edb90,_0x489983['options']);var _0x368d84={'where':_0x1edb90['where']};return db[_0xf8a6('0x31')][_0xf8a6('0x22')](_0x368d84)[_0xf8a6('0x28')](function(_0x2808d1){_0x5668f6[_0xf8a6('0x22')]=_0x2808d1;if(_0x489983['query'][_0xf8a6('0x47')]){_0x1edb90[_0xf8a6('0x48')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xf8a6('0x49')](_0x1edb90);})[_0xf8a6('0x28')](function(_0x4a9019){_0x5668f6['rows']=_0x4a9019;return _0x5668f6;})[_0xf8a6('0x28')](respondWithFilteredResult(_0x5875ba,_0x1edb90))[_0xf8a6('0x4a')](handleError(_0x5875ba,null));};exports['show']=function(_0x3e7be6,_0x255830){var _0xe78b02={'raw':!![],'where':{'id':_0x3e7be6[_0xf8a6('0x4b')]['id']}},_0x122e84={};_0x122e84[_0xf8a6('0x36')]=_['keys'](db[_0xf8a6('0x31')]['rawAttributes']);_0x122e84[_0xf8a6('0x37')]=_[_0xf8a6('0x38')](_0x3e7be6[_0xf8a6('0x37')]);_0x122e84['filters']=_[_0xf8a6('0x3a')](_0x122e84[_0xf8a6('0x36')],_0x122e84['query']);_0xe78b02[_0xf8a6('0x3b')]=_['intersection'](_0x122e84[_0xf8a6('0x36')],qs['fields'](_0x3e7be6['query'][_0xf8a6('0x3c')]));_0xe78b02[_0xf8a6('0x3b')]=_0xe78b02[_0xf8a6('0x3b')][_0xf8a6('0x3d')]?_0xe78b02[_0xf8a6('0x3b')]:_0x122e84['model'];if(_0x3e7be6[_0xf8a6('0x37')][_0xf8a6('0x47')]){_0xe78b02[_0xf8a6('0x48')]=[{'all':!![]}];}_0xe78b02=_['merge']({},_0xe78b02,_0x3e7be6[_0xf8a6('0x4c')]);return db[_0xf8a6('0x31')][_0xf8a6('0x4d')](_0xe78b02)[_0xf8a6('0x28')](handleEntityNotFound(_0x255830,null))[_0xf8a6('0x28')](respondWithResult(_0x255830,null))[_0xf8a6('0x4a')](handleError(_0x255830,null));};exports[_0xf8a6('0x4e')]=function(_0x24aa5d,_0x2d9989){return db[_0xf8a6('0x31')][_0xf8a6('0x4e')](_0x24aa5d['body'],{})[_0xf8a6('0x28')](respondWithResult(_0x2d9989,0xc9))['catch'](handleError(_0x2d9989,null));};exports[_0xf8a6('0x27')]=function(_0x28e31d,_0x43d515){if(_0x28e31d[_0xf8a6('0x4f')]['id']){delete _0x28e31d[_0xf8a6('0x4f')]['id'];}return db[_0xf8a6('0x31')][_0xf8a6('0x4d')]({'where':{'id':_0x28e31d[_0xf8a6('0x4b')]['id']}})[_0xf8a6('0x28')](handleEntityNotFound(_0x43d515,null))[_0xf8a6('0x28')](saveUpdates(_0x28e31d['body'],null))[_0xf8a6('0x28')](respondWithResult(_0x43d515,null))['catch'](handleError(_0x43d515,null));};exports['destroy']=function(_0x8f524e,_0xb93d1d){return db['FaxTransferReport'][_0xf8a6('0x4d')]({'where':{'id':_0x8f524e[_0xf8a6('0x4b')]['id']}})[_0xf8a6('0x28')](handleEntityNotFound(_0xb93d1d,null))[_0xf8a6('0x28')](removeEntity(_0xb93d1d,null))[_0xf8a6('0x4a')](handleError(_0xb93d1d,null));};exports[_0xf8a6('0x50')]=function(_0x5e9f1a,_0x5acb1b){return db[_0xf8a6('0x31')]['describe']()[_0xf8a6('0x28')](respondWithResult(_0x5acb1b,null))[_0xf8a6('0x4a')](handleError(_0x5acb1b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fc8904c..a2aef1e 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 _0xaf69=['define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x461ce6,_0xe9e972){var _0x20efa7=function(_0xfc685d){while(--_0xfc685d){_0x461ce6['push'](_0x461ce6['shift']());}};_0x20efa7(++_0xe9e972);}(_0xaf69,0x13c));var _0x9af6=function(_0x4ea97b,_0x49b493){_0x4ea97b=_0x4ea97b-0x0;var _0x27f1e9=_0xaf69[_0x4ea97b];return _0x27f1e9;};'use strict';var _=require('lodash');var util=require(_0x9af6('0x0'));var logger=require('../../config/logger')(_0x9af6('0x1'));var moment=require(_0x9af6('0x2'));var BPromise=require('bluebird');var rp=require(_0x9af6('0x3'));var fs=require('fs');var path=require(_0x9af6('0x4'));var rimraf=require(_0x9af6('0x5'));var config=require(_0x9af6('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x9af6('0x7')]=function(_0x5982ed,_0xf7ef2d){return _0x5982ed[_0x9af6('0x8')](_0x9af6('0x9'),attributes,{'tableName':_0x9af6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9af6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d05=['uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxTransferReport.attributes','FaxTransferReport'];(function(_0x11a004,_0x4cf898){var _0x5249ea=function(_0x316b16){while(--_0x316b16){_0x11a004['push'](_0x11a004['shift']());}};_0x5249ea(++_0x4cf898);}(_0x8d05,0xe8));var _0x58d0=function(_0x337bfa,_0xe5d72){_0x337bfa=_0x337bfa-0x0;var _0x1600bb=_0x8d05[_0x337bfa];return _0x1600bb;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var logger=require(_0x58d0('0x2'))(_0x58d0('0x3'));var moment=require(_0x58d0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58d0('0x5'));var rimraf=require(_0x58d0('0x6'));var config=require(_0x58d0('0x7'));var attributes=require(_0x58d0('0x8'));module['exports']=function(_0xdff7f2,_0xb300a9){return _0xdff7f2['define'](_0x58d0('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x58d0('0xa'),'fields':[_0x58d0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c6987d3..308ea67 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 _0xa129=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x57576d,_0x5e2566){var _0x120290=function(_0x2e097){while(--_0x2e097){_0x57576d['push'](_0x57576d['shift']());}};_0x120290(++_0x5e2566);}(_0xa129,0xb7));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var moment=require(_0x9a12('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a12('0x4'))['db'];var utils=require(_0x9a12('0x5'));var logger=require(_0x9a12('0x6'))('rpc');var config=require(_0x9a12('0x7'));var jayson=require(_0x9a12('0x8'));var client=jayson[_0x9a12('0x9')][_0x9a12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fd13,_0x22e6e8,_0x2353fe){return new BPromise(function(_0x1b4252,_0x188adb){return client[_0x9a12('0xb')](_0x49fd13,_0x2353fe)['then'](function(_0x20ac62){logger[_0x9a12('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x22e6e8,_0x9a12('0xd'));logger[_0x9a12('0xe')](_0x9a12('0xf'),_0x22e6e8,_0x9a12('0xd'),JSON[_0x9a12('0x10')](_0x20ac62));if(_0x20ac62[_0x9a12('0x11')]){if(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x12')]===0x1f4){logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x20ac62['error'][_0x9a12('0x14')]);return _0x188adb(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);}logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);return _0x1b4252(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);}else{logger[_0x9a12('0xc')](_0x9a12('0x13'),_0x22e6e8,'request\x20sent');_0x1b4252(_0x20ac62[_0x9a12('0x15')]['message']);}})[_0x9a12('0x16')](function(_0x1eeb8e){logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x1eeb8e);_0x188adb(_0x1eeb8e);});});} \ No newline at end of file +var _0x48f6=['../../config/environment','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x48f6,0x1ee));var _0x648f=function(_0x789cf2,_0x42b949){_0x789cf2=_0x789cf2-0x0;var _0x95d76b=_0x48f6[_0x789cf2];return _0x95d76b;};'use strict';var _=require(_0x648f('0x0'));var util=require('util');var moment=require(_0x648f('0x1'));var BPromise=require('bluebird');var rs=require(_0x648f('0x2'));var fs=require('fs');var Redis=require(_0x648f('0x3'));var db=require(_0x648f('0x4'))['db'];var utils=require(_0x648f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x648f('0x6'));var jayson=require(_0x648f('0x7'));var client=jayson['client'][_0x648f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9e3d09,_0x3bc009,_0x4fe671){return new BPromise(function(_0x1b5799,_0x1fa50d){return client[_0x648f('0x9')](_0x9e3d09,_0x4fe671)['then'](function(_0x1106fc){logger[_0x648f('0xa')](_0x648f('0xb'),_0x3bc009,_0x648f('0xc'));logger[_0x648f('0xd')](_0x648f('0xe'),_0x3bc009,_0x648f('0xc'),JSON[_0x648f('0xf')](_0x1106fc));if(_0x1106fc[_0x648f('0x10')]){if(_0x1106fc[_0x648f('0x10')][_0x648f('0x11')]===0x1f4){logger[_0x648f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x3bc009,_0x1106fc[_0x648f('0x10')][_0x648f('0x12')]);return _0x1fa50d(_0x1106fc[_0x648f('0x10')][_0x648f('0x12')]);}logger['error'](_0x648f('0xb'),_0x3bc009,_0x1106fc[_0x648f('0x10')][_0x648f('0x12')]);return _0x1b5799(_0x1106fc['error']['message']);}else{logger[_0x648f('0xa')](_0x648f('0xb'),_0x3bc009,'request\x20sent');_0x1b5799(_0x1106fc[_0x648f('0x13')]['message']);}})['catch'](function(_0x410f76){logger[_0x648f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x3bc009,_0x410f76);_0x1fa50d(_0x410f76);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index bba8264..d1d6171 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 _0xbc57=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','exports'];(function(_0x255689,_0x28fd4c){var _0x417f69=function(_0x4b8431){while(--_0x4b8431){_0x255689['push'](_0x255689['shift']());}};_0x417f69(++_0x28fd4c);}(_0xbc57,0x1ee));var _0x7bc5=function(_0x3835f4,_0x58b13a){_0x3835f4=_0x3835f4-0x0;var _0x17e2df=_0xbc57[_0x3835f4];return _0x17e2df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7bc5('0x0'));var timeout=require(_0x7bc5('0x1'));var express=require(_0x7bc5('0x2'));var router=express[_0x7bc5('0x3')]();var fs_extra=require(_0x7bc5('0x4'));var auth=require(_0x7bc5('0x5'));var interaction=require(_0x7bc5('0x6'));var config=require(_0x7bc5('0x7'));var controller=require(_0x7bc5('0x8'));router[_0x7bc5('0x9')]('/',auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xb')]);router[_0x7bc5('0x9')](_0x7bc5('0xc'),auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xd')]);router[_0x7bc5('0x9')](_0x7bc5('0xe'),auth[_0x7bc5('0xa')](),controller['show']);router['post']('/',auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xf')]);router['put'](_0x7bc5('0xe'),auth[_0x7bc5('0xa')](),controller[_0x7bc5('0x10')]);router[_0x7bc5('0x11')]('/:id',auth[_0x7bc5('0xa')](),controller['destroy']);module[_0x7bc5('0x12')]=router; \ No newline at end of file +var _0x462a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x462a,0x127));var _0xa462=function(_0x500611,_0x179481){_0x500611=_0x500611-0x0;var _0x379d32=_0x462a[_0x500611];return _0x379d32;};'use strict';var multer=require(_0xa462('0x0'));var util=require('util');var path=require(_0xa462('0x1'));var timeout=require(_0xa462('0x2'));var express=require(_0xa462('0x3'));var router=express[_0xa462('0x4')]();var fs_extra=require(_0xa462('0x5'));var auth=require(_0xa462('0x6'));var interaction=require(_0xa462('0x7'));var config=require(_0xa462('0x8'));var controller=require(_0xa462('0x9'));router[_0xa462('0xa')]('/',auth[_0xa462('0xb')](),controller[_0xa462('0xc')]);router['get']('/describe',auth[_0xa462('0xb')](),controller[_0xa462('0xd')]);router['get'](_0xa462('0xe'),auth[_0xa462('0xb')](),controller[_0xa462('0xf')]);router['post']('/',auth[_0xa462('0xb')](),controller[_0xa462('0x10')]);router[_0xa462('0x11')](_0xa462('0xe'),auth[_0xa462('0xb')](),controller['update']);router[_0xa462('0x12')](_0xa462('0xe'),auth['isAuthenticated'](),controller[_0xa462('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index dcd0395..5d7ccb7 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 _0x16b0=['show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x57e73c,_0x256531){var _0xd298b3=function(_0x20e22e){while(--_0x20e22e){_0x57e73c['push'](_0x57e73c['shift']());}};_0xd298b3(++_0x256531);}(_0x16b0,0x1a3));var _0x016b=function(_0x5d170b,_0x26b53a){_0x5d170b=_0x5d170b-0x0;var _0x19e761=_0x16b0[_0x5d170b];return _0x19e761;};'use strict';var multer=require('multer');var util=require(_0x016b('0x0'));var path=require(_0x016b('0x1'));var timeout=require(_0x016b('0x2'));var express=require(_0x016b('0x3'));var router=express[_0x016b('0x4')]();var fs_extra=require(_0x016b('0x5'));var auth=require(_0x016b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x016b('0x7'));var controller=require(_0x016b('0x8'));router[_0x016b('0x9')]('/',auth[_0x016b('0xa')](),controller[_0x016b('0xb')]);router[_0x016b('0x9')](_0x016b('0xc'),auth[_0x016b('0xa')](),controller[_0x016b('0xd')]);router[_0x016b('0x9')](_0x016b('0xe'),auth[_0x016b('0xa')](),controller[_0x016b('0xf')]);router['get']('/:id/fields',auth[_0x016b('0xa')](),controller[_0x016b('0x10')]);router['post']('/',auth[_0x016b('0xa')](),controller[_0x016b('0x11')]);router['post']('/:id/configurations',auth[_0x016b('0xa')](),controller[_0x016b('0x12')]);router[_0x016b('0x13')](_0x016b('0xc'),auth[_0x016b('0xa')](),controller[_0x016b('0x14')]);router[_0x016b('0x15')](_0x016b('0xc'),auth['isAuthenticated'](),controller[_0x016b('0x16')]);module[_0x016b('0x17')]=router; \ No newline at end of file +var _0xa045=['Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x9e5aa9,_0x102a92){var _0x5597cd=function(_0x4bf6cf){while(--_0x4bf6cf){_0x9e5aa9['push'](_0x9e5aa9['shift']());}};_0x5597cd(++_0x102a92);}(_0xa045,0xde));var _0x5a04=function(_0x385e7a,_0x7ffd81){_0x385e7a=_0x385e7a-0x0;var _0x164a3d=_0xa045[_0x385e7a];return _0x164a3d;};'use strict';var multer=require(_0x5a04('0x0'));var util=require(_0x5a04('0x1'));var path=require(_0x5a04('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a04('0x3')]();var fs_extra=require(_0x5a04('0x4'));var auth=require(_0x5a04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a04('0x6'));var controller=require(_0x5a04('0x7'));router[_0x5a04('0x8')]('/',auth[_0x5a04('0x9')](),controller[_0x5a04('0xa')]);router[_0x5a04('0x8')](_0x5a04('0xb'),auth[_0x5a04('0x9')](),controller[_0x5a04('0xc')]);router['get'](_0x5a04('0xd'),auth['isAuthenticated'](),controller[_0x5a04('0xe')]);router['get'](_0x5a04('0xf'),auth[_0x5a04('0x9')](),controller[_0x5a04('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a04('0x11')]);router[_0x5a04('0x12')](_0x5a04('0xd'),auth[_0x5a04('0x9')](),controller[_0x5a04('0x13')]);router[_0x5a04('0x14')](_0x5a04('0xb'),auth['isAuthenticated'](),controller[_0x5a04('0x15')]);router[_0x5a04('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5a04('0x17')]);module[_0x5a04('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a09ddb8..79aa4ce 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 _0x243a=['STRING','basic','ENUM','integrationTab','newTab','exports'];(function(_0x3de221,_0xd26072){var _0x19dfe2=function(_0x576f15){while(--_0x576f15){_0x3de221['push'](_0x3de221['shift']());}};_0x19dfe2(++_0xd26072);}(_0x243a,0xfb));var _0xa243=function(_0x16be0e,_0x5d8b7a){_0x16be0e=_0x16be0e-0x0;var _0x2d2cd6=_0x243a[_0x16be0e];return _0x2d2cd6;};'use strict';var Sequelize=require('sequelize');module[_0xa243('0x0')]={'name':{'type':Sequelize[_0xa243('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa243('0x1')]},'remoteUri':{'type':Sequelize[_0xa243('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xa243('0x2')),'defaultValue':_0xa243('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa243('0x1')]},'consumerSecret':{'type':Sequelize[_0xa243('0x1')]},'token':{'type':Sequelize[_0xa243('0x1')]},'tokenSecret':{'type':Sequelize[_0xa243('0x1')]},'serverUrl':{'type':Sequelize[_0xa243('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa243('0x3')](_0xa243('0x4'),_0xa243('0x5')),'defaultValue':_0xa243('0x4')}}; \ No newline at end of file +var _0x006d=['STRING','newTab','integrationTab','sequelize'];(function(_0x493a4e,_0xf4556c){var _0x3ab197=function(_0x539553){while(--_0x539553){_0x493a4e['push'](_0x493a4e['shift']());}};_0x3ab197(++_0xf4556c);}(_0x006d,0x11f));var _0xd006=function(_0x28a858,_0x3268ac){_0x28a858=_0x28a858-0x0;var _0xde609c=_0x006d[_0x28a858];return _0xde609c;};'use strict';var Sequelize=require(_0xd006('0x0'));module['exports']={'name':{'type':Sequelize[_0xd006('0x1')]},'description':{'type':Sequelize[_0xd006('0x1')]},'username':{'type':Sequelize[_0xd006('0x1')]},'remoteUri':{'type':Sequelize[_0xd006('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd006('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd006('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xd006('0x2')),'defaultValue':_0xd006('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a329b99..12c68c6 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 _0x198a=['pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','username','password','toString','_embedded','entries','active','label','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters'];(function(_0x502137,_0x372ad2){var _0x443ecf=function(_0x4baaad){while(--_0x4baaad){_0x502137['push'](_0x502137['shift']());}};_0x443ecf(++_0x372ad2);}(_0x198a,0x11c));var _0xa198=function(_0x48bea0,_0x4c7a11){_0x48bea0=_0x48bea0-0x0;var _0x58058d=_0x198a[_0x48bea0];return _0x58058d;};'use strict';var emlformat=require(_0xa198('0x0'));var rimraf=require(_0xa198('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa198('0x2'));var rp=require(_0xa198('0x3'));var moment=require(_0xa198('0x4'));var BPromise=require(_0xa198('0x5'));var Mustache=require(_0xa198('0x6'));var util=require(_0xa198('0x7'));var path=require(_0xa198('0x8'));var sox=require(_0xa198('0x9'));var csv=require('to-csv');var ejs=require(_0xa198('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa198('0xb'));var squel=require(_0xa198('0xc'));var crypto=require(_0xa198('0xd'));var jsforce=require(_0xa198('0xe'));var deskjs=require(_0xa198('0xf'));var toCsv=require(_0xa198('0x10'));var querystring=require('querystring');var Papa=require(_0xa198('0x11'));var Redis=require('ioredis');var authService=require(_0xa198('0x12'));var qs=require(_0xa198('0x13'));var as=require(_0xa198('0x14'));var hardwareService=require(_0xa198('0x15'));var logger=require(_0xa198('0x16'))(_0xa198('0x17'));var utils=require(_0xa198('0x18'));var config=require(_0xa198('0x19'));var licenseUtil=require(_0xa198('0x1a'));var db=require(_0xa198('0x1b'))['db'];var integrations=require(_0xa198('0x1c'));function respondWithStatusCode(_0x1e0cc8,_0x5d578f){_0x5d578f=_0x5d578f||0xcc;return function(_0x17de0e){if(_0x17de0e){return _0x1e0cc8[_0xa198('0x1d')](_0x5d578f);}return _0x1e0cc8[_0xa198('0x1e')](_0x5d578f)[_0xa198('0x1f')]();};}function respondWithResult(_0x33516c,_0x1cfe84){_0x1cfe84=_0x1cfe84||0xc8;return function(_0xc3e61c){if(_0xc3e61c){return _0x33516c['status'](_0x1cfe84)[_0xa198('0x20')](_0xc3e61c);}};}function respondWithFilteredResult(_0x222142,_0x13e127){return function(_0x1fb172){if(_0x1fb172){var _0x5e06b9=typeof _0x13e127[_0xa198('0x21')]===_0xa198('0x22')&&typeof _0x13e127[_0xa198('0x23')]===_0xa198('0x22');var _0x18f87b=_0x1fb172['count'];var _0x444148=_0x5e06b9?0x0:_0x13e127[_0xa198('0x21')];var _0x4cea9d=_0x5e06b9?_0x1fb172[_0xa198('0x24')]:_0x13e127['offset']+_0x13e127[_0xa198('0x23')];var _0x1be7be;if(_0x4cea9d>=_0x18f87b){_0x4cea9d=_0x18f87b;_0x1be7be=0xc8;}else{_0x1be7be=0xce;}_0x222142[_0xa198('0x1e')](_0x1be7be);return _0x222142[_0xa198('0x25')](_0xa198('0x26'),_0x444148+'-'+_0x4cea9d+'/'+_0x18f87b)[_0xa198('0x20')](_0x1fb172);}return null;};}function patchUpdates(_0x34be2c){return function(_0x2a4f44){try{jsonpatch['apply'](_0x2a4f44,_0x34be2c,!![]);}catch(_0x45fdb2){return BPromise[_0xa198('0x27')](_0x45fdb2);}return _0x2a4f44[_0xa198('0x28')]();};}function saveUpdates(_0x1b7058,_0xa2189){return function(_0x539919){if(_0x539919){return _0x539919['update'](_0x1b7058)[_0xa198('0x29')](function(_0x917d1c){return _0x917d1c;});}return null;};}function removeEntity(_0x17d8af,_0x1e7094){return function(_0x3e6638){if(_0x3e6638){return _0x3e6638[_0xa198('0x2a')]()[_0xa198('0x29')](function(){_0x17d8af[_0xa198('0x1e')](0xcc)[_0xa198('0x1f')]();});}};}function handleEntityNotFound(_0x1fc084,_0x9d727c){return function(_0x46b420){if(!_0x46b420){_0x1fc084['sendStatus'](0x194);}return _0x46b420;};}function handleError(_0x44142a,_0x2c3537){_0x2c3537=_0x2c3537||0x1f4;return function(_0x937de){logger[_0xa198('0x2b')](_0x937de[_0xa198('0x2c')]);if(_0x937de[_0xa198('0x2d')]){delete _0x937de['name'];}_0x44142a[_0xa198('0x1e')](_0x2c3537)[_0xa198('0x2e')](_0x937de);};}exports[_0xa198('0x2f')]=function(_0x3b2a2e,_0x1e90aa){var _0x5a4237={},_0x4dc22b={},_0x12c650={'count':0x0,'rows':[]};var _0x22b44a=_[_0xa198('0x30')](db[_0xa198('0x31')][_0xa198('0x32')],function(_0x3b1f13){return{'name':_0x3b1f13['fieldName'],'type':_0x3b1f13[_0xa198('0x33')][_0xa198('0x34')]};});_0x4dc22b['model']=_[_0xa198('0x30')](_0x22b44a,_0xa198('0x2d'));_0x4dc22b[_0xa198('0x35')]=_[_0xa198('0x36')](_0x3b2a2e[_0xa198('0x35')]);_0x4dc22b['filters']=_[_0xa198('0x37')](_0x4dc22b['model'],_0x4dc22b[_0xa198('0x35')]);_0x5a4237['attributes']=_[_0xa198('0x37')](_0x4dc22b[_0xa198('0x38')],qs['fields'](_0x3b2a2e['query'][_0xa198('0x39')]));_0x5a4237[_0xa198('0x3a')]=_0x5a4237[_0xa198('0x3a')][_0xa198('0x3b')]?_0x5a4237[_0xa198('0x3a')]:_0x4dc22b[_0xa198('0x38')];if(!_0x3b2a2e[_0xa198('0x35')]['hasOwnProperty']('nolimit')){_0x5a4237[_0xa198('0x23')]=qs[_0xa198('0x23')](_0x3b2a2e['query'][_0xa198('0x23')]);_0x5a4237[_0xa198('0x21')]=qs['offset'](_0x3b2a2e[_0xa198('0x35')]['offset']);}_0x5a4237[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x3b2a2e[_0xa198('0x35')][_0xa198('0x3d')]);_0x5a4237[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_[_0xa198('0x40')](_0x3b2a2e[_0xa198('0x35')],_0x4dc22b['filters']),_0x22b44a);if(_0x3b2a2e['query'][_0xa198('0x41')]){_0x5a4237[_0xa198('0x3e')]=_[_0xa198('0x42')](_0x5a4237[_0xa198('0x3e')],{'$or':_[_0xa198('0x30')](_0x22b44a,function(_0xe55b5e){if(_0xe55b5e['type']!==_0xa198('0x43')){var _0x3a804e={};_0x3a804e[_0xe55b5e['name']]={'$like':'%'+_0x3b2a2e[_0xa198('0x35')][_0xa198('0x41')]+'%'};return _0x3a804e;}})});}_0x5a4237=_['merge']({},_0x5a4237,_0x3b2a2e[_0xa198('0x44')]);var _0x252857={'where':_0x5a4237[_0xa198('0x3e')]};return db['DeskAccount'][_0xa198('0x24')](_0x252857)[_0xa198('0x29')](function(_0xf06978){_0x12c650[_0xa198('0x24')]=_0xf06978;if(_0x3b2a2e[_0xa198('0x35')][_0xa198('0x45')]){_0x5a4237[_0xa198('0x46')]=[{'all':!![]}];}return db[_0xa198('0x31')]['findAll'](_0x5a4237);})[_0xa198('0x29')](function(_0x1fd890){_0x12c650['rows']=_0x1fd890;return _0x12c650;})[_0xa198('0x29')](respondWithFilteredResult(_0x1e90aa,_0x5a4237))[_0xa198('0x47')](handleError(_0x1e90aa,null));};exports[_0xa198('0x48')]=function(_0x2dda99,_0x4df61f){var _0x472216={'raw':![],'where':{'id':_0x2dda99[_0xa198('0x49')]['id']}},_0xacce44={};_0xacce44['model']=_[_0xa198('0x36')](db[_0xa198('0x31')][_0xa198('0x32')]);_0xacce44[_0xa198('0x35')]=_[_0xa198('0x36')](_0x2dda99[_0xa198('0x35')]);_0xacce44[_0xa198('0x3f')]=_[_0xa198('0x37')](_0xacce44[_0xa198('0x38')],_0xacce44[_0xa198('0x35')]);_0x472216['attributes']=_[_0xa198('0x37')](_0xacce44[_0xa198('0x38')],qs[_0xa198('0x39')](_0x2dda99['query'][_0xa198('0x39')]));_0x472216[_0xa198('0x3a')]=_0x472216[_0xa198('0x3a')][_0xa198('0x3b')]?_0x472216[_0xa198('0x3a')]:_0xacce44[_0xa198('0x38')];if(_0x2dda99['query'][_0xa198('0x45')]){_0x472216[_0xa198('0x46')]=[{'all':!![]}];}_0x472216=_[_0xa198('0x42')]({},_0x472216,_0x2dda99[_0xa198('0x44')]);return db[_0xa198('0x31')][_0xa198('0x4a')](_0x472216)[_0xa198('0x29')](handleEntityNotFound(_0x4df61f,null))[_0xa198('0x29')](respondWithResult(_0x4df61f,null))[_0xa198('0x47')](handleError(_0x4df61f,null));};exports[_0xa198('0x4b')]=function(_0x212e2c,_0x5a2e1b){return db[_0xa198('0x31')][_0xa198('0x4b')](_0x212e2c[_0xa198('0x4c')],{})[_0xa198('0x29')](respondWithResult(_0x5a2e1b,0xc9))[_0xa198('0x47')](handleError(_0x5a2e1b,null));};exports[_0xa198('0x4d')]=function(_0x294ccf,_0x3c5b4b){if(_0x294ccf[_0xa198('0x4c')]['id']){delete _0x294ccf[_0xa198('0x4c')]['id'];}return db['DeskAccount'][_0xa198('0x4a')]({'where':{'id':_0x294ccf[_0xa198('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c5b4b,null))[_0xa198('0x29')](saveUpdates(_0x294ccf['body'],null))[_0xa198('0x29')](respondWithResult(_0x3c5b4b,null))['catch'](handleError(_0x3c5b4b,null));};exports[_0xa198('0x2a')]=function(_0x3aa661,_0x33830a){return db[_0xa198('0x31')][_0xa198('0x4a')]({'where':{'id':_0x3aa661[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0x33830a,null))[_0xa198('0x29')](removeEntity(_0x33830a,null))['catch'](handleError(_0x33830a,null));};exports[_0xa198('0x4e')]=function(_0x5aa6b4,_0x375488,_0x2fcb85){var _0x3257d4={};var _0x39e08d={};var _0xdbe2b2;var _0x1c1c9d;return db[_0xa198('0x31')]['findOne']({'where':{'id':_0x5aa6b4['params']['id']}})[_0xa198('0x29')](handleEntityNotFound(_0x375488,null))[_0xa198('0x29')](function(_0x1dd645){if(_0x1dd645){_0xdbe2b2=_0x1dd645;_0x39e08d['model']=_[_0xa198('0x36')](db[_0xa198('0x4f')][_0xa198('0x32')]);_0x39e08d[_0xa198('0x35')]=_[_0xa198('0x36')](_0x5aa6b4[_0xa198('0x35')]);_0x39e08d[_0xa198('0x3f')]=_[_0xa198('0x37')](_0x39e08d[_0xa198('0x38')],_0x39e08d['query']);_0x3257d4[_0xa198('0x3a')]=_['intersection'](_0x39e08d[_0xa198('0x38')],qs[_0xa198('0x39')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x39')]));_0x3257d4[_0xa198('0x3a')]=_0x3257d4[_0xa198('0x3a')][_0xa198('0x3b')]?_0x3257d4[_0xa198('0x3a')]:_0x39e08d[_0xa198('0x38')];_0x3257d4[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x3d')]);_0x3257d4[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_['pick'](_0x5aa6b4['query'],_0x39e08d[_0xa198('0x3f')]));if(_0x5aa6b4[_0xa198('0x35')][_0xa198('0x41')]){_0x3257d4[_0xa198('0x3e')]=_[_0xa198('0x42')](_0x3257d4[_0xa198('0x3e')],{'$or':_[_0xa198('0x30')](_0x3257d4[_0xa198('0x3a')],function(_0x168e53){var _0x543aa1={};_0x543aa1[_0x168e53]={'$like':'%'+_0x5aa6b4['query'][_0xa198('0x41')]+'%'};return _0x543aa1;})});}_0x3257d4=_['merge']({},_0x3257d4,_0x5aa6b4[_0xa198('0x44')]);return _0xdbe2b2[_0xa198('0x4e')](_0x3257d4);}})[_0xa198('0x29')](function(_0x4d0e91){if(_0x4d0e91){_0x1c1c9d=_0x4d0e91['length'];if(!_0x5aa6b4[_0xa198('0x35')][_0xa198('0x50')](_0xa198('0x51'))){_0x3257d4[_0xa198('0x23')]=qs[_0xa198('0x23')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x23')]);_0x3257d4[_0xa198('0x21')]=qs[_0xa198('0x21')](_0x5aa6b4[_0xa198('0x35')]['offset']);}return _0xdbe2b2[_0xa198('0x4e')](_0x3257d4);}})['then'](function(_0x1388a3){if(_0x1388a3){return _0x1388a3?{'count':_0x1c1c9d,'rows':_0x1388a3}:null;}})[_0xa198('0x29')](respondWithResult(_0x375488,null))[_0xa198('0x47')](handleError(_0x375488,null));};exports[_0xa198('0x52')]=function(_0x1f2915,_0xfea1d3,_0x2432c8){if(_0x1f2915[_0xa198('0x4c')]['id']){delete _0x1f2915['body']['id'];}return db[_0xa198('0x31')][_0xa198('0x53')]({'where':{'id':_0x1f2915[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0xfea1d3,null))[_0xa198('0x29')](function(_0x1274f9){if(_0x1274f9){_0x1f2915[_0xa198('0x4c')][_0xa198('0x54')]=_0x1274f9['id'];_0x1f2915[_0xa198('0x4c')][_0xa198('0x55')]=integrations[_0xa198('0x56')](_0x1f2915[_0xa198('0x4c')]['channel'],_0x1f2915['body'][_0xa198('0x33')]);_0x1f2915[_0xa198('0x4c')]['Descriptions']=integrations[_0xa198('0x57')](_0x1f2915[_0xa198('0x4c')]['channel'],_0x1f2915['body'][_0xa198('0x33')]);return db[_0xa198('0x4f')][_0xa198('0x4b')](_0x1f2915[_0xa198('0x4c')],{'include':[{'model':db[_0xa198('0x58')],'as':_0xa198('0x55')},{'model':db[_0xa198('0x58')],'as':_0xa198('0x59')}]});}return null;})[_0xa198('0x29')](respondWithResult(_0xfea1d3,null))['catch'](handleError(_0xfea1d3,null));};exports[_0xa198('0x5a')]=function(_0x52e763,_0x9390ca,_0x3b281f){var _0x38b2c1=[{'name':_0xa198('0x5b'),'label':_0xa198('0x5b'),'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 _0x19a622='';return db[_0xa198('0x31')][_0xa198('0x53')]({'where':{'id':_0x52e763[_0xa198('0x49')]['id']},'attributes':['id',_0xa198('0x5c'),_0xa198('0x5d'),'username','password',_0xa198('0x5e'),_0xa198('0x5f'),'token',_0xa198('0x60')]})[_0xa198('0x29')](handleEntityNotFound(_0x9390ca,null))[_0xa198('0x29')](function(_0x5f54c1){if(_0x5f54c1){_0x19a622=_0x5f54c1[_0xa198('0x5c')];var _0x3b98f4=_0x19a622[_0xa198('0x61')](-0x1);if(_0x3b98f4==='/'){_0x19a622=_0x19a622[_0xa198('0x62')](0x0,_0x19a622[_0xa198('0x63')](_0x3b98f4));}var _0x3eb533={'method':_0xa198('0x64'),'uri':util[_0xa198('0x65')](_0xa198('0x66'),_0x19a622),'headers':{'Content-Type':_0xa198('0x67'),'Accept':_0xa198('0x67')},'json':!![]};if(_0x5f54c1[_0xa198('0x5d')]==='basic'){_0x3eb533[_0xa198('0x68')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0xa198('0x65')]('%s:%s',_0x5f54c1[_0xa198('0x69')],_0x5f54c1[_0xa198('0x6a')]))[_0xa198('0x6b')]('base64'));}return rp(_0x3eb533)[_0xa198('0x29')](function(_0x108d25){return _0x38b2c1['concat'](_[_0xa198('0x30')](_0x108d25[_0xa198('0x6c')][_0xa198('0x6d')],function(_0xcf0058){return{'id':_0xcf0058['name'],'name':_0xcf0058[_0xa198('0x2d')],'type':_0xcf0058[_0xa198('0x33')],'active':_0xcf0058[_0xa198('0x6e')],'label':_0xcf0058[_0xa198('0x6f')],'custom':!![]};}));});}})[_0xa198('0x29')](function(_0x5a371a){return{'count':_0x5a371a[_0xa198('0x3b')],'rows':_0x5a371a};})['then'](respondWithResult(_0x9390ca,null))['catch'](function(_0xd60fbc){var _0x2be450=_0x52e763['query'][_0xa198('0x70')]?0x1f4:_0xd60fbc['statusCode']||0x1f4;logger[_0xa198('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xa198('0x5a'),_0x2be450,JSON[_0xa198('0x71')](_0xd60fbc));delete _0xd60fbc[_0xa198('0x2d')];if(_0x2be450===0x191){_0x2be450=0x190;}_0x9390ca['status'](_0x2be450)[_0xa198('0x2e')](_0x52e763[_0xa198('0x35')][_0xa198('0x70')]?{'message':_0xa198('0x72'),'statusCode':_0xd60fbc[_0xa198('0x73')]}:_0xd60fbc);});}; \ No newline at end of file +var _0x7d9d=['filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','channel','DeskConfiguration','DeskField','getFields','priority','authType','consumerKey','tokenSecret','remoteUri','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','format','Basic\x20%s','%s:%s','username','password','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0x7d9d,0x11e));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7d9('0x0'));var rimraf=require(_0xd7d9('0x1'));var zipdir=require(_0xd7d9('0x2'));var jsonpatch=require(_0xd7d9('0x3'));var rp=require(_0xd7d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7d9('0x5'));var util=require(_0xd7d9('0x6'));var path=require(_0xd7d9('0x7'));var sox=require('sox');var csv=require(_0xd7d9('0x8'));var ejs=require(_0xd7d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7d9('0xa'));var squel=require(_0xd7d9('0xb'));var crypto=require('crypto');var jsforce=require(_0xd7d9('0xc'));var deskjs=require(_0xd7d9('0xd'));var toCsv=require(_0xd7d9('0x8'));var querystring=require(_0xd7d9('0xe'));var Papa=require(_0xd7d9('0xf'));var Redis=require(_0xd7d9('0x10'));var authService=require(_0xd7d9('0x11'));var qs=require(_0xd7d9('0x12'));var as=require(_0xd7d9('0x13'));var hardwareService=require(_0xd7d9('0x14'));var logger=require(_0xd7d9('0x15'))(_0xd7d9('0x16'));var utils=require(_0xd7d9('0x17'));var config=require(_0xd7d9('0x18'));var licenseUtil=require(_0xd7d9('0x19'));var db=require(_0xd7d9('0x1a'))['db'];var integrations=require(_0xd7d9('0x1b'));function respondWithStatusCode(_0x36f1c1,_0x582044){_0x582044=_0x582044||0xcc;return function(_0xcc7252){if(_0xcc7252){return _0x36f1c1[_0xd7d9('0x1c')](_0x582044);}return _0x36f1c1['status'](_0x582044)[_0xd7d9('0x1d')]();};}function respondWithResult(_0x66abe1,_0x4fd267){_0x4fd267=_0x4fd267||0xc8;return function(_0x300d57){if(_0x300d57){return _0x66abe1['status'](_0x4fd267)[_0xd7d9('0x1e')](_0x300d57);}};}function respondWithFilteredResult(_0x32c491,_0x1c8c4e){return function(_0x1fa58a){if(_0x1fa58a){var _0x1268ee=typeof _0x1c8c4e[_0xd7d9('0x1f')]===_0xd7d9('0x20')&&typeof _0x1c8c4e[_0xd7d9('0x21')]===_0xd7d9('0x20');var _0x56eab1=_0x1fa58a['count'];var _0x579458=_0x1268ee?0x0:_0x1c8c4e['offset'];var _0x283bee=_0x1268ee?_0x1fa58a[_0xd7d9('0x22')]:_0x1c8c4e[_0xd7d9('0x1f')]+_0x1c8c4e['limit'];var _0x2484fe;if(_0x283bee>=_0x56eab1){_0x283bee=_0x56eab1;_0x2484fe=0xc8;}else{_0x2484fe=0xce;}_0x32c491[_0xd7d9('0x23')](_0x2484fe);return _0x32c491['set'](_0xd7d9('0x24'),_0x579458+'-'+_0x283bee+'/'+_0x56eab1)[_0xd7d9('0x1e')](_0x1fa58a);}return null;};}function patchUpdates(_0x1af7a0){return function(_0x5a23d0){try{jsonpatch[_0xd7d9('0x25')](_0x5a23d0,_0x1af7a0,!![]);}catch(_0x426bbd){return BPromise[_0xd7d9('0x26')](_0x426bbd);}return _0x5a23d0[_0xd7d9('0x27')]();};}function saveUpdates(_0x19ba00,_0xde96e2){return function(_0x17eeb9){if(_0x17eeb9){return _0x17eeb9[_0xd7d9('0x28')](_0x19ba00)[_0xd7d9('0x29')](function(_0x45fcd7){return _0x45fcd7;});}return null;};}function removeEntity(_0x329856,_0x492a84){return function(_0x577c08){if(_0x577c08){return _0x577c08['destroy']()[_0xd7d9('0x29')](function(){_0x329856[_0xd7d9('0x23')](0xcc)[_0xd7d9('0x1d')]();});}};}function handleEntityNotFound(_0x324d6a,_0x51a255){return function(_0x2f5613){if(!_0x2f5613){_0x324d6a[_0xd7d9('0x1c')](0x194);}return _0x2f5613;};}function handleError(_0x21ecfc,_0x5e2977){_0x5e2977=_0x5e2977||0x1f4;return function(_0xdc7d1b){logger['error'](_0xdc7d1b[_0xd7d9('0x2a')]);if(_0xdc7d1b[_0xd7d9('0x2b')]){delete _0xdc7d1b[_0xd7d9('0x2b')];}_0x21ecfc[_0xd7d9('0x23')](_0x5e2977)[_0xd7d9('0x2c')](_0xdc7d1b);};}exports[_0xd7d9('0x2d')]=function(_0x3c7369,_0x434fee){var _0x3a4adc={},_0x2ab11d={},_0x436423={'count':0x0,'rows':[]};var _0x3f04f8=_[_0xd7d9('0x2e')](db[_0xd7d9('0x2f')][_0xd7d9('0x30')],function(_0x32f2cf){return{'name':_0x32f2cf['fieldName'],'type':_0x32f2cf[_0xd7d9('0x31')][_0xd7d9('0x32')]};});_0x2ab11d['model']=_[_0xd7d9('0x2e')](_0x3f04f8,'name');_0x2ab11d[_0xd7d9('0x33')]=_[_0xd7d9('0x34')](_0x3c7369['query']);_0x2ab11d['filters']=_[_0xd7d9('0x35')](_0x2ab11d[_0xd7d9('0x36')],_0x2ab11d['query']);_0x3a4adc[_0xd7d9('0x37')]=_[_0xd7d9('0x35')](_0x2ab11d[_0xd7d9('0x36')],qs[_0xd7d9('0x38')](_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x38')]));_0x3a4adc[_0xd7d9('0x37')]=_0x3a4adc[_0xd7d9('0x37')][_0xd7d9('0x39')]?_0x3a4adc[_0xd7d9('0x37')]:_0x2ab11d[_0xd7d9('0x36')];if(!_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x3a')](_0xd7d9('0x3b'))){_0x3a4adc[_0xd7d9('0x21')]=qs[_0xd7d9('0x21')](_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x21')]);_0x3a4adc[_0xd7d9('0x1f')]=qs['offset'](_0x3c7369['query'][_0xd7d9('0x1f')]);}_0x3a4adc[_0xd7d9('0x3c')]=qs[_0xd7d9('0x3d')](_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x3d')]);_0x3a4adc[_0xd7d9('0x3e')]=qs[_0xd7d9('0x3f')](_[_0xd7d9('0x40')](_0x3c7369[_0xd7d9('0x33')],_0x2ab11d['filters']),_0x3f04f8);if(_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x41')]){_0x3a4adc[_0xd7d9('0x3e')]=_['merge'](_0x3a4adc[_0xd7d9('0x3e')],{'$or':_['map'](_0x3f04f8,function(_0x2dffa6){if(_0x2dffa6[_0xd7d9('0x31')]!==_0xd7d9('0x42')){var _0x3d22ef={};_0x3d22ef[_0x2dffa6[_0xd7d9('0x2b')]]={'$like':'%'+_0x3c7369[_0xd7d9('0x33')]['filter']+'%'};return _0x3d22ef;}})});}_0x3a4adc=_[_0xd7d9('0x43')]({},_0x3a4adc,_0x3c7369[_0xd7d9('0x44')]);var _0x225a3f={'where':_0x3a4adc[_0xd7d9('0x3e')]};return db[_0xd7d9('0x2f')][_0xd7d9('0x22')](_0x225a3f)[_0xd7d9('0x29')](function(_0x164b0f){_0x436423['count']=_0x164b0f;if(_0x3c7369[_0xd7d9('0x33')][_0xd7d9('0x45')]){_0x3a4adc['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3a4adc);})[_0xd7d9('0x29')](function(_0x36f1fc){_0x436423[_0xd7d9('0x46')]=_0x36f1fc;return _0x436423;})[_0xd7d9('0x29')](respondWithFilteredResult(_0x434fee,_0x3a4adc))[_0xd7d9('0x47')](handleError(_0x434fee,null));};exports[_0xd7d9('0x48')]=function(_0x4a3081,_0x3a4ee2){var _0x18645f={'raw':![],'where':{'id':_0x4a3081[_0xd7d9('0x49')]['id']}},_0x48c7b1={};_0x48c7b1[_0xd7d9('0x36')]=_['keys'](db[_0xd7d9('0x2f')]['rawAttributes']);_0x48c7b1[_0xd7d9('0x33')]=_[_0xd7d9('0x34')](_0x4a3081[_0xd7d9('0x33')]);_0x48c7b1['filters']=_[_0xd7d9('0x35')](_0x48c7b1[_0xd7d9('0x36')],_0x48c7b1['query']);_0x18645f['attributes']=_[_0xd7d9('0x35')](_0x48c7b1['model'],qs[_0xd7d9('0x38')](_0x4a3081[_0xd7d9('0x33')][_0xd7d9('0x38')]));_0x18645f[_0xd7d9('0x37')]=_0x18645f[_0xd7d9('0x37')][_0xd7d9('0x39')]?_0x18645f['attributes']:_0x48c7b1[_0xd7d9('0x36')];if(_0x4a3081['query'][_0xd7d9('0x45')]){_0x18645f[_0xd7d9('0x4a')]=[{'all':!![]}];}_0x18645f=_[_0xd7d9('0x43')]({},_0x18645f,_0x4a3081[_0xd7d9('0x44')]);return db[_0xd7d9('0x2f')][_0xd7d9('0x4b')](_0x18645f)[_0xd7d9('0x29')](handleEntityNotFound(_0x3a4ee2,null))[_0xd7d9('0x29')](respondWithResult(_0x3a4ee2,null))[_0xd7d9('0x47')](handleError(_0x3a4ee2,null));};exports[_0xd7d9('0x4c')]=function(_0x35198a,_0x26dfe0){return db[_0xd7d9('0x2f')][_0xd7d9('0x4c')](_0x35198a[_0xd7d9('0x4d')],{})[_0xd7d9('0x29')](respondWithResult(_0x26dfe0,0xc9))[_0xd7d9('0x47')](handleError(_0x26dfe0,null));};exports[_0xd7d9('0x28')]=function(_0x45bdf9,_0x1a75ff){if(_0x45bdf9['body']['id']){delete _0x45bdf9[_0xd7d9('0x4d')]['id'];}return db[_0xd7d9('0x2f')]['find']({'where':{'id':_0x45bdf9[_0xd7d9('0x49')]['id']}})[_0xd7d9('0x29')](handleEntityNotFound(_0x1a75ff,null))[_0xd7d9('0x29')](saveUpdates(_0x45bdf9[_0xd7d9('0x4d')],null))[_0xd7d9('0x29')](respondWithResult(_0x1a75ff,null))[_0xd7d9('0x47')](handleError(_0x1a75ff,null));};exports[_0xd7d9('0x4e')]=function(_0x49c5ee,_0x328125){return db[_0xd7d9('0x2f')][_0xd7d9('0x4b')]({'where':{'id':_0x49c5ee[_0xd7d9('0x49')]['id']}})['then'](handleEntityNotFound(_0x328125,null))[_0xd7d9('0x29')](removeEntity(_0x328125,null))[_0xd7d9('0x47')](handleError(_0x328125,null));};exports[_0xd7d9('0x4f')]=function(_0x5db100,_0x4d5ba5,_0x2c9a31){var _0x2148f1={};var _0x44cff0={};var _0x3080db;var _0x18526f;return db[_0xd7d9('0x2f')][_0xd7d9('0x50')]({'where':{'id':_0x5db100[_0xd7d9('0x49')]['id']}})[_0xd7d9('0x29')](handleEntityNotFound(_0x4d5ba5,null))[_0xd7d9('0x29')](function(_0x5b96fb){if(_0x5b96fb){_0x3080db=_0x5b96fb;_0x44cff0[_0xd7d9('0x36')]=_[_0xd7d9('0x34')](db['DeskConfiguration'][_0xd7d9('0x30')]);_0x44cff0[_0xd7d9('0x33')]=_[_0xd7d9('0x34')](_0x5db100[_0xd7d9('0x33')]);_0x44cff0[_0xd7d9('0x3f')]=_[_0xd7d9('0x35')](_0x44cff0[_0xd7d9('0x36')],_0x44cff0[_0xd7d9('0x33')]);_0x2148f1['attributes']=_[_0xd7d9('0x35')](_0x44cff0[_0xd7d9('0x36')],qs[_0xd7d9('0x38')](_0x5db100['query']['fields']));_0x2148f1[_0xd7d9('0x37')]=_0x2148f1[_0xd7d9('0x37')][_0xd7d9('0x39')]?_0x2148f1['attributes']:_0x44cff0['model'];_0x2148f1[_0xd7d9('0x3c')]=qs[_0xd7d9('0x3d')](_0x5db100[_0xd7d9('0x33')][_0xd7d9('0x3d')]);_0x2148f1['where']=qs['filters'](_[_0xd7d9('0x40')](_0x5db100[_0xd7d9('0x33')],_0x44cff0[_0xd7d9('0x3f')]));if(_0x5db100[_0xd7d9('0x33')][_0xd7d9('0x41')]){_0x2148f1[_0xd7d9('0x3e')]=_['merge'](_0x2148f1[_0xd7d9('0x3e')],{'$or':_['map'](_0x2148f1[_0xd7d9('0x37')],function(_0xcda27c){var _0x4b24c9={};_0x4b24c9[_0xcda27c]={'$like':'%'+_0x5db100[_0xd7d9('0x33')][_0xd7d9('0x41')]+'%'};return _0x4b24c9;})});}_0x2148f1=_['merge']({},_0x2148f1,_0x5db100[_0xd7d9('0x44')]);return _0x3080db['getConfigurations'](_0x2148f1);}})[_0xd7d9('0x29')](function(_0x3ddd85){if(_0x3ddd85){_0x18526f=_0x3ddd85[_0xd7d9('0x39')];if(!_0x5db100[_0xd7d9('0x33')]['hasOwnProperty'](_0xd7d9('0x3b'))){_0x2148f1[_0xd7d9('0x21')]=qs['limit'](_0x5db100[_0xd7d9('0x33')][_0xd7d9('0x21')]);_0x2148f1[_0xd7d9('0x1f')]=qs[_0xd7d9('0x1f')](_0x5db100[_0xd7d9('0x33')]['offset']);}return _0x3080db[_0xd7d9('0x4f')](_0x2148f1);}})['then'](function(_0x26345b){if(_0x26345b){return _0x26345b?{'count':_0x18526f,'rows':_0x26345b}:null;}})['then'](respondWithResult(_0x4d5ba5,null))[_0xd7d9('0x47')](handleError(_0x4d5ba5,null));};exports[_0xd7d9('0x51')]=function(_0x3b7a92,_0x2f8669,_0x32e641){if(_0x3b7a92[_0xd7d9('0x4d')]['id']){delete _0x3b7a92[_0xd7d9('0x4d')]['id'];}return db['DeskAccount'][_0xd7d9('0x50')]({'where':{'id':_0x3b7a92['params']['id']}})[_0xd7d9('0x29')](handleEntityNotFound(_0x2f8669,null))[_0xd7d9('0x29')](function(_0x31de79){if(_0x31de79){_0x3b7a92[_0xd7d9('0x4d')][_0xd7d9('0x52')]=_0x31de79['id'];_0x3b7a92[_0xd7d9('0x4d')][_0xd7d9('0x53')]=integrations['getSubjects'](_0x3b7a92[_0xd7d9('0x4d')]['channel'],_0x3b7a92[_0xd7d9('0x4d')][_0xd7d9('0x31')]);_0x3b7a92[_0xd7d9('0x4d')][_0xd7d9('0x54')]=integrations['getDescriptions'](_0x3b7a92[_0xd7d9('0x4d')][_0xd7d9('0x55')],_0x3b7a92[_0xd7d9('0x4d')]['type']);return db[_0xd7d9('0x56')][_0xd7d9('0x4c')](_0x3b7a92[_0xd7d9('0x4d')],{'include':[{'model':db[_0xd7d9('0x57')],'as':_0xd7d9('0x53')},{'model':db['DeskField'],'as':_0xd7d9('0x54')}]});}return null;})['then'](respondWithResult(_0x2f8669,null))['catch'](handleError(_0x2f8669,null));};exports[_0xd7d9('0x58')]=function(_0x492cea,_0xa47d51,_0xfa5d96){var _0x39b7f0=[{'name':_0xd7d9('0x59'),'label':_0xd7d9('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2abed2='';return db[_0xd7d9('0x2f')]['findOne']({'where':{'id':_0x492cea[_0xd7d9('0x49')]['id']},'attributes':['id','remoteUri',_0xd7d9('0x5a'),'username','password',_0xd7d9('0x5b'),'consumerSecret','token',_0xd7d9('0x5c')]})['then'](handleEntityNotFound(_0xa47d51,null))['then'](function(_0x2e0570){if(_0x2e0570){_0x2abed2=_0x2e0570[_0xd7d9('0x5d')];var _0x4919f1=_0x2abed2['slice'](-0x1);if(_0x4919f1==='/'){_0x2abed2=_0x2abed2[_0xd7d9('0x5e')](0x0,_0x2abed2[_0xd7d9('0x5f')](_0x4919f1));}var _0x46ab2e={'method':_0xd7d9('0x60'),'uri':util['format'](_0xd7d9('0x61'),_0x2abed2),'headers':{'Content-Type':_0xd7d9('0x62'),'Accept':'application/json'},'json':!![]};if(_0x2e0570[_0xd7d9('0x5a')]===_0xd7d9('0x63')){_0x46ab2e['headers']['Authorization']=util[_0xd7d9('0x64')](_0xd7d9('0x65'),new Buffer(util[_0xd7d9('0x64')](_0xd7d9('0x66'),_0x2e0570[_0xd7d9('0x67')],_0x2e0570[_0xd7d9('0x68')]))['toString'](_0xd7d9('0x69')));}return rp(_0x46ab2e)[_0xd7d9('0x29')](function(_0x3e41f2){return _0x39b7f0[_0xd7d9('0x6a')](_['map'](_0x3e41f2[_0xd7d9('0x6b')][_0xd7d9('0x6c')],function(_0x4e4480){return{'id':_0x4e4480[_0xd7d9('0x2b')],'name':_0x4e4480[_0xd7d9('0x2b')],'type':_0x4e4480[_0xd7d9('0x31')],'active':_0x4e4480[_0xd7d9('0x6d')],'label':_0x4e4480[_0xd7d9('0x6e')],'custom':!![]};}));});}})[_0xd7d9('0x29')](function(_0x199ace){return{'count':_0x199ace[_0xd7d9('0x39')],'rows':_0x199ace};})['then'](respondWithResult(_0xa47d51,null))['catch'](function(_0x16f8a9){var _0x12b8fc=_0x492cea['query'][_0xd7d9('0x6f')]?0x1f4:_0x16f8a9[_0xd7d9('0x70')]||0x1f4;logger[_0xd7d9('0x71')](_0xd7d9('0x72'),_0xd7d9('0x58'),_0x12b8fc,JSON[_0xd7d9('0x73')](_0x16f8a9));delete _0x16f8a9[_0xd7d9('0x2b')];if(_0x12b8fc===0x191){_0x12b8fc=0x190;}_0xa47d51['status'](_0x12b8fc)[_0xd7d9('0x2c')](_0x492cea[_0xd7d9('0x33')][_0xd7d9('0x6f')]?{'message':_0xd7d9('0x74'),'statusCode':_0x16f8a9[_0xd7d9('0x70')]}:_0x16f8a9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9a5059a..9cb4d2d 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 _0x00ca=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x4100b3,_0x15d14e){var _0x9a4c24=function(_0x131e2e){while(--_0x131e2e){_0x4100b3['push'](_0x4100b3['shift']());}};_0x9a4c24(++_0x15d14e);}(_0x00ca,0x17a));var _0xa00c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x00ca[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa00c('0x0'));var util=require(_0xa00c('0x1'));var logger=require(_0xa00c('0x2'))(_0xa00c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa00c('0x4'));var fs=require('fs');var path=require(_0xa00c('0x5'));var rimraf=require(_0xa00c('0x6'));var config=require(_0xa00c('0x7'));var attributes=require(_0xa00c('0x8'));var integrations=require(_0xa00c('0x9'));module[_0xa00c('0xa')]=function(_0x4bd457,_0x227ee2){return _0x4bd457[_0xa00c('0xb')](_0xa00c('0xc'),attributes,{'tableName':_0xa00c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf622=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0xf622,0x1f4));var _0x2f62=function(_0x3a7afd,_0x164059){_0x3a7afd=_0x3a7afd-0x0;var _0x40bf9f=_0xf622[_0x3a7afd];return _0x40bf9f;};'use strict';var _=require('lodash');var util=require(_0x2f62('0x0'));var logger=require(_0x2f62('0x1'))(_0x2f62('0x2'));var moment=require(_0x2f62('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f62('0x4'));var fs=require('fs');var path=require(_0x2f62('0x5'));var rimraf=require('rimraf');var config=require(_0x2f62('0x6'));var attributes=require(_0x2f62('0x7'));var integrations=require(_0x2f62('0x8'));module[_0x2f62('0x9')]=function(_0x50dce9,_0x112dc2){return _0x50dce9[_0x2f62('0xa')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 38a5548..4151a3a 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 _0x30ca=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowDeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46c297,_0x13d386){var _0x4274f3=function(_0x111bc5){while(--_0x111bc5){_0x46c297['push'](_0x46c297['shift']());}};_0x4274f3(++_0x13d386);}(_0x30ca,0xbf));var _0xa30c=function(_0x588084,_0x3caff4){_0x588084=_0x588084-0x0;var _0x2b444d=_0x30ca[_0x588084];return _0x2b444d;};'use strict';var _=require(_0xa30c('0x0'));var util=require(_0xa30c('0x1'));var moment=require(_0xa30c('0x2'));var BPromise=require(_0xa30c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa30c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa30c('0x5'));var config=require(_0xa30c('0x6'));var jayson=require(_0xa30c('0x7'));var client=jayson[_0xa30c('0x8')][_0xa30c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ab74,_0x5f33bf,_0x467b3e){return new BPromise(function(_0x508747,_0x26a739){return client['request'](_0x26ab74,_0x467b3e)[_0xa30c('0xa')](function(_0x462469){logger[_0xa30c('0xb')](_0xa30c('0xc'),_0x5f33bf,_0xa30c('0xd'));logger['debug'](_0xa30c('0xe'),_0x5f33bf,'request\x20sent',JSON[_0xa30c('0xf')](_0x462469));if(_0x462469[_0xa30c('0x10')]){if(_0x462469['error'][_0xa30c('0x11')]===0x1f4){logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x462469[_0xa30c('0x10')]['message']);return _0x26a739(_0x462469[_0xa30c('0x10')][_0xa30c('0x12')]);}logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x462469[_0xa30c('0x10')]['message']);return _0x508747(_0x462469['error'][_0xa30c('0x12')]);}else{logger[_0xa30c('0xb')]('DeskAccount,\x20%s,\x20%s',_0x5f33bf,_0xa30c('0xd'));_0x508747(_0x462469[_0xa30c('0x13')][_0xa30c('0x12')]);}})[_0xa30c('0x14')](function(_0x4212d4){logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x4212d4);_0x26a739(_0x4212d4);});});}exports[_0xa30c('0x15')]=function(_0x379ce3){var _0x45a8f8=this;return new Promise(function(_0x258218,_0x38a66c){return db[_0xa30c('0x16')][_0xa30c('0x17')]({'raw':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x19')]===undefined?!![]:![]:!![],'where':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1a')]||null:null,'attributes':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1b')]||null:null,'limit':_0x379ce3['options']?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1c')]||null:null,'include':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')]['include']?_[_0xa30c('0x1d')](_0x379ce3['options']['include'],function(_0x4cb9be){return{'model':db[_0x4cb9be['model']],'as':_0x4cb9be['as'],'attributes':_0x4cb9be['attributes'],'include':_0x4cb9be[_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0x4cb9be['include'],function(_0x3c4686){return{'model':db[_0x3c4686[_0xa30c('0x1f')]],'as':_0x3c4686['as'],'attributes':_0x3c4686[_0xa30c('0x1b')],'include':_0x3c4686[_0xa30c('0x1e')]?_['map'](_0x3c4686[_0xa30c('0x1e')],function(_0x40bbc6){return{'model':db[_0x40bbc6[_0xa30c('0x1f')]],'as':_0x40bbc6['as'],'attributes':_0x40bbc6[_0xa30c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa30c('0xa')](function(_0x152117){logger[_0xa30c('0xb')]('GetDeskAccount',_0x379ce3);logger[_0xa30c('0x20')](_0xa30c('0x15'),_0x379ce3,JSON[_0xa30c('0xf')](_0x152117));_0x258218(_0x152117);})[_0xa30c('0x14')](function(_0x2eb690){logger[_0xa30c('0x10')](_0xa30c('0x15'),_0x2eb690[_0xa30c('0x12')],_0x379ce3);_0x38a66c(_0x45a8f8[_0xa30c('0x10')](0x1f4,_0x2eb690[_0xa30c('0x12')]));});});};exports[_0xa30c('0x21')]=function(_0xf576f9){var _0x3bda90=this;return new Promise(function(_0x21baea,_0x401886){return db[_0xa30c('0x16')][_0xa30c('0x22')]({'raw':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')]['where']||null:null,'attributes':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')][_0xa30c('0x1b')]||null:null,'include':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')][_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0xf576f9[_0xa30c('0x18')]['include'],function(_0x3805b9){return{'model':db[_0x3805b9[_0xa30c('0x1f')]],'as':_0x3805b9['as'],'attributes':_0x3805b9[_0xa30c('0x1b')],'include':_0x3805b9[_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0x3805b9[_0xa30c('0x1e')],function(_0x46d936){return{'model':db[_0x46d936[_0xa30c('0x1f')]],'as':_0x46d936['as'],'attributes':_0x46d936[_0xa30c('0x1b')],'include':_0x46d936['include']?_['map'](_0x46d936[_0xa30c('0x1e')],function(_0x296c45){return{'model':db[_0x296c45['model']],'as':_0x296c45['as'],'attributes':_0x296c45[_0xa30c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa30c('0xa')](function(_0x10172a){logger['info'](_0xa30c('0x21'),_0xf576f9);logger[_0xa30c('0x20')]('ShowDeskAccount',_0xf576f9,JSON[_0xa30c('0xf')](_0x10172a));_0x21baea(_0x10172a);})['catch'](function(_0x15271a){logger['error'](_0xa30c('0x21'),_0x15271a['message'],_0xf576f9);_0x401886(_0x3bda90[_0xa30c('0x10')](0x1f4,_0x15271a['message']));});});}; \ No newline at end of file +var _0xb83e=['where','attributes','limit','include','map','model','then','ShowDeskAccount','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw'];(function(_0x294bd5,_0x32a124){var _0x5c7239=function(_0x4a0f92){while(--_0x4a0f92){_0x294bd5['push'](_0x294bd5['shift']());}};_0x5c7239(++_0x32a124);}(_0xb83e,0x88));var _0xeb83=function(_0x4d256b,_0x3b902d){_0x4d256b=_0x4d256b-0x0;var _0x35b246=_0xb83e[_0x4d256b];return _0x35b246;};'use strict';var _=require(_0xeb83('0x0'));var util=require(_0xeb83('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb83('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb83('0x5'));var client=jayson[_0xeb83('0x6')][_0xeb83('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x222af0,_0x4962e6,_0x5da078){return new BPromise(function(_0x508b0a,_0x15c742){return client[_0xeb83('0x8')](_0x222af0,_0x5da078)['then'](function(_0x3c47ec){logger[_0xeb83('0x9')]('DeskAccount,\x20%s,\x20%s',_0x4962e6,_0xeb83('0xa'));logger[_0xeb83('0xb')](_0xeb83('0xc'),_0x4962e6,_0xeb83('0xa'),JSON[_0xeb83('0xd')](_0x3c47ec));if(_0x3c47ec['error']){if(_0x3c47ec['error']['code']===0x1f4){logger[_0xeb83('0xe')](_0xeb83('0xf'),_0x4962e6,_0x3c47ec[_0xeb83('0xe')][_0xeb83('0x10')]);return _0x15c742(_0x3c47ec[_0xeb83('0xe')][_0xeb83('0x10')]);}logger[_0xeb83('0xe')](_0xeb83('0xf'),_0x4962e6,_0x3c47ec['error']['message']);return _0x508b0a(_0x3c47ec['error'][_0xeb83('0x10')]);}else{logger[_0xeb83('0x9')](_0xeb83('0xf'),_0x4962e6,_0xeb83('0xa'));_0x508b0a(_0x3c47ec[_0xeb83('0x11')]['message']);}})[_0xeb83('0x12')](function(_0x59c9c2){logger['error'](_0xeb83('0xf'),_0x4962e6,_0x59c9c2);_0x15c742(_0x59c9c2);});});}exports[_0xeb83('0x13')]=function(_0xe537ba){var _0x427f93=this;return new Promise(function(_0x37d67c,_0x3cde20){return db[_0xeb83('0x14')][_0xeb83('0x15')]({'raw':_0xe537ba['options']?_0xe537ba[_0xeb83('0x16')][_0xeb83('0x17')]===undefined?!![]:![]:!![],'where':_0xe537ba[_0xeb83('0x16')]?_0xe537ba[_0xeb83('0x16')][_0xeb83('0x18')]||null:null,'attributes':_0xe537ba[_0xeb83('0x16')]?_0xe537ba[_0xeb83('0x16')][_0xeb83('0x19')]||null:null,'limit':_0xe537ba['options']?_0xe537ba[_0xeb83('0x16')][_0xeb83('0x1a')]||null:null,'include':_0xe537ba['options']?_0xe537ba[_0xeb83('0x16')][_0xeb83('0x1b')]?_[_0xeb83('0x1c')](_0xe537ba[_0xeb83('0x16')][_0xeb83('0x1b')],function(_0x2c9aaf){return{'model':db[_0x2c9aaf[_0xeb83('0x1d')]],'as':_0x2c9aaf['as'],'attributes':_0x2c9aaf[_0xeb83('0x19')],'include':_0x2c9aaf['include']?_[_0xeb83('0x1c')](_0x2c9aaf[_0xeb83('0x1b')],function(_0x272de2){return{'model':db[_0x272de2['model']],'as':_0x272de2['as'],'attributes':_0x272de2[_0xeb83('0x19')],'include':_0x272de2[_0xeb83('0x1b')]?_[_0xeb83('0x1c')](_0x272de2[_0xeb83('0x1b')],function(_0x41619f){return{'model':db[_0x41619f[_0xeb83('0x1d')]],'as':_0x41619f['as'],'attributes':_0x41619f[_0xeb83('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeb83('0x1e')](function(_0x52b3f5){logger['info'](_0xeb83('0x13'),_0xe537ba);logger[_0xeb83('0xb')](_0xeb83('0x13'),_0xe537ba,JSON['stringify'](_0x52b3f5));_0x37d67c(_0x52b3f5);})[_0xeb83('0x12')](function(_0x528654){logger[_0xeb83('0xe')](_0xeb83('0x13'),_0x528654[_0xeb83('0x10')],_0xe537ba);_0x3cde20(_0x427f93[_0xeb83('0xe')](0x1f4,_0x528654[_0xeb83('0x10')]));});});};exports[_0xeb83('0x1f')]=function(_0x3d635e){var _0x1f0aa6=this;return new Promise(function(_0x3635fe,_0x274082){return db[_0xeb83('0x14')]['find']({'raw':_0x3d635e[_0xeb83('0x16')]?_0x3d635e['options'][_0xeb83('0x17')]===undefined?!![]:![]:!![],'where':_0x3d635e[_0xeb83('0x16')]?_0x3d635e['options'][_0xeb83('0x18')]||null:null,'attributes':_0x3d635e[_0xeb83('0x16')]?_0x3d635e[_0xeb83('0x16')][_0xeb83('0x19')]||null:null,'include':_0x3d635e[_0xeb83('0x16')]?_0x3d635e[_0xeb83('0x16')]['include']?_[_0xeb83('0x1c')](_0x3d635e[_0xeb83('0x16')]['include'],function(_0x1fceb2){return{'model':db[_0x1fceb2[_0xeb83('0x1d')]],'as':_0x1fceb2['as'],'attributes':_0x1fceb2[_0xeb83('0x19')],'include':_0x1fceb2['include']?_[_0xeb83('0x1c')](_0x1fceb2['include'],function(_0x1aab97){return{'model':db[_0x1aab97['model']],'as':_0x1aab97['as'],'attributes':_0x1aab97[_0xeb83('0x19')],'include':_0x1aab97['include']?_[_0xeb83('0x1c')](_0x1aab97[_0xeb83('0x1b')],function(_0x11abbb){return{'model':db[_0x11abbb['model']],'as':_0x11abbb['as'],'attributes':_0x11abbb[_0xeb83('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeb83('0x1e')](function(_0x10819e){logger[_0xeb83('0x9')]('ShowDeskAccount',_0x3d635e);logger['debug'](_0xeb83('0x1f'),_0x3d635e,JSON[_0xeb83('0xd')](_0x10819e));_0x3635fe(_0x10819e);})[_0xeb83('0x12')](function(_0x2183b5){logger[_0xeb83('0xe')]('ShowDeskAccount',_0x2183b5[_0xeb83('0x10')],_0x3d635e);_0x274082(_0x1f0aa6[_0xeb83('0xe')](0x1f4,_0x2183b5[_0xeb83('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 57bf1af..bd0a8a5 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(_0x2d3d0d,_0x67ac82){var _0xca35b6=function(_0x483979){while(--_0x483979){_0x2d3d0d['push'](_0x2d3d0d['shift']());}};_0xca35b6(++_0x67ac82);}(_0x55ca,0x126));var _0xa55c=function(_0x90dfad,_0x4d127a){_0x90dfad=_0x90dfad-0x0;var _0x8cdcc7=_0x55ca[_0x90dfad];return _0x8cdcc7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x390dfd,_0x444dcf){var _0x66c15d=function(_0x2daa12){while(--_0x2daa12){_0x390dfd['push'](_0x390dfd['shift']());}};_0x66c15d(++_0x444dcf);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a0da8c2..f60c91e 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 _0x9a61=['STRING','sequelize','exports'];(function(_0x5d5a7c,_0x51e29c){var _0x106274=function(_0x4df00a){while(--_0x4df00a){_0x5d5a7c['push'](_0x5d5a7c['shift']());}};_0x106274(++_0x51e29c);}(_0x9a61,0x1a8));var _0x19a6=function(_0x6f7fee,_0x2cb733){_0x6f7fee=_0x6f7fee-0x0;var _0x3bc517=_0x9a61[_0x6f7fee];return _0x3bc517;};'use strict';var Sequelize=require(_0x19a6('0x0'));module[_0x19a6('0x1')]={'name':{'type':Sequelize[_0x19a6('0x2')]},'description':{'type':Sequelize[_0x19a6('0x2')]}}; \ No newline at end of file +var _0xbef4=['STRING','sequelize','exports'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xbef4,0x1ae));var _0x4bef=function(_0x2d489a,_0x25ce3c){_0x2d489a=_0x2d489a-0x0;var _0x11b301=_0xbef4[_0x2d489a];return _0x11b301;};'use strict';var Sequelize=require(_0x4bef('0x0'));module[_0x4bef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4bef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 42ab7ce..4063cac 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 _0xd082=['query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getFields','DeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','DeskConfiguration','key','model','map'];(function(_0x150240,_0x512309){var _0x3aa85b=function(_0x24a91f){while(--_0x24a91f){_0x150240['push'](_0x150240['shift']());}};_0x3aa85b(++_0x512309);}(_0xd082,0x11a));var _0x2d08=function(_0xddb31c,_0x9345e6){_0xddb31c=_0xddb31c-0x0;var _0x34f7a1=_0xd082[_0xddb31c];return _0x34f7a1;};'use strict';var emlformat=require(_0x2d08('0x0'));var rimraf=require(_0x2d08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d08('0x2'));var rp=require(_0x2d08('0x3'));var moment=require(_0x2d08('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2d08('0x5'));var sox=require(_0x2d08('0x6'));var csv=require(_0x2d08('0x7'));var ejs=require(_0x2d08('0x8'));var fs=require('fs');var fs_extra=require(_0x2d08('0x9'));var _=require(_0x2d08('0xa'));var squel=require(_0x2d08('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2d08('0x7'));var querystring=require(_0x2d08('0xd'));var Papa=require(_0x2d08('0xe'));var Redis=require(_0x2d08('0xf'));var authService=require(_0x2d08('0x10'));var qs=require(_0x2d08('0x11'));var as=require(_0x2d08('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d08('0x13'))(_0x2d08('0x14'));var utils=require(_0x2d08('0x15'));var config=require(_0x2d08('0x16'));var licenseUtil=require(_0x2d08('0x17'));var db=require(_0x2d08('0x18'))['db'];function respondWithStatusCode(_0x586abf,_0x40c8b6){_0x40c8b6=_0x40c8b6||0xcc;return function(_0xbe1ae6){if(_0xbe1ae6){return _0x586abf['sendStatus'](_0x40c8b6);}return _0x586abf['status'](_0x40c8b6)[_0x2d08('0x19')]();};}function respondWithResult(_0x2acaeb,_0x3cef14){_0x3cef14=_0x3cef14||0xc8;return function(_0x3f9724){if(_0x3f9724){return _0x2acaeb[_0x2d08('0x1a')](_0x3cef14)[_0x2d08('0x1b')](_0x3f9724);}};}function respondWithFilteredResult(_0x324380,_0x6c2213){return function(_0x540aed){if(_0x540aed){var _0x393f64=typeof _0x6c2213[_0x2d08('0x1c')]===_0x2d08('0x1d')&&typeof _0x6c2213[_0x2d08('0x1e')]===_0x2d08('0x1d');var _0x4abee5=_0x540aed[_0x2d08('0x1f')];var _0x23e772=_0x393f64?0x0:_0x6c2213['offset'];var _0x2e67ff=_0x393f64?_0x540aed[_0x2d08('0x1f')]:_0x6c2213[_0x2d08('0x1c')]+_0x6c2213[_0x2d08('0x1e')];var _0x938f4b;if(_0x2e67ff>=_0x4abee5){_0x2e67ff=_0x4abee5;_0x938f4b=0xc8;}else{_0x938f4b=0xce;}_0x324380['status'](_0x938f4b);return _0x324380[_0x2d08('0x20')]('Content-Range',_0x23e772+'-'+_0x2e67ff+'/'+_0x4abee5)[_0x2d08('0x1b')](_0x540aed);}return null;};}function patchUpdates(_0x43c693){return function(_0x329eb6){try{jsonpatch[_0x2d08('0x21')](_0x329eb6,_0x43c693,!![]);}catch(_0x4c1453){return BPromise[_0x2d08('0x22')](_0x4c1453);}return _0x329eb6[_0x2d08('0x23')]();};}function saveUpdates(_0x2e7ba0,_0x580f4f){return function(_0x2149de){if(_0x2149de){return _0x2149de['update'](_0x2e7ba0)[_0x2d08('0x24')](function(_0x27c2c4){return _0x27c2c4;});}return null;};}function removeEntity(_0x31fca4,_0x5bc887){return function(_0x16568b){if(_0x16568b){return _0x16568b[_0x2d08('0x25')]()[_0x2d08('0x24')](function(){_0x31fca4[_0x2d08('0x1a')](0xcc)[_0x2d08('0x19')]();});}};}function handleEntityNotFound(_0xac4e0a,_0x5b4db9){return function(_0x4c247f){if(!_0x4c247f){_0xac4e0a['sendStatus'](0x194);}return _0x4c247f;};}function handleError(_0x550244,_0x5aacf7){_0x5aacf7=_0x5aacf7||0x1f4;return function(_0xdc0c80){logger[_0x2d08('0x26')](_0xdc0c80['stack']);if(_0xdc0c80[_0x2d08('0x27')]){delete _0xdc0c80['name'];}_0x550244[_0x2d08('0x1a')](_0x5aacf7)[_0x2d08('0x28')](_0xdc0c80);};}exports[_0x2d08('0x29')]=function(_0x3ed5d6,_0xb57aa6){var _0x17cb94={},_0x211de2={},_0x4cb6c1={'count':0x0,'rows':[]};var _0x5ce5f1=_['map'](db[_0x2d08('0x2a')]['rawAttributes'],function(_0x345080){return{'name':_0x345080['fieldName'],'type':_0x345080['type'][_0x2d08('0x2b')]};});_0x211de2[_0x2d08('0x2c')]=_[_0x2d08('0x2d')](_0x5ce5f1,_0x2d08('0x27'));_0x211de2[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x3ed5d6[_0x2d08('0x2e')]);_0x211de2['filters']=_[_0x2d08('0x30')](_0x211de2[_0x2d08('0x2c')],_0x211de2['query']);_0x17cb94[_0x2d08('0x31')]=_['intersection'](_0x211de2[_0x2d08('0x2c')],qs[_0x2d08('0x32')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x17cb94[_0x2d08('0x31')]=_0x17cb94[_0x2d08('0x31')][_0x2d08('0x33')]?_0x17cb94['attributes']:_0x211de2[_0x2d08('0x2c')];if(!_0x3ed5d6[_0x2d08('0x2e')]['hasOwnProperty'](_0x2d08('0x34'))){_0x17cb94['limit']=qs[_0x2d08('0x1e')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x17cb94[_0x2d08('0x1c')]=qs['offset'](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x1c')]);}_0x17cb94['order']=qs[_0x2d08('0x35')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x17cb94[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x3ed5d6[_0x2d08('0x2e')],_0x211de2[_0x2d08('0x37')]),_0x5ce5f1);if(_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x17cb94[_0x2d08('0x36')]=_['merge'](_0x17cb94[_0x2d08('0x36')],{'$or':_['map'](_0x5ce5f1,function(_0x5b2a20){if(_0x5b2a20[_0x2d08('0x3a')]!=='VIRTUAL'){var _0x424c3c={};_0x424c3c[_0x5b2a20[_0x2d08('0x27')]]={'$like':'%'+_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x39')]+'%'};return _0x424c3c;}})});}_0x17cb94=_[_0x2d08('0x3b')]({},_0x17cb94,_0x3ed5d6[_0x2d08('0x3c')]);var _0x509548={'where':_0x17cb94[_0x2d08('0x36')]};return db['DeskConfiguration'][_0x2d08('0x1f')](_0x509548)[_0x2d08('0x24')](function(_0xaeae1){_0x4cb6c1[_0x2d08('0x1f')]=_0xaeae1;if(_0x3ed5d6['query'][_0x2d08('0x3d')]){_0x17cb94[_0x2d08('0x3e')]=[{'all':!![]}];}return db[_0x2d08('0x2a')][_0x2d08('0x3f')](_0x17cb94);})[_0x2d08('0x24')](function(_0x299240){_0x4cb6c1[_0x2d08('0x40')]=_0x299240;return _0x4cb6c1;})[_0x2d08('0x24')](respondWithFilteredResult(_0xb57aa6,_0x17cb94))[_0x2d08('0x41')](handleError(_0xb57aa6,null));};exports[_0x2d08('0x42')]=function(_0x5cea6d,_0x424b81){var _0x5cf613={'raw':![],'where':{'id':_0x5cea6d[_0x2d08('0x43')]['id']}},_0x20ecca={};_0x20ecca[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db['DeskConfiguration'][_0x2d08('0x44')]);_0x20ecca[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x5cea6d['query']);_0x20ecca[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x20ecca[_0x2d08('0x2c')],_0x20ecca[_0x2d08('0x2e')]);_0x5cf613[_0x2d08('0x31')]=_['intersection'](_0x20ecca['model'],qs['fields'](_0x5cea6d[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x5cf613[_0x2d08('0x31')]=_0x5cf613['attributes'][_0x2d08('0x33')]?_0x5cf613[_0x2d08('0x31')]:_0x20ecca['model'];if(_0x5cea6d[_0x2d08('0x2e')][_0x2d08('0x3d')]){_0x5cf613['include']=[{'all':!![]}];}_0x5cf613=_[_0x2d08('0x3b')]({},_0x5cf613,_0x5cea6d[_0x2d08('0x3c')]);return db['DeskConfiguration'][_0x2d08('0x45')](_0x5cf613)['then'](handleEntityNotFound(_0x424b81,null))[_0x2d08('0x24')](respondWithResult(_0x424b81,null))[_0x2d08('0x41')](handleError(_0x424b81,null));};exports['create']=function(_0x4388a2,_0x20a3fb){return db[_0x2d08('0x2a')][_0x2d08('0x46')](_0x4388a2[_0x2d08('0x47')],{})[_0x2d08('0x24')](respondWithResult(_0x20a3fb,0xc9))[_0x2d08('0x41')](handleError(_0x20a3fb,null));};exports[_0x2d08('0x48')]=function(_0x45e032,_0x19ab10){if(_0x45e032[_0x2d08('0x47')]['id']){delete _0x45e032['body']['id'];}return db[_0x2d08('0x2a')]['find']({'where':{'id':_0x45e032[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x19ab10,null))['then'](saveUpdates(_0x45e032['body'],null))['then'](respondWithResult(_0x19ab10,null))[_0x2d08('0x41')](handleError(_0x19ab10,null));};exports[_0x2d08('0x25')]=function(_0xc6c614,_0xa1df84){return db[_0x2d08('0x2a')][_0x2d08('0x45')]({'where':{'id':_0xc6c614['params']['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0xa1df84,null))[_0x2d08('0x24')](removeEntity(_0xa1df84,null))[_0x2d08('0x41')](handleError(_0xa1df84,null));};exports[_0x2d08('0x49')]=function(_0x4e2fc4,_0x5a31f4,_0xc51183){var _0x153f62={};var _0x168342={};var _0x50cc8b;var _0x200575;return db[_0x2d08('0x2a')]['findOne']({'where':{'id':_0x4e2fc4[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x5a31f4,null))[_0x2d08('0x24')](function(_0x2613f2){if(_0x2613f2){_0x50cc8b=_0x2613f2;_0x168342[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db[_0x2d08('0x4a')]['rawAttributes']);_0x168342[_0x2d08('0x2e')]=_['keys'](_0x4e2fc4[_0x2d08('0x2e')]);_0x168342[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x168342[_0x2d08('0x2c')],_0x168342[_0x2d08('0x2e')]);_0x153f62['attributes']=_['intersection'](_0x168342['model'],qs[_0x2d08('0x32')](_0x4e2fc4['query'][_0x2d08('0x32')]));_0x153f62[_0x2d08('0x31')]=_0x153f62[_0x2d08('0x31')][_0x2d08('0x33')]?_0x153f62[_0x2d08('0x31')]:_0x168342[_0x2d08('0x2c')];_0x153f62[_0x2d08('0x4b')]=qs['sort'](_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x153f62[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x4e2fc4[_0x2d08('0x2e')],_0x168342[_0x2d08('0x37')]));if(_0x4e2fc4[_0x2d08('0x2e')]['filter']){_0x153f62[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x153f62['where'],{'$or':_[_0x2d08('0x2d')](_0x153f62['attributes'],function(_0x167dd2){var _0x49b487={};_0x49b487[_0x167dd2]={'$like':'%'+_0x4e2fc4['query'][_0x2d08('0x39')]+'%'};return _0x49b487;})});}_0x153f62=_['merge']({},_0x153f62,_0x4e2fc4[_0x2d08('0x3c')]);return _0x50cc8b[_0x2d08('0x49')](_0x153f62);}})['then'](function(_0x6352c9){if(_0x6352c9){_0x200575=_0x6352c9[_0x2d08('0x33')];if(!_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x4c')](_0x2d08('0x34'))){_0x153f62['limit']=qs[_0x2d08('0x1e')](_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x153f62['offset']=qs[_0x2d08('0x1c')](_0x4e2fc4['query'][_0x2d08('0x1c')]);}return _0x50cc8b[_0x2d08('0x49')](_0x153f62);}})[_0x2d08('0x24')](function(_0x196bb3){if(_0x196bb3){return _0x196bb3?{'count':_0x200575,'rows':_0x196bb3}:null;}})[_0x2d08('0x24')](respondWithResult(_0x5a31f4,null))[_0x2d08('0x41')](handleError(_0x5a31f4,null));};exports[_0x2d08('0x4d')]=function(_0x11184b,_0x131a45,_0x379b5c){var _0x2f5d61={};var _0x2823bd={};var _0x5efaee;var _0x251090;return db['DeskConfiguration'][_0x2d08('0x4e')]({'where':{'id':_0x11184b[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x131a45,null))[_0x2d08('0x24')](function(_0x1f5dbc){if(_0x1f5dbc){_0x5efaee=_0x1f5dbc;_0x2823bd[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db[_0x2d08('0x4a')][_0x2d08('0x44')]);_0x2823bd[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x11184b['query']);_0x2823bd[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x2823bd['model'],_0x2823bd[_0x2d08('0x2e')]);_0x2f5d61[_0x2d08('0x31')]=_['intersection'](_0x2823bd[_0x2d08('0x2c')],qs[_0x2d08('0x32')](_0x11184b[_0x2d08('0x2e')]['fields']));_0x2f5d61[_0x2d08('0x31')]=_0x2f5d61[_0x2d08('0x31')][_0x2d08('0x33')]?_0x2f5d61['attributes']:_0x2823bd[_0x2d08('0x2c')];_0x2f5d61[_0x2d08('0x4b')]=qs[_0x2d08('0x35')](_0x11184b[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x2f5d61[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x11184b[_0x2d08('0x2e')],_0x2823bd[_0x2d08('0x37')]));if(_0x11184b[_0x2d08('0x2e')]['filter']){_0x2f5d61[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x2f5d61[_0x2d08('0x36')],{'$or':_[_0x2d08('0x2d')](_0x2f5d61[_0x2d08('0x31')],function(_0x2c82de){var _0xc2fe26={};_0xc2fe26[_0x2c82de]={'$like':'%'+_0x11184b['query'][_0x2d08('0x39')]+'%'};return _0xc2fe26;})});}_0x2f5d61=_[_0x2d08('0x3b')]({},_0x2f5d61,_0x11184b[_0x2d08('0x3c')]);return _0x5efaee[_0x2d08('0x4d')](_0x2f5d61);}})[_0x2d08('0x24')](function(_0x6239ca){if(_0x6239ca){_0x251090=_0x6239ca['length'];if(!_0x11184b[_0x2d08('0x2e')]['hasOwnProperty']('nolimit')){_0x2f5d61[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x11184b[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x2f5d61['offset']=qs[_0x2d08('0x1c')](_0x11184b[_0x2d08('0x2e')]['offset']);}return _0x5efaee[_0x2d08('0x4d')](_0x2f5d61);}})[_0x2d08('0x24')](function(_0x2a4563){if(_0x2a4563){return _0x2a4563?{'count':_0x251090,'rows':_0x2a4563}:null;}})[_0x2d08('0x24')](respondWithResult(_0x131a45,null))[_0x2d08('0x41')](handleError(_0x131a45,null));};exports[_0x2d08('0x4f')]=function(_0x40328c,_0x581962,_0x21ce5c){var _0x6ae012={};var _0x10aeea={};var _0x291b17;var _0x37f241;return db['DeskConfiguration'][_0x2d08('0x4e')]({'where':{'id':_0x40328c[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x581962,null))[_0x2d08('0x24')](function(_0x496484){if(_0x496484){_0x291b17=_0x496484;_0x10aeea[_0x2d08('0x2c')]=_['keys'](db[_0x2d08('0x4a')][_0x2d08('0x44')]);_0x10aeea['query']=_[_0x2d08('0x2f')](_0x40328c[_0x2d08('0x2e')]);_0x10aeea[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x10aeea['model'],_0x10aeea[_0x2d08('0x2e')]);_0x6ae012[_0x2d08('0x31')]=_['intersection'](_0x10aeea['model'],qs[_0x2d08('0x32')](_0x40328c[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x6ae012[_0x2d08('0x31')]=_0x6ae012[_0x2d08('0x31')][_0x2d08('0x33')]?_0x6ae012['attributes']:_0x10aeea[_0x2d08('0x2c')];_0x6ae012[_0x2d08('0x4b')]=qs['sort'](_0x40328c['query']['sort']);_0x6ae012[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x40328c['query'],_0x10aeea['filters']));if(_0x40328c[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x6ae012[_0x2d08('0x36')]=_['merge'](_0x6ae012[_0x2d08('0x36')],{'$or':_[_0x2d08('0x2d')](_0x6ae012[_0x2d08('0x31')],function(_0x4016d1){var _0x2d231c={};_0x2d231c[_0x4016d1]={'$like':'%'+_0x40328c[_0x2d08('0x2e')][_0x2d08('0x39')]+'%'};return _0x2d231c;})});}_0x6ae012=_['merge']({},_0x6ae012,_0x40328c['options']);return _0x291b17['getDescriptions'](_0x6ae012);}})['then'](function(_0x987921){if(_0x987921){_0x37f241=_0x987921[_0x2d08('0x33')];if(!_0x40328c[_0x2d08('0x2e')][_0x2d08('0x4c')](_0x2d08('0x34'))){_0x6ae012[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x40328c[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x6ae012[_0x2d08('0x1c')]=qs[_0x2d08('0x1c')](_0x40328c[_0x2d08('0x2e')]['offset']);}return _0x291b17[_0x2d08('0x4f')](_0x6ae012);}})['then'](function(_0x2df608){if(_0x2df608){return _0x2df608?{'count':_0x37f241,'rows':_0x2df608}:null;}})[_0x2d08('0x24')](respondWithResult(_0x581962,null))[_0x2d08('0x41')](handleError(_0x581962,null));};exports['getTags']=function(_0x1531a1,_0x218cde,_0x5e7b38){var _0x33e2c7={};var _0x5780b0={};var _0xd05004;var _0x16f6de;return db[_0x2d08('0x2a')][_0x2d08('0x4e')]({'where':{'id':_0x1531a1[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x218cde,null))[_0x2d08('0x24')](function(_0x28ea84){if(_0x28ea84){_0xd05004=_0x28ea84;_0x5780b0[_0x2d08('0x2c')]=_['keys'](db['Tag'][_0x2d08('0x44')]);_0x5780b0['query']=_[_0x2d08('0x2f')](_0x1531a1[_0x2d08('0x2e')]);_0x5780b0[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x5780b0[_0x2d08('0x2c')],_0x5780b0[_0x2d08('0x2e')]);_0x33e2c7[_0x2d08('0x31')]=_['intersection'](_0x5780b0['model'],qs['fields'](_0x1531a1[_0x2d08('0x2e')]['fields']));_0x33e2c7[_0x2d08('0x31')]=_0x33e2c7[_0x2d08('0x31')][_0x2d08('0x33')]?_0x33e2c7[_0x2d08('0x31')]:_0x5780b0[_0x2d08('0x2c')];_0x33e2c7[_0x2d08('0x4b')]=qs['sort'](_0x1531a1[_0x2d08('0x2e')]['sort']);_0x33e2c7['where']=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x1531a1['query'],_0x5780b0[_0x2d08('0x37')]));if(_0x1531a1[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x33e2c7[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x33e2c7['where'],{'$or':_['map'](_0x33e2c7['attributes'],function(_0x5395df){var _0x34ace0={};_0x34ace0[_0x5395df]={'$like':'%'+_0x1531a1[_0x2d08('0x2e')]['filter']+'%'};return _0x34ace0;})});}_0x33e2c7=_[_0x2d08('0x3b')]({},_0x33e2c7,_0x1531a1['options']);return _0xd05004[_0x2d08('0x50')](_0x33e2c7);}})['then'](function(_0x59171e){if(_0x59171e){_0x16f6de=_0x59171e[_0x2d08('0x33')];if(!_0x1531a1['query'][_0x2d08('0x4c')]('nolimit')){_0x33e2c7[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x1531a1[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x33e2c7[_0x2d08('0x1c')]=qs['offset'](_0x1531a1['query'][_0x2d08('0x1c')]);}return _0xd05004[_0x2d08('0x50')](_0x33e2c7);}})[_0x2d08('0x24')](function(_0x6392d7){if(_0x6392d7){return _0x6392d7?{'count':_0x16f6de,'rows':_0x6392d7}:null;}})[_0x2d08('0x24')](respondWithResult(_0x218cde,null))['catch'](handleError(_0x218cde,null));};exports[_0x2d08('0x51')]=function(_0x398af0,_0x1e5fbd,_0x4c2bc7){if(_0x398af0['body']['id']){delete _0x398af0[_0x2d08('0x47')]['id'];}return db[_0x2d08('0x2a')]['findOne']({'where':{'id':_0x398af0[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x1e5fbd,null))[_0x2d08('0x24')](function(_0x5df7e6){if(_0x5df7e6){return _0x5df7e6['setTags'](_0x398af0['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x1e5fbd,null))[_0x2d08('0x41')](handleError(_0x1e5fbd,null));}; \ No newline at end of file +var _0xb176=['type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','create','body','find','destroy','params','getFields','DeskField','order','sort','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName'];(function(_0x493566,_0x4cea46){var _0x2d5638=function(_0x4c53a5){while(--_0x4c53a5){_0x493566['push'](_0x493566['shift']());}};_0x2d5638(++_0x4cea46);}(_0xb176,0x130));var _0x6b17=function(_0x254849,_0x321ff6){_0x254849=_0x254849-0x0;var _0x4f73d1=_0xb176[_0x254849];return _0x4f73d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b17('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b17('0x1'));var rp=require(_0x6b17('0x2'));var moment=require(_0x6b17('0x3'));var BPromise=require(_0x6b17('0x4'));var Mustache=require(_0x6b17('0x5'));var util=require(_0x6b17('0x6'));var path=require(_0x6b17('0x7'));var sox=require(_0x6b17('0x8'));var csv=require(_0x6b17('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b17('0xa'));var _=require(_0x6b17('0xb'));var squel=require(_0x6b17('0xc'));var crypto=require(_0x6b17('0xd'));var jsforce=require(_0x6b17('0xe'));var deskjs=require(_0x6b17('0xf'));var toCsv=require(_0x6b17('0x9'));var querystring=require(_0x6b17('0x10'));var Papa=require(_0x6b17('0x11'));var Redis=require(_0x6b17('0x12'));var authService=require(_0x6b17('0x13'));var qs=require(_0x6b17('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b17('0x15'));var logger=require(_0x6b17('0x16'))('api');var utils=require(_0x6b17('0x17'));var config=require(_0x6b17('0x18'));var licenseUtil=require(_0x6b17('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294032,_0x489a77){_0x489a77=_0x489a77||0xcc;return function(_0x30b4e4){if(_0x30b4e4){return _0x294032[_0x6b17('0x1a')](_0x489a77);}return _0x294032[_0x6b17('0x1b')](_0x489a77)[_0x6b17('0x1c')]();};}function respondWithResult(_0x90d379,_0x16ad16){_0x16ad16=_0x16ad16||0xc8;return function(_0x2db7c7){if(_0x2db7c7){return _0x90d379[_0x6b17('0x1b')](_0x16ad16)[_0x6b17('0x1d')](_0x2db7c7);}};}function respondWithFilteredResult(_0x40d691,_0x22d39a){return function(_0x34252f){if(_0x34252f){var _0x1e9803=typeof _0x22d39a[_0x6b17('0x1e')]===_0x6b17('0x1f')&&typeof _0x22d39a[_0x6b17('0x20')]===_0x6b17('0x1f');var _0x1031c4=_0x34252f[_0x6b17('0x21')];var _0x26c869=_0x1e9803?0x0:_0x22d39a[_0x6b17('0x1e')];var _0xed210a=_0x1e9803?_0x34252f[_0x6b17('0x21')]:_0x22d39a[_0x6b17('0x1e')]+_0x22d39a[_0x6b17('0x20')];var _0x6d1b0e;if(_0xed210a>=_0x1031c4){_0xed210a=_0x1031c4;_0x6d1b0e=0xc8;}else{_0x6d1b0e=0xce;}_0x40d691['status'](_0x6d1b0e);return _0x40d691[_0x6b17('0x22')](_0x6b17('0x23'),_0x26c869+'-'+_0xed210a+'/'+_0x1031c4)[_0x6b17('0x1d')](_0x34252f);}return null;};}function patchUpdates(_0x471863){return function(_0x39839d){try{jsonpatch[_0x6b17('0x24')](_0x39839d,_0x471863,!![]);}catch(_0x17a20c){return BPromise[_0x6b17('0x25')](_0x17a20c);}return _0x39839d['save']();};}function saveUpdates(_0x4f4771,_0x575705){return function(_0x178114){if(_0x178114){return _0x178114[_0x6b17('0x26')](_0x4f4771)[_0x6b17('0x27')](function(_0x530bf2){return _0x530bf2;});}return null;};}function removeEntity(_0x21afb6,_0x505ad9){return function(_0x2fbe76){if(_0x2fbe76){return _0x2fbe76['destroy']()[_0x6b17('0x27')](function(){_0x21afb6[_0x6b17('0x1b')](0xcc)[_0x6b17('0x1c')]();});}};}function handleEntityNotFound(_0x273684,_0x59bddd){return function(_0x5f0244){if(!_0x5f0244){_0x273684[_0x6b17('0x1a')](0x194);}return _0x5f0244;};}function handleError(_0x379ce3,_0x438629){_0x438629=_0x438629||0x1f4;return function(_0xf1e898){logger[_0x6b17('0x28')](_0xf1e898[_0x6b17('0x29')]);if(_0xf1e898[_0x6b17('0x2a')]){delete _0xf1e898['name'];}_0x379ce3[_0x6b17('0x1b')](_0x438629)[_0x6b17('0x2b')](_0xf1e898);};}exports[_0x6b17('0x2c')]=function(_0x378570,_0xa73cd5){var _0x31f3b3={},_0x4aecb2={},_0x154115={'count':0x0,'rows':[]};var _0x47d2e6=_['map'](db[_0x6b17('0x2d')][_0x6b17('0x2e')],function(_0x196870){return{'name':_0x196870[_0x6b17('0x2f')],'type':_0x196870[_0x6b17('0x30')]['key']};});_0x4aecb2[_0x6b17('0x31')]=_[_0x6b17('0x32')](_0x47d2e6,_0x6b17('0x2a'));_0x4aecb2[_0x6b17('0x33')]=_[_0x6b17('0x34')](_0x378570[_0x6b17('0x33')]);_0x4aecb2['filters']=_[_0x6b17('0x35')](_0x4aecb2[_0x6b17('0x31')],_0x4aecb2[_0x6b17('0x33')]);_0x31f3b3[_0x6b17('0x36')]=_[_0x6b17('0x35')](_0x4aecb2['model'],qs['fields'](_0x378570[_0x6b17('0x33')][_0x6b17('0x37')]));_0x31f3b3[_0x6b17('0x36')]=_0x31f3b3[_0x6b17('0x36')][_0x6b17('0x38')]?_0x31f3b3['attributes']:_0x4aecb2[_0x6b17('0x31')];if(!_0x378570['query'][_0x6b17('0x39')](_0x6b17('0x3a'))){_0x31f3b3[_0x6b17('0x20')]=qs[_0x6b17('0x20')](_0x378570[_0x6b17('0x33')]['limit']);_0x31f3b3[_0x6b17('0x1e')]=qs[_0x6b17('0x1e')](_0x378570[_0x6b17('0x33')][_0x6b17('0x1e')]);}_0x31f3b3['order']=qs['sort'](_0x378570['query']['sort']);_0x31f3b3[_0x6b17('0x3b')]=qs['filters'](_[_0x6b17('0x3c')](_0x378570['query'],_0x4aecb2[_0x6b17('0x3d')]),_0x47d2e6);if(_0x378570[_0x6b17('0x33')]['filter']){_0x31f3b3[_0x6b17('0x3b')]=_[_0x6b17('0x3e')](_0x31f3b3[_0x6b17('0x3b')],{'$or':_[_0x6b17('0x32')](_0x47d2e6,function(_0x23b856){if(_0x23b856[_0x6b17('0x30')]!==_0x6b17('0x3f')){var _0x3cffbd={};_0x3cffbd[_0x23b856[_0x6b17('0x2a')]]={'$like':'%'+_0x378570[_0x6b17('0x33')][_0x6b17('0x40')]+'%'};return _0x3cffbd;}})});}_0x31f3b3=_[_0x6b17('0x3e')]({},_0x31f3b3,_0x378570['options']);var _0x42cd25={'where':_0x31f3b3['where']};return db[_0x6b17('0x2d')]['count'](_0x42cd25)[_0x6b17('0x27')](function(_0x55b3a0){_0x154115[_0x6b17('0x21')]=_0x55b3a0;if(_0x378570[_0x6b17('0x33')][_0x6b17('0x41')]){_0x31f3b3[_0x6b17('0x42')]=[{'all':!![]}];}return db[_0x6b17('0x2d')][_0x6b17('0x43')](_0x31f3b3);})[_0x6b17('0x27')](function(_0x54794b){_0x154115[_0x6b17('0x44')]=_0x54794b;return _0x154115;})[_0x6b17('0x27')](respondWithFilteredResult(_0xa73cd5,_0x31f3b3))[_0x6b17('0x45')](handleError(_0xa73cd5,null));};exports[_0x6b17('0x46')]=function(_0x40b2ee,_0x3b4c23){var _0x38e72f={'raw':![],'where':{'id':_0x40b2ee['params']['id']}},_0x28e8c3={};_0x28e8c3[_0x6b17('0x31')]=_['keys'](db[_0x6b17('0x2d')][_0x6b17('0x2e')]);_0x28e8c3[_0x6b17('0x33')]=_[_0x6b17('0x34')](_0x40b2ee[_0x6b17('0x33')]);_0x28e8c3[_0x6b17('0x3d')]=_[_0x6b17('0x35')](_0x28e8c3['model'],_0x28e8c3[_0x6b17('0x33')]);_0x38e72f[_0x6b17('0x36')]=_['intersection'](_0x28e8c3[_0x6b17('0x31')],qs[_0x6b17('0x37')](_0x40b2ee[_0x6b17('0x33')][_0x6b17('0x37')]));_0x38e72f[_0x6b17('0x36')]=_0x38e72f['attributes'][_0x6b17('0x38')]?_0x38e72f['attributes']:_0x28e8c3[_0x6b17('0x31')];if(_0x40b2ee[_0x6b17('0x33')][_0x6b17('0x41')]){_0x38e72f[_0x6b17('0x42')]=[{'all':!![]}];}_0x38e72f=_[_0x6b17('0x3e')]({},_0x38e72f,_0x40b2ee[_0x6b17('0x47')]);return db[_0x6b17('0x2d')]['find'](_0x38e72f)[_0x6b17('0x27')](handleEntityNotFound(_0x3b4c23,null))[_0x6b17('0x27')](respondWithResult(_0x3b4c23,null))[_0x6b17('0x45')](handleError(_0x3b4c23,null));};exports[_0x6b17('0x48')]=function(_0x10a044,_0x3c7ce8){return db[_0x6b17('0x2d')][_0x6b17('0x48')](_0x10a044[_0x6b17('0x49')],{})[_0x6b17('0x27')](respondWithResult(_0x3c7ce8,0xc9))[_0x6b17('0x45')](handleError(_0x3c7ce8,null));};exports[_0x6b17('0x26')]=function(_0x361b6f,_0x17b979){if(_0x361b6f[_0x6b17('0x49')]['id']){delete _0x361b6f['body']['id'];}return db['DeskConfiguration'][_0x6b17('0x4a')]({'where':{'id':_0x361b6f['params']['id']}})['then'](handleEntityNotFound(_0x17b979,null))[_0x6b17('0x27')](saveUpdates(_0x361b6f['body'],null))[_0x6b17('0x27')](respondWithResult(_0x17b979,null))[_0x6b17('0x45')](handleError(_0x17b979,null));};exports[_0x6b17('0x4b')]=function(_0x1e7dcb,_0x302750){return db[_0x6b17('0x2d')][_0x6b17('0x4a')]({'where':{'id':_0x1e7dcb[_0x6b17('0x4c')]['id']}})[_0x6b17('0x27')](handleEntityNotFound(_0x302750,null))[_0x6b17('0x27')](removeEntity(_0x302750,null))['catch'](handleError(_0x302750,null));};exports[_0x6b17('0x4d')]=function(_0x1effd5,_0x5d84a8,_0x205e06){var _0x62dbbb={};var _0x39af7e={};var _0x5a4c92;var _0x38aa95;return db[_0x6b17('0x2d')]['findOne']({'where':{'id':_0x1effd5['params']['id']}})[_0x6b17('0x27')](handleEntityNotFound(_0x5d84a8,null))[_0x6b17('0x27')](function(_0x277e9e){if(_0x277e9e){_0x5a4c92=_0x277e9e;_0x39af7e['model']=_['keys'](db[_0x6b17('0x4e')][_0x6b17('0x2e')]);_0x39af7e[_0x6b17('0x33')]=_[_0x6b17('0x34')](_0x1effd5[_0x6b17('0x33')]);_0x39af7e[_0x6b17('0x3d')]=_['intersection'](_0x39af7e[_0x6b17('0x31')],_0x39af7e[_0x6b17('0x33')]);_0x62dbbb[_0x6b17('0x36')]=_['intersection'](_0x39af7e[_0x6b17('0x31')],qs[_0x6b17('0x37')](_0x1effd5[_0x6b17('0x33')][_0x6b17('0x37')]));_0x62dbbb[_0x6b17('0x36')]=_0x62dbbb[_0x6b17('0x36')][_0x6b17('0x38')]?_0x62dbbb[_0x6b17('0x36')]:_0x39af7e[_0x6b17('0x31')];_0x62dbbb[_0x6b17('0x4f')]=qs['sort'](_0x1effd5[_0x6b17('0x33')][_0x6b17('0x50')]);_0x62dbbb['where']=qs[_0x6b17('0x3d')](_[_0x6b17('0x3c')](_0x1effd5[_0x6b17('0x33')],_0x39af7e[_0x6b17('0x3d')]));if(_0x1effd5[_0x6b17('0x33')][_0x6b17('0x40')]){_0x62dbbb['where']=_[_0x6b17('0x3e')](_0x62dbbb[_0x6b17('0x3b')],{'$or':_[_0x6b17('0x32')](_0x62dbbb[_0x6b17('0x36')],function(_0x331b64){var _0x4c16d8={};_0x4c16d8[_0x331b64]={'$like':'%'+_0x1effd5[_0x6b17('0x33')][_0x6b17('0x40')]+'%'};return _0x4c16d8;})});}_0x62dbbb=_[_0x6b17('0x3e')]({},_0x62dbbb,_0x1effd5[_0x6b17('0x47')]);return _0x5a4c92[_0x6b17('0x4d')](_0x62dbbb);}})[_0x6b17('0x27')](function(_0x4014e6){if(_0x4014e6){_0x38aa95=_0x4014e6[_0x6b17('0x38')];if(!_0x1effd5[_0x6b17('0x33')][_0x6b17('0x39')](_0x6b17('0x3a'))){_0x62dbbb[_0x6b17('0x20')]=qs['limit'](_0x1effd5[_0x6b17('0x33')][_0x6b17('0x20')]);_0x62dbbb['offset']=qs[_0x6b17('0x1e')](_0x1effd5[_0x6b17('0x33')]['offset']);}return _0x5a4c92[_0x6b17('0x4d')](_0x62dbbb);}})[_0x6b17('0x27')](function(_0x1d4253){if(_0x1d4253){return _0x1d4253?{'count':_0x38aa95,'rows':_0x1d4253}:null;}})[_0x6b17('0x27')](respondWithResult(_0x5d84a8,null))[_0x6b17('0x45')](handleError(_0x5d84a8,null));};exports[_0x6b17('0x51')]=function(_0x4942fe,_0x3d0cf6,_0x2f090f){var _0x3b13ea={};var _0x895f79={};var _0x4ad987;var _0x1bf69e;return db[_0x6b17('0x2d')][_0x6b17('0x52')]({'where':{'id':_0x4942fe[_0x6b17('0x4c')]['id']}})[_0x6b17('0x27')](handleEntityNotFound(_0x3d0cf6,null))[_0x6b17('0x27')](function(_0x204190){if(_0x204190){_0x4ad987=_0x204190;_0x895f79[_0x6b17('0x31')]=_[_0x6b17('0x34')](db[_0x6b17('0x4e')][_0x6b17('0x2e')]);_0x895f79[_0x6b17('0x33')]=_['keys'](_0x4942fe[_0x6b17('0x33')]);_0x895f79[_0x6b17('0x3d')]=_[_0x6b17('0x35')](_0x895f79[_0x6b17('0x31')],_0x895f79[_0x6b17('0x33')]);_0x3b13ea['attributes']=_[_0x6b17('0x35')](_0x895f79[_0x6b17('0x31')],qs[_0x6b17('0x37')](_0x4942fe[_0x6b17('0x33')]['fields']));_0x3b13ea['attributes']=_0x3b13ea[_0x6b17('0x36')][_0x6b17('0x38')]?_0x3b13ea[_0x6b17('0x36')]:_0x895f79[_0x6b17('0x31')];_0x3b13ea[_0x6b17('0x4f')]=qs['sort'](_0x4942fe['query']['sort']);_0x3b13ea[_0x6b17('0x3b')]=qs[_0x6b17('0x3d')](_[_0x6b17('0x3c')](_0x4942fe[_0x6b17('0x33')],_0x895f79[_0x6b17('0x3d')]));if(_0x4942fe[_0x6b17('0x33')][_0x6b17('0x40')]){_0x3b13ea['where']=_[_0x6b17('0x3e')](_0x3b13ea[_0x6b17('0x3b')],{'$or':_[_0x6b17('0x32')](_0x3b13ea[_0x6b17('0x36')],function(_0x8ff3cf){var _0x397dbb={};_0x397dbb[_0x8ff3cf]={'$like':'%'+_0x4942fe['query'][_0x6b17('0x40')]+'%'};return _0x397dbb;})});}_0x3b13ea=_[_0x6b17('0x3e')]({},_0x3b13ea,_0x4942fe[_0x6b17('0x47')]);return _0x4ad987[_0x6b17('0x51')](_0x3b13ea);}})[_0x6b17('0x27')](function(_0x20a9c8){if(_0x20a9c8){_0x1bf69e=_0x20a9c8[_0x6b17('0x38')];if(!_0x4942fe['query']['hasOwnProperty']('nolimit')){_0x3b13ea[_0x6b17('0x20')]=qs[_0x6b17('0x20')](_0x4942fe[_0x6b17('0x33')]['limit']);_0x3b13ea[_0x6b17('0x1e')]=qs[_0x6b17('0x1e')](_0x4942fe['query'][_0x6b17('0x1e')]);}return _0x4ad987[_0x6b17('0x51')](_0x3b13ea);}})[_0x6b17('0x27')](function(_0x2937ee){if(_0x2937ee){return _0x2937ee?{'count':_0x1bf69e,'rows':_0x2937ee}:null;}})[_0x6b17('0x27')](respondWithResult(_0x3d0cf6,null))['catch'](handleError(_0x3d0cf6,null));};exports['getDescriptions']=function(_0x3d62f2,_0x3395ed,_0x13a5e6){var _0x25a24e={};var _0x57d2c4={};var _0x4f0937;var _0x2dfd00;return db[_0x6b17('0x2d')][_0x6b17('0x52')]({'where':{'id':_0x3d62f2[_0x6b17('0x4c')]['id']}})[_0x6b17('0x27')](handleEntityNotFound(_0x3395ed,null))[_0x6b17('0x27')](function(_0x2bec51){if(_0x2bec51){_0x4f0937=_0x2bec51;_0x57d2c4[_0x6b17('0x31')]=_[_0x6b17('0x34')](db['DeskField'][_0x6b17('0x2e')]);_0x57d2c4['query']=_['keys'](_0x3d62f2[_0x6b17('0x33')]);_0x57d2c4['filters']=_[_0x6b17('0x35')](_0x57d2c4[_0x6b17('0x31')],_0x57d2c4[_0x6b17('0x33')]);_0x25a24e[_0x6b17('0x36')]=_['intersection'](_0x57d2c4['model'],qs[_0x6b17('0x37')](_0x3d62f2[_0x6b17('0x33')][_0x6b17('0x37')]));_0x25a24e['attributes']=_0x25a24e[_0x6b17('0x36')][_0x6b17('0x38')]?_0x25a24e[_0x6b17('0x36')]:_0x57d2c4[_0x6b17('0x31')];_0x25a24e['order']=qs[_0x6b17('0x50')](_0x3d62f2[_0x6b17('0x33')][_0x6b17('0x50')]);_0x25a24e[_0x6b17('0x3b')]=qs[_0x6b17('0x3d')](_[_0x6b17('0x3c')](_0x3d62f2['query'],_0x57d2c4['filters']));if(_0x3d62f2[_0x6b17('0x33')][_0x6b17('0x40')]){_0x25a24e[_0x6b17('0x3b')]=_[_0x6b17('0x3e')](_0x25a24e[_0x6b17('0x3b')],{'$or':_['map'](_0x25a24e[_0x6b17('0x36')],function(_0xff0c61){var _0x391311={};_0x391311[_0xff0c61]={'$like':'%'+_0x3d62f2[_0x6b17('0x33')]['filter']+'%'};return _0x391311;})});}_0x25a24e=_[_0x6b17('0x3e')]({},_0x25a24e,_0x3d62f2[_0x6b17('0x47')]);return _0x4f0937[_0x6b17('0x53')](_0x25a24e);}})[_0x6b17('0x27')](function(_0xf4f7a2){if(_0xf4f7a2){_0x2dfd00=_0xf4f7a2[_0x6b17('0x38')];if(!_0x3d62f2['query'][_0x6b17('0x39')](_0x6b17('0x3a'))){_0x25a24e[_0x6b17('0x20')]=qs[_0x6b17('0x20')](_0x3d62f2[_0x6b17('0x33')][_0x6b17('0x20')]);_0x25a24e[_0x6b17('0x1e')]=qs['offset'](_0x3d62f2[_0x6b17('0x33')][_0x6b17('0x1e')]);}return _0x4f0937[_0x6b17('0x53')](_0x25a24e);}})[_0x6b17('0x27')](function(_0x4c9099){if(_0x4c9099){return _0x4c9099?{'count':_0x2dfd00,'rows':_0x4c9099}:null;}})[_0x6b17('0x27')](respondWithResult(_0x3395ed,null))[_0x6b17('0x45')](handleError(_0x3395ed,null));};exports[_0x6b17('0x54')]=function(_0x31cd2b,_0x4a34a1,_0x38d0a1){var _0x4832a5={};var _0x5ae59c={};var _0x1c0c3d;var _0x5272d7;return db[_0x6b17('0x2d')]['findOne']({'where':{'id':_0x31cd2b['params']['id']}})['then'](handleEntityNotFound(_0x4a34a1,null))['then'](function(_0x32304c){if(_0x32304c){_0x1c0c3d=_0x32304c;_0x5ae59c[_0x6b17('0x31')]=_['keys'](db[_0x6b17('0x55')][_0x6b17('0x2e')]);_0x5ae59c[_0x6b17('0x33')]=_[_0x6b17('0x34')](_0x31cd2b[_0x6b17('0x33')]);_0x5ae59c['filters']=_[_0x6b17('0x35')](_0x5ae59c[_0x6b17('0x31')],_0x5ae59c[_0x6b17('0x33')]);_0x4832a5['attributes']=_[_0x6b17('0x35')](_0x5ae59c[_0x6b17('0x31')],qs['fields'](_0x31cd2b[_0x6b17('0x33')][_0x6b17('0x37')]));_0x4832a5['attributes']=_0x4832a5['attributes']['length']?_0x4832a5[_0x6b17('0x36')]:_0x5ae59c['model'];_0x4832a5['order']=qs[_0x6b17('0x50')](_0x31cd2b['query'][_0x6b17('0x50')]);_0x4832a5[_0x6b17('0x3b')]=qs[_0x6b17('0x3d')](_[_0x6b17('0x3c')](_0x31cd2b['query'],_0x5ae59c[_0x6b17('0x3d')]));if(_0x31cd2b[_0x6b17('0x33')][_0x6b17('0x40')]){_0x4832a5[_0x6b17('0x3b')]=_[_0x6b17('0x3e')](_0x4832a5[_0x6b17('0x3b')],{'$or':_[_0x6b17('0x32')](_0x4832a5[_0x6b17('0x36')],function(_0x421b3c){var _0x31fcf4={};_0x31fcf4[_0x421b3c]={'$like':'%'+_0x31cd2b[_0x6b17('0x33')][_0x6b17('0x40')]+'%'};return _0x31fcf4;})});}_0x4832a5=_[_0x6b17('0x3e')]({},_0x4832a5,_0x31cd2b[_0x6b17('0x47')]);return _0x1c0c3d[_0x6b17('0x54')](_0x4832a5);}})['then'](function(_0x338518){if(_0x338518){_0x5272d7=_0x338518['length'];if(!_0x31cd2b[_0x6b17('0x33')][_0x6b17('0x39')](_0x6b17('0x3a'))){_0x4832a5['limit']=qs[_0x6b17('0x20')](_0x31cd2b[_0x6b17('0x33')][_0x6b17('0x20')]);_0x4832a5['offset']=qs[_0x6b17('0x1e')](_0x31cd2b['query'][_0x6b17('0x1e')]);}return _0x1c0c3d[_0x6b17('0x54')](_0x4832a5);}})[_0x6b17('0x27')](function(_0x4bb21b){if(_0x4bb21b){return _0x4bb21b?{'count':_0x5272d7,'rows':_0x4bb21b}:null;}})[_0x6b17('0x27')](respondWithResult(_0x4a34a1,null))[_0x6b17('0x45')](handleError(_0x4a34a1,null));};exports[_0x6b17('0x56')]=function(_0x4b07fe,_0x1011f3,_0x44b96f){if(_0x4b07fe[_0x6b17('0x49')]['id']){delete _0x4b07fe[_0x6b17('0x49')]['id'];}return db[_0x6b17('0x2d')][_0x6b17('0x52')]({'where':{'id':_0x4b07fe[_0x6b17('0x4c')]['id']}})[_0x6b17('0x27')](handleEntityNotFound(_0x1011f3,null))[_0x6b17('0x27')](function(_0x21ce67){if(_0x21ce67){return _0x21ce67['setTags'](_0x4b07fe[_0x6b17('0x49')][_0x6b17('0x57')]||[]);}return null;})['then'](respondWithResult(_0x1011f3,null))['catch'](handleError(_0x1011f3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5938f3f..93992e8 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 _0x7f1a=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment'];(function(_0x2b576b,_0xaf8e4a){var _0x1c26d1=function(_0x5b14d0){while(--_0x5b14d0){_0x2b576b['push'](_0x2b576b['shift']());}};_0x1c26d1(++_0xaf8e4a);}(_0x7f1a,0x15a));var _0xa7f1=function(_0x21da56,_0x531348){_0x21da56=_0x21da56-0x0;var _0x4a6d9c=_0x7f1a[_0x21da56];return _0x4a6d9c;};'use strict';var _=require(_0xa7f1('0x0'));var util=require(_0xa7f1('0x1'));var logger=require('../../config/logger')(_0xa7f1('0x2'));var moment=require(_0xa7f1('0x3'));var BPromise=require(_0xa7f1('0x4'));var rp=require(_0xa7f1('0x5'));var fs=require('fs');var path=require(_0xa7f1('0x6'));var rimraf=require(_0xa7f1('0x7'));var config=require(_0xa7f1('0x8'));var attributes=require(_0xa7f1('0x9'));module[_0xa7f1('0xa')]=function(_0x202c02,_0x4953b7){return _0x202c02[_0xa7f1('0xb')](_0xa7f1('0xc'),attributes,{'tableName':_0xa7f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x802b=['api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x802b,0x103));var _0xb802=function(_0x3382e1,_0x1b69ee){_0x3382e1=_0x3382e1-0x0;var _0x166bd5=_0x802b[_0x3382e1];return _0x166bd5;};'use strict';var _=require('lodash');var util=require(_0xb802('0x0'));var logger=require('../../config/logger')(_0xb802('0x1'));var moment=require(_0xb802('0x2'));var BPromise=require(_0xb802('0x3'));var rp=require(_0xb802('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb802('0x5'));var attributes=require(_0xb802('0x6'));module[_0xb802('0x7')]=function(_0x3266a2,_0x2d339e){return _0x3266a2[_0xb802('0x8')]('DeskConfiguration',attributes,{'tableName':_0xb802('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9e658af..b9fd98b 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 _0xb955=['../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27f700,_0x587393){var _0x57d0d1=function(_0x5096c7){while(--_0x5096c7){_0x27f700['push'](_0x27f700['shift']());}};_0x57d0d1(++_0x587393);}(_0xb955,0x123));var _0x5b95=function(_0x575bdb,_0x57a5a1){_0x575bdb=_0x575bdb-0x0;var _0x519678=_0xb955[_0x575bdb];return _0x519678;};'use strict';var _=require(_0x5b95('0x0'));var util=require(_0x5b95('0x1'));var moment=require(_0x5b95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b95('0x3'));var db=require(_0x5b95('0x4'))['db'];var utils=require(_0x5b95('0x5'));var logger=require(_0x5b95('0x6'))(_0x5b95('0x7'));var config=require(_0x5b95('0x8'));var jayson=require(_0x5b95('0x9'));var client=jayson[_0x5b95('0xa')][_0x5b95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392ee2,_0x4eb97a,_0xf02d99){return new BPromise(function(_0x23ee42,_0x4b0744){return client['request'](_0x392ee2,_0xf02d99)[_0x5b95('0xc')](function(_0x2bca40){logger[_0x5b95('0xd')](_0x5b95('0xe'),_0x4eb97a,_0x5b95('0xf'));logger[_0x5b95('0x10')](_0x5b95('0x11'),_0x4eb97a,'request\x20sent',JSON[_0x5b95('0x12')](_0x2bca40));if(_0x2bca40['error']){if(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x14')]===0x1f4){logger[_0x5b95('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);return _0x4b0744(_0x2bca40[_0x5b95('0x13')]['message']);}logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x2bca40[_0x5b95('0x13')]['message']);return _0x23ee42(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x5b95('0xf'));_0x23ee42(_0x2bca40['result'][_0x5b95('0x15')]);}})[_0x5b95('0x16')](function(_0x79abc5){logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x79abc5);_0x4b0744(_0x79abc5);});});} \ No newline at end of file +var _0x27f4=['http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x8f1f4a,_0x1e3b82){var _0x920a53=function(_0x46e771){while(--_0x46e771){_0x8f1f4a['push'](_0x8f1f4a['shift']());}};_0x920a53(++_0x1e3b82);}(_0x27f4,0x14e));var _0x427f=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x27f4[_0x835cb7];return _0x3ef599;};'use strict';var _=require('lodash');var util=require(_0x427f('0x0'));var moment=require(_0x427f('0x1'));var BPromise=require(_0x427f('0x2'));var rs=require(_0x427f('0x3'));var fs=require('fs');var Redis=require(_0x427f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x427f('0x5'));var config=require(_0x427f('0x6'));var jayson=require(_0x427f('0x7'));var client=jayson['client'][_0x427f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x372c76,_0x4e87bd,_0x19a13e){return new BPromise(function(_0x5c3cb5,_0xf22405){return client['request'](_0x372c76,_0x19a13e)['then'](function(_0x2d25a7){logger[_0x427f('0x9')](_0x427f('0xa'),_0x4e87bd,_0x427f('0xb'));logger[_0x427f('0xc')](_0x427f('0xd'),_0x4e87bd,_0x427f('0xb'),JSON[_0x427f('0xe')](_0x2d25a7));if(_0x2d25a7[_0x427f('0xf')]){if(_0x2d25a7[_0x427f('0xf')][_0x427f('0x10')]===0x1f4){logger[_0x427f('0xf')](_0x427f('0xa'),_0x4e87bd,_0x2d25a7[_0x427f('0xf')][_0x427f('0x11')]);return _0xf22405(_0x2d25a7[_0x427f('0xf')][_0x427f('0x11')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4e87bd,_0x2d25a7['error'][_0x427f('0x11')]);return _0x5c3cb5(_0x2d25a7['error'][_0x427f('0x11')]);}else{logger[_0x427f('0x9')](_0x427f('0xa'),_0x4e87bd,_0x427f('0xb'));_0x5c3cb5(_0x2d25a7[_0x427f('0x12')][_0x427f('0x11')]);}})['catch'](function(_0x3fe2c2){logger[_0x427f('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x4e87bd,_0x3fe2c2);_0xf22405(_0x3fe2c2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6ae86d1..e63a169 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 _0x6796=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x118a12,_0x323a33){var _0x3da036=function(_0x28d39d){while(--_0x28d39d){_0x118a12['push'](_0x118a12['shift']());}};_0x3da036(++_0x323a33);}(_0x6796,0x66));var _0x6679=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x6796[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require(_0x6679('0x0'));var util=require('util');var path=require(_0x6679('0x1'));var timeout=require(_0x6679('0x2'));var express=require('express');var router=express[_0x6679('0x3')]();var fs_extra=require(_0x6679('0x4'));var auth=require(_0x6679('0x5'));var interaction=require(_0x6679('0x6'));var config=require(_0x6679('0x7'));var controller=require(_0x6679('0x8'));router[_0x6679('0x9')]('/',auth[_0x6679('0xa')](),controller['index']);router[_0x6679('0x9')](_0x6679('0xb'),auth[_0x6679('0xa')](),controller[_0x6679('0xc')]);router[_0x6679('0xd')]('/',auth['isAuthenticated'](),controller[_0x6679('0xe')]);router[_0x6679('0xf')]('/:id',auth[_0x6679('0xa')](),controller[_0x6679('0x10')]);router['delete'](_0x6679('0xb'),auth['isAuthenticated'](),controller[_0x6679('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4f3d=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','index','isAuthenticated','put','/:id'];(function(_0x51e856,_0x22efb4){var _0x5afc90=function(_0x1769ad){while(--_0x1769ad){_0x51e856['push'](_0x51e856['shift']());}};_0x5afc90(++_0x22efb4);}(_0x4f3d,0x18a));var _0xd4f3=function(_0x3bb50e,_0x3c0294){_0x3bb50e=_0x3bb50e-0x0;var _0x490881=_0x4f3d[_0x3bb50e];return _0x490881;};'use strict';var multer=require(_0xd4f3('0x0'));var util=require(_0xd4f3('0x1'));var path=require(_0xd4f3('0x2'));var timeout=require(_0xd4f3('0x3'));var express=require(_0xd4f3('0x4'));var router=express[_0xd4f3('0x5')]();var fs_extra=require(_0xd4f3('0x6'));var auth=require(_0xd4f3('0x7'));var interaction=require(_0xd4f3('0x8'));var config=require('../../config/environment');var controller=require(_0xd4f3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd4f3('0xa')]);router['get']('/:id',auth[_0xd4f3('0xb')](),controller['show']);router['post']('/',auth[_0xd4f3('0xb')](),controller['create']);router[_0xd4f3('0xc')](_0xd4f3('0xd'),auth[_0xd4f3('0xb')](),controller[_0xd4f3('0xe')]);router[_0xd4f3('0xf')](_0xd4f3('0xd'),auth[_0xd4f3('0xb')](),controller[_0xd4f3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 65d91fa..38f170c 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 _0xd908=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x17a33e,_0x1b38fe){var _0x4801d0=function(_0x23fb6a){while(--_0x23fb6a){_0x17a33e['push'](_0x17a33e['shift']());}};_0x4801d0(++_0x1b38fe);}(_0xd908,0x1ce));var _0x8d90=function(_0x2efd88,_0x5f26d0){_0x2efd88=_0x2efd88-0x0;var _0x1311da=_0xd908[_0x2efd88];return _0x1311da;};'use strict';var Sequelize=require(_0x8d90('0x0'));module[_0x8d90('0x1')]={'type':{'type':Sequelize[_0x8d90('0x2')](_0x8d90('0x3'),_0x8d90('0x4'),_0x8d90('0x5'),_0x8d90('0x6'),'picklist'),'defaultValue':_0x8d90('0x3')},'content':{'type':Sequelize[_0x8d90('0x7')]},'key':{'type':Sequelize[_0x8d90('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8d90('0x3'),_0x8d90('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8d90('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8d90('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8d90('0x7')]}}; \ No newline at end of file +var _0x2b61=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','sequelize'];(function(_0x1c4c1a,_0x5482f4){var _0x1d6acb=function(_0x3ddcd3){while(--_0x3ddcd3){_0x1c4c1a['push'](_0x1c4c1a['shift']());}};_0x1d6acb(++_0x5482f4);}(_0x2b61,0x10d));var _0x12b6=function(_0x7e8ffb,_0x272fcc){_0x7e8ffb=_0x7e8ffb-0x0;var _0x1756f6=_0x2b61[_0x7e8ffb];return _0x1756f6;};'use strict';var Sequelize=require(_0x12b6('0x0'));module[_0x12b6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x12b6('0x2'),'variable',_0x12b6('0x3'),_0x12b6('0x4'),_0x12b6('0x5')),'defaultValue':_0x12b6('0x2')},'content':{'type':Sequelize[_0x12b6('0x6')]},'key':{'type':Sequelize[_0x12b6('0x6')]},'keyType':{'type':Sequelize[_0x12b6('0x7')](_0x12b6('0x2'),_0x12b6('0x8'),_0x12b6('0x3'))},'keyContent':{'type':Sequelize[_0x12b6('0x6')]},'idField':{'type':Sequelize[_0x12b6('0x6')]},'nameField':{'type':Sequelize[_0x12b6('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ac7d8e6..850225f 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 _0x1be0=['jsforce','querystring','papaparse','ioredis','../../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','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','DeskField','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto'];(function(_0x2ceb3c,_0x1fba66){var _0xc009a5=function(_0x1b8df0){while(--_0x1b8df0){_0x2ceb3c['push'](_0x2ceb3c['shift']());}};_0xc009a5(++_0x1fba66);}(_0x1be0,0x16b));var _0x01be=function(_0x23c5bf,_0x38a350){_0x23c5bf=_0x23c5bf-0x0;var _0x597e78=_0x1be0[_0x23c5bf];return _0x597e78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01be('0x0'));var zipdir=require(_0x01be('0x1'));var jsonpatch=require(_0x01be('0x2'));var rp=require(_0x01be('0x3'));var moment=require('moment');var BPromise=require(_0x01be('0x4'));var Mustache=require(_0x01be('0x5'));var util=require(_0x01be('0x6'));var path=require(_0x01be('0x7'));var sox=require('sox');var csv=require(_0x01be('0x8'));var ejs=require(_0x01be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x01be('0xa'));var crypto=require(_0x01be('0xb'));var jsforce=require(_0x01be('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x01be('0x8'));var querystring=require(_0x01be('0xd'));var Papa=require(_0x01be('0xe'));var Redis=require(_0x01be('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01be('0x10'));var logger=require(_0x01be('0x11'))(_0x01be('0x12'));var utils=require(_0x01be('0x13'));var config=require(_0x01be('0x14'));var licenseUtil=require(_0x01be('0x15'));var db=require(_0x01be('0x16'))['db'];function respondWithStatusCode(_0x6146b5,_0x500b61){_0x500b61=_0x500b61||0xcc;return function(_0x5e4bb0){if(_0x5e4bb0){return _0x6146b5[_0x01be('0x17')](_0x500b61);}return _0x6146b5[_0x01be('0x18')](_0x500b61)['end']();};}function respondWithResult(_0x2c3f74,_0x4a13bc){_0x4a13bc=_0x4a13bc||0xc8;return function(_0x2ef2b6){if(_0x2ef2b6){return _0x2c3f74[_0x01be('0x18')](_0x4a13bc)[_0x01be('0x19')](_0x2ef2b6);}};}function respondWithFilteredResult(_0x18fb14,_0xf63424){return function(_0x126595){if(_0x126595){var _0x138315=typeof _0xf63424[_0x01be('0x1a')]===_0x01be('0x1b')&&typeof _0xf63424[_0x01be('0x1c')]===_0x01be('0x1b');var _0x30e167=_0x126595[_0x01be('0x1d')];var _0x4bb952=_0x138315?0x0:_0xf63424['offset'];var _0x5870b5=_0x138315?_0x126595[_0x01be('0x1d')]:_0xf63424[_0x01be('0x1a')]+_0xf63424[_0x01be('0x1c')];var _0x5845d8;if(_0x5870b5>=_0x30e167){_0x5870b5=_0x30e167;_0x5845d8=0xc8;}else{_0x5845d8=0xce;}_0x18fb14['status'](_0x5845d8);return _0x18fb14[_0x01be('0x1e')](_0x01be('0x1f'),_0x4bb952+'-'+_0x5870b5+'/'+_0x30e167)[_0x01be('0x19')](_0x126595);}return null;};}function patchUpdates(_0x2cbcdf){return function(_0x10e2fe){try{jsonpatch[_0x01be('0x20')](_0x10e2fe,_0x2cbcdf,!![]);}catch(_0x187bf3){return BPromise[_0x01be('0x21')](_0x187bf3);}return _0x10e2fe[_0x01be('0x22')]();};}function saveUpdates(_0x6502c2,_0x3ac7f1){return function(_0x2569a3){if(_0x2569a3){return _0x2569a3[_0x01be('0x23')](_0x6502c2)[_0x01be('0x24')](function(_0x40cf97){return _0x40cf97;});}return null;};}function removeEntity(_0x2819cf,_0x11c019){return function(_0x1dc049){if(_0x1dc049){return _0x1dc049[_0x01be('0x25')]()[_0x01be('0x24')](function(){_0x2819cf[_0x01be('0x18')](0xcc)[_0x01be('0x26')]();});}};}function handleEntityNotFound(_0x405df8,_0xb6f4e1){return function(_0x265ccb){if(!_0x265ccb){_0x405df8[_0x01be('0x17')](0x194);}return _0x265ccb;};}function handleError(_0x1bcfc2,_0x6d8e6b){_0x6d8e6b=_0x6d8e6b||0x1f4;return function(_0x4f32fc){logger[_0x01be('0x27')](_0x4f32fc[_0x01be('0x28')]);if(_0x4f32fc[_0x01be('0x29')]){delete _0x4f32fc[_0x01be('0x29')];}_0x1bcfc2[_0x01be('0x18')](_0x6d8e6b)[_0x01be('0x2a')](_0x4f32fc);};}exports[_0x01be('0x2b')]=function(_0x2d6fef,_0x25abb3){var _0x52e8d8={},_0x5803a9={},_0x13c906={'count':0x0,'rows':[]};var _0x1fbcaf=_[_0x01be('0x2c')](db['DeskField'][_0x01be('0x2d')],function(_0x5d4894){return{'name':_0x5d4894[_0x01be('0x2e')],'type':_0x5d4894[_0x01be('0x2f')]['key']};});_0x5803a9[_0x01be('0x30')]=_[_0x01be('0x2c')](_0x1fbcaf,_0x01be('0x29'));_0x5803a9['query']=_[_0x01be('0x31')](_0x2d6fef['query']);_0x5803a9[_0x01be('0x32')]=_['intersection'](_0x5803a9[_0x01be('0x30')],_0x5803a9[_0x01be('0x33')]);_0x52e8d8[_0x01be('0x34')]=_[_0x01be('0x35')](_0x5803a9[_0x01be('0x30')],qs[_0x01be('0x36')](_0x2d6fef[_0x01be('0x33')][_0x01be('0x36')]));_0x52e8d8[_0x01be('0x34')]=_0x52e8d8['attributes'][_0x01be('0x37')]?_0x52e8d8[_0x01be('0x34')]:_0x5803a9['model'];if(!_0x2d6fef[_0x01be('0x33')][_0x01be('0x38')]('nolimit')){_0x52e8d8[_0x01be('0x1c')]=qs[_0x01be('0x1c')](_0x2d6fef[_0x01be('0x33')]['limit']);_0x52e8d8[_0x01be('0x1a')]=qs[_0x01be('0x1a')](_0x2d6fef[_0x01be('0x33')][_0x01be('0x1a')]);}_0x52e8d8[_0x01be('0x39')]=qs['sort'](_0x2d6fef[_0x01be('0x33')][_0x01be('0x3a')]);_0x52e8d8['where']=qs[_0x01be('0x32')](_[_0x01be('0x3b')](_0x2d6fef[_0x01be('0x33')],_0x5803a9['filters']),_0x1fbcaf);if(_0x2d6fef['query'][_0x01be('0x3c')]){_0x52e8d8[_0x01be('0x3d')]=_[_0x01be('0x3e')](_0x52e8d8[_0x01be('0x3d')],{'$or':_[_0x01be('0x2c')](_0x1fbcaf,function(_0x5ab6e7){if(_0x5ab6e7[_0x01be('0x2f')]!=='VIRTUAL'){var _0x487e3b={};_0x487e3b[_0x5ab6e7[_0x01be('0x29')]]={'$like':'%'+_0x2d6fef[_0x01be('0x33')]['filter']+'%'};return _0x487e3b;}})});}_0x52e8d8=_['merge']({},_0x52e8d8,_0x2d6fef[_0x01be('0x3f')]);var _0x489d22={'where':_0x52e8d8[_0x01be('0x3d')]};return db[_0x01be('0x40')][_0x01be('0x1d')](_0x489d22)[_0x01be('0x24')](function(_0x6e6787){_0x13c906[_0x01be('0x1d')]=_0x6e6787;if(_0x2d6fef[_0x01be('0x33')][_0x01be('0x41')]){_0x52e8d8['include']=[{'all':!![]}];}return db[_0x01be('0x40')][_0x01be('0x42')](_0x52e8d8);})[_0x01be('0x24')](function(_0x4388c0){_0x13c906[_0x01be('0x43')]=_0x4388c0;return _0x13c906;})['then'](respondWithFilteredResult(_0x25abb3,_0x52e8d8))[_0x01be('0x44')](handleError(_0x25abb3,null));};exports[_0x01be('0x45')]=function(_0x1c2290,_0x1be4e2){var _0x35f7ae={'raw':!![],'where':{'id':_0x1c2290[_0x01be('0x46')]['id']}},_0x1ec7b5={};_0x1ec7b5['model']=_['keys'](db[_0x01be('0x40')][_0x01be('0x2d')]);_0x1ec7b5['query']=_[_0x01be('0x31')](_0x1c2290[_0x01be('0x33')]);_0x1ec7b5[_0x01be('0x32')]=_[_0x01be('0x35')](_0x1ec7b5['model'],_0x1ec7b5[_0x01be('0x33')]);_0x35f7ae[_0x01be('0x34')]=_['intersection'](_0x1ec7b5[_0x01be('0x30')],qs['fields'](_0x1c2290['query'][_0x01be('0x36')]));_0x35f7ae[_0x01be('0x34')]=_0x35f7ae[_0x01be('0x34')][_0x01be('0x37')]?_0x35f7ae[_0x01be('0x34')]:_0x1ec7b5[_0x01be('0x30')];if(_0x1c2290[_0x01be('0x33')][_0x01be('0x41')]){_0x35f7ae[_0x01be('0x47')]=[{'all':!![]}];}_0x35f7ae=_[_0x01be('0x3e')]({},_0x35f7ae,_0x1c2290['options']);return db[_0x01be('0x40')]['find'](_0x35f7ae)[_0x01be('0x24')](handleEntityNotFound(_0x1be4e2,null))['then'](respondWithResult(_0x1be4e2,null))[_0x01be('0x44')](handleError(_0x1be4e2,null));};exports[_0x01be('0x48')]=function(_0x376404,_0x534611){return db[_0x01be('0x40')][_0x01be('0x48')](_0x376404[_0x01be('0x49')],{})[_0x01be('0x24')](respondWithResult(_0x534611,0xc9))[_0x01be('0x44')](handleError(_0x534611,null));};exports[_0x01be('0x23')]=function(_0x7acd73,_0x4ce697){if(_0x7acd73[_0x01be('0x49')]['id']){delete _0x7acd73[_0x01be('0x49')]['id'];}return db['DeskField'][_0x01be('0x4a')]({'where':{'id':_0x7acd73['params']['id']}})[_0x01be('0x24')](handleEntityNotFound(_0x4ce697,null))[_0x01be('0x24')](saveUpdates(_0x7acd73[_0x01be('0x49')],null))[_0x01be('0x24')](respondWithResult(_0x4ce697,null))['catch'](handleError(_0x4ce697,null));};exports['destroy']=function(_0x12cdd8,_0x5e136c){return db[_0x01be('0x40')][_0x01be('0x4a')]({'where':{'id':_0x12cdd8[_0x01be('0x46')]['id']}})[_0x01be('0x24')](handleEntityNotFound(_0x5e136c,null))[_0x01be('0x24')](removeEntity(_0x5e136c,null))[_0x01be('0x44')](handleError(_0x5e136c,null));}; \ No newline at end of file +var _0x5e9c=['VIRTUAL','options','include','DeskField','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','fieldName','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x388886,_0xe78c0f){var _0x52aa06=function(_0x2948aa){while(--_0x2948aa){_0x388886['push'](_0x388886['shift']());}};_0x52aa06(++_0xe78c0f);}(_0x5e9c,0x17c));var _0xc5e9=function(_0x40f59d,_0x1e32c6){_0x40f59d=_0x40f59d-0x0;var _0x4c61f6=_0x5e9c[_0x40f59d];return _0x4c61f6;};'use strict';var emlformat=require(_0xc5e9('0x0'));var rimraf=require(_0xc5e9('0x1'));var zipdir=require(_0xc5e9('0x2'));var jsonpatch=require(_0xc5e9('0x3'));var rp=require('request-promise');var moment=require(_0xc5e9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5e9('0x5'));var util=require(_0xc5e9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc5e9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5e9('0x8'));var _=require(_0xc5e9('0x9'));var squel=require(_0xc5e9('0xa'));var crypto=require(_0xc5e9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc5e9('0xc'));var toCsv=require(_0xc5e9('0x7'));var querystring=require(_0xc5e9('0xd'));var Papa=require('papaparse');var Redis=require(_0xc5e9('0xe'));var authService=require(_0xc5e9('0xf'));var qs=require(_0xc5e9('0x10'));var as=require(_0xc5e9('0x11'));var hardwareService=require(_0xc5e9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc5e9('0x13'));var config=require(_0xc5e9('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340ac5,_0x426244){_0x426244=_0x426244||0xcc;return function(_0x576cdf){if(_0x576cdf){return _0x340ac5['sendStatus'](_0x426244);}return _0x340ac5['status'](_0x426244)['end']();};}function respondWithResult(_0x27a5fe,_0x57a0ee){_0x57a0ee=_0x57a0ee||0xc8;return function(_0x40899b){if(_0x40899b){return _0x27a5fe[_0xc5e9('0x15')](_0x57a0ee)['json'](_0x40899b);}};}function respondWithFilteredResult(_0x3ccda2,_0x3586c1){return function(_0x51c3e2){if(_0x51c3e2){var _0x266f0a=typeof _0x3586c1['offset']==='undefined'&&typeof _0x3586c1[_0xc5e9('0x16')]===_0xc5e9('0x17');var _0x42e431=_0x51c3e2[_0xc5e9('0x18')];var _0x11ec69=_0x266f0a?0x0:_0x3586c1[_0xc5e9('0x19')];var _0x11e03c=_0x266f0a?_0x51c3e2[_0xc5e9('0x18')]:_0x3586c1[_0xc5e9('0x19')]+_0x3586c1[_0xc5e9('0x16')];var _0x29fa04;if(_0x11e03c>=_0x42e431){_0x11e03c=_0x42e431;_0x29fa04=0xc8;}else{_0x29fa04=0xce;}_0x3ccda2['status'](_0x29fa04);return _0x3ccda2[_0xc5e9('0x1a')](_0xc5e9('0x1b'),_0x11ec69+'-'+_0x11e03c+'/'+_0x42e431)[_0xc5e9('0x1c')](_0x51c3e2);}return null;};}function patchUpdates(_0x371cb7){return function(_0xd79496){try{jsonpatch[_0xc5e9('0x1d')](_0xd79496,_0x371cb7,!![]);}catch(_0x3ee8cd){return BPromise[_0xc5e9('0x1e')](_0x3ee8cd);}return _0xd79496[_0xc5e9('0x1f')]();};}function saveUpdates(_0x1743a1,_0x1db321){return function(_0x207e0e){if(_0x207e0e){return _0x207e0e['update'](_0x1743a1)[_0xc5e9('0x20')](function(_0x1a0274){return _0x1a0274;});}return null;};}function removeEntity(_0x16f2ba,_0x30882f){return function(_0x50ca99){if(_0x50ca99){return _0x50ca99[_0xc5e9('0x21')]()['then'](function(){_0x16f2ba[_0xc5e9('0x15')](0xcc)[_0xc5e9('0x22')]();});}};}function handleEntityNotFound(_0x365375,_0xcc8f1d){return function(_0x453b19){if(!_0x453b19){_0x365375[_0xc5e9('0x23')](0x194);}return _0x453b19;};}function handleError(_0x5d1a49,_0x3981a7){_0x3981a7=_0x3981a7||0x1f4;return function(_0x5cf0a2){logger[_0xc5e9('0x24')](_0x5cf0a2['stack']);if(_0x5cf0a2[_0xc5e9('0x25')]){delete _0x5cf0a2['name'];}_0x5d1a49[_0xc5e9('0x15')](_0x3981a7)[_0xc5e9('0x26')](_0x5cf0a2);};}exports[_0xc5e9('0x27')]=function(_0x3c4c3e,_0x3348c3){var _0x1aace9={},_0x12b677={},_0xe9a832={'count':0x0,'rows':[]};var _0x498225=_[_0xc5e9('0x28')](db['DeskField']['rawAttributes'],function(_0x12f33d){return{'name':_0x12f33d[_0xc5e9('0x29')],'type':_0x12f33d['type']['key']};});_0x12b677['model']=_[_0xc5e9('0x28')](_0x498225,'name');_0x12b677['query']=_[_0xc5e9('0x2a')](_0x3c4c3e[_0xc5e9('0x2b')]);_0x12b677[_0xc5e9('0x2c')]=_['intersection'](_0x12b677[_0xc5e9('0x2d')],_0x12b677[_0xc5e9('0x2b')]);_0x1aace9[_0xc5e9('0x2e')]=_[_0xc5e9('0x2f')](_0x12b677['model'],qs['fields'](_0x3c4c3e[_0xc5e9('0x2b')][_0xc5e9('0x30')]));_0x1aace9[_0xc5e9('0x2e')]=_0x1aace9[_0xc5e9('0x2e')][_0xc5e9('0x31')]?_0x1aace9[_0xc5e9('0x2e')]:_0x12b677[_0xc5e9('0x2d')];if(!_0x3c4c3e['query'][_0xc5e9('0x32')](_0xc5e9('0x33'))){_0x1aace9[_0xc5e9('0x16')]=qs['limit'](_0x3c4c3e[_0xc5e9('0x2b')][_0xc5e9('0x16')]);_0x1aace9[_0xc5e9('0x19')]=qs[_0xc5e9('0x19')](_0x3c4c3e[_0xc5e9('0x2b')][_0xc5e9('0x19')]);}_0x1aace9[_0xc5e9('0x34')]=qs[_0xc5e9('0x35')](_0x3c4c3e['query'][_0xc5e9('0x35')]);_0x1aace9[_0xc5e9('0x36')]=qs[_0xc5e9('0x2c')](_[_0xc5e9('0x37')](_0x3c4c3e[_0xc5e9('0x2b')],_0x12b677[_0xc5e9('0x2c')]),_0x498225);if(_0x3c4c3e[_0xc5e9('0x2b')][_0xc5e9('0x38')]){_0x1aace9['where']=_[_0xc5e9('0x39')](_0x1aace9[_0xc5e9('0x36')],{'$or':_[_0xc5e9('0x28')](_0x498225,function(_0x385168){if(_0x385168['type']!==_0xc5e9('0x3a')){var _0x5a2544={};_0x5a2544[_0x385168['name']]={'$like':'%'+_0x3c4c3e['query']['filter']+'%'};return _0x5a2544;}})});}_0x1aace9=_['merge']({},_0x1aace9,_0x3c4c3e[_0xc5e9('0x3b')]);var _0x84ce43={'where':_0x1aace9[_0xc5e9('0x36')]};return db['DeskField'][_0xc5e9('0x18')](_0x84ce43)[_0xc5e9('0x20')](function(_0x340e2d){_0xe9a832['count']=_0x340e2d;if(_0x3c4c3e[_0xc5e9('0x2b')]['includeAll']){_0x1aace9[_0xc5e9('0x3c')]=[{'all':!![]}];}return db[_0xc5e9('0x3d')][_0xc5e9('0x3e')](_0x1aace9);})[_0xc5e9('0x20')](function(_0x36c68c){_0xe9a832[_0xc5e9('0x3f')]=_0x36c68c;return _0xe9a832;})[_0xc5e9('0x20')](respondWithFilteredResult(_0x3348c3,_0x1aace9))[_0xc5e9('0x40')](handleError(_0x3348c3,null));};exports[_0xc5e9('0x41')]=function(_0x4e8e12,_0x7e7ffd){var _0x31a767={'raw':!![],'where':{'id':_0x4e8e12['params']['id']}},_0x14833e={};_0x14833e['model']=_[_0xc5e9('0x2a')](db[_0xc5e9('0x3d')][_0xc5e9('0x42')]);_0x14833e[_0xc5e9('0x2b')]=_[_0xc5e9('0x2a')](_0x4e8e12[_0xc5e9('0x2b')]);_0x14833e['filters']=_[_0xc5e9('0x2f')](_0x14833e[_0xc5e9('0x2d')],_0x14833e[_0xc5e9('0x2b')]);_0x31a767['attributes']=_[_0xc5e9('0x2f')](_0x14833e[_0xc5e9('0x2d')],qs['fields'](_0x4e8e12[_0xc5e9('0x2b')][_0xc5e9('0x30')]));_0x31a767[_0xc5e9('0x2e')]=_0x31a767[_0xc5e9('0x2e')][_0xc5e9('0x31')]?_0x31a767[_0xc5e9('0x2e')]:_0x14833e[_0xc5e9('0x2d')];if(_0x4e8e12['query'][_0xc5e9('0x43')]){_0x31a767['include']=[{'all':!![]}];}_0x31a767=_['merge']({},_0x31a767,_0x4e8e12[_0xc5e9('0x3b')]);return db[_0xc5e9('0x3d')][_0xc5e9('0x44')](_0x31a767)['then'](handleEntityNotFound(_0x7e7ffd,null))[_0xc5e9('0x20')](respondWithResult(_0x7e7ffd,null))[_0xc5e9('0x40')](handleError(_0x7e7ffd,null));};exports[_0xc5e9('0x45')]=function(_0x2a2cf5,_0x530d90){return db[_0xc5e9('0x3d')]['create'](_0x2a2cf5[_0xc5e9('0x46')],{})[_0xc5e9('0x20')](respondWithResult(_0x530d90,0xc9))[_0xc5e9('0x40')](handleError(_0x530d90,null));};exports[_0xc5e9('0x47')]=function(_0x3684e7,_0x59bde1){if(_0x3684e7[_0xc5e9('0x46')]['id']){delete _0x3684e7[_0xc5e9('0x46')]['id'];}return db[_0xc5e9('0x3d')]['find']({'where':{'id':_0x3684e7[_0xc5e9('0x48')]['id']}})[_0xc5e9('0x20')](handleEntityNotFound(_0x59bde1,null))[_0xc5e9('0x20')](saveUpdates(_0x3684e7['body'],null))[_0xc5e9('0x20')](respondWithResult(_0x59bde1,null))[_0xc5e9('0x40')](handleError(_0x59bde1,null));};exports['destroy']=function(_0x50b13a,_0xcb269a){return db[_0xc5e9('0x3d')]['find']({'where':{'id':_0x50b13a[_0xc5e9('0x48')]['id']}})[_0xc5e9('0x20')](handleEntityNotFound(_0xcb269a,null))[_0xc5e9('0x20')](removeEntity(_0xcb269a,null))['catch'](handleError(_0xcb269a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c36634d..d0cbc04 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 _0x74f2=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x74f2,0xcf));var _0x274f=function(_0x43f1e9,_0x113148){_0x43f1e9=_0x43f1e9-0x0;var _0x2dbeb6=_0x74f2[_0x43f1e9];return _0x2dbeb6;};'use strict';var _=require(_0x274f('0x0'));var util=require('util');var logger=require(_0x274f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x274f('0x2'));var rp=require(_0x274f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x274f('0x4'));var config=require(_0x274f('0x5'));var attributes=require('./intDeskField.attributes');module[_0x274f('0x6')]=function(_0x2406c3,_0x367613){return _0x2406c3[_0x274f('0x7')](_0x274f('0x8'),attributes,{'tableName':_0x274f('0x9'),'paranoid':![],'indexes':[{'name':_0x274f('0xa'),'fields':[_0x274f('0xb'),_0x274f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25cd=['int_desk_fields','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskField'];(function(_0x119e57,_0x1b4888){var _0x386557=function(_0x162a72){while(--_0x162a72){_0x119e57['push'](_0x119e57['shift']());}};_0x386557(++_0x1b4888);}(_0x25cd,0xe8));var _0xd25c=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0x25cd[_0x4496c1];return _0xa2da11;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd25c('0x0'))(_0xd25c('0x1'));var moment=require(_0xd25c('0x2'));var BPromise=require(_0xd25c('0x3'));var rp=require(_0xd25c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd25c('0x5'));var config=require(_0xd25c('0x6'));var attributes=require('./intDeskField.attributes');module[_0xd25c('0x7')]=function(_0x4d6e59,_0x1aed9a){return _0x4d6e59[_0xd25c('0x8')](_0xd25c('0x9'),attributes,{'tableName':_0xd25c('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'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 88b5c1e..d98409e 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 _0xb133=['../../config/logger','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xb133,0x1f4));var _0x3b13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb133[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b13('0x0'));var util=require(_0x3b13('0x1'));var moment=require('moment');var BPromise=require(_0x3b13('0x2'));var rs=require(_0x3b13('0x3'));var fs=require('fs');var Redis=require(_0x3b13('0x4'));var db=require(_0x3b13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b13('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b13('0x7'));var client=jayson[_0x3b13('0x8')][_0x3b13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f7e34,_0x8865e4,_0x4bcc0a){return new BPromise(function(_0x4cea14,_0x1d4a50){return client[_0x3b13('0xa')](_0x2f7e34,_0x4bcc0a)[_0x3b13('0xb')](function(_0x57400c){logger[_0x3b13('0xc')](_0x3b13('0xd'),_0x8865e4,_0x3b13('0xe'));logger[_0x3b13('0xf')](_0x3b13('0x10'),_0x8865e4,_0x3b13('0xe'),JSON[_0x3b13('0x11')](_0x57400c));if(_0x57400c[_0x3b13('0x12')]){if(_0x57400c[_0x3b13('0x12')][_0x3b13('0x13')]===0x1f4){logger[_0x3b13('0x12')](_0x3b13('0xd'),_0x8865e4,_0x57400c[_0x3b13('0x12')]['message']);return _0x1d4a50(_0x57400c['error'][_0x3b13('0x14')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x8865e4,_0x57400c['error'][_0x3b13('0x14')]);return _0x4cea14(_0x57400c[_0x3b13('0x12')][_0x3b13('0x14')]);}else{logger[_0x3b13('0xc')]('DeskField,\x20%s,\x20%s',_0x8865e4,_0x3b13('0xe'));_0x4cea14(_0x57400c[_0x3b13('0x15')]['message']);}})['catch'](function(_0xde74ab){logger[_0x3b13('0x12')]('DeskField,\x20%s,\x20%s',_0x8865e4,_0xde74ab);_0x1d4a50(_0xde74ab);});});} \ No newline at end of file +var _0x4f1e=['error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4f1e,0x100));var _0xe4f1=function(_0x253a1a,_0x302502){_0x253a1a=_0x253a1a-0x0;var _0x53b485=_0x4f1e[_0x253a1a];return _0x53b485;};'use strict';var _=require(_0xe4f1('0x0'));var util=require(_0xe4f1('0x1'));var moment=require('moment');var BPromise=require(_0xe4f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4f1('0x3'));var db=require(_0xe4f1('0x4'))['db'];var utils=require(_0xe4f1('0x5'));var logger=require(_0xe4f1('0x6'))(_0xe4f1('0x7'));var config=require(_0xe4f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe4f1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43c65a,_0x41b80e,_0x1e6316){return new BPromise(function(_0x226ecf,_0x3badbb){return client[_0xe4f1('0xa')](_0x43c65a,_0x1e6316)['then'](function(_0x215b7e){logger[_0xe4f1('0xb')](_0xe4f1('0xc'),_0x41b80e,'request\x20sent');logger[_0xe4f1('0xd')](_0xe4f1('0xe'),_0x41b80e,_0xe4f1('0xf'),JSON[_0xe4f1('0x10')](_0x215b7e));if(_0x215b7e['error']){if(_0x215b7e[_0xe4f1('0x11')]['code']===0x1f4){logger['error'](_0xe4f1('0xc'),_0x41b80e,_0x215b7e[_0xe4f1('0x11')][_0xe4f1('0x12')]);return _0x3badbb(_0x215b7e[_0xe4f1('0x11')][_0xe4f1('0x12')]);}logger['error'](_0xe4f1('0xc'),_0x41b80e,_0x215b7e[_0xe4f1('0x11')][_0xe4f1('0x12')]);return _0x226ecf(_0x215b7e[_0xe4f1('0x11')]['message']);}else{logger[_0xe4f1('0xb')](_0xe4f1('0xc'),_0x41b80e,_0xe4f1('0xf'));_0x226ecf(_0x215b7e[_0xe4f1('0x13')][_0xe4f1('0x12')]);}})[_0xe4f1('0x14')](function(_0x1d541e){logger[_0xe4f1('0x11')]('DeskField,\x20%s,\x20%s',_0x41b80e,_0x1d541e);_0x3badbb(_0x1d541e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 05cd521..a851280 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 _0x79a9=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put'];(function(_0x143b88,_0x3888bd){var _0x3c095f=function(_0x3dc143){while(--_0x3dc143){_0x143b88['push'](_0x143b88['shift']());}};_0x3c095f(++_0x3888bd);}(_0x79a9,0x120));var _0x979a=function(_0x3dc688,_0x4c604b){_0x3dc688=_0x3dc688-0x0;var _0x26cea2=_0x79a9[_0x3dc688];return _0x26cea2;};'use strict';var multer=require('multer');var util=require(_0x979a('0x0'));var path=require(_0x979a('0x1'));var timeout=require(_0x979a('0x2'));var express=require(_0x979a('0x3'));var router=express[_0x979a('0x4')]();var fs_extra=require(_0x979a('0x5'));var auth=require(_0x979a('0x6'));var interaction=require(_0x979a('0x7'));var config=require('../../config/environment');var controller=require(_0x979a('0x8'));router[_0x979a('0x9')]('/',auth['isAuthenticated'](),controller[_0x979a('0xa')]);router['get'](_0x979a('0xb'),auth[_0x979a('0xc')](),controller[_0x979a('0xd')]);router[_0x979a('0x9')]('/:id/configurations',auth[_0x979a('0xc')](),controller[_0x979a('0xe')]);router[_0x979a('0x9')]('/:id/fields',auth[_0x979a('0xc')](),controller['getFields']);router[_0x979a('0xf')]('/',auth[_0x979a('0xc')](),controller[_0x979a('0x10')]);router[_0x979a('0xf')](_0x979a('0x11'),auth[_0x979a('0xc')](),controller[_0x979a('0x12')]);router[_0x979a('0x13')](_0x979a('0xb'),auth[_0x979a('0xc')](),controller['update']);router[_0x979a('0x14')](_0x979a('0xb'),auth[_0x979a('0xc')](),controller[_0x979a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xda34=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xda34,0x1dc));var _0x4da3=function(_0x3d3f6c,_0x39da52){_0x3d3f6c=_0x3d3f6c-0x0;var _0x4a34c7=_0xda34[_0x3d3f6c];return _0x4a34c7;};'use strict';var multer=require('multer');var util=require(_0x4da3('0x0'));var path=require('path');var timeout=require(_0x4da3('0x1'));var express=require(_0x4da3('0x2'));var router=express[_0x4da3('0x3')]();var fs_extra=require(_0x4da3('0x4'));var auth=require(_0x4da3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4da3('0x6'));router[_0x4da3('0x7')]('/',auth[_0x4da3('0x8')](),controller[_0x4da3('0x9')]);router[_0x4da3('0x7')]('/:id',auth[_0x4da3('0x8')](),controller[_0x4da3('0xa')]);router[_0x4da3('0x7')](_0x4da3('0xb'),auth['isAuthenticated'](),controller[_0x4da3('0xc')]);router[_0x4da3('0x7')](_0x4da3('0xd'),auth['isAuthenticated'](),controller[_0x4da3('0xe')]);router[_0x4da3('0xf')]('/',auth[_0x4da3('0x8')](),controller['create']);router[_0x4da3('0xf')](_0x4da3('0xb'),auth[_0x4da3('0x8')](),controller[_0x4da3('0x10')]);router['put'](_0x4da3('0x11'),auth[_0x4da3('0x8')](),controller[_0x4da3('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4da3('0x13')]);module[_0x4da3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 649b2f7..fe3562b 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 _0x42b0=['sequelize','exports','STRING','BOOLEAN'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x42b0,0xbc));var _0x042b=function(_0x86ca04,_0x77ec8c){_0x86ca04=_0x86ca04-0x0;var _0x3c4a3b=_0x42b0[_0x86ca04];return _0x3c4a3b;};'use strict';var Sequelize=require(_0x042b('0x0'));module[_0x042b('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x042b('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x042b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x042b('0x2')]},'serverUrl':{'type':Sequelize[_0x042b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x042b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x042b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xec46=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5d2734,_0x423a7c){var _0x16de74=function(_0x2dab05){while(--_0x2dab05){_0x5d2734['push'](_0x5d2734['shift']());}};_0x16de74(++_0x423a7c);}(_0xec46,0x19c));var _0x6ec4=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xec46[_0x51bda1];return _0x1ce08c;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')]},'username':{'type':Sequelize[_0x6ec4('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x6ec4('0x2')]},'clientId':{'type':Sequelize[_0x6ec4('0x2')]},'clientSecret':{'type':Sequelize[_0x6ec4('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6ec4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6ec4('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3aa0173..aab0183 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 _0x1b3e=['description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','UserLocalizedLabel','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.','../../components/parsers/qs','api','../../components/integrations/configuration','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','filter','merge','where','options','includeAll','include','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','order','map','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Subjects','slice','lastIndexOf','ticketType','incident','PhoneCall','title'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x1b3e,0x128));var _0xe1b3=function(_0x1d0572,_0x888496){_0x1d0572=_0x1d0572-0x0;var _0x25b576=_0x1b3e[_0x1d0572];return _0x25b576;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var qs=require(_0xe1b3('0x0'));var logger=require('../../config/logger')(_0xe1b3('0x1'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe1b3('0x2'));function respondWithResult(_0x2a334a,_0xcb92e0){_0xcb92e0=_0xcb92e0||0xc8;return function(_0x324877){if(_0x324877){return _0x2a334a['status'](_0xcb92e0)['json'](_0x324877);}};}function respondWithFilteredResult(_0x163170,_0x2d2b89){return function(_0x50f3f8){if(_0x50f3f8){var _0x4650f1=typeof _0x2d2b89[_0xe1b3('0x3')]===_0xe1b3('0x4')&&typeof _0x2d2b89[_0xe1b3('0x5')]===_0xe1b3('0x4');var _0x41e7ee=_0x50f3f8[_0xe1b3('0x6')];var _0x18259c=_0x4650f1?0x0:_0x2d2b89['offset'];var _0x27ad5a=_0x4650f1?_0x50f3f8[_0xe1b3('0x6')]:_0x2d2b89[_0xe1b3('0x3')]+_0x2d2b89[_0xe1b3('0x5')];var _0x3c73f7;if(_0x27ad5a>=_0x41e7ee){_0x27ad5a=_0x41e7ee;_0x3c73f7=0xc8;}else{_0x3c73f7=0xce;}_0x163170[_0xe1b3('0x7')](_0x3c73f7);return _0x163170[_0xe1b3('0x8')](_0xe1b3('0x9'),_0x18259c+'-'+_0x27ad5a+'/'+_0x41e7ee)[_0xe1b3('0xa')](_0x50f3f8);}return null;};}function saveUpdates(_0x110e68){return function(_0x5128e2){if(_0x5128e2){return _0x5128e2[_0xe1b3('0xb')](_0x110e68)[_0xe1b3('0xc')](function(_0x509441){return _0x509441;});}return null;};}function removeEntity(_0x4aeaef){return function(_0x398814){if(_0x398814){return _0x398814[_0xe1b3('0xd')]()[_0xe1b3('0xc')](function(){_0x4aeaef[_0xe1b3('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4403ca){return function(_0x3ecd12){if(!_0x3ecd12){_0x4403ca[_0xe1b3('0xe')](0x194);}return _0x3ecd12;};}function handleError(_0x391a8b,_0x31e063){_0x31e063=_0x31e063||0x1f4;return function(_0x25a2a3){logger[_0xe1b3('0xf')](_0x25a2a3[_0xe1b3('0x10')]);if(_0x25a2a3[_0xe1b3('0x11')]){delete _0x25a2a3[_0xe1b3('0x11')];}_0x391a8b[_0xe1b3('0x7')](_0x31e063)[_0xe1b3('0x12')](_0x25a2a3);};}exports[_0xe1b3('0x13')]=function(_0x399751,_0x40bf7a){var _0x1434df={},_0x33589c={},_0x45cbfc={'count':0x0,'rows':[]};var _0x3a7712=_['map'](db[_0xe1b3('0x14')][_0xe1b3('0x15')],function(_0x2bae47){return{'name':_0x2bae47[_0xe1b3('0x16')],'type':_0x2bae47[_0xe1b3('0x17')]['key']};});_0x33589c[_0xe1b3('0x18')]=_['map'](_0x3a7712,_0xe1b3('0x11'));_0x33589c['query']=_[_0xe1b3('0x19')](_0x399751[_0xe1b3('0x1a')]);_0x33589c[_0xe1b3('0x1b')]=_[_0xe1b3('0x1c')](_0x33589c[_0xe1b3('0x18')],_0x33589c['query']);_0x1434df[_0xe1b3('0x1d')]=_[_0xe1b3('0x1c')](_0x33589c['model'],qs[_0xe1b3('0x1e')](_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x1e')]));_0x1434df[_0xe1b3('0x1d')]=_0x1434df[_0xe1b3('0x1d')]['length']?_0x1434df[_0xe1b3('0x1d')]:_0x33589c[_0xe1b3('0x18')];if(!_0x399751[_0xe1b3('0x1a')]['hasOwnProperty'](_0xe1b3('0x1f'))){_0x1434df[_0xe1b3('0x5')]=qs[_0xe1b3('0x5')](_0x399751['query'][_0xe1b3('0x5')]);_0x1434df['offset']=qs[_0xe1b3('0x3')](_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x3')]);}_0x1434df['order']=qs[_0xe1b3('0x20')](_0x399751[_0xe1b3('0x1a')]['sort']);_0x1434df['where']=qs[_0xe1b3('0x1b')](_['pick'](_0x399751[_0xe1b3('0x1a')],_0x33589c[_0xe1b3('0x1b')]),_0x3a7712);if(_0x399751['query'][_0xe1b3('0x21')]){_0x1434df['where']=_[_0xe1b3('0x22')](_0x1434df[_0xe1b3('0x23')],{'$or':_['map'](_0x3a7712,function(_0x433769){if(_0x433769[_0xe1b3('0x17')]!=='VIRTUAL'){var _0x4cae52={};_0x4cae52[_0x433769[_0xe1b3('0x11')]]={'$like':'%'+_0x399751['query'][_0xe1b3('0x21')]+'%'};return _0x4cae52;}})});}_0x1434df=_[_0xe1b3('0x22')]({},_0x1434df,_0x399751[_0xe1b3('0x24')]);var _0x419b4d={'where':_0x1434df['where']};return db[_0xe1b3('0x14')][_0xe1b3('0x6')](_0x419b4d)[_0xe1b3('0xc')](function(_0x2b4bd5){_0x45cbfc['count']=_0x2b4bd5;if(_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x25')]){_0x1434df[_0xe1b3('0x26')]=[{'all':!![]}];}return db[_0xe1b3('0x14')]['findAll'](_0x1434df);})[_0xe1b3('0xc')](function(_0x589b7a){_0x45cbfc[_0xe1b3('0x27')]=_0x589b7a;return _0x45cbfc;})[_0xe1b3('0xc')](respondWithFilteredResult(_0x40bf7a,_0x1434df))['catch'](handleError(_0x40bf7a,null));};exports[_0xe1b3('0x28')]=function(_0x4fd65a,_0x29762f){var _0x56d626={'raw':![],'where':{'id':_0x4fd65a[_0xe1b3('0x29')]['id']}},_0x3a091f={};_0x3a091f['model']=_[_0xe1b3('0x19')](db['Dynamics365Account'][_0xe1b3('0x15')]);_0x3a091f[_0xe1b3('0x1a')]=_[_0xe1b3('0x19')](_0x4fd65a['query']);_0x3a091f[_0xe1b3('0x1b')]=_['intersection'](_0x3a091f[_0xe1b3('0x18')],_0x3a091f[_0xe1b3('0x1a')]);_0x56d626['attributes']=_[_0xe1b3('0x1c')](_0x3a091f[_0xe1b3('0x18')],qs['fields'](_0x4fd65a[_0xe1b3('0x1a')][_0xe1b3('0x1e')]));_0x56d626[_0xe1b3('0x1d')]=_0x56d626[_0xe1b3('0x1d')][_0xe1b3('0x2a')]?_0x56d626[_0xe1b3('0x1d')]:_0x3a091f[_0xe1b3('0x18')];if(_0x4fd65a[_0xe1b3('0x1a')]['includeAll']){_0x56d626['include']=[{'all':!![]}];}_0x56d626=_['merge']({},_0x56d626,_0x4fd65a[_0xe1b3('0x24')]);return db[_0xe1b3('0x14')][_0xe1b3('0x2b')](_0x56d626)[_0xe1b3('0xc')](handleEntityNotFound(_0x29762f,null))[_0xe1b3('0xc')](respondWithResult(_0x29762f,null))[_0xe1b3('0x2c')](handleError(_0x29762f,null));};exports[_0xe1b3('0x2d')]=function(_0x146591,_0x165306){return db[_0xe1b3('0x14')][_0xe1b3('0x2d')](_0x146591[_0xe1b3('0x2e')],{})[_0xe1b3('0xc')](respondWithResult(_0x165306,0xc9))[_0xe1b3('0x2c')](handleError(_0x165306,null));};exports[_0xe1b3('0xb')]=function(_0x1c75ae,_0x11daa9){if(_0x1c75ae[_0xe1b3('0x2e')]['id']){delete _0x1c75ae[_0xe1b3('0x2e')]['id'];}return db[_0xe1b3('0x14')][_0xe1b3('0x2b')]({'where':{'id':_0x1c75ae['params']['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0x11daa9,null))[_0xe1b3('0xc')](saveUpdates(_0x1c75ae[_0xe1b3('0x2e')],null))[_0xe1b3('0xc')](respondWithResult(_0x11daa9,null))['catch'](handleError(_0x11daa9,null));};exports[_0xe1b3('0xd')]=function(_0x12f02d,_0xa78eb6){return db[_0xe1b3('0x14')][_0xe1b3('0x2b')]({'where':{'id':_0x12f02d[_0xe1b3('0x29')]['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0xa78eb6,null))[_0xe1b3('0xc')](removeEntity(_0xa78eb6,null))[_0xe1b3('0x2c')](handleError(_0xa78eb6,null));};exports[_0xe1b3('0x2f')]=function(_0x4da0b8,_0x293b58){var _0x44303d={};var _0x5d4629={};var _0x667af6;var _0x2e1fc7;return db[_0xe1b3('0x14')][_0xe1b3('0x30')]({'where':{'id':_0x4da0b8[_0xe1b3('0x29')]['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0x293b58,null))[_0xe1b3('0xc')](function(_0x58f143){if(_0x58f143){_0x667af6=_0x58f143;_0x5d4629[_0xe1b3('0x18')]=_[_0xe1b3('0x19')](db['Dynamics365Configuration'][_0xe1b3('0x15')]);_0x5d4629[_0xe1b3('0x1a')]=_['keys'](_0x4da0b8[_0xe1b3('0x1a')]);_0x5d4629[_0xe1b3('0x1b')]=_[_0xe1b3('0x1c')](_0x5d4629[_0xe1b3('0x18')],_0x5d4629[_0xe1b3('0x1a')]);_0x44303d[_0xe1b3('0x1d')]=_[_0xe1b3('0x1c')](_0x5d4629[_0xe1b3('0x18')],qs[_0xe1b3('0x1e')](_0x4da0b8[_0xe1b3('0x1a')]['fields']));_0x44303d['attributes']=_0x44303d['attributes'][_0xe1b3('0x2a')]?_0x44303d[_0xe1b3('0x1d')]:_0x5d4629[_0xe1b3('0x18')];_0x44303d[_0xe1b3('0x31')]=qs[_0xe1b3('0x20')](_0x4da0b8['query']['sort']);_0x44303d[_0xe1b3('0x23')]=qs[_0xe1b3('0x1b')](_['pick'](_0x4da0b8[_0xe1b3('0x1a')],_0x5d4629[_0xe1b3('0x1b')]));if(_0x4da0b8['query'][_0xe1b3('0x21')]){_0x44303d[_0xe1b3('0x23')]=_['merge'](_0x44303d[_0xe1b3('0x23')],{'$or':_[_0xe1b3('0x32')](_0x44303d['attributes'],function(_0x4f9f48){var _0x4b7dcc={};_0x4b7dcc[_0x4f9f48]={'$like':'%'+_0x4da0b8['query'][_0xe1b3('0x21')]+'%'};return _0x4b7dcc;})});}_0x44303d=_['merge']({},_0x44303d,_0x4da0b8[_0xe1b3('0x24')]);return _0x667af6[_0xe1b3('0x2f')](_0x44303d);}})[_0xe1b3('0xc')](function(_0x5ac83b){if(_0x5ac83b){_0x2e1fc7=_0x5ac83b[_0xe1b3('0x2a')];if(!_0x4da0b8[_0xe1b3('0x1a')][_0xe1b3('0x33')](_0xe1b3('0x1f'))){_0x44303d[_0xe1b3('0x5')]=qs[_0xe1b3('0x5')](_0x4da0b8[_0xe1b3('0x1a')][_0xe1b3('0x5')]);_0x44303d[_0xe1b3('0x3')]=qs[_0xe1b3('0x3')](_0x4da0b8[_0xe1b3('0x1a')]['offset']);}return _0x667af6['getConfigurations'](_0x44303d);}})[_0xe1b3('0xc')](function(_0x50e5ef){if(_0x50e5ef){return _0x50e5ef?{'count':_0x2e1fc7,'rows':_0x50e5ef}:null;}})[_0xe1b3('0xc')](respondWithResult(_0x293b58,null))[_0xe1b3('0x2c')](handleError(_0x293b58,null));};exports[_0xe1b3('0x34')]=function(_0x4e042c,_0x2dce4c){if(_0x4e042c[_0xe1b3('0x2e')]['id']){delete _0x4e042c[_0xe1b3('0x2e')]['id'];}return db[_0xe1b3('0x14')][_0xe1b3('0x30')]({'where':{'id':_0x4e042c['params']['id']}})['then'](handleEntityNotFound(_0x2dce4c,null))[_0xe1b3('0xc')](function(_0x1e11cf){if(_0x1e11cf){_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x35')]=_0x1e11cf['id'];_0x4e042c[_0xe1b3('0x2e')]['Subjects']=integrations[_0xe1b3('0x36')](_0x4e042c['body'][_0xe1b3('0x37')],_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x17')]);_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x38')]=integrations[_0xe1b3('0x39')](_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x37')],_0x4e042c[_0xe1b3('0x2e')]['type']);return db[_0xe1b3('0x3a')]['create'](_0x4e042c['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xe1b3('0x3b')},{'model':db['Dynamics365Field'],'as':_0xe1b3('0x38')}]});}return null;})[_0xe1b3('0xc')](respondWithResult(_0x2dce4c,null))[_0xe1b3('0x2c')](handleError(_0x2dce4c,null));};function sanitizeRemoteUri(_0x426fed){var _0x7a82a=_0x426fed[_0xe1b3('0x3c')](-0x1);if(_0x7a82a==='/')return _0x426fed['substring'](0x0,_0x426fed[_0xe1b3('0x3d')](_0x7a82a));return _0x426fed;}function getWebApiUrl(_0x217b09){return util['format']('%s/api/data/v9.0/',_0x217b09);}exports['getFields']=function(_0x5b4116,_0x3e592d){var _0x4ab218=_0x5b4116['query'][_0xe1b3('0x3e')];var _0x36f10a=_0x4ab218===_0xe1b3('0x3f')?'Incident':_0xe1b3('0x40');var _0x38877b='';var _0x4d1925='';var _0x43b323='';var _0x4f00ad='';var _0x1671a6='';var _0x57a608='';var _0x25d85e='';var _0x16dce4='';var _0x1fb97c=[_0xe1b3('0x41'),_0xe1b3('0x42'),_0xe1b3('0x43'),_0xe1b3('0x44'),'caseorigincode',_0xe1b3('0x45'),_0xe1b3('0x46'),_0xe1b3('0x47'),_0xe1b3('0x48'),_0xe1b3('0x49')];var _0x243ff8=[_0xe1b3('0x4a'),_0xe1b3('0x4b'),_0xe1b3('0x4c'),_0xe1b3('0x4d'),_0xe1b3('0x4e'),_0xe1b3('0x4f'),_0xe1b3('0x50'),_0xe1b3('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0xe1b3('0x52'),_0xe1b3('0x53'),_0xe1b3('0x54'),_0xe1b3('0x55'),_0xe1b3('0x56'),'customeridyominame',_0xe1b3('0x57'),_0xe1b3('0x58'),'entityimage_timestamp',_0xe1b3('0x59'),'escalatedon',_0xe1b3('0x5a'),'firstresponsebykpiidname',_0xe1b3('0x5b'),_0xe1b3('0x5c'),_0xe1b3('0x5d'),_0xe1b3('0x5e'),_0xe1b3('0x5f'),_0xe1b3('0x60'),_0xe1b3('0x61'),_0xe1b3('0x62'),_0xe1b3('0x63'),'modifiedbyyominame','modifiedon',_0xe1b3('0x64'),_0xe1b3('0x65'),_0xe1b3('0x66'),_0xe1b3('0x67'),_0xe1b3('0x68'),_0xe1b3('0x69'),'overriddencreatedon',_0xe1b3('0x6a'),_0xe1b3('0x6b'),_0xe1b3('0x6c'),_0xe1b3('0x6d'),'primarycontactidname','primarycontactidyominame',_0xe1b3('0x6e'),_0xe1b3('0x6f'),_0xe1b3('0x70'),'resolveby',_0xe1b3('0x71'),'responseby',_0xe1b3('0x72'),_0xe1b3('0x73'),_0xe1b3('0x74'),'slainvokedidname',_0xe1b3('0x75'),'socialprofileidname',_0xe1b3('0x76'),_0xe1b3('0x77'),_0xe1b3('0x78'),_0xe1b3('0x79'),_0xe1b3('0x7a'),'transactioncurrencyidname',_0xe1b3('0x7b'),_0xe1b3('0x7c'),'versionnumber'];var _0x4c2a65=_0x1fb97c[_0xe1b3('0x7d')](_0x243ff8);return db[_0xe1b3('0x14')]['findOne']({'where':{'id':_0x5b4116[_0xe1b3('0x29')]['id']},'attributes':['id',_0xe1b3('0x7e'),_0xe1b3('0x7f'),_0xe1b3('0x80'),'tenantId',_0xe1b3('0x81'),_0xe1b3('0x82'),_0xe1b3('0x83')],'include':[{'model':db[_0xe1b3('0x84')],'as':_0xe1b3('0x84'),'attributes':['id',_0xe1b3('0x85'),'data7']}]})[_0xe1b3('0xc')](handleEntityNotFound(_0x3e592d,null))[_0xe1b3('0xc')](function(_0x1b57d1){if(_0x1b57d1){if(_0x1b57d1['modernAuthentication']){_0x1b57d1['access_token']=_0x1b57d1[_0xe1b3('0x84')][_0xe1b3('0x85')];_0x16dce4=sanitizeRemoteUri(_0x1b57d1[_0xe1b3('0x84')][_0xe1b3('0x86')]);_0x25d85e=getWebApiUrl(_0x16dce4);return _0x1b57d1;}_0x16dce4=sanitizeRemoteUri(_0x1b57d1[_0xe1b3('0x80')]);_0x25d85e=getWebApiUrl(_0x16dce4);var _0xc8892e={'method':_0xe1b3('0x87'),'uri':'https://login.microsoftonline.com/'+_0x1b57d1[_0xe1b3('0x88')]+_0xe1b3('0x89'),'form':{'client_id':_0x1b57d1[_0xe1b3('0x81')],'resource':_0x16dce4,'username':_0x1b57d1[_0xe1b3('0x7e')],'password':_0x1b57d1[_0xe1b3('0x7f')],'grant_type':'password','client_secret':_0x1b57d1[_0xe1b3('0x82')]},'json':!![]};return rp(_0xc8892e);}})[_0xe1b3('0xc')](function(_0x137c85){_0x57a608=_0x137c85[_0xe1b3('0x8a')];var _0x1ba4c5={'method':_0xe1b3('0x8b'),'uri':encodeURI(_0x25d85e+_0xe1b3('0x8c')+_0x36f10a+'\x27'),'headers':{'Authorization':_0xe1b3('0x8d')+_0x57a608,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x1ba4c5);})[_0xe1b3('0xc')](function(_0x368239){var _0xafffb2=_0x368239['value'][0x0];var _0x302d34=_0xafffb2[_0xe1b3('0x8f')];var _0x259772={'method':_0xe1b3('0x8b'),'uri':_0x25d85e+'EntityDefinitions('+_0x302d34+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe1b3('0x8d')+_0x57a608,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x259772);})['then'](function(_0xbb0a66){_0x38877b=_0xbb0a66;_0x4d1925=_0x38877b[_0xe1b3('0x90')];_0x4d1925=_[_0xe1b3('0x91')](_0x4d1925,function(_0x556939){return!_0x4c2a65['includes'](_0x556939[_0xe1b3('0x92')]);});var _0x3f4621=[];var _0x59af3a=[];_0x4d1925[_0xe1b3('0x93')](function(_0x17881d){if(_0x17881d['@odata.type']){var _0x5a2547=_0x17881d[_0xe1b3('0x94')][_0xe1b3('0x95')](_0x17881d[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x5a2547===_0xe1b3('0x96')){_0x3f4621[_0xe1b3('0x97')](getSelectList(_0x25d85e,_0x4ab218,_0x59af3a,_0x38877b[_0xe1b3('0x8f')],_0x17881d[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0x3f4621);})['then'](function(_0x3bb705){_0x43b323=_0x3bb705[0x0];var _0xd7d2d3=[];var _0x3858fd=[];_0x4d1925[_0xe1b3('0x93')](function(_0x230114){if(!_[_0xe1b3('0x99')](_0x230114[_0xe1b3('0x94')])){var _0x3fa3cd=_0x230114['@odata.type'][_0xe1b3('0x95')](_0x230114[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x3fa3cd===_0xe1b3('0x9a')){_0xd7d2d3[_0xe1b3('0x97')](getBooleanList(_0x25d85e,_0x4ab218,_0x3858fd,_0x38877b['MetadataId'],_0x230114[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0xd7d2d3);})[_0xe1b3('0xc')](function(_0x844639){_0x4f00ad=_0x844639[0x0];var _0x2388a5=[];var _0x184733=[];_0x4d1925[_0xe1b3('0x93')](function(_0x41fcbd){if(_0x41fcbd[_0xe1b3('0x94')]){var _0x2f6fd4=_0x41fcbd[_0xe1b3('0x94')][_0xe1b3('0x95')](_0x41fcbd[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x2f6fd4===_0xe1b3('0x9b')||_0x2f6fd4===_0xe1b3('0x9c')||_0x2f6fd4==='BigIntAttributeMetadata'||_0x2f6fd4===_0xe1b3('0x9d')||_0x2f6fd4===_0xe1b3('0x9e')||_0x2f6fd4===_0xe1b3('0x9f')||_0x2f6fd4==='StatusAttributeMetadata'||_0x2f6fd4===_0xe1b3('0xa0')||_0x2f6fd4===_0xe1b3('0xa1')||_0x2f6fd4===_0xe1b3('0xa2')){_0x2388a5[_0xe1b3('0x97')](getInputList(_0x25d85e,_0x4ab218,_0x2f6fd4,_0x184733,_0x38877b['MetadataId'],_0x41fcbd[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0x2388a5);})[_0xe1b3('0xc')](function(_0x160e76){_0x1671a6=_0x160e76[0x0];var _0x481edf=_0x43b323['concat'](_0x4f00ad)[_0xe1b3('0x7d')](_0x1671a6);var _0x42e3dd={'count':_0x481edf[_0xe1b3('0x2a')],'rows':_0x481edf};return _0x42e3dd;})[_0xe1b3('0xc')](respondWithResult(_0x3e592d,null))[_0xe1b3('0x2c')](function(_0x42460c){var _0x391326=_0x5b4116['query']['test']?0x1f4:_0x42460c['statusCode']||0x1f4;logger[_0xe1b3('0xf')](_0x42460c[_0xe1b3('0x10')]);delete _0x42460c[_0xe1b3('0x11')];if(_0x391326===0x191){_0x391326=0x190;}_0x3e592d[_0xe1b3('0x7')](_0x391326)['send'](_0x5b4116[_0xe1b3('0x1a')][_0xe1b3('0xa3')]?{'message':_0xe1b3('0xa4'),'statusCode':_0x42460c[_0xe1b3('0xa5')]}:_0x42460c);});};function getSelectList(_0x27a8b1,_0x16b576,_0x1ec0b2,_0xda711b,_0x4ceb07,_0x1d1fc9){var _0x2a993f={'method':_0xe1b3('0x8b'),'uri':_0x27a8b1+'EntityDefinitions('+_0xda711b+')/Attributes('+_0x4ceb07+_0xe1b3('0xa6')+_0xe1b3('0xa7'),'headers':{'Authorization':'Bearer\x20'+_0x1d1fc9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a993f)['then'](function(_0x34de0a){var _0xa52a4c=[];var _0x314f9b=_0x34de0a['OptionSet'][_0xe1b3('0xa8')];_0x314f9b[_0xe1b3('0x93')](function(_0x481947){_0xa52a4c[_0xe1b3('0x97')]({'name':_0x481947[_0xe1b3('0xa9')]['UserLocalizedLabel'][_0xe1b3('0xa9')],'value':String(_0x481947[_0xe1b3('0xaa')])});});var _0x2d47f0={'id':_0x16b576+'_'+_0x34de0a[_0xe1b3('0x92')],'name':_0x34de0a['DisplayName'][_0xe1b3('0xab')][_0xe1b3('0xa9')],'custom':![],'options':_0xa52a4c};_0x1ec0b2['push'](_0x2d47f0);return _0x1ec0b2;});}function getBooleanList(_0x2631e9,_0xf6e6,_0x1791ab,_0x5e6d93,_0x3b1729,_0x26dcb6){var _0x3daddf={'method':'GET','uri':_0x2631e9+_0xe1b3('0xac')+_0x5e6d93+')/Attributes('+_0x3b1729+_0xe1b3('0xad'),'headers':{'Authorization':'Bearer\x20'+_0x26dcb6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3daddf)[_0xe1b3('0xc')](function(_0x31ff3c){var _0x35d019=[];_0x35d019[_0xe1b3('0x97')]({'name':_0x31ff3c[_0xe1b3('0xae')][_0xe1b3('0xaf')][_0xe1b3('0xa9')]['UserLocalizedLabel']['Label'],'value':_0xe1b3('0xb0')},{'name':_0x31ff3c[_0xe1b3('0xae')][_0xe1b3('0xb1')][_0xe1b3('0xa9')][_0xe1b3('0xab')]['Label'],'value':'false'});var _0x14b358={'id':_0xf6e6+'_'+_0x31ff3c[_0xe1b3('0x92')],'name':_0x31ff3c[_0xe1b3('0xb2')][_0xe1b3('0xab')][_0xe1b3('0xa9')],'custom':![],'options':_0x35d019};_0x1791ab[_0xe1b3('0x97')](_0x14b358);return _0x1791ab;});}function getInputList(_0x5bc91e,_0x244db8,_0x526fbe,_0x292089,_0x351d5e,_0x50bafc,_0x27f57b){var _0x57bc67={'method':_0xe1b3('0x8b'),'uri':_0x5bc91e+_0xe1b3('0xac')+_0x351d5e+_0xe1b3('0xb3')+_0x50bafc+_0xe1b3('0xb4')+_0x526fbe+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xe1b3('0x8d')+_0x27f57b,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x57bc67)[_0xe1b3('0xc')](function(_0x467c22){var _0x592b4b={'id':_0x244db8+'_'+_0x467c22[_0xe1b3('0x92')],'name':_0x467c22[_0xe1b3('0xb2')][_0xe1b3('0xab')]?_0x467c22[_0xe1b3('0xb2')]['UserLocalizedLabel'][_0xe1b3('0xa9')]:_0x467c22[_0xe1b3('0x92')],'custom':![],'options':[]};_0x292089[_0xe1b3('0x97')](_0x592b4b);return _0x292089;});} \ No newline at end of file +var _0x23ca=['ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/','/oauth2/token','username','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','LogicalName','forEach','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','request-promise','lodash','../../config/logger','api','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','catch','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','ticketType','incident','Incident','PhoneCall','title','description'];(function(_0x198b63,_0x2fa09d){var _0x43544b=function(_0x314506){while(--_0x314506){_0x198b63['push'](_0x198b63['shift']());}};_0x43544b(++_0x2fa09d);}(_0x23ca,0x130));var _0xa23c=function(_0x4bf559,_0x3fb379){_0x4bf559=_0x4bf559-0x0;var _0x208dc9=_0x23ca[_0x4bf559];return _0x208dc9;};'use strict';var rp=require(_0xa23c('0x0'));var util=require('util');var _=require(_0xa23c('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa23c('0x2'))(_0xa23c('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa23c('0x4'));function respondWithResult(_0xb77c9c,_0x5bc2ea){_0x5bc2ea=_0x5bc2ea||0xc8;return function(_0x1ecb18){if(_0x1ecb18){return _0xb77c9c[_0xa23c('0x5')](_0x5bc2ea)['json'](_0x1ecb18);}};}function respondWithFilteredResult(_0x5ce02a,_0x16f1c2){return function(_0x36886e){if(_0x36886e){var _0x395993=typeof _0x16f1c2[_0xa23c('0x6')]==='undefined'&&typeof _0x16f1c2['limit']===_0xa23c('0x7');var _0x1609fa=_0x36886e[_0xa23c('0x8')];var _0x3a1c92=_0x395993?0x0:_0x16f1c2[_0xa23c('0x6')];var _0x126207=_0x395993?_0x36886e[_0xa23c('0x8')]:_0x16f1c2[_0xa23c('0x6')]+_0x16f1c2[_0xa23c('0x9')];var _0x1069f1;if(_0x126207>=_0x1609fa){_0x126207=_0x1609fa;_0x1069f1=0xc8;}else{_0x1069f1=0xce;}_0x5ce02a['status'](_0x1069f1);return _0x5ce02a[_0xa23c('0xa')](_0xa23c('0xb'),_0x3a1c92+'-'+_0x126207+'/'+_0x1609fa)['json'](_0x36886e);}return null;};}function saveUpdates(_0x5c8059){return function(_0x4489c7){if(_0x4489c7){return _0x4489c7[_0xa23c('0xc')](_0x5c8059)[_0xa23c('0xd')](function(_0xb84006){return _0xb84006;});}return null;};}function removeEntity(_0x55832a){return function(_0x464fb2){if(_0x464fb2){return _0x464fb2[_0xa23c('0xe')]()[_0xa23c('0xd')](function(){_0x55832a[_0xa23c('0x5')](0xcc)[_0xa23c('0xf')]();});}};}function handleEntityNotFound(_0xb91e52){return function(_0x56cd2d){if(!_0x56cd2d){_0xb91e52[_0xa23c('0x10')](0x194);}return _0x56cd2d;};}function handleError(_0x380a9a,_0x389a54){_0x389a54=_0x389a54||0x1f4;return function(_0xb357bf){logger[_0xa23c('0x11')](_0xb357bf[_0xa23c('0x12')]);if(_0xb357bf[_0xa23c('0x13')]){delete _0xb357bf['name'];}_0x380a9a[_0xa23c('0x5')](_0x389a54)[_0xa23c('0x14')](_0xb357bf);};}exports[_0xa23c('0x15')]=function(_0x464001,_0x25d80c){var _0x54f7e6={},_0x3bd01d={},_0x58be26={'count':0x0,'rows':[]};var _0x4e6111=_[_0xa23c('0x16')](db[_0xa23c('0x17')][_0xa23c('0x18')],function(_0x54537d){return{'name':_0x54537d[_0xa23c('0x19')],'type':_0x54537d[_0xa23c('0x1a')][_0xa23c('0x1b')]};});_0x3bd01d[_0xa23c('0x1c')]=_[_0xa23c('0x16')](_0x4e6111,_0xa23c('0x13'));_0x3bd01d['query']=_['keys'](_0x464001[_0xa23c('0x1d')]);_0x3bd01d[_0xa23c('0x1e')]=_[_0xa23c('0x1f')](_0x3bd01d[_0xa23c('0x1c')],_0x3bd01d['query']);_0x54f7e6[_0xa23c('0x20')]=_[_0xa23c('0x1f')](_0x3bd01d['model'],qs[_0xa23c('0x21')](_0x464001['query']['fields']));_0x54f7e6[_0xa23c('0x20')]=_0x54f7e6[_0xa23c('0x20')][_0xa23c('0x22')]?_0x54f7e6[_0xa23c('0x20')]:_0x3bd01d[_0xa23c('0x1c')];if(!_0x464001[_0xa23c('0x1d')][_0xa23c('0x23')]('nolimit')){_0x54f7e6['limit']=qs[_0xa23c('0x9')](_0x464001[_0xa23c('0x1d')][_0xa23c('0x9')]);_0x54f7e6[_0xa23c('0x6')]=qs[_0xa23c('0x6')](_0x464001[_0xa23c('0x1d')][_0xa23c('0x6')]);}_0x54f7e6[_0xa23c('0x24')]=qs[_0xa23c('0x25')](_0x464001[_0xa23c('0x1d')][_0xa23c('0x25')]);_0x54f7e6[_0xa23c('0x26')]=qs[_0xa23c('0x1e')](_[_0xa23c('0x27')](_0x464001['query'],_0x3bd01d[_0xa23c('0x1e')]),_0x4e6111);if(_0x464001[_0xa23c('0x1d')]['filter']){_0x54f7e6[_0xa23c('0x26')]=_['merge'](_0x54f7e6[_0xa23c('0x26')],{'$or':_['map'](_0x4e6111,function(_0x3306ff){if(_0x3306ff['type']!==_0xa23c('0x28')){var _0x298406={};_0x298406[_0x3306ff[_0xa23c('0x13')]]={'$like':'%'+_0x464001[_0xa23c('0x1d')][_0xa23c('0x29')]+'%'};return _0x298406;}})});}_0x54f7e6=_[_0xa23c('0x2a')]({},_0x54f7e6,_0x464001[_0xa23c('0x2b')]);var _0x46cfc4={'where':_0x54f7e6[_0xa23c('0x26')]};return db[_0xa23c('0x17')][_0xa23c('0x8')](_0x46cfc4)[_0xa23c('0xd')](function(_0x6f2fbc){_0x58be26['count']=_0x6f2fbc;if(_0x464001[_0xa23c('0x1d')][_0xa23c('0x2c')]){_0x54f7e6[_0xa23c('0x2d')]=[{'all':!![]}];}return db[_0xa23c('0x17')][_0xa23c('0x2e')](_0x54f7e6);})[_0xa23c('0xd')](function(_0x34ba40){_0x58be26[_0xa23c('0x2f')]=_0x34ba40;return _0x58be26;})[_0xa23c('0xd')](respondWithFilteredResult(_0x25d80c,_0x54f7e6))['catch'](handleError(_0x25d80c,null));};exports['show']=function(_0x1ea24e,_0x544876){var _0x4a0d8a={'raw':![],'where':{'id':_0x1ea24e[_0xa23c('0x30')]['id']}},_0xeadfb1={};_0xeadfb1[_0xa23c('0x1c')]=_[_0xa23c('0x31')](db[_0xa23c('0x17')][_0xa23c('0x18')]);_0xeadfb1[_0xa23c('0x1d')]=_[_0xa23c('0x31')](_0x1ea24e['query']);_0xeadfb1['filters']=_['intersection'](_0xeadfb1[_0xa23c('0x1c')],_0xeadfb1[_0xa23c('0x1d')]);_0x4a0d8a[_0xa23c('0x20')]=_[_0xa23c('0x1f')](_0xeadfb1[_0xa23c('0x1c')],qs['fields'](_0x1ea24e['query'][_0xa23c('0x21')]));_0x4a0d8a[_0xa23c('0x20')]=_0x4a0d8a[_0xa23c('0x20')]['length']?_0x4a0d8a[_0xa23c('0x20')]:_0xeadfb1['model'];if(_0x1ea24e[_0xa23c('0x1d')][_0xa23c('0x2c')]){_0x4a0d8a[_0xa23c('0x2d')]=[{'all':!![]}];}_0x4a0d8a=_['merge']({},_0x4a0d8a,_0x1ea24e['options']);return db[_0xa23c('0x17')][_0xa23c('0x32')](_0x4a0d8a)[_0xa23c('0xd')](handleEntityNotFound(_0x544876,null))[_0xa23c('0xd')](respondWithResult(_0x544876,null))['catch'](handleError(_0x544876,null));};exports[_0xa23c('0x33')]=function(_0x508c32,_0x3bb0ec){return db[_0xa23c('0x17')]['create'](_0x508c32[_0xa23c('0x34')],{})[_0xa23c('0xd')](respondWithResult(_0x3bb0ec,0xc9))[_0xa23c('0x35')](handleError(_0x3bb0ec,null));};exports[_0xa23c('0xc')]=function(_0x29b10e,_0x1484fb){if(_0x29b10e['body']['id']){delete _0x29b10e[_0xa23c('0x34')]['id'];}return db[_0xa23c('0x17')][_0xa23c('0x32')]({'where':{'id':_0x29b10e['params']['id']}})[_0xa23c('0xd')](handleEntityNotFound(_0x1484fb,null))[_0xa23c('0xd')](saveUpdates(_0x29b10e['body'],null))['then'](respondWithResult(_0x1484fb,null))['catch'](handleError(_0x1484fb,null));};exports['destroy']=function(_0x146161,_0x12ef18){return db[_0xa23c('0x17')][_0xa23c('0x32')]({'where':{'id':_0x146161['params']['id']}})[_0xa23c('0xd')](handleEntityNotFound(_0x12ef18,null))[_0xa23c('0xd')](removeEntity(_0x12ef18,null))[_0xa23c('0x35')](handleError(_0x12ef18,null));};exports['getConfigurations']=function(_0x4bd2ed,_0x4dc475){var _0x5a2483={};var _0x249681={};var _0x265f7f;var _0xed894f;return db[_0xa23c('0x17')][_0xa23c('0x36')]({'where':{'id':_0x4bd2ed[_0xa23c('0x30')]['id']}})[_0xa23c('0xd')](handleEntityNotFound(_0x4dc475,null))['then'](function(_0x165e6a){if(_0x165e6a){_0x265f7f=_0x165e6a;_0x249681[_0xa23c('0x1c')]=_[_0xa23c('0x31')](db[_0xa23c('0x37')]['rawAttributes']);_0x249681['query']=_[_0xa23c('0x31')](_0x4bd2ed[_0xa23c('0x1d')]);_0x249681['filters']=_[_0xa23c('0x1f')](_0x249681[_0xa23c('0x1c')],_0x249681['query']);_0x5a2483['attributes']=_[_0xa23c('0x1f')](_0x249681['model'],qs[_0xa23c('0x21')](_0x4bd2ed['query'][_0xa23c('0x21')]));_0x5a2483['attributes']=_0x5a2483[_0xa23c('0x20')]['length']?_0x5a2483[_0xa23c('0x20')]:_0x249681[_0xa23c('0x1c')];_0x5a2483[_0xa23c('0x24')]=qs[_0xa23c('0x25')](_0x4bd2ed[_0xa23c('0x1d')][_0xa23c('0x25')]);_0x5a2483['where']=qs[_0xa23c('0x1e')](_[_0xa23c('0x27')](_0x4bd2ed[_0xa23c('0x1d')],_0x249681[_0xa23c('0x1e')]));if(_0x4bd2ed[_0xa23c('0x1d')][_0xa23c('0x29')]){_0x5a2483[_0xa23c('0x26')]=_[_0xa23c('0x2a')](_0x5a2483[_0xa23c('0x26')],{'$or':_[_0xa23c('0x16')](_0x5a2483['attributes'],function(_0x5380ff){var _0x575062={};_0x575062[_0x5380ff]={'$like':'%'+_0x4bd2ed[_0xa23c('0x1d')]['filter']+'%'};return _0x575062;})});}_0x5a2483=_[_0xa23c('0x2a')]({},_0x5a2483,_0x4bd2ed['options']);return _0x265f7f['getConfigurations'](_0x5a2483);}})[_0xa23c('0xd')](function(_0x136af3){if(_0x136af3){_0xed894f=_0x136af3[_0xa23c('0x22')];if(!_0x4bd2ed[_0xa23c('0x1d')][_0xa23c('0x23')](_0xa23c('0x38'))){_0x5a2483['limit']=qs[_0xa23c('0x9')](_0x4bd2ed[_0xa23c('0x1d')]['limit']);_0x5a2483['offset']=qs[_0xa23c('0x6')](_0x4bd2ed['query']['offset']);}return _0x265f7f['getConfigurations'](_0x5a2483);}})['then'](function(_0x30b539){if(_0x30b539){return _0x30b539?{'count':_0xed894f,'rows':_0x30b539}:null;}})['then'](respondWithResult(_0x4dc475,null))[_0xa23c('0x35')](handleError(_0x4dc475,null));};exports[_0xa23c('0x39')]=function(_0xb07ada,_0x14a41a){if(_0xb07ada[_0xa23c('0x34')]['id']){delete _0xb07ada[_0xa23c('0x34')]['id'];}return db['Dynamics365Account'][_0xa23c('0x36')]({'where':{'id':_0xb07ada[_0xa23c('0x30')]['id']}})['then'](handleEntityNotFound(_0x14a41a,null))[_0xa23c('0xd')](function(_0x3724f4){if(_0x3724f4){_0xb07ada[_0xa23c('0x34')][_0xa23c('0x3a')]=_0x3724f4['id'];_0xb07ada[_0xa23c('0x34')][_0xa23c('0x3b')]=integrations[_0xa23c('0x3c')](_0xb07ada[_0xa23c('0x34')][_0xa23c('0x3d')],_0xb07ada[_0xa23c('0x34')][_0xa23c('0x1a')]);_0xb07ada[_0xa23c('0x34')][_0xa23c('0x3e')]=integrations[_0xa23c('0x3f')](_0xb07ada[_0xa23c('0x34')][_0xa23c('0x3d')],_0xb07ada['body'][_0xa23c('0x1a')]);return db[_0xa23c('0x37')][_0xa23c('0x33')](_0xb07ada['body'],{'include':[{'model':db[_0xa23c('0x40')],'as':_0xa23c('0x3b')},{'model':db[_0xa23c('0x40')],'as':_0xa23c('0x3e')}]});}return null;})[_0xa23c('0xd')](respondWithResult(_0x14a41a,null))[_0xa23c('0x35')](handleError(_0x14a41a,null));};function sanitizeRemoteUri(_0x233d0e){var _0x23d639=_0x233d0e[_0xa23c('0x41')](-0x1);if(_0x23d639==='/')return _0x233d0e['substring'](0x0,_0x233d0e['lastIndexOf'](_0x23d639));return _0x233d0e;}function getWebApiUrl(_0x1547be){return util['format']('%s/api/data/v9.0/',_0x1547be);}exports['getFields']=function(_0x2247a5,_0x1af724){var _0x5be495=_0x2247a5[_0xa23c('0x1d')][_0xa23c('0x42')];var _0x5caed1=_0x5be495===_0xa23c('0x43')?_0xa23c('0x44'):_0xa23c('0x45');var _0x3439ef='';var _0x3a0430='';var _0xbce28='';var _0x2d1197='';var _0xe5d193='';var _0xb400e5='';var _0x163ed3='';var _0x324aef='';var _0x13e6c0=[_0xa23c('0x46'),_0xa23c('0x47'),'customerid',_0xa23c('0x48'),_0xa23c('0x49'),'subject',_0xa23c('0x4a'),_0xa23c('0x4b'),_0xa23c('0x4c'),_0xa23c('0x4d')];var _0x9667ba=[_0xa23c('0x4e'),_0xa23c('0x4f'),'actualserviceunits',_0xa23c('0x50'),_0xa23c('0x51'),_0xa23c('0x52'),_0xa23c('0x53'),_0xa23c('0x54'),_0xa23c('0x55'),_0xa23c('0x56'),_0xa23c('0x57'),_0xa23c('0x58'),'createdon','createdonbehalfbyname',_0xa23c('0x59'),_0xa23c('0x5a'),'customeridtype','customeridyominame',_0xa23c('0x5b'),'entitlementidname','entityimage_timestamp',_0xa23c('0x5c'),_0xa23c('0x5d'),_0xa23c('0x5e'),_0xa23c('0x5f'),'followupby',_0xa23c('0x60'),'influencescore',_0xa23c('0x61'),_0xa23c('0x62'),_0xa23c('0x63'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xa23c('0x64'),_0xa23c('0x65'),_0xa23c('0x66'),_0xa23c('0x67'),_0xa23c('0x68'),'msdyn_incidenttypename',_0xa23c('0x69'),_0xa23c('0x6a'),'onholdtime',_0xa23c('0x6b'),_0xa23c('0x6c'),_0xa23c('0x6d'),_0xa23c('0x6e'),'parentcaseidname',_0xa23c('0x6f'),_0xa23c('0x70'),'prioritycodename',_0xa23c('0x71'),_0xa23c('0x72'),_0xa23c('0x73'),_0xa23c('0x74'),_0xa23c('0x75'),_0xa23c('0x76'),_0xa23c('0x77'),'sentimentvalue','slainvokedidname',_0xa23c('0x78'),_0xa23c('0x79'),_0xa23c('0x7a'),_0xa23c('0x7b'),_0xa23c('0x7c'),_0xa23c('0x7d'),'timezoneruleversionnumber',_0xa23c('0x7e'),_0xa23c('0x7f'),'utcconversiontimezonecode',_0xa23c('0x80')];var _0x5db907=_0x13e6c0[_0xa23c('0x81')](_0x9667ba);return db[_0xa23c('0x17')]['findOne']({'where':{'id':_0x2247a5[_0xa23c('0x30')]['id']},'attributes':['id','username',_0xa23c('0x82'),_0xa23c('0x83'),_0xa23c('0x84'),_0xa23c('0x85'),_0xa23c('0x86'),_0xa23c('0x87')],'include':[{'model':db['CloudProvider'],'as':_0xa23c('0x88'),'attributes':['id','data5',_0xa23c('0x89')]}]})[_0xa23c('0xd')](handleEntityNotFound(_0x1af724,null))[_0xa23c('0xd')](function(_0x139970){if(_0x139970){if(_0x139970[_0xa23c('0x87')]){_0x139970['access_token']=_0x139970[_0xa23c('0x88')][_0xa23c('0x8a')];_0x324aef=sanitizeRemoteUri(_0x139970[_0xa23c('0x88')][_0xa23c('0x89')]);_0x163ed3=getWebApiUrl(_0x324aef);return _0x139970;}_0x324aef=sanitizeRemoteUri(_0x139970[_0xa23c('0x83')]);_0x163ed3=getWebApiUrl(_0x324aef);var _0x1afeed={'method':_0xa23c('0x8b'),'uri':_0xa23c('0x8c')+_0x139970['tenantId']+_0xa23c('0x8d'),'form':{'client_id':_0x139970[_0xa23c('0x85')],'resource':_0x324aef,'username':_0x139970[_0xa23c('0x8e')],'password':_0x139970[_0xa23c('0x82')],'grant_type':_0xa23c('0x82'),'client_secret':_0x139970[_0xa23c('0x86')]},'json':!![]};return rp(_0x1afeed);}})[_0xa23c('0xd')](function(_0x52b053){_0xb400e5=_0x52b053[_0xa23c('0x8f')];var _0x3ca027={'method':'GET','uri':encodeURI(_0x163ed3+_0xa23c('0x90')+_0x5caed1+'\x27'),'headers':{'Authorization':_0xa23c('0x91')+_0xb400e5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ca027);})[_0xa23c('0xd')](function(_0x206dfe){var _0x2c3568=_0x206dfe[_0xa23c('0x92')][0x0];var _0x301ef9=_0x2c3568[_0xa23c('0x93')];var _0x14de9a={'method':_0xa23c('0x94'),'uri':_0x163ed3+'EntityDefinitions('+_0x301ef9+_0xa23c('0x95'),'headers':{'Authorization':_0xa23c('0x91')+_0xb400e5,'If-None-Match':null,'OData-Version':_0xa23c('0x96')},'json':!![]};return rp(_0x14de9a);})['then'](function(_0x463255){_0x3439ef=_0x463255;_0x3a0430=_0x3439ef[_0xa23c('0x97')];_0x3a0430=_[_0xa23c('0x98')](_0x3a0430,function(_0x140b0b){return!_0x5db907['includes'](_0x140b0b[_0xa23c('0x99')]);});var _0x2c7c56=[];var _0x3da508=[];_0x3a0430[_0xa23c('0x9a')](function(_0x167ae9){if(_0x167ae9['@odata.type']){var _0x41768d=_0x167ae9[_0xa23c('0x9b')][_0xa23c('0x9c')](_0x167ae9[_0xa23c('0x9b')][_0xa23c('0x9d')]('.')+0x1);if(_0x41768d===_0xa23c('0x9e')){_0x2c7c56[_0xa23c('0x9f')](getSelectList(_0x163ed3,_0x5be495,_0x3da508,_0x3439ef[_0xa23c('0x93')],_0x167ae9[_0xa23c('0x93')],_0xb400e5));}}});return Promise[_0xa23c('0xa0')](_0x2c7c56);})[_0xa23c('0xd')](function(_0x14bcba){_0xbce28=_0x14bcba[0x0];var _0x1ffce5=[];var _0x21b51a=[];_0x3a0430[_0xa23c('0x9a')](function(_0x5e9e6f){if(!_[_0xa23c('0xa1')](_0x5e9e6f['@odata.type'])){var _0x40463b=_0x5e9e6f[_0xa23c('0x9b')][_0xa23c('0x9c')](_0x5e9e6f[_0xa23c('0x9b')][_0xa23c('0x9d')]('.')+0x1);if(_0x40463b===_0xa23c('0xa2')){_0x1ffce5[_0xa23c('0x9f')](getBooleanList(_0x163ed3,_0x5be495,_0x21b51a,_0x3439ef['MetadataId'],_0x5e9e6f[_0xa23c('0x93')],_0xb400e5));}}});return Promise[_0xa23c('0xa0')](_0x1ffce5);})[_0xa23c('0xd')](function(_0x25ef40){_0x2d1197=_0x25ef40[0x0];var _0x1044bb=[];var _0x34c92e=[];_0x3a0430[_0xa23c('0x9a')](function(_0xa037e7){if(_0xa037e7[_0xa23c('0x9b')]){var _0x3274be=_0xa037e7[_0xa23c('0x9b')][_0xa23c('0x9c')](_0xa037e7[_0xa23c('0x9b')][_0xa23c('0x9d')]('.')+0x1);if(_0x3274be===_0xa23c('0xa3')||_0x3274be==='DoubleAttributeMetadata'||_0x3274be===_0xa23c('0xa4')||_0x3274be===_0xa23c('0xa5')||_0x3274be===_0xa23c('0xa6')||_0x3274be===_0xa23c('0xa7')||_0x3274be===_0xa23c('0xa8')||_0x3274be===_0xa23c('0xa9')||_0x3274be===_0xa23c('0xaa')||_0x3274be===_0xa23c('0xab')){_0x1044bb[_0xa23c('0x9f')](getInputList(_0x163ed3,_0x5be495,_0x3274be,_0x34c92e,_0x3439ef[_0xa23c('0x93')],_0xa037e7[_0xa23c('0x93')],_0xb400e5));}}});return Promise[_0xa23c('0xa0')](_0x1044bb);})['then'](function(_0x32ae73){_0xe5d193=_0x32ae73[0x0];var _0x346043=_0xbce28[_0xa23c('0x81')](_0x2d1197)[_0xa23c('0x81')](_0xe5d193);var _0x67c65c={'count':_0x346043[_0xa23c('0x22')],'rows':_0x346043};return _0x67c65c;})[_0xa23c('0xd')](respondWithResult(_0x1af724,null))[_0xa23c('0x35')](function(_0x20431b){var _0x3cbb21=_0x2247a5[_0xa23c('0x1d')][_0xa23c('0xac')]?0x1f4:_0x20431b[_0xa23c('0xad')]||0x1f4;logger[_0xa23c('0x11')](_0x20431b[_0xa23c('0x12')]);delete _0x20431b[_0xa23c('0x13')];if(_0x3cbb21===0x191){_0x3cbb21=0x190;}_0x1af724[_0xa23c('0x5')](_0x3cbb21)[_0xa23c('0x14')](_0x2247a5[_0xa23c('0x1d')][_0xa23c('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x20431b[_0xa23c('0xad')]}:_0x20431b);});};function getSelectList(_0x5db07e,_0x3971e5,_0x2be08c,_0x37da57,_0xffd7b7,_0x2dd860){var _0x53181e={'method':_0xa23c('0x94'),'uri':_0x5db07e+_0xa23c('0xae')+_0x37da57+_0xa23c('0xaf')+_0xffd7b7+_0xa23c('0xb0')+_0xa23c('0xb1'),'headers':{'Authorization':_0xa23c('0x91')+_0x2dd860,'If-None-Match':null,'OData-Version':_0xa23c('0x96')},'json':!![]};return rp(_0x53181e)['then'](function(_0x35aede){var _0x5b6b8d=[];var _0x1e08b3=_0x35aede[_0xa23c('0xb2')][_0xa23c('0xb3')];_0x1e08b3[_0xa23c('0x9a')](function(_0x393ac6){_0x5b6b8d[_0xa23c('0x9f')]({'name':_0x393ac6[_0xa23c('0xb4')][_0xa23c('0xb5')][_0xa23c('0xb4')],'value':String(_0x393ac6[_0xa23c('0xb6')])});});var _0x25d662={'id':_0x3971e5+'_'+_0x35aede[_0xa23c('0x99')],'name':_0x35aede[_0xa23c('0xb7')][_0xa23c('0xb5')][_0xa23c('0xb4')],'custom':![],'options':_0x5b6b8d};_0x2be08c['push'](_0x25d662);return _0x2be08c;});}function getBooleanList(_0x1d2f2f,_0x44f704,_0x52f96b,_0x3f9ffe,_0x3075db,_0xd86bc1){var _0x344823={'method':'GET','uri':_0x1d2f2f+_0xa23c('0xae')+_0x3f9ffe+_0xa23c('0xaf')+_0x3075db+_0xa23c('0xb8'),'headers':{'Authorization':_0xa23c('0x91')+_0xd86bc1,'If-None-Match':null,'OData-Version':_0xa23c('0x96')},'json':!![]};return rp(_0x344823)[_0xa23c('0xd')](function(_0x3add84){var _0x794c46=[];_0x794c46[_0xa23c('0x9f')]({'name':_0x3add84[_0xa23c('0xb2')][_0xa23c('0xb9')][_0xa23c('0xb4')][_0xa23c('0xb5')]['Label'],'value':_0xa23c('0xba')},{'name':_0x3add84[_0xa23c('0xb2')][_0xa23c('0xbb')][_0xa23c('0xb4')][_0xa23c('0xb5')][_0xa23c('0xb4')],'value':'false'});var _0x24eada={'id':_0x44f704+'_'+_0x3add84[_0xa23c('0x99')],'name':_0x3add84[_0xa23c('0xb7')][_0xa23c('0xb5')][_0xa23c('0xb4')],'custom':![],'options':_0x794c46};_0x52f96b[_0xa23c('0x9f')](_0x24eada);return _0x52f96b;});}function getInputList(_0x37bea5,_0x3f91de,_0x35466e,_0xe23305,_0x5ad931,_0x1dc7e4,_0x44f828){var _0x444e2c={'method':'GET','uri':_0x37bea5+_0xa23c('0xae')+_0x5ad931+_0xa23c('0xaf')+_0x1dc7e4+')/Microsoft.Dynamics.CRM.'+_0x35466e+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa23c('0x91')+_0x44f828,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x444e2c)['then'](function(_0x512911){var _0x5f16c6={'id':_0x3f91de+'_'+_0x512911[_0xa23c('0x99')],'name':_0x512911[_0xa23c('0xb7')][_0xa23c('0xb5')]?_0x512911[_0xa23c('0xb7')]['UserLocalizedLabel'][_0xa23c('0xb4')]:_0x512911[_0xa23c('0x99')],'custom':![],'options':[]};_0xe23305[_0xa23c('0x9f')](_0x5f16c6);return _0xe23305;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e47d73f..84199fc 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x51f963,_0x419a3b){var _0x31ed94=function(_0x49f923){while(--_0x49f923){_0x51f963['push'](_0x51f963['shift']());}};_0x31ed94(++_0x419a3b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0xd698e3,_0x2352d2){var _0x48a8e8=function(_0x3cc120){while(--_0x3cc120){_0xd698e3['push'](_0xd698e3['shift']());}};_0x48a8e8(++_0x2352d2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 78a594f..394bd41 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 _0x1727=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','map','model','attributes','ShowDynamics365Account','find','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1727,0x172));var _0x7172=function(_0x137fab,_0x2900ed){_0x137fab=_0x137fab-0x0;var _0x128d08=_0x1727[_0x137fab];return _0x128d08;};'use strict';var _=require(_0x7172('0x0'));var util=require(_0x7172('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7172('0x2'));var fs=require('fs');var Redis=require(_0x7172('0x3'));var db=require(_0x7172('0x4'))['db'];var utils=require(_0x7172('0x5'));var logger=require(_0x7172('0x6'))(_0x7172('0x7'));var config=require(_0x7172('0x8'));var jayson=require(_0x7172('0x9'));var client=jayson[_0x7172('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe4a74a,_0x420bcb,_0x411632){return new BPromise(function(_0x147be6,_0x52d010){return client[_0x7172('0xb')](_0xe4a74a,_0x411632)[_0x7172('0xc')](function(_0x579933){logger[_0x7172('0xd')](_0x7172('0xe'),_0x420bcb,_0x7172('0xf'));logger[_0x7172('0x10')](_0x7172('0x11'),_0x420bcb,_0x7172('0xf'),JSON[_0x7172('0x12')](_0x579933));if(_0x579933[_0x7172('0x13')]){if(_0x579933[_0x7172('0x13')][_0x7172('0x14')]===0x1f4){logger[_0x7172('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x420bcb,_0x579933[_0x7172('0x13')][_0x7172('0x15')]);return _0x52d010(_0x579933[_0x7172('0x13')]['message']);}logger['error'](_0x7172('0xe'),_0x420bcb,_0x579933[_0x7172('0x13')]['message']);return _0x147be6(_0x579933[_0x7172('0x13')]['message']);}else{logger[_0x7172('0xd')](_0x7172('0xe'),_0x420bcb,_0x7172('0xf'));_0x147be6(_0x579933[_0x7172('0x16')]['message']);}})[_0x7172('0x17')](function(_0x30b3ec){logger[_0x7172('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x420bcb,_0x30b3ec);_0x52d010(_0x30b3ec);});});}exports[_0x7172('0x18')]=function(_0x4c6b2d){var _0x3ca2df=this;return new Promise(function(_0x222568,_0x3dc6f4){return db[_0x7172('0x19')][_0x7172('0x1a')]({'raw':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')]['where']||null:null,'attributes':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d['options']['attributes']||null:null,'limit':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1d')]||null:null,'include':_0x4c6b2d['options']?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x4c6b2d[_0x7172('0x1b')]['include'],function(_0x2fec1a){return{'model':db[_0x2fec1a[_0x7172('0x20')]],'as':_0x2fec1a['as'],'attributes':_0x2fec1a[_0x7172('0x21')],'include':_0x2fec1a[_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x2fec1a[_0x7172('0x1e')],function(_0x134559){return{'model':db[_0x134559[_0x7172('0x20')]],'as':_0x134559['as'],'attributes':_0x134559['attributes'],'include':_0x134559[_0x7172('0x1e')]?_['map'](_0x134559['include'],function(_0x8c5ac0){return{'model':db[_0x8c5ac0[_0x7172('0x20')]],'as':_0x8c5ac0['as'],'attributes':_0x8c5ac0[_0x7172('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7172('0xc')](function(_0x5883ea){logger[_0x7172('0xd')]('GetDynamics365Account',_0x4c6b2d);logger[_0x7172('0x10')]('GetDynamics365Account',_0x4c6b2d,JSON[_0x7172('0x12')](_0x5883ea));_0x222568(_0x5883ea);})['catch'](function(_0x4b6c51){logger[_0x7172('0x13')]('GetDynamics365Account',_0x4b6c51['message'],_0x4c6b2d);_0x3dc6f4(_0x3ca2df[_0x7172('0x13')](0x1f4,_0x4b6c51[_0x7172('0x15')]));});});};exports[_0x7172('0x22')]=function(_0x2ebed5){var _0x3c6b38=this;return new Promise(function(_0x47b8cf,_0x4b8656){return db[_0x7172('0x19')][_0x7172('0x23')]({'raw':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5['options'][_0x7172('0x24')]||null:null,'attributes':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5[_0x7172('0x1b')][_0x7172('0x21')]||null:null,'include':_0x2ebed5['options']?_0x2ebed5['options'][_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x2ebed5[_0x7172('0x1b')][_0x7172('0x1e')],function(_0x3e9b43){return{'model':db[_0x3e9b43[_0x7172('0x20')]],'as':_0x3e9b43['as'],'attributes':_0x3e9b43[_0x7172('0x21')],'include':_0x3e9b43[_0x7172('0x1e')]?_['map'](_0x3e9b43['include'],function(_0x3b0199){return{'model':db[_0x3b0199['model']],'as':_0x3b0199['as'],'attributes':_0x3b0199[_0x7172('0x21')],'include':_0x3b0199[_0x7172('0x1e')]?_['map'](_0x3b0199[_0x7172('0x1e')],function(_0xb52a32){return{'model':db[_0xb52a32[_0x7172('0x20')]],'as':_0xb52a32['as'],'attributes':_0xb52a32[_0x7172('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x958c7e){logger[_0x7172('0xd')](_0x7172('0x22'),_0x2ebed5);logger[_0x7172('0x10')](_0x7172('0x22'),_0x2ebed5,JSON[_0x7172('0x12')](_0x958c7e));_0x47b8cf(_0x958c7e);})['catch'](function(_0x4cbca8){logger[_0x7172('0x13')](_0x7172('0x22'),_0x4cbca8[_0x7172('0x15')],_0x2ebed5);_0x4b8656(_0x3c6b38[_0x7172('0x13')](0x1f4,_0x4cbca8['message']));});});}; \ No newline at end of file +var _0x5621=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5621,0x9f));var _0x1562=function(_0x457681,_0x43e54f){_0x457681=_0x457681-0x0;var _0x4031fa=_0x5621[_0x457681];return _0x4031fa;};'use strict';var _=require(_0x1562('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1562('0x1'));var fs=require('fs');var Redis=require(_0x1562('0x2'));var db=require(_0x1562('0x3'))['db'];var utils=require(_0x1562('0x4'));var logger=require(_0x1562('0x5'))(_0x1562('0x6'));var config=require(_0x1562('0x7'));var jayson=require(_0x1562('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd16bfc,_0x26d920,_0xad08f7){return new BPromise(function(_0x2f51f5,_0x45010a){return client['request'](_0xd16bfc,_0xad08f7)[_0x1562('0x9')](function(_0x36c816){logger[_0x1562('0xa')](_0x1562('0xb'),_0x26d920,_0x1562('0xc'));logger[_0x1562('0xd')](_0x1562('0xe'),_0x26d920,_0x1562('0xc'),JSON['stringify'](_0x36c816));if(_0x36c816[_0x1562('0xf')]){if(_0x36c816[_0x1562('0xf')][_0x1562('0x10')]===0x1f4){logger[_0x1562('0xf')](_0x1562('0xb'),_0x26d920,_0x36c816[_0x1562('0xf')][_0x1562('0x11')]);return _0x45010a(_0x36c816[_0x1562('0xf')][_0x1562('0x11')]);}logger[_0x1562('0xf')](_0x1562('0xb'),_0x26d920,_0x36c816[_0x1562('0xf')][_0x1562('0x11')]);return _0x2f51f5(_0x36c816['error'][_0x1562('0x11')]);}else{logger[_0x1562('0xa')](_0x1562('0xb'),_0x26d920,_0x1562('0xc'));_0x2f51f5(_0x36c816[_0x1562('0x12')]['message']);}})[_0x1562('0x13')](function(_0x2b106f){logger['error'](_0x1562('0xb'),_0x26d920,_0x2b106f);_0x45010a(_0x2b106f);});});}exports[_0x1562('0x14')]=function(_0x19d1f5){var _0x12be7d=this;return new Promise(function(_0x58807b,_0x364729){return db[_0x1562('0x15')][_0x1562('0x16')]({'raw':_0x19d1f5[_0x1562('0x17')]?_0x19d1f5[_0x1562('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19d1f5[_0x1562('0x17')]?_0x19d1f5['options'][_0x1562('0x18')]||null:null,'attributes':_0x19d1f5[_0x1562('0x17')]?_0x19d1f5[_0x1562('0x17')][_0x1562('0x19')]||null:null,'limit':_0x19d1f5[_0x1562('0x17')]?_0x19d1f5[_0x1562('0x17')][_0x1562('0x1a')]||null:null,'include':_0x19d1f5['options']?_0x19d1f5[_0x1562('0x17')][_0x1562('0x1b')]?_[_0x1562('0x1c')](_0x19d1f5['options'][_0x1562('0x1b')],function(_0x543117){return{'model':db[_0x543117[_0x1562('0x1d')]],'as':_0x543117['as'],'attributes':_0x543117[_0x1562('0x19')],'include':_0x543117['include']?_[_0x1562('0x1c')](_0x543117[_0x1562('0x1b')],function(_0x5c186a){return{'model':db[_0x5c186a[_0x1562('0x1d')]],'as':_0x5c186a['as'],'attributes':_0x5c186a['attributes'],'include':_0x5c186a['include']?_[_0x1562('0x1c')](_0x5c186a[_0x1562('0x1b')],function(_0x55b60f){return{'model':db[_0x55b60f[_0x1562('0x1d')]],'as':_0x55b60f['as'],'attributes':_0x55b60f[_0x1562('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1562('0x9')](function(_0x2d420d){logger[_0x1562('0xa')](_0x1562('0x14'),_0x19d1f5);logger[_0x1562('0xd')](_0x1562('0x14'),_0x19d1f5,JSON[_0x1562('0x1e')](_0x2d420d));_0x58807b(_0x2d420d);})[_0x1562('0x13')](function(_0x1c4f16){logger[_0x1562('0xf')]('GetDynamics365Account',_0x1c4f16[_0x1562('0x11')],_0x19d1f5);_0x364729(_0x12be7d[_0x1562('0xf')](0x1f4,_0x1c4f16[_0x1562('0x11')]));});});};exports[_0x1562('0x1f')]=function(_0x44c94b){var _0x4cf181=this;return new Promise(function(_0x5a0043,_0x3e1889){return db[_0x1562('0x15')][_0x1562('0x20')]({'raw':_0x44c94b[_0x1562('0x17')]?_0x44c94b[_0x1562('0x17')][_0x1562('0x21')]===undefined?!![]:![]:!![],'where':_0x44c94b[_0x1562('0x17')]?_0x44c94b[_0x1562('0x17')][_0x1562('0x18')]||null:null,'attributes':_0x44c94b[_0x1562('0x17')]?_0x44c94b[_0x1562('0x17')]['attributes']||null:null,'include':_0x44c94b['options']?_0x44c94b['options'][_0x1562('0x1b')]?_[_0x1562('0x1c')](_0x44c94b[_0x1562('0x17')][_0x1562('0x1b')],function(_0xf19fd0){return{'model':db[_0xf19fd0['model']],'as':_0xf19fd0['as'],'attributes':_0xf19fd0[_0x1562('0x19')],'include':_0xf19fd0[_0x1562('0x1b')]?_[_0x1562('0x1c')](_0xf19fd0[_0x1562('0x1b')],function(_0x1013df){return{'model':db[_0x1013df[_0x1562('0x1d')]],'as':_0x1013df['as'],'attributes':_0x1013df[_0x1562('0x19')],'include':_0x1013df['include']?_[_0x1562('0x1c')](_0x1013df['include'],function(_0x4cdb62){return{'model':db[_0x4cdb62[_0x1562('0x1d')]],'as':_0x4cdb62['as'],'attributes':_0x4cdb62[_0x1562('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1562('0x9')](function(_0x41771f){logger['info'](_0x1562('0x1f'),_0x44c94b);logger[_0x1562('0xd')]('ShowDynamics365Account',_0x44c94b,JSON[_0x1562('0x1e')](_0x41771f));_0x5a0043(_0x41771f);})[_0x1562('0x13')](function(_0x3d34d9){logger[_0x1562('0xf')](_0x1562('0x1f'),_0x3d34d9[_0x1562('0x11')],_0x44c94b);_0x3e1889(_0x4cf181[_0x1562('0xf')](0x1f4,_0x3d34d9['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9f272a1..7f83850 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 _0x7044=['isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x5d5ab2,_0x1d3681){var _0xb8fe37=function(_0x29a76c){while(--_0x29a76c){_0x5d5ab2['push'](_0x5d5ab2['shift']());}};_0xb8fe37(++_0x1d3681);}(_0x7044,0x147));var _0x4704=function(_0x4f9c08,_0x4d83df){_0x4f9c08=_0x4f9c08-0x0;var _0x4da7e5=_0x7044[_0x4f9c08];return _0x4da7e5;};'use strict';var multer=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var path=require(_0x4704('0x2'));var timeout=require('connect-timeout');var express=require(_0x4704('0x3'));var router=express[_0x4704('0x4')]();var fs_extra=require(_0x4704('0x5'));var auth=require(_0x4704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4704('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x4704('0x8')]('/',auth[_0x4704('0x9')](),controller['index']);router['get'](_0x4704('0xa'),auth[_0x4704('0x9')](),controller[_0x4704('0xb')]);router[_0x4704('0x8')](_0x4704('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x4704('0x8')]('/:id/subjects',auth[_0x4704('0x9')](),controller[_0x4704('0xd')]);router[_0x4704('0x8')](_0x4704('0xe'),auth[_0x4704('0x9')](),controller['getDescriptions']);router[_0x4704('0xf')]('/',auth[_0x4704('0x9')](),controller[_0x4704('0x10')]);router[_0x4704('0x11')](_0x4704('0xa'),auth[_0x4704('0x9')](),controller['update']);router[_0x4704('0x12')](_0x4704('0xa'),auth[_0x4704('0x9')](),controller[_0x4704('0x13')]);module[_0x4704('0x14')]=router; \ No newline at end of file +var _0xa109=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x385e36,_0x17d250){var _0x1c54ae=function(_0x2e5759){while(--_0x2e5759){_0x385e36['push'](_0x385e36['shift']());}};_0x1c54ae(++_0x17d250);}(_0xa109,0xf2));var _0x9a10=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa109[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x9a10('0x0'));var util=require('util');var path=require(_0x9a10('0x1'));var timeout=require(_0x9a10('0x2'));var express=require(_0x9a10('0x3'));var router=express['Router']();var fs_extra=require(_0x9a10('0x4'));var auth=require(_0x9a10('0x5'));var interaction=require(_0x9a10('0x6'));var config=require(_0x9a10('0x7'));var controller=require(_0x9a10('0x8'));router[_0x9a10('0x9')]('/',auth[_0x9a10('0xa')](),controller[_0x9a10('0xb')]);router[_0x9a10('0x9')](_0x9a10('0xc'),auth['isAuthenticated'](),controller[_0x9a10('0xd')]);router[_0x9a10('0x9')](_0x9a10('0xe'),auth[_0x9a10('0xa')](),controller[_0x9a10('0xf')]);router[_0x9a10('0x9')](_0x9a10('0x10'),auth[_0x9a10('0xa')](),controller[_0x9a10('0x11')]);router['get'](_0x9a10('0x12'),auth[_0x9a10('0xa')](),controller[_0x9a10('0x13')]);router[_0x9a10('0x14')]('/',auth[_0x9a10('0xa')](),controller['create']);router[_0x9a10('0x15')](_0x9a10('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9a10('0xc'),auth[_0x9a10('0xa')](),controller[_0x9a10('0x16')]);module[_0x9a10('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 186c9b8..58eeb9d 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 _0x38c3=['sequelize','exports','ENUM','incident','nothing','contact','STRING','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x38c3,0x120));var _0x338c=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0x38c3[_0x4d821c];return _0x15dd5b;};'use strict';var Sequelize=require(_0x338c('0x0'));module[_0x338c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x338c('0x2')](_0x338c('0x3'),'phonecall'),'defaultValue':_0x338c('0x3')},'moduleCreate':{'type':Sequelize[_0x338c('0x2')]('contact',_0x338c('0x4')),'defaultValue':_0x338c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x338c('0x6')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x338c('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9610=['BOOLEAN','STRING','incident','phonecall','ENUM','contact','nothing'];(function(_0x44ce97,_0x321989){var _0x48eec6=function(_0x18049b){while(--_0x18049b){_0x44ce97['push'](_0x44ce97['shift']());}};_0x48eec6(++_0x321989);}(_0x9610,0xc5));var _0x0961=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x9610[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0961('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x0961('0x1'),_0x0961('0x2')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x0961('0x3')](_0x0961('0x4'),_0x0961('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0961('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0961('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a073ec4..8e33995 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 _0x3ff0=['filter','options','include','findAll','then','rows','show','includeAll','find','catch','create','body','destroy','params','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','sendStatus','error','stack','send','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','name'];(function(_0x3da141,_0x4b94f9){var _0x5cf4d7=function(_0x144848){while(--_0x144848){_0x3da141['push'](_0x3da141['shift']());}};_0x5cf4d7(++_0x4b94f9);}(_0x3ff0,0xfd));var _0x03ff=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x3ff0[_0x1dd532];return _0x3732aa;};'use strict';var emlformat=require(_0x03ff('0x0'));var rimraf=require(_0x03ff('0x1'));var zipdir=require(_0x03ff('0x2'));var jsonpatch=require(_0x03ff('0x3'));var rp=require(_0x03ff('0x4'));var moment=require('moment');var BPromise=require(_0x03ff('0x5'));var Mustache=require(_0x03ff('0x6'));var util=require('util');var path=require(_0x03ff('0x7'));var sox=require(_0x03ff('0x8'));var csv=require(_0x03ff('0x9'));var ejs=require(_0x03ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x03ff('0xb'));var crypto=require('crypto');var jsforce=require(_0x03ff('0xc'));var deskjs=require(_0x03ff('0xd'));var toCsv=require(_0x03ff('0x9'));var querystring=require(_0x03ff('0xe'));var Papa=require(_0x03ff('0xf'));var Redis=require(_0x03ff('0x10'));var authService=require(_0x03ff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03ff('0x12'))('api');var utils=require(_0x03ff('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x03ff('0x14'));var db=require(_0x03ff('0x15'))['db'];function respondWithStatusCode(_0x327d63,_0x50eba1){_0x50eba1=_0x50eba1||0xcc;return function(_0x470aa5){if(_0x470aa5){return _0x327d63['sendStatus'](_0x50eba1);}return _0x327d63[_0x03ff('0x16')](_0x50eba1)[_0x03ff('0x17')]();};}function respondWithResult(_0x3a9209,_0x274d2e){_0x274d2e=_0x274d2e||0xc8;return function(_0xe15a3c){if(_0xe15a3c){return _0x3a9209[_0x03ff('0x16')](_0x274d2e)[_0x03ff('0x18')](_0xe15a3c);}};}function respondWithFilteredResult(_0x2d531a,_0x2cc456){return function(_0x55f67b){if(_0x55f67b){var _0x53a4a=typeof _0x2cc456[_0x03ff('0x19')]===_0x03ff('0x1a')&&typeof _0x2cc456[_0x03ff('0x1b')]===_0x03ff('0x1a');var _0x361e33=_0x55f67b[_0x03ff('0x1c')];var _0x30b5ca=_0x53a4a?0x0:_0x2cc456[_0x03ff('0x19')];var _0x59f86d=_0x53a4a?_0x55f67b[_0x03ff('0x1c')]:_0x2cc456['offset']+_0x2cc456[_0x03ff('0x1b')];var _0x30a968;if(_0x59f86d>=_0x361e33){_0x59f86d=_0x361e33;_0x30a968=0xc8;}else{_0x30a968=0xce;}_0x2d531a['status'](_0x30a968);return _0x2d531a['set'](_0x03ff('0x1d'),_0x30b5ca+'-'+_0x59f86d+'/'+_0x361e33)['json'](_0x55f67b);}return null;};}function patchUpdates(_0x55d354){return function(_0x391d96){try{jsonpatch[_0x03ff('0x1e')](_0x391d96,_0x55d354,!![]);}catch(_0x6eb110){return BPromise[_0x03ff('0x1f')](_0x6eb110);}return _0x391d96['save']();};}function saveUpdates(_0x2e92bb,_0x5314c4){return function(_0x3d168c){if(_0x3d168c){return _0x3d168c[_0x03ff('0x20')](_0x2e92bb)['then'](function(_0x3f25e9){return _0x3f25e9;});}return null;};}function removeEntity(_0x57b309,_0x3060c4){return function(_0x1a290c){if(_0x1a290c){return _0x1a290c['destroy']()['then'](function(){_0x57b309['status'](0xcc)[_0x03ff('0x17')]();});}};}function handleEntityNotFound(_0x2371fb,_0x26a2b8){return function(_0x292ff0){if(!_0x292ff0){_0x2371fb[_0x03ff('0x21')](0x194);}return _0x292ff0;};}function handleError(_0x34f8ec,_0x150368){_0x150368=_0x150368||0x1f4;return function(_0x1e16f9){logger[_0x03ff('0x22')](_0x1e16f9[_0x03ff('0x23')]);if(_0x1e16f9['name']){delete _0x1e16f9['name'];}_0x34f8ec[_0x03ff('0x16')](_0x150368)[_0x03ff('0x24')](_0x1e16f9);};}exports['index']=function(_0x5963f7,_0x81c9cd){var _0x4cbcf6={},_0x374936={},_0x4e8f7={'count':0x0,'rows':[]};var _0x5b07c8=_['map'](db[_0x03ff('0x25')][_0x03ff('0x26')],function(_0x171e40){return{'name':_0x171e40[_0x03ff('0x27')],'type':_0x171e40[_0x03ff('0x28')]['key']};});_0x374936[_0x03ff('0x29')]=_['map'](_0x5b07c8,'name');_0x374936[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x5963f7[_0x03ff('0x2a')]);_0x374936['filters']=_[_0x03ff('0x2c')](_0x374936[_0x03ff('0x29')],_0x374936[_0x03ff('0x2a')]);_0x4cbcf6[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x374936[_0x03ff('0x29')],qs['fields'](_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x4cbcf6[_0x03ff('0x2d')]=_0x4cbcf6[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x4cbcf6[_0x03ff('0x2d')]:_0x374936[_0x03ff('0x29')];if(!_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x4cbcf6['limit']=qs[_0x03ff('0x1b')](_0x5963f7[_0x03ff('0x2a')]['limit']);_0x4cbcf6[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x19')]);}_0x4cbcf6[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x5963f7['query']['sort']);_0x4cbcf6[_0x03ff('0x34')]=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x5963f7[_0x03ff('0x2a')],_0x374936[_0x03ff('0x35')]),_0x5b07c8);if(_0x5963f7[_0x03ff('0x2a')]['filter']){_0x4cbcf6[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x4cbcf6[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x5b07c8,function(_0x1224ae){if(_0x1224ae[_0x03ff('0x28')]!==_0x03ff('0x39')){var _0x3bfdbc={};_0x3bfdbc[_0x1224ae[_0x03ff('0x3a')]]={'$like':'%'+_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x3b')]+'%'};return _0x3bfdbc;}})});}_0x4cbcf6=_[_0x03ff('0x37')]({},_0x4cbcf6,_0x5963f7[_0x03ff('0x3c')]);var _0x27801f={'where':_0x4cbcf6['where']};return db[_0x03ff('0x25')][_0x03ff('0x1c')](_0x27801f)['then'](function(_0x57fc6b){_0x4e8f7[_0x03ff('0x1c')]=_0x57fc6b;if(_0x5963f7[_0x03ff('0x2a')]['includeAll']){_0x4cbcf6[_0x03ff('0x3d')]=[{'all':!![]}];}return db[_0x03ff('0x25')][_0x03ff('0x3e')](_0x4cbcf6);})[_0x03ff('0x3f')](function(_0x435695){_0x4e8f7[_0x03ff('0x40')]=_0x435695;return _0x4e8f7;})[_0x03ff('0x3f')](respondWithFilteredResult(_0x81c9cd,_0x4cbcf6))['catch'](handleError(_0x81c9cd,null));};exports[_0x03ff('0x41')]=function(_0x304a3d,_0x202288){var _0x32a2f6={'raw':![],'where':{'id':_0x304a3d['params']['id']}},_0x163c47={};_0x163c47['model']=_[_0x03ff('0x2b')](db[_0x03ff('0x25')][_0x03ff('0x26')]);_0x163c47[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x304a3d[_0x03ff('0x2a')]);_0x163c47[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x163c47[_0x03ff('0x29')],_0x163c47['query']);_0x32a2f6[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x163c47[_0x03ff('0x29')],qs['fields'](_0x304a3d[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x32a2f6[_0x03ff('0x2d')]=_0x32a2f6[_0x03ff('0x2d')]['length']?_0x32a2f6['attributes']:_0x163c47['model'];if(_0x304a3d[_0x03ff('0x2a')][_0x03ff('0x42')]){_0x32a2f6[_0x03ff('0x3d')]=[{'all':!![]}];}_0x32a2f6=_[_0x03ff('0x37')]({},_0x32a2f6,_0x304a3d[_0x03ff('0x3c')]);return db[_0x03ff('0x25')][_0x03ff('0x43')](_0x32a2f6)[_0x03ff('0x3f')](handleEntityNotFound(_0x202288,null))[_0x03ff('0x3f')](respondWithResult(_0x202288,null))[_0x03ff('0x44')](handleError(_0x202288,null));};exports[_0x03ff('0x45')]=function(_0x21cf18,_0x364f04){return db[_0x03ff('0x25')][_0x03ff('0x45')](_0x21cf18['body'],{})['then'](respondWithResult(_0x364f04,0xc9))['catch'](handleError(_0x364f04,null));};exports[_0x03ff('0x20')]=function(_0x4dbb0d,_0x9de397){if(_0x4dbb0d[_0x03ff('0x46')]['id']){delete _0x4dbb0d[_0x03ff('0x46')]['id'];}return db[_0x03ff('0x25')]['find']({'where':{'id':_0x4dbb0d['params']['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x9de397,null))[_0x03ff('0x3f')](saveUpdates(_0x4dbb0d[_0x03ff('0x46')],null))['then'](respondWithResult(_0x9de397,null))[_0x03ff('0x44')](handleError(_0x9de397,null));};exports[_0x03ff('0x47')]=function(_0x2bef46,_0xb23d8e){return db['Dynamics365Configuration'][_0x03ff('0x43')]({'where':{'id':_0x2bef46[_0x03ff('0x48')]['id']}})['then'](handleEntityNotFound(_0xb23d8e,null))[_0x03ff('0x3f')](removeEntity(_0xb23d8e,null))[_0x03ff('0x44')](handleError(_0xb23d8e,null));};exports[_0x03ff('0x49')]=function(_0x4b2693,_0x134536,_0x10bc3f){var _0x3ba162={};var _0x269f65={};var _0x1055be;var _0x598875;return db[_0x03ff('0x25')]['findOne']({'where':{'id':_0x4b2693['params']['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x134536,null))[_0x03ff('0x3f')](function(_0x174011){if(_0x174011){_0x1055be=_0x174011;_0x269f65[_0x03ff('0x29')]=_[_0x03ff('0x2b')](db[_0x03ff('0x4a')][_0x03ff('0x26')]);_0x269f65[_0x03ff('0x2a')]=_['keys'](_0x4b2693[_0x03ff('0x2a')]);_0x269f65[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x269f65[_0x03ff('0x29')],_0x269f65[_0x03ff('0x2a')]);_0x3ba162['attributes']=_[_0x03ff('0x2c')](_0x269f65['model'],qs['fields'](_0x4b2693['query'][_0x03ff('0x2e')]));_0x3ba162[_0x03ff('0x2d')]=_0x3ba162[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x3ba162[_0x03ff('0x2d')]:_0x269f65['model'];_0x3ba162[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x4b2693['query'][_0x03ff('0x33')]);_0x3ba162[_0x03ff('0x34')]=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x4b2693[_0x03ff('0x2a')],_0x269f65[_0x03ff('0x35')]));if(_0x4b2693['query'][_0x03ff('0x3b')]){_0x3ba162[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x3ba162[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x3ba162['attributes'],function(_0x47e1f9){var _0x5de620={};_0x5de620[_0x47e1f9]={'$like':'%'+_0x4b2693[_0x03ff('0x2a')]['filter']+'%'};return _0x5de620;})});}_0x3ba162=_[_0x03ff('0x37')]({},_0x3ba162,_0x4b2693[_0x03ff('0x3c')]);return _0x1055be[_0x03ff('0x49')](_0x3ba162);}})[_0x03ff('0x3f')](function(_0x55cc0b){if(_0x55cc0b){_0x598875=_0x55cc0b[_0x03ff('0x2f')];if(!_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x3ba162[_0x03ff('0x1b')]=qs[_0x03ff('0x1b')](_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x3ba162[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x19')]);}return _0x1055be[_0x03ff('0x49')](_0x3ba162);}})['then'](function(_0xd3a423){if(_0xd3a423){return _0xd3a423?{'count':_0x598875,'rows':_0xd3a423}:null;}})[_0x03ff('0x3f')](respondWithResult(_0x134536,null))[_0x03ff('0x44')](handleError(_0x134536,null));};exports[_0x03ff('0x4b')]=function(_0x4ffbea,_0x138b48,_0x5147a9){var _0x147d25={};var _0x4f8f2a={};var _0x3f307;var _0x10b270;return db[_0x03ff('0x25')][_0x03ff('0x4c')]({'where':{'id':_0x4ffbea[_0x03ff('0x48')]['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x138b48,null))['then'](function(_0xc55e05){if(_0xc55e05){_0x3f307=_0xc55e05;_0x4f8f2a[_0x03ff('0x29')]=_[_0x03ff('0x2b')](db[_0x03ff('0x4a')][_0x03ff('0x26')]);_0x4f8f2a['query']=_['keys'](_0x4ffbea[_0x03ff('0x2a')]);_0x4f8f2a['filters']=_[_0x03ff('0x2c')](_0x4f8f2a[_0x03ff('0x29')],_0x4f8f2a[_0x03ff('0x2a')]);_0x147d25['attributes']=_[_0x03ff('0x2c')](_0x4f8f2a[_0x03ff('0x29')],qs[_0x03ff('0x2e')](_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x147d25[_0x03ff('0x2d')]=_0x147d25['attributes']['length']?_0x147d25[_0x03ff('0x2d')]:_0x4f8f2a[_0x03ff('0x29')];_0x147d25[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x4ffbea[_0x03ff('0x2a')]['sort']);_0x147d25['where']=qs[_0x03ff('0x35')](_['pick'](_0x4ffbea['query'],_0x4f8f2a[_0x03ff('0x35')]));if(_0x4ffbea[_0x03ff('0x2a')]['filter']){_0x147d25[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x147d25[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x147d25['attributes'],function(_0x1b49fc){var _0x11e7be={};_0x11e7be[_0x1b49fc]={'$like':'%'+_0x4ffbea['query'][_0x03ff('0x3b')]+'%'};return _0x11e7be;})});}_0x147d25=_[_0x03ff('0x37')]({},_0x147d25,_0x4ffbea['options']);return _0x3f307[_0x03ff('0x4b')](_0x147d25);}})[_0x03ff('0x3f')](function(_0x161900){if(_0x161900){_0x10b270=_0x161900[_0x03ff('0x2f')];if(!_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x147d25[_0x03ff('0x1b')]=qs[_0x03ff('0x1b')](_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x147d25[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x4ffbea['query'][_0x03ff('0x19')]);}return _0x3f307[_0x03ff('0x4b')](_0x147d25);}})['then'](function(_0xd4ba37){if(_0xd4ba37){return _0xd4ba37?{'count':_0x10b270,'rows':_0xd4ba37}:null;}})[_0x03ff('0x3f')](respondWithResult(_0x138b48,null))[_0x03ff('0x44')](handleError(_0x138b48,null));};exports[_0x03ff('0x4d')]=function(_0x137b7a,_0x8bc365,_0xaae4a8){var _0x1ddd31={};var _0x24ac21={};var _0x1168d3;var _0x2b397a;return db[_0x03ff('0x25')]['findOne']({'where':{'id':_0x137b7a[_0x03ff('0x48')]['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x8bc365,null))[_0x03ff('0x3f')](function(_0x43227b){if(_0x43227b){_0x1168d3=_0x43227b;_0x24ac21[_0x03ff('0x29')]=_['keys'](db[_0x03ff('0x4a')]['rawAttributes']);_0x24ac21[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x137b7a[_0x03ff('0x2a')]);_0x24ac21[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x24ac21[_0x03ff('0x29')],_0x24ac21[_0x03ff('0x2a')]);_0x1ddd31[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x24ac21['model'],qs['fields'](_0x137b7a['query']['fields']));_0x1ddd31[_0x03ff('0x2d')]=_0x1ddd31[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x1ddd31['attributes']:_0x24ac21['model'];_0x1ddd31[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x137b7a['query'][_0x03ff('0x33')]);_0x1ddd31['where']=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x137b7a[_0x03ff('0x2a')],_0x24ac21[_0x03ff('0x35')]));if(_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x3b')]){_0x1ddd31[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x1ddd31[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x1ddd31[_0x03ff('0x2d')],function(_0x37d08d){var _0x26b8e1={};_0x26b8e1[_0x37d08d]={'$like':'%'+_0x137b7a['query']['filter']+'%'};return _0x26b8e1;})});}_0x1ddd31=_[_0x03ff('0x37')]({},_0x1ddd31,_0x137b7a[_0x03ff('0x3c')]);return _0x1168d3['getDescriptions'](_0x1ddd31);}})[_0x03ff('0x3f')](function(_0xa3f571){if(_0xa3f571){_0x2b397a=_0xa3f571['length'];if(!_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x30')]('nolimit')){_0x1ddd31[_0x03ff('0x1b')]=qs['limit'](_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x1ddd31[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x137b7a[_0x03ff('0x2a')]['offset']);}return _0x1168d3[_0x03ff('0x4d')](_0x1ddd31);}})[_0x03ff('0x3f')](function(_0x286dfa){if(_0x286dfa){return _0x286dfa?{'count':_0x2b397a,'rows':_0x286dfa}:null;}})['then'](respondWithResult(_0x8bc365,null))['catch'](handleError(_0x8bc365,null));}; \ No newline at end of file +var _0x8eda=['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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','hasOwnProperty','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','attributes','includeAll','find','create','body','getFields','findOne','order','sort','nolimit','Dynamics365Field','length','pick','getSubjects','getDescriptions'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x8eda,0x1f2));var _0xa8ed=function(_0x3f9be8,_0xe2dbd2){_0x3f9be8=_0x3f9be8-0x0;var _0x5341f0=_0x8eda[_0x3f9be8];return _0x5341f0;};'use strict';var emlformat=require(_0xa8ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8ed('0x1'));var jsonpatch=require(_0xa8ed('0x2'));var rp=require(_0xa8ed('0x3'));var moment=require(_0xa8ed('0x4'));var BPromise=require(_0xa8ed('0x5'));var Mustache=require(_0xa8ed('0x6'));var util=require(_0xa8ed('0x7'));var path=require('path');var sox=require(_0xa8ed('0x8'));var csv=require('to-csv');var ejs=require(_0xa8ed('0x9'));var fs=require('fs');var fs_extra=require(_0xa8ed('0xa'));var _=require(_0xa8ed('0xb'));var squel=require(_0xa8ed('0xc'));var crypto=require(_0xa8ed('0xd'));var jsforce=require(_0xa8ed('0xe'));var deskjs=require(_0xa8ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa8ed('0x10'));var Papa=require(_0xa8ed('0x11'));var Redis=require(_0xa8ed('0x12'));var authService=require(_0xa8ed('0x13'));var qs=require(_0xa8ed('0x14'));var as=require(_0xa8ed('0x15'));var hardwareService=require(_0xa8ed('0x16'));var logger=require(_0xa8ed('0x17'))(_0xa8ed('0x18'));var utils=require(_0xa8ed('0x19'));var config=require(_0xa8ed('0x1a'));var licenseUtil=require(_0xa8ed('0x1b'));var db=require(_0xa8ed('0x1c'))['db'];function respondWithStatusCode(_0x264dc9,_0x44a664){_0x44a664=_0x44a664||0xcc;return function(_0x267080){if(_0x267080){return _0x264dc9[_0xa8ed('0x1d')](_0x44a664);}return _0x264dc9[_0xa8ed('0x1e')](_0x44a664)[_0xa8ed('0x1f')]();};}function respondWithResult(_0x2587f2,_0x1e1995){_0x1e1995=_0x1e1995||0xc8;return function(_0x46add1){if(_0x46add1){return _0x2587f2[_0xa8ed('0x1e')](_0x1e1995)['json'](_0x46add1);}};}function respondWithFilteredResult(_0x45e0d8,_0x56e4fc){return function(_0x424129){if(_0x424129){var _0x38c41c=typeof _0x56e4fc[_0xa8ed('0x20')]==='undefined'&&typeof _0x56e4fc[_0xa8ed('0x21')]==='undefined';var _0x154c38=_0x424129[_0xa8ed('0x22')];var _0x2a5e5d=_0x38c41c?0x0:_0x56e4fc[_0xa8ed('0x20')];var _0x20cc4a=_0x38c41c?_0x424129[_0xa8ed('0x22')]:_0x56e4fc[_0xa8ed('0x20')]+_0x56e4fc['limit'];var _0x9ecd79;if(_0x20cc4a>=_0x154c38){_0x20cc4a=_0x154c38;_0x9ecd79=0xc8;}else{_0x9ecd79=0xce;}_0x45e0d8[_0xa8ed('0x1e')](_0x9ecd79);return _0x45e0d8[_0xa8ed('0x23')](_0xa8ed('0x24'),_0x2a5e5d+'-'+_0x20cc4a+'/'+_0x154c38)['json'](_0x424129);}return null;};}function patchUpdates(_0x8cc455){return function(_0x5e8d55){try{jsonpatch[_0xa8ed('0x25')](_0x5e8d55,_0x8cc455,!![]);}catch(_0x243904){return BPromise[_0xa8ed('0x26')](_0x243904);}return _0x5e8d55['save']();};}function saveUpdates(_0x140040,_0x4fc259){return function(_0x1ce555){if(_0x1ce555){return _0x1ce555[_0xa8ed('0x27')](_0x140040)[_0xa8ed('0x28')](function(_0x1f5cab){return _0x1f5cab;});}return null;};}function removeEntity(_0x2359b1,_0x138a4e){return function(_0xb95b0d){if(_0xb95b0d){return _0xb95b0d[_0xa8ed('0x29')]()[_0xa8ed('0x28')](function(){_0x2359b1[_0xa8ed('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4cb3,_0x24a26d){return function(_0x69315e){if(!_0x69315e){_0x2f4cb3[_0xa8ed('0x1d')](0x194);}return _0x69315e;};}function handleError(_0x597a6e,_0x302f08){_0x302f08=_0x302f08||0x1f4;return function(_0x15020c){logger[_0xa8ed('0x2a')](_0x15020c[_0xa8ed('0x2b')]);if(_0x15020c[_0xa8ed('0x2c')]){delete _0x15020c[_0xa8ed('0x2c')];}_0x597a6e['status'](_0x302f08)[_0xa8ed('0x2d')](_0x15020c);};}exports['index']=function(_0xb1f852,_0x171e01){var _0x32e347={},_0x2d189d={},_0x442bb9={'count':0x0,'rows':[]};var _0x25dddc=_[_0xa8ed('0x2e')](db[_0xa8ed('0x2f')][_0xa8ed('0x30')],function(_0x3777ba){return{'name':_0x3777ba[_0xa8ed('0x31')],'type':_0x3777ba[_0xa8ed('0x32')]['key']};});_0x2d189d['model']=_[_0xa8ed('0x2e')](_0x25dddc,_0xa8ed('0x2c'));_0x2d189d[_0xa8ed('0x33')]=_[_0xa8ed('0x34')](_0xb1f852['query']);_0x2d189d[_0xa8ed('0x35')]=_[_0xa8ed('0x36')](_0x2d189d[_0xa8ed('0x37')],_0x2d189d[_0xa8ed('0x33')]);_0x32e347['attributes']=_[_0xa8ed('0x36')](_0x2d189d[_0xa8ed('0x37')],qs[_0xa8ed('0x38')](_0xb1f852[_0xa8ed('0x33')][_0xa8ed('0x38')]));_0x32e347['attributes']=_0x32e347['attributes']['length']?_0x32e347['attributes']:_0x2d189d[_0xa8ed('0x37')];if(!_0xb1f852[_0xa8ed('0x33')][_0xa8ed('0x39')]('nolimit')){_0x32e347[_0xa8ed('0x21')]=qs[_0xa8ed('0x21')](_0xb1f852[_0xa8ed('0x33')][_0xa8ed('0x21')]);_0x32e347[_0xa8ed('0x20')]=qs['offset'](_0xb1f852[_0xa8ed('0x33')][_0xa8ed('0x20')]);}_0x32e347['order']=qs['sort'](_0xb1f852[_0xa8ed('0x33')]['sort']);_0x32e347['where']=qs[_0xa8ed('0x35')](_['pick'](_0xb1f852[_0xa8ed('0x33')],_0x2d189d[_0xa8ed('0x35')]),_0x25dddc);if(_0xb1f852[_0xa8ed('0x33')][_0xa8ed('0x3a')]){_0x32e347[_0xa8ed('0x3b')]=_[_0xa8ed('0x3c')](_0x32e347[_0xa8ed('0x3b')],{'$or':_[_0xa8ed('0x2e')](_0x25dddc,function(_0x5ec3ae){if(_0x5ec3ae[_0xa8ed('0x32')]!==_0xa8ed('0x3d')){var _0x3d7eef={};_0x3d7eef[_0x5ec3ae[_0xa8ed('0x2c')]]={'$like':'%'+_0xb1f852['query']['filter']+'%'};return _0x3d7eef;}})});}_0x32e347=_[_0xa8ed('0x3c')]({},_0x32e347,_0xb1f852[_0xa8ed('0x3e')]);var _0x424ea7={'where':_0x32e347[_0xa8ed('0x3b')]};return db['Dynamics365Configuration'][_0xa8ed('0x22')](_0x424ea7)[_0xa8ed('0x28')](function(_0x2a2e2c){_0x442bb9[_0xa8ed('0x22')]=_0x2a2e2c;if(_0xb1f852[_0xa8ed('0x33')]['includeAll']){_0x32e347[_0xa8ed('0x3f')]=[{'all':!![]}];}return db[_0xa8ed('0x2f')]['findAll'](_0x32e347);})['then'](function(_0x2407b4){_0x442bb9[_0xa8ed('0x40')]=_0x2407b4;return _0x442bb9;})[_0xa8ed('0x28')](respondWithFilteredResult(_0x171e01,_0x32e347))[_0xa8ed('0x41')](handleError(_0x171e01,null));};exports[_0xa8ed('0x42')]=function(_0x283fff,_0x5b1be6){var _0x5be068={'raw':![],'where':{'id':_0x283fff[_0xa8ed('0x43')]['id']}},_0x4cc34e={};_0x4cc34e[_0xa8ed('0x37')]=_[_0xa8ed('0x34')](db[_0xa8ed('0x2f')][_0xa8ed('0x30')]);_0x4cc34e[_0xa8ed('0x33')]=_['keys'](_0x283fff['query']);_0x4cc34e[_0xa8ed('0x35')]=_['intersection'](_0x4cc34e['model'],_0x4cc34e[_0xa8ed('0x33')]);_0x5be068['attributes']=_[_0xa8ed('0x36')](_0x4cc34e['model'],qs['fields'](_0x283fff[_0xa8ed('0x33')]['fields']));_0x5be068[_0xa8ed('0x44')]=_0x5be068[_0xa8ed('0x44')]['length']?_0x5be068[_0xa8ed('0x44')]:_0x4cc34e[_0xa8ed('0x37')];if(_0x283fff[_0xa8ed('0x33')][_0xa8ed('0x45')]){_0x5be068[_0xa8ed('0x3f')]=[{'all':!![]}];}_0x5be068=_[_0xa8ed('0x3c')]({},_0x5be068,_0x283fff[_0xa8ed('0x3e')]);return db[_0xa8ed('0x2f')][_0xa8ed('0x46')](_0x5be068)[_0xa8ed('0x28')](handleEntityNotFound(_0x5b1be6,null))[_0xa8ed('0x28')](respondWithResult(_0x5b1be6,null))['catch'](handleError(_0x5b1be6,null));};exports[_0xa8ed('0x47')]=function(_0x4d37c7,_0x332bde){return db[_0xa8ed('0x2f')][_0xa8ed('0x47')](_0x4d37c7[_0xa8ed('0x48')],{})[_0xa8ed('0x28')](respondWithResult(_0x332bde,0xc9))['catch'](handleError(_0x332bde,null));};exports[_0xa8ed('0x27')]=function(_0xe6f305,_0x4d88bb){if(_0xe6f305['body']['id']){delete _0xe6f305[_0xa8ed('0x48')]['id'];}return db[_0xa8ed('0x2f')][_0xa8ed('0x46')]({'where':{'id':_0xe6f305[_0xa8ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d88bb,null))[_0xa8ed('0x28')](saveUpdates(_0xe6f305['body'],null))['then'](respondWithResult(_0x4d88bb,null))[_0xa8ed('0x41')](handleError(_0x4d88bb,null));};exports[_0xa8ed('0x29')]=function(_0x48aedf,_0x71c062){return db[_0xa8ed('0x2f')][_0xa8ed('0x46')]({'where':{'id':_0x48aedf[_0xa8ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x71c062,null))[_0xa8ed('0x28')](removeEntity(_0x71c062,null))[_0xa8ed('0x41')](handleError(_0x71c062,null));};exports[_0xa8ed('0x49')]=function(_0x5070bf,_0x5dbad8,_0x17d05a){var _0x5af371={};var _0x59b170={};var _0x2f1d6c;var _0x1bdc72;return db[_0xa8ed('0x2f')][_0xa8ed('0x4a')]({'where':{'id':_0x5070bf[_0xa8ed('0x43')]['id']}})[_0xa8ed('0x28')](handleEntityNotFound(_0x5dbad8,null))[_0xa8ed('0x28')](function(_0x36109b){if(_0x36109b){_0x2f1d6c=_0x36109b;_0x59b170[_0xa8ed('0x37')]=_[_0xa8ed('0x34')](db['Dynamics365Field']['rawAttributes']);_0x59b170[_0xa8ed('0x33')]=_[_0xa8ed('0x34')](_0x5070bf[_0xa8ed('0x33')]);_0x59b170[_0xa8ed('0x35')]=_[_0xa8ed('0x36')](_0x59b170[_0xa8ed('0x37')],_0x59b170[_0xa8ed('0x33')]);_0x5af371[_0xa8ed('0x44')]=_[_0xa8ed('0x36')](_0x59b170[_0xa8ed('0x37')],qs[_0xa8ed('0x38')](_0x5070bf[_0xa8ed('0x33')][_0xa8ed('0x38')]));_0x5af371[_0xa8ed('0x44')]=_0x5af371[_0xa8ed('0x44')]['length']?_0x5af371[_0xa8ed('0x44')]:_0x59b170[_0xa8ed('0x37')];_0x5af371[_0xa8ed('0x4b')]=qs['sort'](_0x5070bf[_0xa8ed('0x33')][_0xa8ed('0x4c')]);_0x5af371['where']=qs[_0xa8ed('0x35')](_['pick'](_0x5070bf[_0xa8ed('0x33')],_0x59b170[_0xa8ed('0x35')]));if(_0x5070bf[_0xa8ed('0x33')][_0xa8ed('0x3a')]){_0x5af371[_0xa8ed('0x3b')]=_[_0xa8ed('0x3c')](_0x5af371['where'],{'$or':_[_0xa8ed('0x2e')](_0x5af371[_0xa8ed('0x44')],function(_0x40e409){var _0x13b3f9={};_0x13b3f9[_0x40e409]={'$like':'%'+_0x5070bf['query'][_0xa8ed('0x3a')]+'%'};return _0x13b3f9;})});}_0x5af371=_[_0xa8ed('0x3c')]({},_0x5af371,_0x5070bf[_0xa8ed('0x3e')]);return _0x2f1d6c[_0xa8ed('0x49')](_0x5af371);}})['then'](function(_0x5e5360){if(_0x5e5360){_0x1bdc72=_0x5e5360['length'];if(!_0x5070bf[_0xa8ed('0x33')]['hasOwnProperty'](_0xa8ed('0x4d'))){_0x5af371['limit']=qs[_0xa8ed('0x21')](_0x5070bf[_0xa8ed('0x33')][_0xa8ed('0x21')]);_0x5af371['offset']=qs[_0xa8ed('0x20')](_0x5070bf[_0xa8ed('0x33')][_0xa8ed('0x20')]);}return _0x2f1d6c[_0xa8ed('0x49')](_0x5af371);}})[_0xa8ed('0x28')](function(_0x453c14){if(_0x453c14){return _0x453c14?{'count':_0x1bdc72,'rows':_0x453c14}:null;}})[_0xa8ed('0x28')](respondWithResult(_0x5dbad8,null))['catch'](handleError(_0x5dbad8,null));};exports['getSubjects']=function(_0x408fcd,_0x4e5c18,_0xd54c40){var _0x2b041e={};var _0x367501={};var _0xe978f9;var _0x387425;return db[_0xa8ed('0x2f')][_0xa8ed('0x4a')]({'where':{'id':_0x408fcd[_0xa8ed('0x43')]['id']}})[_0xa8ed('0x28')](handleEntityNotFound(_0x4e5c18,null))[_0xa8ed('0x28')](function(_0x550c78){if(_0x550c78){_0xe978f9=_0x550c78;_0x367501[_0xa8ed('0x37')]=_[_0xa8ed('0x34')](db[_0xa8ed('0x4e')][_0xa8ed('0x30')]);_0x367501[_0xa8ed('0x33')]=_[_0xa8ed('0x34')](_0x408fcd['query']);_0x367501[_0xa8ed('0x35')]=_[_0xa8ed('0x36')](_0x367501[_0xa8ed('0x37')],_0x367501['query']);_0x2b041e[_0xa8ed('0x44')]=_[_0xa8ed('0x36')](_0x367501[_0xa8ed('0x37')],qs[_0xa8ed('0x38')](_0x408fcd[_0xa8ed('0x33')]['fields']));_0x2b041e['attributes']=_0x2b041e[_0xa8ed('0x44')][_0xa8ed('0x4f')]?_0x2b041e[_0xa8ed('0x44')]:_0x367501['model'];_0x2b041e['order']=qs['sort'](_0x408fcd['query'][_0xa8ed('0x4c')]);_0x2b041e['where']=qs[_0xa8ed('0x35')](_[_0xa8ed('0x50')](_0x408fcd[_0xa8ed('0x33')],_0x367501[_0xa8ed('0x35')]));if(_0x408fcd[_0xa8ed('0x33')][_0xa8ed('0x3a')]){_0x2b041e[_0xa8ed('0x3b')]=_[_0xa8ed('0x3c')](_0x2b041e['where'],{'$or':_[_0xa8ed('0x2e')](_0x2b041e[_0xa8ed('0x44')],function(_0x1825f7){var _0x46d5a9={};_0x46d5a9[_0x1825f7]={'$like':'%'+_0x408fcd[_0xa8ed('0x33')][_0xa8ed('0x3a')]+'%'};return _0x46d5a9;})});}_0x2b041e=_[_0xa8ed('0x3c')]({},_0x2b041e,_0x408fcd[_0xa8ed('0x3e')]);return _0xe978f9[_0xa8ed('0x51')](_0x2b041e);}})['then'](function(_0x2e84e8){if(_0x2e84e8){_0x387425=_0x2e84e8[_0xa8ed('0x4f')];if(!_0x408fcd[_0xa8ed('0x33')][_0xa8ed('0x39')](_0xa8ed('0x4d'))){_0x2b041e['limit']=qs[_0xa8ed('0x21')](_0x408fcd[_0xa8ed('0x33')][_0xa8ed('0x21')]);_0x2b041e['offset']=qs[_0xa8ed('0x20')](_0x408fcd[_0xa8ed('0x33')][_0xa8ed('0x20')]);}return _0xe978f9[_0xa8ed('0x51')](_0x2b041e);}})[_0xa8ed('0x28')](function(_0x371d53){if(_0x371d53){return _0x371d53?{'count':_0x387425,'rows':_0x371d53}:null;}})[_0xa8ed('0x28')](respondWithResult(_0x4e5c18,null))[_0xa8ed('0x41')](handleError(_0x4e5c18,null));};exports['getDescriptions']=function(_0x19756e,_0x3d50d9,_0x425ace){var _0x2352bf={};var _0xa0d3f5={};var _0x4c0d85;var _0x44b85c;return db[_0xa8ed('0x2f')][_0xa8ed('0x4a')]({'where':{'id':_0x19756e[_0xa8ed('0x43')]['id']}})[_0xa8ed('0x28')](handleEntityNotFound(_0x3d50d9,null))[_0xa8ed('0x28')](function(_0x4dedfe){if(_0x4dedfe){_0x4c0d85=_0x4dedfe;_0xa0d3f5[_0xa8ed('0x37')]=_[_0xa8ed('0x34')](db['Dynamics365Field'][_0xa8ed('0x30')]);_0xa0d3f5[_0xa8ed('0x33')]=_[_0xa8ed('0x34')](_0x19756e[_0xa8ed('0x33')]);_0xa0d3f5[_0xa8ed('0x35')]=_['intersection'](_0xa0d3f5[_0xa8ed('0x37')],_0xa0d3f5[_0xa8ed('0x33')]);_0x2352bf[_0xa8ed('0x44')]=_[_0xa8ed('0x36')](_0xa0d3f5[_0xa8ed('0x37')],qs[_0xa8ed('0x38')](_0x19756e[_0xa8ed('0x33')][_0xa8ed('0x38')]));_0x2352bf[_0xa8ed('0x44')]=_0x2352bf[_0xa8ed('0x44')]['length']?_0x2352bf[_0xa8ed('0x44')]:_0xa0d3f5['model'];_0x2352bf[_0xa8ed('0x4b')]=qs[_0xa8ed('0x4c')](_0x19756e[_0xa8ed('0x33')][_0xa8ed('0x4c')]);_0x2352bf[_0xa8ed('0x3b')]=qs[_0xa8ed('0x35')](_['pick'](_0x19756e[_0xa8ed('0x33')],_0xa0d3f5[_0xa8ed('0x35')]));if(_0x19756e[_0xa8ed('0x33')][_0xa8ed('0x3a')]){_0x2352bf['where']=_[_0xa8ed('0x3c')](_0x2352bf[_0xa8ed('0x3b')],{'$or':_['map'](_0x2352bf[_0xa8ed('0x44')],function(_0x353ac3){var _0x667972={};_0x667972[_0x353ac3]={'$like':'%'+_0x19756e[_0xa8ed('0x33')]['filter']+'%'};return _0x667972;})});}_0x2352bf=_['merge']({},_0x2352bf,_0x19756e[_0xa8ed('0x3e')]);return _0x4c0d85[_0xa8ed('0x52')](_0x2352bf);}})[_0xa8ed('0x28')](function(_0x2403e2){if(_0x2403e2){_0x44b85c=_0x2403e2[_0xa8ed('0x4f')];if(!_0x19756e[_0xa8ed('0x33')][_0xa8ed('0x39')](_0xa8ed('0x4d'))){_0x2352bf['limit']=qs[_0xa8ed('0x21')](_0x19756e[_0xa8ed('0x33')]['limit']);_0x2352bf['offset']=qs['offset'](_0x19756e['query']['offset']);}return _0x4c0d85['getDescriptions'](_0x2352bf);}})['then'](function(_0x229cfa){if(_0x229cfa){return _0x229cfa?{'count':_0x44b85c,'rows':_0x229cfa}:null;}})[_0xa8ed('0x28')](respondWithResult(_0x3d50d9,null))[_0xa8ed('0x41')](handleError(_0x3d50d9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 850a261..f15cc6a 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x68e994,_0x3fe71e){var _0x2692f6=function(_0x59c55d){while(--_0x59c55d){_0x68e994['push'](_0x68e994['shift']());}};_0x2692f6(++_0x3fe71e);}(_0x54ef,0x112));var _0xf54e=function(_0x2f74cb,_0x43727c){_0x2f74cb=_0x2f74cb-0x0;var _0x5b6b5e=_0x54ef[_0x2f74cb];return _0x5b6b5e;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x405b0c,_0x24eb44){var _0x572ff0=function(_0x319c6a){while(--_0x319c6a){_0x405b0c['push'](_0x405b0c['shift']());}};_0x572ff0(++_0x24eb44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 5fd0c27..f1f81d6 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 _0x79c6=['rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2e15de,_0x3b9a6f){var _0xdaa198=function(_0x575fed){while(--_0x575fed){_0x2e15de['push'](_0x2e15de['shift']());}};_0xdaa198(++_0x3b9a6f);}(_0x79c6,0x151));var _0x679c=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x79c6[_0x3358ba];return _0x296e73;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));var moment=require(_0x679c('0x2'));var BPromise=require(_0x679c('0x3'));var rs=require(_0x679c('0x4'));var fs=require('fs');var Redis=require(_0x679c('0x5'));var db=require(_0x679c('0x6'))['db'];var utils=require(_0x679c('0x7'));var logger=require('../../config/logger')(_0x679c('0x8'));var config=require(_0x679c('0x9'));var jayson=require(_0x679c('0xa'));var client=jayson[_0x679c('0xb')][_0x679c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x76a9c4,_0xabbabb,_0x1c1968){return new BPromise(function(_0x5e1226,_0x5556c9){return client[_0x679c('0xd')](_0x76a9c4,_0x1c1968)['then'](function(_0x7f868e){logger[_0x679c('0xe')](_0x679c('0xf'),_0xabbabb,_0x679c('0x10'));logger[_0x679c('0x11')](_0x679c('0x12'),_0xabbabb,_0x679c('0x10'),JSON[_0x679c('0x13')](_0x7f868e));if(_0x7f868e[_0x679c('0x14')]){if(_0x7f868e[_0x679c('0x14')][_0x679c('0x15')]===0x1f4){logger[_0x679c('0x14')](_0x679c('0xf'),_0xabbabb,_0x7f868e['error'][_0x679c('0x16')]);return _0x5556c9(_0x7f868e[_0x679c('0x14')][_0x679c('0x16')]);}logger[_0x679c('0x14')](_0x679c('0xf'),_0xabbabb,_0x7f868e[_0x679c('0x14')][_0x679c('0x16')]);return _0x5e1226(_0x7f868e[_0x679c('0x14')]['message']);}else{logger[_0x679c('0xe')](_0x679c('0xf'),_0xabbabb,'request\x20sent');_0x5e1226(_0x7f868e['result'][_0x679c('0x16')]);}})['catch'](function(_0x209fd9){logger[_0x679c('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0xabbabb,_0x209fd9);_0x5556c9(_0x209fd9);});});} \ No newline at end of file +var _0x5f87=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2d6154,_0x4124d5){var _0x5f55c6=function(_0x8060eb){while(--_0x8060eb){_0x2d6154['push'](_0x2d6154['shift']());}};_0x5f55c6(++_0x4124d5);}(_0x5f87,0x124));var _0x75f8=function(_0xc41d48,_0x51483f){_0xc41d48=_0xc41d48-0x0;var _0x369292=_0x5f87[_0xc41d48];return _0x369292;};'use strict';var _=require(_0x75f8('0x0'));var util=require(_0x75f8('0x1'));var moment=require(_0x75f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x75f8('0x3'));var fs=require('fs');var Redis=require(_0x75f8('0x4'));var db=require(_0x75f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x75f8('0x6'))(_0x75f8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a210a,_0x248023,_0x31c189){return new BPromise(function(_0x16195b,_0x45ee41){return client[_0x75f8('0x8')](_0x4a210a,_0x31c189)[_0x75f8('0x9')](function(_0x2e8e19){logger[_0x75f8('0xa')](_0x75f8('0xb'),_0x248023,_0x75f8('0xc'));logger[_0x75f8('0xd')](_0x75f8('0xe'),_0x248023,'request\x20sent',JSON[_0x75f8('0xf')](_0x2e8e19));if(_0x2e8e19[_0x75f8('0x10')]){if(_0x2e8e19[_0x75f8('0x10')][_0x75f8('0x11')]===0x1f4){logger[_0x75f8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x248023,_0x2e8e19[_0x75f8('0x10')][_0x75f8('0x12')]);return _0x45ee41(_0x2e8e19[_0x75f8('0x10')][_0x75f8('0x12')]);}logger[_0x75f8('0x10')](_0x75f8('0xb'),_0x248023,_0x2e8e19[_0x75f8('0x10')][_0x75f8('0x12')]);return _0x16195b(_0x2e8e19['error'][_0x75f8('0x12')]);}else{logger['info'](_0x75f8('0xb'),_0x248023,'request\x20sent');_0x16195b(_0x2e8e19[_0x75f8('0x13')][_0x75f8('0x12')]);}})[_0x75f8('0x14')](function(_0x21ae02){logger[_0x75f8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x248023,_0x21ae02);_0x45ee41(_0x21ae02);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e604865..3f13e8c 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 _0x871a=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','/:id','post','update','delete','destroy','exports'];(function(_0x240e97,_0x31b643){var _0x38d32a=function(_0x3d8cfb){while(--_0x3d8cfb){_0x240e97['push'](_0x240e97['shift']());}};_0x38d32a(++_0x31b643);}(_0x871a,0x188));var _0xa871=function(_0x252782,_0x5b7839){_0x252782=_0x252782-0x0;var _0x5123ea=_0x871a[_0x252782];return _0x5123ea;};'use strict';var multer=require('multer');var util=require(_0xa871('0x0'));var path=require(_0xa871('0x1'));var timeout=require(_0xa871('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa871('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa871('0x4'));var controller=require(_0xa871('0x5'));router['get']('/',auth[_0xa871('0x6')](),controller['index']);router[_0xa871('0x7')](_0xa871('0x8'),auth[_0xa871('0x6')](),controller['show']);router[_0xa871('0x9')]('/',auth[_0xa871('0x6')](),controller['create']);router['put'](_0xa871('0x8'),auth[_0xa871('0x6')](),controller[_0xa871('0xa')]);router[_0xa871('0xb')](_0xa871('0x8'),auth[_0xa871('0x6')](),controller[_0xa871('0xc')]);module[_0xa871('0xd')]=router; \ No newline at end of file +var _0x85e5=['./intDynamics365Field.controller','get','index','/:id','isAuthenticated','create','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x78e8aa,_0x30e607){var _0x49daac=function(_0x44541e){while(--_0x44541e){_0x78e8aa['push'](_0x78e8aa['shift']());}};_0x49daac(++_0x30e607);}(_0x85e5,0x119));var _0x585e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85e5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x585e('0x0'));var path=require(_0x585e('0x1'));var timeout=require(_0x585e('0x2'));var express=require('express');var router=express[_0x585e('0x3')]();var fs_extra=require(_0x585e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x585e('0x5'));var config=require(_0x585e('0x6'));var controller=require(_0x585e('0x7'));router[_0x585e('0x8')]('/',auth['isAuthenticated'](),controller[_0x585e('0x9')]);router[_0x585e('0x8')](_0x585e('0xa'),auth[_0x585e('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x585e('0xc')]);router['put'](_0x585e('0xa'),auth[_0x585e('0xb')](),controller[_0x585e('0xd')]);router['delete']('/:id',auth[_0x585e('0xb')](),controller[_0x585e('0xe')]);module[_0x585e('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 c34d92c..28e9859 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 _0x47a5=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x116ce6,_0x47adf3){var _0x1cda4b=function(_0x115f41){while(--_0x115f41){_0x116ce6['push'](_0x116ce6['shift']());}};_0x1cda4b(++_0x47adf3);}(_0x47a5,0x137));var _0x547a=function(_0x3bddd8,_0x4e2ddf){_0x3bddd8=_0x3bddd8-0x0;var _0xf2e1ab=_0x47a5[_0x3bddd8];return _0xf2e1ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x547a('0x0')](_0x547a('0x1'),_0x547a('0x2'),_0x547a('0x3'),_0x547a('0x4'),_0x547a('0x5')),'defaultValue':_0x547a('0x1')},'content':{'type':Sequelize[_0x547a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x547a('0x1'),_0x547a('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x547a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x870d=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4874b4,_0x576156){var _0x186617=function(_0x187743){while(--_0x187743){_0x4874b4['push'](_0x4874b4['shift']());}};_0x186617(++_0x576156);}(_0x870d,0x133));var _0xd870=function(_0x119909,_0x1a2812){_0x119909=_0x119909-0x0;var _0x2dd602=_0x870d[_0x119909];return _0x2dd602;};'use strict';var Sequelize=require(_0xd870('0x0'));module[_0xd870('0x1')]={'type':{'type':Sequelize[_0xd870('0x2')](_0xd870('0x3'),_0xd870('0x4'),_0xd870('0x5'),_0xd870('0x6'),_0xd870('0x7')),'defaultValue':_0xd870('0x3')},'content':{'type':Sequelize[_0xd870('0x8')]},'key':{'type':Sequelize[_0xd870('0x8')]},'keyType':{'type':Sequelize[_0xd870('0x2')](_0xd870('0x3'),_0xd870('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd870('0x8')]},'idField':{'type':Sequelize[_0xd870('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd870('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index edaadf8..ae32bab 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 _0xad18=['params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0xad18,0x131));var _0x8ad1=function(_0x268916,_0x1c27e1){_0x268916=_0x268916-0x0;var _0x38f8a4=_0xad18[_0x268916];return _0x38f8a4;};'use strict';var emlformat=require(_0x8ad1('0x0'));var rimraf=require(_0x8ad1('0x1'));var zipdir=require(_0x8ad1('0x2'));var jsonpatch=require(_0x8ad1('0x3'));var rp=require(_0x8ad1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ad1('0x5'));var util=require(_0x8ad1('0x6'));var path=require(_0x8ad1('0x7'));var sox=require(_0x8ad1('0x8'));var csv=require(_0x8ad1('0x9'));var ejs=require(_0x8ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x8ad1('0xb'));var _=require(_0x8ad1('0xc'));var squel=require(_0x8ad1('0xd'));var crypto=require(_0x8ad1('0xe'));var jsforce=require(_0x8ad1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8ad1('0x9'));var querystring=require(_0x8ad1('0x10'));var Papa=require(_0x8ad1('0x11'));var Redis=require(_0x8ad1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8ad1('0x13'));var as=require(_0x8ad1('0x14'));var hardwareService=require(_0x8ad1('0x15'));var logger=require(_0x8ad1('0x16'))(_0x8ad1('0x17'));var utils=require('../../config/utils');var config=require(_0x8ad1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ad1('0x19'))['db'];function respondWithStatusCode(_0x122c4c,_0x2a25a9){_0x2a25a9=_0x2a25a9||0xcc;return function(_0xf46c07){if(_0xf46c07){return _0x122c4c[_0x8ad1('0x1a')](_0x2a25a9);}return _0x122c4c[_0x8ad1('0x1b')](_0x2a25a9)[_0x8ad1('0x1c')]();};}function respondWithResult(_0x5db1cf,_0x303664){_0x303664=_0x303664||0xc8;return function(_0x288d15){if(_0x288d15){return _0x5db1cf[_0x8ad1('0x1b')](_0x303664)[_0x8ad1('0x1d')](_0x288d15);}};}function respondWithFilteredResult(_0x4f4f77,_0xc8aa7){return function(_0x3872a9){if(_0x3872a9){var _0x1e836b=typeof _0xc8aa7['offset']===_0x8ad1('0x1e')&&typeof _0xc8aa7['limit']==='undefined';var _0x4cf359=_0x3872a9[_0x8ad1('0x1f')];var _0x4e80c7=_0x1e836b?0x0:_0xc8aa7[_0x8ad1('0x20')];var _0x551612=_0x1e836b?_0x3872a9[_0x8ad1('0x1f')]:_0xc8aa7[_0x8ad1('0x20')]+_0xc8aa7[_0x8ad1('0x21')];var _0xad9a2;if(_0x551612>=_0x4cf359){_0x551612=_0x4cf359;_0xad9a2=0xc8;}else{_0xad9a2=0xce;}_0x4f4f77[_0x8ad1('0x1b')](_0xad9a2);return _0x4f4f77[_0x8ad1('0x22')](_0x8ad1('0x23'),_0x4e80c7+'-'+_0x551612+'/'+_0x4cf359)[_0x8ad1('0x1d')](_0x3872a9);}return null;};}function patchUpdates(_0x1b2fe1){return function(_0x8724ea){try{jsonpatch[_0x8ad1('0x24')](_0x8724ea,_0x1b2fe1,!![]);}catch(_0x5f55d4){return BPromise[_0x8ad1('0x25')](_0x5f55d4);}return _0x8724ea['save']();};}function saveUpdates(_0x5a6eb3,_0x2632d){return function(_0x2f430a){if(_0x2f430a){return _0x2f430a[_0x8ad1('0x26')](_0x5a6eb3)[_0x8ad1('0x27')](function(_0x1e0963){return _0x1e0963;});}return null;};}function removeEntity(_0x13bd04,_0x20efce){return function(_0x372833){if(_0x372833){return _0x372833['destroy']()[_0x8ad1('0x27')](function(){_0x13bd04['status'](0xcc)[_0x8ad1('0x1c')]();});}};}function handleEntityNotFound(_0x2feeb0,_0x300d17){return function(_0x1a03eb){if(!_0x1a03eb){_0x2feeb0['sendStatus'](0x194);}return _0x1a03eb;};}function handleError(_0x9dd0ca,_0x53f125){_0x53f125=_0x53f125||0x1f4;return function(_0x170eb1){logger[_0x8ad1('0x28')](_0x170eb1[_0x8ad1('0x29')]);if(_0x170eb1['name']){delete _0x170eb1[_0x8ad1('0x2a')];}_0x9dd0ca[_0x8ad1('0x1b')](_0x53f125)[_0x8ad1('0x2b')](_0x170eb1);};}exports['index']=function(_0x2b20ac,_0x47ab7d){var _0x24646b={},_0x340acc={},_0x5be269={'count':0x0,'rows':[]};var _0xe0276c=_[_0x8ad1('0x2c')](db[_0x8ad1('0x2d')][_0x8ad1('0x2e')],function(_0xf80767){return{'name':_0xf80767[_0x8ad1('0x2f')],'type':_0xf80767[_0x8ad1('0x30')][_0x8ad1('0x31')]};});_0x340acc[_0x8ad1('0x32')]=_[_0x8ad1('0x2c')](_0xe0276c,'name');_0x340acc[_0x8ad1('0x33')]=_[_0x8ad1('0x34')](_0x2b20ac[_0x8ad1('0x33')]);_0x340acc[_0x8ad1('0x35')]=_[_0x8ad1('0x36')](_0x340acc[_0x8ad1('0x32')],_0x340acc[_0x8ad1('0x33')]);_0x24646b[_0x8ad1('0x37')]=_['intersection'](_0x340acc[_0x8ad1('0x32')],qs[_0x8ad1('0x38')](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x38')]));_0x24646b[_0x8ad1('0x37')]=_0x24646b[_0x8ad1('0x37')][_0x8ad1('0x39')]?_0x24646b[_0x8ad1('0x37')]:_0x340acc['model'];if(!_0x2b20ac['query']['hasOwnProperty'](_0x8ad1('0x3a'))){_0x24646b[_0x8ad1('0x21')]=qs[_0x8ad1('0x21')](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x21')]);_0x24646b[_0x8ad1('0x20')]=qs['offset'](_0x2b20ac['query'][_0x8ad1('0x20')]);}_0x24646b['order']=qs['sort'](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x3b')]);_0x24646b[_0x8ad1('0x3c')]=qs[_0x8ad1('0x35')](_['pick'](_0x2b20ac[_0x8ad1('0x33')],_0x340acc[_0x8ad1('0x35')]),_0xe0276c);if(_0x2b20ac['query'][_0x8ad1('0x3d')]){_0x24646b[_0x8ad1('0x3c')]=_[_0x8ad1('0x3e')](_0x24646b['where'],{'$or':_['map'](_0xe0276c,function(_0x4c0b49){if(_0x4c0b49[_0x8ad1('0x30')]!=='VIRTUAL'){var _0x7fa97c={};_0x7fa97c[_0x4c0b49[_0x8ad1('0x2a')]]={'$like':'%'+_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x3d')]+'%'};return _0x7fa97c;}})});}_0x24646b=_[_0x8ad1('0x3e')]({},_0x24646b,_0x2b20ac[_0x8ad1('0x3f')]);var _0x2d5c6b={'where':_0x24646b[_0x8ad1('0x3c')]};return db[_0x8ad1('0x2d')][_0x8ad1('0x1f')](_0x2d5c6b)[_0x8ad1('0x27')](function(_0x1464b8){_0x5be269['count']=_0x1464b8;if(_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x40')]){_0x24646b[_0x8ad1('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x8ad1('0x42')](_0x24646b);})[_0x8ad1('0x27')](function(_0x45fba5){_0x5be269[_0x8ad1('0x43')]=_0x45fba5;return _0x5be269;})['then'](respondWithFilteredResult(_0x47ab7d,_0x24646b))[_0x8ad1('0x44')](handleError(_0x47ab7d,null));};exports[_0x8ad1('0x45')]=function(_0x17e799,_0x1a54ef){var _0x2ca95a={'raw':!![],'where':{'id':_0x17e799[_0x8ad1('0x46')]['id']}},_0x5a939d={};_0x5a939d['model']=_[_0x8ad1('0x34')](db['Dynamics365Field'][_0x8ad1('0x2e')]);_0x5a939d[_0x8ad1('0x33')]=_[_0x8ad1('0x34')](_0x17e799[_0x8ad1('0x33')]);_0x5a939d['filters']=_['intersection'](_0x5a939d[_0x8ad1('0x32')],_0x5a939d[_0x8ad1('0x33')]);_0x2ca95a[_0x8ad1('0x37')]=_[_0x8ad1('0x36')](_0x5a939d[_0x8ad1('0x32')],qs[_0x8ad1('0x38')](_0x17e799['query'][_0x8ad1('0x38')]));_0x2ca95a['attributes']=_0x2ca95a['attributes'][_0x8ad1('0x39')]?_0x2ca95a['attributes']:_0x5a939d[_0x8ad1('0x32')];if(_0x17e799[_0x8ad1('0x33')][_0x8ad1('0x40')]){_0x2ca95a['include']=[{'all':!![]}];}_0x2ca95a=_[_0x8ad1('0x3e')]({},_0x2ca95a,_0x17e799[_0x8ad1('0x3f')]);return db[_0x8ad1('0x2d')][_0x8ad1('0x47')](_0x2ca95a)['then'](handleEntityNotFound(_0x1a54ef,null))[_0x8ad1('0x27')](respondWithResult(_0x1a54ef,null))[_0x8ad1('0x44')](handleError(_0x1a54ef,null));};exports[_0x8ad1('0x48')]=function(_0x184b1d,_0x707a0){return db[_0x8ad1('0x2d')][_0x8ad1('0x48')](_0x184b1d['body'],{})[_0x8ad1('0x27')](respondWithResult(_0x707a0,0xc9))[_0x8ad1('0x44')](handleError(_0x707a0,null));};exports[_0x8ad1('0x26')]=function(_0x5a433d,_0x2ee4cd){if(_0x5a433d[_0x8ad1('0x49')]['id']){delete _0x5a433d[_0x8ad1('0x49')]['id'];}return db[_0x8ad1('0x2d')][_0x8ad1('0x47')]({'where':{'id':_0x5a433d[_0x8ad1('0x46')]['id']}})[_0x8ad1('0x27')](handleEntityNotFound(_0x2ee4cd,null))[_0x8ad1('0x27')](saveUpdates(_0x5a433d[_0x8ad1('0x49')],null))[_0x8ad1('0x27')](respondWithResult(_0x2ee4cd,null))[_0x8ad1('0x44')](handleError(_0x2ee4cd,null));};exports[_0x8ad1('0x4a')]=function(_0x3318cb,_0x126659){return db['Dynamics365Field'][_0x8ad1('0x47')]({'where':{'id':_0x3318cb[_0x8ad1('0x46')]['id']}})['then'](handleEntityNotFound(_0x126659,null))[_0x8ad1('0x27')](removeEntity(_0x126659,null))[_0x8ad1('0x44')](handleError(_0x126659,null));}; \ No newline at end of file +var _0xa2c2=['error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','Dynamics365Field','includeAll','include','rows','show','params','rawAttributes','length','options','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa2c2,0xb6));var _0x2a2c=function(_0x474cca,_0x51e923){_0x474cca=_0x474cca-0x0;var _0x5659bc=_0xa2c2[_0x474cca];return _0x5659bc;};'use strict';var emlformat=require(_0x2a2c('0x0'));var rimraf=require(_0x2a2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a2c('0x2'));var rp=require('request-promise');var moment=require(_0x2a2c('0x3'));var BPromise=require(_0x2a2c('0x4'));var Mustache=require('mustache');var util=require(_0x2a2c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2a2c('0x6'));var ejs=require(_0x2a2c('0x7'));var fs=require('fs');var fs_extra=require(_0x2a2c('0x8'));var _=require(_0x2a2c('0x9'));var squel=require(_0x2a2c('0xa'));var crypto=require(_0x2a2c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a2c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a2c('0xd'));var Papa=require(_0x2a2c('0xe'));var Redis=require(_0x2a2c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2a2c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a2c('0x11'));var logger=require(_0x2a2c('0x12'))(_0x2a2c('0x13'));var utils=require(_0x2a2c('0x14'));var config=require(_0x2a2c('0x15'));var licenseUtil=require(_0x2a2c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ba1d7,_0x4b3b06){_0x4b3b06=_0x4b3b06||0xcc;return function(_0x606adf){if(_0x606adf){return _0x3ba1d7[_0x2a2c('0x17')](_0x4b3b06);}return _0x3ba1d7[_0x2a2c('0x18')](_0x4b3b06)[_0x2a2c('0x19')]();};}function respondWithResult(_0x17b18e,_0x661c80){_0x661c80=_0x661c80||0xc8;return function(_0x39611d){if(_0x39611d){return _0x17b18e[_0x2a2c('0x18')](_0x661c80)['json'](_0x39611d);}};}function respondWithFilteredResult(_0x4e94fa,_0x543a2a){return function(_0x204639){if(_0x204639){var _0x1aceff=typeof _0x543a2a[_0x2a2c('0x1a')]===_0x2a2c('0x1b')&&typeof _0x543a2a[_0x2a2c('0x1c')]===_0x2a2c('0x1b');var _0x38b94d=_0x204639[_0x2a2c('0x1d')];var _0x26b380=_0x1aceff?0x0:_0x543a2a[_0x2a2c('0x1a')];var _0x561130=_0x1aceff?_0x204639[_0x2a2c('0x1d')]:_0x543a2a[_0x2a2c('0x1a')]+_0x543a2a[_0x2a2c('0x1c')];var _0x2042a4;if(_0x561130>=_0x38b94d){_0x561130=_0x38b94d;_0x2042a4=0xc8;}else{_0x2042a4=0xce;}_0x4e94fa['status'](_0x2042a4);return _0x4e94fa['set'](_0x2a2c('0x1e'),_0x26b380+'-'+_0x561130+'/'+_0x38b94d)[_0x2a2c('0x1f')](_0x204639);}return null;};}function patchUpdates(_0x3bb1e0){return function(_0x23bbbe){try{jsonpatch[_0x2a2c('0x20')](_0x23bbbe,_0x3bb1e0,!![]);}catch(_0x32ed44){return BPromise[_0x2a2c('0x21')](_0x32ed44);}return _0x23bbbe[_0x2a2c('0x22')]();};}function saveUpdates(_0x4a34db,_0x6f85a6){return function(_0x33f00a){if(_0x33f00a){return _0x33f00a['update'](_0x4a34db)[_0x2a2c('0x23')](function(_0x214f11){return _0x214f11;});}return null;};}function removeEntity(_0xf989e9,_0x50ce91){return function(_0x56327d){if(_0x56327d){return _0x56327d[_0x2a2c('0x24')]()['then'](function(){_0xf989e9[_0x2a2c('0x18')](0xcc)[_0x2a2c('0x19')]();});}};}function handleEntityNotFound(_0x392cff,_0x21afd6){return function(_0x4af00c){if(!_0x4af00c){_0x392cff[_0x2a2c('0x17')](0x194);}return _0x4af00c;};}function handleError(_0x5fbf99,_0x41ac46){_0x41ac46=_0x41ac46||0x1f4;return function(_0x196fa6){logger[_0x2a2c('0x25')](_0x196fa6['stack']);if(_0x196fa6[_0x2a2c('0x26')]){delete _0x196fa6['name'];}_0x5fbf99[_0x2a2c('0x18')](_0x41ac46)[_0x2a2c('0x27')](_0x196fa6);};}exports[_0x2a2c('0x28')]=function(_0x3823d2,_0x229546){var _0x4df91a={},_0x2a7ea0={},_0x1094aa={'count':0x0,'rows':[]};var _0x165517=_[_0x2a2c('0x29')](db['Dynamics365Field']['rawAttributes'],function(_0x2ca340){return{'name':_0x2ca340[_0x2a2c('0x2a')],'type':_0x2ca340[_0x2a2c('0x2b')][_0x2a2c('0x2c')]};});_0x2a7ea0[_0x2a2c('0x2d')]=_[_0x2a2c('0x29')](_0x165517,_0x2a2c('0x26'));_0x2a7ea0[_0x2a2c('0x2e')]=_[_0x2a2c('0x2f')](_0x3823d2[_0x2a2c('0x2e')]);_0x2a7ea0[_0x2a2c('0x30')]=_[_0x2a2c('0x31')](_0x2a7ea0[_0x2a2c('0x2d')],_0x2a7ea0[_0x2a2c('0x2e')]);_0x4df91a[_0x2a2c('0x32')]=_['intersection'](_0x2a7ea0[_0x2a2c('0x2d')],qs['fields'](_0x3823d2['query'][_0x2a2c('0x33')]));_0x4df91a[_0x2a2c('0x32')]=_0x4df91a['attributes']['length']?_0x4df91a[_0x2a2c('0x32')]:_0x2a7ea0['model'];if(!_0x3823d2[_0x2a2c('0x2e')][_0x2a2c('0x34')](_0x2a2c('0x35'))){_0x4df91a['limit']=qs[_0x2a2c('0x1c')](_0x3823d2['query'][_0x2a2c('0x1c')]);_0x4df91a[_0x2a2c('0x1a')]=qs[_0x2a2c('0x1a')](_0x3823d2['query'][_0x2a2c('0x1a')]);}_0x4df91a[_0x2a2c('0x36')]=qs[_0x2a2c('0x37')](_0x3823d2[_0x2a2c('0x2e')][_0x2a2c('0x37')]);_0x4df91a[_0x2a2c('0x38')]=qs[_0x2a2c('0x30')](_['pick'](_0x3823d2[_0x2a2c('0x2e')],_0x2a7ea0[_0x2a2c('0x30')]),_0x165517);if(_0x3823d2[_0x2a2c('0x2e')][_0x2a2c('0x39')]){_0x4df91a['where']=_[_0x2a2c('0x3a')](_0x4df91a[_0x2a2c('0x38')],{'$or':_[_0x2a2c('0x29')](_0x165517,function(_0x157b24){if(_0x157b24[_0x2a2c('0x2b')]!=='VIRTUAL'){var _0x4f44b7={};_0x4f44b7[_0x157b24[_0x2a2c('0x26')]]={'$like':'%'+_0x3823d2['query'][_0x2a2c('0x39')]+'%'};return _0x4f44b7;}})});}_0x4df91a=_[_0x2a2c('0x3a')]({},_0x4df91a,_0x3823d2['options']);var _0x5041ca={'where':_0x4df91a[_0x2a2c('0x38')]};return db[_0x2a2c('0x3b')][_0x2a2c('0x1d')](_0x5041ca)['then'](function(_0x1e5a41){_0x1094aa[_0x2a2c('0x1d')]=_0x1e5a41;if(_0x3823d2[_0x2a2c('0x2e')][_0x2a2c('0x3c')]){_0x4df91a[_0x2a2c('0x3d')]=[{'all':!![]}];}return db[_0x2a2c('0x3b')]['findAll'](_0x4df91a);})['then'](function(_0xd7b4c1){_0x1094aa[_0x2a2c('0x3e')]=_0xd7b4c1;return _0x1094aa;})[_0x2a2c('0x23')](respondWithFilteredResult(_0x229546,_0x4df91a))['catch'](handleError(_0x229546,null));};exports[_0x2a2c('0x3f')]=function(_0x28466,_0x212550){var _0x594026={'raw':!![],'where':{'id':_0x28466[_0x2a2c('0x40')]['id']}},_0x2167b2={};_0x2167b2[_0x2a2c('0x2d')]=_[_0x2a2c('0x2f')](db[_0x2a2c('0x3b')][_0x2a2c('0x41')]);_0x2167b2[_0x2a2c('0x2e')]=_[_0x2a2c('0x2f')](_0x28466['query']);_0x2167b2[_0x2a2c('0x30')]=_[_0x2a2c('0x31')](_0x2167b2['model'],_0x2167b2[_0x2a2c('0x2e')]);_0x594026[_0x2a2c('0x32')]=_[_0x2a2c('0x31')](_0x2167b2[_0x2a2c('0x2d')],qs[_0x2a2c('0x33')](_0x28466[_0x2a2c('0x2e')][_0x2a2c('0x33')]));_0x594026[_0x2a2c('0x32')]=_0x594026[_0x2a2c('0x32')][_0x2a2c('0x42')]?_0x594026[_0x2a2c('0x32')]:_0x2167b2[_0x2a2c('0x2d')];if(_0x28466[_0x2a2c('0x2e')][_0x2a2c('0x3c')]){_0x594026[_0x2a2c('0x3d')]=[{'all':!![]}];}_0x594026=_[_0x2a2c('0x3a')]({},_0x594026,_0x28466[_0x2a2c('0x43')]);return db[_0x2a2c('0x3b')][_0x2a2c('0x44')](_0x594026)['then'](handleEntityNotFound(_0x212550,null))[_0x2a2c('0x23')](respondWithResult(_0x212550,null))[_0x2a2c('0x45')](handleError(_0x212550,null));};exports[_0x2a2c('0x46')]=function(_0x16a536,_0x4a80f2){return db[_0x2a2c('0x3b')][_0x2a2c('0x46')](_0x16a536[_0x2a2c('0x47')],{})[_0x2a2c('0x23')](respondWithResult(_0x4a80f2,0xc9))[_0x2a2c('0x45')](handleError(_0x4a80f2,null));};exports[_0x2a2c('0x48')]=function(_0x185990,_0x489546){if(_0x185990[_0x2a2c('0x47')]['id']){delete _0x185990[_0x2a2c('0x47')]['id'];}return db[_0x2a2c('0x3b')][_0x2a2c('0x44')]({'where':{'id':_0x185990['params']['id']}})['then'](handleEntityNotFound(_0x489546,null))[_0x2a2c('0x23')](saveUpdates(_0x185990['body'],null))[_0x2a2c('0x23')](respondWithResult(_0x489546,null))['catch'](handleError(_0x489546,null));};exports[_0x2a2c('0x24')]=function(_0x51b72b,_0xd145bf){return db[_0x2a2c('0x3b')][_0x2a2c('0x44')]({'where':{'id':_0x51b72b['params']['id']}})['then'](handleEntityNotFound(_0xd145bf,null))[_0x2a2c('0x23')](removeEntity(_0xd145bf,null))['catch'](handleError(_0xd145bf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8414eb2..400a4bd 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 _0x2f94=['exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x2f94,0x157));var _0x42f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2f94[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x42f9('0x0'));var util=require(_0x42f9('0x1'));var logger=require('../../config/logger')(_0x42f9('0x2'));var moment=require(_0x42f9('0x3'));var BPromise=require(_0x42f9('0x4'));var rp=require(_0x42f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x42f9('0x7'));module[_0x42f9('0x8')]=function(_0x2923b9,_0xbbaca){return _0x2923b9[_0x42f9('0x9')](_0x42f9('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x42f9('0xb'),'fields':[_0x42f9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2884=['Dynamics365Field','dynamics365_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0x2884,0x107));var _0x4288=function(_0x25ea25,_0x1e6541){_0x25ea25=_0x25ea25-0x0;var _0x150ba9=_0x2884[_0x25ea25];return _0x150ba9;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4288('0x1'));var moment=require('moment');var BPromise=require(_0x4288('0x2'));var rp=require(_0x4288('0x3'));var fs=require('fs');var path=require(_0x4288('0x4'));var rimraf=require(_0x4288('0x5'));var config=require(_0x4288('0x6'));var attributes=require(_0x4288('0x7'));module[_0x4288('0x8')]=function(_0x3fda5c,_0x24413f){return _0x3fda5c[_0x4288('0x9')](_0x4288('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4288('0xb'),'fields':['idField',_0x4288('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index fb5cfc4..00b05d1 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 _0x8de0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x6949f1,_0x106daa){var _0x2d7590=function(_0x4c495c){while(--_0x4c495c){_0x6949f1['push'](_0x6949f1['shift']());}};_0x2d7590(++_0x106daa);}(_0x8de0,0x1b0));var _0x08de=function(_0x3f29e9,_0xc339d){_0x3f29e9=_0x3f29e9-0x0;var _0x124174=_0x8de0[_0x3f29e9];return _0x124174;};'use strict';var _=require(_0x08de('0x0'));var util=require('util');var moment=require(_0x08de('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08de('0x2'));var db=require(_0x08de('0x3'))['db'];var utils=require(_0x08de('0x4'));var logger=require('../../config/logger')(_0x08de('0x5'));var config=require(_0x08de('0x6'));var jayson=require(_0x08de('0x7'));var client=jayson[_0x08de('0x8')][_0x08de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380451,_0x1f4638,_0xff38bd){return new BPromise(function(_0x536fd4,_0x3a2773){return client[_0x08de('0xa')](_0x380451,_0xff38bd)[_0x08de('0xb')](function(_0x5b4578){logger[_0x08de('0xc')](_0x08de('0xd'),_0x1f4638,'request\x20sent');logger[_0x08de('0xe')](_0x08de('0xf'),_0x1f4638,'request\x20sent',JSON['stringify'](_0x5b4578));if(_0x5b4578[_0x08de('0x10')]){if(_0x5b4578[_0x08de('0x10')]['code']===0x1f4){logger[_0x08de('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x1f4638,_0x5b4578['error'][_0x08de('0x11')]);return _0x3a2773(_0x5b4578[_0x08de('0x10')][_0x08de('0x11')]);}logger[_0x08de('0x10')](_0x08de('0xd'),_0x1f4638,_0x5b4578[_0x08de('0x10')]['message']);return _0x536fd4(_0x5b4578[_0x08de('0x10')][_0x08de('0x11')]);}else{logger[_0x08de('0xc')](_0x08de('0xd'),_0x1f4638,'request\x20sent');_0x536fd4(_0x5b4578[_0x08de('0x12')][_0x08de('0x11')]);}})['catch'](function(_0x13f355){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1f4638,_0x13f355);_0x3a2773(_0x13f355);});});} \ No newline at end of file +var _0x1818=['client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b0be9,_0xefdac){var _0x48c0eb=function(_0x38f789){while(--_0x38f789){_0x2b0be9['push'](_0x2b0be9['shift']());}};_0x48c0eb(++_0xefdac);}(_0x1818,0x1eb));var _0x8181=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x1818[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0x8181('0x0'));var util=require(_0x8181('0x1'));var moment=require(_0x8181('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8181('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8181('0x4'));var logger=require(_0x8181('0x5'))(_0x8181('0x6'));var config=require(_0x8181('0x7'));var jayson=require(_0x8181('0x8'));var client=jayson[_0x8181('0x9')][_0x8181('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5887,_0x424888,_0x3990c5){return new BPromise(function(_0x1a8638,_0x20fa72){return client[_0x8181('0xb')](_0x4b5887,_0x3990c5)[_0x8181('0xc')](function(_0x28602d){logger['info'](_0x8181('0xd'),_0x424888,'request\x20sent');logger[_0x8181('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x424888,_0x8181('0xf'),JSON['stringify'](_0x28602d));if(_0x28602d[_0x8181('0x10')]){if(_0x28602d[_0x8181('0x10')][_0x8181('0x11')]===0x1f4){logger[_0x8181('0x10')](_0x8181('0xd'),_0x424888,_0x28602d[_0x8181('0x10')][_0x8181('0x12')]);return _0x20fa72(_0x28602d[_0x8181('0x10')][_0x8181('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x424888,_0x28602d['error'][_0x8181('0x12')]);return _0x1a8638(_0x28602d[_0x8181('0x10')][_0x8181('0x12')]);}else{logger[_0x8181('0x13')](_0x8181('0xd'),_0x424888,_0x8181('0xf'));_0x1a8638(_0x28602d['result'][_0x8181('0x12')]);}})['catch'](function(_0x1d6462){logger[_0x8181('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x424888,_0x1d6462);_0x20fa72(_0x1d6462);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 41c21cb..93b70b7 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 _0x5875=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x3af9f1,_0x37a0e2){var _0x15004d=function(_0x4320b8){while(--_0x4320b8){_0x3af9f1['push'](_0x3af9f1['shift']());}};_0x15004d(++_0x37a0e2);}(_0x5875,0xf7));var _0x5587=function(_0x15103f,_0x9caa2){_0x15103f=_0x15103f-0x0;var _0x4c4a6b=_0x5875[_0x15103f];return _0x4c4a6b;};'use strict';var multer=require(_0x5587('0x0'));var util=require('util');var path=require(_0x5587('0x1'));var timeout=require(_0x5587('0x2'));var express=require(_0x5587('0x3'));var router=express['Router']();var fs_extra=require(_0x5587('0x4'));var auth=require(_0x5587('0x5'));var interaction=require(_0x5587('0x6'));var config=require('../../config/environment');var controller=require(_0x5587('0x7'));router[_0x5587('0x8')]('/',auth[_0x5587('0x9')](),controller[_0x5587('0xa')]);router['get']('/:id',auth[_0x5587('0x9')](),controller[_0x5587('0xb')]);router[_0x5587('0x8')](_0x5587('0xc'),auth[_0x5587('0x9')](),controller[_0x5587('0xd')]);router[_0x5587('0x8')](_0x5587('0xe'),auth['isAuthenticated'](),controller[_0x5587('0xf')]);router[_0x5587('0x10')]('/',auth[_0x5587('0x9')](),controller[_0x5587('0x11')]);router[_0x5587('0x10')](_0x5587('0xc'),auth['isAuthenticated'](),controller[_0x5587('0x12')]);router[_0x5587('0x13')]('/:id',auth[_0x5587('0x9')](),controller[_0x5587('0x14')]);router[_0x5587('0x15')](_0x5587('0x16'),auth['isAuthenticated'](),controller[_0x5587('0x17')]);module[_0x5587('0x18')]=router; \ No newline at end of file +var _0x35af=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x1b7741,_0x57bb27){var _0x5a7f5a=function(_0xe18049){while(--_0xe18049){_0x1b7741['push'](_0x1b7741['shift']());}};_0x5a7f5a(++_0x57bb27);}(_0x35af,0x108));var _0xf35a=function(_0x36b576,_0x25c089){_0x36b576=_0x36b576-0x0;var _0x37566c=_0x35af[_0x36b576];return _0x37566c;};'use strict';var multer=require(_0xf35a('0x0'));var util=require(_0xf35a('0x1'));var path=require(_0xf35a('0x2'));var timeout=require(_0xf35a('0x3'));var express=require(_0xf35a('0x4'));var router=express[_0xf35a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf35a('0x6'));var interaction=require(_0xf35a('0x7'));var config=require('../../config/environment');var controller=require(_0xf35a('0x8'));router[_0xf35a('0x9')]('/',auth[_0xf35a('0xa')](),controller[_0xf35a('0xb')]);router[_0xf35a('0x9')](_0xf35a('0xc'),auth[_0xf35a('0xa')](),controller[_0xf35a('0xd')]);router[_0xf35a('0x9')](_0xf35a('0xe'),auth[_0xf35a('0xa')](),controller[_0xf35a('0xf')]);router[_0xf35a('0x9')](_0xf35a('0x10'),auth['isAuthenticated'](),controller[_0xf35a('0x11')]);router[_0xf35a('0x12')]('/',auth[_0xf35a('0xa')](),controller[_0xf35a('0x13')]);router[_0xf35a('0x12')](_0xf35a('0xe'),auth[_0xf35a('0xa')](),controller[_0xf35a('0x14')]);router[_0xf35a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf35a('0x16')]);router['delete'](_0xf35a('0xc'),auth['isAuthenticated'](),controller[_0xf35a('0x17')]);module[_0xf35a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ac726eb..6a22f33 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 _0xfff0=['username','exports','STRING'];(function(_0x22df9f,_0x9ec477){var _0x4ed906=function(_0x3bdb69){while(--_0x3bdb69){_0x22df9f['push'](_0x22df9f['shift']());}};_0x4ed906(++_0x9ec477);}(_0xfff0,0x139));var _0x0fff=function(_0x3679db,_0x1c3a2f){_0x3679db=_0x3679db-0x0;var _0x5a6212=_0xfff0[_0x3679db];return _0x5a6212;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x185f72,_0x521737){var _0x4b9d08=function(_0x4ef38c){while(--_0x4ef38c){_0x185f72['push'](_0x185f72['shift']());}};_0x4b9d08(++_0x521737);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0x0b0e[_0x4e6cbb];return _0x15ced4;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('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 1eea589..3f13349 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 _0x453b=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit','order','sort','filters','filter','where','merge','include','findAll','rows','show','params','rawAttributes','length','includeAll','options','find','catch','create','body','getConfigurations','FreshdeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','source','group','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2f31d0,_0x4fce9a){var _0x1d0256=function(_0x3f1ed5){while(--_0x3f1ed5){_0x2f31d0['push'](_0x2f31d0['shift']());}};_0x1d0256(++_0x4fce9a);}(_0x453b,0x164));var _0xb453=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x453b[_0x1857d0];return _0x3e3c46;};'use strict';var emlformat=require(_0xb453('0x0'));var rimraf=require(_0xb453('0x1'));var zipdir=require(_0xb453('0x2'));var jsonpatch=require(_0xb453('0x3'));var rp=require(_0xb453('0x4'));var moment=require(_0xb453('0x5'));var BPromise=require(_0xb453('0x6'));var Mustache=require(_0xb453('0x7'));var util=require(_0xb453('0x8'));var path=require(_0xb453('0x9'));var sox=require(_0xb453('0xa'));var csv=require(_0xb453('0xb'));var ejs=require(_0xb453('0xc'));var fs=require('fs');var fs_extra=require(_0xb453('0xd'));var _=require(_0xb453('0xe'));var squel=require(_0xb453('0xf'));var crypto=require('crypto');var jsforce=require(_0xb453('0x10'));var deskjs=require(_0xb453('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb453('0x12'));var Papa=require('papaparse');var Redis=require(_0xb453('0x13'));var authService=require(_0xb453('0x14'));var qs=require(_0xb453('0x15'));var as=require(_0xb453('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb453('0x17'))(_0xb453('0x18'));var utils=require(_0xb453('0x19'));var config=require(_0xb453('0x1a'));var licenseUtil=require(_0xb453('0x1b'));var db=require(_0xb453('0x1c'))['db'];var integrations=require(_0xb453('0x1d'));function respondWithStatusCode(_0x22e39b,_0x2d24b9){_0x2d24b9=_0x2d24b9||0xcc;return function(_0x5deeab){if(_0x5deeab){return _0x22e39b['sendStatus'](_0x2d24b9);}return _0x22e39b['status'](_0x2d24b9)[_0xb453('0x1e')]();};}function respondWithResult(_0x50d908,_0x3853fb){_0x3853fb=_0x3853fb||0xc8;return function(_0x3cd12d){if(_0x3cd12d){return _0x50d908[_0xb453('0x1f')](_0x3853fb)['json'](_0x3cd12d);}};}function respondWithFilteredResult(_0x5ee747,_0x30550b){return function(_0x376b8e){if(_0x376b8e){var _0x1f8b95=typeof _0x30550b[_0xb453('0x20')]===_0xb453('0x21')&&typeof _0x30550b[_0xb453('0x22')]===_0xb453('0x21');var _0x1f8604=_0x376b8e[_0xb453('0x23')];var _0x55d4d8=_0x1f8b95?0x0:_0x30550b['offset'];var _0x521542=_0x1f8b95?_0x376b8e['count']:_0x30550b[_0xb453('0x20')]+_0x30550b[_0xb453('0x22')];var _0x25403e;if(_0x521542>=_0x1f8604){_0x521542=_0x1f8604;_0x25403e=0xc8;}else{_0x25403e=0xce;}_0x5ee747[_0xb453('0x1f')](_0x25403e);return _0x5ee747[_0xb453('0x24')](_0xb453('0x25'),_0x55d4d8+'-'+_0x521542+'/'+_0x1f8604)['json'](_0x376b8e);}return null;};}function patchUpdates(_0x4d1cd7){return function(_0x57293a){try{jsonpatch[_0xb453('0x26')](_0x57293a,_0x4d1cd7,!![]);}catch(_0x50cab2){return BPromise[_0xb453('0x27')](_0x50cab2);}return _0x57293a[_0xb453('0x28')]();};}function saveUpdates(_0x1f87bf,_0x22f284){return function(_0xfffaf){if(_0xfffaf){return _0xfffaf[_0xb453('0x29')](_0x1f87bf)[_0xb453('0x2a')](function(_0x5f8a52){return _0x5f8a52;});}return null;};}function removeEntity(_0x1ab2b6,_0x587862){return function(_0x19e591){if(_0x19e591){return _0x19e591[_0xb453('0x2b')]()[_0xb453('0x2a')](function(){_0x1ab2b6[_0xb453('0x1f')](0xcc)[_0xb453('0x1e')]();});}};}function handleEntityNotFound(_0x45a745,_0x31592f){return function(_0x35293f){if(!_0x35293f){_0x45a745[_0xb453('0x2c')](0x194);}return _0x35293f;};}function handleError(_0x1e65cc,_0x3ecdf6){_0x3ecdf6=_0x3ecdf6||0x1f4;return function(_0x1b2585){logger[_0xb453('0x2d')](_0x1b2585['stack']);if(_0x1b2585[_0xb453('0x2e')]){delete _0x1b2585[_0xb453('0x2e')];}_0x1e65cc[_0xb453('0x1f')](_0x3ecdf6)[_0xb453('0x2f')](_0x1b2585);};}exports[_0xb453('0x30')]=function(_0x3587f9,_0x1a78d0){var _0x2ab342={},_0x1a6c72={},_0x479cc7={'count':0x0,'rows':[]};var _0x3e7418=_[_0xb453('0x31')](db[_0xb453('0x32')]['rawAttributes'],function(_0x4ae042){return{'name':_0x4ae042[_0xb453('0x33')],'type':_0x4ae042[_0xb453('0x34')][_0xb453('0x35')]};});_0x1a6c72[_0xb453('0x36')]=_['map'](_0x3e7418,'name');_0x1a6c72['query']=_[_0xb453('0x37')](_0x3587f9['query']);_0x1a6c72['filters']=_[_0xb453('0x38')](_0x1a6c72[_0xb453('0x36')],_0x1a6c72[_0xb453('0x39')]);_0x2ab342[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x1a6c72[_0xb453('0x36')],qs[_0xb453('0x3b')](_0x3587f9[_0xb453('0x39')]['fields']));_0x2ab342['attributes']=_0x2ab342[_0xb453('0x3a')]['length']?_0x2ab342['attributes']:_0x1a6c72[_0xb453('0x36')];if(!_0x3587f9[_0xb453('0x39')]['hasOwnProperty'](_0xb453('0x3c'))){_0x2ab342[_0xb453('0x22')]=qs[_0xb453('0x22')](_0x3587f9[_0xb453('0x39')][_0xb453('0x22')]);_0x2ab342['offset']=qs['offset'](_0x3587f9['query'][_0xb453('0x20')]);}_0x2ab342[_0xb453('0x3d')]=qs[_0xb453('0x3e')](_0x3587f9['query'][_0xb453('0x3e')]);_0x2ab342['where']=qs[_0xb453('0x3f')](_['pick'](_0x3587f9[_0xb453('0x39')],_0x1a6c72[_0xb453('0x3f')]),_0x3e7418);if(_0x3587f9[_0xb453('0x39')][_0xb453('0x40')]){_0x2ab342[_0xb453('0x41')]=_[_0xb453('0x42')](_0x2ab342[_0xb453('0x41')],{'$or':_[_0xb453('0x31')](_0x3e7418,function(_0x17f851){if(_0x17f851[_0xb453('0x34')]!=='VIRTUAL'){var _0x5461e8={};_0x5461e8[_0x17f851[_0xb453('0x2e')]]={'$like':'%'+_0x3587f9[_0xb453('0x39')][_0xb453('0x40')]+'%'};return _0x5461e8;}})});}_0x2ab342=_[_0xb453('0x42')]({},_0x2ab342,_0x3587f9['options']);var _0x49a4f2={'where':_0x2ab342['where']};return db[_0xb453('0x32')][_0xb453('0x23')](_0x49a4f2)['then'](function(_0x562120){_0x479cc7[_0xb453('0x23')]=_0x562120;if(_0x3587f9[_0xb453('0x39')]['includeAll']){_0x2ab342[_0xb453('0x43')]=[{'all':!![]}];}return db[_0xb453('0x32')][_0xb453('0x44')](_0x2ab342);})[_0xb453('0x2a')](function(_0x45bba2){_0x479cc7[_0xb453('0x45')]=_0x45bba2;return _0x479cc7;})['then'](respondWithFilteredResult(_0x1a78d0,_0x2ab342))['catch'](handleError(_0x1a78d0,null));};exports[_0xb453('0x46')]=function(_0x19fb6e,_0x427408){var _0x3bab40={'raw':![],'where':{'id':_0x19fb6e[_0xb453('0x47')]['id']}},_0x12cd2c={};_0x12cd2c[_0xb453('0x36')]=_[_0xb453('0x37')](db[_0xb453('0x32')][_0xb453('0x48')]);_0x12cd2c[_0xb453('0x39')]=_[_0xb453('0x37')](_0x19fb6e[_0xb453('0x39')]);_0x12cd2c['filters']=_[_0xb453('0x38')](_0x12cd2c['model'],_0x12cd2c[_0xb453('0x39')]);_0x3bab40[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x12cd2c[_0xb453('0x36')],qs[_0xb453('0x3b')](_0x19fb6e[_0xb453('0x39')][_0xb453('0x3b')]));_0x3bab40[_0xb453('0x3a')]=_0x3bab40['attributes'][_0xb453('0x49')]?_0x3bab40[_0xb453('0x3a')]:_0x12cd2c[_0xb453('0x36')];if(_0x19fb6e[_0xb453('0x39')][_0xb453('0x4a')]){_0x3bab40[_0xb453('0x43')]=[{'all':!![]}];}_0x3bab40=_[_0xb453('0x42')]({},_0x3bab40,_0x19fb6e[_0xb453('0x4b')]);return db[_0xb453('0x32')][_0xb453('0x4c')](_0x3bab40)['then'](handleEntityNotFound(_0x427408,null))[_0xb453('0x2a')](respondWithResult(_0x427408,null))[_0xb453('0x4d')](handleError(_0x427408,null));};exports['create']=function(_0x3351df,_0x9b93c6){return db[_0xb453('0x32')][_0xb453('0x4e')](_0x3351df[_0xb453('0x4f')],{})['then'](respondWithResult(_0x9b93c6,0xc9))[_0xb453('0x4d')](handleError(_0x9b93c6,null));};exports[_0xb453('0x29')]=function(_0x4c2a74,_0x24ba2c){if(_0x4c2a74['body']['id']){delete _0x4c2a74[_0xb453('0x4f')]['id'];}return db[_0xb453('0x32')]['find']({'where':{'id':_0x4c2a74[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x24ba2c,null))[_0xb453('0x2a')](saveUpdates(_0x4c2a74[_0xb453('0x4f')],null))['then'](respondWithResult(_0x24ba2c,null))['catch'](handleError(_0x24ba2c,null));};exports[_0xb453('0x2b')]=function(_0x5bc228,_0x54f917){return db[_0xb453('0x32')][_0xb453('0x4c')]({'where':{'id':_0x5bc228['params']['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x54f917,null))[_0xb453('0x2a')](removeEntity(_0x54f917,null))['catch'](handleError(_0x54f917,null));};exports[_0xb453('0x50')]=function(_0x5ae3ac,_0x5bbfb2,_0x4c8d84){var _0x40d172={};var _0x1bef48={};var _0x3abe00;var _0x5a534c;return db[_0xb453('0x32')]['findOne']({'where':{'id':_0x5ae3ac[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x5bbfb2,null))['then'](function(_0x255682){if(_0x255682){_0x3abe00=_0x255682;_0x1bef48['model']=_[_0xb453('0x37')](db[_0xb453('0x51')]['rawAttributes']);_0x1bef48[_0xb453('0x39')]=_[_0xb453('0x37')](_0x5ae3ac[_0xb453('0x39')]);_0x1bef48['filters']=_[_0xb453('0x38')](_0x1bef48['model'],_0x1bef48['query']);_0x40d172[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x1bef48['model'],qs[_0xb453('0x3b')](_0x5ae3ac['query'][_0xb453('0x3b')]));_0x40d172[_0xb453('0x3a')]=_0x40d172[_0xb453('0x3a')][_0xb453('0x49')]?_0x40d172[_0xb453('0x3a')]:_0x1bef48[_0xb453('0x36')];_0x40d172['order']=qs['sort'](_0x5ae3ac[_0xb453('0x39')]['sort']);_0x40d172[_0xb453('0x41')]=qs['filters'](_[_0xb453('0x52')](_0x5ae3ac[_0xb453('0x39')],_0x1bef48['filters']));if(_0x5ae3ac['query'][_0xb453('0x40')]){_0x40d172[_0xb453('0x41')]=_[_0xb453('0x42')](_0x40d172[_0xb453('0x41')],{'$or':_[_0xb453('0x31')](_0x40d172[_0xb453('0x3a')],function(_0x4c1c66){var _0x54afbd={};_0x54afbd[_0x4c1c66]={'$like':'%'+_0x5ae3ac['query'][_0xb453('0x40')]+'%'};return _0x54afbd;})});}_0x40d172=_[_0xb453('0x42')]({},_0x40d172,_0x5ae3ac[_0xb453('0x4b')]);return _0x3abe00[_0xb453('0x50')](_0x40d172);}})[_0xb453('0x2a')](function(_0x56c1a7){if(_0x56c1a7){_0x5a534c=_0x56c1a7[_0xb453('0x49')];if(!_0x5ae3ac['query'][_0xb453('0x53')](_0xb453('0x3c'))){_0x40d172[_0xb453('0x22')]=qs[_0xb453('0x22')](_0x5ae3ac[_0xb453('0x39')][_0xb453('0x22')]);_0x40d172[_0xb453('0x20')]=qs['offset'](_0x5ae3ac['query'][_0xb453('0x20')]);}return _0x3abe00[_0xb453('0x50')](_0x40d172);}})[_0xb453('0x2a')](function(_0x186162){if(_0x186162){return _0x186162?{'count':_0x5a534c,'rows':_0x186162}:null;}})[_0xb453('0x2a')](respondWithResult(_0x5bbfb2,null))[_0xb453('0x4d')](handleError(_0x5bbfb2,null));};exports[_0xb453('0x54')]=function(_0x3c949d,_0x16736a,_0x1b31f5){if(_0x3c949d[_0xb453('0x4f')]['id']){delete _0x3c949d[_0xb453('0x4f')]['id'];}return db[_0xb453('0x32')]['findOne']({'where':{'id':_0x3c949d[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x16736a,null))[_0xb453('0x2a')](function(_0x189f97){if(_0x189f97){_0x3c949d[_0xb453('0x4f')][_0xb453('0x55')]=_0x189f97['id'];_0x3c949d['body'][_0xb453('0x56')]=integrations['getSubjects'](_0x3c949d[_0xb453('0x4f')][_0xb453('0x57')],_0x3c949d[_0xb453('0x4f')][_0xb453('0x34')]);_0x3c949d['body'][_0xb453('0x58')]=integrations[_0xb453('0x59')](_0x3c949d[_0xb453('0x4f')][_0xb453('0x57')],_0x3c949d[_0xb453('0x4f')][_0xb453('0x34')]);return db[_0xb453('0x51')][_0xb453('0x4e')](_0x3c949d[_0xb453('0x4f')],{'include':[{'model':db[_0xb453('0x5a')],'as':'Subjects'},{'model':db[_0xb453('0x5a')],'as':_0xb453('0x58')}]});}return null;})[_0xb453('0x2a')](respondWithResult(_0x16736a,null))[_0xb453('0x4d')](handleError(_0x16736a,null));};exports[_0xb453('0x5b')]=function(_0x32b057,_0x51d528,_0x895e4e){var _0x3e466a='';return db[_0xb453('0x32')][_0xb453('0x5c')]({'where':{'id':_0x32b057[_0xb453('0x47')]['id']},'attributes':['id',_0xb453('0x5d'),_0xb453('0x5e')]})[_0xb453('0x2a')](handleEntityNotFound(_0x51d528,null))[_0xb453('0x2a')](function(_0x343692){if(_0x343692){_0x3e466a=_0x343692['remoteUri'];var _0x432385=_0x3e466a[_0xb453('0x5f')](-0x1);if(_0x432385==='/'){_0x3e466a=_0x3e466a[_0xb453('0x60')](0x0,_0x3e466a[_0xb453('0x61')](_0x432385));}return rp({'method':_0xb453('0x62'),'uri':util[_0xb453('0x63')](_0xb453('0x64'),_0x3e466a,_0xb453('0x65')),'headers':{'Authorization':util[_0xb453('0x63')](_0xb453('0x66'),new Buffer(util[_0xb453('0x63')](_0xb453('0x67'),_0x343692[_0xb453('0x5e')]))[_0xb453('0x68')](_0xb453('0x69')))},'json':!![]});}})[_0xb453('0x2a')](function(_0x4f32ff){if(_0x4f32ff){var _0x296325=[_0xb453('0x6a'),_0xb453('0x6b'),'agent',_0xb453('0x6c'),_0xb453('0x1f'),_0xb453('0x6d'),'group',_0xb453('0x6e'),'ticket_type',_0xb453('0x6f'),_0xb453('0x70')];_[_0xb453('0x71')](_0x4f32ff,function(_0x1fe938){return _0x296325[_0xb453('0x72')](_0x1fe938['name'])||!_0x1fe938[_0xb453('0x73')]&&_0x1fe938[_0xb453('0x34')]!=='custom_text'&&_0x1fe938[_0xb453('0x34')]!==_0xb453('0x74');});return{'count':_0x4f32ff['length'],'rows':_[_0xb453('0x31')](_0x4f32ff,function(_0x5681ed){return{'id':_0x5681ed['name'],'name':_0x5681ed[_0xb453('0x75')],'custom':!_0x5681ed[_0xb453('0x73')],'options':_0x5681ed[_0xb453('0x76')]?_['map'](_0x5681ed[_0xb453('0x76')],function(_0x59d753){return{'name':_[_0xb453('0x77')](_0x59d753),'value':_0x59d753};}):[]};})};}})[_0xb453('0x2a')](respondWithResult(_0x51d528,null))[_0xb453('0x4d')](function(_0x5f3244){var _0x143ccf=_0x32b057[_0xb453('0x39')][_0xb453('0x78')]?0x1f4:_0x5f3244['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb453('0x5b'),_0x143ccf,JSON[_0xb453('0x79')](_0x5f3244));delete _0x5f3244[_0xb453('0x2e')];if(_0x143ccf===0x191){_0x143ccf=0x190;}_0x51d528[_0xb453('0x1f')](_0x143ccf)['send'](_0x32b057[_0xb453('0x39')][_0xb453('0x78')]?{'message':_0xb453('0x7a'),'statusCode':_0x5f3244[_0xb453('0x7b')]}:_0x5f3244);});}; \ No newline at end of file +var _0x6c4b=['format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6c4b,0x93));var _0xb6c4=function(_0x40f355,_0x27fac0){_0x40f355=_0x40f355-0x0;var _0x1ebb62=_0x6c4b[_0x40f355];return _0x1ebb62;};'use strict';var emlformat=require(_0xb6c4('0x0'));var rimraf=require(_0xb6c4('0x1'));var zipdir=require(_0xb6c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c4('0x3'));var moment=require(_0xb6c4('0x4'));var BPromise=require(_0xb6c4('0x5'));var Mustache=require(_0xb6c4('0x6'));var util=require(_0xb6c4('0x7'));var path=require(_0xb6c4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb6c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6c4('0xa'));var squel=require(_0xb6c4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb6c4('0xc'));var deskjs=require(_0xb6c4('0xd'));var toCsv=require(_0xb6c4('0xe'));var querystring=require(_0xb6c4('0xf'));var Papa=require(_0xb6c4('0x10'));var Redis=require(_0xb6c4('0x11'));var authService=require(_0xb6c4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb6c4('0x13'));var hardwareService=require(_0xb6c4('0x14'));var logger=require(_0xb6c4('0x15'))(_0xb6c4('0x16'));var utils=require('../../config/utils');var config=require(_0xb6c4('0x17'));var licenseUtil=require(_0xb6c4('0x18'));var db=require(_0xb6c4('0x19'))['db'];var integrations=require(_0xb6c4('0x1a'));function respondWithStatusCode(_0x465416,_0x1d4e87){_0x1d4e87=_0x1d4e87||0xcc;return function(_0x185304){if(_0x185304){return _0x465416[_0xb6c4('0x1b')](_0x1d4e87);}return _0x465416['status'](_0x1d4e87)['end']();};}function respondWithResult(_0xdfd12b,_0x48e451){_0x48e451=_0x48e451||0xc8;return function(_0x8da84){if(_0x8da84){return _0xdfd12b[_0xb6c4('0x1c')](_0x48e451)[_0xb6c4('0x1d')](_0x8da84);}};}function respondWithFilteredResult(_0x5edd5c,_0x5c3d5e){return function(_0x1566a8){if(_0x1566a8){var _0xd9de6d=typeof _0x5c3d5e['offset']===_0xb6c4('0x1e')&&typeof _0x5c3d5e[_0xb6c4('0x1f')]===_0xb6c4('0x1e');var _0x2ab682=_0x1566a8[_0xb6c4('0x20')];var _0x1002cc=_0xd9de6d?0x0:_0x5c3d5e[_0xb6c4('0x21')];var _0x55eb35=_0xd9de6d?_0x1566a8['count']:_0x5c3d5e[_0xb6c4('0x21')]+_0x5c3d5e[_0xb6c4('0x1f')];var _0x1a7076;if(_0x55eb35>=_0x2ab682){_0x55eb35=_0x2ab682;_0x1a7076=0xc8;}else{_0x1a7076=0xce;}_0x5edd5c[_0xb6c4('0x1c')](_0x1a7076);return _0x5edd5c[_0xb6c4('0x22')](_0xb6c4('0x23'),_0x1002cc+'-'+_0x55eb35+'/'+_0x2ab682)['json'](_0x1566a8);}return null;};}function patchUpdates(_0x49c1b5){return function(_0x1d6495){try{jsonpatch[_0xb6c4('0x24')](_0x1d6495,_0x49c1b5,!![]);}catch(_0x95a9d){return BPromise[_0xb6c4('0x25')](_0x95a9d);}return _0x1d6495[_0xb6c4('0x26')]();};}function saveUpdates(_0x8f4a6f,_0x30071b){return function(_0x2cea6f){if(_0x2cea6f){return _0x2cea6f[_0xb6c4('0x27')](_0x8f4a6f)[_0xb6c4('0x28')](function(_0x5f6b5){return _0x5f6b5;});}return null;};}function removeEntity(_0x17e9c9,_0x3341aa){return function(_0x5da94d){if(_0x5da94d){return _0x5da94d[_0xb6c4('0x29')]()[_0xb6c4('0x28')](function(){_0x17e9c9[_0xb6c4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33df4e,_0x435622){return function(_0x2db07a){if(!_0x2db07a){_0x33df4e[_0xb6c4('0x1b')](0x194);}return _0x2db07a;};}function handleError(_0x30fa6f,_0x58607d){_0x58607d=_0x58607d||0x1f4;return function(_0x1f822e){logger[_0xb6c4('0x2a')](_0x1f822e[_0xb6c4('0x2b')]);if(_0x1f822e[_0xb6c4('0x2c')]){delete _0x1f822e['name'];}_0x30fa6f[_0xb6c4('0x1c')](_0x58607d)['send'](_0x1f822e);};}exports[_0xb6c4('0x2d')]=function(_0x58e7e8,_0xe0e62e){var _0x1335b9={},_0x38fbd0={},_0x194734={'count':0x0,'rows':[]};var _0x324656=_[_0xb6c4('0x2e')](db[_0xb6c4('0x2f')][_0xb6c4('0x30')],function(_0x2bbe57){return{'name':_0x2bbe57[_0xb6c4('0x31')],'type':_0x2bbe57[_0xb6c4('0x32')][_0xb6c4('0x33')]};});_0x38fbd0['model']=_['map'](_0x324656,_0xb6c4('0x2c'));_0x38fbd0[_0xb6c4('0x34')]=_[_0xb6c4('0x35')](_0x58e7e8['query']);_0x38fbd0['filters']=_[_0xb6c4('0x36')](_0x38fbd0[_0xb6c4('0x37')],_0x38fbd0[_0xb6c4('0x34')]);_0x1335b9[_0xb6c4('0x38')]=_[_0xb6c4('0x36')](_0x38fbd0[_0xb6c4('0x37')],qs[_0xb6c4('0x39')](_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x39')]));_0x1335b9['attributes']=_0x1335b9[_0xb6c4('0x38')][_0xb6c4('0x3a')]?_0x1335b9[_0xb6c4('0x38')]:_0x38fbd0[_0xb6c4('0x37')];if(!_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x3b')](_0xb6c4('0x3c'))){_0x1335b9[_0xb6c4('0x1f')]=qs[_0xb6c4('0x1f')](_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x1f')]);_0x1335b9[_0xb6c4('0x21')]=qs[_0xb6c4('0x21')](_0x58e7e8['query']['offset']);}_0x1335b9[_0xb6c4('0x3d')]=qs['sort'](_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x3e')]);_0x1335b9[_0xb6c4('0x3f')]=qs[_0xb6c4('0x40')](_[_0xb6c4('0x41')](_0x58e7e8['query'],_0x38fbd0[_0xb6c4('0x40')]),_0x324656);if(_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x42')]){_0x1335b9[_0xb6c4('0x3f')]=_[_0xb6c4('0x43')](_0x1335b9[_0xb6c4('0x3f')],{'$or':_[_0xb6c4('0x2e')](_0x324656,function(_0x59f73f){if(_0x59f73f[_0xb6c4('0x32')]!==_0xb6c4('0x44')){var _0x33b69d={};_0x33b69d[_0x59f73f[_0xb6c4('0x2c')]]={'$like':'%'+_0x58e7e8[_0xb6c4('0x34')]['filter']+'%'};return _0x33b69d;}})});}_0x1335b9=_[_0xb6c4('0x43')]({},_0x1335b9,_0x58e7e8[_0xb6c4('0x45')]);var _0xc50fdf={'where':_0x1335b9['where']};return db[_0xb6c4('0x2f')][_0xb6c4('0x20')](_0xc50fdf)[_0xb6c4('0x28')](function(_0x43b7c0){_0x194734[_0xb6c4('0x20')]=_0x43b7c0;if(_0x58e7e8[_0xb6c4('0x34')][_0xb6c4('0x46')]){_0x1335b9['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xb6c4('0x47')](_0x1335b9);})[_0xb6c4('0x28')](function(_0x1ed762){_0x194734[_0xb6c4('0x48')]=_0x1ed762;return _0x194734;})[_0xb6c4('0x28')](respondWithFilteredResult(_0xe0e62e,_0x1335b9))[_0xb6c4('0x49')](handleError(_0xe0e62e,null));};exports[_0xb6c4('0x4a')]=function(_0x20ae74,_0xa7b854){var _0x43f5c7={'raw':![],'where':{'id':_0x20ae74[_0xb6c4('0x4b')]['id']}},_0x428b57={};_0x428b57[_0xb6c4('0x37')]=_['keys'](db[_0xb6c4('0x2f')][_0xb6c4('0x30')]);_0x428b57['query']=_['keys'](_0x20ae74['query']);_0x428b57[_0xb6c4('0x40')]=_[_0xb6c4('0x36')](_0x428b57['model'],_0x428b57[_0xb6c4('0x34')]);_0x43f5c7[_0xb6c4('0x38')]=_['intersection'](_0x428b57[_0xb6c4('0x37')],qs[_0xb6c4('0x39')](_0x20ae74[_0xb6c4('0x34')][_0xb6c4('0x39')]));_0x43f5c7[_0xb6c4('0x38')]=_0x43f5c7[_0xb6c4('0x38')]['length']?_0x43f5c7[_0xb6c4('0x38')]:_0x428b57[_0xb6c4('0x37')];if(_0x20ae74['query'][_0xb6c4('0x46')]){_0x43f5c7[_0xb6c4('0x4c')]=[{'all':!![]}];}_0x43f5c7=_[_0xb6c4('0x43')]({},_0x43f5c7,_0x20ae74['options']);return db[_0xb6c4('0x2f')][_0xb6c4('0x4d')](_0x43f5c7)[_0xb6c4('0x28')](handleEntityNotFound(_0xa7b854,null))[_0xb6c4('0x28')](respondWithResult(_0xa7b854,null))[_0xb6c4('0x49')](handleError(_0xa7b854,null));};exports['create']=function(_0x679490,_0x297a57){return db[_0xb6c4('0x2f')][_0xb6c4('0x4e')](_0x679490[_0xb6c4('0x4f')],{})['then'](respondWithResult(_0x297a57,0xc9))[_0xb6c4('0x49')](handleError(_0x297a57,null));};exports[_0xb6c4('0x27')]=function(_0x317785,_0x10e8fd){if(_0x317785[_0xb6c4('0x4f')]['id']){delete _0x317785[_0xb6c4('0x4f')]['id'];}return db['FreshdeskAccount'][_0xb6c4('0x4d')]({'where':{'id':_0x317785['params']['id']}})[_0xb6c4('0x28')](handleEntityNotFound(_0x10e8fd,null))[_0xb6c4('0x28')](saveUpdates(_0x317785[_0xb6c4('0x4f')],null))[_0xb6c4('0x28')](respondWithResult(_0x10e8fd,null))[_0xb6c4('0x49')](handleError(_0x10e8fd,null));};exports[_0xb6c4('0x29')]=function(_0x3ab488,_0x5d762d){return db[_0xb6c4('0x2f')]['find']({'where':{'id':_0x3ab488[_0xb6c4('0x4b')]['id']}})[_0xb6c4('0x28')](handleEntityNotFound(_0x5d762d,null))['then'](removeEntity(_0x5d762d,null))[_0xb6c4('0x49')](handleError(_0x5d762d,null));};exports[_0xb6c4('0x50')]=function(_0x563272,_0x35edb3,_0x1ffe1b){var _0x37dc6f={};var _0x2cf3c8={};var _0xd3beae;var _0xd8a683;return db[_0xb6c4('0x2f')]['findOne']({'where':{'id':_0x563272['params']['id']}})['then'](handleEntityNotFound(_0x35edb3,null))['then'](function(_0x2d4f29){if(_0x2d4f29){_0xd3beae=_0x2d4f29;_0x2cf3c8[_0xb6c4('0x37')]=_[_0xb6c4('0x35')](db[_0xb6c4('0x51')][_0xb6c4('0x30')]);_0x2cf3c8['query']=_['keys'](_0x563272['query']);_0x2cf3c8['filters']=_[_0xb6c4('0x36')](_0x2cf3c8['model'],_0x2cf3c8[_0xb6c4('0x34')]);_0x37dc6f[_0xb6c4('0x38')]=_[_0xb6c4('0x36')](_0x2cf3c8['model'],qs[_0xb6c4('0x39')](_0x563272[_0xb6c4('0x34')][_0xb6c4('0x39')]));_0x37dc6f['attributes']=_0x37dc6f['attributes'][_0xb6c4('0x3a')]?_0x37dc6f[_0xb6c4('0x38')]:_0x2cf3c8['model'];_0x37dc6f[_0xb6c4('0x3d')]=qs[_0xb6c4('0x3e')](_0x563272[_0xb6c4('0x34')][_0xb6c4('0x3e')]);_0x37dc6f[_0xb6c4('0x3f')]=qs['filters'](_['pick'](_0x563272[_0xb6c4('0x34')],_0x2cf3c8['filters']));if(_0x563272[_0xb6c4('0x34')][_0xb6c4('0x42')]){_0x37dc6f['where']=_[_0xb6c4('0x43')](_0x37dc6f[_0xb6c4('0x3f')],{'$or':_[_0xb6c4('0x2e')](_0x37dc6f[_0xb6c4('0x38')],function(_0x326a96){var _0x1c26fc={};_0x1c26fc[_0x326a96]={'$like':'%'+_0x563272[_0xb6c4('0x34')][_0xb6c4('0x42')]+'%'};return _0x1c26fc;})});}_0x37dc6f=_[_0xb6c4('0x43')]({},_0x37dc6f,_0x563272['options']);return _0xd3beae[_0xb6c4('0x50')](_0x37dc6f);}})['then'](function(_0x3c8911){if(_0x3c8911){_0xd8a683=_0x3c8911[_0xb6c4('0x3a')];if(!_0x563272[_0xb6c4('0x34')][_0xb6c4('0x3b')](_0xb6c4('0x3c'))){_0x37dc6f[_0xb6c4('0x1f')]=qs[_0xb6c4('0x1f')](_0x563272[_0xb6c4('0x34')]['limit']);_0x37dc6f[_0xb6c4('0x21')]=qs[_0xb6c4('0x21')](_0x563272[_0xb6c4('0x34')][_0xb6c4('0x21')]);}return _0xd3beae[_0xb6c4('0x50')](_0x37dc6f);}})[_0xb6c4('0x28')](function(_0x4557ea){if(_0x4557ea){return _0x4557ea?{'count':_0xd8a683,'rows':_0x4557ea}:null;}})[_0xb6c4('0x28')](respondWithResult(_0x35edb3,null))[_0xb6c4('0x49')](handleError(_0x35edb3,null));};exports[_0xb6c4('0x52')]=function(_0x5d7385,_0x451cfc,_0x557656){if(_0x5d7385['body']['id']){delete _0x5d7385[_0xb6c4('0x4f')]['id'];}return db[_0xb6c4('0x2f')][_0xb6c4('0x53')]({'where':{'id':_0x5d7385[_0xb6c4('0x4b')]['id']}})[_0xb6c4('0x28')](handleEntityNotFound(_0x451cfc,null))[_0xb6c4('0x28')](function(_0x3b7afb){if(_0x3b7afb){_0x5d7385[_0xb6c4('0x4f')][_0xb6c4('0x54')]=_0x3b7afb['id'];_0x5d7385['body'][_0xb6c4('0x55')]=integrations[_0xb6c4('0x56')](_0x5d7385[_0xb6c4('0x4f')][_0xb6c4('0x57')],_0x5d7385[_0xb6c4('0x4f')][_0xb6c4('0x32')]);_0x5d7385['body']['Descriptions']=integrations[_0xb6c4('0x58')](_0x5d7385[_0xb6c4('0x4f')][_0xb6c4('0x57')],_0x5d7385[_0xb6c4('0x4f')][_0xb6c4('0x32')]);return db[_0xb6c4('0x51')][_0xb6c4('0x4e')](_0x5d7385['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xb6c4('0x55')},{'model':db[_0xb6c4('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x451cfc,null))[_0xb6c4('0x49')](handleError(_0x451cfc,null));};exports[_0xb6c4('0x5a')]=function(_0x2deccf,_0x2e0eb6,_0x36fcd9){var _0x1f88b4='';return db[_0xb6c4('0x2f')][_0xb6c4('0x53')]({'where':{'id':_0x2deccf[_0xb6c4('0x4b')]['id']},'attributes':['id',_0xb6c4('0x5b'),_0xb6c4('0x5c')]})[_0xb6c4('0x28')](handleEntityNotFound(_0x2e0eb6,null))[_0xb6c4('0x28')](function(_0x15b60b){if(_0x15b60b){_0x1f88b4=_0x15b60b[_0xb6c4('0x5b')];var _0x1ab46a=_0x1f88b4[_0xb6c4('0x5d')](-0x1);if(_0x1ab46a==='/'){_0x1f88b4=_0x1f88b4[_0xb6c4('0x5e')](0x0,_0x1f88b4[_0xb6c4('0x5f')](_0x1ab46a));}return rp({'method':_0xb6c4('0x60'),'uri':util['format'](_0xb6c4('0x61'),_0x1f88b4,_0xb6c4('0x62')),'headers':{'Authorization':util[_0xb6c4('0x63')](_0xb6c4('0x64'),new Buffer(util['format'](_0xb6c4('0x65'),_0x15b60b['apiKey']))[_0xb6c4('0x66')](_0xb6c4('0x67')))},'json':!![]});}})[_0xb6c4('0x28')](function(_0x574225){if(_0x574225){var _0x453d82=[_0xb6c4('0x68'),_0xb6c4('0x69'),_0xb6c4('0x6a'),_0xb6c4('0x6b'),'status',_0xb6c4('0x6c'),_0xb6c4('0x6d'),_0xb6c4('0x6e'),_0xb6c4('0x6f'),'group','company'];_[_0xb6c4('0x70')](_0x574225,function(_0x496cc9){return _0x453d82[_0xb6c4('0x71')](_0x496cc9['name'])||!_0x496cc9[_0xb6c4('0x72')]&&_0x496cc9[_0xb6c4('0x32')]!==_0xb6c4('0x73')&&_0x496cc9['type']!=='custom_dropdown';});return{'count':_0x574225[_0xb6c4('0x3a')],'rows':_['map'](_0x574225,function(_0x4ca9ef){return{'id':_0x4ca9ef[_0xb6c4('0x2c')],'name':_0x4ca9ef[_0xb6c4('0x74')],'custom':!_0x4ca9ef['default'],'options':_0x4ca9ef[_0xb6c4('0x75')]?_[_0xb6c4('0x2e')](_0x4ca9ef[_0xb6c4('0x75')],function(_0x13a050){return{'name':_[_0xb6c4('0x76')](_0x13a050),'value':_0x13a050};}):[]};})};}})[_0xb6c4('0x28')](respondWithResult(_0x2e0eb6,null))[_0xb6c4('0x49')](function(_0x85e926){var _0x4b817e=_0x2deccf['query'][_0xb6c4('0x77')]?0x1f4:_0x85e926[_0xb6c4('0x78')]||0x1f4;logger[_0xb6c4('0x2a')](_0xb6c4('0x79'),_0xb6c4('0x5a'),_0x4b817e,JSON[_0xb6c4('0x7a')](_0x85e926));delete _0x85e926[_0xb6c4('0x2c')];if(_0x4b817e===0x191){_0x4b817e=0x190;}_0x2e0eb6[_0xb6c4('0x1c')](_0x4b817e)['send'](_0x2deccf[_0xb6c4('0x34')][_0xb6c4('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x85e926[_0xb6c4('0x78')]}:_0x85e926);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 25c5897..f011dd5 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 _0xce82=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x3797e0,_0x55e8be){var _0x412f20=function(_0x1ee16f){while(--_0x1ee16f){_0x3797e0['push'](_0x3797e0['shift']());}};_0x412f20(++_0x55e8be);}(_0xce82,0x13a));var _0x2ce8=function(_0x17963b,_0x21fbea){_0x17963b=_0x17963b-0x0;var _0x3faa26=_0xce82[_0x17963b];return _0x3faa26;};'use strict';var _=require(_0x2ce8('0x0'));var util=require(_0x2ce8('0x1'));var logger=require('../../config/logger')(_0x2ce8('0x2'));var moment=require(_0x2ce8('0x3'));var BPromise=require(_0x2ce8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ce8('0x5'));var rimraf=require(_0x2ce8('0x6'));var config=require(_0x2ce8('0x7'));var attributes=require(_0x2ce8('0x8'));var integrations=require(_0x2ce8('0x9'));module['exports']=function(_0x48349a,_0x13cc78){return _0x48349a[_0x2ce8('0xa')](_0x2ce8('0xb'),attributes,{'tableName':_0x2ce8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa68=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xaa68,0x1a3));var _0x8aa6=function(_0x37a5c6,_0x8a3c96){_0x37a5c6=_0x37a5c6-0x0;var _0x28318f=_0xaa68[_0x37a5c6];return _0x28318f;};'use strict';var _=require(_0x8aa6('0x0'));var util=require(_0x8aa6('0x1'));var logger=require(_0x8aa6('0x2'))('api');var moment=require(_0x8aa6('0x3'));var BPromise=require(_0x8aa6('0x4'));var rp=require(_0x8aa6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8aa6('0x6'));var attributes=require(_0x8aa6('0x7'));var integrations=require(_0x8aa6('0x8'));module[_0x8aa6('0x9')]=function(_0x1a1a18,_0x4f7065){return _0x1a1a18[_0x8aa6('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x8aa6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 48aef96..f03348a 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 _0xec6b=['stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','ShowFreshdeskAccount','find','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x338be1,_0x37e9c3){var _0x3e1662=function(_0x2b6bc1){while(--_0x2b6bc1){_0x338be1['push'](_0x338be1['shift']());}};_0x3e1662(++_0x37e9c3);}(_0xec6b,0x129));var _0xbec6=function(_0x4b4d02,_0x3a49cc){_0x4b4d02=_0x4b4d02-0x0;var _0x4d4b24=_0xec6b[_0x4b4d02];return _0x4d4b24;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var moment=require('moment');var BPromise=require(_0xbec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec6('0x4'));var logger=require(_0xbec6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51c972,_0x6d3729,_0x5df981){return new BPromise(function(_0x58edd9,_0x3a0c1c){return client[_0xbec6('0x6')](_0x51c972,_0x5df981)[_0xbec6('0x7')](function(_0x3fff36){logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,_0xbec6('0xa'));logger[_0xbec6('0xb')](_0xbec6('0xc'),_0x6d3729,_0xbec6('0xa'),JSON[_0xbec6('0xd')](_0x3fff36));if(_0x3fff36[_0xbec6('0xe')]){if(_0x3fff36['error'][_0xbec6('0xf')]===0x1f4){logger['error'](_0xbec6('0x9'),_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x3a0c1c(_0x3fff36[_0xbec6('0xe')]['message']);}logger[_0xbec6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x58edd9(_0x3fff36[_0xbec6('0xe')][_0xbec6('0x10')]);}else{logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,'request\x20sent');_0x58edd9(_0x3fff36[_0xbec6('0x11')]['message']);}})[_0xbec6('0x12')](function(_0x20924c){logger[_0xbec6('0xe')](_0xbec6('0x9'),_0x6d3729,_0x20924c);_0x3a0c1c(_0x20924c);});});}exports[_0xbec6('0x13')]=function(_0x4a18bd){var _0x2e4fbc=this;return new Promise(function(_0x98a9f3,_0x49ce37){return db[_0xbec6('0x14')][_0xbec6('0x15')]({'raw':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')][_0xbec6('0x17')]||null:null,'attributes':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd['options'][_0xbec6('0x18')]||null:null,'limit':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')]['limit']||null:null,'include':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd['options'][_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x4a18bd[_0xbec6('0x16')][_0xbec6('0x19')],function(_0x1d882a){return{'model':db[_0x1d882a[_0xbec6('0x1b')]],'as':_0x1d882a['as'],'attributes':_0x1d882a[_0xbec6('0x18')],'include':_0x1d882a[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x1d882a[_0xbec6('0x19')],function(_0x59dea8){return{'model':db[_0x59dea8[_0xbec6('0x1b')]],'as':_0x59dea8['as'],'attributes':_0x59dea8[_0xbec6('0x18')],'include':_0x59dea8['include']?_[_0xbec6('0x1a')](_0x59dea8['include'],function(_0x17b98d){return{'model':db[_0x17b98d[_0xbec6('0x1b')]],'as':_0x17b98d['as'],'attributes':_0x17b98d[_0xbec6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbec6('0x7')](function(_0x450b5f){logger[_0xbec6('0x8')](_0xbec6('0x13'),_0x4a18bd);logger['debug'](_0xbec6('0x13'),_0x4a18bd,JSON[_0xbec6('0xd')](_0x450b5f));_0x98a9f3(_0x450b5f);})[_0xbec6('0x12')](function(_0x1e5bc0){logger['error'](_0xbec6('0x13'),_0x1e5bc0[_0xbec6('0x10')],_0x4a18bd);_0x49ce37(_0x2e4fbc['error'](0x1f4,_0x1e5bc0[_0xbec6('0x10')]));});});};exports[_0xbec6('0x1c')]=function(_0x31a54a){var _0x28a6e1=this;return new Promise(function(_0x5517e3,_0x447a96){return db['FreshdeskAccount'][_0xbec6('0x1d')]({'raw':_0x31a54a['options']?_0x31a54a['options'][_0xbec6('0x1e')]===undefined?!![]:![]:!![],'where':_0x31a54a[_0xbec6('0x16')]?_0x31a54a['options']['where']||null:null,'attributes':_0x31a54a[_0xbec6('0x16')]?_0x31a54a[_0xbec6('0x16')][_0xbec6('0x18')]||null:null,'include':_0x31a54a[_0xbec6('0x16')]?_0x31a54a[_0xbec6('0x16')]['include']?_[_0xbec6('0x1a')](_0x31a54a[_0xbec6('0x16')][_0xbec6('0x19')],function(_0x4c0c97){return{'model':db[_0x4c0c97[_0xbec6('0x1b')]],'as':_0x4c0c97['as'],'attributes':_0x4c0c97[_0xbec6('0x18')],'include':_0x4c0c97[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x4c0c97['include'],function(_0x333f33){return{'model':db[_0x333f33[_0xbec6('0x1b')]],'as':_0x333f33['as'],'attributes':_0x333f33[_0xbec6('0x18')],'include':_0x333f33[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x333f33['include'],function(_0x3baec0){return{'model':db[_0x3baec0[_0xbec6('0x1b')]],'as':_0x3baec0['as'],'attributes':_0x3baec0['attributes']};}):[]};}):[]};}):[]:[]})[_0xbec6('0x7')](function(_0x4c1249){logger[_0xbec6('0x8')](_0xbec6('0x1c'),_0x31a54a);logger['debug'](_0xbec6('0x1c'),_0x31a54a,JSON[_0xbec6('0xd')](_0x4c1249));_0x5517e3(_0x4c1249);})[_0xbec6('0x12')](function(_0x2fd307){logger['error']('ShowFreshdeskAccount',_0x2fd307[_0xbec6('0x10')],_0x31a54a);_0x447a96(_0x28a6e1[_0xbec6('0xe')](0x1f4,_0x2fd307[_0xbec6('0x10')]));});});}; \ No newline at end of file +var _0xe432=['raw','where','attributes','limit','include','map','model','then','debug','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0xe432,0xb5));var _0x2e43=function(_0x22acaa,_0x36b8ea){_0x22acaa=_0x22acaa-0x0;var _0x3ff523=_0xe432[_0x22acaa];return _0x3ff523;};'use strict';var _=require(_0x2e43('0x0'));var util=require(_0x2e43('0x1'));var moment=require('moment');var BPromise=require(_0x2e43('0x2'));var rs=require(_0x2e43('0x3'));var fs=require('fs');var Redis=require(_0x2e43('0x4'));var db=require(_0x2e43('0x5'))['db'];var utils=require(_0x2e43('0x6'));var logger=require('../../config/logger')(_0x2e43('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e43('0x8')][_0x2e43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34ff59,_0x7ed47c,_0x56e887){return new BPromise(function(_0x5044d5,_0xd1eebb){return client[_0x2e43('0xa')](_0x34ff59,_0x56e887)['then'](function(_0x290086){logger[_0x2e43('0xb')](_0x2e43('0xc'),_0x7ed47c,_0x2e43('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x7ed47c,_0x2e43('0xd'),JSON[_0x2e43('0xe')](_0x290086));if(_0x290086[_0x2e43('0xf')]){if(_0x290086[_0x2e43('0xf')]['code']===0x1f4){logger['error'](_0x2e43('0xc'),_0x7ed47c,_0x290086[_0x2e43('0xf')][_0x2e43('0x10')]);return _0xd1eebb(_0x290086[_0x2e43('0xf')][_0x2e43('0x10')]);}logger[_0x2e43('0xf')](_0x2e43('0xc'),_0x7ed47c,_0x290086[_0x2e43('0xf')][_0x2e43('0x10')]);return _0x5044d5(_0x290086[_0x2e43('0xf')][_0x2e43('0x10')]);}else{logger[_0x2e43('0xb')](_0x2e43('0xc'),_0x7ed47c,'request\x20sent');_0x5044d5(_0x290086[_0x2e43('0x11')][_0x2e43('0x10')]);}})[_0x2e43('0x12')](function(_0x41e550){logger[_0x2e43('0xf')](_0x2e43('0xc'),_0x7ed47c,_0x41e550);_0xd1eebb(_0x41e550);});});}exports[_0x2e43('0x13')]=function(_0x4be98b){var _0x5b58cc=this;return new Promise(function(_0xd7a059,_0xf00f76){return db[_0x2e43('0x14')][_0x2e43('0x15')]({'raw':_0x4be98b[_0x2e43('0x16')]?_0x4be98b['options'][_0x2e43('0x17')]===undefined?!![]:![]:!![],'where':_0x4be98b['options']?_0x4be98b['options'][_0x2e43('0x18')]||null:null,'attributes':_0x4be98b[_0x2e43('0x16')]?_0x4be98b[_0x2e43('0x16')][_0x2e43('0x19')]||null:null,'limit':_0x4be98b[_0x2e43('0x16')]?_0x4be98b[_0x2e43('0x16')][_0x2e43('0x1a')]||null:null,'include':_0x4be98b[_0x2e43('0x16')]?_0x4be98b[_0x2e43('0x16')][_0x2e43('0x1b')]?_[_0x2e43('0x1c')](_0x4be98b[_0x2e43('0x16')][_0x2e43('0x1b')],function(_0x18511b){return{'model':db[_0x18511b[_0x2e43('0x1d')]],'as':_0x18511b['as'],'attributes':_0x18511b['attributes'],'include':_0x18511b[_0x2e43('0x1b')]?_[_0x2e43('0x1c')](_0x18511b[_0x2e43('0x1b')],function(_0x59e9c7){return{'model':db[_0x59e9c7[_0x2e43('0x1d')]],'as':_0x59e9c7['as'],'attributes':_0x59e9c7[_0x2e43('0x19')],'include':_0x59e9c7[_0x2e43('0x1b')]?_[_0x2e43('0x1c')](_0x59e9c7[_0x2e43('0x1b')],function(_0x5e3aae){return{'model':db[_0x5e3aae[_0x2e43('0x1d')]],'as':_0x5e3aae['as'],'attributes':_0x5e3aae[_0x2e43('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e43('0x1e')](function(_0x449ab1){logger[_0x2e43('0xb')]('GetFreshdeskAccount',_0x4be98b);logger[_0x2e43('0x1f')]('GetFreshdeskAccount',_0x4be98b,JSON['stringify'](_0x449ab1));_0xd7a059(_0x449ab1);})['catch'](function(_0x2ebb15){logger[_0x2e43('0xf')](_0x2e43('0x13'),_0x2ebb15[_0x2e43('0x10')],_0x4be98b);_0xf00f76(_0x5b58cc[_0x2e43('0xf')](0x1f4,_0x2ebb15[_0x2e43('0x10')]));});});};exports[_0x2e43('0x20')]=function(_0x2b763b){var _0x5a3faf=this;return new Promise(function(_0xcfd317,_0x2a38b3){return db[_0x2e43('0x14')][_0x2e43('0x21')]({'raw':_0x2b763b[_0x2e43('0x16')]?_0x2b763b[_0x2e43('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2b763b[_0x2e43('0x16')]?_0x2b763b['options'][_0x2e43('0x18')]||null:null,'attributes':_0x2b763b[_0x2e43('0x16')]?_0x2b763b['options'][_0x2e43('0x19')]||null:null,'include':_0x2b763b[_0x2e43('0x16')]?_0x2b763b[_0x2e43('0x16')]['include']?_[_0x2e43('0x1c')](_0x2b763b[_0x2e43('0x16')][_0x2e43('0x1b')],function(_0x25c0ff){return{'model':db[_0x25c0ff[_0x2e43('0x1d')]],'as':_0x25c0ff['as'],'attributes':_0x25c0ff[_0x2e43('0x19')],'include':_0x25c0ff[_0x2e43('0x1b')]?_[_0x2e43('0x1c')](_0x25c0ff[_0x2e43('0x1b')],function(_0x4460ce){return{'model':db[_0x4460ce[_0x2e43('0x1d')]],'as':_0x4460ce['as'],'attributes':_0x4460ce[_0x2e43('0x19')],'include':_0x4460ce[_0x2e43('0x1b')]?_[_0x2e43('0x1c')](_0x4460ce['include'],function(_0x3e5f55){return{'model':db[_0x3e5f55[_0x2e43('0x1d')]],'as':_0x3e5f55['as'],'attributes':_0x3e5f55[_0x2e43('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c824f){logger[_0x2e43('0xb')](_0x2e43('0x20'),_0x2b763b);logger['debug']('ShowFreshdeskAccount',_0x2b763b,JSON[_0x2e43('0xe')](_0x1c824f));_0xcfd317(_0x1c824f);})[_0x2e43('0x12')](function(_0xf53334){logger['error'](_0x2e43('0x20'),_0xf53334[_0x2e43('0x10')],_0x2b763b);_0x2a38b3(_0x5a3faf['error'](0x1f4,_0xf53334[_0x2e43('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 24e498e..3e57924 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 _0x3b27=['/:id/fields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x3b27,0x8a));var _0x73b2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x3b27[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require('multer');var util=require(_0x73b2('0x0'));var path=require(_0x73b2('0x1'));var timeout=require(_0x73b2('0x2'));var express=require(_0x73b2('0x3'));var router=express[_0x73b2('0x4')]();var fs_extra=require(_0x73b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73b2('0x6'));var config=require('../../config/environment');var controller=require(_0x73b2('0x7'));router[_0x73b2('0x8')]('/',auth[_0x73b2('0x9')](),controller['index']);router[_0x73b2('0x8')](_0x73b2('0xa'),auth[_0x73b2('0x9')](),controller[_0x73b2('0xb')]);router[_0x73b2('0x8')](_0x73b2('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x73b2('0x8')](_0x73b2('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x73b2('0x8')]('/:id/descriptions',auth[_0x73b2('0x9')](),controller[_0x73b2('0xe')]);router[_0x73b2('0x8')](_0x73b2('0xf'),auth['isAuthenticated'](),controller[_0x73b2('0x10')]);router[_0x73b2('0x11')]('/',auth[_0x73b2('0x9')](),controller[_0x73b2('0x12')]);router[_0x73b2('0x11')]('/:id/tags',auth[_0x73b2('0x9')](),controller[_0x73b2('0x13')]);router[_0x73b2('0x14')](_0x73b2('0xa'),auth['isAuthenticated'](),controller[_0x73b2('0x15')]);router[_0x73b2('0x16')](_0x73b2('0xa'),auth[_0x73b2('0x9')](),controller[_0x73b2('0x17')]);module[_0x73b2('0x18')]=router; \ No newline at end of file +var _0xf99d=['getTags','create','post','/:id/tags','setTags','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','/:id/subjects','/:id/descriptions'];(function(_0x5b5e7c,_0x1800d6){var _0x10fe9f=function(_0x3eb6a7){while(--_0x3eb6a7){_0x5b5e7c['push'](_0x5b5e7c['shift']());}};_0x10fe9f(++_0x1800d6);}(_0xf99d,0x8b));var _0xdf99=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xf99d[_0x35007a];return _0x574f68;};'use strict';var multer=require(_0xdf99('0x0'));var util=require('util');var path=require(_0xdf99('0x1'));var timeout=require(_0xdf99('0x2'));var express=require(_0xdf99('0x3'));var router=express[_0xdf99('0x4')]();var fs_extra=require(_0xdf99('0x5'));var auth=require(_0xdf99('0x6'));var interaction=require(_0xdf99('0x7'));var config=require(_0xdf99('0x8'));var controller=require(_0xdf99('0x9'));router['get']('/',auth[_0xdf99('0xa')](),controller[_0xdf99('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdf99('0xc')]);router[_0xdf99('0xd')](_0xdf99('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xdf99('0xd')](_0xdf99('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdf99('0xd')](_0xdf99('0x10'),auth[_0xdf99('0xa')](),controller['getDescriptions']);router[_0xdf99('0xd')]('/:id/tags',auth[_0xdf99('0xa')](),controller[_0xdf99('0x11')]);router['post']('/',auth[_0xdf99('0xa')](),controller[_0xdf99('0x12')]);router[_0xdf99('0x13')](_0xdf99('0x14'),auth[_0xdf99('0xa')](),controller[_0xdf99('0x15')]);router['put']('/:id',auth[_0xdf99('0xa')](),controller[_0xdf99('0x16')]);router[_0xdf99('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xdf99('0x18')]);module[_0xdf99('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3e81323..8b31aad 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 _0xd773=['exports','STRING','sequelize'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0xd773,0x10a));var _0x3d77=function(_0x54c4bc,_0x298d05){_0x54c4bc=_0x54c4bc-0x0;var _0x2fe731=_0xd773[_0x54c4bc];return _0x2fe731;};'use strict';var Sequelize=require(_0x3d77('0x0'));module[_0x3d77('0x1')]={'name':{'type':Sequelize[_0x3d77('0x2')]},'description':{'type':Sequelize[_0x3d77('0x2')]}}; \ No newline at end of file +var _0xf481=['sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf481,0x102));var _0x1f48=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0xf481[_0x24721a];return _0x6a9880;};'use strict';var Sequelize=require(_0x1f48('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 97a9ebb..2c4be16 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 _0xdb45=['keys','options','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdb45,0xb6));var _0x5db4=function(_0x27237c,_0x36f1d4){_0x27237c=_0x27237c-0x0;var _0x1f412e=_0xdb45[_0x27237c];return _0x1f412e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5db4('0x0'));var zipdir=require(_0x5db4('0x1'));var jsonpatch=require(_0x5db4('0x2'));var rp=require('request-promise');var moment=require(_0x5db4('0x3'));var BPromise=require(_0x5db4('0x4'));var Mustache=require('mustache');var util=require(_0x5db4('0x5'));var path=require(_0x5db4('0x6'));var sox=require(_0x5db4('0x7'));var csv=require(_0x5db4('0x8'));var ejs=require(_0x5db4('0x9'));var fs=require('fs');var fs_extra=require(_0x5db4('0xa'));var _=require(_0x5db4('0xb'));var squel=require(_0x5db4('0xc'));var crypto=require(_0x5db4('0xd'));var jsforce=require(_0x5db4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5db4('0x8'));var querystring=require(_0x5db4('0xf'));var Papa=require(_0x5db4('0x10'));var Redis=require(_0x5db4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5db4('0x12'));var as=require(_0x5db4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5db4('0x14'));var db=require(_0x5db4('0x15'))['db'];function respondWithStatusCode(_0x5d5781,_0x4a9a50){_0x4a9a50=_0x4a9a50||0xcc;return function(_0xc7c24d){if(_0xc7c24d){return _0x5d5781[_0x5db4('0x16')](_0x4a9a50);}return _0x5d5781[_0x5db4('0x17')](_0x4a9a50)[_0x5db4('0x18')]();};}function respondWithResult(_0x4fcf54,_0x56752b){_0x56752b=_0x56752b||0xc8;return function(_0x8ac5c9){if(_0x8ac5c9){return _0x4fcf54[_0x5db4('0x17')](_0x56752b)[_0x5db4('0x19')](_0x8ac5c9);}};}function respondWithFilteredResult(_0x46e1b3,_0x5bb33d){return function(_0x4de025){if(_0x4de025){var _0x35c4d9=typeof _0x5bb33d[_0x5db4('0x1a')]===_0x5db4('0x1b')&&typeof _0x5bb33d[_0x5db4('0x1c')]===_0x5db4('0x1b');var _0x3c55e1=_0x4de025[_0x5db4('0x1d')];var _0x588bb0=_0x35c4d9?0x0:_0x5bb33d[_0x5db4('0x1a')];var _0x2eb2e1=_0x35c4d9?_0x4de025[_0x5db4('0x1d')]:_0x5bb33d['offset']+_0x5bb33d['limit'];var _0x373e6f;if(_0x2eb2e1>=_0x3c55e1){_0x2eb2e1=_0x3c55e1;_0x373e6f=0xc8;}else{_0x373e6f=0xce;}_0x46e1b3[_0x5db4('0x17')](_0x373e6f);return _0x46e1b3[_0x5db4('0x1e')](_0x5db4('0x1f'),_0x588bb0+'-'+_0x2eb2e1+'/'+_0x3c55e1)[_0x5db4('0x19')](_0x4de025);}return null;};}function patchUpdates(_0x5f26e5){return function(_0x32e2dc){try{jsonpatch[_0x5db4('0x20')](_0x32e2dc,_0x5f26e5,!![]);}catch(_0x2390c2){return BPromise[_0x5db4('0x21')](_0x2390c2);}return _0x32e2dc[_0x5db4('0x22')]();};}function saveUpdates(_0x440f6b,_0x393d82){return function(_0x5c142c){if(_0x5c142c){return _0x5c142c[_0x5db4('0x23')](_0x440f6b)[_0x5db4('0x24')](function(_0x113b70){return _0x113b70;});}return null;};}function removeEntity(_0x2101e8,_0x930f01){return function(_0x43a0d9){if(_0x43a0d9){return _0x43a0d9[_0x5db4('0x25')]()[_0x5db4('0x24')](function(){_0x2101e8[_0x5db4('0x17')](0xcc)[_0x5db4('0x18')]();});}};}function handleEntityNotFound(_0x657705,_0x172411){return function(_0x3e5f88){if(!_0x3e5f88){_0x657705[_0x5db4('0x16')](0x194);}return _0x3e5f88;};}function handleError(_0x346ac8,_0x2e23ba){_0x2e23ba=_0x2e23ba||0x1f4;return function(_0x32891d){logger[_0x5db4('0x26')](_0x32891d[_0x5db4('0x27')]);if(_0x32891d[_0x5db4('0x28')]){delete _0x32891d[_0x5db4('0x28')];}_0x346ac8['status'](_0x2e23ba)[_0x5db4('0x29')](_0x32891d);};}exports[_0x5db4('0x2a')]=function(_0x47c070,_0x4dc9c2){var _0x12b719={},_0x3e9e1b={},_0x1b0118={'count':0x0,'rows':[]};var _0x4846ed=_[_0x5db4('0x2b')](db[_0x5db4('0x2c')][_0x5db4('0x2d')],function(_0x14ba97){return{'name':_0x14ba97[_0x5db4('0x2e')],'type':_0x14ba97[_0x5db4('0x2f')][_0x5db4('0x30')]};});_0x3e9e1b[_0x5db4('0x31')]=_[_0x5db4('0x2b')](_0x4846ed,_0x5db4('0x28'));_0x3e9e1b[_0x5db4('0x32')]=_['keys'](_0x47c070['query']);_0x3e9e1b[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x3e9e1b[_0x5db4('0x31')],_0x3e9e1b[_0x5db4('0x32')]);_0x12b719[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x3e9e1b['model'],qs[_0x5db4('0x36')](_0x47c070['query']['fields']));_0x12b719[_0x5db4('0x35')]=_0x12b719[_0x5db4('0x35')][_0x5db4('0x37')]?_0x12b719[_0x5db4('0x35')]:_0x3e9e1b['model'];if(!_0x47c070['query'][_0x5db4('0x38')](_0x5db4('0x39'))){_0x12b719['limit']=qs['limit'](_0x47c070[_0x5db4('0x32')]['limit']);_0x12b719[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x47c070[_0x5db4('0x32')][_0x5db4('0x1a')]);}_0x12b719[_0x5db4('0x3a')]=qs[_0x5db4('0x3b')](_0x47c070[_0x5db4('0x32')][_0x5db4('0x3b')]);_0x12b719['where']=qs[_0x5db4('0x33')](_[_0x5db4('0x3c')](_0x47c070[_0x5db4('0x32')],_0x3e9e1b[_0x5db4('0x33')]),_0x4846ed);if(_0x47c070['query'][_0x5db4('0x3d')]){_0x12b719[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x12b719[_0x5db4('0x3e')],{'$or':_['map'](_0x4846ed,function(_0x968067){if(_0x968067[_0x5db4('0x2f')]!==_0x5db4('0x40')){var _0x449363={};_0x449363[_0x968067[_0x5db4('0x28')]]={'$like':'%'+_0x47c070[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x449363;}})});}_0x12b719=_['merge']({},_0x12b719,_0x47c070['options']);var _0x25f8f8={'where':_0x12b719[_0x5db4('0x3e')]};return db[_0x5db4('0x2c')][_0x5db4('0x1d')](_0x25f8f8)[_0x5db4('0x24')](function(_0x526aa5){_0x1b0118[_0x5db4('0x1d')]=_0x526aa5;if(_0x47c070['query'][_0x5db4('0x41')]){_0x12b719[_0x5db4('0x42')]=[{'all':!![]}];}return db[_0x5db4('0x2c')][_0x5db4('0x43')](_0x12b719);})['then'](function(_0x79536f){_0x1b0118['rows']=_0x79536f;return _0x1b0118;})[_0x5db4('0x24')](respondWithFilteredResult(_0x4dc9c2,_0x12b719))[_0x5db4('0x44')](handleError(_0x4dc9c2,null));};exports['show']=function(_0x1ac3ba,_0x1f0ecd){var _0x368a34={'raw':![],'where':{'id':_0x1ac3ba[_0x5db4('0x45')]['id']}},_0x3bee54={};_0x3bee54['model']=_[_0x5db4('0x46')](db['FreshdeskConfiguration'][_0x5db4('0x2d')]);_0x3bee54[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x1ac3ba['query']);_0x3bee54[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x3bee54[_0x5db4('0x31')],_0x3bee54['query']);_0x368a34['attributes']=_[_0x5db4('0x34')](_0x3bee54[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x1ac3ba['query'][_0x5db4('0x36')]));_0x368a34['attributes']=_0x368a34[_0x5db4('0x35')]['length']?_0x368a34[_0x5db4('0x35')]:_0x3bee54[_0x5db4('0x31')];if(_0x1ac3ba[_0x5db4('0x32')][_0x5db4('0x41')]){_0x368a34[_0x5db4('0x42')]=[{'all':!![]}];}_0x368a34=_[_0x5db4('0x3f')]({},_0x368a34,_0x1ac3ba[_0x5db4('0x47')]);return db[_0x5db4('0x2c')][_0x5db4('0x48')](_0x368a34)[_0x5db4('0x24')](handleEntityNotFound(_0x1f0ecd,null))['then'](respondWithResult(_0x1f0ecd,null))[_0x5db4('0x44')](handleError(_0x1f0ecd,null));};exports[_0x5db4('0x49')]=function(_0x27a502,_0x2dfa2d){return db[_0x5db4('0x2c')][_0x5db4('0x49')](_0x27a502[_0x5db4('0x4a')],{})[_0x5db4('0x24')](respondWithResult(_0x2dfa2d,0xc9))['catch'](handleError(_0x2dfa2d,null));};exports[_0x5db4('0x23')]=function(_0x4939b7,_0x2617b8){if(_0x4939b7[_0x5db4('0x4a')]['id']){delete _0x4939b7['body']['id'];}return db[_0x5db4('0x2c')]['find']({'where':{'id':_0x4939b7[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x2617b8,null))[_0x5db4('0x24')](saveUpdates(_0x4939b7['body'],null))['then'](respondWithResult(_0x2617b8,null))[_0x5db4('0x44')](handleError(_0x2617b8,null));};exports[_0x5db4('0x25')]=function(_0xafb3c,_0xc02d63){return db[_0x5db4('0x2c')]['find']({'where':{'id':_0xafb3c[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0xc02d63,null))[_0x5db4('0x24')](removeEntity(_0xc02d63,null))[_0x5db4('0x44')](handleError(_0xc02d63,null));};exports[_0x5db4('0x4b')]=function(_0x2a91ce,_0x556b88,_0x1c68a5){var _0x1e57e1={};var _0x13116e={};var _0x3f92bc;var _0x1814e3;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x2a91ce['params']['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x556b88,null))['then'](function(_0x336b78){if(_0x336b78){_0x3f92bc=_0x336b78;_0x13116e[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')][_0x5db4('0x2d')]);_0x13116e[_0x5db4('0x32')]=_['keys'](_0x2a91ce[_0x5db4('0x32')]);_0x13116e[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x13116e[_0x5db4('0x31')],_0x13116e[_0x5db4('0x32')]);_0x1e57e1['attributes']=_['intersection'](_0x13116e[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x36')]));_0x1e57e1[_0x5db4('0x35')]=_0x1e57e1['attributes'][_0x5db4('0x37')]?_0x1e57e1['attributes']:_0x13116e[_0x5db4('0x31')];_0x1e57e1['order']=qs[_0x5db4('0x3b')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x3b')]);_0x1e57e1[_0x5db4('0x3e')]=qs['filters'](_[_0x5db4('0x3c')](_0x2a91ce['query'],_0x13116e[_0x5db4('0x33')]));if(_0x2a91ce[_0x5db4('0x32')]['filter']){_0x1e57e1[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x1e57e1[_0x5db4('0x3e')],{'$or':_[_0x5db4('0x2b')](_0x1e57e1['attributes'],function(_0x5e0326){var _0x3e0c8a={};_0x3e0c8a[_0x5e0326]={'$like':'%'+_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x3e0c8a;})});}_0x1e57e1=_[_0x5db4('0x3f')]({},_0x1e57e1,_0x2a91ce[_0x5db4('0x47')]);return _0x3f92bc[_0x5db4('0x4b')](_0x1e57e1);}})[_0x5db4('0x24')](function(_0x229901){if(_0x229901){_0x1814e3=_0x229901[_0x5db4('0x37')];if(!_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x38')]('nolimit')){_0x1e57e1[_0x5db4('0x1c')]=qs[_0x5db4('0x1c')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x1e57e1['offset']=qs['offset'](_0x2a91ce['query'][_0x5db4('0x1a')]);}return _0x3f92bc[_0x5db4('0x4b')](_0x1e57e1);}})['then'](function(_0x43118f){if(_0x43118f){return _0x43118f?{'count':_0x1814e3,'rows':_0x43118f}:null;}})[_0x5db4('0x24')](respondWithResult(_0x556b88,null))[_0x5db4('0x44')](handleError(_0x556b88,null));};exports[_0x5db4('0x4e')]=function(_0x14eab3,_0x19ceef,_0x5b57e1){var _0x477d0c={};var _0x23bc02={};var _0x1ff9cd;var _0x168e30;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x14eab3[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x19ceef,null))[_0x5db4('0x24')](function(_0x4ca902){if(_0x4ca902){_0x1ff9cd=_0x4ca902;_0x23bc02[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')]['rawAttributes']);_0x23bc02['query']=_['keys'](_0x14eab3['query']);_0x23bc02[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x23bc02[_0x5db4('0x31')],_0x23bc02[_0x5db4('0x32')]);_0x477d0c['attributes']=_[_0x5db4('0x34')](_0x23bc02['model'],qs['fields'](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x36')]));_0x477d0c[_0x5db4('0x35')]=_0x477d0c['attributes'][_0x5db4('0x37')]?_0x477d0c[_0x5db4('0x35')]:_0x23bc02['model'];_0x477d0c[_0x5db4('0x3a')]=qs[_0x5db4('0x3b')](_0x14eab3[_0x5db4('0x32')]['sort']);_0x477d0c[_0x5db4('0x3e')]=qs[_0x5db4('0x33')](_[_0x5db4('0x3c')](_0x14eab3[_0x5db4('0x32')],_0x23bc02['filters']));if(_0x14eab3[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x477d0c[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x477d0c[_0x5db4('0x3e')],{'$or':_['map'](_0x477d0c[_0x5db4('0x35')],function(_0x47195a){var _0x255b4a={};_0x255b4a[_0x47195a]={'$like':'%'+_0x14eab3[_0x5db4('0x32')]['filter']+'%'};return _0x255b4a;})});}_0x477d0c=_[_0x5db4('0x3f')]({},_0x477d0c,_0x14eab3[_0x5db4('0x47')]);return _0x1ff9cd[_0x5db4('0x4e')](_0x477d0c);}})['then'](function(_0x5167fd){if(_0x5167fd){_0x168e30=_0x5167fd[_0x5db4('0x37')];if(!_0x14eab3['query'][_0x5db4('0x38')](_0x5db4('0x39'))){_0x477d0c[_0x5db4('0x1c')]=qs['limit'](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x477d0c['offset']=qs[_0x5db4('0x1a')](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x1a')]);}return _0x1ff9cd[_0x5db4('0x4e')](_0x477d0c);}})['then'](function(_0x536448){if(_0x536448){return _0x536448?{'count':_0x168e30,'rows':_0x536448}:null;}})[_0x5db4('0x24')](respondWithResult(_0x19ceef,null))[_0x5db4('0x44')](handleError(_0x19ceef,null));};exports[_0x5db4('0x4f')]=function(_0x1e0b06,_0x208bd4,_0xb734fb){var _0x3dafc2={};var _0x1a7879={};var _0x35820d;var _0x58079e;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x1e0b06[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x208bd4,null))[_0x5db4('0x24')](function(_0x36976a){if(_0x36976a){_0x35820d=_0x36976a;_0x1a7879[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')][_0x5db4('0x2d')]);_0x1a7879[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x1e0b06[_0x5db4('0x32')]);_0x1a7879[_0x5db4('0x33')]=_['intersection'](_0x1a7879[_0x5db4('0x31')],_0x1a7879[_0x5db4('0x32')]);_0x3dafc2[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x1a7879[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x36')]));_0x3dafc2[_0x5db4('0x35')]=_0x3dafc2[_0x5db4('0x35')][_0x5db4('0x37')]?_0x3dafc2['attributes']:_0x1a7879['model'];_0x3dafc2[_0x5db4('0x3a')]=qs['sort'](_0x1e0b06['query']['sort']);_0x3dafc2['where']=qs['filters'](_[_0x5db4('0x3c')](_0x1e0b06[_0x5db4('0x32')],_0x1a7879[_0x5db4('0x33')]));if(_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x3dafc2[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x3dafc2['where'],{'$or':_[_0x5db4('0x2b')](_0x3dafc2[_0x5db4('0x35')],function(_0xe19906){var _0x3df807={};_0x3df807[_0xe19906]={'$like':'%'+_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x3df807;})});}_0x3dafc2=_[_0x5db4('0x3f')]({},_0x3dafc2,_0x1e0b06[_0x5db4('0x47')]);return _0x35820d['getDescriptions'](_0x3dafc2);}})[_0x5db4('0x24')](function(_0xe2b949){if(_0xe2b949){_0x58079e=_0xe2b949[_0x5db4('0x37')];if(!_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x38')](_0x5db4('0x39'))){_0x3dafc2[_0x5db4('0x1c')]=qs[_0x5db4('0x1c')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x3dafc2[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x1a')]);}return _0x35820d['getDescriptions'](_0x3dafc2);}})[_0x5db4('0x24')](function(_0x1217f6){if(_0x1217f6){return _0x1217f6?{'count':_0x58079e,'rows':_0x1217f6}:null;}})[_0x5db4('0x24')](respondWithResult(_0x208bd4,null))[_0x5db4('0x44')](handleError(_0x208bd4,null));};exports[_0x5db4('0x50')]=function(_0x3ab12a,_0x36e5da,_0x207aa1){var _0x364a50={};var _0x4c8caf={};var _0x45f08b;var _0x362cd7;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x3ab12a[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x36e5da,null))[_0x5db4('0x24')](function(_0x3b634c){if(_0x3b634c){_0x45f08b=_0x3b634c;_0x4c8caf[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x51')][_0x5db4('0x2d')]);_0x4c8caf[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x3ab12a[_0x5db4('0x32')]);_0x4c8caf[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x4c8caf['model'],_0x4c8caf[_0x5db4('0x32')]);_0x364a50[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x4c8caf[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x36')]));_0x364a50[_0x5db4('0x35')]=_0x364a50['attributes'][_0x5db4('0x37')]?_0x364a50[_0x5db4('0x35')]:_0x4c8caf[_0x5db4('0x31')];_0x364a50['order']=qs[_0x5db4('0x3b')](_0x3ab12a['query'][_0x5db4('0x3b')]);_0x364a50[_0x5db4('0x3e')]=qs[_0x5db4('0x33')](_['pick'](_0x3ab12a[_0x5db4('0x32')],_0x4c8caf['filters']));if(_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x364a50[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x364a50[_0x5db4('0x3e')],{'$or':_['map'](_0x364a50[_0x5db4('0x35')],function(_0x30b006){var _0x3a6aab={};_0x3a6aab[_0x30b006]={'$like':'%'+_0x3ab12a['query'][_0x5db4('0x3d')]+'%'};return _0x3a6aab;})});}_0x364a50=_[_0x5db4('0x3f')]({},_0x364a50,_0x3ab12a[_0x5db4('0x47')]);return _0x45f08b[_0x5db4('0x50')](_0x364a50);}})[_0x5db4('0x24')](function(_0x5865f9){if(_0x5865f9){_0x362cd7=_0x5865f9[_0x5db4('0x37')];if(!_0x3ab12a[_0x5db4('0x32')]['hasOwnProperty'](_0x5db4('0x39'))){_0x364a50['limit']=qs[_0x5db4('0x1c')](_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x364a50[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x3ab12a['query']['offset']);}return _0x45f08b['getTags'](_0x364a50);}})[_0x5db4('0x24')](function(_0x8b02d0){if(_0x8b02d0){return _0x8b02d0?{'count':_0x362cd7,'rows':_0x8b02d0}:null;}})['then'](respondWithResult(_0x36e5da,null))[_0x5db4('0x44')](handleError(_0x36e5da,null));};exports[_0x5db4('0x52')]=function(_0x12b6e3,_0x1aeb3b,_0x272460){if(_0x12b6e3[_0x5db4('0x4a')]['id']){delete _0x12b6e3[_0x5db4('0x4a')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x12b6e3[_0x5db4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aeb3b,null))[_0x5db4('0x24')](function(_0x5c9d5c){if(_0x5c9d5c){return _0x5c9d5c[_0x5db4('0x52')](_0x12b6e3[_0x5db4('0x4a')][_0x5db4('0x53')]||[]);}return null;})[_0x5db4('0x24')](respondWithResult(_0x1aeb3b,null))[_0x5db4('0x44')](handleError(_0x1aeb3b,null));}; \ No newline at end of file +var _0x09f8=['error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','filters','pick','where','VIRTUAL','filter','merge','options','FreshdeskConfiguration','include','catch','show','length','includeAll','find','create','body','update','params','destroy','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','status'];(function(_0x1647f0,_0x40b657){var _0x3ed600=function(_0xd29f95){while(--_0xd29f95){_0x1647f0['push'](_0x1647f0['shift']());}};_0x3ed600(++_0x40b657);}(_0x09f8,0x12a));var _0x809f=function(_0x3d5d96,_0x474ee8){_0x3d5d96=_0x3d5d96-0x0;var _0x1ba137=_0x09f8[_0x3d5d96];return _0x1ba137;};'use strict';var emlformat=require(_0x809f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x809f('0x1'));var rp=require(_0x809f('0x2'));var moment=require('moment');var BPromise=require(_0x809f('0x3'));var Mustache=require(_0x809f('0x4'));var util=require('util');var path=require(_0x809f('0x5'));var sox=require(_0x809f('0x6'));var csv=require(_0x809f('0x7'));var ejs=require(_0x809f('0x8'));var fs=require('fs');var fs_extra=require(_0x809f('0x9'));var _=require(_0x809f('0xa'));var squel=require(_0x809f('0xb'));var crypto=require(_0x809f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x809f('0xd'));var toCsv=require(_0x809f('0x7'));var querystring=require(_0x809f('0xe'));var Papa=require(_0x809f('0xf'));var Redis=require(_0x809f('0x10'));var authService=require(_0x809f('0x11'));var qs=require(_0x809f('0x12'));var as=require(_0x809f('0x13'));var hardwareService=require(_0x809f('0x14'));var logger=require(_0x809f('0x15'))(_0x809f('0x16'));var utils=require(_0x809f('0x17'));var config=require(_0x809f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eca22,_0x2325fb){_0x2325fb=_0x2325fb||0xcc;return function(_0xb0ad98){if(_0xb0ad98){return _0x2eca22[_0x809f('0x19')](_0x2325fb);}return _0x2eca22['status'](_0x2325fb)[_0x809f('0x1a')]();};}function respondWithResult(_0x5c48ad,_0x2cd669){_0x2cd669=_0x2cd669||0xc8;return function(_0x3179d0){if(_0x3179d0){return _0x5c48ad['status'](_0x2cd669)[_0x809f('0x1b')](_0x3179d0);}};}function respondWithFilteredResult(_0x53029b,_0x58787d){return function(_0x536df5){if(_0x536df5){var _0x4370d3=typeof _0x58787d[_0x809f('0x1c')]==='undefined'&&typeof _0x58787d[_0x809f('0x1d')]===_0x809f('0x1e');var _0x27e91a=_0x536df5[_0x809f('0x1f')];var _0x48c30d=_0x4370d3?0x0:_0x58787d[_0x809f('0x1c')];var _0x3455e7=_0x4370d3?_0x536df5[_0x809f('0x1f')]:_0x58787d[_0x809f('0x1c')]+_0x58787d['limit'];var _0x9a83a1;if(_0x3455e7>=_0x27e91a){_0x3455e7=_0x27e91a;_0x9a83a1=0xc8;}else{_0x9a83a1=0xce;}_0x53029b['status'](_0x9a83a1);return _0x53029b[_0x809f('0x20')](_0x809f('0x21'),_0x48c30d+'-'+_0x3455e7+'/'+_0x27e91a)[_0x809f('0x1b')](_0x536df5);}return null;};}function patchUpdates(_0x2baa91){return function(_0x2016c7){try{jsonpatch['apply'](_0x2016c7,_0x2baa91,!![]);}catch(_0x9e5acd){return BPromise[_0x809f('0x22')](_0x9e5acd);}return _0x2016c7[_0x809f('0x23')]();};}function saveUpdates(_0x344294,_0x428f28){return function(_0x3f1b2a){if(_0x3f1b2a){return _0x3f1b2a['update'](_0x344294)[_0x809f('0x24')](function(_0x2d1221){return _0x2d1221;});}return null;};}function removeEntity(_0x113236,_0x110706){return function(_0x10f51f){if(_0x10f51f){return _0x10f51f['destroy']()['then'](function(){_0x113236[_0x809f('0x25')](0xcc)[_0x809f('0x1a')]();});}};}function handleEntityNotFound(_0xfb6f91,_0x434c15){return function(_0x3071c5){if(!_0x3071c5){_0xfb6f91['sendStatus'](0x194);}return _0x3071c5;};}function handleError(_0x21346f,_0x3aab28){_0x3aab28=_0x3aab28||0x1f4;return function(_0x49e945){logger[_0x809f('0x26')](_0x49e945[_0x809f('0x27')]);if(_0x49e945[_0x809f('0x28')]){delete _0x49e945[_0x809f('0x28')];}_0x21346f['status'](_0x3aab28)['send'](_0x49e945);};}exports[_0x809f('0x29')]=function(_0x1578f8,_0x5cfb07){var _0x51b31e={},_0x164e36={},_0x23afd1={'count':0x0,'rows':[]};var _0x5320bf=_[_0x809f('0x2a')](db['FreshdeskConfiguration'][_0x809f('0x2b')],function(_0x5b7e0d){return{'name':_0x5b7e0d[_0x809f('0x2c')],'type':_0x5b7e0d[_0x809f('0x2d')]['key']};});_0x164e36[_0x809f('0x2e')]=_[_0x809f('0x2a')](_0x5320bf,'name');_0x164e36[_0x809f('0x2f')]=_[_0x809f('0x30')](_0x1578f8[_0x809f('0x2f')]);_0x164e36['filters']=_[_0x809f('0x31')](_0x164e36[_0x809f('0x2e')],_0x164e36[_0x809f('0x2f')]);_0x51b31e['attributes']=_[_0x809f('0x31')](_0x164e36[_0x809f('0x2e')],qs[_0x809f('0x32')](_0x1578f8['query'][_0x809f('0x32')]));_0x51b31e[_0x809f('0x33')]=_0x51b31e[_0x809f('0x33')]['length']?_0x51b31e[_0x809f('0x33')]:_0x164e36[_0x809f('0x2e')];if(!_0x1578f8[_0x809f('0x2f')][_0x809f('0x34')](_0x809f('0x35'))){_0x51b31e[_0x809f('0x1d')]=qs[_0x809f('0x1d')](_0x1578f8['query'][_0x809f('0x1d')]);_0x51b31e['offset']=qs['offset'](_0x1578f8['query'][_0x809f('0x1c')]);}_0x51b31e[_0x809f('0x36')]=qs['sort'](_0x1578f8[_0x809f('0x2f')]['sort']);_0x51b31e['where']=qs[_0x809f('0x37')](_[_0x809f('0x38')](_0x1578f8[_0x809f('0x2f')],_0x164e36[_0x809f('0x37')]),_0x5320bf);if(_0x1578f8['query']['filter']){_0x51b31e[_0x809f('0x39')]=_['merge'](_0x51b31e['where'],{'$or':_['map'](_0x5320bf,function(_0x1d8320){if(_0x1d8320['type']!==_0x809f('0x3a')){var _0x590a0f={};_0x590a0f[_0x1d8320['name']]={'$like':'%'+_0x1578f8[_0x809f('0x2f')][_0x809f('0x3b')]+'%'};return _0x590a0f;}})});}_0x51b31e=_[_0x809f('0x3c')]({},_0x51b31e,_0x1578f8[_0x809f('0x3d')]);var _0x180e86={'where':_0x51b31e[_0x809f('0x39')]};return db[_0x809f('0x3e')][_0x809f('0x1f')](_0x180e86)[_0x809f('0x24')](function(_0x50588c){_0x23afd1[_0x809f('0x1f')]=_0x50588c;if(_0x1578f8['query']['includeAll']){_0x51b31e[_0x809f('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x51b31e);})['then'](function(_0x6369cf){_0x23afd1['rows']=_0x6369cf;return _0x23afd1;})[_0x809f('0x24')](respondWithFilteredResult(_0x5cfb07,_0x51b31e))[_0x809f('0x40')](handleError(_0x5cfb07,null));};exports[_0x809f('0x41')]=function(_0x2dee63,_0x23c47f){var _0x1e7020={'raw':![],'where':{'id':_0x2dee63['params']['id']}},_0x5f4a41={};_0x5f4a41['model']=_['keys'](db['FreshdeskConfiguration'][_0x809f('0x2b')]);_0x5f4a41[_0x809f('0x2f')]=_[_0x809f('0x30')](_0x2dee63[_0x809f('0x2f')]);_0x5f4a41['filters']=_[_0x809f('0x31')](_0x5f4a41[_0x809f('0x2e')],_0x5f4a41[_0x809f('0x2f')]);_0x1e7020[_0x809f('0x33')]=_[_0x809f('0x31')](_0x5f4a41['model'],qs[_0x809f('0x32')](_0x2dee63['query'][_0x809f('0x32')]));_0x1e7020['attributes']=_0x1e7020['attributes'][_0x809f('0x42')]?_0x1e7020[_0x809f('0x33')]:_0x5f4a41['model'];if(_0x2dee63[_0x809f('0x2f')][_0x809f('0x43')]){_0x1e7020[_0x809f('0x3f')]=[{'all':!![]}];}_0x1e7020=_[_0x809f('0x3c')]({},_0x1e7020,_0x2dee63[_0x809f('0x3d')]);return db[_0x809f('0x3e')][_0x809f('0x44')](_0x1e7020)[_0x809f('0x24')](handleEntityNotFound(_0x23c47f,null))[_0x809f('0x24')](respondWithResult(_0x23c47f,null))[_0x809f('0x40')](handleError(_0x23c47f,null));};exports['create']=function(_0x3fc1f1,_0xc13700){return db[_0x809f('0x3e')][_0x809f('0x45')](_0x3fc1f1[_0x809f('0x46')],{})['then'](respondWithResult(_0xc13700,0xc9))[_0x809f('0x40')](handleError(_0xc13700,null));};exports[_0x809f('0x47')]=function(_0x3c300a,_0xcc4e13){if(_0x3c300a['body']['id']){delete _0x3c300a['body']['id'];}return db['FreshdeskConfiguration'][_0x809f('0x44')]({'where':{'id':_0x3c300a[_0x809f('0x48')]['id']}})[_0x809f('0x24')](handleEntityNotFound(_0xcc4e13,null))['then'](saveUpdates(_0x3c300a[_0x809f('0x46')],null))['then'](respondWithResult(_0xcc4e13,null))['catch'](handleError(_0xcc4e13,null));};exports[_0x809f('0x49')]=function(_0x13b795,_0x3602f0){return db[_0x809f('0x3e')]['find']({'where':{'id':_0x13b795[_0x809f('0x48')]['id']}})['then'](handleEntityNotFound(_0x3602f0,null))[_0x809f('0x24')](removeEntity(_0x3602f0,null))[_0x809f('0x40')](handleError(_0x3602f0,null));};exports[_0x809f('0x4a')]=function(_0xb66198,_0x2d6d6c,_0x5072b3){var _0x24396b={};var _0x372636={};var _0xcb50be;var _0xb8ae02;return db['FreshdeskConfiguration'][_0x809f('0x4b')]({'where':{'id':_0xb66198[_0x809f('0x48')]['id']}})[_0x809f('0x24')](handleEntityNotFound(_0x2d6d6c,null))['then'](function(_0xc79030){if(_0xc79030){_0xcb50be=_0xc79030;_0x372636[_0x809f('0x2e')]=_[_0x809f('0x30')](db[_0x809f('0x4c')]['rawAttributes']);_0x372636[_0x809f('0x2f')]=_['keys'](_0xb66198['query']);_0x372636[_0x809f('0x37')]=_[_0x809f('0x31')](_0x372636[_0x809f('0x2e')],_0x372636[_0x809f('0x2f')]);_0x24396b[_0x809f('0x33')]=_[_0x809f('0x31')](_0x372636[_0x809f('0x2e')],qs['fields'](_0xb66198[_0x809f('0x2f')][_0x809f('0x32')]));_0x24396b[_0x809f('0x33')]=_0x24396b[_0x809f('0x33')][_0x809f('0x42')]?_0x24396b['attributes']:_0x372636[_0x809f('0x2e')];_0x24396b[_0x809f('0x36')]=qs['sort'](_0xb66198[_0x809f('0x2f')][_0x809f('0x4d')]);_0x24396b[_0x809f('0x39')]=qs[_0x809f('0x37')](_[_0x809f('0x38')](_0xb66198['query'],_0x372636[_0x809f('0x37')]));if(_0xb66198[_0x809f('0x2f')][_0x809f('0x3b')]){_0x24396b['where']=_['merge'](_0x24396b['where'],{'$or':_[_0x809f('0x2a')](_0x24396b[_0x809f('0x33')],function(_0x5994af){var _0x187586={};_0x187586[_0x5994af]={'$like':'%'+_0xb66198['query']['filter']+'%'};return _0x187586;})});}_0x24396b=_[_0x809f('0x3c')]({},_0x24396b,_0xb66198[_0x809f('0x3d')]);return _0xcb50be[_0x809f('0x4a')](_0x24396b);}})[_0x809f('0x24')](function(_0x16c958){if(_0x16c958){_0xb8ae02=_0x16c958['length'];if(!_0xb66198[_0x809f('0x2f')][_0x809f('0x34')]('nolimit')){_0x24396b[_0x809f('0x1d')]=qs[_0x809f('0x1d')](_0xb66198[_0x809f('0x2f')][_0x809f('0x1d')]);_0x24396b[_0x809f('0x1c')]=qs[_0x809f('0x1c')](_0xb66198[_0x809f('0x2f')]['offset']);}return _0xcb50be[_0x809f('0x4a')](_0x24396b);}})['then'](function(_0x3c15f5){if(_0x3c15f5){return _0x3c15f5?{'count':_0xb8ae02,'rows':_0x3c15f5}:null;}})[_0x809f('0x24')](respondWithResult(_0x2d6d6c,null))['catch'](handleError(_0x2d6d6c,null));};exports[_0x809f('0x4e')]=function(_0x27facf,_0x4eb9a8,_0xe5a507){var _0x5d514b={};var _0x30ce06={};var _0x544192;var _0x3698ea;return db[_0x809f('0x3e')][_0x809f('0x4b')]({'where':{'id':_0x27facf[_0x809f('0x48')]['id']}})[_0x809f('0x24')](handleEntityNotFound(_0x4eb9a8,null))[_0x809f('0x24')](function(_0x44044a){if(_0x44044a){_0x544192=_0x44044a;_0x30ce06[_0x809f('0x2e')]=_['keys'](db[_0x809f('0x4c')]['rawAttributes']);_0x30ce06[_0x809f('0x2f')]=_[_0x809f('0x30')](_0x27facf[_0x809f('0x2f')]);_0x30ce06[_0x809f('0x37')]=_[_0x809f('0x31')](_0x30ce06[_0x809f('0x2e')],_0x30ce06[_0x809f('0x2f')]);_0x5d514b['attributes']=_[_0x809f('0x31')](_0x30ce06['model'],qs['fields'](_0x27facf['query'][_0x809f('0x32')]));_0x5d514b[_0x809f('0x33')]=_0x5d514b[_0x809f('0x33')]['length']?_0x5d514b[_0x809f('0x33')]:_0x30ce06[_0x809f('0x2e')];_0x5d514b['order']=qs['sort'](_0x27facf[_0x809f('0x2f')]['sort']);_0x5d514b['where']=qs[_0x809f('0x37')](_['pick'](_0x27facf[_0x809f('0x2f')],_0x30ce06[_0x809f('0x37')]));if(_0x27facf[_0x809f('0x2f')][_0x809f('0x3b')]){_0x5d514b[_0x809f('0x39')]=_[_0x809f('0x3c')](_0x5d514b['where'],{'$or':_['map'](_0x5d514b[_0x809f('0x33')],function(_0x21f105){var _0x401c7b={};_0x401c7b[_0x21f105]={'$like':'%'+_0x27facf['query'][_0x809f('0x3b')]+'%'};return _0x401c7b;})});}_0x5d514b=_['merge']({},_0x5d514b,_0x27facf[_0x809f('0x3d')]);return _0x544192[_0x809f('0x4e')](_0x5d514b);}})[_0x809f('0x24')](function(_0x2844b8){if(_0x2844b8){_0x3698ea=_0x2844b8[_0x809f('0x42')];if(!_0x27facf['query'][_0x809f('0x34')](_0x809f('0x35'))){_0x5d514b[_0x809f('0x1d')]=qs['limit'](_0x27facf['query'][_0x809f('0x1d')]);_0x5d514b[_0x809f('0x1c')]=qs[_0x809f('0x1c')](_0x27facf[_0x809f('0x2f')]['offset']);}return _0x544192[_0x809f('0x4e')](_0x5d514b);}})[_0x809f('0x24')](function(_0x866d14){if(_0x866d14){return _0x866d14?{'count':_0x3698ea,'rows':_0x866d14}:null;}})[_0x809f('0x24')](respondWithResult(_0x4eb9a8,null))['catch'](handleError(_0x4eb9a8,null));};exports['getDescriptions']=function(_0x2821d5,_0x471345,_0x249c0f){var _0x4dbb45={};var _0x2d4d54={};var _0x3044c8;var _0x481610;return db[_0x809f('0x3e')]['findOne']({'where':{'id':_0x2821d5[_0x809f('0x48')]['id']}})[_0x809f('0x24')](handleEntityNotFound(_0x471345,null))[_0x809f('0x24')](function(_0x34f506){if(_0x34f506){_0x3044c8=_0x34f506;_0x2d4d54[_0x809f('0x2e')]=_['keys'](db[_0x809f('0x4c')]['rawAttributes']);_0x2d4d54[_0x809f('0x2f')]=_[_0x809f('0x30')](_0x2821d5['query']);_0x2d4d54[_0x809f('0x37')]=_[_0x809f('0x31')](_0x2d4d54['model'],_0x2d4d54[_0x809f('0x2f')]);_0x4dbb45[_0x809f('0x33')]=_[_0x809f('0x31')](_0x2d4d54[_0x809f('0x2e')],qs['fields'](_0x2821d5[_0x809f('0x2f')][_0x809f('0x32')]));_0x4dbb45[_0x809f('0x33')]=_0x4dbb45['attributes']['length']?_0x4dbb45[_0x809f('0x33')]:_0x2d4d54[_0x809f('0x2e')];_0x4dbb45['order']=qs[_0x809f('0x4d')](_0x2821d5['query']['sort']);_0x4dbb45[_0x809f('0x39')]=qs[_0x809f('0x37')](_[_0x809f('0x38')](_0x2821d5[_0x809f('0x2f')],_0x2d4d54[_0x809f('0x37')]));if(_0x2821d5['query'][_0x809f('0x3b')]){_0x4dbb45[_0x809f('0x39')]=_[_0x809f('0x3c')](_0x4dbb45[_0x809f('0x39')],{'$or':_['map'](_0x4dbb45[_0x809f('0x33')],function(_0x5f405a){var _0x46c46d={};_0x46c46d[_0x5f405a]={'$like':'%'+_0x2821d5[_0x809f('0x2f')][_0x809f('0x3b')]+'%'};return _0x46c46d;})});}_0x4dbb45=_[_0x809f('0x3c')]({},_0x4dbb45,_0x2821d5[_0x809f('0x3d')]);return _0x3044c8[_0x809f('0x4f')](_0x4dbb45);}})[_0x809f('0x24')](function(_0x113567){if(_0x113567){_0x481610=_0x113567[_0x809f('0x42')];if(!_0x2821d5['query'][_0x809f('0x34')](_0x809f('0x35'))){_0x4dbb45[_0x809f('0x1d')]=qs['limit'](_0x2821d5[_0x809f('0x2f')][_0x809f('0x1d')]);_0x4dbb45[_0x809f('0x1c')]=qs[_0x809f('0x1c')](_0x2821d5[_0x809f('0x2f')][_0x809f('0x1c')]);}return _0x3044c8[_0x809f('0x4f')](_0x4dbb45);}})[_0x809f('0x24')](function(_0x1a140f){if(_0x1a140f){return _0x1a140f?{'count':_0x481610,'rows':_0x1a140f}:null;}})['then'](respondWithResult(_0x471345,null))[_0x809f('0x40')](handleError(_0x471345,null));};exports['getTags']=function(_0x7290dd,_0x11abe7,_0x269a70){var _0x41ce33={};var _0x1e88b6={};var _0x1af7c5;var _0x590214;return db[_0x809f('0x3e')][_0x809f('0x4b')]({'where':{'id':_0x7290dd['params']['id']}})['then'](handleEntityNotFound(_0x11abe7,null))[_0x809f('0x24')](function(_0x26357a){if(_0x26357a){_0x1af7c5=_0x26357a;_0x1e88b6['model']=_[_0x809f('0x30')](db[_0x809f('0x50')]['rawAttributes']);_0x1e88b6['query']=_[_0x809f('0x30')](_0x7290dd[_0x809f('0x2f')]);_0x1e88b6[_0x809f('0x37')]=_['intersection'](_0x1e88b6[_0x809f('0x2e')],_0x1e88b6['query']);_0x41ce33[_0x809f('0x33')]=_[_0x809f('0x31')](_0x1e88b6[_0x809f('0x2e')],qs[_0x809f('0x32')](_0x7290dd[_0x809f('0x2f')]['fields']));_0x41ce33[_0x809f('0x33')]=_0x41ce33[_0x809f('0x33')][_0x809f('0x42')]?_0x41ce33[_0x809f('0x33')]:_0x1e88b6[_0x809f('0x2e')];_0x41ce33['order']=qs[_0x809f('0x4d')](_0x7290dd[_0x809f('0x2f')][_0x809f('0x4d')]);_0x41ce33[_0x809f('0x39')]=qs[_0x809f('0x37')](_['pick'](_0x7290dd[_0x809f('0x2f')],_0x1e88b6['filters']));if(_0x7290dd['query'][_0x809f('0x3b')]){_0x41ce33[_0x809f('0x39')]=_['merge'](_0x41ce33[_0x809f('0x39')],{'$or':_['map'](_0x41ce33[_0x809f('0x33')],function(_0x5d1e5b){var _0x2b5f0b={};_0x2b5f0b[_0x5d1e5b]={'$like':'%'+_0x7290dd[_0x809f('0x2f')][_0x809f('0x3b')]+'%'};return _0x2b5f0b;})});}_0x41ce33=_['merge']({},_0x41ce33,_0x7290dd[_0x809f('0x3d')]);return _0x1af7c5[_0x809f('0x51')](_0x41ce33);}})[_0x809f('0x24')](function(_0x315f76){if(_0x315f76){_0x590214=_0x315f76[_0x809f('0x42')];if(!_0x7290dd[_0x809f('0x2f')][_0x809f('0x34')]('nolimit')){_0x41ce33['limit']=qs['limit'](_0x7290dd[_0x809f('0x2f')][_0x809f('0x1d')]);_0x41ce33[_0x809f('0x1c')]=qs[_0x809f('0x1c')](_0x7290dd[_0x809f('0x2f')][_0x809f('0x1c')]);}return _0x1af7c5[_0x809f('0x51')](_0x41ce33);}})[_0x809f('0x24')](function(_0x31ca0b){if(_0x31ca0b){return _0x31ca0b?{'count':_0x590214,'rows':_0x31ca0b}:null;}})[_0x809f('0x24')](respondWithResult(_0x11abe7,null))[_0x809f('0x40')](handleError(_0x11abe7,null));};exports['setTags']=function(_0xb9ebd7,_0x327feb,_0x1eea00){if(_0xb9ebd7[_0x809f('0x46')]['id']){delete _0xb9ebd7[_0x809f('0x46')]['id'];}return db[_0x809f('0x3e')][_0x809f('0x4b')]({'where':{'id':_0xb9ebd7['params']['id']}})[_0x809f('0x24')](handleEntityNotFound(_0x327feb,null))[_0x809f('0x24')](function(_0x44cfde){if(_0x44cfde){return _0x44cfde[_0x809f('0x52')](_0xb9ebd7[_0x809f('0x46')][_0x809f('0x53')]||[]);}return null;})[_0x809f('0x24')](respondWithResult(_0x327feb,null))[_0x809f('0x40')](handleError(_0x327feb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5743271..962382b 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 _0x8b9b=['bluebird','path','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8b9b,0x13b));var _0xb8b9=function(_0x409c8b,_0x4892d4){_0x409c8b=_0x409c8b-0x0;var _0x430500=_0x8b9b[_0x409c8b];return _0x430500;};'use strict';var _=require(_0xb8b9('0x0'));var util=require(_0xb8b9('0x1'));var logger=require('../../config/logger')(_0xb8b9('0x2'));var moment=require(_0xb8b9('0x3'));var BPromise=require(_0xb8b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8b9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8b9('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb8b9('0x7')]=function(_0x1add95,_0x3f22a0){return _0x1add95[_0xb8b9('0x8')](_0xb8b9('0x9'),attributes,{'tableName':_0xb8b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1796=['exports','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1796,0x19a));var _0x6179=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x1796[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require('lodash');var util=require(_0x6179('0x0'));var logger=require(_0x6179('0x1'))(_0x6179('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6179('0x3'));var fs=require('fs');var path=require(_0x6179('0x4'));var rimraf=require(_0x6179('0x5'));var config=require(_0x6179('0x6'));var attributes=require(_0x6179('0x7'));module[_0x6179('0x8')]=function(_0x55f60b,_0x2c76ac){return _0x55f60b['define'](_0x6179('0x9'),attributes,{'tableName':_0x6179('0xa'),'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 609e659..183549a 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 _0xe600=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3605fc,_0x388a23){var _0xd02479=function(_0x47cd22){while(--_0x47cd22){_0x3605fc['push'](_0x3605fc['shift']());}};_0xd02479(++_0x388a23);}(_0xe600,0x101));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0e60('0x0'));var util=require(_0x0e60('0x1'));var moment=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var rs=require(_0x0e60('0x4'));var fs=require('fs');var Redis=require(_0x0e60('0x5'));var db=require(_0x0e60('0x6'))['db'];var utils=require(_0x0e60('0x7'));var logger=require(_0x0e60('0x8'))(_0x0e60('0x9'));var config=require(_0x0e60('0xa'));var jayson=require(_0x0e60('0xb'));var client=jayson['client'][_0x0e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55260e,_0x5ba3ca,_0x4aed93){return new BPromise(function(_0x1a68a1,_0x2f2b52){return client['request'](_0x55260e,_0x4aed93)[_0x0e60('0xd')](function(_0x460c89){logger[_0x0e60('0xe')](_0x0e60('0xf'),_0x5ba3ca,'request\x20sent');logger[_0x0e60('0x10')](_0x0e60('0x11'),_0x5ba3ca,'request\x20sent',JSON['stringify'](_0x460c89));if(_0x460c89[_0x0e60('0x12')]){if(_0x460c89['error'][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ba3ca,_0x460c89[_0x0e60('0x12')]['message']);return _0x2f2b52(_0x460c89[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xf'),_0x5ba3ca,_0x460c89['error'][_0x0e60('0x14')]);return _0x1a68a1(_0x460c89[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ba3ca,_0x0e60('0x15'));_0x1a68a1(_0x460c89[_0x0e60('0x16')][_0x0e60('0x14')]);}})[_0x0e60('0x17')](function(_0xccc038){logger[_0x0e60('0x12')](_0x0e60('0xf'),_0x5ba3ca,_0xccc038);_0x2f2b52(_0xccc038);});});} \ No newline at end of file +var _0x8697=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x8697,0x12a));var _0x7869=function(_0x23f966,_0x25df3f){_0x23f966=_0x23f966-0x0;var _0x16fcac=_0x8697[_0x23f966];return _0x16fcac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7869('0x0'));var BPromise=require(_0x7869('0x1'));var rs=require(_0x7869('0x2'));var fs=require('fs');var Redis=require(_0x7869('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7869('0x4'));var logger=require('../../config/logger')(_0x7869('0x5'));var config=require(_0x7869('0x6'));var jayson=require(_0x7869('0x7'));var client=jayson[_0x7869('0x8')][_0x7869('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x361897,_0xb68694,_0x462f43){return new BPromise(function(_0x261fac,_0x4fb608){return client[_0x7869('0xa')](_0x361897,_0x462f43)['then'](function(_0x122701){logger[_0x7869('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb68694,_0x7869('0xc'));logger[_0x7869('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xb68694,_0x7869('0xc'),JSON['stringify'](_0x122701));if(_0x122701[_0x7869('0xe')]){if(_0x122701[_0x7869('0xe')][_0x7869('0xf')]===0x1f4){logger[_0x7869('0xe')](_0x7869('0x10'),_0xb68694,_0x122701[_0x7869('0xe')]['message']);return _0x4fb608(_0x122701[_0x7869('0xe')][_0x7869('0x11')]);}logger['error'](_0x7869('0x10'),_0xb68694,_0x122701[_0x7869('0xe')]['message']);return _0x261fac(_0x122701[_0x7869('0xe')][_0x7869('0x11')]);}else{logger['info'](_0x7869('0x10'),_0xb68694,_0x7869('0xc'));_0x261fac(_0x122701[_0x7869('0x12')]['message']);}})[_0x7869('0x13')](function(_0x3a56f9){logger[_0x7869('0xe')](_0x7869('0x10'),_0xb68694,_0x3a56f9);_0x4fb608(_0x3a56f9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8ec3ba5..915add9 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 _0xae7f=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer'];(function(_0x204106,_0x3e2e12){var _0x157a1a=function(_0x7a1440){while(--_0x7a1440){_0x204106['push'](_0x204106['shift']());}};_0x157a1a(++_0x3e2e12);}(_0xae7f,0x68));var _0xfae7=function(_0xc68188,_0x237a6d){_0xc68188=_0xc68188-0x0;var _0x248fe3=_0xae7f[_0xc68188];return _0x248fe3;};'use strict';var multer=require(_0xfae7('0x0'));var util=require(_0xfae7('0x1'));var path=require('path');var timeout=require(_0xfae7('0x2'));var express=require(_0xfae7('0x3'));var router=express[_0xfae7('0x4')]();var fs_extra=require(_0xfae7('0x5'));var auth=require(_0xfae7('0x6'));var interaction=require(_0xfae7('0x7'));var config=require(_0xfae7('0x8'));var controller=require(_0xfae7('0x9'));router[_0xfae7('0xa')]('/',auth['isAuthenticated'](),controller[_0xfae7('0xb')]);router[_0xfae7('0xa')](_0xfae7('0xc'),auth[_0xfae7('0xd')](),controller[_0xfae7('0xe')]);router['post']('/',auth[_0xfae7('0xd')](),controller[_0xfae7('0xf')]);router[_0xfae7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfae7('0x11')]);router[_0xfae7('0x12')]('/:id',auth[_0xfae7('0xd')](),controller[_0xfae7('0x13')]);module[_0xfae7('0x14')]=router; \ No newline at end of file +var _0x9680=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x32e4ef,_0x1799f5){var _0x2640e3=function(_0x3b5fb9){while(--_0x3b5fb9){_0x32e4ef['push'](_0x32e4ef['shift']());}};_0x2640e3(++_0x1799f5);}(_0x9680,0x7a));var _0x0968=function(_0x5e904e,_0x6749bb){_0x5e904e=_0x5e904e-0x0;var _0x787ee2=_0x9680[_0x5e904e];return _0x787ee2;};'use strict';var multer=require(_0x0968('0x0'));var util=require(_0x0968('0x1'));var path=require(_0x0968('0x2'));var timeout=require(_0x0968('0x3'));var express=require('express');var router=express[_0x0968('0x4')]();var fs_extra=require(_0x0968('0x5'));var auth=require(_0x0968('0x6'));var interaction=require(_0x0968('0x7'));var config=require(_0x0968('0x8'));var controller=require(_0x0968('0x9'));router[_0x0968('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0968('0xa')](_0x0968('0xb'),auth[_0x0968('0xc')](),controller[_0x0968('0xd')]);router[_0x0968('0xe')]('/',auth[_0x0968('0xc')](),controller[_0x0968('0xf')]);router[_0x0968('0x10')](_0x0968('0xb'),auth[_0x0968('0xc')](),controller[_0x0968('0x11')]);router[_0x0968('0x12')](_0x0968('0xb'),auth[_0x0968('0xc')](),controller[_0x0968('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ee9781c..3691e8d 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 _0xc97e=['STRING','BOOLEAN','exports','ENUM','string','variable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc97e,0x11a));var _0xec97=function(_0x30f53a,_0x55acf8){_0x30f53a=_0x30f53a-0x0;var _0x24fd11=_0xc97e[_0x30f53a];return _0x24fd11;};'use strict';var Sequelize=require('sequelize');module[_0xec97('0x0')]={'type':{'type':Sequelize[_0xec97('0x1')](_0xec97('0x2'),_0xec97('0x3'),'customVariable','keyValue',_0xec97('0x4')),'defaultValue':_0xec97('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xec97('0x2'),_0xec97('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xec97('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xec97('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec97('0x5')]}}; \ No newline at end of file +var _0xe477=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe477,0x99));var _0x7e47=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xe477[_0x18aaaf];return _0x52d892;};'use strict';var Sequelize=require(_0x7e47('0x0'));module['exports']={'type':{'type':Sequelize[_0x7e47('0x1')](_0x7e47('0x2'),_0x7e47('0x3'),_0x7e47('0x4'),'keyValue','picklist'),'defaultValue':_0x7e47('0x2')},'content':{'type':Sequelize[_0x7e47('0x5')]},'key':{'type':Sequelize[_0x7e47('0x5')]},'keyType':{'type':Sequelize[_0x7e47('0x1')](_0x7e47('0x2'),_0x7e47('0x3'),_0x7e47('0x4'))},'keyContent':{'type':Sequelize[_0x7e47('0x5')]},'idField':{'type':Sequelize[_0x7e47('0x5')]},'nameField':{'type':Sequelize[_0x7e47('0x5')]},'customField':{'type':Sequelize[_0x7e47('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e47('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 74b9016..aff99d3 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 _0x235a=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x280b44,_0x42ba2b){var _0x347efa=function(_0x398653){while(--_0x398653){_0x280b44['push'](_0x280b44['shift']());}};_0x347efa(++_0x42ba2b);}(_0x235a,0x1ef));var _0xa235=function(_0x275998,_0x2e6420){_0x275998=_0x275998-0x0;var _0x1558ef=_0x235a[_0x275998];return _0x1558ef;};'use strict';var emlformat=require(_0xa235('0x0'));var rimraf=require(_0xa235('0x1'));var zipdir=require(_0xa235('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var Mustache=require(_0xa235('0x5'));var util=require(_0xa235('0x6'));var path=require(_0xa235('0x7'));var sox=require(_0xa235('0x8'));var csv=require(_0xa235('0x9'));var ejs=require(_0xa235('0xa'));var fs=require('fs');var fs_extra=require(_0xa235('0xb'));var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];function respondWithStatusCode(_0x5330db,_0x5510ff){_0x5510ff=_0x5510ff||0xcc;return function(_0x47aad7){if(_0x47aad7){return _0x5330db[_0xa235('0x17')](_0x5510ff);}return _0x5330db[_0xa235('0x18')](_0x5510ff)[_0xa235('0x19')]();};}function respondWithResult(_0x3bf6fc,_0x36b4b1){_0x36b4b1=_0x36b4b1||0xc8;return function(_0x44ea6a){if(_0x44ea6a){return _0x3bf6fc[_0xa235('0x18')](_0x36b4b1)[_0xa235('0x1a')](_0x44ea6a);}};}function respondWithFilteredResult(_0x1369de,_0x4aceee){return function(_0x352463){if(_0x352463){var _0x20cd67=typeof _0x4aceee[_0xa235('0x1b')]===_0xa235('0x1c')&&typeof _0x4aceee[_0xa235('0x1d')]===_0xa235('0x1c');var _0x5c6e95=_0x352463['count'];var _0x446ea2=_0x20cd67?0x0:_0x4aceee[_0xa235('0x1b')];var _0x2b3769=_0x20cd67?_0x352463['count']:_0x4aceee[_0xa235('0x1b')]+_0x4aceee[_0xa235('0x1d')];var _0x3ca514;if(_0x2b3769>=_0x5c6e95){_0x2b3769=_0x5c6e95;_0x3ca514=0xc8;}else{_0x3ca514=0xce;}_0x1369de[_0xa235('0x18')](_0x3ca514);return _0x1369de[_0xa235('0x1e')](_0xa235('0x1f'),_0x446ea2+'-'+_0x2b3769+'/'+_0x5c6e95)[_0xa235('0x1a')](_0x352463);}return null;};}function patchUpdates(_0x483771){return function(_0x5a3bea){try{jsonpatch[_0xa235('0x20')](_0x5a3bea,_0x483771,!![]);}catch(_0x21940f){return BPromise[_0xa235('0x21')](_0x21940f);}return _0x5a3bea[_0xa235('0x22')]();};}function saveUpdates(_0x2e38e,_0x3deeea){return function(_0x3d9f70){if(_0x3d9f70){return _0x3d9f70[_0xa235('0x23')](_0x2e38e)[_0xa235('0x24')](function(_0x216083){return _0x216083;});}return null;};}function removeEntity(_0x3219f1,_0x20292c){return function(_0xee45e1){if(_0xee45e1){return _0xee45e1[_0xa235('0x25')]()[_0xa235('0x24')](function(){_0x3219f1[_0xa235('0x18')](0xcc)[_0xa235('0x19')]();});}};}function handleEntityNotFound(_0x13c868,_0x976c9f){return function(_0x1cb892){if(!_0x1cb892){_0x13c868[_0xa235('0x17')](0x194);}return _0x1cb892;};}function handleError(_0x57f591,_0xe1176c){_0xe1176c=_0xe1176c||0x1f4;return function(_0x533b15){logger[_0xa235('0x26')](_0x533b15['stack']);if(_0x533b15[_0xa235('0x27')]){delete _0x533b15[_0xa235('0x27')];}_0x57f591[_0xa235('0x18')](_0xe1176c)[_0xa235('0x28')](_0x533b15);};}exports[_0xa235('0x29')]=function(_0x5d811a,_0x2585c7){var _0x612f2={},_0x55a21e={},_0x4b33ef={'count':0x0,'rows':[]};var _0x502df9=_['map'](db[_0xa235('0x2a')][_0xa235('0x2b')],function(_0x2d8073){return{'name':_0x2d8073[_0xa235('0x2c')],'type':_0x2d8073[_0xa235('0x2d')][_0xa235('0x2e')]};});_0x55a21e[_0xa235('0x2f')]=_['map'](_0x502df9,'name');_0x55a21e[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5d811a['query']);_0x55a21e[_0xa235('0x32')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],_0x55a21e[_0xa235('0x30')]);_0x612f2[_0xa235('0x34')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5d811a['query'][_0xa235('0x35')]));_0x612f2['attributes']=_0x612f2[_0xa235('0x34')][_0xa235('0x36')]?_0x612f2[_0xa235('0x34')]:_0x55a21e[_0xa235('0x2f')];if(!_0x5d811a[_0xa235('0x30')][_0xa235('0x37')](_0xa235('0x38'))){_0x612f2[_0xa235('0x1d')]=qs[_0xa235('0x1d')](_0x5d811a[_0xa235('0x30')][_0xa235('0x1d')]);_0x612f2[_0xa235('0x1b')]=qs[_0xa235('0x1b')](_0x5d811a['query']['offset']);}_0x612f2['order']=qs[_0xa235('0x39')](_0x5d811a['query'][_0xa235('0x39')]);_0x612f2[_0xa235('0x3a')]=qs[_0xa235('0x32')](_[_0xa235('0x3b')](_0x5d811a[_0xa235('0x30')],_0x55a21e[_0xa235('0x32')]),_0x502df9);if(_0x5d811a[_0xa235('0x30')]['filter']){_0x612f2[_0xa235('0x3a')]=_[_0xa235('0x3c')](_0x612f2['where'],{'$or':_[_0xa235('0x3d')](_0x502df9,function(_0x3fa927){if(_0x3fa927[_0xa235('0x2d')]!==_0xa235('0x3e')){var _0x45cc55={};_0x45cc55[_0x3fa927[_0xa235('0x27')]]={'$like':'%'+_0x5d811a[_0xa235('0x30')][_0xa235('0x3f')]+'%'};return _0x45cc55;}})});}_0x612f2=_[_0xa235('0x3c')]({},_0x612f2,_0x5d811a['options']);var _0x28c259={'where':_0x612f2[_0xa235('0x3a')]};return db[_0xa235('0x2a')][_0xa235('0x40')](_0x28c259)[_0xa235('0x24')](function(_0x542755){_0x4b33ef[_0xa235('0x40')]=_0x542755;if(_0x5d811a[_0xa235('0x30')][_0xa235('0x41')]){_0x612f2[_0xa235('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa235('0x43')](_0x612f2);})[_0xa235('0x24')](function(_0x47801f){_0x4b33ef[_0xa235('0x44')]=_0x47801f;return _0x4b33ef;})[_0xa235('0x24')](respondWithFilteredResult(_0x2585c7,_0x612f2))[_0xa235('0x45')](handleError(_0x2585c7,null));};exports[_0xa235('0x46')]=function(_0x5c203c,_0x333ed8){var _0x4748d8={'raw':!![],'where':{'id':_0x5c203c[_0xa235('0x47')]['id']}},_0x1e90a9={};_0x1e90a9[_0xa235('0x2f')]=_['keys'](db[_0xa235('0x2a')][_0xa235('0x2b')]);_0x1e90a9[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5c203c[_0xa235('0x30')]);_0x1e90a9['filters']=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],_0x1e90a9[_0xa235('0x30')]);_0x4748d8[_0xa235('0x34')]=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5c203c[_0xa235('0x30')]['fields']));_0x4748d8[_0xa235('0x34')]=_0x4748d8[_0xa235('0x34')][_0xa235('0x36')]?_0x4748d8[_0xa235('0x34')]:_0x1e90a9[_0xa235('0x2f')];if(_0x5c203c[_0xa235('0x30')][_0xa235('0x41')]){_0x4748d8[_0xa235('0x42')]=[{'all':!![]}];}_0x4748d8=_[_0xa235('0x3c')]({},_0x4748d8,_0x5c203c['options']);return db[_0xa235('0x2a')][_0xa235('0x48')](_0x4748d8)[_0xa235('0x24')](handleEntityNotFound(_0x333ed8,null))[_0xa235('0x24')](respondWithResult(_0x333ed8,null))[_0xa235('0x45')](handleError(_0x333ed8,null));};exports['create']=function(_0x22f11c,_0x11b5e7){return db['FreshdeskField'][_0xa235('0x49')](_0x22f11c[_0xa235('0x4a')],{})[_0xa235('0x24')](respondWithResult(_0x11b5e7,0xc9))[_0xa235('0x45')](handleError(_0x11b5e7,null));};exports['update']=function(_0x16d9e8,_0x4909e9){if(_0x16d9e8[_0xa235('0x4a')]['id']){delete _0x16d9e8[_0xa235('0x4a')]['id'];}return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x16d9e8[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x4909e9,null))[_0xa235('0x24')](saveUpdates(_0x16d9e8[_0xa235('0x4a')],null))[_0xa235('0x24')](respondWithResult(_0x4909e9,null))[_0xa235('0x45')](handleError(_0x4909e9,null));};exports[_0xa235('0x25')]=function(_0x5ab614,_0x5033dc){return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x5ab614[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x5033dc,null))[_0xa235('0x24')](removeEntity(_0x5033dc,null))['catch'](handleError(_0x5033dc,null));}; \ No newline at end of file +var _0x9348=['undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','FreshdeskField','count','include','findAll','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x2fef06,_0x17efe0){var _0x3435ad=function(_0x49266f){while(--_0x49266f){_0x2fef06['push'](_0x2fef06['shift']());}};_0x3435ad(++_0x17efe0);}(_0x9348,0x10d));var _0x8934=function(_0x5352ca,_0x150276){_0x5352ca=_0x5352ca-0x0;var _0x215f96=_0x9348[_0x5352ca];return _0x215f96;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['FreshdeskField'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['FreshdeskField'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0bba975..a16c49a 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 _0xc1e8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0xc1e8,0x87));var _0x8c1e=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xc1e8[_0x24618a];return _0x2e3d64;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var logger=require(_0x8c1e('0x2'))(_0x8c1e('0x3'));var moment=require(_0x8c1e('0x4'));var BPromise=require(_0x8c1e('0x5'));var rp=require(_0x8c1e('0x6'));var fs=require('fs');var path=require(_0x8c1e('0x7'));var rimraf=require(_0x8c1e('0x8'));var config=require(_0x8c1e('0x9'));var attributes=require(_0x8c1e('0xa'));module[_0x8c1e('0xb')]=function(_0x57e576,_0x380525){return _0x57e576[_0x8c1e('0xc')](_0x8c1e('0xd'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x8c1e('0xe'),'fields':[_0x8c1e('0xf'),_0x8c1e('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util'];(function(_0x25aed1,_0x4d955d){var _0x102326=function(_0x5ad640){while(--_0x5ad640){_0x25aed1['push'](_0x25aed1['shift']());}};_0x102326(++_0x4d955d);}(_0xd6cb,0xde));var _0xbd6c=function(_0x3f9130,_0xc0246f){_0x3f9130=_0x3f9130-0x0;var _0x568e1e=_0xd6cb[_0x3f9130];return _0x568e1e;};'use strict';var _=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var logger=require(_0xbd6c('0x2'))(_0xbd6c('0x3'));var moment=require('moment');var BPromise=require(_0xbd6c('0x4'));var rp=require(_0xbd6c('0x5'));var fs=require('fs');var path=require(_0xbd6c('0x6'));var rimraf=require(_0xbd6c('0x7'));var config=require(_0xbd6c('0x8'));var attributes=require(_0xbd6c('0x9'));module[_0xbd6c('0xa')]=function(_0x10d92b,_0x3633aa){return _0x10d92b[_0xbd6c('0xb')](_0xbd6c('0xc'),attributes,{'tableName':_0xbd6c('0xd'),'paranoid':![],'indexes':[{'name':_0xbd6c('0xe'),'fields':[_0xbd6c('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c7c04ba..a2f978d 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 _0xd548=['error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x116a29,_0x4fe941){var _0x16d90f=function(_0x402a8a){while(--_0x402a8a){_0x116a29['push'](_0x116a29['shift']());}};_0x16d90f(++_0x4fe941);}(_0xd548,0x1e0));var _0x8d54=function(_0x59883a,_0x5564cd){_0x59883a=_0x59883a-0x0;var _0x4ffe68=_0xd548[_0x59883a];return _0x4ffe68;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d54('0x0'));var BPromise=require(_0x8d54('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d54('0x2'));var db=require(_0x8d54('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d54('0x4'))(_0x8d54('0x5'));var config=require(_0x8d54('0x6'));var jayson=require(_0x8d54('0x7'));var client=jayson[_0x8d54('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x678289,_0x4aee31,_0x5d2023){return new BPromise(function(_0x1a3624,_0x220816){return client[_0x8d54('0x9')](_0x678289,_0x5d2023)['then'](function(_0x4afe38){logger[_0x8d54('0xa')](_0x8d54('0xb'),_0x4aee31,'request\x20sent');logger['debug'](_0x8d54('0xc'),_0x4aee31,_0x8d54('0xd'),JSON['stringify'](_0x4afe38));if(_0x4afe38[_0x8d54('0xe')]){if(_0x4afe38['error'][_0x8d54('0xf')]===0x1f4){logger[_0x8d54('0xe')](_0x8d54('0xb'),_0x4aee31,_0x4afe38[_0x8d54('0xe')]['message']);return _0x220816(_0x4afe38[_0x8d54('0xe')][_0x8d54('0x10')]);}logger['error'](_0x8d54('0xb'),_0x4aee31,_0x4afe38['error'][_0x8d54('0x10')]);return _0x1a3624(_0x4afe38[_0x8d54('0xe')][_0x8d54('0x10')]);}else{logger[_0x8d54('0xa')](_0x8d54('0xb'),_0x4aee31,_0x8d54('0xd'));_0x1a3624(_0x4afe38[_0x8d54('0x11')][_0x8d54('0x10')]);}})[_0x8d54('0x12')](function(_0x205306){logger[_0x8d54('0xe')](_0x8d54('0xb'),_0x4aee31,_0x205306);_0x220816(_0x205306);});});} \ No newline at end of file +var _0xe288=['debug','stringify','error','message','info','result','catch','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0xe288,0xbb));var _0x8e28=function(_0x36cfae,_0x35dae4){_0x36cfae=_0x36cfae-0x0;var _0x297137=_0xe288[_0x36cfae];return _0x297137;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e28('0x0'));var fs=require('fs');var Redis=require(_0x8e28('0x1'));var db=require(_0x8e28('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e28('0x3'))(_0x8e28('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e28('0x5')][_0x8e28('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4437e8,_0x25b857,_0x251e1c){return new BPromise(function(_0xc6046f,_0xa31df3){return client[_0x8e28('0x7')](_0x4437e8,_0x251e1c)[_0x8e28('0x8')](function(_0xfcbabd){logger['info'](_0x8e28('0x9'),_0x25b857,_0x8e28('0xa'));logger[_0x8e28('0xb')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x25b857,_0x8e28('0xa'),JSON[_0x8e28('0xc')](_0xfcbabd));if(_0xfcbabd[_0x8e28('0xd')]){if(_0xfcbabd[_0x8e28('0xd')]['code']===0x1f4){logger['error'](_0x8e28('0x9'),_0x25b857,_0xfcbabd[_0x8e28('0xd')][_0x8e28('0xe')]);return _0xa31df3(_0xfcbabd[_0x8e28('0xd')][_0x8e28('0xe')]);}logger['error'](_0x8e28('0x9'),_0x25b857,_0xfcbabd[_0x8e28('0xd')]['message']);return _0xc6046f(_0xfcbabd['error'][_0x8e28('0xe')]);}else{logger[_0x8e28('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x25b857,_0x8e28('0xa'));_0xc6046f(_0xfcbabd[_0x8e28('0x10')][_0x8e28('0xe')]);}})[_0x8e28('0x11')](function(_0xbdcf83){logger['error'](_0x8e28('0x9'),_0x25b857,_0xbdcf83);_0xa31df3(_0xbdcf83);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e69869e..13a96ad 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 _0xb574=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util'];(function(_0x27da38,_0x3a3192){var _0x2ca893=function(_0x3c83ea){while(--_0x3c83ea){_0x27da38['push'](_0x27da38['shift']());}};_0x2ca893(++_0x3a3192);}(_0xb574,0x106));var _0x4b57=function(_0x4f4488,_0x2ce30c){_0x4f4488=_0x4f4488-0x0;var _0x167548=_0xb574[_0x4f4488];return _0x167548;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require('path');var timeout=require(_0x4b57('0x2'));var express=require(_0x4b57('0x3'));var router=express['Router']();var fs_extra=require(_0x4b57('0x4'));var auth=require(_0x4b57('0x5'));var interaction=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var controller=require(_0x4b57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4b57('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b57('0xa')](_0x4b57('0xb'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xd')]);router[_0x4b57('0xa')](_0x4b57('0xe'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xf')]);router['post']('/',auth[_0x4b57('0xc')](),controller[_0x4b57('0x10')]);router[_0x4b57('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4b57('0x12')]);router[_0x4b57('0x13')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x15')]);router[_0x4b57('0x16')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf290=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x475ea5,_0xd72cee){var _0x1400f8=function(_0x3f1b1d){while(--_0x3f1b1d){_0x475ea5['push'](_0x475ea5['shift']());}};_0x1400f8(++_0xd72cee);}(_0xf290,0xde));var _0x0f29=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xf290[_0xd09668];return _0x68726;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),controller['create']);router[_0x0f29('0x10')]('/:id/configurations',auth[_0x0f29('0xa')](),controller[_0x0f29('0x11')]);router[_0x0f29('0x12')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x13')]);router['delete'](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);module[_0x0f29('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 646131b..0adec1d 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(_0x245d15,_0x347515){var _0x558034=function(_0x5eba1c){while(--_0x5eba1c){_0x245d15['push'](_0x245d15['shift']());}};_0x558034(++_0x347515);}(_0x4b17,0x10f));var _0x74b1=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x4b17[_0x584291];return _0x4e7d08;};'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 _0x6d38=['exports','STRING','remoteUri'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6d38[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('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 b704b4d..5b456dd 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 _0xa319=['includeAll','include','rows','show','params','rawAttributes','fields','length','create','catch','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','lastIndexOf','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count'];(function(_0xbcb4bf,_0x5296ed){var _0x3932b3=function(_0x3df0f2){while(--_0x3df0f2){_0xbcb4bf['push'](_0xbcb4bf['shift']());}};_0x3932b3(++_0x5296ed);}(_0xa319,0x1c6));var _0x9a31=function(_0x351739,_0xac9fb3){_0x351739=_0x351739-0x0;var _0x258028=_0xa319[_0x351739];return _0x258028;};'use strict';var emlformat=require(_0x9a31('0x0'));var rimraf=require(_0x9a31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a31('0x2'));var moment=require(_0x9a31('0x3'));var BPromise=require(_0x9a31('0x4'));var Mustache=require(_0x9a31('0x5'));var util=require(_0x9a31('0x6'));var path=require('path');var sox=require(_0x9a31('0x7'));var csv=require(_0x9a31('0x8'));var ejs=require(_0x9a31('0x9'));var fs=require('fs');var fs_extra=require(_0x9a31('0xa'));var _=require(_0x9a31('0xb'));var squel=require(_0x9a31('0xc'));var crypto=require(_0x9a31('0xd'));var jsforce=require(_0x9a31('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a31('0x8'));var querystring=require('querystring');var Papa=require(_0x9a31('0xf'));var Redis=require('ioredis');var authService=require(_0x9a31('0x10'));var qs=require(_0x9a31('0x11'));var as=require(_0x9a31('0x12'));var hardwareService=require(_0x9a31('0x13'));var logger=require('../../config/logger')(_0x9a31('0x14'));var utils=require(_0x9a31('0x15'));var config=require(_0x9a31('0x16'));var licenseUtil=require(_0x9a31('0x17'));var db=require(_0x9a31('0x18'))['db'];var integrations=require(_0x9a31('0x19'));function respondWithStatusCode(_0x5aafe1,_0x3a9eac){_0x3a9eac=_0x3a9eac||0xcc;return function(_0x307fb8){if(_0x307fb8){return _0x5aafe1[_0x9a31('0x1a')](_0x3a9eac);}return _0x5aafe1[_0x9a31('0x1b')](_0x3a9eac)[_0x9a31('0x1c')]();};}function respondWithResult(_0x362c5e,_0x252fd1){_0x252fd1=_0x252fd1||0xc8;return function(_0x5bd261){if(_0x5bd261){return _0x362c5e[_0x9a31('0x1b')](_0x252fd1)[_0x9a31('0x1d')](_0x5bd261);}};}function respondWithFilteredResult(_0x3c9f0d,_0xbdea1){return function(_0x1d4805){if(_0x1d4805){var _0x3f924b=typeof _0xbdea1[_0x9a31('0x1e')]==='undefined'&&typeof _0xbdea1[_0x9a31('0x1f')]===_0x9a31('0x20');var _0x45e199=_0x1d4805['count'];var _0x2ca979=_0x3f924b?0x0:_0xbdea1['offset'];var _0x2152c=_0x3f924b?_0x1d4805['count']:_0xbdea1[_0x9a31('0x1e')]+_0xbdea1[_0x9a31('0x1f')];var _0x51bd04;if(_0x2152c>=_0x45e199){_0x2152c=_0x45e199;_0x51bd04=0xc8;}else{_0x51bd04=0xce;}_0x3c9f0d['status'](_0x51bd04);return _0x3c9f0d[_0x9a31('0x21')](_0x9a31('0x22'),_0x2ca979+'-'+_0x2152c+'/'+_0x45e199)[_0x9a31('0x1d')](_0x1d4805);}return null;};}function patchUpdates(_0x5ba710){return function(_0xb0178){try{jsonpatch[_0x9a31('0x23')](_0xb0178,_0x5ba710,!![]);}catch(_0x300edf){return BPromise[_0x9a31('0x24')](_0x300edf);}return _0xb0178[_0x9a31('0x25')]();};}function saveUpdates(_0x106b4f,_0x3e68c8){return function(_0x24b576){if(_0x24b576){return _0x24b576[_0x9a31('0x26')](_0x106b4f)[_0x9a31('0x27')](function(_0xa0eca5){return _0xa0eca5;});}return null;};}function removeEntity(_0x42615b,_0x1e0d75){return function(_0x32b4d0){if(_0x32b4d0){return _0x32b4d0[_0x9a31('0x28')]()[_0x9a31('0x27')](function(){_0x42615b[_0x9a31('0x1b')](0xcc)[_0x9a31('0x1c')]();});}};}function handleEntityNotFound(_0x19e14e,_0x1eb720){return function(_0x65d01e){if(!_0x65d01e){_0x19e14e[_0x9a31('0x1a')](0x194);}return _0x65d01e;};}function handleError(_0xb79270,_0x154a7b){_0x154a7b=_0x154a7b||0x1f4;return function(_0x4f6208){logger['error'](_0x4f6208[_0x9a31('0x29')]);if(_0x4f6208[_0x9a31('0x2a')]){delete _0x4f6208['name'];}_0xb79270[_0x9a31('0x1b')](_0x154a7b)[_0x9a31('0x2b')](_0x4f6208);};}exports[_0x9a31('0x2c')]=function(_0x3da748,_0x4e9802){var _0x39c321={},_0x2b78a9={},_0x2d4379={'count':0x0,'rows':[]};var _0x4a4b66=_[_0x9a31('0x2d')](db[_0x9a31('0x2e')]['rawAttributes'],function(_0x347e0e){return{'name':_0x347e0e[_0x9a31('0x2f')],'type':_0x347e0e[_0x9a31('0x30')][_0x9a31('0x31')]};});_0x2b78a9[_0x9a31('0x32')]=_[_0x9a31('0x2d')](_0x4a4b66,_0x9a31('0x2a'));_0x2b78a9[_0x9a31('0x33')]=_[_0x9a31('0x34')](_0x3da748[_0x9a31('0x33')]);_0x2b78a9[_0x9a31('0x35')]=_['intersection'](_0x2b78a9[_0x9a31('0x32')],_0x2b78a9[_0x9a31('0x33')]);_0x39c321[_0x9a31('0x36')]=_[_0x9a31('0x37')](_0x2b78a9['model'],qs['fields'](_0x3da748[_0x9a31('0x33')]['fields']));_0x39c321['attributes']=_0x39c321[_0x9a31('0x36')]['length']?_0x39c321[_0x9a31('0x36')]:_0x2b78a9[_0x9a31('0x32')];if(!_0x3da748['query'][_0x9a31('0x38')](_0x9a31('0x39'))){_0x39c321[_0x9a31('0x1f')]=qs[_0x9a31('0x1f')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x1f')]);_0x39c321[_0x9a31('0x1e')]=qs[_0x9a31('0x1e')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x1e')]);}_0x39c321[_0x9a31('0x3a')]=qs[_0x9a31('0x3b')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x3b')]);_0x39c321[_0x9a31('0x3c')]=qs[_0x9a31('0x35')](_['pick'](_0x3da748[_0x9a31('0x33')],_0x2b78a9['filters']),_0x4a4b66);if(_0x3da748[_0x9a31('0x33')][_0x9a31('0x3d')]){_0x39c321[_0x9a31('0x3c')]=_[_0x9a31('0x3e')](_0x39c321['where'],{'$or':_['map'](_0x4a4b66,function(_0x1f4153){if(_0x1f4153[_0x9a31('0x30')]!==_0x9a31('0x3f')){var _0x43e675={};_0x43e675[_0x1f4153[_0x9a31('0x2a')]]={'$like':'%'+_0x3da748[_0x9a31('0x33')][_0x9a31('0x3d')]+'%'};return _0x43e675;}})});}_0x39c321=_[_0x9a31('0x3e')]({},_0x39c321,_0x3da748[_0x9a31('0x40')]);var _0x25cf2f={'where':_0x39c321['where']};return db[_0x9a31('0x2e')][_0x9a31('0x41')](_0x25cf2f)[_0x9a31('0x27')](function(_0x5e947d){_0x2d4379[_0x9a31('0x41')]=_0x5e947d;if(_0x3da748[_0x9a31('0x33')][_0x9a31('0x42')]){_0x39c321[_0x9a31('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x39c321);})[_0x9a31('0x27')](function(_0x30307b){_0x2d4379[_0x9a31('0x44')]=_0x30307b;return _0x2d4379;})[_0x9a31('0x27')](respondWithFilteredResult(_0x4e9802,_0x39c321))['catch'](handleError(_0x4e9802,null));};exports[_0x9a31('0x45')]=function(_0x236eb0,_0x26995f){var _0x4a203b={'raw':![],'where':{'id':_0x236eb0[_0x9a31('0x46')]['id']}},_0x23b821={};_0x23b821[_0x9a31('0x32')]=_['keys'](db['FreshsalesAccount'][_0x9a31('0x47')]);_0x23b821[_0x9a31('0x33')]=_['keys'](_0x236eb0[_0x9a31('0x33')]);_0x23b821[_0x9a31('0x35')]=_[_0x9a31('0x37')](_0x23b821['model'],_0x23b821[_0x9a31('0x33')]);_0x4a203b['attributes']=_[_0x9a31('0x37')](_0x23b821[_0x9a31('0x32')],qs[_0x9a31('0x48')](_0x236eb0[_0x9a31('0x33')][_0x9a31('0x48')]));_0x4a203b[_0x9a31('0x36')]=_0x4a203b[_0x9a31('0x36')][_0x9a31('0x49')]?_0x4a203b[_0x9a31('0x36')]:_0x23b821[_0x9a31('0x32')];if(_0x236eb0[_0x9a31('0x33')][_0x9a31('0x42')]){_0x4a203b[_0x9a31('0x43')]=[{'all':!![]}];}_0x4a203b=_[_0x9a31('0x3e')]({},_0x4a203b,_0x236eb0[_0x9a31('0x40')]);return db['FreshsalesAccount']['find'](_0x4a203b)[_0x9a31('0x27')](handleEntityNotFound(_0x26995f,null))['then'](respondWithResult(_0x26995f,null))['catch'](handleError(_0x26995f,null));};exports[_0x9a31('0x4a')]=function(_0x56b2e0,_0x3fc04e){return db['FreshsalesAccount']['create'](_0x56b2e0['body'],{})[_0x9a31('0x27')](respondWithResult(_0x3fc04e,0xc9))[_0x9a31('0x4b')](handleError(_0x3fc04e,null));};exports[_0x9a31('0x26')]=function(_0x12b733,_0x166701){if(_0x12b733[_0x9a31('0x4c')]['id']){delete _0x12b733[_0x9a31('0x4c')]['id'];}return db[_0x9a31('0x2e')][_0x9a31('0x4d')]({'where':{'id':_0x12b733[_0x9a31('0x46')]['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x166701,null))['then'](saveUpdates(_0x12b733[_0x9a31('0x4c')],null))['then'](respondWithResult(_0x166701,null))['catch'](handleError(_0x166701,null));};exports[_0x9a31('0x28')]=function(_0x2e3ce6,_0x586ca9){return db[_0x9a31('0x2e')][_0x9a31('0x4d')]({'where':{'id':_0x2e3ce6['params']['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x586ca9,null))['then'](removeEntity(_0x586ca9,null))[_0x9a31('0x4b')](handleError(_0x586ca9,null));};exports[_0x9a31('0x4e')]=function(_0x23fb7a,_0x3977b9,_0x53c2ce){var _0x1aac28={};var _0x2131cc={};var _0x4cfffe;var _0x461340;return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x23fb7a['params']['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x3977b9,null))['then'](function(_0x1214ff){if(_0x1214ff){_0x4cfffe=_0x1214ff;_0x2131cc[_0x9a31('0x32')]=_['keys'](db[_0x9a31('0x50')][_0x9a31('0x47')]);_0x2131cc[_0x9a31('0x33')]=_['keys'](_0x23fb7a[_0x9a31('0x33')]);_0x2131cc[_0x9a31('0x35')]=_[_0x9a31('0x37')](_0x2131cc[_0x9a31('0x32')],_0x2131cc[_0x9a31('0x33')]);_0x1aac28['attributes']=_[_0x9a31('0x37')](_0x2131cc[_0x9a31('0x32')],qs['fields'](_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x48')]));_0x1aac28[_0x9a31('0x36')]=_0x1aac28['attributes'][_0x9a31('0x49')]?_0x1aac28[_0x9a31('0x36')]:_0x2131cc[_0x9a31('0x32')];_0x1aac28[_0x9a31('0x3a')]=qs[_0x9a31('0x3b')](_0x23fb7a['query'][_0x9a31('0x3b')]);_0x1aac28['where']=qs[_0x9a31('0x35')](_[_0x9a31('0x51')](_0x23fb7a[_0x9a31('0x33')],_0x2131cc[_0x9a31('0x35')]));if(_0x23fb7a[_0x9a31('0x33')]['filter']){_0x1aac28['where']=_[_0x9a31('0x3e')](_0x1aac28['where'],{'$or':_[_0x9a31('0x2d')](_0x1aac28['attributes'],function(_0x2477d9){var _0x211fdc={};_0x211fdc[_0x2477d9]={'$like':'%'+_0x23fb7a['query']['filter']+'%'};return _0x211fdc;})});}_0x1aac28=_[_0x9a31('0x3e')]({},_0x1aac28,_0x23fb7a[_0x9a31('0x40')]);return _0x4cfffe['getConfigurations'](_0x1aac28);}})[_0x9a31('0x27')](function(_0x176966){if(_0x176966){_0x461340=_0x176966['length'];if(!_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x38')]('nolimit')){_0x1aac28['limit']=qs[_0x9a31('0x1f')](_0x23fb7a[_0x9a31('0x33')]['limit']);_0x1aac28['offset']=qs[_0x9a31('0x1e')](_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x1e')]);}return _0x4cfffe[_0x9a31('0x4e')](_0x1aac28);}})['then'](function(_0x37fbb3){if(_0x37fbb3){return _0x37fbb3?{'count':_0x461340,'rows':_0x37fbb3}:null;}})['then'](respondWithResult(_0x3977b9,null))['catch'](handleError(_0x3977b9,null));};exports[_0x9a31('0x52')]=function(_0x1d49cc,_0x29f71c,_0x270280){if(_0x1d49cc[_0x9a31('0x4c')]['id']){delete _0x1d49cc[_0x9a31('0x4c')]['id'];}return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x1d49cc[_0x9a31('0x46')]['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x29f71c,null))[_0x9a31('0x27')](function(_0x55d839){if(_0x55d839){_0x1d49cc[_0x9a31('0x4c')]['AccountId']=_0x55d839['id'];_0x1d49cc['body']['Subjects']=integrations[_0x9a31('0x53')](_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x54')],_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x30')]);_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x55')]=integrations[_0x9a31('0x56')](_0x1d49cc['body'][_0x9a31('0x54')],_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x30')]);return db[_0x9a31('0x50')][_0x9a31('0x4a')](_0x1d49cc['body'],{'include':[{'model':db[_0x9a31('0x57')],'as':_0x9a31('0x58')},{'model':db['FreshsalesField'],'as':_0x9a31('0x55')}]});}return null;})[_0x9a31('0x27')](respondWithResult(_0x29f71c,null))[_0x9a31('0x4b')](handleError(_0x29f71c,null));};exports[_0x9a31('0x59')]=function(_0x372727,_0x5e62a3,_0x58f69a){var _0x2317d1='';var _0x36ca76='';return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x372727[_0x9a31('0x46')]['id']},'attributes':['id',_0x9a31('0x5a'),_0x9a31('0x5b'),_0x9a31('0x5c')]})[_0x9a31('0x27')](handleEntityNotFound(_0x5e62a3,null))[_0x9a31('0x27')](function(_0x37c344){if(_0x37c344){_0x36ca76=_0x37c344['username'];_0x2317d1=_0x37c344[_0x9a31('0x5b')];var _0x1d6e32=_0x37c344['remoteUri'][_0x9a31('0x5d')](-0x1);if(_0x1d6e32==='/'){_0x2317d1=_0x2317d1['substring'](0x0,_0x2317d1[_0x9a31('0x5e')](_0x1d6e32));}return rp({'method':'GET','uri':util['format']('%s%s',_0x2317d1,'/api/selector/owners'),'headers':{'Authorization':_0x9a31('0x5f')+_0x37c344[_0x9a31('0x5c')]},'json':!![]});}})[_0x9a31('0x27')](function(_0x1a9e95){if(_0x1a9e95){var _0x4c67e3=_0x1a9e95[_0x9a31('0x60')];var _0x1732b8=![];var _0x477f6c=null;for(_0x477f6c=0x0;_0x477f6c<_0x4c67e3[_0x9a31('0x49')];_0x477f6c++){if(_0x4c67e3[_0x477f6c][_0x9a31('0x61')]===_0x36ca76){_0x1732b8=!![];}}if(_0x1732b8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9a31('0x62')});}}})[_0x9a31('0x27')](respondWithResult(_0x5e62a3,null))[_0x9a31('0x4b')](function(_0xcbec1a){var _0x89ca75=_0x372727[_0x9a31('0x33')][_0x9a31('0x63')]?0x1f4:_0xcbec1a[_0x9a31('0x64')]||0x1f4;logger[_0x9a31('0x65')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x89ca75,JSON[_0x9a31('0x66')](_0xcbec1a));delete _0xcbec1a[_0x9a31('0x2a')];if(_0x89ca75===0x191){_0x89ca75=0x190;}_0x5e62a3['status'](_0x89ca75)[_0x9a31('0x2b')](_0x372727['query']['test']?{'message':_0x9a31('0x67'),'statusCode':_0xcbec1a[_0x9a31('0x64')]}:_0xcbec1a);});}; \ No newline at end of file +var _0xe9ee=['GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','save','update','then','sendStatus','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','fields','length','create','body','find','catch','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri'];(function(_0x41f882,_0x360760){var _0x402761=function(_0x325158){while(--_0x325158){_0x41f882['push'](_0x41f882['shift']());}};_0x402761(++_0x360760);}(_0xe9ee,0x144));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee9e('0x0'));var rimraf=require(_0xee9e('0x1'));var zipdir=require(_0xee9e('0x2'));var jsonpatch=require(_0xee9e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xee9e('0x4'));var Mustache=require(_0xee9e('0x5'));var util=require('util');var path=require(_0xee9e('0x6'));var sox=require(_0xee9e('0x7'));var csv=require('to-csv');var ejs=require(_0xee9e('0x8'));var fs=require('fs');var fs_extra=require(_0xee9e('0x9'));var _=require(_0xee9e('0xa'));var squel=require(_0xee9e('0xb'));var crypto=require('crypto');var jsforce=require(_0xee9e('0xc'));var deskjs=require(_0xee9e('0xd'));var toCsv=require(_0xee9e('0xe'));var querystring=require(_0xee9e('0xf'));var Papa=require(_0xee9e('0x10'));var Redis=require(_0xee9e('0x11'));var authService=require(_0xee9e('0x12'));var qs=require(_0xee9e('0x13'));var as=require(_0xee9e('0x14'));var hardwareService=require(_0xee9e('0x15'));var logger=require(_0xee9e('0x16'))(_0xee9e('0x17'));var utils=require(_0xee9e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xee9e('0x19'));var db=require(_0xee9e('0x1a'))['db'];var integrations=require(_0xee9e('0x1b'));function respondWithStatusCode(_0x177fed,_0x3925d7){_0x3925d7=_0x3925d7||0xcc;return function(_0x892a7c){if(_0x892a7c){return _0x177fed['sendStatus'](_0x3925d7);}return _0x177fed[_0xee9e('0x1c')](_0x3925d7)[_0xee9e('0x1d')]();};}function respondWithResult(_0x4fe3ba,_0x45239b){_0x45239b=_0x45239b||0xc8;return function(_0x498768){if(_0x498768){return _0x4fe3ba['status'](_0x45239b)[_0xee9e('0x1e')](_0x498768);}};}function respondWithFilteredResult(_0xf239a6,_0x27ed6f){return function(_0x3f1491){if(_0x3f1491){var _0x54fe12=typeof _0x27ed6f[_0xee9e('0x1f')]===_0xee9e('0x20')&&typeof _0x27ed6f[_0xee9e('0x21')]===_0xee9e('0x20');var _0x13f35e=_0x3f1491[_0xee9e('0x22')];var _0x27e433=_0x54fe12?0x0:_0x27ed6f[_0xee9e('0x1f')];var _0x569228=_0x54fe12?_0x3f1491['count']:_0x27ed6f[_0xee9e('0x1f')]+_0x27ed6f[_0xee9e('0x21')];var _0x3afbb6;if(_0x569228>=_0x13f35e){_0x569228=_0x13f35e;_0x3afbb6=0xc8;}else{_0x3afbb6=0xce;}_0xf239a6[_0xee9e('0x1c')](_0x3afbb6);return _0xf239a6[_0xee9e('0x23')]('Content-Range',_0x27e433+'-'+_0x569228+'/'+_0x13f35e)[_0xee9e('0x1e')](_0x3f1491);}return null;};}function patchUpdates(_0x1072ab){return function(_0x1097e3){try{jsonpatch['apply'](_0x1097e3,_0x1072ab,!![]);}catch(_0x1e6e51){return BPromise['reject'](_0x1e6e51);}return _0x1097e3[_0xee9e('0x24')]();};}function saveUpdates(_0x2512fd,_0x5acde7){return function(_0x31c685){if(_0x31c685){return _0x31c685[_0xee9e('0x25')](_0x2512fd)[_0xee9e('0x26')](function(_0x1d4169){return _0x1d4169;});}return null;};}function removeEntity(_0x330432,_0x2b11de){return function(_0x13cce4){if(_0x13cce4){return _0x13cce4['destroy']()['then'](function(){_0x330432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbcce,_0x49b1bb){return function(_0x5b5b4e){if(!_0x5b5b4e){_0x3fbcce[_0xee9e('0x27')](0x194);}return _0x5b5b4e;};}function handleError(_0x82781e,_0x42585){_0x42585=_0x42585||0x1f4;return function(_0x42f369){logger[_0xee9e('0x28')](_0x42f369[_0xee9e('0x29')]);if(_0x42f369[_0xee9e('0x2a')]){delete _0x42f369['name'];}_0x82781e[_0xee9e('0x1c')](_0x42585)[_0xee9e('0x2b')](_0x42f369);};}exports[_0xee9e('0x2c')]=function(_0x431686,_0x4b09aa){var _0x141cdf={},_0x257d8c={},_0x2c97aa={'count':0x0,'rows':[]};var _0x1690ce=_['map'](db[_0xee9e('0x2d')][_0xee9e('0x2e')],function(_0x3415c0){return{'name':_0x3415c0[_0xee9e('0x2f')],'type':_0x3415c0[_0xee9e('0x30')][_0xee9e('0x31')]};});_0x257d8c[_0xee9e('0x32')]=_[_0xee9e('0x33')](_0x1690ce,_0xee9e('0x2a'));_0x257d8c['query']=_[_0xee9e('0x34')](_0x431686[_0xee9e('0x35')]);_0x257d8c[_0xee9e('0x36')]=_[_0xee9e('0x37')](_0x257d8c[_0xee9e('0x32')],_0x257d8c['query']);_0x141cdf[_0xee9e('0x38')]=_[_0xee9e('0x37')](_0x257d8c['model'],qs['fields'](_0x431686[_0xee9e('0x35')]['fields']));_0x141cdf[_0xee9e('0x38')]=_0x141cdf[_0xee9e('0x38')]['length']?_0x141cdf[_0xee9e('0x38')]:_0x257d8c[_0xee9e('0x32')];if(!_0x431686[_0xee9e('0x35')][_0xee9e('0x39')](_0xee9e('0x3a'))){_0x141cdf[_0xee9e('0x21')]=qs[_0xee9e('0x21')](_0x431686[_0xee9e('0x35')]['limit']);_0x141cdf['offset']=qs[_0xee9e('0x1f')](_0x431686[_0xee9e('0x35')]['offset']);}_0x141cdf['order']=qs['sort'](_0x431686[_0xee9e('0x35')][_0xee9e('0x3b')]);_0x141cdf[_0xee9e('0x3c')]=qs['filters'](_[_0xee9e('0x3d')](_0x431686[_0xee9e('0x35')],_0x257d8c[_0xee9e('0x36')]),_0x1690ce);if(_0x431686['query'][_0xee9e('0x3e')]){_0x141cdf['where']=_['merge'](_0x141cdf[_0xee9e('0x3c')],{'$or':_[_0xee9e('0x33')](_0x1690ce,function(_0x234fec){if(_0x234fec[_0xee9e('0x30')]!==_0xee9e('0x3f')){var _0x504f68={};_0x504f68[_0x234fec[_0xee9e('0x2a')]]={'$like':'%'+_0x431686[_0xee9e('0x35')][_0xee9e('0x3e')]+'%'};return _0x504f68;}})});}_0x141cdf=_[_0xee9e('0x40')]({},_0x141cdf,_0x431686[_0xee9e('0x41')]);var _0x383611={'where':_0x141cdf['where']};return db[_0xee9e('0x2d')]['count'](_0x383611)[_0xee9e('0x26')](function(_0x4c4180){_0x2c97aa[_0xee9e('0x22')]=_0x4c4180;if(_0x431686[_0xee9e('0x35')][_0xee9e('0x42')]){_0x141cdf[_0xee9e('0x43')]=[{'all':!![]}];}return db[_0xee9e('0x2d')][_0xee9e('0x44')](_0x141cdf);})[_0xee9e('0x26')](function(_0x40a7bb){_0x2c97aa['rows']=_0x40a7bb;return _0x2c97aa;})[_0xee9e('0x26')](respondWithFilteredResult(_0x4b09aa,_0x141cdf))['catch'](handleError(_0x4b09aa,null));};exports[_0xee9e('0x45')]=function(_0x1b2171,_0x2d80e2){var _0x4a4d78={'raw':![],'where':{'id':_0x1b2171[_0xee9e('0x46')]['id']}},_0x403b42={};_0x403b42[_0xee9e('0x32')]=_[_0xee9e('0x34')](db[_0xee9e('0x2d')]['rawAttributes']);_0x403b42[_0xee9e('0x35')]=_[_0xee9e('0x34')](_0x1b2171[_0xee9e('0x35')]);_0x403b42[_0xee9e('0x36')]=_[_0xee9e('0x37')](_0x403b42[_0xee9e('0x32')],_0x403b42[_0xee9e('0x35')]);_0x4a4d78[_0xee9e('0x38')]=_['intersection'](_0x403b42[_0xee9e('0x32')],qs[_0xee9e('0x47')](_0x1b2171[_0xee9e('0x35')]['fields']));_0x4a4d78['attributes']=_0x4a4d78[_0xee9e('0x38')][_0xee9e('0x48')]?_0x4a4d78[_0xee9e('0x38')]:_0x403b42[_0xee9e('0x32')];if(_0x1b2171[_0xee9e('0x35')][_0xee9e('0x42')]){_0x4a4d78[_0xee9e('0x43')]=[{'all':!![]}];}_0x4a4d78=_[_0xee9e('0x40')]({},_0x4a4d78,_0x1b2171['options']);return db[_0xee9e('0x2d')]['find'](_0x4a4d78)['then'](handleEntityNotFound(_0x2d80e2,null))['then'](respondWithResult(_0x2d80e2,null))['catch'](handleError(_0x2d80e2,null));};exports[_0xee9e('0x49')]=function(_0xded323,_0x2f5864){return db[_0xee9e('0x2d')][_0xee9e('0x49')](_0xded323[_0xee9e('0x4a')],{})[_0xee9e('0x26')](respondWithResult(_0x2f5864,0xc9))['catch'](handleError(_0x2f5864,null));};exports['update']=function(_0x519261,_0x49d136){if(_0x519261['body']['id']){delete _0x519261['body']['id'];}return db[_0xee9e('0x2d')][_0xee9e('0x4b')]({'where':{'id':_0x519261[_0xee9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x49d136,null))[_0xee9e('0x26')](saveUpdates(_0x519261['body'],null))[_0xee9e('0x26')](respondWithResult(_0x49d136,null))[_0xee9e('0x4c')](handleError(_0x49d136,null));};exports[_0xee9e('0x4d')]=function(_0x5d1eed,_0x4f8822){return db['FreshsalesAccount'][_0xee9e('0x4b')]({'where':{'id':_0x5d1eed['params']['id']}})[_0xee9e('0x26')](handleEntityNotFound(_0x4f8822,null))[_0xee9e('0x26')](removeEntity(_0x4f8822,null))[_0xee9e('0x4c')](handleError(_0x4f8822,null));};exports[_0xee9e('0x4e')]=function(_0x2854b7,_0x25d0f2,_0xd347b4){var _0x3a1498={};var _0x491087={};var _0x49046d;var _0x16ad54;return db[_0xee9e('0x2d')][_0xee9e('0x4f')]({'where':{'id':_0x2854b7[_0xee9e('0x46')]['id']}})[_0xee9e('0x26')](handleEntityNotFound(_0x25d0f2,null))[_0xee9e('0x26')](function(_0x5b723c){if(_0x5b723c){_0x49046d=_0x5b723c;_0x491087[_0xee9e('0x32')]=_[_0xee9e('0x34')](db['FreshsalesConfiguration'][_0xee9e('0x2e')]);_0x491087[_0xee9e('0x35')]=_[_0xee9e('0x34')](_0x2854b7[_0xee9e('0x35')]);_0x491087[_0xee9e('0x36')]=_[_0xee9e('0x37')](_0x491087[_0xee9e('0x32')],_0x491087['query']);_0x3a1498['attributes']=_[_0xee9e('0x37')](_0x491087[_0xee9e('0x32')],qs[_0xee9e('0x47')](_0x2854b7['query']['fields']));_0x3a1498[_0xee9e('0x38')]=_0x3a1498['attributes'][_0xee9e('0x48')]?_0x3a1498['attributes']:_0x491087[_0xee9e('0x32')];_0x3a1498[_0xee9e('0x50')]=qs[_0xee9e('0x3b')](_0x2854b7[_0xee9e('0x35')][_0xee9e('0x3b')]);_0x3a1498['where']=qs[_0xee9e('0x36')](_['pick'](_0x2854b7[_0xee9e('0x35')],_0x491087[_0xee9e('0x36')]));if(_0x2854b7['query'][_0xee9e('0x3e')]){_0x3a1498[_0xee9e('0x3c')]=_['merge'](_0x3a1498[_0xee9e('0x3c')],{'$or':_[_0xee9e('0x33')](_0x3a1498[_0xee9e('0x38')],function(_0x273509){var _0x2532a2={};_0x2532a2[_0x273509]={'$like':'%'+_0x2854b7['query']['filter']+'%'};return _0x2532a2;})});}_0x3a1498=_[_0xee9e('0x40')]({},_0x3a1498,_0x2854b7[_0xee9e('0x41')]);return _0x49046d[_0xee9e('0x4e')](_0x3a1498);}})[_0xee9e('0x26')](function(_0x2c0c3c){if(_0x2c0c3c){_0x16ad54=_0x2c0c3c[_0xee9e('0x48')];if(!_0x2854b7[_0xee9e('0x35')][_0xee9e('0x39')](_0xee9e('0x3a'))){_0x3a1498[_0xee9e('0x21')]=qs[_0xee9e('0x21')](_0x2854b7['query'][_0xee9e('0x21')]);_0x3a1498[_0xee9e('0x1f')]=qs[_0xee9e('0x1f')](_0x2854b7[_0xee9e('0x35')]['offset']);}return _0x49046d['getConfigurations'](_0x3a1498);}})[_0xee9e('0x26')](function(_0x393d2e){if(_0x393d2e){return _0x393d2e?{'count':_0x16ad54,'rows':_0x393d2e}:null;}})[_0xee9e('0x26')](respondWithResult(_0x25d0f2,null))[_0xee9e('0x4c')](handleError(_0x25d0f2,null));};exports[_0xee9e('0x51')]=function(_0x3eec6f,_0x4a6ccb,_0x1d841b){if(_0x3eec6f[_0xee9e('0x4a')]['id']){delete _0x3eec6f[_0xee9e('0x4a')]['id'];}return db['FreshsalesAccount'][_0xee9e('0x4f')]({'where':{'id':_0x3eec6f[_0xee9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6ccb,null))[_0xee9e('0x26')](function(_0x2f238f){if(_0x2f238f){_0x3eec6f[_0xee9e('0x4a')][_0xee9e('0x52')]=_0x2f238f['id'];_0x3eec6f[_0xee9e('0x4a')][_0xee9e('0x53')]=integrations['getSubjects'](_0x3eec6f['body'][_0xee9e('0x54')],_0x3eec6f[_0xee9e('0x4a')][_0xee9e('0x30')]);_0x3eec6f['body'][_0xee9e('0x55')]=integrations[_0xee9e('0x56')](_0x3eec6f['body']['channel'],_0x3eec6f[_0xee9e('0x4a')][_0xee9e('0x30')]);return db['FreshsalesConfiguration'][_0xee9e('0x49')](_0x3eec6f[_0xee9e('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0xee9e('0x53')},{'model':db[_0xee9e('0x57')],'as':_0xee9e('0x55')}]});}return null;})[_0xee9e('0x26')](respondWithResult(_0x4a6ccb,null))[_0xee9e('0x4c')](handleError(_0x4a6ccb,null));};exports[_0xee9e('0x58')]=function(_0x37084c,_0x16f9be,_0x4a9e70){var _0x25406e='';var _0x46a97b='';return db['FreshsalesAccount'][_0xee9e('0x4f')]({'where':{'id':_0x37084c[_0xee9e('0x46')]['id']},'attributes':['id',_0xee9e('0x59'),'remoteUri',_0xee9e('0x5a')]})[_0xee9e('0x26')](handleEntityNotFound(_0x16f9be,null))[_0xee9e('0x26')](function(_0x3db422){if(_0x3db422){_0x46a97b=_0x3db422[_0xee9e('0x59')];_0x25406e=_0x3db422[_0xee9e('0x5b')];var _0x55a6fc=_0x3db422['remoteUri']['slice'](-0x1);if(_0x55a6fc==='/'){_0x25406e=_0x25406e['substring'](0x0,_0x25406e['lastIndexOf'](_0x55a6fc));}return rp({'method':_0xee9e('0x5c'),'uri':util[_0xee9e('0x5d')]('%s%s',_0x25406e,_0xee9e('0x5e')),'headers':{'Authorization':_0xee9e('0x5f')+_0x3db422[_0xee9e('0x5a')]},'json':!![]});}})[_0xee9e('0x26')](function(_0x3d108a){if(_0x3d108a){var _0x4e0133=_0x3d108a[_0xee9e('0x60')];var _0x4b9718=![];var _0x44cc17=null;for(_0x44cc17=0x0;_0x44cc17<_0x4e0133['length'];_0x44cc17++){if(_0x4e0133[_0x44cc17][_0xee9e('0x61')]===_0x46a97b){_0x4b9718=!![];}}if(_0x4b9718){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xee9e('0x62')});}}})[_0xee9e('0x26')](respondWithResult(_0x16f9be,null))['catch'](function(_0x375811){var _0x20b003=_0x37084c[_0xee9e('0x35')][_0xee9e('0x63')]?0x1f4:_0x375811[_0xee9e('0x64')]||0x1f4;logger[_0xee9e('0x28')](_0xee9e('0x65'),_0xee9e('0x58'),_0x20b003,JSON[_0xee9e('0x66')](_0x375811));delete _0x375811[_0xee9e('0x2a')];if(_0x20b003===0x191){_0x20b003=0x190;}_0x16f9be['status'](_0x20b003)['send'](_0x37084c[_0xee9e('0x35')][_0xee9e('0x63')]?{'message':_0xee9e('0x67'),'statusCode':_0x375811[_0xee9e('0x64')]}:_0x375811);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ca9bf61..c99f9e9 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 _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x348437,_0x340c5e){var _0x2fb21a=function(_0x17ad26){while(--_0x17ad26){_0x348437['push'](_0x348437['shift']());}};_0x2fb21a(++_0x340c5e);}(_0x6050,0x196));var _0x0605=function(_0x25e693,_0x43c9df){_0x25e693=_0x25e693-0x0;var _0x255a79=_0x6050[_0x25e693];return _0x255a79;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeda8=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1c2ad4,_0x42b3bb){var _0x129a4e=function(_0x3756cb){while(--_0x3756cb){_0x1c2ad4['push'](_0x1c2ad4['shift']());}};_0x129a4e(++_0x42b3bb);}(_0xeda8,0x104));var _0x8eda=function(_0x141740,_0x311108){_0x141740=_0x141740-0x0;var _0x1bdf22=_0xeda8[_0x141740];return _0x1bdf22;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'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 6c673d5..54c8987 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa456=['message','result','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x58e7ec,_0x461dac){var _0x5c5578=function(_0x166cf8){while(--_0x166cf8){_0x58e7ec['push'](_0x58e7ec['shift']());}};_0x5c5578(++_0x461dac);}(_0xa456,0x142));var _0x6a45=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xa456[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['FreshsalesAccount']['findAll']({'raw':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x17')]||null:null,'attributes':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x19')]||null:null,'include':_0x52a055['options']?_0x52a055['options'][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x52a055[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x25a380){return{'model':db[_0x25a380[_0x6a45('0x1c')]],'as':_0x25a380['as'],'attributes':_0x25a380[_0x6a45('0x18')],'include':_0x25a380[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x25a380[_0x6a45('0x1a')],function(_0x1310d7){return{'model':db[_0x1310d7[_0x6a45('0x1c')]],'as':_0x1310d7['as'],'attributes':_0x1310d7['attributes'],'include':_0x1310d7[_0x6a45('0x1a')]?_['map'](_0x1310d7[_0x6a45('0x1a')],function(_0x25467d){return{'model':db[_0x25467d[_0x6a45('0x1c')]],'as':_0x25467d['as'],'attributes':_0x25467d[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x526062){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x1d')](_0x526062));_0x102981(_0x526062);})[_0x6a45('0x1e')](function(_0x3fac9b){logger[_0x6a45('0x11')]('GetFreshsalesAccount',_0x3fac9b[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x3fac9b[_0x6a45('0x12')]));});});};exports[_0x6a45('0x1f')]=function(_0x3b07a1){var _0x5dc288=this;return new Promise(function(_0x1f95d4,_0x1f96bf){return db[_0x6a45('0x20')][_0x6a45('0x21')]({'raw':_0x3b07a1['options']?_0x3b07a1['options'][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x3b07a1['options']?_0x3b07a1[_0x6a45('0x15')]['where']||null:null,'attributes':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'include':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x36f4a4){return{'model':db[_0x36f4a4[_0x6a45('0x1c')]],'as':_0x36f4a4['as'],'attributes':_0x36f4a4[_0x6a45('0x18')],'include':_0x36f4a4[_0x6a45('0x1a')]?_['map'](_0x36f4a4[_0x6a45('0x1a')],function(_0x4ae2ac){return{'model':db[_0x4ae2ac[_0x6a45('0x1c')]],'as':_0x4ae2ac['as'],'attributes':_0x4ae2ac[_0x6a45('0x18')],'include':_0x4ae2ac[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x4ae2ac[_0x6a45('0x1a')],function(_0x2199c1){return{'model':db[_0x2199c1['model']],'as':_0x2199c1['as'],'attributes':_0x2199c1[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x2b75f6){logger[_0x6a45('0xc')](_0x6a45('0x1f'),_0x3b07a1);logger[_0x6a45('0xf')]('ShowFreshsalesAccount',_0x3b07a1,JSON[_0x6a45('0x1d')](_0x2b75f6));_0x1f95d4(_0x2b75f6);})[_0x6a45('0x1e')](function(_0x5c76bd){logger[_0x6a45('0x11')](_0x6a45('0x1f'),_0x5c76bd[_0x6a45('0x12')],_0x3b07a1);_0x1f96bf(_0x5dc288[_0x6a45('0x11')](0x1f4,_0x5c76bd[_0x6a45('0x12')]));});});}; \ No newline at end of file +var _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x118a2b,_0x1b4339){var _0x459ea5=function(_0x2e7468){while(--_0x2e7468){_0x118a2b['push'](_0x118a2b['shift']());}};_0x459ea5(++_0x1b4339);}(_0x68b3,0x1d8));var _0x368b=function(_0x1bb3e1,_0x519c6d){_0x1bb3e1=_0x1bb3e1-0x0;var _0x4bf665=_0x68b3[_0x1bb3e1];return _0x4bf665;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 35dff5c..750a02c 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 _0xcc35=['getSubjects','getDescriptions','/:id/fields','getFields','post','put','delete','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/subjects'];(function(_0x52e304,_0x1306f0){var _0x5dbe88=function(_0x5defb4){while(--_0x5defb4){_0x52e304['push'](_0x52e304['shift']());}};_0x5dbe88(++_0x1306f0);}(_0xcc35,0xb3));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5cc3('0x0'));var util=require(_0x5cc3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5cc3('0x2'));var auth=require(_0x5cc3('0x3'));var interaction=require(_0x5cc3('0x4'));var config=require(_0x5cc3('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cc3('0x6'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0x8')]);router[_0x5cc3('0x9')](_0x5cc3('0xa'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0xb')]);router[_0x5cc3('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5cc3('0xc')]);router['get'](_0x5cc3('0xd'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0xe')]);router[_0x5cc3('0xf')]('/',auth[_0x5cc3('0x7')](),controller['create']);router[_0x5cc3('0x10')]('/:id',auth[_0x5cc3('0x7')](),controller['update']);router[_0x5cc3('0x11')](_0x5cc3('0x6'),auth[_0x5cc3('0x7')](),controller['destroy']);module[_0x5cc3('0x12')]=router; \ No newline at end of file +var _0x6060=['/:id/fields','post','put','/:id','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','show','get','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions'];(function(_0x3db066,_0x8def67){var _0x77c240=function(_0x1eb830){while(--_0x1eb830){_0x3db066['push'](_0x3db066['shift']());}};_0x77c240(++_0x8def67);}(_0x6060,0x1ce));var _0x0606=function(_0xfc3f65,_0x21f988){_0xfc3f65=_0xfc3f65-0x0;var _0xc3d341=_0x6060[_0xfc3f65];return _0xc3d341;};'use strict';var multer=require('multer');var util=require(_0x0606('0x0'));var path=require(_0x0606('0x1'));var timeout=require('connect-timeout');var express=require(_0x0606('0x2'));var router=express['Router']();var fs_extra=require(_0x0606('0x3'));var auth=require(_0x0606('0x4'));var interaction=require(_0x0606('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0606('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0606('0x7')]);router[_0x0606('0x8')](_0x0606('0x9'),auth[_0x0606('0xa')](),controller['getSubjects']);router[_0x0606('0x8')](_0x0606('0xb'),auth[_0x0606('0xa')](),controller[_0x0606('0xc')]);router[_0x0606('0x8')](_0x0606('0xd'),auth[_0x0606('0xa')](),controller['getFields']);router[_0x0606('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0606('0xf')]('/:id',auth[_0x0606('0xa')](),controller['update']);router['delete'](_0x0606('0x10'),auth[_0x0606('0xa')](),controller[_0x0606('0x11')]);module[_0x0606('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 06f19d1..7fc738b 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 _0x888e=['STRING','sequelize','exports'];(function(_0x517c4f,_0x4168a5){var _0x572fdd=function(_0x358cc4){while(--_0x358cc4){_0x517c4f['push'](_0x517c4f['shift']());}};_0x572fdd(++_0x4168a5);}(_0x888e,0x136));var _0xe888=function(_0x31b0d9,_0x367641){_0x31b0d9=_0x31b0d9-0x0;var _0x486776=_0x888e[_0x31b0d9];return _0x486776;};'use strict';var Sequelize=require(_0xe888('0x0'));module[_0xe888('0x1')]={'name':{'type':Sequelize[_0xe888('0x2')]},'description':{'type':Sequelize[_0xe888('0x2')]}}; \ No newline at end of file +var _0x3911=['sequelize','STRING'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x3911,0xc4));var _0x1391=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0x3911[_0x4c4a8b];return _0x20fa14;};'use strict';var Sequelize=require(_0x1391('0x0'));module['exports']={'name':{'type':Sequelize[_0x1391('0x1')]},'description':{'type':Sequelize[_0x1391('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e198d5b..f8b344d 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 _0x9a30=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','FreshsalesField','length','sort','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x35bf13,_0x1d9861){var _0x41b1eb=function(_0x30603e){while(--_0x30603e){_0x35bf13['push'](_0x35bf13['shift']());}};_0x41b1eb(++_0x1d9861);}(_0x9a30,0x161));var _0x09a3=function(_0x6c7219,_0xf48897){_0x6c7219=_0x6c7219-0x0;var _0x2155d4=_0x9a30[_0x6c7219];return _0x2155d4;};'use strict';var emlformat=require(_0x09a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09a3('0x1'));var jsonpatch=require(_0x09a3('0x2'));var rp=require(_0x09a3('0x3'));var moment=require(_0x09a3('0x4'));var BPromise=require(_0x09a3('0x5'));var Mustache=require(_0x09a3('0x6'));var util=require(_0x09a3('0x7'));var path=require(_0x09a3('0x8'));var sox=require(_0x09a3('0x9'));var csv=require(_0x09a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09a3('0xb'));var squel=require(_0x09a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x09a3('0xd'));var deskjs=require(_0x09a3('0xe'));var toCsv=require(_0x09a3('0xa'));var querystring=require(_0x09a3('0xf'));var Papa=require('papaparse');var Redis=require(_0x09a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x09a3('0x11'));var as=require(_0x09a3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x09a3('0x13'));var utils=require(_0x09a3('0x14'));var config=require(_0x09a3('0x15'));var licenseUtil=require(_0x09a3('0x16'));var db=require(_0x09a3('0x17'))['db'];function respondWithStatusCode(_0x51fb8d,_0x5abd25){_0x5abd25=_0x5abd25||0xcc;return function(_0x5c749b){if(_0x5c749b){return _0x51fb8d[_0x09a3('0x18')](_0x5abd25);}return _0x51fb8d[_0x09a3('0x19')](_0x5abd25)[_0x09a3('0x1a')]();};}function respondWithResult(_0x59d5e6,_0x48ff14){_0x48ff14=_0x48ff14||0xc8;return function(_0x5219b0){if(_0x5219b0){return _0x59d5e6['status'](_0x48ff14)[_0x09a3('0x1b')](_0x5219b0);}};}function respondWithFilteredResult(_0x3e59db,_0x450739){return function(_0x169546){if(_0x169546){var _0x4a7340=typeof _0x450739[_0x09a3('0x1c')]===_0x09a3('0x1d')&&typeof _0x450739[_0x09a3('0x1e')]===_0x09a3('0x1d');var _0x16b535=_0x169546[_0x09a3('0x1f')];var _0x60d6df=_0x4a7340?0x0:_0x450739[_0x09a3('0x1c')];var _0x3aafbd=_0x4a7340?_0x169546[_0x09a3('0x1f')]:_0x450739[_0x09a3('0x1c')]+_0x450739[_0x09a3('0x1e')];var _0x59fad4;if(_0x3aafbd>=_0x16b535){_0x3aafbd=_0x16b535;_0x59fad4=0xc8;}else{_0x59fad4=0xce;}_0x3e59db[_0x09a3('0x19')](_0x59fad4);return _0x3e59db[_0x09a3('0x20')](_0x09a3('0x21'),_0x60d6df+'-'+_0x3aafbd+'/'+_0x16b535)[_0x09a3('0x1b')](_0x169546);}return null;};}function patchUpdates(_0x28983d){return function(_0x2b0f75){try{jsonpatch[_0x09a3('0x22')](_0x2b0f75,_0x28983d,!![]);}catch(_0x9b9036){return BPromise[_0x09a3('0x23')](_0x9b9036);}return _0x2b0f75['save']();};}function saveUpdates(_0xe9e11b,_0x1ab165){return function(_0xcc129e){if(_0xcc129e){return _0xcc129e[_0x09a3('0x24')](_0xe9e11b)['then'](function(_0x22306c){return _0x22306c;});}return null;};}function removeEntity(_0x4e95e1,_0x615a82){return function(_0x472d65){if(_0x472d65){return _0x472d65[_0x09a3('0x25')]()[_0x09a3('0x26')](function(){_0x4e95e1[_0x09a3('0x19')](0xcc)[_0x09a3('0x1a')]();});}};}function handleEntityNotFound(_0x2f5f25,_0x560aa6){return function(_0x5be99d){if(!_0x5be99d){_0x2f5f25[_0x09a3('0x18')](0x194);}return _0x5be99d;};}function handleError(_0x4aabc4,_0x44c9c7){_0x44c9c7=_0x44c9c7||0x1f4;return function(_0x44d87f){logger['error'](_0x44d87f[_0x09a3('0x27')]);if(_0x44d87f[_0x09a3('0x28')]){delete _0x44d87f[_0x09a3('0x28')];}_0x4aabc4[_0x09a3('0x19')](_0x44c9c7)[_0x09a3('0x29')](_0x44d87f);};}exports[_0x09a3('0x2a')]=function(_0x4d1c96,_0x33e4e8){var _0x501e8e={},_0x1d9ebe={},_0x87c493={'count':0x0,'rows':[]};var _0x10a548=_[_0x09a3('0x2b')](db['FreshsalesConfiguration'][_0x09a3('0x2c')],function(_0xb9636e){return{'name':_0xb9636e[_0x09a3('0x2d')],'type':_0xb9636e['type'][_0x09a3('0x2e')]};});_0x1d9ebe[_0x09a3('0x2f')]=_[_0x09a3('0x2b')](_0x10a548,'name');_0x1d9ebe[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x4d1c96[_0x09a3('0x30')]);_0x1d9ebe[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x1d9ebe[_0x09a3('0x2f')],_0x1d9ebe[_0x09a3('0x30')]);_0x501e8e[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x1d9ebe[_0x09a3('0x2f')],qs['fields'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x35')]));_0x501e8e[_0x09a3('0x34')]=_0x501e8e[_0x09a3('0x34')]['length']?_0x501e8e['attributes']:_0x1d9ebe[_0x09a3('0x2f')];if(!_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x36')]('nolimit')){_0x501e8e['limit']=qs['limit'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x1e')]);_0x501e8e[_0x09a3('0x1c')]=qs['offset'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x1c')]);}_0x501e8e[_0x09a3('0x37')]=qs['sort'](_0x4d1c96[_0x09a3('0x30')]['sort']);_0x501e8e[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_[_0x09a3('0x39')](_0x4d1c96['query'],_0x1d9ebe[_0x09a3('0x32')]),_0x10a548);if(_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3a')]){_0x501e8e[_0x09a3('0x38')]=_['merge'](_0x501e8e[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x10a548,function(_0x39036b){if(_0x39036b['type']!==_0x09a3('0x3b')){var _0x143d7d={};_0x143d7d[_0x39036b[_0x09a3('0x28')]]={'$like':'%'+_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3a')]+'%'};return _0x143d7d;}})});}_0x501e8e=_[_0x09a3('0x3c')]({},_0x501e8e,_0x4d1c96[_0x09a3('0x3d')]);var _0xfdee4f={'where':_0x501e8e['where']};return db[_0x09a3('0x3e')][_0x09a3('0x1f')](_0xfdee4f)[_0x09a3('0x26')](function(_0x5320be){_0x87c493['count']=_0x5320be;if(_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3f')]){_0x501e8e[_0x09a3('0x40')]=[{'all':!![]}];}return db[_0x09a3('0x3e')][_0x09a3('0x41')](_0x501e8e);})[_0x09a3('0x26')](function(_0x202318){_0x87c493[_0x09a3('0x42')]=_0x202318;return _0x87c493;})[_0x09a3('0x26')](respondWithFilteredResult(_0x33e4e8,_0x501e8e))[_0x09a3('0x43')](handleError(_0x33e4e8,null));};exports[_0x09a3('0x44')]=function(_0x1b631d,_0x5685ff){var _0x11ba62={'raw':![],'where':{'id':_0x1b631d['params']['id']}},_0x3b61b7={};_0x3b61b7['model']=_[_0x09a3('0x31')](db[_0x09a3('0x3e')]['rawAttributes']);_0x3b61b7[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x1b631d[_0x09a3('0x30')]);_0x3b61b7[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x3b61b7[_0x09a3('0x2f')],_0x3b61b7['query']);_0x11ba62['attributes']=_[_0x09a3('0x33')](_0x3b61b7['model'],qs[_0x09a3('0x35')](_0x1b631d[_0x09a3('0x30')][_0x09a3('0x35')]));_0x11ba62[_0x09a3('0x34')]=_0x11ba62[_0x09a3('0x34')]['length']?_0x11ba62['attributes']:_0x3b61b7['model'];if(_0x1b631d[_0x09a3('0x30')][_0x09a3('0x3f')]){_0x11ba62[_0x09a3('0x40')]=[{'all':!![]}];}_0x11ba62=_['merge']({},_0x11ba62,_0x1b631d[_0x09a3('0x3d')]);return db[_0x09a3('0x3e')][_0x09a3('0x45')](_0x11ba62)[_0x09a3('0x26')](handleEntityNotFound(_0x5685ff,null))['then'](respondWithResult(_0x5685ff,null))[_0x09a3('0x43')](handleError(_0x5685ff,null));};exports['create']=function(_0x45c0bc,_0x200734){return db['FreshsalesConfiguration'][_0x09a3('0x46')](_0x45c0bc['body'],{})[_0x09a3('0x26')](respondWithResult(_0x200734,0xc9))[_0x09a3('0x43')](handleError(_0x200734,null));};exports[_0x09a3('0x24')]=function(_0x3b444e,_0x31d8a8){if(_0x3b444e[_0x09a3('0x47')]['id']){delete _0x3b444e[_0x09a3('0x47')]['id'];}return db[_0x09a3('0x3e')][_0x09a3('0x45')]({'where':{'id':_0x3b444e[_0x09a3('0x48')]['id']}})[_0x09a3('0x26')](handleEntityNotFound(_0x31d8a8,null))[_0x09a3('0x26')](saveUpdates(_0x3b444e[_0x09a3('0x47')],null))[_0x09a3('0x26')](respondWithResult(_0x31d8a8,null))[_0x09a3('0x43')](handleError(_0x31d8a8,null));};exports[_0x09a3('0x25')]=function(_0xd07a30,_0x4bbe9c){return db[_0x09a3('0x3e')]['find']({'where':{'id':_0xd07a30[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bbe9c,null))['then'](removeEntity(_0x4bbe9c,null))['catch'](handleError(_0x4bbe9c,null));};exports[_0x09a3('0x49')]=function(_0x41545c,_0x24024a,_0x3c951c){var _0x16f12f={};var _0x5913f4={};var _0x50fc7c;var _0x2269c6;return db[_0x09a3('0x3e')]['findOne']({'where':{'id':_0x41545c[_0x09a3('0x48')]['id']}})[_0x09a3('0x26')](handleEntityNotFound(_0x24024a,null))[_0x09a3('0x26')](function(_0x5c6246){if(_0x5c6246){_0x50fc7c=_0x5c6246;_0x5913f4[_0x09a3('0x2f')]=_[_0x09a3('0x31')](db[_0x09a3('0x4a')][_0x09a3('0x2c')]);_0x5913f4[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x41545c[_0x09a3('0x30')]);_0x5913f4[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x5913f4[_0x09a3('0x2f')],_0x5913f4[_0x09a3('0x30')]);_0x16f12f[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x5913f4[_0x09a3('0x2f')],qs['fields'](_0x41545c[_0x09a3('0x30')]['fields']));_0x16f12f[_0x09a3('0x34')]=_0x16f12f['attributes'][_0x09a3('0x4b')]?_0x16f12f[_0x09a3('0x34')]:_0x5913f4[_0x09a3('0x2f')];_0x16f12f[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x41545c[_0x09a3('0x30')][_0x09a3('0x4c')]);_0x16f12f[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_['pick'](_0x41545c[_0x09a3('0x30')],_0x5913f4[_0x09a3('0x32')]));if(_0x41545c[_0x09a3('0x30')]['filter']){_0x16f12f[_0x09a3('0x38')]=_[_0x09a3('0x3c')](_0x16f12f[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x16f12f[_0x09a3('0x34')],function(_0x556d1e){var _0x1166e4={};_0x1166e4[_0x556d1e]={'$like':'%'+_0x41545c[_0x09a3('0x30')]['filter']+'%'};return _0x1166e4;})});}_0x16f12f=_[_0x09a3('0x3c')]({},_0x16f12f,_0x41545c[_0x09a3('0x3d')]);return _0x50fc7c[_0x09a3('0x49')](_0x16f12f);}})['then'](function(_0x4cc88d){if(_0x4cc88d){_0x2269c6=_0x4cc88d[_0x09a3('0x4b')];if(!_0x41545c['query'][_0x09a3('0x36')]('nolimit')){_0x16f12f[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x41545c[_0x09a3('0x30')]['limit']);_0x16f12f[_0x09a3('0x1c')]=qs[_0x09a3('0x1c')](_0x41545c[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x50fc7c[_0x09a3('0x49')](_0x16f12f);}})[_0x09a3('0x26')](function(_0x3568c7){if(_0x3568c7){return _0x3568c7?{'count':_0x2269c6,'rows':_0x3568c7}:null;}})[_0x09a3('0x26')](respondWithResult(_0x24024a,null))[_0x09a3('0x43')](handleError(_0x24024a,null));};exports[_0x09a3('0x4d')]=function(_0x4b436b,_0x482f79,_0x5a26c0){var _0x352ead={};var _0x21fbd0={};var _0x29cc1a;var _0x64ec46;return db['FreshsalesConfiguration'][_0x09a3('0x4e')]({'where':{'id':_0x4b436b[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x482f79,null))[_0x09a3('0x26')](function(_0x3e3014){if(_0x3e3014){_0x29cc1a=_0x3e3014;_0x21fbd0[_0x09a3('0x2f')]=_[_0x09a3('0x31')](db[_0x09a3('0x4a')]['rawAttributes']);_0x21fbd0['query']=_[_0x09a3('0x31')](_0x4b436b[_0x09a3('0x30')]);_0x21fbd0[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x21fbd0[_0x09a3('0x2f')],_0x21fbd0[_0x09a3('0x30')]);_0x352ead['attributes']=_[_0x09a3('0x33')](_0x21fbd0['model'],qs[_0x09a3('0x35')](_0x4b436b[_0x09a3('0x30')][_0x09a3('0x35')]));_0x352ead[_0x09a3('0x34')]=_0x352ead[_0x09a3('0x34')][_0x09a3('0x4b')]?_0x352ead[_0x09a3('0x34')]:_0x21fbd0[_0x09a3('0x2f')];_0x352ead[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x4b436b['query'][_0x09a3('0x4c')]);_0x352ead[_0x09a3('0x38')]=qs['filters'](_[_0x09a3('0x39')](_0x4b436b[_0x09a3('0x30')],_0x21fbd0[_0x09a3('0x32')]));if(_0x4b436b[_0x09a3('0x30')][_0x09a3('0x3a')]){_0x352ead[_0x09a3('0x38')]=_[_0x09a3('0x3c')](_0x352ead['where'],{'$or':_[_0x09a3('0x2b')](_0x352ead[_0x09a3('0x34')],function(_0x46f3a9){var _0x46aa68={};_0x46aa68[_0x46f3a9]={'$like':'%'+_0x4b436b[_0x09a3('0x30')][_0x09a3('0x3a')]+'%'};return _0x46aa68;})});}_0x352ead=_[_0x09a3('0x3c')]({},_0x352ead,_0x4b436b[_0x09a3('0x3d')]);return _0x29cc1a[_0x09a3('0x4d')](_0x352ead);}})['then'](function(_0x313496){if(_0x313496){_0x64ec46=_0x313496[_0x09a3('0x4b')];if(!_0x4b436b['query'][_0x09a3('0x36')]('nolimit')){_0x352ead[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x4b436b['query'][_0x09a3('0x1e')]);_0x352ead['offset']=qs['offset'](_0x4b436b[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x29cc1a[_0x09a3('0x4d')](_0x352ead);}})[_0x09a3('0x26')](function(_0x1ce505){if(_0x1ce505){return _0x1ce505?{'count':_0x64ec46,'rows':_0x1ce505}:null;}})['then'](respondWithResult(_0x482f79,null))['catch'](handleError(_0x482f79,null));};exports[_0x09a3('0x4f')]=function(_0x46709c,_0x355a6b,_0x30d629){var _0x4bf90e={};var _0x352ca8={};var _0x1f7bd2;var _0x4c70d9;return db['FreshsalesConfiguration'][_0x09a3('0x4e')]({'where':{'id':_0x46709c[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x355a6b,null))[_0x09a3('0x26')](function(_0x38f0a9){if(_0x38f0a9){_0x1f7bd2=_0x38f0a9;_0x352ca8['model']=_['keys'](db[_0x09a3('0x4a')][_0x09a3('0x2c')]);_0x352ca8[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x46709c[_0x09a3('0x30')]);_0x352ca8[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x352ca8[_0x09a3('0x2f')],_0x352ca8[_0x09a3('0x30')]);_0x4bf90e[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x352ca8['model'],qs[_0x09a3('0x35')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x35')]));_0x4bf90e[_0x09a3('0x34')]=_0x4bf90e[_0x09a3('0x34')]['length']?_0x4bf90e['attributes']:_0x352ca8[_0x09a3('0x2f')];_0x4bf90e[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x4c')]);_0x4bf90e[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_[_0x09a3('0x39')](_0x46709c[_0x09a3('0x30')],_0x352ca8[_0x09a3('0x32')]));if(_0x46709c['query'][_0x09a3('0x3a')]){_0x4bf90e[_0x09a3('0x38')]=_['merge'](_0x4bf90e[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x4bf90e[_0x09a3('0x34')],function(_0x3b5c9c){var _0xd39dac={};_0xd39dac[_0x3b5c9c]={'$like':'%'+_0x46709c['query'][_0x09a3('0x3a')]+'%'};return _0xd39dac;})});}_0x4bf90e=_['merge']({},_0x4bf90e,_0x46709c[_0x09a3('0x3d')]);return _0x1f7bd2['getFields'](_0x4bf90e);}})[_0x09a3('0x26')](function(_0x44fc6b){if(_0x44fc6b){_0x4c70d9=_0x44fc6b[_0x09a3('0x4b')];if(!_0x46709c[_0x09a3('0x30')]['hasOwnProperty']('nolimit')){_0x4bf90e[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x1e')]);_0x4bf90e[_0x09a3('0x1c')]=qs['offset'](_0x46709c[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x1f7bd2['getFields'](_0x4bf90e);}})[_0x09a3('0x26')](function(_0x4f34cc){if(_0x4f34cc){return _0x4f34cc?{'count':_0x4c70d9,'rows':_0x4f34cc}:null;}})[_0x09a3('0x26')](respondWithResult(_0x355a6b,null))['catch'](handleError(_0x355a6b,null));}; \ No newline at end of file +var _0xdc70=['params','rawAttributes','fields','find','create','body','destroy','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x1cea15,_0x114761){var _0x4a2a2c=function(_0x2e97b0){while(--_0x2e97b0){_0x1cea15['push'](_0x1cea15['shift']());}};_0x4a2a2c(++_0x114761);}(_0xdc70,0x1ed));var _0x0dc7=function(_0xc0af3,_0x7f5baf){_0xc0af3=_0xc0af3-0x0;var _0x1a3f58=_0xdc70[_0xc0af3];return _0x1a3f58;};'use strict';var emlformat=require(_0x0dc7('0x0'));var rimraf=require(_0x0dc7('0x1'));var zipdir=require(_0x0dc7('0x2'));var jsonpatch=require(_0x0dc7('0x3'));var rp=require('request-promise');var moment=require(_0x0dc7('0x4'));var BPromise=require(_0x0dc7('0x5'));var Mustache=require(_0x0dc7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0dc7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc7('0x8'));var squel=require(_0x0dc7('0x9'));var crypto=require(_0x0dc7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0dc7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0dc7('0xc'));var Papa=require(_0x0dc7('0xd'));var Redis=require(_0x0dc7('0xe'));var authService=require(_0x0dc7('0xf'));var qs=require(_0x0dc7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dc7('0x11'));var logger=require(_0x0dc7('0x12'))(_0x0dc7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0dc7('0x14'));var db=require(_0x0dc7('0x15'))['db'];function respondWithStatusCode(_0x13b645,_0x3f9253){_0x3f9253=_0x3f9253||0xcc;return function(_0x18ec71){if(_0x18ec71){return _0x13b645[_0x0dc7('0x16')](_0x3f9253);}return _0x13b645[_0x0dc7('0x17')](_0x3f9253)[_0x0dc7('0x18')]();};}function respondWithResult(_0x425928,_0xd1a95c){_0xd1a95c=_0xd1a95c||0xc8;return function(_0x4cb307){if(_0x4cb307){return _0x425928[_0x0dc7('0x17')](_0xd1a95c)[_0x0dc7('0x19')](_0x4cb307);}};}function respondWithFilteredResult(_0xb46514,_0x32c9bd){return function(_0x29abb1){if(_0x29abb1){var _0x4b5dda=typeof _0x32c9bd[_0x0dc7('0x1a')]===_0x0dc7('0x1b')&&typeof _0x32c9bd[_0x0dc7('0x1c')]==='undefined';var _0x30f2d5=_0x29abb1[_0x0dc7('0x1d')];var _0x3ee205=_0x4b5dda?0x0:_0x32c9bd[_0x0dc7('0x1a')];var _0x534360=_0x4b5dda?_0x29abb1[_0x0dc7('0x1d')]:_0x32c9bd['offset']+_0x32c9bd[_0x0dc7('0x1c')];var _0x578375;if(_0x534360>=_0x30f2d5){_0x534360=_0x30f2d5;_0x578375=0xc8;}else{_0x578375=0xce;}_0xb46514[_0x0dc7('0x17')](_0x578375);return _0xb46514[_0x0dc7('0x1e')](_0x0dc7('0x1f'),_0x3ee205+'-'+_0x534360+'/'+_0x30f2d5)[_0x0dc7('0x19')](_0x29abb1);}return null;};}function patchUpdates(_0x2f6ab4){return function(_0x5698a1){try{jsonpatch[_0x0dc7('0x20')](_0x5698a1,_0x2f6ab4,!![]);}catch(_0x2cda74){return BPromise[_0x0dc7('0x21')](_0x2cda74);}return _0x5698a1[_0x0dc7('0x22')]();};}function saveUpdates(_0x46ec03,_0x24e896){return function(_0x1e11c4){if(_0x1e11c4){return _0x1e11c4[_0x0dc7('0x23')](_0x46ec03)[_0x0dc7('0x24')](function(_0x4c9b83){return _0x4c9b83;});}return null;};}function removeEntity(_0x3b397a,_0x2ba762){return function(_0x48cada){if(_0x48cada){return _0x48cada['destroy']()['then'](function(){_0x3b397a[_0x0dc7('0x17')](0xcc)[_0x0dc7('0x18')]();});}};}function handleEntityNotFound(_0x2aa71b,_0x3d3ab1){return function(_0x370f2f){if(!_0x370f2f){_0x2aa71b[_0x0dc7('0x16')](0x194);}return _0x370f2f;};}function handleError(_0x4a8fdb,_0x122755){_0x122755=_0x122755||0x1f4;return function(_0x58bd1a){logger[_0x0dc7('0x25')](_0x58bd1a[_0x0dc7('0x26')]);if(_0x58bd1a['name']){delete _0x58bd1a[_0x0dc7('0x27')];}_0x4a8fdb[_0x0dc7('0x17')](_0x122755)[_0x0dc7('0x28')](_0x58bd1a);};}exports[_0x0dc7('0x29')]=function(_0x3356b0,_0x5bd2c6){var _0x4666fe={},_0x19fee2={},_0x44528b={'count':0x0,'rows':[]};var _0x218994=_[_0x0dc7('0x2a')](db[_0x0dc7('0x2b')]['rawAttributes'],function(_0x59d77a){return{'name':_0x59d77a['fieldName'],'type':_0x59d77a[_0x0dc7('0x2c')][_0x0dc7('0x2d')]};});_0x19fee2[_0x0dc7('0x2e')]=_['map'](_0x218994,_0x0dc7('0x27'));_0x19fee2[_0x0dc7('0x2f')]=_[_0x0dc7('0x30')](_0x3356b0[_0x0dc7('0x2f')]);_0x19fee2[_0x0dc7('0x31')]=_['intersection'](_0x19fee2[_0x0dc7('0x2e')],_0x19fee2['query']);_0x4666fe[_0x0dc7('0x32')]=_[_0x0dc7('0x33')](_0x19fee2[_0x0dc7('0x2e')],qs['fields'](_0x3356b0['query']['fields']));_0x4666fe['attributes']=_0x4666fe[_0x0dc7('0x32')][_0x0dc7('0x34')]?_0x4666fe[_0x0dc7('0x32')]:_0x19fee2[_0x0dc7('0x2e')];if(!_0x3356b0[_0x0dc7('0x2f')]['hasOwnProperty'](_0x0dc7('0x35'))){_0x4666fe[_0x0dc7('0x1c')]=qs[_0x0dc7('0x1c')](_0x3356b0[_0x0dc7('0x2f')][_0x0dc7('0x1c')]);_0x4666fe[_0x0dc7('0x1a')]=qs[_0x0dc7('0x1a')](_0x3356b0[_0x0dc7('0x2f')][_0x0dc7('0x1a')]);}_0x4666fe[_0x0dc7('0x36')]=qs['sort'](_0x3356b0[_0x0dc7('0x2f')][_0x0dc7('0x37')]);_0x4666fe['where']=qs[_0x0dc7('0x31')](_[_0x0dc7('0x38')](_0x3356b0[_0x0dc7('0x2f')],_0x19fee2[_0x0dc7('0x31')]),_0x218994);if(_0x3356b0[_0x0dc7('0x2f')][_0x0dc7('0x39')]){_0x4666fe['where']=_['merge'](_0x4666fe[_0x0dc7('0x3a')],{'$or':_[_0x0dc7('0x2a')](_0x218994,function(_0x1c1d9b){if(_0x1c1d9b['type']!==_0x0dc7('0x3b')){var _0x5176b1={};_0x5176b1[_0x1c1d9b[_0x0dc7('0x27')]]={'$like':'%'+_0x3356b0['query'][_0x0dc7('0x39')]+'%'};return _0x5176b1;}})});}_0x4666fe=_[_0x0dc7('0x3c')]({},_0x4666fe,_0x3356b0[_0x0dc7('0x3d')]);var _0x37052b={'where':_0x4666fe['where']};return db[_0x0dc7('0x2b')][_0x0dc7('0x1d')](_0x37052b)[_0x0dc7('0x24')](function(_0x422735){_0x44528b[_0x0dc7('0x1d')]=_0x422735;if(_0x3356b0[_0x0dc7('0x2f')][_0x0dc7('0x3e')]){_0x4666fe[_0x0dc7('0x3f')]=[{'all':!![]}];}return db[_0x0dc7('0x2b')][_0x0dc7('0x40')](_0x4666fe);})[_0x0dc7('0x24')](function(_0x4a3445){_0x44528b[_0x0dc7('0x41')]=_0x4a3445;return _0x44528b;})[_0x0dc7('0x24')](respondWithFilteredResult(_0x5bd2c6,_0x4666fe))[_0x0dc7('0x42')](handleError(_0x5bd2c6,null));};exports['show']=function(_0x3f2032,_0x5394ad){var _0x3a6f29={'raw':![],'where':{'id':_0x3f2032[_0x0dc7('0x43')]['id']}},_0x25296a={};_0x25296a[_0x0dc7('0x2e')]=_[_0x0dc7('0x30')](db['FreshsalesConfiguration'][_0x0dc7('0x44')]);_0x25296a[_0x0dc7('0x2f')]=_[_0x0dc7('0x30')](_0x3f2032[_0x0dc7('0x2f')]);_0x25296a['filters']=_[_0x0dc7('0x33')](_0x25296a[_0x0dc7('0x2e')],_0x25296a[_0x0dc7('0x2f')]);_0x3a6f29[_0x0dc7('0x32')]=_[_0x0dc7('0x33')](_0x25296a[_0x0dc7('0x2e')],qs[_0x0dc7('0x45')](_0x3f2032[_0x0dc7('0x2f')][_0x0dc7('0x45')]));_0x3a6f29['attributes']=_0x3a6f29[_0x0dc7('0x32')][_0x0dc7('0x34')]?_0x3a6f29['attributes']:_0x25296a[_0x0dc7('0x2e')];if(_0x3f2032[_0x0dc7('0x2f')][_0x0dc7('0x3e')]){_0x3a6f29[_0x0dc7('0x3f')]=[{'all':!![]}];}_0x3a6f29=_[_0x0dc7('0x3c')]({},_0x3a6f29,_0x3f2032[_0x0dc7('0x3d')]);return db[_0x0dc7('0x2b')][_0x0dc7('0x46')](_0x3a6f29)[_0x0dc7('0x24')](handleEntityNotFound(_0x5394ad,null))[_0x0dc7('0x24')](respondWithResult(_0x5394ad,null))['catch'](handleError(_0x5394ad,null));};exports['create']=function(_0x590188,_0x1a9cee){return db[_0x0dc7('0x2b')][_0x0dc7('0x47')](_0x590188['body'],{})['then'](respondWithResult(_0x1a9cee,0xc9))[_0x0dc7('0x42')](handleError(_0x1a9cee,null));};exports['update']=function(_0x2e34bb,_0x57656f){if(_0x2e34bb[_0x0dc7('0x48')]['id']){delete _0x2e34bb[_0x0dc7('0x48')]['id'];}return db[_0x0dc7('0x2b')]['find']({'where':{'id':_0x2e34bb[_0x0dc7('0x43')]['id']}})[_0x0dc7('0x24')](handleEntityNotFound(_0x57656f,null))[_0x0dc7('0x24')](saveUpdates(_0x2e34bb[_0x0dc7('0x48')],null))[_0x0dc7('0x24')](respondWithResult(_0x57656f,null))[_0x0dc7('0x42')](handleError(_0x57656f,null));};exports[_0x0dc7('0x49')]=function(_0x24d005,_0x177c9d){return db[_0x0dc7('0x2b')][_0x0dc7('0x46')]({'where':{'id':_0x24d005['params']['id']}})[_0x0dc7('0x24')](handleEntityNotFound(_0x177c9d,null))[_0x0dc7('0x24')](removeEntity(_0x177c9d,null))[_0x0dc7('0x42')](handleError(_0x177c9d,null));};exports[_0x0dc7('0x4a')]=function(_0x220478,_0x214663,_0xf55af1){var _0x5a02bf={};var _0x545fd0={};var _0x253b7c;var _0xae47d0;return db['FreshsalesConfiguration'][_0x0dc7('0x4b')]({'where':{'id':_0x220478[_0x0dc7('0x43')]['id']}})[_0x0dc7('0x24')](handleEntityNotFound(_0x214663,null))[_0x0dc7('0x24')](function(_0x43128b){if(_0x43128b){_0x253b7c=_0x43128b;_0x545fd0[_0x0dc7('0x2e')]=_[_0x0dc7('0x30')](db[_0x0dc7('0x4c')]['rawAttributes']);_0x545fd0['query']=_['keys'](_0x220478[_0x0dc7('0x2f')]);_0x545fd0[_0x0dc7('0x31')]=_[_0x0dc7('0x33')](_0x545fd0['model'],_0x545fd0[_0x0dc7('0x2f')]);_0x5a02bf[_0x0dc7('0x32')]=_[_0x0dc7('0x33')](_0x545fd0[_0x0dc7('0x2e')],qs[_0x0dc7('0x45')](_0x220478['query']['fields']));_0x5a02bf[_0x0dc7('0x32')]=_0x5a02bf['attributes'][_0x0dc7('0x34')]?_0x5a02bf[_0x0dc7('0x32')]:_0x545fd0[_0x0dc7('0x2e')];_0x5a02bf[_0x0dc7('0x36')]=qs[_0x0dc7('0x37')](_0x220478[_0x0dc7('0x2f')][_0x0dc7('0x37')]);_0x5a02bf[_0x0dc7('0x3a')]=qs['filters'](_[_0x0dc7('0x38')](_0x220478[_0x0dc7('0x2f')],_0x545fd0[_0x0dc7('0x31')]));if(_0x220478['query'][_0x0dc7('0x39')]){_0x5a02bf[_0x0dc7('0x3a')]=_[_0x0dc7('0x3c')](_0x5a02bf['where'],{'$or':_[_0x0dc7('0x2a')](_0x5a02bf['attributes'],function(_0x1cf34e){var _0x22e3f5={};_0x22e3f5[_0x1cf34e]={'$like':'%'+_0x220478[_0x0dc7('0x2f')][_0x0dc7('0x39')]+'%'};return _0x22e3f5;})});}_0x5a02bf=_['merge']({},_0x5a02bf,_0x220478[_0x0dc7('0x3d')]);return _0x253b7c[_0x0dc7('0x4a')](_0x5a02bf);}})['then'](function(_0x4361f2){if(_0x4361f2){_0xae47d0=_0x4361f2[_0x0dc7('0x34')];if(!_0x220478[_0x0dc7('0x2f')][_0x0dc7('0x4d')]('nolimit')){_0x5a02bf[_0x0dc7('0x1c')]=qs[_0x0dc7('0x1c')](_0x220478[_0x0dc7('0x2f')][_0x0dc7('0x1c')]);_0x5a02bf['offset']=qs[_0x0dc7('0x1a')](_0x220478[_0x0dc7('0x2f')][_0x0dc7('0x1a')]);}return _0x253b7c[_0x0dc7('0x4a')](_0x5a02bf);}})[_0x0dc7('0x24')](function(_0x55bf22){if(_0x55bf22){return _0x55bf22?{'count':_0xae47d0,'rows':_0x55bf22}:null;}})[_0x0dc7('0x24')](respondWithResult(_0x214663,null))[_0x0dc7('0x42')](handleError(_0x214663,null));};exports[_0x0dc7('0x4e')]=function(_0x50663a,_0x1eca43,_0x17380a){var _0x5f58d5={};var _0x576355={};var _0x4db5d6;var _0x539589;return db['FreshsalesConfiguration'][_0x0dc7('0x4b')]({'where':{'id':_0x50663a['params']['id']}})['then'](handleEntityNotFound(_0x1eca43,null))[_0x0dc7('0x24')](function(_0x327d5d){if(_0x327d5d){_0x4db5d6=_0x327d5d;_0x576355['model']=_[_0x0dc7('0x30')](db[_0x0dc7('0x4c')]['rawAttributes']);_0x576355[_0x0dc7('0x2f')]=_[_0x0dc7('0x30')](_0x50663a[_0x0dc7('0x2f')]);_0x576355['filters']=_['intersection'](_0x576355[_0x0dc7('0x2e')],_0x576355[_0x0dc7('0x2f')]);_0x5f58d5['attributes']=_[_0x0dc7('0x33')](_0x576355[_0x0dc7('0x2e')],qs[_0x0dc7('0x45')](_0x50663a[_0x0dc7('0x2f')]['fields']));_0x5f58d5['attributes']=_0x5f58d5['attributes']['length']?_0x5f58d5['attributes']:_0x576355['model'];_0x5f58d5[_0x0dc7('0x36')]=qs[_0x0dc7('0x37')](_0x50663a['query'][_0x0dc7('0x37')]);_0x5f58d5[_0x0dc7('0x3a')]=qs[_0x0dc7('0x31')](_[_0x0dc7('0x38')](_0x50663a[_0x0dc7('0x2f')],_0x576355[_0x0dc7('0x31')]));if(_0x50663a[_0x0dc7('0x2f')][_0x0dc7('0x39')]){_0x5f58d5[_0x0dc7('0x3a')]=_['merge'](_0x5f58d5[_0x0dc7('0x3a')],{'$or':_['map'](_0x5f58d5[_0x0dc7('0x32')],function(_0x518987){var _0x249ff5={};_0x249ff5[_0x518987]={'$like':'%'+_0x50663a['query'][_0x0dc7('0x39')]+'%'};return _0x249ff5;})});}_0x5f58d5=_[_0x0dc7('0x3c')]({},_0x5f58d5,_0x50663a[_0x0dc7('0x3d')]);return _0x4db5d6[_0x0dc7('0x4e')](_0x5f58d5);}})[_0x0dc7('0x24')](function(_0x248e8e){if(_0x248e8e){_0x539589=_0x248e8e[_0x0dc7('0x34')];if(!_0x50663a['query']['hasOwnProperty'](_0x0dc7('0x35'))){_0x5f58d5[_0x0dc7('0x1c')]=qs[_0x0dc7('0x1c')](_0x50663a[_0x0dc7('0x2f')][_0x0dc7('0x1c')]);_0x5f58d5[_0x0dc7('0x1a')]=qs[_0x0dc7('0x1a')](_0x50663a[_0x0dc7('0x2f')]['offset']);}return _0x4db5d6[_0x0dc7('0x4e')](_0x5f58d5);}})[_0x0dc7('0x24')](function(_0x7bbb93){if(_0x7bbb93){return _0x7bbb93?{'count':_0x539589,'rows':_0x7bbb93}:null;}})[_0x0dc7('0x24')](respondWithResult(_0x1eca43,null))[_0x0dc7('0x42')](handleError(_0x1eca43,null));};exports[_0x0dc7('0x4f')]=function(_0x38ac1a,_0x3924d5,_0x49d71a){var _0x1cf7c3={};var _0x37afdf={};var _0x317947;var _0x2e7bb9;return db['FreshsalesConfiguration'][_0x0dc7('0x4b')]({'where':{'id':_0x38ac1a[_0x0dc7('0x43')]['id']}})[_0x0dc7('0x24')](handleEntityNotFound(_0x3924d5,null))[_0x0dc7('0x24')](function(_0x7e4513){if(_0x7e4513){_0x317947=_0x7e4513;_0x37afdf['model']=_[_0x0dc7('0x30')](db[_0x0dc7('0x4c')][_0x0dc7('0x44')]);_0x37afdf[_0x0dc7('0x2f')]=_[_0x0dc7('0x30')](_0x38ac1a[_0x0dc7('0x2f')]);_0x37afdf[_0x0dc7('0x31')]=_[_0x0dc7('0x33')](_0x37afdf[_0x0dc7('0x2e')],_0x37afdf[_0x0dc7('0x2f')]);_0x1cf7c3['attributes']=_[_0x0dc7('0x33')](_0x37afdf[_0x0dc7('0x2e')],qs['fields'](_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x45')]));_0x1cf7c3[_0x0dc7('0x32')]=_0x1cf7c3[_0x0dc7('0x32')][_0x0dc7('0x34')]?_0x1cf7c3['attributes']:_0x37afdf[_0x0dc7('0x2e')];_0x1cf7c3[_0x0dc7('0x36')]=qs[_0x0dc7('0x37')](_0x38ac1a['query']['sort']);_0x1cf7c3[_0x0dc7('0x3a')]=qs[_0x0dc7('0x31')](_[_0x0dc7('0x38')](_0x38ac1a[_0x0dc7('0x2f')],_0x37afdf[_0x0dc7('0x31')]));if(_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x39')]){_0x1cf7c3[_0x0dc7('0x3a')]=_[_0x0dc7('0x3c')](_0x1cf7c3[_0x0dc7('0x3a')],{'$or':_[_0x0dc7('0x2a')](_0x1cf7c3[_0x0dc7('0x32')],function(_0x1c945e){var _0x365fa6={};_0x365fa6[_0x1c945e]={'$like':'%'+_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x39')]+'%'};return _0x365fa6;})});}_0x1cf7c3=_[_0x0dc7('0x3c')]({},_0x1cf7c3,_0x38ac1a['options']);return _0x317947[_0x0dc7('0x4f')](_0x1cf7c3);}})[_0x0dc7('0x24')](function(_0x4cae96){if(_0x4cae96){_0x2e7bb9=_0x4cae96['length'];if(!_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x4d')]('nolimit')){_0x1cf7c3[_0x0dc7('0x1c')]=qs[_0x0dc7('0x1c')](_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x1c')]);_0x1cf7c3[_0x0dc7('0x1a')]=qs[_0x0dc7('0x1a')](_0x38ac1a[_0x0dc7('0x2f')][_0x0dc7('0x1a')]);}return _0x317947['getFields'](_0x1cf7c3);}})[_0x0dc7('0x24')](function(_0x50b3c5){if(_0x50b3c5){return _0x50b3c5?{'count':_0x2e7bb9,'rows':_0x50b3c5}:null;}})[_0x0dc7('0x24')](respondWithResult(_0x3924d5,null))[_0x0dc7('0x42')](handleError(_0x3924d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 92ebc02..7470037 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 _0x49b9=['moment','bluebird','path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger'];(function(_0x6421db,_0x12e1c8){var _0x51876e=function(_0x5bc9ce){while(--_0x5bc9ce){_0x6421db['push'](_0x6421db['shift']());}};_0x51876e(++_0x12e1c8);}(_0x49b9,0x15c));var _0x949b=function(_0x2695dd,_0x1986b1){_0x2695dd=_0x2695dd-0x0;var _0x361e8a=_0x49b9[_0x2695dd];return _0x361e8a;};'use strict';var _=require(_0x949b('0x0'));var util=require('util');var logger=require(_0x949b('0x1'))('api');var moment=require(_0x949b('0x2'));var BPromise=require(_0x949b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x949b('0x4'));var rimraf=require(_0x949b('0x5'));var config=require(_0x949b('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x167721,_0x5b93a3){return _0x167721[_0x949b('0x7')](_0x949b('0x8'),attributes,{'tableName':_0x949b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x237a=['int_freshsales_configurations','../../config/logger','api','moment','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x1f6693,_0x13f21f){var _0x169e92=function(_0x27629c){while(--_0x27629c){_0x1f6693['push'](_0x1f6693['shift']());}};_0x169e92(++_0x13f21f);}(_0x237a,0x12e));var _0xa237=function(_0x4314ff,_0x1cd6cf){_0x4314ff=_0x4314ff-0x0;var _0x48cd10=_0x237a[_0x4314ff];return _0x48cd10;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa237('0x0'))(_0xa237('0x1'));var moment=require(_0xa237('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa237('0x3'));var attributes=require(_0xa237('0x4'));module['exports']=function(_0x5284a5,_0x3eb5ef){return _0x5284a5[_0xa237('0x5')]('FreshsalesConfiguration',attributes,{'tableName':_0xa237('0x6'),'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 b201450..c0bd75f 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 _0x6bc3=['jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2f8bef,_0x207faf){var _0x347cb7=function(_0x5b1146){while(--_0x5b1146){_0x2f8bef['push'](_0x2f8bef['shift']());}};_0x347cb7(++_0x207faf);}(_0x6bc3,0x1b0));var _0x36bc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6bc3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x36bc('0x0'));var util=require('util');var moment=require(_0x36bc('0x1'));var BPromise=require(_0x36bc('0x2'));var rs=require(_0x36bc('0x3'));var fs=require('fs');var Redis=require(_0x36bc('0x4'));var db=require(_0x36bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36bc('0x6'))('rpc');var config=require(_0x36bc('0x7'));var jayson=require(_0x36bc('0x8'));var client=jayson[_0x36bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d345a,_0x2c8ed1,_0x2e8824){return new BPromise(function(_0x39fa02,_0x426c24){return client[_0x36bc('0xa')](_0x5d345a,_0x2e8824)[_0x36bc('0xb')](function(_0x5a2114){logger[_0x36bc('0xc')](_0x36bc('0xd'),_0x2c8ed1,'request\x20sent');logger[_0x36bc('0xe')](_0x36bc('0xf'),_0x2c8ed1,_0x36bc('0x10'),JSON[_0x36bc('0x11')](_0x5a2114));if(_0x5a2114[_0x36bc('0x12')]){if(_0x5a2114['error'][_0x36bc('0x13')]===0x1f4){logger[_0x36bc('0x12')](_0x36bc('0xd'),_0x2c8ed1,_0x5a2114[_0x36bc('0x12')]['message']);return _0x426c24(_0x5a2114[_0x36bc('0x12')][_0x36bc('0x14')]);}logger['error'](_0x36bc('0xd'),_0x2c8ed1,_0x5a2114[_0x36bc('0x12')]['message']);return _0x39fa02(_0x5a2114[_0x36bc('0x12')]['message']);}else{logger[_0x36bc('0xc')](_0x36bc('0xd'),_0x2c8ed1,'request\x20sent');_0x39fa02(_0x5a2114[_0x36bc('0x15')][_0x36bc('0x14')]);}})['catch'](function(_0x43f522){logger[_0x36bc('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c8ed1,_0x43f522);_0x426c24(_0x43f522);});});} \ No newline at end of file +var _0x664a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5c8b07,_0xd0de0a){var _0x753b16=function(_0xd8f91a){while(--_0xd8f91a){_0x5c8b07['push'](_0x5c8b07['shift']());}};_0x753b16(++_0xd0de0a);}(_0x664a,0x145));var _0xa664=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x664a[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xa664('0x0'));var moment=require(_0xa664('0x1'));var BPromise=require(_0xa664('0x2'));var rs=require(_0xa664('0x3'));var fs=require('fs');var Redis=require(_0xa664('0x4'));var db=require(_0xa664('0x5'))['db'];var utils=require(_0xa664('0x6'));var logger=require(_0xa664('0x7'))(_0xa664('0x8'));var config=require('../../config/environment');var jayson=require(_0xa664('0x9'));var client=jayson[_0xa664('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24228a,_0x5a22ef,_0x236ce5){return new BPromise(function(_0x4274b4,_0x48c300){return client['request'](_0x24228a,_0x236ce5)[_0xa664('0xb')](function(_0x4c70a9){logger['info'](_0xa664('0xc'),_0x5a22ef,_0xa664('0xd'));logger[_0xa664('0xe')](_0xa664('0xf'),_0x5a22ef,_0xa664('0xd'),JSON[_0xa664('0x10')](_0x4c70a9));if(_0x4c70a9['error']){if(_0x4c70a9[_0xa664('0x11')][_0xa664('0x12')]===0x1f4){logger[_0xa664('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a22ef,_0x4c70a9[_0xa664('0x11')][_0xa664('0x13')]);return _0x48c300(_0x4c70a9[_0xa664('0x11')]['message']);}logger['error'](_0xa664('0xc'),_0x5a22ef,_0x4c70a9['error']['message']);return _0x4274b4(_0x4c70a9['error'][_0xa664('0x13')]);}else{logger[_0xa664('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a22ef,_0xa664('0xd'));_0x4274b4(_0x4c70a9['result'][_0xa664('0x13')]);}})[_0xa664('0x15')](function(_0x60e1f5){logger['error'](_0xa664('0xc'),_0x5a22ef,_0x60e1f5);_0x48c300(_0x60e1f5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b7778bc..e0ac143 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 _0xf0ba=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express['Router']();var fs_extra=require(_0xaf0b('0x5'));var auth=require(_0xaf0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf0b('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xaf0b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaf0b('0x8')](_0xaf0b('0x9'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xb')]);router[_0xaf0b('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0xe')](_0xaf0b('0x9'),auth['isAuthenticated'](),controller[_0xaf0b('0xf')]);router['delete'](_0xaf0b('0x9'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2504=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','multer','util'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x2504,0xee));var _0x4250=function(_0x299da0,_0x4e417f){_0x299da0=_0x299da0-0x0;var _0x5adf7c=_0x2504[_0x299da0];return _0x5adf7c;};'use strict';var multer=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var path=require(_0x4250('0x2'));var timeout=require(_0x4250('0x3'));var express=require(_0x4250('0x4'));var router=express[_0x4250('0x5')]();var fs_extra=require(_0x4250('0x6'));var auth=require(_0x4250('0x7'));var interaction=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var controller=require(_0x4250('0xa'));router[_0x4250('0xb')]('/',auth['isAuthenticated'](),controller[_0x4250('0xc')]);router['get']('/:id',auth[_0x4250('0xd')](),controller[_0x4250('0xe')]);router[_0x4250('0xf')]('/',auth[_0x4250('0xd')](),controller[_0x4250('0x10')]);router['put'](_0x4250('0x11'),auth['isAuthenticated'](),controller[_0x4250('0x12')]);router[_0x4250('0x13')]('/:id',auth[_0x4250('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 202ce76..e92984c 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 _0xb88a=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2b2304,_0x469bc6){var _0x26ae4f=function(_0x1e4088){while(--_0x1e4088){_0x2b2304['push'](_0x2b2304['shift']());}};_0x26ae4f(++_0x469bc6);}(_0xb88a,0xdb));var _0xab88=function(_0x5004d5,_0x50ab11){_0x5004d5=_0x5004d5-0x0;var _0x33469a=_0xb88a[_0x5004d5];return _0x33469a;};'use strict';var Sequelize=require(_0xab88('0x0'));module[_0xab88('0x1')]={'type':{'type':Sequelize[_0xab88('0x2')](_0xab88('0x3'),_0xab88('0x4'),_0xab88('0x5'),'keyValue','picklist'),'defaultValue':_0xab88('0x3')},'content':{'type':Sequelize[_0xab88('0x6')]},'key':{'type':Sequelize[_0xab88('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xab88('0x6')]},'idField':{'type':Sequelize[_0xab88('0x6')]},'nameField':{'type':Sequelize[_0xab88('0x6')]},'customField':{'type':Sequelize[_0xab88('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab88('0x6')]}}; \ No newline at end of file +var _0xa632=['ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x230479,_0x3809c3){var _0x399593=function(_0x5246c2){while(--_0x5246c2){_0x230479['push'](_0x230479['shift']());}};_0x399593(++_0x3809c3);}(_0xa632,0xd0));var _0x2a63=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa632[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x2a63('0x0'));module[_0x2a63('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2a63('0x2'),_0x2a63('0x3'),_0x2a63('0x4'),_0x2a63('0x5'),_0x2a63('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a63('0x7')]},'key':{'type':Sequelize[_0x2a63('0x7')]},'keyType':{'type':Sequelize[_0x2a63('0x8')](_0x2a63('0x2'),_0x2a63('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2a63('0x7')]},'idField':{'type':Sequelize[_0x2a63('0x7')]},'nameField':{'type':Sequelize[_0x2a63('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a63('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7374dc5..505cdd6 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 _0x38c4=['merge','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','rows','show','params','fields'];(function(_0x3a9f29,_0x43e4bf){var _0x48f2a2=function(_0x92bf63){while(--_0x92bf63){_0x3a9f29['push'](_0x3a9f29['shift']());}};_0x48f2a2(++_0x43e4bf);}(_0x38c4,0x190));var _0x438c=function(_0x14ccf5,_0x2ccb79){_0x14ccf5=_0x14ccf5-0x0;var _0x2d9d97=_0x38c4[_0x14ccf5];return _0x2d9d97;};'use strict';var emlformat=require(_0x438c('0x0'));var rimraf=require(_0x438c('0x1'));var zipdir=require(_0x438c('0x2'));var jsonpatch=require(_0x438c('0x3'));var rp=require(_0x438c('0x4'));var moment=require(_0x438c('0x5'));var BPromise=require(_0x438c('0x6'));var Mustache=require(_0x438c('0x7'));var util=require(_0x438c('0x8'));var path=require('path');var sox=require(_0x438c('0x9'));var csv=require(_0x438c('0xa'));var ejs=require(_0x438c('0xb'));var fs=require('fs');var fs_extra=require(_0x438c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x438c('0xd'));var deskjs=require(_0x438c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x438c('0xf'));var Papa=require(_0x438c('0x10'));var Redis=require(_0x438c('0x11'));var authService=require(_0x438c('0x12'));var qs=require(_0x438c('0x13'));var as=require(_0x438c('0x14'));var hardwareService=require(_0x438c('0x15'));var logger=require('../../config/logger')(_0x438c('0x16'));var utils=require(_0x438c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x438c('0x18'));var db=require(_0x438c('0x19'))['db'];function respondWithStatusCode(_0x57c212,_0x3f3731){_0x3f3731=_0x3f3731||0xcc;return function(_0x20b6bc){if(_0x20b6bc){return _0x57c212[_0x438c('0x1a')](_0x3f3731);}return _0x57c212[_0x438c('0x1b')](_0x3f3731)[_0x438c('0x1c')]();};}function respondWithResult(_0x367710,_0x23534f){_0x23534f=_0x23534f||0xc8;return function(_0x36589b){if(_0x36589b){return _0x367710['status'](_0x23534f)[_0x438c('0x1d')](_0x36589b);}};}function respondWithFilteredResult(_0x473e22,_0x3412dd){return function(_0x4f9530){if(_0x4f9530){var _0x18282b=typeof _0x3412dd[_0x438c('0x1e')]===_0x438c('0x1f')&&typeof _0x3412dd['limit']===_0x438c('0x1f');var _0x5f2fc0=_0x4f9530[_0x438c('0x20')];var _0xf5f337=_0x18282b?0x0:_0x3412dd[_0x438c('0x1e')];var _0xd45e24=_0x18282b?_0x4f9530[_0x438c('0x20')]:_0x3412dd[_0x438c('0x1e')]+_0x3412dd[_0x438c('0x21')];var _0x530a43;if(_0xd45e24>=_0x5f2fc0){_0xd45e24=_0x5f2fc0;_0x530a43=0xc8;}else{_0x530a43=0xce;}_0x473e22['status'](_0x530a43);return _0x473e22[_0x438c('0x22')](_0x438c('0x23'),_0xf5f337+'-'+_0xd45e24+'/'+_0x5f2fc0)[_0x438c('0x1d')](_0x4f9530);}return null;};}function patchUpdates(_0x3e3ba4){return function(_0x5df2c8){try{jsonpatch[_0x438c('0x24')](_0x5df2c8,_0x3e3ba4,!![]);}catch(_0x377191){return BPromise[_0x438c('0x25')](_0x377191);}return _0x5df2c8[_0x438c('0x26')]();};}function saveUpdates(_0x363b9e,_0xc9e92a){return function(_0x1581d6){if(_0x1581d6){return _0x1581d6['update'](_0x363b9e)[_0x438c('0x27')](function(_0x4fe417){return _0x4fe417;});}return null;};}function removeEntity(_0x391288,_0x1459ea){return function(_0x51cc9a){if(_0x51cc9a){return _0x51cc9a[_0x438c('0x28')]()[_0x438c('0x27')](function(){_0x391288[_0x438c('0x1b')](0xcc)[_0x438c('0x1c')]();});}};}function handleEntityNotFound(_0x435887,_0x3a2ca1){return function(_0x18241e){if(!_0x18241e){_0x435887[_0x438c('0x1a')](0x194);}return _0x18241e;};}function handleError(_0x4eda1d,_0xa993ca){_0xa993ca=_0xa993ca||0x1f4;return function(_0x2c33a1){logger[_0x438c('0x29')](_0x2c33a1[_0x438c('0x2a')]);if(_0x2c33a1['name']){delete _0x2c33a1[_0x438c('0x2b')];}_0x4eda1d[_0x438c('0x1b')](_0xa993ca)['send'](_0x2c33a1);};}exports[_0x438c('0x2c')]=function(_0x5ba5fd,_0xafc1d1){var _0xd8a44c={},_0x5dbd88={},_0x4cd1bd={'count':0x0,'rows':[]};var _0x368719=_[_0x438c('0x2d')](db['FreshsalesField'][_0x438c('0x2e')],function(_0x3b298e){return{'name':_0x3b298e[_0x438c('0x2f')],'type':_0x3b298e[_0x438c('0x30')][_0x438c('0x31')]};});_0x5dbd88['model']=_['map'](_0x368719,_0x438c('0x2b'));_0x5dbd88[_0x438c('0x32')]=_[_0x438c('0x33')](_0x5ba5fd[_0x438c('0x32')]);_0x5dbd88['filters']=_[_0x438c('0x34')](_0x5dbd88[_0x438c('0x35')],_0x5dbd88[_0x438c('0x32')]);_0xd8a44c[_0x438c('0x36')]=_[_0x438c('0x34')](_0x5dbd88['model'],qs['fields'](_0x5ba5fd[_0x438c('0x32')]['fields']));_0xd8a44c[_0x438c('0x36')]=_0xd8a44c['attributes'][_0x438c('0x37')]?_0xd8a44c[_0x438c('0x36')]:_0x5dbd88[_0x438c('0x35')];if(!_0x5ba5fd[_0x438c('0x32')][_0x438c('0x38')](_0x438c('0x39'))){_0xd8a44c[_0x438c('0x21')]=qs[_0x438c('0x21')](_0x5ba5fd[_0x438c('0x32')][_0x438c('0x21')]);_0xd8a44c[_0x438c('0x1e')]=qs['offset'](_0x5ba5fd[_0x438c('0x32')][_0x438c('0x1e')]);}_0xd8a44c[_0x438c('0x3a')]=qs[_0x438c('0x3b')](_0x5ba5fd[_0x438c('0x32')]['sort']);_0xd8a44c[_0x438c('0x3c')]=qs['filters'](_[_0x438c('0x3d')](_0x5ba5fd[_0x438c('0x32')],_0x5dbd88[_0x438c('0x3e')]),_0x368719);if(_0x5ba5fd[_0x438c('0x32')][_0x438c('0x3f')]){_0xd8a44c[_0x438c('0x3c')]=_['merge'](_0xd8a44c[_0x438c('0x3c')],{'$or':_['map'](_0x368719,function(_0x1899da){if(_0x1899da[_0x438c('0x30')]!==_0x438c('0x40')){var _0x328e65={};_0x328e65[_0x1899da['name']]={'$like':'%'+_0x5ba5fd['query'][_0x438c('0x3f')]+'%'};return _0x328e65;}})});}_0xd8a44c=_['merge']({},_0xd8a44c,_0x5ba5fd[_0x438c('0x41')]);var _0x5880cd={'where':_0xd8a44c[_0x438c('0x3c')]};return db['FreshsalesField'][_0x438c('0x20')](_0x5880cd)[_0x438c('0x27')](function(_0xa83f57){_0x4cd1bd['count']=_0xa83f57;if(_0x5ba5fd[_0x438c('0x32')][_0x438c('0x42')]){_0xd8a44c[_0x438c('0x43')]=[{'all':!![]}];}return db[_0x438c('0x44')][_0x438c('0x45')](_0xd8a44c);})[_0x438c('0x27')](function(_0x544372){_0x4cd1bd[_0x438c('0x46')]=_0x544372;return _0x4cd1bd;})['then'](respondWithFilteredResult(_0xafc1d1,_0xd8a44c))['catch'](handleError(_0xafc1d1,null));};exports[_0x438c('0x47')]=function(_0x139fdd,_0x206b3d){var _0x59ad80={'raw':!![],'where':{'id':_0x139fdd[_0x438c('0x48')]['id']}},_0x12fd6b={};_0x12fd6b['model']=_['keys'](db[_0x438c('0x44')][_0x438c('0x2e')]);_0x12fd6b[_0x438c('0x32')]=_[_0x438c('0x33')](_0x139fdd['query']);_0x12fd6b[_0x438c('0x3e')]=_[_0x438c('0x34')](_0x12fd6b[_0x438c('0x35')],_0x12fd6b[_0x438c('0x32')]);_0x59ad80['attributes']=_['intersection'](_0x12fd6b['model'],qs[_0x438c('0x49')](_0x139fdd['query'][_0x438c('0x49')]));_0x59ad80['attributes']=_0x59ad80[_0x438c('0x36')][_0x438c('0x37')]?_0x59ad80[_0x438c('0x36')]:_0x12fd6b[_0x438c('0x35')];if(_0x139fdd[_0x438c('0x32')][_0x438c('0x42')]){_0x59ad80[_0x438c('0x43')]=[{'all':!![]}];}_0x59ad80=_[_0x438c('0x4a')]({},_0x59ad80,_0x139fdd[_0x438c('0x41')]);return db[_0x438c('0x44')]['find'](_0x59ad80)[_0x438c('0x27')](handleEntityNotFound(_0x206b3d,null))[_0x438c('0x27')](respondWithResult(_0x206b3d,null))[_0x438c('0x4b')](handleError(_0x206b3d,null));};exports[_0x438c('0x4c')]=function(_0x54045c,_0x57198e){return db[_0x438c('0x44')][_0x438c('0x4c')](_0x54045c[_0x438c('0x4d')],{})[_0x438c('0x27')](respondWithResult(_0x57198e,0xc9))[_0x438c('0x4b')](handleError(_0x57198e,null));};exports['update']=function(_0x2c62f0,_0x3d3501){if(_0x2c62f0[_0x438c('0x4d')]['id']){delete _0x2c62f0[_0x438c('0x4d')]['id'];}return db[_0x438c('0x44')][_0x438c('0x4e')]({'where':{'id':_0x2c62f0[_0x438c('0x48')]['id']}})[_0x438c('0x27')](handleEntityNotFound(_0x3d3501,null))[_0x438c('0x27')](saveUpdates(_0x2c62f0[_0x438c('0x4d')],null))[_0x438c('0x27')](respondWithResult(_0x3d3501,null))[_0x438c('0x4b')](handleError(_0x3d3501,null));};exports[_0x438c('0x28')]=function(_0x1bbf99,_0x5a5eba){return db['FreshsalesField'][_0x438c('0x4e')]({'where':{'id':_0x1bbf99['params']['id']}})[_0x438c('0x27')](handleEntityNotFound(_0x5a5eba,null))['then'](removeEntity(_0x5a5eba,null))[_0x438c('0x4b')](handleError(_0x5a5eba,null));}; \ No newline at end of file +var _0x1e0c=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','FreshsalesField','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x2d2421,_0x3422d6){var _0x341708=function(_0x4585e8){while(--_0x4585e8){_0x2d2421['push'](_0x2d2421['shift']());}};_0x341708(++_0x3422d6);}(_0x1e0c,0x1b5));var _0xc1e0=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0x1e0c[_0x3cbee0];return _0x2ed094;};'use strict';var emlformat=require(_0xc1e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1e0('0x1'));var jsonpatch=require(_0xc1e0('0x2'));var rp=require(_0xc1e0('0x3'));var moment=require('moment');var BPromise=require(_0xc1e0('0x4'));var Mustache=require(_0xc1e0('0x5'));var util=require('util');var path=require(_0xc1e0('0x6'));var sox=require(_0xc1e0('0x7'));var csv=require(_0xc1e0('0x8'));var ejs=require(_0xc1e0('0x9'));var fs=require('fs');var fs_extra=require(_0xc1e0('0xa'));var _=require(_0xc1e0('0xb'));var squel=require(_0xc1e0('0xc'));var crypto=require('crypto');var jsforce=require(_0xc1e0('0xd'));var deskjs=require(_0xc1e0('0xe'));var toCsv=require(_0xc1e0('0x8'));var querystring=require(_0xc1e0('0xf'));var Papa=require(_0xc1e0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1e0('0x11'));var as=require(_0xc1e0('0x12'));var hardwareService=require(_0xc1e0('0x13'));var logger=require(_0xc1e0('0x14'))(_0xc1e0('0x15'));var utils=require(_0xc1e0('0x16'));var config=require(_0xc1e0('0x17'));var licenseUtil=require(_0xc1e0('0x18'));var db=require(_0xc1e0('0x19'))['db'];function respondWithStatusCode(_0x467df3,_0x18c9a3){_0x18c9a3=_0x18c9a3||0xcc;return function(_0x586d5d){if(_0x586d5d){return _0x467df3[_0xc1e0('0x1a')](_0x18c9a3);}return _0x467df3[_0xc1e0('0x1b')](_0x18c9a3)[_0xc1e0('0x1c')]();};}function respondWithResult(_0x67ab55,_0x526c7f){_0x526c7f=_0x526c7f||0xc8;return function(_0x44d9d5){if(_0x44d9d5){return _0x67ab55[_0xc1e0('0x1b')](_0x526c7f)[_0xc1e0('0x1d')](_0x44d9d5);}};}function respondWithFilteredResult(_0x6a4e67,_0x29aeb8){return function(_0x412abc){if(_0x412abc){var _0x30702a=typeof _0x29aeb8[_0xc1e0('0x1e')]==='undefined'&&typeof _0x29aeb8['limit']===_0xc1e0('0x1f');var _0x5e0351=_0x412abc['count'];var _0x16de2e=_0x30702a?0x0:_0x29aeb8[_0xc1e0('0x1e')];var _0x147573=_0x30702a?_0x412abc[_0xc1e0('0x20')]:_0x29aeb8[_0xc1e0('0x1e')]+_0x29aeb8[_0xc1e0('0x21')];var _0x3718ae;if(_0x147573>=_0x5e0351){_0x147573=_0x5e0351;_0x3718ae=0xc8;}else{_0x3718ae=0xce;}_0x6a4e67[_0xc1e0('0x1b')](_0x3718ae);return _0x6a4e67[_0xc1e0('0x22')]('Content-Range',_0x16de2e+'-'+_0x147573+'/'+_0x5e0351)[_0xc1e0('0x1d')](_0x412abc);}return null;};}function patchUpdates(_0x4a5075){return function(_0x16bef8){try{jsonpatch[_0xc1e0('0x23')](_0x16bef8,_0x4a5075,!![]);}catch(_0x3eb1d5){return BPromise[_0xc1e0('0x24')](_0x3eb1d5);}return _0x16bef8[_0xc1e0('0x25')]();};}function saveUpdates(_0x1f91fc,_0x5c9fd1){return function(_0x1d26ad){if(_0x1d26ad){return _0x1d26ad[_0xc1e0('0x26')](_0x1f91fc)[_0xc1e0('0x27')](function(_0x2c592d){return _0x2c592d;});}return null;};}function removeEntity(_0x5afea2,_0x42ed73){return function(_0x4ed855){if(_0x4ed855){return _0x4ed855[_0xc1e0('0x28')]()['then'](function(){_0x5afea2[_0xc1e0('0x1b')](0xcc)[_0xc1e0('0x1c')]();});}};}function handleEntityNotFound(_0x422b80,_0x3e5679){return function(_0x2bcf39){if(!_0x2bcf39){_0x422b80['sendStatus'](0x194);}return _0x2bcf39;};}function handleError(_0x272aaf,_0x5c044b){_0x5c044b=_0x5c044b||0x1f4;return function(_0x4c7b81){logger['error'](_0x4c7b81[_0xc1e0('0x29')]);if(_0x4c7b81[_0xc1e0('0x2a')]){delete _0x4c7b81[_0xc1e0('0x2a')];}_0x272aaf[_0xc1e0('0x1b')](_0x5c044b)[_0xc1e0('0x2b')](_0x4c7b81);};}exports['index']=function(_0x4b4583,_0x3f86c7){var _0x14fdce={},_0x341d8c={},_0x398ba3={'count':0x0,'rows':[]};var _0x400d38=_['map'](db[_0xc1e0('0x2c')][_0xc1e0('0x2d')],function(_0x1bb8f3){return{'name':_0x1bb8f3[_0xc1e0('0x2e')],'type':_0x1bb8f3['type'][_0xc1e0('0x2f')]};});_0x341d8c[_0xc1e0('0x30')]=_['map'](_0x400d38,_0xc1e0('0x2a'));_0x341d8c[_0xc1e0('0x31')]=_['keys'](_0x4b4583['query']);_0x341d8c[_0xc1e0('0x32')]=_['intersection'](_0x341d8c[_0xc1e0('0x30')],_0x341d8c[_0xc1e0('0x31')]);_0x14fdce[_0xc1e0('0x33')]=_[_0xc1e0('0x34')](_0x341d8c[_0xc1e0('0x30')],qs['fields'](_0x4b4583[_0xc1e0('0x31')][_0xc1e0('0x35')]));_0x14fdce['attributes']=_0x14fdce[_0xc1e0('0x33')]['length']?_0x14fdce[_0xc1e0('0x33')]:_0x341d8c[_0xc1e0('0x30')];if(!_0x4b4583[_0xc1e0('0x31')][_0xc1e0('0x36')]('nolimit')){_0x14fdce['limit']=qs[_0xc1e0('0x21')](_0x4b4583['query'][_0xc1e0('0x21')]);_0x14fdce[_0xc1e0('0x1e')]=qs[_0xc1e0('0x1e')](_0x4b4583[_0xc1e0('0x31')]['offset']);}_0x14fdce[_0xc1e0('0x37')]=qs[_0xc1e0('0x38')](_0x4b4583[_0xc1e0('0x31')][_0xc1e0('0x38')]);_0x14fdce[_0xc1e0('0x39')]=qs[_0xc1e0('0x32')](_[_0xc1e0('0x3a')](_0x4b4583['query'],_0x341d8c[_0xc1e0('0x32')]),_0x400d38);if(_0x4b4583['query'][_0xc1e0('0x3b')]){_0x14fdce[_0xc1e0('0x39')]=_[_0xc1e0('0x3c')](_0x14fdce[_0xc1e0('0x39')],{'$or':_[_0xc1e0('0x3d')](_0x400d38,function(_0x47edbc){if(_0x47edbc[_0xc1e0('0x3e')]!=='VIRTUAL'){var _0x4577e4={};_0x4577e4[_0x47edbc[_0xc1e0('0x2a')]]={'$like':'%'+_0x4b4583['query'][_0xc1e0('0x3b')]+'%'};return _0x4577e4;}})});}_0x14fdce=_['merge']({},_0x14fdce,_0x4b4583[_0xc1e0('0x3f')]);var _0xcd2e4b={'where':_0x14fdce[_0xc1e0('0x39')]};return db['FreshsalesField']['count'](_0xcd2e4b)['then'](function(_0x126932){_0x398ba3[_0xc1e0('0x20')]=_0x126932;if(_0x4b4583[_0xc1e0('0x31')][_0xc1e0('0x40')]){_0x14fdce[_0xc1e0('0x41')]=[{'all':!![]}];}return db['FreshsalesField'][_0xc1e0('0x42')](_0x14fdce);})[_0xc1e0('0x27')](function(_0x1b6b9d){_0x398ba3[_0xc1e0('0x43')]=_0x1b6b9d;return _0x398ba3;})['then'](respondWithFilteredResult(_0x3f86c7,_0x14fdce))[_0xc1e0('0x44')](handleError(_0x3f86c7,null));};exports[_0xc1e0('0x45')]=function(_0x37029c,_0x19fc5c){var _0x48f304={'raw':!![],'where':{'id':_0x37029c[_0xc1e0('0x46')]['id']}},_0x1162aa={};_0x1162aa[_0xc1e0('0x30')]=_[_0xc1e0('0x47')](db['FreshsalesField'][_0xc1e0('0x2d')]);_0x1162aa['query']=_[_0xc1e0('0x47')](_0x37029c[_0xc1e0('0x31')]);_0x1162aa[_0xc1e0('0x32')]=_['intersection'](_0x1162aa['model'],_0x1162aa['query']);_0x48f304[_0xc1e0('0x33')]=_[_0xc1e0('0x34')](_0x1162aa[_0xc1e0('0x30')],qs[_0xc1e0('0x35')](_0x37029c[_0xc1e0('0x31')][_0xc1e0('0x35')]));_0x48f304[_0xc1e0('0x33')]=_0x48f304['attributes']['length']?_0x48f304[_0xc1e0('0x33')]:_0x1162aa[_0xc1e0('0x30')];if(_0x37029c['query'][_0xc1e0('0x40')]){_0x48f304['include']=[{'all':!![]}];}_0x48f304=_[_0xc1e0('0x3c')]({},_0x48f304,_0x37029c[_0xc1e0('0x3f')]);return db['FreshsalesField'][_0xc1e0('0x48')](_0x48f304)[_0xc1e0('0x27')](handleEntityNotFound(_0x19fc5c,null))[_0xc1e0('0x27')](respondWithResult(_0x19fc5c,null))[_0xc1e0('0x44')](handleError(_0x19fc5c,null));};exports['create']=function(_0x4886b7,_0x1ec281){return db[_0xc1e0('0x2c')]['create'](_0x4886b7['body'],{})['then'](respondWithResult(_0x1ec281,0xc9))[_0xc1e0('0x44')](handleError(_0x1ec281,null));};exports[_0xc1e0('0x26')]=function(_0xb16fb1,_0x162007){if(_0xb16fb1['body']['id']){delete _0xb16fb1['body']['id'];}return db[_0xc1e0('0x2c')][_0xc1e0('0x48')]({'where':{'id':_0xb16fb1['params']['id']}})[_0xc1e0('0x27')](handleEntityNotFound(_0x162007,null))[_0xc1e0('0x27')](saveUpdates(_0xb16fb1[_0xc1e0('0x49')],null))[_0xc1e0('0x27')](respondWithResult(_0x162007,null))[_0xc1e0('0x44')](handleError(_0x162007,null));};exports[_0xc1e0('0x28')]=function(_0x441fec,_0x569369){return db[_0xc1e0('0x2c')]['find']({'where':{'id':_0x441fec[_0xc1e0('0x46')]['id']}})[_0xc1e0('0x27')](handleEntityNotFound(_0x569369,null))['then'](removeEntity(_0x569369,null))[_0xc1e0('0x44')](handleError(_0x569369,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 8b8d98b..7a538ce 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 _0x530f=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','util','moment','bluebird','request-promise','path'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x530f,0x167));var _0xf530=function(_0x105c6a,_0x48c736){_0x105c6a=_0x105c6a-0x0;var _0x5b844d=_0x530f[_0x105c6a];return _0x5b844d;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xf530('0xb'),'fields':[_0xf530('0xc'),_0xf530('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81cb=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3605f6,_0x4af8b3){var _0x98b2c1=function(_0x5b5a47){while(--_0x5b5a47){_0x3605f6['push'](_0x3605f6['shift']());}};_0x98b2c1(++_0x4af8b3);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb81c('0x0'));var util=require(_0xb81c('0x1'));var logger=require('../../config/logger')(_0xb81c('0x2'));var moment=require(_0xb81c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb81c('0x4'));var fs=require('fs');var path=require(_0xb81c('0x5'));var rimraf=require(_0xb81c('0x6'));var config=require(_0xb81c('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0xb81c('0x8')]=function(_0x50d323,_0x4e7d10){return _0x50d323[_0xb81c('0x9')](_0xb81c('0xa'),attributes,{'tableName':_0xb81c('0xb'),'paranoid':![],'indexes':[{'name':_0xb81c('0xc'),'fields':[_0xb81c('0xd'),_0xb81c('0xe')],'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 9edacd3..b170459 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x49d2f7,_0x4404cb){var _0x4cf79b=function(_0x6a7a30){while(--_0x6a7a30){_0x49d2f7['push'](_0x49d2f7['shift']());}};_0x4cf79b(++_0x4404cb);}(_0x33af,0xec));var _0xf33a=function(_0x3d0366,_0x50211a){_0x3d0366=_0x3d0366-0x0;var _0x5ce75e=_0x33af[_0x3d0366];return _0x5ce75e;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ 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(_0x46197a,_0x29ead4){var _0x807595=function(_0xdf5937){while(--_0xdf5937){_0x46197a['push'](_0x46197a['shift']());}};_0x807595(++_0x29ead4);}(_0x326f,0xd1));var _0xf326=function(_0x30fde9,_0x28ca21){_0x30fde9=_0x30fde9-0x0;var _0x5a6a11=_0x326f[_0x30fde9];return _0x5a6a11;};'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 ef7258e..4f6246d 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(_0x55a168,_0x168f0f){var _0x2f03e5=function(_0x7a8a22){while(--_0x7a8a22){_0x55a168['push'](_0x55a168['shift']());}};_0x2f03e5(++_0x168f0f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x27ff87,_0x3ce51e){var _0x4a2e9c=function(_0xceee7c){while(--_0xceee7c){_0x27ff87['push'](_0x27ff87['shift']());}};_0x4a2e9c(++_0x3ce51e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 b4935cd..919d3d9 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 _0x1b2a=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x599800,_0x4ba841){var _0x5aec6d=function(_0x3b4a25){while(--_0x3b4a25){_0x599800['push'](_0x599800['shift']());}};_0x5aec6d(++_0x4ba841);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x418f1a,_0x126065){_0x418f1a=_0x418f1a-0x0;var _0x432855=_0x1b2a[_0x418f1a];return _0x432855;};'use strict';var Sequelize=require('sequelize');module[_0xa1b2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1b2('0x1')]},'username':{'type':Sequelize[_0xa1b2('0x1')],'unique':_0xa1b2('0x2')},'remoteUri':{'type':Sequelize[_0xa1b2('0x1')]},'password':{'type':Sequelize[_0xa1b2('0x1')]},'clientId':{'type':Sequelize[_0xa1b2('0x1')]},'clientSecret':{'type':Sequelize[_0xa1b2('0x1')]},'securityToken':{'type':Sequelize[_0xa1b2('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa1b2('0x3')](_0xa1b2('0x4'),_0xa1b2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf03d=['username','ENUM','newTab','sequelize','exports','STRING'];(function(_0x14f681,_0xa0808e){var _0x1d4cb2=function(_0x66e474){while(--_0x66e474){_0x14f681['push'](_0x14f681['shift']());}};_0x1d4cb2(++_0xa0808e);}(_0xf03d,0x1a7));var _0xdf03=function(_0xaf05eb,_0x2918f6){_0xaf05eb=_0xaf05eb-0x0;var _0x39c7df=_0xf03d[_0xaf05eb];return _0x39c7df;};'use strict';var Sequelize=require(_0xdf03('0x0'));module[_0xdf03('0x1')]={'name':{'type':Sequelize[_0xdf03('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdf03('0x2')],'unique':_0xdf03('0x3')},'remoteUri':{'type':Sequelize[_0xdf03('0x2')]},'password':{'type':Sequelize[_0xdf03('0x2')]},'clientId':{'type':Sequelize[_0xdf03('0x2')]},'clientSecret':{'type':Sequelize[_0xdf03('0x2')]},'securityToken':{'type':Sequelize[_0xdf03('0x2')]},'serverUrl':{'type':Sequelize[_0xdf03('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdf03('0x4')]('integrationTab',_0xdf03('0x5')),'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 6dd411f..5bf45bc 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 _0x4887=['Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','includes','label','picklistValues','value','True','true','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','map','SalesforceAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring'];(function(_0x5b0b32,_0x24ab0b){var _0xcc46ae=function(_0x29cb8e){while(--_0x29cb8e){_0x5b0b32['push'](_0x5b0b32['shift']());}};_0xcc46ae(++_0x24ab0b);}(_0x4887,0x8f));var _0x7488=function(_0x320fcb,_0x4e5e7b){_0x320fcb=_0x320fcb-0x0;var _0x2418b2=_0x4887[_0x320fcb];return _0x2418b2;};'use strict';var emlformat=require(_0x7488('0x0'));var rimraf=require(_0x7488('0x1'));var zipdir=require(_0x7488('0x2'));var jsonpatch=require(_0x7488('0x3'));var rp=require(_0x7488('0x4'));var moment=require(_0x7488('0x5'));var BPromise=require(_0x7488('0x6'));var Mustache=require(_0x7488('0x7'));var util=require(_0x7488('0x8'));var path=require(_0x7488('0x9'));var sox=require('sox');var csv=require(_0x7488('0xa'));var ejs=require(_0x7488('0xb'));var fs=require('fs');var fs_extra=require(_0x7488('0xc'));var _=require(_0x7488('0xd'));var squel=require(_0x7488('0xe'));var crypto=require('crypto');var jsforce=require(_0x7488('0xf'));var deskjs=require(_0x7488('0x10'));var toCsv=require(_0x7488('0xa'));var querystring=require('querystring');var Papa=require(_0x7488('0x11'));var Redis=require(_0x7488('0x12'));var authService=require(_0x7488('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7488('0x14'));var hardwareService=require(_0x7488('0x15'));var logger=require(_0x7488('0x16'))('api');var utils=require(_0x7488('0x17'));var config=require(_0x7488('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7488('0x19'))['db'];var integrations=require(_0x7488('0x1a'));function respondWithStatusCode(_0xa28e76,_0x4ba633){_0x4ba633=_0x4ba633||0xcc;return function(_0x4770fc){if(_0x4770fc){return _0xa28e76[_0x7488('0x1b')](_0x4ba633);}return _0xa28e76[_0x7488('0x1c')](_0x4ba633)['end']();};}function respondWithResult(_0x4b4647,_0xb822f3){_0xb822f3=_0xb822f3||0xc8;return function(_0x228dcb){if(_0x228dcb){return _0x4b4647[_0x7488('0x1c')](_0xb822f3)[_0x7488('0x1d')](_0x228dcb);}};}function respondWithFilteredResult(_0x16c917,_0x373320){return function(_0x393183){if(_0x393183){var _0x5c8228=typeof _0x373320[_0x7488('0x1e')]==='undefined'&&typeof _0x373320['limit']===_0x7488('0x1f');var _0x5e83b5=_0x393183['count'];var _0x84f7f8=_0x5c8228?0x0:_0x373320[_0x7488('0x1e')];var _0x51e716=_0x5c8228?_0x393183[_0x7488('0x20')]:_0x373320[_0x7488('0x1e')]+_0x373320[_0x7488('0x21')];var _0x48ef34;if(_0x51e716>=_0x5e83b5){_0x51e716=_0x5e83b5;_0x48ef34=0xc8;}else{_0x48ef34=0xce;}_0x16c917[_0x7488('0x1c')](_0x48ef34);return _0x16c917[_0x7488('0x22')](_0x7488('0x23'),_0x84f7f8+'-'+_0x51e716+'/'+_0x5e83b5)[_0x7488('0x1d')](_0x393183);}return null;};}function patchUpdates(_0x3950ec){return function(_0x50c639){try{jsonpatch[_0x7488('0x24')](_0x50c639,_0x3950ec,!![]);}catch(_0x587eab){return BPromise[_0x7488('0x25')](_0x587eab);}return _0x50c639['save']();};}function saveUpdates(_0x408c04,_0x4daec3){return function(_0x445167){if(_0x445167){return _0x445167['update'](_0x408c04)[_0x7488('0x26')](function(_0xaf7068){return _0xaf7068;});}return null;};}function removeEntity(_0x52de4b,_0x18f24b){return function(_0x1039d9){if(_0x1039d9){return _0x1039d9[_0x7488('0x27')]()[_0x7488('0x26')](function(){_0x52de4b['status'](0xcc)[_0x7488('0x28')]();});}};}function handleEntityNotFound(_0x4affef,_0x5345b6){return function(_0x559303){if(!_0x559303){_0x4affef['sendStatus'](0x194);}return _0x559303;};}function handleError(_0x124adf,_0x5cacb6){_0x5cacb6=_0x5cacb6||0x1f4;return function(_0xf7bb5c){logger['error'](_0xf7bb5c[_0x7488('0x29')]);if(_0xf7bb5c[_0x7488('0x2a')]){delete _0xf7bb5c[_0x7488('0x2a')];}_0x124adf[_0x7488('0x1c')](_0x5cacb6)[_0x7488('0x2b')](_0xf7bb5c);};}exports['index']=function(_0x4788b0,_0x18bc33){var _0xc92261={},_0x342ed7={},_0x7c515b={'count':0x0,'rows':[]};var _0x2fd9ec=_[_0x7488('0x2c')](db[_0x7488('0x2d')]['rawAttributes'],function(_0x599fd1){return{'name':_0x599fd1[_0x7488('0x2e')],'type':_0x599fd1['type']['key']};});_0x342ed7[_0x7488('0x2f')]=_[_0x7488('0x2c')](_0x2fd9ec,_0x7488('0x2a'));_0x342ed7[_0x7488('0x30')]=_[_0x7488('0x31')](_0x4788b0[_0x7488('0x30')]);_0x342ed7[_0x7488('0x32')]=_[_0x7488('0x33')](_0x342ed7['model'],_0x342ed7['query']);_0xc92261['attributes']=_['intersection'](_0x342ed7[_0x7488('0x2f')],qs[_0x7488('0x34')](_0x4788b0['query'][_0x7488('0x34')]));_0xc92261['attributes']=_0xc92261[_0x7488('0x35')][_0x7488('0x36')]?_0xc92261[_0x7488('0x35')]:_0x342ed7[_0x7488('0x2f')];if(!_0x4788b0[_0x7488('0x30')][_0x7488('0x37')]('nolimit')){_0xc92261['limit']=qs[_0x7488('0x21')](_0x4788b0['query'][_0x7488('0x21')]);_0xc92261[_0x7488('0x1e')]=qs[_0x7488('0x1e')](_0x4788b0[_0x7488('0x30')][_0x7488('0x1e')]);}_0xc92261['order']=qs['sort'](_0x4788b0[_0x7488('0x30')][_0x7488('0x38')]);_0xc92261[_0x7488('0x39')]=qs[_0x7488('0x32')](_['pick'](_0x4788b0[_0x7488('0x30')],_0x342ed7[_0x7488('0x32')]),_0x2fd9ec);if(_0x4788b0[_0x7488('0x30')][_0x7488('0x3a')]){_0xc92261[_0x7488('0x39')]=_[_0x7488('0x3b')](_0xc92261[_0x7488('0x39')],{'$or':_[_0x7488('0x2c')](_0x2fd9ec,function(_0x16f739){if(_0x16f739[_0x7488('0x3c')]!==_0x7488('0x3d')){var _0x1ad4f1={};_0x1ad4f1[_0x16f739[_0x7488('0x2a')]]={'$like':'%'+_0x4788b0['query'][_0x7488('0x3a')]+'%'};return _0x1ad4f1;}})});}_0xc92261=_[_0x7488('0x3b')]({},_0xc92261,_0x4788b0[_0x7488('0x3e')]);var _0x285291={'where':_0xc92261['where']};return db[_0x7488('0x2d')]['count'](_0x285291)[_0x7488('0x26')](function(_0x494874){_0x7c515b[_0x7488('0x20')]=_0x494874;if(_0x4788b0[_0x7488('0x30')][_0x7488('0x3f')]){_0xc92261[_0x7488('0x40')]=[{'all':!![]}];}return db[_0x7488('0x2d')][_0x7488('0x41')](_0xc92261);})[_0x7488('0x26')](function(_0x60145e){_0x7c515b[_0x7488('0x42')]=_0x60145e;return _0x7c515b;})[_0x7488('0x26')](respondWithFilteredResult(_0x18bc33,_0xc92261))[_0x7488('0x43')](handleError(_0x18bc33,null));};exports[_0x7488('0x44')]=function(_0x1fb4fb,_0xa7e606){var _0x185547={'raw':![],'where':{'id':_0x1fb4fb[_0x7488('0x45')]['id']}},_0x331836={};_0x331836['model']=_[_0x7488('0x31')](db[_0x7488('0x2d')][_0x7488('0x46')]);_0x331836[_0x7488('0x30')]=_[_0x7488('0x31')](_0x1fb4fb['query']);_0x331836['filters']=_[_0x7488('0x33')](_0x331836[_0x7488('0x2f')],_0x331836[_0x7488('0x30')]);_0x185547['attributes']=_['intersection'](_0x331836['model'],qs['fields'](_0x1fb4fb['query'][_0x7488('0x34')]));_0x185547[_0x7488('0x35')]=_0x185547[_0x7488('0x35')][_0x7488('0x36')]?_0x185547['attributes']:_0x331836['model'];if(_0x1fb4fb[_0x7488('0x30')]['includeAll']){_0x185547['include']=[{'all':!![]}];}_0x185547=_[_0x7488('0x3b')]({},_0x185547,_0x1fb4fb[_0x7488('0x3e')]);return db['SalesforceAccount']['find'](_0x185547)[_0x7488('0x26')](handleEntityNotFound(_0xa7e606,null))[_0x7488('0x26')](respondWithResult(_0xa7e606,null))[_0x7488('0x43')](handleError(_0xa7e606,null));};exports[_0x7488('0x47')]=function(_0x5b7a97,_0x46553a){return db[_0x7488('0x2d')][_0x7488('0x47')](_0x5b7a97[_0x7488('0x48')],{})[_0x7488('0x26')](respondWithResult(_0x46553a,0xc9))[_0x7488('0x43')](handleError(_0x46553a,null));};exports[_0x7488('0x49')]=function(_0x45f9bb,_0x3f0e8e){if(_0x45f9bb[_0x7488('0x48')]['id']){delete _0x45f9bb[_0x7488('0x48')]['id'];}return db[_0x7488('0x2d')][_0x7488('0x4a')]({'where':{'id':_0x45f9bb[_0x7488('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f0e8e,null))[_0x7488('0x26')](saveUpdates(_0x45f9bb[_0x7488('0x48')],null))[_0x7488('0x26')](respondWithResult(_0x3f0e8e,null))[_0x7488('0x43')](handleError(_0x3f0e8e,null));};exports[_0x7488('0x27')]=function(_0x4fe178,_0xabaceb){return db[_0x7488('0x2d')][_0x7488('0x4a')]({'where':{'id':_0x4fe178['params']['id']}})[_0x7488('0x26')](handleEntityNotFound(_0xabaceb,null))[_0x7488('0x26')](removeEntity(_0xabaceb,null))[_0x7488('0x43')](handleError(_0xabaceb,null));};exports[_0x7488('0x4b')]=function(_0x3d7eda,_0x2fc980,_0xd731bf){var _0xefcecd={};var _0x482dd3={};var _0x2932f3;var _0x4500e1;return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x3d7eda[_0x7488('0x45')]['id']}})[_0x7488('0x26')](handleEntityNotFound(_0x2fc980,null))[_0x7488('0x26')](function(_0x1d2e98){if(_0x1d2e98){_0x2932f3=_0x1d2e98;_0x482dd3[_0x7488('0x2f')]=_[_0x7488('0x31')](db[_0x7488('0x4d')][_0x7488('0x46')]);_0x482dd3[_0x7488('0x30')]=_['keys'](_0x3d7eda['query']);_0x482dd3[_0x7488('0x32')]=_['intersection'](_0x482dd3[_0x7488('0x2f')],_0x482dd3[_0x7488('0x30')]);_0xefcecd[_0x7488('0x35')]=_[_0x7488('0x33')](_0x482dd3['model'],qs[_0x7488('0x34')](_0x3d7eda['query']['fields']));_0xefcecd[_0x7488('0x35')]=_0xefcecd[_0x7488('0x35')][_0x7488('0x36')]?_0xefcecd[_0x7488('0x35')]:_0x482dd3[_0x7488('0x2f')];_0xefcecd[_0x7488('0x4e')]=qs[_0x7488('0x38')](_0x3d7eda[_0x7488('0x30')][_0x7488('0x38')]);_0xefcecd[_0x7488('0x39')]=qs[_0x7488('0x32')](_[_0x7488('0x4f')](_0x3d7eda[_0x7488('0x30')],_0x482dd3[_0x7488('0x32')]));if(_0x3d7eda[_0x7488('0x30')][_0x7488('0x3a')]){_0xefcecd['where']=_[_0x7488('0x3b')](_0xefcecd[_0x7488('0x39')],{'$or':_[_0x7488('0x2c')](_0xefcecd[_0x7488('0x35')],function(_0xb14e0c){var _0x514b0a={};_0x514b0a[_0xb14e0c]={'$like':'%'+_0x3d7eda['query']['filter']+'%'};return _0x514b0a;})});}_0xefcecd=_['merge']({},_0xefcecd,_0x3d7eda[_0x7488('0x3e')]);return _0x2932f3[_0x7488('0x4b')](_0xefcecd);}})['then'](function(_0x10a5ec){if(_0x10a5ec){_0x4500e1=_0x10a5ec[_0x7488('0x36')];if(!_0x3d7eda[_0x7488('0x30')][_0x7488('0x37')]('nolimit')){_0xefcecd[_0x7488('0x21')]=qs[_0x7488('0x21')](_0x3d7eda[_0x7488('0x30')]['limit']);_0xefcecd[_0x7488('0x1e')]=qs['offset'](_0x3d7eda[_0x7488('0x30')][_0x7488('0x1e')]);}return _0x2932f3[_0x7488('0x4b')](_0xefcecd);}})['then'](function(_0x4ad2cf){if(_0x4ad2cf){return _0x4ad2cf?{'count':_0x4500e1,'rows':_0x4ad2cf}:null;}})[_0x7488('0x26')](respondWithResult(_0x2fc980,null))['catch'](handleError(_0x2fc980,null));};exports[_0x7488('0x50')]=function(_0x8dec23,_0x264d1e,_0x5e0955){if(_0x8dec23['body']['id']){delete _0x8dec23[_0x7488('0x48')]['id'];}return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x8dec23['params']['id']}})['then'](handleEntityNotFound(_0x264d1e,null))['then'](function(_0x557ee6){if(_0x557ee6){_0x8dec23[_0x7488('0x48')]['AccountId']=_0x557ee6['id'];_0x8dec23[_0x7488('0x48')][_0x7488('0x51')]=integrations[_0x7488('0x52')](_0x8dec23[_0x7488('0x48')][_0x7488('0x53')],_0x8dec23['body'][_0x7488('0x3c')]);_0x8dec23[_0x7488('0x48')][_0x7488('0x54')]=integrations[_0x7488('0x55')](_0x8dec23[_0x7488('0x48')][_0x7488('0x53')],_0x8dec23[_0x7488('0x48')][_0x7488('0x3c')]);return db[_0x7488('0x4d')][_0x7488('0x47')](_0x8dec23[_0x7488('0x48')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7488('0x56')],'as':_0x7488('0x54')}]});}return null;})['then'](respondWithResult(_0x264d1e,null))['catch'](handleError(_0x264d1e,null));};exports[_0x7488('0x57')]=function(_0x3ae2fc,_0x359661,_0x26c0af){var _0x37cf7e;var _0x5d9736='';var _0x458b71=_0x7488('0x58');return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x3ae2fc[_0x7488('0x45')]['id']},'attributes':['id',_0x7488('0x59'),_0x7488('0x5a'),_0x7488('0x5b'),_0x7488('0x5c'),_0x7488('0x5d'),_0x7488('0x5e')]})[_0x7488('0x26')](handleEntityNotFound(_0x359661,null))[_0x7488('0x26')](function(_0x198f5){if(_0x198f5){_0x5d9736=_0x198f5[_0x7488('0x59')];var _0x66cfa6=_0x5d9736[_0x7488('0x5f')](-0x1);if(_0x66cfa6==='/'){_0x5d9736=_0x5d9736[_0x7488('0x60')](0x0,_0x5d9736['lastIndexOf'](_0x66cfa6));}_0x37cf7e=new jsforce[(_0x7488('0x61'))]({'oauth2':{'loginUrl':_0x5d9736,'clientId':_0x198f5[_0x7488('0x5a')],'clientSecret':_0x198f5[_0x7488('0x5b')]}});return _0x37cf7e[_0x7488('0x62')](_0x198f5[_0x7488('0x5c')],_0x198f5[_0x7488('0x5d')][_0x7488('0x63')](_0x198f5[_0x7488('0x5e')]));}})[_0x7488('0x26')](function(_0x2f70d7){if(_0x2f70d7){if(!_['isNil'](_0x3ae2fc[_0x7488('0x30')][_0x7488('0x64')])){_0x458b71=_0x3ae2fc[_0x7488('0x30')]['ticketType'];}return _0x37cf7e[_0x7488('0x65')](_0x458b71)[_0x7488('0x66')]();}})['then'](function(_0xe799af){var _0x57d767=[_0x7488('0x67'),_0x7488('0x68'),_0x7488('0x69'),'IsRecurrence',_0x7488('0x6a'),'Description'];var _0x421685=[_0x7488('0x6b'),_0x7488('0x6c'),'picklist',_0x7488('0x6d'),'email','textarea','phone'];if(_0xe799af){_['remove'](_0xe799af[_0x7488('0x34')],function(_0x371dd3){return _0x57d767['includes'](_0x371dd3[_0x7488('0x2a')])||!_0x421685[_0x7488('0x6e')](_0x371dd3[_0x7488('0x3c')]);});return{'count':_0xe799af['fields'][_0x7488('0x36')],'rows':_[_0x7488('0x2c')](_0xe799af['fields'],function(_0x2019f3){return{'id':_0x2019f3[_0x7488('0x2a')],'name':_0x2019f3[_0x7488('0x6f')],'custom':_0x2019f3['custom'],'options':_0x2019f3[_0x7488('0x70')][_0x7488('0x36')]>0x0?_['map'](_0x2019f3[_0x7488('0x70')],function(_0x4bb812){return{'name':_0x4bb812[_0x7488('0x6f')],'value':_0x4bb812[_0x7488('0x71')]};}):_0x2019f3[_0x7488('0x3c')]=='boolean'?[{'name':_0x7488('0x72'),'value':_0x7488('0x73')},{'name':'False','value':'false'}]:[]};})};}})[_0x7488('0x26')](respondWithResult(_0x359661,null))[_0x7488('0x43')](function(_0x40ae17){var _0x9a287e=_0x3ae2fc['query'][_0x7488('0x74')]?0x1f4:_0x40ae17[_0x7488('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7488('0x57'),_0x9a287e,JSON[_0x7488('0x76')](_0x40ae17));delete _0x40ae17[_0x7488('0x2a')];if(_0x9a287e===0x191){_0x9a287e=0x190;}_0x359661[_0x7488('0x1c')](_0x9a287e)[_0x7488('0x2b')](_0x3ae2fc[_0x7488('0x30')][_0x7488('0x74')]?{'message':_0x7488('0x77'),'statusCode':_0x40ae17[_0x7488('0x75')]}:_0x40ae17);});}; \ No newline at end of file +var _0xc1a3=['remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','value','True','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','body','destroy','getConfigurations','findOne','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','Task'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc1a3,0x11f));var _0x3c1a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xc1a3[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x3c1a('0x0'));var rimraf=require(_0x3c1a('0x1'));var zipdir=require(_0x3c1a('0x2'));var jsonpatch=require(_0x3c1a('0x3'));var rp=require(_0x3c1a('0x4'));var moment=require(_0x3c1a('0x5'));var BPromise=require(_0x3c1a('0x6'));var Mustache=require(_0x3c1a('0x7'));var util=require(_0x3c1a('0x8'));var path=require(_0x3c1a('0x9'));var sox=require('sox');var csv=require(_0x3c1a('0xa'));var ejs=require(_0x3c1a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c1a('0xc'));var crypto=require(_0x3c1a('0xd'));var jsforce=require(_0x3c1a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c1a('0xa'));var querystring=require(_0x3c1a('0xf'));var Papa=require(_0x3c1a('0x10'));var Redis=require(_0x3c1a('0x11'));var authService=require(_0x3c1a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c1a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3c1a('0x14'));var licenseUtil=require(_0x3c1a('0x15'));var db=require(_0x3c1a('0x16'))['db'];var integrations=require(_0x3c1a('0x17'));function respondWithStatusCode(_0x4332dc,_0x3bb99c){_0x3bb99c=_0x3bb99c||0xcc;return function(_0x2791d6){if(_0x2791d6){return _0x4332dc['sendStatus'](_0x3bb99c);}return _0x4332dc[_0x3c1a('0x18')](_0x3bb99c)['end']();};}function respondWithResult(_0x3024f2,_0x568943){_0x568943=_0x568943||0xc8;return function(_0x336361){if(_0x336361){return _0x3024f2[_0x3c1a('0x18')](_0x568943)[_0x3c1a('0x19')](_0x336361);}};}function respondWithFilteredResult(_0x2bada0,_0x658c90){return function(_0x113755){if(_0x113755){var _0x4c5095=typeof _0x658c90[_0x3c1a('0x1a')]===_0x3c1a('0x1b')&&typeof _0x658c90[_0x3c1a('0x1c')]===_0x3c1a('0x1b');var _0x536371=_0x113755['count'];var _0x248870=_0x4c5095?0x0:_0x658c90[_0x3c1a('0x1a')];var _0x522fc3=_0x4c5095?_0x113755[_0x3c1a('0x1d')]:_0x658c90[_0x3c1a('0x1a')]+_0x658c90['limit'];var _0x3b17d9;if(_0x522fc3>=_0x536371){_0x522fc3=_0x536371;_0x3b17d9=0xc8;}else{_0x3b17d9=0xce;}_0x2bada0[_0x3c1a('0x18')](_0x3b17d9);return _0x2bada0[_0x3c1a('0x1e')]('Content-Range',_0x248870+'-'+_0x522fc3+'/'+_0x536371)[_0x3c1a('0x19')](_0x113755);}return null;};}function patchUpdates(_0x38af50){return function(_0x23d12d){try{jsonpatch[_0x3c1a('0x1f')](_0x23d12d,_0x38af50,!![]);}catch(_0x5d426c){return BPromise[_0x3c1a('0x20')](_0x5d426c);}return _0x23d12d['save']();};}function saveUpdates(_0x17a94a,_0x204cef){return function(_0x3aba27){if(_0x3aba27){return _0x3aba27[_0x3c1a('0x21')](_0x17a94a)[_0x3c1a('0x22')](function(_0x2cf4ed){return _0x2cf4ed;});}return null;};}function removeEntity(_0x1da999,_0xe394b4){return function(_0x42f60c){if(_0x42f60c){return _0x42f60c['destroy']()[_0x3c1a('0x22')](function(){_0x1da999[_0x3c1a('0x18')](0xcc)[_0x3c1a('0x23')]();});}};}function handleEntityNotFound(_0xbbf826,_0x3633df){return function(_0x53a681){if(!_0x53a681){_0xbbf826[_0x3c1a('0x24')](0x194);}return _0x53a681;};}function handleError(_0x28d9d6,_0x4d6f84){_0x4d6f84=_0x4d6f84||0x1f4;return function(_0x2e9d0c){logger[_0x3c1a('0x25')](_0x2e9d0c[_0x3c1a('0x26')]);if(_0x2e9d0c[_0x3c1a('0x27')]){delete _0x2e9d0c[_0x3c1a('0x27')];}_0x28d9d6[_0x3c1a('0x18')](_0x4d6f84)[_0x3c1a('0x28')](_0x2e9d0c);};}exports[_0x3c1a('0x29')]=function(_0x403e24,_0x532be8){var _0x120053={},_0x4d904c={},_0x58016a={'count':0x0,'rows':[]};var _0x4a84ab=_[_0x3c1a('0x2a')](db[_0x3c1a('0x2b')][_0x3c1a('0x2c')],function(_0x7a0233){return{'name':_0x7a0233[_0x3c1a('0x2d')],'type':_0x7a0233['type'][_0x3c1a('0x2e')]};});_0x4d904c[_0x3c1a('0x2f')]=_[_0x3c1a('0x2a')](_0x4a84ab,_0x3c1a('0x27'));_0x4d904c[_0x3c1a('0x30')]=_['keys'](_0x403e24[_0x3c1a('0x30')]);_0x4d904c[_0x3c1a('0x31')]=_[_0x3c1a('0x32')](_0x4d904c[_0x3c1a('0x2f')],_0x4d904c['query']);_0x120053[_0x3c1a('0x33')]=_[_0x3c1a('0x32')](_0x4d904c[_0x3c1a('0x2f')],qs[_0x3c1a('0x34')](_0x403e24['query'][_0x3c1a('0x34')]));_0x120053['attributes']=_0x120053[_0x3c1a('0x33')][_0x3c1a('0x35')]?_0x120053[_0x3c1a('0x33')]:_0x4d904c[_0x3c1a('0x2f')];if(!_0x403e24[_0x3c1a('0x30')]['hasOwnProperty'](_0x3c1a('0x36'))){_0x120053['limit']=qs[_0x3c1a('0x1c')](_0x403e24['query'][_0x3c1a('0x1c')]);_0x120053[_0x3c1a('0x1a')]=qs[_0x3c1a('0x1a')](_0x403e24['query']['offset']);}_0x120053[_0x3c1a('0x37')]=qs['sort'](_0x403e24['query'][_0x3c1a('0x38')]);_0x120053[_0x3c1a('0x39')]=qs[_0x3c1a('0x31')](_['pick'](_0x403e24[_0x3c1a('0x30')],_0x4d904c[_0x3c1a('0x31')]),_0x4a84ab);if(_0x403e24[_0x3c1a('0x30')][_0x3c1a('0x3a')]){_0x120053[_0x3c1a('0x39')]=_[_0x3c1a('0x3b')](_0x120053[_0x3c1a('0x39')],{'$or':_[_0x3c1a('0x2a')](_0x4a84ab,function(_0x23fcdd){if(_0x23fcdd[_0x3c1a('0x3c')]!==_0x3c1a('0x3d')){var _0x246d9b={};_0x246d9b[_0x23fcdd[_0x3c1a('0x27')]]={'$like':'%'+_0x403e24[_0x3c1a('0x30')][_0x3c1a('0x3a')]+'%'};return _0x246d9b;}})});}_0x120053=_['merge']({},_0x120053,_0x403e24[_0x3c1a('0x3e')]);var _0x398843={'where':_0x120053[_0x3c1a('0x39')]};return db[_0x3c1a('0x2b')][_0x3c1a('0x1d')](_0x398843)[_0x3c1a('0x22')](function(_0x2b5f99){_0x58016a[_0x3c1a('0x1d')]=_0x2b5f99;if(_0x403e24[_0x3c1a('0x30')][_0x3c1a('0x3f')]){_0x120053[_0x3c1a('0x40')]=[{'all':!![]}];}return db[_0x3c1a('0x2b')]['findAll'](_0x120053);})['then'](function(_0x35abad){_0x58016a[_0x3c1a('0x41')]=_0x35abad;return _0x58016a;})['then'](respondWithFilteredResult(_0x532be8,_0x120053))[_0x3c1a('0x42')](handleError(_0x532be8,null));};exports[_0x3c1a('0x43')]=function(_0x3ce45a,_0x530d6c){var _0x2f814f={'raw':![],'where':{'id':_0x3ce45a[_0x3c1a('0x44')]['id']}},_0x56d161={};_0x56d161[_0x3c1a('0x2f')]=_[_0x3c1a('0x45')](db['SalesforceAccount']['rawAttributes']);_0x56d161['query']=_[_0x3c1a('0x45')](_0x3ce45a['query']);_0x56d161[_0x3c1a('0x31')]=_[_0x3c1a('0x32')](_0x56d161[_0x3c1a('0x2f')],_0x56d161[_0x3c1a('0x30')]);_0x2f814f['attributes']=_[_0x3c1a('0x32')](_0x56d161[_0x3c1a('0x2f')],qs[_0x3c1a('0x34')](_0x3ce45a['query'][_0x3c1a('0x34')]));_0x2f814f[_0x3c1a('0x33')]=_0x2f814f[_0x3c1a('0x33')][_0x3c1a('0x35')]?_0x2f814f[_0x3c1a('0x33')]:_0x56d161[_0x3c1a('0x2f')];if(_0x3ce45a[_0x3c1a('0x30')][_0x3c1a('0x3f')]){_0x2f814f['include']=[{'all':!![]}];}_0x2f814f=_[_0x3c1a('0x3b')]({},_0x2f814f,_0x3ce45a[_0x3c1a('0x3e')]);return db['SalesforceAccount']['find'](_0x2f814f)[_0x3c1a('0x22')](handleEntityNotFound(_0x530d6c,null))[_0x3c1a('0x22')](respondWithResult(_0x530d6c,null))['catch'](handleError(_0x530d6c,null));};exports['create']=function(_0x5c952f,_0x458555){return db[_0x3c1a('0x2b')]['create'](_0x5c952f[_0x3c1a('0x46')],{})[_0x3c1a('0x22')](respondWithResult(_0x458555,0xc9))[_0x3c1a('0x42')](handleError(_0x458555,null));};exports[_0x3c1a('0x21')]=function(_0x1ff2b6,_0x3242ab){if(_0x1ff2b6['body']['id']){delete _0x1ff2b6['body']['id'];}return db[_0x3c1a('0x2b')]['find']({'where':{'id':_0x1ff2b6[_0x3c1a('0x44')]['id']}})[_0x3c1a('0x22')](handleEntityNotFound(_0x3242ab,null))[_0x3c1a('0x22')](saveUpdates(_0x1ff2b6['body'],null))[_0x3c1a('0x22')](respondWithResult(_0x3242ab,null))[_0x3c1a('0x42')](handleError(_0x3242ab,null));};exports[_0x3c1a('0x47')]=function(_0x596e87,_0x3ce78c){return db[_0x3c1a('0x2b')]['find']({'where':{'id':_0x596e87['params']['id']}})['then'](handleEntityNotFound(_0x3ce78c,null))[_0x3c1a('0x22')](removeEntity(_0x3ce78c,null))[_0x3c1a('0x42')](handleError(_0x3ce78c,null));};exports[_0x3c1a('0x48')]=function(_0x382daf,_0x31bc82,_0x544553){var _0x2c7553={};var _0x526814={};var _0x58359e;var _0x5919c8;return db[_0x3c1a('0x2b')][_0x3c1a('0x49')]({'where':{'id':_0x382daf[_0x3c1a('0x44')]['id']}})['then'](handleEntityNotFound(_0x31bc82,null))[_0x3c1a('0x22')](function(_0xce7cd8){if(_0xce7cd8){_0x58359e=_0xce7cd8;_0x526814[_0x3c1a('0x2f')]=_[_0x3c1a('0x45')](db[_0x3c1a('0x4a')]['rawAttributes']);_0x526814[_0x3c1a('0x30')]=_[_0x3c1a('0x45')](_0x382daf[_0x3c1a('0x30')]);_0x526814[_0x3c1a('0x31')]=_[_0x3c1a('0x32')](_0x526814[_0x3c1a('0x2f')],_0x526814[_0x3c1a('0x30')]);_0x2c7553[_0x3c1a('0x33')]=_[_0x3c1a('0x32')](_0x526814[_0x3c1a('0x2f')],qs[_0x3c1a('0x34')](_0x382daf['query']['fields']));_0x2c7553[_0x3c1a('0x33')]=_0x2c7553[_0x3c1a('0x33')]['length']?_0x2c7553[_0x3c1a('0x33')]:_0x526814[_0x3c1a('0x2f')];_0x2c7553[_0x3c1a('0x37')]=qs[_0x3c1a('0x38')](_0x382daf['query']['sort']);_0x2c7553[_0x3c1a('0x39')]=qs[_0x3c1a('0x31')](_[_0x3c1a('0x4b')](_0x382daf[_0x3c1a('0x30')],_0x526814[_0x3c1a('0x31')]));if(_0x382daf[_0x3c1a('0x30')]['filter']){_0x2c7553[_0x3c1a('0x39')]=_['merge'](_0x2c7553[_0x3c1a('0x39')],{'$or':_['map'](_0x2c7553[_0x3c1a('0x33')],function(_0x3062e3){var _0x18e867={};_0x18e867[_0x3062e3]={'$like':'%'+_0x382daf['query'][_0x3c1a('0x3a')]+'%'};return _0x18e867;})});}_0x2c7553=_[_0x3c1a('0x3b')]({},_0x2c7553,_0x382daf[_0x3c1a('0x3e')]);return _0x58359e['getConfigurations'](_0x2c7553);}})[_0x3c1a('0x22')](function(_0x8a635e){if(_0x8a635e){_0x5919c8=_0x8a635e[_0x3c1a('0x35')];if(!_0x382daf[_0x3c1a('0x30')][_0x3c1a('0x4c')](_0x3c1a('0x36'))){_0x2c7553[_0x3c1a('0x1c')]=qs[_0x3c1a('0x1c')](_0x382daf[_0x3c1a('0x30')][_0x3c1a('0x1c')]);_0x2c7553[_0x3c1a('0x1a')]=qs[_0x3c1a('0x1a')](_0x382daf[_0x3c1a('0x30')]['offset']);}return _0x58359e[_0x3c1a('0x48')](_0x2c7553);}})[_0x3c1a('0x22')](function(_0x2a8481){if(_0x2a8481){return _0x2a8481?{'count':_0x5919c8,'rows':_0x2a8481}:null;}})['then'](respondWithResult(_0x31bc82,null))[_0x3c1a('0x42')](handleError(_0x31bc82,null));};exports[_0x3c1a('0x4d')]=function(_0x576a87,_0x198d63,_0x37b6a8){if(_0x576a87[_0x3c1a('0x46')]['id']){delete _0x576a87['body']['id'];}return db[_0x3c1a('0x2b')][_0x3c1a('0x49')]({'where':{'id':_0x576a87[_0x3c1a('0x44')]['id']}})[_0x3c1a('0x22')](handleEntityNotFound(_0x198d63,null))[_0x3c1a('0x22')](function(_0x1a5f2d){if(_0x1a5f2d){_0x576a87[_0x3c1a('0x46')][_0x3c1a('0x4e')]=_0x1a5f2d['id'];_0x576a87[_0x3c1a('0x46')][_0x3c1a('0x4f')]=integrations[_0x3c1a('0x50')](_0x576a87[_0x3c1a('0x46')][_0x3c1a('0x51')],_0x576a87[_0x3c1a('0x46')][_0x3c1a('0x3c')]);_0x576a87['body'][_0x3c1a('0x52')]=integrations['getDescriptions'](_0x576a87['body'][_0x3c1a('0x51')],_0x576a87[_0x3c1a('0x46')]['type']);return db[_0x3c1a('0x4a')]['create'](_0x576a87[_0x3c1a('0x46')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x3c1a('0x52')}]});}return null;})['then'](respondWithResult(_0x198d63,null))[_0x3c1a('0x42')](handleError(_0x198d63,null));};exports[_0x3c1a('0x53')]=function(_0xc76208,_0x2cd160,_0x5136d4){var _0x4cbf5a;var _0x224a2f='';var _0x1d0c17=_0x3c1a('0x54');return db['SalesforceAccount'][_0x3c1a('0x49')]({'where':{'id':_0xc76208[_0x3c1a('0x44')]['id']},'attributes':['id',_0x3c1a('0x55'),_0x3c1a('0x56'),'clientSecret',_0x3c1a('0x57'),_0x3c1a('0x58'),_0x3c1a('0x59')]})[_0x3c1a('0x22')](handleEntityNotFound(_0x2cd160,null))['then'](function(_0x3250a0){if(_0x3250a0){_0x224a2f=_0x3250a0[_0x3c1a('0x55')];var _0x416a01=_0x224a2f[_0x3c1a('0x5a')](-0x1);if(_0x416a01==='/'){_0x224a2f=_0x224a2f[_0x3c1a('0x5b')](0x0,_0x224a2f[_0x3c1a('0x5c')](_0x416a01));}_0x4cbf5a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x224a2f,'clientId':_0x3250a0[_0x3c1a('0x56')],'clientSecret':_0x3250a0[_0x3c1a('0x5d')]}});return _0x4cbf5a[_0x3c1a('0x5e')](_0x3250a0[_0x3c1a('0x57')],_0x3250a0[_0x3c1a('0x58')][_0x3c1a('0x5f')](_0x3250a0[_0x3c1a('0x59')]));}})[_0x3c1a('0x22')](function(_0x80a4b8){if(_0x80a4b8){if(!_[_0x3c1a('0x60')](_0xc76208['query'][_0x3c1a('0x61')])){_0x1d0c17=_0xc76208['query'][_0x3c1a('0x61')];}return _0x4cbf5a[_0x3c1a('0x62')](_0x1d0c17)[_0x3c1a('0x63')]();}})[_0x3c1a('0x22')](function(_0x39734e){var _0x584c8f=[_0x3c1a('0x64'),_0x3c1a('0x65'),_0x3c1a('0x66'),_0x3c1a('0x67'),_0x3c1a('0x68'),_0x3c1a('0x69')];var _0x2aee95=[_0x3c1a('0x6a'),_0x3c1a('0x6b'),_0x3c1a('0x6c'),_0x3c1a('0x6d'),_0x3c1a('0x6e'),_0x3c1a('0x6f'),_0x3c1a('0x70')];if(_0x39734e){_[_0x3c1a('0x71')](_0x39734e['fields'],function(_0x4ea99e){return _0x584c8f[_0x3c1a('0x72')](_0x4ea99e['name'])||!_0x2aee95[_0x3c1a('0x72')](_0x4ea99e[_0x3c1a('0x3c')]);});return{'count':_0x39734e['fields'][_0x3c1a('0x35')],'rows':_['map'](_0x39734e[_0x3c1a('0x34')],function(_0x4aa525){return{'id':_0x4aa525[_0x3c1a('0x27')],'name':_0x4aa525['label'],'custom':_0x4aa525[_0x3c1a('0x73')],'options':_0x4aa525[_0x3c1a('0x74')][_0x3c1a('0x35')]>0x0?_[_0x3c1a('0x2a')](_0x4aa525[_0x3c1a('0x74')],function(_0x5b3f34){return{'name':_0x5b3f34['label'],'value':_0x5b3f34[_0x3c1a('0x75')]};}):_0x4aa525[_0x3c1a('0x3c')]==_0x3c1a('0x6d')?[{'name':_0x3c1a('0x76'),'value':'true'},{'name':'False','value':_0x3c1a('0x77')}]:[]};})};}})[_0x3c1a('0x22')](respondWithResult(_0x2cd160,null))[_0x3c1a('0x42')](function(_0x38c03e){var _0x5814f0=_0xc76208[_0x3c1a('0x30')]['test']?0x1f4:_0x38c03e[_0x3c1a('0x78')]||0x1f4;logger['error'](_0x3c1a('0x79'),_0x3c1a('0x53'),_0x5814f0,JSON[_0x3c1a('0x7a')](_0x38c03e));delete _0x38c03e[_0x3c1a('0x27')];if(_0x5814f0===0x191){_0x5814f0=0x190;}_0x2cd160['status'](_0x5814f0)[_0x3c1a('0x28')](_0xc76208[_0x3c1a('0x30')][_0x3c1a('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x38c03e[_0x3c1a('0x78')]}:_0x38c03e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b7e23ab..c4f19a2 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 _0x6d1c=['path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52c8e8,_0x5ee20d){var _0x31bb1a=function(_0x47233a){while(--_0x47233a){_0x52c8e8['push'](_0x52c8e8['shift']());}};_0x31bb1a(++_0x5ee20d);}(_0x6d1c,0x69));var _0xc6d1=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x6d1c[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var logger=require(_0xc6d1('0x2'))(_0xc6d1('0x3'));var moment=require(_0xc6d1('0x4'));var BPromise=require(_0xc6d1('0x5'));var rp=require(_0xc6d1('0x6'));var fs=require('fs');var path=require(_0xc6d1('0x7'));var rimraf=require('rimraf');var config=require(_0xc6d1('0x8'));var attributes=require(_0xc6d1('0x9'));var integrations=require(_0xc6d1('0xa'));module['exports']=function(_0x1fe5e7,_0x3e23ec){return _0x1fe5e7[_0xc6d1('0xb')](_0xc6d1('0xc'),attributes,{'tableName':_0xc6d1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9634=['bluebird','request-promise','rimraf','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x35d56e,_0x472e50){var _0x184b70=function(_0x508538){while(--_0x508538){_0x35d56e['push'](_0x35d56e['shift']());}};_0x184b70(++_0x472e50);}(_0x9634,0x146));var _0x4963=function(_0x573126,_0x355fd2){_0x573126=_0x573126-0x0;var _0x1a7adc=_0x9634[_0x573126];return _0x1a7adc;};'use strict';var _=require(_0x4963('0x0'));var util=require(_0x4963('0x1'));var logger=require(_0x4963('0x2'))(_0x4963('0x3'));var moment=require('moment');var BPromise=require(_0x4963('0x4'));var rp=require(_0x4963('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4963('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x4963('0x7'));module['exports']=function(_0x55ba97,_0x34e06b){return _0x55ba97[_0x4963('0x8')](_0x4963('0x9'),attributes,{'tableName':_0x4963('0xa'),'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 bcc10e2..38aead7 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 _0x2a69=['rpc','../../config/environment','client','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','info','result','catch','SalesforceAccount','options','raw','where','attributes','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9d498b,_0x53b51e){var _0x1491c4=function(_0x5043f7){while(--_0x5043f7){_0x9d498b['push'](_0x9d498b['shift']());}};_0x1491c4(++_0x53b51e);}(_0x2a69,0x159));var _0x92a6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2a69[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));var moment=require('moment');var BPromise=require(_0x92a6('0x2'));var rs=require(_0x92a6('0x3'));var fs=require('fs');var Redis=require(_0x92a6('0x4'));var db=require(_0x92a6('0x5'))['db'];var utils=require(_0x92a6('0x6'));var logger=require('../../config/logger')(_0x92a6('0x7'));var config=require(_0x92a6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fab53,_0x136f8b,_0x4c9b53){return new BPromise(function(_0x34333c,_0x4d095f){return client['request'](_0x2fab53,_0x4c9b53)[_0x92a6('0xa')](function(_0x463dda){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x136f8b,'request\x20sent');logger[_0x92a6('0xb')](_0x92a6('0xc'),_0x136f8b,'request\x20sent',JSON[_0x92a6('0xd')](_0x463dda));if(_0x463dda[_0x92a6('0xe')]){if(_0x463dda['error'][_0x92a6('0xf')]===0x1f4){logger[_0x92a6('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x136f8b,_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);return _0x4d095f(_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);}logger['error'](_0x92a6('0x11'),_0x136f8b,_0x463dda[_0x92a6('0xe')]['message']);return _0x34333c(_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);}else{logger[_0x92a6('0x12')](_0x92a6('0x11'),_0x136f8b,'request\x20sent');_0x34333c(_0x463dda[_0x92a6('0x13')][_0x92a6('0x10')]);}})[_0x92a6('0x14')](function(_0x3f55f8){logger['error'](_0x92a6('0x11'),_0x136f8b,_0x3f55f8);_0x4d095f(_0x3f55f8);});});}exports['GetSalesforceAccount']=function(_0x22379a){var _0x59bbf9=this;return new Promise(function(_0x523f06,_0x45bcb3){return db[_0x92a6('0x15')]['findAll']({'raw':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')][_0x92a6('0x17')]===undefined?!![]:![]:!![],'where':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')][_0x92a6('0x18')]||null:null,'attributes':_0x22379a['options']?_0x22379a[_0x92a6('0x16')][_0x92a6('0x19')]||null:null,'limit':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')]['limit']||null:null,'include':_0x22379a[_0x92a6('0x16')]?_0x22379a['options'][_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x22379a[_0x92a6('0x16')][_0x92a6('0x1a')],function(_0x5cca2e){return{'model':db[_0x5cca2e[_0x92a6('0x1c')]],'as':_0x5cca2e['as'],'attributes':_0x5cca2e[_0x92a6('0x19')],'include':_0x5cca2e[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x5cca2e['include'],function(_0x4370b9){return{'model':db[_0x4370b9[_0x92a6('0x1c')]],'as':_0x4370b9['as'],'attributes':_0x4370b9[_0x92a6('0x19')],'include':_0x4370b9[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x4370b9['include'],function(_0x3a380e){return{'model':db[_0x3a380e[_0x92a6('0x1c')]],'as':_0x3a380e['as'],'attributes':_0x3a380e[_0x92a6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x92a6('0xa')](function(_0x33c800){logger[_0x92a6('0x12')](_0x92a6('0x1d'),_0x22379a);logger[_0x92a6('0xb')](_0x92a6('0x1d'),_0x22379a,JSON[_0x92a6('0xd')](_0x33c800));_0x523f06(_0x33c800);})[_0x92a6('0x14')](function(_0x488a12){logger[_0x92a6('0xe')](_0x92a6('0x1d'),_0x488a12[_0x92a6('0x10')],_0x22379a);_0x45bcb3(_0x59bbf9[_0x92a6('0xe')](0x1f4,_0x488a12['message']));});});};exports[_0x92a6('0x1e')]=function(_0x402f85){var _0x576a03=this;return new Promise(function(_0x3aabaf,_0x2b7aa5){return db[_0x92a6('0x15')][_0x92a6('0x1f')]({'raw':_0x402f85[_0x92a6('0x16')]?_0x402f85[_0x92a6('0x16')][_0x92a6('0x17')]===undefined?!![]:![]:!![],'where':_0x402f85['options']?_0x402f85[_0x92a6('0x16')][_0x92a6('0x18')]||null:null,'attributes':_0x402f85['options']?_0x402f85[_0x92a6('0x16')][_0x92a6('0x19')]||null:null,'include':_0x402f85[_0x92a6('0x16')]?_0x402f85[_0x92a6('0x16')][_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x402f85[_0x92a6('0x16')]['include'],function(_0x54e2f3){return{'model':db[_0x54e2f3[_0x92a6('0x1c')]],'as':_0x54e2f3['as'],'attributes':_0x54e2f3[_0x92a6('0x19')],'include':_0x54e2f3[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x54e2f3[_0x92a6('0x1a')],function(_0x3be85d){return{'model':db[_0x3be85d[_0x92a6('0x1c')]],'as':_0x3be85d['as'],'attributes':_0x3be85d[_0x92a6('0x19')],'include':_0x3be85d[_0x92a6('0x1a')]?_['map'](_0x3be85d[_0x92a6('0x1a')],function(_0x4c8417){return{'model':db[_0x4c8417[_0x92a6('0x1c')]],'as':_0x4c8417['as'],'attributes':_0x4c8417['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a6('0xa')](function(_0x1c0bcb){logger['info'](_0x92a6('0x1e'),_0x402f85);logger[_0x92a6('0xb')](_0x92a6('0x1e'),_0x402f85,JSON[_0x92a6('0xd')](_0x1c0bcb));_0x3aabaf(_0x1c0bcb);})[_0x92a6('0x14')](function(_0x110313){logger['error']('ShowSalesforceAccount',_0x110313[_0x92a6('0x10')],_0x402f85);_0x2b7aa5(_0x576a03[_0x92a6('0xe')](0x1f4,_0x110313[_0x92a6('0x10')]));});});}; \ No newline at end of file +var _0x9dcf=['request\x20sent','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowSalesforceAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x36e900,_0x4b0279){var _0xeccc59=function(_0x198867){while(--_0x198867){_0x36e900['push'](_0x36e900['shift']());}};_0xeccc59(++_0x4b0279);}(_0x9dcf,0x103));var _0xf9dc=function(_0x61ae1a,_0xfad56){_0x61ae1a=_0x61ae1a-0x0;var _0x2d1c5c=_0x9dcf[_0x61ae1a];return _0x2d1c5c;};'use strict';var _=require(_0xf9dc('0x0'));var util=require(_0xf9dc('0x1'));var moment=require('moment');var BPromise=require(_0xf9dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9dc('0x3'));var db=require(_0xf9dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9dc('0x5'))(_0xf9dc('0x6'));var config=require(_0xf9dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf9dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c5c1,_0x51eb74,_0x45d993){return new BPromise(function(_0x1c3302,_0x57065f){return client[_0xf9dc('0x9')](_0x24c5c1,_0x45d993)[_0xf9dc('0xa')](function(_0x39a980){logger[_0xf9dc('0xb')](_0xf9dc('0xc'),_0x51eb74,_0xf9dc('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x51eb74,'request\x20sent',JSON[_0xf9dc('0xe')](_0x39a980));if(_0x39a980[_0xf9dc('0xf')]){if(_0x39a980[_0xf9dc('0xf')][_0xf9dc('0x10')]===0x1f4){logger[_0xf9dc('0xf')](_0xf9dc('0xc'),_0x51eb74,_0x39a980[_0xf9dc('0xf')][_0xf9dc('0x11')]);return _0x57065f(_0x39a980['error']['message']);}logger[_0xf9dc('0xf')](_0xf9dc('0xc'),_0x51eb74,_0x39a980[_0xf9dc('0xf')][_0xf9dc('0x11')]);return _0x1c3302(_0x39a980[_0xf9dc('0xf')][_0xf9dc('0x11')]);}else{logger[_0xf9dc('0xb')](_0xf9dc('0xc'),_0x51eb74,_0xf9dc('0xd'));_0x1c3302(_0x39a980[_0xf9dc('0x12')][_0xf9dc('0x11')]);}})['catch'](function(_0x3ebcfd){logger[_0xf9dc('0xf')](_0xf9dc('0xc'),_0x51eb74,_0x3ebcfd);_0x57065f(_0x3ebcfd);});});}exports[_0xf9dc('0x13')]=function(_0x5d3dc8){var _0x878b6a=this;return new Promise(function(_0x5181bd,_0x3702f7){return db[_0xf9dc('0x14')][_0xf9dc('0x15')]({'raw':_0x5d3dc8['options']?_0x5d3dc8[_0xf9dc('0x16')][_0xf9dc('0x17')]===undefined?!![]:![]:!![],'where':_0x5d3dc8[_0xf9dc('0x16')]?_0x5d3dc8[_0xf9dc('0x16')][_0xf9dc('0x18')]||null:null,'attributes':_0x5d3dc8[_0xf9dc('0x16')]?_0x5d3dc8[_0xf9dc('0x16')][_0xf9dc('0x19')]||null:null,'limit':_0x5d3dc8[_0xf9dc('0x16')]?_0x5d3dc8[_0xf9dc('0x16')][_0xf9dc('0x1a')]||null:null,'include':_0x5d3dc8[_0xf9dc('0x16')]?_0x5d3dc8[_0xf9dc('0x16')][_0xf9dc('0x1b')]?_[_0xf9dc('0x1c')](_0x5d3dc8['options'][_0xf9dc('0x1b')],function(_0x41b812){return{'model':db[_0x41b812[_0xf9dc('0x1d')]],'as':_0x41b812['as'],'attributes':_0x41b812[_0xf9dc('0x19')],'include':_0x41b812[_0xf9dc('0x1b')]?_[_0xf9dc('0x1c')](_0x41b812[_0xf9dc('0x1b')],function(_0x29159f){return{'model':db[_0x29159f[_0xf9dc('0x1d')]],'as':_0x29159f['as'],'attributes':_0x29159f[_0xf9dc('0x19')],'include':_0x29159f[_0xf9dc('0x1b')]?_['map'](_0x29159f['include'],function(_0x232d80){return{'model':db[_0x232d80[_0xf9dc('0x1d')]],'as':_0x232d80['as'],'attributes':_0x232d80['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9dc('0xa')](function(_0x1cd0ff){logger['info'](_0xf9dc('0x13'),_0x5d3dc8);logger[_0xf9dc('0x1e')]('GetSalesforceAccount',_0x5d3dc8,JSON['stringify'](_0x1cd0ff));_0x5181bd(_0x1cd0ff);})[_0xf9dc('0x1f')](function(_0x32b1ff){logger[_0xf9dc('0xf')]('GetSalesforceAccount',_0x32b1ff[_0xf9dc('0x11')],_0x5d3dc8);_0x3702f7(_0x878b6a['error'](0x1f4,_0x32b1ff[_0xf9dc('0x11')]));});});};exports[_0xf9dc('0x20')]=function(_0x11ee64){var _0x374b79=this;return new Promise(function(_0x41a980,_0x3e3a6c){return db['SalesforceAccount'][_0xf9dc('0x21')]({'raw':_0x11ee64[_0xf9dc('0x16')]?_0x11ee64['options'][_0xf9dc('0x17')]===undefined?!![]:![]:!![],'where':_0x11ee64['options']?_0x11ee64[_0xf9dc('0x16')]['where']||null:null,'attributes':_0x11ee64[_0xf9dc('0x16')]?_0x11ee64[_0xf9dc('0x16')][_0xf9dc('0x19')]||null:null,'include':_0x11ee64[_0xf9dc('0x16')]?_0x11ee64[_0xf9dc('0x16')][_0xf9dc('0x1b')]?_[_0xf9dc('0x1c')](_0x11ee64[_0xf9dc('0x16')][_0xf9dc('0x1b')],function(_0x2fc2ed){return{'model':db[_0x2fc2ed[_0xf9dc('0x1d')]],'as':_0x2fc2ed['as'],'attributes':_0x2fc2ed[_0xf9dc('0x19')],'include':_0x2fc2ed[_0xf9dc('0x1b')]?_[_0xf9dc('0x1c')](_0x2fc2ed[_0xf9dc('0x1b')],function(_0x257146){return{'model':db[_0x257146[_0xf9dc('0x1d')]],'as':_0x257146['as'],'attributes':_0x257146['attributes'],'include':_0x257146[_0xf9dc('0x1b')]?_[_0xf9dc('0x1c')](_0x257146[_0xf9dc('0x1b')],function(_0xa00e9d){return{'model':db[_0xa00e9d['model']],'as':_0xa00e9d['as'],'attributes':_0xa00e9d[_0xf9dc('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x172555){logger['info'](_0xf9dc('0x20'),_0x11ee64);logger[_0xf9dc('0x1e')](_0xf9dc('0x20'),_0x11ee64,JSON[_0xf9dc('0xe')](_0x172555));_0x41a980(_0x172555);})[_0xf9dc('0x1f')](function(_0x13a5e1){logger[_0xf9dc('0xf')](_0xf9dc('0x20'),_0x13a5e1[_0xf9dc('0x11')],_0x11ee64);_0x3e3a6c(_0x374b79['error'](0x1f4,_0x13a5e1[_0xf9dc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c985bce..6187506 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x0b0e,0x187));var _0xe0b0=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x0b0e[_0x200827];return _0x120047;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _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(_0x61795b,_0x5e6b6b){var _0x439d28=function(_0x56eab8){while(--_0x56eab8){_0x61795b['push'](_0x61795b['shift']());}};_0x439d28(++_0x5e6b6b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35c9a8,_0x108572){_0x35c9a8=_0x35c9a8-0x0;var _0x2c1a97=_0x5f2f[_0x35c9a8];return _0x2c1a97;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3fcedd7..f9ba859 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 _0x3306=['exports','STRING','Task','Case','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize'];(function(_0x214742,_0x51809d){var _0x54a1a4=function(_0x4cf9df){while(--_0x4cf9df){_0x214742['push'](_0x214742['shift']());}};_0x54a1a4(++_0x51809d);}(_0x3306,0x107));var _0x6330=function(_0x204ff4,_0xc30c0b){_0x204ff4=_0x204ff4-0x0;var _0x43b104=_0x3306[_0x204ff4];return _0x43b104;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'name':{'type':Sequelize[_0x6330('0x2')]},'description':{'type':Sequelize[_0x6330('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6330('0x3'),_0x6330('0x4')),'defaultValue':_0x6330('0x3')},'moduleSearch':{'type':Sequelize[_0x6330('0x5')](_0x6330('0x6'),'contact',_0x6330('0x7'),_0x6330('0x8'),_0x6330('0x9')),'defaultValue':_0x6330('0x6')},'moduleCreate':{'type':Sequelize[_0x6330('0x5')](_0x6330('0xa'),_0x6330('0xb'),_0x6330('0x7'),_0x6330('0x9')),'defaultValue':_0x6330('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x6330('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file +var _0x14d1=['Case','Task','contact_lead','lead','account_contact_lead','account','nothing','contact','exports','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14d1,0xc3));var _0x114d=function(_0x4aa068,_0x4ce810){_0x4aa068=_0x4aa068-0x0;var _0x3b5c52=_0x14d1[_0x4aa068];return _0x3b5c52;};'use strict';var Sequelize=require('sequelize');module[_0x114d('0x0')]={'name':{'type':Sequelize[_0x114d('0x1')]},'description':{'type':Sequelize[_0x114d('0x1')]},'ticketType':{'type':Sequelize[_0x114d('0x2')]('Task',_0x114d('0x3')),'defaultValue':_0x114d('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x114d('0x5'),'contact',_0x114d('0x6'),_0x114d('0x7'),_0x114d('0x8')),'defaultValue':_0x114d('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x114d('0x9'),_0x114d('0xa'),_0x114d('0x6'),_0x114d('0x8')),'defaultValue':_0x114d('0x6')},'leadId':{'type':Sequelize[_0x114d('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x114d('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x114d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5ce7720..eca014c 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 _0x6395=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','params','model','keys','create','body','find','getFields','findOne','SalesforceField','getSubjects','nolimit','getDescriptions','options','eml-format','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/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','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','filters'];(function(_0x1c6d74,_0x120249){var _0x4a8549=function(_0x419569){while(--_0x419569){_0x1c6d74['push'](_0x1c6d74['shift']());}};_0x4a8549(++_0x120249);}(_0x6395,0xc8));var _0x5639=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6395[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x5639('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5639('0x1'));var jsonpatch=require(_0x5639('0x2'));var rp=require(_0x5639('0x3'));var moment=require(_0x5639('0x4'));var BPromise=require(_0x5639('0x5'));var Mustache=require(_0x5639('0x6'));var util=require(_0x5639('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5639('0x8'));var ejs=require(_0x5639('0x9'));var fs=require('fs');var fs_extra=require(_0x5639('0xa'));var _=require(_0x5639('0xb'));var squel=require(_0x5639('0xc'));var crypto=require(_0x5639('0xd'));var jsforce=require(_0x5639('0xe'));var deskjs=require(_0x5639('0xf'));var toCsv=require(_0x5639('0x8'));var querystring=require(_0x5639('0x10'));var Papa=require(_0x5639('0x11'));var Redis=require(_0x5639('0x12'));var authService=require(_0x5639('0x13'));var qs=require(_0x5639('0x14'));var as=require(_0x5639('0x15'));var hardwareService=require(_0x5639('0x16'));var logger=require(_0x5639('0x17'))(_0x5639('0x18'));var utils=require(_0x5639('0x19'));var config=require(_0x5639('0x1a'));var licenseUtil=require(_0x5639('0x1b'));var db=require(_0x5639('0x1c'))['db'];function respondWithStatusCode(_0x683fab,_0x564f54){_0x564f54=_0x564f54||0xcc;return function(_0x45abcb){if(_0x45abcb){return _0x683fab['sendStatus'](_0x564f54);}return _0x683fab[_0x5639('0x1d')](_0x564f54)[_0x5639('0x1e')]();};}function respondWithResult(_0x5f3a8e,_0x37eb30){_0x37eb30=_0x37eb30||0xc8;return function(_0x13ee03){if(_0x13ee03){return _0x5f3a8e[_0x5639('0x1d')](_0x37eb30)[_0x5639('0x1f')](_0x13ee03);}};}function respondWithFilteredResult(_0x46207c,_0x41c1d6){return function(_0x16ffee){if(_0x16ffee){var _0x31be22=typeof _0x41c1d6[_0x5639('0x20')]===_0x5639('0x21')&&typeof _0x41c1d6[_0x5639('0x22')]==='undefined';var _0x1d6eae=_0x16ffee[_0x5639('0x23')];var _0x4efbbb=_0x31be22?0x0:_0x41c1d6[_0x5639('0x20')];var _0x35ef4e=_0x31be22?_0x16ffee[_0x5639('0x23')]:_0x41c1d6[_0x5639('0x20')]+_0x41c1d6['limit'];var _0x3d7e4d;if(_0x35ef4e>=_0x1d6eae){_0x35ef4e=_0x1d6eae;_0x3d7e4d=0xc8;}else{_0x3d7e4d=0xce;}_0x46207c[_0x5639('0x1d')](_0x3d7e4d);return _0x46207c['set'](_0x5639('0x24'),_0x4efbbb+'-'+_0x35ef4e+'/'+_0x1d6eae)[_0x5639('0x1f')](_0x16ffee);}return null;};}function patchUpdates(_0x1aae1a){return function(_0x540e4e){try{jsonpatch['apply'](_0x540e4e,_0x1aae1a,!![]);}catch(_0x4c8ea3){return BPromise[_0x5639('0x25')](_0x4c8ea3);}return _0x540e4e[_0x5639('0x26')]();};}function saveUpdates(_0x1de018,_0x39d553){return function(_0x195e4b){if(_0x195e4b){return _0x195e4b[_0x5639('0x27')](_0x1de018)[_0x5639('0x28')](function(_0x35000d){return _0x35000d;});}return null;};}function removeEntity(_0x2fc680,_0x1f66b4){return function(_0x40c6ec){if(_0x40c6ec){return _0x40c6ec[_0x5639('0x29')]()['then'](function(){_0x2fc680[_0x5639('0x1d')](0xcc)[_0x5639('0x1e')]();});}};}function handleEntityNotFound(_0x5a69c4,_0x4d7b1d){return function(_0x46f19b){if(!_0x46f19b){_0x5a69c4[_0x5639('0x2a')](0x194);}return _0x46f19b;};}function handleError(_0x1551c4,_0x38c4e9){_0x38c4e9=_0x38c4e9||0x1f4;return function(_0x4bf48c){logger[_0x5639('0x2b')](_0x4bf48c[_0x5639('0x2c')]);if(_0x4bf48c[_0x5639('0x2d')]){delete _0x4bf48c['name'];}_0x1551c4[_0x5639('0x1d')](_0x38c4e9)[_0x5639('0x2e')](_0x4bf48c);};}exports[_0x5639('0x2f')]=function(_0x43013c,_0x427352){var _0x136527={},_0x2654a8={},_0x5f0bdd={'count':0x0,'rows':[]};var _0x53d63f=_[_0x5639('0x30')](db[_0x5639('0x31')][_0x5639('0x32')],function(_0x3c57ac){return{'name':_0x3c57ac[_0x5639('0x33')],'type':_0x3c57ac['type'][_0x5639('0x34')]};});_0x2654a8['model']=_[_0x5639('0x30')](_0x53d63f,_0x5639('0x2d'));_0x2654a8['query']=_['keys'](_0x43013c[_0x5639('0x35')]);_0x2654a8[_0x5639('0x36')]=_['intersection'](_0x2654a8['model'],_0x2654a8['query']);_0x136527['attributes']=_[_0x5639('0x37')](_0x2654a8['model'],qs[_0x5639('0x38')](_0x43013c[_0x5639('0x35')][_0x5639('0x38')]));_0x136527[_0x5639('0x39')]=_0x136527[_0x5639('0x39')][_0x5639('0x3a')]?_0x136527[_0x5639('0x39')]:_0x2654a8['model'];if(!_0x43013c[_0x5639('0x35')][_0x5639('0x3b')]('nolimit')){_0x136527[_0x5639('0x22')]=qs[_0x5639('0x22')](_0x43013c[_0x5639('0x35')][_0x5639('0x22')]);_0x136527['offset']=qs[_0x5639('0x20')](_0x43013c[_0x5639('0x35')]['offset']);}_0x136527[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x43013c[_0x5639('0x35')]['sort']);_0x136527[_0x5639('0x3e')]=qs['filters'](_[_0x5639('0x3f')](_0x43013c[_0x5639('0x35')],_0x2654a8[_0x5639('0x36')]),_0x53d63f);if(_0x43013c[_0x5639('0x35')][_0x5639('0x40')]){_0x136527['where']=_[_0x5639('0x41')](_0x136527[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x53d63f,function(_0x5542e7){if(_0x5542e7[_0x5639('0x42')]!=='VIRTUAL'){var _0x478717={};_0x478717[_0x5542e7[_0x5639('0x2d')]]={'$like':'%'+_0x43013c[_0x5639('0x35')][_0x5639('0x40')]+'%'};return _0x478717;}})});}_0x136527=_[_0x5639('0x41')]({},_0x136527,_0x43013c['options']);var _0x455650={'where':_0x136527[_0x5639('0x3e')]};return db['SalesforceConfiguration'][_0x5639('0x23')](_0x455650)['then'](function(_0x2d6213){_0x5f0bdd[_0x5639('0x23')]=_0x2d6213;if(_0x43013c[_0x5639('0x35')][_0x5639('0x43')]){_0x136527[_0x5639('0x44')]=[{'all':!![]}];}return db[_0x5639('0x31')][_0x5639('0x45')](_0x136527);})['then'](function(_0x338a54){_0x5f0bdd[_0x5639('0x46')]=_0x338a54;return _0x5f0bdd;})[_0x5639('0x28')](respondWithFilteredResult(_0x427352,_0x136527))[_0x5639('0x47')](handleError(_0x427352,null));};exports['show']=function(_0x22b4ac,_0x30b003){var _0x455180={'raw':![],'where':{'id':_0x22b4ac[_0x5639('0x48')]['id']}},_0x4c2c1d={};_0x4c2c1d[_0x5639('0x49')]=_[_0x5639('0x4a')](db[_0x5639('0x31')][_0x5639('0x32')]);_0x4c2c1d[_0x5639('0x35')]=_['keys'](_0x22b4ac[_0x5639('0x35')]);_0x4c2c1d[_0x5639('0x36')]=_[_0x5639('0x37')](_0x4c2c1d[_0x5639('0x49')],_0x4c2c1d[_0x5639('0x35')]);_0x455180[_0x5639('0x39')]=_['intersection'](_0x4c2c1d['model'],qs[_0x5639('0x38')](_0x22b4ac['query'][_0x5639('0x38')]));_0x455180['attributes']=_0x455180[_0x5639('0x39')]['length']?_0x455180[_0x5639('0x39')]:_0x4c2c1d[_0x5639('0x49')];if(_0x22b4ac[_0x5639('0x35')][_0x5639('0x43')]){_0x455180[_0x5639('0x44')]=[{'all':!![]}];}_0x455180=_['merge']({},_0x455180,_0x22b4ac['options']);return db['SalesforceConfiguration']['find'](_0x455180)[_0x5639('0x28')](handleEntityNotFound(_0x30b003,null))[_0x5639('0x28')](respondWithResult(_0x30b003,null))[_0x5639('0x47')](handleError(_0x30b003,null));};exports[_0x5639('0x4b')]=function(_0x5d6cb8,_0x2140f5){return db[_0x5639('0x31')][_0x5639('0x4b')](_0x5d6cb8[_0x5639('0x4c')],{})[_0x5639('0x28')](respondWithResult(_0x2140f5,0xc9))[_0x5639('0x47')](handleError(_0x2140f5,null));};exports[_0x5639('0x27')]=function(_0x13760c,_0xc310da){if(_0x13760c[_0x5639('0x4c')]['id']){delete _0x13760c[_0x5639('0x4c')]['id'];}return db[_0x5639('0x31')][_0x5639('0x4d')]({'where':{'id':_0x13760c[_0x5639('0x48')]['id']}})[_0x5639('0x28')](handleEntityNotFound(_0xc310da,null))[_0x5639('0x28')](saveUpdates(_0x13760c[_0x5639('0x4c')],null))['then'](respondWithResult(_0xc310da,null))[_0x5639('0x47')](handleError(_0xc310da,null));};exports[_0x5639('0x29')]=function(_0x39d156,_0xd29fdf){return db[_0x5639('0x31')][_0x5639('0x4d')]({'where':{'id':_0x39d156['params']['id']}})['then'](handleEntityNotFound(_0xd29fdf,null))['then'](removeEntity(_0xd29fdf,null))[_0x5639('0x47')](handleError(_0xd29fdf,null));};exports[_0x5639('0x4e')]=function(_0x544e12,_0x2e6a12,_0x199283){var _0x4016f6={};var _0x4c01fd={};var _0x31a579;var _0x1a1297;return db[_0x5639('0x31')][_0x5639('0x4f')]({'where':{'id':_0x544e12['params']['id']}})[_0x5639('0x28')](handleEntityNotFound(_0x2e6a12,null))[_0x5639('0x28')](function(_0x1b7720){if(_0x1b7720){_0x31a579=_0x1b7720;_0x4c01fd[_0x5639('0x49')]=_[_0x5639('0x4a')](db['SalesforceField'][_0x5639('0x32')]);_0x4c01fd['query']=_[_0x5639('0x4a')](_0x544e12[_0x5639('0x35')]);_0x4c01fd[_0x5639('0x36')]=_['intersection'](_0x4c01fd['model'],_0x4c01fd['query']);_0x4016f6[_0x5639('0x39')]=_[_0x5639('0x37')](_0x4c01fd[_0x5639('0x49')],qs[_0x5639('0x38')](_0x544e12[_0x5639('0x35')][_0x5639('0x38')]));_0x4016f6[_0x5639('0x39')]=_0x4016f6[_0x5639('0x39')][_0x5639('0x3a')]?_0x4016f6[_0x5639('0x39')]:_0x4c01fd[_0x5639('0x49')];_0x4016f6['order']=qs['sort'](_0x544e12['query'][_0x5639('0x3d')]);_0x4016f6[_0x5639('0x3e')]=qs[_0x5639('0x36')](_[_0x5639('0x3f')](_0x544e12[_0x5639('0x35')],_0x4c01fd[_0x5639('0x36')]));if(_0x544e12['query'][_0x5639('0x40')]){_0x4016f6['where']=_[_0x5639('0x41')](_0x4016f6[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x4016f6['attributes'],function(_0xba91ae){var _0x3d2ed4={};_0x3d2ed4[_0xba91ae]={'$like':'%'+_0x544e12[_0x5639('0x35')][_0x5639('0x40')]+'%'};return _0x3d2ed4;})});}_0x4016f6=_[_0x5639('0x41')]({},_0x4016f6,_0x544e12['options']);return _0x31a579[_0x5639('0x4e')](_0x4016f6);}})['then'](function(_0x371dfc){if(_0x371dfc){_0x1a1297=_0x371dfc[_0x5639('0x3a')];if(!_0x544e12['query'][_0x5639('0x3b')]('nolimit')){_0x4016f6[_0x5639('0x22')]=qs['limit'](_0x544e12[_0x5639('0x35')][_0x5639('0x22')]);_0x4016f6[_0x5639('0x20')]=qs['offset'](_0x544e12[_0x5639('0x35')]['offset']);}return _0x31a579[_0x5639('0x4e')](_0x4016f6);}})['then'](function(_0x473192){if(_0x473192){return _0x473192?{'count':_0x1a1297,'rows':_0x473192}:null;}})[_0x5639('0x28')](respondWithResult(_0x2e6a12,null))[_0x5639('0x47')](handleError(_0x2e6a12,null));};exports['getSubjects']=function(_0x13bd17,_0x3e5d79,_0x2dbb92){var _0x281751={};var _0x2ded87={};var _0x4ccf85;var _0x5c4c74;return db[_0x5639('0x31')]['findOne']({'where':{'id':_0x13bd17[_0x5639('0x48')]['id']}})[_0x5639('0x28')](handleEntityNotFound(_0x3e5d79,null))[_0x5639('0x28')](function(_0x25ed55){if(_0x25ed55){_0x4ccf85=_0x25ed55;_0x2ded87['model']=_[_0x5639('0x4a')](db[_0x5639('0x50')][_0x5639('0x32')]);_0x2ded87[_0x5639('0x35')]=_['keys'](_0x13bd17['query']);_0x2ded87[_0x5639('0x36')]=_[_0x5639('0x37')](_0x2ded87[_0x5639('0x49')],_0x2ded87['query']);_0x281751[_0x5639('0x39')]=_['intersection'](_0x2ded87[_0x5639('0x49')],qs[_0x5639('0x38')](_0x13bd17[_0x5639('0x35')][_0x5639('0x38')]));_0x281751[_0x5639('0x39')]=_0x281751[_0x5639('0x39')][_0x5639('0x3a')]?_0x281751['attributes']:_0x2ded87['model'];_0x281751[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x13bd17[_0x5639('0x35')][_0x5639('0x3d')]);_0x281751['where']=qs[_0x5639('0x36')](_['pick'](_0x13bd17['query'],_0x2ded87['filters']));if(_0x13bd17['query'][_0x5639('0x40')]){_0x281751[_0x5639('0x3e')]=_[_0x5639('0x41')](_0x281751[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x281751[_0x5639('0x39')],function(_0x37d866){var _0x22f952={};_0x22f952[_0x37d866]={'$like':'%'+_0x13bd17[_0x5639('0x35')]['filter']+'%'};return _0x22f952;})});}_0x281751=_[_0x5639('0x41')]({},_0x281751,_0x13bd17['options']);return _0x4ccf85[_0x5639('0x51')](_0x281751);}})[_0x5639('0x28')](function(_0x422323){if(_0x422323){_0x5c4c74=_0x422323[_0x5639('0x3a')];if(!_0x13bd17[_0x5639('0x35')][_0x5639('0x3b')](_0x5639('0x52'))){_0x281751['limit']=qs[_0x5639('0x22')](_0x13bd17[_0x5639('0x35')][_0x5639('0x22')]);_0x281751[_0x5639('0x20')]=qs[_0x5639('0x20')](_0x13bd17[_0x5639('0x35')][_0x5639('0x20')]);}return _0x4ccf85['getSubjects'](_0x281751);}})[_0x5639('0x28')](function(_0x39a706){if(_0x39a706){return _0x39a706?{'count':_0x5c4c74,'rows':_0x39a706}:null;}})[_0x5639('0x28')](respondWithResult(_0x3e5d79,null))[_0x5639('0x47')](handleError(_0x3e5d79,null));};exports[_0x5639('0x53')]=function(_0x31367e,_0x558272,_0x5e5f67){var _0x998596={};var _0xb6cbd1={};var _0x37168b;var _0x40f7c0;return db['SalesforceConfiguration'][_0x5639('0x4f')]({'where':{'id':_0x31367e[_0x5639('0x48')]['id']}})['then'](handleEntityNotFound(_0x558272,null))[_0x5639('0x28')](function(_0x567e12){if(_0x567e12){_0x37168b=_0x567e12;_0xb6cbd1[_0x5639('0x49')]=_[_0x5639('0x4a')](db[_0x5639('0x50')][_0x5639('0x32')]);_0xb6cbd1['query']=_[_0x5639('0x4a')](_0x31367e[_0x5639('0x35')]);_0xb6cbd1[_0x5639('0x36')]=_[_0x5639('0x37')](_0xb6cbd1[_0x5639('0x49')],_0xb6cbd1[_0x5639('0x35')]);_0x998596['attributes']=_[_0x5639('0x37')](_0xb6cbd1[_0x5639('0x49')],qs[_0x5639('0x38')](_0x31367e[_0x5639('0x35')][_0x5639('0x38')]));_0x998596['attributes']=_0x998596['attributes'][_0x5639('0x3a')]?_0x998596[_0x5639('0x39')]:_0xb6cbd1[_0x5639('0x49')];_0x998596[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x31367e[_0x5639('0x35')]['sort']);_0x998596[_0x5639('0x3e')]=qs[_0x5639('0x36')](_[_0x5639('0x3f')](_0x31367e['query'],_0xb6cbd1['filters']));if(_0x31367e['query']['filter']){_0x998596[_0x5639('0x3e')]=_[_0x5639('0x41')](_0x998596[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x998596[_0x5639('0x39')],function(_0x21fe09){var _0x2613a8={};_0x2613a8[_0x21fe09]={'$like':'%'+_0x31367e['query'][_0x5639('0x40')]+'%'};return _0x2613a8;})});}_0x998596=_[_0x5639('0x41')]({},_0x998596,_0x31367e[_0x5639('0x54')]);return _0x37168b[_0x5639('0x53')](_0x998596);}})[_0x5639('0x28')](function(_0x563b60){if(_0x563b60){_0x40f7c0=_0x563b60[_0x5639('0x3a')];if(!_0x31367e['query'][_0x5639('0x3b')](_0x5639('0x52'))){_0x998596[_0x5639('0x22')]=qs[_0x5639('0x22')](_0x31367e[_0x5639('0x35')]['limit']);_0x998596['offset']=qs[_0x5639('0x20')](_0x31367e[_0x5639('0x35')][_0x5639('0x20')]);}return _0x37168b['getDescriptions'](_0x998596);}})[_0x5639('0x28')](function(_0x155abe){if(_0x155abe){return _0x155abe?{'count':_0x40f7c0,'rows':_0x155abe}:null;}})[_0x5639('0x28')](respondWithResult(_0x558272,null))[_0x5639('0x47')](handleError(_0x558272,null));}; \ No newline at end of file +var _0x2070=['filter','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','pick','getSubjects','order','nolimit','SalesforceField','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','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','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x250d0d,_0x1186f0){var _0x258dcf=function(_0x2f2e37){while(--_0x2f2e37){_0x250d0d['push'](_0x250d0d['shift']());}};_0x258dcf(++_0x1186f0);}(_0x2070,0x1a2));var _0x0207=function(_0x444adf,_0x8bfe5){_0x444adf=_0x444adf-0x0;var _0x1f8161=_0x2070[_0x444adf];return _0x1f8161;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0207('0x0'));var jsonpatch=require(_0x0207('0x1'));var rp=require(_0x0207('0x2'));var moment=require('moment');var BPromise=require(_0x0207('0x3'));var Mustache=require(_0x0207('0x4'));var util=require('util');var path=require(_0x0207('0x5'));var sox=require(_0x0207('0x6'));var csv=require('to-csv');var ejs=require(_0x0207('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0207('0x8'));var crypto=require(_0x0207('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0207('0xa'));var toCsv=require(_0x0207('0xb'));var querystring=require('querystring');var Papa=require(_0x0207('0xc'));var Redis=require(_0x0207('0xd'));var authService=require(_0x0207('0xe'));var qs=require(_0x0207('0xf'));var as=require(_0x0207('0x10'));var hardwareService=require(_0x0207('0x11'));var logger=require(_0x0207('0x12'))(_0x0207('0x13'));var utils=require(_0x0207('0x14'));var config=require(_0x0207('0x15'));var licenseUtil=require(_0x0207('0x16'));var db=require(_0x0207('0x17'))['db'];function respondWithStatusCode(_0x22be26,_0x7c84b){_0x7c84b=_0x7c84b||0xcc;return function(_0x5bb744){if(_0x5bb744){return _0x22be26[_0x0207('0x18')](_0x7c84b);}return _0x22be26['status'](_0x7c84b)[_0x0207('0x19')]();};}function respondWithResult(_0x3bd0c4,_0x3ffc3a){_0x3ffc3a=_0x3ffc3a||0xc8;return function(_0x1748a1){if(_0x1748a1){return _0x3bd0c4[_0x0207('0x1a')](_0x3ffc3a)['json'](_0x1748a1);}};}function respondWithFilteredResult(_0x3cb346,_0x1cbefd){return function(_0x5e8d17){if(_0x5e8d17){var _0x2bb662=typeof _0x1cbefd[_0x0207('0x1b')]===_0x0207('0x1c')&&typeof _0x1cbefd[_0x0207('0x1d')]==='undefined';var _0x1bdc25=_0x5e8d17[_0x0207('0x1e')];var _0x171122=_0x2bb662?0x0:_0x1cbefd[_0x0207('0x1b')];var _0x45bb5d=_0x2bb662?_0x5e8d17[_0x0207('0x1e')]:_0x1cbefd[_0x0207('0x1b')]+_0x1cbefd[_0x0207('0x1d')];var _0x4255bb;if(_0x45bb5d>=_0x1bdc25){_0x45bb5d=_0x1bdc25;_0x4255bb=0xc8;}else{_0x4255bb=0xce;}_0x3cb346[_0x0207('0x1a')](_0x4255bb);return _0x3cb346[_0x0207('0x1f')](_0x0207('0x20'),_0x171122+'-'+_0x45bb5d+'/'+_0x1bdc25)[_0x0207('0x21')](_0x5e8d17);}return null;};}function patchUpdates(_0xfc201){return function(_0x3474f3){try{jsonpatch['apply'](_0x3474f3,_0xfc201,!![]);}catch(_0x2c8567){return BPromise['reject'](_0x2c8567);}return _0x3474f3[_0x0207('0x22')]();};}function saveUpdates(_0x1421e7,_0x37c050){return function(_0x56a158){if(_0x56a158){return _0x56a158[_0x0207('0x23')](_0x1421e7)[_0x0207('0x24')](function(_0x5cd2bc){return _0x5cd2bc;});}return null;};}function removeEntity(_0x16bf24,_0x11bb0f){return function(_0x40224d){if(_0x40224d){return _0x40224d[_0x0207('0x25')]()[_0x0207('0x24')](function(){_0x16bf24['status'](0xcc)[_0x0207('0x19')]();});}};}function handleEntityNotFound(_0x4089f1,_0x4a0b93){return function(_0x94e0e1){if(!_0x94e0e1){_0x4089f1['sendStatus'](0x194);}return _0x94e0e1;};}function handleError(_0x3ae0af,_0x3cfd1b){_0x3cfd1b=_0x3cfd1b||0x1f4;return function(_0x2e496f){logger['error'](_0x2e496f[_0x0207('0x26')]);if(_0x2e496f[_0x0207('0x27')]){delete _0x2e496f[_0x0207('0x27')];}_0x3ae0af[_0x0207('0x1a')](_0x3cfd1b)[_0x0207('0x28')](_0x2e496f);};}exports['index']=function(_0x33b7dc,_0x527cdb){var _0x3a7dbd={},_0x873259={},_0x435e79={'count':0x0,'rows':[]};var _0x4e5e7b=_[_0x0207('0x29')](db['SalesforceConfiguration']['rawAttributes'],function(_0x9cd617){return{'name':_0x9cd617[_0x0207('0x2a')],'type':_0x9cd617[_0x0207('0x2b')][_0x0207('0x2c')]};});_0x873259[_0x0207('0x2d')]=_['map'](_0x4e5e7b,_0x0207('0x27'));_0x873259[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x33b7dc[_0x0207('0x2e')]);_0x873259['filters']=_[_0x0207('0x30')](_0x873259[_0x0207('0x2d')],_0x873259[_0x0207('0x2e')]);_0x3a7dbd[_0x0207('0x31')]=_[_0x0207('0x30')](_0x873259[_0x0207('0x2d')],qs['fields'](_0x33b7dc['query'][_0x0207('0x32')]));_0x3a7dbd['attributes']=_0x3a7dbd[_0x0207('0x31')][_0x0207('0x33')]?_0x3a7dbd[_0x0207('0x31')]:_0x873259[_0x0207('0x2d')];if(!_0x33b7dc['query'][_0x0207('0x34')]('nolimit')){_0x3a7dbd['limit']=qs[_0x0207('0x1d')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x1d')]);_0x3a7dbd[_0x0207('0x1b')]=qs[_0x0207('0x1b')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x1b')]);}_0x3a7dbd['order']=qs[_0x0207('0x35')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x35')]);_0x3a7dbd[_0x0207('0x36')]=qs['filters'](_['pick'](_0x33b7dc['query'],_0x873259[_0x0207('0x37')]),_0x4e5e7b);if(_0x33b7dc[_0x0207('0x2e')][_0x0207('0x38')]){_0x3a7dbd[_0x0207('0x36')]=_['merge'](_0x3a7dbd[_0x0207('0x36')],{'$or':_[_0x0207('0x29')](_0x4e5e7b,function(_0x21c9a1){if(_0x21c9a1[_0x0207('0x2b')]!=='VIRTUAL'){var _0x59aaae={};_0x59aaae[_0x21c9a1[_0x0207('0x27')]]={'$like':'%'+_0x33b7dc['query']['filter']+'%'};return _0x59aaae;}})});}_0x3a7dbd=_[_0x0207('0x39')]({},_0x3a7dbd,_0x33b7dc[_0x0207('0x3a')]);var _0x360052={'where':_0x3a7dbd['where']};return db[_0x0207('0x3b')][_0x0207('0x1e')](_0x360052)[_0x0207('0x24')](function(_0x9527d7){_0x435e79['count']=_0x9527d7;if(_0x33b7dc[_0x0207('0x2e')][_0x0207('0x3c')]){_0x3a7dbd[_0x0207('0x3d')]=[{'all':!![]}];}return db[_0x0207('0x3b')][_0x0207('0x3e')](_0x3a7dbd);})['then'](function(_0x3dc87d){_0x435e79[_0x0207('0x3f')]=_0x3dc87d;return _0x435e79;})[_0x0207('0x24')](respondWithFilteredResult(_0x527cdb,_0x3a7dbd))[_0x0207('0x40')](handleError(_0x527cdb,null));};exports[_0x0207('0x41')]=function(_0x5a532b,_0x121e5c){var _0x151bfa={'raw':![],'where':{'id':_0x5a532b[_0x0207('0x42')]['id']}},_0x4cce6a={};_0x4cce6a[_0x0207('0x2d')]=_[_0x0207('0x2f')](db[_0x0207('0x3b')][_0x0207('0x43')]);_0x4cce6a[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x5a532b[_0x0207('0x2e')]);_0x4cce6a[_0x0207('0x37')]=_[_0x0207('0x30')](_0x4cce6a[_0x0207('0x2d')],_0x4cce6a[_0x0207('0x2e')]);_0x151bfa[_0x0207('0x31')]=_['intersection'](_0x4cce6a[_0x0207('0x2d')],qs[_0x0207('0x32')](_0x5a532b[_0x0207('0x2e')][_0x0207('0x32')]));_0x151bfa['attributes']=_0x151bfa['attributes'][_0x0207('0x33')]?_0x151bfa['attributes']:_0x4cce6a[_0x0207('0x2d')];if(_0x5a532b[_0x0207('0x2e')]['includeAll']){_0x151bfa[_0x0207('0x3d')]=[{'all':!![]}];}_0x151bfa=_[_0x0207('0x39')]({},_0x151bfa,_0x5a532b[_0x0207('0x3a')]);return db['SalesforceConfiguration'][_0x0207('0x44')](_0x151bfa)[_0x0207('0x24')](handleEntityNotFound(_0x121e5c,null))[_0x0207('0x24')](respondWithResult(_0x121e5c,null))['catch'](handleError(_0x121e5c,null));};exports[_0x0207('0x45')]=function(_0x25b94c,_0x33f716){return db[_0x0207('0x3b')]['create'](_0x25b94c[_0x0207('0x46')],{})[_0x0207('0x24')](respondWithResult(_0x33f716,0xc9))['catch'](handleError(_0x33f716,null));};exports['update']=function(_0x4ad321,_0x567782){if(_0x4ad321['body']['id']){delete _0x4ad321['body']['id'];}return db[_0x0207('0x3b')][_0x0207('0x44')]({'where':{'id':_0x4ad321[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x567782,null))[_0x0207('0x24')](saveUpdates(_0x4ad321[_0x0207('0x46')],null))['then'](respondWithResult(_0x567782,null))['catch'](handleError(_0x567782,null));};exports[_0x0207('0x25')]=function(_0x22b375,_0x583536){return db['SalesforceConfiguration']['find']({'where':{'id':_0x22b375[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x583536,null))[_0x0207('0x24')](removeEntity(_0x583536,null))[_0x0207('0x40')](handleError(_0x583536,null));};exports[_0x0207('0x47')]=function(_0x3bdf14,_0x20f479,_0x3d939e){var _0x31221d={};var _0x4a046c={};var _0x27238b;var _0x49fc81;return db[_0x0207('0x3b')][_0x0207('0x48')]({'where':{'id':_0x3bdf14[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x20f479,null))[_0x0207('0x24')](function(_0x3e18ba){if(_0x3e18ba){_0x27238b=_0x3e18ba;_0x4a046c['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x4a046c[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x3bdf14[_0x0207('0x2e')]);_0x4a046c[_0x0207('0x37')]=_[_0x0207('0x30')](_0x4a046c['model'],_0x4a046c[_0x0207('0x2e')]);_0x31221d[_0x0207('0x31')]=_[_0x0207('0x30')](_0x4a046c[_0x0207('0x2d')],qs['fields'](_0x3bdf14[_0x0207('0x2e')]['fields']));_0x31221d['attributes']=_0x31221d['attributes']['length']?_0x31221d['attributes']:_0x4a046c[_0x0207('0x2d')];_0x31221d['order']=qs[_0x0207('0x35')](_0x3bdf14[_0x0207('0x2e')][_0x0207('0x35')]);_0x31221d[_0x0207('0x36')]=qs[_0x0207('0x37')](_[_0x0207('0x49')](_0x3bdf14[_0x0207('0x2e')],_0x4a046c[_0x0207('0x37')]));if(_0x3bdf14['query'][_0x0207('0x38')]){_0x31221d[_0x0207('0x36')]=_[_0x0207('0x39')](_0x31221d[_0x0207('0x36')],{'$or':_['map'](_0x31221d[_0x0207('0x31')],function(_0x1c4fd0){var _0x302de3={};_0x302de3[_0x1c4fd0]={'$like':'%'+_0x3bdf14['query']['filter']+'%'};return _0x302de3;})});}_0x31221d=_['merge']({},_0x31221d,_0x3bdf14[_0x0207('0x3a')]);return _0x27238b[_0x0207('0x47')](_0x31221d);}})[_0x0207('0x24')](function(_0x55c0da){if(_0x55c0da){_0x49fc81=_0x55c0da[_0x0207('0x33')];if(!_0x3bdf14['query'][_0x0207('0x34')]('nolimit')){_0x31221d[_0x0207('0x1d')]=qs[_0x0207('0x1d')](_0x3bdf14[_0x0207('0x2e')][_0x0207('0x1d')]);_0x31221d[_0x0207('0x1b')]=qs[_0x0207('0x1b')](_0x3bdf14[_0x0207('0x2e')]['offset']);}return _0x27238b[_0x0207('0x47')](_0x31221d);}})[_0x0207('0x24')](function(_0x553f3e){if(_0x553f3e){return _0x553f3e?{'count':_0x49fc81,'rows':_0x553f3e}:null;}})[_0x0207('0x24')](respondWithResult(_0x20f479,null))[_0x0207('0x40')](handleError(_0x20f479,null));};exports[_0x0207('0x4a')]=function(_0x5b9aa9,_0x2599e4,_0x403f8f){var _0x2d279d={};var _0x5b54f2={};var _0x38a403;var _0x5ca436;return db[_0x0207('0x3b')][_0x0207('0x48')]({'where':{'id':_0x5b9aa9[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x2599e4,null))[_0x0207('0x24')](function(_0x116e00){if(_0x116e00){_0x38a403=_0x116e00;_0x5b54f2['model']=_[_0x0207('0x2f')](db['SalesforceField'][_0x0207('0x43')]);_0x5b54f2[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x5b9aa9[_0x0207('0x2e')]);_0x5b54f2[_0x0207('0x37')]=_['intersection'](_0x5b54f2[_0x0207('0x2d')],_0x5b54f2['query']);_0x2d279d['attributes']=_['intersection'](_0x5b54f2[_0x0207('0x2d')],qs[_0x0207('0x32')](_0x5b9aa9[_0x0207('0x2e')][_0x0207('0x32')]));_0x2d279d[_0x0207('0x31')]=_0x2d279d[_0x0207('0x31')]['length']?_0x2d279d[_0x0207('0x31')]:_0x5b54f2[_0x0207('0x2d')];_0x2d279d[_0x0207('0x4b')]=qs[_0x0207('0x35')](_0x5b9aa9['query'][_0x0207('0x35')]);_0x2d279d['where']=qs['filters'](_[_0x0207('0x49')](_0x5b9aa9[_0x0207('0x2e')],_0x5b54f2[_0x0207('0x37')]));if(_0x5b9aa9['query'][_0x0207('0x38')]){_0x2d279d[_0x0207('0x36')]=_[_0x0207('0x39')](_0x2d279d[_0x0207('0x36')],{'$or':_[_0x0207('0x29')](_0x2d279d[_0x0207('0x31')],function(_0x45e569){var _0x3ac90b={};_0x3ac90b[_0x45e569]={'$like':'%'+_0x5b9aa9[_0x0207('0x2e')][_0x0207('0x38')]+'%'};return _0x3ac90b;})});}_0x2d279d=_[_0x0207('0x39')]({},_0x2d279d,_0x5b9aa9[_0x0207('0x3a')]);return _0x38a403['getSubjects'](_0x2d279d);}})['then'](function(_0x39cb50){if(_0x39cb50){_0x5ca436=_0x39cb50['length'];if(!_0x5b9aa9[_0x0207('0x2e')][_0x0207('0x34')](_0x0207('0x4c'))){_0x2d279d[_0x0207('0x1d')]=qs[_0x0207('0x1d')](_0x5b9aa9[_0x0207('0x2e')][_0x0207('0x1d')]);_0x2d279d['offset']=qs[_0x0207('0x1b')](_0x5b9aa9[_0x0207('0x2e')][_0x0207('0x1b')]);}return _0x38a403[_0x0207('0x4a')](_0x2d279d);}})['then'](function(_0x1225e4){if(_0x1225e4){return _0x1225e4?{'count':_0x5ca436,'rows':_0x1225e4}:null;}})[_0x0207('0x24')](respondWithResult(_0x2599e4,null))[_0x0207('0x40')](handleError(_0x2599e4,null));};exports['getDescriptions']=function(_0x3f5821,_0x2ebe87,_0x442381){var _0x28dd23={};var _0x4a6531={};var _0x167ed1;var _0x24ee2d;return db['SalesforceConfiguration'][_0x0207('0x48')]({'where':{'id':_0x3f5821[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x2ebe87,null))[_0x0207('0x24')](function(_0x42d5d1){if(_0x42d5d1){_0x167ed1=_0x42d5d1;_0x4a6531[_0x0207('0x2d')]=_[_0x0207('0x2f')](db[_0x0207('0x4d')][_0x0207('0x43')]);_0x4a6531[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x3f5821[_0x0207('0x2e')]);_0x4a6531[_0x0207('0x37')]=_[_0x0207('0x30')](_0x4a6531[_0x0207('0x2d')],_0x4a6531[_0x0207('0x2e')]);_0x28dd23[_0x0207('0x31')]=_[_0x0207('0x30')](_0x4a6531['model'],qs[_0x0207('0x32')](_0x3f5821[_0x0207('0x2e')][_0x0207('0x32')]));_0x28dd23['attributes']=_0x28dd23[_0x0207('0x31')][_0x0207('0x33')]?_0x28dd23[_0x0207('0x31')]:_0x4a6531['model'];_0x28dd23[_0x0207('0x4b')]=qs['sort'](_0x3f5821[_0x0207('0x2e')][_0x0207('0x35')]);_0x28dd23[_0x0207('0x36')]=qs['filters'](_[_0x0207('0x49')](_0x3f5821[_0x0207('0x2e')],_0x4a6531[_0x0207('0x37')]));if(_0x3f5821[_0x0207('0x2e')][_0x0207('0x38')]){_0x28dd23[_0x0207('0x36')]=_[_0x0207('0x39')](_0x28dd23[_0x0207('0x36')],{'$or':_[_0x0207('0x29')](_0x28dd23[_0x0207('0x31')],function(_0x2f44d1){var _0x12c210={};_0x12c210[_0x2f44d1]={'$like':'%'+_0x3f5821[_0x0207('0x2e')]['filter']+'%'};return _0x12c210;})});}_0x28dd23=_['merge']({},_0x28dd23,_0x3f5821[_0x0207('0x3a')]);return _0x167ed1[_0x0207('0x4e')](_0x28dd23);}})[_0x0207('0x24')](function(_0x3fb058){if(_0x3fb058){_0x24ee2d=_0x3fb058[_0x0207('0x33')];if(!_0x3f5821[_0x0207('0x2e')][_0x0207('0x34')]('nolimit')){_0x28dd23[_0x0207('0x1d')]=qs[_0x0207('0x1d')](_0x3f5821[_0x0207('0x2e')][_0x0207('0x1d')]);_0x28dd23[_0x0207('0x1b')]=qs[_0x0207('0x1b')](_0x3f5821[_0x0207('0x2e')][_0x0207('0x1b')]);}return _0x167ed1[_0x0207('0x4e')](_0x28dd23);}})['then'](function(_0x560a8c){if(_0x560a8c){return _0x560a8c?{'count':_0x24ee2d,'rows':_0x560a8c}:null;}})[_0x0207('0x24')](respondWithResult(_0x2ebe87,null))[_0x0207('0x40')](handleError(_0x2ebe87,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4d34341..ea4d93d 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 _0x96a9=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','util'];(function(_0x1d7700,_0x303437){var _0x10f3ac=function(_0x4baa79){while(--_0x4baa79){_0x1d7700['push'](_0x1d7700['shift']());}};_0x10f3ac(++_0x303437);}(_0x96a9,0x6d));var _0x996a=function(_0x19a283,_0x452d48){_0x19a283=_0x19a283-0x0;var _0x27a1ec=_0x96a9[_0x19a283];return _0x27a1ec;};'use strict';var _=require('lodash');var util=require(_0x996a('0x0'));var logger=require(_0x996a('0x1'))('api');var moment=require(_0x996a('0x2'));var BPromise=require(_0x996a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x996a('0x4'));var rimraf=require(_0x996a('0x5'));var config=require(_0x996a('0x6'));var attributes=require(_0x996a('0x7'));module[_0x996a('0x8')]=function(_0x2e0c7e,_0x3c30bc){return _0x2e0c7e[_0x996a('0x9')](_0x996a('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd760=['../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xb77dea,_0x4d0e76){var _0x3d0d8e=function(_0x132f41){while(--_0x132f41){_0xb77dea['push'](_0xb77dea['shift']());}};_0x3d0d8e(++_0x4d0e76);}(_0xd760,0x19c));var _0x0d76=function(_0x36fe77,_0xcee8d7){_0x36fe77=_0x36fe77-0x0;var _0x361bd9=_0xd760[_0x36fe77];return _0x361bd9;};'use strict';var _=require(_0x0d76('0x0'));var util=require(_0x0d76('0x1'));var logger=require(_0x0d76('0x2'))(_0x0d76('0x3'));var moment=require('moment');var BPromise=require(_0x0d76('0x4'));var rp=require(_0x0d76('0x5'));var fs=require('fs');var path=require(_0x0d76('0x6'));var rimraf=require(_0x0d76('0x7'));var config=require(_0x0d76('0x8'));var attributes=require(_0x0d76('0x9'));module[_0x0d76('0xa')]=function(_0x48e4f2,_0x5863d6){return _0x48e4f2['define']('SalesforceConfiguration',attributes,{'tableName':_0x0d76('0xb'),'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 e41e4e8..5dd63e5 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 _0xac4a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x4fcd70,_0x109348){var _0x336588=function(_0x430a8c){while(--_0x430a8c){_0x4fcd70['push'](_0x4fcd70['shift']());}};_0x336588(++_0x109348);}(_0xac4a,0x144));var _0xaac4=function(_0x133669,_0x54afb1){_0x133669=_0x133669-0x0;var _0x2a4ead=_0xac4a[_0x133669];return _0x2a4ead;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaac4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaac4('0x5'));var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require(_0xaac4('0x9'));var client=jayson[_0xaac4('0xa')][_0xaac4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d06cd,_0x3e041f,_0x22c45e){return new BPromise(function(_0x1d731d,_0x1e3b35){return client['request'](_0x3d06cd,_0x22c45e)[_0xaac4('0xc')](function(_0x22f174){logger[_0xaac4('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e041f,_0xaac4('0xe'));logger[_0xaac4('0xf')](_0xaac4('0x10'),_0x3e041f,'request\x20sent',JSON['stringify'](_0x22f174));if(_0x22f174[_0xaac4('0x11')]){if(_0x22f174['error'][_0xaac4('0x12')]===0x1f4){logger['error'](_0xaac4('0x13'),_0x3e041f,_0x22f174[_0xaac4('0x11')][_0xaac4('0x14')]);return _0x1e3b35(_0x22f174[_0xaac4('0x11')][_0xaac4('0x14')]);}logger[_0xaac4('0x11')](_0xaac4('0x13'),_0x3e041f,_0x22f174['error'][_0xaac4('0x14')]);return _0x1d731d(_0x22f174['error'][_0xaac4('0x14')]);}else{logger['info'](_0xaac4('0x13'),_0x3e041f,_0xaac4('0xe'));_0x1d731d(_0x22f174[_0xaac4('0x15')]['message']);}})['catch'](function(_0x504d98){logger[_0xaac4('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e041f,_0x504d98);_0x1e3b35(_0x504d98);});});} \ No newline at end of file +var _0x30a4=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3c4cc4,_0x23eebb){var _0x40e018=function(_0x2e541d){while(--_0x2e541d){_0x3c4cc4['push'](_0x3c4cc4['shift']());}};_0x40e018(++_0x23eebb);}(_0x30a4,0x112));var _0x430a=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x30a4[_0x412342];return _0x3e62cb;};'use strict';var _=require(_0x430a('0x0'));var util=require(_0x430a('0x1'));var moment=require(_0x430a('0x2'));var BPromise=require(_0x430a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x430a('0x4'));var db=require(_0x430a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x430a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x430a('0x7')][_0x430a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56f849,_0x222e9f,_0x13544d){return new BPromise(function(_0x27809a,_0x5c7ea4){return client[_0x430a('0x9')](_0x56f849,_0x13544d)[_0x430a('0xa')](function(_0x40d307){logger[_0x430a('0xb')](_0x430a('0xc'),_0x222e9f,_0x430a('0xd'));logger[_0x430a('0xe')](_0x430a('0xf'),_0x222e9f,_0x430a('0xd'),JSON[_0x430a('0x10')](_0x40d307));if(_0x40d307[_0x430a('0x11')]){if(_0x40d307[_0x430a('0x11')]['code']===0x1f4){logger[_0x430a('0x11')](_0x430a('0xc'),_0x222e9f,_0x40d307[_0x430a('0x11')]['message']);return _0x5c7ea4(_0x40d307['error'][_0x430a('0x12')]);}logger[_0x430a('0x11')](_0x430a('0xc'),_0x222e9f,_0x40d307['error'][_0x430a('0x12')]);return _0x27809a(_0x40d307[_0x430a('0x11')][_0x430a('0x12')]);}else{logger[_0x430a('0xb')](_0x430a('0xc'),_0x222e9f,_0x430a('0xd'));_0x27809a(_0x40d307[_0x430a('0x13')][_0x430a('0x12')]);}})[_0x430a('0x14')](function(_0x1115d9){logger[_0x430a('0x11')](_0x430a('0xc'),_0x222e9f,_0x1115d9);_0x5c7ea4(_0x1115d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b4d4e96..a02fd4d 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 _0xcc60=['isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x4ce63d,_0x46c45a){var _0x5bdff2=function(_0x209fdd){while(--_0x209fdd){_0x4ce63d['push'](_0x4ce63d['shift']());}};_0x5bdff2(++_0x46c45a);}(_0xcc60,0x119));var _0x0cc6=function(_0x5509f9,_0x173378){_0x5509f9=_0x5509f9-0x0;var _0x18926a=_0xcc60[_0x5509f9];return _0x18926a;};'use strict';var multer=require('multer');var util=require(_0x0cc6('0x0'));var path=require(_0x0cc6('0x1'));var timeout=require(_0x0cc6('0x2'));var express=require(_0x0cc6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cc6('0x4'));var config=require(_0x0cc6('0x5'));var controller=require(_0x0cc6('0x6'));router[_0x0cc6('0x7')]('/',auth[_0x0cc6('0x8')](),controller['index']);router['get']('/:id',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0x9')]);router[_0x0cc6('0xa')]('/',auth['isAuthenticated'](),controller[_0x0cc6('0xb')]);router[_0x0cc6('0xc')](_0x0cc6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0cc6('0xe')](_0x0cc6('0xd'),auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xf')]);module[_0x0cc6('0x10')]=router; \ No newline at end of file +var _0x13c1=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create','put','update'];(function(_0x2bcf16,_0xeaf342){var _0xb56fab=function(_0x2b97ed){while(--_0x2b97ed){_0x2bcf16['push'](_0x2bcf16['shift']());}};_0xb56fab(++_0xeaf342);}(_0x13c1,0x103));var _0x113c=function(_0x518082,_0x1fa2cb){_0x518082=_0x518082-0x0;var _0x513790=_0x13c1[_0x518082];return _0x513790;};'use strict';var multer=require(_0x113c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x113c('0x1'));var express=require(_0x113c('0x2'));var router=express[_0x113c('0x3')]();var fs_extra=require(_0x113c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x113c('0x5')](),controller['index']);router[_0x113c('0x6')](_0x113c('0x7'),auth[_0x113c('0x5')](),controller[_0x113c('0x8')]);router[_0x113c('0x9')]('/',auth[_0x113c('0x5')](),controller[_0x113c('0xa')]);router[_0x113c('0xb')](_0x113c('0x7'),auth[_0x113c('0x5')](),controller[_0x113c('0xc')]);router[_0x113c('0xd')](_0x113c('0x7'),auth['isAuthenticated'](),controller[_0x113c('0xe')]);module[_0x113c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 94febbc..30e5cdb 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 _0xe2ff=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x43afdd,_0x4d584a){var _0x5e122b=function(_0x23c4f5){while(--_0x23c4f5){_0x43afdd['push'](_0x43afdd['shift']());}};_0x5e122b(++_0x4d584a);}(_0xe2ff,0x1c3));var _0xfe2f=function(_0x5f1adf,_0x195272){_0x5f1adf=_0x5f1adf-0x0;var _0x125b6b=_0xe2ff[_0x5f1adf];return _0x125b6b;};'use strict';var Sequelize=require(_0xfe2f('0x0'));module['exports']={'type':{'type':Sequelize[_0xfe2f('0x1')](_0xfe2f('0x2'),_0xfe2f('0x3'),_0xfe2f('0x4'),_0xfe2f('0x5'),_0xfe2f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe2f('0x7')]},'key':{'type':Sequelize[_0xfe2f('0x7')]},'keyType':{'type':Sequelize[_0xfe2f('0x1')](_0xfe2f('0x2'),'variable',_0xfe2f('0x4'))},'keyContent':{'type':Sequelize[_0xfe2f('0x7')]},'idField':{'type':Sequelize[_0xfe2f('0x7')]},'variableName':{'type':Sequelize[_0xfe2f('0x7')]}}; \ No newline at end of file +var _0xf288=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x244874,_0x9e393){var _0x24bfd3=function(_0x53ff7b){while(--_0x53ff7b){_0x244874['push'](_0x244874['shift']());}};_0x24bfd3(++_0x9e393);}(_0xf288,0x166));var _0x8f28=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0xf288[_0x5448a9];return _0x1924af;};'use strict';var Sequelize=require(_0x8f28('0x0'));module[_0x8f28('0x1')]={'type':{'type':Sequelize[_0x8f28('0x2')](_0x8f28('0x3'),_0x8f28('0x4'),_0x8f28('0x5'),_0x8f28('0x6'),_0x8f28('0x7')),'defaultValue':_0x8f28('0x3')},'content':{'type':Sequelize[_0x8f28('0x8')]},'key':{'type':Sequelize[_0x8f28('0x8')]},'keyType':{'type':Sequelize[_0x8f28('0x2')](_0x8f28('0x3'),_0x8f28('0x4'),_0x8f28('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8f28('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e86620f..bef5259 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 _0xf5c8=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','SalesforceField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0xd154cd,_0x389877){var _0x3567a2=function(_0x503ee8){while(--_0x503ee8){_0xd154cd['push'](_0xd154cd['shift']());}};_0x3567a2(++_0x389877);}(_0xf5c8,0x17b));var _0x8f5c=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xf5c8[_0x4314d7];return _0x5c599b;};'use strict';var emlformat=require(_0x8f5c('0x0'));var rimraf=require(_0x8f5c('0x1'));var zipdir=require(_0x8f5c('0x2'));var jsonpatch=require(_0x8f5c('0x3'));var rp=require(_0x8f5c('0x4'));var moment=require('moment');var BPromise=require(_0x8f5c('0x5'));var Mustache=require(_0x8f5c('0x6'));var util=require('util');var path=require(_0x8f5c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f5c('0x8'));var fs=require('fs');var fs_extra=require(_0x8f5c('0x9'));var _=require(_0x8f5c('0xa'));var squel=require('squel');var crypto=require(_0x8f5c('0xb'));var jsforce=require(_0x8f5c('0xc'));var deskjs=require(_0x8f5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f5c('0xe'));var Papa=require(_0x8f5c('0xf'));var Redis=require(_0x8f5c('0x10'));var authService=require(_0x8f5c('0x11'));var qs=require(_0x8f5c('0x12'));var as=require(_0x8f5c('0x13'));var hardwareService=require(_0x8f5c('0x14'));var logger=require(_0x8f5c('0x15'))(_0x8f5c('0x16'));var utils=require(_0x8f5c('0x17'));var config=require(_0x8f5c('0x18'));var licenseUtil=require(_0x8f5c('0x19'));var db=require(_0x8f5c('0x1a'))['db'];function respondWithStatusCode(_0x43b680,_0x524cf5){_0x524cf5=_0x524cf5||0xcc;return function(_0x435100){if(_0x435100){return _0x43b680[_0x8f5c('0x1b')](_0x524cf5);}return _0x43b680['status'](_0x524cf5)[_0x8f5c('0x1c')]();};}function respondWithResult(_0xdbd953,_0x1fbffd){_0x1fbffd=_0x1fbffd||0xc8;return function(_0x58e4d0){if(_0x58e4d0){return _0xdbd953[_0x8f5c('0x1d')](_0x1fbffd)[_0x8f5c('0x1e')](_0x58e4d0);}};}function respondWithFilteredResult(_0x30428e,_0x46596f){return function(_0x5700c0){if(_0x5700c0){var _0x5d7509=typeof _0x46596f[_0x8f5c('0x1f')]===_0x8f5c('0x20')&&typeof _0x46596f['limit']===_0x8f5c('0x20');var _0xe4d10a=_0x5700c0['count'];var _0x4e2278=_0x5d7509?0x0:_0x46596f[_0x8f5c('0x1f')];var _0x181891=_0x5d7509?_0x5700c0[_0x8f5c('0x21')]:_0x46596f[_0x8f5c('0x1f')]+_0x46596f['limit'];var _0xbf02a0;if(_0x181891>=_0xe4d10a){_0x181891=_0xe4d10a;_0xbf02a0=0xc8;}else{_0xbf02a0=0xce;}_0x30428e[_0x8f5c('0x1d')](_0xbf02a0);return _0x30428e[_0x8f5c('0x22')](_0x8f5c('0x23'),_0x4e2278+'-'+_0x181891+'/'+_0xe4d10a)[_0x8f5c('0x1e')](_0x5700c0);}return null;};}function patchUpdates(_0x3d19ff){return function(_0x544abe){try{jsonpatch['apply'](_0x544abe,_0x3d19ff,!![]);}catch(_0x43a795){return BPromise[_0x8f5c('0x24')](_0x43a795);}return _0x544abe[_0x8f5c('0x25')]();};}function saveUpdates(_0x1756fa,_0x2635bf){return function(_0x31078c){if(_0x31078c){return _0x31078c[_0x8f5c('0x26')](_0x1756fa)['then'](function(_0x5c9eed){return _0x5c9eed;});}return null;};}function removeEntity(_0x1506da,_0x10bb54){return function(_0x304841){if(_0x304841){return _0x304841[_0x8f5c('0x27')]()[_0x8f5c('0x28')](function(){_0x1506da[_0x8f5c('0x1d')](0xcc)[_0x8f5c('0x1c')]();});}};}function handleEntityNotFound(_0x498d6e,_0x1a002a){return function(_0x496008){if(!_0x496008){_0x498d6e[_0x8f5c('0x1b')](0x194);}return _0x496008;};}function handleError(_0x562e7c,_0x2b3ccc){_0x2b3ccc=_0x2b3ccc||0x1f4;return function(_0x830303){logger[_0x8f5c('0x29')](_0x830303[_0x8f5c('0x2a')]);if(_0x830303[_0x8f5c('0x2b')]){delete _0x830303['name'];}_0x562e7c[_0x8f5c('0x1d')](_0x2b3ccc)[_0x8f5c('0x2c')](_0x830303);};}exports['index']=function(_0x2a7ec0,_0x19423c){var _0x91337b={},_0x3fdc47={},_0xbbcd72={'count':0x0,'rows':[]};var _0x396c0b=_[_0x8f5c('0x2d')](db[_0x8f5c('0x2e')]['rawAttributes'],function(_0x26e71d){return{'name':_0x26e71d[_0x8f5c('0x2f')],'type':_0x26e71d[_0x8f5c('0x30')]['key']};});_0x3fdc47[_0x8f5c('0x31')]=_[_0x8f5c('0x2d')](_0x396c0b,_0x8f5c('0x2b'));_0x3fdc47[_0x8f5c('0x32')]=_[_0x8f5c('0x33')](_0x2a7ec0['query']);_0x3fdc47[_0x8f5c('0x34')]=_['intersection'](_0x3fdc47[_0x8f5c('0x31')],_0x3fdc47[_0x8f5c('0x32')]);_0x91337b[_0x8f5c('0x35')]=_[_0x8f5c('0x36')](_0x3fdc47['model'],qs[_0x8f5c('0x37')](_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x37')]));_0x91337b['attributes']=_0x91337b[_0x8f5c('0x35')][_0x8f5c('0x38')]?_0x91337b[_0x8f5c('0x35')]:_0x3fdc47[_0x8f5c('0x31')];if(!_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x39')](_0x8f5c('0x3a'))){_0x91337b['limit']=qs['limit'](_0x2a7ec0[_0x8f5c('0x32')]['limit']);_0x91337b[_0x8f5c('0x1f')]=qs[_0x8f5c('0x1f')](_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x1f')]);}_0x91337b[_0x8f5c('0x3b')]=qs[_0x8f5c('0x3c')](_0x2a7ec0['query'][_0x8f5c('0x3c')]);_0x91337b[_0x8f5c('0x3d')]=qs['filters'](_[_0x8f5c('0x3e')](_0x2a7ec0[_0x8f5c('0x32')],_0x3fdc47['filters']),_0x396c0b);if(_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x3f')]){_0x91337b['where']=_[_0x8f5c('0x40')](_0x91337b[_0x8f5c('0x3d')],{'$or':_[_0x8f5c('0x2d')](_0x396c0b,function(_0x26cc54){if(_0x26cc54[_0x8f5c('0x30')]!==_0x8f5c('0x41')){var _0x450e9a={};_0x450e9a[_0x26cc54[_0x8f5c('0x2b')]]={'$like':'%'+_0x2a7ec0['query'][_0x8f5c('0x3f')]+'%'};return _0x450e9a;}})});}_0x91337b=_[_0x8f5c('0x40')]({},_0x91337b,_0x2a7ec0[_0x8f5c('0x42')]);var _0x37a0b3={'where':_0x91337b[_0x8f5c('0x3d')]};return db['SalesforceField'][_0x8f5c('0x21')](_0x37a0b3)[_0x8f5c('0x28')](function(_0x2b6757){_0xbbcd72[_0x8f5c('0x21')]=_0x2b6757;if(_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x43')]){_0x91337b[_0x8f5c('0x44')]=[{'all':!![]}];}return db[_0x8f5c('0x2e')][_0x8f5c('0x45')](_0x91337b);})['then'](function(_0x474272){_0xbbcd72[_0x8f5c('0x46')]=_0x474272;return _0xbbcd72;})[_0x8f5c('0x28')](respondWithFilteredResult(_0x19423c,_0x91337b))[_0x8f5c('0x47')](handleError(_0x19423c,null));};exports[_0x8f5c('0x48')]=function(_0x493deb,_0x25e0ef){var _0x6d98cf={'raw':!![],'where':{'id':_0x493deb['params']['id']}},_0x3a3350={};_0x3a3350['model']=_['keys'](db[_0x8f5c('0x2e')][_0x8f5c('0x49')]);_0x3a3350[_0x8f5c('0x32')]=_[_0x8f5c('0x33')](_0x493deb['query']);_0x3a3350[_0x8f5c('0x34')]=_['intersection'](_0x3a3350['model'],_0x3a3350['query']);_0x6d98cf[_0x8f5c('0x35')]=_[_0x8f5c('0x36')](_0x3a3350[_0x8f5c('0x31')],qs[_0x8f5c('0x37')](_0x493deb[_0x8f5c('0x32')]['fields']));_0x6d98cf[_0x8f5c('0x35')]=_0x6d98cf[_0x8f5c('0x35')][_0x8f5c('0x38')]?_0x6d98cf['attributes']:_0x3a3350[_0x8f5c('0x31')];if(_0x493deb[_0x8f5c('0x32')]['includeAll']){_0x6d98cf[_0x8f5c('0x44')]=[{'all':!![]}];}_0x6d98cf=_[_0x8f5c('0x40')]({},_0x6d98cf,_0x493deb[_0x8f5c('0x42')]);return db[_0x8f5c('0x2e')][_0x8f5c('0x4a')](_0x6d98cf)[_0x8f5c('0x28')](handleEntityNotFound(_0x25e0ef,null))['then'](respondWithResult(_0x25e0ef,null))[_0x8f5c('0x47')](handleError(_0x25e0ef,null));};exports[_0x8f5c('0x4b')]=function(_0x555c84,_0x22cd63){return db[_0x8f5c('0x2e')]['create'](_0x555c84['body'],{})[_0x8f5c('0x28')](respondWithResult(_0x22cd63,0xc9))['catch'](handleError(_0x22cd63,null));};exports[_0x8f5c('0x26')]=function(_0x5805b1,_0x277f73){if(_0x5805b1[_0x8f5c('0x4c')]['id']){delete _0x5805b1[_0x8f5c('0x4c')]['id'];}return db['SalesforceField'][_0x8f5c('0x4a')]({'where':{'id':_0x5805b1['params']['id']}})[_0x8f5c('0x28')](handleEntityNotFound(_0x277f73,null))[_0x8f5c('0x28')](saveUpdates(_0x5805b1['body'],null))[_0x8f5c('0x28')](respondWithResult(_0x277f73,null))[_0x8f5c('0x47')](handleError(_0x277f73,null));};exports[_0x8f5c('0x27')]=function(_0x35c30e,_0x2c0624){return db['SalesforceField'][_0x8f5c('0x4a')]({'where':{'id':_0x35c30e[_0x8f5c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c0624,null))[_0x8f5c('0x28')](removeEntity(_0x2c0624,null))['catch'](handleError(_0x2c0624,null));}; \ No newline at end of file +var _0x6dc1=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','SalesforceField','rawAttributes','type','key'];(function(_0xbf1875,_0x34b144){var _0x2e598b=function(_0xd104ec){while(--_0xd104ec){_0xbf1875['push'](_0xbf1875['shift']());}};_0x2e598b(++_0x34b144);}(_0x6dc1,0x142));var _0x16dc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6dc1[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16dc('0x0'));var zipdir=require(_0x16dc('0x1'));var jsonpatch=require(_0x16dc('0x2'));var rp=require('request-promise');var moment=require(_0x16dc('0x3'));var BPromise=require(_0x16dc('0x4'));var Mustache=require(_0x16dc('0x5'));var util=require(_0x16dc('0x6'));var path=require(_0x16dc('0x7'));var sox=require(_0x16dc('0x8'));var csv=require(_0x16dc('0x9'));var ejs=require(_0x16dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16dc('0xb'));var squel=require(_0x16dc('0xc'));var crypto=require(_0x16dc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x16dc('0xe'));var toCsv=require(_0x16dc('0x9'));var querystring=require(_0x16dc('0xf'));var Papa=require(_0x16dc('0x10'));var Redis=require(_0x16dc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x16dc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16dc('0x13'));var logger=require('../../config/logger')(_0x16dc('0x14'));var utils=require(_0x16dc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x16dc('0x16'));var db=require(_0x16dc('0x17'))['db'];function respondWithStatusCode(_0x1315c8,_0x25ceac){_0x25ceac=_0x25ceac||0xcc;return function(_0x3b4705){if(_0x3b4705){return _0x1315c8[_0x16dc('0x18')](_0x25ceac);}return _0x1315c8[_0x16dc('0x19')](_0x25ceac)['end']();};}function respondWithResult(_0x5354d5,_0x56c24d){_0x56c24d=_0x56c24d||0xc8;return function(_0x445e42){if(_0x445e42){return _0x5354d5[_0x16dc('0x19')](_0x56c24d)['json'](_0x445e42);}};}function respondWithFilteredResult(_0x4c688e,_0xcbf065){return function(_0x4cbb71){if(_0x4cbb71){var _0x587ef9=typeof _0xcbf065['offset']==='undefined'&&typeof _0xcbf065[_0x16dc('0x1a')]==='undefined';var _0x43bfc9=_0x4cbb71[_0x16dc('0x1b')];var _0x4b2f3d=_0x587ef9?0x0:_0xcbf065[_0x16dc('0x1c')];var _0x5e03f5=_0x587ef9?_0x4cbb71[_0x16dc('0x1b')]:_0xcbf065[_0x16dc('0x1c')]+_0xcbf065[_0x16dc('0x1a')];var _0xb7174;if(_0x5e03f5>=_0x43bfc9){_0x5e03f5=_0x43bfc9;_0xb7174=0xc8;}else{_0xb7174=0xce;}_0x4c688e[_0x16dc('0x19')](_0xb7174);return _0x4c688e[_0x16dc('0x1d')](_0x16dc('0x1e'),_0x4b2f3d+'-'+_0x5e03f5+'/'+_0x43bfc9)[_0x16dc('0x1f')](_0x4cbb71);}return null;};}function patchUpdates(_0x1ed287){return function(_0x598a28){try{jsonpatch[_0x16dc('0x20')](_0x598a28,_0x1ed287,!![]);}catch(_0x4bbd3a){return BPromise[_0x16dc('0x21')](_0x4bbd3a);}return _0x598a28[_0x16dc('0x22')]();};}function saveUpdates(_0x4dc1cd,_0x580edd){return function(_0x42dc7d){if(_0x42dc7d){return _0x42dc7d[_0x16dc('0x23')](_0x4dc1cd)['then'](function(_0x214c81){return _0x214c81;});}return null;};}function removeEntity(_0x2c9d9f,_0x809367){return function(_0x47fd33){if(_0x47fd33){return _0x47fd33[_0x16dc('0x24')]()[_0x16dc('0x25')](function(){_0x2c9d9f[_0x16dc('0x19')](0xcc)[_0x16dc('0x26')]();});}};}function handleEntityNotFound(_0x39e67d,_0x296c16){return function(_0x5503cb){if(!_0x5503cb){_0x39e67d[_0x16dc('0x18')](0x194);}return _0x5503cb;};}function handleError(_0x2fedac,_0x547dbf){_0x547dbf=_0x547dbf||0x1f4;return function(_0x54ea73){logger[_0x16dc('0x27')](_0x54ea73[_0x16dc('0x28')]);if(_0x54ea73[_0x16dc('0x29')]){delete _0x54ea73[_0x16dc('0x29')];}_0x2fedac[_0x16dc('0x19')](_0x547dbf)['send'](_0x54ea73);};}exports[_0x16dc('0x2a')]=function(_0x2b6982,_0x3e8eb9){var _0x14e9ee={},_0xebf82b={},_0x3ae3b3={'count':0x0,'rows':[]};var _0x1488a5=_[_0x16dc('0x2b')](db[_0x16dc('0x2c')][_0x16dc('0x2d')],function(_0x585419){return{'name':_0x585419['fieldName'],'type':_0x585419[_0x16dc('0x2e')][_0x16dc('0x2f')]};});_0xebf82b[_0x16dc('0x30')]=_[_0x16dc('0x2b')](_0x1488a5,'name');_0xebf82b['query']=_['keys'](_0x2b6982[_0x16dc('0x31')]);_0xebf82b[_0x16dc('0x32')]=_['intersection'](_0xebf82b[_0x16dc('0x30')],_0xebf82b[_0x16dc('0x31')]);_0x14e9ee['attributes']=_[_0x16dc('0x33')](_0xebf82b[_0x16dc('0x30')],qs[_0x16dc('0x34')](_0x2b6982[_0x16dc('0x31')][_0x16dc('0x34')]));_0x14e9ee['attributes']=_0x14e9ee[_0x16dc('0x35')][_0x16dc('0x36')]?_0x14e9ee['attributes']:_0xebf82b[_0x16dc('0x30')];if(!_0x2b6982[_0x16dc('0x31')][_0x16dc('0x37')](_0x16dc('0x38'))){_0x14e9ee[_0x16dc('0x1a')]=qs[_0x16dc('0x1a')](_0x2b6982['query'][_0x16dc('0x1a')]);_0x14e9ee[_0x16dc('0x1c')]=qs[_0x16dc('0x1c')](_0x2b6982[_0x16dc('0x31')][_0x16dc('0x1c')]);}_0x14e9ee[_0x16dc('0x39')]=qs['sort'](_0x2b6982[_0x16dc('0x31')][_0x16dc('0x3a')]);_0x14e9ee['where']=qs['filters'](_[_0x16dc('0x3b')](_0x2b6982[_0x16dc('0x31')],_0xebf82b[_0x16dc('0x32')]),_0x1488a5);if(_0x2b6982[_0x16dc('0x31')][_0x16dc('0x3c')]){_0x14e9ee[_0x16dc('0x3d')]=_['merge'](_0x14e9ee[_0x16dc('0x3d')],{'$or':_[_0x16dc('0x2b')](_0x1488a5,function(_0x2e7d08){if(_0x2e7d08[_0x16dc('0x2e')]!==_0x16dc('0x3e')){var _0x49953b={};_0x49953b[_0x2e7d08[_0x16dc('0x29')]]={'$like':'%'+_0x2b6982[_0x16dc('0x31')]['filter']+'%'};return _0x49953b;}})});}_0x14e9ee=_[_0x16dc('0x3f')]({},_0x14e9ee,_0x2b6982[_0x16dc('0x40')]);var _0x1f34bb={'where':_0x14e9ee['where']};return db[_0x16dc('0x2c')][_0x16dc('0x1b')](_0x1f34bb)[_0x16dc('0x25')](function(_0x1a33e3){_0x3ae3b3[_0x16dc('0x1b')]=_0x1a33e3;if(_0x2b6982['query'][_0x16dc('0x41')]){_0x14e9ee[_0x16dc('0x42')]=[{'all':!![]}];}return db[_0x16dc('0x2c')]['findAll'](_0x14e9ee);})[_0x16dc('0x25')](function(_0x28177a){_0x3ae3b3[_0x16dc('0x43')]=_0x28177a;return _0x3ae3b3;})[_0x16dc('0x25')](respondWithFilteredResult(_0x3e8eb9,_0x14e9ee))[_0x16dc('0x44')](handleError(_0x3e8eb9,null));};exports['show']=function(_0x6d06e9,_0x41d71f){var _0x4f83da={'raw':!![],'where':{'id':_0x6d06e9[_0x16dc('0x45')]['id']}},_0x20e81e={};_0x20e81e[_0x16dc('0x30')]=_[_0x16dc('0x46')](db['SalesforceField'][_0x16dc('0x2d')]);_0x20e81e[_0x16dc('0x31')]=_[_0x16dc('0x46')](_0x6d06e9['query']);_0x20e81e[_0x16dc('0x32')]=_[_0x16dc('0x33')](_0x20e81e['model'],_0x20e81e['query']);_0x4f83da['attributes']=_[_0x16dc('0x33')](_0x20e81e[_0x16dc('0x30')],qs[_0x16dc('0x34')](_0x6d06e9[_0x16dc('0x31')][_0x16dc('0x34')]));_0x4f83da[_0x16dc('0x35')]=_0x4f83da[_0x16dc('0x35')][_0x16dc('0x36')]?_0x4f83da[_0x16dc('0x35')]:_0x20e81e['model'];if(_0x6d06e9[_0x16dc('0x31')][_0x16dc('0x41')]){_0x4f83da['include']=[{'all':!![]}];}_0x4f83da=_[_0x16dc('0x3f')]({},_0x4f83da,_0x6d06e9[_0x16dc('0x40')]);return db[_0x16dc('0x2c')]['find'](_0x4f83da)[_0x16dc('0x25')](handleEntityNotFound(_0x41d71f,null))[_0x16dc('0x25')](respondWithResult(_0x41d71f,null))[_0x16dc('0x44')](handleError(_0x41d71f,null));};exports[_0x16dc('0x47')]=function(_0x829929,_0x4679be){return db[_0x16dc('0x2c')]['create'](_0x829929[_0x16dc('0x48')],{})[_0x16dc('0x25')](respondWithResult(_0x4679be,0xc9))[_0x16dc('0x44')](handleError(_0x4679be,null));};exports['update']=function(_0x29fc32,_0x41540b){if(_0x29fc32['body']['id']){delete _0x29fc32['body']['id'];}return db[_0x16dc('0x2c')][_0x16dc('0x49')]({'where':{'id':_0x29fc32[_0x16dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x41540b,null))[_0x16dc('0x25')](saveUpdates(_0x29fc32[_0x16dc('0x48')],null))[_0x16dc('0x25')](respondWithResult(_0x41540b,null))[_0x16dc('0x44')](handleError(_0x41540b,null));};exports[_0x16dc('0x24')]=function(_0x5b7de7,_0x4227b4){return db[_0x16dc('0x2c')][_0x16dc('0x49')]({'where':{'id':_0x5b7de7['params']['id']}})[_0x16dc('0x25')](handleEntityNotFound(_0x4227b4,null))[_0x16dc('0x25')](removeEntity(_0x4227b4,null))[_0x16dc('0x44')](handleError(_0x4227b4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9c78d2d..5cd871e 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 _0x6681=['request-promise','path','rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0x6681,0x6b));var _0x1668=function(_0x5c88b9,_0x2cf0f4){_0x5c88b9=_0x5c88b9-0x0;var _0x5ba659=_0x6681[_0x5c88b9];return _0x5ba659;};'use strict';var _=require(_0x1668('0x0'));var util=require(_0x1668('0x1'));var logger=require(_0x1668('0x2'))(_0x1668('0x3'));var moment=require('moment');var BPromise=require(_0x1668('0x4'));var rp=require(_0x1668('0x5'));var fs=require('fs');var path=require(_0x1668('0x6'));var rimraf=require(_0x1668('0x7'));var config=require(_0x1668('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x1668('0x9')]=function(_0x257cee,_0x210074){return _0x257cee['define'](_0x1668('0xa'),attributes,{'tableName':_0x1668('0xb'),'paranoid':![],'indexes':[{'name':_0x1668('0xc'),'fields':[_0x1668('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe318=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField'];(function(_0x30e4d1,_0x22f791){var _0x1f2d58=function(_0x5ecaf0){while(--_0x5ecaf0){_0x30e4d1['push'](_0x30e4d1['shift']());}};_0x1f2d58(++_0x22f791);}(_0xe318,0x74));var _0x8e31=function(_0x479ce9,_0xefb790){_0x479ce9=_0x479ce9-0x0;var _0x48364e=_0xe318[_0x479ce9];return _0x48364e;};'use strict';var _=require(_0x8e31('0x0'));var util=require(_0x8e31('0x1'));var logger=require(_0x8e31('0x2'))(_0x8e31('0x3'));var moment=require(_0x8e31('0x4'));var BPromise=require(_0x8e31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e31('0x6'));var rimraf=require(_0x8e31('0x7'));var config=require(_0x8e31('0x8'));var attributes=require(_0x8e31('0x9'));module['exports']=function(_0x548c91,_0x5a3661){return _0x548c91[_0x8e31('0xa')](_0x8e31('0xb'),attributes,{'tableName':_0x8e31('0xc'),'paranoid':![],'indexes':[{'name':_0x8e31('0xd'),'fields':[_0x8e31('0xe'),_0x8e31('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 50dd3d1..dec2bf7 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 _0x1589=['code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1589,0x1ea));var _0x9158=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1589[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x9158('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9158('0x1'));var fs=require('fs');var Redis=require(_0x9158('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9158('0x3'));var logger=require(_0x9158('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9158('0x5'));var client=jayson['client'][_0x9158('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d155f,_0x4197b2,_0x83f07c){return new BPromise(function(_0x4018fa,_0x3df96f){return client['request'](_0x1d155f,_0x83f07c)[_0x9158('0x7')](function(_0x5ad097){logger[_0x9158('0x8')](_0x9158('0x9'),_0x4197b2,_0x9158('0xa'));logger['debug'](_0x9158('0xb'),_0x4197b2,'request\x20sent',JSON[_0x9158('0xc')](_0x5ad097));if(_0x5ad097[_0x9158('0xd')]){if(_0x5ad097[_0x9158('0xd')][_0x9158('0xe')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x4197b2,_0x5ad097[_0x9158('0xd')][_0x9158('0xf')]);return _0x3df96f(_0x5ad097[_0x9158('0xd')][_0x9158('0xf')]);}logger[_0x9158('0xd')](_0x9158('0x9'),_0x4197b2,_0x5ad097[_0x9158('0xd')]['message']);return _0x4018fa(_0x5ad097['error'][_0x9158('0xf')]);}else{logger[_0x9158('0x8')](_0x9158('0x9'),_0x4197b2,'request\x20sent');_0x4018fa(_0x5ad097[_0x9158('0x10')]['message']);}})[_0x9158('0x11')](function(_0x332f43){logger['error'](_0x9158('0x9'),_0x4197b2,_0x332f43);_0x3df96f(_0x332f43);});});} \ No newline at end of file +var _0x5881=['jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x5881,0x69));var _0x1588=function(_0xce2631,_0x1b81e6){_0xce2631=_0xce2631-0x0;var _0x35b3db=_0x5881[_0xce2631];return _0x35b3db;};'use strict';var _=require('lodash');var util=require(_0x1588('0x0'));var moment=require(_0x1588('0x1'));var BPromise=require(_0x1588('0x2'));var rs=require(_0x1588('0x3'));var fs=require('fs');var Redis=require(_0x1588('0x4'));var db=require(_0x1588('0x5'))['db'];var utils=require(_0x1588('0x6'));var logger=require(_0x1588('0x7'))(_0x1588('0x8'));var config=require(_0x1588('0x9'));var jayson=require(_0x1588('0xa'));var client=jayson['client'][_0x1588('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf52752,_0x233db8,_0x573875){return new BPromise(function(_0x578dbf,_0x1b3c37){return client[_0x1588('0xc')](_0xf52752,_0x573875)[_0x1588('0xd')](function(_0x13e677){logger[_0x1588('0xe')](_0x1588('0xf'),_0x233db8,_0x1588('0x10'));logger[_0x1588('0x11')](_0x1588('0x12'),_0x233db8,_0x1588('0x10'),JSON[_0x1588('0x13')](_0x13e677));if(_0x13e677[_0x1588('0x14')]){if(_0x13e677[_0x1588('0x14')]['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x233db8,_0x13e677[_0x1588('0x14')]['message']);return _0x1b3c37(_0x13e677[_0x1588('0x14')][_0x1588('0x15')]);}logger[_0x1588('0x14')]('SalesforceField,\x20%s,\x20%s',_0x233db8,_0x13e677[_0x1588('0x14')][_0x1588('0x15')]);return _0x578dbf(_0x13e677[_0x1588('0x14')][_0x1588('0x15')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x233db8,_0x1588('0x10'));_0x578dbf(_0x13e677[_0x1588('0x16')][_0x1588('0x15')]);}})['catch'](function(_0x30fa4a){logger['error'](_0x1588('0xf'),_0x233db8,_0x30fa4a);_0x1b3c37(_0x30fa4a);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 48e5437..45a2a5c 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 _0x366a=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','path','express','Router'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x366a,0x85));var _0xa366=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x366a[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require(_0xa366('0x0'));var util=require(_0xa366('0x1'));var path=require(_0xa366('0x2'));var timeout=require('connect-timeout');var express=require(_0xa366('0x3'));var router=express[_0xa366('0x4')]();var fs_extra=require(_0xa366('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa366('0x6'));var config=require(_0xa366('0x7'));var controller=require(_0xa366('0x8'));router['get']('/',auth[_0xa366('0x9')](),controller[_0xa366('0xa')]);router[_0xa366('0xb')](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0xd')]);router['get'](_0xa366('0xe'),auth[_0xa366('0x9')](),controller[_0xa366('0xf')]);router[_0xa366('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa366('0x10')]);router[_0xa366('0x11')]('/',auth[_0xa366('0x9')](),controller[_0xa366('0x12')]);router[_0xa366('0x11')](_0xa366('0xe'),auth['isAuthenticated'](),controller[_0xa366('0x13')]);router['put'](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0x14')]);router['delete'](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0x15')]);module[_0xa366('0x16')]=router; \ No newline at end of file +var _0xe6d7=['getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x46f5e9,_0x4c51ab){var _0x57de85=function(_0x49cdfe){while(--_0x49cdfe){_0x46f5e9['push'](_0x46f5e9['shift']());}};_0x57de85(++_0x4c51ab);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x762c59,_0x5e21c9){_0x762c59=_0x762c59-0x0;var _0x27c6f3=_0xe6d7[_0x762c59];return _0x27c6f3;};'use strict';var multer=require('multer');var util=require(_0x7e6d('0x0'));var path=require('path');var timeout=require(_0x7e6d('0x1'));var express=require(_0x7e6d('0x2'));var router=express[_0x7e6d('0x3')]();var fs_extra=require(_0x7e6d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7e6d('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x7e6d('0x6')]('/',auth[_0x7e6d('0x7')](),controller['index']);router[_0x7e6d('0x6')](_0x7e6d('0x8'),auth[_0x7e6d('0x7')](),controller[_0x7e6d('0x9')]);router[_0x7e6d('0x6')](_0x7e6d('0xa'),auth[_0x7e6d('0x7')](),controller[_0x7e6d('0xb')]);router[_0x7e6d('0x6')](_0x7e6d('0xc'),auth['isAuthenticated'](),controller[_0x7e6d('0xd')]);router[_0x7e6d('0xe')]('/',auth[_0x7e6d('0x7')](),controller[_0x7e6d('0xf')]);router['post'](_0x7e6d('0xa'),auth[_0x7e6d('0x7')](),controller['addConfiguration']);router[_0x7e6d('0x10')](_0x7e6d('0x8'),auth[_0x7e6d('0x7')](),controller[_0x7e6d('0x11')]);router[_0x7e6d('0x12')](_0x7e6d('0x8'),auth[_0x7e6d('0x7')](),controller[_0x7e6d('0x13')]);module[_0x7e6d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 33a6fdb..7e9a879 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 _0x69cb=['remoteUri','sequelize','exports','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x69cb,0x69));var _0xb69c=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x69cb[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require(_0xb69c('0x0'));module[_0xb69c('0x1')]={'name':{'type':Sequelize[_0xb69c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb69c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb69c('0x2')]},'email':{'type':Sequelize[_0xb69c('0x2')]},'remoteUri':{'type':Sequelize[_0xb69c('0x2')],'unique':_0xb69c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xccfd=['exports','STRING','username','remoteUri'];(function(_0x46ff82,_0x59d48c){var _0x262d95=function(_0xec0f3f){while(--_0xec0f3f){_0x46ff82['push'](_0x46ff82['shift']());}};_0x262d95(++_0x59d48c);}(_0xccfd,0x9c));var _0xdccf=function(_0x43f51a,_0x217216){_0x43f51a=_0x43f51a-0x0;var _0x1de863=_0xccfd[_0x43f51a];return _0x1de863;};'use strict';var Sequelize=require('sequelize');module[_0xdccf('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdccf('0x1')]},'username':{'type':Sequelize[_0xdccf('0x1')],'unique':_0xdccf('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdccf('0x1')]},'remoteUri':{'type':Sequelize[_0xdccf('0x1')],'unique':_0xdccf('0x3')},'serverUrl':{'type':Sequelize[_0xdccf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index bc7879e..f82f7dd 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 _0x1db6=['test','statusCode','send','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','show','params','keys','include','find','catch','create','body','getConfigurations','findOne','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','watch_list','child_incidents','approval_history','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list','business_service','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20'];(function(_0x14a4d0,_0x4c7068){var _0x18c8ab=function(_0x10bd3b){while(--_0x10bd3b){_0x14a4d0['push'](_0x14a4d0['shift']());}};_0x18c8ab(++_0x4c7068);}(_0x1db6,0xbd));var _0x61db=function(_0x383ac1,_0x47f750){_0x383ac1=_0x383ac1-0x0;var _0x31997f=_0x1db6[_0x383ac1];return _0x31997f;};'use strict';var emlformat=require(_0x61db('0x0'));var rimraf=require(_0x61db('0x1'));var zipdir=require(_0x61db('0x2'));var jsonpatch=require(_0x61db('0x3'));var rp=require('request-promise');var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var Mustache=require(_0x61db('0x6'));var util=require(_0x61db('0x7'));var path=require(_0x61db('0x8'));var sox=require(_0x61db('0x9'));var csv=require(_0x61db('0xa'));var ejs=require(_0x61db('0xb'));var fs=require('fs');var fs_extra=require(_0x61db('0xc'));var _=require(_0x61db('0xd'));var squel=require(_0x61db('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61db('0xa'));var querystring=require(_0x61db('0xf'));var Papa=require(_0x61db('0x10'));var Redis=require('ioredis');var authService=require(_0x61db('0x11'));var qs=require(_0x61db('0x12'));var as=require(_0x61db('0x13'));var hardwareService=require(_0x61db('0x14'));var logger=require(_0x61db('0x15'))('api');var utils=require(_0x61db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x61db('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x61db('0x18'));function respondWithStatusCode(_0x2c7504,_0x1207aa){_0x1207aa=_0x1207aa||0xcc;return function(_0x1c4666){if(_0x1c4666){return _0x2c7504[_0x61db('0x19')](_0x1207aa);}return _0x2c7504['status'](_0x1207aa)[_0x61db('0x1a')]();};}function respondWithResult(_0x24b989,_0x288541){_0x288541=_0x288541||0xc8;return function(_0x1312a8){if(_0x1312a8){return _0x24b989['status'](_0x288541)[_0x61db('0x1b')](_0x1312a8);}};}function respondWithFilteredResult(_0x26d0aa,_0x559b6d){return function(_0x58f213){if(_0x58f213){var _0x24c5d1=typeof _0x559b6d['offset']===_0x61db('0x1c')&&typeof _0x559b6d[_0x61db('0x1d')]===_0x61db('0x1c');var _0xfbcf15=_0x58f213['count'];var _0x1ff5b3=_0x24c5d1?0x0:_0x559b6d['offset'];var _0x4a190f=_0x24c5d1?_0x58f213[_0x61db('0x1e')]:_0x559b6d['offset']+_0x559b6d['limit'];var _0xb42986;if(_0x4a190f>=_0xfbcf15){_0x4a190f=_0xfbcf15;_0xb42986=0xc8;}else{_0xb42986=0xce;}_0x26d0aa['status'](_0xb42986);return _0x26d0aa['set'](_0x61db('0x1f'),_0x1ff5b3+'-'+_0x4a190f+'/'+_0xfbcf15)[_0x61db('0x1b')](_0x58f213);}return null;};}function patchUpdates(_0x274b3f){return function(_0x1bb949){try{jsonpatch[_0x61db('0x20')](_0x1bb949,_0x274b3f,!![]);}catch(_0x37085e){return BPromise[_0x61db('0x21')](_0x37085e);}return _0x1bb949[_0x61db('0x22')]();};}function saveUpdates(_0x23ed25,_0x1947d0){return function(_0x4b2a69){if(_0x4b2a69){return _0x4b2a69[_0x61db('0x23')](_0x23ed25)[_0x61db('0x24')](function(_0x19ae8b){return _0x19ae8b;});}return null;};}function removeEntity(_0x1ef4bf,_0x319ddf){return function(_0x1c281d){if(_0x1c281d){return _0x1c281d[_0x61db('0x25')]()[_0x61db('0x24')](function(){_0x1ef4bf[_0x61db('0x26')](0xcc)[_0x61db('0x1a')]();});}};}function handleEntityNotFound(_0x3d9800,_0x406082){return function(_0x4e9a3b){if(!_0x4e9a3b){_0x3d9800['sendStatus'](0x194);}return _0x4e9a3b;};}function handleError(_0x2a137b,_0x229e78){_0x229e78=_0x229e78||0x1f4;return function(_0x4f1407){logger[_0x61db('0x27')](_0x4f1407[_0x61db('0x28')]);if(_0x4f1407[_0x61db('0x29')]){delete _0x4f1407[_0x61db('0x29')];}_0x2a137b[_0x61db('0x26')](_0x229e78)['send'](_0x4f1407);};}exports[_0x61db('0x2a')]=function(_0x56c433,_0x4fe86c){var _0x536d80={},_0x427fcd={},_0x1de64a={'count':0x0,'rows':[]};var _0x2f8fa0=_['map'](db[_0x61db('0x2b')][_0x61db('0x2c')],function(_0x2aea30){return{'name':_0x2aea30[_0x61db('0x2d')],'type':_0x2aea30[_0x61db('0x2e')][_0x61db('0x2f')]};});_0x427fcd['model']=_[_0x61db('0x30')](_0x2f8fa0,'name');_0x427fcd['query']=_['keys'](_0x56c433['query']);_0x427fcd['filters']=_[_0x61db('0x31')](_0x427fcd[_0x61db('0x32')],_0x427fcd[_0x61db('0x33')]);_0x536d80[_0x61db('0x34')]=_[_0x61db('0x31')](_0x427fcd[_0x61db('0x32')],qs[_0x61db('0x35')](_0x56c433['query'][_0x61db('0x35')]));_0x536d80[_0x61db('0x34')]=_0x536d80[_0x61db('0x34')]['length']?_0x536d80['attributes']:_0x427fcd[_0x61db('0x32')];if(!_0x56c433[_0x61db('0x33')][_0x61db('0x36')](_0x61db('0x37'))){_0x536d80[_0x61db('0x1d')]=qs[_0x61db('0x1d')](_0x56c433[_0x61db('0x33')][_0x61db('0x1d')]);_0x536d80['offset']=qs[_0x61db('0x38')](_0x56c433[_0x61db('0x33')]['offset']);}_0x536d80[_0x61db('0x39')]=qs[_0x61db('0x3a')](_0x56c433[_0x61db('0x33')][_0x61db('0x3a')]);_0x536d80[_0x61db('0x3b')]=qs[_0x61db('0x3c')](_[_0x61db('0x3d')](_0x56c433[_0x61db('0x33')],_0x427fcd[_0x61db('0x3c')]),_0x2f8fa0);if(_0x56c433[_0x61db('0x33')][_0x61db('0x3e')]){_0x536d80[_0x61db('0x3b')]=_[_0x61db('0x3f')](_0x536d80[_0x61db('0x3b')],{'$or':_[_0x61db('0x30')](_0x2f8fa0,function(_0x3b0c59){if(_0x3b0c59[_0x61db('0x2e')]!=='VIRTUAL'){var _0x33fb73={};_0x33fb73[_0x3b0c59[_0x61db('0x29')]]={'$like':'%'+_0x56c433[_0x61db('0x33')][_0x61db('0x3e')]+'%'};return _0x33fb73;}})});}_0x536d80=_[_0x61db('0x3f')]({},_0x536d80,_0x56c433[_0x61db('0x40')]);var _0x3f5c91={'where':_0x536d80[_0x61db('0x3b')]};return db[_0x61db('0x2b')][_0x61db('0x1e')](_0x3f5c91)[_0x61db('0x24')](function(_0xa8ac4d){_0x1de64a['count']=_0xa8ac4d;if(_0x56c433[_0x61db('0x33')][_0x61db('0x41')]){_0x536d80['include']=[{'all':!![]}];}return db[_0x61db('0x2b')]['findAll'](_0x536d80);})[_0x61db('0x24')](function(_0x45d6f2){_0x1de64a[_0x61db('0x42')]=_0x45d6f2;return _0x1de64a;})['then'](respondWithFilteredResult(_0x4fe86c,_0x536d80))['catch'](handleError(_0x4fe86c,null));};exports[_0x61db('0x43')]=function(_0x290068,_0x40933e){var _0x53eab5={'raw':![],'where':{'id':_0x290068[_0x61db('0x44')]['id']}},_0x10f7b4={};_0x10f7b4['model']=_[_0x61db('0x45')](db[_0x61db('0x2b')][_0x61db('0x2c')]);_0x10f7b4[_0x61db('0x33')]=_[_0x61db('0x45')](_0x290068[_0x61db('0x33')]);_0x10f7b4[_0x61db('0x3c')]=_['intersection'](_0x10f7b4['model'],_0x10f7b4[_0x61db('0x33')]);_0x53eab5[_0x61db('0x34')]=_[_0x61db('0x31')](_0x10f7b4[_0x61db('0x32')],qs[_0x61db('0x35')](_0x290068[_0x61db('0x33')][_0x61db('0x35')]));_0x53eab5[_0x61db('0x34')]=_0x53eab5['attributes']['length']?_0x53eab5['attributes']:_0x10f7b4[_0x61db('0x32')];if(_0x290068['query'][_0x61db('0x41')]){_0x53eab5[_0x61db('0x46')]=[{'all':!![]}];}_0x53eab5=_[_0x61db('0x3f')]({},_0x53eab5,_0x290068[_0x61db('0x40')]);return db[_0x61db('0x2b')][_0x61db('0x47')](_0x53eab5)['then'](handleEntityNotFound(_0x40933e,null))[_0x61db('0x24')](respondWithResult(_0x40933e,null))[_0x61db('0x48')](handleError(_0x40933e,null));};exports[_0x61db('0x49')]=function(_0x5656ed,_0x14ab59){return db[_0x61db('0x2b')][_0x61db('0x49')](_0x5656ed[_0x61db('0x4a')],{})[_0x61db('0x24')](respondWithResult(_0x14ab59,0xc9))[_0x61db('0x48')](handleError(_0x14ab59,null));};exports[_0x61db('0x23')]=function(_0x33275d,_0xc50a22){if(_0x33275d[_0x61db('0x4a')]['id']){delete _0x33275d[_0x61db('0x4a')]['id'];}return db['ServicenowAccount'][_0x61db('0x47')]({'where':{'id':_0x33275d['params']['id']}})[_0x61db('0x24')](handleEntityNotFound(_0xc50a22,null))[_0x61db('0x24')](saveUpdates(_0x33275d[_0x61db('0x4a')],null))[_0x61db('0x24')](respondWithResult(_0xc50a22,null))[_0x61db('0x48')](handleError(_0xc50a22,null));};exports[_0x61db('0x25')]=function(_0x1b541a,_0x1cf662){return db[_0x61db('0x2b')][_0x61db('0x47')]({'where':{'id':_0x1b541a['params']['id']}})['then'](handleEntityNotFound(_0x1cf662,null))[_0x61db('0x24')](removeEntity(_0x1cf662,null))[_0x61db('0x48')](handleError(_0x1cf662,null));};exports[_0x61db('0x4b')]=function(_0x1847da,_0x437ce5,_0x20fc0a){var _0x1fede6={};var _0x39ab6a={};var _0x1354b9;var _0x535bb3;return db['ServicenowAccount'][_0x61db('0x4c')]({'where':{'id':_0x1847da[_0x61db('0x44')]['id']}})[_0x61db('0x24')](handleEntityNotFound(_0x437ce5,null))[_0x61db('0x24')](function(_0x20dc01){if(_0x20dc01){_0x1354b9=_0x20dc01;_0x39ab6a['model']=_['keys'](db['ServicenowConfiguration'][_0x61db('0x2c')]);_0x39ab6a[_0x61db('0x33')]=_[_0x61db('0x45')](_0x1847da[_0x61db('0x33')]);_0x39ab6a[_0x61db('0x3c')]=_['intersection'](_0x39ab6a[_0x61db('0x32')],_0x39ab6a[_0x61db('0x33')]);_0x1fede6[_0x61db('0x34')]=_[_0x61db('0x31')](_0x39ab6a[_0x61db('0x32')],qs['fields'](_0x1847da[_0x61db('0x33')][_0x61db('0x35')]));_0x1fede6['attributes']=_0x1fede6[_0x61db('0x34')]['length']?_0x1fede6[_0x61db('0x34')]:_0x39ab6a[_0x61db('0x32')];_0x1fede6['order']=qs['sort'](_0x1847da[_0x61db('0x33')][_0x61db('0x3a')]);_0x1fede6[_0x61db('0x3b')]=qs[_0x61db('0x3c')](_['pick'](_0x1847da[_0x61db('0x33')],_0x39ab6a[_0x61db('0x3c')]));if(_0x1847da[_0x61db('0x33')][_0x61db('0x3e')]){_0x1fede6[_0x61db('0x3b')]=_[_0x61db('0x3f')](_0x1fede6[_0x61db('0x3b')],{'$or':_[_0x61db('0x30')](_0x1fede6[_0x61db('0x34')],function(_0x30b207){var _0x293abf={};_0x293abf[_0x30b207]={'$like':'%'+_0x1847da[_0x61db('0x33')][_0x61db('0x3e')]+'%'};return _0x293abf;})});}_0x1fede6=_[_0x61db('0x3f')]({},_0x1fede6,_0x1847da[_0x61db('0x40')]);return _0x1354b9[_0x61db('0x4b')](_0x1fede6);}})[_0x61db('0x24')](function(_0x518589){if(_0x518589){_0x535bb3=_0x518589[_0x61db('0x4d')];if(!_0x1847da['query'][_0x61db('0x36')](_0x61db('0x37'))){_0x1fede6[_0x61db('0x1d')]=qs[_0x61db('0x1d')](_0x1847da[_0x61db('0x33')]['limit']);_0x1fede6['offset']=qs[_0x61db('0x38')](_0x1847da[_0x61db('0x33')][_0x61db('0x38')]);}return _0x1354b9[_0x61db('0x4b')](_0x1fede6);}})[_0x61db('0x24')](function(_0x36923f){if(_0x36923f){return _0x36923f?{'count':_0x535bb3,'rows':_0x36923f}:null;}})[_0x61db('0x24')](respondWithResult(_0x437ce5,null))[_0x61db('0x48')](handleError(_0x437ce5,null));};exports[_0x61db('0x4e')]=function(_0x2fdf9d,_0x124200,_0x58e769){if(_0x2fdf9d[_0x61db('0x4a')]['id']){delete _0x2fdf9d[_0x61db('0x4a')]['id'];}return db[_0x61db('0x2b')][_0x61db('0x4c')]({'where':{'id':_0x2fdf9d[_0x61db('0x44')]['id']}})[_0x61db('0x24')](handleEntityNotFound(_0x124200,null))[_0x61db('0x24')](function(_0x22380b){if(_0x22380b){_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x4f')]=_0x22380b['id'];_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x50')]=integrations[_0x61db('0x51')](_0x2fdf9d['body'][_0x61db('0x52')],_0x2fdf9d[_0x61db('0x4a')]['type']);_0x2fdf9d['body'][_0x61db('0x53')]=integrations[_0x61db('0x54')](_0x2fdf9d['body'][_0x61db('0x52')],_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x2e')]);return db['ServicenowConfiguration'][_0x61db('0x49')](_0x2fdf9d[_0x61db('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0x61db('0x50')},{'model':db[_0x61db('0x55')],'as':'Descriptions'}]});}return null;})[_0x61db('0x24')](respondWithResult(_0x124200,null))[_0x61db('0x48')](handleError(_0x124200,null));};exports[_0x61db('0x56')]=function(_0xa74651,_0x2fef7c,_0x34897f){var _0x58d19b=[_0x61db('0x57'),_0x61db('0x58'),_0x61db('0x59'),_0x61db('0x5a'),_0x61db('0x5b'),_0x61db('0x5c'),'incident_state',_0x61db('0x5d'),'category'];var _0x3c53e9=['parent',_0x61db('0x57'),'caused_by',_0x61db('0x5e'),'upon_reject','sys_updated_on',_0x61db('0x5f'),'hold_reason',_0x61db('0x60'),'number','resolved_by','sys_updated_by',_0x61db('0x61'),_0x61db('0x62'),_0x61db('0x63'),_0x61db('0x64'),'state',_0x61db('0x65'),_0x61db('0x59'),_0x61db('0x39'),_0x61db('0x66'),'closed_at',_0x61db('0x67'),'delivery_plan',_0x61db('0x68'),_0x61db('0x69'),_0x61db('0x6a'),_0x61db('0x6b'),'priority','sys_domain_path','rfc','time_worked',_0x61db('0x6c'),'opened_at',_0x61db('0x6d'),_0x61db('0x6e'),_0x61db('0x6f'),'reopened_time',_0x61db('0x70'),_0x61db('0x71'),_0x61db('0x72'),_0x61db('0x5a'),_0x61db('0x73'),'short_description','close_code',_0x61db('0x74'),_0x61db('0x75'),_0x61db('0x76'),_0x61db('0x77'),_0x61db('0x78'),_0x61db('0x79'),_0x61db('0x7a'),_0x61db('0x7b'),_0x61db('0x5c'),_0x61db('0x7c'),'close_notes',_0x61db('0x7d'),'follow_up',_0x61db('0x7e'),_0x61db('0x7f'),_0x61db('0x80'),_0x61db('0x81'),_0x61db('0x82'),_0x61db('0x83'),'problem_id',_0x61db('0x84'),'reassignment_count',_0x61db('0x85'),'assigned_to',_0x61db('0x5d'),'comments',_0x61db('0x86'),_0x61db('0x87'),_0x61db('0x88'),_0x61db('0x89'),_0x61db('0x8a'),'reopen_count',_0x61db('0x8b'),_0x61db('0x8c'),_0x61db('0x8d'),_0x61db('0x8e'),_0x61db('0x8f'),_0x61db('0x90')];var _0x1f6e10='';var _0x1fae7a='';var _0x4b72ef=[];var _0x3bc4f3='';var _0x451c88='';var _0x2ea6a9=[];var _0x446e2c='';var _0x5fbc42='';var _0x3a9839={};var _0x380374='';return db[_0x61db('0x2b')]['findOne']({'where':{'id':_0xa74651[_0x61db('0x44')]['id']},'attributes':['id',_0x61db('0x91'),_0x61db('0x92'),_0x61db('0x93'),_0x61db('0x94'),'serverUrl']})[_0x61db('0x24')](handleEntityNotFound(_0x2fef7c,null))[_0x61db('0x24')](function(_0x2de22a){if(_0x2de22a){_0x380374=_0x2de22a[_0x61db('0x94')];var _0x334d70=_0x380374[_0x61db('0x95')](-0x1);if(_0x334d70==='/'){_0x380374=_0x380374[_0x61db('0x96')](0x0,_0x380374[_0x61db('0x97')](_0x334d70));}_0x5fbc42=util[_0x61db('0x98')](_0x61db('0x99'),_0x380374);_0x446e2c=util['format'](_0x61db('0x9a'),_0x380374);_0x3a9839={'user':_0x2de22a['username'],'pass':_0x2de22a[_0x61db('0x92')]};var _0x33d0c0={'method':_0x61db('0x9b'),'uri':_0x5fbc42+'incident?sysparm_display_value=all','auth':_0x3a9839,'json':!![]};return rp(_0x33d0c0);}})['then'](function(_0x424f9d){if(_0x424f9d[_0x61db('0x9c')]['length']>0x0){_0x1f6e10=_0x424f9d[_0x61db('0x9c')];}console[_0x61db('0x9d')](_0x61db('0x9e'),_0x1f6e10);_0x2ea6a9=[];_0x1fae7a=Object[_0x61db('0x9f')]([],_0x1f6e10);_[_0x61db('0xa0')](_0x1fae7a,function(_0x22547f){return!_0x58d19b[_0x61db('0xa1')](_0x22547f[_0x61db('0x29')]);});_0x1fae7a[_0x61db('0xa2')](function(_0x35497a){var _0x2bdf0f=createFieldObject(_0x446e2c,_0x3a9839,_0x35497a[_0x61db('0xa3')],_0x35497a[_0x61db('0x29')],_0x35497a[_0x61db('0xa4')],![]);_0x2ea6a9[_0x61db('0xa5')](_0x2bdf0f);});return Promise[_0x61db('0xa6')](_0x2ea6a9);})[_0x61db('0x24')](function(_0x18465d){_0x4b72ef=_0x18465d;_0x3bc4f3=Object[_0x61db('0x9f')]([],_0x1f6e10);console['log'](_0x61db('0xa7'),_0x1f6e10);_[_0x61db('0xa0')](_0x3bc4f3,function(_0x4128eb){return _0x3c53e9[_0x61db('0xa1')](_0x4128eb[_0x61db('0x29')]);});console[_0x61db('0x9d')](_0x61db('0xa8'),_0x3bc4f3);_0x2ea6a9=[];_0x3bc4f3[_0x61db('0xa2')](function(_0x3ea202){var _0x47db83=createFieldObject(_0x446e2c,_0x3a9839,_0x3ea202[_0x61db('0xa3')],_0x3ea202[_0x61db('0x29')],_0x3ea202[_0x61db('0xa4')],!![]);_0x2ea6a9['push'](_0x47db83);});return Promise['all'](_0x2ea6a9);})[_0x61db('0x24')](function(_0x4d4990){_0x451c88=_0x4d4990;var _0x4af36c=_0x4b72ef[_0x61db('0xa9')](_0x451c88);return{'count':_0x4af36c[_0x61db('0x4d')],'rows':_0x4af36c};})[_0x61db('0x24')](respondWithResult(_0x2fef7c,null))[_0x61db('0x48')](function(_0x4af649){console['log'](_0x61db('0xaa')+_0x4af649);var _0x4572bd=_0xa74651[_0x61db('0x33')][_0x61db('0xab')]?0x1f4:_0x4af649[_0x61db('0xac')]||0x1f4;logger[_0x61db('0x27')](_0x4af649[_0x61db('0x28')]);delete _0x4af649[_0x61db('0x29')];if(_0x4572bd===0x191){_0x4572bd=0x190;}_0x2fef7c[_0x61db('0x26')](_0x4572bd)[_0x61db('0xad')](_0xa74651[_0x61db('0x33')][_0x61db('0xab')]?{'message':_0x61db('0xae'),'statusCode':_0x4af649['statusCode']}:_0x4af649);});};function createFieldObject(_0x26c54a,_0x532caf,_0x28292c,_0x2ce24a,_0x11a0a9,_0x446382){return new Promise(function(_0x3224ea,_0xb79936){var _0x5d9d3c={'id':_0x2ce24a,'name':_0x11a0a9,'custom':_0x446382};if(_0x28292c==='boolean'){_0x5d9d3c['options']=[{'name':'True','value':_0x61db('0xaf')},{'name':_0x61db('0xb0'),'value':'false'}];_0x3224ea(_0x5d9d3c);}else{var _0x19e79c={'method':_0x61db('0x9b'),'uri':_0x26c54a+_0x61db('0xb1')+_0x2ce24a,'auth':_0x532caf,'json':!![]};return rp(_0x19e79c)['then'](function(_0x252804){var _0x147632=[];if(_0x252804[_0x61db('0x9c')]['length']>0x0){_0x252804[_0x61db('0x9c')]['forEach'](function(_0x24c9c7){if(_0x24c9c7[_0x61db('0xb2')]==='false'){var _0x2177f6={'name':_0x24c9c7['label'],'value':_0x24c9c7[_0x61db('0xb3')]};_0x147632[_0x61db('0xa5')](_0x2177f6);}});}_0x5d9d3c[_0x61db('0x40')]=_0x147632;if(_0x5d9d3c['options'][_0x61db('0x4d')]>0x0){_0x3224ea(_0x5d9d3c);}else{if(_0x446382==![]){_0x3224ea();}else{_0x3224ea(_0x5d9d3c);}}});}});} \ No newline at end of file +var _0xc915=['label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','true','False','false','GET','result','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../components/integrations/configuration','status','end','undefined','count','offset','limit','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','order','sort','filters','pick','filter','where','type','merge','ServicenowAccount','includeAll','include','rows','catch','show','params','options','create','body','find','findOne','ServicenowConfiguration','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','made_sla','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','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','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','location','category','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType'];(function(_0x4fc11a,_0x2340e2){var _0x301d6a=function(_0x584fb0){while(--_0x584fb0){_0x4fc11a['push'](_0x4fc11a['shift']());}};_0x301d6a(++_0x2340e2);}(_0xc915,0xcf));var _0x5c91=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc915[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x5c91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c91('0x1'));var jsonpatch=require(_0x5c91('0x2'));var rp=require(_0x5c91('0x3'));var moment=require(_0x5c91('0x4'));var BPromise=require(_0x5c91('0x5'));var Mustache=require(_0x5c91('0x6'));var util=require('util');var path=require(_0x5c91('0x7'));var sox=require(_0x5c91('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c91('0x9'));var squel=require(_0x5c91('0xa'));var crypto=require(_0x5c91('0xb'));var jsforce=require(_0x5c91('0xc'));var deskjs=require(_0x5c91('0xd'));var toCsv=require(_0x5c91('0xe'));var querystring=require(_0x5c91('0xf'));var Papa=require(_0x5c91('0x10'));var Redis=require(_0x5c91('0x11'));var authService=require(_0x5c91('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5c91('0x13'));var hardwareService=require(_0x5c91('0x14'));var logger=require('../../config/logger')(_0x5c91('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c91('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5c91('0x17'));function respondWithStatusCode(_0x166964,_0x296e3a){_0x296e3a=_0x296e3a||0xcc;return function(_0x34fd30){if(_0x34fd30){return _0x166964['sendStatus'](_0x296e3a);}return _0x166964[_0x5c91('0x18')](_0x296e3a)[_0x5c91('0x19')]();};}function respondWithResult(_0x3b6017,_0x542dc6){_0x542dc6=_0x542dc6||0xc8;return function(_0x522fc8){if(_0x522fc8){return _0x3b6017[_0x5c91('0x18')](_0x542dc6)['json'](_0x522fc8);}};}function respondWithFilteredResult(_0x37a9ba,_0x5579c9){return function(_0x1ae95e){if(_0x1ae95e){var _0x302a33=typeof _0x5579c9['offset']===_0x5c91('0x1a')&&typeof _0x5579c9['limit']==='undefined';var _0xc0b2dc=_0x1ae95e[_0x5c91('0x1b')];var _0x1faa51=_0x302a33?0x0:_0x5579c9[_0x5c91('0x1c')];var _0x246380=_0x302a33?_0x1ae95e[_0x5c91('0x1b')]:_0x5579c9[_0x5c91('0x1c')]+_0x5579c9[_0x5c91('0x1d')];var _0x2ed200;if(_0x246380>=_0xc0b2dc){_0x246380=_0xc0b2dc;_0x2ed200=0xc8;}else{_0x2ed200=0xce;}_0x37a9ba[_0x5c91('0x18')](_0x2ed200);return _0x37a9ba['set']('Content-Range',_0x1faa51+'-'+_0x246380+'/'+_0xc0b2dc)['json'](_0x1ae95e);}return null;};}function patchUpdates(_0x4e73a4){return function(_0x5f3034){try{jsonpatch[_0x5c91('0x1e')](_0x5f3034,_0x4e73a4,!![]);}catch(_0x155533){return BPromise[_0x5c91('0x1f')](_0x155533);}return _0x5f3034[_0x5c91('0x20')]();};}function saveUpdates(_0x5d781d,_0x55d3ba){return function(_0x4fc78b){if(_0x4fc78b){return _0x4fc78b[_0x5c91('0x21')](_0x5d781d)['then'](function(_0x1e8982){return _0x1e8982;});}return null;};}function removeEntity(_0x3aa8e6,_0x59244d){return function(_0x19bcae){if(_0x19bcae){return _0x19bcae[_0x5c91('0x22')]()[_0x5c91('0x23')](function(){_0x3aa8e6[_0x5c91('0x18')](0xcc)[_0x5c91('0x19')]();});}};}function handleEntityNotFound(_0x4a29a9,_0x1e7d40){return function(_0x14a800){if(!_0x14a800){_0x4a29a9[_0x5c91('0x24')](0x194);}return _0x14a800;};}function handleError(_0x3067d6,_0x50e2c9){_0x50e2c9=_0x50e2c9||0x1f4;return function(_0x59c544){logger['error'](_0x59c544[_0x5c91('0x25')]);if(_0x59c544[_0x5c91('0x26')]){delete _0x59c544[_0x5c91('0x26')];}_0x3067d6['status'](_0x50e2c9)[_0x5c91('0x27')](_0x59c544);};}exports[_0x5c91('0x28')]=function(_0x4a4e9a,_0x2efad0){var _0x41f641={},_0x3daaa6={},_0x49ca86={'count':0x0,'rows':[]};var _0x45c905=_[_0x5c91('0x29')](db['ServicenowAccount'][_0x5c91('0x2a')],function(_0x457ee3){return{'name':_0x457ee3[_0x5c91('0x2b')],'type':_0x457ee3['type'][_0x5c91('0x2c')]};});_0x3daaa6['model']=_[_0x5c91('0x29')](_0x45c905,_0x5c91('0x26'));_0x3daaa6[_0x5c91('0x2d')]=_[_0x5c91('0x2e')](_0x4a4e9a[_0x5c91('0x2d')]);_0x3daaa6['filters']=_[_0x5c91('0x2f')](_0x3daaa6[_0x5c91('0x30')],_0x3daaa6[_0x5c91('0x2d')]);_0x41f641[_0x5c91('0x31')]=_[_0x5c91('0x2f')](_0x3daaa6[_0x5c91('0x30')],qs['fields'](_0x4a4e9a['query'][_0x5c91('0x32')]));_0x41f641[_0x5c91('0x31')]=_0x41f641['attributes'][_0x5c91('0x33')]?_0x41f641[_0x5c91('0x31')]:_0x3daaa6['model'];if(!_0x4a4e9a[_0x5c91('0x2d')]['hasOwnProperty']('nolimit')){_0x41f641['limit']=qs[_0x5c91('0x1d')](_0x4a4e9a[_0x5c91('0x2d')]['limit']);_0x41f641['offset']=qs['offset'](_0x4a4e9a['query']['offset']);}_0x41f641[_0x5c91('0x34')]=qs['sort'](_0x4a4e9a[_0x5c91('0x2d')][_0x5c91('0x35')]);_0x41f641['where']=qs[_0x5c91('0x36')](_[_0x5c91('0x37')](_0x4a4e9a[_0x5c91('0x2d')],_0x3daaa6['filters']),_0x45c905);if(_0x4a4e9a['query'][_0x5c91('0x38')]){_0x41f641['where']=_['merge'](_0x41f641[_0x5c91('0x39')],{'$or':_[_0x5c91('0x29')](_0x45c905,function(_0x3058b3){if(_0x3058b3[_0x5c91('0x3a')]!=='VIRTUAL'){var _0x3c49f4={};_0x3c49f4[_0x3058b3[_0x5c91('0x26')]]={'$like':'%'+_0x4a4e9a[_0x5c91('0x2d')][_0x5c91('0x38')]+'%'};return _0x3c49f4;}})});}_0x41f641=_[_0x5c91('0x3b')]({},_0x41f641,_0x4a4e9a['options']);var _0x224774={'where':_0x41f641[_0x5c91('0x39')]};return db[_0x5c91('0x3c')][_0x5c91('0x1b')](_0x224774)[_0x5c91('0x23')](function(_0x18782b){_0x49ca86['count']=_0x18782b;if(_0x4a4e9a[_0x5c91('0x2d')][_0x5c91('0x3d')]){_0x41f641[_0x5c91('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x41f641);})[_0x5c91('0x23')](function(_0x5ad7b5){_0x49ca86[_0x5c91('0x3f')]=_0x5ad7b5;return _0x49ca86;})[_0x5c91('0x23')](respondWithFilteredResult(_0x2efad0,_0x41f641))[_0x5c91('0x40')](handleError(_0x2efad0,null));};exports[_0x5c91('0x41')]=function(_0x3e16fa,_0x5b86f6){var _0x28d687={'raw':![],'where':{'id':_0x3e16fa[_0x5c91('0x42')]['id']}},_0x1df5ea={};_0x1df5ea[_0x5c91('0x30')]=_['keys'](db['ServicenowAccount'][_0x5c91('0x2a')]);_0x1df5ea[_0x5c91('0x2d')]=_[_0x5c91('0x2e')](_0x3e16fa[_0x5c91('0x2d')]);_0x1df5ea[_0x5c91('0x36')]=_[_0x5c91('0x2f')](_0x1df5ea[_0x5c91('0x30')],_0x1df5ea[_0x5c91('0x2d')]);_0x28d687[_0x5c91('0x31')]=_[_0x5c91('0x2f')](_0x1df5ea[_0x5c91('0x30')],qs[_0x5c91('0x32')](_0x3e16fa[_0x5c91('0x2d')]['fields']));_0x28d687['attributes']=_0x28d687[_0x5c91('0x31')][_0x5c91('0x33')]?_0x28d687[_0x5c91('0x31')]:_0x1df5ea[_0x5c91('0x30')];if(_0x3e16fa[_0x5c91('0x2d')][_0x5c91('0x3d')]){_0x28d687[_0x5c91('0x3e')]=[{'all':!![]}];}_0x28d687=_[_0x5c91('0x3b')]({},_0x28d687,_0x3e16fa[_0x5c91('0x43')]);return db[_0x5c91('0x3c')]['find'](_0x28d687)['then'](handleEntityNotFound(_0x5b86f6,null))[_0x5c91('0x23')](respondWithResult(_0x5b86f6,null))['catch'](handleError(_0x5b86f6,null));};exports[_0x5c91('0x44')]=function(_0x343a77,_0x2cc7f5){return db['ServicenowAccount'][_0x5c91('0x44')](_0x343a77[_0x5c91('0x45')],{})[_0x5c91('0x23')](respondWithResult(_0x2cc7f5,0xc9))['catch'](handleError(_0x2cc7f5,null));};exports[_0x5c91('0x21')]=function(_0x1974e5,_0x4c0d75){if(_0x1974e5['body']['id']){delete _0x1974e5['body']['id'];}return db[_0x5c91('0x3c')][_0x5c91('0x46')]({'where':{'id':_0x1974e5[_0x5c91('0x42')]['id']}})[_0x5c91('0x23')](handleEntityNotFound(_0x4c0d75,null))[_0x5c91('0x23')](saveUpdates(_0x1974e5[_0x5c91('0x45')],null))['then'](respondWithResult(_0x4c0d75,null))['catch'](handleError(_0x4c0d75,null));};exports[_0x5c91('0x22')]=function(_0x4da545,_0x593779){return db['ServicenowAccount'][_0x5c91('0x46')]({'where':{'id':_0x4da545[_0x5c91('0x42')]['id']}})[_0x5c91('0x23')](handleEntityNotFound(_0x593779,null))['then'](removeEntity(_0x593779,null))[_0x5c91('0x40')](handleError(_0x593779,null));};exports['getConfigurations']=function(_0x3bc4a1,_0x392765,_0x364f8f){var _0x5df4e6={};var _0x5fd8c5={};var _0x695fb3;var _0x4ee6c6;return db['ServicenowAccount'][_0x5c91('0x47')]({'where':{'id':_0x3bc4a1['params']['id']}})[_0x5c91('0x23')](handleEntityNotFound(_0x392765,null))[_0x5c91('0x23')](function(_0x2727f8){if(_0x2727f8){_0x695fb3=_0x2727f8;_0x5fd8c5['model']=_[_0x5c91('0x2e')](db[_0x5c91('0x48')][_0x5c91('0x2a')]);_0x5fd8c5[_0x5c91('0x2d')]=_[_0x5c91('0x2e')](_0x3bc4a1[_0x5c91('0x2d')]);_0x5fd8c5['filters']=_['intersection'](_0x5fd8c5[_0x5c91('0x30')],_0x5fd8c5[_0x5c91('0x2d')]);_0x5df4e6[_0x5c91('0x31')]=_['intersection'](_0x5fd8c5['model'],qs[_0x5c91('0x32')](_0x3bc4a1[_0x5c91('0x2d')][_0x5c91('0x32')]));_0x5df4e6[_0x5c91('0x31')]=_0x5df4e6[_0x5c91('0x31')][_0x5c91('0x33')]?_0x5df4e6['attributes']:_0x5fd8c5[_0x5c91('0x30')];_0x5df4e6['order']=qs['sort'](_0x3bc4a1['query'][_0x5c91('0x35')]);_0x5df4e6['where']=qs['filters'](_[_0x5c91('0x37')](_0x3bc4a1[_0x5c91('0x2d')],_0x5fd8c5['filters']));if(_0x3bc4a1['query'][_0x5c91('0x38')]){_0x5df4e6[_0x5c91('0x39')]=_[_0x5c91('0x3b')](_0x5df4e6[_0x5c91('0x39')],{'$or':_[_0x5c91('0x29')](_0x5df4e6['attributes'],function(_0x362cf2){var _0x31a0bd={};_0x31a0bd[_0x362cf2]={'$like':'%'+_0x3bc4a1[_0x5c91('0x2d')]['filter']+'%'};return _0x31a0bd;})});}_0x5df4e6=_[_0x5c91('0x3b')]({},_0x5df4e6,_0x3bc4a1[_0x5c91('0x43')]);return _0x695fb3[_0x5c91('0x49')](_0x5df4e6);}})[_0x5c91('0x23')](function(_0xd73b15){if(_0xd73b15){_0x4ee6c6=_0xd73b15[_0x5c91('0x33')];if(!_0x3bc4a1[_0x5c91('0x2d')][_0x5c91('0x4a')](_0x5c91('0x4b'))){_0x5df4e6[_0x5c91('0x1d')]=qs[_0x5c91('0x1d')](_0x3bc4a1[_0x5c91('0x2d')][_0x5c91('0x1d')]);_0x5df4e6['offset']=qs[_0x5c91('0x1c')](_0x3bc4a1[_0x5c91('0x2d')][_0x5c91('0x1c')]);}return _0x695fb3['getConfigurations'](_0x5df4e6);}})[_0x5c91('0x23')](function(_0x44f144){if(_0x44f144){return _0x44f144?{'count':_0x4ee6c6,'rows':_0x44f144}:null;}})[_0x5c91('0x23')](respondWithResult(_0x392765,null))[_0x5c91('0x40')](handleError(_0x392765,null));};exports[_0x5c91('0x4c')]=function(_0x48bffb,_0x51dac2,_0x43449e){if(_0x48bffb[_0x5c91('0x45')]['id']){delete _0x48bffb[_0x5c91('0x45')]['id'];}return db[_0x5c91('0x3c')]['findOne']({'where':{'id':_0x48bffb[_0x5c91('0x42')]['id']}})[_0x5c91('0x23')](handleEntityNotFound(_0x51dac2,null))[_0x5c91('0x23')](function(_0x58f3d3){if(_0x58f3d3){_0x48bffb['body'][_0x5c91('0x4d')]=_0x58f3d3['id'];_0x48bffb['body']['Subjects']=integrations[_0x5c91('0x4e')](_0x48bffb[_0x5c91('0x45')][_0x5c91('0x4f')],_0x48bffb['body'][_0x5c91('0x3a')]);_0x48bffb['body'][_0x5c91('0x50')]=integrations['getDescriptions'](_0x48bffb[_0x5c91('0x45')][_0x5c91('0x4f')],_0x48bffb['body'][_0x5c91('0x3a')]);return db[_0x5c91('0x48')][_0x5c91('0x44')](_0x48bffb['body'],{'include':[{'model':db[_0x5c91('0x51')],'as':_0x5c91('0x52')},{'model':db['ServicenowField'],'as':_0x5c91('0x50')}]});}return null;})[_0x5c91('0x23')](respondWithResult(_0x51dac2,null))[_0x5c91('0x40')](handleError(_0x51dac2,null));};exports[_0x5c91('0x53')]=function(_0x7e3e99,_0x103812,_0xa41ec9){var _0x4b4910=['made_sla',_0x5c91('0x54'),_0x5c91('0x55'),_0x5c91('0x56'),_0x5c91('0x57'),_0x5c91('0x58'),_0x5c91('0x59'),_0x5c91('0x5a'),'category'];var _0x170288=['parent',_0x5c91('0x5b'),'caused_by',_0x5c91('0x5c'),'upon_reject',_0x5c91('0x5d'),_0x5c91('0x5e'),_0x5c91('0x54'),_0x5c91('0x5f'),_0x5c91('0x60'),_0x5c91('0x61'),_0x5c91('0x62'),_0x5c91('0x63'),_0x5c91('0x64'),_0x5c91('0x65'),_0x5c91('0x66'),_0x5c91('0x67'),'sys_created_by',_0x5c91('0x55'),_0x5c91('0x34'),_0x5c91('0x68'),_0x5c91('0x69'),'cmdb_ci','delivery_plan',_0x5c91('0x6a'),_0x5c91('0x6b'),_0x5c91('0x6c'),_0x5c91('0x6d'),_0x5c91('0x6e'),_0x5c91('0x6f'),_0x5c91('0x70'),_0x5c91('0x71'),_0x5c91('0x72'),_0x5c91('0x73'),_0x5c91('0x74'),_0x5c91('0x75'),_0x5c91('0x76'),'reopened_time',_0x5c91('0x77'),_0x5c91('0x78'),_0x5c91('0x79'),_0x5c91('0x56'),_0x5c91('0x7a'),_0x5c91('0x7b'),_0x5c91('0x57'),_0x5c91('0x7c'),_0x5c91('0x7d'),_0x5c91('0x7e'),_0x5c91('0x7f'),_0x5c91('0x80'),_0x5c91('0x81'),_0x5c91('0x82'),_0x5c91('0x83'),'notify','sys_class_name',_0x5c91('0x84'),_0x5c91('0x85'),'follow_up',_0x5c91('0x86'),_0x5c91('0x87'),_0x5c91('0x88'),_0x5c91('0x89'),_0x5c91('0x59'),'urgency','problem_id',_0x5c91('0x8a'),'reassignment_count',_0x5c91('0x8b'),_0x5c91('0x8c'),_0x5c91('0x5a'),_0x5c91('0x8d'),_0x5c91('0x8e'),_0x5c91('0x8f'),_0x5c91('0x90'),_0x5c91('0x91'),_0x5c91('0x92'),_0x5c91('0x93'),_0x5c91('0x94'),'escalation','upon_approval','correlation_id',_0x5c91('0x95'),_0x5c91('0x96')];var _0x4bc54d='';var _0x5832a8='';var _0x11ec22=[];var _0x4dc8c8='';var _0x3cbe80='';var _0x1d3293=[];var _0x361737='';var _0x5e3b17='';var _0x5cfa90={};var _0x56084a='';return db['ServicenowAccount'][_0x5c91('0x47')]({'where':{'id':_0x7e3e99[_0x5c91('0x42')]['id']},'attributes':['id','username',_0x5c91('0x97'),_0x5c91('0x98'),_0x5c91('0x99'),_0x5c91('0x9a')]})[_0x5c91('0x23')](handleEntityNotFound(_0x103812,null))[_0x5c91('0x23')](function(_0x2feee8){if(_0x2feee8){_0x56084a=_0x2feee8[_0x5c91('0x99')];var _0x1883aa=_0x56084a[_0x5c91('0x9b')](-0x1);if(_0x1883aa==='/'){_0x56084a=_0x56084a[_0x5c91('0x9c')](0x0,_0x56084a[_0x5c91('0x9d')](_0x1883aa));}_0x5e3b17=util['format'](_0x5c91('0x9e'),_0x56084a);_0x361737=util[_0x5c91('0x9f')]('%s/api/now/table/',_0x56084a);_0x5cfa90={'user':_0x2feee8['username'],'pass':_0x2feee8['password']};var _0x16f41f={'method':'GET','uri':_0x5e3b17+_0x5c91('0xa0'),'auth':_0x5cfa90,'json':!![]};return rp(_0x16f41f);}})['then'](function(_0x126ef9){if(_0x126ef9['result'][_0x5c91('0x33')]>0x0){_0x4bc54d=_0x126ef9['result'];}console[_0x5c91('0xa1')](_0x5c91('0xa2'),_0x4bc54d);_0x1d3293=[];_0x5832a8=Object[_0x5c91('0xa3')]([],_0x4bc54d);_[_0x5c91('0xa4')](_0x5832a8,function(_0x1177ae){return!_0x4b4910['includes'](_0x1177ae['name']);});_0x5832a8[_0x5c91('0xa5')](function(_0x12b293){var _0x587139=createFieldObject(_0x361737,_0x5cfa90,_0x12b293[_0x5c91('0xa6')],_0x12b293[_0x5c91('0x26')],_0x12b293[_0x5c91('0xa7')],![]);_0x1d3293[_0x5c91('0xa8')](_0x587139);});return Promise[_0x5c91('0xa9')](_0x1d3293);})[_0x5c91('0x23')](function(_0x25e94c){_0x11ec22=_0x25e94c;_0x4dc8c8=Object[_0x5c91('0xa3')]([],_0x4bc54d);console['log'](_0x5c91('0xaa'),_0x4bc54d);_[_0x5c91('0xa4')](_0x4dc8c8,function(_0x27ae56){return _0x170288[_0x5c91('0xab')](_0x27ae56[_0x5c91('0x26')]);});console[_0x5c91('0xa1')](_0x5c91('0xac'),_0x4dc8c8);_0x1d3293=[];_0x4dc8c8[_0x5c91('0xa5')](function(_0x453422){var _0x58d347=createFieldObject(_0x361737,_0x5cfa90,_0x453422[_0x5c91('0xa6')],_0x453422[_0x5c91('0x26')],_0x453422[_0x5c91('0xa7')],!![]);_0x1d3293[_0x5c91('0xa8')](_0x58d347);});return Promise['all'](_0x1d3293);})[_0x5c91('0x23')](function(_0x219bb6){_0x3cbe80=_0x219bb6;var _0x842f60=_0x11ec22[_0x5c91('0xad')](_0x3cbe80);return{'count':_0x842f60[_0x5c91('0x33')],'rows':_0x842f60};})['then'](respondWithResult(_0x103812,null))[_0x5c91('0x40')](function(_0x2cb0ce){console[_0x5c91('0xa1')](_0x5c91('0xae')+_0x2cb0ce);var _0x42fdb3=_0x7e3e99[_0x5c91('0x2d')]['test']?0x1f4:_0x2cb0ce[_0x5c91('0xaf')]||0x1f4;logger['error'](_0x2cb0ce[_0x5c91('0x25')]);delete _0x2cb0ce['name'];if(_0x42fdb3===0x191){_0x42fdb3=0x190;}_0x103812[_0x5c91('0x18')](_0x42fdb3)[_0x5c91('0x27')](_0x7e3e99[_0x5c91('0x2d')][_0x5c91('0xb0')]?{'message':_0x5c91('0xb1'),'statusCode':_0x2cb0ce[_0x5c91('0xaf')]}:_0x2cb0ce);});};function createFieldObject(_0x4a572c,_0x4fc350,_0x100fcf,_0x2f4881,_0x4108e6,_0x5f2793){return new Promise(function(_0x39b8bf,_0x3b844f){var _0x1f7ac3={'id':_0x2f4881,'name':_0x4108e6,'custom':_0x5f2793};if(_0x100fcf===_0x5c91('0xb2')){_0x1f7ac3[_0x5c91('0x43')]=[{'name':_0x5c91('0xb3'),'value':_0x5c91('0xb4')},{'name':_0x5c91('0xb5'),'value':_0x5c91('0xb6')}];_0x39b8bf(_0x1f7ac3);}else{var _0x72bdaf={'method':_0x5c91('0xb7'),'uri':_0x4a572c+'sys_choice?sysparm_query=name=incident^element='+_0x2f4881,'auth':_0x4fc350,'json':!![]};return rp(_0x72bdaf)[_0x5c91('0x23')](function(_0x4986fd){var _0x3037a3=[];if(_0x4986fd[_0x5c91('0xb8')][_0x5c91('0x33')]>0x0){_0x4986fd[_0x5c91('0xb8')][_0x5c91('0xa5')](function(_0x1618e2){if(_0x1618e2[_0x5c91('0xb9')]===_0x5c91('0xb6')){var _0x1a7781={'name':_0x1618e2[_0x5c91('0xa7')],'value':_0x1618e2[_0x5c91('0xba')]};_0x3037a3['push'](_0x1a7781);}});}_0x1f7ac3[_0x5c91('0x43')]=_0x3037a3;if(_0x1f7ac3[_0x5c91('0x43')][_0x5c91('0x33')]>0x0){_0x39b8bf(_0x1f7ac3);}else{if(_0x5f2793==![]){_0x39b8bf();}else{_0x39b8bf(_0x1f7ac3);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6ba0444..8a5f447 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 _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x40b6cd,_0x19809d){var _0x5d4dac=function(_0x569615){while(--_0x569615){_0x40b6cd['push'](_0x40b6cd['shift']());}};_0x5d4dac(++_0x19809d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x14181c,_0x216dd5){_0x14181c=_0x14181c-0x0;var _0x5e06f5=_0xdbf5[_0x14181c];return _0x5e06f5;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','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 680b454..bf859ea 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 _0x0152=['ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c0038,_0x152425){var _0x42366a=function(_0x211609){while(--_0x211609){_0x3c0038['push'](_0x3c0038['shift']());}};_0x42366a(++_0x152425);}(_0x0152,0x1c3));var _0x2015=function(_0xaeccb4,_0x4d068b){_0xaeccb4=_0xaeccb4-0x0;var _0x41d1b0=_0x0152[_0xaeccb4];return _0x41d1b0;};'use strict';var _=require('lodash');var util=require(_0x2015('0x0'));var moment=require(_0x2015('0x1'));var BPromise=require(_0x2015('0x2'));var rs=require(_0x2015('0x3'));var fs=require('fs');var Redis=require(_0x2015('0x4'));var db=require(_0x2015('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2015('0x6'))('rpc');var config=require(_0x2015('0x7'));var jayson=require(_0x2015('0x8'));var client=jayson[_0x2015('0x9')][_0x2015('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa10b98,_0x4d9c1f,_0x22f066){return new BPromise(function(_0x542b84,_0x308682){return client[_0x2015('0xb')](_0xa10b98,_0x22f066)[_0x2015('0xc')](function(_0x2d4d30){logger[_0x2015('0xd')](_0x2015('0xe'),_0x4d9c1f,_0x2015('0xf'));logger[_0x2015('0x10')](_0x2015('0x11'),_0x4d9c1f,_0x2015('0xf'),JSON[_0x2015('0x12')](_0x2d4d30));if(_0x2d4d30[_0x2015('0x13')]){if(_0x2d4d30['error'][_0x2015('0x14')]===0x1f4){logger[_0x2015('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9c1f,_0x2d4d30['error'][_0x2015('0x15')]);return _0x308682(_0x2d4d30[_0x2015('0x13')]['message']);}logger[_0x2015('0x13')](_0x2015('0xe'),_0x4d9c1f,_0x2d4d30[_0x2015('0x13')][_0x2015('0x15')]);return _0x542b84(_0x2d4d30[_0x2015('0x13')][_0x2015('0x15')]);}else{logger['info'](_0x2015('0xe'),_0x4d9c1f,'request\x20sent');_0x542b84(_0x2d4d30['result'][_0x2015('0x15')]);}})[_0x2015('0x16')](function(_0x270e3a){logger[_0x2015('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9c1f,_0x270e3a);_0x308682(_0x270e3a);});});}exports[_0x2015('0x17')]=function(_0x3de401){var _0x3680a2=this;return new Promise(function(_0x3e8058,_0xd18333){return db[_0x2015('0x18')][_0x2015('0x19')]({'raw':_0x3de401[_0x2015('0x1a')]?_0x3de401[_0x2015('0x1a')][_0x2015('0x1b')]===undefined?!![]:![]:!![],'where':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1c')]||null:null,'attributes':_0x3de401[_0x2015('0x1a')]?_0x3de401[_0x2015('0x1a')][_0x2015('0x1d')]||null:null,'limit':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1e')]||null:null,'include':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1f')]?_['map'](_0x3de401[_0x2015('0x1a')]['include'],function(_0x146f21){return{'model':db[_0x146f21[_0x2015('0x20')]],'as':_0x146f21['as'],'attributes':_0x146f21[_0x2015('0x1d')],'include':_0x146f21[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x146f21[_0x2015('0x1f')],function(_0x3f49a3){return{'model':db[_0x3f49a3['model']],'as':_0x3f49a3['as'],'attributes':_0x3f49a3['attributes'],'include':_0x3f49a3[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x3f49a3['include'],function(_0x3d4c6a){return{'model':db[_0x3d4c6a[_0x2015('0x20')]],'as':_0x3d4c6a['as'],'attributes':_0x3d4c6a[_0x2015('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2015('0xc')](function(_0x501cc8){logger[_0x2015('0xd')]('GetServicenowAccount',_0x3de401);logger[_0x2015('0x10')](_0x2015('0x17'),_0x3de401,JSON[_0x2015('0x12')](_0x501cc8));_0x3e8058(_0x501cc8);})[_0x2015('0x16')](function(_0xa6b799){logger[_0x2015('0x13')](_0x2015('0x17'),_0xa6b799[_0x2015('0x15')],_0x3de401);_0xd18333(_0x3680a2[_0x2015('0x13')](0x1f4,_0xa6b799['message']));});});};exports[_0x2015('0x22')]=function(_0xa2fdd2){var _0x50b16e=this;return new Promise(function(_0x2b7fb1,_0x54208e){return db[_0x2015('0x18')][_0x2015('0x23')]({'raw':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2['options']['raw']===undefined?!![]:![]:!![],'where':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1c')]||null:null,'attributes':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')]['attributes']||null:null,'include':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1f')]?_[_0x2015('0x21')](_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1f')],function(_0x467d06){return{'model':db[_0x467d06[_0x2015('0x20')]],'as':_0x467d06['as'],'attributes':_0x467d06[_0x2015('0x1d')],'include':_0x467d06['include']?_[_0x2015('0x21')](_0x467d06[_0x2015('0x1f')],function(_0x5d6dd1){return{'model':db[_0x5d6dd1['model']],'as':_0x5d6dd1['as'],'attributes':_0x5d6dd1[_0x2015('0x1d')],'include':_0x5d6dd1[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x5d6dd1[_0x2015('0x1f')],function(_0x387130){return{'model':db[_0x387130[_0x2015('0x20')]],'as':_0x387130['as'],'attributes':_0x387130[_0x2015('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2015('0xc')](function(_0x2c6997){logger[_0x2015('0xd')](_0x2015('0x22'),_0xa2fdd2);logger[_0x2015('0x10')](_0x2015('0x22'),_0xa2fdd2,JSON[_0x2015('0x12')](_0x2c6997));_0x2b7fb1(_0x2c6997);})[_0x2015('0x16')](function(_0x5c552f){logger[_0x2015('0x13')](_0x2015('0x22'),_0x5c552f[_0x2015('0x15')],_0xa2fdd2);_0x54208e(_0x50b16e[_0x2015('0x13')](0x1f4,_0x5c552f['message']));});});}; \ No newline at end of file +var _0x076a=['jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x550826,_0x2dd991){var _0x47ad2d=function(_0x395455){while(--_0x395455){_0x550826['push'](_0x550826['shift']());}};_0x47ad2d(++_0x2dd991);}(_0x076a,0x1be));var _0xa076=function(_0xe67e22,_0x547e07){_0xe67e22=_0xe67e22-0x0;var _0x39ff12=_0x076a[_0xe67e22];return _0x39ff12;};'use strict';var _=require(_0xa076('0x0'));var util=require(_0xa076('0x1'));var moment=require(_0xa076('0x2'));var BPromise=require(_0xa076('0x3'));var rs=require(_0xa076('0x4'));var fs=require('fs');var Redis=require(_0xa076('0x5'));var db=require(_0xa076('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa076('0x7'))(_0xa076('0x8'));var config=require(_0xa076('0x9'));var jayson=require(_0xa076('0xa'));var client=jayson[_0xa076('0xb')][_0xa076('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2267d9,_0x36910a,_0x1f2204){return new BPromise(function(_0x2425c5,_0x32d6a1){return client['request'](_0x2267d9,_0x1f2204)[_0xa076('0xd')](function(_0xeccbf9){logger[_0xa076('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x36910a,_0xa076('0xf'));logger[_0xa076('0x10')](_0xa076('0x11'),_0x36910a,_0xa076('0xf'),JSON[_0xa076('0x12')](_0xeccbf9));if(_0xeccbf9[_0xa076('0x13')]){if(_0xeccbf9['error'][_0xa076('0x14')]===0x1f4){logger[_0xa076('0x13')](_0xa076('0x15'),_0x36910a,_0xeccbf9[_0xa076('0x13')][_0xa076('0x16')]);return _0x32d6a1(_0xeccbf9['error'][_0xa076('0x16')]);}logger['error'](_0xa076('0x15'),_0x36910a,_0xeccbf9[_0xa076('0x13')]['message']);return _0x2425c5(_0xeccbf9[_0xa076('0x13')][_0xa076('0x16')]);}else{logger[_0xa076('0xe')](_0xa076('0x15'),_0x36910a,_0xa076('0xf'));_0x2425c5(_0xeccbf9[_0xa076('0x17')][_0xa076('0x16')]);}})[_0xa076('0x18')](function(_0x5778ea){logger[_0xa076('0x13')](_0xa076('0x15'),_0x36910a,_0x5778ea);_0x32d6a1(_0x5778ea);});});}exports[_0xa076('0x19')]=function(_0x33ebee){var _0x4a67bb=this;return new Promise(function(_0x593af1,_0x3aaf53){return db[_0xa076('0x1a')][_0xa076('0x1b')]({'raw':_0x33ebee[_0xa076('0x1c')]?_0x33ebee[_0xa076('0x1c')][_0xa076('0x1d')]===undefined?!![]:![]:!![],'where':_0x33ebee['options']?_0x33ebee[_0xa076('0x1c')]['where']||null:null,'attributes':_0x33ebee[_0xa076('0x1c')]?_0x33ebee[_0xa076('0x1c')][_0xa076('0x1e')]||null:null,'limit':_0x33ebee[_0xa076('0x1c')]?_0x33ebee[_0xa076('0x1c')][_0xa076('0x1f')]||null:null,'include':_0x33ebee[_0xa076('0x1c')]?_0x33ebee[_0xa076('0x1c')][_0xa076('0x20')]?_[_0xa076('0x21')](_0x33ebee[_0xa076('0x1c')][_0xa076('0x20')],function(_0x20ab74){return{'model':db[_0x20ab74['model']],'as':_0x20ab74['as'],'attributes':_0x20ab74['attributes'],'include':_0x20ab74[_0xa076('0x20')]?_[_0xa076('0x21')](_0x20ab74[_0xa076('0x20')],function(_0x1f2701){return{'model':db[_0x1f2701['model']],'as':_0x1f2701['as'],'attributes':_0x1f2701[_0xa076('0x1e')],'include':_0x1f2701['include']?_['map'](_0x1f2701['include'],function(_0x56775a){return{'model':db[_0x56775a[_0xa076('0x22')]],'as':_0x56775a['as'],'attributes':_0x56775a[_0xa076('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa076('0xd')](function(_0x1ac982){logger[_0xa076('0xe')]('GetServicenowAccount',_0x33ebee);logger[_0xa076('0x10')](_0xa076('0x19'),_0x33ebee,JSON[_0xa076('0x12')](_0x1ac982));_0x593af1(_0x1ac982);})[_0xa076('0x18')](function(_0x589a53){logger[_0xa076('0x13')]('GetServicenowAccount',_0x589a53['message'],_0x33ebee);_0x3aaf53(_0x4a67bb[_0xa076('0x13')](0x1f4,_0x589a53[_0xa076('0x16')]));});});};exports['ShowServicenowAccount']=function(_0x1327bb){var _0x8dc7ee=this;return new Promise(function(_0x50999d,_0x3f6490){return db[_0xa076('0x1a')][_0xa076('0x23')]({'raw':_0x1327bb[_0xa076('0x1c')]?_0x1327bb[_0xa076('0x1c')][_0xa076('0x1d')]===undefined?!![]:![]:!![],'where':_0x1327bb['options']?_0x1327bb[_0xa076('0x1c')][_0xa076('0x24')]||null:null,'attributes':_0x1327bb[_0xa076('0x1c')]?_0x1327bb['options']['attributes']||null:null,'include':_0x1327bb['options']?_0x1327bb[_0xa076('0x1c')]['include']?_[_0xa076('0x21')](_0x1327bb[_0xa076('0x1c')]['include'],function(_0x49b24f){return{'model':db[_0x49b24f[_0xa076('0x22')]],'as':_0x49b24f['as'],'attributes':_0x49b24f[_0xa076('0x1e')],'include':_0x49b24f[_0xa076('0x20')]?_[_0xa076('0x21')](_0x49b24f[_0xa076('0x20')],function(_0x40c694){return{'model':db[_0x40c694[_0xa076('0x22')]],'as':_0x40c694['as'],'attributes':_0x40c694[_0xa076('0x1e')],'include':_0x40c694['include']?_[_0xa076('0x21')](_0x40c694[_0xa076('0x20')],function(_0x4f23dd){return{'model':db[_0x4f23dd[_0xa076('0x22')]],'as':_0x4f23dd['as'],'attributes':_0x4f23dd[_0xa076('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa076('0xd')](function(_0x59c3ca){logger['info'](_0xa076('0x25'),_0x1327bb);logger[_0xa076('0x10')](_0xa076('0x25'),_0x1327bb,JSON['stringify'](_0x59c3ca));_0x50999d(_0x59c3ca);})[_0xa076('0x18')](function(_0x2eb42f){logger[_0xa076('0x13')](_0xa076('0x25'),_0x2eb42f[_0xa076('0x16')],_0x1327bb);_0x3f6490(_0x8dc7ee[_0xa076('0x13')](0x1f4,_0x2eb42f[_0xa076('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a6f498b..df5545d 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 _0x523e=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x3d1eb3,_0x3ffab4){var _0x5c4d25=function(_0x50ec32){while(--_0x50ec32){_0x3d1eb3['push'](_0x3d1eb3['shift']());}};_0x5c4d25(++_0x3ffab4);}(_0x523e,0x96));var _0xe523=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x523e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0xe523('0x0'));var path=require('path');var timeout=require(_0xe523('0x1'));var express=require(_0xe523('0x2'));var router=express[_0xe523('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe523('0x4'));var interaction=require(_0xe523('0x5'));var config=require(_0xe523('0x6'));var controller=require(_0xe523('0x7'));router[_0xe523('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe523('0x9'),auth[_0xe523('0xa')](),controller[_0xe523('0xb')]);router[_0xe523('0x8')](_0xe523('0xc'),auth[_0xe523('0xa')](),controller[_0xe523('0xd')]);router[_0xe523('0x8')](_0xe523('0xe'),auth[_0xe523('0xa')](),controller['getSubjects']);router[_0xe523('0x8')](_0xe523('0xf'),auth[_0xe523('0xa')](),controller[_0xe523('0x10')]);router[_0xe523('0x11')]('/',auth['isAuthenticated'](),controller[_0xe523('0x12')]);router['put'](_0xe523('0x9'),auth['isAuthenticated'](),controller[_0xe523('0x13')]);router[_0xe523('0x14')](_0xe523('0x9'),auth[_0xe523('0xa')](),controller[_0xe523('0x15')]);module[_0xe523('0x16')]=router; \ No newline at end of file +var _0x7024=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7024,0x122));var _0x4702=function(_0x5eb488,_0x2bef45){_0x5eb488=_0x5eb488-0x0;var _0x43fb55=_0x7024[_0x5eb488];return _0x43fb55;};'use strict';var multer=require('multer');var util=require(_0x4702('0x0'));var path=require(_0x4702('0x1'));var timeout=require(_0x4702('0x2'));var express=require(_0x4702('0x3'));var router=express[_0x4702('0x4')]();var fs_extra=require(_0x4702('0x5'));var auth=require(_0x4702('0x6'));var interaction=require(_0x4702('0x7'));var config=require('../../config/environment');var controller=require(_0x4702('0x8'));router[_0x4702('0x9')]('/',auth['isAuthenticated'](),controller[_0x4702('0xa')]);router[_0x4702('0x9')]('/:id',auth[_0x4702('0xb')](),controller[_0x4702('0xc')]);router[_0x4702('0x9')](_0x4702('0xd'),auth[_0x4702('0xb')](),controller[_0x4702('0xe')]);router[_0x4702('0x9')](_0x4702('0xf'),auth['isAuthenticated'](),controller[_0x4702('0x10')]);router['get'](_0x4702('0x11'),auth[_0x4702('0xb')](),controller[_0x4702('0x12')]);router[_0x4702('0x13')]('/',auth[_0x4702('0xb')](),controller['create']);router[_0x4702('0x14')](_0x4702('0x15'),auth[_0x4702('0xb')](),controller['update']);router[_0x4702('0x16')](_0x4702('0x15'),auth[_0x4702('0xb')](),controller[_0x4702('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5c6163f..2d13bc5 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 _0x872f=['sequelize','exports','STRING'];(function(_0x29da57,_0x93718d){var _0x532a28=function(_0x2c380a){while(--_0x2c380a){_0x29da57['push'](_0x29da57['shift']());}};_0x532a28(++_0x93718d);}(_0x872f,0x84));var _0xf872=function(_0x47c9d1,_0x2bb28c){_0x47c9d1=_0x47c9d1-0x0;var _0x5d54f3=_0x872f[_0x47c9d1];return _0x5d54f3;};'use strict';var Sequelize=require(_0xf872('0x0'));module[_0xf872('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf872('0x2')]}}; \ No newline at end of file +var _0x03f5=['STRING','sequelize','exports'];(function(_0x3a5048,_0x3033e8){var _0x451c75=function(_0x216604){while(--_0x216604){_0x3a5048['push'](_0x3a5048['shift']());}};_0x451c75(++_0x3033e8);}(_0x03f5,0x88));var _0x503f=function(_0xc706e1,_0x543e4c){_0xc706e1=_0xc706e1-0x0;var _0x57d1ae=_0x03f5[_0xc706e1];return _0x57d1ae;};'use strict';var Sequelize=require(_0x503f('0x0'));module[_0x503f('0x1')]={'name':{'type':Sequelize[_0x503f('0x2')]},'description':{'type':Sequelize[_0x503f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1ab530e..a7df201 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 _0xbbdf=['findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','error','stack','name','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getFields','order','nolimit','ServicenowField','getSubjects','getDescriptions'];(function(_0xcdb024,_0x48c364){var _0x386966=function(_0x147d12){while(--_0x147d12){_0xcdb024['push'](_0xcdb024['shift']());}};_0x386966(++_0x48c364);}(_0xbbdf,0xeb));var _0xfbbd=function(_0x5744df,_0x30c6cf){_0x5744df=_0x5744df-0x0;var _0xa3fd93=_0xbbdf[_0x5744df];return _0xa3fd93;};'use strict';var emlformat=require(_0xfbbd('0x0'));var rimraf=require(_0xfbbd('0x1'));var zipdir=require(_0xfbbd('0x2'));var jsonpatch=require(_0xfbbd('0x3'));var rp=require(_0xfbbd('0x4'));var moment=require(_0xfbbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbbd('0x6'));var util=require('util');var path=require(_0xfbbd('0x7'));var sox=require(_0xfbbd('0x8'));var csv=require(_0xfbbd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbbd('0xa'));var _=require(_0xfbbd('0xb'));var squel=require(_0xfbbd('0xc'));var crypto=require('crypto');var jsforce=require(_0xfbbd('0xd'));var deskjs=require(_0xfbbd('0xe'));var toCsv=require(_0xfbbd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfbbd('0xf'));var qs=require(_0xfbbd('0x10'));var as=require(_0xfbbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbbd('0x12'))(_0xfbbd('0x13'));var utils=require(_0xfbbd('0x14'));var config=require(_0xfbbd('0x15'));var licenseUtil=require(_0xfbbd('0x16'));var db=require(_0xfbbd('0x17'))['db'];function respondWithStatusCode(_0x5f65ce,_0x4ca0cf){_0x4ca0cf=_0x4ca0cf||0xcc;return function(_0x39f03d){if(_0x39f03d){return _0x5f65ce[_0xfbbd('0x18')](_0x4ca0cf);}return _0x5f65ce[_0xfbbd('0x19')](_0x4ca0cf)[_0xfbbd('0x1a')]();};}function respondWithResult(_0x46368a,_0x91cc4e){_0x91cc4e=_0x91cc4e||0xc8;return function(_0x185bb8){if(_0x185bb8){return _0x46368a[_0xfbbd('0x19')](_0x91cc4e)[_0xfbbd('0x1b')](_0x185bb8);}};}function respondWithFilteredResult(_0x33a362,_0x1f7f49){return function(_0x1dc389){if(_0x1dc389){var _0x4f534e=typeof _0x1f7f49[_0xfbbd('0x1c')]===_0xfbbd('0x1d')&&typeof _0x1f7f49[_0xfbbd('0x1e')]===_0xfbbd('0x1d');var _0x301b12=_0x1dc389[_0xfbbd('0x1f')];var _0x218400=_0x4f534e?0x0:_0x1f7f49[_0xfbbd('0x1c')];var _0x254f49=_0x4f534e?_0x1dc389['count']:_0x1f7f49['offset']+_0x1f7f49['limit'];var _0x11eb6d;if(_0x254f49>=_0x301b12){_0x254f49=_0x301b12;_0x11eb6d=0xc8;}else{_0x11eb6d=0xce;}_0x33a362['status'](_0x11eb6d);return _0x33a362['set'](_0xfbbd('0x20'),_0x218400+'-'+_0x254f49+'/'+_0x301b12)[_0xfbbd('0x1b')](_0x1dc389);}return null;};}function patchUpdates(_0x3e06ae){return function(_0x5d33a6){try{jsonpatch['apply'](_0x5d33a6,_0x3e06ae,!![]);}catch(_0x1577c3){return BPromise[_0xfbbd('0x21')](_0x1577c3);}return _0x5d33a6['save']();};}function saveUpdates(_0x59db91,_0x5b4d32){return function(_0x4d95c4){if(_0x4d95c4){return _0x4d95c4['update'](_0x59db91)[_0xfbbd('0x22')](function(_0x4e447a){return _0x4e447a;});}return null;};}function removeEntity(_0x204c03,_0x2650c6){return function(_0x148d21){if(_0x148d21){return _0x148d21['destroy']()[_0xfbbd('0x22')](function(){_0x204c03['status'](0xcc)[_0xfbbd('0x1a')]();});}};}function handleEntityNotFound(_0x31fcf6,_0x1f9908){return function(_0x55e64f){if(!_0x55e64f){_0x31fcf6[_0xfbbd('0x18')](0x194);}return _0x55e64f;};}function handleError(_0x4daa04,_0x25be57){_0x25be57=_0x25be57||0x1f4;return function(_0x48d3cb){logger[_0xfbbd('0x23')](_0x48d3cb[_0xfbbd('0x24')]);if(_0x48d3cb[_0xfbbd('0x25')]){delete _0x48d3cb[_0xfbbd('0x25')];}_0x4daa04[_0xfbbd('0x19')](_0x25be57)['send'](_0x48d3cb);};}exports['index']=function(_0x2541c8,_0x5bd48d){var _0x427d4a={},_0x2bdabb={},_0x2db4f6={'count':0x0,'rows':[]};var _0x1656be=_[_0xfbbd('0x26')](db[_0xfbbd('0x27')]['rawAttributes'],function(_0x18644b){return{'name':_0x18644b[_0xfbbd('0x28')],'type':_0x18644b[_0xfbbd('0x29')][_0xfbbd('0x2a')]};});_0x2bdabb[_0xfbbd('0x2b')]=_[_0xfbbd('0x26')](_0x1656be,_0xfbbd('0x25'));_0x2bdabb[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x2541c8[_0xfbbd('0x2c')]);_0x2bdabb[_0xfbbd('0x2e')]=_[_0xfbbd('0x2f')](_0x2bdabb[_0xfbbd('0x2b')],_0x2bdabb[_0xfbbd('0x2c')]);_0x427d4a[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x2bdabb[_0xfbbd('0x2b')],qs[_0xfbbd('0x31')](_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x31')]));_0x427d4a[_0xfbbd('0x30')]=_0x427d4a[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x427d4a['attributes']:_0x2bdabb[_0xfbbd('0x2b')];if(!_0x2541c8['query'][_0xfbbd('0x33')]('nolimit')){_0x427d4a['limit']=qs[_0xfbbd('0x1e')](_0x2541c8[_0xfbbd('0x2c')]['limit']);_0x427d4a[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0x2541c8[_0xfbbd('0x2c')]['offset']);}_0x427d4a['order']=qs[_0xfbbd('0x34')](_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x34')]);_0x427d4a[_0xfbbd('0x35')]=qs[_0xfbbd('0x2e')](_[_0xfbbd('0x36')](_0x2541c8[_0xfbbd('0x2c')],_0x2bdabb[_0xfbbd('0x2e')]),_0x1656be);if(_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x37')]){_0x427d4a['where']=_[_0xfbbd('0x38')](_0x427d4a['where'],{'$or':_[_0xfbbd('0x26')](_0x1656be,function(_0x127143){if(_0x127143['type']!==_0xfbbd('0x39')){var _0x37d675={};_0x37d675[_0x127143['name']]={'$like':'%'+_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x37d675;}})});}_0x427d4a=_[_0xfbbd('0x38')]({},_0x427d4a,_0x2541c8[_0xfbbd('0x3a')]);var _0x36bae5={'where':_0x427d4a[_0xfbbd('0x35')]};return db[_0xfbbd('0x27')]['count'](_0x36bae5)['then'](function(_0x56aa5b){_0x2db4f6[_0xfbbd('0x1f')]=_0x56aa5b;if(_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x3b')]){_0x427d4a[_0xfbbd('0x3c')]=[{'all':!![]}];}return db[_0xfbbd('0x27')][_0xfbbd('0x3d')](_0x427d4a);})[_0xfbbd('0x22')](function(_0x250cbf){_0x2db4f6[_0xfbbd('0x3e')]=_0x250cbf;return _0x2db4f6;})[_0xfbbd('0x22')](respondWithFilteredResult(_0x5bd48d,_0x427d4a))[_0xfbbd('0x3f')](handleError(_0x5bd48d,null));};exports[_0xfbbd('0x40')]=function(_0x2e232d,_0x3501ef){var _0x312685={'raw':![],'where':{'id':_0x2e232d[_0xfbbd('0x41')]['id']}},_0x29aaa7={};_0x29aaa7[_0xfbbd('0x2b')]=_[_0xfbbd('0x2d')](db[_0xfbbd('0x27')][_0xfbbd('0x42')]);_0x29aaa7[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x2e232d[_0xfbbd('0x2c')]);_0x29aaa7[_0xfbbd('0x2e')]=_['intersection'](_0x29aaa7[_0xfbbd('0x2b')],_0x29aaa7[_0xfbbd('0x2c')]);_0x312685[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x29aaa7['model'],qs['fields'](_0x2e232d['query'][_0xfbbd('0x31')]));_0x312685[_0xfbbd('0x30')]=_0x312685[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x312685[_0xfbbd('0x30')]:_0x29aaa7[_0xfbbd('0x2b')];if(_0x2e232d['query'][_0xfbbd('0x3b')]){_0x312685[_0xfbbd('0x3c')]=[{'all':!![]}];}_0x312685=_[_0xfbbd('0x38')]({},_0x312685,_0x2e232d[_0xfbbd('0x3a')]);return db[_0xfbbd('0x27')][_0xfbbd('0x43')](_0x312685)[_0xfbbd('0x22')](handleEntityNotFound(_0x3501ef,null))[_0xfbbd('0x22')](respondWithResult(_0x3501ef,null))[_0xfbbd('0x3f')](handleError(_0x3501ef,null));};exports['create']=function(_0x212624,_0x12238e){return db[_0xfbbd('0x27')][_0xfbbd('0x44')](_0x212624['body'],{})[_0xfbbd('0x22')](respondWithResult(_0x12238e,0xc9))[_0xfbbd('0x3f')](handleError(_0x12238e,null));};exports[_0xfbbd('0x45')]=function(_0xf29754,_0xf902b5){if(_0xf29754[_0xfbbd('0x46')]['id']){delete _0xf29754['body']['id'];}return db[_0xfbbd('0x27')][_0xfbbd('0x43')]({'where':{'id':_0xf29754[_0xfbbd('0x41')]['id']}})['then'](handleEntityNotFound(_0xf902b5,null))[_0xfbbd('0x22')](saveUpdates(_0xf29754[_0xfbbd('0x46')],null))[_0xfbbd('0x22')](respondWithResult(_0xf902b5,null))['catch'](handleError(_0xf902b5,null));};exports['destroy']=function(_0x4171b7,_0x2d2ccc){return db[_0xfbbd('0x27')][_0xfbbd('0x43')]({'where':{'id':_0x4171b7[_0xfbbd('0x41')]['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x2d2ccc,null))[_0xfbbd('0x22')](removeEntity(_0x2d2ccc,null))['catch'](handleError(_0x2d2ccc,null));};exports[_0xfbbd('0x47')]=function(_0x14a921,_0x122f11,_0x1a07d6){var _0x2704db={};var _0x4887fc={};var _0x38758b;var _0x2ed7f0;return db[_0xfbbd('0x27')]['findOne']({'where':{'id':_0x14a921['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x122f11,null))[_0xfbbd('0x22')](function(_0x3a1d4d){if(_0x3a1d4d){_0x38758b=_0x3a1d4d;_0x4887fc[_0xfbbd('0x2b')]=_['keys'](db['ServicenowField'][_0xfbbd('0x42')]);_0x4887fc[_0xfbbd('0x2c')]=_['keys'](_0x14a921[_0xfbbd('0x2c')]);_0x4887fc['filters']=_['intersection'](_0x4887fc['model'],_0x4887fc[_0xfbbd('0x2c')]);_0x2704db['attributes']=_['intersection'](_0x4887fc[_0xfbbd('0x2b')],qs[_0xfbbd('0x31')](_0x14a921[_0xfbbd('0x2c')]['fields']));_0x2704db[_0xfbbd('0x30')]=_0x2704db['attributes']['length']?_0x2704db['attributes']:_0x4887fc[_0xfbbd('0x2b')];_0x2704db[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0x14a921['query']['sort']);_0x2704db['where']=qs[_0xfbbd('0x2e')](_['pick'](_0x14a921[_0xfbbd('0x2c')],_0x4887fc[_0xfbbd('0x2e')]));if(_0x14a921[_0xfbbd('0x2c')][_0xfbbd('0x37')]){_0x2704db[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x2704db[_0xfbbd('0x35')],{'$or':_['map'](_0x2704db[_0xfbbd('0x30')],function(_0x48152b){var _0x4aafed={};_0x4aafed[_0x48152b]={'$like':'%'+_0x14a921['query'][_0xfbbd('0x37')]+'%'};return _0x4aafed;})});}_0x2704db=_['merge']({},_0x2704db,_0x14a921[_0xfbbd('0x3a')]);return _0x38758b[_0xfbbd('0x47')](_0x2704db);}})[_0xfbbd('0x22')](function(_0x129854){if(_0x129854){_0x2ed7f0=_0x129854[_0xfbbd('0x32')];if(!_0x14a921[_0xfbbd('0x2c')]['hasOwnProperty'](_0xfbbd('0x49'))){_0x2704db[_0xfbbd('0x1e')]=qs['limit'](_0x14a921[_0xfbbd('0x2c')]['limit']);_0x2704db[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0x14a921[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x38758b['getFields'](_0x2704db);}})[_0xfbbd('0x22')](function(_0x5a4583){if(_0x5a4583){return _0x5a4583?{'count':_0x2ed7f0,'rows':_0x5a4583}:null;}})[_0xfbbd('0x22')](respondWithResult(_0x122f11,null))[_0xfbbd('0x3f')](handleError(_0x122f11,null));};exports['getSubjects']=function(_0xdffdb7,_0x42223a,_0x395418){var _0x1b9a96={};var _0x5e5a6f={};var _0x3b3bf5;var _0x297fe6;return db[_0xfbbd('0x27')]['findOne']({'where':{'id':_0xdffdb7['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x42223a,null))[_0xfbbd('0x22')](function(_0x1df2bf){if(_0x1df2bf){_0x3b3bf5=_0x1df2bf;_0x5e5a6f[_0xfbbd('0x2b')]=_['keys'](db[_0xfbbd('0x4a')]['rawAttributes']);_0x5e5a6f[_0xfbbd('0x2c')]=_['keys'](_0xdffdb7[_0xfbbd('0x2c')]);_0x5e5a6f[_0xfbbd('0x2e')]=_['intersection'](_0x5e5a6f['model'],_0x5e5a6f[_0xfbbd('0x2c')]);_0x1b9a96['attributes']=_[_0xfbbd('0x2f')](_0x5e5a6f[_0xfbbd('0x2b')],qs['fields'](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x31')]));_0x1b9a96[_0xfbbd('0x30')]=_0x1b9a96[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x1b9a96[_0xfbbd('0x30')]:_0x5e5a6f[_0xfbbd('0x2b')];_0x1b9a96[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0xdffdb7['query'][_0xfbbd('0x34')]);_0x1b9a96[_0xfbbd('0x35')]=qs['filters'](_[_0xfbbd('0x36')](_0xdffdb7[_0xfbbd('0x2c')],_0x5e5a6f[_0xfbbd('0x2e')]));if(_0xdffdb7['query'][_0xfbbd('0x37')]){_0x1b9a96[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x1b9a96[_0xfbbd('0x35')],{'$or':_[_0xfbbd('0x26')](_0x1b9a96[_0xfbbd('0x30')],function(_0x7d755b){var _0x5b85f6={};_0x5b85f6[_0x7d755b]={'$like':'%'+_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x5b85f6;})});}_0x1b9a96=_[_0xfbbd('0x38')]({},_0x1b9a96,_0xdffdb7['options']);return _0x3b3bf5[_0xfbbd('0x4b')](_0x1b9a96);}})[_0xfbbd('0x22')](function(_0x4b8e01){if(_0x4b8e01){_0x297fe6=_0x4b8e01['length'];if(!_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x33')]('nolimit')){_0x1b9a96[_0xfbbd('0x1e')]=qs['limit'](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x1e')]);_0x1b9a96[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x3b3bf5[_0xfbbd('0x4b')](_0x1b9a96);}})['then'](function(_0x1edddf){if(_0x1edddf){return _0x1edddf?{'count':_0x297fe6,'rows':_0x1edddf}:null;}})[_0xfbbd('0x22')](respondWithResult(_0x42223a,null))[_0xfbbd('0x3f')](handleError(_0x42223a,null));};exports[_0xfbbd('0x4c')]=function(_0x1f14f3,_0x40510a,_0x37db4c){var _0x5dffba={};var _0x1db7c7={};var _0x3c0f4d;var _0x484580;return db['ServicenowConfiguration'][_0xfbbd('0x4d')]({'where':{'id':_0x1f14f3['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x40510a,null))[_0xfbbd('0x22')](function(_0x4e37ad){if(_0x4e37ad){_0x3c0f4d=_0x4e37ad;_0x1db7c7[_0xfbbd('0x2b')]=_[_0xfbbd('0x2d')](db['ServicenowField'][_0xfbbd('0x42')]);_0x1db7c7[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x1f14f3[_0xfbbd('0x2c')]);_0x1db7c7[_0xfbbd('0x2e')]=_['intersection'](_0x1db7c7[_0xfbbd('0x2b')],_0x1db7c7[_0xfbbd('0x2c')]);_0x5dffba[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x1db7c7['model'],qs[_0xfbbd('0x31')](_0x1f14f3['query'][_0xfbbd('0x31')]));_0x5dffba['attributes']=_0x5dffba[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x5dffba[_0xfbbd('0x30')]:_0x1db7c7['model'];_0x5dffba[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x34')]);_0x5dffba[_0xfbbd('0x35')]=qs['filters'](_['pick'](_0x1f14f3['query'],_0x1db7c7[_0xfbbd('0x2e')]));if(_0x1f14f3['query'][_0xfbbd('0x37')]){_0x5dffba[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x5dffba[_0xfbbd('0x35')],{'$or':_[_0xfbbd('0x26')](_0x5dffba['attributes'],function(_0x106670){var _0x28dcf7={};_0x28dcf7[_0x106670]={'$like':'%'+_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x28dcf7;})});}_0x5dffba=_['merge']({},_0x5dffba,_0x1f14f3[_0xfbbd('0x3a')]);return _0x3c0f4d[_0xfbbd('0x4c')](_0x5dffba);}})[_0xfbbd('0x22')](function(_0x4ca8d8){if(_0x4ca8d8){_0x484580=_0x4ca8d8['length'];if(!_0x1f14f3[_0xfbbd('0x2c')]['hasOwnProperty']('nolimit')){_0x5dffba[_0xfbbd('0x1e')]=qs[_0xfbbd('0x1e')](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x1e')]);_0x5dffba[_0xfbbd('0x1c')]=qs['offset'](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x3c0f4d[_0xfbbd('0x4c')](_0x5dffba);}})[_0xfbbd('0x22')](function(_0x1af07f){if(_0x1af07f){return _0x1af07f?{'count':_0x484580,'rows':_0x1af07f}:null;}})['then'](respondWithResult(_0x40510a,null))[_0xfbbd('0x3f')](handleError(_0x40510a,null));}; \ No newline at end of file +var _0x12cd=['nolimit','order','where','merge','options','includeAll','findAll','rows','show','rawAttributes','include','find','catch','body','params','getFields','findOne','ServicenowField','sort','pick','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12cd,0xb7));var _0xd12c=function(_0x13bc50,_0x52ee92){_0x13bc50=_0x13bc50-0x0;var _0x146c75=_0x12cd[_0x13bc50];return _0x146c75;};'use strict';var emlformat=require(_0xd12c('0x0'));var rimraf=require(_0xd12c('0x1'));var zipdir=require(_0xd12c('0x2'));var jsonpatch=require(_0xd12c('0x3'));var rp=require(_0xd12c('0x4'));var moment=require(_0xd12c('0x5'));var BPromise=require(_0xd12c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd12c('0x7'));var sox=require(_0xd12c('0x8'));var csv=require(_0xd12c('0x9'));var ejs=require(_0xd12c('0xa'));var fs=require('fs');var fs_extra=require(_0xd12c('0xb'));var _=require('lodash');var squel=require(_0xd12c('0xc'));var crypto=require(_0xd12c('0xd'));var jsforce=require(_0xd12c('0xe'));var deskjs=require(_0xd12c('0xf'));var toCsv=require(_0xd12c('0x9'));var querystring=require(_0xd12c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd12c('0x11'));var as=require(_0xd12c('0x12'));var hardwareService=require(_0xd12c('0x13'));var logger=require('../../config/logger')(_0xd12c('0x14'));var utils=require('../../config/utils');var config=require(_0xd12c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd12c('0x16'))['db'];function respondWithStatusCode(_0x10f18b,_0x31dc6c){_0x31dc6c=_0x31dc6c||0xcc;return function(_0x1a779a){if(_0x1a779a){return _0x10f18b[_0xd12c('0x17')](_0x31dc6c);}return _0x10f18b[_0xd12c('0x18')](_0x31dc6c)[_0xd12c('0x19')]();};}function respondWithResult(_0xd47e0d,_0x5278f7){_0x5278f7=_0x5278f7||0xc8;return function(_0x567bf3){if(_0x567bf3){return _0xd47e0d[_0xd12c('0x18')](_0x5278f7)['json'](_0x567bf3);}};}function respondWithFilteredResult(_0x57aa1f,_0x7e722){return function(_0x47cd72){if(_0x47cd72){var _0x321630=typeof _0x7e722['offset']===_0xd12c('0x1a')&&typeof _0x7e722['limit']===_0xd12c('0x1a');var _0x56f8e1=_0x47cd72['count'];var _0x520a31=_0x321630?0x0:_0x7e722[_0xd12c('0x1b')];var _0x18b0cf=_0x321630?_0x47cd72[_0xd12c('0x1c')]:_0x7e722[_0xd12c('0x1b')]+_0x7e722[_0xd12c('0x1d')];var _0x38d53f;if(_0x18b0cf>=_0x56f8e1){_0x18b0cf=_0x56f8e1;_0x38d53f=0xc8;}else{_0x38d53f=0xce;}_0x57aa1f[_0xd12c('0x18')](_0x38d53f);return _0x57aa1f[_0xd12c('0x1e')](_0xd12c('0x1f'),_0x520a31+'-'+_0x18b0cf+'/'+_0x56f8e1)[_0xd12c('0x20')](_0x47cd72);}return null;};}function patchUpdates(_0x4568b3){return function(_0x4ac3f){try{jsonpatch[_0xd12c('0x21')](_0x4ac3f,_0x4568b3,!![]);}catch(_0x205d55){return BPromise[_0xd12c('0x22')](_0x205d55);}return _0x4ac3f[_0xd12c('0x23')]();};}function saveUpdates(_0x21e8dd,_0x439fbb){return function(_0x4169a1){if(_0x4169a1){return _0x4169a1[_0xd12c('0x24')](_0x21e8dd)[_0xd12c('0x25')](function(_0x443b04){return _0x443b04;});}return null;};}function removeEntity(_0x2c29a8,_0x3df268){return function(_0x32615e){if(_0x32615e){return _0x32615e[_0xd12c('0x26')]()[_0xd12c('0x25')](function(){_0x2c29a8[_0xd12c('0x18')](0xcc)[_0xd12c('0x19')]();});}};}function handleEntityNotFound(_0xd2e4b3,_0xff6c06){return function(_0x4fc6b1){if(!_0x4fc6b1){_0xd2e4b3['sendStatus'](0x194);}return _0x4fc6b1;};}function handleError(_0x1ae55f,_0xfa1e95){_0xfa1e95=_0xfa1e95||0x1f4;return function(_0x38e5e4){logger[_0xd12c('0x27')](_0x38e5e4[_0xd12c('0x28')]);if(_0x38e5e4[_0xd12c('0x29')]){delete _0x38e5e4[_0xd12c('0x29')];}_0x1ae55f[_0xd12c('0x18')](_0xfa1e95)[_0xd12c('0x2a')](_0x38e5e4);};}exports[_0xd12c('0x2b')]=function(_0xcf1b8,_0x58f8bb){var _0x63d377={},_0x103c06={},_0x170a12={'count':0x0,'rows':[]};var _0x388d66=_[_0xd12c('0x2c')](db[_0xd12c('0x2d')]['rawAttributes'],function(_0x301915){return{'name':_0x301915[_0xd12c('0x2e')],'type':_0x301915[_0xd12c('0x2f')]['key']};});_0x103c06[_0xd12c('0x30')]=_['map'](_0x388d66,_0xd12c('0x29'));_0x103c06[_0xd12c('0x31')]=_[_0xd12c('0x32')](_0xcf1b8[_0xd12c('0x31')]);_0x103c06[_0xd12c('0x33')]=_[_0xd12c('0x34')](_0x103c06[_0xd12c('0x30')],_0x103c06[_0xd12c('0x31')]);_0x63d377[_0xd12c('0x35')]=_[_0xd12c('0x34')](_0x103c06[_0xd12c('0x30')],qs[_0xd12c('0x36')](_0xcf1b8['query']['fields']));_0x63d377[_0xd12c('0x35')]=_0x63d377['attributes'][_0xd12c('0x37')]?_0x63d377[_0xd12c('0x35')]:_0x103c06[_0xd12c('0x30')];if(!_0xcf1b8[_0xd12c('0x31')][_0xd12c('0x38')](_0xd12c('0x39'))){_0x63d377[_0xd12c('0x1d')]=qs[_0xd12c('0x1d')](_0xcf1b8[_0xd12c('0x31')][_0xd12c('0x1d')]);_0x63d377[_0xd12c('0x1b')]=qs['offset'](_0xcf1b8['query'][_0xd12c('0x1b')]);}_0x63d377[_0xd12c('0x3a')]=qs['sort'](_0xcf1b8[_0xd12c('0x31')]['sort']);_0x63d377[_0xd12c('0x3b')]=qs[_0xd12c('0x33')](_['pick'](_0xcf1b8[_0xd12c('0x31')],_0x103c06[_0xd12c('0x33')]),_0x388d66);if(_0xcf1b8[_0xd12c('0x31')]['filter']){_0x63d377[_0xd12c('0x3b')]=_[_0xd12c('0x3c')](_0x63d377['where'],{'$or':_[_0xd12c('0x2c')](_0x388d66,function(_0x2fcfb7){if(_0x2fcfb7['type']!=='VIRTUAL'){var _0x5affc3={};_0x5affc3[_0x2fcfb7[_0xd12c('0x29')]]={'$like':'%'+_0xcf1b8[_0xd12c('0x31')]['filter']+'%'};return _0x5affc3;}})});}_0x63d377=_[_0xd12c('0x3c')]({},_0x63d377,_0xcf1b8[_0xd12c('0x3d')]);var _0x3f5f58={'where':_0x63d377[_0xd12c('0x3b')]};return db['ServicenowConfiguration'][_0xd12c('0x1c')](_0x3f5f58)[_0xd12c('0x25')](function(_0x3866f4){_0x170a12[_0xd12c('0x1c')]=_0x3866f4;if(_0xcf1b8[_0xd12c('0x31')][_0xd12c('0x3e')]){_0x63d377['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xd12c('0x3f')](_0x63d377);})[_0xd12c('0x25')](function(_0x39e5a5){_0x170a12[_0xd12c('0x40')]=_0x39e5a5;return _0x170a12;})[_0xd12c('0x25')](respondWithFilteredResult(_0x58f8bb,_0x63d377))['catch'](handleError(_0x58f8bb,null));};exports[_0xd12c('0x41')]=function(_0xfd7f5c,_0x1a625b){var _0x830f55={'raw':![],'where':{'id':_0xfd7f5c['params']['id']}},_0x40b406={};_0x40b406[_0xd12c('0x30')]=_['keys'](db[_0xd12c('0x2d')][_0xd12c('0x42')]);_0x40b406[_0xd12c('0x31')]=_[_0xd12c('0x32')](_0xfd7f5c[_0xd12c('0x31')]);_0x40b406[_0xd12c('0x33')]=_[_0xd12c('0x34')](_0x40b406[_0xd12c('0x30')],_0x40b406['query']);_0x830f55[_0xd12c('0x35')]=_[_0xd12c('0x34')](_0x40b406[_0xd12c('0x30')],qs[_0xd12c('0x36')](_0xfd7f5c['query'][_0xd12c('0x36')]));_0x830f55[_0xd12c('0x35')]=_0x830f55['attributes']['length']?_0x830f55[_0xd12c('0x35')]:_0x40b406[_0xd12c('0x30')];if(_0xfd7f5c[_0xd12c('0x31')][_0xd12c('0x3e')]){_0x830f55[_0xd12c('0x43')]=[{'all':!![]}];}_0x830f55=_[_0xd12c('0x3c')]({},_0x830f55,_0xfd7f5c[_0xd12c('0x3d')]);return db[_0xd12c('0x2d')][_0xd12c('0x44')](_0x830f55)[_0xd12c('0x25')](handleEntityNotFound(_0x1a625b,null))[_0xd12c('0x25')](respondWithResult(_0x1a625b,null))[_0xd12c('0x45')](handleError(_0x1a625b,null));};exports['create']=function(_0x2caeae,_0x579f7e){return db[_0xd12c('0x2d')]['create'](_0x2caeae[_0xd12c('0x46')],{})[_0xd12c('0x25')](respondWithResult(_0x579f7e,0xc9))['catch'](handleError(_0x579f7e,null));};exports[_0xd12c('0x24')]=function(_0x5b69ef,_0x48e753){if(_0x5b69ef[_0xd12c('0x46')]['id']){delete _0x5b69ef[_0xd12c('0x46')]['id'];}return db[_0xd12c('0x2d')][_0xd12c('0x44')]({'where':{'id':_0x5b69ef[_0xd12c('0x47')]['id']}})[_0xd12c('0x25')](handleEntityNotFound(_0x48e753,null))[_0xd12c('0x25')](saveUpdates(_0x5b69ef[_0xd12c('0x46')],null))[_0xd12c('0x25')](respondWithResult(_0x48e753,null))[_0xd12c('0x45')](handleError(_0x48e753,null));};exports[_0xd12c('0x26')]=function(_0x1eac84,_0x2b8915){return db['ServicenowConfiguration']['find']({'where':{'id':_0x1eac84[_0xd12c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b8915,null))[_0xd12c('0x25')](removeEntity(_0x2b8915,null))[_0xd12c('0x45')](handleError(_0x2b8915,null));};exports[_0xd12c('0x48')]=function(_0x2ce098,_0xcb8684,_0x5c382d){var _0x13c26b={};var _0x540484={};var _0x937695;var _0x3fe018;return db[_0xd12c('0x2d')][_0xd12c('0x49')]({'where':{'id':_0x2ce098[_0xd12c('0x47')]['id']}})[_0xd12c('0x25')](handleEntityNotFound(_0xcb8684,null))[_0xd12c('0x25')](function(_0x1e97e3){if(_0x1e97e3){_0x937695=_0x1e97e3;_0x540484[_0xd12c('0x30')]=_[_0xd12c('0x32')](db[_0xd12c('0x4a')][_0xd12c('0x42')]);_0x540484['query']=_[_0xd12c('0x32')](_0x2ce098['query']);_0x540484['filters']=_[_0xd12c('0x34')](_0x540484[_0xd12c('0x30')],_0x540484[_0xd12c('0x31')]);_0x13c26b['attributes']=_['intersection'](_0x540484[_0xd12c('0x30')],qs[_0xd12c('0x36')](_0x2ce098[_0xd12c('0x31')][_0xd12c('0x36')]));_0x13c26b['attributes']=_0x13c26b[_0xd12c('0x35')][_0xd12c('0x37')]?_0x13c26b[_0xd12c('0x35')]:_0x540484[_0xd12c('0x30')];_0x13c26b['order']=qs[_0xd12c('0x4b')](_0x2ce098[_0xd12c('0x31')][_0xd12c('0x4b')]);_0x13c26b[_0xd12c('0x3b')]=qs[_0xd12c('0x33')](_[_0xd12c('0x4c')](_0x2ce098[_0xd12c('0x31')],_0x540484['filters']));if(_0x2ce098['query']['filter']){_0x13c26b[_0xd12c('0x3b')]=_['merge'](_0x13c26b[_0xd12c('0x3b')],{'$or':_['map'](_0x13c26b[_0xd12c('0x35')],function(_0x23b910){var _0x498bf8={};_0x498bf8[_0x23b910]={'$like':'%'+_0x2ce098['query'][_0xd12c('0x4d')]+'%'};return _0x498bf8;})});}_0x13c26b=_[_0xd12c('0x3c')]({},_0x13c26b,_0x2ce098[_0xd12c('0x3d')]);return _0x937695[_0xd12c('0x48')](_0x13c26b);}})['then'](function(_0x42ef15){if(_0x42ef15){_0x3fe018=_0x42ef15['length'];if(!_0x2ce098[_0xd12c('0x31')][_0xd12c('0x38')](_0xd12c('0x39'))){_0x13c26b[_0xd12c('0x1d')]=qs[_0xd12c('0x1d')](_0x2ce098[_0xd12c('0x31')][_0xd12c('0x1d')]);_0x13c26b[_0xd12c('0x1b')]=qs[_0xd12c('0x1b')](_0x2ce098[_0xd12c('0x31')][_0xd12c('0x1b')]);}return _0x937695[_0xd12c('0x48')](_0x13c26b);}})['then'](function(_0x3a7f96){if(_0x3a7f96){return _0x3a7f96?{'count':_0x3fe018,'rows':_0x3a7f96}:null;}})['then'](respondWithResult(_0xcb8684,null))[_0xd12c('0x45')](handleError(_0xcb8684,null));};exports[_0xd12c('0x4e')]=function(_0x4d9bf1,_0x555ede,_0x486160){var _0x2f8c00={};var _0x1454d8={};var _0x396957;var _0x3697ee;return db['ServicenowConfiguration'][_0xd12c('0x49')]({'where':{'id':_0x4d9bf1[_0xd12c('0x47')]['id']}})[_0xd12c('0x25')](handleEntityNotFound(_0x555ede,null))[_0xd12c('0x25')](function(_0x37ba15){if(_0x37ba15){_0x396957=_0x37ba15;_0x1454d8[_0xd12c('0x30')]=_[_0xd12c('0x32')](db[_0xd12c('0x4a')][_0xd12c('0x42')]);_0x1454d8[_0xd12c('0x31')]=_['keys'](_0x4d9bf1[_0xd12c('0x31')]);_0x1454d8['filters']=_[_0xd12c('0x34')](_0x1454d8[_0xd12c('0x30')],_0x1454d8[_0xd12c('0x31')]);_0x2f8c00[_0xd12c('0x35')]=_['intersection'](_0x1454d8[_0xd12c('0x30')],qs[_0xd12c('0x36')](_0x4d9bf1['query'][_0xd12c('0x36')]));_0x2f8c00[_0xd12c('0x35')]=_0x2f8c00['attributes'][_0xd12c('0x37')]?_0x2f8c00['attributes']:_0x1454d8['model'];_0x2f8c00[_0xd12c('0x3a')]=qs[_0xd12c('0x4b')](_0x4d9bf1[_0xd12c('0x31')][_0xd12c('0x4b')]);_0x2f8c00['where']=qs[_0xd12c('0x33')](_['pick'](_0x4d9bf1['query'],_0x1454d8[_0xd12c('0x33')]));if(_0x4d9bf1['query'][_0xd12c('0x4d')]){_0x2f8c00['where']=_[_0xd12c('0x3c')](_0x2f8c00[_0xd12c('0x3b')],{'$or':_['map'](_0x2f8c00[_0xd12c('0x35')],function(_0x1ba712){var _0x4b3765={};_0x4b3765[_0x1ba712]={'$like':'%'+_0x4d9bf1[_0xd12c('0x31')]['filter']+'%'};return _0x4b3765;})});}_0x2f8c00=_[_0xd12c('0x3c')]({},_0x2f8c00,_0x4d9bf1[_0xd12c('0x3d')]);return _0x396957[_0xd12c('0x4e')](_0x2f8c00);}})[_0xd12c('0x25')](function(_0x1a527d){if(_0x1a527d){_0x3697ee=_0x1a527d[_0xd12c('0x37')];if(!_0x4d9bf1[_0xd12c('0x31')][_0xd12c('0x38')](_0xd12c('0x39'))){_0x2f8c00[_0xd12c('0x1d')]=qs[_0xd12c('0x1d')](_0x4d9bf1[_0xd12c('0x31')][_0xd12c('0x1d')]);_0x2f8c00[_0xd12c('0x1b')]=qs[_0xd12c('0x1b')](_0x4d9bf1['query'][_0xd12c('0x1b')]);}return _0x396957[_0xd12c('0x4e')](_0x2f8c00);}})['then'](function(_0x415ba3){if(_0x415ba3){return _0x415ba3?{'count':_0x3697ee,'rows':_0x415ba3}:null;}})[_0xd12c('0x25')](respondWithResult(_0x555ede,null))[_0xd12c('0x45')](handleError(_0x555ede,null));};exports['getDescriptions']=function(_0x5b1d07,_0xfd9bee,_0x15a76a){var _0x7b1684={};var _0x3f68b1={};var _0x4d7aae;var _0x3a889c;return db[_0xd12c('0x2d')]['findOne']({'where':{'id':_0x5b1d07[_0xd12c('0x47')]['id']}})[_0xd12c('0x25')](handleEntityNotFound(_0xfd9bee,null))[_0xd12c('0x25')](function(_0x3fffb8){if(_0x3fffb8){_0x4d7aae=_0x3fffb8;_0x3f68b1['model']=_['keys'](db[_0xd12c('0x4a')][_0xd12c('0x42')]);_0x3f68b1[_0xd12c('0x31')]=_[_0xd12c('0x32')](_0x5b1d07[_0xd12c('0x31')]);_0x3f68b1[_0xd12c('0x33')]=_[_0xd12c('0x34')](_0x3f68b1[_0xd12c('0x30')],_0x3f68b1[_0xd12c('0x31')]);_0x7b1684['attributes']=_[_0xd12c('0x34')](_0x3f68b1[_0xd12c('0x30')],qs['fields'](_0x5b1d07[_0xd12c('0x31')]['fields']));_0x7b1684[_0xd12c('0x35')]=_0x7b1684['attributes'][_0xd12c('0x37')]?_0x7b1684[_0xd12c('0x35')]:_0x3f68b1[_0xd12c('0x30')];_0x7b1684[_0xd12c('0x3a')]=qs['sort'](_0x5b1d07['query'][_0xd12c('0x4b')]);_0x7b1684[_0xd12c('0x3b')]=qs[_0xd12c('0x33')](_[_0xd12c('0x4c')](_0x5b1d07[_0xd12c('0x31')],_0x3f68b1[_0xd12c('0x33')]));if(_0x5b1d07['query'][_0xd12c('0x4d')]){_0x7b1684['where']=_[_0xd12c('0x3c')](_0x7b1684['where'],{'$or':_[_0xd12c('0x2c')](_0x7b1684['attributes'],function(_0x1a0ea5){var _0x76b55f={};_0x76b55f[_0x1a0ea5]={'$like':'%'+_0x5b1d07[_0xd12c('0x31')][_0xd12c('0x4d')]+'%'};return _0x76b55f;})});}_0x7b1684=_[_0xd12c('0x3c')]({},_0x7b1684,_0x5b1d07[_0xd12c('0x3d')]);return _0x4d7aae['getDescriptions'](_0x7b1684);}})[_0xd12c('0x25')](function(_0x245ad4){if(_0x245ad4){_0x3a889c=_0x245ad4['length'];if(!_0x5b1d07[_0xd12c('0x31')]['hasOwnProperty'](_0xd12c('0x39'))){_0x7b1684[_0xd12c('0x1d')]=qs['limit'](_0x5b1d07['query'][_0xd12c('0x1d')]);_0x7b1684['offset']=qs[_0xd12c('0x1b')](_0x5b1d07['query'][_0xd12c('0x1b')]);}return _0x4d7aae[_0xd12c('0x4f')](_0x7b1684);}})[_0xd12c('0x25')](function(_0x5052eb){if(_0x5052eb){return _0x5052eb?{'count':_0x3a889c,'rows':_0x5052eb}:null;}})[_0xd12c('0x25')](respondWithResult(_0xfd9bee,null))[_0xd12c('0x45')](handleError(_0xfd9bee,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f6574a7..cbc4494 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 _0x19c3=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x19c3,0xf9));var _0x319c=function(_0x20e843,_0x270961){_0x20e843=_0x20e843-0x0;var _0x4c7d4e=_0x19c3[_0x20e843];return _0x4c7d4e;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var logger=require(_0x319c('0x1'))(_0x319c('0x2'));var moment=require('moment');var BPromise=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var fs=require('fs');var path=require(_0x319c('0x5'));var rimraf=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var attributes=require(_0x319c('0x8'));module['exports']=function(_0x20f77e,_0x53a1de){return _0x20f77e[_0x319c('0x9')](_0x319c('0xa'),attributes,{'tableName':_0x319c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x980c=['./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d9b2b,_0x30c0d1){var _0x117028=function(_0x1c4fe1){while(--_0x1c4fe1){_0x2d9b2b['push'](_0x2d9b2b['shift']());}};_0x117028(++_0x30c0d1);}(_0x980c,0x100));var _0xc980=function(_0x494223,_0x4eb071){_0x494223=_0x494223-0x0;var _0x540a3e=_0x980c[_0x494223];return _0x540a3e;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require(_0xc980('0x2'))(_0xc980('0x3'));var moment=require(_0xc980('0x4'));var BPromise=require(_0xc980('0x5'));var rp=require(_0xc980('0x6'));var fs=require('fs');var path=require(_0xc980('0x7'));var rimraf=require(_0xc980('0x8'));var config=require(_0xc980('0x9'));var attributes=require(_0xc980('0xa'));module['exports']=function(_0x472ece,_0x311a54){return _0x472ece[_0xc980('0xb')](_0xc980('0xc'),attributes,{'tableName':_0xc980('0xd'),'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 74d595e..6e454b8 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 _0x016c=['client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x016c,0x1da));var _0xc016=function(_0xf8de68,_0x5bbaff){_0xf8de68=_0xf8de68-0x0;var _0x3f8ac6=_0x016c[_0xf8de68];return _0x3f8ac6;};'use strict';var _=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var moment=require(_0xc016('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc016('0x3'));var db=require(_0xc016('0x4'))['db'];var utils=require(_0xc016('0x5'));var logger=require(_0xc016('0x6'))(_0xc016('0x7'));var config=require(_0xc016('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc016('0x9')][_0xc016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385e8e,_0x212e52,_0x5f3185){return new BPromise(function(_0x5077c2,_0x27e2d8){return client[_0xc016('0xb')](_0x385e8e,_0x5f3185)['then'](function(_0x1f89b3){logger[_0xc016('0xc')](_0xc016('0xd'),_0x212e52,_0xc016('0xe'));logger[_0xc016('0xf')](_0xc016('0x10'),_0x212e52,_0xc016('0xe'),JSON['stringify'](_0x1f89b3));if(_0x1f89b3[_0xc016('0x11')]){if(_0x1f89b3[_0xc016('0x11')]['code']===0x1f4){logger[_0xc016('0x11')](_0xc016('0xd'),_0x212e52,_0x1f89b3[_0xc016('0x11')]['message']);return _0x27e2d8(_0x1f89b3['error']['message']);}logger['error'](_0xc016('0xd'),_0x212e52,_0x1f89b3[_0xc016('0x11')][_0xc016('0x12')]);return _0x5077c2(_0x1f89b3['error'][_0xc016('0x12')]);}else{logger[_0xc016('0xc')](_0xc016('0xd'),_0x212e52,_0xc016('0xe'));_0x5077c2(_0x1f89b3[_0xc016('0x13')][_0xc016('0x12')]);}})[_0xc016('0x14')](function(_0xaeb15b){logger[_0xc016('0x11')](_0xc016('0xd'),_0x212e52,_0xaeb15b);_0x27e2d8(_0xaeb15b);});});} \ No newline at end of file +var _0x3d9d=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3147e0,_0x35c5eb){var _0x176f12=function(_0x35646d){while(--_0x35646d){_0x3147e0['push'](_0x3147e0['shift']());}};_0x176f12(++_0x35c5eb);}(_0x3d9d,0xc4));var _0xd3d9=function(_0x36d11c,_0x6dffa7){_0x36d11c=_0x36d11c-0x0;var _0xd95b50=_0x3d9d[_0x36d11c];return _0xd95b50;};'use strict';var _=require('lodash');var util=require(_0xd3d9('0x0'));var moment=require(_0xd3d9('0x1'));var BPromise=require(_0xd3d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3d9('0x3'));var db=require(_0xd3d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d9('0x5'))(_0xd3d9('0x6'));var config=require(_0xd3d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3d9('0x8')][_0xd3d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4153,_0x1b3947,_0x1d77d0){return new BPromise(function(_0x455cdb,_0x2596b4){return client['request'](_0x4a4153,_0x1d77d0)[_0xd3d9('0xa')](function(_0xf04bf8){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x1b3947,_0xd3d9('0xb'));logger['debug'](_0xd3d9('0xc'),_0x1b3947,_0xd3d9('0xb'),JSON[_0xd3d9('0xd')](_0xf04bf8));if(_0xf04bf8[_0xd3d9('0xe')]){if(_0xf04bf8[_0xd3d9('0xe')][_0xd3d9('0xf')]===0x1f4){logger[_0xd3d9('0xe')](_0xd3d9('0x10'),_0x1b3947,_0xf04bf8[_0xd3d9('0xe')][_0xd3d9('0x11')]);return _0x2596b4(_0xf04bf8[_0xd3d9('0xe')][_0xd3d9('0x11')]);}logger[_0xd3d9('0xe')](_0xd3d9('0x10'),_0x1b3947,_0xf04bf8[_0xd3d9('0xe')][_0xd3d9('0x11')]);return _0x455cdb(_0xf04bf8['error']['message']);}else{logger[_0xd3d9('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1b3947,'request\x20sent');_0x455cdb(_0xf04bf8[_0xd3d9('0x13')][_0xd3d9('0x11')]);}})[_0xd3d9('0x14')](function(_0x8e952e){logger[_0xd3d9('0xe')](_0xd3d9('0x10'),_0x1b3947,_0x8e952e);_0x2596b4(_0x8e952e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2a61684..b82ae12 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 _0xbce8=['get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbce8,0x1bb));var _0x8bce=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xbce8[_0x24a88e];return _0x232cbb;};'use strict';var multer=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var path=require('path');var timeout=require(_0x8bce('0x2'));var express=require('express');var router=express[_0x8bce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8bce('0x4'));var interaction=require(_0x8bce('0x5'));var config=require('../../config/environment');var controller=require(_0x8bce('0x6'));router[_0x8bce('0x7')]('/',auth['isAuthenticated'](),controller[_0x8bce('0x8')]);router[_0x8bce('0x7')]('/:id',auth[_0x8bce('0x9')](),controller['show']);router[_0x8bce('0xa')]('/',auth[_0x8bce('0x9')](),controller[_0x8bce('0xb')]);router[_0x8bce('0xc')](_0x8bce('0xd'),auth[_0x8bce('0x9')](),controller[_0x8bce('0xe')]);router[_0x8bce('0xf')]('/:id',auth[_0x8bce('0x9')](),controller[_0x8bce('0x10')]);module[_0x8bce('0x11')]=router; \ No newline at end of file +var _0xf59b=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','create','put'];(function(_0x2dbff7,_0x381a44){var _0x31a95c=function(_0x2dbdc9){while(--_0x2dbdc9){_0x2dbff7['push'](_0x2dbff7['shift']());}};_0x31a95c(++_0x381a44);}(_0xf59b,0x1cf));var _0xbf59=function(_0x4477f6,_0x786920){_0x4477f6=_0x4477f6-0x0;var _0x2de580=_0xf59b[_0x4477f6];return _0x2de580;};'use strict';var multer=require(_0xbf59('0x0'));var util=require('util');var path=require(_0xbf59('0x1'));var timeout=require(_0xbf59('0x2'));var express=require('express');var router=express[_0xbf59('0x3')]();var fs_extra=require(_0xbf59('0x4'));var auth=require(_0xbf59('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf59('0x6'));var controller=require(_0xbf59('0x7'));router[_0xbf59('0x8')]('/',auth[_0xbf59('0x9')](),controller['index']);router['get'](_0xbf59('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbf59('0x9')](),controller[_0xbf59('0xb')]);router[_0xbf59('0xc')](_0xbf59('0xa'),auth[_0xbf59('0x9')](),controller[_0xbf59('0xd')]);router[_0xbf59('0xe')](_0xbf59('0xa'),auth[_0xbf59('0x9')](),controller[_0xbf59('0xf')]);module[_0xbf59('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 700878a..b7649d1 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 _0x4a14=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x15e2f6,_0x464c0e){var _0x28b533=function(_0x5b811c){while(--_0x5b811c){_0x15e2f6['push'](_0x15e2f6['shift']());}};_0x28b533(++_0x464c0e);}(_0x4a14,0x6e));var _0x44a1=function(_0x5b2b2b,_0x2ac388){_0x5b2b2b=_0x5b2b2b-0x0;var _0xb50b9c=_0x4a14[_0x5b2b2b];return _0xb50b9c;};'use strict';var Sequelize=require(_0x44a1('0x0'));module[_0x44a1('0x1')]={'type':{'type':Sequelize[_0x44a1('0x2')](_0x44a1('0x3'),_0x44a1('0x4'),_0x44a1('0x5'),_0x44a1('0x6'),_0x44a1('0x7')),'defaultValue':_0x44a1('0x3')},'content':{'type':Sequelize[_0x44a1('0x8')]},'key':{'type':Sequelize[_0x44a1('0x8')]},'keyType':{'type':Sequelize[_0x44a1('0x2')]('string',_0x44a1('0x4'),_0x44a1('0x5'))},'keyContent':{'type':Sequelize[_0x44a1('0x8')]},'idField':{'type':Sequelize[_0x44a1('0x8')]},'nameField':{'type':Sequelize[_0x44a1('0x8')]},'customField':{'type':Sequelize[_0x44a1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x44a1('0x8')]}}; \ No newline at end of file +var _0x4502=['ENUM','STRING','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x3544a1,_0x175b4d){var _0x556878=function(_0x45a88e){while(--_0x45a88e){_0x3544a1['push'](_0x3544a1['shift']());}};_0x556878(++_0x175b4d);}(_0x4502,0x82));var _0x2450=function(_0x3d5525,_0x5ee313){_0x3d5525=_0x3d5525-0x0;var _0x155a11=_0x4502[_0x3d5525];return _0x155a11;};'use strict';var Sequelize=require(_0x2450('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x2450('0x1'),_0x2450('0x2'),_0x2450('0x3'),_0x2450('0x4'),_0x2450('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2450('0x6')]('string',_0x2450('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2450('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2450('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ad538e5..1c700db 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 _0x26f5=['params','rawAttributes','include','options','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','map','ServicenowField','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show'];(function(_0x1c0f99,_0x52c12e){var _0x5bbd75=function(_0x5b7c95){while(--_0x5b7c95){_0x1c0f99['push'](_0x1c0f99['shift']());}};_0x5bbd75(++_0x52c12e);}(_0x26f5,0xe3));var _0x526f=function(_0x4d8f90,_0x4a8339){_0x4d8f90=_0x4d8f90-0x0;var _0x498e30=_0x26f5[_0x4d8f90];return _0x498e30;};'use strict';var emlformat=require(_0x526f('0x0'));var rimraf=require(_0x526f('0x1'));var zipdir=require(_0x526f('0x2'));var jsonpatch=require(_0x526f('0x3'));var rp=require('request-promise');var moment=require(_0x526f('0x4'));var BPromise=require(_0x526f('0x5'));var Mustache=require('mustache');var util=require(_0x526f('0x6'));var path=require(_0x526f('0x7'));var sox=require(_0x526f('0x8'));var csv=require(_0x526f('0x9'));var ejs=require(_0x526f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x526f('0xb'));var squel=require('squel');var crypto=require(_0x526f('0xc'));var jsforce=require(_0x526f('0xd'));var deskjs=require(_0x526f('0xe'));var toCsv=require(_0x526f('0x9'));var querystring=require('querystring');var Papa=require(_0x526f('0xf'));var Redis=require(_0x526f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x526f('0x11'));var as=require(_0x526f('0x12'));var hardwareService=require(_0x526f('0x13'));var logger=require(_0x526f('0x14'))(_0x526f('0x15'));var utils=require(_0x526f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x526f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5729c7,_0x44b115){_0x44b115=_0x44b115||0xcc;return function(_0x175945){if(_0x175945){return _0x5729c7[_0x526f('0x18')](_0x44b115);}return _0x5729c7[_0x526f('0x19')](_0x44b115)[_0x526f('0x1a')]();};}function respondWithResult(_0x5cb118,_0x5e8b35){_0x5e8b35=_0x5e8b35||0xc8;return function(_0x23bfe4){if(_0x23bfe4){return _0x5cb118[_0x526f('0x19')](_0x5e8b35)[_0x526f('0x1b')](_0x23bfe4);}};}function respondWithFilteredResult(_0x34413c,_0x462115){return function(_0x48a702){if(_0x48a702){var _0x510676=typeof _0x462115['offset']===_0x526f('0x1c')&&typeof _0x462115[_0x526f('0x1d')]==='undefined';var _0x570a51=_0x48a702['count'];var _0x39f044=_0x510676?0x0:_0x462115['offset'];var _0x190844=_0x510676?_0x48a702[_0x526f('0x1e')]:_0x462115[_0x526f('0x1f')]+_0x462115[_0x526f('0x1d')];var _0x588971;if(_0x190844>=_0x570a51){_0x190844=_0x570a51;_0x588971=0xc8;}else{_0x588971=0xce;}_0x34413c['status'](_0x588971);return _0x34413c[_0x526f('0x20')](_0x526f('0x21'),_0x39f044+'-'+_0x190844+'/'+_0x570a51)['json'](_0x48a702);}return null;};}function patchUpdates(_0x3c8420){return function(_0x4d1aba){try{jsonpatch['apply'](_0x4d1aba,_0x3c8420,!![]);}catch(_0x1dcf85){return BPromise[_0x526f('0x22')](_0x1dcf85);}return _0x4d1aba[_0x526f('0x23')]();};}function saveUpdates(_0x221c4d,_0x21171f){return function(_0x28d5bf){if(_0x28d5bf){return _0x28d5bf['update'](_0x221c4d)[_0x526f('0x24')](function(_0x396176){return _0x396176;});}return null;};}function removeEntity(_0x2ef807,_0x4f80f1){return function(_0x44c9fb){if(_0x44c9fb){return _0x44c9fb[_0x526f('0x25')]()[_0x526f('0x24')](function(){_0x2ef807[_0x526f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5182,_0x44ee58){return function(_0x49bae6){if(!_0x49bae6){_0x3a5182['sendStatus'](0x194);}return _0x49bae6;};}function handleError(_0x7b2b4e,_0x55f846){_0x55f846=_0x55f846||0x1f4;return function(_0x590118){logger['error'](_0x590118[_0x526f('0x26')]);if(_0x590118[_0x526f('0x27')]){delete _0x590118[_0x526f('0x27')];}_0x7b2b4e[_0x526f('0x19')](_0x55f846)['send'](_0x590118);};}exports['index']=function(_0x346d0a,_0x3f5927){var _0x227e31={},_0x51bd30={},_0x5306ca={'count':0x0,'rows':[]};var _0x5e6a4e=_[_0x526f('0x28')](db[_0x526f('0x29')]['rawAttributes'],function(_0x3dc2fc){return{'name':_0x3dc2fc[_0x526f('0x2a')],'type':_0x3dc2fc[_0x526f('0x2b')]['key']};});_0x51bd30[_0x526f('0x2c')]=_[_0x526f('0x28')](_0x5e6a4e,'name');_0x51bd30[_0x526f('0x2d')]=_[_0x526f('0x2e')](_0x346d0a[_0x526f('0x2d')]);_0x51bd30[_0x526f('0x2f')]=_['intersection'](_0x51bd30[_0x526f('0x2c')],_0x51bd30[_0x526f('0x2d')]);_0x227e31['attributes']=_['intersection'](_0x51bd30[_0x526f('0x2c')],qs[_0x526f('0x30')](_0x346d0a[_0x526f('0x2d')]['fields']));_0x227e31['attributes']=_0x227e31[_0x526f('0x31')][_0x526f('0x32')]?_0x227e31['attributes']:_0x51bd30['model'];if(!_0x346d0a[_0x526f('0x2d')][_0x526f('0x33')](_0x526f('0x34'))){_0x227e31['limit']=qs[_0x526f('0x1d')](_0x346d0a[_0x526f('0x2d')]['limit']);_0x227e31[_0x526f('0x1f')]=qs[_0x526f('0x1f')](_0x346d0a[_0x526f('0x2d')][_0x526f('0x1f')]);}_0x227e31[_0x526f('0x35')]=qs[_0x526f('0x36')](_0x346d0a[_0x526f('0x2d')][_0x526f('0x36')]);_0x227e31[_0x526f('0x37')]=qs['filters'](_[_0x526f('0x38')](_0x346d0a[_0x526f('0x2d')],_0x51bd30[_0x526f('0x2f')]),_0x5e6a4e);if(_0x346d0a[_0x526f('0x2d')][_0x526f('0x39')]){_0x227e31[_0x526f('0x37')]=_[_0x526f('0x3a')](_0x227e31['where'],{'$or':_[_0x526f('0x28')](_0x5e6a4e,function(_0x330a82){if(_0x330a82[_0x526f('0x2b')]!==_0x526f('0x3b')){var _0x2435fc={};_0x2435fc[_0x330a82[_0x526f('0x27')]]={'$like':'%'+_0x346d0a[_0x526f('0x2d')][_0x526f('0x39')]+'%'};return _0x2435fc;}})});}_0x227e31=_[_0x526f('0x3a')]({},_0x227e31,_0x346d0a['options']);var _0x12ba6b={'where':_0x227e31[_0x526f('0x37')]};return db[_0x526f('0x29')][_0x526f('0x1e')](_0x12ba6b)[_0x526f('0x24')](function(_0x26fcfd){_0x5306ca[_0x526f('0x1e')]=_0x26fcfd;if(_0x346d0a[_0x526f('0x2d')][_0x526f('0x3c')]){_0x227e31['include']=[{'all':!![]}];}return db['ServicenowField'][_0x526f('0x3d')](_0x227e31);})[_0x526f('0x24')](function(_0x10bb8e){_0x5306ca[_0x526f('0x3e')]=_0x10bb8e;return _0x5306ca;})['then'](respondWithFilteredResult(_0x3f5927,_0x227e31))[_0x526f('0x3f')](handleError(_0x3f5927,null));};exports[_0x526f('0x40')]=function(_0x33006b,_0x4395fb){var _0x111da1={'raw':!![],'where':{'id':_0x33006b[_0x526f('0x41')]['id']}},_0x590f8f={};_0x590f8f[_0x526f('0x2c')]=_[_0x526f('0x2e')](db[_0x526f('0x29')][_0x526f('0x42')]);_0x590f8f[_0x526f('0x2d')]=_[_0x526f('0x2e')](_0x33006b[_0x526f('0x2d')]);_0x590f8f['filters']=_['intersection'](_0x590f8f['model'],_0x590f8f[_0x526f('0x2d')]);_0x111da1[_0x526f('0x31')]=_['intersection'](_0x590f8f[_0x526f('0x2c')],qs[_0x526f('0x30')](_0x33006b[_0x526f('0x2d')]['fields']));_0x111da1[_0x526f('0x31')]=_0x111da1[_0x526f('0x31')][_0x526f('0x32')]?_0x111da1[_0x526f('0x31')]:_0x590f8f[_0x526f('0x2c')];if(_0x33006b[_0x526f('0x2d')][_0x526f('0x3c')]){_0x111da1[_0x526f('0x43')]=[{'all':!![]}];}_0x111da1=_['merge']({},_0x111da1,_0x33006b[_0x526f('0x44')]);return db['ServicenowField']['find'](_0x111da1)['then'](handleEntityNotFound(_0x4395fb,null))[_0x526f('0x24')](respondWithResult(_0x4395fb,null))['catch'](handleError(_0x4395fb,null));};exports[_0x526f('0x45')]=function(_0x58d7be,_0x11eeb4){return db['ServicenowField'][_0x526f('0x45')](_0x58d7be['body'],{})[_0x526f('0x24')](respondWithResult(_0x11eeb4,0xc9))[_0x526f('0x3f')](handleError(_0x11eeb4,null));};exports[_0x526f('0x46')]=function(_0x38f9c0,_0x1dbdf6){if(_0x38f9c0[_0x526f('0x47')]['id']){delete _0x38f9c0['body']['id'];}return db[_0x526f('0x29')][_0x526f('0x48')]({'where':{'id':_0x38f9c0[_0x526f('0x41')]['id']}})['then'](handleEntityNotFound(_0x1dbdf6,null))[_0x526f('0x24')](saveUpdates(_0x38f9c0['body'],null))[_0x526f('0x24')](respondWithResult(_0x1dbdf6,null))[_0x526f('0x3f')](handleError(_0x1dbdf6,null));};exports[_0x526f('0x25')]=function(_0x5b0e73,_0x5b04c9){return db['ServicenowField'][_0x526f('0x48')]({'where':{'id':_0x5b0e73[_0x526f('0x41')]['id']}})[_0x526f('0x24')](handleEntityNotFound(_0x5b04c9,null))[_0x526f('0x24')](removeEntity(_0x5b04c9,null))[_0x526f('0x3f')](handleError(_0x5b04c9,null));}; \ No newline at end of file +var _0x9b3c=['api','../../config/utils','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','update','then','destroy','error','name','index','ServicenowField','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0x9b3c,0x1bb));var _0xc9b3=function(_0x2e873a,_0x419536){_0x2e873a=_0x2e873a-0x0;var _0x25162b=_0x9b3c[_0x2e873a];return _0x25162b;};'use strict';var emlformat=require(_0xc9b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9b3('0x1'));var jsonpatch=require(_0xc9b3('0x2'));var rp=require(_0xc9b3('0x3'));var moment=require('moment');var BPromise=require(_0xc9b3('0x4'));var Mustache=require(_0xc9b3('0x5'));var util=require(_0xc9b3('0x6'));var path=require(_0xc9b3('0x7'));var sox=require(_0xc9b3('0x8'));var csv=require(_0xc9b3('0x9'));var ejs=require(_0xc9b3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9b3('0xb'));var squel=require(_0xc9b3('0xc'));var crypto=require(_0xc9b3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc9b3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9b3('0xf'));var authService=require(_0xc9b3('0x10'));var qs=require(_0xc9b3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9b3('0x12'))(_0xc9b3('0x13'));var utils=require(_0xc9b3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5417ce,_0x2da81a){_0x2da81a=_0x2da81a||0xcc;return function(_0x20e740){if(_0x20e740){return _0x5417ce[_0xc9b3('0x15')](_0x2da81a);}return _0x5417ce[_0xc9b3('0x16')](_0x2da81a)[_0xc9b3('0x17')]();};}function respondWithResult(_0x424386,_0x11fc5d){_0x11fc5d=_0x11fc5d||0xc8;return function(_0x55e713){if(_0x55e713){return _0x424386[_0xc9b3('0x16')](_0x11fc5d)['json'](_0x55e713);}};}function respondWithFilteredResult(_0x2f01d8,_0x970890){return function(_0x3d4cff){if(_0x3d4cff){var _0x23a9e8=typeof _0x970890[_0xc9b3('0x18')]==='undefined'&&typeof _0x970890[_0xc9b3('0x19')]==='undefined';var _0x37b9ee=_0x3d4cff[_0xc9b3('0x1a')];var _0x1dbd26=_0x23a9e8?0x0:_0x970890['offset'];var _0x304b1f=_0x23a9e8?_0x3d4cff[_0xc9b3('0x1a')]:_0x970890['offset']+_0x970890['limit'];var _0x132be6;if(_0x304b1f>=_0x37b9ee){_0x304b1f=_0x37b9ee;_0x132be6=0xc8;}else{_0x132be6=0xce;}_0x2f01d8[_0xc9b3('0x16')](_0x132be6);return _0x2f01d8[_0xc9b3('0x1b')](_0xc9b3('0x1c'),_0x1dbd26+'-'+_0x304b1f+'/'+_0x37b9ee)[_0xc9b3('0x1d')](_0x3d4cff);}return null;};}function patchUpdates(_0x592793){return function(_0x4624e2){try{jsonpatch['apply'](_0x4624e2,_0x592793,!![]);}catch(_0x35d9ea){return BPromise[_0xc9b3('0x1e')](_0x35d9ea);}return _0x4624e2['save']();};}function saveUpdates(_0x3edb9a,_0x16a789){return function(_0x1db835){if(_0x1db835){return _0x1db835[_0xc9b3('0x1f')](_0x3edb9a)[_0xc9b3('0x20')](function(_0x2aafe1){return _0x2aafe1;});}return null;};}function removeEntity(_0x4f90c0,_0x43372c){return function(_0x1c549c){if(_0x1c549c){return _0x1c549c[_0xc9b3('0x21')]()[_0xc9b3('0x20')](function(){_0x4f90c0[_0xc9b3('0x16')](0xcc)[_0xc9b3('0x17')]();});}};}function handleEntityNotFound(_0x16ef46,_0x4dea69){return function(_0x472903){if(!_0x472903){_0x16ef46[_0xc9b3('0x15')](0x194);}return _0x472903;};}function handleError(_0x1a6a58,_0x1e3334){_0x1e3334=_0x1e3334||0x1f4;return function(_0x210799){logger[_0xc9b3('0x22')](_0x210799['stack']);if(_0x210799[_0xc9b3('0x23')]){delete _0x210799[_0xc9b3('0x23')];}_0x1a6a58[_0xc9b3('0x16')](_0x1e3334)['send'](_0x210799);};}exports[_0xc9b3('0x24')]=function(_0x48e75d,_0x302874){var _0xe2cdb3={},_0x17be96={},_0x26d6bc={'count':0x0,'rows':[]};var _0x3f88ab=_['map'](db[_0xc9b3('0x25')]['rawAttributes'],function(_0x31b1e0){return{'name':_0x31b1e0[_0xc9b3('0x26')],'type':_0x31b1e0[_0xc9b3('0x27')]['key']};});_0x17be96[_0xc9b3('0x28')]=_[_0xc9b3('0x29')](_0x3f88ab,_0xc9b3('0x23'));_0x17be96[_0xc9b3('0x2a')]=_[_0xc9b3('0x2b')](_0x48e75d['query']);_0x17be96[_0xc9b3('0x2c')]=_[_0xc9b3('0x2d')](_0x17be96['model'],_0x17be96[_0xc9b3('0x2a')]);_0xe2cdb3[_0xc9b3('0x2e')]=_[_0xc9b3('0x2d')](_0x17be96['model'],qs[_0xc9b3('0x2f')](_0x48e75d[_0xc9b3('0x2a')][_0xc9b3('0x2f')]));_0xe2cdb3[_0xc9b3('0x2e')]=_0xe2cdb3[_0xc9b3('0x2e')][_0xc9b3('0x30')]?_0xe2cdb3['attributes']:_0x17be96[_0xc9b3('0x28')];if(!_0x48e75d[_0xc9b3('0x2a')]['hasOwnProperty']('nolimit')){_0xe2cdb3['limit']=qs['limit'](_0x48e75d[_0xc9b3('0x2a')]['limit']);_0xe2cdb3['offset']=qs['offset'](_0x48e75d[_0xc9b3('0x2a')]['offset']);}_0xe2cdb3['order']=qs['sort'](_0x48e75d[_0xc9b3('0x2a')][_0xc9b3('0x31')]);_0xe2cdb3[_0xc9b3('0x32')]=qs['filters'](_[_0xc9b3('0x33')](_0x48e75d[_0xc9b3('0x2a')],_0x17be96[_0xc9b3('0x2c')]),_0x3f88ab);if(_0x48e75d[_0xc9b3('0x2a')][_0xc9b3('0x34')]){_0xe2cdb3['where']=_[_0xc9b3('0x35')](_0xe2cdb3['where'],{'$or':_[_0xc9b3('0x29')](_0x3f88ab,function(_0x4ec4a0){if(_0x4ec4a0['type']!==_0xc9b3('0x36')){var _0x51e41f={};_0x51e41f[_0x4ec4a0[_0xc9b3('0x23')]]={'$like':'%'+_0x48e75d['query'][_0xc9b3('0x34')]+'%'};return _0x51e41f;}})});}_0xe2cdb3=_[_0xc9b3('0x35')]({},_0xe2cdb3,_0x48e75d['options']);var _0x5d1918={'where':_0xe2cdb3[_0xc9b3('0x32')]};return db[_0xc9b3('0x25')]['count'](_0x5d1918)['then'](function(_0x34fbd9){_0x26d6bc['count']=_0x34fbd9;if(_0x48e75d['query'][_0xc9b3('0x37')]){_0xe2cdb3[_0xc9b3('0x38')]=[{'all':!![]}];}return db[_0xc9b3('0x25')][_0xc9b3('0x39')](_0xe2cdb3);})[_0xc9b3('0x20')](function(_0x532927){_0x26d6bc[_0xc9b3('0x3a')]=_0x532927;return _0x26d6bc;})[_0xc9b3('0x20')](respondWithFilteredResult(_0x302874,_0xe2cdb3))['catch'](handleError(_0x302874,null));};exports[_0xc9b3('0x3b')]=function(_0x397634,_0x14d21a){var _0x3bd417={'raw':!![],'where':{'id':_0x397634[_0xc9b3('0x3c')]['id']}},_0x469ba7={};_0x469ba7[_0xc9b3('0x28')]=_[_0xc9b3('0x2b')](db[_0xc9b3('0x25')]['rawAttributes']);_0x469ba7['query']=_[_0xc9b3('0x2b')](_0x397634['query']);_0x469ba7[_0xc9b3('0x2c')]=_[_0xc9b3('0x2d')](_0x469ba7[_0xc9b3('0x28')],_0x469ba7[_0xc9b3('0x2a')]);_0x3bd417[_0xc9b3('0x2e')]=_['intersection'](_0x469ba7[_0xc9b3('0x28')],qs[_0xc9b3('0x2f')](_0x397634[_0xc9b3('0x2a')]['fields']));_0x3bd417[_0xc9b3('0x2e')]=_0x3bd417[_0xc9b3('0x2e')][_0xc9b3('0x30')]?_0x3bd417['attributes']:_0x469ba7[_0xc9b3('0x28')];if(_0x397634[_0xc9b3('0x2a')][_0xc9b3('0x37')]){_0x3bd417['include']=[{'all':!![]}];}_0x3bd417=_['merge']({},_0x3bd417,_0x397634[_0xc9b3('0x3d')]);return db[_0xc9b3('0x25')]['find'](_0x3bd417)[_0xc9b3('0x20')](handleEntityNotFound(_0x14d21a,null))['then'](respondWithResult(_0x14d21a,null))['catch'](handleError(_0x14d21a,null));};exports[_0xc9b3('0x3e')]=function(_0x52ea35,_0x17dd58){return db[_0xc9b3('0x25')]['create'](_0x52ea35[_0xc9b3('0x3f')],{})['then'](respondWithResult(_0x17dd58,0xc9))[_0xc9b3('0x40')](handleError(_0x17dd58,null));};exports[_0xc9b3('0x1f')]=function(_0x14c14f,_0x21336f){if(_0x14c14f[_0xc9b3('0x3f')]['id']){delete _0x14c14f['body']['id'];}return db[_0xc9b3('0x25')][_0xc9b3('0x41')]({'where':{'id':_0x14c14f['params']['id']}})[_0xc9b3('0x20')](handleEntityNotFound(_0x21336f,null))[_0xc9b3('0x20')](saveUpdates(_0x14c14f[_0xc9b3('0x3f')],null))[_0xc9b3('0x20')](respondWithResult(_0x21336f,null))[_0xc9b3('0x40')](handleError(_0x21336f,null));};exports['destroy']=function(_0x123dcb,_0x41df63){return db['ServicenowField'][_0xc9b3('0x41')]({'where':{'id':_0x123dcb[_0xc9b3('0x3c')]['id']}})[_0xc9b3('0x20')](handleEntityNotFound(_0x41df63,null))[_0xc9b3('0x20')](removeEntity(_0x41df63,null))[_0xc9b3('0x40')](handleError(_0x41df63,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5264ef3..5ba3dc4 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 _0x8338=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x187c00,_0x12e588){var _0xf1162f=function(_0x4eac41){while(--_0x4eac41){_0x187c00['push'](_0x187c00['shift']());}};_0xf1162f(++_0x12e588);}(_0x8338,0xe6));var _0x8833=function(_0x1d6f0d,_0x57817f){_0x1d6f0d=_0x1d6f0d-0x0;var _0x277185=_0x8338[_0x1d6f0d];return _0x277185;};'use strict';var _=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var logger=require(_0x8833('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8833('0x3'));var rp=require(_0x8833('0x4'));var fs=require('fs');var path=require(_0x8833('0x5'));var rimraf=require(_0x8833('0x6'));var config=require(_0x8833('0x7'));var attributes=require(_0x8833('0x8'));module[_0x8833('0x9')]=function(_0x1c2424,_0x345cf3){return _0x1c2424[_0x8833('0xa')](_0x8833('0xb'),attributes,{'tableName':_0x8833('0xc'),'paranoid':![],'indexes':[{'name':_0x8833('0xd'),'fields':['idField',_0x8833('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe2c=['api','moment','bluebird','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','lodash','util','../../config/logger'];(function(_0x5c5603,_0x17fd20){var _0x49028c=function(_0x22d5c3){while(--_0x22d5c3){_0x5c5603['push'](_0x5c5603['shift']());}};_0x49028c(++_0x17fd20);}(_0xbe2c,0x169));var _0xcbe2=function(_0x3b58c7,_0x486f85){_0x3b58c7=_0x3b58c7-0x0;var _0x2f0e39=_0xbe2c[_0x3b58c7];return _0x2f0e39;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var logger=require(_0xcbe2('0x2'))(_0xcbe2('0x3'));var moment=require(_0xcbe2('0x4'));var BPromise=require(_0xcbe2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbe2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcbe2('0x7'));module[_0xcbe2('0x8')]=function(_0x12d0e6,_0x518ee5){return _0x12d0e6[_0xcbe2('0x9')](_0xcbe2('0xa'),attributes,{'tableName':_0xcbe2('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xcbe2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index d24cbdd..cc899c4 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x4de168,_0x2f9a41){var _0x4ad68c=function(_0x6f2b55){while(--_0x6f2b55){_0x4de168['push'](_0x4de168['shift']());}};_0x4ad68c(++_0x2f9a41);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x241c5d,_0x3ed23f){var _0x77650b=function(_0x4d212a){while(--_0x4d212a){_0x241c5d['push'](_0x241c5d['shift']());}};_0x77650b(++_0x3ed23f);}(_0xaa88,0x137));var _0x8aa8=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0xaa88[_0x33c1b1];return _0x2c2037;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9617e0b..19df7f5 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27ff2b,_0x50c13f){var _0xedecaf=function(_0x4808da){while(--_0x4808da){_0x27ff2b['push'](_0x27ff2b['shift']());}};_0xedecaf(++_0x50c13f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4762d2,_0x176167){var _0x2a3cd4=function(_0x8eeccd){while(--_0x8eeccd){_0x4762d2['push'](_0x4762d2['shift']());}};_0x2a3cd4(++_0x176167);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 785a94b..0f2291d 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(_0x4b9609,_0x21c82f){var _0x4ffb78=function(_0x4223ec){while(--_0x4223ec){_0x4b9609['push'](_0x4b9609['shift']());}};_0x4ffb78(++_0x21c82f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x346f87,_0x17807d){var _0x14cff0=function(_0x5f5928){while(--_0x5f5928){_0x346f87['push'](_0x346f87['shift']());}};_0x14cff0(++_0x17807d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index bba43a2..135c44f 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 _0xc2cc=['fast-json-patch','moment','mustache','path','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','limit','undefined','count','offset','set','reject','update','destroy','sendStatus','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','body','getConfigurations','findOne','SugarcrmConfiguration','pick','filter','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','create','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','stringify','values','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir'];(function(_0x228d44,_0x2a8722){var _0x1623f7=function(_0x4739b4){while(--_0x4739b4){_0x228d44['push'](_0x228d44['shift']());}};_0x1623f7(++_0x2a8722);}(_0xc2cc,0x70));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc2c('0x0'));var zipdir=require(_0xcc2c('0x1'));var jsonpatch=require(_0xcc2c('0x2'));var rp=require('request-promise');var moment=require(_0xcc2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc2c('0x4'));var util=require('util');var path=require(_0xcc2c('0x5'));var sox=require('sox');var csv=require(_0xcc2c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc2c('0x7'));var squel=require('squel');var crypto=require(_0xcc2c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xcc2c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc2c('0xa'));var Redis=require(_0xcc2c('0xb'));var authService=require(_0xcc2c('0xc'));var qs=require(_0xcc2c('0xd'));var as=require(_0xcc2c('0xe'));var hardwareService=require(_0xcc2c('0xf'));var logger=require(_0xcc2c('0x10'))(_0xcc2c('0x11'));var utils=require('../../config/utils');var config=require(_0xcc2c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc2c('0x13'))['db'];var integrations=require(_0xcc2c('0x14'));function respondWithStatusCode(_0x3900a4,_0x1f6f0f){_0x1f6f0f=_0x1f6f0f||0xcc;return function(_0x57d7c1){if(_0x57d7c1){return _0x3900a4['sendStatus'](_0x1f6f0f);}return _0x3900a4['status'](_0x1f6f0f)[_0xcc2c('0x15')]();};}function respondWithResult(_0xc1cafd,_0x5086f2){_0x5086f2=_0x5086f2||0xc8;return function(_0x4ad8a2){if(_0x4ad8a2){return _0xc1cafd[_0xcc2c('0x16')](_0x5086f2)['json'](_0x4ad8a2);}};}function respondWithFilteredResult(_0x18a774,_0x344caa){return function(_0x10a651){if(_0x10a651){var _0x38fb6f=typeof _0x344caa['offset']==='undefined'&&typeof _0x344caa[_0xcc2c('0x17')]===_0xcc2c('0x18');var _0x59185d=_0x10a651[_0xcc2c('0x19')];var _0x285deb=_0x38fb6f?0x0:_0x344caa[_0xcc2c('0x1a')];var _0x2a9f02=_0x38fb6f?_0x10a651[_0xcc2c('0x19')]:_0x344caa[_0xcc2c('0x1a')]+_0x344caa[_0xcc2c('0x17')];var _0x5a1f0a;if(_0x2a9f02>=_0x59185d){_0x2a9f02=_0x59185d;_0x5a1f0a=0xc8;}else{_0x5a1f0a=0xce;}_0x18a774[_0xcc2c('0x16')](_0x5a1f0a);return _0x18a774[_0xcc2c('0x1b')]('Content-Range',_0x285deb+'-'+_0x2a9f02+'/'+_0x59185d)['json'](_0x10a651);}return null;};}function patchUpdates(_0x4a67f4){return function(_0x15bbd6){try{jsonpatch['apply'](_0x15bbd6,_0x4a67f4,!![]);}catch(_0x11ee63){return BPromise[_0xcc2c('0x1c')](_0x11ee63);}return _0x15bbd6['save']();};}function saveUpdates(_0x321279,_0x831360){return function(_0x5c7c53){if(_0x5c7c53){return _0x5c7c53[_0xcc2c('0x1d')](_0x321279)['then'](function(_0x31788d){return _0x31788d;});}return null;};}function removeEntity(_0x5233e3,_0x4d5132){return function(_0x26fd43){if(_0x26fd43){return _0x26fd43[_0xcc2c('0x1e')]()['then'](function(){_0x5233e3[_0xcc2c('0x16')](0xcc)[_0xcc2c('0x15')]();});}};}function handleEntityNotFound(_0x3129d3,_0x98ae06){return function(_0x35f59b){if(!_0x35f59b){_0x3129d3[_0xcc2c('0x1f')](0x194);}return _0x35f59b;};}function handleError(_0x4aeb24,_0xaab877){_0xaab877=_0xaab877||0x1f4;return function(_0x17e528){logger[_0xcc2c('0x20')](_0x17e528[_0xcc2c('0x21')]);if(_0x17e528[_0xcc2c('0x22')]){delete _0x17e528['name'];}_0x4aeb24['status'](_0xaab877)['send'](_0x17e528);};}exports['index']=function(_0x28bb05,_0x168ef6){var _0x406515={},_0x2c4ce9={},_0x3ad1aa={'count':0x0,'rows':[]};var _0x184de4=_[_0xcc2c('0x23')](db[_0xcc2c('0x24')][_0xcc2c('0x25')],function(_0x3cd971){return{'name':_0x3cd971[_0xcc2c('0x26')],'type':_0x3cd971['type'][_0xcc2c('0x27')]};});_0x2c4ce9['model']=_['map'](_0x184de4,'name');_0x2c4ce9[_0xcc2c('0x28')]=_[_0xcc2c('0x29')](_0x28bb05['query']);_0x2c4ce9['filters']=_[_0xcc2c('0x2a')](_0x2c4ce9['model'],_0x2c4ce9[_0xcc2c('0x28')]);_0x406515[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x2c4ce9[_0xcc2c('0x2c')],qs[_0xcc2c('0x2d')](_0x28bb05['query']['fields']));_0x406515[_0xcc2c('0x2b')]=_0x406515[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x406515[_0xcc2c('0x2b')]:_0x2c4ce9[_0xcc2c('0x2c')];if(!_0x28bb05['query'][_0xcc2c('0x2f')]('nolimit')){_0x406515[_0xcc2c('0x17')]=qs[_0xcc2c('0x17')](_0x28bb05['query'][_0xcc2c('0x17')]);_0x406515['offset']=qs['offset'](_0x28bb05[_0xcc2c('0x28')]['offset']);}_0x406515[_0xcc2c('0x30')]=qs[_0xcc2c('0x31')](_0x28bb05[_0xcc2c('0x28')]['sort']);_0x406515[_0xcc2c('0x32')]=qs[_0xcc2c('0x33')](_['pick'](_0x28bb05[_0xcc2c('0x28')],_0x2c4ce9['filters']),_0x184de4);if(_0x28bb05[_0xcc2c('0x28')]['filter']){_0x406515[_0xcc2c('0x32')]=_[_0xcc2c('0x34')](_0x406515[_0xcc2c('0x32')],{'$or':_['map'](_0x184de4,function(_0x40509e){if(_0x40509e[_0xcc2c('0x35')]!==_0xcc2c('0x36')){var _0x116afd={};_0x116afd[_0x40509e[_0xcc2c('0x22')]]={'$like':'%'+_0x28bb05[_0xcc2c('0x28')]['filter']+'%'};return _0x116afd;}})});}_0x406515=_[_0xcc2c('0x34')]({},_0x406515,_0x28bb05[_0xcc2c('0x37')]);var _0xd6e808={'where':_0x406515[_0xcc2c('0x32')]};return db['SugarcrmAccount'][_0xcc2c('0x19')](_0xd6e808)[_0xcc2c('0x38')](function(_0x1909fb){_0x3ad1aa[_0xcc2c('0x19')]=_0x1909fb;if(_0x28bb05[_0xcc2c('0x28')][_0xcc2c('0x39')]){_0x406515[_0xcc2c('0x3a')]=[{'all':!![]}];}return db[_0xcc2c('0x24')][_0xcc2c('0x3b')](_0x406515);})[_0xcc2c('0x38')](function(_0x5cd4f4){_0x3ad1aa[_0xcc2c('0x3c')]=_0x5cd4f4;return _0x3ad1aa;})[_0xcc2c('0x38')](respondWithFilteredResult(_0x168ef6,_0x406515))['catch'](handleError(_0x168ef6,null));};exports[_0xcc2c('0x3d')]=function(_0x42d8c0,_0x3be3ed){var _0x3e30bf={'raw':![],'where':{'id':_0x42d8c0[_0xcc2c('0x3e')]['id']}},_0x3a1a80={};_0x3a1a80[_0xcc2c('0x2c')]=_['keys'](db[_0xcc2c('0x24')][_0xcc2c('0x25')]);_0x3a1a80[_0xcc2c('0x28')]=_[_0xcc2c('0x29')](_0x42d8c0[_0xcc2c('0x28')]);_0x3a1a80[_0xcc2c('0x33')]=_[_0xcc2c('0x2a')](_0x3a1a80['model'],_0x3a1a80['query']);_0x3e30bf[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x3a1a80[_0xcc2c('0x2c')],qs[_0xcc2c('0x2d')](_0x42d8c0[_0xcc2c('0x28')][_0xcc2c('0x2d')]));_0x3e30bf[_0xcc2c('0x2b')]=_0x3e30bf[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x3e30bf[_0xcc2c('0x2b')]:_0x3a1a80['model'];if(_0x42d8c0[_0xcc2c('0x28')]['includeAll']){_0x3e30bf[_0xcc2c('0x3a')]=[{'all':!![]}];}_0x3e30bf=_[_0xcc2c('0x34')]({},_0x3e30bf,_0x42d8c0['options']);return db[_0xcc2c('0x24')][_0xcc2c('0x3f')](_0x3e30bf)[_0xcc2c('0x38')](handleEntityNotFound(_0x3be3ed,null))[_0xcc2c('0x38')](respondWithResult(_0x3be3ed,null))[_0xcc2c('0x40')](handleError(_0x3be3ed,null));};exports['create']=function(_0x4f50fc,_0x283d10){return db['SugarcrmAccount']['create'](_0x4f50fc['body'],{})[_0xcc2c('0x38')](respondWithResult(_0x283d10,0xc9))['catch'](handleError(_0x283d10,null));};exports['update']=function(_0x55a70f,_0x5a1deb){if(_0x55a70f['body']['id']){delete _0x55a70f['body']['id'];}return db[_0xcc2c('0x24')]['find']({'where':{'id':_0x55a70f[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x5a1deb,null))[_0xcc2c('0x38')](saveUpdates(_0x55a70f[_0xcc2c('0x41')],null))['then'](respondWithResult(_0x5a1deb,null))[_0xcc2c('0x40')](handleError(_0x5a1deb,null));};exports[_0xcc2c('0x1e')]=function(_0x259949,_0x2b93a7){return db['SugarcrmAccount'][_0xcc2c('0x3f')]({'where':{'id':_0x259949[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x2b93a7,null))[_0xcc2c('0x38')](removeEntity(_0x2b93a7,null))[_0xcc2c('0x40')](handleError(_0x2b93a7,null));};exports[_0xcc2c('0x42')]=function(_0x455f59,_0x19c04e,_0x113660){var _0x298c2d={};var _0x19176e={};var _0x46d7e4;var _0x5de4ce;return db[_0xcc2c('0x24')][_0xcc2c('0x43')]({'where':{'id':_0x455f59[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x19c04e,null))['then'](function(_0x43c714){if(_0x43c714){_0x46d7e4=_0x43c714;_0x19176e[_0xcc2c('0x2c')]=_[_0xcc2c('0x29')](db[_0xcc2c('0x44')][_0xcc2c('0x25')]);_0x19176e['query']=_[_0xcc2c('0x29')](_0x455f59[_0xcc2c('0x28')]);_0x19176e[_0xcc2c('0x33')]=_['intersection'](_0x19176e[_0xcc2c('0x2c')],_0x19176e[_0xcc2c('0x28')]);_0x298c2d[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x19176e[_0xcc2c('0x2c')],qs['fields'](_0x455f59['query'][_0xcc2c('0x2d')]));_0x298c2d['attributes']=_0x298c2d[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x298c2d['attributes']:_0x19176e[_0xcc2c('0x2c')];_0x298c2d[_0xcc2c('0x30')]=qs[_0xcc2c('0x31')](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x31')]);_0x298c2d['where']=qs[_0xcc2c('0x33')](_[_0xcc2c('0x45')](_0x455f59[_0xcc2c('0x28')],_0x19176e[_0xcc2c('0x33')]));if(_0x455f59[_0xcc2c('0x28')]['filter']){_0x298c2d[_0xcc2c('0x32')]=_[_0xcc2c('0x34')](_0x298c2d[_0xcc2c('0x32')],{'$or':_['map'](_0x298c2d[_0xcc2c('0x2b')],function(_0x159ddc){var _0x1d9629={};_0x1d9629[_0x159ddc]={'$like':'%'+_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x46')]+'%'};return _0x1d9629;})});}_0x298c2d=_[_0xcc2c('0x34')]({},_0x298c2d,_0x455f59[_0xcc2c('0x37')]);return _0x46d7e4['getConfigurations'](_0x298c2d);}})[_0xcc2c('0x38')](function(_0x4df48e){if(_0x4df48e){_0x5de4ce=_0x4df48e[_0xcc2c('0x2e')];if(!_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x2f')](_0xcc2c('0x47'))){_0x298c2d[_0xcc2c('0x17')]=qs[_0xcc2c('0x17')](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x17')]);_0x298c2d[_0xcc2c('0x1a')]=qs['offset'](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x1a')]);}return _0x46d7e4['getConfigurations'](_0x298c2d);}})[_0xcc2c('0x38')](function(_0x432094){if(_0x432094){return _0x432094?{'count':_0x5de4ce,'rows':_0x432094}:null;}})['then'](respondWithResult(_0x19c04e,null))[_0xcc2c('0x40')](handleError(_0x19c04e,null));};exports[_0xcc2c('0x48')]=function(_0x1c6630,_0x1c99b4,_0x3902bb){if(_0x1c6630[_0xcc2c('0x41')]['id']){delete _0x1c6630[_0xcc2c('0x41')]['id'];}return db[_0xcc2c('0x24')][_0xcc2c('0x43')]({'where':{'id':_0x1c6630['params']['id']}})['then'](handleEntityNotFound(_0x1c99b4,null))[_0xcc2c('0x38')](function(_0x1c6b2e){if(_0x1c6b2e){_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x49')]=_0x1c6b2e['id'];_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x4a')]=integrations['getSubjects'](_0x1c6630[_0xcc2c('0x41')]['channel'],_0x1c6630['body'][_0xcc2c('0x35')]);_0x1c6630[_0xcc2c('0x41')]['Descriptions']=integrations[_0xcc2c('0x4b')](_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x4c')],_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x35')]);return db[_0xcc2c('0x44')][_0xcc2c('0x4d')](_0x1c6630[_0xcc2c('0x41')],{'include':[{'model':db['SugarcrmField'],'as':_0xcc2c('0x4a')},{'model':db[_0xcc2c('0x4e')],'as':_0xcc2c('0x4f')}]});}return null;})[_0xcc2c('0x38')](respondWithResult(_0x1c99b4,null))['catch'](handleError(_0x1c99b4,null));};exports[_0xcc2c('0x50')]=function(_0x22daa3,_0x585164,_0x5ea133){var _0x1fc9d8='';var _0x1e8121=['id','name',_0xcc2c('0x51'),_0xcc2c('0x52'),'description',_0xcc2c('0x53'),_0xcc2c('0x54'),'duration_minutes',_0xcc2c('0x55'),_0xcc2c('0x56'),'parent_name',_0xcc2c('0x57')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x22daa3['params']['id']},'attributes':['id',_0xcc2c('0x58'),_0xcc2c('0x59'),_0xcc2c('0x5a')]})[_0xcc2c('0x38')](handleEntityNotFound(_0x585164,null))[_0xcc2c('0x38')](function(_0x4e182a){if(_0x4e182a){_0x1fc9d8=_0x4e182a[_0xcc2c('0x5a')];var _0x8f136b=_0x1fc9d8[_0xcc2c('0x5b')](-0x1);if(_0x8f136b==='/'){_0x1fc9d8=_0x1fc9d8['substring'](0x0,_0x1fc9d8[_0xcc2c('0x5c')](_0x8f136b));}return rp({'method':_0xcc2c('0x5d'),'uri':util[_0xcc2c('0x5e')]('%s%s',_0x1fc9d8,_0xcc2c('0x5f')),'json':!![],'form':{'method':_0xcc2c('0x60'),'input_type':'JSON','response_type':_0xcc2c('0x61'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4e182a[_0xcc2c('0x58')],'password':_0x4e182a[_0xcc2c('0x59')],'encryption':_0xcc2c('0x62')},'application':_0xcc2c('0x63')})}});}})['then'](function(_0x1e3880){if(_0x1e3880&&_0x1e3880['name']!==_0xcc2c('0x64')&&_0x1e3880[_0xcc2c('0x22')]!=='Password\x20Expired'){return rp({'method':_0xcc2c('0x5d'),'uri':util[_0xcc2c('0x5e')](_0xcc2c('0x65'),_0x1fc9d8,_0xcc2c('0x5f')),'json':!![],'form':{'method':_0xcc2c('0x66'),'input_type':_0xcc2c('0x61'),'response_type':_0xcc2c('0x61'),'rest_data':JSON[_0xcc2c('0x67')]({'session':_0x1e3880['id'],'module_name':'Calls'})}})[_0xcc2c('0x38')](function(_0x44028e){if(_0x44028e){var _0x488ba0=_[_0xcc2c('0x68')](_0x44028e['module_fields']);_[_0xcc2c('0x69')](_0x488ba0,function(_0x240d51){return _0x1e8121[_0xcc2c('0x6a')](_0x240d51['name']);});return{'count':_0x488ba0[_0xcc2c('0x2e')],'rows':_['map'](_0x488ba0,function(_0x376f43){return{'id':_0x376f43['name'],'name':_0x376f43[_0xcc2c('0x6b')],'custom':_[_0xcc2c('0x6c')](_0x376f43[_0xcc2c('0x22')],'_c')?!![]:![],'options':_0x376f43[_0xcc2c('0x37')]?_['map'](_['values'](_0x376f43['options']),function(_0x394097){return{'name':_0x394097[_0xcc2c('0x6d')],'value':_0x394097[_0xcc2c('0x22')]};}):[]};})};}})['then'](respondWithResult(_0x585164,null))[_0xcc2c('0x40')](function(_0x35f998){var _0x457979=_0x22daa3[_0xcc2c('0x28')]['test']?0x1f4:_0x35f998[_0xcc2c('0x6e')]||0x1f4;logger[_0xcc2c('0x20')](_0xcc2c('0x6f'),_0xcc2c('0x50'),_0x457979,JSON['stringify'](_0x35f998));delete _0x35f998[_0xcc2c('0x22')];if(_0x457979===0x191){_0x457979=0x190;}_0x585164[_0xcc2c('0x16')](_0x457979)[_0xcc2c('0x70')](_0x22daa3[_0xcc2c('0x28')]['test']?{'message':_0xcc2c('0x71'),'statusCode':_0x35f998[_0xcc2c('0x6e')]}:_0x35f998);});}else{var _0x3d6288=0x1f4;_0x585164['status'](_0x3d6288)['send']({'message':_0xcc2c('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x98c9=['Calls','remove','includes','label','values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','filters','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x98c9,0x84));var _0x998c=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x98c9[_0x545a3a];return _0x5a5493;};'use strict';var emlformat=require(_0x998c('0x0'));var rimraf=require(_0x998c('0x1'));var zipdir=require(_0x998c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x998c('0x3'));var moment=require(_0x998c('0x4'));var BPromise=require(_0x998c('0x5'));var Mustache=require(_0x998c('0x6'));var util=require(_0x998c('0x7'));var path=require(_0x998c('0x8'));var sox=require('sox');var csv=require(_0x998c('0x9'));var ejs=require(_0x998c('0xa'));var fs=require('fs');var fs_extra=require(_0x998c('0xb'));var _=require('lodash');var squel=require(_0x998c('0xc'));var crypto=require(_0x998c('0xd'));var jsforce=require(_0x998c('0xe'));var deskjs=require(_0x998c('0xf'));var toCsv=require(_0x998c('0x9'));var querystring=require(_0x998c('0x10'));var Papa=require('papaparse');var Redis=require(_0x998c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x998c('0x12'));var as=require(_0x998c('0x13'));var hardwareService=require(_0x998c('0x14'));var logger=require(_0x998c('0x15'))('api');var utils=require(_0x998c('0x16'));var config=require(_0x998c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x998c('0x18'))['db'];var integrations=require(_0x998c('0x19'));function respondWithStatusCode(_0x2d7767,_0x1bb3f4){_0x1bb3f4=_0x1bb3f4||0xcc;return function(_0x5ddfcb){if(_0x5ddfcb){return _0x2d7767[_0x998c('0x1a')](_0x1bb3f4);}return _0x2d7767['status'](_0x1bb3f4)[_0x998c('0x1b')]();};}function respondWithResult(_0x5079a7,_0xb7d529){_0xb7d529=_0xb7d529||0xc8;return function(_0x12b773){if(_0x12b773){return _0x5079a7[_0x998c('0x1c')](_0xb7d529)['json'](_0x12b773);}};}function respondWithFilteredResult(_0x397f78,_0x3166c2){return function(_0x496f72){if(_0x496f72){var _0x5dfd2c=typeof _0x3166c2['offset']===_0x998c('0x1d')&&typeof _0x3166c2[_0x998c('0x1e')]==='undefined';var _0x47cb06=_0x496f72[_0x998c('0x1f')];var _0x255b38=_0x5dfd2c?0x0:_0x3166c2[_0x998c('0x20')];var _0x282584=_0x5dfd2c?_0x496f72[_0x998c('0x1f')]:_0x3166c2['offset']+_0x3166c2[_0x998c('0x1e')];var _0x3f83cf;if(_0x282584>=_0x47cb06){_0x282584=_0x47cb06;_0x3f83cf=0xc8;}else{_0x3f83cf=0xce;}_0x397f78[_0x998c('0x1c')](_0x3f83cf);return _0x397f78[_0x998c('0x21')](_0x998c('0x22'),_0x255b38+'-'+_0x282584+'/'+_0x47cb06)[_0x998c('0x23')](_0x496f72);}return null;};}function patchUpdates(_0xaab311){return function(_0x7449a1){try{jsonpatch[_0x998c('0x24')](_0x7449a1,_0xaab311,!![]);}catch(_0x4ba744){return BPromise['reject'](_0x4ba744);}return _0x7449a1['save']();};}function saveUpdates(_0x21d2b5,_0x32c655){return function(_0x389d98){if(_0x389d98){return _0x389d98[_0x998c('0x25')](_0x21d2b5)['then'](function(_0x1102ac){return _0x1102ac;});}return null;};}function removeEntity(_0x4d2131,_0x11be93){return function(_0xc5e65a){if(_0xc5e65a){return _0xc5e65a[_0x998c('0x26')]()[_0x998c('0x27')](function(){_0x4d2131['status'](0xcc)[_0x998c('0x1b')]();});}};}function handleEntityNotFound(_0xde7286,_0x4d0f5d){return function(_0x47a94b){if(!_0x47a94b){_0xde7286[_0x998c('0x1a')](0x194);}return _0x47a94b;};}function handleError(_0x2a079b,_0x6c196d){_0x6c196d=_0x6c196d||0x1f4;return function(_0x53285e){logger[_0x998c('0x28')](_0x53285e[_0x998c('0x29')]);if(_0x53285e[_0x998c('0x2a')]){delete _0x53285e[_0x998c('0x2a')];}_0x2a079b[_0x998c('0x1c')](_0x6c196d)[_0x998c('0x2b')](_0x53285e);};}exports[_0x998c('0x2c')]=function(_0x4d6ef9,_0x45577d){var _0x197d03={},_0x215560={},_0xb00f62={'count':0x0,'rows':[]};var _0x1e5877=_[_0x998c('0x2d')](db[_0x998c('0x2e')][_0x998c('0x2f')],function(_0x2462d4){return{'name':_0x2462d4[_0x998c('0x30')],'type':_0x2462d4['type'][_0x998c('0x31')]};});_0x215560[_0x998c('0x32')]=_[_0x998c('0x2d')](_0x1e5877,_0x998c('0x2a'));_0x215560['query']=_['keys'](_0x4d6ef9['query']);_0x215560[_0x998c('0x33')]=_['intersection'](_0x215560[_0x998c('0x32')],_0x215560[_0x998c('0x34')]);_0x197d03[_0x998c('0x35')]=_['intersection'](_0x215560[_0x998c('0x32')],qs[_0x998c('0x36')](_0x4d6ef9[_0x998c('0x34')][_0x998c('0x36')]));_0x197d03[_0x998c('0x35')]=_0x197d03[_0x998c('0x35')]['length']?_0x197d03[_0x998c('0x35')]:_0x215560['model'];if(!_0x4d6ef9[_0x998c('0x34')][_0x998c('0x37')](_0x998c('0x38'))){_0x197d03['limit']=qs[_0x998c('0x1e')](_0x4d6ef9[_0x998c('0x34')][_0x998c('0x1e')]);_0x197d03[_0x998c('0x20')]=qs[_0x998c('0x20')](_0x4d6ef9['query'][_0x998c('0x20')]);}_0x197d03[_0x998c('0x39')]=qs['sort'](_0x4d6ef9[_0x998c('0x34')][_0x998c('0x3a')]);_0x197d03[_0x998c('0x3b')]=qs[_0x998c('0x33')](_[_0x998c('0x3c')](_0x4d6ef9[_0x998c('0x34')],_0x215560[_0x998c('0x33')]),_0x1e5877);if(_0x4d6ef9[_0x998c('0x34')][_0x998c('0x3d')]){_0x197d03[_0x998c('0x3b')]=_[_0x998c('0x3e')](_0x197d03[_0x998c('0x3b')],{'$or':_[_0x998c('0x2d')](_0x1e5877,function(_0x3c009f){if(_0x3c009f[_0x998c('0x3f')]!=='VIRTUAL'){var _0x387838={};_0x387838[_0x3c009f[_0x998c('0x2a')]]={'$like':'%'+_0x4d6ef9[_0x998c('0x34')][_0x998c('0x3d')]+'%'};return _0x387838;}})});}_0x197d03=_[_0x998c('0x3e')]({},_0x197d03,_0x4d6ef9['options']);var _0x18045a={'where':_0x197d03['where']};return db['SugarcrmAccount'][_0x998c('0x1f')](_0x18045a)[_0x998c('0x27')](function(_0x491cdc){_0xb00f62['count']=_0x491cdc;if(_0x4d6ef9[_0x998c('0x34')][_0x998c('0x40')]){_0x197d03[_0x998c('0x41')]=[{'all':!![]}];}return db[_0x998c('0x2e')][_0x998c('0x42')](_0x197d03);})[_0x998c('0x27')](function(_0x43311c){_0xb00f62[_0x998c('0x43')]=_0x43311c;return _0xb00f62;})[_0x998c('0x27')](respondWithFilteredResult(_0x45577d,_0x197d03))[_0x998c('0x44')](handleError(_0x45577d,null));};exports[_0x998c('0x45')]=function(_0x275c66,_0x328f01){var _0x33265e={'raw':![],'where':{'id':_0x275c66[_0x998c('0x46')]['id']}},_0x371e8a={};_0x371e8a[_0x998c('0x32')]=_[_0x998c('0x47')](db[_0x998c('0x2e')][_0x998c('0x2f')]);_0x371e8a['query']=_[_0x998c('0x47')](_0x275c66[_0x998c('0x34')]);_0x371e8a[_0x998c('0x33')]=_[_0x998c('0x48')](_0x371e8a[_0x998c('0x32')],_0x371e8a['query']);_0x33265e[_0x998c('0x35')]=_[_0x998c('0x48')](_0x371e8a[_0x998c('0x32')],qs[_0x998c('0x36')](_0x275c66[_0x998c('0x34')][_0x998c('0x36')]));_0x33265e[_0x998c('0x35')]=_0x33265e[_0x998c('0x35')][_0x998c('0x49')]?_0x33265e[_0x998c('0x35')]:_0x371e8a[_0x998c('0x32')];if(_0x275c66[_0x998c('0x34')][_0x998c('0x40')]){_0x33265e[_0x998c('0x41')]=[{'all':!![]}];}_0x33265e=_[_0x998c('0x3e')]({},_0x33265e,_0x275c66[_0x998c('0x4a')]);return db[_0x998c('0x2e')][_0x998c('0x4b')](_0x33265e)[_0x998c('0x27')](handleEntityNotFound(_0x328f01,null))[_0x998c('0x27')](respondWithResult(_0x328f01,null))['catch'](handleError(_0x328f01,null));};exports['create']=function(_0x38e109,_0x1a858a){return db['SugarcrmAccount'][_0x998c('0x4c')](_0x38e109[_0x998c('0x4d')],{})[_0x998c('0x27')](respondWithResult(_0x1a858a,0xc9))['catch'](handleError(_0x1a858a,null));};exports['update']=function(_0x4dda16,_0x230bdf){if(_0x4dda16[_0x998c('0x4d')]['id']){delete _0x4dda16[_0x998c('0x4d')]['id'];}return db[_0x998c('0x2e')]['find']({'where':{'id':_0x4dda16[_0x998c('0x46')]['id']}})['then'](handleEntityNotFound(_0x230bdf,null))['then'](saveUpdates(_0x4dda16[_0x998c('0x4d')],null))['then'](respondWithResult(_0x230bdf,null))[_0x998c('0x44')](handleError(_0x230bdf,null));};exports[_0x998c('0x26')]=function(_0x1b7b2b,_0x3a1b44){return db[_0x998c('0x2e')]['find']({'where':{'id':_0x1b7b2b['params']['id']}})['then'](handleEntityNotFound(_0x3a1b44,null))[_0x998c('0x27')](removeEntity(_0x3a1b44,null))[_0x998c('0x44')](handleError(_0x3a1b44,null));};exports[_0x998c('0x4e')]=function(_0x15f6d7,_0x5b1d18,_0x1ca4ae){var _0x4e696d={};var _0x26154b={};var _0x3e5709;var _0x11fe55;return db[_0x998c('0x2e')][_0x998c('0x4f')]({'where':{'id':_0x15f6d7[_0x998c('0x46')]['id']}})[_0x998c('0x27')](handleEntityNotFound(_0x5b1d18,null))[_0x998c('0x27')](function(_0x499625){if(_0x499625){_0x3e5709=_0x499625;_0x26154b['model']=_[_0x998c('0x47')](db[_0x998c('0x50')][_0x998c('0x2f')]);_0x26154b[_0x998c('0x34')]=_[_0x998c('0x47')](_0x15f6d7['query']);_0x26154b[_0x998c('0x33')]=_[_0x998c('0x48')](_0x26154b[_0x998c('0x32')],_0x26154b['query']);_0x4e696d[_0x998c('0x35')]=_[_0x998c('0x48')](_0x26154b[_0x998c('0x32')],qs['fields'](_0x15f6d7['query']['fields']));_0x4e696d[_0x998c('0x35')]=_0x4e696d[_0x998c('0x35')][_0x998c('0x49')]?_0x4e696d[_0x998c('0x35')]:_0x26154b[_0x998c('0x32')];_0x4e696d['order']=qs['sort'](_0x15f6d7[_0x998c('0x34')][_0x998c('0x3a')]);_0x4e696d[_0x998c('0x3b')]=qs[_0x998c('0x33')](_[_0x998c('0x3c')](_0x15f6d7['query'],_0x26154b[_0x998c('0x33')]));if(_0x15f6d7['query']['filter']){_0x4e696d[_0x998c('0x3b')]=_[_0x998c('0x3e')](_0x4e696d[_0x998c('0x3b')],{'$or':_['map'](_0x4e696d[_0x998c('0x35')],function(_0x27eb90){var _0x2447ae={};_0x2447ae[_0x27eb90]={'$like':'%'+_0x15f6d7[_0x998c('0x34')][_0x998c('0x3d')]+'%'};return _0x2447ae;})});}_0x4e696d=_[_0x998c('0x3e')]({},_0x4e696d,_0x15f6d7[_0x998c('0x4a')]);return _0x3e5709[_0x998c('0x4e')](_0x4e696d);}})[_0x998c('0x27')](function(_0x30a611){if(_0x30a611){_0x11fe55=_0x30a611[_0x998c('0x49')];if(!_0x15f6d7[_0x998c('0x34')]['hasOwnProperty']('nolimit')){_0x4e696d[_0x998c('0x1e')]=qs[_0x998c('0x1e')](_0x15f6d7[_0x998c('0x34')][_0x998c('0x1e')]);_0x4e696d['offset']=qs[_0x998c('0x20')](_0x15f6d7[_0x998c('0x34')][_0x998c('0x20')]);}return _0x3e5709['getConfigurations'](_0x4e696d);}})['then'](function(_0x3b70c6){if(_0x3b70c6){return _0x3b70c6?{'count':_0x11fe55,'rows':_0x3b70c6}:null;}})[_0x998c('0x27')](respondWithResult(_0x5b1d18,null))[_0x998c('0x44')](handleError(_0x5b1d18,null));};exports[_0x998c('0x51')]=function(_0x269556,_0x5ad3fb,_0xf821d0){if(_0x269556['body']['id']){delete _0x269556[_0x998c('0x4d')]['id'];}return db['SugarcrmAccount'][_0x998c('0x4f')]({'where':{'id':_0x269556[_0x998c('0x46')]['id']}})[_0x998c('0x27')](handleEntityNotFound(_0x5ad3fb,null))['then'](function(_0x37d8fd){if(_0x37d8fd){_0x269556[_0x998c('0x4d')][_0x998c('0x52')]=_0x37d8fd['id'];_0x269556[_0x998c('0x4d')]['Subjects']=integrations[_0x998c('0x53')](_0x269556['body']['channel'],_0x269556[_0x998c('0x4d')][_0x998c('0x3f')]);_0x269556[_0x998c('0x4d')][_0x998c('0x54')]=integrations[_0x998c('0x55')](_0x269556['body'][_0x998c('0x56')],_0x269556['body'][_0x998c('0x3f')]);return db[_0x998c('0x50')]['create'](_0x269556[_0x998c('0x4d')],{'include':[{'model':db[_0x998c('0x57')],'as':_0x998c('0x58')},{'model':db[_0x998c('0x57')],'as':_0x998c('0x54')}]});}return null;})[_0x998c('0x27')](respondWithResult(_0x5ad3fb,null))[_0x998c('0x44')](handleError(_0x5ad3fb,null));};exports[_0x998c('0x59')]=function(_0x2df0f3,_0x19f6fb,_0x4531f5){var _0xe8ce86='';var _0x879b9e=['id','name',_0x998c('0x5a'),_0x998c('0x5b'),'description',_0x998c('0x5c'),_0x998c('0x5d'),'duration_minutes','parent_id',_0x998c('0x5e'),_0x998c('0x5f'),_0x998c('0x60')];return db['SugarcrmAccount'][_0x998c('0x4f')]({'where':{'id':_0x2df0f3[_0x998c('0x46')]['id']},'attributes':['id',_0x998c('0x61'),_0x998c('0x62'),_0x998c('0x63')]})[_0x998c('0x27')](handleEntityNotFound(_0x19f6fb,null))['then'](function(_0x1e1f8a){if(_0x1e1f8a){_0xe8ce86=_0x1e1f8a[_0x998c('0x63')];var _0x5f13e9=_0xe8ce86[_0x998c('0x64')](-0x1);if(_0x5f13e9==='/'){_0xe8ce86=_0xe8ce86[_0x998c('0x65')](0x0,_0xe8ce86[_0x998c('0x66')](_0x5f13e9));}return rp({'method':'POST','uri':util[_0x998c('0x67')](_0x998c('0x68'),_0xe8ce86,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x998c('0x69'),'input_type':_0x998c('0x6a'),'response_type':_0x998c('0x6a'),'rest_data':JSON[_0x998c('0x6b')]({'user_auth':{'user_name':_0x1e1f8a[_0x998c('0x61')],'password':_0x1e1f8a[_0x998c('0x62')],'encryption':_0x998c('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x998c('0x27')](function(_0x15af20){if(_0x15af20&&_0x15af20[_0x998c('0x2a')]!==_0x998c('0x6d')&&_0x15af20['name']!==_0x998c('0x6e')){return rp({'method':_0x998c('0x6f'),'uri':util[_0x998c('0x67')](_0x998c('0x68'),_0xe8ce86,_0x998c('0x70')),'json':!![],'form':{'method':_0x998c('0x71'),'input_type':_0x998c('0x6a'),'response_type':_0x998c('0x6a'),'rest_data':JSON[_0x998c('0x6b')]({'session':_0x15af20['id'],'module_name':_0x998c('0x72')})}})[_0x998c('0x27')](function(_0x198062){if(_0x198062){var _0x28ee88=_['values'](_0x198062['module_fields']);_[_0x998c('0x73')](_0x28ee88,function(_0x482d59){return _0x879b9e[_0x998c('0x74')](_0x482d59[_0x998c('0x2a')]);});return{'count':_0x28ee88[_0x998c('0x49')],'rows':_[_0x998c('0x2d')](_0x28ee88,function(_0x2e81dd){return{'id':_0x2e81dd['name'],'name':_0x2e81dd[_0x998c('0x75')],'custom':_['endsWith'](_0x2e81dd[_0x998c('0x2a')],'_c')?!![]:![],'options':_0x2e81dd[_0x998c('0x4a')]?_[_0x998c('0x2d')](_[_0x998c('0x76')](_0x2e81dd[_0x998c('0x4a')]),function(_0xe9d8a){return{'name':_0xe9d8a['value'],'value':_0xe9d8a[_0x998c('0x2a')]};}):[]};})};}})[_0x998c('0x27')](respondWithResult(_0x19f6fb,null))[_0x998c('0x44')](function(_0x4aee93){var _0x587f7d=_0x2df0f3[_0x998c('0x34')]['test']?0x1f4:_0x4aee93[_0x998c('0x77')]||0x1f4;logger[_0x998c('0x28')](_0x998c('0x78'),_0x998c('0x59'),_0x587f7d,JSON[_0x998c('0x6b')](_0x4aee93));delete _0x4aee93[_0x998c('0x2a')];if(_0x587f7d===0x191){_0x587f7d=0x190;}_0x19f6fb[_0x998c('0x1c')](_0x587f7d)[_0x998c('0x2b')](_0x2df0f3['query'][_0x998c('0x79')]?{'message':_0x998c('0x7a'),'statusCode':_0x4aee93['statusCode']}:_0x4aee93);});}else{var _0x3ffdcb=0x1f4;_0x19f6fb[_0x998c('0x1c')](_0x3ffdcb)['send']({'message':_0x998c('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 37f67e8..d395579 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 _0x8d41=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x5bc41c,_0x926b55){var _0x99951b=function(_0x5a07e8){while(--_0x5a07e8){_0x5bc41c['push'](_0x5bc41c['shift']());}};_0x99951b(++_0x926b55);}(_0x8d41,0x1aa));var _0x18d4=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0x8d41[_0x2aaa60];return _0x2e3fa5;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var logger=require(_0x18d4('0x2'))(_0x18d4('0x3'));var moment=require(_0x18d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x18d4('0x5'));var fs=require('fs');var path=require(_0x18d4('0x6'));var rimraf=require(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var attributes=require(_0x18d4('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x18d4('0xa')]=function(_0x25b129,_0x31e994){return _0x25b129[_0x18d4('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x18d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0799=['util','../../config/logger','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x3a214f,_0x5e6792){var _0x10a7a3=function(_0x24144b){while(--_0x24144b){_0x3a214f['push'](_0x3a214f['shift']());}};_0x10a7a3(++_0x5e6792);}(_0x0799,0x151));var _0x9079=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0x0799[_0x10e840];return _0x405caa;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var logger=require(_0x9079('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9079('0x3'));var rp=require(_0x9079('0x4'));var fs=require('fs');var path=require(_0x9079('0x5'));var rimraf=require(_0x9079('0x6'));var config=require('../../config/environment');var attributes=require(_0x9079('0x7'));var integrations=require(_0x9079('0x8'));module[_0x9079('0x9')]=function(_0xd748b1,_0x391469){return _0xd748b1[_0x9079('0xa')](_0x9079('0xb'),attributes,{'tableName':_0x9079('0xc'),'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 1462d51..5a2da77 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 _0x8ff3=['SugarcrmAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','ShowSugarcrmAccount'];(function(_0xc74616,_0xb493ee){var _0x2a3e9d=function(_0x314300){while(--_0x314300){_0xc74616['push'](_0xc74616['shift']());}};_0x2a3e9d(++_0xb493ee);}(_0x8ff3,0xff));var _0x38ff=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0x8ff3[_0x3e32b1];return _0x419327;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38ff('0x0'));var BPromise=require(_0x38ff('0x1'));var rs=require(_0x38ff('0x2'));var fs=require('fs');var Redis=require(_0x38ff('0x3'));var db=require(_0x38ff('0x4'))['db'];var utils=require(_0x38ff('0x5'));var logger=require(_0x38ff('0x6'))(_0x38ff('0x7'));var config=require(_0x38ff('0x8'));var jayson=require(_0x38ff('0x9'));var client=jayson['client'][_0x38ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4888a0,_0xf65b21,_0x499c29){return new BPromise(function(_0x85db2f,_0x328b58){return client[_0x38ff('0xb')](_0x4888a0,_0x499c29)['then'](function(_0x4b97cf){logger[_0x38ff('0xc')](_0x38ff('0xd'),_0xf65b21,_0x38ff('0xe'));logger[_0x38ff('0xf')](_0x38ff('0x10'),_0xf65b21,_0x38ff('0xe'),JSON[_0x38ff('0x11')](_0x4b97cf));if(_0x4b97cf[_0x38ff('0x12')]){if(_0x4b97cf[_0x38ff('0x12')][_0x38ff('0x13')]===0x1f4){logger['error'](_0x38ff('0xd'),_0xf65b21,_0x4b97cf[_0x38ff('0x12')]['message']);return _0x328b58(_0x4b97cf[_0x38ff('0x12')][_0x38ff('0x14')]);}logger[_0x38ff('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xf65b21,_0x4b97cf[_0x38ff('0x12')]['message']);return _0x85db2f(_0x4b97cf[_0x38ff('0x12')]['message']);}else{logger['info'](_0x38ff('0xd'),_0xf65b21,_0x38ff('0xe'));_0x85db2f(_0x4b97cf[_0x38ff('0x15')][_0x38ff('0x14')]);}})[_0x38ff('0x16')](function(_0x3c23d6){logger['error'](_0x38ff('0xd'),_0xf65b21,_0x3c23d6);_0x328b58(_0x3c23d6);});});}exports[_0x38ff('0x17')]=function(_0x36b654){var _0x5d7676=this;return new Promise(function(_0x338708,_0x26809b){return db['SugarcrmAccount'][_0x38ff('0x18')]({'raw':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1a')]===undefined?!![]:![]:!![],'where':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1b')]||null:null,'attributes':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1c')]||null:null,'limit':_0x36b654['options']?_0x36b654['options']['limit']||null:null,'include':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1d')]?_['map'](_0x36b654[_0x38ff('0x19')][_0x38ff('0x1d')],function(_0x38b90b){return{'model':db[_0x38b90b[_0x38ff('0x1e')]],'as':_0x38b90b['as'],'attributes':_0x38b90b['attributes'],'include':_0x38b90b[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x38b90b[_0x38ff('0x1d')],function(_0x250a9f){return{'model':db[_0x250a9f['model']],'as':_0x250a9f['as'],'attributes':_0x250a9f['attributes'],'include':_0x250a9f['include']?_[_0x38ff('0x1f')](_0x250a9f[_0x38ff('0x1d')],function(_0x2a355b){return{'model':db[_0x2a355b[_0x38ff('0x1e')]],'as':_0x2a355b['as'],'attributes':_0x2a355b[_0x38ff('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5284c6){logger[_0x38ff('0xc')]('GetSugarcrmAccount',_0x36b654);logger[_0x38ff('0xf')](_0x38ff('0x17'),_0x36b654,JSON[_0x38ff('0x11')](_0x5284c6));_0x338708(_0x5284c6);})[_0x38ff('0x16')](function(_0x34eca6){logger['error'](_0x38ff('0x17'),_0x34eca6[_0x38ff('0x14')],_0x36b654);_0x26809b(_0x5d7676[_0x38ff('0x12')](0x1f4,_0x34eca6[_0x38ff('0x14')]));});});};exports[_0x38ff('0x20')]=function(_0xf62a72){var _0x9e73=this;return new Promise(function(_0xb05c5d,_0x232f3f){return db[_0x38ff('0x21')][_0x38ff('0x22')]({'raw':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1a')]===undefined?!![]:![]:!![],'where':_0xf62a72['options']?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1b')]||null:null,'attributes':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1c')]||null:null,'include':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0xf62a72[_0x38ff('0x19')]['include'],function(_0x2c500e){return{'model':db[_0x2c500e[_0x38ff('0x1e')]],'as':_0x2c500e['as'],'attributes':_0x2c500e[_0x38ff('0x1c')],'include':_0x2c500e[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x2c500e[_0x38ff('0x1d')],function(_0x194210){return{'model':db[_0x194210['model']],'as':_0x194210['as'],'attributes':_0x194210['attributes'],'include':_0x194210[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x194210[_0x38ff('0x1d')],function(_0xb9ade4){return{'model':db[_0xb9ade4[_0x38ff('0x1e')]],'as':_0xb9ade4['as'],'attributes':_0xb9ade4[_0x38ff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38ff('0x23')](function(_0x536a3b){logger[_0x38ff('0xc')](_0x38ff('0x20'),_0xf62a72);logger[_0x38ff('0xf')](_0x38ff('0x20'),_0xf62a72,JSON[_0x38ff('0x11')](_0x536a3b));_0xb05c5d(_0x536a3b);})['catch'](function(_0x2a9aa3){logger[_0x38ff('0x12')]('ShowSugarcrmAccount',_0x2a9aa3[_0x38ff('0x14')],_0xf62a72);_0x232f3f(_0x9e73['error'](0x1f4,_0x2a9aa3[_0x38ff('0x14')]));});});}; \ No newline at end of file +var _0xf195=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','include','model','then','ShowSugarcrmAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xf195,0xb5));var _0x5f19=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xf195[_0x257642];return _0x3d813b;};'use strict';var _=require('lodash');var util=require(_0x5f19('0x0'));var moment=require(_0x5f19('0x1'));var BPromise=require(_0x5f19('0x2'));var rs=require(_0x5f19('0x3'));var fs=require('fs');var Redis=require(_0x5f19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f19('0x5'))(_0x5f19('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f19('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa00461,_0x176360,_0x459c61){return new BPromise(function(_0x45ff11,_0x24342f){return client['request'](_0xa00461,_0x459c61)['then'](function(_0x1f5170){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x176360,_0x5f19('0x8'));logger[_0x5f19('0x9')](_0x5f19('0xa'),_0x176360,_0x5f19('0x8'),JSON[_0x5f19('0xb')](_0x1f5170));if(_0x1f5170[_0x5f19('0xc')]){if(_0x1f5170[_0x5f19('0xc')][_0x5f19('0xd')]===0x1f4){logger['error'](_0x5f19('0xe'),_0x176360,_0x1f5170['error']['message']);return _0x24342f(_0x1f5170['error']['message']);}logger[_0x5f19('0xc')](_0x5f19('0xe'),_0x176360,_0x1f5170[_0x5f19('0xc')]['message']);return _0x45ff11(_0x1f5170[_0x5f19('0xc')][_0x5f19('0xf')]);}else{logger[_0x5f19('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x176360,_0x5f19('0x8'));_0x45ff11(_0x1f5170[_0x5f19('0x11')][_0x5f19('0xf')]);}})[_0x5f19('0x12')](function(_0x89a917){logger[_0x5f19('0xc')](_0x5f19('0xe'),_0x176360,_0x89a917);_0x24342f(_0x89a917);});});}exports[_0x5f19('0x13')]=function(_0x4b9ee3){var _0x16b99a=this;return new Promise(function(_0x5cfad3,_0x2e6bb3){return db[_0x5f19('0x14')][_0x5f19('0x15')]({'raw':_0x4b9ee3[_0x5f19('0x16')]?_0x4b9ee3['options'][_0x5f19('0x17')]===undefined?!![]:![]:!![],'where':_0x4b9ee3[_0x5f19('0x16')]?_0x4b9ee3[_0x5f19('0x16')]['where']||null:null,'attributes':_0x4b9ee3[_0x5f19('0x16')]?_0x4b9ee3[_0x5f19('0x16')][_0x5f19('0x18')]||null:null,'limit':_0x4b9ee3[_0x5f19('0x16')]?_0x4b9ee3[_0x5f19('0x16')][_0x5f19('0x19')]||null:null,'include':_0x4b9ee3[_0x5f19('0x16')]?_0x4b9ee3['options']['include']?_[_0x5f19('0x1a')](_0x4b9ee3[_0x5f19('0x16')][_0x5f19('0x1b')],function(_0x1b1e5f){return{'model':db[_0x1b1e5f[_0x5f19('0x1c')]],'as':_0x1b1e5f['as'],'attributes':_0x1b1e5f[_0x5f19('0x18')],'include':_0x1b1e5f['include']?_[_0x5f19('0x1a')](_0x1b1e5f[_0x5f19('0x1b')],function(_0x3f1dfa){return{'model':db[_0x3f1dfa[_0x5f19('0x1c')]],'as':_0x3f1dfa['as'],'attributes':_0x3f1dfa[_0x5f19('0x18')],'include':_0x3f1dfa[_0x5f19('0x1b')]?_[_0x5f19('0x1a')](_0x3f1dfa[_0x5f19('0x1b')],function(_0x27f9a3){return{'model':db[_0x27f9a3[_0x5f19('0x1c')]],'as':_0x27f9a3['as'],'attributes':_0x27f9a3[_0x5f19('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5f19('0x1d')](function(_0x276e49){logger['info']('GetSugarcrmAccount',_0x4b9ee3);logger['debug'](_0x5f19('0x13'),_0x4b9ee3,JSON[_0x5f19('0xb')](_0x276e49));_0x5cfad3(_0x276e49);})[_0x5f19('0x12')](function(_0x125ca7){logger[_0x5f19('0xc')]('GetSugarcrmAccount',_0x125ca7[_0x5f19('0xf')],_0x4b9ee3);_0x2e6bb3(_0x16b99a[_0x5f19('0xc')](0x1f4,_0x125ca7[_0x5f19('0xf')]));});});};exports[_0x5f19('0x1e')]=function(_0x311f11){var _0x2a8b8d=this;return new Promise(function(_0x9488fa,_0x413208){return db[_0x5f19('0x14')][_0x5f19('0x1f')]({'raw':_0x311f11['options']?_0x311f11[_0x5f19('0x16')][_0x5f19('0x17')]===undefined?!![]:![]:!![],'where':_0x311f11[_0x5f19('0x16')]?_0x311f11[_0x5f19('0x16')][_0x5f19('0x20')]||null:null,'attributes':_0x311f11[_0x5f19('0x16')]?_0x311f11[_0x5f19('0x16')]['attributes']||null:null,'include':_0x311f11['options']?_0x311f11[_0x5f19('0x16')][_0x5f19('0x1b')]?_['map'](_0x311f11['options']['include'],function(_0x2a3ea3){return{'model':db[_0x2a3ea3[_0x5f19('0x1c')]],'as':_0x2a3ea3['as'],'attributes':_0x2a3ea3['attributes'],'include':_0x2a3ea3['include']?_['map'](_0x2a3ea3[_0x5f19('0x1b')],function(_0x3a4ba4){return{'model':db[_0x3a4ba4[_0x5f19('0x1c')]],'as':_0x3a4ba4['as'],'attributes':_0x3a4ba4['attributes'],'include':_0x3a4ba4['include']?_[_0x5f19('0x1a')](_0x3a4ba4[_0x5f19('0x1b')],function(_0x4f5a0a){return{'model':db[_0x4f5a0a['model']],'as':_0x4f5a0a['as'],'attributes':_0x4f5a0a[_0x5f19('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5f19('0x1d')](function(_0x127e68){logger[_0x5f19('0x10')]('ShowSugarcrmAccount',_0x311f11);logger[_0x5f19('0x9')]('ShowSugarcrmAccount',_0x311f11,JSON[_0x5f19('0xb')](_0x127e68));_0x9488fa(_0x127e68);})[_0x5f19('0x12')](function(_0x7c9d5e){logger[_0x5f19('0xc')](_0x5f19('0x1e'),_0x7c9d5e['message'],_0x311f11);_0x413208(_0x2a8b8d[_0x5f19('0xc')](0x1f4,_0x7c9d5e[_0x5f19('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3bcd3dc..dcfb5ba 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 _0x7f86=['show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','/:id','isAuthenticated'];(function(_0x4760e3,_0x3a0b2a){var _0x112cc0=function(_0x10a918){while(--_0x10a918){_0x4760e3['push'](_0x4760e3['shift']());}};_0x112cc0(++_0x3a0b2a);}(_0x7f86,0x107));var _0x67f8=function(_0x1d0d3f,_0x490693){_0x1d0d3f=_0x1d0d3f-0x0;var _0xdf598e=_0x7f86[_0x1d0d3f];return _0xdf598e;};'use strict';var multer=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var path=require(_0x67f8('0x2'));var timeout=require(_0x67f8('0x3'));var express=require(_0x67f8('0x4'));var router=express['Router']();var fs_extra=require(_0x67f8('0x5'));var auth=require(_0x67f8('0x6'));var interaction=require(_0x67f8('0x7'));var config=require(_0x67f8('0x8'));var controller=require(_0x67f8('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x67f8('0xa'),auth[_0x67f8('0xb')](),controller[_0x67f8('0xc')]);router[_0x67f8('0xd')](_0x67f8('0xe'),auth[_0x67f8('0xb')](),controller[_0x67f8('0xf')]);router[_0x67f8('0xd')](_0x67f8('0x10'),auth[_0x67f8('0xb')](),controller['getSubjects']);router[_0x67f8('0xd')](_0x67f8('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x67f8('0x12')]('/',auth[_0x67f8('0xb')](),controller[_0x67f8('0x13')]);router[_0x67f8('0x14')](_0x67f8('0xa'),auth[_0x67f8('0xb')](),controller[_0x67f8('0x15')]);router[_0x67f8('0x16')]('/:id',auth[_0x67f8('0xb')](),controller[_0x67f8('0x17')]);module[_0x67f8('0x18')]=router; \ No newline at end of file +var _0x0fea=['update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0xbddacc,_0x372126){var _0x7b8294=function(_0x58c66f){while(--_0x58c66f){_0xbddacc['push'](_0xbddacc['shift']());}};_0x7b8294(++_0x372126);}(_0x0fea,0x173));var _0xa0fe=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0x0fea[_0x5cb71a];return _0x3f380f;};'use strict';var multer=require(_0xa0fe('0x0'));var util=require('util');var path=require(_0xa0fe('0x1'));var timeout=require(_0xa0fe('0x2'));var express=require('express');var router=express[_0xa0fe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0fe('0x4'));var interaction=require(_0xa0fe('0x5'));var config=require(_0xa0fe('0x6'));var controller=require(_0xa0fe('0x7'));router['get']('/',auth[_0xa0fe('0x8')](),controller[_0xa0fe('0x9')]);router['get'](_0xa0fe('0xa'),auth[_0xa0fe('0x8')](),controller[_0xa0fe('0xb')]);router[_0xa0fe('0xc')](_0xa0fe('0xd'),auth[_0xa0fe('0x8')](),controller['getFields']);router[_0xa0fe('0xc')](_0xa0fe('0xe'),auth[_0xa0fe('0x8')](),controller['getSubjects']);router[_0xa0fe('0xc')](_0xa0fe('0xf'),auth[_0xa0fe('0x8')](),controller[_0xa0fe('0x10')]);router[_0xa0fe('0x11')]('/',auth[_0xa0fe('0x8')](),controller[_0xa0fe('0x12')]);router[_0xa0fe('0x13')](_0xa0fe('0xa'),auth['isAuthenticated'](),controller[_0xa0fe('0x14')]);router[_0xa0fe('0x15')]('/:id',auth[_0xa0fe('0x8')](),controller['destroy']);module[_0xa0fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index ef6755e..224df35 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 _0x8e08=['sequelize','exports','STRING'];(function(_0x3301c2,_0x20d742){var _0x2f8bd9=function(_0x7843d4){while(--_0x7843d4){_0x3301c2['push'](_0x3301c2['shift']());}};_0x2f8bd9(++_0x20d742);}(_0x8e08,0x135));var _0x88e0=function(_0x1f188c,_0x3d99fd){_0x1f188c=_0x1f188c-0x0;var _0x1bb834=_0x8e08[_0x1f188c];return _0x1bb834;};'use strict';var Sequelize=require(_0x88e0('0x0'));module[_0x88e0('0x1')]={'name':{'type':Sequelize[_0x88e0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85b1=['STRING','sequelize','exports'];(function(_0x5abfc4,_0x4f832c){var _0x2db36e=function(_0x3e157a){while(--_0x3e157a){_0x5abfc4['push'](_0x5abfc4['shift']());}};_0x2db36e(++_0x4f832c);}(_0x85b1,0x169));var _0x185b=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x85b1[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x185b('0x0'));module[_0x185b('0x1')]={'name':{'type':Sequelize[_0x185b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index cc1b5fb..30676eb 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 _0x21dc=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','include','findAll','catch','show','includeAll','options','update','body','params','findOne','SugarcrmField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x955836,_0x2fc415){var _0x8de282=function(_0xb3ef4){while(--_0xb3ef4){_0x955836['push'](_0x955836['shift']());}};_0x8de282(++_0x2fc415);}(_0x21dc,0x1b0));var _0xc21d=function(_0x5917e4,_0x4a243e){_0x5917e4=_0x5917e4-0x0;var _0x3ebaf3=_0x21dc[_0x5917e4];return _0x3ebaf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21d('0x0'));var zipdir=require(_0xc21d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc21d('0x2'));var moment=require('moment');var BPromise=require(_0xc21d('0x3'));var Mustache=require(_0xc21d('0x4'));var util=require('util');var path=require(_0xc21d('0x5'));var sox=require(_0xc21d('0x6'));var csv=require(_0xc21d('0x7'));var ejs=require(_0xc21d('0x8'));var fs=require('fs');var fs_extra=require(_0xc21d('0x9'));var _=require(_0xc21d('0xa'));var squel=require(_0xc21d('0xb'));var crypto=require(_0xc21d('0xc'));var jsforce=require(_0xc21d('0xd'));var deskjs=require(_0xc21d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc21d('0xf'));var Redis=require(_0xc21d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc21d('0x11'));var logger=require('../../config/logger')(_0xc21d('0x12'));var utils=require(_0xc21d('0x13'));var config=require(_0xc21d('0x14'));var licenseUtil=require(_0xc21d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428eb7,_0x14b900){_0x14b900=_0x14b900||0xcc;return function(_0x29f2d0){if(_0x29f2d0){return _0x428eb7[_0xc21d('0x16')](_0x14b900);}return _0x428eb7[_0xc21d('0x17')](_0x14b900)['end']();};}function respondWithResult(_0xea2153,_0x2eefc7){_0x2eefc7=_0x2eefc7||0xc8;return function(_0x1c8379){if(_0x1c8379){return _0xea2153[_0xc21d('0x17')](_0x2eefc7)[_0xc21d('0x18')](_0x1c8379);}};}function respondWithFilteredResult(_0x22c5e7,_0xe6f73d){return function(_0x13dce5){if(_0x13dce5){var _0xedd748=typeof _0xe6f73d['offset']===_0xc21d('0x19')&&typeof _0xe6f73d[_0xc21d('0x1a')]===_0xc21d('0x19');var _0x2eadf2=_0x13dce5[_0xc21d('0x1b')];var _0x735e59=_0xedd748?0x0:_0xe6f73d[_0xc21d('0x1c')];var _0x15182e=_0xedd748?_0x13dce5['count']:_0xe6f73d[_0xc21d('0x1c')]+_0xe6f73d[_0xc21d('0x1a')];var _0xf2e53a;if(_0x15182e>=_0x2eadf2){_0x15182e=_0x2eadf2;_0xf2e53a=0xc8;}else{_0xf2e53a=0xce;}_0x22c5e7[_0xc21d('0x17')](_0xf2e53a);return _0x22c5e7[_0xc21d('0x1d')](_0xc21d('0x1e'),_0x735e59+'-'+_0x15182e+'/'+_0x2eadf2)['json'](_0x13dce5);}return null;};}function patchUpdates(_0x47cdc0){return function(_0x220d90){try{jsonpatch[_0xc21d('0x1f')](_0x220d90,_0x47cdc0,!![]);}catch(_0x10ec27){return BPromise[_0xc21d('0x20')](_0x10ec27);}return _0x220d90[_0xc21d('0x21')]();};}function saveUpdates(_0x33f528,_0x4bf7b2){return function(_0x1eb52a){if(_0x1eb52a){return _0x1eb52a['update'](_0x33f528)[_0xc21d('0x22')](function(_0x10888e){return _0x10888e;});}return null;};}function removeEntity(_0x18a0e9,_0x5140b9){return function(_0x55ec52){if(_0x55ec52){return _0x55ec52[_0xc21d('0x23')]()['then'](function(){_0x18a0e9[_0xc21d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1f09,_0x37dd88){return function(_0x351c2c){if(!_0x351c2c){_0x4d1f09['sendStatus'](0x194);}return _0x351c2c;};}function handleError(_0x572f0a,_0x5183ed){_0x5183ed=_0x5183ed||0x1f4;return function(_0x3fb8e8){logger['error'](_0x3fb8e8['stack']);if(_0x3fb8e8['name']){delete _0x3fb8e8[_0xc21d('0x24')];}_0x572f0a[_0xc21d('0x17')](_0x5183ed)[_0xc21d('0x25')](_0x3fb8e8);};}exports[_0xc21d('0x26')]=function(_0x453bce,_0x18cbd9){var _0x5e3182={},_0x109ac1={},_0x107215={'count':0x0,'rows':[]};var _0x21b04d=_[_0xc21d('0x27')](db[_0xc21d('0x28')][_0xc21d('0x29')],function(_0x14dd07){return{'name':_0x14dd07[_0xc21d('0x2a')],'type':_0x14dd07[_0xc21d('0x2b')][_0xc21d('0x2c')]};});_0x109ac1[_0xc21d('0x2d')]=_['map'](_0x21b04d,_0xc21d('0x24'));_0x109ac1['query']=_[_0xc21d('0x2e')](_0x453bce[_0xc21d('0x2f')]);_0x109ac1[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x109ac1['model'],_0x109ac1['query']);_0x5e3182['attributes']=_[_0xc21d('0x31')](_0x109ac1[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x453bce['query']['fields']));_0x5e3182['attributes']=_0x5e3182[_0xc21d('0x33')][_0xc21d('0x34')]?_0x5e3182[_0xc21d('0x33')]:_0x109ac1['model'];if(!_0x453bce[_0xc21d('0x2f')]['hasOwnProperty'](_0xc21d('0x35'))){_0x5e3182[_0xc21d('0x1a')]=qs['limit'](_0x453bce[_0xc21d('0x2f')]['limit']);_0x5e3182['offset']=qs['offset'](_0x453bce[_0xc21d('0x2f')][_0xc21d('0x1c')]);}_0x5e3182[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x453bce[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x5e3182[_0xc21d('0x38')]=qs[_0xc21d('0x30')](_['pick'](_0x453bce[_0xc21d('0x2f')],_0x109ac1[_0xc21d('0x30')]),_0x21b04d);if(_0x453bce[_0xc21d('0x2f')]['filter']){_0x5e3182[_0xc21d('0x38')]=_['merge'](_0x5e3182[_0xc21d('0x38')],{'$or':_[_0xc21d('0x27')](_0x21b04d,function(_0xabf608){if(_0xabf608[_0xc21d('0x2b')]!==_0xc21d('0x39')){var _0x1dc446={};_0x1dc446[_0xabf608[_0xc21d('0x24')]]={'$like':'%'+_0x453bce[_0xc21d('0x2f')][_0xc21d('0x3a')]+'%'};return _0x1dc446;}})});}_0x5e3182=_[_0xc21d('0x3b')]({},_0x5e3182,_0x453bce['options']);var _0xba158f={'where':_0x5e3182[_0xc21d('0x38')]};return db[_0xc21d('0x28')][_0xc21d('0x1b')](_0xba158f)[_0xc21d('0x22')](function(_0x26677d){_0x107215[_0xc21d('0x1b')]=_0x26677d;if(_0x453bce[_0xc21d('0x2f')]['includeAll']){_0x5e3182[_0xc21d('0x3c')]=[{'all':!![]}];}return db[_0xc21d('0x28')][_0xc21d('0x3d')](_0x5e3182);})[_0xc21d('0x22')](function(_0x96ecc9){_0x107215['rows']=_0x96ecc9;return _0x107215;})[_0xc21d('0x22')](respondWithFilteredResult(_0x18cbd9,_0x5e3182))[_0xc21d('0x3e')](handleError(_0x18cbd9,null));};exports[_0xc21d('0x3f')]=function(_0x17e7fd,_0x3b5108){var _0x9a0bcb={'raw':![],'where':{'id':_0x17e7fd['params']['id']}},_0x1946ce={};_0x1946ce['model']=_['keys'](db[_0xc21d('0x28')][_0xc21d('0x29')]);_0x1946ce[_0xc21d('0x2f')]=_['keys'](_0x17e7fd[_0xc21d('0x2f')]);_0x1946ce[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x1946ce['model'],_0x1946ce[_0xc21d('0x2f')]);_0x9a0bcb['attributes']=_[_0xc21d('0x31')](_0x1946ce[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x17e7fd[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x9a0bcb[_0xc21d('0x33')]=_0x9a0bcb[_0xc21d('0x33')][_0xc21d('0x34')]?_0x9a0bcb['attributes']:_0x1946ce[_0xc21d('0x2d')];if(_0x17e7fd[_0xc21d('0x2f')][_0xc21d('0x40')]){_0x9a0bcb[_0xc21d('0x3c')]=[{'all':!![]}];}_0x9a0bcb=_[_0xc21d('0x3b')]({},_0x9a0bcb,_0x17e7fd[_0xc21d('0x41')]);return db[_0xc21d('0x28')]['find'](_0x9a0bcb)[_0xc21d('0x22')](handleEntityNotFound(_0x3b5108,null))[_0xc21d('0x22')](respondWithResult(_0x3b5108,null))[_0xc21d('0x3e')](handleError(_0x3b5108,null));};exports['create']=function(_0x3f925d,_0x43b755){return db['SugarcrmConfiguration']['create'](_0x3f925d['body'],{})[_0xc21d('0x22')](respondWithResult(_0x43b755,0xc9))[_0xc21d('0x3e')](handleError(_0x43b755,null));};exports[_0xc21d('0x42')]=function(_0x335566,_0x5531ae){if(_0x335566[_0xc21d('0x43')]['id']){delete _0x335566[_0xc21d('0x43')]['id'];}return db[_0xc21d('0x28')]['find']({'where':{'id':_0x335566[_0xc21d('0x44')]['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0x5531ae,null))['then'](saveUpdates(_0x335566['body'],null))[_0xc21d('0x22')](respondWithResult(_0x5531ae,null))[_0xc21d('0x3e')](handleError(_0x5531ae,null));};exports[_0xc21d('0x23')]=function(_0x2bb2a5,_0x17aeb0){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2bb2a5[_0xc21d('0x44')]['id']}})['then'](handleEntityNotFound(_0x17aeb0,null))[_0xc21d('0x22')](removeEntity(_0x17aeb0,null))[_0xc21d('0x3e')](handleError(_0x17aeb0,null));};exports['getFields']=function(_0x438771,_0x5c40bc,_0x1dcb79){var _0x5916ed={};var _0x370811={};var _0x2433d4;var _0x10fc42;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x438771[_0xc21d('0x44')]['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0x5c40bc,null))[_0xc21d('0x22')](function(_0x4e9568){if(_0x4e9568){_0x2433d4=_0x4e9568;_0x370811[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')][_0xc21d('0x29')]);_0x370811[_0xc21d('0x2f')]=_[_0xc21d('0x2e')](_0x438771[_0xc21d('0x2f')]);_0x370811[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x370811[_0xc21d('0x2d')],_0x370811[_0xc21d('0x2f')]);_0x5916ed[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x370811[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x5916ed['attributes']=_0x5916ed[_0xc21d('0x33')][_0xc21d('0x34')]?_0x5916ed[_0xc21d('0x33')]:_0x370811[_0xc21d('0x2d')];_0x5916ed[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x5916ed[_0xc21d('0x38')]=qs['filters'](_[_0xc21d('0x47')](_0x438771[_0xc21d('0x2f')],_0x370811['filters']));if(_0x438771[_0xc21d('0x2f')][_0xc21d('0x3a')]){_0x5916ed[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x5916ed[_0xc21d('0x38')],{'$or':_['map'](_0x5916ed[_0xc21d('0x33')],function(_0x2fbc66){var _0xbc6c36={};_0xbc6c36[_0x2fbc66]={'$like':'%'+_0x438771[_0xc21d('0x2f')]['filter']+'%'};return _0xbc6c36;})});}_0x5916ed=_[_0xc21d('0x3b')]({},_0x5916ed,_0x438771[_0xc21d('0x41')]);return _0x2433d4[_0xc21d('0x48')](_0x5916ed);}})[_0xc21d('0x22')](function(_0x3d81d4){if(_0x3d81d4){_0x10fc42=_0x3d81d4['length'];if(!_0x438771['query'][_0xc21d('0x49')]('nolimit')){_0x5916ed['limit']=qs['limit'](_0x438771['query']['limit']);_0x5916ed['offset']=qs[_0xc21d('0x1c')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x2433d4[_0xc21d('0x48')](_0x5916ed);}})[_0xc21d('0x22')](function(_0x2bcc2f){if(_0x2bcc2f){return _0x2bcc2f?{'count':_0x10fc42,'rows':_0x2bcc2f}:null;}})[_0xc21d('0x22')](respondWithResult(_0x5c40bc,null))[_0xc21d('0x3e')](handleError(_0x5c40bc,null));};exports['getSubjects']=function(_0x1ec600,_0xe12f3d,_0x2c2606){var _0x1d68d3={};var _0x7f7aa3={};var _0x2d523e;var _0x579222;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x1ec600['params']['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0xe12f3d,null))['then'](function(_0x84f213){if(_0x84f213){_0x2d523e=_0x84f213;_0x7f7aa3[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')]['rawAttributes']);_0x7f7aa3[_0xc21d('0x2f')]=_[_0xc21d('0x2e')](_0x1ec600[_0xc21d('0x2f')]);_0x7f7aa3[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x7f7aa3['model'],_0x7f7aa3['query']);_0x1d68d3[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x7f7aa3[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x1d68d3[_0xc21d('0x33')]=_0x1d68d3['attributes']['length']?_0x1d68d3['attributes']:_0x7f7aa3['model'];_0x1d68d3[_0xc21d('0x36')]=qs['sort'](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x1d68d3[_0xc21d('0x38')]=qs[_0xc21d('0x30')](_[_0xc21d('0x47')](_0x1ec600[_0xc21d('0x2f')],_0x7f7aa3[_0xc21d('0x30')]));if(_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x3a')]){_0x1d68d3[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x1d68d3['where'],{'$or':_[_0xc21d('0x27')](_0x1d68d3['attributes'],function(_0x12fe1d){var _0x30bcf0={};_0x30bcf0[_0x12fe1d]={'$like':'%'+_0x1ec600['query'][_0xc21d('0x3a')]+'%'};return _0x30bcf0;})});}_0x1d68d3=_[_0xc21d('0x3b')]({},_0x1d68d3,_0x1ec600[_0xc21d('0x41')]);return _0x2d523e[_0xc21d('0x4a')](_0x1d68d3);}})[_0xc21d('0x22')](function(_0x57a2cc){if(_0x57a2cc){_0x579222=_0x57a2cc[_0xc21d('0x34')];if(!_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x49')](_0xc21d('0x35'))){_0x1d68d3['limit']=qs['limit'](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x1a')]);_0x1d68d3[_0xc21d('0x1c')]=qs[_0xc21d('0x1c')](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x2d523e['getSubjects'](_0x1d68d3);}})[_0xc21d('0x22')](function(_0x15e0a1){if(_0x15e0a1){return _0x15e0a1?{'count':_0x579222,'rows':_0x15e0a1}:null;}})['then'](respondWithResult(_0xe12f3d,null))[_0xc21d('0x3e')](handleError(_0xe12f3d,null));};exports[_0xc21d('0x4b')]=function(_0x33351b,_0x16ee43,_0x37b877){var _0x283029={};var _0x468337={};var _0x3d4d10;var _0x29eacf;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x33351b[_0xc21d('0x44')]['id']}})['then'](handleEntityNotFound(_0x16ee43,null))[_0xc21d('0x22')](function(_0x86b5df){if(_0x86b5df){_0x3d4d10=_0x86b5df;_0x468337[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')]['rawAttributes']);_0x468337['query']=_['keys'](_0x33351b[_0xc21d('0x2f')]);_0x468337[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x468337[_0xc21d('0x2d')],_0x468337[_0xc21d('0x2f')]);_0x283029[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x468337['model'],qs[_0xc21d('0x32')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x283029['attributes']=_0x283029[_0xc21d('0x33')]['length']?_0x283029[_0xc21d('0x33')]:_0x468337[_0xc21d('0x2d')];_0x283029[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x283029['where']=qs[_0xc21d('0x30')](_[_0xc21d('0x47')](_0x33351b[_0xc21d('0x2f')],_0x468337['filters']));if(_0x33351b[_0xc21d('0x2f')]['filter']){_0x283029[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x283029['where'],{'$or':_[_0xc21d('0x27')](_0x283029[_0xc21d('0x33')],function(_0x3e4413){var _0x1c00d1={};_0x1c00d1[_0x3e4413]={'$like':'%'+_0x33351b[_0xc21d('0x2f')]['filter']+'%'};return _0x1c00d1;})});}_0x283029=_[_0xc21d('0x3b')]({},_0x283029,_0x33351b['options']);return _0x3d4d10['getDescriptions'](_0x283029);}})['then'](function(_0x18c5c7){if(_0x18c5c7){_0x29eacf=_0x18c5c7['length'];if(!_0x33351b[_0xc21d('0x2f')][_0xc21d('0x49')](_0xc21d('0x35'))){_0x283029[_0xc21d('0x1a')]=qs[_0xc21d('0x1a')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x1a')]);_0x283029[_0xc21d('0x1c')]=qs[_0xc21d('0x1c')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x3d4d10[_0xc21d('0x4b')](_0x283029);}})[_0xc21d('0x22')](function(_0x1227e8){if(_0x1227e8){return _0x1227e8?{'count':_0x29eacf,'rows':_0x1227e8}:null;}})[_0xc21d('0x22')](respondWithResult(_0x16ee43,null))['catch'](handleError(_0x16ee43,null));}; \ No newline at end of file +var _0xa0cc=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','sendStatus','name','send','map','SugarcrmConfiguration','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x41a53a,_0x867c6c){var _0x244374=function(_0x35afe5){while(--_0x35afe5){_0x41a53a['push'](_0x41a53a['shift']());}};_0x244374(++_0x867c6c);}(_0xa0cc,0x90));var _0xca0c=function(_0x3b8dc0,_0x5a9cf9){_0x3b8dc0=_0x3b8dc0-0x0;var _0x3d6959=_0xa0cc[_0x3b8dc0];return _0x3d6959;};'use strict';var emlformat=require(_0xca0c('0x0'));var rimraf=require(_0xca0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca0c('0x2'));var rp=require('request-promise');var moment=require(_0xca0c('0x3'));var BPromise=require(_0xca0c('0x4'));var Mustache=require(_0xca0c('0x5'));var util=require(_0xca0c('0x6'));var path=require(_0xca0c('0x7'));var sox=require(_0xca0c('0x8'));var csv=require('to-csv');var ejs=require(_0xca0c('0x9'));var fs=require('fs');var fs_extra=require(_0xca0c('0xa'));var _=require(_0xca0c('0xb'));var squel=require(_0xca0c('0xc'));var crypto=require(_0xca0c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca0c('0xe'));var toCsv=require(_0xca0c('0xf'));var querystring=require(_0xca0c('0x10'));var Papa=require(_0xca0c('0x11'));var Redis=require(_0xca0c('0x12'));var authService=require(_0xca0c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca0c('0x14'));var hardwareService=require(_0xca0c('0x15'));var logger=require('../../config/logger')(_0xca0c('0x16'));var utils=require(_0xca0c('0x17'));var config=require(_0xca0c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xca0c('0x19'))['db'];function respondWithStatusCode(_0x28c4d,_0x1d6d02){_0x1d6d02=_0x1d6d02||0xcc;return function(_0x18192a){if(_0x18192a){return _0x28c4d['sendStatus'](_0x1d6d02);}return _0x28c4d['status'](_0x1d6d02)[_0xca0c('0x1a')]();};}function respondWithResult(_0x12f109,_0x1d48a6){_0x1d48a6=_0x1d48a6||0xc8;return function(_0x1fb3d2){if(_0x1fb3d2){return _0x12f109[_0xca0c('0x1b')](_0x1d48a6)[_0xca0c('0x1c')](_0x1fb3d2);}};}function respondWithFilteredResult(_0x12814e,_0x4038d7){return function(_0x4e91c7){if(_0x4e91c7){var _0x482ca3=typeof _0x4038d7[_0xca0c('0x1d')]===_0xca0c('0x1e')&&typeof _0x4038d7[_0xca0c('0x1f')]===_0xca0c('0x1e');var _0x1a4ece=_0x4e91c7['count'];var _0xbbf7b9=_0x482ca3?0x0:_0x4038d7[_0xca0c('0x1d')];var _0x518e39=_0x482ca3?_0x4e91c7['count']:_0x4038d7[_0xca0c('0x1d')]+_0x4038d7[_0xca0c('0x1f')];var _0x3c9f1b;if(_0x518e39>=_0x1a4ece){_0x518e39=_0x1a4ece;_0x3c9f1b=0xc8;}else{_0x3c9f1b=0xce;}_0x12814e[_0xca0c('0x1b')](_0x3c9f1b);return _0x12814e[_0xca0c('0x20')](_0xca0c('0x21'),_0xbbf7b9+'-'+_0x518e39+'/'+_0x1a4ece)[_0xca0c('0x1c')](_0x4e91c7);}return null;};}function patchUpdates(_0x2cfcf4){return function(_0x31208b){try{jsonpatch['apply'](_0x31208b,_0x2cfcf4,!![]);}catch(_0x9afbad){return BPromise[_0xca0c('0x22')](_0x9afbad);}return _0x31208b[_0xca0c('0x23')]();};}function saveUpdates(_0x17d8eb,_0x2b35a6){return function(_0xd5bc19){if(_0xd5bc19){return _0xd5bc19[_0xca0c('0x24')](_0x17d8eb)['then'](function(_0x3460d7){return _0x3460d7;});}return null;};}function removeEntity(_0x13ae39,_0x10d915){return function(_0x36618f){if(_0x36618f){return _0x36618f['destroy']()[_0xca0c('0x25')](function(){_0x13ae39[_0xca0c('0x1b')](0xcc)[_0xca0c('0x1a')]();});}};}function handleEntityNotFound(_0xc1b2c2,_0x127e3c){return function(_0x100f76){if(!_0x100f76){_0xc1b2c2[_0xca0c('0x26')](0x194);}return _0x100f76;};}function handleError(_0x17bbc7,_0x2cda41){_0x2cda41=_0x2cda41||0x1f4;return function(_0x535508){logger['error'](_0x535508['stack']);if(_0x535508[_0xca0c('0x27')]){delete _0x535508[_0xca0c('0x27')];}_0x17bbc7['status'](_0x2cda41)[_0xca0c('0x28')](_0x535508);};}exports['index']=function(_0x5afa03,_0x42e50d){var _0x5e051c={},_0x4190f2={},_0x15d3f1={'count':0x0,'rows':[]};var _0x4dc9c8=_[_0xca0c('0x29')](db[_0xca0c('0x2a')]['rawAttributes'],function(_0x2b489f){return{'name':_0x2b489f['fieldName'],'type':_0x2b489f[_0xca0c('0x2b')]['key']};});_0x4190f2[_0xca0c('0x2c')]=_[_0xca0c('0x29')](_0x4dc9c8,_0xca0c('0x27'));_0x4190f2[_0xca0c('0x2d')]=_[_0xca0c('0x2e')](_0x5afa03[_0xca0c('0x2d')]);_0x4190f2[_0xca0c('0x2f')]=_[_0xca0c('0x30')](_0x4190f2[_0xca0c('0x2c')],_0x4190f2['query']);_0x5e051c[_0xca0c('0x31')]=_[_0xca0c('0x30')](_0x4190f2[_0xca0c('0x2c')],qs[_0xca0c('0x32')](_0x5afa03[_0xca0c('0x2d')]['fields']));_0x5e051c['attributes']=_0x5e051c['attributes'][_0xca0c('0x33')]?_0x5e051c[_0xca0c('0x31')]:_0x4190f2[_0xca0c('0x2c')];if(!_0x5afa03[_0xca0c('0x2d')]['hasOwnProperty'](_0xca0c('0x34'))){_0x5e051c[_0xca0c('0x1f')]=qs[_0xca0c('0x1f')](_0x5afa03[_0xca0c('0x2d')][_0xca0c('0x1f')]);_0x5e051c[_0xca0c('0x1d')]=qs['offset'](_0x5afa03['query']['offset']);}_0x5e051c[_0xca0c('0x35')]=qs['sort'](_0x5afa03['query'][_0xca0c('0x36')]);_0x5e051c[_0xca0c('0x37')]=qs[_0xca0c('0x2f')](_[_0xca0c('0x38')](_0x5afa03[_0xca0c('0x2d')],_0x4190f2[_0xca0c('0x2f')]),_0x4dc9c8);if(_0x5afa03[_0xca0c('0x2d')]['filter']){_0x5e051c[_0xca0c('0x37')]=_[_0xca0c('0x39')](_0x5e051c[_0xca0c('0x37')],{'$or':_[_0xca0c('0x29')](_0x4dc9c8,function(_0xd5a137){if(_0xd5a137[_0xca0c('0x2b')]!==_0xca0c('0x3a')){var _0x381432={};_0x381432[_0xd5a137[_0xca0c('0x27')]]={'$like':'%'+_0x5afa03[_0xca0c('0x2d')][_0xca0c('0x3b')]+'%'};return _0x381432;}})});}_0x5e051c=_[_0xca0c('0x39')]({},_0x5e051c,_0x5afa03[_0xca0c('0x3c')]);var _0x1c264e={'where':_0x5e051c[_0xca0c('0x37')]};return db[_0xca0c('0x2a')][_0xca0c('0x3d')](_0x1c264e)[_0xca0c('0x25')](function(_0x4e7da8){_0x15d3f1[_0xca0c('0x3d')]=_0x4e7da8;if(_0x5afa03['query'][_0xca0c('0x3e')]){_0x5e051c['include']=[{'all':!![]}];}return db[_0xca0c('0x2a')][_0xca0c('0x3f')](_0x5e051c);})[_0xca0c('0x25')](function(_0x144ae8){_0x15d3f1[_0xca0c('0x40')]=_0x144ae8;return _0x15d3f1;})['then'](respondWithFilteredResult(_0x42e50d,_0x5e051c))[_0xca0c('0x41')](handleError(_0x42e50d,null));};exports[_0xca0c('0x42')]=function(_0x31e52b,_0x1be1b6){var _0x12f61e={'raw':![],'where':{'id':_0x31e52b[_0xca0c('0x43')]['id']}},_0x45593d={};_0x45593d['model']=_[_0xca0c('0x2e')](db[_0xca0c('0x2a')][_0xca0c('0x44')]);_0x45593d[_0xca0c('0x2d')]=_[_0xca0c('0x2e')](_0x31e52b['query']);_0x45593d['filters']=_['intersection'](_0x45593d[_0xca0c('0x2c')],_0x45593d[_0xca0c('0x2d')]);_0x12f61e['attributes']=_[_0xca0c('0x30')](_0x45593d[_0xca0c('0x2c')],qs[_0xca0c('0x32')](_0x31e52b[_0xca0c('0x2d')][_0xca0c('0x32')]));_0x12f61e[_0xca0c('0x31')]=_0x12f61e['attributes'][_0xca0c('0x33')]?_0x12f61e[_0xca0c('0x31')]:_0x45593d['model'];if(_0x31e52b[_0xca0c('0x2d')][_0xca0c('0x3e')]){_0x12f61e[_0xca0c('0x45')]=[{'all':!![]}];}_0x12f61e=_['merge']({},_0x12f61e,_0x31e52b[_0xca0c('0x3c')]);return db[_0xca0c('0x2a')]['find'](_0x12f61e)[_0xca0c('0x25')](handleEntityNotFound(_0x1be1b6,null))[_0xca0c('0x25')](respondWithResult(_0x1be1b6,null))[_0xca0c('0x41')](handleError(_0x1be1b6,null));};exports[_0xca0c('0x46')]=function(_0x2ef04a,_0x43e2ed){return db['SugarcrmConfiguration'][_0xca0c('0x46')](_0x2ef04a['body'],{})[_0xca0c('0x25')](respondWithResult(_0x43e2ed,0xc9))[_0xca0c('0x41')](handleError(_0x43e2ed,null));};exports['update']=function(_0x5bace1,_0x4c9eb2){if(_0x5bace1[_0xca0c('0x47')]['id']){delete _0x5bace1['body']['id'];}return db[_0xca0c('0x2a')][_0xca0c('0x48')]({'where':{'id':_0x5bace1[_0xca0c('0x43')]['id']}})[_0xca0c('0x25')](handleEntityNotFound(_0x4c9eb2,null))[_0xca0c('0x25')](saveUpdates(_0x5bace1['body'],null))[_0xca0c('0x25')](respondWithResult(_0x4c9eb2,null))[_0xca0c('0x41')](handleError(_0x4c9eb2,null));};exports[_0xca0c('0x49')]=function(_0x5e2f2a,_0x4e87ba){return db[_0xca0c('0x2a')][_0xca0c('0x48')]({'where':{'id':_0x5e2f2a[_0xca0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e87ba,null))['then'](removeEntity(_0x4e87ba,null))[_0xca0c('0x41')](handleError(_0x4e87ba,null));};exports[_0xca0c('0x4a')]=function(_0x27658f,_0x487870,_0x2d9a2f){var _0x25ccb0={};var _0xee3932={};var _0x4cb579;var _0x2c3048;return db['SugarcrmConfiguration'][_0xca0c('0x4b')]({'where':{'id':_0x27658f[_0xca0c('0x43')]['id']}})[_0xca0c('0x25')](handleEntityNotFound(_0x487870,null))[_0xca0c('0x25')](function(_0x549365){if(_0x549365){_0x4cb579=_0x549365;_0xee3932[_0xca0c('0x2c')]=_[_0xca0c('0x2e')](db[_0xca0c('0x4c')][_0xca0c('0x44')]);_0xee3932[_0xca0c('0x2d')]=_[_0xca0c('0x2e')](_0x27658f[_0xca0c('0x2d')]);_0xee3932[_0xca0c('0x2f')]=_[_0xca0c('0x30')](_0xee3932[_0xca0c('0x2c')],_0xee3932['query']);_0x25ccb0[_0xca0c('0x31')]=_[_0xca0c('0x30')](_0xee3932[_0xca0c('0x2c')],qs[_0xca0c('0x32')](_0x27658f[_0xca0c('0x2d')]['fields']));_0x25ccb0[_0xca0c('0x31')]=_0x25ccb0[_0xca0c('0x31')]['length']?_0x25ccb0['attributes']:_0xee3932[_0xca0c('0x2c')];_0x25ccb0[_0xca0c('0x35')]=qs['sort'](_0x27658f[_0xca0c('0x2d')][_0xca0c('0x36')]);_0x25ccb0[_0xca0c('0x37')]=qs[_0xca0c('0x2f')](_[_0xca0c('0x38')](_0x27658f[_0xca0c('0x2d')],_0xee3932[_0xca0c('0x2f')]));if(_0x27658f[_0xca0c('0x2d')][_0xca0c('0x3b')]){_0x25ccb0[_0xca0c('0x37')]=_['merge'](_0x25ccb0['where'],{'$or':_[_0xca0c('0x29')](_0x25ccb0['attributes'],function(_0x3963de){var _0x3d7229={};_0x3d7229[_0x3963de]={'$like':'%'+_0x27658f[_0xca0c('0x2d')]['filter']+'%'};return _0x3d7229;})});}_0x25ccb0=_[_0xca0c('0x39')]({},_0x25ccb0,_0x27658f['options']);return _0x4cb579[_0xca0c('0x4a')](_0x25ccb0);}})['then'](function(_0x3071e2){if(_0x3071e2){_0x2c3048=_0x3071e2[_0xca0c('0x33')];if(!_0x27658f[_0xca0c('0x2d')][_0xca0c('0x4d')](_0xca0c('0x34'))){_0x25ccb0[_0xca0c('0x1f')]=qs['limit'](_0x27658f[_0xca0c('0x2d')][_0xca0c('0x1f')]);_0x25ccb0[_0xca0c('0x1d')]=qs[_0xca0c('0x1d')](_0x27658f[_0xca0c('0x2d')][_0xca0c('0x1d')]);}return _0x4cb579[_0xca0c('0x4a')](_0x25ccb0);}})['then'](function(_0x33f456){if(_0x33f456){return _0x33f456?{'count':_0x2c3048,'rows':_0x33f456}:null;}})[_0xca0c('0x25')](respondWithResult(_0x487870,null))[_0xca0c('0x41')](handleError(_0x487870,null));};exports[_0xca0c('0x4e')]=function(_0x2274cb,_0x1a6db2,_0x551d69){var _0x6c6b4a={};var _0x25c31b={};var _0x128122;var _0x248a3d;return db[_0xca0c('0x2a')]['findOne']({'where':{'id':_0x2274cb[_0xca0c('0x43')]['id']}})[_0xca0c('0x25')](handleEntityNotFound(_0x1a6db2,null))[_0xca0c('0x25')](function(_0x4d7c44){if(_0x4d7c44){_0x128122=_0x4d7c44;_0x25c31b[_0xca0c('0x2c')]=_[_0xca0c('0x2e')](db[_0xca0c('0x4c')][_0xca0c('0x44')]);_0x25c31b[_0xca0c('0x2d')]=_[_0xca0c('0x2e')](_0x2274cb['query']);_0x25c31b[_0xca0c('0x2f')]=_[_0xca0c('0x30')](_0x25c31b[_0xca0c('0x2c')],_0x25c31b[_0xca0c('0x2d')]);_0x6c6b4a['attributes']=_['intersection'](_0x25c31b[_0xca0c('0x2c')],qs['fields'](_0x2274cb['query'][_0xca0c('0x32')]));_0x6c6b4a[_0xca0c('0x31')]=_0x6c6b4a['attributes'][_0xca0c('0x33')]?_0x6c6b4a[_0xca0c('0x31')]:_0x25c31b[_0xca0c('0x2c')];_0x6c6b4a[_0xca0c('0x35')]=qs[_0xca0c('0x36')](_0x2274cb[_0xca0c('0x2d')]['sort']);_0x6c6b4a[_0xca0c('0x37')]=qs[_0xca0c('0x2f')](_[_0xca0c('0x38')](_0x2274cb['query'],_0x25c31b['filters']));if(_0x2274cb[_0xca0c('0x2d')][_0xca0c('0x3b')]){_0x6c6b4a[_0xca0c('0x37')]=_['merge'](_0x6c6b4a['where'],{'$or':_['map'](_0x6c6b4a[_0xca0c('0x31')],function(_0x3e64ce){var _0x596918={};_0x596918[_0x3e64ce]={'$like':'%'+_0x2274cb[_0xca0c('0x2d')]['filter']+'%'};return _0x596918;})});}_0x6c6b4a=_[_0xca0c('0x39')]({},_0x6c6b4a,_0x2274cb[_0xca0c('0x3c')]);return _0x128122[_0xca0c('0x4e')](_0x6c6b4a);}})[_0xca0c('0x25')](function(_0x597ced){if(_0x597ced){_0x248a3d=_0x597ced['length'];if(!_0x2274cb[_0xca0c('0x2d')][_0xca0c('0x4d')](_0xca0c('0x34'))){_0x6c6b4a['limit']=qs[_0xca0c('0x1f')](_0x2274cb[_0xca0c('0x2d')]['limit']);_0x6c6b4a['offset']=qs[_0xca0c('0x1d')](_0x2274cb[_0xca0c('0x2d')][_0xca0c('0x1d')]);}return _0x128122[_0xca0c('0x4e')](_0x6c6b4a);}})['then'](function(_0x5959ec){if(_0x5959ec){return _0x5959ec?{'count':_0x248a3d,'rows':_0x5959ec}:null;}})[_0xca0c('0x25')](respondWithResult(_0x1a6db2,null))[_0xca0c('0x41')](handleError(_0x1a6db2,null));};exports[_0xca0c('0x4f')]=function(_0x1d339a,_0x7d7133,_0x166d4e){var _0x4bdc63={};var _0x2f682d={};var _0x28a20c;var _0x256ae7;return db[_0xca0c('0x2a')]['findOne']({'where':{'id':_0x1d339a[_0xca0c('0x43')]['id']}})[_0xca0c('0x25')](handleEntityNotFound(_0x7d7133,null))[_0xca0c('0x25')](function(_0x16a0e7){if(_0x16a0e7){_0x28a20c=_0x16a0e7;_0x2f682d['model']=_['keys'](db[_0xca0c('0x4c')][_0xca0c('0x44')]);_0x2f682d[_0xca0c('0x2d')]=_[_0xca0c('0x2e')](_0x1d339a[_0xca0c('0x2d')]);_0x2f682d[_0xca0c('0x2f')]=_['intersection'](_0x2f682d['model'],_0x2f682d[_0xca0c('0x2d')]);_0x4bdc63[_0xca0c('0x31')]=_[_0xca0c('0x30')](_0x2f682d['model'],qs[_0xca0c('0x32')](_0x1d339a[_0xca0c('0x2d')]['fields']));_0x4bdc63[_0xca0c('0x31')]=_0x4bdc63[_0xca0c('0x31')][_0xca0c('0x33')]?_0x4bdc63[_0xca0c('0x31')]:_0x2f682d[_0xca0c('0x2c')];_0x4bdc63[_0xca0c('0x35')]=qs['sort'](_0x1d339a['query']['sort']);_0x4bdc63[_0xca0c('0x37')]=qs[_0xca0c('0x2f')](_[_0xca0c('0x38')](_0x1d339a[_0xca0c('0x2d')],_0x2f682d[_0xca0c('0x2f')]));if(_0x1d339a[_0xca0c('0x2d')]['filter']){_0x4bdc63[_0xca0c('0x37')]=_[_0xca0c('0x39')](_0x4bdc63[_0xca0c('0x37')],{'$or':_[_0xca0c('0x29')](_0x4bdc63[_0xca0c('0x31')],function(_0x2c15e4){var _0x248d26={};_0x248d26[_0x2c15e4]={'$like':'%'+_0x1d339a[_0xca0c('0x2d')][_0xca0c('0x3b')]+'%'};return _0x248d26;})});}_0x4bdc63=_['merge']({},_0x4bdc63,_0x1d339a['options']);return _0x28a20c[_0xca0c('0x4f')](_0x4bdc63);}})[_0xca0c('0x25')](function(_0x5bf628){if(_0x5bf628){_0x256ae7=_0x5bf628['length'];if(!_0x1d339a[_0xca0c('0x2d')][_0xca0c('0x4d')](_0xca0c('0x34'))){_0x4bdc63[_0xca0c('0x1f')]=qs['limit'](_0x1d339a[_0xca0c('0x2d')]['limit']);_0x4bdc63[_0xca0c('0x1d')]=qs['offset'](_0x1d339a[_0xca0c('0x2d')]['offset']);}return _0x28a20c[_0xca0c('0x4f')](_0x4bdc63);}})[_0xca0c('0x25')](function(_0x4ef34d){if(_0x4ef34d){return _0x4ef34d?{'count':_0x256ae7,'rows':_0x4ef34d}:null;}})[_0xca0c('0x25')](respondWithResult(_0x7d7133,null))[_0xca0c('0x41')](handleError(_0x7d7133,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c569b2e..39680c6 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 _0x0e24=['int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','SugarcrmConfiguration'];(function(_0x1c23b2,_0x23ebf0){var _0x227b67=function(_0x2bdfcc){while(--_0x2bdfcc){_0x1c23b2['push'](_0x1c23b2['shift']());}};_0x227b67(++_0x23ebf0);}(_0x0e24,0x12d));var _0x40e2=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0e24[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x40e2('0x0'));var util=require('util');var logger=require(_0x40e2('0x1'))(_0x40e2('0x2'));var moment=require(_0x40e2('0x3'));var BPromise=require(_0x40e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40e2('0x5'));var config=require(_0x40e2('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x41fa5b,_0x55ec1a){return _0x41fa5b[_0x40e2('0x7')](_0x40e2('0x8'),attributes,{'tableName':_0x40e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6942=['api','moment','bluebird','request-promise','exports','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x1dc2f5,_0xaa2e92){var _0x2d863c=function(_0x4e4dc9){while(--_0x4e4dc9){_0x1dc2f5['push'](_0x1dc2f5['shift']());}};_0x2d863c(++_0xaa2e92);}(_0x6942,0x1ec));var _0x2694=function(_0x211f51,_0x3beffe){_0x211f51=_0x211f51-0x0;var _0x158193=_0x6942[_0x211f51];return _0x158193;};'use strict';var _=require(_0x2694('0x0'));var util=require(_0x2694('0x1'));var logger=require(_0x2694('0x2'))(_0x2694('0x3'));var moment=require(_0x2694('0x4'));var BPromise=require(_0x2694('0x5'));var rp=require(_0x2694('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x2694('0x7')]=function(_0xc6f4ef,_0xe5f794){return _0xc6f4ef['define']('SugarcrmConfiguration',attributes,{'tableName':_0x2694('0x8'),'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 3cc3784..422bf4c 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 _0x228a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x721a1f,_0x33d49e){var _0x42eaec=function(_0x4ae9f1){while(--_0x4ae9f1){_0x721a1f['push'](_0x721a1f['shift']());}};_0x42eaec(++_0x33d49e);}(_0x228a,0xe9));var _0xa228=function(_0x3c39f3,_0x41956){_0x3c39f3=_0x3c39f3-0x0;var _0x1924cc=_0x228a[_0x3c39f3];return _0x1924cc;};'use strict';var _=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var moment=require(_0xa228('0x2'));var BPromise=require(_0xa228('0x3'));var rs=require(_0xa228('0x4'));var fs=require('fs');var Redis=require(_0xa228('0x5'));var db=require(_0xa228('0x6'))['db'];var utils=require(_0xa228('0x7'));var logger=require(_0xa228('0x8'))(_0xa228('0x9'));var config=require(_0xa228('0xa'));var jayson=require(_0xa228('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x489c0f,_0x24718a,_0xc37fa8){return new BPromise(function(_0x2f55cb,_0x4ae754){return client[_0xa228('0xc')](_0x489c0f,_0xc37fa8)[_0xa228('0xd')](function(_0x21fd77){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x24718a,_0xa228('0xe'));logger['debug'](_0xa228('0xf'),_0x24718a,_0xa228('0xe'),JSON[_0xa228('0x10')](_0x21fd77));if(_0x21fd77[_0xa228('0x11')]){if(_0x21fd77['error'][_0xa228('0x12')]===0x1f4){logger[_0xa228('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x24718a,_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);return _0x4ae754(_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);}logger[_0xa228('0x11')](_0xa228('0x14'),_0x24718a,_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);return _0x2f55cb(_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);}else{logger[_0xa228('0x15')](_0xa228('0x14'),_0x24718a,_0xa228('0xe'));_0x2f55cb(_0x21fd77[_0xa228('0x16')][_0xa228('0x13')]);}})[_0xa228('0x17')](function(_0x2ee921){logger[_0xa228('0x11')](_0xa228('0x14'),_0x24718a,_0x2ee921);_0x4ae754(_0x2ee921);});});} \ No newline at end of file +var _0x74e1=['../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x44ff7d,_0x16542e){var _0x524573=function(_0x43a9fa){while(--_0x43a9fa){_0x44ff7d['push'](_0x44ff7d['shift']());}};_0x524573(++_0x16542e);}(_0x74e1,0x15a));var _0x174e=function(_0xfc87ae,_0x4416c8){_0xfc87ae=_0xfc87ae-0x0;var _0x551d2a=_0x74e1[_0xfc87ae];return _0x551d2a;};'use strict';var _=require(_0x174e('0x0'));var util=require(_0x174e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x174e('0x2'));var fs=require('fs');var Redis=require(_0x174e('0x3'));var db=require(_0x174e('0x4'))['db'];var utils=require(_0x174e('0x5'));var logger=require(_0x174e('0x6'))('rpc');var config=require(_0x174e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x174e('0x8')][_0x174e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d466,_0x293dc5,_0x527d15){return new BPromise(function(_0xd717ca,_0x1b5020){return client[_0x174e('0xa')](_0x30d466,_0x527d15)[_0x174e('0xb')](function(_0x22fa57){logger[_0x174e('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x293dc5,_0x174e('0xd'));logger['debug'](_0x174e('0xe'),_0x293dc5,'request\x20sent',JSON[_0x174e('0xf')](_0x22fa57));if(_0x22fa57[_0x174e('0x10')]){if(_0x22fa57[_0x174e('0x10')][_0x174e('0x11')]===0x1f4){logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x22fa57[_0x174e('0x10')]['message']);return _0x1b5020(_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);}logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);return _0xd717ca(_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);}else{logger[_0x174e('0xc')](_0x174e('0x12'),_0x293dc5,'request\x20sent');_0xd717ca(_0x22fa57[_0x174e('0x14')][_0x174e('0x13')]);}})[_0x174e('0x15')](function(_0x3375dd){logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x3375dd);_0x1b5020(_0x3375dd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e50613c..08b0a51 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 _0x55c0=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55c0,0x144));var _0x055c=function(_0x5dbb2,_0x1e3317){_0x5dbb2=_0x5dbb2-0x0;var _0x4ba922=_0x55c0[_0x5dbb2];return _0x4ba922;};'use strict';var multer=require(_0x055c('0x0'));var util=require(_0x055c('0x1'));var path=require(_0x055c('0x2'));var timeout=require(_0x055c('0x3'));var express=require('express');var router=express[_0x055c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x055c('0x5'));var interaction=require(_0x055c('0x6'));var config=require(_0x055c('0x7'));var controller=require(_0x055c('0x8'));router[_0x055c('0x9')]('/',auth[_0x055c('0xa')](),controller[_0x055c('0xb')]);router[_0x055c('0x9')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0xd')]);router[_0x055c('0xe')]('/',auth[_0x055c('0xa')](),controller['create']);router[_0x055c('0xf')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0x10')]);router[_0x055c('0x11')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0x12')]);module[_0x055c('0x13')]=router; \ No newline at end of file +var _0x17d1=['isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get'];(function(_0x246ff2,_0x309785){var _0x1c8a90=function(_0x4cbeaa){while(--_0x4cbeaa){_0x246ff2['push'](_0x246ff2['shift']());}};_0x1c8a90(++_0x309785);}(_0x17d1,0x100));var _0x117d=function(_0x385362,_0x481aaf){_0x385362=_0x385362-0x0;var _0x58097d=_0x17d1[_0x385362];return _0x58097d;};'use strict';var multer=require(_0x117d('0x0'));var util=require(_0x117d('0x1'));var path=require(_0x117d('0x2'));var timeout=require(_0x117d('0x3'));var express=require(_0x117d('0x4'));var router=express[_0x117d('0x5')]();var fs_extra=require(_0x117d('0x6'));var auth=require(_0x117d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x117d('0x8'));router[_0x117d('0x9')]('/',auth[_0x117d('0xa')](),controller[_0x117d('0xb')]);router[_0x117d('0x9')]('/:id',auth[_0x117d('0xa')](),controller[_0x117d('0xc')]);router[_0x117d('0xd')]('/',auth[_0x117d('0xa')](),controller[_0x117d('0xe')]);router['put'](_0x117d('0xf'),auth[_0x117d('0xa')](),controller[_0x117d('0x10')]);router[_0x117d('0x11')](_0x117d('0xf'),auth[_0x117d('0xa')](),controller['destroy']);module[_0x117d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index cc268a5..45e9f0a 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 _0xe43c=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe43c,0x19e));var _0xce43=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe43c[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'type':{'type':Sequelize[_0xce43('0x2')](_0xce43('0x3'),_0xce43('0x4'),_0xce43('0x5'),_0xce43('0x6'),'picklist'),'defaultValue':_0xce43('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xce43('0x4'),_0xce43('0x5'))},'keyContent':{'type':Sequelize[_0xce43('0x7')]},'idField':{'type':Sequelize[_0xce43('0x7')]},'nameField':{'type':Sequelize[_0xce43('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcbd9=['variable','STRING','customVariable','BOOLEAN','exports','ENUM','string'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcbd9,0x15b));var _0x9cbd=function(_0xe2e1ec,_0xb7ba23){_0xe2e1ec=_0xe2e1ec-0x0;var _0x15ab92=_0xcbd9[_0xe2e1ec];return _0x15ab92;};'use strict';var Sequelize=require('sequelize');module[_0x9cbd('0x0')]={'type':{'type':Sequelize[_0x9cbd('0x1')](_0x9cbd('0x2'),_0x9cbd('0x3'),'customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9cbd('0x4')]},'keyType':{'type':Sequelize[_0x9cbd('0x1')](_0x9cbd('0x2'),_0x9cbd('0x3'),_0x9cbd('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9cbd('0x4')]},'nameField':{'type':Sequelize[_0x9cbd('0x4')]},'customField':{'type':Sequelize[_0x9cbd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b8c9bf0..870a8a2 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 _0x6f86=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','type','key'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x6f86,0x1de));var _0x66f8=function(_0x119a07,_0x2289f6){_0x119a07=_0x119a07-0x0;var _0x36025c=_0x6f86[_0x119a07];return _0x36025c;};'use strict';var emlformat=require(_0x66f8('0x0'));var rimraf=require(_0x66f8('0x1'));var zipdir=require(_0x66f8('0x2'));var jsonpatch=require(_0x66f8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66f8('0x4'));var Mustache=require(_0x66f8('0x5'));var util=require(_0x66f8('0x6'));var path=require(_0x66f8('0x7'));var sox=require(_0x66f8('0x8'));var csv=require(_0x66f8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66f8('0xa'));var _=require('lodash');var squel=require(_0x66f8('0xb'));var crypto=require(_0x66f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x66f8('0xd'));var toCsv=require(_0x66f8('0x9'));var querystring=require(_0x66f8('0xe'));var Papa=require(_0x66f8('0xf'));var Redis=require(_0x66f8('0x10'));var authService=require(_0x66f8('0x11'));var qs=require(_0x66f8('0x12'));var as=require(_0x66f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66f8('0x14'))('api');var utils=require(_0x66f8('0x15'));var config=require(_0x66f8('0x16'));var licenseUtil=require(_0x66f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb14e,_0x1d0689){_0x1d0689=_0x1d0689||0xcc;return function(_0xb7d44b){if(_0xb7d44b){return _0x2eb14e[_0x66f8('0x18')](_0x1d0689);}return _0x2eb14e[_0x66f8('0x19')](_0x1d0689)[_0x66f8('0x1a')]();};}function respondWithResult(_0x516a14,_0x274220){_0x274220=_0x274220||0xc8;return function(_0x5be837){if(_0x5be837){return _0x516a14[_0x66f8('0x19')](_0x274220)[_0x66f8('0x1b')](_0x5be837);}};}function respondWithFilteredResult(_0x24346f,_0x2ea533){return function(_0x32de14){if(_0x32de14){var _0x284f24=typeof _0x2ea533[_0x66f8('0x1c')]===_0x66f8('0x1d')&&typeof _0x2ea533['limit']===_0x66f8('0x1d');var _0x52e6be=_0x32de14[_0x66f8('0x1e')];var _0x6f99=_0x284f24?0x0:_0x2ea533[_0x66f8('0x1c')];var _0xb8dc09=_0x284f24?_0x32de14['count']:_0x2ea533[_0x66f8('0x1c')]+_0x2ea533[_0x66f8('0x1f')];var _0x239d81;if(_0xb8dc09>=_0x52e6be){_0xb8dc09=_0x52e6be;_0x239d81=0xc8;}else{_0x239d81=0xce;}_0x24346f[_0x66f8('0x19')](_0x239d81);return _0x24346f['set'](_0x66f8('0x20'),_0x6f99+'-'+_0xb8dc09+'/'+_0x52e6be)['json'](_0x32de14);}return null;};}function patchUpdates(_0x451454){return function(_0x225a0f){try{jsonpatch[_0x66f8('0x21')](_0x225a0f,_0x451454,!![]);}catch(_0x144399){return BPromise[_0x66f8('0x22')](_0x144399);}return _0x225a0f['save']();};}function saveUpdates(_0x2a6c05,_0x35eae7){return function(_0x468a14){if(_0x468a14){return _0x468a14[_0x66f8('0x23')](_0x2a6c05)[_0x66f8('0x24')](function(_0x30ae4b){return _0x30ae4b;});}return null;};}function removeEntity(_0x3b7bb7,_0x2a9857){return function(_0x1e7b03){if(_0x1e7b03){return _0x1e7b03[_0x66f8('0x25')]()[_0x66f8('0x24')](function(){_0x3b7bb7[_0x66f8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56710c,_0x50d07e){return function(_0x1b67de){if(!_0x1b67de){_0x56710c[_0x66f8('0x18')](0x194);}return _0x1b67de;};}function handleError(_0x27221e,_0x51a2bd){_0x51a2bd=_0x51a2bd||0x1f4;return function(_0x168f49){logger[_0x66f8('0x26')](_0x168f49[_0x66f8('0x27')]);if(_0x168f49[_0x66f8('0x28')]){delete _0x168f49[_0x66f8('0x28')];}_0x27221e['status'](_0x51a2bd)[_0x66f8('0x29')](_0x168f49);};}exports[_0x66f8('0x2a')]=function(_0x1b863e,_0xd75549){var _0x329f9a={},_0x41a352={},_0x5a9a6b={'count':0x0,'rows':[]};var _0x40a6da=_[_0x66f8('0x2b')](db[_0x66f8('0x2c')]['rawAttributes'],function(_0x34c52e){return{'name':_0x34c52e['fieldName'],'type':_0x34c52e[_0x66f8('0x2d')][_0x66f8('0x2e')]};});_0x41a352[_0x66f8('0x2f')]=_['map'](_0x40a6da,_0x66f8('0x28'));_0x41a352[_0x66f8('0x30')]=_[_0x66f8('0x31')](_0x1b863e['query']);_0x41a352[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x41a352[_0x66f8('0x2f')],_0x41a352[_0x66f8('0x30')]);_0x329f9a[_0x66f8('0x34')]=_['intersection'](_0x41a352[_0x66f8('0x2f')],qs[_0x66f8('0x35')](_0x1b863e[_0x66f8('0x30')][_0x66f8('0x35')]));_0x329f9a[_0x66f8('0x34')]=_0x329f9a[_0x66f8('0x34')][_0x66f8('0x36')]?_0x329f9a[_0x66f8('0x34')]:_0x41a352['model'];if(!_0x1b863e[_0x66f8('0x30')][_0x66f8('0x37')](_0x66f8('0x38'))){_0x329f9a[_0x66f8('0x1f')]=qs[_0x66f8('0x1f')](_0x1b863e[_0x66f8('0x30')]['limit']);_0x329f9a[_0x66f8('0x1c')]=qs['offset'](_0x1b863e['query'][_0x66f8('0x1c')]);}_0x329f9a[_0x66f8('0x39')]=qs['sort'](_0x1b863e[_0x66f8('0x30')][_0x66f8('0x3a')]);_0x329f9a[_0x66f8('0x3b')]=qs[_0x66f8('0x32')](_[_0x66f8('0x3c')](_0x1b863e[_0x66f8('0x30')],_0x41a352[_0x66f8('0x32')]),_0x40a6da);if(_0x1b863e[_0x66f8('0x30')][_0x66f8('0x3d')]){_0x329f9a[_0x66f8('0x3b')]=_['merge'](_0x329f9a[_0x66f8('0x3b')],{'$or':_[_0x66f8('0x2b')](_0x40a6da,function(_0x54be3e){if(_0x54be3e[_0x66f8('0x2d')]!==_0x66f8('0x3e')){var _0x653a9b={};_0x653a9b[_0x54be3e['name']]={'$like':'%'+_0x1b863e[_0x66f8('0x30')]['filter']+'%'};return _0x653a9b;}})});}_0x329f9a=_[_0x66f8('0x3f')]({},_0x329f9a,_0x1b863e[_0x66f8('0x40')]);var _0x31bf2a={'where':_0x329f9a['where']};return db['SugarcrmField'][_0x66f8('0x1e')](_0x31bf2a)[_0x66f8('0x24')](function(_0x5ad91d){_0x5a9a6b[_0x66f8('0x1e')]=_0x5ad91d;if(_0x1b863e['query']['includeAll']){_0x329f9a[_0x66f8('0x41')]=[{'all':!![]}];}return db[_0x66f8('0x2c')]['findAll'](_0x329f9a);})[_0x66f8('0x24')](function(_0x11b470){_0x5a9a6b[_0x66f8('0x42')]=_0x11b470;return _0x5a9a6b;})['then'](respondWithFilteredResult(_0xd75549,_0x329f9a))['catch'](handleError(_0xd75549,null));};exports[_0x66f8('0x43')]=function(_0x1354c2,_0x69d173){var _0x3e311d={'raw':!![],'where':{'id':_0x1354c2[_0x66f8('0x44')]['id']}},_0x2adbd6={};_0x2adbd6['model']=_[_0x66f8('0x31')](db[_0x66f8('0x2c')][_0x66f8('0x45')]);_0x2adbd6[_0x66f8('0x30')]=_['keys'](_0x1354c2[_0x66f8('0x30')]);_0x2adbd6[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x2adbd6[_0x66f8('0x2f')],_0x2adbd6[_0x66f8('0x30')]);_0x3e311d['attributes']=_[_0x66f8('0x33')](_0x2adbd6[_0x66f8('0x2f')],qs[_0x66f8('0x35')](_0x1354c2[_0x66f8('0x30')][_0x66f8('0x35')]));_0x3e311d['attributes']=_0x3e311d['attributes']['length']?_0x3e311d['attributes']:_0x2adbd6[_0x66f8('0x2f')];if(_0x1354c2[_0x66f8('0x30')][_0x66f8('0x46')]){_0x3e311d[_0x66f8('0x41')]=[{'all':!![]}];}_0x3e311d=_[_0x66f8('0x3f')]({},_0x3e311d,_0x1354c2[_0x66f8('0x40')]);return db['SugarcrmField'][_0x66f8('0x47')](_0x3e311d)['then'](handleEntityNotFound(_0x69d173,null))['then'](respondWithResult(_0x69d173,null))[_0x66f8('0x48')](handleError(_0x69d173,null));};exports['create']=function(_0x1c294a,_0x2b1309){return db[_0x66f8('0x2c')][_0x66f8('0x49')](_0x1c294a[_0x66f8('0x4a')],{})[_0x66f8('0x24')](respondWithResult(_0x2b1309,0xc9))['catch'](handleError(_0x2b1309,null));};exports[_0x66f8('0x23')]=function(_0x36384b,_0x231386){if(_0x36384b[_0x66f8('0x4a')]['id']){delete _0x36384b[_0x66f8('0x4a')]['id'];}return db[_0x66f8('0x2c')][_0x66f8('0x47')]({'where':{'id':_0x36384b[_0x66f8('0x44')]['id']}})[_0x66f8('0x24')](handleEntityNotFound(_0x231386,null))[_0x66f8('0x24')](saveUpdates(_0x36384b[_0x66f8('0x4a')],null))[_0x66f8('0x24')](respondWithResult(_0x231386,null))[_0x66f8('0x48')](handleError(_0x231386,null));};exports[_0x66f8('0x25')]=function(_0x3223ef,_0x546e8e){return db['SugarcrmField'][_0x66f8('0x47')]({'where':{'id':_0x3223ef[_0x66f8('0x44')]['id']}})[_0x66f8('0x24')](handleEntityNotFound(_0x546e8e,null))[_0x66f8('0x24')](removeEntity(_0x546e8e,null))[_0x66f8('0x48')](handleError(_0x546e8e,null));}; \ No newline at end of file +var _0x31b3=['squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x31b3,0x85));var _0x331b=function(_0xedad0f,_0xd2a73d){_0xedad0f=_0xedad0f-0x0;var _0x1d657e=_0x31b3[_0xedad0f];return _0x1d657e;};'use strict';var emlformat=require(_0x331b('0x0'));var rimraf=require(_0x331b('0x1'));var zipdir=require(_0x331b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x331b('0x3'));var moment=require(_0x331b('0x4'));var BPromise=require(_0x331b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x331b('0x6'));var sox=require(_0x331b('0x7'));var csv=require(_0x331b('0x8'));var ejs=require(_0x331b('0x9'));var fs=require('fs');var fs_extra=require(_0x331b('0xa'));var _=require('lodash');var squel=require(_0x331b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x331b('0xc'));var toCsv=require(_0x331b('0x8'));var querystring=require(_0x331b('0xd'));var Papa=require(_0x331b('0xe'));var Redis=require(_0x331b('0xf'));var authService=require(_0x331b('0x10'));var qs=require(_0x331b('0x11'));var as=require(_0x331b('0x12'));var hardwareService=require(_0x331b('0x13'));var logger=require('../../config/logger')(_0x331b('0x14'));var utils=require(_0x331b('0x15'));var config=require(_0x331b('0x16'));var licenseUtil=require(_0x331b('0x17'));var db=require(_0x331b('0x18'))['db'];function respondWithStatusCode(_0xdf3171,_0x1fff45){_0x1fff45=_0x1fff45||0xcc;return function(_0x4a1cbb){if(_0x4a1cbb){return _0xdf3171[_0x331b('0x19')](_0x1fff45);}return _0xdf3171[_0x331b('0x1a')](_0x1fff45)[_0x331b('0x1b')]();};}function respondWithResult(_0x464165,_0x14333c){_0x14333c=_0x14333c||0xc8;return function(_0x3aa222){if(_0x3aa222){return _0x464165[_0x331b('0x1a')](_0x14333c)['json'](_0x3aa222);}};}function respondWithFilteredResult(_0x1447d5,_0x5ddec6){return function(_0x2b71fa){if(_0x2b71fa){var _0x286601=typeof _0x5ddec6[_0x331b('0x1c')]===_0x331b('0x1d')&&typeof _0x5ddec6[_0x331b('0x1e')]===_0x331b('0x1d');var _0x56f95d=_0x2b71fa[_0x331b('0x1f')];var _0x23e5b3=_0x286601?0x0:_0x5ddec6['offset'];var _0x263af4=_0x286601?_0x2b71fa[_0x331b('0x1f')]:_0x5ddec6[_0x331b('0x1c')]+_0x5ddec6['limit'];var _0x34aab3;if(_0x263af4>=_0x56f95d){_0x263af4=_0x56f95d;_0x34aab3=0xc8;}else{_0x34aab3=0xce;}_0x1447d5[_0x331b('0x1a')](_0x34aab3);return _0x1447d5[_0x331b('0x20')](_0x331b('0x21'),_0x23e5b3+'-'+_0x263af4+'/'+_0x56f95d)[_0x331b('0x22')](_0x2b71fa);}return null;};}function patchUpdates(_0x5bdb93){return function(_0x14df82){try{jsonpatch['apply'](_0x14df82,_0x5bdb93,!![]);}catch(_0xaedc22){return BPromise[_0x331b('0x23')](_0xaedc22);}return _0x14df82[_0x331b('0x24')]();};}function saveUpdates(_0x55ffc7,_0x4adb77){return function(_0x9f268b){if(_0x9f268b){return _0x9f268b[_0x331b('0x25')](_0x55ffc7)[_0x331b('0x26')](function(_0x133fde){return _0x133fde;});}return null;};}function removeEntity(_0x3def28,_0x52b9e4){return function(_0x575f59){if(_0x575f59){return _0x575f59[_0x331b('0x27')]()[_0x331b('0x26')](function(){_0x3def28[_0x331b('0x1a')](0xcc)[_0x331b('0x1b')]();});}};}function handleEntityNotFound(_0x5da90d,_0xe04427){return function(_0x114eb7){if(!_0x114eb7){_0x5da90d[_0x331b('0x19')](0x194);}return _0x114eb7;};}function handleError(_0x387d82,_0x24e020){_0x24e020=_0x24e020||0x1f4;return function(_0x5a6763){logger['error'](_0x5a6763[_0x331b('0x28')]);if(_0x5a6763[_0x331b('0x29')]){delete _0x5a6763[_0x331b('0x29')];}_0x387d82['status'](_0x24e020)[_0x331b('0x2a')](_0x5a6763);};}exports[_0x331b('0x2b')]=function(_0x5e00a6,_0x2b59c9){var _0x162456={},_0x22fe7f={},_0xe9d5c5={'count':0x0,'rows':[]};var _0x2f04c3=_[_0x331b('0x2c')](db[_0x331b('0x2d')]['rawAttributes'],function(_0x445bce){return{'name':_0x445bce[_0x331b('0x2e')],'type':_0x445bce[_0x331b('0x2f')]['key']};});_0x22fe7f[_0x331b('0x30')]=_[_0x331b('0x2c')](_0x2f04c3,_0x331b('0x29'));_0x22fe7f[_0x331b('0x31')]=_[_0x331b('0x32')](_0x5e00a6[_0x331b('0x31')]);_0x22fe7f[_0x331b('0x33')]=_[_0x331b('0x34')](_0x22fe7f[_0x331b('0x30')],_0x22fe7f[_0x331b('0x31')]);_0x162456[_0x331b('0x35')]=_[_0x331b('0x34')](_0x22fe7f['model'],qs['fields'](_0x5e00a6[_0x331b('0x31')][_0x331b('0x36')]));_0x162456[_0x331b('0x35')]=_0x162456[_0x331b('0x35')][_0x331b('0x37')]?_0x162456['attributes']:_0x22fe7f[_0x331b('0x30')];if(!_0x5e00a6['query']['hasOwnProperty']('nolimit')){_0x162456[_0x331b('0x1e')]=qs[_0x331b('0x1e')](_0x5e00a6['query'][_0x331b('0x1e')]);_0x162456[_0x331b('0x1c')]=qs[_0x331b('0x1c')](_0x5e00a6[_0x331b('0x31')][_0x331b('0x1c')]);}_0x162456['order']=qs[_0x331b('0x38')](_0x5e00a6[_0x331b('0x31')][_0x331b('0x38')]);_0x162456[_0x331b('0x39')]=qs['filters'](_[_0x331b('0x3a')](_0x5e00a6[_0x331b('0x31')],_0x22fe7f[_0x331b('0x33')]),_0x2f04c3);if(_0x5e00a6['query'][_0x331b('0x3b')]){_0x162456[_0x331b('0x39')]=_[_0x331b('0x3c')](_0x162456[_0x331b('0x39')],{'$or':_['map'](_0x2f04c3,function(_0x1d5c93){if(_0x1d5c93[_0x331b('0x2f')]!=='VIRTUAL'){var _0x29f601={};_0x29f601[_0x1d5c93[_0x331b('0x29')]]={'$like':'%'+_0x5e00a6[_0x331b('0x31')][_0x331b('0x3b')]+'%'};return _0x29f601;}})});}_0x162456=_['merge']({},_0x162456,_0x5e00a6[_0x331b('0x3d')]);var _0x18aa6f={'where':_0x162456[_0x331b('0x39')]};return db[_0x331b('0x2d')][_0x331b('0x1f')](_0x18aa6f)[_0x331b('0x26')](function(_0x1fb907){_0xe9d5c5[_0x331b('0x1f')]=_0x1fb907;if(_0x5e00a6[_0x331b('0x31')][_0x331b('0x3e')]){_0x162456['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x331b('0x3f')](_0x162456);})[_0x331b('0x26')](function(_0x23ddc1){_0xe9d5c5[_0x331b('0x40')]=_0x23ddc1;return _0xe9d5c5;})[_0x331b('0x26')](respondWithFilteredResult(_0x2b59c9,_0x162456))[_0x331b('0x41')](handleError(_0x2b59c9,null));};exports[_0x331b('0x42')]=function(_0x2eb851,_0x10824b){var _0x1521d2={'raw':!![],'where':{'id':_0x2eb851[_0x331b('0x43')]['id']}},_0x20a3e2={};_0x20a3e2[_0x331b('0x30')]=_['keys'](db[_0x331b('0x2d')][_0x331b('0x44')]);_0x20a3e2['query']=_[_0x331b('0x32')](_0x2eb851[_0x331b('0x31')]);_0x20a3e2['filters']=_['intersection'](_0x20a3e2[_0x331b('0x30')],_0x20a3e2[_0x331b('0x31')]);_0x1521d2[_0x331b('0x35')]=_[_0x331b('0x34')](_0x20a3e2[_0x331b('0x30')],qs[_0x331b('0x36')](_0x2eb851[_0x331b('0x31')][_0x331b('0x36')]));_0x1521d2[_0x331b('0x35')]=_0x1521d2[_0x331b('0x35')]['length']?_0x1521d2[_0x331b('0x35')]:_0x20a3e2['model'];if(_0x2eb851[_0x331b('0x31')][_0x331b('0x3e')]){_0x1521d2['include']=[{'all':!![]}];}_0x1521d2=_[_0x331b('0x3c')]({},_0x1521d2,_0x2eb851[_0x331b('0x3d')]);return db[_0x331b('0x2d')][_0x331b('0x45')](_0x1521d2)['then'](handleEntityNotFound(_0x10824b,null))[_0x331b('0x26')](respondWithResult(_0x10824b,null))[_0x331b('0x41')](handleError(_0x10824b,null));};exports[_0x331b('0x46')]=function(_0xcc7ab,_0x40a5eb){return db[_0x331b('0x2d')]['create'](_0xcc7ab[_0x331b('0x47')],{})[_0x331b('0x26')](respondWithResult(_0x40a5eb,0xc9))[_0x331b('0x41')](handleError(_0x40a5eb,null));};exports[_0x331b('0x25')]=function(_0x248219,_0x135516){if(_0x248219[_0x331b('0x47')]['id']){delete _0x248219[_0x331b('0x47')]['id'];}return db[_0x331b('0x2d')]['find']({'where':{'id':_0x248219[_0x331b('0x43')]['id']}})['then'](handleEntityNotFound(_0x135516,null))[_0x331b('0x26')](saveUpdates(_0x248219[_0x331b('0x47')],null))[_0x331b('0x26')](respondWithResult(_0x135516,null))[_0x331b('0x41')](handleError(_0x135516,null));};exports[_0x331b('0x27')]=function(_0x3d3e38,_0x5e105e){return db[_0x331b('0x2d')][_0x331b('0x45')]({'where':{'id':_0x3d3e38[_0x331b('0x43')]['id']}})[_0x331b('0x26')](handleEntityNotFound(_0x5e105e,null))[_0x331b('0x26')](removeEntity(_0x5e105e,null))[_0x331b('0x41')](handleError(_0x5e105e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fd7d049..a9f4bcd 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 _0x06bb=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0xa00884,_0xceb26e){var _0x5348c0=function(_0x217fa7){while(--_0x217fa7){_0xa00884['push'](_0xa00884['shift']());}};_0x5348c0(++_0xceb26e);}(_0x06bb,0x1dd));var _0xb06b=function(_0x4363ee,_0x24f151){_0x4363ee=_0x4363ee-0x0;var _0x1d824f=_0x06bb[_0x4363ee];return _0x1d824f;};'use strict';var _=require(_0xb06b('0x0'));var util=require('util');var logger=require(_0xb06b('0x1'))(_0xb06b('0x2'));var moment=require(_0xb06b('0x3'));var BPromise=require(_0xb06b('0x4'));var rp=require(_0xb06b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb06b('0x6'));var config=require(_0xb06b('0x7'));var attributes=require(_0xb06b('0x8'));module[_0xb06b('0x9')]=function(_0x11f79a,_0x1ee137){return _0x11f79a[_0xb06b('0xa')](_0xb06b('0xb'),attributes,{'tableName':_0xb06b('0xc'),'paranoid':![],'indexes':[{'name':_0xb06b('0xd'),'fields':[_0xb06b('0xe'),_0xb06b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d4c=['path','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7d4c,0xe9));var _0xc7d4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7d4c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc7d4('0x0'));var util=require(_0xc7d4('0x1'));var logger=require(_0xc7d4('0x2'))(_0xc7d4('0x3'));var moment=require(_0xc7d4('0x4'));var BPromise=require(_0xc7d4('0x5'));var rp=require(_0xc7d4('0x6'));var fs=require('fs');var path=require(_0xc7d4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7d4('0x8'));module[_0xc7d4('0x9')]=function(_0x467b3c,_0x2a0321){return _0x467b3c[_0xc7d4('0xa')](_0xc7d4('0xb'),attributes,{'tableName':_0xc7d4('0xc'),'paranoid':![],'indexes':[{'name':_0xc7d4('0xd'),'fields':[_0xc7d4('0xe'),_0xc7d4('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index fba27de..2b10050 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 _0x438e=['info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','http','request','then'];(function(_0x3655a1,_0x44ed1d){var _0x364918=function(_0x5753b6){while(--_0x5753b6){_0x3655a1['push'](_0x3655a1['shift']());}};_0x364918(++_0x44ed1d);}(_0x438e,0x19a));var _0xe438=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x438e[_0x175a55];return _0x167adf;};'use strict';var _=require(_0xe438('0x0'));var util=require(_0xe438('0x1'));var moment=require(_0xe438('0x2'));var BPromise=require(_0xe438('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe438('0x4'));var db=require(_0xe438('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe438('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe438('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc5cba,_0x4d7aa3,_0x3b6098){return new BPromise(function(_0x2a3dbb,_0x10e86d){return client[_0xe438('0x8')](_0xc5cba,_0x3b6098)[_0xe438('0x9')](function(_0x37053d){logger[_0xe438('0xa')](_0xe438('0xb'),_0x4d7aa3,'request\x20sent');logger[_0xe438('0xc')](_0xe438('0xd'),_0x4d7aa3,_0xe438('0xe'),JSON[_0xe438('0xf')](_0x37053d));if(_0x37053d[_0xe438('0x10')]){if(_0x37053d[_0xe438('0x10')][_0xe438('0x11')]===0x1f4){logger[_0xe438('0x10')](_0xe438('0xb'),_0x4d7aa3,_0x37053d[_0xe438('0x10')]['message']);return _0x10e86d(_0x37053d[_0xe438('0x10')]['message']);}logger[_0xe438('0x10')](_0xe438('0xb'),_0x4d7aa3,_0x37053d[_0xe438('0x10')][_0xe438('0x12')]);return _0x2a3dbb(_0x37053d[_0xe438('0x10')][_0xe438('0x12')]);}else{logger['info'](_0xe438('0xb'),_0x4d7aa3,'request\x20sent');_0x2a3dbb(_0x37053d[_0xe438('0x13')]['message']);}})[_0xe438('0x14')](function(_0x243947){logger[_0xe438('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4d7aa3,_0x243947);_0x10e86d(_0x243947);});});} \ No newline at end of file +var _0xd237=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x27c69c,_0x4fa9a9){var _0x339bd9=function(_0x219032){while(--_0x219032){_0x27c69c['push'](_0x27c69c['shift']());}};_0x339bd9(++_0x4fa9a9);}(_0xd237,0x197));var _0x7d23=function(_0x17fbc2,_0x1f2de7){_0x17fbc2=_0x17fbc2-0x0;var _0x38b500=_0xd237[_0x17fbc2];return _0x38b500;};'use strict';var _=require(_0x7d23('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d23('0x1'));var rs=require(_0x7d23('0x2'));var fs=require('fs');var Redis=require(_0x7d23('0x3'));var db=require(_0x7d23('0x4'))['db'];var utils=require(_0x7d23('0x5'));var logger=require(_0x7d23('0x6'))(_0x7d23('0x7'));var config=require(_0x7d23('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0x9')][_0x7d23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9fd6,_0x4385f0,_0x5d1c4c){return new BPromise(function(_0x690163,_0x8b211a){return client[_0x7d23('0xb')](_0x4f9fd6,_0x5d1c4c)[_0x7d23('0xc')](function(_0x451d2d){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x4385f0,_0x7d23('0xf'));logger[_0x7d23('0x10')](_0x7d23('0x11'),_0x4385f0,'request\x20sent',JSON['stringify'](_0x451d2d));if(_0x451d2d[_0x7d23('0x12')]){if(_0x451d2d['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x4385f0,_0x451d2d[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x8b211a(_0x451d2d[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error'](_0x7d23('0xe'),_0x4385f0,_0x451d2d['error']['message']);return _0x690163(_0x451d2d[_0x7d23('0x12')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x4385f0,_0x7d23('0xf'));_0x690163(_0x451d2d[_0x7d23('0x15')]['message']);}})['catch'](function(_0x108d94){logger['error'](_0x7d23('0xe'),_0x4385f0,_0x108d94);_0x8b211a(_0x108d94);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 184e751..2516134 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 _0x5f86=['/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index'];(function(_0x1c181e,_0x1d5457){var _0x20bcb5=function(_0x30ec15){while(--_0x30ec15){_0x1c181e['push'](_0x1c181e['shift']());}};_0x20bcb5(++_0x1d5457);}(_0x5f86,0x81));var _0x65f8=function(_0x351c9d,_0x2b306e){_0x351c9d=_0x351c9d-0x0;var _0x281bfa=_0x5f86[_0x351c9d];return _0x281bfa;};'use strict';var multer=require('multer');var util=require(_0x65f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65f8('0x1'));var router=express[_0x65f8('0x2')]();var fs_extra=require(_0x65f8('0x3'));var auth=require(_0x65f8('0x4'));var interaction=require(_0x65f8('0x5'));var config=require(_0x65f8('0x6'));var controller=require(_0x65f8('0x7'));router[_0x65f8('0x8')]('/',auth[_0x65f8('0x9')](),controller[_0x65f8('0xa')]);router[_0x65f8('0x8')](_0x65f8('0xb'),auth[_0x65f8('0x9')](),controller[_0x65f8('0xc')]);router[_0x65f8('0x8')](_0x65f8('0xd'),auth[_0x65f8('0x9')](),controller[_0x65f8('0xe')]);router[_0x65f8('0x8')]('/:id/fields',auth[_0x65f8('0x9')](),controller['getFields']);router[_0x65f8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65f8('0xf')](_0x65f8('0xd'),auth[_0x65f8('0x9')](),controller[_0x65f8('0x10')]);router[_0x65f8('0x11')](_0x65f8('0xb'),auth[_0x65f8('0x9')](),controller['update']);router['delete']('/:id',auth[_0x65f8('0x9')](),controller[_0x65f8('0x12')]);module[_0x65f8('0x13')]=router; \ No newline at end of file +var _0x8b7c=['/:id/configurations','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','post'];(function(_0x58591c,_0x3dbb23){var _0x46585c=function(_0x1acaf1){while(--_0x1acaf1){_0x58591c['push'](_0x58591c['shift']());}};_0x46585c(++_0x3dbb23);}(_0x8b7c,0x119));var _0xc8b7=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x8b7c[_0xcfc44];return _0x307a25;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var timeout=require(_0xc8b7('0x3'));var express=require(_0xc8b7('0x4'));var router=express[_0xc8b7('0x5')]();var fs_extra=require(_0xc8b7('0x6'));var auth=require(_0xc8b7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b7('0x8'));var controller=require(_0xc8b7('0x9'));router[_0xc8b7('0xa')]('/',auth['isAuthenticated'](),controller[_0xc8b7('0xb')]);router[_0xc8b7('0xa')](_0xc8b7('0xc'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0xe')]);router[_0xc8b7('0xa')]('/:id/configurations',auth[_0xc8b7('0xd')](),controller['getConfigurations']);router[_0xc8b7('0xa')](_0xc8b7('0xf'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc8b7('0x12'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x13')]);router[_0xc8b7('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc8b7('0x15')](_0xc8b7('0xc'),auth[_0xc8b7('0xd')](),controller['destroy']);module[_0xc8b7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9150b3b..84366b7 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 _0xecd1=['STRING','HelpDesk','sequelize','exports'];(function(_0x1b729d,_0x5c5a6f){var _0x256125=function(_0x31481c){while(--_0x31481c){_0x1b729d['push'](_0x1b729d['shift']());}};_0x256125(++_0x5c5a6f);}(_0xecd1,0x13e));var _0x1ecd=function(_0x30c3f7,_0x35672b){_0x30c3f7=_0x30c3f7-0x0;var _0x56443d=_0xecd1[_0x30c3f7];return _0x56443d;};'use strict';var Sequelize=require(_0x1ecd('0x0'));module[_0x1ecd('0x1')]={'name':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1ecd('0x2')]},'username':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ecd('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3a34=['exports','STRING','sequelize'];(function(_0x1d930f,_0x27c5a3){var _0x1e6bda=function(_0x3b7264){while(--_0x3b7264){_0x1d930f['push'](_0x1d930f['shift']());}};_0x1e6bda(++_0x27c5a3);}(_0x3a34,0x191));var _0x43a3=function(_0x45e5f2,_0xc803d0){_0x45e5f2=_0x45e5f2-0x0;var _0x333b0a=_0x3a34[_0x45e5f2];return _0x333b0a;};'use strict';var Sequelize=require(_0x43a3('0x0'));module[_0x43a3('0x1')]={'name':{'type':Sequelize[_0x43a3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x43a3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x43a3('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x43a3('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x43a3('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 cafcab2..017e735 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 _0x3fcb=['getDescriptions','create','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','reference','owner','includes','remove','false','cf_','picklistValues','label','log','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','../../components/integrations/configuration','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','stack','name','send','index','map','VtigerAccount','rawAttributes','type','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','body','update','destroy','VtigerConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x8a1d5a,_0x214c58){var _0x27cf4e=function(_0x7e67d7){while(--_0x7e67d7){_0x8a1d5a['push'](_0x8a1d5a['shift']());}};_0x27cf4e(++_0x214c58);}(_0x3fcb,0xa2));var _0xb3fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3fcb[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xb3fc('0x0'));var rimraf=require(_0xb3fc('0x1'));var zipdir=require(_0xb3fc('0x2'));var jsonpatch=require(_0xb3fc('0x3'));var rp=require(_0xb3fc('0x4'));var moment=require(_0xb3fc('0x5'));var BPromise=require(_0xb3fc('0x6'));var Mustache=require('mustache');var util=require(_0xb3fc('0x7'));var path=require(_0xb3fc('0x8'));var sox=require(_0xb3fc('0x9'));var csv=require(_0xb3fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3fc('0xb'));var _=require(_0xb3fc('0xc'));var squel=require(_0xb3fc('0xd'));var crypto=require(_0xb3fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3fc('0xf'));var toCsv=require(_0xb3fc('0xa'));var querystring=require('querystring');var Papa=require(_0xb3fc('0x10'));var Redis=require(_0xb3fc('0x11'));var authService=require(_0xb3fc('0x12'));var qs=require(_0xb3fc('0x13'));var as=require(_0xb3fc('0x14'));var hardwareService=require(_0xb3fc('0x15'));var logger=require(_0xb3fc('0x16'))('api');var utils=require(_0xb3fc('0x17'));var config=require(_0xb3fc('0x18'));var licenseUtil=require(_0xb3fc('0x19'));var db=require(_0xb3fc('0x1a'))['db'];var integrations=require(_0xb3fc('0x1b'));function respondWithStatusCode(_0x337d38,_0x55fbec){_0x55fbec=_0x55fbec||0xcc;return function(_0x12cc88){if(_0x12cc88){return _0x337d38['sendStatus'](_0x55fbec);}return _0x337d38[_0xb3fc('0x1c')](_0x55fbec)[_0xb3fc('0x1d')]();};}function respondWithResult(_0x278c91,_0x11bb07){_0x11bb07=_0x11bb07||0xc8;return function(_0x3e5fdc){if(_0x3e5fdc){return _0x278c91[_0xb3fc('0x1c')](_0x11bb07)[_0xb3fc('0x1e')](_0x3e5fdc);}};}function respondWithFilteredResult(_0x5e2a7a,_0x1c9665){return function(_0x56842a){if(_0x56842a){var _0x571f4f=typeof _0x1c9665['offset']===_0xb3fc('0x1f')&&typeof _0x1c9665['limit']==='undefined';var _0x31e927=_0x56842a['count'];var _0xe04c74=_0x571f4f?0x0:_0x1c9665[_0xb3fc('0x20')];var _0x4a6cdd=_0x571f4f?_0x56842a[_0xb3fc('0x21')]:_0x1c9665[_0xb3fc('0x20')]+_0x1c9665[_0xb3fc('0x22')];var _0x371ed8;if(_0x4a6cdd>=_0x31e927){_0x4a6cdd=_0x31e927;_0x371ed8=0xc8;}else{_0x371ed8=0xce;}_0x5e2a7a[_0xb3fc('0x1c')](_0x371ed8);return _0x5e2a7a[_0xb3fc('0x23')](_0xb3fc('0x24'),_0xe04c74+'-'+_0x4a6cdd+'/'+_0x31e927)[_0xb3fc('0x1e')](_0x56842a);}return null;};}function patchUpdates(_0x1febc3){return function(_0x242496){try{jsonpatch[_0xb3fc('0x25')](_0x242496,_0x1febc3,!![]);}catch(_0x2da6c1){return BPromise['reject'](_0x2da6c1);}return _0x242496[_0xb3fc('0x26')]();};}function saveUpdates(_0x5489d5,_0x2a247b){return function(_0x465ae6){if(_0x465ae6){return _0x465ae6['update'](_0x5489d5)[_0xb3fc('0x27')](function(_0x290324){return _0x290324;});}return null;};}function removeEntity(_0x143cd0,_0x59bcff){return function(_0x287833){if(_0x287833){return _0x287833['destroy']()[_0xb3fc('0x27')](function(){_0x143cd0['status'](0xcc)[_0xb3fc('0x1d')]();});}};}function handleEntityNotFound(_0x4fb61d,_0x1effca){return function(_0x196ef5){if(!_0x196ef5){_0x4fb61d['sendStatus'](0x194);}return _0x196ef5;};}function handleError(_0x16e79c,_0x5ec576){_0x5ec576=_0x5ec576||0x1f4;return function(_0x5847f5){logger['error'](_0x5847f5[_0xb3fc('0x28')]);if(_0x5847f5[_0xb3fc('0x29')]){delete _0x5847f5[_0xb3fc('0x29')];}_0x16e79c[_0xb3fc('0x1c')](_0x5ec576)[_0xb3fc('0x2a')](_0x5847f5);};}exports[_0xb3fc('0x2b')]=function(_0x41e511,_0x25b952){var _0x552e5a={},_0x457b0e={},_0xa4b63f={'count':0x0,'rows':[]};var _0x217f6e=_[_0xb3fc('0x2c')](db[_0xb3fc('0x2d')][_0xb3fc('0x2e')],function(_0x342843){return{'name':_0x342843['fieldName'],'type':_0x342843[_0xb3fc('0x2f')]['key']};});_0x457b0e['model']=_[_0xb3fc('0x2c')](_0x217f6e,_0xb3fc('0x29'));_0x457b0e['query']=_[_0xb3fc('0x30')](_0x41e511['query']);_0x457b0e['filters']=_['intersection'](_0x457b0e['model'],_0x457b0e[_0xb3fc('0x31')]);_0x552e5a[_0xb3fc('0x32')]=_[_0xb3fc('0x33')](_0x457b0e[_0xb3fc('0x34')],qs['fields'](_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x552e5a[_0xb3fc('0x32')]=_0x552e5a[_0xb3fc('0x32')][_0xb3fc('0x36')]?_0x552e5a[_0xb3fc('0x32')]:_0x457b0e[_0xb3fc('0x34')];if(!_0x41e511['query'][_0xb3fc('0x37')](_0xb3fc('0x38'))){_0x552e5a[_0xb3fc('0x22')]=qs[_0xb3fc('0x22')](_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x22')]);_0x552e5a['offset']=qs[_0xb3fc('0x20')](_0x41e511['query']['offset']);}_0x552e5a[_0xb3fc('0x39')]=qs[_0xb3fc('0x3a')](_0x41e511[_0xb3fc('0x31')]['sort']);_0x552e5a[_0xb3fc('0x3b')]=qs['filters'](_[_0xb3fc('0x3c')](_0x41e511[_0xb3fc('0x31')],_0x457b0e[_0xb3fc('0x3d')]),_0x217f6e);if(_0x41e511['query'][_0xb3fc('0x3e')]){_0x552e5a[_0xb3fc('0x3b')]=_[_0xb3fc('0x3f')](_0x552e5a['where'],{'$or':_[_0xb3fc('0x2c')](_0x217f6e,function(_0x104edc){if(_0x104edc[_0xb3fc('0x2f')]!==_0xb3fc('0x40')){var _0x5393b0={};_0x5393b0[_0x104edc[_0xb3fc('0x29')]]={'$like':'%'+_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x3e')]+'%'};return _0x5393b0;}})});}_0x552e5a=_['merge']({},_0x552e5a,_0x41e511['options']);var _0x2f4f82={'where':_0x552e5a[_0xb3fc('0x3b')]};return db[_0xb3fc('0x2d')][_0xb3fc('0x21')](_0x2f4f82)[_0xb3fc('0x27')](function(_0xb02746){_0xa4b63f[_0xb3fc('0x21')]=_0xb02746;if(_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x41')]){_0x552e5a[_0xb3fc('0x42')]=[{'all':!![]}];}return db[_0xb3fc('0x2d')][_0xb3fc('0x43')](_0x552e5a);})[_0xb3fc('0x27')](function(_0x537473){_0xa4b63f['rows']=_0x537473;return _0xa4b63f;})[_0xb3fc('0x27')](respondWithFilteredResult(_0x25b952,_0x552e5a))[_0xb3fc('0x44')](handleError(_0x25b952,null));};exports[_0xb3fc('0x45')]=function(_0x2252f8,_0x214589){var _0x8fd3bc={'raw':![],'where':{'id':_0x2252f8[_0xb3fc('0x46')]['id']}},_0x51220b={};_0x51220b[_0xb3fc('0x34')]=_['keys'](db[_0xb3fc('0x2d')][_0xb3fc('0x2e')]);_0x51220b[_0xb3fc('0x31')]=_['keys'](_0x2252f8[_0xb3fc('0x31')]);_0x51220b[_0xb3fc('0x3d')]=_[_0xb3fc('0x33')](_0x51220b[_0xb3fc('0x34')],_0x51220b['query']);_0x8fd3bc['attributes']=_[_0xb3fc('0x33')](_0x51220b[_0xb3fc('0x34')],qs['fields'](_0x2252f8[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x8fd3bc[_0xb3fc('0x32')]=_0x8fd3bc[_0xb3fc('0x32')]['length']?_0x8fd3bc[_0xb3fc('0x32')]:_0x51220b['model'];if(_0x2252f8[_0xb3fc('0x31')][_0xb3fc('0x41')]){_0x8fd3bc[_0xb3fc('0x42')]=[{'all':!![]}];}_0x8fd3bc=_[_0xb3fc('0x3f')]({},_0x8fd3bc,_0x2252f8[_0xb3fc('0x47')]);return db['VtigerAccount'][_0xb3fc('0x48')](_0x8fd3bc)['then'](handleEntityNotFound(_0x214589,null))[_0xb3fc('0x27')](respondWithResult(_0x214589,null))[_0xb3fc('0x44')](handleError(_0x214589,null));};exports['create']=function(_0xf68393,_0x30aa95){return db[_0xb3fc('0x2d')]['create'](_0xf68393[_0xb3fc('0x49')],{})[_0xb3fc('0x27')](respondWithResult(_0x30aa95,0xc9))[_0xb3fc('0x44')](handleError(_0x30aa95,null));};exports[_0xb3fc('0x4a')]=function(_0x5aeab5,_0x284477){if(_0x5aeab5[_0xb3fc('0x49')]['id']){delete _0x5aeab5[_0xb3fc('0x49')]['id'];}return db[_0xb3fc('0x2d')]['find']({'where':{'id':_0x5aeab5[_0xb3fc('0x46')]['id']}})[_0xb3fc('0x27')](handleEntityNotFound(_0x284477,null))['then'](saveUpdates(_0x5aeab5['body'],null))[_0xb3fc('0x27')](respondWithResult(_0x284477,null))['catch'](handleError(_0x284477,null));};exports[_0xb3fc('0x4b')]=function(_0x37598f,_0x5bff02){return db[_0xb3fc('0x2d')][_0xb3fc('0x48')]({'where':{'id':_0x37598f[_0xb3fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bff02,null))[_0xb3fc('0x27')](removeEntity(_0x5bff02,null))[_0xb3fc('0x44')](handleError(_0x5bff02,null));};exports['getConfigurations']=function(_0x51cb4c,_0xc0952d,_0x5679dd){var _0x336088={};var _0x36a1c7={};var _0x165bd3;var _0x31b7b8;return db['VtigerAccount']['findOne']({'where':{'id':_0x51cb4c['params']['id']}})['then'](handleEntityNotFound(_0xc0952d,null))[_0xb3fc('0x27')](function(_0x55ab0f){if(_0x55ab0f){_0x165bd3=_0x55ab0f;_0x36a1c7[_0xb3fc('0x34')]=_[_0xb3fc('0x30')](db[_0xb3fc('0x4c')]['rawAttributes']);_0x36a1c7['query']=_[_0xb3fc('0x30')](_0x51cb4c['query']);_0x36a1c7['filters']=_['intersection'](_0x36a1c7[_0xb3fc('0x34')],_0x36a1c7['query']);_0x336088[_0xb3fc('0x32')]=_[_0xb3fc('0x33')](_0x36a1c7[_0xb3fc('0x34')],qs['fields'](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x336088['attributes']=_0x336088[_0xb3fc('0x32')][_0xb3fc('0x36')]?_0x336088[_0xb3fc('0x32')]:_0x36a1c7[_0xb3fc('0x34')];_0x336088[_0xb3fc('0x39')]=qs[_0xb3fc('0x3a')](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x3a')]);_0x336088[_0xb3fc('0x3b')]=qs[_0xb3fc('0x3d')](_[_0xb3fc('0x3c')](_0x51cb4c['query'],_0x36a1c7[_0xb3fc('0x3d')]));if(_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x3e')]){_0x336088[_0xb3fc('0x3b')]=_['merge'](_0x336088['where'],{'$or':_[_0xb3fc('0x2c')](_0x336088[_0xb3fc('0x32')],function(_0x56041c){var _0xad9b05={};_0xad9b05[_0x56041c]={'$like':'%'+_0x51cb4c['query'][_0xb3fc('0x3e')]+'%'};return _0xad9b05;})});}_0x336088=_[_0xb3fc('0x3f')]({},_0x336088,_0x51cb4c[_0xb3fc('0x47')]);return _0x165bd3['getConfigurations'](_0x336088);}})[_0xb3fc('0x27')](function(_0x150baf){if(_0x150baf){_0x31b7b8=_0x150baf[_0xb3fc('0x36')];if(!_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x37')](_0xb3fc('0x38'))){_0x336088[_0xb3fc('0x22')]=qs[_0xb3fc('0x22')](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x22')]);_0x336088[_0xb3fc('0x20')]=qs[_0xb3fc('0x20')](_0x51cb4c[_0xb3fc('0x31')]['offset']);}return _0x165bd3[_0xb3fc('0x4d')](_0x336088);}})[_0xb3fc('0x27')](function(_0x5ad0b8){if(_0x5ad0b8){return _0x5ad0b8?{'count':_0x31b7b8,'rows':_0x5ad0b8}:null;}})[_0xb3fc('0x27')](respondWithResult(_0xc0952d,null))[_0xb3fc('0x44')](handleError(_0xc0952d,null));};exports['addConfiguration']=function(_0x284c0f,_0x476632,_0x5c392f){if(_0x284c0f['body']['id']){delete _0x284c0f[_0xb3fc('0x49')]['id'];}return db['VtigerAccount'][_0xb3fc('0x4e')]({'where':{'id':_0x284c0f['params']['id']}})[_0xb3fc('0x27')](handleEntityNotFound(_0x476632,null))[_0xb3fc('0x27')](function(_0x3ff578){if(_0x3ff578){_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x4f')]=_0x3ff578['id'];_0x284c0f['body'][_0xb3fc('0x50')]=integrations[_0xb3fc('0x51')](_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x52')],_0x284c0f[_0xb3fc('0x49')]['type']);_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x53')]=integrations[_0xb3fc('0x54')](_0x284c0f['body']['channel'],_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x2f')]);return db[_0xb3fc('0x4c')][_0xb3fc('0x55')](_0x284c0f[_0xb3fc('0x49')],{'include':[{'model':db[_0xb3fc('0x56')],'as':_0xb3fc('0x50')},{'model':db[_0xb3fc('0x56')],'as':_0xb3fc('0x53')}]});}return null;})[_0xb3fc('0x27')](respondWithResult(_0x476632,null))['catch'](handleError(_0x476632,null));};var md5=require(_0xb3fc('0x57'));exports[_0xb3fc('0x58')]=function(_0xf28254,_0x298830,_0x5c2e67){var _0x54f171=null;var _0x36ecb0=null;var _0x2837ad=null;var _0x48cd60=null;var _0x3df1a3='';return db[_0xb3fc('0x2d')]['findOne']({'where':{'id':_0xf28254[_0xb3fc('0x46')]['id']},'attributes':['id',_0xb3fc('0x29'),_0xb3fc('0x59'),_0xb3fc('0x5a'),_0xb3fc('0x5b'),'remoteUri',_0xb3fc('0x5c'),_0xb3fc('0x5d')]})['then'](handleEntityNotFound(_0x298830,null))[_0xb3fc('0x27')](function(_0x3f152a){if(_0x3f152a){_0x54f171=_0x3f152a['username'];_0x36ecb0=_0x3f152a[_0xb3fc('0x5d')];_0x2837ad=_0x3f152a['moduleName'];_0x3df1a3=_0x3f152a[_0xb3fc('0x5e')];var _0x1f67ab=_0x3df1a3[_0xb3fc('0x5f')](-0x1);if(_0x1f67ab==='/'){_0x3df1a3=_0x3df1a3[_0xb3fc('0x60')](0x0,_0x3df1a3[_0xb3fc('0x61')](_0x1f67ab));}_0x48cd60=util[_0xb3fc('0x62')](_0xb3fc('0x63'),_0x3df1a3);var _0x2fefac={'method':_0xb3fc('0x64'),'uri':_0x48cd60,'qs':{'operation':'getchallenge','username':_0x3f152a[_0xb3fc('0x59')]},'json':!![]};return rp(_0x2fefac);}})[_0xb3fc('0x27')](function(_0x1c828f){if(_0x1c828f[_0xb3fc('0x65')]){var _0x265ebc={'method':_0xb3fc('0x66'),'uri':_0x48cd60,'form':{'operation':_0xb3fc('0x67'),'username':_0x54f171,'accessKey':md5(_0x1c828f[_0xb3fc('0x68')][_0xb3fc('0x69')]+_0x36ecb0)},'json':!![]};return rp(_0x265ebc);}})[_0xb3fc('0x27')](function(_0x3a10fd){if(_0x3a10fd[_0xb3fc('0x65')]){var _0x590d5b={'method':_0xb3fc('0x64'),'uri':_0x48cd60,'qs':{'operation':_0xb3fc('0x6a'),'username':_0x54f171,'sessionName':_0x3a10fd[_0xb3fc('0x68')][_0xb3fc('0x6b')],'elementType':_0x2837ad},'json':!![]};return rp(_0x590d5b);}})[_0xb3fc('0x27')](function(_0x3c5c00){if(_0x3c5c00['success']){var _0x578a3e=['autogenerated',_0xb3fc('0x6c'),_0xb3fc('0x6d')];_['remove'](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0xdba814){return _0x578a3e[_0xb3fc('0x6e')](_0xdba814[_0xb3fc('0x2f')]['name']);});_[_0xb3fc('0x6f')](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0x5311d4){return _0x5311d4['editable']===_0xb3fc('0x70');});return{'count':_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')][_0xb3fc('0x36')],'rows':_[_0xb3fc('0x2c')](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0x599c7d){return{'id':_0x599c7d['name'],'name':_0x599c7d['label'],'custom':_['startsWith'](_0x599c7d[_0xb3fc('0x29')],_0xb3fc('0x71'))?!![]:![],'options':_0x599c7d['type'][_0xb3fc('0x29')]==='picklist'&&_0x599c7d[_0xb3fc('0x2f')][_0xb3fc('0x72')][_0xb3fc('0x36')]>0x0?_['map'](_0x599c7d[_0xb3fc('0x2f')]['picklistValues'],function(_0x5bdae6){return{'name':_0x5bdae6[_0xb3fc('0x73')],'value':_0x5bdae6['value']};}):[]};})};}})[_0xb3fc('0x27')](respondWithResult(_0x298830,null))[_0xb3fc('0x44')](function(_0x33ceef){console[_0xb3fc('0x74')]('vTiger\x20error:\x20'+_0x33ceef);var _0x54ce14=_0xf28254[_0xb3fc('0x31')]['test']?0x1f4:_0x33ceef['statusCode']||0x1f4;logger[_0xb3fc('0x75')](_0xb3fc('0x76'),_0xb3fc('0x58'),_0x54ce14,JSON[_0xb3fc('0x77')](_0x33ceef));delete _0x33ceef[_0xb3fc('0x29')];if(_0x54ce14===0x191){_0x54ce14=0x190;}_0x298830['status'](_0x54ce14)[_0xb3fc('0x2a')](_0xf28254['query'][_0xb3fc('0x78')]?{'message':_0xb3fc('0x79'),'statusCode':_0x33ceef[_0xb3fc('0x7a')]}:_0x33ceef);});}; \ No newline at end of file +var _0x8f24=['send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','VtigerAccount','includeAll','findAll','rows','catch','params','length','create','body','find','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','success','login','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x260ed8,_0x3fef72){var _0x32657f=function(_0x5a73a6){while(--_0x5a73a6){_0x260ed8['push'](_0x260ed8['shift']());}};_0x32657f(++_0x3fef72);}(_0x8f24,0x77));var _0x48f2=function(_0x30716f,_0x5e3483){_0x30716f=_0x30716f-0x0;var _0x2d545c=_0x8f24[_0x30716f];return _0x2d545c;};'use strict';var emlformat=require(_0x48f2('0x0'));var rimraf=require(_0x48f2('0x1'));var zipdir=require(_0x48f2('0x2'));var jsonpatch=require(_0x48f2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x48f2('0x4'));var util=require(_0x48f2('0x5'));var path=require('path');var sox=require(_0x48f2('0x6'));var csv=require(_0x48f2('0x7'));var ejs=require(_0x48f2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x48f2('0x9'));var jsforce=require(_0x48f2('0xa'));var deskjs=require(_0x48f2('0xb'));var toCsv=require(_0x48f2('0x7'));var querystring=require(_0x48f2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x48f2('0xd'));var qs=require(_0x48f2('0xe'));var as=require(_0x48f2('0xf'));var hardwareService=require(_0x48f2('0x10'));var logger=require(_0x48f2('0x11'))('api');var utils=require(_0x48f2('0x12'));var config=require(_0x48f2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x48f2('0x14'))['db'];var integrations=require(_0x48f2('0x15'));function respondWithStatusCode(_0x49ec0c,_0x1beecd){_0x1beecd=_0x1beecd||0xcc;return function(_0x5553b9){if(_0x5553b9){return _0x49ec0c['sendStatus'](_0x1beecd);}return _0x49ec0c[_0x48f2('0x16')](_0x1beecd)[_0x48f2('0x17')]();};}function respondWithResult(_0x1c763e,_0x4770dc){_0x4770dc=_0x4770dc||0xc8;return function(_0x1513a9){if(_0x1513a9){return _0x1c763e[_0x48f2('0x16')](_0x4770dc)[_0x48f2('0x18')](_0x1513a9);}};}function respondWithFilteredResult(_0x91ac1f,_0x451f8e){return function(_0x385da8){if(_0x385da8){var _0x21c727=typeof _0x451f8e[_0x48f2('0x19')]==='undefined'&&typeof _0x451f8e['limit']==='undefined';var _0x2d59eb=_0x385da8[_0x48f2('0x1a')];var _0x1d4d87=_0x21c727?0x0:_0x451f8e[_0x48f2('0x19')];var _0x19c313=_0x21c727?_0x385da8[_0x48f2('0x1a')]:_0x451f8e[_0x48f2('0x19')]+_0x451f8e['limit'];var _0x3a54b2;if(_0x19c313>=_0x2d59eb){_0x19c313=_0x2d59eb;_0x3a54b2=0xc8;}else{_0x3a54b2=0xce;}_0x91ac1f[_0x48f2('0x16')](_0x3a54b2);return _0x91ac1f[_0x48f2('0x1b')](_0x48f2('0x1c'),_0x1d4d87+'-'+_0x19c313+'/'+_0x2d59eb)['json'](_0x385da8);}return null;};}function patchUpdates(_0x543cf5){return function(_0x260d56){try{jsonpatch['apply'](_0x260d56,_0x543cf5,!![]);}catch(_0x460b0d){return BPromise[_0x48f2('0x1d')](_0x460b0d);}return _0x260d56['save']();};}function saveUpdates(_0x162f15,_0x5a566d){return function(_0x3cfd87){if(_0x3cfd87){return _0x3cfd87[_0x48f2('0x1e')](_0x162f15)[_0x48f2('0x1f')](function(_0x34a5b1){return _0x34a5b1;});}return null;};}function removeEntity(_0x117f2d,_0x1926a9){return function(_0xc1d1ea){if(_0xc1d1ea){return _0xc1d1ea[_0x48f2('0x20')]()[_0x48f2('0x1f')](function(){_0x117f2d[_0x48f2('0x16')](0xcc)[_0x48f2('0x17')]();});}};}function handleEntityNotFound(_0x47b3e1,_0x22f211){return function(_0x2ad301){if(!_0x2ad301){_0x47b3e1[_0x48f2('0x21')](0x194);}return _0x2ad301;};}function handleError(_0xa1d217,_0x5a8e66){_0x5a8e66=_0x5a8e66||0x1f4;return function(_0x156855){logger[_0x48f2('0x22')](_0x156855['stack']);if(_0x156855[_0x48f2('0x23')]){delete _0x156855[_0x48f2('0x23')];}_0xa1d217['status'](_0x5a8e66)['send'](_0x156855);};}exports['index']=function(_0x46afaf,_0x2cf846){var _0x45f2f1={},_0x5c9f26={},_0x32799e={'count':0x0,'rows':[]};var _0x8a2600=_[_0x48f2('0x24')](db['VtigerAccount'][_0x48f2('0x25')],function(_0x249d85){return{'name':_0x249d85[_0x48f2('0x26')],'type':_0x249d85[_0x48f2('0x27')][_0x48f2('0x28')]};});_0x5c9f26[_0x48f2('0x29')]=_[_0x48f2('0x24')](_0x8a2600,_0x48f2('0x23'));_0x5c9f26[_0x48f2('0x2a')]=_[_0x48f2('0x2b')](_0x46afaf[_0x48f2('0x2a')]);_0x5c9f26['filters']=_['intersection'](_0x5c9f26[_0x48f2('0x29')],_0x5c9f26[_0x48f2('0x2a')]);_0x45f2f1[_0x48f2('0x2c')]=_[_0x48f2('0x2d')](_0x5c9f26['model'],qs[_0x48f2('0x2e')](_0x46afaf[_0x48f2('0x2a')][_0x48f2('0x2e')]));_0x45f2f1['attributes']=_0x45f2f1[_0x48f2('0x2c')]['length']?_0x45f2f1[_0x48f2('0x2c')]:_0x5c9f26[_0x48f2('0x29')];if(!_0x46afaf[_0x48f2('0x2a')][_0x48f2('0x2f')](_0x48f2('0x30'))){_0x45f2f1[_0x48f2('0x31')]=qs[_0x48f2('0x31')](_0x46afaf[_0x48f2('0x2a')]['limit']);_0x45f2f1['offset']=qs['offset'](_0x46afaf[_0x48f2('0x2a')][_0x48f2('0x19')]);}_0x45f2f1[_0x48f2('0x32')]=qs['sort'](_0x46afaf[_0x48f2('0x2a')][_0x48f2('0x33')]);_0x45f2f1[_0x48f2('0x34')]=qs[_0x48f2('0x35')](_[_0x48f2('0x36')](_0x46afaf[_0x48f2('0x2a')],_0x5c9f26[_0x48f2('0x35')]),_0x8a2600);if(_0x46afaf[_0x48f2('0x2a')]['filter']){_0x45f2f1[_0x48f2('0x34')]=_[_0x48f2('0x37')](_0x45f2f1[_0x48f2('0x34')],{'$or':_['map'](_0x8a2600,function(_0x3d2c39){if(_0x3d2c39['type']!==_0x48f2('0x38')){var _0x29f504={};_0x29f504[_0x3d2c39[_0x48f2('0x23')]]={'$like':'%'+_0x46afaf['query'][_0x48f2('0x39')]+'%'};return _0x29f504;}})});}_0x45f2f1=_[_0x48f2('0x37')]({},_0x45f2f1,_0x46afaf[_0x48f2('0x3a')]);var _0x2211d8={'where':_0x45f2f1[_0x48f2('0x34')]};return db[_0x48f2('0x3b')][_0x48f2('0x1a')](_0x2211d8)['then'](function(_0x4595d1){_0x32799e[_0x48f2('0x1a')]=_0x4595d1;if(_0x46afaf['query'][_0x48f2('0x3c')]){_0x45f2f1['include']=[{'all':!![]}];}return db[_0x48f2('0x3b')][_0x48f2('0x3d')](_0x45f2f1);})[_0x48f2('0x1f')](function(_0x553677){_0x32799e[_0x48f2('0x3e')]=_0x553677;return _0x32799e;})[_0x48f2('0x1f')](respondWithFilteredResult(_0x2cf846,_0x45f2f1))[_0x48f2('0x3f')](handleError(_0x2cf846,null));};exports['show']=function(_0x294cb4,_0x24e122){var _0x4f1607={'raw':![],'where':{'id':_0x294cb4[_0x48f2('0x40')]['id']}},_0x469dfc={};_0x469dfc['model']=_[_0x48f2('0x2b')](db[_0x48f2('0x3b')][_0x48f2('0x25')]);_0x469dfc['query']=_[_0x48f2('0x2b')](_0x294cb4[_0x48f2('0x2a')]);_0x469dfc[_0x48f2('0x35')]=_['intersection'](_0x469dfc[_0x48f2('0x29')],_0x469dfc[_0x48f2('0x2a')]);_0x4f1607['attributes']=_['intersection'](_0x469dfc['model'],qs[_0x48f2('0x2e')](_0x294cb4['query'][_0x48f2('0x2e')]));_0x4f1607['attributes']=_0x4f1607[_0x48f2('0x2c')][_0x48f2('0x41')]?_0x4f1607[_0x48f2('0x2c')]:_0x469dfc[_0x48f2('0x29')];if(_0x294cb4[_0x48f2('0x2a')][_0x48f2('0x3c')]){_0x4f1607['include']=[{'all':!![]}];}_0x4f1607=_['merge']({},_0x4f1607,_0x294cb4[_0x48f2('0x3a')]);return db[_0x48f2('0x3b')]['find'](_0x4f1607)[_0x48f2('0x1f')](handleEntityNotFound(_0x24e122,null))['then'](respondWithResult(_0x24e122,null))['catch'](handleError(_0x24e122,null));};exports[_0x48f2('0x42')]=function(_0x4ba7b7,_0x29b867){return db['VtigerAccount'][_0x48f2('0x42')](_0x4ba7b7[_0x48f2('0x43')],{})['then'](respondWithResult(_0x29b867,0xc9))[_0x48f2('0x3f')](handleError(_0x29b867,null));};exports[_0x48f2('0x1e')]=function(_0x5f4b5e,_0x5f0fb8){if(_0x5f4b5e[_0x48f2('0x43')]['id']){delete _0x5f4b5e[_0x48f2('0x43')]['id'];}return db[_0x48f2('0x3b')][_0x48f2('0x44')]({'where':{'id':_0x5f4b5e['params']['id']}})[_0x48f2('0x1f')](handleEntityNotFound(_0x5f0fb8,null))[_0x48f2('0x1f')](saveUpdates(_0x5f4b5e[_0x48f2('0x43')],null))[_0x48f2('0x1f')](respondWithResult(_0x5f0fb8,null))[_0x48f2('0x3f')](handleError(_0x5f0fb8,null));};exports[_0x48f2('0x20')]=function(_0x571902,_0x5af26f){return db[_0x48f2('0x3b')]['find']({'where':{'id':_0x571902['params']['id']}})[_0x48f2('0x1f')](handleEntityNotFound(_0x5af26f,null))['then'](removeEntity(_0x5af26f,null))[_0x48f2('0x3f')](handleError(_0x5af26f,null));};exports[_0x48f2('0x45')]=function(_0x3ff20e,_0x4c04f4,_0x465ca1){var _0x5736e7={};var _0x39afdc={};var _0x332a5e;var _0x474280;return db[_0x48f2('0x3b')]['findOne']({'where':{'id':_0x3ff20e[_0x48f2('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c04f4,null))['then'](function(_0x5da30f){if(_0x5da30f){_0x332a5e=_0x5da30f;_0x39afdc[_0x48f2('0x29')]=_[_0x48f2('0x2b')](db['VtigerConfiguration'][_0x48f2('0x25')]);_0x39afdc['query']=_[_0x48f2('0x2b')](_0x3ff20e[_0x48f2('0x2a')]);_0x39afdc['filters']=_[_0x48f2('0x2d')](_0x39afdc[_0x48f2('0x29')],_0x39afdc[_0x48f2('0x2a')]);_0x5736e7['attributes']=_[_0x48f2('0x2d')](_0x39afdc[_0x48f2('0x29')],qs[_0x48f2('0x2e')](_0x3ff20e[_0x48f2('0x2a')]['fields']));_0x5736e7[_0x48f2('0x2c')]=_0x5736e7[_0x48f2('0x2c')][_0x48f2('0x41')]?_0x5736e7[_0x48f2('0x2c')]:_0x39afdc[_0x48f2('0x29')];_0x5736e7[_0x48f2('0x32')]=qs[_0x48f2('0x33')](_0x3ff20e[_0x48f2('0x2a')][_0x48f2('0x33')]);_0x5736e7[_0x48f2('0x34')]=qs[_0x48f2('0x35')](_[_0x48f2('0x36')](_0x3ff20e[_0x48f2('0x2a')],_0x39afdc['filters']));if(_0x3ff20e[_0x48f2('0x2a')]['filter']){_0x5736e7['where']=_[_0x48f2('0x37')](_0x5736e7['where'],{'$or':_['map'](_0x5736e7[_0x48f2('0x2c')],function(_0x3cf8e7){var _0x175b96={};_0x175b96[_0x3cf8e7]={'$like':'%'+_0x3ff20e['query'][_0x48f2('0x39')]+'%'};return _0x175b96;})});}_0x5736e7=_[_0x48f2('0x37')]({},_0x5736e7,_0x3ff20e[_0x48f2('0x3a')]);return _0x332a5e[_0x48f2('0x45')](_0x5736e7);}})['then'](function(_0xcec07a){if(_0xcec07a){_0x474280=_0xcec07a['length'];if(!_0x3ff20e[_0x48f2('0x2a')][_0x48f2('0x2f')]('nolimit')){_0x5736e7['limit']=qs[_0x48f2('0x31')](_0x3ff20e[_0x48f2('0x2a')][_0x48f2('0x31')]);_0x5736e7[_0x48f2('0x19')]=qs[_0x48f2('0x19')](_0x3ff20e[_0x48f2('0x2a')][_0x48f2('0x19')]);}return _0x332a5e[_0x48f2('0x45')](_0x5736e7);}})[_0x48f2('0x1f')](function(_0x158693){if(_0x158693){return _0x158693?{'count':_0x474280,'rows':_0x158693}:null;}})[_0x48f2('0x1f')](respondWithResult(_0x4c04f4,null))[_0x48f2('0x3f')](handleError(_0x4c04f4,null));};exports[_0x48f2('0x46')]=function(_0x45529d,_0x3e3798,_0x592c8e){if(_0x45529d[_0x48f2('0x43')]['id']){delete _0x45529d['body']['id'];}return db[_0x48f2('0x3b')][_0x48f2('0x47')]({'where':{'id':_0x45529d['params']['id']}})[_0x48f2('0x1f')](handleEntityNotFound(_0x3e3798,null))[_0x48f2('0x1f')](function(_0x43865b){if(_0x43865b){_0x45529d[_0x48f2('0x43')]['AccountId']=_0x43865b['id'];_0x45529d[_0x48f2('0x43')][_0x48f2('0x48')]=integrations[_0x48f2('0x49')](_0x45529d[_0x48f2('0x43')][_0x48f2('0x4a')],_0x45529d['body'][_0x48f2('0x27')]);_0x45529d[_0x48f2('0x43')]['Descriptions']=integrations['getDescriptions'](_0x45529d[_0x48f2('0x43')]['channel'],_0x45529d[_0x48f2('0x43')][_0x48f2('0x27')]);return db[_0x48f2('0x4b')][_0x48f2('0x42')](_0x45529d[_0x48f2('0x43')],{'include':[{'model':db[_0x48f2('0x4c')],'as':'Subjects'},{'model':db[_0x48f2('0x4c')],'as':_0x48f2('0x4d')}]});}return null;})[_0x48f2('0x1f')](respondWithResult(_0x3e3798,null))[_0x48f2('0x3f')](handleError(_0x3e3798,null));};var md5=require(_0x48f2('0x4e'));exports[_0x48f2('0x4f')]=function(_0x47a557,_0x5826f7,_0x3934e6){var _0xa20912=null;var _0x32fdd9=null;var _0x66eb76=null;var _0x1149ee=null;var _0x259e38='';return db[_0x48f2('0x3b')]['findOne']({'where':{'id':_0x47a557[_0x48f2('0x40')]['id']},'attributes':['id',_0x48f2('0x23'),_0x48f2('0x50'),_0x48f2('0x51'),_0x48f2('0x52'),_0x48f2('0x53'),_0x48f2('0x54'),'accessKey']})['then'](handleEntityNotFound(_0x5826f7,null))[_0x48f2('0x1f')](function(_0x3aa18a){if(_0x3aa18a){_0xa20912=_0x3aa18a[_0x48f2('0x50')];_0x32fdd9=_0x3aa18a[_0x48f2('0x55')];_0x66eb76=_0x3aa18a[_0x48f2('0x52')];_0x259e38=_0x3aa18a[_0x48f2('0x53')];var _0x21cdec=_0x259e38[_0x48f2('0x56')](-0x1);if(_0x21cdec==='/'){_0x259e38=_0x259e38[_0x48f2('0x57')](0x0,_0x259e38[_0x48f2('0x58')](_0x21cdec));}_0x1149ee=util[_0x48f2('0x59')]('%s/webservice.php',_0x259e38);var _0x1baf9c={'method':_0x48f2('0x5a'),'uri':_0x1149ee,'qs':{'operation':_0x48f2('0x5b'),'username':_0x3aa18a[_0x48f2('0x50')]},'json':!![]};return rp(_0x1baf9c);}})[_0x48f2('0x1f')](function(_0x107f58){if(_0x107f58[_0x48f2('0x5c')]){var _0x3675b2={'method':'POST','uri':_0x1149ee,'form':{'operation':_0x48f2('0x5d'),'username':_0xa20912,'accessKey':md5(_0x107f58[_0x48f2('0x5e')]['token']+_0x32fdd9)},'json':!![]};return rp(_0x3675b2);}})[_0x48f2('0x1f')](function(_0x1dae8e){if(_0x1dae8e['success']){var _0x25339d={'method':_0x48f2('0x5a'),'uri':_0x1149ee,'qs':{'operation':_0x48f2('0x5f'),'username':_0xa20912,'sessionName':_0x1dae8e[_0x48f2('0x5e')][_0x48f2('0x60')],'elementType':_0x66eb76},'json':!![]};return rp(_0x25339d);}})[_0x48f2('0x1f')](function(_0x309c03){if(_0x309c03[_0x48f2('0x5c')]){var _0x60c9b7=[_0x48f2('0x61'),_0x48f2('0x62'),_0x48f2('0x63')];_[_0x48f2('0x64')](_0x309c03['result'][_0x48f2('0x2e')],function(_0x5589d8){return _0x60c9b7[_0x48f2('0x65')](_0x5589d8[_0x48f2('0x27')]['name']);});_[_0x48f2('0x64')](_0x309c03[_0x48f2('0x5e')][_0x48f2('0x2e')],function(_0x375c62){return _0x375c62[_0x48f2('0x66')]===_0x48f2('0x67');});return{'count':_0x309c03[_0x48f2('0x5e')][_0x48f2('0x2e')][_0x48f2('0x41')],'rows':_[_0x48f2('0x24')](_0x309c03[_0x48f2('0x5e')][_0x48f2('0x2e')],function(_0x2ace8c){return{'id':_0x2ace8c[_0x48f2('0x23')],'name':_0x2ace8c[_0x48f2('0x68')],'custom':_['startsWith'](_0x2ace8c[_0x48f2('0x23')],_0x48f2('0x69'))?!![]:![],'options':_0x2ace8c['type']['name']===_0x48f2('0x6a')&&_0x2ace8c['type'][_0x48f2('0x6b')]['length']>0x0?_[_0x48f2('0x24')](_0x2ace8c['type'][_0x48f2('0x6b')],function(_0x51633a){return{'name':_0x51633a[_0x48f2('0x68')],'value':_0x51633a[_0x48f2('0x6c')]};}):[]};})};}})[_0x48f2('0x1f')](respondWithResult(_0x5826f7,null))[_0x48f2('0x3f')](function(_0x243185){console[_0x48f2('0x6d')](_0x48f2('0x6e')+_0x243185);var _0x4173a9=_0x47a557[_0x48f2('0x2a')]['test']?0x1f4:_0x243185['statusCode']||0x1f4;logger['error'](_0x48f2('0x6f'),'getFields',_0x4173a9,JSON[_0x48f2('0x70')](_0x243185));delete _0x243185[_0x48f2('0x23')];if(_0x4173a9===0x191){_0x4173a9=0x190;}_0x5826f7['status'](_0x4173a9)[_0x48f2('0x71')](_0x47a557[_0x48f2('0x2a')]['test']?{'message':_0x48f2('0x72'),'statusCode':_0x243185[_0x48f2('0x73')]}:_0x243185);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d2449b1..dbf700a 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 _0x1e31=['define','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0xe2a525,_0x1739f7){var _0x3df847=function(_0x1f391e){while(--_0x1f391e){_0xe2a525['push'](_0xe2a525['shift']());}};_0x3df847(++_0x1739f7);}(_0x1e31,0x162));var _0x11e3=function(_0x360aac,_0xd96009){_0x360aac=_0x360aac-0x0;var _0x5826fd=_0x1e31[_0x360aac];return _0x5826fd;};'use strict';var _=require('lodash');var util=require(_0x11e3('0x0'));var logger=require(_0x11e3('0x1'))(_0x11e3('0x2'));var moment=require('moment');var BPromise=require(_0x11e3('0x3'));var rp=require(_0x11e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11e3('0x5'));var config=require(_0x11e3('0x6'));var attributes=require(_0x11e3('0x7'));var integrations=require(_0x11e3('0x8'));module['exports']=function(_0x18934e,_0x29873d){return _0x18934e[_0x11e3('0x9')]('VtigerAccount',attributes,{'tableName':_0x11e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ddc=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3ddc,0x110));var _0xc3dd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3ddc[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xc3dd('0x0'));var util=require(_0xc3dd('0x1'));var logger=require(_0xc3dd('0x2'))(_0xc3dd('0x3'));var moment=require(_0xc3dd('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3dd('0x5'));var fs=require('fs');var path=require(_0xc3dd('0x6'));var rimraf=require(_0xc3dd('0x7'));var config=require(_0xc3dd('0x8'));var attributes=require(_0xc3dd('0x9'));var integrations=require(_0xc3dd('0xa'));module[_0xc3dd('0xb')]=function(_0x382010,_0x3b9a76){return _0x382010[_0xc3dd('0xc')](_0xc3dd('0xd'),attributes,{'tableName':_0xc3dd('0xe'),'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 06a03e9..7255b54 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 _0xcf66=['raw','where','attributes','limit','include','map','model','info','ShowVtigerAccount','find','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x2dde25,_0x36aa4b){var _0x4da423=function(_0x49061f){while(--_0x49061f){_0x2dde25['push'](_0x2dde25['shift']());}};_0x4da423(++_0x36aa4b);}(_0xcf66,0x71));var _0x6cf6=function(_0x33b48d,_0x24bbcf){_0x33b48d=_0x33b48d-0x0;var _0xe97860=_0xcf66[_0x33b48d];return _0xe97860;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['findAll']({'raw':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x17')]===undefined?!![]:![]:!![],'where':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1['options'][_0x6cf6('0x19')]||null:null,'limit':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1a')]||null:null,'include':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x2ca2b1['options']['include'],function(_0x276225){return{'model':db[_0x276225['model']],'as':_0x276225['as'],'attributes':_0x276225[_0x6cf6('0x19')],'include':_0x276225[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x276225[_0x6cf6('0x1b')],function(_0x3f9871){return{'model':db[_0x3f9871[_0x6cf6('0x1d')]],'as':_0x3f9871['as'],'attributes':_0x3f9871[_0x6cf6('0x19')],'include':_0x3f9871['include']?_[_0x6cf6('0x1c')](_0x3f9871[_0x6cf6('0x1b')],function(_0x3eaa31){return{'model':db[_0x3eaa31['model']],'as':_0x3eaa31['as'],'attributes':_0x3eaa31[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x2224db){logger[_0x6cf6('0x1e')]('GetVtigerAccount',_0x2ca2b1);logger['debug'](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x2224db));_0x11d994(_0x2224db);})[_0x6cf6('0x13')](function(_0x5869e9){logger['error'](_0x6cf6('0x14'),_0x5869e9['message'],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5869e9['message']));});});};exports[_0x6cf6('0x1f')]=function(_0x65433){var _0x33d308=this;return new Promise(function(_0x42f488,_0x11c848){return db['VtigerAccount'][_0x6cf6('0x20')]({'raw':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x19')]||null:null,'include':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')],function(_0x4620b6){return{'model':db[_0x4620b6[_0x6cf6('0x1d')]],'as':_0x4620b6['as'],'attributes':_0x4620b6[_0x6cf6('0x19')],'include':_0x4620b6[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x4620b6[_0x6cf6('0x1b')],function(_0x5cc6cd){return{'model':db[_0x5cc6cd[_0x6cf6('0x1d')]],'as':_0x5cc6cd['as'],'attributes':_0x5cc6cd[_0x6cf6('0x19')],'include':_0x5cc6cd[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x5cc6cd[_0x6cf6('0x1b')],function(_0x2cf3a3){return{'model':db[_0x2cf3a3[_0x6cf6('0x1d')]],'as':_0x2cf3a3['as'],'attributes':_0x2cf3a3[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x3718a1){logger[_0x6cf6('0x1e')]('ShowVtigerAccount',_0x65433);logger[_0x6cf6('0x21')](_0x6cf6('0x1f'),_0x65433,JSON[_0x6cf6('0xe')](_0x3718a1));_0x42f488(_0x3718a1);})[_0x6cf6('0x13')](function(_0x31c822){logger[_0x6cf6('0xf')](_0x6cf6('0x1f'),_0x31c822[_0x6cf6('0x11')],_0x65433);_0x11c848(_0x33d308[_0x6cf6('0xf')](0x1f4,_0x31c822['message']));});});}; \ No newline at end of file +var _0xd64b=['include','map','model','then','ShowVtigerAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','where','attributes'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xd64b,0xc1));var _0xbd64=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0xd64b[_0x2f8a7c];return _0x257e01;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});}exports[_0xbd64('0x13')]=function(_0x1d7a14){var _0x17d015=this;return new Promise(function(_0x2f4554,_0xa5491d){return db[_0xbd64('0x14')]['findAll']({'raw':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d7a14['options']?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x16')]||null:null,'attributes':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x17')]||null:null,'limit':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14['options']['limit']||null:null,'include':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x1d7a14['options']['include'],function(_0x28497c){return{'model':db[_0x28497c['model']],'as':_0x28497c['as'],'attributes':_0x28497c[_0xbd64('0x17')],'include':_0x28497c['include']?_[_0xbd64('0x19')](_0x28497c[_0xbd64('0x18')],function(_0x3d12a0){return{'model':db[_0x3d12a0[_0xbd64('0x1a')]],'as':_0x3d12a0['as'],'attributes':_0x3d12a0['attributes'],'include':_0x3d12a0[_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x3d12a0[_0xbd64('0x18')],function(_0x2a44d0){return{'model':db[_0x2a44d0['model']],'as':_0x2a44d0['as'],'attributes':_0x2a44d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd64('0x1b')](function(_0x49eac5){logger['info'](_0xbd64('0x13'),_0x1d7a14);logger['debug'](_0xbd64('0x13'),_0x1d7a14,JSON['stringify'](_0x49eac5));_0x2f4554(_0x49eac5);})[_0xbd64('0x12')](function(_0x5d8c35){logger[_0xbd64('0xe')](_0xbd64('0x13'),_0x5d8c35[_0xbd64('0x10')],_0x1d7a14);_0xa5491d(_0x17d015[_0xbd64('0xe')](0x1f4,_0x5d8c35[_0xbd64('0x10')]));});});};exports[_0xbd64('0x1c')]=function(_0x4ed44a){var _0x35bdd5=this;return new Promise(function(_0xe876c9,_0xc44280){return db[_0xbd64('0x14')][_0xbd64('0x1d')]({'raw':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options'][_0xbd64('0x16')]||null:null,'attributes':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['attributes']||null:null,'include':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['include']?_[_0xbd64('0x19')](_0x4ed44a[_0xbd64('0x15')][_0xbd64('0x18')],function(_0x50c58e){return{'model':db[_0x50c58e[_0xbd64('0x1a')]],'as':_0x50c58e['as'],'attributes':_0x50c58e['attributes'],'include':_0x50c58e[_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x50c58e[_0xbd64('0x18')],function(_0x243588){return{'model':db[_0x243588[_0xbd64('0x1a')]],'as':_0x243588['as'],'attributes':_0x243588[_0xbd64('0x17')],'include':_0x243588['include']?_['map'](_0x243588[_0xbd64('0x18')],function(_0x2be110){return{'model':db[_0x2be110[_0xbd64('0x1a')]],'as':_0x2be110['as'],'attributes':_0x2be110[_0xbd64('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbd64('0x1b')](function(_0x3b245e){logger['info']('ShowVtigerAccount',_0x4ed44a);logger[_0xbd64('0x1e')](_0xbd64('0x1c'),_0x4ed44a,JSON[_0xbd64('0xd')](_0x3b245e));_0xe876c9(_0x3b245e);})['catch'](function(_0x5afe9b){logger[_0xbd64('0xe')]('ShowVtigerAccount',_0x5afe9b[_0xbd64('0x10')],_0x4ed44a);_0xc44280(_0x35bdd5['error'](0x1f4,_0x5afe9b[_0xbd64('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b84cb97..d7c956c 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 _0x3efb=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x4bf628,_0x2a0ebd){var _0x542e6f=function(_0x13dd4f){while(--_0x13dd4f){_0x4bf628['push'](_0x4bf628['shift']());}};_0x542e6f(++_0x2a0ebd);}(_0x3efb,0xd7));var _0xb3ef=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x3efb[_0x52666e];return _0x515330;};'use strict';var multer=require(_0xb3ef('0x0'));var util=require(_0xb3ef('0x1'));var path=require(_0xb3ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3ef('0x3'));var router=express['Router']();var fs_extra=require(_0xb3ef('0x4'));var auth=require(_0xb3ef('0x5'));var interaction=require(_0xb3ef('0x6'));var config=require(_0xb3ef('0x7'));var controller=require(_0xb3ef('0x8'));router[_0xb3ef('0x9')]('/',auth[_0xb3ef('0xa')](),controller['index']);router['get']('/:id',auth[_0xb3ef('0xa')](),controller[_0xb3ef('0xb')]);router[_0xb3ef('0x9')](_0xb3ef('0xc'),auth[_0xb3ef('0xa')](),controller['getFields']);router['get'](_0xb3ef('0xd'),auth['isAuthenticated'](),controller[_0xb3ef('0xe')]);router[_0xb3ef('0x9')](_0xb3ef('0xf'),auth['isAuthenticated'](),controller[_0xb3ef('0x10')]);router[_0xb3ef('0x11')]('/',auth['isAuthenticated'](),controller[_0xb3ef('0x12')]);router[_0xb3ef('0x13')](_0xb3ef('0x14'),auth['isAuthenticated'](),controller[_0xb3ef('0x15')]);router['delete'](_0xb3ef('0x14'),auth[_0xb3ef('0xa')](),controller['destroy']);module[_0xb3ef('0x16')]=router; \ No newline at end of file +var _0xb3b4=['update','destroy','multer','path','connect-timeout','Router','fs-extra','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xb3b4,0x1e5));var _0x4b3b=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb3b4[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x4b3b('0x0'));var util=require('util');var path=require(_0x4b3b('0x1'));var timeout=require(_0x4b3b('0x2'));var express=require('express');var router=express[_0x4b3b('0x3')]();var fs_extra=require(_0x4b3b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x4b3b('0x5')]('/',auth[_0x4b3b('0x6')](),controller[_0x4b3b('0x7')]);router['get']('/:id',auth[_0x4b3b('0x6')](),controller[_0x4b3b('0x8')]);router['get'](_0x4b3b('0x9'),auth['isAuthenticated'](),controller[_0x4b3b('0xa')]);router['get'](_0x4b3b('0xb'),auth[_0x4b3b('0x6')](),controller[_0x4b3b('0xc')]);router[_0x4b3b('0x5')](_0x4b3b('0xd'),auth[_0x4b3b('0x6')](),controller[_0x4b3b('0xe')]);router[_0x4b3b('0xf')]('/',auth[_0x4b3b('0x6')](),controller[_0x4b3b('0x10')]);router[_0x4b3b('0x11')](_0x4b3b('0x12'),auth[_0x4b3b('0x6')](),controller[_0x4b3b('0x13')]);router['delete'](_0x4b3b('0x12'),auth[_0x4b3b('0x6')](),controller[_0x4b3b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e23ae71..320f2e5 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 _0x8884=['sequelize','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8884,0x19a));var _0x4888=function(_0x2cbac6,_0x3b32bd){_0x2cbac6=_0x2cbac6-0x0;var _0x1709a8=_0x8884[_0x2cbac6];return _0x1709a8;};'use strict';var Sequelize=require(_0x4888('0x0'));module['exports']={'name':{'type':Sequelize[_0x4888('0x1')]},'description':{'type':Sequelize[_0x4888('0x1')]}}; \ No newline at end of file +var _0xeccc=['exports','STRING'];(function(_0x4fa5af,_0x1cea32){var _0x1abaca=function(_0x41e049){while(--_0x41e049){_0x4fa5af['push'](_0x4fa5af['shift']());}};_0x1abaca(++_0x1cea32);}(_0xeccc,0x104));var _0xcecc=function(_0x5e5b5e,_0x1d4bde){_0x5e5b5e=_0x5e5b5e-0x0;var _0x296489=_0xeccc[_0x5e5b5e];return _0x296489;};'use strict';var Sequelize=require('sequelize');module[_0xcecc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcecc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0f55b5c..6699f27 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 _0x5912=['rawAttributes','fieldName','key','model','map','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','create','body','find','getFields','VtigerField','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','VtigerConfiguration'];(function(_0x1b6c41,_0x56c974){var _0x3cde58=function(_0x24b471){while(--_0x24b471){_0x1b6c41['push'](_0x1b6c41['shift']());}};_0x3cde58(++_0x56c974);}(_0x5912,0x1cf));var _0x2591=function(_0x3af64a,_0x3d87d5){_0x3af64a=_0x3af64a-0x0;var _0x284090=_0x5912[_0x3af64a];return _0x284090;};'use strict';var emlformat=require(_0x2591('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2591('0x1'));var jsonpatch=require(_0x2591('0x2'));var rp=require(_0x2591('0x3'));var moment=require(_0x2591('0x4'));var BPromise=require(_0x2591('0x5'));var Mustache=require(_0x2591('0x6'));var util=require(_0x2591('0x7'));var path=require('path');var sox=require(_0x2591('0x8'));var csv=require(_0x2591('0x9'));var ejs=require(_0x2591('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2591('0xb'));var squel=require(_0x2591('0xc'));var crypto=require(_0x2591('0xd'));var jsforce=require(_0x2591('0xe'));var deskjs=require(_0x2591('0xf'));var toCsv=require(_0x2591('0x9'));var querystring=require(_0x2591('0x10'));var Papa=require(_0x2591('0x11'));var Redis=require(_0x2591('0x12'));var authService=require(_0x2591('0x13'));var qs=require(_0x2591('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2591('0x15'));var logger=require('../../config/logger')(_0x2591('0x16'));var utils=require(_0x2591('0x17'));var config=require(_0x2591('0x18'));var licenseUtil=require(_0x2591('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x350931,_0x5628bd){_0x5628bd=_0x5628bd||0xcc;return function(_0x477566){if(_0x477566){return _0x350931['sendStatus'](_0x5628bd);}return _0x350931['status'](_0x5628bd)['end']();};}function respondWithResult(_0x561d0b,_0x4eeeb4){_0x4eeeb4=_0x4eeeb4||0xc8;return function(_0x3a381e){if(_0x3a381e){return _0x561d0b[_0x2591('0x1a')](_0x4eeeb4)[_0x2591('0x1b')](_0x3a381e);}};}function respondWithFilteredResult(_0x3df208,_0x2a401f){return function(_0x3547e7){if(_0x3547e7){var _0x1ae634=typeof _0x2a401f[_0x2591('0x1c')]===_0x2591('0x1d')&&typeof _0x2a401f[_0x2591('0x1e')]===_0x2591('0x1d');var _0x4db830=_0x3547e7[_0x2591('0x1f')];var _0x3ca143=_0x1ae634?0x0:_0x2a401f['offset'];var _0x2299e4=_0x1ae634?_0x3547e7[_0x2591('0x1f')]:_0x2a401f[_0x2591('0x1c')]+_0x2a401f['limit'];var _0x9ecd9a;if(_0x2299e4>=_0x4db830){_0x2299e4=_0x4db830;_0x9ecd9a=0xc8;}else{_0x9ecd9a=0xce;}_0x3df208[_0x2591('0x1a')](_0x9ecd9a);return _0x3df208[_0x2591('0x20')](_0x2591('0x21'),_0x3ca143+'-'+_0x2299e4+'/'+_0x4db830)[_0x2591('0x1b')](_0x3547e7);}return null;};}function patchUpdates(_0xd7fbb0){return function(_0x42a7b4){try{jsonpatch[_0x2591('0x22')](_0x42a7b4,_0xd7fbb0,!![]);}catch(_0x476970){return BPromise[_0x2591('0x23')](_0x476970);}return _0x42a7b4[_0x2591('0x24')]();};}function saveUpdates(_0x56de62,_0xc1e8ea){return function(_0x20fe2b){if(_0x20fe2b){return _0x20fe2b[_0x2591('0x25')](_0x56de62)[_0x2591('0x26')](function(_0x2a2eeb){return _0x2a2eeb;});}return null;};}function removeEntity(_0x1b8ebf,_0x3909a0){return function(_0x427c73){if(_0x427c73){return _0x427c73[_0x2591('0x27')]()[_0x2591('0x26')](function(){_0x1b8ebf[_0x2591('0x1a')](0xcc)[_0x2591('0x28')]();});}};}function handleEntityNotFound(_0x166334,_0x43c646){return function(_0x3db34){if(!_0x3db34){_0x166334[_0x2591('0x29')](0x194);}return _0x3db34;};}function handleError(_0x33f415,_0x2b7f52){_0x2b7f52=_0x2b7f52||0x1f4;return function(_0x3c427e){logger[_0x2591('0x2a')](_0x3c427e[_0x2591('0x2b')]);if(_0x3c427e[_0x2591('0x2c')]){delete _0x3c427e[_0x2591('0x2c')];}_0x33f415['status'](_0x2b7f52)[_0x2591('0x2d')](_0x3c427e);};}exports['index']=function(_0xa966c0,_0x219101){var _0x2b1b92={},_0x5a4e89={},_0x49cc30={'count':0x0,'rows':[]};var _0xf10ec2=_['map'](db[_0x2591('0x2e')][_0x2591('0x2f')],function(_0x3d30d5){return{'name':_0x3d30d5[_0x2591('0x30')],'type':_0x3d30d5['type'][_0x2591('0x31')]};});_0x5a4e89[_0x2591('0x32')]=_[_0x2591('0x33')](_0xf10ec2,'name');_0x5a4e89['query']=_['keys'](_0xa966c0['query']);_0x5a4e89[_0x2591('0x34')]=_[_0x2591('0x35')](_0x5a4e89['model'],_0x5a4e89[_0x2591('0x36')]);_0x2b1b92[_0x2591('0x37')]=_[_0x2591('0x35')](_0x5a4e89['model'],qs[_0x2591('0x38')](_0xa966c0[_0x2591('0x36')][_0x2591('0x38')]));_0x2b1b92['attributes']=_0x2b1b92[_0x2591('0x37')]['length']?_0x2b1b92['attributes']:_0x5a4e89[_0x2591('0x32')];if(!_0xa966c0[_0x2591('0x36')]['hasOwnProperty'](_0x2591('0x39'))){_0x2b1b92[_0x2591('0x1e')]=qs['limit'](_0xa966c0['query']['limit']);_0x2b1b92[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0xa966c0[_0x2591('0x36')][_0x2591('0x1c')]);}_0x2b1b92[_0x2591('0x3a')]=qs[_0x2591('0x3b')](_0xa966c0[_0x2591('0x36')][_0x2591('0x3b')]);_0x2b1b92[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0xa966c0[_0x2591('0x36')],_0x5a4e89[_0x2591('0x34')]),_0xf10ec2);if(_0xa966c0[_0x2591('0x36')][_0x2591('0x3e')]){_0x2b1b92[_0x2591('0x3c')]=_['merge'](_0x2b1b92[_0x2591('0x3c')],{'$or':_[_0x2591('0x33')](_0xf10ec2,function(_0x351115){if(_0x351115[_0x2591('0x3f')]!==_0x2591('0x40')){var _0x34008e={};_0x34008e[_0x351115[_0x2591('0x2c')]]={'$like':'%'+_0xa966c0[_0x2591('0x36')]['filter']+'%'};return _0x34008e;}})});}_0x2b1b92=_['merge']({},_0x2b1b92,_0xa966c0[_0x2591('0x41')]);var _0xdafeca={'where':_0x2b1b92['where']};return db[_0x2591('0x2e')][_0x2591('0x1f')](_0xdafeca)[_0x2591('0x26')](function(_0x2cf095){_0x49cc30[_0x2591('0x1f')]=_0x2cf095;if(_0xa966c0['query'][_0x2591('0x42')]){_0x2b1b92[_0x2591('0x43')]=[{'all':!![]}];}return db[_0x2591('0x2e')][_0x2591('0x44')](_0x2b1b92);})[_0x2591('0x26')](function(_0x52d89e){_0x49cc30[_0x2591('0x45')]=_0x52d89e;return _0x49cc30;})[_0x2591('0x26')](respondWithFilteredResult(_0x219101,_0x2b1b92))[_0x2591('0x46')](handleError(_0x219101,null));};exports[_0x2591('0x47')]=function(_0x24be2a,_0x3c92b9){var _0x59bab9={'raw':![],'where':{'id':_0x24be2a[_0x2591('0x48')]['id']}},_0x328f05={};_0x328f05[_0x2591('0x32')]=_[_0x2591('0x49')](db['VtigerConfiguration'][_0x2591('0x2f')]);_0x328f05[_0x2591('0x36')]=_['keys'](_0x24be2a[_0x2591('0x36')]);_0x328f05[_0x2591('0x34')]=_[_0x2591('0x35')](_0x328f05[_0x2591('0x32')],_0x328f05[_0x2591('0x36')]);_0x59bab9['attributes']=_[_0x2591('0x35')](_0x328f05[_0x2591('0x32')],qs[_0x2591('0x38')](_0x24be2a['query'][_0x2591('0x38')]));_0x59bab9['attributes']=_0x59bab9[_0x2591('0x37')][_0x2591('0x4a')]?_0x59bab9[_0x2591('0x37')]:_0x328f05['model'];if(_0x24be2a['query'][_0x2591('0x42')]){_0x59bab9[_0x2591('0x43')]=[{'all':!![]}];}_0x59bab9=_[_0x2591('0x4b')]({},_0x59bab9,_0x24be2a[_0x2591('0x41')]);return db[_0x2591('0x2e')]['find'](_0x59bab9)['then'](handleEntityNotFound(_0x3c92b9,null))['then'](respondWithResult(_0x3c92b9,null))[_0x2591('0x46')](handleError(_0x3c92b9,null));};exports[_0x2591('0x4c')]=function(_0x4c80bc,_0x8ddf08){return db[_0x2591('0x2e')][_0x2591('0x4c')](_0x4c80bc[_0x2591('0x4d')],{})[_0x2591('0x26')](respondWithResult(_0x8ddf08,0xc9))[_0x2591('0x46')](handleError(_0x8ddf08,null));};exports[_0x2591('0x25')]=function(_0x24b902,_0x1427d7){if(_0x24b902['body']['id']){delete _0x24b902[_0x2591('0x4d')]['id'];}return db[_0x2591('0x2e')][_0x2591('0x4e')]({'where':{'id':_0x24b902['params']['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x1427d7,null))[_0x2591('0x26')](saveUpdates(_0x24b902[_0x2591('0x4d')],null))[_0x2591('0x26')](respondWithResult(_0x1427d7,null))[_0x2591('0x46')](handleError(_0x1427d7,null));};exports[_0x2591('0x27')]=function(_0x9fa239,_0x5032ed){return db[_0x2591('0x2e')][_0x2591('0x4e')]({'where':{'id':_0x9fa239['params']['id']}})['then'](handleEntityNotFound(_0x5032ed,null))[_0x2591('0x26')](removeEntity(_0x5032ed,null))[_0x2591('0x46')](handleError(_0x5032ed,null));};exports[_0x2591('0x4f')]=function(_0x4f71e4,_0x1a6013,_0x4293ee){var _0x64ab93={};var _0x17625e={};var _0x1d4a20;var _0x56117d;return db[_0x2591('0x2e')]['findOne']({'where':{'id':_0x4f71e4[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x1a6013,null))[_0x2591('0x26')](function(_0x5e9547){if(_0x5e9547){_0x1d4a20=_0x5e9547;_0x17625e[_0x2591('0x32')]=_['keys'](db[_0x2591('0x50')][_0x2591('0x2f')]);_0x17625e['query']=_[_0x2591('0x49')](_0x4f71e4['query']);_0x17625e[_0x2591('0x34')]=_['intersection'](_0x17625e[_0x2591('0x32')],_0x17625e['query']);_0x64ab93[_0x2591('0x37')]=_[_0x2591('0x35')](_0x17625e[_0x2591('0x32')],qs['fields'](_0x4f71e4['query'][_0x2591('0x38')]));_0x64ab93[_0x2591('0x37')]=_0x64ab93['attributes']['length']?_0x64ab93['attributes']:_0x17625e[_0x2591('0x32')];_0x64ab93[_0x2591('0x3a')]=qs[_0x2591('0x3b')](_0x4f71e4['query']['sort']);_0x64ab93['where']=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x4f71e4[_0x2591('0x36')],_0x17625e[_0x2591('0x34')]));if(_0x4f71e4[_0x2591('0x36')][_0x2591('0x3e')]){_0x64ab93[_0x2591('0x3c')]=_[_0x2591('0x4b')](_0x64ab93[_0x2591('0x3c')],{'$or':_[_0x2591('0x33')](_0x64ab93[_0x2591('0x37')],function(_0x23c591){var _0xd7f4c3={};_0xd7f4c3[_0x23c591]={'$like':'%'+_0x4f71e4[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0xd7f4c3;})});}_0x64ab93=_[_0x2591('0x4b')]({},_0x64ab93,_0x4f71e4['options']);return _0x1d4a20['getFields'](_0x64ab93);}})[_0x2591('0x26')](function(_0xfb10b9){if(_0xfb10b9){_0x56117d=_0xfb10b9[_0x2591('0x4a')];if(!_0x4f71e4['query'][_0x2591('0x51')](_0x2591('0x39'))){_0x64ab93['limit']=qs[_0x2591('0x1e')](_0x4f71e4['query'][_0x2591('0x1e')]);_0x64ab93[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0x4f71e4[_0x2591('0x36')]['offset']);}return _0x1d4a20[_0x2591('0x4f')](_0x64ab93);}})['then'](function(_0x4cf3d8){if(_0x4cf3d8){return _0x4cf3d8?{'count':_0x56117d,'rows':_0x4cf3d8}:null;}})['then'](respondWithResult(_0x1a6013,null))['catch'](handleError(_0x1a6013,null));};exports['getSubjects']=function(_0x43e06e,_0x36ac7e,_0x9ffd7f){var _0x2d6dcc={};var _0x3eb6c2={};var _0x47f5ac;var _0x5ce74d;return db['VtigerConfiguration'][_0x2591('0x52')]({'where':{'id':_0x43e06e[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x36ac7e,null))[_0x2591('0x26')](function(_0x3acc7d){if(_0x3acc7d){_0x47f5ac=_0x3acc7d;_0x3eb6c2[_0x2591('0x32')]=_[_0x2591('0x49')](db[_0x2591('0x50')][_0x2591('0x2f')]);_0x3eb6c2['query']=_[_0x2591('0x49')](_0x43e06e[_0x2591('0x36')]);_0x3eb6c2[_0x2591('0x34')]=_['intersection'](_0x3eb6c2[_0x2591('0x32')],_0x3eb6c2[_0x2591('0x36')]);_0x2d6dcc[_0x2591('0x37')]=_['intersection'](_0x3eb6c2[_0x2591('0x32')],qs[_0x2591('0x38')](_0x43e06e[_0x2591('0x36')][_0x2591('0x38')]));_0x2d6dcc['attributes']=_0x2d6dcc['attributes'][_0x2591('0x4a')]?_0x2d6dcc[_0x2591('0x37')]:_0x3eb6c2[_0x2591('0x32')];_0x2d6dcc[_0x2591('0x3a')]=qs['sort'](_0x43e06e['query'][_0x2591('0x3b')]);_0x2d6dcc[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x43e06e[_0x2591('0x36')],_0x3eb6c2[_0x2591('0x34')]));if(_0x43e06e['query'][_0x2591('0x3e')]){_0x2d6dcc['where']=_[_0x2591('0x4b')](_0x2d6dcc['where'],{'$or':_[_0x2591('0x33')](_0x2d6dcc['attributes'],function(_0x382108){var _0x1a5276={};_0x1a5276[_0x382108]={'$like':'%'+_0x43e06e[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0x1a5276;})});}_0x2d6dcc=_[_0x2591('0x4b')]({},_0x2d6dcc,_0x43e06e['options']);return _0x47f5ac[_0x2591('0x53')](_0x2d6dcc);}})['then'](function(_0x1f0ff7){if(_0x1f0ff7){_0x5ce74d=_0x1f0ff7['length'];if(!_0x43e06e[_0x2591('0x36')][_0x2591('0x51')](_0x2591('0x39'))){_0x2d6dcc['limit']=qs[_0x2591('0x1e')](_0x43e06e[_0x2591('0x36')]['limit']);_0x2d6dcc['offset']=qs[_0x2591('0x1c')](_0x43e06e[_0x2591('0x36')]['offset']);}return _0x47f5ac[_0x2591('0x53')](_0x2d6dcc);}})[_0x2591('0x26')](function(_0x48cae6){if(_0x48cae6){return _0x48cae6?{'count':_0x5ce74d,'rows':_0x48cae6}:null;}})['then'](respondWithResult(_0x36ac7e,null))[_0x2591('0x46')](handleError(_0x36ac7e,null));};exports[_0x2591('0x54')]=function(_0x3e90a8,_0x5c2ac6,_0x2c4841){var _0xf21699={};var _0x36d4d6={};var _0x376db2;var _0x29589d;return db[_0x2591('0x2e')][_0x2591('0x52')]({'where':{'id':_0x3e90a8[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x5c2ac6,null))[_0x2591('0x26')](function(_0x2b8fe8){if(_0x2b8fe8){_0x376db2=_0x2b8fe8;_0x36d4d6[_0x2591('0x32')]=_['keys'](db[_0x2591('0x50')]['rawAttributes']);_0x36d4d6[_0x2591('0x36')]=_[_0x2591('0x49')](_0x3e90a8[_0x2591('0x36')]);_0x36d4d6[_0x2591('0x34')]=_[_0x2591('0x35')](_0x36d4d6['model'],_0x36d4d6[_0x2591('0x36')]);_0xf21699[_0x2591('0x37')]=_[_0x2591('0x35')](_0x36d4d6[_0x2591('0x32')],qs[_0x2591('0x38')](_0x3e90a8['query'][_0x2591('0x38')]));_0xf21699['attributes']=_0xf21699[_0x2591('0x37')][_0x2591('0x4a')]?_0xf21699['attributes']:_0x36d4d6[_0x2591('0x32')];_0xf21699['order']=qs[_0x2591('0x3b')](_0x3e90a8['query'][_0x2591('0x3b')]);_0xf21699[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x3e90a8[_0x2591('0x36')],_0x36d4d6[_0x2591('0x34')]));if(_0x3e90a8[_0x2591('0x36')][_0x2591('0x3e')]){_0xf21699[_0x2591('0x3c')]=_['merge'](_0xf21699['where'],{'$or':_[_0x2591('0x33')](_0xf21699[_0x2591('0x37')],function(_0xc1f6a9){var _0x26ae08={};_0x26ae08[_0xc1f6a9]={'$like':'%'+_0x3e90a8[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0x26ae08;})});}_0xf21699=_[_0x2591('0x4b')]({},_0xf21699,_0x3e90a8[_0x2591('0x41')]);return _0x376db2[_0x2591('0x54')](_0xf21699);}})[_0x2591('0x26')](function(_0x438dc8){if(_0x438dc8){_0x29589d=_0x438dc8['length'];if(!_0x3e90a8[_0x2591('0x36')][_0x2591('0x51')](_0x2591('0x39'))){_0xf21699['limit']=qs[_0x2591('0x1e')](_0x3e90a8['query'][_0x2591('0x1e')]);_0xf21699[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0x3e90a8[_0x2591('0x36')][_0x2591('0x1c')]);}return _0x376db2[_0x2591('0x54')](_0xf21699);}})[_0x2591('0x26')](function(_0x1dd25e){if(_0x1dd25e){return _0x1dd25e?{'count':_0x29589d,'rows':_0x1dd25e}:null;}})['then'](respondWithResult(_0x5c2ac6,null))[_0x2591('0x46')](handleError(_0x5c2ac6,null));}; \ No newline at end of file +var _0xf591=['../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x120ab8,_0x577eb9){var _0x597e51=function(_0x165bf4){while(--_0x165bf4){_0x120ab8['push'](_0x120ab8['shift']());}};_0x597e51(++_0x577eb9);}(_0xf591,0x128));var _0x1f59=function(_0x5c036b,_0x39fd65){_0x5c036b=_0x5c036b-0x0;var _0x1b27b1=_0xf591[_0x5c036b];return _0x1b27b1;};'use strict';var emlformat=require(_0x1f59('0x0'));var rimraf=require(_0x1f59('0x1'));var zipdir=require(_0x1f59('0x2'));var jsonpatch=require(_0x1f59('0x3'));var rp=require('request-promise');var moment=require(_0x1f59('0x4'));var BPromise=require(_0x1f59('0x5'));var Mustache=require(_0x1f59('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1f59('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f59('0x8'));var squel=require(_0x1f59('0x9'));var crypto=require(_0x1f59('0xa'));var jsforce=require(_0x1f59('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f59('0xc'));var Redis=require(_0x1f59('0xd'));var authService=require(_0x1f59('0xe'));var qs=require(_0x1f59('0xf'));var as=require(_0x1f59('0x10'));var hardwareService=require(_0x1f59('0x11'));var logger=require('../../config/logger')(_0x1f59('0x12'));var utils=require(_0x1f59('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1f59('0x14'));var db=require(_0x1f59('0x15'))['db'];function respondWithStatusCode(_0x4589d3,_0x7e0f18){_0x7e0f18=_0x7e0f18||0xcc;return function(_0x344c3a){if(_0x344c3a){return _0x4589d3[_0x1f59('0x16')](_0x7e0f18);}return _0x4589d3['status'](_0x7e0f18)['end']();};}function respondWithResult(_0x1c4a63,_0x2cb7bd){_0x2cb7bd=_0x2cb7bd||0xc8;return function(_0x20451d){if(_0x20451d){return _0x1c4a63[_0x1f59('0x17')](_0x2cb7bd)[_0x1f59('0x18')](_0x20451d);}};}function respondWithFilteredResult(_0x46f016,_0x3afe4b){return function(_0x267c4c){if(_0x267c4c){var _0x6ff8e=typeof _0x3afe4b['offset']==='undefined'&&typeof _0x3afe4b[_0x1f59('0x19')]==='undefined';var _0x1360b8=_0x267c4c[_0x1f59('0x1a')];var _0x1ced8c=_0x6ff8e?0x0:_0x3afe4b[_0x1f59('0x1b')];var _0x2bfcf0=_0x6ff8e?_0x267c4c['count']:_0x3afe4b[_0x1f59('0x1b')]+_0x3afe4b[_0x1f59('0x19')];var _0x265093;if(_0x2bfcf0>=_0x1360b8){_0x2bfcf0=_0x1360b8;_0x265093=0xc8;}else{_0x265093=0xce;}_0x46f016[_0x1f59('0x17')](_0x265093);return _0x46f016[_0x1f59('0x1c')](_0x1f59('0x1d'),_0x1ced8c+'-'+_0x2bfcf0+'/'+_0x1360b8)[_0x1f59('0x18')](_0x267c4c);}return null;};}function patchUpdates(_0x3e821e){return function(_0x5ae10d){try{jsonpatch[_0x1f59('0x1e')](_0x5ae10d,_0x3e821e,!![]);}catch(_0x1e0495){return BPromise[_0x1f59('0x1f')](_0x1e0495);}return _0x5ae10d[_0x1f59('0x20')]();};}function saveUpdates(_0x3005a8,_0xbf0fd0){return function(_0x535bcc){if(_0x535bcc){return _0x535bcc['update'](_0x3005a8)[_0x1f59('0x21')](function(_0x3ec938){return _0x3ec938;});}return null;};}function removeEntity(_0x485b9d,_0x1b8c3f){return function(_0x4d4bdc){if(_0x4d4bdc){return _0x4d4bdc[_0x1f59('0x22')]()['then'](function(){_0x485b9d[_0x1f59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19337d,_0x949f4f){return function(_0x181e80){if(!_0x181e80){_0x19337d[_0x1f59('0x16')](0x194);}return _0x181e80;};}function handleError(_0x460019,_0x15a65d){_0x15a65d=_0x15a65d||0x1f4;return function(_0x5256b8){logger[_0x1f59('0x23')](_0x5256b8[_0x1f59('0x24')]);if(_0x5256b8['name']){delete _0x5256b8[_0x1f59('0x25')];}_0x460019[_0x1f59('0x17')](_0x15a65d)[_0x1f59('0x26')](_0x5256b8);};}exports[_0x1f59('0x27')]=function(_0x56f778,_0x296642){var _0x4cdc23={},_0x1604dc={},_0x433a81={'count':0x0,'rows':[]};var _0x36fd78=_['map'](db[_0x1f59('0x28')][_0x1f59('0x29')],function(_0x1edc07){return{'name':_0x1edc07[_0x1f59('0x2a')],'type':_0x1edc07[_0x1f59('0x2b')][_0x1f59('0x2c')]};});_0x1604dc[_0x1f59('0x2d')]=_[_0x1f59('0x2e')](_0x36fd78,_0x1f59('0x25'));_0x1604dc['query']=_[_0x1f59('0x2f')](_0x56f778['query']);_0x1604dc[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x1604dc[_0x1f59('0x2d')],_0x1604dc[_0x1f59('0x32')]);_0x4cdc23[_0x1f59('0x33')]=_['intersection'](_0x1604dc[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x34')]));_0x4cdc23[_0x1f59('0x33')]=_0x4cdc23[_0x1f59('0x33')][_0x1f59('0x35')]?_0x4cdc23[_0x1f59('0x33')]:_0x1604dc[_0x1f59('0x2d')];if(!_0x56f778[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x4cdc23[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x19')]);_0x4cdc23[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x56f778['query'][_0x1f59('0x1b')]);}_0x4cdc23[_0x1f59('0x38')]=qs[_0x1f59('0x39')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x39')]);_0x4cdc23[_0x1f59('0x3a')]=qs[_0x1f59('0x30')](_['pick'](_0x56f778[_0x1f59('0x32')],_0x1604dc[_0x1f59('0x30')]),_0x36fd78);if(_0x56f778[_0x1f59('0x32')]['filter']){_0x4cdc23[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x4cdc23[_0x1f59('0x3a')],{'$or':_['map'](_0x36fd78,function(_0x356cd4){if(_0x356cd4[_0x1f59('0x2b')]!==_0x1f59('0x3c')){var _0x28df18={};_0x28df18[_0x356cd4['name']]={'$like':'%'+_0x56f778['query'][_0x1f59('0x3d')]+'%'};return _0x28df18;}})});}_0x4cdc23=_[_0x1f59('0x3b')]({},_0x4cdc23,_0x56f778[_0x1f59('0x3e')]);var _0x9cc3f1={'where':_0x4cdc23[_0x1f59('0x3a')]};return db[_0x1f59('0x28')][_0x1f59('0x1a')](_0x9cc3f1)[_0x1f59('0x21')](function(_0xe9cf98){_0x433a81['count']=_0xe9cf98;if(_0x56f778[_0x1f59('0x32')]['includeAll']){_0x4cdc23['include']=[{'all':!![]}];}return db[_0x1f59('0x28')][_0x1f59('0x3f')](_0x4cdc23);})['then'](function(_0x5839c1){_0x433a81[_0x1f59('0x40')]=_0x5839c1;return _0x433a81;})['then'](respondWithFilteredResult(_0x296642,_0x4cdc23))[_0x1f59('0x41')](handleError(_0x296642,null));};exports[_0x1f59('0x42')]=function(_0x10913f,_0x52a004){var _0x3db0cd={'raw':![],'where':{'id':_0x10913f[_0x1f59('0x43')]['id']}},_0x2b538e={};_0x2b538e[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db['VtigerConfiguration'][_0x1f59('0x29')]);_0x2b538e[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x10913f['query']);_0x2b538e[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x2b538e[_0x1f59('0x2d')],_0x2b538e[_0x1f59('0x32')]);_0x3db0cd['attributes']=_[_0x1f59('0x31')](_0x2b538e['model'],qs[_0x1f59('0x34')](_0x10913f[_0x1f59('0x32')]['fields']));_0x3db0cd[_0x1f59('0x33')]=_0x3db0cd[_0x1f59('0x33')][_0x1f59('0x35')]?_0x3db0cd[_0x1f59('0x33')]:_0x2b538e[_0x1f59('0x2d')];if(_0x10913f[_0x1f59('0x32')][_0x1f59('0x44')]){_0x3db0cd[_0x1f59('0x45')]=[{'all':!![]}];}_0x3db0cd=_['merge']({},_0x3db0cd,_0x10913f[_0x1f59('0x3e')]);return db[_0x1f59('0x28')][_0x1f59('0x46')](_0x3db0cd)[_0x1f59('0x21')](handleEntityNotFound(_0x52a004,null))[_0x1f59('0x21')](respondWithResult(_0x52a004,null))[_0x1f59('0x41')](handleError(_0x52a004,null));};exports[_0x1f59('0x47')]=function(_0x1f3e5e,_0x5074cf){return db[_0x1f59('0x28')][_0x1f59('0x47')](_0x1f3e5e[_0x1f59('0x48')],{})['then'](respondWithResult(_0x5074cf,0xc9))[_0x1f59('0x41')](handleError(_0x5074cf,null));};exports['update']=function(_0x1bbae3,_0x55eb38){if(_0x1bbae3[_0x1f59('0x48')]['id']){delete _0x1bbae3['body']['id'];}return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x1bbae3[_0x1f59('0x43')]['id']}})['then'](handleEntityNotFound(_0x55eb38,null))[_0x1f59('0x21')](saveUpdates(_0x1bbae3['body'],null))[_0x1f59('0x21')](respondWithResult(_0x55eb38,null))[_0x1f59('0x41')](handleError(_0x55eb38,null));};exports[_0x1f59('0x22')]=function(_0x39bb95,_0x3f3d9d){return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x39bb95['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x3f3d9d,null))[_0x1f59('0x21')](removeEntity(_0x3f3d9d,null))[_0x1f59('0x41')](handleError(_0x3f3d9d,null));};exports[_0x1f59('0x49')]=function(_0x2d0b21,_0xa50352,_0x5f36d0){var _0x459a5f={};var _0x3c3068={};var _0x51147f;var _0x5b757a;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0x2d0b21['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0xa50352,null))[_0x1f59('0x21')](function(_0x2430eb){if(_0x2430eb){_0x51147f=_0x2430eb;_0x3c3068[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x3c3068[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x2d0b21[_0x1f59('0x32')]);_0x3c3068['filters']=_[_0x1f59('0x31')](_0x3c3068[_0x1f59('0x2d')],_0x3c3068['query']);_0x459a5f[_0x1f59('0x33')]=_[_0x1f59('0x31')](_0x3c3068['model'],qs['fields'](_0x2d0b21['query']['fields']));_0x459a5f[_0x1f59('0x33')]=_0x459a5f[_0x1f59('0x33')][_0x1f59('0x35')]?_0x459a5f['attributes']:_0x3c3068[_0x1f59('0x2d')];_0x459a5f['order']=qs[_0x1f59('0x39')](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x39')]);_0x459a5f['where']=qs['filters'](_[_0x1f59('0x4c')](_0x2d0b21[_0x1f59('0x32')],_0x3c3068[_0x1f59('0x30')]));if(_0x2d0b21['query'][_0x1f59('0x3d')]){_0x459a5f[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x459a5f[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x459a5f[_0x1f59('0x33')],function(_0x218a36){var _0x3fd418={};_0x3fd418[_0x218a36]={'$like':'%'+_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x3fd418;})});}_0x459a5f=_[_0x1f59('0x3b')]({},_0x459a5f,_0x2d0b21[_0x1f59('0x3e')]);return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})['then'](function(_0x3fc86f){if(_0x3fc86f){_0x5b757a=_0x3fc86f[_0x1f59('0x35')];if(!_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x459a5f[_0x1f59('0x19')]=qs['limit'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x19')]);_0x459a5f[_0x1f59('0x1b')]=qs['offset'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})[_0x1f59('0x21')](function(_0x4b7844){if(_0x4b7844){return _0x4b7844?{'count':_0x5b757a,'rows':_0x4b7844}:null;}})[_0x1f59('0x21')](respondWithResult(_0xa50352,null))[_0x1f59('0x41')](handleError(_0xa50352,null));};exports[_0x1f59('0x4d')]=function(_0xc483ec,_0x51389e,_0x127c3d){var _0x3a2b0a={};var _0x2d6636={};var _0xaeae17;var _0x107a82;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0xc483ec[_0x1f59('0x43')]['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x51389e,null))['then'](function(_0x5aea4d){if(_0x5aea4d){_0xaeae17=_0x5aea4d;_0x2d6636['model']=_[_0x1f59('0x2f')](db['VtigerField']['rawAttributes']);_0x2d6636[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0xc483ec[_0x1f59('0x32')]);_0x2d6636['filters']=_['intersection'](_0x2d6636[_0x1f59('0x2d')],_0x2d6636[_0x1f59('0x32')]);_0x3a2b0a['attributes']=_[_0x1f59('0x31')](_0x2d6636[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0xc483ec[_0x1f59('0x32')]['fields']));_0x3a2b0a[_0x1f59('0x33')]=_0x3a2b0a['attributes'][_0x1f59('0x35')]?_0x3a2b0a['attributes']:_0x2d6636[_0x1f59('0x2d')];_0x3a2b0a[_0x1f59('0x38')]=qs['sort'](_0xc483ec[_0x1f59('0x32')][_0x1f59('0x39')]);_0x3a2b0a[_0x1f59('0x3a')]=qs['filters'](_[_0x1f59('0x4c')](_0xc483ec['query'],_0x2d6636[_0x1f59('0x30')]));if(_0xc483ec['query']['filter']){_0x3a2b0a[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x3a2b0a[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x3a2b0a[_0x1f59('0x33')],function(_0x181689){var _0x266c2d={};_0x266c2d[_0x181689]={'$like':'%'+_0xc483ec[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x266c2d;})});}_0x3a2b0a=_['merge']({},_0x3a2b0a,_0xc483ec[_0x1f59('0x3e')]);return _0xaeae17[_0x1f59('0x4d')](_0x3a2b0a);}})['then'](function(_0x3f69e4){if(_0x3f69e4){_0x107a82=_0x3f69e4[_0x1f59('0x35')];if(!_0xc483ec['query']['hasOwnProperty']('nolimit')){_0x3a2b0a[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0xc483ec[_0x1f59('0x32')]['limit']);_0x3a2b0a['offset']=qs['offset'](_0xc483ec[_0x1f59('0x32')]['offset']);}return _0xaeae17['getSubjects'](_0x3a2b0a);}})[_0x1f59('0x21')](function(_0x43d788){if(_0x43d788){return _0x43d788?{'count':_0x107a82,'rows':_0x43d788}:null;}})[_0x1f59('0x21')](respondWithResult(_0x51389e,null))[_0x1f59('0x41')](handleError(_0x51389e,null));};exports['getDescriptions']=function(_0x4c32e8,_0x19c7c6,_0x53f9b6){var _0x35d58e={};var _0x1858a3={};var _0x576e34;var _0x2cf653;return db[_0x1f59('0x28')]['findOne']({'where':{'id':_0x4c32e8['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x19c7c6,null))['then'](function(_0x1bfff0){if(_0x1bfff0){_0x576e34=_0x1bfff0;_0x1858a3[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x1858a3[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x4c32e8[_0x1f59('0x32')]);_0x1858a3['filters']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],_0x1858a3[_0x1f59('0x32')]);_0x35d58e['attributes']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],qs['fields'](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x34')]));_0x35d58e[_0x1f59('0x33')]=_0x35d58e[_0x1f59('0x33')]['length']?_0x35d58e[_0x1f59('0x33')]:_0x1858a3[_0x1f59('0x2d')];_0x35d58e['order']=qs[_0x1f59('0x39')](_0x4c32e8['query'][_0x1f59('0x39')]);_0x35d58e['where']=qs[_0x1f59('0x30')](_[_0x1f59('0x4c')](_0x4c32e8['query'],_0x1858a3[_0x1f59('0x30')]));if(_0x4c32e8['query']['filter']){_0x35d58e['where']=_['merge'](_0x35d58e[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x35d58e[_0x1f59('0x33')],function(_0x1c1f09){var _0x4f6858={};_0x4f6858[_0x1c1f09]={'$like':'%'+_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x4f6858;})});}_0x35d58e=_[_0x1f59('0x3b')]({},_0x35d58e,_0x4c32e8[_0x1f59('0x3e')]);return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x4c1684){if(_0x4c1684){_0x2cf653=_0x4c1684['length'];if(!_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x35d58e[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x19')]);_0x35d58e[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x494792){if(_0x494792){return _0x494792?{'count':_0x2cf653,'rows':_0x494792}:null;}})[_0x1f59('0x21')](respondWithResult(_0x19c7c6,null))[_0x1f59('0x41')](handleError(_0x19c7c6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b948486..41867fc 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 _0xfdfe=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0xac7ce0,_0x3b60ea){var _0x1f6cdf=function(_0x6196f4){while(--_0x6196f4){_0xac7ce0['push'](_0xac7ce0['shift']());}};_0x1f6cdf(++_0x3b60ea);}(_0xfdfe,0x10e));var _0xefdf=function(_0x30bdf6,_0x1a3d52){_0x30bdf6=_0x30bdf6-0x0;var _0x38ad01=_0xfdfe[_0x30bdf6];return _0x38ad01;};'use strict';var _=require(_0xefdf('0x0'));var util=require(_0xefdf('0x1'));var logger=require(_0xefdf('0x2'))(_0xefdf('0x3'));var moment=require(_0xefdf('0x4'));var BPromise=require('bluebird');var rp=require(_0xefdf('0x5'));var fs=require('fs');var path=require(_0xefdf('0x6'));var rimraf=require(_0xefdf('0x7'));var config=require(_0xefdf('0x8'));var attributes=require(_0xefdf('0x9'));module[_0xefdf('0xa')]=function(_0x100aeb,_0x5e92af){return _0x100aeb[_0xefdf('0xb')](_0xefdf('0xc'),attributes,{'tableName':_0xefdf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a95=['moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger'];(function(_0x2521d6,_0x4a9644){var _0x3bce04=function(_0x3d31c3){while(--_0x3d31c3){_0x2521d6['push'](_0x2521d6['shift']());}};_0x3bce04(++_0x4a9644);}(_0x8a95,0x1ad));var _0x58a9=function(_0x5a1f2d,_0x207962){_0x5a1f2d=_0x5a1f2d-0x0;var _0x3194bc=_0x8a95[_0x5a1f2d];return _0x3194bc;};'use strict';var _=require(_0x58a9('0x0'));var util=require(_0x58a9('0x1'));var logger=require(_0x58a9('0x2'))('api');var moment=require(_0x58a9('0x3'));var BPromise=require(_0x58a9('0x4'));var rp=require(_0x58a9('0x5'));var fs=require('fs');var path=require(_0x58a9('0x6'));var rimraf=require(_0x58a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x58a9('0x8'));module[_0x58a9('0x9')]=function(_0x2e10a7,_0x410416){return _0x2e10a7[_0x58a9('0xa')](_0x58a9('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index e75dc5e..452e775 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 _0x0d54=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4c9818,_0xe14396){var _0x46ce76=function(_0xa6c574){while(--_0xa6c574){_0x4c9818['push'](_0x4c9818['shift']());}};_0x46ce76(++_0xe14396);}(_0x0d54,0x160));var _0x40d5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0d54[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x40d5('0x0'));var util=require(_0x40d5('0x1'));var moment=require(_0x40d5('0x2'));var BPromise=require(_0x40d5('0x3'));var rs=require(_0x40d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40d5('0x5'))['db'];var utils=require(_0x40d5('0x6'));var logger=require(_0x40d5('0x7'))(_0x40d5('0x8'));var config=require(_0x40d5('0x9'));var jayson=require(_0x40d5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x741de6,_0x10ac4d,_0x32b7b3){return new BPromise(function(_0x30ce82,_0x4428a3){return client[_0x40d5('0xb')](_0x741de6,_0x32b7b3)[_0x40d5('0xc')](function(_0x59ccc7){logger[_0x40d5('0xd')](_0x40d5('0xe'),_0x10ac4d,_0x40d5('0xf'));logger[_0x40d5('0x10')](_0x40d5('0x11'),_0x10ac4d,_0x40d5('0xf'),JSON[_0x40d5('0x12')](_0x59ccc7));if(_0x59ccc7[_0x40d5('0x13')]){if(_0x59ccc7[_0x40d5('0x13')]['code']===0x1f4){logger[_0x40d5('0x13')](_0x40d5('0xe'),_0x10ac4d,_0x59ccc7[_0x40d5('0x13')][_0x40d5('0x14')]);return _0x4428a3(_0x59ccc7['error'][_0x40d5('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x10ac4d,_0x59ccc7['error'][_0x40d5('0x14')]);return _0x30ce82(_0x59ccc7[_0x40d5('0x13')][_0x40d5('0x14')]);}else{logger[_0x40d5('0xd')](_0x40d5('0xe'),_0x10ac4d,_0x40d5('0xf'));_0x30ce82(_0x59ccc7['result'][_0x40d5('0x14')]);}})[_0x40d5('0x15')](function(_0x45ce9a){logger[_0x40d5('0x13')](_0x40d5('0xe'),_0x10ac4d,_0x45ce9a);_0x4428a3(_0x45ce9a);});});} \ No newline at end of file +var _0xd282=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x28f394,_0x4f6fc5){var _0x7c1395=function(_0x2c4a29){while(--_0x2c4a29){_0x28f394['push'](_0x28f394['shift']());}};_0x7c1395(++_0x4f6fc5);}(_0xd282,0x11c));var _0x2d28=function(_0x4bb969,_0x41e27a){_0x4bb969=_0x4bb969-0x0;var _0x5c8857=_0xd282[_0x4bb969];return _0x5c8857;};'use strict';var _=require(_0x2d28('0x0'));var util=require(_0x2d28('0x1'));var moment=require(_0x2d28('0x2'));var BPromise=require(_0x2d28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d28('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d28('0x5'))(_0x2d28('0x6'));var config=require(_0x2d28('0x7'));var jayson=require(_0x2d28('0x8'));var client=jayson[_0x2d28('0x9')][_0x2d28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x330187,_0x21e63e,_0x3a5e18){return new BPromise(function(_0x5220d3,_0x10c490){return client[_0x2d28('0xb')](_0x330187,_0x3a5e18)[_0x2d28('0xc')](function(_0x105fbb){logger['info'](_0x2d28('0xd'),_0x21e63e,_0x2d28('0xe'));logger[_0x2d28('0xf')](_0x2d28('0x10'),_0x21e63e,'request\x20sent',JSON[_0x2d28('0x11')](_0x105fbb));if(_0x105fbb[_0x2d28('0x12')]){if(_0x105fbb['error']['code']===0x1f4){logger[_0x2d28('0x12')](_0x2d28('0xd'),_0x21e63e,_0x105fbb[_0x2d28('0x12')][_0x2d28('0x13')]);return _0x10c490(_0x105fbb[_0x2d28('0x12')]['message']);}logger[_0x2d28('0x12')](_0x2d28('0xd'),_0x21e63e,_0x105fbb[_0x2d28('0x12')][_0x2d28('0x13')]);return _0x5220d3(_0x105fbb[_0x2d28('0x12')][_0x2d28('0x13')]);}else{logger[_0x2d28('0x14')](_0x2d28('0xd'),_0x21e63e,_0x2d28('0xe'));_0x5220d3(_0x105fbb[_0x2d28('0x15')][_0x2d28('0x13')]);}})[_0x2d28('0x16')](function(_0x5921dd){logger[_0x2d28('0x12')](_0x2d28('0xd'),_0x21e63e,_0x5921dd);_0x10c490(_0x5921dd);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7b86a78..d3ebdf1 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 _0x8924=['fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8924,0x1c6));var _0x4892=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x8924[_0x208749];return _0x3e0042;};'use strict';var multer=require(_0x4892('0x0'));var util=require(_0x4892('0x1'));var path=require(_0x4892('0x2'));var timeout=require(_0x4892('0x3'));var express=require('express');var router=express[_0x4892('0x4')]();var fs_extra=require(_0x4892('0x5'));var auth=require(_0x4892('0x6'));var interaction=require(_0x4892('0x7'));var config=require('../../config/environment');var controller=require(_0x4892('0x8'));router['get']('/',auth[_0x4892('0x9')](),controller['index']);router[_0x4892('0xa')]('/:id',auth[_0x4892('0x9')](),controller[_0x4892('0xb')]);router[_0x4892('0xc')]('/',auth[_0x4892('0x9')](),controller['create']);router[_0x4892('0xd')](_0x4892('0xe'),auth[_0x4892('0x9')](),controller[_0x4892('0xf')]);router[_0x4892('0x10')](_0x4892('0xe'),auth[_0x4892('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6569=['put','/:id','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','post'];(function(_0x1230d5,_0x947375){var _0x29c11d=function(_0x3f5d2e){while(--_0x3f5d2e){_0x1230d5['push'](_0x1230d5['shift']());}};_0x29c11d(++_0x947375);}(_0x6569,0x76));var _0x9656=function(_0x2b47a0,_0x167c88){_0x2b47a0=_0x2b47a0-0x0;var _0x253aeb=_0x6569[_0x2b47a0];return _0x253aeb;};'use strict';var multer=require('multer');var util=require(_0x9656('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9656('0x1'));var router=express[_0x9656('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9656('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9656('0x4'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x9656('0x5')](),controller['index']);router[_0x9656('0x6')]('/:id',auth[_0x9656('0x5')](),controller['show']);router[_0x9656('0x7')]('/',auth[_0x9656('0x5')](),controller['create']);router[_0x9656('0x8')](_0x9656('0x9'),auth['isAuthenticated'](),controller[_0x9656('0xa')]);router[_0x9656('0xb')](_0x9656('0x9'),auth[_0x9656('0x5')](),controller[_0x9656('0xc')]);module[_0x9656('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 1010baf..c91fa74 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 _0x64c2=['variable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0xb912f0,_0x3b6133){var _0x4923d6=function(_0x4f7634){while(--_0x4f7634){_0xb912f0['push'](_0xb912f0['shift']());}};_0x4923d6(++_0x3b6133);}(_0x64c2,0x124));var _0x264c=function(_0x35096e,_0x1ef66d){_0x35096e=_0x35096e-0x0;var _0xfe9f23=_0x64c2[_0x35096e];return _0xfe9f23;};'use strict';var Sequelize=require(_0x264c('0x0'));module[_0x264c('0x1')]={'type':{'type':Sequelize[_0x264c('0x2')](_0x264c('0x3'),_0x264c('0x4'),'customVariable','keyValue',_0x264c('0x5')),'defaultValue':_0x264c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x264c('0x6')]},'keyType':{'type':Sequelize[_0x264c('0x2')](_0x264c('0x3'),_0x264c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x264c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x264c('0x6')]},'customField':{'type':Sequelize[_0x264c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb20=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x513bc2,_0x177da2){var _0x1e14c7=function(_0x1a66e5){while(--_0x1a66e5){_0x513bc2['push'](_0x513bc2['shift']());}};_0x1e14c7(++_0x177da2);}(_0xcb20,0x1c7));var _0x0cb2=function(_0x313da6,_0x4bebea){_0x313da6=_0x313da6-0x0;var _0x119946=_0xcb20[_0x313da6];return _0x119946;};'use strict';var Sequelize=require(_0x0cb2('0x0'));module['exports']={'type':{'type':Sequelize[_0x0cb2('0x1')](_0x0cb2('0x2'),_0x0cb2('0x3'),_0x0cb2('0x4'),_0x0cb2('0x5'),_0x0cb2('0x6')),'defaultValue':_0x0cb2('0x2')},'content':{'type':Sequelize[_0x0cb2('0x7')]},'key':{'type':Sequelize[_0x0cb2('0x7')]},'keyType':{'type':Sequelize[_0x0cb2('0x1')](_0x0cb2('0x2'),_0x0cb2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0cb2('0x7')]},'idField':{'type':Sequelize[_0x0cb2('0x7')]},'nameField':{'type':Sequelize[_0x0cb2('0x7')]},'customField':{'type':Sequelize[_0x0cb2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cb2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 47d400e..9e88a31 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 _0x6620=['show','rawAttributes','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','destroy','name','send','index','map','VtigerField','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x6620,0x123));var _0x0662=function(_0x3b1715,_0x2f8c36){_0x3b1715=_0x3b1715-0x0;var _0x96600d=_0x6620[_0x3b1715];return _0x96600d;};'use strict';var emlformat=require(_0x0662('0x0'));var rimraf=require(_0x0662('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0662('0x2'));var rp=require(_0x0662('0x3'));var moment=require('moment');var BPromise=require(_0x0662('0x4'));var Mustache=require(_0x0662('0x5'));var util=require(_0x0662('0x6'));var path=require(_0x0662('0x7'));var sox=require(_0x0662('0x8'));var csv=require(_0x0662('0x9'));var ejs=require(_0x0662('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0662('0xb'));var squel=require(_0x0662('0xc'));var crypto=require(_0x0662('0xd'));var jsforce=require(_0x0662('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0662('0xf'));var Papa=require(_0x0662('0x10'));var Redis=require('ioredis');var authService=require(_0x0662('0x11'));var qs=require(_0x0662('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0662('0x13'))(_0x0662('0x14'));var utils=require('../../config/utils');var config=require(_0x0662('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0662('0x16'))['db'];function respondWithStatusCode(_0x36636c,_0x31405f){_0x31405f=_0x31405f||0xcc;return function(_0x295aee){if(_0x295aee){return _0x36636c[_0x0662('0x17')](_0x31405f);}return _0x36636c['status'](_0x31405f)[_0x0662('0x18')]();};}function respondWithResult(_0x2751e2,_0x49ef66){_0x49ef66=_0x49ef66||0xc8;return function(_0x32a3df){if(_0x32a3df){return _0x2751e2['status'](_0x49ef66)[_0x0662('0x19')](_0x32a3df);}};}function respondWithFilteredResult(_0x527b34,_0x448596){return function(_0x543fa2){if(_0x543fa2){var _0x2cc7f7=typeof _0x448596[_0x0662('0x1a')]===_0x0662('0x1b')&&typeof _0x448596[_0x0662('0x1c')]===_0x0662('0x1b');var _0x5c6e17=_0x543fa2[_0x0662('0x1d')];var _0x2beda2=_0x2cc7f7?0x0:_0x448596[_0x0662('0x1a')];var _0x153a99=_0x2cc7f7?_0x543fa2[_0x0662('0x1d')]:_0x448596[_0x0662('0x1a')]+_0x448596['limit'];var _0x5f18f7;if(_0x153a99>=_0x5c6e17){_0x153a99=_0x5c6e17;_0x5f18f7=0xc8;}else{_0x5f18f7=0xce;}_0x527b34[_0x0662('0x1e')](_0x5f18f7);return _0x527b34[_0x0662('0x1f')]('Content-Range',_0x2beda2+'-'+_0x153a99+'/'+_0x5c6e17)[_0x0662('0x19')](_0x543fa2);}return null;};}function patchUpdates(_0x2792b7){return function(_0x59b92a){try{jsonpatch['apply'](_0x59b92a,_0x2792b7,!![]);}catch(_0x26f708){return BPromise[_0x0662('0x20')](_0x26f708);}return _0x59b92a[_0x0662('0x21')]();};}function saveUpdates(_0x5f42ec,_0xb8bba1){return function(_0x41bca1){if(_0x41bca1){return _0x41bca1['update'](_0x5f42ec)[_0x0662('0x22')](function(_0x20933c){return _0x20933c;});}return null;};}function removeEntity(_0x359c3e,_0x30af52){return function(_0x3cd8b9){if(_0x3cd8b9){return _0x3cd8b9[_0x0662('0x23')]()[_0x0662('0x22')](function(){_0x359c3e[_0x0662('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11c915,_0x4e79f0){return function(_0xa380fb){if(!_0xa380fb){_0x11c915['sendStatus'](0x194);}return _0xa380fb;};}function handleError(_0x3c168f,_0x55a9a3){_0x55a9a3=_0x55a9a3||0x1f4;return function(_0x32a6b9){logger['error'](_0x32a6b9['stack']);if(_0x32a6b9[_0x0662('0x24')]){delete _0x32a6b9[_0x0662('0x24')];}_0x3c168f[_0x0662('0x1e')](_0x55a9a3)[_0x0662('0x25')](_0x32a6b9);};}exports[_0x0662('0x26')]=function(_0xfe0a1b,_0x113f4f){var _0x1b5e6c={},_0x557306={},_0x270285={'count':0x0,'rows':[]};var _0xc4d020=_[_0x0662('0x27')](db[_0x0662('0x28')]['rawAttributes'],function(_0x134a1a){return{'name':_0x134a1a[_0x0662('0x29')],'type':_0x134a1a['type']['key']};});_0x557306[_0x0662('0x2a')]=_[_0x0662('0x27')](_0xc4d020,_0x0662('0x24'));_0x557306[_0x0662('0x2b')]=_[_0x0662('0x2c')](_0xfe0a1b[_0x0662('0x2b')]);_0x557306['filters']=_[_0x0662('0x2d')](_0x557306[_0x0662('0x2a')],_0x557306[_0x0662('0x2b')]);_0x1b5e6c['attributes']=_[_0x0662('0x2d')](_0x557306['model'],qs['fields'](_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x2e')]));_0x1b5e6c['attributes']=_0x1b5e6c[_0x0662('0x2f')][_0x0662('0x30')]?_0x1b5e6c[_0x0662('0x2f')]:_0x557306['model'];if(!_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x31')](_0x0662('0x32'))){_0x1b5e6c['limit']=qs[_0x0662('0x1c')](_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x1c')]);_0x1b5e6c['offset']=qs[_0x0662('0x1a')](_0xfe0a1b[_0x0662('0x2b')]['offset']);}_0x1b5e6c[_0x0662('0x33')]=qs['sort'](_0xfe0a1b['query'][_0x0662('0x34')]);_0x1b5e6c['where']=qs[_0x0662('0x35')](_['pick'](_0xfe0a1b['query'],_0x557306['filters']),_0xc4d020);if(_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x36')]){_0x1b5e6c[_0x0662('0x37')]=_[_0x0662('0x38')](_0x1b5e6c['where'],{'$or':_['map'](_0xc4d020,function(_0x148004){if(_0x148004['type']!==_0x0662('0x39')){var _0x42d400={};_0x42d400[_0x148004[_0x0662('0x24')]]={'$like':'%'+_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x36')]+'%'};return _0x42d400;}})});}_0x1b5e6c=_[_0x0662('0x38')]({},_0x1b5e6c,_0xfe0a1b[_0x0662('0x3a')]);var _0x30334a={'where':_0x1b5e6c[_0x0662('0x37')]};return db[_0x0662('0x28')][_0x0662('0x1d')](_0x30334a)[_0x0662('0x22')](function(_0xd16d85){_0x270285[_0x0662('0x1d')]=_0xd16d85;if(_0xfe0a1b['query'][_0x0662('0x3b')]){_0x1b5e6c[_0x0662('0x3c')]=[{'all':!![]}];}return db[_0x0662('0x28')][_0x0662('0x3d')](_0x1b5e6c);})[_0x0662('0x22')](function(_0x43aff2){_0x270285[_0x0662('0x3e')]=_0x43aff2;return _0x270285;})[_0x0662('0x22')](respondWithFilteredResult(_0x113f4f,_0x1b5e6c))[_0x0662('0x3f')](handleError(_0x113f4f,null));};exports[_0x0662('0x40')]=function(_0x2933ed,_0xc63784){var _0xfe3d27={'raw':!![],'where':{'id':_0x2933ed['params']['id']}},_0x3a8099={};_0x3a8099[_0x0662('0x2a')]=_[_0x0662('0x2c')](db[_0x0662('0x28')][_0x0662('0x41')]);_0x3a8099[_0x0662('0x2b')]=_[_0x0662('0x2c')](_0x2933ed[_0x0662('0x2b')]);_0x3a8099[_0x0662('0x35')]=_[_0x0662('0x2d')](_0x3a8099[_0x0662('0x2a')],_0x3a8099[_0x0662('0x2b')]);_0xfe3d27[_0x0662('0x2f')]=_[_0x0662('0x2d')](_0x3a8099[_0x0662('0x2a')],qs[_0x0662('0x2e')](_0x2933ed['query'][_0x0662('0x2e')]));_0xfe3d27[_0x0662('0x2f')]=_0xfe3d27['attributes'][_0x0662('0x30')]?_0xfe3d27[_0x0662('0x2f')]:_0x3a8099['model'];if(_0x2933ed[_0x0662('0x2b')]['includeAll']){_0xfe3d27['include']=[{'all':!![]}];}_0xfe3d27=_[_0x0662('0x38')]({},_0xfe3d27,_0x2933ed['options']);return db[_0x0662('0x28')][_0x0662('0x42')](_0xfe3d27)['then'](handleEntityNotFound(_0xc63784,null))[_0x0662('0x22')](respondWithResult(_0xc63784,null))[_0x0662('0x3f')](handleError(_0xc63784,null));};exports['create']=function(_0x1bd2f5,_0x4923c0){return db['VtigerField'][_0x0662('0x43')](_0x1bd2f5[_0x0662('0x44')],{})[_0x0662('0x22')](respondWithResult(_0x4923c0,0xc9))[_0x0662('0x3f')](handleError(_0x4923c0,null));};exports[_0x0662('0x45')]=function(_0x31fc04,_0x40876f){if(_0x31fc04[_0x0662('0x44')]['id']){delete _0x31fc04['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x31fc04[_0x0662('0x46')]['id']}})[_0x0662('0x22')](handleEntityNotFound(_0x40876f,null))[_0x0662('0x22')](saveUpdates(_0x31fc04[_0x0662('0x44')],null))[_0x0662('0x22')](respondWithResult(_0x40876f,null))[_0x0662('0x3f')](handleError(_0x40876f,null));};exports[_0x0662('0x23')]=function(_0x2f767d,_0x42beb7){return db['VtigerField'][_0x0662('0x42')]({'where':{'id':_0x2f767d[_0x0662('0x46')]['id']}})[_0x0662('0x22')](handleEntityNotFound(_0x42beb7,null))[_0x0662('0x22')](removeEntity(_0x42beb7,null))[_0x0662('0x3f')](handleError(_0x42beb7,null));}; \ No newline at end of file +var _0xf761=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','error','index','map','VtigerField','fieldName','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','destroy','eml-format'];(function(_0x5cbe4d,_0x1e8fee){var _0x596e80=function(_0x5e6f0e){while(--_0x5e6f0e){_0x5cbe4d['push'](_0x5cbe4d['shift']());}};_0x596e80(++_0x1e8fee);}(_0xf761,0x89));var _0x1f76=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xf761[_0x307086];return _0x699043;};'use strict';var emlformat=require(_0x1f76('0x0'));var rimraf=require(_0x1f76('0x1'));var zipdir=require(_0x1f76('0x2'));var jsonpatch=require(_0x1f76('0x3'));var rp=require(_0x1f76('0x4'));var moment=require('moment');var BPromise=require(_0x1f76('0x5'));var Mustache=require(_0x1f76('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1f76('0x7'));var csv=require(_0x1f76('0x8'));var ejs=require(_0x1f76('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f76('0xa'));var crypto=require(_0x1f76('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f76('0x8'));var querystring=require(_0x1f76('0xc'));var Papa=require(_0x1f76('0xd'));var Redis=require(_0x1f76('0xe'));var authService=require(_0x1f76('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1f76('0x10'));var hardwareService=require(_0x1f76('0x11'));var logger=require(_0x1f76('0x12'))(_0x1f76('0x13'));var utils=require('../../config/utils');var config=require(_0x1f76('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f76('0x15'))['db'];function respondWithStatusCode(_0x4b86d2,_0x3d2428){_0x3d2428=_0x3d2428||0xcc;return function(_0x49d740){if(_0x49d740){return _0x4b86d2[_0x1f76('0x16')](_0x3d2428);}return _0x4b86d2[_0x1f76('0x17')](_0x3d2428)['end']();};}function respondWithResult(_0x2b6291,_0x540a7e){_0x540a7e=_0x540a7e||0xc8;return function(_0x28a6c9){if(_0x28a6c9){return _0x2b6291[_0x1f76('0x17')](_0x540a7e)['json'](_0x28a6c9);}};}function respondWithFilteredResult(_0x2175d5,_0x1b30f0){return function(_0x1c3d42){if(_0x1c3d42){var _0x48e888=typeof _0x1b30f0[_0x1f76('0x18')]===_0x1f76('0x19')&&typeof _0x1b30f0[_0x1f76('0x1a')]==='undefined';var _0xde9941=_0x1c3d42[_0x1f76('0x1b')];var _0x20d2c3=_0x48e888?0x0:_0x1b30f0['offset'];var _0x20a4e4=_0x48e888?_0x1c3d42[_0x1f76('0x1b')]:_0x1b30f0[_0x1f76('0x18')]+_0x1b30f0[_0x1f76('0x1a')];var _0x3df9d8;if(_0x20a4e4>=_0xde9941){_0x20a4e4=_0xde9941;_0x3df9d8=0xc8;}else{_0x3df9d8=0xce;}_0x2175d5[_0x1f76('0x17')](_0x3df9d8);return _0x2175d5['set'](_0x1f76('0x1c'),_0x20d2c3+'-'+_0x20a4e4+'/'+_0xde9941)[_0x1f76('0x1d')](_0x1c3d42);}return null;};}function patchUpdates(_0xc3c3d8){return function(_0x4c7b2f){try{jsonpatch['apply'](_0x4c7b2f,_0xc3c3d8,!![]);}catch(_0x37c9ef){return BPromise[_0x1f76('0x1e')](_0x37c9ef);}return _0x4c7b2f[_0x1f76('0x1f')]();};}function saveUpdates(_0x57f7c5,_0x4a6dcb){return function(_0x9a3ff3){if(_0x9a3ff3){return _0x9a3ff3[_0x1f76('0x20')](_0x57f7c5)[_0x1f76('0x21')](function(_0x1ab109){return _0x1ab109;});}return null;};}function removeEntity(_0x5dff88,_0x2ea21a){return function(_0x544621){if(_0x544621){return _0x544621['destroy']()[_0x1f76('0x21')](function(){_0x5dff88[_0x1f76('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x292799,_0x50e250){return function(_0x594aea){if(!_0x594aea){_0x292799[_0x1f76('0x16')](0x194);}return _0x594aea;};}function handleError(_0x147861,_0x2e8be4){_0x2e8be4=_0x2e8be4||0x1f4;return function(_0x2a33b0){logger[_0x1f76('0x22')](_0x2a33b0['stack']);if(_0x2a33b0['name']){delete _0x2a33b0['name'];}_0x147861[_0x1f76('0x17')](_0x2e8be4)['send'](_0x2a33b0);};}exports[_0x1f76('0x23')]=function(_0x29abb8,_0x140f2b){var _0x593641={},_0x252115={},_0x36d921={'count':0x0,'rows':[]};var _0x4f6b9b=_[_0x1f76('0x24')](db[_0x1f76('0x25')]['rawAttributes'],function(_0x3adcd1){return{'name':_0x3adcd1[_0x1f76('0x26')],'type':_0x3adcd1['type'][_0x1f76('0x27')]};});_0x252115['model']=_[_0x1f76('0x24')](_0x4f6b9b,_0x1f76('0x28'));_0x252115[_0x1f76('0x29')]=_[_0x1f76('0x2a')](_0x29abb8[_0x1f76('0x29')]);_0x252115['filters']=_[_0x1f76('0x2b')](_0x252115[_0x1f76('0x2c')],_0x252115['query']);_0x593641[_0x1f76('0x2d')]=_[_0x1f76('0x2b')](_0x252115[_0x1f76('0x2c')],qs[_0x1f76('0x2e')](_0x29abb8['query'][_0x1f76('0x2e')]));_0x593641[_0x1f76('0x2d')]=_0x593641['attributes'][_0x1f76('0x2f')]?_0x593641[_0x1f76('0x2d')]:_0x252115['model'];if(!_0x29abb8[_0x1f76('0x29')][_0x1f76('0x30')]('nolimit')){_0x593641[_0x1f76('0x1a')]=qs[_0x1f76('0x1a')](_0x29abb8[_0x1f76('0x29')][_0x1f76('0x1a')]);_0x593641[_0x1f76('0x18')]=qs['offset'](_0x29abb8[_0x1f76('0x29')]['offset']);}_0x593641[_0x1f76('0x31')]=qs['sort'](_0x29abb8[_0x1f76('0x29')]['sort']);_0x593641[_0x1f76('0x32')]=qs['filters'](_[_0x1f76('0x33')](_0x29abb8[_0x1f76('0x29')],_0x252115[_0x1f76('0x34')]),_0x4f6b9b);if(_0x29abb8[_0x1f76('0x29')][_0x1f76('0x35')]){_0x593641[_0x1f76('0x32')]=_[_0x1f76('0x36')](_0x593641[_0x1f76('0x32')],{'$or':_['map'](_0x4f6b9b,function(_0x1dc1d5){if(_0x1dc1d5[_0x1f76('0x37')]!==_0x1f76('0x38')){var _0x19b113={};_0x19b113[_0x1dc1d5[_0x1f76('0x28')]]={'$like':'%'+_0x29abb8[_0x1f76('0x29')][_0x1f76('0x35')]+'%'};return _0x19b113;}})});}_0x593641=_['merge']({},_0x593641,_0x29abb8[_0x1f76('0x39')]);var _0x497a28={'where':_0x593641[_0x1f76('0x32')]};return db[_0x1f76('0x25')][_0x1f76('0x1b')](_0x497a28)['then'](function(_0x1eb5f1){_0x36d921[_0x1f76('0x1b')]=_0x1eb5f1;if(_0x29abb8[_0x1f76('0x29')]['includeAll']){_0x593641['include']=[{'all':!![]}];}return db['VtigerField'][_0x1f76('0x3a')](_0x593641);})[_0x1f76('0x21')](function(_0x28e6c4){_0x36d921[_0x1f76('0x3b')]=_0x28e6c4;return _0x36d921;})[_0x1f76('0x21')](respondWithFilteredResult(_0x140f2b,_0x593641))['catch'](handleError(_0x140f2b,null));};exports[_0x1f76('0x3c')]=function(_0x511591,_0x5b1fd9){var _0x3dca11={'raw':!![],'where':{'id':_0x511591[_0x1f76('0x3d')]['id']}},_0x472ce7={};_0x472ce7[_0x1f76('0x2c')]=_['keys'](db[_0x1f76('0x25')]['rawAttributes']);_0x472ce7[_0x1f76('0x29')]=_[_0x1f76('0x2a')](_0x511591[_0x1f76('0x29')]);_0x472ce7['filters']=_[_0x1f76('0x2b')](_0x472ce7[_0x1f76('0x2c')],_0x472ce7[_0x1f76('0x29')]);_0x3dca11[_0x1f76('0x2d')]=_[_0x1f76('0x2b')](_0x472ce7['model'],qs[_0x1f76('0x2e')](_0x511591[_0x1f76('0x29')]['fields']));_0x3dca11[_0x1f76('0x2d')]=_0x3dca11[_0x1f76('0x2d')][_0x1f76('0x2f')]?_0x3dca11[_0x1f76('0x2d')]:_0x472ce7['model'];if(_0x511591[_0x1f76('0x29')][_0x1f76('0x3e')]){_0x3dca11[_0x1f76('0x3f')]=[{'all':!![]}];}_0x3dca11=_['merge']({},_0x3dca11,_0x511591[_0x1f76('0x39')]);return db[_0x1f76('0x25')][_0x1f76('0x40')](_0x3dca11)[_0x1f76('0x21')](handleEntityNotFound(_0x5b1fd9,null))[_0x1f76('0x21')](respondWithResult(_0x5b1fd9,null))[_0x1f76('0x41')](handleError(_0x5b1fd9,null));};exports[_0x1f76('0x42')]=function(_0x2a947e,_0x33a288){return db['VtigerField'][_0x1f76('0x42')](_0x2a947e['body'],{})[_0x1f76('0x21')](respondWithResult(_0x33a288,0xc9))[_0x1f76('0x41')](handleError(_0x33a288,null));};exports[_0x1f76('0x20')]=function(_0x860fa4,_0x3e9612){if(_0x860fa4['body']['id']){delete _0x860fa4[_0x1f76('0x43')]['id'];}return db[_0x1f76('0x25')][_0x1f76('0x40')]({'where':{'id':_0x860fa4['params']['id']}})[_0x1f76('0x21')](handleEntityNotFound(_0x3e9612,null))[_0x1f76('0x21')](saveUpdates(_0x860fa4[_0x1f76('0x43')],null))[_0x1f76('0x21')](respondWithResult(_0x3e9612,null))[_0x1f76('0x41')](handleError(_0x3e9612,null));};exports[_0x1f76('0x44')]=function(_0x36c1ec,_0x376747){return db[_0x1f76('0x25')][_0x1f76('0x40')]({'where':{'id':_0x36c1ec[_0x1f76('0x3d')]['id']}})['then'](handleEntityNotFound(_0x376747,null))[_0x1f76('0x21')](removeEntity(_0x376747,null))[_0x1f76('0x41')](handleError(_0x376747,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5f5eee0..c8f5d21 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 _0xe6f3=['path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2598ac,_0x34a2e7){var _0x415d93=function(_0x5cecc8){while(--_0x5cecc8){_0x2598ac['push'](_0x2598ac['shift']());}};_0x415d93(++_0x34a2e7);}(_0xe6f3,0x116));var _0x3e6f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe6f3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require(_0x3e6f('0x5'));var rp=require(_0x3e6f('0x6'));var fs=require('fs');var path=require(_0x3e6f('0x7'));var rimraf=require(_0x3e6f('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x3e6f('0x9')]=function(_0x204950,_0x29ff4f){return _0x204950[_0x3e6f('0xa')](_0x3e6f('0xb'),attributes,{'tableName':_0x3e6f('0xc'),'paranoid':![],'indexes':[{'name':_0x3e6f('0xd'),'fields':[_0x3e6f('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf3a=['../../config/environment','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x88ac64,_0x3be5ca){var _0x455737=function(_0x1142be){while(--_0x1142be){_0x88ac64['push'](_0x88ac64['shift']());}};_0x455737(++_0x3be5ca);}(_0xbf3a,0x149));var _0xabf3=function(_0x34e14d,_0x5dea39){_0x34e14d=_0x34e14d-0x0;var _0x3d8e08=_0xbf3a[_0x34e14d];return _0x3d8e08;};'use strict';var _=require(_0xabf3('0x0'));var util=require(_0xabf3('0x1'));var logger=require('../../config/logger')(_0xabf3('0x2'));var moment=require(_0xabf3('0x3'));var BPromise=require(_0xabf3('0x4'));var rp=require(_0xabf3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabf3('0x6'));var config=require(_0xabf3('0x7'));var attributes=require('./intVtigerField.attributes');module[_0xabf3('0x8')]=function(_0x3bdf5c,_0x594ffb){return _0x3bdf5c['define'](_0xabf3('0x9'),attributes,{'tableName':_0xabf3('0xa'),'paranoid':![],'indexes':[{'name':_0xabf3('0xb'),'fields':[_0xabf3('0xc'),_0xabf3('0xd')],'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 99d630f..5a231d5 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 _0x0a1a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x0a1a,0x161));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var moment=require(_0xa0a1('0x2'));var BPromise=require(_0xa0a1('0x3'));var rs=require(_0xa0a1('0x4'));var fs=require('fs');var Redis=require(_0xa0a1('0x5'));var db=require(_0xa0a1('0x6'))['db'];var utils=require(_0xa0a1('0x7'));var logger=require('../../config/logger')(_0xa0a1('0x8'));var config=require(_0xa0a1('0x9'));var jayson=require(_0xa0a1('0xa'));var client=jayson[_0xa0a1('0xb')][_0xa0a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e0353,_0x482fd3,_0x2989ff){return new BPromise(function(_0xe8b7b3,_0xf9d4c8){return client[_0xa0a1('0xd')](_0x3e0353,_0x2989ff)[_0xa0a1('0xe')](function(_0x303535){logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));logger[_0xa0a1('0x12')](_0xa0a1('0x13'),_0x482fd3,_0xa0a1('0x11'),JSON['stringify'](_0x303535));if(_0x303535[_0xa0a1('0x14')]){if(_0x303535[_0xa0a1('0x14')]['code']===0x1f4){logger[_0xa0a1('0x14')](_0xa0a1('0x10'),_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xf9d4c8(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}logger[_0xa0a1('0x14')]('VtigerField,\x20%s,\x20%s',_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xe8b7b3(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}else{logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));_0xe8b7b3(_0x303535[_0xa0a1('0x16')][_0xa0a1('0x15')]);}})[_0xa0a1('0x17')](function(_0x58074c){logger[_0xa0a1('0x14')]('VtigerField,\x20%s,\x20%s',_0x482fd3,_0x58074c);_0xf9d4c8(_0x58074c);});});} \ No newline at end of file +var _0x870d=['moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x870d,0x124));var _0xd870=function(_0x42b0d6,_0x33bca1){_0x42b0d6=_0x42b0d6-0x0;var _0x12c29c=_0x870d[_0x42b0d6];return _0x12c29c;};'use strict';var _=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var moment=require(_0xd870('0x2'));var BPromise=require(_0xd870('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd870('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd870('0x5'))('rpc');var config=require(_0xd870('0x6'));var jayson=require(_0xd870('0x7'));var client=jayson['client'][_0xd870('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x906978,_0x52f730,_0x5a0345){return new BPromise(function(_0x39a9c4,_0x3bbbd0){return client[_0xd870('0x9')](_0x906978,_0x5a0345)[_0xd870('0xa')](function(_0x75db89){logger[_0xd870('0xb')](_0xd870('0xc'),_0x52f730,'request\x20sent');logger[_0xd870('0xd')](_0xd870('0xe'),_0x52f730,_0xd870('0xf'),JSON[_0xd870('0x10')](_0x75db89));if(_0x75db89[_0xd870('0x11')]){if(_0x75db89[_0xd870('0x11')][_0xd870('0x12')]===0x1f4){logger[_0xd870('0x11')](_0xd870('0xc'),_0x52f730,_0x75db89[_0xd870('0x11')][_0xd870('0x13')]);return _0x3bbbd0(_0x75db89['error']['message']);}logger[_0xd870('0x11')]('VtigerField,\x20%s,\x20%s',_0x52f730,_0x75db89['error'][_0xd870('0x13')]);return _0x39a9c4(_0x75db89[_0xd870('0x11')][_0xd870('0x13')]);}else{logger[_0xd870('0xb')](_0xd870('0xc'),_0x52f730,_0xd870('0xf'));_0x39a9c4(_0x75db89[_0xd870('0x14')]['message']);}})['catch'](function(_0x33529d){logger[_0xd870('0x11')]('VtigerField,\x20%s,\x20%s',_0x52f730,_0x33529d);_0x3bbbd0(_0x33529d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8786149..508abcc 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 _0x52d2=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4c5b52,_0x1a945a){var _0x24fce3=function(_0x5be371){while(--_0x5be371){_0x4c5b52['push'](_0x4c5b52['shift']());}};_0x24fce3(++_0x1a945a);}(_0x52d2,0x95));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require('path');var timeout=require(_0x252d('0x2'));var express=require(_0x252d('0x3'));var router=express[_0x252d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x252d('0x5'));var config=require('../../config/environment');var controller=require(_0x252d('0x6'));router[_0x252d('0x7')]('/',auth[_0x252d('0x8')](),controller[_0x252d('0x9')]);router[_0x252d('0x7')]('/:id',auth[_0x252d('0x8')](),controller[_0x252d('0xa')]);router[_0x252d('0x7')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0xc')]);router[_0x252d('0x7')](_0x252d('0xd'),auth[_0x252d('0x8')](),controller['getFields']);router[_0x252d('0xe')]('/',auth[_0x252d('0x8')](),controller[_0x252d('0xf')]);router[_0x252d('0xe')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0x10')]);router[_0x252d('0x11')](_0x252d('0x12'),auth[_0x252d('0x8')](),controller['update']);router[_0x252d('0x13')](_0x252d('0x12'),auth[_0x252d('0x8')](),controller[_0x252d('0x14')]);module[_0x252d('0x15')]=router; \ No newline at end of file +var _0xa7cb=['put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','post','create','/:id/configurations','addConfiguration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa7cb,0xdf));var _0xba7c=function(_0x44b362,_0x1b5fd9){_0x44b362=_0x44b362-0x0;var _0x38b45c=_0xa7cb[_0x44b362];return _0x38b45c;};'use strict';var multer=require(_0xba7c('0x0'));var util=require(_0xba7c('0x1'));var path=require(_0xba7c('0x2'));var timeout=require(_0xba7c('0x3'));var express=require(_0xba7c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba7c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba7c('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xba7c('0x7')]('/',auth[_0xba7c('0x8')](),controller[_0xba7c('0x9')]);router[_0xba7c('0x7')](_0xba7c('0xa'),auth[_0xba7c('0x8')](),controller[_0xba7c('0xb')]);router[_0xba7c('0x7')]('/:id/configurations',auth[_0xba7c('0x8')](),controller['getConfigurations']);router[_0xba7c('0x7')](_0xba7c('0xc'),auth[_0xba7c('0x8')](),controller['getFields']);router[_0xba7c('0xd')]('/',auth['isAuthenticated'](),controller[_0xba7c('0xe')]);router[_0xba7c('0xd')](_0xba7c('0xf'),auth[_0xba7c('0x8')](),controller[_0xba7c('0x10')]);router[_0xba7c('0x11')](_0xba7c('0xa'),auth[_0xba7c('0x8')](),controller['update']);router[_0xba7c('0x12')](_0xba7c('0xa'),auth[_0xba7c('0x8')](),controller[_0xba7c('0x13')]);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 b8cb6fb..e6982d9 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 _0x8506=['integrationTab','exports','STRING','username','remoteUri','password','token'];(function(_0x3f4018,_0x4c1543){var _0xf8beb7=function(_0x393c26){while(--_0x393c26){_0x3f4018['push'](_0x3f4018['shift']());}};_0xf8beb7(++_0x4c1543);}(_0x8506,0xe8));var _0x6850=function(_0x58bbef,_0x2d265a){_0x58bbef=_0x58bbef-0x0;var _0x42cd2e=_0x8506[_0x58bbef];return _0x42cd2e;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6850('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6850('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6850('0x1')]},'remoteUri':{'type':Sequelize[_0x6850('0x1')],'unique':_0x6850('0x3')},'authType':{'type':Sequelize['ENUM'](_0x6850('0x4'),_0x6850('0x5')),'defaultValue':_0x6850('0x4')},'serverUrl':{'type':Sequelize[_0x6850('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x6850('0x6')}}; \ No newline at end of file +var _0x9666=['sequelize','exports','STRING','username','ENUM','password','token','newTab','integrationTab'];(function(_0x133fea,_0x14d265){var _0x516752=function(_0x53acac){while(--_0x53acac){_0x133fea['push'](_0x133fea['shift']());}};_0x516752(++_0x14d265);}(_0x9666,0x17a));var _0x6966=function(_0x4cb5b6,_0x3a2ef8){_0x4cb5b6=_0x4cb5b6-0x0;var _0x1fb952=_0x9666[_0x4cb5b6];return _0x1fb952;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'name':{'type':Sequelize[_0x6966('0x2')]},'description':{'type':Sequelize[_0x6966('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6966('0x3')},'password':{'type':Sequelize[_0x6966('0x2')]},'token':{'type':Sequelize[_0x6966('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6966('0x4')](_0x6966('0x5'),_0x6966('0x6')),'defaultValue':_0x6966('0x5')},'serverUrl':{'type':Sequelize[_0x6966('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6966('0x4')]('integrationTab',_0x6966('0x7')),'defaultValue':_0x6966('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bd508d4..e1c1c38 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 _0x6e6c=['name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack'];(function(_0xc4e0ed,_0x54dae3){var _0x440d96=function(_0x5b3350){while(--_0x5b3350){_0xc4e0ed['push'](_0xc4e0ed['shift']());}};_0x440d96(++_0x54dae3);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['ZendeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56'),_0xc6e6('0x57'),_0xc6e6('0x58'),'remoteUri']})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))['then'](function(_0x4bdac6){if(_0x4bdac6){_0x55cec5=_0x4bdac6[_0xc6e6('0x59')];var _0xc38c57=_0x55cec5[_0xc6e6('0x5a')](-0x1);if(_0xc38c57==='/'){_0x55cec5=_0x55cec5['substring'](0x0,_0x55cec5[_0xc6e6('0x5b')](_0xc38c57));}var _0x4ec143={'method':'GET','uri':util[_0xc6e6('0x5c')]('%s/%s',_0x55cec5,_0xc6e6('0x5d')),'json':!![]};switch(_0x4bdac6[_0xc6e6('0x58')]){case _0xc6e6('0x56'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util['format'](_0xc6e6('0x5f'),new Buffer(util[_0xc6e6('0x5c')](_0xc6e6('0x60'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x56')]))['toString'](_0xc6e6('0x61')))};break;case _0xc6e6('0x57'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util[_0xc6e6('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc6e6('0x62'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x57')]))[_0xc6e6('0x63')](_0xc6e6('0x61')))};break;default:throw new db[(_0xc6e6('0x64'))][(_0xc6e6('0x65'))](_0xc6e6('0x66'));}return rp(_0x4ec143);}})[_0xc6e6('0x24')](function(_0x4bbe4c){if(_0x4bbe4c){var _0x506679=[_0xc6e6('0x67'),'description',_0xc6e6('0x68'),_0xc6e6('0x69')];_[_0xc6e6('0x6a')](_0x4bbe4c['ticket_fields'],function(_0x5b0c3b){return _0x506679[_0xc6e6('0x6b')](_0x5b0c3b['type']);});return{'count':_0x4bbe4c[_0xc6e6('0x5d')]['length'],'rows':_[_0xc6e6('0x2a')](_0x4bbe4c[_0xc6e6('0x5d')],function(_0x5d867e){return{'id':_0x5d867e['id'],'name':_0x5d867e[_0xc6e6('0x6c')]>0x7?_0x5d867e[_0xc6e6('0x6d')]:_0x5d867e[_0xc6e6('0x2e')],'custom':_0x5d867e['position']>0x7?!![]:![],'options':_0x5d867e[_0xc6e6('0x6e')]?_0x5d867e[_0xc6e6('0x6e')]:_0x5d867e[_0xc6e6('0x6f')]?_0x5d867e['custom_field_options']:[]};})};}})[_0xc6e6('0x24')](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x4e7b05){var _0x4e0add=_0x4c4985['query'][_0xc6e6('0x70')]?0x1f4:_0x4e7b05[_0xc6e6('0x71')]||0x1f4;logger[_0xc6e6('0x25')](_0xc6e6('0x72'),_0xc6e6('0x54'),_0x4e0add,JSON[_0xc6e6('0x73')](_0x4e7b05));delete _0x4e7b05['name'];if(_0x4e0add===0x191){_0x4e0add=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x4e0add)['send'](_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x70')]?{'message':_0xc6e6('0x74'),'statusCode':_0x4e7b05['statusCode']}:_0x4e7b05);});}; \ No newline at end of file +var _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','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','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x57c5cc,_0x465823){var _0x3aff5d=function(_0x5935ee){while(--_0x5935ee){_0x57c5cc['push'](_0x57c5cc['shift']());}};_0x3aff5d(++_0x465823);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xae60[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4f75273..c2d8a1e 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 _0xc1c5=['ZendeskAccount','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc1c5,0x1d7));var _0x5c1c=function(_0x592414,_0x4a78b1){_0x592414=_0x592414-0x0;var _0x4cfb09=_0xc1c5[_0x592414];return _0x4cfb09;};'use strict';var _=require('lodash');var util=require(_0x5c1c('0x0'));var logger=require(_0x5c1c('0x1'))(_0x5c1c('0x2'));var moment=require('moment');var BPromise=require(_0x5c1c('0x3'));var rp=require(_0x5c1c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c1c('0x5'));var config=require(_0x5c1c('0x6'));var attributes=require(_0x5c1c('0x7'));var integrations=require(_0x5c1c('0x8'));module['exports']=function(_0x28e119,_0x623b1a){return _0x28e119['define'](_0x5c1c('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e9=['../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x30e9,0x121));var _0x930e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x30e9[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var logger=require(_0x930e('0x2'))('api');var moment=require(_0x930e('0x3'));var BPromise=require(_0x930e('0x4'));var rp=require(_0x930e('0x5'));var fs=require('fs');var path=require(_0x930e('0x6'));var rimraf=require(_0x930e('0x7'));var config=require(_0x930e('0x8'));var attributes=require(_0x930e('0x9'));var integrations=require(_0x930e('0xa'));module[_0x930e('0xb')]=function(_0xf4758b,_0x345010){return _0xf4758b['define'](_0x930e('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index ef6a6a5..d064f9b 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 _0xa8d3=['ZendeskAccount','find','raw','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','attributes','limit','map','include','model','GetZendeskAccount'];(function(_0x434aa4,_0x5dc559){var _0x34e9b2=function(_0x493f96){while(--_0x493f96){_0x434aa4['push'](_0x434aa4['shift']());}};_0x34e9b2(++_0x5dc559);}(_0xa8d3,0x190));var _0x3a8d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa8d3[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var moment=require(_0x3a8d('0x2'));var BPromise=require(_0x3a8d('0x3'));var rs=require(_0x3a8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a8d('0x5'))['db'];var utils=require(_0x3a8d('0x6'));var logger=require(_0x3a8d('0x7'))(_0x3a8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x3a8d('0x9'));var client=jayson[_0x3a8d('0xa')][_0x3a8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b032,_0x54ab35,_0x43b2f4){return new BPromise(function(_0x22a4b8,_0x1fe79e){return client[_0x3a8d('0xc')](_0x26b032,_0x43b2f4)[_0x3a8d('0xd')](function(_0x257cb5){logger[_0x3a8d('0xe')](_0x3a8d('0xf'),_0x54ab35,_0x3a8d('0x10'));logger[_0x3a8d('0x11')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x54ab35,_0x3a8d('0x10'),JSON[_0x3a8d('0x12')](_0x257cb5));if(_0x257cb5['error']){if(_0x257cb5[_0x3a8d('0x13')][_0x3a8d('0x14')]===0x1f4){logger['error'](_0x3a8d('0xf'),_0x54ab35,_0x257cb5[_0x3a8d('0x13')]['message']);return _0x1fe79e(_0x257cb5['error'][_0x3a8d('0x15')]);}logger[_0x3a8d('0x13')](_0x3a8d('0xf'),_0x54ab35,_0x257cb5[_0x3a8d('0x13')]['message']);return _0x22a4b8(_0x257cb5['error'][_0x3a8d('0x15')]);}else{logger['info'](_0x3a8d('0xf'),_0x54ab35,_0x3a8d('0x10'));_0x22a4b8(_0x257cb5[_0x3a8d('0x16')][_0x3a8d('0x15')]);}})[_0x3a8d('0x17')](function(_0x326895){logger[_0x3a8d('0x13')](_0x3a8d('0xf'),_0x54ab35,_0x326895);_0x1fe79e(_0x326895);});});}exports['GetZendeskAccount']=function(_0x5d7179){var _0x14eb9f=this;return new Promise(function(_0xb44dbf,_0x53dea6){return db['ZendeskAccount'][_0x3a8d('0x18')]({'raw':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179[_0x3a8d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5d7179['options']?_0x5d7179[_0x3a8d('0x19')]['where']||null:null,'attributes':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179[_0x3a8d('0x19')][_0x3a8d('0x1a')]||null:null,'limit':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179['options'][_0x3a8d('0x1b')]||null:null,'include':_0x5d7179['options']?_0x5d7179[_0x3a8d('0x19')]['include']?_[_0x3a8d('0x1c')](_0x5d7179[_0x3a8d('0x19')][_0x3a8d('0x1d')],function(_0x525b5c){return{'model':db[_0x525b5c[_0x3a8d('0x1e')]],'as':_0x525b5c['as'],'attributes':_0x525b5c[_0x3a8d('0x1a')],'include':_0x525b5c[_0x3a8d('0x1d')]?_[_0x3a8d('0x1c')](_0x525b5c[_0x3a8d('0x1d')],function(_0x2b2f40){return{'model':db[_0x2b2f40['model']],'as':_0x2b2f40['as'],'attributes':_0x2b2f40['attributes'],'include':_0x2b2f40['include']?_[_0x3a8d('0x1c')](_0x2b2f40[_0x3a8d('0x1d')],function(_0x3101dc){return{'model':db[_0x3101dc['model']],'as':_0x3101dc['as'],'attributes':_0x3101dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f5db2){logger[_0x3a8d('0xe')](_0x3a8d('0x1f'),_0x5d7179);logger['debug'](_0x3a8d('0x1f'),_0x5d7179,JSON[_0x3a8d('0x12')](_0x1f5db2));_0xb44dbf(_0x1f5db2);})['catch'](function(_0x1284e8){logger['error']('GetZendeskAccount',_0x1284e8[_0x3a8d('0x15')],_0x5d7179);_0x53dea6(_0x14eb9f['error'](0x1f4,_0x1284e8[_0x3a8d('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x3b01ec){var _0x27b3ae=this;return new Promise(function(_0x480e3b,_0x208662){return db[_0x3a8d('0x20')][_0x3a8d('0x21')]({'raw':_0x3b01ec['options']?_0x3b01ec['options'][_0x3a8d('0x22')]===undefined?!![]:![]:!![],'where':_0x3b01ec[_0x3a8d('0x19')]?_0x3b01ec[_0x3a8d('0x19')]['where']||null:null,'attributes':_0x3b01ec['options']?_0x3b01ec['options'][_0x3a8d('0x1a')]||null:null,'include':_0x3b01ec[_0x3a8d('0x19')]?_0x3b01ec['options']['include']?_['map'](_0x3b01ec[_0x3a8d('0x19')]['include'],function(_0x28e003){return{'model':db[_0x28e003[_0x3a8d('0x1e')]],'as':_0x28e003['as'],'attributes':_0x28e003[_0x3a8d('0x1a')],'include':_0x28e003['include']?_[_0x3a8d('0x1c')](_0x28e003[_0x3a8d('0x1d')],function(_0x4e0de6){return{'model':db[_0x4e0de6['model']],'as':_0x4e0de6['as'],'attributes':_0x4e0de6[_0x3a8d('0x1a')],'include':_0x4e0de6[_0x3a8d('0x1d')]?_[_0x3a8d('0x1c')](_0x4e0de6[_0x3a8d('0x1d')],function(_0x140964){return{'model':db[_0x140964[_0x3a8d('0x1e')]],'as':_0x140964['as'],'attributes':_0x140964[_0x3a8d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3a8d('0xd')](function(_0x297dd2){logger[_0x3a8d('0xe')](_0x3a8d('0x23'),_0x3b01ec);logger[_0x3a8d('0x11')](_0x3a8d('0x23'),_0x3b01ec,JSON[_0x3a8d('0x12')](_0x297dd2));_0x480e3b(_0x297dd2);})[_0x3a8d('0x17')](function(_0x470eb8){logger['error'](_0x3a8d('0x23'),_0x470eb8['message'],_0x3b01ec);_0x208662(_0x27b3ae['error'](0x1f4,_0x470eb8[_0x3a8d('0x15')]));});});}; \ No newline at end of file +var _0x49fe=['limit','include','map','model','attributes','info','GetZendeskAccount','ShowZendeskAccount','find','where','then','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZendeskAccount','options','raw'];(function(_0x5058a6,_0x49710){var _0x2aeff6=function(_0x263f63){while(--_0x263f63){_0x5058a6['push'](_0x5058a6['shift']());}};_0x2aeff6(++_0x49710);}(_0x49fe,0x75));var _0xe49f=function(_0x265c56,_0x6072a4){_0x265c56=_0x265c56-0x0;var _0x4f603d=_0x49fe[_0x265c56];return _0x4f603d;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe49f('0x1'));var fs=require('fs');var Redis=require(_0xe49f('0x2'));var db=require(_0xe49f('0x3'))['db'];var utils=require(_0xe49f('0x4'));var logger=require(_0xe49f('0x5'))(_0xe49f('0x6'));var config=require(_0xe49f('0x7'));var jayson=require(_0xe49f('0x8'));var client=jayson[_0xe49f('0x9')][_0xe49f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0591c,_0x2a7c98,_0x6f1120){return new BPromise(function(_0x574f52,_0x306059){return client[_0xe49f('0xb')](_0xe0591c,_0x6f1120)['then'](function(_0x1eefb2){logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));logger['debug'](_0xe49f('0xe'),_0x2a7c98,_0xe49f('0xd'),JSON[_0xe49f('0xf')](_0x1eefb2));if(_0x1eefb2[_0xe49f('0x10')]){if(_0x1eefb2[_0xe49f('0x10')]['code']===0x1f4){logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x306059(_0x1eefb2[_0xe49f('0x10')][_0xe49f('0x11')]);}logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x574f52(_0x1eefb2[_0xe49f('0x10')]['message']);}else{logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));_0x574f52(_0x1eefb2[_0xe49f('0x12')][_0xe49f('0x11')]);}})[_0xe49f('0x13')](function(_0x35e3ed){logger['error'](_0xe49f('0xc'),_0x2a7c98,_0x35e3ed);_0x306059(_0x35e3ed);});});}exports['GetZendeskAccount']=function(_0x6ab378){var _0x4df1cc=this;return new Promise(function(_0x58f852,_0x3b5758){return db[_0xe49f('0x14')]['findAll']({'raw':_0x6ab378[_0xe49f('0x15')]?_0x6ab378['options'][_0xe49f('0x16')]===undefined?!![]:![]:!![],'where':_0x6ab378['options']?_0x6ab378[_0xe49f('0x15')]['where']||null:null,'attributes':_0x6ab378['options']?_0x6ab378[_0xe49f('0x15')]['attributes']||null:null,'limit':_0x6ab378[_0xe49f('0x15')]?_0x6ab378[_0xe49f('0x15')][_0xe49f('0x17')]||null:null,'include':_0x6ab378[_0xe49f('0x15')]?_0x6ab378[_0xe49f('0x15')][_0xe49f('0x18')]?_[_0xe49f('0x19')](_0x6ab378[_0xe49f('0x15')][_0xe49f('0x18')],function(_0x2a2926){return{'model':db[_0x2a2926[_0xe49f('0x1a')]],'as':_0x2a2926['as'],'attributes':_0x2a2926[_0xe49f('0x1b')],'include':_0x2a2926[_0xe49f('0x18')]?_['map'](_0x2a2926[_0xe49f('0x18')],function(_0x298cba){return{'model':db[_0x298cba[_0xe49f('0x1a')]],'as':_0x298cba['as'],'attributes':_0x298cba[_0xe49f('0x1b')],'include':_0x298cba['include']?_['map'](_0x298cba[_0xe49f('0x18')],function(_0x44b702){return{'model':db[_0x44b702['model']],'as':_0x44b702['as'],'attributes':_0x44b702[_0xe49f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x76b6f8){logger[_0xe49f('0x1c')](_0xe49f('0x1d'),_0x6ab378);logger['debug']('GetZendeskAccount',_0x6ab378,JSON[_0xe49f('0xf')](_0x76b6f8));_0x58f852(_0x76b6f8);})[_0xe49f('0x13')](function(_0x298248){logger[_0xe49f('0x10')]('GetZendeskAccount',_0x298248[_0xe49f('0x11')],_0x6ab378);_0x3b5758(_0x4df1cc[_0xe49f('0x10')](0x1f4,_0x298248[_0xe49f('0x11')]));});});};exports[_0xe49f('0x1e')]=function(_0x2f6d1d){var _0x183125=this;return new Promise(function(_0x5bd82d,_0x26dafe){return db[_0xe49f('0x14')][_0xe49f('0x1f')]({'raw':_0x2f6d1d[_0xe49f('0x15')]?_0x2f6d1d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f6d1d[_0xe49f('0x15')]?_0x2f6d1d[_0xe49f('0x15')][_0xe49f('0x20')]||null:null,'attributes':_0x2f6d1d['options']?_0x2f6d1d['options'][_0xe49f('0x1b')]||null:null,'include':_0x2f6d1d[_0xe49f('0x15')]?_0x2f6d1d[_0xe49f('0x15')]['include']?_[_0xe49f('0x19')](_0x2f6d1d['options']['include'],function(_0x18b501){return{'model':db[_0x18b501[_0xe49f('0x1a')]],'as':_0x18b501['as'],'attributes':_0x18b501[_0xe49f('0x1b')],'include':_0x18b501['include']?_[_0xe49f('0x19')](_0x18b501[_0xe49f('0x18')],function(_0x56d17a){return{'model':db[_0x56d17a['model']],'as':_0x56d17a['as'],'attributes':_0x56d17a[_0xe49f('0x1b')],'include':_0x56d17a[_0xe49f('0x18')]?_[_0xe49f('0x19')](_0x56d17a[_0xe49f('0x18')],function(_0x5a35a7){return{'model':db[_0x5a35a7[_0xe49f('0x1a')]],'as':_0x5a35a7['as'],'attributes':_0x5a35a7[_0xe49f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe49f('0x21')](function(_0x44afd6){logger[_0xe49f('0x1c')](_0xe49f('0x1e'),_0x2f6d1d);logger[_0xe49f('0x22')](_0xe49f('0x1e'),_0x2f6d1d,JSON[_0xe49f('0xf')](_0x44afd6));_0x5bd82d(_0x44afd6);})[_0xe49f('0x13')](function(_0x1cd414){logger[_0xe49f('0x10')](_0xe49f('0x1e'),_0x1cd414[_0xe49f('0x11')],_0x2f6d1d);_0x26dafe(_0x183125[_0xe49f('0x10')](0x1f4,_0x1cd414[_0xe49f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d82eaa7..9eb80f6 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x5d0c3b,_0x4e2806){var _0x1070e1=function(_0x5ce058){while(--_0x5ce058){_0x5d0c3b['push'](_0x5d0c3b['shift']());}};_0x1070e1(++_0x4e2806);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4beb1f,_0x52c21d){_0x4beb1f=_0x4beb1f-0x0;var _0x243ce5=_0xf4eb[_0x4beb1f];return _0x243ce5;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x819859,_0x2a8b7b){_0x819859=_0x819859-0x0;var _0x751696=_0x9ffd[_0x819859];return _0x751696;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('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 128db50..aac38d4 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 _0xb3ed=['exports','STRING','sequelize'];(function(_0x2dfe42,_0x1620e0){var _0x58cc02=function(_0x2a3a18){while(--_0x2a3a18){_0x2dfe42['push'](_0x2dfe42['shift']());}};_0x58cc02(++_0x1620e0);}(_0xb3ed,0xad));var _0xdb3e=function(_0x1eb4cc,_0x411971){_0x1eb4cc=_0x1eb4cc-0x0;var _0x4f4823=_0xb3ed[_0x1eb4cc];return _0x4f4823;};'use strict';var Sequelize=require(_0xdb3e('0x0'));module[_0xdb3e('0x1')]={'name':{'type':Sequelize[_0xdb3e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb114=['STRING','sequelize'];(function(_0x2314ec,_0x1a69fa){var _0x23a918=function(_0x3f456f){while(--_0x3f456f){_0x2314ec['push'](_0x2314ec['shift']());}};_0x23a918(++_0x1a69fa);}(_0xb114,0xb1));var _0x4b11=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb114[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x4b11('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b11('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b9df4f7..7e2b84a 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 _0x44c1=['length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','fields','include','catch','body','find','getFields','findOne','order','pick','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZendeskConfiguration','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x44c1,0x16d));var _0x144c=function(_0xd04611,_0x6f7365){_0xd04611=_0xd04611-0x0;var _0x72e2db=_0x44c1[_0xd04611];return _0x72e2db;};'use strict';var emlformat=require(_0x144c('0x0'));var rimraf=require(_0x144c('0x1'));var zipdir=require(_0x144c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x144c('0x3'));var moment=require(_0x144c('0x4'));var BPromise=require(_0x144c('0x5'));var Mustache=require(_0x144c('0x6'));var util=require(_0x144c('0x7'));var path=require('path');var sox=require(_0x144c('0x8'));var csv=require(_0x144c('0x9'));var ejs=require(_0x144c('0xa'));var fs=require('fs');var fs_extra=require(_0x144c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x144c('0xc'));var jsforce=require(_0x144c('0xd'));var deskjs=require(_0x144c('0xe'));var toCsv=require(_0x144c('0x9'));var querystring=require(_0x144c('0xf'));var Papa=require(_0x144c('0x10'));var Redis=require(_0x144c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x144c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x144c('0x13'));var logger=require(_0x144c('0x14'))(_0x144c('0x15'));var utils=require(_0x144c('0x16'));var config=require(_0x144c('0x17'));var licenseUtil=require(_0x144c('0x18'));var db=require(_0x144c('0x19'))['db'];function respondWithStatusCode(_0x4aa39f,_0x594694){_0x594694=_0x594694||0xcc;return function(_0x2960c3){if(_0x2960c3){return _0x4aa39f['sendStatus'](_0x594694);}return _0x4aa39f[_0x144c('0x1a')](_0x594694)[_0x144c('0x1b')]();};}function respondWithResult(_0x38b25d,_0x55bb73){_0x55bb73=_0x55bb73||0xc8;return function(_0x553614){if(_0x553614){return _0x38b25d['status'](_0x55bb73)[_0x144c('0x1c')](_0x553614);}};}function respondWithFilteredResult(_0x949cc8,_0x137158){return function(_0x4786d1){if(_0x4786d1){var _0xe4ecb5=typeof _0x137158[_0x144c('0x1d')]==='undefined'&&typeof _0x137158['limit']===_0x144c('0x1e');var _0x48a990=_0x4786d1[_0x144c('0x1f')];var _0x1d328e=_0xe4ecb5?0x0:_0x137158['offset'];var _0x19dd53=_0xe4ecb5?_0x4786d1['count']:_0x137158[_0x144c('0x1d')]+_0x137158[_0x144c('0x20')];var _0x213e5c;if(_0x19dd53>=_0x48a990){_0x19dd53=_0x48a990;_0x213e5c=0xc8;}else{_0x213e5c=0xce;}_0x949cc8[_0x144c('0x1a')](_0x213e5c);return _0x949cc8['set'](_0x144c('0x21'),_0x1d328e+'-'+_0x19dd53+'/'+_0x48a990)[_0x144c('0x1c')](_0x4786d1);}return null;};}function patchUpdates(_0xe08a04){return function(_0x4d37cd){try{jsonpatch[_0x144c('0x22')](_0x4d37cd,_0xe08a04,!![]);}catch(_0x3dd2a2){return BPromise[_0x144c('0x23')](_0x3dd2a2);}return _0x4d37cd[_0x144c('0x24')]();};}function saveUpdates(_0xf27cad,_0x1913ba){return function(_0x30e4dc){if(_0x30e4dc){return _0x30e4dc[_0x144c('0x25')](_0xf27cad)[_0x144c('0x26')](function(_0x13aaad){return _0x13aaad;});}return null;};}function removeEntity(_0x4dd832,_0x2a0504){return function(_0x177f07){if(_0x177f07){return _0x177f07[_0x144c('0x27')]()[_0x144c('0x26')](function(){_0x4dd832[_0x144c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be1ad,_0x3577da){return function(_0x147d88){if(!_0x147d88){_0x4be1ad[_0x144c('0x28')](0x194);}return _0x147d88;};}function handleError(_0x3e90ba,_0x2459f4){_0x2459f4=_0x2459f4||0x1f4;return function(_0x42787f){logger[_0x144c('0x29')](_0x42787f[_0x144c('0x2a')]);if(_0x42787f[_0x144c('0x2b')]){delete _0x42787f[_0x144c('0x2b')];}_0x3e90ba[_0x144c('0x1a')](_0x2459f4)[_0x144c('0x2c')](_0x42787f);};}exports['index']=function(_0x444a95,_0xb172bf){var _0x222095={},_0x4295f3={},_0x2830d9={'count':0x0,'rows':[]};var _0x2c8f5a=_[_0x144c('0x2d')](db[_0x144c('0x2e')]['rawAttributes'],function(_0x4f178c){return{'name':_0x4f178c['fieldName'],'type':_0x4f178c[_0x144c('0x2f')][_0x144c('0x30')]};});_0x4295f3[_0x144c('0x31')]=_['map'](_0x2c8f5a,_0x144c('0x2b'));_0x4295f3['query']=_[_0x144c('0x32')](_0x444a95[_0x144c('0x33')]);_0x4295f3[_0x144c('0x34')]=_[_0x144c('0x35')](_0x4295f3[_0x144c('0x31')],_0x4295f3[_0x144c('0x33')]);_0x222095[_0x144c('0x36')]=_[_0x144c('0x35')](_0x4295f3['model'],qs['fields'](_0x444a95[_0x144c('0x33')]['fields']));_0x222095['attributes']=_0x222095[_0x144c('0x36')][_0x144c('0x37')]?_0x222095[_0x144c('0x36')]:_0x4295f3[_0x144c('0x31')];if(!_0x444a95['query'][_0x144c('0x38')](_0x144c('0x39'))){_0x222095[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x444a95['query'][_0x144c('0x20')]);_0x222095[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x444a95[_0x144c('0x33')][_0x144c('0x1d')]);}_0x222095['order']=qs[_0x144c('0x3a')](_0x444a95[_0x144c('0x33')][_0x144c('0x3a')]);_0x222095['where']=qs['filters'](_['pick'](_0x444a95['query'],_0x4295f3['filters']),_0x2c8f5a);if(_0x444a95[_0x144c('0x33')][_0x144c('0x3b')]){_0x222095[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x222095['where'],{'$or':_['map'](_0x2c8f5a,function(_0x574f3c){if(_0x574f3c[_0x144c('0x2f')]!==_0x144c('0x3e')){var _0x4825c2={};_0x4825c2[_0x574f3c[_0x144c('0x2b')]]={'$like':'%'+_0x444a95['query'][_0x144c('0x3b')]+'%'};return _0x4825c2;}})});}_0x222095=_[_0x144c('0x3d')]({},_0x222095,_0x444a95[_0x144c('0x3f')]);var _0x4351bd={'where':_0x222095['where']};return db['ZendeskConfiguration'][_0x144c('0x1f')](_0x4351bd)[_0x144c('0x26')](function(_0xe55f52){_0x2830d9[_0x144c('0x1f')]=_0xe55f52;if(_0x444a95[_0x144c('0x33')][_0x144c('0x40')]){_0x222095['include']=[{'all':!![]}];}return db[_0x144c('0x2e')]['findAll'](_0x222095);})[_0x144c('0x26')](function(_0x5e12de){_0x2830d9[_0x144c('0x41')]=_0x5e12de;return _0x2830d9;})[_0x144c('0x26')](respondWithFilteredResult(_0xb172bf,_0x222095))['catch'](handleError(_0xb172bf,null));};exports[_0x144c('0x42')]=function(_0x5ec78b,_0x3fd38e){var _0x7737ad={'raw':![],'where':{'id':_0x5ec78b[_0x144c('0x43')]['id']}},_0x199e12={};_0x199e12['model']=_[_0x144c('0x32')](db[_0x144c('0x2e')][_0x144c('0x44')]);_0x199e12[_0x144c('0x33')]=_['keys'](_0x5ec78b[_0x144c('0x33')]);_0x199e12[_0x144c('0x34')]=_['intersection'](_0x199e12[_0x144c('0x31')],_0x199e12['query']);_0x7737ad[_0x144c('0x36')]=_[_0x144c('0x35')](_0x199e12[_0x144c('0x31')],qs[_0x144c('0x45')](_0x5ec78b['query'][_0x144c('0x45')]));_0x7737ad[_0x144c('0x36')]=_0x7737ad[_0x144c('0x36')][_0x144c('0x37')]?_0x7737ad[_0x144c('0x36')]:_0x199e12[_0x144c('0x31')];if(_0x5ec78b[_0x144c('0x33')][_0x144c('0x40')]){_0x7737ad[_0x144c('0x46')]=[{'all':!![]}];}_0x7737ad=_[_0x144c('0x3d')]({},_0x7737ad,_0x5ec78b[_0x144c('0x3f')]);return db[_0x144c('0x2e')]['find'](_0x7737ad)['then'](handleEntityNotFound(_0x3fd38e,null))[_0x144c('0x26')](respondWithResult(_0x3fd38e,null))[_0x144c('0x47')](handleError(_0x3fd38e,null));};exports['create']=function(_0x516430,_0x415177){return db[_0x144c('0x2e')]['create'](_0x516430[_0x144c('0x48')],{})[_0x144c('0x26')](respondWithResult(_0x415177,0xc9))[_0x144c('0x47')](handleError(_0x415177,null));};exports['update']=function(_0x476d54,_0x3d1bcb){if(_0x476d54[_0x144c('0x48')]['id']){delete _0x476d54[_0x144c('0x48')]['id'];}return db[_0x144c('0x2e')]['find']({'where':{'id':_0x476d54[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x3d1bcb,null))['then'](saveUpdates(_0x476d54[_0x144c('0x48')],null))[_0x144c('0x26')](respondWithResult(_0x3d1bcb,null))[_0x144c('0x47')](handleError(_0x3d1bcb,null));};exports[_0x144c('0x27')]=function(_0x1100d6,_0x36f37){return db[_0x144c('0x2e')][_0x144c('0x49')]({'where':{'id':_0x1100d6[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x36f37,null))[_0x144c('0x26')](removeEntity(_0x36f37,null))[_0x144c('0x47')](handleError(_0x36f37,null));};exports[_0x144c('0x4a')]=function(_0x75b6f7,_0x1338ae,_0x1ece7e){var _0x2dec1d={};var _0x53be16={};var _0x16c966;var _0x3580e3;return db['ZendeskConfiguration'][_0x144c('0x4b')]({'where':{'id':_0x75b6f7[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x1338ae,null))['then'](function(_0x49c3b8){if(_0x49c3b8){_0x16c966=_0x49c3b8;_0x53be16[_0x144c('0x31')]=_[_0x144c('0x32')](db['ZendeskField'][_0x144c('0x44')]);_0x53be16[_0x144c('0x33')]=_['keys'](_0x75b6f7[_0x144c('0x33')]);_0x53be16[_0x144c('0x34')]=_[_0x144c('0x35')](_0x53be16[_0x144c('0x31')],_0x53be16['query']);_0x2dec1d[_0x144c('0x36')]=_[_0x144c('0x35')](_0x53be16['model'],qs[_0x144c('0x45')](_0x75b6f7[_0x144c('0x33')][_0x144c('0x45')]));_0x2dec1d[_0x144c('0x36')]=_0x2dec1d[_0x144c('0x36')][_0x144c('0x37')]?_0x2dec1d[_0x144c('0x36')]:_0x53be16[_0x144c('0x31')];_0x2dec1d[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x75b6f7['query']['sort']);_0x2dec1d[_0x144c('0x3c')]=qs['filters'](_[_0x144c('0x4d')](_0x75b6f7[_0x144c('0x33')],_0x53be16['filters']));if(_0x75b6f7[_0x144c('0x33')][_0x144c('0x3b')]){_0x2dec1d[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x2dec1d[_0x144c('0x3c')],{'$or':_['map'](_0x2dec1d[_0x144c('0x36')],function(_0x2b881d){var _0x6b743b={};_0x6b743b[_0x2b881d]={'$like':'%'+_0x75b6f7['query'][_0x144c('0x3b')]+'%'};return _0x6b743b;})});}_0x2dec1d=_[_0x144c('0x3d')]({},_0x2dec1d,_0x75b6f7[_0x144c('0x3f')]);return _0x16c966[_0x144c('0x4a')](_0x2dec1d);}})['then'](function(_0x28f732){if(_0x28f732){_0x3580e3=_0x28f732[_0x144c('0x37')];if(!_0x75b6f7[_0x144c('0x33')][_0x144c('0x38')](_0x144c('0x39'))){_0x2dec1d[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x75b6f7[_0x144c('0x33')]['limit']);_0x2dec1d[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x75b6f7[_0x144c('0x33')][_0x144c('0x1d')]);}return _0x16c966['getFields'](_0x2dec1d);}})[_0x144c('0x26')](function(_0xea5496){if(_0xea5496){return _0xea5496?{'count':_0x3580e3,'rows':_0xea5496}:null;}})[_0x144c('0x26')](respondWithResult(_0x1338ae,null))['catch'](handleError(_0x1338ae,null));};exports[_0x144c('0x4e')]=function(_0x571409,_0x2a50c5,_0x31158b){var _0x1b7450={};var _0x2abf09={};var _0x220783;var _0x3c73b2;return db['ZendeskConfiguration'][_0x144c('0x4b')]({'where':{'id':_0x571409[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x2a50c5,null))[_0x144c('0x26')](function(_0x50e3fd){if(_0x50e3fd){_0x220783=_0x50e3fd;_0x2abf09[_0x144c('0x31')]=_['keys'](db[_0x144c('0x4f')]['rawAttributes']);_0x2abf09[_0x144c('0x33')]=_['keys'](_0x571409['query']);_0x2abf09[_0x144c('0x34')]=_[_0x144c('0x35')](_0x2abf09[_0x144c('0x31')],_0x2abf09[_0x144c('0x33')]);_0x1b7450[_0x144c('0x36')]=_[_0x144c('0x35')](_0x2abf09[_0x144c('0x31')],qs[_0x144c('0x45')](_0x571409[_0x144c('0x33')][_0x144c('0x45')]));_0x1b7450[_0x144c('0x36')]=_0x1b7450['attributes'][_0x144c('0x37')]?_0x1b7450['attributes']:_0x2abf09['model'];_0x1b7450[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x571409['query'][_0x144c('0x3a')]);_0x1b7450[_0x144c('0x3c')]=qs['filters'](_[_0x144c('0x4d')](_0x571409[_0x144c('0x33')],_0x2abf09[_0x144c('0x34')]));if(_0x571409[_0x144c('0x33')][_0x144c('0x3b')]){_0x1b7450[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x1b7450['where'],{'$or':_[_0x144c('0x2d')](_0x1b7450['attributes'],function(_0x156d19){var _0x363cfd={};_0x363cfd[_0x156d19]={'$like':'%'+_0x571409[_0x144c('0x33')]['filter']+'%'};return _0x363cfd;})});}_0x1b7450=_['merge']({},_0x1b7450,_0x571409[_0x144c('0x3f')]);return _0x220783[_0x144c('0x4e')](_0x1b7450);}})[_0x144c('0x26')](function(_0x2f85b6){if(_0x2f85b6){_0x3c73b2=_0x2f85b6[_0x144c('0x37')];if(!_0x571409[_0x144c('0x33')][_0x144c('0x38')](_0x144c('0x39'))){_0x1b7450[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x571409[_0x144c('0x33')][_0x144c('0x20')]);_0x1b7450[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x571409['query'][_0x144c('0x1d')]);}return _0x220783['getSubjects'](_0x1b7450);}})[_0x144c('0x26')](function(_0xc1f081){if(_0xc1f081){return _0xc1f081?{'count':_0x3c73b2,'rows':_0xc1f081}:null;}})[_0x144c('0x26')](respondWithResult(_0x2a50c5,null))['catch'](handleError(_0x2a50c5,null));};exports['getDescriptions']=function(_0x23be72,_0x4dd243,_0x35331d){var _0x4ca8b5={};var _0x3449c7={};var _0x25189c;var _0x18175c;return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x23be72[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x4dd243,null))['then'](function(_0x156172){if(_0x156172){_0x25189c=_0x156172;_0x3449c7[_0x144c('0x31')]=_[_0x144c('0x32')](db[_0x144c('0x4f')][_0x144c('0x44')]);_0x3449c7[_0x144c('0x33')]=_[_0x144c('0x32')](_0x23be72[_0x144c('0x33')]);_0x3449c7['filters']=_[_0x144c('0x35')](_0x3449c7[_0x144c('0x31')],_0x3449c7[_0x144c('0x33')]);_0x4ca8b5[_0x144c('0x36')]=_[_0x144c('0x35')](_0x3449c7['model'],qs[_0x144c('0x45')](_0x23be72[_0x144c('0x33')][_0x144c('0x45')]));_0x4ca8b5['attributes']=_0x4ca8b5[_0x144c('0x36')]['length']?_0x4ca8b5[_0x144c('0x36')]:_0x3449c7[_0x144c('0x31')];_0x4ca8b5[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x23be72[_0x144c('0x33')]['sort']);_0x4ca8b5[_0x144c('0x3c')]=qs[_0x144c('0x34')](_[_0x144c('0x4d')](_0x23be72[_0x144c('0x33')],_0x3449c7[_0x144c('0x34')]));if(_0x23be72[_0x144c('0x33')][_0x144c('0x3b')]){_0x4ca8b5['where']=_[_0x144c('0x3d')](_0x4ca8b5[_0x144c('0x3c')],{'$or':_[_0x144c('0x2d')](_0x4ca8b5[_0x144c('0x36')],function(_0x182d78){var _0xb41f6a={};_0xb41f6a[_0x182d78]={'$like':'%'+_0x23be72['query'][_0x144c('0x3b')]+'%'};return _0xb41f6a;})});}_0x4ca8b5=_[_0x144c('0x3d')]({},_0x4ca8b5,_0x23be72['options']);return _0x25189c[_0x144c('0x50')](_0x4ca8b5);}})[_0x144c('0x26')](function(_0x99648b){if(_0x99648b){_0x18175c=_0x99648b['length'];if(!_0x23be72[_0x144c('0x33')][_0x144c('0x38')]('nolimit')){_0x4ca8b5[_0x144c('0x20')]=qs['limit'](_0x23be72[_0x144c('0x33')]['limit']);_0x4ca8b5[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x23be72[_0x144c('0x33')][_0x144c('0x1d')]);}return _0x25189c[_0x144c('0x50')](_0x4ca8b5);}})['then'](function(_0x2c379f){if(_0x2c379f){return _0x2c379f?{'count':_0x18175c,'rows':_0x2c379f}:null;}})[_0x144c('0x26')](respondWithResult(_0x4dd243,null))[_0x144c('0x47')](handleError(_0x4dd243,null));};exports['getTags']=function(_0x426519,_0x4f2cd3,_0x2e6734){var _0x46be1a={};var _0x20605a={};var _0x2c545d;var _0x42f10f;return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x426519[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f2cd3,null))[_0x144c('0x26')](function(_0x2aadd0){if(_0x2aadd0){_0x2c545d=_0x2aadd0;_0x20605a['model']=_[_0x144c('0x32')](db[_0x144c('0x51')][_0x144c('0x44')]);_0x20605a[_0x144c('0x33')]=_[_0x144c('0x32')](_0x426519[_0x144c('0x33')]);_0x20605a[_0x144c('0x34')]=_['intersection'](_0x20605a[_0x144c('0x31')],_0x20605a[_0x144c('0x33')]);_0x46be1a[_0x144c('0x36')]=_[_0x144c('0x35')](_0x20605a['model'],qs['fields'](_0x426519['query']['fields']));_0x46be1a['attributes']=_0x46be1a[_0x144c('0x36')][_0x144c('0x37')]?_0x46be1a[_0x144c('0x36')]:_0x20605a[_0x144c('0x31')];_0x46be1a[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x426519[_0x144c('0x33')][_0x144c('0x3a')]);_0x46be1a['where']=qs[_0x144c('0x34')](_['pick'](_0x426519[_0x144c('0x33')],_0x20605a['filters']));if(_0x426519[_0x144c('0x33')][_0x144c('0x3b')]){_0x46be1a['where']=_['merge'](_0x46be1a[_0x144c('0x3c')],{'$or':_['map'](_0x46be1a[_0x144c('0x36')],function(_0x1609a0){var _0x39345a={};_0x39345a[_0x1609a0]={'$like':'%'+_0x426519[_0x144c('0x33')][_0x144c('0x3b')]+'%'};return _0x39345a;})});}_0x46be1a=_['merge']({},_0x46be1a,_0x426519[_0x144c('0x3f')]);return _0x2c545d[_0x144c('0x52')](_0x46be1a);}})[_0x144c('0x26')](function(_0xcb2211){if(_0xcb2211){_0x42f10f=_0xcb2211[_0x144c('0x37')];if(!_0x426519['query'][_0x144c('0x38')]('nolimit')){_0x46be1a[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x426519[_0x144c('0x33')][_0x144c('0x20')]);_0x46be1a[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x426519['query'][_0x144c('0x1d')]);}return _0x2c545d[_0x144c('0x52')](_0x46be1a);}})['then'](function(_0x3dfbb9){if(_0x3dfbb9){return _0x3dfbb9?{'count':_0x42f10f,'rows':_0x3dfbb9}:null;}})[_0x144c('0x26')](respondWithResult(_0x4f2cd3,null))[_0x144c('0x47')](handleError(_0x4f2cd3,null));};exports[_0x144c('0x53')]=function(_0x299f97,_0x1f4769,_0x5dad28){if(_0x299f97[_0x144c('0x48')]['id']){delete _0x299f97['body']['id'];}return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x299f97[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f4769,null))[_0x144c('0x26')](function(_0x24f349){if(_0x24f349){return _0x24f349['setTags'](_0x299f97[_0x144c('0x48')]['ids']||[]);}return null;})[_0x144c('0x26')](respondWithResult(_0x1f4769,null))[_0x144c('0x47')](handleError(_0x1f4769,null));}; \ No newline at end of file +var _0x4d6e=['findOne','ZendeskField','sort','options','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','zip-dir','moment','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','type','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getFields'];(function(_0x1f1366,_0x8232b9){var _0x155396=function(_0x56bfa3){while(--_0x56bfa3){_0x1f1366['push'](_0x1f1366['shift']());}};_0x155396(++_0x8232b9);}(_0x4d6e,0xf1));var _0xe4d6=function(_0x1db653,_0x3a9940){_0x1db653=_0x1db653-0x0;var _0x156348=_0x4d6e[_0x1db653];return _0x156348;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe4d6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4d6('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe4d6('0x2'));var csv=require(_0xe4d6('0x3'));var ejs=require(_0xe4d6('0x4'));var fs=require('fs');var fs_extra=require(_0xe4d6('0x5'));var _=require(_0xe4d6('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe4d6('0x7'));var toCsv=require(_0xe4d6('0x3'));var querystring=require(_0xe4d6('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe4d6('0x9'));var qs=require(_0xe4d6('0xa'));var as=require(_0xe4d6('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4d6('0xc'))(_0xe4d6('0xd'));var utils=require(_0xe4d6('0xe'));var config=require(_0xe4d6('0xf'));var licenseUtil=require(_0xe4d6('0x10'));var db=require(_0xe4d6('0x11'))['db'];function respondWithStatusCode(_0x436322,_0x178c4a){_0x178c4a=_0x178c4a||0xcc;return function(_0x165620){if(_0x165620){return _0x436322['sendStatus'](_0x178c4a);}return _0x436322['status'](_0x178c4a)[_0xe4d6('0x12')]();};}function respondWithResult(_0x37e343,_0x57e678){_0x57e678=_0x57e678||0xc8;return function(_0x2c8a6c){if(_0x2c8a6c){return _0x37e343[_0xe4d6('0x13')](_0x57e678)[_0xe4d6('0x14')](_0x2c8a6c);}};}function respondWithFilteredResult(_0x5a0f6a,_0x4ed6e1){return function(_0x4110f8){if(_0x4110f8){var _0x43624e=typeof _0x4ed6e1['offset']===_0xe4d6('0x15')&&typeof _0x4ed6e1[_0xe4d6('0x16')]===_0xe4d6('0x15');var _0x6ef5b0=_0x4110f8[_0xe4d6('0x17')];var _0x124115=_0x43624e?0x0:_0x4ed6e1['offset'];var _0x527117=_0x43624e?_0x4110f8[_0xe4d6('0x17')]:_0x4ed6e1[_0xe4d6('0x18')]+_0x4ed6e1['limit'];var _0x4f1928;if(_0x527117>=_0x6ef5b0){_0x527117=_0x6ef5b0;_0x4f1928=0xc8;}else{_0x4f1928=0xce;}_0x5a0f6a[_0xe4d6('0x13')](_0x4f1928);return _0x5a0f6a[_0xe4d6('0x19')](_0xe4d6('0x1a'),_0x124115+'-'+_0x527117+'/'+_0x6ef5b0)[_0xe4d6('0x14')](_0x4110f8);}return null;};}function patchUpdates(_0x5247c1){return function(_0x5e7abe){try{jsonpatch[_0xe4d6('0x1b')](_0x5e7abe,_0x5247c1,!![]);}catch(_0x5b4f0c){return BPromise[_0xe4d6('0x1c')](_0x5b4f0c);}return _0x5e7abe[_0xe4d6('0x1d')]();};}function saveUpdates(_0x2af901,_0x13c6a2){return function(_0x10abcc){if(_0x10abcc){return _0x10abcc[_0xe4d6('0x1e')](_0x2af901)[_0xe4d6('0x1f')](function(_0x5053e4){return _0x5053e4;});}return null;};}function removeEntity(_0x49a289,_0x28e691){return function(_0x2521f8){if(_0x2521f8){return _0x2521f8[_0xe4d6('0x20')]()[_0xe4d6('0x1f')](function(){_0x49a289[_0xe4d6('0x13')](0xcc)[_0xe4d6('0x12')]();});}};}function handleEntityNotFound(_0x2adeee,_0x32c762){return function(_0x320577){if(!_0x320577){_0x2adeee['sendStatus'](0x194);}return _0x320577;};}function handleError(_0x35208c,_0x5647c4){_0x5647c4=_0x5647c4||0x1f4;return function(_0x4998b7){logger[_0xe4d6('0x21')](_0x4998b7[_0xe4d6('0x22')]);if(_0x4998b7['name']){delete _0x4998b7['name'];}_0x35208c['status'](_0x5647c4)[_0xe4d6('0x23')](_0x4998b7);};}exports[_0xe4d6('0x24')]=function(_0x1740fb,_0x3dcba5){var _0x287b88={},_0xdcaa7f={},_0x24eb68={'count':0x0,'rows':[]};var _0x46f628=_[_0xe4d6('0x25')](db[_0xe4d6('0x26')][_0xe4d6('0x27')],function(_0x34f02f){return{'name':_0x34f02f['fieldName'],'type':_0x34f02f['type']['key']};});_0xdcaa7f[_0xe4d6('0x28')]=_[_0xe4d6('0x25')](_0x46f628,_0xe4d6('0x29'));_0xdcaa7f[_0xe4d6('0x2a')]=_['keys'](_0x1740fb[_0xe4d6('0x2a')]);_0xdcaa7f[_0xe4d6('0x2b')]=_[_0xe4d6('0x2c')](_0xdcaa7f[_0xe4d6('0x28')],_0xdcaa7f[_0xe4d6('0x2a')]);_0x287b88['attributes']=_[_0xe4d6('0x2c')](_0xdcaa7f[_0xe4d6('0x28')],qs[_0xe4d6('0x2d')](_0x1740fb[_0xe4d6('0x2a')]['fields']));_0x287b88[_0xe4d6('0x2e')]=_0x287b88[_0xe4d6('0x2e')][_0xe4d6('0x2f')]?_0x287b88[_0xe4d6('0x2e')]:_0xdcaa7f[_0xe4d6('0x28')];if(!_0x1740fb[_0xe4d6('0x2a')][_0xe4d6('0x30')]('nolimit')){_0x287b88[_0xe4d6('0x16')]=qs[_0xe4d6('0x16')](_0x1740fb['query'][_0xe4d6('0x16')]);_0x287b88[_0xe4d6('0x18')]=qs[_0xe4d6('0x18')](_0x1740fb[_0xe4d6('0x2a')]['offset']);}_0x287b88[_0xe4d6('0x31')]=qs['sort'](_0x1740fb[_0xe4d6('0x2a')]['sort']);_0x287b88[_0xe4d6('0x32')]=qs['filters'](_[_0xe4d6('0x33')](_0x1740fb[_0xe4d6('0x2a')],_0xdcaa7f[_0xe4d6('0x2b')]),_0x46f628);if(_0x1740fb[_0xe4d6('0x2a')][_0xe4d6('0x34')]){_0x287b88[_0xe4d6('0x32')]=_[_0xe4d6('0x35')](_0x287b88['where'],{'$or':_[_0xe4d6('0x25')](_0x46f628,function(_0x1a0025){if(_0x1a0025[_0xe4d6('0x36')]!=='VIRTUAL'){var _0x5c1002={};_0x5c1002[_0x1a0025[_0xe4d6('0x29')]]={'$like':'%'+_0x1740fb[_0xe4d6('0x2a')][_0xe4d6('0x34')]+'%'};return _0x5c1002;}})});}_0x287b88=_[_0xe4d6('0x35')]({},_0x287b88,_0x1740fb['options']);var _0x249f7c={'where':_0x287b88[_0xe4d6('0x32')]};return db[_0xe4d6('0x26')]['count'](_0x249f7c)[_0xe4d6('0x1f')](function(_0x1fb74a){_0x24eb68[_0xe4d6('0x17')]=_0x1fb74a;if(_0x1740fb['query']['includeAll']){_0x287b88[_0xe4d6('0x37')]=[{'all':!![]}];}return db[_0xe4d6('0x26')][_0xe4d6('0x38')](_0x287b88);})[_0xe4d6('0x1f')](function(_0x420242){_0x24eb68[_0xe4d6('0x39')]=_0x420242;return _0x24eb68;})[_0xe4d6('0x1f')](respondWithFilteredResult(_0x3dcba5,_0x287b88))[_0xe4d6('0x3a')](handleError(_0x3dcba5,null));};exports[_0xe4d6('0x3b')]=function(_0xb243e0,_0xdfe184){var _0x545468={'raw':![],'where':{'id':_0xb243e0[_0xe4d6('0x3c')]['id']}},_0xfbbf9b={};_0xfbbf9b[_0xe4d6('0x28')]=_[_0xe4d6('0x3d')](db[_0xe4d6('0x26')][_0xe4d6('0x27')]);_0xfbbf9b[_0xe4d6('0x2a')]=_[_0xe4d6('0x3d')](_0xb243e0[_0xe4d6('0x2a')]);_0xfbbf9b['filters']=_[_0xe4d6('0x2c')](_0xfbbf9b[_0xe4d6('0x28')],_0xfbbf9b[_0xe4d6('0x2a')]);_0x545468[_0xe4d6('0x2e')]=_[_0xe4d6('0x2c')](_0xfbbf9b[_0xe4d6('0x28')],qs[_0xe4d6('0x2d')](_0xb243e0['query'][_0xe4d6('0x2d')]));_0x545468[_0xe4d6('0x2e')]=_0x545468[_0xe4d6('0x2e')][_0xe4d6('0x2f')]?_0x545468[_0xe4d6('0x2e')]:_0xfbbf9b[_0xe4d6('0x28')];if(_0xb243e0[_0xe4d6('0x2a')][_0xe4d6('0x3e')]){_0x545468['include']=[{'all':!![]}];}_0x545468=_[_0xe4d6('0x35')]({},_0x545468,_0xb243e0['options']);return db[_0xe4d6('0x26')][_0xe4d6('0x3f')](_0x545468)[_0xe4d6('0x1f')](handleEntityNotFound(_0xdfe184,null))[_0xe4d6('0x1f')](respondWithResult(_0xdfe184,null))[_0xe4d6('0x3a')](handleError(_0xdfe184,null));};exports[_0xe4d6('0x40')]=function(_0x170081,_0x469820){return db[_0xe4d6('0x26')][_0xe4d6('0x40')](_0x170081[_0xe4d6('0x41')],{})[_0xe4d6('0x1f')](respondWithResult(_0x469820,0xc9))[_0xe4d6('0x3a')](handleError(_0x469820,null));};exports['update']=function(_0x91d97b,_0x5ac470){if(_0x91d97b[_0xe4d6('0x41')]['id']){delete _0x91d97b[_0xe4d6('0x41')]['id'];}return db[_0xe4d6('0x26')][_0xe4d6('0x3f')]({'where':{'id':_0x91d97b[_0xe4d6('0x3c')]['id']}})[_0xe4d6('0x1f')](handleEntityNotFound(_0x5ac470,null))['then'](saveUpdates(_0x91d97b[_0xe4d6('0x41')],null))[_0xe4d6('0x1f')](respondWithResult(_0x5ac470,null))[_0xe4d6('0x3a')](handleError(_0x5ac470,null));};exports['destroy']=function(_0x378913,_0x92b4ab){return db[_0xe4d6('0x26')][_0xe4d6('0x3f')]({'where':{'id':_0x378913[_0xe4d6('0x3c')]['id']}})[_0xe4d6('0x1f')](handleEntityNotFound(_0x92b4ab,null))[_0xe4d6('0x1f')](removeEntity(_0x92b4ab,null))['catch'](handleError(_0x92b4ab,null));};exports[_0xe4d6('0x42')]=function(_0x5a8f87,_0x216a6b,_0x198136){var _0x110058={};var _0x571ef9={};var _0x12999d;var _0x355447;return db['ZendeskConfiguration'][_0xe4d6('0x43')]({'where':{'id':_0x5a8f87['params']['id']}})[_0xe4d6('0x1f')](handleEntityNotFound(_0x216a6b,null))['then'](function(_0x41dced){if(_0x41dced){_0x12999d=_0x41dced;_0x571ef9[_0xe4d6('0x28')]=_['keys'](db[_0xe4d6('0x44')][_0xe4d6('0x27')]);_0x571ef9[_0xe4d6('0x2a')]=_['keys'](_0x5a8f87[_0xe4d6('0x2a')]);_0x571ef9[_0xe4d6('0x2b')]=_['intersection'](_0x571ef9['model'],_0x571ef9[_0xe4d6('0x2a')]);_0x110058[_0xe4d6('0x2e')]=_['intersection'](_0x571ef9['model'],qs['fields'](_0x5a8f87['query'][_0xe4d6('0x2d')]));_0x110058[_0xe4d6('0x2e')]=_0x110058[_0xe4d6('0x2e')]['length']?_0x110058['attributes']:_0x571ef9[_0xe4d6('0x28')];_0x110058['order']=qs[_0xe4d6('0x45')](_0x5a8f87[_0xe4d6('0x2a')]['sort']);_0x110058['where']=qs[_0xe4d6('0x2b')](_['pick'](_0x5a8f87[_0xe4d6('0x2a')],_0x571ef9[_0xe4d6('0x2b')]));if(_0x5a8f87[_0xe4d6('0x2a')][_0xe4d6('0x34')]){_0x110058[_0xe4d6('0x32')]=_['merge'](_0x110058[_0xe4d6('0x32')],{'$or':_[_0xe4d6('0x25')](_0x110058[_0xe4d6('0x2e')],function(_0x526458){var _0x578382={};_0x578382[_0x526458]={'$like':'%'+_0x5a8f87[_0xe4d6('0x2a')][_0xe4d6('0x34')]+'%'};return _0x578382;})});}_0x110058=_['merge']({},_0x110058,_0x5a8f87[_0xe4d6('0x46')]);return _0x12999d[_0xe4d6('0x42')](_0x110058);}})['then'](function(_0xd68c4f){if(_0xd68c4f){_0x355447=_0xd68c4f['length'];if(!_0x5a8f87['query'][_0xe4d6('0x30')](_0xe4d6('0x47'))){_0x110058['limit']=qs[_0xe4d6('0x16')](_0x5a8f87[_0xe4d6('0x2a')][_0xe4d6('0x16')]);_0x110058[_0xe4d6('0x18')]=qs[_0xe4d6('0x18')](_0x5a8f87['query'][_0xe4d6('0x18')]);}return _0x12999d['getFields'](_0x110058);}})['then'](function(_0x568951){if(_0x568951){return _0x568951?{'count':_0x355447,'rows':_0x568951}:null;}})[_0xe4d6('0x1f')](respondWithResult(_0x216a6b,null))[_0xe4d6('0x3a')](handleError(_0x216a6b,null));};exports[_0xe4d6('0x48')]=function(_0x919369,_0x20ceb5,_0x33334b){var _0x275d38={};var _0x33b1a9={};var _0x5e76c9;var _0x4af706;return db[_0xe4d6('0x26')][_0xe4d6('0x43')]({'where':{'id':_0x919369['params']['id']}})['then'](handleEntityNotFound(_0x20ceb5,null))['then'](function(_0x38aad2){if(_0x38aad2){_0x5e76c9=_0x38aad2;_0x33b1a9[_0xe4d6('0x28')]=_[_0xe4d6('0x3d')](db[_0xe4d6('0x44')]['rawAttributes']);_0x33b1a9[_0xe4d6('0x2a')]=_['keys'](_0x919369[_0xe4d6('0x2a')]);_0x33b1a9[_0xe4d6('0x2b')]=_['intersection'](_0x33b1a9[_0xe4d6('0x28')],_0x33b1a9['query']);_0x275d38[_0xe4d6('0x2e')]=_[_0xe4d6('0x2c')](_0x33b1a9['model'],qs[_0xe4d6('0x2d')](_0x919369['query'][_0xe4d6('0x2d')]));_0x275d38['attributes']=_0x275d38[_0xe4d6('0x2e')]['length']?_0x275d38[_0xe4d6('0x2e')]:_0x33b1a9['model'];_0x275d38[_0xe4d6('0x31')]=qs[_0xe4d6('0x45')](_0x919369[_0xe4d6('0x2a')][_0xe4d6('0x45')]);_0x275d38['where']=qs['filters'](_['pick'](_0x919369['query'],_0x33b1a9['filters']));if(_0x919369[_0xe4d6('0x2a')][_0xe4d6('0x34')]){_0x275d38[_0xe4d6('0x32')]=_[_0xe4d6('0x35')](_0x275d38['where'],{'$or':_[_0xe4d6('0x25')](_0x275d38[_0xe4d6('0x2e')],function(_0x38d842){var _0x2f2bbc={};_0x2f2bbc[_0x38d842]={'$like':'%'+_0x919369[_0xe4d6('0x2a')][_0xe4d6('0x34')]+'%'};return _0x2f2bbc;})});}_0x275d38=_['merge']({},_0x275d38,_0x919369['options']);return _0x5e76c9[_0xe4d6('0x48')](_0x275d38);}})[_0xe4d6('0x1f')](function(_0x3c07e3){if(_0x3c07e3){_0x4af706=_0x3c07e3[_0xe4d6('0x2f')];if(!_0x919369['query'][_0xe4d6('0x30')]('nolimit')){_0x275d38[_0xe4d6('0x16')]=qs['limit'](_0x919369[_0xe4d6('0x2a')][_0xe4d6('0x16')]);_0x275d38[_0xe4d6('0x18')]=qs[_0xe4d6('0x18')](_0x919369[_0xe4d6('0x2a')][_0xe4d6('0x18')]);}return _0x5e76c9['getSubjects'](_0x275d38);}})[_0xe4d6('0x1f')](function(_0x591648){if(_0x591648){return _0x591648?{'count':_0x4af706,'rows':_0x591648}:null;}})['then'](respondWithResult(_0x20ceb5,null))[_0xe4d6('0x3a')](handleError(_0x20ceb5,null));};exports[_0xe4d6('0x49')]=function(_0x593f17,_0x170e91,_0x4cea2f){var _0x55ace0={};var _0x2da463={};var _0xcd0794;var _0x5b2f6b;return db[_0xe4d6('0x26')][_0xe4d6('0x43')]({'where':{'id':_0x593f17[_0xe4d6('0x3c')]['id']}})[_0xe4d6('0x1f')](handleEntityNotFound(_0x170e91,null))[_0xe4d6('0x1f')](function(_0x4fa3cf){if(_0x4fa3cf){_0xcd0794=_0x4fa3cf;_0x2da463['model']=_[_0xe4d6('0x3d')](db['ZendeskField'][_0xe4d6('0x27')]);_0x2da463['query']=_[_0xe4d6('0x3d')](_0x593f17['query']);_0x2da463[_0xe4d6('0x2b')]=_['intersection'](_0x2da463['model'],_0x2da463[_0xe4d6('0x2a')]);_0x55ace0[_0xe4d6('0x2e')]=_[_0xe4d6('0x2c')](_0x2da463[_0xe4d6('0x28')],qs['fields'](_0x593f17['query'][_0xe4d6('0x2d')]));_0x55ace0[_0xe4d6('0x2e')]=_0x55ace0[_0xe4d6('0x2e')][_0xe4d6('0x2f')]?_0x55ace0[_0xe4d6('0x2e')]:_0x2da463['model'];_0x55ace0[_0xe4d6('0x31')]=qs[_0xe4d6('0x45')](_0x593f17[_0xe4d6('0x2a')][_0xe4d6('0x45')]);_0x55ace0[_0xe4d6('0x32')]=qs[_0xe4d6('0x2b')](_[_0xe4d6('0x33')](_0x593f17[_0xe4d6('0x2a')],_0x2da463[_0xe4d6('0x2b')]));if(_0x593f17[_0xe4d6('0x2a')]['filter']){_0x55ace0['where']=_['merge'](_0x55ace0[_0xe4d6('0x32')],{'$or':_[_0xe4d6('0x25')](_0x55ace0[_0xe4d6('0x2e')],function(_0x4d8ef0){var _0xfb15d6={};_0xfb15d6[_0x4d8ef0]={'$like':'%'+_0x593f17[_0xe4d6('0x2a')][_0xe4d6('0x34')]+'%'};return _0xfb15d6;})});}_0x55ace0=_[_0xe4d6('0x35')]({},_0x55ace0,_0x593f17[_0xe4d6('0x46')]);return _0xcd0794['getDescriptions'](_0x55ace0);}})[_0xe4d6('0x1f')](function(_0x2076fa){if(_0x2076fa){_0x5b2f6b=_0x2076fa[_0xe4d6('0x2f')];if(!_0x593f17[_0xe4d6('0x2a')]['hasOwnProperty'](_0xe4d6('0x47'))){_0x55ace0[_0xe4d6('0x16')]=qs[_0xe4d6('0x16')](_0x593f17[_0xe4d6('0x2a')][_0xe4d6('0x16')]);_0x55ace0[_0xe4d6('0x18')]=qs[_0xe4d6('0x18')](_0x593f17[_0xe4d6('0x2a')]['offset']);}return _0xcd0794[_0xe4d6('0x49')](_0x55ace0);}})[_0xe4d6('0x1f')](function(_0x25e12a){if(_0x25e12a){return _0x25e12a?{'count':_0x5b2f6b,'rows':_0x25e12a}:null;}})[_0xe4d6('0x1f')](respondWithResult(_0x170e91,null))[_0xe4d6('0x3a')](handleError(_0x170e91,null));};exports[_0xe4d6('0x4a')]=function(_0xfa9793,_0x178cd4,_0xd36711){var _0x16690f={};var _0x1cccd5={};var _0x20add6;var _0x294fe4;return db[_0xe4d6('0x26')][_0xe4d6('0x43')]({'where':{'id':_0xfa9793[_0xe4d6('0x3c')]['id']}})['then'](handleEntityNotFound(_0x178cd4,null))[_0xe4d6('0x1f')](function(_0xbf77e1){if(_0xbf77e1){_0x20add6=_0xbf77e1;_0x1cccd5[_0xe4d6('0x28')]=_[_0xe4d6('0x3d')](db[_0xe4d6('0x4b')][_0xe4d6('0x27')]);_0x1cccd5[_0xe4d6('0x2a')]=_[_0xe4d6('0x3d')](_0xfa9793[_0xe4d6('0x2a')]);_0x1cccd5[_0xe4d6('0x2b')]=_[_0xe4d6('0x2c')](_0x1cccd5[_0xe4d6('0x28')],_0x1cccd5[_0xe4d6('0x2a')]);_0x16690f[_0xe4d6('0x2e')]=_['intersection'](_0x1cccd5[_0xe4d6('0x28')],qs['fields'](_0xfa9793[_0xe4d6('0x2a')][_0xe4d6('0x2d')]));_0x16690f[_0xe4d6('0x2e')]=_0x16690f['attributes'][_0xe4d6('0x2f')]?_0x16690f[_0xe4d6('0x2e')]:_0x1cccd5[_0xe4d6('0x28')];_0x16690f['order']=qs['sort'](_0xfa9793[_0xe4d6('0x2a')][_0xe4d6('0x45')]);_0x16690f['where']=qs[_0xe4d6('0x2b')](_[_0xe4d6('0x33')](_0xfa9793[_0xe4d6('0x2a')],_0x1cccd5[_0xe4d6('0x2b')]));if(_0xfa9793['query'][_0xe4d6('0x34')]){_0x16690f['where']=_[_0xe4d6('0x35')](_0x16690f[_0xe4d6('0x32')],{'$or':_[_0xe4d6('0x25')](_0x16690f[_0xe4d6('0x2e')],function(_0x5581eb){var _0x5c81cf={};_0x5c81cf[_0x5581eb]={'$like':'%'+_0xfa9793[_0xe4d6('0x2a')][_0xe4d6('0x34')]+'%'};return _0x5c81cf;})});}_0x16690f=_[_0xe4d6('0x35')]({},_0x16690f,_0xfa9793[_0xe4d6('0x46')]);return _0x20add6[_0xe4d6('0x4a')](_0x16690f);}})[_0xe4d6('0x1f')](function(_0x2ca79f){if(_0x2ca79f){_0x294fe4=_0x2ca79f['length'];if(!_0xfa9793[_0xe4d6('0x2a')][_0xe4d6('0x30')](_0xe4d6('0x47'))){_0x16690f['limit']=qs['limit'](_0xfa9793[_0xe4d6('0x2a')]['limit']);_0x16690f['offset']=qs[_0xe4d6('0x18')](_0xfa9793['query'][_0xe4d6('0x18')]);}return _0x20add6[_0xe4d6('0x4a')](_0x16690f);}})[_0xe4d6('0x1f')](function(_0x58e602){if(_0x58e602){return _0x58e602?{'count':_0x294fe4,'rows':_0x58e602}:null;}})[_0xe4d6('0x1f')](respondWithResult(_0x178cd4,null))['catch'](handleError(_0x178cd4,null));};exports[_0xe4d6('0x4c')]=function(_0x4d6142,_0x5d36af,_0x44bf52){if(_0x4d6142['body']['id']){delete _0x4d6142['body']['id'];}return db[_0xe4d6('0x26')][_0xe4d6('0x43')]({'where':{'id':_0x4d6142[_0xe4d6('0x3c')]['id']}})[_0xe4d6('0x1f')](handleEntityNotFound(_0x5d36af,null))['then'](function(_0x365f2f){if(_0x365f2f){return _0x365f2f[_0xe4d6('0x4c')](_0x4d6142[_0xe4d6('0x41')]['ids']||[]);}return null;})[_0xe4d6('0x1f')](respondWithResult(_0x5d36af,null))[_0xe4d6('0x3a')](handleError(_0x5d36af,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 06861e2..76647a2 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 _0xdd4f=['exports','define','ZendeskConfiguration','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x143e5c,_0x1e8445){_0x143e5c=_0x143e5c-0x0;var _0x30406f=_0xdd4f[_0x143e5c];return _0x30406f;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a95=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x446dcf,_0x4052cb){var _0x276313=function(_0x42fb68){while(--_0x42fb68){_0x446dcf['push'](_0x446dcf['shift']());}};_0x276313(++_0x4052cb);}(_0x6a95,0x1db));var _0x56a9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x6a95[_0xc6be3a];return _0x56a310;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 5f72874..7c807ea 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 _0x1a21=['../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1a21,0xd8));var _0x11a2=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x1a21[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var moment=require(_0x11a2('0x2'));var BPromise=require(_0x11a2('0x3'));var rs=require(_0x11a2('0x4'));var fs=require('fs');var Redis=require(_0x11a2('0x5'));var db=require(_0x11a2('0x6'))['db'];var utils=require(_0x11a2('0x7'));var logger=require('../../config/logger')(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var jayson=require(_0x11a2('0xa'));var client=jayson[_0x11a2('0xb')][_0x11a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x282968,_0x3a84b0,_0x219545){return new BPromise(function(_0x51b866,_0x558893){return client[_0x11a2('0xd')](_0x282968,_0x219545)['then'](function(_0x5cd635){logger[_0x11a2('0xe')](_0x11a2('0xf'),_0x3a84b0,_0x11a2('0x10'));logger[_0x11a2('0x11')](_0x11a2('0x12'),_0x3a84b0,_0x11a2('0x10'),JSON[_0x11a2('0x13')](_0x5cd635));if(_0x5cd635['error']){if(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);return _0x558893(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);}logger[_0x11a2('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x5cd635['error'][_0x11a2('0x16')]);return _0x51b866(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);}else{logger['info'](_0x11a2('0xf'),_0x3a84b0,_0x11a2('0x10'));_0x51b866(_0x5cd635[_0x11a2('0x17')][_0x11a2('0x16')]);}})[_0x11a2('0x18')](function(_0x59629a){logger[_0x11a2('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x59629a);_0x558893(_0x59629a);});});} \ No newline at end of file +var _0x45dd=['ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x45dd,0x1d1));var _0xd45d=function(_0x5f3e16,_0x48e8bd){_0x5f3e16=_0x5f3e16-0x0;var _0x55f1a2=_0x45dd[_0x5f3e16];return _0x55f1a2;};'use strict';var _=require(_0xd45d('0x0'));var util=require(_0xd45d('0x1'));var moment=require(_0xd45d('0x2'));var BPromise=require(_0xd45d('0x3'));var rs=require(_0xd45d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd45d('0x5'))['db'];var utils=require(_0xd45d('0x6'));var logger=require('../../config/logger')(_0xd45d('0x7'));var config=require(_0xd45d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd45d('0x9')][_0xd45d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277211,_0x3792d4,_0x86cdb){return new BPromise(function(_0x2ff368,_0x37d1ae){return client['request'](_0x277211,_0x86cdb)[_0xd45d('0xb')](function(_0x2d2c30){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3792d4,_0xd45d('0xc'));logger[_0xd45d('0xd')](_0xd45d('0xe'),_0x3792d4,'request\x20sent',JSON[_0xd45d('0xf')](_0x2d2c30));if(_0x2d2c30[_0xd45d('0x10')]){if(_0x2d2c30['error'][_0xd45d('0x11')]===0x1f4){logger[_0xd45d('0x10')](_0xd45d('0x12'),_0x3792d4,_0x2d2c30[_0xd45d('0x10')][_0xd45d('0x13')]);return _0x37d1ae(_0x2d2c30['error']['message']);}logger[_0xd45d('0x10')](_0xd45d('0x12'),_0x3792d4,_0x2d2c30[_0xd45d('0x10')]['message']);return _0x2ff368(_0x2d2c30[_0xd45d('0x10')][_0xd45d('0x13')]);}else{logger[_0xd45d('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3792d4,'request\x20sent');_0x2ff368(_0x2d2c30[_0xd45d('0x15')][_0xd45d('0x13')]);}})[_0xd45d('0x16')](function(_0x1d5f28){logger[_0xd45d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3792d4,_0x1d5f28);_0x37d1ae(_0x1d5f28);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 62ed4f8..331d63c 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 _0x19d4=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4c39a6,_0x40191b){var _0x5ce442=function(_0x217edc){while(--_0x217edc){_0x4c39a6['push'](_0x4c39a6['shift']());}};_0x5ce442(++_0x40191b);}(_0x19d4,0xb3));var _0x419d=function(_0x39364c,_0x26d447){_0x39364c=_0x39364c-0x0;var _0x22c0b9=_0x19d4[_0x39364c];return _0x22c0b9;};'use strict';var multer=require(_0x419d('0x0'));var util=require(_0x419d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x419d('0x2'));var router=express[_0x419d('0x3')]();var fs_extra=require(_0x419d('0x4'));var auth=require(_0x419d('0x5'));var interaction=require(_0x419d('0x6'));var config=require(_0x419d('0x7'));var controller=require(_0x419d('0x8'));router['get']('/',auth[_0x419d('0x9')](),controller[_0x419d('0xa')]);router[_0x419d('0xb')](_0x419d('0xc'),auth['isAuthenticated'](),controller[_0x419d('0xd')]);router[_0x419d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x419d('0xf')](_0x419d('0xc'),auth['isAuthenticated'](),controller[_0x419d('0x10')]);router[_0x419d('0x11')](_0x419d('0xc'),auth[_0x419d('0x9')](),controller[_0x419d('0x12')]);module[_0x419d('0x13')]=router; \ No newline at end of file +var _0x6e1a=['connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskField.controller','index','get','/:id','show','create','put','update','delete','isAuthenticated','destroy','multer','util','path'];(function(_0x179b29,_0xea3cff){var _0x562a59=function(_0x5c641d){while(--_0x5c641d){_0x179b29['push'](_0x179b29['shift']());}};_0x562a59(++_0xea3cff);}(_0x6e1a,0x189));var _0xa6e1=function(_0xf2082a,_0x5f23f0){_0xf2082a=_0xf2082a-0x0;var _0x7bd01b=_0x6e1a[_0xf2082a];return _0x7bd01b;};'use strict';var multer=require(_0xa6e1('0x0'));var util=require(_0xa6e1('0x1'));var path=require(_0xa6e1('0x2'));var timeout=require(_0xa6e1('0x3'));var express=require(_0xa6e1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa6e1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa6e1('0x6'));var controller=require(_0xa6e1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa6e1('0x8')]);router[_0xa6e1('0x9')](_0xa6e1('0xa'),auth['isAuthenticated'](),controller[_0xa6e1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa6e1('0xc')]);router[_0xa6e1('0xd')](_0xa6e1('0xa'),auth['isAuthenticated'](),controller[_0xa6e1('0xe')]);router[_0xa6e1('0xf')](_0xa6e1('0xa'),auth[_0xa6e1('0x10')](),controller[_0xa6e1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index b23f5b0..0937411 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 _0x25c5=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x25bf9,_0x467adb){var _0x5642e5=function(_0x40b941){while(--_0x40b941){_0x25bf9['push'](_0x25bf9['shift']());}};_0x5642e5(++_0x467adb);}(_0x25c5,0x190));var _0x525c=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x25c5[_0x3f6565];return _0x4abd23;};'use strict';var Sequelize=require(_0x525c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x525c('0x1'),_0x525c('0x2'),_0x525c('0x3'),_0x525c('0x4'),_0x525c('0x5')),'defaultValue':_0x525c('0x1')},'content':{'type':Sequelize[_0x525c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x525c('0x7')](_0x525c('0x1'),_0x525c('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x525c('0x6')]},'idField':{'type':Sequelize[_0x525c('0x6')]},'nameField':{'type':Sequelize[_0x525c('0x6')]},'customField':{'type':Sequelize[_0x525c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x525c('0x6')]}}; \ No newline at end of file +var _0xf9b1=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string'];(function(_0x23ae00,_0x3f1ddb){var _0x4dd6f6=function(_0x29cb37){while(--_0x29cb37){_0x23ae00['push'](_0x23ae00['shift']());}};_0x4dd6f6(++_0x3f1ddb);}(_0xf9b1,0x7e));var _0x1f9b=function(_0x6e8378,_0x438891){_0x6e8378=_0x6e8378-0x0;var _0x4db20b=_0xf9b1[_0x6e8378];return _0x4db20b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1f9b('0x0')](_0x1f9b('0x1'),_0x1f9b('0x2'),_0x1f9b('0x3'),_0x1f9b('0x4'),_0x1f9b('0x5')),'defaultValue':_0x1f9b('0x1')},'content':{'type':Sequelize[_0x1f9b('0x6')]},'key':{'type':Sequelize[_0x1f9b('0x6')]},'keyType':{'type':Sequelize[_0x1f9b('0x0')](_0x1f9b('0x1'),_0x1f9b('0x2'),_0x1f9b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1f9b('0x6')]},'customField':{'type':Sequelize[_0x1f9b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f3e4daf..cff3ee7 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 _0x0111=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','save','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','length','include','find','catch'];(function(_0x1c0d3a,_0x5917c1){var _0x115215=function(_0x10688e){while(--_0x10688e){_0x1c0d3a['push'](_0x1c0d3a['shift']());}};_0x115215(++_0x5917c1);}(_0x0111,0x16f));var _0x1011=function(_0x1eaf93,_0x241082){_0x1eaf93=_0x1eaf93-0x0;var _0x2825bc=_0x0111[_0x1eaf93];return _0x2825bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1011('0x0'));var zipdir=require(_0x1011('0x1'));var jsonpatch=require(_0x1011('0x2'));var rp=require(_0x1011('0x3'));var moment=require('moment');var BPromise=require(_0x1011('0x4'));var Mustache=require(_0x1011('0x5'));var util=require(_0x1011('0x6'));var path=require(_0x1011('0x7'));var sox=require(_0x1011('0x8'));var csv=require('to-csv');var ejs=require(_0x1011('0x9'));var fs=require('fs');var fs_extra=require(_0x1011('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1011('0xb'));var jsforce=require(_0x1011('0xc'));var deskjs=require(_0x1011('0xd'));var toCsv=require(_0x1011('0xe'));var querystring=require(_0x1011('0xf'));var Papa=require(_0x1011('0x10'));var Redis=require(_0x1011('0x11'));var authService=require(_0x1011('0x12'));var qs=require(_0x1011('0x13'));var as=require(_0x1011('0x14'));var hardwareService=require(_0x1011('0x15'));var logger=require('../../config/logger')(_0x1011('0x16'));var utils=require(_0x1011('0x17'));var config=require(_0x1011('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1011('0x19'))['db'];function respondWithStatusCode(_0x1757f7,_0x3fb871){_0x3fb871=_0x3fb871||0xcc;return function(_0x356c9e){if(_0x356c9e){return _0x1757f7[_0x1011('0x1a')](_0x3fb871);}return _0x1757f7[_0x1011('0x1b')](_0x3fb871)[_0x1011('0x1c')]();};}function respondWithResult(_0x142a41,_0xd0039){_0xd0039=_0xd0039||0xc8;return function(_0x5e9b46){if(_0x5e9b46){return _0x142a41[_0x1011('0x1b')](_0xd0039)[_0x1011('0x1d')](_0x5e9b46);}};}function respondWithFilteredResult(_0x31735c,_0x1a115d){return function(_0x122fd3){if(_0x122fd3){var _0x5f1ce0=typeof _0x1a115d[_0x1011('0x1e')]===_0x1011('0x1f')&&typeof _0x1a115d[_0x1011('0x20')]===_0x1011('0x1f');var _0x2945cb=_0x122fd3['count'];var _0x16b044=_0x5f1ce0?0x0:_0x1a115d[_0x1011('0x1e')];var _0x141ad1=_0x5f1ce0?_0x122fd3['count']:_0x1a115d['offset']+_0x1a115d['limit'];var _0x27f704;if(_0x141ad1>=_0x2945cb){_0x141ad1=_0x2945cb;_0x27f704=0xc8;}else{_0x27f704=0xce;}_0x31735c[_0x1011('0x1b')](_0x27f704);return _0x31735c[_0x1011('0x21')]('Content-Range',_0x16b044+'-'+_0x141ad1+'/'+_0x2945cb)['json'](_0x122fd3);}return null;};}function patchUpdates(_0xc01626){return function(_0x1f804f){try{jsonpatch['apply'](_0x1f804f,_0xc01626,!![]);}catch(_0x2718a3){return BPromise['reject'](_0x2718a3);}return _0x1f804f[_0x1011('0x22')]();};}function saveUpdates(_0x4ae333,_0x59ba4e){return function(_0x97a2ef){if(_0x97a2ef){return _0x97a2ef[_0x1011('0x23')](_0x4ae333)[_0x1011('0x24')](function(_0x1bc8a0){return _0x1bc8a0;});}return null;};}function removeEntity(_0x52876f,_0x47f373){return function(_0x333b6a){if(_0x333b6a){return _0x333b6a[_0x1011('0x25')]()[_0x1011('0x24')](function(){_0x52876f[_0x1011('0x1b')](0xcc)[_0x1011('0x1c')]();});}};}function handleEntityNotFound(_0x8a6a76,_0xf50b86){return function(_0x33e865){if(!_0x33e865){_0x8a6a76[_0x1011('0x1a')](0x194);}return _0x33e865;};}function handleError(_0x18462b,_0x32cdc7){_0x32cdc7=_0x32cdc7||0x1f4;return function(_0x241af8){logger[_0x1011('0x26')](_0x241af8[_0x1011('0x27')]);if(_0x241af8['name']){delete _0x241af8[_0x1011('0x28')];}_0x18462b['status'](_0x32cdc7)[_0x1011('0x29')](_0x241af8);};}exports['index']=function(_0x5e1bca,_0x18aaac){var _0x1d41fc={},_0x1121e5={},_0x5a093b={'count':0x0,'rows':[]};var _0x28c991=_[_0x1011('0x2a')](db[_0x1011('0x2b')]['rawAttributes'],function(_0x4ba976){return{'name':_0x4ba976[_0x1011('0x2c')],'type':_0x4ba976[_0x1011('0x2d')]['key']};});_0x1121e5['model']=_[_0x1011('0x2a')](_0x28c991,_0x1011('0x28'));_0x1121e5['query']=_[_0x1011('0x2e')](_0x5e1bca['query']);_0x1121e5['filters']=_[_0x1011('0x2f')](_0x1121e5[_0x1011('0x30')],_0x1121e5[_0x1011('0x31')]);_0x1d41fc[_0x1011('0x32')]=_[_0x1011('0x2f')](_0x1121e5[_0x1011('0x30')],qs['fields'](_0x5e1bca[_0x1011('0x31')][_0x1011('0x33')]));_0x1d41fc['attributes']=_0x1d41fc[_0x1011('0x32')]['length']?_0x1d41fc[_0x1011('0x32')]:_0x1121e5[_0x1011('0x30')];if(!_0x5e1bca[_0x1011('0x31')][_0x1011('0x34')](_0x1011('0x35'))){_0x1d41fc[_0x1011('0x20')]=qs['limit'](_0x5e1bca[_0x1011('0x31')][_0x1011('0x20')]);_0x1d41fc[_0x1011('0x1e')]=qs[_0x1011('0x1e')](_0x5e1bca[_0x1011('0x31')][_0x1011('0x1e')]);}_0x1d41fc['order']=qs[_0x1011('0x36')](_0x5e1bca['query'][_0x1011('0x36')]);_0x1d41fc[_0x1011('0x37')]=qs[_0x1011('0x38')](_[_0x1011('0x39')](_0x5e1bca[_0x1011('0x31')],_0x1121e5[_0x1011('0x38')]),_0x28c991);if(_0x5e1bca[_0x1011('0x31')][_0x1011('0x3a')]){_0x1d41fc['where']=_[_0x1011('0x3b')](_0x1d41fc[_0x1011('0x37')],{'$or':_[_0x1011('0x2a')](_0x28c991,function(_0x2260dd){if(_0x2260dd[_0x1011('0x2d')]!==_0x1011('0x3c')){var _0x2eb971={};_0x2eb971[_0x2260dd[_0x1011('0x28')]]={'$like':'%'+_0x5e1bca['query'][_0x1011('0x3a')]+'%'};return _0x2eb971;}})});}_0x1d41fc=_['merge']({},_0x1d41fc,_0x5e1bca[_0x1011('0x3d')]);var _0x1200c8={'where':_0x1d41fc[_0x1011('0x37')]};return db[_0x1011('0x2b')][_0x1011('0x3e')](_0x1200c8)[_0x1011('0x24')](function(_0x2780f0){_0x5a093b[_0x1011('0x3e')]=_0x2780f0;if(_0x5e1bca[_0x1011('0x31')][_0x1011('0x3f')]){_0x1d41fc['include']=[{'all':!![]}];}return db[_0x1011('0x2b')][_0x1011('0x40')](_0x1d41fc);})[_0x1011('0x24')](function(_0x5b5ac7){_0x5a093b['rows']=_0x5b5ac7;return _0x5a093b;})[_0x1011('0x24')](respondWithFilteredResult(_0x18aaac,_0x1d41fc))['catch'](handleError(_0x18aaac,null));};exports[_0x1011('0x41')]=function(_0x5e5f2e,_0x24a759){var _0x7f5618={'raw':!![],'where':{'id':_0x5e5f2e[_0x1011('0x42')]['id']}},_0x1b0a7f={};_0x1b0a7f[_0x1011('0x30')]=_[_0x1011('0x2e')](db['ZendeskField']['rawAttributes']);_0x1b0a7f['query']=_[_0x1011('0x2e')](_0x5e5f2e[_0x1011('0x31')]);_0x1b0a7f[_0x1011('0x38')]=_['intersection'](_0x1b0a7f['model'],_0x1b0a7f['query']);_0x7f5618[_0x1011('0x32')]=_['intersection'](_0x1b0a7f[_0x1011('0x30')],qs[_0x1011('0x33')](_0x5e5f2e[_0x1011('0x31')][_0x1011('0x33')]));_0x7f5618[_0x1011('0x32')]=_0x7f5618[_0x1011('0x32')][_0x1011('0x43')]?_0x7f5618['attributes']:_0x1b0a7f['model'];if(_0x5e5f2e[_0x1011('0x31')][_0x1011('0x3f')]){_0x7f5618[_0x1011('0x44')]=[{'all':!![]}];}_0x7f5618=_[_0x1011('0x3b')]({},_0x7f5618,_0x5e5f2e['options']);return db['ZendeskField'][_0x1011('0x45')](_0x7f5618)[_0x1011('0x24')](handleEntityNotFound(_0x24a759,null))[_0x1011('0x24')](respondWithResult(_0x24a759,null))[_0x1011('0x46')](handleError(_0x24a759,null));};exports[_0x1011('0x47')]=function(_0x5c1e1d,_0x463263){return db['ZendeskField'][_0x1011('0x47')](_0x5c1e1d[_0x1011('0x48')],{})[_0x1011('0x24')](respondWithResult(_0x463263,0xc9))[_0x1011('0x46')](handleError(_0x463263,null));};exports[_0x1011('0x23')]=function(_0x4fecd5,_0x2c82a1){if(_0x4fecd5['body']['id']){delete _0x4fecd5['body']['id'];}return db[_0x1011('0x2b')]['find']({'where':{'id':_0x4fecd5[_0x1011('0x42')]['id']}})[_0x1011('0x24')](handleEntityNotFound(_0x2c82a1,null))['then'](saveUpdates(_0x4fecd5[_0x1011('0x48')],null))[_0x1011('0x24')](respondWithResult(_0x2c82a1,null))[_0x1011('0x46')](handleError(_0x2c82a1,null));};exports[_0x1011('0x25')]=function(_0x498e31,_0x26dec0){return db[_0x1011('0x2b')][_0x1011('0x45')]({'where':{'id':_0x498e31['params']['id']}})[_0x1011('0x24')](handleEntityNotFound(_0x26dec0,null))[_0x1011('0x24')](removeEntity(_0x26dec0,null))[_0x1011('0x46')](handleError(_0x26dec0,null));}; \ No newline at end of file +var _0x99b7=['status','end','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','filters','pick','filter','where','merge','VIRTUAL','include','ZendeskField','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x99b7,0x14e));var _0x799b=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x99b7[_0x368fb9];return _0x4892fb;};'use strict';var emlformat=require(_0x799b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x799b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x799b('0x2'));var Mustache=require(_0x799b('0x3'));var util=require(_0x799b('0x4'));var path=require('path');var sox=require(_0x799b('0x5'));var csv=require(_0x799b('0x6'));var ejs=require(_0x799b('0x7'));var fs=require('fs');var fs_extra=require(_0x799b('0x8'));var _=require(_0x799b('0x9'));var squel=require(_0x799b('0xa'));var crypto=require('crypto');var jsforce=require(_0x799b('0xb'));var deskjs=require(_0x799b('0xc'));var toCsv=require(_0x799b('0x6'));var querystring=require(_0x799b('0xd'));var Papa=require(_0x799b('0xe'));var Redis=require('ioredis');var authService=require(_0x799b('0xf'));var qs=require(_0x799b('0x10'));var as=require(_0x799b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x799b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x799b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x799b('0x14'))['db'];function respondWithStatusCode(_0x5d970d,_0x30a5e0){_0x30a5e0=_0x30a5e0||0xcc;return function(_0x4a6d53){if(_0x4a6d53){return _0x5d970d['sendStatus'](_0x30a5e0);}return _0x5d970d[_0x799b('0x15')](_0x30a5e0)[_0x799b('0x16')]();};}function respondWithResult(_0x28e749,_0x36d3cb){_0x36d3cb=_0x36d3cb||0xc8;return function(_0x3fbf4a){if(_0x3fbf4a){return _0x28e749[_0x799b('0x15')](_0x36d3cb)['json'](_0x3fbf4a);}};}function respondWithFilteredResult(_0x2efe00,_0x5187c1){return function(_0x45004c){if(_0x45004c){var _0x26b419=typeof _0x5187c1['offset']===_0x799b('0x17')&&typeof _0x5187c1[_0x799b('0x18')]==='undefined';var _0x140a04=_0x45004c[_0x799b('0x19')];var _0x3f5cbb=_0x26b419?0x0:_0x5187c1['offset'];var _0x51d53c=_0x26b419?_0x45004c[_0x799b('0x19')]:_0x5187c1['offset']+_0x5187c1[_0x799b('0x18')];var _0x70df1a;if(_0x51d53c>=_0x140a04){_0x51d53c=_0x140a04;_0x70df1a=0xc8;}else{_0x70df1a=0xce;}_0x2efe00['status'](_0x70df1a);return _0x2efe00['set'](_0x799b('0x1a'),_0x3f5cbb+'-'+_0x51d53c+'/'+_0x140a04)[_0x799b('0x1b')](_0x45004c);}return null;};}function patchUpdates(_0x590d88){return function(_0x1fdf0b){try{jsonpatch[_0x799b('0x1c')](_0x1fdf0b,_0x590d88,!![]);}catch(_0x4aef46){return BPromise[_0x799b('0x1d')](_0x4aef46);}return _0x1fdf0b['save']();};}function saveUpdates(_0x51f9bc,_0x4109dd){return function(_0x395925){if(_0x395925){return _0x395925['update'](_0x51f9bc)[_0x799b('0x1e')](function(_0x26d8ec){return _0x26d8ec;});}return null;};}function removeEntity(_0x2621a9,_0x362fc9){return function(_0x107e5e){if(_0x107e5e){return _0x107e5e[_0x799b('0x1f')]()[_0x799b('0x1e')](function(){_0x2621a9[_0x799b('0x15')](0xcc)[_0x799b('0x16')]();});}};}function handleEntityNotFound(_0xa42021,_0x301412){return function(_0x31c1fe){if(!_0x31c1fe){_0xa42021[_0x799b('0x20')](0x194);}return _0x31c1fe;};}function handleError(_0x3be9a0,_0x38a03e){_0x38a03e=_0x38a03e||0x1f4;return function(_0x4f151e){logger[_0x799b('0x21')](_0x4f151e[_0x799b('0x22')]);if(_0x4f151e[_0x799b('0x23')]){delete _0x4f151e[_0x799b('0x23')];}_0x3be9a0[_0x799b('0x15')](_0x38a03e)[_0x799b('0x24')](_0x4f151e);};}exports[_0x799b('0x25')]=function(_0x1b0339,_0x52dc90){var _0x1dd3ba={},_0x33d2e6={},_0x47bbba={'count':0x0,'rows':[]};var _0x5bf64a=_[_0x799b('0x26')](db['ZendeskField'][_0x799b('0x27')],function(_0x42d49e){return{'name':_0x42d49e['fieldName'],'type':_0x42d49e[_0x799b('0x28')][_0x799b('0x29')]};});_0x33d2e6[_0x799b('0x2a')]=_[_0x799b('0x26')](_0x5bf64a,'name');_0x33d2e6[_0x799b('0x2b')]=_['keys'](_0x1b0339[_0x799b('0x2b')]);_0x33d2e6['filters']=_['intersection'](_0x33d2e6[_0x799b('0x2a')],_0x33d2e6[_0x799b('0x2b')]);_0x1dd3ba[_0x799b('0x2c')]=_[_0x799b('0x2d')](_0x33d2e6[_0x799b('0x2a')],qs[_0x799b('0x2e')](_0x1b0339[_0x799b('0x2b')][_0x799b('0x2e')]));_0x1dd3ba[_0x799b('0x2c')]=_0x1dd3ba[_0x799b('0x2c')][_0x799b('0x2f')]?_0x1dd3ba[_0x799b('0x2c')]:_0x33d2e6[_0x799b('0x2a')];if(!_0x1b0339[_0x799b('0x2b')][_0x799b('0x30')](_0x799b('0x31'))){_0x1dd3ba[_0x799b('0x18')]=qs[_0x799b('0x18')](_0x1b0339[_0x799b('0x2b')][_0x799b('0x18')]);_0x1dd3ba[_0x799b('0x32')]=qs['offset'](_0x1b0339[_0x799b('0x2b')][_0x799b('0x32')]);}_0x1dd3ba['order']=qs[_0x799b('0x33')](_0x1b0339[_0x799b('0x2b')]['sort']);_0x1dd3ba['where']=qs[_0x799b('0x34')](_[_0x799b('0x35')](_0x1b0339['query'],_0x33d2e6[_0x799b('0x34')]),_0x5bf64a);if(_0x1b0339[_0x799b('0x2b')][_0x799b('0x36')]){_0x1dd3ba[_0x799b('0x37')]=_[_0x799b('0x38')](_0x1dd3ba[_0x799b('0x37')],{'$or':_['map'](_0x5bf64a,function(_0x489ae2){if(_0x489ae2[_0x799b('0x28')]!==_0x799b('0x39')){var _0x236c9f={};_0x236c9f[_0x489ae2[_0x799b('0x23')]]={'$like':'%'+_0x1b0339[_0x799b('0x2b')][_0x799b('0x36')]+'%'};return _0x236c9f;}})});}_0x1dd3ba=_[_0x799b('0x38')]({},_0x1dd3ba,_0x1b0339['options']);var _0x121992={'where':_0x1dd3ba['where']};return db['ZendeskField'][_0x799b('0x19')](_0x121992)[_0x799b('0x1e')](function(_0x391af7){_0x47bbba[_0x799b('0x19')]=_0x391af7;if(_0x1b0339['query']['includeAll']){_0x1dd3ba[_0x799b('0x3a')]=[{'all':!![]}];}return db[_0x799b('0x3b')][_0x799b('0x3c')](_0x1dd3ba);})['then'](function(_0x2f3c74){_0x47bbba[_0x799b('0x3d')]=_0x2f3c74;return _0x47bbba;})[_0x799b('0x1e')](respondWithFilteredResult(_0x52dc90,_0x1dd3ba))[_0x799b('0x3e')](handleError(_0x52dc90,null));};exports[_0x799b('0x3f')]=function(_0x4e6b7c,_0x385ce5){var _0xdfe52b={'raw':!![],'where':{'id':_0x4e6b7c['params']['id']}},_0x45a639={};_0x45a639[_0x799b('0x2a')]=_[_0x799b('0x40')](db['ZendeskField'][_0x799b('0x27')]);_0x45a639[_0x799b('0x2b')]=_[_0x799b('0x40')](_0x4e6b7c['query']);_0x45a639['filters']=_[_0x799b('0x2d')](_0x45a639[_0x799b('0x2a')],_0x45a639[_0x799b('0x2b')]);_0xdfe52b[_0x799b('0x2c')]=_[_0x799b('0x2d')](_0x45a639[_0x799b('0x2a')],qs['fields'](_0x4e6b7c[_0x799b('0x2b')][_0x799b('0x2e')]));_0xdfe52b[_0x799b('0x2c')]=_0xdfe52b[_0x799b('0x2c')][_0x799b('0x2f')]?_0xdfe52b[_0x799b('0x2c')]:_0x45a639[_0x799b('0x2a')];if(_0x4e6b7c[_0x799b('0x2b')][_0x799b('0x41')]){_0xdfe52b[_0x799b('0x3a')]=[{'all':!![]}];}_0xdfe52b=_[_0x799b('0x38')]({},_0xdfe52b,_0x4e6b7c[_0x799b('0x42')]);return db[_0x799b('0x3b')][_0x799b('0x43')](_0xdfe52b)[_0x799b('0x1e')](handleEntityNotFound(_0x385ce5,null))[_0x799b('0x1e')](respondWithResult(_0x385ce5,null))['catch'](handleError(_0x385ce5,null));};exports['create']=function(_0x120c57,_0x31a22){return db[_0x799b('0x3b')][_0x799b('0x44')](_0x120c57[_0x799b('0x45')],{})[_0x799b('0x1e')](respondWithResult(_0x31a22,0xc9))[_0x799b('0x3e')](handleError(_0x31a22,null));};exports['update']=function(_0x32a016,_0x10cf13){if(_0x32a016['body']['id']){delete _0x32a016[_0x799b('0x45')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x32a016[_0x799b('0x46')]['id']}})[_0x799b('0x1e')](handleEntityNotFound(_0x10cf13,null))[_0x799b('0x1e')](saveUpdates(_0x32a016[_0x799b('0x45')],null))[_0x799b('0x1e')](respondWithResult(_0x10cf13,null))[_0x799b('0x3e')](handleError(_0x10cf13,null));};exports[_0x799b('0x1f')]=function(_0x529f22,_0x5e42f9){return db[_0x799b('0x3b')][_0x799b('0x43')]({'where':{'id':_0x529f22['params']['id']}})[_0x799b('0x1e')](handleEntityNotFound(_0x5e42f9,null))[_0x799b('0x1e')](removeEntity(_0x5e42f9,null))[_0x799b('0x3e')](handleError(_0x5e42f9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 85e9d80..623aba4 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 _0xace8=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x281eb1,_0x294f80){var _0x5d60ec=function(_0x298c82){while(--_0x298c82){_0x281eb1['push'](_0x281eb1['shift']());}};_0x5d60ec(++_0x294f80);}(_0xace8,0x1d0));var _0x8ace=function(_0x3aaf78,_0x27aa1f){_0x3aaf78=_0x3aaf78-0x0;var _0x1c97b7=_0xace8[_0x3aaf78];return _0x1c97b7;};'use strict';var _=require(_0x8ace('0x0'));var util=require(_0x8ace('0x1'));var logger=require(_0x8ace('0x2'))(_0x8ace('0x3'));var moment=require(_0x8ace('0x4'));var BPromise=require(_0x8ace('0x5'));var rp=require(_0x8ace('0x6'));var fs=require('fs');var path=require(_0x8ace('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8ace('0x8'));module['exports']=function(_0x1a77ba,_0x1ebcc7){return _0x1a77ba[_0x8ace('0x9')](_0x8ace('0xa'),attributes,{'tableName':_0x8ace('0xb'),'paranoid':![],'indexes':[{'name':_0x8ace('0xc'),'fields':[_0x8ace('0xd'),_0x8ace('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba52=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x7770ed,_0x5a9549){var _0x1ddf2c=function(_0x2ea051){while(--_0x2ea051){_0x7770ed['push'](_0x7770ed['shift']());}};_0x1ddf2c(++_0x5a9549);}(_0xba52,0x1c3));var _0x2ba5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ba5('0x0'));var util=require(_0x2ba5('0x1'));var logger=require('../../config/logger')(_0x2ba5('0x2'));var moment=require(_0x2ba5('0x3'));var BPromise=require(_0x2ba5('0x4'));var rp=require(_0x2ba5('0x5'));var fs=require('fs');var path=require(_0x2ba5('0x6'));var rimraf=require(_0x2ba5('0x7'));var config=require(_0x2ba5('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x2ba5('0x9')]=function(_0xed9d,_0x42496f){return _0xed9d[_0x2ba5('0xa')]('ZendeskField',attributes,{'tableName':_0x2ba5('0xb'),'paranoid':![],'indexes':[{'name':_0x2ba5('0xc'),'fields':[_0x2ba5('0xd'),_0x2ba5('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 11c317c..f904937 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 _0x337a=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x51160c,_0x374b59){var _0x15a3fb=function(_0x5e81bc){while(--_0x5e81bc){_0x51160c['push'](_0x51160c['shift']());}};_0x15a3fb(++_0x374b59);}(_0x337a,0xcf));var _0xa337=function(_0x3da4a6,_0x38e3bd){_0x3da4a6=_0x3da4a6-0x0;var _0x4cf1bd=_0x337a[_0x3da4a6];return _0x4cf1bd;};'use strict';var _=require(_0xa337('0x0'));var util=require(_0xa337('0x1'));var moment=require(_0xa337('0x2'));var BPromise=require(_0xa337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa337('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa337('0x5'))(_0xa337('0x6'));var config=require(_0xa337('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa337('0x8')][_0xa337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x390d04,_0x39f4df,_0x49ad32){return new BPromise(function(_0x116e08,_0x1168fb){return client['request'](_0x390d04,_0x49ad32)[_0xa337('0xa')](function(_0x1511aa){logger[_0xa337('0xb')](_0xa337('0xc'),_0x39f4df,_0xa337('0xd'));logger[_0xa337('0xe')](_0xa337('0xf'),_0x39f4df,_0xa337('0xd'),JSON[_0xa337('0x10')](_0x1511aa));if(_0x1511aa[_0xa337('0x11')]){if(_0x1511aa[_0xa337('0x11')][_0xa337('0x12')]===0x1f4){logger[_0xa337('0x11')](_0xa337('0xc'),_0x39f4df,_0x1511aa[_0xa337('0x11')][_0xa337('0x13')]);return _0x1168fb(_0x1511aa['error'][_0xa337('0x13')]);}logger['error'](_0xa337('0xc'),_0x39f4df,_0x1511aa[_0xa337('0x11')][_0xa337('0x13')]);return _0x116e08(_0x1511aa[_0xa337('0x11')]['message']);}else{logger[_0xa337('0xb')]('ZendeskField,\x20%s,\x20%s',_0x39f4df,'request\x20sent');_0x116e08(_0x1511aa[_0xa337('0x14')][_0xa337('0x13')]);}})[_0xa337('0x15')](function(_0x3f9b0d){logger[_0xa337('0x11')](_0xa337('0xc'),_0x39f4df,_0x3f9b0d);_0x1168fb(_0x3f9b0d);});});} \ No newline at end of file +var _0xd7bc=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0xb95658,_0x1445cc){var _0x3c03e2=function(_0x24ca62){while(--_0x24ca62){_0xb95658['push'](_0xb95658['shift']());}};_0x3c03e2(++_0x1445cc);}(_0xd7bc,0xfb));var _0xcd7b=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xd7bc[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0xcd7b('0x0'));var util=require(_0xcd7b('0x1'));var moment=require(_0xcd7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd7b('0x3'));var db=require(_0xcd7b('0x4'))['db'];var utils=require(_0xcd7b('0x5'));var logger=require(_0xcd7b('0x6'))(_0xcd7b('0x7'));var config=require(_0xcd7b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcd7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20afcf,_0x52f200,_0x33c968){return new BPromise(function(_0x3d5441,_0x5171ec){return client['request'](_0x20afcf,_0x33c968)[_0xcd7b('0xa')](function(_0x3d8628){logger['info']('ZendeskField,\x20%s,\x20%s',_0x52f200,_0xcd7b('0xb'));logger['debug'](_0xcd7b('0xc'),_0x52f200,'request\x20sent',JSON[_0xcd7b('0xd')](_0x3d8628));if(_0x3d8628['error']){if(_0x3d8628[_0xcd7b('0xe')][_0xcd7b('0xf')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x52f200,_0x3d8628[_0xcd7b('0xe')][_0xcd7b('0x10')]);return _0x5171ec(_0x3d8628['error'][_0xcd7b('0x10')]);}logger[_0xcd7b('0xe')](_0xcd7b('0x11'),_0x52f200,_0x3d8628[_0xcd7b('0xe')][_0xcd7b('0x10')]);return _0x3d5441(_0x3d8628[_0xcd7b('0xe')][_0xcd7b('0x10')]);}else{logger[_0xcd7b('0x12')](_0xcd7b('0x11'),_0x52f200,_0xcd7b('0xb'));_0x3d5441(_0x3d8628[_0xcd7b('0x13')][_0xcd7b('0x10')]);}})[_0xcd7b('0x14')](function(_0x297557){logger[_0xcd7b('0xe')](_0xcd7b('0x11'),_0x52f200,_0x297557);_0x5171ec(_0x297557);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ad1d5d2..401275c 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 _0x35d6=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','getFields','post','/:id/configurations','update','delete','/:id','destroy','exports','multer','util'];(function(_0x44aa76,_0x2c9362){var _0x151ac7=function(_0x4f30a0){while(--_0x4f30a0){_0x44aa76['push'](_0x44aa76['shift']());}};_0x151ac7(++_0x2c9362);}(_0x35d6,0x1c6));var _0x635d=function(_0x115cc8,_0x5f3547){_0x115cc8=_0x115cc8-0x0;var _0x235dfc=_0x35d6[_0x115cc8];return _0x235dfc;};'use strict';var multer=require(_0x635d('0x0'));var util=require(_0x635d('0x1'));var path=require(_0x635d('0x2'));var timeout=require('connect-timeout');var express=require(_0x635d('0x3'));var router=express[_0x635d('0x4')]();var fs_extra=require(_0x635d('0x5'));var auth=require(_0x635d('0x6'));var interaction=require(_0x635d('0x7'));var config=require(_0x635d('0x8'));var controller=require('./intZohoAccount.controller');router[_0x635d('0x9')]('/',auth[_0x635d('0xa')](),controller['index']);router[_0x635d('0x9')]('/:id',auth[_0x635d('0xa')](),controller['show']);router[_0x635d('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x635d('0x9')]('/:id/fields',auth[_0x635d('0xa')](),controller[_0x635d('0xb')]);router[_0x635d('0xc')]('/',auth[_0x635d('0xa')](),controller['create']);router[_0x635d('0xc')](_0x635d('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x635d('0xe')]);router[_0x635d('0xf')](_0x635d('0x10'),auth[_0x635d('0xa')](),controller[_0x635d('0x11')]);module[_0x635d('0x12')]=router; \ No newline at end of file +var _0x5cc2=['../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2bc567,_0x2b3d6a){var _0x56dc06=function(_0xa7609){while(--_0xa7609){_0x2bc567['push'](_0x2bc567['shift']());}};_0x56dc06(++_0x2b3d6a);}(_0x5cc2,0x1f4));var _0x25cc=function(_0x4e1d78,_0x24f5a3){_0x4e1d78=_0x4e1d78-0x0;var _0x3932a9=_0x5cc2[_0x4e1d78];return _0x3932a9;};'use strict';var multer=require(_0x25cc('0x0'));var util=require(_0x25cc('0x1'));var path=require(_0x25cc('0x2'));var timeout=require(_0x25cc('0x3'));var express=require(_0x25cc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x25cc('0x5'));var interaction=require(_0x25cc('0x6'));var config=require('../../config/environment');var controller=require(_0x25cc('0x7'));router[_0x25cc('0x8')]('/',auth[_0x25cc('0x9')](),controller['index']);router[_0x25cc('0x8')]('/:id',auth[_0x25cc('0x9')](),controller[_0x25cc('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x25cc('0xb')]);router['get'](_0x25cc('0xc'),auth['isAuthenticated'](),controller[_0x25cc('0xd')]);router[_0x25cc('0xe')]('/',auth[_0x25cc('0x9')](),controller[_0x25cc('0xf')]);router['post'](_0x25cc('0x10'),auth['isAuthenticated'](),controller[_0x25cc('0x11')]);router[_0x25cc('0x12')](_0x25cc('0x13'),auth[_0x25cc('0x9')](),controller[_0x25cc('0x14')]);router[_0x25cc('0x15')](_0x25cc('0x13'),auth[_0x25cc('0x9')](),controller[_0x25cc('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ff0ea92..c96ac2f 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 _0xa8a8=['exports','STRING','sequelize'];(function(_0x3588ae,_0x423afe){var _0x386636=function(_0x2f1b5e){while(--_0x2f1b5e){_0x3588ae['push'](_0x3588ae['shift']());}};_0x386636(++_0x423afe);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2d2b47,_0x1e3e85){_0x2d2b47=_0x2d2b47-0x0;var _0x576c63=_0xa8a8[_0x2d2b47];return _0x576c63;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0x4ea3=['STRING','sequelize','exports'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0x4ea3,0x70));var _0x34ea=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ea3[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a66317a..9792d0a 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 _0x7c6e=['com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','ZohoAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZohoConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientSecret','code','zoho.eu'];(function(_0x5eff86,_0x2cdd22){var _0x4b3010=function(_0x319012){while(--_0x319012){_0x5eff86['push'](_0x5eff86['shift']());}};_0x4b3010(++_0x2cdd22);}(_0x7c6e,0x121));var _0xe7c6=function(_0x3f7dd4,_0x1b8904){_0x3f7dd4=_0x3f7dd4-0x0;var _0x2726e3=_0x7c6e[_0x3f7dd4];return _0x2726e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7c6('0x0'));var zipdir=require(_0xe7c6('0x1'));var jsonpatch=require(_0xe7c6('0x2'));var rp=require(_0xe7c6('0x3'));var moment=require(_0xe7c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe7c6('0x5'));var path=require(_0xe7c6('0x6'));var sox=require(_0xe7c6('0x7'));var csv=require(_0xe7c6('0x8'));var ejs=require(_0xe7c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe7c6('0xa'));var _=require(_0xe7c6('0xb'));var squel=require(_0xe7c6('0xc'));var crypto=require(_0xe7c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe7c6('0xe'));var toCsv=require(_0xe7c6('0x8'));var querystring=require(_0xe7c6('0xf'));var Papa=require(_0xe7c6('0x10'));var Redis=require(_0xe7c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe7c6('0x12'));var as=require(_0xe7c6('0x13'));var hardwareService=require(_0xe7c6('0x14'));var logger=require(_0xe7c6('0x15'))(_0xe7c6('0x16'));var utils=require('../../config/utils');var config=require(_0xe7c6('0x17'));var licenseUtil=require(_0xe7c6('0x18'));var db=require(_0xe7c6('0x19'))['db'];var integrations=require(_0xe7c6('0x1a'));function respondWithStatusCode(_0x1fdb16,_0x2e7898){_0x2e7898=_0x2e7898||0xcc;return function(_0x19d1ab){if(_0x19d1ab){return _0x1fdb16['sendStatus'](_0x2e7898);}return _0x1fdb16[_0xe7c6('0x1b')](_0x2e7898)[_0xe7c6('0x1c')]();};}function respondWithResult(_0x1f4c23,_0x10fa89){_0x10fa89=_0x10fa89||0xc8;return function(_0x3d7690){if(_0x3d7690){return _0x1f4c23['status'](_0x10fa89)[_0xe7c6('0x1d')](_0x3d7690);}};}function respondWithFilteredResult(_0x55aa2a,_0x177796){return function(_0x3b4586){if(_0x3b4586){var _0x429f69=typeof _0x177796[_0xe7c6('0x1e')]===_0xe7c6('0x1f')&&typeof _0x177796[_0xe7c6('0x20')]===_0xe7c6('0x1f');var _0x3dc145=_0x3b4586[_0xe7c6('0x21')];var _0x581c65=_0x429f69?0x0:_0x177796[_0xe7c6('0x1e')];var _0xe7af7e=_0x429f69?_0x3b4586['count']:_0x177796[_0xe7c6('0x1e')]+_0x177796[_0xe7c6('0x20')];var _0x294873;if(_0xe7af7e>=_0x3dc145){_0xe7af7e=_0x3dc145;_0x294873=0xc8;}else{_0x294873=0xce;}_0x55aa2a[_0xe7c6('0x1b')](_0x294873);return _0x55aa2a[_0xe7c6('0x22')](_0xe7c6('0x23'),_0x581c65+'-'+_0xe7af7e+'/'+_0x3dc145)['json'](_0x3b4586);}return null;};}function patchUpdates(_0x4da91b){return function(_0x4cc29d){try{jsonpatch[_0xe7c6('0x24')](_0x4cc29d,_0x4da91b,!![]);}catch(_0x1937a6){return BPromise[_0xe7c6('0x25')](_0x1937a6);}return _0x4cc29d[_0xe7c6('0x26')]();};}function saveUpdates(_0x3ac61c,_0x5c7296){return function(_0x538015){if(_0x538015){return _0x538015[_0xe7c6('0x27')](_0x3ac61c)[_0xe7c6('0x28')](function(_0x415af8){return _0x415af8;});}return null;};}function removeEntity(_0x16f747,_0x527f0d){return function(_0x3ad033){if(_0x3ad033){return _0x3ad033['destroy']()[_0xe7c6('0x28')](function(){_0x16f747[_0xe7c6('0x1b')](0xcc)[_0xe7c6('0x1c')]();});}};}function handleEntityNotFound(_0x3c1496,_0x56f0b3){return function(_0x190116){if(!_0x190116){_0x3c1496[_0xe7c6('0x29')](0x194);}return _0x190116;};}function handleError(_0x27b3a4,_0x2c9e6b){_0x2c9e6b=_0x2c9e6b||0x1f4;return function(_0x44998b){logger['error'](_0x44998b[_0xe7c6('0x2a')]);if(_0x44998b[_0xe7c6('0x2b')]){delete _0x44998b[_0xe7c6('0x2b')];}_0x27b3a4[_0xe7c6('0x1b')](_0x2c9e6b)['send'](_0x44998b);};}exports[_0xe7c6('0x2c')]=function(_0xd9a8db,_0x1d395f){var _0x1c342c={},_0x327e7c={},_0x54ff03={'count':0x0,'rows':[]};var _0x27cba9=_[_0xe7c6('0x2d')](db[_0xe7c6('0x2e')]['rawAttributes'],function(_0x4fb5d2){return{'name':_0x4fb5d2[_0xe7c6('0x2f')],'type':_0x4fb5d2[_0xe7c6('0x30')]['key']};});_0x327e7c[_0xe7c6('0x31')]=_[_0xe7c6('0x2d')](_0x27cba9,_0xe7c6('0x2b'));_0x327e7c[_0xe7c6('0x32')]=_[_0xe7c6('0x33')](_0xd9a8db[_0xe7c6('0x32')]);_0x327e7c[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x327e7c[_0xe7c6('0x31')],_0x327e7c[_0xe7c6('0x32')]);_0x1c342c[_0xe7c6('0x36')]=_[_0xe7c6('0x35')](_0x327e7c[_0xe7c6('0x31')],qs['fields'](_0xd9a8db['query'][_0xe7c6('0x37')]));_0x1c342c[_0xe7c6('0x36')]=_0x1c342c[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x1c342c['attributes']:_0x327e7c[_0xe7c6('0x31')];if(!_0xd9a8db[_0xe7c6('0x32')]['hasOwnProperty'](_0xe7c6('0x39'))){_0x1c342c[_0xe7c6('0x20')]=qs[_0xe7c6('0x20')](_0xd9a8db['query'][_0xe7c6('0x20')]);_0x1c342c[_0xe7c6('0x1e')]=qs['offset'](_0xd9a8db[_0xe7c6('0x32')][_0xe7c6('0x1e')]);}_0x1c342c[_0xe7c6('0x3a')]=qs[_0xe7c6('0x3b')](_0xd9a8db[_0xe7c6('0x32')]['sort']);_0x1c342c[_0xe7c6('0x3c')]=qs[_0xe7c6('0x34')](_[_0xe7c6('0x3d')](_0xd9a8db[_0xe7c6('0x32')],_0x327e7c[_0xe7c6('0x34')]),_0x27cba9);if(_0xd9a8db['query'][_0xe7c6('0x3e')]){_0x1c342c[_0xe7c6('0x3c')]=_[_0xe7c6('0x3f')](_0x1c342c['where'],{'$or':_[_0xe7c6('0x2d')](_0x27cba9,function(_0xc580c4){if(_0xc580c4[_0xe7c6('0x30')]!==_0xe7c6('0x40')){var _0x370f2b={};_0x370f2b[_0xc580c4['name']]={'$like':'%'+_0xd9a8db['query'][_0xe7c6('0x3e')]+'%'};return _0x370f2b;}})});}_0x1c342c=_[_0xe7c6('0x3f')]({},_0x1c342c,_0xd9a8db[_0xe7c6('0x41')]);var _0x35236b={'where':_0x1c342c[_0xe7c6('0x3c')]};return db[_0xe7c6('0x2e')][_0xe7c6('0x21')](_0x35236b)[_0xe7c6('0x28')](function(_0x2241be){_0x54ff03['count']=_0x2241be;if(_0xd9a8db[_0xe7c6('0x32')][_0xe7c6('0x42')]){_0x1c342c[_0xe7c6('0x43')]=[{'all':!![]}];}return db[_0xe7c6('0x2e')]['findAll'](_0x1c342c);})['then'](function(_0x2ec2cb){_0x54ff03['rows']=_0x2ec2cb;return _0x54ff03;})[_0xe7c6('0x28')](respondWithFilteredResult(_0x1d395f,_0x1c342c))[_0xe7c6('0x44')](handleError(_0x1d395f,null));};exports[_0xe7c6('0x45')]=function(_0xb474f6,_0x40d26b){var _0x1f250d={'raw':![],'where':{'id':_0xb474f6[_0xe7c6('0x46')]['id']}},_0x5b4740={};_0x5b4740[_0xe7c6('0x31')]=_[_0xe7c6('0x33')](db[_0xe7c6('0x2e')][_0xe7c6('0x47')]);_0x5b4740['query']=_[_0xe7c6('0x33')](_0xb474f6[_0xe7c6('0x32')]);_0x5b4740[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x5b4740[_0xe7c6('0x31')],_0x5b4740[_0xe7c6('0x32')]);_0x1f250d['attributes']=_[_0xe7c6('0x35')](_0x5b4740['model'],qs[_0xe7c6('0x37')](_0xb474f6['query'][_0xe7c6('0x37')]));_0x1f250d[_0xe7c6('0x36')]=_0x1f250d[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x1f250d[_0xe7c6('0x36')]:_0x5b4740[_0xe7c6('0x31')];if(_0xb474f6['query']['includeAll']){_0x1f250d[_0xe7c6('0x43')]=[{'all':!![]}];}_0x1f250d=_[_0xe7c6('0x3f')]({},_0x1f250d,_0xb474f6[_0xe7c6('0x41')]);return db[_0xe7c6('0x2e')]['find'](_0x1f250d)[_0xe7c6('0x28')](handleEntityNotFound(_0x40d26b,null))[_0xe7c6('0x28')](respondWithResult(_0x40d26b,null))[_0xe7c6('0x44')](handleError(_0x40d26b,null));};exports[_0xe7c6('0x48')]=function(_0xb69dce,_0x1f239b){return db[_0xe7c6('0x2e')][_0xe7c6('0x48')](_0xb69dce[_0xe7c6('0x49')],{})[_0xe7c6('0x28')](respondWithResult(_0x1f239b,0xc9))[_0xe7c6('0x44')](handleError(_0x1f239b,null));};exports[_0xe7c6('0x27')]=function(_0x2429a6,_0x31e401){if(_0x2429a6[_0xe7c6('0x49')]['id']){delete _0x2429a6['body']['id'];}return db['ZohoAccount'][_0xe7c6('0x4a')]({'where':{'id':_0x2429a6['params']['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0x31e401,null))[_0xe7c6('0x28')](saveUpdates(_0x2429a6[_0xe7c6('0x49')],null))[_0xe7c6('0x28')](respondWithResult(_0x31e401,null))[_0xe7c6('0x44')](handleError(_0x31e401,null));};exports['destroy']=function(_0x242251,_0xce13c3){return db[_0xe7c6('0x2e')]['find']({'where':{'id':_0x242251[_0xe7c6('0x46')]['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0xce13c3,null))[_0xe7c6('0x28')](removeEntity(_0xce13c3,null))[_0xe7c6('0x44')](handleError(_0xce13c3,null));};exports[_0xe7c6('0x4b')]=function(_0x47497f,_0x45409c,_0x43cc7b){var _0x5a2cf6={};var _0x2a4a31={};var _0x1372c9;var _0x3dd0d5;return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x47497f[_0xe7c6('0x46')]['id']}})['then'](handleEntityNotFound(_0x45409c,null))[_0xe7c6('0x28')](function(_0x19bd0e){if(_0x19bd0e){_0x1372c9=_0x19bd0e;_0x2a4a31[_0xe7c6('0x31')]=_['keys'](db[_0xe7c6('0x4d')]['rawAttributes']);_0x2a4a31[_0xe7c6('0x32')]=_[_0xe7c6('0x33')](_0x47497f[_0xe7c6('0x32')]);_0x2a4a31[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x2a4a31[_0xe7c6('0x31')],_0x2a4a31[_0xe7c6('0x32')]);_0x5a2cf6[_0xe7c6('0x36')]=_[_0xe7c6('0x35')](_0x2a4a31['model'],qs[_0xe7c6('0x37')](_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x37')]));_0x5a2cf6[_0xe7c6('0x36')]=_0x5a2cf6[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x5a2cf6[_0xe7c6('0x36')]:_0x2a4a31[_0xe7c6('0x31')];_0x5a2cf6['order']=qs['sort'](_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3b')]);_0x5a2cf6[_0xe7c6('0x3c')]=qs[_0xe7c6('0x34')](_[_0xe7c6('0x3d')](_0x47497f['query'],_0x2a4a31['filters']));if(_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3e')]){_0x5a2cf6[_0xe7c6('0x3c')]=_[_0xe7c6('0x3f')](_0x5a2cf6[_0xe7c6('0x3c')],{'$or':_['map'](_0x5a2cf6['attributes'],function(_0x1beb6f){var _0x2dfe44={};_0x2dfe44[_0x1beb6f]={'$like':'%'+_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3e')]+'%'};return _0x2dfe44;})});}_0x5a2cf6=_[_0xe7c6('0x3f')]({},_0x5a2cf6,_0x47497f['options']);return _0x1372c9[_0xe7c6('0x4b')](_0x5a2cf6);}})[_0xe7c6('0x28')](function(_0x50fcad){if(_0x50fcad){_0x3dd0d5=_0x50fcad[_0xe7c6('0x38')];if(!_0x47497f[_0xe7c6('0x32')]['hasOwnProperty'](_0xe7c6('0x39'))){_0x5a2cf6[_0xe7c6('0x20')]=qs[_0xe7c6('0x20')](_0x47497f['query'][_0xe7c6('0x20')]);_0x5a2cf6[_0xe7c6('0x1e')]=qs[_0xe7c6('0x1e')](_0x47497f[_0xe7c6('0x32')]['offset']);}return _0x1372c9[_0xe7c6('0x4b')](_0x5a2cf6);}})[_0xe7c6('0x28')](function(_0x377c69){if(_0x377c69){return _0x377c69?{'count':_0x3dd0d5,'rows':_0x377c69}:null;}})[_0xe7c6('0x28')](respondWithResult(_0x45409c,null))['catch'](handleError(_0x45409c,null));};exports['addConfiguration']=function(_0x42a937,_0x3f5a1a,_0x1c846b){if(_0x42a937[_0xe7c6('0x49')]['id']){delete _0x42a937[_0xe7c6('0x49')]['id'];}return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x42a937['params']['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0x3f5a1a,null))[_0xe7c6('0x28')](function(_0x241376){if(_0x241376){_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x4e')]=_0x241376['id'];_0x42a937['body'][_0xe7c6('0x4f')]=integrations[_0xe7c6('0x50')](_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x51')],_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x30')]);_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x52')]=integrations[_0xe7c6('0x53')](_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x51')],_0x42a937['body'][_0xe7c6('0x30')]);return db['ZohoConfiguration'][_0xe7c6('0x48')](_0x42a937[_0xe7c6('0x49')],{'include':[{'model':db['ZohoField'],'as':_0xe7c6('0x4f')},{'model':db[_0xe7c6('0x54')],'as':'Descriptions'}]});}return null;})[_0xe7c6('0x28')](respondWithResult(_0x3f5a1a,null))['catch'](handleError(_0x3f5a1a,null));};function getAccessToken(_0x554e09){return new Promise(function(_0xa78e8d,_0x51b11b){var _0xb7ff1;switch(_0x554e09['zone']){case'US':_0xb7ff1=_0xe7c6('0x55');break;case'AU':_0xb7ff1=_0xe7c6('0x56');break;case'EU':_0xb7ff1=_0xe7c6('0x57');break;case'IN':_0xb7ff1='https://accounts.zoho.in';break;case'CN':_0xb7ff1='https://accounts.zoho.com.cn';break;default:_0xb7ff1='https://accounts.zoho.eu';break;}var _0x4055bb={'method':'POST','uri':_0xb7ff1+_0xe7c6('0x58'),'qs':{'refresh_token':_0x554e09[_0xe7c6('0x59')],'client_id':_0x554e09[_0xe7c6('0x5a')],'client_secret':_0x554e09['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4055bb)[_0xe7c6('0x28')](function(_0x28452f){if(_0x28452f[_0xe7c6('0x5b')]){_0xa78e8d(_0x28452f[_0xe7c6('0x5b')]);}else{_0x51b11b(_0xe7c6('0x5c'));}})[_0xe7c6('0x44')](function(_0x5627b9){_0x51b11b(_0x5627b9);});});}exports['getFields']=function(_0x54646a,_0x367022,_0x47a252){var _0x1e877a,_0xea19e,_0x18f236,_0x4f0986,_0x3b36fd;return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x54646a['params']['id']},'attributes':['id',_0xe7c6('0x5d'),_0xe7c6('0x5e'),_0xe7c6('0x5a'),_0xe7c6('0x5f'),'serverUrl',_0xe7c6('0x60'),_0xe7c6('0x59')]})[_0xe7c6('0x28')](handleEntityNotFound(_0x367022,null))[_0xe7c6('0x28')](function(_0xbb6140){_0x3b36fd=_0xbb6140;_0x1e877a=_0x3b36fd['host'];_0xea19e=_0x1e877a===_0xe7c6('0x61')?'eu':_0xe7c6('0x62');_0x18f236=_0x3b36fd[_0xe7c6('0x63')];var _0x46df3b=_0x18f236[_0xe7c6('0x64')](-0x1);if(_0x46df3b==='/'||_0x46df3b==='\x5c'||_0x46df3b===':'){_0x18f236=_0x18f236[_0xe7c6('0x65')](0x0,_0x18f236[_0xe7c6('0x66')](_0x46df3b));}if(!_0x3b36fd[_0xe7c6('0x59')]){throw new Error(_0xe7c6('0x67'));}return getAccessToken(_0x3b36fd);})[_0xe7c6('0x28')](function(_0x3f1b0a){if(_0x3f1b0a){return rp({'method':_0xe7c6('0x68'),'uri':util['format'](_0xe7c6('0x69'),_0xea19e),'qs':{'module':_0xe7c6('0x6a')},'headers':{'Authorization':_0xe7c6('0x6b')+_0x3f1b0a},'json':!![]});}})[_0xe7c6('0x28')](function(_0x4f0cdf){if(_0x4f0cdf){if(_0x4f0cdf[_0xe7c6('0x6c')]&&_0x4f0cdf[_0xe7c6('0x6c')][_0xe7c6('0x6d')]){throw new Error(_0x4f0cdf[_0xe7c6('0x6c')][_0xe7c6('0x6d')][_0xe7c6('0x6e')]);}var _0x420b77=[];var _0xa3a266=[];var _0x22f3c0=[_0xe7c6('0x6f'),_0xe7c6('0x70'),'Description',_0xe7c6('0x71'),_0xe7c6('0x72'),_0xe7c6('0x73'),_0xe7c6('0x74'),'Call_Type'];_0xa3a266=_[_0xe7c6('0x75')](_0x4f0cdf[_0xe7c6('0x37')],function(_0x33f5aa){return _0x22f3c0[_0xe7c6('0x76')](_0x33f5aa[_0xe7c6('0x77')]);});for(var _0x12f478=0x0;_0x12f478<_0xa3a266['length'];_0x12f478++){if(_0xa3a266[_0x12f478][_0xe7c6('0x78')]===![]){_0x420b77['push']({'id':_0xa3a266[_0x12f478]['id'],'name':_0xa3a266[_0x12f478][_0xe7c6('0x79')],'custom':_0xa3a266[_0x12f478]['custom_field'],'options':_0xa3a266[_0x12f478][_0xe7c6('0x7a')]===_0xe7c6('0x7b')&&_0xa3a266[_0x12f478]['pick_list_values'][_0xe7c6('0x38')]>-0x1?_[_0xe7c6('0x2d')](_0xa3a266[_0x12f478][_0xe7c6('0x7c')],function(_0x876c37){return{'name':_0x876c37,'value':_0x876c37};}):[]});}}return{'count':_0x420b77[_0xe7c6('0x38')],'rows':_0x420b77};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x367022,null))[_0xe7c6('0x44')](function(_0x29844a){var _0x247cbc=_0x54646a['query'][_0xe7c6('0x7d')]?0x1f4:_0x29844a[_0xe7c6('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe7c6('0x7f'),_0x247cbc,JSON[_0xe7c6('0x80')](_0x29844a));delete _0x29844a[_0xe7c6('0x2b')];if(_0x247cbc===0x191){_0x247cbc=0x190;}_0x367022[_0xe7c6('0x1b')](_0x247cbc)['send'](_0x54646a['query'][_0xe7c6('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x29844a[_0xe7c6('0x7e')]}:_0x29844a);});}; \ No newline at end of file +var _0x42ad=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','ZohoAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','catch','show','params','includeAll','include','options','body','find','getConfigurations','findOne','ZohoConfiguration','rawAttributes','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','create','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','push','custom_field','data_type','picklist','pick_list_values','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0xf27b88,_0x43c542){var _0x6fd519=function(_0x46e55f){while(--_0x46e55f){_0xf27b88['push'](_0xf27b88['shift']());}};_0x6fd519(++_0x43c542);}(_0x42ad,0xed));var _0xd42a=function(_0x9dbfc6,_0x2c9e46){_0x9dbfc6=_0x9dbfc6-0x0;var _0x521cc5=_0x42ad[_0x9dbfc6];return _0x521cc5;};'use strict';var emlformat=require(_0xd42a('0x0'));var rimraf=require(_0xd42a('0x1'));var zipdir=require(_0xd42a('0x2'));var jsonpatch=require(_0xd42a('0x3'));var rp=require(_0xd42a('0x4'));var moment=require(_0xd42a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd42a('0x6'));var path=require(_0xd42a('0x7'));var sox=require(_0xd42a('0x8'));var csv=require('to-csv');var ejs=require(_0xd42a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd42a('0xa'));var squel=require('squel');var crypto=require(_0xd42a('0xb'));var jsforce=require(_0xd42a('0xc'));var deskjs=require(_0xd42a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd42a('0xe'));var Papa=require(_0xd42a('0xf'));var Redis=require('ioredis');var authService=require(_0xd42a('0x10'));var qs=require(_0xd42a('0x11'));var as=require(_0xd42a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd42a('0x13'))(_0xd42a('0x14'));var utils=require(_0xd42a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd42a('0x16'));var db=require(_0xd42a('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3dd873,_0x31f2f5){_0x31f2f5=_0x31f2f5||0xcc;return function(_0xc12eb3){if(_0xc12eb3){return _0x3dd873['sendStatus'](_0x31f2f5);}return _0x3dd873[_0xd42a('0x18')](_0x31f2f5)[_0xd42a('0x19')]();};}function respondWithResult(_0x33ef04,_0x5d1351){_0x5d1351=_0x5d1351||0xc8;return function(_0x192797){if(_0x192797){return _0x33ef04[_0xd42a('0x18')](_0x5d1351)[_0xd42a('0x1a')](_0x192797);}};}function respondWithFilteredResult(_0x8380de,_0x2ab718){return function(_0x568bc8){if(_0x568bc8){var _0x368803=typeof _0x2ab718[_0xd42a('0x1b')]===_0xd42a('0x1c')&&typeof _0x2ab718[_0xd42a('0x1d')]===_0xd42a('0x1c');var _0x35974c=_0x568bc8[_0xd42a('0x1e')];var _0x25ff38=_0x368803?0x0:_0x2ab718[_0xd42a('0x1b')];var _0x4fb2f3=_0x368803?_0x568bc8[_0xd42a('0x1e')]:_0x2ab718[_0xd42a('0x1b')]+_0x2ab718['limit'];var _0xdf5300;if(_0x4fb2f3>=_0x35974c){_0x4fb2f3=_0x35974c;_0xdf5300=0xc8;}else{_0xdf5300=0xce;}_0x8380de['status'](_0xdf5300);return _0x8380de[_0xd42a('0x1f')]('Content-Range',_0x25ff38+'-'+_0x4fb2f3+'/'+_0x35974c)['json'](_0x568bc8);}return null;};}function patchUpdates(_0x5472fc){return function(_0x2a603d){try{jsonpatch[_0xd42a('0x20')](_0x2a603d,_0x5472fc,!![]);}catch(_0x102bf8){return BPromise[_0xd42a('0x21')](_0x102bf8);}return _0x2a603d[_0xd42a('0x22')]();};}function saveUpdates(_0xa8755f,_0xc5e005){return function(_0x1fc228){if(_0x1fc228){return _0x1fc228['update'](_0xa8755f)[_0xd42a('0x23')](function(_0x54ea56){return _0x54ea56;});}return null;};}function removeEntity(_0x27b10a,_0x5da2bc){return function(_0x4bb963){if(_0x4bb963){return _0x4bb963[_0xd42a('0x24')]()['then'](function(){_0x27b10a[_0xd42a('0x18')](0xcc)[_0xd42a('0x19')]();});}};}function handleEntityNotFound(_0x2fed1c,_0x5b533e){return function(_0x5e0913){if(!_0x5e0913){_0x2fed1c[_0xd42a('0x25')](0x194);}return _0x5e0913;};}function handleError(_0x3f76e9,_0x4b26c8){_0x4b26c8=_0x4b26c8||0x1f4;return function(_0x5575cb){logger[_0xd42a('0x26')](_0x5575cb['stack']);if(_0x5575cb['name']){delete _0x5575cb[_0xd42a('0x27')];}_0x3f76e9['status'](_0x4b26c8)[_0xd42a('0x28')](_0x5575cb);};}exports[_0xd42a('0x29')]=function(_0x4989a1,_0x4dde61){var _0x1ea9ec={},_0x40692c={},_0x12bd23={'count':0x0,'rows':[]};var _0x54a174=_[_0xd42a('0x2a')](db[_0xd42a('0x2b')]['rawAttributes'],function(_0x5f24cf){return{'name':_0x5f24cf[_0xd42a('0x2c')],'type':_0x5f24cf['type'][_0xd42a('0x2d')]};});_0x40692c[_0xd42a('0x2e')]=_['map'](_0x54a174,_0xd42a('0x27'));_0x40692c[_0xd42a('0x2f')]=_[_0xd42a('0x30')](_0x4989a1['query']);_0x40692c[_0xd42a('0x31')]=_[_0xd42a('0x32')](_0x40692c['model'],_0x40692c[_0xd42a('0x2f')]);_0x1ea9ec['attributes']=_[_0xd42a('0x32')](_0x40692c[_0xd42a('0x2e')],qs['fields'](_0x4989a1[_0xd42a('0x2f')][_0xd42a('0x33')]));_0x1ea9ec[_0xd42a('0x34')]=_0x1ea9ec[_0xd42a('0x34')]['length']?_0x1ea9ec['attributes']:_0x40692c['model'];if(!_0x4989a1[_0xd42a('0x2f')]['hasOwnProperty'](_0xd42a('0x35'))){_0x1ea9ec['limit']=qs[_0xd42a('0x1d')](_0x4989a1[_0xd42a('0x2f')]['limit']);_0x1ea9ec[_0xd42a('0x1b')]=qs['offset'](_0x4989a1[_0xd42a('0x2f')][_0xd42a('0x1b')]);}_0x1ea9ec[_0xd42a('0x36')]=qs[_0xd42a('0x37')](_0x4989a1[_0xd42a('0x2f')][_0xd42a('0x37')]);_0x1ea9ec[_0xd42a('0x38')]=qs[_0xd42a('0x31')](_['pick'](_0x4989a1[_0xd42a('0x2f')],_0x40692c['filters']),_0x54a174);if(_0x4989a1[_0xd42a('0x2f')]['filter']){_0x1ea9ec['where']=_[_0xd42a('0x39')](_0x1ea9ec[_0xd42a('0x38')],{'$or':_[_0xd42a('0x2a')](_0x54a174,function(_0x1a75e4){if(_0x1a75e4['type']!==_0xd42a('0x3a')){var _0x4e7789={};_0x4e7789[_0x1a75e4[_0xd42a('0x27')]]={'$like':'%'+_0x4989a1[_0xd42a('0x2f')][_0xd42a('0x3b')]+'%'};return _0x4e7789;}})});}_0x1ea9ec=_[_0xd42a('0x39')]({},_0x1ea9ec,_0x4989a1['options']);var _0x30a177={'where':_0x1ea9ec[_0xd42a('0x38')]};return db[_0xd42a('0x2b')]['count'](_0x30a177)['then'](function(_0x308ba9){_0x12bd23[_0xd42a('0x1e')]=_0x308ba9;if(_0x4989a1['query']['includeAll']){_0x1ea9ec['include']=[{'all':!![]}];}return db[_0xd42a('0x2b')][_0xd42a('0x3c')](_0x1ea9ec);})[_0xd42a('0x23')](function(_0x1e216f){_0x12bd23[_0xd42a('0x3d')]=_0x1e216f;return _0x12bd23;})['then'](respondWithFilteredResult(_0x4dde61,_0x1ea9ec))[_0xd42a('0x3e')](handleError(_0x4dde61,null));};exports[_0xd42a('0x3f')]=function(_0x32eb94,_0x18b964){var _0x1e4898={'raw':![],'where':{'id':_0x32eb94[_0xd42a('0x40')]['id']}},_0x631fb9={};_0x631fb9[_0xd42a('0x2e')]=_[_0xd42a('0x30')](db[_0xd42a('0x2b')]['rawAttributes']);_0x631fb9['query']=_['keys'](_0x32eb94['query']);_0x631fb9['filters']=_[_0xd42a('0x32')](_0x631fb9[_0xd42a('0x2e')],_0x631fb9[_0xd42a('0x2f')]);_0x1e4898[_0xd42a('0x34')]=_[_0xd42a('0x32')](_0x631fb9[_0xd42a('0x2e')],qs['fields'](_0x32eb94['query'][_0xd42a('0x33')]));_0x1e4898[_0xd42a('0x34')]=_0x1e4898[_0xd42a('0x34')]['length']?_0x1e4898[_0xd42a('0x34')]:_0x631fb9[_0xd42a('0x2e')];if(_0x32eb94[_0xd42a('0x2f')][_0xd42a('0x41')]){_0x1e4898[_0xd42a('0x42')]=[{'all':!![]}];}_0x1e4898=_['merge']({},_0x1e4898,_0x32eb94[_0xd42a('0x43')]);return db[_0xd42a('0x2b')]['find'](_0x1e4898)[_0xd42a('0x23')](handleEntityNotFound(_0x18b964,null))[_0xd42a('0x23')](respondWithResult(_0x18b964,null))[_0xd42a('0x3e')](handleError(_0x18b964,null));};exports['create']=function(_0x164e3a,_0x2d6d49){return db[_0xd42a('0x2b')]['create'](_0x164e3a['body'],{})[_0xd42a('0x23')](respondWithResult(_0x2d6d49,0xc9))[_0xd42a('0x3e')](handleError(_0x2d6d49,null));};exports['update']=function(_0x3636c7,_0x2a4d67){if(_0x3636c7[_0xd42a('0x44')]['id']){delete _0x3636c7[_0xd42a('0x44')]['id'];}return db[_0xd42a('0x2b')][_0xd42a('0x45')]({'where':{'id':_0x3636c7[_0xd42a('0x40')]['id']}})[_0xd42a('0x23')](handleEntityNotFound(_0x2a4d67,null))[_0xd42a('0x23')](saveUpdates(_0x3636c7[_0xd42a('0x44')],null))[_0xd42a('0x23')](respondWithResult(_0x2a4d67,null))[_0xd42a('0x3e')](handleError(_0x2a4d67,null));};exports[_0xd42a('0x24')]=function(_0x5304b4,_0x25a0c0){return db[_0xd42a('0x2b')]['find']({'where':{'id':_0x5304b4[_0xd42a('0x40')]['id']}})['then'](handleEntityNotFound(_0x25a0c0,null))['then'](removeEntity(_0x25a0c0,null))['catch'](handleError(_0x25a0c0,null));};exports[_0xd42a('0x46')]=function(_0x73a56f,_0x5c0ec4,_0xf2c8b5){var _0xa358a2={};var _0x16a66d={};var _0x265c2c;var _0x8e64d5;return db[_0xd42a('0x2b')][_0xd42a('0x47')]({'where':{'id':_0x73a56f[_0xd42a('0x40')]['id']}})[_0xd42a('0x23')](handleEntityNotFound(_0x5c0ec4,null))['then'](function(_0x1bea46){if(_0x1bea46){_0x265c2c=_0x1bea46;_0x16a66d[_0xd42a('0x2e')]=_[_0xd42a('0x30')](db[_0xd42a('0x48')][_0xd42a('0x49')]);_0x16a66d[_0xd42a('0x2f')]=_[_0xd42a('0x30')](_0x73a56f[_0xd42a('0x2f')]);_0x16a66d[_0xd42a('0x31')]=_[_0xd42a('0x32')](_0x16a66d[_0xd42a('0x2e')],_0x16a66d[_0xd42a('0x2f')]);_0xa358a2[_0xd42a('0x34')]=_[_0xd42a('0x32')](_0x16a66d[_0xd42a('0x2e')],qs[_0xd42a('0x33')](_0x73a56f[_0xd42a('0x2f')][_0xd42a('0x33')]));_0xa358a2['attributes']=_0xa358a2[_0xd42a('0x34')][_0xd42a('0x4a')]?_0xa358a2['attributes']:_0x16a66d[_0xd42a('0x2e')];_0xa358a2[_0xd42a('0x36')]=qs[_0xd42a('0x37')](_0x73a56f[_0xd42a('0x2f')]['sort']);_0xa358a2[_0xd42a('0x38')]=qs['filters'](_[_0xd42a('0x4b')](_0x73a56f[_0xd42a('0x2f')],_0x16a66d['filters']));if(_0x73a56f[_0xd42a('0x2f')][_0xd42a('0x3b')]){_0xa358a2[_0xd42a('0x38')]=_[_0xd42a('0x39')](_0xa358a2[_0xd42a('0x38')],{'$or':_[_0xd42a('0x2a')](_0xa358a2['attributes'],function(_0x38c778){var _0x1fcdd5={};_0x1fcdd5[_0x38c778]={'$like':'%'+_0x73a56f[_0xd42a('0x2f')]['filter']+'%'};return _0x1fcdd5;})});}_0xa358a2=_['merge']({},_0xa358a2,_0x73a56f[_0xd42a('0x43')]);return _0x265c2c[_0xd42a('0x46')](_0xa358a2);}})[_0xd42a('0x23')](function(_0x11cdc7){if(_0x11cdc7){_0x8e64d5=_0x11cdc7[_0xd42a('0x4a')];if(!_0x73a56f[_0xd42a('0x2f')]['hasOwnProperty'](_0xd42a('0x35'))){_0xa358a2[_0xd42a('0x1d')]=qs[_0xd42a('0x1d')](_0x73a56f['query'][_0xd42a('0x1d')]);_0xa358a2[_0xd42a('0x1b')]=qs[_0xd42a('0x1b')](_0x73a56f[_0xd42a('0x2f')][_0xd42a('0x1b')]);}return _0x265c2c[_0xd42a('0x46')](_0xa358a2);}})[_0xd42a('0x23')](function(_0x2a5a3b){if(_0x2a5a3b){return _0x2a5a3b?{'count':_0x8e64d5,'rows':_0x2a5a3b}:null;}})['then'](respondWithResult(_0x5c0ec4,null))[_0xd42a('0x3e')](handleError(_0x5c0ec4,null));};exports[_0xd42a('0x4c')]=function(_0x108e22,_0x566ef8,_0x36349b){if(_0x108e22[_0xd42a('0x44')]['id']){delete _0x108e22[_0xd42a('0x44')]['id'];}return db[_0xd42a('0x2b')][_0xd42a('0x47')]({'where':{'id':_0x108e22[_0xd42a('0x40')]['id']}})[_0xd42a('0x23')](handleEntityNotFound(_0x566ef8,null))[_0xd42a('0x23')](function(_0x1b1bb9){if(_0x1b1bb9){_0x108e22[_0xd42a('0x44')][_0xd42a('0x4d')]=_0x1b1bb9['id'];_0x108e22['body'][_0xd42a('0x4e')]=integrations[_0xd42a('0x4f')](_0x108e22[_0xd42a('0x44')][_0xd42a('0x50')],_0x108e22[_0xd42a('0x44')][_0xd42a('0x51')]);_0x108e22['body']['Descriptions']=integrations[_0xd42a('0x52')](_0x108e22[_0xd42a('0x44')][_0xd42a('0x50')],_0x108e22[_0xd42a('0x44')]['type']);return db[_0xd42a('0x48')][_0xd42a('0x53')](_0x108e22['body'],{'include':[{'model':db[_0xd42a('0x54')],'as':'Subjects'},{'model':db[_0xd42a('0x54')],'as':_0xd42a('0x55')}]});}return null;})[_0xd42a('0x23')](respondWithResult(_0x566ef8,null))[_0xd42a('0x3e')](handleError(_0x566ef8,null));};function getAccessToken(_0x1ce13c){return new Promise(function(_0x4a0a0a,_0x29ad93){var _0x2b1d50;switch(_0x1ce13c['zone']){case'US':_0x2b1d50='https://accounts.zoho.com';break;case'AU':_0x2b1d50=_0xd42a('0x56');break;case'EU':_0x2b1d50='https://accounts.zoho.eu';break;case'IN':_0x2b1d50=_0xd42a('0x57');break;case'CN':_0x2b1d50=_0xd42a('0x58');break;default:_0x2b1d50=_0xd42a('0x59');break;}var _0x160d67={'method':_0xd42a('0x5a'),'uri':_0x2b1d50+_0xd42a('0x5b'),'qs':{'refresh_token':_0x1ce13c[_0xd42a('0x5c')],'client_id':_0x1ce13c[_0xd42a('0x5d')],'client_secret':_0x1ce13c[_0xd42a('0x5e')],'grant_type':_0xd42a('0x5f')},'json':!![]};return rp(_0x160d67)[_0xd42a('0x23')](function(_0xb211ee){if(_0xb211ee['access_token']){_0x4a0a0a(_0xb211ee[_0xd42a('0x60')]);}else{_0x29ad93('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd42a('0x3e')](function(_0x197d52){_0x29ad93(_0x197d52);});});}exports[_0xd42a('0x61')]=function(_0x19d0fe,_0x5ae901,_0x1db283){var _0x19bcbb,_0xf86c7e,_0x2154cc,_0x45a94d,_0x18f3ac;return db[_0xd42a('0x2b')][_0xd42a('0x47')]({'where':{'id':_0x19d0fe[_0xd42a('0x40')]['id']},'attributes':['id',_0xd42a('0x62'),_0xd42a('0x63'),_0xd42a('0x5d'),_0xd42a('0x5e'),_0xd42a('0x64'),_0xd42a('0x65'),_0xd42a('0x5c')]})[_0xd42a('0x23')](handleEntityNotFound(_0x5ae901,null))[_0xd42a('0x23')](function(_0x21bdf6){_0x18f3ac=_0x21bdf6;_0x19bcbb=_0x18f3ac[_0xd42a('0x62')];_0xf86c7e=_0x19bcbb===_0xd42a('0x66')?'eu':_0xd42a('0x67');_0x2154cc=_0x18f3ac[_0xd42a('0x64')];var _0x59645b=_0x2154cc[_0xd42a('0x68')](-0x1);if(_0x59645b==='/'||_0x59645b==='\x5c'||_0x59645b===':'){_0x2154cc=_0x2154cc['substring'](0x0,_0x2154cc[_0xd42a('0x69')](_0x59645b));}if(!_0x18f3ac[_0xd42a('0x5c')]){throw new Error(_0xd42a('0x6a'));}return getAccessToken(_0x18f3ac);})[_0xd42a('0x23')](function(_0x1c83d8){if(_0x1c83d8){return rp({'method':_0xd42a('0x6b'),'uri':util[_0xd42a('0x6c')](_0xd42a('0x6d'),_0xf86c7e),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1c83d8},'json':!![]});}})[_0xd42a('0x23')](function(_0x461563){if(_0x461563){if(_0x461563[_0xd42a('0x6e')]&&_0x461563[_0xd42a('0x6e')][_0xd42a('0x26')]){throw new Error(_0x461563[_0xd42a('0x6e')][_0xd42a('0x26')][_0xd42a('0x6f')]);}var _0x189f61=[];var _0x274697=[];var _0x290cc1=[_0xd42a('0x70'),'Subject',_0xd42a('0x71'),_0xd42a('0x72'),_0xd42a('0x73'),_0xd42a('0x74'),_0xd42a('0x75'),'Call_Type'];_0x274697=_[_0xd42a('0x76')](_0x461563[_0xd42a('0x33')],function(_0x313bc3){return _0x290cc1[_0xd42a('0x77')](_0x313bc3['api_name']);});for(var _0x59686b=0x0;_0x59686b<_0x274697[_0xd42a('0x4a')];_0x59686b++){if(_0x274697[_0x59686b]['system_mandatory']===![]){_0x189f61[_0xd42a('0x78')]({'id':_0x274697[_0x59686b]['id'],'name':_0x274697[_0x59686b]['display_label'],'custom':_0x274697[_0x59686b][_0xd42a('0x79')],'options':_0x274697[_0x59686b][_0xd42a('0x7a')]===_0xd42a('0x7b')&&_0x274697[_0x59686b][_0xd42a('0x7c')][_0xd42a('0x4a')]>-0x1?_[_0xd42a('0x2a')](_0x274697[_0x59686b][_0xd42a('0x7c')],function(_0x600da3){return{'name':_0x600da3,'value':_0x600da3};}):[]});}}return{'count':_0x189f61['length'],'rows':_0x189f61};}else{return{'count':0x0,'rows':[]};}})[_0xd42a('0x23')](respondWithResult(_0x5ae901,null))[_0xd42a('0x3e')](function(_0x32f614){var _0x319cf7=_0x19d0fe[_0xd42a('0x2f')][_0xd42a('0x7d')]?0x1f4:_0x32f614['statusCode']||0x1f4;logger[_0xd42a('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x319cf7,JSON['stringify'](_0x32f614));delete _0x32f614[_0xd42a('0x27')];if(_0x319cf7===0x191){_0x319cf7=0x190;}_0x5ae901[_0xd42a('0x18')](_0x319cf7)[_0xd42a('0x28')](_0x19d0fe[_0xd42a('0x2f')][_0xd42a('0x7d')]?{'message':_0xd42a('0x7e'),'statusCode':_0x32f614['statusCode']}:_0x32f614);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index eaa984c..73036d1 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 _0xd585=['./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','code','host','slice','substring','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','format','clientId','https://accounts.zoho.com','https://accounts.zoho.com.cn','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19cf38,_0x173546){var _0x22f483=function(_0x4c13c8){while(--_0x4c13c8){_0x19cf38['push'](_0x19cf38['shift']());}};_0x22f483(++_0x173546);}(_0xd585,0xf3));var _0x5d58=function(_0x1a14d7,_0x192602){_0x1a14d7=_0x1a14d7-0x0;var _0x462d19=_0xd585[_0x1a14d7];return _0x462d19;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var logger=require(_0x5d58('0x2'))(_0x5d58('0x3'));var moment=require('moment');var BPromise=require(_0x5d58('0x4'));var rp=require(_0x5d58('0x5'));var fs=require('fs');var path=require(_0x5d58('0x6'));var rimraf=require(_0x5d58('0x7'));var config=require(_0x5d58('0x8'));var attributes=require(_0x5d58('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3df19e,_0x4d1901){return _0x3df19e[_0x5d58('0xa')](_0x5d58('0xb'),attributes,{'tableName':_0x5d58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x263ebb,_0x36219b,_0x7293df){if(_0x263ebb[_0x5d58('0xd')]('zone')||_0x263ebb['changed'](_0x5d58('0xe'))||_0x263ebb[_0x5d58('0xd')]('clientId')||_0x263ebb[_0x5d58('0xd')]('clientSecret')||_0x263ebb[_0x5d58('0xd')](_0x5d58('0xf'))||_0x263ebb[_0x5d58('0xd')](_0x5d58('0x10'))){var _0x201eba,_0x4e951d;_0x201eba=_0x263ebb[_0x5d58('0xe')];var _0x5c1fef=_0x201eba[_0x5d58('0x11')](-0x1);if(_0x5c1fef==='/'||_0x5c1fef==='\x5c'||_0x5c1fef===':'){_0x201eba=_0x201eba[_0x5d58('0x12')](0x0,_0x201eba['lastIndexOf'](_0x5c1fef));}switch(_0x263ebb[_0x5d58('0x13')]){case'US':_0x4e951d='https://accounts.zoho.com';break;case'AU':_0x4e951d=_0x5d58('0x14');break;case'IN':_0x4e951d=_0x5d58('0x15');break;case'CN':_0x4e951d='https://accounts.zoho.com.cn';break;default:_0x4e951d=_0x5d58('0x16');break;}var _0x3ffd63={'method':_0x5d58('0x17'),'uri':_0x4e951d+_0x5d58('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x263ebb['clientId'],'client_secret':_0x263ebb[_0x5d58('0x19')],'redirect_uri':_0x263ebb['serverUrl'],'code':_0x263ebb['code']},'headers':{'Content-Type':_0x5d58('0x1a')}};return rp(_0x3ffd63)[_0x5d58('0x1b')](function(_0xf9ac95){var _0x2828b0=JSON[_0x5d58('0x1c')](_0xf9ac95);if(_0x2828b0[_0x5d58('0x1d')]){_0x263ebb[_0x5d58('0x1e')]=_0x2828b0[_0x5d58('0x1d')];logger[_0x5d58('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x263ebb['name'],_0x263ebb['id']));}else{logger['error'](util['format'](_0x5d58('0x20'),_0x263ebb[_0x5d58('0x21')],_0x263ebb['id']),util[_0x5d58('0x22')](_0x2828b0,{'showHidden':![],'depth':null}));}return _0x7293df(null,_0x36219b);})[_0x5d58('0x23')](function(_0x57807b){logger[_0x5d58('0x24')](util[_0x5d58('0x25')](_0x5d58('0x20'),_0x263ebb[_0x5d58('0x21')],_0x263ebb['id']),util[_0x5d58('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x7293df(_0x57807b);});}else{return _0x7293df(null,_0x36219b);}},'beforeUpdate':function(_0x30b7ae,_0x511af5,_0x9b8a2f){if(_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x13'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0xe'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x26'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x19'))||_0x30b7ae[_0x5d58('0xd')]('code')||_0x30b7ae[_0x5d58('0xd')]('host')){var _0x4c6451,_0x23da27;_0x4c6451=_0x30b7ae[_0x5d58('0xe')];var _0x94675c=_0x4c6451[_0x5d58('0x11')](-0x1);if(_0x94675c==='/'||_0x94675c==='\x5c'||_0x94675c===':'){_0x4c6451=_0x4c6451[_0x5d58('0x12')](0x0,_0x4c6451['lastIndexOf'](_0x94675c));}switch(_0x30b7ae[_0x5d58('0x13')]){case'US':_0x23da27=_0x5d58('0x27');break;case'AU':_0x23da27=_0x5d58('0x14');break;case'IN':_0x23da27='https://accounts.zoho.in';break;case'CN':_0x23da27=_0x5d58('0x28');break;default:_0x23da27=_0x5d58('0x16');break;}var _0x3cff52={'method':_0x5d58('0x17'),'uri':_0x23da27+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x30b7ae[_0x5d58('0x26')],'client_secret':_0x30b7ae['clientSecret'],'redirect_uri':_0x30b7ae[_0x5d58('0xe')],'code':_0x30b7ae[_0x5d58('0xf')]},'headers':{'Content-Type':_0x5d58('0x1a')}};return rp(_0x3cff52)['then'](function(_0xd344ee){var _0x152010=JSON[_0x5d58('0x1c')](_0xd344ee);if(_0x152010[_0x5d58('0x1d')]){_0x30b7ae[_0x5d58('0x1e')]=_0x152010[_0x5d58('0x1d')];logger[_0x5d58('0x1f')](util[_0x5d58('0x25')](_0x5d58('0x29'),_0x30b7ae['name'],_0x30b7ae['id']));}else{logger[_0x5d58('0x24')](util[_0x5d58('0x25')](_0x5d58('0x20'),_0x30b7ae[_0x5d58('0x21')],_0x30b7ae['id']),util[_0x5d58('0x22')](_0x152010,{'showHidden':![],'depth':null}));}return _0x9b8a2f(null,_0x511af5);})['catch'](function(_0x45234d){logger[_0x5d58('0x24')](util['format'](_0x5d58('0x20'),_0x30b7ae[_0x5d58('0x21')],_0x30b7ae['id']),util[_0x5d58('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x9b8a2f(_0x45234d);});}else{return _0x9b8a2f(null,_0x511af5);}}}});}; \ No newline at end of file +var _0xea64=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x3f5cd1,_0x39f78a){var _0x43c38b=function(_0x2a8f90){while(--_0x2a8f90){_0x3f5cd1['push'](_0x3f5cd1['shift']());}};_0x43c38b(++_0x39f78a);}(_0xea64,0xdf));var _0x4ea6=function(_0x84d005,_0xba696e){_0x84d005=_0x84d005-0x0;var _0x3d5aab=_0xea64[_0x84d005];return _0x3d5aab;};'use strict';var _=require(_0x4ea6('0x0'));var util=require('util');var logger=require(_0x4ea6('0x1'))(_0x4ea6('0x2'));var moment=require(_0x4ea6('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ea6('0x4'));var fs=require('fs');var path=require(_0x4ea6('0x5'));var rimraf=require(_0x4ea6('0x6'));var config=require(_0x4ea6('0x7'));var attributes=require(_0x4ea6('0x8'));var integrations=require(_0x4ea6('0x9'));module['exports']=function(_0x18265a,_0x5ce0d){return _0x18265a[_0x4ea6('0xa')]('ZohoAccount',attributes,{'tableName':_0x4ea6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x218156,_0x566169,_0xb1c5a3){if(_0x218156['changed']('zone')||_0x218156[_0x4ea6('0xc')](_0x4ea6('0xd'))||_0x218156['changed'](_0x4ea6('0xe'))||_0x218156['changed'](_0x4ea6('0xf'))||_0x218156[_0x4ea6('0xc')](_0x4ea6('0x10'))||_0x218156[_0x4ea6('0xc')]('host')){var _0x490a64,_0x371583;_0x490a64=_0x218156[_0x4ea6('0xd')];var _0x56dc17=_0x490a64[_0x4ea6('0x11')](-0x1);if(_0x56dc17==='/'||_0x56dc17==='\x5c'||_0x56dc17===':'){_0x490a64=_0x490a64[_0x4ea6('0x12')](0x0,_0x490a64['lastIndexOf'](_0x56dc17));}switch(_0x218156[_0x4ea6('0x13')]){case'US':_0x371583=_0x4ea6('0x14');break;case'AU':_0x371583='https://accounts.zoho.com.au';break;case'IN':_0x371583=_0x4ea6('0x15');break;case'CN':_0x371583='https://accounts.zoho.com.cn';break;default:_0x371583=_0x4ea6('0x16');break;}var _0x4848cb={'method':_0x4ea6('0x17'),'uri':_0x371583+_0x4ea6('0x18'),'form':{'grant_type':_0x4ea6('0x19'),'client_id':_0x218156['clientId'],'client_secret':_0x218156[_0x4ea6('0xf')],'redirect_uri':_0x218156[_0x4ea6('0xd')],'code':_0x218156[_0x4ea6('0x10')]},'headers':{'Content-Type':_0x4ea6('0x1a')}};return rp(_0x4848cb)[_0x4ea6('0x1b')](function(_0x2d0ab5){var _0x5c1017=JSON[_0x4ea6('0x1c')](_0x2d0ab5);if(_0x5c1017[_0x4ea6('0x1d')]){_0x218156[_0x4ea6('0x1e')]=_0x5c1017[_0x4ea6('0x1d')];logger[_0x4ea6('0x1f')](util[_0x4ea6('0x20')](_0x4ea6('0x21'),_0x218156[_0x4ea6('0x22')],_0x218156['id']));}else{logger[_0x4ea6('0x23')](util[_0x4ea6('0x20')](_0x4ea6('0x24'),_0x218156['name'],_0x218156['id']),util[_0x4ea6('0x25')](_0x5c1017,{'showHidden':![],'depth':null}));}return _0xb1c5a3(null,_0x566169);})[_0x4ea6('0x26')](function(_0x3a3264){logger['error'](util[_0x4ea6('0x20')](_0x4ea6('0x24'),_0x218156[_0x4ea6('0x22')],_0x218156['id']),util[_0x4ea6('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xb1c5a3(_0x3a3264);});}else{return _0xb1c5a3(null,_0x566169);}},'beforeUpdate':function(_0x35e2f6,_0x37b598,_0x6ed3aa){if(_0x35e2f6[_0x4ea6('0xc')](_0x4ea6('0x13'))||_0x35e2f6[_0x4ea6('0xc')](_0x4ea6('0xd'))||_0x35e2f6[_0x4ea6('0xc')](_0x4ea6('0xe'))||_0x35e2f6['changed'](_0x4ea6('0xf'))||_0x35e2f6['changed']('code')||_0x35e2f6['changed'](_0x4ea6('0x27'))){var _0x2cc2ce,_0xedd307;_0x2cc2ce=_0x35e2f6[_0x4ea6('0xd')];var _0x5d3c53=_0x2cc2ce['slice'](-0x1);if(_0x5d3c53==='/'||_0x5d3c53==='\x5c'||_0x5d3c53===':'){_0x2cc2ce=_0x2cc2ce[_0x4ea6('0x12')](0x0,_0x2cc2ce[_0x4ea6('0x28')](_0x5d3c53));}switch(_0x35e2f6[_0x4ea6('0x13')]){case'US':_0xedd307=_0x4ea6('0x14');break;case'AU':_0xedd307=_0x4ea6('0x29');break;case'IN':_0xedd307=_0x4ea6('0x15');break;case'CN':_0xedd307=_0x4ea6('0x2a');break;default:_0xedd307=_0x4ea6('0x16');break;}var _0x44e56b={'method':_0x4ea6('0x17'),'uri':_0xedd307+'/oauth/v2/token','form':{'grant_type':_0x4ea6('0x19'),'client_id':_0x35e2f6[_0x4ea6('0xe')],'client_secret':_0x35e2f6[_0x4ea6('0xf')],'redirect_uri':_0x35e2f6[_0x4ea6('0xd')],'code':_0x35e2f6[_0x4ea6('0x10')]},'headers':{'Content-Type':_0x4ea6('0x1a')}};return rp(_0x44e56b)[_0x4ea6('0x1b')](function(_0x4c29cf){var _0x81927b=JSON['parse'](_0x4c29cf);if(_0x81927b['refresh_token']){_0x35e2f6[_0x4ea6('0x1e')]=_0x81927b[_0x4ea6('0x1d')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35e2f6[_0x4ea6('0x22')],_0x35e2f6['id']));}else{logger['error'](util[_0x4ea6('0x20')](_0x4ea6('0x24'),_0x35e2f6[_0x4ea6('0x22')],_0x35e2f6['id']),util['inspect'](_0x81927b,{'showHidden':![],'depth':null}));}return _0x6ed3aa(null,_0x37b598);})[_0x4ea6('0x26')](function(_0x303638){logger[_0x4ea6('0x23')](util[_0x4ea6('0x20')](_0x4ea6('0x24'),_0x35e2f6[_0x4ea6('0x22')],_0x35e2f6['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x6ed3aa(_0x303638);});}else{return _0x6ed3aa(null,_0x37b598);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ddd9896..ac9b8f9 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 _0x853e=['util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowZohoAccount'];(function(_0x59deb3,_0x1278a4){var _0x3875d3=function(_0x4cbdc1){while(--_0x4cbdc1){_0x59deb3['push'](_0x59deb3['shift']());}};_0x3875d3(++_0x1278a4);}(_0x853e,0x1ea));var _0xe853=function(_0x237443,_0x282cd4){_0x237443=_0x237443-0x0;var _0x3d3ff9=_0x853e[_0x237443];return _0x3d3ff9;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var moment=require('moment');var BPromise=require(_0xe853('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe853('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe853('0x3'));var logger=require(_0xe853('0x4'))(_0xe853('0x5'));var config=require(_0xe853('0x6'));var jayson=require(_0xe853('0x7'));var client=jayson['client'][_0xe853('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x131614,_0xab8d0d,_0x25e6e1){return new BPromise(function(_0xe3d468,_0x36d502){return client[_0xe853('0x9')](_0x131614,_0x25e6e1)[_0xe853('0xa')](function(_0x213f17){logger[_0xe853('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xab8d0d,'request\x20sent');logger['debug'](_0xe853('0xc'),_0xab8d0d,'request\x20sent',JSON['stringify'](_0x213f17));if(_0x213f17[_0xe853('0xd')]){if(_0x213f17[_0xe853('0xd')][_0xe853('0xe')]===0x1f4){logger['error'](_0xe853('0xf'),_0xab8d0d,_0x213f17[_0xe853('0xd')][_0xe853('0x10')]);return _0x36d502(_0x213f17[_0xe853('0xd')][_0xe853('0x10')]);}logger[_0xe853('0xd')](_0xe853('0xf'),_0xab8d0d,_0x213f17['error']['message']);return _0xe3d468(_0x213f17['error']['message']);}else{logger[_0xe853('0xb')](_0xe853('0xf'),_0xab8d0d,_0xe853('0x11'));_0xe3d468(_0x213f17[_0xe853('0x12')][_0xe853('0x10')]);}})[_0xe853('0x13')](function(_0x335ca3){logger[_0xe853('0xd')](_0xe853('0xf'),_0xab8d0d,_0x335ca3);_0x36d502(_0x335ca3);});});}exports[_0xe853('0x14')]=function(_0x30d868){var _0x1d2526=this;return new Promise(function(_0x459007,_0x3295cc){return db[_0xe853('0x15')][_0xe853('0x16')]({'raw':_0x30d868['options']?_0x30d868[_0xe853('0x17')][_0xe853('0x18')]===undefined?!![]:![]:!![],'where':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x19')]||null:null,'attributes':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x1a')]||null:null,'limit':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x1b')]||null:null,'include':_0x30d868['options']?_0x30d868[_0xe853('0x17')][_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x30d868[_0xe853('0x17')][_0xe853('0x1c')],function(_0xc875b2){return{'model':db[_0xc875b2[_0xe853('0x1e')]],'as':_0xc875b2['as'],'attributes':_0xc875b2[_0xe853('0x1a')],'include':_0xc875b2['include']?_[_0xe853('0x1d')](_0xc875b2[_0xe853('0x1c')],function(_0x198895){return{'model':db[_0x198895[_0xe853('0x1e')]],'as':_0x198895['as'],'attributes':_0x198895[_0xe853('0x1a')],'include':_0x198895['include']?_[_0xe853('0x1d')](_0x198895[_0xe853('0x1c')],function(_0x49d8ed){return{'model':db[_0x49d8ed[_0xe853('0x1e')]],'as':_0x49d8ed['as'],'attributes':_0x49d8ed['attributes']};}):[]};}):[]};}):[]:[]})[_0xe853('0xa')](function(_0x545738){logger['info'](_0xe853('0x14'),_0x30d868);logger[_0xe853('0x1f')](_0xe853('0x14'),_0x30d868,JSON[_0xe853('0x20')](_0x545738));_0x459007(_0x545738);})[_0xe853('0x13')](function(_0x1e99c8){logger[_0xe853('0xd')](_0xe853('0x14'),_0x1e99c8[_0xe853('0x10')],_0x30d868);_0x3295cc(_0x1d2526[_0xe853('0xd')](0x1f4,_0x1e99c8[_0xe853('0x10')]));});});};exports['ShowZohoAccount']=function(_0x139fa2){var _0x82cb01=this;return new Promise(function(_0x47cace,_0xf159f9){return db['ZohoAccount'][_0xe853('0x21')]({'raw':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x19')]||null:null,'attributes':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x1a')]||null:null,'include':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x139fa2[_0xe853('0x17')]['include'],function(_0x323317){return{'model':db[_0x323317['model']],'as':_0x323317['as'],'attributes':_0x323317[_0xe853('0x1a')],'include':_0x323317[_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x323317[_0xe853('0x1c')],function(_0x4ee5b2){return{'model':db[_0x4ee5b2[_0xe853('0x1e')]],'as':_0x4ee5b2['as'],'attributes':_0x4ee5b2[_0xe853('0x1a')],'include':_0x4ee5b2[_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x4ee5b2[_0xe853('0x1c')],function(_0xbf08f9){return{'model':db[_0xbf08f9['model']],'as':_0xbf08f9['as'],'attributes':_0xbf08f9[_0xe853('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe853('0xa')](function(_0x13bd8d){logger[_0xe853('0xb')](_0xe853('0x22'),_0x139fa2);logger[_0xe853('0x1f')](_0xe853('0x22'),_0x139fa2,JSON[_0xe853('0x20')](_0x13bd8d));_0x47cace(_0x13bd8d);})[_0xe853('0x13')](function(_0x5d9735){logger['error'](_0xe853('0x22'),_0x5d9735[_0xe853('0x10')],_0x139fa2);_0xf159f9(_0x82cb01[_0xe853('0xd')](0x1f4,_0x5d9735['message']));});});}; \ No newline at end of file +var _0x0424=['info','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x519100,_0xde87e4){var _0x2e8097=function(_0x365801){while(--_0x365801){_0x519100['push'](_0x519100['shift']());}};_0x2e8097(++_0xde87e4);}(_0x0424,0x159));var _0x4042=function(_0x2e5011,_0x2ed248){_0x2e5011=_0x2e5011-0x0;var _0x4fed64=_0x0424[_0x2e5011];return _0x4fed64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('ZohoAccount,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetZohoAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowZohoAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3c49760..0a064ce 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 _0x211d=['post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3f43c4,_0x3e4d40){var _0x2106d3=function(_0x3518d8){while(--_0x3518d8){_0x3f43c4['push'](_0x3f43c4['shift']());}};_0x2106d3(++_0x3e4d40);}(_0x211d,0x175));var _0xd211=function(_0x376e5d,_0x2e41fe){_0x376e5d=_0x376e5d-0x0;var _0x237eb0=_0x211d[_0x376e5d];return _0x237eb0;};'use strict';var multer=require(_0xd211('0x0'));var util=require(_0xd211('0x1'));var path=require(_0xd211('0x2'));var timeout=require(_0xd211('0x3'));var express=require(_0xd211('0x4'));var router=express[_0xd211('0x5')]();var fs_extra=require(_0xd211('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd211('0x7'));var config=require(_0xd211('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xd211('0x9')]('/',auth[_0xd211('0xa')](),controller['index']);router[_0xd211('0x9')](_0xd211('0xb'),auth[_0xd211('0xa')](),controller[_0xd211('0xc')]);router[_0xd211('0x9')](_0xd211('0xd'),auth[_0xd211('0xa')](),controller[_0xd211('0xe')]);router[_0xd211('0x9')](_0xd211('0xf'),auth[_0xd211('0xa')](),controller[_0xd211('0x10')]);router[_0xd211('0x9')](_0xd211('0x11'),auth[_0xd211('0xa')](),controller['getDescriptions']);router[_0xd211('0x12')]('/',auth[_0xd211('0xa')](),controller[_0xd211('0x13')]);router[_0xd211('0x14')](_0xd211('0xb'),auth[_0xd211('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd211('0x15')]);module[_0xd211('0x16')]=router; \ No newline at end of file +var _0x261c=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x261c,0x10c));var _0xc261=function(_0x392368,_0x1e14a5){_0x392368=_0x392368-0x0;var _0x33efe7=_0x261c[_0x392368];return _0x33efe7;};'use strict';var multer=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var path=require(_0xc261('0x2'));var timeout=require(_0xc261('0x3'));var express=require(_0xc261('0x4'));var router=express[_0xc261('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc261('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc261('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xc261('0x8')]('/',auth[_0xc261('0x9')](),controller[_0xc261('0xa')]);router[_0xc261('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc261('0xb')]);router[_0xc261('0x8')](_0xc261('0xc'),auth[_0xc261('0x9')](),controller[_0xc261('0xd')]);router[_0xc261('0x8')](_0xc261('0xe'),auth[_0xc261('0x9')](),controller['getSubjects']);router[_0xc261('0x8')](_0xc261('0xf'),auth[_0xc261('0x9')](),controller[_0xc261('0x10')]);router[_0xc261('0x11')]('/',auth[_0xc261('0x9')](),controller[_0xc261('0x12')]);router[_0xc261('0x13')](_0xc261('0x14'),auth[_0xc261('0x9')](),controller['update']);router[_0xc261('0x15')](_0xc261('0x14'),auth['isAuthenticated'](),controller[_0xc261('0x16')]);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 62f7814..32d1604 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 _0x605e=['exports','ENUM','lead','contact_lead','contact','STRING','sequelize'];(function(_0xf5bba0,_0x3494ae){var _0x56f8c7=function(_0x4e096b){while(--_0x4e096b){_0xf5bba0['push'](_0xf5bba0['shift']());}};_0x56f8c7(++_0x3494ae);}(_0x605e,0x1b8));var _0xe605=function(_0x3fe14b,_0x171900){_0x3fe14b=_0x3fe14b-0x0;var _0x15d797=_0x605e[_0x3fe14b];return _0x15d797;};'use strict';var Sequelize=require(_0xe605('0x0'));module[_0xe605('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe605('0x2')](_0xe605('0x3'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe605('0x2')](_0xe605('0x4'),_0xe605('0x5'),'lead'),'defaultValue':_0xe605('0x4')},'description':{'type':Sequelize[_0xe605('0x6')]}}; \ No newline at end of file +var _0xfa6f=['nothing','ENUM','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x916ede,_0x5a78cf){var _0x5e3467=function(_0x65e185){while(--_0x65e185){_0x916ede['push'](_0x916ede['shift']());}};_0x5e3467(++_0x5a78cf);}(_0xfa6f,0xdb));var _0xffa6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xfa6f[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require(_0xffa6('0x0'));module[_0xffa6('0x1')]={'name':{'type':Sequelize[_0xffa6('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xffa6('0x3'),_0xffa6('0x4'),_0xffa6('0x5')),'defaultValue':_0xffa6('0x3')},'moduleSearch':{'type':Sequelize[_0xffa6('0x6')](_0xffa6('0x7'),'contact',_0xffa6('0x3')),'defaultValue':_0xffa6('0x7')},'description':{'type':Sequelize[_0xffa6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d6164ba..bf7a729 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 _0xacb1=['pick','filter','merge','VIRTUAL','options','ZohoConfiguration','count','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','type','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x37672c,_0x4780dd){var _0x32710a=function(_0xb72484){while(--_0xb72484){_0x37672c['push'](_0x37672c['shift']());}};_0x32710a(++_0x4780dd);}(_0xacb1,0x15a));var _0x1acb=function(_0x6739d7,_0x4e03b8){_0x6739d7=_0x6739d7-0x0;var _0x2792a3=_0xacb1[_0x6739d7];return _0x2792a3;};'use strict';var emlformat=require(_0x1acb('0x0'));var rimraf=require(_0x1acb('0x1'));var zipdir=require(_0x1acb('0x2'));var jsonpatch=require(_0x1acb('0x3'));var rp=require(_0x1acb('0x4'));var moment=require(_0x1acb('0x5'));var BPromise=require(_0x1acb('0x6'));var Mustache=require(_0x1acb('0x7'));var util=require(_0x1acb('0x8'));var path=require('path');var sox=require(_0x1acb('0x9'));var csv=require(_0x1acb('0xa'));var ejs=require(_0x1acb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1acb('0xc'));var crypto=require(_0x1acb('0xd'));var jsforce=require(_0x1acb('0xe'));var deskjs=require(_0x1acb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1acb('0x10'));var Papa=require(_0x1acb('0x11'));var Redis=require('ioredis');var authService=require(_0x1acb('0x12'));var qs=require(_0x1acb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1acb('0x14'))(_0x1acb('0x15'));var utils=require(_0x1acb('0x16'));var config=require(_0x1acb('0x17'));var licenseUtil=require(_0x1acb('0x18'));var db=require(_0x1acb('0x19'))['db'];function respondWithStatusCode(_0xd19d67,_0x59d4e9){_0x59d4e9=_0x59d4e9||0xcc;return function(_0x397857){if(_0x397857){return _0xd19d67[_0x1acb('0x1a')](_0x59d4e9);}return _0xd19d67[_0x1acb('0x1b')](_0x59d4e9)[_0x1acb('0x1c')]();};}function respondWithResult(_0x52993f,_0x344197){_0x344197=_0x344197||0xc8;return function(_0x2db7f4){if(_0x2db7f4){return _0x52993f['status'](_0x344197)['json'](_0x2db7f4);}};}function respondWithFilteredResult(_0x185fe4,_0x44313b){return function(_0x1ce91f){if(_0x1ce91f){var _0x17b11c=typeof _0x44313b[_0x1acb('0x1d')]==='undefined'&&typeof _0x44313b['limit']==='undefined';var _0x33fc57=_0x1ce91f['count'];var _0x4a69a9=_0x17b11c?0x0:_0x44313b[_0x1acb('0x1d')];var _0x35b913=_0x17b11c?_0x1ce91f['count']:_0x44313b[_0x1acb('0x1d')]+_0x44313b[_0x1acb('0x1e')];var _0x3a2321;if(_0x35b913>=_0x33fc57){_0x35b913=_0x33fc57;_0x3a2321=0xc8;}else{_0x3a2321=0xce;}_0x185fe4[_0x1acb('0x1b')](_0x3a2321);return _0x185fe4[_0x1acb('0x1f')](_0x1acb('0x20'),_0x4a69a9+'-'+_0x35b913+'/'+_0x33fc57)['json'](_0x1ce91f);}return null;};}function patchUpdates(_0x1bdf06){return function(_0x1b85bc){try{jsonpatch[_0x1acb('0x21')](_0x1b85bc,_0x1bdf06,!![]);}catch(_0x19062c){return BPromise[_0x1acb('0x22')](_0x19062c);}return _0x1b85bc[_0x1acb('0x23')]();};}function saveUpdates(_0x5212ef,_0x516a53){return function(_0x3148a4){if(_0x3148a4){return _0x3148a4[_0x1acb('0x24')](_0x5212ef)[_0x1acb('0x25')](function(_0x57cead){return _0x57cead;});}return null;};}function removeEntity(_0x5e487d,_0x175919){return function(_0x5712c5){if(_0x5712c5){return _0x5712c5['destroy']()[_0x1acb('0x25')](function(){_0x5e487d[_0x1acb('0x1b')](0xcc)[_0x1acb('0x1c')]();});}};}function handleEntityNotFound(_0x25f2fa,_0x4c30d7){return function(_0x1b0c49){if(!_0x1b0c49){_0x25f2fa['sendStatus'](0x194);}return _0x1b0c49;};}function handleError(_0x1cb68c,_0x2aac31){_0x2aac31=_0x2aac31||0x1f4;return function(_0x1c7099){logger[_0x1acb('0x26')](_0x1c7099['stack']);if(_0x1c7099[_0x1acb('0x27')]){delete _0x1c7099['name'];}_0x1cb68c[_0x1acb('0x1b')](_0x2aac31)['send'](_0x1c7099);};}exports[_0x1acb('0x28')]=function(_0x27bae5,_0x1f21a3){var _0x52c526={},_0x4629f6={},_0xf3d3dc={'count':0x0,'rows':[]};var _0x3d429=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x1887ac){return{'name':_0x1887ac['fieldName'],'type':_0x1887ac[_0x1acb('0x29')]['key']};});_0x4629f6[_0x1acb('0x2a')]=_[_0x1acb('0x2b')](_0x3d429,_0x1acb('0x27'));_0x4629f6[_0x1acb('0x2c')]=_['keys'](_0x27bae5[_0x1acb('0x2c')]);_0x4629f6['filters']=_[_0x1acb('0x2d')](_0x4629f6['model'],_0x4629f6[_0x1acb('0x2c')]);_0x52c526[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x4629f6['model'],qs[_0x1acb('0x2f')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x2f')]));_0x52c526[_0x1acb('0x2e')]=_0x52c526[_0x1acb('0x2e')]['length']?_0x52c526[_0x1acb('0x2e')]:_0x4629f6[_0x1acb('0x2a')];if(!_0x27bae5['query'][_0x1acb('0x30')](_0x1acb('0x31'))){_0x52c526[_0x1acb('0x1e')]=qs[_0x1acb('0x1e')](_0x27bae5['query'][_0x1acb('0x1e')]);_0x52c526[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x1d')]);}_0x52c526[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x33')]);_0x52c526[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_[_0x1acb('0x36')](_0x27bae5['query'],_0x4629f6[_0x1acb('0x35')]),_0x3d429);if(_0x27bae5['query'][_0x1acb('0x37')]){_0x52c526[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x52c526[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x3d429,function(_0x489073){if(_0x489073[_0x1acb('0x29')]!==_0x1acb('0x39')){var _0x4ba974={};_0x4ba974[_0x489073[_0x1acb('0x27')]]={'$like':'%'+_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4ba974;}})});}_0x52c526=_['merge']({},_0x52c526,_0x27bae5[_0x1acb('0x3a')]);var _0x3d1627={'where':_0x52c526[_0x1acb('0x34')]};return db[_0x1acb('0x3b')][_0x1acb('0x3c')](_0x3d1627)[_0x1acb('0x25')](function(_0xafe169){_0xf3d3dc['count']=_0xafe169;if(_0x27bae5[_0x1acb('0x2c')]['includeAll']){_0x52c526[_0x1acb('0x3d')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x1acb('0x3e')](_0x52c526);})[_0x1acb('0x25')](function(_0x38207d){_0xf3d3dc[_0x1acb('0x3f')]=_0x38207d;return _0xf3d3dc;})[_0x1acb('0x25')](respondWithFilteredResult(_0x1f21a3,_0x52c526))[_0x1acb('0x40')](handleError(_0x1f21a3,null));};exports[_0x1acb('0x41')]=function(_0x50ae32,_0x4f809e){var _0x198e02={'raw':![],'where':{'id':_0x50ae32[_0x1acb('0x42')]['id']}},_0x471989={};_0x471989[_0x1acb('0x2a')]=_[_0x1acb('0x43')](db['ZohoConfiguration'][_0x1acb('0x44')]);_0x471989[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x50ae32[_0x1acb('0x2c')]);_0x471989['filters']=_[_0x1acb('0x2d')](_0x471989[_0x1acb('0x2a')],_0x471989[_0x1acb('0x2c')]);_0x198e02[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x471989['model'],qs['fields'](_0x50ae32['query'][_0x1acb('0x2f')]));_0x198e02[_0x1acb('0x2e')]=_0x198e02[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x198e02['attributes']:_0x471989[_0x1acb('0x2a')];if(_0x50ae32[_0x1acb('0x2c')][_0x1acb('0x46')]){_0x198e02[_0x1acb('0x3d')]=[{'all':!![]}];}_0x198e02=_['merge']({},_0x198e02,_0x50ae32['options']);return db[_0x1acb('0x3b')][_0x1acb('0x47')](_0x198e02)[_0x1acb('0x25')](handleEntityNotFound(_0x4f809e,null))[_0x1acb('0x25')](respondWithResult(_0x4f809e,null))[_0x1acb('0x40')](handleError(_0x4f809e,null));};exports[_0x1acb('0x48')]=function(_0x496609,_0x1854bb){return db[_0x1acb('0x3b')]['create'](_0x496609[_0x1acb('0x49')],{})[_0x1acb('0x25')](respondWithResult(_0x1854bb,0xc9))[_0x1acb('0x40')](handleError(_0x1854bb,null));};exports[_0x1acb('0x24')]=function(_0xc055f6,_0x52c648){if(_0xc055f6[_0x1acb('0x49')]['id']){delete _0xc055f6[_0x1acb('0x49')]['id'];}return db[_0x1acb('0x3b')][_0x1acb('0x47')]({'where':{'id':_0xc055f6[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x52c648,null))[_0x1acb('0x25')](saveUpdates(_0xc055f6[_0x1acb('0x49')],null))[_0x1acb('0x25')](respondWithResult(_0x52c648,null))[_0x1acb('0x40')](handleError(_0x52c648,null));};exports[_0x1acb('0x4a')]=function(_0x126c3d,_0x486184){return db[_0x1acb('0x3b')][_0x1acb('0x47')]({'where':{'id':_0x126c3d['params']['id']}})[_0x1acb('0x25')](handleEntityNotFound(_0x486184,null))[_0x1acb('0x25')](removeEntity(_0x486184,null))['catch'](handleError(_0x486184,null));};exports[_0x1acb('0x4b')]=function(_0x231c07,_0x45ae2f,_0x2823f6){var _0x310ca5={};var _0x5c50cf={};var _0x3127ee;var _0x33c671;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x231c07[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x45ae2f,null))[_0x1acb('0x25')](function(_0x222e1b){if(_0x222e1b){_0x3127ee=_0x222e1b;_0x5c50cf['model']=_[_0x1acb('0x43')](db[_0x1acb('0x4c')][_0x1acb('0x44')]);_0x5c50cf[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x231c07[_0x1acb('0x2c')]);_0x5c50cf[_0x1acb('0x35')]=_['intersection'](_0x5c50cf[_0x1acb('0x2a')],_0x5c50cf[_0x1acb('0x2c')]);_0x310ca5[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x5c50cf[_0x1acb('0x2a')],qs[_0x1acb('0x2f')](_0x231c07['query']['fields']));_0x310ca5[_0x1acb('0x2e')]=_0x310ca5['attributes'][_0x1acb('0x45')]?_0x310ca5[_0x1acb('0x2e')]:_0x5c50cf[_0x1acb('0x2a')];_0x310ca5[_0x1acb('0x32')]=qs['sort'](_0x231c07['query'][_0x1acb('0x33')]);_0x310ca5[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_['pick'](_0x231c07[_0x1acb('0x2c')],_0x5c50cf[_0x1acb('0x35')]));if(_0x231c07[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x310ca5[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x310ca5[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x310ca5[_0x1acb('0x2e')],function(_0x34ab87){var _0x4fa0ea={};_0x4fa0ea[_0x34ab87]={'$like':'%'+_0x231c07[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4fa0ea;})});}_0x310ca5=_[_0x1acb('0x38')]({},_0x310ca5,_0x231c07[_0x1acb('0x3a')]);return _0x3127ee[_0x1acb('0x4b')](_0x310ca5);}})['then'](function(_0x10c5f2){if(_0x10c5f2){_0x33c671=_0x10c5f2[_0x1acb('0x45')];if(!_0x231c07[_0x1acb('0x2c')][_0x1acb('0x30')](_0x1acb('0x31'))){_0x310ca5[_0x1acb('0x1e')]=qs[_0x1acb('0x1e')](_0x231c07['query'][_0x1acb('0x1e')]);_0x310ca5[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x231c07['query'][_0x1acb('0x1d')]);}return _0x3127ee[_0x1acb('0x4b')](_0x310ca5);}})[_0x1acb('0x25')](function(_0x42d1c0){if(_0x42d1c0){return _0x42d1c0?{'count':_0x33c671,'rows':_0x42d1c0}:null;}})['then'](respondWithResult(_0x45ae2f,null))[_0x1acb('0x40')](handleError(_0x45ae2f,null));};exports[_0x1acb('0x4d')]=function(_0x1283cb,_0x13d67b,_0x134108){var _0x107e27={};var _0x2a3af8={};var _0x38f5ea;var _0x3f3472;return db[_0x1acb('0x3b')][_0x1acb('0x4e')]({'where':{'id':_0x1283cb[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x13d67b,null))[_0x1acb('0x25')](function(_0x401956){if(_0x401956){_0x38f5ea=_0x401956;_0x2a3af8[_0x1acb('0x2a')]=_[_0x1acb('0x43')](db['ZohoField'][_0x1acb('0x44')]);_0x2a3af8[_0x1acb('0x2c')]=_['keys'](_0x1283cb['query']);_0x2a3af8['filters']=_[_0x1acb('0x2d')](_0x2a3af8[_0x1acb('0x2a')],_0x2a3af8[_0x1acb('0x2c')]);_0x107e27['attributes']=_[_0x1acb('0x2d')](_0x2a3af8[_0x1acb('0x2a')],qs['fields'](_0x1283cb[_0x1acb('0x2c')]['fields']));_0x107e27['attributes']=_0x107e27[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x107e27['attributes']:_0x2a3af8[_0x1acb('0x2a')];_0x107e27[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x33')]);_0x107e27['where']=qs[_0x1acb('0x35')](_['pick'](_0x1283cb[_0x1acb('0x2c')],_0x2a3af8[_0x1acb('0x35')]));if(_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x107e27[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x107e27[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x107e27[_0x1acb('0x2e')],function(_0x533cb4){var _0x4ebce7={};_0x4ebce7[_0x533cb4]={'$like':'%'+_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4ebce7;})});}_0x107e27=_[_0x1acb('0x38')]({},_0x107e27,_0x1283cb[_0x1acb('0x3a')]);return _0x38f5ea[_0x1acb('0x4d')](_0x107e27);}})[_0x1acb('0x25')](function(_0x43a702){if(_0x43a702){_0x3f3472=_0x43a702[_0x1acb('0x45')];if(!_0x1283cb['query']['hasOwnProperty']('nolimit')){_0x107e27['limit']=qs[_0x1acb('0x1e')](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x1e')]);_0x107e27[_0x1acb('0x1d')]=qs['offset'](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x1d')]);}return _0x38f5ea[_0x1acb('0x4d')](_0x107e27);}})[_0x1acb('0x25')](function(_0x4d3e3f){if(_0x4d3e3f){return _0x4d3e3f?{'count':_0x3f3472,'rows':_0x4d3e3f}:null;}})[_0x1acb('0x25')](respondWithResult(_0x13d67b,null))[_0x1acb('0x40')](handleError(_0x13d67b,null));};exports['getDescriptions']=function(_0x30829a,_0x4d5e1b,_0x2cc2cd){var _0x587793={};var _0x38276d={};var _0x1b75e5;var _0x2adb57;return db['ZohoConfiguration'][_0x1acb('0x4e')]({'where':{'id':_0x30829a[_0x1acb('0x42')]['id']}})[_0x1acb('0x25')](handleEntityNotFound(_0x4d5e1b,null))[_0x1acb('0x25')](function(_0x519ddc){if(_0x519ddc){_0x1b75e5=_0x519ddc;_0x38276d['model']=_[_0x1acb('0x43')](db[_0x1acb('0x4c')]['rawAttributes']);_0x38276d[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x30829a[_0x1acb('0x2c')]);_0x38276d[_0x1acb('0x35')]=_[_0x1acb('0x2d')](_0x38276d[_0x1acb('0x2a')],_0x38276d[_0x1acb('0x2c')]);_0x587793[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x38276d[_0x1acb('0x2a')],qs[_0x1acb('0x2f')](_0x30829a[_0x1acb('0x2c')][_0x1acb('0x2f')]));_0x587793[_0x1acb('0x2e')]=_0x587793[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x587793[_0x1acb('0x2e')]:_0x38276d['model'];_0x587793[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x30829a[_0x1acb('0x2c')]['sort']);_0x587793[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_[_0x1acb('0x36')](_0x30829a[_0x1acb('0x2c')],_0x38276d[_0x1acb('0x35')]));if(_0x30829a[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x587793[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x587793['where'],{'$or':_[_0x1acb('0x2b')](_0x587793[_0x1acb('0x2e')],function(_0x4654b3){var _0x1d3d2a={};_0x1d3d2a[_0x4654b3]={'$like':'%'+_0x30829a[_0x1acb('0x2c')]['filter']+'%'};return _0x1d3d2a;})});}_0x587793=_[_0x1acb('0x38')]({},_0x587793,_0x30829a['options']);return _0x1b75e5[_0x1acb('0x4f')](_0x587793);}})[_0x1acb('0x25')](function(_0x4e9845){if(_0x4e9845){_0x2adb57=_0x4e9845[_0x1acb('0x45')];if(!_0x30829a[_0x1acb('0x2c')][_0x1acb('0x30')](_0x1acb('0x31'))){_0x587793['limit']=qs[_0x1acb('0x1e')](_0x30829a['query'][_0x1acb('0x1e')]);_0x587793[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x30829a[_0x1acb('0x2c')][_0x1acb('0x1d')]);}return _0x1b75e5[_0x1acb('0x4f')](_0x587793);}})[_0x1acb('0x25')](function(_0x1f6696){if(_0x1f6696){return _0x1f6696?{'count':_0x2adb57,'rows':_0x1f6696}:null;}})['then'](respondWithResult(_0x4d5e1b,null))['catch'](handleError(_0x4d5e1b,null));}; \ No newline at end of file +var _0xdf04=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','params','length','includeAll','include','find','catch','create','body','getFields','findOne','order','pick','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4bcc9b,_0x557b41){var _0x40a886=function(_0x57dbd1){while(--_0x57dbd1){_0x4bcc9b['push'](_0x4bcc9b['shift']());}};_0x40a886(++_0x557b41);}(_0xdf04,0x17d));var _0x4df0=function(_0x466d99,_0x5ff522){_0x466d99=_0x466d99-0x0;var _0x33a11f=_0xdf04[_0x466d99];return _0x33a11f;};'use strict';var emlformat=require(_0x4df0('0x0'));var rimraf=require(_0x4df0('0x1'));var zipdir=require(_0x4df0('0x2'));var jsonpatch=require(_0x4df0('0x3'));var rp=require('request-promise');var moment=require(_0x4df0('0x4'));var BPromise=require(_0x4df0('0x5'));var Mustache=require(_0x4df0('0x6'));var util=require(_0x4df0('0x7'));var path=require(_0x4df0('0x8'));var sox=require(_0x4df0('0x9'));var csv=require(_0x4df0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4df0('0xb'));var _=require('lodash');var squel=require(_0x4df0('0xc'));var crypto=require(_0x4df0('0xd'));var jsforce=require(_0x4df0('0xe'));var deskjs=require(_0x4df0('0xf'));var toCsv=require(_0x4df0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4df0('0x10'));var authService=require(_0x4df0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4df0('0x12'));var hardwareService=require(_0x4df0('0x13'));var logger=require(_0x4df0('0x14'))(_0x4df0('0x15'));var utils=require(_0x4df0('0x16'));var config=require(_0x4df0('0x17'));var licenseUtil=require(_0x4df0('0x18'));var db=require(_0x4df0('0x19'))['db'];function respondWithStatusCode(_0x2f4d25,_0x433d56){_0x433d56=_0x433d56||0xcc;return function(_0x270fc8){if(_0x270fc8){return _0x2f4d25[_0x4df0('0x1a')](_0x433d56);}return _0x2f4d25[_0x4df0('0x1b')](_0x433d56)[_0x4df0('0x1c')]();};}function respondWithResult(_0x537e85,_0x127173){_0x127173=_0x127173||0xc8;return function(_0x597c88){if(_0x597c88){return _0x537e85['status'](_0x127173)[_0x4df0('0x1d')](_0x597c88);}};}function respondWithFilteredResult(_0x57a58a,_0x21e6ea){return function(_0x5c6105){if(_0x5c6105){var _0x5ede32=typeof _0x21e6ea[_0x4df0('0x1e')]===_0x4df0('0x1f')&&typeof _0x21e6ea[_0x4df0('0x20')]===_0x4df0('0x1f');var _0x279a99=_0x5c6105[_0x4df0('0x21')];var _0x1b8fe1=_0x5ede32?0x0:_0x21e6ea[_0x4df0('0x1e')];var _0x58d42e=_0x5ede32?_0x5c6105[_0x4df0('0x21')]:_0x21e6ea[_0x4df0('0x1e')]+_0x21e6ea[_0x4df0('0x20')];var _0x56d192;if(_0x58d42e>=_0x279a99){_0x58d42e=_0x279a99;_0x56d192=0xc8;}else{_0x56d192=0xce;}_0x57a58a[_0x4df0('0x1b')](_0x56d192);return _0x57a58a['set'](_0x4df0('0x22'),_0x1b8fe1+'-'+_0x58d42e+'/'+_0x279a99)['json'](_0x5c6105);}return null;};}function patchUpdates(_0x2f1b92){return function(_0x1a356a){try{jsonpatch[_0x4df0('0x23')](_0x1a356a,_0x2f1b92,!![]);}catch(_0x36943d){return BPromise[_0x4df0('0x24')](_0x36943d);}return _0x1a356a[_0x4df0('0x25')]();};}function saveUpdates(_0x4074eb,_0x1002e0){return function(_0x5deb3a){if(_0x5deb3a){return _0x5deb3a[_0x4df0('0x26')](_0x4074eb)[_0x4df0('0x27')](function(_0x41acb2){return _0x41acb2;});}return null;};}function removeEntity(_0x101e63,_0x55f882){return function(_0x53e589){if(_0x53e589){return _0x53e589['destroy']()[_0x4df0('0x27')](function(){_0x101e63['status'](0xcc)[_0x4df0('0x1c')]();});}};}function handleEntityNotFound(_0x4d43af,_0x3355b0){return function(_0x5bba3a){if(!_0x5bba3a){_0x4d43af[_0x4df0('0x1a')](0x194);}return _0x5bba3a;};}function handleError(_0x4fccab,_0x1fd29b){_0x1fd29b=_0x1fd29b||0x1f4;return function(_0x15a183){logger[_0x4df0('0x28')](_0x15a183[_0x4df0('0x29')]);if(_0x15a183[_0x4df0('0x2a')]){delete _0x15a183[_0x4df0('0x2a')];}_0x4fccab[_0x4df0('0x1b')](_0x1fd29b)[_0x4df0('0x2b')](_0x15a183);};}exports[_0x4df0('0x2c')]=function(_0x1e4ce8,_0x1997b7){var _0x461638={},_0x3cd0e4={},_0xbbdeae={'count':0x0,'rows':[]};var _0x46b79c=_[_0x4df0('0x2d')](db[_0x4df0('0x2e')][_0x4df0('0x2f')],function(_0xe6e5c3){return{'name':_0xe6e5c3['fieldName'],'type':_0xe6e5c3[_0x4df0('0x30')][_0x4df0('0x31')]};});_0x3cd0e4[_0x4df0('0x32')]=_[_0x4df0('0x2d')](_0x46b79c,_0x4df0('0x2a'));_0x3cd0e4[_0x4df0('0x33')]=_[_0x4df0('0x34')](_0x1e4ce8[_0x4df0('0x33')]);_0x3cd0e4[_0x4df0('0x35')]=_[_0x4df0('0x36')](_0x3cd0e4[_0x4df0('0x32')],_0x3cd0e4[_0x4df0('0x33')]);_0x461638[_0x4df0('0x37')]=_[_0x4df0('0x36')](_0x3cd0e4[_0x4df0('0x32')],qs['fields'](_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x38')]));_0x461638['attributes']=_0x461638['attributes']['length']?_0x461638[_0x4df0('0x37')]:_0x3cd0e4[_0x4df0('0x32')];if(!_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x39')](_0x4df0('0x3a'))){_0x461638['limit']=qs[_0x4df0('0x20')](_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x20')]);_0x461638['offset']=qs['offset'](_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x1e')]);}_0x461638['order']=qs[_0x4df0('0x3b')](_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x3b')]);_0x461638[_0x4df0('0x3c')]=qs[_0x4df0('0x35')](_['pick'](_0x1e4ce8[_0x4df0('0x33')],_0x3cd0e4['filters']),_0x46b79c);if(_0x1e4ce8[_0x4df0('0x33')][_0x4df0('0x3d')]){_0x461638[_0x4df0('0x3c')]=_['merge'](_0x461638[_0x4df0('0x3c')],{'$or':_[_0x4df0('0x2d')](_0x46b79c,function(_0x48233a){if(_0x48233a[_0x4df0('0x30')]!==_0x4df0('0x3e')){var _0x4980c2={};_0x4980c2[_0x48233a[_0x4df0('0x2a')]]={'$like':'%'+_0x1e4ce8['query'][_0x4df0('0x3d')]+'%'};return _0x4980c2;}})});}_0x461638=_[_0x4df0('0x3f')]({},_0x461638,_0x1e4ce8[_0x4df0('0x40')]);var _0x1f7f61={'where':_0x461638[_0x4df0('0x3c')]};return db['ZohoConfiguration'][_0x4df0('0x21')](_0x1f7f61)[_0x4df0('0x27')](function(_0x2a68b6){_0xbbdeae[_0x4df0('0x21')]=_0x2a68b6;if(_0x1e4ce8[_0x4df0('0x33')]['includeAll']){_0x461638['include']=[{'all':!![]}];}return db[_0x4df0('0x2e')][_0x4df0('0x41')](_0x461638);})[_0x4df0('0x27')](function(_0x409f24){_0xbbdeae[_0x4df0('0x42')]=_0x409f24;return _0xbbdeae;})[_0x4df0('0x27')](respondWithFilteredResult(_0x1997b7,_0x461638))['catch'](handleError(_0x1997b7,null));};exports['show']=function(_0x345aed,_0x35dad7){var _0x1dea4f={'raw':![],'where':{'id':_0x345aed[_0x4df0('0x43')]['id']}},_0x238591={};_0x238591[_0x4df0('0x32')]=_[_0x4df0('0x34')](db[_0x4df0('0x2e')][_0x4df0('0x2f')]);_0x238591[_0x4df0('0x33')]=_[_0x4df0('0x34')](_0x345aed[_0x4df0('0x33')]);_0x238591['filters']=_['intersection'](_0x238591['model'],_0x238591[_0x4df0('0x33')]);_0x1dea4f[_0x4df0('0x37')]=_[_0x4df0('0x36')](_0x238591['model'],qs[_0x4df0('0x38')](_0x345aed['query'][_0x4df0('0x38')]));_0x1dea4f['attributes']=_0x1dea4f['attributes'][_0x4df0('0x44')]?_0x1dea4f[_0x4df0('0x37')]:_0x238591[_0x4df0('0x32')];if(_0x345aed[_0x4df0('0x33')][_0x4df0('0x45')]){_0x1dea4f[_0x4df0('0x46')]=[{'all':!![]}];}_0x1dea4f=_[_0x4df0('0x3f')]({},_0x1dea4f,_0x345aed['options']);return db[_0x4df0('0x2e')][_0x4df0('0x47')](_0x1dea4f)[_0x4df0('0x27')](handleEntityNotFound(_0x35dad7,null))[_0x4df0('0x27')](respondWithResult(_0x35dad7,null))[_0x4df0('0x48')](handleError(_0x35dad7,null));};exports['create']=function(_0x124760,_0xc4645a){return db[_0x4df0('0x2e')][_0x4df0('0x49')](_0x124760['body'],{})[_0x4df0('0x27')](respondWithResult(_0xc4645a,0xc9))[_0x4df0('0x48')](handleError(_0xc4645a,null));};exports['update']=function(_0x558145,_0x11a434){if(_0x558145['body']['id']){delete _0x558145['body']['id'];}return db[_0x4df0('0x2e')]['find']({'where':{'id':_0x558145[_0x4df0('0x43')]['id']}})[_0x4df0('0x27')](handleEntityNotFound(_0x11a434,null))[_0x4df0('0x27')](saveUpdates(_0x558145[_0x4df0('0x4a')],null))[_0x4df0('0x27')](respondWithResult(_0x11a434,null))[_0x4df0('0x48')](handleError(_0x11a434,null));};exports['destroy']=function(_0x425f70,_0x215ac8){return db[_0x4df0('0x2e')][_0x4df0('0x47')]({'where':{'id':_0x425f70[_0x4df0('0x43')]['id']}})['then'](handleEntityNotFound(_0x215ac8,null))[_0x4df0('0x27')](removeEntity(_0x215ac8,null))['catch'](handleError(_0x215ac8,null));};exports[_0x4df0('0x4b')]=function(_0x28858e,_0x2c5dd8,_0x2e9af9){var _0xaa162b={};var _0x42872a={};var _0x2db349;var _0x2ca03a;return db['ZohoConfiguration'][_0x4df0('0x4c')]({'where':{'id':_0x28858e[_0x4df0('0x43')]['id']}})[_0x4df0('0x27')](handleEntityNotFound(_0x2c5dd8,null))['then'](function(_0x319b8a){if(_0x319b8a){_0x2db349=_0x319b8a;_0x42872a[_0x4df0('0x32')]=_[_0x4df0('0x34')](db['ZohoField'][_0x4df0('0x2f')]);_0x42872a['query']=_[_0x4df0('0x34')](_0x28858e['query']);_0x42872a[_0x4df0('0x35')]=_[_0x4df0('0x36')](_0x42872a[_0x4df0('0x32')],_0x42872a[_0x4df0('0x33')]);_0xaa162b[_0x4df0('0x37')]=_['intersection'](_0x42872a['model'],qs['fields'](_0x28858e['query'][_0x4df0('0x38')]));_0xaa162b[_0x4df0('0x37')]=_0xaa162b[_0x4df0('0x37')]['length']?_0xaa162b[_0x4df0('0x37')]:_0x42872a[_0x4df0('0x32')];_0xaa162b[_0x4df0('0x4d')]=qs['sort'](_0x28858e['query']['sort']);_0xaa162b[_0x4df0('0x3c')]=qs[_0x4df0('0x35')](_[_0x4df0('0x4e')](_0x28858e['query'],_0x42872a['filters']));if(_0x28858e['query']['filter']){_0xaa162b[_0x4df0('0x3c')]=_[_0x4df0('0x3f')](_0xaa162b[_0x4df0('0x3c')],{'$or':_[_0x4df0('0x2d')](_0xaa162b[_0x4df0('0x37')],function(_0x3403f1){var _0x59b928={};_0x59b928[_0x3403f1]={'$like':'%'+_0x28858e[_0x4df0('0x33')][_0x4df0('0x3d')]+'%'};return _0x59b928;})});}_0xaa162b=_[_0x4df0('0x3f')]({},_0xaa162b,_0x28858e[_0x4df0('0x40')]);return _0x2db349['getFields'](_0xaa162b);}})['then'](function(_0x4df299){if(_0x4df299){_0x2ca03a=_0x4df299[_0x4df0('0x44')];if(!_0x28858e[_0x4df0('0x33')][_0x4df0('0x39')](_0x4df0('0x3a'))){_0xaa162b[_0x4df0('0x20')]=qs[_0x4df0('0x20')](_0x28858e[_0x4df0('0x33')][_0x4df0('0x20')]);_0xaa162b['offset']=qs[_0x4df0('0x1e')](_0x28858e[_0x4df0('0x33')]['offset']);}return _0x2db349[_0x4df0('0x4b')](_0xaa162b);}})[_0x4df0('0x27')](function(_0x115bc8){if(_0x115bc8){return _0x115bc8?{'count':_0x2ca03a,'rows':_0x115bc8}:null;}})[_0x4df0('0x27')](respondWithResult(_0x2c5dd8,null))['catch'](handleError(_0x2c5dd8,null));};exports[_0x4df0('0x4f')]=function(_0x2deed5,_0x1dc26b,_0x4e4399){var _0x21bfab={};var _0xf3283b={};var _0x540e65;var _0x58112b;return db[_0x4df0('0x2e')][_0x4df0('0x4c')]({'where':{'id':_0x2deed5['params']['id']}})[_0x4df0('0x27')](handleEntityNotFound(_0x1dc26b,null))[_0x4df0('0x27')](function(_0xc2a297){if(_0xc2a297){_0x540e65=_0xc2a297;_0xf3283b['model']=_[_0x4df0('0x34')](db[_0x4df0('0x50')][_0x4df0('0x2f')]);_0xf3283b['query']=_[_0x4df0('0x34')](_0x2deed5[_0x4df0('0x33')]);_0xf3283b[_0x4df0('0x35')]=_[_0x4df0('0x36')](_0xf3283b[_0x4df0('0x32')],_0xf3283b[_0x4df0('0x33')]);_0x21bfab['attributes']=_[_0x4df0('0x36')](_0xf3283b[_0x4df0('0x32')],qs[_0x4df0('0x38')](_0x2deed5[_0x4df0('0x33')][_0x4df0('0x38')]));_0x21bfab[_0x4df0('0x37')]=_0x21bfab[_0x4df0('0x37')][_0x4df0('0x44')]?_0x21bfab[_0x4df0('0x37')]:_0xf3283b['model'];_0x21bfab[_0x4df0('0x4d')]=qs[_0x4df0('0x3b')](_0x2deed5[_0x4df0('0x33')][_0x4df0('0x3b')]);_0x21bfab[_0x4df0('0x3c')]=qs[_0x4df0('0x35')](_[_0x4df0('0x4e')](_0x2deed5['query'],_0xf3283b[_0x4df0('0x35')]));if(_0x2deed5[_0x4df0('0x33')][_0x4df0('0x3d')]){_0x21bfab[_0x4df0('0x3c')]=_[_0x4df0('0x3f')](_0x21bfab[_0x4df0('0x3c')],{'$or':_[_0x4df0('0x2d')](_0x21bfab[_0x4df0('0x37')],function(_0x226d2c){var _0x5bd221={};_0x5bd221[_0x226d2c]={'$like':'%'+_0x2deed5[_0x4df0('0x33')][_0x4df0('0x3d')]+'%'};return _0x5bd221;})});}_0x21bfab=_[_0x4df0('0x3f')]({},_0x21bfab,_0x2deed5[_0x4df0('0x40')]);return _0x540e65['getSubjects'](_0x21bfab);}})['then'](function(_0x4d2de3){if(_0x4d2de3){_0x58112b=_0x4d2de3[_0x4df0('0x44')];if(!_0x2deed5['query']['hasOwnProperty']('nolimit')){_0x21bfab['limit']=qs[_0x4df0('0x20')](_0x2deed5[_0x4df0('0x33')][_0x4df0('0x20')]);_0x21bfab[_0x4df0('0x1e')]=qs['offset'](_0x2deed5[_0x4df0('0x33')][_0x4df0('0x1e')]);}return _0x540e65[_0x4df0('0x4f')](_0x21bfab);}})[_0x4df0('0x27')](function(_0x1a714d){if(_0x1a714d){return _0x1a714d?{'count':_0x58112b,'rows':_0x1a714d}:null;}})[_0x4df0('0x27')](respondWithResult(_0x1dc26b,null))[_0x4df0('0x48')](handleError(_0x1dc26b,null));};exports[_0x4df0('0x51')]=function(_0x47bb76,_0x46898c,_0x46c7cc){var _0x4a17ef={};var _0x1706d7={};var _0xa2d08c;var _0x1d62a5;return db['ZohoConfiguration'][_0x4df0('0x4c')]({'where':{'id':_0x47bb76[_0x4df0('0x43')]['id']}})[_0x4df0('0x27')](handleEntityNotFound(_0x46898c,null))['then'](function(_0x5643d6){if(_0x5643d6){_0xa2d08c=_0x5643d6;_0x1706d7['model']=_[_0x4df0('0x34')](db[_0x4df0('0x50')][_0x4df0('0x2f')]);_0x1706d7['query']=_[_0x4df0('0x34')](_0x47bb76[_0x4df0('0x33')]);_0x1706d7[_0x4df0('0x35')]=_['intersection'](_0x1706d7['model'],_0x1706d7[_0x4df0('0x33')]);_0x4a17ef['attributes']=_['intersection'](_0x1706d7['model'],qs[_0x4df0('0x38')](_0x47bb76[_0x4df0('0x33')][_0x4df0('0x38')]));_0x4a17ef[_0x4df0('0x37')]=_0x4a17ef[_0x4df0('0x37')][_0x4df0('0x44')]?_0x4a17ef[_0x4df0('0x37')]:_0x1706d7[_0x4df0('0x32')];_0x4a17ef['order']=qs[_0x4df0('0x3b')](_0x47bb76[_0x4df0('0x33')][_0x4df0('0x3b')]);_0x4a17ef[_0x4df0('0x3c')]=qs[_0x4df0('0x35')](_[_0x4df0('0x4e')](_0x47bb76[_0x4df0('0x33')],_0x1706d7['filters']));if(_0x47bb76[_0x4df0('0x33')][_0x4df0('0x3d')]){_0x4a17ef[_0x4df0('0x3c')]=_['merge'](_0x4a17ef[_0x4df0('0x3c')],{'$or':_[_0x4df0('0x2d')](_0x4a17ef[_0x4df0('0x37')],function(_0x43c0e){var _0x3d3fa6={};_0x3d3fa6[_0x43c0e]={'$like':'%'+_0x47bb76[_0x4df0('0x33')][_0x4df0('0x3d')]+'%'};return _0x3d3fa6;})});}_0x4a17ef=_[_0x4df0('0x3f')]({},_0x4a17ef,_0x47bb76[_0x4df0('0x40')]);return _0xa2d08c[_0x4df0('0x51')](_0x4a17ef);}})[_0x4df0('0x27')](function(_0x2d0de9){if(_0x2d0de9){_0x1d62a5=_0x2d0de9[_0x4df0('0x44')];if(!_0x47bb76[_0x4df0('0x33')][_0x4df0('0x39')](_0x4df0('0x3a'))){_0x4a17ef[_0x4df0('0x20')]=qs[_0x4df0('0x20')](_0x47bb76[_0x4df0('0x33')][_0x4df0('0x20')]);_0x4a17ef[_0x4df0('0x1e')]=qs[_0x4df0('0x1e')](_0x47bb76[_0x4df0('0x33')][_0x4df0('0x1e')]);}return _0xa2d08c[_0x4df0('0x51')](_0x4a17ef);}})[_0x4df0('0x27')](function(_0xe1db03){if(_0xe1db03){return _0xe1db03?{'count':_0x1d62a5,'rows':_0xe1db03}:null;}})[_0x4df0('0x27')](respondWithResult(_0x46898c,null))[_0x4df0('0x48')](handleError(_0x46898c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fad9c2b..27f09e6 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 _0x5dba=['moment','path','rimraf','exports','define','int_zoho_configurations','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dba,0x1da));var _0xa5db=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0x5dba[_0x24d92a];return _0x2d5aed;};'use strict';var _=require(_0xa5db('0x0'));var util=require('util');var logger=require(_0xa5db('0x1'))(_0xa5db('0x2'));var moment=require(_0xa5db('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5db('0x4'));var rimraf=require(_0xa5db('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xa5db('0x6')]=function(_0x3a9a66,_0xdd0d39){return _0x3a9a66[_0xa5db('0x7')]('ZohoConfiguration',attributes,{'tableName':_0xa5db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2496=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoConfiguration.attributes','exports','define'];(function(_0x4fc793,_0x93d251){var _0x514bbf=function(_0x4afbf3){while(--_0x4afbf3){_0x4fc793['push'](_0x4fc793['shift']());}};_0x514bbf(++_0x93d251);}(_0x2496,0xe6));var _0x6249=function(_0x2a1457,_0xb87c7c){_0x2a1457=_0x2a1457-0x0;var _0x358f8f=_0x2496[_0x2a1457];return _0x358f8f;};'use strict';var _=require(_0x6249('0x0'));var util=require('util');var logger=require(_0x6249('0x1'))(_0x6249('0x2'));var moment=require(_0x6249('0x3'));var BPromise=require(_0x6249('0x4'));var rp=require(_0x6249('0x5'));var fs=require('fs');var path=require(_0x6249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6249('0x7'));module[_0x6249('0x8')]=function(_0x4172e3,_0x2b6054){return _0x4172e3[_0x6249('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','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 0d442b5..14bc2c8 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 _0xb7a4=['bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util'];(function(_0x20a089,_0x158776){var _0x4521e9=function(_0x5b1728){while(--_0x5b1728){_0x20a089['push'](_0x20a089['shift']());}};_0x4521e9(++_0x158776);}(_0xb7a4,0xfd));var _0x4b7a=function(_0x16decb,_0x57d16f){_0x16decb=_0x16decb-0x0;var _0x3277da=_0xb7a4[_0x16decb];return _0x3277da;};'use strict';var _=require(_0x4b7a('0x0'));var util=require(_0x4b7a('0x1'));var moment=require('moment');var BPromise=require(_0x4b7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b7a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b7a('0x4'))('rpc');var config=require(_0x4b7a('0x5'));var jayson=require(_0x4b7a('0x6'));var client=jayson[_0x4b7a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11ac9f,_0x397119,_0x3fbfde){return new BPromise(function(_0x4b41d1,_0x3cacb4){return client[_0x4b7a('0x8')](_0x11ac9f,_0x3fbfde)['then'](function(_0x201013){logger[_0x4b7a('0x9')](_0x4b7a('0xa'),_0x397119,_0x4b7a('0xb'));logger[_0x4b7a('0xc')](_0x4b7a('0xd'),_0x397119,_0x4b7a('0xb'),JSON['stringify'](_0x201013));if(_0x201013[_0x4b7a('0xe')]){if(_0x201013['error']['code']===0x1f4){logger[_0x4b7a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x397119,_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);return _0x3cacb4(_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);}logger[_0x4b7a('0xe')](_0x4b7a('0xa'),_0x397119,_0x201013['error'][_0x4b7a('0xf')]);return _0x4b41d1(_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);}else{logger[_0x4b7a('0x9')](_0x4b7a('0xa'),_0x397119,_0x4b7a('0xb'));_0x4b41d1(_0x201013['result'][_0x4b7a('0xf')]);}})[_0x4b7a('0x10')](function(_0x2d6c04){logger['error'](_0x4b7a('0xa'),_0x397119,_0x2d6c04);_0x3cacb4(_0x2d6c04);});});} \ No newline at end of file +var _0xdad8=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird'];(function(_0x1af6b7,_0xda9b0b){var _0x1f4e55=function(_0xe6fea6){while(--_0xe6fea6){_0x1af6b7['push'](_0x1af6b7['shift']());}};_0x1f4e55(++_0xda9b0b);}(_0xdad8,0x110));var _0x8dad=function(_0x20419e,_0x422e8a){_0x20419e=_0x20419e-0x0;var _0x24054f=_0xdad8[_0x20419e];return _0x24054f;};'use strict';var _=require(_0x8dad('0x0'));var util=require(_0x8dad('0x1'));var moment=require(_0x8dad('0x2'));var BPromise=require(_0x8dad('0x3'));var rs=require(_0x8dad('0x4'));var fs=require('fs');var Redis=require(_0x8dad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8dad('0x6'));var logger=require(_0x8dad('0x7'))(_0x8dad('0x8'));var config=require(_0x8dad('0x9'));var jayson=require(_0x8dad('0xa'));var client=jayson[_0x8dad('0xb')][_0x8dad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17abeb,_0xaaa40e,_0x48f15e){return new BPromise(function(_0x15252a,_0x6c222e){return client['request'](_0x17abeb,_0x48f15e)[_0x8dad('0xd')](function(_0x26dd9a){logger[_0x8dad('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xaaa40e,_0x8dad('0xf'));logger[_0x8dad('0x10')](_0x8dad('0x11'),_0xaaa40e,_0x8dad('0xf'),JSON[_0x8dad('0x12')](_0x26dd9a));if(_0x26dd9a[_0x8dad('0x13')]){if(_0x26dd9a['error'][_0x8dad('0x14')]===0x1f4){logger[_0x8dad('0x13')](_0x8dad('0x15'),_0xaaa40e,_0x26dd9a[_0x8dad('0x13')][_0x8dad('0x16')]);return _0x6c222e(_0x26dd9a[_0x8dad('0x13')]['message']);}logger['error'](_0x8dad('0x15'),_0xaaa40e,_0x26dd9a[_0x8dad('0x13')][_0x8dad('0x16')]);return _0x15252a(_0x26dd9a[_0x8dad('0x13')][_0x8dad('0x16')]);}else{logger[_0x8dad('0xe')](_0x8dad('0x15'),_0xaaa40e,'request\x20sent');_0x15252a(_0x26dd9a['result'][_0x8dad('0x16')]);}})['catch'](function(_0x5da8e4){logger[_0x8dad('0x13')](_0x8dad('0x15'),_0xaaa40e,_0x5da8e4);_0x6c222e(_0x5da8e4);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a86c2a3..50369d4 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 _0x922c=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x922c,0x11c));var _0xc922=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x922c[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0xc922('0x0'));var util=require('util');var path=require(_0xc922('0x1'));var timeout=require('connect-timeout');var express=require(_0xc922('0x2'));var router=express[_0xc922('0x3')]();var fs_extra=require(_0xc922('0x4'));var auth=require(_0xc922('0x5'));var interaction=require(_0xc922('0x6'));var config=require(_0xc922('0x7'));var controller=require(_0xc922('0x8'));router[_0xc922('0x9')]('/',auth[_0xc922('0xa')](),controller[_0xc922('0xb')]);router[_0xc922('0x9')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0xd')]);router[_0xc922('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc922('0xf')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0x10')]);router[_0xc922('0x11')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2f37=['index','/:id','put','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x2f37,0x122));var _0x72f3=function(_0x58d105,_0x4e6727){_0x58d105=_0x58d105-0x0;var _0xf79844=_0x2f37[_0x58d105];return _0xf79844;};'use strict';var multer=require('multer');var util=require(_0x72f3('0x0'));var path=require(_0x72f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x72f3('0x2'));var router=express[_0x72f3('0x3')]();var fs_extra=require(_0x72f3('0x4'));var auth=require(_0x72f3('0x5'));var interaction=require(_0x72f3('0x6'));var config=require('../../config/environment');var controller=require(_0x72f3('0x7'));router[_0x72f3('0x8')]('/',auth[_0x72f3('0x9')](),controller[_0x72f3('0xa')]);router[_0x72f3('0x8')](_0x72f3('0xb'),auth[_0x72f3('0x9')](),controller['show']);router['post']('/',auth[_0x72f3('0x9')](),controller['create']);router[_0x72f3('0xc')](_0x72f3('0xb'),auth[_0x72f3('0x9')](),controller[_0x72f3('0xd')]);router['delete'](_0x72f3('0xb'),auth[_0x72f3('0x9')](),controller['destroy']);module[_0x72f3('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c05ede8..e6ee121 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 _0x0a46=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4924ae,_0x1dd735){var _0x2238e4=function(_0x48dc88){while(--_0x48dc88){_0x4924ae['push'](_0x4924ae['shift']());}};_0x2238e4(++_0x1dd735);}(_0x0a46,0xa4));var _0x60a4=function(_0x4410b7,_0x1523af){_0x4410b7=_0x4410b7-0x0;var _0x31e4f0=_0x0a46[_0x4410b7];return _0x31e4f0;};'use strict';var Sequelize=require(_0x60a4('0x0'));module[_0x60a4('0x1')]={'type':{'type':Sequelize[_0x60a4('0x2')](_0x60a4('0x3'),_0x60a4('0x4'),_0x60a4('0x5'),_0x60a4('0x6'),_0x60a4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x60a4('0x8')]},'keyType':{'type':Sequelize[_0x60a4('0x2')]('string',_0x60a4('0x4'),_0x60a4('0x5'))},'keyContent':{'type':Sequelize[_0x60a4('0x8')]},'idField':{'type':Sequelize[_0x60a4('0x8')]},'nameField':{'type':Sequelize[_0x60a4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x60a4('0x8')]}}; \ No newline at end of file +var _0x1932=['variable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4ab848,_0x244ff9){var _0x3064e4=function(_0x2fdb94){while(--_0x2fdb94){_0x4ab848['push'](_0x4ab848['shift']());}};_0x3064e4(++_0x244ff9);}(_0x1932,0x9c));var _0x2193=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x1932[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x2193('0x0'));module[_0x2193('0x1')]={'type':{'type':Sequelize[_0x2193('0x2')](_0x2193('0x3'),_0x2193('0x4'),'customVariable','keyValue',_0x2193('0x5')),'defaultValue':_0x2193('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2193('0x2')](_0x2193('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2193('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2193('0x6')]},'customField':{'type':Sequelize[_0x2193('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2193('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d63cac3..463d0c9 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 _0xfbf7=['set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit'];(function(_0x42f919,_0x37c612){var _0x3d5250=function(_0x21547f){while(--_0x21547f){_0x42f919['push'](_0x42f919['shift']());}};_0x3d5250(++_0x37c612);}(_0xfbf7,0x113));var _0x7fbf=function(_0x49d375,_0x36f3fc){_0x49d375=_0x49d375-0x0;var _0x5d0289=_0xfbf7[_0x49d375];return _0x5d0289;};'use strict';var emlformat=require(_0x7fbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fbf('0x2'));var moment=require(_0x7fbf('0x3'));var BPromise=require(_0x7fbf('0x4'));var Mustache=require(_0x7fbf('0x5'));var util=require(_0x7fbf('0x6'));var path=require(_0x7fbf('0x7'));var sox=require(_0x7fbf('0x8'));var csv=require(_0x7fbf('0x9'));var ejs=require(_0x7fbf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fbf('0xb'));var squel=require(_0x7fbf('0xc'));var crypto=require(_0x7fbf('0xd'));var jsforce=require(_0x7fbf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7fbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fbf('0xf'));var authService=require(_0x7fbf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7fbf('0x11'));var hardwareService=require(_0x7fbf('0x12'));var logger=require('../../config/logger')(_0x7fbf('0x13'));var utils=require(_0x7fbf('0x14'));var config=require(_0x7fbf('0x15'));var licenseUtil=require(_0x7fbf('0x16'));var db=require(_0x7fbf('0x17'))['db'];function respondWithStatusCode(_0x42f11b,_0xb52843){_0xb52843=_0xb52843||0xcc;return function(_0x1adf53){if(_0x1adf53){return _0x42f11b['sendStatus'](_0xb52843);}return _0x42f11b[_0x7fbf('0x18')](_0xb52843)['end']();};}function respondWithResult(_0x2d52b4,_0x554684){_0x554684=_0x554684||0xc8;return function(_0x48fe44){if(_0x48fe44){return _0x2d52b4['status'](_0x554684)['json'](_0x48fe44);}};}function respondWithFilteredResult(_0x4fd0ff,_0xff3af9){return function(_0x20acca){if(_0x20acca){var _0x81a575=typeof _0xff3af9[_0x7fbf('0x19')]===_0x7fbf('0x1a')&&typeof _0xff3af9['limit']===_0x7fbf('0x1a');var _0x58ffdc=_0x20acca['count'];var _0x132160=_0x81a575?0x0:_0xff3af9[_0x7fbf('0x19')];var _0x4b1a61=_0x81a575?_0x20acca[_0x7fbf('0x1b')]:_0xff3af9[_0x7fbf('0x19')]+_0xff3af9[_0x7fbf('0x1c')];var _0x9f3c60;if(_0x4b1a61>=_0x58ffdc){_0x4b1a61=_0x58ffdc;_0x9f3c60=0xc8;}else{_0x9f3c60=0xce;}_0x4fd0ff[_0x7fbf('0x18')](_0x9f3c60);return _0x4fd0ff[_0x7fbf('0x1d')](_0x7fbf('0x1e'),_0x132160+'-'+_0x4b1a61+'/'+_0x58ffdc)[_0x7fbf('0x1f')](_0x20acca);}return null;};}function patchUpdates(_0x5865d3){return function(_0x25d73b){try{jsonpatch[_0x7fbf('0x20')](_0x25d73b,_0x5865d3,!![]);}catch(_0x429eaf){return BPromise[_0x7fbf('0x21')](_0x429eaf);}return _0x25d73b[_0x7fbf('0x22')]();};}function saveUpdates(_0x47bc19,_0x15ed37){return function(_0x42b8d6){if(_0x42b8d6){return _0x42b8d6[_0x7fbf('0x23')](_0x47bc19)[_0x7fbf('0x24')](function(_0x469876){return _0x469876;});}return null;};}function removeEntity(_0x351690,_0x436ea0){return function(_0x44ce6e){if(_0x44ce6e){return _0x44ce6e[_0x7fbf('0x25')]()['then'](function(){_0x351690[_0x7fbf('0x18')](0xcc)[_0x7fbf('0x26')]();});}};}function handleEntityNotFound(_0x3089c4,_0x1d88d2){return function(_0x1eece1){if(!_0x1eece1){_0x3089c4[_0x7fbf('0x27')](0x194);}return _0x1eece1;};}function handleError(_0x3c7b48,_0x6b58bb){_0x6b58bb=_0x6b58bb||0x1f4;return function(_0x451809){logger[_0x7fbf('0x28')](_0x451809[_0x7fbf('0x29')]);if(_0x451809[_0x7fbf('0x2a')]){delete _0x451809[_0x7fbf('0x2a')];}_0x3c7b48[_0x7fbf('0x18')](_0x6b58bb)[_0x7fbf('0x2b')](_0x451809);};}exports['index']=function(_0x3ba867,_0x5eeb55){var _0x2565b4={},_0x5d46cf={},_0x221cc7={'count':0x0,'rows':[]};var _0x5988f5=_[_0x7fbf('0x2c')](db[_0x7fbf('0x2d')][_0x7fbf('0x2e')],function(_0x2ac154){return{'name':_0x2ac154[_0x7fbf('0x2f')],'type':_0x2ac154['type'][_0x7fbf('0x30')]};});_0x5d46cf['model']=_[_0x7fbf('0x2c')](_0x5988f5,_0x7fbf('0x2a'));_0x5d46cf[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x3ba867[_0x7fbf('0x31')]);_0x5d46cf[_0x7fbf('0x33')]=_['intersection'](_0x5d46cf[_0x7fbf('0x34')],_0x5d46cf[_0x7fbf('0x31')]);_0x2565b4[_0x7fbf('0x35')]=_[_0x7fbf('0x36')](_0x5d46cf[_0x7fbf('0x34')],qs[_0x7fbf('0x37')](_0x3ba867[_0x7fbf('0x31')]['fields']));_0x2565b4['attributes']=_0x2565b4[_0x7fbf('0x35')]['length']?_0x2565b4[_0x7fbf('0x35')]:_0x5d46cf[_0x7fbf('0x34')];if(!_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x38')]('nolimit')){_0x2565b4[_0x7fbf('0x1c')]=qs[_0x7fbf('0x1c')](_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x1c')]);_0x2565b4['offset']=qs['offset'](_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x19')]);}_0x2565b4['order']=qs[_0x7fbf('0x39')](_0x3ba867['query'][_0x7fbf('0x39')]);_0x2565b4[_0x7fbf('0x3a')]=qs[_0x7fbf('0x33')](_[_0x7fbf('0x3b')](_0x3ba867[_0x7fbf('0x31')],_0x5d46cf[_0x7fbf('0x33')]),_0x5988f5);if(_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x3c')]){_0x2565b4['where']=_[_0x7fbf('0x3d')](_0x2565b4[_0x7fbf('0x3a')],{'$or':_['map'](_0x5988f5,function(_0x422193){if(_0x422193[_0x7fbf('0x3e')]!==_0x7fbf('0x3f')){var _0x111e67={};_0x111e67[_0x422193[_0x7fbf('0x2a')]]={'$like':'%'+_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x3c')]+'%'};return _0x111e67;}})});}_0x2565b4=_[_0x7fbf('0x3d')]({},_0x2565b4,_0x3ba867[_0x7fbf('0x40')]);var _0x1923d2={'where':_0x2565b4[_0x7fbf('0x3a')]};return db[_0x7fbf('0x2d')][_0x7fbf('0x1b')](_0x1923d2)[_0x7fbf('0x24')](function(_0x150f10){_0x221cc7[_0x7fbf('0x1b')]=_0x150f10;if(_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x41')]){_0x2565b4['include']=[{'all':!![]}];}return db['ZohoField'][_0x7fbf('0x42')](_0x2565b4);})[_0x7fbf('0x24')](function(_0x2ab52a){_0x221cc7[_0x7fbf('0x43')]=_0x2ab52a;return _0x221cc7;})['then'](respondWithFilteredResult(_0x5eeb55,_0x2565b4))[_0x7fbf('0x44')](handleError(_0x5eeb55,null));};exports[_0x7fbf('0x45')]=function(_0x40102b,_0x27675c){var _0x44e0c9={'raw':!![],'where':{'id':_0x40102b['params']['id']}},_0x1c8c99={};_0x1c8c99[_0x7fbf('0x34')]=_[_0x7fbf('0x32')](db[_0x7fbf('0x2d')][_0x7fbf('0x2e')]);_0x1c8c99[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x40102b[_0x7fbf('0x31')]);_0x1c8c99['filters']=_[_0x7fbf('0x36')](_0x1c8c99[_0x7fbf('0x34')],_0x1c8c99[_0x7fbf('0x31')]);_0x44e0c9['attributes']=_[_0x7fbf('0x36')](_0x1c8c99[_0x7fbf('0x34')],qs[_0x7fbf('0x37')](_0x40102b[_0x7fbf('0x31')][_0x7fbf('0x37')]));_0x44e0c9[_0x7fbf('0x35')]=_0x44e0c9[_0x7fbf('0x35')][_0x7fbf('0x46')]?_0x44e0c9['attributes']:_0x1c8c99[_0x7fbf('0x34')];if(_0x40102b[_0x7fbf('0x31')]['includeAll']){_0x44e0c9[_0x7fbf('0x47')]=[{'all':!![]}];}_0x44e0c9=_[_0x7fbf('0x3d')]({},_0x44e0c9,_0x40102b['options']);return db[_0x7fbf('0x2d')][_0x7fbf('0x48')](_0x44e0c9)[_0x7fbf('0x24')](handleEntityNotFound(_0x27675c,null))[_0x7fbf('0x24')](respondWithResult(_0x27675c,null))[_0x7fbf('0x44')](handleError(_0x27675c,null));};exports['create']=function(_0x3ad66b,_0xd2af2e){return db['ZohoField'][_0x7fbf('0x49')](_0x3ad66b[_0x7fbf('0x4a')],{})[_0x7fbf('0x24')](respondWithResult(_0xd2af2e,0xc9))[_0x7fbf('0x44')](handleError(_0xd2af2e,null));};exports[_0x7fbf('0x23')]=function(_0x333ad6,_0x38a5ba){if(_0x333ad6[_0x7fbf('0x4a')]['id']){delete _0x333ad6[_0x7fbf('0x4a')]['id'];}return db['ZohoField'][_0x7fbf('0x48')]({'where':{'id':_0x333ad6[_0x7fbf('0x4b')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x38a5ba,null))[_0x7fbf('0x24')](saveUpdates(_0x333ad6['body'],null))['then'](respondWithResult(_0x38a5ba,null))['catch'](handleError(_0x38a5ba,null));};exports['destroy']=function(_0x231ecb,_0x13a4cb){return db[_0x7fbf('0x2d')][_0x7fbf('0x48')]({'where':{'id':_0x231ecb[_0x7fbf('0x4b')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x13a4cb,null))[_0x7fbf('0x24')](removeEntity(_0x13a4cb,null))[_0x7fbf('0x44')](handleError(_0x13a4cb,null));}; \ No newline at end of file +var _0x634f=['order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','rimraf','zip-dir','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','index','map','ZohoField','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','nolimit'];(function(_0x50a37b,_0x5cd9bc){var _0x490db6=function(_0x3dbf81){while(--_0x3dbf81){_0x50a37b['push'](_0x50a37b['shift']());}};_0x490db6(++_0x5cd9bc);}(_0x634f,0xab));var _0xf634=function(_0x4c437a,_0x92f5e5){_0x4c437a=_0x4c437a-0x0;var _0x3a47ba=_0x634f[_0x4c437a];return _0x3a47ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf634('0x0'));var zipdir=require(_0xf634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf634('0x2'));var moment=require('moment');var BPromise=require(_0xf634('0x3'));var Mustache=require(_0xf634('0x4'));var util=require(_0xf634('0x5'));var path=require(_0xf634('0x6'));var sox=require('sox');var csv=require(_0xf634('0x7'));var ejs=require(_0xf634('0x8'));var fs=require('fs');var fs_extra=require(_0xf634('0x9'));var _=require(_0xf634('0xa'));var squel=require(_0xf634('0xb'));var crypto=require(_0xf634('0xc'));var jsforce=require(_0xf634('0xd'));var deskjs=require(_0xf634('0xe'));var toCsv=require(_0xf634('0x7'));var querystring=require(_0xf634('0xf'));var Papa=require(_0xf634('0x10'));var Redis=require(_0xf634('0x11'));var authService=require(_0xf634('0x12'));var qs=require(_0xf634('0x13'));var as=require(_0xf634('0x14'));var hardwareService=require(_0xf634('0x15'));var logger=require(_0xf634('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf634('0x17'));var licenseUtil=require(_0xf634('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2416,_0x27b681){_0x27b681=_0x27b681||0xcc;return function(_0x22b08f){if(_0x22b08f){return _0x2c2416[_0xf634('0x19')](_0x27b681);}return _0x2c2416[_0xf634('0x1a')](_0x27b681)[_0xf634('0x1b')]();};}function respondWithResult(_0x4d6d20,_0x15c4e7){_0x15c4e7=_0x15c4e7||0xc8;return function(_0x3d3b14){if(_0x3d3b14){return _0x4d6d20[_0xf634('0x1a')](_0x15c4e7)['json'](_0x3d3b14);}};}function respondWithFilteredResult(_0x3a8132,_0x5c1654){return function(_0x94a87f){if(_0x94a87f){var _0x26587e=typeof _0x5c1654[_0xf634('0x1c')]===_0xf634('0x1d')&&typeof _0x5c1654['limit']===_0xf634('0x1d');var _0x1eba7a=_0x94a87f['count'];var _0xe2f071=_0x26587e?0x0:_0x5c1654[_0xf634('0x1c')];var _0xd5afe1=_0x26587e?_0x94a87f[_0xf634('0x1e')]:_0x5c1654[_0xf634('0x1c')]+_0x5c1654[_0xf634('0x1f')];var _0x461e7f;if(_0xd5afe1>=_0x1eba7a){_0xd5afe1=_0x1eba7a;_0x461e7f=0xc8;}else{_0x461e7f=0xce;}_0x3a8132[_0xf634('0x1a')](_0x461e7f);return _0x3a8132[_0xf634('0x20')](_0xf634('0x21'),_0xe2f071+'-'+_0xd5afe1+'/'+_0x1eba7a)[_0xf634('0x22')](_0x94a87f);}return null;};}function patchUpdates(_0xe98107){return function(_0xdd58ca){try{jsonpatch[_0xf634('0x23')](_0xdd58ca,_0xe98107,!![]);}catch(_0x2e7dfd){return BPromise[_0xf634('0x24')](_0x2e7dfd);}return _0xdd58ca['save']();};}function saveUpdates(_0x2c24cb,_0x2a9951){return function(_0x582db3){if(_0x582db3){return _0x582db3[_0xf634('0x25')](_0x2c24cb)[_0xf634('0x26')](function(_0xdbc11c){return _0xdbc11c;});}return null;};}function removeEntity(_0x39bb0a,_0x1fbb52){return function(_0x3fe282){if(_0x3fe282){return _0x3fe282[_0xf634('0x27')]()['then'](function(){_0x39bb0a[_0xf634('0x1a')](0xcc)[_0xf634('0x1b')]();});}};}function handleEntityNotFound(_0x3412bd,_0x1aeb48){return function(_0x1318e0){if(!_0x1318e0){_0x3412bd[_0xf634('0x19')](0x194);}return _0x1318e0;};}function handleError(_0x12a8c8,_0xfbfb18){_0xfbfb18=_0xfbfb18||0x1f4;return function(_0x514242){logger[_0xf634('0x28')](_0x514242[_0xf634('0x29')]);if(_0x514242['name']){delete _0x514242['name'];}_0x12a8c8[_0xf634('0x1a')](_0xfbfb18)['send'](_0x514242);};}exports[_0xf634('0x2a')]=function(_0x5531f3,_0x576dc2){var _0x24ff0b={},_0x4bdf16={},_0x55e3d4={'count':0x0,'rows':[]};var _0x4243de=_[_0xf634('0x2b')](db[_0xf634('0x2c')][_0xf634('0x2d')],function(_0x12b12e){return{'name':_0x12b12e[_0xf634('0x2e')],'type':_0x12b12e[_0xf634('0x2f')][_0xf634('0x30')]};});_0x4bdf16[_0xf634('0x31')]=_[_0xf634('0x2b')](_0x4243de,_0xf634('0x32'));_0x4bdf16[_0xf634('0x33')]=_[_0xf634('0x34')](_0x5531f3[_0xf634('0x33')]);_0x4bdf16['filters']=_[_0xf634('0x35')](_0x4bdf16['model'],_0x4bdf16[_0xf634('0x33')]);_0x24ff0b[_0xf634('0x36')]=_[_0xf634('0x35')](_0x4bdf16[_0xf634('0x31')],qs[_0xf634('0x37')](_0x5531f3[_0xf634('0x33')][_0xf634('0x37')]));_0x24ff0b['attributes']=_0x24ff0b[_0xf634('0x36')]['length']?_0x24ff0b['attributes']:_0x4bdf16['model'];if(!_0x5531f3['query']['hasOwnProperty'](_0xf634('0x38'))){_0x24ff0b['limit']=qs[_0xf634('0x1f')](_0x5531f3[_0xf634('0x33')]['limit']);_0x24ff0b['offset']=qs[_0xf634('0x1c')](_0x5531f3[_0xf634('0x33')]['offset']);}_0x24ff0b[_0xf634('0x39')]=qs[_0xf634('0x3a')](_0x5531f3['query']['sort']);_0x24ff0b[_0xf634('0x3b')]=qs['filters'](_['pick'](_0x5531f3[_0xf634('0x33')],_0x4bdf16[_0xf634('0x3c')]),_0x4243de);if(_0x5531f3[_0xf634('0x33')][_0xf634('0x3d')]){_0x24ff0b[_0xf634('0x3b')]=_[_0xf634('0x3e')](_0x24ff0b[_0xf634('0x3b')],{'$or':_['map'](_0x4243de,function(_0x2b4ed9){if(_0x2b4ed9[_0xf634('0x2f')]!==_0xf634('0x3f')){var _0x180f3a={};_0x180f3a[_0x2b4ed9['name']]={'$like':'%'+_0x5531f3[_0xf634('0x33')][_0xf634('0x3d')]+'%'};return _0x180f3a;}})});}_0x24ff0b=_['merge']({},_0x24ff0b,_0x5531f3[_0xf634('0x40')]);var _0x2c7c2e={'where':_0x24ff0b[_0xf634('0x3b')]};return db[_0xf634('0x2c')][_0xf634('0x1e')](_0x2c7c2e)[_0xf634('0x26')](function(_0x3d7337){_0x55e3d4[_0xf634('0x1e')]=_0x3d7337;if(_0x5531f3[_0xf634('0x33')][_0xf634('0x41')]){_0x24ff0b[_0xf634('0x42')]=[{'all':!![]}];}return db[_0xf634('0x2c')][_0xf634('0x43')](_0x24ff0b);})[_0xf634('0x26')](function(_0x1053e9){_0x55e3d4[_0xf634('0x44')]=_0x1053e9;return _0x55e3d4;})[_0xf634('0x26')](respondWithFilteredResult(_0x576dc2,_0x24ff0b))['catch'](handleError(_0x576dc2,null));};exports[_0xf634('0x45')]=function(_0x48ab89,_0x30755b){var _0x307143={'raw':!![],'where':{'id':_0x48ab89[_0xf634('0x46')]['id']}},_0x9319fe={};_0x9319fe[_0xf634('0x31')]=_['keys'](db[_0xf634('0x2c')][_0xf634('0x2d')]);_0x9319fe[_0xf634('0x33')]=_['keys'](_0x48ab89[_0xf634('0x33')]);_0x9319fe[_0xf634('0x3c')]=_['intersection'](_0x9319fe[_0xf634('0x31')],_0x9319fe[_0xf634('0x33')]);_0x307143[_0xf634('0x36')]=_['intersection'](_0x9319fe['model'],qs[_0xf634('0x37')](_0x48ab89[_0xf634('0x33')][_0xf634('0x37')]));_0x307143[_0xf634('0x36')]=_0x307143[_0xf634('0x36')][_0xf634('0x47')]?_0x307143[_0xf634('0x36')]:_0x9319fe[_0xf634('0x31')];if(_0x48ab89['query'][_0xf634('0x41')]){_0x307143[_0xf634('0x42')]=[{'all':!![]}];}_0x307143=_[_0xf634('0x3e')]({},_0x307143,_0x48ab89[_0xf634('0x40')]);return db[_0xf634('0x2c')]['find'](_0x307143)[_0xf634('0x26')](handleEntityNotFound(_0x30755b,null))[_0xf634('0x26')](respondWithResult(_0x30755b,null))[_0xf634('0x48')](handleError(_0x30755b,null));};exports[_0xf634('0x49')]=function(_0xd84a08,_0x15b7c1){return db['ZohoField'][_0xf634('0x49')](_0xd84a08[_0xf634('0x4a')],{})['then'](respondWithResult(_0x15b7c1,0xc9))[_0xf634('0x48')](handleError(_0x15b7c1,null));};exports['update']=function(_0x26b719,_0x59f1c3){if(_0x26b719[_0xf634('0x4a')]['id']){delete _0x26b719['body']['id'];}return db[_0xf634('0x2c')][_0xf634('0x4b')]({'where':{'id':_0x26b719['params']['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x59f1c3,null))['then'](saveUpdates(_0x26b719['body'],null))['then'](respondWithResult(_0x59f1c3,null))[_0xf634('0x48')](handleError(_0x59f1c3,null));};exports[_0xf634('0x27')]=function(_0x41652c,_0x2162d0){return db[_0xf634('0x2c')][_0xf634('0x4b')]({'where':{'id':_0x41652c[_0xf634('0x46')]['id']}})['then'](handleEntityNotFound(_0x2162d0,null))[_0xf634('0x26')](removeEntity(_0x2162d0,null))[_0xf634('0x48')](handleError(_0x2162d0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 239e916..10cc147 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 _0x958a=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x958a,0x128));var _0xa958=function(_0x134521,_0x4ea0e7){_0x134521=_0x134521-0x0;var _0x10917c=_0x958a[_0x134521];return _0x10917c;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./intZohoField.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[{'name':_0xa958('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x178d9c,_0x3aaad3){var _0x9656c5=function(_0x3dfe99){while(--_0x3dfe99){_0x178d9c['push'](_0x178d9c['shift']());}};_0x9656c5(++_0x3aaad3);}(_0x5496,0x175));var _0x6549=function(_0x3b033d,_0x443b71){_0x3b033d=_0x3b033d-0x0;var _0x54a4a7=_0x5496[_0x3b033d];return _0x54a4a7;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('ZohoField',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xc'),'FieldId'],'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 203d188..04e1040 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 _0x5dce=['ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5dce,0x1bf));var _0xe5dc=function(_0x20534c,_0xe46275){_0x20534c=_0x20534c-0x0;var _0x1925cc=_0x5dce[_0x20534c];return _0x1925cc;};'use strict';var _=require(_0xe5dc('0x0'));var util=require(_0xe5dc('0x1'));var moment=require(_0xe5dc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5dc('0x3'));var fs=require('fs');var Redis=require(_0xe5dc('0x4'));var db=require(_0xe5dc('0x5'))['db'];var utils=require(_0xe5dc('0x6'));var logger=require('../../config/logger')(_0xe5dc('0x7'));var config=require(_0xe5dc('0x8'));var jayson=require(_0xe5dc('0x9'));var client=jayson[_0xe5dc('0xa')][_0xe5dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12d934,_0x51fae6,_0x587ee2){return new BPromise(function(_0x14a18c,_0x841a14){return client[_0xe5dc('0xc')](_0x12d934,_0x587ee2)['then'](function(_0x57b855){logger['info'](_0xe5dc('0xd'),_0x51fae6,'request\x20sent');logger['debug'](_0xe5dc('0xe'),_0x51fae6,'request\x20sent',JSON[_0xe5dc('0xf')](_0x57b855));if(_0x57b855[_0xe5dc('0x10')]){if(_0x57b855['error'][_0xe5dc('0x11')]===0x1f4){logger['error'](_0xe5dc('0xd'),_0x51fae6,_0x57b855['error'][_0xe5dc('0x12')]);return _0x841a14(_0x57b855['error'][_0xe5dc('0x12')]);}logger['error'](_0xe5dc('0xd'),_0x51fae6,_0x57b855[_0xe5dc('0x10')][_0xe5dc('0x12')]);return _0x14a18c(_0x57b855['error'][_0xe5dc('0x12')]);}else{logger[_0xe5dc('0x13')]('ZohoField,\x20%s,\x20%s',_0x51fae6,_0xe5dc('0x14'));_0x14a18c(_0x57b855[_0xe5dc('0x15')]['message']);}})[_0xe5dc('0x16')](function(_0x43b58c){logger[_0xe5dc('0x10')](_0xe5dc('0xd'),_0x51fae6,_0x43b58c);_0x841a14(_0x43b58c);});});} \ No newline at end of file +var _0x2fcb=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result'];(function(_0x2920b4,_0x2650ae){var _0x1fbac9=function(_0x1adfce){while(--_0x1adfce){_0x2920b4['push'](_0x2920b4['shift']());}};_0x1fbac9(++_0x2650ae);}(_0x2fcb,0x11f));var _0xb2fc=function(_0x32cb40,_0x3566a6){_0x32cb40=_0x32cb40-0x0;var _0x58792d=_0x2fcb[_0x32cb40];return _0x58792d;};'use strict';var _=require(_0xb2fc('0x0'));var util=require(_0xb2fc('0x1'));var moment=require(_0xb2fc('0x2'));var BPromise=require(_0xb2fc('0x3'));var rs=require(_0xb2fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2fc('0x6'))(_0xb2fc('0x7'));var config=require(_0xb2fc('0x8'));var jayson=require(_0xb2fc('0x9'));var client=jayson[_0xb2fc('0xa')][_0xb2fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571640,_0x323ddf,_0x512af8){return new BPromise(function(_0x5aa44a,_0x2cb745){return client['request'](_0x571640,_0x512af8)['then'](function(_0x5b8975){logger[_0xb2fc('0xc')]('ZohoField,\x20%s,\x20%s',_0x323ddf,_0xb2fc('0xd'));logger[_0xb2fc('0xe')](_0xb2fc('0xf'),_0x323ddf,'request\x20sent',JSON['stringify'](_0x5b8975));if(_0x5b8975[_0xb2fc('0x10')]){if(_0x5b8975[_0xb2fc('0x10')][_0xb2fc('0x11')]===0x1f4){logger[_0xb2fc('0x10')](_0xb2fc('0x12'),_0x323ddf,_0x5b8975[_0xb2fc('0x10')][_0xb2fc('0x13')]);return _0x2cb745(_0x5b8975[_0xb2fc('0x10')][_0xb2fc('0x13')]);}logger[_0xb2fc('0x10')](_0xb2fc('0x12'),_0x323ddf,_0x5b8975[_0xb2fc('0x10')][_0xb2fc('0x13')]);return _0x5aa44a(_0x5b8975['error']['message']);}else{logger[_0xb2fc('0xc')](_0xb2fc('0x12'),_0x323ddf,_0xb2fc('0xd'));_0x5aa44a(_0x5b8975[_0xb2fc('0x14')][_0xb2fc('0x13')]);}})[_0xb2fc('0x15')](function(_0x376347){logger['error'](_0xb2fc('0x12'),_0x323ddf,_0x376347);_0x2cb745(_0x376347);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3d6d75b..71258c3 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x48987a,_0x4cfc6d){var _0xb2d155=function(_0x47b872){while(--_0x47b872){_0x48987a['push'](_0x48987a['shift']());}};_0xb2d155(++_0x4cfc6d);}(_0xe706,0xa3));var _0x6e70=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xe706[_0x1c2051];return _0x2b58a0;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 712109c..9352390 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 _0xca79=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','exports'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0xca79,0x1a9));var _0x9ca7=function(_0x3514da,_0x533609){_0x3514da=_0x3514da-0x0;var _0xb5f3b9=_0xca79[_0x3514da];return _0xb5f3b9;};'use strict';var Sequelize=require('sequelize');module[_0x9ca7('0x0')]={'name':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':_0x9ca7('0x2')},'version':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9ca7('0x1')],'defaultValue':_0x9ca7('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x9ca7('0x1')]},'type':{'type':Sequelize[_0x9ca7('0x1')]},'size':{'type':Sequelize[_0x9ca7('0x4')]},'active':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9ca7('0x1')]},'logo':{'type':Sequelize[_0x9ca7('0x1')]},'state':{'type':Sequelize[_0x9ca7('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x9ca7('0x1')]},'remoteUri':{'type':Sequelize[_0x9ca7('0x1')]},'link':{'type':Sequelize[_0x9ca7('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x7085=['exports','STRING','unique_name_and_version','app.js','INTEGER','state','sequelize'];(function(_0x3141fb,_0x5788e7){var _0x3ffbb8=function(_0xff8cbf){while(--_0xff8cbf){_0x3141fb['push'](_0x3141fb['shift']());}};_0x3ffbb8(++_0x5788e7);}(_0x7085,0x125));var _0x5708=function(_0x4572c7,_0x49785c){_0x4572c7=_0x4572c7-0x0;var _0x573aa1=_0x7085[_0x4572c7];return _0x573aa1;};'use strict';var Sequelize=require(_0x5708('0x0'));module[_0x5708('0x1')]={'name':{'type':Sequelize[_0x5708('0x2')],'allowNull':![],'unique':_0x5708('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5708('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x5708('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x5708('0x2')]},'type':{'type':Sequelize[_0x5708('0x2')]},'size':{'type':Sequelize[_0x5708('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x5708('0x2')]},'logo':{'type':Sequelize[_0x5708('0x2')]},'state':{'type':Sequelize[_0x5708('0x2')],'unique':_0x5708('0x6')},'description':{'type':Sequelize[_0x5708('0x2')]},'title':{'type':Sequelize[_0x5708('0x2')]},'remoteUri':{'type':Sequelize[_0x5708('0x2')]},'link':{'type':Sequelize[_0x5708('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 14f3771..294ff13 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 _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','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'];(function(_0x9ed883,_0x33fcbe){var _0x1ff7ee=function(_0x19c8f8){while(--_0x19c8f8){_0x9ed883['push'](_0x9ed883['shift']());}};_0x1ff7ee(++_0x33fcbe);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c3593,_0x49dd88){_0x1c3593=_0x1c3593-0x0;var _0x3dafe4=_0x2ef3[_0x1c3593];return _0x3dafe4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8a4a96b..27ab953 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 _0x4205=['api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','../../config/logger'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x4205,0x1de));var _0x5420=function(_0x539acb,_0x5e89f1){_0x539acb=_0x539acb-0x0;var _0x5c98b6=_0x4205[_0x539acb];return _0x5c98b6;};'use strict';var _=require(_0x5420('0x0'));var util=require('util');var logger=require(_0x5420('0x1'))(_0x5420('0x2'));var moment=require(_0x5420('0x3'));var BPromise=require(_0x5420('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5420('0x5'));var config=require(_0x5420('0x6'));var attributes=require(_0x5420('0x7'));module[_0x5420('0x8')]=function(_0x36ef18,_0x496868){return _0x36ef18['define'](_0x5420('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfba6=['exports','define','Integration','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x5eb51a,_0x557d39){var _0x543ad2=function(_0x1c5719){while(--_0x1c5719){_0x5eb51a['push'](_0x5eb51a['shift']());}};_0x543ad2(++_0x557d39);}(_0xfba6,0x137));var _0x6fba=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0xfba6[_0x2df1f2];return _0x38652b;};'use strict';var _=require(_0x6fba('0x0'));var util=require(_0x6fba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6fba('0x2'));var BPromise=require(_0x6fba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fba('0x4'));var rimraf=require(_0x6fba('0x5'));var config=require(_0x6fba('0x6'));var attributes=require(_0x6fba('0x7'));module[_0x6fba('0x8')]=function(_0x1159ff,_0xa30625){return _0x1159ff[_0x6fba('0x9')](_0x6fba('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 6e9ddce..6d2ffd3 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 _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0x955f,0x1eb));var _0xf955=function(_0x2ffcf3,_0x38f289){_0x2ffcf3=_0x2ffcf3-0x0;var _0x38a806=_0x955f[_0x2ffcf3];return _0x38a806;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x335998,_0x21b705){var _0x50e66e=function(_0x395598){while(--_0x395598){_0x335998['push'](_0x335998['shift']());}};_0x50e66e(++_0x21b705);}(_0x66fa,0x117));var _0xa66f=function(_0x55d0b0,_0x1c4efa){_0x55d0b0=_0x55d0b0-0x0;var _0x3c31e2=_0x66fa[_0x55d0b0];return _0x3c31e2;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 789c0f2..4458c9d 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x119e3d,_0x3b9033){var _0x32db8a=function(_0x1df1b0){while(--_0x1df1b0){_0x119e3d['push'](_0x119e3d['shift']());}};_0x32db8a(++_0x3b9033);}(_0x955f,0x1eb));var _0xf955=function(_0x3568c8,_0x18b63f){_0x3568c8=_0x3568c8-0x0;var _0xafca6=_0x955f[_0x3568c8];return _0xafca6;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x178909,_0x17cf2c){var _0x57fa4c=function(_0x3986c6){while(--_0x3986c6){_0x178909['push'](_0x178909['shift']());}};_0x57fa4c(++_0x17cf2c);}(_0x524e,0x15e));var _0xe524=function(_0xa4574a,_0x5b32e3){_0xa4574a=_0xa4574a-0x0;var _0x2f3a8c=_0x524e[_0xa4574a];return _0x2f3a8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 99d3b1f..7a5779c 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 _0xa1f0=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0xdce6c6,_0x2ab39f){var _0x573ca1=function(_0x2ad2b5){while(--_0x2ad2b5){_0xdce6c6['push'](_0xdce6c6['shift']());}};_0x573ca1(++_0x2ab39f);}(_0xa1f0,0x7e));var _0x0a1f=function(_0x275255,_0x10cc82){_0x275255=_0x275255-0x0;var _0x34949f=_0xa1f0[_0x275255];return _0x34949f;};'use strict';var Sequelize=require('sequelize');module[_0x0a1f('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x0a1f('0x1')]},'exitStatus':{'type':Sequelize[_0x0a1f('0x1')]},'ticketId':{'type':Sequelize[_0x0a1f('0x1')]},'integrationId':{'type':Sequelize[_0x0a1f('0x2')]},'contacts':{'type':Sequelize[_0x0a1f('0x1')]},'uniqueid':{'type':Sequelize[_0x0a1f('0x1')]},'calleridnum':{'type':Sequelize[_0x0a1f('0x1')]},'calleridname':{'type':Sequelize[_0x0a1f('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0a1f('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0a1f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a1f('0x2')]},'agentcomplete':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x0a1f('0x2')]},'agentacw':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0a1f('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0a1f('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0a1f('0x3')]},'lastevent':{'type':Sequelize[_0x0a1f('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0a1f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0a1f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0a1f('0x1')]},'connectedlinename':{'type':Sequelize[_0x0a1f('0x1')]},'language':{'type':Sequelize[_0x0a1f('0x1')]},'accountcode':{'type':Sequelize[_0x0a1f('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0a1f('0x1')]},'priority':{'type':Sequelize[_0x0a1f('0x1')]},'destchannel':{'type':Sequelize[_0x0a1f('0x1')]},'destchannelstate':{'type':Sequelize[_0x0a1f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0a1f('0x1')]},'destcalleridname':{'type':Sequelize[_0x0a1f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0a1f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0a1f('0x1')]},'destlanguage':{'type':Sequelize[_0x0a1f('0x1')]},'destaccountcode':{'type':Sequelize[_0x0a1f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0a1f('0x1')]},'destuniqueid':{'type':Sequelize[_0x0a1f('0x1')]},'messageId':{'type':Sequelize[_0x0a1f('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x0a1f('0x1')]},'from':{'type':Sequelize[_0x0a1f('0x1')]},'to':{'type':Sequelize[_0x0a1f('0x1')]},'cc':{'type':Sequelize[_0x0a1f('0x1')]},'attachment':{'type':Sequelize[_0x0a1f('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0a1f('0x5')]},'status':{'type':Sequelize['ENUM'](_0x0a1f('0x6'),_0x0a1f('0x7'),_0x0a1f('0x8'),_0x0a1f('0x9'))},'url':{'type':Sequelize[_0x0a1f('0x1')]},'app':{'type':Sequelize[_0x0a1f('0x1')]},'appdata':{'type':Sequelize[_0x0a1f('0x1')]},'projectId':{'type':Sequelize[_0x0a1f('0x2')]}}; \ No newline at end of file +var _0x0917=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x79cb75,_0x3b24a6){var _0x154325=function(_0x3e7274){while(--_0x3e7274){_0x79cb75['push'](_0x79cb75['shift']());}};_0x154325(++_0x3b24a6);}(_0x0917,0x15f));var _0x7091=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x0917[_0x1f16de];return _0x36cd80;};'use strict';var Sequelize=require(_0x7091('0x0'));module[_0x7091('0x1')]={'integration':{'type':Sequelize[_0x7091('0x2')]},'eventChannel':{'type':Sequelize[_0x7091('0x2')]},'exitStatus':{'type':Sequelize[_0x7091('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x7091('0x2')]},'uniqueid':{'type':Sequelize[_0x7091('0x2')]},'calleridnum':{'type':Sequelize[_0x7091('0x2')]},'calleridname':{'type':Sequelize[_0x7091('0x2')]},'queue':{'type':Sequelize[_0x7091('0x2')]},'interface':{'type':Sequelize[_0x7091('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7091('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7091('0x4')]},'agentcomplete':{'type':Sequelize[_0x7091('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7091('0x3')]},'talktime':{'type':Sequelize[_0x7091('0x4')]},'agentacw':{'type':Sequelize[_0x7091('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7091('0x4')]},'reason':{'type':Sequelize[_0x7091('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x7091('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x7091('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7091('0x3')]},'lastevent':{'type':Sequelize[_0x7091('0x2')]},'channel':{'type':Sequelize[_0x7091('0x2')]},'channelstate':{'type':Sequelize[_0x7091('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7091('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7091('0x2')]},'connectedlinename':{'type':Sequelize[_0x7091('0x2')]},'language':{'type':Sequelize[_0x7091('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7091('0x2')]},'exten':{'type':Sequelize[_0x7091('0x2')]},'priority':{'type':Sequelize[_0x7091('0x2')]},'destchannel':{'type':Sequelize[_0x7091('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7091('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7091('0x2')]},'destcalleridname':{'type':Sequelize[_0x7091('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7091('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7091('0x2')]},'destaccountcode':{'type':Sequelize[_0x7091('0x2')]},'destcontext':{'type':Sequelize[_0x7091('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7091('0x2')]},'destuniqueid':{'type':Sequelize[_0x7091('0x2')]},'messageId':{'type':Sequelize[_0x7091('0x2')]},'inReplyTo':{'type':Sequelize[_0x7091('0x2')]},'subject':{'type':Sequelize[_0x7091('0x2')]},'from':{'type':Sequelize[_0x7091('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7091('0x2')]},'attachment':{'type':Sequelize[_0x7091('0x6')]},'html':{'type':Sequelize[_0x7091('0x6')]},'text':{'type':Sequelize[_0x7091('0x6')]},'status':{'type':Sequelize['ENUM'](_0x7091('0x7'),_0x7091('0x8'),_0x7091('0x9'),_0x7091('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x7091('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7091('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 190412e..4310bb5 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 _0x03f6=['catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x54afe6,_0x4bb075){var _0x4fc29d=function(_0x562921){while(--_0x562921){_0x54afe6['push'](_0x54afe6['shift']());}};_0x4fc29d(++_0x4bb075);}(_0x03f6,0x12d));var _0x603f=function(_0x400d77,_0x57d796){_0x400d77=_0x400d77-0x0;var _0x3abdee=_0x03f6[_0x400d77];return _0x3abdee;};'use strict';var emlformat=require(_0x603f('0x0'));var rimraf=require(_0x603f('0x1'));var zipdir=require(_0x603f('0x2'));var jsonpatch=require(_0x603f('0x3'));var rp=require('request-promise');var moment=require(_0x603f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x603f('0x5'));var util=require(_0x603f('0x6'));var path=require('path');var sox=require(_0x603f('0x7'));var csv=require(_0x603f('0x8'));var ejs=require(_0x603f('0x9'));var fs=require('fs');var fs_extra=require(_0x603f('0xa'));var _=require('lodash');var squel=require(_0x603f('0xb'));var crypto=require(_0x603f('0xc'));var jsforce=require(_0x603f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x603f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x603f('0xe'));var authService=require(_0x603f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x603f('0x10'));var hardwareService=require(_0x603f('0x11'));var logger=require(_0x603f('0x12'))(_0x603f('0x13'));var utils=require('../../config/utils');var config=require(_0x603f('0x14'));var licenseUtil=require(_0x603f('0x15'));var db=require(_0x603f('0x16'))['db'];function respondWithStatusCode(_0x4d7d3e,_0x2db608){_0x2db608=_0x2db608||0xcc;return function(_0x1622a0){if(_0x1622a0){return _0x4d7d3e['sendStatus'](_0x2db608);}return _0x4d7d3e[_0x603f('0x17')](_0x2db608)[_0x603f('0x18')]();};}function respondWithResult(_0x3c03c0,_0x5ce593){_0x5ce593=_0x5ce593||0xc8;return function(_0x332e6a){if(_0x332e6a){return _0x3c03c0[_0x603f('0x17')](_0x5ce593)[_0x603f('0x19')](_0x332e6a);}};}function respondWithFilteredResult(_0x39fff9,_0x3486ec){return function(_0x53795b){if(_0x53795b){var _0x32dd96=typeof _0x3486ec[_0x603f('0x1a')]===_0x603f('0x1b')&&typeof _0x3486ec[_0x603f('0x1c')]===_0x603f('0x1b');var _0x462e70=_0x53795b[_0x603f('0x1d')];var _0x13c979=_0x32dd96?0x0:_0x3486ec[_0x603f('0x1a')];var _0x196583=_0x32dd96?_0x53795b['count']:_0x3486ec[_0x603f('0x1a')]+_0x3486ec['limit'];var _0x17c92f;if(_0x196583>=_0x462e70){_0x196583=_0x462e70;_0x17c92f=0xc8;}else{_0x17c92f=0xce;}_0x39fff9['status'](_0x17c92f);return _0x39fff9[_0x603f('0x1e')]('Content-Range',_0x13c979+'-'+_0x196583+'/'+_0x462e70)[_0x603f('0x19')](_0x53795b);}return null;};}function patchUpdates(_0x75baf8){return function(_0x2b76b0){try{jsonpatch[_0x603f('0x1f')](_0x2b76b0,_0x75baf8,!![]);}catch(_0x45477a){return BPromise['reject'](_0x45477a);}return _0x2b76b0[_0x603f('0x20')]();};}function saveUpdates(_0x17d659,_0x5b59cb){return function(_0x4b4a9d){if(_0x4b4a9d){return _0x4b4a9d[_0x603f('0x21')](_0x17d659)['then'](function(_0x4b6665){return _0x4b6665;});}return null;};}function removeEntity(_0x528365,_0x1d68af){return function(_0x14954a){if(_0x14954a){return _0x14954a['destroy']()[_0x603f('0x22')](function(){_0x528365['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2112,_0x29315e){return function(_0x1f95e9){if(!_0x1f95e9){_0x2d2112[_0x603f('0x23')](0x194);}return _0x1f95e9;};}function handleError(_0x205e2e,_0x1808e6){_0x1808e6=_0x1808e6||0x1f4;return function(_0x13e65e){logger['error'](_0x13e65e[_0x603f('0x24')]);if(_0x13e65e[_0x603f('0x25')]){delete _0x13e65e[_0x603f('0x25')];}_0x205e2e[_0x603f('0x17')](_0x1808e6)[_0x603f('0x26')](_0x13e65e);};}exports[_0x603f('0x27')]=function(_0x129316,_0x47c834){var _0x1dbe15={},_0x4f7ccd={},_0x5a5d4c={'count':0x0,'rows':[]};var _0x3e43a2=_[_0x603f('0x28')](db[_0x603f('0x29')][_0x603f('0x2a')],function(_0x2d05f8){return{'name':_0x2d05f8['fieldName'],'type':_0x2d05f8[_0x603f('0x2b')][_0x603f('0x2c')]};});_0x4f7ccd[_0x603f('0x2d')]=_[_0x603f('0x28')](_0x3e43a2,_0x603f('0x25'));_0x4f7ccd['query']=_['keys'](_0x129316[_0x603f('0x2e')]);_0x4f7ccd[_0x603f('0x2f')]=_['intersection'](_0x4f7ccd[_0x603f('0x2d')],_0x4f7ccd['query']);_0x1dbe15[_0x603f('0x30')]=_[_0x603f('0x31')](_0x4f7ccd[_0x603f('0x2d')],qs['fields'](_0x129316['query'][_0x603f('0x32')]));_0x1dbe15[_0x603f('0x30')]=_0x1dbe15[_0x603f('0x30')][_0x603f('0x33')]?_0x1dbe15[_0x603f('0x30')]:_0x4f7ccd[_0x603f('0x2d')];if(!_0x129316[_0x603f('0x2e')]['hasOwnProperty']('nolimit')){_0x1dbe15[_0x603f('0x1c')]=qs[_0x603f('0x1c')](_0x129316['query']['limit']);_0x1dbe15[_0x603f('0x1a')]=qs['offset'](_0x129316[_0x603f('0x2e')]['offset']);}_0x1dbe15[_0x603f('0x34')]=qs[_0x603f('0x35')](_0x129316[_0x603f('0x2e')][_0x603f('0x35')]);_0x1dbe15['where']=qs['filters'](_[_0x603f('0x36')](_0x129316[_0x603f('0x2e')],_0x4f7ccd[_0x603f('0x2f')]),_0x3e43a2);if(_0x129316['query']['filter']){_0x1dbe15[_0x603f('0x37')]=_[_0x603f('0x38')](_0x1dbe15[_0x603f('0x37')],{'$or':_[_0x603f('0x28')](_0x3e43a2,function(_0x5d094c){if(_0x5d094c[_0x603f('0x2b')]!==_0x603f('0x39')){var _0xda5fae={};_0xda5fae[_0x5d094c[_0x603f('0x25')]]={'$like':'%'+_0x129316[_0x603f('0x2e')][_0x603f('0x3a')]+'%'};return _0xda5fae;}})});}_0x1dbe15=_['merge']({},_0x1dbe15,_0x129316[_0x603f('0x3b')]);var _0x53aa0c={'where':_0x1dbe15[_0x603f('0x37')]};return db[_0x603f('0x29')][_0x603f('0x1d')](_0x53aa0c)[_0x603f('0x22')](function(_0xc084e4){_0x5a5d4c[_0x603f('0x1d')]=_0xc084e4;if(_0x129316[_0x603f('0x2e')][_0x603f('0x3c')]){_0x1dbe15[_0x603f('0x3d')]=[{'all':!![]}];}return db[_0x603f('0x29')][_0x603f('0x3e')](_0x1dbe15);})[_0x603f('0x22')](function(_0x3a8cf2){_0x5a5d4c[_0x603f('0x3f')]=_0x3a8cf2;return _0x5a5d4c;})[_0x603f('0x22')](respondWithFilteredResult(_0x47c834,_0x1dbe15))[_0x603f('0x40')](handleError(_0x47c834,null));};exports[_0x603f('0x41')]=function(_0x30548d,_0xdb55f5){var _0x3a242a={'raw':![],'where':{'id':_0x30548d['params']['id']}},_0x49b972={};_0x49b972['model']=_[_0x603f('0x42')](db['IntegrationReport'][_0x603f('0x2a')]);_0x49b972[_0x603f('0x2e')]=_[_0x603f('0x42')](_0x30548d[_0x603f('0x2e')]);_0x49b972[_0x603f('0x2f')]=_[_0x603f('0x31')](_0x49b972[_0x603f('0x2d')],_0x49b972[_0x603f('0x2e')]);_0x3a242a[_0x603f('0x30')]=_[_0x603f('0x31')](_0x49b972[_0x603f('0x2d')],qs[_0x603f('0x32')](_0x30548d['query'][_0x603f('0x32')]));_0x3a242a[_0x603f('0x30')]=_0x3a242a[_0x603f('0x30')][_0x603f('0x33')]?_0x3a242a[_0x603f('0x30')]:_0x49b972['model'];if(_0x30548d[_0x603f('0x2e')]['includeAll']){_0x3a242a[_0x603f('0x3d')]=[{'all':!![]}];}_0x3a242a=_['merge']({},_0x3a242a,_0x30548d[_0x603f('0x3b')]);return db[_0x603f('0x29')][_0x603f('0x43')](_0x3a242a)[_0x603f('0x22')](handleEntityNotFound(_0xdb55f5,null))[_0x603f('0x22')](respondWithResult(_0xdb55f5,null))[_0x603f('0x40')](handleError(_0xdb55f5,null));};exports['create']=function(_0xfde2b6,_0x3cd16f){return db['IntegrationReport'][_0x603f('0x44')](_0xfde2b6[_0x603f('0x45')],{})[_0x603f('0x22')](respondWithResult(_0x3cd16f,0xc9))['catch'](handleError(_0x3cd16f,null));};exports[_0x603f('0x21')]=function(_0x44afea,_0x2f8795){if(_0x44afea['body']['id']){delete _0x44afea[_0x603f('0x45')]['id'];}return db[_0x603f('0x29')][_0x603f('0x43')]({'where':{'id':_0x44afea[_0x603f('0x46')]['id']}})[_0x603f('0x22')](handleEntityNotFound(_0x2f8795,null))[_0x603f('0x22')](saveUpdates(_0x44afea[_0x603f('0x45')],null))[_0x603f('0x22')](respondWithResult(_0x2f8795,null))[_0x603f('0x40')](handleError(_0x2f8795,null));};exports[_0x603f('0x47')]=function(_0x5934e6,_0x5aeb2f){return db[_0x603f('0x29')][_0x603f('0x43')]({'where':{'id':_0x5934e6[_0x603f('0x46')]['id']}})[_0x603f('0x22')](handleEntityNotFound(_0x5aeb2f,null))[_0x603f('0x22')](removeEntity(_0x5aeb2f,null))['catch'](handleError(_0x5aeb2f,null));};exports[_0x603f('0x48')]=function(_0x130b60,_0x525910){return db[_0x603f('0x29')][_0x603f('0x48')]()[_0x603f('0x22')](respondWithResult(_0x525910,null))[_0x603f('0x40')](handleError(_0x525910,null));}; \ No newline at end of file +var _0x65c9=['params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x451ac4,_0x19dc1f){var _0x11d0db=function(_0x2a224b){while(--_0x2a224b){_0x451ac4['push'](_0x451ac4['shift']());}};_0x11d0db(++_0x19dc1f);}(_0x65c9,0xee));var _0x965c=function(_0x39e4f9,_0x509f7f){_0x39e4f9=_0x39e4f9-0x0;var _0x114aef=_0x65c9[_0x39e4f9];return _0x114aef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x965c('0x0'));var zipdir=require(_0x965c('0x1'));var jsonpatch=require(_0x965c('0x2'));var rp=require(_0x965c('0x3'));var moment=require('moment');var BPromise=require(_0x965c('0x4'));var Mustache=require(_0x965c('0x5'));var util=require(_0x965c('0x6'));var path=require(_0x965c('0x7'));var sox=require('sox');var csv=require(_0x965c('0x8'));var ejs=require(_0x965c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x965c('0xa'));var squel=require('squel');var crypto=require(_0x965c('0xb'));var jsforce=require(_0x965c('0xc'));var deskjs=require(_0x965c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x965c('0xe'));var Papa=require(_0x965c('0xf'));var Redis=require(_0x965c('0x10'));var authService=require(_0x965c('0x11'));var qs=require(_0x965c('0x12'));var as=require(_0x965c('0x13'));var hardwareService=require(_0x965c('0x14'));var logger=require('../../config/logger')(_0x965c('0x15'));var utils=require(_0x965c('0x16'));var config=require(_0x965c('0x17'));var licenseUtil=require(_0x965c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392483,_0x3bc1d0){_0x3bc1d0=_0x3bc1d0||0xcc;return function(_0x4ab9ab){if(_0x4ab9ab){return _0x392483[_0x965c('0x19')](_0x3bc1d0);}return _0x392483[_0x965c('0x1a')](_0x3bc1d0)[_0x965c('0x1b')]();};}function respondWithResult(_0x3693b4,_0x542d99){_0x542d99=_0x542d99||0xc8;return function(_0x2dca0f){if(_0x2dca0f){return _0x3693b4[_0x965c('0x1a')](_0x542d99)[_0x965c('0x1c')](_0x2dca0f);}};}function respondWithFilteredResult(_0x2bafbe,_0x51f03a){return function(_0x4af427){if(_0x4af427){var _0x19725c=typeof _0x51f03a[_0x965c('0x1d')]===_0x965c('0x1e')&&typeof _0x51f03a[_0x965c('0x1f')]===_0x965c('0x1e');var _0x1102e8=_0x4af427[_0x965c('0x20')];var _0x2dd5ab=_0x19725c?0x0:_0x51f03a[_0x965c('0x1d')];var _0x20bff4=_0x19725c?_0x4af427[_0x965c('0x20')]:_0x51f03a[_0x965c('0x1d')]+_0x51f03a[_0x965c('0x1f')];var _0x1ba9d2;if(_0x20bff4>=_0x1102e8){_0x20bff4=_0x1102e8;_0x1ba9d2=0xc8;}else{_0x1ba9d2=0xce;}_0x2bafbe[_0x965c('0x1a')](_0x1ba9d2);return _0x2bafbe[_0x965c('0x21')](_0x965c('0x22'),_0x2dd5ab+'-'+_0x20bff4+'/'+_0x1102e8)[_0x965c('0x1c')](_0x4af427);}return null;};}function patchUpdates(_0x48302f){return function(_0x584abf){try{jsonpatch[_0x965c('0x23')](_0x584abf,_0x48302f,!![]);}catch(_0x3ed2ea){return BPromise[_0x965c('0x24')](_0x3ed2ea);}return _0x584abf[_0x965c('0x25')]();};}function saveUpdates(_0x26348e,_0x13d359){return function(_0x1f211a){if(_0x1f211a){return _0x1f211a[_0x965c('0x26')](_0x26348e)[_0x965c('0x27')](function(_0x141b7e){return _0x141b7e;});}return null;};}function removeEntity(_0x1ad855,_0x272167){return function(_0x121295){if(_0x121295){return _0x121295[_0x965c('0x28')]()[_0x965c('0x27')](function(){_0x1ad855['status'](0xcc)[_0x965c('0x1b')]();});}};}function handleEntityNotFound(_0x4cc132,_0x93305f){return function(_0x3ddb09){if(!_0x3ddb09){_0x4cc132['sendStatus'](0x194);}return _0x3ddb09;};}function handleError(_0x1f04e7,_0x10db5f){_0x10db5f=_0x10db5f||0x1f4;return function(_0x1af1c6){logger[_0x965c('0x29')](_0x1af1c6[_0x965c('0x2a')]);if(_0x1af1c6[_0x965c('0x2b')]){delete _0x1af1c6[_0x965c('0x2b')];}_0x1f04e7['status'](_0x10db5f)[_0x965c('0x2c')](_0x1af1c6);};}exports[_0x965c('0x2d')]=function(_0x50917e,_0x167a39){var _0x25d070={},_0x506533={},_0x5db6cb={'count':0x0,'rows':[]};var _0x21c165=_['map'](db[_0x965c('0x2e')][_0x965c('0x2f')],function(_0x4fe8ad){return{'name':_0x4fe8ad[_0x965c('0x30')],'type':_0x4fe8ad['type'][_0x965c('0x31')]};});_0x506533[_0x965c('0x32')]=_[_0x965c('0x33')](_0x21c165,'name');_0x506533[_0x965c('0x34')]=_[_0x965c('0x35')](_0x50917e['query']);_0x506533['filters']=_[_0x965c('0x36')](_0x506533[_0x965c('0x32')],_0x506533[_0x965c('0x34')]);_0x25d070[_0x965c('0x37')]=_[_0x965c('0x36')](_0x506533[_0x965c('0x32')],qs['fields'](_0x50917e[_0x965c('0x34')][_0x965c('0x38')]));_0x25d070[_0x965c('0x37')]=_0x25d070[_0x965c('0x37')][_0x965c('0x39')]?_0x25d070[_0x965c('0x37')]:_0x506533['model'];if(!_0x50917e['query'][_0x965c('0x3a')]('nolimit')){_0x25d070[_0x965c('0x1f')]=qs[_0x965c('0x1f')](_0x50917e[_0x965c('0x34')][_0x965c('0x1f')]);_0x25d070[_0x965c('0x1d')]=qs[_0x965c('0x1d')](_0x50917e['query'][_0x965c('0x1d')]);}_0x25d070[_0x965c('0x3b')]=qs['sort'](_0x50917e[_0x965c('0x34')][_0x965c('0x3c')]);_0x25d070[_0x965c('0x3d')]=qs['filters'](_[_0x965c('0x3e')](_0x50917e[_0x965c('0x34')],_0x506533[_0x965c('0x3f')]),_0x21c165);if(_0x50917e['query'][_0x965c('0x40')]){_0x25d070[_0x965c('0x3d')]=_[_0x965c('0x41')](_0x25d070['where'],{'$or':_['map'](_0x21c165,function(_0xfa24f2){if(_0xfa24f2[_0x965c('0x42')]!==_0x965c('0x43')){var _0x16ec24={};_0x16ec24[_0xfa24f2[_0x965c('0x2b')]]={'$like':'%'+_0x50917e[_0x965c('0x34')]['filter']+'%'};return _0x16ec24;}})});}_0x25d070=_[_0x965c('0x41')]({},_0x25d070,_0x50917e[_0x965c('0x44')]);var _0x26dc3c={'where':_0x25d070[_0x965c('0x3d')]};return db[_0x965c('0x2e')][_0x965c('0x20')](_0x26dc3c)[_0x965c('0x27')](function(_0x2f7943){_0x5db6cb[_0x965c('0x20')]=_0x2f7943;if(_0x50917e[_0x965c('0x34')][_0x965c('0x45')]){_0x25d070[_0x965c('0x46')]=[{'all':!![]}];}return db[_0x965c('0x2e')]['findAll'](_0x25d070);})['then'](function(_0xcb57a){_0x5db6cb[_0x965c('0x47')]=_0xcb57a;return _0x5db6cb;})['then'](respondWithFilteredResult(_0x167a39,_0x25d070))[_0x965c('0x48')](handleError(_0x167a39,null));};exports[_0x965c('0x49')]=function(_0x49d969,_0x2324f3){var _0x3e18d3={'raw':![],'where':{'id':_0x49d969[_0x965c('0x4a')]['id']}},_0x1b9ed8={};_0x1b9ed8[_0x965c('0x32')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x1b9ed8[_0x965c('0x34')]=_[_0x965c('0x35')](_0x49d969[_0x965c('0x34')]);_0x1b9ed8[_0x965c('0x3f')]=_['intersection'](_0x1b9ed8[_0x965c('0x32')],_0x1b9ed8[_0x965c('0x34')]);_0x3e18d3[_0x965c('0x37')]=_['intersection'](_0x1b9ed8[_0x965c('0x32')],qs[_0x965c('0x38')](_0x49d969[_0x965c('0x34')][_0x965c('0x38')]));_0x3e18d3[_0x965c('0x37')]=_0x3e18d3[_0x965c('0x37')][_0x965c('0x39')]?_0x3e18d3['attributes']:_0x1b9ed8[_0x965c('0x32')];if(_0x49d969['query']['includeAll']){_0x3e18d3['include']=[{'all':!![]}];}_0x3e18d3=_['merge']({},_0x3e18d3,_0x49d969[_0x965c('0x44')]);return db[_0x965c('0x2e')][_0x965c('0x4b')](_0x3e18d3)[_0x965c('0x27')](handleEntityNotFound(_0x2324f3,null))[_0x965c('0x27')](respondWithResult(_0x2324f3,null))['catch'](handleError(_0x2324f3,null));};exports['create']=function(_0x588741,_0x32dae9){return db['IntegrationReport']['create'](_0x588741[_0x965c('0x4c')],{})['then'](respondWithResult(_0x32dae9,0xc9))[_0x965c('0x48')](handleError(_0x32dae9,null));};exports['update']=function(_0x9ae09a,_0x33339f){if(_0x9ae09a[_0x965c('0x4c')]['id']){delete _0x9ae09a['body']['id'];}return db[_0x965c('0x2e')][_0x965c('0x4b')]({'where':{'id':_0x9ae09a[_0x965c('0x4a')]['id']}})[_0x965c('0x27')](handleEntityNotFound(_0x33339f,null))[_0x965c('0x27')](saveUpdates(_0x9ae09a[_0x965c('0x4c')],null))[_0x965c('0x27')](respondWithResult(_0x33339f,null))[_0x965c('0x48')](handleError(_0x33339f,null));};exports[_0x965c('0x28')]=function(_0x26adcc,_0x485736){return db[_0x965c('0x2e')][_0x965c('0x4b')]({'where':{'id':_0x26adcc[_0x965c('0x4a')]['id']}})[_0x965c('0x27')](handleEntityNotFound(_0x485736,null))[_0x965c('0x27')](removeEntity(_0x485736,null))['catch'](handleError(_0x485736,null));};exports[_0x965c('0x4d')]=function(_0x2cbe8f,_0x18a529){return db[_0x965c('0x2e')][_0x965c('0x4d')]()[_0x965c('0x27')](respondWithResult(_0x18a529,null))[_0x965c('0x48')](handleError(_0x18a529,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index bdf1359..2abde74 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 _0xabab=['api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xabab,0x81));var _0xbaba=function(_0x210c1e,_0x4d5349){_0x210c1e=_0x210c1e-0x0;var _0xf8e022=_0xabab[_0x210c1e];return _0xf8e022;};'use strict';var _=require(_0xbaba('0x0'));var util=require(_0xbaba('0x1'));var logger=require(_0xbaba('0x2'))(_0xbaba('0x3'));var moment=require(_0xbaba('0x4'));var BPromise=require('bluebird');var rp=require(_0xbaba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbaba('0x6'));var config=require(_0xbaba('0x7'));var attributes=require(_0xbaba('0x8'));module[_0xbaba('0x9')]=function(_0x5701e9,_0x48b719){return _0x5701e9['define'](_0xbaba('0xa'),attributes,{'tableName':_0xbaba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9629=['lodash','util','../../config/logger','api','moment','request-promise','path','./integrationReport.attributes','exports','define','report_integration'];(function(_0x31a21e,_0x13f71d){var _0x43fa84=function(_0x692331){while(--_0x692331){_0x31a21e['push'](_0x31a21e['shift']());}};_0x43fa84(++_0x13f71d);}(_0x9629,0x16b));var _0x9962=function(_0x7a1f88,_0x5d1b54){_0x7a1f88=_0x7a1f88-0x0;var _0x2b0b57=_0x9629[_0x7a1f88];return _0x2b0b57;};'use strict';var _=require(_0x9962('0x0'));var util=require(_0x9962('0x1'));var logger=require(_0x9962('0x2'))(_0x9962('0x3'));var moment=require(_0x9962('0x4'));var BPromise=require('bluebird');var rp=require(_0x9962('0x5'));var fs=require('fs');var path=require(_0x9962('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9962('0x7'));module[_0x9962('0x8')]=function(_0x555bfd,_0x2528c0){return _0x555bfd[_0x9962('0x9')]('IntegrationReport',attributes,{'tableName':_0x9962('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 42bdd65..bd9dcfd 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x53ec,0x192));var _0xc53e=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x53ec[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ 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','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 2ca3ded..11fb279 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 _0x5162=['../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c7488,_0xf5d9d9){var _0x175ea9=function(_0x37d315){while(--_0x37d315){_0x3c7488['push'](_0x3c7488['shift']());}};_0x175ea9(++_0xf5d9d9);}(_0x5162,0x103));var _0x2516=function(_0x7b6f59,_0x7cc38d){_0x7b6f59=_0x7b6f59-0x0;var _0x278caf=_0x5162[_0x7b6f59];return _0x278caf;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['post']('/',auth[_0x2516('0x9')](),controller[_0x2516('0xd')]);router[_0x2516('0xe')]('/:id/sub_intervals',auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x2516('0xf'),auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0x11')]('/:id',auth[_0x2516('0x9')](),controller[_0x2516('0x12')]);router[_0x2516('0x13')](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0x14')]);module[_0x2516('0x15')]=router; \ No newline at end of file +var _0x4da5=['delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x54dbb8,_0x47237b){var _0x411f3f=function(_0x18fd4d){while(--_0x18fd4d){_0x54dbb8['push'](_0x54dbb8['shift']());}};_0x411f3f(++_0x47237b);}(_0x4da5,0x1b7));var _0x54da=function(_0x159b4e,_0x440cdf){_0x159b4e=_0x159b4e-0x0;var _0x234d58=_0x4da5[_0x159b4e];return _0x234d58;};'use strict';var multer=require('multer');var util=require(_0x54da('0x0'));var path=require(_0x54da('0x1'));var timeout=require(_0x54da('0x2'));var express=require('express');var router=express[_0x54da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x54da('0x4'));var interaction=require(_0x54da('0x5'));var config=require(_0x54da('0x6'));var controller=require(_0x54da('0x7'));router['get']('/',auth[_0x54da('0x8')](),controller[_0x54da('0x9')]);router[_0x54da('0xa')](_0x54da('0xb'),auth[_0x54da('0x8')](),controller[_0x54da('0xc')]);router[_0x54da('0xa')]('/:id/sub_intervals',auth[_0x54da('0x8')](),controller[_0x54da('0xd')]);router[_0x54da('0xe')]('/',auth['isAuthenticated'](),controller[_0x54da('0xf')]);router['post']('/:id/sub_intervals',auth[_0x54da('0x8')](),controller[_0x54da('0x10')]);router[_0x54da('0xe')](_0x54da('0x11'),auth[_0x54da('0x8')](),controller[_0x54da('0x12')]);router[_0x54da('0x13')](_0x54da('0xb'),auth[_0x54da('0x8')](),controller[_0x54da('0x14')]);router[_0x54da('0x15')](_0x54da('0xb'),auth[_0x54da('0x8')](),controller['destroy']);module[_0x54da('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 6666ea5..a93ec65 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 _0x58ba=['sequelize','exports','STRING'];(function(_0x41ce1e,_0x40a674){var _0x324f8c=function(_0x1a7e62){while(--_0x1a7e62){_0x41ce1e['push'](_0x41ce1e['shift']());}};_0x324f8c(++_0x40a674);}(_0x58ba,0x11d));var _0xa58b=function(_0x1f4639,_0x67d565){_0x1f4639=_0x1f4639-0x0;var _0x41efa4=_0x58ba[_0x1f4639];return _0x41efa4;};'use strict';var Sequelize=require(_0xa58b('0x0'));module[_0xa58b('0x1')]={'name':{'type':Sequelize[_0xa58b('0x2')]},'description':{'type':Sequelize[_0xa58b('0x2')]},'interval':{'type':Sequelize[_0xa58b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1755=['STRING','exports'];(function(_0x5c6968,_0x35f27a){var _0x243611=function(_0x3ac2a1){while(--_0x3ac2a1){_0x5c6968['push'](_0x5c6968['shift']());}};_0x243611(++_0x35f27a);}(_0x1755,0x95));var _0x5175=function(_0x552ac2,_0x51be13){_0x552ac2=_0x552ac2-0x0;var _0x3f3e23=_0x1755[_0x552ac2];return _0x3f3e23;};'use strict';var Sequelize=require('sequelize');module[_0x5175('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5175('0x1')]},'interval':{'type':Sequelize[_0x5175('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 f97a60e..47a422f 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 _0x4192=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','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','../../components/extensions/rewrite','sendStatus','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','status','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model'];(function(_0x672855,_0x56d8c2){var _0x59b8d1=function(_0x3a2bf8){while(--_0x3a2bf8){_0x672855['push'](_0x672855['shift']());}};_0x59b8d1(++_0x56d8c2);}(_0x4192,0x149));var _0x2419=function(_0x7709d5,_0x3a0bc4){_0x7709d5=_0x7709d5-0x0;var _0x36e23c=_0x4192[_0x7709d5];return _0x36e23c;};'use strict';var emlformat=require(_0x2419('0x0'));var rimraf=require(_0x2419('0x1'));var zipdir=require(_0x2419('0x2'));var jsonpatch=require(_0x2419('0x3'));var rp=require(_0x2419('0x4'));var moment=require(_0x2419('0x5'));var BPromise=require(_0x2419('0x6'));var Mustache=require(_0x2419('0x7'));var util=require(_0x2419('0x8'));var path=require('path');var sox=require(_0x2419('0x9'));var csv=require(_0x2419('0xa'));var ejs=require(_0x2419('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2419('0xc'));var crypto=require(_0x2419('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2419('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2419('0xf'));var Papa=require(_0x2419('0x10'));var Redis=require(_0x2419('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2419('0x12'));var as=require(_0x2419('0x13'));var hardwareService=require(_0x2419('0x14'));var logger=require(_0x2419('0x15'))(_0x2419('0x16'));var utils=require(_0x2419('0x17'));var config=require(_0x2419('0x18'));var licenseUtil=require(_0x2419('0x19'));var db=require(_0x2419('0x1a'))['db'];var extensions=require(_0x2419('0x1b'));function respondWithStatusCode(_0x518e47,_0x97f046){_0x97f046=_0x97f046||0xcc;return function(_0xd4973d){if(_0xd4973d){return _0x518e47[_0x2419('0x1c')](_0x97f046);}return _0x518e47['status'](_0x97f046)[_0x2419('0x1d')]();};}function respondWithResult(_0x49a9a2,_0x33b801){_0x33b801=_0x33b801||0xc8;return function(_0x2a31b8){if(_0x2a31b8){return _0x49a9a2['status'](_0x33b801)[_0x2419('0x1e')](_0x2a31b8);}};}function respondWithFilteredResult(_0x2527dc,_0x525934){return function(_0x49c7b3){if(_0x49c7b3){var _0x1e35db=typeof _0x525934['offset']===_0x2419('0x1f')&&typeof _0x525934['limit']==='undefined';var _0x3860aa=_0x49c7b3['count'];var _0xcde5e5=_0x1e35db?0x0:_0x525934['offset'];var _0x4c27fa=_0x1e35db?_0x49c7b3[_0x2419('0x20')]:_0x525934[_0x2419('0x21')]+_0x525934[_0x2419('0x22')];var _0x3e27fe;if(_0x4c27fa>=_0x3860aa){_0x4c27fa=_0x3860aa;_0x3e27fe=0xc8;}else{_0x3e27fe=0xce;}_0x2527dc['status'](_0x3e27fe);return _0x2527dc[_0x2419('0x23')](_0x2419('0x24'),_0xcde5e5+'-'+_0x4c27fa+'/'+_0x3860aa)['json'](_0x49c7b3);}return null;};}function patchUpdates(_0x645b5b){return function(_0xfbb6d5){try{jsonpatch[_0x2419('0x25')](_0xfbb6d5,_0x645b5b,!![]);}catch(_0x1ac06f){return BPromise[_0x2419('0x26')](_0x1ac06f);}return _0xfbb6d5[_0x2419('0x27')]();};}function saveUpdates(_0x304782,_0x15acf9){return function(_0x15fb1a){if(_0x15fb1a){return _0x15fb1a[_0x2419('0x28')](_0x304782)[_0x2419('0x29')](function(_0x2d7131){return _0x2d7131;});}return null;};}function removeEntity(_0x20da29,_0x3e8a9b){return function(_0x319304){if(_0x319304){return _0x319304['destroy']()[_0x2419('0x29')](function(){var _0x277e36=_0x319304[_0x2419('0x2a')]({'plain':!![]});var _0x5121e4='Intervals';return db[_0x2419('0x2b')][_0x2419('0x2c')]({'where':{'type':_0x5121e4,'resourceId':_0x277e36['id']}})[_0x2419('0x29')](function(){return _0x319304;});})['then'](function(){_0x20da29[_0x2419('0x2d')](0xcc)[_0x2419('0x1d')]();});}};}function handleEntityNotFound(_0x37d167,_0x2a68d8){return function(_0x4b18b0){if(!_0x4b18b0){_0x37d167['sendStatus'](0x194);}return _0x4b18b0;};}function handleError(_0x94a710,_0x236158){_0x236158=_0x236158||0x1f4;return function(_0x29b057){logger['error'](_0x29b057[_0x2419('0x2e')]);if(_0x29b057['name']){delete _0x29b057[_0x2419('0x2f')];}_0x94a710[_0x2419('0x2d')](_0x236158)[_0x2419('0x30')](_0x29b057);};}exports[_0x2419('0x31')]=function(_0x55b829,_0x3d0dde){var _0x3858d0={},_0x2713fe={},_0x3cbfa5={'count':0x0,'rows':[]};var _0x16ce5b=_[_0x2419('0x32')](db[_0x2419('0x33')]['rawAttributes'],function(_0x5ae2c3){return{'name':_0x5ae2c3[_0x2419('0x34')],'type':_0x5ae2c3[_0x2419('0x35')][_0x2419('0x36')]};});_0x2713fe['model']=_[_0x2419('0x32')](_0x16ce5b,'name');_0x2713fe[_0x2419('0x37')]=_['keys'](_0x55b829[_0x2419('0x37')]);_0x2713fe[_0x2419('0x38')]=_[_0x2419('0x39')](_0x2713fe[_0x2419('0x3a')],_0x2713fe['query']);_0x3858d0[_0x2419('0x3b')]=_['intersection'](_0x2713fe[_0x2419('0x3a')],qs[_0x2419('0x3c')](_0x55b829[_0x2419('0x37')][_0x2419('0x3c')]));_0x3858d0[_0x2419('0x3b')]=_0x3858d0[_0x2419('0x3b')][_0x2419('0x3d')]?_0x3858d0[_0x2419('0x3b')]:_0x2713fe['model'];if(!_0x55b829[_0x2419('0x37')][_0x2419('0x3e')](_0x2419('0x3f'))){_0x3858d0[_0x2419('0x22')]=qs[_0x2419('0x22')](_0x55b829['query']['limit']);_0x3858d0[_0x2419('0x21')]=qs[_0x2419('0x21')](_0x55b829[_0x2419('0x37')][_0x2419('0x21')]);}_0x3858d0[_0x2419('0x40')]=qs[_0x2419('0x41')](_0x55b829[_0x2419('0x37')]['sort']);_0x3858d0[_0x2419('0x42')]=qs[_0x2419('0x38')](_[_0x2419('0x43')](_0x55b829[_0x2419('0x37')],_0x2713fe[_0x2419('0x38')]),_0x16ce5b);if(_0x55b829[_0x2419('0x37')][_0x2419('0x44')]){_0x3858d0[_0x2419('0x42')]=_['merge'](_0x3858d0[_0x2419('0x42')],{'$or':_['map'](_0x16ce5b,function(_0x546a9e){if(_0x546a9e['type']!=='VIRTUAL'){var _0xb2f623={};_0xb2f623[_0x546a9e[_0x2419('0x2f')]]={'$like':'%'+_0x55b829[_0x2419('0x37')][_0x2419('0x44')]+'%'};return _0xb2f623;}})});}_0x3858d0=_[_0x2419('0x45')]({},_0x3858d0,_0x55b829[_0x2419('0x46')]);var _0x18895b={'where':_0x3858d0[_0x2419('0x42')]};return db['Interval']['count'](_0x18895b)[_0x2419('0x29')](function(_0x45a1d6){_0x3cbfa5[_0x2419('0x20')]=_0x45a1d6;if(_0x55b829['query']['includeAll']){_0x3858d0[_0x2419('0x47')]=[{'all':!![]}];}return db[_0x2419('0x33')]['findAll'](_0x3858d0);})['then'](function(_0x3c8960){_0x3cbfa5[_0x2419('0x48')]=_0x3c8960;return _0x3cbfa5;})[_0x2419('0x29')](respondWithFilteredResult(_0x3d0dde,_0x3858d0))['catch'](handleError(_0x3d0dde,null));};exports[_0x2419('0x49')]=function(_0x2db8e3,_0x3043b4){var _0x33cd13={'raw':!![],'where':{'id':_0x2db8e3[_0x2419('0x4a')]['id']}},_0x5d9bbe={};_0x5d9bbe[_0x2419('0x3a')]=_['keys'](db[_0x2419('0x33')]['rawAttributes']);_0x5d9bbe['query']=_[_0x2419('0x4b')](_0x2db8e3[_0x2419('0x37')]);_0x5d9bbe[_0x2419('0x38')]=_['intersection'](_0x5d9bbe[_0x2419('0x3a')],_0x5d9bbe[_0x2419('0x37')]);_0x33cd13['attributes']=_[_0x2419('0x39')](_0x5d9bbe[_0x2419('0x3a')],qs[_0x2419('0x3c')](_0x2db8e3[_0x2419('0x37')][_0x2419('0x3c')]));_0x33cd13[_0x2419('0x3b')]=_0x33cd13[_0x2419('0x3b')][_0x2419('0x3d')]?_0x33cd13['attributes']:_0x5d9bbe['model'];if(_0x2db8e3[_0x2419('0x37')][_0x2419('0x4c')]){_0x33cd13[_0x2419('0x47')]=[{'all':!![]}];}_0x33cd13=_[_0x2419('0x45')]({},_0x33cd13,_0x2db8e3[_0x2419('0x46')]);return db[_0x2419('0x33')][_0x2419('0x4d')](_0x33cd13)[_0x2419('0x29')](handleEntityNotFound(_0x3043b4,null))[_0x2419('0x29')](respondWithResult(_0x3043b4,null))[_0x2419('0x4e')](handleError(_0x3043b4,null));};exports[_0x2419('0x4f')]=function(_0xd1a2a3,_0x49a016){return db[_0x2419('0x33')]['create'](_0xd1a2a3[_0x2419('0x50')],{})['then'](function(_0x3300a8){var _0x9ef117=_0xd1a2a3['user']['get']({'plain':!![]});if(!_0x9ef117)throw new Error(_0x2419('0x51'));if(_0x9ef117[_0x2419('0x52')]===_0x2419('0x53')){var _0x17b8bd=_0x3300a8['get']({'plain':!![]});var _0x3223c6=_0x2419('0x54');return db[_0x2419('0x55')]['find']({'where':{'name':_0x3223c6,'userProfileId':_0x9ef117['userProfileId']},'raw':!![]})['then'](function(_0x41e4fe){if(_0x41e4fe&&_0x41e4fe['autoAssociation']===0x0){return db['UserProfileResource'][_0x2419('0x4f')]({'name':_0x17b8bd[_0x2419('0x2f')],'resourceId':_0x17b8bd['id'],'type':_0x41e4fe[_0x2419('0x2f')],'sectionId':_0x41e4fe['id']},{})[_0x2419('0x29')](function(){return _0x3300a8;});}else{return _0x3300a8;}})[_0x2419('0x4e')](function(_0x4c1c71){logger[_0x2419('0x56')](_0x2419('0x57'),_0x4c1c71);throw _0x4c1c71;});}return _0x3300a8;})[_0x2419('0x29')](respondWithResult(_0x49a016,0xc9))['catch'](handleError(_0x49a016,null));};exports[_0x2419('0x28')]=function(_0x4095f6,_0x489a93){if(_0x4095f6[_0x2419('0x50')]['id']){delete _0x4095f6['body']['id'];}return db[_0x2419('0x33')][_0x2419('0x4d')]({'where':{'id':_0x4095f6[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x489a93,null))[_0x2419('0x29')](saveUpdates(_0x4095f6[_0x2419('0x50')],null))[_0x2419('0x29')](respondWithResult(_0x489a93,null))[_0x2419('0x4e')](handleError(_0x489a93,null));};exports[_0x2419('0x2c')]=function(_0x329e88,_0x58d1ba){return db['Interval'][_0x2419('0x4d')]({'where':{'id':_0x329e88[_0x2419('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58d1ba,null))['then'](removeEntity(_0x58d1ba,null))[_0x2419('0x4e')](handleError(_0x58d1ba,null));};exports[_0x2419('0x58')]=function(_0x2527f2,_0x258a9c,_0x49b5e1){if(_0x2527f2[_0x2419('0x50')]['id']){delete _0x2527f2[_0x2419('0x50')]['id'];}return db[_0x2419('0x33')][_0x2419('0x4d')]({'where':{'id':_0x2527f2[_0x2419('0x4a')]['id']}})['then'](handleEntityNotFound(_0x258a9c,null))['then'](function(_0x5522e4){if(_0x5522e4){_0x2527f2[_0x2419('0x50')][_0x2419('0x59')]=_0x5522e4['id'];return db[_0x2419('0x33')][_0x2419('0x4f')](_0x2527f2[_0x2419('0x50')]);}})['then'](respondWithResult(_0x258a9c,null))[_0x2419('0x4e')](handleError(_0x258a9c,null));};exports[_0x2419('0x5a')]=function(_0x135e95,_0x41d225,_0x22c01b){var _0x4765b9={};var _0x30ae89={};var _0x4bc0be;var _0x579dca;return db['Interval'][_0x2419('0x5b')]({'where':{'id':_0x135e95[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x41d225,null))[_0x2419('0x29')](function(_0x4c03c7){if(_0x4c03c7){_0x4bc0be=_0x4c03c7;_0x30ae89[_0x2419('0x3a')]=_[_0x2419('0x4b')](db[_0x2419('0x33')]['rawAttributes']);_0x30ae89[_0x2419('0x37')]=_[_0x2419('0x4b')](_0x135e95['query']);_0x30ae89['filters']=_[_0x2419('0x39')](_0x30ae89['model'],_0x30ae89[_0x2419('0x37')]);_0x4765b9[_0x2419('0x3b')]=_[_0x2419('0x39')](_0x30ae89['model'],qs[_0x2419('0x3c')](_0x135e95['query'][_0x2419('0x3c')]));_0x4765b9['attributes']=_0x4765b9[_0x2419('0x3b')][_0x2419('0x3d')]?_0x4765b9[_0x2419('0x3b')]:_0x30ae89[_0x2419('0x3a')];_0x4765b9[_0x2419('0x40')]=qs[_0x2419('0x41')](_0x135e95[_0x2419('0x37')]['sort']);_0x4765b9['where']=qs[_0x2419('0x38')](_[_0x2419('0x43')](_0x135e95['query'],_0x30ae89[_0x2419('0x38')]));if(_0x135e95[_0x2419('0x37')][_0x2419('0x44')]){_0x4765b9[_0x2419('0x42')]=_[_0x2419('0x45')](_0x4765b9[_0x2419('0x42')],{'$or':_[_0x2419('0x32')](_0x4765b9['attributes'],function(_0x313403){var _0x3155e5={};_0x3155e5[_0x313403]={'$like':'%'+_0x135e95[_0x2419('0x37')][_0x2419('0x44')]+'%'};return _0x3155e5;})});}_0x4765b9=_[_0x2419('0x45')]({},_0x4765b9,_0x135e95[_0x2419('0x46')]);return _0x4bc0be[_0x2419('0x5a')](_0x4765b9);}})[_0x2419('0x29')](function(_0x36ddd9){if(_0x36ddd9){_0x579dca=_0x36ddd9[_0x2419('0x3d')];if(!_0x135e95['query'][_0x2419('0x3e')](_0x2419('0x3f'))){_0x4765b9[_0x2419('0x22')]=qs[_0x2419('0x22')](_0x135e95[_0x2419('0x37')][_0x2419('0x22')]);_0x4765b9['offset']=qs[_0x2419('0x21')](_0x135e95['query'][_0x2419('0x21')]);}return _0x4bc0be[_0x2419('0x5a')](_0x4765b9);}})[_0x2419('0x29')](function(_0x678bc2){if(_0x678bc2){return _0x678bc2?{'count':_0x579dca,'rows':_0x678bc2}:null;}})[_0x2419('0x29')](respondWithResult(_0x41d225,null))[_0x2419('0x4e')](handleError(_0x41d225,null));};exports[_0x2419('0x5c')]=function(_0x2b6f06,_0x5f6a7,_0x35474f){return db[_0x2419('0x33')]['findOne']({'where':{'id':_0x2b6f06[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x5f6a7,null))[_0x2419('0x29')](function(_0x5527a9){if(_0x5527a9){return db[_0x2419('0x5d')][_0x2419('0x5e')](function(_0x2ec376){return db[_0x2419('0x33')][_0x2419('0x2c')]({'where':{'IntervalId':_0x2b6f06[_0x2419('0x4a')]['id']},'transaction':_0x2ec376})[_0x2419('0x29')](function(_0x384452){var _0x3a9ccc=_[_0x2419('0x32')](_0x2b6f06[_0x2419('0x50')],function(_0x2f2800){delete _0x2f2800['id'];_0x2f2800[_0x2419('0x59')]=_0x2b6f06['params']['id'];return _0x2f2800;});return db[_0x2419('0x33')][_0x2419('0x5f')](_0x3a9ccc,{'transaction':_0x2ec376});});})[_0x2419('0x29')](function(){return db[_0x2419('0x33')][_0x2419('0x60')]({'where':{'IntervalId':_0x2b6f06[_0x2419('0x4a')]['id']}});});}})[_0x2419('0x29')](respondWithResult(_0x5f6a7,null))[_0x2419('0x4e')](handleError(_0x5f6a7,null));}; \ No newline at end of file +var _0x3cd2=['set','Content-Range','apply','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','Interval','includeAll','include','findAll','show','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','order','addIntervals','IntervalId','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x25a288,_0x3f081e){var _0x44cc74=function(_0x3a5cbe){while(--_0x3a5cbe){_0x25a288['push'](_0x25a288['shift']());}};_0x44cc74(++_0x3f081e);}(_0x3cd2,0xec));var _0x23cd=function(_0x4784ea,_0x3f032b){_0x4784ea=_0x4784ea-0x0;var _0x469b61=_0x3cd2[_0x4784ea];return _0x469b61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23cd('0x1'));var rp=require(_0x23cd('0x2'));var moment=require(_0x23cd('0x3'));var BPromise=require(_0x23cd('0x4'));var Mustache=require(_0x23cd('0x5'));var util=require(_0x23cd('0x6'));var path=require(_0x23cd('0x7'));var sox=require('sox');var csv=require(_0x23cd('0x8'));var ejs=require(_0x23cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23cd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23cd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x23cd('0x8'));var querystring=require(_0x23cd('0xc'));var Papa=require('papaparse');var Redis=require(_0x23cd('0xd'));var authService=require(_0x23cd('0xe'));var qs=require(_0x23cd('0xf'));var as=require(_0x23cd('0x10'));var hardwareService=require(_0x23cd('0x11'));var logger=require('../../config/logger')(_0x23cd('0x12'));var utils=require(_0x23cd('0x13'));var config=require(_0x23cd('0x14'));var licenseUtil=require(_0x23cd('0x15'));var db=require(_0x23cd('0x16'))['db'];var extensions=require(_0x23cd('0x17'));function respondWithStatusCode(_0x37f7e5,_0x1e9f42){_0x1e9f42=_0x1e9f42||0xcc;return function(_0x2936fb){if(_0x2936fb){return _0x37f7e5[_0x23cd('0x18')](_0x1e9f42);}return _0x37f7e5['status'](_0x1e9f42)['end']();};}function respondWithResult(_0x65d0de,_0x183274){_0x183274=_0x183274||0xc8;return function(_0x35dd41){if(_0x35dd41){return _0x65d0de[_0x23cd('0x19')](_0x183274)[_0x23cd('0x1a')](_0x35dd41);}};}function respondWithFilteredResult(_0x5344d2,_0x1845b6){return function(_0x742e64){if(_0x742e64){var _0x483ff6=typeof _0x1845b6['offset']==='undefined'&&typeof _0x1845b6[_0x23cd('0x1b')]===_0x23cd('0x1c');var _0x4beb0c=_0x742e64[_0x23cd('0x1d')];var _0x5be2de=_0x483ff6?0x0:_0x1845b6[_0x23cd('0x1e')];var _0x130238=_0x483ff6?_0x742e64[_0x23cd('0x1d')]:_0x1845b6[_0x23cd('0x1e')]+_0x1845b6[_0x23cd('0x1b')];var _0x307bb1;if(_0x130238>=_0x4beb0c){_0x130238=_0x4beb0c;_0x307bb1=0xc8;}else{_0x307bb1=0xce;}_0x5344d2[_0x23cd('0x19')](_0x307bb1);return _0x5344d2[_0x23cd('0x1f')](_0x23cd('0x20'),_0x5be2de+'-'+_0x130238+'/'+_0x4beb0c)[_0x23cd('0x1a')](_0x742e64);}return null;};}function patchUpdates(_0x295306){return function(_0xf31b43){try{jsonpatch[_0x23cd('0x21')](_0xf31b43,_0x295306,!![]);}catch(_0x19f95c){return BPromise['reject'](_0x19f95c);}return _0xf31b43[_0x23cd('0x22')]();};}function saveUpdates(_0x5a5e57,_0x1e2d69){return function(_0x1d2db7){if(_0x1d2db7){return _0x1d2db7[_0x23cd('0x23')](_0x5a5e57)[_0x23cd('0x24')](function(_0x15d6a0){return _0x15d6a0;});}return null;};}function removeEntity(_0x59221a,_0x21c0f4){return function(_0xb4ee14){if(_0xb4ee14){return _0xb4ee14[_0x23cd('0x25')]()[_0x23cd('0x24')](function(){var _0x122df7=_0xb4ee14[_0x23cd('0x26')]({'plain':!![]});var _0x4ca517=_0x23cd('0x27');return db[_0x23cd('0x28')]['destroy']({'where':{'type':_0x4ca517,'resourceId':_0x122df7['id']}})['then'](function(){return _0xb4ee14;});})[_0x23cd('0x24')](function(){_0x59221a['status'](0xcc)[_0x23cd('0x29')]();});}};}function handleEntityNotFound(_0x3da8c5,_0x48b3db){return function(_0xa0b7d2){if(!_0xa0b7d2){_0x3da8c5['sendStatus'](0x194);}return _0xa0b7d2;};}function handleError(_0x5000dc,_0x58fb4f){_0x58fb4f=_0x58fb4f||0x1f4;return function(_0x35bac5){logger[_0x23cd('0x2a')](_0x35bac5['stack']);if(_0x35bac5[_0x23cd('0x2b')]){delete _0x35bac5[_0x23cd('0x2b')];}_0x5000dc[_0x23cd('0x19')](_0x58fb4f)[_0x23cd('0x2c')](_0x35bac5);};}exports[_0x23cd('0x2d')]=function(_0x2a6081,_0x5666f7){var _0x122c2b={},_0x389c39={},_0x3d083b={'count':0x0,'rows':[]};var _0xc5b7c6=_[_0x23cd('0x2e')](db['Interval'][_0x23cd('0x2f')],function(_0x37cafd){return{'name':_0x37cafd[_0x23cd('0x30')],'type':_0x37cafd[_0x23cd('0x31')]['key']};});_0x389c39[_0x23cd('0x32')]=_[_0x23cd('0x2e')](_0xc5b7c6,_0x23cd('0x2b'));_0x389c39[_0x23cd('0x33')]=_[_0x23cd('0x34')](_0x2a6081[_0x23cd('0x33')]);_0x389c39['filters']=_['intersection'](_0x389c39[_0x23cd('0x32')],_0x389c39['query']);_0x122c2b[_0x23cd('0x35')]=_['intersection'](_0x389c39[_0x23cd('0x32')],qs[_0x23cd('0x36')](_0x2a6081[_0x23cd('0x33')][_0x23cd('0x36')]));_0x122c2b[_0x23cd('0x35')]=_0x122c2b[_0x23cd('0x35')][_0x23cd('0x37')]?_0x122c2b['attributes']:_0x389c39[_0x23cd('0x32')];if(!_0x2a6081[_0x23cd('0x33')][_0x23cd('0x38')](_0x23cd('0x39'))){_0x122c2b[_0x23cd('0x1b')]=qs[_0x23cd('0x1b')](_0x2a6081[_0x23cd('0x33')][_0x23cd('0x1b')]);_0x122c2b[_0x23cd('0x1e')]=qs[_0x23cd('0x1e')](_0x2a6081[_0x23cd('0x33')]['offset']);}_0x122c2b['order']=qs[_0x23cd('0x3a')](_0x2a6081[_0x23cd('0x33')][_0x23cd('0x3a')]);_0x122c2b[_0x23cd('0x3b')]=qs[_0x23cd('0x3c')](_[_0x23cd('0x3d')](_0x2a6081['query'],_0x389c39[_0x23cd('0x3c')]),_0xc5b7c6);if(_0x2a6081['query']['filter']){_0x122c2b[_0x23cd('0x3b')]=_[_0x23cd('0x3e')](_0x122c2b[_0x23cd('0x3b')],{'$or':_[_0x23cd('0x2e')](_0xc5b7c6,function(_0x4cfdaa){if(_0x4cfdaa[_0x23cd('0x31')]!==_0x23cd('0x3f')){var _0x22195e={};_0x22195e[_0x4cfdaa['name']]={'$like':'%'+_0x2a6081[_0x23cd('0x33')][_0x23cd('0x40')]+'%'};return _0x22195e;}})});}_0x122c2b=_['merge']({},_0x122c2b,_0x2a6081[_0x23cd('0x41')]);var _0x418993={'where':_0x122c2b[_0x23cd('0x3b')]};return db[_0x23cd('0x42')]['count'](_0x418993)[_0x23cd('0x24')](function(_0x5b8efb){_0x3d083b[_0x23cd('0x1d')]=_0x5b8efb;if(_0x2a6081[_0x23cd('0x33')][_0x23cd('0x43')]){_0x122c2b[_0x23cd('0x44')]=[{'all':!![]}];}return db[_0x23cd('0x42')][_0x23cd('0x45')](_0x122c2b);})[_0x23cd('0x24')](function(_0x4e27c3){_0x3d083b['rows']=_0x4e27c3;return _0x3d083b;})[_0x23cd('0x24')](respondWithFilteredResult(_0x5666f7,_0x122c2b))['catch'](handleError(_0x5666f7,null));};exports[_0x23cd('0x46')]=function(_0x382c17,_0x43dfa2){var _0x487b31={'raw':!![],'where':{'id':_0x382c17['params']['id']}},_0xf4ba31={};_0xf4ba31[_0x23cd('0x32')]=_[_0x23cd('0x34')](db[_0x23cd('0x42')]['rawAttributes']);_0xf4ba31['query']=_[_0x23cd('0x34')](_0x382c17[_0x23cd('0x33')]);_0xf4ba31[_0x23cd('0x3c')]=_[_0x23cd('0x47')](_0xf4ba31[_0x23cd('0x32')],_0xf4ba31[_0x23cd('0x33')]);_0x487b31['attributes']=_[_0x23cd('0x47')](_0xf4ba31[_0x23cd('0x32')],qs['fields'](_0x382c17[_0x23cd('0x33')]['fields']));_0x487b31[_0x23cd('0x35')]=_0x487b31['attributes'][_0x23cd('0x37')]?_0x487b31[_0x23cd('0x35')]:_0xf4ba31['model'];if(_0x382c17['query'][_0x23cd('0x43')]){_0x487b31[_0x23cd('0x44')]=[{'all':!![]}];}_0x487b31=_['merge']({},_0x487b31,_0x382c17[_0x23cd('0x41')]);return db[_0x23cd('0x42')][_0x23cd('0x48')](_0x487b31)[_0x23cd('0x24')](handleEntityNotFound(_0x43dfa2,null))[_0x23cd('0x24')](respondWithResult(_0x43dfa2,null))[_0x23cd('0x49')](handleError(_0x43dfa2,null));};exports[_0x23cd('0x4a')]=function(_0x1d28f4,_0x2c9664){return db[_0x23cd('0x42')][_0x23cd('0x4a')](_0x1d28f4[_0x23cd('0x4b')],{})[_0x23cd('0x24')](function(_0x574d7a){var _0x103bb7=_0x1d28f4[_0x23cd('0x4c')][_0x23cd('0x26')]({'plain':!![]});if(!_0x103bb7)throw new Error(_0x23cd('0x4d'));if(_0x103bb7[_0x23cd('0x4e')]===_0x23cd('0x4c')){var _0x4c3c02=_0x574d7a[_0x23cd('0x26')]({'plain':!![]});var _0xdc0572=_0x23cd('0x27');return db[_0x23cd('0x4f')]['find']({'where':{'name':_0xdc0572,'userProfileId':_0x103bb7['userProfileId']},'raw':!![]})['then'](function(_0x5231cd){if(_0x5231cd&&_0x5231cd[_0x23cd('0x50')]===0x0){return db[_0x23cd('0x28')][_0x23cd('0x4a')]({'name':_0x4c3c02['name'],'resourceId':_0x4c3c02['id'],'type':_0x5231cd[_0x23cd('0x2b')],'sectionId':_0x5231cd['id']},{})[_0x23cd('0x24')](function(){return _0x574d7a;});}else{return _0x574d7a;}})[_0x23cd('0x49')](function(_0x321b22){logger['error'](_0x23cd('0x51'),_0x321b22);throw _0x321b22;});}return _0x574d7a;})[_0x23cd('0x24')](respondWithResult(_0x2c9664,0xc9))[_0x23cd('0x49')](handleError(_0x2c9664,null));};exports['update']=function(_0x54835b,_0x17373a){if(_0x54835b[_0x23cd('0x4b')]['id']){delete _0x54835b['body']['id'];}return db[_0x23cd('0x42')][_0x23cd('0x48')]({'where':{'id':_0x54835b['params']['id']}})[_0x23cd('0x24')](handleEntityNotFound(_0x17373a,null))[_0x23cd('0x24')](saveUpdates(_0x54835b[_0x23cd('0x4b')],null))[_0x23cd('0x24')](respondWithResult(_0x17373a,null))[_0x23cd('0x49')](handleError(_0x17373a,null));};exports[_0x23cd('0x25')]=function(_0x59d067,_0x263a9d){return db[_0x23cd('0x42')][_0x23cd('0x48')]({'where':{'id':_0x59d067[_0x23cd('0x52')]['id']}})['then'](handleEntityNotFound(_0x263a9d,null))[_0x23cd('0x24')](removeEntity(_0x263a9d,null))['catch'](handleError(_0x263a9d,null));};exports[_0x23cd('0x53')]=function(_0x67441c,_0x87cbc0,_0x44ffd8){if(_0x67441c['body']['id']){delete _0x67441c[_0x23cd('0x4b')]['id'];}return db[_0x23cd('0x42')][_0x23cd('0x48')]({'where':{'id':_0x67441c[_0x23cd('0x52')]['id']}})['then'](handleEntityNotFound(_0x87cbc0,null))[_0x23cd('0x24')](function(_0x121805){if(_0x121805){_0x67441c[_0x23cd('0x4b')]['IntervalId']=_0x121805['id'];return db['Interval']['create'](_0x67441c[_0x23cd('0x4b')]);}})[_0x23cd('0x24')](respondWithResult(_0x87cbc0,null))[_0x23cd('0x49')](handleError(_0x87cbc0,null));};exports[_0x23cd('0x54')]=function(_0x1cd09c,_0x1aaf44,_0x5dbc45){var _0x23cc6e={};var _0x56cd92={};var _0x10e69e;var _0x4bf7c8;return db['Interval'][_0x23cd('0x55')]({'where':{'id':_0x1cd09c[_0x23cd('0x52')]['id']}})[_0x23cd('0x24')](handleEntityNotFound(_0x1aaf44,null))[_0x23cd('0x24')](function(_0x516282){if(_0x516282){_0x10e69e=_0x516282;_0x56cd92[_0x23cd('0x32')]=_[_0x23cd('0x34')](db[_0x23cd('0x42')][_0x23cd('0x2f')]);_0x56cd92[_0x23cd('0x33')]=_[_0x23cd('0x34')](_0x1cd09c[_0x23cd('0x33')]);_0x56cd92[_0x23cd('0x3c')]=_[_0x23cd('0x47')](_0x56cd92['model'],_0x56cd92[_0x23cd('0x33')]);_0x23cc6e[_0x23cd('0x35')]=_['intersection'](_0x56cd92[_0x23cd('0x32')],qs[_0x23cd('0x36')](_0x1cd09c[_0x23cd('0x33')][_0x23cd('0x36')]));_0x23cc6e[_0x23cd('0x35')]=_0x23cc6e[_0x23cd('0x35')][_0x23cd('0x37')]?_0x23cc6e[_0x23cd('0x35')]:_0x56cd92[_0x23cd('0x32')];_0x23cc6e[_0x23cd('0x56')]=qs['sort'](_0x1cd09c[_0x23cd('0x33')][_0x23cd('0x3a')]);_0x23cc6e['where']=qs[_0x23cd('0x3c')](_[_0x23cd('0x3d')](_0x1cd09c['query'],_0x56cd92[_0x23cd('0x3c')]));if(_0x1cd09c[_0x23cd('0x33')][_0x23cd('0x40')]){_0x23cc6e[_0x23cd('0x3b')]=_[_0x23cd('0x3e')](_0x23cc6e[_0x23cd('0x3b')],{'$or':_[_0x23cd('0x2e')](_0x23cc6e[_0x23cd('0x35')],function(_0x2444e1){var _0x22cc95={};_0x22cc95[_0x2444e1]={'$like':'%'+_0x1cd09c[_0x23cd('0x33')]['filter']+'%'};return _0x22cc95;})});}_0x23cc6e=_['merge']({},_0x23cc6e,_0x1cd09c[_0x23cd('0x41')]);return _0x10e69e['getIntervals'](_0x23cc6e);}})['then'](function(_0x17618a){if(_0x17618a){_0x4bf7c8=_0x17618a[_0x23cd('0x37')];if(!_0x1cd09c[_0x23cd('0x33')][_0x23cd('0x38')](_0x23cd('0x39'))){_0x23cc6e[_0x23cd('0x1b')]=qs[_0x23cd('0x1b')](_0x1cd09c[_0x23cd('0x33')][_0x23cd('0x1b')]);_0x23cc6e[_0x23cd('0x1e')]=qs[_0x23cd('0x1e')](_0x1cd09c['query'][_0x23cd('0x1e')]);}return _0x10e69e[_0x23cd('0x54')](_0x23cc6e);}})[_0x23cd('0x24')](function(_0x2ab45b){if(_0x2ab45b){return _0x2ab45b?{'count':_0x4bf7c8,'rows':_0x2ab45b}:null;}})[_0x23cd('0x24')](respondWithResult(_0x1aaf44,null))[_0x23cd('0x49')](handleError(_0x1aaf44,null));};exports[_0x23cd('0x57')]=function(_0x21fe21,_0x4b5203,_0x1f1757){return db[_0x23cd('0x42')][_0x23cd('0x55')]({'where':{'id':_0x21fe21[_0x23cd('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b5203,null))[_0x23cd('0x24')](function(_0x1f326e){if(_0x1f326e){return db['sequelize']['transaction'](function(_0x28159b){return db[_0x23cd('0x42')][_0x23cd('0x25')]({'where':{'IntervalId':_0x21fe21['params']['id']},'transaction':_0x28159b})[_0x23cd('0x24')](function(_0x56e2a9){var _0x11adfa=_['map'](_0x21fe21[_0x23cd('0x4b')],function(_0x15aa42){delete _0x15aa42['id'];_0x15aa42[_0x23cd('0x58')]=_0x21fe21[_0x23cd('0x52')]['id'];return _0x15aa42;});return db[_0x23cd('0x42')]['bulkCreate'](_0x11adfa,{'transaction':_0x28159b});});})[_0x23cd('0x24')](function(){return db[_0x23cd('0x42')][_0x23cd('0x45')]({'where':{'IntervalId':_0x21fe21[_0x23cd('0x52')]['id']}});});}})[_0x23cd('0x24')](respondWithResult(_0x4b5203,null))['catch'](handleError(_0x4b5203,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 708dfc1..55d18af 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 _0x2b6b=['string','getIntervals','then','all','../../components/extensions/rewrite','../../utils/iftime','iftime','define','tools_intervals','rewrite','interval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b6b,0xa9));var _0xb2b6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2b6b[_0x3bf83f];return _0x22c4a9;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xb2b6('0x0'));var iftime=require(_0xb2b6('0x1'))[_0xb2b6('0x2')];module['exports']=function(_0x178bee){return _0x178bee[_0xb2b6('0x3')]('Interval',attributes,{'tableName':_0xb2b6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31320c){extensions['rewrite'](_0x178bee,_0x31320c);},'afterBulkCreate':function(_0x223d09,_0x3013ff,_0x2a7c9e){_0x2a7c9e();extensions[_0xb2b6('0x5')](_0x178bee,_0x223d09[0x0]);},'afterUpdate':function(_0x4fe2d9){extensions[_0xb2b6('0x5')](_0x178bee,_0x4fe2d9);},'afterDestroy':function(_0xf04e99){extensions[_0xb2b6('0x5')](_0x178bee,_0xf04e99);}},'instanceMethods':{'ifTime':function(_0x1f2ed8=undefined,_0x17aa8d=new Date()){if(typeof this[_0xb2b6('0x6')]===_0xb2b6('0x7')){return iftime(this[_0xb2b6('0x6')],_0x1f2ed8,_0x17aa8d);}else{return this[_0xb2b6('0x8')]()[_0xb2b6('0x9')](function(_0x3cfd24){return Promise[_0xb2b6('0xa')](_0x3cfd24['map'](function(_0x4af8d3){return _0x4af8d3['ifTime'](_0x1f2ed8,_0x17aa8d);}));})[_0xb2b6('0x9')](function(_0x22cf7e){return _0x22cf7e['reduce'](function(_0x39c519,_0xe94b91){return _0x39c519||_0xe94b91;},![]);});}}}});}; \ No newline at end of file +var _0x7b24=['tools_intervals','rewrite','interval','then','map','ifTime','reduce','./interval.attributes','iftime','exports','Interval'];(function(_0x2a1f2b,_0x26f5e4){var _0x517914=function(_0x5a3f79){while(--_0x5a3f79){_0x2a1f2b['push'](_0x2a1f2b['shift']());}};_0x517914(++_0x26f5e4);}(_0x7b24,0x96));var _0x47b2=function(_0xaa5751,_0x223180){_0xaa5751=_0xaa5751-0x0;var _0x5b3d67=_0x7b24[_0xaa5751];return _0x5b3d67;};'use strict';var attributes=require(_0x47b2('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x47b2('0x1')];module[_0x47b2('0x2')]=function(_0x45474a){return _0x45474a['define'](_0x47b2('0x3'),attributes,{'tableName':_0x47b2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xbe055b){extensions[_0x47b2('0x5')](_0x45474a,_0xbe055b);},'afterBulkCreate':function(_0xb9ca6f,_0x444c4f,_0x1f1300){_0x1f1300();extensions[_0x47b2('0x5')](_0x45474a,_0xb9ca6f[0x0]);},'afterUpdate':function(_0x42b1e2){extensions[_0x47b2('0x5')](_0x45474a,_0x42b1e2);},'afterDestroy':function(_0x562c63){extensions[_0x47b2('0x5')](_0x45474a,_0x562c63);}},'instanceMethods':{'ifTime':function(_0x33de4c=undefined,_0x231075=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x47b2('0x6')],_0x33de4c,_0x231075);}else{return this['getIntervals']()[_0x47b2('0x7')](function(_0x52c2fc){return Promise['all'](_0x52c2fc[_0x47b2('0x8')](function(_0x49de81){return _0x49de81[_0x47b2('0x9')](_0x33de4c,_0x231075);}));})[_0x47b2('0x7')](function(_0x22ac9c){return _0x22ac9c[_0x47b2('0xa')](function(_0x351192,_0x153264){return _0x351192||_0x153264;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 6dc865b..23a7560 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 _0x8288=['where','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','reduce','IntervalIftime','lodash','util','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','find'];(function(_0x10609c,_0xb21b1e){var _0xb66922=function(_0x51da65){while(--_0x51da65){_0x10609c['push'](_0x10609c['shift']());}};_0xb66922(++_0xb21b1e);}(_0x8288,0x1b8));var _0x8828=function(_0x4306b4,_0x354c84){_0x4306b4=_0x4306b4-0x0;var _0x1b4639=_0x8288[_0x4306b4];return _0x1b4639;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x8828('0x2'))[_0x8828('0x3')];var logger=require(_0x8828('0x4'))('rpc');exports[_0x8828('0x5')]=function(_0x16bd92){var _0x111c4e=this;return new Promise(function(_0x202301,_0x1e570e){return db[_0x8828('0x6')][_0x8828('0x7')]({'raw':_0x16bd92['options']?_0x16bd92[_0x8828('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x16bd92[_0x8828('0x8')]?_0x16bd92[_0x8828('0x8')]['where']||null:null,'attributes':_0x16bd92[_0x8828('0x8')]?_0x16bd92[_0x8828('0x8')][_0x8828('0x9')]||null:null,'limit':_0x16bd92['options']?_0x16bd92['options']['limit']||null:null,'include':_0x16bd92['options']?_0x16bd92[_0x8828('0x8')][_0x8828('0xa')]?_[_0x8828('0xb')](_0x16bd92[_0x8828('0x8')]['include'],function(_0x233120){return{'model':db[_0x233120[_0x8828('0xc')]],'as':_0x233120['as'],'attributes':_0x233120[_0x8828('0x9')],'include':_0x233120['include']?_[_0x8828('0xb')](_0x233120['include'],function(_0x2cd3f7){return{'model':db[_0x2cd3f7['model']],'as':_0x2cd3f7['as'],'attributes':_0x2cd3f7[_0x8828('0x9')],'include':_0x2cd3f7[_0x8828('0xa')]?_[_0x8828('0xb')](_0x2cd3f7[_0x8828('0xa')],function(_0x117c26){return{'model':db[_0x117c26[_0x8828('0xc')]],'as':_0x117c26['as'],'attributes':_0x117c26[_0x8828('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8828('0xd')](function(_0x57757e){logger[_0x8828('0xe')](_0x8828('0x5'),_0x16bd92);logger[_0x8828('0xf')](_0x8828('0x5'),_0x16bd92,JSON[_0x8828('0x10')](_0x57757e));_0x202301(_0x57757e);})[_0x8828('0x11')](function(_0x16b57f){logger[_0x8828('0x12')]('GetInterval',_0x16b57f['message'],_0x16bd92);_0x1e570e(_0x111c4e[_0x8828('0x12')](0x1f4,_0x16b57f[_0x8828('0x13')]));});});};exports[_0x8828('0x14')]=function(_0x5e99ba){var _0x22f668=this;return new Promise(function(_0x4220c8,_0x689db0){return db[_0x8828('0x6')][_0x8828('0x15')]({'raw':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba['options'][_0x8828('0x16')]||null:null,'attributes':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba[_0x8828('0x8')][_0x8828('0x9')]||null:null,'include':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba[_0x8828('0x8')][_0x8828('0xa')]?_[_0x8828('0xb')](_0x5e99ba[_0x8828('0x8')]['include'],function(_0x2ace9c){return{'model':db[_0x2ace9c[_0x8828('0xc')]],'as':_0x2ace9c['as'],'attributes':_0x2ace9c[_0x8828('0x9')],'include':_0x2ace9c[_0x8828('0xa')]?_[_0x8828('0xb')](_0x2ace9c[_0x8828('0xa')],function(_0x253800){return{'model':db[_0x253800[_0x8828('0xc')]],'as':_0x253800['as'],'attributes':_0x253800[_0x8828('0x9')],'include':_0x253800['include']?_[_0x8828('0xb')](_0x253800[_0x8828('0xa')],function(_0x220673){return{'model':db[_0x220673['model']],'as':_0x220673['as'],'attributes':_0x220673[_0x8828('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8828('0xd')](function(_0x51960e){logger['info'](_0x8828('0x14'),_0x5e99ba);logger[_0x8828('0xf')]('ShowInterval',_0x5e99ba,JSON[_0x8828('0x10')](_0x51960e));_0x4220c8(_0x51960e);})['catch'](function(_0x3bf33e){logger[_0x8828('0x12')](_0x8828('0x14'),_0x3bf33e[_0x8828('0x13')],_0x5e99ba);_0x689db0(_0x22f668[_0x8828('0x12')](0x1f4,_0x3bf33e[_0x8828('0x13')]));});});};function checkArrayOfIntervals(_0x5948ff,_0x50fec6){var _0x3f5567=[];return db['Interval']['findAll']({'where':{'id':_0x5948ff}})[_0x8828('0xd')](function(_0x5bf1cc){_0x3f5567=_0x5bf1cc;return Promise[_0x8828('0x17')](_0x3f5567[_0x8828('0xb')](function(_0xe613e1){return _0xe613e1[_0x8828('0x18')](_0x50fec6);}));})[_0x8828('0xd')](function(_0x30202e){var _0x288708=_0x30202e['reduce'](function(_0x42ca39,_0x42c9d0){return _0x42ca39||_0x42c9d0;},![]);logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x1a'),_0x3f5567['map'](function(_0x73bb56){return _0x73bb56[_0x8828('0x1b')];})[_0x8828('0x1c')](',\x20'),_0x3f5567[_0x8828('0xb')](function(_0xb9bd37){return _0xb9bd37['id'];})[_0x8828('0x1c')](',\x20')));return _0x288708;});}function checkSingleInterval(_0x4813c5,_0x167140){return db[_0x8828('0x6')][_0x8828('0x1d')](_0x4813c5)['then'](function(_0x7e8837){if(_0x7e8837){logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x1e'),_0x7e8837[_0x8828('0x1b')],_0x7e8837['id']));return _0x7e8837[_0x8828('0x18')](_0x167140);}});}exports['IntervalIftime']=function(_0x54b484){var _0x2c5823=_0x54b484[_0x8828('0x1f')];var _0x2416a7=Array[_0x8828('0x20')](_0x54b484[_0x8828('0x21')])?_0x54b484[_0x8828('0x21')]:typeof _0x54b484[_0x8828('0x21')]===_0x8828('0x22')?[_0x54b484['intervals']]:[];var _0x5b356a=_0x54b484['timezone']||undefined;var _0x28693f=![];if(_0x2416a7[_0x8828('0x23')]){logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x24'),_0x2416a7['join'](';\x20')));}if(_0x5b356a){logger[_0x8828('0xe')](util[_0x8828('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x5b356a));}logger['debug'](_0x8828('0x25'),_0x28693f);logger[_0x8828('0x26')]('IntervalIftime',_0x54b484);return Promise[_0x8828('0x27')]()[_0x8828('0xd')](function(){if(Array[_0x8828('0x20')](_0x2c5823)){return checkArrayOfIntervals(_0x2c5823,_0x5b356a);}else if(_0x2c5823){return checkSingleInterval(_0x2c5823,_0x5b356a);}})[_0x8828('0xd')](function(_0x224945){var _0x3d3f39=_0x2416a7[_0x8828('0x28')](function(_0x48f4b0,_0x55c858){return _0x48f4b0||iftime(_0x55c858,_0x5b356a);},![]);_0x28693f=_0x224945||_0x3d3f39;return _0x28693f;})[_0x8828('0x11')](function(_0x584a28){logger[_0x8828('0x12')](_0x8828('0x29'),_0x54b484,_0x584a28);throw this['error'](0x1f4,_0x584a28[_0x8828('0x13')]);});}; \ No newline at end of file +var _0x3547=['../../config/logger','GetInterval','Interval','options','where','attributes','include','map','model','then','stringify','catch','message','error','ShowInterval','find','info','debug','findAll','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','isArray','reduce','lodash','../../mysqldb','../../utils/iftime'];(function(_0x3774c7,_0x361f2b){var _0x1db61e=function(_0x442a9e){while(--_0x442a9e){_0x3774c7['push'](_0x3774c7['shift']());}};_0x1db61e(++_0x361f2b);}(_0x3547,0x107));var _0x7354=function(_0x3f099e,_0x5968cc){_0x3f099e=_0x3f099e-0x0;var _0xe9234e=_0x3547[_0x3f099e];return _0xe9234e;};'use strict';var _=require(_0x7354('0x0'));var util=require('util');var db=require(_0x7354('0x1'))['db'];var iftime=require(_0x7354('0x2'))['iftime'];var logger=require(_0x7354('0x3'))('rpc');exports[_0x7354('0x4')]=function(_0xfbb606){var _0x23e038=this;return new Promise(function(_0x1be0db,_0x1d4b83){return db[_0x7354('0x5')]['findAll']({'raw':_0xfbb606['options']?_0xfbb606[_0x7354('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0xfbb606[_0x7354('0x6')]?_0xfbb606[_0x7354('0x6')][_0x7354('0x7')]||null:null,'attributes':_0xfbb606['options']?_0xfbb606[_0x7354('0x6')][_0x7354('0x8')]||null:null,'limit':_0xfbb606[_0x7354('0x6')]?_0xfbb606[_0x7354('0x6')]['limit']||null:null,'include':_0xfbb606[_0x7354('0x6')]?_0xfbb606[_0x7354('0x6')][_0x7354('0x9')]?_[_0x7354('0xa')](_0xfbb606[_0x7354('0x6')][_0x7354('0x9')],function(_0x51e421){return{'model':db[_0x51e421[_0x7354('0xb')]],'as':_0x51e421['as'],'attributes':_0x51e421['attributes'],'include':_0x51e421['include']?_['map'](_0x51e421[_0x7354('0x9')],function(_0x243112){return{'model':db[_0x243112['model']],'as':_0x243112['as'],'attributes':_0x243112[_0x7354('0x8')],'include':_0x243112[_0x7354('0x9')]?_['map'](_0x243112[_0x7354('0x9')],function(_0x1e7a12){return{'model':db[_0x1e7a12[_0x7354('0xb')]],'as':_0x1e7a12['as'],'attributes':_0x1e7a12[_0x7354('0x8')]};}):[]};}):[]};}):[]:[]})[_0x7354('0xc')](function(_0x19192a){logger['info']('GetInterval',_0xfbb606);logger['debug'](_0x7354('0x4'),_0xfbb606,JSON[_0x7354('0xd')](_0x19192a));_0x1be0db(_0x19192a);})[_0x7354('0xe')](function(_0x91edf8){logger['error'](_0x7354('0x4'),_0x91edf8[_0x7354('0xf')],_0xfbb606);_0x1d4b83(_0x23e038[_0x7354('0x10')](0x1f4,_0x91edf8[_0x7354('0xf')]));});});};exports[_0x7354('0x11')]=function(_0x8ddced){var _0xa404f9=this;return new Promise(function(_0x44292e,_0x13875f){return db['Interval'][_0x7354('0x12')]({'raw':_0x8ddced[_0x7354('0x6')]?_0x8ddced[_0x7354('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x8ddced[_0x7354('0x6')]?_0x8ddced[_0x7354('0x6')]['where']||null:null,'attributes':_0x8ddced[_0x7354('0x6')]?_0x8ddced[_0x7354('0x6')]['attributes']||null:null,'include':_0x8ddced[_0x7354('0x6')]?_0x8ddced[_0x7354('0x6')][_0x7354('0x9')]?_['map'](_0x8ddced[_0x7354('0x6')][_0x7354('0x9')],function(_0x22e215){return{'model':db[_0x22e215[_0x7354('0xb')]],'as':_0x22e215['as'],'attributes':_0x22e215['attributes'],'include':_0x22e215[_0x7354('0x9')]?_[_0x7354('0xa')](_0x22e215[_0x7354('0x9')],function(_0x2f557a){return{'model':db[_0x2f557a[_0x7354('0xb')]],'as':_0x2f557a['as'],'attributes':_0x2f557a[_0x7354('0x8')],'include':_0x2f557a['include']?_[_0x7354('0xa')](_0x2f557a[_0x7354('0x9')],function(_0xaa6904){return{'model':db[_0xaa6904['model']],'as':_0xaa6904['as'],'attributes':_0xaa6904[_0x7354('0x8')]};}):[]};}):[]};}):[]:[]})[_0x7354('0xc')](function(_0xb3059a){logger[_0x7354('0x13')]('ShowInterval',_0x8ddced);logger[_0x7354('0x14')](_0x7354('0x11'),_0x8ddced,JSON[_0x7354('0xd')](_0xb3059a));_0x44292e(_0xb3059a);})[_0x7354('0xe')](function(_0x4de2b8){logger[_0x7354('0x10')]('ShowInterval',_0x4de2b8[_0x7354('0xf')],_0x8ddced);_0x13875f(_0xa404f9[_0x7354('0x10')](0x1f4,_0x4de2b8['message']));});});};function checkArrayOfIntervals(_0x4cb8c2,_0x427db0){var _0x320a9c=[];return db[_0x7354('0x5')][_0x7354('0x15')]({'where':{'id':_0x4cb8c2}})[_0x7354('0xc')](function(_0x8e4997){_0x320a9c=_0x8e4997;return Promise[_0x7354('0x16')](_0x320a9c[_0x7354('0xa')](function(_0x8c3578){return _0x8c3578[_0x7354('0x17')](_0x427db0);}));})[_0x7354('0xc')](function(_0xce8802){var _0x5020f4=_0xce8802['reduce'](function(_0x523fb9,_0x2bbb28){return _0x523fb9||_0x2bbb28;},![]);logger[_0x7354('0x13')](util['format'](_0x7354('0x18'),_0x320a9c['map'](function(_0x3838d0){return _0x3838d0[_0x7354('0x19')];})[_0x7354('0x1a')](',\x20'),_0x320a9c[_0x7354('0xa')](function(_0x4cb626){return _0x4cb626['id'];})[_0x7354('0x1a')](',\x20')));return _0x5020f4;});}function checkSingleInterval(_0x1fee1f,_0x109814){return db[_0x7354('0x5')][_0x7354('0x1b')](_0x1fee1f)[_0x7354('0xc')](function(_0x1c05ff){if(_0x1c05ff){logger[_0x7354('0x13')](util['format'](_0x7354('0x1c'),_0x1c05ff['name'],_0x1c05ff['id']));return _0x1c05ff[_0x7354('0x17')](_0x109814);}});}exports[_0x7354('0x1d')]=function(_0x22395a){var _0x565d4e=_0x22395a[_0x7354('0x1e')];var _0x5754b8=Array['isArray'](_0x22395a[_0x7354('0x1f')])?_0x22395a[_0x7354('0x1f')]:typeof _0x22395a[_0x7354('0x1f')]==='string'?[_0x22395a[_0x7354('0x1f')]]:[];var _0x237fb3=_0x22395a['timezone']||undefined;var _0x1248ed=![];if(_0x5754b8[_0x7354('0x20')]){logger[_0x7354('0x13')](util[_0x7354('0x21')](_0x7354('0x22'),_0x5754b8[_0x7354('0x1a')](';\x20')));}if(_0x237fb3){logger[_0x7354('0x13')](util[_0x7354('0x21')](_0x7354('0x23'),_0x237fb3));}logger[_0x7354('0x14')]('Iftime',_0x1248ed);logger['silly']('IntervalIftime',_0x22395a);return Promise['resolve']()[_0x7354('0xc')](function(){if(Array[_0x7354('0x24')](_0x565d4e)){return checkArrayOfIntervals(_0x565d4e,_0x237fb3);}else if(_0x565d4e){return checkSingleInterval(_0x565d4e,_0x237fb3);}})[_0x7354('0xc')](function(_0x130e2f){var _0x1ff961=_0x5754b8[_0x7354('0x25')](function(_0x125761,_0x3f48a2){return _0x125761||iftime(_0x3f48a2,_0x237fb3);},![]);_0x1248ed=_0x130e2f||_0x1ff961;return _0x1248ed;})[_0x7354('0xe')](function(_0x12619b){logger['error'](_0x7354('0x1d'),_0x22395a,_0x12619b);throw this[_0x7354('0x10')](0x1f4,_0x12619b[_0x7354('0xf')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d9e74c0..6b9dad3 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x0b0e,0x187));var _0xe0b0=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x0b0e[_0x246890];return _0x2b2a5a;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x305362,_0x27feb9){var _0x1fba96=function(_0x646452){while(--_0x646452){_0x305362['push'](_0x305362['shift']());}};_0x1fba96(++_0x27feb9);}(_0x2032,0xd9));var _0x2203=function(_0x49adac,_0x468342){_0x49adac=_0x49adac-0x0;var _0x327d1c=_0x2032[_0x49adac];return _0x327d1c;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 75ca30b..6f69c4d 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 _0x5a39=['utf8','data','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','setEncoding'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a39,0x138));var _0x95a3=function(_0xba248b,_0x1ca690){_0xba248b=_0xba248b-0x0;var _0x3d2d45=_0x5a39[_0xba248b];return _0x3d2d45;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x95a3('0x0'))(_0x95a3('0x1'));var USERNAME='support';var PASSWORD=_0x95a3('0x2');function openIssue(_0x3f696a,_0x53a23b){var _0x4cbd2c={'fields':{'project':{'key':_0x3f696a[_0x95a3('0x3')]||_0x95a3('0x4')},'summary':(_0x3f696a[_0x95a3('0x5')]||_0x95a3('0x6'))+'\x20from\x20'+_0x3f696a['ip'],'description':_0x3f696a[_0x95a3('0x7')]||JSON[_0x95a3('0x8')](_0x3f696a),'issuetype':{'name':_0x3f696a[_0x95a3('0x9')]||'Bug'}}};_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xb')]=_0x3f696a['email'];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xc')]=_0x3f696a[_0x95a3('0xd')];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xe')]=_0x3f696a['newToken'];_0x4cbd2c[_0x95a3('0xa')]['customfield_11503']=_0x3f696a[_0x95a3('0xf')];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0x10')]=_0x3f696a['reason'];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0x11')]=_0x3f696a['ip'];var _0xa3a7aa={'host':_0x95a3('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x95a3('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x95a3('0x14'),'Authorization':_0x95a3('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x95a3('0x16'))}};var _0x3abb97=JSON[_0x95a3('0x8')](_0x4cbd2c);var _0x1c3de1=https['request'](_0xa3a7aa,function(_0x1d23e9){_0x1d23e9[_0x95a3('0x17')](_0x95a3('0x18'));var _0x597b8d='';_0x1d23e9['on'](_0x95a3('0x19'),function(_0x4360e5){_0x597b8d+=_0x4360e5;});_0x1d23e9['on']('end',function(){if(_0x53a23b){return _0x53a23b[_0x95a3('0x1a')](_0x1d23e9[_0x95a3('0x1b')])['json'](JSON[_0x95a3('0x1c')](_0x597b8d));}});});_0x1c3de1['on'](_0x95a3('0x1d'),function(_0x3c96b9){if(_0x53a23b){return _0x53a23b[_0x95a3('0x1a')](0x1f4)[_0x95a3('0x1e')]({'errors':[{'message':_0x95a3('0x1f'),'type':_0x95a3('0x20')}]});}});_0x1c3de1[_0x95a3('0x21')](_0x3abb97);_0x1c3de1['end']();}exports[_0x95a3('0x22')]=openIssue;exports[_0x95a3('0x23')]=function(_0x51044c,_0x808481){_0x51044c[_0x95a3('0x24')]['ip']=_0x51044c[_0x95a3('0x25')][_0x95a3('0x26')]||_0x51044c[_0x95a3('0x27')][_0x95a3('0x28')]||_0x51044c['socket'][_0x95a3('0x28')]||_0x51044c[_0x95a3('0x27')][_0x95a3('0x29')][_0x95a3('0x28')];return openIssue(_0x51044c[_0x95a3('0x24')],_0x808481);}; \ No newline at end of file +var _0xd970=['json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','stringify','utf8','data','end','statusCode'];(function(_0xba6b88,_0x4f1e92){var _0x575135=function(_0x52cf18){while(--_0x52cf18){_0xba6b88['push'](_0xba6b88['shift']());}};_0x575135(++_0x4f1e92);}(_0xd970,0xdd));var _0x0d97=function(_0x45a2c7,_0x3e8440){_0x45a2c7=_0x45a2c7-0x0;var _0x18dff2=_0xd970[_0x45a2c7];return _0x18dff2;};'use strict';var BPromise=require(_0x0d97('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x0d97('0x1'));var USERNAME='support';var PASSWORD=_0x0d97('0x2');function openIssue(_0x1f8512,_0x383de4){var _0x387217={'fields':{'project':{'key':_0x1f8512[_0x0d97('0x3')]||_0x0d97('0x4')},'summary':(_0x1f8512[_0x0d97('0x5')]||_0x0d97('0x6'))+_0x0d97('0x7')+_0x1f8512['ip'],'description':_0x1f8512[_0x0d97('0x8')]||JSON['stringify'](_0x1f8512),'issuetype':{'name':_0x1f8512[_0x0d97('0x9')]||_0x0d97('0xa')}}};_0x387217[_0x0d97('0xb')][_0x0d97('0xc')]=_0x1f8512[_0x0d97('0xd')];_0x387217[_0x0d97('0xb')][_0x0d97('0xe')]=_0x1f8512[_0x0d97('0xf')];_0x387217[_0x0d97('0xb')][_0x0d97('0x10')]=_0x1f8512[_0x0d97('0x11')];_0x387217[_0x0d97('0xb')]['customfield_11503']=_0x1f8512[_0x0d97('0x12')];_0x387217[_0x0d97('0xb')][_0x0d97('0x13')]=_0x1f8512[_0x0d97('0x14')];_0x387217[_0x0d97('0xb')]['customfield_10102']=_0x1f8512['ip'];var _0x58a7ec={'host':_0x0d97('0x15'),'port':0x1bb,'path':_0x0d97('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0d97('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x0d97('0x18')](_0x0d97('0x19'))}};var _0x1696f6=JSON[_0x0d97('0x1a')](_0x387217);var _0x5c7e57=https['request'](_0x58a7ec,function(_0x57b424){_0x57b424['setEncoding'](_0x0d97('0x1b'));var _0x37e2de='';_0x57b424['on'](_0x0d97('0x1c'),function(_0x59a81b){_0x37e2de+=_0x59a81b;});_0x57b424['on'](_0x0d97('0x1d'),function(){if(_0x383de4){return _0x383de4['status'](_0x57b424[_0x0d97('0x1e')])[_0x0d97('0x1f')](JSON[_0x0d97('0x20')](_0x37e2de));}});});_0x5c7e57['on']('error',function(_0x5d8be1){if(_0x383de4){return _0x383de4[_0x0d97('0x21')](0x1f4)[_0x0d97('0x1f')]({'errors':[{'message':_0x0d97('0x22'),'type':'api.jira'}]});}});_0x5c7e57[_0x0d97('0x23')](_0x1696f6);_0x5c7e57[_0x0d97('0x1d')]();}exports[_0x0d97('0x24')]=openIssue;exports['send']=function(_0x54af5d,_0x42c32d){_0x54af5d[_0x0d97('0x25')]['ip']=_0x54af5d[_0x0d97('0x26')][_0x0d97('0x27')]||_0x54af5d['connection'][_0x0d97('0x28')]||_0x54af5d[_0x0d97('0x29')][_0x0d97('0x28')]||_0x54af5d['connection'][_0x0d97('0x29')][_0x0d97('0x28')];return openIssue(_0x54af5d[_0x0d97('0x25')],_0x42c32d);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f532fd2..23d7f9e 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x5a21a4,_0xc836c4){var _0x3dc8d7=function(_0x3b6adb){while(--_0x3b6adb){_0x5a21a4['push'](_0x5a21a4['shift']());}};_0x3dc8d7(++_0xc836c4);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x588241,_0x3bbd0b){var _0x559773=function(_0x423dc6){while(--_0x423dc6){_0x588241['push'](_0x588241['shift']());}};_0x559773(++_0x3bbd0b);}(_0xbec5,0xe5));var _0x5bec=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xbec5[_0x336264];return _0x53cf91;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7e1547d..64645bb 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x18cdb3,_0x464d8f){_0x18cdb3=_0x18cdb3-0x0;var _0x16e5f8=_0x7a54[_0x18cdb3];return _0x16e5f8;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x4330d9,_0x13660a){_0x4330d9=_0x4330d9-0x0;var _0x50f6b0=_0x7a54[_0x4330d9];return _0x50f6b0;};'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 f778362..c0fc985 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 _0x165d=['attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model'];(function(_0x59ad89,_0x41cdbd){var _0x463e97=function(_0x4bc593){while(--_0x4bc593){_0x59ad89['push'](_0x59ad89['shift']());}};_0x463e97(++_0x41cdbd);}(_0x165d,0x14a));var _0xd165=function(_0x4caf6d,_0x5a4a0d){_0x4caf6d=_0x4caf6d-0x0;var _0x144166=_0x165d[_0x4caf6d];return _0x144166;};'use strict';var emlformat=require(_0xd165('0x0'));var rimraf=require(_0xd165('0x1'));var zipdir=require(_0xd165('0x2'));var jsonpatch=require(_0xd165('0x3'));var rp=require(_0xd165('0x4'));var moment=require(_0xd165('0x5'));var BPromise=require(_0xd165('0x6'));var Mustache=require('mustache');var util=require(_0xd165('0x7'));var path=require(_0xd165('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd165('0x9'));var _=require(_0xd165('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd165('0xb'));var deskjs=require(_0xd165('0xc'));var toCsv=require(_0xd165('0xd'));var querystring=require(_0xd165('0xe'));var Papa=require(_0xd165('0xf'));var Redis=require(_0xd165('0x10'));var authService=require(_0xd165('0x11'));var qs=require(_0xd165('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd165('0x13'));var logger=require(_0xd165('0x14'))(_0xd165('0x15'));var utils=require('../../config/utils');var config=require(_0xd165('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd165('0x17'))['db'];function respondWithStatusCode(_0x267f62,_0x2eee5c){_0x2eee5c=_0x2eee5c||0xcc;return function(_0x430499){if(_0x430499){return _0x267f62['sendStatus'](_0x2eee5c);}return _0x267f62['status'](_0x2eee5c)[_0xd165('0x18')]();};}function respondWithResult(_0x17521a,_0x3e586a){_0x3e586a=_0x3e586a||0xc8;return function(_0x51fa95){if(_0x51fa95){return _0x17521a['status'](_0x3e586a)['json'](_0x51fa95);}};}function respondWithFilteredResult(_0x693c9b,_0x3e6032){return function(_0x4c86c6){if(_0x4c86c6){var _0x170839=typeof _0x3e6032[_0xd165('0x19')]==='undefined'&&typeof _0x3e6032['limit']===_0xd165('0x1a');var _0x30378f=_0x4c86c6['count'];var _0x551561=_0x170839?0x0:_0x3e6032['offset'];var _0x529cc9=_0x170839?_0x4c86c6[_0xd165('0x1b')]:_0x3e6032[_0xd165('0x19')]+_0x3e6032[_0xd165('0x1c')];var _0x7ed688;if(_0x529cc9>=_0x30378f){_0x529cc9=_0x30378f;_0x7ed688=0xc8;}else{_0x7ed688=0xce;}_0x693c9b[_0xd165('0x1d')](_0x7ed688);return _0x693c9b[_0xd165('0x1e')](_0xd165('0x1f'),_0x551561+'-'+_0x529cc9+'/'+_0x30378f)[_0xd165('0x20')](_0x4c86c6);}return null;};}function patchUpdates(_0x332b0a){return function(_0x4ec084){try{jsonpatch[_0xd165('0x21')](_0x4ec084,_0x332b0a,!![]);}catch(_0x492257){return BPromise[_0xd165('0x22')](_0x492257);}return _0x4ec084[_0xd165('0x23')]();};}function saveUpdates(_0x5e9d0a,_0x46a462){return function(_0x3a3b5a){if(_0x3a3b5a){return _0x3a3b5a['update'](_0x5e9d0a)[_0xd165('0x24')](function(_0x33754b){return _0x33754b;});}return null;};}function removeEntity(_0x26ae3b,_0x5a86a2){return function(_0x36838b){if(_0x36838b){return _0x36838b[_0xd165('0x25')]()[_0xd165('0x24')](function(){_0x26ae3b[_0xd165('0x1d')](0xcc)[_0xd165('0x18')]();});}};}function handleEntityNotFound(_0x21a42e,_0x528ea8){return function(_0x43946e){if(!_0x43946e){_0x21a42e[_0xd165('0x26')](0x194);}return _0x43946e;};}function handleError(_0x3c80b7,_0x11167c){_0x11167c=_0x11167c||0x1f4;return function(_0x45183b){logger[_0xd165('0x27')](_0x45183b[_0xd165('0x28')]);if(_0x45183b['name']){delete _0x45183b[_0xd165('0x29')];}_0x3c80b7['status'](_0x11167c)[_0xd165('0x2a')](_0x45183b);};}exports[_0xd165('0x2b')]=function(_0xeefe8,_0x4c503a){var _0x2e71e3={},_0x33ef5f={},_0x1db50b={'count':0x0,'rows':[]};var _0x38f4d3=_['map'](db[_0xd165('0x2c')][_0xd165('0x2d')],function(_0x11a46c){return{'name':_0x11a46c[_0xd165('0x2e')],'type':_0x11a46c[_0xd165('0x2f')][_0xd165('0x30')]};});_0x33ef5f['model']=_[_0xd165('0x31')](_0x38f4d3,_0xd165('0x29'));_0x33ef5f['query']=_[_0xd165('0x32')](_0xeefe8[_0xd165('0x33')]);_0x33ef5f[_0xd165('0x34')]=_[_0xd165('0x35')](_0x33ef5f[_0xd165('0x36')],_0x33ef5f[_0xd165('0x33')]);_0x2e71e3['attributes']=_['intersection'](_0x33ef5f[_0xd165('0x36')],qs['fields'](_0xeefe8[_0xd165('0x33')]['fields']));_0x2e71e3[_0xd165('0x37')]=_0x2e71e3['attributes'][_0xd165('0x38')]?_0x2e71e3[_0xd165('0x37')]:_0x33ef5f[_0xd165('0x36')];if(!_0xeefe8[_0xd165('0x33')][_0xd165('0x39')](_0xd165('0x3a'))){_0x2e71e3[_0xd165('0x1c')]=qs[_0xd165('0x1c')](_0xeefe8[_0xd165('0x33')][_0xd165('0x1c')]);_0x2e71e3[_0xd165('0x19')]=qs[_0xd165('0x19')](_0xeefe8[_0xd165('0x33')][_0xd165('0x19')]);}_0x2e71e3['order']=qs[_0xd165('0x3b')](_0xeefe8[_0xd165('0x33')][_0xd165('0x3b')]);_0x2e71e3[_0xd165('0x3c')]=qs[_0xd165('0x34')](_['pick'](_0xeefe8['query'],_0x33ef5f['filters']),_0x38f4d3);if(_0xeefe8[_0xd165('0x33')][_0xd165('0x3d')]){_0x2e71e3[_0xd165('0x3c')]=_[_0xd165('0x3e')](_0x2e71e3[_0xd165('0x3c')],{'$or':_[_0xd165('0x31')](_0x38f4d3,function(_0x250200){if(_0x250200[_0xd165('0x2f')]!==_0xd165('0x3f')){var _0x1a2e19={};_0x1a2e19[_0x250200[_0xd165('0x29')]]={'$like':'%'+_0xeefe8['query'][_0xd165('0x3d')]+'%'};return _0x1a2e19;}})});}_0x2e71e3=_[_0xd165('0x3e')]({},_0x2e71e3,_0xeefe8[_0xd165('0x40')]);var _0xcafb72={'where':_0x2e71e3[_0xd165('0x3c')]};return db['JscriptyAnswerReport'][_0xd165('0x1b')](_0xcafb72)[_0xd165('0x24')](function(_0x5e3708){_0x1db50b[_0xd165('0x1b')]=_0x5e3708;if(_0xeefe8[_0xd165('0x33')][_0xd165('0x41')]){_0x2e71e3[_0xd165('0x42')]=[{'all':!![]}];}return db[_0xd165('0x2c')][_0xd165('0x43')](_0x2e71e3);})['then'](function(_0x4a5b12){_0x1db50b[_0xd165('0x44')]=_0x4a5b12;return _0x1db50b;})[_0xd165('0x24')](respondWithFilteredResult(_0x4c503a,_0x2e71e3))[_0xd165('0x45')](handleError(_0x4c503a,null));};exports[_0xd165('0x46')]=function(_0x36202f,_0x363290){var _0x290384={'raw':!![],'where':{'id':_0x36202f['params']['id']}},_0xb446f8={};_0xb446f8[_0xd165('0x36')]=_['keys'](db[_0xd165('0x2c')][_0xd165('0x2d')]);_0xb446f8[_0xd165('0x33')]=_[_0xd165('0x32')](_0x36202f[_0xd165('0x33')]);_0xb446f8[_0xd165('0x34')]=_['intersection'](_0xb446f8[_0xd165('0x36')],_0xb446f8[_0xd165('0x33')]);_0x290384[_0xd165('0x37')]=_['intersection'](_0xb446f8[_0xd165('0x36')],qs['fields'](_0x36202f[_0xd165('0x33')][_0xd165('0x47')]));_0x290384[_0xd165('0x37')]=_0x290384[_0xd165('0x37')][_0xd165('0x38')]?_0x290384[_0xd165('0x37')]:_0xb446f8[_0xd165('0x36')];if(_0x36202f['query']['includeAll']){_0x290384['include']=[{'all':!![]}];}_0x290384=_['merge']({},_0x290384,_0x36202f['options']);return db[_0xd165('0x2c')][_0xd165('0x48')](_0x290384)[_0xd165('0x24')](handleEntityNotFound(_0x363290,null))[_0xd165('0x24')](respondWithResult(_0x363290,null))[_0xd165('0x45')](handleError(_0x363290,null));};exports[_0xd165('0x49')]=function(_0x5e73e5,_0x4c729d){return db[_0xd165('0x2c')][_0xd165('0x49')](_0x5e73e5[_0xd165('0x4a')],{})[_0xd165('0x24')](respondWithResult(_0x4c729d,0xc9))[_0xd165('0x45')](handleError(_0x4c729d,null));};exports['update']=function(_0x54f064,_0xd0e787){if(_0x54f064[_0xd165('0x4a')]['id']){delete _0x54f064['body']['id'];}return db[_0xd165('0x2c')][_0xd165('0x48')]({'where':{'id':_0x54f064[_0xd165('0x4b')]['id']}})[_0xd165('0x24')](handleEntityNotFound(_0xd0e787,null))[_0xd165('0x24')](saveUpdates(_0x54f064[_0xd165('0x4a')],null))[_0xd165('0x24')](respondWithResult(_0xd0e787,null))[_0xd165('0x45')](handleError(_0xd0e787,null));};exports[_0xd165('0x25')]=function(_0x1dc329,_0x18f83d){return db['JscriptyAnswerReport'][_0xd165('0x48')]({'where':{'id':_0x1dc329[_0xd165('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18f83d,null))['then'](removeEntity(_0x18f83d,null))[_0xd165('0x45')](handleError(_0x18f83d,null));};exports[_0xd165('0x4c')]=function(_0x4480ac,_0x2d06cb){return db['JscriptyAnswerReport'][_0xd165('0x4c')]()[_0xd165('0x24')](respondWithResult(_0x2d06cb,null))[_0xd165('0x45')](handleError(_0x2d06cb,null));}; \ No newline at end of file +var _0x4819=['path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4d64d6,_0x23d809){var _0x5bb8dd=function(_0x4676b3){while(--_0x4676b3){_0x4d64d6['push'](_0x4d64d6['shift']());}};_0x5bb8dd(++_0x23d809);}(_0x4819,0xcd));var _0x9481=function(_0x4e566c,_0x16e04c){_0x4e566c=_0x4e566c-0x0;var _0x31947e=_0x4819[_0x4e566c];return _0x31947e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['JscriptyAnswerReport']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['JscriptyAnswerReport'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));};exports[_0x9481('0x46')]=function(_0x5ee59e,_0x4c3048){return db[_0x9481('0x2b')][_0x9481('0x46')]()[_0x9481('0x25')](respondWithResult(_0x4c3048,null))['catch'](handleError(_0x4c3048,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9cd30bd..5ce8f96 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 _0x29fa=['path','rimraf','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','bluebird','request-promise'];(function(_0x274d6b,_0x3d537c){var _0x5bdb46=function(_0x3f8b06){while(--_0x3f8b06){_0x274d6b['push'](_0x274d6b['shift']());}};_0x5bdb46(++_0x3d537c);}(_0x29fa,0xb9));var _0xa29f=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x29fa[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require(_0xa29f('0x0'));var util=require('util');var logger=require(_0xa29f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa29f('0x2'));var rp=require(_0xa29f('0x3'));var fs=require('fs');var path=require(_0xa29f('0x4'));var rimraf=require(_0xa29f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa29f('0x6'));module['exports']=function(_0x2b833d,_0x27e94a){return _0x2b833d['define'](_0xa29f('0x7'),attributes,{'tableName':_0xa29f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c4=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc2c4,0x1d9));var _0x4c2c=function(_0x3a63c6,_0x352002){_0x3a63c6=_0x3a63c6-0x0;var _0x179ad4=_0xc2c4[_0x3a63c6];return _0x179ad4;};'use strict';var _=require(_0x4c2c('0x0'));var util=require(_0x4c2c('0x1'));var logger=require(_0x4c2c('0x2'))(_0x4c2c('0x3'));var moment=require(_0x4c2c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c2c('0x5'));var rimraf=require(_0x4c2c('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c2c('0x7'));module[_0x4c2c('0x8')]=function(_0x3fc2d6,_0x23c072){return _0x3fc2d6[_0x4c2c('0x9')](_0x4c2c('0xa'),attributes,{'tableName':_0x4c2c('0xb'),'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 4a5ab50..8accb06 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 _0xf172=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0xf172,0xab));var _0x2f17=function(_0xe6612a,_0x160233){_0xe6612a=_0xe6612a-0x0;var _0x404010=_0xf172[_0xe6612a];return _0x404010;};'use strict';var _=require(_0x2f17('0x0'));var util=require(_0x2f17('0x1'));var moment=require(_0x2f17('0x2'));var BPromise=require(_0x2f17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f17('0x4'))['db'];var utils=require(_0x2f17('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2f17('0x6')][_0x2f17('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33c4f2,_0x28b17f,_0x575cf8){return new BPromise(function(_0x455a12,_0x119eb5){return client[_0x2f17('0x8')](_0x33c4f2,_0x575cf8)['then'](function(_0x1e1515){logger['info'](_0x2f17('0x9'),_0x28b17f,_0x2f17('0xa'));logger[_0x2f17('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x28b17f,'request\x20sent',JSON[_0x2f17('0xc')](_0x1e1515));if(_0x1e1515[_0x2f17('0xd')]){if(_0x1e1515['error'][_0x2f17('0xe')]===0x1f4){logger['error'](_0x2f17('0x9'),_0x28b17f,_0x1e1515[_0x2f17('0xd')][_0x2f17('0xf')]);return _0x119eb5(_0x1e1515[_0x2f17('0xd')]['message']);}logger[_0x2f17('0xd')](_0x2f17('0x9'),_0x28b17f,_0x1e1515['error']['message']);return _0x455a12(_0x1e1515[_0x2f17('0xd')]['message']);}else{logger[_0x2f17('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x28b17f,_0x2f17('0xa'));_0x455a12(_0x1e1515[_0x2f17('0x11')][_0x2f17('0xf')]);}})[_0x2f17('0x12')](function(_0x26bd0c){logger[_0x2f17('0xd')](_0x2f17('0x9'),_0x28b17f,_0x26bd0c);_0x119eb5(_0x26bd0c);});});} \ No newline at end of file +var _0xa348=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4f3f94,_0x4c09a9){var _0xc8904f=function(_0x4bddec){while(--_0x4bddec){_0x4f3f94['push'](_0x4f3f94['shift']());}};_0xc8904f(++_0x4c09a9);}(_0xa348,0x1e5));var _0x8a34=function(_0x59ed42,_0x2d8655){_0x59ed42=_0x59ed42-0x0;var _0x358ad4=_0xa348[_0x59ed42];return _0x358ad4;};'use strict';var _=require(_0x8a34('0x0'));var util=require('util');var moment=require(_0x8a34('0x1'));var BPromise=require(_0x8a34('0x2'));var rs=require(_0x8a34('0x3'));var fs=require('fs');var Redis=require(_0x8a34('0x4'));var db=require(_0x8a34('0x5'))['db'];var utils=require(_0x8a34('0x6'));var logger=require(_0x8a34('0x7'))(_0x8a34('0x8'));var config=require(_0x8a34('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a34('0xa')][_0x8a34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45d53f,_0x4e9356,_0x15bfeb){return new BPromise(function(_0x5c15f3,_0x378f8f){return client[_0x8a34('0xc')](_0x45d53f,_0x15bfeb)['then'](function(_0x4e6fe1){logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x4e9356,_0x8a34('0xf'));logger[_0x8a34('0x10')](_0x8a34('0x11'),_0x4e9356,_0x8a34('0xf'),JSON[_0x8a34('0x12')](_0x4e6fe1));if(_0x4e6fe1[_0x8a34('0x13')]){if(_0x4e6fe1[_0x8a34('0x13')]['code']===0x1f4){logger[_0x8a34('0x13')](_0x8a34('0xe'),_0x4e9356,_0x4e6fe1['error'][_0x8a34('0x14')]);return _0x378f8f(_0x4e6fe1[_0x8a34('0x13')][_0x8a34('0x14')]);}logger[_0x8a34('0x13')](_0x8a34('0xe'),_0x4e9356,_0x4e6fe1[_0x8a34('0x13')][_0x8a34('0x14')]);return _0x5c15f3(_0x4e6fe1[_0x8a34('0x13')][_0x8a34('0x14')]);}else{logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x4e9356,_0x8a34('0xf'));_0x5c15f3(_0x4e6fe1['result'][_0x8a34('0x14')]);}})[_0x8a34('0x15')](function(_0x4bf95d){logger[_0x8a34('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4e9356,_0x4bf95d);_0x378f8f(_0x4bf95d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 30ed5e9..7019e26 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 _0x6898=['../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6898,0x199));var _0x8689=function(_0x13dba5,_0x9c86f6){_0x13dba5=_0x13dba5-0x0;var _0x4189b8=_0x6898[_0x13dba5];return _0x4189b8;};'use strict';var multer=require('multer');var util=require(_0x8689('0x0'));var path=require(_0x8689('0x1'));var timeout=require(_0x8689('0x2'));var express=require(_0x8689('0x3'));var router=express[_0x8689('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8689('0x5'));var interaction=require(_0x8689('0x6'));var config=require(_0x8689('0x7'));var controller=require(_0x8689('0x8'));router[_0x8689('0x9')]('/',auth['isAuthenticated'](),controller[_0x8689('0xa')]);router[_0x8689('0x9')](_0x8689('0xb'),auth[_0x8689('0xc')](),controller['show']);router['get'](_0x8689('0xd'),auth['isAuthenticated'](),controller[_0x8689('0xe')]);router['get'](_0x8689('0xf'),auth[_0x8689('0xc')](),controller[_0x8689('0x10')]);router[_0x8689('0x9')](_0x8689('0x11'),auth['isAuthenticated'](),timeout(_0x8689('0x12')),controller[_0x8689('0x13')]);router[_0x8689('0x14')]('/',auth[_0x8689('0xc')](),controller[_0x8689('0x15')]);router[_0x8689('0x14')](_0x8689('0x16'),auth[_0x8689('0xc')](),controller[_0x8689('0x17')]);router[_0x8689('0x18')](_0x8689('0xb'),auth[_0x8689('0xc')](),controller['update']);router['delete'](_0x8689('0xb'),auth[_0x8689('0xc')](),controller[_0x8689('0x19')]);module['exports']=router; \ No newline at end of file +var _0x03a3=['./jscriptyProject.controller','get','index','show','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x03a3,0x189));var _0x303a=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x03a3[_0x34919b];return _0x505b56;};'use strict';var multer=require(_0x303a('0x0'));var util=require(_0x303a('0x1'));var path=require('path');var timeout=require(_0x303a('0x2'));var express=require('express');var router=express[_0x303a('0x3')]();var fs_extra=require(_0x303a('0x4'));var auth=require(_0x303a('0x5'));var interaction=require(_0x303a('0x6'));var config=require('../../config/environment');var controller=require(_0x303a('0x7'));router[_0x303a('0x8')]('/',auth['isAuthenticated'](),controller[_0x303a('0x9')]);router[_0x303a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x303a('0xa')]);router[_0x303a('0x8')](_0x303a('0xb'),auth[_0x303a('0xc')](),controller['getSessions']);router[_0x303a('0x8')](_0x303a('0xd'),auth[_0x303a('0xc')](),controller[_0x303a('0xe')]);router['get'](_0x303a('0xf'),auth[_0x303a('0xc')](),timeout('30s'),controller[_0x303a('0x10')]);router[_0x303a('0x11')]('/',auth[_0x303a('0xc')](),controller[_0x303a('0x12')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x303a('0x13')]);router[_0x303a('0x14')](_0x303a('0x15'),auth[_0x303a('0xc')](),controller[_0x303a('0x16')]);router[_0x303a('0x17')](_0x303a('0x15'),auth[_0x303a('0xc')](),controller[_0x303a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6b48c25..9bc21f0 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 _0x6e89=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xd066c8,_0x46b223){var _0x369df2=function(_0x314fb9){while(--_0x314fb9){_0xd066c8['push'](_0xd066c8['shift']());}};_0x369df2(++_0x46b223);}(_0x6e89,0x6c));var _0x96e8=function(_0x2a7875,_0x593104){_0x2a7875=_0x2a7875-0x0;var _0x55b782=_0x6e89[_0x2a7875];return _0x55b782;};'use strict';var Sequelize=require(_0x96e8('0x0'));var _=require('lodash');var util=require('util');module[_0x96e8('0x1')]={'name':{'type':Sequelize[_0x96e8('0x2')],'unique':_0x96e8('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x96e8('0x4')](_0x96e8('0x5')),'set':function(_0x112104){if(_[_0x96e8('0x6')](_0x112104)){this[_0x96e8('0x7')](_0x96e8('0x8'),JSON[_0x96e8('0x9')](_0x112104));}else if(_[_0x96e8('0xa')](_0x112104)){this['setDataValue'](_0x96e8('0x8'),_0x112104);}else{this[_0x96e8('0x7')](_0x96e8('0x8'),util[_0x96e8('0xb')](_0x96e8('0xc'),this[_0x96e8('0xd')](_0x96e8('0x3'))||'',this[_0x96e8('0xd')](_0x96e8('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x96e8('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xefe7=['name','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','STRING'];(function(_0xf79585,_0x296bb2){var _0x41c777=function(_0x226171){while(--_0x226171){_0xf79585['push'](_0xf79585['shift']());}};_0x41c777(++_0x296bb2);}(_0xefe7,0x18c));var _0x7efe=function(_0x458a47,_0x2852d9){_0x458a47=_0x458a47-0x0;var _0x12084d=_0xefe7[_0x458a47];return _0x12084d;};'use strict';var Sequelize=require(_0x7efe('0x0'));var _=require(_0x7efe('0x1'));var util=require(_0x7efe('0x2'));module['exports']={'name':{'type':Sequelize[_0x7efe('0x3')],'unique':_0x7efe('0x4')},'description':{'type':Sequelize[_0x7efe('0x3')]},'formData':{'type':Sequelize[_0x7efe('0x5')](_0x7efe('0x6')),'set':function(_0x39f315){if(_[_0x7efe('0x7')](_0x39f315)){this['setDataValue']('formData',JSON[_0x7efe('0x8')](_0x39f315));}else if(_[_0x7efe('0x9')](_0x39f315)){this[_0x7efe('0xa')]('formData',_0x39f315);}else{this[_0x7efe('0xa')](_0x7efe('0xb'),util[_0x7efe('0xc')](_0x7efe('0xd'),this[_0x7efe('0xe')](_0x7efe('0x4'))||'',this[_0x7efe('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7efe('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7efe('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 3f68104..c66fbd0 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 _0x38e7=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyProject','include','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','UserProfileResource','includeAll','options','get','omit','createdAt','updatedAt','body','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','order','pick','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','answer','push','isEmpty','now','writeFileSync','format','/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(_0x87212a,_0x360989){var _0x216047=function(_0x4d9ccf){while(--_0x4d9ccf){_0x87212a['push'](_0x87212a['shift']());}};_0x216047(++_0x360989);}(_0x38e7,0x1eb));var _0x738e=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x38e7[_0xabbd2f];return _0x34a040;};'use strict';var emlformat=require(_0x738e('0x0'));var rimraf=require(_0x738e('0x1'));var zipdir=require(_0x738e('0x2'));var jsonpatch=require(_0x738e('0x3'));var rp=require(_0x738e('0x4'));var moment=require(_0x738e('0x5'));var BPromise=require(_0x738e('0x6'));var Mustache=require(_0x738e('0x7'));var util=require(_0x738e('0x8'));var path=require(_0x738e('0x9'));var sox=require(_0x738e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x738e('0xb'));var squel=require(_0x738e('0xc'));var crypto=require(_0x738e('0xd'));var jsforce=require(_0x738e('0xe'));var deskjs=require(_0x738e('0xf'));var toCsv=require(_0x738e('0x10'));var querystring=require(_0x738e('0x11'));var Papa=require(_0x738e('0x12'));var Redis=require(_0x738e('0x13'));var authService=require(_0x738e('0x14'));var qs=require(_0x738e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x738e('0x16'))('api');var utils=require(_0x738e('0x17'));var config=require(_0x738e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x738e('0x19'))['db'];function respondWithStatusCode(_0x493d1a,_0x1766f2){_0x1766f2=_0x1766f2||0xcc;return function(_0x579327){if(_0x579327){return _0x493d1a[_0x738e('0x1a')](_0x1766f2);}return _0x493d1a[_0x738e('0x1b')](_0x1766f2)[_0x738e('0x1c')]();};}function respondWithResult(_0x2253a0,_0x485f03){_0x485f03=_0x485f03||0xc8;return function(_0x26e9a0){if(_0x26e9a0){return _0x2253a0[_0x738e('0x1b')](_0x485f03)[_0x738e('0x1d')](_0x26e9a0);}};}function respondWithFilteredResult(_0x2af80f,_0x463be3){return function(_0x1a8215){if(_0x1a8215){var _0x5edf88=typeof _0x463be3[_0x738e('0x1e')]===_0x738e('0x1f')&&typeof _0x463be3['limit']===_0x738e('0x1f');var _0x56d8e1=_0x1a8215[_0x738e('0x20')];var _0x3add89=_0x5edf88?0x0:_0x463be3[_0x738e('0x1e')];var _0x130bc5=_0x5edf88?_0x1a8215[_0x738e('0x20')]:_0x463be3[_0x738e('0x1e')]+_0x463be3[_0x738e('0x21')];var _0x498284;if(_0x130bc5>=_0x56d8e1){_0x130bc5=_0x56d8e1;_0x498284=0xc8;}else{_0x498284=0xce;}_0x2af80f[_0x738e('0x1b')](_0x498284);return _0x2af80f['set'](_0x738e('0x22'),_0x3add89+'-'+_0x130bc5+'/'+_0x56d8e1)[_0x738e('0x1d')](_0x1a8215);}return null;};}function patchUpdates(_0xb1d393){return function(_0x5f2d11){try{jsonpatch[_0x738e('0x23')](_0x5f2d11,_0xb1d393,!![]);}catch(_0x2bb2ff){return BPromise[_0x738e('0x24')](_0x2bb2ff);}return _0x5f2d11[_0x738e('0x25')]();};}function saveUpdates(_0xca9396,_0x3d8c4b){return function(_0x48ffbe){if(_0x48ffbe){return _0x48ffbe[_0x738e('0x26')](_0xca9396)[_0x738e('0x27')](function(_0x500473){return _0x500473;});}return null;};}function removeEntity(_0x309187,_0x609ed6){return function(_0xf1cde0){if(_0xf1cde0){return _0xf1cde0['destroy']()[_0x738e('0x27')](function(){var _0x17673=_0xf1cde0['get']({'plain':!![]});var _0x275850='Projects';return db['UserProfileResource'][_0x738e('0x28')]({'where':{'type':_0x275850,'resourceId':_0x17673['id']}})[_0x738e('0x27')](function(){return _0xf1cde0;});})[_0x738e('0x27')](function(){_0x309187[_0x738e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6efd,_0x3ba474){return function(_0x3b4a25){if(!_0x3b4a25){_0x3c6efd[_0x738e('0x1a')](0x194);}return _0x3b4a25;};}function handleError(_0x17b36a,_0x37c2dc){_0x37c2dc=_0x37c2dc||0x1f4;return function(_0x2e3a94){logger[_0x738e('0x29')](_0x2e3a94[_0x738e('0x2a')]);if(_0x2e3a94[_0x738e('0x2b')]){delete _0x2e3a94[_0x738e('0x2b')];}_0x17b36a[_0x738e('0x1b')](_0x37c2dc)[_0x738e('0x2c')](_0x2e3a94);};}exports[_0x738e('0x2d')]=function(_0x1ebcb6,_0x587276){var _0x3216ac={},_0x11cfb0={},_0x2b98fe={'count':0x0,'rows':[]};var _0x155ab9=_['map'](db['JscriptyProject'][_0x738e('0x2e')],function(_0x3963e){return{'name':_0x3963e['fieldName'],'type':_0x3963e[_0x738e('0x2f')][_0x738e('0x30')]};});_0x11cfb0[_0x738e('0x31')]=_[_0x738e('0x32')](_0x155ab9,_0x738e('0x2b'));_0x11cfb0[_0x738e('0x33')]=_[_0x738e('0x34')](_0x1ebcb6['query']);_0x11cfb0[_0x738e('0x35')]=_[_0x738e('0x36')](_0x11cfb0[_0x738e('0x31')],_0x11cfb0[_0x738e('0x33')]);_0x3216ac[_0x738e('0x37')]=_[_0x738e('0x36')](_0x11cfb0[_0x738e('0x31')],qs[_0x738e('0x38')](_0x1ebcb6[_0x738e('0x33')][_0x738e('0x38')]));_0x3216ac['attributes']=_0x3216ac[_0x738e('0x37')][_0x738e('0x39')]?_0x3216ac[_0x738e('0x37')]:_0x11cfb0['model'];if(!_0x1ebcb6['query'][_0x738e('0x3a')](_0x738e('0x3b'))){_0x3216ac[_0x738e('0x21')]=qs[_0x738e('0x21')](_0x1ebcb6[_0x738e('0x33')][_0x738e('0x21')]);_0x3216ac[_0x738e('0x1e')]=qs['offset'](_0x1ebcb6['query'][_0x738e('0x1e')]);}_0x3216ac['order']=qs[_0x738e('0x3c')](_0x1ebcb6[_0x738e('0x33')]['sort']);_0x3216ac[_0x738e('0x3d')]=qs[_0x738e('0x35')](_['pick'](_0x1ebcb6[_0x738e('0x33')],_0x11cfb0[_0x738e('0x35')]),_0x155ab9);if(_0x1ebcb6[_0x738e('0x33')][_0x738e('0x3e')]){_0x3216ac[_0x738e('0x3d')]=_[_0x738e('0x3f')](_0x3216ac[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x155ab9,function(_0x495e9d){if(_0x495e9d[_0x738e('0x2f')]!==_0x738e('0x40')){var _0x23d12b={};_0x23d12b[_0x495e9d[_0x738e('0x2b')]]={'$like':'%'+_0x1ebcb6[_0x738e('0x33')][_0x738e('0x3e')]+'%'};return _0x23d12b;}})});}_0x3216ac=_[_0x738e('0x3f')]({},_0x3216ac,_0x1ebcb6['options']);var _0x597768={'where':_0x3216ac['where']};return db[_0x738e('0x41')]['count'](_0x597768)['then'](function(_0x42a19f){_0x2b98fe[_0x738e('0x20')]=_0x42a19f;if(_0x1ebcb6['query']['includeAll']){_0x3216ac[_0x738e('0x42')]=[{'all':!![]}];}return db[_0x738e('0x41')]['findAll'](_0x3216ac);})[_0x738e('0x27')](function(_0x5e5d37){_0x2b98fe[_0x738e('0x43')]=_0x5e5d37;return _0x2b98fe;})[_0x738e('0x27')](respondWithFilteredResult(_0x587276,_0x3216ac))['catch'](handleError(_0x587276,null));};exports[_0x738e('0x44')]=function(_0x3950b1,_0x2dd327){var _0x51f1a5={'raw':![],'where':{'id':_0x3950b1[_0x738e('0x45')]['id']}},_0x78604a={};_0x78604a[_0x738e('0x31')]=_[_0x738e('0x34')](db[_0x738e('0x41')][_0x738e('0x2e')]);_0x78604a['query']=_[_0x738e('0x34')](_0x3950b1['query']);_0x78604a['filters']=_['intersection'](_0x78604a[_0x738e('0x31')],_0x78604a[_0x738e('0x33')]);_0x51f1a5[_0x738e('0x37')]=_[_0x738e('0x36')](_0x78604a[_0x738e('0x31')],qs[_0x738e('0x38')](_0x3950b1[_0x738e('0x33')]['fields']));_0x51f1a5[_0x738e('0x37')]=_0x51f1a5['attributes']['length']?_0x51f1a5['attributes']:_0x78604a[_0x738e('0x31')];if(_0x3950b1['query']['includeAll']){_0x51f1a5[_0x738e('0x42')]=[{'all':!![]}];}_0x51f1a5=_['merge']({},_0x51f1a5,_0x3950b1['options']);return db[_0x738e('0x41')][_0x738e('0x46')](_0x51f1a5)['then'](handleEntityNotFound(_0x2dd327,null))[_0x738e('0x27')](respondWithResult(_0x2dd327,null))[_0x738e('0x47')](handleError(_0x2dd327,null));};exports[_0x738e('0x48')]=function(_0x1a7ca1,_0x436f70){return db['JscriptyProject'][_0x738e('0x48')](_0x1a7ca1['body'],{})[_0x738e('0x27')](function(_0x38ed07){var _0x4937f2=_0x1a7ca1[_0x738e('0x49')]['get']({'plain':!![]});if(!_0x4937f2)throw new Error(_0x738e('0x4a'));if(_0x4937f2['role']===_0x738e('0x49')){var _0x4708bc=_0x38ed07['get']({'plain':!![]});var _0x4cc997=_0x738e('0x4b');return db[_0x738e('0x4c')][_0x738e('0x46')]({'where':{'name':_0x4cc997,'userProfileId':_0x4937f2[_0x738e('0x4d')]},'raw':!![]})[_0x738e('0x27')](function(_0x1c528b){if(_0x1c528b&&_0x1c528b['autoAssociation']===0x0){return db[_0x738e('0x4e')][_0x738e('0x48')]({'name':_0x4708bc['name'],'resourceId':_0x4708bc['id'],'type':_0x1c528b['name'],'sectionId':_0x1c528b['id']},{})['then'](function(){return _0x38ed07;});}else{return _0x38ed07;}})['catch'](function(_0x519657){logger[_0x738e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x519657);throw _0x519657;});}return _0x38ed07;})[_0x738e('0x27')](respondWithResult(_0x436f70,0xc9))[_0x738e('0x47')](handleError(_0x436f70,null));};exports['clone']=function(_0x30fd23,_0x36561d){var _0x17c3d5={'where':{'id':_0x30fd23[_0x738e('0x45')]['id']}},_0x51111e={};_0x51111e['model']=_['keys'](db['JscriptyProject'][_0x738e('0x2e')]);_0x17c3d5['attributes']=_[_0x738e('0x36')](_0x51111e['model'],qs['fields'](_0x30fd23[_0x738e('0x33')][_0x738e('0x38')]));_0x17c3d5[_0x738e('0x37')]=_0x17c3d5[_0x738e('0x37')]['length']?_0x17c3d5['attributes']:_0x51111e['model'];if(_0x30fd23[_0x738e('0x33')][_0x738e('0x4f')]){_0x17c3d5[_0x738e('0x42')]=[{'all':!![]}];}_0x17c3d5=_[_0x738e('0x3f')]({},_0x17c3d5,_0x30fd23[_0x738e('0x50')]);return db['JscriptyProject'][_0x738e('0x46')](_0x17c3d5)[_0x738e('0x27')](handleEntityNotFound(_0x36561d,null))[_0x738e('0x27')](function(_0x12a381){if(_0x12a381){var _0x203644=_0x12a381[_0x738e('0x51')]({'plain':!![]});_0x203644=qs[_0x738e('0x52')](_0x203644,['id',_0x738e('0x53'),_0x738e('0x54')]);_0x30fd23[_0x738e('0x55')]=_[_0x738e('0x52')](_0x30fd23[_0x738e('0x55')],['id',_0x738e('0x53'),_0x738e('0x54')]);return db[_0x738e('0x41')][_0x738e('0x48')](_['merge'](_0x203644,_0x30fd23[_0x738e('0x55')]),{'include':_0x30fd23[_0x738e('0x33')][_0x738e('0x4f')]?[{'all':!![]}]:undefined})[_0x738e('0x27')](function(_0x25d9d9){var _0xafc5bf=_0x30fd23['user'][_0x738e('0x51')]({'plain':!![]});if(!_0xafc5bf)throw new Error(_0x738e('0x4a'));if(_0xafc5bf[_0x738e('0x56')]===_0x738e('0x49')){var _0xfeeb5c=_0x25d9d9[_0x738e('0x51')]({'plain':!![]});var _0x361bb5=_0x738e('0x4b');return db[_0x738e('0x4c')][_0x738e('0x46')]({'where':{'name':_0x361bb5,'userProfileId':_0xafc5bf[_0x738e('0x4d')]},'raw':!![]})['then'](function(_0x4a4c24){if(_0x4a4c24&&_0x4a4c24[_0x738e('0x57')]===0x0){return db[_0x738e('0x4e')][_0x738e('0x48')]({'name':_0xfeeb5c['name'],'resourceId':_0xfeeb5c['id'],'type':_0x4a4c24[_0x738e('0x2b')],'sectionId':_0x4a4c24['id']},{})[_0x738e('0x27')](function(){return _0x25d9d9;});}else{return _0x25d9d9;}})[_0x738e('0x47')](function(_0x3ba754){logger[_0x738e('0x29')](_0x738e('0x58'),_0x3ba754);throw _0x3ba754;});}return _0x25d9d9;});}})['then'](respondWithResult(_0x36561d,0xc9))['catch'](handleError(_0x36561d,null));};exports[_0x738e('0x26')]=function(_0x147cb8,_0x384f2c){if(_0x147cb8[_0x738e('0x55')]['id']){delete _0x147cb8[_0x738e('0x55')]['id'];}return db[_0x738e('0x41')]['find']({'where':{'id':_0x147cb8[_0x738e('0x45')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x384f2c,null))[_0x738e('0x27')](saveUpdates(_0x147cb8[_0x738e('0x55')],null))[_0x738e('0x27')](respondWithResult(_0x384f2c,null))[_0x738e('0x47')](handleError(_0x384f2c,null));};exports[_0x738e('0x28')]=function(_0x57b170,_0x14b8d2){return db[_0x738e('0x41')][_0x738e('0x46')]({'where':{'id':_0x57b170['params']['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x14b8d2,null))[_0x738e('0x27')](removeEntity(_0x14b8d2,null))[_0x738e('0x47')](handleError(_0x14b8d2,null));};exports[_0x738e('0x59')]=function(_0x499c04,_0x3274ef,_0x32356e){var _0x257eb3={'raw':!![],'where':{}};var _0x7f5076={};var _0xbee7db={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x499c04[_0x738e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3274ef,null))[_0x738e('0x27')](function(_0x3a8dde){if(_0x3a8dde){_0x7f5076[_0x738e('0x31')]=_[_0x738e('0x34')](db['JscriptySessionReport'][_0x738e('0x2e')]);_0x7f5076[_0x738e('0x33')]=_['keys'](_0x499c04[_0x738e('0x33')]);_0x7f5076[_0x738e('0x35')]=_['intersection'](_0x7f5076[_0x738e('0x31')],_0x7f5076[_0x738e('0x33')]);_0x257eb3[_0x738e('0x37')]=_[_0x738e('0x36')](_0x7f5076[_0x738e('0x31')],qs[_0x738e('0x38')](_0x499c04[_0x738e('0x33')][_0x738e('0x38')]));_0x257eb3[_0x738e('0x37')]=_0x257eb3[_0x738e('0x37')][_0x738e('0x39')]?_0x257eb3[_0x738e('0x37')]:_0x7f5076[_0x738e('0x31')];if(!_0x499c04[_0x738e('0x33')][_0x738e('0x3a')](_0x738e('0x3b'))){_0x257eb3[_0x738e('0x21')]=qs[_0x738e('0x21')](_0x499c04[_0x738e('0x33')][_0x738e('0x21')]);_0x257eb3[_0x738e('0x1e')]=qs[_0x738e('0x1e')](_0x499c04[_0x738e('0x33')][_0x738e('0x1e')]);}_0x257eb3[_0x738e('0x5a')]=qs[_0x738e('0x3c')](_0x499c04[_0x738e('0x33')][_0x738e('0x3c')]);_0x257eb3[_0x738e('0x3d')]=qs[_0x738e('0x35')](_[_0x738e('0x5b')](_0x499c04[_0x738e('0x33')],_0x7f5076[_0x738e('0x35')]));_0x257eb3['where'][_0x738e('0x5c')]=_0x3a8dde['id'];if(_0x499c04[_0x738e('0x33')][_0x738e('0x3e')]){_0x257eb3[_0x738e('0x3d')]=_[_0x738e('0x3f')](_0x257eb3[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x257eb3[_0x738e('0x37')],function(_0x27a02f){var _0x180afd={};_0x180afd[_0x27a02f]={'$like':'%'+_0x499c04[_0x738e('0x33')][_0x738e('0x3e')]+'%'};return _0x180afd;})});}_0x257eb3=_['merge']({},_0x257eb3,_0x499c04[_0x738e('0x50')]);return db['JscriptySessionReport'][_0x738e('0x20')]({'where':_0x257eb3[_0x738e('0x3d')]})[_0x738e('0x27')](function(_0x1c572f){_0xbee7db['count']=_0x1c572f;if(_0x499c04['query'][_0x738e('0x4f')]){_0x257eb3['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x738e('0x5d')](_0x257eb3);})[_0x738e('0x27')](function(_0x5a986f){_0xbee7db['rows']=_0x5a986f;return _0xbee7db;});}})[_0x738e('0x27')](respondWithFilteredResult(_0x3274ef,_0x257eb3))[_0x738e('0x47')](handleError(_0x3274ef,null));};exports[_0x738e('0x5e')]=function(_0x512492,_0x21476e,_0x5a94bd){var _0x52222a={'raw':!![],'where':{}};var _0x497704={};var _0x4c7bfe={'count':0x0,'rows':[]};return db[_0x738e('0x41')][_0x738e('0x5f')]({'where':{'id':_0x512492[_0x738e('0x45')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x21476e,null))[_0x738e('0x27')](function(_0x3ddc36){if(_0x3ddc36){_0x497704[_0x738e('0x31')]=_['keys'](db[_0x738e('0x60')][_0x738e('0x2e')]);_0x497704[_0x738e('0x33')]=_['keys'](_0x512492[_0x738e('0x33')]);_0x497704[_0x738e('0x35')]=_[_0x738e('0x36')](_0x497704[_0x738e('0x31')],_0x497704['query']);_0x52222a[_0x738e('0x37')]=_[_0x738e('0x36')](_0x497704[_0x738e('0x31')],qs[_0x738e('0x38')](_0x512492[_0x738e('0x33')][_0x738e('0x38')]));_0x52222a[_0x738e('0x37')]=_0x52222a[_0x738e('0x37')][_0x738e('0x39')]?_0x52222a[_0x738e('0x37')]:_0x497704[_0x738e('0x31')];if(!_0x512492[_0x738e('0x33')]['hasOwnProperty'](_0x738e('0x3b'))){_0x52222a['limit']=qs[_0x738e('0x21')](_0x512492['query'][_0x738e('0x21')]);_0x52222a[_0x738e('0x1e')]=qs['offset'](_0x512492['query'][_0x738e('0x1e')]);}_0x52222a[_0x738e('0x5a')]=qs[_0x738e('0x3c')](_0x512492['query']['sort']);_0x52222a[_0x738e('0x3d')]=qs[_0x738e('0x35')](_[_0x738e('0x5b')](_0x512492[_0x738e('0x33')],_0x497704['filters']));_0x52222a[_0x738e('0x3d')][_0x738e('0x5c')]=_0x3ddc36['id'];if(_0x512492[_0x738e('0x33')][_0x738e('0x3e')]){_0x52222a['where']=_[_0x738e('0x3f')](_0x52222a[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x52222a['attributes'],function(_0x55099e){var _0x1a4c8a={};_0x1a4c8a[_0x55099e]={'$like':'%'+_0x512492['query'][_0x738e('0x3e')]+'%'};return _0x1a4c8a;})});}_0x52222a=_[_0x738e('0x3f')]({},_0x52222a,_0x512492['options']);return db['JscriptyAnswerReport'][_0x738e('0x20')]({'where':_0x52222a['where']})[_0x738e('0x27')](function(_0xb9a0f8){_0x4c7bfe[_0x738e('0x20')]=_0xb9a0f8;if(_0x512492['query'][_0x738e('0x4f')]){_0x52222a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x52222a);})[_0x738e('0x27')](function(_0x4f20c3){_0x4c7bfe['rows']=_0x4f20c3;return _0x4c7bfe;});}})[_0x738e('0x27')](respondWithFilteredResult(_0x21476e,_0x52222a))[_0x738e('0x47')](handleError(_0x21476e,null));};function char(_0x4e0cbc){return _0x738e('0x61')===typeof _0x4e0cbc?String['fromCharCode'][_0x738e('0x23')](null,arguments):_0x4e0cbc;}function needsEncapsulation(_0x318b55){return!!_0x318b55&&(_0x318b55[_0x738e('0x62')]()[_0x738e('0x63')](char(0xd))>=0x0||_0x318b55[_0x738e('0x62')]()['indexOf'](char(0xa))>=0x0||_0x318b55[_0x738e('0x62')]()[_0x738e('0x63')](char(0x2c))>=0x0||_0x318b55[_0x738e('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x40d06c){var _0x22e789=char(0x22),_0x33a843='\x5c'+char(0x22),_0x48eb41=_0x40d06c[_0x738e('0x62')]()[_0x738e('0x64')](new RegExp(_0x22e789,'g'),_0x33a843);return _0x22e789+_0x48eb41+_0x22e789;}exports['getSummary']=function(_0x4b1a47,_0x1c3609,_0x5ec459){var _0xddf6ca,_0x275afa;var _0x49fe73={'where':{'ProjectId':_0x4b1a47[_0x738e('0x45')]['id']}};if(_0x4b1a47[_0x738e('0x33')][_0x738e('0x65')]){_0x49fe73['where'][_0x738e('0x66')]=JSON[_0x738e('0x67')](_0x4b1a47[_0x738e('0x33')][_0x738e('0x65')]);}return db[_0x738e('0x68')]['findAll'](_0x49fe73)[_0x738e('0x27')](handleEntityNotFound(_0x1c3609,null))[_0x738e('0x27')](function(_0x1a9ff8){if(_0x1a9ff8){_0xddf6ca=_0x1a9ff8;return db[_0x738e('0x69')][_0x738e('0x5d')]({'where':{'SessionId':{'$in':_[_0x738e('0x32')](_0xddf6ca,'id')},'ProjectId':_0x4b1a47[_0x738e('0x45')]['id']},'order':_0x738e('0x6a')});}})[_0x738e('0x27')](handleEntityNotFound(_0x1c3609,null))[_0x738e('0x27')](function(_0x2bbf1d){if(_0x2bbf1d){_0x275afa=_0x2bbf1d;var _0x429480={};for(var _0x565d52=0x0,_0x527b7d=_0x275afa['length'];_0x565d52<_0x527b7d;_0x565d52++){if(!_0x429480[_0x738e('0x3a')](_0x275afa[_0x565d52][_0x738e('0x6b')])){_0x429480[_0x275afa[_0x565d52][_0x738e('0x6b')]]=needsEncapsulation(_0x275afa[_0x565d52][_0x738e('0x6c')])?encapsulate(_0x275afa[_0x565d52][_0x738e('0x6c')]):_0x275afa[_0x565d52][_0x738e('0x6c')];}}var _0x1dece0=[],_0x2982dc={};for(var _0x3155a2=0x0,_0x2e1797=_0xddf6ca['length'];_0x3155a2<_0x2e1797;_0x3155a2++){_0x2982dc={'ProjectId':_0x4b1a47['params']['id'],'SessionId':_0xddf6ca[_0x3155a2]['id'],'StartTime':moment(_0xddf6ca[_0x3155a2]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4e9380=0x0,_0x4cc06d=_0x275afa[_0x738e('0x39')];_0x4e9380<_0x4cc06d;_0x4e9380++){if(_0x275afa[_0x4e9380]['SessionId']==_0xddf6ca[_0x3155a2]['id']&&_0x429480[_0x738e('0x3a')](_0x275afa[_0x4e9380]['questionId'])){_0x2982dc[_0x429480[_0x275afa[_0x4e9380]['questionId']]]=_0x275afa[_0x4e9380][_0x738e('0x6d')];}}for(var _0xfd9cc in _0x429480){if(!_0x2982dc[_0x738e('0x3a')](_0x429480[_0xfd9cc])){_0x2982dc[_0x429480[_0xfd9cc]]=null;}}_0x1dece0[_0x738e('0x6e')](_0x2982dc);}return _0x1dece0;}})[_0x738e('0x27')](function(_0x3e2aee){if(!_[_0x738e('0x6f')](_0x3e2aee)){var _0x16ec4f=toCsv(_0x3e2aee);var _0x29b447=Date[_0x738e('0x70')]();fs[_0x738e('0x71')](util[_0x738e('0x72')](_0x738e('0x73'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447),_0x16ec4f);_0x1c3609[_0x738e('0x74')](_0x738e('0x75'),_0x738e('0x76')+util[_0x738e('0x72')](_0x738e('0x77'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447));_0x1c3609[_0x738e('0x74')](_0x738e('0x78'),_0x738e('0x79'));return _0x1c3609[_0x738e('0x7a')](util['format'](_0x738e('0x73'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447));}else{return _0x1c3609[_0x738e('0x1a')](0xcc);}})[_0x738e('0x47')](handleError(_0x1c3609,null));}; \ No newline at end of file +var _0x2cb0=['JscriptyProject','includeAll','include','rows','catch','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','ProjectId','filter','JscriptySessionReport','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','end','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','options'];(function(_0x37a16d,_0x5add44){var _0x30c43a=function(_0x24583f){while(--_0x24583f){_0x37a16d['push'](_0x37a16d['shift']());}};_0x30c43a(++_0x5add44);}(_0x2cb0,0x12c));var _0x02cb=function(_0x49d0f9,_0xf93ac4){_0x49d0f9=_0x49d0f9-0x0;var _0x759bd0=_0x2cb0[_0x49d0f9];return _0x759bd0;};'use strict';var emlformat=require(_0x02cb('0x0'));var rimraf=require(_0x02cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02cb('0x2'));var rp=require(_0x02cb('0x3'));var moment=require(_0x02cb('0x4'));var BPromise=require(_0x02cb('0x5'));var Mustache=require('mustache');var util=require(_0x02cb('0x6'));var path=require(_0x02cb('0x7'));var sox=require(_0x02cb('0x8'));var csv=require(_0x02cb('0x9'));var ejs=require(_0x02cb('0xa'));var fs=require('fs');var fs_extra=require(_0x02cb('0xb'));var _=require(_0x02cb('0xc'));var squel=require(_0x02cb('0xd'));var crypto=require('crypto');var jsforce=require(_0x02cb('0xe'));var deskjs=require(_0x02cb('0xf'));var toCsv=require(_0x02cb('0x9'));var querystring=require(_0x02cb('0x10'));var Papa=require(_0x02cb('0x11'));var Redis=require('ioredis');var authService=require(_0x02cb('0x12'));var qs=require(_0x02cb('0x13'));var as=require(_0x02cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02cb('0x15'))(_0x02cb('0x16'));var utils=require(_0x02cb('0x17'));var config=require(_0x02cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x02cb('0x19'))['db'];function respondWithStatusCode(_0x19b326,_0x403cc9){_0x403cc9=_0x403cc9||0xcc;return function(_0x6f43c0){if(_0x6f43c0){return _0x19b326[_0x02cb('0x1a')](_0x403cc9);}return _0x19b326[_0x02cb('0x1b')](_0x403cc9)['end']();};}function respondWithResult(_0xd0e811,_0x331583){_0x331583=_0x331583||0xc8;return function(_0x2026f6){if(_0x2026f6){return _0xd0e811['status'](_0x331583)[_0x02cb('0x1c')](_0x2026f6);}};}function respondWithFilteredResult(_0xc05f92,_0xd34d82){return function(_0x29d567){if(_0x29d567){var _0x1c88aa=typeof _0xd34d82['offset']==='undefined'&&typeof _0xd34d82[_0x02cb('0x1d')]===_0x02cb('0x1e');var _0x41ead4=_0x29d567[_0x02cb('0x1f')];var _0x547d96=_0x1c88aa?0x0:_0xd34d82[_0x02cb('0x20')];var _0x5cb9e4=_0x1c88aa?_0x29d567[_0x02cb('0x1f')]:_0xd34d82['offset']+_0xd34d82[_0x02cb('0x1d')];var _0x381e33;if(_0x5cb9e4>=_0x41ead4){_0x5cb9e4=_0x41ead4;_0x381e33=0xc8;}else{_0x381e33=0xce;}_0xc05f92[_0x02cb('0x1b')](_0x381e33);return _0xc05f92['set'](_0x02cb('0x21'),_0x547d96+'-'+_0x5cb9e4+'/'+_0x41ead4)['json'](_0x29d567);}return null;};}function patchUpdates(_0x426b1e){return function(_0x2e7666){try{jsonpatch[_0x02cb('0x22')](_0x2e7666,_0x426b1e,!![]);}catch(_0xfd9e8b){return BPromise[_0x02cb('0x23')](_0xfd9e8b);}return _0x2e7666[_0x02cb('0x24')]();};}function saveUpdates(_0x4c7bfe,_0x2c6f84){return function(_0x443ca5){if(_0x443ca5){return _0x443ca5[_0x02cb('0x25')](_0x4c7bfe)['then'](function(_0x5b5cd1){return _0x5b5cd1;});}return null;};}function removeEntity(_0x58423b,_0x4fde1c){return function(_0x286b1c){if(_0x286b1c){return _0x286b1c[_0x02cb('0x26')]()[_0x02cb('0x27')](function(){var _0x267b0f=_0x286b1c[_0x02cb('0x28')]({'plain':!![]});var _0x136e25=_0x02cb('0x29');return db[_0x02cb('0x2a')][_0x02cb('0x26')]({'where':{'type':_0x136e25,'resourceId':_0x267b0f['id']}})['then'](function(){return _0x286b1c;});})[_0x02cb('0x27')](function(){_0x58423b[_0x02cb('0x1b')](0xcc)[_0x02cb('0x2b')]();});}};}function handleEntityNotFound(_0x2dbe1d,_0x32cdcf){return function(_0x4381f2){if(!_0x4381f2){_0x2dbe1d[_0x02cb('0x1a')](0x194);}return _0x4381f2;};}function handleError(_0x186c9a,_0x2b3988){_0x2b3988=_0x2b3988||0x1f4;return function(_0x540908){logger['error'](_0x540908[_0x02cb('0x2c')]);if(_0x540908[_0x02cb('0x2d')]){delete _0x540908[_0x02cb('0x2d')];}_0x186c9a[_0x02cb('0x1b')](_0x2b3988)[_0x02cb('0x2e')](_0x540908);};}exports['index']=function(_0x42a1dc,_0x59ecb6){var _0x36fc91={},_0x5d99e5={},_0x261ab2={'count':0x0,'rows':[]};var _0x2b467c=_['map'](db['JscriptyProject'][_0x02cb('0x2f')],function(_0x4c9042){return{'name':_0x4c9042['fieldName'],'type':_0x4c9042[_0x02cb('0x30')]['key']};});_0x5d99e5[_0x02cb('0x31')]=_[_0x02cb('0x32')](_0x2b467c,_0x02cb('0x2d'));_0x5d99e5[_0x02cb('0x33')]=_[_0x02cb('0x34')](_0x42a1dc[_0x02cb('0x33')]);_0x5d99e5[_0x02cb('0x35')]=_[_0x02cb('0x36')](_0x5d99e5[_0x02cb('0x31')],_0x5d99e5[_0x02cb('0x33')]);_0x36fc91[_0x02cb('0x37')]=_[_0x02cb('0x36')](_0x5d99e5['model'],qs['fields'](_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x38')]));_0x36fc91[_0x02cb('0x37')]=_0x36fc91[_0x02cb('0x37')][_0x02cb('0x39')]?_0x36fc91[_0x02cb('0x37')]:_0x5d99e5[_0x02cb('0x31')];if(!_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x3a')](_0x02cb('0x3b'))){_0x36fc91[_0x02cb('0x1d')]=qs[_0x02cb('0x1d')](_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x1d')]);_0x36fc91[_0x02cb('0x20')]=qs['offset'](_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x20')]);}_0x36fc91[_0x02cb('0x3c')]=qs[_0x02cb('0x3d')](_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x3d')]);_0x36fc91['where']=qs['filters'](_[_0x02cb('0x3e')](_0x42a1dc[_0x02cb('0x33')],_0x5d99e5[_0x02cb('0x35')]),_0x2b467c);if(_0x42a1dc['query']['filter']){_0x36fc91[_0x02cb('0x3f')]=_['merge'](_0x36fc91[_0x02cb('0x3f')],{'$or':_[_0x02cb('0x32')](_0x2b467c,function(_0x1a8f8f){if(_0x1a8f8f[_0x02cb('0x30')]!==_0x02cb('0x40')){var _0xd56e9c={};_0xd56e9c[_0x1a8f8f[_0x02cb('0x2d')]]={'$like':'%'+_0x42a1dc[_0x02cb('0x33')]['filter']+'%'};return _0xd56e9c;}})});}_0x36fc91=_['merge']({},_0x36fc91,_0x42a1dc[_0x02cb('0x41')]);var _0x1dcfe0={'where':_0x36fc91['where']};return db[_0x02cb('0x42')][_0x02cb('0x1f')](_0x1dcfe0)[_0x02cb('0x27')](function(_0x5eb399){_0x261ab2[_0x02cb('0x1f')]=_0x5eb399;if(_0x42a1dc[_0x02cb('0x33')][_0x02cb('0x43')]){_0x36fc91[_0x02cb('0x44')]=[{'all':!![]}];}return db[_0x02cb('0x42')]['findAll'](_0x36fc91);})[_0x02cb('0x27')](function(_0x33e625){_0x261ab2[_0x02cb('0x45')]=_0x33e625;return _0x261ab2;})[_0x02cb('0x27')](respondWithFilteredResult(_0x59ecb6,_0x36fc91))[_0x02cb('0x46')](handleError(_0x59ecb6,null));};exports['show']=function(_0x4b2339,_0x43629a){var _0x579ba4={'raw':![],'where':{'id':_0x4b2339['params']['id']}},_0x1669b8={};_0x1669b8[_0x02cb('0x31')]=_[_0x02cb('0x34')](db[_0x02cb('0x42')][_0x02cb('0x2f')]);_0x1669b8[_0x02cb('0x33')]=_[_0x02cb('0x34')](_0x4b2339[_0x02cb('0x33')]);_0x1669b8['filters']=_[_0x02cb('0x36')](_0x1669b8[_0x02cb('0x31')],_0x1669b8[_0x02cb('0x33')]);_0x579ba4['attributes']=_[_0x02cb('0x36')](_0x1669b8[_0x02cb('0x31')],qs[_0x02cb('0x38')](_0x4b2339[_0x02cb('0x33')][_0x02cb('0x38')]));_0x579ba4[_0x02cb('0x37')]=_0x579ba4[_0x02cb('0x37')]['length']?_0x579ba4[_0x02cb('0x37')]:_0x1669b8[_0x02cb('0x31')];if(_0x4b2339[_0x02cb('0x33')][_0x02cb('0x43')]){_0x579ba4[_0x02cb('0x44')]=[{'all':!![]}];}_0x579ba4=_[_0x02cb('0x47')]({},_0x579ba4,_0x4b2339[_0x02cb('0x41')]);return db[_0x02cb('0x42')]['find'](_0x579ba4)[_0x02cb('0x27')](handleEntityNotFound(_0x43629a,null))[_0x02cb('0x27')](respondWithResult(_0x43629a,null))[_0x02cb('0x46')](handleError(_0x43629a,null));};exports['create']=function(_0x41927f,_0x2ada73){return db[_0x02cb('0x42')][_0x02cb('0x48')](_0x41927f[_0x02cb('0x49')],{})[_0x02cb('0x27')](function(_0x38eea4){var _0x3c5b9e=_0x41927f[_0x02cb('0x4a')][_0x02cb('0x28')]({'plain':!![]});if(!_0x3c5b9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c5b9e[_0x02cb('0x4b')]===_0x02cb('0x4a')){var _0x163571=_0x38eea4['get']({'plain':!![]});var _0x3c2899=_0x02cb('0x29');return db[_0x02cb('0x4c')][_0x02cb('0x4d')]({'where':{'name':_0x3c2899,'userProfileId':_0x3c5b9e[_0x02cb('0x4e')]},'raw':!![]})[_0x02cb('0x27')](function(_0x2ca051){if(_0x2ca051&&_0x2ca051[_0x02cb('0x4f')]===0x0){return db['UserProfileResource'][_0x02cb('0x48')]({'name':_0x163571['name'],'resourceId':_0x163571['id'],'type':_0x2ca051[_0x02cb('0x2d')],'sectionId':_0x2ca051['id']},{})[_0x02cb('0x27')](function(){return _0x38eea4;});}else{return _0x38eea4;}})[_0x02cb('0x46')](function(_0x50dcb3){logger['error'](_0x02cb('0x50'),_0x50dcb3);throw _0x50dcb3;});}return _0x38eea4;})['then'](respondWithResult(_0x2ada73,0xc9))[_0x02cb('0x46')](handleError(_0x2ada73,null));};exports[_0x02cb('0x51')]=function(_0x554583,_0x1cb565){var _0x3b77ee={'where':{'id':_0x554583[_0x02cb('0x52')]['id']}},_0x3de4ee={};_0x3de4ee[_0x02cb('0x31')]=_[_0x02cb('0x34')](db[_0x02cb('0x42')][_0x02cb('0x2f')]);_0x3b77ee[_0x02cb('0x37')]=_[_0x02cb('0x36')](_0x3de4ee['model'],qs[_0x02cb('0x38')](_0x554583[_0x02cb('0x33')][_0x02cb('0x38')]));_0x3b77ee[_0x02cb('0x37')]=_0x3b77ee[_0x02cb('0x37')][_0x02cb('0x39')]?_0x3b77ee[_0x02cb('0x37')]:_0x3de4ee['model'];if(_0x554583['query'][_0x02cb('0x43')]){_0x3b77ee[_0x02cb('0x44')]=[{'all':!![]}];}_0x3b77ee=_[_0x02cb('0x47')]({},_0x3b77ee,_0x554583[_0x02cb('0x41')]);return db[_0x02cb('0x42')][_0x02cb('0x4d')](_0x3b77ee)[_0x02cb('0x27')](handleEntityNotFound(_0x1cb565,null))[_0x02cb('0x27')](function(_0x552688){if(_0x552688){var _0x1a2cf5=_0x552688[_0x02cb('0x28')]({'plain':!![]});_0x1a2cf5=qs['omit'](_0x1a2cf5,['id',_0x02cb('0x53'),'updatedAt']);_0x554583[_0x02cb('0x49')]=_[_0x02cb('0x54')](_0x554583[_0x02cb('0x49')],['id','createdAt',_0x02cb('0x55')]);return db['JscriptyProject'][_0x02cb('0x48')](_[_0x02cb('0x47')](_0x1a2cf5,_0x554583[_0x02cb('0x49')]),{'include':_0x554583[_0x02cb('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x02cb('0x27')](function(_0xa78c83){var _0x56163a=_0x554583[_0x02cb('0x4a')]['get']({'plain':!![]});if(!_0x56163a)throw new Error(_0x02cb('0x56'));if(_0x56163a[_0x02cb('0x4b')]===_0x02cb('0x4a')){var _0x433373=_0xa78c83[_0x02cb('0x28')]({'plain':!![]});var _0x1c4dff=_0x02cb('0x29');return db['UserProfileSection'][_0x02cb('0x4d')]({'where':{'name':_0x1c4dff,'userProfileId':_0x56163a[_0x02cb('0x4e')]},'raw':!![]})[_0x02cb('0x27')](function(_0xd4cf68){if(_0xd4cf68&&_0xd4cf68[_0x02cb('0x4f')]===0x0){return db[_0x02cb('0x2a')][_0x02cb('0x48')]({'name':_0x433373['name'],'resourceId':_0x433373['id'],'type':_0xd4cf68[_0x02cb('0x2d')],'sectionId':_0xd4cf68['id']},{})['then'](function(){return _0xa78c83;});}else{return _0xa78c83;}})[_0x02cb('0x46')](function(_0x4b9d1f){logger['error'](_0x02cb('0x50'),_0x4b9d1f);throw _0x4b9d1f;});}return _0xa78c83;});}})[_0x02cb('0x27')](respondWithResult(_0x1cb565,0xc9))[_0x02cb('0x46')](handleError(_0x1cb565,null));};exports['update']=function(_0x459c0d,_0x48a588){if(_0x459c0d[_0x02cb('0x49')]['id']){delete _0x459c0d[_0x02cb('0x49')]['id'];}return db[_0x02cb('0x42')][_0x02cb('0x4d')]({'where':{'id':_0x459c0d[_0x02cb('0x52')]['id']}})['then'](handleEntityNotFound(_0x48a588,null))['then'](saveUpdates(_0x459c0d['body'],null))[_0x02cb('0x27')](respondWithResult(_0x48a588,null))['catch'](handleError(_0x48a588,null));};exports[_0x02cb('0x26')]=function(_0x3a8c9a,_0x4aa66c){return db[_0x02cb('0x42')][_0x02cb('0x4d')]({'where':{'id':_0x3a8c9a[_0x02cb('0x52')]['id']}})[_0x02cb('0x27')](handleEntityNotFound(_0x4aa66c,null))[_0x02cb('0x27')](removeEntity(_0x4aa66c,null))[_0x02cb('0x46')](handleError(_0x4aa66c,null));};exports[_0x02cb('0x57')]=function(_0x24baf4,_0x31313a,_0x4a3416){var _0xa5911f={'raw':!![],'where':{}};var _0x49eaa8={};var _0x441940={'count':0x0,'rows':[]};return db[_0x02cb('0x42')][_0x02cb('0x58')]({'where':{'id':_0x24baf4['params']['id']}})[_0x02cb('0x27')](handleEntityNotFound(_0x31313a,null))[_0x02cb('0x27')](function(_0x50d44d){if(_0x50d44d){_0x49eaa8[_0x02cb('0x31')]=_[_0x02cb('0x34')](db['JscriptySessionReport']['rawAttributes']);_0x49eaa8[_0x02cb('0x33')]=_[_0x02cb('0x34')](_0x24baf4['query']);_0x49eaa8[_0x02cb('0x35')]=_[_0x02cb('0x36')](_0x49eaa8[_0x02cb('0x31')],_0x49eaa8['query']);_0xa5911f['attributes']=_[_0x02cb('0x36')](_0x49eaa8['model'],qs[_0x02cb('0x38')](_0x24baf4['query'][_0x02cb('0x38')]));_0xa5911f[_0x02cb('0x37')]=_0xa5911f['attributes'][_0x02cb('0x39')]?_0xa5911f[_0x02cb('0x37')]:_0x49eaa8[_0x02cb('0x31')];if(!_0x24baf4[_0x02cb('0x33')][_0x02cb('0x3a')](_0x02cb('0x3b'))){_0xa5911f[_0x02cb('0x1d')]=qs[_0x02cb('0x1d')](_0x24baf4[_0x02cb('0x33')][_0x02cb('0x1d')]);_0xa5911f[_0x02cb('0x20')]=qs['offset'](_0x24baf4[_0x02cb('0x33')][_0x02cb('0x20')]);}_0xa5911f['order']=qs[_0x02cb('0x3d')](_0x24baf4[_0x02cb('0x33')][_0x02cb('0x3d')]);_0xa5911f['where']=qs[_0x02cb('0x35')](_[_0x02cb('0x3e')](_0x24baf4[_0x02cb('0x33')],_0x49eaa8[_0x02cb('0x35')]));_0xa5911f[_0x02cb('0x3f')][_0x02cb('0x59')]=_0x50d44d['id'];if(_0x24baf4[_0x02cb('0x33')][_0x02cb('0x5a')]){_0xa5911f[_0x02cb('0x3f')]=_[_0x02cb('0x47')](_0xa5911f[_0x02cb('0x3f')],{'$or':_[_0x02cb('0x32')](_0xa5911f[_0x02cb('0x37')],function(_0x1767c2){var _0x33e218={};_0x33e218[_0x1767c2]={'$like':'%'+_0x24baf4[_0x02cb('0x33')]['filter']+'%'};return _0x33e218;})});}_0xa5911f=_[_0x02cb('0x47')]({},_0xa5911f,_0x24baf4[_0x02cb('0x41')]);return db[_0x02cb('0x5b')][_0x02cb('0x1f')]({'where':_0xa5911f[_0x02cb('0x3f')]})[_0x02cb('0x27')](function(_0x5d99fb){_0x441940['count']=_0x5d99fb;if(_0x24baf4['query'][_0x02cb('0x43')]){_0xa5911f[_0x02cb('0x44')]=[{'all':!![]}];}return db[_0x02cb('0x5b')]['findAll'](_0xa5911f);})[_0x02cb('0x27')](function(_0x1209e6){_0x441940[_0x02cb('0x45')]=_0x1209e6;return _0x441940;});}})[_0x02cb('0x27')](respondWithFilteredResult(_0x31313a,_0xa5911f))[_0x02cb('0x46')](handleError(_0x31313a,null));};exports[_0x02cb('0x5c')]=function(_0x39d4ff,_0x3df1f6,_0x3bc8ac){var _0x3e5478={'raw':!![],'where':{}};var _0x432300={};var _0x566816={'count':0x0,'rows':[]};return db[_0x02cb('0x42')][_0x02cb('0x58')]({'where':{'id':_0x39d4ff[_0x02cb('0x52')]['id']}})[_0x02cb('0x27')](handleEntityNotFound(_0x3df1f6,null))[_0x02cb('0x27')](function(_0x677738){if(_0x677738){_0x432300[_0x02cb('0x31')]=_[_0x02cb('0x34')](db['JscriptyAnswerReport'][_0x02cb('0x2f')]);_0x432300[_0x02cb('0x33')]=_['keys'](_0x39d4ff['query']);_0x432300[_0x02cb('0x35')]=_['intersection'](_0x432300['model'],_0x432300[_0x02cb('0x33')]);_0x3e5478[_0x02cb('0x37')]=_[_0x02cb('0x36')](_0x432300['model'],qs[_0x02cb('0x38')](_0x39d4ff['query'][_0x02cb('0x38')]));_0x3e5478['attributes']=_0x3e5478['attributes']['length']?_0x3e5478['attributes']:_0x432300['model'];if(!_0x39d4ff['query'][_0x02cb('0x3a')](_0x02cb('0x3b'))){_0x3e5478[_0x02cb('0x1d')]=qs[_0x02cb('0x1d')](_0x39d4ff[_0x02cb('0x33')][_0x02cb('0x1d')]);_0x3e5478[_0x02cb('0x20')]=qs[_0x02cb('0x20')](_0x39d4ff['query'][_0x02cb('0x20')]);}_0x3e5478[_0x02cb('0x3c')]=qs[_0x02cb('0x3d')](_0x39d4ff[_0x02cb('0x33')][_0x02cb('0x3d')]);_0x3e5478[_0x02cb('0x3f')]=qs[_0x02cb('0x35')](_['pick'](_0x39d4ff[_0x02cb('0x33')],_0x432300[_0x02cb('0x35')]));_0x3e5478['where'][_0x02cb('0x59')]=_0x677738['id'];if(_0x39d4ff[_0x02cb('0x33')][_0x02cb('0x5a')]){_0x3e5478['where']=_[_0x02cb('0x47')](_0x3e5478['where'],{'$or':_[_0x02cb('0x32')](_0x3e5478[_0x02cb('0x37')],function(_0x576984){var _0x53b264={};_0x53b264[_0x576984]={'$like':'%'+_0x39d4ff[_0x02cb('0x33')][_0x02cb('0x5a')]+'%'};return _0x53b264;})});}_0x3e5478=_[_0x02cb('0x47')]({},_0x3e5478,_0x39d4ff[_0x02cb('0x41')]);return db[_0x02cb('0x5d')][_0x02cb('0x1f')]({'where':_0x3e5478['where']})[_0x02cb('0x27')](function(_0x56e86b){_0x566816[_0x02cb('0x1f')]=_0x56e86b;if(_0x39d4ff[_0x02cb('0x33')]['includeAll']){_0x3e5478[_0x02cb('0x44')]=[{'all':!![]}];}return db[_0x02cb('0x5d')][_0x02cb('0x5e')](_0x3e5478);})[_0x02cb('0x27')](function(_0x583d6a){_0x566816[_0x02cb('0x45')]=_0x583d6a;return _0x566816;});}})['then'](respondWithFilteredResult(_0x3df1f6,_0x3e5478))[_0x02cb('0x46')](handleError(_0x3df1f6,null));};function char(_0x42331a){return _0x02cb('0x5f')===typeof _0x42331a?String[_0x02cb('0x60')][_0x02cb('0x22')](null,arguments):_0x42331a;}function needsEncapsulation(_0x1de7f3){return!!_0x1de7f3&&(_0x1de7f3['toString']()[_0x02cb('0x61')](char(0xd))>=0x0||_0x1de7f3[_0x02cb('0x62')]()[_0x02cb('0x61')](char(0xa))>=0x0||_0x1de7f3[_0x02cb('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x1de7f3[_0x02cb('0x62')]()[_0x02cb('0x61')](char(0x22))>=0x0);}function encapsulate(_0x9b5249){var _0x49b7ea=char(0x22),_0x5ac4dd='\x5c'+char(0x22),_0x362ac9=_0x9b5249['toString']()[_0x02cb('0x63')](new RegExp(_0x49b7ea,'g'),_0x5ac4dd);return _0x49b7ea+_0x362ac9+_0x49b7ea;}exports[_0x02cb('0x64')]=function(_0x1855a8,_0x362bb8,_0x22a28f){var _0x4bd8ee,_0x25e944;var _0x26fe56={'where':{'ProjectId':_0x1855a8[_0x02cb('0x52')]['id']}};if(_0x1855a8['query'][_0x02cb('0x65')]){_0x26fe56[_0x02cb('0x3f')][_0x02cb('0x66')]=JSON[_0x02cb('0x67')](_0x1855a8[_0x02cb('0x33')][_0x02cb('0x65')]);}return db['JscriptySessionReport'][_0x02cb('0x5e')](_0x26fe56)[_0x02cb('0x27')](handleEntityNotFound(_0x362bb8,null))[_0x02cb('0x27')](function(_0x56fad2){if(_0x56fad2){_0x4bd8ee=_0x56fad2;return db[_0x02cb('0x68')][_0x02cb('0x5e')]({'where':{'SessionId':{'$in':_['map'](_0x4bd8ee,'id')},'ProjectId':_0x1855a8[_0x02cb('0x52')]['id']},'order':_0x02cb('0x69')});}})['then'](handleEntityNotFound(_0x362bb8,null))[_0x02cb('0x27')](function(_0xad3ac4){if(_0xad3ac4){_0x25e944=_0xad3ac4;var _0x3cf0a5={};for(var _0x4c6b98=0x0,_0x4de5f3=_0x25e944['length'];_0x4c6b98<_0x4de5f3;_0x4c6b98++){if(!_0x3cf0a5[_0x02cb('0x3a')](_0x25e944[_0x4c6b98][_0x02cb('0x6a')])){_0x3cf0a5[_0x25e944[_0x4c6b98][_0x02cb('0x6a')]]=needsEncapsulation(_0x25e944[_0x4c6b98][_0x02cb('0x6b')])?encapsulate(_0x25e944[_0x4c6b98]['question']):_0x25e944[_0x4c6b98][_0x02cb('0x6b')];}}var _0xcccb1f=[],_0x14ace3={};for(var _0x19dadf=0x0,_0x138b95=_0x4bd8ee[_0x02cb('0x39')];_0x19dadf<_0x138b95;_0x19dadf++){_0x14ace3={'ProjectId':_0x1855a8[_0x02cb('0x52')]['id'],'SessionId':_0x4bd8ee[_0x19dadf]['id'],'StartTime':moment(_0x4bd8ee[_0x19dadf]['starttime'])[_0x02cb('0x6c')](_0x02cb('0x6d'))};for(var _0x5d94d3=0x0,_0x547402=_0x25e944[_0x02cb('0x39')];_0x5d94d3<_0x547402;_0x5d94d3++){if(_0x25e944[_0x5d94d3][_0x02cb('0x6e')]==_0x4bd8ee[_0x19dadf]['id']&&_0x3cf0a5[_0x02cb('0x3a')](_0x25e944[_0x5d94d3]['questionId'])){_0x14ace3[_0x3cf0a5[_0x25e944[_0x5d94d3]['questionId']]]=_0x25e944[_0x5d94d3][_0x02cb('0x6f')];}}for(var _0x38849c in _0x3cf0a5){if(!_0x14ace3[_0x02cb('0x3a')](_0x3cf0a5[_0x38849c])){_0x14ace3[_0x3cf0a5[_0x38849c]]=null;}}_0xcccb1f['push'](_0x14ace3);}return _0xcccb1f;}})['then'](function(_0x2c41aa){if(!_['isEmpty'](_0x2c41aa)){var _0x516ae6=toCsv(_0x2c41aa);var _0x4164e4=Date[_0x02cb('0x70')]();fs[_0x02cb('0x71')](util[_0x02cb('0x6c')](_0x02cb('0x72'),_0x1855a8[_0x02cb('0x52')]['id'],_0x4164e4),_0x516ae6);_0x362bb8[_0x02cb('0x73')](_0x02cb('0x74'),_0x02cb('0x75')+util['format'](_0x02cb('0x76'),_0x1855a8['params']['id'],_0x4164e4));_0x362bb8[_0x02cb('0x73')](_0x02cb('0x77'),_0x02cb('0x78'));return _0x362bb8[_0x02cb('0x79')](util['format'](_0x02cb('0x72'),_0x1855a8[_0x02cb('0x52')]['id'],_0x4164e4));}else{return _0x362bb8['sendStatus'](0xcc);}})['catch'](handleError(_0x362bb8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index fc38f56..d7ac412 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 _0xa2c8=['exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4078af,_0x4e6fb2){var _0x346a6c=function(_0x51aa02){while(--_0x51aa02){_0x4078af['push'](_0x4078af['shift']());}};_0x346a6c(++_0x4e6fb2);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var logger=require(_0x8a2c('0x2'))(_0x8a2c('0x3'));var moment=require(_0x8a2c('0x4'));var BPromise=require(_0x8a2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x8a2c('0x7')]=function(_0x40fb26,_0x3f754a){return _0x40fb26[_0x8a2c('0x8')]('JscriptyProject',attributes,{'tableName':_0x8a2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea89=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x291ec3,_0x2eb1a9){var _0x37a5d4=function(_0x152477){while(--_0x152477){_0x291ec3['push'](_0x291ec3['shift']());}};_0x37a5d4(++_0x2eb1a9);}(_0xea89,0x1e2));var _0x9ea8=function(_0x3e10b0,_0x4544e3){_0x3e10b0=_0x3e10b0-0x0;var _0x14b94d=_0xea89[_0x3e10b0];return _0x14b94d;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('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 5482474..028c254 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x37c471,_0x5a2f41){var _0x27feb5=function(_0x2e534d){while(--_0x2e534d){_0x37c471['push'](_0x37c471['shift']());}};_0x27feb5(++_0x5a2f41);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _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(_0x105b06,_0x3638cf){var _0x135c7b=function(_0x4a7536){while(--_0x4a7536){_0x105b06['push'](_0x105b06['shift']());}};_0x135c7b(++_0x3638cf);}(_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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 986dcab..e4f41ec 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 _0xf119=['Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','post','create','update','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x121d5c,_0x1fe2c4){var _0x2b817a=function(_0x57a8a3){while(--_0x57a8a3){_0x121d5c['push'](_0x121d5c['shift']());}};_0x2b817a(++_0x1fe2c4);}(_0xf119,0x1ab));var _0x9f11=function(_0x3656ea,_0x38108b){_0x3656ea=_0x3656ea-0x0;var _0x6d3e9b=_0xf119[_0x3656ea];return _0x6d3e9b;};'use strict';var multer=require(_0x9f11('0x0'));var util=require(_0x9f11('0x1'));var path=require(_0x9f11('0x2'));var timeout=require(_0x9f11('0x3'));var express=require(_0x9f11('0x4'));var router=express[_0x9f11('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9f11('0x6'));var interaction=require(_0x9f11('0x7'));var config=require('../../config/environment');var controller=require(_0x9f11('0x8'));router[_0x9f11('0x9')]('/',auth[_0x9f11('0xa')](),controller[_0x9f11('0xb')]);router['get']('/describe',auth[_0x9f11('0xa')](),controller[_0x9f11('0xc')]);router[_0x9f11('0x9')]('/:id',auth[_0x9f11('0xa')](),controller['show']);router[_0x9f11('0xd')]('/',auth[_0x9f11('0xa')](),controller[_0x9f11('0xe')]);router['put']('/:id',auth[_0x9f11('0xa')](),controller[_0x9f11('0xf')]);router['delete'](_0x9f11('0x10'),auth[_0x9f11('0xa')](),controller[_0x9f11('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd74c=['put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','describe','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd74c,0x116));var _0xcd74=function(_0x3e1947,_0x50ea34){_0x3e1947=_0x3e1947-0x0;var _0x67dc17=_0xd74c[_0x3e1947];return _0x67dc17;};'use strict';var multer=require(_0xcd74('0x0'));var util=require('util');var path=require(_0xcd74('0x1'));var timeout=require(_0xcd74('0x2'));var express=require(_0xcd74('0x3'));var router=express[_0xcd74('0x4')]();var fs_extra=require(_0xcd74('0x5'));var auth=require(_0xcd74('0x6'));var interaction=require(_0xcd74('0x7'));var config=require(_0xcd74('0x8'));var controller=require(_0xcd74('0x9'));router['get']('/',auth[_0xcd74('0xa')](),controller[_0xcd74('0xb')]);router[_0xcd74('0xc')]('/describe',auth[_0xcd74('0xa')](),controller[_0xcd74('0xd')]);router[_0xcd74('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcd74('0xe')]);router['post']('/',auth[_0xcd74('0xa')](),controller[_0xcd74('0xf')]);router[_0xcd74('0x10')](_0xcd74('0x11'),auth[_0xcd74('0xa')](),controller['update']);router[_0xcd74('0x12')]('/:id',auth[_0xcd74('0xa')](),controller[_0xcd74('0x13')]);module[_0xcd74('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 45cd8f6..e2e0af5 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x3ddb60,_0x415bae){_0x3ddb60=_0x3ddb60-0x0;var _0x4a0149=_0x7a54[_0x3ddb60];return _0x4a0149;};'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(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x500d42,_0x39bc76){_0x500d42=_0x500d42-0x0;var _0x3d161f=_0x7a54[_0x500d42];return _0x3d161f;};'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 174bc13..1da6298 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 _0xd432=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','JscriptyQuestionReport','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1599a5,_0x1cede4){var _0x580593=function(_0x26c0f8){while(--_0x26c0f8){_0x1599a5['push'](_0x1599a5['shift']());}};_0x580593(++_0x1cede4);}(_0xd432,0x15c));var _0x2d43=function(_0x3f3240,_0x5990ca){_0x3f3240=_0x3f3240-0x0;var _0x5eaf2d=_0xd432[_0x3f3240];return _0x5eaf2d;};'use strict';var emlformat=require(_0x2d43('0x0'));var rimraf=require(_0x2d43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d43('0x2'));var rp=require(_0x2d43('0x3'));var moment=require(_0x2d43('0x4'));var BPromise=require(_0x2d43('0x5'));var Mustache=require(_0x2d43('0x6'));var util=require(_0x2d43('0x7'));var path=require(_0x2d43('0x8'));var sox=require(_0x2d43('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d43('0xa'));var squel=require(_0x2d43('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d43('0xc'));var deskjs=require(_0x2d43('0xd'));var toCsv=require(_0x2d43('0xe'));var querystring=require(_0x2d43('0xf'));var Papa=require(_0x2d43('0x10'));var Redis=require(_0x2d43('0x11'));var authService=require(_0x2d43('0x12'));var qs=require(_0x2d43('0x13'));var as=require(_0x2d43('0x14'));var hardwareService=require(_0x2d43('0x15'));var logger=require(_0x2d43('0x16'))('api');var utils=require(_0x2d43('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d43('0x18'));var db=require(_0x2d43('0x19'))['db'];function respondWithStatusCode(_0x24ebe8,_0x5b7420){_0x5b7420=_0x5b7420||0xcc;return function(_0xeda33e){if(_0xeda33e){return _0x24ebe8[_0x2d43('0x1a')](_0x5b7420);}return _0x24ebe8[_0x2d43('0x1b')](_0x5b7420)['end']();};}function respondWithResult(_0xea5d9,_0x2845ef){_0x2845ef=_0x2845ef||0xc8;return function(_0x111862){if(_0x111862){return _0xea5d9[_0x2d43('0x1b')](_0x2845ef)[_0x2d43('0x1c')](_0x111862);}};}function respondWithFilteredResult(_0x58b06b,_0x1d2cae){return function(_0x40ff52){if(_0x40ff52){var _0x597182=typeof _0x1d2cae[_0x2d43('0x1d')]===_0x2d43('0x1e')&&typeof _0x1d2cae[_0x2d43('0x1f')]===_0x2d43('0x1e');var _0x150d90=_0x40ff52[_0x2d43('0x20')];var _0x44a45b=_0x597182?0x0:_0x1d2cae[_0x2d43('0x1d')];var _0x280b49=_0x597182?_0x40ff52[_0x2d43('0x20')]:_0x1d2cae[_0x2d43('0x1d')]+_0x1d2cae['limit'];var _0x1abcf1;if(_0x280b49>=_0x150d90){_0x280b49=_0x150d90;_0x1abcf1=0xc8;}else{_0x1abcf1=0xce;}_0x58b06b[_0x2d43('0x1b')](_0x1abcf1);return _0x58b06b[_0x2d43('0x21')](_0x2d43('0x22'),_0x44a45b+'-'+_0x280b49+'/'+_0x150d90)[_0x2d43('0x1c')](_0x40ff52);}return null;};}function patchUpdates(_0x2ce40f){return function(_0x3e5d1f){try{jsonpatch[_0x2d43('0x23')](_0x3e5d1f,_0x2ce40f,!![]);}catch(_0x53f81a){return BPromise['reject'](_0x53f81a);}return _0x3e5d1f[_0x2d43('0x24')]();};}function saveUpdates(_0x366fea,_0x5e10e9){return function(_0x226c3a){if(_0x226c3a){return _0x226c3a[_0x2d43('0x25')](_0x366fea)['then'](function(_0x5def1e){return _0x5def1e;});}return null;};}function removeEntity(_0x315a19,_0x513b17){return function(_0x21061e){if(_0x21061e){return _0x21061e['destroy']()[_0x2d43('0x26')](function(){_0x315a19[_0x2d43('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd45ac,_0x257c3a){return function(_0x1308b8){if(!_0x1308b8){_0xfd45ac[_0x2d43('0x1a')](0x194);}return _0x1308b8;};}function handleError(_0x5e7881,_0x29eb6f){_0x29eb6f=_0x29eb6f||0x1f4;return function(_0x3b4731){logger[_0x2d43('0x27')](_0x3b4731[_0x2d43('0x28')]);if(_0x3b4731[_0x2d43('0x29')]){delete _0x3b4731[_0x2d43('0x29')];}_0x5e7881[_0x2d43('0x1b')](_0x29eb6f)[_0x2d43('0x2a')](_0x3b4731);};}exports[_0x2d43('0x2b')]=function(_0x84ff60,_0x445b97){var _0x98467={},_0x299d3e={},_0x41b6fa={'count':0x0,'rows':[]};var _0x2be134=_[_0x2d43('0x2c')](db['JscriptyQuestionReport'][_0x2d43('0x2d')],function(_0x2b6f76){return{'name':_0x2b6f76[_0x2d43('0x2e')],'type':_0x2b6f76[_0x2d43('0x2f')][_0x2d43('0x30')]};});_0x299d3e[_0x2d43('0x31')]=_['map'](_0x2be134,_0x2d43('0x29'));_0x299d3e[_0x2d43('0x32')]=_[_0x2d43('0x33')](_0x84ff60[_0x2d43('0x32')]);_0x299d3e[_0x2d43('0x34')]=_[_0x2d43('0x35')](_0x299d3e[_0x2d43('0x31')],_0x299d3e[_0x2d43('0x32')]);_0x98467[_0x2d43('0x36')]=_[_0x2d43('0x35')](_0x299d3e[_0x2d43('0x31')],qs[_0x2d43('0x37')](_0x84ff60[_0x2d43('0x32')][_0x2d43('0x37')]));_0x98467[_0x2d43('0x36')]=_0x98467[_0x2d43('0x36')][_0x2d43('0x38')]?_0x98467[_0x2d43('0x36')]:_0x299d3e[_0x2d43('0x31')];if(!_0x84ff60[_0x2d43('0x32')][_0x2d43('0x39')](_0x2d43('0x3a'))){_0x98467[_0x2d43('0x1f')]=qs[_0x2d43('0x1f')](_0x84ff60[_0x2d43('0x32')][_0x2d43('0x1f')]);_0x98467['offset']=qs['offset'](_0x84ff60[_0x2d43('0x32')]['offset']);}_0x98467[_0x2d43('0x3b')]=qs[_0x2d43('0x3c')](_0x84ff60['query'][_0x2d43('0x3c')]);_0x98467[_0x2d43('0x3d')]=qs[_0x2d43('0x34')](_[_0x2d43('0x3e')](_0x84ff60[_0x2d43('0x32')],_0x299d3e[_0x2d43('0x34')]),_0x2be134);if(_0x84ff60['query']['filter']){_0x98467[_0x2d43('0x3d')]=_[_0x2d43('0x3f')](_0x98467[_0x2d43('0x3d')],{'$or':_[_0x2d43('0x2c')](_0x2be134,function(_0x1bd232){if(_0x1bd232[_0x2d43('0x2f')]!==_0x2d43('0x40')){var _0x5eafd9={};_0x5eafd9[_0x1bd232['name']]={'$like':'%'+_0x84ff60[_0x2d43('0x32')][_0x2d43('0x41')]+'%'};return _0x5eafd9;}})});}_0x98467=_[_0x2d43('0x3f')]({},_0x98467,_0x84ff60[_0x2d43('0x42')]);var _0x25709d={'where':_0x98467[_0x2d43('0x3d')]};return db['JscriptyQuestionReport'][_0x2d43('0x20')](_0x25709d)[_0x2d43('0x26')](function(_0x5a6c64){_0x41b6fa['count']=_0x5a6c64;if(_0x84ff60[_0x2d43('0x32')][_0x2d43('0x43')]){_0x98467[_0x2d43('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2d43('0x45')](_0x98467);})['then'](function(_0x1cadc0){_0x41b6fa[_0x2d43('0x46')]=_0x1cadc0;return _0x41b6fa;})['then'](respondWithFilteredResult(_0x445b97,_0x98467))[_0x2d43('0x47')](handleError(_0x445b97,null));};exports[_0x2d43('0x48')]=function(_0x4c098e,_0x470287){var _0x1e6b80={'raw':!![],'where':{'id':_0x4c098e[_0x2d43('0x49')]['id']}},_0x32fbff={};_0x32fbff[_0x2d43('0x31')]=_[_0x2d43('0x33')](db[_0x2d43('0x4a')]['rawAttributes']);_0x32fbff[_0x2d43('0x32')]=_[_0x2d43('0x33')](_0x4c098e[_0x2d43('0x32')]);_0x32fbff[_0x2d43('0x34')]=_[_0x2d43('0x35')](_0x32fbff[_0x2d43('0x31')],_0x32fbff[_0x2d43('0x32')]);_0x1e6b80[_0x2d43('0x36')]=_[_0x2d43('0x35')](_0x32fbff[_0x2d43('0x31')],qs[_0x2d43('0x37')](_0x4c098e['query'][_0x2d43('0x37')]));_0x1e6b80[_0x2d43('0x36')]=_0x1e6b80[_0x2d43('0x36')][_0x2d43('0x38')]?_0x1e6b80[_0x2d43('0x36')]:_0x32fbff[_0x2d43('0x31')];if(_0x4c098e['query'][_0x2d43('0x43')]){_0x1e6b80[_0x2d43('0x44')]=[{'all':!![]}];}_0x1e6b80=_[_0x2d43('0x3f')]({},_0x1e6b80,_0x4c098e['options']);return db[_0x2d43('0x4a')][_0x2d43('0x4b')](_0x1e6b80)[_0x2d43('0x26')](handleEntityNotFound(_0x470287,null))[_0x2d43('0x26')](respondWithResult(_0x470287,null))[_0x2d43('0x47')](handleError(_0x470287,null));};exports[_0x2d43('0x4c')]=function(_0x4ff5ac,_0x14c1b3){return db[_0x2d43('0x4a')][_0x2d43('0x4c')](_0x4ff5ac[_0x2d43('0x4d')],{})['then'](respondWithResult(_0x14c1b3,0xc9))[_0x2d43('0x47')](handleError(_0x14c1b3,null));};exports[_0x2d43('0x25')]=function(_0x3c6a72,_0x53b99b){if(_0x3c6a72[_0x2d43('0x4d')]['id']){delete _0x3c6a72[_0x2d43('0x4d')]['id'];}return db[_0x2d43('0x4a')][_0x2d43('0x4b')]({'where':{'id':_0x3c6a72[_0x2d43('0x49')]['id']}})[_0x2d43('0x26')](handleEntityNotFound(_0x53b99b,null))['then'](saveUpdates(_0x3c6a72['body'],null))[_0x2d43('0x26')](respondWithResult(_0x53b99b,null))[_0x2d43('0x47')](handleError(_0x53b99b,null));};exports[_0x2d43('0x4e')]=function(_0x289fae,_0x5cefd0){return db[_0x2d43('0x4a')][_0x2d43('0x4b')]({'where':{'id':_0x289fae[_0x2d43('0x49')]['id']}})[_0x2d43('0x26')](handleEntityNotFound(_0x5cefd0,null))[_0x2d43('0x26')](removeEntity(_0x5cefd0,null))[_0x2d43('0x47')](handleError(_0x5cefd0,null));};exports[_0x2d43('0x4f')]=function(_0x5649e4,_0x3a573c){return db['JscriptyQuestionReport'][_0x2d43('0x4f')]()['then'](respondWithResult(_0x3a573c,null))['catch'](handleError(_0x3a573c,null));}; \ No newline at end of file +var _0x93fa=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','catch','show','keys','includeAll','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','intersection'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x93fa,0xad));var _0xa93f=function(_0x5ce268,_0x1835b6){_0x5ce268=_0x5ce268-0x0;var _0x28c96a=_0x93fa[_0x5ce268];return _0x28c96a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa93f('0x0'));var zipdir=require(_0xa93f('0x1'));var jsonpatch=require(_0xa93f('0x2'));var rp=require(_0xa93f('0x3'));var moment=require(_0xa93f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa93f('0x5'));var util=require('util');var path=require(_0xa93f('0x6'));var sox=require(_0xa93f('0x7'));var csv=require(_0xa93f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa93f('0x9'));var _=require(_0xa93f('0xa'));var squel=require('squel');var crypto=require(_0xa93f('0xb'));var jsforce=require(_0xa93f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa93f('0x8'));var querystring=require(_0xa93f('0xd'));var Papa=require(_0xa93f('0xe'));var Redis=require(_0xa93f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa93f('0x10'));var as=require(_0xa93f('0x11'));var hardwareService=require(_0xa93f('0x12'));var logger=require(_0xa93f('0x13'))(_0xa93f('0x14'));var utils=require(_0xa93f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa93f('0x16'));var db=require(_0xa93f('0x17'))['db'];function respondWithStatusCode(_0x54f9a3,_0x509d95){_0x509d95=_0x509d95||0xcc;return function(_0x5206f1){if(_0x5206f1){return _0x54f9a3[_0xa93f('0x18')](_0x509d95);}return _0x54f9a3[_0xa93f('0x19')](_0x509d95)['end']();};}function respondWithResult(_0xf1b77b,_0x333cab){_0x333cab=_0x333cab||0xc8;return function(_0x1c43e9){if(_0x1c43e9){return _0xf1b77b[_0xa93f('0x19')](_0x333cab)['json'](_0x1c43e9);}};}function respondWithFilteredResult(_0x258a1c,_0x31ee4e){return function(_0x47ae34){if(_0x47ae34){var _0x30f45d=typeof _0x31ee4e['offset']===_0xa93f('0x1a')&&typeof _0x31ee4e[_0xa93f('0x1b')]===_0xa93f('0x1a');var _0x26241e=_0x47ae34['count'];var _0x1379da=_0x30f45d?0x0:_0x31ee4e[_0xa93f('0x1c')];var _0x4b7506=_0x30f45d?_0x47ae34[_0xa93f('0x1d')]:_0x31ee4e['offset']+_0x31ee4e[_0xa93f('0x1b')];var _0x1377c1;if(_0x4b7506>=_0x26241e){_0x4b7506=_0x26241e;_0x1377c1=0xc8;}else{_0x1377c1=0xce;}_0x258a1c[_0xa93f('0x19')](_0x1377c1);return _0x258a1c[_0xa93f('0x1e')](_0xa93f('0x1f'),_0x1379da+'-'+_0x4b7506+'/'+_0x26241e)[_0xa93f('0x20')](_0x47ae34);}return null;};}function patchUpdates(_0x334eb5){return function(_0x42666f){try{jsonpatch[_0xa93f('0x21')](_0x42666f,_0x334eb5,!![]);}catch(_0x3bc332){return BPromise[_0xa93f('0x22')](_0x3bc332);}return _0x42666f[_0xa93f('0x23')]();};}function saveUpdates(_0x546c3d,_0x3342f4){return function(_0x17f403){if(_0x17f403){return _0x17f403['update'](_0x546c3d)['then'](function(_0x2e2ef9){return _0x2e2ef9;});}return null;};}function removeEntity(_0x55fedb,_0x12bfed){return function(_0x4e3ff7){if(_0x4e3ff7){return _0x4e3ff7[_0xa93f('0x24')]()[_0xa93f('0x25')](function(){_0x55fedb[_0xa93f('0x19')](0xcc)[_0xa93f('0x26')]();});}};}function handleEntityNotFound(_0x1750f9,_0xfbaf62){return function(_0x48b9fa){if(!_0x48b9fa){_0x1750f9[_0xa93f('0x18')](0x194);}return _0x48b9fa;};}function handleError(_0x2726f9,_0x2c4eff){_0x2c4eff=_0x2c4eff||0x1f4;return function(_0x3b062d){logger[_0xa93f('0x27')](_0x3b062d[_0xa93f('0x28')]);if(_0x3b062d['name']){delete _0x3b062d[_0xa93f('0x29')];}_0x2726f9[_0xa93f('0x19')](_0x2c4eff)[_0xa93f('0x2a')](_0x3b062d);};}exports[_0xa93f('0x2b')]=function(_0x3676df,_0x19e4f8){var _0x163c48={},_0x42fccc={},_0x5f0b1d={'count':0x0,'rows':[]};var _0x52b21a=_[_0xa93f('0x2c')](db[_0xa93f('0x2d')][_0xa93f('0x2e')],function(_0x3fa9a4){return{'name':_0x3fa9a4[_0xa93f('0x2f')],'type':_0x3fa9a4[_0xa93f('0x30')][_0xa93f('0x31')]};});_0x42fccc['model']=_[_0xa93f('0x2c')](_0x52b21a,'name');_0x42fccc['query']=_['keys'](_0x3676df[_0xa93f('0x32')]);_0x42fccc['filters']=_[_0xa93f('0x33')](_0x42fccc[_0xa93f('0x34')],_0x42fccc['query']);_0x163c48[_0xa93f('0x35')]=_['intersection'](_0x42fccc[_0xa93f('0x34')],qs[_0xa93f('0x36')](_0x3676df[_0xa93f('0x32')][_0xa93f('0x36')]));_0x163c48[_0xa93f('0x35')]=_0x163c48[_0xa93f('0x35')][_0xa93f('0x37')]?_0x163c48[_0xa93f('0x35')]:_0x42fccc[_0xa93f('0x34')];if(!_0x3676df[_0xa93f('0x32')][_0xa93f('0x38')](_0xa93f('0x39'))){_0x163c48[_0xa93f('0x1b')]=qs['limit'](_0x3676df[_0xa93f('0x32')]['limit']);_0x163c48[_0xa93f('0x1c')]=qs[_0xa93f('0x1c')](_0x3676df[_0xa93f('0x32')][_0xa93f('0x1c')]);}_0x163c48[_0xa93f('0x3a')]=qs[_0xa93f('0x3b')](_0x3676df[_0xa93f('0x32')]['sort']);_0x163c48[_0xa93f('0x3c')]=qs[_0xa93f('0x3d')](_[_0xa93f('0x3e')](_0x3676df['query'],_0x42fccc['filters']),_0x52b21a);if(_0x3676df[_0xa93f('0x32')][_0xa93f('0x3f')]){_0x163c48[_0xa93f('0x3c')]=_[_0xa93f('0x40')](_0x163c48[_0xa93f('0x3c')],{'$or':_[_0xa93f('0x2c')](_0x52b21a,function(_0x5c4d49){if(_0x5c4d49[_0xa93f('0x30')]!=='VIRTUAL'){var _0x49e372={};_0x49e372[_0x5c4d49[_0xa93f('0x29')]]={'$like':'%'+_0x3676df[_0xa93f('0x32')][_0xa93f('0x3f')]+'%'};return _0x49e372;}})});}_0x163c48=_[_0xa93f('0x40')]({},_0x163c48,_0x3676df[_0xa93f('0x41')]);var _0x4f4c8c={'where':_0x163c48['where']};return db[_0xa93f('0x2d')]['count'](_0x4f4c8c)['then'](function(_0x580fb9){_0x5f0b1d[_0xa93f('0x1d')]=_0x580fb9;if(_0x3676df[_0xa93f('0x32')]['includeAll']){_0x163c48[_0xa93f('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x163c48);})[_0xa93f('0x25')](function(_0x249873){_0x5f0b1d['rows']=_0x249873;return _0x5f0b1d;})[_0xa93f('0x25')](respondWithFilteredResult(_0x19e4f8,_0x163c48))[_0xa93f('0x43')](handleError(_0x19e4f8,null));};exports[_0xa93f('0x44')]=function(_0x13519a,_0x15ebd0){var _0x1f4f5b={'raw':!![],'where':{'id':_0x13519a['params']['id']}},_0x5a810c={};_0x5a810c[_0xa93f('0x34')]=_[_0xa93f('0x45')](db[_0xa93f('0x2d')]['rawAttributes']);_0x5a810c['query']=_[_0xa93f('0x45')](_0x13519a['query']);_0x5a810c[_0xa93f('0x3d')]=_[_0xa93f('0x33')](_0x5a810c[_0xa93f('0x34')],_0x5a810c['query']);_0x1f4f5b['attributes']=_[_0xa93f('0x33')](_0x5a810c['model'],qs['fields'](_0x13519a['query'][_0xa93f('0x36')]));_0x1f4f5b[_0xa93f('0x35')]=_0x1f4f5b[_0xa93f('0x35')][_0xa93f('0x37')]?_0x1f4f5b[_0xa93f('0x35')]:_0x5a810c[_0xa93f('0x34')];if(_0x13519a[_0xa93f('0x32')][_0xa93f('0x46')]){_0x1f4f5b[_0xa93f('0x42')]=[{'all':!![]}];}_0x1f4f5b=_[_0xa93f('0x40')]({},_0x1f4f5b,_0x13519a[_0xa93f('0x41')]);return db[_0xa93f('0x2d')][_0xa93f('0x47')](_0x1f4f5b)[_0xa93f('0x25')](handleEntityNotFound(_0x15ebd0,null))[_0xa93f('0x25')](respondWithResult(_0x15ebd0,null))[_0xa93f('0x43')](handleError(_0x15ebd0,null));};exports['create']=function(_0x4f358f,_0x1fe318){return db[_0xa93f('0x2d')]['create'](_0x4f358f[_0xa93f('0x48')],{})[_0xa93f('0x25')](respondWithResult(_0x1fe318,0xc9))[_0xa93f('0x43')](handleError(_0x1fe318,null));};exports['update']=function(_0x23430d,_0x4b49da){if(_0x23430d[_0xa93f('0x48')]['id']){delete _0x23430d[_0xa93f('0x48')]['id'];}return db[_0xa93f('0x2d')]['find']({'where':{'id':_0x23430d[_0xa93f('0x49')]['id']}})[_0xa93f('0x25')](handleEntityNotFound(_0x4b49da,null))[_0xa93f('0x25')](saveUpdates(_0x23430d[_0xa93f('0x48')],null))['then'](respondWithResult(_0x4b49da,null))[_0xa93f('0x43')](handleError(_0x4b49da,null));};exports[_0xa93f('0x24')]=function(_0x275b44,_0x222eca){return db[_0xa93f('0x2d')][_0xa93f('0x47')]({'where':{'id':_0x275b44[_0xa93f('0x49')]['id']}})['then'](handleEntityNotFound(_0x222eca,null))[_0xa93f('0x25')](removeEntity(_0x222eca,null))[_0xa93f('0x43')](handleError(_0x222eca,null));};exports['describe']=function(_0x28ae09,_0x35718d){return db['JscriptyQuestionReport'][_0xa93f('0x4a')]()['then'](respondWithResult(_0x35718d,null))['catch'](handleError(_0x35718d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2f43387..265822a 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 _0xefdb=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xefdb,0x1a6));var _0xbefd=function(_0x39d812,_0x13406a){_0x39d812=_0x39d812-0x0;var _0x366d02=_0xefdb[_0x39d812];return _0x366d02;};'use strict';var _=require('lodash');var util=require(_0xbefd('0x0'));var logger=require(_0xbefd('0x1'))(_0xbefd('0x2'));var moment=require(_0xbefd('0x3'));var BPromise=require(_0xbefd('0x4'));var rp=require(_0xbefd('0x5'));var fs=require('fs');var path=require(_0xbefd('0x6'));var rimraf=require('rimraf');var config=require(_0xbefd('0x7'));var attributes=require(_0xbefd('0x8'));module[_0xbefd('0x9')]=function(_0x565358,_0x2155e2){return _0x565358[_0xbefd('0xa')](_0xbefd('0xb'),attributes,{'tableName':_0xbefd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ad6=['define','JscriptyQuestionReport','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x1ad6,0x199));var _0x61ad=function(_0x57d546,_0x5e1f6f){_0x57d546=_0x57d546-0x0;var _0xf3ce3b=_0x1ad6[_0x57d546];return _0xf3ce3b;};'use strict';var _=require(_0x61ad('0x0'));var util=require('util');var logger=require(_0x61ad('0x1'))(_0x61ad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61ad('0x3'));var fs=require('fs');var path=require(_0x61ad('0x4'));var rimraf=require(_0x61ad('0x5'));var config=require(_0x61ad('0x6'));var attributes=require(_0x61ad('0x7'));module[_0x61ad('0x8')]=function(_0xcad1d5,_0x5433f0){return _0xcad1d5[_0x61ad('0x9')](_0x61ad('0xa'),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 5f9ed11..83616f0 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 _0x9d8a=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4e996a,_0x381f6d){var _0x30b0e6=function(_0x2c5e44){while(--_0x2c5e44){_0x4e996a['push'](_0x4e996a['shift']());}};_0x30b0e6(++_0x381f6d);}(_0x9d8a,0x1af));var _0xa9d8=function(_0x43bcf0,_0xa554dd){_0x43bcf0=_0x43bcf0-0x0;var _0x2f2a69=_0x9d8a[_0x43bcf0];return _0x2f2a69;};'use strict';var _=require(_0xa9d8('0x0'));var util=require(_0xa9d8('0x1'));var moment=require('moment');var BPromise=require(_0xa9d8('0x2'));var rs=require(_0xa9d8('0x3'));var fs=require('fs');var Redis=require(_0xa9d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9d8('0x5'));var logger=require(_0xa9d8('0x6'))(_0xa9d8('0x7'));var config=require(_0xa9d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa9d8('0x9')][_0xa9d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29bc27,_0x1bef0b,_0xc927){return new BPromise(function(_0x3bf62a,_0x3a1f78){return client['request'](_0x29bc27,_0xc927)[_0xa9d8('0xb')](function(_0x440e43){logger[_0xa9d8('0xc')](_0xa9d8('0xd'),_0x1bef0b,'request\x20sent');logger[_0xa9d8('0xe')](_0xa9d8('0xf'),_0x1bef0b,_0xa9d8('0x10'),JSON[_0xa9d8('0x11')](_0x440e43));if(_0x440e43[_0xa9d8('0x12')]){if(_0x440e43['error'][_0xa9d8('0x13')]===0x1f4){logger[_0xa9d8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);return _0x3a1f78(_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);}logger['error'](_0xa9d8('0xd'),_0x1bef0b,_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);return _0x3bf62a(_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);}else{logger[_0xa9d8('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0xa9d8('0x10'));_0x3bf62a(_0x440e43['result'][_0xa9d8('0x14')]);}})['catch'](function(_0x5a2690){logger[_0xa9d8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0x5a2690);_0x3a1f78(_0x5a2690);});});} \ No newline at end of file +var _0x86b8=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x86b8,0x1e9));var _0x886b=function(_0x4b2e58,_0x3a7bf2){_0x4b2e58=_0x4b2e58-0x0;var _0x4e3510=_0x86b8[_0x4b2e58];return _0x4e3510;};'use strict';var _=require('lodash');var util=require(_0x886b('0x0'));var moment=require(_0x886b('0x1'));var BPromise=require(_0x886b('0x2'));var rs=require(_0x886b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x886b('0x4'));var logger=require('../../config/logger')(_0x886b('0x5'));var config=require(_0x886b('0x6'));var jayson=require(_0x886b('0x7'));var client=jayson[_0x886b('0x8')][_0x886b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fe570,_0x13f433,_0x118d90){return new BPromise(function(_0x59f580,_0x1f9c29){return client[_0x886b('0xa')](_0x4fe570,_0x118d90)[_0x886b('0xb')](function(_0x5aceca){logger[_0x886b('0xc')](_0x886b('0xd'),_0x13f433,_0x886b('0xe'));logger[_0x886b('0xf')](_0x886b('0x10'),_0x13f433,_0x886b('0xe'),JSON[_0x886b('0x11')](_0x5aceca));if(_0x5aceca[_0x886b('0x12')]){if(_0x5aceca[_0x886b('0x12')]['code']===0x1f4){logger[_0x886b('0x12')](_0x886b('0xd'),_0x13f433,_0x5aceca[_0x886b('0x12')]['message']);return _0x1f9c29(_0x5aceca['error']['message']);}logger[_0x886b('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x13f433,_0x5aceca[_0x886b('0x12')][_0x886b('0x13')]);return _0x59f580(_0x5aceca[_0x886b('0x12')][_0x886b('0x13')]);}else{logger[_0x886b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x13f433,_0x886b('0xe'));_0x59f580(_0x5aceca[_0x886b('0x14')]['message']);}})['catch'](function(_0x2eb684){logger[_0x886b('0x12')](_0x886b('0xd'),_0x13f433,_0x2eb684);_0x1f9c29(_0x2eb684);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2b8ae58..6b0ad2a 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 _0x5372=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5372,0x16a));var _0x2537=function(_0x3e2fee,_0x1a8be3){_0x3e2fee=_0x3e2fee-0x0;var _0x170717=_0x5372[_0x3e2fee];return _0x170717;};'use strict';var multer=require(_0x2537('0x0'));var util=require('util');var path=require(_0x2537('0x1'));var timeout=require(_0x2537('0x2'));var express=require(_0x2537('0x3'));var router=express[_0x2537('0x4')]();var fs_extra=require(_0x2537('0x5'));var auth=require(_0x2537('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2537('0x7'));var controller=require(_0x2537('0x8'));router[_0x2537('0x9')]('/',auth[_0x2537('0xa')](),controller[_0x2537('0xb')]);router[_0x2537('0x9')](_0x2537('0xc'),auth[_0x2537('0xa')](),controller[_0x2537('0xd')]);router['get'](_0x2537('0xe'),auth[_0x2537('0xa')](),controller[_0x2537('0xf')]);router['get'](_0x2537('0x10'),auth[_0x2537('0xa')](),controller[_0x2537('0x11')]);router[_0x2537('0x12')]('/',auth[_0x2537('0xa')](),controller['create']);router[_0x2537('0x13')](_0x2537('0xe'),auth[_0x2537('0xa')](),controller[_0x2537('0x14')]);router[_0x2537('0x15')]('/:id',auth[_0x2537('0xa')](),controller[_0x2537('0x16')]);module[_0x2537('0x17')]=router; \ No newline at end of file +var _0x83c8=['isAuthenticated','show','/:id/questions','getQuestions','post','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','./jscriptySessionReport.controller','get','/describe','describe'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x83c8,0x19b));var _0x883c=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x83c8[_0x314a8c];return _0x1d4607;};'use strict';var multer=require('multer');var util=require(_0x883c('0x0'));var path=require('path');var timeout=require(_0x883c('0x1'));var express=require(_0x883c('0x2'));var router=express[_0x883c('0x3')]();var fs_extra=require(_0x883c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x883c('0x5'));router[_0x883c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x883c('0x6')](_0x883c('0x7'),auth['isAuthenticated'](),controller[_0x883c('0x8')]);router['get']('/:id',auth[_0x883c('0x9')](),controller[_0x883c('0xa')]);router['get'](_0x883c('0xb'),auth['isAuthenticated'](),controller[_0x883c('0xc')]);router[_0x883c('0xd')]('/',auth['isAuthenticated'](),controller[_0x883c('0xe')]);router[_0x883c('0xf')]('/:id',auth[_0x883c('0x9')](),controller[_0x883c('0x10')]);router[_0x883c('0x11')](_0x883c('0x12'),auth[_0x883c('0x9')](),controller[_0x883c('0x13')]);module[_0x883c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 99a93dc..2614351 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 _0xe201=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe201,0x1f1));var _0x1e20=function(_0xd13cad,_0xea397a){_0xd13cad=_0xd13cad-0x0;var _0xc744f2=_0xe201[_0xd13cad];return _0xc744f2;};'use strict';var moment=require(_0x1e20('0x0'));var Sequelize=require(_0x1e20('0x1'));module[_0x1e20('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5c76d1){this[_0x1e20('0x3')](_0x1e20('0x4'),_0x5c76d1);this[_0x1e20('0x3')](_0x1e20('0x5'),moment()[_0x1e20('0x6')](_0x1e20('0x7')));}},'endtime':{'type':Sequelize[_0x1e20('0x8')]},'membername':{'type':Sequelize[_0x1e20('0x9')]},'projectname':{'type':Sequelize[_0x1e20('0x9')]},'queue':{'type':Sequelize[_0x1e20('0x9')]},'uniqueid':{'type':Sequelize[_0x1e20('0x9')]},'calleridname':{'type':Sequelize[_0x1e20('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1e20('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xdda2=['DATE','STRING','moment','exports','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x49b649,_0x2fc9b4){var _0x16b8a3=function(_0x307330){while(--_0x307330){_0x49b649['push'](_0x49b649['shift']());}};_0x16b8a3(++_0x2fc9b4);}(_0xdda2,0x122));var _0x2dda=function(_0x2d93d9,_0x377d13){_0x2d93d9=_0x2d93d9-0x0;var _0x419ed8=_0xdda2[_0x2d93d9];return _0x419ed8;};'use strict';var moment=require(_0x2dda('0x0'));var Sequelize=require('sequelize');module[_0x2dda('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x14df1c){this[_0x2dda('0x2')](_0x2dda('0x3'),_0x14df1c);this['setDataValue']('endtime',moment()[_0x2dda('0x4')](_0x2dda('0x5')));}},'endtime':{'type':Sequelize[_0x2dda('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2dda('0x7')]},'uniqueid':{'type':Sequelize[_0x2dda('0x7')]},'calleridname':{'type':Sequelize[_0x2dda('0x7')]},'calleridnum':{'type':Sequelize[_0x2dda('0x7')]},'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 93f20c3..84f0b49 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 _0x0c5d=['save','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','JscriptySessionReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','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','undefined','count','limit','apply','reject'];(function(_0x3d4b2f,_0x3f28c3){var _0x3cd8c4=function(_0x2204f8){while(--_0x2204f8){_0x3d4b2f['push'](_0x3d4b2f['shift']());}};_0x3cd8c4(++_0x3f28c3);}(_0x0c5d,0x109));var _0xd0c5=function(_0x11617c,_0x20bf0c){_0x11617c=_0x11617c-0x0;var _0x459588=_0x0c5d[_0x11617c];return _0x459588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0c5('0x0'));var zipdir=require(_0xd0c5('0x1'));var jsonpatch=require(_0xd0c5('0x2'));var rp=require('request-promise');var moment=require(_0xd0c5('0x3'));var BPromise=require(_0xd0c5('0x4'));var Mustache=require(_0xd0c5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0c5('0x6'));var fs=require('fs');var fs_extra=require(_0xd0c5('0x7'));var _=require(_0xd0c5('0x8'));var squel=require(_0xd0c5('0x9'));var crypto=require(_0xd0c5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xb'));var Papa=require(_0xd0c5('0xc'));var Redis=require(_0xd0c5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0c5('0xe'));var as=require(_0xd0c5('0xf'));var hardwareService=require(_0xd0c5('0x10'));var logger=require('../../config/logger')(_0xd0c5('0x11'));var utils=require(_0xd0c5('0x12'));var config=require(_0xd0c5('0x13'));var licenseUtil=require(_0xd0c5('0x14'));var db=require(_0xd0c5('0x15'))['db'];function respondWithStatusCode(_0x2df571,_0x562c03){_0x562c03=_0x562c03||0xcc;return function(_0xa5caf3){if(_0xa5caf3){return _0x2df571[_0xd0c5('0x16')](_0x562c03);}return _0x2df571[_0xd0c5('0x17')](_0x562c03)[_0xd0c5('0x18')]();};}function respondWithResult(_0x439310,_0x4f3e87){_0x4f3e87=_0x4f3e87||0xc8;return function(_0x198edc){if(_0x198edc){return _0x439310['status'](_0x4f3e87)['json'](_0x198edc);}};}function respondWithFilteredResult(_0x40c300,_0x2fd39d){return function(_0x5c7df0){if(_0x5c7df0){var _0x1f3a21=typeof _0x2fd39d[_0xd0c5('0x19')]==='undefined'&&typeof _0x2fd39d['limit']===_0xd0c5('0x1a');var _0xf483d0=_0x5c7df0[_0xd0c5('0x1b')];var _0x193e94=_0x1f3a21?0x0:_0x2fd39d['offset'];var _0x37ac8a=_0x1f3a21?_0x5c7df0['count']:_0x2fd39d[_0xd0c5('0x19')]+_0x2fd39d[_0xd0c5('0x1c')];var _0x380602;if(_0x37ac8a>=_0xf483d0){_0x37ac8a=_0xf483d0;_0x380602=0xc8;}else{_0x380602=0xce;}_0x40c300[_0xd0c5('0x17')](_0x380602);return _0x40c300['set']('Content-Range',_0x193e94+'-'+_0x37ac8a+'/'+_0xf483d0)['json'](_0x5c7df0);}return null;};}function patchUpdates(_0x968686){return function(_0xcb523e){try{jsonpatch[_0xd0c5('0x1d')](_0xcb523e,_0x968686,!![]);}catch(_0x3c8615){return BPromise[_0xd0c5('0x1e')](_0x3c8615);}return _0xcb523e[_0xd0c5('0x1f')]();};}function saveUpdates(_0xf0090b,_0x19c650){return function(_0x358094){if(_0x358094){return _0x358094['update'](_0xf0090b)[_0xd0c5('0x20')](function(_0x5887ce){return _0x5887ce;});}return null;};}function removeEntity(_0x7a3309,_0x10f710){return function(_0x43fbac){if(_0x43fbac){return _0x43fbac[_0xd0c5('0x21')]()[_0xd0c5('0x20')](function(){_0x7a3309[_0xd0c5('0x17')](0xcc)[_0xd0c5('0x18')]();});}};}function handleEntityNotFound(_0x2313ba,_0x353006){return function(_0x49adad){if(!_0x49adad){_0x2313ba[_0xd0c5('0x16')](0x194);}return _0x49adad;};}function handleError(_0x378ed9,_0x5223bb){_0x5223bb=_0x5223bb||0x1f4;return function(_0x73d08b){logger[_0xd0c5('0x22')](_0x73d08b[_0xd0c5('0x23')]);if(_0x73d08b['name']){delete _0x73d08b['name'];}_0x378ed9['status'](_0x5223bb)[_0xd0c5('0x24')](_0x73d08b);};}exports[_0xd0c5('0x25')]=function(_0x87828f,_0x5bf017){var _0x5918fc={},_0x365a32={},_0x5db2f4={'count':0x0,'rows':[]};var _0x593534=_[_0xd0c5('0x26')](db['JscriptySessionReport'][_0xd0c5('0x27')],function(_0x5dabbb){return{'name':_0x5dabbb[_0xd0c5('0x28')],'type':_0x5dabbb[_0xd0c5('0x29')]['key']};});_0x365a32[_0xd0c5('0x2a')]=_[_0xd0c5('0x26')](_0x593534,'name');_0x365a32[_0xd0c5('0x2b')]=_[_0xd0c5('0x2c')](_0x87828f['query']);_0x365a32[_0xd0c5('0x2d')]=_[_0xd0c5('0x2e')](_0x365a32[_0xd0c5('0x2a')],_0x365a32['query']);_0x5918fc['attributes']=_[_0xd0c5('0x2e')](_0x365a32[_0xd0c5('0x2a')],qs[_0xd0c5('0x2f')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x5918fc['attributes']=_0x5918fc[_0xd0c5('0x30')]['length']?_0x5918fc['attributes']:_0x365a32[_0xd0c5('0x2a')];if(!_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x31')](_0xd0c5('0x32'))){_0x5918fc[_0xd0c5('0x1c')]=qs[_0xd0c5('0x1c')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x1c')]);_0x5918fc[_0xd0c5('0x19')]=qs[_0xd0c5('0x19')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x19')]);}_0x5918fc[_0xd0c5('0x33')]=qs[_0xd0c5('0x34')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x34')]);_0x5918fc[_0xd0c5('0x35')]=qs['filters'](_['pick'](_0x87828f[_0xd0c5('0x2b')],_0x365a32['filters']),_0x593534);if(_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x36')]){_0x5918fc['where']=_['merge'](_0x5918fc[_0xd0c5('0x35')],{'$or':_['map'](_0x593534,function(_0xf82048){if(_0xf82048[_0xd0c5('0x29')]!=='VIRTUAL'){var _0x24aae4={};_0x24aae4[_0xf82048['name']]={'$like':'%'+_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x36')]+'%'};return _0x24aae4;}})});}_0x5918fc=_[_0xd0c5('0x37')]({},_0x5918fc,_0x87828f['options']);var _0x26831f={'where':_0x5918fc[_0xd0c5('0x35')]};return db[_0xd0c5('0x38')][_0xd0c5('0x1b')](_0x26831f)[_0xd0c5('0x20')](function(_0x220e32){_0x5db2f4[_0xd0c5('0x1b')]=_0x220e32;if(_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x5918fc[_0xd0c5('0x3a')]=[{'all':!![]}];}return db[_0xd0c5('0x38')][_0xd0c5('0x3b')](_0x5918fc);})[_0xd0c5('0x20')](function(_0x429b5e){_0x5db2f4[_0xd0c5('0x3c')]=_0x429b5e;return _0x5db2f4;})[_0xd0c5('0x20')](respondWithFilteredResult(_0x5bf017,_0x5918fc))['catch'](handleError(_0x5bf017,null));};exports[_0xd0c5('0x3d')]=function(_0x30eaaa,_0x463141){var _0x2b21d7={'raw':!![],'where':{'id':_0x30eaaa[_0xd0c5('0x3e')]['id']}},_0x1724db={};_0x1724db[_0xd0c5('0x2a')]=_[_0xd0c5('0x2c')](db[_0xd0c5('0x38')][_0xd0c5('0x27')]);_0x1724db['query']=_['keys'](_0x30eaaa[_0xd0c5('0x2b')]);_0x1724db[_0xd0c5('0x2d')]=_[_0xd0c5('0x2e')](_0x1724db[_0xd0c5('0x2a')],_0x1724db['query']);_0x2b21d7[_0xd0c5('0x30')]=_[_0xd0c5('0x2e')](_0x1724db[_0xd0c5('0x2a')],qs['fields'](_0x30eaaa[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x2b21d7['attributes']=_0x2b21d7['attributes'][_0xd0c5('0x3f')]?_0x2b21d7[_0xd0c5('0x30')]:_0x1724db[_0xd0c5('0x2a')];if(_0x30eaaa[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x2b21d7['include']=[{'all':!![]}];}_0x2b21d7=_[_0xd0c5('0x37')]({},_0x2b21d7,_0x30eaaa['options']);return db[_0xd0c5('0x38')][_0xd0c5('0x40')](_0x2b21d7)[_0xd0c5('0x20')](handleEntityNotFound(_0x463141,null))[_0xd0c5('0x20')](respondWithResult(_0x463141,null))[_0xd0c5('0x41')](handleError(_0x463141,null));};exports['create']=function(_0x3a5883,_0x4d8e90){return db[_0xd0c5('0x38')][_0xd0c5('0x42')](_0x3a5883[_0xd0c5('0x43')],{})[_0xd0c5('0x20')](respondWithResult(_0x4d8e90,0xc9))[_0xd0c5('0x41')](handleError(_0x4d8e90,null));};exports['update']=function(_0x10225f,_0x38994c){if(_0x10225f[_0xd0c5('0x43')]['id']){delete _0x10225f['body']['id'];}return db[_0xd0c5('0x38')][_0xd0c5('0x40')]({'where':{'id':_0x10225f[_0xd0c5('0x3e')]['id']}})[_0xd0c5('0x20')](handleEntityNotFound(_0x38994c,null))['then'](saveUpdates(_0x10225f[_0xd0c5('0x43')],null))[_0xd0c5('0x20')](respondWithResult(_0x38994c,null))[_0xd0c5('0x41')](handleError(_0x38994c,null));};exports[_0xd0c5('0x21')]=function(_0x3acbd5,_0x217e4f){return db[_0xd0c5('0x38')][_0xd0c5('0x40')]({'where':{'id':_0x3acbd5['params']['id']}})[_0xd0c5('0x20')](handleEntityNotFound(_0x217e4f,null))['then'](removeEntity(_0x217e4f,null))[_0xd0c5('0x41')](handleError(_0x217e4f,null));};exports[_0xd0c5('0x44')]=function(_0x5a07f8,_0x4d2221){return db[_0xd0c5('0x38')][_0xd0c5('0x44')]()[_0xd0c5('0x20')](respondWithResult(_0x4d2221,null))[_0xd0c5('0x41')](handleError(_0x4d2221,null));};exports[_0xd0c5('0x45')]=function(_0x137a4d,_0x5dcf96,_0x21f550){var _0x3f1bb7={'raw':!![],'where':{}};var _0x2ecee2={};var _0x45ccee={'count':0x0,'rows':[]};return db[_0xd0c5('0x38')][_0xd0c5('0x46')]({'where':{'id':_0x137a4d[_0xd0c5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5dcf96,null))['then'](function(_0x3c6036){if(_0x3c6036){_0x2ecee2[_0xd0c5('0x2a')]=_['keys'](db[_0xd0c5('0x47')]['rawAttributes']);_0x2ecee2[_0xd0c5('0x2b')]=_['keys'](_0x137a4d[_0xd0c5('0x2b')]);_0x2ecee2[_0xd0c5('0x2d')]=_['intersection'](_0x2ecee2[_0xd0c5('0x2a')],_0x2ecee2[_0xd0c5('0x2b')]);_0x3f1bb7[_0xd0c5('0x30')]=_[_0xd0c5('0x2e')](_0x2ecee2[_0xd0c5('0x2a')],qs[_0xd0c5('0x2f')](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x3f1bb7[_0xd0c5('0x30')]=_0x3f1bb7[_0xd0c5('0x30')][_0xd0c5('0x3f')]?_0x3f1bb7[_0xd0c5('0x30')]:_0x2ecee2[_0xd0c5('0x2a')];if(!_0x137a4d[_0xd0c5('0x2b')]['hasOwnProperty']('nolimit')){_0x3f1bb7['limit']=qs[_0xd0c5('0x1c')](_0x137a4d['query'][_0xd0c5('0x1c')]);_0x3f1bb7[_0xd0c5('0x19')]=qs['offset'](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x19')]);}_0x3f1bb7[_0xd0c5('0x33')]=qs[_0xd0c5('0x34')](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x34')]);_0x3f1bb7[_0xd0c5('0x35')]=qs['filters'](_[_0xd0c5('0x48')](_0x137a4d[_0xd0c5('0x2b')],_0x2ecee2['filters']));_0x3f1bb7[_0xd0c5('0x35')][_0xd0c5('0x49')]=_0x3c6036['id'];if(_0x137a4d[_0xd0c5('0x2b')]['filter']){_0x3f1bb7[_0xd0c5('0x35')]=_['merge'](_0x3f1bb7[_0xd0c5('0x35')],{'$or':_[_0xd0c5('0x26')](_0x3f1bb7[_0xd0c5('0x30')],function(_0x4b5885){var _0x525ea4={};_0x525ea4[_0x4b5885]={'$like':'%'+_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x36')]+'%'};return _0x525ea4;})});}_0x3f1bb7=_[_0xd0c5('0x37')]({},_0x3f1bb7,_0x137a4d['options']);return db['JscriptyQuestionReport'][_0xd0c5('0x1b')]({'where':_0x3f1bb7[_0xd0c5('0x35')]})['then'](function(_0x3370ad){_0x45ccee[_0xd0c5('0x1b')]=_0x3370ad;if(_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x3f1bb7[_0xd0c5('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd0c5('0x3b')](_0x3f1bb7);})[_0xd0c5('0x20')](function(_0x371aaa){_0x45ccee['rows']=_0x371aaa;return _0x45ccee;});}})[_0xd0c5('0x20')](respondWithFilteredResult(_0x5dcf96,_0x3f1bb7))[_0xd0c5('0x41')](handleError(_0x5dcf96,null));}; \ No newline at end of file +var _0x6982=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','create','body','catch','find','params','describe','getQuestions','JscriptyQuestionReport','nolimit','order','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x45b25a,_0x37fbc7){var _0x36e942=function(_0x15d6ad){while(--_0x15d6ad){_0x45b25a['push'](_0x45b25a['shift']());}};_0x36e942(++_0x37fbc7);}(_0x6982,0x1d8));var _0x2698=function(_0x4239c2,_0x4f2925){_0x4239c2=_0x4239c2-0x0;var _0x437a83=_0x6982[_0x4239c2];return _0x437a83;};'use strict';var emlformat=require(_0x2698('0x0'));var rimraf=require(_0x2698('0x1'));var zipdir=require(_0x2698('0x2'));var jsonpatch=require(_0x2698('0x3'));var rp=require(_0x2698('0x4'));var moment=require(_0x2698('0x5'));var BPromise=require(_0x2698('0x6'));var Mustache=require(_0x2698('0x7'));var util=require('util');var path=require(_0x2698('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2698('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2698('0xa'));var squel=require(_0x2698('0xb'));var crypto=require(_0x2698('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2698('0xd'));var toCsv=require(_0x2698('0xe'));var querystring=require(_0x2698('0xf'));var Papa=require(_0x2698('0x10'));var Redis=require(_0x2698('0x11'));var authService=require(_0x2698('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2698('0x13'));var hardwareService=require(_0x2698('0x14'));var logger=require(_0x2698('0x15'))(_0x2698('0x16'));var utils=require('../../config/utils');var config=require(_0x2698('0x17'));var licenseUtil=require(_0x2698('0x18'));var db=require(_0x2698('0x19'))['db'];function respondWithStatusCode(_0x39fa0b,_0x2936c4){_0x2936c4=_0x2936c4||0xcc;return function(_0x7e9ee6){if(_0x7e9ee6){return _0x39fa0b['sendStatus'](_0x2936c4);}return _0x39fa0b[_0x2698('0x1a')](_0x2936c4)[_0x2698('0x1b')]();};}function respondWithResult(_0x50d6c0,_0xfd1db1){_0xfd1db1=_0xfd1db1||0xc8;return function(_0x114528){if(_0x114528){return _0x50d6c0['status'](_0xfd1db1)[_0x2698('0x1c')](_0x114528);}};}function respondWithFilteredResult(_0x569d5f,_0x168e54){return function(_0x185315){if(_0x185315){var _0x509d86=typeof _0x168e54['offset']===_0x2698('0x1d')&&typeof _0x168e54[_0x2698('0x1e')]==='undefined';var _0x14588c=_0x185315[_0x2698('0x1f')];var _0x3ac902=_0x509d86?0x0:_0x168e54['offset'];var _0xa0972c=_0x509d86?_0x185315[_0x2698('0x1f')]:_0x168e54[_0x2698('0x20')]+_0x168e54[_0x2698('0x1e')];var _0x1dab33;if(_0xa0972c>=_0x14588c){_0xa0972c=_0x14588c;_0x1dab33=0xc8;}else{_0x1dab33=0xce;}_0x569d5f['status'](_0x1dab33);return _0x569d5f[_0x2698('0x21')](_0x2698('0x22'),_0x3ac902+'-'+_0xa0972c+'/'+_0x14588c)[_0x2698('0x1c')](_0x185315);}return null;};}function patchUpdates(_0x3ea3ec){return function(_0x5de797){try{jsonpatch[_0x2698('0x23')](_0x5de797,_0x3ea3ec,!![]);}catch(_0x2730c9){return BPromise[_0x2698('0x24')](_0x2730c9);}return _0x5de797['save']();};}function saveUpdates(_0x11cee5,_0x512f4d){return function(_0x4da097){if(_0x4da097){return _0x4da097[_0x2698('0x25')](_0x11cee5)[_0x2698('0x26')](function(_0x33d2ab){return _0x33d2ab;});}return null;};}function removeEntity(_0x3cd49a,_0x351aac){return function(_0x14348b){if(_0x14348b){return _0x14348b[_0x2698('0x27')]()[_0x2698('0x26')](function(){_0x3cd49a[_0x2698('0x1a')](0xcc)[_0x2698('0x1b')]();});}};}function handleEntityNotFound(_0xc987f0,_0x196666){return function(_0x4d11dc){if(!_0x4d11dc){_0xc987f0[_0x2698('0x28')](0x194);}return _0x4d11dc;};}function handleError(_0x787799,_0x111db7){_0x111db7=_0x111db7||0x1f4;return function(_0x35479e){logger[_0x2698('0x29')](_0x35479e[_0x2698('0x2a')]);if(_0x35479e[_0x2698('0x2b')]){delete _0x35479e[_0x2698('0x2b')];}_0x787799[_0x2698('0x1a')](_0x111db7)[_0x2698('0x2c')](_0x35479e);};}exports[_0x2698('0x2d')]=function(_0x52785a,_0x2e2c76){var _0x1f760c={},_0x146919={},_0x1af1ae={'count':0x0,'rows':[]};var _0x1bf227=_['map'](db[_0x2698('0x2e')][_0x2698('0x2f')],function(_0x20e431){return{'name':_0x20e431[_0x2698('0x30')],'type':_0x20e431[_0x2698('0x31')][_0x2698('0x32')]};});_0x146919[_0x2698('0x33')]=_[_0x2698('0x34')](_0x1bf227,_0x2698('0x2b'));_0x146919['query']=_[_0x2698('0x35')](_0x52785a[_0x2698('0x36')]);_0x146919[_0x2698('0x37')]=_[_0x2698('0x38')](_0x146919[_0x2698('0x33')],_0x146919[_0x2698('0x36')]);_0x1f760c[_0x2698('0x39')]=_[_0x2698('0x38')](_0x146919[_0x2698('0x33')],qs[_0x2698('0x3a')](_0x52785a['query'][_0x2698('0x3a')]));_0x1f760c[_0x2698('0x39')]=_0x1f760c['attributes'][_0x2698('0x3b')]?_0x1f760c['attributes']:_0x146919[_0x2698('0x33')];if(!_0x52785a['query'][_0x2698('0x3c')]('nolimit')){_0x1f760c[_0x2698('0x1e')]=qs['limit'](_0x52785a[_0x2698('0x36')]['limit']);_0x1f760c['offset']=qs[_0x2698('0x20')](_0x52785a[_0x2698('0x36')]['offset']);}_0x1f760c['order']=qs[_0x2698('0x3d')](_0x52785a[_0x2698('0x36')]['sort']);_0x1f760c[_0x2698('0x3e')]=qs['filters'](_[_0x2698('0x3f')](_0x52785a[_0x2698('0x36')],_0x146919['filters']),_0x1bf227);if(_0x52785a[_0x2698('0x36')][_0x2698('0x40')]){_0x1f760c['where']=_[_0x2698('0x41')](_0x1f760c[_0x2698('0x3e')],{'$or':_[_0x2698('0x34')](_0x1bf227,function(_0x41ec5f){if(_0x41ec5f[_0x2698('0x31')]!==_0x2698('0x42')){var _0x7df802={};_0x7df802[_0x41ec5f[_0x2698('0x2b')]]={'$like':'%'+_0x52785a[_0x2698('0x36')][_0x2698('0x40')]+'%'};return _0x7df802;}})});}_0x1f760c=_[_0x2698('0x41')]({},_0x1f760c,_0x52785a[_0x2698('0x43')]);var _0x2d0805={'where':_0x1f760c[_0x2698('0x3e')]};return db[_0x2698('0x2e')]['count'](_0x2d0805)[_0x2698('0x26')](function(_0x302536){_0x1af1ae[_0x2698('0x1f')]=_0x302536;if(_0x52785a[_0x2698('0x36')][_0x2698('0x44')]){_0x1f760c[_0x2698('0x45')]=[{'all':!![]}];}return db[_0x2698('0x2e')]['findAll'](_0x1f760c);})[_0x2698('0x26')](function(_0x11f92a){_0x1af1ae['rows']=_0x11f92a;return _0x1af1ae;})[_0x2698('0x26')](respondWithFilteredResult(_0x2e2c76,_0x1f760c))['catch'](handleError(_0x2e2c76,null));};exports[_0x2698('0x46')]=function(_0x16201e,_0x598ac3){var _0x144013={'raw':!![],'where':{'id':_0x16201e['params']['id']}},_0x3849a0={};_0x3849a0['model']=_[_0x2698('0x35')](db[_0x2698('0x2e')][_0x2698('0x2f')]);_0x3849a0['query']=_[_0x2698('0x35')](_0x16201e[_0x2698('0x36')]);_0x3849a0[_0x2698('0x37')]=_[_0x2698('0x38')](_0x3849a0[_0x2698('0x33')],_0x3849a0['query']);_0x144013[_0x2698('0x39')]=_['intersection'](_0x3849a0['model'],qs['fields'](_0x16201e[_0x2698('0x36')][_0x2698('0x3a')]));_0x144013['attributes']=_0x144013[_0x2698('0x39')][_0x2698('0x3b')]?_0x144013[_0x2698('0x39')]:_0x3849a0[_0x2698('0x33')];if(_0x16201e[_0x2698('0x36')][_0x2698('0x44')]){_0x144013[_0x2698('0x45')]=[{'all':!![]}];}_0x144013=_[_0x2698('0x41')]({},_0x144013,_0x16201e['options']);return db[_0x2698('0x2e')]['find'](_0x144013)[_0x2698('0x26')](handleEntityNotFound(_0x598ac3,null))[_0x2698('0x26')](respondWithResult(_0x598ac3,null))['catch'](handleError(_0x598ac3,null));};exports[_0x2698('0x47')]=function(_0x4062f7,_0x3ac21b){return db['JscriptySessionReport'][_0x2698('0x47')](_0x4062f7[_0x2698('0x48')],{})[_0x2698('0x26')](respondWithResult(_0x3ac21b,0xc9))[_0x2698('0x49')](handleError(_0x3ac21b,null));};exports[_0x2698('0x25')]=function(_0x3b1be2,_0x35091c){if(_0x3b1be2[_0x2698('0x48')]['id']){delete _0x3b1be2[_0x2698('0x48')]['id'];}return db['JscriptySessionReport'][_0x2698('0x4a')]({'where':{'id':_0x3b1be2[_0x2698('0x4b')]['id']}})['then'](handleEntityNotFound(_0x35091c,null))[_0x2698('0x26')](saveUpdates(_0x3b1be2[_0x2698('0x48')],null))[_0x2698('0x26')](respondWithResult(_0x35091c,null))[_0x2698('0x49')](handleError(_0x35091c,null));};exports[_0x2698('0x27')]=function(_0x5d6ca0,_0x1788b4){return db[_0x2698('0x2e')][_0x2698('0x4a')]({'where':{'id':_0x5d6ca0[_0x2698('0x4b')]['id']}})[_0x2698('0x26')](handleEntityNotFound(_0x1788b4,null))[_0x2698('0x26')](removeEntity(_0x1788b4,null))[_0x2698('0x49')](handleError(_0x1788b4,null));};exports[_0x2698('0x4c')]=function(_0x2114c1,_0x828771){return db['JscriptySessionReport'][_0x2698('0x4c')]()[_0x2698('0x26')](respondWithResult(_0x828771,null))['catch'](handleError(_0x828771,null));};exports[_0x2698('0x4d')]=function(_0x75cfa6,_0x4bb74e,_0x4f0ca7){var _0x1487fd={'raw':!![],'where':{}};var _0x11795b={};var _0x240767={'count':0x0,'rows':[]};return db[_0x2698('0x2e')]['findOne']({'where':{'id':_0x75cfa6['params']['id']}})[_0x2698('0x26')](handleEntityNotFound(_0x4bb74e,null))[_0x2698('0x26')](function(_0x463859){if(_0x463859){_0x11795b[_0x2698('0x33')]=_[_0x2698('0x35')](db[_0x2698('0x4e')][_0x2698('0x2f')]);_0x11795b[_0x2698('0x36')]=_[_0x2698('0x35')](_0x75cfa6[_0x2698('0x36')]);_0x11795b[_0x2698('0x37')]=_[_0x2698('0x38')](_0x11795b[_0x2698('0x33')],_0x11795b['query']);_0x1487fd['attributes']=_[_0x2698('0x38')](_0x11795b[_0x2698('0x33')],qs['fields'](_0x75cfa6[_0x2698('0x36')]['fields']));_0x1487fd[_0x2698('0x39')]=_0x1487fd['attributes'][_0x2698('0x3b')]?_0x1487fd[_0x2698('0x39')]:_0x11795b['model'];if(!_0x75cfa6[_0x2698('0x36')][_0x2698('0x3c')](_0x2698('0x4f'))){_0x1487fd[_0x2698('0x1e')]=qs['limit'](_0x75cfa6[_0x2698('0x36')][_0x2698('0x1e')]);_0x1487fd[_0x2698('0x20')]=qs[_0x2698('0x20')](_0x75cfa6['query'][_0x2698('0x20')]);}_0x1487fd[_0x2698('0x50')]=qs[_0x2698('0x3d')](_0x75cfa6[_0x2698('0x36')][_0x2698('0x3d')]);_0x1487fd['where']=qs[_0x2698('0x37')](_[_0x2698('0x3f')](_0x75cfa6[_0x2698('0x36')],_0x11795b[_0x2698('0x37')]));_0x1487fd[_0x2698('0x3e')]['SessionId']=_0x463859['id'];if(_0x75cfa6[_0x2698('0x36')][_0x2698('0x40')]){_0x1487fd[_0x2698('0x3e')]=_[_0x2698('0x41')](_0x1487fd[_0x2698('0x3e')],{'$or':_[_0x2698('0x34')](_0x1487fd[_0x2698('0x39')],function(_0x2088b4){var _0x292dfe={};_0x292dfe[_0x2088b4]={'$like':'%'+_0x75cfa6[_0x2698('0x36')]['filter']+'%'};return _0x292dfe;})});}_0x1487fd=_['merge']({},_0x1487fd,_0x75cfa6[_0x2698('0x43')]);return db['JscriptyQuestionReport'][_0x2698('0x1f')]({'where':_0x1487fd[_0x2698('0x3e')]})['then'](function(_0x3e3c6d){_0x240767[_0x2698('0x1f')]=_0x3e3c6d;if(_0x75cfa6[_0x2698('0x36')]['includeAll']){_0x1487fd[_0x2698('0x45')]=[{'all':!![]}];}return db[_0x2698('0x4e')][_0x2698('0x51')](_0x1487fd);})[_0x2698('0x26')](function(_0x1094e7){_0x240767[_0x2698('0x52')]=_0x1094e7;return _0x240767;});}})[_0x2698('0x26')](respondWithFilteredResult(_0x4bb74e,_0x1487fd))[_0x2698('0x49')](handleError(_0x4bb74e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4a578a5..743ed86 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 _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x44dcf4,_0x9a5ee8){var _0x19b076=function(_0x2afcf3){while(--_0x2afcf3){_0x44dcf4['push'](_0x44dcf4['shift']());}};_0x19b076(++_0x9a5ee8);}(_0x31f0,0xb7));var _0x031f=function(_0x40e257,_0x1d0d7f){_0x40e257=_0x40e257-0x0;var _0x2111c2=_0x31f0[_0x40e257];return _0x2111c2;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0xb36843,_0x57c1f4){var _0x227b83=function(_0x3bce6f){while(--_0x3bce6f){_0xb36843['push'](_0xb36843['shift']());}};_0x227b83(++_0x57c1f4);}(_0x1db9,0x176));var _0x91db=function(_0x1405ce,_0x130422){_0x1405ce=_0x1405ce-0x0;var _0x43b90a=_0x1db9[_0x1405ce];return _0x43b90a;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4503917..df4601d 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xf1f2e0,_0x37c415){var _0x991373=function(_0x5baf7f){while(--_0x5baf7f){_0xf1f2e0['push'](_0xf1f2e0['shift']());}};_0x991373(++_0x37c415);}(_0xadb5,0xad));var _0x5adb=function(_0x57447b,_0x29d9ed){_0x57447b=_0x57447b-0x0;var _0x6f2d11=_0xadb5[_0x57447b];return _0x6f2d11;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x6050=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then'];(function(_0x3ca349,_0x203ed0){var _0xeac360=function(_0x1ba652){while(--_0x1ba652){_0x3ca349['push'](_0x3ca349['shift']());}};_0xeac360(++_0x203ed0);}(_0x6050,0x196));var _0x0605=function(_0xa10093,_0x1c8943){_0xa10093=_0xa10093-0x0;var _0x32ef80=_0x6050[_0xa10093];return _0x32ef80;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9d65b93..847edfa 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 _0x7a9c=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile'];(function(_0x2a4a0a,_0x42b1fb){var _0x43636b=function(_0x5a35ea){while(--_0x5a35ea){_0x2a4a0a['push'](_0x2a4a0a['shift']());}};_0x43636b(++_0x42b1fb);}(_0x7a9c,0x1f1));var _0xc7a9=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x7a9c[_0x3be7ff];return _0x186721;};'use strict';var multer=require(_0xc7a9('0x0'));var util=require(_0xc7a9('0x1'));var path=require('path');var timeout=require(_0xc7a9('0x2'));var express=require('express');var router=express[_0xc7a9('0x3')]();var fs_extra=require(_0xc7a9('0x4'));var auth=require(_0xc7a9('0x5'));var interaction=require(_0xc7a9('0x6'));var config=require(_0xc7a9('0x7'));var controller=require('./license.controller');router[_0xc7a9('0x8')]('/',controller[_0xc7a9('0x9')]);router[_0xc7a9('0xa')](_0xc7a9('0xb'),auth[_0xc7a9('0xc')](),controller['update']);router['get'](_0xc7a9('0xd'),auth[_0xc7a9('0xc')](),controller[_0xc7a9('0xe')]);module[_0xc7a9('0xf')]=router; \ No newline at end of file +var _0x5e87=['/:id','isAuthenticated','/download_log_file','downloadLogFile','util','connect-timeout','express','fs-extra','../../components/interaction/service','./license.controller','get','index','put'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x5e87,0xee));var _0x75e8=function(_0x109feb,_0x2404fc){_0x109feb=_0x109feb-0x0;var _0x2cb210=_0x5e87[_0x109feb];return _0x2cb210;};'use strict';var multer=require('multer');var util=require(_0x75e8('0x0'));var path=require('path');var timeout=require(_0x75e8('0x1'));var express=require(_0x75e8('0x2'));var router=express['Router']();var fs_extra=require(_0x75e8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x75e8('0x4'));var config=require('../../config/environment');var controller=require(_0x75e8('0x5'));router[_0x75e8('0x6')]('/',controller[_0x75e8('0x7')]);router[_0x75e8('0x8')](_0x75e8('0x9'),auth[_0x75e8('0xa')](),controller['update']);router[_0x75e8('0x6')](_0x75e8('0xb'),auth[_0x75e8('0xa')](),controller[_0x75e8('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cb015ee..b054f72 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 _0x4d8c=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x117fed,_0x457fb2){var _0x3911ad=function(_0x2f4a62){while(--_0x2f4a62){_0x117fed['push'](_0x117fed['shift']());}};_0x3911ad(++_0x457fb2);}(_0x4d8c,0x7c));var _0xc4d8=function(_0xc4ae54,_0x31430e){_0xc4ae54=_0xc4ae54-0x0;var _0x3b819f=_0x4d8c[_0xc4ae54];return _0x3b819f;};'use strict';var Sequelize=require(_0xc4d8('0x0'));module[_0xc4d8('0x1')]={'license':{'type':Sequelize[_0xc4d8('0x2')]},'data1':{'type':Sequelize[_0xc4d8('0x3')]},'data2':{'type':Sequelize[_0xc4d8('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc4d8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1ea0=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1ea0,0x1bd));var _0x01ea=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1ea0[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x01ea('0x0'));module[_0x01ea('0x1')]={'license':{'type':Sequelize[_0x01ea('0x2')]},'data1':{'type':Sequelize[_0x01ea('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x01ea('0x4')],'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 19989bf..e1f38c9 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 _0x6bff=['count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','License','rawAttributes','query','keys','filters','intersection','model','fields','attributes','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined'];(function(_0x39bb0a,_0x4b98a6){var _0x3ca657=function(_0x1fd89){while(--_0x1fd89){_0x39bb0a['push'](_0x39bb0a['shift']());}};_0x3ca657(++_0x4b98a6);}(_0x6bff,0x1b1));var _0xf6bf=function(_0x216d4a,_0x51cfd8){_0x216d4a=_0x216d4a-0x0;var _0xe6a2d2=_0x6bff[_0x216d4a];return _0xe6a2d2;};'use strict';var emlformat=require(_0xf6bf('0x0'));var rimraf=require(_0xf6bf('0x1'));var zipdir=require(_0xf6bf('0x2'));var jsonpatch=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var moment=require(_0xf6bf('0x5'));var BPromise=require(_0xf6bf('0x6'));var Mustache=require(_0xf6bf('0x7'));var util=require(_0xf6bf('0x8'));var path=require('path');var sox=require(_0xf6bf('0x9'));var csv=require(_0xf6bf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6bf('0xb'));var squel=require(_0xf6bf('0xc'));var crypto=require(_0xf6bf('0xd'));var jsforce=require(_0xf6bf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf6bf('0xa'));var querystring=require('querystring');var Papa=require(_0xf6bf('0xf'));var Redis=require(_0xf6bf('0x10'));var authService=require(_0xf6bf('0x11'));var qs=require(_0xf6bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6bf('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf6bf('0x15'));var db=require(_0xf6bf('0x16'))['db'];function respondWithStatusCode(_0x32bd7b,_0x1ab5f0){_0x1ab5f0=_0x1ab5f0||0xcc;return function(_0x2b52ee){if(_0x2b52ee){return _0x32bd7b['sendStatus'](_0x1ab5f0);}return _0x32bd7b[_0xf6bf('0x17')](_0x1ab5f0)[_0xf6bf('0x18')]();};}function respondWithResult(_0x41fcd4,_0x25701c){_0x25701c=_0x25701c||0xc8;return function(_0x1215e3){if(_0x1215e3){return _0x41fcd4[_0xf6bf('0x17')](_0x25701c)[_0xf6bf('0x19')](_0x1215e3);}};}function respondWithFilteredResult(_0x4ac11a,_0x4db8ef){return function(_0x30544b){if(_0x30544b){var _0x218ba7=typeof _0x4db8ef[_0xf6bf('0x1a')]==='undefined'&&typeof _0x4db8ef[_0xf6bf('0x1b')]===_0xf6bf('0x1c');var _0x3b253b=_0x30544b[_0xf6bf('0x1d')];var _0x34e23d=_0x218ba7?0x0:_0x4db8ef[_0xf6bf('0x1a')];var _0xa986be=_0x218ba7?_0x30544b['count']:_0x4db8ef[_0xf6bf('0x1a')]+_0x4db8ef[_0xf6bf('0x1b')];var _0xdb9461;if(_0xa986be>=_0x3b253b){_0xa986be=_0x3b253b;_0xdb9461=0xc8;}else{_0xdb9461=0xce;}_0x4ac11a[_0xf6bf('0x17')](_0xdb9461);return _0x4ac11a[_0xf6bf('0x1e')]('Content-Range',_0x34e23d+'-'+_0xa986be+'/'+_0x3b253b)[_0xf6bf('0x19')](_0x30544b);}return null;};}function patchUpdates(_0x3d9bc8){return function(_0x295768){try{jsonpatch[_0xf6bf('0x1f')](_0x295768,_0x3d9bc8,!![]);}catch(_0x5e1e55){return BPromise['reject'](_0x5e1e55);}return _0x295768[_0xf6bf('0x20')]();};}function saveUpdates(_0x55748b,_0xde4804){return function(_0x357955){if(_0x357955){return _0x357955[_0xf6bf('0x21')](_0x55748b)[_0xf6bf('0x22')](function(_0x1e977c){return _0x1e977c;});}return null;};}function removeEntity(_0x2339fc,_0x3c96f1){return function(_0x447471){if(_0x447471){return _0x447471[_0xf6bf('0x23')]()[_0xf6bf('0x22')](function(){_0x2339fc[_0xf6bf('0x17')](0xcc)[_0xf6bf('0x18')]();});}};}function handleEntityNotFound(_0x1112e9,_0xede1f2){return function(_0x5f2a7b){if(!_0x5f2a7b){_0x1112e9[_0xf6bf('0x24')](0x194);}return _0x5f2a7b;};}function handleError(_0x5d1bf1,_0x292b9b){_0x292b9b=_0x292b9b||0x1f4;return function(_0xf18d99){logger[_0xf6bf('0x25')](_0xf18d99[_0xf6bf('0x26')]);if(_0xf18d99[_0xf6bf('0x27')]){delete _0xf18d99[_0xf6bf('0x27')];}_0x5d1bf1[_0xf6bf('0x17')](_0x292b9b)[_0xf6bf('0x28')](_0xf18d99);};}var utilLicense=require(_0xf6bf('0x15'));exports['index']=function(_0x3702cb,_0x5ba798){var _0x37716e={'raw':!![],'where':{'id':0x1}},_0x54915b={};_0x54915b['model']=_['keys'](db[_0xf6bf('0x29')][_0xf6bf('0x2a')]);_0x54915b[_0xf6bf('0x2b')]=_[_0xf6bf('0x2c')](_0x3702cb['query']);_0x54915b[_0xf6bf('0x2d')]=_[_0xf6bf('0x2e')](_0x54915b['model'],_0x54915b[_0xf6bf('0x2b')]);_0x37716e['attributes']=_[_0xf6bf('0x2e')](_0x54915b[_0xf6bf('0x2f')],qs[_0xf6bf('0x30')](_0x3702cb[_0xf6bf('0x2b')][_0xf6bf('0x30')]));_0x37716e[_0xf6bf('0x31')]=_0x37716e[_0xf6bf('0x31')]['length']?_0x37716e['attributes']:_0x54915b[_0xf6bf('0x2f')];_0x37716e=_['merge']({},_0x37716e,_0x3702cb['options']);return utilLicense['getLicense'](_0x37716e)[_0xf6bf('0x22')](respondWithResult(_0x5ba798,null))[_0xf6bf('0x32')](handleError(_0x5ba798,null));};exports[_0xf6bf('0x21')]=function(_0x312547,_0x414d32){if(_0x312547[_0xf6bf('0x33')]['id']){delete _0x312547[_0xf6bf('0x33')]['id'];}return db[_0xf6bf('0x29')][_0xf6bf('0x34')]({'where':{'id':_0x312547['params']['id']}})[_0xf6bf('0x22')](handleEntityNotFound(_0x414d32,null))['then'](function(_0x516172){var _0x15cdba=_0x516172[_0xf6bf('0x35')]({'plain':!![]});return utilLicense[_0xf6bf('0x36')](_0x15cdba,_0x312547[_0xf6bf('0x33')][_0xf6bf('0x37')]);})['then'](function(_0x156567){if(!_0x156567[_0xf6bf('0x38')]){return saveUpdates(_0x312547[_0xf6bf('0x33')],null);}return _0x156567;})[_0xf6bf('0x22')](respondWithResult(_0x414d32,null))['catch'](handleError(_0x414d32,null));};exports[_0xf6bf('0x39')]=function(_0x544f38,_0x1c4de7){var _0x318662=_0xf6bf('0x3a');var _0x43b3cc=path[_0xf6bf('0x3b')]('/var',_0xf6bf('0x3c'),_0xf6bf('0x3d'),_0x318662);_0x1c4de7[_0xf6bf('0x3e')]('Content-disposition',_0xf6bf('0x3f')+_0x318662);_0x1c4de7[_0xf6bf('0x1e')](_0xf6bf('0x40'),_0xf6bf('0x41'));_0x1c4de7['download'](_0x43b3cc);}; \ No newline at end of file +var _0xe50e=['error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','getLicense','catch','body','find','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0xe50e,0x145));var _0xee50=function(_0x287e5b,_0x1fc85a){_0x287e5b=_0x287e5b-0x0;var _0x3579af=_0xe50e[_0x287e5b];return _0x3579af;};'use strict';var emlformat=require(_0xee50('0x0'));var rimraf=require(_0xee50('0x1'));var zipdir=require(_0xee50('0x2'));var jsonpatch=require(_0xee50('0x3'));var rp=require(_0xee50('0x4'));var moment=require('moment');var BPromise=require(_0xee50('0x5'));var Mustache=require(_0xee50('0x6'));var util=require('util');var path=require(_0xee50('0x7'));var sox=require('sox');var csv=require(_0xee50('0x8'));var ejs=require(_0xee50('0x9'));var fs=require('fs');var fs_extra=require(_0xee50('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee50('0xb'));var jsforce=require(_0xee50('0xc'));var deskjs=require(_0xee50('0xd'));var toCsv=require('to-csv');var querystring=require(_0xee50('0xe'));var Papa=require(_0xee50('0xf'));var Redis=require('ioredis');var authService=require(_0xee50('0x10'));var qs=require(_0xee50('0x11'));var as=require(_0xee50('0x12'));var hardwareService=require(_0xee50('0x13'));var logger=require('../../config/logger')(_0xee50('0x14'));var utils=require(_0xee50('0x15'));var config=require(_0xee50('0x16'));var licenseUtil=require(_0xee50('0x17'));var db=require(_0xee50('0x18'))['db'];function respondWithStatusCode(_0x5b02a7,_0x77d28e){_0x77d28e=_0x77d28e||0xcc;return function(_0x566d81){if(_0x566d81){return _0x5b02a7[_0xee50('0x19')](_0x77d28e);}return _0x5b02a7[_0xee50('0x1a')](_0x77d28e)[_0xee50('0x1b')]();};}function respondWithResult(_0x49063a,_0x2e5274){_0x2e5274=_0x2e5274||0xc8;return function(_0x5519c6){if(_0x5519c6){return _0x49063a[_0xee50('0x1a')](_0x2e5274)[_0xee50('0x1c')](_0x5519c6);}};}function respondWithFilteredResult(_0x389852,_0x333982){return function(_0x2de80f){if(_0x2de80f){var _0x5d67dc=typeof _0x333982['offset']===_0xee50('0x1d')&&typeof _0x333982['limit']===_0xee50('0x1d');var _0x2a64b2=_0x2de80f['count'];var _0x2ab3b6=_0x5d67dc?0x0:_0x333982[_0xee50('0x1e')];var _0x31c651=_0x5d67dc?_0x2de80f[_0xee50('0x1f')]:_0x333982[_0xee50('0x1e')]+_0x333982[_0xee50('0x20')];var _0x1f558c;if(_0x31c651>=_0x2a64b2){_0x31c651=_0x2a64b2;_0x1f558c=0xc8;}else{_0x1f558c=0xce;}_0x389852[_0xee50('0x1a')](_0x1f558c);return _0x389852[_0xee50('0x21')](_0xee50('0x22'),_0x2ab3b6+'-'+_0x31c651+'/'+_0x2a64b2)[_0xee50('0x1c')](_0x2de80f);}return null;};}function patchUpdates(_0x2eb6ab){return function(_0x20980a){try{jsonpatch[_0xee50('0x23')](_0x20980a,_0x2eb6ab,!![]);}catch(_0x2ee2d4){return BPromise[_0xee50('0x24')](_0x2ee2d4);}return _0x20980a['save']();};}function saveUpdates(_0x529ae6,_0x40a945){return function(_0x28d757){if(_0x28d757){return _0x28d757[_0xee50('0x25')](_0x529ae6)[_0xee50('0x26')](function(_0x17fc5a){return _0x17fc5a;});}return null;};}function removeEntity(_0x34f72c,_0x11f0bd){return function(_0x31354c){if(_0x31354c){return _0x31354c[_0xee50('0x27')]()[_0xee50('0x26')](function(){_0x34f72c[_0xee50('0x1a')](0xcc)[_0xee50('0x1b')]();});}};}function handleEntityNotFound(_0x11c55a,_0x3fd792){return function(_0x20eb62){if(!_0x20eb62){_0x11c55a['sendStatus'](0x194);}return _0x20eb62;};}function handleError(_0x31fc7d,_0x1a1b89){_0x1a1b89=_0x1a1b89||0x1f4;return function(_0xc28ce3){logger[_0xee50('0x28')](_0xc28ce3[_0xee50('0x29')]);if(_0xc28ce3[_0xee50('0x2a')]){delete _0xc28ce3[_0xee50('0x2a')];}_0x31fc7d[_0xee50('0x1a')](_0x1a1b89)[_0xee50('0x2b')](_0xc28ce3);};}var utilLicense=require('../../config/license/util');exports[_0xee50('0x2c')]=function(_0x484070,_0x22d098){var _0x46b891={'raw':!![],'where':{'id':0x1}},_0x46ebc7={};_0x46ebc7[_0xee50('0x2d')]=_[_0xee50('0x2e')](db[_0xee50('0x2f')][_0xee50('0x30')]);_0x46ebc7[_0xee50('0x31')]=_[_0xee50('0x2e')](_0x484070[_0xee50('0x31')]);_0x46ebc7[_0xee50('0x32')]=_['intersection'](_0x46ebc7[_0xee50('0x2d')],_0x46ebc7['query']);_0x46b891[_0xee50('0x33')]=_[_0xee50('0x34')](_0x46ebc7['model'],qs[_0xee50('0x35')](_0x484070['query'][_0xee50('0x35')]));_0x46b891[_0xee50('0x33')]=_0x46b891[_0xee50('0x33')][_0xee50('0x36')]?_0x46b891[_0xee50('0x33')]:_0x46ebc7['model'];_0x46b891=_['merge']({},_0x46b891,_0x484070['options']);return utilLicense[_0xee50('0x37')](_0x46b891)['then'](respondWithResult(_0x22d098,null))[_0xee50('0x38')](handleError(_0x22d098,null));};exports[_0xee50('0x25')]=function(_0x568ef6,_0x3b2334){if(_0x568ef6[_0xee50('0x39')]['id']){delete _0x568ef6[_0xee50('0x39')]['id'];}return db[_0xee50('0x2f')][_0xee50('0x3a')]({'where':{'id':_0x568ef6['params']['id']}})[_0xee50('0x26')](handleEntityNotFound(_0x3b2334,null))[_0xee50('0x26')](function(_0x2dc7b0){var _0x42a756=_0x2dc7b0[_0xee50('0x3b')]({'plain':!![]});return utilLicense[_0xee50('0x3c')](_0x42a756,_0x568ef6[_0xee50('0x39')]['key']);})['then'](function(_0x375e){if(!_0x375e[_0xee50('0x3d')]){return saveUpdates(_0x568ef6[_0xee50('0x39')],null);}return _0x375e;})[_0xee50('0x26')](respondWithResult(_0x3b2334,null))[_0xee50('0x38')](handleError(_0x3b2334,null));};exports[_0xee50('0x3e')]=function(_0x569e11,_0x145e76){var _0x2d9303=_0xee50('0x3f');var _0x16414f=path[_0xee50('0x40')](_0xee50('0x41'),_0xee50('0x42'),_0xee50('0x43'),_0x2d9303);_0x145e76[_0xee50('0x44')]('Content-disposition',_0xee50('0x45')+_0x2d9303);_0x145e76['set'](_0xee50('0x46'),_0xee50('0x47'));_0x145e76[_0xee50('0x48')](_0x16414f);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7ebf9a7..ff9fc35 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 _0x1c64=['exports','define','License','license','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./license.attributes'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x1c64,0x17d));var _0x41c6=function(_0x1e4834,_0x9806bb){_0x1e4834=_0x1e4834-0x0;var _0x3eced3=_0x1c64[_0x1e4834];return _0x3eced3;};'use strict';var _=require(_0x41c6('0x0'));var util=require(_0x41c6('0x1'));var logger=require(_0x41c6('0x2'))(_0x41c6('0x3'));var moment=require('moment');var BPromise=require(_0x41c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41c6('0x5'));var rimraf=require(_0x41c6('0x6'));var config=require(_0x41c6('0x7'));var attributes=require(_0x41c6('0x8'));module[_0x41c6('0x9')]=function(_0x2634ff,_0x1ea4f2){return _0x2634ff[_0x41c6('0xa')](_0x41c6('0xb'),attributes,{'tableName':_0x41c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d36=['License','license','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x5e8965,_0x744744){var _0x5efd03=function(_0xc82aa1){while(--_0xc82aa1){_0x5e8965['push'](_0x5e8965['shift']());}};_0x5efd03(++_0x744744);}(_0x2d36,0xd3));var _0x62d3=function(_0x3d7fcf,_0x5e75a1){_0x3d7fcf=_0x3d7fcf-0x0;var _0xc9c417=_0x2d36[_0x3d7fcf];return _0xc9c417;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x62d3('0x0'));var moment=require(_0x62d3('0x1'));var BPromise=require(_0x62d3('0x2'));var rp=require(_0x62d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62d3('0x4'));var config=require(_0x62d3('0x5'));var attributes=require(_0x62d3('0x6'));module[_0x62d3('0x7')]=function(_0xadba7e,_0x5cd757){return _0xadba7e[_0x62d3('0x8')](_0x62d3('0x9'),attributes,{'tableName':_0x62d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 87f5158..cc7fe84 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 _0x2a0a=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','result'];(function(_0x3f6066,_0x2582d6){var _0x169181=function(_0x1a5f43){while(--_0x1a5f43){_0x3f6066['push'](_0x3f6066['shift']());}};_0x169181(++_0x2582d6);}(_0x2a0a,0x121));var _0xa2a0=function(_0x3f4bc0,_0x2d1c53){_0x3f4bc0=_0x3f4bc0-0x0;var _0x702e6a=_0x2a0a[_0x3f4bc0];return _0x702e6a;};'use strict';var _=require('lodash');var util=require(_0xa2a0('0x0'));var moment=require(_0xa2a0('0x1'));var BPromise=require(_0xa2a0('0x2'));var rs=require(_0xa2a0('0x3'));var fs=require('fs');var Redis=require(_0xa2a0('0x4'));var db=require(_0xa2a0('0x5'))['db'];var utils=require(_0xa2a0('0x6'));var logger=require(_0xa2a0('0x7'))(_0xa2a0('0x8'));var config=require(_0xa2a0('0x9'));var jayson=require(_0xa2a0('0xa'));var client=jayson[_0xa2a0('0xb')][_0xa2a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c631b,_0x5a02d4,_0x445095){return new BPromise(function(_0xa08228,_0x1af3b2){return client[_0xa2a0('0xd')](_0x2c631b,_0x445095)[_0xa2a0('0xe')](function(_0xec9e4f){logger['info']('License,\x20%s,\x20%s',_0x5a02d4,'request\x20sent');logger[_0xa2a0('0xf')](_0xa2a0('0x10'),_0x5a02d4,_0xa2a0('0x11'),JSON[_0xa2a0('0x12')](_0xec9e4f));if(_0xec9e4f[_0xa2a0('0x13')]){if(_0xec9e4f[_0xa2a0('0x13')]['code']===0x1f4){logger[_0xa2a0('0x13')](_0xa2a0('0x14'),_0x5a02d4,_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);return _0x1af3b2(_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);}logger[_0xa2a0('0x13')](_0xa2a0('0x14'),_0x5a02d4,_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);return _0xa08228(_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);}else{logger['info']('License,\x20%s,\x20%s',_0x5a02d4,_0xa2a0('0x11'));_0xa08228(_0xec9e4f[_0xa2a0('0x16')]['message']);}})[_0xa2a0('0x17')](function(_0x1f7851){logger[_0xa2a0('0x13')]('License,\x20%s,\x20%s',_0x5a02d4,_0x1f7851);_0x1af3b2(_0x1f7851);});});} \ No newline at end of file +var _0xd261=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd261,0x131));var _0x1d26=function(_0x59d530,_0x1f3219){_0x59d530=_0x59d530-0x0;var _0x1020c5=_0xd261[_0x59d530];return _0x1020c5;};'use strict';var _=require('lodash');var util=require(_0x1d26('0x0'));var moment=require('moment');var BPromise=require(_0x1d26('0x1'));var rs=require(_0x1d26('0x2'));var fs=require('fs');var Redis=require(_0x1d26('0x3'));var db=require(_0x1d26('0x4'))['db'];var utils=require(_0x1d26('0x5'));var logger=require(_0x1d26('0x6'))(_0x1d26('0x7'));var config=require(_0x1d26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d26('0x9')][_0x1d26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf346c1,_0x58a9ae,_0x41add0){return new BPromise(function(_0x3dfd5d,_0x4f6624){return client[_0x1d26('0xb')](_0xf346c1,_0x41add0)[_0x1d26('0xc')](function(_0x59bf39){logger[_0x1d26('0xd')](_0x1d26('0xe'),_0x58a9ae,_0x1d26('0xf'));logger[_0x1d26('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x58a9ae,_0x1d26('0xf'),JSON[_0x1d26('0x11')](_0x59bf39));if(_0x59bf39['error']){if(_0x59bf39[_0x1d26('0x12')][_0x1d26('0x13')]===0x1f4){logger[_0x1d26('0x12')](_0x1d26('0xe'),_0x58a9ae,_0x59bf39[_0x1d26('0x12')][_0x1d26('0x14')]);return _0x4f6624(_0x59bf39['error'][_0x1d26('0x14')]);}logger[_0x1d26('0x12')](_0x1d26('0xe'),_0x58a9ae,_0x59bf39[_0x1d26('0x12')][_0x1d26('0x14')]);return _0x3dfd5d(_0x59bf39[_0x1d26('0x12')][_0x1d26('0x14')]);}else{logger[_0x1d26('0xd')](_0x1d26('0xe'),_0x58a9ae,_0x1d26('0xf'));_0x3dfd5d(_0x59bf39[_0x1d26('0x15')][_0x1d26('0x14')]);}})[_0x1d26('0x16')](function(_0x46afee){logger[_0x1d26('0x12')]('License,\x20%s,\x20%s',_0x58a9ae,_0x46afee);_0x4f6624(_0x46afee);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5d5577f..f1d04e2 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 _0x7304=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2c9a28,_0x30b126){var _0x17023b=function(_0x518bbc){while(--_0x518bbc){_0x2c9a28['push'](_0x2c9a28['shift']());}};_0x17023b(++_0x30b126);}(_0x7304,0x1f3));var _0x4730=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x7304[_0xfd495c];return _0x561dd8;};'use strict';var multer=require(_0x4730('0x0'));var util=require(_0x4730('0x1'));var path=require(_0x4730('0x2'));var timeout=require(_0x4730('0x3'));var express=require(_0x4730('0x4'));var router=express[_0x4730('0x5')]();var fs_extra=require(_0x4730('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4730('0x7'));var config=require(_0x4730('0x8'));var controller=require('./mailAccount.controller');router[_0x4730('0x9')]('/',auth[_0x4730('0xa')](),controller[_0x4730('0xb')]);router[_0x4730('0x9')](_0x4730('0xc'),auth[_0x4730('0xa')](),controller[_0x4730('0xd')]);router[_0x4730('0x9')](_0x4730('0xe'),auth[_0x4730('0xa')](),controller[_0x4730('0xf')]);router[_0x4730('0x9')](_0x4730('0x10'),auth['isAuthenticated'](),controller[_0x4730('0x11')]);router[_0x4730('0x9')]('/:id/canned_answers',auth[_0x4730('0xa')](),controller[_0x4730('0x12')]);router[_0x4730('0x9')](_0x4730('0x13'),auth['isAuthenticated'](),controller[_0x4730('0x14')]);router[_0x4730('0x9')](_0x4730('0x15'),auth[_0x4730('0xa')](),controller[_0x4730('0x16')]);router['get'](_0x4730('0x17'),auth[_0x4730('0xa')](),controller[_0x4730('0x18')]);router[_0x4730('0x9')](_0x4730('0x19'),auth[_0x4730('0xa')](),controller[_0x4730('0x1a')]);router[_0x4730('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4730('0x1b')]);router[_0x4730('0x9')](_0x4730('0x1c'),auth[_0x4730('0xa')](),controller[_0x4730('0x1d')]);router[_0x4730('0x9')]('/:id/users',auth[_0x4730('0xa')](),controller[_0x4730('0x1e')]);router[_0x4730('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4730('0x20')]);router['post'](_0x4730('0x21'),auth['isAuthenticated'](),controller[_0x4730('0x22')]);router['post']('/',auth[_0x4730('0xa')](),controller[_0x4730('0x23')]);router[_0x4730('0x1f')](_0x4730('0x13'),auth[_0x4730('0xa')](),controller[_0x4730('0x24')]);router['post']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x4730('0x25')]);router[_0x4730('0x1f')]('/:id/interactions',auth[_0x4730('0xa')](),controller[_0x4730('0x26')]);router['post'](_0x4730('0x19'),auth[_0x4730('0xa')](),controller[_0x4730('0x27')]);router[_0x4730('0x1f')](_0x4730('0x28'),auth[_0x4730('0xa')](),controller[_0x4730('0x29')]);router['post'](_0x4730('0x2a'),auth[_0x4730('0xa')](),controller['addAgents']);router[_0x4730('0x2b')]('/:id',auth[_0x4730('0xa')](),controller[_0x4730('0x2c')]);router[_0x4730('0x2d')](_0x4730('0x10'),auth[_0x4730('0xa')](),controller[_0x4730('0x2e')]);router[_0x4730('0x2d')](_0x4730('0x21'),auth[_0x4730('0xa')](),controller[_0x4730('0x2f')]);router[_0x4730('0x2d')](_0x4730('0x13'),auth[_0x4730('0xa')](),controller['removeImap']);router['delete'](_0x4730('0x15'),auth['isAuthenticated'](),controller[_0x4730('0x30')]);router[_0x4730('0x2d')](_0x4730('0xe'),auth['isAuthenticated'](),controller[_0x4730('0x31')]);router[_0x4730('0x2d')](_0x4730('0x2a'),auth[_0x4730('0xa')](),controller['removeAgents']);module[_0x4730('0x32')]=router; \ No newline at end of file +var _0x144f=['getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','/:id','removeDispositions','delete','removeAnswers','removeImap','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0xdfed1c,_0x48ba9d){var _0x4a5981=function(_0x4f2ba7){while(--_0x4f2ba7){_0xdfed1c['push'](_0xdfed1c['shift']());}};_0x4a5981(++_0x48ba9d);}(_0x144f,0x1c4));var _0xf144=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x144f[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf144('0x0'));var timeout=require(_0xf144('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf144('0x2'));var auth=require(_0xf144('0x3'));var interaction=require(_0xf144('0x4'));var config=require(_0xf144('0x5'));var controller=require(_0xf144('0x6'));router[_0xf144('0x7')]('/',auth[_0xf144('0x8')](),controller[_0xf144('0x9')]);router['get'](_0xf144('0xa'),auth[_0xf144('0x8')](),controller[_0xf144('0xb')]);router[_0xf144('0x7')]('/:id',auth[_0xf144('0x8')](),controller[_0xf144('0xc')]);router['get'](_0xf144('0xd'),auth[_0xf144('0x8')](),controller['getDispositions']);router[_0xf144('0x7')]('/:id/canned_answers',auth[_0xf144('0x8')](),controller[_0xf144('0xe')]);router[_0xf144('0x7')](_0xf144('0xf'),auth['isAuthenticated'](),controller[_0xf144('0x10')]);router['get'](_0xf144('0x11'),auth[_0xf144('0x8')](),controller[_0xf144('0x12')]);router[_0xf144('0x7')](_0xf144('0x13'),auth[_0xf144('0x8')](),controller[_0xf144('0x14')]);router[_0xf144('0x7')]('/:id/applications',auth[_0xf144('0x8')](),controller[_0xf144('0x15')]);router['get'](_0xf144('0x16'),auth[_0xf144('0x8')](),controller[_0xf144('0x17')]);router[_0xf144('0x7')](_0xf144('0x18'),auth[_0xf144('0x8')](),controller[_0xf144('0x19')]);router[_0xf144('0x7')]('/:id/users',auth[_0xf144('0x8')](),controller[_0xf144('0x1a')]);router['post'](_0xf144('0xd'),auth['isAuthenticated'](),controller[_0xf144('0x1b')]);router[_0xf144('0x1c')](_0xf144('0x1d'),auth[_0xf144('0x8')](),controller[_0xf144('0x1e')]);router[_0xf144('0x1c')]('/',auth['isAuthenticated'](),controller[_0xf144('0x1f')]);router[_0xf144('0x1c')](_0xf144('0xf'),auth[_0xf144('0x8')](),controller[_0xf144('0x20')]);router[_0xf144('0x1c')]('/:id/out_servers',auth[_0xf144('0x8')](),controller[_0xf144('0x21')]);router['post'](_0xf144('0x13'),auth['isAuthenticated'](),controller[_0xf144('0x22')]);router[_0xf144('0x1c')]('/:id/applications',auth[_0xf144('0x8')](),controller['addApplications']);router['post'](_0xf144('0x23'),auth[_0xf144('0x8')](),controller['send']);router['post'](_0xf144('0x24'),auth['isAuthenticated'](),controller[_0xf144('0x25')]);router['put'](_0xf144('0x26'),auth[_0xf144('0x8')](),controller['update']);router['delete'](_0xf144('0xd'),auth['isAuthenticated'](),controller[_0xf144('0x27')]);router[_0xf144('0x28')](_0xf144('0x1d'),auth[_0xf144('0x8')](),controller[_0xf144('0x29')]);router[_0xf144('0x28')](_0xf144('0xf'),auth[_0xf144('0x8')](),controller[_0xf144('0x2a')]);router[_0xf144('0x28')](_0xf144('0x11'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0xf144('0x28')](_0xf144('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0xf144('0x28')](_0xf144('0x24'),auth[_0xf144('0x8')](),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 7ab2991..4edd21a 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 _0xf534=['mandatoryDisposition','ENUM','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf534,0x16c));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4f53('0x0'));module[_0x4f53('0x1')]={'description':{'type':Sequelize[_0x4f53('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4f53('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4f53('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4f53('0x4')](0x2)[_0x4f53('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4f53('0x6')],'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[_0x4f53('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f53('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f53('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f53('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![],'comment':_0x4f53('0x7'),'set':function(_0x3e3d86){if(!_0x3e3d86)this[_0x4f53('0x8')](_0x4f53('0x9'),null);this[_0x4f53('0x8')](_0x4f53('0xa'),_0x3e3d86);}},'provider':{'type':Sequelize[_0x4f53('0xb')]('gmail',_0x4f53('0xc'),'yahoo',_0x4f53('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this[_0x4f53('0xe')](_0x4f53('0xf'));},'set':function(_0x131f7a){if(_0x131f7a===_0x4f53('0x10'))_0x131f7a=null;return this[_0x4f53('0x8')]('provider',_0x131f7a);}}}; \ No newline at end of file +var _0x62bd=['gmail','hotmail','outlook365','getDataValue','custom','provider','sequelize','exports','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','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x19b9e2,_0x3366b1){var _0x4745f5=function(_0x536bfe){while(--_0x536bfe){_0x19b9e2['push'](_0x19b9e2['shift']());}};_0x4745f5(++_0x3366b1);}(_0x62bd,0x6a));var _0xd62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd62b('0x0'));module[_0xd62b('0x1')]={'description':{'type':Sequelize[_0xd62b('0x2')]},'name':{'type':Sequelize[_0xd62b('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd62b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd62b('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd62b('0x4')]},'markAsUnread':{'type':Sequelize[_0xd62b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd62b('0x2')],'allowNull':![],'defaultValue':_0xd62b('0x5')},'fontSize':{'type':Sequelize[_0xd62b('0x6')](0x2)[_0xd62b('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd62b('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xd62b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd62b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd62b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd62b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd62b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd62b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd62b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd62b('0x3')],'defaultValue':![],'comment':_0xd62b('0x9'),'set':function(_0x13a9d2){if(!_0x13a9d2)this[_0xd62b('0xa')](_0xd62b('0xb'),null);this['setDataValue'](_0xd62b('0xc'),_0x13a9d2);}},'provider':{'type':Sequelize[_0xd62b('0xd')](_0xd62b('0xe'),_0xd62b('0xf'),'yahoo',_0xd62b('0x10')),'defaultValue':null,'get':function(){if(!this[_0xd62b('0x11')]('provider'))return _0xd62b('0x12');return this['getDataValue'](_0xd62b('0x13'));},'set':function(_0x21c9c8){if(_0x21c9c8===_0xd62b('0x12'))_0x21c9c8=null;return this['setDataValue']('provider',_0x21c9c8);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 31ab7f9..0206020 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 _0x4319=['localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','catch','sendStatus','end','status','offset','undefined','count','limit','set','json','update','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','hotmail','Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','show','params','MailServerIn','mandatoryDispositionPause','includeAll','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','pick','rows','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','create','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults'];(function(_0x53b4ac,_0x29d9f8){var _0x29c7c4=function(_0x107a75){while(--_0x107a75){_0x53b4ac['push'](_0x53b4ac['shift']());}};_0x29c7c4(++_0x29d9f8);}(_0x4319,0xba));var _0x9431=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0x4319[_0x1baa84];return _0x18523b;};'use strict';var moment=require(_0x9431('0x0'));var BPromise=require(_0x9431('0x1'));var util=require(_0x9431('0x2'));var path=require(_0x9431('0x3'));var _=require(_0x9431('0x4'));var juice=require(_0x9431('0x5'));var Redis=require(_0x9431('0x6'));var qs=require(_0x9431('0x7'));var logger=require(_0x9431('0x8'))('api');var config=require('../../config/environment');var db=require(_0x9431('0x9'))['db'];config[_0x9431('0xa')]=_[_0x9431('0xb')](config[_0x9431('0xa')],{'host':_0x9431('0xc'),'port':0x18eb});var socket=require(_0x9431('0xd'))(new Redis(config[_0x9431('0xa')]));require(_0x9431('0xe'))[_0x9431('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9431('0x10')][_0x9431('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x193da6,_0x998c88,_0x150e6c,_0x589b12){return new BPromise(function(_0x11c6ea,_0x1377f3){var _0x5ddd05=_0x589b12||client;return _0x5ddd05[_0x9431('0x12')](_0x193da6,_0x150e6c)[_0x9431('0x13')](function(_0x3e13e7){logger['info']('MailAccount,\x20%s,\x20%s',_0x998c88,_0x9431('0x14'));logger[_0x9431('0x15')](_0x9431('0x16'),_0x998c88,_0x9431('0x14'),JSON['stringify'](_0x3e13e7));if(_0x3e13e7['error']){if(_0x3e13e7[_0x9431('0x17')][_0x9431('0x18')]===0x1f4){logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x3e13e7[_0x9431('0x17')][_0x9431('0x1a')]);return _0x1377f3(_0x3e13e7['error'][_0x9431('0x1a')]);}logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x3e13e7[_0x9431('0x17')]['message']);return _0x11c6ea(_0x3e13e7[_0x9431('0x17')][_0x9431('0x1a')]);}else{logger[_0x9431('0x1b')](_0x9431('0x19'),_0x998c88,'request\x20sent');_0x11c6ea(_0x3e13e7['result'][_0x9431('0x1a')]);}})[_0x9431('0x1c')](function(_0x1eaaf4){logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x1eaaf4);_0x1377f3(_0x1eaaf4);});});}function respondWithStatusCode(_0x946128,_0x829931){_0x829931=_0x829931||0xcc;return function(_0x1220f1){if(_0x1220f1){return _0x946128[_0x9431('0x1d')](_0x829931);}return _0x946128['status'](_0x829931)[_0x9431('0x1e')]();};}function respondWithResult(_0x155d80,_0x58dbeb){_0x58dbeb=_0x58dbeb||0xc8;return function(_0x49f9d8){if(_0x49f9d8){return _0x155d80[_0x9431('0x1f')](_0x58dbeb)['json'](_0x49f9d8);}};}function respondWithFilteredResult(_0x41c0ee,_0x116592){return function(_0x55f91f){if(_0x55f91f){var _0x57e461=typeof _0x116592[_0x9431('0x20')]===_0x9431('0x21')&&typeof _0x116592['limit']==='undefined';var _0xc6d273=_0x55f91f['count'];var _0x18dd9a=_0x57e461?0x0:_0x116592[_0x9431('0x20')];var _0x168152=_0x57e461?_0x55f91f[_0x9431('0x22')]:_0x116592[_0x9431('0x20')]+_0x116592[_0x9431('0x23')];var _0x1de67b;if(_0x168152>=_0xc6d273){_0x168152=_0xc6d273;_0x1de67b=0xc8;}else{_0x1de67b=0xce;}_0x41c0ee[_0x9431('0x1f')](_0x1de67b);return _0x41c0ee[_0x9431('0x24')]('Content-Range',_0x18dd9a+'-'+_0x168152+'/'+_0xc6d273)[_0x9431('0x25')](_0x55f91f);}return null;};}function saveUpdates(_0x5b933d){return function(_0xb3caff){if(_0xb3caff){return _0xb3caff[_0x9431('0x26')](_0x5b933d)['then'](function(_0x216664){return _0x216664;});}return null;};}function removeEntity(_0x5a13ee){return function(_0x324e49){if(_0x324e49){return _0x324e49['destroy']()[_0x9431('0x13')](function(){var _0x27edf2=_0x324e49[_0x9431('0x27')]({'plain':!![]});var _0x8b72e3=_0x9431('0x28');return db[_0x9431('0x29')]['destroy']({'where':{'type':_0x8b72e3,'resourceId':_0x27edf2['id']}})['then'](function(){return _0x324e49;});})[_0x9431('0x13')](function(){_0x5a13ee[_0x9431('0x1f')](0xcc)[_0x9431('0x1e')]();});}};}function handleEntityNotFound(_0x419781){return function(_0x181bbe){if(!_0x181bbe){_0x419781[_0x9431('0x1d')](0x194);}return _0x181bbe;};}function handleError(_0x521e89,_0x2edffe){_0x2edffe=_0x2edffe||0x1f4;return function(_0x30f39b){logger[_0x9431('0x17')](_0x30f39b[_0x9431('0x2a')]);if(_0x30f39b[_0x9431('0x2b')]){delete _0x30f39b[_0x9431('0x2b')];}_0x521e89[_0x9431('0x1f')](_0x2edffe)[_0x9431('0x2c')](_0x30f39b);};}function getImapHost(_0x4a0c25){switch(_0x4a0c25){case _0x9431('0x2d'):return _0x9431('0x2e');case _0x9431('0x2f'):return _0x9431('0x30');case'hotmail':return _0x9431('0x31');case _0x9431('0x32'):return _0x9431('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4a0c25);}function getSmtpHost(_0x5458a0){switch(_0x5458a0){case'gmail':return _0x9431('0x34');case _0x9431('0x2f'):return'smtp.mail.yahoo.com';case _0x9431('0x35'):return'smtp-mail.outlook.com';case _0x9431('0x32'):return'smtp.office365.com';}throw new Error(_0x9431('0x36'),_0x5458a0);}function getAuthenticationOptions(_0xbd6ae,_0x596bdc){var _0x3fec4b={};var _0x157730={};if(_0xbd6ae){_0x3fec4b[_0x9431('0x37')]=_0x157730['user']=_0x596bdc['username'];_0x3fec4b[_0x9431('0x38')]=_0x157730[_0x9431('0x39')]=_0x596bdc[_0x9431('0x38')];if(_0x596bdc['modernAuthentication']){_0x3fec4b[_0x9431('0x3a')]=_0x157730[_0x9431('0x3a')]=!![];_0x3fec4b[_0x9431('0x3b')]=_0x157730[_0x9431('0x3b')]=_0x596bdc[_0x9431('0x3b')];_0x3fec4b[_0x9431('0x38')]=_0x157730['pass']=null;}else{_0x3fec4b[_0x9431('0x3b')]=_0x157730[_0x9431('0x3b')]=null;}_0x3fec4b[_0x9431('0x3c')]=getImapHost(_0xbd6ae);_0x3fec4b[_0x9431('0x3d')]=0x3e1;_0x157730[_0x9431('0x3c')]=getSmtpHost(_0xbd6ae);_0x157730[_0x9431('0x3d')]=0x24b;_0x157730[_0x9431('0x3e')]=![];_0x3fec4b[_0x9431('0x3f')]=_0x157730[_0x9431('0x3f')]=null;}else{if(_0x596bdc[_0x9431('0x40')]){_0x3fec4b[_0x9431('0x37')]=_0x157730[_0x9431('0x37')]=_0x596bdc[_0x9431('0x41')];_0x3fec4b['password']=_0x157730[_0x9431('0x39')]=_0x596bdc[_0x9431('0x38')];}else{_0x3fec4b[_0x9431('0x40')]=_0x157730[_0x9431('0x40')]=![];_0x3fec4b[_0x9431('0x37')]=_0x157730['user']=null;_0x3fec4b[_0x9431('0x38')]=_0x157730[_0x9431('0x39')]=null;}_0x3fec4b[_0x9431('0x3c')]=_0x596bdc[_0x9431('0x42')][_0x9431('0x3c')];_0x3fec4b[_0x9431('0x3d')]=_0x596bdc[_0x9431('0x42')]['port'];_0x157730[_0x9431('0x3c')]=_0x596bdc['Smtp'][_0x9431('0x3c')];_0x157730[_0x9431('0x3d')]=_0x596bdc[_0x9431('0x43')][_0x9431('0x3d')];}return{'Imap':_0x3fec4b,'Smtp':_0x157730};}exports[_0x9431('0x44')]=function(_0x4ef666,_0x4a6914){var _0x2460d3={'include':[{'model':db['MailServerIn'],'as':_0x9431('0x42')},{'model':db[_0x9431('0x45')],'as':'Smtp'},{'model':db[_0x9431('0x46')],'as':'mandatoryDispositionPause'}]},_0x364924={},_0x475a40={'count':0x0,'rows':[]};var _0x5f09e7=_[_0x9431('0x47')](db[_0x9431('0x48')][_0x9431('0x49')],function(_0x437180){return{'name':_0x437180[_0x9431('0x4a')],'type':_0x437180[_0x9431('0x4b')][_0x9431('0x4c')]};});_0x364924[_0x9431('0x4d')]=_[_0x9431('0x47')](_0x5f09e7,_0x9431('0x2b'));_0x364924[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x4ef666[_0x9431('0x4e')]);_0x364924['filters']=_[_0x9431('0x50')](_0x364924[_0x9431('0x4d')],_0x364924[_0x9431('0x4e')]);_0x2460d3['attributes']=_[_0x9431('0x50')](_0x364924[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x51')]));_0x2460d3['attributes']=_0x2460d3[_0x9431('0x52')][_0x9431('0x53')]?_0x2460d3[_0x9431('0x52')]:_0x364924[_0x9431('0x4d')];if(!_0x4ef666[_0x9431('0x4e')][_0x9431('0x54')](_0x9431('0x55'))){_0x2460d3[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x23')]);_0x2460d3[_0x9431('0x20')]=qs[_0x9431('0x20')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x20')]);}_0x2460d3[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x57')]);_0x2460d3[_0x9431('0x58')]=qs[_0x9431('0x59')](_['pick'](_0x4ef666[_0x9431('0x4e')],_0x364924[_0x9431('0x59')]),_0x5f09e7);if(_0x4ef666[_0x9431('0x4e')][_0x9431('0x5a')]){_0x2460d3[_0x9431('0x58')]=_['merge'](_0x2460d3['where'],{'$or':_[_0x9431('0x47')](_0x5f09e7,function(_0x1f7199){if(_0x1f7199[_0x9431('0x4b')]!==_0x9431('0x5b')){var _0x4f08a7={};_0x4f08a7[_0x1f7199['name']]={'$like':'%'+_0x4ef666[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x4f08a7;}})});}_0x2460d3=_[_0x9431('0x5c')]({},_0x2460d3,_0x4ef666[_0x9431('0x5d')]);var _0x2556f7={'where':_0x2460d3[_0x9431('0x58')]};return db[_0x9431('0x48')][_0x9431('0x22')](_0x2556f7)['then'](function(_0x52aa2d){_0x475a40['count']=_0x52aa2d;if(_0x4ef666['query']['includeAll']){_0x2460d3[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x48')][_0x9431('0x5f')](_0x2460d3);})[_0x9431('0x13')](function(_0x11ef3c){_0x475a40['rows']=_0x11ef3c;return _0x475a40;})[_0x9431('0x13')](respondWithFilteredResult(_0x4a6914,_0x2460d3))[_0x9431('0x1c')](handleError(_0x4a6914,null));};exports[_0x9431('0x60')]=function(_0x1223f1,_0x378d45){var _0x4c2e5d={'raw':![],'where':{'id':_0x1223f1[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')},{'model':db['MailServerOut'],'as':_0x9431('0x43')},{'model':db[_0x9431('0x46')],'as':_0x9431('0x63')}]},_0x37b3fa={};_0x37b3fa['model']=_[_0x9431('0x4f')](db[_0x9431('0x48')]['rawAttributes']);_0x37b3fa[_0x9431('0x4e')]=_['keys'](_0x1223f1[_0x9431('0x4e')]);_0x37b3fa[_0x9431('0x59')]=_['intersection'](_0x37b3fa[_0x9431('0x4d')],_0x37b3fa[_0x9431('0x4e')]);_0x4c2e5d[_0x9431('0x52')]=_[_0x9431('0x50')](_0x37b3fa[_0x9431('0x4d')],qs['fields'](_0x1223f1[_0x9431('0x4e')][_0x9431('0x51')]));_0x4c2e5d[_0x9431('0x52')]=_0x4c2e5d[_0x9431('0x52')]['length']?_0x4c2e5d['attributes']:_0x37b3fa[_0x9431('0x4d')];if(_0x1223f1['query'][_0x9431('0x64')]){_0x4c2e5d['include']=[{'all':!![]}];}_0x4c2e5d=_[_0x9431('0x5c')]({},_0x4c2e5d,_0x1223f1[_0x9431('0x5d')]);return db[_0x9431('0x48')][_0x9431('0x65')](_0x4c2e5d)['then'](handleEntityNotFound(_0x378d45,null))['then'](respondWithResult(_0x378d45,null))['catch'](handleError(_0x378d45,null));};exports['update']=function(_0x18e128,_0x4d65a4){if(_0x18e128[_0x9431('0x66')]['id']){delete _0x18e128[_0x9431('0x66')]['id'];}var _0x57b207=_0x18e128['body'][_0x9431('0x67')]===_0x9431('0x68')?null:_0x18e128[_0x9431('0x66')][_0x9431('0x67')];var _0x518646=_0x18e128[_0x9431('0x66')]['Imap']||{};var _0x51bef4=_0x18e128['body'][_0x9431('0x43')]||{};if(_0x57b207){_0x518646[_0x9431('0x3c')]=getImapHost(_0x57b207);_0x518646['port']=0x3e1;_0x51bef4['host']=getSmtpHost(_0x57b207);_0x51bef4[_0x9431('0x3d')]=0x24b;_0x51bef4[_0x9431('0x3e')]=![];}if(_0x51bef4[_0x9431('0x3a')]){_0x51bef4[_0x9431('0x3e')]=![];}else{_0x51bef4['CloudProviderId']=null;}if(!_0x518646[_0x9431('0x3a')])_0x518646[_0x9431('0x3b')]=null;_0x18e128[_0x9431('0x66')][_0x9431('0x42')]=_0x518646;_0x18e128[_0x9431('0x66')][_0x9431('0x43')]=_0x51bef4;return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x18e128[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')},{'model':db[_0x9431('0x45')],'as':_0x9431('0x43')},{'model':db[_0x9431('0x46')],'as':_0x9431('0x63')}]})[_0x9431('0x13')](handleEntityNotFound(_0x4d65a4,null))[_0x9431('0x13')](function(_0x497899){if(!_0x497899)throw new Error('Mail\x20Account\x20not\x20found');if(_0x497899['service'])delete _0x18e128[_0x9431('0x66')][_0x9431('0x42')];return _0x497899;})[_0x9431('0x13')](saveUpdates(_0x18e128[_0x9431('0x66')],null))[_0x9431('0x13')](function(_0x2c861e){if(!_0x18e128[_0x9431('0x66')][_0x9431('0x42')])return _0x2c861e;return db[_0x9431('0x62')][_0x9431('0x26')](_0x18e128[_0x9431('0x66')][_0x9431('0x42')],{'where':{'MailAccountId':_0x2c861e['id']}})[_0x9431('0x13')](function(){return _0x2c861e;});})[_0x9431('0x13')](function(_0x18396f){if(!_0x18e128[_0x9431('0x66')][_0x9431('0x43')])return _0x18396f;return db[_0x9431('0x45')][_0x9431('0x26')](_0x18e128[_0x9431('0x66')][_0x9431('0x43')],{'where':{'MailAccountId':_0x18396f['id']}})[_0x9431('0x13')](function(){return _0x18396f;});})[_0x9431('0x13')](respondWithResult(_0x4d65a4,null))['catch'](handleError(_0x4d65a4,null));};exports['describe']=function(_0x257f58,_0x22bbcf){return db[_0x9431('0x48')][_0x9431('0x69')]()[_0x9431('0x13')](respondWithResult(_0x22bbcf,null))[_0x9431('0x1c')](handleError(_0x22bbcf,null));};exports[_0x9431('0x6a')]=function(_0x30efeb,_0xb26ed4){if(_0x30efeb[_0x9431('0x66')]['id']){delete _0x30efeb[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x30efeb['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xb26ed4,null))[_0x9431('0x13')](function(_0x12da14){if(_0x12da14){_0x30efeb[_0x9431('0x66')][_0x9431('0x6b')]=_0x12da14['id'];return db[_0x9431('0x6c')]['create'](_0x30efeb[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0xb26ed4,null))[_0x9431('0x1c')](handleError(_0xb26ed4,null));};exports[_0x9431('0x6d')]=function(_0x44e391,_0x359b15){var _0x4e6dbc={'raw':![],'where':{}};var _0x30e44a={};var _0x2fc281={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x44e391[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x359b15,null))['then'](function(_0x35ff91){if(_0x35ff91){_0x30e44a[_0x9431('0x4d')]=_['keys'](db['Disposition'][_0x9431('0x49')]);_0x30e44a[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x44e391[_0x9431('0x4e')]);_0x30e44a[_0x9431('0x59')]=_[_0x9431('0x50')](_0x30e44a[_0x9431('0x4d')],_0x30e44a['query']);_0x4e6dbc[_0x9431('0x52')]=_['intersection'](_0x30e44a['model'],qs[_0x9431('0x51')](_0x44e391[_0x9431('0x4e')][_0x9431('0x51')]));_0x4e6dbc['attributes']=_0x4e6dbc[_0x9431('0x52')][_0x9431('0x53')]?_0x4e6dbc[_0x9431('0x52')]:_0x30e44a['model'];if(!_0x44e391['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x4e6dbc[_0x9431('0x23')]=qs['limit'](_0x44e391[_0x9431('0x4e')]['limit']);_0x4e6dbc[_0x9431('0x20')]=qs['offset'](_0x44e391[_0x9431('0x4e')][_0x9431('0x20')]);}_0x4e6dbc['order']=qs[_0x9431('0x57')](_0x44e391['query'][_0x9431('0x57')]);_0x4e6dbc[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x44e391[_0x9431('0x4e')],_0x30e44a[_0x9431('0x59')]));_0x4e6dbc['where'][_0x9431('0x6b')]=_0x35ff91['id'];if(_0x44e391['query'][_0x9431('0x5a')]){_0x4e6dbc[_0x9431('0x58')]=_['merge'](_0x4e6dbc['where'],{'$or':_[_0x9431('0x47')](_0x4e6dbc[_0x9431('0x52')],function(_0x234e46){var _0x446a8f={};_0x446a8f[_0x234e46]={'$like':'%'+_0x44e391[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x446a8f;})});}_0x4e6dbc=_['merge']({},_0x4e6dbc,_0x44e391['options']);return db[_0x9431('0x6c')][_0x9431('0x22')]({'where':_0x4e6dbc['where']})[_0x9431('0x13')](function(_0x2beb1f){_0x2fc281[_0x9431('0x22')]=_0x2beb1f;if(_0x44e391[_0x9431('0x4e')]['includeAll']){_0x4e6dbc[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x6c')]['findAll'](_0x4e6dbc);})['then'](function(_0x84e22c){_0x2fc281[_0x9431('0x70')]=_0x84e22c;return _0x2fc281;});}})['then'](respondWithFilteredResult(_0x359b15,_0x4e6dbc))['catch'](handleError(_0x359b15,null));};exports['removeDispositions']=function(_0x258a32,_0x249660){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x258a32[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x249660,null))[_0x9431('0x13')](function(_0x13e4ae){if(_0x13e4ae){return _0x13e4ae['removeDispositions'](_0x258a32[_0x9431('0x4e')][_0x9431('0x71')]);}})[_0x9431('0x13')](respondWithStatusCode(_0x249660,null))['catch'](handleError(_0x249660,null));};exports[_0x9431('0x72')]=function(_0x8adcba,_0x370b6d){if(_0x8adcba[_0x9431('0x66')]['id']){delete _0x8adcba[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x8adcba[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x370b6d,null))[_0x9431('0x13')](function(_0x268653){if(_0x268653){_0x8adcba[_0x9431('0x66')][_0x9431('0x6b')]=_0x268653['id'];return db['CannedAnswer']['create'](_0x8adcba['body']);}})[_0x9431('0x13')](respondWithResult(_0x370b6d,null))[_0x9431('0x1c')](handleError(_0x370b6d,null));};exports[_0x9431('0x73')]=function(_0x10b645,_0x584eaa){var _0x5557c3={'raw':![],'where':{}};var _0x198163={};var _0x48dd22={'count':0x0,'rows':[]};return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x10b645[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x584eaa,null))[_0x9431('0x13')](function(_0x72a393){if(_0x72a393){_0x198163[_0x9431('0x4d')]=_['keys'](db[_0x9431('0x74')][_0x9431('0x49')]);_0x198163[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x10b645[_0x9431('0x4e')]);_0x198163[_0x9431('0x59')]=_[_0x9431('0x50')](_0x198163[_0x9431('0x4d')],_0x198163[_0x9431('0x4e')]);_0x5557c3['attributes']=_[_0x9431('0x50')](_0x198163['model'],qs['fields'](_0x10b645[_0x9431('0x4e')][_0x9431('0x51')]));_0x5557c3[_0x9431('0x52')]=_0x5557c3[_0x9431('0x52')][_0x9431('0x53')]?_0x5557c3[_0x9431('0x52')]:_0x198163['model'];if(!_0x10b645[_0x9431('0x4e')][_0x9431('0x54')]('nolimit')){_0x5557c3[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x10b645['query'][_0x9431('0x23')]);_0x5557c3[_0x9431('0x20')]=qs[_0x9431('0x20')](_0x10b645[_0x9431('0x4e')][_0x9431('0x20')]);}_0x5557c3[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x10b645[_0x9431('0x4e')][_0x9431('0x57')]);_0x5557c3[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x10b645[_0x9431('0x4e')],_0x198163['filters']));_0x5557c3[_0x9431('0x58')][_0x9431('0x6b')]=_0x72a393['id'];if(_0x10b645[_0x9431('0x4e')][_0x9431('0x5a')]){_0x5557c3['where']=_[_0x9431('0x5c')](_0x5557c3['where'],{'$or':_[_0x9431('0x47')](_0x5557c3[_0x9431('0x52')],function(_0x16a68e){var _0x5c1f24={};_0x5c1f24[_0x16a68e]={'$like':'%'+_0x10b645[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x5c1f24;})});}_0x5557c3=_[_0x9431('0x5c')]({},_0x5557c3,_0x10b645[_0x9431('0x5d')]);return db['CannedAnswer'][_0x9431('0x22')]({'where':_0x5557c3['where']})[_0x9431('0x13')](function(_0x2be8b6){_0x48dd22[_0x9431('0x22')]=_0x2be8b6;if(_0x10b645['query'][_0x9431('0x64')]){_0x5557c3[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x74')][_0x9431('0x5f')](_0x5557c3);})['then'](function(_0x5d6459){_0x48dd22[_0x9431('0x70')]=_0x5d6459;return _0x48dd22;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x584eaa,_0x5557c3))[_0x9431('0x1c')](handleError(_0x584eaa,null));};exports['removeAnswers']=function(_0x72c9f,_0x31fc80){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x72c9f['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x31fc80,null))[_0x9431('0x13')](function(_0x3ffda8){if(_0x3ffda8){return _0x3ffda8[_0x9431('0x75')](_0x72c9f[_0x9431('0x4e')][_0x9431('0x71')]);}})[_0x9431('0x13')](respondWithStatusCode(_0x31fc80,null))[_0x9431('0x1c')](handleError(_0x31fc80,null));};exports[_0x9431('0x76')]=function(_0x5f49c6,_0xbf619c){var _0x2b3571={'name':_0x5f49c6['body']['name'],'key':_0x5f49c6[_0x9431('0x66')][_0x9431('0x4c')],'provider':_0x5f49c6['body'][_0x9431('0x67')]===_0x9431('0x68')?null:_0x5f49c6[_0x9431('0x66')][_0x9431('0x67')],'email':_0x5f49c6[_0x9431('0x66')][_0x9431('0x77')],'ListId':_0x5f49c6[_0x9431('0x66')][_0x9431('0x78')],'active':!_['isNil'](_0x5f49c6[_0x9431('0x66')][_0x9431('0x79')])?_0x5f49c6['body'][_0x9431('0x79')]:!![],'description':_0x5f49c6[_0x9431('0x66')][_0x9431('0x7a')]||null};var _0x4ac0e5=getAuthenticationOptions(_0x2b3571['provider'],_0x5f49c6[_0x9431('0x66')]);_0x2b3571[_0x9431('0x42')]=_0x4ac0e5[_0x9431('0x42')];_0x2b3571['Smtp']=_0x4ac0e5[_0x9431('0x43')];return db[_0x9431('0x48')][_0x9431('0x76')](_0x2b3571,{'include':[{'model':db[_0x9431('0x45')],'as':_0x9431('0x43')},{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')}]})['then'](function(_0x13a757){var _0x530a75=_0x5f49c6[_0x9431('0x37')][_0x9431('0x27')]({'plain':!![]});if(!_0x530a75)throw new Error(_0x9431('0x7b'));if(_0x530a75['role']===_0x9431('0x37')){var _0x1bf3f7=_0x13a757[_0x9431('0x27')]({'plain':!![]});return db[_0x9431('0x7c')][_0x9431('0x65')]({'where':{'name':_0x9431('0x28'),'userProfileId':_0x530a75[_0x9431('0x7d')]},'raw':!![]})[_0x9431('0x13')](function(_0x3c304b){if(_0x3c304b&&_0x3c304b[_0x9431('0x7e')]===0x0){return db[_0x9431('0x29')]['create']({'name':_0x1bf3f7[_0x9431('0x2b')],'resourceId':_0x1bf3f7['id'],'type':_0x3c304b[_0x9431('0x2b')],'sectionId':_0x3c304b['id']},{})[_0x9431('0x13')](function(){return _0x13a757;});}else{return _0x13a757;}})[_0x9431('0x1c')](function(_0x34ab56){logger[_0x9431('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34ab56);throw _0x34ab56;});}return _0x13a757;})['then'](respondWithResult(_0xbf619c,0xc9))[_0x9431('0x1c')](handleError(_0xbf619c,null));};exports[_0x9431('0x7f')]=function(_0x5707f7,_0x4cfe03){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x5707f7['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x4cfe03,null))[_0x9431('0x13')](function(_0x167758){if(_0x167758){return _0x167758[_0x9431('0x7f')]();}return null;})[_0x9431('0x13')](respondWithResult(_0x4cfe03,null))[_0x9431('0x1c')](handleError(_0x4cfe03,null));};exports[_0x9431('0x80')]=function(_0x11ef03,_0x4154e5){if(_0x11ef03[_0x9431('0x66')]['id']){delete _0x11ef03['body']['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x11ef03[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x4154e5,null))[_0x9431('0x13')](function(_0x279d1e){if(_0x279d1e){_0x11ef03[_0x9431('0x66')][_0x9431('0x6b')]=_0x279d1e['id'];return db[_0x9431('0x62')][_0x9431('0x76')](_0x11ef03[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0x4154e5,null))['catch'](handleError(_0x4154e5,null));};exports[_0x9431('0x81')]=function(_0x7e3935,_0x28e7b2){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x7e3935[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x28e7b2,null))[_0x9431('0x13')](function(_0x528cbb){if(_0x528cbb){return _0x528cbb[_0x9431('0x82')](null);}return null;})[_0x9431('0x13')](respondWithStatusCode(_0x28e7b2,null))[_0x9431('0x1c')](handleError(_0x28e7b2,null));};exports[_0x9431('0x83')]=function(_0x3323e7,_0x1cad72){return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x3323e7['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x1cad72,null))[_0x9431('0x13')](function(_0x2b41a0){if(_0x2b41a0){return _0x2b41a0['getSmtp']();}return null;})['then'](respondWithResult(_0x1cad72,null))['catch'](handleError(_0x1cad72,null));};exports['addSmtp']=function(_0x31f61e,_0x236bb4){if(_0x31f61e[_0x9431('0x66')]['id']){delete _0x31f61e[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x31f61e[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x236bb4,null))[_0x9431('0x13')](function(_0x192bd6){if(_0x192bd6){_0x31f61e[_0x9431('0x66')][_0x9431('0x6b')]=_0x192bd6['id'];return db[_0x9431('0x45')][_0x9431('0x76')](_0x31f61e[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0x236bb4,null))[_0x9431('0x1c')](handleError(_0x236bb4,null));};exports[_0x9431('0x84')]=function(_0x502f08,_0x442c8e){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x502f08['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x442c8e,null))[_0x9431('0x13')](function(_0x9e2309){if(_0x9e2309){return _0x9e2309[_0x9431('0x85')](null);}return null;})[_0x9431('0x13')](respondWithStatusCode(_0x442c8e,null))['catch'](handleError(_0x442c8e,null));};exports[_0x9431('0x86')]=function(_0x4fde86,_0x97748e){return db[_0x9431('0x87')]['find']({'where':{'id':_0x4fde86[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x97748e,null))[_0x9431('0x13')](function(_0x214bec){if(_0x214bec){return _0x214bec[_0x9431('0x86')](_0x4fde86[_0x9431('0x66')][_0x9431('0x71')],_[_0x9431('0x88')](_0x4fde86[_0x9431('0x66')],[_0x9431('0x71'),'id'])||{});}})[_0x9431('0x13')](respondWithResult(_0x97748e,null))[_0x9431('0x1c')](handleError(_0x97748e,null));};exports[_0x9431('0x89')]=function(_0x5545a0,_0x4187bb){var _0x168b13={'raw':![],'where':{}};var _0x3bd523={};var _0x56a076={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x5545a0[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x4187bb,null))[_0x9431('0x13')](function(_0x3e78c8){if(_0x3e78c8){_0x3bd523[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x87')]['rawAttributes']);_0x3bd523[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x5545a0[_0x9431('0x4e')]);_0x3bd523['filters']=_[_0x9431('0x50')](_0x3bd523[_0x9431('0x4d')],_0x3bd523[_0x9431('0x4e')]);_0x168b13['attributes']=_['intersection'](_0x3bd523[_0x9431('0x4d')],qs['fields'](_0x5545a0[_0x9431('0x4e')][_0x9431('0x51')]));_0x168b13[_0x9431('0x52')]=_0x168b13['attributes'][_0x9431('0x53')]?_0x168b13[_0x9431('0x52')]:_0x3bd523[_0x9431('0x4d')];if(!_0x5545a0['query']['hasOwnProperty'](_0x9431('0x55'))){_0x168b13[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x5545a0[_0x9431('0x4e')][_0x9431('0x23')]);_0x168b13[_0x9431('0x20')]=qs['offset'](_0x5545a0[_0x9431('0x4e')]['offset']);}_0x168b13[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x5545a0[_0x9431('0x4e')]['sort']);_0x168b13[_0x9431('0x58')]=qs['filters'](_[_0x9431('0x6f')](_0x5545a0[_0x9431('0x4e')],_0x3bd523[_0x9431('0x59')]));_0x168b13[_0x9431('0x58')]['MailAccountId']=_0x3e78c8['id'];if(_0x5545a0[_0x9431('0x4e')]['filter']){_0x168b13['where']=_[_0x9431('0x5c')](_0x168b13[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x168b13[_0x9431('0x52')],function(_0x46f3f7){var _0x4969d5={};_0x4969d5[_0x46f3f7]={'$like':'%'+_0x5545a0[_0x9431('0x4e')]['filter']+'%'};return _0x4969d5;})});}_0x168b13=_[_0x9431('0x5c')]({},_0x168b13,_0x5545a0[_0x9431('0x5d')]);return db[_0x9431('0x87')]['count']({'where':_0x168b13[_0x9431('0x58')]})[_0x9431('0x13')](function(_0x22f179){_0x56a076[_0x9431('0x22')]=_0x22f179;if(_0x5545a0['query'][_0x9431('0x64')]){_0x168b13[_0x9431('0x5e')]=[{'model':db[_0x9431('0x8a')],'as':_0x9431('0x8b'),'required':![]},{'model':db[_0x9431('0x8c')],'as':'Owner','attributes':['name',_0x9431('0x8d'),_0x9431('0x8e')],'required':![]},{'model':db[_0x9431('0x8f')],'as':_0x9431('0x90'),'attributes':['id',_0x9431('0x2b'),_0x9431('0x91')],'where':_0x5545a0['query'][_0x9431('0x92')]?{'id':_0x5545a0['query']['tag']}:undefined,'required':_0x5545a0[_0x9431('0x4e')][_0x9431('0x92')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x168b13);})[_0x9431('0x13')](function(_0x369bf5){_0x56a076['rows']=_0x369bf5;return _0x56a076;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x4187bb,_0x168b13))[_0x9431('0x1c')](handleError(_0x4187bb,null));};exports['addApplications']=function addApplications(_0x3383a5,_0x2a921b){var _0x268ef1=_0x3383a5['params']['id'];var _0x57ff55=_0x3383a5[_0x9431('0x66')];var _0x5b68d6=0xc8;var _0x3741f0=null;return db[_0x9431('0x93')]['transaction']({'isolationLevel':db[_0x9431('0x93')][_0x9431('0x94')][_0x9431('0x95')]['READ_COMMITTED']},function(_0x27331b){return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x268ef1},'transaction':_0x27331b})['then'](function(_0x1de599){if(_0x1de599){return db[_0x9431('0x96')][_0x9431('0x97')]({'where':{'MailAccountId':_0x268ef1},'transaction':_0x27331b})['then'](function(){var _0x57e6e0=_['map'](_0x57ff55,function(_0xa474f6){_0xa474f6[_0x9431('0x6b')]=_0x268ef1;return _0xa474f6;});return db['MailApplication'][_0x9431('0x98')](_0x57e6e0,{'transaction':_0x27331b});});}else{_0x5b68d6=0x194;_0x3741f0=[];}});})['then'](function(){if(_0x5b68d6!==0x194){return db[_0x9431('0x96')][_0x9431('0x99')]({'where':{'MailAccountId':_0x268ef1},'order':_0x9431('0x9a')})[_0x9431('0x13')](function(_0x27c70){_0x3741f0=_0x27c70;});}})[_0x9431('0x1c')](function(_0x53565a){_0x5b68d6=0x1f4;logger[_0x9431('0x17')](_0x53565a[_0x9431('0x2a')]);if(_0x53565a['name']){delete _0x53565a['name'];}_0x3741f0=_0x53565a;})[_0x9431('0x9b')](function(){if(_0x3741f0===null){_0x2a921b['sendStatus'](_0x5b68d6);}else{if(_0x5b68d6===0x1f4){_0x2a921b[_0x9431('0x1f')](_0x5b68d6)[_0x9431('0x2c')](_0x3741f0);}else{_0x2a921b[_0x9431('0x1f')](_0x5b68d6)[_0x9431('0x25')](_0x3741f0);}}});};exports[_0x9431('0x9c')]=function(_0x245199,_0x3f8bea){var _0x4b934d={};var _0x41ae65={};var _0x4c2f22;var _0x28c1ba;return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x245199[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x3f8bea,null))[_0x9431('0x13')](function(_0x4eef81){if(_0x4eef81){_0x4c2f22=_0x4eef81;_0x41ae65[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x96')][_0x9431('0x49')]);_0x41ae65[_0x9431('0x4e')]=_['keys'](_0x245199[_0x9431('0x4e')]);_0x41ae65[_0x9431('0x59')]=_['intersection'](_0x41ae65[_0x9431('0x4d')],_0x41ae65['query']);_0x4b934d['attributes']=_[_0x9431('0x50')](_0x41ae65[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x245199['query'][_0x9431('0x51')]));_0x4b934d[_0x9431('0x52')]=_0x4b934d[_0x9431('0x52')][_0x9431('0x53')]?_0x4b934d[_0x9431('0x52')]:_0x41ae65[_0x9431('0x4d')];_0x4b934d[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x245199['query']['sort']);_0x4b934d[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x245199[_0x9431('0x4e')],_0x41ae65['filters']));if(_0x245199[_0x9431('0x4e')][_0x9431('0x5a')]){_0x4b934d['where']=_[_0x9431('0x5c')](_0x4b934d[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x4b934d[_0x9431('0x52')],function(_0x5b5af7){var _0x108585={};_0x108585[_0x5b5af7]={'$like':'%'+_0x245199[_0x9431('0x4e')]['filter']+'%'};return _0x108585;})});}_0x4b934d=_[_0x9431('0x5c')]({},_0x4b934d,_0x245199[_0x9431('0x5d')]);return _0x4c2f22[_0x9431('0x9c')](_0x4b934d);}})[_0x9431('0x13')](function(_0x198c69){if(_0x198c69){_0x28c1ba=_0x198c69[_0x9431('0x53')];if(!_0x245199['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x4b934d[_0x9431('0x23')]=qs['limit'](_0x245199[_0x9431('0x4e')][_0x9431('0x23')]);_0x4b934d['offset']=qs[_0x9431('0x20')](_0x245199['query']['offset']);}return _0x4c2f22[_0x9431('0x9c')](_0x4b934d);}})[_0x9431('0x13')](function(_0x3198c1){if(_0x3198c1){return _0x3198c1?{'count':_0x28c1ba,'rows':_0x3198c1}:null;}})['then'](respondWithResult(_0x3f8bea,null))['catch'](handleError(_0x3f8bea,null));};exports[_0x9431('0x9d')]=function(_0x248935,_0x552d6a){var _0x510295={'raw':!![],'where':{}};var _0x43dc44={};var _0x3afac2={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x248935[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x552d6a,null))[_0x9431('0x13')](function(_0x1c2760){if(_0x1c2760){_0x43dc44['model']=_[_0x9431('0x4f')](db['MailMessage'][_0x9431('0x49')]);_0x43dc44[_0x9431('0x4e')]=_['keys'](_0x248935[_0x9431('0x4e')]);_0x43dc44[_0x9431('0x59')]=_[_0x9431('0x50')](_0x43dc44[_0x9431('0x4d')],_0x43dc44[_0x9431('0x4e')]);_0x510295[_0x9431('0x52')]=_[_0x9431('0x50')](_0x43dc44[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x248935[_0x9431('0x4e')]['fields']));_0x510295[_0x9431('0x52')]=_0x510295[_0x9431('0x52')][_0x9431('0x53')]?_0x510295['attributes']:_0x43dc44[_0x9431('0x4d')];if(!_0x248935['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x510295['limit']=qs[_0x9431('0x23')](_0x248935[_0x9431('0x4e')][_0x9431('0x23')]);_0x510295['offset']=qs[_0x9431('0x20')](_0x248935[_0x9431('0x4e')][_0x9431('0x20')]);}_0x510295[_0x9431('0x56')]=qs['sort'](_0x248935[_0x9431('0x4e')][_0x9431('0x57')]);_0x510295['where']=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x248935['query'],_0x43dc44[_0x9431('0x59')]));_0x510295[_0x9431('0x58')][_0x9431('0x6b')]=_0x1c2760['id'];if(_0x248935[_0x9431('0x4e')]['filter']){_0x510295[_0x9431('0x58')]=_[_0x9431('0x5c')](_0x510295['where'],{'$or':_[_0x9431('0x47')](_0x510295[_0x9431('0x52')],function(_0x38d57c){var _0x3e19d6={};_0x3e19d6[_0x38d57c]={'$like':'%'+_0x248935[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x3e19d6;})});}if(_0x248935[_0x9431('0x4e')]['$gte']){var _0x518da1=_0x248935['query']['$gte'][_0x9431('0x9e')](',');var _0x4a5fcf={};_0x4a5fcf[_0x518da1[0x0]]={'$gte':moment(_0x518da1[0x1])[_0x9431('0x9f')](_0x9431('0xa0'))};_0x510295[_0x9431('0x58')]=_['merge'](_0x510295[_0x9431('0x58')],_0x4a5fcf);}_0x510295=_[_0x9431('0x5c')]({},_0x510295,_0x248935[_0x9431('0x5d')]);return db[_0x9431('0xa1')]['count']({'where':_0x510295[_0x9431('0x58')]})['then'](function(_0x5cfc55){_0x3afac2[_0x9431('0x22')]=_0x5cfc55;if(_0x248935[_0x9431('0x4e')][_0x9431('0x64')]){_0x510295['include']=[{'all':!![]}];}return db[_0x9431('0xa1')]['findAll'](_0x510295);})[_0x9431('0x13')](function(_0x2c5fd7){if(_0x248935[_0x9431('0x4e')][_0x9431('0xa2')]==='true'){for(var _0x4759ba=0x0;_0x4759ba<_0x2c5fd7['length'];_0x4759ba++){_0x2c5fd7[_0x4759ba][_0x9431('0x66')]=juice(_0x2c5fd7[_0x4759ba][_0x9431('0x66')]);}}_0x3afac2[_0x9431('0x70')]=_0x2c5fd7;return _0x3afac2;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x552d6a,_0x510295))[_0x9431('0x1c')](handleError(_0x552d6a,null));};exports[_0x9431('0x2c')]=function(_0x167cc8,_0xf7333c){var _0x59adbf,_0x24fa27={},_0x12651d;if(_0x167cc8[_0x9431('0x66')]['to']){_0x12651d=_0x167cc8['body']['to']['split'](',')[0x0];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x167cc8['params']['id']},'include':[{'model':db[_0x9431('0xa3')],'as':_0x9431('0xa4'),'include':[{'model':db[_0x9431('0x8a')],'as':'Contacts','where':{'email':_0x12651d},'limit':0x1,'order':[[_0x9431('0xa5'),_0x9431('0xa6')]]}]},{'model':db[_0x9431('0x45')],'as':_0x9431('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0xf7333c,null))['then'](function(_0x7ba994){if(!_0x7ba994)return;_0x59adbf=_0x7ba994;if(!_0x7ba994[_0x9431('0x43')])throw new Error(_0x9431('0xa7'));if(_[_0x9431('0xa8')](_0x167cc8['body'][_0x9431('0xa9')])){_0x167cc8[_0x9431('0x66')]['from']=util[_0x9431('0x9f')](_0x9431('0xaa'),_0x7ba994[_0x9431('0x2b')],_0x7ba994[_0x9431('0x77')]||_0x7ba994[_0x9431('0x43')]['user']);}if(_0x167cc8['body'][_0x9431('0xab')]&&_0x167cc8['body'][_0x9431('0xab')][_0x9431('0x53')]){for(var _0x277d60=0x0;_0x277d60<_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x9431('0x53')];_0x277d60+=0x1){_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60]={'filename':_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60][_0x9431('0x2b')],'path':path[_0x9431('0xac')](config[_0x9431('0xad')],'server/files/attachments',_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60]['basename'])};}}var _0x578064=_0x7ba994['getSmtpOptions']();return respondWithRpcPromise(_0x9431('0xae'),'sendMail',{'account':_0x578064,'message':_0x167cc8['body']});})['then'](function(_0x495356){if(!_0x495356)return;_0x24fa27=_0x495356;if(!_0x59adbf[_0x9431('0xa4')])throw new Error(_0x9431('0xaf'));if(_0x59adbf[_0x9431('0xa4')][_0x9431('0xb0')][_0x9431('0x53')])return _0x59adbf[_0x9431('0xa4')][_0x9431('0xb0')][0x0];return db[_0x9431('0x8a')][_0x9431('0x76')](_[_0x9431('0xb')](_0x167cc8[_0x9431('0x66')],{'firstName':_0x167cc8[_0x9431('0x66')]['to'],'email':_0x167cc8[_0x9431('0x66')]['to'],'phone':_0x167cc8[_0x9431('0x66')]['to'],'ListId':_0x59adbf[_0x9431('0x78')]}));})['then'](function(_0x315133){if(!_0x315133)return;var _0x53b5f0={'UserId':_0x167cc8[_0x9431('0x37')]['id'],'ContactId':_0x315133['id'],'MailAccountId':_0x59adbf['id'],'inReplyTo':_0x24fa27[_0x9431('0xb1')],'to':_0x167cc8[_0x9431('0x66')][_0x9431('0xa9')],'cc':_0x167cc8['body']['cc'],'subject':_0x167cc8[_0x9431('0x66')][_0x9431('0xb2')],'attach':_0x167cc8[_0x9431('0x66')][_0x9431('0xb3')],'firstMsgDirection':_0x9431('0xb4'),'lastMsgAt':moment()[_0x9431('0x9f')](_0x9431('0xa0')),'lastMsgDirection':_0x9431('0xb4'),'Messages':[_['merge'](_0x167cc8[_0x9431('0x66')],{'messageId':_0x24fa27[_0x9431('0xb1')],'sentAt':moment()[_0x9431('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x59adbf['id'],'UserId':_0x167cc8[_0x9431('0x37')]['id'],'ContactId':_0x315133['id']})]};if(_0x167cc8[_0x9431('0x66')][_0x9431('0xb5')]){_0x53b5f0=_['merge'](_0x53b5f0,_0x167cc8[_0x9431('0x66')][_0x9431('0xb5')]);}return db[_0x9431('0x87')][_0x9431('0x76')](_0x53b5f0,{'include':[{'model':db[_0x9431('0xa1')],'as':_0x9431('0xb6')}]});})[_0x9431('0x13')](respondWithResult(_0xf7333c,null))[_0x9431('0x1c')](handleError(_0xf7333c,null));};exports[_0x9431('0xb7')]=function(_0x3ade86,_0x5e787c){return db['MailAccount'][_0x9431('0x65')]({'where':{'id':_0x3ade86[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9431('0xb8')],'as':_0x9431('0xb8'),'raw':!![]}]}]})[_0x9431('0x13')](handleEntityNotFound(_0x5e787c,null))[_0x9431('0x13')](function(_0x57a949){if(!_0x57a949['Smtp'])return;var _0x148d46=_0x57a949[_0x9431('0xb9')]();return respondWithRpcPromise(_0x9431('0xba'),_0x9431('0xb7'),{'account':_0x148d46});})[_0x9431('0x13')](respondWithResult(_0x5e787c,null))[_0x9431('0x1c')](handleError(_0x5e787c,null));};exports[_0x9431('0x97')]=function(_0x4aa6fa,_0x31827f){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x4aa6fa['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x31827f,null))[_0x9431('0x13')](function(_0xfc3a18){if(_0xfc3a18&&_0xfc3a18[_0x9431('0x3f')]){throw new db[(_0x9431('0xbb'))][(_0x9431('0xbc'))](_0x9431('0xbd'));}return _0xfc3a18;})[_0x9431('0x13')](removeEntity(_0x31827f,null))[_0x9431('0x1c')](handleError(_0x31827f,null));};exports[_0x9431('0xbe')]=function(_0x30a3ea,_0xf51165){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x30a3ea[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xf51165,null))['then'](function(_0x331243){if(_0x331243){return _0x331243['addAgents'](_0x30a3ea['body']['ids'],_[_0x9431('0x88')](_0x30a3ea['body'],[_0x9431('0x71'),'id'])||{})[_0x9431('0xbf')](function(_0x3665cb){for(var _0x1db5d5=0x0;_0x1db5d5<_0x30a3ea[_0x9431('0x66')][_0x9431('0x71')][_0x9431('0x53')];_0x1db5d5+=0x1){socket[_0x9431('0xc0')](_0x9431('0xc1'),{'UserId':Number(_0x30a3ea['body'][_0x9431('0x71')][_0x1db5d5]),'MailAccountId':Number(_0x30a3ea['params']['id'])});}return _0x3665cb;});}})[_0x9431('0x13')](respondWithResult(_0xf51165,null))[_0x9431('0x1c')](handleError(_0xf51165,null));};exports[_0x9431('0xc2')]=function(_0x26a907,_0x11c858){return db[_0x9431('0x48')]['find']({'where':{'id':_0x26a907[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x11c858,null))[_0x9431('0x13')](function(_0x52465c){if(_0x52465c){return _0x52465c[_0x9431('0xc2')](_0x26a907[_0x9431('0x4e')][_0x9431('0x71')])[_0x9431('0x13')](function(){if(_[_0x9431('0xc3')](_0x26a907[_0x9431('0x4e')][_0x9431('0x71')])){for(var _0x45a875=0x0;_0x45a875<_0x26a907['query'][_0x9431('0x71')][_0x9431('0x53')];_0x45a875+=0x1){socket[_0x9431('0xc0')](_0x9431('0xc4'),{'UserId':Number(_0x26a907[_0x9431('0x4e')]['ids'][_0x45a875]),'MailAccountId':Number(_0x26a907['params']['id'])});}}else{socket[_0x9431('0xc0')](_0x9431('0xc4'),{'UserId':Number(_0x26a907[_0x9431('0x4e')][_0x9431('0x71')]),'MailAccountId':Number(_0x26a907[_0x9431('0x61')]['id'])});}});}})[_0x9431('0x13')](respondWithStatusCode(_0x11c858,null))[_0x9431('0x1c')](handleError(_0x11c858,null));};exports[_0x9431('0xc5')]=function(_0x4cf768,_0xb74a0a){var _0x570f5f={};var _0x2f4319={};var _0x15636e;var _0x506d8e;return db[_0x9431('0x48')]['findOne']({'where':{'id':_0x4cf768[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xb74a0a,null))['then'](function(_0x4301fa){if(_0x4301fa){_0x15636e=_0x4301fa;_0x2f4319[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x8c')]['rawAttributes']);_0x2f4319[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x4cf768[_0x9431('0x4e')]);_0x2f4319[_0x9431('0x59')]=_[_0x9431('0x50')](_0x2f4319[_0x9431('0x4d')],_0x2f4319[_0x9431('0x4e')]);_0x570f5f['attributes']=_[_0x9431('0x50')](_0x2f4319[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x4cf768[_0x9431('0x4e')][_0x9431('0x51')]));_0x570f5f[_0x9431('0x52')]=_0x570f5f[_0x9431('0x52')][_0x9431('0x53')]?_0x570f5f['attributes']:_0x2f4319[_0x9431('0x4d')];_0x570f5f['order']=qs[_0x9431('0x57')](_0x4cf768[_0x9431('0x4e')]['sort']);_0x570f5f[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x4cf768[_0x9431('0x4e')],_0x2f4319[_0x9431('0x59')]));if(_0x4cf768[_0x9431('0x4e')][_0x9431('0x5a')]){_0x570f5f[_0x9431('0x58')]=_['merge'](_0x570f5f[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x570f5f[_0x9431('0x52')],function(_0x1f54f2){var _0x264088={};_0x264088[_0x1f54f2]={'$like':'%'+_0x4cf768[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x264088;})});}_0x570f5f=_[_0x9431('0x5c')]({},_0x570f5f,_0x4cf768['options']);return _0x15636e['getAgents'](_0x570f5f);}})['then'](function(_0x4a25a6){if(_0x4a25a6){_0x506d8e=_0x4a25a6['length'];if(!_0x4cf768['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x570f5f[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x4cf768[_0x9431('0x4e')][_0x9431('0x23')]);_0x570f5f[_0x9431('0x20')]=qs['offset'](_0x4cf768[_0x9431('0x4e')]['offset']);}return _0x15636e[_0x9431('0xc5')](_0x570f5f);}})['then'](function(_0x1f9ae8){if(_0x1f9ae8){return _0x1f9ae8?{'count':_0x506d8e,'rows':_0x1f9ae8}:null;}})[_0x9431('0x13')](respondWithResult(_0xb74a0a,null))[_0x9431('0x1c')](handleError(_0xb74a0a,null));}; \ No newline at end of file +var _0x8366=['code','message','sendStatus','status','offset','limit','undefined','count','set','Content-Range','then','destroy','MailAccounts','UserProfileResource','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','keys','length','includeAll','find','update','body','custom','provider','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','key','email','ListId','isNil','active','description','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','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','send','json','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','VerifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','juice','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b4922,_0x316080){var _0x5ae0c2=function(_0x498e39){while(--_0x498e39){_0x4b4922['push'](_0x4b4922['shift']());}};_0x5ae0c2(++_0x316080);}(_0x8366,0xa8));var _0x6836=function(_0x53bf9b,_0x1ad4bc){_0x53bf9b=_0x53bf9b-0x0;var _0x22960c=_0x8366[_0x53bf9b];return _0x22960c;};'use strict';var moment=require(_0x6836('0x0'));var BPromise=require('bluebird');var util=require(_0x6836('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x6836('0x2'));var Redis=require(_0x6836('0x3'));var qs=require(_0x6836('0x4'));var logger=require(_0x6836('0x5'))(_0x6836('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6836('0x7')]=_[_0x6836('0x8')](config[_0x6836('0x7')],{'host':_0x6836('0x9'),'port':0x18eb});var socket=require(_0x6836('0xa'))(new Redis(config[_0x6836('0x7')]));require(_0x6836('0xb'))[_0x6836('0xc')](socket);var jayson=require(_0x6836('0xd'));var client=jayson[_0x6836('0xe')][_0x6836('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x28bd6f,_0x579382,_0x93c32,_0x3e2c0e){return new BPromise(function(_0x508b68,_0x4ba6e5){var _0x5d3146=_0x3e2c0e||client;return _0x5d3146[_0x6836('0x10')](_0x28bd6f,_0x93c32)['then'](function(_0x1cdeb0){logger[_0x6836('0x11')](_0x6836('0x12'),_0x579382,_0x6836('0x13'));logger[_0x6836('0x14')](_0x6836('0x15'),_0x579382,'request\x20sent',JSON[_0x6836('0x16')](_0x1cdeb0));if(_0x1cdeb0[_0x6836('0x17')]){if(_0x1cdeb0[_0x6836('0x17')][_0x6836('0x18')]===0x1f4){logger['error'](_0x6836('0x12'),_0x579382,_0x1cdeb0[_0x6836('0x17')][_0x6836('0x19')]);return _0x4ba6e5(_0x1cdeb0[_0x6836('0x17')][_0x6836('0x19')]);}logger[_0x6836('0x17')](_0x6836('0x12'),_0x579382,_0x1cdeb0[_0x6836('0x17')][_0x6836('0x19')]);return _0x508b68(_0x1cdeb0[_0x6836('0x17')]['message']);}else{logger[_0x6836('0x11')]('MailAccount,\x20%s,\x20%s',_0x579382,_0x6836('0x13'));_0x508b68(_0x1cdeb0['result'][_0x6836('0x19')]);}})['catch'](function(_0x2b1670){logger[_0x6836('0x17')]('MailAccount,\x20%s,\x20%s',_0x579382,_0x2b1670);_0x4ba6e5(_0x2b1670);});});}function respondWithStatusCode(_0x2a0925,_0x1b9874){_0x1b9874=_0x1b9874||0xcc;return function(_0x1c142b){if(_0x1c142b){return _0x2a0925[_0x6836('0x1a')](_0x1b9874);}return _0x2a0925['status'](_0x1b9874)['end']();};}function respondWithResult(_0x3921c5,_0x207e8f){_0x207e8f=_0x207e8f||0xc8;return function(_0x89f266){if(_0x89f266){return _0x3921c5[_0x6836('0x1b')](_0x207e8f)['json'](_0x89f266);}};}function respondWithFilteredResult(_0x1a9b18,_0x3985e1){return function(_0x1354bd){if(_0x1354bd){var _0x5425cd=typeof _0x3985e1[_0x6836('0x1c')]==='undefined'&&typeof _0x3985e1[_0x6836('0x1d')]===_0x6836('0x1e');var _0x5d4895=_0x1354bd[_0x6836('0x1f')];var _0x310334=_0x5425cd?0x0:_0x3985e1['offset'];var _0x1e267d=_0x5425cd?_0x1354bd[_0x6836('0x1f')]:_0x3985e1[_0x6836('0x1c')]+_0x3985e1[_0x6836('0x1d')];var _0x2fabe3;if(_0x1e267d>=_0x5d4895){_0x1e267d=_0x5d4895;_0x2fabe3=0xc8;}else{_0x2fabe3=0xce;}_0x1a9b18[_0x6836('0x1b')](_0x2fabe3);return _0x1a9b18[_0x6836('0x20')](_0x6836('0x21'),_0x310334+'-'+_0x1e267d+'/'+_0x5d4895)['json'](_0x1354bd);}return null;};}function saveUpdates(_0x1b9fe6){return function(_0x4a1bc4){if(_0x4a1bc4){return _0x4a1bc4['update'](_0x1b9fe6)[_0x6836('0x22')](function(_0x4878bb){return _0x4878bb;});}return null;};}function removeEntity(_0x52dd41){return function(_0x1a3c6a){if(_0x1a3c6a){return _0x1a3c6a[_0x6836('0x23')]()[_0x6836('0x22')](function(){var _0x525065=_0x1a3c6a['get']({'plain':!![]});var _0x9e45e7=_0x6836('0x24');return db[_0x6836('0x25')][_0x6836('0x23')]({'where':{'type':_0x9e45e7,'resourceId':_0x525065['id']}})['then'](function(){return _0x1a3c6a;});})[_0x6836('0x22')](function(){_0x52dd41[_0x6836('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3406c2){return function(_0x584395){if(!_0x584395){_0x3406c2[_0x6836('0x1a')](0x194);}return _0x584395;};}function handleError(_0x7e8f08,_0x598d77){_0x598d77=_0x598d77||0x1f4;return function(_0x2a65fd){logger[_0x6836('0x17')](_0x2a65fd['stack']);if(_0x2a65fd[_0x6836('0x26')]){delete _0x2a65fd['name'];}_0x7e8f08['status'](_0x598d77)['send'](_0x2a65fd);};}function getImapHost(_0x3b6e84){switch(_0x3b6e84){case _0x6836('0x27'):return _0x6836('0x28');case _0x6836('0x29'):return _0x6836('0x2a');case _0x6836('0x2b'):return'imap-mail.outlook.com';case _0x6836('0x2c'):return _0x6836('0x2d');}throw new Error(_0x6836('0x2e'),_0x3b6e84);}function getSmtpHost(_0x33f544){switch(_0x33f544){case'gmail':return _0x6836('0x2f');case _0x6836('0x29'):return _0x6836('0x30');case _0x6836('0x2b'):return'smtp-mail.outlook.com';case _0x6836('0x2c'):return _0x6836('0x31');}throw new Error(_0x6836('0x2e'),_0x33f544);}function getAuthenticationOptions(_0x438dd9,_0x504289){var _0x3a533b={};var _0x5de2c5={};if(_0x438dd9){_0x3a533b[_0x6836('0x32')]=_0x5de2c5[_0x6836('0x32')]=_0x504289['username'];_0x3a533b['password']=_0x5de2c5[_0x6836('0x33')]=_0x504289[_0x6836('0x34')];if(_0x504289[_0x6836('0x35')]){_0x3a533b[_0x6836('0x35')]=_0x5de2c5[_0x6836('0x35')]=!![];_0x3a533b[_0x6836('0x36')]=_0x5de2c5['CloudProviderId']=_0x504289[_0x6836('0x36')];_0x3a533b[_0x6836('0x34')]=_0x5de2c5[_0x6836('0x33')]=null;}else{_0x3a533b[_0x6836('0x36')]=_0x5de2c5[_0x6836('0x36')]=null;}_0x3a533b[_0x6836('0x37')]=getImapHost(_0x438dd9);_0x3a533b[_0x6836('0x38')]=0x3e1;_0x5de2c5[_0x6836('0x37')]=getSmtpHost(_0x438dd9);_0x5de2c5[_0x6836('0x38')]=0x24b;_0x5de2c5[_0x6836('0x39')]=![];_0x3a533b['service']=_0x5de2c5[_0x6836('0x3a')]=null;}else{if(_0x504289[_0x6836('0x3b')]){_0x3a533b[_0x6836('0x32')]=_0x5de2c5[_0x6836('0x32')]=_0x504289[_0x6836('0x3c')];_0x3a533b['password']=_0x5de2c5[_0x6836('0x33')]=_0x504289[_0x6836('0x34')];}else{_0x3a533b[_0x6836('0x3b')]=_0x5de2c5['authentication']=![];_0x3a533b[_0x6836('0x32')]=_0x5de2c5['user']=null;_0x3a533b['password']=_0x5de2c5['pass']=null;}_0x3a533b['host']=_0x504289[_0x6836('0x3d')][_0x6836('0x37')];_0x3a533b[_0x6836('0x38')]=_0x504289['Imap'][_0x6836('0x38')];_0x5de2c5[_0x6836('0x37')]=_0x504289[_0x6836('0x3e')]['host'];_0x5de2c5[_0x6836('0x38')]=_0x504289[_0x6836('0x3e')]['port'];}return{'Imap':_0x3a533b,'Smtp':_0x5de2c5};}exports['index']=function(_0x590484,_0x66b99){var _0x98c758={'include':[{'model':db[_0x6836('0x3f')],'as':_0x6836('0x3d')},{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e')},{'model':db[_0x6836('0x41')],'as':_0x6836('0x42')}]},_0x1cc549={},_0x38ef7f={'count':0x0,'rows':[]};var _0x2e3e49=_[_0x6836('0x43')](db[_0x6836('0x44')][_0x6836('0x45')],function(_0x518955){return{'name':_0x518955[_0x6836('0x46')],'type':_0x518955[_0x6836('0x47')]['key']};});_0x1cc549[_0x6836('0x48')]=_[_0x6836('0x43')](_0x2e3e49,_0x6836('0x26'));_0x1cc549[_0x6836('0x49')]=_['keys'](_0x590484['query']);_0x1cc549[_0x6836('0x4a')]=_[_0x6836('0x4b')](_0x1cc549[_0x6836('0x48')],_0x1cc549[_0x6836('0x49')]);_0x98c758[_0x6836('0x4c')]=_['intersection'](_0x1cc549[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x590484[_0x6836('0x49')]['fields']));_0x98c758['attributes']=_0x98c758[_0x6836('0x4c')]['length']?_0x98c758['attributes']:_0x1cc549[_0x6836('0x48')];if(!_0x590484['query']['hasOwnProperty'](_0x6836('0x4e'))){_0x98c758[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x590484[_0x6836('0x49')][_0x6836('0x1d')]);_0x98c758[_0x6836('0x1c')]=qs[_0x6836('0x1c')](_0x590484[_0x6836('0x49')][_0x6836('0x1c')]);}_0x98c758[_0x6836('0x4f')]=qs['sort'](_0x590484['query'][_0x6836('0x50')]);_0x98c758[_0x6836('0x51')]=qs['filters'](_[_0x6836('0x52')](_0x590484[_0x6836('0x49')],_0x1cc549[_0x6836('0x4a')]),_0x2e3e49);if(_0x590484[_0x6836('0x49')][_0x6836('0x53')]){_0x98c758[_0x6836('0x51')]=_[_0x6836('0x54')](_0x98c758[_0x6836('0x51')],{'$or':_[_0x6836('0x43')](_0x2e3e49,function(_0xa549df){if(_0xa549df[_0x6836('0x47')]!=='VIRTUAL'){var _0x102dbb={};_0x102dbb[_0xa549df['name']]={'$like':'%'+_0x590484[_0x6836('0x49')][_0x6836('0x53')]+'%'};return _0x102dbb;}})});}_0x98c758=_[_0x6836('0x54')]({},_0x98c758,_0x590484[_0x6836('0x55')]);var _0x425d87={'where':_0x98c758['where']};return db[_0x6836('0x44')]['count'](_0x425d87)[_0x6836('0x22')](function(_0x248e49){_0x38ef7f[_0x6836('0x1f')]=_0x248e49;if(_0x590484[_0x6836('0x49')]['includeAll']){_0x98c758[_0x6836('0x56')]=[{'all':!![]}];}return db[_0x6836('0x44')]['findAll'](_0x98c758);})[_0x6836('0x22')](function(_0x40c347){_0x38ef7f[_0x6836('0x57')]=_0x40c347;return _0x38ef7f;})[_0x6836('0x22')](respondWithFilteredResult(_0x66b99,_0x98c758))[_0x6836('0x58')](handleError(_0x66b99,null));};exports['show']=function(_0x42e35e,_0xc1a42c){var _0x2b818b={'raw':![],'where':{'id':_0x42e35e['params']['id']},'include':[{'model':db[_0x6836('0x3f')],'as':_0x6836('0x3d')},{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e')},{'model':db[_0x6836('0x41')],'as':_0x6836('0x42')}]},_0x358c96={};_0x358c96[_0x6836('0x48')]=_[_0x6836('0x59')](db[_0x6836('0x44')][_0x6836('0x45')]);_0x358c96[_0x6836('0x49')]=_['keys'](_0x42e35e[_0x6836('0x49')]);_0x358c96['filters']=_['intersection'](_0x358c96[_0x6836('0x48')],_0x358c96[_0x6836('0x49')]);_0x2b818b[_0x6836('0x4c')]=_[_0x6836('0x4b')](_0x358c96[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x42e35e[_0x6836('0x49')][_0x6836('0x4d')]));_0x2b818b[_0x6836('0x4c')]=_0x2b818b[_0x6836('0x4c')][_0x6836('0x5a')]?_0x2b818b[_0x6836('0x4c')]:_0x358c96['model'];if(_0x42e35e['query'][_0x6836('0x5b')]){_0x2b818b[_0x6836('0x56')]=[{'all':!![]}];}_0x2b818b=_['merge']({},_0x2b818b,_0x42e35e[_0x6836('0x55')]);return db[_0x6836('0x44')][_0x6836('0x5c')](_0x2b818b)[_0x6836('0x22')](handleEntityNotFound(_0xc1a42c,null))[_0x6836('0x22')](respondWithResult(_0xc1a42c,null))[_0x6836('0x58')](handleError(_0xc1a42c,null));};exports[_0x6836('0x5d')]=function(_0x28123d,_0x3134c0){if(_0x28123d['body']['id']){delete _0x28123d[_0x6836('0x5e')]['id'];}var _0x1e8960=_0x28123d['body']['provider']===_0x6836('0x5f')?null:_0x28123d[_0x6836('0x5e')][_0x6836('0x60')];var _0x6f8c54=_0x28123d[_0x6836('0x5e')]['Imap']||{};var _0x13074a=_0x28123d['body']['Smtp']||{};if(_0x1e8960){_0x6f8c54[_0x6836('0x37')]=getImapHost(_0x1e8960);_0x6f8c54['port']=0x3e1;_0x13074a[_0x6836('0x37')]=getSmtpHost(_0x1e8960);_0x13074a['port']=0x24b;_0x13074a[_0x6836('0x39')]=![];}if(_0x13074a[_0x6836('0x35')]){_0x13074a[_0x6836('0x39')]=![];}else{_0x13074a['CloudProviderId']=null;}if(!_0x6f8c54[_0x6836('0x35')])_0x6f8c54[_0x6836('0x36')]=null;_0x28123d['body']['Imap']=_0x6f8c54;_0x28123d[_0x6836('0x5e')][_0x6836('0x3e')]=_0x13074a;return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x28123d[_0x6836('0x61')]['id']},'include':[{'model':db[_0x6836('0x3f')],'as':_0x6836('0x3d')},{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6836('0x22')](handleEntityNotFound(_0x3134c0,null))[_0x6836('0x22')](function(_0x53b6fe){if(!_0x53b6fe)throw new Error('Mail\x20Account\x20not\x20found');if(_0x53b6fe[_0x6836('0x3a')])delete _0x28123d[_0x6836('0x5e')][_0x6836('0x3d')];return _0x53b6fe;})[_0x6836('0x22')](saveUpdates(_0x28123d[_0x6836('0x5e')],null))['then'](function(_0x57a168){if(!_0x28123d['body'][_0x6836('0x3d')])return _0x57a168;return db['MailServerIn'][_0x6836('0x5d')](_0x28123d[_0x6836('0x5e')]['Imap'],{'where':{'MailAccountId':_0x57a168['id']}})['then'](function(){return _0x57a168;});})[_0x6836('0x22')](function(_0xea19aa){if(!_0x28123d['body'][_0x6836('0x3e')])return _0xea19aa;return db['MailServerOut'][_0x6836('0x5d')](_0x28123d[_0x6836('0x5e')][_0x6836('0x3e')],{'where':{'MailAccountId':_0xea19aa['id']}})[_0x6836('0x22')](function(){return _0xea19aa;});})['then'](respondWithResult(_0x3134c0,null))[_0x6836('0x58')](handleError(_0x3134c0,null));};exports[_0x6836('0x62')]=function(_0x41a877,_0x37ee30){return db[_0x6836('0x44')][_0x6836('0x62')]()[_0x6836('0x22')](respondWithResult(_0x37ee30,null))['catch'](handleError(_0x37ee30,null));};exports[_0x6836('0x63')]=function(_0x159a2c,_0x5b88e0){if(_0x159a2c[_0x6836('0x5e')]['id']){delete _0x159a2c['body']['id'];}return db['MailAccount'][_0x6836('0x5c')]({'where':{'id':_0x159a2c[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x5b88e0,null))[_0x6836('0x22')](function(_0x3d916f){if(_0x3d916f){_0x159a2c['body'][_0x6836('0x64')]=_0x3d916f['id'];return db[_0x6836('0x65')][_0x6836('0x66')](_0x159a2c[_0x6836('0x5e')]);}})[_0x6836('0x22')](respondWithResult(_0x5b88e0,null))[_0x6836('0x58')](handleError(_0x5b88e0,null));};exports[_0x6836('0x67')]=function(_0x4868d6,_0x53ed3d){var _0x25bf3b={'raw':![],'where':{}};var _0x5f2ea6={};var _0x3aa651={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4868d6[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x53ed3d,null))[_0x6836('0x22')](function(_0x77d996){if(_0x77d996){_0x5f2ea6[_0x6836('0x48')]=_[_0x6836('0x59')](db[_0x6836('0x65')][_0x6836('0x45')]);_0x5f2ea6[_0x6836('0x49')]=_[_0x6836('0x59')](_0x4868d6[_0x6836('0x49')]);_0x5f2ea6[_0x6836('0x4a')]=_['intersection'](_0x5f2ea6[_0x6836('0x48')],_0x5f2ea6[_0x6836('0x49')]);_0x25bf3b['attributes']=_['intersection'](_0x5f2ea6[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x4868d6['query']['fields']));_0x25bf3b[_0x6836('0x4c')]=_0x25bf3b[_0x6836('0x4c')][_0x6836('0x5a')]?_0x25bf3b[_0x6836('0x4c')]:_0x5f2ea6[_0x6836('0x48')];if(!_0x4868d6[_0x6836('0x49')][_0x6836('0x68')]('nolimit')){_0x25bf3b[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x4868d6[_0x6836('0x49')][_0x6836('0x1d')]);_0x25bf3b[_0x6836('0x1c')]=qs[_0x6836('0x1c')](_0x4868d6[_0x6836('0x49')][_0x6836('0x1c')]);}_0x25bf3b[_0x6836('0x4f')]=qs['sort'](_0x4868d6[_0x6836('0x49')][_0x6836('0x50')]);_0x25bf3b['where']=qs[_0x6836('0x4a')](_[_0x6836('0x52')](_0x4868d6[_0x6836('0x49')],_0x5f2ea6[_0x6836('0x4a')]));_0x25bf3b[_0x6836('0x51')]['MailAccountId']=_0x77d996['id'];if(_0x4868d6[_0x6836('0x49')][_0x6836('0x53')]){_0x25bf3b[_0x6836('0x51')]=_['merge'](_0x25bf3b[_0x6836('0x51')],{'$or':_[_0x6836('0x43')](_0x25bf3b[_0x6836('0x4c')],function(_0x27ed65){var _0x2b9608={};_0x2b9608[_0x27ed65]={'$like':'%'+_0x4868d6[_0x6836('0x49')][_0x6836('0x53')]+'%'};return _0x2b9608;})});}_0x25bf3b=_[_0x6836('0x54')]({},_0x25bf3b,_0x4868d6[_0x6836('0x55')]);return db[_0x6836('0x65')][_0x6836('0x1f')]({'where':_0x25bf3b[_0x6836('0x51')]})[_0x6836('0x22')](function(_0xde4360){_0x3aa651[_0x6836('0x1f')]=_0xde4360;if(_0x4868d6[_0x6836('0x49')]['includeAll']){_0x25bf3b[_0x6836('0x56')]=[{'all':!![]}];}return db[_0x6836('0x65')][_0x6836('0x69')](_0x25bf3b);})[_0x6836('0x22')](function(_0x10c6db){_0x3aa651[_0x6836('0x57')]=_0x10c6db;return _0x3aa651;});}})['then'](respondWithFilteredResult(_0x53ed3d,_0x25bf3b))[_0x6836('0x58')](handleError(_0x53ed3d,null));};exports[_0x6836('0x6a')]=function(_0x1ccedb,_0x231f59){return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x1ccedb[_0x6836('0x61')]['id']}})['then'](handleEntityNotFound(_0x231f59,null))['then'](function(_0xd4e4c5){if(_0xd4e4c5){return _0xd4e4c5['removeDispositions'](_0x1ccedb[_0x6836('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x231f59,null))[_0x6836('0x58')](handleError(_0x231f59,null));};exports[_0x6836('0x6b')]=function(_0x2af5b6,_0x34a864){if(_0x2af5b6['body']['id']){delete _0x2af5b6[_0x6836('0x5e')]['id'];}return db['MailAccount'][_0x6836('0x5c')]({'where':{'id':_0x2af5b6['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x34a864,null))['then'](function(_0x2c019f){if(_0x2c019f){_0x2af5b6[_0x6836('0x5e')][_0x6836('0x64')]=_0x2c019f['id'];return db[_0x6836('0x6c')][_0x6836('0x66')](_0x2af5b6['body']);}})[_0x6836('0x22')](respondWithResult(_0x34a864,null))['catch'](handleError(_0x34a864,null));};exports[_0x6836('0x6d')]=function(_0x503d64,_0x5e8a30){var _0x31656c={'raw':![],'where':{}};var _0x195341={};var _0x2ccdd0={'count':0x0,'rows':[]};return db[_0x6836('0x44')][_0x6836('0x6e')]({'where':{'id':_0x503d64[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x5e8a30,null))[_0x6836('0x22')](function(_0x479342){if(_0x479342){_0x195341['model']=_[_0x6836('0x59')](db['CannedAnswer']['rawAttributes']);_0x195341[_0x6836('0x49')]=_[_0x6836('0x59')](_0x503d64['query']);_0x195341[_0x6836('0x4a')]=_[_0x6836('0x4b')](_0x195341[_0x6836('0x48')],_0x195341['query']);_0x31656c['attributes']=_[_0x6836('0x4b')](_0x195341[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x503d64['query'][_0x6836('0x4d')]));_0x31656c[_0x6836('0x4c')]=_0x31656c['attributes'][_0x6836('0x5a')]?_0x31656c['attributes']:_0x195341[_0x6836('0x48')];if(!_0x503d64[_0x6836('0x49')][_0x6836('0x68')](_0x6836('0x4e'))){_0x31656c[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x503d64[_0x6836('0x49')]['limit']);_0x31656c[_0x6836('0x1c')]=qs['offset'](_0x503d64[_0x6836('0x49')][_0x6836('0x1c')]);}_0x31656c[_0x6836('0x4f')]=qs['sort'](_0x503d64[_0x6836('0x49')][_0x6836('0x50')]);_0x31656c[_0x6836('0x51')]=qs[_0x6836('0x4a')](_[_0x6836('0x52')](_0x503d64[_0x6836('0x49')],_0x195341[_0x6836('0x4a')]));_0x31656c[_0x6836('0x51')][_0x6836('0x64')]=_0x479342['id'];if(_0x503d64['query'][_0x6836('0x53')]){_0x31656c['where']=_['merge'](_0x31656c[_0x6836('0x51')],{'$or':_['map'](_0x31656c[_0x6836('0x4c')],function(_0x183154){var _0x1dc101={};_0x1dc101[_0x183154]={'$like':'%'+_0x503d64[_0x6836('0x49')]['filter']+'%'};return _0x1dc101;})});}_0x31656c=_[_0x6836('0x54')]({},_0x31656c,_0x503d64[_0x6836('0x55')]);return db[_0x6836('0x6c')]['count']({'where':_0x31656c[_0x6836('0x51')]})['then'](function(_0x10cbdf){_0x2ccdd0['count']=_0x10cbdf;if(_0x503d64['query'][_0x6836('0x5b')]){_0x31656c[_0x6836('0x56')]=[{'all':!![]}];}return db[_0x6836('0x6c')][_0x6836('0x69')](_0x31656c);})[_0x6836('0x22')](function(_0x29ca9e){_0x2ccdd0[_0x6836('0x57')]=_0x29ca9e;return _0x2ccdd0;});}})[_0x6836('0x22')](respondWithFilteredResult(_0x5e8a30,_0x31656c))[_0x6836('0x58')](handleError(_0x5e8a30,null));};exports[_0x6836('0x6f')]=function(_0x206ac7,_0x18a512){return db['MailAccount'][_0x6836('0x5c')]({'where':{'id':_0x206ac7[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x18a512,null))[_0x6836('0x22')](function(_0x366146){if(_0x366146){return _0x366146['removeAnswers'](_0x206ac7[_0x6836('0x49')][_0x6836('0x70')]);}})[_0x6836('0x22')](respondWithStatusCode(_0x18a512,null))[_0x6836('0x58')](handleError(_0x18a512,null));};exports[_0x6836('0x66')]=function(_0x15318d,_0x5766fe){var _0x30e93b={'name':_0x15318d[_0x6836('0x5e')]['name'],'key':_0x15318d['body'][_0x6836('0x71')],'provider':_0x15318d[_0x6836('0x5e')][_0x6836('0x60')]===_0x6836('0x5f')?null:_0x15318d['body'][_0x6836('0x60')],'email':_0x15318d[_0x6836('0x5e')][_0x6836('0x72')],'ListId':_0x15318d['body'][_0x6836('0x73')],'active':!_[_0x6836('0x74')](_0x15318d[_0x6836('0x5e')][_0x6836('0x75')])?_0x15318d['body'][_0x6836('0x75')]:!![],'description':_0x15318d[_0x6836('0x5e')][_0x6836('0x76')]||null};var _0x23cdec=getAuthenticationOptions(_0x30e93b[_0x6836('0x60')],_0x15318d['body']);_0x30e93b[_0x6836('0x3d')]=_0x23cdec['Imap'];_0x30e93b[_0x6836('0x3e')]=_0x23cdec[_0x6836('0x3e')];return db[_0x6836('0x44')][_0x6836('0x66')](_0x30e93b,{'include':[{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e')},{'model':db['MailServerIn'],'as':_0x6836('0x3d')}]})[_0x6836('0x22')](function(_0x4cced0){var _0xfeb0fa=_0x15318d['user']['get']({'plain':!![]});if(!_0xfeb0fa)throw new Error(_0x6836('0x77'));if(_0xfeb0fa[_0x6836('0x78')]===_0x6836('0x32')){var _0x131329=_0x4cced0['get']({'plain':!![]});return db[_0x6836('0x79')][_0x6836('0x5c')]({'where':{'name':_0x6836('0x24'),'userProfileId':_0xfeb0fa[_0x6836('0x7a')]},'raw':!![]})[_0x6836('0x22')](function(_0x4f2e7e){if(_0x4f2e7e&&_0x4f2e7e[_0x6836('0x7b')]===0x0){return db[_0x6836('0x25')][_0x6836('0x66')]({'name':_0x131329['name'],'resourceId':_0x131329['id'],'type':_0x4f2e7e['name'],'sectionId':_0x4f2e7e['id']},{})[_0x6836('0x22')](function(){return _0x4cced0;});}else{return _0x4cced0;}})[_0x6836('0x58')](function(_0x5bdbe2){logger[_0x6836('0x17')](_0x6836('0x7c'),_0x5bdbe2);throw _0x5bdbe2;});}return _0x4cced0;})[_0x6836('0x22')](respondWithResult(_0x5766fe,0xc9))[_0x6836('0x58')](handleError(_0x5766fe,null));};exports[_0x6836('0x7d')]=function(_0x4bb834,_0x2cf141){return db['MailAccount'][_0x6836('0x6e')]({'where':{'id':_0x4bb834[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x2cf141,null))[_0x6836('0x22')](function(_0x2af08a){if(_0x2af08a){return _0x2af08a['getImap']();}return null;})[_0x6836('0x22')](respondWithResult(_0x2cf141,null))[_0x6836('0x58')](handleError(_0x2cf141,null));};exports[_0x6836('0x7e')]=function(_0x3c383d,_0x3f0746){if(_0x3c383d[_0x6836('0x5e')]['id']){delete _0x3c383d[_0x6836('0x5e')]['id'];}return db[_0x6836('0x44')]['find']({'where':{'id':_0x3c383d[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x3f0746,null))['then'](function(_0x1ab087){if(_0x1ab087){_0x3c383d['body']['MailAccountId']=_0x1ab087['id'];return db['MailServerIn'][_0x6836('0x66')](_0x3c383d[_0x6836('0x5e')]);}})[_0x6836('0x22')](respondWithResult(_0x3f0746,null))[_0x6836('0x58')](handleError(_0x3f0746,null));};exports[_0x6836('0x7f')]=function(_0x18c577,_0x57606a){return db['MailAccount'][_0x6836('0x6e')]({'where':{'id':_0x18c577['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x57606a,null))[_0x6836('0x22')](function(_0x241da7){if(_0x241da7){return _0x241da7[_0x6836('0x80')](null);}return null;})[_0x6836('0x22')](respondWithStatusCode(_0x57606a,null))[_0x6836('0x58')](handleError(_0x57606a,null));};exports[_0x6836('0x81')]=function(_0x1dc18a,_0x185779){return db[_0x6836('0x44')][_0x6836('0x6e')]({'where':{'id':_0x1dc18a[_0x6836('0x61')]['id']}})['then'](handleEntityNotFound(_0x185779,null))[_0x6836('0x22')](function(_0x3a94bf){if(_0x3a94bf){return _0x3a94bf[_0x6836('0x81')]();}return null;})[_0x6836('0x22')](respondWithResult(_0x185779,null))[_0x6836('0x58')](handleError(_0x185779,null));};exports[_0x6836('0x82')]=function(_0x55722f,_0x1ae112){if(_0x55722f[_0x6836('0x5e')]['id']){delete _0x55722f[_0x6836('0x5e')]['id'];}return db['MailAccount'][_0x6836('0x5c')]({'where':{'id':_0x55722f['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x1ae112,null))[_0x6836('0x22')](function(_0xebd1ce){if(_0xebd1ce){_0x55722f[_0x6836('0x5e')][_0x6836('0x64')]=_0xebd1ce['id'];return db[_0x6836('0x40')][_0x6836('0x66')](_0x55722f[_0x6836('0x5e')]);}})[_0x6836('0x22')](respondWithResult(_0x1ae112,null))[_0x6836('0x58')](handleError(_0x1ae112,null));};exports[_0x6836('0x83')]=function(_0x1bbc31,_0x318f0e){return db['MailAccount'][_0x6836('0x6e')]({'where':{'id':_0x1bbc31[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x318f0e,null))[_0x6836('0x22')](function(_0x2dc644){if(_0x2dc644){return _0x2dc644[_0x6836('0x84')](null);}return null;})[_0x6836('0x22')](respondWithStatusCode(_0x318f0e,null))[_0x6836('0x58')](handleError(_0x318f0e,null));};exports[_0x6836('0x85')]=function(_0x2398fe,_0x39dc23){return db[_0x6836('0x86')][_0x6836('0x5c')]({'where':{'id':_0x2398fe[_0x6836('0x61')]['id']}})['then'](handleEntityNotFound(_0x39dc23,null))[_0x6836('0x22')](function(_0x1533cd){if(_0x1533cd){return _0x1533cd[_0x6836('0x85')](_0x2398fe[_0x6836('0x5e')][_0x6836('0x70')],_[_0x6836('0x87')](_0x2398fe[_0x6836('0x5e')],[_0x6836('0x70'),'id'])||{});}})['then'](respondWithResult(_0x39dc23,null))['catch'](handleError(_0x39dc23,null));};exports[_0x6836('0x88')]=function(_0x2565b9,_0x3bc0ea){var _0x52f984={'raw':![],'where':{}};var _0x170a8a={};var _0xe306fb={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2565b9['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x3bc0ea,null))[_0x6836('0x22')](function(_0x23276f){if(_0x23276f){_0x170a8a[_0x6836('0x48')]=_[_0x6836('0x59')](db[_0x6836('0x86')][_0x6836('0x45')]);_0x170a8a[_0x6836('0x49')]=_[_0x6836('0x59')](_0x2565b9[_0x6836('0x49')]);_0x170a8a['filters']=_['intersection'](_0x170a8a[_0x6836('0x48')],_0x170a8a[_0x6836('0x49')]);_0x52f984[_0x6836('0x4c')]=_[_0x6836('0x4b')](_0x170a8a['model'],qs['fields'](_0x2565b9[_0x6836('0x49')]['fields']));_0x52f984['attributes']=_0x52f984[_0x6836('0x4c')][_0x6836('0x5a')]?_0x52f984[_0x6836('0x4c')]:_0x170a8a[_0x6836('0x48')];if(!_0x2565b9['query'][_0x6836('0x68')](_0x6836('0x4e'))){_0x52f984[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x2565b9[_0x6836('0x49')][_0x6836('0x1d')]);_0x52f984['offset']=qs['offset'](_0x2565b9[_0x6836('0x49')][_0x6836('0x1c')]);}_0x52f984[_0x6836('0x4f')]=qs['sort'](_0x2565b9[_0x6836('0x49')][_0x6836('0x50')]);_0x52f984[_0x6836('0x51')]=qs['filters'](_[_0x6836('0x52')](_0x2565b9[_0x6836('0x49')],_0x170a8a[_0x6836('0x4a')]));_0x52f984[_0x6836('0x51')][_0x6836('0x64')]=_0x23276f['id'];if(_0x2565b9[_0x6836('0x49')][_0x6836('0x53')]){_0x52f984[_0x6836('0x51')]=_[_0x6836('0x54')](_0x52f984[_0x6836('0x51')],{'$or':_[_0x6836('0x43')](_0x52f984[_0x6836('0x4c')],function(_0x338828){var _0x25df9e={};_0x25df9e[_0x338828]={'$like':'%'+_0x2565b9[_0x6836('0x49')][_0x6836('0x53')]+'%'};return _0x25df9e;})});}_0x52f984=_[_0x6836('0x54')]({},_0x52f984,_0x2565b9[_0x6836('0x55')]);return db[_0x6836('0x86')][_0x6836('0x1f')]({'where':_0x52f984[_0x6836('0x51')]})[_0x6836('0x22')](function(_0x4845fb){_0xe306fb[_0x6836('0x1f')]=_0x4845fb;if(_0x2565b9[_0x6836('0x49')]['includeAll']){_0x52f984[_0x6836('0x56')]=[{'model':db[_0x6836('0x89')],'as':_0x6836('0x8a'),'required':![]},{'model':db[_0x6836('0x8b')],'as':_0x6836('0x8c'),'attributes':[_0x6836('0x26'),_0x6836('0x8d'),'internal'],'required':![]},{'model':db[_0x6836('0x8e')],'as':_0x6836('0x8f'),'attributes':['id',_0x6836('0x26'),_0x6836('0x90')],'where':_0x2565b9[_0x6836('0x49')]['tag']?{'id':_0x2565b9[_0x6836('0x49')][_0x6836('0x91')]}:undefined,'required':_0x2565b9[_0x6836('0x49')]['tag']?!![]:![]}];}return db[_0x6836('0x86')][_0x6836('0x69')](_0x52f984);})[_0x6836('0x22')](function(_0x24f2d9){_0xe306fb[_0x6836('0x57')]=_0x24f2d9;return _0xe306fb;});}})[_0x6836('0x22')](respondWithFilteredResult(_0x3bc0ea,_0x52f984))[_0x6836('0x58')](handleError(_0x3bc0ea,null));};exports[_0x6836('0x92')]=function addApplications(_0x2aaa7e,_0x5019fe){var _0x5497cc=_0x2aaa7e[_0x6836('0x61')]['id'];var _0x2ee90e=_0x2aaa7e[_0x6836('0x5e')];var _0x319eef=0xc8;var _0x42d17a=null;return db[_0x6836('0x93')][_0x6836('0x94')]({'isolationLevel':db['sequelize'][_0x6836('0x95')][_0x6836('0x96')][_0x6836('0x97')]},function(_0x380970){return db[_0x6836('0x44')][_0x6836('0x6e')]({'where':{'id':_0x5497cc},'transaction':_0x380970})['then'](function(_0x4a065a){if(_0x4a065a){return db[_0x6836('0x98')][_0x6836('0x23')]({'where':{'MailAccountId':_0x5497cc},'transaction':_0x380970})[_0x6836('0x22')](function(){var _0x486c27=_[_0x6836('0x43')](_0x2ee90e,function(_0x4b1b23){_0x4b1b23['MailAccountId']=_0x5497cc;return _0x4b1b23;});return db[_0x6836('0x98')][_0x6836('0x99')](_0x486c27,{'transaction':_0x380970});});}else{_0x319eef=0x194;_0x42d17a=[];}});})[_0x6836('0x22')](function(){if(_0x319eef!==0x194){return db[_0x6836('0x98')][_0x6836('0x9a')]({'where':{'MailAccountId':_0x5497cc},'order':_0x6836('0x9b')})['then'](function(_0x4e2561){_0x42d17a=_0x4e2561;});}})[_0x6836('0x58')](function(_0xf2a53d){_0x319eef=0x1f4;logger[_0x6836('0x17')](_0xf2a53d[_0x6836('0x9c')]);if(_0xf2a53d[_0x6836('0x26')]){delete _0xf2a53d['name'];}_0x42d17a=_0xf2a53d;})['finally'](function(){if(_0x42d17a===null){_0x5019fe[_0x6836('0x1a')](_0x319eef);}else{if(_0x319eef===0x1f4){_0x5019fe['status'](_0x319eef)[_0x6836('0x9d')](_0x42d17a);}else{_0x5019fe[_0x6836('0x1b')](_0x319eef)[_0x6836('0x9e')](_0x42d17a);}}});};exports[_0x6836('0x9f')]=function(_0x2a3c58,_0x2ef76f){var _0x33e5e7={};var _0xd7f5a2={};var _0x26ff48;var _0x34a6ad;return db[_0x6836('0x44')][_0x6836('0x6e')]({'where':{'id':_0x2a3c58[_0x6836('0x61')]['id']}})['then'](handleEntityNotFound(_0x2ef76f,null))[_0x6836('0x22')](function(_0x5a30fa){if(_0x5a30fa){_0x26ff48=_0x5a30fa;_0xd7f5a2[_0x6836('0x48')]=_['keys'](db[_0x6836('0x98')][_0x6836('0x45')]);_0xd7f5a2[_0x6836('0x49')]=_[_0x6836('0x59')](_0x2a3c58[_0x6836('0x49')]);_0xd7f5a2[_0x6836('0x4a')]=_[_0x6836('0x4b')](_0xd7f5a2[_0x6836('0x48')],_0xd7f5a2[_0x6836('0x49')]);_0x33e5e7[_0x6836('0x4c')]=_['intersection'](_0xd7f5a2['model'],qs[_0x6836('0x4d')](_0x2a3c58[_0x6836('0x49')][_0x6836('0x4d')]));_0x33e5e7[_0x6836('0x4c')]=_0x33e5e7['attributes']['length']?_0x33e5e7['attributes']:_0xd7f5a2[_0x6836('0x48')];_0x33e5e7[_0x6836('0x4f')]=qs[_0x6836('0x50')](_0x2a3c58[_0x6836('0x49')]['sort']);_0x33e5e7[_0x6836('0x51')]=qs[_0x6836('0x4a')](_[_0x6836('0x52')](_0x2a3c58['query'],_0xd7f5a2[_0x6836('0x4a')]));if(_0x2a3c58[_0x6836('0x49')]['filter']){_0x33e5e7[_0x6836('0x51')]=_[_0x6836('0x54')](_0x33e5e7['where'],{'$or':_[_0x6836('0x43')](_0x33e5e7[_0x6836('0x4c')],function(_0x1957b3){var _0x8c6090={};_0x8c6090[_0x1957b3]={'$like':'%'+_0x2a3c58[_0x6836('0x49')][_0x6836('0x53')]+'%'};return _0x8c6090;})});}_0x33e5e7=_['merge']({},_0x33e5e7,_0x2a3c58[_0x6836('0x55')]);return _0x26ff48[_0x6836('0x9f')](_0x33e5e7);}})[_0x6836('0x22')](function(_0x33692e){if(_0x33692e){_0x34a6ad=_0x33692e[_0x6836('0x5a')];if(!_0x2a3c58[_0x6836('0x49')][_0x6836('0x68')](_0x6836('0x4e'))){_0x33e5e7[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x2a3c58[_0x6836('0x49')][_0x6836('0x1d')]);_0x33e5e7[_0x6836('0x1c')]=qs['offset'](_0x2a3c58[_0x6836('0x49')]['offset']);}return _0x26ff48[_0x6836('0x9f')](_0x33e5e7);}})[_0x6836('0x22')](function(_0x263b58){if(_0x263b58){return _0x263b58?{'count':_0x34a6ad,'rows':_0x263b58}:null;}})[_0x6836('0x22')](respondWithResult(_0x2ef76f,null))[_0x6836('0x58')](handleError(_0x2ef76f,null));};exports['getMessages']=function(_0x8f9abe,_0x363b7d){var _0x3314c1={'raw':!![],'where':{}};var _0x10456e={};var _0x42014a={'count':0x0,'rows':[]};return db[_0x6836('0x44')][_0x6836('0x6e')]({'where':{'id':_0x8f9abe[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x363b7d,null))[_0x6836('0x22')](function(_0x366b52){if(_0x366b52){_0x10456e[_0x6836('0x48')]=_['keys'](db[_0x6836('0xa0')][_0x6836('0x45')]);_0x10456e['query']=_['keys'](_0x8f9abe[_0x6836('0x49')]);_0x10456e[_0x6836('0x4a')]=_[_0x6836('0x4b')](_0x10456e[_0x6836('0x48')],_0x10456e[_0x6836('0x49')]);_0x3314c1[_0x6836('0x4c')]=_[_0x6836('0x4b')](_0x10456e[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x8f9abe[_0x6836('0x49')][_0x6836('0x4d')]));_0x3314c1[_0x6836('0x4c')]=_0x3314c1[_0x6836('0x4c')][_0x6836('0x5a')]?_0x3314c1[_0x6836('0x4c')]:_0x10456e[_0x6836('0x48')];if(!_0x8f9abe['query'][_0x6836('0x68')]('nolimit')){_0x3314c1[_0x6836('0x1d')]=qs[_0x6836('0x1d')](_0x8f9abe[_0x6836('0x49')][_0x6836('0x1d')]);_0x3314c1[_0x6836('0x1c')]=qs[_0x6836('0x1c')](_0x8f9abe[_0x6836('0x49')][_0x6836('0x1c')]);}_0x3314c1[_0x6836('0x4f')]=qs[_0x6836('0x50')](_0x8f9abe['query'][_0x6836('0x50')]);_0x3314c1[_0x6836('0x51')]=qs['filters'](_[_0x6836('0x52')](_0x8f9abe[_0x6836('0x49')],_0x10456e[_0x6836('0x4a')]));_0x3314c1['where'][_0x6836('0x64')]=_0x366b52['id'];if(_0x8f9abe[_0x6836('0x49')][_0x6836('0x53')]){_0x3314c1['where']=_['merge'](_0x3314c1['where'],{'$or':_[_0x6836('0x43')](_0x3314c1[_0x6836('0x4c')],function(_0x2f0722){var _0x297c36={};_0x297c36[_0x2f0722]={'$like':'%'+_0x8f9abe['query'][_0x6836('0x53')]+'%'};return _0x297c36;})});}if(_0x8f9abe[_0x6836('0x49')]['$gte']){var _0x5be10b=_0x8f9abe[_0x6836('0x49')][_0x6836('0xa1')][_0x6836('0xa2')](',');var _0x49cd5e={};_0x49cd5e[_0x5be10b[0x0]]={'$gte':moment(_0x5be10b[0x1])[_0x6836('0xa3')](_0x6836('0xa4'))};_0x3314c1[_0x6836('0x51')]=_['merge'](_0x3314c1[_0x6836('0x51')],_0x49cd5e);}_0x3314c1=_[_0x6836('0x54')]({},_0x3314c1,_0x8f9abe[_0x6836('0x55')]);return db[_0x6836('0xa0')][_0x6836('0x1f')]({'where':_0x3314c1[_0x6836('0x51')]})[_0x6836('0x22')](function(_0x3913f3){_0x42014a['count']=_0x3913f3;if(_0x8f9abe[_0x6836('0x49')]['includeAll']){_0x3314c1[_0x6836('0x56')]=[{'all':!![]}];}return db[_0x6836('0xa0')]['findAll'](_0x3314c1);})[_0x6836('0x22')](function(_0x4c6bda){if(_0x8f9abe[_0x6836('0x49')]['inlineCss']===_0x6836('0xa5')){for(var _0x1b8493=0x0;_0x1b8493<_0x4c6bda[_0x6836('0x5a')];_0x1b8493++){_0x4c6bda[_0x1b8493]['body']=juice(_0x4c6bda[_0x1b8493][_0x6836('0x5e')]);}}_0x42014a[_0x6836('0x57')]=_0x4c6bda;return _0x42014a;});}})['then'](respondWithFilteredResult(_0x363b7d,_0x3314c1))['catch'](handleError(_0x363b7d,null));};exports[_0x6836('0x9d')]=function(_0x1b8914,_0x188d63){var _0x3e4d29,_0x1a9005={},_0x43aec7;if(_0x1b8914[_0x6836('0x5e')]['to']){_0x43aec7=_0x1b8914[_0x6836('0x5e')]['to'][_0x6836('0xa2')](',')[0x0];}return db['MailAccount'][_0x6836('0x5c')]({'where':{'id':_0x1b8914['params']['id']},'include':[{'model':db['CmList'],'as':_0x6836('0xa6'),'include':[{'model':db[_0x6836('0x89')],'as':_0x6836('0xa7'),'where':{'email':_0x43aec7},'limit':0x1,'order':[['updatedAt',_0x6836('0xa8')]]}]},{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6836('0xa9'),'raw':!![]}]}]})[_0x6836('0x22')](handleEntityNotFound(_0x188d63,null))[_0x6836('0x22')](function(_0x58c5e3){if(!_0x58c5e3)return;_0x3e4d29=_0x58c5e3;if(!_0x58c5e3[_0x6836('0x3e')])throw new Error(_0x6836('0xaa'));if(_[_0x6836('0x74')](_0x1b8914[_0x6836('0x5e')][_0x6836('0xab')])){_0x1b8914[_0x6836('0x5e')][_0x6836('0xab')]=util[_0x6836('0xa3')]('%s\x20<%s>',_0x58c5e3['name'],_0x58c5e3[_0x6836('0x72')]||_0x58c5e3[_0x6836('0x3e')][_0x6836('0x32')]);}if(_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')]&&_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')]['length']){for(var _0x354792=0x0;_0x354792<_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')]['length'];_0x354792+=0x1){_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')][_0x354792]={'filename':_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')][_0x354792]['name'],'path':path[_0x6836('0xad')](config['root'],_0x6836('0xae'),_0x1b8914[_0x6836('0x5e')][_0x6836('0xac')][_0x354792]['basename'])};}}var _0x33acca=_0x58c5e3[_0x6836('0xaf')]();return respondWithRpcPromise('SendMail',_0x6836('0xb0'),{'account':_0x33acca,'message':_0x1b8914[_0x6836('0x5e')]});})[_0x6836('0x22')](function(_0x53e13c){if(!_0x53e13c)return;_0x1a9005=_0x53e13c;if(!_0x3e4d29[_0x6836('0xa6')])throw new Error(_0x6836('0xb1'));if(_0x3e4d29[_0x6836('0xa6')][_0x6836('0xa7')][_0x6836('0x5a')])return _0x3e4d29[_0x6836('0xa6')][_0x6836('0xa7')][0x0];return db[_0x6836('0x89')][_0x6836('0x66')](_[_0x6836('0x8')](_0x1b8914[_0x6836('0x5e')],{'firstName':_0x1b8914[_0x6836('0x5e')]['to'],'email':_0x1b8914[_0x6836('0x5e')]['to'],'phone':_0x1b8914['body']['to'],'ListId':_0x3e4d29[_0x6836('0x73')]}));})[_0x6836('0x22')](function(_0x59461c){if(!_0x59461c)return;var _0x3370fc={'UserId':_0x1b8914[_0x6836('0x32')]['id'],'ContactId':_0x59461c['id'],'MailAccountId':_0x3e4d29['id'],'inReplyTo':_0x1a9005[_0x6836('0xb2')],'to':_0x1b8914['body']['from'],'cc':_0x1b8914['body']['cc'],'subject':_0x1b8914[_0x6836('0x5e')][_0x6836('0xb3')],'attach':_0x1b8914['body'][_0x6836('0xb4')],'firstMsgDirection':_0x6836('0xb5'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x6836('0xb5'),'Messages':[_['merge'](_0x1b8914['body'],{'messageId':_0x1a9005[_0x6836('0xb2')],'sentAt':moment()[_0x6836('0xa3')](_0x6836('0xa4')),'read':!![],'MailAccountId':_0x3e4d29['id'],'UserId':_0x1b8914['user']['id'],'ContactId':_0x59461c['id']})]};if(_0x1b8914[_0x6836('0x5e')][_0x6836('0xb6')]){_0x3370fc=_['merge'](_0x3370fc,_0x1b8914['body']['Interaction']);}return db['MailInteraction']['create'](_0x3370fc,{'include':[{'model':db[_0x6836('0xa0')],'as':'Messages'}]});})['then'](respondWithResult(_0x188d63,null))[_0x6836('0x58')](handleError(_0x188d63,null));};exports['verifySmtp']=function(_0x9290f8,_0x30e28a){return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x9290f8['params']['id']},'include':[{'model':db[_0x6836('0x40')],'as':_0x6836('0x3e'),'raw':!![],'include':[{'model':db[_0x6836('0xa9')],'as':_0x6836('0xa9'),'raw':!![]}]}]})[_0x6836('0x22')](handleEntityNotFound(_0x30e28a,null))[_0x6836('0x22')](function(_0x185ebc){if(!_0x185ebc[_0x6836('0x3e')])return;var _0x45f217=_0x185ebc[_0x6836('0xaf')]();return respondWithRpcPromise(_0x6836('0xb7'),'verifySmtp',{'account':_0x45f217});})[_0x6836('0x22')](respondWithResult(_0x30e28a,null))[_0x6836('0x58')](handleError(_0x30e28a,null));};exports[_0x6836('0x23')]=function(_0x33fed9,_0x9591c6){return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x33fed9['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x9591c6,null))['then'](function(_0x1c1f74){if(_0x1c1f74&&_0x1c1f74[_0x6836('0x3a')]){throw new db[(_0x6836('0xb8'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1c1f74;})[_0x6836('0x22')](removeEntity(_0x9591c6,null))[_0x6836('0x58')](handleError(_0x9591c6,null));};exports[_0x6836('0xb9')]=function(_0x514868,_0x1ce511){return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x514868['params']['id']}})[_0x6836('0x22')](handleEntityNotFound(_0x1ce511,null))[_0x6836('0x22')](function(_0x12ba1a){if(_0x12ba1a){return _0x12ba1a[_0x6836('0xb9')](_0x514868[_0x6836('0x5e')][_0x6836('0x70')],_[_0x6836('0x87')](_0x514868[_0x6836('0x5e')],[_0x6836('0x70'),'id'])||{})[_0x6836('0xba')](function(_0x359ac6){for(var _0x468619=0x0;_0x468619<_0x514868[_0x6836('0x5e')][_0x6836('0x70')]['length'];_0x468619+=0x1){socket[_0x6836('0xbb')](_0x6836('0xbc'),{'UserId':Number(_0x514868[_0x6836('0x5e')]['ids'][_0x468619]),'MailAccountId':Number(_0x514868['params']['id'])});}return _0x359ac6;});}})[_0x6836('0x22')](respondWithResult(_0x1ce511,null))[_0x6836('0x58')](handleError(_0x1ce511,null));};exports[_0x6836('0xbd')]=function(_0x51bb18,_0x498279){return db[_0x6836('0x44')][_0x6836('0x5c')]({'where':{'id':_0x51bb18[_0x6836('0x61')]['id']}})['then'](handleEntityNotFound(_0x498279,null))[_0x6836('0x22')](function(_0x276df4){if(_0x276df4){return _0x276df4[_0x6836('0xbd')](_0x51bb18[_0x6836('0x49')][_0x6836('0x70')])['then'](function(){if(_['isArray'](_0x51bb18['query'][_0x6836('0x70')])){for(var _0x227028=0x0;_0x227028<_0x51bb18[_0x6836('0x49')][_0x6836('0x70')][_0x6836('0x5a')];_0x227028+=0x1){socket[_0x6836('0xbb')](_0x6836('0xbe'),{'UserId':Number(_0x51bb18[_0x6836('0x49')][_0x6836('0x70')][_0x227028]),'MailAccountId':Number(_0x51bb18[_0x6836('0x61')]['id'])});}}else{socket[_0x6836('0xbb')](_0x6836('0xbe'),{'UserId':Number(_0x51bb18[_0x6836('0x49')]['ids']),'MailAccountId':Number(_0x51bb18[_0x6836('0x61')]['id'])});}});}})[_0x6836('0x22')](respondWithStatusCode(_0x498279,null))['catch'](handleError(_0x498279,null));};exports['getAgents']=function(_0x5a5978,_0xb72821){var _0x387c64={};var _0x552a1d={};var _0xc378db;var _0x31d354;return db['MailAccount'][_0x6836('0x6e')]({'where':{'id':_0x5a5978[_0x6836('0x61')]['id']}})[_0x6836('0x22')](handleEntityNotFound(_0xb72821,null))[_0x6836('0x22')](function(_0x1373c2){if(_0x1373c2){_0xc378db=_0x1373c2;_0x552a1d[_0x6836('0x48')]=_[_0x6836('0x59')](db['User'][_0x6836('0x45')]);_0x552a1d[_0x6836('0x49')]=_[_0x6836('0x59')](_0x5a5978[_0x6836('0x49')]);_0x552a1d['filters']=_[_0x6836('0x4b')](_0x552a1d['model'],_0x552a1d[_0x6836('0x49')]);_0x387c64[_0x6836('0x4c')]=_[_0x6836('0x4b')](_0x552a1d[_0x6836('0x48')],qs[_0x6836('0x4d')](_0x5a5978[_0x6836('0x49')][_0x6836('0x4d')]));_0x387c64[_0x6836('0x4c')]=_0x387c64[_0x6836('0x4c')][_0x6836('0x5a')]?_0x387c64['attributes']:_0x552a1d['model'];_0x387c64['order']=qs['sort'](_0x5a5978[_0x6836('0x49')][_0x6836('0x50')]);_0x387c64[_0x6836('0x51')]=qs[_0x6836('0x4a')](_[_0x6836('0x52')](_0x5a5978[_0x6836('0x49')],_0x552a1d[_0x6836('0x4a')]));if(_0x5a5978[_0x6836('0x49')][_0x6836('0x53')]){_0x387c64[_0x6836('0x51')]=_[_0x6836('0x54')](_0x387c64[_0x6836('0x51')],{'$or':_[_0x6836('0x43')](_0x387c64['attributes'],function(_0x3eec9d){var _0x230455={};_0x230455[_0x3eec9d]={'$like':'%'+_0x5a5978[_0x6836('0x49')][_0x6836('0x53')]+'%'};return _0x230455;})});}_0x387c64=_['merge']({},_0x387c64,_0x5a5978[_0x6836('0x55')]);return _0xc378db[_0x6836('0xbf')](_0x387c64);}})[_0x6836('0x22')](function(_0x581ad9){if(_0x581ad9){_0x31d354=_0x581ad9[_0x6836('0x5a')];if(!_0x5a5978[_0x6836('0x49')]['hasOwnProperty'](_0x6836('0x4e'))){_0x387c64['limit']=qs[_0x6836('0x1d')](_0x5a5978['query'][_0x6836('0x1d')]);_0x387c64['offset']=qs['offset'](_0x5a5978['query'][_0x6836('0x1c')]);}return _0xc378db[_0x6836('0xbf')](_0x387c64);}})[_0x6836('0x22')](function(_0x43b024){if(_0x43b024){return _0x43b024?{'count':_0x31d354,'rows':_0x43b024}:null;}})[_0x6836('0x22')](respondWithResult(_0xb72821,null))[_0x6836('0x58')](handleError(_0xb72821,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4f5052b..f15dab1 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 _0xdd0c=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x4349d1,_0xc9c746){var _0x3b9bff=function(_0x1f7f28){while(--_0x1f7f28){_0x4349d1['push'](_0x4349d1['shift']());}};_0x3b9bff(++_0xc9c746);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x59c088,_0x2936e9){_0x59c088=_0x59c088-0x0;var _0x515183=_0xdd0c[_0x59c088];return _0x515183;};'use strict';var EventEmitter=require(_0xcdd0('0x0'));var MailAccount=require(_0xcdd0('0x1'))['db'][_0xcdd0('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcdd0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdd0('0x4'),'afterDestroy':_0xcdd0('0x5')};function emitEvent(_0x284276){return function(_0x221bc5,_0x8cb3e2,_0x5e5702){MailAccountEvents[_0xcdd0('0x6')](_0x284276+':'+_0x221bc5['id'],_0x221bc5);MailAccountEvents[_0xcdd0('0x6')](_0x284276,_0x221bc5);_0x5e5702(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xcdd0('0x7')](e,emitEvent(event));}}module[_0xcdd0('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xf8fa=['hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit'];(function(_0x4d9952,_0x411e0f){var _0xc8df9a=function(_0x5df5ca){while(--_0x5df5ca){_0x4d9952['push'](_0x4d9952['shift']());}};_0xc8df9a(++_0x411e0f);}(_0xf8fa,0x13e));var _0xaf8f=function(_0x5264c6,_0x5100e6){_0x5264c6=_0x5264c6-0x0;var _0x24230d=_0xf8fa[_0x5264c6];return _0x24230d;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xaf8f('0x0'))['db'][_0xaf8f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaf8f('0x2')](0x0);var events={'afterCreate':_0xaf8f('0x3'),'afterUpdate':'update','afterDestroy':_0xaf8f('0x4')};function emitEvent(_0x57b1a0){return function(_0x2caa11,_0xe41e2d,_0x3f2186){MailAccountEvents['emit'](_0x57b1a0+':'+_0x2caa11['id'],_0x2caa11);MailAccountEvents[_0xaf8f('0x5')](_0x57b1a0,_0x2caa11);_0x3f2186(null);};}for(var e in events){if(events[_0xaf8f('0x6')](e)){var event=events[e];MailAccount[_0xaf8f('0x7')](e,emitEvent(event));}}module[_0xaf8f('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index aee6e96..92778ef 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 _0xc084=['user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2'];(function(_0x49be9c,_0x113d81){var _0xc7e7b4=function(_0x192a0f){while(--_0x192a0f){_0x49be9c['push'](_0x49be9c['shift']());}};_0xc7e7b4(++_0x113d81);}(_0xc084,0x192));var _0x4c08=function(_0x4009af,_0x1bc8ac){_0x4009af=_0x4009af-0x0;var _0x16e058=_0xc084[_0x4009af];return _0x16e058;};'use strict';var attributes=require(_0x4c08('0x0'));module[_0x4c08('0x1')]=function(_0x477350){return _0x477350[_0x4c08('0x2')]('MailAccount',attributes,{'tableName':_0x4c08('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2b2301=this;var _0x4c42e1={'id':_0x2b2301['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2b2301[_0x4c08('0x4')]!==_0x4c08('0x5')){_0x4c42e1[_0x4c08('0x6')]=_0x2b2301[_0x4c08('0x4')];}else{_0x4c42e1[_0x4c08('0x7')]=_0x2b2301[_0x4c08('0x8')][_0x4c08('0x7')];_0x4c42e1[_0x4c08('0x9')]=_0x2b2301[_0x4c08('0x8')][_0x4c08('0x9')];_0x4c42e1['secure']=_0x2b2301[_0x4c08('0x8')][_0x4c08('0xa')];}if(_0x2b2301[_0x4c08('0x8')]['authentication']){if(_0x2b2301[_0x4c08('0x8')][_0x4c08('0xb')]){if(!_0x2b2301[_0x4c08('0x8')][_0x4c08('0xc')])throw new Error(_0x4c08('0xd'));_0x4c42e1[_0x4c08('0xe')]={'type':_0x4c08('0xf'),'user':_0x2b2301['Smtp'][_0x4c08('0x10')],'accessToken':_0x2b2301['Smtp'][_0x4c08('0xc')][_0x4c08('0x11')]};}else{_0x4c42e1[_0x4c08('0xe')]={'user':_0x2b2301[_0x4c08('0x8')][_0x4c08('0x10')],'pass':_0x2b2301['Smtp'][_0x4c08('0x12')]};}}return _0x4c42e1;}}});}; \ No newline at end of file +var _0x0c03=['user','CloudProvider','data5','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2'];(function(_0x3f3ad8,_0x4bc014){var _0x3a2667=function(_0x4fe7e0){while(--_0x4fe7e0){_0x3f3ad8['push'](_0x3f3ad8['shift']());}};_0x3a2667(++_0x4bc014);}(_0x0c03,0x83));var _0x30c0=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x0c03[_0x3ce3c];return _0x55a2c9;};'use strict';var attributes=require(_0x30c0('0x0'));module[_0x30c0('0x1')]=function(_0x3f6e77){return _0x3f6e77[_0x30c0('0x2')]('MailAccount',attributes,{'tableName':_0x30c0('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5c4a7f=this;var _0xd64b70={'id':_0x5c4a7f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5c4a7f[_0x30c0('0x4')]!==_0x30c0('0x5')){_0xd64b70[_0x30c0('0x6')]=_0x5c4a7f[_0x30c0('0x4')];}else{_0xd64b70[_0x30c0('0x7')]=_0x5c4a7f[_0x30c0('0x8')]['host'];_0xd64b70[_0x30c0('0x9')]=_0x5c4a7f[_0x30c0('0x8')][_0x30c0('0x9')];_0xd64b70[_0x30c0('0xa')]=_0x5c4a7f[_0x30c0('0x8')]['secure'];}if(_0x5c4a7f['Smtp']['authentication']){if(_0x5c4a7f['Smtp']['modernAuthentication']){if(!_0x5c4a7f[_0x30c0('0x8')]['CloudProvider'])throw new Error(_0x30c0('0xb'));_0xd64b70['auth']={'type':_0x30c0('0xc'),'user':_0x5c4a7f[_0x30c0('0x8')][_0x30c0('0xd')],'accessToken':_0x5c4a7f[_0x30c0('0x8')][_0x30c0('0xe')][_0x30c0('0xf')]};}else{_0xd64b70['auth']={'user':_0x5c4a7f['Smtp'][_0x30c0('0xd')],'pass':_0x5c4a7f['Smtp']['pass']};}}return _0xd64b70;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 833354d..267138a 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 _0x90ec=['Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','MailAccount','options','raw','where','attributes','limit','map','include','model','GetMailAccount','debug','find','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','from','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage'];(function(_0x545c47,_0x2c5c95){var _0x2150ce=function(_0x1d0351){while(--_0x1d0351){_0x545c47['push'](_0x545c47['shift']());}};_0x2150ce(++_0x2c5c95);}(_0x90ec,0x1d4));var _0xc90e=function(_0x53c7f0,_0x2b9b5e){_0x53c7f0=_0x53c7f0-0x0;var _0x47734b=_0x90ec[_0x53c7f0];return _0x47734b;};'use strict';var _=require(_0xc90e('0x0'));var moment=require(_0xc90e('0x1'));var BPromise=require('bluebird');var rs=require(_0xc90e('0x2'));var Redis=require(_0xc90e('0x3'));var db=require(_0xc90e('0x4'))['db'];var logger=require(_0xc90e('0x5'))(_0xc90e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc90e('0x7'));var client=jayson[_0xc90e('0x8')][_0xc90e('0x9')]({'port':0x232c});config['redis']=_[_0xc90e('0xa')](config['redis'],{'host':_0xc90e('0xb'),'port':0x18eb});var socket=require(_0xc90e('0xc'))(new Redis(config['redis']));require(_0xc90e('0xd'))[_0xc90e('0xe')](socket);function respondWithRpcPromise(_0x121335,_0x1a02ad,_0x3702ed){return new BPromise(function(_0x1bfb66,_0x386e63){return client[_0xc90e('0xf')](_0x121335,_0x3702ed)[_0xc90e('0x10')](function(_0x574156){logger[_0xc90e('0x11')]('MailAccount,\x20%s,\x20%s',_0x1a02ad,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1a02ad,_0xc90e('0x12'),JSON[_0xc90e('0x13')](_0x574156));if(_0x574156['error']){if(_0x574156[_0xc90e('0x14')][_0xc90e('0x15')]===0x1f4){logger['error'](_0xc90e('0x16'),_0x1a02ad,_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);return _0x386e63(_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);}logger[_0xc90e('0x14')]('MailAccount,\x20%s,\x20%s',_0x1a02ad,_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);return _0x1bfb66(_0x574156['error'][_0xc90e('0x17')]);}else{logger['info'](_0xc90e('0x16'),_0x1a02ad,_0xc90e('0x12'));_0x1bfb66(_0x574156['result'][_0xc90e('0x17')]);}})[_0xc90e('0x18')](function(_0x17ec6b){logger['error']('MailAccount,\x20%s,\x20%s',_0x1a02ad,_0x17ec6b);_0x386e63(_0x17ec6b);});});}exports['GetMailAccount']=function(_0x161a3a){var _0x147120=this;return new Promise(function(_0x25b1d7,_0x1dc258){return db[_0xc90e('0x19')]['findAll']({'raw':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a['options'][_0xc90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a['options'][_0xc90e('0x1c')]||null:null,'attributes':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x1d')]||null:null,'limit':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x1e')]||null:null,'include':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')]['include']?_[_0xc90e('0x1f')](_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x20')],function(_0x380f3f){return{'model':db[_0x380f3f[_0xc90e('0x21')]],'as':_0x380f3f['as'],'attributes':_0x380f3f['attributes'],'include':_0x380f3f[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x380f3f[_0xc90e('0x20')],function(_0x4fde04){return{'model':db[_0x4fde04[_0xc90e('0x21')]],'as':_0x4fde04['as'],'attributes':_0x4fde04[_0xc90e('0x1d')],'include':_0x4fde04[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x4fde04[_0xc90e('0x20')],function(_0x270040){return{'model':db[_0x270040['model']],'as':_0x270040['as'],'attributes':_0x270040['attributes']};}):[]};}):[]};}):[]:[]})[_0xc90e('0x10')](function(_0x550e8f){logger[_0xc90e('0x11')](_0xc90e('0x22'),_0x161a3a);logger[_0xc90e('0x23')](_0xc90e('0x22'),_0x161a3a,JSON[_0xc90e('0x13')](_0x550e8f));_0x25b1d7(_0x550e8f);})[_0xc90e('0x18')](function(_0x42b79b){logger['error'](_0xc90e('0x22'),_0x42b79b[_0xc90e('0x17')],_0x161a3a);_0x1dc258(_0x147120['error'](0x1f4,_0x42b79b[_0xc90e('0x17')]));});});};exports['ShowMailAccount']=function(_0x25c9d5){var _0x297d85=this;return new Promise(function(_0xad857d,_0x3ecbc1){return db[_0xc90e('0x19')][_0xc90e('0x24')]({'raw':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c9d5['options']?_0x25c9d5['options'][_0xc90e('0x1c')]||null:null,'attributes':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x1d')]||null:null,'include':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x20')],function(_0x4fc508){return{'model':db[_0x4fc508[_0xc90e('0x21')]],'as':_0x4fc508['as'],'attributes':_0x4fc508[_0xc90e('0x1d')],'include':_0x4fc508[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x4fc508['include'],function(_0x5bcfe4){return{'model':db[_0x5bcfe4['model']],'as':_0x5bcfe4['as'],'attributes':_0x5bcfe4[_0xc90e('0x1d')],'include':_0x5bcfe4[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x5bcfe4[_0xc90e('0x20')],function(_0x19d37e){return{'model':db[_0x19d37e['model']],'as':_0x19d37e['as'],'attributes':_0x19d37e[_0xc90e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc90e('0x10')](function(_0x1139eb){if(_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x25')]===!![])_0x1139eb[_0xc90e('0x26')](_0xc90e('0x27'),_0x1139eb[_0xc90e('0x28')]());logger[_0xc90e('0x11')](_0xc90e('0x29'),_0x25c9d5);logger[_0xc90e('0x23')](_0xc90e('0x29'),_0x25c9d5,JSON[_0xc90e('0x13')](_0x1139eb));_0xad857d(_0x1139eb);})['catch'](function(_0x42bce8){logger[_0xc90e('0x14')]('ShowMailAccount',_0x42bce8['message'],_0x25c9d5);_0x3ecbc1(_0x297d85[_0xc90e('0x14')](0x1f4,_0x42bce8['message']));});});};exports[_0xc90e('0x2a')]=function(_0x2c8829){var _0x5005cf=this;return new Promise(function(_0xca9e25,_0x4d7911){var _0x51ead2={'body':_0x2c8829[_0xc90e('0x2b')],'channel':'mail'};var _0x4baaea=_[_0xc90e('0x2c')](_[_0xc90e('0x2d')](db['CmContact'][_0xc90e('0x2e')]),[_0xc90e('0x2f'),_0xc90e('0x30'),_0xc90e('0x31'),_0xc90e('0x32')]);var _0x25b5da=![];if(_0x2c8829[_0xc90e('0x2b')]['id']){delete _0x2c8829[_0xc90e('0x2b')]['id'];}if(_['isNil'](_0x2c8829[_0xc90e('0x2b')]['from'])){return _0x4d7911(_0x5005cf['error'](0x1f4,_0xc90e('0x33')));}if(_['isNil'](_0x2c8829[_0xc90e('0x2b')]['body'])||_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x2b')]===''){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x34')));}if(_[_0xc90e('0x35')](_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')])){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x37')+_0x4baaea));}if(!_['includes'](_0x4baaea,_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')])){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x38')+_0x4baaea));}var _0x5dd284={};_0x5dd284[_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')]]=_0x2c8829[_0xc90e('0x2b')]['from'];return db[_0xc90e('0x19')]['find']({'where':{'id':_0x2c8829[_0xc90e('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xc90e('0x3a'),'include':[{'model':db['CmContact'],'as':_0xc90e('0x3b'),'where':_0x5dd284,'limit':0x1,'order':[[_0xc90e('0x30'),_0xc90e('0x3c')]]}]},{'model':db[_0xc90e('0x3d')],'as':_0xc90e('0x3e')},{'model':db[_0xc90e('0x3f')],'as':_0xc90e('0x40'),'include':[{'model':db[_0xc90e('0x41')],'as':'CloudProvider'}]}]})[_0xc90e('0x10')](function(_0x3de64f){if(_0x3de64f&&_0x3de64f['List']){var _0x50751f=_0x3de64f[_0xc90e('0x42')]({'plain':!![]});_0x51ead2['account']=_[_0xc90e('0x43')](_0x50751f,[_0xc90e('0x3e'),_0xc90e('0x3a')]);_0x51ead2[_0xc90e('0x39')][_0xc90e('0x27')]=_0x3de64f['getSmtpOptions']();_0x51ead2[_0xc90e('0x44')]=_0x50751f[_0xc90e('0x3e')];_0x51ead2['list']=_0x50751f[_0xc90e('0x3a')];_0x51ead2['applications']=_[_0xc90e('0x45')](_0x51ead2['applications'],[_0xc90e('0x46')],[_0xc90e('0x47')]);if(_0x51ead2[_0xc90e('0x39')]&&_0x51ead2[_0xc90e('0x39')][_0xc90e('0x48')]){_0x51ead2[_0xc90e('0x44')][_0xc90e('0x49')]({'id':0x0,'priority':_0x51ead2[_0xc90e('0x44')][_0xc90e('0x4a')]+0x1,'app':_0xc90e('0x4b'),'appdata':_0xc90e('0x48'),'interval':_0xc90e('0x4c')});}if(_0x51ead2[_0xc90e('0x39')][_0xc90e('0x3e')]){delete _0x51ead2[_0xc90e('0x39')][_0xc90e('0x3e')];}if(_0x51ead2['account'][_0xc90e('0x3a')]){delete _0x51ead2[_0xc90e('0x39')][_0xc90e('0x3a')];}if(_0x50751f[_0xc90e('0x3a')][_0xc90e('0x3b')][_0xc90e('0x4a')]){return _0x50751f[_0xc90e('0x3a')]['Contacts'][0x0];}var _0x1ec7f2=_['defaults'](_0x2c8829[_0xc90e('0x2b')],{'firstName':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x4d')],'ListId':_0x50751f[_0xc90e('0x32')]});_0x1ec7f2[_0x2c8829[_0xc90e('0x2b')]['mapKey']]=_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x4d')];return db['CmContact'][_0xc90e('0x4e')](_0x1ec7f2);}else{throw new Error(_0xc90e('0x4f'));}})[_0xc90e('0x10')](function(_0xaebbb3){_0x51ead2['contact']=_0xaebbb3;if(_0xaebbb3){if(!_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x50')]){_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')]=rs['generate']()+'\x20'+_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['from'];}var _0x4a0f64={'ContactId':_0xaebbb3['id'],'MailAccountId':_0x2c8829[_0xc90e('0x39')]['id'],'inReplyTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')],'to':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x4d')],'cc':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['cc'],'subject':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x51')],'attach':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x52')],'lastMsgAt':moment()[_0xc90e('0x53')](_0xc90e('0x54')),'lastMsgDirection':'in'};return db[_0xc90e('0x55')][_0xc90e('0x24')]({'where':{'closed':![],'MailAccountId':_0x2c8829['account']['id']},'include':[{'model':db[_0xc90e('0x56')],'as':_0xc90e('0x57'),'attributes':[_0xc90e('0x50')],'where':{'messageId':_0x2c8829['body']['message'][_0xc90e('0x58')]}}]})['then'](function(_0x311083){if(_0x311083){return[_0x311083,![]];}return db['MailInteraction'][_0xc90e('0x4e')](_0x4a0f64)[_0xc90e('0x10')](function(_0x26b89b){return[_0x26b89b,!![]];});});}else{throw new Error(_0xc90e('0x59'));}})[_0xc90e('0x5a')](function(_0x379847,_0xb44c95){if(_0x379847){_0x25b5da=_0xb44c95;if(!_0xb44c95){return _0x379847[_0xc90e('0x5b')]({'inReplyTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')],'to':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x4d')],'cc':_0x2c8829['body']['message']['cc'],'subject':_0x2c8829['body']['message'][_0xc90e('0x51')],'attach':_0x379847[_0xc90e('0x52')]?_0x379847['attach']:_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x52')],'substatus':null,'substatusAt':moment()[_0xc90e('0x53')](_0xc90e('0x54')),'lastMsgAt':moment()[_0xc90e('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x379847;}}})[_0xc90e('0x10')](function(_0x1cd004){_0x51ead2[_0xc90e('0x5c')]=_0x1cd004[_0xc90e('0x42')]({'plain':!![]});_0x51ead2[_0xc90e('0x5c')][_0xc90e('0x5d')]=_0x25b5da;return db['MailMessage'][_0xc90e('0x4e')]({'body':_0x2c8829['body'][_0xc90e('0x2b')],'MailAccountId':_0x2c8829['account']['id'],'MailInteractionId':_0x1cd004['id'],'direction':'in','ContactId':_0x51ead2['contact']['id'],'messageId':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['messageId'],'from':_0x2c8829[_0xc90e('0x2b')]['message']['from'],'to':_0x2c8829['body']['message']['to'],'cc':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['cc'],'subject':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x51')],'attach':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x52')],'Attachments':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['attachments'],'originTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['originTo'],'originCc':_0x2c8829['body'][_0xc90e('0x17')]['originCc'],'bcc':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x5e')],'ChatWebsiteId':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x5f')]||null,'originChannel':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['originChannel']||_0xc90e('0x60'),'ChatOfflineMessageId':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x61')]||null},{'include':[{'model':db[_0xc90e('0x62')],'as':_0xc90e('0x63')}]});})['then'](function(_0x4e2379){_0x51ead2[_0xc90e('0x17')]=_0x4e2379;if(!_0x51ead2['interaction'][_0xc90e('0x64')]){return;}return db[_0xc90e('0x65')][_0xc90e('0x24')]({'attributes':['id',_0xc90e('0x66')],'where':{'id':_0x51ead2['interaction'][_0xc90e('0x64')]}});})[_0xc90e('0x10')](function(_0x3fa08e){if(_0x3fa08e){_0x51ead2[_0xc90e('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc90e('0x67'),'appdata':_0x3fa08e['name']+','+(_0x51ead2[_0xc90e('0x39')][_0xc90e('0x68')]||0xa),'interval':_0xc90e('0x4c')});}if(!_0x51ead2[_0xc90e('0x5c')][_0xc90e('0x69')]){return;}return db['MailQueue'][_0xc90e('0x24')]({'attributes':['id',_0xc90e('0x66')],'where':{'id':_0x51ead2['interaction'][_0xc90e('0x69')]}});})[_0xc90e('0x10')](function(_0xd7c0d9){if(_0xd7c0d9){_0x51ead2[_0xc90e('0x44')][_0xc90e('0x6a')]({'id':0x0,'priority':0x1,'app':_0xc90e('0x6b'),'appdata':_0xd7c0d9['name']+','+(_0x51ead2['account'][_0xc90e('0x6c')]||0x12c),'interval':_0xc90e('0x4c')});}return respondWithRpcPromise(_0xc90e('0x6d'),_0xc90e('0x6e'),_0x51ead2);})['then'](function(_0x23be25){_0xca9e25(_0x23be25);})['catch'](function(_0x5b5b61){_0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0x5b5b61[_0xc90e('0x17')]));});});}; \ No newline at end of file +var _0x6b8f=['queueId','MailQueue','queue','waitForTheAssignedQueue','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','findAll','options','where','attributes','limit','include','map','model','info','stringify','ShowMailAccount','MailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','account','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','applications','list','priority','autoclose','push','close','*,*,*,*','length','List\x20not\x20found','messageId','generate','subject','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','UserId','unshift','agent','name','waitForTheAssignedAgent'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x56f536,_0x408bcf){_0x56f536=_0x56f536-0x0;var _0x23c6e9=_0x6b8f[_0x56f536];return _0x23c6e9;};'use strict';var _=require('lodash');var moment=require(_0xf6b8('0x0'));var BPromise=require('bluebird');var rs=require(_0xf6b8('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xf6b8('0x2'))(_0xf6b8('0x3'));var config=require('../../config/environment');var jayson=require(_0xf6b8('0x4'));var client=jayson[_0xf6b8('0x5')][_0xf6b8('0x6')]({'port':0x232c});config['redis']=_[_0xf6b8('0x7')](config[_0xf6b8('0x8')],{'host':_0xf6b8('0x9'),'port':0x18eb});var socket=require(_0xf6b8('0xa'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xf6b8('0xb')](socket);function respondWithRpcPromise(_0x577c92,_0x24458c,_0x7ac5fd){return new BPromise(function(_0x16a799,_0x3e6712){return client[_0xf6b8('0xc')](_0x577c92,_0x7ac5fd)[_0xf6b8('0xd')](function(_0x55dad4){logger['info']('MailAccount,\x20%s,\x20%s',_0x24458c,_0xf6b8('0xe'));logger[_0xf6b8('0xf')](_0xf6b8('0x10'),_0x24458c,_0xf6b8('0xe'),JSON['stringify'](_0x55dad4));if(_0x55dad4['error']){if(_0x55dad4[_0xf6b8('0x11')][_0xf6b8('0x12')]===0x1f4){logger['error'](_0xf6b8('0x13'),_0x24458c,_0x55dad4[_0xf6b8('0x11')][_0xf6b8('0x14')]);return _0x3e6712(_0x55dad4['error'][_0xf6b8('0x14')]);}logger['error'](_0xf6b8('0x13'),_0x24458c,_0x55dad4[_0xf6b8('0x11')][_0xf6b8('0x14')]);return _0x16a799(_0x55dad4[_0xf6b8('0x11')][_0xf6b8('0x14')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x24458c,_0xf6b8('0xe'));_0x16a799(_0x55dad4['result'][_0xf6b8('0x14')]);}})[_0xf6b8('0x15')](function(_0x4a93a8){logger['error'](_0xf6b8('0x13'),_0x24458c,_0x4a93a8);_0x3e6712(_0x4a93a8);});});}exports[_0xf6b8('0x16')]=function(_0x3081db){var _0x2cac60=this;return new Promise(function(_0x4df5f4,_0x59f9df){return db['MailAccount'][_0xf6b8('0x17')]({'raw':_0x3081db[_0xf6b8('0x18')]?_0x3081db[_0xf6b8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3081db[_0xf6b8('0x18')]?_0x3081db[_0xf6b8('0x18')][_0xf6b8('0x19')]||null:null,'attributes':_0x3081db[_0xf6b8('0x18')]?_0x3081db['options'][_0xf6b8('0x1a')]||null:null,'limit':_0x3081db['options']?_0x3081db[_0xf6b8('0x18')][_0xf6b8('0x1b')]||null:null,'include':_0x3081db[_0xf6b8('0x18')]?_0x3081db[_0xf6b8('0x18')][_0xf6b8('0x1c')]?_[_0xf6b8('0x1d')](_0x3081db['options'][_0xf6b8('0x1c')],function(_0x1ebfea){return{'model':db[_0x1ebfea['model']],'as':_0x1ebfea['as'],'attributes':_0x1ebfea[_0xf6b8('0x1a')],'include':_0x1ebfea[_0xf6b8('0x1c')]?_[_0xf6b8('0x1d')](_0x1ebfea[_0xf6b8('0x1c')],function(_0x3365b8){return{'model':db[_0x3365b8['model']],'as':_0x3365b8['as'],'attributes':_0x3365b8['attributes'],'include':_0x3365b8[_0xf6b8('0x1c')]?_[_0xf6b8('0x1d')](_0x3365b8['include'],function(_0x459ed0){return{'model':db[_0x459ed0[_0xf6b8('0x1e')]],'as':_0x459ed0['as'],'attributes':_0x459ed0[_0xf6b8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x458935){logger[_0xf6b8('0x1f')]('GetMailAccount',_0x3081db);logger[_0xf6b8('0xf')](_0xf6b8('0x16'),_0x3081db,JSON[_0xf6b8('0x20')](_0x458935));_0x4df5f4(_0x458935);})[_0xf6b8('0x15')](function(_0x51ffcf){logger[_0xf6b8('0x11')](_0xf6b8('0x16'),_0x51ffcf[_0xf6b8('0x14')],_0x3081db);_0x59f9df(_0x2cac60['error'](0x1f4,_0x51ffcf[_0xf6b8('0x14')]));});});};exports[_0xf6b8('0x21')]=function(_0x20af96){var _0x50c0ce=this;return new Promise(function(_0x14a0be,_0x11b040){return db[_0xf6b8('0x22')][_0xf6b8('0x23')]({'raw':_0x20af96['options']?_0x20af96[_0xf6b8('0x18')][_0xf6b8('0x24')]===undefined?!![]:![]:!![],'where':_0x20af96[_0xf6b8('0x18')]?_0x20af96['options']['where']||null:null,'attributes':_0x20af96[_0xf6b8('0x18')]?_0x20af96[_0xf6b8('0x18')][_0xf6b8('0x1a')]||null:null,'include':_0x20af96[_0xf6b8('0x18')]?_0x20af96[_0xf6b8('0x18')][_0xf6b8('0x1c')]?_[_0xf6b8('0x1d')](_0x20af96[_0xf6b8('0x18')][_0xf6b8('0x1c')],function(_0x3b9493){return{'model':db[_0x3b9493[_0xf6b8('0x1e')]],'as':_0x3b9493['as'],'attributes':_0x3b9493[_0xf6b8('0x1a')],'include':_0x3b9493[_0xf6b8('0x1c')]?_[_0xf6b8('0x1d')](_0x3b9493[_0xf6b8('0x1c')],function(_0xad9285){return{'model':db[_0xad9285[_0xf6b8('0x1e')]],'as':_0xad9285['as'],'attributes':_0xad9285[_0xf6b8('0x1a')],'include':_0xad9285['include']?_['map'](_0xad9285[_0xf6b8('0x1c')],function(_0x296d10){return{'model':db[_0x296d10[_0xf6b8('0x1e')]],'as':_0x296d10['as'],'attributes':_0x296d10[_0xf6b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf6b8('0xd')](function(_0x374aa7){if(_0x20af96[_0xf6b8('0x18')][_0xf6b8('0x25')]===!![])_0x374aa7[_0xf6b8('0x26')](_0xf6b8('0x27'),_0x374aa7[_0xf6b8('0x28')]());logger[_0xf6b8('0x1f')]('ShowMailAccount',_0x20af96);logger[_0xf6b8('0xf')](_0xf6b8('0x21'),_0x20af96,JSON['stringify'](_0x374aa7));_0x14a0be(_0x374aa7);})[_0xf6b8('0x15')](function(_0x2e1c69){logger[_0xf6b8('0x11')](_0xf6b8('0x21'),_0x2e1c69[_0xf6b8('0x14')],_0x20af96);_0x11b040(_0x50c0ce[_0xf6b8('0x11')](0x1f4,_0x2e1c69[_0xf6b8('0x14')]));});});};exports[_0xf6b8('0x29')]=function(_0x1c42fe){var _0x3238de=this;return new Promise(function(_0x15a63b,_0x3b0554){var _0x1220d7={'body':_0x1c42fe[_0xf6b8('0x2a')],'channel':'mail'};var _0x4fd756=_['difference'](_[_0xf6b8('0x2b')](db[_0xf6b8('0x2c')][_0xf6b8('0x2d')]),[_0xf6b8('0x2e'),_0xf6b8('0x2f'),_0xf6b8('0x30'),_0xf6b8('0x31')]);var _0x48f4cb=![];if(_0x1c42fe[_0xf6b8('0x2a')]['id']){delete _0x1c42fe['body']['id'];}if(_[_0xf6b8('0x32')](_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x33')])){return _0x3b0554(_0x3238de[_0xf6b8('0x11')](0x1f4,_0xf6b8('0x34')));}if(_['isNil'](_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x2a')])||_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x2a')]===''){return _0x3b0554(_0x3238de[_0xf6b8('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xf6b8('0x32')](_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x35')])){return _0x3b0554(_0x3238de['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fd756));}if(!_[_0xf6b8('0x36')](_0x4fd756,_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x35')])){return _0x3b0554(_0x3238de[_0xf6b8('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fd756));}var _0x53e9eb={};_0x53e9eb[_0x1c42fe['body'][_0xf6b8('0x35')]]=_0x1c42fe['body'][_0xf6b8('0x33')];return db[_0xf6b8('0x22')][_0xf6b8('0x23')]({'where':{'id':_0x1c42fe[_0xf6b8('0x37')]['id']},'include':[{'model':db[_0xf6b8('0x38')],'as':_0xf6b8('0x39'),'include':[{'model':db[_0xf6b8('0x2c')],'as':_0xf6b8('0x3a'),'where':_0x53e9eb,'limit':0x1,'order':[[_0xf6b8('0x2f'),'DESC']]}]},{'model':db[_0xf6b8('0x3b')],'as':'Applications'},{'model':db[_0xf6b8('0x3c')],'as':_0xf6b8('0x3d'),'include':[{'model':db[_0xf6b8('0x3e')],'as':_0xf6b8('0x3e')}]}]})[_0xf6b8('0xd')](function(_0x291845){if(_0x291845&&_0x291845[_0xf6b8('0x39')]){var _0x524b39=_0x291845[_0xf6b8('0x3f')]({'plain':!![]});_0x1220d7[_0xf6b8('0x37')]=_[_0xf6b8('0x40')](_0x524b39,[_0xf6b8('0x41'),'List']);_0x1220d7[_0xf6b8('0x37')][_0xf6b8('0x27')]=_0x291845['getSmtpOptions']();_0x1220d7[_0xf6b8('0x42')]=_0x524b39[_0xf6b8('0x41')];_0x1220d7[_0xf6b8('0x43')]=_0x524b39[_0xf6b8('0x39')];_0x1220d7[_0xf6b8('0x42')]=_['orderBy'](_0x1220d7[_0xf6b8('0x42')],[_0xf6b8('0x44')],['asc']);if(_0x1220d7['account']&&_0x1220d7['account'][_0xf6b8('0x45')]){_0x1220d7[_0xf6b8('0x42')][_0xf6b8('0x46')]({'id':0x0,'priority':_0x1220d7[_0xf6b8('0x42')]['length']+0x1,'app':_0xf6b8('0x47'),'appdata':_0xf6b8('0x45'),'interval':_0xf6b8('0x48')});}if(_0x1220d7[_0xf6b8('0x37')][_0xf6b8('0x41')]){delete _0x1220d7[_0xf6b8('0x37')][_0xf6b8('0x41')];}if(_0x1220d7['account']['List']){delete _0x1220d7[_0xf6b8('0x37')][_0xf6b8('0x39')];}if(_0x524b39['List']['Contacts'][_0xf6b8('0x49')]){return _0x524b39[_0xf6b8('0x39')][_0xf6b8('0x3a')][0x0];}var _0x25cf3d=_[_0xf6b8('0x7')](_0x1c42fe[_0xf6b8('0x2a')],{'firstName':_0x1c42fe['body'][_0xf6b8('0x33')],'ListId':_0x524b39[_0xf6b8('0x31')]});_0x25cf3d[_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x35')]]=_0x1c42fe['body'][_0xf6b8('0x33')];return db[_0xf6b8('0x2c')]['create'](_0x25cf3d);}else{throw new Error(_0xf6b8('0x4a'));}})[_0xf6b8('0xd')](function(_0x33b639){_0x1220d7['contact']=_0x33b639;if(_0x33b639){if(!_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4b')]){_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4b')]=rs[_0xf6b8('0x4c')]()+'\x20'+_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x33')];}var _0x1b3559={'ContactId':_0x33b639['id'],'MailAccountId':_0x1c42fe[_0xf6b8('0x37')]['id'],'inReplyTo':_0x1c42fe['body']['message']['messageId'],'to':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x33')],'cc':_0x1c42fe[_0xf6b8('0x2a')]['message']['cc'],'subject':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4d')],'attach':_0x1c42fe['body'][_0xf6b8('0x14')][_0xf6b8('0x4e')],'lastMsgAt':moment()[_0xf6b8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf6b8('0x23')]({'where':{'closed':![],'MailAccountId':_0x1c42fe[_0xf6b8('0x37')]['id']},'include':[{'model':db[_0xf6b8('0x50')],'as':_0xf6b8('0x51'),'attributes':['messageId'],'where':{'messageId':_0x1c42fe[_0xf6b8('0x2a')]['message'][_0xf6b8('0x52')]}}]})[_0xf6b8('0xd')](function(_0x1b51bc){if(_0x1b51bc){return[_0x1b51bc,![]];}return db[_0xf6b8('0x53')][_0xf6b8('0x54')](_0x1b3559)['then'](function(_0x2f62f7){return[_0x2f62f7,!![]];});});}else{throw new Error(_0xf6b8('0x55'));}})[_0xf6b8('0x56')](function(_0x28e1d7,_0x1980de){if(_0x28e1d7){_0x48f4cb=_0x1980de;if(!_0x1980de){return _0x28e1d7[_0xf6b8('0x57')]({'inReplyTo':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4b')],'to':_0x1c42fe[_0xf6b8('0x2a')]['message'][_0xf6b8('0x33')],'cc':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')]['cc'],'subject':_0x1c42fe['body'][_0xf6b8('0x14')]['subject'],'attach':_0x28e1d7[_0xf6b8('0x4e')]?_0x28e1d7['attach']:_0x1c42fe['body'][_0xf6b8('0x14')][_0xf6b8('0x4e')],'substatus':null,'substatusAt':moment()[_0xf6b8('0x4f')](_0xf6b8('0x58')),'lastMsgAt':moment()[_0xf6b8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x28e1d7;}}})[_0xf6b8('0xd')](function(_0x2af21e){_0x1220d7['interaction']=_0x2af21e['get']({'plain':!![]});_0x1220d7[_0xf6b8('0x59')][_0xf6b8('0x5a')]=_0x48f4cb;return db[_0xf6b8('0x50')][_0xf6b8('0x54')]({'body':_0x1c42fe[_0xf6b8('0x2a')]['body'],'MailAccountId':_0x1c42fe['account']['id'],'MailInteractionId':_0x2af21e['id'],'direction':'in','ContactId':_0x1220d7[_0xf6b8('0x5b')]['id'],'messageId':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4b')],'from':_0x1c42fe['body'][_0xf6b8('0x14')][_0xf6b8('0x33')],'to':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')]['to'],'cc':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')]['cc'],'subject':_0x1c42fe[_0xf6b8('0x2a')]['message']['subject'],'attach':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x4e')],'Attachments':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x5c')],'originTo':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')]['originTo'],'originCc':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x5d')],'bcc':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')]['bcc'],'ChatWebsiteId':_0x1c42fe[_0xf6b8('0x2a')]['message'][_0xf6b8('0x5e')]||null,'originChannel':_0x1c42fe[_0xf6b8('0x2a')][_0xf6b8('0x14')][_0xf6b8('0x5f')]||_0xf6b8('0x60'),'ChatOfflineMessageId':_0x1c42fe[_0xf6b8('0x2a')]['message'][_0xf6b8('0x61')]||null},{'include':[{'model':db[_0xf6b8('0x62')],'as':_0xf6b8('0x63')}]});})[_0xf6b8('0xd')](function(_0x396a7c){_0x1220d7[_0xf6b8('0x14')]=_0x396a7c;if(!_0x1220d7[_0xf6b8('0x59')]['UserId']){return;}return db[_0xf6b8('0x64')][_0xf6b8('0x23')]({'attributes':['id','name'],'where':{'id':_0x1220d7[_0xf6b8('0x59')][_0xf6b8('0x65')]}});})[_0xf6b8('0xd')](function(_0x288b94){if(_0x288b94){_0x1220d7['applications'][_0xf6b8('0x66')]({'id':0x0,'priority':0x0,'app':_0xf6b8('0x67'),'appdata':_0x288b94[_0xf6b8('0x68')]+','+(_0x1220d7['account'][_0xf6b8('0x69')]||0xa),'interval':'*,*,*,*'});}if(!_0x1220d7['interaction'][_0xf6b8('0x6a')]){return;}return db[_0xf6b8('0x6b')][_0xf6b8('0x23')]({'attributes':['id',_0xf6b8('0x68')],'where':{'id':_0x1220d7[_0xf6b8('0x59')][_0xf6b8('0x6a')]}});})[_0xf6b8('0xd')](function(_0x2e66bf){if(_0x2e66bf){_0x1220d7[_0xf6b8('0x42')][_0xf6b8('0x66')]({'id':0x0,'priority':0x1,'app':_0xf6b8('0x6c'),'appdata':_0x2e66bf[_0xf6b8('0x68')]+','+(_0x1220d7[_0xf6b8('0x37')][_0xf6b8('0x6d')]||0x12c),'interval':_0xf6b8('0x48')});}return respondWithRpcPromise('Start','startRouting',_0x1220d7);})[_0xf6b8('0xd')](function(_0x4463e5){_0x15a63b(_0x4463e5);})['catch'](function(_0x171db9){_0x3b0554(_0x3238de[_0xf6b8('0x11')](0x1f4,_0x171db9[_0xf6b8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3b67b24..72971c6 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 _0xfc61=['length','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x557a59,_0xda6692){var _0x21176d=function(_0xbc8118){while(--_0xbc8118){_0x557a59['push'](_0x557a59['shift']());}};_0x21176d(++_0xda6692);}(_0xfc61,0x78));var _0x1fc6=function(_0x9b7e1c,_0x3680d7){_0x9b7e1c=_0x9b7e1c-0x0;var _0xa3b16=_0xfc61[_0x9b7e1c];return _0xa3b16;};'use strict';var MailAccountEvents=require(_0x1fc6('0x0'));var events=[_0x1fc6('0x1'),_0x1fc6('0x2'),_0x1fc6('0x3')];function createListener(_0x49b30c,_0x569481){return function(_0x4be6d6){_0x569481[_0x1fc6('0x4')](_0x49b30c,_0x4be6d6);};}function removeListener(_0x3a7772,_0x451c27){return function(){MailAccountEvents[_0x1fc6('0x5')](_0x3a7772,_0x451c27);};}exports['register']=function(_0x5b5f8c){for(var _0x2c32ca=0x0,_0x2afe7c=events[_0x1fc6('0x6')];_0x2c32ca<_0x2afe7c;_0x2c32ca++){var _0x3b7967=events[_0x2c32ca];var _0x377d87=createListener('mailAccount:'+_0x3b7967,_0x5b5f8c);MailAccountEvents['on'](_0x3b7967,_0x377d87);}}; \ No newline at end of file +var _0x9a86=['save','remove','emit','removeListener','register','length','./mailAccount.events'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x9a86,0xae));var _0x69a8=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x9a86[_0x18fb16];return _0x147b0d;};'use strict';var MailAccountEvents=require(_0x69a8('0x0'));var events=[_0x69a8('0x1'),_0x69a8('0x2'),'update'];function createListener(_0x5c1607,_0x3cd1f5){return function(_0x3c3b23){_0x3cd1f5[_0x69a8('0x3')](_0x5c1607,_0x3c3b23);};}function removeListener(_0x37a823,_0x30a80e){return function(){MailAccountEvents[_0x69a8('0x4')](_0x37a823,_0x30a80e);};}exports[_0x69a8('0x5')]=function(_0x3e3e69){for(var _0x59326a=0x0,_0x31d6aa=events[_0x69a8('0x6')];_0x59326a<_0x31d6aa;_0x59326a++){var _0x2b2af1=events[_0x59326a];var _0xbb0bc2=createListener('mailAccount:'+_0x2b2af1,_0x3e3e69);MailAccountEvents['on'](_0x2b2af1,_0xbb0bc2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 21407bd..5db3b7b 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 _0x5ea8=['put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show'];(function(_0xf9ec57,_0x206572){var _0x33af02=function(_0x348e87){while(--_0x348e87){_0xf9ec57['push'](_0xf9ec57['shift']());}};_0x33af02(++_0x206572);}(_0x5ea8,0x94));var _0x85ea=function(_0x39c6c9,_0x3f09d3){_0x39c6c9=_0x39c6c9-0x0;var _0x5d8d32=_0x5ea8[_0x39c6c9];return _0x5d8d32;};'use strict';var multer=require(_0x85ea('0x0'));var util=require(_0x85ea('0x1'));var path=require(_0x85ea('0x2'));var timeout=require(_0x85ea('0x3'));var express=require('express');var router=express[_0x85ea('0x4')]();var fs_extra=require(_0x85ea('0x5'));var auth=require(_0x85ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x85ea('0x7'));var controller=require(_0x85ea('0x8'));router[_0x85ea('0x9')]('/:id',auth[_0x85ea('0xa')](),controller[_0x85ea('0xb')]);router[_0x85ea('0xc')](_0x85ea('0xd'),auth['isAuthenticated'](),controller[_0x85ea('0xe')]);router[_0x85ea('0xf')](_0x85ea('0xd'),auth[_0x85ea('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0af1=['../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x35de57,_0x11b2cb){var _0x1b509d=function(_0x4af6f9){while(--_0x4af6f9){_0x35de57['push'](_0x35de57['shift']());}};_0x1b509d(++_0x11b2cb);}(_0x0af1,0x16a));var _0x10af=function(_0x3ca170,_0x5e2dda){_0x3ca170=_0x3ca170-0x0;var _0x51d086=_0x0af1[_0x3ca170];return _0x51d086;};'use strict';var multer=require(_0x10af('0x0'));var util=require('util');var path=require(_0x10af('0x1'));var timeout=require(_0x10af('0x2'));var express=require(_0x10af('0x3'));var router=express['Router']();var fs_extra=require(_0x10af('0x4'));var auth=require(_0x10af('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x10af('0x6'));var controller=require(_0x10af('0x7'));router[_0x10af('0x8')](_0x10af('0x9'),auth[_0x10af('0xa')](),controller[_0x10af('0xb')]);router[_0x10af('0xc')](_0x10af('0x9'),auth[_0x10af('0xa')](),controller['update']);router[_0x10af('0xd')](_0x10af('0x9'),auth[_0x10af('0xa')](),controller[_0x10af('0xe')]);module[_0x10af('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 50fb2e8..28c0c2c 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 _0xfc18=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x5b00a0,_0x3430e1){var _0x3fb7ce=function(_0x5a975c){while(--_0x5a975c){_0x5b00a0['push'](_0x5b00a0['shift']());}};_0x3fb7ce(++_0x3430e1);}(_0xfc18,0xa2));var _0x8fc1=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xfc18[_0x340380];return _0x49ce1c;};'use strict';var Sequelize=require(_0x8fc1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8fc1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fc1('0x2')},'appdata':{'type':Sequelize[_0x8fc1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8fc1('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0e1d=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2fa7d2,_0x11096d){var _0x3ead3b=function(_0x541385){while(--_0x541385){_0x2fa7d2['push'](_0x2fa7d2['shift']());}};_0x3ead3b(++_0x11096d);}(_0x0e1d,0x1b8));var _0xd0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd0e1('0x0'));module[_0xd0e1('0x1')]={'priority':{'type':Sequelize[_0xd0e1('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd0e1('0x3')},'appdata':{'type':Sequelize[_0xd0e1('0x4')]()},'description':{'type':Sequelize[_0xd0e1('0x5')]},'interval':{'type':Sequelize[_0xd0e1('0x5')],'defaultValue':_0xd0e1('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2c2703a..0a793b8 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x3128eb,_0x395845){var _0x1e1d68=function(_0x2db2ea){while(--_0x2db2ea){_0x3128eb['push'](_0x3128eb['shift']());}};_0x1e1d68(++_0x395845);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x147e9e,_0x3dfac5){var _0x1b42cf=function(_0x3a9bdc){while(--_0x3a9bdc){_0x147e9e['push'](_0x147e9e['shift']());}};_0x1b42cf(++_0x3dfac5);}(_0x70e0,0x17b));var _0x070e=function(_0xbd60b8,_0x509599){_0xbd60b8=_0xbd60b8-0x0;var _0x516a63=_0x70e0[_0xbd60b8];return _0x516a63;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5d0d823..42ffc6d 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 _0x7c45=['moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','../../config/logger'];(function(_0x2b57a4,_0x14c5e1){var _0x5d1f8b=function(_0x5753a9){while(--_0x5753a9){_0x2b57a4['push'](_0x2b57a4['shift']());}};_0x5d1f8b(++_0x14c5e1);}(_0x7c45,0x15f));var _0x57c4=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7c45[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x57c4('0x0'))('api');var moment=require(_0x57c4('0x1'));var BPromise=require('bluebird');var rp=require(_0x57c4('0x2'));var fs=require('fs');var path=require(_0x57c4('0x3'));var rimraf=require(_0x57c4('0x4'));var config=require(_0x57c4('0x5'));var attributes=require(_0x57c4('0x6'));module[_0x57c4('0x7')]=function(_0x2f98a0,_0x5d223b){return _0x2f98a0['define'](_0x57c4('0x8'),attributes,{'tableName':_0x57c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x57c4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2aee=['path','rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x2aee,0xa1));var _0xe2ae=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x2aee[_0x46a3ff];return _0x404bc2;};'use strict';var _=require(_0xe2ae('0x0'));var util=require(_0xe2ae('0x1'));var logger=require(_0xe2ae('0x2'))('api');var moment=require(_0xe2ae('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ae('0x4'));var rimraf=require(_0xe2ae('0x5'));var config=require(_0xe2ae('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x296991,_0x2d22e5){return _0x296991[_0xe2ae('0x7')](_0xe2ae('0x8'),attributes,{'tableName':_0xe2ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe2ae('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3a263bb..2219a0e 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 _0x7cf5=['util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x7cf5,0x152));var _0x57cf=function(_0x3deb3f,_0x3feec8){_0x3deb3f=_0x3deb3f-0x0;var _0x1f0fe5=_0x7cf5[_0x3deb3f];return _0x1f0fe5;};'use strict';var _=require('lodash');var util=require(_0x57cf('0x0'));var moment=require(_0x57cf('0x1'));var BPromise=require(_0x57cf('0x2'));var rs=require(_0x57cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x57cf('0x4'));var config=require(_0x57cf('0x5'));var jayson=require(_0x57cf('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f57b9,_0x9b3223,_0x2b354e){return new BPromise(function(_0xe45e04,_0x5b44ab){return client[_0x57cf('0x7')](_0x4f57b9,_0x2b354e)[_0x57cf('0x8')](function(_0x244206){logger[_0x57cf('0x9')](_0x57cf('0xa'),_0x9b3223,_0x57cf('0xb'));logger[_0x57cf('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x9b3223,'request\x20sent',JSON[_0x57cf('0xd')](_0x244206));if(_0x244206[_0x57cf('0xe')]){if(_0x244206['error']['code']===0x1f4){logger['error'](_0x57cf('0xa'),_0x9b3223,_0x244206[_0x57cf('0xe')]['message']);return _0x5b44ab(_0x244206[_0x57cf('0xe')][_0x57cf('0xf')]);}logger[_0x57cf('0xe')](_0x57cf('0xa'),_0x9b3223,_0x244206[_0x57cf('0xe')][_0x57cf('0xf')]);return _0xe45e04(_0x244206['error'][_0x57cf('0xf')]);}else{logger[_0x57cf('0x9')]('MailApplication,\x20%s,\x20%s',_0x9b3223,_0x57cf('0xb'));_0xe45e04(_0x244206['result'][_0x57cf('0xf')]);}})[_0x57cf('0x10')](function(_0x410355){logger['error']('MailApplication,\x20%s,\x20%s',_0x9b3223,_0x410355);_0x5b44ab(_0x410355);});});}exports[_0x57cf('0x11')]=function(_0x1e7403){var _0x315b52=this;return new Promise(function(_0xb24496,_0x409c04){return db[_0x57cf('0x12')][_0x57cf('0x13')](_0x1e7403[_0x57cf('0x14')],{'raw':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7403[_0x57cf('0x15')]?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x17')]||null:null,'attributes':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x18')]||null:null,'limit':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x19')]||null:null})['then'](function(_0x10483c){logger[_0x57cf('0x9')]('UpdateMailApplication',_0x1e7403);logger[_0x57cf('0xc')]('UpdateMailApplication',_0x1e7403,JSON['stringify'](_0x10483c));_0xb24496(_0x10483c);})[_0x57cf('0x10')](function(_0x411f03){logger[_0x57cf('0xe')](_0x57cf('0x11'),_0x411f03['message'],_0x1e7403);_0x409c04(_0x315b52[_0x57cf('0xe')](0x1f4,_0x411f03[_0x57cf('0xf')]));});});}; \ No newline at end of file +var _0x0e1e=['http','request','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0x0e1e,0x13d));var _0xe0e1=function(_0xc8a8b,_0x19c9ae){_0xc8a8b=_0xc8a8b-0x0;var _0x3a04ca=_0x0e1e[_0xc8a8b];return _0x3a04ca;};'use strict';var _=require(_0xe0e1('0x0'));var util=require(_0xe0e1('0x1'));var moment=require(_0xe0e1('0x2'));var BPromise=require(_0xe0e1('0x3'));var rs=require(_0xe0e1('0x4'));var fs=require('fs');var Redis=require(_0xe0e1('0x5'));var db=require(_0xe0e1('0x6'))['db'];var utils=require(_0xe0e1('0x7'));var logger=require(_0xe0e1('0x8'))(_0xe0e1('0x9'));var config=require(_0xe0e1('0xa'));var jayson=require(_0xe0e1('0xb'));var client=jayson[_0xe0e1('0xc')][_0xe0e1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x86902a,_0x56db8a,_0x2b0907){return new BPromise(function(_0x2d0e72,_0xa5e94a){return client[_0xe0e1('0xe')](_0x86902a,_0x2b0907)['then'](function(_0xc61bf7){logger['info']('MailApplication,\x20%s,\x20%s',_0x56db8a,_0xe0e1('0xf'));logger[_0xe0e1('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x56db8a,'request\x20sent',JSON[_0xe0e1('0x11')](_0xc61bf7));if(_0xc61bf7[_0xe0e1('0x12')]){if(_0xc61bf7[_0xe0e1('0x12')][_0xe0e1('0x13')]===0x1f4){logger[_0xe0e1('0x12')](_0xe0e1('0x14'),_0x56db8a,_0xc61bf7[_0xe0e1('0x12')][_0xe0e1('0x15')]);return _0xa5e94a(_0xc61bf7[_0xe0e1('0x12')][_0xe0e1('0x15')]);}logger[_0xe0e1('0x12')](_0xe0e1('0x14'),_0x56db8a,_0xc61bf7[_0xe0e1('0x12')]['message']);return _0x2d0e72(_0xc61bf7['error'][_0xe0e1('0x15')]);}else{logger[_0xe0e1('0x16')](_0xe0e1('0x14'),_0x56db8a,_0xe0e1('0xf'));_0x2d0e72(_0xc61bf7[_0xe0e1('0x17')][_0xe0e1('0x15')]);}})[_0xe0e1('0x18')](function(_0x4a8d10){logger[_0xe0e1('0x12')](_0xe0e1('0x14'),_0x56db8a,_0x4a8d10);_0xa5e94a(_0x4a8d10);});});}exports[_0xe0e1('0x19')]=function(_0xfa5037){var _0x3f9416=this;return new Promise(function(_0x44d662,_0x3638cc){return db[_0xe0e1('0x1a')][_0xe0e1('0x1b')](_0xfa5037['body'],{'raw':_0xfa5037[_0xe0e1('0x1c')]?_0xfa5037[_0xe0e1('0x1c')][_0xe0e1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa5037[_0xe0e1('0x1c')]?_0xfa5037['options'][_0xe0e1('0x1e')]||null:null,'attributes':_0xfa5037[_0xe0e1('0x1c')]?_0xfa5037[_0xe0e1('0x1c')][_0xe0e1('0x1f')]||null:null,'limit':_0xfa5037[_0xe0e1('0x1c')]?_0xfa5037[_0xe0e1('0x1c')][_0xe0e1('0x20')]||null:null})['then'](function(_0x4f8649){logger['info'](_0xe0e1('0x19'),_0xfa5037);logger[_0xe0e1('0x10')]('UpdateMailApplication',_0xfa5037,JSON[_0xe0e1('0x11')](_0x4f8649));_0x44d662(_0x4f8649);})[_0xe0e1('0x18')](function(_0x348bff){logger[_0xe0e1('0x12')]('UpdateMailApplication',_0x348bff[_0xe0e1('0x15')],_0xfa5037);_0x3638cc(_0x3f9416[_0xe0e1('0x12')](0x1f4,_0x348bff[_0xe0e1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7a604d6..bb4eb97 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 _0xd4a8=['/:id','isAuthenticated','show','getMessages','create','post','/:id/messages','addMessage','tracked','addTags','put','mail','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','Router','./mailInteraction.controller','get','index','/describe','describe'];(function(_0x3e1c31,_0x2918e8){var _0x5adfb9=function(_0x4eb347){while(--_0x4eb347){_0x3e1c31['push'](_0x3e1c31['shift']());}};_0x5adfb9(++_0x2918e8);}(_0xd4a8,0x1f1));var _0x8d4a=function(_0x450a7e,_0x39ca8b){_0x450a7e=_0x450a7e-0x0;var _0x42c4c4=_0xd4a8[_0x450a7e];return _0x42c4c4;};'use strict';var express=require(_0x8d4a('0x0'));var router=express[_0x8d4a('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0x8d4a('0x2'));router[_0x8d4a('0x3')]('/',auth['isAuthenticated'](),controller[_0x8d4a('0x4')]);router['get'](_0x8d4a('0x5'),auth['isAuthenticated'](),controller[_0x8d4a('0x6')]);router['get'](_0x8d4a('0x7'),auth[_0x8d4a('0x8')](),controller[_0x8d4a('0x9')]);router['get']('/:id/messages',auth[_0x8d4a('0x8')](),controller[_0x8d4a('0xa')]);router[_0x8d4a('0x3')]('/:id/download',auth[_0x8d4a('0x8')](),controller['download']);router['post']('/',auth[_0x8d4a('0x8')](),controller[_0x8d4a('0xb')]);router[_0x8d4a('0xc')](_0x8d4a('0xd'),auth['isAuthenticated'](),controller[_0x8d4a('0xe')]);router[_0x8d4a('0xc')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8d4a('0xf')]('mail','mailinteraction:addtags'),controller[_0x8d4a('0x10')]);router[_0x8d4a('0x11')](_0x8d4a('0x7'),auth['isAuthenticated'](),interaction['tracked'](_0x8d4a('0x12'),'mailinteraction:update'),controller['update']);router['delete'](_0x8d4a('0x7'),auth[_0x8d4a('0x8')](),interaction[_0x8d4a('0xf')](_0x8d4a('0x12'),_0x8d4a('0x13')),controller[_0x8d4a('0x14')]);router['delete'](_0x8d4a('0x15'),auth['isAuthenticated'](),controller[_0x8d4a('0x16')]);module[_0x8d4a('0x17')]=router; \ No newline at end of file +var _0x496a=['put','mailinteraction:update','update','delete','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x496a,0x89));var _0xa496=function(_0x525f71,_0x1d3fee){_0x525f71=_0x525f71-0x0;var _0x3605ad=_0x496a[_0x525f71];return _0x3605ad;};'use strict';var express=require(_0xa496('0x0'));var router=express['Router']();var auth=require(_0xa496('0x1'));var interaction=require(_0xa496('0x2'));var controller=require(_0xa496('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa496('0x4')](_0xa496('0x5'),auth['isAuthenticated'](),controller[_0xa496('0x6')]);router['get'](_0xa496('0x7'),auth[_0xa496('0x8')](),controller[_0xa496('0x9')]);router[_0xa496('0x4')](_0xa496('0xa'),auth['isAuthenticated'](),controller[_0xa496('0xb')]);router['get'](_0xa496('0xc'),auth[_0xa496('0x8')](),controller[_0xa496('0xd')]);router[_0xa496('0xe')]('/',auth[_0xa496('0x8')](),controller['create']);router[_0xa496('0xe')](_0xa496('0xa'),auth[_0xa496('0x8')](),controller[_0xa496('0xf')]);router[_0xa496('0xe')](_0xa496('0x10'),auth[_0xa496('0x8')](),interaction[_0xa496('0x11')](_0xa496('0x12'),'mailinteraction:addtags'),controller['addTags']);router[_0xa496('0x13')](_0xa496('0x7'),auth['isAuthenticated'](),interaction['tracked'](_0xa496('0x12'),_0xa496('0x14')),controller[_0xa496('0x15')]);router[_0xa496('0x16')](_0xa496('0x7'),auth[_0xa496('0x8')](),interaction[_0xa496('0x11')](_0xa496('0x12'),'mailinteraction:destroy'),controller[_0xa496('0x17')]);router[_0xa496('0x16')](_0xa496('0x10'),auth[_0xa496('0x8')](),controller[_0xa496('0x18')]);module[_0xa496('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 81acf4b..f895901 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 _0xfeb1=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x33ee75,_0x547bc9){var _0x686ef9=function(_0xe67e93){while(--_0xe67e93){_0x33ee75['push'](_0x33ee75['shift']());}};_0x686ef9(++_0x547bc9);}(_0xfeb1,0x8c));var _0x1feb=function(_0x171086,_0x381396){_0x171086=_0x171086-0x0;var _0x5e844f=_0xfeb1[_0x171086];return _0x5e844f;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1feb('0x1')]},'disposition':{'type':Sequelize[_0x1feb('0x2')]},'secondDisposition':{'type':Sequelize[_0x1feb('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1feb('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1feb('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1feb('0x3')](_0x1feb('0x4'))},'subject':{'type':Sequelize[_0x1feb('0x3')]()},'attach':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1feb('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x1feb('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x1feb('0x5')]('in',_0x1feb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1feb('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1feb('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x953d=['TEXT','long','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x117892,_0xe418c4){var _0x5fc5c6=function(_0x4e5765){while(--_0x4e5765){_0x117892['push'](_0x117892['shift']());}};_0x5fc5c6(++_0xe418c4);}(_0x953d,0x152));var _0xd953=function(_0x251ff8,_0x181c7f){_0x251ff8=_0x251ff8-0x0;var _0xda0abc=_0x953d[_0x251ff8];return _0xda0abc;};'use strict';var Sequelize=require(_0xd953('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xd953('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd953('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd953('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd953('0x3')]},'note':{'type':Sequelize[_0xd953('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xd953('0x3')]},'cc':{'type':Sequelize[_0xd953('0x4')](_0xd953('0x5'))},'subject':{'type':Sequelize[_0xd953('0x4')]()},'attach':{'type':Sequelize[_0xd953('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd953('0x2')]},'substatus':{'type':Sequelize[_0xd953('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd953('0x6')]('in',_0xd953('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd953('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd953('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd953('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 580d5e5..d805a6f 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 _0x9df2=['transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','createdAt','Messages','mkdirSync','each','missing.recipient@your.company.com','subject','decode','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailInteraction.socket','register','sendStatus','status','json','undefined','offset','count','set','update','then','destroy','end','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','findAll','mail','query','user','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','find','create','body','describe','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','limit','sort','pick','MailInteractionId','filter','where','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','attachments'];(function(_0x1f2b84,_0x14d770){var _0x162453=function(_0xd9cdee){while(--_0xd9cdee){_0x1f2b84['push'](_0x1f2b84['shift']());}};_0x162453(++_0x14d770);}(_0x9df2,0x16b));var _0x29df=function(_0x49f03c,_0xf40861){_0x49f03c=_0x49f03c-0x0;var _0x16c0d7=_0x9df2[_0x49f03c];return _0x16c0d7;};'use strict';var emlformat=require(_0x29df('0x0'));var rimraf=require(_0x29df('0x1'));var zipdir=require(_0x29df('0x2'));var moment=require(_0x29df('0x3'));var BPromise=require(_0x29df('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x29df('0x5'));var juice=require('juice');var Redis=require(_0x29df('0x6'));var interaction=require(_0x29df('0x7'));var qs=require(_0x29df('0x8'));var logger=require(_0x29df('0x9'))(_0x29df('0xa'));var config=require(_0x29df('0xb'));var db=require(_0x29df('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x29df('0xd')]=_['defaults'](config[_0x29df('0xd')],{'host':_0x29df('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x29df('0xf'))[_0x29df('0x10')](socket);function respondWithStatusCode(_0x3c6277,_0x12cf9d){_0x12cf9d=_0x12cf9d||0xcc;return function(_0x5b2788){if(_0x5b2788){return _0x3c6277[_0x29df('0x11')](_0x12cf9d);}return _0x3c6277[_0x29df('0x12')](_0x12cf9d)['end']();};}function respondWithResult(_0x142b8e,_0xcf580b){_0xcf580b=_0xcf580b||0xc8;return function(_0x212ac7){if(_0x212ac7){return _0x142b8e[_0x29df('0x12')](_0xcf580b)[_0x29df('0x13')](_0x212ac7);}};}function respondWithFilteredResult(_0x7568f0,_0x846846){return function(_0x3b56c7){if(_0x3b56c7){var _0x3fb2de=typeof _0x846846['offset']===_0x29df('0x14')&&typeof _0x846846['limit']===_0x29df('0x14');var _0x48f2f1=_0x3b56c7['count'];var _0x3dc469=_0x3fb2de?0x0:_0x846846[_0x29df('0x15')];var _0x387087=_0x3fb2de?_0x3b56c7[_0x29df('0x16')]:_0x846846[_0x29df('0x15')]+_0x846846['limit'];var _0x522ff5;if(_0x387087>=_0x48f2f1){_0x387087=_0x48f2f1;_0x522ff5=0xc8;}else{_0x522ff5=0xce;}_0x7568f0[_0x29df('0x12')](_0x522ff5);return _0x7568f0[_0x29df('0x17')]('Content-Range',_0x3dc469+'-'+_0x387087+'/'+_0x48f2f1)[_0x29df('0x13')](_0x3b56c7);}return null;};}function saveUpdates(_0x5b5c61){return function(_0x44d73a){if(_0x44d73a){return _0x44d73a[_0x29df('0x18')](_0x5b5c61)[_0x29df('0x19')](function(_0x18ff11){return _0x18ff11;});}return null;};}function removeEntity(_0x182f75){return function(_0x520517){if(_0x520517){return _0x520517[_0x29df('0x1a')]()[_0x29df('0x19')](function(){_0x182f75[_0x29df('0x12')](0xcc)[_0x29df('0x1b')]();});}};}function handleEntityNotFound(_0x6691){return function(_0x9a40c){if(!_0x9a40c){_0x6691[_0x29df('0x11')](0x194);}return _0x9a40c;};}function handleError(_0x5642f6,_0x24bee9){_0x24bee9=_0x24bee9||0x1f4;return function(_0x522a8f){logger[_0x29df('0x1c')](_0x522a8f[_0x29df('0x1d')]);if(_0x522a8f[_0x29df('0x1e')]){delete _0x522a8f[_0x29df('0x1e')];}_0x5642f6[_0x29df('0x12')](_0x24bee9)[_0x29df('0x1f')](_0x522a8f);};}exports[_0x29df('0x20')]=function(_0x27c804,_0x2a4e4b){var _0x7ab03e={};var _0x3c9aa6=_['map'](db[_0x29df('0x21')][_0x29df('0x22')],function(_0x574037){return{'name':_0x574037[_0x29df('0x23')],'type':_0x574037[_0x29df('0x24')]['key']};});_0x7ab03e=qs['getOptions'](_0x3c9aa6,_0x27c804);return interaction[_0x29df('0x25')](_0x29df('0x26'),_0x27c804[_0x29df('0x27')],_0x27c804[_0x29df('0x28')],_0x7ab03e,_0x3c9aa6)[_0x29df('0x19')](respondWithFilteredResult(_0x2a4e4b,_0x7ab03e))[_0x29df('0x29')](handleError(_0x2a4e4b,null));};exports['show']=function(_0x3d6945,_0x39f195){var _0x239b24={'raw':![],'where':{'id':_0x3d6945[_0x29df('0x2a')]['id']}},_0x5cbdf3={};_0x5cbdf3['model']=_['keys'](db[_0x29df('0x21')][_0x29df('0x22')]);_0x5cbdf3[_0x29df('0x27')]=_[_0x29df('0x2b')](_0x3d6945[_0x29df('0x27')]);_0x5cbdf3[_0x29df('0x2c')]=_[_0x29df('0x2d')](_0x5cbdf3['model'],_0x5cbdf3[_0x29df('0x27')]);_0x239b24[_0x29df('0x2e')]=_[_0x29df('0x2d')](_0x5cbdf3[_0x29df('0x2f')],qs[_0x29df('0x30')](_0x3d6945[_0x29df('0x27')]['fields']));_0x239b24[_0x29df('0x2e')]=_0x239b24[_0x29df('0x2e')][_0x29df('0x31')]?_0x239b24['attributes']:_0x5cbdf3[_0x29df('0x2f')];if(_0x3d6945[_0x29df('0x27')][_0x29df('0x32')]){_0x239b24[_0x29df('0x33')]=[{'all':!![]}];}_0x239b24=_['merge']({},_0x239b24,_0x3d6945['options']);return db[_0x29df('0x21')][_0x29df('0x34')](_0x239b24)[_0x29df('0x19')](handleEntityNotFound(_0x39f195,null))[_0x29df('0x19')](respondWithResult(_0x39f195,null))[_0x29df('0x29')](handleError(_0x39f195,null));};exports['create']=function(_0x42598,_0x313158){return db[_0x29df('0x21')][_0x29df('0x35')](_0x42598[_0x29df('0x36')],{})[_0x29df('0x19')](respondWithResult(_0x313158,0xc9))[_0x29df('0x29')](handleError(_0x313158,null));};exports[_0x29df('0x18')]=function(_0x3e6bac,_0x200955){if(_0x3e6bac[_0x29df('0x36')]['id']){delete _0x3e6bac['body']['id'];}return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x3e6bac[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x200955,null))[_0x29df('0x19')](saveUpdates(_0x3e6bac[_0x29df('0x36')],null))[_0x29df('0x19')](respondWithResult(_0x200955,null))[_0x29df('0x29')](handleError(_0x200955,null));};exports[_0x29df('0x1a')]=function(_0x103f45,_0x32bf0d){return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x103f45[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x32bf0d,null))[_0x29df('0x19')](removeEntity(_0x32bf0d,null))[_0x29df('0x29')](handleError(_0x32bf0d,null));};exports['describe']=function(_0x6de3cd,_0x3d0884){return db[_0x29df('0x21')][_0x29df('0x37')]()['then'](respondWithResult(_0x3d0884,null))[_0x29df('0x29')](handleError(_0x3d0884,null));};exports['addMessage']=function(_0x5af3c7,_0x5069ab){return db[_0x29df('0x38')][_0x29df('0x34')]({'where':{'id':_0x5af3c7[_0x29df('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5069ab,null))[_0x29df('0x19')](function(_0x752270){if(_0x752270){return _0x752270['addMessage'](_0x5af3c7['body'][_0x29df('0x39')],_['omit'](_0x5af3c7[_0x29df('0x36')],[_0x29df('0x39'),'id'])||{});}})[_0x29df('0x19')](respondWithResult(_0x5069ab,null))[_0x29df('0x29')](handleError(_0x5069ab,null));};exports[_0x29df('0x3a')]=function(_0x47723d,_0x4d7d58){var _0x3a3a3f={'raw':![],'where':{}};var _0x3e3469={};var _0x4aa5e3={'count':0x0,'rows':[]};return db[_0x29df('0x21')][_0x29df('0x3b')]({'where':{'id':_0x47723d['params']['id']}})['then'](handleEntityNotFound(_0x4d7d58,null))[_0x29df('0x19')](function(_0x156f8f){if(_0x156f8f){_0x3e3469[_0x29df('0x2f')]=_[_0x29df('0x2b')](db['MailMessage']['rawAttributes']);_0x3e3469[_0x29df('0x27')]=_[_0x29df('0x2b')](_0x47723d[_0x29df('0x27')]);_0x3e3469[_0x29df('0x2c')]=_['intersection'](_0x3e3469['model'],_0x3e3469[_0x29df('0x27')]);_0x3a3a3f[_0x29df('0x2e')]=_[_0x29df('0x2d')](_0x3e3469[_0x29df('0x2f')],qs[_0x29df('0x30')](_0x47723d[_0x29df('0x27')]['fields']));_0x3a3a3f['attributes']=_0x3a3a3f[_0x29df('0x2e')][_0x29df('0x31')]?_0x3a3a3f['attributes']:_0x3e3469[_0x29df('0x2f')];if(!_0x47723d[_0x29df('0x27')][_0x29df('0x3c')](_0x29df('0x3d'))){_0x3a3a3f['limit']=qs['limit'](_0x47723d['query'][_0x29df('0x3e')]);_0x3a3a3f[_0x29df('0x15')]=qs['offset'](_0x47723d[_0x29df('0x27')][_0x29df('0x15')]);}_0x3a3a3f['order']=qs['sort'](_0x47723d[_0x29df('0x27')][_0x29df('0x3f')]);_0x3a3a3f['where']=qs[_0x29df('0x2c')](_[_0x29df('0x40')](_0x47723d['query'],_0x3e3469['filters']));_0x3a3a3f['where'][_0x29df('0x41')]=_0x156f8f['id'];if(_0x47723d['query'][_0x29df('0x42')]){_0x3a3a3f[_0x29df('0x43')]=_[_0x29df('0x44')](_0x3a3a3f[_0x29df('0x43')],{'$or':_['map'](_0x3a3a3f[_0x29df('0x2e')],function(_0x2a2c07){var _0x4e20e6={};_0x4e20e6[_0x2a2c07]={'$like':'%'+_0x47723d[_0x29df('0x27')][_0x29df('0x42')]+'%'};return _0x4e20e6;})});}if(_0x47723d[_0x29df('0x27')][_0x29df('0x45')]){var _0x53d2cb=_0x47723d['query'][_0x29df('0x45')][_0x29df('0x46')](',');var _0x2dee3a={};_0x2dee3a[_0x53d2cb[0x0]]={'$gte':moment(_0x53d2cb[0x1])[_0x29df('0x47')](_0x29df('0x48'))};_0x3a3a3f[_0x29df('0x43')]=_['merge'](_0x3a3a3f[_0x29df('0x43')],_0x2dee3a);}_0x3a3a3f=_[_0x29df('0x44')]({},_0x3a3a3f,_0x47723d[_0x29df('0x49')]);return db[_0x29df('0x38')][_0x29df('0x16')]({'where':_0x3a3a3f[_0x29df('0x43')]})['then'](function(_0x4b9a7b){_0x4aa5e3['count']=_0x4b9a7b;if(_0x47723d['query'][_0x29df('0x32')]){_0x3a3a3f[_0x29df('0x33')]=[{'all':!![]}];}return db[_0x29df('0x38')]['findAll'](_0x3a3a3f);})['then'](function(_0x100b5c){if(_0x47723d['query'][_0x29df('0x4a')]===_0x29df('0x4b')){for(var _0x3c776d=0x0;_0x3c776d<_0x100b5c[_0x29df('0x31')];_0x3c776d++){_0x100b5c[_0x3c776d][_0x29df('0x36')]=juice(_0x100b5c[_0x3c776d][_0x29df('0x36')]);}}_0x4aa5e3[_0x29df('0x4c')]=_0x100b5c;return _0x4aa5e3;});}})[_0x29df('0x19')](respondWithFilteredResult(_0x4d7d58,_0x3a3a3f))[_0x29df('0x29')](handleError(_0x4d7d58,null));};exports[_0x29df('0x4d')]=function(_0x44ee9b,_0x3cdc81){return db['MailInteraction']['find']({'where':{'id':_0x44ee9b[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x3cdc81,null))[_0x29df('0x19')](function(_0x2c37d9){if(_0x2c37d9){return _0x2c37d9[_0x29df('0x4e')](_0x44ee9b[_0x29df('0x36')]['ids'],_['omit'](_0x44ee9b[_0x29df('0x36')],['ids','id'])||{})[_0x29df('0x4f')](function(){return db[_0x29df('0x50')][_0x29df('0x25')]({'attributes':['id',_0x29df('0x1e'),_0x29df('0x51')],'where':{'id':_0x44ee9b[_0x29df('0x36')][_0x29df('0x39')]}});})[_0x29df('0x19')](function(_0x186100){socket[_0x29df('0x52')](_0x29df('0x53'),{'id':Number(_0x44ee9b['params']['id']),'tags':_0x186100||[]});return{'id':Number(_0x44ee9b[_0x29df('0x2a')]['id']),'tags':_0x186100||[]};});}})[_0x29df('0x19')](respondWithResult(_0x3cdc81,null))[_0x29df('0x29')](handleError(_0x3cdc81,null));};exports[_0x29df('0x54')]=function(_0x224cfc,_0x49985c){return db[_0x29df('0x21')]['find']({'where':{'id':_0x224cfc[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x49985c,null))[_0x29df('0x19')](function(_0x41f0fa){if(_0x41f0fa){return _0x41f0fa[_0x29df('0x54')](_0x224cfc[_0x29df('0x27')][_0x29df('0x39')]);}})[_0x29df('0x19')](respondWithStatusCode(_0x49985c,null))[_0x29df('0x29')](handleError(_0x49985c,null));};exports[_0x29df('0x55')]=function(_0x30f191,_0x5022e4){var _0x44f20c=moment()[_0x29df('0x56')]()[_0x29df('0x57')]();var _0x5d2d02=path['join'](config['root'],_0x29df('0x58'),_0x29df('0x59'),_0x29df('0x5a'));var _0x10d236=path[_0x29df('0x5b')](config['root'],_0x29df('0x58'),_0x29df('0x59'),_0x29df('0x5c'));var _0x34ca44=path[_0x29df('0x5b')](_0x5d2d02,_0x44f20c);var _0x517c42=util['format'](_0x29df('0x5d'),_0x30f191[_0x29df('0x2a')]['id'],_0x44f20c);var _0x1675b5=path[_0x29df('0x5b')](_0x5d2d02,_0x517c42);var _0x350e36=[];if(_0x30f191[_0x29df('0x27')][_0x29df('0x5c')]){_0x350e36[_0x29df('0x5e')]({'model':db[_0x29df('0x5f')],'as':_0x29df('0x60'),'raw':!![]});}var _0x19b9cd=[{'model':db[_0x29df('0x38')],'as':'Messages','attributes':['id',_0x29df('0x36'),_0x29df('0x61'),'to','cc',_0x29df('0x62'),'subject',_0x29df('0x63')],'where':{'secret':![]},'order':qs[_0x29df('0x3f')]('id'),'include':_0x350e36}];return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x30f191['params']['id']},'include':_0x19b9cd})[_0x29df('0x19')](handleEntityNotFound(_0x5022e4,null))[_0x29df('0x19')](function(_0x1d47bc){if(_0x1d47bc&&_0x1d47bc[_0x29df('0x64')]){var _0x39be41=_0x1d47bc['get']({'plain':!![]});fs[_0x29df('0x65')](_0x34ca44);return BPromise[_0x29df('0x66')](_0x39be41[_0x29df('0x64')],function(_0x1603ab,_0x303fe3){var _0x171535={'from':_0x1603ab['from'],'to':_0x1603ab['to']||_0x29df('0x67'),'subject':_0x1603ab[_0x29df('0x68')],'html':htmlEntities[_0x29df('0x69')](_0x1603ab[_0x29df('0x36')]),'headers':{'Date':moment(_0x1603ab[_0x29df('0x63')])[_0x29df('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1603ab['cc']){_0x171535[_0x29df('0x6a')]['Cc']=_0x1603ab['cc'];}if(_0x1603ab[_0x29df('0x62')]){_0x171535[_0x29df('0x6a')][_0x29df('0x6b')]=_0x1603ab[_0x29df('0x62')];}return new BPromise(function(_0x3e7dad,_0x24f4bb){if(_0x1603ab[_0x29df('0x60')]){for(var _0x558185=0x0;_0x558185<_0x1603ab['Attachments'][_0x29df('0x31')];_0x558185++){var _0x32ac2e=_0x1603ab[_0x29df('0x60')][_0x558185];var _0x334c44=path['join'](_0x10d236,_0x32ac2e[_0x29df('0x6c')]);if(fs['existsSync'](_0x334c44)){_0x171535[_0x29df('0x5c')]['push']({'name':_0x32ac2e['name'],'contentType':_0x32ac2e['type'],'data':fs[_0x29df('0x6d')](_0x334c44)});}}}emlformat[_0x29df('0x6e')](_0x171535,function(_0x30adb4,_0x5e6a92){if(_0x30adb4)return _0x24f4bb(_0x30adb4);fs[_0x29df('0x6f')](path[_0x29df('0x5b')](_0x34ca44,util[_0x29df('0x47')](_0x29df('0x70'),_0x303fe3)),_0x5e6a92);return _0x3e7dad(_0x5e6a92);});});})['then'](function(){return new BPromise(function(_0x485f0f,_0x2f4a78){zipdir(_0x34ca44,{'saveTo':_0x1675b5},function(_0x416577,_0x4970c4){if(_0x416577)return _0x2f4a78(_0x416577);return _0x485f0f(_0x4970c4);});})[_0x29df('0x19')](function(){return new BPromise(function(_0x307630,_0x4d2c2a){rimraf(_0x34ca44,function(_0xef88a){if(_0xef88a)_0x4d2c2a(_0xef88a);return _0x307630();});});})[_0x29df('0x19')](function(){return _0x5022e4[_0x29df('0x55')](_0x1675b5,_0x517c42,function(_0xebf02c){if(!_0xebf02c)fs[_0x29df('0x71')](_0x1675b5);});});});}else{return _0x5022e4[_0x29df('0x11')](0xc8);}})[_0x29df('0x29')](handleError(_0x5022e4,null));}; \ No newline at end of file +var _0xc488=['findOne','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachments','Messages','from','bcc','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','status','end','json','offset','undefined','limit','set','then','sendStatus','error','name','send','index','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','user','catch','show','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','update','body','params','destroy','describe','addMessage','MailMessage','ids','omit','getMessages'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xc488,0x116));var _0x8c48=function(_0x36ffdd,_0x18cc6e){_0x36ffdd=_0x36ffdd-0x0;var _0x1b5184=_0xc488[_0x36ffdd];return _0x1b5184;};'use strict';var emlformat=require(_0x8c48('0x0'));var rimraf=require(_0x8c48('0x1'));var zipdir=require('zip-dir');var moment=require(_0x8c48('0x2'));var BPromise=require(_0x8c48('0x3'));var util=require(_0x8c48('0x4'));var path=require(_0x8c48('0x5'));var fs=require('fs');var _=require(_0x8c48('0x6'));var juice=require(_0x8c48('0x7'));var Redis=require(_0x8c48('0x8'));var interaction=require(_0x8c48('0x9'));var qs=require(_0x8c48('0xa'));var logger=require('../../config/logger')(_0x8c48('0xb'));var config=require(_0x8c48('0xc'));var db=require(_0x8c48('0xd'))['db'];var htmlEntities=require(_0x8c48('0xe'));config[_0x8c48('0xf')]=_[_0x8c48('0x10')](config[_0x8c48('0xf')],{'host':_0x8c48('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c48('0x12'))['register'](socket);function respondWithStatusCode(_0x394299,_0xa6fb22){_0xa6fb22=_0xa6fb22||0xcc;return function(_0xd54841){if(_0xd54841){return _0x394299['sendStatus'](_0xa6fb22);}return _0x394299[_0x8c48('0x13')](_0xa6fb22)[_0x8c48('0x14')]();};}function respondWithResult(_0x3a9905,_0x3311cc){_0x3311cc=_0x3311cc||0xc8;return function(_0x3a7d5a){if(_0x3a7d5a){return _0x3a9905[_0x8c48('0x13')](_0x3311cc)[_0x8c48('0x15')](_0x3a7d5a);}};}function respondWithFilteredResult(_0x39f916,_0x9a72da){return function(_0x4fe4ea){if(_0x4fe4ea){var _0x84e136=typeof _0x9a72da[_0x8c48('0x16')]===_0x8c48('0x17')&&typeof _0x9a72da[_0x8c48('0x18')]===_0x8c48('0x17');var _0x168c55=_0x4fe4ea['count'];var _0x329aa3=_0x84e136?0x0:_0x9a72da[_0x8c48('0x16')];var _0x3dbeeb=_0x84e136?_0x4fe4ea['count']:_0x9a72da[_0x8c48('0x16')]+_0x9a72da['limit'];var _0x354d4e;if(_0x3dbeeb>=_0x168c55){_0x3dbeeb=_0x168c55;_0x354d4e=0xc8;}else{_0x354d4e=0xce;}_0x39f916['status'](_0x354d4e);return _0x39f916[_0x8c48('0x19')]('Content-Range',_0x329aa3+'-'+_0x3dbeeb+'/'+_0x168c55)[_0x8c48('0x15')](_0x4fe4ea);}return null;};}function saveUpdates(_0x93c46){return function(_0x39a4f3){if(_0x39a4f3){return _0x39a4f3['update'](_0x93c46)[_0x8c48('0x1a')](function(_0x1adff3){return _0x1adff3;});}return null;};}function removeEntity(_0x47ebdf){return function(_0x1b9daa){if(_0x1b9daa){return _0x1b9daa['destroy']()[_0x8c48('0x1a')](function(){_0x47ebdf['status'](0xcc)[_0x8c48('0x14')]();});}};}function handleEntityNotFound(_0x28a6db){return function(_0x1b7dac){if(!_0x1b7dac){_0x28a6db[_0x8c48('0x1b')](0x194);}return _0x1b7dac;};}function handleError(_0x549e05,_0x3bc15d){_0x3bc15d=_0x3bc15d||0x1f4;return function(_0x202bf8){logger[_0x8c48('0x1c')](_0x202bf8['stack']);if(_0x202bf8[_0x8c48('0x1d')]){delete _0x202bf8['name'];}_0x549e05[_0x8c48('0x13')](_0x3bc15d)[_0x8c48('0x1e')](_0x202bf8);};}exports[_0x8c48('0x1f')]=function(_0x47e204,_0x4f26ac){var _0x1c982a={};var _0x4f6b37=_['map'](db[_0x8c48('0x20')][_0x8c48('0x21')],function(_0xbb2356){return{'name':_0xbb2356[_0x8c48('0x22')],'type':_0xbb2356['type'][_0x8c48('0x23')]};});_0x1c982a=qs[_0x8c48('0x24')](_0x4f6b37,_0x47e204);return interaction[_0x8c48('0x25')]('mail',_0x47e204['query'],_0x47e204[_0x8c48('0x26')],_0x1c982a,_0x4f6b37)[_0x8c48('0x1a')](respondWithFilteredResult(_0x4f26ac,_0x1c982a))[_0x8c48('0x27')](handleError(_0x4f26ac,null));};exports[_0x8c48('0x28')]=function(_0x23abf5,_0x3cc1ee){var _0x28c126={'raw':![],'where':{'id':_0x23abf5['params']['id']}},_0x549bdf={};_0x549bdf[_0x8c48('0x29')]=_['keys'](db[_0x8c48('0x20')][_0x8c48('0x21')]);_0x549bdf['query']=_[_0x8c48('0x2a')](_0x23abf5[_0x8c48('0x2b')]);_0x549bdf[_0x8c48('0x2c')]=_[_0x8c48('0x2d')](_0x549bdf['model'],_0x549bdf[_0x8c48('0x2b')]);_0x28c126[_0x8c48('0x2e')]=_[_0x8c48('0x2d')](_0x549bdf[_0x8c48('0x29')],qs[_0x8c48('0x2f')](_0x23abf5['query'][_0x8c48('0x2f')]));_0x28c126['attributes']=_0x28c126['attributes'][_0x8c48('0x30')]?_0x28c126['attributes']:_0x549bdf['model'];if(_0x23abf5[_0x8c48('0x2b')][_0x8c48('0x31')]){_0x28c126[_0x8c48('0x32')]=[{'all':!![]}];}_0x28c126=_[_0x8c48('0x33')]({},_0x28c126,_0x23abf5['options']);return db[_0x8c48('0x20')][_0x8c48('0x34')](_0x28c126)[_0x8c48('0x1a')](handleEntityNotFound(_0x3cc1ee,null))['then'](respondWithResult(_0x3cc1ee,null))[_0x8c48('0x27')](handleError(_0x3cc1ee,null));};exports[_0x8c48('0x35')]=function(_0x5b6250,_0xb9f02e){return db['MailInteraction'][_0x8c48('0x35')](_0x5b6250['body'],{})[_0x8c48('0x1a')](respondWithResult(_0xb9f02e,0xc9))[_0x8c48('0x27')](handleError(_0xb9f02e,null));};exports[_0x8c48('0x36')]=function(_0x518cb4,_0x27d1df){if(_0x518cb4[_0x8c48('0x37')]['id']){delete _0x518cb4[_0x8c48('0x37')]['id'];}return db[_0x8c48('0x20')][_0x8c48('0x34')]({'where':{'id':_0x518cb4[_0x8c48('0x38')]['id']}})['then'](handleEntityNotFound(_0x27d1df,null))['then'](saveUpdates(_0x518cb4[_0x8c48('0x37')],null))[_0x8c48('0x1a')](respondWithResult(_0x27d1df,null))[_0x8c48('0x27')](handleError(_0x27d1df,null));};exports[_0x8c48('0x39')]=function(_0x3cecd5,_0x21849c){return db[_0x8c48('0x20')][_0x8c48('0x34')]({'where':{'id':_0x3cecd5['params']['id']}})['then'](handleEntityNotFound(_0x21849c,null))[_0x8c48('0x1a')](removeEntity(_0x21849c,null))[_0x8c48('0x27')](handleError(_0x21849c,null));};exports[_0x8c48('0x3a')]=function(_0x2edce4,_0x3df137){return db[_0x8c48('0x20')][_0x8c48('0x3a')]()[_0x8c48('0x1a')](respondWithResult(_0x3df137,null))[_0x8c48('0x27')](handleError(_0x3df137,null));};exports[_0x8c48('0x3b')]=function(_0xa540f8,_0x8884bf){return db[_0x8c48('0x3c')]['find']({'where':{'id':_0xa540f8['params']['id']}})[_0x8c48('0x1a')](handleEntityNotFound(_0x8884bf,null))['then'](function(_0x152020){if(_0x152020){return _0x152020['addMessage'](_0xa540f8[_0x8c48('0x37')][_0x8c48('0x3d')],_[_0x8c48('0x3e')](_0xa540f8[_0x8c48('0x37')],[_0x8c48('0x3d'),'id'])||{});}})[_0x8c48('0x1a')](respondWithResult(_0x8884bf,null))['catch'](handleError(_0x8884bf,null));};exports[_0x8c48('0x3f')]=function(_0x24efa3,_0x15afa7){var _0x2eefef={'raw':![],'where':{}};var _0x2f4e56={};var _0x1fb72d={'count':0x0,'rows':[]};return db['MailInteraction'][_0x8c48('0x40')]({'where':{'id':_0x24efa3['params']['id']}})[_0x8c48('0x1a')](handleEntityNotFound(_0x15afa7,null))['then'](function(_0x28e099){if(_0x28e099){_0x2f4e56['model']=_[_0x8c48('0x2a')](db[_0x8c48('0x3c')][_0x8c48('0x21')]);_0x2f4e56[_0x8c48('0x2b')]=_[_0x8c48('0x2a')](_0x24efa3['query']);_0x2f4e56[_0x8c48('0x2c')]=_[_0x8c48('0x2d')](_0x2f4e56[_0x8c48('0x29')],_0x2f4e56[_0x8c48('0x2b')]);_0x2eefef[_0x8c48('0x2e')]=_[_0x8c48('0x2d')](_0x2f4e56[_0x8c48('0x29')],qs['fields'](_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x2f')]));_0x2eefef[_0x8c48('0x2e')]=_0x2eefef[_0x8c48('0x2e')]['length']?_0x2eefef[_0x8c48('0x2e')]:_0x2f4e56[_0x8c48('0x29')];if(!_0x24efa3[_0x8c48('0x2b')]['hasOwnProperty']('nolimit')){_0x2eefef[_0x8c48('0x18')]=qs['limit'](_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x18')]);_0x2eefef[_0x8c48('0x16')]=qs['offset'](_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x16')]);}_0x2eefef[_0x8c48('0x41')]=qs['sort'](_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x42')]);_0x2eefef[_0x8c48('0x43')]=qs[_0x8c48('0x2c')](_['pick'](_0x24efa3[_0x8c48('0x2b')],_0x2f4e56[_0x8c48('0x2c')]));_0x2eefef['where'][_0x8c48('0x44')]=_0x28e099['id'];if(_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x45')]){_0x2eefef[_0x8c48('0x43')]=_[_0x8c48('0x33')](_0x2eefef[_0x8c48('0x43')],{'$or':_['map'](_0x2eefef['attributes'],function(_0x42c13f){var _0x557a26={};_0x557a26[_0x42c13f]={'$like':'%'+_0x24efa3[_0x8c48('0x2b')]['filter']+'%'};return _0x557a26;})});}if(_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x46')]){var _0x5e13a7=_0x24efa3['query'][_0x8c48('0x46')][_0x8c48('0x47')](',');var _0x2d0701={};_0x2d0701[_0x5e13a7[0x0]]={'$gte':moment(_0x5e13a7[0x1])[_0x8c48('0x48')](_0x8c48('0x49'))};_0x2eefef[_0x8c48('0x43')]=_['merge'](_0x2eefef[_0x8c48('0x43')],_0x2d0701);}_0x2eefef=_[_0x8c48('0x33')]({},_0x2eefef,_0x24efa3['options']);return db[_0x8c48('0x3c')][_0x8c48('0x4a')]({'where':_0x2eefef[_0x8c48('0x43')]})[_0x8c48('0x1a')](function(_0x3f8405){_0x1fb72d['count']=_0x3f8405;if(_0x24efa3['query']['includeAll']){_0x2eefef[_0x8c48('0x32')]=[{'all':!![]}];}return db[_0x8c48('0x3c')][_0x8c48('0x25')](_0x2eefef);})[_0x8c48('0x1a')](function(_0x1bd59c){if(_0x24efa3[_0x8c48('0x2b')][_0x8c48('0x4b')]===_0x8c48('0x4c')){for(var _0x588062=0x0;_0x588062<_0x1bd59c['length'];_0x588062++){_0x1bd59c[_0x588062][_0x8c48('0x37')]=juice(_0x1bd59c[_0x588062][_0x8c48('0x37')]);}}_0x1fb72d[_0x8c48('0x4d')]=_0x1bd59c;return _0x1fb72d;});}})['then'](respondWithFilteredResult(_0x15afa7,_0x2eefef))[_0x8c48('0x27')](handleError(_0x15afa7,null));};exports[_0x8c48('0x4e')]=function(_0x413f1a,_0x1d78a0){return db['MailInteraction'][_0x8c48('0x34')]({'where':{'id':_0x413f1a[_0x8c48('0x38')]['id']}})[_0x8c48('0x1a')](handleEntityNotFound(_0x1d78a0,null))[_0x8c48('0x1a')](function(_0x3ad980){if(_0x3ad980){return _0x3ad980[_0x8c48('0x4f')](_0x413f1a[_0x8c48('0x37')][_0x8c48('0x3d')],_[_0x8c48('0x3e')](_0x413f1a[_0x8c48('0x37')],[_0x8c48('0x3d'),'id'])||{})['spread'](function(){return db[_0x8c48('0x50')][_0x8c48('0x25')]({'attributes':['id',_0x8c48('0x1d'),_0x8c48('0x51')],'where':{'id':_0x413f1a[_0x8c48('0x37')]['ids']}});})['then'](function(_0x29bd41){socket[_0x8c48('0x52')](_0x8c48('0x53'),{'id':Number(_0x413f1a[_0x8c48('0x38')]['id']),'tags':_0x29bd41||[]});return{'id':Number(_0x413f1a[_0x8c48('0x38')]['id']),'tags':_0x29bd41||[]};});}})['then'](respondWithResult(_0x1d78a0,null))[_0x8c48('0x27')](handleError(_0x1d78a0,null));};exports[_0x8c48('0x54')]=function(_0x4312ec,_0x39e0c4){return db[_0x8c48('0x20')][_0x8c48('0x34')]({'where':{'id':_0x4312ec['params']['id']}})[_0x8c48('0x1a')](handleEntityNotFound(_0x39e0c4,null))[_0x8c48('0x1a')](function(_0x10297b){if(_0x10297b){return _0x10297b[_0x8c48('0x54')](_0x4312ec[_0x8c48('0x2b')]['ids']);}})['then'](respondWithStatusCode(_0x39e0c4,null))[_0x8c48('0x27')](handleError(_0x39e0c4,null));};exports[_0x8c48('0x55')]=function(_0xc080c9,_0x4aa249){var _0x204dd7=moment()[_0x8c48('0x56')]()[_0x8c48('0x57')]();var _0x268d85=path[_0x8c48('0x58')](config[_0x8c48('0x59')],_0x8c48('0x5a'),_0x8c48('0x5b'),_0x8c48('0x5c'));var _0x2af796=path[_0x8c48('0x58')](config[_0x8c48('0x59')],'server','files',_0x8c48('0x5d'));var _0x2f93df=path[_0x8c48('0x58')](_0x268d85,_0x204dd7);var _0xb1079e=util[_0x8c48('0x48')](_0x8c48('0x5e'),_0xc080c9['params']['id'],_0x204dd7);var _0x90afeb=path['join'](_0x268d85,_0xb1079e);var _0x496b30=[];if(_0xc080c9[_0x8c48('0x2b')][_0x8c48('0x5d')]){_0x496b30[_0x8c48('0x5f')]({'model':db['Attachment'],'as':_0x8c48('0x60'),'raw':!![]});}var _0x3f2845=[{'model':db[_0x8c48('0x3c')],'as':_0x8c48('0x61'),'attributes':['id',_0x8c48('0x37'),_0x8c48('0x62'),'to','cc',_0x8c48('0x63'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x8c48('0x42')]('id'),'include':_0x496b30}];return db[_0x8c48('0x20')][_0x8c48('0x34')]({'where':{'id':_0xc080c9[_0x8c48('0x38')]['id']},'include':_0x3f2845})[_0x8c48('0x1a')](handleEntityNotFound(_0x4aa249,null))[_0x8c48('0x1a')](function(_0x4c59cc){if(_0x4c59cc&&_0x4c59cc[_0x8c48('0x61')]){var _0x23e2a3=_0x4c59cc[_0x8c48('0x64')]({'plain':!![]});fs[_0x8c48('0x65')](_0x2f93df);return BPromise[_0x8c48('0x66')](_0x23e2a3[_0x8c48('0x61')],function(_0x56016,_0x480aea){var _0x5a47aa={'from':_0x56016[_0x8c48('0x62')],'to':_0x56016['to']||_0x8c48('0x67'),'subject':_0x56016['subject'],'html':htmlEntities[_0x8c48('0x68')](_0x56016['body']),'headers':{'Date':moment(_0x56016[_0x8c48('0x69')])[_0x8c48('0x48')](_0x8c48('0x6a'))},'attachments':[]};if(_0x56016['cc']){_0x5a47aa[_0x8c48('0x6b')]['Cc']=_0x56016['cc'];}if(_0x56016[_0x8c48('0x63')]){_0x5a47aa[_0x8c48('0x6b')][_0x8c48('0x6c')]=_0x56016[_0x8c48('0x63')];}return new BPromise(function(_0x1ee33c,_0xca57ef){if(_0x56016['Attachments']){for(var _0x3d5293=0x0;_0x3d5293<_0x56016[_0x8c48('0x60')][_0x8c48('0x30')];_0x3d5293++){var _0x11b881=_0x56016[_0x8c48('0x60')][_0x3d5293];var _0x353bba=path[_0x8c48('0x58')](_0x2af796,_0x11b881[_0x8c48('0x6d')]);if(fs[_0x8c48('0x6e')](_0x353bba)){_0x5a47aa['attachments'][_0x8c48('0x5f')]({'name':_0x11b881[_0x8c48('0x1d')],'contentType':_0x11b881['type'],'data':fs[_0x8c48('0x6f')](_0x353bba)});}}}emlformat[_0x8c48('0x70')](_0x5a47aa,function(_0x515eb8,_0x36886b){if(_0x515eb8)return _0xca57ef(_0x515eb8);fs['writeFileSync'](path['join'](_0x2f93df,util[_0x8c48('0x48')](_0x8c48('0x71'),_0x480aea)),_0x36886b);return _0x1ee33c(_0x36886b);});});})[_0x8c48('0x1a')](function(){return new BPromise(function(_0x213e00,_0x115586){zipdir(_0x2f93df,{'saveTo':_0x90afeb},function(_0x447ce3,_0x48ac66){if(_0x447ce3)return _0x115586(_0x447ce3);return _0x213e00(_0x48ac66);});})[_0x8c48('0x1a')](function(){return new BPromise(function(_0x4fe98a,_0x2d7200){rimraf(_0x2f93df,function(_0x1746b0){if(_0x1746b0)_0x2d7200(_0x1746b0);return _0x4fe98a();});});})[_0x8c48('0x1a')](function(){return _0x4aa249[_0x8c48('0x55')](_0x90afeb,_0xb1079e,function(_0x3b925a){if(!_0x3b925a)fs['unlinkSync'](_0x90afeb);});});});}else{return _0x4aa249[_0x8c48('0x1b')](0xc8);}})[_0x8c48('0x27')](handleError(_0x4aa249,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a6e7eba..b48a196 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 _0xaf74=['hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','save','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','catch'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xaf74,0x1ac));var _0x4af7=function(_0x20f036,_0x679ea0){_0x20f036=_0x20f036-0x0;var _0x350faa=_0xaf74[_0x20f036];return _0x350faa;};'use strict';var EventEmitter=require(_0x4af7('0x0'));var MailInteraction=require(_0x4af7('0x1'))['db'][_0x4af7('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4af7('0x3'),'afterUpdate':_0x4af7('0x4'),'afterDestroy':_0x4af7('0x5')};function emitEvent(_0x3ebace){return function(_0x352dfb,_0x3ae59e,_0x46374f){_0x352dfb[_0x4af7('0x6')]({'attributes':['id'],'raw':!![]})[_0x4af7('0x7')](function(_0xc45d8e){_0x352dfb['setDataValue'](_0x4af7('0x8'),_0xc45d8e[_0x4af7('0x9')](function(_0x21d747){return{'id':_0x21d747['id']};}));return MailMessage[_0x4af7('0xa')]({'where':{'MailInteractionId':_0x352dfb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4af7('0x7')](function(_0x460d2a){_0x352dfb['setDataValue'](_0x4af7('0xb'),_0x460d2a[_0x4af7('0xc')]);MailInteractionEvents['emit'](_0x3ebace+':'+_0x352dfb['id'],_0x352dfb);MailInteractionEvents['emit'](_0x3ebace,_0x352dfb);_0x46374f(null);})[_0x4af7('0xd')](_0x46374f(null));};}for(var e in events){if(events[_0x4af7('0xe')](e)){var event=events[e];MailInteraction[_0x4af7('0xf')](e,emitEvent(event));}}module[_0x4af7('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xcb17=['../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xcb17,0x1d3));var _0x7cb1=function(_0x10a598,_0x2488c2){_0x10a598=_0x10a598-0x0;var _0x24f2de=_0xcb17[_0x10a598];return _0x24f2de;};'use strict';var EventEmitter=require(_0x7cb1('0x0'));var MailInteraction=require(_0x7cb1('0x1'))['db'][_0x7cb1('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7cb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cb1('0x4'),'afterDestroy':_0x7cb1('0x5')};function emitEvent(_0x42580f){return function(_0x2665dd,_0x1acde8,_0x18144c){_0x2665dd[_0x7cb1('0x6')]({'attributes':['id'],'raw':!![]})[_0x7cb1('0x7')](function(_0x459175){_0x2665dd[_0x7cb1('0x8')](_0x7cb1('0x9'),_0x459175[_0x7cb1('0xa')](function(_0x2d6dba){return{'id':_0x2d6dba['id']};}));return MailMessage[_0x7cb1('0xb')]({'where':{'MailInteractionId':_0x2665dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7cb1('0x7')](function(_0x42c6f9){_0x2665dd[_0x7cb1('0x8')](_0x7cb1('0xc'),_0x42c6f9[_0x7cb1('0xd')]);MailInteractionEvents[_0x7cb1('0xe')](_0x42580f+':'+_0x2665dd['id'],_0x2665dd);MailInteractionEvents[_0x7cb1('0xe')](_0x42580f,_0x2665dd);_0x18144c(null);})[_0x7cb1('0xf')](_0x18144c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7cb1('0x10')](e,emitEvent(event));}}module[_0x7cb1('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9a0eb4c..5672189 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 _0x8331=['bluebird','request-promise','path','rimraf','../../config/environment','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x5bd5f0,_0x389d7c){var _0x2981b0=function(_0x112ea7){while(--_0x112ea7){_0x5bd5f0['push'](_0x5bd5f0['shift']());}};_0x2981b0(++_0x389d7c);}(_0x8331,0x1d1));var _0x1833=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x8331[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0x1833('0x0'));var util=require(_0x1833('0x1'));var logger=require('../../config/logger')(_0x1833('0x2'));var moment=require('moment');var BPromise=require(_0x1833('0x3'));var rp=require(_0x1833('0x4'));var fs=require('fs');var path=require(_0x1833('0x5'));var rimraf=require(_0x1833('0x6'));var config=require(_0x1833('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x3381d1,_0x3bba17){return _0x3381d1[_0x1833('0x8')](_0x1833('0x9'),attributes,{'tableName':_0x1833('0xa'),'paranoid':![],'indexes':[{'name':_0x1833('0xb'),'fields':[_0x1833('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18f3c1,_0x744058,_0x2402ce){if(_0x18f3c1[_0x1833('0xd')]){_0x18f3c1[_0x1833('0xe')]=moment()['format'](_0x1833('0xf'));}if(_0x18f3c1[_0x1833('0x10')]){_0x18f3c1[_0x1833('0x11')]=moment()[_0x1833('0x12')](_0x1833('0xf'));}_0x2402ce(null,_0x744058);},'beforeUpdate':function(_0x22df32,_0x7468,_0x5b0152){if(_0x22df32[_0x1833('0x13')](_0x1833('0xd'))){_0x22df32[_0x1833('0xe')]=_0x22df32[_0x1833('0xd')]?moment()[_0x1833('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x22df32[_0x1833('0x13')](_0x1833('0x10'))){_0x22df32['closedAt']=moment()['format'](_0x1833('0xf'));_0x22df32['substatus']=null;_0x22df32[_0x1833('0xe')]=null;}_0x5b0152(null,_0x22df32);},'afterUpdate':function(_0x50bb08,_0x5b26c8,_0x4afad0){var _0x38aa20=_0x3381d1['models'];var _0xfb7a96=_0x50bb08[_0x1833('0x14')]({'plain':!![]});if(_0xfb7a96['closed']){return _0x38aa20[_0x1833('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xfb7a96['id']}})[_0x1833('0x16')](function(){_0x4afad0();})[_0x1833('0x17')](function(_0x28e23e){_0x4afad0(_0x28e23e);});}else{_0x4afad0();}}},'charset':_0x1833('0x18'),'collate':_0x1833('0x19')});}; \ No newline at end of file +var _0x2e73=['FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','subject'];(function(_0x1ad06d,_0x4c8c6f){var _0xf03b97=function(_0x25f305){while(--_0x25f305){_0x1ad06d['push'](_0x1ad06d['shift']());}};_0xf03b97(++_0x4c8c6f);}(_0x2e73,0xbc));var _0x32e7=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x2e73[_0x43a5c7];return _0x3b12a2;};'use strict';var _=require('lodash');var util=require(_0x32e7('0x0'));var logger=require('../../config/logger')(_0x32e7('0x1'));var moment=require('moment');var BPromise=require(_0x32e7('0x2'));var rp=require(_0x32e7('0x3'));var fs=require('fs');var path=require(_0x32e7('0x4'));var rimraf=require(_0x32e7('0x5'));var config=require(_0x32e7('0x6'));var attributes=require(_0x32e7('0x7'));module['exports']=function(_0x42ce25,_0x1ddf0c){return _0x42ce25[_0x32e7('0x8')](_0x32e7('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x32e7('0xa'),'fields':[_0x32e7('0xb'),'to'],'type':_0x32e7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e1516,_0x156330,_0x39b20c){if(_0x3e1516['substatus']){_0x3e1516[_0x32e7('0xd')]=moment()[_0x32e7('0xe')](_0x32e7('0xf'));}if(_0x3e1516[_0x32e7('0x10')]){_0x3e1516[_0x32e7('0x11')]=moment()[_0x32e7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x39b20c(null,_0x156330);},'beforeUpdate':function(_0x1cd0ea,_0x3c6473,_0x4bd696){if(_0x1cd0ea[_0x32e7('0x12')](_0x32e7('0x13'))){_0x1cd0ea['substatusAt']=_0x1cd0ea[_0x32e7('0x13')]?moment()['format'](_0x32e7('0xf')):null;}if(_0x1cd0ea[_0x32e7('0x12')]('closed')){_0x1cd0ea[_0x32e7('0x11')]=moment()[_0x32e7('0xe')](_0x32e7('0xf'));_0x1cd0ea[_0x32e7('0x13')]=null;_0x1cd0ea['substatusAt']=null;}_0x4bd696(null,_0x1cd0ea);},'afterUpdate':function(_0x4db887,_0x2eea75,_0x59e598){var _0x571dd4=_0x42ce25['models'];var _0x384303=_0x4db887[_0x32e7('0x14')]({'plain':!![]});if(_0x384303[_0x32e7('0x10')]){return _0x571dd4[_0x32e7('0x15')][_0x32e7('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x384303['id']}})['then'](function(){_0x59e598();})['catch'](function(_0x3ccac2){_0x59e598(_0x3ccac2);});}else{_0x59e598();}}},'charset':_0x32e7('0x17'),'collate':_0x32e7('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fc063cf..b6c4164 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 _0xc69b=['message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','stringify','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x464059,_0x143e2b){var _0x2ee156=function(_0x39a773){while(--_0x39a773){_0x464059['push'](_0x464059['shift']());}};_0x2ee156(++_0x143e2b);}(_0xc69b,0xcf));var _0xbc69=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xc69b[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0xbc69('0x0'));var util=require('util');var moment=require(_0xbc69('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc69('0x2'));var fs=require('fs');var Redis=require(_0xbc69('0x3'));var db=require(_0xbc69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc69('0x6'));var client=jayson[_0xbc69('0x7')]['http']({'port':0x232a});config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc69('0xa'))(new Redis(config[_0xbc69('0x8')]));require(_0xbc69('0xb'))[_0xbc69('0xc')](socket);function respondWithRpcPromise(_0x3adb11,_0x57be21,_0x181560){return new BPromise(function(_0x2e8394,_0xd7337e){return client[_0xbc69('0xd')](_0x3adb11,_0x181560)[_0xbc69('0xe')](function(_0x5dc950){logger[_0xbc69('0xf')](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));logger[_0xbc69('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x57be21,_0xbc69('0x11'),JSON['stringify'](_0x5dc950));if(_0x5dc950[_0xbc69('0x13')]){if(_0x5dc950['error'][_0xbc69('0x14')]===0x1f4){logger[_0xbc69('0x13')]('MailInteraction,\x20%s,\x20%s',_0x57be21,_0x5dc950['error'][_0xbc69('0x15')]);return _0xd7337e(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);return _0x2e8394(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}else{logger['info'](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));_0x2e8394(_0x5dc950[_0xbc69('0x16')][_0xbc69('0x15')]);}})[_0xbc69('0x17')](function(_0x4cca15){logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x4cca15);_0xd7337e(_0x4cca15);});});}exports[_0xbc69('0x18')]=function(_0x19aa26){var _0x1ba59f=this;return new Promise(function(_0x71fbd9,_0x4e00ec){return db[_0xbc69('0x19')][_0xbc69('0x1a')](_0x19aa26[_0xbc69('0x1b')],{'raw':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null,'attributes':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')]['attributes']||null:null,'limit':_0x19aa26['options']?_0x19aa26[_0xbc69('0x1c')]['limit']||null:null})[_0xbc69('0xe')](function(_0x47d454){logger[_0xbc69('0xf')](_0xbc69('0x18'),_0x19aa26);logger['debug'](_0xbc69('0x18'),_0x19aa26,JSON[_0xbc69('0x1f')](_0x47d454));_0x71fbd9(_0x47d454);})[_0xbc69('0x17')](function(_0x4b22e5){logger[_0xbc69('0x13')]('UpdateMailInteraction',_0x4b22e5[_0xbc69('0x15')],_0x19aa26);_0x4e00ec(_0x1ba59f[_0xbc69('0x13')](0x1f4,_0x4b22e5[_0xbc69('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xe424c2){return new Promise(function(_0x182473,_0x582908){return db[_0xbc69('0x19')][_0xbc69('0x20')]({'where':_0xe424c2[_0xbc69('0x1c')]?_0xe424c2[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null})['then'](function(_0x53a7f0){if(_0x53a7f0){return _0x53a7f0[_0xbc69('0x21')](_0xe424c2[_0xbc69('0x1b')][_0xbc69('0x22')],_[_0xbc69('0x23')](_0xe424c2[_0xbc69('0x1b')],[_0xbc69('0x22'),'id'])||{});}})[_0xbc69('0x24')](function(_0xc72391){logger[_0xbc69('0xf')](_0xbc69('0x25'),_0xe424c2);logger[_0xbc69('0x12')]('AddTags',_0xe424c2,JSON[_0xbc69('0x1f')](_0xc72391));_0x182473(_0xc72391);})['catch'](function(_0x54f6a6){logger[_0xbc69('0x13')](_0xbc69('0x25'),_0x54f6a6[_0xbc69('0x15')],_0xe424c2);_0x582908(_this['error'](0x1f4,_0x54f6a6['message']));});});}; \ No newline at end of file +var _0x535d=['register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateMailInteraction','MailInteraction','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailInteraction.socket'];(function(_0x41ed86,_0x8b2143){var _0x4bcb09=function(_0x40394c){while(--_0x40394c){_0x41ed86['push'](_0x41ed86['shift']());}};_0x4bcb09(++_0x8b2143);}(_0x535d,0xe8));var _0xd535=function(_0x5b6b12,_0x2d4a30){_0x5b6b12=_0x5b6b12-0x0;var _0x56d713=_0x535d[_0x5b6b12];return _0x56d713;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var moment=require('moment');var BPromise=require(_0xd535('0x2'));var rs=require(_0xd535('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd535('0x4'));var logger=require(_0xd535('0x5'))(_0xd535('0x6'));var config=require(_0xd535('0x7'));var jayson=require(_0xd535('0x8'));var client=jayson[_0xd535('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd535('0xa')](config[_0xd535('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd535('0xc'))(new Redis(config['redis']));require(_0xd535('0xd'))[_0xd535('0xe')](socket);function respondWithRpcPromise(_0x39792b,_0x3a6841,_0x4a296c){return new BPromise(function(_0x3f34c4,_0x38b299){return client[_0xd535('0xf')](_0x39792b,_0x4a296c)[_0xd535('0x10')](function(_0x4c0692){logger[_0xd535('0x11')](_0xd535('0x12'),_0x3a6841,_0xd535('0x13'));logger[_0xd535('0x14')](_0xd535('0x15'),_0x3a6841,_0xd535('0x13'),JSON[_0xd535('0x16')](_0x4c0692));if(_0x4c0692['error']){if(_0x4c0692[_0xd535('0x17')]['code']===0x1f4){logger['error'](_0xd535('0x12'),_0x3a6841,_0x4c0692[_0xd535('0x17')]['message']);return _0x38b299(_0x4c0692[_0xd535('0x17')][_0xd535('0x18')]);}logger[_0xd535('0x17')](_0xd535('0x12'),_0x3a6841,_0x4c0692['error'][_0xd535('0x18')]);return _0x3f34c4(_0x4c0692[_0xd535('0x17')][_0xd535('0x18')]);}else{logger[_0xd535('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3a6841,_0xd535('0x13'));_0x3f34c4(_0x4c0692['result'][_0xd535('0x18')]);}})['catch'](function(_0x34dc17){logger['error'](_0xd535('0x12'),_0x3a6841,_0x34dc17);_0x38b299(_0x34dc17);});});}exports[_0xd535('0x19')]=function(_0x31eda3){var _0x2499f0=this;return new Promise(function(_0x5749fa,_0x4b11d9){return db[_0xd535('0x1a')]['update'](_0x31eda3['body'],{'raw':_0x31eda3[_0xd535('0x1b')]?_0x31eda3[_0xd535('0x1b')][_0xd535('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31eda3[_0xd535('0x1b')]?_0x31eda3[_0xd535('0x1b')][_0xd535('0x1d')]||null:null,'attributes':_0x31eda3['options']?_0x31eda3[_0xd535('0x1b')][_0xd535('0x1e')]||null:null,'limit':_0x31eda3[_0xd535('0x1b')]?_0x31eda3[_0xd535('0x1b')][_0xd535('0x1f')]||null:null})['then'](function(_0x59729f){logger[_0xd535('0x11')](_0xd535('0x19'),_0x31eda3);logger['debug']('UpdateMailInteraction',_0x31eda3,JSON[_0xd535('0x16')](_0x59729f));_0x5749fa(_0x59729f);})[_0xd535('0x20')](function(_0x13cdb2){logger['error']('UpdateMailInteraction',_0x13cdb2[_0xd535('0x18')],_0x31eda3);_0x4b11d9(_0x2499f0[_0xd535('0x17')](0x1f4,_0x13cdb2[_0xd535('0x18')]));});});};exports[_0xd535('0x21')]=function(_0x11daf4){return new Promise(function(_0x33fcb1,_0x231736){return db['MailInteraction'][_0xd535('0x22')]({'where':_0x11daf4[_0xd535('0x1b')]?_0x11daf4['options']['where']||null:null})['then'](function(_0x30bb88){if(_0x30bb88){return _0x30bb88[_0xd535('0x23')](_0x11daf4[_0xd535('0x24')][_0xd535('0x25')],_[_0xd535('0x26')](_0x11daf4['body'],['ids','id'])||{});}})[_0xd535('0x27')](function(_0x385147){logger[_0xd535('0x11')](_0xd535('0x28'),_0x11daf4);logger['debug'](_0xd535('0x28'),_0x11daf4,JSON[_0xd535('0x16')](_0x385147));_0x33fcb1(_0x385147);})[_0xd535('0x20')](function(_0x27f53){logger[_0xd535('0x17')](_0xd535('0x28'),_0x27f53['message'],_0x11daf4);_0x231736(_this[_0xd535('0x17')](0x1f4,_0x27f53[_0xd535('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index fd183b0..c7f70ff 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 _0xb1b7=['remove','update','removeListener','register','./mailInteraction.events','save'];(function(_0x4bb115,_0x24e56a){var _0x449ee4=function(_0x57ad23){while(--_0x57ad23){_0x4bb115['push'](_0x4bb115['shift']());}};_0x449ee4(++_0x24e56a);}(_0xb1b7,0x166));var _0x7b1b=function(_0x160fe3,_0x47d8eb){_0x160fe3=_0x160fe3-0x0;var _0x458a4b=_0xb1b7[_0x160fe3];return _0x458a4b;};'use strict';var MailInteractionEvents=require(_0x7b1b('0x0'));var events=[_0x7b1b('0x1'),_0x7b1b('0x2'),_0x7b1b('0x3')];function createListener(_0xd0de53,_0x501d5e){return function(_0x5b4fc9){_0x501d5e['emit'](_0xd0de53,_0x5b4fc9);};}function removeListener(_0x4e7139,_0x80cf07){return function(){MailInteractionEvents[_0x7b1b('0x4')](_0x4e7139,_0x80cf07);};}exports[_0x7b1b('0x5')]=function(_0x4808e2){for(var _0x4e7b02=0x0,_0x113359=events['length'];_0x4e7b02<_0x113359;_0x4e7b02++){var _0x332e34=events[_0x4e7b02];var _0x5337b6=createListener('mailInteraction:'+_0x332e34,_0x4808e2);MailInteractionEvents['on'](_0x332e34,_0x5337b6);}}; \ No newline at end of file +var _0x68a9=['removeListener','register','length','save','remove','emit'];(function(_0x130e0d,_0x27170c){var _0x43285e=function(_0x157f95){while(--_0x157f95){_0x130e0d['push'](_0x130e0d['shift']());}};_0x43285e(++_0x27170c);}(_0x68a9,0x141));var _0x968a=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x68a9[_0x3899d1];return _0xeb4a7d;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x968a('0x0'),_0x968a('0x1'),'update'];function createListener(_0x128604,_0x13cc75){return function(_0x17d3ff){_0x13cc75[_0x968a('0x2')](_0x128604,_0x17d3ff);};}function removeListener(_0x374cf7,_0x59727f){return function(){MailInteractionEvents[_0x968a('0x3')](_0x374cf7,_0x59727f);};}exports[_0x968a('0x4')]=function(_0xfe2463){for(var _0x15c14d=0x0,_0x163150=events[_0x968a('0x5')];_0x15c14d<_0x163150;_0x15c14d++){var _0x375c07=events[_0x15c14d];var _0x1f00e8=createListener('mailInteraction:'+_0x375c07,_0xfe2463);MailInteractionEvents['on'](_0x375c07,_0x1f00e8);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index db9da42..2e946fb 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 _0xb921=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','accept','delete','exports','multer','util'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb921,0x16a));var _0x1b92=function(_0x1a2603,_0x43182e){_0x1a2603=_0x1a2603-0x0;var _0x10f23a=_0xb921[_0x1a2603];return _0x10f23a;};'use strict';var multer=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var path=require(_0x1b92('0x2'));var timeout=require(_0x1b92('0x3'));var express=require(_0x1b92('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1b92('0x5'));var interaction=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var controller=require(_0x1b92('0x8'));router[_0x1b92('0x9')]('/',auth[_0x1b92('0xa')](),controller[_0x1b92('0xb')]);router[_0x1b92('0x9')](_0x1b92('0xc'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xd')]);router[_0x1b92('0x9')](_0x1b92('0xe'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xf')]);router['get'](_0x1b92('0x10'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x11')]);router[_0x1b92('0x12')]('/',auth[_0x1b92('0xa')](),interaction[_0x1b92('0x13')](_0x1b92('0x14'),'mailmessage:create'),controller[_0x1b92('0x15')]);router[_0x1b92('0x16')]('/:id',auth[_0x1b92('0xa')](),controller[_0x1b92('0x17')]);router[_0x1b92('0x16')](_0x1b92('0x18'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x19')]);router[_0x1b92('0x16')]('/:id/reject',auth[_0x1b92('0xa')](),controller['reject']);router[_0x1b92('0x1a')]('/:id',auth[_0x1b92('0xa')](),controller['destroy']);module[_0x1b92('0x1b')]=router; \ No newline at end of file +var _0x25a3=['put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','tracked','mail','create'];(function(_0x46de85,_0x4073eb){var _0x216dd3=function(_0xf052dc){while(--_0xf052dc){_0x46de85['push'](_0x46de85['shift']());}};_0x216dd3(++_0x4073eb);}(_0x25a3,0x121));var _0x325a=function(_0x443c84,_0x56aa82){_0x443c84=_0x443c84-0x0;var _0x232c4a=_0x25a3[_0x443c84];return _0x232c4a;};'use strict';var multer=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var path=require(_0x325a('0x2'));var timeout=require('connect-timeout');var express=require(_0x325a('0x3'));var router=express['Router']();var fs_extra=require(_0x325a('0x4'));var auth=require(_0x325a('0x5'));var interaction=require(_0x325a('0x6'));var config=require('../../config/environment');var controller=require(_0x325a('0x7'));router[_0x325a('0x8')]('/',auth[_0x325a('0x9')](),controller['index']);router['get'](_0x325a('0xa'),auth[_0x325a('0x9')](),controller[_0x325a('0xb')]);router[_0x325a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x325a('0xc')]);router[_0x325a('0x8')](_0x325a('0xd'),auth[_0x325a('0x9')](),controller[_0x325a('0xe')]);router[_0x325a('0xf')]('/',auth['isAuthenticated'](),interaction[_0x325a('0x10')](_0x325a('0x11'),'mailmessage:create'),controller[_0x325a('0x12')]);router[_0x325a('0x13')](_0x325a('0x14'),auth[_0x325a('0x9')](),controller['update']);router['put'](_0x325a('0x15'),auth['isAuthenticated'](),controller[_0x325a('0x16')]);router[_0x325a('0x13')](_0x325a('0x17'),auth[_0x325a('0x9')](),controller[_0x325a('0x18')]);router[_0x325a('0x19')](_0x325a('0x14'),auth[_0x325a('0x9')](),controller[_0x325a('0x1a')]);module[_0x325a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fc3b73f..91b71bd 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 _0xd755=['lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd755,0x109));var _0x5d75=function(_0x320f22,_0x488293){_0x320f22=_0x320f22-0x0;var _0x281311=_0xd755[_0x320f22];return _0x281311;};'use strict';var Sequelize=require(_0x5d75('0x0'));var _=require(_0x5d75('0x1'));module[_0x5d75('0x2')]={'body':{'type':Sequelize[_0x5d75('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x4'))},'read':{'type':Sequelize[_0x5d75('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d75('0x6')]('in','out'),'defaultValue':_0x5d75('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5d75('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5d75('0x8')]},'to':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'cc':{'type':Sequelize[_0x5d75('0x3')]('long')},'bcc':{'type':Sequelize[_0x5d75('0x3')]('long')},'subject':{'type':Sequelize[_0x5d75('0x3')]},'sentAt':{'type':Sequelize[_0x5d75('0xa')]},'attach':{'type':Sequelize[_0x5d75('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5d75('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'originCc':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'originChannel':{'type':Sequelize[_0x5d75('0x6')](_0x5d75('0xc'),_0x5d75('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x2e2a=['out','STRING','long','DATE','Email','Chat','lodash','exports','TEXT','BOOLEAN','ENUM'];(function(_0x57bbda,_0x3b49c3){var _0x32abde=function(_0x181843){while(--_0x181843){_0x57bbda['push'](_0x57bbda['shift']());}};_0x32abde(++_0x3b49c3);}(_0x2e2a,0x1b3));var _0xa2e2=function(_0x2b9324,_0x32f260){_0x2b9324=_0x2b9324-0x0;var _0x5063a4=_0x2e2a[_0x2b9324];return _0x5063a4;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa2e2('0x0'));module[_0xa2e2('0x1')]={'body':{'type':Sequelize[_0xa2e2('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa2e2('0x2')]('medium')},'read':{'type':Sequelize[_0xa2e2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa2e2('0x4')]('in',_0xa2e2('0x5')),'defaultValue':_0xa2e2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa2e2('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa2e2('0x6')]},'to':{'type':Sequelize['TEXT'](_0xa2e2('0x7'))},'cc':{'type':Sequelize[_0xa2e2('0x2')](_0xa2e2('0x7'))},'bcc':{'type':Sequelize[_0xa2e2('0x2')](_0xa2e2('0x7'))},'subject':{'type':Sequelize[_0xa2e2('0x2')]},'sentAt':{'type':Sequelize[_0xa2e2('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa2e2('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa2e2('0x8')]},'originTo':{'type':Sequelize[_0xa2e2('0x2')](_0xa2e2('0x7'))},'originCc':{'type':Sequelize[_0xa2e2('0x2')](_0xa2e2('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xa2e2('0x9'),_0xa2e2('0xa')),'defaultValue':_0xa2e2('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8a48a95..d657da2 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 _0x14e0=['client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','includeAll','find','params','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','attachments','join','server/files/attachments','defaults','ListId','sendMail','messageId','format','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteractionId','isNil','info','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','rejectmessage','unix','root','server','files','tmp','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e0,0x8d));var _0x014e=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x14e0[_0xc0638b];return _0xd57dfa;};'use strict';var emlformat=require(_0x014e('0x0'));var moment=require(_0x014e('0x1'));var BPromise=require(_0x014e('0x2'));var util=require(_0x014e('0x3'));var path=require(_0x014e('0x4'));var fs=require('fs');var _=require(_0x014e('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x014e('0x6'));var logger=require(_0x014e('0x7'))(_0x014e('0x8'));var interaction_log=require(_0x014e('0x7'))(_0x014e('0x9'));var config=require(_0x014e('0xa'));var db=require(_0x014e('0xb'))['db'];config[_0x014e('0xc')]=_['defaults'](config[_0x014e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x014e('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x014e('0xe'));require(_0x014e('0xf'))['register'](socket);var jayson=require(_0x014e('0x10'));var client=jayson[_0x014e('0x11')][_0x014e('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x014e('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x014e('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2a8a1e,_0x481b0d,_0x259170,_0xec4c0e){return new BPromise(function(_0x3915c9,_0x18756a){var _0x4cfcce=_0xec4c0e||client;return _0x4cfcce[_0x014e('0x13')](_0x2a8a1e,_0x259170)[_0x014e('0x14')](function(_0x3da3de){logger['info'](_0x014e('0x15'),_0x481b0d,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x481b0d,_0x014e('0x16'),JSON[_0x014e('0x17')](_0x3da3de));if(_0x3da3de[_0x014e('0x18')]){if(_0x3da3de[_0x014e('0x18')][_0x014e('0x19')]===0x1f4){logger['error'](_0x014e('0x15'),_0x481b0d,_0x3da3de[_0x014e('0x18')][_0x014e('0x1a')]);return _0x18756a(_0x3da3de[_0x014e('0x18')][_0x014e('0x1a')]);}logger[_0x014e('0x18')](_0x014e('0x15'),_0x481b0d,_0x3da3de[_0x014e('0x18')]['message']);return _0x3915c9(_0x3da3de[_0x014e('0x18')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x481b0d,_0x014e('0x16'));_0x3915c9(_0x3da3de[_0x014e('0x1b')]['message']);}})[_0x014e('0x1c')](function(_0x5647c1){logger[_0x014e('0x18')](_0x014e('0x15'),_0x481b0d,_0x5647c1);_0x18756a(_0x5647c1);});});}function respondWithResult(_0x5e2001,_0x1a21b9){_0x1a21b9=_0x1a21b9||0xc8;return function(_0x2ffc67){if(_0x2ffc67){return _0x5e2001[_0x014e('0x1d')](_0x1a21b9)[_0x014e('0x1e')](_0x2ffc67);}};}function respondWithFilteredResult(_0x1e637e,_0x190913){return function(_0x4e8c2b){if(_0x4e8c2b){var _0x5e75f5=typeof _0x190913[_0x014e('0x1f')]===_0x014e('0x20')&&typeof _0x190913[_0x014e('0x21')]===_0x014e('0x20');var _0x27df93=_0x4e8c2b[_0x014e('0x22')];var _0x4fa966=_0x5e75f5?0x0:_0x190913['offset'];var _0x1d26e3=_0x5e75f5?_0x4e8c2b[_0x014e('0x22')]:_0x190913['offset']+_0x190913[_0x014e('0x21')];var _0x48252b;if(_0x1d26e3>=_0x27df93){_0x1d26e3=_0x27df93;_0x48252b=0xc8;}else{_0x48252b=0xce;}_0x1e637e[_0x014e('0x1d')](_0x48252b);return _0x1e637e[_0x014e('0x23')]('Content-Range',_0x4fa966+'-'+_0x1d26e3+'/'+_0x27df93)['json'](_0x4e8c2b);}return null;};}function saveUpdates(_0x18f383){return function(_0x491ce8){if(_0x491ce8){return _0x491ce8[_0x014e('0x24')](_0x18f383)[_0x014e('0x14')](function(_0x4bc7af){return _0x4bc7af;});}return null;};}function removeEntity(_0xdb2fb9){return function(_0x146c38){if(_0x146c38){return _0x146c38[_0x014e('0x25')]()[_0x014e('0x14')](function(){_0xdb2fb9[_0x014e('0x1d')](0xcc)[_0x014e('0x26')]();});}};}function handleEntityNotFound(_0x392bff){return function(_0x33c805){if(!_0x33c805){_0x392bff[_0x014e('0x27')](0x194);}return _0x33c805;};}function handleError(_0x397496,_0x614fe2){_0x614fe2=_0x614fe2||0x1f4;return function(_0x221721){logger[_0x014e('0x18')](_0x221721[_0x014e('0x28')]);if(_0x221721[_0x014e('0x29')]){delete _0x221721[_0x014e('0x29')];}_0x397496[_0x014e('0x1d')](_0x614fe2)[_0x014e('0x2a')](_0x221721);};}exports[_0x014e('0x2b')]=function(_0x34c899,_0x4090ca){var _0x467d07={},_0x555f41={},_0x53b138={'count':0x0,'rows':[]};var _0x27e493=_['map'](db[_0x014e('0x2c')][_0x014e('0x2d')],function(_0x21b1dc){return{'name':_0x21b1dc[_0x014e('0x2e')],'type':_0x21b1dc[_0x014e('0x2f')][_0x014e('0x30')]};});_0x555f41['model']=_['map'](_0x27e493,_0x014e('0x29'));_0x555f41[_0x014e('0x31')]=_[_0x014e('0x32')](_0x34c899[_0x014e('0x31')]);_0x555f41[_0x014e('0x33')]=_['intersection'](_0x555f41[_0x014e('0x34')],_0x555f41[_0x014e('0x31')]);_0x467d07[_0x014e('0x35')]=_[_0x014e('0x36')](_0x555f41[_0x014e('0x34')],qs['fields'](_0x34c899[_0x014e('0x31')][_0x014e('0x37')]));_0x467d07['attributes']=_0x467d07[_0x014e('0x35')][_0x014e('0x38')]?_0x467d07[_0x014e('0x35')]:_0x555f41[_0x014e('0x34')];if(!_0x34c899['query'][_0x014e('0x39')](_0x014e('0x3a'))){_0x467d07['limit']=qs[_0x014e('0x21')](_0x34c899[_0x014e('0x31')][_0x014e('0x21')]);_0x467d07[_0x014e('0x1f')]=qs['offset'](_0x34c899[_0x014e('0x31')][_0x014e('0x1f')]);}_0x467d07[_0x014e('0x3b')]=qs[_0x014e('0x3c')](_0x34c899[_0x014e('0x31')][_0x014e('0x3c')]);_0x467d07[_0x014e('0x3d')]=qs[_0x014e('0x33')](_[_0x014e('0x3e')](_0x34c899[_0x014e('0x31')],_0x555f41[_0x014e('0x33')]),_0x27e493);if(_0x34c899[_0x014e('0x31')][_0x014e('0x3f')]){_0x467d07[_0x014e('0x3d')]=_[_0x014e('0x40')](_0x467d07['where'],{'$or':_[_0x014e('0x41')](_0x27e493,function(_0x5d5891){if(_0x5d5891[_0x014e('0x2f')]!==_0x014e('0x42')){var _0x5bcdde={};_0x5bcdde[_0x5d5891['name']]={'$like':'%'+_0x34c899[_0x014e('0x31')][_0x014e('0x3f')]+'%'};return _0x5bcdde;}})});}_0x467d07=_[_0x014e('0x40')]({},_0x467d07,_0x34c899[_0x014e('0x43')]);var _0x5a3da7={'where':_0x467d07[_0x014e('0x3d')]};return db[_0x014e('0x2c')]['count'](_0x5a3da7)['then'](function(_0x20e939){_0x53b138[_0x014e('0x22')]=_0x20e939;if(_0x34c899[_0x014e('0x31')]['includeAll']){_0x467d07[_0x014e('0x44')]=[{'all':!![]}];}return db[_0x014e('0x2c')][_0x014e('0x45')](_0x467d07);})[_0x014e('0x14')](function(_0x31cf6c){_0x53b138[_0x014e('0x46')]=_0x31cf6c;return _0x53b138;})[_0x014e('0x14')](respondWithFilteredResult(_0x4090ca,_0x467d07))[_0x014e('0x1c')](handleError(_0x4090ca,null));};exports[_0x014e('0x47')]=function(_0x4ae5f6,_0x571aca){var _0x325fe9={'raw':!![],'where':{'id':_0x4ae5f6['params']['id']}},_0xac32ff={};_0xac32ff['model']=_[_0x014e('0x32')](db[_0x014e('0x2c')][_0x014e('0x2d')]);_0xac32ff['query']=_[_0x014e('0x32')](_0x4ae5f6[_0x014e('0x31')]);_0xac32ff['filters']=_['intersection'](_0xac32ff[_0x014e('0x34')],_0xac32ff[_0x014e('0x31')]);_0x325fe9[_0x014e('0x35')]=_['intersection'](_0xac32ff[_0x014e('0x34')],qs[_0x014e('0x37')](_0x4ae5f6[_0x014e('0x31')][_0x014e('0x37')]));_0x325fe9[_0x014e('0x35')]=_0x325fe9[_0x014e('0x35')]['length']?_0x325fe9[_0x014e('0x35')]:_0xac32ff[_0x014e('0x34')];if(_0x4ae5f6['query'][_0x014e('0x48')]){_0x325fe9[_0x014e('0x44')]=[{'all':!![]}];}_0x325fe9=_['merge']({},_0x325fe9,_0x4ae5f6[_0x014e('0x43')]);return db[_0x014e('0x2c')][_0x014e('0x49')](_0x325fe9)[_0x014e('0x14')](handleEntityNotFound(_0x571aca,null))[_0x014e('0x14')](respondWithResult(_0x571aca,null))['catch'](handleError(_0x571aca,null));};exports['update']=function(_0x18610d,_0x13633e){if(_0x18610d['body']['id']){delete _0x18610d['body']['id'];}return db['MailMessage'][_0x014e('0x49')]({'where':{'id':_0x18610d[_0x014e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13633e,null))[_0x014e('0x14')](saveUpdates(_0x18610d[_0x014e('0x4b')],null))[_0x014e('0x14')](respondWithResult(_0x13633e,null))[_0x014e('0x1c')](handleError(_0x13633e,null));};exports[_0x014e('0x25')]=function(_0x24d42f,_0xe5c1e3){return db['MailMessage']['find']({'where':{'id':_0x24d42f[_0x014e('0x4a')]['id']}})[_0x014e('0x14')](handleEntityNotFound(_0xe5c1e3,null))[_0x014e('0x14')](removeEntity(_0xe5c1e3,null))['catch'](handleError(_0xe5c1e3,null));};exports[_0x014e('0x4c')]=function(_0x41a79c,_0x3b6a83){return db['MailMessage'][_0x014e('0x4c')]()['then'](respondWithResult(_0x3b6a83,null))[_0x014e('0x1c')](handleError(_0x3b6a83,null));};exports['create']=function(_0x16aed6,_0x292ef4){return db['MailMessage'][_0x014e('0x4d')](_0x16aed6[_0x014e('0x4b')])[_0x014e('0x14')](function(_0x2c6863){if(_0x2c6863){if(_0x2c6863[_0x014e('0x4e')]===_0x014e('0x4f')&&!_0x2c6863[_0x014e('0x50')]){var _0x4a4e31,_0x56de68,_0x7514f;if(_0x16aed6[_0x014e('0x4b')]['to']){_0x56de68=_0x16aed6['body']['to'][_0x014e('0x51')](',')[0x0];}return db[_0x014e('0x52')][_0x014e('0x53')]({'where':{'id':_0x2c6863[_0x014e('0x54')]},'include':[{'model':db[_0x014e('0x55')],'as':_0x014e('0x56'),'include':[{'model':db['CmContact'],'as':_0x014e('0x57'),'where':{'email':_0x56de68},'limit':0x1,'order':[['updatedAt',_0x014e('0x58')]]}]},{'model':db[_0x014e('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x014e('0x14')](function(_0x474b8b){_0x4a4e31=_0x474b8b;if(!_0x4a4e31||!_0x4a4e31[_0x014e('0x5a')])return;var _0x370a15=_0x4a4e31['getSmtpOptions']();if(_0x16aed6[_0x014e('0x4b')]['attachments']&&_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')][_0x014e('0x38')]){for(var _0x13d694=0x0;_0x13d694<_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')]['length'];_0x13d694+=0x1){_0x16aed6['body'][_0x014e('0x5b')][_0x13d694]={'filename':_0x16aed6[_0x014e('0x4b')]['attachments'][_0x13d694][_0x014e('0x29')],'path':path[_0x014e('0x5c')](config['root'],_0x014e('0x5d'),_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')][_0x13d694]['basename'])};}}_0x7514f={'account':_0x370a15,'message':_0x16aed6[_0x014e('0x4b')]};return;})[_0x014e('0x14')](function(){if(_0x4a4e31['List']){if(_0x4a4e31[_0x014e('0x56')][_0x014e('0x57')][_0x014e('0x38')]){return _0x4a4e31[_0x014e('0x56')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x014e('0x5e')](_0x16aed6['body'],{'firstName':_0x16aed6[_0x014e('0x4b')]['to'],'email':_0x16aed6[_0x014e('0x4b')]['to'],'phone':_0x16aed6['body']['to'],'ListId':_0x4a4e31[_0x014e('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x014e('0x14')](function(){if(_0x7514f){return respondWithRpcPromise('SendMail',_0x014e('0x60'),_0x7514f,client9003)[_0x014e('0x14')](function(_0x5830c1){return _0x2c6863['update']({'read':!![],'messageId':_0x5830c1[_0x014e('0x61')],'sentAt':moment()[_0x014e('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x014e('0x1c')](function(_0x489692){logger[_0x014e('0x18')]('%s',JSON['stringify'](_0x489692));return _0x2c6863;});}return _0x2c6863;});}return _0x2c6863;}})[_0x014e('0x14')](respondWithResult(_0x292ef4,0xc9))['catch'](handleError(_0x292ef4,null));};exports[_0x014e('0x63')]=function(_0x52094d,_0x1dd3d8){var _0x5019d6={'agent':{},'channel':'mail'};if(_0x52094d[_0x014e('0x4b')]['id']){delete _0x52094d[_0x014e('0x4b')]['id'];}_0x52094d['body']['read']=!![];_0x52094d[_0x014e('0x4b')][_0x014e('0x64')]=moment()[_0x014e('0x62')](_0x014e('0x65'));_0x52094d[_0x014e('0x4b')][_0x014e('0x66')]=_0x52094d['body'][_0x014e('0x66')]||_0x52094d['user']['id'];_0x5019d6[_0x014e('0x67')]['id']=_0x52094d[_0x014e('0x4b')]['UserId'];return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x52094d['params']['id'],'UserId':null}})[_0x014e('0x14')](handleEntityNotFound(_0x1dd3d8,null))[_0x014e('0x14')](saveUpdates(_0x52094d[_0x014e('0x4b')],null))[_0x014e('0x14')](function(_0x3db0a5){if(_0x3db0a5){_0x5019d6[_0x014e('0x1a')]=_0x3db0a5[_0x014e('0x68')]({'plain':!![]});return db['MailInteraction'][_0x014e('0x49')]({'where':{'id':_0x3db0a5[_0x014e('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x1dd3d8,null))[_0x014e('0x14')](function(_0x167154){if(_0x167154){return _0x167154[_0x014e('0x24')]({'UserId':_0x52094d[_0x014e('0x4b')][_0x014e('0x66')],'read1stAt':_[_0x014e('0x6a')](_0x167154['read1stAt'])?moment()[_0x014e('0x62')](_0x014e('0x65')):undefined});}return null;})['then'](function(_0x36e9b8){if(_0x36e9b8){_0x5019d6['interaction']=_0x36e9b8[_0x014e('0x68')]({'plain':!![]});interaction_log[_0x014e('0x6b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52094d[_0x014e('0x6c')]['id'],_0x52094d['user']['name'],_0x52094d[_0x014e('0x6c')][_0x014e('0x6d')],_0x5019d6[_0x014e('0x6e')]['id'],_0x52094d[_0x014e('0x4b')]?JSON[_0x014e('0x17')](_0x52094d[_0x014e('0x4b')]):_0x014e('0x6f'));return respondWithRpcPromise(_0x014e('0x70'),_0x014e('0x71'),_0x5019d6);}return null;})[_0x014e('0x14')](function(_0x170ba4){var _0x7d7f06=_0x014e('0x72')+_0x170ba4[_0x014e('0x1a')]['ContactId'];return db[_0x014e('0x73')]['query'](_0x7d7f06,{'type':db['Sequelize'][_0x014e('0x74')][_0x014e('0x75')],'raw':!![]})[_0x014e('0x14')](function(_0x4da58b){return _0x4da58b;});})['then'](function(_0xae7f49){if(_0xae7f49){_0x5019d6[_0x014e('0x1a')][_0x014e('0x76')]=_0xae7f49[0x0];if(!_0x52094d[_0x014e('0x4b')][_0x014e('0x66')])return;return db[_0x014e('0x77')][_0x014e('0x49')]({'where':{'id':_0x52094d[_0x014e('0x4b')][_0x014e('0x66')],'role':'agent'},'attributes':['id',_0x014e('0x29'),_0x014e('0x78'),_0x014e('0x79'),_0x014e('0x7a')],'raw':!![]});}return null;})[_0x014e('0x14')](function(_0x4a0293){if(!_0x4a0293)return null;_0x5019d6[_0x014e('0x1a')][_0x014e('0x67')]=_0x4a0293;return _0x5019d6;})['then'](function(_0x279681){if(_0x279681){if(_0x52094d[_0x014e('0x4b')][_0x014e('0x7b')]){_0x5019d6[_0x014e('0x1a')][_0x014e('0x7c')]=util['format'](_0x014e('0x7d'),_0x52094d[_0x014e('0x6c')][_0x014e('0x29')]);_0x5019d6[_0x014e('0x1a')][_0x014e('0x7e')]=_0x5019d6['channel'];_0x5019d6[_0x014e('0x1a')][_0x014e('0x7f')]=_0x5019d6[_0x014e('0x7e')];_0x5019d6['message'][_0x014e('0x80')]=_0x014e('0x63');_0x5019d6[_0x014e('0x1a')]['body']=htmlToText[_0x014e('0x81')](_0x5019d6[_0x014e('0x1a')]['body']);return respondWithRpcPromise(_0x014e('0x82'),_0x014e('0x82'),{'event':_0x014e('0x83'),'message':_0x5019d6[_0x014e('0x1a')]},client9002)[_0x014e('0x14')](function(){return _0x5019d6;});}return _0x5019d6;}return null;})[_0x014e('0x14')](respondWithResult(_0x1dd3d8,null))[_0x014e('0x1c')](handleError(_0x1dd3d8,null));};exports[_0x014e('0x84')]=function(_0x70904b,_0xdc7786){var _0x1adffa={'agent':{},'channel':'mail'};if(_0x70904b['body']['id']){delete _0x70904b[_0x014e('0x4b')]['id'];}_0x70904b[_0x014e('0x4b')]['UserId']=_0x70904b[_0x014e('0x4b')][_0x014e('0x66')]||_0x70904b[_0x014e('0x6c')]['id'];_0x1adffa[_0x014e('0x67')]['id']=_0x70904b[_0x014e('0x4b')]['UserId'];return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x70904b[_0x014e('0x4a')]['id'],'UserId':null}})[_0x014e('0x14')](handleEntityNotFound(_0xdc7786,null))[_0x014e('0x14')](function(_0x395a67){if(_0x395a67){_0x1adffa[_0x014e('0x1a')]=_0x395a67[_0x014e('0x68')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x395a67[_0x014e('0x69')]}});}return null;})[_0x014e('0x14')](handleEntityNotFound(_0xdc7786,null))[_0x014e('0x14')](function(_0x1f560d){if(_0x1f560d){_0x1adffa['interaction']=_0x1f560d[_0x014e('0x68')]({'plain':!![]});interaction_log[_0x014e('0x6b')](_0x014e('0x85'),_0x70904b[_0x014e('0x6c')]['id'],_0x70904b['user'][_0x014e('0x29')],_0x70904b[_0x014e('0x6c')][_0x014e('0x6d')],_0x1adffa['interaction']['id'],_0x70904b[_0x014e('0x4b')]?JSON[_0x014e('0x17')](_0x70904b[_0x014e('0x4b')]):_0x014e('0x6f'));return respondWithRpcPromise(_0x014e('0x86'),_0x014e('0x87'),_0x1adffa);}return null;})[_0x014e('0x14')](function(_0x31db07){var _0x3e9934=_0x014e('0x72')+_0x31db07['message'][_0x014e('0x88')];return db[_0x014e('0x73')]['query'](_0x3e9934,{'type':db[_0x014e('0x89')][_0x014e('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x4e8931){return _0x4e8931;});})['then'](function(_0x69e908){if(_0x69e908){_0x1adffa[_0x014e('0x1a')][_0x014e('0x76')]=_0x69e908[0x0];if(!_0x70904b[_0x014e('0x4b')][_0x014e('0x66')])return;return db[_0x014e('0x77')][_0x014e('0x49')]({'where':{'id':_0x70904b['body']['UserId'],'role':_0x014e('0x67')},'attributes':['id',_0x014e('0x29'),_0x014e('0x78'),_0x014e('0x79'),'internal'],'raw':!![]});}return null;})[_0x014e('0x14')](function(_0x3d56f0){if(!_0x3d56f0)return null;_0x1adffa[_0x014e('0x1a')][_0x014e('0x67')]=_0x3d56f0;return _0x1adffa;})[_0x014e('0x14')](function(_0x4a89e7){if(_0x4a89e7){_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7c')]=util[_0x014e('0x62')]('SIP/%s',_0x70904b[_0x014e('0x6c')][_0x014e('0x29')]);_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7e')]=_0x1adffa[_0x014e('0x7e')];_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7f')]=_0x1adffa[_0x014e('0x7e')];_0x4a89e7[_0x014e('0x1a')][_0x014e('0x80')]='reject';_0x4a89e7[_0x014e('0x1a')][_0x014e('0x4b')]=htmlToText[_0x014e('0x81')](_0x1adffa[_0x014e('0x1a')][_0x014e('0x4b')]);respondWithRpcPromise(_0x014e('0x82'),'EventManager',{'event':_0x014e('0x8a'),'message':_0x4a89e7[_0x014e('0x1a')]},client9002);return _0x1adffa;}return null;})[_0x014e('0x14')](respondWithResult(_0xdc7786,null))[_0x014e('0x1c')](handleError(_0xdc7786,null));};exports['download']=function(_0x4bd024,_0x205f3a){var _0x1ef812=moment()[_0x014e('0x8b')]()['toString']();var _0x40e38a=path[_0x014e('0x5c')](config[_0x014e('0x8c')],_0x014e('0x8d'),_0x014e('0x8e'),_0x014e('0x8f'));var _0x704810=path[_0x014e('0x5c')](config[_0x014e('0x8c')],_0x014e('0x8d'),'files',_0x014e('0x5b'));var _0x4bb7f6=util[_0x014e('0x62')]('message-%s.eml',_0x1ef812);return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x4bd024[_0x014e('0x4a')]['id']},'attributes':['id',_0x014e('0x4b'),'from','to','cc',_0x014e('0x90'),_0x014e('0x91'),_0x014e('0x92')],'include':_0x4bd024[_0x014e('0x31')][_0x014e('0x5b')]?[{'model':db[_0x014e('0x93')],'as':_0x014e('0x94')}]:undefined})[_0x014e('0x14')](handleEntityNotFound(_0x205f3a,null))['then'](function(_0x1478bf){if(_0x1478bf){var _0x350578=_0x1478bf;var _0x36da90={'from':_0x350578[_0x014e('0x95')],'to':_0x350578['to'],'subject':_0x350578[_0x014e('0x91')],'html':htmlEntities['decode'](_0x350578[_0x014e('0x4b')]),'headers':{'Date':moment(_0x350578['createdAt'])[_0x014e('0x62')](_0x014e('0x96'))},'attachments':[]};if(_0x1478bf['cc']){_0x36da90['headers']['Cc']=_0x1478bf['cc'];}if(_0x1478bf[_0x014e('0x90')]){_0x36da90[_0x014e('0x97')][_0x014e('0x98')]=_0x1478bf[_0x014e('0x90')];}return new BPromise(function(_0x2aa2d4,_0x586ae9){if(_0x1478bf[_0x014e('0x94')]){for(var _0x500aba=0x0;_0x500aba<_0x1478bf[_0x014e('0x94')][_0x014e('0x38')];_0x500aba++){var _0xa5902b=_0x1478bf['Attachments'][_0x500aba];var _0x3bce0c=path['join'](_0x704810,_0xa5902b[_0x014e('0x99')]);if(fs['existsSync'](_0x3bce0c)){_0x36da90[_0x014e('0x5b')][_0x014e('0x9a')]({'name':_0xa5902b[_0x014e('0x29')],'contentType':_0xa5902b[_0x014e('0x2f')],'data':fs['readFileSync'](_0x3bce0c)});}}}emlformat[_0x014e('0x9b')](_0x36da90,function(_0x3f98fc,_0x2e17c2){if(_0x3f98fc)return _0x586ae9(_0x3f98fc);fs[_0x014e('0x9c')](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6),_0x2e17c2);return _0x2aa2d4(_0x2e17c2);});});}})[_0x014e('0x14')](function(_0x32f394){if(_0x32f394){return _0x205f3a['download'](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6),_0x4bb7f6,function(_0x337215){if(!_0x337215)fs[_0x014e('0x9d')](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6));});}})[_0x014e('0x1c')](handleError(_0x205f3a,null));}; \ No newline at end of file +var _0x2825=['send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','MailMessage','findAll','rows','show','params','fields','includeAll','find','body','describe','create','out','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','rejectMessage','User','fromString','download','unix','server','message-%s.eml','from','bcc','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack','name'];(function(_0x4816cd,_0x139be0){var _0x5e20b1=function(_0x3bca36){while(--_0x3bca36){_0x4816cd['push'](_0x4816cd['shift']());}};_0x5e20b1(++_0x139be0);}(_0x2825,0x6c));var _0x5282=function(_0x35ee47,_0x4627ac){_0x35ee47=_0x35ee47-0x0;var _0x3edebc=_0x2825[_0x35ee47];return _0x3edebc;};'use strict';var emlformat=require(_0x5282('0x0'));var moment=require(_0x5282('0x1'));var BPromise=require(_0x5282('0x2'));var util=require(_0x5282('0x3'));var path=require(_0x5282('0x4'));var fs=require('fs');var _=require(_0x5282('0x5'));var Redis=require(_0x5282('0x6'));var htmlToText=require(_0x5282('0x7'));var qs=require(_0x5282('0x8'));var logger=require(_0x5282('0x9'))('api');var interaction_log=require(_0x5282('0x9'))(_0x5282('0xa'));var config=require('../../config/environment');var db=require(_0x5282('0xb'))['db'];config[_0x5282('0xc')]=_[_0x5282('0xd')](config[_0x5282('0xc')],{'host':_0x5282('0xe'),'port':0x18eb});var socket=require(_0x5282('0xf'))(new Redis(config[_0x5282('0xc')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x5282('0x10')](socket);var jayson=require(_0x5282('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x5282('0x12')][_0x5282('0x13')]({'port':0x232b});var client9002=jayson[_0x5282('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x464224,_0x5a2f85,_0x4fbf2c,_0x4527a2){return new BPromise(function(_0xd9b800,_0x1938d8){var _0x283bd9=_0x4527a2||client;return _0x283bd9['request'](_0x464224,_0x4fbf2c)['then'](function(_0x31e029){logger[_0x5282('0x14')](_0x5282('0x15'),_0x5a2f85,_0x5282('0x16'));logger['debug'](_0x5282('0x17'),_0x5a2f85,_0x5282('0x16'),JSON[_0x5282('0x18')](_0x31e029));if(_0x31e029[_0x5282('0x19')]){if(_0x31e029[_0x5282('0x19')][_0x5282('0x1a')]===0x1f4){logger['error'](_0x5282('0x15'),_0x5a2f85,_0x31e029[_0x5282('0x19')][_0x5282('0x1b')]);return _0x1938d8(_0x31e029[_0x5282('0x19')][_0x5282('0x1b')]);}logger[_0x5282('0x19')](_0x5282('0x15'),_0x5a2f85,_0x31e029[_0x5282('0x19')][_0x5282('0x1b')]);return _0xd9b800(_0x31e029[_0x5282('0x19')]['message']);}else{logger[_0x5282('0x14')]('MailMessage,\x20%s,\x20%s',_0x5a2f85,'request\x20sent');_0xd9b800(_0x31e029[_0x5282('0x1c')][_0x5282('0x1b')]);}})[_0x5282('0x1d')](function(_0x50c92c){logger[_0x5282('0x19')](_0x5282('0x15'),_0x5a2f85,_0x50c92c);_0x1938d8(_0x50c92c);});});}function respondWithResult(_0x17ab7d,_0x3c6f04){_0x3c6f04=_0x3c6f04||0xc8;return function(_0x32a378){if(_0x32a378){return _0x17ab7d[_0x5282('0x1e')](_0x3c6f04)[_0x5282('0x1f')](_0x32a378);}};}function respondWithFilteredResult(_0x20e7e4,_0x5ed72e){return function(_0x33e32e){if(_0x33e32e){var _0x2bd0be=typeof _0x5ed72e[_0x5282('0x20')]===_0x5282('0x21')&&typeof _0x5ed72e[_0x5282('0x22')]===_0x5282('0x21');var _0x4142f5=_0x33e32e[_0x5282('0x23')];var _0x524316=_0x2bd0be?0x0:_0x5ed72e[_0x5282('0x20')];var _0x353876=_0x2bd0be?_0x33e32e[_0x5282('0x23')]:_0x5ed72e[_0x5282('0x20')]+_0x5ed72e[_0x5282('0x22')];var _0x8001cb;if(_0x353876>=_0x4142f5){_0x353876=_0x4142f5;_0x8001cb=0xc8;}else{_0x8001cb=0xce;}_0x20e7e4[_0x5282('0x1e')](_0x8001cb);return _0x20e7e4[_0x5282('0x24')](_0x5282('0x25'),_0x524316+'-'+_0x353876+'/'+_0x4142f5)[_0x5282('0x1f')](_0x33e32e);}return null;};}function saveUpdates(_0x1e30e7){return function(_0x2fe39d){if(_0x2fe39d){return _0x2fe39d[_0x5282('0x26')](_0x1e30e7)['then'](function(_0x5c494a){return _0x5c494a;});}return null;};}function removeEntity(_0x1a9255){return function(_0x4d0b37){if(_0x4d0b37){return _0x4d0b37['destroy']()[_0x5282('0x27')](function(){_0x1a9255['status'](0xcc)[_0x5282('0x28')]();});}};}function handleEntityNotFound(_0x22b961){return function(_0x5e620d){if(!_0x5e620d){_0x22b961[_0x5282('0x29')](0x194);}return _0x5e620d;};}function handleError(_0x44a70d,_0x90924d){_0x90924d=_0x90924d||0x1f4;return function(_0xa4ea7e){logger['error'](_0xa4ea7e[_0x5282('0x2a')]);if(_0xa4ea7e[_0x5282('0x2b')]){delete _0xa4ea7e[_0x5282('0x2b')];}_0x44a70d[_0x5282('0x1e')](_0x90924d)[_0x5282('0x2c')](_0xa4ea7e);};}exports[_0x5282('0x2d')]=function(_0x15e7da,_0x1c9dec){var _0x584023={},_0x1ea7f9={},_0x91d311={'count':0x0,'rows':[]};var _0x87021a=_[_0x5282('0x2e')](db['MailMessage'][_0x5282('0x2f')],function(_0x41a8eb){return{'name':_0x41a8eb[_0x5282('0x30')],'type':_0x41a8eb[_0x5282('0x31')][_0x5282('0x32')]};});_0x1ea7f9[_0x5282('0x33')]=_[_0x5282('0x2e')](_0x87021a,_0x5282('0x2b'));_0x1ea7f9['query']=_[_0x5282('0x34')](_0x15e7da[_0x5282('0x35')]);_0x1ea7f9[_0x5282('0x36')]=_[_0x5282('0x37')](_0x1ea7f9[_0x5282('0x33')],_0x1ea7f9[_0x5282('0x35')]);_0x584023[_0x5282('0x38')]=_[_0x5282('0x37')](_0x1ea7f9[_0x5282('0x33')],qs['fields'](_0x15e7da[_0x5282('0x35')]['fields']));_0x584023[_0x5282('0x38')]=_0x584023[_0x5282('0x38')][_0x5282('0x39')]?_0x584023[_0x5282('0x38')]:_0x1ea7f9[_0x5282('0x33')];if(!_0x15e7da[_0x5282('0x35')][_0x5282('0x3a')](_0x5282('0x3b'))){_0x584023[_0x5282('0x22')]=qs[_0x5282('0x22')](_0x15e7da['query'][_0x5282('0x22')]);_0x584023[_0x5282('0x20')]=qs[_0x5282('0x20')](_0x15e7da['query'][_0x5282('0x20')]);}_0x584023[_0x5282('0x3c')]=qs[_0x5282('0x3d')](_0x15e7da[_0x5282('0x35')][_0x5282('0x3d')]);_0x584023[_0x5282('0x3e')]=qs['filters'](_['pick'](_0x15e7da[_0x5282('0x35')],_0x1ea7f9[_0x5282('0x36')]),_0x87021a);if(_0x15e7da[_0x5282('0x35')][_0x5282('0x3f')]){_0x584023[_0x5282('0x3e')]=_[_0x5282('0x40')](_0x584023['where'],{'$or':_['map'](_0x87021a,function(_0x53fd88){if(_0x53fd88['type']!==_0x5282('0x41')){var _0x44d8d6={};_0x44d8d6[_0x53fd88[_0x5282('0x2b')]]={'$like':'%'+_0x15e7da['query']['filter']+'%'};return _0x44d8d6;}})});}_0x584023=_['merge']({},_0x584023,_0x15e7da[_0x5282('0x42')]);var _0x330a8c={'where':_0x584023[_0x5282('0x3e')]};return db['MailMessage'][_0x5282('0x23')](_0x330a8c)['then'](function(_0x52cf83){_0x91d311[_0x5282('0x23')]=_0x52cf83;if(_0x15e7da[_0x5282('0x35')]['includeAll']){_0x584023[_0x5282('0x43')]=[{'all':!![]}];}return db[_0x5282('0x44')][_0x5282('0x45')](_0x584023);})[_0x5282('0x27')](function(_0x11aa8e){_0x91d311[_0x5282('0x46')]=_0x11aa8e;return _0x91d311;})[_0x5282('0x27')](respondWithFilteredResult(_0x1c9dec,_0x584023))[_0x5282('0x1d')](handleError(_0x1c9dec,null));};exports[_0x5282('0x47')]=function(_0x41b10e,_0x5e5373){var _0x404989={'raw':!![],'where':{'id':_0x41b10e[_0x5282('0x48')]['id']}},_0x197259={};_0x197259['model']=_[_0x5282('0x34')](db['MailMessage'][_0x5282('0x2f')]);_0x197259[_0x5282('0x35')]=_[_0x5282('0x34')](_0x41b10e[_0x5282('0x35')]);_0x197259['filters']=_[_0x5282('0x37')](_0x197259['model'],_0x197259[_0x5282('0x35')]);_0x404989[_0x5282('0x38')]=_[_0x5282('0x37')](_0x197259['model'],qs[_0x5282('0x49')](_0x41b10e['query'][_0x5282('0x49')]));_0x404989[_0x5282('0x38')]=_0x404989['attributes']['length']?_0x404989[_0x5282('0x38')]:_0x197259[_0x5282('0x33')];if(_0x41b10e[_0x5282('0x35')][_0x5282('0x4a')]){_0x404989[_0x5282('0x43')]=[{'all':!![]}];}_0x404989=_[_0x5282('0x40')]({},_0x404989,_0x41b10e[_0x5282('0x42')]);return db[_0x5282('0x44')][_0x5282('0x4b')](_0x404989)[_0x5282('0x27')](handleEntityNotFound(_0x5e5373,null))[_0x5282('0x27')](respondWithResult(_0x5e5373,null))[_0x5282('0x1d')](handleError(_0x5e5373,null));};exports[_0x5282('0x26')]=function(_0x53149d,_0x11cecf){if(_0x53149d[_0x5282('0x4c')]['id']){delete _0x53149d[_0x5282('0x4c')]['id'];}return db[_0x5282('0x44')][_0x5282('0x4b')]({'where':{'id':_0x53149d[_0x5282('0x48')]['id']}})[_0x5282('0x27')](handleEntityNotFound(_0x11cecf,null))[_0x5282('0x27')](saveUpdates(_0x53149d['body'],null))[_0x5282('0x27')](respondWithResult(_0x11cecf,null))['catch'](handleError(_0x11cecf,null));};exports['destroy']=function(_0xd0e0f8,_0x1ae817){return db['MailMessage'][_0x5282('0x4b')]({'where':{'id':_0xd0e0f8[_0x5282('0x48')]['id']}})[_0x5282('0x27')](handleEntityNotFound(_0x1ae817,null))[_0x5282('0x27')](removeEntity(_0x1ae817,null))[_0x5282('0x1d')](handleError(_0x1ae817,null));};exports['describe']=function(_0x2e03bc,_0x12690f){return db[_0x5282('0x44')][_0x5282('0x4d')]()[_0x5282('0x27')](respondWithResult(_0x12690f,null))['catch'](handleError(_0x12690f,null));};exports[_0x5282('0x4e')]=function(_0x4e56a9,_0x219230){return db['MailMessage']['create'](_0x4e56a9[_0x5282('0x4c')])[_0x5282('0x27')](function(_0x83c8d5){if(_0x83c8d5){if(_0x83c8d5['direction']===_0x5282('0x4f')&&!_0x83c8d5['secret']){var _0x510c03,_0x5fb7c4,_0x13b0d1;if(_0x4e56a9[_0x5282('0x4c')]['to']){_0x5fb7c4=_0x4e56a9[_0x5282('0x4c')]['to'][_0x5282('0x50')](',')[0x0];}return db[_0x5282('0x51')]['findOne']({'where':{'id':_0x83c8d5[_0x5282('0x52')]},'include':[{'model':db[_0x5282('0x53')],'as':_0x5282('0x54'),'include':[{'model':db[_0x5282('0x55')],'as':_0x5282('0x56'),'where':{'email':_0x5fb7c4},'limit':0x1,'order':[[_0x5282('0x57'),'DESC']]}]},{'model':db[_0x5282('0x58')],'as':_0x5282('0x59'),'raw':!![],'include':[{'model':db[_0x5282('0x5a')],'as':_0x5282('0x5a'),'raw':!![]}]}]})[_0x5282('0x27')](function(_0x4a24a5){_0x510c03=_0x4a24a5;if(!_0x510c03||!_0x510c03[_0x5282('0x59')])return;var _0xd332e6=_0x510c03['getSmtpOptions']();if(_0x4e56a9[_0x5282('0x4c')][_0x5282('0x5b')]&&_0x4e56a9[_0x5282('0x4c')][_0x5282('0x5b')][_0x5282('0x39')]){for(var _0x44b66a=0x0;_0x44b66a<_0x4e56a9['body'][_0x5282('0x5b')]['length'];_0x44b66a+=0x1){_0x4e56a9[_0x5282('0x4c')]['attachments'][_0x44b66a]={'filename':_0x4e56a9[_0x5282('0x4c')][_0x5282('0x5b')][_0x44b66a]['name'],'path':path[_0x5282('0x5c')](config[_0x5282('0x5d')],_0x5282('0x5e'),_0x4e56a9[_0x5282('0x4c')][_0x5282('0x5b')][_0x44b66a][_0x5282('0x5f')])};}}_0x13b0d1={'account':_0xd332e6,'message':_0x4e56a9['body']};return;})[_0x5282('0x27')](function(){if(_0x510c03[_0x5282('0x54')]){if(_0x510c03[_0x5282('0x54')]['Contacts'][_0x5282('0x39')]){return _0x510c03[_0x5282('0x54')][_0x5282('0x56')][0x0];}else{return db[_0x5282('0x55')][_0x5282('0x4e')](_[_0x5282('0xd')](_0x4e56a9['body'],{'firstName':_0x4e56a9['body']['to'],'email':_0x4e56a9[_0x5282('0x4c')]['to'],'phone':_0x4e56a9[_0x5282('0x4c')]['to'],'ListId':_0x510c03[_0x5282('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x5282('0x27')](function(){if(_0x13b0d1){return respondWithRpcPromise(_0x5282('0x61'),_0x5282('0x62'),_0x13b0d1,client9003)['then'](function(_0x3aefa9){return _0x83c8d5[_0x5282('0x26')]({'read':!![],'messageId':_0x3aefa9[_0x5282('0x63')],'sentAt':moment()['format'](_0x5282('0x64'))});})['catch'](function(_0x3149de){logger[_0x5282('0x19')]('%s',JSON[_0x5282('0x18')](_0x3149de));return _0x83c8d5;});}return _0x83c8d5;});}return _0x83c8d5;}})[_0x5282('0x27')](respondWithResult(_0x219230,0xc9))[_0x5282('0x1d')](handleError(_0x219230,null));};exports[_0x5282('0x65')]=function(_0x54f0ff,_0x5c2847){var _0x592d06={'agent':{},'channel':_0x5282('0x66')};if(_0x54f0ff[_0x5282('0x4c')]['id']){delete _0x54f0ff[_0x5282('0x4c')]['id'];}_0x54f0ff[_0x5282('0x4c')]['read']=!![];_0x54f0ff[_0x5282('0x4c')][_0x5282('0x67')]=moment()[_0x5282('0x68')](_0x5282('0x64'));_0x54f0ff['body'][_0x5282('0x69')]=_0x54f0ff[_0x5282('0x4c')][_0x5282('0x69')]||_0x54f0ff['user']['id'];_0x592d06['agent']['id']=_0x54f0ff[_0x5282('0x4c')][_0x5282('0x69')];return db[_0x5282('0x44')][_0x5282('0x4b')]({'where':{'id':_0x54f0ff[_0x5282('0x48')]['id'],'UserId':null}})[_0x5282('0x27')](handleEntityNotFound(_0x5c2847,null))[_0x5282('0x27')](saveUpdates(_0x54f0ff[_0x5282('0x4c')],null))[_0x5282('0x27')](function(_0x5566d9){if(_0x5566d9){_0x592d06[_0x5282('0x1b')]=_0x5566d9[_0x5282('0x6a')]({'plain':!![]});return db[_0x5282('0x6b')][_0x5282('0x4b')]({'where':{'id':_0x5566d9[_0x5282('0x6c')]}});}return null;})[_0x5282('0x27')](handleEntityNotFound(_0x5c2847,null))[_0x5282('0x27')](function(_0x47558f){if(_0x47558f){return _0x47558f['update']({'UserId':_0x54f0ff[_0x5282('0x4c')]['UserId'],'read1stAt':_[_0x5282('0x6d')](_0x47558f['read1stAt'])?moment()[_0x5282('0x68')](_0x5282('0x64')):undefined});}return null;})[_0x5282('0x27')](function(_0x25acb2){if(_0x25acb2){_0x592d06[_0x5282('0x6e')]=_0x25acb2[_0x5282('0x6a')]({'plain':!![]});interaction_log[_0x5282('0x14')](_0x5282('0x6f'),_0x54f0ff['user']['id'],_0x54f0ff[_0x5282('0x70')]['name'],_0x54f0ff[_0x5282('0x70')]['role'],_0x592d06[_0x5282('0x6e')]['id'],_0x54f0ff[_0x5282('0x4c')]?JSON['stringify'](_0x54f0ff[_0x5282('0x4c')]):_0x5282('0x71'));return respondWithRpcPromise(_0x5282('0x72'),_0x5282('0x73'),_0x592d06);}return null;})[_0x5282('0x27')](function(_0x3ee031){var _0x500017='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ee031[_0x5282('0x1b')][_0x5282('0x74')];return db[_0x5282('0x75')][_0x5282('0x35')](_0x500017,{'type':db[_0x5282('0x76')][_0x5282('0x77')][_0x5282('0x78')],'raw':!![]})['then'](function(_0x5c5392){return _0x5c5392;});})[_0x5282('0x27')](function(_0x584aa6){if(_0x584aa6){_0x592d06[_0x5282('0x1b')][_0x5282('0x79')]=_0x584aa6[0x0];if(!_0x54f0ff[_0x5282('0x4c')]['UserId'])return;return db['User'][_0x5282('0x4b')]({'where':{'id':_0x54f0ff[_0x5282('0x4c')][_0x5282('0x69')],'role':_0x5282('0x7a')},'attributes':['id',_0x5282('0x2b'),_0x5282('0x7b'),_0x5282('0x7c'),_0x5282('0x7d')],'raw':!![]});}return null;})[_0x5282('0x27')](function(_0x5222c6){if(!_0x5222c6)return null;_0x592d06[_0x5282('0x1b')][_0x5282('0x7a')]=_0x5222c6;return _0x592d06;})['then'](function(_0x596b7e){if(_0x596b7e){if(_0x54f0ff[_0x5282('0x4c')]['manual']){_0x592d06[_0x5282('0x1b')][_0x5282('0x7e')]=util[_0x5282('0x68')](_0x5282('0x7f'),_0x54f0ff[_0x5282('0x70')][_0x5282('0x2b')]);_0x592d06['message'][_0x5282('0x80')]=_0x592d06[_0x5282('0x80')];_0x592d06[_0x5282('0x1b')][_0x5282('0x81')]=_0x592d06[_0x5282('0x80')];_0x592d06['message'][_0x5282('0x82')]=_0x5282('0x65');_0x592d06[_0x5282('0x1b')][_0x5282('0x4c')]=htmlToText['fromString'](_0x592d06[_0x5282('0x1b')][_0x5282('0x4c')]);return respondWithRpcPromise(_0x5282('0x83'),'EventManager',{'event':'acceptmessage','message':_0x592d06['message']},client9002)[_0x5282('0x27')](function(){return _0x592d06;});}return _0x592d06;}return null;})[_0x5282('0x27')](respondWithResult(_0x5c2847,null))[_0x5282('0x1d')](handleError(_0x5c2847,null));};exports[_0x5282('0x84')]=function(_0x394bda,_0x19f917){var _0x2c4626={'agent':{},'channel':_0x5282('0x66')};if(_0x394bda[_0x5282('0x4c')]['id']){delete _0x394bda['body']['id'];}_0x394bda[_0x5282('0x4c')]['UserId']=_0x394bda[_0x5282('0x4c')][_0x5282('0x69')]||_0x394bda[_0x5282('0x70')]['id'];_0x2c4626[_0x5282('0x7a')]['id']=_0x394bda[_0x5282('0x4c')]['UserId'];return db['MailMessage'][_0x5282('0x4b')]({'where':{'id':_0x394bda['params']['id'],'UserId':null}})[_0x5282('0x27')](handleEntityNotFound(_0x19f917,null))[_0x5282('0x27')](function(_0x49bb27){if(_0x49bb27){_0x2c4626[_0x5282('0x1b')]=_0x49bb27[_0x5282('0x6a')]({'plain':!![]});return db[_0x5282('0x6b')]['find']({'where':{'id':_0x49bb27[_0x5282('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x19f917,null))['then'](function(_0x447129){if(_0x447129){_0x2c4626[_0x5282('0x6e')]=_0x447129[_0x5282('0x6a')]({'plain':!![]});interaction_log[_0x5282('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x394bda[_0x5282('0x70')]['id'],_0x394bda['user']['name'],_0x394bda[_0x5282('0x70')]['role'],_0x2c4626[_0x5282('0x6e')]['id'],_0x394bda['body']?JSON['stringify'](_0x394bda['body']):_0x5282('0x71'));return respondWithRpcPromise('RejectMessage',_0x5282('0x85'),_0x2c4626);}return null;})[_0x5282('0x27')](function(_0x45f906){var _0x406f15='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45f906[_0x5282('0x1b')][_0x5282('0x74')];return db['sequelize'][_0x5282('0x35')](_0x406f15,{'type':db[_0x5282('0x76')][_0x5282('0x77')]['SELECT'],'raw':!![]})[_0x5282('0x27')](function(_0x379361){return _0x379361;});})[_0x5282('0x27')](function(_0x124a15){if(_0x124a15){_0x2c4626[_0x5282('0x1b')][_0x5282('0x79')]=_0x124a15[0x0];if(!_0x394bda[_0x5282('0x4c')]['UserId'])return;return db[_0x5282('0x86')][_0x5282('0x4b')]({'where':{'id':_0x394bda[_0x5282('0x4c')][_0x5282('0x69')],'role':_0x5282('0x7a')},'attributes':['id',_0x5282('0x2b'),_0x5282('0x7b'),'email',_0x5282('0x7d')],'raw':!![]});}return null;})[_0x5282('0x27')](function(_0x1632aa){if(!_0x1632aa)return null;_0x2c4626[_0x5282('0x1b')]['agent']=_0x1632aa;return _0x2c4626;})[_0x5282('0x27')](function(_0x32d70d){if(_0x32d70d){_0x32d70d['message'][_0x5282('0x7e')]=util[_0x5282('0x68')](_0x5282('0x7f'),_0x394bda[_0x5282('0x70')][_0x5282('0x2b')]);_0x32d70d[_0x5282('0x1b')][_0x5282('0x80')]=_0x2c4626[_0x5282('0x80')];_0x32d70d['message']['motionChannel']=_0x2c4626[_0x5282('0x80')];_0x32d70d[_0x5282('0x1b')][_0x5282('0x82')]=_0x5282('0x84');_0x32d70d[_0x5282('0x1b')][_0x5282('0x4c')]=htmlToText[_0x5282('0x87')](_0x2c4626[_0x5282('0x1b')]['body']);respondWithRpcPromise('EventManager',_0x5282('0x83'),{'event':'rejectmessage','message':_0x32d70d[_0x5282('0x1b')]},client9002);return _0x2c4626;}return null;})[_0x5282('0x27')](respondWithResult(_0x19f917,null))[_0x5282('0x1d')](handleError(_0x19f917,null));};exports[_0x5282('0x88')]=function(_0x44405e,_0x101cc9){var _0x5c20f8=moment()[_0x5282('0x89')]()['toString']();var _0x4f5a25=path[_0x5282('0x5c')](config[_0x5282('0x5d')],_0x5282('0x8a'),'files','tmp');var _0x17dc9f=path[_0x5282('0x5c')](config[_0x5282('0x5d')],_0x5282('0x8a'),'files',_0x5282('0x5b'));var _0x55e2c0=util[_0x5282('0x68')](_0x5282('0x8b'),_0x5c20f8);return db[_0x5282('0x44')][_0x5282('0x4b')]({'where':{'id':_0x44405e[_0x5282('0x48')]['id']},'attributes':['id','body',_0x5282('0x8c'),'to','cc',_0x5282('0x8d'),'subject','createdAt'],'include':_0x44405e[_0x5282('0x35')][_0x5282('0x5b')]?[{'model':db['Attachment'],'as':_0x5282('0x8e')}]:undefined})[_0x5282('0x27')](handleEntityNotFound(_0x101cc9,null))[_0x5282('0x27')](function(_0x4a58e4){if(_0x4a58e4){var _0x9a9a96=_0x4a58e4;var _0x3ea8b9={'from':_0x9a9a96[_0x5282('0x8c')],'to':_0x9a9a96['to'],'subject':_0x9a9a96[_0x5282('0x8f')],'html':htmlEntities[_0x5282('0x90')](_0x9a9a96[_0x5282('0x4c')]),'headers':{'Date':moment(_0x9a9a96['createdAt'])[_0x5282('0x68')](_0x5282('0x91'))},'attachments':[]};if(_0x4a58e4['cc']){_0x3ea8b9['headers']['Cc']=_0x4a58e4['cc'];}if(_0x4a58e4[_0x5282('0x8d')]){_0x3ea8b9[_0x5282('0x92')]['Bcc']=_0x4a58e4[_0x5282('0x8d')];}return new BPromise(function(_0x11795e,_0xe5dcf){if(_0x4a58e4[_0x5282('0x8e')]){for(var _0x1a3d07=0x0;_0x1a3d07<_0x4a58e4['Attachments']['length'];_0x1a3d07++){var _0x50d0f3=_0x4a58e4['Attachments'][_0x1a3d07];var _0x1b4619=path[_0x5282('0x5c')](_0x17dc9f,_0x50d0f3['basename']);if(fs['existsSync'](_0x1b4619)){_0x3ea8b9[_0x5282('0x5b')][_0x5282('0x93')]({'name':_0x50d0f3[_0x5282('0x2b')],'contentType':_0x50d0f3[_0x5282('0x31')],'data':fs[_0x5282('0x94')](_0x1b4619)});}}}emlformat[_0x5282('0x95')](_0x3ea8b9,function(_0x2ac1f8,_0xc0de17){if(_0x2ac1f8)return _0xe5dcf(_0x2ac1f8);fs[_0x5282('0x96')](path[_0x5282('0x5c')](_0x4f5a25,_0x55e2c0),_0xc0de17);return _0x11795e(_0xc0de17);});});}})[_0x5282('0x27')](function(_0x27ce9c){if(_0x27ce9c){return _0x101cc9[_0x5282('0x88')](path[_0x5282('0x5c')](_0x4f5a25,_0x55e2c0),_0x55e2c0,function(_0x497071){if(!_0x497071)fs[_0x5282('0x97')](path[_0x5282('0x5c')](_0x4f5a25,_0x55e2c0));});}})['catch'](handleError(_0x101cc9,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index db721cc..8ecc39c 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 _0xe3ec=['remove','emit','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x4a7589,_0xd20483){var _0x409969=function(_0x43ab0b){while(--_0x43ab0b){_0x4a7589['push'](_0x4a7589['shift']());}};_0x409969(++_0xd20483);}(_0xe3ec,0x84));var _0xce3e=function(_0x358f56,_0x36c10f){_0x358f56=_0x358f56-0x0;var _0x1e4fbd=_0xe3ec[_0x358f56];return _0x1e4fbd;};'use strict';var EventEmitter=require(_0xce3e('0x0'));var MailMessage=require(_0xce3e('0x1'))['db'][_0xce3e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce3e('0x3'),'afterUpdate':'update','afterDestroy':_0xce3e('0x4')};function emitEvent(_0x5c0e90){return function(_0x2a3b23,_0x26102f,_0x289329){MailMessageEvents[_0xce3e('0x5')](_0x5c0e90+':'+_0x2a3b23['id'],_0x2a3b23);MailMessageEvents[_0xce3e('0x5')](_0x5c0e90,_0x2a3b23);_0x289329(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xce3e('0x6')](e,emitEvent(event));}}module[_0xce3e('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xa6f8=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6f8,0x167));var _0x8a6f=function(_0x347498,_0x332242){_0x347498=_0x347498-0x0;var _0x334f2b=_0xa6f8[_0x347498];return _0x334f2b;};'use strict';var EventEmitter=require(_0x8a6f('0x0'));var MailMessage=require(_0x8a6f('0x1'))['db'][_0x8a6f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8a6f('0x3')](0x0);var events={'afterCreate':_0x8a6f('0x4'),'afterUpdate':_0x8a6f('0x5'),'afterDestroy':_0x8a6f('0x6')};function emitEvent(_0x234b24){return function(_0x2568e6,_0x94eb1,_0x4ba00f){MailMessageEvents[_0x8a6f('0x7')](_0x234b24+':'+_0x2568e6['id'],_0x2568e6);MailMessageEvents['emit'](_0x234b24,_0x2568e6);_0x4ba00f(null);};}for(var e in events){if(events[_0x8a6f('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x8a6f('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 47c7ac3..3e80cc3 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 _0x9a1e=['utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x9a1e,0x106));var _0xe9a1=function(_0xcad50,_0x6abe8e){_0xcad50=_0xcad50-0x0;var _0x597cd1=_0x9a1e[_0xcad50];return _0x597cd1;};'use strict';var _=require('lodash');var util=require(_0xe9a1('0x0'));var logger=require(_0xe9a1('0x1'))('api');var moment=require(_0xe9a1('0x2'));var BPromise=require(_0xe9a1('0x3'));var rp=require(_0xe9a1('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe9a1('0x5'));var rimraf=require(_0xe9a1('0x6'));var config=require(_0xe9a1('0x7'));var attributes=require(_0xe9a1('0x8'));module[_0xe9a1('0x9')]=function(_0x1ed4b2,_0x12bbf9){return _0x1ed4b2['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe9a1('0xa'),'fields':['messageId']},{'name':_0xe9a1('0xb'),'fields':[_0xe9a1('0xc'),_0xe9a1('0xd')],'type':_0xe9a1('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51c331,_0x22d5de,_0x3942e1){if(_0x51c331[_0xe9a1('0xf')]){_0x51c331[_0xe9a1('0xc')]=htmlToText['fromString'](_0x51c331[_0xe9a1('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3942e1(null,_0x22d5de);},'afterCreate':function(_0x5b6c52,_0x2ffca6,_0x3fe9d8){var _0x4c1651=_0x1ed4b2['models'];var _0x1cc45b=_0x5b6c52['get']({'plain':!![]});if(_0x1cc45b[_0xe9a1('0x10')][_0xe9a1('0x11')]()==='in'||_0x1cc45b[_0xe9a1('0x10')]['toLowerCase']()===_0xe9a1('0x12')&&!_0x1cc45b['secret']&&!_[_0xe9a1('0x13')](_0x1cc45b[_0xe9a1('0x14')])){_0x4c1651[_0xe9a1('0x15')][_0xe9a1('0x16')]({'where':{'id':_0x1cc45b[_0xe9a1('0x17')]}})[_0xe9a1('0x18')](function(_0x2a9f14){if(_0x2a9f14){_0x2a9f14[_0xe9a1('0x19')]({'lastMsgAt':_0x1cc45b[_0xe9a1('0x1a')],'lastMsgDirection':_0x1cc45b[_0xe9a1('0x10')][_0xe9a1('0x11')]()});}})[_0xe9a1('0x1b')](function(_0x587024){console['error'](_0x587024);});}_0x3fe9d8();}},'charset':_0xe9a1('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1a2d=['update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then'];(function(_0x12756f,_0x514b27){var _0xb67da2=function(_0x487479){while(--_0x487479){_0x12756f['push'](_0x12756f['shift']());}};_0xb67da2(++_0x514b27);}(_0x1a2d,0xf2));var _0xd1a2=function(_0x5f0632,_0x11125c){_0x5f0632=_0x5f0632-0x0;var _0x13bb70=_0x1a2d[_0x5f0632];return _0x13bb70;};'use strict';var _=require(_0xd1a2('0x0'));var util=require(_0xd1a2('0x1'));var logger=require(_0xd1a2('0x2'))('api');var moment=require(_0xd1a2('0x3'));var BPromise=require('bluebird');var rp=require(_0xd1a2('0x4'));var htmlToText=require(_0xd1a2('0x5'));var fs=require('fs');var path=require(_0xd1a2('0x6'));var rimraf=require('rimraf');var config=require(_0xd1a2('0x7'));var attributes=require(_0xd1a2('0x8'));module[_0xd1a2('0x9')]=function(_0x56a311,_0x409edd){return _0x56a311[_0xd1a2('0xa')](_0xd1a2('0xb'),attributes,{'tableName':_0xd1a2('0xc'),'paranoid':![],'indexes':[{'name':_0xd1a2('0xd'),'fields':[_0xd1a2('0xd')]},{'name':'fti_mail_messages','fields':[_0xd1a2('0xe'),_0xd1a2('0xf')],'type':_0xd1a2('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x6e50d,_0x3fac6b,_0x301453){if(_0x6e50d[_0xd1a2('0x11')]){_0x6e50d[_0xd1a2('0xe')]=htmlToText[_0xd1a2('0x12')](_0x6e50d[_0xd1a2('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x301453(null,_0x3fac6b);},'afterCreate':function(_0x193736,_0x59f1d6,_0x2d4800){var _0x2a2fa0=_0x56a311[_0xd1a2('0x13')];var _0x5ed20e=_0x193736[_0xd1a2('0x14')]({'plain':!![]});if(_0x5ed20e[_0xd1a2('0x15')][_0xd1a2('0x16')]()==='in'||_0x5ed20e[_0xd1a2('0x15')][_0xd1a2('0x16')]()===_0xd1a2('0x17')&&!_0x5ed20e[_0xd1a2('0x18')]&&!_['isNil'](_0x5ed20e[_0xd1a2('0x19')])){_0x2a2fa0[_0xd1a2('0x1a')][_0xd1a2('0x1b')]({'where':{'id':_0x5ed20e[_0xd1a2('0x1c')]}})[_0xd1a2('0x1d')](function(_0x45f60b){if(_0x45f60b){_0x45f60b[_0xd1a2('0x1e')]({'lastMsgAt':_0x5ed20e[_0xd1a2('0x1f')],'lastMsgDirection':_0x5ed20e[_0xd1a2('0x15')][_0xd1a2('0x16')]()});}})['catch'](function(_0x390f99){console[_0xd1a2('0x20')](_0x390f99);});}_0x2d4800();}},'charset':'utf8mb4','collate':_0xd1a2('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 30f7d0f..2bd2dc9 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 _0x8e3f=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});}exports[_0xf8e3('0x1c')]=function(_0x24e8d6){var _0x31f55d=this;return new Promise(function(_0x3128ad,_0x11c58e){return db[_0xf8e3('0x1d')][_0xf8e3('0x1e')](_0x24e8d6['body'],{'raw':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![]})[_0xf8e3('0x21')](function(_0x4a1e5f){logger[_0xf8e3('0x11')]('CreateMailMessage',_0x24e8d6);logger[_0xf8e3('0x13')](_0xf8e3('0x1c'),_0x24e8d6,JSON[_0xf8e3('0x16')](_0x4a1e5f));_0x3128ad(_0x4a1e5f);})[_0xf8e3('0x1b')](function(_0x1f4b68){logger[_0xf8e3('0x17')]('CreateMailMessage',_0x1f4b68[_0xf8e3('0x19')],_0x24e8d6);_0x11c58e(_0x31f55d[_0xf8e3('0x17')](0x1f4,_0x1f4b68[_0xf8e3('0x19')]));});});}; \ No newline at end of file +var _0x2032=['register','request','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateMailMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x2032,0xd9));var _0x2203=function(_0x3b3e09,_0x5a5cfe){_0x3b3e09=_0x3b3e09-0x0;var _0x1de4e4=_0x2032[_0x3b3e09];return _0x1de4e4;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['MailMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateMailMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 35dd6f8..8f9f879 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 _0x67a7=['mailMessage:','./mailMessage.events','remove','emit','removeListener'];(function(_0x49fc59,_0x33d88b){var _0x137573=function(_0x2c9469){while(--_0x2c9469){_0x49fc59['push'](_0x49fc59['shift']());}};_0x137573(++_0x33d88b);}(_0x67a7,0x19b));var _0x767a=function(_0x3dc21f,_0x590c94){_0x3dc21f=_0x3dc21f-0x0;var _0x1b2835=_0x67a7[_0x3dc21f];return _0x1b2835;};'use strict';var MailMessageEvents=require(_0x767a('0x0'));var events=['save',_0x767a('0x1'),'update'];function createListener(_0x4e414c,_0x5cbd65){return function(_0x6b6065){_0x5cbd65[_0x767a('0x2')](_0x4e414c,_0x6b6065);};}function removeListener(_0x21308b,_0x14c394){return function(){MailMessageEvents[_0x767a('0x3')](_0x21308b,_0x14c394);};}exports['register']=function(_0x1451ba){for(var _0x577dd8=0x0,_0x20302f=events['length'];_0x577dd8<_0x20302f;_0x577dd8++){var _0xa3e113=events[_0x577dd8];var _0x145b17=createListener(_0x767a('0x4')+_0xa3e113,_0x1451ba);MailMessageEvents['on'](_0xa3e113,_0x145b17);}}; \ No newline at end of file +var _0x665a=['update','emit','removeListener','register','length','mailMessage:','save'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x665a,0xbc));var _0xa665=function(_0xe88157,_0x965589){_0xe88157=_0xe88157-0x0;var _0xa9cf33=_0x665a[_0xe88157];return _0xa9cf33;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa665('0x0'),'remove',_0xa665('0x1')];function createListener(_0x546b13,_0x5e890d){return function(_0x2b643e){_0x5e890d[_0xa665('0x2')](_0x546b13,_0x2b643e);};}function removeListener(_0x3abc94,_0xddb535){return function(){MailMessageEvents[_0xa665('0x3')](_0x3abc94,_0xddb535);};}exports[_0xa665('0x4')]=function(_0x5625f1){for(var _0x2771ea=0x0,_0x4726b6=events[_0xa665('0x5')];_0x2771ea<_0x4726b6;_0x2771ea++){var _0x5b4594=events[_0x2771ea];var _0x423aff=createListener(_0xa665('0x6')+_0x5b4594,_0x5625f1);MailMessageEvents['on'](_0x5b4594,_0x423aff);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d3f853c..a8a03db 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 _0xdb06=['/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','/:id/teams','/:id/users','post','create','addTeams','addAgents','update','delete'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xdb06,0xe5));var _0x6db0=function(_0x553c46,_0x1bcdae){_0x553c46=_0x553c46-0x0;var _0x347e0f=_0xdb06[_0x553c46];return _0x347e0f;};'use strict';var multer=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var path=require(_0x6db0('0x2'));var timeout=require('connect-timeout');var express=require(_0x6db0('0x3'));var router=express['Router']();var fs_extra=require(_0x6db0('0x4'));var auth=require(_0x6db0('0x5'));var interaction=require(_0x6db0('0x6'));var config=require(_0x6db0('0x7'));var controller=require(_0x6db0('0x8'));router[_0x6db0('0x9')]('/',auth[_0x6db0('0xa')](),controller[_0x6db0('0xb')]);router['get'](_0x6db0('0xc'),auth[_0x6db0('0xa')](),controller[_0x6db0('0xd')]);router[_0x6db0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6db0('0x9')](_0x6db0('0xe'),auth[_0x6db0('0xa')](),controller['getMembers']);router[_0x6db0('0x9')](_0x6db0('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6db0('0x9')](_0x6db0('0x10'),auth[_0x6db0('0xa')](),controller['getAgents']);router[_0x6db0('0x11')]('/',auth[_0x6db0('0xa')](),controller[_0x6db0('0x12')]);router[_0x6db0('0x11')](_0x6db0('0xf'),auth['isAuthenticated'](),controller[_0x6db0('0x13')]);router['post'](_0x6db0('0x10'),auth[_0x6db0('0xa')](),controller[_0x6db0('0x14')]);router['put']('/:id',auth[_0x6db0('0xa')](),controller[_0x6db0('0x15')]);router[_0x6db0('0x16')](_0x6db0('0x17'),auth[_0x6db0('0xa')](),controller[_0x6db0('0x18')]);router[_0x6db0('0x16')](_0x6db0('0xf'),auth['isAuthenticated'](),controller[_0x6db0('0x19')]);router[_0x6db0('0x16')]('/:id/users',auth[_0x6db0('0xa')](),controller[_0x6db0('0x1a')]);module[_0x6db0('0x1b')]=router; \ No newline at end of file +var _0x8061=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers'];(function(_0x32a643,_0x1036af){var _0x24d11d=function(_0x3c2621){while(--_0x3c2621){_0x32a643['push'](_0x32a643['shift']());}};_0x24d11d(++_0x1036af);}(_0x8061,0x1a0));var _0x1806=function(_0x3da425,_0xa47640){_0x3da425=_0x3da425-0x0;var _0x2900aa=_0x8061[_0x3da425];return _0x2900aa;};'use strict';var multer=require(_0x1806('0x0'));var util=require(_0x1806('0x1'));var path=require(_0x1806('0x2'));var timeout=require(_0x1806('0x3'));var express=require(_0x1806('0x4'));var router=express[_0x1806('0x5')]();var fs_extra=require(_0x1806('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1806('0x7'));var config=require(_0x1806('0x8'));var controller=require(_0x1806('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1806('0xa')]);router[_0x1806('0xb')](_0x1806('0xc'),auth[_0x1806('0xd')](),controller[_0x1806('0xe')]);router[_0x1806('0xb')](_0x1806('0xf'),auth[_0x1806('0xd')](),controller['show']);router[_0x1806('0xb')](_0x1806('0x10'),auth[_0x1806('0xd')](),controller[_0x1806('0x11')]);router['get'](_0x1806('0x12'),auth[_0x1806('0xd')](),controller[_0x1806('0x13')]);router[_0x1806('0xb')]('/:id/users',auth[_0x1806('0xd')](),controller[_0x1806('0x14')]);router[_0x1806('0x15')]('/',auth[_0x1806('0xd')](),controller[_0x1806('0x16')]);router[_0x1806('0x15')](_0x1806('0x12'),auth['isAuthenticated'](),controller[_0x1806('0x17')]);router[_0x1806('0x15')](_0x1806('0x18'),auth['isAuthenticated'](),controller[_0x1806('0x19')]);router[_0x1806('0x1a')](_0x1806('0xf'),auth[_0x1806('0xd')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1806('0x1b')]);router[_0x1806('0x1c')](_0x1806('0x12'),auth[_0x1806('0xd')](),controller['removeTeams']);router[_0x1806('0x1c')](_0x1806('0x18'),auth[_0x1806('0xd')](),controller[_0x1806('0x1d')]);module[_0x1806('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4e27716..6431873 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 _0x1a26=['sequelize','STRING','ENUM'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x1a26,0x1d7));var _0x61a2=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x1a26[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x61a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x61a2('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x61a2('0x2')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xd10f=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xd10f,0x80));var _0xfd10=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd10f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfd10('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd10('0x1')],'unique':_0xfd10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfd10('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfd10('0x4'),_0xfd10('0x5'),_0xfd10('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index eebb415..7a3ef06 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 _0xbe84=['isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','nolimit','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','UserProfileResource','error','stack','name','index','map','MailQueue','fieldName','type','key','include','query','catch','show','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','getMembers','findOne','params','UserMailQueue','hasOwnProperty','order','sort','where','pick','filter','findAll','User','findAndCountAll','agent','mailPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams'];(function(_0x4f3d26,_0x29012e){var _0x52efd9=function(_0x2a91bc){while(--_0x2a91bc){_0x4f3d26['push'](_0x4f3d26['shift']());}};_0x52efd9(++_0x29012e);}(_0xbe84,0x82));var _0x4be8=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xbe84[_0x3b5250];return _0xc844a1;};'use strict';var BPromise=require('bluebird');var util=require(_0x4be8('0x0'));var _=require('lodash');var squel=require(_0x4be8('0x1'));var Redis=require(_0x4be8('0x2'));var qs=require(_0x4be8('0x3'));var logger=require(_0x4be8('0x4'))(_0x4be8('0x5'));var config=require(_0x4be8('0x6'));var db=require(_0x4be8('0x7'))['db'];config[_0x4be8('0x8')]=_[_0x4be8('0x9')](config[_0x4be8('0x8')],{'host':_0x4be8('0xa'),'port':0x18eb});var socket=require(_0x4be8('0xb'))(new Redis(config['redis']));require(_0x4be8('0xc'))[_0x4be8('0xd')](socket);function respondWithStatusCode(_0x45ee79,_0x145e5d){_0x145e5d=_0x145e5d||0xcc;return function(_0x365a6e){if(_0x365a6e){return _0x45ee79[_0x4be8('0xe')](_0x145e5d);}return _0x45ee79[_0x4be8('0xf')](_0x145e5d)[_0x4be8('0x10')]();};}function respondWithResult(_0x4d28c3,_0x3d755e){_0x3d755e=_0x3d755e||0xc8;return function(_0x595495){if(_0x595495){return _0x4d28c3[_0x4be8('0xf')](_0x3d755e)[_0x4be8('0x11')](_0x595495);}};}function respondWithFilteredResult(_0x382e07,_0xbf87ae){return function(_0x449bac){if(_0x449bac){var _0x6fb16f=typeof _0xbf87ae[_0x4be8('0x12')]===_0x4be8('0x13')&&typeof _0xbf87ae[_0x4be8('0x14')]==='undefined';var _0x158cf3=_0x449bac[_0x4be8('0x15')];var _0x192ca4=_0x6fb16f?0x0:_0xbf87ae[_0x4be8('0x12')];var _0xe47276=_0x6fb16f?_0x449bac['count']:_0xbf87ae['offset']+_0xbf87ae[_0x4be8('0x14')];var _0x488a12;if(_0xe47276>=_0x158cf3){_0xe47276=_0x158cf3;_0x488a12=0xc8;}else{_0x488a12=0xce;}_0x382e07[_0x4be8('0xf')](_0x488a12);return _0x382e07[_0x4be8('0x16')](_0x4be8('0x17'),_0x192ca4+'-'+_0xe47276+'/'+_0x158cf3)[_0x4be8('0x11')](_0x449bac);}return null;};}function saveUpdates(_0x47b459){return function(_0x271751){if(_0x271751){return _0x271751['update'](_0x47b459)[_0x4be8('0x18')](function(_0x373ca8){return _0x373ca8;});}return null;};}function removeEntity(_0x5119ab){return function(_0x49effa){if(_0x49effa){return _0x49effa['destroy']()[_0x4be8('0x18')](function(){var _0xa4b9b4=_0x49effa[_0x4be8('0x19')]({'plain':!![]});var _0x5612d3='MailQueues';return db[_0x4be8('0x1a')]['destroy']({'where':{'type':_0x5612d3,'resourceId':_0xa4b9b4['id']}})['then'](function(){return _0x49effa;});})[_0x4be8('0x18')](function(){_0x5119ab[_0x4be8('0xf')](0xcc)[_0x4be8('0x10')]();});}};}function handleEntityNotFound(_0x5b6427){return function(_0x4d7153){if(!_0x4d7153){_0x5b6427[_0x4be8('0xe')](0x194);}return _0x4d7153;};}function handleError(_0x360281,_0x1e7b38){_0x1e7b38=_0x1e7b38||0x1f4;return function(_0x1fbd2e){logger[_0x4be8('0x1b')](_0x1fbd2e[_0x4be8('0x1c')]);if(_0x1fbd2e[_0x4be8('0x1d')]){delete _0x1fbd2e[_0x4be8('0x1d')];}_0x360281[_0x4be8('0xf')](_0x1e7b38)['send'](_0x1fbd2e);};}exports[_0x4be8('0x1e')]=function(_0x15505a,_0x284f96){var _0x36e161={};var _0x16d0a4={'count':0x0,'rows':[]};var _0x550909=_[_0x4be8('0x1f')](db[_0x4be8('0x20')]['rawAttributes'],function(_0x5ab7c7){return{'name':_0x5ab7c7[_0x4be8('0x21')],'type':_0x5ab7c7[_0x4be8('0x22')][_0x4be8('0x23')]};});_0x36e161=qs['getOptions'](_0x550909,_0x15505a);var _0x31a69e={'where':_0x36e161['where']};return db[_0x4be8('0x20')][_0x4be8('0x15')](_0x31a69e)[_0x4be8('0x18')](function(_0x36ee85){_0x16d0a4[_0x4be8('0x15')]=_0x36ee85;_0x36e161['include']=qs[_0x4be8('0x24')](_0x15505a[_0x4be8('0x25')]);return db[_0x4be8('0x20')]['findAll'](_0x36e161);})[_0x4be8('0x18')](function(_0x268806){_0x16d0a4['rows']=_0x268806;return _0x16d0a4;})[_0x4be8('0x18')](respondWithFilteredResult(_0x284f96,_0x36e161))[_0x4be8('0x26')](handleError(_0x284f96,null));};exports[_0x4be8('0x27')]=function(_0x352ec3,_0x431efb){var _0x472aa1={'raw':!![],'where':{'id':_0x352ec3['params']['id']}},_0x3f74db={};_0x3f74db[_0x4be8('0x28')]=_[_0x4be8('0x29')](db[_0x4be8('0x20')][_0x4be8('0x2a')]);_0x3f74db[_0x4be8('0x25')]=_[_0x4be8('0x29')](_0x352ec3[_0x4be8('0x25')]);_0x3f74db[_0x4be8('0x2b')]=_['intersection'](_0x3f74db[_0x4be8('0x28')],_0x3f74db[_0x4be8('0x25')]);_0x472aa1['attributes']=_[_0x4be8('0x2c')](_0x3f74db['model'],qs[_0x4be8('0x2d')](_0x352ec3[_0x4be8('0x25')][_0x4be8('0x2d')]));_0x472aa1['attributes']=_0x472aa1[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x472aa1[_0x4be8('0x2e')]:_0x3f74db['model'];if(_0x352ec3[_0x4be8('0x25')][_0x4be8('0x30')]){_0x472aa1[_0x4be8('0x24')]=[{'all':!![]}];}_0x472aa1=_[_0x4be8('0x31')]({},_0x472aa1,_0x352ec3[_0x4be8('0x32')]);return db[_0x4be8('0x20')][_0x4be8('0x33')](_0x472aa1)[_0x4be8('0x18')](handleEntityNotFound(_0x431efb,null))[_0x4be8('0x18')](respondWithResult(_0x431efb,null))[_0x4be8('0x26')](handleError(_0x431efb,null));};exports[_0x4be8('0x34')]=function(_0x2f81d0,_0x54cd9a){return db[_0x4be8('0x20')]['create'](_0x2f81d0['body'],{})['then'](function(_0x225258){var _0x366d8d=_0x2f81d0[_0x4be8('0x35')][_0x4be8('0x19')]({'plain':!![]});if(!_0x366d8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366d8d['role']===_0x4be8('0x35')){var _0x3d2237=_0x225258['get']({'plain':!![]});var _0x46e38d=_0x4be8('0x36');return db[_0x4be8('0x37')][_0x4be8('0x33')]({'where':{'name':_0x46e38d,'userProfileId':_0x366d8d[_0x4be8('0x38')]},'raw':!![]})[_0x4be8('0x18')](function(_0x6c74ad){if(_0x6c74ad&&_0x6c74ad[_0x4be8('0x39')]===0x0){return db[_0x4be8('0x1a')][_0x4be8('0x34')]({'name':_0x3d2237['name'],'resourceId':_0x3d2237['id'],'type':_0x6c74ad[_0x4be8('0x1d')],'sectionId':_0x6c74ad['id']},{})[_0x4be8('0x18')](function(){return _0x225258;});}else{return _0x225258;}})[_0x4be8('0x26')](function(_0x2da1b0){logger['error'](_0x4be8('0x3a'),_0x2da1b0);throw _0x2da1b0;});}return _0x225258;})[_0x4be8('0x18')](respondWithResult(_0x54cd9a,0xc9))[_0x4be8('0x26')](handleError(_0x54cd9a,null));};exports[_0x4be8('0x3b')]=function(_0x30aaf9,_0x19930f){if(_0x30aaf9['body']['id']){delete _0x30aaf9[_0x4be8('0x3c')]['id'];}return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x30aaf9['params']['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x19930f,null))[_0x4be8('0x18')](saveUpdates(_0x30aaf9['body'],null))['then'](respondWithResult(_0x19930f,null))[_0x4be8('0x26')](handleError(_0x19930f,null));};exports[_0x4be8('0x3d')]=function(_0x4590c1,_0x549e24){return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x4590c1['params']['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x549e24,null))['then'](removeEntity(_0x549e24,null))[_0x4be8('0x26')](handleError(_0x549e24,null));};exports['describe']=function(_0x15e042,_0x35d849){return db[_0x4be8('0x20')][_0x4be8('0x3e')]()[_0x4be8('0x18')](respondWithResult(_0x35d849,null))['catch'](handleError(_0x35d849,null));};exports[_0x4be8('0x3f')]=function(_0x27cd1c,_0x1e8b0d){var _0x1fb781={'raw':!![],'where':{}},_0x2868f6={},_0x3e2bed;return db[_0x4be8('0x20')][_0x4be8('0x40')]({'where':{'id':_0x27cd1c[_0x4be8('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e8b0d,null))[_0x4be8('0x18')](function(_0xba3d0b){if(_0xba3d0b){_0x3e2bed=_0xba3d0b[_0x4be8('0x19')]({'plain':!![]});_0x2868f6['model']=_[_0x4be8('0x29')](db[_0x4be8('0x42')]['rawAttributes']);_0x2868f6['query']=_[_0x4be8('0x29')](_0x27cd1c['query']);_0x2868f6[_0x4be8('0x2b')]=_[_0x4be8('0x2c')](_0x2868f6[_0x4be8('0x28')],_0x2868f6[_0x4be8('0x25')]);_0x1fb781[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x2868f6[_0x4be8('0x28')],qs[_0x4be8('0x2d')](_0x27cd1c[_0x4be8('0x25')]['fields']));_0x1fb781[_0x4be8('0x2e')]=_0x1fb781['attributes'][_0x4be8('0x2f')]?_0x1fb781[_0x4be8('0x2e')]:_0x2868f6[_0x4be8('0x28')];if(!_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x43')]('nolimit')){_0x1fb781['limit']=qs[_0x4be8('0x14')](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x14')]);_0x1fb781[_0x4be8('0x12')]=qs['offset'](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x12')]);}_0x1fb781[_0x4be8('0x44')]=qs['sort'](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x45')]);_0x1fb781[_0x4be8('0x46')]=qs['filters'](_[_0x4be8('0x47')](_0x27cd1c['query'],_0x2868f6[_0x4be8('0x2b')]));_0x1fb781['where']['MailQueueId']=_0xba3d0b['id'];if(_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x48')]){_0x1fb781[_0x4be8('0x46')]=_[_0x4be8('0x31')](_0x1fb781[_0x4be8('0x46')],{'$or':_['map'](_0x1fb781['attributes'],function(_0x46f640){var _0xda2940={};_0xda2940[_0x46f640]={'$like':'%'+_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x48')]+'%'};return _0xda2940;})});}_0x1fb781=_['merge']({},_0x1fb781,_0x27cd1c[_0x4be8('0x32')]);return db[_0x4be8('0x42')][_0x4be8('0x49')](_0x1fb781);}})[_0x4be8('0x18')](function(_0x180c83){if(_0x180c83){return db[_0x4be8('0x4a')][_0x4be8('0x4b')]({'where':{'id':_[_0x4be8('0x1f')](_0x180c83,'UserId'),'role':_0x4be8('0x4c')},'attributes':['id',_0x4be8('0x1d'),_0x4be8('0x4d'),'updatedAt',_0x4be8('0x4e')]});}})['then'](function(_0x193187){if(_0x193187){return{'count':_0x193187[_0x4be8('0x15')],'rows':_[_0x4be8('0x1f')](_0x193187[_0x4be8('0x4f')],function(_0x46806f){return{'membername':_0x46806f[_0x4be8('0x1d')],'UserId':_0x46806f['id'],'queue_name':_0x3e2bed[_0x4be8('0x1d')],'MailQueueId':_0x3e2bed['id'],'interface':util[_0x4be8('0x50')]('%s/%s',_0x4be8('0x51'),_0x46806f[_0x4be8('0x1d')]),'penalty':0x0,'paused':_0x46806f[_0x4be8('0x4d')],'createdAt':_0x46806f['createdAt'],'updatedAt':_0x46806f[_0x4be8('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4be8('0x18')](respondWithFilteredResult(_0x1e8b0d,_0x1fb781))[_0x4be8('0x26')](handleError(_0x1e8b0d,null));};exports[_0x4be8('0x53')]=function(_0x10bf5b,_0x29f725){var _0x343964={};var _0x487f3d={};var _0x35fc87;var _0x33cd45;return db[_0x4be8('0x20')][_0x4be8('0x40')]({'where':{'id':_0x10bf5b[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x29f725,null))[_0x4be8('0x18')](function(_0x36f8d4){if(_0x36f8d4){_0x35fc87=_0x36f8d4;_0x487f3d[_0x4be8('0x28')]=_[_0x4be8('0x29')](db[_0x4be8('0x54')][_0x4be8('0x2a')]);_0x487f3d['query']=_['keys'](_0x10bf5b[_0x4be8('0x25')]);_0x487f3d[_0x4be8('0x2b')]=_['intersection'](_0x487f3d[_0x4be8('0x28')],_0x487f3d[_0x4be8('0x25')]);_0x343964[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x487f3d[_0x4be8('0x28')],qs[_0x4be8('0x2d')](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x2d')]));_0x343964[_0x4be8('0x2e')]=_0x343964[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x343964[_0x4be8('0x2e')]:_0x487f3d[_0x4be8('0x28')];_0x343964['order']=qs['sort'](_0x10bf5b[_0x4be8('0x25')]['sort']);_0x343964[_0x4be8('0x46')]=qs[_0x4be8('0x2b')](_[_0x4be8('0x47')](_0x10bf5b[_0x4be8('0x25')],_0x487f3d[_0x4be8('0x2b')]));if(_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x48')]){_0x343964[_0x4be8('0x46')]=_[_0x4be8('0x31')](_0x343964['where'],{'$or':_[_0x4be8('0x1f')](_0x343964[_0x4be8('0x2e')],function(_0x3d55cc){var _0x1a2147={};_0x1a2147[_0x3d55cc]={'$like':'%'+_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x48')]+'%'};return _0x1a2147;})});}_0x343964=_['merge']({},_0x343964,_0x10bf5b[_0x4be8('0x32')]);return _0x35fc87[_0x4be8('0x53')](_0x343964);}})[_0x4be8('0x18')](function(_0x34d3a7){if(_0x34d3a7){_0x33cd45=_0x34d3a7[_0x4be8('0x2f')];if(!_0x10bf5b['query'][_0x4be8('0x43')]('nolimit')){_0x343964[_0x4be8('0x14')]=qs['limit'](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x14')]);_0x343964[_0x4be8('0x12')]=qs[_0x4be8('0x12')](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x12')]);}return _0x35fc87[_0x4be8('0x53')](_0x343964);}})[_0x4be8('0x18')](function(_0x3381de){if(_0x3381de){return _0x3381de?{'count':_0x33cd45,'rows':_0x3381de}:null;}})[_0x4be8('0x18')](respondWithResult(_0x29f725,null))[_0x4be8('0x26')](handleError(_0x29f725,null));};exports[_0x4be8('0x55')]=function(_0x506d16,_0x2bbbe0){var _0x2ccd49=_0x506d16[_0x4be8('0x3c')][_0x4be8('0x56')];return db[_0x4be8('0x54')]['findAll']({'where':{'id':_0x2ccd49},'attributes':['id'],'include':[{'model':db[_0x4be8('0x4a')],'as':_0x4be8('0x57'),'attributes':['id','name',_0x4be8('0x58'),_0x4be8('0x59'),'interface'],'raw':!![]}]})[_0x4be8('0x18')](function(_0x15ec86){if(_0x15ec86){var _0x2c103f=_[_0x4be8('0x5a')](_0x15ec86,function(_0x418169){var _0x43d2c1=_0x418169[_0x4be8('0x19')]({'plain':!![]});return _0x43d2c1[_0x4be8('0x57')];});return db['MailQueue']['find']({'where':{'id':_0x506d16[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](function(_0x8edf7b){return db['sequelize'][_0x4be8('0x5b')](function(_0x55631b){return _0x8edf7b['addTeams'](_0x2ccd49,{'transaction':_0x55631b})[_0x4be8('0x18')](function(){return BPromise['each'](_0x2c103f,function(_0x5811a1){return db[_0x4be8('0x42')][_0x4be8('0x5c')]({'where':{'UserId':_0x5811a1['id'],'MailQueueId':_0x506d16[_0x4be8('0x41')]['id']},'transaction':_0x55631b});});})['then'](function(){_0x2c103f[_0x4be8('0x5d')](function(_0x4c33c1){socket[_0x4be8('0x5e')](_0x4be8('0x5f'),{'UserId':_0x4c33c1['id'],'MailQueueId':_0x8edf7b['id']});});});});});}})['then'](respondWithStatusCode(_0x2bbbe0,null))[_0x4be8('0x26')](handleError(_0x2bbbe0,null));};exports['removeTeams']=function(_0x1b8496,_0x3e4631){return db[_0x4be8('0x54')][_0x4be8('0x49')]({'where':{'id':_0x1b8496[_0x4be8('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4be8('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e4631,null))['then'](function(_0x16432e){var _0x26e61b=_[_0x4be8('0x1f')](_0x16432e,'id');var _0x337219=[];var _0x4619ff=[];var _0x11f97a=squel[_0x4be8('0x60')]();_0x11f97a[_0x4be8('0x61')](_0x4be8('0x62'))['from']('team_has_mail_queues','tq')[_0x4be8('0x63')]('user_has_teams','ut',_0x4be8('0x64'))[_0x4be8('0x46')]('MailQueueId\x20=\x20?',_0x1b8496[_0x4be8('0x41')]['id']);for(var _0x1ca488=0x0;_0x1ca488<_0x16432e[_0x4be8('0x2f')];_0x1ca488+=0x1){let _0x26b264=_0x16432e[_0x1ca488];for(var _0x25a767=0x0;_0x25a767<_0x26b264[_0x4be8('0x57')]['length'];_0x25a767+=0x1){let _0x4d00ae=_0x26b264[_0x4be8('0x57')][_0x25a767];var _0x1c903f=_0x11f97a[_0x4be8('0x65')]();_0x1c903f[_0x4be8('0x46')]('ut.UserId\x20=\x20?',_0x4d00ae['id']);_0x4619ff[_0x4be8('0x66')](db[_0x4be8('0x67')][_0x4be8('0x25')](_0x1c903f['toString'](),{'type':db[_0x4be8('0x67')][_0x4be8('0x68')][_0x4be8('0x69')]})[_0x4be8('0x18')](function(_0x88c8a9){if(_0x88c8a9[_0x4be8('0x2f')]===0x1){return _0x4d00ae['id'];}else{var _0x3de192=_[_0x4be8('0x6a')](_[_0x4be8('0x1f')](_0x88c8a9,_0x4be8('0x6b')),function(_0x21817e){return _[_0x4be8('0x6c')](_0x26e61b,_0x21817e);});if(_0x3de192){return _0x4d00ae['id'];}}}));}}return BPromise[_0x4be8('0x6d')](_0x4619ff)[_0x4be8('0x18')](function(_0x5b3d6c){_0x337219=_(_0x337219)[_0x4be8('0x6e')](_0x5b3d6c)[_0x4be8('0x6f')]()[_0x4be8('0x70')]();return db['MailQueue'][_0x4be8('0x33')]({'where':{'id':_0x1b8496[_0x4be8('0x41')]['id']}})['then'](function(_0x10ccd7){return db[_0x4be8('0x67')][_0x4be8('0x5b')](function(_0x531492){return _0x10ccd7[_0x4be8('0x71')](_0x1b8496['query']['ids'],{'transaction':_0x531492})[_0x4be8('0x18')](function(){if(!_[_0x4be8('0x72')](_0x337219)){return _0x10ccd7[_0x4be8('0x73')](_0x337219,{'transaction':_0x531492});}})[_0x4be8('0x18')](function(){_0x337219['forEach'](function(_0x4b7d0a){socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':_0x4b7d0a,'MailQueueId':_0x10ccd7['id']});});});});});});})['then'](respondWithStatusCode(_0x3e4631,null))['catch'](handleError(_0x3e4631,null));};exports[_0x4be8('0x75')]=function(_0x21e2b7,_0x55ce26){return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x21e2b7['params']['id']}})['then'](handleEntityNotFound(_0x55ce26,null))[_0x4be8('0x18')](function(_0xfc7d94){if(_0xfc7d94){return _0xfc7d94[_0x4be8('0x75')](_0x21e2b7[_0x4be8('0x3c')][_0x4be8('0x56')],_[_0x4be8('0x76')](_0x21e2b7[_0x4be8('0x3c')],['ids','id'])||{})[_0x4be8('0x77')](function(_0x59d6ec){for(var _0x58d790=0x0;_0x58d790<_0x21e2b7['body'][_0x4be8('0x56')]['length'];_0x58d790+=0x1){socket[_0x4be8('0x5e')](_0x4be8('0x5f'),{'UserId':Number(_0x21e2b7['body'][_0x4be8('0x56')][_0x58d790]),'MailQueueId':Number(_0x21e2b7['params']['id'])});}return _0x59d6ec;});}})['then'](respondWithResult(_0x55ce26,null))['catch'](handleError(_0x55ce26,null));};exports[_0x4be8('0x73')]=function(_0x3618a6,_0x54de29){return db['MailQueue']['find']({'where':{'id':_0x3618a6[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x54de29,null))['then'](function(_0x61ca6c){if(_0x61ca6c){return _0x61ca6c[_0x4be8('0x73')](_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')])[_0x4be8('0x18')](function(){if(_['isArray'](_0x3618a6['query'][_0x4be8('0x56')])){for(var _0x5c9e7b=0x0;_0x5c9e7b<_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')][_0x4be8('0x2f')];_0x5c9e7b+=0x1){socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':Number(_0x3618a6['query'][_0x4be8('0x56')][_0x5c9e7b]),'MailQueueId':Number(_0x3618a6['params']['id'])});}}else{socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':Number(_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')]),'MailQueueId':Number(_0x3618a6[_0x4be8('0x41')]['id'])});}});}})[_0x4be8('0x18')](respondWithStatusCode(_0x54de29,null))[_0x4be8('0x26')](handleError(_0x54de29,null));};exports[_0x4be8('0x78')]=function(_0x3b17a1,_0x26918b){var _0x2a107c={};var _0x369c83={};var _0xd13677;var _0x2f2665;return db[_0x4be8('0x20')]['findOne']({'where':{'id':_0x3b17a1[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x26918b,null))['then'](function(_0x4fccc9){if(_0x4fccc9){_0xd13677=_0x4fccc9;_0x369c83['model']=_[_0x4be8('0x29')](db[_0x4be8('0x4a')]['rawAttributes']);_0x369c83[_0x4be8('0x25')]=_['keys'](_0x3b17a1[_0x4be8('0x25')]);_0x369c83[_0x4be8('0x2b')]=_[_0x4be8('0x2c')](_0x369c83['model'],_0x369c83['query']);_0x2a107c[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x369c83[_0x4be8('0x28')],qs['fields'](_0x3b17a1['query'][_0x4be8('0x2d')]));_0x2a107c['attributes']=_0x2a107c[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x2a107c[_0x4be8('0x2e')]:_0x369c83[_0x4be8('0x28')];_0x2a107c[_0x4be8('0x44')]=qs['sort'](_0x3b17a1['query'][_0x4be8('0x45')]);_0x2a107c[_0x4be8('0x46')]=qs[_0x4be8('0x2b')](_[_0x4be8('0x47')](_0x3b17a1['query'],_0x369c83[_0x4be8('0x2b')]));if(_0x3b17a1[_0x4be8('0x25')]['filter']){_0x2a107c['where']=_[_0x4be8('0x31')](_0x2a107c['where'],{'$or':_[_0x4be8('0x1f')](_0x2a107c[_0x4be8('0x2e')],function(_0x3fffa7){var _0x2ccfcd={};_0x2ccfcd[_0x3fffa7]={'$like':'%'+_0x3b17a1['query'][_0x4be8('0x48')]+'%'};return _0x2ccfcd;})});}_0x2a107c=_['merge']({},_0x2a107c,_0x3b17a1[_0x4be8('0x32')]);return _0xd13677[_0x4be8('0x78')](_0x2a107c);}})[_0x4be8('0x18')](function(_0x51f446){if(_0x51f446){_0x2f2665=_0x51f446[_0x4be8('0x2f')];if(!_0x3b17a1['query'][_0x4be8('0x43')](_0x4be8('0x79'))){_0x2a107c[_0x4be8('0x14')]=qs[_0x4be8('0x14')](_0x3b17a1['query'][_0x4be8('0x14')]);_0x2a107c['offset']=qs['offset'](_0x3b17a1[_0x4be8('0x25')][_0x4be8('0x12')]);}return _0xd13677[_0x4be8('0x78')](_0x2a107c);}})[_0x4be8('0x18')](function(_0x55f1a4){if(_0x55f1a4){return _0x55f1a4?{'count':_0x2f2665,'rows':_0x55f1a4}:null;}})[_0x4be8('0x18')](respondWithResult(_0x26918b,null))['catch'](handleError(_0x26918b,null));}; \ No newline at end of file +var _0xb438=['undefined','limit','count','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','where','MailQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','body','user','get','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','merge','findAndCountAll','UserId','agent','mailPause','format','SIP','createdAt','updatedAt','getTeams','Team','order','addTeams','ids','User','interface','Agents','sequelize','transaction','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','status','end','json','offset'];(function(_0x4980e3,_0x50746c){var _0x469ab9=function(_0xd25a01){while(--_0xd25a01){_0x4980e3['push'](_0x4980e3['shift']());}};_0x469ab9(++_0x50746c);}(_0xb438,0x67));var _0x8b43=function(_0x284bc2,_0x1277ef){_0x284bc2=_0x284bc2-0x0;var _0x481b13=_0xb438[_0x284bc2];return _0x481b13;};'use strict';var BPromise=require(_0x8b43('0x0'));var util=require(_0x8b43('0x1'));var _=require(_0x8b43('0x2'));var squel=require(_0x8b43('0x3'));var Redis=require(_0x8b43('0x4'));var qs=require(_0x8b43('0x5'));var logger=require(_0x8b43('0x6'))(_0x8b43('0x7'));var config=require(_0x8b43('0x8'));var db=require(_0x8b43('0x9'))['db'];config[_0x8b43('0xa')]=_[_0x8b43('0xb')](config[_0x8b43('0xa')],{'host':_0x8b43('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b43('0xa')]));require(_0x8b43('0xd'))[_0x8b43('0xe')](socket);function respondWithStatusCode(_0xd666f0,_0x1dc86e){_0x1dc86e=_0x1dc86e||0xcc;return function(_0xd3c25d){if(_0xd3c25d){return _0xd666f0['sendStatus'](_0x1dc86e);}return _0xd666f0[_0x8b43('0xf')](_0x1dc86e)[_0x8b43('0x10')]();};}function respondWithResult(_0x46ff0d,_0x553e7a){_0x553e7a=_0x553e7a||0xc8;return function(_0x357f60){if(_0x357f60){return _0x46ff0d['status'](_0x553e7a)[_0x8b43('0x11')](_0x357f60);}};}function respondWithFilteredResult(_0x348f9c,_0x354d70){return function(_0x48d507){if(_0x48d507){var _0x30e6c1=typeof _0x354d70[_0x8b43('0x12')]===_0x8b43('0x13')&&typeof _0x354d70[_0x8b43('0x14')]==='undefined';var _0x1dd2a2=_0x48d507[_0x8b43('0x15')];var _0x19c4e4=_0x30e6c1?0x0:_0x354d70['offset'];var _0x424e0=_0x30e6c1?_0x48d507[_0x8b43('0x15')]:_0x354d70[_0x8b43('0x12')]+_0x354d70[_0x8b43('0x14')];var _0x159a67;if(_0x424e0>=_0x1dd2a2){_0x424e0=_0x1dd2a2;_0x159a67=0xc8;}else{_0x159a67=0xce;}_0x348f9c[_0x8b43('0xf')](_0x159a67);return _0x348f9c[_0x8b43('0x16')](_0x8b43('0x17'),_0x19c4e4+'-'+_0x424e0+'/'+_0x1dd2a2)[_0x8b43('0x11')](_0x48d507);}return null;};}function saveUpdates(_0x40bc6b){return function(_0x9771c0){if(_0x9771c0){return _0x9771c0[_0x8b43('0x18')](_0x40bc6b)[_0x8b43('0x19')](function(_0x5882f6){return _0x5882f6;});}return null;};}function removeEntity(_0x5dfcfa){return function(_0x330e51){if(_0x330e51){return _0x330e51[_0x8b43('0x1a')]()[_0x8b43('0x19')](function(){var _0x23f11d=_0x330e51['get']({'plain':!![]});var _0x308912=_0x8b43('0x1b');return db[_0x8b43('0x1c')][_0x8b43('0x1a')]({'where':{'type':_0x308912,'resourceId':_0x23f11d['id']}})[_0x8b43('0x19')](function(){return _0x330e51;});})[_0x8b43('0x19')](function(){_0x5dfcfa[_0x8b43('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23b7db){return function(_0xfe6282){if(!_0xfe6282){_0x23b7db[_0x8b43('0x1d')](0x194);}return _0xfe6282;};}function handleError(_0x17b66e,_0x482087){_0x482087=_0x482087||0x1f4;return function(_0x109aaf){logger['error'](_0x109aaf[_0x8b43('0x1e')]);if(_0x109aaf[_0x8b43('0x1f')]){delete _0x109aaf[_0x8b43('0x1f')];}_0x17b66e[_0x8b43('0xf')](_0x482087)[_0x8b43('0x20')](_0x109aaf);};}exports[_0x8b43('0x21')]=function(_0x130383,_0x369b5d){var _0x3b3ef1={};var _0x480ca2={'count':0x0,'rows':[]};var _0x1a0d16=_[_0x8b43('0x22')](db['MailQueue'][_0x8b43('0x23')],function(_0x3fce9c){return{'name':_0x3fce9c['fieldName'],'type':_0x3fce9c[_0x8b43('0x24')][_0x8b43('0x25')]};});_0x3b3ef1=qs['getOptions'](_0x1a0d16,_0x130383);var _0x481e40={'where':_0x3b3ef1[_0x8b43('0x26')]};return db[_0x8b43('0x27')][_0x8b43('0x15')](_0x481e40)[_0x8b43('0x19')](function(_0x1cb9ad){_0x480ca2['count']=_0x1cb9ad;_0x3b3ef1[_0x8b43('0x28')]=qs[_0x8b43('0x28')](_0x130383[_0x8b43('0x29')]);return db[_0x8b43('0x27')][_0x8b43('0x2a')](_0x3b3ef1);})[_0x8b43('0x19')](function(_0x15ab05){_0x480ca2[_0x8b43('0x2b')]=_0x15ab05;return _0x480ca2;})[_0x8b43('0x19')](respondWithFilteredResult(_0x369b5d,_0x3b3ef1))[_0x8b43('0x2c')](handleError(_0x369b5d,null));};exports[_0x8b43('0x2d')]=function(_0x4663ab,_0x33d5c1){var _0x31ad55={'raw':!![],'where':{'id':_0x4663ab[_0x8b43('0x2e')]['id']}},_0x28e21a={};_0x28e21a[_0x8b43('0x2f')]=_[_0x8b43('0x30')](db['MailQueue']['rawAttributes']);_0x28e21a[_0x8b43('0x29')]=_['keys'](_0x4663ab[_0x8b43('0x29')]);_0x28e21a[_0x8b43('0x31')]=_[_0x8b43('0x32')](_0x28e21a[_0x8b43('0x2f')],_0x28e21a[_0x8b43('0x29')]);_0x31ad55[_0x8b43('0x33')]=_[_0x8b43('0x32')](_0x28e21a[_0x8b43('0x2f')],qs['fields'](_0x4663ab[_0x8b43('0x29')][_0x8b43('0x34')]));_0x31ad55[_0x8b43('0x33')]=_0x31ad55[_0x8b43('0x33')][_0x8b43('0x35')]?_0x31ad55[_0x8b43('0x33')]:_0x28e21a['model'];if(_0x4663ab[_0x8b43('0x29')][_0x8b43('0x36')]){_0x31ad55[_0x8b43('0x28')]=[{'all':!![]}];}_0x31ad55=_['merge']({},_0x31ad55,_0x4663ab[_0x8b43('0x37')]);return db[_0x8b43('0x27')]['find'](_0x31ad55)[_0x8b43('0x19')](handleEntityNotFound(_0x33d5c1,null))[_0x8b43('0x19')](respondWithResult(_0x33d5c1,null))['catch'](handleError(_0x33d5c1,null));};exports[_0x8b43('0x38')]=function(_0x39f64f,_0x7f10c){return db[_0x8b43('0x27')][_0x8b43('0x38')](_0x39f64f[_0x8b43('0x39')],{})[_0x8b43('0x19')](function(_0x54601d){var _0x1b84c5=_0x39f64f[_0x8b43('0x3a')][_0x8b43('0x3b')]({'plain':!![]});if(!_0x1b84c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b84c5['role']===_0x8b43('0x3a')){var _0x1eb9d0=_0x54601d[_0x8b43('0x3b')]({'plain':!![]});var _0x55049a=_0x8b43('0x1b');return db[_0x8b43('0x3c')][_0x8b43('0x3d')]({'where':{'name':_0x55049a,'userProfileId':_0x1b84c5['userProfileId']},'raw':!![]})[_0x8b43('0x19')](function(_0x143f36){if(_0x143f36&&_0x143f36[_0x8b43('0x3e')]===0x0){return db[_0x8b43('0x1c')][_0x8b43('0x38')]({'name':_0x1eb9d0[_0x8b43('0x1f')],'resourceId':_0x1eb9d0['id'],'type':_0x143f36['name'],'sectionId':_0x143f36['id']},{})[_0x8b43('0x19')](function(){return _0x54601d;});}else{return _0x54601d;}})[_0x8b43('0x2c')](function(_0x23aed7){logger[_0x8b43('0x3f')](_0x8b43('0x40'),_0x23aed7);throw _0x23aed7;});}return _0x54601d;})[_0x8b43('0x19')](respondWithResult(_0x7f10c,0xc9))[_0x8b43('0x2c')](handleError(_0x7f10c,null));};exports[_0x8b43('0x18')]=function(_0x2930ea,_0x4fc3eb){if(_0x2930ea[_0x8b43('0x39')]['id']){delete _0x2930ea[_0x8b43('0x39')]['id'];}return db[_0x8b43('0x27')]['find']({'where':{'id':_0x2930ea[_0x8b43('0x2e')]['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x4fc3eb,null))[_0x8b43('0x19')](saveUpdates(_0x2930ea[_0x8b43('0x39')],null))[_0x8b43('0x19')](respondWithResult(_0x4fc3eb,null))[_0x8b43('0x2c')](handleError(_0x4fc3eb,null));};exports[_0x8b43('0x1a')]=function(_0x1bc917,_0x5a5895){return db[_0x8b43('0x27')][_0x8b43('0x3d')]({'where':{'id':_0x1bc917[_0x8b43('0x2e')]['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x5a5895,null))[_0x8b43('0x19')](removeEntity(_0x5a5895,null))[_0x8b43('0x2c')](handleError(_0x5a5895,null));};exports[_0x8b43('0x41')]=function(_0x1e0834,_0x904e3f){return db[_0x8b43('0x27')]['describe']()[_0x8b43('0x19')](respondWithResult(_0x904e3f,null))[_0x8b43('0x2c')](handleError(_0x904e3f,null));};exports[_0x8b43('0x42')]=function(_0x28ea50,_0x4d9348){var _0x501afd={'raw':!![],'where':{}},_0x5647e5={},_0x4c2876;return db[_0x8b43('0x27')]['findOne']({'where':{'id':_0x28ea50['params']['id']}})['then'](handleEntityNotFound(_0x4d9348,null))[_0x8b43('0x19')](function(_0x2f07b){if(_0x2f07b){_0x4c2876=_0x2f07b[_0x8b43('0x3b')]({'plain':!![]});_0x5647e5['model']=_['keys'](db[_0x8b43('0x43')][_0x8b43('0x23')]);_0x5647e5[_0x8b43('0x29')]=_[_0x8b43('0x30')](_0x28ea50['query']);_0x5647e5['filters']=_['intersection'](_0x5647e5[_0x8b43('0x2f')],_0x5647e5[_0x8b43('0x29')]);_0x501afd['attributes']=_[_0x8b43('0x32')](_0x5647e5[_0x8b43('0x2f')],qs['fields'](_0x28ea50[_0x8b43('0x29')][_0x8b43('0x34')]));_0x501afd['attributes']=_0x501afd[_0x8b43('0x33')][_0x8b43('0x35')]?_0x501afd['attributes']:_0x5647e5[_0x8b43('0x2f')];if(!_0x28ea50[_0x8b43('0x29')][_0x8b43('0x44')](_0x8b43('0x45'))){_0x501afd[_0x8b43('0x14')]=qs['limit'](_0x28ea50[_0x8b43('0x29')]['limit']);_0x501afd['offset']=qs['offset'](_0x28ea50['query'][_0x8b43('0x12')]);}_0x501afd['order']=qs[_0x8b43('0x46')](_0x28ea50[_0x8b43('0x29')][_0x8b43('0x46')]);_0x501afd['where']=qs['filters'](_[_0x8b43('0x47')](_0x28ea50['query'],_0x5647e5[_0x8b43('0x31')]));_0x501afd[_0x8b43('0x26')][_0x8b43('0x48')]=_0x2f07b['id'];if(_0x28ea50['query'][_0x8b43('0x49')]){_0x501afd[_0x8b43('0x26')]=_['merge'](_0x501afd['where'],{'$or':_['map'](_0x501afd[_0x8b43('0x33')],function(_0x373a09){var _0x2655c3={};_0x2655c3[_0x373a09]={'$like':'%'+_0x28ea50['query'][_0x8b43('0x49')]+'%'};return _0x2655c3;})});}_0x501afd=_[_0x8b43('0x4a')]({},_0x501afd,_0x28ea50['options']);return db[_0x8b43('0x43')][_0x8b43('0x2a')](_0x501afd);}})['then'](function(_0x22704c){if(_0x22704c){return db['User'][_0x8b43('0x4b')]({'where':{'id':_[_0x8b43('0x22')](_0x22704c,_0x8b43('0x4c')),'role':_0x8b43('0x4d')},'attributes':['id',_0x8b43('0x1f'),_0x8b43('0x4e'),'updatedAt','createdAt']});}})[_0x8b43('0x19')](function(_0xd2fc79){if(_0xd2fc79){return{'count':_0xd2fc79[_0x8b43('0x15')],'rows':_[_0x8b43('0x22')](_0xd2fc79[_0x8b43('0x2b')],function(_0x2affe7){return{'membername':_0x2affe7['name'],'UserId':_0x2affe7['id'],'queue_name':_0x4c2876[_0x8b43('0x1f')],'MailQueueId':_0x4c2876['id'],'interface':util[_0x8b43('0x4f')]('%s/%s',_0x8b43('0x50'),_0x2affe7[_0x8b43('0x1f')]),'penalty':0x0,'paused':_0x2affe7[_0x8b43('0x4e')],'createdAt':_0x2affe7[_0x8b43('0x51')],'updatedAt':_0x2affe7[_0x8b43('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d9348,_0x501afd))[_0x8b43('0x2c')](handleError(_0x4d9348,null));};exports[_0x8b43('0x53')]=function(_0x4af7f9,_0x5dafde){var _0x59c7f8={};var _0x44edd6={};var _0x1871b2;var _0xcd18b7;return db[_0x8b43('0x27')]['findOne']({'where':{'id':_0x4af7f9[_0x8b43('0x2e')]['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x5dafde,null))[_0x8b43('0x19')](function(_0x50171b){if(_0x50171b){_0x1871b2=_0x50171b;_0x44edd6[_0x8b43('0x2f')]=_['keys'](db[_0x8b43('0x54')][_0x8b43('0x23')]);_0x44edd6[_0x8b43('0x29')]=_['keys'](_0x4af7f9['query']);_0x44edd6[_0x8b43('0x31')]=_[_0x8b43('0x32')](_0x44edd6[_0x8b43('0x2f')],_0x44edd6[_0x8b43('0x29')]);_0x59c7f8[_0x8b43('0x33')]=_[_0x8b43('0x32')](_0x44edd6['model'],qs[_0x8b43('0x34')](_0x4af7f9[_0x8b43('0x29')][_0x8b43('0x34')]));_0x59c7f8[_0x8b43('0x33')]=_0x59c7f8['attributes'][_0x8b43('0x35')]?_0x59c7f8[_0x8b43('0x33')]:_0x44edd6['model'];_0x59c7f8[_0x8b43('0x55')]=qs[_0x8b43('0x46')](_0x4af7f9[_0x8b43('0x29')]['sort']);_0x59c7f8['where']=qs[_0x8b43('0x31')](_[_0x8b43('0x47')](_0x4af7f9[_0x8b43('0x29')],_0x44edd6['filters']));if(_0x4af7f9[_0x8b43('0x29')][_0x8b43('0x49')]){_0x59c7f8['where']=_['merge'](_0x59c7f8[_0x8b43('0x26')],{'$or':_['map'](_0x59c7f8[_0x8b43('0x33')],function(_0x36a136){var _0xcb28f9={};_0xcb28f9[_0x36a136]={'$like':'%'+_0x4af7f9['query'][_0x8b43('0x49')]+'%'};return _0xcb28f9;})});}_0x59c7f8=_['merge']({},_0x59c7f8,_0x4af7f9[_0x8b43('0x37')]);return _0x1871b2[_0x8b43('0x53')](_0x59c7f8);}})[_0x8b43('0x19')](function(_0x33870e){if(_0x33870e){_0xcd18b7=_0x33870e[_0x8b43('0x35')];if(!_0x4af7f9[_0x8b43('0x29')][_0x8b43('0x44')](_0x8b43('0x45'))){_0x59c7f8[_0x8b43('0x14')]=qs[_0x8b43('0x14')](_0x4af7f9[_0x8b43('0x29')][_0x8b43('0x14')]);_0x59c7f8[_0x8b43('0x12')]=qs[_0x8b43('0x12')](_0x4af7f9[_0x8b43('0x29')]['offset']);}return _0x1871b2['getTeams'](_0x59c7f8);}})[_0x8b43('0x19')](function(_0x5078f4){if(_0x5078f4){return _0x5078f4?{'count':_0xcd18b7,'rows':_0x5078f4}:null;}})[_0x8b43('0x19')](respondWithResult(_0x5dafde,null))[_0x8b43('0x2c')](handleError(_0x5dafde,null));};exports[_0x8b43('0x56')]=function(_0x1d3044,_0x25d664){var _0x30441c=_0x1d3044[_0x8b43('0x39')][_0x8b43('0x57')];return db[_0x8b43('0x54')][_0x8b43('0x2a')]({'where':{'id':_0x30441c},'attributes':['id'],'include':[{'model':db[_0x8b43('0x58')],'as':'Agents','attributes':['id',_0x8b43('0x1f'),'online','voicePause',_0x8b43('0x59')],'raw':!![]}]})[_0x8b43('0x19')](function(_0x1e6fed){if(_0x1e6fed){var _0x133c6d=_['flatMap'](_0x1e6fed,function(_0x4cf668){var _0x4d923c=_0x4cf668['get']({'plain':!![]});return _0x4d923c[_0x8b43('0x5a')];});return db[_0x8b43('0x27')][_0x8b43('0x3d')]({'where':{'id':_0x1d3044[_0x8b43('0x2e')]['id']}})['then'](function(_0x47e770){return db[_0x8b43('0x5b')][_0x8b43('0x5c')](function(_0x327671){return _0x47e770[_0x8b43('0x56')](_0x30441c,{'transaction':_0x327671})[_0x8b43('0x19')](function(){return BPromise['each'](_0x133c6d,function(_0x527802){return db[_0x8b43('0x43')][_0x8b43('0x5d')]({'where':{'UserId':_0x527802['id'],'MailQueueId':_0x1d3044['params']['id']},'transaction':_0x327671});});})[_0x8b43('0x19')](function(){_0x133c6d[_0x8b43('0x5e')](function(_0x69d973){socket['emit'](_0x8b43('0x5f'),{'UserId':_0x69d973['id'],'MailQueueId':_0x47e770['id']});});});});});}})['then'](respondWithStatusCode(_0x25d664,null))[_0x8b43('0x2c')](handleError(_0x25d664,null));};exports[_0x8b43('0x60')]=function(_0x331f02,_0x102376){return db[_0x8b43('0x54')]['findAll']({'where':{'id':_0x331f02[_0x8b43('0x29')][_0x8b43('0x57')]},'attributes':['id'],'include':[{'model':db[_0x8b43('0x58')],'as':_0x8b43('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x102376,null))['then'](function(_0x3578bd){var _0x153488=_[_0x8b43('0x22')](_0x3578bd,'id');var _0x3bf14c=[];var _0x52d484=[];var _0x48a07c=squel[_0x8b43('0x61')]();_0x48a07c[_0x8b43('0x62')]('tq.TeamId')[_0x8b43('0x63')](_0x8b43('0x64'),'tq')[_0x8b43('0x65')](_0x8b43('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8b43('0x26')]('MailQueueId\x20=\x20?',_0x331f02[_0x8b43('0x2e')]['id']);for(var _0x20c4de=0x0;_0x20c4de<_0x3578bd['length'];_0x20c4de+=0x1){let _0xa1b1c1=_0x3578bd[_0x20c4de];for(var _0x28ec5=0x0;_0x28ec5<_0xa1b1c1['Agents'][_0x8b43('0x35')];_0x28ec5+=0x1){let _0x5a5151=_0xa1b1c1[_0x8b43('0x5a')][_0x28ec5];var _0x5334a7=_0x48a07c[_0x8b43('0x67')]();_0x5334a7[_0x8b43('0x26')]('ut.UserId\x20=\x20?',_0x5a5151['id']);_0x52d484[_0x8b43('0x68')](db['sequelize'][_0x8b43('0x29')](_0x5334a7[_0x8b43('0x69')](),{'type':db[_0x8b43('0x5b')][_0x8b43('0x6a')][_0x8b43('0x6b')]})[_0x8b43('0x19')](function(_0x52d738){if(_0x52d738[_0x8b43('0x35')]===0x1){return _0x5a5151['id'];}else{var _0x2f87d5=_[_0x8b43('0x6c')](_[_0x8b43('0x22')](_0x52d738,_0x8b43('0x6d')),function(_0x2cf60d){return _[_0x8b43('0x6e')](_0x153488,_0x2cf60d);});if(_0x2f87d5){return _0x5a5151['id'];}}}));}}return BPromise[_0x8b43('0x6f')](_0x52d484)[_0x8b43('0x19')](function(_0x22b1fb){_0x3bf14c=_(_0x3bf14c)['union'](_0x22b1fb)['compact']()[_0x8b43('0x70')]();return db[_0x8b43('0x27')][_0x8b43('0x3d')]({'where':{'id':_0x331f02['params']['id']}})[_0x8b43('0x19')](function(_0x2b4e99){return db[_0x8b43('0x5b')][_0x8b43('0x5c')](function(_0x2fc78a){return _0x2b4e99['removeTeams'](_0x331f02[_0x8b43('0x29')][_0x8b43('0x57')],{'transaction':_0x2fc78a})['then'](function(){if(!_['isEmpty'](_0x3bf14c)){return _0x2b4e99[_0x8b43('0x71')](_0x3bf14c,{'transaction':_0x2fc78a});}})[_0x8b43('0x19')](function(){_0x3bf14c['forEach'](function(_0x2004be){socket[_0x8b43('0x72')](_0x8b43('0x73'),{'UserId':_0x2004be,'MailQueueId':_0x2b4e99['id']});});});});});});})[_0x8b43('0x19')](respondWithStatusCode(_0x102376,null))[_0x8b43('0x2c')](handleError(_0x102376,null));};exports[_0x8b43('0x74')]=function(_0x424287,_0x333f7c){return db['MailQueue'][_0x8b43('0x3d')]({'where':{'id':_0x424287[_0x8b43('0x2e')]['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x333f7c,null))[_0x8b43('0x19')](function(_0x30c81a){if(_0x30c81a){return _0x30c81a[_0x8b43('0x74')](_0x424287[_0x8b43('0x39')][_0x8b43('0x57')],_[_0x8b43('0x75')](_0x424287[_0x8b43('0x39')],[_0x8b43('0x57'),'id'])||{})[_0x8b43('0x76')](function(_0x43abdd){for(var _0x3f51ca=0x0;_0x3f51ca<_0x424287[_0x8b43('0x39')]['ids'][_0x8b43('0x35')];_0x3f51ca+=0x1){socket['emit'](_0x8b43('0x5f'),{'UserId':Number(_0x424287[_0x8b43('0x39')][_0x8b43('0x57')][_0x3f51ca]),'MailQueueId':Number(_0x424287[_0x8b43('0x2e')]['id'])});}return _0x43abdd;});}})['then'](respondWithResult(_0x333f7c,null))[_0x8b43('0x2c')](handleError(_0x333f7c,null));};exports[_0x8b43('0x71')]=function(_0x49d035,_0x5c443a){return db[_0x8b43('0x27')][_0x8b43('0x3d')]({'where':{'id':_0x49d035[_0x8b43('0x2e')]['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x5c443a,null))[_0x8b43('0x19')](function(_0x5aaed1){if(_0x5aaed1){return _0x5aaed1[_0x8b43('0x71')](_0x49d035['query'][_0x8b43('0x57')])['then'](function(){if(_[_0x8b43('0x77')](_0x49d035[_0x8b43('0x29')]['ids'])){for(var _0x46548c=0x0;_0x46548c<_0x49d035[_0x8b43('0x29')]['ids'][_0x8b43('0x35')];_0x46548c+=0x1){socket[_0x8b43('0x72')](_0x8b43('0x73'),{'UserId':Number(_0x49d035[_0x8b43('0x29')][_0x8b43('0x57')][_0x46548c]),'MailQueueId':Number(_0x49d035['params']['id'])});}}else{socket[_0x8b43('0x72')](_0x8b43('0x73'),{'UserId':Number(_0x49d035[_0x8b43('0x29')][_0x8b43('0x57')]),'MailQueueId':Number(_0x49d035['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5c443a,null))['catch'](handleError(_0x5c443a,null));};exports[_0x8b43('0x78')]=function(_0x51eff6,_0x2272b9){var _0x19a341={};var _0x4bfb38={};var _0x33d96f;var _0x5e51b9;return db[_0x8b43('0x27')][_0x8b43('0x79')]({'where':{'id':_0x51eff6['params']['id']}})[_0x8b43('0x19')](handleEntityNotFound(_0x2272b9,null))['then'](function(_0x1aaf2f){if(_0x1aaf2f){_0x33d96f=_0x1aaf2f;_0x4bfb38[_0x8b43('0x2f')]=_[_0x8b43('0x30')](db[_0x8b43('0x58')][_0x8b43('0x23')]);_0x4bfb38[_0x8b43('0x29')]=_[_0x8b43('0x30')](_0x51eff6[_0x8b43('0x29')]);_0x4bfb38[_0x8b43('0x31')]=_[_0x8b43('0x32')](_0x4bfb38['model'],_0x4bfb38[_0x8b43('0x29')]);_0x19a341['attributes']=_[_0x8b43('0x32')](_0x4bfb38[_0x8b43('0x2f')],qs['fields'](_0x51eff6[_0x8b43('0x29')]['fields']));_0x19a341[_0x8b43('0x33')]=_0x19a341[_0x8b43('0x33')][_0x8b43('0x35')]?_0x19a341[_0x8b43('0x33')]:_0x4bfb38[_0x8b43('0x2f')];_0x19a341['order']=qs['sort'](_0x51eff6['query']['sort']);_0x19a341[_0x8b43('0x26')]=qs[_0x8b43('0x31')](_['pick'](_0x51eff6['query'],_0x4bfb38[_0x8b43('0x31')]));if(_0x51eff6[_0x8b43('0x29')][_0x8b43('0x49')]){_0x19a341['where']=_[_0x8b43('0x4a')](_0x19a341['where'],{'$or':_[_0x8b43('0x22')](_0x19a341[_0x8b43('0x33')],function(_0x52249c){var _0x205754={};_0x205754[_0x52249c]={'$like':'%'+_0x51eff6[_0x8b43('0x29')]['filter']+'%'};return _0x205754;})});}_0x19a341=_['merge']({},_0x19a341,_0x51eff6[_0x8b43('0x37')]);return _0x33d96f[_0x8b43('0x78')](_0x19a341);}})[_0x8b43('0x19')](function(_0x271960){if(_0x271960){_0x5e51b9=_0x271960['length'];if(!_0x51eff6[_0x8b43('0x29')][_0x8b43('0x44')](_0x8b43('0x45'))){_0x19a341[_0x8b43('0x14')]=qs[_0x8b43('0x14')](_0x51eff6['query'][_0x8b43('0x14')]);_0x19a341[_0x8b43('0x12')]=qs[_0x8b43('0x12')](_0x51eff6[_0x8b43('0x29')][_0x8b43('0x12')]);}return _0x33d96f[_0x8b43('0x78')](_0x19a341);}})['then'](function(_0xe00492){if(_0xe00492){return _0xe00492?{'count':_0x5e51b9,'rows':_0xe00492}:null;}})[_0x8b43('0x19')](respondWithResult(_0x2272b9,null))['catch'](handleError(_0x2272b9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2486531..5030b5e 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 _0x3b71=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5a73ba,_0x35469b){var _0x7c54ad=function(_0x3146c4){while(--_0x3146c4){_0x5a73ba['push'](_0x5a73ba['shift']());}};_0x7c54ad(++_0x35469b);}(_0x3b71,0x148));var _0x13b7=function(_0x3f4f29,_0x4372a7){_0x3f4f29=_0x3f4f29-0x0;var _0x5ba522=_0x3b71[_0x3f4f29];return _0x5ba522;};'use strict';var EventEmitter=require(_0x13b7('0x0'));var MailQueue=require(_0x13b7('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x13b7('0x2')](0x0);var events={'afterCreate':_0x13b7('0x3'),'afterUpdate':_0x13b7('0x4'),'afterDestroy':_0x13b7('0x5')};function emitEvent(_0x344f20){return function(_0x4c9640,_0x54acce,_0x1398db){MailQueueEvents[_0x13b7('0x6')](_0x344f20+':'+_0x4c9640['id'],_0x4c9640);MailQueueEvents[_0x13b7('0x6')](_0x344f20,_0x4c9640);_0x1398db(null);};}for(var e in events){if(events[_0x13b7('0x7')](e)){var event=events[e];MailQueue[_0x13b7('0x8')](e,emitEvent(event));}}module[_0x13b7('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xb615=['remove','emit','hasOwnProperty','exports','../../mysqldb','update'];(function(_0x16e007,_0x3ac6a9){var _0x546f8b=function(_0x35ba24){while(--_0x35ba24){_0x16e007['push'](_0x16e007['shift']());}};_0x546f8b(++_0x3ac6a9);}(_0xb615,0xe8));var _0x5b61=function(_0x3741aa,_0x438aa9){_0x3741aa=_0x3741aa-0x0;var _0x1807fe=_0xb615[_0x3741aa];return _0x1807fe;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x5b61('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b61('0x1'),'afterDestroy':_0x5b61('0x2')};function emitEvent(_0x1a1cf0){return function(_0x21d22e,_0xfeeabd,_0xd8fe76){MailQueueEvents[_0x5b61('0x3')](_0x1a1cf0+':'+_0x21d22e['id'],_0x21d22e);MailQueueEvents[_0x5b61('0x3')](_0x1a1cf0,_0x21d22e);_0xd8fe76(null);};}for(var e in events){if(events[_0x5b61('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x5b61('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 96528be..8a38ab7 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 _0x98d2=['moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','api'];(function(_0x59d3a1,_0x255155){var _0x587c3=function(_0x548152){while(--_0x548152){_0x59d3a1['push'](_0x59d3a1['shift']());}};_0x587c3(++_0x255155);}(_0x98d2,0x1b6));var _0x298d=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x98d2[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0x298d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x298d('0x1'));var moment=require(_0x298d('0x2'));var BPromise=require('bluebird');var rp=require(_0x298d('0x3'));var fs=require('fs');var path=require(_0x298d('0x4'));var rimraf=require(_0x298d('0x5'));var config=require(_0x298d('0x6'));var attributes=require(_0x298d('0x7'));module['exports']=function(_0x5b2a4b,_0x26a125){return _0x5b2a4b[_0x298d('0x8')](_0x298d('0x9'),attributes,{'tableName':_0x298d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a4=['define','mail_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x2723b8,_0x3d52a0){var _0x4e3fe9=function(_0x1b154a){while(--_0x1b154a){_0x2723b8['push'](_0x2723b8['shift']());}};_0x4e3fe9(++_0x3d52a0);}(_0xf2a4,0xca));var _0x4f2a=function(_0x535ba7,_0x2d9c53){_0x535ba7=_0x535ba7-0x0;var _0x4b8ef5=_0xf2a4[_0x535ba7];return _0x4b8ef5;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var logger=require(_0x4f2a('0x2'))(_0x4f2a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f2a('0x4'));var fs=require('fs');var path=require(_0x4f2a('0x5'));var rimraf=require(_0x4f2a('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x4f2a('0x7')]=function(_0x2a5011,_0x4969d1){return _0x2a5011[_0x4f2a('0x8')]('MailQueue',attributes,{'tableName':_0x4f2a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 80d5657..94f9910 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 _0x4641=['raw','where','include','map','model','attributes','debug','catch','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailQueue','MailQueue','options'];(function(_0x1477ac,_0x86a86d){var _0x4f0441=function(_0x39d618){while(--_0x39d618){_0x1477ac['push'](_0x1477ac['shift']());}};_0x4f0441(++_0x86a86d);}(_0x4641,0x185));var _0x1464=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4641[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x1464('0x0'));var moment=require(_0x1464('0x1'));var BPromise=require(_0x1464('0x2'));var rs=require(_0x1464('0x3'));var fs=require('fs');var Redis=require(_0x1464('0x4'));var db=require(_0x1464('0x5'))['db'];var utils=require(_0x1464('0x6'));var logger=require(_0x1464('0x7'))('rpc');var config=require(_0x1464('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1464('0x9')][_0x1464('0xa')]({'port':0x232a});config[_0x1464('0xb')]=_['defaults'](config[_0x1464('0xb')],{'host':_0x1464('0xc'),'port':0x18eb});var socket=require(_0x1464('0xd'))(new Redis(config[_0x1464('0xb')]));require(_0x1464('0xe'))[_0x1464('0xf')](socket);function respondWithRpcPromise(_0x3fd1f8,_0x59dd42,_0x209018){return new BPromise(function(_0x36b90d,_0x590bd9){return client['request'](_0x3fd1f8,_0x209018)[_0x1464('0x10')](function(_0x6ef4ed){logger[_0x1464('0x11')](_0x1464('0x12'),_0x59dd42,'request\x20sent');logger['debug'](_0x1464('0x13'),_0x59dd42,'request\x20sent',JSON[_0x1464('0x14')](_0x6ef4ed));if(_0x6ef4ed[_0x1464('0x15')]){if(_0x6ef4ed[_0x1464('0x15')][_0x1464('0x16')]===0x1f4){logger[_0x1464('0x15')]('MailQueue,\x20%s,\x20%s',_0x59dd42,_0x6ef4ed[_0x1464('0x15')][_0x1464('0x17')]);return _0x590bd9(_0x6ef4ed['error']['message']);}logger[_0x1464('0x15')](_0x1464('0x12'),_0x59dd42,_0x6ef4ed['error']['message']);return _0x36b90d(_0x6ef4ed[_0x1464('0x15')][_0x1464('0x17')]);}else{logger[_0x1464('0x11')](_0x1464('0x12'),_0x59dd42,_0x1464('0x18'));_0x36b90d(_0x6ef4ed[_0x1464('0x19')][_0x1464('0x17')]);}})['catch'](function(_0x1da829){logger['error']('MailQueue,\x20%s,\x20%s',_0x59dd42,_0x1da829);_0x590bd9(_0x1da829);});});}exports[_0x1464('0x1a')]=function(_0x5e3eed){var _0x127d03=this;return new Promise(function(_0x20cd76,_0x5d88a2){return db[_0x1464('0x1b')]['findAll']({'raw':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')][_0x1464('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed['options'][_0x1464('0x1e')]||null:null,'attributes':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')]['attributes']||null:null,'limit':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')]['limit']||null:null,'include':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')][_0x1464('0x1f')]?_[_0x1464('0x20')](_0x5e3eed['options'][_0x1464('0x1f')],function(_0x2cc0cc){return{'model':db[_0x2cc0cc[_0x1464('0x21')]],'as':_0x2cc0cc['as'],'attributes':_0x2cc0cc[_0x1464('0x22')],'include':_0x2cc0cc[_0x1464('0x1f')]?_[_0x1464('0x20')](_0x2cc0cc['include'],function(_0x131d5d){return{'model':db[_0x131d5d[_0x1464('0x21')]],'as':_0x131d5d['as'],'attributes':_0x131d5d['attributes'],'include':_0x131d5d[_0x1464('0x1f')]?_[_0x1464('0x20')](_0x131d5d['include'],function(_0x5b42c6){return{'model':db[_0x5b42c6[_0x1464('0x21')]],'as':_0x5b42c6['as'],'attributes':_0x5b42c6[_0x1464('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1464('0x10')](function(_0x54cec9){logger[_0x1464('0x11')](_0x1464('0x1a'),_0x5e3eed);logger[_0x1464('0x23')](_0x1464('0x1a'),_0x5e3eed,JSON[_0x1464('0x14')](_0x54cec9));_0x20cd76(_0x54cec9);})[_0x1464('0x24')](function(_0x19d281){logger[_0x1464('0x15')]('GetMailQueue',_0x19d281[_0x1464('0x17')],_0x5e3eed);_0x5d88a2(_0x127d03['error'](0x1f4,_0x19d281[_0x1464('0x17')]));});});};exports[_0x1464('0x25')]=function(_0x458ce5){var _0x524415=this;return new Promise(function(_0x29ce3e,_0x1fc7a5){return db['MailQueue']['find']({'raw':_0x458ce5[_0x1464('0x1c')]?_0x458ce5['options'][_0x1464('0x1d')]===undefined?!![]:![]:!![],'where':_0x458ce5[_0x1464('0x1c')]?_0x458ce5['options']['where']||null:null,'attributes':_0x458ce5[_0x1464('0x1c')]?_0x458ce5[_0x1464('0x1c')][_0x1464('0x22')]||null:null,'include':_0x458ce5[_0x1464('0x1c')]?_0x458ce5[_0x1464('0x1c')]['include']?_[_0x1464('0x20')](_0x458ce5[_0x1464('0x1c')][_0x1464('0x1f')],function(_0x8e44e1){return{'model':db[_0x8e44e1['model']],'as':_0x8e44e1['as'],'attributes':_0x8e44e1[_0x1464('0x22')],'include':_0x8e44e1['include']?_[_0x1464('0x20')](_0x8e44e1[_0x1464('0x1f')],function(_0x1568ac){return{'model':db[_0x1568ac['model']],'as':_0x1568ac['as'],'attributes':_0x1568ac['attributes'],'include':_0x1568ac['include']?_[_0x1464('0x20')](_0x1568ac[_0x1464('0x1f')],function(_0x4269ce){return{'model':db[_0x4269ce[_0x1464('0x21')]],'as':_0x4269ce['as'],'attributes':_0x4269ce[_0x1464('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1464('0x10')](function(_0x34b9a6){logger[_0x1464('0x11')]('ShowMailQueue',_0x458ce5);logger['debug'](_0x1464('0x25'),_0x458ce5,JSON[_0x1464('0x14')](_0x34b9a6));_0x29ce3e(_0x34b9a6);})[_0x1464('0x24')](function(_0x13c411){logger[_0x1464('0x15')](_0x1464('0x25'),_0x13c411[_0x1464('0x17')],_0x458ce5);_0x1fc7a5(_0x524415[_0x1464('0x15')](0x1f4,_0x13c411[_0x1464('0x17')]));});});}; \ No newline at end of file +var _0xd087=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x14aa89,_0x137255){var _0x35dcc0=function(_0x42da44){while(--_0x42da44){_0x14aa89['push'](_0x14aa89['shift']());}};_0x35dcc0(++_0x137255);}(_0xd087,0x1bd));var _0x7d08=function(_0x40b241,_0x2ce6cc){_0x40b241=_0x40b241-0x0;var _0x22b4b1=_0xd087[_0x40b241];return _0x22b4b1;};'use strict';var _=require(_0x7d08('0x0'));var util=require(_0x7d08('0x1'));var moment=require(_0x7d08('0x2'));var BPromise=require(_0x7d08('0x3'));var rs=require(_0x7d08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d08('0x5'));var logger=require(_0x7d08('0x6'))('rpc');var config=require(_0x7d08('0x7'));var jayson=require(_0x7d08('0x8'));var client=jayson[_0x7d08('0x9')][_0x7d08('0xa')]({'port':0x232a});config[_0x7d08('0xb')]=_['defaults'](config['redis'],{'host':_0x7d08('0xc'),'port':0x18eb});var socket=require(_0x7d08('0xd'))(new Redis(config[_0x7d08('0xb')]));require(_0x7d08('0xe'))[_0x7d08('0xf')](socket);function respondWithRpcPromise(_0x191717,_0x117ab3,_0x24df3f){return new BPromise(function(_0x21691d,_0x44fb0c){return client[_0x7d08('0x10')](_0x191717,_0x24df3f)[_0x7d08('0x11')](function(_0x145b93){logger[_0x7d08('0x12')](_0x7d08('0x13'),_0x117ab3,_0x7d08('0x14'));logger[_0x7d08('0x15')](_0x7d08('0x16'),_0x117ab3,_0x7d08('0x14'),JSON[_0x7d08('0x17')](_0x145b93));if(_0x145b93[_0x7d08('0x18')]){if(_0x145b93[_0x7d08('0x18')][_0x7d08('0x19')]===0x1f4){logger[_0x7d08('0x18')](_0x7d08('0x13'),_0x117ab3,_0x145b93['error']['message']);return _0x44fb0c(_0x145b93[_0x7d08('0x18')][_0x7d08('0x1a')]);}logger[_0x7d08('0x18')](_0x7d08('0x13'),_0x117ab3,_0x145b93[_0x7d08('0x18')][_0x7d08('0x1a')]);return _0x21691d(_0x145b93[_0x7d08('0x18')][_0x7d08('0x1a')]);}else{logger[_0x7d08('0x12')](_0x7d08('0x13'),_0x117ab3,_0x7d08('0x14'));_0x21691d(_0x145b93[_0x7d08('0x1b')][_0x7d08('0x1a')]);}})['catch'](function(_0x4eea81){logger[_0x7d08('0x18')](_0x7d08('0x13'),_0x117ab3,_0x4eea81);_0x44fb0c(_0x4eea81);});});}exports[_0x7d08('0x1c')]=function(_0x5e59c2){var _0x5e41ec=this;return new Promise(function(_0x10fed4,_0x1f55a5){return db[_0x7d08('0x1d')]['findAll']({'raw':_0x5e59c2[_0x7d08('0x1e')]?_0x5e59c2[_0x7d08('0x1e')][_0x7d08('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e59c2['options']?_0x5e59c2[_0x7d08('0x1e')][_0x7d08('0x20')]||null:null,'attributes':_0x5e59c2['options']?_0x5e59c2[_0x7d08('0x1e')][_0x7d08('0x21')]||null:null,'limit':_0x5e59c2[_0x7d08('0x1e')]?_0x5e59c2['options'][_0x7d08('0x22')]||null:null,'include':_0x5e59c2[_0x7d08('0x1e')]?_0x5e59c2[_0x7d08('0x1e')]['include']?_[_0x7d08('0x23')](_0x5e59c2[_0x7d08('0x1e')][_0x7d08('0x24')],function(_0x24ba48){return{'model':db[_0x24ba48[_0x7d08('0x25')]],'as':_0x24ba48['as'],'attributes':_0x24ba48['attributes'],'include':_0x24ba48['include']?_[_0x7d08('0x23')](_0x24ba48['include'],function(_0x3c422f){return{'model':db[_0x3c422f['model']],'as':_0x3c422f['as'],'attributes':_0x3c422f[_0x7d08('0x21')],'include':_0x3c422f['include']?_[_0x7d08('0x23')](_0x3c422f[_0x7d08('0x24')],function(_0xe76c4){return{'model':db[_0xe76c4[_0x7d08('0x25')]],'as':_0xe76c4['as'],'attributes':_0xe76c4[_0x7d08('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35264f){logger[_0x7d08('0x12')](_0x7d08('0x1c'),_0x5e59c2);logger[_0x7d08('0x15')](_0x7d08('0x1c'),_0x5e59c2,JSON[_0x7d08('0x17')](_0x35264f));_0x10fed4(_0x35264f);})[_0x7d08('0x26')](function(_0x58ec72){logger[_0x7d08('0x18')](_0x7d08('0x1c'),_0x58ec72[_0x7d08('0x1a')],_0x5e59c2);_0x1f55a5(_0x5e41ec[_0x7d08('0x18')](0x1f4,_0x58ec72[_0x7d08('0x1a')]));});});};exports[_0x7d08('0x27')]=function(_0x2cabe0){var _0x5306fe=this;return new Promise(function(_0x46f50e,_0x306c6d){return db[_0x7d08('0x1d')][_0x7d08('0x28')]({'raw':_0x2cabe0[_0x7d08('0x1e')]?_0x2cabe0[_0x7d08('0x1e')][_0x7d08('0x1f')]===undefined?!![]:![]:!![],'where':_0x2cabe0[_0x7d08('0x1e')]?_0x2cabe0[_0x7d08('0x1e')][_0x7d08('0x20')]||null:null,'attributes':_0x2cabe0[_0x7d08('0x1e')]?_0x2cabe0[_0x7d08('0x1e')][_0x7d08('0x21')]||null:null,'include':_0x2cabe0[_0x7d08('0x1e')]?_0x2cabe0[_0x7d08('0x1e')][_0x7d08('0x24')]?_['map'](_0x2cabe0[_0x7d08('0x1e')][_0x7d08('0x24')],function(_0xf3d539){return{'model':db[_0xf3d539[_0x7d08('0x25')]],'as':_0xf3d539['as'],'attributes':_0xf3d539[_0x7d08('0x21')],'include':_0xf3d539[_0x7d08('0x24')]?_[_0x7d08('0x23')](_0xf3d539[_0x7d08('0x24')],function(_0x3a1f57){return{'model':db[_0x3a1f57[_0x7d08('0x25')]],'as':_0x3a1f57['as'],'attributes':_0x3a1f57[_0x7d08('0x21')],'include':_0x3a1f57[_0x7d08('0x24')]?_[_0x7d08('0x23')](_0x3a1f57['include'],function(_0x44d321){return{'model':db[_0x44d321['model']],'as':_0x44d321['as'],'attributes':_0x44d321[_0x7d08('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d08('0x11')](function(_0x32272c){logger[_0x7d08('0x12')]('ShowMailQueue',_0x2cabe0);logger['debug'](_0x7d08('0x27'),_0x2cabe0,JSON['stringify'](_0x32272c));_0x46f50e(_0x32272c);})[_0x7d08('0x26')](function(_0x3efd5a){logger[_0x7d08('0x18')](_0x7d08('0x27'),_0x3efd5a['message'],_0x2cabe0);_0x306c6d(_0x5306fe[_0x7d08('0x18')](0x1f4,_0x3efd5a[_0x7d08('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index adbface..edcfd5b 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 _0xfde3=['./mailQueue.events','emit','register','mailQueue:'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xfde3,0xe8));var _0x3fde=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfde3[_0x17d9e3];return _0x14192d;};'use strict';var MailQueueEvents=require(_0x3fde('0x0'));var events=['save','remove','update'];function createListener(_0x3fbbc1,_0xc35bf2){return function(_0x390554){_0xc35bf2[_0x3fde('0x1')](_0x3fbbc1,_0x390554);};}function removeListener(_0x55e688,_0x288717){return function(){MailQueueEvents['removeListener'](_0x55e688,_0x288717);};}exports[_0x3fde('0x2')]=function(_0xb76889){for(var _0x49ea96=0x0,_0x43c5c2=events['length'];_0x49ea96<_0x43c5c2;_0x49ea96++){var _0x4230fa=events[_0x49ea96];var _0x222b8d=createListener(_0x3fde('0x3')+_0x4230fa,_0xb76889);MailQueueEvents['on'](_0x4230fa,_0x222b8d);}}; \ No newline at end of file +var _0x0048=['./mailQueue.events','remove','emit','removeListener','register','length'];(function(_0x1b3fb0,_0x49325a){var _0x5eb66e=function(_0x5781e5){while(--_0x5781e5){_0x1b3fb0['push'](_0x1b3fb0['shift']());}};_0x5eb66e(++_0x49325a);}(_0x0048,0xba));var _0x8004=function(_0x287aba,_0x2b05a3){_0x287aba=_0x287aba-0x0;var _0x25d2ea=_0x0048[_0x287aba];return _0x25d2ea;};'use strict';var MailQueueEvents=require(_0x8004('0x0'));var events=['save',_0x8004('0x1'),'update'];function createListener(_0x1848ab,_0x547b71){return function(_0x146eb1){_0x547b71[_0x8004('0x2')](_0x1848ab,_0x146eb1);};}function removeListener(_0x332b49,_0x554f02){return function(){MailQueueEvents[_0x8004('0x3')](_0x332b49,_0x554f02);};}exports[_0x8004('0x4')]=function(_0x101f0a){for(var _0x3d9735=0x0,_0x2ef67e=events[_0x8004('0x5')];_0x3d9735<_0x2ef67e;_0x3d9735++){var _0x5ce231=events[_0x3d9735];var _0x41518b=createListener('mailQueue:'+_0x5ce231,_0x101f0a);MailQueueEvents['on'](_0x5ce231,_0x41518b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 26b6907..d3573d8 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 _0xd4f1=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x18b23c,_0x313e80){var _0x52c9e5=function(_0x449a41){while(--_0x449a41){_0x18b23c['push'](_0x18b23c['shift']());}};_0x52c9e5(++_0x313e80);}(_0xd4f1,0x9a));var _0x1d4f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4f1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1d4f('0x0'));var util=require(_0x1d4f('0x1'));var path=require(_0x1d4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d4f('0x3'));var router=express['Router']();var fs_extra=require(_0x1d4f('0x4'));var auth=require(_0x1d4f('0x5'));var interaction=require(_0x1d4f('0x6'));var config=require(_0x1d4f('0x7'));var controller=require(_0x1d4f('0x8'));router[_0x1d4f('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d4f('0xa')]);router['get'](_0x1d4f('0xb'),auth['isAuthenticated'](),controller[_0x1d4f('0xc')]);router[_0x1d4f('0x9')](_0x1d4f('0xd'),auth[_0x1d4f('0xe')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d4f('0xf')]);router[_0x1d4f('0x10')](_0x1d4f('0xd'),auth[_0x1d4f('0xe')](),controller[_0x1d4f('0x11')]);router[_0x1d4f('0x12')](_0x1d4f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d4f('0x13')]=router; \ No newline at end of file +var _0xd9a6=['/describe','describe','show','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd9a6,0x10d));var _0x6d9a=function(_0x161aa5,_0x333136){_0x161aa5=_0x161aa5-0x0;var _0x9c51f1=_0xd9a6[_0x161aa5];return _0x9c51f1;};'use strict';var multer=require('multer');var util=require(_0x6d9a('0x0'));var path=require(_0x6d9a('0x1'));var timeout=require(_0x6d9a('0x2'));var express=require(_0x6d9a('0x3'));var router=express[_0x6d9a('0x4')]();var fs_extra=require(_0x6d9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d9a('0x6'));var config=require(_0x6d9a('0x7'));var controller=require(_0x6d9a('0x8'));router[_0x6d9a('0x9')]('/',auth[_0x6d9a('0xa')](),controller['index']);router[_0x6d9a('0x9')](_0x6d9a('0xb'),auth[_0x6d9a('0xa')](),controller[_0x6d9a('0xc')]);router['get']('/:id',auth[_0x6d9a('0xa')](),controller[_0x6d9a('0xd')]);router['post']('/',auth[_0x6d9a('0xa')](),controller[_0x6d9a('0xe')]);router['put'](_0x6d9a('0xf'),auth['isAuthenticated'](),controller[_0x6d9a('0x10')]);router[_0x6d9a('0x11')]('/:id',auth[_0x6d9a('0xa')](),controller[_0x6d9a('0x12')]);module[_0x6d9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 197b55d..a398de4 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 _0x4143=['exports','STRING','DATE','moment'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x4143,0x167));var _0x3414=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x4143[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0x3414('0x0'));var Sequelize=require('sequelize');module[_0x3414('0x1')]={'uniqueid':{'type':Sequelize[_0x3414('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3414('0x2')]},'joinAt':{'type':Sequelize[_0x3414('0x3')]},'leaveAt':{'type':Sequelize[_0x3414('0x3')]},'acceptAt':{'type':Sequelize[_0x3414('0x3')]},'exitAt':{'type':Sequelize[_0x3414('0x3')]},'reason':{'type':Sequelize[_0x3414('0x2')]}}; \ No newline at end of file +var _0xbd19=['DATE','moment','sequelize','exports','STRING'];(function(_0x45ce82,_0x4fe2bc){var _0x2f58e9=function(_0x3aada6){while(--_0x3aada6){_0x45ce82['push'](_0x45ce82['shift']());}};_0x2f58e9(++_0x4fe2bc);}(_0xbd19,0x9c));var _0x9bd1=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xbd19[_0x5c2e3e];return _0x53f64a;};'use strict';var moment=require(_0x9bd1('0x0'));var Sequelize=require(_0x9bd1('0x1'));module[_0x9bd1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9bd1('0x3')]},'joinAt':{'type':Sequelize[_0x9bd1('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9bd1('0x4')]},'reason':{'type':Sequelize[_0x9bd1('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c42e5a1..3fe0541 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 _0xeb3b=['destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then'];(function(_0x53d5a0,_0xeaccfc){var _0x5836a7=function(_0x361bbf){while(--_0x361bbf){_0x53d5a0['push'](_0x53d5a0['shift']());}};_0x5836a7(++_0xeaccfc);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xeb3b[_0x2c93e2];return _0x57264e;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){_0x55a59d[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0x84921a,_0x340581){return function(_0x46fe17){if(!_0x46fe17){_0x84921a['sendStatus'](0x194);}return _0x46fe17;};}function handleError(_0x4e695e,_0x1f36b9){_0x1f36b9=_0x1f36b9||0x1f4;return function(_0x520116){logger[_0xbeb3('0x25')](_0x520116[_0xbeb3('0x26')]);if(_0x520116[_0xbeb3('0x27')]){delete _0x520116[_0xbeb3('0x27')];}_0x4e695e['status'](_0x1f36b9)[_0xbeb3('0x28')](_0x520116);};}exports['index']=function(_0x26cd8f,_0xab301c){var _0x5bd93d={},_0x483198={},_0x9b8f13={'count':0x0,'rows':[]};var _0x585c6f=_['map'](db['MailQueueReport']['rawAttributes'],function(_0xf5dbaf){return{'name':_0xf5dbaf['fieldName'],'type':_0xf5dbaf[_0xbeb3('0x29')][_0xbeb3('0x2a')]};});_0x483198[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x585c6f,_0xbeb3('0x27'));_0x483198[_0xbeb3('0x2d')]=_[_0xbeb3('0x2e')](_0x26cd8f[_0xbeb3('0x2d')]);_0x483198[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x483198['model'],_0x483198[_0xbeb3('0x2d')]);_0x5bd93d[_0xbeb3('0x31')]=_['intersection'](_0x483198[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0x5bd93d['attributes']=_0x5bd93d[_0xbeb3('0x31')][_0xbeb3('0x33')]?_0x5bd93d[_0xbeb3('0x31')]:_0x483198[_0xbeb3('0x2b')];if(!_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x34')](_0xbeb3('0x35'))){_0x5bd93d[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x26cd8f['query'][_0xbeb3('0x1f')]);_0x5bd93d['offset']=qs[_0xbeb3('0x1e')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x1e')]);}_0x5bd93d[_0xbeb3('0x36')]=qs[_0xbeb3('0x37')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x37')]);_0x5bd93d[_0xbeb3('0x38')]=qs['filters'](_[_0xbeb3('0x39')](_0x26cd8f['query'],_0x483198['filters']),_0x585c6f);if(_0x26cd8f['query'][_0xbeb3('0x3a')]){_0x5bd93d[_0xbeb3('0x38')]=_[_0xbeb3('0x3b')](_0x5bd93d[_0xbeb3('0x38')],{'$or':_[_0xbeb3('0x2c')](_0x585c6f,function(_0x40f166){if(_0x40f166['type']!==_0xbeb3('0x3c')){var _0x40de8d={};_0x40de8d[_0x40f166[_0xbeb3('0x27')]]={'$like':'%'+_0x26cd8f['query']['filter']+'%'};return _0x40de8d;}})});}_0x5bd93d=_['merge']({},_0x5bd93d,_0x26cd8f[_0xbeb3('0x3d')]);var _0x2a8860={'where':_0x5bd93d[_0xbeb3('0x38')]};return db['MailQueueReport'][_0xbeb3('0x1d')](_0x2a8860)['then'](function(_0x1b6700){_0x9b8f13[_0xbeb3('0x1d')]=_0x1b6700;if(_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x3e')]){_0x5bd93d['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xbeb3('0x3f')](_0x5bd93d);})[_0xbeb3('0x23')](function(_0x3d4262){_0x9b8f13[_0xbeb3('0x40')]=_0x3d4262;return _0x9b8f13;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xab301c,_0x5bd93d))[_0xbeb3('0x41')](handleError(_0xab301c,null));};exports[_0xbeb3('0x42')]=function(_0x4606a6,_0x5758c6){var _0xfcb57f={'raw':!![],'where':{'id':_0x4606a6[_0xbeb3('0x43')]['id']}},_0x39f2d2={};_0x39f2d2[_0xbeb3('0x2b')]=_[_0xbeb3('0x2e')](db[_0xbeb3('0x44')][_0xbeb3('0x45')]);_0x39f2d2['query']=_[_0xbeb3('0x2e')](_0x4606a6[_0xbeb3('0x2d')]);_0x39f2d2[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],_0x39f2d2[_0xbeb3('0x2d')]);_0xfcb57f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x4606a6[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0xfcb57f[_0xbeb3('0x31')]=_0xfcb57f['attributes'][_0xbeb3('0x33')]?_0xfcb57f[_0xbeb3('0x31')]:_0x39f2d2[_0xbeb3('0x2b')];if(_0x4606a6['query']['includeAll']){_0xfcb57f[_0xbeb3('0x46')]=[{'all':!![]}];}_0xfcb57f=_[_0xbeb3('0x3b')]({},_0xfcb57f,_0x4606a6[_0xbeb3('0x3d')]);return db[_0xbeb3('0x44')]['find'](_0xfcb57f)[_0xbeb3('0x23')](handleEntityNotFound(_0x5758c6,null))['then'](respondWithResult(_0x5758c6,null))['catch'](handleError(_0x5758c6,null));};exports[_0xbeb3('0x47')]=function(_0x393e60,_0x1ff297){return db[_0xbeb3('0x44')]['create'](_0x393e60[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](respondWithResult(_0x1ff297,0xc9))[_0xbeb3('0x41')](handleError(_0x1ff297,null));};exports['update']=function(_0x3f93ab,_0x58c49f){if(_0x3f93ab['body']['id']){delete _0x3f93ab[_0xbeb3('0x48')]['id'];}return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x3f93ab['params']['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x58c49f,null))[_0xbeb3('0x23')](saveUpdates(_0x3f93ab[_0xbeb3('0x48')],null))['then'](respondWithResult(_0x58c49f,null))[_0xbeb3('0x41')](handleError(_0x58c49f,null));};exports['destroy']=function(_0x39605b,_0x4d8e21){return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x39605b[_0xbeb3('0x43')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x4d8e21,null))[_0xbeb3('0x23')](removeEntity(_0x4d8e21,null))[_0xbeb3('0x41')](handleError(_0x4d8e21,null));};exports[_0xbeb3('0x4a')]=function(_0x168434,_0x49fded){return db[_0xbeb3('0x44')][_0xbeb3('0x4a')]()[_0xbeb3('0x23')](respondWithResult(_0x49fded,null))[_0xbeb3('0x41')](handleError(_0x49fded,null));}; \ No newline at end of file +var _0x7046=['map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','MailQueueReport','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','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','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send'];(function(_0x5c8321,_0x4b8dda){var _0x4fc3cf=function(_0x6fd087){while(--_0x6fd087){_0x5c8321['push'](_0x5c8321['shift']());}};_0x4fc3cf(++_0x4b8dda);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x6704('0x0'));var rimraf=require(_0x6704('0x1'));var zipdir=require(_0x6704('0x2'));var jsonpatch=require(_0x6704('0x3'));var rp=require('request-promise');var moment=require(_0x6704('0x4'));var BPromise=require(_0x6704('0x5'));var Mustache=require(_0x6704('0x6'));var util=require('util');var path=require(_0x6704('0x7'));var sox=require(_0x6704('0x8'));var csv=require(_0x6704('0x9'));var ejs=require(_0x6704('0xa'));var fs=require('fs');var fs_extra=require(_0x6704('0xb'));var _=require('lodash');var squel=require(_0x6704('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6704('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6704('0xe'));var Redis=require(_0x6704('0xf'));var authService=require(_0x6704('0x10'));var qs=require(_0x6704('0x11'));var as=require(_0x6704('0x12'));var hardwareService=require(_0x6704('0x13'));var logger=require(_0x6704('0x14'))(_0x6704('0x15'));var utils=require('../../config/utils');var config=require(_0x6704('0x16'));var licenseUtil=require(_0x6704('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2feb52,_0x1db0ad){_0x1db0ad=_0x1db0ad||0xcc;return function(_0x327e03){if(_0x327e03){return _0x2feb52[_0x6704('0x18')](_0x1db0ad);}return _0x2feb52[_0x6704('0x19')](_0x1db0ad)[_0x6704('0x1a')]();};}function respondWithResult(_0x17b9bc,_0x2da4df){_0x2da4df=_0x2da4df||0xc8;return function(_0x24ece3){if(_0x24ece3){return _0x17b9bc['status'](_0x2da4df)[_0x6704('0x1b')](_0x24ece3);}};}function respondWithFilteredResult(_0x1752bc,_0x35082b){return function(_0x4fef80){if(_0x4fef80){var _0x11782a=typeof _0x35082b[_0x6704('0x1c')]===_0x6704('0x1d')&&typeof _0x35082b[_0x6704('0x1e')]===_0x6704('0x1d');var _0x5adb35=_0x4fef80[_0x6704('0x1f')];var _0x31d732=_0x11782a?0x0:_0x35082b[_0x6704('0x1c')];var _0xe49450=_0x11782a?_0x4fef80[_0x6704('0x1f')]:_0x35082b['offset']+_0x35082b[_0x6704('0x1e')];var _0x2f6eae;if(_0xe49450>=_0x5adb35){_0xe49450=_0x5adb35;_0x2f6eae=0xc8;}else{_0x2f6eae=0xce;}_0x1752bc[_0x6704('0x19')](_0x2f6eae);return _0x1752bc[_0x6704('0x20')](_0x6704('0x21'),_0x31d732+'-'+_0xe49450+'/'+_0x5adb35)[_0x6704('0x1b')](_0x4fef80);}return null;};}function patchUpdates(_0x42b27f){return function(_0x5bb33e){try{jsonpatch[_0x6704('0x22')](_0x5bb33e,_0x42b27f,!![]);}catch(_0xf6d433){return BPromise[_0x6704('0x23')](_0xf6d433);}return _0x5bb33e['save']();};}function saveUpdates(_0x4dca58,_0x48d829){return function(_0x3e183b){if(_0x3e183b){return _0x3e183b[_0x6704('0x24')](_0x4dca58)[_0x6704('0x25')](function(_0x41f89e){return _0x41f89e;});}return null;};}function removeEntity(_0x56d1e1,_0xf2c459){return function(_0xabb97a){if(_0xabb97a){return _0xabb97a[_0x6704('0x26')]()[_0x6704('0x25')](function(){_0x56d1e1[_0x6704('0x19')](0xcc)[_0x6704('0x1a')]();});}};}function handleEntityNotFound(_0x2acafd,_0x5d50ff){return function(_0x896227){if(!_0x896227){_0x2acafd[_0x6704('0x18')](0x194);}return _0x896227;};}function handleError(_0x36bea4,_0x1bdfee){_0x1bdfee=_0x1bdfee||0x1f4;return function(_0x118d93){logger['error'](_0x118d93['stack']);if(_0x118d93[_0x6704('0x27')]){delete _0x118d93[_0x6704('0x27')];}_0x36bea4[_0x6704('0x19')](_0x1bdfee)[_0x6704('0x28')](_0x118d93);};}exports['index']=function(_0x1def46,_0x18cd98){var _0x5c229d={},_0x588814={},_0x16e749={'count':0x0,'rows':[]};var _0x5363c9=_[_0x6704('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x7e193e){return{'name':_0x7e193e[_0x6704('0x2a')],'type':_0x7e193e[_0x6704('0x2b')]['key']};});_0x588814[_0x6704('0x2c')]=_[_0x6704('0x29')](_0x5363c9,_0x6704('0x27'));_0x588814[_0x6704('0x2d')]=_[_0x6704('0x2e')](_0x1def46[_0x6704('0x2d')]);_0x588814[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],_0x588814[_0x6704('0x2d')]);_0x5c229d[_0x6704('0x31')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x1def46[_0x6704('0x2d')][_0x6704('0x32')]));_0x5c229d[_0x6704('0x31')]=_0x5c229d[_0x6704('0x31')][_0x6704('0x33')]?_0x5c229d[_0x6704('0x31')]:_0x588814[_0x6704('0x2c')];if(!_0x1def46[_0x6704('0x2d')][_0x6704('0x34')](_0x6704('0x35'))){_0x5c229d[_0x6704('0x1e')]=qs['limit'](_0x1def46['query']['limit']);_0x5c229d[_0x6704('0x1c')]=qs[_0x6704('0x1c')](_0x1def46[_0x6704('0x2d')]['offset']);}_0x5c229d[_0x6704('0x36')]=qs['sort'](_0x1def46[_0x6704('0x2d')][_0x6704('0x37')]);_0x5c229d[_0x6704('0x38')]=qs[_0x6704('0x2f')](_[_0x6704('0x39')](_0x1def46[_0x6704('0x2d')],_0x588814[_0x6704('0x2f')]),_0x5363c9);if(_0x1def46[_0x6704('0x2d')]['filter']){_0x5c229d['where']=_[_0x6704('0x3a')](_0x5c229d[_0x6704('0x38')],{'$or':_['map'](_0x5363c9,function(_0x48f3c2){if(_0x48f3c2[_0x6704('0x2b')]!=='VIRTUAL'){var _0xd7e27b={};_0xd7e27b[_0x48f3c2[_0x6704('0x27')]]={'$like':'%'+_0x1def46[_0x6704('0x2d')][_0x6704('0x3b')]+'%'};return _0xd7e27b;}})});}_0x5c229d=_['merge']({},_0x5c229d,_0x1def46[_0x6704('0x3c')]);var _0x1ee017={'where':_0x5c229d['where']};return db[_0x6704('0x3d')]['count'](_0x1ee017)[_0x6704('0x25')](function(_0x714c83){_0x16e749[_0x6704('0x1f')]=_0x714c83;if(_0x1def46['query'][_0x6704('0x3e')]){_0x5c229d[_0x6704('0x3f')]=[{'all':!![]}];}return db[_0x6704('0x3d')]['findAll'](_0x5c229d);})[_0x6704('0x25')](function(_0x444d36){_0x16e749[_0x6704('0x40')]=_0x444d36;return _0x16e749;})[_0x6704('0x25')](respondWithFilteredResult(_0x18cd98,_0x5c229d))['catch'](handleError(_0x18cd98,null));};exports[_0x6704('0x41')]=function(_0x50cc74,_0x2defda){var _0x45a217={'raw':!![],'where':{'id':_0x50cc74[_0x6704('0x42')]['id']}},_0x10fc26={};_0x10fc26['model']=_['keys'](db['MailQueueReport'][_0x6704('0x43')]);_0x10fc26['query']=_[_0x6704('0x2e')](_0x50cc74['query']);_0x10fc26[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x10fc26['model'],_0x10fc26[_0x6704('0x2d')]);_0x45a217[_0x6704('0x31')]=_[_0x6704('0x30')](_0x10fc26[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x50cc74['query'][_0x6704('0x32')]));_0x45a217[_0x6704('0x31')]=_0x45a217[_0x6704('0x31')][_0x6704('0x33')]?_0x45a217[_0x6704('0x31')]:_0x10fc26['model'];if(_0x50cc74[_0x6704('0x2d')]['includeAll']){_0x45a217[_0x6704('0x3f')]=[{'all':!![]}];}_0x45a217=_[_0x6704('0x3a')]({},_0x45a217,_0x50cc74[_0x6704('0x3c')]);return db[_0x6704('0x3d')][_0x6704('0x44')](_0x45a217)['then'](handleEntityNotFound(_0x2defda,null))[_0x6704('0x25')](respondWithResult(_0x2defda,null))[_0x6704('0x45')](handleError(_0x2defda,null));};exports['create']=function(_0x1b9d36,_0x17a98a){return db[_0x6704('0x3d')][_0x6704('0x46')](_0x1b9d36[_0x6704('0x47')],{})[_0x6704('0x25')](respondWithResult(_0x17a98a,0xc9))['catch'](handleError(_0x17a98a,null));};exports[_0x6704('0x24')]=function(_0x5b0713,_0xb73442){if(_0x5b0713['body']['id']){delete _0x5b0713[_0x6704('0x47')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x5b0713[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0xb73442,null))[_0x6704('0x25')](saveUpdates(_0x5b0713[_0x6704('0x47')],null))[_0x6704('0x25')](respondWithResult(_0xb73442,null))[_0x6704('0x45')](handleError(_0xb73442,null));};exports['destroy']=function(_0x5b9e28,_0x254cf7){return db[_0x6704('0x3d')][_0x6704('0x44')]({'where':{'id':_0x5b9e28[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0x254cf7,null))[_0x6704('0x25')](removeEntity(_0x254cf7,null))[_0x6704('0x45')](handleError(_0x254cf7,null));};exports[_0x6704('0x48')]=function(_0x1fcfb0,_0x44e4a5){return db[_0x6704('0x3d')][_0x6704('0x48')]()[_0x6704('0x25')](respondWithResult(_0x44e4a5,null))[_0x6704('0x45')](handleError(_0x44e4a5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9d67dc2..d17745c 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 _0xbebd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util'];(function(_0x5b4e7a,_0x2431a5){var _0x406ce6=function(_0x532bca){while(--_0x532bca){_0x5b4e7a['push'](_0x5b4e7a['shift']());}};_0x406ce6(++_0x2431a5);}(_0xbebd,0x1ab));var _0xdbeb=function(_0x555b4c,_0x299303){_0x555b4c=_0x555b4c-0x0;var _0x16d5fc=_0xbebd[_0x555b4c];return _0x16d5fc;};'use strict';var _=require(_0xdbeb('0x0'));var util=require(_0xdbeb('0x1'));var logger=require('../../config/logger')(_0xdbeb('0x2'));var moment=require(_0xdbeb('0x3'));var BPromise=require(_0xdbeb('0x4'));var rp=require(_0xdbeb('0x5'));var fs=require('fs');var path=require(_0xdbeb('0x6'));var rimraf=require(_0xdbeb('0x7'));var config=require(_0xdbeb('0x8'));var attributes=require(_0xdbeb('0x9'));module['exports']=function(_0x463b34,_0x21adb5){return _0x463b34[_0xdbeb('0xa')](_0xdbeb('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xdbeb('0xc'),'fields':[_0xdbeb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3cf=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa3cf,0xfa));var _0xfa3c=function(_0x8d708,_0x26cc9c){_0x8d708=_0x8d708-0x0;var _0x5c3691=_0xa3cf[_0x8d708];return _0x5c3691;};'use strict';var _=require('lodash');var util=require(_0xfa3c('0x0'));var logger=require(_0xfa3c('0x1'))(_0xfa3c('0x2'));var moment=require(_0xfa3c('0x3'));var BPromise=require(_0xfa3c('0x4'));var rp=require(_0xfa3c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa3c('0x6'));var config=require(_0xfa3c('0x7'));var attributes=require(_0xfa3c('0x8'));module[_0xfa3c('0x9')]=function(_0x180b34,_0x13d6cf){return _0x180b34[_0xfa3c('0xa')](_0xfa3c('0xb'),attributes,{'tableName':_0xfa3c('0xc'),'paranoid':![],'indexes':[{'name':_0xfa3c('0xd'),'fields':[_0xfa3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4d4e1fb..e5f43ca 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x334701,_0x8e563f){var _0x36fd03=function(_0x103ade){while(--_0x103ade){_0x334701['push'](_0x334701['shift']());}};_0x36fd03(++_0x8e563f);}(_0xadb5,0xad));var _0x5adb=function(_0x5b0444,_0x16eafb){_0x5b0444=_0x5b0444-0x0;var _0x51a305=_0xadb5[_0x5b0444];return _0x51a305;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5984bb,_0x33da4e){var _0x2f7a8d=function(_0xc7358a){while(--_0xc7358a){_0x5984bb['push'](_0x5984bb['shift']());}};_0x2f7a8d(++_0x33da4e);}(_0x1261,0x144));var _0x1126=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x1261[_0x12b8ec];return _0x21af77;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4491108..f845fcd 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1ce3db,_0x17418b){var _0x1416d3=function(_0x14306d){while(--_0x14306d){_0x1ce3db['push'](_0x1ce3db['shift']());}};_0x1416d3(++_0x17418b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xcb91[_0x1aed80];return _0x43961e;};'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(_0x146bf6,_0x4ba843){var _0x2489fe=function(_0x7e07e2){while(--_0x7e07e2){_0x146bf6['push'](_0x146bf6['shift']());}};_0x2489fe(++_0x4ba843);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xcb91[_0x1ab0e6];return _0x248815;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1156f9a..226fc14 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 _0x194b=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x194b,0x14f));var _0xb194=function(_0x503e79,_0x12f2d5){_0x503e79=_0x503e79-0x0;var _0x509aab=_0x194b[_0x503e79];return _0x509aab;};'use strict';var Sequelize=require(_0xb194('0x0'));module[_0xb194('0x1')]={'description':{'type':Sequelize[_0xb194('0x2')]},'host':{'type':Sequelize[_0xb194('0x2')]},'authentication':{'type':Sequelize[_0xb194('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb194('0x2')]},'password':{'type':Sequelize[_0xb194('0x2')]},'port':{'type':Sequelize[_0xb194('0x4')]},'tls':{'type':Sequelize[_0xb194('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb194('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb194('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xb194('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb194('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe3cf=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x1f8f22,_0x2b1b51){var _0x2373b8=function(_0x52a505){while(--_0x52a505){_0x1f8f22['push'](_0x1f8f22['shift']());}};_0x2373b8(++_0x2b1b51);}(_0xe3cf,0x179));var _0xfe3c=function(_0x3e602e,_0x28d032){_0x3e602e=_0x3e602e-0x0;var _0x5e75f5=_0xe3cf[_0x3e602e];return _0x5e75f5;};'use strict';var Sequelize=require(_0xfe3c('0x0'));module[_0xfe3c('0x1')]={'description':{'type':Sequelize[_0xfe3c('0x2')]},'host':{'type':Sequelize[_0xfe3c('0x2')]},'authentication':{'type':Sequelize[_0xfe3c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfe3c('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfe3c('0x4')},'connTimeout':{'type':Sequelize[_0xfe3c('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfe3c('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfe3c('0x2')]},'modernAuthentication':{'type':Sequelize[_0xfe3c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 609eb16..8a1d47a 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 _0x7a53=['mail_servers_in','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x37c2ff,_0x5080ba){var _0x23322f=function(_0x3f5f13){while(--_0x3f5f13){_0x37c2ff['push'](_0x37c2ff['shift']());}};_0x23322f(++_0x5080ba);}(_0x7a53,0x169));var _0x37a5=function(_0x2414fa,_0x4697d2){_0x2414fa=_0x2414fa-0x0;var _0x5d4452=_0x7a53[_0x2414fa];return _0x5d4452;};'use strict';var _=require('lodash');var util=require(_0x37a5('0x0'));var logger=require(_0x37a5('0x1'))(_0x37a5('0x2'));var moment=require('moment');var BPromise=require(_0x37a5('0x3'));var rp=require(_0x37a5('0x4'));var fs=require('fs');var path=require(_0x37a5('0x5'));var rimraf=require(_0x37a5('0x6'));var config=require(_0x37a5('0x7'));var attributes=require(_0x37a5('0x8'));module[_0x37a5('0x9')]=function(_0x2f61d8,_0x2dedeb){return _0x2f61d8[_0x37a5('0xa')]('MailServerIn',attributes,{'tableName':_0x37a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdde5=['exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xdde5,0x186));var _0x5dde=function(_0x170eb7,_0x1ac59b){_0x170eb7=_0x170eb7-0x0;var _0x4dfeac=_0xdde5[_0x170eb7];return _0x4dfeac;};'use strict';var _=require(_0x5dde('0x0'));var util=require(_0x5dde('0x1'));var logger=require(_0x5dde('0x2'))(_0x5dde('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dde('0x4'));var rimraf=require(_0x5dde('0x5'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x5dde('0x6')]=function(_0x31edd6,_0x41435e){return _0x31edd6['define'](_0x5dde('0x7'),attributes,{'tableName':_0x5dde('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index b52d376..717df6a 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 _0x38e7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x18c7db,_0x2d19f7){var _0x42847d=function(_0x48602d){while(--_0x48602d){_0x18c7db['push'](_0x18c7db['shift']());}};_0x42847d(++_0x2d19f7);}(_0x38e7,0x1eb));var _0x738e=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x38e7[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x738e('0x0'));var util=require(_0x738e('0x1'));var moment=require(_0x738e('0x2'));var BPromise=require(_0x738e('0x3'));var rs=require(_0x738e('0x4'));var fs=require('fs');var Redis=require(_0x738e('0x5'));var db=require(_0x738e('0x6'))['db'];var utils=require(_0x738e('0x7'));var logger=require(_0x738e('0x8'))(_0x738e('0x9'));var config=require(_0x738e('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282b59,_0x35db07,_0x26c0a7){return new BPromise(function(_0x287d50,_0x160926){return client[_0x738e('0xb')](_0x282b59,_0x26c0a7)[_0x738e('0xc')](function(_0x36f796){logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x35db07,_0x738e('0xf'),JSON['stringify'](_0x36f796));if(_0x36f796[_0x738e('0x10')]){if(_0x36f796[_0x738e('0x10')]['code']===0x1f4){logger[_0x738e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x35db07,_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);return _0x160926(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}logger[_0x738e('0x10')](_0x738e('0xe'),_0x35db07,_0x36f796['error'][_0x738e('0x11')]);return _0x287d50(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}else{logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));_0x287d50(_0x36f796['result'][_0x738e('0x11')]);}})[_0x738e('0x12')](function(_0x4d0651){logger[_0x738e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x35db07,_0x4d0651);_0x160926(_0x4d0651);});});}exports[_0x738e('0x13')]=function(_0x3add89){var _0x4618a4=this;return new Promise(function(_0x130bc5,_0x2b9eab){return db[_0x738e('0x14')][_0x738e('0x15')]({'raw':_0x3add89['options']?_0x3add89[_0x738e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x17')]||null:null,'attributes':_0x3add89['options']?_0x3add89[_0x738e('0x16')][_0x738e('0x18')]||null:null,'limit':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x19')]||null:null,'include':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x3add89['options'][_0x738e('0x1a')],function(_0x609ed6){return{'model':db[_0x609ed6[_0x738e('0x1c')]],'as':_0x609ed6['as'],'attributes':_0x609ed6['attributes'],'include':_0x609ed6[_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x609ed6['include'],function(_0x275850){return{'model':db[_0x275850['model']],'as':_0x275850['as'],'attributes':_0x275850['attributes'],'include':_0x275850[_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x275850[_0x738e('0x1a')],function(_0x54e0bf){return{'model':db[_0x54e0bf['model']],'as':_0x54e0bf['as'],'attributes':_0x54e0bf[_0x738e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x738e('0xc')](function(_0x3b4a25){logger[_0x738e('0xd')](_0x738e('0x13'),_0x3add89);logger[_0x738e('0x1d')](_0x738e('0x13'),_0x3add89,JSON[_0x738e('0x1e')](_0x3b4a25));_0x130bc5(_0x3b4a25);})[_0x738e('0x12')](function(_0x129fcb){logger[_0x738e('0x10')](_0x738e('0x13'),_0x129fcb[_0x738e('0x11')],_0x3add89);_0x2b9eab(_0x4618a4[_0x738e('0x10')](0x1f4,_0x129fcb[_0x738e('0x11')]));});});}; \ No newline at end of file +var _0x5cd8=['http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map','model','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d2c31,_0x4cdef0){var _0x2aa1f6=function(_0x4359af){while(--_0x4359af){_0x5d2c31['push'](_0x5d2c31['shift']());}};_0x2aa1f6(++_0x4cdef0);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x51c9b4,_0x729cfe){_0x51c9b4=_0x51c9b4-0x0;var _0x113a8f=_0x5cd8[_0x51c9b4];return _0x113a8f;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');var moment=require(_0x85cd('0x1'));var BPromise=require(_0x85cd('0x2'));var rs=require(_0x85cd('0x3'));var fs=require('fs');var Redis=require(_0x85cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x85cd('0x5'));var logger=require('../../config/logger')(_0x85cd('0x6'));var config=require(_0x85cd('0x7'));var jayson=require(_0x85cd('0x8'));var client=jayson[_0x85cd('0x9')][_0x85cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x598ab6,_0x1a8619,_0x1a69c4){return new BPromise(function(_0x5aa3c3,_0x1e002d){return client[_0x85cd('0xb')](_0x598ab6,_0x1a69c4)[_0x85cd('0xc')](function(_0x30204b){logger[_0x85cd('0xd')](_0x85cd('0xe'),_0x1a8619,_0x85cd('0xf'));logger[_0x85cd('0x10')](_0x85cd('0x11'),_0x1a8619,'request\x20sent',JSON['stringify'](_0x30204b));if(_0x30204b[_0x85cd('0x12')]){if(_0x30204b[_0x85cd('0x12')][_0x85cd('0x13')]===0x1f4){logger[_0x85cd('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1a8619,_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);return _0x1e002d(_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);}logger[_0x85cd('0x12')](_0x85cd('0xe'),_0x1a8619,_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);return _0x5aa3c3(_0x30204b['error'][_0x85cd('0x14')]);}else{logger[_0x85cd('0xd')](_0x85cd('0xe'),_0x1a8619,_0x85cd('0xf'));_0x5aa3c3(_0x30204b[_0x85cd('0x15')]['message']);}})[_0x85cd('0x16')](function(_0x5164e8){logger[_0x85cd('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1a8619,_0x5164e8);_0x1e002d(_0x5164e8);});});}exports[_0x85cd('0x17')]=function(_0x4d9c64){var _0x40e2e5=this;return new Promise(function(_0x11292e,_0x238799){return db[_0x85cd('0x18')][_0x85cd('0x19')]({'raw':_0x4d9c64[_0x85cd('0x1a')]?_0x4d9c64[_0x85cd('0x1a')][_0x85cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d9c64['options']?_0x4d9c64[_0x85cd('0x1a')][_0x85cd('0x1c')]||null:null,'attributes':_0x4d9c64['options']?_0x4d9c64['options']['attributes']||null:null,'limit':_0x4d9c64['options']?_0x4d9c64[_0x85cd('0x1a')]['limit']||null:null,'include':_0x4d9c64[_0x85cd('0x1a')]?_0x4d9c64[_0x85cd('0x1a')][_0x85cd('0x1d')]?_[_0x85cd('0x1e')](_0x4d9c64['options'][_0x85cd('0x1d')],function(_0x2b00a8){return{'model':db[_0x2b00a8[_0x85cd('0x1f')]],'as':_0x2b00a8['as'],'attributes':_0x2b00a8[_0x85cd('0x20')],'include':_0x2b00a8[_0x85cd('0x1d')]?_[_0x85cd('0x1e')](_0x2b00a8['include'],function(_0xb3500f){return{'model':db[_0xb3500f[_0x85cd('0x1f')]],'as':_0xb3500f['as'],'attributes':_0xb3500f[_0x85cd('0x20')],'include':_0xb3500f[_0x85cd('0x1d')]?_['map'](_0xb3500f[_0x85cd('0x1d')],function(_0x43a062){return{'model':db[_0x43a062[_0x85cd('0x1f')]],'as':_0x43a062['as'],'attributes':_0x43a062['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ea68b){logger['info'](_0x85cd('0x17'),_0x4d9c64);logger[_0x85cd('0x10')](_0x85cd('0x17'),_0x4d9c64,JSON[_0x85cd('0x21')](_0x2ea68b));_0x11292e(_0x2ea68b);})['catch'](function(_0x225802){logger[_0x85cd('0x12')](_0x85cd('0x17'),_0x225802[_0x85cd('0x14')],_0x4d9c64);_0x238799(_0x40e2e5['error'](0x1f4,_0x225802[_0x85cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dec9a86..9f05079 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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x808165,_0x5e44b7){_0x808165=_0x808165-0x0;var _0x8387c6=_0x7a54[_0x808165];return _0x8387c6;};'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(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 c0daf3b..ef059ae 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 _0x373d=['STRING','BOOLEAN','sequelize'];(function(_0x8f270,_0x2f435f){var _0x5446cb=function(_0x6b3be8){while(--_0x6b3be8){_0x8f270['push'](_0x8f270['shift']());}};_0x5446cb(++_0x2f435f);}(_0x373d,0x1e2));var _0xd373=function(_0x17d314,_0x4c6cc8){_0x17d314=_0x17d314-0x0;var _0x58e7d3=_0x373d[_0x17d314];return _0x58e7d3;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'description':{'type':Sequelize[_0xd373('0x1')]},'host':{'type':Sequelize[_0xd373('0x1')]},'user':{'type':Sequelize[_0xd373('0x1')]},'pass':{'type':Sequelize[_0xd373('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xd373('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xd373('0x1')]},'authentication':{'type':Sequelize[_0xd373('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0fd9=['BOOLEAN','exports','STRING'];(function(_0x228d7b,_0x287149){var _0x2000cb=function(_0x3fc5b0){while(--_0x3fc5b0){_0x228d7b['push'](_0x228d7b['shift']());}};_0x2000cb(++_0x287149);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x0fd9[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'description':{'type':Sequelize[_0x90fd('0x1')]},'host':{'type':Sequelize[_0x90fd('0x1')]},'user':{'type':Sequelize[_0x90fd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x90fd('0x1')]},'authentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d61daba..5b97188 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 _0x4e6c=['set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','include','rows','catch','show','keys','includeAll','options','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count'];(function(_0x5f2b0a,_0x2f4569){var _0x4b5157=function(_0x2ea975){while(--_0x2ea975){_0x5f2b0a['push'](_0x5f2b0a['shift']());}};_0x4b5157(++_0x2f4569);}(_0x4e6c,0xc3));var _0xc4e6=function(_0x376fb7,_0x5b0cbe){_0x376fb7=_0x376fb7-0x0;var _0x3bfeb8=_0x4e6c[_0x376fb7];return _0x3bfeb8;};'use strict';var emlformat=require(_0xc4e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4e6('0x1'));var jsonpatch=require(_0xc4e6('0x2'));var rp=require(_0xc4e6('0x3'));var moment=require(_0xc4e6('0x4'));var BPromise=require(_0xc4e6('0x5'));var Mustache=require(_0xc4e6('0x6'));var util=require('util');var path=require(_0xc4e6('0x7'));var sox=require(_0xc4e6('0x8'));var csv=require('to-csv');var ejs=require(_0xc4e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4e6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4e6('0xb'));var deskjs=require(_0xc4e6('0xc'));var toCsv=require(_0xc4e6('0xd'));var querystring=require(_0xc4e6('0xe'));var Papa=require(_0xc4e6('0xf'));var Redis=require(_0xc4e6('0x10'));var authService=require(_0xc4e6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4e6('0x12'));var logger=require(_0xc4e6('0x13'))(_0xc4e6('0x14'));var utils=require(_0xc4e6('0x15'));var config=require(_0xc4e6('0x16'));var licenseUtil=require(_0xc4e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7320,_0x2dbeda){_0x2dbeda=_0x2dbeda||0xcc;return function(_0x2eb83b){if(_0x2eb83b){return _0x1f7320['sendStatus'](_0x2dbeda);}return _0x1f7320[_0xc4e6('0x18')](_0x2dbeda)[_0xc4e6('0x19')]();};}function respondWithResult(_0x4d4ee1,_0x5282f2){_0x5282f2=_0x5282f2||0xc8;return function(_0x177f28){if(_0x177f28){return _0x4d4ee1[_0xc4e6('0x18')](_0x5282f2)[_0xc4e6('0x1a')](_0x177f28);}};}function respondWithFilteredResult(_0x4c8c68,_0x45dceb){return function(_0x2600be){if(_0x2600be){var _0x41412b=typeof _0x45dceb[_0xc4e6('0x1b')]===_0xc4e6('0x1c')&&typeof _0x45dceb['limit']===_0xc4e6('0x1c');var _0x327747=_0x2600be[_0xc4e6('0x1d')];var _0x7795e5=_0x41412b?0x0:_0x45dceb[_0xc4e6('0x1b')];var _0x490f06=_0x41412b?_0x2600be[_0xc4e6('0x1d')]:_0x45dceb[_0xc4e6('0x1b')]+_0x45dceb['limit'];var _0x5e7678;if(_0x490f06>=_0x327747){_0x490f06=_0x327747;_0x5e7678=0xc8;}else{_0x5e7678=0xce;}_0x4c8c68[_0xc4e6('0x18')](_0x5e7678);return _0x4c8c68[_0xc4e6('0x1e')](_0xc4e6('0x1f'),_0x7795e5+'-'+_0x490f06+'/'+_0x327747)[_0xc4e6('0x1a')](_0x2600be);}return null;};}function patchUpdates(_0x56c732){return function(_0x351d7b){try{jsonpatch['apply'](_0x351d7b,_0x56c732,!![]);}catch(_0x3b6198){return BPromise[_0xc4e6('0x20')](_0x3b6198);}return _0x351d7b[_0xc4e6('0x21')]();};}function saveUpdates(_0x1b3d13,_0x155485){return function(_0x3cebea){if(_0x3cebea){return _0x3cebea['update'](_0x1b3d13)[_0xc4e6('0x22')](function(_0x440e7a){return _0x440e7a;});}return null;};}function removeEntity(_0x2e25b8,_0x21fc0c){return function(_0x587495){if(_0x587495){return _0x587495[_0xc4e6('0x23')]()[_0xc4e6('0x22')](function(){_0x2e25b8[_0xc4e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e86b,_0x40a64d){return function(_0x3802ee){if(!_0x3802ee){_0x39e86b['sendStatus'](0x194);}return _0x3802ee;};}function handleError(_0xebae20,_0x460b70){_0x460b70=_0x460b70||0x1f4;return function(_0x2d1f53){logger[_0xc4e6('0x24')](_0x2d1f53[_0xc4e6('0x25')]);if(_0x2d1f53[_0xc4e6('0x26')]){delete _0x2d1f53[_0xc4e6('0x26')];}_0xebae20[_0xc4e6('0x18')](_0x460b70)[_0xc4e6('0x27')](_0x2d1f53);};}exports[_0xc4e6('0x28')]=function(_0x4fb590,_0xe4bf53){var _0x2563c7={},_0x393b6f={},_0x445eda={'count':0x0,'rows':[]};var _0x1559fa=_[_0xc4e6('0x29')](db['MailServerOut'][_0xc4e6('0x2a')],function(_0x15af38){return{'name':_0x15af38[_0xc4e6('0x2b')],'type':_0x15af38[_0xc4e6('0x2c')][_0xc4e6('0x2d')]};});_0x393b6f[_0xc4e6('0x2e')]=_[_0xc4e6('0x29')](_0x1559fa,_0xc4e6('0x26'));_0x393b6f['query']=_['keys'](_0x4fb590[_0xc4e6('0x2f')]);_0x393b6f[_0xc4e6('0x30')]=_[_0xc4e6('0x31')](_0x393b6f[_0xc4e6('0x2e')],_0x393b6f[_0xc4e6('0x2f')]);_0x2563c7[_0xc4e6('0x32')]=_[_0xc4e6('0x31')](_0x393b6f[_0xc4e6('0x2e')],qs[_0xc4e6('0x33')](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x33')]));_0x2563c7[_0xc4e6('0x32')]=_0x2563c7['attributes'][_0xc4e6('0x34')]?_0x2563c7[_0xc4e6('0x32')]:_0x393b6f[_0xc4e6('0x2e')];if(!_0x4fb590[_0xc4e6('0x2f')]['hasOwnProperty'](_0xc4e6('0x35'))){_0x2563c7['limit']=qs['limit'](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x36')]);_0x2563c7['offset']=qs['offset'](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x1b')]);}_0x2563c7[_0xc4e6('0x37')]=qs[_0xc4e6('0x38')](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x38')]);_0x2563c7[_0xc4e6('0x39')]=qs[_0xc4e6('0x30')](_[_0xc4e6('0x3a')](_0x4fb590[_0xc4e6('0x2f')],_0x393b6f[_0xc4e6('0x30')]),_0x1559fa);if(_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x3b')]){_0x2563c7[_0xc4e6('0x39')]=_[_0xc4e6('0x3c')](_0x2563c7[_0xc4e6('0x39')],{'$or':_[_0xc4e6('0x29')](_0x1559fa,function(_0x14ea0a){if(_0x14ea0a['type']!==_0xc4e6('0x3d')){var _0x491f8d={};_0x491f8d[_0x14ea0a[_0xc4e6('0x26')]]={'$like':'%'+_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x3b')]+'%'};return _0x491f8d;}})});}_0x2563c7=_[_0xc4e6('0x3c')]({},_0x2563c7,_0x4fb590['options']);var _0x928b5f={'where':_0x2563c7[_0xc4e6('0x39')]};return db[_0xc4e6('0x3e')][_0xc4e6('0x1d')](_0x928b5f)[_0xc4e6('0x22')](function(_0x3c3336){_0x445eda['count']=_0x3c3336;if(_0x4fb590[_0xc4e6('0x2f')]['includeAll']){_0x2563c7[_0xc4e6('0x3f')]=[{'all':!![]}];}return db[_0xc4e6('0x3e')]['findAll'](_0x2563c7);})[_0xc4e6('0x22')](function(_0x259c13){_0x445eda[_0xc4e6('0x40')]=_0x259c13;return _0x445eda;})[_0xc4e6('0x22')](respondWithFilteredResult(_0xe4bf53,_0x2563c7))[_0xc4e6('0x41')](handleError(_0xe4bf53,null));};exports[_0xc4e6('0x42')]=function(_0xadde92,_0x59228a){var _0xe801fd={'raw':!![],'where':{'id':_0xadde92['params']['id']}},_0x534ad5={};_0x534ad5[_0xc4e6('0x2e')]=_[_0xc4e6('0x43')](db['MailServerOut'][_0xc4e6('0x2a')]);_0x534ad5[_0xc4e6('0x2f')]=_[_0xc4e6('0x43')](_0xadde92['query']);_0x534ad5[_0xc4e6('0x30')]=_[_0xc4e6('0x31')](_0x534ad5[_0xc4e6('0x2e')],_0x534ad5[_0xc4e6('0x2f')]);_0xe801fd[_0xc4e6('0x32')]=_[_0xc4e6('0x31')](_0x534ad5[_0xc4e6('0x2e')],qs[_0xc4e6('0x33')](_0xadde92[_0xc4e6('0x2f')][_0xc4e6('0x33')]));_0xe801fd[_0xc4e6('0x32')]=_0xe801fd[_0xc4e6('0x32')][_0xc4e6('0x34')]?_0xe801fd[_0xc4e6('0x32')]:_0x534ad5[_0xc4e6('0x2e')];if(_0xadde92['query'][_0xc4e6('0x44')]){_0xe801fd[_0xc4e6('0x3f')]=[{'all':!![]}];}_0xe801fd=_[_0xc4e6('0x3c')]({},_0xe801fd,_0xadde92[_0xc4e6('0x45')]);return db[_0xc4e6('0x3e')][_0xc4e6('0x46')](_0xe801fd)[_0xc4e6('0x22')](handleEntityNotFound(_0x59228a,null))[_0xc4e6('0x22')](respondWithResult(_0x59228a,null))[_0xc4e6('0x41')](handleError(_0x59228a,null));};exports[_0xc4e6('0x47')]=function(_0x100e56,_0x3bede1){return db[_0xc4e6('0x3e')][_0xc4e6('0x47')](_0x100e56[_0xc4e6('0x48')],{})[_0xc4e6('0x22')](respondWithResult(_0x3bede1,0xc9))['catch'](handleError(_0x3bede1,null));};exports[_0xc4e6('0x49')]=function(_0x5aac57,_0x167631){if(_0x5aac57[_0xc4e6('0x48')]['id']){delete _0x5aac57['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x5aac57['params']['id']}})[_0xc4e6('0x22')](handleEntityNotFound(_0x167631,null))['then'](saveUpdates(_0x5aac57['body'],null))[_0xc4e6('0x22')](respondWithResult(_0x167631,null))[_0xc4e6('0x41')](handleError(_0x167631,null));};exports[_0xc4e6('0x23')]=function(_0x478b02,_0x575398){return db['MailServerOut'][_0xc4e6('0x46')]({'where':{'id':_0x478b02[_0xc4e6('0x4a')]['id']}})[_0xc4e6('0x22')](handleEntityNotFound(_0x575398,null))[_0xc4e6('0x22')](removeEntity(_0x575398,null))[_0xc4e6('0x41')](handleError(_0x575398,null));}; \ No newline at end of file +var _0x6a36=['reject','save','then','end','error','name','send','index','MailServerOut','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','includeAll','findAll','catch','params','include','options','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x3f7a3f,_0x477495){var _0x30c932=function(_0x47ca52){while(--_0x47ca52){_0x3f7a3f['push'](_0x3f7a3f['shift']());}};_0x30c932(++_0x477495);}(_0x6a36,0x14c));var _0x66a3=function(_0x2a1c38,_0x2bf01e){_0x2a1c38=_0x2a1c38-0x0;var _0x10d767=_0x6a36[_0x2a1c38];return _0x10d767;};'use strict';var emlformat=require(_0x66a3('0x0'));var rimraf=require(_0x66a3('0x1'));var zipdir=require(_0x66a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66a3('0x3'));var moment=require('moment');var BPromise=require(_0x66a3('0x4'));var Mustache=require(_0x66a3('0x5'));var util=require('util');var path=require(_0x66a3('0x6'));var sox=require(_0x66a3('0x7'));var csv=require('to-csv');var ejs=require(_0x66a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66a3('0x9'));var squel=require(_0x66a3('0xa'));var crypto=require('crypto');var jsforce=require(_0x66a3('0xb'));var deskjs=require(_0x66a3('0xc'));var toCsv=require(_0x66a3('0xd'));var querystring=require(_0x66a3('0xe'));var Papa=require(_0x66a3('0xf'));var Redis=require(_0x66a3('0x10'));var authService=require(_0x66a3('0x11'));var qs=require(_0x66a3('0x12'));var as=require(_0x66a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66a3('0x14'))(_0x66a3('0x15'));var utils=require('../../config/utils');var config=require(_0x66a3('0x16'));var licenseUtil=require(_0x66a3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dd2aa,_0x4d4052){_0x4d4052=_0x4d4052||0xcc;return function(_0x3efe1b){if(_0x3efe1b){return _0x1dd2aa[_0x66a3('0x18')](_0x4d4052);}return _0x1dd2aa[_0x66a3('0x19')](_0x4d4052)['end']();};}function respondWithResult(_0x1b7144,_0x3736f8){_0x3736f8=_0x3736f8||0xc8;return function(_0x1cfdf7){if(_0x1cfdf7){return _0x1b7144[_0x66a3('0x19')](_0x3736f8)[_0x66a3('0x1a')](_0x1cfdf7);}};}function respondWithFilteredResult(_0x3dcf7f,_0xe5ee7e){return function(_0x164aee){if(_0x164aee){var _0x58046a=typeof _0xe5ee7e['offset']===_0x66a3('0x1b')&&typeof _0xe5ee7e[_0x66a3('0x1c')]===_0x66a3('0x1b');var _0x5029c8=_0x164aee[_0x66a3('0x1d')];var _0x5100a4=_0x58046a?0x0:_0xe5ee7e[_0x66a3('0x1e')];var _0xffe145=_0x58046a?_0x164aee[_0x66a3('0x1d')]:_0xe5ee7e[_0x66a3('0x1e')]+_0xe5ee7e[_0x66a3('0x1c')];var _0x2f0d74;if(_0xffe145>=_0x5029c8){_0xffe145=_0x5029c8;_0x2f0d74=0xc8;}else{_0x2f0d74=0xce;}_0x3dcf7f[_0x66a3('0x19')](_0x2f0d74);return _0x3dcf7f[_0x66a3('0x1f')](_0x66a3('0x20'),_0x5100a4+'-'+_0xffe145+'/'+_0x5029c8)['json'](_0x164aee);}return null;};}function patchUpdates(_0x1ad558){return function(_0x175ca5){try{jsonpatch['apply'](_0x175ca5,_0x1ad558,!![]);}catch(_0x18d1a3){return BPromise[_0x66a3('0x21')](_0x18d1a3);}return _0x175ca5[_0x66a3('0x22')]();};}function saveUpdates(_0x5a1fba,_0x3110c9){return function(_0x5406c9){if(_0x5406c9){return _0x5406c9['update'](_0x5a1fba)['then'](function(_0x2eaca0){return _0x2eaca0;});}return null;};}function removeEntity(_0x4a2706,_0x58192b){return function(_0xd4a75a){if(_0xd4a75a){return _0xd4a75a['destroy']()[_0x66a3('0x23')](function(){_0x4a2706[_0x66a3('0x19')](0xcc)[_0x66a3('0x24')]();});}};}function handleEntityNotFound(_0x164f67,_0x57574d){return function(_0x16d23f){if(!_0x16d23f){_0x164f67['sendStatus'](0x194);}return _0x16d23f;};}function handleError(_0x3dc28d,_0x29bc16){_0x29bc16=_0x29bc16||0x1f4;return function(_0x4b4396){logger[_0x66a3('0x25')](_0x4b4396['stack']);if(_0x4b4396['name']){delete _0x4b4396[_0x66a3('0x26')];}_0x3dc28d[_0x66a3('0x19')](_0x29bc16)[_0x66a3('0x27')](_0x4b4396);};}exports[_0x66a3('0x28')]=function(_0x559b07,_0x2e6190){var _0x3fe8a3={},_0x5b2b3e={},_0x4a9809={'count':0x0,'rows':[]};var _0x17e42c=_['map'](db[_0x66a3('0x29')][_0x66a3('0x2a')],function(_0x5a448e){return{'name':_0x5a448e[_0x66a3('0x2b')],'type':_0x5a448e[_0x66a3('0x2c')]['key']};});_0x5b2b3e[_0x66a3('0x2d')]=_['map'](_0x17e42c,_0x66a3('0x26'));_0x5b2b3e['query']=_[_0x66a3('0x2e')](_0x559b07[_0x66a3('0x2f')]);_0x5b2b3e['filters']=_[_0x66a3('0x30')](_0x5b2b3e[_0x66a3('0x2d')],_0x5b2b3e[_0x66a3('0x2f')]);_0x3fe8a3[_0x66a3('0x31')]=_[_0x66a3('0x30')](_0x5b2b3e['model'],qs[_0x66a3('0x32')](_0x559b07[_0x66a3('0x2f')][_0x66a3('0x32')]));_0x3fe8a3[_0x66a3('0x31')]=_0x3fe8a3[_0x66a3('0x31')][_0x66a3('0x33')]?_0x3fe8a3[_0x66a3('0x31')]:_0x5b2b3e[_0x66a3('0x2d')];if(!_0x559b07['query'][_0x66a3('0x34')](_0x66a3('0x35'))){_0x3fe8a3['limit']=qs[_0x66a3('0x1c')](_0x559b07[_0x66a3('0x2f')]['limit']);_0x3fe8a3[_0x66a3('0x1e')]=qs['offset'](_0x559b07[_0x66a3('0x2f')][_0x66a3('0x1e')]);}_0x3fe8a3[_0x66a3('0x36')]=qs[_0x66a3('0x37')](_0x559b07[_0x66a3('0x2f')]['sort']);_0x3fe8a3['where']=qs[_0x66a3('0x38')](_[_0x66a3('0x39')](_0x559b07['query'],_0x5b2b3e[_0x66a3('0x38')]),_0x17e42c);if(_0x559b07[_0x66a3('0x2f')][_0x66a3('0x3a')]){_0x3fe8a3[_0x66a3('0x3b')]=_[_0x66a3('0x3c')](_0x3fe8a3[_0x66a3('0x3b')],{'$or':_[_0x66a3('0x3d')](_0x17e42c,function(_0x1e9b6a){if(_0x1e9b6a[_0x66a3('0x2c')]!==_0x66a3('0x3e')){var _0x15b8fc={};_0x15b8fc[_0x1e9b6a[_0x66a3('0x26')]]={'$like':'%'+_0x559b07[_0x66a3('0x2f')][_0x66a3('0x3a')]+'%'};return _0x15b8fc;}})});}_0x3fe8a3=_['merge']({},_0x3fe8a3,_0x559b07['options']);var _0x3ae325={'where':_0x3fe8a3[_0x66a3('0x3b')]};return db[_0x66a3('0x29')][_0x66a3('0x1d')](_0x3ae325)[_0x66a3('0x23')](function(_0x35de09){_0x4a9809[_0x66a3('0x1d')]=_0x35de09;if(_0x559b07['query'][_0x66a3('0x3f')]){_0x3fe8a3['include']=[{'all':!![]}];}return db['MailServerOut'][_0x66a3('0x40')](_0x3fe8a3);})[_0x66a3('0x23')](function(_0xacaa81){_0x4a9809['rows']=_0xacaa81;return _0x4a9809;})[_0x66a3('0x23')](respondWithFilteredResult(_0x2e6190,_0x3fe8a3))[_0x66a3('0x41')](handleError(_0x2e6190,null));};exports['show']=function(_0x131261,_0x3dc046){var _0x9691f={'raw':!![],'where':{'id':_0x131261[_0x66a3('0x42')]['id']}},_0x1d5403={};_0x1d5403['model']=_[_0x66a3('0x2e')](db[_0x66a3('0x29')][_0x66a3('0x2a')]);_0x1d5403[_0x66a3('0x2f')]=_[_0x66a3('0x2e')](_0x131261[_0x66a3('0x2f')]);_0x1d5403['filters']=_[_0x66a3('0x30')](_0x1d5403[_0x66a3('0x2d')],_0x1d5403[_0x66a3('0x2f')]);_0x9691f[_0x66a3('0x31')]=_[_0x66a3('0x30')](_0x1d5403[_0x66a3('0x2d')],qs[_0x66a3('0x32')](_0x131261[_0x66a3('0x2f')][_0x66a3('0x32')]));_0x9691f[_0x66a3('0x31')]=_0x9691f['attributes'][_0x66a3('0x33')]?_0x9691f['attributes']:_0x1d5403[_0x66a3('0x2d')];if(_0x131261[_0x66a3('0x2f')][_0x66a3('0x3f')]){_0x9691f[_0x66a3('0x43')]=[{'all':!![]}];}_0x9691f=_[_0x66a3('0x3c')]({},_0x9691f,_0x131261[_0x66a3('0x44')]);return db[_0x66a3('0x29')][_0x66a3('0x45')](_0x9691f)[_0x66a3('0x23')](handleEntityNotFound(_0x3dc046,null))[_0x66a3('0x23')](respondWithResult(_0x3dc046,null))[_0x66a3('0x41')](handleError(_0x3dc046,null));};exports[_0x66a3('0x46')]=function(_0x7cb2f1,_0xfe4dba){return db[_0x66a3('0x29')][_0x66a3('0x46')](_0x7cb2f1[_0x66a3('0x47')],{})['then'](respondWithResult(_0xfe4dba,0xc9))[_0x66a3('0x41')](handleError(_0xfe4dba,null));};exports[_0x66a3('0x48')]=function(_0x154ad9,_0x4d6c91){if(_0x154ad9[_0x66a3('0x47')]['id']){delete _0x154ad9[_0x66a3('0x47')]['id'];}return db['MailServerOut'][_0x66a3('0x45')]({'where':{'id':_0x154ad9[_0x66a3('0x42')]['id']}})[_0x66a3('0x23')](handleEntityNotFound(_0x4d6c91,null))['then'](saveUpdates(_0x154ad9[_0x66a3('0x47')],null))[_0x66a3('0x23')](respondWithResult(_0x4d6c91,null))[_0x66a3('0x41')](handleError(_0x4d6c91,null));};exports['destroy']=function(_0x1d07ad,_0x4c5289){return db['MailServerOut'][_0x66a3('0x45')]({'where':{'id':_0x1d07ad[_0x66a3('0x42')]['id']}})[_0x66a3('0x23')](handleEntityNotFound(_0x4c5289,null))[_0x66a3('0x23')](removeEntity(_0x4c5289,null))['catch'](handleError(_0x4c5289,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9394064..6ba7336 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 _0x9076=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x53cada,_0x1627bc){var _0x48a99e=function(_0x3a1d0f){while(--_0x3a1d0f){_0x53cada['push'](_0x53cada['shift']());}};_0x48a99e(++_0x1627bc);}(_0x9076,0x1d5));var _0x6907=function(_0x218ab0,_0x165282){_0x218ab0=_0x218ab0-0x0;var _0x27ec8e=_0x9076[_0x218ab0];return _0x27ec8e;};'use strict';var _=require(_0x6907('0x0'));var util=require(_0x6907('0x1'));var logger=require(_0x6907('0x2'))(_0x6907('0x3'));var moment=require(_0x6907('0x4'));var BPromise=require(_0x6907('0x5'));var rp=require(_0x6907('0x6'));var fs=require('fs');var path=require(_0x6907('0x7'));var rimraf=require(_0x6907('0x8'));var config=require('../../config/environment');var attributes=require(_0x6907('0x9'));module[_0x6907('0xa')]=function(_0xb01168,_0x5c8309){return _0xb01168['define'](_0x6907('0xb'),attributes,{'tableName':_0x6907('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fe=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','mail_servers_out'];(function(_0x2b4e1d,_0x169c3a){var _0x1b08e0=function(_0x43c7bc){while(--_0x43c7bc){_0x2b4e1d['push'](_0x2b4e1d['shift']());}};_0x1b08e0(++_0x169c3a);}(_0x98fe,0x1a4));var _0xe98f=function(_0x455657,_0x260409){_0x455657=_0x455657-0x0;var _0x16ead7=_0x98fe[_0x455657];return _0x16ead7;};'use strict';var _=require('lodash');var util=require(_0xe98f('0x0'));var logger=require(_0xe98f('0x1'))(_0xe98f('0x2'));var moment=require('moment');var BPromise=require(_0xe98f('0x3'));var rp=require(_0xe98f('0x4'));var fs=require('fs');var path=require(_0xe98f('0x5'));var rimraf=require(_0xe98f('0x6'));var config=require(_0xe98f('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xe98f('0x8')]=function(_0x17a434,_0x66aed6){return _0x17a434['define']('MailServerOut',attributes,{'tableName':_0xe98f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 34a6ba1..e617db6 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1d2e48,_0x54394a){_0x1d2e48=_0x1d2e48-0x0;var _0x1e3980=_0x7a54[_0x1d2e48];return _0x1e3980;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x192979,_0x1448da){var _0x39aeb3=function(_0x35bdbd){while(--_0x35bdbd){_0x192979['push'](_0x192979['shift']());}};_0x39aeb3(++_0x1448da);}(_0xdb28,0x106));var _0x8db2=function(_0x1c578c,_0x543dc3){_0x1c578c=_0x1c578c-0x0;var _0x3321db=_0xdb28[_0x1c578c];return _0x3321db;};'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 437ed62..a523404 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 _0xd3e9=['get','describe','/:id','show','create','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xd3e9,0x1c2));var _0x9d3e=function(_0x54c8a8,_0xcab4ac){_0x54c8a8=_0x54c8a8-0x0;var _0x38940c=_0xd3e9[_0x54c8a8];return _0x38940c;};'use strict';var multer=require(_0x9d3e('0x0'));var util=require(_0x9d3e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d3e('0x2'));var router=express['Router']();var fs_extra=require(_0x9d3e('0x3'));var auth=require(_0x9d3e('0x4'));var interaction=require(_0x9d3e('0x5'));var config=require(_0x9d3e('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0x8')]);router[_0x9d3e('0x9')]('/describe',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xa')]);router[_0x9d3e('0x9')](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xc')]);router['post']('/',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xd')]);router['put'](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller['update']);router[_0x9d3e('0xe')](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xf')]);module[_0x9d3e('0x10')]=router; \ No newline at end of file +var _0x457d=['show','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x10660d,_0x4a600a){var _0xa1fc9f=function(_0x1460f0){while(--_0x1460f0){_0x10660d['push'](_0x10660d['shift']());}};_0xa1fc9f(++_0x4a600a);}(_0x457d,0xff));var _0xd457=function(_0x95860d,_0x19e303){_0x95860d=_0x95860d-0x0;var _0xbd5e42=_0x457d[_0x95860d];return _0xbd5e42;};'use strict';var multer=require(_0xd457('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd457('0x1'));var express=require(_0xd457('0x2'));var router=express[_0xd457('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd457('0x4'));var config=require(_0xd457('0x5'));var controller=require(_0xd457('0x6'));router[_0xd457('0x7')]('/',auth[_0xd457('0x8')](),controller[_0xd457('0x9')]);router[_0xd457('0x7')](_0xd457('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd457('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd457('0xb')]);router[_0xd457('0xc')]('/',auth[_0xd457('0x8')](),controller['create']);router[_0xd457('0xd')](_0xd457('0xe'),auth[_0xd457('0x8')](),controller[_0xd457('0xf')]);router[_0xd457('0x10')](_0xd457('0xe'),auth[_0xd457('0x8')](),controller[_0xd457('0x11')]);module[_0xd457('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8148b86..52ef6cb 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 _0x7409=['name','STRING','sequelize','exports'];(function(_0x13c62e,_0x45b94c){var _0x1a4050=function(_0x5790e2){while(--_0x5790e2){_0x13c62e['push'](_0x13c62e['shift']());}};_0x1a4050(++_0x45b94c);}(_0x7409,0x6e));var _0x9740=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x7409[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9740('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9740('0x3')]}}; \ No newline at end of file +var _0x4300=['sequelize'];(function(_0xb9f9d0,_0x33edd1){var _0x2351e5=function(_0x5e0d08){while(--_0x5e0d08){_0xb9f9d0['push'](_0xb9f9d0['shift']());}};_0x2351e5(++_0x33edd1);}(_0x4300,0x1a6));var _0x0430=function(_0x4b2bef,_0xb2209){_0x4b2bef=_0x4b2bef-0x0;var _0x279037=_0x4300[_0x4b2bef];return _0x279037;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6ed5001..a283bae 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 _0xe903=['body','find','params','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','error','name','send','index','map','MailSubstatus','rawAttributes','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','fields','create'];(function(_0x2573b9,_0x752002){var _0x4a9dd6=function(_0x39ebbd){while(--_0x39ebbd){_0x2573b9['push'](_0x2573b9['shift']());}};_0x4a9dd6(++_0x752002);}(_0xe903,0x99));var _0x3e90=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xe903[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x3e90('0x0'));var rimraf=require(_0x3e90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e90('0x2'));var rp=require('request-promise');var moment=require(_0x3e90('0x3'));var BPromise=require(_0x3e90('0x4'));var Mustache=require('mustache');var util=require(_0x3e90('0x5'));var path=require('path');var sox=require(_0x3e90('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e90('0x7'));var squel=require('squel');var crypto=require(_0x3e90('0x8'));var jsforce=require(_0x3e90('0x9'));var deskjs=require(_0x3e90('0xa'));var toCsv=require(_0x3e90('0xb'));var querystring=require(_0x3e90('0xc'));var Papa=require(_0x3e90('0xd'));var Redis=require(_0x3e90('0xe'));var authService=require(_0x3e90('0xf'));var qs=require(_0x3e90('0x10'));var as=require(_0x3e90('0x11'));var hardwareService=require(_0x3e90('0x12'));var logger=require(_0x3e90('0x13'))(_0x3e90('0x14'));var utils=require(_0x3e90('0x15'));var config=require(_0x3e90('0x16'));var licenseUtil=require(_0x3e90('0x17'));var db=require(_0x3e90('0x18'))['db'];function respondWithStatusCode(_0x5613aa,_0x45fe52){_0x45fe52=_0x45fe52||0xcc;return function(_0x376886){if(_0x376886){return _0x5613aa[_0x3e90('0x19')](_0x45fe52);}return _0x5613aa['status'](_0x45fe52)[_0x3e90('0x1a')]();};}function respondWithResult(_0x43faa1,_0x25b6ce){_0x25b6ce=_0x25b6ce||0xc8;return function(_0xb738e1){if(_0xb738e1){return _0x43faa1['status'](_0x25b6ce)[_0x3e90('0x1b')](_0xb738e1);}};}function respondWithFilteredResult(_0x470817,_0x287576){return function(_0x4c3cdf){if(_0x4c3cdf){var _0x2ea215=typeof _0x287576['offset']===_0x3e90('0x1c')&&typeof _0x287576[_0x3e90('0x1d')]===_0x3e90('0x1c');var _0x35ccce=_0x4c3cdf[_0x3e90('0x1e')];var _0xb618c8=_0x2ea215?0x0:_0x287576[_0x3e90('0x1f')];var _0x4cac37=_0x2ea215?_0x4c3cdf[_0x3e90('0x1e')]:_0x287576[_0x3e90('0x1f')]+_0x287576[_0x3e90('0x1d')];var _0x25e80f;if(_0x4cac37>=_0x35ccce){_0x4cac37=_0x35ccce;_0x25e80f=0xc8;}else{_0x25e80f=0xce;}_0x470817[_0x3e90('0x20')](_0x25e80f);return _0x470817[_0x3e90('0x21')](_0x3e90('0x22'),_0xb618c8+'-'+_0x4cac37+'/'+_0x35ccce)[_0x3e90('0x1b')](_0x4c3cdf);}return null;};}function patchUpdates(_0x2bae7f){return function(_0x1fd982){try{jsonpatch['apply'](_0x1fd982,_0x2bae7f,!![]);}catch(_0x3a43ce){return BPromise['reject'](_0x3a43ce);}return _0x1fd982['save']();};}function saveUpdates(_0x3e6216,_0x24acf5){return function(_0x591e83){if(_0x591e83){return _0x591e83[_0x3e90('0x23')](_0x3e6216)['then'](function(_0x26b770){return _0x26b770;});}return null;};}function removeEntity(_0x3f643d,_0x18117e){return function(_0x443d4a){if(_0x443d4a){return _0x443d4a['destroy']()[_0x3e90('0x24')](function(){_0x3f643d['status'](0xcc)[_0x3e90('0x1a')]();});}};}function handleEntityNotFound(_0x824915,_0x35120d){return function(_0x59cae5){if(!_0x59cae5){_0x824915['sendStatus'](0x194);}return _0x59cae5;};}function handleError(_0xe80aee,_0x26a00d){_0x26a00d=_0x26a00d||0x1f4;return function(_0x8d10a5){logger[_0x3e90('0x25')](_0x8d10a5['stack']);if(_0x8d10a5[_0x3e90('0x26')]){delete _0x8d10a5[_0x3e90('0x26')];}_0xe80aee[_0x3e90('0x20')](_0x26a00d)[_0x3e90('0x27')](_0x8d10a5);};}exports[_0x3e90('0x28')]=function(_0x3287a1,_0x1755e7){var _0x1ba70e={},_0x540584={},_0x4507f3={'count':0x0,'rows':[]};var _0x5d0fe3=_[_0x3e90('0x29')](db[_0x3e90('0x2a')][_0x3e90('0x2b')],function(_0x36123b){return{'name':_0x36123b['fieldName'],'type':_0x36123b['type'][_0x3e90('0x2c')]};});_0x540584[_0x3e90('0x2d')]=_[_0x3e90('0x29')](_0x5d0fe3,_0x3e90('0x26'));_0x540584[_0x3e90('0x2e')]=_[_0x3e90('0x2f')](_0x3287a1[_0x3e90('0x2e')]);_0x540584[_0x3e90('0x30')]=_['intersection'](_0x540584[_0x3e90('0x2d')],_0x540584[_0x3e90('0x2e')]);_0x1ba70e[_0x3e90('0x31')]=_[_0x3e90('0x32')](_0x540584[_0x3e90('0x2d')],qs['fields'](_0x3287a1[_0x3e90('0x2e')]['fields']));_0x1ba70e[_0x3e90('0x31')]=_0x1ba70e[_0x3e90('0x31')][_0x3e90('0x33')]?_0x1ba70e[_0x3e90('0x31')]:_0x540584[_0x3e90('0x2d')];if(!_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x34')](_0x3e90('0x35'))){_0x1ba70e[_0x3e90('0x1d')]=qs[_0x3e90('0x1d')](_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x1d')]);_0x1ba70e['offset']=qs[_0x3e90('0x1f')](_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x1f')]);}_0x1ba70e[_0x3e90('0x36')]=qs['sort'](_0x3287a1['query'][_0x3e90('0x37')]);_0x1ba70e['where']=qs[_0x3e90('0x30')](_[_0x3e90('0x38')](_0x3287a1[_0x3e90('0x2e')],_0x540584[_0x3e90('0x30')]),_0x5d0fe3);if(_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x39')]){_0x1ba70e[_0x3e90('0x3a')]=_[_0x3e90('0x3b')](_0x1ba70e[_0x3e90('0x3a')],{'$or':_[_0x3e90('0x29')](_0x5d0fe3,function(_0x381253){if(_0x381253[_0x3e90('0x3c')]!==_0x3e90('0x3d')){var _0xf8b22f={};_0xf8b22f[_0x381253[_0x3e90('0x26')]]={'$like':'%'+_0x3287a1[_0x3e90('0x2e')]['filter']+'%'};return _0xf8b22f;}})});}_0x1ba70e=_[_0x3e90('0x3b')]({},_0x1ba70e,_0x3287a1[_0x3e90('0x3e')]);var _0x1c239f={'where':_0x1ba70e[_0x3e90('0x3a')]};return db[_0x3e90('0x2a')][_0x3e90('0x1e')](_0x1c239f)[_0x3e90('0x24')](function(_0x30ce3e){_0x4507f3[_0x3e90('0x1e')]=_0x30ce3e;if(_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x3f')]){_0x1ba70e[_0x3e90('0x40')]=[{'all':!![]}];}return db[_0x3e90('0x2a')][_0x3e90('0x41')](_0x1ba70e);})['then'](function(_0x48fd16){_0x4507f3['rows']=_0x48fd16;return _0x4507f3;})[_0x3e90('0x24')](respondWithFilteredResult(_0x1755e7,_0x1ba70e))[_0x3e90('0x42')](handleError(_0x1755e7,null));};exports['show']=function(_0x519420,_0x59516c){var _0x1d46bc={'raw':!![],'where':{'id':_0x519420['params']['id']}},_0x39a8e0={};_0x39a8e0[_0x3e90('0x2d')]=_[_0x3e90('0x2f')](db['MailSubstatus'][_0x3e90('0x2b')]);_0x39a8e0[_0x3e90('0x2e')]=_[_0x3e90('0x2f')](_0x519420[_0x3e90('0x2e')]);_0x39a8e0['filters']=_[_0x3e90('0x32')](_0x39a8e0[_0x3e90('0x2d')],_0x39a8e0['query']);_0x1d46bc[_0x3e90('0x31')]=_['intersection'](_0x39a8e0['model'],qs['fields'](_0x519420[_0x3e90('0x2e')][_0x3e90('0x43')]));_0x1d46bc[_0x3e90('0x31')]=_0x1d46bc[_0x3e90('0x31')]['length']?_0x1d46bc[_0x3e90('0x31')]:_0x39a8e0['model'];if(_0x519420[_0x3e90('0x2e')][_0x3e90('0x3f')]){_0x1d46bc[_0x3e90('0x40')]=[{'all':!![]}];}_0x1d46bc=_[_0x3e90('0x3b')]({},_0x1d46bc,_0x519420['options']);return db[_0x3e90('0x2a')]['find'](_0x1d46bc)[_0x3e90('0x24')](handleEntityNotFound(_0x59516c,null))[_0x3e90('0x24')](respondWithResult(_0x59516c,null))[_0x3e90('0x42')](handleError(_0x59516c,null));};exports['create']=function(_0x3ff9db,_0x57ac08){return db[_0x3e90('0x2a')][_0x3e90('0x44')](_0x3ff9db['body'],{})[_0x3e90('0x24')](respondWithResult(_0x57ac08,0xc9))[_0x3e90('0x42')](handleError(_0x57ac08,null));};exports['update']=function(_0xa9aa8e,_0x26fd21){if(_0xa9aa8e[_0x3e90('0x45')]['id']){delete _0xa9aa8e['body']['id'];}return db['MailSubstatus'][_0x3e90('0x46')]({'where':{'id':_0xa9aa8e[_0x3e90('0x47')]['id']}})['then'](handleEntityNotFound(_0x26fd21,null))['then'](saveUpdates(_0xa9aa8e['body'],null))[_0x3e90('0x24')](respondWithResult(_0x26fd21,null))[_0x3e90('0x42')](handleError(_0x26fd21,null));};exports[_0x3e90('0x48')]=function(_0x21b09b,_0x5e8409){return db[_0x3e90('0x2a')][_0x3e90('0x46')]({'where':{'id':_0x21b09b[_0x3e90('0x47')]['id']}})[_0x3e90('0x24')](handleEntityNotFound(_0x5e8409,null))[_0x3e90('0x24')](removeEntity(_0x5e8409,null))['catch'](handleError(_0x5e8409,null));};exports[_0x3e90('0x49')]=function(_0x1ac184,_0x2d3643){return db['MailSubstatus'][_0x3e90('0x49')]()[_0x3e90('0x24')](respondWithResult(_0x2d3643,null))[_0x3e90('0x42')](handleError(_0x2d3643,null));}; \ No newline at end of file +var _0xc80d=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','MailSubstatus','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2981c1,_0x37815b){var _0x3eba8b=function(_0x5697c7){while(--_0x5697c7){_0x2981c1['push'](_0x2981c1['shift']());}};_0x3eba8b(++_0x37815b);}(_0xc80d,0x123));var _0xdc80=function(_0x1a390d,_0x205346){_0x1a390d=_0x1a390d-0x0;var _0x4bfade=_0xc80d[_0x1a390d];return _0x4bfade;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc80('0x0'));var zipdir=require(_0xdc80('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc80('0x2'));var moment=require(_0xdc80('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc80('0x4'));var util=require(_0xdc80('0x5'));var path=require(_0xdc80('0x6'));var sox=require(_0xdc80('0x7'));var csv=require('to-csv');var ejs=require(_0xdc80('0x8'));var fs=require('fs');var fs_extra=require(_0xdc80('0x9'));var _=require(_0xdc80('0xa'));var squel=require('squel');var crypto=require(_0xdc80('0xb'));var jsforce=require(_0xdc80('0xc'));var deskjs=require(_0xdc80('0xd'));var toCsv=require(_0xdc80('0xe'));var querystring=require(_0xdc80('0xf'));var Papa=require('papaparse');var Redis=require(_0xdc80('0x10'));var authService=require(_0xdc80('0x11'));var qs=require(_0xdc80('0x12'));var as=require(_0xdc80('0x13'));var hardwareService=require(_0xdc80('0x14'));var logger=require(_0xdc80('0x15'))(_0xdc80('0x16'));var utils=require(_0xdc80('0x17'));var config=require(_0xdc80('0x18'));var licenseUtil=require(_0xdc80('0x19'));var db=require(_0xdc80('0x1a'))['db'];function respondWithStatusCode(_0x45fa62,_0x18627a){_0x18627a=_0x18627a||0xcc;return function(_0x1bf18b){if(_0x1bf18b){return _0x45fa62[_0xdc80('0x1b')](_0x18627a);}return _0x45fa62[_0xdc80('0x1c')](_0x18627a)[_0xdc80('0x1d')]();};}function respondWithResult(_0x259ca9,_0x51900c){_0x51900c=_0x51900c||0xc8;return function(_0x53d666){if(_0x53d666){return _0x259ca9[_0xdc80('0x1c')](_0x51900c)[_0xdc80('0x1e')](_0x53d666);}};}function respondWithFilteredResult(_0x574c08,_0xdbf850){return function(_0x2eb96e){if(_0x2eb96e){var _0x30b8b0=typeof _0xdbf850[_0xdc80('0x1f')]===_0xdc80('0x20')&&typeof _0xdbf850[_0xdc80('0x21')]===_0xdc80('0x20');var _0x325d45=_0x2eb96e[_0xdc80('0x22')];var _0x3f4893=_0x30b8b0?0x0:_0xdbf850[_0xdc80('0x1f')];var _0x2d64dc=_0x30b8b0?_0x2eb96e[_0xdc80('0x22')]:_0xdbf850[_0xdc80('0x1f')]+_0xdbf850['limit'];var _0x1f081a;if(_0x2d64dc>=_0x325d45){_0x2d64dc=_0x325d45;_0x1f081a=0xc8;}else{_0x1f081a=0xce;}_0x574c08[_0xdc80('0x1c')](_0x1f081a);return _0x574c08[_0xdc80('0x23')](_0xdc80('0x24'),_0x3f4893+'-'+_0x2d64dc+'/'+_0x325d45)[_0xdc80('0x1e')](_0x2eb96e);}return null;};}function patchUpdates(_0x1b095d){return function(_0xa44c83){try{jsonpatch[_0xdc80('0x25')](_0xa44c83,_0x1b095d,!![]);}catch(_0x2e4916){return BPromise['reject'](_0x2e4916);}return _0xa44c83[_0xdc80('0x26')]();};}function saveUpdates(_0x10f6b6,_0x348b60){return function(_0x128fa4){if(_0x128fa4){return _0x128fa4[_0xdc80('0x27')](_0x10f6b6)['then'](function(_0x28bc4e){return _0x28bc4e;});}return null;};}function removeEntity(_0x278df1,_0x4fb6d0){return function(_0x5e8c00){if(_0x5e8c00){return _0x5e8c00[_0xdc80('0x28')]()[_0xdc80('0x29')](function(){_0x278df1[_0xdc80('0x1c')](0xcc)[_0xdc80('0x1d')]();});}};}function handleEntityNotFound(_0x23abcc,_0x911471){return function(_0x766640){if(!_0x766640){_0x23abcc[_0xdc80('0x1b')](0x194);}return _0x766640;};}function handleError(_0x2854a7,_0x1c2065){_0x1c2065=_0x1c2065||0x1f4;return function(_0x5eb11c){logger[_0xdc80('0x2a')](_0x5eb11c['stack']);if(_0x5eb11c[_0xdc80('0x2b')]){delete _0x5eb11c[_0xdc80('0x2b')];}_0x2854a7['status'](_0x1c2065)[_0xdc80('0x2c')](_0x5eb11c);};}exports[_0xdc80('0x2d')]=function(_0x12d970,_0x689d91){var _0x5043d0={},_0x300ee2={},_0x3bc210={'count':0x0,'rows':[]};var _0x46bd09=_['map'](db[_0xdc80('0x2e')]['rawAttributes'],function(_0x1436ba){return{'name':_0x1436ba[_0xdc80('0x2f')],'type':_0x1436ba[_0xdc80('0x30')]['key']};});_0x300ee2[_0xdc80('0x31')]=_[_0xdc80('0x32')](_0x46bd09,'name');_0x300ee2[_0xdc80('0x33')]=_[_0xdc80('0x34')](_0x12d970['query']);_0x300ee2['filters']=_[_0xdc80('0x35')](_0x300ee2['model'],_0x300ee2[_0xdc80('0x33')]);_0x5043d0[_0xdc80('0x36')]=_[_0xdc80('0x35')](_0x300ee2['model'],qs[_0xdc80('0x37')](_0x12d970[_0xdc80('0x33')][_0xdc80('0x37')]));_0x5043d0[_0xdc80('0x36')]=_0x5043d0['attributes'][_0xdc80('0x38')]?_0x5043d0[_0xdc80('0x36')]:_0x300ee2['model'];if(!_0x12d970['query']['hasOwnProperty'](_0xdc80('0x39'))){_0x5043d0[_0xdc80('0x21')]=qs[_0xdc80('0x21')](_0x12d970[_0xdc80('0x33')][_0xdc80('0x21')]);_0x5043d0[_0xdc80('0x1f')]=qs[_0xdc80('0x1f')](_0x12d970[_0xdc80('0x33')]['offset']);}_0x5043d0[_0xdc80('0x3a')]=qs[_0xdc80('0x3b')](_0x12d970[_0xdc80('0x33')]['sort']);_0x5043d0['where']=qs[_0xdc80('0x3c')](_[_0xdc80('0x3d')](_0x12d970[_0xdc80('0x33')],_0x300ee2['filters']),_0x46bd09);if(_0x12d970[_0xdc80('0x33')][_0xdc80('0x3e')]){_0x5043d0[_0xdc80('0x3f')]=_['merge'](_0x5043d0['where'],{'$or':_['map'](_0x46bd09,function(_0x5c6e8d){if(_0x5c6e8d[_0xdc80('0x30')]!==_0xdc80('0x40')){var _0x29fd98={};_0x29fd98[_0x5c6e8d[_0xdc80('0x2b')]]={'$like':'%'+_0x12d970[_0xdc80('0x33')][_0xdc80('0x3e')]+'%'};return _0x29fd98;}})});}_0x5043d0=_[_0xdc80('0x41')]({},_0x5043d0,_0x12d970[_0xdc80('0x42')]);var _0x19ea0c={'where':_0x5043d0[_0xdc80('0x3f')]};return db[_0xdc80('0x2e')][_0xdc80('0x22')](_0x19ea0c)[_0xdc80('0x29')](function(_0x21d84c){_0x3bc210[_0xdc80('0x22')]=_0x21d84c;if(_0x12d970['query'][_0xdc80('0x43')]){_0x5043d0[_0xdc80('0x44')]=[{'all':!![]}];}return db[_0xdc80('0x2e')][_0xdc80('0x45')](_0x5043d0);})['then'](function(_0x36ba75){_0x3bc210[_0xdc80('0x46')]=_0x36ba75;return _0x3bc210;})[_0xdc80('0x29')](respondWithFilteredResult(_0x689d91,_0x5043d0))[_0xdc80('0x47')](handleError(_0x689d91,null));};exports['show']=function(_0x50cf03,_0x1d6b10){var _0x1a47f5={'raw':!![],'where':{'id':_0x50cf03['params']['id']}},_0x13cb95={};_0x13cb95[_0xdc80('0x31')]=_['keys'](db[_0xdc80('0x2e')][_0xdc80('0x48')]);_0x13cb95[_0xdc80('0x33')]=_[_0xdc80('0x34')](_0x50cf03[_0xdc80('0x33')]);_0x13cb95['filters']=_[_0xdc80('0x35')](_0x13cb95[_0xdc80('0x31')],_0x13cb95[_0xdc80('0x33')]);_0x1a47f5[_0xdc80('0x36')]=_[_0xdc80('0x35')](_0x13cb95[_0xdc80('0x31')],qs['fields'](_0x50cf03[_0xdc80('0x33')]['fields']));_0x1a47f5[_0xdc80('0x36')]=_0x1a47f5['attributes'][_0xdc80('0x38')]?_0x1a47f5[_0xdc80('0x36')]:_0x13cb95[_0xdc80('0x31')];if(_0x50cf03['query']['includeAll']){_0x1a47f5['include']=[{'all':!![]}];}_0x1a47f5=_[_0xdc80('0x41')]({},_0x1a47f5,_0x50cf03[_0xdc80('0x42')]);return db[_0xdc80('0x2e')][_0xdc80('0x49')](_0x1a47f5)[_0xdc80('0x29')](handleEntityNotFound(_0x1d6b10,null))[_0xdc80('0x29')](respondWithResult(_0x1d6b10,null))[_0xdc80('0x47')](handleError(_0x1d6b10,null));};exports[_0xdc80('0x4a')]=function(_0x1cfdf6,_0x377274){return db[_0xdc80('0x2e')][_0xdc80('0x4a')](_0x1cfdf6[_0xdc80('0x4b')],{})['then'](respondWithResult(_0x377274,0xc9))[_0xdc80('0x47')](handleError(_0x377274,null));};exports['update']=function(_0x4a5183,_0x289975){if(_0x4a5183[_0xdc80('0x4b')]['id']){delete _0x4a5183[_0xdc80('0x4b')]['id'];}return db[_0xdc80('0x2e')][_0xdc80('0x49')]({'where':{'id':_0x4a5183[_0xdc80('0x4c')]['id']}})[_0xdc80('0x29')](handleEntityNotFound(_0x289975,null))[_0xdc80('0x29')](saveUpdates(_0x4a5183['body'],null))[_0xdc80('0x29')](respondWithResult(_0x289975,null))[_0xdc80('0x47')](handleError(_0x289975,null));};exports[_0xdc80('0x28')]=function(_0x516842,_0x4112b0){return db[_0xdc80('0x2e')][_0xdc80('0x49')]({'where':{'id':_0x516842['params']['id']}})[_0xdc80('0x29')](handleEntityNotFound(_0x4112b0,null))[_0xdc80('0x29')](removeEntity(_0x4112b0,null))[_0xdc80('0x47')](handleError(_0x4112b0,null));};exports[_0xdc80('0x4d')]=function(_0xe5ec6c,_0x35dc1c){return db[_0xdc80('0x2e')][_0xdc80('0x4d')]()[_0xdc80('0x29')](respondWithResult(_0x35dc1c,null))[_0xdc80('0x47')](handleError(_0x35dc1c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index c28f04e..14092ee 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 _0xf737=['emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x253b45,_0x32b9da){var _0x3e1947=function(_0x442fed){while(--_0x442fed){_0x253b45['push'](_0x253b45['shift']());}};_0x3e1947(++_0x32b9da);}(_0xf737,0x142));var _0x7f73=function(_0x3b0db9,_0x178c55){_0x3b0db9=_0x3b0db9-0x0;var _0x425b49=_0xf737[_0x3b0db9];return _0x425b49;};'use strict';var EventEmitter=require(_0x7f73('0x0'));var MailSubstatus=require(_0x7f73('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5a0aea){return function(_0xff4c8f,_0x1f9f4f,_0xbaed10){MailSubstatusEvents['emit'](_0x5a0aea+':'+_0xff4c8f['id'],_0xff4c8f);MailSubstatusEvents[_0x7f73('0x2')](_0x5a0aea,_0xff4c8f);_0xbaed10(null);};}for(var e in events){if(events[_0x7f73('0x3')](e)){var event=events[e];MailSubstatus[_0x7f73('0x4')](e,emitEvent(event));}}module[_0x7f73('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x2da7=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty'];(function(_0x39ff9c,_0x35d13a){var _0x4ff2d2=function(_0x4017d4){while(--_0x4017d4){_0x39ff9c['push'](_0x39ff9c['shift']());}};_0x4ff2d2(++_0x35d13a);}(_0x2da7,0xaa));var _0x72da=function(_0x8dab7b,_0x165c89){_0x8dab7b=_0x8dab7b-0x0;var _0x1dff5e=_0x2da7[_0x8dab7b];return _0x1dff5e;};'use strict';var EventEmitter=require(_0x72da('0x0'));var MailSubstatus=require(_0x72da('0x1'))['db'][_0x72da('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x72da('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x55d35b){return function(_0x547d78,_0x9dfeff,_0x1bbd24){MailSubstatusEvents[_0x72da('0x4')](_0x55d35b+':'+_0x547d78['id'],_0x547d78);MailSubstatusEvents[_0x72da('0x4')](_0x55d35b,_0x547d78);_0x1bbd24(null);};}for(var e in events){if(events[_0x72da('0x5')](e)){var event=events[e];MailSubstatus[_0x72da('0x6')](e,emitEvent(event));}}module[_0x72da('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index dc1935d..a11535e 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 _0x22e9=['update','name','mailSubstatus','_previousDataValues','then','catch','exports','define','MailSubstatus','mail_substatuses'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x22e9,0xd8));var _0x922e=function(_0x213969,_0x303344){_0x213969=_0x213969-0x0;var _0x5f4fca=_0x22e9[_0x213969];return _0x5f4fca;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x922e('0x0')]=function(_0x25d918){var _0x54ac9=_0x25d918['models'];return _0x25d918[_0x922e('0x1')](_0x922e('0x2'),attributes,{'tableName':_0x922e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3d8128,_0x8a186,_0x5145ff){return _0x54ac9['Condition'][_0x922e('0x4')]({'value':_0x3d8128[_0x922e('0x5')]},{'where':{'field':_0x922e('0x6'),'value':_0x3d8128[_0x922e('0x7')]['name']}})[_0x922e('0x8')](function(){_0x5145ff();})[_0x922e('0x9')](function(_0x290de1){_0x5145ff(_0x290de1);});}}});}; \ No newline at end of file +var _0x9f8c=['exports','define','mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x5187ab,_0x1f7cae){var _0x1d932c=function(_0x4ee5b3){while(--_0x4ee5b3){_0x5187ab['push'](_0x5187ab['shift']());}};_0x1d932c(++_0x1f7cae);}(_0x9f8c,0x1f3));var _0xc9f8=function(_0x51fa33,_0x1700e9){_0x51fa33=_0x51fa33-0x0;var _0x141777=_0x9f8c[_0x51fa33];return _0x141777;};'use strict';var attributes=require(_0xc9f8('0x0'));module[_0xc9f8('0x1')]=function(_0x2a1ac5){var _0x5bc46a=_0x2a1ac5['models'];return _0x2a1ac5[_0xc9f8('0x2')]('MailSubstatus',attributes,{'tableName':_0xc9f8('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xb7167a,_0x526e25,_0x25bcf6){return _0x5bc46a['Condition'][_0xc9f8('0x4')]({'value':_0xb7167a[_0xc9f8('0x5')]},{'where':{'field':_0xc9f8('0x6'),'value':_0xb7167a[_0xc9f8('0x7')][_0xc9f8('0x5')]}})[_0xc9f8('0x8')](function(){_0x25bcf6();})[_0xc9f8('0x9')](function(_0x22e362){_0x25bcf6(_0x22e362);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4432b46..9673a11 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 _0x12ef=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x12ef,0xd6));var _0xf12e=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x12ef[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0xf12e('0x0'));var util=require(_0xf12e('0x1'));var moment=require(_0xf12e('0x2'));var BPromise=require(_0xf12e('0x3'));var rs=require(_0xf12e('0x4'));var fs=require('fs');var Redis=require(_0xf12e('0x5'));var db=require(_0xf12e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf12e('0x7'))(_0xf12e('0x8'));var config=require(_0xf12e('0x9'));var jayson=require(_0xf12e('0xa'));var client=jayson['client'][_0xf12e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x445734,_0x582d0c,_0x2192e0){return new BPromise(function(_0x565add,_0x39b4fe){return client[_0xf12e('0xc')](_0x445734,_0x2192e0)[_0xf12e('0xd')](function(_0x11a1e3){logger[_0xf12e('0xe')](_0xf12e('0xf'),_0x582d0c,_0xf12e('0x10'));logger[_0xf12e('0x11')](_0xf12e('0x12'),_0x582d0c,_0xf12e('0x10'),JSON[_0xf12e('0x13')](_0x11a1e3));if(_0x11a1e3[_0xf12e('0x14')]){if(_0x11a1e3['error'][_0xf12e('0x15')]===0x1f4){logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x11a1e3['error'][_0xf12e('0x16')]);return _0x39b4fe(_0x11a1e3['error'][_0xf12e('0x16')]);}logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x11a1e3['error'][_0xf12e('0x16')]);return _0x565add(_0x11a1e3['error']['message']);}else{logger['info'](_0xf12e('0xf'),_0x582d0c,_0xf12e('0x10'));_0x565add(_0x11a1e3[_0xf12e('0x17')]['message']);}})[_0xf12e('0x18')](function(_0x4625ae){logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x4625ae);_0x39b4fe(_0x4625ae);});});} \ No newline at end of file +var _0x2c0a=['client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c0a,0x1f1));var _0xa2c0=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x2c0a[_0x10d0f0];return _0x93e308;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa2c0('0x0'));var BPromise=require(_0xa2c0('0x1'));var rs=require(_0xa2c0('0x2'));var fs=require('fs');var Redis=require(_0xa2c0('0x3'));var db=require(_0xa2c0('0x4'))['db'];var utils=require(_0xa2c0('0x5'));var logger=require(_0xa2c0('0x6'))('rpc');var config=require(_0xa2c0('0x7'));var jayson=require(_0xa2c0('0x8'));var client=jayson[_0xa2c0('0x9')][_0xa2c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b52d9,_0xd0afe2,_0x5b64d2){return new BPromise(function(_0x2ff996,_0x5840ae){return client[_0xa2c0('0xb')](_0x3b52d9,_0x5b64d2)['then'](function(_0x3ed760){logger[_0xa2c0('0xc')](_0xa2c0('0xd'),_0xd0afe2,'request\x20sent');logger[_0xa2c0('0xe')](_0xa2c0('0xf'),_0xd0afe2,_0xa2c0('0x10'),JSON[_0xa2c0('0x11')](_0x3ed760));if(_0x3ed760[_0xa2c0('0x12')]){if(_0x3ed760[_0xa2c0('0x12')][_0xa2c0('0x13')]===0x1f4){logger[_0xa2c0('0x12')](_0xa2c0('0xd'),_0xd0afe2,_0x3ed760[_0xa2c0('0x12')][_0xa2c0('0x14')]);return _0x5840ae(_0x3ed760['error'][_0xa2c0('0x14')]);}logger[_0xa2c0('0x12')](_0xa2c0('0xd'),_0xd0afe2,_0x3ed760[_0xa2c0('0x12')][_0xa2c0('0x14')]);return _0x2ff996(_0x3ed760[_0xa2c0('0x12')][_0xa2c0('0x14')]);}else{logger[_0xa2c0('0xc')](_0xa2c0('0xd'),_0xd0afe2,_0xa2c0('0x10'));_0x2ff996(_0x3ed760['result'][_0xa2c0('0x14')]);}})[_0xa2c0('0x15')](function(_0x2f4728){logger['error'](_0xa2c0('0xd'),_0xd0afe2,_0x2f4728);_0x5840ae(_0x2f4728);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d3c7ff1..4a8292d 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 _0x6530=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update'];(function(_0x23acc0,_0x454ba0){var _0x22c52f=function(_0x2615d0){while(--_0x2615d0){_0x23acc0['push'](_0x23acc0['shift']());}};_0x22c52f(++_0x454ba0);}(_0x6530,0x11f));var _0x0653=function(_0x42b89e,_0x2ae4e9){_0x42b89e=_0x42b89e-0x0;var _0x43da07=_0x6530[_0x42b89e];return _0x43da07;};'use strict';var multer=require(_0x0653('0x0'));var util=require(_0x0653('0x1'));var path=require(_0x0653('0x2'));var timeout=require(_0x0653('0x3'));var express=require(_0x0653('0x4'));var router=express[_0x0653('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0653('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0653('0x7'));router[_0x0653('0x8')]('/',auth[_0x0653('0x9')](),controller[_0x0653('0xa')]);router[_0x0653('0x8')](_0x0653('0xb'),auth[_0x0653('0x9')](),controller['describe']);router[_0x0653('0x8')](_0x0653('0xc'),auth[_0x0653('0x9')](),controller[_0x0653('0xd')]);router[_0x0653('0xe')]('/',auth[_0x0653('0x9')](),controller[_0x0653('0xf')]);router['put'](_0x0653('0xc'),auth[_0x0653('0x9')](),controller[_0x0653('0x10')]);router[_0x0653('0x11')](_0x0653('0xc'),auth[_0x0653('0x9')](),controller['destroy']);module[_0x0653('0x12')]=router; \ No newline at end of file +var _0x83f8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x39ff36,_0x5c1ce7){var _0x193380=function(_0x353520){while(--_0x353520){_0x39ff36['push'](_0x39ff36['shift']());}};_0x193380(++_0x5c1ce7);}(_0x83f8,0x75));var _0x883f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x83f8[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x883f('0x0'));var timeout=require(_0x883f('0x1'));var express=require(_0x883f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x883f('0x3'));var interaction=require(_0x883f('0x4'));var config=require(_0x883f('0x5'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x883f('0x6')](),controller['index']);router[_0x883f('0x7')]('/describe',auth[_0x883f('0x6')](),controller[_0x883f('0x8')]);router[_0x883f('0x7')]('/:id',auth[_0x883f('0x6')](),controller[_0x883f('0x9')]);router[_0x883f('0xa')]('/',auth[_0x883f('0x6')](),controller[_0x883f('0xb')]);router[_0x883f('0xc')]('/:id',auth[_0x883f('0x6')](),controller[_0x883f('0xd')]);router[_0x883f('0xe')]('/:id',auth[_0x883f('0x6')](),controller[_0x883f('0xf')]);module[_0x883f('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ac96c76..f6f7664 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3463a3,_0x3e6efc){_0x3463a3=_0x3463a3-0x0;var _0x2e2934=_0xb43b[_0x3463a3];return _0x2e2934;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1c9db3,_0x8b01bf){var _0x2338ef=function(_0x5d003e){while(--_0x5d003e){_0x1c9db3['push'](_0x1c9db3['shift']());}};_0x2338ef(++_0x8b01bf);}(_0x70e0,0x17b));var _0x070e=function(_0x37b492,_0xf91051){_0x37b492=_0x37b492-0x0;var _0x424d93=_0x70e0[_0x37b492];return _0x424d93;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 73d59b7..f39d6a8 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 _0x4b1a=['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/environment','../../config/license/util','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','map','MailTransferReport','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs'];(function(_0x35a153,_0x36047f){var _0x2b000a=function(_0x1ae527){while(--_0x1ae527){_0x35a153['push'](_0x35a153['shift']());}};_0x2b000a(++_0x36047f);}(_0x4b1a,0x1e8));var _0xa4b1=function(_0x5665b0,_0x59fde7){_0x5665b0=_0x5665b0-0x0;var _0x35dbe3=_0x4b1a[_0x5665b0];return _0x35dbe3;};'use strict';var emlformat=require(_0xa4b1('0x0'));var rimraf=require(_0xa4b1('0x1'));var zipdir=require(_0xa4b1('0x2'));var jsonpatch=require(_0xa4b1('0x3'));var rp=require(_0xa4b1('0x4'));var moment=require('moment');var BPromise=require(_0xa4b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa4b1('0x6'));var csv=require(_0xa4b1('0x7'));var ejs=require(_0xa4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xa4b1('0x9'));var _=require(_0xa4b1('0xa'));var squel=require(_0xa4b1('0xb'));var crypto=require(_0xa4b1('0xc'));var jsforce=require(_0xa4b1('0xd'));var deskjs=require(_0xa4b1('0xe'));var toCsv=require(_0xa4b1('0x7'));var querystring=require(_0xa4b1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa4b1('0x10'));var authService=require(_0xa4b1('0x11'));var qs=require(_0xa4b1('0x12'));var as=require(_0xa4b1('0x13'));var hardwareService=require(_0xa4b1('0x14'));var logger=require(_0xa4b1('0x15'))(_0xa4b1('0x16'));var utils=require('../../config/utils');var config=require(_0xa4b1('0x17'));var licenseUtil=require(_0xa4b1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e933,_0x32a64f){_0x32a64f=_0x32a64f||0xcc;return function(_0x3014d3){if(_0x3014d3){return _0x20e933['sendStatus'](_0x32a64f);}return _0x20e933[_0xa4b1('0x19')](_0x32a64f)['end']();};}function respondWithResult(_0x5c3bb3,_0x232228){_0x232228=_0x232228||0xc8;return function(_0x55b1c9){if(_0x55b1c9){return _0x5c3bb3['status'](_0x232228)[_0xa4b1('0x1a')](_0x55b1c9);}};}function respondWithFilteredResult(_0x435f75,_0x1ef1f6){return function(_0x3005d3){if(_0x3005d3){var _0x85a496=typeof _0x1ef1f6[_0xa4b1('0x1b')]==='undefined'&&typeof _0x1ef1f6['limit']===_0xa4b1('0x1c');var _0x28bb3a=_0x3005d3[_0xa4b1('0x1d')];var _0x537fb6=_0x85a496?0x0:_0x1ef1f6[_0xa4b1('0x1b')];var _0x253a5a=_0x85a496?_0x3005d3[_0xa4b1('0x1d')]:_0x1ef1f6[_0xa4b1('0x1b')]+_0x1ef1f6['limit'];var _0x544c6f;if(_0x253a5a>=_0x28bb3a){_0x253a5a=_0x28bb3a;_0x544c6f=0xc8;}else{_0x544c6f=0xce;}_0x435f75[_0xa4b1('0x19')](_0x544c6f);return _0x435f75[_0xa4b1('0x1e')]('Content-Range',_0x537fb6+'-'+_0x253a5a+'/'+_0x28bb3a)['json'](_0x3005d3);}return null;};}function patchUpdates(_0x35c494){return function(_0x55455d){try{jsonpatch[_0xa4b1('0x1f')](_0x55455d,_0x35c494,!![]);}catch(_0x3e9625){return BPromise[_0xa4b1('0x20')](_0x3e9625);}return _0x55455d[_0xa4b1('0x21')]();};}function saveUpdates(_0x313a21,_0x2ef23f){return function(_0x5d3491){if(_0x5d3491){return _0x5d3491[_0xa4b1('0x22')](_0x313a21)[_0xa4b1('0x23')](function(_0x4c54f6){return _0x4c54f6;});}return null;};}function removeEntity(_0x5e36fd,_0x11e90c){return function(_0x18a21f){if(_0x18a21f){return _0x18a21f[_0xa4b1('0x24')]()[_0xa4b1('0x23')](function(){_0x5e36fd[_0xa4b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ed22c,_0x3132b1){return function(_0x5d65ae){if(!_0x5d65ae){_0x4ed22c['sendStatus'](0x194);}return _0x5d65ae;};}function handleError(_0x47a819,_0x2bed2b){_0x2bed2b=_0x2bed2b||0x1f4;return function(_0x1572c2){logger[_0xa4b1('0x25')](_0x1572c2['stack']);if(_0x1572c2[_0xa4b1('0x26')]){delete _0x1572c2['name'];}_0x47a819[_0xa4b1('0x19')](_0x2bed2b)['send'](_0x1572c2);};}exports['index']=function(_0x22ee5f,_0x4b1a26){var _0x1a3ed8={},_0x47612={},_0x5219c5={'count':0x0,'rows':[]};var _0x5e51fd=_[_0xa4b1('0x27')](db[_0xa4b1('0x28')]['rawAttributes'],function(_0x3cc087){return{'name':_0x3cc087['fieldName'],'type':_0x3cc087[_0xa4b1('0x29')][_0xa4b1('0x2a')]};});_0x47612[_0xa4b1('0x2b')]=_['map'](_0x5e51fd,'name');_0x47612['query']=_[_0xa4b1('0x2c')](_0x22ee5f['query']);_0x47612[_0xa4b1('0x2d')]=_['intersection'](_0x47612[_0xa4b1('0x2b')],_0x47612['query']);_0x1a3ed8['attributes']=_[_0xa4b1('0x2e')](_0x47612[_0xa4b1('0x2b')],qs[_0xa4b1('0x2f')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x2f')]));_0x1a3ed8['attributes']=_0x1a3ed8[_0xa4b1('0x31')][_0xa4b1('0x32')]?_0x1a3ed8['attributes']:_0x47612['model'];if(!_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x33')](_0xa4b1('0x34'))){_0x1a3ed8[_0xa4b1('0x35')]=qs[_0xa4b1('0x35')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x35')]);_0x1a3ed8[_0xa4b1('0x1b')]=qs[_0xa4b1('0x1b')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x1b')]);}_0x1a3ed8['order']=qs[_0xa4b1('0x36')](_0x22ee5f[_0xa4b1('0x30')]['sort']);_0x1a3ed8[_0xa4b1('0x37')]=qs[_0xa4b1('0x2d')](_[_0xa4b1('0x38')](_0x22ee5f[_0xa4b1('0x30')],_0x47612[_0xa4b1('0x2d')]),_0x5e51fd);if(_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x39')]){_0x1a3ed8[_0xa4b1('0x37')]=_[_0xa4b1('0x3a')](_0x1a3ed8['where'],{'$or':_['map'](_0x5e51fd,function(_0xf69bec){if(_0xf69bec[_0xa4b1('0x29')]!=='VIRTUAL'){var _0x5b22c1={};_0x5b22c1[_0xf69bec[_0xa4b1('0x26')]]={'$like':'%'+_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x39')]+'%'};return _0x5b22c1;}})});}_0x1a3ed8=_[_0xa4b1('0x3a')]({},_0x1a3ed8,_0x22ee5f[_0xa4b1('0x3b')]);var _0x443d7d={'where':_0x1a3ed8[_0xa4b1('0x37')]};return db[_0xa4b1('0x28')][_0xa4b1('0x1d')](_0x443d7d)[_0xa4b1('0x23')](function(_0x5788c2){_0x5219c5[_0xa4b1('0x1d')]=_0x5788c2;if(_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x3c')]){_0x1a3ed8[_0xa4b1('0x3d')]=[{'all':!![]}];}return db[_0xa4b1('0x28')]['findAll'](_0x1a3ed8);})[_0xa4b1('0x23')](function(_0x749c31){_0x5219c5[_0xa4b1('0x3e')]=_0x749c31;return _0x5219c5;})[_0xa4b1('0x23')](respondWithFilteredResult(_0x4b1a26,_0x1a3ed8))['catch'](handleError(_0x4b1a26,null));};exports[_0xa4b1('0x3f')]=function(_0x38da02,_0x2b00df){var _0x4bbc1b={'raw':!![],'where':{'id':_0x38da02[_0xa4b1('0x40')]['id']}},_0x400545={};_0x400545[_0xa4b1('0x2b')]=_[_0xa4b1('0x2c')](db[_0xa4b1('0x28')][_0xa4b1('0x41')]);_0x400545[_0xa4b1('0x30')]=_[_0xa4b1('0x2c')](_0x38da02[_0xa4b1('0x30')]);_0x400545[_0xa4b1('0x2d')]=_[_0xa4b1('0x2e')](_0x400545[_0xa4b1('0x2b')],_0x400545[_0xa4b1('0x30')]);_0x4bbc1b[_0xa4b1('0x31')]=_['intersection'](_0x400545[_0xa4b1('0x2b')],qs[_0xa4b1('0x2f')](_0x38da02[_0xa4b1('0x30')]['fields']));_0x4bbc1b[_0xa4b1('0x31')]=_0x4bbc1b['attributes'][_0xa4b1('0x32')]?_0x4bbc1b[_0xa4b1('0x31')]:_0x400545['model'];if(_0x38da02[_0xa4b1('0x30')][_0xa4b1('0x3c')]){_0x4bbc1b[_0xa4b1('0x3d')]=[{'all':!![]}];}_0x4bbc1b=_[_0xa4b1('0x3a')]({},_0x4bbc1b,_0x38da02[_0xa4b1('0x3b')]);return db[_0xa4b1('0x28')][_0xa4b1('0x42')](_0x4bbc1b)[_0xa4b1('0x23')](handleEntityNotFound(_0x2b00df,null))['then'](respondWithResult(_0x2b00df,null))[_0xa4b1('0x43')](handleError(_0x2b00df,null));};exports[_0xa4b1('0x44')]=function(_0x5118e2,_0x18ad74){return db['MailTransferReport'][_0xa4b1('0x44')](_0x5118e2['body'],{})[_0xa4b1('0x23')](respondWithResult(_0x18ad74,0xc9))[_0xa4b1('0x43')](handleError(_0x18ad74,null));};exports[_0xa4b1('0x22')]=function(_0x4a453a,_0x2fdcd4){if(_0x4a453a[_0xa4b1('0x45')]['id']){delete _0x4a453a[_0xa4b1('0x45')]['id'];}return db['MailTransferReport'][_0xa4b1('0x42')]({'where':{'id':_0x4a453a[_0xa4b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fdcd4,null))[_0xa4b1('0x23')](saveUpdates(_0x4a453a[_0xa4b1('0x45')],null))[_0xa4b1('0x23')](respondWithResult(_0x2fdcd4,null))[_0xa4b1('0x43')](handleError(_0x2fdcd4,null));};exports['destroy']=function(_0x42d042,_0x2979ed){return db[_0xa4b1('0x28')][_0xa4b1('0x42')]({'where':{'id':_0x42d042[_0xa4b1('0x40')]['id']}})[_0xa4b1('0x23')](handleEntityNotFound(_0x2979ed,null))[_0xa4b1('0x23')](removeEntity(_0x2979ed,null))[_0xa4b1('0x43')](handleError(_0x2979ed,null));};exports[_0xa4b1('0x46')]=function(_0x333c13,_0x4fc97b){return db['MailTransferReport']['describe']()[_0xa4b1('0x23')](respondWithResult(_0x4fc97b,null))[_0xa4b1('0x43')](handleError(_0x4fc97b,null));}; \ No newline at end of file +var _0x09f8=['include','findAll','rows','show','rawAttributes','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','count','includeAll'];(function(_0x5719bd,_0x212fa4){var _0x25a2e9=function(_0x5c778b){while(--_0x5c778b){_0x5719bd['push'](_0x5719bd['shift']());}};_0x25a2e9(++_0x212fa4);}(_0x09f8,0x1e5));var _0x809f=function(_0x7a99dd,_0x47f32c){_0x7a99dd=_0x7a99dd-0x0;var _0x4fd4a9=_0x09f8[_0x7a99dd];return _0x4fd4a9;};'use strict';var emlformat=require(_0x809f('0x0'));var rimraf=require(_0x809f('0x1'));var zipdir=require(_0x809f('0x2'));var jsonpatch=require(_0x809f('0x3'));var rp=require(_0x809f('0x4'));var moment=require(_0x809f('0x5'));var BPromise=require(_0x809f('0x6'));var Mustache=require(_0x809f('0x7'));var util=require(_0x809f('0x8'));var path=require(_0x809f('0x9'));var sox=require(_0x809f('0xa'));var csv=require(_0x809f('0xb'));var ejs=require(_0x809f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x809f('0xd'));var squel=require(_0x809f('0xe'));var crypto=require('crypto');var jsforce=require(_0x809f('0xf'));var deskjs=require(_0x809f('0x10'));var toCsv=require(_0x809f('0xb'));var querystring=require(_0x809f('0x11'));var Papa=require(_0x809f('0x12'));var Redis=require('ioredis');var authService=require(_0x809f('0x13'));var qs=require(_0x809f('0x14'));var as=require(_0x809f('0x15'));var hardwareService=require(_0x809f('0x16'));var logger=require(_0x809f('0x17'))(_0x809f('0x18'));var utils=require('../../config/utils');var config=require(_0x809f('0x19'));var licenseUtil=require(_0x809f('0x1a'));var db=require(_0x809f('0x1b'))['db'];function respondWithStatusCode(_0x349731,_0x4c2afb){_0x4c2afb=_0x4c2afb||0xcc;return function(_0x357b64){if(_0x357b64){return _0x349731[_0x809f('0x1c')](_0x4c2afb);}return _0x349731[_0x809f('0x1d')](_0x4c2afb)[_0x809f('0x1e')]();};}function respondWithResult(_0x3e2fda,_0xaa9853){_0xaa9853=_0xaa9853||0xc8;return function(_0x122b64){if(_0x122b64){return _0x3e2fda[_0x809f('0x1d')](_0xaa9853)[_0x809f('0x1f')](_0x122b64);}};}function respondWithFilteredResult(_0x12889a,_0x1a4870){return function(_0x406b11){if(_0x406b11){var _0x4ee72f=typeof _0x1a4870[_0x809f('0x20')]===_0x809f('0x21')&&typeof _0x1a4870[_0x809f('0x22')]==='undefined';var _0x4f74e9=_0x406b11['count'];var _0x262b2f=_0x4ee72f?0x0:_0x1a4870[_0x809f('0x20')];var _0x5b566c=_0x4ee72f?_0x406b11['count']:_0x1a4870['offset']+_0x1a4870[_0x809f('0x22')];var _0x243577;if(_0x5b566c>=_0x4f74e9){_0x5b566c=_0x4f74e9;_0x243577=0xc8;}else{_0x243577=0xce;}_0x12889a['status'](_0x243577);return _0x12889a['set'](_0x809f('0x23'),_0x262b2f+'-'+_0x5b566c+'/'+_0x4f74e9)[_0x809f('0x1f')](_0x406b11);}return null;};}function patchUpdates(_0x514d5b){return function(_0x163f9a){try{jsonpatch['apply'](_0x163f9a,_0x514d5b,!![]);}catch(_0x4717f5){return BPromise[_0x809f('0x24')](_0x4717f5);}return _0x163f9a[_0x809f('0x25')]();};}function saveUpdates(_0x5d7b88,_0x1d4d5d){return function(_0x1176a3){if(_0x1176a3){return _0x1176a3[_0x809f('0x26')](_0x5d7b88)['then'](function(_0xd98987){return _0xd98987;});}return null;};}function removeEntity(_0x4be748,_0x279326){return function(_0x344a99){if(_0x344a99){return _0x344a99[_0x809f('0x27')]()[_0x809f('0x28')](function(){_0x4be748['status'](0xcc)[_0x809f('0x1e')]();});}};}function handleEntityNotFound(_0x31dcb5,_0x29dbdf){return function(_0x4ec767){if(!_0x4ec767){_0x31dcb5[_0x809f('0x1c')](0x194);}return _0x4ec767;};}function handleError(_0xc67675,_0x3c98bb){_0x3c98bb=_0x3c98bb||0x1f4;return function(_0x2683c0){logger[_0x809f('0x29')](_0x2683c0[_0x809f('0x2a')]);if(_0x2683c0[_0x809f('0x2b')]){delete _0x2683c0['name'];}_0xc67675[_0x809f('0x1d')](_0x3c98bb)[_0x809f('0x2c')](_0x2683c0);};}exports['index']=function(_0x12835a,_0x4d9764){var _0x4e4042={},_0x465558={},_0x21dc37={'count':0x0,'rows':[]};var _0x5b74a=_[_0x809f('0x2d')](db['MailTransferReport']['rawAttributes'],function(_0x31797b){return{'name':_0x31797b['fieldName'],'type':_0x31797b[_0x809f('0x2e')][_0x809f('0x2f')]};});_0x465558[_0x809f('0x30')]=_[_0x809f('0x2d')](_0x5b74a,'name');_0x465558[_0x809f('0x31')]=_[_0x809f('0x32')](_0x12835a[_0x809f('0x31')]);_0x465558[_0x809f('0x33')]=_[_0x809f('0x34')](_0x465558['model'],_0x465558[_0x809f('0x31')]);_0x4e4042[_0x809f('0x35')]=_[_0x809f('0x34')](_0x465558[_0x809f('0x30')],qs['fields'](_0x12835a[_0x809f('0x31')][_0x809f('0x36')]));_0x4e4042[_0x809f('0x35')]=_0x4e4042['attributes'][_0x809f('0x37')]?_0x4e4042[_0x809f('0x35')]:_0x465558[_0x809f('0x30')];if(!_0x12835a[_0x809f('0x31')]['hasOwnProperty'](_0x809f('0x38'))){_0x4e4042[_0x809f('0x22')]=qs[_0x809f('0x22')](_0x12835a[_0x809f('0x31')][_0x809f('0x22')]);_0x4e4042[_0x809f('0x20')]=qs[_0x809f('0x20')](_0x12835a[_0x809f('0x31')][_0x809f('0x20')]);}_0x4e4042[_0x809f('0x39')]=qs[_0x809f('0x3a')](_0x12835a[_0x809f('0x31')][_0x809f('0x3a')]);_0x4e4042[_0x809f('0x3b')]=qs[_0x809f('0x33')](_[_0x809f('0x3c')](_0x12835a[_0x809f('0x31')],_0x465558['filters']),_0x5b74a);if(_0x12835a['query'][_0x809f('0x3d')]){_0x4e4042['where']=_[_0x809f('0x3e')](_0x4e4042[_0x809f('0x3b')],{'$or':_[_0x809f('0x2d')](_0x5b74a,function(_0x5aadb9){if(_0x5aadb9[_0x809f('0x2e')]!==_0x809f('0x3f')){var _0x2e488a={};_0x2e488a[_0x5aadb9[_0x809f('0x2b')]]={'$like':'%'+_0x12835a[_0x809f('0x31')][_0x809f('0x3d')]+'%'};return _0x2e488a;}})});}_0x4e4042=_['merge']({},_0x4e4042,_0x12835a[_0x809f('0x40')]);var _0x4ff37b={'where':_0x4e4042[_0x809f('0x3b')]};return db[_0x809f('0x41')][_0x809f('0x42')](_0x4ff37b)[_0x809f('0x28')](function(_0xa6f9d2){_0x21dc37['count']=_0xa6f9d2;if(_0x12835a[_0x809f('0x31')][_0x809f('0x43')]){_0x4e4042[_0x809f('0x44')]=[{'all':!![]}];}return db[_0x809f('0x41')][_0x809f('0x45')](_0x4e4042);})[_0x809f('0x28')](function(_0x4b7646){_0x21dc37[_0x809f('0x46')]=_0x4b7646;return _0x21dc37;})[_0x809f('0x28')](respondWithFilteredResult(_0x4d9764,_0x4e4042))['catch'](handleError(_0x4d9764,null));};exports[_0x809f('0x47')]=function(_0x2b2554,_0x2f7fc4){var _0x61ec3f={'raw':!![],'where':{'id':_0x2b2554['params']['id']}},_0x34eb5b={};_0x34eb5b[_0x809f('0x30')]=_[_0x809f('0x32')](db[_0x809f('0x41')][_0x809f('0x48')]);_0x34eb5b[_0x809f('0x31')]=_[_0x809f('0x32')](_0x2b2554[_0x809f('0x31')]);_0x34eb5b['filters']=_['intersection'](_0x34eb5b[_0x809f('0x30')],_0x34eb5b[_0x809f('0x31')]);_0x61ec3f['attributes']=_[_0x809f('0x34')](_0x34eb5b[_0x809f('0x30')],qs[_0x809f('0x36')](_0x2b2554[_0x809f('0x31')]['fields']));_0x61ec3f['attributes']=_0x61ec3f[_0x809f('0x35')]['length']?_0x61ec3f[_0x809f('0x35')]:_0x34eb5b[_0x809f('0x30')];if(_0x2b2554[_0x809f('0x31')][_0x809f('0x43')]){_0x61ec3f[_0x809f('0x44')]=[{'all':!![]}];}_0x61ec3f=_[_0x809f('0x3e')]({},_0x61ec3f,_0x2b2554[_0x809f('0x40')]);return db[_0x809f('0x41')][_0x809f('0x49')](_0x61ec3f)['then'](handleEntityNotFound(_0x2f7fc4,null))[_0x809f('0x28')](respondWithResult(_0x2f7fc4,null))['catch'](handleError(_0x2f7fc4,null));};exports[_0x809f('0x4a')]=function(_0x35c411,_0x46cec4){return db[_0x809f('0x41')][_0x809f('0x4a')](_0x35c411[_0x809f('0x4b')],{})[_0x809f('0x28')](respondWithResult(_0x46cec4,0xc9))[_0x809f('0x4c')](handleError(_0x46cec4,null));};exports[_0x809f('0x26')]=function(_0x5617f6,_0x4e4a48){if(_0x5617f6[_0x809f('0x4b')]['id']){delete _0x5617f6[_0x809f('0x4b')]['id'];}return db[_0x809f('0x41')][_0x809f('0x49')]({'where':{'id':_0x5617f6[_0x809f('0x4d')]['id']}})[_0x809f('0x28')](handleEntityNotFound(_0x4e4a48,null))[_0x809f('0x28')](saveUpdates(_0x5617f6[_0x809f('0x4b')],null))[_0x809f('0x28')](respondWithResult(_0x4e4a48,null))['catch'](handleError(_0x4e4a48,null));};exports['destroy']=function(_0x50f758,_0x5dd517){return db[_0x809f('0x41')][_0x809f('0x49')]({'where':{'id':_0x50f758[_0x809f('0x4d')]['id']}})[_0x809f('0x28')](handleEntityNotFound(_0x5dd517,null))[_0x809f('0x28')](removeEntity(_0x5dd517,null))['catch'](handleError(_0x5dd517,null));};exports[_0x809f('0x4e')]=function(_0x313218,_0x34b76d){return db[_0x809f('0x41')]['describe']()[_0x809f('0x28')](respondWithResult(_0x34b76d,null))[_0x809f('0x4c')](handleError(_0x34b76d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f76dba4..b0f8a14 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 _0xe799=['../../config/environment','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0xe799,0x170));var _0x9e79=function(_0x24e4b9,_0x52cf96){_0x24e4b9=_0x24e4b9-0x0;var _0x523ebc=_0xe799[_0x24e4b9];return _0x523ebc;};'use strict';var _=require(_0x9e79('0x0'));var util=require('util');var logger=require(_0x9e79('0x1'))('api');var moment=require(_0x9e79('0x2'));var BPromise=require(_0x9e79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e79('0x4'));var rimraf=require(_0x9e79('0x5'));var config=require(_0x9e79('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x9e79('0x7')]=function(_0x4e7bb3,_0x3239df){return _0x4e7bb3[_0x9e79('0x8')](_0x9e79('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9e79('0xa'),'fields':[_0x9e79('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac22=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0xac22,0x138));var _0x2ac2=function(_0x2b9c69,_0x2cf79d){_0x2b9c69=_0x2b9c69-0x0;var _0x264a93=_0xac22[_0x2b9c69];return _0x264a93;};'use strict';var _=require('lodash');var util=require(_0x2ac2('0x0'));var logger=require(_0x2ac2('0x1'))(_0x2ac2('0x2'));var moment=require(_0x2ac2('0x3'));var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac2('0x7'));var attributes=require(_0x2ac2('0x8'));module[_0x2ac2('0x9')]=function(_0x54943c,_0xd807b2){return _0x54943c[_0x2ac2('0xa')]('MailTransferReport',attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xc'),'fields':[_0x2ac2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ab42bfd..65ad821 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 _0x5e0b=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring'];(function(_0x272ea6,_0x3f0673){var _0x43ef03=function(_0x2307e2){while(--_0x2307e2){_0x272ea6['push'](_0x272ea6['shift']());}};_0x43ef03(++_0x3f0673);}(_0x5e0b,0x178));var _0xb5e0=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x5e0b[_0x40822a];return _0x357420;};'use strict';var _=require(_0xb5e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5e0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5e0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5e0('0x3'))(_0xb5e0('0x4'));var config=require(_0xb5e0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb5e0('0x6')][_0xb5e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f2ab8,_0x567232,_0x18472c){return new BPromise(function(_0x2c9bf3,_0x570571){return client[_0xb5e0('0x8')](_0x1f2ab8,_0x18472c)[_0xb5e0('0x9')](function(_0x1897a0){logger[_0xb5e0('0xa')](_0xb5e0('0xb'),_0x567232,_0xb5e0('0xc'));logger['debug'](_0xb5e0('0xd'),_0x567232,'request\x20sent',JSON[_0xb5e0('0xe')](_0x1897a0));if(_0x1897a0['error']){if(_0x1897a0[_0xb5e0('0xf')]['code']===0x1f4){logger[_0xb5e0('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x567232,_0x1897a0[_0xb5e0('0xf')]['message']);return _0x570571(_0x1897a0[_0xb5e0('0xf')][_0xb5e0('0x10')]);}logger[_0xb5e0('0xf')](_0xb5e0('0xb'),_0x567232,_0x1897a0['error'][_0xb5e0('0x10')]);return _0x2c9bf3(_0x1897a0['error']['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x567232,_0xb5e0('0xc'));_0x2c9bf3(_0x1897a0['result'][_0xb5e0('0x10')]);}})[_0xb5e0('0x11')](function(_0x422b23){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x567232,_0x422b23);_0x570571(_0x422b23);});});} \ No newline at end of file +var _0x2bbe=['debug','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x2bbe,0x12c));var _0xe2bb=function(_0x217ae0,_0x55ba89){_0x217ae0=_0x217ae0-0x0;var _0x20f25a=_0x2bbe[_0x217ae0];return _0x20f25a;};'use strict';var _=require('lodash');var util=require(_0xe2bb('0x0'));var moment=require(_0xe2bb('0x1'));var BPromise=require(_0xe2bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2bb('0x3'));var db=require(_0xe2bb('0x4'))['db'];var utils=require(_0xe2bb('0x5'));var logger=require(_0xe2bb('0x6'))(_0xe2bb('0x7'));var config=require('../../config/environment');var jayson=require(_0xe2bb('0x8'));var client=jayson[_0xe2bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aa03e,_0x9157ad,_0x4f43ef){return new BPromise(function(_0x47dec3,_0xb12109){return client[_0xe2bb('0xa')](_0x3aa03e,_0x4f43ef)[_0xe2bb('0xb')](function(_0xd12812){logger[_0xe2bb('0xc')](_0xe2bb('0xd'),_0x9157ad,_0xe2bb('0xe'));logger[_0xe2bb('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x9157ad,'request\x20sent',JSON[_0xe2bb('0x10')](_0xd12812));if(_0xd12812[_0xe2bb('0x11')]){if(_0xd12812['error']['code']===0x1f4){logger[_0xe2bb('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9157ad,_0xd12812[_0xe2bb('0x11')]['message']);return _0xb12109(_0xd12812[_0xe2bb('0x11')][_0xe2bb('0x12')]);}logger[_0xe2bb('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9157ad,_0xd12812['error'][_0xe2bb('0x12')]);return _0x47dec3(_0xd12812[_0xe2bb('0x11')]['message']);}else{logger[_0xe2bb('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x9157ad,_0xe2bb('0xe'));_0x47dec3(_0xd12812[_0xe2bb('0x13')][_0xe2bb('0x12')]);}})[_0xe2bb('0x14')](function(_0x505f30){logger[_0xe2bb('0x11')](_0xe2bb('0xd'),_0x9157ad,_0x505f30);_0xb12109(_0x505f30);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 82d3627..9ba4c37 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 _0xe26e=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','update'];(function(_0xcf2962,_0x1acbed){var _0x5d3089=function(_0xb19998){while(--_0xb19998){_0xcf2962['push'](_0xcf2962['shift']());}};_0x5d3089(++_0x1acbed);}(_0xe26e,0xd4));var _0xee26=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe26e[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xee26('0x0'));var util=require(_0xee26('0x1'));var path=require('path');var timeout=require(_0xee26('0x2'));var express=require(_0xee26('0x3'));var router=express[_0xee26('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xee26('0x5'));var config=require(_0xee26('0x6'));var controller=require(_0xee26('0x7'));router['get']('/',auth[_0xee26('0x8')](),controller[_0xee26('0x9')]);router[_0xee26('0xa')](_0xee26('0xb'),auth['isAuthenticated'](),controller[_0xee26('0xc')]);router[_0xee26('0xa')](_0xee26('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xee26('0xe')]('/',auth[_0xee26('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee26('0xf')]);router[_0xee26('0x10')](_0xee26('0xd'),auth[_0xee26('0x8')](),controller[_0xee26('0x11')]);module[_0xee26('0x12')]=router; \ No newline at end of file +var _0x5c62=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xd8321f,_0x146fe1){var _0x5074c4=function(_0x258278){while(--_0x258278){_0xd8321f['push'](_0xd8321f['shift']());}};_0x5074c4(++_0x146fe1);}(_0x5c62,0x188));var _0x25c6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5c62[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x25c6('0x0'));var util=require(_0x25c6('0x1'));var path=require(_0x25c6('0x2'));var timeout=require(_0x25c6('0x3'));var express=require(_0x25c6('0x4'));var router=express[_0x25c6('0x5')]();var fs_extra=require(_0x25c6('0x6'));var auth=require(_0x25c6('0x7'));var interaction=require(_0x25c6('0x8'));var config=require(_0x25c6('0x9'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x25c6('0xa')](),controller[_0x25c6('0xb')]);router[_0x25c6('0xc')](_0x25c6('0xd'),auth[_0x25c6('0xa')](),controller[_0x25c6('0xe')]);router['get'](_0x25c6('0xf'),auth[_0x25c6('0xa')](),controller[_0x25c6('0x10')]);router[_0x25c6('0x11')]('/',auth[_0x25c6('0xa')](),controller['create']);router['put'](_0x25c6('0xf'),auth[_0x25c6('0xa')](),controller['update']);router[_0x25c6('0x12')]('/:id',auth[_0x25c6('0xa')](),controller[_0x25c6('0x13')]);module[_0x25c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5777717..9a66b81 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 _0x49b3=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[destination]'];(function(_0x45bfbc,_0x1ff15e){var _0x407018=function(_0x22f0f0){while(--_0x22f0f0){_0x45bfbc['push'](_0x45bfbc['shift']());}};_0x407018(++_0x1ff15e);}(_0x49b3,0x1b2));var _0x349b=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x49b3[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x349b('0x0'));var moment=require(_0x349b('0x1'));module[_0x349b('0x2')]={'channel':{'type':Sequelize[_0x349b('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x349b('0x3')],'defaultValue':_0x349b('0x4'),'comment':_0x349b('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x349b('0x6')]},'exitAt':{'type':Sequelize[_0x349b('0x6')],'set':function(_0x11cbf3){var _0x48ced6=moment(_0x11cbf3);var _0xf5f7c9=moment(this[_0x349b('0x7')](_0x349b('0x8')));var _0x31ad24=_0x48ced6['diff'](_0xf5f7c9,_0x349b('0x9'));this[_0x349b('0xa')](_0x349b('0xb'),_0x11cbf3);this['setDataValue'](_0x349b('0xc'),_0x31ad24>=0x0?_0x31ad24:null);}},'data1':{'type':Sequelize[_0x349b('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x349b('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xd')},'data4':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xe')},'data5':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x349b('0x3')]}}; \ No newline at end of file +var _0xd014=['talk:[queue]','INTEGER','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x232635,_0x1dcb1b){var _0x27028b=function(_0x1199d8){while(--_0x1199d8){_0x232635['push'](_0x232635['shift']());}};_0x27028b(++_0x1dcb1b);}(_0xd014,0x188));var _0x4d01=function(_0x5395c8,_0x3cf754){_0x5395c8=_0x5395c8-0x0;var _0xb7e3c1=_0xd014[_0x5395c8];return _0xb7e3c1;};'use strict';var Sequelize=require(_0x4d01('0x0'));var moment=require(_0x4d01('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4d01('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x4d01('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x4d01('0x4')]},'exitAt':{'type':Sequelize[_0x4d01('0x4')],'set':function(_0x28d950){var _0x3748ea=moment(_0x28d950);var _0x4f93df=moment(this['getDataValue'](_0x4d01('0x5')));var _0x1ea857=_0x3748ea[_0x4d01('0x6')](_0x4f93df,'seconds');this[_0x4d01('0x7')](_0x4d01('0x8'),_0x28d950);this[_0x4d01('0x7')](_0x4d01('0x9'),_0x1ea857>=0x0?_0x1ea857:null);}},'data1':{'type':Sequelize[_0x4d01('0x2')],'comment':_0x4d01('0xa')},'data2':{'type':Sequelize[_0x4d01('0x2')],'comment':_0x4d01('0xb')},'data3':{'type':Sequelize[_0x4d01('0x2')],'comment':_0x4d01('0xc')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x4d01('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x4d01('0xe')]},'uniqueid':{'type':Sequelize[_0x4d01('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 15caad4..13383ea 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4e884d,_0x1309e1){var _0x40d395=function(_0x4a9801){while(--_0x4a9801){_0x4e884d['push'](_0x4e884d['shift']());}};_0x40d395(++_0x1309e1);}(_0x3e74,0x175));var _0x43e7=function(_0xe38e6e,_0x51ceac){_0xe38e6e=_0xe38e6e-0x0;var _0x32b178=_0x3e74[_0xe38e6e];return _0x32b178;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xedd9,0xfc));var _0x9edd=function(_0x49cba4,_0x10ede8){_0x49cba4=_0x49cba4-0x0;var _0x1efbc7=_0xedd9[_0x49cba4];return _0x1efbc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 369ac40..ec3d9be 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 _0x5bb1=['report_member','interface','lodash','util','../../config/logger','api','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport'];(function(_0x519c5e,_0x280d4f){var _0x2454fb=function(_0x2551a8){while(--_0x2551a8){_0x519c5e['push'](_0x519c5e['shift']());}};_0x2454fb(++_0x280d4f);}(_0x5bb1,0x1d6));var _0x15bb=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x5bb1[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x15bb('0x0'));var util=require(_0x15bb('0x1'));var logger=require(_0x15bb('0x2'))(_0x15bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15bb('0x4'));var fs=require('fs');var path=require(_0x15bb('0x5'));var rimraf=require(_0x15bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x15bb('0x7'));module['exports']=function(_0x14e214,_0xcd6d05){return _0x14e214[_0x15bb('0x8')](_0x15bb('0x9'),attributes,{'tableName':_0x15bb('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x15bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaafc=['membername_interface','interface','util','../../config/logger','api','moment','request-promise','path','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x15e350,_0x25ba2f){var _0x1b2a9b=function(_0x283dd3){while(--_0x283dd3){_0x15e350['push'](_0x15e350['shift']());}};_0x1b2a9b(++_0x25ba2f);}(_0xaafc,0x176));var _0xcaaf=function(_0x48dfb2,_0x276150){_0x48dfb2=_0x48dfb2-0x0;var _0x5c8909=_0xaafc[_0x48dfb2];return _0x5c8909;};'use strict';var _=require('lodash');var util=require(_0xcaaf('0x0'));var logger=require(_0xcaaf('0x1'))(_0xcaaf('0x2'));var moment=require(_0xcaaf('0x3'));var BPromise=require('bluebird');var rp=require(_0xcaaf('0x4'));var fs=require('fs');var path=require(_0xcaaf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcaaf('0x6'));module['exports']=function(_0x291f15,_0x54757a){return _0x291f15[_0xcaaf('0x7')](_0xcaaf('0x8'),attributes,{'tableName':_0xcaaf('0x9'),'paranoid':![],'indexes':[{'name':_0xcaaf('0xa'),'fields':['membername',_0xcaaf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 287e862..66f8ecb 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 _0x5a43=['where','limit','include','model','map','attributes','debug','stringify','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5a43,0xf1));var _0x35a4=function(_0x39a80f,_0x3521aa){_0x39a80f=_0x39a80f-0x0;var _0x25ec73=_0x5a43[_0x39a80f];return _0x25ec73;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('MemberReport,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetMemberReport',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetMemberReport',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')](_0x1da508[_0x35a4('0x23')],{'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![]})[_0x35a4('0xb')](function(_0x293d05){logger[_0x35a4('0xc')]('CreateMemberReport',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x293d05));_0x160bb5(_0x293d05);})['catch'](function(_0xa62fb5){logger[_0x35a4('0xf')](_0x35a4('0x21'),_0xa62fb5['message'],_0x1da508);_0x2e6d5d(_0x2e1985['error'](0x1f4,_0xa62fb5[_0x35a4('0x11')]));});});};exports['UpdateMemberReport']=function(_0x418725){var _0x206d65=this;return new Promise(function(_0x274237,_0x4ea3b0){return db['MemberReport'][_0x35a4('0x24')](_0x418725[_0x35a4('0x23')],{'raw':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x418725['options']?_0x418725['options'][_0x35a4('0x1e')]||null:null,'limit':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null})[_0x35a4('0xb')](function(_0x5033a1){logger[_0x35a4('0xc')]('UpdateMemberReport',_0x418725);logger[_0x35a4('0x1f')]('UpdateMemberReport',_0x418725,JSON[_0x35a4('0x20')](_0x5033a1));_0x274237(_0x5033a1);})[_0x35a4('0x13')](function(_0x432c1d){logger[_0x35a4('0xf')](_0x35a4('0x25'),_0x432c1d[_0x35a4('0x11')],_0x418725);_0x4ea3b0(_0x206d65['error'](0x1f4,_0x432c1d[_0x35a4('0x11')]));});});}; \ No newline at end of file +var _0x4813=['attributes','limit','map','include','model','then','GetMemberReport','debug','CreateMemberReport','create','body','raw','catch','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MemberReport','findAll','options','where'];(function(_0x38aa3d,_0x5ed191){var _0x8936ba=function(_0x38d5b9){while(--_0x38d5b9){_0x38aa3d['push'](_0x38aa3d['shift']());}};_0x8936ba(++_0x5ed191);}(_0x4813,0x14e));var _0x3481=function(_0x51c2d8,_0x782543){_0x51c2d8=_0x51c2d8-0x0;var _0xca448a=_0x4813[_0x51c2d8];return _0xca448a;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require(_0x3481('0x2'));var BPromise=require(_0x3481('0x3'));var rs=require(_0x3481('0x4'));var fs=require('fs');var Redis=require(_0x3481('0x5'));var db=require(_0x3481('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x7'))(_0x3481('0x8'));var config=require(_0x3481('0x9'));var jayson=require(_0x3481('0xa'));var client=jayson[_0x3481('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e58ba,_0x3f5015,_0x59eda6){return new BPromise(function(_0x41fb39,_0x1a65d7){return client[_0x3481('0xc')](_0x5e58ba,_0x59eda6)['then'](function(_0x56cf19){logger['info'](_0x3481('0xd'),_0x3f5015,'request\x20sent');logger['debug'](_0x3481('0xe'),_0x3f5015,_0x3481('0xf'),JSON[_0x3481('0x10')](_0x56cf19));if(_0x56cf19[_0x3481('0x11')]){if(_0x56cf19[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')](_0x3481('0xd'),_0x3f5015,_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);return _0x1a65d7(_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);}logger['error'](_0x3481('0xd'),_0x3f5015,_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);return _0x41fb39(_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);}else{logger[_0x3481('0x14')]('MemberReport,\x20%s,\x20%s',_0x3f5015,_0x3481('0xf'));_0x41fb39(_0x56cf19[_0x3481('0x15')]['message']);}})['catch'](function(_0x4f6f45){logger['error']('MemberReport,\x20%s,\x20%s',_0x3f5015,_0x4f6f45);_0x1a65d7(_0x4f6f45);});});}exports['GetMemberReport']=function(_0x32a315){var _0x35a12b=this;return new Promise(function(_0x5a8e65,_0x47d554){return db[_0x3481('0x16')][_0x3481('0x17')]({'raw':_0x32a315[_0x3481('0x18')]?_0x32a315['options']['raw']===undefined?!![]:![]:!![],'where':_0x32a315[_0x3481('0x18')]?_0x32a315[_0x3481('0x18')][_0x3481('0x19')]||null:null,'attributes':_0x32a315[_0x3481('0x18')]?_0x32a315[_0x3481('0x18')][_0x3481('0x1a')]||null:null,'limit':_0x32a315['options']?_0x32a315[_0x3481('0x18')][_0x3481('0x1b')]||null:null,'include':_0x32a315[_0x3481('0x18')]?_0x32a315[_0x3481('0x18')]['include']?_[_0x3481('0x1c')](_0x32a315['options'][_0x3481('0x1d')],function(_0x33c6fa){return{'model':db[_0x33c6fa[_0x3481('0x1e')]],'as':_0x33c6fa['as'],'attributes':_0x33c6fa[_0x3481('0x1a')],'include':_0x33c6fa['include']?_['map'](_0x33c6fa[_0x3481('0x1d')],function(_0x3e5963){return{'model':db[_0x3e5963[_0x3481('0x1e')]],'as':_0x3e5963['as'],'attributes':_0x3e5963[_0x3481('0x1a')],'include':_0x3e5963['include']?_[_0x3481('0x1c')](_0x3e5963[_0x3481('0x1d')],function(_0x1181e1){return{'model':db[_0x1181e1[_0x3481('0x1e')]],'as':_0x1181e1['as'],'attributes':_0x1181e1[_0x3481('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3481('0x1f')](function(_0xc4a238){logger[_0x3481('0x14')](_0x3481('0x20'),_0x32a315);logger[_0x3481('0x21')]('GetMemberReport',_0x32a315,JSON[_0x3481('0x10')](_0xc4a238));_0x5a8e65(_0xc4a238);})['catch'](function(_0xdcacba){logger[_0x3481('0x11')](_0x3481('0x20'),_0xdcacba['message'],_0x32a315);_0x47d554(_0x35a12b[_0x3481('0x11')](0x1f4,_0xdcacba[_0x3481('0x13')]));});});};exports[_0x3481('0x22')]=function(_0x28699f){var _0x3e217b=this;return new Promise(function(_0x59d53d,_0x45603b){return db[_0x3481('0x16')][_0x3481('0x23')](_0x28699f[_0x3481('0x24')],{'raw':_0x28699f['options']?_0x28699f[_0x3481('0x18')][_0x3481('0x25')]===undefined?!![]:![]:!![]})[_0x3481('0x1f')](function(_0x2afcb2){logger[_0x3481('0x14')](_0x3481('0x22'),_0x28699f);logger[_0x3481('0x21')](_0x3481('0x22'),_0x28699f,JSON['stringify'](_0x2afcb2));_0x59d53d(_0x2afcb2);})[_0x3481('0x26')](function(_0x39306b){logger[_0x3481('0x11')]('CreateMemberReport',_0x39306b[_0x3481('0x13')],_0x28699f);_0x45603b(_0x3e217b['error'](0x1f4,_0x39306b[_0x3481('0x13')]));});});};exports['UpdateMemberReport']=function(_0x34b0df){var _0x5975c5=this;return new Promise(function(_0x387a99,_0x251355){return db[_0x3481('0x16')]['update'](_0x34b0df[_0x3481('0x24')],{'raw':_0x34b0df['options']?_0x34b0df[_0x3481('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b0df[_0x3481('0x18')]?_0x34b0df[_0x3481('0x18')][_0x3481('0x19')]||null:null,'attributes':_0x34b0df[_0x3481('0x18')]?_0x34b0df[_0x3481('0x18')][_0x3481('0x1a')]||null:null,'limit':_0x34b0df[_0x3481('0x18')]?_0x34b0df[_0x3481('0x18')][_0x3481('0x1b')]||null:null})['then'](function(_0x203065){logger['info'](_0x3481('0x27'),_0x34b0df);logger[_0x3481('0x21')](_0x3481('0x27'),_0x34b0df,JSON[_0x3481('0x10')](_0x203065));_0x387a99(_0x203065);})['catch'](function(_0x4b6369){logger[_0x3481('0x11')](_0x3481('0x27'),_0x4b6369[_0x3481('0x13')],_0x34b0df);_0x251355(_0x5975c5[_0x3481('0x11')](0x1f4,_0x4b6369['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2ee3601..bce897d 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 _0xea11=['../../config/environment','./migration.controller','index','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b3ae0,_0x540540){var _0x78746a=function(_0x5718f9){while(--_0x5718f9){_0x1b3ae0['push'](_0x1b3ae0['shift']());}};_0x78746a(++_0x540540);}(_0xea11,0x10c));var _0x1ea1=function(_0x3142a6,_0xe9ff9e){_0x3142a6=_0x3142a6-0x0;var _0x2bdc43=_0xea11[_0x3142a6];return _0x2bdc43;};'use strict';var multer=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var path=require('path');var timeout=require(_0x1ea1('0x2'));var express=require(_0x1ea1('0x3'));var router=express[_0x1ea1('0x4')]();var fs_extra=require(_0x1ea1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1ea1('0x6'));var config=require(_0x1ea1('0x7'));var controller=require(_0x1ea1('0x8'));router['get']('/',controller[_0x1ea1('0x9')]);module[_0x1ea1('0xa')]=router; \ No newline at end of file +var _0xfd76=['express','fs-extra','../../components/interaction/service','./migration.controller','exports','multer','util','path','connect-timeout'];(function(_0x6d7567,_0x445eb7){var _0x1436f5=function(_0x105acf){while(--_0x105acf){_0x6d7567['push'](_0x6d7567['shift']());}};_0x1436f5(++_0x445eb7);}(_0xfd76,0x101));var _0x6fd7=function(_0x5aebfb,_0x414413){_0x5aebfb=_0x5aebfb-0x0;var _0x5db6a8=_0xfd76[_0x5aebfb];return _0x5db6a8;};'use strict';var multer=require(_0x6fd7('0x0'));var util=require(_0x6fd7('0x1'));var path=require(_0x6fd7('0x2'));var timeout=require(_0x6fd7('0x3'));var express=require(_0x6fd7('0x4'));var router=express['Router']();var fs_extra=require(_0x6fd7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6fd7('0x6'));var config=require('../../config/environment');var controller=require(_0x6fd7('0x7'));router['get']('/',controller['index']);module[_0x6fd7('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 170952e..9f40fd0 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 _0x958b=['sequelize','exports','STRING','version'];(function(_0x2a846d,_0x90981e){var _0x13c533=function(_0x4c9b72){while(--_0x4c9b72){_0x2a846d['push'](_0x2a846d['shift']());}};_0x13c533(++_0x90981e);}(_0x958b,0x180));var _0xb958=function(_0x26d109,_0x3f8997){_0x26d109=_0x26d109-0x0;var _0x3c6e1b=_0x958b[_0x26d109];return _0x3c6e1b;};'use strict';var Sequelize=require(_0xb958('0x0'));module[_0xb958('0x1')]={'version':{'type':Sequelize[_0xb958('0x2')],'unique':_0xb958('0x3')}}; \ No newline at end of file +var _0x1a0b=['STRING','version','sequelize','exports'];(function(_0x38443e,_0x8a7a){var _0x566e8b=function(_0x5c33f4){while(--_0x5c33f4){_0x38443e['push'](_0x38443e['shift']());}};_0x566e8b(++_0x8a7a);}(_0x1a0b,0x13a));var _0xb1a0=function(_0x5149b4,_0x502e63){_0x5149b4=_0x5149b4-0x0;var _0x2f20ef=_0x1a0b[_0x5149b4];return _0x2f20ef;};'use strict';var Sequelize=require(_0xb1a0('0x0'));module[_0xb1a0('0x1')]={'version':{'type':Sequelize[_0xb1a0('0x2')],'unique':_0xb1a0('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d0fb6f8..16434a1 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 _0x0174=['index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send'];(function(_0x156c1a,_0x3f12a8){var _0x1d2723=function(_0x12cf29){while(--_0x12cf29){_0x156c1a['push'](_0x156c1a['shift']());}};_0x1d2723(++_0x3f12a8);}(_0x0174,0x12a));var _0x4017=function(_0x482f92,_0x469f50){_0x482f92=_0x482f92-0x0;var _0x3f3775=_0x0174[_0x482f92];return _0x3f3775;};'use strict';var emlformat=require(_0x4017('0x0'));var rimraf=require(_0x4017('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4017('0x2'));var rp=require(_0x4017('0x3'));var moment=require(_0x4017('0x4'));var BPromise=require(_0x4017('0x5'));var Mustache=require(_0x4017('0x6'));var util=require(_0x4017('0x7'));var path=require(_0x4017('0x8'));var sox=require(_0x4017('0x9'));var csv=require(_0x4017('0xa'));var ejs=require(_0x4017('0xb'));var fs=require('fs');var fs_extra=require(_0x4017('0xc'));var _=require(_0x4017('0xd'));var squel=require(_0x4017('0xe'));var crypto=require(_0x4017('0xf'));var jsforce=require(_0x4017('0x10'));var deskjs=require(_0x4017('0x11'));var toCsv=require(_0x4017('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4017('0x12'));var authService=require(_0x4017('0x13'));var qs=require(_0x4017('0x14'));var as=require(_0x4017('0x15'));var hardwareService=require(_0x4017('0x16'));var logger=require(_0x4017('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4017('0x18'));var licenseUtil=require(_0x4017('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x535fd4,_0x44275f){_0x44275f=_0x44275f||0xcc;return function(_0x2a5ac3){if(_0x2a5ac3){return _0x535fd4[_0x4017('0x1a')](_0x44275f);}return _0x535fd4[_0x4017('0x1b')](_0x44275f)[_0x4017('0x1c')]();};}function respondWithResult(_0x58af97,_0x50a443){_0x50a443=_0x50a443||0xc8;return function(_0x2b1acb){if(_0x2b1acb){return _0x58af97[_0x4017('0x1b')](_0x50a443)[_0x4017('0x1d')](_0x2b1acb);}};}function respondWithFilteredResult(_0x1a9d17,_0xb037b9){return function(_0x53d156){if(_0x53d156){var _0x568611=typeof _0xb037b9[_0x4017('0x1e')]===_0x4017('0x1f')&&typeof _0xb037b9[_0x4017('0x20')]===_0x4017('0x1f');var _0x452b94=_0x53d156[_0x4017('0x21')];var _0x32ad82=_0x568611?0x0:_0xb037b9['offset'];var _0x1a44f9=_0x568611?_0x53d156[_0x4017('0x21')]:_0xb037b9['offset']+_0xb037b9[_0x4017('0x20')];var _0x1da423;if(_0x1a44f9>=_0x452b94){_0x1a44f9=_0x452b94;_0x1da423=0xc8;}else{_0x1da423=0xce;}_0x1a9d17[_0x4017('0x1b')](_0x1da423);return _0x1a9d17[_0x4017('0x22')](_0x4017('0x23'),_0x32ad82+'-'+_0x1a44f9+'/'+_0x452b94)[_0x4017('0x1d')](_0x53d156);}return null;};}function patchUpdates(_0x2336f4){return function(_0x54ae28){try{jsonpatch['apply'](_0x54ae28,_0x2336f4,!![]);}catch(_0x18d940){return BPromise[_0x4017('0x24')](_0x18d940);}return _0x54ae28['save']();};}function saveUpdates(_0x4583f4,_0x1b430e){return function(_0xabb56d){if(_0xabb56d){return _0xabb56d[_0x4017('0x25')](_0x4583f4)['then'](function(_0x41acb6){return _0x41acb6;});}return null;};}function removeEntity(_0x25f8e4,_0x55c15a){return function(_0x1fb893){if(_0x1fb893){return _0x1fb893['destroy']()[_0x4017('0x26')](function(){_0x25f8e4[_0x4017('0x1b')](0xcc)[_0x4017('0x1c')]();});}};}function handleEntityNotFound(_0x3be294,_0x22f3e0){return function(_0x303423){if(!_0x303423){_0x3be294[_0x4017('0x1a')](0x194);}return _0x303423;};}function handleError(_0x38d0d7,_0x436b28){_0x436b28=_0x436b28||0x1f4;return function(_0x3305f6){logger['error'](_0x3305f6[_0x4017('0x27')]);if(_0x3305f6[_0x4017('0x28')]){delete _0x3305f6[_0x4017('0x28')];}_0x38d0d7[_0x4017('0x1b')](_0x436b28)[_0x4017('0x29')](_0x3305f6);};}exports[_0x4017('0x2a')]=function(_0x24e87e,_0x4e8859){var _0x5cb748={},_0x3b5240={},_0x2dcd85={'count':0x0,'rows':[]};var _0x259df0=_[_0x4017('0x2b')](db['Migration'][_0x4017('0x2c')],function(_0x65c4e9){return{'name':_0x65c4e9[_0x4017('0x2d')],'type':_0x65c4e9[_0x4017('0x2e')][_0x4017('0x2f')]};});_0x3b5240['model']=_[_0x4017('0x2b')](_0x259df0,_0x4017('0x28'));_0x3b5240[_0x4017('0x30')]=_['keys'](_0x24e87e[_0x4017('0x30')]);_0x3b5240[_0x4017('0x31')]=_[_0x4017('0x32')](_0x3b5240[_0x4017('0x33')],_0x3b5240[_0x4017('0x30')]);_0x5cb748[_0x4017('0x34')]=_[_0x4017('0x32')](_0x3b5240[_0x4017('0x33')],qs[_0x4017('0x35')](_0x24e87e[_0x4017('0x30')][_0x4017('0x35')]));_0x5cb748[_0x4017('0x34')]=_0x5cb748[_0x4017('0x34')][_0x4017('0x36')]?_0x5cb748[_0x4017('0x34')]:_0x3b5240['model'];if(!_0x24e87e[_0x4017('0x30')]['hasOwnProperty'](_0x4017('0x37'))){_0x5cb748['limit']=qs[_0x4017('0x20')](_0x24e87e[_0x4017('0x30')]['limit']);_0x5cb748[_0x4017('0x1e')]=qs[_0x4017('0x1e')](_0x24e87e[_0x4017('0x30')][_0x4017('0x1e')]);}_0x5cb748['order']=qs[_0x4017('0x38')](_0x24e87e[_0x4017('0x30')][_0x4017('0x38')]);_0x5cb748[_0x4017('0x39')]=qs['filters'](_[_0x4017('0x3a')](_0x24e87e[_0x4017('0x30')],_0x3b5240['filters']),_0x259df0);if(_0x24e87e['query'][_0x4017('0x3b')]){_0x5cb748[_0x4017('0x39')]=_[_0x4017('0x3c')](_0x5cb748[_0x4017('0x39')],{'$or':_[_0x4017('0x2b')](_0x259df0,function(_0x4a9f47){if(_0x4a9f47[_0x4017('0x2e')]!==_0x4017('0x3d')){var _0x368f8b={};_0x368f8b[_0x4a9f47['name']]={'$like':'%'+_0x24e87e['query'][_0x4017('0x3b')]+'%'};return _0x368f8b;}})});}_0x5cb748=_[_0x4017('0x3c')]({},_0x5cb748,_0x24e87e['options']);var _0x12c049={'where':_0x5cb748[_0x4017('0x39')]};return db[_0x4017('0x3e')][_0x4017('0x21')](_0x12c049)[_0x4017('0x26')](function(_0x3220c1){_0x2dcd85[_0x4017('0x21')]=_0x3220c1;if(_0x24e87e[_0x4017('0x30')][_0x4017('0x3f')]){_0x5cb748[_0x4017('0x40')]=[{'all':!![]}];}return db[_0x4017('0x3e')][_0x4017('0x41')](_0x5cb748);})[_0x4017('0x26')](function(_0x1fe17b){_0x2dcd85[_0x4017('0x42')]=_0x1fe17b;return _0x2dcd85;})[_0x4017('0x26')](respondWithFilteredResult(_0x4e8859,_0x5cb748))[_0x4017('0x43')](handleError(_0x4e8859,null));}; \ No newline at end of file +var _0xbabb=['VIRTUAL','merge','options','includeAll','include','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0xbabb,0x192));var _0xbbab=function(_0x3967c1,_0x1d0eb6){_0x3967c1=_0x3967c1-0x0;var _0xfd806d=_0xbabb[_0x3967c1];return _0xfd806d;};'use strict';var emlformat=require(_0xbbab('0x0'));var rimraf=require(_0xbbab('0x1'));var zipdir=require(_0xbbab('0x2'));var jsonpatch=require(_0xbbab('0x3'));var rp=require(_0xbbab('0x4'));var moment=require(_0xbbab('0x5'));var BPromise=require(_0xbbab('0x6'));var Mustache=require(_0xbbab('0x7'));var util=require(_0xbbab('0x8'));var path=require('path');var sox=require(_0xbbab('0x9'));var csv=require(_0xbbab('0xa'));var ejs=require(_0xbbab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbbab('0xc'));var crypto=require('crypto');var jsforce=require(_0xbbab('0xd'));var deskjs=require(_0xbbab('0xe'));var toCsv=require(_0xbbab('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbbab('0xf'));var authService=require(_0xbbab('0x10'));var qs=require(_0xbbab('0x11'));var as=require(_0xbbab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbbab('0x13'));var config=require(_0xbbab('0x14'));var licenseUtil=require(_0xbbab('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x342248,_0x589747){_0x589747=_0x589747||0xcc;return function(_0x561372){if(_0x561372){return _0x342248[_0xbbab('0x16')](_0x589747);}return _0x342248[_0xbbab('0x17')](_0x589747)[_0xbbab('0x18')]();};}function respondWithResult(_0x2aa53c,_0x5b5189){_0x5b5189=_0x5b5189||0xc8;return function(_0x2c6c50){if(_0x2c6c50){return _0x2aa53c[_0xbbab('0x17')](_0x5b5189)[_0xbbab('0x19')](_0x2c6c50);}};}function respondWithFilteredResult(_0x28e0fa,_0xc04d07){return function(_0x500a7a){if(_0x500a7a){var _0x185749=typeof _0xc04d07[_0xbbab('0x1a')]===_0xbbab('0x1b')&&typeof _0xc04d07[_0xbbab('0x1c')]===_0xbbab('0x1b');var _0x4134d1=_0x500a7a[_0xbbab('0x1d')];var _0x26e43e=_0x185749?0x0:_0xc04d07[_0xbbab('0x1a')];var _0x12134b=_0x185749?_0x500a7a[_0xbbab('0x1d')]:_0xc04d07[_0xbbab('0x1a')]+_0xc04d07[_0xbbab('0x1c')];var _0x3cc44a;if(_0x12134b>=_0x4134d1){_0x12134b=_0x4134d1;_0x3cc44a=0xc8;}else{_0x3cc44a=0xce;}_0x28e0fa['status'](_0x3cc44a);return _0x28e0fa[_0xbbab('0x1e')](_0xbbab('0x1f'),_0x26e43e+'-'+_0x12134b+'/'+_0x4134d1)[_0xbbab('0x19')](_0x500a7a);}return null;};}function patchUpdates(_0x3f3a3e){return function(_0x4cc084){try{jsonpatch[_0xbbab('0x20')](_0x4cc084,_0x3f3a3e,!![]);}catch(_0x3005c9){return BPromise[_0xbbab('0x21')](_0x3005c9);}return _0x4cc084['save']();};}function saveUpdates(_0x191597,_0x4bf81c){return function(_0x3bdb3c){if(_0x3bdb3c){return _0x3bdb3c['update'](_0x191597)['then'](function(_0xf8235f){return _0xf8235f;});}return null;};}function removeEntity(_0xd89b70,_0x16d434){return function(_0x2dbf15){if(_0x2dbf15){return _0x2dbf15[_0xbbab('0x22')]()[_0xbbab('0x23')](function(){_0xd89b70[_0xbbab('0x17')](0xcc)[_0xbbab('0x18')]();});}};}function handleEntityNotFound(_0x3ea2b0,_0x5ac684){return function(_0x156203){if(!_0x156203){_0x3ea2b0[_0xbbab('0x16')](0x194);}return _0x156203;};}function handleError(_0x3fed66,_0x1309f1){_0x1309f1=_0x1309f1||0x1f4;return function(_0x5ec4a2){logger[_0xbbab('0x24')](_0x5ec4a2[_0xbbab('0x25')]);if(_0x5ec4a2[_0xbbab('0x26')]){delete _0x5ec4a2[_0xbbab('0x26')];}_0x3fed66['status'](_0x1309f1)[_0xbbab('0x27')](_0x5ec4a2);};}exports['index']=function(_0x381528,_0x492414){var _0x24b815={},_0x47787b={},_0xad2214={'count':0x0,'rows':[]};var _0x34eae5=_['map'](db[_0xbbab('0x28')][_0xbbab('0x29')],function(_0x3f27f0){return{'name':_0x3f27f0[_0xbbab('0x2a')],'type':_0x3f27f0[_0xbbab('0x2b')][_0xbbab('0x2c')]};});_0x47787b[_0xbbab('0x2d')]=_[_0xbbab('0x2e')](_0x34eae5,_0xbbab('0x26'));_0x47787b[_0xbbab('0x2f')]=_[_0xbbab('0x30')](_0x381528['query']);_0x47787b['filters']=_[_0xbbab('0x31')](_0x47787b[_0xbbab('0x2d')],_0x47787b[_0xbbab('0x2f')]);_0x24b815[_0xbbab('0x32')]=_[_0xbbab('0x31')](_0x47787b['model'],qs[_0xbbab('0x33')](_0x381528[_0xbbab('0x2f')]['fields']));_0x24b815['attributes']=_0x24b815[_0xbbab('0x32')][_0xbbab('0x34')]?_0x24b815['attributes']:_0x47787b[_0xbbab('0x2d')];if(!_0x381528[_0xbbab('0x2f')]['hasOwnProperty'](_0xbbab('0x35'))){_0x24b815['limit']=qs['limit'](_0x381528[_0xbbab('0x2f')][_0xbbab('0x1c')]);_0x24b815[_0xbbab('0x1a')]=qs['offset'](_0x381528[_0xbbab('0x2f')][_0xbbab('0x1a')]);}_0x24b815[_0xbbab('0x36')]=qs[_0xbbab('0x37')](_0x381528[_0xbbab('0x2f')][_0xbbab('0x37')]);_0x24b815[_0xbbab('0x38')]=qs[_0xbbab('0x39')](_[_0xbbab('0x3a')](_0x381528['query'],_0x47787b['filters']),_0x34eae5);if(_0x381528[_0xbbab('0x2f')][_0xbbab('0x3b')]){_0x24b815[_0xbbab('0x38')]=_['merge'](_0x24b815['where'],{'$or':_[_0xbbab('0x2e')](_0x34eae5,function(_0x7c7022){if(_0x7c7022['type']!==_0xbbab('0x3c')){var _0x16cd1f={};_0x16cd1f[_0x7c7022[_0xbbab('0x26')]]={'$like':'%'+_0x381528[_0xbbab('0x2f')]['filter']+'%'};return _0x16cd1f;}})});}_0x24b815=_[_0xbbab('0x3d')]({},_0x24b815,_0x381528[_0xbbab('0x3e')]);var _0x20c2d4={'where':_0x24b815[_0xbbab('0x38')]};return db[_0xbbab('0x28')]['count'](_0x20c2d4)['then'](function(_0x7b4895){_0xad2214[_0xbbab('0x1d')]=_0x7b4895;if(_0x381528[_0xbbab('0x2f')][_0xbbab('0x3f')]){_0x24b815[_0xbbab('0x40')]=[{'all':!![]}];}return db['Migration'][_0xbbab('0x41')](_0x24b815);})[_0xbbab('0x23')](function(_0x303839){_0xad2214['rows']=_0x303839;return _0xad2214;})[_0xbbab('0x23')](respondWithFilteredResult(_0x492414,_0x24b815))['catch'](handleError(_0x492414,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 659d605..82d0c26 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 _0x4731=['migrations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4731,0x1bd));var _0x1473=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4731[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x1473('0x0'));var util=require(_0x1473('0x1'));var logger=require(_0x1473('0x2'))(_0x1473('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1473('0x4'));var fs=require('fs');var path=require(_0x1473('0x5'));var rimraf=require(_0x1473('0x6'));var config=require(_0x1473('0x7'));var attributes=require(_0x1473('0x8'));module[_0x1473('0x9')]=function(_0x16ef58,_0x43dbc3){return _0x16ef58['define'](_0x1473('0xa'),attributes,{'tableName':_0x1473('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdde=['path','rimraf','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x15fe68,_0xddc145){var _0x1d144c=function(_0x408370){while(--_0x408370){_0x15fe68['push'](_0x15fe68['shift']());}};_0x1d144c(++_0xddc145);}(_0xbdde,0x72));var _0xebdd=function(_0x66094a,_0x3f5795){_0x66094a=_0x66094a-0x0;var _0xf8cf1d=_0xbdde[_0x66094a];return _0xf8cf1d;};'use strict';var _=require(_0xebdd('0x0'));var util=require(_0xebdd('0x1'));var logger=require(_0xebdd('0x2'))(_0xebdd('0x3'));var moment=require('moment');var BPromise=require(_0xebdd('0x4'));var rp=require(_0xebdd('0x5'));var fs=require('fs');var path=require(_0xebdd('0x6'));var rimraf=require(_0xebdd('0x7'));var config=require('../../config/environment');var attributes=require(_0xebdd('0x8'));module[_0xebdd('0x9')]=function(_0x2c124,_0x9a5b45){return _0x2c124[_0xebdd('0xa')]('Migration',attributes,{'tableName':_0xebdd('0xb'),'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 55c3dfa..1780dfb 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b4ffc,_0x283aa3){var _0x42ba2a=function(_0x85585c){while(--_0x85585c){_0x5b4ffc['push'](_0x5b4ffc['shift']());}};_0x42ba2a(++_0x283aa3);}(_0x878f,0x173));var _0xf878=function(_0xfc0dd6,_0x2feabf){_0xfc0dd6=_0xfc0dd6-0x0;var _0x2f87e1=_0x878f[_0xfc0dd6];return _0x2f87e1;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0x1da6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x250f95,_0x5a5728){var _0x4ada97=function(_0x392edc){while(--_0x392edc){_0x250f95['push'](_0x250f95['shift']());}};_0x4ada97(++_0x5a5728);}(_0x1da6,0x7c));var _0x61da=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x1da6[_0x3fd275];return _0xe4f14f;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var moment=require(_0x61da('0x2'));var BPromise=require(_0x61da('0x3'));var rs=require(_0x61da('0x4'));var fs=require('fs');var Redis=require(_0x61da('0x5'));var db=require(_0x61da('0x6'))['db'];var utils=require(_0x61da('0x7'));var logger=require(_0x61da('0x8'))(_0x61da('0x9'));var config=require(_0x61da('0xa'));var jayson=require(_0x61da('0xb'));var client=jayson[_0x61da('0xc')][_0x61da('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2bb2c7,_0x2c43c2,_0x196162){return new BPromise(function(_0x352ac4,_0x1a63b2){return client[_0x61da('0xe')](_0x2bb2c7,_0x196162)['then'](function(_0x2c7da4){logger[_0x61da('0xf')](_0x61da('0x10'),_0x2c43c2,_0x61da('0x11'));logger[_0x61da('0x12')](_0x61da('0x13'),_0x2c43c2,_0x61da('0x11'),JSON[_0x61da('0x14')](_0x2c7da4));if(_0x2c7da4[_0x61da('0x15')]){if(_0x2c7da4[_0x61da('0x15')][_0x61da('0x16')]===0x1f4){logger[_0x61da('0x15')](_0x61da('0x10'),_0x2c43c2,_0x2c7da4[_0x61da('0x15')][_0x61da('0x17')]);return _0x1a63b2(_0x2c7da4['error'][_0x61da('0x17')]);}logger[_0x61da('0x15')](_0x61da('0x10'),_0x2c43c2,_0x2c7da4[_0x61da('0x15')]['message']);return _0x352ac4(_0x2c7da4[_0x61da('0x15')]['message']);}else{logger[_0x61da('0xf')](_0x61da('0x10'),_0x2c43c2,'request\x20sent');_0x352ac4(_0x2c7da4['result'][_0x61da('0x17')]);}})[_0x61da('0x18')](function(_0x46d2c4){logger[_0x61da('0x15')](_0x61da('0x10'),_0x2c43c2,_0x46d2c4);_0x1a63b2(_0x46d2c4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d88069d..150e6f0 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 _0x09d2=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x09d2,0x1d2));var _0x209d=function(_0x39be46,_0x5d503f){_0x39be46=_0x39be46-0x0;var _0x35f305=_0x09d2[_0x39be46];return _0x35f305;};'use strict';var multer=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var path=require(_0x209d('0x2'));var timeout=require(_0x209d('0x3'));var express=require(_0x209d('0x4'));var router=express[_0x209d('0x5')]();var fs_extra=require(_0x209d('0x6'));var auth=require(_0x209d('0x7'));var interaction=require(_0x209d('0x8'));var config=require(_0x209d('0x9'));var controller=require('./network.controller');router[_0x209d('0xa')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xc')]);router[_0x209d('0xa')](_0x209d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x209d('0xe')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xf')]);router['put'](_0x209d('0xd'),auth['isAuthenticated'](),controller[_0x209d('0x10')]);router[_0x209d('0x11')](_0x209d('0xd'),auth[_0x209d('0xb')](),controller[_0x209d('0x12')]);module[_0x209d('0x13')]=router; \ No newline at end of file +var _0x71ab=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x71ab,0x64));var _0xb71a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x71ab[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0xd')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0xf')](_0xb71a('0xb'),auth['isAuthenticated'](),controller[_0xb71a('0x10')]);router['delete'](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c007c16..f0c9aa3 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 _0xeeb8=['externip','stun','turn','STRING','sequelize','exports','localnet'];(function(_0x1dd28b,_0x37c08c){var _0x2a9a50=function(_0x515581){while(--_0x515581){_0x1dd28b['push'](_0x1dd28b['shift']());}};_0x2a9a50(++_0x37c08c);}(_0xeeb8,0x7b));var _0x8eeb=function(_0x3eec90,_0x3dfafe){_0x3eec90=_0x3eec90-0x0;var _0x3c79b5=_0xeeb8[_0x3eec90];return _0x3c79b5;};'use strict';var Sequelize=require(_0x8eeb('0x0'));module[_0x8eeb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8eeb('0x2'),_0x8eeb('0x3'),_0x8eeb('0x4'),_0x8eeb('0x5'))},'value':{'type':Sequelize[_0x8eeb('0x6')]},'username':{'type':Sequelize[_0x8eeb('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0366=['exports','ENUM','stun','turn','STRING','sequelize'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x0366,0x12b));var _0x6036=function(_0x28878f,_0x53c5fa){_0x28878f=_0x28878f-0x0;var _0x5126a5=_0x0366[_0x28878f];return _0x5126a5;};'use strict';var Sequelize=require(_0x6036('0x0'));module[_0x6036('0x1')]={'type':{'type':Sequelize[_0x6036('0x2')]('localnet','externip',_0x6036('0x3'),_0x6036('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6036('0x5')]},'password':{'type':Sequelize[_0x6036('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 73d3654..3bb373e 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 _0x02d7=['undefined','count','offset','set','Content-Range','destroy','end','sendStatus','name','send','index','map','Network','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','create','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','/etc/asterisk/stun_xcally.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','status','json','limit'];(function(_0x334641,_0x34648b){var _0x467db4=function(_0x188cc7){while(--_0x188cc7){_0x334641['push'](_0x334641['shift']());}};_0x467db4(++_0x34648b);}(_0x02d7,0x191));var _0x702d=function(_0x308527,_0x146bed){_0x308527=_0x308527-0x0;var _0x31ad08=_0x02d7[_0x308527];return _0x31ad08;};'use strict';var util=require(_0x702d('0x0'));var path=require('path');var ejs=require(_0x702d('0x1'));var fs=require('fs');var _=require(_0x702d('0x2'));var qs=require(_0x702d('0x3'));var logger=require(_0x702d('0x4'))(_0x702d('0x5'));var config=require(_0x702d('0x6'));var db=require(_0x702d('0x7'))['db'];var jayson=require(_0x702d('0x8'));var client=jayson[_0x702d('0x9')][_0x702d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bbed5,_0x3d8541,_0x5369a0,_0x1b6240){return new Promise(function(_0x50e8ec,_0x3fb324){var _0x46655f=_0x1b6240||client;return _0x46655f[_0x702d('0xb')](_0x1bbed5,_0x5369a0)[_0x702d('0xc')](function(_0x23ea6f){logger[_0x702d('0xd')](_0x702d('0xe'),_0x3d8541,'request\x20sent');logger[_0x702d('0xf')](_0x702d('0x10'),_0x3d8541,_0x702d('0x11'),JSON['stringify'](_0x23ea6f));if(_0x23ea6f[_0x702d('0x12')]){if(_0x23ea6f[_0x702d('0x12')]['code']===0x1f4){logger[_0x702d('0x12')]('Network,\x20%s,\x20%s',_0x3d8541,_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);return _0x3fb324(_0x23ea6f['error'][_0x702d('0x13')]);}logger['error'](_0x702d('0xe'),_0x3d8541,_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);return _0x50e8ec(_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x3d8541,_0x702d('0x11'));_0x50e8ec(_0x23ea6f[_0x702d('0x14')]['message']);}})['catch'](function(_0x2a2a42){logger[_0x702d('0x12')](_0x702d('0xe'),_0x3d8541,_0x2a2a42);_0x3fb324(_0x2a2a42);});});}function respondWithResult(_0x5ed8b9,_0x1cfec5){_0x1cfec5=_0x1cfec5||0xc8;return function(_0xc871e1){if(_0xc871e1){return _0x5ed8b9[_0x702d('0x15')](_0x1cfec5)[_0x702d('0x16')](_0xc871e1);}};}function respondWithFilteredResult(_0x412bb5,_0x1f8125){return function(_0x58368e){if(_0x58368e){var _0x5cc976=typeof _0x1f8125['offset']==='undefined'&&typeof _0x1f8125[_0x702d('0x17')]===_0x702d('0x18');var _0x1e1762=_0x58368e[_0x702d('0x19')];var _0x11c884=_0x5cc976?0x0:_0x1f8125[_0x702d('0x1a')];var _0x4481de=_0x5cc976?_0x58368e[_0x702d('0x19')]:_0x1f8125[_0x702d('0x1a')]+_0x1f8125[_0x702d('0x17')];var _0x1ece68;if(_0x4481de>=_0x1e1762){_0x4481de=_0x1e1762;_0x1ece68=0xc8;}else{_0x1ece68=0xce;}_0x412bb5['status'](_0x1ece68);return _0x412bb5[_0x702d('0x1b')](_0x702d('0x1c'),_0x11c884+'-'+_0x4481de+'/'+_0x1e1762)[_0x702d('0x16')](_0x58368e);}return null;};}function saveUpdates(_0x495d89){return function(_0x5ca7cc){if(_0x5ca7cc){return _0x5ca7cc['update'](_0x495d89)[_0x702d('0xc')](function(_0x2a9168){return _0x2a9168;});}return null;};}function removeEntity(_0x185ffb){return function(_0x583885){if(_0x583885){return _0x583885[_0x702d('0x1d')]()[_0x702d('0xc')](function(){_0x185ffb[_0x702d('0x15')](0xcc)[_0x702d('0x1e')]();});}};}function handleEntityNotFound(_0x2b50aa){return function(_0x2c377c){if(!_0x2c377c){_0x2b50aa[_0x702d('0x1f')](0x194);}return _0x2c377c;};}function handleError(_0x836cd1,_0x4adc79){_0x4adc79=_0x4adc79||0x1f4;return function(_0x460267){logger[_0x702d('0x12')](_0x460267['stack']);if(_0x460267[_0x702d('0x20')]){delete _0x460267[_0x702d('0x20')];}_0x836cd1['status'](_0x4adc79)[_0x702d('0x21')](_0x460267);};}exports[_0x702d('0x22')]=function(_0x22809b,_0x4de718){var _0x10d169={},_0x50e484={},_0x58624e={'count':0x0,'rows':[]};var _0x529531=_[_0x702d('0x23')](db[_0x702d('0x24')][_0x702d('0x25')],function(_0x4610c8){return{'name':_0x4610c8['fieldName'],'type':_0x4610c8['type']['key']};});_0x50e484['model']=_[_0x702d('0x23')](_0x529531,_0x702d('0x20'));_0x50e484[_0x702d('0x26')]=_[_0x702d('0x27')](_0x22809b[_0x702d('0x26')]);_0x50e484[_0x702d('0x28')]=_[_0x702d('0x29')](_0x50e484[_0x702d('0x2a')],_0x50e484[_0x702d('0x26')]);_0x10d169['attributes']=_[_0x702d('0x29')](_0x50e484[_0x702d('0x2a')],qs[_0x702d('0x2b')](_0x22809b[_0x702d('0x26')][_0x702d('0x2b')]));_0x10d169[_0x702d('0x2c')]=_0x10d169[_0x702d('0x2c')][_0x702d('0x2d')]?_0x10d169[_0x702d('0x2c')]:_0x50e484['model'];if(!_0x22809b['query']['hasOwnProperty'](_0x702d('0x2e'))){_0x10d169[_0x702d('0x17')]=qs['limit'](_0x22809b[_0x702d('0x26')][_0x702d('0x17')]);_0x10d169[_0x702d('0x1a')]=qs[_0x702d('0x1a')](_0x22809b[_0x702d('0x26')][_0x702d('0x1a')]);}_0x10d169[_0x702d('0x2f')]=qs[_0x702d('0x30')](_0x22809b[_0x702d('0x26')]['sort']);_0x10d169[_0x702d('0x31')]=qs[_0x702d('0x28')](_[_0x702d('0x32')](_0x22809b[_0x702d('0x26')],_0x50e484[_0x702d('0x28')]),_0x529531);if(_0x22809b[_0x702d('0x26')][_0x702d('0x33')]){_0x10d169['where']=_[_0x702d('0x34')](_0x10d169[_0x702d('0x31')],{'$or':_[_0x702d('0x23')](_0x529531,function(_0x47ae59){if(_0x47ae59[_0x702d('0x35')]!==_0x702d('0x36')){var _0x26e044={};_0x26e044[_0x47ae59[_0x702d('0x20')]]={'$like':'%'+_0x22809b[_0x702d('0x26')]['filter']+'%'};return _0x26e044;}})});}_0x10d169=_[_0x702d('0x34')]({},_0x10d169,_0x22809b['options']);var _0x4aab70={'where':_0x10d169[_0x702d('0x31')]};return db[_0x702d('0x24')][_0x702d('0x19')](_0x4aab70)[_0x702d('0xc')](function(_0x2b2228){_0x58624e['count']=_0x2b2228;if(_0x22809b[_0x702d('0x26')][_0x702d('0x37')]){_0x10d169[_0x702d('0x38')]=[{'all':!![]}];}return db[_0x702d('0x24')][_0x702d('0x39')](_0x10d169);})[_0x702d('0xc')](function(_0x2cc7c7){_0x58624e['rows']=_0x2cc7c7;return _0x58624e;})['then'](respondWithFilteredResult(_0x4de718,_0x10d169))['catch'](handleError(_0x4de718,null));};exports[_0x702d('0x3a')]=function(_0x505c1c,_0x59c88c){var _0x459b7c={'raw':!![],'where':{'id':_0x505c1c[_0x702d('0x3b')]['id']}},_0x4c401c={};_0x4c401c[_0x702d('0x2a')]=_[_0x702d('0x27')](db['Network'][_0x702d('0x25')]);_0x4c401c['query']=_['keys'](_0x505c1c[_0x702d('0x26')]);_0x4c401c[_0x702d('0x28')]=_[_0x702d('0x29')](_0x4c401c[_0x702d('0x2a')],_0x4c401c[_0x702d('0x26')]);_0x459b7c[_0x702d('0x2c')]=_[_0x702d('0x29')](_0x4c401c[_0x702d('0x2a')],qs[_0x702d('0x2b')](_0x505c1c['query'][_0x702d('0x2b')]));_0x459b7c['attributes']=_0x459b7c[_0x702d('0x2c')][_0x702d('0x2d')]?_0x459b7c['attributes']:_0x4c401c[_0x702d('0x2a')];if(_0x505c1c[_0x702d('0x26')][_0x702d('0x37')]){_0x459b7c['include']=[{'all':!![]}];}_0x459b7c=_[_0x702d('0x34')]({},_0x459b7c,_0x505c1c[_0x702d('0x3c')]);return db['Network'][_0x702d('0x3d')](_0x459b7c)[_0x702d('0xc')](handleEntityNotFound(_0x59c88c,null))[_0x702d('0xc')](respondWithResult(_0x59c88c,null))[_0x702d('0x3e')](handleError(_0x59c88c,null));};exports['create']=function(_0x13bb25,_0x1e6c6e){var _0x1a3903;return db[_0x702d('0x24')]['create'](_0x13bb25[_0x702d('0x3f')],{'raw':!![]})[_0x702d('0xc')](function(_0x31e82c){_0x1a3903=_0x31e82c;return db[_0x702d('0x24')][_0x702d('0x39')]({'where':{'type':_0x13bb25[_0x702d('0x3f')][_0x702d('0x35')]},'raw':!![]});})['then'](function(_0x53aaec){if(_0x1a3903[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x41')){var _0x4e00e8=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],_0x702d('0x44')),_0x702d('0x45'));var _0x107a49=ejs[_0x702d('0x46')](_0x4e00e8,{'networks':_0x53aaec||[]});fs[_0x702d('0x47')]('/etc/asterisk/stun_xcally.conf',_0x107a49);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x49'),{'module':_0x702d('0x4a')});}else if(_0x1a3903[_0x702d('0x35')]['toUpperCase']()==_0x702d('0x4b')){var _0x197863=fs['readFileSync'](path[_0x702d('0x4c')](config['root'],_0x702d('0x4d')),_0x702d('0x45'));var _0x3888ce=ejs['render'](_0x197863,{'networks':_0x53aaec||[]});fs[_0x702d('0x47')](_0x702d('0x4e'),_0x3888ce);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x49'),{'module':_0x702d('0x4a')});}else{var _0x4840cc=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x4395d0=ejs['render'](_0x4840cc,{'networks':_0x53aaec||[]});fs['writeFileSync'](util[_0x702d('0x4f')](_0x702d('0x50'),_0x13bb25[_0x702d('0x3f')][_0x702d('0x35')][_0x702d('0x51')]()),_0x4395d0);return respondWithRpcPromise('Reload',_0x702d('0x49'),{'module':_0x702d('0x52')});}})[_0x702d('0xc')](function(){return _0x1a3903;})[_0x702d('0xc')](respondWithResult(_0x1e6c6e,0xc9))['catch'](handleError(_0x1e6c6e,null));};exports['update']=function(_0x249cba,_0x26ab2b){var _0x6e96;return db[_0x702d('0x24')][_0x702d('0x3d')]({'where':{'id':_0x249cba['params']['id']}})[_0x702d('0xc')](handleEntityNotFound(_0x26ab2b,null))['then'](saveUpdates(_0x249cba['body'],null))[_0x702d('0xc')](function(_0x3f3023){if(_0x3f3023){_0x6e96=_0x3f3023;return db[_0x702d('0x24')]['findAll']({'where':{'type':_0x6e96[_0x702d('0x35')]},'raw':!![]});}return null;})['then'](function(_0x5ae097){if(_0x6e96['type'][_0x702d('0x40')]()==_0x702d('0x41')){var _0x1c9122=fs['readFileSync'](path[_0x702d('0x4c')](config['root'],_0x702d('0x44')),_0x702d('0x45'));var _0x2bf079=ejs[_0x702d('0x46')](_0x1c9122,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')]('/etc/asterisk/stun_xcally.conf',_0x2bf079);return respondWithRpcPromise(_0x702d('0x48'),'update',{'module':'res_stun_monitor.so'});}else if(_0x6e96[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x4b')){var _0x36b805=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/turn_multiple.ejs'),_0x702d('0x45'));var _0x1b8985=ejs[_0x702d('0x46')](_0x36b805,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')]('/etc/asterisk/turn_xcally.conf',_0x1b8985);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x53'),{'module':_0x702d('0x4a')});}else{var _0x484dd5=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x503cb1=ejs[_0x702d('0x46')](_0x484dd5,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')](util[_0x702d('0x4f')](_0x702d('0x50'),_0x249cba[_0x702d('0x3f')][_0x702d('0x35')]['toLowerCase']()),_0x503cb1);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x53'),{'module':_0x702d('0x52')});}})[_0x702d('0xc')](function(_0x27fc3a){if(_0x27fc3a){return _0x6e96;}return null;})[_0x702d('0xc')](respondWithResult(_0x26ab2b,null))[_0x702d('0x3e')](handleError(_0x26ab2b,null));};exports[_0x702d('0x1d')]=function(_0x5c952d,_0x24fe85){var _0x21064a;return db[_0x702d('0x24')][_0x702d('0x3d')]({'where':{'id':_0x5c952d[_0x702d('0x3b')]['id']}})[_0x702d('0xc')](function(_0xca6294){_0x21064a=_0xca6294;return _0xca6294;})[_0x702d('0xc')](handleEntityNotFound(_0x24fe85,null))[_0x702d('0xc')](removeEntity(_0x24fe85,null))[_0x702d('0xc')](function(){if(_0x21064a){return db['Network'][_0x702d('0x39')]({'where':{'type':_0x21064a[_0x702d('0x35')]},'raw':!![]});}})[_0x702d('0xc')](function(_0x22d47d){if(_0x21064a[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x41')){var _0x36e47b=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config['root'],_0x702d('0x44')),_0x702d('0x45'));var _0x2b563b=ejs[_0x702d('0x46')](_0x36e47b,{'networks':_0x22d47d||[]});fs[_0x702d('0x47')](_0x702d('0x54'),_0x2b563b);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x1d'),{'module':_0x702d('0x4a')});}else if(_0x21064a[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x4b')){var _0x2cde74=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],_0x702d('0x4d')),_0x702d('0x45'));var _0x4bfdbb=ejs['render'](_0x2cde74,{'networks':_0x22d47d||[]});fs[_0x702d('0x47')]('/etc/asterisk/turn_xcally.conf',_0x4bfdbb);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x1d'),{'module':_0x702d('0x4a')});}else{var _0x2e726f=fs['readFileSync'](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x1b2eee=ejs[_0x702d('0x46')](_0x2e726f,{'networks':_0x22d47d||[]});fs['writeFileSync'](util[_0x702d('0x4f')](_0x702d('0x50'),_0x21064a[_0x702d('0x35')][_0x702d('0x51')]()),_0x1b2eee);return respondWithRpcPromise('Reload',_0x702d('0x1d'),{'module':_0x702d('0x52')});}})[_0x702d('0x3e')](handleError(_0x24fe85,null));}; \ No newline at end of file +var _0x67b9=['path','ejs','../../config/logger','../../config/environment','jayson/promise','client','request','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','toUpperCase','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','root','writeFileSync','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','TURN','toLowerCase','server/files/templates/turn_multiple.ejs','util'];(function(_0x117487,_0xe79398){var _0x25cea3=function(_0x106805){while(--_0x106805){_0x117487['push'](_0x117487['shift']());}};_0x25cea3(++_0xe79398);}(_0x67b9,0x153));var _0x967b=function(_0x13b325,_0x95360a){_0x13b325=_0x13b325-0x0;var _0x305f0a=_0x67b9[_0x13b325];return _0x305f0a;};'use strict';var util=require(_0x967b('0x0'));var path=require(_0x967b('0x1'));var ejs=require(_0x967b('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x967b('0x3'))('api');var config=require(_0x967b('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0x967b('0x5'));var client=jayson[_0x967b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2396,_0x24b032,_0x3530a2,_0xeb109d){return new Promise(function(_0x348798,_0x1f5b3c){var _0x4415da=_0xeb109d||client;return _0x4415da[_0x967b('0x7')](_0x2d2396,_0x3530a2)['then'](function(_0x51529c){logger[_0x967b('0x8')](_0x967b('0x9'),_0x24b032,'request\x20sent');logger[_0x967b('0xa')]('Network,\x20%s,\x20%s,\x20%s',_0x24b032,_0x967b('0xb'),JSON[_0x967b('0xc')](_0x51529c));if(_0x51529c[_0x967b('0xd')]){if(_0x51529c[_0x967b('0xd')]['code']===0x1f4){logger[_0x967b('0xd')](_0x967b('0x9'),_0x24b032,_0x51529c[_0x967b('0xd')][_0x967b('0xe')]);return _0x1f5b3c(_0x51529c[_0x967b('0xd')][_0x967b('0xe')]);}logger[_0x967b('0xd')](_0x967b('0x9'),_0x24b032,_0x51529c[_0x967b('0xd')]['message']);return _0x348798(_0x51529c[_0x967b('0xd')]['message']);}else{logger[_0x967b('0x8')](_0x967b('0x9'),_0x24b032,_0x967b('0xb'));_0x348798(_0x51529c[_0x967b('0xf')][_0x967b('0xe')]);}})[_0x967b('0x10')](function(_0x9f803a){logger[_0x967b('0xd')]('Network,\x20%s,\x20%s',_0x24b032,_0x9f803a);_0x1f5b3c(_0x9f803a);});});}function respondWithResult(_0x311381,_0x7d65a){_0x7d65a=_0x7d65a||0xc8;return function(_0x3ffaf4){if(_0x3ffaf4){return _0x311381['status'](_0x7d65a)[_0x967b('0x11')](_0x3ffaf4);}};}function respondWithFilteredResult(_0x5e839f,_0x4d2214){return function(_0x5e3e61){if(_0x5e3e61){var _0x28c3f6=typeof _0x4d2214[_0x967b('0x12')]===_0x967b('0x13')&&typeof _0x4d2214[_0x967b('0x14')]==='undefined';var _0x1dc4b3=_0x5e3e61[_0x967b('0x15')];var _0x526bf0=_0x28c3f6?0x0:_0x4d2214['offset'];var _0x43ae73=_0x28c3f6?_0x5e3e61[_0x967b('0x15')]:_0x4d2214[_0x967b('0x12')]+_0x4d2214[_0x967b('0x14')];var _0x3404da;if(_0x43ae73>=_0x1dc4b3){_0x43ae73=_0x1dc4b3;_0x3404da=0xc8;}else{_0x3404da=0xce;}_0x5e839f[_0x967b('0x16')](_0x3404da);return _0x5e839f[_0x967b('0x17')](_0x967b('0x18'),_0x526bf0+'-'+_0x43ae73+'/'+_0x1dc4b3)['json'](_0x5e3e61);}return null;};}function saveUpdates(_0x51c847){return function(_0x1a0d9e){if(_0x1a0d9e){return _0x1a0d9e[_0x967b('0x19')](_0x51c847)['then'](function(_0x39c328){return _0x39c328;});}return null;};}function removeEntity(_0x53b276){return function(_0x58377e){if(_0x58377e){return _0x58377e[_0x967b('0x1a')]()[_0x967b('0x1b')](function(){_0x53b276['status'](0xcc)[_0x967b('0x1c')]();});}};}function handleEntityNotFound(_0x4f39e7){return function(_0x1938d1){if(!_0x1938d1){_0x4f39e7[_0x967b('0x1d')](0x194);}return _0x1938d1;};}function handleError(_0x4d51ae,_0x1a3ef8){_0x1a3ef8=_0x1a3ef8||0x1f4;return function(_0x1185a4){logger[_0x967b('0xd')](_0x1185a4[_0x967b('0x1e')]);if(_0x1185a4[_0x967b('0x1f')]){delete _0x1185a4[_0x967b('0x1f')];}_0x4d51ae[_0x967b('0x16')](_0x1a3ef8)[_0x967b('0x20')](_0x1185a4);};}exports[_0x967b('0x21')]=function(_0x4ff4aa,_0x2e9916){var _0x260d94={},_0x21de31={},_0x75a8ac={'count':0x0,'rows':[]};var _0x1fa62d=_[_0x967b('0x22')](db[_0x967b('0x23')][_0x967b('0x24')],function(_0x4ef920){return{'name':_0x4ef920['fieldName'],'type':_0x4ef920[_0x967b('0x25')][_0x967b('0x26')]};});_0x21de31[_0x967b('0x27')]=_[_0x967b('0x22')](_0x1fa62d,_0x967b('0x1f'));_0x21de31[_0x967b('0x28')]=_[_0x967b('0x29')](_0x4ff4aa[_0x967b('0x28')]);_0x21de31[_0x967b('0x2a')]=_[_0x967b('0x2b')](_0x21de31[_0x967b('0x27')],_0x21de31[_0x967b('0x28')]);_0x260d94['attributes']=_[_0x967b('0x2b')](_0x21de31['model'],qs[_0x967b('0x2c')](_0x4ff4aa[_0x967b('0x28')]['fields']));_0x260d94[_0x967b('0x2d')]=_0x260d94['attributes'][_0x967b('0x2e')]?_0x260d94[_0x967b('0x2d')]:_0x21de31[_0x967b('0x27')];if(!_0x4ff4aa[_0x967b('0x28')][_0x967b('0x2f')]('nolimit')){_0x260d94[_0x967b('0x14')]=qs['limit'](_0x4ff4aa[_0x967b('0x28')][_0x967b('0x14')]);_0x260d94[_0x967b('0x12')]=qs[_0x967b('0x12')](_0x4ff4aa[_0x967b('0x28')][_0x967b('0x12')]);}_0x260d94[_0x967b('0x30')]=qs[_0x967b('0x31')](_0x4ff4aa[_0x967b('0x28')][_0x967b('0x31')]);_0x260d94[_0x967b('0x32')]=qs[_0x967b('0x2a')](_[_0x967b('0x33')](_0x4ff4aa[_0x967b('0x28')],_0x21de31['filters']),_0x1fa62d);if(_0x4ff4aa[_0x967b('0x28')][_0x967b('0x34')]){_0x260d94[_0x967b('0x32')]=_[_0x967b('0x35')](_0x260d94[_0x967b('0x32')],{'$or':_[_0x967b('0x22')](_0x1fa62d,function(_0x480b88){if(_0x480b88[_0x967b('0x25')]!==_0x967b('0x36')){var _0x33b453={};_0x33b453[_0x480b88['name']]={'$like':'%'+_0x4ff4aa['query']['filter']+'%'};return _0x33b453;}})});}_0x260d94=_['merge']({},_0x260d94,_0x4ff4aa[_0x967b('0x37')]);var _0x1b547b={'where':_0x260d94[_0x967b('0x32')]};return db['Network'][_0x967b('0x15')](_0x1b547b)['then'](function(_0x44e4c3){_0x75a8ac[_0x967b('0x15')]=_0x44e4c3;if(_0x4ff4aa[_0x967b('0x28')][_0x967b('0x38')]){_0x260d94['include']=[{'all':!![]}];}return db[_0x967b('0x23')][_0x967b('0x39')](_0x260d94);})[_0x967b('0x1b')](function(_0x1428ca){_0x75a8ac[_0x967b('0x3a')]=_0x1428ca;return _0x75a8ac;})[_0x967b('0x1b')](respondWithFilteredResult(_0x2e9916,_0x260d94))[_0x967b('0x10')](handleError(_0x2e9916,null));};exports[_0x967b('0x3b')]=function(_0x1182cb,_0x37f11a){var _0x82cf98={'raw':!![],'where':{'id':_0x1182cb[_0x967b('0x3c')]['id']}},_0x1c0901={};_0x1c0901['model']=_[_0x967b('0x29')](db[_0x967b('0x23')][_0x967b('0x24')]);_0x1c0901[_0x967b('0x28')]=_[_0x967b('0x29')](_0x1182cb[_0x967b('0x28')]);_0x1c0901[_0x967b('0x2a')]=_['intersection'](_0x1c0901[_0x967b('0x27')],_0x1c0901[_0x967b('0x28')]);_0x82cf98['attributes']=_[_0x967b('0x2b')](_0x1c0901[_0x967b('0x27')],qs[_0x967b('0x2c')](_0x1182cb[_0x967b('0x28')][_0x967b('0x2c')]));_0x82cf98[_0x967b('0x2d')]=_0x82cf98[_0x967b('0x2d')]['length']?_0x82cf98['attributes']:_0x1c0901[_0x967b('0x27')];if(_0x1182cb[_0x967b('0x28')][_0x967b('0x38')]){_0x82cf98[_0x967b('0x3d')]=[{'all':!![]}];}_0x82cf98=_[_0x967b('0x35')]({},_0x82cf98,_0x1182cb[_0x967b('0x37')]);return db[_0x967b('0x23')][_0x967b('0x3e')](_0x82cf98)[_0x967b('0x1b')](handleEntityNotFound(_0x37f11a,null))[_0x967b('0x1b')](respondWithResult(_0x37f11a,null))[_0x967b('0x10')](handleError(_0x37f11a,null));};exports[_0x967b('0x3f')]=function(_0x3f69dd,_0x2e0e81){var _0x484584;return db[_0x967b('0x23')][_0x967b('0x3f')](_0x3f69dd[_0x967b('0x40')],{'raw':!![]})[_0x967b('0x1b')](function(_0x32abd2){_0x484584=_0x32abd2;return db[_0x967b('0x23')][_0x967b('0x39')]({'where':{'type':_0x3f69dd[_0x967b('0x40')][_0x967b('0x25')]},'raw':!![]});})[_0x967b('0x1b')](function(_0x4ac6d4){if(_0x484584[_0x967b('0x25')][_0x967b('0x41')]()=='STUN'){var _0xe78277=fs['readFileSync'](path['join'](config['root'],_0x967b('0x42')),_0x967b('0x43'));var _0x5b5373=ejs[_0x967b('0x44')](_0xe78277,{'networks':_0x4ac6d4||[]});fs['writeFileSync'](_0x967b('0x45'),_0x5b5373);return respondWithRpcPromise(_0x967b('0x46'),'create',{'module':_0x967b('0x47')});}else if(_0x484584[_0x967b('0x25')]['toUpperCase']()=='TURN'){var _0x3a007f=fs[_0x967b('0x48')](path['join'](config[_0x967b('0x49')],'server/files/templates/turn_multiple.ejs'),_0x967b('0x43'));var _0x466d08=ejs[_0x967b('0x44')](_0x3a007f,{'networks':_0x4ac6d4||[]});fs[_0x967b('0x4a')](_0x967b('0x4b'),_0x466d08);return respondWithRpcPromise(_0x967b('0x46'),_0x967b('0x3f'),{'module':_0x967b('0x47')});}else{var _0x30ee31=fs[_0x967b('0x48')](path[_0x967b('0x4c')](config[_0x967b('0x49')],_0x967b('0x4d')),_0x967b('0x43'));var _0x4b590b=ejs[_0x967b('0x44')](_0x30ee31,{'networks':_0x4ac6d4||[]});fs['writeFileSync'](util[_0x967b('0x4e')](_0x967b('0x4f'),_0x3f69dd['body'][_0x967b('0x25')]['toLowerCase']()),_0x4b590b);return respondWithRpcPromise(_0x967b('0x46'),_0x967b('0x3f'),{'module':_0x967b('0x50')});}})['then'](function(){return _0x484584;})[_0x967b('0x1b')](respondWithResult(_0x2e0e81,0xc9))[_0x967b('0x10')](handleError(_0x2e0e81,null));};exports[_0x967b('0x19')]=function(_0x57859b,_0xdf4188){var _0x599679;return db[_0x967b('0x23')][_0x967b('0x3e')]({'where':{'id':_0x57859b[_0x967b('0x3c')]['id']}})[_0x967b('0x1b')](handleEntityNotFound(_0xdf4188,null))[_0x967b('0x1b')](saveUpdates(_0x57859b['body'],null))[_0x967b('0x1b')](function(_0x117be8){if(_0x117be8){_0x599679=_0x117be8;return db[_0x967b('0x23')][_0x967b('0x39')]({'where':{'type':_0x599679[_0x967b('0x25')]},'raw':!![]});}return null;})[_0x967b('0x1b')](function(_0x2b9a5f){if(_0x599679[_0x967b('0x25')][_0x967b('0x41')]()==_0x967b('0x51')){var _0x3d8368=fs[_0x967b('0x48')](path['join'](config['root'],_0x967b('0x42')),_0x967b('0x43'));var _0x502209=ejs[_0x967b('0x44')](_0x3d8368,{'networks':_0x2b9a5f||[]});fs[_0x967b('0x4a')](_0x967b('0x45'),_0x502209);return respondWithRpcPromise('Reload','update',{'module':_0x967b('0x47')});}else if(_0x599679[_0x967b('0x25')]['toUpperCase']()==_0x967b('0x52')){var _0x21aab8=fs[_0x967b('0x48')](path[_0x967b('0x4c')](config[_0x967b('0x49')],'server/files/templates/turn_multiple.ejs'),_0x967b('0x43'));var _0x346c6f=ejs[_0x967b('0x44')](_0x21aab8,{'networks':_0x2b9a5f||[]});fs[_0x967b('0x4a')](_0x967b('0x4b'),_0x346c6f);return respondWithRpcPromise('Reload','update',{'module':_0x967b('0x47')});}else{var _0x413e43=fs[_0x967b('0x48')](path[_0x967b('0x4c')](config[_0x967b('0x49')],'server/files/templates/network.ejs'),_0x967b('0x43'));var _0x22ddb2=ejs[_0x967b('0x44')](_0x413e43,{'networks':_0x2b9a5f||[]});fs[_0x967b('0x4a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x57859b[_0x967b('0x40')][_0x967b('0x25')][_0x967b('0x53')]()),_0x22ddb2);return respondWithRpcPromise(_0x967b('0x46'),_0x967b('0x19'),{'module':'chan_sip.so'});}})[_0x967b('0x1b')](function(_0x2be0fa){if(_0x2be0fa){return _0x599679;}return null;})[_0x967b('0x1b')](respondWithResult(_0xdf4188,null))[_0x967b('0x10')](handleError(_0xdf4188,null));};exports[_0x967b('0x1a')]=function(_0x569312,_0x308ca0){var _0xdd4611;return db['Network'][_0x967b('0x3e')]({'where':{'id':_0x569312[_0x967b('0x3c')]['id']}})[_0x967b('0x1b')](function(_0x2c9334){_0xdd4611=_0x2c9334;return _0x2c9334;})[_0x967b('0x1b')](handleEntityNotFound(_0x308ca0,null))[_0x967b('0x1b')](removeEntity(_0x308ca0,null))[_0x967b('0x1b')](function(){if(_0xdd4611){return db[_0x967b('0x23')][_0x967b('0x39')]({'where':{'type':_0xdd4611[_0x967b('0x25')]},'raw':!![]});}})[_0x967b('0x1b')](function(_0xfa1ae6){if(_0xdd4611[_0x967b('0x25')][_0x967b('0x41')]()==_0x967b('0x51')){var _0x113a82=fs[_0x967b('0x48')](path[_0x967b('0x4c')](config[_0x967b('0x49')],_0x967b('0x42')),_0x967b('0x43'));var _0x584b58=ejs[_0x967b('0x44')](_0x113a82,{'networks':_0xfa1ae6||[]});fs[_0x967b('0x4a')](_0x967b('0x45'),_0x584b58);return respondWithRpcPromise('Reload',_0x967b('0x1a'),{'module':_0x967b('0x47')});}else if(_0xdd4611['type'][_0x967b('0x41')]()=='TURN'){var _0x20d1ba=fs['readFileSync'](path['join'](config[_0x967b('0x49')],_0x967b('0x54')),_0x967b('0x43'));var _0x9df53f=ejs['render'](_0x20d1ba,{'networks':_0xfa1ae6||[]});fs[_0x967b('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x9df53f);return respondWithRpcPromise(_0x967b('0x46'),_0x967b('0x1a'),{'module':_0x967b('0x47')});}else{var _0x3471e7=fs[_0x967b('0x48')](path[_0x967b('0x4c')](config['root'],_0x967b('0x4d')),_0x967b('0x43'));var _0x1f225b=ejs[_0x967b('0x44')](_0x3471e7,{'networks':_0xfa1ae6||[]});fs[_0x967b('0x4a')](util[_0x967b('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0xdd4611[_0x967b('0x25')]['toLowerCase']()),_0x1f225b);return respondWithRpcPromise('Reload','destroy',{'module':_0x967b('0x50')});}})['catch'](handleError(_0x308ca0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8ce036f..6706599 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 _0x0c5d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','lodash','util'];(function(_0x4692a8,_0x2d4d8d){var _0x2ec246=function(_0x1a373b){while(--_0x1a373b){_0x4692a8['push'](_0x4692a8['shift']());}};_0x2ec246(++_0x2d4d8d);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x48afc7,_0x1a5335){_0x48afc7=_0x48afc7-0x0;var _0x384b5e=_0x0c5d[_0x48afc7];return _0x384b5e;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var logger=require('../../config/logger')(_0xd0c5('0x2'));var moment=require('moment');var BPromise=require(_0xd0c5('0x3'));var rp=require(_0xd0c5('0x4'));var fs=require('fs');var path=require(_0xd0c5('0x5'));var rimraf=require(_0xd0c5('0x6'));var config=require(_0xd0c5('0x7'));var attributes=require(_0xd0c5('0x8'));module[_0xd0c5('0x9')]=function(_0x121911,_0x569992){return _0x121911[_0xd0c5('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','lodash','api','moment'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x2e54,0x1dd));var _0x42e5=function(_0xd2490,_0x23862a){_0xd2490=_0xd2490-0x0;var _0x401b12=_0x2e54[_0xd2490];return _0x401b12;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require(_0x42e5('0x5'));var rimraf=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var attributes=require('./network.attributes');module[_0x42e5('0x8')]=function(_0x455f48,_0x38cb1b){return _0x455f48['define'](_0x42e5('0x9'),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 51fa0d4..75b91d9 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x21391a,_0x403fb9){_0x21391a=_0x21391a-0x0;var _0x2a27c2=_0x7a54[_0x21391a];return _0x2a27c2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3497e2,_0x24c992){var _0x1cba36=function(_0x229deb){while(--_0x229deb){_0x3497e2['push'](_0x3497e2['shift']());}};_0x1cba36(++_0x24c992);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 10f70ae..e3279ec 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 _0x02ea=['removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','put','/:id','update','delete','destroy'];(function(_0x3cffde,_0x4b06da){var _0x464490=function(_0x16ce67){while(--_0x16ce67){_0x3cffde['push'](_0x3cffde['shift']());}};_0x464490(++_0x4b06da);}(_0x02ea,0x1cb));var _0xa02e=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x02ea[_0x38987f];return _0x4cb697;};'use strict';var multer=require(_0xa02e('0x0'));var util=require(_0xa02e('0x1'));var path=require(_0xa02e('0x2'));var timeout=require(_0xa02e('0x3'));var express=require(_0xa02e('0x4'));var router=express[_0xa02e('0x5')]();var fs_extra=require(_0xa02e('0x6'));var auth=require(_0xa02e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa02e('0x8'));var controller=require('./openchannelAccount.controller');router[_0xa02e('0x9')]('/',auth[_0xa02e('0xa')](),controller[_0xa02e('0xb')]);router[_0xa02e('0x9')]('/describe',auth[_0xa02e('0xa')](),controller['describe']);router['get']('/:id',auth[_0xa02e('0xa')](),controller[_0xa02e('0xc')]);router[_0xa02e('0x9')](_0xa02e('0xd'),auth[_0xa02e('0xa')](),controller['getDispositions']);router[_0xa02e('0x9')](_0xa02e('0xe'),auth[_0xa02e('0xa')](),controller[_0xa02e('0xf')]);router['get']('/:id/applications',auth[_0xa02e('0xa')](),controller[_0xa02e('0x10')]);router['get'](_0xa02e('0x11'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x12')]);router['get'](_0xa02e('0x13'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x14')]);router[_0xa02e('0x15')]('/',auth[_0xa02e('0xa')](),controller[_0xa02e('0x16')]);router[_0xa02e('0x15')](_0xa02e('0xd'),auth['isAuthenticated'](),controller[_0xa02e('0x17')]);router[_0xa02e('0x15')](_0xa02e('0xe'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x18')]);router['post'](_0xa02e('0x19'),controller[_0xa02e('0x1a')]);router[_0xa02e('0x15')](_0xa02e('0x1b'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x1c')]);router[_0xa02e('0x15')](_0xa02e('0x13'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x1d')]);router['post']('/:id/send',auth[_0xa02e('0xa')](),controller['send']);router[_0xa02e('0x1e')](_0xa02e('0x1f'),auth['isAuthenticated'](),controller[_0xa02e('0x20')]);router[_0xa02e('0x21')](_0xa02e('0x1f'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x22')]);router[_0xa02e('0x21')](_0xa02e('0xd'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x23')]);router[_0xa02e('0x21')](_0xa02e('0xe'),auth['isAuthenticated'](),controller[_0xa02e('0x24')]);router[_0xa02e('0x21')]('/:id/users',auth[_0xa02e('0xa')](),controller[_0xa02e('0x25')]);module['exports']=router; \ No newline at end of file +var _0x1588=['get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','notify','/:id/users','addAgents','update','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x1588,0x10f));var _0x8158=function(_0x3dab49,_0x1ebeb1){_0x3dab49=_0x3dab49-0x0;var _0x275819=_0x1588[_0x3dab49];return _0x275819;};'use strict';var multer=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));var path=require(_0x8158('0x2'));var timeout=require(_0x8158('0x3'));var express=require(_0x8158('0x4'));var router=express[_0x8158('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8158('0x6'));var interaction=require(_0x8158('0x7'));var config=require('../../config/environment');var controller=require(_0x8158('0x8'));router[_0x8158('0x9')]('/',auth['isAuthenticated'](),controller[_0x8158('0xa')]);router['get'](_0x8158('0xb'),auth[_0x8158('0xc')](),controller[_0x8158('0xd')]);router['get'](_0x8158('0xe'),auth[_0x8158('0xc')](),controller[_0x8158('0xf')]);router[_0x8158('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8158('0x10')]);router['get'](_0x8158('0x11'),auth['isAuthenticated'](),controller[_0x8158('0x12')]);router[_0x8158('0x9')](_0x8158('0x13'),auth[_0x8158('0xc')](),controller[_0x8158('0x14')]);router['get'](_0x8158('0x15'),auth[_0x8158('0xc')](),controller[_0x8158('0x16')]);router[_0x8158('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x8158('0x17')]);router[_0x8158('0x18')]('/',auth['isAuthenticated'](),controller[_0x8158('0x19')]);router[_0x8158('0x18')](_0x8158('0x1a'),auth[_0x8158('0xc')](),controller[_0x8158('0x1b')]);router['post'](_0x8158('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x8158('0x18')]('/:id/notify',controller[_0x8158('0x1c')]);router[_0x8158('0x18')](_0x8158('0x13'),auth['isAuthenticated'](),controller['addApplications']);router[_0x8158('0x18')](_0x8158('0x1d'),auth[_0x8158('0xc')](),controller[_0x8158('0x1e')]);router[_0x8158('0x18')]('/:id/send',auth['isAuthenticated'](),controller['send']);router['put'](_0x8158('0xe'),auth['isAuthenticated'](),controller[_0x8158('0x1f')]);router[_0x8158('0x20')]('/:id',auth[_0x8158('0xc')](),controller['destroy']);router[_0x8158('0x20')](_0x8158('0x1a'),auth[_0x8158('0xc')](),controller[_0x8158('0x21')]);router[_0x8158('0x20')](_0x8158('0x11'),auth[_0x8158('0xc')](),controller['removeAnswers']);router['delete'](_0x8158('0x1d'),auth[_0x8158('0xc')](),controller[_0x8158('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d8474c6..edfefe2 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 _0xcd75=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3afd24,_0x132824){var _0x488fad=function(_0x39719f){while(--_0x39719f){_0x3afd24['push'](_0x3afd24['shift']());}};_0x488fad(++_0x132824);}(_0xcd75,0x19a));var _0x5cd7=function(_0x5e38d4,_0x5da333){_0x5e38d4=_0x5e38d4-0x0;var _0x4b010f=_0xcd75[_0x5e38d4];return _0x4b010f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5cd7('0x0')]={'name':{'type':Sequelize[_0x5cd7('0x1')],'unique':_0x5cd7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5cd7('0x1')]},'token':{'type':Sequelize[_0x5cd7('0x1')],'defaultValue':function(){return rs[_0x5cd7('0x3')]();}},'replyUri':{'type':Sequelize[_0x5cd7('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5cd7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5cd7('0x4')],'defaultValue':function(){return _0x5cd7('0x5');}},'notificationSound':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cd7('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5cd7('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![],'comment':_0x5cd7('0x9'),'set':function(_0x23ec6){if(!_0x23ec6)this[_0x5cd7('0xa')](_0x5cd7('0xb'),null);this[_0x5cd7('0xa')](_0x5cd7('0xc'),_0x23ec6);}}}; \ No newline at end of file +var _0x63df=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate'];(function(_0x20f288,_0x42b564){var _0x800caf=function(_0x47aa1e){while(--_0x47aa1e){_0x20f288['push'](_0x20f288['shift']());}};_0x800caf(++_0x42b564);}(_0x63df,0xcb));var _0xf63d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x63df[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf63d('0x0'));module[_0xf63d('0x1')]={'name':{'type':Sequelize[_0xf63d('0x2')],'unique':_0xf63d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf63d('0x2')]},'token':{'type':Sequelize[_0xf63d('0x2')],'defaultValue':function(){return rs[_0xf63d('0x4')]();}},'replyUri':{'type':Sequelize[_0xf63d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf63d('0x5');}},'notificationSound':{'type':Sequelize[_0xf63d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf63d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf63d('0x2')]},'queueTransfer':{'type':Sequelize[_0xf63d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf63d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf63d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf63d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf63d('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xf63d('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf63d('0x9'),'set':function(_0x8a1974){if(!_0x8a1974)this[_0xf63d('0xa')](_0xf63d('0xb'),null);this[_0xf63d('0xa')](_0xf63d('0xc'),_0x8a1974);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7561830..2f0d16f 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 _0xaafc=['crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','offset','count','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','includeAll','options','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','asc','account','defaults','lastName','threadId','OpenchannelInteraction','ContactId','contact','firstName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','priority','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel'];(function(_0x5bc105,_0x2ff002){var _0x26468f=function(_0x511642){while(--_0x511642){_0x5bc105['push'](_0x5bc105['shift']());}};_0x26468f(++_0x2ff002);}(_0xaafc,0x176));var _0xcaaf=function(_0xd8abb1,_0x3e2bae){_0xd8abb1=_0xd8abb1-0x0;var _0x5ca637=_0xaafc[_0xd8abb1];return _0x5ca637;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaaf('0x0'));var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require(_0xcaaf('0x2'));var rp=require(_0xcaaf('0x3'));var moment=require('moment');var BPromise=require(_0xcaaf('0x4'));var Mustache=require(_0xcaaf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xcaaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaaf('0x8'));var squel=require(_0xcaaf('0x9'));var crypto=require(_0xcaaf('0xa'));var jsforce=require(_0xcaaf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaaf('0xc'));var querystring=require('querystring');var Papa=require(_0xcaaf('0xd'));var Redis=require('ioredis');var authService=require(_0xcaaf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcaaf('0xf'));var hardwareService=require(_0xcaaf('0x10'));var logger=require(_0xcaaf('0x11'))(_0xcaaf('0x12'));var utils=require(_0xcaaf('0x13'));var config=require(_0xcaaf('0x14'));var licenseUtil=require(_0xcaaf('0x15'));var db=require(_0xcaaf('0x16'))['db'];config[_0xcaaf('0x17')]=_['defaults'](config[_0xcaaf('0x17')],{'host':_0xcaaf('0x18'),'port':0x18eb});var socket=require(_0xcaaf('0x19'))(new Redis(config[_0xcaaf('0x17')]));require(_0xcaaf('0x1a'))[_0xcaaf('0x1b')](socket);var jayson=require(_0xcaaf('0x1c'));var client=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232c});var client9002=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x552cf1,_0x301344,_0xb8532b,_0x7f23fb){return new BPromise(function(_0x3bb678,_0x3580ac){var _0x360078=_0x7f23fb||client;return _0x360078['request'](_0x552cf1,_0xb8532b)[_0xcaaf('0x1f')](function(_0x10ad54){logger['info'](_0xcaaf('0x20'),_0x301344,_0xcaaf('0x21'));logger[_0xcaaf('0x22')](_0xcaaf('0x23'),_0x301344,_0xcaaf('0x21'),JSON[_0xcaaf('0x24')](_0x10ad54));if(_0x10ad54[_0xcaaf('0x25')]){if(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x26')]===0x1f4){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54['error'][_0xcaaf('0x27')]);return _0x3580ac(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);}logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);return _0x3bb678(_0x10ad54['error'][_0xcaaf('0x27')]);}else{logger[_0xcaaf('0x28')](_0xcaaf('0x20'),_0x301344,'request\x20sent');_0x3bb678(_0x10ad54[_0xcaaf('0x29')][_0xcaaf('0x27')]);}})[_0xcaaf('0x2a')](function(_0x3dac7d){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x3dac7d);_0x3580ac(_0x3dac7d);});});}function respondWithStatusCode(_0x1cc1fb,_0x4ffbab){_0x4ffbab=_0x4ffbab||0xcc;return function(_0x387319){if(_0x387319){return _0x1cc1fb['sendStatus'](_0x4ffbab);}return _0x1cc1fb['status'](_0x4ffbab)['end']();};}function respondWithResult(_0x30d68a,_0x85b4a){_0x85b4a=_0x85b4a||0xc8;return function(_0x149dbb){if(_0x149dbb){return _0x30d68a[_0xcaaf('0x2b')](_0x85b4a)[_0xcaaf('0x2c')](_0x149dbb);}};}function respondWithFilteredResult(_0x35e500,_0x20be72){return function(_0x34019c){if(_0x34019c){var _0x1523bc=typeof _0x20be72['offset']==='undefined'&&typeof _0x20be72[_0xcaaf('0x2d')]==='undefined';var _0x4429e3=_0x34019c['count'];var _0x343cd5=_0x1523bc?0x0:_0x20be72[_0xcaaf('0x2e')];var _0x2e8530=_0x1523bc?_0x34019c[_0xcaaf('0x2f')]:_0x20be72['offset']+_0x20be72[_0xcaaf('0x2d')];var _0x2d0881;if(_0x2e8530>=_0x4429e3){_0x2e8530=_0x4429e3;_0x2d0881=0xc8;}else{_0x2d0881=0xce;}_0x35e500[_0xcaaf('0x2b')](_0x2d0881);return _0x35e500['set']('Content-Range',_0x343cd5+'-'+_0x2e8530+'/'+_0x4429e3)[_0xcaaf('0x2c')](_0x34019c);}return null;};}function patchUpdates(_0xe1207f){return function(_0x5696e4){try{jsonpatch[_0xcaaf('0x30')](_0x5696e4,_0xe1207f,!![]);}catch(_0x315565){return BPromise[_0xcaaf('0x31')](_0x315565);}return _0x5696e4[_0xcaaf('0x32')]();};}function saveUpdates(_0x427510,_0x3cdf87){return function(_0x19135d){if(_0x19135d){return _0x19135d[_0xcaaf('0x33')](_0x427510)[_0xcaaf('0x1f')](function(_0x4f1eb1){return _0x4f1eb1;});}return null;};}function removeEntity(_0x48b018,_0x318e42){return function(_0x581c02){if(_0x581c02){return _0x581c02[_0xcaaf('0x34')]()[_0xcaaf('0x1f')](function(){var _0x73267e=_0x581c02['get']({'plain':!![]});var _0x5aae88=_0xcaaf('0x35');return db[_0xcaaf('0x36')]['destroy']({'where':{'type':_0x5aae88,'resourceId':_0x73267e['id']}})['then'](function(){return _0x581c02;});})[_0xcaaf('0x1f')](function(){_0x48b018[_0xcaaf('0x2b')](0xcc)[_0xcaaf('0x37')]();});}};}function handleEntityNotFound(_0x5be05f,_0x1000c0){return function(_0x47afbb){if(!_0x47afbb){_0x5be05f[_0xcaaf('0x38')](0x194);}return _0x47afbb;};}function handleError(_0x5bc988,_0x458cd5){_0x458cd5=_0x458cd5||0x1f4;return function(_0x44abfd){logger['error'](_0x44abfd['stack']);if(_0x44abfd[_0xcaaf('0x39')]){delete _0x44abfd[_0xcaaf('0x39')];}_0x5bc988['status'](_0x458cd5)[_0xcaaf('0x3a')](_0x44abfd);};}exports[_0xcaaf('0x3b')]=function(_0x4e91a8,_0x210268){var _0x4d428f={'include':[{'model':db[_0xcaaf('0x3c')],'as':_0xcaaf('0x3d')}]},_0x2ef2e7={},_0x139aa3={'count':0x0,'rows':[]};var _0x136a1f=_[_0xcaaf('0x3e')](db[_0xcaaf('0x3f')][_0xcaaf('0x40')],function(_0x26571b){return{'name':_0x26571b['fieldName'],'type':_0x26571b['type'][_0xcaaf('0x41')]};});_0x2ef2e7['model']=_[_0xcaaf('0x3e')](_0x136a1f,'name');_0x2ef2e7[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0x4e91a8[_0xcaaf('0x42')]);_0x2ef2e7[_0xcaaf('0x44')]=_['intersection'](_0x2ef2e7[_0xcaaf('0x45')],_0x2ef2e7[_0xcaaf('0x42')]);_0x4d428f['attributes']=_[_0xcaaf('0x46')](_0x2ef2e7[_0xcaaf('0x45')],qs[_0xcaaf('0x47')](_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x4d428f[_0xcaaf('0x48')]=_0x4d428f[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x4d428f[_0xcaaf('0x48')]:_0x2ef2e7[_0xcaaf('0x45')];if(!_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x4d428f[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x4e91a8[_0xcaaf('0x42')]['limit']);_0x4d428f['offset']=qs['offset'](_0x4e91a8['query'][_0xcaaf('0x2e')]);}_0x4d428f[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x4e91a8[_0xcaaf('0x42')]['sort']);_0x4d428f['where']=qs['filters'](_[_0xcaaf('0x4e')](_0x4e91a8[_0xcaaf('0x42')],_0x2ef2e7[_0xcaaf('0x44')]),_0x136a1f);if(_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x4d428f[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x4d428f['where'],{'$or':_[_0xcaaf('0x3e')](_0x136a1f,function(_0x14ecbe){if(_0x14ecbe['type']!=='VIRTUAL'){var _0x5c95ed={};_0x5c95ed[_0x14ecbe[_0xcaaf('0x39')]]={'$like':'%'+_0x4e91a8[_0xcaaf('0x42')]['filter']+'%'};return _0x5c95ed;}})});}_0x4d428f=_[_0xcaaf('0x51')]({},_0x4d428f,_0x4e91a8['options']);var _0x510324={'where':_0x4d428f[_0xcaaf('0x50')]};return db[_0xcaaf('0x3f')][_0xcaaf('0x2f')](_0x510324)[_0xcaaf('0x1f')](function(_0x1e1321){_0x139aa3[_0xcaaf('0x2f')]=_0x1e1321;if(_0x4e91a8[_0xcaaf('0x42')]['includeAll']){_0x4d428f[_0xcaaf('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xcaaf('0x53')](_0x4d428f);})[_0xcaaf('0x1f')](function(_0x17676b){_0x139aa3[_0xcaaf('0x54')]=_0x17676b;return _0x139aa3;})['then'](respondWithFilteredResult(_0x210268,_0x4d428f))[_0xcaaf('0x2a')](handleError(_0x210268,null));};exports['show']=function(_0x10e4d6,_0x421da7){var _0x30c4ac={'raw':![],'where':{'id':_0x10e4d6[_0xcaaf('0x55')]['id']},'include':[{'model':db[_0xcaaf('0x3c')],'as':_0xcaaf('0x3d')}]},_0x111270={};_0x111270[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x3f')][_0xcaaf('0x40')]);_0x111270['query']=_[_0xcaaf('0x43')](_0x10e4d6['query']);_0x111270[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x111270['model'],_0x111270[_0xcaaf('0x42')]);_0x30c4ac[_0xcaaf('0x48')]=_['intersection'](_0x111270[_0xcaaf('0x45')],qs['fields'](_0x10e4d6[_0xcaaf('0x42')]['fields']));_0x30c4ac[_0xcaaf('0x48')]=_0x30c4ac[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x30c4ac[_0xcaaf('0x48')]:_0x111270[_0xcaaf('0x45')];if(_0x10e4d6[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x30c4ac[_0xcaaf('0x52')]=[{'all':!![]}];}_0x30c4ac=_[_0xcaaf('0x51')]({},_0x30c4ac,_0x10e4d6[_0xcaaf('0x57')]);return db[_0xcaaf('0x3f')]['find'](_0x30c4ac)[_0xcaaf('0x1f')](handleEntityNotFound(_0x421da7,null))[_0xcaaf('0x1f')](respondWithResult(_0x421da7,null))[_0xcaaf('0x2a')](handleError(_0x421da7,null));};exports[_0xcaaf('0x58')]=function(_0x3ca2a5,_0x1771ff){return db[_0xcaaf('0x3f')][_0xcaaf('0x58')](_0x3ca2a5[_0xcaaf('0x59')],{})[_0xcaaf('0x1f')](function(_0x497059){var _0x545ee1=_0x3ca2a5[_0xcaaf('0x5a')][_0xcaaf('0x5b')]({'plain':!![]});if(!_0x545ee1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x545ee1[_0xcaaf('0x5c')]===_0xcaaf('0x5a')){var _0x49d439=_0x497059[_0xcaaf('0x5b')]({'plain':!![]});var _0x46ff21='OpenchannelAccounts';return db[_0xcaaf('0x5d')][_0xcaaf('0x5e')]({'where':{'name':_0x46ff21,'userProfileId':_0x545ee1[_0xcaaf('0x5f')]},'raw':!![]})['then'](function(_0x1d6ed9){if(_0x1d6ed9&&_0x1d6ed9[_0xcaaf('0x60')]===0x0){return db[_0xcaaf('0x36')][_0xcaaf('0x58')]({'name':_0x49d439[_0xcaaf('0x39')],'resourceId':_0x49d439['id'],'type':_0x1d6ed9[_0xcaaf('0x39')],'sectionId':_0x1d6ed9['id']},{})[_0xcaaf('0x1f')](function(){return _0x497059;});}else{return _0x497059;}})['catch'](function(_0x4f5505){logger[_0xcaaf('0x25')](_0xcaaf('0x61'),_0x4f5505);throw _0x4f5505;});}return _0x497059;})[_0xcaaf('0x1f')](respondWithResult(_0x1771ff,0xc9))['catch'](handleError(_0x1771ff,null));};exports[_0xcaaf('0x33')]=function(_0x327470,_0x5c26c6){if(_0x327470[_0xcaaf('0x59')]['id']){delete _0x327470[_0xcaaf('0x59')]['id'];}return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x327470[_0xcaaf('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcaaf('0x3d')}]})[_0xcaaf('0x1f')](handleEntityNotFound(_0x5c26c6,null))[_0xcaaf('0x1f')](saveUpdates(_0x327470[_0xcaaf('0x59')],null))[_0xcaaf('0x1f')](respondWithResult(_0x5c26c6,null))[_0xcaaf('0x2a')](handleError(_0x5c26c6,null));};exports[_0xcaaf('0x34')]=function(_0x4fff23,_0xc03f8d){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x4fff23['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xc03f8d,null))[_0xcaaf('0x1f')](removeEntity(_0xc03f8d,null))[_0xcaaf('0x2a')](handleError(_0xc03f8d,null));};exports[_0xcaaf('0x62')]=function(_0x45b258,_0x231ca0){return db['OpenchannelAccount'][_0xcaaf('0x62')]()[_0xcaaf('0x1f')](respondWithResult(_0x231ca0,null))[_0xcaaf('0x2a')](handleError(_0x231ca0,null));};exports[_0xcaaf('0x63')]=function(_0x1bed8f,_0x18f5b2,_0x630ffd){if(_0x1bed8f[_0xcaaf('0x59')]['id']){delete _0x1bed8f[_0xcaaf('0x59')]['id'];}return db[_0xcaaf('0x3f')]['find']({'where':{'id':_0x1bed8f[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x18f5b2,null))[_0xcaaf('0x1f')](function(_0x31e456){if(_0x31e456){_0x1bed8f[_0xcaaf('0x59')][_0xcaaf('0x64')]=_0x31e456['id'];return db['Disposition'][_0xcaaf('0x58')](_0x1bed8f[_0xcaaf('0x59')]);}})[_0xcaaf('0x1f')](respondWithResult(_0x18f5b2,null))[_0xcaaf('0x2a')](handleError(_0x18f5b2,null));};exports[_0xcaaf('0x65')]=function(_0x4af983,_0x126741,_0x128bf6){var _0x36f486={'raw':![],'where':{}};var _0x392e12={};var _0x11424a={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x4af983[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x126741,null))[_0xcaaf('0x1f')](function(_0x51a2e2){if(_0x51a2e2){_0x392e12[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x67')][_0xcaaf('0x40')]);_0x392e12['query']=_[_0xcaaf('0x43')](_0x4af983['query']);_0x392e12[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x392e12[_0xcaaf('0x45')],_0x392e12[_0xcaaf('0x42')]);_0x36f486[_0xcaaf('0x48')]=_['intersection'](_0x392e12['model'],qs[_0xcaaf('0x47')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x36f486[_0xcaaf('0x48')]=_0x36f486[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x36f486['attributes']:_0x392e12[_0xcaaf('0x45')];if(!_0x4af983[_0xcaaf('0x42')]['hasOwnProperty'](_0xcaaf('0x4b'))){_0x36f486['limit']=qs[_0xcaaf('0x2d')](_0x4af983[_0xcaaf('0x42')]['limit']);_0x36f486['offset']=qs[_0xcaaf('0x2e')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}_0x36f486[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x36f486[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x4af983[_0xcaaf('0x42')],_0x392e12[_0xcaaf('0x44')]));_0x36f486[_0xcaaf('0x50')]['OpenchannelAccountId']=_0x51a2e2['id'];if(_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x36f486[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x36f486[_0xcaaf('0x50')],{'$or':_[_0xcaaf('0x3e')](_0x36f486['attributes'],function(_0x529cc9){var _0x297b44={};_0x297b44[_0x529cc9]={'$like':'%'+_0x4af983['query'][_0xcaaf('0x4f')]+'%'};return _0x297b44;})});}_0x36f486=_[_0xcaaf('0x51')]({},_0x36f486,_0x4af983['options']);return db[_0xcaaf('0x67')][_0xcaaf('0x2f')]({'where':_0x36f486['where']})[_0xcaaf('0x1f')](function(_0x3f472c){_0x11424a[_0xcaaf('0x2f')]=_0x3f472c;if(_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x36f486[_0xcaaf('0x52')]=[{'all':!![]}];}return db[_0xcaaf('0x67')]['findAll'](_0x36f486);})[_0xcaaf('0x1f')](function(_0x45de45){_0x11424a[_0xcaaf('0x54')]=_0x45de45;return _0x11424a;});}})[_0xcaaf('0x1f')](respondWithFilteredResult(_0x126741,_0x36f486))[_0xcaaf('0x2a')](handleError(_0x126741,null));};exports['removeDispositions']=function(_0x21a704,_0x4e32a9,_0x13bf97){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x21a704['params']['id']}})['then'](handleEntityNotFound(_0x4e32a9,null))[_0xcaaf('0x1f')](function(_0x31113e){if(_0x31113e){return _0x31113e[_0xcaaf('0x68')](_0x21a704[_0xcaaf('0x42')][_0xcaaf('0x69')]);}})['then'](respondWithStatusCode(_0x4e32a9,null))[_0xcaaf('0x2a')](handleError(_0x4e32a9,null));};exports[_0xcaaf('0x6a')]=function(_0x1c75e1,_0x1d19c9,_0x5d358a){if(_0x1c75e1['body']['id']){delete _0x1c75e1['body']['id'];}return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x1c75e1[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d19c9,null))[_0xcaaf('0x1f')](function(_0x216853){if(_0x216853){_0x1c75e1['body']['OpenchannelAccountId']=_0x216853['id'];return db[_0xcaaf('0x6b')][_0xcaaf('0x58')](_0x1c75e1['body']);}})['then'](respondWithResult(_0x1d19c9,null))['catch'](handleError(_0x1d19c9,null));};exports[_0xcaaf('0x6c')]=function(_0xf998a0,_0xd7242f,_0x25c427){var _0x1dc3af={'raw':![],'where':{}};var _0x4b6eba={};var _0x496194={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0xf998a0['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xd7242f,null))[_0xcaaf('0x1f')](function(_0x5e2e3b){if(_0x5e2e3b){_0x4b6eba[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x6b')][_0xcaaf('0x40')]);_0x4b6eba[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0xf998a0[_0xcaaf('0x42')]);_0x4b6eba[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x4b6eba[_0xcaaf('0x45')],_0x4b6eba['query']);_0x1dc3af[_0xcaaf('0x48')]=_[_0xcaaf('0x46')](_0x4b6eba[_0xcaaf('0x45')],qs['fields'](_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x1dc3af[_0xcaaf('0x48')]=_0x1dc3af[_0xcaaf('0x48')]['length']?_0x1dc3af[_0xcaaf('0x48')]:_0x4b6eba['model'];if(!_0xf998a0['query'][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x1dc3af['limit']=qs[_0xcaaf('0x2d')](_0xf998a0[_0xcaaf('0x42')]['limit']);_0x1dc3af[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0xf998a0[_0xcaaf('0x42')]['offset']);}_0x1dc3af[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x1dc3af[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0xf998a0[_0xcaaf('0x42')],_0x4b6eba[_0xcaaf('0x44')]));_0x1dc3af['where'][_0xcaaf('0x64')]=_0x5e2e3b['id'];if(_0xf998a0[_0xcaaf('0x42')]['filter']){_0x1dc3af['where']=_[_0xcaaf('0x51')](_0x1dc3af[_0xcaaf('0x50')],{'$or':_['map'](_0x1dc3af['attributes'],function(_0x812d19){var _0x36d3a6={};_0x36d3a6[_0x812d19]={'$like':'%'+_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x36d3a6;})});}_0x1dc3af=_[_0xcaaf('0x51')]({},_0x1dc3af,_0xf998a0[_0xcaaf('0x57')]);return db[_0xcaaf('0x6b')][_0xcaaf('0x2f')]({'where':_0x1dc3af[_0xcaaf('0x50')]})[_0xcaaf('0x1f')](function(_0x4d5d54){_0x496194[_0xcaaf('0x2f')]=_0x4d5d54;if(_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x1dc3af[_0xcaaf('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcaaf('0x53')](_0x1dc3af);})[_0xcaaf('0x1f')](function(_0x11d5c0){_0x496194[_0xcaaf('0x54')]=_0x11d5c0;return _0x496194;});}})[_0xcaaf('0x1f')](respondWithFilteredResult(_0xd7242f,_0x1dc3af))[_0xcaaf('0x2a')](handleError(_0xd7242f,null));};exports[_0xcaaf('0x6d')]=function(_0x3ba3f7,_0x533b5d,_0x53ca62){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x3ba3f7['params']['id']}})['then'](handleEntityNotFound(_0x533b5d,null))[_0xcaaf('0x1f')](function(_0x7f35ae){if(_0x7f35ae){return _0x7f35ae[_0xcaaf('0x6d')](_0x3ba3f7[_0xcaaf('0x42')][_0xcaaf('0x69')]);}})[_0xcaaf('0x1f')](respondWithStatusCode(_0x533b5d,null))[_0xcaaf('0x2a')](handleError(_0x533b5d,null));};exports[_0xcaaf('0x6e')]=function(_0x35b672,_0x551704,_0x29180c){var _0x43b83f={'body':_0x35b672['body'],'channel':_0xcaaf('0x6f')};var _0x28d162=[];var _0xe988f4=[];var _0x579117={};var _0x38ee91=![];return db[_0xcaaf('0x70')][_0xcaaf('0x62')]()[_0xcaaf('0x1f')](function(_0x24fafc){if(!_0x24fafc){throw new db['Sequelize'][(_0xcaaf('0x71'))](_0xcaaf('0x72'));}_0x28d162=_[_0xcaaf('0x73')](_[_0xcaaf('0x43')](_0x24fafc),[_0xcaaf('0x74'),_0xcaaf('0x75')]);_0xe988f4=_[_0xcaaf('0x73')](_[_0xcaaf('0x43')](_0x24fafc),[_0xcaaf('0x74'),_0xcaaf('0x75'),_0xcaaf('0x76'),_0xcaaf('0x77')]);if(_0x35b672[_0xcaaf('0x59')]['id']){delete _0x35b672['body']['id'];}if(_['isNil'](_0x35b672['body'][_0xcaaf('0x78')])){throw new db[(_0xcaaf('0x79'))][(_0xcaaf('0x71'))](_0xcaaf('0x7a'));}if(_[_0xcaaf('0x7b')](_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')])||_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')]===''){throw new db[(_0xcaaf('0x79'))]['ValidationError'](_0xcaaf('0x7c'));}if(_[_0xcaaf('0x7b')](_0x35b672[_0xcaaf('0x59')]['mapKey'])){throw new db[(_0xcaaf('0x79'))]['ValidationError'](_0xcaaf('0x7d')+_0xe988f4);}if(!_['includes'](_0xe988f4,_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')])){throw new db['Sequelize']['ValidationError'](_0xcaaf('0x7f')+_0xe988f4);}_0x579117[_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')]]=_0x35b672['body'][_0xcaaf('0x78')];})[_0xcaaf('0x1f')](function(){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x35b672[_0xcaaf('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xcaaf('0x80'),'include':[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0x81'),'where':_0x579117,'limit':0x1,'order':[[_0xcaaf('0x75'),_0xcaaf('0x82')]]}]},{'model':db[_0xcaaf('0x83')],'as':_0xcaaf('0x84')}]});})[_0xcaaf('0x1f')](handleEntityNotFound(_0x551704,null))[_0xcaaf('0x1f')](function(_0x51343b){if(_0x51343b&&_0x51343b[_0xcaaf('0x80')]){_0x43b83f['account']=_0x51343b;_0x43b83f[_0xcaaf('0x85')]=_0x51343b['Applications'];_0x43b83f[_0xcaaf('0x86')]=_0x51343b[_0xcaaf('0x80')];_0x43b83f['applications']=_[_0xcaaf('0x87')](_0x43b83f[_0xcaaf('0x85')],['priority'],[_0xcaaf('0x88')]);if(_0x43b83f[_0xcaaf('0x89')]['Applications']){delete _0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x84')];}if(_0x43b83f[_0xcaaf('0x89')]['List']&&_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x80')]['Contacts'][_0xcaaf('0x49')]){return _0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x80')][_0xcaaf('0x81')][0x0];}var _0x174a32=_[_0xcaaf('0x8a')](_0x35b672[_0xcaaf('0x59')],{'firstName':_0x35b672['body']['from'],'ListId':_0x51343b['ListId']});_0x174a32[_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')]]=_0x35b672['body'][_0xcaaf('0x78')];return db['CmContact'][_0xcaaf('0x58')](_0x174a32,{'fields':_0x28d162,'raw':!![]});}})['then'](handleEntityNotFound(_0x551704,null))[_0xcaaf('0x1f')](function(_0x3907d9){_0x43b83f['contact']=_0x3907d9;if(_0x3907d9){var _0x3ce344={'ContactId':_0x3907d9['id'],'OpenchannelAccountId':_0x35b672[_0xcaaf('0x55')]['id'],'from':(_0x3907d9['firstName']||'')+'\x20'+(_0x3907d9[_0xcaaf('0x8b')]||'')};var _0x27cbc6={'OpenchannelAccountId':_0x35b672[_0xcaaf('0x55')]['id'],'closed':![]};if(_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')]){_0x27cbc6[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')];return db[_0xcaaf('0x8d')]['find']({'where':_0x27cbc6})[_0xcaaf('0x1f')](function(_0x3742c6){if(_0x3742c6){return[_0x3742c6,![]];}_0x3ce344[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')]['threadId'];_0x3ce344['externalUrl']=_0x35b672[_0xcaaf('0x59')]['externalUrl'];return db[_0xcaaf('0x8d')]['create'](_0x3ce344)[_0xcaaf('0x1f')](function(_0x5aa581){return[_0x5aa581,!![]];});});}else{_0x27cbc6[_0xcaaf('0x8c')]=null;}_0x27cbc6[_0xcaaf('0x8e')]=_0x3907d9['id'];return db[_0xcaaf('0x8d')][_0xcaaf('0x5e')]({'where':_0x27cbc6})['then'](function(_0x442204){if(_0x442204){return[_0x442204,![]];}return db['OpenchannelInteraction'][_0xcaaf('0x58')](_0x3ce344)[_0xcaaf('0x1f')](function(_0x573a25){return[_0x573a25,!![]];});});}})['spread'](function(_0x420fbb,_0x2446d2){if(_0x420fbb){_0x38ee91=_0x2446d2;if(!_0x2446d2){var _0x3595a1={'from':(_0x43b83f[_0xcaaf('0x8f')][_0xcaaf('0x90')]||'')+'\x20'+(_0x43b83f[_0xcaaf('0x8f')][_0xcaaf('0x8b')]||'')};if(_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')]&&_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')]&&_0x35b672[_0xcaaf('0x59')]['threadId']!=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')]){_0x3595a1[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')];}return _0x420fbb[_0xcaaf('0x33')](_0x3595a1);}else{return _0x420fbb;}}})[_0xcaaf('0x1f')](function(_0x4ce662){_0x43b83f['interaction']=_0x4ce662[_0xcaaf('0x5b')]({'plain':!![]});_0x43b83f[_0xcaaf('0x92')]['created']=_0x38ee91;if(_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x93')]){if(_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x94')]){_0x43b83f[_0xcaaf('0x85')]['push']({'id':0x0,'priority':_0x43b83f[_0xcaaf('0x85')][_0xcaaf('0x49')]+0x1,'app':_0xcaaf('0x95'),'appdata':_0xcaaf('0x96'),'interval':_0xcaaf('0x97')});}}return db[_0xcaaf('0x98')]['create']({'body':_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')],'OpenchannelAccountId':_0x35b672['params']['id'],'OpenchannelInteractionId':_0x4ce662['id'],'direction':'in','ContactId':_0x43b83f[_0xcaaf('0x8f')]['id'],'AttachmentId':_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x99')]});})[_0xcaaf('0x1f')](function(_0x2d87b1){_0x43b83f[_0xcaaf('0x27')]=_0x2d87b1;if(!_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9a')])return;return db[_0xcaaf('0x9b')]['find']({'attributes':['id',_0xcaaf('0x39')],'where':{'id':_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9a')]}});})[_0xcaaf('0x1f')](function(_0x121bef){if(_0x121bef){_0x43b83f['applications'][_0xcaaf('0x9c')]({'id':0x0,'priority':0x0,'app':_0xcaaf('0x9d'),'appdata':_0x121bef['name']+','+(_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x9e')]||0xa),'interval':_0xcaaf('0x97')});}if(!_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9f')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0xcaaf('0x39')],'where':{'id':_0x43b83f['interaction'][_0xcaaf('0x9f')]}});})[_0xcaaf('0x1f')](function(_0x4615c3){if(_0x4615c3){_0x43b83f[_0xcaaf('0x85')][_0xcaaf('0x9c')]({'id':0x0,'priority':0x1,'app':_0xcaaf('0xa0'),'appdata':_0x4615c3[_0xcaaf('0x39')]+','+(_0x43b83f[_0xcaaf('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0xcaaf('0x97')});}return respondWithRpcPromise(_0xcaaf('0xa1'),_0xcaaf('0xa2'),_0x43b83f);})[_0xcaaf('0x1f')](function(_0x14bc83){respondWithRpcPromise(_0xcaaf('0xa3'),'EventManager',{'event':_0xcaaf('0x6e'),'message':_0x14bc83},client9002);return _0x14bc83;})['then'](respondWithResult(_0x551704,null))[_0xcaaf('0x2a')](handleError(_0x551704,null));};exports[_0xcaaf('0xa4')]=function(_0x3f5a30,_0x25175a){var _0x1ac238=_0x3f5a30['params']['id'];var _0x4ac839=_0x3f5a30[_0xcaaf('0x59')];var _0x1a18a4=0xc8;var _0x2ecfce=null;return db[_0xcaaf('0xa5')][_0xcaaf('0xa6')]({'isolationLevel':db[_0xcaaf('0xa5')]['Transaction'][_0xcaaf('0xa7')]['READ_COMMITTED']},function(_0x125d45){return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x1ac238},'transaction':_0x125d45})['then'](function(_0x196d2b){if(_0x196d2b){return db[_0xcaaf('0x83')][_0xcaaf('0x34')]({'where':{'OpenchannelAccountId':_0x1ac238},'transaction':_0x125d45})[_0xcaaf('0x1f')](function(){var _0x11fb95=_[_0xcaaf('0x3e')](_0x4ac839,function(_0x22dc1e){_0x22dc1e[_0xcaaf('0x64')]=_0x1ac238;return _0x22dc1e;});return db[_0xcaaf('0x83')]['bulkCreate'](_0x11fb95,{'transaction':_0x125d45});});}else{_0x1a18a4=0x194;_0x2ecfce=[];}});})[_0xcaaf('0x1f')](function(){if(_0x1a18a4!==0x194){return db[_0xcaaf('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1ac238},'order':_0xcaaf('0xa8')})['then'](function(_0x1da9e3){_0x2ecfce=_0x1da9e3;});}})['catch'](function(_0x5039d1){_0x1a18a4=0x1f4;logger[_0xcaaf('0x25')](_0x5039d1[_0xcaaf('0xa9')]);if(_0x5039d1[_0xcaaf('0x39')]){delete _0x5039d1[_0xcaaf('0x39')];}_0x2ecfce=_0x5039d1;})['finally'](function(){if(_0x2ecfce===null){_0x25175a[_0xcaaf('0x38')](_0x1a18a4);}else{if(_0x1a18a4===0x1f4){_0x25175a[_0xcaaf('0x2b')](_0x1a18a4)[_0xcaaf('0x3a')](_0x2ecfce);}else{_0x25175a['status'](_0x1a18a4)[_0xcaaf('0x2c')](_0x2ecfce);}}});};exports['getApplications']=function(_0x4cb8e8,_0xa7037a,_0x42d82e){var _0x38ad54={};var _0x2e968c={};var _0x2a07b8;var _0xedbac3;return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x4cb8e8['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xa7037a,null))[_0xcaaf('0x1f')](function(_0x58055a){if(_0x58055a){_0x2a07b8=_0x58055a;_0x2e968c[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x83')]['rawAttributes']);_0x2e968c[_0xcaaf('0x42')]=_['keys'](_0x4cb8e8[_0xcaaf('0x42')]);_0x2e968c[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x2e968c[_0xcaaf('0x45')],_0x2e968c['query']);_0x38ad54['attributes']=_[_0xcaaf('0x46')](_0x2e968c['model'],qs['fields'](_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x38ad54[_0xcaaf('0x48')]=_0x38ad54[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x38ad54[_0xcaaf('0x48')]:_0x2e968c[_0xcaaf('0x45')];_0x38ad54['order']=qs[_0xcaaf('0x4d')](_0x4cb8e8['query'][_0xcaaf('0x4d')]);_0x38ad54[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x4cb8e8[_0xcaaf('0x42')],_0x2e968c[_0xcaaf('0x44')]));if(_0x4cb8e8[_0xcaaf('0x42')]['filter']){_0x38ad54[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x38ad54['where'],{'$or':_[_0xcaaf('0x3e')](_0x38ad54[_0xcaaf('0x48')],function(_0x10b64b){var _0x57d0db={};_0x57d0db[_0x10b64b]={'$like':'%'+_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x57d0db;})});}_0x38ad54=_[_0xcaaf('0x51')]({},_0x38ad54,_0x4cb8e8[_0xcaaf('0x57')]);return _0x2a07b8[_0xcaaf('0xaa')](_0x38ad54);}})[_0xcaaf('0x1f')](function(_0x421c10){if(_0x421c10){_0xedbac3=_0x421c10['length'];if(!_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x4a')]('nolimit')){_0x38ad54['limit']=qs[_0xcaaf('0x2d')](_0x4cb8e8[_0xcaaf('0x42')]['limit']);_0x38ad54[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0x4cb8e8['query']['offset']);}return _0x2a07b8['getApplications'](_0x38ad54);}})[_0xcaaf('0x1f')](function(_0x575c99){if(_0x575c99){return _0x575c99?{'count':_0xedbac3,'rows':_0x575c99}:null;}})['then'](respondWithResult(_0xa7037a,null))[_0xcaaf('0x2a')](handleError(_0xa7037a,null));};exports[_0xcaaf('0xab')]=function(_0x6d69c3,_0xc3ee82,_0x5b5ea0){var _0x904289={'raw':![],'where':{}};var _0x1e6954={};var _0x4e4b93={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x6d69c3[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0xc3ee82,null))['then'](function(_0x4b4ffe){if(_0x4b4ffe){_0x1e6954[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x8d')]['rawAttributes']);_0x1e6954['query']=_['keys'](_0x6d69c3[_0xcaaf('0x42')]);_0x1e6954[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x1e6954['model'],_0x1e6954[_0xcaaf('0x42')]);_0x904289['attributes']=_[_0xcaaf('0x46')](_0x1e6954['model'],qs['fields'](_0x6d69c3[_0xcaaf('0x42')]['fields']));_0x904289[_0xcaaf('0x48')]=_0x904289[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x904289[_0xcaaf('0x48')]:_0x1e6954['model'];if(!_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x904289[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x6d69c3['query'][_0xcaaf('0x2d')]);_0x904289[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}_0x904289[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x6d69c3['query']['sort']);_0x904289['where']=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x6d69c3['query'],_0x1e6954['filters']));_0x904289['where']['OpenchannelAccountId']=_0x4b4ffe['id'];if(_0x6d69c3[_0xcaaf('0x42')]['filter']){_0x904289['where']=_[_0xcaaf('0x51')](_0x904289[_0xcaaf('0x50')],{'$or':_['map'](_0x904289['attributes'],function(_0x383b66){var _0x32db8e={};_0x32db8e[_0x383b66]={'$like':'%'+_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x32db8e;})});}_0x904289=_['merge']({},_0x904289,_0x6d69c3[_0xcaaf('0x57')]);return db[_0xcaaf('0x8d')][_0xcaaf('0x2f')]({'where':_0x904289[_0xcaaf('0x50')]})[_0xcaaf('0x1f')](function(_0x4c32c3){_0x4e4b93[_0xcaaf('0x2f')]=_0x4c32c3;if(_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x904289[_0xcaaf('0x52')]=[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0xac'),'required':![]},{'model':db[_0xcaaf('0x9b')],'as':_0xcaaf('0xad'),'attributes':[_0xcaaf('0x39'),_0xcaaf('0xae'),_0xcaaf('0xaf')],'required':![]},{'model':db[_0xcaaf('0xb0')],'as':_0xcaaf('0xb1'),'attributes':['id',_0xcaaf('0x39'),_0xcaaf('0xb2')],'where':_0x6d69c3[_0xcaaf('0x42')]['tag']?{'id':_0x6d69c3[_0xcaaf('0x42')]['tag']}:undefined,'required':_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0xb3')]?!![]:![]}];}return db[_0xcaaf('0x8d')][_0xcaaf('0x53')](_0x904289);})[_0xcaaf('0x1f')](function(_0x2fcb83){_0x4e4b93[_0xcaaf('0x54')]=_0x2fcb83;return _0x4e4b93;});}})['then'](respondWithFilteredResult(_0xc3ee82,_0x904289))[_0xcaaf('0x2a')](handleError(_0xc3ee82,null));};exports[_0xcaaf('0xb4')]=function(_0x586345,_0x2fdb86,_0x2cf1b9){return db[_0xcaaf('0x3f')]['find']({'where':{'id':_0x586345[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x2fdb86,null))[_0xcaaf('0x1f')](function(_0x18d56c){if(_0x18d56c){return _0x18d56c[_0xcaaf('0xb4')](_0x586345[_0xcaaf('0x59')][_0xcaaf('0x69')],_[_0xcaaf('0xb5')](_0x586345['body'],[_0xcaaf('0x69'),'id'])||{})[_0xcaaf('0xb6')](function(_0x17210b){for(var _0x1e479e=0x0;_0x1e479e<_0x586345['body'][_0xcaaf('0x69')]['length'];_0x1e479e+=0x1){socket[_0xcaaf('0xb7')]('userOpenchannelAccount:save',{'UserId':Number(_0x586345[_0xcaaf('0x59')][_0xcaaf('0x69')][_0x1e479e]),'OpenchannelAccountId':Number(_0x586345['params']['id'])});}return _0x17210b;});}})[_0xcaaf('0x1f')](respondWithResult(_0x2fdb86,null))[_0xcaaf('0x2a')](handleError(_0x2fdb86,null));};exports[_0xcaaf('0xb8')]=function(_0x5a6ebe,_0x4c2506,_0x2e6617){return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x5a6ebe[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x4c2506,null))[_0xcaaf('0x1f')](function(_0x1a9084){if(_0x1a9084){return _0x1a9084[_0xcaaf('0xb8')](_0x5a6ebe['query'][_0xcaaf('0x69')])['then'](function(){if(_[_0xcaaf('0xb9')](_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')])){for(var _0x20ee5a=0x0;_0x20ee5a<_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')][_0xcaaf('0x49')];_0x20ee5a+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')][_0x20ee5a]),'OpenchannelAccountId':Number(_0x5a6ebe[_0xcaaf('0x55')]['id'])});}}else{socket['emit'](_0xcaaf('0xba'),{'UserId':Number(_0x5a6ebe[_0xcaaf('0x42')]['ids']),'OpenchannelAccountId':Number(_0x5a6ebe[_0xcaaf('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c2506,null))[_0xcaaf('0x2a')](handleError(_0x4c2506,null));};exports[_0xcaaf('0xbb')]=function(_0x3c780d,_0x9f09e5,_0x1af10d){var _0x3f4d4c={};var _0x40e8d7={};var _0x23c417;var _0x27df32;return db['OpenchannelAccount'][_0xcaaf('0x66')]({'where':{'id':_0x3c780d[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x9f09e5,null))['then'](function(_0x44c20f){if(_0x44c20f){_0x23c417=_0x44c20f;_0x40e8d7[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x9b')][_0xcaaf('0x40')]);_0x40e8d7[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0x3c780d[_0xcaaf('0x42')]);_0x40e8d7[_0xcaaf('0x44')]=_['intersection'](_0x40e8d7['model'],_0x40e8d7[_0xcaaf('0x42')]);_0x3f4d4c[_0xcaaf('0x48')]=_['intersection'](_0x40e8d7['model'],qs[_0xcaaf('0x47')](_0x3c780d[_0xcaaf('0x42')]['fields']));_0x3f4d4c['attributes']=_0x3f4d4c['attributes'][_0xcaaf('0x49')]?_0x3f4d4c[_0xcaaf('0x48')]:_0x40e8d7[_0xcaaf('0x45')];_0x3f4d4c[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x3f4d4c[_0xcaaf('0x50')]=qs['filters'](_[_0xcaaf('0x4e')](_0x3c780d[_0xcaaf('0x42')],_0x40e8d7[_0xcaaf('0x44')]));if(_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x3f4d4c[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x3f4d4c[_0xcaaf('0x50')],{'$or':_[_0xcaaf('0x3e')](_0x3f4d4c[_0xcaaf('0x48')],function(_0x5d5ee3){var _0x2332b5={};_0x2332b5[_0x5d5ee3]={'$like':'%'+_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x2332b5;})});}_0x3f4d4c=_[_0xcaaf('0x51')]({},_0x3f4d4c,_0x3c780d[_0xcaaf('0x57')]);return _0x23c417[_0xcaaf('0xbb')](_0x3f4d4c);}})[_0xcaaf('0x1f')](function(_0x56abcd){if(_0x56abcd){_0x27df32=_0x56abcd[_0xcaaf('0x49')];if(!_0x3c780d['query'][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x3f4d4c[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x3c780d['query'][_0xcaaf('0x2d')]);_0x3f4d4c['offset']=qs[_0xcaaf('0x2e')](_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}return _0x23c417['getAgents'](_0x3f4d4c);}})['then'](function(_0x1a067b){if(_0x1a067b){return _0x1a067b?{'count':_0x27df32,'rows':_0x1a067b}:null;}})[_0xcaaf('0x1f')](respondWithResult(_0x9f09e5,null))[_0xcaaf('0x2a')](handleError(_0x9f09e5,null));};exports[_0xcaaf('0x3a')]=function(_0x468565,_0x46d863,_0x2140f4){var _0x210260,_0x27f915,_0x528e60;if(_[_0xcaaf('0x7b')](_0x468565[_0xcaaf('0x59')]['body'])||_0x468565[_0xcaaf('0x59')][_0xcaaf('0x59')]===''){throw new db[(_0xcaaf('0x79'))][(_0xcaaf('0x71'))](_0xcaaf('0x7c'));}if(_[_0xcaaf('0x7b')](_0x468565[_0xcaaf('0x59')]['to'])){}_0x210260=_0x468565[_0xcaaf('0x59')]['to'];return db[_0xcaaf('0x3f')]['findOne']({'where':{'id':_0x468565['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x46d863,null))['then'](function(_0x1b891c){if(_0x1b891c){return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x1b891c['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0x81'),'where':{[_0x1b891c[_0xcaaf('0x7e')]]:_0x210260},'limit':0x1,'order':[[_0xcaaf('0x75'),_0xcaaf('0x82')]]}]}]})['then'](handleEntityNotFound(_0x46d863,null))[_0xcaaf('0x1f')](function(_0x426271){if(_0x426271&&_0x426271[_0xcaaf('0x80')]){_0x27f915=_0x426271[_0xcaaf('0x5b')]({'plain':!![]});if(_0x27f915[_0xcaaf('0x80')]&&_0x27f915[_0xcaaf('0x80')]['Contacts']['length']){return _0x27f915[_0xcaaf('0x80')][_0xcaaf('0x81')][0x0];}return db[_0xcaaf('0x70')]['create'](_[_0xcaaf('0x8a')](_0x468565[_0xcaaf('0x59')],{'firstName':_0x210260,[_0x426271[_0xcaaf('0x7e')]]:_0x210260,'phone':_0x210260,'ListId':_0x27f915['ListId']}));}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x46d863,null))[_0xcaaf('0x1f')](function(_0x23e686){if(_0x23e686){_0x528e60=_0x23e686;return db['OpenchannelInteraction'][_0xcaaf('0x5e')]({'where':{'ContactId':_0x528e60['id'],'closed':![],'OpenchannelAccountId':_0x27f915['id']}})[_0xcaaf('0x1f')](function(_0x14285c){if(_0x14285c){return[_0x14285c,![]];}return db[_0xcaaf('0x8d')][_0xcaaf('0x58')]({'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id'],'OpenchannelAccountId':_0x27f915['id'],'lastMsgDirection':_0xcaaf('0xbc'),'firstMsgDirection':_0xcaaf('0xbc'),'Messages':[_[_0xcaaf('0x51')](_0x468565['body'],{'read':![],'body':_0x468565[_0xcaaf('0x59')]['body'],'OpenchannelAccountId':_0x27f915['id'],'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id']})]},{'include':[{'model':db[_0xcaaf('0x98')],'as':_0xcaaf('0xbd')}]})[_0xcaaf('0x1f')](function(_0x3020b4){return[_0x3020b4,!![]];});});}})[_0xcaaf('0xb6')](function(_0xfe79e0,_0x36e286){if(_0x36e286){return _0xfe79e0;}return db[_0xcaaf('0x98')][_0xcaaf('0x58')](_['merge'](_0x468565[_0xcaaf('0x59')],{'read':![],'body':_0x468565['body'][_0xcaaf('0x59')],'OpenchannelAccountId':_0x27f915['id'],'OpenchannelInteractionId':_0xfe79e0['id'],'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id']}))[_0xcaaf('0x1f')](function(_0x4a001c){_0xfe79e0['dataValues'][_0xcaaf('0xbd')]=[];_0xfe79e0[_0xcaaf('0xbe')][_0xcaaf('0xbd')][_0xcaaf('0xbf')](_0x4a001c[_0xcaaf('0xbe')]);return _0xfe79e0;});});}})[_0xcaaf('0x1f')](respondWithResult(_0x46d863,null))[_0xcaaf('0x2a')](handleError(_0x46d863,null));}; \ No newline at end of file +var _0x975f=['internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','filter','options','include','findAll','rows','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Disposition','getDispositions','keys','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','hasOwnProperty','sort','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','applications','list','orderBy','priority','asc','Contacts','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','EventManager','transaction','sequelize','Transaction','OpenchannelApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname'];(function(_0x3bb5ae,_0x4ab350){var _0x45b547=function(_0x4af2f4){while(--_0x4af2f4){_0x3bb5ae['push'](_0x3bb5ae['shift']());}};_0x45b547(++_0x4ab350);}(_0x975f,0x191));var _0xf975=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x975f[_0x492221];return _0x398bf9;};'use strict';var emlformat=require(_0xf975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf975('0x1'));var jsonpatch=require(_0xf975('0x2'));var rp=require(_0xf975('0x3'));var moment=require(_0xf975('0x4'));var BPromise=require(_0xf975('0x5'));var Mustache=require(_0xf975('0x6'));var util=require('util');var path=require(_0xf975('0x7'));var sox=require(_0xf975('0x8'));var csv=require('to-csv');var ejs=require(_0xf975('0x9'));var fs=require('fs');var fs_extra=require(_0xf975('0xa'));var _=require(_0xf975('0xb'));var squel=require(_0xf975('0xc'));var crypto=require(_0xf975('0xd'));var jsforce=require(_0xf975('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf975('0xf'));var querystring=require('querystring');var Papa=require(_0xf975('0x10'));var Redis=require('ioredis');var authService=require(_0xf975('0x11'));var qs=require(_0xf975('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf975('0x13'));var logger=require(_0xf975('0x14'))(_0xf975('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf975('0x16'));var db=require(_0xf975('0x17'))['db'];config['redis']=_['defaults'](config[_0xf975('0x18')],{'host':_0xf975('0x19'),'port':0x18eb});var socket=require(_0xf975('0x1a'))(new Redis(config[_0xf975('0x18')]));require(_0xf975('0x1b'))[_0xf975('0x1c')](socket);var jayson=require(_0xf975('0x1d'));var client=jayson[_0xf975('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf975('0x1e')][_0xf975('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x35ef4b,_0x458132,_0x1705f5,_0x2ac0bd){return new BPromise(function(_0x3e3f9e,_0x1513a8){var _0x298207=_0x2ac0bd||client;return _0x298207[_0xf975('0x20')](_0x35ef4b,_0x1705f5)[_0xf975('0x21')](function(_0xf52469){logger[_0xf975('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x458132,_0xf975('0x23'));logger[_0xf975('0x24')](_0xf975('0x25'),_0x458132,'request\x20sent',JSON[_0xf975('0x26')](_0xf52469));if(_0xf52469['error']){if(_0xf52469['error'][_0xf975('0x27')]===0x1f4){logger[_0xf975('0x28')](_0xf975('0x29'),_0x458132,_0xf52469[_0xf975('0x28')][_0xf975('0x2a')]);return _0x1513a8(_0xf52469[_0xf975('0x28')][_0xf975('0x2a')]);}logger[_0xf975('0x28')](_0xf975('0x29'),_0x458132,_0xf52469[_0xf975('0x28')][_0xf975('0x2a')]);return _0x3e3f9e(_0xf52469[_0xf975('0x28')][_0xf975('0x2a')]);}else{logger[_0xf975('0x22')](_0xf975('0x29'),_0x458132,_0xf975('0x23'));_0x3e3f9e(_0xf52469['result'][_0xf975('0x2a')]);}})[_0xf975('0x2b')](function(_0x14f6c0){logger[_0xf975('0x28')](_0xf975('0x29'),_0x458132,_0x14f6c0);_0x1513a8(_0x14f6c0);});});}function respondWithStatusCode(_0x3b3b59,_0x22241f){_0x22241f=_0x22241f||0xcc;return function(_0x13bb6d){if(_0x13bb6d){return _0x3b3b59[_0xf975('0x2c')](_0x22241f);}return _0x3b3b59[_0xf975('0x2d')](_0x22241f)['end']();};}function respondWithResult(_0x566f58,_0x565e35){_0x565e35=_0x565e35||0xc8;return function(_0x365032){if(_0x365032){return _0x566f58[_0xf975('0x2d')](_0x565e35)[_0xf975('0x2e')](_0x365032);}};}function respondWithFilteredResult(_0x3ddd47,_0x5e5e1){return function(_0x463128){if(_0x463128){var _0x4450b6=typeof _0x5e5e1[_0xf975('0x2f')]===_0xf975('0x30')&&typeof _0x5e5e1[_0xf975('0x31')]===_0xf975('0x30');var _0x2a970b=_0x463128[_0xf975('0x32')];var _0x3bf1c1=_0x4450b6?0x0:_0x5e5e1[_0xf975('0x2f')];var _0x3342a1=_0x4450b6?_0x463128[_0xf975('0x32')]:_0x5e5e1[_0xf975('0x2f')]+_0x5e5e1[_0xf975('0x31')];var _0x2bfe6e;if(_0x3342a1>=_0x2a970b){_0x3342a1=_0x2a970b;_0x2bfe6e=0xc8;}else{_0x2bfe6e=0xce;}_0x3ddd47['status'](_0x2bfe6e);return _0x3ddd47[_0xf975('0x33')]('Content-Range',_0x3bf1c1+'-'+_0x3342a1+'/'+_0x2a970b)[_0xf975('0x2e')](_0x463128);}return null;};}function patchUpdates(_0xcdfb7e){return function(_0xf0dad2){try{jsonpatch[_0xf975('0x34')](_0xf0dad2,_0xcdfb7e,!![]);}catch(_0x1a5f15){return BPromise['reject'](_0x1a5f15);}return _0xf0dad2[_0xf975('0x35')]();};}function saveUpdates(_0x3a7299,_0x4cc2cf){return function(_0x17c104){if(_0x17c104){return _0x17c104[_0xf975('0x36')](_0x3a7299)[_0xf975('0x21')](function(_0x57fbdc){return _0x57fbdc;});}return null;};}function removeEntity(_0x573958,_0x5a01cc){return function(_0x5d7a91){if(_0x5d7a91){return _0x5d7a91[_0xf975('0x37')]()[_0xf975('0x21')](function(){var _0x21e3ca=_0x5d7a91[_0xf975('0x38')]({'plain':!![]});var _0x304679=_0xf975('0x39');return db[_0xf975('0x3a')]['destroy']({'where':{'type':_0x304679,'resourceId':_0x21e3ca['id']}})['then'](function(){return _0x5d7a91;});})[_0xf975('0x21')](function(){_0x573958[_0xf975('0x2d')](0xcc)[_0xf975('0x3b')]();});}};}function handleEntityNotFound(_0x1ccc1b,_0x5bb149){return function(_0x32b9f2){if(!_0x32b9f2){_0x1ccc1b['sendStatus'](0x194);}return _0x32b9f2;};}function handleError(_0x43ff37,_0x58237b){_0x58237b=_0x58237b||0x1f4;return function(_0x5ca61a){logger['error'](_0x5ca61a['stack']);if(_0x5ca61a[_0xf975('0x3c')]){delete _0x5ca61a['name'];}_0x43ff37[_0xf975('0x2d')](_0x58237b)[_0xf975('0x3d')](_0x5ca61a);};}exports[_0xf975('0x3e')]=function(_0x2ce78b,_0x5319eb){var _0x282c7b={'include':[{'model':db[_0xf975('0x3f')],'as':_0xf975('0x40')}]},_0xd74571={},_0x400499={'count':0x0,'rows':[]};var _0x89f926=_[_0xf975('0x41')](db[_0xf975('0x42')][_0xf975('0x43')],function(_0x2c1414){return{'name':_0x2c1414[_0xf975('0x44')],'type':_0x2c1414[_0xf975('0x45')]['key']};});_0xd74571[_0xf975('0x46')]=_['map'](_0x89f926,_0xf975('0x3c'));_0xd74571[_0xf975('0x47')]=_['keys'](_0x2ce78b['query']);_0xd74571[_0xf975('0x48')]=_[_0xf975('0x49')](_0xd74571[_0xf975('0x46')],_0xd74571[_0xf975('0x47')]);_0x282c7b[_0xf975('0x4a')]=_[_0xf975('0x49')](_0xd74571[_0xf975('0x46')],qs[_0xf975('0x4b')](_0x2ce78b[_0xf975('0x47')][_0xf975('0x4b')]));_0x282c7b[_0xf975('0x4a')]=_0x282c7b[_0xf975('0x4a')][_0xf975('0x4c')]?_0x282c7b[_0xf975('0x4a')]:_0xd74571['model'];if(!_0x2ce78b[_0xf975('0x47')]['hasOwnProperty'](_0xf975('0x4d'))){_0x282c7b['limit']=qs[_0xf975('0x31')](_0x2ce78b[_0xf975('0x47')][_0xf975('0x31')]);_0x282c7b['offset']=qs[_0xf975('0x2f')](_0x2ce78b[_0xf975('0x47')][_0xf975('0x2f')]);}_0x282c7b[_0xf975('0x4e')]=qs['sort'](_0x2ce78b['query']['sort']);_0x282c7b[_0xf975('0x4f')]=qs[_0xf975('0x48')](_[_0xf975('0x50')](_0x2ce78b['query'],_0xd74571['filters']),_0x89f926);if(_0x2ce78b['query']['filter']){_0x282c7b[_0xf975('0x4f')]=_[_0xf975('0x51')](_0x282c7b[_0xf975('0x4f')],{'$or':_[_0xf975('0x41')](_0x89f926,function(_0x38c352){if(_0x38c352['type']!=='VIRTUAL'){var _0x5a3312={};_0x5a3312[_0x38c352[_0xf975('0x3c')]]={'$like':'%'+_0x2ce78b[_0xf975('0x47')][_0xf975('0x52')]+'%'};return _0x5a3312;}})});}_0x282c7b=_[_0xf975('0x51')]({},_0x282c7b,_0x2ce78b[_0xf975('0x53')]);var _0x44bacf={'where':_0x282c7b[_0xf975('0x4f')]};return db['OpenchannelAccount']['count'](_0x44bacf)[_0xf975('0x21')](function(_0xf9959f){_0x400499['count']=_0xf9959f;if(_0x2ce78b[_0xf975('0x47')]['includeAll']){_0x282c7b[_0xf975('0x54')]=[{'all':!![]}];}return db[_0xf975('0x42')][_0xf975('0x55')](_0x282c7b);})[_0xf975('0x21')](function(_0x2caa52){_0x400499[_0xf975('0x56')]=_0x2caa52;return _0x400499;})['then'](respondWithFilteredResult(_0x5319eb,_0x282c7b))[_0xf975('0x2b')](handleError(_0x5319eb,null));};exports['show']=function(_0x44250e,_0x331b98){var _0x2ae95f={'raw':![],'where':{'id':_0x44250e[_0xf975('0x57')]['id']},'include':[{'model':db[_0xf975('0x3f')],'as':_0xf975('0x40')}]},_0x2d8b5f={};_0x2d8b5f['model']=_['keys'](db[_0xf975('0x42')][_0xf975('0x43')]);_0x2d8b5f[_0xf975('0x47')]=_['keys'](_0x44250e[_0xf975('0x47')]);_0x2d8b5f[_0xf975('0x48')]=_[_0xf975('0x49')](_0x2d8b5f[_0xf975('0x46')],_0x2d8b5f[_0xf975('0x47')]);_0x2ae95f[_0xf975('0x4a')]=_['intersection'](_0x2d8b5f[_0xf975('0x46')],qs['fields'](_0x44250e[_0xf975('0x47')]['fields']));_0x2ae95f[_0xf975('0x4a')]=_0x2ae95f[_0xf975('0x4a')][_0xf975('0x4c')]?_0x2ae95f[_0xf975('0x4a')]:_0x2d8b5f[_0xf975('0x46')];if(_0x44250e[_0xf975('0x47')][_0xf975('0x58')]){_0x2ae95f[_0xf975('0x54')]=[{'all':!![]}];}_0x2ae95f=_[_0xf975('0x51')]({},_0x2ae95f,_0x44250e[_0xf975('0x53')]);return db[_0xf975('0x42')][_0xf975('0x59')](_0x2ae95f)['then'](handleEntityNotFound(_0x331b98,null))[_0xf975('0x21')](respondWithResult(_0x331b98,null))[_0xf975('0x2b')](handleError(_0x331b98,null));};exports['create']=function(_0x87469a,_0x3925b4){return db[_0xf975('0x42')][_0xf975('0x5a')](_0x87469a[_0xf975('0x5b')],{})[_0xf975('0x21')](function(_0x28b198){var _0x568b3b=_0x87469a['user'][_0xf975('0x38')]({'plain':!![]});if(!_0x568b3b)throw new Error(_0xf975('0x5c'));if(_0x568b3b[_0xf975('0x5d')]===_0xf975('0x5e')){var _0x58ea63=_0x28b198[_0xf975('0x38')]({'plain':!![]});var _0x19c542=_0xf975('0x39');return db['UserProfileSection'][_0xf975('0x59')]({'where':{'name':_0x19c542,'userProfileId':_0x568b3b[_0xf975('0x5f')]},'raw':!![]})[_0xf975('0x21')](function(_0x1379ba){if(_0x1379ba&&_0x1379ba[_0xf975('0x60')]===0x0){return db[_0xf975('0x3a')][_0xf975('0x5a')]({'name':_0x58ea63[_0xf975('0x3c')],'resourceId':_0x58ea63['id'],'type':_0x1379ba['name'],'sectionId':_0x1379ba['id']},{})[_0xf975('0x21')](function(){return _0x28b198;});}else{return _0x28b198;}})['catch'](function(_0x9ad75c){logger[_0xf975('0x28')](_0xf975('0x61'),_0x9ad75c);throw _0x9ad75c;});}return _0x28b198;})[_0xf975('0x21')](respondWithResult(_0x3925b4,0xc9))['catch'](handleError(_0x3925b4,null));};exports['update']=function(_0xe235eb,_0x141375){if(_0xe235eb['body']['id']){delete _0xe235eb[_0xf975('0x5b')]['id'];}return db['OpenchannelAccount'][_0xf975('0x59')]({'where':{'id':_0xe235eb['params']['id']},'include':[{'model':db[_0xf975('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xf975('0x21')](handleEntityNotFound(_0x141375,null))[_0xf975('0x21')](saveUpdates(_0xe235eb[_0xf975('0x5b')],null))[_0xf975('0x21')](respondWithResult(_0x141375,null))[_0xf975('0x2b')](handleError(_0x141375,null));};exports[_0xf975('0x37')]=function(_0x3fc7f7,_0x2ab531){return db['OpenchannelAccount'][_0xf975('0x59')]({'where':{'id':_0x3fc7f7[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x2ab531,null))['then'](removeEntity(_0x2ab531,null))[_0xf975('0x2b')](handleError(_0x2ab531,null));};exports['describe']=function(_0x19f01a,_0xedcdf0){return db[_0xf975('0x42')]['describe']()[_0xf975('0x21')](respondWithResult(_0xedcdf0,null))[_0xf975('0x2b')](handleError(_0xedcdf0,null));};exports['addDisposition']=function(_0x55be71,_0x1ebf0c,_0x3abf11){if(_0x55be71[_0xf975('0x5b')]['id']){delete _0x55be71[_0xf975('0x5b')]['id'];}return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0x55be71[_0xf975('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ebf0c,null))[_0xf975('0x21')](function(_0xec3c3d){if(_0xec3c3d){_0x55be71[_0xf975('0x5b')]['OpenchannelAccountId']=_0xec3c3d['id'];return db[_0xf975('0x62')]['create'](_0x55be71[_0xf975('0x5b')]);}})['then'](respondWithResult(_0x1ebf0c,null))['catch'](handleError(_0x1ebf0c,null));};exports[_0xf975('0x63')]=function(_0x1eb8d0,_0x5f4a72,_0x18025c){var _0x286a92={'raw':![],'where':{}};var _0x2e9360={};var _0x4256fd={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1eb8d0['params']['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x5f4a72,null))[_0xf975('0x21')](function(_0x10a4b0){if(_0x10a4b0){_0x2e9360[_0xf975('0x46')]=_['keys'](db[_0xf975('0x62')][_0xf975('0x43')]);_0x2e9360[_0xf975('0x47')]=_[_0xf975('0x64')](_0x1eb8d0['query']);_0x2e9360['filters']=_[_0xf975('0x49')](_0x2e9360[_0xf975('0x46')],_0x2e9360[_0xf975('0x47')]);_0x286a92[_0xf975('0x4a')]=_[_0xf975('0x49')](_0x2e9360[_0xf975('0x46')],qs[_0xf975('0x4b')](_0x1eb8d0[_0xf975('0x47')][_0xf975('0x4b')]));_0x286a92[_0xf975('0x4a')]=_0x286a92[_0xf975('0x4a')][_0xf975('0x4c')]?_0x286a92[_0xf975('0x4a')]:_0x2e9360[_0xf975('0x46')];if(!_0x1eb8d0[_0xf975('0x47')]['hasOwnProperty']('nolimit')){_0x286a92[_0xf975('0x31')]=qs[_0xf975('0x31')](_0x1eb8d0[_0xf975('0x47')][_0xf975('0x31')]);_0x286a92[_0xf975('0x2f')]=qs[_0xf975('0x2f')](_0x1eb8d0[_0xf975('0x47')][_0xf975('0x2f')]);}_0x286a92['order']=qs['sort'](_0x1eb8d0[_0xf975('0x47')]['sort']);_0x286a92['where']=qs[_0xf975('0x48')](_[_0xf975('0x50')](_0x1eb8d0[_0xf975('0x47')],_0x2e9360[_0xf975('0x48')]));_0x286a92['where'][_0xf975('0x65')]=_0x10a4b0['id'];if(_0x1eb8d0[_0xf975('0x47')]['filter']){_0x286a92['where']=_[_0xf975('0x51')](_0x286a92['where'],{'$or':_['map'](_0x286a92[_0xf975('0x4a')],function(_0x120469){var _0x18c33b={};_0x18c33b[_0x120469]={'$like':'%'+_0x1eb8d0['query'][_0xf975('0x52')]+'%'};return _0x18c33b;})});}_0x286a92=_[_0xf975('0x51')]({},_0x286a92,_0x1eb8d0[_0xf975('0x53')]);return db[_0xf975('0x62')]['count']({'where':_0x286a92['where']})['then'](function(_0x28d7d8){_0x4256fd[_0xf975('0x32')]=_0x28d7d8;if(_0x1eb8d0[_0xf975('0x47')][_0xf975('0x58')]){_0x286a92[_0xf975('0x54')]=[{'all':!![]}];}return db[_0xf975('0x62')][_0xf975('0x55')](_0x286a92);})[_0xf975('0x21')](function(_0x560ec6){_0x4256fd[_0xf975('0x56')]=_0x560ec6;return _0x4256fd;});}})['then'](respondWithFilteredResult(_0x5f4a72,_0x286a92))['catch'](handleError(_0x5f4a72,null));};exports[_0xf975('0x66')]=function(_0x4a2abe,_0x231068,_0x5978d9){return db['OpenchannelAccount'][_0xf975('0x59')]({'where':{'id':_0x4a2abe[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x231068,null))[_0xf975('0x21')](function(_0x417378){if(_0x417378){return _0x417378[_0xf975('0x66')](_0x4a2abe[_0xf975('0x47')][_0xf975('0x67')]);}})[_0xf975('0x21')](respondWithStatusCode(_0x231068,null))['catch'](handleError(_0x231068,null));};exports[_0xf975('0x68')]=function(_0xa37b96,_0x10ca21,_0x767e4d){if(_0xa37b96[_0xf975('0x5b')]['id']){delete _0xa37b96[_0xf975('0x5b')]['id'];}return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0xa37b96['params']['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x10ca21,null))[_0xf975('0x21')](function(_0x6b89b6){if(_0x6b89b6){_0xa37b96[_0xf975('0x5b')][_0xf975('0x65')]=_0x6b89b6['id'];return db[_0xf975('0x69')]['create'](_0xa37b96[_0xf975('0x5b')]);}})[_0xf975('0x21')](respondWithResult(_0x10ca21,null))['catch'](handleError(_0x10ca21,null));};exports['getAnswers']=function(_0x508b52,_0x24a8d6,_0x10d188){var _0x5f0c9d={'raw':![],'where':{}};var _0x55d178={};var _0x1396cf={'count':0x0,'rows':[]};return db[_0xf975('0x42')][_0xf975('0x6a')]({'where':{'id':_0x508b52[_0xf975('0x57')]['id']}})['then'](handleEntityNotFound(_0x24a8d6,null))[_0xf975('0x21')](function(_0x2d85a1){if(_0x2d85a1){_0x55d178[_0xf975('0x46')]=_['keys'](db[_0xf975('0x69')][_0xf975('0x43')]);_0x55d178['query']=_[_0xf975('0x64')](_0x508b52[_0xf975('0x47')]);_0x55d178[_0xf975('0x48')]=_[_0xf975('0x49')](_0x55d178[_0xf975('0x46')],_0x55d178[_0xf975('0x47')]);_0x5f0c9d[_0xf975('0x4a')]=_[_0xf975('0x49')](_0x55d178[_0xf975('0x46')],qs[_0xf975('0x4b')](_0x508b52['query']['fields']));_0x5f0c9d['attributes']=_0x5f0c9d[_0xf975('0x4a')][_0xf975('0x4c')]?_0x5f0c9d[_0xf975('0x4a')]:_0x55d178['model'];if(!_0x508b52[_0xf975('0x47')][_0xf975('0x6b')](_0xf975('0x4d'))){_0x5f0c9d['limit']=qs[_0xf975('0x31')](_0x508b52[_0xf975('0x47')]['limit']);_0x5f0c9d[_0xf975('0x2f')]=qs['offset'](_0x508b52[_0xf975('0x47')][_0xf975('0x2f')]);}_0x5f0c9d[_0xf975('0x4e')]=qs[_0xf975('0x6c')](_0x508b52['query'][_0xf975('0x6c')]);_0x5f0c9d['where']=qs[_0xf975('0x48')](_[_0xf975('0x50')](_0x508b52[_0xf975('0x47')],_0x55d178['filters']));_0x5f0c9d[_0xf975('0x4f')][_0xf975('0x65')]=_0x2d85a1['id'];if(_0x508b52[_0xf975('0x47')]['filter']){_0x5f0c9d['where']=_[_0xf975('0x51')](_0x5f0c9d['where'],{'$or':_[_0xf975('0x41')](_0x5f0c9d[_0xf975('0x4a')],function(_0xccfce){var _0xaea397={};_0xaea397[_0xccfce]={'$like':'%'+_0x508b52[_0xf975('0x47')][_0xf975('0x52')]+'%'};return _0xaea397;})});}_0x5f0c9d=_[_0xf975('0x51')]({},_0x5f0c9d,_0x508b52[_0xf975('0x53')]);return db['CannedAnswer'][_0xf975('0x32')]({'where':_0x5f0c9d[_0xf975('0x4f')]})[_0xf975('0x21')](function(_0x1e44d8){_0x1396cf['count']=_0x1e44d8;if(_0x508b52[_0xf975('0x47')][_0xf975('0x58')]){_0x5f0c9d[_0xf975('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf975('0x55')](_0x5f0c9d);})[_0xf975('0x21')](function(_0x946e1e){_0x1396cf[_0xf975('0x56')]=_0x946e1e;return _0x1396cf;});}})[_0xf975('0x21')](respondWithFilteredResult(_0x24a8d6,_0x5f0c9d))['catch'](handleError(_0x24a8d6,null));};exports[_0xf975('0x6d')]=function(_0x1cc4f9,_0x368915,_0x4894f1){return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0x1cc4f9['params']['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x368915,null))[_0xf975('0x21')](function(_0x38acb5){if(_0x38acb5){return _0x38acb5[_0xf975('0x6d')](_0x1cc4f9[_0xf975('0x47')]['ids']);}})[_0xf975('0x21')](respondWithStatusCode(_0x368915,null))[_0xf975('0x2b')](handleError(_0x368915,null));};exports[_0xf975('0x6e')]=function(_0x473774,_0x456b33,_0x34b39d){var _0x2827c2={'body':_0x473774[_0xf975('0x5b')],'channel':_0xf975('0x6f')};var _0x4a6f12=[];var _0xe99e6e=[];var _0x4b78c2={};var _0x45d075=![];return db[_0xf975('0x70')]['describe']()[_0xf975('0x21')](function(_0x1fa929){if(!_0x1fa929){throw new db['Sequelize'][(_0xf975('0x71'))](_0xf975('0x72'));}_0x4a6f12=_[_0xf975('0x73')](_[_0xf975('0x64')](_0x1fa929),[_0xf975('0x74'),_0xf975('0x75')]);_0xe99e6e=_['difference'](_[_0xf975('0x64')](_0x1fa929),[_0xf975('0x74'),_0xf975('0x75'),'CompanyId',_0xf975('0x76')]);if(_0x473774[_0xf975('0x5b')]['id']){delete _0x473774[_0xf975('0x5b')]['id'];}if(_[_0xf975('0x77')](_0x473774[_0xf975('0x5b')][_0xf975('0x78')])){throw new db[(_0xf975('0x79'))][(_0xf975('0x71'))](_0xf975('0x7a'));}if(_[_0xf975('0x77')](_0x473774[_0xf975('0x5b')][_0xf975('0x5b')])||_0x473774[_0xf975('0x5b')][_0xf975('0x5b')]===''){throw new db['Sequelize'][(_0xf975('0x71'))](_0xf975('0x7b'));}if(_[_0xf975('0x77')](_0x473774[_0xf975('0x5b')][_0xf975('0x7c')])){throw new db[(_0xf975('0x79'))]['ValidationError'](_0xf975('0x7d')+_0xe99e6e);}if(!_[_0xf975('0x7e')](_0xe99e6e,_0x473774[_0xf975('0x5b')]['mapKey'])){throw new db[(_0xf975('0x79'))][(_0xf975('0x71'))](_0xf975('0x7f')+_0xe99e6e);}_0x4b78c2[_0x473774[_0xf975('0x5b')][_0xf975('0x7c')]]=_0x473774[_0xf975('0x5b')][_0xf975('0x78')];})[_0xf975('0x21')](function(){return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0x473774[_0xf975('0x57')]['id']},'include':[{'model':db[_0xf975('0x80')],'as':_0xf975('0x81'),'include':[{'model':db[_0xf975('0x70')],'as':'Contacts','where':_0x4b78c2,'limit':0x1,'order':[[_0xf975('0x75'),_0xf975('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xf975('0x83')}]});})['then'](handleEntityNotFound(_0x456b33,null))[_0xf975('0x21')](function(_0x49e87c){if(_0x49e87c&&_0x49e87c[_0xf975('0x81')]){_0x2827c2[_0xf975('0x84')]=_0x49e87c;_0x2827c2[_0xf975('0x85')]=_0x49e87c[_0xf975('0x83')];_0x2827c2[_0xf975('0x86')]=_0x49e87c['List'];_0x2827c2[_0xf975('0x85')]=_[_0xf975('0x87')](_0x2827c2['applications'],[_0xf975('0x88')],[_0xf975('0x89')]);if(_0x2827c2[_0xf975('0x84')]['Applications']){delete _0x2827c2[_0xf975('0x84')][_0xf975('0x83')];}if(_0x2827c2[_0xf975('0x84')][_0xf975('0x81')]&&_0x2827c2[_0xf975('0x84')][_0xf975('0x81')][_0xf975('0x8a')][_0xf975('0x4c')]){return _0x2827c2['account'][_0xf975('0x81')][_0xf975('0x8a')][0x0];}var _0x213c63=_[_0xf975('0x8b')](_0x473774['body'],{'firstName':_0x473774['body'][_0xf975('0x78')],'ListId':_0x49e87c[_0xf975('0x76')]});_0x213c63[_0x473774[_0xf975('0x5b')]['mapKey']]=_0x473774[_0xf975('0x5b')][_0xf975('0x78')];return db[_0xf975('0x70')][_0xf975('0x5a')](_0x213c63,{'fields':_0x4a6f12,'raw':!![]});}})[_0xf975('0x21')](handleEntityNotFound(_0x456b33,null))[_0xf975('0x21')](function(_0x174cbe){_0x2827c2[_0xf975('0x8c')]=_0x174cbe;if(_0x174cbe){var _0x1afaec={'ContactId':_0x174cbe['id'],'OpenchannelAccountId':_0x473774[_0xf975('0x57')]['id'],'from':(_0x174cbe['firstName']||'')+'\x20'+(_0x174cbe[_0xf975('0x8d')]||'')};var _0xd4797b={'OpenchannelAccountId':_0x473774[_0xf975('0x57')]['id'],'closed':![]};if(_0x473774[_0xf975('0x5b')][_0xf975('0x8e')]){_0xd4797b[_0xf975('0x8e')]=_0x473774[_0xf975('0x5b')][_0xf975('0x8e')];return db[_0xf975('0x8f')]['find']({'where':_0xd4797b})['then'](function(_0x3ab594){if(_0x3ab594){return[_0x3ab594,![]];}_0x1afaec[_0xf975('0x8e')]=_0x473774[_0xf975('0x5b')][_0xf975('0x8e')];_0x1afaec['externalUrl']=_0x473774['body'][_0xf975('0x90')];return db[_0xf975('0x8f')][_0xf975('0x5a')](_0x1afaec)[_0xf975('0x21')](function(_0x829b1){return[_0x829b1,!![]];});});}else{_0xd4797b['threadId']=null;}_0xd4797b[_0xf975('0x91')]=_0x174cbe['id'];return db[_0xf975('0x8f')][_0xf975('0x59')]({'where':_0xd4797b})[_0xf975('0x21')](function(_0x529c6c){if(_0x529c6c){return[_0x529c6c,![]];}return db[_0xf975('0x8f')][_0xf975('0x5a')](_0x1afaec)['then'](function(_0x3002d4){return[_0x3002d4,!![]];});});}})[_0xf975('0x92')](function(_0x1412b6,_0x4b89c4){if(_0x1412b6){_0x45d075=_0x4b89c4;if(!_0x4b89c4){var _0x4e3bec={'from':(_0x2827c2[_0xf975('0x8c')][_0xf975('0x93')]||'')+'\x20'+(_0x2827c2[_0xf975('0x8c')][_0xf975('0x8d')]||'')};if(_0x473774[_0xf975('0x5b')][_0xf975('0x8e')]&&_0x473774['body'][_0xf975('0x94')]&&_0x473774['body']['threadId']!=_0x473774['body']['messageId']){_0x4e3bec[_0xf975('0x8e')]=_0x473774['body'][_0xf975('0x94')];}return _0x1412b6[_0xf975('0x36')](_0x4e3bec);}else{return _0x1412b6;}}})[_0xf975('0x21')](function(_0x2765fa){_0x2827c2[_0xf975('0x95')]=_0x2765fa[_0xf975('0x38')]({'plain':!![]});_0x2827c2[_0xf975('0x95')]['created']=_0x45d075;if(_0x2827c2[_0xf975('0x95')][_0xf975('0x96')]){if(_0x2827c2[_0xf975('0x84')]['autoclose']){_0x2827c2[_0xf975('0x85')]['push']({'id':0x0,'priority':_0x2827c2[_0xf975('0x85')][_0xf975('0x4c')]+0x1,'app':_0xf975('0x97'),'appdata':_0xf975('0x98'),'interval':_0xf975('0x99')});}}return db[_0xf975('0x9a')][_0xf975('0x5a')]({'body':_0x473774[_0xf975('0x5b')][_0xf975('0x5b')],'OpenchannelAccountId':_0x473774[_0xf975('0x57')]['id'],'OpenchannelInteractionId':_0x2765fa['id'],'direction':'in','ContactId':_0x2827c2['contact']['id'],'AttachmentId':_0x473774[_0xf975('0x5b')][_0xf975('0x9b')]});})['then'](function(_0x1f7c1b){_0x2827c2['message']=_0x1f7c1b;if(!_0x2827c2['interaction']['UserId'])return;return db['User'][_0xf975('0x59')]({'attributes':['id','name'],'where':{'id':_0x2827c2['interaction'][_0xf975('0x9c')]}});})[_0xf975('0x21')](function(_0x56f118){if(_0x56f118){_0x2827c2['applications'][_0xf975('0x9d')]({'id':0x0,'priority':0x0,'app':_0xf975('0x9e'),'appdata':_0x56f118['name']+','+(_0x2827c2['account']['waitForTheAssignedAgent']||0xa),'interval':_0xf975('0x99')});}if(!_0x2827c2[_0xf975('0x95')]['queueId'])return;return db['OpenchannelQueue'][_0xf975('0x59')]({'attributes':['id',_0xf975('0x3c')],'where':{'id':_0x2827c2['interaction'][_0xf975('0x9f')]}});})[_0xf975('0x21')](function(_0x394ac4){if(_0x394ac4){_0x2827c2[_0xf975('0x85')][_0xf975('0x9d')]({'id':0x0,'priority':0x1,'app':_0xf975('0xa0'),'appdata':_0x394ac4['name']+','+(_0x2827c2[_0xf975('0x84')][_0xf975('0xa1')]||0x12c),'interval':_0xf975('0x99')});}return respondWithRpcPromise(_0xf975('0xa2'),'startRouting',_0x2827c2);})[_0xf975('0x21')](function(_0x474cfc){respondWithRpcPromise(_0xf975('0xa3'),_0xf975('0xa3'),{'event':_0xf975('0x6e'),'message':_0x474cfc},client9002);return _0x474cfc;})['then'](respondWithResult(_0x456b33,null))[_0xf975('0x2b')](handleError(_0x456b33,null));};exports['addApplications']=function(_0x1dffda,_0x1aec6d){var _0x26eb6b=_0x1dffda[_0xf975('0x57')]['id'];var _0x5672b5=_0x1dffda[_0xf975('0x5b')];var _0x45e649=0xc8;var _0x3ead44=null;return db['sequelize'][_0xf975('0xa4')]({'isolationLevel':db[_0xf975('0xa5')][_0xf975('0xa6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x119961){return db[_0xf975('0x42')]['findOne']({'where':{'id':_0x26eb6b},'transaction':_0x119961})[_0xf975('0x21')](function(_0x265d64){if(_0x265d64){return db[_0xf975('0xa7')]['destroy']({'where':{'OpenchannelAccountId':_0x26eb6b},'transaction':_0x119961})[_0xf975('0x21')](function(){var _0x43b2dc=_['map'](_0x5672b5,function(_0x542daa){_0x542daa['OpenchannelAccountId']=_0x26eb6b;return _0x542daa;});return db[_0xf975('0xa7')][_0xf975('0xa8')](_0x43b2dc,{'transaction':_0x119961});});}else{_0x45e649=0x194;_0x3ead44=[];}});})['then'](function(){if(_0x45e649!==0x194){return db[_0xf975('0xa7')][_0xf975('0xa9')]({'where':{'OpenchannelAccountId':_0x26eb6b},'order':_0xf975('0x88')})[_0xf975('0x21')](function(_0xbc6f17){_0x3ead44=_0xbc6f17;});}})[_0xf975('0x2b')](function(_0x29efec){_0x45e649=0x1f4;logger[_0xf975('0x28')](_0x29efec[_0xf975('0xaa')]);if(_0x29efec[_0xf975('0x3c')]){delete _0x29efec[_0xf975('0x3c')];}_0x3ead44=_0x29efec;})[_0xf975('0xab')](function(){if(_0x3ead44===null){_0x1aec6d['sendStatus'](_0x45e649);}else{if(_0x45e649===0x1f4){_0x1aec6d[_0xf975('0x2d')](_0x45e649)[_0xf975('0x3d')](_0x3ead44);}else{_0x1aec6d[_0xf975('0x2d')](_0x45e649)[_0xf975('0x2e')](_0x3ead44);}}});};exports['getApplications']=function(_0x51e465,_0x4fa1be,_0x42262e){var _0x1f713d={};var _0x46d6bc={};var _0x3b53c6;var _0x35a2db;return db[_0xf975('0x42')][_0xf975('0x6a')]({'where':{'id':_0x51e465[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x4fa1be,null))[_0xf975('0x21')](function(_0x5b97b5){if(_0x5b97b5){_0x3b53c6=_0x5b97b5;_0x46d6bc[_0xf975('0x46')]=_[_0xf975('0x64')](db['OpenchannelApplication']['rawAttributes']);_0x46d6bc[_0xf975('0x47')]=_[_0xf975('0x64')](_0x51e465[_0xf975('0x47')]);_0x46d6bc[_0xf975('0x48')]=_[_0xf975('0x49')](_0x46d6bc[_0xf975('0x46')],_0x46d6bc[_0xf975('0x47')]);_0x1f713d[_0xf975('0x4a')]=_[_0xf975('0x49')](_0x46d6bc[_0xf975('0x46')],qs['fields'](_0x51e465['query'][_0xf975('0x4b')]));_0x1f713d[_0xf975('0x4a')]=_0x1f713d[_0xf975('0x4a')][_0xf975('0x4c')]?_0x1f713d[_0xf975('0x4a')]:_0x46d6bc[_0xf975('0x46')];_0x1f713d['order']=qs[_0xf975('0x6c')](_0x51e465['query'][_0xf975('0x6c')]);_0x1f713d['where']=qs[_0xf975('0x48')](_[_0xf975('0x50')](_0x51e465['query'],_0x46d6bc[_0xf975('0x48')]));if(_0x51e465[_0xf975('0x47')]['filter']){_0x1f713d[_0xf975('0x4f')]=_[_0xf975('0x51')](_0x1f713d['where'],{'$or':_['map'](_0x1f713d[_0xf975('0x4a')],function(_0x266ed2){var _0x13be06={};_0x13be06[_0x266ed2]={'$like':'%'+_0x51e465[_0xf975('0x47')][_0xf975('0x52')]+'%'};return _0x13be06;})});}_0x1f713d=_[_0xf975('0x51')]({},_0x1f713d,_0x51e465['options']);return _0x3b53c6[_0xf975('0xac')](_0x1f713d);}})[_0xf975('0x21')](function(_0x3060a5){if(_0x3060a5){_0x35a2db=_0x3060a5[_0xf975('0x4c')];if(!_0x51e465[_0xf975('0x47')][_0xf975('0x6b')](_0xf975('0x4d'))){_0x1f713d[_0xf975('0x31')]=qs['limit'](_0x51e465[_0xf975('0x47')]['limit']);_0x1f713d[_0xf975('0x2f')]=qs[_0xf975('0x2f')](_0x51e465['query'][_0xf975('0x2f')]);}return _0x3b53c6[_0xf975('0xac')](_0x1f713d);}})['then'](function(_0x470a79){if(_0x470a79){return _0x470a79?{'count':_0x35a2db,'rows':_0x470a79}:null;}})['then'](respondWithResult(_0x4fa1be,null))['catch'](handleError(_0x4fa1be,null));};exports[_0xf975('0xad')]=function(_0x26ef17,_0x1e1088,_0x5118e5){var _0x54c87a={'raw':![],'where':{}};var _0x12761b={};var _0x58b3ee={'count':0x0,'rows':[]};return db[_0xf975('0x42')][_0xf975('0x6a')]({'where':{'id':_0x26ef17[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x1e1088,null))[_0xf975('0x21')](function(_0x15e4e7){if(_0x15e4e7){_0x12761b[_0xf975('0x46')]=_['keys'](db['OpenchannelInteraction'][_0xf975('0x43')]);_0x12761b[_0xf975('0x47')]=_['keys'](_0x26ef17[_0xf975('0x47')]);_0x12761b[_0xf975('0x48')]=_[_0xf975('0x49')](_0x12761b[_0xf975('0x46')],_0x12761b[_0xf975('0x47')]);_0x54c87a[_0xf975('0x4a')]=_[_0xf975('0x49')](_0x12761b['model'],qs['fields'](_0x26ef17['query'][_0xf975('0x4b')]));_0x54c87a[_0xf975('0x4a')]=_0x54c87a[_0xf975('0x4a')]['length']?_0x54c87a[_0xf975('0x4a')]:_0x12761b[_0xf975('0x46')];if(!_0x26ef17[_0xf975('0x47')]['hasOwnProperty'](_0xf975('0x4d'))){_0x54c87a['limit']=qs['limit'](_0x26ef17['query']['limit']);_0x54c87a['offset']=qs[_0xf975('0x2f')](_0x26ef17[_0xf975('0x47')]['offset']);}_0x54c87a[_0xf975('0x4e')]=qs[_0xf975('0x6c')](_0x26ef17['query'][_0xf975('0x6c')]);_0x54c87a[_0xf975('0x4f')]=qs['filters'](_[_0xf975('0x50')](_0x26ef17[_0xf975('0x47')],_0x12761b[_0xf975('0x48')]));_0x54c87a[_0xf975('0x4f')][_0xf975('0x65')]=_0x15e4e7['id'];if(_0x26ef17[_0xf975('0x47')][_0xf975('0x52')]){_0x54c87a['where']=_[_0xf975('0x51')](_0x54c87a[_0xf975('0x4f')],{'$or':_['map'](_0x54c87a[_0xf975('0x4a')],function(_0x1c0139){var _0x17601f={};_0x17601f[_0x1c0139]={'$like':'%'+_0x26ef17[_0xf975('0x47')]['filter']+'%'};return _0x17601f;})});}_0x54c87a=_['merge']({},_0x54c87a,_0x26ef17[_0xf975('0x53')]);return db[_0xf975('0x8f')][_0xf975('0x32')]({'where':_0x54c87a['where']})[_0xf975('0x21')](function(_0x1c4674){_0x58b3ee['count']=_0x1c4674;if(_0x26ef17[_0xf975('0x47')][_0xf975('0x58')]){_0x54c87a[_0xf975('0x54')]=[{'model':db['CmContact'],'as':_0xf975('0xae'),'required':![]},{'model':db[_0xf975('0xaf')],'as':_0xf975('0xb0'),'attributes':[_0xf975('0x3c'),_0xf975('0xb1'),_0xf975('0xb2')],'required':![]},{'model':db[_0xf975('0xb3')],'as':_0xf975('0xb4'),'attributes':['id',_0xf975('0x3c'),'color'],'where':_0x26ef17['query'][_0xf975('0xb5')]?{'id':_0x26ef17[_0xf975('0x47')][_0xf975('0xb5')]}:undefined,'required':_0x26ef17[_0xf975('0x47')][_0xf975('0xb5')]?!![]:![]}];}return db[_0xf975('0x8f')][_0xf975('0x55')](_0x54c87a);})['then'](function(_0x58a0d4){_0x58b3ee['rows']=_0x58a0d4;return _0x58b3ee;});}})[_0xf975('0x21')](respondWithFilteredResult(_0x1e1088,_0x54c87a))['catch'](handleError(_0x1e1088,null));};exports[_0xf975('0xb6')]=function(_0x1a0436,_0x55989e,_0x435a52){return db[_0xf975('0x42')]['find']({'where':{'id':_0x1a0436[_0xf975('0x57')]['id']}})['then'](handleEntityNotFound(_0x55989e,null))[_0xf975('0x21')](function(_0x92e203){if(_0x92e203){return _0x92e203[_0xf975('0xb6')](_0x1a0436[_0xf975('0x5b')][_0xf975('0x67')],_[_0xf975('0xb7')](_0x1a0436[_0xf975('0x5b')],[_0xf975('0x67'),'id'])||{})['spread'](function(_0x20aab8){for(var _0xffd7ee=0x0;_0xffd7ee<_0x1a0436[_0xf975('0x5b')][_0xf975('0x67')][_0xf975('0x4c')];_0xffd7ee+=0x1){socket[_0xf975('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x1a0436['body'][_0xf975('0x67')][_0xffd7ee]),'OpenchannelAccountId':Number(_0x1a0436['params']['id'])});}return _0x20aab8;});}})[_0xf975('0x21')](respondWithResult(_0x55989e,null))[_0xf975('0x2b')](handleError(_0x55989e,null));};exports[_0xf975('0xb9')]=function(_0x3ebaed,_0x3f90b8,_0x43c435){return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0x3ebaed[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x3f90b8,null))[_0xf975('0x21')](function(_0x1f51f9){if(_0x1f51f9){return _0x1f51f9[_0xf975('0xb9')](_0x3ebaed['query'][_0xf975('0x67')])[_0xf975('0x21')](function(){if(_[_0xf975('0xba')](_0x3ebaed[_0xf975('0x47')][_0xf975('0x67')])){for(var _0x1fbbcd=0x0;_0x1fbbcd<_0x3ebaed[_0xf975('0x47')][_0xf975('0x67')][_0xf975('0x4c')];_0x1fbbcd+=0x1){socket[_0xf975('0xb8')](_0xf975('0xbb'),{'UserId':Number(_0x3ebaed[_0xf975('0x47')][_0xf975('0x67')][_0x1fbbcd]),'OpenchannelAccountId':Number(_0x3ebaed['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3ebaed['query'][_0xf975('0x67')]),'OpenchannelAccountId':Number(_0x3ebaed[_0xf975('0x57')]['id'])});}});}})[_0xf975('0x21')](respondWithStatusCode(_0x3f90b8,null))[_0xf975('0x2b')](handleError(_0x3f90b8,null));};exports[_0xf975('0xbc')]=function(_0x33edc1,_0x22790c,_0x2c3d14){var _0x50235e={};var _0x5862d0={};var _0x25faeb;var _0x4bde77;return db[_0xf975('0x42')][_0xf975('0x6a')]({'where':{'id':_0x33edc1[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x22790c,null))['then'](function(_0x123357){if(_0x123357){_0x25faeb=_0x123357;_0x5862d0[_0xf975('0x46')]=_[_0xf975('0x64')](db['User'][_0xf975('0x43')]);_0x5862d0[_0xf975('0x47')]=_[_0xf975('0x64')](_0x33edc1['query']);_0x5862d0[_0xf975('0x48')]=_[_0xf975('0x49')](_0x5862d0[_0xf975('0x46')],_0x5862d0['query']);_0x50235e[_0xf975('0x4a')]=_['intersection'](_0x5862d0['model'],qs[_0xf975('0x4b')](_0x33edc1[_0xf975('0x47')][_0xf975('0x4b')]));_0x50235e[_0xf975('0x4a')]=_0x50235e[_0xf975('0x4a')][_0xf975('0x4c')]?_0x50235e['attributes']:_0x5862d0[_0xf975('0x46')];_0x50235e['order']=qs[_0xf975('0x6c')](_0x33edc1['query']['sort']);_0x50235e[_0xf975('0x4f')]=qs[_0xf975('0x48')](_['pick'](_0x33edc1[_0xf975('0x47')],_0x5862d0[_0xf975('0x48')]));if(_0x33edc1['query']['filter']){_0x50235e['where']=_[_0xf975('0x51')](_0x50235e['where'],{'$or':_[_0xf975('0x41')](_0x50235e['attributes'],function(_0x1cfb13){var _0x1b028f={};_0x1b028f[_0x1cfb13]={'$like':'%'+_0x33edc1['query'][_0xf975('0x52')]+'%'};return _0x1b028f;})});}_0x50235e=_[_0xf975('0x51')]({},_0x50235e,_0x33edc1[_0xf975('0x53')]);return _0x25faeb[_0xf975('0xbc')](_0x50235e);}})[_0xf975('0x21')](function(_0x34248a){if(_0x34248a){_0x4bde77=_0x34248a[_0xf975('0x4c')];if(!_0x33edc1['query'][_0xf975('0x6b')](_0xf975('0x4d'))){_0x50235e['limit']=qs[_0xf975('0x31')](_0x33edc1[_0xf975('0x47')]['limit']);_0x50235e['offset']=qs[_0xf975('0x2f')](_0x33edc1[_0xf975('0x47')]['offset']);}return _0x25faeb[_0xf975('0xbc')](_0x50235e);}})[_0xf975('0x21')](function(_0x15e443){if(_0x15e443){return _0x15e443?{'count':_0x4bde77,'rows':_0x15e443}:null;}})[_0xf975('0x21')](respondWithResult(_0x22790c,null))[_0xf975('0x2b')](handleError(_0x22790c,null));};exports['send']=function(_0x26c41b,_0x16101e,_0x4c161a){var _0x1c67e4,_0x49c36f,_0x57d124;if(_['isNil'](_0x26c41b[_0xf975('0x5b')]['body'])||_0x26c41b['body'][_0xf975('0x5b')]===''){throw new db['Sequelize'][(_0xf975('0x71'))](_0xf975('0x7b'));}if(_[_0xf975('0x77')](_0x26c41b[_0xf975('0x5b')]['to'])){}_0x1c67e4=_0x26c41b[_0xf975('0x5b')]['to'];return db['OpenchannelAccount'][_0xf975('0x6a')]({'where':{'id':_0x26c41b[_0xf975('0x57')]['id']}})[_0xf975('0x21')](handleEntityNotFound(_0x16101e,null))[_0xf975('0x21')](function(_0x5ca18f){if(_0x5ca18f){return db[_0xf975('0x42')][_0xf975('0x59')]({'where':{'id':_0x5ca18f['id']},'include':[{'model':db['CmList'],'as':_0xf975('0x81'),'include':[{'model':db[_0xf975('0x70')],'as':_0xf975('0x8a'),'where':{[_0x5ca18f[_0xf975('0x7c')]]:_0x1c67e4},'limit':0x1,'order':[[_0xf975('0x75'),_0xf975('0x82')]]}]}]})[_0xf975('0x21')](handleEntityNotFound(_0x16101e,null))[_0xf975('0x21')](function(_0x27b6fc){if(_0x27b6fc&&_0x27b6fc[_0xf975('0x81')]){_0x49c36f=_0x27b6fc[_0xf975('0x38')]({'plain':!![]});if(_0x49c36f[_0xf975('0x81')]&&_0x49c36f[_0xf975('0x81')][_0xf975('0x8a')]['length']){return _0x49c36f[_0xf975('0x81')]['Contacts'][0x0];}return db['CmContact'][_0xf975('0x5a')](_[_0xf975('0x8b')](_0x26c41b[_0xf975('0x5b')],{'firstName':_0x1c67e4,[_0x27b6fc[_0xf975('0x7c')]]:_0x1c67e4,'phone':_0x1c67e4,'ListId':_0x49c36f[_0xf975('0x76')]}));}})['then'](handleEntityNotFound(_0x16101e,null))[_0xf975('0x21')](function(_0x59ffac){if(_0x59ffac){_0x57d124=_0x59ffac;return db[_0xf975('0x8f')][_0xf975('0x59')]({'where':{'ContactId':_0x57d124['id'],'closed':![],'OpenchannelAccountId':_0x49c36f['id']}})[_0xf975('0x21')](function(_0x41b511){if(_0x41b511){return[_0x41b511,![]];}return db[_0xf975('0x8f')][_0xf975('0x5a')]({'UserId':_0x26c41b[_0xf975('0x5e')]['id'],'ContactId':_0x57d124['id'],'OpenchannelAccountId':_0x49c36f['id'],'lastMsgDirection':'out','firstMsgDirection':_0xf975('0xbd'),'Messages':[_['merge'](_0x26c41b[_0xf975('0x5b')],{'read':![],'body':_0x26c41b[_0xf975('0x5b')]['body'],'OpenchannelAccountId':_0x49c36f['id'],'UserId':_0x26c41b[_0xf975('0x5e')]['id'],'ContactId':_0x57d124['id']})]},{'include':[{'model':db[_0xf975('0x9a')],'as':_0xf975('0xbe')}]})[_0xf975('0x21')](function(_0x4d4d3c){return[_0x4d4d3c,!![]];});});}})[_0xf975('0x92')](function(_0xa78da2,_0x5efae0){if(_0x5efae0){return _0xa78da2;}return db[_0xf975('0x9a')][_0xf975('0x5a')](_['merge'](_0x26c41b[_0xf975('0x5b')],{'read':![],'body':_0x26c41b[_0xf975('0x5b')][_0xf975('0x5b')],'OpenchannelAccountId':_0x49c36f['id'],'OpenchannelInteractionId':_0xa78da2['id'],'UserId':_0x26c41b['user']['id'],'ContactId':_0x57d124['id']}))['then'](function(_0x1633ed){_0xa78da2[_0xf975('0xbf')]['Messages']=[];_0xa78da2[_0xf975('0xbf')][_0xf975('0xbe')][_0xf975('0xc0')](_0x1633ed[_0xf975('0xbf')]);return _0xa78da2;});});}})[_0xf975('0x21')](respondWithResult(_0x16101e,null))[_0xf975('0x2b')](handleError(_0x16101e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 91f5c2c..00caa80 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 _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x4e1a67,_0x3782d1){var _0x5ac838=function(_0x4c7da6){while(--_0x4c7da6){_0x4e1a67['push'](_0x4e1a67['shift']());}};_0x5ac838(++_0x3782d1);}(_0xac4a,0x13f));var _0xaac4=function(_0xcf2305,_0x2380e9){_0xcf2305=_0xcf2305-0x0;var _0x5020da=_0xac4a[_0xcf2305];return _0x5020da;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x2750=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x39cb42,_0x61bf00){var _0x29c8ee=function(_0x3c577a){while(--_0x3c577a){_0x39cb42['push'](_0x39cb42['shift']());}};_0x29c8ee(++_0x61bf00);}(_0x2750,0x13b));var _0x0275=function(_0x2cbce0,_0x30972d){_0x2cbce0=_0x2cbce0-0x0;var _0x50222c=_0x2750[_0x2cbce0];return _0x50222c;};'use strict';var EventEmitter=require(_0x0275('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x0275('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0275('0x2')](0x0);var events={'afterCreate':_0x0275('0x3'),'afterUpdate':_0x0275('0x4'),'afterDestroy':_0x0275('0x5')};function emitEvent(_0x41ec06){return function(_0x20273d,_0x4960,_0x3d0c9c){OpenchannelAccountEvents[_0x0275('0x6')](_0x41ec06+':'+_0x20273d['id'],_0x20273d);OpenchannelAccountEvents['emit'](_0x41ec06,_0x20273d);_0x3d0c9c(null);};}for(var e in events){if(events[_0x0275('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0275('0x8')](e,emitEvent(event));}}module[_0x0275('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 54f8e6a..1fb97c4 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(_0x484ded,_0x2a0c92){var _0x4bb2fb=function(_0x3829f3){while(--_0x3829f3){_0x484ded['push'](_0x484ded['shift']());}};_0x4bb2fb(++_0x2a0c92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x2f77af,_0x44fd2f){var _0x3860a2=function(_0x140c3a){while(--_0x140c3a){_0x2f77af['push'](_0x2f77af['shift']());}};_0x3860a2(++_0x44fd2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 90081f5..d18d3ea 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 _0x34b7=['redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5d860a,_0xe2505b){var _0x2bd13a=function(_0x471d8c){while(--_0x471d8c){_0x5d860a['push'](_0x5d860a['shift']());}};_0x2bd13a(++_0xe2505b);}(_0x34b7,0x196));var _0x734b=function(_0x26e780,_0x5465ba){_0x26e780=_0x26e780-0x0;var _0x2e9594=_0x34b7[_0x26e780];return _0x2e9594;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});config[_0x734b('0xa')]=_[_0x734b('0xb')](config['redis'],{'host':_0x734b('0xc'),'port':0x18eb});var socket=require(_0x734b('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x19a88e,_0x598dee,_0x43c5e0){return new BPromise(function(_0x333738,_0x2860a2){return client[_0x734b('0xe')](_0x19a88e,_0x43c5e0)[_0x734b('0xf')](function(_0x16e451){logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));logger[_0x734b('0x13')](_0x734b('0x14'),_0x598dee,_0x734b('0x12'),JSON[_0x734b('0x15')](_0x16e451));if(_0x16e451[_0x734b('0x16')]){if(_0x16e451['error'][_0x734b('0x17')]===0x1f4){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x2860a2(_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);}logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x333738(_0x16e451['error'][_0x734b('0x18')]);}else{logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));_0x333738(_0x16e451['result']['message']);}})[_0x734b('0x19')](function(_0x3033cd){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x3033cd);_0x2860a2(_0x3033cd);});});} \ No newline at end of file +var _0xd547=['request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','register'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd547,0x1c1));var _0x7d54=function(_0x57d4b2,_0x43236a){_0x57d4b2=_0x57d4b2-0x0;var _0x57fc1c=_0xd547[_0x57d4b2];return _0x57fc1c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d54('0x0'));var BPromise=require(_0x7d54('0x1'));var rs=require(_0x7d54('0x2'));var fs=require('fs');var Redis=require(_0x7d54('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d54('0x4'))('rpc');var config=require(_0x7d54('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7d54('0x6')][_0x7d54('0x7')]({'port':0x232a});config[_0x7d54('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d54('0x9'))(new Redis(config[_0x7d54('0x8')]));require('./openchannelAccount.socket')[_0x7d54('0xa')](socket);function respondWithRpcPromise(_0x48b250,_0x2bede6,_0x4d9dc3){return new BPromise(function(_0x1d7ff7,_0x570460){return client[_0x7d54('0xb')](_0x48b250,_0x4d9dc3)[_0x7d54('0xc')](function(_0x5bd01a){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2bede6,_0x7d54('0xd'));logger[_0x7d54('0xe')](_0x7d54('0xf'),_0x2bede6,'request\x20sent',JSON[_0x7d54('0x10')](_0x5bd01a));if(_0x5bd01a['error']){if(_0x5bd01a[_0x7d54('0x11')]['code']===0x1f4){logger[_0x7d54('0x11')](_0x7d54('0x12'),_0x2bede6,_0x5bd01a['error'][_0x7d54('0x13')]);return _0x570460(_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);}logger['error'](_0x7d54('0x12'),_0x2bede6,_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);return _0x1d7ff7(_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);}else{logger[_0x7d54('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x2bede6,_0x7d54('0xd'));_0x1d7ff7(_0x5bd01a[_0x7d54('0x15')]['message']);}})[_0x7d54('0x16')](function(_0x4b9caf){logger['error'](_0x7d54('0x12'),_0x2bede6,_0x4b9caf);_0x570460(_0x4b9caf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 834aa8c..0988b09 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 _0xd5b6=['removeListener','register','length','./openchannelAccount.events','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd5b6,0x73));var _0x6d5b=function(_0x34de66,_0x2d1467){_0x34de66=_0x34de66-0x0;var _0x34651b=_0xd5b6[_0x34de66];return _0x34651b;};'use strict';var OpenchannelAccountEvents=require(_0x6d5b('0x0'));var events=[_0x6d5b('0x1'),_0x6d5b('0x2'),_0x6d5b('0x3')];function createListener(_0x406106,_0x3d9bc9){return function(_0x162442){_0x3d9bc9[_0x6d5b('0x4')](_0x406106,_0x162442);};}function removeListener(_0x558202,_0x2735ab){return function(){OpenchannelAccountEvents[_0x6d5b('0x5')](_0x558202,_0x2735ab);};}exports[_0x6d5b('0x6')]=function(_0x4935ef){for(var _0x1c2490=0x0,_0x3e722d=events[_0x6d5b('0x7')];_0x1c2490<_0x3e722d;_0x1c2490++){var _0x3cdc91=events[_0x1c2490];var _0x5b57cb=createListener('openchannelAccount:'+_0x3cdc91,_0x4935ef);OpenchannelAccountEvents['on'](_0x3cdc91,_0x5b57cb);}}; \ No newline at end of file +var _0x3df4=['emit','register','openchannelAccount:','remove','update'];(function(_0x44d1bf,_0x5f4a5a){var _0x33e1a2=function(_0xc66808){while(--_0xc66808){_0x44d1bf['push'](_0x44d1bf['shift']());}};_0x33e1a2(++_0x5f4a5a);}(_0x3df4,0x102));var _0x43df=function(_0x5e8f1d,_0x4124fd){_0x5e8f1d=_0x5e8f1d-0x0;var _0x4af358=_0x3df4[_0x5e8f1d];return _0x4af358;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x43df('0x0'),_0x43df('0x1')];function createListener(_0x40bf18,_0x206707){return function(_0x38a050){_0x206707[_0x43df('0x2')](_0x40bf18,_0x38a050);};}function removeListener(_0x4297f4,_0x5affd4){return function(){OpenchannelAccountEvents['removeListener'](_0x4297f4,_0x5affd4);};}exports[_0x43df('0x3')]=function(_0x3111bf){for(var _0x3af1ec=0x0,_0x43fd8c=events['length'];_0x3af1ec<_0x43fd8c;_0x3af1ec++){var _0x5863be=events[_0x3af1ec];var _0x2492a9=createListener(_0x43df('0x4')+_0x5863be,_0x3111bf);OpenchannelAccountEvents['on'](_0x5863be,_0x2492a9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3acabc5..7026d8b 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 _0x84c3=['put','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','create'];(function(_0x519f04,_0x241684){var _0x59a907=function(_0x3580d7){while(--_0x3580d7){_0x519f04['push'](_0x519f04['shift']());}};_0x59a907(++_0x241684);}(_0x84c3,0x114));var _0x384c=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x84c3[_0x34843e];return _0x598f7f;};'use strict';var multer=require('multer');var util=require(_0x384c('0x0'));var path=require(_0x384c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x384c('0x2')]();var fs_extra=require(_0x384c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x384c('0x4'));var config=require(_0x384c('0x5'));var controller=require(_0x384c('0x6'));router['get']('/',auth[_0x384c('0x7')](),controller[_0x384c('0x8')]);router['get'](_0x384c('0x9'),auth[_0x384c('0x7')](),controller[_0x384c('0xa')]);router['post']('/',auth[_0x384c('0x7')](),controller[_0x384c('0xb')]);router[_0x384c('0xc')](_0x384c('0x9'),auth[_0x384c('0x7')](),controller['update']);router[_0x384c('0xd')]('/:id',auth[_0x384c('0x7')](),controller[_0x384c('0xe')]);module[_0x384c('0xf')]=router; \ No newline at end of file +var _0x630e=['show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x58c8cd,_0x1ee38d){var _0x52a9da=function(_0x34bd91){while(--_0x34bd91){_0x58c8cd['push'](_0x58c8cd['shift']());}};_0x52a9da(++_0x1ee38d);}(_0x630e,0xba));var _0xe630=function(_0x1c95ec,_0x462b82){_0x1c95ec=_0x1c95ec-0x0;var _0x26f931=_0x630e[_0x1c95ec];return _0x26f931;};'use strict';var multer=require(_0xe630('0x0'));var util=require(_0xe630('0x1'));var path=require(_0xe630('0x2'));var timeout=require('connect-timeout');var express=require(_0xe630('0x3'));var router=express[_0xe630('0x4')]();var fs_extra=require(_0xe630('0x5'));var auth=require(_0xe630('0x6'));var interaction=require(_0xe630('0x7'));var config=require(_0xe630('0x8'));var controller=require(_0xe630('0x9'));router[_0xe630('0xa')]('/',auth[_0xe630('0xb')](),controller[_0xe630('0xc')]);router[_0xe630('0xa')](_0xe630('0xd'),auth[_0xe630('0xb')](),controller[_0xe630('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe630('0xf')]);router[_0xe630('0x10')](_0xe630('0xd'),auth[_0xe630('0xb')](),controller[_0xe630('0x11')]);router[_0xe630('0x12')](_0xe630('0xd'),auth[_0xe630('0xb')](),controller[_0xe630('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 052e435..d632d05 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 _0xa9f0=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x5c739f,_0x1b2ed5){var _0x5ea129=function(_0x22dda4){while(--_0x22dda4){_0x5c739f['push'](_0x5c739f['shift']());}};_0x5ea129(++_0x1b2ed5);}(_0xa9f0,0x11c));var _0x0a9f=function(_0x57b374,_0x2414ef){_0x57b374=_0x57b374-0x0;var _0x3fe6cb=_0xa9f0[_0x57b374];return _0x3fe6cb;};'use strict';var Sequelize=require(_0x0a9f('0x0'));module[_0x0a9f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a9f('0x2')],'allowNull':![],'defaultValue':_0x0a9f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0a9f('0x2')]},'interval':{'type':Sequelize[_0x0a9f('0x2')],'defaultValue':_0x0a9f('0x4')}}; \ No newline at end of file +var _0x720c=['TEXT','sequelize','INTEGER','STRING'];(function(_0x12d340,_0x3504ed){var _0x3afbc7=function(_0x191e31){while(--_0x191e31){_0x12d340['push'](_0x12d340['shift']());}};_0x3afbc7(++_0x3504ed);}(_0x720c,0x1bd));var _0xc720=function(_0x321cc3,_0xd7325c){_0x321cc3=_0x321cc3-0x0;var _0x5d4df2=_0x720c[_0x321cc3];return _0x5d4df2;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc720('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc720('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc720('0x3')]()},'description':{'type':Sequelize[_0xc720('0x2')]},'interval':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b6df33b..de34864 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 _0x2aed=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName'];(function(_0x45ec65,_0x40dac4){var _0x1a5226=function(_0x5cfd99){while(--_0x5cfd99){_0x45ec65['push'](_0x45ec65['shift']());}};_0x1a5226(++_0x40dac4);}(_0x2aed,0x159));var _0xd2ae=function(_0x321b4f,_0x365d79){_0x321b4f=_0x321b4f-0x0;var _0x879912=_0x2aed[_0x321b4f];return _0x879912;};'use strict';var emlformat=require(_0xd2ae('0x0'));var rimraf=require(_0xd2ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2ae('0x2'));var moment=require('moment');var BPromise=require(_0xd2ae('0x3'));var Mustache=require(_0xd2ae('0x4'));var util=require(_0xd2ae('0x5'));var path=require(_0xd2ae('0x6'));var sox=require(_0xd2ae('0x7'));var csv=require(_0xd2ae('0x8'));var ejs=require(_0xd2ae('0x9'));var fs=require('fs');var fs_extra=require(_0xd2ae('0xa'));var _=require('lodash');var squel=require(_0xd2ae('0xb'));var crypto=require(_0xd2ae('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd2ae('0xd'));var toCsv=require(_0xd2ae('0x8'));var querystring=require(_0xd2ae('0xe'));var Papa=require(_0xd2ae('0xf'));var Redis=require(_0xd2ae('0x10'));var authService=require(_0xd2ae('0x11'));var qs=require(_0xd2ae('0x12'));var as=require(_0xd2ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ae('0x14'))(_0xd2ae('0x15'));var utils=require(_0xd2ae('0x16'));var config=require(_0xd2ae('0x17'));var licenseUtil=require(_0xd2ae('0x18'));var db=require(_0xd2ae('0x19'))['db'];function respondWithStatusCode(_0x1d1539,_0x2729c1){_0x2729c1=_0x2729c1||0xcc;return function(_0x5d04f5){if(_0x5d04f5){return _0x1d1539[_0xd2ae('0x1a')](_0x2729c1);}return _0x1d1539[_0xd2ae('0x1b')](_0x2729c1)['end']();};}function respondWithResult(_0x3c9570,_0x3f9520){_0x3f9520=_0x3f9520||0xc8;return function(_0x32a9bb){if(_0x32a9bb){return _0x3c9570['status'](_0x3f9520)[_0xd2ae('0x1c')](_0x32a9bb);}};}function respondWithFilteredResult(_0x5f15b1,_0x14a621){return function(_0x3ad986){if(_0x3ad986){var _0x4d4242=typeof _0x14a621[_0xd2ae('0x1d')]===_0xd2ae('0x1e')&&typeof _0x14a621[_0xd2ae('0x1f')]===_0xd2ae('0x1e');var _0x58bafc=_0x3ad986[_0xd2ae('0x20')];var _0x5e437f=_0x4d4242?0x0:_0x14a621[_0xd2ae('0x1d')];var _0x302d9f=_0x4d4242?_0x3ad986[_0xd2ae('0x20')]:_0x14a621[_0xd2ae('0x1d')]+_0x14a621[_0xd2ae('0x1f')];var _0x3ccb6c;if(_0x302d9f>=_0x58bafc){_0x302d9f=_0x58bafc;_0x3ccb6c=0xc8;}else{_0x3ccb6c=0xce;}_0x5f15b1[_0xd2ae('0x1b')](_0x3ccb6c);return _0x5f15b1[_0xd2ae('0x21')](_0xd2ae('0x22'),_0x5e437f+'-'+_0x302d9f+'/'+_0x58bafc)[_0xd2ae('0x1c')](_0x3ad986);}return null;};}function patchUpdates(_0x21a06a){return function(_0x5c5349){try{jsonpatch['apply'](_0x5c5349,_0x21a06a,!![]);}catch(_0x3b182c){return BPromise[_0xd2ae('0x23')](_0x3b182c);}return _0x5c5349[_0xd2ae('0x24')]();};}function saveUpdates(_0x551d51,_0x499383){return function(_0x169235){if(_0x169235){return _0x169235[_0xd2ae('0x25')](_0x551d51)['then'](function(_0x1d9dc3){return _0x1d9dc3;});}return null;};}function removeEntity(_0x1dd6b5,_0xa0da8c){return function(_0x221a2c){if(_0x221a2c){return _0x221a2c[_0xd2ae('0x26')]()[_0xd2ae('0x27')](function(){_0x1dd6b5[_0xd2ae('0x1b')](0xcc)[_0xd2ae('0x28')]();});}};}function handleEntityNotFound(_0x4f7463,_0x90b3fc){return function(_0x4ffd35){if(!_0x4ffd35){_0x4f7463['sendStatus'](0x194);}return _0x4ffd35;};}function handleError(_0x56907d,_0x5a9fac){_0x5a9fac=_0x5a9fac||0x1f4;return function(_0x419c61){logger[_0xd2ae('0x29')](_0x419c61[_0xd2ae('0x2a')]);if(_0x419c61[_0xd2ae('0x2b')]){delete _0x419c61[_0xd2ae('0x2b')];}_0x56907d[_0xd2ae('0x1b')](_0x5a9fac)[_0xd2ae('0x2c')](_0x419c61);};}exports[_0xd2ae('0x2d')]=function(_0x38ee86,_0x4b8e92){var _0x58d623={},_0x5e89e6={},_0x50c3cf={'count':0x0,'rows':[]};var _0x393d59=_[_0xd2ae('0x2e')](db[_0xd2ae('0x2f')][_0xd2ae('0x30')],function(_0x384bc3){return{'name':_0x384bc3[_0xd2ae('0x31')],'type':_0x384bc3[_0xd2ae('0x32')][_0xd2ae('0x33')]};});_0x5e89e6[_0xd2ae('0x34')]=_['map'](_0x393d59,_0xd2ae('0x2b'));_0x5e89e6[_0xd2ae('0x35')]=_['keys'](_0x38ee86[_0xd2ae('0x35')]);_0x5e89e6[_0xd2ae('0x36')]=_[_0xd2ae('0x37')](_0x5e89e6['model'],_0x5e89e6[_0xd2ae('0x35')]);_0x58d623[_0xd2ae('0x38')]=_['intersection'](_0x5e89e6[_0xd2ae('0x34')],qs[_0xd2ae('0x39')](_0x38ee86['query'][_0xd2ae('0x39')]));_0x58d623[_0xd2ae('0x38')]=_0x58d623[_0xd2ae('0x38')][_0xd2ae('0x3a')]?_0x58d623[_0xd2ae('0x38')]:_0x5e89e6[_0xd2ae('0x34')];if(!_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x3b')](_0xd2ae('0x3c'))){_0x58d623[_0xd2ae('0x1f')]=qs['limit'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x1f')]);_0x58d623[_0xd2ae('0x1d')]=qs['offset'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x1d')]);}_0x58d623[_0xd2ae('0x3d')]=qs['sort'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x3e')]);_0x58d623[_0xd2ae('0x3f')]=qs[_0xd2ae('0x36')](_[_0xd2ae('0x40')](_0x38ee86[_0xd2ae('0x35')],_0x5e89e6[_0xd2ae('0x36')]),_0x393d59);if(_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x41')]){_0x58d623[_0xd2ae('0x3f')]=_[_0xd2ae('0x42')](_0x58d623[_0xd2ae('0x3f')],{'$or':_[_0xd2ae('0x2e')](_0x393d59,function(_0x243a66){if(_0x243a66[_0xd2ae('0x32')]!==_0xd2ae('0x43')){var _0x26c01c={};_0x26c01c[_0x243a66[_0xd2ae('0x2b')]]={'$like':'%'+_0x38ee86[_0xd2ae('0x35')]['filter']+'%'};return _0x26c01c;}})});}_0x58d623=_['merge']({},_0x58d623,_0x38ee86[_0xd2ae('0x44')]);var _0x41769c={'where':_0x58d623['where']};return db[_0xd2ae('0x2f')][_0xd2ae('0x20')](_0x41769c)[_0xd2ae('0x27')](function(_0x58b266){_0x50c3cf['count']=_0x58b266;if(_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x45')]){_0x58d623[_0xd2ae('0x46')]=[{'all':!![]}];}return db[_0xd2ae('0x2f')][_0xd2ae('0x47')](_0x58d623);})[_0xd2ae('0x27')](function(_0x3a6014){_0x50c3cf['rows']=_0x3a6014;return _0x50c3cf;})[_0xd2ae('0x27')](respondWithFilteredResult(_0x4b8e92,_0x58d623))['catch'](handleError(_0x4b8e92,null));};exports[_0xd2ae('0x48')]=function(_0x5874da,_0x1e8137){var _0x246c29={'raw':!![],'where':{'id':_0x5874da[_0xd2ae('0x49')]['id']}},_0x1e4adc={};_0x1e4adc['model']=_[_0xd2ae('0x4a')](db[_0xd2ae('0x2f')]['rawAttributes']);_0x1e4adc[_0xd2ae('0x35')]=_[_0xd2ae('0x4a')](_0x5874da[_0xd2ae('0x35')]);_0x1e4adc['filters']=_[_0xd2ae('0x37')](_0x1e4adc['model'],_0x1e4adc[_0xd2ae('0x35')]);_0x246c29['attributes']=_['intersection'](_0x1e4adc[_0xd2ae('0x34')],qs[_0xd2ae('0x39')](_0x5874da[_0xd2ae('0x35')]['fields']));_0x246c29[_0xd2ae('0x38')]=_0x246c29[_0xd2ae('0x38')][_0xd2ae('0x3a')]?_0x246c29[_0xd2ae('0x38')]:_0x1e4adc['model'];if(_0x5874da[_0xd2ae('0x35')][_0xd2ae('0x45')]){_0x246c29[_0xd2ae('0x46')]=[{'all':!![]}];}_0x246c29=_[_0xd2ae('0x42')]({},_0x246c29,_0x5874da[_0xd2ae('0x44')]);return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')](_0x246c29)[_0xd2ae('0x27')](handleEntityNotFound(_0x1e8137,null))[_0xd2ae('0x27')](respondWithResult(_0x1e8137,null))[_0xd2ae('0x4c')](handleError(_0x1e8137,null));};exports[_0xd2ae('0x4d')]=function(_0x57627b,_0x2d642f){return db[_0xd2ae('0x2f')][_0xd2ae('0x4d')](_0x57627b[_0xd2ae('0x4e')],{})['then'](respondWithResult(_0x2d642f,0xc9))[_0xd2ae('0x4c')](handleError(_0x2d642f,null));};exports['update']=function(_0x3e07ec,_0x354dcc){if(_0x3e07ec['body']['id']){delete _0x3e07ec[_0xd2ae('0x4e')]['id'];}return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')]({'where':{'id':_0x3e07ec[_0xd2ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x354dcc,null))[_0xd2ae('0x27')](saveUpdates(_0x3e07ec['body'],null))[_0xd2ae('0x27')](respondWithResult(_0x354dcc,null))['catch'](handleError(_0x354dcc,null));};exports[_0xd2ae('0x26')]=function(_0x45a31e,_0xf25444){return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')]({'where':{'id':_0x45a31e[_0xd2ae('0x49')]['id']}})[_0xd2ae('0x27')](handleEntityNotFound(_0xf25444,null))[_0xd2ae('0x27')](removeEntity(_0xf25444,null))[_0xd2ae('0x4c')](handleError(_0xf25444,null));}; \ No newline at end of file +var _0x44f2=['create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelApplication','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','find'];(function(_0xe2b567,_0x482232){var _0x1dbaef=function(_0x5f164c){while(--_0x5f164c){_0xe2b567['push'](_0xe2b567['shift']());}};_0x1dbaef(++_0x482232);}(_0x44f2,0x1ad));var _0x244f=function(_0x4bd1de,_0x1ba648){_0x4bd1de=_0x4bd1de-0x0;var _0x38bd31=_0x44f2[_0x4bd1de];return _0x38bd31;};'use strict';var emlformat=require(_0x244f('0x0'));var rimraf=require(_0x244f('0x1'));var zipdir=require(_0x244f('0x2'));var jsonpatch=require(_0x244f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x244f('0x4'));var Mustache=require(_0x244f('0x5'));var util=require(_0x244f('0x6'));var path=require('path');var sox=require(_0x244f('0x7'));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(_0x244f('0x8'));var crypto=require(_0x244f('0x9'));var jsforce=require(_0x244f('0xa'));var deskjs=require(_0x244f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x244f('0xc'));var Redis=require(_0x244f('0xd'));var authService=require(_0x244f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x244f('0xf'));var hardwareService=require(_0x244f('0x10'));var logger=require(_0x244f('0x11'))(_0x244f('0x12'));var utils=require(_0x244f('0x13'));var config=require(_0x244f('0x14'));var licenseUtil=require(_0x244f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1f54,_0x2d2bce){_0x2d2bce=_0x2d2bce||0xcc;return function(_0x4e46c0){if(_0x4e46c0){return _0x3b1f54[_0x244f('0x16')](_0x2d2bce);}return _0x3b1f54[_0x244f('0x17')](_0x2d2bce)[_0x244f('0x18')]();};}function respondWithResult(_0x3238b2,_0x51fa5c){_0x51fa5c=_0x51fa5c||0xc8;return function(_0x37a87f){if(_0x37a87f){return _0x3238b2[_0x244f('0x17')](_0x51fa5c)[_0x244f('0x19')](_0x37a87f);}};}function respondWithFilteredResult(_0x4da530,_0x43f710){return function(_0x3e07e6){if(_0x3e07e6){var _0x5e6a7a=typeof _0x43f710[_0x244f('0x1a')]===_0x244f('0x1b')&&typeof _0x43f710[_0x244f('0x1c')]===_0x244f('0x1b');var _0x2c51ac=_0x3e07e6[_0x244f('0x1d')];var _0x10fa24=_0x5e6a7a?0x0:_0x43f710[_0x244f('0x1a')];var _0x5750ef=_0x5e6a7a?_0x3e07e6[_0x244f('0x1d')]:_0x43f710[_0x244f('0x1a')]+_0x43f710['limit'];var _0x42eda7;if(_0x5750ef>=_0x2c51ac){_0x5750ef=_0x2c51ac;_0x42eda7=0xc8;}else{_0x42eda7=0xce;}_0x4da530[_0x244f('0x17')](_0x42eda7);return _0x4da530[_0x244f('0x1e')](_0x244f('0x1f'),_0x10fa24+'-'+_0x5750ef+'/'+_0x2c51ac)[_0x244f('0x19')](_0x3e07e6);}return null;};}function patchUpdates(_0x205b8b){return function(_0x3b6a4b){try{jsonpatch[_0x244f('0x20')](_0x3b6a4b,_0x205b8b,!![]);}catch(_0x4aed59){return BPromise[_0x244f('0x21')](_0x4aed59);}return _0x3b6a4b[_0x244f('0x22')]();};}function saveUpdates(_0x54b51c,_0x506632){return function(_0x25f481){if(_0x25f481){return _0x25f481['update'](_0x54b51c)[_0x244f('0x23')](function(_0x416052){return _0x416052;});}return null;};}function removeEntity(_0x253e69,_0x3d78f3){return function(_0x576527){if(_0x576527){return _0x576527[_0x244f('0x24')]()[_0x244f('0x23')](function(){_0x253e69[_0x244f('0x17')](0xcc)[_0x244f('0x18')]();});}};}function handleEntityNotFound(_0x3fd6bb,_0x349db1){return function(_0xaa5322){if(!_0xaa5322){_0x3fd6bb[_0x244f('0x16')](0x194);}return _0xaa5322;};}function handleError(_0x59d004,_0x2c8805){_0x2c8805=_0x2c8805||0x1f4;return function(_0x4672c0){logger[_0x244f('0x25')](_0x4672c0[_0x244f('0x26')]);if(_0x4672c0[_0x244f('0x27')]){delete _0x4672c0[_0x244f('0x27')];}_0x59d004[_0x244f('0x17')](_0x2c8805)[_0x244f('0x28')](_0x4672c0);};}exports[_0x244f('0x29')]=function(_0xc445d7,_0x5cfa51){var _0x23f2f8={},_0x1c60f1={},_0x51bfbc={'count':0x0,'rows':[]};var _0x6b4b50=_['map'](db[_0x244f('0x2a')]['rawAttributes'],function(_0x1a5ab6){return{'name':_0x1a5ab6[_0x244f('0x2b')],'type':_0x1a5ab6[_0x244f('0x2c')][_0x244f('0x2d')]};});_0x1c60f1['model']=_['map'](_0x6b4b50,_0x244f('0x27'));_0x1c60f1[_0x244f('0x2e')]=_['keys'](_0xc445d7[_0x244f('0x2e')]);_0x1c60f1[_0x244f('0x2f')]=_[_0x244f('0x30')](_0x1c60f1['model'],_0x1c60f1[_0x244f('0x2e')]);_0x23f2f8[_0x244f('0x31')]=_[_0x244f('0x30')](_0x1c60f1[_0x244f('0x32')],qs[_0x244f('0x33')](_0xc445d7[_0x244f('0x2e')][_0x244f('0x33')]));_0x23f2f8[_0x244f('0x31')]=_0x23f2f8[_0x244f('0x31')][_0x244f('0x34')]?_0x23f2f8[_0x244f('0x31')]:_0x1c60f1[_0x244f('0x32')];if(!_0xc445d7[_0x244f('0x2e')][_0x244f('0x35')]('nolimit')){_0x23f2f8[_0x244f('0x1c')]=qs[_0x244f('0x1c')](_0xc445d7['query']['limit']);_0x23f2f8[_0x244f('0x1a')]=qs[_0x244f('0x1a')](_0xc445d7[_0x244f('0x2e')][_0x244f('0x1a')]);}_0x23f2f8['order']=qs[_0x244f('0x36')](_0xc445d7[_0x244f('0x2e')][_0x244f('0x36')]);_0x23f2f8[_0x244f('0x37')]=qs[_0x244f('0x2f')](_[_0x244f('0x38')](_0xc445d7[_0x244f('0x2e')],_0x1c60f1['filters']),_0x6b4b50);if(_0xc445d7['query'][_0x244f('0x39')]){_0x23f2f8[_0x244f('0x37')]=_[_0x244f('0x3a')](_0x23f2f8['where'],{'$or':_['map'](_0x6b4b50,function(_0x202a22){if(_0x202a22[_0x244f('0x2c')]!=='VIRTUAL'){var _0x32b9ed={};_0x32b9ed[_0x202a22['name']]={'$like':'%'+_0xc445d7[_0x244f('0x2e')][_0x244f('0x39')]+'%'};return _0x32b9ed;}})});}_0x23f2f8=_[_0x244f('0x3a')]({},_0x23f2f8,_0xc445d7[_0x244f('0x3b')]);var _0x176141={'where':_0x23f2f8[_0x244f('0x37')]};return db[_0x244f('0x2a')][_0x244f('0x1d')](_0x176141)['then'](function(_0x4d4fc8){_0x51bfbc[_0x244f('0x1d')]=_0x4d4fc8;if(_0xc445d7['query'][_0x244f('0x3c')]){_0x23f2f8['include']=[{'all':!![]}];}return db[_0x244f('0x2a')][_0x244f('0x3d')](_0x23f2f8);})[_0x244f('0x23')](function(_0x8400cb){_0x51bfbc[_0x244f('0x3e')]=_0x8400cb;return _0x51bfbc;})[_0x244f('0x23')](respondWithFilteredResult(_0x5cfa51,_0x23f2f8))[_0x244f('0x3f')](handleError(_0x5cfa51,null));};exports['show']=function(_0x2bbc40,_0x3bc039){var _0x50a709={'raw':!![],'where':{'id':_0x2bbc40[_0x244f('0x40')]['id']}},_0x57b740={};_0x57b740[_0x244f('0x32')]=_[_0x244f('0x41')](db[_0x244f('0x2a')][_0x244f('0x42')]);_0x57b740['query']=_[_0x244f('0x41')](_0x2bbc40[_0x244f('0x2e')]);_0x57b740['filters']=_[_0x244f('0x30')](_0x57b740[_0x244f('0x32')],_0x57b740[_0x244f('0x2e')]);_0x50a709[_0x244f('0x31')]=_[_0x244f('0x30')](_0x57b740[_0x244f('0x32')],qs[_0x244f('0x33')](_0x2bbc40[_0x244f('0x2e')][_0x244f('0x33')]));_0x50a709[_0x244f('0x31')]=_0x50a709['attributes']['length']?_0x50a709['attributes']:_0x57b740[_0x244f('0x32')];if(_0x2bbc40[_0x244f('0x2e')][_0x244f('0x3c')]){_0x50a709['include']=[{'all':!![]}];}_0x50a709=_['merge']({},_0x50a709,_0x2bbc40['options']);return db[_0x244f('0x2a')][_0x244f('0x43')](_0x50a709)[_0x244f('0x23')](handleEntityNotFound(_0x3bc039,null))[_0x244f('0x23')](respondWithResult(_0x3bc039,null))[_0x244f('0x3f')](handleError(_0x3bc039,null));};exports[_0x244f('0x44')]=function(_0x39a2f6,_0x3042f4){return db['OpenchannelApplication'][_0x244f('0x44')](_0x39a2f6['body'],{})[_0x244f('0x23')](respondWithResult(_0x3042f4,0xc9))[_0x244f('0x3f')](handleError(_0x3042f4,null));};exports[_0x244f('0x45')]=function(_0x49dd65,_0x574d74){if(_0x49dd65[_0x244f('0x46')]['id']){delete _0x49dd65['body']['id'];}return db[_0x244f('0x2a')][_0x244f('0x43')]({'where':{'id':_0x49dd65[_0x244f('0x40')]['id']}})[_0x244f('0x23')](handleEntityNotFound(_0x574d74,null))['then'](saveUpdates(_0x49dd65[_0x244f('0x46')],null))[_0x244f('0x23')](respondWithResult(_0x574d74,null))[_0x244f('0x3f')](handleError(_0x574d74,null));};exports[_0x244f('0x24')]=function(_0x2c3c75,_0x2e3513){return db[_0x244f('0x2a')]['find']({'where':{'id':_0x2c3c75[_0x244f('0x40')]['id']}})['then'](handleEntityNotFound(_0x2e3513,null))[_0x244f('0x23')](removeEntity(_0x2e3513,null))[_0x244f('0x3f')](handleError(_0x2e3513,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d9152fd..8a34863 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 _0x37c3=['bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x37c3,0x171));var _0x337c=function(_0x2f34d2,_0x236793){_0x2f34d2=_0x2f34d2-0x0;var _0x25e904=_0x37c3[_0x2f34d2];return _0x25e904;};'use strict';var _=require(_0x337c('0x0'));var util=require(_0x337c('0x1'));var logger=require('../../config/logger')(_0x337c('0x2'));var moment=require('moment');var BPromise=require(_0x337c('0x3'));var rp=require(_0x337c('0x4'));var fs=require('fs');var path=require(_0x337c('0x5'));var rimraf=require('rimraf');var config=require(_0x337c('0x6'));var attributes=require(_0x337c('0x7'));module[_0x337c('0x8')]=function(_0x258005,_0x287f88){return _0x258005[_0x337c('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x337c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x337c('0xb')});}; \ No newline at end of file +var _0x175c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x335c97,_0x5c00b8){var _0x10633b=function(_0x317c88){while(--_0x317c88){_0x335c97['push'](_0x335c97['shift']());}};_0x10633b(++_0x5c00b8);}(_0x175c,0x10e));var _0xc175=function(_0x5e8ae1,_0x5bb0fb){_0x5e8ae1=_0x5e8ae1-0x0;var _0x25ca9e=_0x175c[_0x5e8ae1];return _0x25ca9e;};'use strict';var _=require(_0xc175('0x0'));var util=require(_0xc175('0x1'));var logger=require('../../config/logger')(_0xc175('0x2'));var moment=require(_0xc175('0x3'));var BPromise=require(_0xc175('0x4'));var rp=require(_0xc175('0x5'));var fs=require('fs');var path=require(_0xc175('0x6'));var rimraf=require(_0xc175('0x7'));var config=require(_0xc175('0x8'));var attributes=require(_0xc175('0x9'));module['exports']=function(_0x322788,_0x5ee744){return _0x322788[_0xc175('0xa')](_0xc175('0xb'),attributes,{'tableName':_0xc175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc175('0xd'),'collate':_0xc175('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cb01ddb..38ed53d 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 _0xfd4d=['options','attributes','UpdateOpenchannelApplication','stringify','util','moment','../../mysqldb','../../config/utils','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelApplication'];(function(_0x5ad4be,_0x357097){var _0x156465=function(_0x4935ce){while(--_0x4935ce){_0x5ad4be['push'](_0x5ad4be['shift']());}};_0x156465(++_0x357097);}(_0xfd4d,0x1e7));var _0xdfd4=function(_0x198cf7,_0x2e5f91){_0x198cf7=_0x198cf7-0x0;var _0x2e621d=_0xfd4d[_0x198cf7];return _0x2e621d;};'use strict';var _=require('lodash');var util=require(_0xdfd4('0x0'));var moment=require(_0xdfd4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfd4('0x2'))['db'];var utils=require(_0xdfd4('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdfd4('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3366d3,_0x5af505,_0x439a8a){return new BPromise(function(_0x527424,_0x1b53c7){return client['request'](_0x3366d3,_0x439a8a)[_0xdfd4('0x5')](function(_0x26c5c4){logger[_0xdfd4('0x6')](_0xdfd4('0x7'),_0x5af505,_0xdfd4('0x8'));logger[_0xdfd4('0x9')](_0xdfd4('0xa'),_0x5af505,_0xdfd4('0x8'),JSON['stringify'](_0x26c5c4));if(_0x26c5c4[_0xdfd4('0xb')]){if(_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xc')]===0x1f4){logger[_0xdfd4('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x5af505,_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xd')]);return _0x1b53c7(_0x26c5c4['error']['message']);}logger[_0xdfd4('0xb')](_0xdfd4('0x7'),_0x5af505,_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xd')]);return _0x527424(_0x26c5c4['error'][_0xdfd4('0xd')]);}else{logger['info'](_0xdfd4('0x7'),_0x5af505,_0xdfd4('0x8'));_0x527424(_0x26c5c4[_0xdfd4('0xe')][_0xdfd4('0xd')]);}})[_0xdfd4('0xf')](function(_0x313513){logger['error'](_0xdfd4('0x7'),_0x5af505,_0x313513);_0x1b53c7(_0x313513);});});}exports['UpdateOpenchannelApplication']=function(_0x11e595){var _0x3fbaa2=this;return new Promise(function(_0x4cd221,_0x3dd82d){return db[_0xdfd4('0x10')]['update'](_0x11e595['body'],{'raw':_0x11e595[_0xdfd4('0x11')]?_0x11e595['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e595['options']?_0x11e595['options']['where']||null:null,'attributes':_0x11e595[_0xdfd4('0x11')]?_0x11e595[_0xdfd4('0x11')][_0xdfd4('0x12')]||null:null,'limit':_0x11e595['options']?_0x11e595[_0xdfd4('0x11')]['limit']||null:null})[_0xdfd4('0x5')](function(_0x942aa2){logger['info'](_0xdfd4('0x13'),_0x11e595);logger[_0xdfd4('0x9')](_0xdfd4('0x13'),_0x11e595,JSON[_0xdfd4('0x14')](_0x942aa2));_0x4cd221(_0x942aa2);})[_0xdfd4('0xf')](function(_0x5b5df7){logger['error'](_0xdfd4('0x13'),_0x5b5df7['message'],_0x11e595);_0x3dd82d(_0x3fbaa2[_0xdfd4('0xb')](0x1f4,_0x5b5df7['message']));});});}; \ No newline at end of file +var _0xcf44=['jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a667f,_0x110028){var _0x3756ff=function(_0x3d58e1){while(--_0x3d58e1){_0x2a667f['push'](_0x2a667f['shift']());}};_0x3756ff(++_0x110028);}(_0xcf44,0x17d));var _0x4cf4=function(_0x5371b7,_0x556980){_0x5371b7=_0x5371b7-0x0;var _0x14e3a5=_0xcf44[_0x5371b7];return _0x14e3a5;};'use strict';var _=require(_0x4cf4('0x0'));var util=require(_0x4cf4('0x1'));var moment=require('moment');var BPromise=require(_0x4cf4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cf4('0x3'));var db=require(_0x4cf4('0x4'))['db'];var utils=require(_0x4cf4('0x5'));var logger=require(_0x4cf4('0x6'))(_0x4cf4('0x7'));var config=require(_0x4cf4('0x8'));var jayson=require(_0x4cf4('0x9'));var client=jayson[_0x4cf4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e027,_0xf056f5,_0x4d5d1d){return new BPromise(function(_0x222358,_0x4de273){return client[_0x4cf4('0xb')](_0x33e027,_0x4d5d1d)[_0x4cf4('0xc')](function(_0xe0a97c){logger[_0x4cf4('0xd')](_0x4cf4('0xe'),_0xf056f5,'request\x20sent');logger[_0x4cf4('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xf056f5,_0x4cf4('0x10'),JSON[_0x4cf4('0x11')](_0xe0a97c));if(_0xe0a97c[_0x4cf4('0x12')]){if(_0xe0a97c[_0x4cf4('0x12')][_0x4cf4('0x13')]===0x1f4){logger[_0x4cf4('0x12')](_0x4cf4('0xe'),_0xf056f5,_0xe0a97c['error'][_0x4cf4('0x14')]);return _0x4de273(_0xe0a97c[_0x4cf4('0x12')]['message']);}logger[_0x4cf4('0x12')](_0x4cf4('0xe'),_0xf056f5,_0xe0a97c[_0x4cf4('0x12')]['message']);return _0x222358(_0xe0a97c[_0x4cf4('0x12')][_0x4cf4('0x14')]);}else{logger[_0x4cf4('0xd')](_0x4cf4('0xe'),_0xf056f5,_0x4cf4('0x10'));_0x222358(_0xe0a97c[_0x4cf4('0x15')][_0x4cf4('0x14')]);}})[_0x4cf4('0x16')](function(_0x46a600){logger['error'](_0x4cf4('0xe'),_0xf056f5,_0x46a600);_0x4de273(_0x46a600);});});}exports[_0x4cf4('0x17')]=function(_0x55e140){var _0x3e7a3b=this;return new Promise(function(_0x12f6a5,_0x74bc80){return db[_0x4cf4('0x18')][_0x4cf4('0x19')](_0x55e140['body'],{'raw':_0x55e140[_0x4cf4('0x1a')]?_0x55e140[_0x4cf4('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e140[_0x4cf4('0x1a')]?_0x55e140['options'][_0x4cf4('0x1b')]||null:null,'attributes':_0x55e140[_0x4cf4('0x1a')]?_0x55e140['options'][_0x4cf4('0x1c')]||null:null,'limit':_0x55e140[_0x4cf4('0x1a')]?_0x55e140[_0x4cf4('0x1a')][_0x4cf4('0x1d')]||null:null})[_0x4cf4('0xc')](function(_0x3633d8){logger['info'](_0x4cf4('0x17'),_0x55e140);logger[_0x4cf4('0xf')](_0x4cf4('0x17'),_0x55e140,JSON[_0x4cf4('0x11')](_0x3633d8));_0x12f6a5(_0x3633d8);})[_0x4cf4('0x16')](function(_0x5cbfd4){logger[_0x4cf4('0x12')](_0x4cf4('0x17'),_0x5cbfd4['message'],_0x55e140);_0x74bc80(_0x3e7a3b[_0x4cf4('0x12')](0x1f4,_0x5cbfd4[_0x4cf4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 80a4b03..7096d30 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 _0xf615=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:destroy','destroy'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xf615,0x107));var _0x5f61=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0xf615[_0x113e32];return _0x4ff939;};'use strict';var multer=require(_0x5f61('0x0'));var util=require(_0x5f61('0x1'));var path=require(_0x5f61('0x2'));var timeout=require(_0x5f61('0x3'));var express=require('express');var router=express[_0x5f61('0x4')]();var fs_extra=require(_0x5f61('0x5'));var auth=require(_0x5f61('0x6'));var interaction=require(_0x5f61('0x7'));var config=require(_0x5f61('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x5f61('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f61('0xa')]);router[_0x5f61('0x9')]('/describe',auth[_0x5f61('0xb')](),controller[_0x5f61('0xc')]);router[_0x5f61('0x9')](_0x5f61('0xd'),auth[_0x5f61('0xb')](),controller['show']);router[_0x5f61('0x9')]('/:id/messages',auth[_0x5f61('0xb')](),controller['getMessages']);router[_0x5f61('0x9')](_0x5f61('0xe'),auth[_0x5f61('0xb')](),controller[_0x5f61('0xf')]);router[_0x5f61('0x10')]('/',auth[_0x5f61('0xb')](),controller[_0x5f61('0x11')]);router[_0x5f61('0x10')](_0x5f61('0x12'),auth['isAuthenticated'](),controller[_0x5f61('0x13')]);router[_0x5f61('0x10')](_0x5f61('0x14'),auth[_0x5f61('0xb')](),interaction[_0x5f61('0x15')](_0x5f61('0x16'),_0x5f61('0x17')),controller[_0x5f61('0x18')]);router['put'](_0x5f61('0xd'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller['update']);router['delete'](_0x5f61('0xd'),auth[_0x5f61('0xb')](),interaction['tracked']('openchannel',_0x5f61('0x19')),controller[_0x5f61('0x1a')]);router['delete'](_0x5f61('0x14'),auth[_0x5f61('0xb')](),controller[_0x5f61('0x1b')]);module[_0x5f61('0x1c')]=router; \ No newline at end of file +var _0x1ecc=['openchannel','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked'];(function(_0x275fbb,_0x52bdd9){var _0x1a1699=function(_0x2ded23){while(--_0x2ded23){_0x275fbb['push'](_0x275fbb['shift']());}};_0x1a1699(++_0x52bdd9);}(_0x1ecc,0xc5));var _0xc1ec=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x1ecc[_0x1c4409];return _0x356d8f;};'use strict';var multer=require(_0xc1ec('0x0'));var util=require(_0xc1ec('0x1'));var path=require(_0xc1ec('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1ec('0x3')]();var fs_extra=require(_0xc1ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc1ec('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xc1ec('0x6')]('/',auth[_0xc1ec('0x7')](),controller['index']);router[_0xc1ec('0x6')](_0xc1ec('0x8'),auth['isAuthenticated'](),controller[_0xc1ec('0x9')]);router['get'](_0xc1ec('0xa'),auth[_0xc1ec('0x7')](),controller[_0xc1ec('0xb')]);router[_0xc1ec('0x6')](_0xc1ec('0xc'),auth[_0xc1ec('0x7')](),controller[_0xc1ec('0xd')]);router[_0xc1ec('0x6')](_0xc1ec('0xe'),auth[_0xc1ec('0x7')](),controller[_0xc1ec('0xf')]);router[_0xc1ec('0x10')]('/',auth[_0xc1ec('0x7')](),controller[_0xc1ec('0x11')]);router['post'](_0xc1ec('0xc'),auth[_0xc1ec('0x7')](),controller['addMessage']);router[_0xc1ec('0x10')]('/:id/tags',auth[_0xc1ec('0x7')](),interaction[_0xc1ec('0x12')](_0xc1ec('0x13'),'openchannelinteraction:addtags'),controller['addTags']);router['put'](_0xc1ec('0xa'),auth['isAuthenticated'](),interaction[_0xc1ec('0x12')](_0xc1ec('0x13'),_0xc1ec('0x14')),controller['update']);router['delete'](_0xc1ec('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0xc1ec('0x13'),_0xc1ec('0x15')),controller[_0xc1ec('0x16')]);router[_0xc1ec('0x17')](_0xc1ec('0x18'),auth[_0xc1ec('0x7')](),controller[_0xc1ec('0x19')]);module[_0xc1ec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ef3f6c0..d2c61db 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 _0x32d5=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x32d5,0x1aa));var _0x532d=function(_0x540a1a,_0x32fde4){_0x540a1a=_0x540a1a-0x0;var _0xc01a5a=_0x32d5[_0x540a1a];return _0xc01a5a;};'use strict';var Sequelize=require(_0x532d('0x0'));module[_0x532d('0x1')]={'closed':{'type':Sequelize[_0x532d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x532d('0x3')]},'disposition':{'type':Sequelize[_0x532d('0x4')]},'secondDisposition':{'type':Sequelize[_0x532d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x532d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x532d('0x3')]},'threadId':{'type':Sequelize[_0x532d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x532d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x532d('0x5')]('in',_0x532d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x532d('0x5')]('in',_0x532d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x532d('0x7')]}}; \ No newline at end of file +var _0xd276=['STRING','out','ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x1e0a66,_0x4c945c){var _0x1f9314=function(_0x2f9e37){while(--_0x2f9e37){_0x1e0a66['push'](_0x1e0a66['shift']());}};_0x1f9314(++_0x4c945c);}(_0xd276,0xfc));var _0x6d27=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xd276[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0x6d27('0x0'));module[_0x6d27('0x1')]={'closed':{'type':Sequelize[_0x6d27('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d27('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d27('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6d27('0x4')]},'note':{'type':Sequelize[_0x6d27('0x4')]},'read1stAt':{'type':Sequelize[_0x6d27('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x6d27('0x4')]},'lastMsgAt':{'type':Sequelize[_0x6d27('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d27('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6d27('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x6d27('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d27('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7ab2a90..d4d076e 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 _0x80ff=['get','mkdirSync','fullname','N.A.','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','basename','out','System','renderFile','views','transcript-','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','findAll','openchannel','show','query','type','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','includeAll','include','options','catch','create','body','find','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','ids','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner'];(function(_0x317061,_0x75aeae){var _0x57b316=function(_0x3fb33f){while(--_0x3fb33f){_0x317061['push'](_0x317061['shift']());}};_0x57b316(++_0x75aeae);}(_0x80ff,0x93));var _0xf80f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x80ff[_0x2bf141];return _0x48277b;};'use strict';var rimraf=require(_0xf80f('0x0'));var zipdir=require(_0xf80f('0x1'));var moment=require(_0xf80f('0x2'));var util=require('util');var path=require(_0xf80f('0x3'));var ejs=require(_0xf80f('0x4'));var fs=require('fs');var _=require(_0xf80f('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf80f('0x6'));var pdf=require(_0xf80f('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xf80f('0x8'));var db=require(_0xf80f('0x9'))['db'];config[_0xf80f('0xa')]=_[_0xf80f('0xb')](config[_0xf80f('0xa')],{'host':_0xf80f('0xc'),'port':0x18eb});var socket=require(_0xf80f('0xd'))(new Redis(config[_0xf80f('0xa')]));require(_0xf80f('0xe'))['register'](socket);function respondWithStatusCode(_0x14fbb9,_0x4d60dc){_0x4d60dc=_0x4d60dc||0xcc;return function(_0x14283f){if(_0x14283f){return _0x14fbb9[_0xf80f('0xf')](_0x4d60dc);}return _0x14fbb9[_0xf80f('0x10')](_0x4d60dc)[_0xf80f('0x11')]();};}function respondWithResult(_0x1f656f,_0x4c3e6d){_0x4c3e6d=_0x4c3e6d||0xc8;return function(_0x73137f){if(_0x73137f){return _0x1f656f[_0xf80f('0x10')](_0x4c3e6d)[_0xf80f('0x12')](_0x73137f);}};}function respondWithFilteredResult(_0x5ae65e,_0x476135){return function(_0x569ed9){if(_0x569ed9){var _0x16272f=typeof _0x476135['offset']===_0xf80f('0x13')&&typeof _0x476135['limit']===_0xf80f('0x13');var _0x354d51=_0x569ed9['count'];var _0x29980b=_0x16272f?0x0:_0x476135['offset'];var _0x51ffb7=_0x16272f?_0x569ed9[_0xf80f('0x14')]:_0x476135['offset']+_0x476135[_0xf80f('0x15')];var _0x3611e5;if(_0x51ffb7>=_0x354d51){_0x51ffb7=_0x354d51;_0x3611e5=0xc8;}else{_0x3611e5=0xce;}_0x5ae65e[_0xf80f('0x10')](_0x3611e5);return _0x5ae65e[_0xf80f('0x16')](_0xf80f('0x17'),_0x29980b+'-'+_0x51ffb7+'/'+_0x354d51)[_0xf80f('0x12')](_0x569ed9);}return null;};}function saveUpdates(_0x5891c1){return function(_0x14ab13){if(_0x14ab13){return _0x14ab13[_0xf80f('0x18')](_0x5891c1)[_0xf80f('0x19')](function(_0xcfc844){return _0xcfc844;});}return null;};}function removeEntity(_0x598721){return function(_0x100f6b){if(_0x100f6b){return _0x100f6b[_0xf80f('0x1a')]()[_0xf80f('0x19')](function(){_0x598721[_0xf80f('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32be2e){return function(_0x3a02d3){if(!_0x3a02d3){_0x32be2e[_0xf80f('0xf')](0x194);}return _0x3a02d3;};}function handleError(_0xe19387,_0x374bc8){_0x374bc8=_0x374bc8||0x1f4;return function(_0x3234d2){logger['error'](_0x3234d2[_0xf80f('0x1b')]);if(_0x3234d2[_0xf80f('0x1c')]){delete _0x3234d2[_0xf80f('0x1c')];}_0xe19387[_0xf80f('0x10')](_0x374bc8)[_0xf80f('0x1d')](_0x3234d2);};}exports[_0xf80f('0x1e')]=function(_0x56d8db,_0x3bd009){var _0x15ffea={};var _0x31e343=_['map'](db['OpenchannelInteraction'][_0xf80f('0x1f')],function(_0x1080e8){return{'name':_0x1080e8[_0xf80f('0x20')],'type':_0x1080e8['type'][_0xf80f('0x21')]};});_0x15ffea=qs['getOptions'](_0x31e343,_0x56d8db);return interaction[_0xf80f('0x22')](_0xf80f('0x23'),_0x56d8db['query'],_0x56d8db['user'],_0x15ffea,_0x31e343)['then'](respondWithFilteredResult(_0x3bd009,_0x15ffea))['catch'](handleError(_0x3bd009,null));};exports[_0xf80f('0x24')]=function(_0x25e926,_0x4ead2f){var _0x2cb377={};if(_0x25e926[_0xf80f('0x25')][_0xf80f('0x26')]&&_0x25e926['query'][_0xf80f('0x26')]===_0xf80f('0x27')){_0x2cb377[_0xf80f('0x27')]=_0x25e926[_0xf80f('0x28')]['id'];}else{_0x2cb377['id']=_0x25e926['params']['id'];}var _0x211906={'raw':![],'where':_0x2cb377},_0x57f4f2={};_0x57f4f2[_0xf80f('0x29')]=_[_0xf80f('0x2a')](db[_0xf80f('0x2b')][_0xf80f('0x1f')]);_0x57f4f2[_0xf80f('0x25')]=_[_0xf80f('0x2a')](_0x25e926['query']);_0x57f4f2['filters']=_[_0xf80f('0x2c')](_0x57f4f2['model'],_0x57f4f2[_0xf80f('0x25')]);_0x211906[_0xf80f('0x2d')]=_['intersection'](_0x57f4f2[_0xf80f('0x29')],qs[_0xf80f('0x2e')](_0x25e926[_0xf80f('0x25')][_0xf80f('0x2e')]));_0x211906['attributes']=_0x211906[_0xf80f('0x2d')]['length']?_0x211906['attributes']:_0x57f4f2[_0xf80f('0x29')];if(_0x25e926[_0xf80f('0x25')][_0xf80f('0x2f')]){_0x211906[_0xf80f('0x30')]=[{'all':!![]}];}_0x211906=_['merge']({},_0x211906,_0x25e926[_0xf80f('0x31')]);return db['OpenchannelInteraction']['find'](_0x211906)[_0xf80f('0x19')](handleEntityNotFound(_0x4ead2f,null))[_0xf80f('0x19')](respondWithResult(_0x4ead2f,null))[_0xf80f('0x32')](handleError(_0x4ead2f,null));};exports[_0xf80f('0x33')]=function(_0x46cb00,_0x83c0c){return db['OpenchannelInteraction'][_0xf80f('0x33')](_0x46cb00[_0xf80f('0x34')],{})['then'](respondWithResult(_0x83c0c,0xc9))[_0xf80f('0x32')](handleError(_0x83c0c,null));};exports['update']=function(_0x3aabb7,_0x3bef73){if(_0x3aabb7[_0xf80f('0x34')]['id']){delete _0x3aabb7[_0xf80f('0x34')]['id'];}return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0x3aabb7['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x3bef73,null))[_0xf80f('0x19')](saveUpdates(_0x3aabb7[_0xf80f('0x34')],null))['then'](respondWithResult(_0x3bef73,null))['catch'](handleError(_0x3bef73,null));};exports[_0xf80f('0x1a')]=function(_0xe3b8bf,_0x3757d2){return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0xe3b8bf[_0xf80f('0x28')]['id']}})['then'](handleEntityNotFound(_0x3757d2,null))[_0xf80f('0x19')](removeEntity(_0x3757d2,null))['catch'](handleError(_0x3757d2,null));};exports[_0xf80f('0x36')]=function(_0x9aa761,_0x121f0a){return db[_0xf80f('0x2b')][_0xf80f('0x36')]()[_0xf80f('0x19')](respondWithResult(_0x121f0a,null))[_0xf80f('0x32')](handleError(_0x121f0a,null));};exports[_0xf80f('0x37')]=function(_0x2afd79,_0x2d5f47){return db[_0xf80f('0x38')][_0xf80f('0x35')]({'where':{'id':_0x2afd79['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x2d5f47,null))[_0xf80f('0x19')](function(_0x497864){if(_0x497864){return _0x497864[_0xf80f('0x37')](_0x2afd79[_0xf80f('0x34')]['ids'],_[_0xf80f('0x39')](_0x2afd79[_0xf80f('0x34')],['ids','id'])||{});}})[_0xf80f('0x19')](respondWithResult(_0x2d5f47,null))[_0xf80f('0x32')](handleError(_0x2d5f47,null));};exports[_0xf80f('0x3a')]=function(_0x1c6209,_0xa9931b){var _0x17b484={'raw':![],'where':{}};var _0x24f934={};var _0x53314d={'count':0x0,'rows':[]};return db[_0xf80f('0x2b')][_0xf80f('0x3b')]({'where':{'id':_0x1c6209[_0xf80f('0x28')]['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0xa9931b,null))[_0xf80f('0x19')](function(_0x2d2802){if(_0x2d2802){_0x24f934[_0xf80f('0x29')]=_[_0xf80f('0x2a')](db[_0xf80f('0x38')][_0xf80f('0x1f')]);_0x24f934[_0xf80f('0x25')]=_[_0xf80f('0x2a')](_0x1c6209[_0xf80f('0x25')]);_0x24f934[_0xf80f('0x3c')]=_[_0xf80f('0x2c')](_0x24f934[_0xf80f('0x29')],_0x24f934[_0xf80f('0x25')]);_0x17b484[_0xf80f('0x2d')]=_['intersection'](_0x24f934[_0xf80f('0x29')],qs[_0xf80f('0x2e')](_0x1c6209[_0xf80f('0x25')]['fields']));_0x17b484[_0xf80f('0x2d')]=_0x17b484[_0xf80f('0x2d')][_0xf80f('0x3d')]?_0x17b484[_0xf80f('0x2d')]:_0x24f934['model'];if(!_0x1c6209[_0xf80f('0x25')][_0xf80f('0x3e')](_0xf80f('0x3f'))){_0x17b484[_0xf80f('0x15')]=qs[_0xf80f('0x15')](_0x1c6209[_0xf80f('0x25')][_0xf80f('0x15')]);_0x17b484['offset']=qs[_0xf80f('0x40')](_0x1c6209['query'][_0xf80f('0x40')]);}_0x17b484[_0xf80f('0x41')]=qs[_0xf80f('0x42')](_0x1c6209['query'][_0xf80f('0x42')]);_0x17b484[_0xf80f('0x43')]=qs[_0xf80f('0x3c')](_[_0xf80f('0x44')](_0x1c6209[_0xf80f('0x25')],_0x24f934[_0xf80f('0x3c')]));_0x17b484['where'][_0xf80f('0x45')]=_0x2d2802['id'];if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x46')]){_0x17b484[_0xf80f('0x43')]=_[_0xf80f('0x47')](_0x17b484[_0xf80f('0x43')],{'$or':_[_0xf80f('0x48')](_0x17b484[_0xf80f('0x2d')],function(_0x50cf04){var _0x413297={};_0x413297[_0x50cf04]={'$like':'%'+_0x1c6209[_0xf80f('0x25')][_0xf80f('0x46')]+'%'};return _0x413297;})});}if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x49')]){var _0x3ff121=_0x1c6209[_0xf80f('0x25')][_0xf80f('0x49')][_0xf80f('0x4a')](',');var _0x5973a3={};_0x5973a3[_0x3ff121[0x0]]={'$gte':moment(_0x3ff121[0x1])[_0xf80f('0x4b')](_0xf80f('0x4c'))};_0x17b484[_0xf80f('0x43')]=_['merge'](_0x17b484[_0xf80f('0x43')],_0x5973a3);}_0x17b484=_['merge']({},_0x17b484,_0x1c6209[_0xf80f('0x31')]);return db[_0xf80f('0x38')][_0xf80f('0x14')]({'where':_0x17b484[_0xf80f('0x43')]})['then'](function(_0x514e36){_0x53314d[_0xf80f('0x14')]=_0x514e36;if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x2f')]){_0x17b484[_0xf80f('0x30')]=[{'all':!![]}];}return db[_0xf80f('0x38')][_0xf80f('0x22')](_0x17b484);})[_0xf80f('0x19')](function(_0x11846d){_0x53314d[_0xf80f('0x4d')]=_0x11846d;return _0x53314d;});}})[_0xf80f('0x19')](respondWithFilteredResult(_0xa9931b,_0x17b484))[_0xf80f('0x32')](handleError(_0xa9931b,null));};exports[_0xf80f('0x4e')]=function(_0x35f619,_0x2c11dd){return db[_0xf80f('0x2b')]['find']({'where':{'id':_0x35f619['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x2c11dd,null))['then'](function(_0x4335fe){if(_0x4335fe){return _0x4335fe[_0xf80f('0x4f')](_0x35f619[_0xf80f('0x34')]['ids'],_[_0xf80f('0x39')](_0x35f619['body'],[_0xf80f('0x50'),'id'])||{})[_0xf80f('0x51')](function(){return db['Tag'][_0xf80f('0x22')]({'attributes':['id',_0xf80f('0x1c'),_0xf80f('0x52')],'where':{'id':_0x35f619[_0xf80f('0x34')][_0xf80f('0x50')]}});})[_0xf80f('0x19')](function(_0x8767b7){socket[_0xf80f('0x53')](_0xf80f('0x54'),{'id':Number(_0x35f619[_0xf80f('0x28')]['id']),'tags':_0x8767b7||[]});return{'id':Number(_0x35f619[_0xf80f('0x28')]['id']),'tags':_0x8767b7||[]};});}})[_0xf80f('0x19')](respondWithResult(_0x2c11dd,null))[_0xf80f('0x32')](handleError(_0x2c11dd,null));};exports[_0xf80f('0x55')]=function(_0x4940eb,_0x4b8a9a){return db['OpenchannelInteraction'][_0xf80f('0x35')]({'where':{'id':_0x4940eb['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x4b8a9a,null))['then'](function(_0x8be725){if(_0x8be725){return _0x8be725['removeTags'](_0x4940eb['query']['ids']);}})[_0xf80f('0x19')](respondWithStatusCode(_0x4b8a9a,null))['catch'](handleError(_0x4b8a9a,null));};exports[_0xf80f('0x56')]=function(_0x7de9,_0x25f76a){var _0x4f7ae8=moment()[_0xf80f('0x57')]()[_0xf80f('0x58')]();var _0x5de6a4=path['join'](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x5b'),'tmp');var _0x30af31=path[_0xf80f('0x5c')](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x5b'),_0xf80f('0x5d'));var _0x27276f=path[_0xf80f('0x5c')](_0x5de6a4,_0x4f7ae8);var _0x186f7f=util[_0xf80f('0x4b')](_0xf80f('0x5e'),_0x7de9[_0xf80f('0x28')]['id'],_0x4f7ae8);var _0x2d5bb7=path[_0xf80f('0x5c')](_0x5de6a4,_0x186f7f);var _0x16fc3d=[];_0x16fc3d['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x16fc3d[_0xf80f('0x5f')]({'model':db[_0xf80f('0x60')],'as':_0xf80f('0x61'),'attributes':['id',_0xf80f('0x62'),_0xf80f('0x63')],'raw':!![]});if(_0x7de9[_0xf80f('0x25')][_0xf80f('0x5d')]){_0x16fc3d['push']({'model':db[_0xf80f('0x64')],'as':'Attachment','raw':!![]});}var _0x36ec34=[{'model':db[_0xf80f('0x38')],'as':_0xf80f('0x65'),'attributes':['id',_0xf80f('0x34'),_0xf80f('0x66'),_0xf80f('0x67'),_0xf80f('0x68'),_0xf80f('0x69')],'include':_0x16fc3d}];_0x36ec34[_0xf80f('0x5f')]({'model':db[_0xf80f('0x6a')],'as':_0xf80f('0x6b'),'attributes':['id',_0xf80f('0x1c')]});_0x36ec34[_0xf80f('0x5f')]({'model':db['User'],'as':_0xf80f('0x6c'),'attributes':['id','fullname']});return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0x7de9['params']['id']},'include':_0x36ec34})[_0xf80f('0x19')](handleEntityNotFound(_0x25f76a,null))[_0xf80f('0x19')](function(_0x1d7af7){if(_0x1d7af7){var _0x5a6288=_0x1d7af7[_0xf80f('0x6d')]({'plain':!![]});fs[_0xf80f('0x6e')](_0x27276f);var _0x46d6d2={'channel':'Openchannel','account':_0x5a6288[_0xf80f('0x6b')]['name'],'agent':_0x5a6288[_0xf80f('0x6c')]?_0x5a6288[_0xf80f('0x6c')][_0xf80f('0x6f')]:_0xf80f('0x70'),'createdAt':moment(_0x5a6288['createdAt'])[_0xf80f('0x4b')](_0xf80f('0x4c'))[_0xf80f('0x58')](),'closedAt':_0x5a6288[_0xf80f('0x71')]?moment(_0x5a6288[_0xf80f('0x72')])['format'](_0xf80f('0x4c'))[_0xf80f('0x58')]():'','disposition':_0x5a6288[_0xf80f('0x73')],'visibility':_0x5a6288[_0xf80f('0x74')]?_0xf80f('0x75'):_0xf80f('0x76'),'messages':_(_0x5a6288[_0xf80f('0x65')])[_0xf80f('0x46')]({'secret':![]})[_0xf80f('0x48')](function(_0x25491d){if(_0x25491d[_0xf80f('0x64')]){var _0x701e21=path[_0xf80f('0x5c')](_0x30af31,_0x25491d['Attachment']['basename']);if(fs[_0xf80f('0x77')](_0x701e21)){fs[_0xf80f('0x78')](_0x701e21)['pipe'](fs['createWriteStream'](path['join'](_0x27276f,_0x25491d[_0xf80f('0x64')][_0xf80f('0x79')])));}}return{'date':moment(_0x25491d[_0xf80f('0x66')])[_0xf80f('0x4b')](_0xf80f('0x4c'))[_0xf80f('0x58')](),'sender':_0x25491d[_0xf80f('0x67')]===_0xf80f('0x7a')?_0x25491d['User']?_0x25491d['User'][_0xf80f('0x6f')]:_0xf80f('0x7b'):_0x25491d[_0xf80f('0x61')]['firstName']+(_0x25491d['Contact'][_0xf80f('0x63')]?'\x20'+_0x25491d[_0xf80f('0x61')][_0xf80f('0x63')]:''),'body':_0x25491d[_0xf80f('0x64')]?_0x25491d[_0xf80f('0x64')]['basename']:_0x25491d[_0xf80f('0x34')],'direction':_0x25491d[_0xf80f('0x67')]==='out'?'A':'C','secret':_0x25491d[_0xf80f('0x68')],'read':_0x25491d[_0xf80f('0x69')],'attachment':_0x25491d[_0xf80f('0x64')]};})['value']()};return ejs[_0xf80f('0x7c')](path['join'](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x7d'),'downloadInteraction.ejs'),{'interaction':_0x46d6d2})[_0xf80f('0x19')](function(_0x1587b0){var _0x520011=path[_0xf80f('0x5c')](_0x27276f,_0xf80f('0x7e')+_0x5a6288['id']+'-'+_0x4f7ae8+'.pdf');var _0x46a74b={'path':_0x520011,'channel':'Openchannel','interactionId':_0x5a6288['id']};return pdf['createPdfFromHTML'](_0x1587b0,_0x46a74b);})['then'](function(){return new Promise(function(_0x5daefd,_0x5e03d6){zipdir(_0x27276f,{'saveTo':_0x2d5bb7},function(_0x5e93e6,_0x4e93de){if(_0x5e93e6)return _0x5e03d6(_0x5e93e6);return _0x5daefd(_0x4e93de);});})['then'](function(){return new Promise(function(_0x3fc235,_0x52184a){rimraf(_0x27276f,function(_0x2b7664){if(_0x2b7664)_0x52184a(_0x2b7664);return _0x3fc235();});});})[_0xf80f('0x19')](function(){return _0x25f76a[_0xf80f('0x56')](_0x2d5bb7,_0x186f7f,function(_0x1f97a9){if(_0x1f97a9){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x1f97a9);}else{fs[_0xf80f('0x7f')](_0x2d5bb7);}});});});}else{return _0x25f76a[_0xf80f('0xf')](0xc8);}})[_0xf80f('0x32')](handleError(_0x25f76a,null));}; \ No newline at end of file +var _0x9d52=['rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','name','send','map','OpenchannelInteraction','rawAttributes','type','getOptions','query','catch','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','toString','join','root','files','tmp','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','format','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','download','unlinkSync'];(function(_0x4602c6,_0x662d5b){var _0x73db64=function(_0x23c369){while(--_0x23c369){_0x4602c6['push'](_0x4602c6['shift']());}};_0x73db64(++_0x662d5b);}(_0x9d52,0x17d));var _0x29d5=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0x9d52[_0x40d339];return _0x5cbd0b;};'use strict';var rimraf=require(_0x29d5('0x0'));var zipdir=require(_0x29d5('0x1'));var moment=require(_0x29d5('0x2'));var util=require(_0x29d5('0x3'));var path=require(_0x29d5('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x29d5('0x5'));var Redis=require(_0x29d5('0x6'));var interaction=require(_0x29d5('0x7'));var qs=require(_0x29d5('0x8'));var pdf=require(_0x29d5('0x9'));var logger=require(_0x29d5('0xa'))(_0x29d5('0xb'));var config=require(_0x29d5('0xc'));var db=require('../../mysqldb')['db'];config[_0x29d5('0xd')]=_[_0x29d5('0xe')](config[_0x29d5('0xd')],{'host':_0x29d5('0xf'),'port':0x18eb});var socket=require(_0x29d5('0x10'))(new Redis(config[_0x29d5('0xd')]));require('./openchannelInteraction.socket')[_0x29d5('0x11')](socket);function respondWithStatusCode(_0x3021f4,_0x3d2abb){_0x3d2abb=_0x3d2abb||0xcc;return function(_0x519a57){if(_0x519a57){return _0x3021f4[_0x29d5('0x12')](_0x3d2abb);}return _0x3021f4[_0x29d5('0x13')](_0x3d2abb)[_0x29d5('0x14')]();};}function respondWithResult(_0xd1c2af,_0x2754f2){_0x2754f2=_0x2754f2||0xc8;return function(_0x535913){if(_0x535913){return _0xd1c2af[_0x29d5('0x13')](_0x2754f2)[_0x29d5('0x15')](_0x535913);}};}function respondWithFilteredResult(_0x23146c,_0xda6cb){return function(_0x2d9af0){if(_0x2d9af0){var _0x58c57a=typeof _0xda6cb[_0x29d5('0x16')]==='undefined'&&typeof _0xda6cb[_0x29d5('0x17')]===_0x29d5('0x18');var _0x55adb4=_0x2d9af0[_0x29d5('0x19')];var _0x5cc845=_0x58c57a?0x0:_0xda6cb[_0x29d5('0x16')];var _0x47fad7=_0x58c57a?_0x2d9af0[_0x29d5('0x19')]:_0xda6cb[_0x29d5('0x16')]+_0xda6cb[_0x29d5('0x17')];var _0x15e205;if(_0x47fad7>=_0x55adb4){_0x47fad7=_0x55adb4;_0x15e205=0xc8;}else{_0x15e205=0xce;}_0x23146c['status'](_0x15e205);return _0x23146c[_0x29d5('0x1a')](_0x29d5('0x1b'),_0x5cc845+'-'+_0x47fad7+'/'+_0x55adb4)['json'](_0x2d9af0);}return null;};}function saveUpdates(_0x3137fd){return function(_0x59ce2a){if(_0x59ce2a){return _0x59ce2a[_0x29d5('0x1c')](_0x3137fd)[_0x29d5('0x1d')](function(_0x293357){return _0x293357;});}return null;};}function removeEntity(_0x4a5113){return function(_0x5776f0){if(_0x5776f0){return _0x5776f0[_0x29d5('0x1e')]()['then'](function(){_0x4a5113['status'](0xcc)[_0x29d5('0x14')]();});}};}function handleEntityNotFound(_0x2ce54c){return function(_0x4f0c08){if(!_0x4f0c08){_0x2ce54c[_0x29d5('0x12')](0x194);}return _0x4f0c08;};}function handleError(_0x1e3a63,_0x83ede){_0x83ede=_0x83ede||0x1f4;return function(_0x4cf1ef){logger[_0x29d5('0x1f')](_0x4cf1ef['stack']);if(_0x4cf1ef[_0x29d5('0x20')]){delete _0x4cf1ef[_0x29d5('0x20')];}_0x1e3a63['status'](_0x83ede)[_0x29d5('0x21')](_0x4cf1ef);};}exports['index']=function(_0x4ba819,_0x5ee9c3){var _0x249f95={};var _0x375a66=_[_0x29d5('0x22')](db[_0x29d5('0x23')][_0x29d5('0x24')],function(_0xa7f272){return{'name':_0xa7f272['fieldName'],'type':_0xa7f272[_0x29d5('0x25')]['key']};});_0x249f95=qs[_0x29d5('0x26')](_0x375a66,_0x4ba819);return interaction['findAll']('openchannel',_0x4ba819[_0x29d5('0x27')],_0x4ba819['user'],_0x249f95,_0x375a66)[_0x29d5('0x1d')](respondWithFilteredResult(_0x5ee9c3,_0x249f95))[_0x29d5('0x28')](handleError(_0x5ee9c3,null));};exports['show']=function(_0x58318c,_0x44d8af){var _0x4d81ba={};if(_0x58318c['query'][_0x29d5('0x25')]&&_0x58318c[_0x29d5('0x27')][_0x29d5('0x25')]==='from'){_0x4d81ba[_0x29d5('0x29')]=_0x58318c[_0x29d5('0x2a')]['id'];}else{_0x4d81ba['id']=_0x58318c[_0x29d5('0x2a')]['id'];}var _0x585773={'raw':![],'where':_0x4d81ba},_0x3edc89={};_0x3edc89[_0x29d5('0x2b')]=_[_0x29d5('0x2c')](db['OpenchannelInteraction'][_0x29d5('0x24')]);_0x3edc89[_0x29d5('0x27')]=_[_0x29d5('0x2c')](_0x58318c[_0x29d5('0x27')]);_0x3edc89[_0x29d5('0x2d')]=_[_0x29d5('0x2e')](_0x3edc89[_0x29d5('0x2b')],_0x3edc89[_0x29d5('0x27')]);_0x585773[_0x29d5('0x2f')]=_[_0x29d5('0x2e')](_0x3edc89[_0x29d5('0x2b')],qs['fields'](_0x58318c[_0x29d5('0x27')][_0x29d5('0x30')]));_0x585773['attributes']=_0x585773[_0x29d5('0x2f')][_0x29d5('0x31')]?_0x585773[_0x29d5('0x2f')]:_0x3edc89['model'];if(_0x58318c[_0x29d5('0x27')][_0x29d5('0x32')]){_0x585773[_0x29d5('0x33')]=[{'all':!![]}];}_0x585773=_['merge']({},_0x585773,_0x58318c[_0x29d5('0x34')]);return db[_0x29d5('0x23')][_0x29d5('0x35')](_0x585773)[_0x29d5('0x1d')](handleEntityNotFound(_0x44d8af,null))[_0x29d5('0x1d')](respondWithResult(_0x44d8af,null))['catch'](handleError(_0x44d8af,null));};exports[_0x29d5('0x36')]=function(_0x5f16c3,_0x1f73c7){return db[_0x29d5('0x23')][_0x29d5('0x36')](_0x5f16c3[_0x29d5('0x37')],{})['then'](respondWithResult(_0x1f73c7,0xc9))[_0x29d5('0x28')](handleError(_0x1f73c7,null));};exports['update']=function(_0xe31efb,_0x3c5f50){if(_0xe31efb[_0x29d5('0x37')]['id']){delete _0xe31efb[_0x29d5('0x37')]['id'];}return db[_0x29d5('0x23')]['find']({'where':{'id':_0xe31efb['params']['id']}})[_0x29d5('0x1d')](handleEntityNotFound(_0x3c5f50,null))[_0x29d5('0x1d')](saveUpdates(_0xe31efb[_0x29d5('0x37')],null))[_0x29d5('0x1d')](respondWithResult(_0x3c5f50,null))['catch'](handleError(_0x3c5f50,null));};exports[_0x29d5('0x1e')]=function(_0xcb4b59,_0x5adfe1){return db[_0x29d5('0x23')][_0x29d5('0x35')]({'where':{'id':_0xcb4b59[_0x29d5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5adfe1,null))['then'](removeEntity(_0x5adfe1,null))[_0x29d5('0x28')](handleError(_0x5adfe1,null));};exports[_0x29d5('0x38')]=function(_0x58c4d3,_0x164a56){return db['OpenchannelInteraction'][_0x29d5('0x38')]()[_0x29d5('0x1d')](respondWithResult(_0x164a56,null))[_0x29d5('0x28')](handleError(_0x164a56,null));};exports['addMessage']=function(_0x51dcc1,_0x52f0be){return db[_0x29d5('0x39')][_0x29d5('0x35')]({'where':{'id':_0x51dcc1['params']['id']}})[_0x29d5('0x1d')](handleEntityNotFound(_0x52f0be,null))['then'](function(_0x51ce5e){if(_0x51ce5e){return _0x51ce5e[_0x29d5('0x3a')](_0x51dcc1[_0x29d5('0x37')][_0x29d5('0x3b')],_[_0x29d5('0x3c')](_0x51dcc1[_0x29d5('0x37')],['ids','id'])||{});}})[_0x29d5('0x1d')](respondWithResult(_0x52f0be,null))[_0x29d5('0x28')](handleError(_0x52f0be,null));};exports[_0x29d5('0x3d')]=function(_0x5985ae,_0x8a1761){var _0x1df1c5={'raw':![],'where':{}};var _0x4cf165={};var _0x2d213c={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x29d5('0x3e')]({'where':{'id':_0x5985ae[_0x29d5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x8a1761,null))[_0x29d5('0x1d')](function(_0xbdfbc7){if(_0xbdfbc7){_0x4cf165[_0x29d5('0x2b')]=_[_0x29d5('0x2c')](db[_0x29d5('0x39')]['rawAttributes']);_0x4cf165['query']=_['keys'](_0x5985ae[_0x29d5('0x27')]);_0x4cf165[_0x29d5('0x2d')]=_[_0x29d5('0x2e')](_0x4cf165['model'],_0x4cf165[_0x29d5('0x27')]);_0x1df1c5['attributes']=_[_0x29d5('0x2e')](_0x4cf165[_0x29d5('0x2b')],qs[_0x29d5('0x30')](_0x5985ae[_0x29d5('0x27')][_0x29d5('0x30')]));_0x1df1c5[_0x29d5('0x2f')]=_0x1df1c5[_0x29d5('0x2f')][_0x29d5('0x31')]?_0x1df1c5[_0x29d5('0x2f')]:_0x4cf165['model'];if(!_0x5985ae[_0x29d5('0x27')][_0x29d5('0x3f')](_0x29d5('0x40'))){_0x1df1c5[_0x29d5('0x17')]=qs[_0x29d5('0x17')](_0x5985ae[_0x29d5('0x27')]['limit']);_0x1df1c5['offset']=qs[_0x29d5('0x16')](_0x5985ae['query'][_0x29d5('0x16')]);}_0x1df1c5[_0x29d5('0x41')]=qs[_0x29d5('0x42')](_0x5985ae[_0x29d5('0x27')][_0x29d5('0x42')]);_0x1df1c5[_0x29d5('0x43')]=qs[_0x29d5('0x2d')](_[_0x29d5('0x44')](_0x5985ae['query'],_0x4cf165['filters']));_0x1df1c5['where'][_0x29d5('0x45')]=_0xbdfbc7['id'];if(_0x5985ae[_0x29d5('0x27')][_0x29d5('0x46')]){_0x1df1c5['where']=_['merge'](_0x1df1c5[_0x29d5('0x43')],{'$or':_[_0x29d5('0x22')](_0x1df1c5[_0x29d5('0x2f')],function(_0x35d1d3){var _0x4aa477={};_0x4aa477[_0x35d1d3]={'$like':'%'+_0x5985ae['query'][_0x29d5('0x46')]+'%'};return _0x4aa477;})});}if(_0x5985ae[_0x29d5('0x27')][_0x29d5('0x47')]){var _0xe95745=_0x5985ae[_0x29d5('0x27')]['$gte'][_0x29d5('0x48')](',');var _0x4abd3b={};_0x4abd3b[_0xe95745[0x0]]={'$gte':moment(_0xe95745[0x1])['format'](_0x29d5('0x49'))};_0x1df1c5[_0x29d5('0x43')]=_['merge'](_0x1df1c5['where'],_0x4abd3b);}_0x1df1c5=_[_0x29d5('0x4a')]({},_0x1df1c5,_0x5985ae[_0x29d5('0x34')]);return db['OpenchannelMessage'][_0x29d5('0x19')]({'where':_0x1df1c5[_0x29d5('0x43')]})[_0x29d5('0x1d')](function(_0x43088b){_0x2d213c[_0x29d5('0x19')]=_0x43088b;if(_0x5985ae[_0x29d5('0x27')]['includeAll']){_0x1df1c5[_0x29d5('0x33')]=[{'all':!![]}];}return db[_0x29d5('0x39')][_0x29d5('0x4b')](_0x1df1c5);})[_0x29d5('0x1d')](function(_0x37533b){_0x2d213c[_0x29d5('0x4c')]=_0x37533b;return _0x2d213c;});}})['then'](respondWithFilteredResult(_0x8a1761,_0x1df1c5))[_0x29d5('0x28')](handleError(_0x8a1761,null));};exports[_0x29d5('0x4d')]=function(_0x63512c,_0x3853b3){return db[_0x29d5('0x23')][_0x29d5('0x35')]({'where':{'id':_0x63512c[_0x29d5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3853b3,null))[_0x29d5('0x1d')](function(_0x1480bc){if(_0x1480bc){return _0x1480bc[_0x29d5('0x4e')](_0x63512c['body'][_0x29d5('0x3b')],_[_0x29d5('0x3c')](_0x63512c[_0x29d5('0x37')],[_0x29d5('0x3b'),'id'])||{})[_0x29d5('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0x29d5('0x20'),_0x29d5('0x50')],'where':{'id':_0x63512c[_0x29d5('0x37')]['ids']}});})['then'](function(_0x1713b5){socket[_0x29d5('0x51')](_0x29d5('0x52'),{'id':Number(_0x63512c[_0x29d5('0x2a')]['id']),'tags':_0x1713b5||[]});return{'id':Number(_0x63512c['params']['id']),'tags':_0x1713b5||[]};});}})[_0x29d5('0x1d')](respondWithResult(_0x3853b3,null))[_0x29d5('0x28')](handleError(_0x3853b3,null));};exports['removeTags']=function(_0x593dac,_0x208ca9){return db[_0x29d5('0x23')]['find']({'where':{'id':_0x593dac['params']['id']}})[_0x29d5('0x1d')](handleEntityNotFound(_0x208ca9,null))['then'](function(_0x4a6fdf){if(_0x4a6fdf){return _0x4a6fdf['removeTags'](_0x593dac['query']['ids']);}})['then'](respondWithStatusCode(_0x208ca9,null))[_0x29d5('0x28')](handleError(_0x208ca9,null));};exports['download']=function(_0x4d44c5,_0x25ce74){var _0x39a798=moment()['unix']()[_0x29d5('0x53')]();var _0x2ba3eb=path[_0x29d5('0x54')](config[_0x29d5('0x55')],'server',_0x29d5('0x56'),_0x29d5('0x57'));var _0x28e2a3=path[_0x29d5('0x54')](config[_0x29d5('0x55')],_0x29d5('0x58'),_0x29d5('0x56'),'attachments');var _0x2c30fa=path[_0x29d5('0x54')](_0x2ba3eb,_0x39a798);var _0x231ecd=util['format'](_0x29d5('0x59'),_0x4d44c5['params']['id'],_0x39a798);var _0xdc2faa=path[_0x29d5('0x54')](_0x2ba3eb,_0x231ecd);var _0x768169=[];_0x768169[_0x29d5('0x5a')]({'model':db['User'],'as':_0x29d5('0x5b'),'attributes':['id',_0x29d5('0x5c')],'raw':!![]});_0x768169['push']({'model':db[_0x29d5('0x5d')],'as':_0x29d5('0x5e'),'attributes':['id',_0x29d5('0x5f'),_0x29d5('0x60')],'raw':!![]});if(_0x4d44c5['query'][_0x29d5('0x61')]){_0x768169[_0x29d5('0x5a')]({'model':db[_0x29d5('0x62')],'as':_0x29d5('0x62'),'raw':!![]});}var _0x22cbfc=[{'model':db[_0x29d5('0x39')],'as':'Messages','attributes':['id','body',_0x29d5('0x63'),_0x29d5('0x64'),_0x29d5('0x65'),_0x29d5('0x66')],'include':_0x768169}];_0x22cbfc['push']({'model':db[_0x29d5('0x67')],'as':_0x29d5('0x68'),'attributes':['id',_0x29d5('0x20')]});_0x22cbfc[_0x29d5('0x5a')]({'model':db['User'],'as':_0x29d5('0x69'),'attributes':['id',_0x29d5('0x5c')]});return db['OpenchannelInteraction'][_0x29d5('0x35')]({'where':{'id':_0x4d44c5[_0x29d5('0x2a')]['id']},'include':_0x22cbfc})[_0x29d5('0x1d')](handleEntityNotFound(_0x25ce74,null))['then'](function(_0x20b6a1){if(_0x20b6a1){var _0x5305c2=_0x20b6a1['get']({'plain':!![]});fs[_0x29d5('0x6a')](_0x2c30fa);var _0x42c40={'channel':'Openchannel','account':_0x5305c2[_0x29d5('0x68')][_0x29d5('0x20')],'agent':_0x5305c2[_0x29d5('0x69')]?_0x5305c2[_0x29d5('0x69')][_0x29d5('0x5c')]:'N.A.','createdAt':moment(_0x5305c2[_0x29d5('0x63')])[_0x29d5('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29d5('0x53')](),'closedAt':_0x5305c2[_0x29d5('0x6c')]?moment(_0x5305c2[_0x29d5('0x6d')])[_0x29d5('0x6b')](_0x29d5('0x49'))[_0x29d5('0x53')]():'','disposition':_0x5305c2[_0x29d5('0x6e')],'visibility':_0x5305c2[_0x29d5('0x6f')]?'Public':_0x29d5('0x70'),'messages':_(_0x5305c2[_0x29d5('0x71')])[_0x29d5('0x46')]({'secret':![]})[_0x29d5('0x22')](function(_0x5eac33){if(_0x5eac33[_0x29d5('0x62')]){var _0x23bbab=path[_0x29d5('0x54')](_0x28e2a3,_0x5eac33['Attachment'][_0x29d5('0x72')]);if(fs[_0x29d5('0x73')](_0x23bbab)){fs[_0x29d5('0x74')](_0x23bbab)['pipe'](fs[_0x29d5('0x75')](path['join'](_0x2c30fa,_0x5eac33[_0x29d5('0x62')][_0x29d5('0x72')])));}}return{'date':moment(_0x5eac33[_0x29d5('0x63')])['format'](_0x29d5('0x49'))[_0x29d5('0x53')](),'sender':_0x5eac33[_0x29d5('0x64')]===_0x29d5('0x76')?_0x5eac33[_0x29d5('0x5b')]?_0x5eac33[_0x29d5('0x5b')][_0x29d5('0x5c')]:_0x29d5('0x77'):_0x5eac33[_0x29d5('0x5e')]['firstName']+(_0x5eac33[_0x29d5('0x5e')]['lastName']?'\x20'+_0x5eac33[_0x29d5('0x5e')]['lastName']:''),'body':_0x5eac33[_0x29d5('0x62')]?_0x5eac33[_0x29d5('0x62')]['basename']:_0x5eac33[_0x29d5('0x37')],'direction':_0x5eac33[_0x29d5('0x64')]==='out'?'A':'C','secret':_0x5eac33[_0x29d5('0x65')],'read':_0x5eac33[_0x29d5('0x66')],'attachment':_0x5eac33[_0x29d5('0x62')]};})['value']()};return ejs[_0x29d5('0x78')](path[_0x29d5('0x54')](config[_0x29d5('0x55')],_0x29d5('0x58'),'views',_0x29d5('0x79')),{'interaction':_0x42c40})['then'](function(_0x263943){var _0x5c5da7=path['join'](_0x2c30fa,_0x29d5('0x7a')+_0x5305c2['id']+'-'+_0x39a798+'.pdf');var _0x2a7dc7={'path':_0x5c5da7,'channel':_0x29d5('0x7b'),'interactionId':_0x5305c2['id']};return pdf[_0x29d5('0x7c')](_0x263943,_0x2a7dc7);})['then'](function(){return new Promise(function(_0xc70d9a,_0x464d37){zipdir(_0x2c30fa,{'saveTo':_0xdc2faa},function(_0x53639d,_0x542891){if(_0x53639d)return _0x464d37(_0x53639d);return _0xc70d9a(_0x542891);});})[_0x29d5('0x1d')](function(){return new Promise(function(_0x531e0d,_0x13c04d){rimraf(_0x2c30fa,function(_0x4a3f1c){if(_0x4a3f1c)_0x13c04d(_0x4a3f1c);return _0x531e0d();});});})['then'](function(){return _0x25ce74[_0x29d5('0x7d')](_0xdc2faa,_0x231ecd,function(_0x37228b){if(_0x37228b){logger[_0x29d5('0x1f')]('Unable\x20to\x20delete\x20zip\x20file',_0x37228b);}else{fs[_0x29d5('0x7e')](_0xdc2faa);}});});});}else{return _0x25ce74[_0x29d5('0x12')](0xc8);}})[_0x29d5('0x28')](handleError(_0x25ce74,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7b7ee8f..7128b62 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 _0x975a=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x4a85b8,_0x5cdcfd){var _0x4c6d40=function(_0x344c64){while(--_0x344c64){_0x4a85b8['push'](_0x4a85b8['shift']());}};_0x4c6d40(++_0x5cdcfd);}(_0x975a,0x1f0));var _0xa975=function(_0x4d3a12,_0x4a75f1){_0x4d3a12=_0x4d3a12-0x0;var _0x23aecd=_0x975a[_0x4d3a12];return _0x23aecd;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa975('0x0')];var OpenchannelMessage=require(_0xa975('0x1'))['db'][_0xa975('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa975('0x3')](0x0);var events={'afterCreate':_0xa975('0x4'),'afterUpdate':_0xa975('0x5'),'afterDestroy':_0xa975('0x6')};function emitEvent(_0x4f3797){return function(_0x17f5e0,_0x508b29,_0x480f70){_0x17f5e0[_0xa975('0x7')]({'attributes':['id'],'raw':!![]})[_0xa975('0x8')](function(_0x2e4254){_0x17f5e0[_0xa975('0x9')](_0xa975('0xa'),_0x2e4254[_0xa975('0xb')](function(_0x58b59b){return{'id':_0x58b59b['id']};}));return OpenchannelMessage[_0xa975('0xc')]({'where':{'OpenchannelInteractionId':_0x17f5e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa975('0x8')](function(_0x3014d4){_0x17f5e0['setDataValue']('unreadMessages',_0x3014d4[_0xa975('0xd')]);OpenchannelInteractionEvents[_0xa975('0xe')](_0x4f3797+':'+_0x17f5e0['id'],_0x17f5e0);OpenchannelInteractionEvents[_0xa975('0xe')](_0x4f3797,_0x17f5e0);_0x480f70(null);})[_0xa975('0xf')](_0x480f70(null));};}for(var e in events){if(events[_0xa975('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa975('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xea95=['setDataValue','Users','findAll','then','unreadMessages','length','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x590764,_0xc6a6f1){var _0x25f888=function(_0x3aa572){while(--_0x3aa572){_0x590764['push'](_0x590764['shift']());}};_0x25f888(++_0xc6a6f1);}(_0xea95,0x6f));var _0x5ea9=function(_0x1f7967,_0x54bb86){_0x1f7967=_0x1f7967-0x0;var _0x116e01=_0xea95[_0x1f7967];return _0x116e01;};'use strict';var EventEmitter=require(_0x5ea9('0x0'));var OpenchannelInteraction=require(_0x5ea9('0x1'))['db'][_0x5ea9('0x2')];var OpenchannelMessage=require(_0x5ea9('0x1'))['db'][_0x5ea9('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5ea9('0x4')](0x0);var events={'afterCreate':_0x5ea9('0x5'),'afterUpdate':_0x5ea9('0x6'),'afterDestroy':_0x5ea9('0x7')};function emitEvent(_0x10197c){return function(_0x48faf0,_0x140b8c,_0x54e6ba){_0x48faf0['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xefb1d5){_0x48faf0[_0x5ea9('0x8')](_0x5ea9('0x9'),_0xefb1d5['map'](function(_0x1ee792){return{'id':_0x1ee792['id']};}));return OpenchannelMessage[_0x5ea9('0xa')]({'where':{'OpenchannelInteractionId':_0x48faf0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ea9('0xb')](function(_0x308fd5){_0x48faf0[_0x5ea9('0x8')](_0x5ea9('0xc'),_0x308fd5[_0x5ea9('0xd')]);OpenchannelInteractionEvents['emit'](_0x10197c+':'+_0x48faf0['id'],_0x48faf0);OpenchannelInteractionEvents['emit'](_0x10197c,_0x48faf0);_0x54e6ba(null);})[_0x5ea9('0xe')](_0x54e6ba(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x5ea9('0xf')](e,emitEvent(event));}}module[_0x5ea9('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7e55239..514048e 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 _0x8fee=['define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x452f5b,_0x5389d1){var _0x33e5e2=function(_0x34b282){while(--_0x34b282){_0x452f5b['push'](_0x452f5b['shift']());}};_0x33e5e2(++_0x5389d1);}(_0x8fee,0x195));var _0xe8fe=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8fee[_0x173f10];return _0x53142d;};'use strict';var _=require(_0xe8fe('0x0'));var util=require(_0xe8fe('0x1'));var logger=require('../../config/logger')(_0xe8fe('0x2'));var moment=require(_0xe8fe('0x3'));var BPromise=require(_0xe8fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8fe('0x5'));var config=require(_0xe8fe('0x6'));var attributes=require(_0xe8fe('0x7'));module[_0xe8fe('0x8')]=function(_0x1fddf6,_0x4d4dab){return _0x1fddf6[_0xe8fe('0x9')](_0xe8fe('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8fe('0xb'),'collate':_0xe8fe('0xc'),'hooks':{'beforeUpdate':function(_0x3570a1,_0xa75af6,_0xf16711){if(_0x3570a1[_0xe8fe('0xd')](_0xe8fe('0xe'))){_0x3570a1[_0xe8fe('0xf')]=moment()[_0xe8fe('0x10')](_0xe8fe('0x11'));}_0xf16711(null,_0x3570a1);}}});}; \ No newline at end of file +var _0x8610=['utf8mb4_unicode_ci','changed','closed','format','lodash','util','../../config/logger','moment','bluebird','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x2e54d4,_0xe00383){var _0x4fd99e=function(_0x2e0fa8){while(--_0x2e0fa8){_0x2e54d4['push'](_0x2e54d4['shift']());}};_0x4fd99e(++_0xe00383);}(_0x8610,0x154));var _0x0861=function(_0x3f2ba3,_0x1452c4){_0x3f2ba3=_0x3f2ba3-0x0;var _0x486246=_0x8610[_0x3f2ba3];return _0x486246;};'use strict';var _=require(_0x0861('0x0'));var util=require(_0x0861('0x1'));var logger=require(_0x0861('0x2'))('api');var moment=require(_0x0861('0x3'));var BPromise=require(_0x0861('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0861('0x5'));var config=require('../../config/environment');var attributes=require(_0x0861('0x6'));module[_0x0861('0x7')]=function(_0x5b4426,_0x53612b){return _0x5b4426[_0x0861('0x8')](_0x0861('0x9'),attributes,{'tableName':_0x0861('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0861('0xb'),'collate':_0x0861('0xc'),'hooks':{'beforeUpdate':function(_0x5c9185,_0x5a4e4a,_0x2655d1){if(_0x5c9185[_0x0861('0xd')](_0x0861('0xe'))){_0x5c9185['closedAt']=moment()[_0x0861('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2655d1(null,_0x5c9185);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d8e577a..71e5d02 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 _0xf0b0=['http','redis','socket.io-emitter','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ea035,_0x5b9512){var _0x37d195=function(_0x5a1f8c){while(--_0x5a1f8c){_0x4ea035['push'](_0x4ea035['shift']());}};_0x37d195(++_0x5b9512);}(_0xf0b0,0x1ba));var _0x0f0b=function(_0x325fc4,_0x43cb59){_0x325fc4=_0x325fc4-0x0;var _0x58c0bb=_0xf0b0[_0x325fc4];return _0x58c0bb;};'use strict';var _=require(_0x0f0b('0x0'));var util=require('util');var moment=require(_0x0f0b('0x1'));var BPromise=require(_0x0f0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f0b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f0b('0x4'));var logger=require('../../config/logger')(_0x0f0b('0x5'));var config=require(_0x0f0b('0x6'));var jayson=require(_0x0f0b('0x7'));var client=jayson[_0x0f0b('0x8')][_0x0f0b('0x9')]({'port':0x232a});config[_0x0f0b('0xa')]=_['defaults'](config[_0x0f0b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f0b('0xb'))(new Redis(config[_0x0f0b('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x48f0db,_0x578597,_0x34d699){return new BPromise(function(_0x44cb99,_0x505745){return client[_0x0f0b('0xc')](_0x48f0db,_0x34d699)[_0x0f0b('0xd')](function(_0x2d8e7f){logger[_0x0f0b('0xe')](_0x0f0b('0xf'),_0x578597,_0x0f0b('0x10'));logger['debug'](_0x0f0b('0x11'),_0x578597,_0x0f0b('0x10'),JSON[_0x0f0b('0x12')](_0x2d8e7f));if(_0x2d8e7f[_0x0f0b('0x13')]){if(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x14')]===0x1f4){logger['error'](_0x0f0b('0xf'),_0x578597,_0x2d8e7f[_0x0f0b('0x13')]['message']);return _0x505745(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);}logger['error'](_0x0f0b('0xf'),_0x578597,_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);return _0x44cb99(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);}else{logger[_0x0f0b('0xe')](_0x0f0b('0xf'),_0x578597,_0x0f0b('0x10'));_0x44cb99(_0x2d8e7f[_0x0f0b('0x16')]['message']);}})[_0x0f0b('0x17')](function(_0x2f759f){logger[_0x0f0b('0x13')](_0x0f0b('0xf'),_0x578597,_0x2f759f);_0x505745(_0x2f759f);});});}exports['UpdateOpenchannelInteraction']=function(_0x380c89){var _0x19d065=this;return new Promise(function(_0x4c8769,_0x5263a4){return db[_0x0f0b('0x18')][_0x0f0b('0x19')](_0x380c89[_0x0f0b('0x1a')],{'raw':_0x380c89[_0x0f0b('0x1b')]?_0x380c89['options'][_0x0f0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380c89[_0x0f0b('0x1b')]?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1d')]||null:null,'attributes':_0x380c89[_0x0f0b('0x1b')]?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1e')]||null:null,'limit':_0x380c89['options']?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1f')]||null:null})[_0x0f0b('0xd')](function(_0x2fde53){logger[_0x0f0b('0xe')](_0x0f0b('0x20'),_0x380c89);logger[_0x0f0b('0x21')](_0x0f0b('0x20'),_0x380c89,JSON['stringify'](_0x2fde53));_0x4c8769(_0x2fde53);})[_0x0f0b('0x17')](function(_0x46902a){logger[_0x0f0b('0x13')]('UpdateOpenchannelInteraction',_0x46902a[_0x0f0b('0x15')],_0x380c89);_0x5263a4(_0x19d065[_0x0f0b('0x13')](0x1f4,_0x46902a[_0x0f0b('0x15')]));});});};exports[_0x0f0b('0x22')]=function(_0x5e9a3d){return new Promise(function(_0xd24f0,_0x117543){return db[_0x0f0b('0x18')][_0x0f0b('0x23')]({'where':_0x5e9a3d[_0x0f0b('0x1b')]?_0x5e9a3d['options'][_0x0f0b('0x1d')]||null:null})['then'](function(_0x55d14c){if(_0x55d14c){return _0x55d14c[_0x0f0b('0x24')](_0x5e9a3d[_0x0f0b('0x1a')][_0x0f0b('0x25')],_[_0x0f0b('0x26')](_0x5e9a3d[_0x0f0b('0x1a')],[_0x0f0b('0x25'),'id'])||{});}})[_0x0f0b('0x27')](function(_0x236d85){logger['info']('AddTags',_0x5e9a3d);logger['debug']('AddTags',_0x5e9a3d,JSON[_0x0f0b('0x12')](_0x236d85));_0xd24f0(_0x236d85);})[_0x0f0b('0x17')](function(_0x32cc71){logger[_0x0f0b('0x13')](_0x0f0b('0x28'),_0x32cc71[_0x0f0b('0x15')],_0x5e9a3d);_0x117543(_this[_0x0f0b('0x13')](0x1f4,_0x32cc71[_0x0f0b('0x15')]));});});}; \ No newline at end of file +var _0x1d7e=['where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','OpenchannelInteraction','update','body','options','raw','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1d7e,0x145));var _0xe1d7=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1d7e[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0xe1d7('0x0'));var util=require(_0xe1d7('0x1'));var moment=require(_0xe1d7('0x2'));var BPromise=require(_0xe1d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1d7('0x4'));var db=require(_0xe1d7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1d7('0x6'))(_0xe1d7('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1d7('0x8'));var client=jayson[_0xe1d7('0x9')][_0xe1d7('0xa')]({'port':0x232a});config[_0xe1d7('0xb')]=_[_0xe1d7('0xc')](config[_0xe1d7('0xb')],{'host':_0xe1d7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1d7('0xb')]));require(_0xe1d7('0xe'))[_0xe1d7('0xf')](socket);function respondWithRpcPromise(_0x2fa3f6,_0x598326,_0x497aad){return new BPromise(function(_0x48690e,_0x1cf6b7){return client[_0xe1d7('0x10')](_0x2fa3f6,_0x497aad)[_0xe1d7('0x11')](function(_0x51ef7b){logger[_0xe1d7('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x598326,_0xe1d7('0x13'));logger[_0xe1d7('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x598326,_0xe1d7('0x13'),JSON[_0xe1d7('0x15')](_0x51ef7b));if(_0x51ef7b[_0xe1d7('0x16')]){if(_0x51ef7b[_0xe1d7('0x16')][_0xe1d7('0x17')]===0x1f4){logger['error'](_0xe1d7('0x18'),_0x598326,_0x51ef7b[_0xe1d7('0x16')]['message']);return _0x1cf6b7(_0x51ef7b[_0xe1d7('0x16')][_0xe1d7('0x19')]);}logger[_0xe1d7('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x598326,_0x51ef7b['error'][_0xe1d7('0x19')]);return _0x48690e(_0x51ef7b[_0xe1d7('0x16')][_0xe1d7('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x598326,'request\x20sent');_0x48690e(_0x51ef7b[_0xe1d7('0x1a')][_0xe1d7('0x19')]);}})['catch'](function(_0x7e3455){logger[_0xe1d7('0x16')](_0xe1d7('0x18'),_0x598326,_0x7e3455);_0x1cf6b7(_0x7e3455);});});}exports['UpdateOpenchannelInteraction']=function(_0x56c10d){var _0x5e7edb=this;return new Promise(function(_0x4e320b,_0x40d9ec){return db[_0xe1d7('0x1b')][_0xe1d7('0x1c')](_0x56c10d[_0xe1d7('0x1d')],{'raw':_0x56c10d['options']?_0x56c10d[_0xe1d7('0x1e')][_0xe1d7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c10d[_0xe1d7('0x1e')]?_0x56c10d['options']['where']||null:null,'attributes':_0x56c10d[_0xe1d7('0x1e')]?_0x56c10d[_0xe1d7('0x1e')][_0xe1d7('0x20')]||null:null,'limit':_0x56c10d[_0xe1d7('0x1e')]?_0x56c10d[_0xe1d7('0x1e')]['limit']||null:null})[_0xe1d7('0x11')](function(_0xbc78c){logger['info']('UpdateOpenchannelInteraction',_0x56c10d);logger[_0xe1d7('0x14')]('UpdateOpenchannelInteraction',_0x56c10d,JSON[_0xe1d7('0x15')](_0xbc78c));_0x4e320b(_0xbc78c);})['catch'](function(_0x56e90d){logger[_0xe1d7('0x16')](_0xe1d7('0x21'),_0x56e90d['message'],_0x56c10d);_0x40d9ec(_0x5e7edb[_0xe1d7('0x16')](0x1f4,_0x56e90d[_0xe1d7('0x19')]));});});};exports[_0xe1d7('0x22')]=function(_0x533e22){return new Promise(function(_0x4a6940,_0x1f844a){return db[_0xe1d7('0x1b')]['find']({'where':_0x533e22[_0xe1d7('0x1e')]?_0x533e22[_0xe1d7('0x1e')][_0xe1d7('0x23')]||null:null})[_0xe1d7('0x11')](function(_0x55a984){if(_0x55a984){return _0x55a984['addTags'](_0x533e22['body'][_0xe1d7('0x24')],_[_0xe1d7('0x25')](_0x533e22['body'],[_0xe1d7('0x24'),'id'])||{});}})[_0xe1d7('0x26')](function(_0x377843){logger[_0xe1d7('0x12')](_0xe1d7('0x27'),_0x533e22);logger[_0xe1d7('0x14')](_0xe1d7('0x27'),_0x533e22,JSON['stringify'](_0x377843));_0x4a6940(_0x377843);})['catch'](function(_0x10c4b2){logger[_0xe1d7('0x16')](_0xe1d7('0x27'),_0x10c4b2[_0xe1d7('0x19')],_0x533e22);_0x1f844a(_this[_0xe1d7('0x16')](0x1f4,_0x10c4b2[_0xe1d7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ad05465..037b1a1 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 _0x02ea=['register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','removeListener'];(function(_0xaf9137,_0x364b8f){var _0x1a6138=function(_0x25ef4d){while(--_0x25ef4d){_0xaf9137['push'](_0xaf9137['shift']());}};_0x1a6138(++_0x364b8f);}(_0x02ea,0x1ed));var _0xa02e=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x02ea[_0xf51c06];return _0x1d5420;};'use strict';var OpenchannelInteractionEvents=require(_0xa02e('0x0'));var events=['save',_0xa02e('0x1'),_0xa02e('0x2')];function createListener(_0x14aaf5,_0x53c27d){return function(_0x45bdb4){_0x53c27d['emit'](_0x14aaf5,_0x45bdb4);};}function removeListener(_0x1c4358,_0x32d452){return function(){OpenchannelInteractionEvents[_0xa02e('0x3')](_0x1c4358,_0x32d452);};}exports[_0xa02e('0x4')]=function(_0x18a1c0){for(var _0x7dab15=0x0,_0x57a1b9=events[_0xa02e('0x5')];_0x7dab15<_0x57a1b9;_0x7dab15++){var _0x13e6ce=events[_0x7dab15];var _0x2a5257=createListener(_0xa02e('0x6')+_0x13e6ce,_0x18a1c0);OpenchannelInteractionEvents['on'](_0x13e6ce,_0x2a5257);}}; \ No newline at end of file +var _0xc213=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','removeListener','register'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc213,0x87));var _0x3c21=function(_0x235976,_0x1a6633){_0x235976=_0x235976-0x0;var _0x531178=_0xc213[_0x235976];return _0x531178;};'use strict';var OpenchannelInteractionEvents=require(_0x3c21('0x0'));var events=[_0x3c21('0x1'),_0x3c21('0x2'),'update'];function createListener(_0x373ef6,_0x4d72bf){return function(_0x5d0107){_0x4d72bf['emit'](_0x373ef6,_0x5d0107);};}function removeListener(_0x77a28,_0x1e7eef){return function(){OpenchannelInteractionEvents[_0x3c21('0x3')](_0x77a28,_0x1e7eef);};}exports[_0x3c21('0x4')]=function(_0x4a9b07){for(var _0x5d6ce3=0x0,_0x4c2fe2=events[_0x3c21('0x5')];_0x5d6ce3<_0x4c2fe2;_0x5d6ce3++){var _0x300dab=events[_0x5d6ce3];var _0x3b3cb2=createListener(_0x3c21('0x6')+_0x300dab,_0x4a9b07);OpenchannelInteractionEvents['on'](_0x300dab,_0x3b3cb2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 212eec1..0f4338a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x296cad,_0x294cf6){var _0x2e6a27=function(_0x3abcbe){while(--_0x3abcbe){_0x296cad['push'](_0x296cad['shift']());}};_0x2e6a27(++_0x294cf6);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 216a1ed..f3347e2 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 _0x61d0=['STRING','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x18c51a,_0x24773c){var _0x4dfd04=function(_0x49834f){while(--_0x49834f){_0x18c51a['push'](_0x18c51a['shift']());}};_0x4dfd04(++_0x24773c);}(_0x61d0,0x187));var _0x061d=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x61d0[_0x4ae459];return _0x51d0c9;};'use strict';var Sequelize=require(_0x061d('0x0'));module['exports']={'body':{'type':Sequelize[_0x061d('0x1')](_0x061d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x061d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x061d('0x4')),'defaultValue':_0x061d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x061d('0x5')]},'providerResponse':{'type':Sequelize[_0x061d('0x1')]}}; \ No newline at end of file +var _0x4b6c=['TEXT','sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x31741e,_0x531dd9){var _0xe0c6eb=function(_0x1a37dd){while(--_0x1a37dd){_0x31741e['push'](_0x31741e['shift']());}};_0xe0c6eb(++_0x531dd9);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module[_0xc4b6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc4b6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc4b6('0x4')),'defaultValue':_0xc4b6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc4b6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc4b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 555c2e6..a336107 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 _0x7a54=['User','EventManager','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','then','rows','show','keys','length','find','create','update','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','../../config/logger','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize'];(function(_0x5e358a,_0x22ed70){var _0x52fb8c=function(_0x2319b0){while(--_0x2319b0){_0x5e358a['push'](_0x5e358a['shift']());}};_0x52fb8c(++_0x22ed70);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9311,_0x3a8925){_0x3a9311=_0x3a9311-0x0;var _0x2d1fd6=_0x7a54[_0x3a9311];return _0x2d1fd6;};'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'];config[_0x47a5('0x16')]=_[_0x47a5('0x17')](config['redis'],{'host':_0x47a5('0x18'),'port':0x18eb});var socket=require(_0x47a5('0x19'))(new Redis(config[_0x47a5('0x16')]));require(_0x47a5('0x1a'))[_0x47a5('0x1b')](socket);var jayson=require(_0x47a5('0x1c'));var client=jayson[_0x47a5('0x1d')][_0x47a5('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x47a5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x11faf5,_0x3b001e,_0x2a2cbb,_0x1ef44c){return new BPromise(function(_0x574af6,_0x549de3){var _0x138bc0=_0x1ef44c||client;return _0x138bc0['request'](_0x11faf5,_0x2a2cbb)['then'](function(_0x423a81){logger[_0x47a5('0x1f')](_0x47a5('0x20'),_0x3b001e,_0x47a5('0x21'));logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x3b001e,_0x47a5('0x21'),JSON[_0x47a5('0x24')](_0x423a81));if(_0x423a81[_0x47a5('0x25')]){if(_0x423a81['error'][_0x47a5('0x26')]===0x1f4){logger[_0x47a5('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x423a81[_0x47a5('0x25')][_0x47a5('0x27')]);return _0x549de3(_0x423a81[_0x47a5('0x25')]['message']);}logger[_0x47a5('0x25')](_0x47a5('0x20'),_0x3b001e,_0x423a81[_0x47a5('0x25')][_0x47a5('0x27')]);return _0x574af6(_0x423a81['error'][_0x47a5('0x27')]);}else{logger[_0x47a5('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x47a5('0x21'));_0x574af6(_0x423a81[_0x47a5('0x28')][_0x47a5('0x27')]);}})[_0x47a5('0x29')](function(_0x3abd6a){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x3abd6a);_0x549de3(_0x3abd6a);});});}function respondWithStatusCode(_0x136745,_0x5686db){_0x5686db=_0x5686db||0xcc;return function(_0x1ea9c8){if(_0x1ea9c8){return _0x136745['sendStatus'](_0x5686db);}return _0x136745[_0x47a5('0x2a')](_0x5686db)[_0x47a5('0x2b')]();};}function respondWithResult(_0x36ad34,_0x1dac65){_0x1dac65=_0x1dac65||0xc8;return function(_0x21f296){if(_0x21f296){return _0x36ad34[_0x47a5('0x2a')](_0x1dac65)[_0x47a5('0x2c')](_0x21f296);}};}function respondWithFilteredResult(_0x136b14,_0x16631f){return function(_0x361bfa){if(_0x361bfa){var _0x1127f8=typeof _0x16631f[_0x47a5('0x2d')]===_0x47a5('0x2e')&&typeof _0x16631f['limit']===_0x47a5('0x2e');var _0x51833b=_0x361bfa[_0x47a5('0x2f')];var _0x9ac908=_0x1127f8?0x0:_0x16631f[_0x47a5('0x2d')];var _0x4d6b57=_0x1127f8?_0x361bfa[_0x47a5('0x2f')]:_0x16631f[_0x47a5('0x2d')]+_0x16631f[_0x47a5('0x30')];var _0x1f1c68;if(_0x4d6b57>=_0x51833b){_0x4d6b57=_0x51833b;_0x1f1c68=0xc8;}else{_0x1f1c68=0xce;}_0x136b14['status'](_0x1f1c68);return _0x136b14['set'](_0x47a5('0x31'),_0x9ac908+'-'+_0x4d6b57+'/'+_0x51833b)[_0x47a5('0x2c')](_0x361bfa);}return null;};}function patchUpdates(_0x5bd7eb){return function(_0x4e1006){try{jsonpatch[_0x47a5('0x32')](_0x4e1006,_0x5bd7eb,!![]);}catch(_0x51544e){return BPromise['reject'](_0x51544e);}return _0x4e1006[_0x47a5('0x33')]();};}function saveUpdates(_0x53119b,_0x122ed6){return function(_0xd972c){if(_0xd972c){return _0xd972c['update'](_0x53119b)['then'](function(_0x274e34){return _0x274e34;});}return null;};}function removeEntity(_0x5910bb,_0x403028){return function(_0x87e4c9){if(_0x87e4c9){return _0x87e4c9[_0x47a5('0x34')]()['then'](function(){_0x5910bb[_0x47a5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c754,_0x65542e){return function(_0x5a8a7c){if(!_0x5a8a7c){_0x53c754[_0x47a5('0x35')](0x194);}return _0x5a8a7c;};}function handleError(_0x5ef577,_0x21ad34){_0x21ad34=_0x21ad34||0x1f4;return function(_0x3534cb){logger[_0x47a5('0x25')](_0x3534cb[_0x47a5('0x36')]);if(_0x3534cb[_0x47a5('0x37')]){delete _0x3534cb[_0x47a5('0x37')];}_0x5ef577[_0x47a5('0x2a')](_0x21ad34)[_0x47a5('0x38')](_0x3534cb);};}exports[_0x47a5('0x39')]=function(_0x4caed5,_0x396a9a){var _0x10f136={},_0x511c06={},_0x2c50d6={'count':0x0,'rows':[]};var _0x2bf53d=_[_0x47a5('0x3a')](db['OpenchannelMessage'][_0x47a5('0x3b')],function(_0x10f660){return{'name':_0x10f660['fieldName'],'type':_0x10f660[_0x47a5('0x3c')][_0x47a5('0x3d')]};});_0x511c06['model']=_['map'](_0x2bf53d,'name');_0x511c06[_0x47a5('0x3e')]=_['keys'](_0x4caed5[_0x47a5('0x3e')]);_0x511c06[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x511c06[_0x47a5('0x41')],_0x511c06[_0x47a5('0x3e')]);_0x10f136[_0x47a5('0x42')]=_[_0x47a5('0x40')](_0x511c06[_0x47a5('0x41')],qs[_0x47a5('0x43')](_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x43')]));_0x10f136[_0x47a5('0x42')]=_0x10f136[_0x47a5('0x42')]['length']?_0x10f136[_0x47a5('0x42')]:_0x511c06[_0x47a5('0x41')];if(!_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x44')]('nolimit')){_0x10f136[_0x47a5('0x30')]=qs['limit'](_0x4caed5['query']['limit']);_0x10f136['offset']=qs[_0x47a5('0x2d')](_0x4caed5['query'][_0x47a5('0x2d')]);}_0x10f136[_0x47a5('0x45')]=qs[_0x47a5('0x46')](_0x4caed5['query'][_0x47a5('0x46')]);_0x10f136[_0x47a5('0x47')]=qs['filters'](_['pick'](_0x4caed5[_0x47a5('0x3e')],_0x511c06['filters']),_0x2bf53d);if(_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x48')]){_0x10f136[_0x47a5('0x47')]=_[_0x47a5('0x49')](_0x10f136[_0x47a5('0x47')],{'$or':_[_0x47a5('0x3a')](_0x2bf53d,function(_0x434227){if(_0x434227[_0x47a5('0x3c')]!==_0x47a5('0x4a')){var _0x162fa0={};_0x162fa0[_0x434227[_0x47a5('0x37')]]={'$like':'%'+_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x48')]+'%'};return _0x162fa0;}})});}_0x10f136=_[_0x47a5('0x49')]({},_0x10f136,_0x4caed5[_0x47a5('0x4b')]);var _0x3a2b38={'where':_0x10f136['where']};return db[_0x47a5('0x4c')][_0x47a5('0x2f')](_0x3a2b38)['then'](function(_0x52b3a8){_0x2c50d6[_0x47a5('0x2f')]=_0x52b3a8;if(_0x4caed5['query'][_0x47a5('0x4d')]){_0x10f136[_0x47a5('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x10f136);})[_0x47a5('0x4f')](function(_0x52d409){_0x2c50d6[_0x47a5('0x50')]=_0x52d409;return _0x2c50d6;})[_0x47a5('0x4f')](respondWithFilteredResult(_0x396a9a,_0x10f136))[_0x47a5('0x29')](handleError(_0x396a9a,null));};exports[_0x47a5('0x51')]=function(_0x44fe8a,_0x26acd2){var _0x238ebb={'raw':!![],'where':{'id':_0x44fe8a['params']['id']}},_0x53e994={};_0x53e994[_0x47a5('0x41')]=_[_0x47a5('0x52')](db[_0x47a5('0x4c')][_0x47a5('0x3b')]);_0x53e994[_0x47a5('0x3e')]=_[_0x47a5('0x52')](_0x44fe8a[_0x47a5('0x3e')]);_0x53e994['filters']=_[_0x47a5('0x40')](_0x53e994[_0x47a5('0x41')],_0x53e994[_0x47a5('0x3e')]);_0x238ebb['attributes']=_[_0x47a5('0x40')](_0x53e994['model'],qs[_0x47a5('0x43')](_0x44fe8a[_0x47a5('0x3e')][_0x47a5('0x43')]));_0x238ebb[_0x47a5('0x42')]=_0x238ebb['attributes'][_0x47a5('0x53')]?_0x238ebb[_0x47a5('0x42')]:_0x53e994[_0x47a5('0x41')];if(_0x44fe8a[_0x47a5('0x3e')][_0x47a5('0x4d')]){_0x238ebb[_0x47a5('0x4e')]=[{'all':!![]}];}_0x238ebb=_[_0x47a5('0x49')]({},_0x238ebb,_0x44fe8a['options']);return db[_0x47a5('0x4c')][_0x47a5('0x54')](_0x238ebb)[_0x47a5('0x4f')](handleEntityNotFound(_0x26acd2,null))[_0x47a5('0x4f')](respondWithResult(_0x26acd2,null))[_0x47a5('0x29')](handleError(_0x26acd2,null));};exports[_0x47a5('0x55')]=function(_0x572233,_0x1ad6a9){return db[_0x47a5('0x4c')][_0x47a5('0x55')](_0x572233['body'],{})[_0x47a5('0x4f')](respondWithResult(_0x1ad6a9,0xc9))[_0x47a5('0x29')](handleError(_0x1ad6a9,null));};exports[_0x47a5('0x56')]=function(_0x5d8d4a,_0x57641e){if(_0x5d8d4a[_0x47a5('0x57')]['id']){delete _0x5d8d4a[_0x47a5('0x57')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x5d8d4a[_0x47a5('0x58')]['id']}})['then'](handleEntityNotFound(_0x57641e,null))[_0x47a5('0x4f')](saveUpdates(_0x5d8d4a['body'],null))['then'](respondWithResult(_0x57641e,null))[_0x47a5('0x29')](handleError(_0x57641e,null));};exports[_0x47a5('0x34')]=function(_0x53eedf,_0x1b958b){return db[_0x47a5('0x4c')]['find']({'where':{'id':_0x53eedf['params']['id']}})[_0x47a5('0x4f')](handleEntityNotFound(_0x1b958b,null))[_0x47a5('0x4f')](removeEntity(_0x1b958b,null))[_0x47a5('0x29')](handleError(_0x1b958b,null));};exports[_0x47a5('0x59')]=function(_0x5996c4,_0x199621){return db[_0x47a5('0x4c')][_0x47a5('0x59')]()['then'](respondWithResult(_0x199621,null))[_0x47a5('0x29')](handleError(_0x199621,null));};var interaction_log=require('../../config/logger')(_0x47a5('0x5a'));exports[_0x47a5('0x5b')]=function(_0x943a15,_0x1c485b,_0x3603b7){var _0x4966af={'agent':{},'channel':_0x47a5('0x5c')};if(_0x943a15['body']['id']){delete _0x943a15['body']['id'];}_0x943a15['body']['read']=!![];_0x943a15[_0x47a5('0x57')][_0x47a5('0x5d')]=moment()[_0x47a5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x943a15['body'][_0x47a5('0x5f')]=_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')]||_0x943a15[_0x47a5('0x60')]['id'];_0x4966af[_0x47a5('0x61')]['id']=_0x943a15['body'][_0x47a5('0x5f')];return db['OpenchannelMessage'][_0x47a5('0x54')]({'where':{'id':_0x943a15[_0x47a5('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c485b,null))[_0x47a5('0x4f')](saveUpdates(_0x943a15[_0x47a5('0x57')],null))[_0x47a5('0x4f')](function(_0x3e8274){if(_0x3e8274){_0x4966af[_0x47a5('0x27')]=_0x3e8274[_0x47a5('0x62')]({'plain':!![]});return db[_0x47a5('0x63')][_0x47a5('0x54')]({'where':{'id':_0x3e8274['OpenchannelInteractionId']}});}return null;})[_0x47a5('0x4f')](handleEntityNotFound(_0x1c485b,null))[_0x47a5('0x4f')](function(_0x3c75c6){if(_0x3c75c6){return _0x3c75c6[_0x47a5('0x56')]({'UserId':_0x943a15[_0x47a5('0x57')]['UserId'],'read1stAt':_[_0x47a5('0x64')](_0x3c75c6[_0x47a5('0x65')])?moment()[_0x47a5('0x5e')](_0x47a5('0x66')):undefined});}return null;})[_0x47a5('0x4f')](function(_0x168329){if(_0x168329){_0x4966af[_0x47a5('0x67')]=_0x168329[_0x47a5('0x62')]({'plain':!![]});interaction_log[_0x47a5('0x1f')](_0x47a5('0x68'),_0x943a15[_0x47a5('0x60')]['id'],_0x943a15[_0x47a5('0x60')][_0x47a5('0x37')],_0x943a15[_0x47a5('0x60')][_0x47a5('0x69')],_0x4966af['interaction']['id'],_0x943a15[_0x47a5('0x57')]?JSON[_0x47a5('0x24')](_0x943a15[_0x47a5('0x57')]):'null');return respondWithRpcPromise(_0x47a5('0x6a'),_0x47a5('0x6b'),_0x4966af);}return null;})[_0x47a5('0x4f')](function(_0x26f1ac){var _0x5d9822=_0x47a5('0x6c')+_0x26f1ac['message'][_0x47a5('0x6d')];return db['sequelize'][_0x47a5('0x3e')](_0x5d9822,{'type':db['Sequelize'][_0x47a5('0x6e')][_0x47a5('0x6f')],'raw':!![]})[_0x47a5('0x4f')](function(_0x58473b){return _0x58473b;});})['then'](function(_0x4b8084){if(_0x4b8084){_0x4966af[_0x47a5('0x27')][_0x47a5('0x70')]=_0x4b8084[0x0];if(!_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')])return;return db['User'][_0x47a5('0x54')]({'where':{'id':_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')],'role':_0x47a5('0x61')},'attributes':['id',_0x47a5('0x37'),_0x47a5('0x71'),_0x47a5('0x72'),_0x47a5('0x73')],'raw':!![]});}return null;})[_0x47a5('0x4f')](function(_0xc69a68){if(!_0xc69a68)return null;_0x4966af[_0x47a5('0x27')][_0x47a5('0x61')]=_0xc69a68;return _0x4966af;})['then'](function(_0x1e3212){if(_0x1e3212){if(_0x943a15['body'][_0x47a5('0x74')]){_0x4966af[_0x47a5('0x27')][_0x47a5('0x75')]=util[_0x47a5('0x5e')](_0x47a5('0x76'),_0x943a15[_0x47a5('0x60')][_0x47a5('0x37')]);_0x4966af[_0x47a5('0x27')][_0x47a5('0x77')]=_0x4966af[_0x47a5('0x77')];_0x4966af[_0x47a5('0x27')][_0x47a5('0x78')]=_0x4966af[_0x47a5('0x77')];_0x4966af[_0x47a5('0x27')][_0x47a5('0x79')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4966af[_0x47a5('0x27')]},client9002)[_0x47a5('0x4f')](function(){return _0x4966af;});}return _0x4966af;}return null;})['then'](respondWithResult(_0x1c485b,null))[_0x47a5('0x29')](handleError(_0x1c485b,null));};var interaction_log=require(_0x47a5('0x7a'))(_0x47a5('0x5a'));exports[_0x47a5('0x7b')]=function(_0x3cd335,_0x930d25,_0x218dfa){var _0x1c7302={'agent':{},'channel':_0x47a5('0x5c')};if(_0x3cd335[_0x47a5('0x57')]['id']){delete _0x3cd335[_0x47a5('0x57')]['id'];}_0x3cd335['body'][_0x47a5('0x5f')]=_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')]||_0x3cd335['user']['id'];_0x1c7302[_0x47a5('0x61')]['id']=_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')];return db['OpenchannelMessage'][_0x47a5('0x54')]({'where':{'id':_0x3cd335['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x930d25,null))[_0x47a5('0x4f')](function(_0x292d9c){if(_0x292d9c){_0x1c7302[_0x47a5('0x27')]=_0x292d9c[_0x47a5('0x62')]({'plain':!![]});return db[_0x47a5('0x63')][_0x47a5('0x54')]({'where':{'id':_0x292d9c['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x930d25,null))[_0x47a5('0x4f')](function(_0x4f2361){if(_0x4f2361){_0x1c7302[_0x47a5('0x67')]=_0x4f2361[_0x47a5('0x62')]({'plain':!![]});interaction_log[_0x47a5('0x1f')](_0x47a5('0x7c'),_0x3cd335['user']['id'],_0x3cd335[_0x47a5('0x60')]['name'],_0x3cd335['user'][_0x47a5('0x69')],_0x1c7302[_0x47a5('0x67')]['id'],_0x3cd335['body']?JSON[_0x47a5('0x24')](_0x3cd335[_0x47a5('0x57')]):_0x47a5('0x7d'));return respondWithRpcPromise('RejectMessage',_0x47a5('0x7e'),_0x1c7302);}return null;})['then'](function(_0x2307da){var _0x219beb=_0x47a5('0x6c')+_0x2307da['message'][_0x47a5('0x6d')];return db[_0x47a5('0x7f')][_0x47a5('0x3e')](_0x219beb,{'type':db['Sequelize'][_0x47a5('0x6e')]['SELECT'],'raw':!![]})[_0x47a5('0x4f')](function(_0x491bb4){return _0x491bb4;});})[_0x47a5('0x4f')](function(_0x20d8bd){if(_0x20d8bd){_0x1c7302[_0x47a5('0x27')][_0x47a5('0x70')]=_0x20d8bd[0x0];if(!_0x3cd335['body'][_0x47a5('0x5f')])return;return db[_0x47a5('0x80')][_0x47a5('0x54')]({'where':{'id':_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')],'role':'agent'},'attributes':['id','name',_0x47a5('0x71'),'email',_0x47a5('0x73')],'raw':!![]});}return null;})[_0x47a5('0x4f')](function(_0x216402){if(!_0x216402)return null;_0x1c7302['message'][_0x47a5('0x61')]=_0x216402;return _0x1c7302;})[_0x47a5('0x4f')](function(_0x565fbe){if(_0x565fbe){_0x565fbe[_0x47a5('0x27')][_0x47a5('0x75')]=util[_0x47a5('0x5e')](_0x47a5('0x76'),_0x3cd335['user']['name']);_0x565fbe[_0x47a5('0x27')][_0x47a5('0x77')]=_0x1c7302['channel'];_0x565fbe[_0x47a5('0x27')][_0x47a5('0x78')]=_0x1c7302['channel'];_0x565fbe[_0x47a5('0x27')][_0x47a5('0x79')]=_0x47a5('0x7b');respondWithRpcPromise('EventManager',_0x47a5('0x81'),{'event':'rejectmessage','message':_0x565fbe[_0x47a5('0x27')]},client9002);return _0x1c7302;}return null;})['then'](respondWithResult(_0x930d25,null))[_0x47a5('0x29')](handleError(_0x930d25,null));}; \ No newline at end of file +var _0xc216=['eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','ContactId','Sequelize','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','openchannel','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','User','rejectmessage'];(function(_0xeffdda,_0x2561bf){var _0x287a2a=function(_0x3d1381){while(--_0x3d1381){_0xeffdda['push'](_0xeffdda['shift']());}};_0x287a2a(++_0x2561bf);}(_0xc216,0x10a));var _0x6c21=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xc216[_0x14a0a0];return _0x56b651;};'use strict';var emlformat=require(_0x6c21('0x0'));var rimraf=require(_0x6c21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c21('0x2'));var rp=require('request-promise');var moment=require(_0x6c21('0x3'));var BPromise=require(_0x6c21('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c21('0x5'));var sox=require(_0x6c21('0x6'));var csv=require(_0x6c21('0x7'));var ejs=require(_0x6c21('0x8'));var fs=require('fs');var fs_extra=require(_0x6c21('0x9'));var _=require('lodash');var squel=require(_0x6c21('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c21('0xb'));var Papa=require(_0x6c21('0xc'));var Redis=require(_0x6c21('0xd'));var authService=require(_0x6c21('0xe'));var qs=require(_0x6c21('0xf'));var as=require(_0x6c21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c21('0x11'))(_0x6c21('0x12'));var utils=require('../../config/utils');var config=require(_0x6c21('0x13'));var licenseUtil=require(_0x6c21('0x14'));var db=require(_0x6c21('0x15'))['db'];config[_0x6c21('0x16')]=_[_0x6c21('0x17')](config['redis'],{'host':_0x6c21('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c21('0x16')]));require('./openchannelMessage.socket')[_0x6c21('0x19')](socket);var jayson=require(_0x6c21('0x1a'));var client=jayson[_0x6c21('0x1b')][_0x6c21('0x1c')]({'port':0x232c});var client9002=jayson[_0x6c21('0x1b')][_0x6c21('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1652d3,_0x6382ae,_0x3e7fd0,_0x334fa1){return new BPromise(function(_0x1140d3,_0xf6ee39){var _0x27e374=_0x334fa1||client;return _0x27e374[_0x6c21('0x1d')](_0x1652d3,_0x3e7fd0)[_0x6c21('0x1e')](function(_0x2e049a){logger[_0x6c21('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x6382ae,_0x6c21('0x20'));logger[_0x6c21('0x21')](_0x6c21('0x22'),_0x6382ae,_0x6c21('0x20'),JSON['stringify'](_0x2e049a));if(_0x2e049a[_0x6c21('0x23')]){if(_0x2e049a[_0x6c21('0x23')][_0x6c21('0x24')]===0x1f4){logger[_0x6c21('0x23')](_0x6c21('0x25'),_0x6382ae,_0x2e049a[_0x6c21('0x23')][_0x6c21('0x26')]);return _0xf6ee39(_0x2e049a['error']['message']);}logger[_0x6c21('0x23')](_0x6c21('0x25'),_0x6382ae,_0x2e049a['error'][_0x6c21('0x26')]);return _0x1140d3(_0x2e049a['error']['message']);}else{logger['info'](_0x6c21('0x25'),_0x6382ae,'request\x20sent');_0x1140d3(_0x2e049a[_0x6c21('0x27')][_0x6c21('0x26')]);}})['catch'](function(_0x2886ab){logger['error'](_0x6c21('0x25'),_0x6382ae,_0x2886ab);_0xf6ee39(_0x2886ab);});});}function respondWithStatusCode(_0x530ae9,_0x20e351){_0x20e351=_0x20e351||0xcc;return function(_0xe1332){if(_0xe1332){return _0x530ae9[_0x6c21('0x28')](_0x20e351);}return _0x530ae9[_0x6c21('0x29')](_0x20e351)[_0x6c21('0x2a')]();};}function respondWithResult(_0x17b1c4,_0x177362){_0x177362=_0x177362||0xc8;return function(_0x232e84){if(_0x232e84){return _0x17b1c4['status'](_0x177362)['json'](_0x232e84);}};}function respondWithFilteredResult(_0x6d9ca5,_0x44a26a){return function(_0x42763a){if(_0x42763a){var _0x56da5a=typeof _0x44a26a['offset']==='undefined'&&typeof _0x44a26a[_0x6c21('0x2b')]===_0x6c21('0x2c');var _0x2bfdb2=_0x42763a[_0x6c21('0x2d')];var _0x2b3a05=_0x56da5a?0x0:_0x44a26a[_0x6c21('0x2e')];var _0x5eafd3=_0x56da5a?_0x42763a[_0x6c21('0x2d')]:_0x44a26a[_0x6c21('0x2e')]+_0x44a26a[_0x6c21('0x2b')];var _0x507744;if(_0x5eafd3>=_0x2bfdb2){_0x5eafd3=_0x2bfdb2;_0x507744=0xc8;}else{_0x507744=0xce;}_0x6d9ca5[_0x6c21('0x29')](_0x507744);return _0x6d9ca5[_0x6c21('0x2f')](_0x6c21('0x30'),_0x2b3a05+'-'+_0x5eafd3+'/'+_0x2bfdb2)[_0x6c21('0x31')](_0x42763a);}return null;};}function patchUpdates(_0x35c5e8){return function(_0x164fb3){try{jsonpatch[_0x6c21('0x32')](_0x164fb3,_0x35c5e8,!![]);}catch(_0x4528a5){return BPromise[_0x6c21('0x33')](_0x4528a5);}return _0x164fb3['save']();};}function saveUpdates(_0x46f8d3,_0xee9160){return function(_0xcc3146){if(_0xcc3146){return _0xcc3146[_0x6c21('0x34')](_0x46f8d3)[_0x6c21('0x1e')](function(_0x8da99){return _0x8da99;});}return null;};}function removeEntity(_0x2a7f01,_0x1dedf2){return function(_0x2eacce){if(_0x2eacce){return _0x2eacce[_0x6c21('0x35')]()[_0x6c21('0x1e')](function(){_0x2a7f01[_0x6c21('0x29')](0xcc)[_0x6c21('0x2a')]();});}};}function handleEntityNotFound(_0x5c1a17,_0x4197c2){return function(_0x52eb3e){if(!_0x52eb3e){_0x5c1a17['sendStatus'](0x194);}return _0x52eb3e;};}function handleError(_0x5edba5,_0x58f149){_0x58f149=_0x58f149||0x1f4;return function(_0x33e3d3){logger['error'](_0x33e3d3[_0x6c21('0x36')]);if(_0x33e3d3['name']){delete _0x33e3d3[_0x6c21('0x37')];}_0x5edba5['status'](_0x58f149)[_0x6c21('0x38')](_0x33e3d3);};}exports[_0x6c21('0x39')]=function(_0x3b38e7,_0x1eafad){var _0x335871={},_0x49ec51={},_0x337f41={'count':0x0,'rows':[]};var _0x3bff3c=_[_0x6c21('0x3a')](db[_0x6c21('0x3b')]['rawAttributes'],function(_0x5d3c8e){return{'name':_0x5d3c8e[_0x6c21('0x3c')],'type':_0x5d3c8e[_0x6c21('0x3d')][_0x6c21('0x3e')]};});_0x49ec51[_0x6c21('0x3f')]=_['map'](_0x3bff3c,_0x6c21('0x37'));_0x49ec51[_0x6c21('0x40')]=_['keys'](_0x3b38e7[_0x6c21('0x40')]);_0x49ec51['filters']=_[_0x6c21('0x41')](_0x49ec51[_0x6c21('0x3f')],_0x49ec51[_0x6c21('0x40')]);_0x335871['attributes']=_[_0x6c21('0x41')](_0x49ec51[_0x6c21('0x3f')],qs[_0x6c21('0x42')](_0x3b38e7[_0x6c21('0x40')]['fields']));_0x335871[_0x6c21('0x43')]=_0x335871['attributes'][_0x6c21('0x44')]?_0x335871[_0x6c21('0x43')]:_0x49ec51[_0x6c21('0x3f')];if(!_0x3b38e7[_0x6c21('0x40')]['hasOwnProperty'](_0x6c21('0x45'))){_0x335871[_0x6c21('0x2b')]=qs['limit'](_0x3b38e7['query'][_0x6c21('0x2b')]);_0x335871['offset']=qs[_0x6c21('0x2e')](_0x3b38e7[_0x6c21('0x40')][_0x6c21('0x2e')]);}_0x335871[_0x6c21('0x46')]=qs[_0x6c21('0x47')](_0x3b38e7[_0x6c21('0x40')][_0x6c21('0x47')]);_0x335871['where']=qs['filters'](_[_0x6c21('0x48')](_0x3b38e7[_0x6c21('0x40')],_0x49ec51[_0x6c21('0x49')]),_0x3bff3c);if(_0x3b38e7['query'][_0x6c21('0x4a')]){_0x335871[_0x6c21('0x4b')]=_[_0x6c21('0x4c')](_0x335871[_0x6c21('0x4b')],{'$or':_[_0x6c21('0x3a')](_0x3bff3c,function(_0x1e412c){if(_0x1e412c['type']!==_0x6c21('0x4d')){var _0x2d88ad={};_0x2d88ad[_0x1e412c[_0x6c21('0x37')]]={'$like':'%'+_0x3b38e7[_0x6c21('0x40')][_0x6c21('0x4a')]+'%'};return _0x2d88ad;}})});}_0x335871=_[_0x6c21('0x4c')]({},_0x335871,_0x3b38e7[_0x6c21('0x4e')]);var _0x519673={'where':_0x335871[_0x6c21('0x4b')]};return db[_0x6c21('0x3b')][_0x6c21('0x2d')](_0x519673)['then'](function(_0x2077ba){_0x337f41[_0x6c21('0x2d')]=_0x2077ba;if(_0x3b38e7[_0x6c21('0x40')][_0x6c21('0x4f')]){_0x335871[_0x6c21('0x50')]=[{'all':!![]}];}return db[_0x6c21('0x3b')][_0x6c21('0x51')](_0x335871);})['then'](function(_0x2a8dc7){_0x337f41[_0x6c21('0x52')]=_0x2a8dc7;return _0x337f41;})['then'](respondWithFilteredResult(_0x1eafad,_0x335871))[_0x6c21('0x53')](handleError(_0x1eafad,null));};exports[_0x6c21('0x54')]=function(_0x2b0a2a,_0x3fd359){var _0x4131c3={'raw':!![],'where':{'id':_0x2b0a2a[_0x6c21('0x55')]['id']}},_0x51ee1c={};_0x51ee1c[_0x6c21('0x3f')]=_[_0x6c21('0x56')](db['OpenchannelMessage'][_0x6c21('0x57')]);_0x51ee1c[_0x6c21('0x40')]=_['keys'](_0x2b0a2a[_0x6c21('0x40')]);_0x51ee1c['filters']=_['intersection'](_0x51ee1c[_0x6c21('0x3f')],_0x51ee1c['query']);_0x4131c3[_0x6c21('0x43')]=_[_0x6c21('0x41')](_0x51ee1c[_0x6c21('0x3f')],qs[_0x6c21('0x42')](_0x2b0a2a[_0x6c21('0x40')]['fields']));_0x4131c3[_0x6c21('0x43')]=_0x4131c3[_0x6c21('0x43')][_0x6c21('0x44')]?_0x4131c3[_0x6c21('0x43')]:_0x51ee1c[_0x6c21('0x3f')];if(_0x2b0a2a[_0x6c21('0x40')][_0x6c21('0x4f')]){_0x4131c3[_0x6c21('0x50')]=[{'all':!![]}];}_0x4131c3=_['merge']({},_0x4131c3,_0x2b0a2a[_0x6c21('0x4e')]);return db[_0x6c21('0x3b')][_0x6c21('0x58')](_0x4131c3)[_0x6c21('0x1e')](handleEntityNotFound(_0x3fd359,null))[_0x6c21('0x1e')](respondWithResult(_0x3fd359,null))['catch'](handleError(_0x3fd359,null));};exports[_0x6c21('0x59')]=function(_0x187c79,_0x531ec5){return db['OpenchannelMessage'][_0x6c21('0x59')](_0x187c79[_0x6c21('0x5a')],{})['then'](respondWithResult(_0x531ec5,0xc9))[_0x6c21('0x53')](handleError(_0x531ec5,null));};exports['update']=function(_0x291525,_0x367e82){if(_0x291525[_0x6c21('0x5a')]['id']){delete _0x291525['body']['id'];}return db[_0x6c21('0x3b')][_0x6c21('0x58')]({'where':{'id':_0x291525[_0x6c21('0x55')]['id']}})['then'](handleEntityNotFound(_0x367e82,null))[_0x6c21('0x1e')](saveUpdates(_0x291525['body'],null))[_0x6c21('0x1e')](respondWithResult(_0x367e82,null))['catch'](handleError(_0x367e82,null));};exports[_0x6c21('0x35')]=function(_0x1177c3,_0x2733a2){return db[_0x6c21('0x3b')][_0x6c21('0x58')]({'where':{'id':_0x1177c3[_0x6c21('0x55')]['id']}})[_0x6c21('0x1e')](handleEntityNotFound(_0x2733a2,null))[_0x6c21('0x1e')](removeEntity(_0x2733a2,null))[_0x6c21('0x53')](handleError(_0x2733a2,null));};exports[_0x6c21('0x5b')]=function(_0x588214,_0x2fe894){return db[_0x6c21('0x3b')][_0x6c21('0x5b')]()[_0x6c21('0x1e')](respondWithResult(_0x2fe894,null))[_0x6c21('0x53')](handleError(_0x2fe894,null));};var interaction_log=require(_0x6c21('0x11'))(_0x6c21('0x5c'));exports[_0x6c21('0x5d')]=function(_0x39e539,_0x2134b4,_0x576836){var _0x148887={'agent':{},'channel':'openchannel'};if(_0x39e539['body']['id']){delete _0x39e539[_0x6c21('0x5a')]['id'];}_0x39e539[_0x6c21('0x5a')][_0x6c21('0x5e')]=!![];_0x39e539['body'][_0x6c21('0x5f')]=moment()[_0x6c21('0x60')](_0x6c21('0x61'));_0x39e539['body'][_0x6c21('0x62')]=_0x39e539[_0x6c21('0x5a')][_0x6c21('0x62')]||_0x39e539[_0x6c21('0x63')]['id'];_0x148887[_0x6c21('0x64')]['id']=_0x39e539[_0x6c21('0x5a')][_0x6c21('0x62')];return db[_0x6c21('0x3b')]['find']({'where':{'id':_0x39e539['params']['id'],'UserId':null}})[_0x6c21('0x1e')](handleEntityNotFound(_0x2134b4,null))['then'](saveUpdates(_0x39e539[_0x6c21('0x5a')],null))[_0x6c21('0x1e')](function(_0x4eedfc){if(_0x4eedfc){_0x148887[_0x6c21('0x26')]=_0x4eedfc['get']({'plain':!![]});return db[_0x6c21('0x65')][_0x6c21('0x58')]({'where':{'id':_0x4eedfc[_0x6c21('0x66')]}});}return null;})[_0x6c21('0x1e')](handleEntityNotFound(_0x2134b4,null))[_0x6c21('0x1e')](function(_0x183190){if(_0x183190){return _0x183190[_0x6c21('0x34')]({'UserId':_0x39e539[_0x6c21('0x5a')][_0x6c21('0x62')],'read1stAt':_[_0x6c21('0x67')](_0x183190['read1stAt'])?moment()[_0x6c21('0x60')](_0x6c21('0x61')):undefined});}return null;})[_0x6c21('0x1e')](function(_0x371b9f){if(_0x371b9f){_0x148887[_0x6c21('0x68')]=_0x371b9f[_0x6c21('0x69')]({'plain':!![]});interaction_log[_0x6c21('0x1f')](_0x6c21('0x6a'),_0x39e539[_0x6c21('0x63')]['id'],_0x39e539[_0x6c21('0x63')][_0x6c21('0x37')],_0x39e539[_0x6c21('0x63')]['role'],_0x148887[_0x6c21('0x68')]['id'],_0x39e539[_0x6c21('0x5a')]?JSON[_0x6c21('0x6b')](_0x39e539[_0x6c21('0x5a')]):'null');return respondWithRpcPromise(_0x6c21('0x6c'),_0x6c21('0x6d'),_0x148887);}return null;})[_0x6c21('0x1e')](function(_0x4cf956){var _0x2d3223='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4cf956[_0x6c21('0x26')][_0x6c21('0x6e')];return db['sequelize'][_0x6c21('0x40')](_0x2d3223,{'type':db[_0x6c21('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6c21('0x1e')](function(_0x9c4496){return _0x9c4496;});})[_0x6c21('0x1e')](function(_0x40e9cc){if(_0x40e9cc){_0x148887[_0x6c21('0x26')][_0x6c21('0x70')]=_0x40e9cc[0x0];if(!_0x39e539['body'][_0x6c21('0x62')])return;return db['User'][_0x6c21('0x58')]({'where':{'id':_0x39e539[_0x6c21('0x5a')][_0x6c21('0x62')],'role':_0x6c21('0x64')},'attributes':['id',_0x6c21('0x37'),_0x6c21('0x71'),_0x6c21('0x72'),_0x6c21('0x73')],'raw':!![]});}return null;})[_0x6c21('0x1e')](function(_0x5631cb){if(!_0x5631cb)return null;_0x148887['message'][_0x6c21('0x64')]=_0x5631cb;return _0x148887;})[_0x6c21('0x1e')](function(_0x2fb071){if(_0x2fb071){if(_0x39e539[_0x6c21('0x5a')][_0x6c21('0x74')]){_0x148887[_0x6c21('0x26')][_0x6c21('0x75')]=util['format'](_0x6c21('0x76'),_0x39e539[_0x6c21('0x63')][_0x6c21('0x37')]);_0x148887[_0x6c21('0x26')][_0x6c21('0x77')]=_0x148887[_0x6c21('0x77')];_0x148887[_0x6c21('0x26')][_0x6c21('0x78')]=_0x148887[_0x6c21('0x77')];_0x148887[_0x6c21('0x26')][_0x6c21('0x79')]=_0x6c21('0x5d');return respondWithRpcPromise(_0x6c21('0x7a'),_0x6c21('0x7a'),{'event':'acceptmessage','message':_0x148887['message']},client9002)[_0x6c21('0x1e')](function(){return _0x148887;});}return _0x148887;}return null;})[_0x6c21('0x1e')](respondWithResult(_0x2134b4,null))[_0x6c21('0x53')](handleError(_0x2134b4,null));};var interaction_log=require(_0x6c21('0x11'))('openchannel-interactions');exports[_0x6c21('0x33')]=function(_0x5212e7,_0x299415,_0x1b9148){var _0x45b1f8={'agent':{},'channel':_0x6c21('0x7b')};if(_0x5212e7[_0x6c21('0x5a')]['id']){delete _0x5212e7[_0x6c21('0x5a')]['id'];}_0x5212e7['body'][_0x6c21('0x62')]=_0x5212e7['body']['UserId']||_0x5212e7['user']['id'];_0x45b1f8['agent']['id']=_0x5212e7['body'][_0x6c21('0x62')];return db[_0x6c21('0x3b')]['find']({'where':{'id':_0x5212e7[_0x6c21('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x299415,null))[_0x6c21('0x1e')](function(_0x230368){if(_0x230368){_0x45b1f8['message']=_0x230368['get']({'plain':!![]});return db[_0x6c21('0x65')][_0x6c21('0x58')]({'where':{'id':_0x230368[_0x6c21('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x299415,null))[_0x6c21('0x1e')](function(_0x1d32ad){if(_0x1d32ad){_0x45b1f8[_0x6c21('0x68')]=_0x1d32ad['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5212e7['user']['id'],_0x5212e7['user']['name'],_0x5212e7[_0x6c21('0x63')][_0x6c21('0x7c')],_0x45b1f8[_0x6c21('0x68')]['id'],_0x5212e7[_0x6c21('0x5a')]?JSON['stringify'](_0x5212e7['body']):_0x6c21('0x7d'));return respondWithRpcPromise(_0x6c21('0x7e'),_0x6c21('0x7f'),_0x45b1f8);}return null;})['then'](function(_0x1bb5ea){var _0x33f155=_0x6c21('0x80')+_0x1bb5ea[_0x6c21('0x26')][_0x6c21('0x6e')];return db[_0x6c21('0x81')][_0x6c21('0x40')](_0x33f155,{'type':db[_0x6c21('0x6f')][_0x6c21('0x82')]['SELECT'],'raw':!![]})['then'](function(_0x3a66ac){return _0x3a66ac;});})[_0x6c21('0x1e')](function(_0x1bbb9a){if(_0x1bbb9a){_0x45b1f8[_0x6c21('0x26')][_0x6c21('0x70')]=_0x1bbb9a[0x0];if(!_0x5212e7[_0x6c21('0x5a')][_0x6c21('0x62')])return;return db[_0x6c21('0x83')]['find']({'where':{'id':_0x5212e7[_0x6c21('0x5a')][_0x6c21('0x62')],'role':_0x6c21('0x64')},'attributes':['id','name',_0x6c21('0x71'),_0x6c21('0x72'),_0x6c21('0x73')],'raw':!![]});}return null;})['then'](function(_0x470486){if(!_0x470486)return null;_0x45b1f8[_0x6c21('0x26')][_0x6c21('0x64')]=_0x470486;return _0x45b1f8;})['then'](function(_0x476aab){if(_0x476aab){_0x476aab[_0x6c21('0x26')][_0x6c21('0x75')]=util[_0x6c21('0x60')]('SIP/%s',_0x5212e7['user'][_0x6c21('0x37')]);_0x476aab[_0x6c21('0x26')]['channel']=_0x45b1f8[_0x6c21('0x77')];_0x476aab[_0x6c21('0x26')][_0x6c21('0x78')]=_0x45b1f8[_0x6c21('0x77')];_0x476aab['message'][_0x6c21('0x79')]=_0x6c21('0x33');respondWithRpcPromise(_0x6c21('0x7a'),_0x6c21('0x7a'),{'event':_0x6c21('0x84'),'message':_0x476aab[_0x6c21('0x26')]},client9002);return _0x45b1f8;}return null;})[_0x6c21('0x1e')](respondWithResult(_0x299415,null))[_0x6c21('0x53')](handleError(_0x299415,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 16a3a4f..831c233 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 _0x1346=['hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x222111,_0x408476){var _0x51106f=function(_0x5b4b02){while(--_0x5b4b02){_0x222111['push'](_0x222111['shift']());}};_0x51106f(++_0x408476);}(_0x1346,0xad));var _0x6134=function(_0x36713f,_0x1e9949){_0x36713f=_0x36713f-0x0;var _0x3e5ffe=_0x1346[_0x36713f];return _0x3e5ffe;};'use strict';var EventEmitter=require(_0x6134('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6134('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6134('0x2')](0x0);var events={'afterCreate':_0x6134('0x3'),'afterUpdate':_0x6134('0x4'),'afterDestroy':_0x6134('0x5')};function emitEvent(_0x4d0488){return function(_0x5caa26,_0x30c095,_0x87866d){OpenchannelMessageEvents[_0x6134('0x6')](_0x4d0488+':'+_0x5caa26['id'],_0x5caa26);OpenchannelMessageEvents['emit'](_0x4d0488,_0x5caa26);_0x87866d(null);};}for(var e in events){if(events[_0x6134('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6134('0x8')](e,emitEvent(event));}}module[_0x6134('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xf81c=['events','../../mysqldb','OpenchannelMessage','save','update','emit','hasOwnProperty','hook'];(function(_0xa6b2e0,_0x592d1c){var _0x328fb3=function(_0x17eaca){while(--_0x17eaca){_0xa6b2e0['push'](_0xa6b2e0['shift']());}};_0x328fb3(++_0x592d1c);}(_0xf81c,0x188));var _0xcf81=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0xf81c[_0x1af482];return _0x7e7580;};'use strict';var EventEmitter=require(_0xcf81('0x0'));var OpenchannelMessage=require(_0xcf81('0x1'))['db'][_0xcf81('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcf81('0x3'),'afterUpdate':_0xcf81('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1aa456){return function(_0x1f8373,_0x719837,_0x394312){OpenchannelMessageEvents[_0xcf81('0x5')](_0x1aa456+':'+_0x1f8373['id'],_0x1f8373);OpenchannelMessageEvents[_0xcf81('0x5')](_0x1aa456,_0x1f8373);_0x394312(null);};}for(var e in events){if(events[_0xcf81('0x6')](e)){var event=events[e];OpenchannelMessage[_0xcf81('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b8cb0a1..2f25a68 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 _0xb7d4=['isNil','findOne','OpenchannelInteractionId','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x5efc71,_0x44d64a){var _0x1e2cf9=function(_0xe13238){while(--_0xe13238){_0x5efc71['push'](_0x5efc71['shift']());}};_0x1e2cf9(++_0x44d64a);}(_0xb7d4,0xde));var _0x4b7d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7d4[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0x4b7d('0x0'));var logger=require(_0x4b7d('0x1'))(_0x4b7d('0x2'));var moment=require(_0x4b7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b7d('0x4'));var rimraf=require(_0x4b7d('0x5'));var config=require(_0x4b7d('0x6'));var attributes=require(_0x4b7d('0x7'));module['exports']=function(_0x6507d,_0x2168da){return _0x6507d[_0x4b7d('0x8')](_0x4b7d('0x9'),attributes,{'tableName':_0x4b7d('0xa'),'paranoid':![],'indexes':[{'name':_0x4b7d('0xb'),'fields':[_0x4b7d('0xc')],'type':_0x4b7d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x219b02,_0x94a5bf,_0x3c0717){var _0x537606=_0x6507d['models'];var _0x2b5522=_0x219b02[_0x4b7d('0xe')]({'plain':!![]});if(_0x2b5522[_0x4b7d('0xf')]['toLowerCase']()==='in'||_0x2b5522[_0x4b7d('0xf')][_0x4b7d('0x10')]()===_0x4b7d('0x11')&&!_0x2b5522['secret']&&!_[_0x4b7d('0x12')](_0x2b5522['UserId'])){_0x537606['OpenchannelInteraction'][_0x4b7d('0x13')]({'where':{'id':_0x2b5522[_0x4b7d('0x14')]}})[_0x4b7d('0x15')](function(_0x513640){if(_0x513640){_0x513640[_0x4b7d('0x16')]({'lastMsgAt':_0x2b5522['createdAt'],'lastMsgDirection':_0x2b5522[_0x4b7d('0xf')][_0x4b7d('0x10')]()});}})[_0x4b7d('0x17')](function(_0x2c7e9e){console[_0x4b7d('0x18')](_0x2c7e9e);});}if(_0x2b5522[_0x4b7d('0xf')]===_0x4b7d('0x11')&&!_0x2b5522[_0x4b7d('0x19')]){var _0xf38f07;_0x537606[_0x4b7d('0x1a')][_0x4b7d('0x1b')]()[_0x4b7d('0x15')](function(_0x143dad){return _0x537606[_0x4b7d('0x1c')][_0x4b7d('0x1d')]({'where':{'id':_0x2b5522['OpenchannelAccountId']},'include':[{'model':_0x537606[_0x4b7d('0x1e')],'as':_0x4b7d('0x1f'),'where':{'id':_0x2b5522[_0x4b7d('0x14')]},'limit':0x1,'include':[{'model':_0x537606['CmContact'],'as':_0x4b7d('0x20'),'attributes':_[_0x4b7d('0x21')](_0x143dad)}]}]});})[_0x4b7d('0x15')](function(_0x362541){_0xf38f07=_0x362541[_0x4b7d('0xe')]({'plain':!![]});if(_0xf38f07&&_0xf38f07[_0x4b7d('0x22')]){logger[_0x4b7d('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b7d('0x24'),util[_0x4b7d('0x25')](_0x4b7d('0x26'),_0x2b5522['id'],_0xf38f07[_0x4b7d('0x22')]));if(_0xf38f07[_0x4b7d('0x1f')]&&_0xf38f07[_0x4b7d('0x1f')][_0x4b7d('0x27')]){_0x2b5522[_0x4b7d('0x28')]=_['omit'](_0xf38f07[_0x4b7d('0x1f')][0x0],_0x4b7d('0x20'));_0x2b5522['Contact']=_0xf38f07['Interactions'][0x0][_0x4b7d('0x20')];}var _0x94a5bf={'method':'POST','uri':encodeURI(_0xf38f07[_0x4b7d('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x94a5bf['method']){case _0x4b7d('0x29'):_0x94a5bf['qs']=_0x2b5522;break;case'POST':_0x94a5bf[_0x4b7d('0xc')]=_0x2b5522;break;}return rp(_0x94a5bf)[_0x4b7d('0x15')](function(_0x207b3f){logger[_0x4b7d('0x23')](_0x4b7d('0x2a'),_0x4b7d('0x24'),util[_0x4b7d('0x25')](_0x4b7d('0x2b'),_0x2b5522['id'],_0xf38f07[_0x4b7d('0x22')]));if(_0x207b3f['body'][_0x4b7d('0x2c')]&&_0x207b3f[_0x4b7d('0xc')][_0x4b7d('0x2c')]!=_0x2b5522[_0x4b7d('0x28')][_0x4b7d('0x2c')]){return _0x537606[_0x4b7d('0x1e')][_0x4b7d('0x16')]({'threadId':_0x207b3f[_0x4b7d('0xc')][_0x4b7d('0x2c')]},{'where':{'id':_0x2b5522[_0x4b7d('0x28')]['id']}});}else{return;}})[_0x4b7d('0x15')](function(){return _0x219b02[_0x4b7d('0x16')]({'read':!![]});})[_0x4b7d('0x17')](function(_0x502835){logger[_0x4b7d('0x18')](_0x4b7d('0x2a'),'afterCreate',util[_0x4b7d('0x2d')](_0x502835,{'showHidden':![],'depth':null}));_0x3c0717();});}else{_0x3c0717();}})[_0x4b7d('0x2e')](function(){_0x3c0717();});}else{_0x3c0717();}}},'charset':'utf8mb4','collate':_0x4b7d('0x2f')});}; \ No newline at end of file +var _0xe69c=['replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','threadId','catch','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys'];(function(_0x463553,_0xdff963){var _0x4576df=function(_0x4cd44a){while(--_0x4cd44a){_0x463553['push'](_0x463553['shift']());}};_0x4576df(++_0xdff963);}(_0xe69c,0xd2));var _0xce69=function(_0x5c38d1,_0x4b6667){_0x5c38d1=_0x5c38d1-0x0;var _0x1a070c=_0xe69c[_0x5c38d1];return _0x1a070c;};'use strict';var _=require(_0xce69('0x0'));var util=require(_0xce69('0x1'));var logger=require(_0xce69('0x2'))(_0xce69('0x3'));var moment=require('moment');var BPromise=require(_0xce69('0x4'));var rp=require(_0xce69('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce69('0x6'));var attributes=require(_0xce69('0x7'));module[_0xce69('0x8')]=function(_0x321bd1,_0x55e29c){return _0x321bd1[_0xce69('0x9')]('OpenchannelMessage',attributes,{'tableName':_0xce69('0xa'),'paranoid':![],'indexes':[{'name':_0xce69('0xb'),'fields':[_0xce69('0xc')],'type':_0xce69('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x203d61,_0x566765,_0x3b84bf){var _0x56e4f9=_0x321bd1[_0xce69('0xe')];var _0x1e41c7=_0x203d61[_0xce69('0xf')]({'plain':!![]});if(_0x1e41c7['direction'][_0xce69('0x10')]()==='in'||_0x1e41c7[_0xce69('0x11')][_0xce69('0x10')]()===_0xce69('0x12')&&!_0x1e41c7[_0xce69('0x13')]&&!_[_0xce69('0x14')](_0x1e41c7[_0xce69('0x15')])){_0x56e4f9[_0xce69('0x16')]['findOne']({'where':{'id':_0x1e41c7[_0xce69('0x17')]}})[_0xce69('0x18')](function(_0x2670b4){if(_0x2670b4){_0x2670b4[_0xce69('0x19')]({'lastMsgAt':_0x1e41c7[_0xce69('0x1a')],'lastMsgDirection':_0x1e41c7['direction'][_0xce69('0x10')]()});}})['catch'](function(_0x3db372){console[_0xce69('0x1b')](_0x3db372);});}if(_0x1e41c7[_0xce69('0x11')]===_0xce69('0x12')&&!_0x1e41c7['secret']){var _0x29320a;_0x56e4f9[_0xce69('0x1c')]['describe']()['then'](function(_0x581259){return _0x56e4f9[_0xce69('0x1d')][_0xce69('0x1e')]({'where':{'id':_0x1e41c7[_0xce69('0x1f')]},'include':[{'model':_0x56e4f9['OpenchannelInteraction'],'as':_0xce69('0x20'),'where':{'id':_0x1e41c7[_0xce69('0x17')]},'limit':0x1,'include':[{'model':_0x56e4f9[_0xce69('0x1c')],'as':_0xce69('0x21'),'attributes':_[_0xce69('0x22')](_0x581259)}]}]});})[_0xce69('0x18')](function(_0x3691ba){_0x29320a=_0x3691ba[_0xce69('0xf')]({'plain':!![]});if(_0x29320a&&_0x29320a[_0xce69('0x23')]){logger[_0xce69('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xce69('0x25'),util[_0xce69('0x26')](_0xce69('0x27'),_0x1e41c7['id'],_0x29320a[_0xce69('0x23')]));if(_0x29320a['Interactions']&&_0x29320a[_0xce69('0x20')][_0xce69('0x28')]){_0x1e41c7[_0xce69('0x29')]=_[_0xce69('0x2a')](_0x29320a[_0xce69('0x20')][0x0],_0xce69('0x21'));_0x1e41c7['Contact']=_0x29320a[_0xce69('0x20')][0x0]['Contact'];}var _0x566765={'method':'POST','uri':encodeURI(_0x29320a[_0xce69('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x566765['method']){case _0xce69('0x2b'):_0x566765['qs']=_0x1e41c7;break;case'POST':_0x566765['body']=_0x1e41c7;break;}return rp(_0x566765)[_0xce69('0x18')](function(_0x2744f9){logger[_0xce69('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xce69('0x25'),util[_0xce69('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1e41c7['id'],_0x29320a['replyUri']));if(_0x2744f9[_0xce69('0xc')][_0xce69('0x2c')]&&_0x2744f9[_0xce69('0xc')][_0xce69('0x2c')]!=_0x1e41c7['Interaction'][_0xce69('0x2c')]){return _0x56e4f9[_0xce69('0x16')]['update']({'threadId':_0x2744f9[_0xce69('0xc')][_0xce69('0x2c')]},{'where':{'id':_0x1e41c7['Interaction']['id']}});}else{return;}})[_0xce69('0x18')](function(){return _0x203d61[_0xce69('0x19')]({'read':!![]});})[_0xce69('0x2d')](function(_0x3e7bd3){logger[_0xce69('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0xce69('0x25'),util[_0xce69('0x2e')](_0x3e7bd3,{'showHidden':![],'depth':null}));_0x3b84bf();});}else{_0x3b84bf();}})[_0xce69('0x2f')](function(){_0x3b84bf();});}else{_0x3b84bf();}}},'charset':_0xce69('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 35ba705..8d14df0 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x5714e2,_0x1cd5fa){var _0x215fdc=function(_0x2cc3ab){while(--_0x2cc3ab){_0x5714e2['push'](_0x5714e2['shift']());}};_0x215fdc(++_0x1cd5fa);}(_0x2ef3,0xba));var _0x32ef=function(_0x3be0c6,_0x3abeb9){_0x3be0c6=_0x3be0c6-0x0;var _0x586476=_0x2ef3[_0x3be0c6];return _0x586476;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5b3344,_0x50f3a0){var _0x1c73d5=function(_0x55070e){while(--_0x55070e){_0x5b3344['push'](_0x5b3344['shift']());}};_0x1c73d5(++_0x50f3a0);}(_0x7a54,0x106));var _0x47a5=function(_0x41e28b,_0x1f1875){_0x41e28b=_0x41e28b-0x0;var _0x38b2db=_0x7a54[_0x41e28b];return _0x38b2db;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7fea125..855879a 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 _0xde4e=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x3fdf47,_0x4c03a1){var _0x409a13=function(_0xbfa315){while(--_0xbfa315){_0x3fdf47['push'](_0x3fdf47['shift']());}};_0x409a13(++_0x4c03a1);}(_0xde4e,0x18e));var _0xede4=function(_0xe21c76,_0x342419){_0xe21c76=_0xe21c76-0x0;var _0x4ac159=_0xde4e[_0xe21c76];return _0x4ac159;};'use strict';var OpenchannelMessageEvents=require(_0xede4('0x0'));var events=[_0xede4('0x1'),'remove',_0xede4('0x2')];function createListener(_0x30eebc,_0x64ee1b){return function(_0x255044){_0x64ee1b[_0xede4('0x3')](_0x30eebc,_0x255044);};}function removeListener(_0x43e5d6,_0x3d42c7){return function(){OpenchannelMessageEvents[_0xede4('0x4')](_0x43e5d6,_0x3d42c7);};}exports[_0xede4('0x5')]=function(_0x4bec4f){for(var _0x39065d=0x0,_0x2c2bdf=events[_0xede4('0x6')];_0x39065d<_0x2c2bdf;_0x39065d++){var _0x387be8=events[_0x39065d];var _0x22b2e6=createListener(_0xede4('0x7')+_0x387be8,_0x4bec4f);OpenchannelMessageEvents['on'](_0x387be8,_0x22b2e6);}}; \ No newline at end of file +var _0xf379=['emit','removeListener','./openchannelMessage.events','save','update'];(function(_0x58c818,_0x5d51aa){var _0x3f13c4=function(_0x1b17f8){while(--_0x1b17f8){_0x58c818['push'](_0x58c818['shift']());}};_0x3f13c4(++_0x5d51aa);}(_0xf379,0x7a));var _0x9f37=function(_0x3422a0,_0x4f39f7){_0x3422a0=_0x3422a0-0x0;var _0x3aa9cd=_0xf379[_0x3422a0];return _0x3aa9cd;};'use strict';var OpenchannelMessageEvents=require(_0x9f37('0x0'));var events=[_0x9f37('0x1'),'remove',_0x9f37('0x2')];function createListener(_0x12c96c,_0x532829){return function(_0x144465){_0x532829[_0x9f37('0x3')](_0x12c96c,_0x144465);};}function removeListener(_0x69b69f,_0x3fa6de){return function(){OpenchannelMessageEvents[_0x9f37('0x4')](_0x69b69f,_0x3fa6de);};}exports['register']=function(_0x599bd8){for(var _0x58e8d9=0x0,_0xc31cf7=events['length'];_0x58e8d9<_0xc31cf7;_0x58e8d9++){var _0x336ce4=events[_0x58e8d9];var _0x9e374e=createListener('openchannelMessage:'+_0x336ce4,_0x599bd8);OpenchannelMessageEvents['on'](_0x336ce4,_0x9e374e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4e16126..526321b 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 _0x28e1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeTeams','exports'];(function(_0x237eb2,_0x48ed97){var _0x44cf6a=function(_0x44c170){while(--_0x44c170){_0x237eb2['push'](_0x237eb2['shift']());}};_0x44cf6a(++_0x48ed97);}(_0x28e1,0xf0));var _0x128e=function(_0x4a5755,_0x25a4f2){_0x4a5755=_0x4a5755-0x0;var _0x7b8985=_0x28e1[_0x4a5755];return _0x7b8985;};'use strict';var multer=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var path=require(_0x128e('0x2'));var timeout=require(_0x128e('0x3'));var express=require(_0x128e('0x4'));var router=express[_0x128e('0x5')]();var fs_extra=require(_0x128e('0x6'));var auth=require(_0x128e('0x7'));var interaction=require(_0x128e('0x8'));var config=require(_0x128e('0x9'));var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x128e('0xa')]);router[_0x128e('0xb')](_0x128e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x128e('0xb')](_0x128e('0xd'),auth[_0x128e('0xe')](),controller[_0x128e('0xf')]);router['get'](_0x128e('0x10'),auth[_0x128e('0xe')](),controller[_0x128e('0x11')]);router['get'](_0x128e('0x12'),auth['isAuthenticated'](),controller[_0x128e('0x13')]);router['get']('/:id/users',auth[_0x128e('0xe')](),controller[_0x128e('0x14')]);router[_0x128e('0x15')]('/',auth[_0x128e('0xe')](),controller[_0x128e('0x16')]);router[_0x128e('0x15')](_0x128e('0x12'),auth[_0x128e('0xe')](),controller[_0x128e('0x17')]);router[_0x128e('0x15')](_0x128e('0x18'),auth[_0x128e('0xe')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x128e('0x19')]);router[_0x128e('0x1a')](_0x128e('0xd'),auth['isAuthenticated'](),controller[_0x128e('0x1b')]);router[_0x128e('0x1a')](_0x128e('0x12'),auth[_0x128e('0xe')](),controller[_0x128e('0x1c')]);router[_0x128e('0x1a')](_0x128e('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x128e('0x1d')]=router; \ No newline at end of file +var _0x1fe3=['destroy','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete'];(function(_0x146fd9,_0x48414d){var _0x23d7bd=function(_0x3a1252){while(--_0x3a1252){_0x146fd9['push'](_0x146fd9['shift']());}};_0x23d7bd(++_0x48414d);}(_0x1fe3,0xd6));var _0x31fe=function(_0x20f00e,_0x95f173){_0x20f00e=_0x20f00e-0x0;var _0x14e7c4=_0x1fe3[_0x20f00e];return _0x14e7c4;};'use strict';var multer=require('multer');var util=require(_0x31fe('0x0'));var path=require(_0x31fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x31fe('0x2'));var router=express[_0x31fe('0x3')]();var fs_extra=require(_0x31fe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x31fe('0x5'));var config=require(_0x31fe('0x6'));var controller=require(_0x31fe('0x7'));router[_0x31fe('0x8')]('/',auth[_0x31fe('0x9')](),controller[_0x31fe('0xa')]);router[_0x31fe('0x8')](_0x31fe('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x31fe('0x8')](_0x31fe('0xc'),auth[_0x31fe('0x9')](),controller[_0x31fe('0xd')]);router[_0x31fe('0x8')](_0x31fe('0xe'),auth[_0x31fe('0x9')](),controller['getMembers']);router[_0x31fe('0x8')](_0x31fe('0xf'),auth[_0x31fe('0x9')](),controller[_0x31fe('0x10')]);router['get']('/:id/users',auth[_0x31fe('0x9')](),controller[_0x31fe('0x11')]);router[_0x31fe('0x12')]('/',auth[_0x31fe('0x9')](),controller[_0x31fe('0x13')]);router['post'](_0x31fe('0xf'),auth['isAuthenticated'](),controller[_0x31fe('0x14')]);router[_0x31fe('0x12')](_0x31fe('0x15'),auth[_0x31fe('0x9')](),controller[_0x31fe('0x16')]);router[_0x31fe('0x17')](_0x31fe('0xc'),auth['isAuthenticated'](),controller[_0x31fe('0x18')]);router[_0x31fe('0x19')]('/:id',auth[_0x31fe('0x9')](),controller[_0x31fe('0x1a')]);router['delete']('/:id/teams',auth[_0x31fe('0x9')](),controller[_0x31fe('0x1b')]);router[_0x31fe('0x19')](_0x31fe('0x15'),auth[_0x31fe('0x9')](),controller[_0x31fe('0x1c')]);module[_0x31fe('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index f7395cc..ed7b61a 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 _0x3373=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x33244d,_0x91dbef){var _0x2fe218=function(_0xf75e12){while(--_0xf75e12){_0x33244d['push'](_0x33244d['shift']());}};_0x2fe218(++_0x91dbef);}(_0x3373,0x1e0));var _0x3337=function(_0x4aa12a,_0x3702b3){_0x4aa12a=_0x4aa12a-0x0;var _0xdd0fed=_0x3373[_0x4aa12a];return _0xdd0fed;};'use strict';var Sequelize=require('sequelize');module[_0x3337('0x0')]={'name':{'type':Sequelize[_0x3337('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3337('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3337('0x3')](_0x3337('0x4'),'beepall',_0x3337('0x5'))}}; \ No newline at end of file +var _0x92e2=['ENUM','rrmemory','beepall','sequelize','exports','name','STRING','INTEGER'];(function(_0x492d2e,_0x373e4c){var _0xd1a72=function(_0x3bf836){while(--_0x3bf836){_0x492d2e['push'](_0x492d2e['shift']());}};_0xd1a72(++_0x373e4c);}(_0x92e2,0x7b));var _0x292e=function(_0x92308,_0x2c5965){_0x92308=_0x92308-0x0;var _0x3e6f92=_0x92e2[_0x92308];return _0x3e6f92;};'use strict';var Sequelize=require(_0x292e('0x0'));module[_0x292e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x292e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x292e('0x3')]},'timeout':{'type':Sequelize[_0x292e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x292e('0x5')](_0x292e('0x6'),_0x292e('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 44cb1e1..4b6225b 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 _0x1a37=['createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','update','then','UserProfileResource','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','length','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserOpenchannelQueue','fields','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','options','findAll','User','findAndCountAll','UserId','updatedAt'];(function(_0x9ff51,_0x4c951f){var _0x31959b=function(_0x350371){while(--_0x350371){_0x9ff51['push'](_0x9ff51['shift']());}};_0x31959b(++_0x4c951f);}(_0x1a37,0x184));var _0x71a3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1a37[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x71a3('0x2'));var qs=require(_0x71a3('0x3'));var logger=require(_0x71a3('0x4'))(_0x71a3('0x5'));var config=require(_0x71a3('0x6'));var db=require(_0x71a3('0x7'))['db'];config[_0x71a3('0x8')]=_['defaults'](config['redis'],{'host':_0x71a3('0x9'),'port':0x18eb});var socket=require(_0x71a3('0xa'))(new Redis(config[_0x71a3('0x8')]));require(_0x71a3('0xb'))[_0x71a3('0xc')](socket);function respondWithStatusCode(_0x10a19d,_0xe2d6cb){_0xe2d6cb=_0xe2d6cb||0xcc;return function(_0xd939f0){if(_0xd939f0){return _0x10a19d[_0x71a3('0xd')](_0xe2d6cb);}return _0x10a19d[_0x71a3('0xe')](_0xe2d6cb)[_0x71a3('0xf')]();};}function respondWithResult(_0x284589,_0x1dbf95){_0x1dbf95=_0x1dbf95||0xc8;return function(_0x9e768d){if(_0x9e768d){return _0x284589['status'](_0x1dbf95)[_0x71a3('0x10')](_0x9e768d);}};}function respondWithFilteredResult(_0x500de5,_0x34e35f){return function(_0x30030d){if(_0x30030d){var _0x342081=typeof _0x34e35f['offset']===_0x71a3('0x11')&&typeof _0x34e35f['limit']==='undefined';var _0x165a1b=_0x30030d[_0x71a3('0x12')];var _0x40f286=_0x342081?0x0:_0x34e35f[_0x71a3('0x13')];var _0x259d6d=_0x342081?_0x30030d[_0x71a3('0x12')]:_0x34e35f[_0x71a3('0x13')]+_0x34e35f[_0x71a3('0x14')];var _0x54eb07;if(_0x259d6d>=_0x165a1b){_0x259d6d=_0x165a1b;_0x54eb07=0xc8;}else{_0x54eb07=0xce;}_0x500de5[_0x71a3('0xe')](_0x54eb07);return _0x500de5['set']('Content-Range',_0x40f286+'-'+_0x259d6d+'/'+_0x165a1b)[_0x71a3('0x10')](_0x30030d);}return null;};}function saveUpdates(_0x55e31e){return function(_0x5105ef){if(_0x5105ef){return _0x5105ef[_0x71a3('0x15')](_0x55e31e)[_0x71a3('0x16')](function(_0xb7b79a){return _0xb7b79a;});}return null;};}function removeEntity(_0xe61774){return function(_0x43c5f1){if(_0x43c5f1){return _0x43c5f1['destroy']()[_0x71a3('0x16')](function(){var _0x6f0326=_0x43c5f1['get']({'plain':!![]});var _0x4f81ea='OpenchannelQueues';return db[_0x71a3('0x17')][_0x71a3('0x18')]({'where':{'type':_0x4f81ea,'resourceId':_0x6f0326['id']}})[_0x71a3('0x16')](function(){return _0x43c5f1;});})[_0x71a3('0x16')](function(){_0xe61774['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e80be){return function(_0xa278c){if(!_0xa278c){_0x3e80be[_0x71a3('0xd')](0x194);}return _0xa278c;};}function handleError(_0x15e1c7,_0xe85ae0){_0xe85ae0=_0xe85ae0||0x1f4;return function(_0x4171a4){logger[_0x71a3('0x19')](_0x4171a4[_0x71a3('0x1a')]);if(_0x4171a4[_0x71a3('0x1b')]){delete _0x4171a4[_0x71a3('0x1b')];}_0x15e1c7[_0x71a3('0xe')](_0xe85ae0)['send'](_0x4171a4);};}exports[_0x71a3('0x1c')]=function(_0x50b9ca,_0x408b5a){var _0x2db0f4={};var _0x24e405={'count':0x0,'rows':[]};var _0x814c31=_[_0x71a3('0x1d')](db[_0x71a3('0x1e')][_0x71a3('0x1f')],function(_0x33eb2e){return{'name':_0x33eb2e[_0x71a3('0x20')],'type':_0x33eb2e[_0x71a3('0x21')]['key']};});_0x2db0f4=qs[_0x71a3('0x22')](_0x814c31,_0x50b9ca);var _0xb11800={'where':_0x2db0f4[_0x71a3('0x23')]};return db[_0x71a3('0x1e')][_0x71a3('0x12')](_0xb11800)[_0x71a3('0x16')](function(_0x39c867){_0x24e405['count']=_0x39c867;_0x2db0f4[_0x71a3('0x24')]=qs['include'](_0x50b9ca[_0x71a3('0x25')]);return db[_0x71a3('0x1e')]['findAll'](_0x2db0f4);})['then'](function(_0x27ecc1){_0x24e405[_0x71a3('0x26')]=_0x27ecc1;return _0x24e405;})[_0x71a3('0x16')](respondWithFilteredResult(_0x408b5a,_0x2db0f4))[_0x71a3('0x27')](handleError(_0x408b5a,null));};exports[_0x71a3('0x28')]=function(_0x1cb5d5,_0x32094b){var _0x1edfa9={'raw':!![],'where':{'id':_0x1cb5d5[_0x71a3('0x29')]['id']}},_0x290c83={};_0x290c83[_0x71a3('0x2a')]=_['keys'](db[_0x71a3('0x1e')][_0x71a3('0x1f')]);_0x290c83['query']=_[_0x71a3('0x2b')](_0x1cb5d5['query']);_0x290c83[_0x71a3('0x2c')]=_[_0x71a3('0x2d')](_0x290c83['model'],_0x290c83[_0x71a3('0x25')]);_0x1edfa9[_0x71a3('0x2e')]=_['intersection'](_0x290c83[_0x71a3('0x2a')],qs['fields'](_0x1cb5d5[_0x71a3('0x25')]['fields']));_0x1edfa9['attributes']=_0x1edfa9[_0x71a3('0x2e')][_0x71a3('0x2f')]?_0x1edfa9[_0x71a3('0x2e')]:_0x290c83[_0x71a3('0x2a')];if(_0x1cb5d5['query']['includeAll']){_0x1edfa9[_0x71a3('0x24')]=[{'all':!![]}];}_0x1edfa9=_[_0x71a3('0x30')]({},_0x1edfa9,_0x1cb5d5['options']);return db['OpenchannelQueue'][_0x71a3('0x31')](_0x1edfa9)[_0x71a3('0x16')](handleEntityNotFound(_0x32094b,null))[_0x71a3('0x16')](respondWithResult(_0x32094b,null))[_0x71a3('0x27')](handleError(_0x32094b,null));};exports[_0x71a3('0x32')]=function(_0x3ff2e6,_0x4308fe){return db['OpenchannelQueue']['create'](_0x3ff2e6[_0x71a3('0x33')],{})[_0x71a3('0x16')](function(_0x2d4831){var _0x181fe3=_0x3ff2e6[_0x71a3('0x34')][_0x71a3('0x35')]({'plain':!![]});if(!_0x181fe3)throw new Error(_0x71a3('0x36'));if(_0x181fe3[_0x71a3('0x37')]===_0x71a3('0x34')){var _0x176f59=_0x2d4831['get']({'plain':!![]});var _0x362003='OpenchannelQueues';return db[_0x71a3('0x38')][_0x71a3('0x31')]({'where':{'name':_0x362003,'userProfileId':_0x181fe3[_0x71a3('0x39')]},'raw':!![]})[_0x71a3('0x16')](function(_0x522664){if(_0x522664&&_0x522664['autoAssociation']===0x0){return db['UserProfileResource'][_0x71a3('0x32')]({'name':_0x176f59[_0x71a3('0x1b')],'resourceId':_0x176f59['id'],'type':_0x522664[_0x71a3('0x1b')],'sectionId':_0x522664['id']},{})[_0x71a3('0x16')](function(){return _0x2d4831;});}else{return _0x2d4831;}})[_0x71a3('0x27')](function(_0x19d3f6){logger[_0x71a3('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19d3f6);throw _0x19d3f6;});}return _0x2d4831;})[_0x71a3('0x16')](respondWithResult(_0x4308fe,0xc9))[_0x71a3('0x27')](handleError(_0x4308fe,null));};exports[_0x71a3('0x15')]=function(_0x3f67e4,_0x48af57){if(_0x3f67e4['body']['id']){delete _0x3f67e4[_0x71a3('0x33')]['id'];}return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x3f67e4['params']['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x48af57,null))[_0x71a3('0x16')](saveUpdates(_0x3f67e4['body'],null))[_0x71a3('0x16')](respondWithResult(_0x48af57,null))[_0x71a3('0x27')](handleError(_0x48af57,null));};exports['destroy']=function(_0x5e9a35,_0x1b6601){return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x5e9a35[_0x71a3('0x29')]['id']}})['then'](handleEntityNotFound(_0x1b6601,null))[_0x71a3('0x16')](removeEntity(_0x1b6601,null))[_0x71a3('0x27')](handleError(_0x1b6601,null));};exports[_0x71a3('0x3a')]=function(_0x3ed03f,_0x239c43){return db['OpenchannelQueue'][_0x71a3('0x3a')]()[_0x71a3('0x16')](respondWithResult(_0x239c43,null))[_0x71a3('0x27')](handleError(_0x239c43,null));};exports[_0x71a3('0x3b')]=function(_0x1a2d95,_0x598739){var _0x48949a={'raw':!![],'where':{}},_0x1d579e={},_0x141291;return db[_0x71a3('0x1e')][_0x71a3('0x3c')]({'where':{'id':_0x1a2d95[_0x71a3('0x29')]['id']}})['then'](handleEntityNotFound(_0x598739,null))['then'](function(_0x97d164){if(_0x97d164){_0x141291=_0x97d164[_0x71a3('0x35')]({'plain':!![]});_0x1d579e['model']=_[_0x71a3('0x2b')](db[_0x71a3('0x3d')]['rawAttributes']);_0x1d579e['query']=_['keys'](_0x1a2d95[_0x71a3('0x25')]);_0x1d579e[_0x71a3('0x2c')]=_[_0x71a3('0x2d')](_0x1d579e['model'],_0x1d579e[_0x71a3('0x25')]);_0x48949a[_0x71a3('0x2e')]=_[_0x71a3('0x2d')](_0x1d579e['model'],qs[_0x71a3('0x3e')](_0x1a2d95[_0x71a3('0x25')]['fields']));_0x48949a[_0x71a3('0x2e')]=_0x48949a['attributes']['length']?_0x48949a[_0x71a3('0x2e')]:_0x1d579e[_0x71a3('0x2a')];if(!_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x48949a[_0x71a3('0x14')]=qs[_0x71a3('0x14')](_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x14')]);_0x48949a['offset']=qs[_0x71a3('0x13')](_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x13')]);}_0x48949a[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0x1a2d95['query']['sort']);_0x48949a[_0x71a3('0x23')]=qs[_0x71a3('0x2c')](_[_0x71a3('0x43')](_0x1a2d95[_0x71a3('0x25')],_0x1d579e[_0x71a3('0x2c')]));_0x48949a[_0x71a3('0x23')][_0x71a3('0x44')]=_0x97d164['id'];if(_0x1a2d95['query'][_0x71a3('0x45')]){_0x48949a[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x48949a[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x48949a['attributes'],function(_0x139fd7){var _0x3be82c={};_0x3be82c[_0x139fd7]={'$like':'%'+_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x45')]+'%'};return _0x3be82c;})});}_0x48949a=_[_0x71a3('0x30')]({},_0x48949a,_0x1a2d95[_0x71a3('0x46')]);return db[_0x71a3('0x3d')][_0x71a3('0x47')](_0x48949a);}})[_0x71a3('0x16')](function(_0x174ae3){if(_0x174ae3){return db[_0x71a3('0x48')][_0x71a3('0x49')]({'where':{'id':_[_0x71a3('0x1d')](_0x174ae3,_0x71a3('0x4a')),'role':'agent'},'attributes':['id',_0x71a3('0x1b'),'openchannelPause',_0x71a3('0x4b'),_0x71a3('0x4c')]});}})['then'](function(_0x48de7f){if(_0x48de7f){return{'count':_0x48de7f[_0x71a3('0x12')],'rows':_['map'](_0x48de7f[_0x71a3('0x26')],function(_0x44e189){return{'membername':_0x44e189['name'],'UserId':_0x44e189['id'],'queue_name':_0x141291[_0x71a3('0x1b')],'OpenchannelQueueId':_0x141291['id'],'interface':util[_0x71a3('0x4d')](_0x71a3('0x4e'),_0x71a3('0x4f'),_0x44e189[_0x71a3('0x1b')]),'penalty':0x0,'paused':_0x44e189[_0x71a3('0x50')],'createdAt':_0x44e189[_0x71a3('0x4c')],'updatedAt':_0x44e189[_0x71a3('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x598739,_0x48949a))[_0x71a3('0x27')](handleError(_0x598739,null));};exports[_0x71a3('0x51')]=function(_0x5efc4c,_0x5320ac){var _0x52036e={};var _0x43b73f={};var _0x26753c;var _0xaa9c80;return db[_0x71a3('0x1e')][_0x71a3('0x3c')]({'where':{'id':_0x5efc4c[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x5320ac,null))[_0x71a3('0x16')](function(_0x100166){if(_0x100166){_0x26753c=_0x100166;_0x43b73f[_0x71a3('0x2a')]=_['keys'](db[_0x71a3('0x52')][_0x71a3('0x1f')]);_0x43b73f[_0x71a3('0x25')]=_[_0x71a3('0x2b')](_0x5efc4c['query']);_0x43b73f['filters']=_['intersection'](_0x43b73f[_0x71a3('0x2a')],_0x43b73f[_0x71a3('0x25')]);_0x52036e[_0x71a3('0x2e')]=_['intersection'](_0x43b73f[_0x71a3('0x2a')],qs[_0x71a3('0x3e')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x3e')]));_0x52036e[_0x71a3('0x2e')]=_0x52036e['attributes']['length']?_0x52036e[_0x71a3('0x2e')]:_0x43b73f[_0x71a3('0x2a')];_0x52036e['order']=qs[_0x71a3('0x42')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x42')]);_0x52036e['where']=qs['filters'](_[_0x71a3('0x43')](_0x5efc4c[_0x71a3('0x25')],_0x43b73f[_0x71a3('0x2c')]));if(_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x45')]){_0x52036e[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x52036e[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x52036e[_0x71a3('0x2e')],function(_0x266c5a){var _0x582a78={};_0x582a78[_0x266c5a]={'$like':'%'+_0x5efc4c[_0x71a3('0x25')]['filter']+'%'};return _0x582a78;})});}_0x52036e=_['merge']({},_0x52036e,_0x5efc4c[_0x71a3('0x46')]);return _0x26753c[_0x71a3('0x51')](_0x52036e);}})[_0x71a3('0x16')](function(_0x253957){if(_0x253957){_0xaa9c80=_0x253957[_0x71a3('0x2f')];if(!_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x52036e[_0x71a3('0x14')]=qs['limit'](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x14')]);_0x52036e[_0x71a3('0x13')]=qs[_0x71a3('0x13')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x13')]);}return _0x26753c[_0x71a3('0x51')](_0x52036e);}})[_0x71a3('0x16')](function(_0x4a75dd){if(_0x4a75dd){return _0x4a75dd?{'count':_0xaa9c80,'rows':_0x4a75dd}:null;}})['then'](respondWithResult(_0x5320ac,null))[_0x71a3('0x27')](handleError(_0x5320ac,null));};exports[_0x71a3('0x53')]=function(_0x2606e7,_0x757634){var _0x5c98d6=_0x2606e7[_0x71a3('0x33')][_0x71a3('0x54')];return db[_0x71a3('0x52')][_0x71a3('0x47')]({'where':{'id':_0x5c98d6},'attributes':['id'],'include':[{'model':db[_0x71a3('0x48')],'as':_0x71a3('0x55'),'attributes':['id',_0x71a3('0x1b'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0xe93409){if(_0xe93409){var _0x355014=_[_0x71a3('0x56')](_0xe93409,function(_0x280984){var _0x165ab6=_0x280984[_0x71a3('0x35')]({'plain':!![]});return _0x165ab6[_0x71a3('0x55')];});return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x2606e7[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](function(_0x46f0e8){return db[_0x71a3('0x57')][_0x71a3('0x58')](function(_0x255220){return _0x46f0e8[_0x71a3('0x53')](_0x5c98d6,{'transaction':_0x255220})[_0x71a3('0x16')](function(){return BPromise[_0x71a3('0x59')](_0x355014,function(_0x77417f){return db[_0x71a3('0x3d')]['findOrCreate']({'where':{'UserId':_0x77417f['id'],'OpenchannelQueueId':_0x2606e7['params']['id']},'transaction':_0x255220});});})[_0x71a3('0x16')](function(){_0x355014[_0x71a3('0x5a')](function(_0xa39936){socket[_0x71a3('0x5b')](_0x71a3('0x5c'),{'UserId':_0xa39936['id'],'OpenchannelQueueId':_0x46f0e8['id']});});});});});}})[_0x71a3('0x16')](respondWithStatusCode(_0x757634,null))[_0x71a3('0x27')](handleError(_0x757634,null));};exports[_0x71a3('0x5d')]=function(_0x1569d3,_0x14d7d1){return db[_0x71a3('0x52')][_0x71a3('0x47')]({'where':{'id':_0x1569d3[_0x71a3('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x71a3('0x48')],'as':_0x71a3('0x55'),'attributes':['id'],'raw':!![]}]})[_0x71a3('0x16')](handleEntityNotFound(_0x14d7d1,null))[_0x71a3('0x16')](function(_0x2f49cd){var _0x55bfce=_[_0x71a3('0x1d')](_0x2f49cd,'id');var _0x48fcd5=[];var _0x4735d3=[];var _0x3f2933=squel['select']();_0x3f2933['field']('tq.TeamId')['from']('team_has_openchannel_queues','tq')['join'](_0x71a3('0x5e'),'ut',_0x71a3('0x5f'))[_0x71a3('0x23')]('OpenchannelQueueId\x20=\x20?',_0x1569d3[_0x71a3('0x29')]['id']);for(var _0x3651ce=0x0;_0x3651ce<_0x2f49cd[_0x71a3('0x2f')];_0x3651ce+=0x1){let _0x4fdfc7=_0x2f49cd[_0x3651ce];for(var _0x32621a=0x0;_0x32621a<_0x4fdfc7[_0x71a3('0x55')][_0x71a3('0x2f')];_0x32621a+=0x1){let _0x164382=_0x4fdfc7[_0x71a3('0x55')][_0x32621a];var _0x2d3a62=_0x3f2933[_0x71a3('0x60')]();_0x2d3a62['where'](_0x71a3('0x61'),_0x164382['id']);_0x4735d3[_0x71a3('0x62')](db[_0x71a3('0x57')][_0x71a3('0x25')](_0x2d3a62[_0x71a3('0x63')](),{'type':db['sequelize'][_0x71a3('0x64')][_0x71a3('0x65')]})['then'](function(_0x3d257d){if(_0x3d257d[_0x71a3('0x2f')]===0x1){return _0x164382['id'];}else{var _0xeb802e=_[_0x71a3('0x66')](_[_0x71a3('0x1d')](_0x3d257d,_0x71a3('0x67')),function(_0x4f2bac){return _[_0x71a3('0x68')](_0x55bfce,_0x4f2bac);});if(_0xeb802e){return _0x164382['id'];}}}));}}return BPromise[_0x71a3('0x69')](_0x4735d3)[_0x71a3('0x16')](function(_0x2d9a9a){_0x48fcd5=_(_0x48fcd5)[_0x71a3('0x6a')](_0x2d9a9a)[_0x71a3('0x6b')]()[_0x71a3('0x6c')]();return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x1569d3['params']['id']}})['then'](function(_0x349276){return db['sequelize']['transaction'](function(_0x4bf3b5){return _0x349276[_0x71a3('0x5d')](_0x1569d3['query']['ids'],{'transaction':_0x4bf3b5})[_0x71a3('0x16')](function(){if(!_['isEmpty'](_0x48fcd5)){return _0x349276[_0x71a3('0x6d')](_0x48fcd5,{'transaction':_0x4bf3b5});}})[_0x71a3('0x16')](function(){_0x48fcd5[_0x71a3('0x5a')](function(_0x132d2b){socket[_0x71a3('0x5b')]('userOpenchannelQueue:remove',{'UserId':_0x132d2b,'OpenchannelQueueId':_0x349276['id']});});});});});});})[_0x71a3('0x16')](respondWithStatusCode(_0x14d7d1,null))['catch'](handleError(_0x14d7d1,null));};exports[_0x71a3('0x6e')]=function(_0x33fa4b,_0x4c1600){return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x33fa4b['params']['id']}})['then'](handleEntityNotFound(_0x4c1600,null))[_0x71a3('0x16')](function(_0x2016a8){if(_0x2016a8){return _0x2016a8['addAgents'](_0x33fa4b[_0x71a3('0x33')][_0x71a3('0x54')],_[_0x71a3('0x6f')](_0x33fa4b[_0x71a3('0x33')],[_0x71a3('0x54'),'id'])||{})[_0x71a3('0x70')](function(_0x3a801d){for(var _0x54b229=0x0;_0x54b229<_0x33fa4b['body'][_0x71a3('0x54')][_0x71a3('0x2f')];_0x54b229+=0x1){socket[_0x71a3('0x5b')](_0x71a3('0x5c'),{'UserId':Number(_0x33fa4b[_0x71a3('0x33')][_0x71a3('0x54')][_0x54b229]),'OpenchannelQueueId':Number(_0x33fa4b[_0x71a3('0x29')]['id'])});}return _0x3a801d;});}})[_0x71a3('0x16')](respondWithResult(_0x4c1600,null))[_0x71a3('0x27')](handleError(_0x4c1600,null));};exports[_0x71a3('0x6d')]=function(_0x15a5a0,_0x23f073){return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x15a5a0[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x23f073,null))[_0x71a3('0x16')](function(_0x413e27){if(_0x413e27){return _0x413e27[_0x71a3('0x6d')](_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')])[_0x71a3('0x16')](function(){if(_[_0x71a3('0x71')](_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')])){for(var _0x58af34=0x0;_0x58af34<_0x15a5a0[_0x71a3('0x25')]['ids']['length'];_0x58af34+=0x1){socket[_0x71a3('0x5b')](_0x71a3('0x72'),{'UserId':Number(_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')][_0x58af34]),'OpenchannelQueueId':Number(_0x15a5a0['params']['id'])});}}else{socket[_0x71a3('0x5b')](_0x71a3('0x72'),{'UserId':Number(_0x15a5a0['query'][_0x71a3('0x54')]),'OpenchannelQueueId':Number(_0x15a5a0[_0x71a3('0x29')]['id'])});}});}})[_0x71a3('0x16')](respondWithStatusCode(_0x23f073,null))[_0x71a3('0x27')](handleError(_0x23f073,null));};exports[_0x71a3('0x73')]=function(_0x2d87d7,_0x4db34d){var _0x331b8d={};var _0x4af2e0={};var _0x323600;var _0x5b12a3;return db['OpenchannelQueue'][_0x71a3('0x3c')]({'where':{'id':_0x2d87d7[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x4db34d,null))['then'](function(_0x46d48a){if(_0x46d48a){_0x323600=_0x46d48a;_0x4af2e0[_0x71a3('0x2a')]=_['keys'](db['User'][_0x71a3('0x1f')]);_0x4af2e0['query']=_[_0x71a3('0x2b')](_0x2d87d7[_0x71a3('0x25')]);_0x4af2e0['filters']=_[_0x71a3('0x2d')](_0x4af2e0['model'],_0x4af2e0[_0x71a3('0x25')]);_0x331b8d[_0x71a3('0x2e')]=_[_0x71a3('0x2d')](_0x4af2e0[_0x71a3('0x2a')],qs['fields'](_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x3e')]));_0x331b8d[_0x71a3('0x2e')]=_0x331b8d['attributes']['length']?_0x331b8d[_0x71a3('0x2e')]:_0x4af2e0[_0x71a3('0x2a')];_0x331b8d[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x42')]);_0x331b8d[_0x71a3('0x23')]=qs[_0x71a3('0x2c')](_[_0x71a3('0x43')](_0x2d87d7['query'],_0x4af2e0[_0x71a3('0x2c')]));if(_0x2d87d7['query']['filter']){_0x331b8d[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x331b8d[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x331b8d['attributes'],function(_0x58455d){var _0x4f1024={};_0x4f1024[_0x58455d]={'$like':'%'+_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x45')]+'%'};return _0x4f1024;})});}_0x331b8d=_['merge']({},_0x331b8d,_0x2d87d7[_0x71a3('0x46')]);return _0x323600[_0x71a3('0x73')](_0x331b8d);}})[_0x71a3('0x16')](function(_0x57c0bb){if(_0x57c0bb){_0x5b12a3=_0x57c0bb['length'];if(!_0x2d87d7['query'][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x331b8d['limit']=qs[_0x71a3('0x14')](_0x2d87d7['query']['limit']);_0x331b8d['offset']=qs['offset'](_0x2d87d7['query'][_0x71a3('0x13')]);}return _0x323600[_0x71a3('0x73')](_0x331b8d);}})['then'](function(_0x4f0943){if(_0x4f0943){return _0x4f0943?{'count':_0x5b12a3,'rows':_0x4f0943}:null;}})[_0x71a3('0x16')](respondWithResult(_0x4db34d,null))[_0x71a3('0x27')](handleError(_0x4db34d,null));}; \ No newline at end of file +var _0x864e=['TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','ids','omit','isArray','userOpenchannelQueue:remove','getAgents','findOne','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','sendStatus','error','stack','name','send','index','OpenchannelQueue','fieldName','type','getOptions','where','findAll','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','create','user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','body','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','findAndCountAll','map','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','length','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every'];(function(_0x5ca1ae,_0x27d18e){var _0x1b6a14=function(_0xe3506f){while(--_0xe3506f){_0x5ca1ae['push'](_0x5ca1ae['shift']());}};_0x1b6a14(++_0x27d18e);}(_0x864e,0x189));var _0xe864=function(_0x9f1577,_0x506939){_0x9f1577=_0x9f1577-0x0;var _0x4ffa31=_0x864e[_0x9f1577];return _0x4ffa31;};'use strict';var BPromise=require(_0xe864('0x0'));var util=require(_0xe864('0x1'));var _=require('lodash');var squel=require(_0xe864('0x2'));var Redis=require(_0xe864('0x3'));var qs=require(_0xe864('0x4'));var logger=require(_0xe864('0x5'))(_0xe864('0x6'));var config=require(_0xe864('0x7'));var db=require(_0xe864('0x8'))['db'];config[_0xe864('0x9')]=_[_0xe864('0xa')](config[_0xe864('0x9')],{'host':_0xe864('0xb'),'port':0x18eb});var socket=require(_0xe864('0xc'))(new Redis(config[_0xe864('0x9')]));require('./openchannelQueue.socket')[_0xe864('0xd')](socket);function respondWithStatusCode(_0x1b53cc,_0x233903){_0x233903=_0x233903||0xcc;return function(_0x41a140){if(_0x41a140){return _0x1b53cc['sendStatus'](_0x233903);}return _0x1b53cc[_0xe864('0xe')](_0x233903)[_0xe864('0xf')]();};}function respondWithResult(_0x3eda7e,_0x50f45f){_0x50f45f=_0x50f45f||0xc8;return function(_0x33f7b3){if(_0x33f7b3){return _0x3eda7e[_0xe864('0xe')](_0x50f45f)[_0xe864('0x10')](_0x33f7b3);}};}function respondWithFilteredResult(_0x23f88f,_0x2833c3){return function(_0x49bc0f){if(_0x49bc0f){var _0x477092=typeof _0x2833c3[_0xe864('0x11')]===_0xe864('0x12')&&typeof _0x2833c3[_0xe864('0x13')]===_0xe864('0x12');var _0x517fd2=_0x49bc0f[_0xe864('0x14')];var _0x295864=_0x477092?0x0:_0x2833c3[_0xe864('0x11')];var _0x1669e9=_0x477092?_0x49bc0f[_0xe864('0x14')]:_0x2833c3['offset']+_0x2833c3[_0xe864('0x13')];var _0x3a8497;if(_0x1669e9>=_0x517fd2){_0x1669e9=_0x517fd2;_0x3a8497=0xc8;}else{_0x3a8497=0xce;}_0x23f88f['status'](_0x3a8497);return _0x23f88f[_0xe864('0x15')](_0xe864('0x16'),_0x295864+'-'+_0x1669e9+'/'+_0x517fd2)[_0xe864('0x10')](_0x49bc0f);}return null;};}function saveUpdates(_0x279b2d){return function(_0x22b687){if(_0x22b687){return _0x22b687['update'](_0x279b2d)[_0xe864('0x17')](function(_0x43bbda){return _0x43bbda;});}return null;};}function removeEntity(_0x34de6e){return function(_0x3f3436){if(_0x3f3436){return _0x3f3436[_0xe864('0x18')]()[_0xe864('0x17')](function(){var _0x5977ed=_0x3f3436[_0xe864('0x19')]({'plain':!![]});var _0x2b9f6f='OpenchannelQueues';return db['UserProfileResource'][_0xe864('0x18')]({'where':{'type':_0x2b9f6f,'resourceId':_0x5977ed['id']}})['then'](function(){return _0x3f3436;});})[_0xe864('0x17')](function(){_0x34de6e[_0xe864('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x84ab31){return function(_0x18a7dd){if(!_0x18a7dd){_0x84ab31[_0xe864('0x1a')](0x194);}return _0x18a7dd;};}function handleError(_0x2cf5b6,_0x38ab9d){_0x38ab9d=_0x38ab9d||0x1f4;return function(_0x27d5c9){logger[_0xe864('0x1b')](_0x27d5c9[_0xe864('0x1c')]);if(_0x27d5c9[_0xe864('0x1d')]){delete _0x27d5c9[_0xe864('0x1d')];}_0x2cf5b6[_0xe864('0xe')](_0x38ab9d)[_0xe864('0x1e')](_0x27d5c9);};}exports[_0xe864('0x1f')]=function(_0x26c2ca,_0x3bcc61){var _0x36ec91={};var _0x3dd0d7={'count':0x0,'rows':[]};var _0x205f02=_['map'](db[_0xe864('0x20')]['rawAttributes'],function(_0x55f644){return{'name':_0x55f644[_0xe864('0x21')],'type':_0x55f644[_0xe864('0x22')]['key']};});_0x36ec91=qs[_0xe864('0x23')](_0x205f02,_0x26c2ca);var _0x1cbe57={'where':_0x36ec91[_0xe864('0x24')]};return db[_0xe864('0x20')][_0xe864('0x14')](_0x1cbe57)['then'](function(_0xc509ed){_0x3dd0d7[_0xe864('0x14')]=_0xc509ed;_0x36ec91['include']=qs['include'](_0x26c2ca['query']);return db[_0xe864('0x20')][_0xe864('0x25')](_0x36ec91);})[_0xe864('0x17')](function(_0x155f0c){_0x3dd0d7['rows']=_0x155f0c;return _0x3dd0d7;})[_0xe864('0x17')](respondWithFilteredResult(_0x3bcc61,_0x36ec91))[_0xe864('0x26')](handleError(_0x3bcc61,null));};exports[_0xe864('0x27')]=function(_0x221aa2,_0x40012c){var _0x3c0548={'raw':!![],'where':{'id':_0x221aa2[_0xe864('0x28')]['id']}},_0x375aec={};_0x375aec[_0xe864('0x29')]=_[_0xe864('0x2a')](db[_0xe864('0x20')][_0xe864('0x2b')]);_0x375aec[_0xe864('0x2c')]=_[_0xe864('0x2a')](_0x221aa2[_0xe864('0x2c')]);_0x375aec[_0xe864('0x2d')]=_[_0xe864('0x2e')](_0x375aec['model'],_0x375aec[_0xe864('0x2c')]);_0x3c0548[_0xe864('0x2f')]=_[_0xe864('0x2e')](_0x375aec[_0xe864('0x29')],qs[_0xe864('0x30')](_0x221aa2[_0xe864('0x2c')][_0xe864('0x30')]));_0x3c0548[_0xe864('0x2f')]=_0x3c0548[_0xe864('0x2f')]['length']?_0x3c0548[_0xe864('0x2f')]:_0x375aec[_0xe864('0x29')];if(_0x221aa2[_0xe864('0x2c')]['includeAll']){_0x3c0548[_0xe864('0x31')]=[{'all':!![]}];}_0x3c0548=_['merge']({},_0x3c0548,_0x221aa2['options']);return db[_0xe864('0x20')]['find'](_0x3c0548)[_0xe864('0x17')](handleEntityNotFound(_0x40012c,null))[_0xe864('0x17')](respondWithResult(_0x40012c,null))[_0xe864('0x26')](handleError(_0x40012c,null));};exports['create']=function(_0x37a39d,_0x16875a){return db[_0xe864('0x20')][_0xe864('0x32')](_0x37a39d['body'],{})[_0xe864('0x17')](function(_0x5d48ec){var _0x703926=_0x37a39d[_0xe864('0x33')]['get']({'plain':!![]});if(!_0x703926)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x703926[_0xe864('0x34')]===_0xe864('0x33')){var _0x19d3fb=_0x5d48ec['get']({'plain':!![]});var _0x244522=_0xe864('0x35');return db[_0xe864('0x36')][_0xe864('0x37')]({'where':{'name':_0x244522,'userProfileId':_0x703926[_0xe864('0x38')]},'raw':!![]})[_0xe864('0x17')](function(_0x231f05){if(_0x231f05&&_0x231f05[_0xe864('0x39')]===0x0){return db[_0xe864('0x3a')][_0xe864('0x32')]({'name':_0x19d3fb[_0xe864('0x1d')],'resourceId':_0x19d3fb['id'],'type':_0x231f05[_0xe864('0x1d')],'sectionId':_0x231f05['id']},{})[_0xe864('0x17')](function(){return _0x5d48ec;});}else{return _0x5d48ec;}})[_0xe864('0x26')](function(_0x2225ab){logger[_0xe864('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2225ab);throw _0x2225ab;});}return _0x5d48ec;})[_0xe864('0x17')](respondWithResult(_0x16875a,0xc9))['catch'](handleError(_0x16875a,null));};exports[_0xe864('0x3b')]=function(_0x422ff6,_0x2748f3){if(_0x422ff6[_0xe864('0x3c')]['id']){delete _0x422ff6['body']['id'];}return db['OpenchannelQueue'][_0xe864('0x37')]({'where':{'id':_0x422ff6[_0xe864('0x28')]['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x2748f3,null))[_0xe864('0x17')](saveUpdates(_0x422ff6[_0xe864('0x3c')],null))[_0xe864('0x17')](respondWithResult(_0x2748f3,null))['catch'](handleError(_0x2748f3,null));};exports[_0xe864('0x18')]=function(_0x83f0e9,_0x49a4bb){return db['OpenchannelQueue'][_0xe864('0x37')]({'where':{'id':_0x83f0e9[_0xe864('0x28')]['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x49a4bb,null))[_0xe864('0x17')](removeEntity(_0x49a4bb,null))[_0xe864('0x26')](handleError(_0x49a4bb,null));};exports['describe']=function(_0x2e9991,_0x5d600e){return db['OpenchannelQueue'][_0xe864('0x3d')]()[_0xe864('0x17')](respondWithResult(_0x5d600e,null))['catch'](handleError(_0x5d600e,null));};exports[_0xe864('0x3e')]=function(_0x29233e,_0x971c60){var _0x117e3b={'raw':!![],'where':{}},_0xb41d1b={},_0x113dbe;return db[_0xe864('0x20')]['findOne']({'where':{'id':_0x29233e['params']['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x971c60,null))[_0xe864('0x17')](function(_0x4ff89c){if(_0x4ff89c){_0x113dbe=_0x4ff89c[_0xe864('0x19')]({'plain':!![]});_0xb41d1b['model']=_[_0xe864('0x2a')](db[_0xe864('0x3f')][_0xe864('0x2b')]);_0xb41d1b[_0xe864('0x2c')]=_[_0xe864('0x2a')](_0x29233e[_0xe864('0x2c')]);_0xb41d1b[_0xe864('0x2d')]=_['intersection'](_0xb41d1b[_0xe864('0x29')],_0xb41d1b[_0xe864('0x2c')]);_0x117e3b[_0xe864('0x2f')]=_['intersection'](_0xb41d1b[_0xe864('0x29')],qs['fields'](_0x29233e[_0xe864('0x2c')][_0xe864('0x30')]));_0x117e3b['attributes']=_0x117e3b[_0xe864('0x2f')]['length']?_0x117e3b[_0xe864('0x2f')]:_0xb41d1b[_0xe864('0x29')];if(!_0x29233e['query'][_0xe864('0x40')](_0xe864('0x41'))){_0x117e3b[_0xe864('0x13')]=qs['limit'](_0x29233e[_0xe864('0x2c')][_0xe864('0x13')]);_0x117e3b[_0xe864('0x11')]=qs[_0xe864('0x11')](_0x29233e[_0xe864('0x2c')]['offset']);}_0x117e3b[_0xe864('0x42')]=qs[_0xe864('0x43')](_0x29233e[_0xe864('0x2c')][_0xe864('0x43')]);_0x117e3b[_0xe864('0x24')]=qs[_0xe864('0x2d')](_[_0xe864('0x44')](_0x29233e[_0xe864('0x2c')],_0xb41d1b[_0xe864('0x2d')]));_0x117e3b[_0xe864('0x24')]['OpenchannelQueueId']=_0x4ff89c['id'];if(_0x29233e[_0xe864('0x2c')][_0xe864('0x45')]){_0x117e3b[_0xe864('0x24')]=_['merge'](_0x117e3b['where'],{'$or':_['map'](_0x117e3b[_0xe864('0x2f')],function(_0x670792){var _0x387d06={};_0x387d06[_0x670792]={'$like':'%'+_0x29233e[_0xe864('0x2c')][_0xe864('0x45')]+'%'};return _0x387d06;})});}_0x117e3b=_[_0xe864('0x46')]({},_0x117e3b,_0x29233e[_0xe864('0x47')]);return db[_0xe864('0x3f')][_0xe864('0x25')](_0x117e3b);}})[_0xe864('0x17')](function(_0x2410f2){if(_0x2410f2){return db['User'][_0xe864('0x48')]({'where':{'id':_[_0xe864('0x49')](_0x2410f2,_0xe864('0x4a')),'role':_0xe864('0x4b')},'attributes':['id',_0xe864('0x1d'),_0xe864('0x4c'),_0xe864('0x4d'),_0xe864('0x4e')]});}})['then'](function(_0x19dd91){if(_0x19dd91){return{'count':_0x19dd91[_0xe864('0x14')],'rows':_[_0xe864('0x49')](_0x19dd91[_0xe864('0x4f')],function(_0xe1af25){return{'membername':_0xe1af25[_0xe864('0x1d')],'UserId':_0xe1af25['id'],'queue_name':_0x113dbe[_0xe864('0x1d')],'OpenchannelQueueId':_0x113dbe['id'],'interface':util['format'](_0xe864('0x50'),'SIP',_0xe1af25['name']),'penalty':0x0,'paused':_0xe1af25['openchannelPause'],'createdAt':_0xe1af25[_0xe864('0x4e')],'updatedAt':_0xe1af25[_0xe864('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe864('0x17')](respondWithFilteredResult(_0x971c60,_0x117e3b))[_0xe864('0x26')](handleError(_0x971c60,null));};exports[_0xe864('0x51')]=function(_0x9cc701,_0x2c392c){var _0x10ac37={};var _0x554369={};var _0x21ea2f;var _0x49f781;return db[_0xe864('0x20')]['findOne']({'where':{'id':_0x9cc701[_0xe864('0x28')]['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x2c392c,null))['then'](function(_0x3e6123){if(_0x3e6123){_0x21ea2f=_0x3e6123;_0x554369[_0xe864('0x29')]=_[_0xe864('0x2a')](db[_0xe864('0x52')]['rawAttributes']);_0x554369[_0xe864('0x2c')]=_[_0xe864('0x2a')](_0x9cc701[_0xe864('0x2c')]);_0x554369[_0xe864('0x2d')]=_['intersection'](_0x554369[_0xe864('0x29')],_0x554369['query']);_0x10ac37['attributes']=_[_0xe864('0x2e')](_0x554369[_0xe864('0x29')],qs[_0xe864('0x30')](_0x9cc701[_0xe864('0x2c')][_0xe864('0x30')]));_0x10ac37[_0xe864('0x2f')]=_0x10ac37['attributes'][_0xe864('0x53')]?_0x10ac37[_0xe864('0x2f')]:_0x554369[_0xe864('0x29')];_0x10ac37[_0xe864('0x42')]=qs[_0xe864('0x43')](_0x9cc701[_0xe864('0x2c')][_0xe864('0x43')]);_0x10ac37['where']=qs[_0xe864('0x2d')](_[_0xe864('0x44')](_0x9cc701[_0xe864('0x2c')],_0x554369[_0xe864('0x2d')]));if(_0x9cc701[_0xe864('0x2c')][_0xe864('0x45')]){_0x10ac37[_0xe864('0x24')]=_['merge'](_0x10ac37['where'],{'$or':_['map'](_0x10ac37['attributes'],function(_0x166555){var _0x57f99f={};_0x57f99f[_0x166555]={'$like':'%'+_0x9cc701[_0xe864('0x2c')][_0xe864('0x45')]+'%'};return _0x57f99f;})});}_0x10ac37=_[_0xe864('0x46')]({},_0x10ac37,_0x9cc701[_0xe864('0x47')]);return _0x21ea2f[_0xe864('0x51')](_0x10ac37);}})[_0xe864('0x17')](function(_0xd56ef8){if(_0xd56ef8){_0x49f781=_0xd56ef8['length'];if(!_0x9cc701['query'][_0xe864('0x40')](_0xe864('0x41'))){_0x10ac37[_0xe864('0x13')]=qs[_0xe864('0x13')](_0x9cc701[_0xe864('0x2c')][_0xe864('0x13')]);_0x10ac37['offset']=qs['offset'](_0x9cc701[_0xe864('0x2c')][_0xe864('0x11')]);}return _0x21ea2f[_0xe864('0x51')](_0x10ac37);}})[_0xe864('0x17')](function(_0x105c66){if(_0x105c66){return _0x105c66?{'count':_0x49f781,'rows':_0x105c66}:null;}})[_0xe864('0x17')](respondWithResult(_0x2c392c,null))[_0xe864('0x26')](handleError(_0x2c392c,null));};exports[_0xe864('0x54')]=function(_0x517e3a,_0x239a43){var _0x25a7b8=_0x517e3a[_0xe864('0x3c')]['ids'];return db[_0xe864('0x52')][_0xe864('0x25')]({'where':{'id':_0x25a7b8},'attributes':['id'],'include':[{'model':db[_0xe864('0x55')],'as':_0xe864('0x56'),'attributes':['id',_0xe864('0x1d'),_0xe864('0x57'),_0xe864('0x58'),_0xe864('0x59')],'raw':!![]}]})[_0xe864('0x17')](function(_0x13bc59){if(_0x13bc59){var _0x2fbff3=_[_0xe864('0x5a')](_0x13bc59,function(_0x8e548c){var _0x13ca81=_0x8e548c[_0xe864('0x19')]({'plain':!![]});return _0x13ca81[_0xe864('0x56')];});return db[_0xe864('0x20')][_0xe864('0x37')]({'where':{'id':_0x517e3a[_0xe864('0x28')]['id']}})['then'](function(_0x503c8b){return db[_0xe864('0x5b')][_0xe864('0x5c')](function(_0x10da53){return _0x503c8b[_0xe864('0x54')](_0x25a7b8,{'transaction':_0x10da53})[_0xe864('0x17')](function(){return BPromise[_0xe864('0x5d')](_0x2fbff3,function(_0x429763){return db['UserOpenchannelQueue'][_0xe864('0x5e')]({'where':{'UserId':_0x429763['id'],'OpenchannelQueueId':_0x517e3a['params']['id']},'transaction':_0x10da53});});})[_0xe864('0x17')](function(){_0x2fbff3[_0xe864('0x5f')](function(_0x226e62){socket[_0xe864('0x60')](_0xe864('0x61'),{'UserId':_0x226e62['id'],'OpenchannelQueueId':_0x503c8b['id']});});});});});}})[_0xe864('0x17')](respondWithStatusCode(_0x239a43,null))[_0xe864('0x26')](handleError(_0x239a43,null));};exports['removeTeams']=function(_0x361db2,_0x5a5cfc){return db['Team'][_0xe864('0x25')]({'where':{'id':_0x361db2[_0xe864('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe864('0x55')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe864('0x17')](handleEntityNotFound(_0x5a5cfc,null))[_0xe864('0x17')](function(_0x3b1e75){var _0x2b9262=_[_0xe864('0x49')](_0x3b1e75,'id');var _0x15352a=[];var _0x4d7549=[];var _0x1587c3=squel['select']();_0x1587c3['field'](_0xe864('0x62'))[_0xe864('0x63')](_0xe864('0x64'),'tq')[_0xe864('0x65')]('user_has_teams','ut',_0xe864('0x66'))[_0xe864('0x24')](_0xe864('0x67'),_0x361db2[_0xe864('0x28')]['id']);for(var _0x1f593e=0x0;_0x1f593e<_0x3b1e75[_0xe864('0x53')];_0x1f593e+=0x1){let _0xd24788=_0x3b1e75[_0x1f593e];for(var _0x5e6ae3=0x0;_0x5e6ae3<_0xd24788[_0xe864('0x56')][_0xe864('0x53')];_0x5e6ae3+=0x1){let _0x218010=_0xd24788[_0xe864('0x56')][_0x5e6ae3];var _0x17a62a=_0x1587c3[_0xe864('0x68')]();_0x17a62a[_0xe864('0x24')](_0xe864('0x69'),_0x218010['id']);_0x4d7549[_0xe864('0x6a')](db['sequelize'][_0xe864('0x2c')](_0x17a62a[_0xe864('0x6b')](),{'type':db[_0xe864('0x5b')][_0xe864('0x6c')][_0xe864('0x6d')]})[_0xe864('0x17')](function(_0x3c7ade){if(_0x3c7ade[_0xe864('0x53')]===0x1){return _0x218010['id'];}else{var _0x1becf4=_[_0xe864('0x6e')](_[_0xe864('0x49')](_0x3c7ade,_0xe864('0x6f')),function(_0x5d20d3){return _['includes'](_0x2b9262,_0x5d20d3);});if(_0x1becf4){return _0x218010['id'];}}}));}}return BPromise[_0xe864('0x70')](_0x4d7549)[_0xe864('0x17')](function(_0x21f9b2){_0x15352a=_(_0x15352a)[_0xe864('0x71')](_0x21f9b2)[_0xe864('0x72')]()[_0xe864('0x73')]();return db[_0xe864('0x20')][_0xe864('0x37')]({'where':{'id':_0x361db2['params']['id']}})[_0xe864('0x17')](function(_0x23cf8e){return db[_0xe864('0x5b')][_0xe864('0x5c')](function(_0x58b5ba){return _0x23cf8e[_0xe864('0x74')](_0x361db2[_0xe864('0x2c')]['ids'],{'transaction':_0x58b5ba})[_0xe864('0x17')](function(){if(!_[_0xe864('0x75')](_0x15352a)){return _0x23cf8e[_0xe864('0x76')](_0x15352a,{'transaction':_0x58b5ba});}})[_0xe864('0x17')](function(){_0x15352a['forEach'](function(_0xf8457a){socket[_0xe864('0x60')]('userOpenchannelQueue:remove',{'UserId':_0xf8457a,'OpenchannelQueueId':_0x23cf8e['id']});});});});});});})['then'](respondWithStatusCode(_0x5a5cfc,null))['catch'](handleError(_0x5a5cfc,null));};exports[_0xe864('0x77')]=function(_0x3bda17,_0x1aa891){return db['OpenchannelQueue']['find']({'where':{'id':_0x3bda17[_0xe864('0x28')]['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x1aa891,null))[_0xe864('0x17')](function(_0x554422){if(_0x554422){return _0x554422[_0xe864('0x77')](_0x3bda17[_0xe864('0x3c')][_0xe864('0x78')],_[_0xe864('0x79')](_0x3bda17['body'],[_0xe864('0x78'),'id'])||{})['spread'](function(_0x2a6f72){for(var _0x584d34=0x0;_0x584d34<_0x3bda17[_0xe864('0x3c')][_0xe864('0x78')]['length'];_0x584d34+=0x1){socket[_0xe864('0x60')](_0xe864('0x61'),{'UserId':Number(_0x3bda17[_0xe864('0x3c')][_0xe864('0x78')][_0x584d34]),'OpenchannelQueueId':Number(_0x3bda17[_0xe864('0x28')]['id'])});}return _0x2a6f72;});}})[_0xe864('0x17')](respondWithResult(_0x1aa891,null))['catch'](handleError(_0x1aa891,null));};exports[_0xe864('0x76')]=function(_0x2906bc,_0x3b3922){return db['OpenchannelQueue'][_0xe864('0x37')]({'where':{'id':_0x2906bc['params']['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x3b3922,null))[_0xe864('0x17')](function(_0x3655c9){if(_0x3655c9){return _0x3655c9[_0xe864('0x76')](_0x2906bc[_0xe864('0x2c')][_0xe864('0x78')])['then'](function(){if(_[_0xe864('0x7a')](_0x2906bc['query']['ids'])){for(var _0x53bf89=0x0;_0x53bf89<_0x2906bc[_0xe864('0x2c')]['ids']['length'];_0x53bf89+=0x1){socket['emit'](_0xe864('0x7b'),{'UserId':Number(_0x2906bc[_0xe864('0x2c')][_0xe864('0x78')][_0x53bf89]),'OpenchannelQueueId':Number(_0x2906bc['params']['id'])});}}else{socket[_0xe864('0x60')](_0xe864('0x7b'),{'UserId':Number(_0x2906bc['query'][_0xe864('0x78')]),'OpenchannelQueueId':Number(_0x2906bc[_0xe864('0x28')]['id'])});}});}})[_0xe864('0x17')](respondWithStatusCode(_0x3b3922,null))['catch'](handleError(_0x3b3922,null));};exports[_0xe864('0x7c')]=function(_0x2de666,_0x558d9e){var _0x4ac4d0={};var _0x440ea2={};var _0x5bd4df;var _0xb6d8f7;return db[_0xe864('0x20')][_0xe864('0x7d')]({'where':{'id':_0x2de666['params']['id']}})[_0xe864('0x17')](handleEntityNotFound(_0x558d9e,null))['then'](function(_0x47277f){if(_0x47277f){_0x5bd4df=_0x47277f;_0x440ea2[_0xe864('0x29')]=_[_0xe864('0x2a')](db[_0xe864('0x55')][_0xe864('0x2b')]);_0x440ea2[_0xe864('0x2c')]=_[_0xe864('0x2a')](_0x2de666['query']);_0x440ea2[_0xe864('0x2d')]=_['intersection'](_0x440ea2[_0xe864('0x29')],_0x440ea2[_0xe864('0x2c')]);_0x4ac4d0['attributes']=_[_0xe864('0x2e')](_0x440ea2[_0xe864('0x29')],qs[_0xe864('0x30')](_0x2de666[_0xe864('0x2c')][_0xe864('0x30')]));_0x4ac4d0['attributes']=_0x4ac4d0[_0xe864('0x2f')][_0xe864('0x53')]?_0x4ac4d0[_0xe864('0x2f')]:_0x440ea2[_0xe864('0x29')];_0x4ac4d0['order']=qs[_0xe864('0x43')](_0x2de666['query'][_0xe864('0x43')]);_0x4ac4d0[_0xe864('0x24')]=qs['filters'](_[_0xe864('0x44')](_0x2de666['query'],_0x440ea2[_0xe864('0x2d')]));if(_0x2de666[_0xe864('0x2c')]['filter']){_0x4ac4d0['where']=_[_0xe864('0x46')](_0x4ac4d0[_0xe864('0x24')],{'$or':_[_0xe864('0x49')](_0x4ac4d0[_0xe864('0x2f')],function(_0x1f07f8){var _0x1586eb={};_0x1586eb[_0x1f07f8]={'$like':'%'+_0x2de666[_0xe864('0x2c')][_0xe864('0x45')]+'%'};return _0x1586eb;})});}_0x4ac4d0=_[_0xe864('0x46')]({},_0x4ac4d0,_0x2de666['options']);return _0x5bd4df[_0xe864('0x7c')](_0x4ac4d0);}})[_0xe864('0x17')](function(_0x28528f){if(_0x28528f){_0xb6d8f7=_0x28528f['length'];if(!_0x2de666[_0xe864('0x2c')][_0xe864('0x40')]('nolimit')){_0x4ac4d0[_0xe864('0x13')]=qs[_0xe864('0x13')](_0x2de666[_0xe864('0x2c')][_0xe864('0x13')]);_0x4ac4d0[_0xe864('0x11')]=qs['offset'](_0x2de666[_0xe864('0x2c')][_0xe864('0x11')]);}return _0x5bd4df[_0xe864('0x7c')](_0x4ac4d0);}})['then'](function(_0x5466ac){if(_0x5466ac){return _0x5466ac?{'count':_0xb6d8f7,'rows':_0x5466ac}:null;}})[_0xe864('0x17')](respondWithResult(_0x558d9e,null))[_0xe864('0x26')](handleError(_0x558d9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 923fc6d..15229ec 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 _0x9a4d=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2437bc,_0x2ebfa1){var _0x3e603c=function(_0x86c58b){while(--_0x86c58b){_0x2437bc['push'](_0x2437bc['shift']());}};_0x3e603c(++_0x2ebfa1);}(_0x9a4d,0x65));var _0xd9a4=function(_0x5aafed,_0x525e53){_0x5aafed=_0x5aafed-0x0;var _0x5e4005=_0x9a4d[_0x5aafed];return _0x5e4005;};'use strict';var EventEmitter=require(_0xd9a4('0x0'));var OpenchannelQueue=require(_0xd9a4('0x1'))['db'][_0xd9a4('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd9a4('0x3')](0x0);var events={'afterCreate':_0xd9a4('0x4'),'afterUpdate':_0xd9a4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x133ded){return function(_0x2ad167,_0x35f295,_0x40931a){OpenchannelQueueEvents['emit'](_0x133ded+':'+_0x2ad167['id'],_0x2ad167);OpenchannelQueueEvents[_0xd9a4('0x6')](_0x133ded,_0x2ad167);_0x40931a(null);};}for(var e in events){if(events[_0xd9a4('0x7')](e)){var event=events[e];OpenchannelQueue[_0xd9a4('0x8')](e,emitEvent(event));}}module[_0xd9a4('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb62a=['exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x14cb71,_0x1367da){var _0x38aad0=function(_0x2c1748){while(--_0x2c1748){_0x14cb71['push'](_0x14cb71['shift']());}};_0x38aad0(++_0x1367da);}(_0xb62a,0xc1));var _0xab62=function(_0x217197,_0xb1d3f2){_0x217197=_0x217197-0x0;var _0x414f9f=_0xb62a[_0x217197];return _0x414f9f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xab62('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xab62('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xab62('0x2')};function emitEvent(_0x109557){return function(_0x22b733,_0x2f81d2,_0x13d9ce){OpenchannelQueueEvents[_0xab62('0x3')](_0x109557+':'+_0x22b733['id'],_0x22b733);OpenchannelQueueEvents[_0xab62('0x3')](_0x109557,_0x22b733);_0x13d9ce(null);};}for(var e in events){if(events[_0xab62('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xab62('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 32155d7..001a4fb 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 _0xb570=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x35e003,_0x21f047){var _0x2d7382=function(_0x47790d){while(--_0x47790d){_0x35e003['push'](_0x35e003['shift']());}};_0x2d7382(++_0x21f047);}(_0xb570,0x19c));var _0x0b57=function(_0x1c0711,_0x56a619){_0x1c0711=_0x1c0711-0x0;var _0x377178=_0xb570[_0x1c0711];return _0x377178;};'use strict';var _=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var logger=require('../../config/logger')(_0x0b57('0x2'));var moment=require(_0x0b57('0x3'));var BPromise=require(_0x0b57('0x4'));var rp=require(_0x0b57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b57('0x6'));var config=require(_0x0b57('0x7'));var attributes=require(_0x0b57('0x8'));module['exports']=function(_0x1f0b22,_0x16ed4b){return _0x1f0b22[_0x0b57('0x9')](_0x0b57('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f6=['path','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x00f6,0xd6));var _0x600f=function(_0x54f563,_0x42f04f){_0x54f563=_0x54f563-0x0;var _0x562235=_0x00f6[_0x54f563];return _0x562235;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var logger=require(_0x600f('0x2'))(_0x600f('0x3'));var moment=require(_0x600f('0x4'));var BPromise=require(_0x600f('0x5'));var rp=require(_0x600f('0x6'));var fs=require('fs');var path=require(_0x600f('0x7'));var rimraf=require('rimraf');var config=require(_0x600f('0x8'));var attributes=require(_0x600f('0x9'));module['exports']=function(_0x153d32,_0x59decc){return _0x153d32[_0x600f('0xa')](_0x600f('0xb'),attributes,{'tableName':_0x600f('0xc'),'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 c390ec1..51c37b6 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 _0xf951=['include','map','model','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes'];(function(_0x3ceb63,_0x22332c){var _0x4102ae=function(_0x547e3f){while(--_0x547e3f){_0x3ceb63['push'](_0x3ceb63['shift']());}};_0x4102ae(++_0x22332c);}(_0xf951,0x1a0));var _0x1f95=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0xf951[_0x2e0854];return _0x4d0ff9;};'use strict';var _=require(_0x1f95('0x0'));var util=require(_0x1f95('0x1'));var moment=require(_0x1f95('0x2'));var BPromise=require(_0x1f95('0x3'));var rs=require(_0x1f95('0x4'));var fs=require('fs');var Redis=require(_0x1f95('0x5'));var db=require(_0x1f95('0x6'))['db'];var utils=require(_0x1f95('0x7'));var logger=require('../../config/logger')(_0x1f95('0x8'));var config=require(_0x1f95('0x9'));var jayson=require(_0x1f95('0xa'));var client=jayson[_0x1f95('0xb')]['http']({'port':0x232a});config[_0x1f95('0xc')]=_[_0x1f95('0xd')](config[_0x1f95('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f95('0xe'))(new Redis(config[_0x1f95('0xc')]));require(_0x1f95('0xf'))[_0x1f95('0x10')](socket);function respondWithRpcPromise(_0x3b600f,_0x55c2a8,_0x4e62f6){return new BPromise(function(_0x2efb3f,_0x583820){return client[_0x1f95('0x11')](_0x3b600f,_0x4e62f6)[_0x1f95('0x12')](function(_0x57e02c){logger[_0x1f95('0x13')](_0x1f95('0x14'),_0x55c2a8,'request\x20sent');logger[_0x1f95('0x15')](_0x1f95('0x16'),_0x55c2a8,_0x1f95('0x17'),JSON['stringify'](_0x57e02c));if(_0x57e02c[_0x1f95('0x18')]){if(_0x57e02c[_0x1f95('0x18')]['code']===0x1f4){logger[_0x1f95('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x55c2a8,_0x57e02c[_0x1f95('0x18')]['message']);return _0x583820(_0x57e02c[_0x1f95('0x18')][_0x1f95('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x55c2a8,_0x57e02c['error'][_0x1f95('0x19')]);return _0x2efb3f(_0x57e02c[_0x1f95('0x18')][_0x1f95('0x19')]);}else{logger['info'](_0x1f95('0x14'),_0x55c2a8,_0x1f95('0x17'));_0x2efb3f(_0x57e02c[_0x1f95('0x1a')][_0x1f95('0x19')]);}})[_0x1f95('0x1b')](function(_0x22e894){logger[_0x1f95('0x18')](_0x1f95('0x14'),_0x55c2a8,_0x22e894);_0x583820(_0x22e894);});});}exports[_0x1f95('0x1c')]=function(_0x55c670){var _0x1b36e8=this;return new Promise(function(_0x35e45d,_0x534b85){return db[_0x1f95('0x1d')][_0x1f95('0x1e')]({'raw':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x20')]===undefined?!![]:![]:!![],'where':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x21')]||null:null,'attributes':_0x55c670[_0x1f95('0x1f')]?_0x55c670['options'][_0x1f95('0x22')]||null:null,'limit':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')]['limit']||null:null,'include':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x55c670[_0x1f95('0x1f')]['include'],function(_0x591c0a){return{'model':db[_0x591c0a[_0x1f95('0x25')]],'as':_0x591c0a['as'],'attributes':_0x591c0a[_0x1f95('0x22')],'include':_0x591c0a[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x591c0a[_0x1f95('0x23')],function(_0x35d317){return{'model':db[_0x35d317[_0x1f95('0x25')]],'as':_0x35d317['as'],'attributes':_0x35d317[_0x1f95('0x22')],'include':_0x35d317[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x35d317[_0x1f95('0x23')],function(_0x1f3f65){return{'model':db[_0x1f3f65[_0x1f95('0x25')]],'as':_0x1f3f65['as'],'attributes':_0x1f3f65[_0x1f95('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c3c3){logger[_0x1f95('0x13')]('GetOpenchannelQueue',_0x55c670);logger[_0x1f95('0x15')](_0x1f95('0x1c'),_0x55c670,JSON[_0x1f95('0x26')](_0x55c3c3));_0x35e45d(_0x55c3c3);})[_0x1f95('0x1b')](function(_0x4243a6){logger[_0x1f95('0x18')](_0x1f95('0x1c'),_0x4243a6[_0x1f95('0x19')],_0x55c670);_0x534b85(_0x1b36e8['error'](0x1f4,_0x4243a6[_0x1f95('0x19')]));});});};exports[_0x1f95('0x27')]=function(_0x5b007b){var _0x1c29fa=this;return new Promise(function(_0x493e3c,_0x5b73e6){return db['OpenchannelQueue'][_0x1f95('0x28')]({'raw':_0x5b007b['options']?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x20')]===undefined?!![]:![]:!![],'where':_0x5b007b['options']?_0x5b007b['options'][_0x1f95('0x21')]||null:null,'attributes':_0x5b007b[_0x1f95('0x1f')]?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x22')]||null:null,'include':_0x5b007b[_0x1f95('0x1f')]?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x23')]?_['map'](_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x23')],function(_0x550934){return{'model':db[_0x550934['model']],'as':_0x550934['as'],'attributes':_0x550934[_0x1f95('0x22')],'include':_0x550934[_0x1f95('0x23')]?_['map'](_0x550934[_0x1f95('0x23')],function(_0x4ee8d0){return{'model':db[_0x4ee8d0[_0x1f95('0x25')]],'as':_0x4ee8d0['as'],'attributes':_0x4ee8d0[_0x1f95('0x22')],'include':_0x4ee8d0[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x4ee8d0[_0x1f95('0x23')],function(_0x4097c6){return{'model':db[_0x4097c6[_0x1f95('0x25')]],'as':_0x4097c6['as'],'attributes':_0x4097c6[_0x1f95('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x863aaa){logger[_0x1f95('0x13')](_0x1f95('0x27'),_0x5b007b);logger['debug']('ShowOpenchannelQueue',_0x5b007b,JSON[_0x1f95('0x26')](_0x863aaa));_0x493e3c(_0x863aaa);})[_0x1f95('0x1b')](function(_0x59e3ea){logger['error'](_0x1f95('0x27'),_0x59e3ea[_0x1f95('0x19')],_0x5b007b);_0x5b73e6(_0x1c29fa[_0x1f95('0x18')](0x1f4,_0x59e3ea[_0x1f95('0x19')]));});});}; \ No newline at end of file +var _0xb193=['GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xb193,0xd4));var _0x3b19=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xb193[_0x403fc7];return _0x5d0827;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b19('0x0'));var BPromise=require(_0x3b19('0x1'));var rs=require(_0x3b19('0x2'));var fs=require('fs');var Redis=require(_0x3b19('0x3'));var db=require(_0x3b19('0x4'))['db'];var utils=require(_0x3b19('0x5'));var logger=require(_0x3b19('0x6'))(_0x3b19('0x7'));var config=require(_0x3b19('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b19('0x9')][_0x3b19('0xa')]({'port':0x232a});config[_0x3b19('0xb')]=_['defaults'](config[_0x3b19('0xb')],{'host':_0x3b19('0xc'),'port':0x18eb});var socket=require(_0x3b19('0xd'))(new Redis(config[_0x3b19('0xb')]));require(_0x3b19('0xe'))[_0x3b19('0xf')](socket);function respondWithRpcPromise(_0x4d15a9,_0x39887e,_0x42efdb){return new BPromise(function(_0x475c66,_0x46a3b4){return client[_0x3b19('0x10')](_0x4d15a9,_0x42efdb)[_0x3b19('0x11')](function(_0x794c0a){logger[_0x3b19('0x12')](_0x3b19('0x13'),_0x39887e,'request\x20sent');logger[_0x3b19('0x14')](_0x3b19('0x15'),_0x39887e,_0x3b19('0x16'),JSON[_0x3b19('0x17')](_0x794c0a));if(_0x794c0a[_0x3b19('0x18')]){if(_0x794c0a[_0x3b19('0x18')]['code']===0x1f4){logger['error'](_0x3b19('0x13'),_0x39887e,_0x794c0a[_0x3b19('0x18')][_0x3b19('0x19')]);return _0x46a3b4(_0x794c0a['error'][_0x3b19('0x19')]);}logger[_0x3b19('0x18')](_0x3b19('0x13'),_0x39887e,_0x794c0a[_0x3b19('0x18')][_0x3b19('0x19')]);return _0x475c66(_0x794c0a[_0x3b19('0x18')][_0x3b19('0x19')]);}else{logger[_0x3b19('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x39887e,_0x3b19('0x16'));_0x475c66(_0x794c0a[_0x3b19('0x1a')][_0x3b19('0x19')]);}})[_0x3b19('0x1b')](function(_0xd294ab){logger[_0x3b19('0x18')](_0x3b19('0x13'),_0x39887e,_0xd294ab);_0x46a3b4(_0xd294ab);});});}exports[_0x3b19('0x1c')]=function(_0x2e6c16){var _0x158196=this;return new Promise(function(_0x2eadc4,_0xdee520){return db[_0x3b19('0x1d')][_0x3b19('0x1e')]({'raw':_0x2e6c16[_0x3b19('0x1f')]?_0x2e6c16[_0x3b19('0x1f')][_0x3b19('0x20')]===undefined?!![]:![]:!![],'where':_0x2e6c16[_0x3b19('0x1f')]?_0x2e6c16['options'][_0x3b19('0x21')]||null:null,'attributes':_0x2e6c16['options']?_0x2e6c16[_0x3b19('0x1f')]['attributes']||null:null,'limit':_0x2e6c16[_0x3b19('0x1f')]?_0x2e6c16[_0x3b19('0x1f')][_0x3b19('0x22')]||null:null,'include':_0x2e6c16[_0x3b19('0x1f')]?_0x2e6c16['options'][_0x3b19('0x23')]?_[_0x3b19('0x24')](_0x2e6c16['options']['include'],function(_0x47dfe3){return{'model':db[_0x47dfe3[_0x3b19('0x25')]],'as':_0x47dfe3['as'],'attributes':_0x47dfe3['attributes'],'include':_0x47dfe3['include']?_[_0x3b19('0x24')](_0x47dfe3[_0x3b19('0x23')],function(_0x1f2f52){return{'model':db[_0x1f2f52[_0x3b19('0x25')]],'as':_0x1f2f52['as'],'attributes':_0x1f2f52[_0x3b19('0x26')],'include':_0x1f2f52[_0x3b19('0x23')]?_[_0x3b19('0x24')](_0x1f2f52[_0x3b19('0x23')],function(_0x14a912){return{'model':db[_0x14a912[_0x3b19('0x25')]],'as':_0x14a912['as'],'attributes':_0x14a912[_0x3b19('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b19('0x11')](function(_0x38010d){logger[_0x3b19('0x12')](_0x3b19('0x1c'),_0x2e6c16);logger['debug']('GetOpenchannelQueue',_0x2e6c16,JSON[_0x3b19('0x17')](_0x38010d));_0x2eadc4(_0x38010d);})['catch'](function(_0x5b49a4){logger['error']('GetOpenchannelQueue',_0x5b49a4[_0x3b19('0x19')],_0x2e6c16);_0xdee520(_0x158196[_0x3b19('0x18')](0x1f4,_0x5b49a4[_0x3b19('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x2f0ff4){var _0x57409b=this;return new Promise(function(_0x1bc299,_0x926ce4){return db[_0x3b19('0x1d')]['find']({'raw':_0x2f0ff4[_0x3b19('0x1f')]?_0x2f0ff4[_0x3b19('0x1f')][_0x3b19('0x20')]===undefined?!![]:![]:!![],'where':_0x2f0ff4[_0x3b19('0x1f')]?_0x2f0ff4['options']['where']||null:null,'attributes':_0x2f0ff4[_0x3b19('0x1f')]?_0x2f0ff4[_0x3b19('0x1f')]['attributes']||null:null,'include':_0x2f0ff4[_0x3b19('0x1f')]?_0x2f0ff4[_0x3b19('0x1f')][_0x3b19('0x23')]?_['map'](_0x2f0ff4['options'][_0x3b19('0x23')],function(_0x50ed9f){return{'model':db[_0x50ed9f['model']],'as':_0x50ed9f['as'],'attributes':_0x50ed9f[_0x3b19('0x26')],'include':_0x50ed9f[_0x3b19('0x23')]?_[_0x3b19('0x24')](_0x50ed9f[_0x3b19('0x23')],function(_0x48d1bc){return{'model':db[_0x48d1bc[_0x3b19('0x25')]],'as':_0x48d1bc['as'],'attributes':_0x48d1bc[_0x3b19('0x26')],'include':_0x48d1bc['include']?_[_0x3b19('0x24')](_0x48d1bc[_0x3b19('0x23')],function(_0x1e5fe7){return{'model':db[_0x1e5fe7[_0x3b19('0x25')]],'as':_0x1e5fe7['as'],'attributes':_0x1e5fe7[_0x3b19('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b19('0x11')](function(_0x87c5e3){logger['info'](_0x3b19('0x27'),_0x2f0ff4);logger['debug'](_0x3b19('0x27'),_0x2f0ff4,JSON[_0x3b19('0x17')](_0x87c5e3));_0x1bc299(_0x87c5e3);})[_0x3b19('0x1b')](function(_0xac76e2){logger[_0x3b19('0x18')](_0x3b19('0x27'),_0xac76e2['message'],_0x2f0ff4);_0x926ce4(_0x57409b['error'](0x1f4,_0xac76e2[_0x3b19('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1c56298..486cbe5 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 _0xa57c=['./openchannelQueue.events','save','remove','register','length','openchannelQueue:'];(function(_0x899a89,_0x2722b0){var _0x9b2b94=function(_0x302290){while(--_0x302290){_0x899a89['push'](_0x899a89['shift']());}};_0x9b2b94(++_0x2722b0);}(_0xa57c,0x150));var _0xca57=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa57c[_0x1cc8fe];return _0x230054;};'use strict';var OpenchannelQueueEvents=require(_0xca57('0x0'));var events=[_0xca57('0x1'),_0xca57('0x2'),'update'];function createListener(_0x4b1a1e,_0x3bcdaa){return function(_0xfcea){_0x3bcdaa['emit'](_0x4b1a1e,_0xfcea);};}function removeListener(_0x144bac,_0x8dc7d){return function(){OpenchannelQueueEvents['removeListener'](_0x144bac,_0x8dc7d);};}exports[_0xca57('0x3')]=function(_0x55c08e){for(var _0x1921df=0x0,_0x3d0f12=events[_0xca57('0x4')];_0x1921df<_0x3d0f12;_0x1921df++){var _0x5859c6=events[_0x1921df];var _0x2bef4a=createListener(_0xca57('0x5')+_0x5859c6,_0x55c08e);OpenchannelQueueEvents['on'](_0x5859c6,_0x2bef4a);}}; \ No newline at end of file +var _0xc0e0=['remove','emit','register','length','./openchannelQueue.events','save'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xc0e0,0xca));var _0x0c0e=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc0e0[_0x5f09c5];return _0x426ad9;};'use strict';var OpenchannelQueueEvents=require(_0x0c0e('0x0'));var events=[_0x0c0e('0x1'),_0x0c0e('0x2'),'update'];function createListener(_0x53131f,_0x278740){return function(_0x41ae67){_0x278740[_0x0c0e('0x3')](_0x53131f,_0x41ae67);};}function removeListener(_0x1d3234,_0x5951cc){return function(){OpenchannelQueueEvents['removeListener'](_0x1d3234,_0x5951cc);};}exports[_0x0c0e('0x4')]=function(_0x5e32f8){for(var _0x11f4b5=0x0,_0xc2695d=events[_0x0c0e('0x5')];_0x11f4b5<_0xc2695d;_0x11f4b5++){var _0x140730=events[_0x11f4b5];var _0x272a0f=createListener('openchannelQueue:'+_0x140730,_0x5e32f8);OpenchannelQueueEvents['on'](_0x140730,_0x272a0f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a4dce97..3ebf1d1 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 _0x7d9e=['index','/describe','describe','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated'];(function(_0xb69d21,_0x439c03){var _0x57660c=function(_0x314207){while(--_0x314207){_0xb69d21['push'](_0xb69d21['shift']());}};_0x57660c(++_0x439c03);}(_0x7d9e,0x17c));var _0xe7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe7d9('0x0'));var util=require(_0xe7d9('0x1'));var path=require('path');var timeout=require(_0xe7d9('0x2'));var express=require(_0xe7d9('0x3'));var router=express[_0xe7d9('0x4')]();var fs_extra=require(_0xe7d9('0x5'));var auth=require(_0xe7d9('0x6'));var interaction=require(_0xe7d9('0x7'));var config=require(_0xe7d9('0x8'));var controller=require(_0xe7d9('0x9'));router['get']('/',auth[_0xe7d9('0xa')](),controller[_0xe7d9('0xb')]);router['get'](_0xe7d9('0xc'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0xd')]);router[_0xe7d9('0xe')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x10')]);router[_0xe7d9('0x11')]('/',auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x12')]);router[_0xe7d9('0x13')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x14')]);router[_0xe7d9('0x15')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller['destroy']);module[_0xe7d9('0x16')]=router; \ No newline at end of file +var _0x4a95=['update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','isAuthenticated','/:id','show','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a95,0x1f0));var _0x54a9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4a95[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x54a9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x54a9('0x1'));var express=require(_0x54a9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54a9('0x3'));var interaction=require(_0x54a9('0x4'));var config=require(_0x54a9('0x5'));var controller=require(_0x54a9('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x54a9('0x7')]);router[_0x54a9('0x8')]('/describe',auth[_0x54a9('0x9')](),controller['describe']);router['get'](_0x54a9('0xa'),auth['isAuthenticated'](),controller[_0x54a9('0xb')]);router['post']('/',auth[_0x54a9('0x9')](),controller[_0x54a9('0xc')]);router[_0x54a9('0xd')](_0x54a9('0xa'),auth[_0x54a9('0x9')](),controller[_0x54a9('0xe')]);router[_0x54a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x54a9('0x10')]);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 4087213..b4283e4 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 _0x67de=['STRING','DATE','moment','sequelize','exports'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0x67de,0x1ba));var _0xe67d=function(_0x33ede3,_0x4113ad){_0x33ede3=_0x33ede3-0x0;var _0x494bf7=_0x67de[_0x33ede3];return _0x494bf7;};'use strict';var moment=require(_0xe67d('0x0'));var Sequelize=require(_0xe67d('0x1'));module[_0xe67d('0x2')]={'uniqueid':{'type':Sequelize[_0xe67d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe67d('0x3')]},'joinAt':{'type':Sequelize[_0xe67d('0x4')]},'leaveAt':{'type':Sequelize[_0xe67d('0x4')]},'acceptAt':{'type':Sequelize[_0xe67d('0x4')]},'exitAt':{'type':Sequelize[_0xe67d('0x4')]},'reason':{'type':Sequelize[_0xe67d('0x3')]}}; \ No newline at end of file +var _0x02a7=['STRING','DATE','sequelize'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x02a7,0x7a));var _0x702a=function(_0x266e5f,_0x39829d){_0x266e5f=_0x266e5f-0x0;var _0x1d0a72=_0x02a7[_0x266e5f];return _0x1d0a72;};'use strict';var moment=require('moment');var Sequelize=require(_0x702a('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x702a('0x1')]},'joinAt':{'type':Sequelize[_0x702a('0x2')]},'leaveAt':{'type':Sequelize[_0x702a('0x2')]},'acceptAt':{'type':Sequelize[_0x702a('0x2')]},'exitAt':{'type':Sequelize[_0x702a('0x2')]},'reason':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b42a67d..0c59a56 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 _0x0deb=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','limit','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type'];(function(_0x2f399b,_0x32f990){var _0x5eabc0=function(_0x25d0c4){while(--_0x25d0c4){_0x2f399b['push'](_0x2f399b['shift']());}};_0x5eabc0(++_0x32f990);}(_0x0deb,0x6e));var _0xb0de=function(_0x2890a9,_0x2c64be){_0x2890a9=_0x2890a9-0x0;var _0xbfe8ba=_0x0deb[_0x2890a9];return _0xbfe8ba;};'use strict';var emlformat=require(_0xb0de('0x0'));var rimraf=require(_0xb0de('0x1'));var zipdir=require(_0xb0de('0x2'));var jsonpatch=require(_0xb0de('0x3'));var rp=require(_0xb0de('0x4'));var moment=require('moment');var BPromise=require(_0xb0de('0x5'));var Mustache=require(_0xb0de('0x6'));var util=require(_0xb0de('0x7'));var path=require('path');var sox=require(_0xb0de('0x8'));var csv=require('to-csv');var ejs=require(_0xb0de('0x9'));var fs=require('fs');var fs_extra=require(_0xb0de('0xa'));var _=require(_0xb0de('0xb'));var squel=require(_0xb0de('0xc'));var crypto=require(_0xb0de('0xd'));var jsforce=require(_0xb0de('0xe'));var deskjs=require(_0xb0de('0xf'));var toCsv=require(_0xb0de('0x10'));var querystring=require(_0xb0de('0x11'));var Papa=require(_0xb0de('0x12'));var Redis=require(_0xb0de('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb0de('0x14'));var as=require(_0xb0de('0x15'));var hardwareService=require(_0xb0de('0x16'));var logger=require(_0xb0de('0x17'))(_0xb0de('0x18'));var utils=require(_0xb0de('0x19'));var config=require(_0xb0de('0x1a'));var licenseUtil=require(_0xb0de('0x1b'));var db=require(_0xb0de('0x1c'))['db'];function respondWithStatusCode(_0x2625c8,_0x55893f){_0x55893f=_0x55893f||0xcc;return function(_0x391431){if(_0x391431){return _0x2625c8[_0xb0de('0x1d')](_0x55893f);}return _0x2625c8['status'](_0x55893f)['end']();};}function respondWithResult(_0x5b840f,_0x215659){_0x215659=_0x215659||0xc8;return function(_0x566758){if(_0x566758){return _0x5b840f['status'](_0x215659)['json'](_0x566758);}};}function respondWithFilteredResult(_0x130fc4,_0x427ec5){return function(_0x283a95){if(_0x283a95){var _0x46ae80=typeof _0x427ec5['offset']==='undefined'&&typeof _0x427ec5[_0xb0de('0x1e')]===_0xb0de('0x1f');var _0x56b31a=_0x283a95[_0xb0de('0x20')];var _0x2fe75f=_0x46ae80?0x0:_0x427ec5[_0xb0de('0x21')];var _0x3d6765=_0x46ae80?_0x283a95['count']:_0x427ec5['offset']+_0x427ec5[_0xb0de('0x1e')];var _0x15dfe3;if(_0x3d6765>=_0x56b31a){_0x3d6765=_0x56b31a;_0x15dfe3=0xc8;}else{_0x15dfe3=0xce;}_0x130fc4[_0xb0de('0x22')](_0x15dfe3);return _0x130fc4[_0xb0de('0x23')](_0xb0de('0x24'),_0x2fe75f+'-'+_0x3d6765+'/'+_0x56b31a)[_0xb0de('0x25')](_0x283a95);}return null;};}function patchUpdates(_0x16e1a9){return function(_0x4e1196){try{jsonpatch[_0xb0de('0x26')](_0x4e1196,_0x16e1a9,!![]);}catch(_0x29ac76){return BPromise[_0xb0de('0x27')](_0x29ac76);}return _0x4e1196[_0xb0de('0x28')]();};}function saveUpdates(_0x30bc80,_0x2bfb32){return function(_0x37b975){if(_0x37b975){return _0x37b975[_0xb0de('0x29')](_0x30bc80)['then'](function(_0x4c0d0f){return _0x4c0d0f;});}return null;};}function removeEntity(_0x26aa65,_0x42ae1d){return function(_0x2aea83){if(_0x2aea83){return _0x2aea83[_0xb0de('0x2a')]()[_0xb0de('0x2b')](function(){_0x26aa65[_0xb0de('0x22')](0xcc)[_0xb0de('0x2c')]();});}};}function handleEntityNotFound(_0x2edda4,_0x4a63c6){return function(_0x6d5f1b){if(!_0x6d5f1b){_0x2edda4[_0xb0de('0x1d')](0x194);}return _0x6d5f1b;};}function handleError(_0x5e3385,_0x4d6619){_0x4d6619=_0x4d6619||0x1f4;return function(_0x212b1f){logger[_0xb0de('0x2d')](_0x212b1f[_0xb0de('0x2e')]);if(_0x212b1f[_0xb0de('0x2f')]){delete _0x212b1f[_0xb0de('0x2f')];}_0x5e3385[_0xb0de('0x22')](_0x4d6619)[_0xb0de('0x30')](_0x212b1f);};}exports[_0xb0de('0x31')]=function(_0x57d3b4,_0x459257){var _0x41b40b={},_0x412a07={},_0x32e5fd={'count':0x0,'rows':[]};var _0x4d94ae=_['map'](db[_0xb0de('0x32')][_0xb0de('0x33')],function(_0x4c9f95){return{'name':_0x4c9f95[_0xb0de('0x34')],'type':_0x4c9f95[_0xb0de('0x35')][_0xb0de('0x36')]};});_0x412a07[_0xb0de('0x37')]=_[_0xb0de('0x38')](_0x4d94ae,_0xb0de('0x2f'));_0x412a07[_0xb0de('0x39')]=_[_0xb0de('0x3a')](_0x57d3b4[_0xb0de('0x39')]);_0x412a07[_0xb0de('0x3b')]=_[_0xb0de('0x3c')](_0x412a07[_0xb0de('0x37')],_0x412a07[_0xb0de('0x39')]);_0x41b40b[_0xb0de('0x3d')]=_[_0xb0de('0x3c')](_0x412a07[_0xb0de('0x37')],qs[_0xb0de('0x3e')](_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x3e')]));_0x41b40b[_0xb0de('0x3d')]=_0x41b40b[_0xb0de('0x3d')][_0xb0de('0x3f')]?_0x41b40b['attributes']:_0x412a07['model'];if(!_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x40')](_0xb0de('0x41'))){_0x41b40b[_0xb0de('0x1e')]=qs[_0xb0de('0x1e')](_0x57d3b4['query'][_0xb0de('0x1e')]);_0x41b40b[_0xb0de('0x21')]=qs[_0xb0de('0x21')](_0x57d3b4['query'][_0xb0de('0x21')]);}_0x41b40b['order']=qs[_0xb0de('0x42')](_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x42')]);_0x41b40b[_0xb0de('0x43')]=qs[_0xb0de('0x3b')](_['pick'](_0x57d3b4[_0xb0de('0x39')],_0x412a07[_0xb0de('0x3b')]),_0x4d94ae);if(_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x44')]){_0x41b40b[_0xb0de('0x43')]=_['merge'](_0x41b40b[_0xb0de('0x43')],{'$or':_[_0xb0de('0x38')](_0x4d94ae,function(_0x1edc22){if(_0x1edc22[_0xb0de('0x35')]!==_0xb0de('0x45')){var _0x4716a1={};_0x4716a1[_0x1edc22[_0xb0de('0x2f')]]={'$like':'%'+_0x57d3b4[_0xb0de('0x39')]['filter']+'%'};return _0x4716a1;}})});}_0x41b40b=_['merge']({},_0x41b40b,_0x57d3b4[_0xb0de('0x46')]);var _0x2e9ff1={'where':_0x41b40b[_0xb0de('0x43')]};return db[_0xb0de('0x32')]['count'](_0x2e9ff1)[_0xb0de('0x2b')](function(_0x18c0fc){_0x32e5fd['count']=_0x18c0fc;if(_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x47')]){_0x41b40b[_0xb0de('0x48')]=[{'all':!![]}];}return db[_0xb0de('0x32')][_0xb0de('0x49')](_0x41b40b);})[_0xb0de('0x2b')](function(_0x56a02a){_0x32e5fd[_0xb0de('0x4a')]=_0x56a02a;return _0x32e5fd;})['then'](respondWithFilteredResult(_0x459257,_0x41b40b))[_0xb0de('0x4b')](handleError(_0x459257,null));};exports[_0xb0de('0x4c')]=function(_0x4b1b25,_0x3f594a){var _0x424acf={'raw':!![],'where':{'id':_0x4b1b25[_0xb0de('0x4d')]['id']}},_0x303b5c={};_0x303b5c[_0xb0de('0x37')]=_[_0xb0de('0x3a')](db[_0xb0de('0x32')][_0xb0de('0x33')]);_0x303b5c[_0xb0de('0x39')]=_[_0xb0de('0x3a')](_0x4b1b25[_0xb0de('0x39')]);_0x303b5c[_0xb0de('0x3b')]=_[_0xb0de('0x3c')](_0x303b5c[_0xb0de('0x37')],_0x303b5c['query']);_0x424acf[_0xb0de('0x3d')]=_[_0xb0de('0x3c')](_0x303b5c[_0xb0de('0x37')],qs['fields'](_0x4b1b25['query'][_0xb0de('0x3e')]));_0x424acf[_0xb0de('0x3d')]=_0x424acf[_0xb0de('0x3d')][_0xb0de('0x3f')]?_0x424acf[_0xb0de('0x3d')]:_0x303b5c[_0xb0de('0x37')];if(_0x4b1b25[_0xb0de('0x39')][_0xb0de('0x47')]){_0x424acf[_0xb0de('0x48')]=[{'all':!![]}];}_0x424acf=_['merge']({},_0x424acf,_0x4b1b25['options']);return db[_0xb0de('0x32')]['find'](_0x424acf)[_0xb0de('0x2b')](handleEntityNotFound(_0x3f594a,null))[_0xb0de('0x2b')](respondWithResult(_0x3f594a,null))['catch'](handleError(_0x3f594a,null));};exports[_0xb0de('0x4e')]=function(_0x311e8d,_0x55d438){return db[_0xb0de('0x32')]['create'](_0x311e8d[_0xb0de('0x4f')],{})[_0xb0de('0x2b')](respondWithResult(_0x55d438,0xc9))[_0xb0de('0x4b')](handleError(_0x55d438,null));};exports[_0xb0de('0x29')]=function(_0xf0b5c5,_0x427efa){if(_0xf0b5c5['body']['id']){delete _0xf0b5c5['body']['id'];}return db[_0xb0de('0x32')][_0xb0de('0x50')]({'where':{'id':_0xf0b5c5[_0xb0de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x427efa,null))[_0xb0de('0x2b')](saveUpdates(_0xf0b5c5[_0xb0de('0x4f')],null))[_0xb0de('0x2b')](respondWithResult(_0x427efa,null))[_0xb0de('0x4b')](handleError(_0x427efa,null));};exports[_0xb0de('0x2a')]=function(_0x38bd77,_0x213159){return db[_0xb0de('0x32')][_0xb0de('0x50')]({'where':{'id':_0x38bd77['params']['id']}})['then'](handleEntityNotFound(_0x213159,null))[_0xb0de('0x2b')](removeEntity(_0x213159,null))[_0xb0de('0x4b')](handleError(_0x213159,null));};exports[_0xb0de('0x51')]=function(_0x3d9da8,_0x2716db){return db[_0xb0de('0x32')][_0xb0de('0x51')]()[_0xb0de('0x2b')](respondWithResult(_0x2716db,null))['catch'](handleError(_0x2716db,null));}; \ No newline at end of file +var _0x137a=['desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','type','options','OpenchannelQueueReport','includeAll','include','findAll','rows','show','params','length','find','catch','body','update','describe','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x137a,0x145));var _0xa137=function(_0x1dc43c,_0x3edf52){_0x1dc43c=_0x1dc43c-0x0;var _0x2efc49=_0x137a[_0x1dc43c];return _0x2efc49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa137('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa137('0x1'));var rp=require('request-promise');var moment=require(_0xa137('0x2'));var BPromise=require(_0xa137('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa137('0x4'));var sox=require('sox');var csv=require(_0xa137('0x5'));var ejs=require(_0xa137('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa137('0x7'));var squel=require('squel');var crypto=require(_0xa137('0x8'));var jsforce=require(_0xa137('0x9'));var deskjs=require(_0xa137('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa137('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa137('0xc'));var logger=require(_0xa137('0xd'))(_0xa137('0xe'));var utils=require(_0xa137('0xf'));var config=require(_0xa137('0x10'));var licenseUtil=require(_0xa137('0x11'));var db=require(_0xa137('0x12'))['db'];function respondWithStatusCode(_0x2e5323,_0x8e2a49){_0x8e2a49=_0x8e2a49||0xcc;return function(_0x14c6ad){if(_0x14c6ad){return _0x2e5323[_0xa137('0x13')](_0x8e2a49);}return _0x2e5323[_0xa137('0x14')](_0x8e2a49)[_0xa137('0x15')]();};}function respondWithResult(_0x23209d,_0x123363){_0x123363=_0x123363||0xc8;return function(_0x174e39){if(_0x174e39){return _0x23209d[_0xa137('0x14')](_0x123363)['json'](_0x174e39);}};}function respondWithFilteredResult(_0x47903b,_0x49a20a){return function(_0xe6f000){if(_0xe6f000){var _0x3f14d0=typeof _0x49a20a[_0xa137('0x16')]===_0xa137('0x17')&&typeof _0x49a20a[_0xa137('0x18')]==='undefined';var _0xfde51b=_0xe6f000[_0xa137('0x19')];var _0x427aa3=_0x3f14d0?0x0:_0x49a20a[_0xa137('0x16')];var _0x4d43d9=_0x3f14d0?_0xe6f000[_0xa137('0x19')]:_0x49a20a['offset']+_0x49a20a['limit'];var _0x546277;if(_0x4d43d9>=_0xfde51b){_0x4d43d9=_0xfde51b;_0x546277=0xc8;}else{_0x546277=0xce;}_0x47903b['status'](_0x546277);return _0x47903b[_0xa137('0x1a')]('Content-Range',_0x427aa3+'-'+_0x4d43d9+'/'+_0xfde51b)['json'](_0xe6f000);}return null;};}function patchUpdates(_0x3c4820){return function(_0x261bf8){try{jsonpatch[_0xa137('0x1b')](_0x261bf8,_0x3c4820,!![]);}catch(_0x528091){return BPromise[_0xa137('0x1c')](_0x528091);}return _0x261bf8[_0xa137('0x1d')]();};}function saveUpdates(_0x46e2dd,_0x3fcae0){return function(_0x28bfc6){if(_0x28bfc6){return _0x28bfc6['update'](_0x46e2dd)['then'](function(_0x2181c3){return _0x2181c3;});}return null;};}function removeEntity(_0x580adf,_0x5d0d7a){return function(_0x4f2162){if(_0x4f2162){return _0x4f2162[_0xa137('0x1e')]()[_0xa137('0x1f')](function(){_0x580adf[_0xa137('0x14')](0xcc)[_0xa137('0x15')]();});}};}function handleEntityNotFound(_0x3b3489,_0x13c2cc){return function(_0x25b76b){if(!_0x25b76b){_0x3b3489[_0xa137('0x13')](0x194);}return _0x25b76b;};}function handleError(_0x36904f,_0x2ca948){_0x2ca948=_0x2ca948||0x1f4;return function(_0x5ba901){logger[_0xa137('0x20')](_0x5ba901[_0xa137('0x21')]);if(_0x5ba901[_0xa137('0x22')]){delete _0x5ba901[_0xa137('0x22')];}_0x36904f['status'](_0x2ca948)['send'](_0x5ba901);};}exports[_0xa137('0x23')]=function(_0x415f2f,_0x150c0f){var _0x48fa90={},_0x23c5e0={},_0x996a56={'count':0x0,'rows':[]};var _0x101166=_[_0xa137('0x24')](db['OpenchannelQueueReport'][_0xa137('0x25')],function(_0x4bca51){return{'name':_0x4bca51[_0xa137('0x26')],'type':_0x4bca51['type']['key']};});_0x23c5e0[_0xa137('0x27')]=_['map'](_0x101166,_0xa137('0x22'));_0x23c5e0[_0xa137('0x28')]=_[_0xa137('0x29')](_0x415f2f[_0xa137('0x28')]);_0x23c5e0['filters']=_['intersection'](_0x23c5e0[_0xa137('0x27')],_0x23c5e0['query']);_0x48fa90['attributes']=_[_0xa137('0x2a')](_0x23c5e0[_0xa137('0x27')],qs[_0xa137('0x2b')](_0x415f2f[_0xa137('0x28')][_0xa137('0x2b')]));_0x48fa90[_0xa137('0x2c')]=_0x48fa90[_0xa137('0x2c')]['length']?_0x48fa90[_0xa137('0x2c')]:_0x23c5e0[_0xa137('0x27')];if(!_0x415f2f[_0xa137('0x28')]['hasOwnProperty'](_0xa137('0x2d'))){_0x48fa90[_0xa137('0x18')]=qs['limit'](_0x415f2f[_0xa137('0x28')][_0xa137('0x18')]);_0x48fa90['offset']=qs[_0xa137('0x16')](_0x415f2f[_0xa137('0x28')][_0xa137('0x16')]);}_0x48fa90[_0xa137('0x2e')]=qs[_0xa137('0x2f')](_0x415f2f[_0xa137('0x28')]['sort']);_0x48fa90[_0xa137('0x30')]=qs[_0xa137('0x31')](_['pick'](_0x415f2f[_0xa137('0x28')],_0x23c5e0[_0xa137('0x31')]),_0x101166);if(_0x415f2f[_0xa137('0x28')][_0xa137('0x32')]){_0x48fa90[_0xa137('0x30')]=_[_0xa137('0x33')](_0x48fa90[_0xa137('0x30')],{'$or':_[_0xa137('0x24')](_0x101166,function(_0x4ebf01){if(_0x4ebf01[_0xa137('0x34')]!=='VIRTUAL'){var _0x277da9={};_0x277da9[_0x4ebf01[_0xa137('0x22')]]={'$like':'%'+_0x415f2f[_0xa137('0x28')][_0xa137('0x32')]+'%'};return _0x277da9;}})});}_0x48fa90=_[_0xa137('0x33')]({},_0x48fa90,_0x415f2f[_0xa137('0x35')]);var _0x29663a={'where':_0x48fa90[_0xa137('0x30')]};return db[_0xa137('0x36')]['count'](_0x29663a)[_0xa137('0x1f')](function(_0x2fd92f){_0x996a56[_0xa137('0x19')]=_0x2fd92f;if(_0x415f2f[_0xa137('0x28')][_0xa137('0x37')]){_0x48fa90[_0xa137('0x38')]=[{'all':!![]}];}return db[_0xa137('0x36')][_0xa137('0x39')](_0x48fa90);})[_0xa137('0x1f')](function(_0x37b481){_0x996a56[_0xa137('0x3a')]=_0x37b481;return _0x996a56;})[_0xa137('0x1f')](respondWithFilteredResult(_0x150c0f,_0x48fa90))['catch'](handleError(_0x150c0f,null));};exports[_0xa137('0x3b')]=function(_0x97850f,_0x253a7a){var _0x151ca0={'raw':!![],'where':{'id':_0x97850f[_0xa137('0x3c')]['id']}},_0x486cdb={};_0x486cdb[_0xa137('0x27')]=_[_0xa137('0x29')](db[_0xa137('0x36')][_0xa137('0x25')]);_0x486cdb[_0xa137('0x28')]=_[_0xa137('0x29')](_0x97850f[_0xa137('0x28')]);_0x486cdb[_0xa137('0x31')]=_[_0xa137('0x2a')](_0x486cdb[_0xa137('0x27')],_0x486cdb['query']);_0x151ca0[_0xa137('0x2c')]=_[_0xa137('0x2a')](_0x486cdb[_0xa137('0x27')],qs[_0xa137('0x2b')](_0x97850f['query'][_0xa137('0x2b')]));_0x151ca0[_0xa137('0x2c')]=_0x151ca0['attributes'][_0xa137('0x3d')]?_0x151ca0[_0xa137('0x2c')]:_0x486cdb[_0xa137('0x27')];if(_0x97850f[_0xa137('0x28')][_0xa137('0x37')]){_0x151ca0[_0xa137('0x38')]=[{'all':!![]}];}_0x151ca0=_[_0xa137('0x33')]({},_0x151ca0,_0x97850f[_0xa137('0x35')]);return db[_0xa137('0x36')][_0xa137('0x3e')](_0x151ca0)[_0xa137('0x1f')](handleEntityNotFound(_0x253a7a,null))[_0xa137('0x1f')](respondWithResult(_0x253a7a,null))[_0xa137('0x3f')](handleError(_0x253a7a,null));};exports['create']=function(_0x461825,_0x62a2eb){return db[_0xa137('0x36')]['create'](_0x461825[_0xa137('0x40')],{})[_0xa137('0x1f')](respondWithResult(_0x62a2eb,0xc9))[_0xa137('0x3f')](handleError(_0x62a2eb,null));};exports[_0xa137('0x41')]=function(_0x121d2c,_0x2f73ed){if(_0x121d2c['body']['id']){delete _0x121d2c[_0xa137('0x40')]['id'];}return db[_0xa137('0x36')]['find']({'where':{'id':_0x121d2c[_0xa137('0x3c')]['id']}})[_0xa137('0x1f')](handleEntityNotFound(_0x2f73ed,null))[_0xa137('0x1f')](saveUpdates(_0x121d2c[_0xa137('0x40')],null))['then'](respondWithResult(_0x2f73ed,null))['catch'](handleError(_0x2f73ed,null));};exports[_0xa137('0x1e')]=function(_0x15dca6,_0x3c2b81){return db[_0xa137('0x36')]['find']({'where':{'id':_0x15dca6[_0xa137('0x3c')]['id']}})[_0xa137('0x1f')](handleEntityNotFound(_0x3c2b81,null))[_0xa137('0x1f')](removeEntity(_0x3c2b81,null))[_0xa137('0x3f')](handleError(_0x3c2b81,null));};exports[_0xa137('0x42')]=function(_0x52f2b3,_0x258951){return db[_0xa137('0x36')][_0xa137('0x42')]()[_0xa137('0x1f')](respondWithResult(_0x258951,null))[_0xa137('0x3f')](handleError(_0x258951,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cdd0c41..bd75f7e 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x2ef3,0xba));var _0x32ef=function(_0x2675a8,_0x53756a){_0x2675a8=_0x2675a8-0x0;var _0x15d1cc=_0x2ef3[_0x2675a8];return _0x15d1cc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x45700d,_0x185e3f){var _0x54716c=function(_0x191d75){while(--_0x191d75){_0x45700d['push'](_0x45700d['shift']());}};_0x54716c(++_0x185e3f);}(_0x1261,0x144));var _0x1126=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x1261[_0x2298f0];return _0x39b136;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 22913c5..2d9f43b 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 _0xbaf0=['UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','update','options','where','attributes','limit'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')](_0x53c338[_0x0baf('0x19')],{'raw':_0x53c338['options']?_0x53c338['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![]})[_0x0baf('0xc')](function(_0x32e839){logger[_0x0baf('0xd')](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x32e839));_0xfbecec(_0x32e839);})[_0x0baf('0x15')](function(_0x15a2c3){logger['error'](_0x0baf('0x16'),_0x15a2c3['message'],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x15a2c3['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ef0aa){var _0x48a0e9=this;return new Promise(function(_0x4be1b9,_0x47c4b){return db[_0x0baf('0x17')][_0x0baf('0x1b')](_0x2ef0aa[_0x0baf('0x19')],{'raw':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1d')]||null:null,'attributes':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1e')]||null:null,'limit':_0x2ef0aa['options']?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1f')]||null:null})[_0x0baf('0xc')](function(_0x265915){logger['info'](_0x0baf('0x20'),_0x2ef0aa);logger[_0x0baf('0x10')]('UpdateOpenchannelQueueReport',_0x2ef0aa,JSON[_0x0baf('0x12')](_0x265915));_0x4be1b9(_0x265915);})[_0x0baf('0x15')](function(_0x478ce8){logger[_0x0baf('0x13')](_0x0baf('0x20'),_0x478ce8[_0x0baf('0x14')],_0x2ef0aa);_0x47c4b(_0x48a0e9[_0x0baf('0x13')](0x1f4,_0x478ce8['message']));});});}; \ No newline at end of file +var _0x34b7=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x377dac,_0x40128d){var _0x3c91e3=function(_0x4ae295){while(--_0x4ae295){_0x377dac['push'](_0x377dac['shift']());}};_0x3c91e3(++_0x40128d);}(_0x34b7,0x196));var _0x734b=function(_0x2e748c,_0x55ec8e){_0x2e748c=_0x2e748c-0x0;var _0x37e219=_0x34b7[_0x2e748c];return _0x37e219;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateOpenchannelQueueReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')](_0x46d432[_0x734b('0x18')],{'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1e')]||null:null,'attributes':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1f')]||null:null,'limit':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x20')]||null:null})[_0x734b('0x1b')](function(_0x3ba39c){logger['info'](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x3ba39c));_0x26eccf(_0x3ba39c);})[_0x734b('0x14')](function(_0x427c36){logger[_0x734b('0xf')](_0x734b('0x1c'),_0x427c36[_0x734b('0x12')],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x427c36['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0451a6e..711a67c 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 _0x181c=['/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x181c,0x14b));var _0xc181=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x181c[_0x4f08dd];return _0x3017ee;};'use strict';var multer=require('multer');var util=require(_0xc181('0x0'));var path=require(_0xc181('0x1'));var timeout=require(_0xc181('0x2'));var express=require(_0xc181('0x3'));var router=express[_0xc181('0x4')]();var fs_extra=require(_0xc181('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc181('0x6'));var config=require(_0xc181('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xc181('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc181('0x8')](_0xc181('0x9'),auth[_0xc181('0xa')](),controller['describe']);router[_0xc181('0x8')](_0xc181('0xb'),auth[_0xc181('0xa')](),controller[_0xc181('0xc')]);router['post']('/',auth[_0xc181('0xa')](),controller[_0xc181('0xd')]);router[_0xc181('0xe')](_0xc181('0xb'),auth['isAuthenticated'](),controller[_0xc181('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc181('0x10')]);module[_0xc181('0x11')]=router; \ No newline at end of file +var _0xb6cb=['put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x21745e,_0x400db8){var _0x30a926=function(_0xc8a87f){while(--_0xc8a87f){_0x21745e['push'](_0x21745e['shift']());}};_0x30a926(++_0x400db8);}(_0xb6cb,0x194));var _0xbb6c=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0xb6cb[_0x1c206c];return _0x188aaa;};'use strict';var multer=require(_0xbb6c('0x0'));var util=require('util');var path=require(_0xbb6c('0x1'));var timeout=require(_0xbb6c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbb6c('0x3'));var auth=require(_0xbb6c('0x4'));var interaction=require(_0xbb6c('0x5'));var config=require(_0xbb6c('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xbb6c('0x7')]('/',auth[_0xbb6c('0x8')](),controller[_0xbb6c('0x9')]);router[_0xbb6c('0x7')](_0xbb6c('0xa'),auth[_0xbb6c('0x8')](),controller[_0xbb6c('0xb')]);router['get'](_0xbb6c('0xc'),auth['isAuthenticated'](),controller[_0xbb6c('0xd')]);router[_0xbb6c('0xe')]('/',auth[_0xbb6c('0x8')](),controller[_0xbb6c('0xf')]);router[_0xbb6c('0x10')](_0xbb6c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbb6c('0x11')](_0xbb6c('0xc'),auth[_0xbb6c('0x8')](),controller[_0xbb6c('0x12')]);module[_0xbb6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 80c0cb0..a2b59e2 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0x008c,0x188));var _0xc008=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0x008c[_0x12a04a];return _0x6d5409;};'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(_0x20e88e,_0x204982){var _0x88f10e=function(_0x5d6f66){while(--_0x5d6f66){_0x20e88e['push'](_0x20e88e['shift']());}};_0x88f10e(++_0x204982);}(_0xf4eb,0xec));var _0xbf4e=function(_0x53f4f9,_0x46dd56){_0x53f4f9=_0x53f4f9-0x0;var _0x383a82=_0xf4eb[_0x53f4f9];return _0x383a82;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 73c44e6..667ba61 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 _0xddb2=['include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xddb2,0x190));var _0x2ddb=function(_0x2429c6,_0x3e607b){_0x2429c6=_0x2429c6-0x0;var _0x252d79=_0xddb2[_0x2429c6];return _0x252d79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ddb('0x0'));var zipdir=require(_0x2ddb('0x1'));var jsonpatch=require(_0x2ddb('0x2'));var rp=require('request-promise');var moment=require(_0x2ddb('0x3'));var BPromise=require(_0x2ddb('0x4'));var Mustache=require('mustache');var util=require(_0x2ddb('0x5'));var path=require(_0x2ddb('0x6'));var sox=require(_0x2ddb('0x7'));var csv=require(_0x2ddb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ddb('0x9'));var _=require(_0x2ddb('0xa'));var squel=require(_0x2ddb('0xb'));var crypto=require(_0x2ddb('0xc'));var jsforce=require(_0x2ddb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ddb('0xe'));var Papa=require(_0x2ddb('0xf'));var Redis=require(_0x2ddb('0x10'));var authService=require(_0x2ddb('0x11'));var qs=require(_0x2ddb('0x12'));var as=require(_0x2ddb('0x13'));var hardwareService=require(_0x2ddb('0x14'));var logger=require(_0x2ddb('0x15'))(_0x2ddb('0x16'));var utils=require(_0x2ddb('0x17'));var config=require(_0x2ddb('0x18'));var licenseUtil=require(_0x2ddb('0x19'));var db=require(_0x2ddb('0x1a'))['db'];function respondWithStatusCode(_0x5e066a,_0x32cef0){_0x32cef0=_0x32cef0||0xcc;return function(_0x13c014){if(_0x13c014){return _0x5e066a['sendStatus'](_0x32cef0);}return _0x5e066a[_0x2ddb('0x1b')](_0x32cef0)['end']();};}function respondWithResult(_0x402ae5,_0x5afee9){_0x5afee9=_0x5afee9||0xc8;return function(_0x36fc1c){if(_0x36fc1c){return _0x402ae5[_0x2ddb('0x1b')](_0x5afee9)[_0x2ddb('0x1c')](_0x36fc1c);}};}function respondWithFilteredResult(_0x383d16,_0x5acb75){return function(_0x2258ed){if(_0x2258ed){var _0x4cff59=typeof _0x5acb75[_0x2ddb('0x1d')]===_0x2ddb('0x1e')&&typeof _0x5acb75[_0x2ddb('0x1f')]===_0x2ddb('0x1e');var _0x1a83ea=_0x2258ed['count'];var _0x4ec53d=_0x4cff59?0x0:_0x5acb75[_0x2ddb('0x1d')];var _0x3bc394=_0x4cff59?_0x2258ed[_0x2ddb('0x20')]:_0x5acb75['offset']+_0x5acb75[_0x2ddb('0x1f')];var _0x392765;if(_0x3bc394>=_0x1a83ea){_0x3bc394=_0x1a83ea;_0x392765=0xc8;}else{_0x392765=0xce;}_0x383d16['status'](_0x392765);return _0x383d16[_0x2ddb('0x21')](_0x2ddb('0x22'),_0x4ec53d+'-'+_0x3bc394+'/'+_0x1a83ea)[_0x2ddb('0x1c')](_0x2258ed);}return null;};}function patchUpdates(_0x426032){return function(_0x475bf4){try{jsonpatch[_0x2ddb('0x23')](_0x475bf4,_0x426032,!![]);}catch(_0x82c179){return BPromise[_0x2ddb('0x24')](_0x82c179);}return _0x475bf4[_0x2ddb('0x25')]();};}function saveUpdates(_0x1d8aec,_0x25a7eb){return function(_0x2fdaab){if(_0x2fdaab){return _0x2fdaab[_0x2ddb('0x26')](_0x1d8aec)[_0x2ddb('0x27')](function(_0x40f45b){return _0x40f45b;});}return null;};}function removeEntity(_0x51c419,_0x935545){return function(_0x57bcc3){if(_0x57bcc3){return _0x57bcc3[_0x2ddb('0x28')]()[_0x2ddb('0x27')](function(){_0x51c419['status'](0xcc)[_0x2ddb('0x29')]();});}};}function handleEntityNotFound(_0x4b6ce9,_0x3f5f95){return function(_0x59a84f){if(!_0x59a84f){_0x4b6ce9[_0x2ddb('0x2a')](0x194);}return _0x59a84f;};}function handleError(_0x2d708d,_0x44390e){_0x44390e=_0x44390e||0x1f4;return function(_0x4e64ee){logger['error'](_0x4e64ee[_0x2ddb('0x2b')]);if(_0x4e64ee[_0x2ddb('0x2c')]){delete _0x4e64ee['name'];}_0x2d708d[_0x2ddb('0x1b')](_0x44390e)[_0x2ddb('0x2d')](_0x4e64ee);};}exports['index']=function(_0x151237,_0x4df0df){var _0x30dfdd={},_0x489e8e={},_0x7ace7={'count':0x0,'rows':[]};var _0x1f16a3=_[_0x2ddb('0x2e')](db[_0x2ddb('0x2f')][_0x2ddb('0x30')],function(_0x27e4a2){return{'name':_0x27e4a2[_0x2ddb('0x31')],'type':_0x27e4a2[_0x2ddb('0x32')][_0x2ddb('0x33')]};});_0x489e8e[_0x2ddb('0x34')]=_[_0x2ddb('0x2e')](_0x1f16a3,'name');_0x489e8e[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x151237[_0x2ddb('0x35')]);_0x489e8e[_0x2ddb('0x37')]=_['intersection'](_0x489e8e[_0x2ddb('0x34')],_0x489e8e[_0x2ddb('0x35')]);_0x30dfdd['attributes']=_[_0x2ddb('0x38')](_0x489e8e[_0x2ddb('0x34')],qs[_0x2ddb('0x39')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x39')]));_0x30dfdd[_0x2ddb('0x3a')]=_0x30dfdd[_0x2ddb('0x3a')][_0x2ddb('0x3b')]?_0x30dfdd[_0x2ddb('0x3a')]:_0x489e8e[_0x2ddb('0x34')];if(!_0x151237[_0x2ddb('0x35')][_0x2ddb('0x3c')]('nolimit')){_0x30dfdd[_0x2ddb('0x1f')]=qs['limit'](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x1f')]);_0x30dfdd['offset']=qs[_0x2ddb('0x1d')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x1d')]);}_0x30dfdd[_0x2ddb('0x3d')]=qs[_0x2ddb('0x3e')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x3e')]);_0x30dfdd[_0x2ddb('0x3f')]=qs['filters'](_['pick'](_0x151237[_0x2ddb('0x35')],_0x489e8e['filters']),_0x1f16a3);if(_0x151237[_0x2ddb('0x35')]['filter']){_0x30dfdd['where']=_[_0x2ddb('0x40')](_0x30dfdd[_0x2ddb('0x3f')],{'$or':_[_0x2ddb('0x2e')](_0x1f16a3,function(_0x9edc63){if(_0x9edc63[_0x2ddb('0x32')]!==_0x2ddb('0x41')){var _0x19cff3={};_0x19cff3[_0x9edc63[_0x2ddb('0x2c')]]={'$like':'%'+_0x151237[_0x2ddb('0x35')][_0x2ddb('0x42')]+'%'};return _0x19cff3;}})});}_0x30dfdd=_[_0x2ddb('0x40')]({},_0x30dfdd,_0x151237[_0x2ddb('0x43')]);var _0x5900f6={'where':_0x30dfdd[_0x2ddb('0x3f')]};return db[_0x2ddb('0x2f')][_0x2ddb('0x20')](_0x5900f6)[_0x2ddb('0x27')](function(_0x6f8a20){_0x7ace7[_0x2ddb('0x20')]=_0x6f8a20;if(_0x151237[_0x2ddb('0x35')][_0x2ddb('0x44')]){_0x30dfdd['include']=[{'all':!![]}];}return db[_0x2ddb('0x2f')][_0x2ddb('0x45')](_0x30dfdd);})[_0x2ddb('0x27')](function(_0x6a8585){_0x7ace7[_0x2ddb('0x46')]=_0x6a8585;return _0x7ace7;})[_0x2ddb('0x27')](respondWithFilteredResult(_0x4df0df,_0x30dfdd))[_0x2ddb('0x47')](handleError(_0x4df0df,null));};exports[_0x2ddb('0x48')]=function(_0x427882,_0x1f35c5){var _0x16ff61={'raw':!![],'where':{'id':_0x427882[_0x2ddb('0x49')]['id']}},_0x10e4d5={};_0x10e4d5[_0x2ddb('0x34')]=_[_0x2ddb('0x36')](db[_0x2ddb('0x2f')][_0x2ddb('0x30')]);_0x10e4d5[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x427882[_0x2ddb('0x35')]);_0x10e4d5['filters']=_[_0x2ddb('0x38')](_0x10e4d5[_0x2ddb('0x34')],_0x10e4d5[_0x2ddb('0x35')]);_0x16ff61['attributes']=_[_0x2ddb('0x38')](_0x10e4d5[_0x2ddb('0x34')],qs[_0x2ddb('0x39')](_0x427882[_0x2ddb('0x35')][_0x2ddb('0x39')]));_0x16ff61[_0x2ddb('0x3a')]=_0x16ff61['attributes']['length']?_0x16ff61[_0x2ddb('0x3a')]:_0x10e4d5['model'];if(_0x427882[_0x2ddb('0x35')][_0x2ddb('0x44')]){_0x16ff61[_0x2ddb('0x4a')]=[{'all':!![]}];}_0x16ff61=_[_0x2ddb('0x40')]({},_0x16ff61,_0x427882[_0x2ddb('0x43')]);return db['OpenchannelTransferReport'][_0x2ddb('0x4b')](_0x16ff61)[_0x2ddb('0x27')](handleEntityNotFound(_0x1f35c5,null))['then'](respondWithResult(_0x1f35c5,null))[_0x2ddb('0x47')](handleError(_0x1f35c5,null));};exports[_0x2ddb('0x4c')]=function(_0x190b6b,_0x5d2f1d){return db[_0x2ddb('0x2f')][_0x2ddb('0x4c')](_0x190b6b[_0x2ddb('0x4d')],{})[_0x2ddb('0x27')](respondWithResult(_0x5d2f1d,0xc9))[_0x2ddb('0x47')](handleError(_0x5d2f1d,null));};exports[_0x2ddb('0x26')]=function(_0x5e673c,_0xc545fd){if(_0x5e673c[_0x2ddb('0x4d')]['id']){delete _0x5e673c[_0x2ddb('0x4d')]['id'];}return db['OpenchannelTransferReport'][_0x2ddb('0x4b')]({'where':{'id':_0x5e673c['params']['id']}})[_0x2ddb('0x27')](handleEntityNotFound(_0xc545fd,null))[_0x2ddb('0x27')](saveUpdates(_0x5e673c[_0x2ddb('0x4d')],null))['then'](respondWithResult(_0xc545fd,null))['catch'](handleError(_0xc545fd,null));};exports[_0x2ddb('0x28')]=function(_0xd7fa16,_0x5b3794){return db[_0x2ddb('0x2f')][_0x2ddb('0x4b')]({'where':{'id':_0xd7fa16['params']['id']}})[_0x2ddb('0x27')](handleEntityNotFound(_0x5b3794,null))[_0x2ddb('0x27')](removeEntity(_0x5b3794,null))[_0x2ddb('0x47')](handleError(_0x5b3794,null));};exports[_0x2ddb('0x4e')]=function(_0x2a68ac,_0x39fa06){return db['OpenchannelTransferReport'][_0x2ddb('0x4e')]()['then'](respondWithResult(_0x39fa06,null))[_0x2ddb('0x47')](handleError(_0x39fa06,null));}; \ No newline at end of file +var _0x8595=['show','includeAll','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelTransferReport','include','findAll'];(function(_0x3763da,_0x58158b){var _0x5d192f=function(_0x329668){while(--_0x329668){_0x3763da['push'](_0x3763da['shift']());}};_0x5d192f(++_0x58158b);}(_0x8595,0x1b8));var _0x5859=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8595[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require(_0x5859('0x0'));var rimraf=require(_0x5859('0x1'));var zipdir=require(_0x5859('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5859('0x3'));var moment=require(_0x5859('0x4'));var BPromise=require(_0x5859('0x5'));var Mustache=require('mustache');var util=require(_0x5859('0x6'));var path=require(_0x5859('0x7'));var sox=require(_0x5859('0x8'));var csv=require('to-csv');var ejs=require(_0x5859('0x9'));var fs=require('fs');var fs_extra=require(_0x5859('0xa'));var _=require(_0x5859('0xb'));var squel=require(_0x5859('0xc'));var crypto=require(_0x5859('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5859('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5859('0xf'));var Redis=require('ioredis');var authService=require(_0x5859('0x10'));var qs=require(_0x5859('0x11'));var as=require(_0x5859('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5859('0x13'))('api');var utils=require(_0x5859('0x14'));var config=require(_0x5859('0x15'));var licenseUtil=require(_0x5859('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x319829,_0x9e499c){_0x9e499c=_0x9e499c||0xcc;return function(_0x41ddee){if(_0x41ddee){return _0x319829['sendStatus'](_0x9e499c);}return _0x319829['status'](_0x9e499c)[_0x5859('0x17')]();};}function respondWithResult(_0x540edc,_0x47d6e2){_0x47d6e2=_0x47d6e2||0xc8;return function(_0x8a8f9){if(_0x8a8f9){return _0x540edc[_0x5859('0x18')](_0x47d6e2)[_0x5859('0x19')](_0x8a8f9);}};}function respondWithFilteredResult(_0x1d6e90,_0x41a11d){return function(_0x235faa){if(_0x235faa){var _0x430440=typeof _0x41a11d[_0x5859('0x1a')]===_0x5859('0x1b')&&typeof _0x41a11d['limit']===_0x5859('0x1b');var _0x49fe09=_0x235faa['count'];var _0x5d5f04=_0x430440?0x0:_0x41a11d[_0x5859('0x1a')];var _0x5be6b2=_0x430440?_0x235faa['count']:_0x41a11d[_0x5859('0x1a')]+_0x41a11d[_0x5859('0x1c')];var _0x12ec0a;if(_0x5be6b2>=_0x49fe09){_0x5be6b2=_0x49fe09;_0x12ec0a=0xc8;}else{_0x12ec0a=0xce;}_0x1d6e90[_0x5859('0x18')](_0x12ec0a);return _0x1d6e90[_0x5859('0x1d')]('Content-Range',_0x5d5f04+'-'+_0x5be6b2+'/'+_0x49fe09)['json'](_0x235faa);}return null;};}function patchUpdates(_0x35d58f){return function(_0x33fcd1){try{jsonpatch[_0x5859('0x1e')](_0x33fcd1,_0x35d58f,!![]);}catch(_0xcf4c4c){return BPromise[_0x5859('0x1f')](_0xcf4c4c);}return _0x33fcd1[_0x5859('0x20')]();};}function saveUpdates(_0x211546,_0x22d1ec){return function(_0x331755){if(_0x331755){return _0x331755[_0x5859('0x21')](_0x211546)[_0x5859('0x22')](function(_0x1ee54c){return _0x1ee54c;});}return null;};}function removeEntity(_0x5b6be0,_0x4c8991){return function(_0x10bd3a){if(_0x10bd3a){return _0x10bd3a[_0x5859('0x23')]()[_0x5859('0x22')](function(){_0x5b6be0['status'](0xcc)[_0x5859('0x17')]();});}};}function handleEntityNotFound(_0x470bcf,_0x16e626){return function(_0x1024bf){if(!_0x1024bf){_0x470bcf[_0x5859('0x24')](0x194);}return _0x1024bf;};}function handleError(_0xd9f4ed,_0x1c69ae){_0x1c69ae=_0x1c69ae||0x1f4;return function(_0x2d347b){logger[_0x5859('0x25')](_0x2d347b['stack']);if(_0x2d347b[_0x5859('0x26')]){delete _0x2d347b[_0x5859('0x26')];}_0xd9f4ed['status'](_0x1c69ae)[_0x5859('0x27')](_0x2d347b);};}exports[_0x5859('0x28')]=function(_0x275b06,_0x4c0619){var _0x55fb20={},_0x3dfb71={},_0x1c9bf8={'count':0x0,'rows':[]};var _0x1b3b13=_[_0x5859('0x29')](db['OpenchannelTransferReport'][_0x5859('0x2a')],function(_0x34d1bd){return{'name':_0x34d1bd[_0x5859('0x2b')],'type':_0x34d1bd['type'][_0x5859('0x2c')]};});_0x3dfb71[_0x5859('0x2d')]=_[_0x5859('0x29')](_0x1b3b13,_0x5859('0x26'));_0x3dfb71['query']=_['keys'](_0x275b06[_0x5859('0x2e')]);_0x3dfb71[_0x5859('0x2f')]=_[_0x5859('0x30')](_0x3dfb71[_0x5859('0x2d')],_0x3dfb71['query']);_0x55fb20[_0x5859('0x31')]=_[_0x5859('0x30')](_0x3dfb71[_0x5859('0x2d')],qs[_0x5859('0x32')](_0x275b06['query'][_0x5859('0x32')]));_0x55fb20['attributes']=_0x55fb20[_0x5859('0x31')][_0x5859('0x33')]?_0x55fb20[_0x5859('0x31')]:_0x3dfb71[_0x5859('0x2d')];if(!_0x275b06[_0x5859('0x2e')][_0x5859('0x34')](_0x5859('0x35'))){_0x55fb20[_0x5859('0x1c')]=qs[_0x5859('0x1c')](_0x275b06['query'][_0x5859('0x1c')]);_0x55fb20[_0x5859('0x1a')]=qs['offset'](_0x275b06[_0x5859('0x2e')][_0x5859('0x1a')]);}_0x55fb20[_0x5859('0x36')]=qs[_0x5859('0x37')](_0x275b06[_0x5859('0x2e')][_0x5859('0x37')]);_0x55fb20[_0x5859('0x38')]=qs['filters'](_['pick'](_0x275b06[_0x5859('0x2e')],_0x3dfb71['filters']),_0x1b3b13);if(_0x275b06[_0x5859('0x2e')][_0x5859('0x39')]){_0x55fb20[_0x5859('0x38')]=_[_0x5859('0x3a')](_0x55fb20['where'],{'$or':_[_0x5859('0x29')](_0x1b3b13,function(_0x40b064){if(_0x40b064['type']!==_0x5859('0x3b')){var _0x36e006={};_0x36e006[_0x40b064[_0x5859('0x26')]]={'$like':'%'+_0x275b06[_0x5859('0x2e')][_0x5859('0x39')]+'%'};return _0x36e006;}})});}_0x55fb20=_[_0x5859('0x3a')]({},_0x55fb20,_0x275b06[_0x5859('0x3c')]);var _0x52c30e={'where':_0x55fb20['where']};return db[_0x5859('0x3d')]['count'](_0x52c30e)['then'](function(_0x47f13c){_0x1c9bf8['count']=_0x47f13c;if(_0x275b06['query']['includeAll']){_0x55fb20[_0x5859('0x3e')]=[{'all':!![]}];}return db[_0x5859('0x3d')][_0x5859('0x3f')](_0x55fb20);})['then'](function(_0x270b61){_0x1c9bf8['rows']=_0x270b61;return _0x1c9bf8;})[_0x5859('0x22')](respondWithFilteredResult(_0x4c0619,_0x55fb20))['catch'](handleError(_0x4c0619,null));};exports[_0x5859('0x40')]=function(_0x2f82f4,_0x4db190){var _0x551652={'raw':!![],'where':{'id':_0x2f82f4['params']['id']}},_0x5b7b12={};_0x5b7b12[_0x5859('0x2d')]=_['keys'](db[_0x5859('0x3d')][_0x5859('0x2a')]);_0x5b7b12[_0x5859('0x2e')]=_['keys'](_0x2f82f4[_0x5859('0x2e')]);_0x5b7b12['filters']=_[_0x5859('0x30')](_0x5b7b12[_0x5859('0x2d')],_0x5b7b12[_0x5859('0x2e')]);_0x551652[_0x5859('0x31')]=_['intersection'](_0x5b7b12['model'],qs[_0x5859('0x32')](_0x2f82f4[_0x5859('0x2e')][_0x5859('0x32')]));_0x551652[_0x5859('0x31')]=_0x551652['attributes'][_0x5859('0x33')]?_0x551652[_0x5859('0x31')]:_0x5b7b12[_0x5859('0x2d')];if(_0x2f82f4[_0x5859('0x2e')][_0x5859('0x41')]){_0x551652['include']=[{'all':!![]}];}_0x551652=_[_0x5859('0x3a')]({},_0x551652,_0x2f82f4[_0x5859('0x3c')]);return db[_0x5859('0x3d')][_0x5859('0x42')](_0x551652)[_0x5859('0x22')](handleEntityNotFound(_0x4db190,null))['then'](respondWithResult(_0x4db190,null))['catch'](handleError(_0x4db190,null));};exports[_0x5859('0x43')]=function(_0x3492c3,_0x3b2db2){return db['OpenchannelTransferReport']['create'](_0x3492c3['body'],{})[_0x5859('0x22')](respondWithResult(_0x3b2db2,0xc9))['catch'](handleError(_0x3b2db2,null));};exports['update']=function(_0x414649,_0x33048c){if(_0x414649[_0x5859('0x44')]['id']){delete _0x414649[_0x5859('0x44')]['id'];}return db[_0x5859('0x3d')][_0x5859('0x42')]({'where':{'id':_0x414649[_0x5859('0x45')]['id']}})['then'](handleEntityNotFound(_0x33048c,null))['then'](saveUpdates(_0x414649[_0x5859('0x44')],null))[_0x5859('0x22')](respondWithResult(_0x33048c,null))[_0x5859('0x46')](handleError(_0x33048c,null));};exports[_0x5859('0x23')]=function(_0x3eb66d,_0xcefabb){return db['OpenchannelTransferReport'][_0x5859('0x42')]({'where':{'id':_0x3eb66d[_0x5859('0x45')]['id']}})[_0x5859('0x22')](handleEntityNotFound(_0xcefabb,null))['then'](removeEntity(_0xcefabb,null))[_0x5859('0x46')](handleError(_0xcefabb,null));};exports[_0x5859('0x47')]=function(_0x2dc3f7,_0x594ffc){return db[_0x5859('0x3d')]['describe']()['then'](respondWithResult(_0x594ffc,null))['catch'](handleError(_0x594ffc,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a665d23..58f5223 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 _0x5681=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x485ef2,_0x14ca2e){var _0x53ab53=function(_0xcf1785){while(--_0xcf1785){_0x485ef2['push'](_0x485ef2['shift']());}};_0x53ab53(++_0x14ca2e);}(_0x5681,0xbb));var _0x1568=function(_0x253e5d,_0x451f92){_0x253e5d=_0x253e5d-0x0;var _0x1349a9=_0x5681[_0x253e5d];return _0x1349a9;};'use strict';var _=require(_0x1568('0x0'));var util=require(_0x1568('0x1'));var logger=require('../../config/logger')(_0x1568('0x2'));var moment=require(_0x1568('0x3'));var BPromise=require(_0x1568('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1568('0x5'));var rimraf=require(_0x1568('0x6'));var config=require(_0x1568('0x7'));var attributes=require(_0x1568('0x8'));module[_0x1568('0x9')]=function(_0x51acb0,_0xcd662e){return _0x51acb0[_0x1568('0xa')](_0x1568('0xb'),attributes,{'tableName':_0x1568('0xc'),'paranoid':![],'indexes':[{'name':_0x1568('0xd'),'fields':[_0x1568('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcce=['path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1fd662,_0x2a191b){var _0x42735d=function(_0x1b6edc){while(--_0x1b6edc){_0x1fd662['push'](_0x1fd662['shift']());}};_0x42735d(++_0x2a191b);}(_0xbcce,0x12e));var _0xebcc=function(_0x1f9c58,_0x5553b2){_0x1f9c58=_0x1f9c58-0x0;var _0x2419f4=_0xbcce[_0x1f9c58];return _0x2419f4;};'use strict';var _=require(_0xebcc('0x0'));var util=require(_0xebcc('0x1'));var logger=require(_0xebcc('0x2'))('api');var moment=require(_0xebcc('0x3'));var BPromise=require(_0xebcc('0x4'));var rp=require(_0xebcc('0x5'));var fs=require('fs');var path=require(_0xebcc('0x6'));var rimraf=require('rimraf');var config=require(_0xebcc('0x7'));var attributes=require(_0xebcc('0x8'));module[_0xebcc('0x9')]=function(_0x3bd650,_0x37784){return _0x3bd650[_0xebcc('0xa')](_0xebcc('0xb'),attributes,{'tableName':_0xebcc('0xc'),'paranoid':![],'indexes':[{'name':_0xebcc('0xd'),'fields':[_0xebcc('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 3f893ed..f67c6c0 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 _0xb38e=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f9e3a,_0x5689d4){var _0x55a591=function(_0x2d2524){while(--_0x2d2524){_0x2f9e3a['push'](_0x2f9e3a['shift']());}};_0x55a591(++_0x5689d4);}(_0xb38e,0xa7));var _0xeb38=function(_0x5987e3,_0x511e26){_0x5987e3=_0x5987e3-0x0;var _0x4fc458=_0xb38e[_0x5987e3];return _0x4fc458;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var moment=require(_0xeb38('0x2'));var BPromise=require(_0xeb38('0x3'));var rs=require(_0xeb38('0x4'));var fs=require('fs');var Redis=require(_0xeb38('0x5'));var db=require(_0xeb38('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb38('0x7'))(_0xeb38('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb38('0x9'));var client=jayson[_0xeb38('0xa')][_0xeb38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31db8c,_0x4cfa4d,_0x3003aa){return new BPromise(function(_0x196580,_0x3b2df7){return client[_0xeb38('0xc')](_0x31db8c,_0x3003aa)['then'](function(_0x2b0c8b){logger[_0xeb38('0xd')](_0xeb38('0xe'),_0x4cfa4d,_0xeb38('0xf'));logger[_0xeb38('0x10')](_0xeb38('0x11'),_0x4cfa4d,_0xeb38('0xf'),JSON['stringify'](_0x2b0c8b));if(_0x2b0c8b[_0xeb38('0x12')]){if(_0x2b0c8b['error'][_0xeb38('0x13')]===0x1f4){logger[_0xeb38('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cfa4d,_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);return _0x3b2df7(_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);}logger[_0xeb38('0x12')](_0xeb38('0xe'),_0x4cfa4d,_0x2b0c8b['error'][_0xeb38('0x14')]);return _0x196580(_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);}else{logger[_0xeb38('0xd')](_0xeb38('0xe'),_0x4cfa4d,_0xeb38('0xf'));_0x196580(_0x2b0c8b[_0xeb38('0x15')]['message']);}})[_0xeb38('0x16')](function(_0x980c8){logger[_0xeb38('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cfa4d,_0x980c8);_0x3b2df7(_0x980c8);});});} \ No newline at end of file +var _0xed1f=['OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x59f014,_0x5e1229){var _0x48a930=function(_0x180e92){while(--_0x180e92){_0x59f014['push'](_0x59f014['shift']());}};_0x48a930(++_0x5e1229);}(_0xed1f,0x170));var _0xfed1=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xed1f[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfed1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfed1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfed1('0x4'))(_0xfed1('0x5'));var config=require(_0xfed1('0x6'));var jayson=require(_0xfed1('0x7'));var client=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x471095,_0x396781,_0x4e7fe7){return new BPromise(function(_0x37565a,_0x550f10){return client[_0xfed1('0xa')](_0x471095,_0x4e7fe7)[_0xfed1('0xb')](function(_0x33d380){logger['info'](_0xfed1('0xc'),_0x396781,'request\x20sent');logger['debug'](_0xfed1('0xd'),_0x396781,_0xfed1('0xe'),JSON['stringify'](_0x33d380));if(_0x33d380['error']){if(_0x33d380[_0xfed1('0xf')][_0xfed1('0x10')]===0x1f4){logger['error'](_0xfed1('0xc'),_0x396781,_0x33d380['error'][_0xfed1('0x11')]);return _0x550f10(_0x33d380[_0xfed1('0xf')][_0xfed1('0x11')]);}logger[_0xfed1('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x396781,_0x33d380[_0xfed1('0xf')][_0xfed1('0x11')]);return _0x37565a(_0x33d380['error']['message']);}else{logger[_0xfed1('0x12')](_0xfed1('0xc'),_0x396781,_0xfed1('0xe'));_0x37565a(_0x33d380['result'][_0xfed1('0x11')]);}})[_0xfed1('0x13')](function(_0x42d67c){logger[_0xfed1('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x396781,_0x42d67c);_0x550f10(_0x42d67c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0dee6be..1e83a68 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 _0x1827=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x342927,_0x4abe14){var _0x8ab3a7=function(_0x3b72ed){while(--_0x3b72ed){_0x342927['push'](_0x342927['shift']());}};_0x8ab3a7(++_0x4abe14);}(_0x1827,0x1dc));var _0x7182=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1827[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require(_0x7182('0x0'));var path=require(_0x7182('0x1'));var timeout=require(_0x7182('0x2'));var express=require(_0x7182('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7182('0x4'));var interaction=require(_0x7182('0x5'));var config=require(_0x7182('0x6'));var controller=require(_0x7182('0x7'));router[_0x7182('0x8')]('/',auth[_0x7182('0x9')](),controller[_0x7182('0xa')]);router[_0x7182('0x8')](_0x7182('0xb'),auth[_0x7182('0x9')](),controller['show']);router['post']('/',auth[_0x7182('0x9')](),controller['create']);router['put']('/:id',auth[_0x7182('0x9')](),controller['update']);router[_0x7182('0xc')](_0x7182('0xb'),auth[_0x7182('0x9')](),controller[_0x7182('0xd')]);module[_0x7182('0xe')]=router; \ No newline at end of file +var _0x7085=['index','show','post','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x7085,0x7e));var _0x5708=function(_0x3c3fc9,_0x19452a){_0x3c3fc9=_0x3c3fc9-0x0;var _0x34debd=_0x7085[_0x3c3fc9];return _0x34debd;};'use strict';var multer=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var path=require(_0x5708('0x2'));var timeout=require(_0x5708('0x3'));var express=require(_0x5708('0x4'));var router=express[_0x5708('0x5')]();var fs_extra=require(_0x5708('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5708('0x7'));var config=require(_0x5708('0x8'));var controller=require('./pause.controller');router['get']('/',auth[_0x5708('0x9')](),controller[_0x5708('0xa')]);router['get']('/:id',auth[_0x5708('0x9')](),controller[_0x5708('0xb')]);router[_0x5708('0xc')]('/',auth['isAuthenticated'](),controller[_0x5708('0xd')]);router['put'](_0x5708('0xe'),auth[_0x5708('0x9')](),controller[_0x5708('0xf')]);router[_0x5708('0x10')](_0x5708('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 949796f..c72df78 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 _0xce71=['STRING','sequelize','exports','name'];(function(_0xad2f25,_0x5d0f1e){var _0x9a937e=function(_0x1e78ac){while(--_0x1e78ac){_0xad2f25['push'](_0xad2f25['shift']());}};_0x9a937e(++_0x5d0f1e);}(_0xce71,0x79));var _0x1ce7=function(_0xd3917d,_0x732781){_0xd3917d=_0xd3917d-0x0;var _0x35aa9d=_0xce71[_0xd3917d];return _0x35aa9d;};'use strict';var Sequelize=require(_0x1ce7('0x0'));module[_0x1ce7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1ce7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1ce7('0x3')]}}; \ No newline at end of file +var _0xddb9=['name','exports','STRING'];(function(_0x511387,_0x50f16d){var _0x4241ea=function(_0x13ea99){while(--_0x13ea99){_0x511387['push'](_0x511387['shift']());}};_0x4241ea(++_0x50f16d);}(_0xddb9,0x157));var _0x9ddb=function(_0xdcd63b,_0x274fc8){_0xdcd63b=_0xdcd63b-0x0;var _0x2b786f=_0xddb9[_0xdcd63b];return _0x2b786f;};'use strict';var Sequelize=require('sequelize');module[_0x9ddb('0x0')]={'name':{'type':Sequelize[_0x9ddb('0x1')],'unique':_0x9ddb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9ddb('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 451dc95..3621b28 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 _0x86cc=['Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','name','send','index','map','Pause','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count'];(function(_0x272ea6,_0x3f0673){var _0x43ef03=function(_0x2307e2){while(--_0x2307e2){_0x272ea6['push'](_0x272ea6['shift']());}};_0x43ef03(++_0x3f0673);}(_0x86cc,0x1e3));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc86c('0x0'));var zipdir=require(_0xc86c('0x1'));var jsonpatch=require(_0xc86c('0x2'));var rp=require('request-promise');var moment=require(_0xc86c('0x3'));var BPromise=require(_0xc86c('0x4'));var Mustache=require(_0xc86c('0x5'));var util=require(_0xc86c('0x6'));var path=require(_0xc86c('0x7'));var sox=require(_0xc86c('0x8'));var csv=require(_0xc86c('0x9'));var ejs=require(_0xc86c('0xa'));var fs=require('fs');var fs_extra=require(_0xc86c('0xb'));var _=require(_0xc86c('0xc'));var squel=require(_0xc86c('0xd'));var crypto=require(_0xc86c('0xe'));var jsforce=require(_0xc86c('0xf'));var deskjs=require(_0xc86c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc86c('0x11'));var Papa=require(_0xc86c('0x12'));var Redis=require(_0xc86c('0x13'));var authService=require(_0xc86c('0x14'));var qs=require(_0xc86c('0x15'));var as=require(_0xc86c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc86c('0x17'))(_0xc86c('0x18'));var utils=require('../../config/utils');var config=require(_0xc86c('0x19'));var licenseUtil=require(_0xc86c('0x1a'));var db=require(_0xc86c('0x1b'))['db'];function respondWithStatusCode(_0x20dc87,_0x1b912c){_0x1b912c=_0x1b912c||0xcc;return function(_0x53297e){if(_0x53297e){return _0x20dc87['sendStatus'](_0x1b912c);}return _0x20dc87[_0xc86c('0x1c')](_0x1b912c)['end']();};}function respondWithResult(_0x5343c3,_0x27a45b){_0x27a45b=_0x27a45b||0xc8;return function(_0x2c95e5){if(_0x2c95e5){return _0x5343c3[_0xc86c('0x1c')](_0x27a45b)[_0xc86c('0x1d')](_0x2c95e5);}};}function respondWithFilteredResult(_0x25355e,_0x1adbda){return function(_0x5ce0cf){if(_0x5ce0cf){var _0x3a69a3=typeof _0x1adbda[_0xc86c('0x1e')]===_0xc86c('0x1f')&&typeof _0x1adbda['limit']===_0xc86c('0x1f');var _0x2bbf31=_0x5ce0cf[_0xc86c('0x20')];var _0x5eef77=_0x3a69a3?0x0:_0x1adbda['offset'];var _0x169abd=_0x3a69a3?_0x5ce0cf[_0xc86c('0x20')]:_0x1adbda[_0xc86c('0x1e')]+_0x1adbda['limit'];var _0xad8bbc;if(_0x169abd>=_0x2bbf31){_0x169abd=_0x2bbf31;_0xad8bbc=0xc8;}else{_0xad8bbc=0xce;}_0x25355e[_0xc86c('0x1c')](_0xad8bbc);return _0x25355e['set'](_0xc86c('0x21'),_0x5eef77+'-'+_0x169abd+'/'+_0x2bbf31)['json'](_0x5ce0cf);}return null;};}function patchUpdates(_0x211581){return function(_0x175b9e){try{jsonpatch[_0xc86c('0x22')](_0x175b9e,_0x211581,!![]);}catch(_0x1aeddf){return BPromise['reject'](_0x1aeddf);}return _0x175b9e[_0xc86c('0x23')]();};}function saveUpdates(_0x1fd495,_0xf48fac){return function(_0x144d56){if(_0x144d56){return _0x144d56[_0xc86c('0x24')](_0x1fd495)[_0xc86c('0x25')](function(_0x7c83ed){return _0x7c83ed;});}return null;};}function removeEntity(_0xf1fed4,_0x5736f1){return function(_0x458d42){if(_0x458d42){return _0x458d42[_0xc86c('0x26')]()[_0xc86c('0x25')](function(){var _0x5d06d5=_0x458d42[_0xc86c('0x27')]({'plain':!![]});var _0x1d2bf7=_0xc86c('0x28');return db[_0xc86c('0x29')][_0xc86c('0x26')]({'where':{'type':_0x1d2bf7,'resourceId':_0x5d06d5['id']}})[_0xc86c('0x25')](function(){return _0x458d42;});})[_0xc86c('0x25')](function(){_0xf1fed4[_0xc86c('0x1c')](0xcc)[_0xc86c('0x2a')]();});}};}function handleEntityNotFound(_0x351c77,_0x1bba1d){return function(_0x3d62a1){if(!_0x3d62a1){_0x351c77[_0xc86c('0x2b')](0x194);}return _0x3d62a1;};}function handleError(_0x2e46d5,_0xb99e7){_0xb99e7=_0xb99e7||0x1f4;return function(_0x3ea184){logger[_0xc86c('0x2c')](_0x3ea184['stack']);if(_0x3ea184[_0xc86c('0x2d')]){delete _0x3ea184['name'];}_0x2e46d5[_0xc86c('0x1c')](_0xb99e7)[_0xc86c('0x2e')](_0x3ea184);};}exports[_0xc86c('0x2f')]=function(_0x3a5ebe,_0x50e9ff){var _0x454e22={},_0x3dc5e9={},_0x87b7b8={'count':0x0,'rows':[]};var _0x14da1d=_[_0xc86c('0x30')](db[_0xc86c('0x31')]['rawAttributes'],function(_0x54bf52){return{'name':_0x54bf52[_0xc86c('0x32')],'type':_0x54bf52[_0xc86c('0x33')][_0xc86c('0x34')]};});_0x3dc5e9['model']=_[_0xc86c('0x30')](_0x14da1d,'name');_0x3dc5e9['query']=_[_0xc86c('0x35')](_0x3a5ebe[_0xc86c('0x36')]);_0x3dc5e9[_0xc86c('0x37')]=_[_0xc86c('0x38')](_0x3dc5e9['model'],_0x3dc5e9[_0xc86c('0x36')]);_0x454e22[_0xc86c('0x39')]=_[_0xc86c('0x38')](_0x3dc5e9[_0xc86c('0x3a')],qs[_0xc86c('0x3b')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3b')]));_0x454e22[_0xc86c('0x39')]=_0x454e22[_0xc86c('0x39')]['length']?_0x454e22[_0xc86c('0x39')]:_0x3dc5e9[_0xc86c('0x3a')];if(!_0x3a5ebe['query'][_0xc86c('0x3c')]('nolimit')){_0x454e22['limit']=qs['limit'](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3d')]);_0x454e22['offset']=qs[_0xc86c('0x1e')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x1e')]);}_0x454e22[_0xc86c('0x3e')]=qs[_0xc86c('0x3f')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3f')]);_0x454e22[_0xc86c('0x40')]=qs['filters'](_[_0xc86c('0x41')](_0x3a5ebe[_0xc86c('0x36')],_0x3dc5e9[_0xc86c('0x37')]),_0x14da1d);if(_0x3a5ebe[_0xc86c('0x36')]['filter']){_0x454e22[_0xc86c('0x40')]=_[_0xc86c('0x42')](_0x454e22[_0xc86c('0x40')],{'$or':_[_0xc86c('0x30')](_0x14da1d,function(_0x16d2ff){if(_0x16d2ff[_0xc86c('0x33')]!==_0xc86c('0x43')){var _0x1b512a={};_0x1b512a[_0x16d2ff[_0xc86c('0x2d')]]={'$like':'%'+_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x44')]+'%'};return _0x1b512a;}})});}_0x454e22=_['merge']({},_0x454e22,_0x3a5ebe[_0xc86c('0x45')]);var _0x3a761b={'where':_0x454e22[_0xc86c('0x40')]};return db[_0xc86c('0x31')][_0xc86c('0x20')](_0x3a761b)['then'](function(_0x2f1780){_0x87b7b8[_0xc86c('0x20')]=_0x2f1780;if(_0x3a5ebe['query'][_0xc86c('0x46')]){_0x454e22['include']=[{'all':!![]}];}return db[_0xc86c('0x31')][_0xc86c('0x47')](_0x454e22);})[_0xc86c('0x25')](function(_0x219528){_0x87b7b8[_0xc86c('0x48')]=_0x219528;return _0x87b7b8;})[_0xc86c('0x25')](respondWithFilteredResult(_0x50e9ff,_0x454e22))[_0xc86c('0x49')](handleError(_0x50e9ff,null));};exports['show']=function(_0x6aea45,_0x259457){var _0x45e1c3={'raw':!![],'where':{'id':_0x6aea45[_0xc86c('0x4a')]['id']}},_0x3323cc={};_0x3323cc[_0xc86c('0x3a')]=_['keys'](db[_0xc86c('0x31')][_0xc86c('0x4b')]);_0x3323cc[_0xc86c('0x36')]=_[_0xc86c('0x35')](_0x6aea45[_0xc86c('0x36')]);_0x3323cc[_0xc86c('0x37')]=_[_0xc86c('0x38')](_0x3323cc['model'],_0x3323cc[_0xc86c('0x36')]);_0x45e1c3[_0xc86c('0x39')]=_['intersection'](_0x3323cc[_0xc86c('0x3a')],qs['fields'](_0x6aea45[_0xc86c('0x36')][_0xc86c('0x3b')]));_0x45e1c3['attributes']=_0x45e1c3['attributes'][_0xc86c('0x4c')]?_0x45e1c3[_0xc86c('0x39')]:_0x3323cc[_0xc86c('0x3a')];if(_0x6aea45[_0xc86c('0x36')][_0xc86c('0x46')]){_0x45e1c3['include']=[{'all':!![]}];}_0x45e1c3=_['merge']({},_0x45e1c3,_0x6aea45['options']);return db[_0xc86c('0x31')][_0xc86c('0x4d')](_0x45e1c3)[_0xc86c('0x25')](handleEntityNotFound(_0x259457,null))[_0xc86c('0x25')](respondWithResult(_0x259457,null))['catch'](handleError(_0x259457,null));};exports[_0xc86c('0x4e')]=function(_0x520631,_0x8c3867){return db[_0xc86c('0x31')][_0xc86c('0x4e')](_0x520631[_0xc86c('0x4f')],{})['then'](function(_0x370d1f){var _0x133b2a=_0x520631[_0xc86c('0x50')][_0xc86c('0x27')]({'plain':!![]});if(!_0x133b2a)throw new Error(_0xc86c('0x51'));if(_0x133b2a[_0xc86c('0x52')]===_0xc86c('0x50')){var _0x4def1b=_0x370d1f['get']({'plain':!![]});var _0x1bbe2b=_0xc86c('0x28');return db[_0xc86c('0x53')]['find']({'where':{'name':_0x1bbe2b,'userProfileId':_0x133b2a['userProfileId']},'raw':!![]})['then'](function(_0x393781){if(_0x393781&&_0x393781[_0xc86c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4def1b[_0xc86c('0x2d')],'resourceId':_0x4def1b['id'],'type':_0x393781[_0xc86c('0x2d')],'sectionId':_0x393781['id']},{})[_0xc86c('0x25')](function(){return _0x370d1f;});}else{return _0x370d1f;}})[_0xc86c('0x49')](function(_0x18cbc2){logger[_0xc86c('0x2c')](_0xc86c('0x55'),_0x18cbc2);throw _0x18cbc2;});}return _0x370d1f;})[_0xc86c('0x25')](respondWithResult(_0x8c3867,0xc9))['catch'](handleError(_0x8c3867,null));};exports[_0xc86c('0x24')]=function(_0x2d0727,_0x314b08){if(_0x2d0727[_0xc86c('0x4f')]['id']){delete _0x2d0727[_0xc86c('0x4f')]['id'];}return db[_0xc86c('0x31')][_0xc86c('0x4d')]({'where':{'id':_0x2d0727[_0xc86c('0x4a')]['id']}})[_0xc86c('0x25')](handleEntityNotFound(_0x314b08,null))['then'](saveUpdates(_0x2d0727[_0xc86c('0x4f')],null))[_0xc86c('0x25')](respondWithResult(_0x314b08,null))[_0xc86c('0x49')](handleError(_0x314b08,null));};exports[_0xc86c('0x26')]=function(_0x15a562,_0x1f0b6f){return db[_0xc86c('0x31')]['find']({'where':{'id':_0x15a562[_0xc86c('0x4a')]['id']}})[_0xc86c('0x25')](handleEntityNotFound(_0x1f0b6f,null))[_0xc86c('0x25')](removeEntity(_0x1f0b6f,null))[_0xc86c('0x49')](handleError(_0x1f0b6f,null));}; \ No newline at end of file +var _0x7c4f=['filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','Pause','include','findAll','catch','params','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Pauses','error','stack','name','send','index','map','rawAttributes','type','model','keys'];(function(_0x2e41ea,_0x1dfcd1){var _0x3410a9=function(_0xd9bc03){while(--_0xd9bc03){_0x2e41ea['push'](_0x2e41ea['shift']());}};_0x3410a9(++_0x1dfcd1);}(_0x7c4f,0x151));var _0xf7c4=function(_0x3ed3bd,_0x2b0e9d){_0x3ed3bd=_0x3ed3bd-0x0;var _0x219579=_0x7c4f[_0x3ed3bd];return _0x219579;};'use strict';var emlformat=require(_0xf7c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7c4('0x1'));var jsonpatch=require(_0xf7c4('0x2'));var rp=require(_0xf7c4('0x3'));var moment=require('moment');var BPromise=require(_0xf7c4('0x4'));var Mustache=require(_0xf7c4('0x5'));var util=require(_0xf7c4('0x6'));var path=require(_0xf7c4('0x7'));var sox=require(_0xf7c4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7c4('0x9'));var _=require(_0xf7c4('0xa'));var squel=require(_0xf7c4('0xb'));var crypto=require(_0xf7c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf7c4('0xd'));var toCsv=require(_0xf7c4('0xe'));var querystring=require(_0xf7c4('0xf'));var Papa=require(_0xf7c4('0x10'));var Redis=require('ioredis');var authService=require(_0xf7c4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf7c4('0x12'));var hardwareService=require(_0xf7c4('0x13'));var logger=require(_0xf7c4('0x14'))(_0xf7c4('0x15'));var utils=require(_0xf7c4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d6c6d,_0x17bec4){_0x17bec4=_0x17bec4||0xcc;return function(_0x2cfcee){if(_0x2cfcee){return _0x3d6c6d[_0xf7c4('0x17')](_0x17bec4);}return _0x3d6c6d[_0xf7c4('0x18')](_0x17bec4)[_0xf7c4('0x19')]();};}function respondWithResult(_0x27ba8c,_0xfdd62d){_0xfdd62d=_0xfdd62d||0xc8;return function(_0x3d1460){if(_0x3d1460){return _0x27ba8c[_0xf7c4('0x18')](_0xfdd62d)[_0xf7c4('0x1a')](_0x3d1460);}};}function respondWithFilteredResult(_0x215db0,_0x40dd69){return function(_0x447815){if(_0x447815){var _0x3e19db=typeof _0x40dd69[_0xf7c4('0x1b')]===_0xf7c4('0x1c')&&typeof _0x40dd69[_0xf7c4('0x1d')]===_0xf7c4('0x1c');var _0xb7bf96=_0x447815['count'];var _0x3b00a3=_0x3e19db?0x0:_0x40dd69['offset'];var _0x2b5a19=_0x3e19db?_0x447815[_0xf7c4('0x1e')]:_0x40dd69[_0xf7c4('0x1b')]+_0x40dd69[_0xf7c4('0x1d')];var _0x31bf6c;if(_0x2b5a19>=_0xb7bf96){_0x2b5a19=_0xb7bf96;_0x31bf6c=0xc8;}else{_0x31bf6c=0xce;}_0x215db0['status'](_0x31bf6c);return _0x215db0[_0xf7c4('0x1f')](_0xf7c4('0x20'),_0x3b00a3+'-'+_0x2b5a19+'/'+_0xb7bf96)[_0xf7c4('0x1a')](_0x447815);}return null;};}function patchUpdates(_0x23c832){return function(_0x1d9e0a){try{jsonpatch['apply'](_0x1d9e0a,_0x23c832,!![]);}catch(_0x4a36e8){return BPromise['reject'](_0x4a36e8);}return _0x1d9e0a[_0xf7c4('0x21')]();};}function saveUpdates(_0x48b7ee,_0x2a6f4f){return function(_0x143519){if(_0x143519){return _0x143519['update'](_0x48b7ee)[_0xf7c4('0x22')](function(_0xbb82da){return _0xbb82da;});}return null;};}function removeEntity(_0x5df171,_0x379d55){return function(_0x4882c6){if(_0x4882c6){return _0x4882c6[_0xf7c4('0x23')]()[_0xf7c4('0x22')](function(){var _0x24535f=_0x4882c6[_0xf7c4('0x24')]({'plain':!![]});var _0x2e5f9e=_0xf7c4('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e5f9e,'resourceId':_0x24535f['id']}})[_0xf7c4('0x22')](function(){return _0x4882c6;});})[_0xf7c4('0x22')](function(){_0x5df171[_0xf7c4('0x18')](0xcc)[_0xf7c4('0x19')]();});}};}function handleEntityNotFound(_0x4d1a8a,_0xeba4f7){return function(_0x12a4b9){if(!_0x12a4b9){_0x4d1a8a[_0xf7c4('0x17')](0x194);}return _0x12a4b9;};}function handleError(_0x40068b,_0xd370d3){_0xd370d3=_0xd370d3||0x1f4;return function(_0x275ef7){logger[_0xf7c4('0x26')](_0x275ef7[_0xf7c4('0x27')]);if(_0x275ef7['name']){delete _0x275ef7[_0xf7c4('0x28')];}_0x40068b[_0xf7c4('0x18')](_0xd370d3)[_0xf7c4('0x29')](_0x275ef7);};}exports[_0xf7c4('0x2a')]=function(_0x5cd469,_0x26d814){var _0x357e37={},_0x163244={},_0x2a081c={'count':0x0,'rows':[]};var _0x239fff=_[_0xf7c4('0x2b')](db['Pause'][_0xf7c4('0x2c')],function(_0x1bc0ef){return{'name':_0x1bc0ef['fieldName'],'type':_0x1bc0ef[_0xf7c4('0x2d')]['key']};});_0x163244[_0xf7c4('0x2e')]=_[_0xf7c4('0x2b')](_0x239fff,_0xf7c4('0x28'));_0x163244['query']=_[_0xf7c4('0x2f')](_0x5cd469['query']);_0x163244[_0xf7c4('0x30')]=_[_0xf7c4('0x31')](_0x163244['model'],_0x163244['query']);_0x357e37[_0xf7c4('0x32')]=_[_0xf7c4('0x31')](_0x163244[_0xf7c4('0x2e')],qs[_0xf7c4('0x33')](_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x33')]));_0x357e37[_0xf7c4('0x32')]=_0x357e37[_0xf7c4('0x32')][_0xf7c4('0x35')]?_0x357e37[_0xf7c4('0x32')]:_0x163244['model'];if(!_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x36')](_0xf7c4('0x37'))){_0x357e37[_0xf7c4('0x1d')]=qs['limit'](_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x1d')]);_0x357e37[_0xf7c4('0x1b')]=qs[_0xf7c4('0x1b')](_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x1b')]);}_0x357e37['order']=qs[_0xf7c4('0x38')](_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x38')]);_0x357e37['where']=qs['filters'](_[_0xf7c4('0x39')](_0x5cd469[_0xf7c4('0x34')],_0x163244['filters']),_0x239fff);if(_0x5cd469['query'][_0xf7c4('0x3a')]){_0x357e37['where']=_[_0xf7c4('0x3b')](_0x357e37[_0xf7c4('0x3c')],{'$or':_[_0xf7c4('0x2b')](_0x239fff,function(_0x24c0bb){if(_0x24c0bb['type']!==_0xf7c4('0x3d')){var _0x32563e={};_0x32563e[_0x24c0bb[_0xf7c4('0x28')]]={'$like':'%'+_0x5cd469[_0xf7c4('0x34')][_0xf7c4('0x3a')]+'%'};return _0x32563e;}})});}_0x357e37=_[_0xf7c4('0x3b')]({},_0x357e37,_0x5cd469[_0xf7c4('0x3e')]);var _0x24c3d4={'where':_0x357e37[_0xf7c4('0x3c')]};return db[_0xf7c4('0x3f')][_0xf7c4('0x1e')](_0x24c3d4)[_0xf7c4('0x22')](function(_0x5999ab){_0x2a081c[_0xf7c4('0x1e')]=_0x5999ab;if(_0x5cd469[_0xf7c4('0x34')]['includeAll']){_0x357e37[_0xf7c4('0x40')]=[{'all':!![]}];}return db[_0xf7c4('0x3f')][_0xf7c4('0x41')](_0x357e37);})['then'](function(_0x4ce67c){_0x2a081c['rows']=_0x4ce67c;return _0x2a081c;})[_0xf7c4('0x22')](respondWithFilteredResult(_0x26d814,_0x357e37))[_0xf7c4('0x42')](handleError(_0x26d814,null));};exports['show']=function(_0x196ab3,_0x1872db){var _0x9ee822={'raw':!![],'where':{'id':_0x196ab3[_0xf7c4('0x43')]['id']}},_0x59f540={};_0x59f540['model']=_['keys'](db[_0xf7c4('0x3f')][_0xf7c4('0x2c')]);_0x59f540[_0xf7c4('0x34')]=_[_0xf7c4('0x2f')](_0x196ab3[_0xf7c4('0x34')]);_0x59f540['filters']=_[_0xf7c4('0x31')](_0x59f540['model'],_0x59f540['query']);_0x9ee822['attributes']=_['intersection'](_0x59f540[_0xf7c4('0x2e')],qs[_0xf7c4('0x33')](_0x196ab3[_0xf7c4('0x34')]['fields']));_0x9ee822[_0xf7c4('0x32')]=_0x9ee822['attributes'][_0xf7c4('0x35')]?_0x9ee822[_0xf7c4('0x32')]:_0x59f540[_0xf7c4('0x2e')];if(_0x196ab3[_0xf7c4('0x34')][_0xf7c4('0x44')]){_0x9ee822[_0xf7c4('0x40')]=[{'all':!![]}];}_0x9ee822=_['merge']({},_0x9ee822,_0x196ab3[_0xf7c4('0x3e')]);return db[_0xf7c4('0x3f')][_0xf7c4('0x45')](_0x9ee822)[_0xf7c4('0x22')](handleEntityNotFound(_0x1872db,null))[_0xf7c4('0x22')](respondWithResult(_0x1872db,null))[_0xf7c4('0x42')](handleError(_0x1872db,null));};exports[_0xf7c4('0x46')]=function(_0x31cd26,_0x4f60e7){return db[_0xf7c4('0x3f')][_0xf7c4('0x46')](_0x31cd26[_0xf7c4('0x47')],{})[_0xf7c4('0x22')](function(_0x41ba02){var _0x1c106c=_0x31cd26[_0xf7c4('0x48')]['get']({'plain':!![]});if(!_0x1c106c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c106c[_0xf7c4('0x49')]===_0xf7c4('0x48')){var _0xba82f4=_0x41ba02[_0xf7c4('0x24')]({'plain':!![]});var _0x34e543=_0xf7c4('0x25');return db[_0xf7c4('0x4a')][_0xf7c4('0x45')]({'where':{'name':_0x34e543,'userProfileId':_0x1c106c['userProfileId']},'raw':!![]})[_0xf7c4('0x22')](function(_0x276383){if(_0x276383&&_0x276383[_0xf7c4('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0xba82f4[_0xf7c4('0x28')],'resourceId':_0xba82f4['id'],'type':_0x276383[_0xf7c4('0x28')],'sectionId':_0x276383['id']},{})[_0xf7c4('0x22')](function(){return _0x41ba02;});}else{return _0x41ba02;}})[_0xf7c4('0x42')](function(_0x16f441){logger[_0xf7c4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f441);throw _0x16f441;});}return _0x41ba02;})[_0xf7c4('0x22')](respondWithResult(_0x4f60e7,0xc9))[_0xf7c4('0x42')](handleError(_0x4f60e7,null));};exports[_0xf7c4('0x4c')]=function(_0x21789c,_0x15db81){if(_0x21789c['body']['id']){delete _0x21789c[_0xf7c4('0x47')]['id'];}return db[_0xf7c4('0x3f')]['find']({'where':{'id':_0x21789c[_0xf7c4('0x43')]['id']}})[_0xf7c4('0x22')](handleEntityNotFound(_0x15db81,null))['then'](saveUpdates(_0x21789c[_0xf7c4('0x47')],null))[_0xf7c4('0x22')](respondWithResult(_0x15db81,null))[_0xf7c4('0x42')](handleError(_0x15db81,null));};exports[_0xf7c4('0x23')]=function(_0x474655,_0x37bc01){return db['Pause']['find']({'where':{'id':_0x474655[_0xf7c4('0x43')]['id']}})[_0xf7c4('0x22')](handleEntityNotFound(_0x37bc01,null))[_0xf7c4('0x22')](removeEntity(_0x37bc01,null))[_0xf7c4('0x42')](handleError(_0x37bc01,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7681114..b399385 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5abbed,_0x5c89e8){var _0xf6cf68=function(_0x31687e){while(--_0x31687e){_0x5abbed['push'](_0x5abbed['shift']());}};_0xf6cf68(++_0x5c89e8);}(_0x326f,0xd1));var _0xf326=function(_0x43192d,_0x5f0dfe){_0x43192d=_0x43192d-0x0;var _0x36e38b=_0x326f[_0x43192d];return _0x36e38b;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x55ca,0x126));var _0xa55c=function(_0x47a204,_0x24b906){_0x47a204=_0x47a204-0x0;var _0x5623fc=_0x55ca[_0x47a204];return _0x5623fc;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Pause',attributes,{'tableName':_0xa55c('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 1d32bf3..f8cbc39 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x476b2e,_0x20e50a){var _0x15356d=function(_0x57fffc){while(--_0x57fffc){_0x476b2e['push'](_0x476b2e['shift']());}};_0x15356d(++_0x20e50a);}(_0xb10b,0x12a));var _0xbb10=function(_0xc37c8,_0x182df1){_0xc37c8=_0xc37c8-0x0;var _0x77188f=_0xb10b[_0xc37c8];return _0x77188f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2d727f,_0x51b368){var _0x5a37d3=function(_0x10c575){while(--_0x10c575){_0x2d727f['push'](_0x2d727f['shift']());}};_0x5a37d3(++_0x51b368);}(_0x7a54,0x106));var _0x47a5=function(_0x4908d9,_0xdf2ac5){_0x4908d9=_0x4908d9-0x0;var _0x215876=_0x7a54[_0x4908d9];return _0x215876;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8e28ea6..8c28f55 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 _0xac9d=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xac9d,0x14d));var _0xdac9=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0xac9d[_0x35f58d];return _0xbca79b;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./plugin.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x9')](_0xdac9('0x10'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x11')]);var upload=multer({'storage':multer[_0xdac9('0x12')]({'destination':function(_0x255627,_0x1b604a,_0xbb5615){_0xbb5615(null,path['join'](config[_0xdac9('0x13')],_0xdac9('0x14')));},'filename':function(_0x5a9bde,_0x3d8e97,_0xeddbc1){_0x3d8e97[_0xdac9('0x15')]=_0x3d8e97['originalname'][_0xdac9('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xeddbc1(null,util[_0xdac9('0x17')](_0xdac9('0x18'),path['basename'](_0x3d8e97['originalname'],path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])),Date['now'](),path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])));}})});router[_0xdac9('0x1a')]('/',upload[_0xdac9('0x1b')](_0xdac9('0x1c')),controller[_0xdac9('0x1d')]);router[_0xdac9('0x1a')](_0xdac9('0xc'),controller['webhookPost']);router[_0xdac9('0x1e')](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0x1f')]);router[_0xdac9('0x20')](_0xdac9('0xe'),auth[_0xdac9('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x3d0cf1,_0x1f27eb){var _0x5e4c7e=function(_0x56fe71){while(--_0x56fe71){_0x3d0cf1['push'](_0x3d0cf1['shift']());}};_0x5e4c7e(++_0x1f27eb);}(_0xb458,0x103));var _0x8b45=function(_0x1fbc6d,_0x59e4af){_0x1fbc6d=_0x1fbc6d-0x0;var _0x1c702e=_0xb458[_0x1fbc6d];return _0x1c702e;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 23d3878..e4fc892 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 _0x85e2=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','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.','STRING','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85e2,0xfa));var _0x285e=function(_0x1dc0fd,_0x427879){_0x1dc0fd=_0x1dc0fd-0x0;var _0x5ea65e=_0x85e2[_0x1dc0fd];return _0x5ea65e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x285e('0x0')]},'type':{'type':Sequelize[_0x285e('0x1')](_0x285e('0x2'),_0x285e('0x3'))},'description':{'type':Sequelize[_0x285e('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x285e('0x0')],'comment':_0x285e('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x285e('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x285e('0x7'),_0x285e('0x8'),_0x285e('0x9'),_0x285e('0xa')),'defaultValue':_0x285e('0x9'),'comment':_0x285e('0xb')},'icon':{'type':Sequelize[_0x285e('0x0')]},'adminUrl':{'type':Sequelize[_0x285e('0x0')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x285e('0x0')]},'scriptPath':{'type':Sequelize[_0x285e('0x0')]}}; \ No newline at end of file +var _0x594a=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x594a,0x1a5));var _0xa594=function(_0x5d6a31,_0x1269e8){_0x5d6a31=_0x5d6a31-0x0;var _0x378059=_0x594a[_0x5d6a31];return _0x378059;};'use strict';var Sequelize=require('sequelize');module[_0xa594('0x0')]={'name':{'type':Sequelize[_0xa594('0x1')]},'type':{'type':Sequelize[_0xa594('0x2')](_0xa594('0x3'),_0xa594('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa594('0x5')]},'path':{'type':Sequelize[_0xa594('0x1')],'comment':_0xa594('0x6')},'active':{'type':Sequelize[_0xa594('0x7')],'defaultValue':0x0,'comment':_0xa594('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xa594('0x9'),_0xa594('0xa'),_0xa594('0xb'),_0xa594('0xc')),'defaultValue':_0xa594('0xb'),'comment':_0xa594('0xd')},'icon':{'type':Sequelize[_0xa594('0x1')]},'adminUrl':{'type':Sequelize[_0xa594('0x1')]},'agentUrl':{'type':Sequelize[_0xa594('0x1')]},'scriptName':{'type':Sequelize[_0xa594('0x1')]},'scriptPath':{'type':Sequelize[_0xa594('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7c58f2c..b33ef2a 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 _0x0e4f=['then','get','error','stack','send','Plugin','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','find','catch','download','path','server/files/plugins','%s.zip','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','join','basename','attachments/**/*','finalize','existsSync','Error','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','admin','test','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','set','save','destroy'];(function(_0x4f4d9c,_0x471842){var _0x13b013=function(_0x404b31){while(--_0x404b31){_0x4f4d9c['push'](_0x4f4d9c['shift']());}};_0x13b013(++_0x471842);}(_0x0e4f,0x121));var _0xf0e4=function(_0x304557,_0x336ce1){_0x304557=_0x304557-0x0;var _0x345c0c=_0x0e4f[_0x304557];return _0x345c0c;};'use strict';var emlformat=require(_0xf0e4('0x0'));var rimraf=require(_0xf0e4('0x1'));var zipdir=require(_0xf0e4('0x2'));var jsonpatch=require(_0xf0e4('0x3'));var rp=require(_0xf0e4('0x4'));var moment=require(_0xf0e4('0x5'));var BPromise=require(_0xf0e4('0x6'));var Mustache=require(_0xf0e4('0x7'));var util=require(_0xf0e4('0x8'));var path=require('path');var sox=require(_0xf0e4('0x9'));var csv=require(_0xf0e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0e4('0xb'));var _=require(_0xf0e4('0xc'));var squel=require(_0xf0e4('0xd'));var crypto=require(_0xf0e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0e4('0xf'));var toCsv=require(_0xf0e4('0xa'));var querystring=require(_0xf0e4('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xf0e4('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xf0e4('0x11'));var qs=require(_0xf0e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0e4('0x13'));var logger=require(_0xf0e4('0x14'))(_0xf0e4('0x15'));var utils=require(_0xf0e4('0x16'));var config=require(_0xf0e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0e4('0x18'))['db'];config['redis']=_['defaults'](config[_0xf0e4('0x19')],{'host':_0xf0e4('0x1a'),'port':0x18eb});var socket=require(_0xf0e4('0x1b'))(new Redis(config[_0xf0e4('0x19')]));require(_0xf0e4('0x1c'))[_0xf0e4('0x1d')](socket);function respondWithStatusCode(_0x390a40,_0x4373e4){_0x4373e4=_0x4373e4||0xcc;return function(_0x2fe125){if(_0x2fe125){return _0x390a40[_0xf0e4('0x1e')](_0x4373e4);}return _0x390a40[_0xf0e4('0x1f')](_0x4373e4)['end']();};}function respondWithResult(_0x14112b,_0x462355){_0x462355=_0x462355||0xc8;return function(_0x3319c2){if(_0x3319c2){return _0x14112b[_0xf0e4('0x1f')](_0x462355)[_0xf0e4('0x20')](_0x3319c2);}};}function respondWithFilteredResult(_0x57a3c6,_0x5d557a){return function(_0x1a0ad6){if(_0x1a0ad6){var _0x37ea7b=typeof _0x5d557a[_0xf0e4('0x21')]===_0xf0e4('0x22')&&typeof _0x5d557a[_0xf0e4('0x23')]===_0xf0e4('0x22');var _0x58a719=_0x1a0ad6['count'];var _0x59d4c8=_0x37ea7b?0x0:_0x5d557a[_0xf0e4('0x21')];var _0x16b0b5=_0x37ea7b?_0x1a0ad6['count']:_0x5d557a[_0xf0e4('0x21')]+_0x5d557a['limit'];var _0x246e4c;if(_0x16b0b5>=_0x58a719){_0x16b0b5=_0x58a719;_0x246e4c=0xc8;}else{_0x246e4c=0xce;}_0x57a3c6['status'](_0x246e4c);return _0x57a3c6[_0xf0e4('0x24')]('Content-Range',_0x59d4c8+'-'+_0x16b0b5+'/'+_0x58a719)[_0xf0e4('0x20')](_0x1a0ad6);}return null;};}function patchUpdates(_0x2a7436){return function(_0x1fb38d){try{jsonpatch['apply'](_0x1fb38d,_0x2a7436,!![]);}catch(_0x24f092){return BPromise['reject'](_0x24f092);}return _0x1fb38d[_0xf0e4('0x25')]();};}function saveUpdates(_0x1419e4,_0x1e2448){return function(_0x5597d9){if(_0x5597d9){return _0x5597d9['update'](_0x1419e4)['then'](function(_0xb00f64){return _0xb00f64;});}return null;};}function removeEntity(_0x211ea3,_0x4448d2){return function(_0x33c50b){if(_0x33c50b){return _0x33c50b[_0xf0e4('0x26')]()[_0xf0e4('0x27')](function(){var _0x47496c=_0x33c50b[_0xf0e4('0x28')]({'plain':!![]});var _0x4ec295='Plugins';return db['UserProfileResource'][_0xf0e4('0x26')]({'where':{'type':_0x4ec295,'resourceId':_0x47496c['id']}})['then'](function(){return _0x33c50b;});})[_0xf0e4('0x27')](function(){_0x211ea3[_0xf0e4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b678a,_0x2be1fa){return function(_0x5a4659){if(!_0x5a4659){_0x2b678a['sendStatus'](0x194);}return _0x5a4659;};}function handleError(_0x3e5128,_0x5c92d2){_0x5c92d2=_0x5c92d2||0x1f4;return function(_0x4a39c4){logger[_0xf0e4('0x29')](_0x4a39c4[_0xf0e4('0x2a')]);if(_0x4a39c4['name']){delete _0x4a39c4['name'];}_0x3e5128[_0xf0e4('0x1f')](_0x5c92d2)[_0xf0e4('0x2b')](_0x4a39c4);};}exports['index']=function(_0x2e7134,_0x4cbbb5){var _0x5d37db={},_0x260a80={},_0x17f21b={'count':0x0,'rows':[]};var _0x4eb337=_['map'](db[_0xf0e4('0x2c')][_0xf0e4('0x2d')],function(_0x36a1f5){return{'name':_0x36a1f5[_0xf0e4('0x2e')],'type':_0x36a1f5[_0xf0e4('0x2f')][_0xf0e4('0x30')]};});_0x260a80[_0xf0e4('0x31')]=_[_0xf0e4('0x32')](_0x4eb337,_0xf0e4('0x33'));_0x260a80[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x2e7134[_0xf0e4('0x34')]);_0x260a80[_0xf0e4('0x36')]=_[_0xf0e4('0x37')](_0x260a80[_0xf0e4('0x31')],_0x260a80[_0xf0e4('0x34')]);_0x5d37db[_0xf0e4('0x38')]=_['intersection'](_0x260a80[_0xf0e4('0x31')],qs[_0xf0e4('0x39')](_0x2e7134[_0xf0e4('0x34')]['fields']));_0x5d37db[_0xf0e4('0x38')]=_0x5d37db['attributes'][_0xf0e4('0x3a')]?_0x5d37db['attributes']:_0x260a80[_0xf0e4('0x31')];if(!_0x2e7134['query'][_0xf0e4('0x3b')](_0xf0e4('0x3c'))){_0x5d37db[_0xf0e4('0x23')]=qs[_0xf0e4('0x23')](_0x2e7134['query'][_0xf0e4('0x23')]);_0x5d37db['offset']=qs[_0xf0e4('0x21')](_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x21')]);}_0x5d37db['order']=qs['sort'](_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x3d')]);_0x5d37db[_0xf0e4('0x3e')]=qs[_0xf0e4('0x36')](_[_0xf0e4('0x3f')](_0x2e7134[_0xf0e4('0x34')],_0x260a80[_0xf0e4('0x36')]),_0x4eb337);if(_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x40')]){_0x5d37db[_0xf0e4('0x3e')]=_[_0xf0e4('0x41')](_0x5d37db[_0xf0e4('0x3e')],{'$or':_['map'](_0x4eb337,function(_0x4af84f){if(_0x4af84f[_0xf0e4('0x2f')]!==_0xf0e4('0x42')){var _0xae07d5={};_0xae07d5[_0x4af84f[_0xf0e4('0x33')]]={'$like':'%'+_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x40')]+'%'};return _0xae07d5;}})});}_0x5d37db=_[_0xf0e4('0x41')]({},_0x5d37db,_0x2e7134['options']);var _0x559a98={'where':_0x5d37db[_0xf0e4('0x3e')]};return db['Plugin']['count'](_0x559a98)['then'](function(_0x248ecd){_0x17f21b[_0xf0e4('0x43')]=_0x248ecd;if(_0x2e7134['query'][_0xf0e4('0x44')]){_0x5d37db[_0xf0e4('0x45')]=[{'all':!![]}];}return db[_0xf0e4('0x2c')][_0xf0e4('0x46')](_0x5d37db);})['then'](function(_0x52ff1a){_0x17f21b[_0xf0e4('0x47')]=_0x52ff1a;return _0x17f21b;})[_0xf0e4('0x27')](respondWithFilteredResult(_0x4cbbb5,_0x5d37db))['catch'](handleError(_0x4cbbb5,null));};exports[_0xf0e4('0x48')]=function(_0x2c70be,_0x5207d4){var _0x3079ba={'raw':!![],'where':{'id':_0x2c70be[_0xf0e4('0x49')]['id']}},_0x93866={};_0x93866[_0xf0e4('0x31')]=_[_0xf0e4('0x35')](db[_0xf0e4('0x2c')]['rawAttributes']);_0x93866[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x2c70be['query']);_0x93866['filters']=_[_0xf0e4('0x37')](_0x93866[_0xf0e4('0x31')],_0x93866[_0xf0e4('0x34')]);_0x3079ba[_0xf0e4('0x38')]=_['intersection'](_0x93866[_0xf0e4('0x31')],qs[_0xf0e4('0x39')](_0x2c70be['query'][_0xf0e4('0x39')]));_0x3079ba[_0xf0e4('0x38')]=_0x3079ba['attributes'][_0xf0e4('0x3a')]?_0x3079ba[_0xf0e4('0x38')]:_0x93866[_0xf0e4('0x31')];if(_0x2c70be[_0xf0e4('0x34')][_0xf0e4('0x44')]){_0x3079ba['include']=[{'all':!![]}];}_0x3079ba=_[_0xf0e4('0x41')]({},_0x3079ba,_0x2c70be['options']);return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')](_0x3079ba)[_0xf0e4('0x27')](handleEntityNotFound(_0x5207d4,null))[_0xf0e4('0x27')](respondWithResult(_0x5207d4,null))[_0xf0e4('0x4b')](handleError(_0x5207d4,null));};exports[_0xf0e4('0x4c')]=function(_0xf520ac,_0xff5d25,_0x482ffc){return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')]({'where':{'id':_0xf520ac[_0xf0e4('0x49')]['id']},'attributes':[_0xf0e4('0x33'),_0xf0e4('0x4d')],'raw':!![]})[_0xf0e4('0x27')](handleEntityNotFound(_0xff5d25,null))['then'](function(_0x220415){if(_0x220415){var _0x3ef775=path['join'](config['root'],_0xf0e4('0x4e'),util['format'](_0xf0e4('0x4f'),path['basename'](_0x220415[_0xf0e4('0x4d')])));var _0x183163=fs['createWriteStream'](_0x3ef775);var _0x9a9cc5=archiver(_0xf0e4('0x50'),{'zlib':{'level':0x9}});_0x9a9cc5['on']('warning',function(_0x31d22e){if(_0x31d22e[_0xf0e4('0x51')]===_0xf0e4('0x52')){logger[_0xf0e4('0x29')](_0x31d22e);}else{throw new db[(_0xf0e4('0x53'))]['Error'](_0xf0e4('0x54'));}});_0x9a9cc5['on'](_0xf0e4('0x29'),function(_0x50f7a5){throw new db['Sequelize']['Error'](_0xf0e4('0x54'));});_0x9a9cc5['pipe'](_0x183163);_0x9a9cc5[_0xf0e4('0x55')](_0xf0e4('0x56'),{'cwd':path['join'](config[_0xf0e4('0x57')],_0xf0e4('0x4e'),path[_0xf0e4('0x58')](_0x220415['path'])),'ignore':[path[_0xf0e4('0x59')](path[_0xf0e4('0x5a')](_0x220415[_0xf0e4('0x4d')]),'node_modules/**/*'),path[_0xf0e4('0x59')](path['basename'](_0x220415[_0xf0e4('0x4d')]),_0xf0e4('0x5b'))],'nodir':!![]})[_0xf0e4('0x5c')]();_0x183163['on']('close',function(){if(!fs[_0xf0e4('0x5d')](_0x3ef775)){throw new db['Sequelize'][(_0xf0e4('0x5e'))]('Plugin\x20not\x20found');}return _0xff5d25[_0xf0e4('0x4c')](_0x3ef775,util['format'](_0xf0e4('0x4f'),path[_0xf0e4('0x5a')](_0x220415[_0xf0e4('0x4d')])),function(_0x201a9b){if(_0x201a9b){throw new db['Sequelize']['Error'](_0xf0e4('0x5f'));}fs['unlinkSync'](_0x3ef775);logger[_0xf0e4('0x60')](_0xf0e4('0x61'));logger[_0xf0e4('0x60')](_0xf0e4('0x62'));});});}return null;})[_0xf0e4('0x4b')](handleError(_0xff5d25,null));};exports[_0xf0e4('0x63')]=function(_0xd7cd1b,_0x2ac995,_0x54160f){var _0x41b364=path[_0xf0e4('0x5a')](_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')],path[_0xf0e4('0x66')](_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')]));var _0x4c1871=path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')]);var _0x434eb3=path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',_0x41b364);logger[_0xf0e4('0x60')]('Plugin\x20upload\x20filepath:\x20%s',_0x4c1871);logger['info'](_0xf0e4('0x67'),_0x434eb3);try{fs[_0xf0e4('0x68')](_0x4c1871,parseInt(_0xf0e4('0x69'),0x8));extract(_0x4c1871,{'dir':_0x434eb3},function(_0x9425ae){if(_0x9425ae){logger[_0xf0e4('0x29')](_0x9425ae);handleError(_0x9425ae,!![]);};var _0x96ddd7=fs[_0xf0e4('0x6a')](_0x434eb3);if(_0x96ddd7['length']>0x1){removeReferences(_0x4c1871,_0x434eb3);logger[_0xf0e4('0x29')](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}var _0x3d19b1=fs[_0xf0e4('0x6c')](path['join'](_0x434eb3,_0x96ddd7[0x0]));if(_0x3d19b1['isFile']()){removeReferences(_0x4c1871,_0x434eb3);logger['error'](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}if(_0x3d19b1['isDirectory']()){var _0x31a5fc=fs['readdirSync'](path[_0xf0e4('0x59')](_0x434eb3,_0x96ddd7[0x0]));if(_0x31a5fc['length']===0x0){removeReferences(_0x4c1871,_0x434eb3);logger[_0xf0e4('0x29')](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}var _0x433120=_0x31a5fc['some'](function(_0x27f233){return _0x27f233===_0xf0e4('0x6d');});if(!_0x433120){return _0x54160f(new Error('Plugin\x20manifest\x20missing'));}var _0x3d752c=fs[_0xf0e4('0x6e')](path['join'](_0x434eb3,_0x96ddd7[0x0],_0xf0e4('0x6d')));var _0x1517fd=JSON[_0xf0e4('0x6f')](_0x3d752c);if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x33')]){return _0x54160f(new Error(_0xf0e4('0x70')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x2f')]){return _0x54160f(new Error(_0xf0e4('0x71')));}if(_0xf0e4('0x22')==typeof _0x1517fd['version']){return _0x54160f(new Error(_0xf0e4('0x72')));}if('undefined'==typeof _0x1517fd[_0xf0e4('0x73')]){return _0x54160f(new Error(_0xf0e4('0x74')));}if(_0x1517fd[_0xf0e4('0x2f')]==='html'){if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]){return _0x54160f(new Error(_0xf0e4('0x76')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]['admin']&&'undefined'==typeof _0x1517fd['parameters'][_0xf0e4('0x75')][_0xf0e4('0x77')]){return _0x54160f(new Error(_0xf0e4('0x78')));}}else if(_0x1517fd[_0xf0e4('0x2f')]==='script'){if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')]['scriptName']){return _0x54160f(new Error(_0xf0e4('0x79')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x7a')]){return _0x54160f(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x54160f(new Error(_0xf0e4('0x7b')));}var _0x4c7ca7=_0x1517fd[_0xf0e4('0x33')];var _0x3c6122=_0x1517fd[_0xf0e4('0x7c')];var _0x8bfaef=_0x1517fd[_0xf0e4('0x2f')];var _0x323965=_0x1517fd[_0xf0e4('0x7d')]?_0x1517fd[_0xf0e4('0x7d')]:'always';var _0x3b3e3c=_0x1517fd['icon']?_0x1517fd[_0xf0e4('0x7e')]:_0xf0e4('0x7f');var _0x42f035='';var _0x33b7e4='';var _0xad9bbd='';var _0x4f09cb='';var _0xacb638=_0x1517fd[_0xf0e4('0x80')];if(_0x8bfaef===_0xf0e4('0x81')){if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')]['views']['admin']){var _0x282175=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x282175)){_0x42f035=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x282175);}else{_0x42f035=_0x282175;}}else{logger[_0xf0e4('0x60')](_0xf0e4('0x83'));}if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')]['views'][_0xf0e4('0x77')]){var _0x414af3=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x414af3)){_0x33b7e4=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x414af3);}else{_0x33b7e4=_0x414af3;}}else{logger[_0xf0e4('0x60')](_0xf0e4('0x84'));}}else if(_0x8bfaef==='script'){_0xad9bbd=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x85')];_0x4f09cb=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x7a')];if('undefined'!=typeof _0x1517fd['parameters']['views']){if(_0xf0e4('0x22')!=typeof _0x1517fd['parameters'][_0xf0e4('0x75')]['admin']){var _0x282175=_0x1517fd['parameters'][_0xf0e4('0x75')][_0xf0e4('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xf0e4('0x87')](_0x282175)){_0x42f035=path['join'](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x282175);}else{_0x42f035=_0x282175;}}if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')]){var _0x414af3=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x414af3)){_0x33b7e4=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x414af3);}else{_0x33b7e4=_0x414af3;}}}}var _0x402456={'name':_0x4c7ca7,'description':_0x3c6122,'path':path[_0xf0e4('0x59')](_0x41b364,_0x96ddd7[0x0]),'type':_0x8bfaef,'sidebar':_0x323965,'icon':_0x3b3e3c,'adminUrl':_0x42f035,'agentUrl':_0x33b7e4,'scriptName':_0xad9bbd,'scriptPath':_0x4f09cb,'version':_0xacb638};removeReferences(_0x4c1871,null);return db[_0xf0e4('0x2c')]['create'](_0x402456)[_0xf0e4('0x27')](function(_0x4968f8){var _0x23fe4f={'role':_0xd7cd1b[_0xf0e4('0x88')]['role'],'userProfileId':_0xd7cd1b[_0xf0e4('0x88')][_0xf0e4('0x89')]};if(!_0x23fe4f)throw new Error(_0xf0e4('0x8a'));if(_0x23fe4f[_0xf0e4('0x8b')]===_0xf0e4('0x8c')){var _0x132919=_0x4968f8[_0xf0e4('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xf0e4('0x4a')]({'where':{'name':_0xf0e4('0x8d'),'userProfileId':_0x23fe4f[_0xf0e4('0x89')]},'raw':!![]})['then'](function(_0x3450bc){if(_0x3450bc&&_0x3450bc[_0xf0e4('0x8e')]===0x0){return db['UserProfileResource'][_0xf0e4('0x8f')]({'name':_0x132919[_0xf0e4('0x33')],'resourceId':_0x132919['id'],'type':_0x3450bc['name'],'sectionId':_0x3450bc['id']},{})['then'](function(){return _0x4968f8;});}else{return _0x4968f8;}})['catch'](function(_0x2441f3){logger[_0xf0e4('0x29')](_0xf0e4('0x90'),_0x2441f3);throw _0x2441f3;});}return _0x4968f8;})[_0xf0e4('0x27')](respondWithResult(_0x2ac995,null))[_0xf0e4('0x4b')](handleError(_0x2ac995,null));}});}catch(_0x221e1e){_0x2ac995[_0xf0e4('0x1f')](0x1f4)['send'](_0x221e1e);}};function removeReferences(_0x461a7a,_0x248a84){try{if(_0x461a7a){fs[_0xf0e4('0x91')](_0x461a7a);logger[_0xf0e4('0x60')](_0xf0e4('0x92'));}if(_0x248a84){rimraf(_0x248a84,function(){});logger[_0xf0e4('0x60')]('Extracted\x20folder\x20removed');}}catch(_0xbe6330){logger[_0xf0e4('0x29')](_0xbe6330);}}exports[_0xf0e4('0x93')]=function(_0x567649,_0x55fcdd,_0x493e39){return db[_0xf0e4('0x2c')]['find']({'where':{'id':_0x567649[_0xf0e4('0x49')]['id']}})[_0xf0e4('0x27')](handleEntityNotFound(_0x55fcdd,null))['then'](saveUpdates(_0x567649['body'],null))[_0xf0e4('0x27')](respondWithResult(_0x55fcdd,null))[_0xf0e4('0x4b')](handleError(_0x55fcdd,null));};exports[_0xf0e4('0x94')]=function(_0x9d727f,_0xfcddad,_0x5e6b05){return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')]({'where':{'id':_0x9d727f[_0xf0e4('0x49')]['id']}})[_0xf0e4('0x27')](function(_0x5cc8a3){if(_0x5cc8a3){return _0x5cc8a3[_0xf0e4('0x26')]();}})[_0xf0e4('0x27')](function(_0x3d05eb){rimraf(path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',path[_0xf0e4('0x58')](_0x3d05eb['path'])),function(){});return _0x3d05eb;})['then'](handleEntityNotFound(_0xfcddad,null))[_0xf0e4('0x27')](respondWithStatusCode(_0xfcddad,null))['catch'](handleError(_0xfcddad,null));};exports[_0xf0e4('0x95')]=function(_0x126c19,_0x22417e,_0x1a01f5){return BPromise['resolve']()['then'](function(){if(!_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')]){throw new Error(_0xf0e4('0x96'));}if(!_0x126c19[_0xf0e4('0x34')]['port']){throw new Error(_0xf0e4('0x97'));}var _0x101288=_0x126c19['query'][_0xf0e4('0x98')]?_0x126c19[_0xf0e4('0x34')]['hostname']+':'+_0x126c19[_0xf0e4('0x34')]['port']:'http://localhost:'+_0x126c19['query'][_0xf0e4('0x99')];var _0x463d48=_0x126c19['query'][_0xf0e4('0x20')]?_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x20')]:!![];var _0x5d7483=_0x126c19['query'][_0xf0e4('0x9a')]?_0x126c19['query'][_0xf0e4('0x9a')]:null;var _0x4d15e8={'method':_0x126c19[_0xf0e4('0x9b')],'uri':util[_0xf0e4('0x9c')](_0xf0e4('0x9d'),_0x101288,_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')]),'json':_0x463d48,'resolveWithFullResponse':!![],'encoding':_0x5d7483,'qs':_0x126c19['query']};if(_0x126c19[_0xf0e4('0x9e')]){_0x4d15e8[_0xf0e4('0x9e')]=_0x126c19[_0xf0e4('0x9e')];if(_0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0x9f')]){delete _0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0x9f')];}}if(_0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0xa0')]){delete _0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0xa0')];}return rp(_0x4d15e8);})['then'](function(_0x5ea22b){if(_0x5ea22b){_0x22417e[_0xf0e4('0x24')](_0x5ea22b[_0xf0e4('0x9e')]);logger[_0xf0e4('0x60')](_0x5ea22b[_0xf0e4('0x88')]);if(_[_0xf0e4('0xa1')](_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')],_0xf0e4('0x4c'))&&_0x5ea22b[_0xf0e4('0xa2')]==0x1f4){return _0x22417e[_0xf0e4('0x1e')](_0x5ea22b[_0xf0e4('0xa2')]);}else{return _0x22417e[_0xf0e4('0x1f')](_0x5ea22b[_0xf0e4('0xa2')])[_0xf0e4('0x2b')](_0x5ea22b[_0xf0e4('0x88')]);}}else{return _0x22417e[_0xf0e4('0x1e')](0xc8);}})['catch'](handleError(_0x22417e,null));};exports['webhookPost']=function(_0x41d516,_0x203481,_0x4c7a9f){return BPromise[_0xf0e4('0xa3')]()[_0xf0e4('0x27')](function(){if(!_0x41d516['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x99')]){throw new Error(_0xf0e4('0x97'));}var _0x4dfd97=_0x41d516['query']['hostname']?_0x41d516[_0xf0e4('0x34')]['hostname']+':'+_0x41d516['query'][_0xf0e4('0x99')]:'http://localhost:'+_0x41d516[_0xf0e4('0x34')]['port'];var _0x19553c=_0x41d516[_0xf0e4('0x34')]['json']?_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x20')]:!![];var _0x5200ba=_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x9a')]?_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x9a')]:null;var _0x40e348={'method':_0x41d516[_0xf0e4('0x9b')],'uri':util[_0xf0e4('0x9c')](_0xf0e4('0x9d'),_0x4dfd97,_0x41d516['query'][_0xf0e4('0x4d')]),'json':_0x19553c,'resolveWithFullResponse':!![],'encoding':_0x5200ba,'body':_0x41d516[_0xf0e4('0x88')]};if(_0x41d516[_0xf0e4('0x9e')]){_0x40e348['headers']=_0x41d516['headers'];if(_0x40e348[_0xf0e4('0x9e')][_0xf0e4('0x9f')]){delete _0x40e348[_0xf0e4('0x9e')][_0xf0e4('0x9f')];}}if(_0x40e348[_0xf0e4('0x9e')][_0xf0e4('0xa0')]){delete _0x40e348[_0xf0e4('0x9e')][_0xf0e4('0xa0')];}return rp(_0x40e348);})[_0xf0e4('0x27')](function(_0x50489e){if(_0x50489e){_0x203481['set'](_0x50489e[_0xf0e4('0x9e')]);logger[_0xf0e4('0x60')](_0x50489e['body']);return _0x203481['status'](_0x50489e['statusCode'])[_0xf0e4('0x2b')](_0x50489e[_0xf0e4('0x88')]);}else{return _0x203481['sendStatus'](0xc8);}})[_0xf0e4('0x4b')](handleError(_0x203481,null));}; \ No newline at end of file +var _0x449f=['Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','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','download','statusCode','send','webhookPost','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Plugin','includeAll','include','rows','catch','show','find','params','join','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x449f,0xcd));var _0xf449=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x449f[_0x409353];return _0x4f4b59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf449('0x0'));var zipdir=require(_0xf449('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf449('0x2'));var moment=require(_0xf449('0x3'));var BPromise=require(_0xf449('0x4'));var Mustache=require(_0xf449('0x5'));var util=require(_0xf449('0x6'));var path=require(_0xf449('0x7'));var sox=require(_0xf449('0x8'));var csv=require(_0xf449('0x9'));var ejs=require(_0xf449('0xa'));var fs=require('fs');var fs_extra=require(_0xf449('0xb'));var _=require(_0xf449('0xc'));var squel=require('squel');var crypto=require(_0xf449('0xd'));var jsforce=require(_0xf449('0xe'));var deskjs=require(_0xf449('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf449('0x10'));var Papa=require(_0xf449('0x11'));var extract=require(_0xf449('0x12'));var rimraf=require('rimraf');var archiver=require(_0xf449('0x13'));var Redis=require(_0xf449('0x14'));var authService=require(_0xf449('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf449('0x16'));var logger=require(_0xf449('0x17'))(_0xf449('0x18'));var utils=require('../../config/utils');var config=require(_0xf449('0x19'));var licenseUtil=require(_0xf449('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf449('0x1b')](config[_0xf449('0x1c')],{'host':_0xf449('0x1d'),'port':0x18eb});var socket=require(_0xf449('0x1e'))(new Redis(config[_0xf449('0x1c')]));require('./plugin.socket')[_0xf449('0x1f')](socket);function respondWithStatusCode(_0x162cf1,_0x2132e9){_0x2132e9=_0x2132e9||0xcc;return function(_0x563dfb){if(_0x563dfb){return _0x162cf1[_0xf449('0x20')](_0x2132e9);}return _0x162cf1[_0xf449('0x21')](_0x2132e9)[_0xf449('0x22')]();};}function respondWithResult(_0x51db5c,_0x45337d){_0x45337d=_0x45337d||0xc8;return function(_0x51e60d){if(_0x51e60d){return _0x51db5c['status'](_0x45337d)[_0xf449('0x23')](_0x51e60d);}};}function respondWithFilteredResult(_0x1be79b,_0x2c02b2){return function(_0x4d2959){if(_0x4d2959){var _0x2c5c44=typeof _0x2c02b2[_0xf449('0x24')]===_0xf449('0x25')&&typeof _0x2c02b2[_0xf449('0x26')]===_0xf449('0x25');var _0x3cfa0c=_0x4d2959[_0xf449('0x27')];var _0x16d880=_0x2c5c44?0x0:_0x2c02b2[_0xf449('0x24')];var _0x468758=_0x2c5c44?_0x4d2959['count']:_0x2c02b2[_0xf449('0x24')]+_0x2c02b2[_0xf449('0x26')];var _0x1d7aea;if(_0x468758>=_0x3cfa0c){_0x468758=_0x3cfa0c;_0x1d7aea=0xc8;}else{_0x1d7aea=0xce;}_0x1be79b[_0xf449('0x21')](_0x1d7aea);return _0x1be79b[_0xf449('0x28')](_0xf449('0x29'),_0x16d880+'-'+_0x468758+'/'+_0x3cfa0c)[_0xf449('0x23')](_0x4d2959);}return null;};}function patchUpdates(_0x44fb13){return function(_0x1f30c3){try{jsonpatch['apply'](_0x1f30c3,_0x44fb13,!![]);}catch(_0x50814a){return BPromise[_0xf449('0x2a')](_0x50814a);}return _0x1f30c3[_0xf449('0x2b')]();};}function saveUpdates(_0x1e4f49,_0x424eee){return function(_0x56b2a8){if(_0x56b2a8){return _0x56b2a8[_0xf449('0x2c')](_0x1e4f49)[_0xf449('0x2d')](function(_0xc63ecc){return _0xc63ecc;});}return null;};}function removeEntity(_0x504e7f,_0x19c82e){return function(_0x18be87){if(_0x18be87){return _0x18be87[_0xf449('0x2e')]()[_0xf449('0x2d')](function(){var _0x375d2a=_0x18be87[_0xf449('0x2f')]({'plain':!![]});var _0x34e5a9=_0xf449('0x30');return db[_0xf449('0x31')][_0xf449('0x2e')]({'where':{'type':_0x34e5a9,'resourceId':_0x375d2a['id']}})[_0xf449('0x2d')](function(){return _0x18be87;});})[_0xf449('0x2d')](function(){_0x504e7f[_0xf449('0x21')](0xcc)[_0xf449('0x22')]();});}};}function handleEntityNotFound(_0x21d18b,_0x58e73a){return function(_0xe5971){if(!_0xe5971){_0x21d18b['sendStatus'](0x194);}return _0xe5971;};}function handleError(_0x5dd951,_0x3da900){_0x3da900=_0x3da900||0x1f4;return function(_0x227c2f){logger[_0xf449('0x32')](_0x227c2f['stack']);if(_0x227c2f[_0xf449('0x33')]){delete _0x227c2f[_0xf449('0x33')];}_0x5dd951['status'](_0x3da900)['send'](_0x227c2f);};}exports[_0xf449('0x34')]=function(_0x28f319,_0x287447){var _0x4ed49={},_0x456d28={},_0x49ff35={'count':0x0,'rows':[]};var _0x4c38fb=_[_0xf449('0x35')](db['Plugin'][_0xf449('0x36')],function(_0x538ad4){return{'name':_0x538ad4[_0xf449('0x37')],'type':_0x538ad4[_0xf449('0x38')][_0xf449('0x39')]};});_0x456d28[_0xf449('0x3a')]=_[_0xf449('0x35')](_0x4c38fb,_0xf449('0x33'));_0x456d28['query']=_[_0xf449('0x3b')](_0x28f319[_0xf449('0x3c')]);_0x456d28[_0xf449('0x3d')]=_[_0xf449('0x3e')](_0x456d28[_0xf449('0x3a')],_0x456d28[_0xf449('0x3c')]);_0x4ed49[_0xf449('0x3f')]=_[_0xf449('0x3e')](_0x456d28[_0xf449('0x3a')],qs[_0xf449('0x40')](_0x28f319[_0xf449('0x3c')][_0xf449('0x40')]));_0x4ed49[_0xf449('0x3f')]=_0x4ed49[_0xf449('0x3f')][_0xf449('0x41')]?_0x4ed49[_0xf449('0x3f')]:_0x456d28[_0xf449('0x3a')];if(!_0x28f319[_0xf449('0x3c')]['hasOwnProperty'](_0xf449('0x42'))){_0x4ed49['limit']=qs['limit'](_0x28f319['query']['limit']);_0x4ed49[_0xf449('0x24')]=qs[_0xf449('0x24')](_0x28f319['query'][_0xf449('0x24')]);}_0x4ed49[_0xf449('0x43')]=qs['sort'](_0x28f319[_0xf449('0x3c')][_0xf449('0x44')]);_0x4ed49['where']=qs[_0xf449('0x3d')](_[_0xf449('0x45')](_0x28f319['query'],_0x456d28[_0xf449('0x3d')]),_0x4c38fb);if(_0x28f319[_0xf449('0x3c')][_0xf449('0x46')]){_0x4ed49['where']=_[_0xf449('0x47')](_0x4ed49[_0xf449('0x48')],{'$or':_['map'](_0x4c38fb,function(_0xc551c6){if(_0xc551c6['type']!==_0xf449('0x49')){var _0x34235b={};_0x34235b[_0xc551c6['name']]={'$like':'%'+_0x28f319[_0xf449('0x3c')]['filter']+'%'};return _0x34235b;}})});}_0x4ed49=_[_0xf449('0x47')]({},_0x4ed49,_0x28f319[_0xf449('0x4a')]);var _0x59ef81={'where':_0x4ed49[_0xf449('0x48')]};return db[_0xf449('0x4b')]['count'](_0x59ef81)[_0xf449('0x2d')](function(_0x3d4fbb){_0x49ff35[_0xf449('0x27')]=_0x3d4fbb;if(_0x28f319[_0xf449('0x3c')][_0xf449('0x4c')]){_0x4ed49[_0xf449('0x4d')]=[{'all':!![]}];}return db[_0xf449('0x4b')]['findAll'](_0x4ed49);})[_0xf449('0x2d')](function(_0x8c027f){_0x49ff35[_0xf449('0x4e')]=_0x8c027f;return _0x49ff35;})['then'](respondWithFilteredResult(_0x287447,_0x4ed49))[_0xf449('0x4f')](handleError(_0x287447,null));};exports[_0xf449('0x50')]=function(_0x1cf515,_0x327260){var _0x1d3c14={'raw':!![],'where':{'id':_0x1cf515['params']['id']}},_0x42a351={};_0x42a351[_0xf449('0x3a')]=_[_0xf449('0x3b')](db[_0xf449('0x4b')]['rawAttributes']);_0x42a351[_0xf449('0x3c')]=_[_0xf449('0x3b')](_0x1cf515[_0xf449('0x3c')]);_0x42a351[_0xf449('0x3d')]=_[_0xf449('0x3e')](_0x42a351['model'],_0x42a351[_0xf449('0x3c')]);_0x1d3c14[_0xf449('0x3f')]=_[_0xf449('0x3e')](_0x42a351[_0xf449('0x3a')],qs[_0xf449('0x40')](_0x1cf515[_0xf449('0x3c')][_0xf449('0x40')]));_0x1d3c14[_0xf449('0x3f')]=_0x1d3c14[_0xf449('0x3f')][_0xf449('0x41')]?_0x1d3c14['attributes']:_0x42a351['model'];if(_0x1cf515['query'][_0xf449('0x4c')]){_0x1d3c14[_0xf449('0x4d')]=[{'all':!![]}];}_0x1d3c14=_['merge']({},_0x1d3c14,_0x1cf515[_0xf449('0x4a')]);return db[_0xf449('0x4b')][_0xf449('0x51')](_0x1d3c14)[_0xf449('0x2d')](handleEntityNotFound(_0x327260,null))[_0xf449('0x2d')](respondWithResult(_0x327260,null))[_0xf449('0x4f')](handleError(_0x327260,null));};exports['download']=function(_0x127b0a,_0x73c379,_0x5c8e7e){return db[_0xf449('0x4b')]['find']({'where':{'id':_0x127b0a[_0xf449('0x52')]['id']},'attributes':[_0xf449('0x33'),_0xf449('0x7')],'raw':!![]})[_0xf449('0x2d')](handleEntityNotFound(_0x73c379,null))[_0xf449('0x2d')](function(_0x945e24){if(_0x945e24){var _0x3ed641=path[_0xf449('0x53')](config['root'],'server/files/plugins',util[_0xf449('0x54')]('%s.zip',path[_0xf449('0x55')](_0x945e24[_0xf449('0x7')])));var _0x1add1b=fs[_0xf449('0x56')](_0x3ed641);var _0x318ed0=archiver(_0xf449('0x57'),{'zlib':{'level':0x9}});_0x318ed0['on']('warning',function(_0x14c3f5){if(_0x14c3f5[_0xf449('0x58')]===_0xf449('0x59')){logger[_0xf449('0x32')](_0x14c3f5);}else{throw new db[(_0xf449('0x5a'))][(_0xf449('0x5b'))](_0xf449('0x5c'));}});_0x318ed0['on']('error',function(_0x55898e){throw new db[(_0xf449('0x5a'))][(_0xf449('0x5b'))](_0xf449('0x5c'));});_0x318ed0[_0xf449('0x5d')](_0x1add1b);_0x318ed0[_0xf449('0x5e')](_0xf449('0x5f'),{'cwd':path['join'](config[_0xf449('0x60')],_0xf449('0x61'),path[_0xf449('0x62')](_0x945e24['path'])),'ignore':[path[_0xf449('0x53')](path[_0xf449('0x55')](_0x945e24[_0xf449('0x7')]),_0xf449('0x63')),path[_0xf449('0x53')](path[_0xf449('0x55')](_0x945e24[_0xf449('0x7')]),_0xf449('0x64'))],'nodir':!![]})[_0xf449('0x65')]();_0x1add1b['on']('close',function(){if(!fs[_0xf449('0x66')](_0x3ed641)){throw new db[(_0xf449('0x5a'))][(_0xf449('0x5b'))]('Plugin\x20not\x20found');}return _0x73c379['download'](_0x3ed641,util[_0xf449('0x54')](_0xf449('0x67'),path[_0xf449('0x55')](_0x945e24['path'])),function(_0x30bdf2){if(_0x30bdf2){throw new db[(_0xf449('0x5a'))]['Error'](_0xf449('0x68'));}fs[_0xf449('0x69')](_0x3ed641);logger[_0xf449('0x6a')](_0xf449('0x6b'));logger[_0xf449('0x6a')](_0xf449('0x6c'));});});}return null;})[_0xf449('0x4f')](handleError(_0x73c379,null));};exports[_0xf449('0x6d')]=function(_0x1e1204,_0x22622f,_0x5522e5){var _0x2dc47e=path[_0xf449('0x55')](_0x1e1204[_0xf449('0x6e')][_0xf449('0x6f')],path[_0xf449('0x70')](_0x1e1204['file'][_0xf449('0x6f')]));var _0x3acb68=path[_0xf449('0x53')](config['root'],'server/files/plugins',_0x1e1204[_0xf449('0x6e')]['filename']);var _0x19f3b4=path[_0xf449('0x53')](config[_0xf449('0x60')],'server/files/plugins',_0x2dc47e);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3acb68);logger[_0xf449('0x6a')](_0xf449('0x71'),_0x19f3b4);try{fs[_0xf449('0x72')](_0x3acb68,parseInt('0777',0x8));extract(_0x3acb68,{'dir':_0x19f3b4},function(_0x1f6064){if(_0x1f6064){logger[_0xf449('0x32')](_0x1f6064);handleError(_0x1f6064,!![]);};var _0x50fd08=fs[_0xf449('0x73')](_0x19f3b4);if(_0x50fd08[_0xf449('0x41')]>0x1){removeReferences(_0x3acb68,_0x19f3b4);logger['error'](_0xf449('0x74'));return _0x5522e5(new Error(_0xf449('0x74')));}var _0x4a8278=fs['lstatSync'](path[_0xf449('0x53')](_0x19f3b4,_0x50fd08[0x0]));if(_0x4a8278['isFile']()){removeReferences(_0x3acb68,_0x19f3b4);logger[_0xf449('0x32')](_0xf449('0x74'));return _0x5522e5(new Error(_0xf449('0x74')));}if(_0x4a8278[_0xf449('0x75')]()){var _0x3e807f=fs[_0xf449('0x73')](path[_0xf449('0x53')](_0x19f3b4,_0x50fd08[0x0]));if(_0x3e807f['length']===0x0){removeReferences(_0x3acb68,_0x19f3b4);logger[_0xf449('0x32')](_0xf449('0x74'));return _0x5522e5(new Error(_0xf449('0x74')));}var _0x264004=_0x3e807f[_0xf449('0x76')](function(_0x14a05f){return _0x14a05f===_0xf449('0x77');});if(!_0x264004){return _0x5522e5(new Error(_0xf449('0x78')));}var _0x10afd3=fs[_0xf449('0x79')](path[_0xf449('0x53')](_0x19f3b4,_0x50fd08[0x0],_0xf449('0x77')));var _0x128666=JSON[_0xf449('0x7a')](_0x10afd3);if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x33')]){return _0x5522e5(new Error(_0xf449('0x7b')));}if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x38')]){return _0x5522e5(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x7c')]){return _0x5522e5(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x7d')]){return _0x5522e5(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x128666[_0xf449('0x38')]===_0xf449('0x7e')){if(_0xf449('0x25')==typeof _0x128666['parameters'][_0xf449('0x7f')]){return _0x5522e5(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x7d')]['views'][_0xf449('0x80')]&&'undefined'==typeof _0x128666[_0xf449('0x7d')][_0xf449('0x7f')][_0xf449('0x81')]){return _0x5522e5(new Error(_0xf449('0x82')));}}else if(_0x128666[_0xf449('0x38')]==='script'){if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x7d')]['scriptName']){return _0x5522e5(new Error(_0xf449('0x83')));}if(_0xf449('0x25')==typeof _0x128666[_0xf449('0x7d')][_0xf449('0x84')]){return _0x5522e5(new Error(_0xf449('0x85')));}}else{return _0x5522e5(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x58e42f=_0x128666[_0xf449('0x33')];var _0x4ab6c8=_0x128666[_0xf449('0x86')];var _0x4e2fe8=_0x128666[_0xf449('0x38')];var _0x5b9e18=_0x128666[_0xf449('0x87')]?_0x128666[_0xf449('0x87')]:'always';var _0xe491da=_0x128666[_0xf449('0x88')]?_0x128666[_0xf449('0x88')]:'icon-apps';var _0x5e3584='';var _0x4ce25c='';var _0x576147='';var _0x1048e5='';var _0x393474=_0x128666[_0xf449('0x7c')];if(_0x4e2fe8===_0xf449('0x7e')){if(_0xf449('0x25')!=typeof _0x128666['parameters']['views'][_0xf449('0x80')]){var _0x309e09=_0x128666['parameters'][_0xf449('0x7f')][_0xf449('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x309e09)){_0x5e3584=path['join']('plugins',_0x2dc47e,_0x50fd08[0x0],_0x309e09);}else{_0x5e3584=_0x309e09;}}else{logger[_0xf449('0x6a')](_0xf449('0x89'));}if('undefined'!=typeof _0x128666[_0xf449('0x7d')][_0xf449('0x7f')]['agent']){var _0x7a7bb7=_0x128666['parameters']['views'][_0xf449('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xf449('0x8a')](_0x7a7bb7)){_0x4ce25c=path['join'](_0xf449('0x8b'),_0x2dc47e,_0x50fd08[0x0],_0x7a7bb7);}else{_0x4ce25c=_0x7a7bb7;}}else{logger['info'](_0xf449('0x8c'));}}else if(_0x4e2fe8==='script'){_0x576147=_0x128666[_0xf449('0x7d')]['scriptName'];_0x1048e5=_0x128666[_0xf449('0x7d')]['scriptPath'];if(_0xf449('0x25')!=typeof _0x128666[_0xf449('0x7d')]['views']){if(_0xf449('0x25')!=typeof _0x128666['parameters'][_0xf449('0x7f')]['admin']){var _0x309e09=_0x128666[_0xf449('0x7d')]['views'][_0xf449('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x309e09)){_0x5e3584=path[_0xf449('0x53')](_0xf449('0x8b'),_0x2dc47e,_0x50fd08[0x0],_0x309e09);}else{_0x5e3584=_0x309e09;}}if(_0xf449('0x25')!=typeof _0x128666[_0xf449('0x7d')][_0xf449('0x7f')][_0xf449('0x81')]){var _0x7a7bb7=_0x128666[_0xf449('0x7d')]['views'][_0xf449('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x7a7bb7)){_0x4ce25c=path[_0xf449('0x53')](_0xf449('0x8b'),_0x2dc47e,_0x50fd08[0x0],_0x7a7bb7);}else{_0x4ce25c=_0x7a7bb7;}}}}var _0x4c4ec4={'name':_0x58e42f,'description':_0x4ab6c8,'path':path[_0xf449('0x53')](_0x2dc47e,_0x50fd08[0x0]),'type':_0x4e2fe8,'sidebar':_0x5b9e18,'icon':_0xe491da,'adminUrl':_0x5e3584,'agentUrl':_0x4ce25c,'scriptName':_0x576147,'scriptPath':_0x1048e5,'version':_0x393474};removeReferences(_0x3acb68,null);return db[_0xf449('0x4b')]['create'](_0x4c4ec4)[_0xf449('0x2d')](function(_0x28e278){var _0x5c41a4={'role':_0x1e1204[_0xf449('0x8d')][_0xf449('0x8e')],'userProfileId':_0x1e1204[_0xf449('0x8d')][_0xf449('0x8f')]};if(!_0x5c41a4)throw new Error(_0xf449('0x90'));if(_0x5c41a4['role']===_0xf449('0x91')){var _0x908b0e=_0x28e278[_0xf449('0x2f')]({'plain':!![]});return db[_0xf449('0x92')][_0xf449('0x51')]({'where':{'name':'Plugins','userProfileId':_0x5c41a4[_0xf449('0x8f')]},'raw':!![]})[_0xf449('0x2d')](function(_0x337e07){if(_0x337e07&&_0x337e07[_0xf449('0x93')]===0x0){return db[_0xf449('0x31')][_0xf449('0x94')]({'name':_0x908b0e[_0xf449('0x33')],'resourceId':_0x908b0e['id'],'type':_0x337e07['name'],'sectionId':_0x337e07['id']},{})[_0xf449('0x2d')](function(){return _0x28e278;});}else{return _0x28e278;}})[_0xf449('0x4f')](function(_0x37391e){logger[_0xf449('0x32')](_0xf449('0x95'),_0x37391e);throw _0x37391e;});}return _0x28e278;})[_0xf449('0x2d')](respondWithResult(_0x22622f,null))[_0xf449('0x4f')](handleError(_0x22622f,null));}});}catch(_0x114082){_0x22622f[_0xf449('0x21')](0x1f4)['send'](_0x114082);}};function removeReferences(_0x35cced,_0x282f81){try{if(_0x35cced){fs[_0xf449('0x69')](_0x35cced);logger[_0xf449('0x6a')](_0xf449('0x96'));}if(_0x282f81){rimraf(_0x282f81,function(){});logger[_0xf449('0x6a')]('Extracted\x20folder\x20removed');}}catch(_0x411965){logger[_0xf449('0x32')](_0x411965);}}exports[_0xf449('0x2c')]=function(_0x333a88,_0x591246,_0x21306a){return db[_0xf449('0x4b')][_0xf449('0x51')]({'where':{'id':_0x333a88[_0xf449('0x52')]['id']}})[_0xf449('0x2d')](handleEntityNotFound(_0x591246,null))[_0xf449('0x2d')](saveUpdates(_0x333a88[_0xf449('0x8d')],null))[_0xf449('0x2d')](respondWithResult(_0x591246,null))[_0xf449('0x4f')](handleError(_0x591246,null));};exports[_0xf449('0x97')]=function(_0x1e24ac,_0xfd3c5,_0x398654){return db['Plugin'][_0xf449('0x51')]({'where':{'id':_0x1e24ac['params']['id']}})['then'](function(_0x1aec5f){if(_0x1aec5f){return _0x1aec5f[_0xf449('0x2e')]();}})[_0xf449('0x2d')](function(_0x4cfb64){rimraf(path[_0xf449('0x53')](config[_0xf449('0x60')],_0xf449('0x61'),path[_0xf449('0x62')](_0x4cfb64[_0xf449('0x7')])),function(){});return _0x4cfb64;})['then'](handleEntityNotFound(_0xfd3c5,null))['then'](respondWithStatusCode(_0xfd3c5,null))[_0xf449('0x4f')](handleError(_0xfd3c5,null));};exports['webhookGet']=function(_0x17cb0e,_0x2109aa,_0x5aad32){return BPromise[_0xf449('0x98')]()[_0xf449('0x2d')](function(){if(!_0x17cb0e[_0xf449('0x3c')]['path']){throw new Error(_0xf449('0x99'));}if(!_0x17cb0e[_0xf449('0x3c')][_0xf449('0x9a')]){throw new Error(_0xf449('0x9b'));}var _0x5b96ff=_0x17cb0e[_0xf449('0x3c')][_0xf449('0x9c')]?_0x17cb0e['query']['hostname']+':'+_0x17cb0e[_0xf449('0x3c')][_0xf449('0x9a')]:_0xf449('0x9d')+_0x17cb0e[_0xf449('0x3c')]['port'];var _0x50e2ee=_0x17cb0e[_0xf449('0x3c')][_0xf449('0x23')]?_0x17cb0e['query'][_0xf449('0x23')]:!![];var _0x1fbfab=_0x17cb0e['query'][_0xf449('0x9e')]?_0x17cb0e[_0xf449('0x3c')][_0xf449('0x9e')]:null;var _0x22ed8a={'method':_0x17cb0e[_0xf449('0x9f')],'uri':util[_0xf449('0x54')](_0xf449('0xa0'),_0x5b96ff,_0x17cb0e[_0xf449('0x3c')][_0xf449('0x7')]),'json':_0x50e2ee,'resolveWithFullResponse':!![],'encoding':_0x1fbfab,'qs':_0x17cb0e[_0xf449('0x3c')]};if(_0x17cb0e[_0xf449('0xa1')]){_0x22ed8a[_0xf449('0xa1')]=_0x17cb0e[_0xf449('0xa1')];if(_0x22ed8a[_0xf449('0xa1')][_0xf449('0xa2')]){delete _0x22ed8a[_0xf449('0xa1')][_0xf449('0xa2')];}}if(_0x22ed8a[_0xf449('0xa1')]['content-type']){delete _0x22ed8a[_0xf449('0xa1')][_0xf449('0xa3')];}return rp(_0x22ed8a);})[_0xf449('0x2d')](function(_0x3fde17){if(_0x3fde17){_0x2109aa[_0xf449('0x28')](_0x3fde17[_0xf449('0xa1')]);logger[_0xf449('0x6a')](_0x3fde17[_0xf449('0x8d')]);if(_[_0xf449('0xa4')](_0x17cb0e[_0xf449('0x3c')][_0xf449('0x7')],_0xf449('0xa5'))&&_0x3fde17[_0xf449('0xa6')]==0x1f4){return _0x2109aa[_0xf449('0x20')](_0x3fde17['statusCode']);}else{return _0x2109aa[_0xf449('0x21')](_0x3fde17[_0xf449('0xa6')])[_0xf449('0xa7')](_0x3fde17[_0xf449('0x8d')]);}}else{return _0x2109aa['sendStatus'](0xc8);}})[_0xf449('0x4f')](handleError(_0x2109aa,null));};exports[_0xf449('0xa8')]=function(_0x251800,_0x1cd90c,_0x5a0fe2){return BPromise['resolve']()[_0xf449('0x2d')](function(){if(!_0x251800[_0xf449('0x3c')]['path']){throw new Error(_0xf449('0x99'));}if(!_0x251800[_0xf449('0x3c')]['port']){throw new Error(_0xf449('0x9b'));}var _0x259456=_0x251800[_0xf449('0x3c')][_0xf449('0x9c')]?_0x251800[_0xf449('0x3c')][_0xf449('0x9c')]+':'+_0x251800[_0xf449('0x3c')][_0xf449('0x9a')]:_0xf449('0x9d')+_0x251800['query']['port'];var _0x537568=_0x251800[_0xf449('0x3c')][_0xf449('0x23')]?_0x251800[_0xf449('0x3c')][_0xf449('0x23')]:!![];var _0x2b710c=_0x251800[_0xf449('0x3c')][_0xf449('0x9e')]?_0x251800[_0xf449('0x3c')]['encoding']:null;var _0x1a88e4={'method':_0x251800[_0xf449('0x9f')],'uri':util[_0xf449('0x54')](_0xf449('0xa0'),_0x259456,_0x251800[_0xf449('0x3c')]['path']),'json':_0x537568,'resolveWithFullResponse':!![],'encoding':_0x2b710c,'body':_0x251800[_0xf449('0x8d')]};if(_0x251800['headers']){_0x1a88e4['headers']=_0x251800[_0xf449('0xa1')];if(_0x1a88e4['headers'][_0xf449('0xa2')]){delete _0x1a88e4['headers'][_0xf449('0xa2')];}}if(_0x1a88e4[_0xf449('0xa1')][_0xf449('0xa3')]){delete _0x1a88e4[_0xf449('0xa1')][_0xf449('0xa3')];}return rp(_0x1a88e4);})[_0xf449('0x2d')](function(_0x4ea82c){if(_0x4ea82c){_0x1cd90c[_0xf449('0x28')](_0x4ea82c[_0xf449('0xa1')]);logger[_0xf449('0x6a')](_0x4ea82c[_0xf449('0x8d')]);return _0x1cd90c[_0xf449('0x21')](_0x4ea82c[_0xf449('0xa6')])[_0xf449('0xa7')](_0x4ea82c[_0xf449('0x8d')]);}else{return _0x1cd90c['sendStatus'](0xc8);}})[_0xf449('0x4f')](handleError(_0x1cd90c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 391db6d..64eea82 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 _0x3831=['update','remove','hook','events','Plugin','setMaxListeners','save'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x3831,0x14c));var _0x1383=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x3831[_0x2bcddb];return _0x12a9e8;};'use strict';var EventEmitter=require(_0x1383('0x0'));var Plugin=require('../../mysqldb')['db'][_0x1383('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x1383('0x2')](0x0);var events={'afterCreate':_0x1383('0x3'),'afterUpdate':_0x1383('0x4'),'afterDestroy':_0x1383('0x5')};function emitEvent(_0x580d3d){return function(_0x2fdf72,_0x573874,_0x21ea2c){PluginEvents['emit'](_0x580d3d+':'+_0x2fdf72['id'],_0x2fdf72);PluginEvents['emit'](_0x580d3d,_0x2fdf72);_0x21ea2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x1383('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x0eb2=['update','remove','emit','hasOwnProperty','hook','events','Plugin','setMaxListeners','save'];(function(_0x17cde2,_0x6c715){var _0x5fdcf2=function(_0x362248){while(--_0x362248){_0x17cde2['push'](_0x17cde2['shift']());}};_0x5fdcf2(++_0x6c715);}(_0x0eb2,0x11c));var _0x20eb=function(_0x39578c,_0x23635b){_0x39578c=_0x39578c-0x0;var _0x15ee51=_0x0eb2[_0x39578c];return _0x15ee51;};'use strict';var EventEmitter=require(_0x20eb('0x0'));var Plugin=require('../../mysqldb')['db'][_0x20eb('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x20eb('0x2')](0x0);var events={'afterCreate':_0x20eb('0x3'),'afterUpdate':_0x20eb('0x4'),'afterDestroy':_0x20eb('0x5')};function emitEvent(_0x525ecf){return function(_0x118292,_0x59e891,_0x48d831){PluginEvents['emit'](_0x525ecf+':'+_0x118292['id'],_0x118292);PluginEvents[_0x20eb('0x6')](_0x525ecf,_0x118292);_0x48d831(null);};}for(var e in events){if(events[_0x20eb('0x7')](e)){var event=events[e];Plugin[_0x20eb('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index adb2047..a2a4897 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 _0x5f7b=['../../config/environment','exports','define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x5f7b,0x19c));var _0xb5f7=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5f7b[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0xb5f7('0x0'));var logger=require(_0xb5f7('0x1'))(_0xb5f7('0x2'));var moment=require(_0xb5f7('0x3'));var BPromise=require(_0xb5f7('0x4'));var rp=require(_0xb5f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5f7('0x6'));var attributes=require('./plugin.attributes');module[_0xb5f7('0x7')]=function(_0x4166ca,_0x532b67){return _0x4166ca[_0xb5f7('0x8')](_0xb5f7('0x9'),attributes,{'tableName':_0xb5f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e4c=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Plugin','plugins','lodash','util'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x5e4c,0xd6));var _0xc5e4=function(_0x5ef305,_0x18c886){_0x5ef305=_0x5ef305-0x0;var _0x58be2d=_0x5e4c[_0x5ef305];return _0x58be2d;};'use strict';var _=require(_0xc5e4('0x0'));var util=require(_0xc5e4('0x1'));var logger=require(_0xc5e4('0x2'))(_0xc5e4('0x3'));var moment=require('moment');var BPromise=require(_0xc5e4('0x4'));var rp=require(_0xc5e4('0x5'));var fs=require('fs');var path=require(_0xc5e4('0x6'));var rimraf=require(_0xc5e4('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xc5e4('0x8')]=function(_0x50f80c,_0x38381c){return _0x50f80c[_0xc5e4('0x9')](_0xc5e4('0xa'),attributes,{'tableName':_0xc5e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 318f9d7..fceb363 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 _0x1637=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','body','options','raw','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','debug'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1637,0x14c));var _0x7163=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x1637[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x7163('0x0'));var util=require(_0x7163('0x1'));var moment=require('moment');var BPromise=require(_0x7163('0x2'));var rs=require(_0x7163('0x3'));var fs=require('fs');var Redis=require(_0x7163('0x4'));var db=require(_0x7163('0x5'))['db'];var utils=require(_0x7163('0x6'));var logger=require(_0x7163('0x7'))('rpc');var config=require(_0x7163('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7163('0x9')][_0x7163('0xa')]({'port':0x232a});config['redis']=_[_0x7163('0xb')](config['redis'],{'host':_0x7163('0xc'),'port':0x18eb});var socket=require(_0x7163('0xd'))(new Redis(config['redis']));require(_0x7163('0xe'))['register'](socket);function respondWithRpcPromise(_0x2663ae,_0x138837,_0x34f914){return new BPromise(function(_0x4dadba,_0xd15c80){return client[_0x7163('0xf')](_0x2663ae,_0x34f914)[_0x7163('0x10')](function(_0x5bd85a){logger[_0x7163('0x11')](_0x7163('0x12'),_0x138837,'request\x20sent');logger[_0x7163('0x13')](_0x7163('0x14'),_0x138837,'request\x20sent',JSON[_0x7163('0x15')](_0x5bd85a));if(_0x5bd85a[_0x7163('0x16')]){if(_0x5bd85a['error'][_0x7163('0x17')]===0x1f4){logger[_0x7163('0x16')]('Plugin,\x20%s,\x20%s',_0x138837,_0x5bd85a['error'][_0x7163('0x18')]);return _0xd15c80(_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);}logger[_0x7163('0x16')](_0x7163('0x12'),_0x138837,_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);return _0x4dadba(_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);}else{logger[_0x7163('0x11')](_0x7163('0x12'),_0x138837,'request\x20sent');_0x4dadba(_0x5bd85a[_0x7163('0x19')]['message']);}})[_0x7163('0x1a')](function(_0x3cdffa){logger[_0x7163('0x16')](_0x7163('0x12'),_0x138837,_0x3cdffa);_0xd15c80(_0x3cdffa);});});}exports['CreatePlugin']=function(_0x49eeee){var _0x5143b2=this;return new Promise(function(_0x211476,_0x5dc832){return db[_0x7163('0x1b')]['create'](_0x49eeee[_0x7163('0x1c')],{'raw':_0x49eeee[_0x7163('0x1d')]?_0x49eeee['options'][_0x7163('0x1e')]===undefined?!![]:![]:!![]})[_0x7163('0x10')](function(_0x40c6f4){logger[_0x7163('0x11')](_0x7163('0x1f'),_0x49eeee);logger[_0x7163('0x13')](_0x7163('0x1f'),_0x49eeee,JSON['stringify'](_0x40c6f4));_0x211476(_0x40c6f4);})[_0x7163('0x1a')](function(_0x1901b7){logger[_0x7163('0x16')](_0x7163('0x1f'),_0x1901b7[_0x7163('0x18')],_0x49eeee);_0x5dc832(_0x5143b2[_0x7163('0x16')](0x1f4,_0x1901b7[_0x7163('0x18')]));});});}; \ No newline at end of file +var _0x3521=['randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','bluebird'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x3521,0x183));var _0x1352=function(_0x3fc244,_0x5ee61d){_0x3fc244=_0x3fc244-0x0;var _0xcb0657=_0x3521[_0x3fc244];return _0xcb0657;};'use strict';var _=require(_0x1352('0x0'));var util=require(_0x1352('0x1'));var moment=require('moment');var BPromise=require(_0x1352('0x2'));var rs=require(_0x1352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1352('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1352('0x5'));var config=require(_0x1352('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1352('0x7')][_0x1352('0x8')]({'port':0x232a});config[_0x1352('0x9')]=_['defaults'](config[_0x1352('0x9')],{'host':_0x1352('0xa'),'port':0x18eb});var socket=require(_0x1352('0xb'))(new Redis(config['redis']));require('./plugin.socket')[_0x1352('0xc')](socket);function respondWithRpcPromise(_0x417fca,_0x1c2acb,_0x5f0837){return new BPromise(function(_0xf2edb6,_0x323ea0){return client['request'](_0x417fca,_0x5f0837)[_0x1352('0xd')](function(_0x8ad131){logger[_0x1352('0xe')](_0x1352('0xf'),_0x1c2acb,_0x1352('0x10'));logger[_0x1352('0x11')](_0x1352('0x12'),_0x1c2acb,_0x1352('0x10'),JSON[_0x1352('0x13')](_0x8ad131));if(_0x8ad131[_0x1352('0x14')]){if(_0x8ad131[_0x1352('0x14')][_0x1352('0x15')]===0x1f4){logger['error'](_0x1352('0xf'),_0x1c2acb,_0x8ad131[_0x1352('0x14')][_0x1352('0x16')]);return _0x323ea0(_0x8ad131[_0x1352('0x14')]['message']);}logger[_0x1352('0x14')]('Plugin,\x20%s,\x20%s',_0x1c2acb,_0x8ad131[_0x1352('0x14')]['message']);return _0xf2edb6(_0x8ad131[_0x1352('0x14')]['message']);}else{logger[_0x1352('0xe')]('Plugin,\x20%s,\x20%s',_0x1c2acb,'request\x20sent');_0xf2edb6(_0x8ad131[_0x1352('0x17')]['message']);}})[_0x1352('0x18')](function(_0x2f8d44){logger[_0x1352('0x14')](_0x1352('0xf'),_0x1c2acb,_0x2f8d44);_0x323ea0(_0x2f8d44);});});}exports[_0x1352('0x19')]=function(_0x1d94e6){var _0x5cd001=this;return new Promise(function(_0x321670,_0x1679ae){return db[_0x1352('0x1a')]['create'](_0x1d94e6[_0x1352('0x1b')],{'raw':_0x1d94e6[_0x1352('0x1c')]?_0x1d94e6[_0x1352('0x1c')][_0x1352('0x1d')]===undefined?!![]:![]:!![]})[_0x1352('0xd')](function(_0x4ddcdd){logger[_0x1352('0xe')](_0x1352('0x19'),_0x1d94e6);logger['debug'](_0x1352('0x19'),_0x1d94e6,JSON[_0x1352('0x13')](_0x4ddcdd));_0x321670(_0x4ddcdd);})['catch'](function(_0x32293b){logger[_0x1352('0x14')](_0x1352('0x19'),_0x32293b['message'],_0x1d94e6);_0x1679ae(_0x5cd001['error'](0x1f4,_0x32293b['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 23efa44..ba46255 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 _0x5679=['register','length','plugin:','./plugin.events','remove','update','emit','removeListener'];(function(_0x37a9fc,_0x2cecb2){var _0x4b2049=function(_0x14340d){while(--_0x14340d){_0x37a9fc['push'](_0x37a9fc['shift']());}};_0x4b2049(++_0x2cecb2);}(_0x5679,0xeb));var _0x9567=function(_0x27ed42,_0x2e5246){_0x27ed42=_0x27ed42-0x0;var _0x105321=_0x5679[_0x27ed42];return _0x105321;};'use strict';var PluginEvents=require(_0x9567('0x0'));var events=['save',_0x9567('0x1'),_0x9567('0x2')];function createListener(_0x528bc5,_0x50085f){return function(_0x7c71cb){_0x50085f[_0x9567('0x3')](_0x528bc5,_0x7c71cb);};}function removeListener(_0x143ddf,_0xb0d5ab){return function(){PluginEvents[_0x9567('0x4')](_0x143ddf,_0xb0d5ab);};}exports[_0x9567('0x5')]=function(_0x17f460){for(var _0x3fc9f6=0x0,_0x5d4c1d=events[_0x9567('0x6')];_0x3fc9f6<_0x5d4c1d;_0x3fc9f6++){var _0xe9d49b=events[_0x3fc9f6];var _0x48221f=createListener(_0x9567('0x7')+_0xe9d49b,_0x17f460);PluginEvents['on'](_0xe9d49b,_0x48221f);}}; \ No newline at end of file +var _0xcc88=['emit','length','plugin:','./plugin.events','save','update'];(function(_0x105855,_0x414d97){var _0x487389=function(_0x4ea0e5){while(--_0x4ea0e5){_0x105855['push'](_0x105855['shift']());}};_0x487389(++_0x414d97);}(_0xcc88,0xd5));var _0x8cc8=function(_0x5d1bd4,_0x5ad706){_0x5d1bd4=_0x5d1bd4-0x0;var _0x330536=_0xcc88[_0x5d1bd4];return _0x330536;};'use strict';var PluginEvents=require(_0x8cc8('0x0'));var events=[_0x8cc8('0x1'),'remove',_0x8cc8('0x2')];function createListener(_0x193eb5,_0x24b409){return function(_0x5c6715){_0x24b409[_0x8cc8('0x3')](_0x193eb5,_0x5c6715);};}function removeListener(_0x3a075d,_0x2cb6ab){return function(){PluginEvents['removeListener'](_0x3a075d,_0x2cb6ab);};}exports['register']=function(_0x24dae0){for(var _0x291368=0x0,_0x57823c=events[_0x8cc8('0x4')];_0x291368<_0x57823c;_0x291368++){var _0x266d2d=events[_0x291368];var _0x48b0d3=createListener(_0x8cc8('0x5')+_0x266d2d,_0x24dae0);PluginEvents['on'](_0x266d2d,_0x48b0d3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4ca4310..83e4529 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(_0x3130e,_0x443313){var _0x2dd444=function(_0x58e7b9){while(--_0x58e7b9){_0x3130e['push'](_0x3130e['shift']());}};_0x2dd444(++_0x443313);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2a8695,_0x4c57fc){var _0xf80575=function(_0x3219b8){while(--_0x3219b8){_0x2a8695['push'](_0x2a8695['shift']());}};_0xf80575(++_0x4c57fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 567f25b..719e22e 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 _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xaa88,0x137));var _0x8aa8=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xaa88[_0xea343d];return _0x2c6e9c;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file +var _0xe13a=['exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','reject','express','length','catch','show','describe','params','then','body','script','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xe13a,0x178));var _0xae13=function(_0x269b9a,_0x2c1906){_0x269b9a=_0x269b9a-0x0;var _0x2a52a0=_0xe13a[_0x269b9a];return _0x2a52a0;};'use strict';var _=require('lodash');var pm2=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var path=require(_0xae13('0x3'));var exec=require('child_process')[_0xae13('0x4')];var BPromise=require(_0xae13('0x5'));function handleEntityNotFound(_0x3ebbfe,_0x10abd7){return function(_0x28a89a){if(!_0x28a89a){_0x3ebbfe[_0xae13('0x6')](0x194);;}return _0x28a89a;};}function respondWithResult(_0x412a07,_0x3379ed){_0x3379ed=_0x3379ed||0xc8;return function(_0x341ba4){if(_0x341ba4){return _0x412a07['status'](_0x3379ed)[_0xae13('0x7')](_0x341ba4);}return null;};}function handleError(_0x2b2e1f,_0x27fefd){_0x27fefd=_0x27fefd||0x1f4;return function(_0x2a793f){logger[_0xae13('0x8')](_0x2a793f[_0xae13('0x9')]);if(_0x2a793f[_0xae13('0xa')]){delete _0x2a793f[_0xae13('0xa')];}_0x2b2e1f[_0xae13('0xb')](_0x27fefd)['send'](_0x2a793f);};}function execChildProcess(){return new BPromise(function(_0x404b0e,_0x83de98){exec(_0xae13('0xc'),function(_0x3a6d41,_0x14df2d,_0x3006f0){logger[_0xae13('0xd')](_0x14df2d);logger['info'](_0x3006f0);if(_0x3a6d41){logger[_0xae13('0x8')](_0x3a6d41);return _0x83de98(_0x3a6d41);}return _0x404b0e(_0x14df2d);});});}exports[_0xae13('0xe')]=function(_0x5c61bb,_0x589803){return pm2['list']()['then'](function(_0x52484b){if(_0x52484b){var _0x26ff3e=_[_0xae13('0xf')](_0x52484b,function(_0x44e141){return _0x44e141[_0xae13('0xa')]===_0xae13('0x10')||_0x44e141[_0xae13('0xa')]==='motion2';});return{'rows':_0x26ff3e,'count':_0x26ff3e[_0xae13('0x11')]};}return null;})['then'](respondWithResult(_0x589803,null))[_0xae13('0x12')](handleError(_0x589803,null));};exports[_0xae13('0x13')]=function(_0x207363,_0x118e52){return pm2[_0xae13('0x14')](_0x207363[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x118e52,null))[_0xae13('0x16')](handleEntityNotFound(_0x118e52,null))[_0xae13('0x12')](handleError(_0x118e52,null));};exports['create']=function(_0x4462a5,_0x50eb6c){if(_0x4462a5[_0xae13('0x17')][_0xae13('0xa')]&&_0x4462a5['body'][_0xae13('0x18')]){var _0x39d41c=path[_0xae13('0x19')](__dirname,_0xae13('0x1a'),_0x4462a5[_0xae13('0x17')][_0xae13('0x18')]);var _0x54b3b4=process['cwd']();process[_0xae13('0x1b')](path[_0xae13('0x1c')](_0x39d41c));return execChildProcess()['then'](function(_0x168b92){process['chdir'](_0x54b3b4);return pm2[_0xae13('0x1d')]({'name':_0x4462a5[_0xae13('0x17')][_0xae13('0xa')],'script':_0x39d41c});})['then'](function(_0x57124a){pm2['dump']();return _0x57124a[0x0];})[_0xae13('0x16')](respondWithResult(_0x50eb6c,0xc9))[_0xae13('0x12')](handleError(_0x50eb6c,null));}else{return _0x50eb6c[_0xae13('0xb')](0x1f4)['send']({'message':_0xae13('0x1e')});}};exports['update']=function(_0x3d0d60,_0x5de054){if(_0x3d0d60[_0xae13('0x17')]['id']){delete _0x3d0d60[_0xae13('0x17')]['id'];}var _0x526e4e={'online':_0xae13('0x1f'),'stopped':_0xae13('0x20')};if(_0x526e4e[_0xae13('0x21')](_0x3d0d60[_0xae13('0x17')]['status'])){return pm2[_0x526e4e[_0x3d0d60[_0xae13('0x17')][_0xae13('0xb')]]](_0x3d0d60[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x5de054,0xc8))[_0xae13('0x12')](handleError(_0x5de054,null));}else{return _0x5de054[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':'Unknown\x20status'});}};exports[_0xae13('0x23')]=function(_0x591f94,_0xf6289c){if(_0x591f94[_0xae13('0x17')]['id']){delete _0x591f94[_0xae13('0x17')]['id'];}if(_0x591f94[_0xae13('0x15')]['id']){return pm2[_0xae13('0x24')](_0x591f94[_0xae13('0x15')]['id'])[_0xae13('0x16')](function(_0x48f0f6){pm2['dump']();return _0x48f0f6[0x0];})[_0xae13('0x16')](respondWithResult(_0xf6289c,null))[_0xae13('0x12')](handleError(_0xf6289c,null));}else{return _0xf6289c[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':_0xae13('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 01bae5c..8a4b61b 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 _0x5943=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x1e71b7,_0x74a443){var _0x42c3a0=function(_0x30050f){while(--_0x30050f){_0x1e71b7['push'](_0x1e71b7['shift']());}};_0x42c3a0(++_0x74a443);}(_0x5943,0x1a4));var _0x3594=function(_0x482560,_0x3e5ef2){_0x482560=_0x482560-0x0;var _0x2cceec=_0x5943[_0x482560];return _0x2cceec;};'use strict';var express=require(_0x3594('0x0'));var router=express[_0x3594('0x1')]();var auth=require(_0x3594('0x2'));var controller=require(_0x3594('0x3'));router[_0x3594('0x4')](_0x3594('0x5'),auth[_0x3594('0x6')](),controller[_0x3594('0x7')]);router[_0x3594('0x4')](_0x3594('0x8'),auth[_0x3594('0x6')](),controller[_0x3594('0x9')]);module['exports']=router; \ No newline at end of file +var _0x8dd9=['exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues','getQueues'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0x8dd9,0x182));var _0x98dd=function(_0x529902,_0x1c9253){_0x529902=_0x529902-0x0;var _0x6f4be6=_0x8dd9[_0x529902];return _0x6f4be6;};'use strict';var express=require(_0x98dd('0x0'));var router=express[_0x98dd('0x1')]();var auth=require(_0x98dd('0x2'));var controller=require(_0x98dd('0x3'));router['get'](_0x98dd('0x4'),auth[_0x98dd('0x5')](),controller[_0x98dd('0x6')]);router[_0x98dd('0x7')](_0x98dd('0x8'),auth[_0x98dd('0x5')](),controller[_0x98dd('0x9')]);module[_0x98dd('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 699c50e..07c6c9a 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x4f23fe,_0x7e5e84){var _0x549f0b=function(_0x192ff0){while(--_0x192ff0){_0x4f23fe['push'](_0x4f23fe['shift']());}};_0x549f0b(++_0x7e5e84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x37909b,_0xbd548c){var _0x1a949b=function(_0x1bceb8){while(--_0x1bceb8){_0x37909b['push'](_0x37909b['shift']());}};_0x1a949b(++_0xbd548c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 86428fe..1f3a5ec 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x172fe1,_0x202c8d){var _0x20ec49=function(_0x514e7c){while(--_0x514e7c){_0x172fe1['push'](_0x172fe1['shift']());}};_0x20ec49(++_0x202c8d);}(_0x70e0,0x17b));var _0x070e=function(_0x8f2c35,_0xe1cdc0){_0x8f2c35=_0x8f2c35-0x0;var _0x3bbf24=_0x70e0[_0x8f2c35];return _0x3bbf24;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5500fa,_0x349363){var _0x56eaeb=function(_0xb88344){while(--_0xb88344){_0x5500fa['push'](_0x5500fa['shift']());}};_0x56eaeb(++_0x349363);}(_0xe706,0xa3));var _0x6e70=function(_0x34c8ff,_0x674110){_0x34c8ff=_0x34c8ff-0x0;var _0x42601c=_0xe706[_0x34c8ff];return _0x42601c;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index dadbeab..cc90616 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 _0xbd51=['sequelize','INTEGER','STRING','DATE'];(function(_0x23fdcd,_0x4760a4){var _0x413768=function(_0x2e1f37){while(--_0x2e1f37){_0x23fdcd['push'](_0x23fdcd['shift']());}};_0x413768(++_0x4760a4);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xb0cd52,_0x2dbe27){_0xb0cd52=_0xb0cd52-0x0;var _0x535f8e=_0xbd51[_0xb0cd52];return _0x535f8e;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'state':{'type':Sequelize[_0x1bd5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1bd5('0x2')]},'scheduledat':{'type':Sequelize[_0x1bd5('0x3')]},'uniqueid':{'type':Sequelize[_0x1bd5('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1bd5('0x2')]},'membername':{'type':Sequelize[_0x1bd5('0x2')]}}; \ No newline at end of file +var _0xb5bb=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0xf47725,_0x16fc46){var _0x9e6d6e=function(_0x2b0650){while(--_0x2b0650){_0xf47725['push'](_0xf47725['shift']());}};_0x9e6d6e(++_0x16fc46);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x269a99,_0x3e8852){_0x269a99=_0x269a99-0x0;var _0x504668=_0xb5bb[_0x269a99];return _0x504668;};'use strict';var Sequelize=require(_0xbb5b('0x0'));module[_0xbb5b('0x1')]={'state':{'type':Sequelize[_0xbb5b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xbb5b('0x3')]},'uniqueid':{'type':Sequelize[_0xbb5b('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3497711..80fd3dc 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 _0x0771=['exports','define','ReportAgentPreview','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes'];(function(_0x4a71c3,_0x2e8608){var _0x250a7d=function(_0x376ef0){while(--_0x376ef0){_0x4a71c3['push'](_0x4a71c3['shift']());}};_0x250a7d(++_0x2e8608);}(_0x0771,0x18f));var _0x1077=function(_0xdae8e6,_0x34854a){_0xdae8e6=_0xdae8e6-0x0;var _0x24c7a7=_0x0771[_0xdae8e6];return _0x24c7a7;};'use strict';var _=require('lodash');var util=require(_0x1077('0x0'));var logger=require(_0x1077('0x1'))(_0x1077('0x2'));var moment=require(_0x1077('0x3'));var BPromise=require(_0x1077('0x4'));var rp=require(_0x1077('0x5'));var fs=require('fs');var path=require(_0x1077('0x6'));var rimraf=require('rimraf');var config=require(_0x1077('0x7'));var attributes=require(_0x1077('0x8'));module[_0x1077('0x9')]=function(_0x32d80c,_0x5772db){return _0x32d80c[_0x1077('0xa')](_0x1077('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x432d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x3f938b,_0x3fae56){var _0x2605a1=function(_0x52f801){while(--_0x52f801){_0x3f938b['push'](_0x3f938b['shift']());}};_0x2605a1(++_0x3fae56);}(_0x432d,0xe7));var _0xd432=function(_0x30da2e,_0x146e54){_0x30da2e=_0x30da2e-0x0;var _0x794139=_0x432d[_0x30da2e];return _0x794139;};'use strict';var _=require(_0xd432('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd432('0x1'));var moment=require(_0xd432('0x2'));var BPromise=require(_0xd432('0x3'));var rp=require(_0xd432('0x4'));var fs=require('fs');var path=require(_0xd432('0x5'));var rimraf=require(_0xd432('0x6'));var config=require(_0xd432('0x7'));var attributes=require(_0xd432('0x8'));module[_0xd432('0x9')]=function(_0x2f4352,_0xfeacd6){return _0x2f4352[_0xd432('0xa')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 2fe71de..45af317 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 _0x8a9c=['raw','CreateReportAgentPreview','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','message','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview','create','body','options'];(function(_0x2c1fe6,_0x3cc587){var _0x1cc691=function(_0x365965){while(--_0x365965){_0x2c1fe6['push'](_0x2c1fe6['shift']());}};_0x1cc691(++_0x3cc587);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var moment=require(_0xc8a9('0x2'));var BPromise=require(_0xc8a9('0x3'));var rs=require(_0xc8a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8a9('0x5'))['db'];var utils=require(_0xc8a9('0x6'));var logger=require('../../config/logger')(_0xc8a9('0x7'));var config=require(_0xc8a9('0x8'));var jayson=require(_0xc8a9('0x9'));var client=jayson['client'][_0xc8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc31c,_0x1d49c8,_0x4520a2){return new BPromise(function(_0x2928f3,_0x241eae){return client[_0xc8a9('0xb')](_0x3dc31c,_0x4520a2)[_0xc8a9('0xc')](function(_0xb079ad){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'));logger[_0xc8a9('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'),JSON['stringify'](_0xb079ad));if(_0xb079ad[_0xc8a9('0xf')]){if(_0xb079ad[_0xc8a9('0xf')]['code']===0x1f4){logger[_0xc8a9('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);return _0x241eae(_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);}logger[_0xc8a9('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xb079ad['error'][_0xc8a9('0x10')]);return _0x2928f3(_0xb079ad['error'][_0xc8a9('0x10')]);}else{logger[_0xc8a9('0x11')](_0xc8a9('0x12'),_0x1d49c8,_0xc8a9('0xd'));_0x2928f3(_0xb079ad['result']['message']);}})['catch'](function(_0x4d03fe){logger[_0xc8a9('0xf')](_0xc8a9('0x12'),_0x1d49c8,_0x4d03fe);_0x241eae(_0x4d03fe);});});}exports['CreateReportAgentPreview']=function(_0x43f403){var _0x2d894e=this;return new Promise(function(_0x35bd4a,_0x20b70d){return db[_0xc8a9('0x13')][_0xc8a9('0x14')](_0x43f403[_0xc8a9('0x15')],{'raw':_0x43f403[_0xc8a9('0x16')]?_0x43f403['options'][_0xc8a9('0x17')]===undefined?!![]:![]:!![]})[_0xc8a9('0xc')](function(_0x44886a){logger[_0xc8a9('0x11')](_0xc8a9('0x18'),_0x43f403);logger[_0xc8a9('0xe')](_0xc8a9('0x18'),_0x43f403,JSON[_0xc8a9('0x19')](_0x44886a));_0x35bd4a(_0x44886a);})[_0xc8a9('0x1a')](function(_0x4d1e06){logger[_0xc8a9('0xf')](_0xc8a9('0x18'),_0x4d1e06[_0xc8a9('0x10')],_0x43f403);_0x20b70d(_0x2d894e['error'](0x1f4,_0x4d1e06[_0xc8a9('0x10')]));});});}; \ No newline at end of file +var _0xdd1b=['message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x531c78,_0x54c7bf){var _0x465248=function(_0x268a2a){while(--_0x268a2a){_0x531c78['push'](_0x531c78['shift']());}};_0x465248(++_0x54c7bf);}(_0xdd1b,0xa4));var _0xbdd1=function(_0x28acd0,_0x387a42){_0x28acd0=_0x28acd0-0x0;var _0x848823=_0xdd1b[_0x28acd0];return _0x848823;};'use strict';var _=require(_0xbdd1('0x0'));var util=require(_0xbdd1('0x1'));var moment=require(_0xbdd1('0x2'));var BPromise=require(_0xbdd1('0x3'));var rs=require(_0xbdd1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdd1('0x5'))['db'];var utils=require(_0xbdd1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbdd1('0x7'));var jayson=require(_0xbdd1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed683,_0x11f5eb,_0x1b5443){return new BPromise(function(_0x1b5d90,_0x2a7bae){return client[_0xbdd1('0x9')](_0x4ed683,_0x1b5443)['then'](function(_0x30f410){logger[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x11f5eb,_0xbdd1('0xc'));logger[_0xbdd1('0xd')](_0xbdd1('0xe'),_0x11f5eb,_0xbdd1('0xc'),JSON[_0xbdd1('0xf')](_0x30f410));if(_0x30f410[_0xbdd1('0x10')]){if(_0x30f410['error'][_0xbdd1('0x11')]===0x1f4){logger[_0xbdd1('0x10')](_0xbdd1('0xb'),_0x11f5eb,_0x30f410[_0xbdd1('0x10')]['message']);return _0x2a7bae(_0x30f410[_0xbdd1('0x10')][_0xbdd1('0x12')]);}logger[_0xbdd1('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x11f5eb,_0x30f410[_0xbdd1('0x10')]['message']);return _0x1b5d90(_0x30f410['error'][_0xbdd1('0x12')]);}else{logger[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x11f5eb,_0xbdd1('0xc'));_0x1b5d90(_0x30f410[_0xbdd1('0x13')][_0xbdd1('0x12')]);}})[_0xbdd1('0x14')](function(_0x565d9a){logger[_0xbdd1('0x10')](_0xbdd1('0xb'),_0x11f5eb,_0x565d9a);_0x2a7bae(_0x565d9a);});});}exports[_0xbdd1('0x15')]=function(_0x342836){var _0x2595da=this;return new Promise(function(_0x32c171,_0x33b118){return db[_0xbdd1('0x16')]['create'](_0x342836[_0xbdd1('0x17')],{'raw':_0x342836['options']?_0x342836[_0xbdd1('0x18')][_0xbdd1('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2d29cc){logger[_0xbdd1('0xa')](_0xbdd1('0x15'),_0x342836);logger[_0xbdd1('0xd')](_0xbdd1('0x15'),_0x342836,JSON['stringify'](_0x2d29cc));_0x32c171(_0x2d29cc);})['catch'](function(_0x1af4ea){logger['error'](_0xbdd1('0x15'),_0x1af4ea[_0xbdd1('0x12')],_0x342836);_0x33b118(_0x2595da[_0xbdd1('0x10')](0x1f4,_0x1af4ea[_0xbdd1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 52fcb40..468196f 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 _0x7b6b=['multer','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports'];(function(_0x2cdb45,_0x44c4c0){var _0x5910e4=function(_0x1f5d96){while(--_0x1f5d96){_0x2cdb45['push'](_0x2cdb45['shift']());}};_0x5910e4(++_0x44c4c0);}(_0x7b6b,0x105));var _0xb7b6=function(_0x55de06,_0x2cb79a){_0x55de06=_0x55de06-0x0;var _0x2dfb4a=_0x7b6b[_0x55de06];return _0x2dfb4a;};'use strict';var multer=require(_0xb7b6('0x0'));var util=require('util');var path=require(_0xb7b6('0x1'));var express=require(_0xb7b6('0x2'));var router=express['Router']();var auth=require(_0xb7b6('0x3'));var controller=require(_0xb7b6('0x4'));router[_0xb7b6('0x5')](_0xb7b6('0x6'),auth['isAuthenticated'](),controller[_0xb7b6('0x7')]);router[_0xb7b6('0x5')](_0xb7b6('0x8'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xa')]);router['get'](_0xb7b6('0xb'),auth['isAuthenticated'](),controller[_0xb7b6('0xc')]);router[_0xb7b6('0x5')]('/voice/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xd')]);router[_0xb7b6('0x5')]('/chat/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xe')]);router[_0xb7b6('0x5')](_0xb7b6('0xf'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x10')]);router['get'](_0xb7b6('0x11'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x12')]);router[_0xb7b6('0x5')](_0xb7b6('0x13'),auth['isAuthenticated'](),controller[_0xb7b6('0x14')]);router[_0xb7b6('0x5')](_0xb7b6('0x15'),auth[_0xb7b6('0x9')](),controller['smsQueues']);router[_0xb7b6('0x5')](_0xb7b6('0x16'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x17')]);router['get']('/fax/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x18')]);router[_0xb7b6('0x5')](_0xb7b6('0x19'),auth['isAuthenticated'](),controller[_0xb7b6('0x1a')]);router[_0xb7b6('0x5')]('/voice/queues/channels',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1b')]);router[_0xb7b6('0x5')](_0xb7b6('0x1c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1d')]);router[_0xb7b6('0x5')](_0xb7b6('0x1e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1f')]);router['get'](_0xb7b6('0x20'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x21')]);router['get'](_0xb7b6('0x22'),auth[_0xb7b6('0x9')](),controller['showVoiceQueues']);router[_0xb7b6('0x23')](_0xb7b6('0x22'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xb7b6('0x24'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x25')]);router[_0xb7b6('0x5')]('/outbound/channels',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x26')]);router[_0xb7b6('0x5')](_0xb7b6('0x27'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x28')]);router[_0xb7b6('0x23')](_0xb7b6('0x29'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2a')]);router[_0xb7b6('0x5')]('/telephones',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2b')]);router[_0xb7b6('0x5')](_0xb7b6('0x2c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2d')]);router[_0xb7b6('0x5')](_0xb7b6('0x2e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2f')]);router['get'](_0xb7b6('0x30'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x31')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xb7b6('0x32')]);router[_0xb7b6('0x5')](_0xb7b6('0x33'),auth['isAuthenticated'](),controller[_0xb7b6('0x34')]);router[_0xb7b6('0x5')](_0xb7b6('0x35'),auth[_0xb7b6('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xb7b6('0x36'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x37')]);router['get'](_0xb7b6('0x38'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x39')]);router[_0xb7b6('0x5')](_0xb7b6('0x3a'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3b')]);router[_0xb7b6('0x5')](_0xb7b6('0x3c'),auth[_0xb7b6('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xb7b6('0x3d')](_0xb7b6('0x3e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x40')));router[_0xb7b6('0x5')](_0xb7b6('0x41'),auth['isAuthenticated'](),controller[_0xb7b6('0x42')]);router[_0xb7b6('0x3d')](_0xb7b6('0x43'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')]('chat'));router[_0xb7b6('0x5')](_0xb7b6('0x44'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x45')]);router[_0xb7b6('0x3d')](_0xb7b6('0x46'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x47')));router['get'](_0xb7b6('0x48'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x49')]);router[_0xb7b6('0x3d')](_0xb7b6('0x4a'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x4b')));router[_0xb7b6('0x5')](_0xb7b6('0x4c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x4d')]);router[_0xb7b6('0x3d')](_0xb7b6('0x4e'),auth[_0xb7b6('0x9')](),controller['queueNotify'](_0xb7b6('0x4f')));router[_0xb7b6('0x3d')]('/whatsapp/queues/:id/notify',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x50')));router[_0xb7b6('0x5')]('/sms/queues/:id',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x51')]);router[_0xb7b6('0x5')](_0xb7b6('0x52'),auth['isAuthenticated'](),controller[_0xb7b6('0x53')]);router['post'](_0xb7b6('0x54'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x55')]);module[_0xb7b6('0x56')]=router; \ No newline at end of file +var _0x7866=['/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','fax'];(function(_0x134e32,_0x2d42ad){var _0x1bd6eb=function(_0x3d898e){while(--_0x3d898e){_0x134e32['push'](_0x134e32['shift']());}};_0x1bd6eb(++_0x2d42ad);}(_0x7866,0xf4));var _0x6786=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x7866[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var path=require(_0x6786('0x2'));var express=require(_0x6786('0x3'));var router=express['Router']();var auth=require(_0x6786('0x4'));var controller=require(_0x6786('0x5'));router['get'](_0x6786('0x6'),auth[_0x6786('0x7')](),controller['voiceChannels']);router[_0x6786('0x8')](_0x6786('0x9'),auth[_0x6786('0x7')](),controller[_0x6786('0xa')]);router[_0x6786('0x8')](_0x6786('0xb'),auth[_0x6786('0x7')](),controller[_0x6786('0xc')]);router[_0x6786('0x8')]('/voice/queues',auth[_0x6786('0x7')](),controller[_0x6786('0xd')]);router[_0x6786('0x8')](_0x6786('0xe'),auth[_0x6786('0x7')](),controller['chatQueues']);router[_0x6786('0x8')](_0x6786('0xf'),auth[_0x6786('0x7')](),controller[_0x6786('0x10')]);router[_0x6786('0x8')](_0x6786('0x11'),auth[_0x6786('0x7')](),controller[_0x6786('0x12')]);router[_0x6786('0x8')]('/openchannel/queues',auth[_0x6786('0x7')](),controller[_0x6786('0x13')]);router['get'](_0x6786('0x14'),auth[_0x6786('0x7')](),controller['smsQueues']);router[_0x6786('0x8')]('/whatsapp/queues',auth[_0x6786('0x7')](),controller['whatsappQueues']);router[_0x6786('0x8')](_0x6786('0x15'),auth[_0x6786('0x7')](),controller[_0x6786('0x16')]);router[_0x6786('0x8')](_0x6786('0x17'),auth[_0x6786('0x7')](),controller[_0x6786('0x18')]);router['get'](_0x6786('0x19'),auth['isAuthenticated'](),controller[_0x6786('0x1a')]);router[_0x6786('0x8')](_0x6786('0x1b'),auth[_0x6786('0x7')](),controller['voiceQueuesChannel']);router[_0x6786('0x8')](_0x6786('0x1c'),auth['isAuthenticated'](),controller[_0x6786('0x1d')]);router['get'](_0x6786('0x1e'),auth[_0x6786('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x6786('0x8')](_0x6786('0x1f'),auth[_0x6786('0x7')](),controller[_0x6786('0x20')]);router[_0x6786('0x21')](_0x6786('0x1f'),auth['isAuthenticated'](),controller[_0x6786('0x22')]);router[_0x6786('0x8')](_0x6786('0x23'),auth[_0x6786('0x7')](),controller[_0x6786('0x24')]);router[_0x6786('0x8')](_0x6786('0x25'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x6786('0x8')](_0x6786('0x26'),auth[_0x6786('0x7')](),controller[_0x6786('0x27')]);router['put'](_0x6786('0x28'),auth['isAuthenticated'](),controller[_0x6786('0x29')]);router[_0x6786('0x8')](_0x6786('0x2a'),auth[_0x6786('0x7')](),controller[_0x6786('0x2b')]);router[_0x6786('0x8')](_0x6786('0x2c'),auth[_0x6786('0x7')](),controller['trunks']);router[_0x6786('0x8')](_0x6786('0x2d'),auth[_0x6786('0x7')](),controller[_0x6786('0x2e')]);router[_0x6786('0x8')]('/fax/accounts',auth[_0x6786('0x7')](),controller[_0x6786('0x2f')]);router[_0x6786('0x8')](_0x6786('0x30'),auth[_0x6786('0x7')](),controller[_0x6786('0x31')]);router[_0x6786('0x8')](_0x6786('0x32'),auth[_0x6786('0x7')](),controller[_0x6786('0x33')]);router[_0x6786('0x8')](_0x6786('0x34'),auth[_0x6786('0x7')](),controller[_0x6786('0x35')]);router[_0x6786('0x8')](_0x6786('0x36'),auth[_0x6786('0x7')](),controller[_0x6786('0x37')]);router[_0x6786('0x8')](_0x6786('0x38'),auth[_0x6786('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0x6786('0x8')]('/whatsapp/queues/waitinginteractions',auth[_0x6786('0x7')](),controller[_0x6786('0x39')]);router[_0x6786('0x8')](_0x6786('0x3a'),auth['isAuthenticated'](),controller[_0x6786('0x3b')]);router[_0x6786('0x3c')]('/mail/queues/:id/notify',auth[_0x6786('0x7')](),controller[_0x6786('0x3d')](_0x6786('0x3e')));router[_0x6786('0x8')](_0x6786('0x3f'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x6786('0x3c')](_0x6786('0x40'),auth[_0x6786('0x7')](),controller[_0x6786('0x3d')]('chat'));router[_0x6786('0x8')](_0x6786('0x41'),auth[_0x6786('0x7')](),controller['showChatQueues']);router['post'](_0x6786('0x42'),auth[_0x6786('0x7')](),controller['queueNotify'](_0x6786('0x43')));router[_0x6786('0x8')](_0x6786('0x44'),auth[_0x6786('0x7')](),controller[_0x6786('0x45')]);router['post'](_0x6786('0x46'),auth[_0x6786('0x7')](),controller['queueNotify']('openchannel'));router['get']('/openchannel/queues/:id',auth[_0x6786('0x7')](),controller[_0x6786('0x47')]);router[_0x6786('0x3c')]('/sms/queues/:id/notify',auth[_0x6786('0x7')](),controller[_0x6786('0x3d')](_0x6786('0x48')));router[_0x6786('0x3c')](_0x6786('0x49'),auth['isAuthenticated'](),controller['queueNotify'](_0x6786('0x4a')));router[_0x6786('0x8')](_0x6786('0x4b'),auth[_0x6786('0x7')](),controller['showSmsQueues']);router[_0x6786('0x8')](_0x6786('0x4c'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x6786('0x3c')](_0x6786('0x4d'),auth['isAuthenticated'](),controller['agentNotify']);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 6759db6..685de34 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 _0x6940=['send','isNil','find','voiceChannels','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','then','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','agent','internal','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','sendStatus','name'];(function(_0x5223f0,_0x12c73c){var _0x55dd06=function(_0x4f8b1b){while(--_0x4f8b1b){_0x5223f0['push'](_0x5223f0['shift']());}};_0x55dd06(++_0x12c73c);}(_0x6940,0xe4));var _0x0694=function(_0x1db042,_0x497a84){_0x1db042=_0x1db042-0x0;var _0xa2f486=_0x6940[_0x1db042];return _0xa2f486;};'use strict';var BPromise=require(_0x0694('0x0'));var moment=require('moment');var _=require(_0x0694('0x1'));var util=require(_0x0694('0x2'));var db=require(_0x0694('0x3'))['db'];var logger=require(_0x0694('0x4'))('api');var jayson=require(_0x0694('0x5'));var amiClient=jayson[_0x0694('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x0694('0x6')][_0x0694('0x7')]({'port':0x232b});var routingClient=jayson[_0x0694('0x6')][_0x0694('0x7')]({'port':0x232c});function respondWithRpcPromise(_0xdf0cf2,_0x104b0d,_0x2fedcd){return new BPromise(function(_0x11de59,_0x45df54){var _0x6a129e=_0x2fedcd?_0x2fedcd:amiClient;return _0x6a129e[_0x0694('0x8')](_0xdf0cf2,_0x104b0d)['then'](function(_0x3f9a77){if(_0x3f9a77[_0x0694('0x9')]){if(_0x3f9a77['error'][_0x0694('0xa')]===0x1f4){return _0x45df54(_0x3f9a77[_0x0694('0x9')][_0x0694('0xb')]);}return _0x11de59(_0x3f9a77[_0x0694('0x9')][_0x0694('0xb')]);}else{_0x11de59(_0x3f9a77[_0x0694('0xc')]);}})['catch'](function(_0x58449a){_0x45df54(_0x58449a);});});}function respondWithResult(_0x3f8441,_0x3888ae){_0x3888ae=_0x3888ae||0xc8;return function(_0x43f5e0){if(_0x43f5e0){return _0x3f8441[_0x0694('0xd')](_0x3888ae)['json'](_0x43f5e0);}return _0x3f8441[_0x0694('0xe')](0x194);};}function handleError(_0x43fc6a,_0x533c05){_0x533c05=_0x533c05||0x1f4;return function(_0x461ff1){logger[_0x0694('0x9')](_0x461ff1['stack']);if(_0x461ff1[_0x0694('0xf')]){delete _0x461ff1[_0x0694('0xf')];}_0x43fc6a[_0x0694('0xd')](_0x533c05)[_0x0694('0x10')](_0x461ff1);};}function findById(_0x336b5e){return function(_0x4ac5df){if(!_['isNil'](_0x336b5e)&&!_[_0x0694('0x11')](_0x4ac5df)&&!_[_0x0694('0x11')](_0x4ac5df['rows'])){return _[_0x0694('0x12')](_0x4ac5df['rows'],function(_0x56fec8){return _0x56fec8['id']==_0x336b5e;});}return null;};}exports[_0x0694('0x13')]=function(_0x33211b,_0x2b5111){return respondWithRpcPromise(_0x0694('0x14'),_0x33211b[_0x0694('0x15')])['then'](respondWithResult(_0x2b5111,null))[_0x0694('0x16')](handleError(_0x2b5111,null));};exports['voiceChannelMixMonitor']=function(_0x245752,_0x203c6e){return respondWithRpcPromise(_0x0694('0x17'),_[_0x0694('0x18')](_0x245752['query'],_0x245752[_0x0694('0x19')]))['then'](respondWithResult(_0x203c6e,null))['catch'](handleError(_0x203c6e,null));};exports[_0x0694('0x1a')]=function(_0x1ef495,_0x2edff2){return respondWithRpcPromise(_0x0694('0x1b'),_['merge'](_0x1ef495[_0x0694('0x15')],_0x1ef495[_0x0694('0x19')]))[_0x0694('0x1c')](respondWithResult(_0x2edff2,null))[_0x0694('0x16')](handleError(_0x2edff2,null));};exports[_0x0694('0x1d')]=function(_0x944c5,_0x3072fd){return respondWithRpcPromise(_0x0694('0x1e'),_0x944c5[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x3072fd,null))[_0x0694('0x16')](handleError(_0x3072fd,null));};exports['showVoiceQueues']=function(_0x465717,_0x1046b8){return respondWithRpcPromise('VoiceQueues',_0x465717[_0x0694('0x15')])['then'](findById(_0x465717[_0x0694('0x19')]['id']))['then'](respondWithResult(_0x1046b8,null))['catch'](handleError(_0x1046b8,null));};exports[_0x0694('0x1f')]=function(_0x5250c9,_0x5675be){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x0694('0x18')](_0x5250c9[_0x0694('0x20')],_0x5250c9[_0x0694('0x19')]))[_0x0694('0x1c')](respondWithResult(_0x5675be,null))[_0x0694('0x16')](handleError(_0x5675be,null));};exports['voiceQueuesPreview']=function(_0x2596e7,_0x3c43ac){return respondWithRpcPromise(_0x0694('0x21'),_[_0x0694('0x18')](_0x2596e7['query'],_0x2596e7['params']))[_0x0694('0x1c')](respondWithResult(_0x3c43ac,null))[_0x0694('0x16')](handleError(_0x3c43ac,null));};exports[_0x0694('0x22')]=function(_0x24b33e,_0x4f3274){return respondWithRpcPromise(_0x0694('0x23'),_0x24b33e[_0x0694('0x15')])['then'](respondWithResult(_0x4f3274,null))['catch'](handleError(_0x4f3274,null));};exports['voiceQueuesChannel']=function(_0x1077b1,_0x1414ec){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0694('0x18')](_0x1077b1[_0x0694('0x15')],_0x1077b1[_0x0694('0x19')]))['then'](respondWithResult(_0x1414ec,null))['catch'](handleError(_0x1414ec,null));};exports['voiceQueuesChannelHangup']=function(_0x41238c,_0x7b6e9){return respondWithRpcPromise(_0x0694('0x24'),_[_0x0694('0x18')](_0x41238c[_0x0694('0x15')],_0x41238c['params']))[_0x0694('0x1c')](respondWithResult(_0x7b6e9,null))[_0x0694('0x16')](handleError(_0x7b6e9,null));};exports[_0x0694('0x25')]=function(_0x4327a5,_0x4b8ebb){return respondWithRpcPromise(_0x0694('0x26'),_['merge'](_0x4327a5[_0x0694('0x15')],_0x4327a5['params']))[_0x0694('0x1c')](respondWithResult(_0x4b8ebb,null))[_0x0694('0x16')](handleError(_0x4b8ebb,null));};exports['outbound']=function(_0x2f75cd,_0x54db68){return respondWithRpcPromise(_0x0694('0x27'),_0x2f75cd['query'])['then'](respondWithResult(_0x54db68,null))[_0x0694('0x16')](handleError(_0x54db68,null));};exports[_0x0694('0x28')]=function(_0x5d2552,_0x344608){return respondWithRpcPromise(_0x0694('0x29'),_0x5d2552['query'])[_0x0694('0x1c')](respondWithResult(_0x344608,null))['catch'](handleError(_0x344608,null));};exports[_0x0694('0x2a')]=function(_0x4e053f,_0x5f0cd0){var _0x30e183;return respondWithRpcPromise('Agents',_0x4e053f[_0x0694('0x15')])[_0x0694('0x1c')](function(_0x3d8e6e){_0x30e183=_0x3d8e6e;return respondWithRpcPromise(_0x0694('0x2b'),_0x4e053f[_0x0694('0x15')],routingClient);})[_0x0694('0x1c')](function(_0x78e849){return _[_0x0694('0x18')]({},_0x78e849,_0x30e183);})[_0x0694('0x1c')](respondWithResult(_0x5f0cd0,null))['catch'](handleError(_0x5f0cd0,null));};exports[_0x0694('0x2c')]=function(_0x537d7d,_0x5befcd){if(_0x537d7d[_0x0694('0x20')]&&_0x537d7d[_0x0694('0x20')]['interaction']&&_0x537d7d[_0x0694('0x2d')]&&_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')]){for(var _0x32e8de in _0x537d7d[_0x0694('0x20')][_0x0694('0x2e')]){if(_0x537d7d[_0x0694('0x20')]['interaction']['hasOwnProperty'](_0x32e8de)){db[_0x0694('0x2f')][_0x0694('0x30')]({'where':{'channel':_0x32e8de,'membername':_0x537d7d['user']['name'],'type':_0x0694('0x31'),'exitAt':null,'uniqueid':_0x537d7d['body']['interaction'][_0x32e8de]&&_0x537d7d[_0x0694('0x20')]['interaction'][_0x32e8de][_0x0694('0x32')]?{'$notIn':_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de]}:{'$ne':null}}})[_0x0694('0x1c')](function(_0x2e2a65){var _0x4b6136=moment()[_0x0694('0x33')](_0x0694('0x34'));for(var _0xbce758=0x0,_0x41e84b=_0x2e2a65[_0x0694('0x32')];_0xbce758<_0x41e84b;_0xbce758+=0x1){_0x2e2a65[_0xbce758][_0x0694('0x35')]({'exitAt':_0x4b6136});}});for(var _0x9d70e7=0x0;_0x9d70e7<_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de]['length'];_0x9d70e7+=0x1){db[_0x0694('0x2f')][_0x0694('0x36')]({'where':{'channel':_0x32e8de,'membername':_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')],'type':'INTERACTION','uniqueid':_0x537d7d['body'][_0x0694('0x2e')][_0x32e8de][_0x9d70e7],'exitAt':null},'defaults':{'channel':_0x32e8de,'membername':_0x537d7d['user'][_0x0694('0xf')],'interface':_[_0x0694('0x11')](_0x537d7d[_0x0694('0x2d')]['interface'])?util[_0x0694('0x33')](_0x0694('0x37'),_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')]):_0x537d7d[_0x0694('0x2d')]['interface'],'type':_0x0694('0x31'),'enterAt':moment()[_0x0694('0x33')](_0x0694('0x34')),'role':_0x0694('0x38'),'internal':_0x537d7d[_0x0694('0x2d')][_0x0694('0x39')],'uniqueid':_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de][_0x9d70e7]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x537d7d[_0x0694('0x19')]['id'],'capacity':_0x537d7d[_0x0694('0x20')]['capacity']},routingClient)[_0x0694('0x1c')](respondWithResult(_0x5befcd,null))[_0x0694('0x16')](handleError(_0x5befcd,null));};exports[_0x0694('0x3a')]=function(_0x5e445e,_0x5857c0){return respondWithRpcPromise(_0x0694('0x3b'),_0x5e445e[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x5857c0,null))[_0x0694('0x16')](handleError(_0x5857c0,null));};exports[_0x0694('0x3c')]=function(_0x2c3628,_0x8cb397){return respondWithRpcPromise(_0x0694('0x3d'),_0x2c3628[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x8cb397,null))[_0x0694('0x16')](handleError(_0x8cb397,null));};exports[_0x0694('0x3e')]=function(_0x307786,_0x2af378){return respondWithRpcPromise('Campaigns',_0x307786[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x2af378,null))[_0x0694('0x16')](handleError(_0x2af378,null));};exports['chatQueues']=function(_0x34e254,_0x250f30){return respondWithRpcPromise(_0x0694('0x3f'),_0x34e254[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x250f30,null))[_0x0694('0x16')](handleError(_0x250f30,null));};exports[_0x0694('0x40')]=function(_0x3169ea,_0x1e123e){return respondWithRpcPromise(_0x0694('0x3f'),_0x3169ea[_0x0694('0x15')],routingClient)['then'](findById(_0x3169ea[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x1e123e,null))[_0x0694('0x16')](handleError(_0x1e123e,null));};exports['mailQueues']=function(_0x5d1fda,_0x5aaf50){return respondWithRpcPromise(_0x0694('0x41'),_0x5d1fda[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x5aaf50,null))[_0x0694('0x16')](handleError(_0x5aaf50,null));};exports[_0x0694('0x42')]=function(_0xf20409,_0x4c7bff){return respondWithRpcPromise('MailQueues',_0xf20409[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0xf20409[_0x0694('0x19')]['id']))['then'](respondWithResult(_0x4c7bff,null))[_0x0694('0x16')](handleError(_0x4c7bff,null));};exports[_0x0694('0x43')]=function(_0x320ae3,_0x40a45f){return respondWithRpcPromise(_0x0694('0x44'),_0x320ae3[_0x0694('0x15')],mailClient)['then'](respondWithResult(_0x40a45f,null))[_0x0694('0x16')](handleError(_0x40a45f,null));};exports[_0x0694('0x45')]=function(_0x4e17df,_0x4b33b1){return respondWithRpcPromise('OpenchannelQueues',_0x4e17df['query'],routingClient)[_0x0694('0x1c')](respondWithResult(_0x4b33b1,null))['catch'](handleError(_0x4b33b1,null));};exports[_0x0694('0x46')]=function(_0x1dfb58,_0x5b3b69){return respondWithRpcPromise('OpenchannelQueues',_0x1dfb58[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0x1dfb58[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x5b3b69,null))[_0x0694('0x16')](handleError(_0x5b3b69,null));};exports[_0x0694('0x47')]=function(_0x2e2380,_0x5c310d){return respondWithRpcPromise(_0x0694('0x48'),_0x2e2380[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x5c310d,null))[_0x0694('0x16')](handleError(_0x5c310d,null));};exports['showSmsQueues']=function(_0x39481a,_0x27a8bf){return respondWithRpcPromise(_0x0694('0x48'),_0x39481a[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0x39481a[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x27a8bf,null))['catch'](handleError(_0x27a8bf,null));};exports['whatsappQueues']=function(_0x20975b,_0x2f57ec){return respondWithRpcPromise('WhatsappQueues',_0x20975b[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x2f57ec,null))[_0x0694('0x16')](handleError(_0x2f57ec,null));};exports[_0x0694('0x49')]=function(_0x395bd7,_0x33b3aa){return respondWithRpcPromise('WhatsappQueues',_0x395bd7[_0x0694('0x15')],routingClient)['then'](findById(_0x395bd7[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x33b3aa,null))[_0x0694('0x16')](handleError(_0x33b3aa,null));};exports['faxQueues']=function(_0x210ae8,_0x416b30){return respondWithRpcPromise('FaxQueues',_0x210ae8[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x416b30,null))[_0x0694('0x16')](handleError(_0x416b30,null));};exports['showFaxQueues']=function(_0x355148,_0x15883d){return respondWithRpcPromise(_0x0694('0x4a'),_0x355148['query'],routingClient)[_0x0694('0x1c')](findById(_0x355148[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x15883d,null))[_0x0694('0x16')](handleError(_0x15883d,null));};exports[_0x0694('0x4b')]=function(_0x9c1272,_0x3ff258){return respondWithRpcPromise('FaxAccounts',_0x9c1272[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x3ff258,null))[_0x0694('0x16')](handleError(_0x3ff258,null));};exports[_0x0694('0x4c')]=function(_0x2b50e9,_0x565d4d){return respondWithRpcPromise(_0x0694('0x4d'),_0x2b50e9[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x565d4d,null))['catch'](handleError(_0x565d4d,null));};exports[_0x0694('0x4e')]=function(_0x21d5f6,_0x32282e){return respondWithRpcPromise(_0x0694('0x4f'),_0x21d5f6[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x32282e,null))['catch'](handleError(_0x32282e,null));};exports[_0x0694('0x50')]=function(_0x456b8d,_0x1f728b){return respondWithRpcPromise(_0x0694('0x51'),_0x456b8d[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x1f728b,null))[_0x0694('0x16')](handleError(_0x1f728b,null));};exports[_0x0694('0x52')]=function(_0x444355,_0x597955){return respondWithRpcPromise(_0x0694('0x51'),_0x444355[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](function(_0x257fd2){if(_0x444355[_0x0694('0x15')][_0x0694('0x53')]!==undefined){var _0x79d00e=_(_0x257fd2[_0x0694('0x54')])[_0x0694('0x55')]([_0x444355[_0x0694('0x15')]['type'],_0x444355[_0x0694('0x19')]['id']])[_0x0694('0x56')](_0x0694('0x57'))[_0x0694('0x58')]()[_0x0694('0x59')]();return _0x257fd2[_0x0694('0x54')]['filter'](function(_0x199c47){return _0x79d00e[_0x0694('0x5a')](_0x199c47[_0x0694('0x57')])>-0x1;});}else{return _0x257fd2[_0x0694('0x54')][_0x0694('0x55')](function(_0x57cbb1){return _0x57cbb1['queue_id']===parseInt(_0x444355[_0x0694('0x19')]['id']);});}})[_0x0694('0x1c')](respondWithResult(_0x597955,null))[_0x0694('0x16')](handleError(_0x597955,null));};exports[_0x0694('0x5b')]=function(_0x4ed7c4,_0x48f923){return respondWithRpcPromise(_0x0694('0x5c'),_0x4ed7c4[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x48f923,null))[_0x0694('0x16')](handleError(_0x48f923,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x13d8a3,_0x39a561){return respondWithRpcPromise(_0x0694('0x5d'),_0x13d8a3[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x39a561,null))[_0x0694('0x16')](handleError(_0x39a561,null));};exports[_0x0694('0x5e')]=function(_0x5c53bd,_0x31d14c){return respondWithRpcPromise(_0x0694('0x5f'),_0x5c53bd[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x31d14c,null))['catch'](handleError(_0x31d14c,null));};exports[_0x0694('0x60')]=function(_0x413ed7){return function(_0x34cdf8,_0x1c12f4){var _0x36dd1e,_0x461a6d;var _0x120001=_[_0x0694('0x61')](_0x413ed7);var _0x3f43ce=_0x413ed7===_0x0694('0x62')?_0x0694('0x63'):'Account';return db[_0x120001+_0x0694('0x64')][_0x0694('0x65')]({'raw':!![],'where':{'id':_0x34cdf8[_0x0694('0x19')]['id']}})[_0x0694('0x1c')](function(_0x3b50f3){if(_['isNil'](_0x3b50f3)){throw new Error(_0x120001+_0x0694('0x66'));}_0x36dd1e=_0x3b50f3;return db[_0x120001+_0x0694('0x67')]['findOne']({'where':{'id':_0x34cdf8[_0x0694('0x20')][_0x0694('0x68')]},'include':[{'model':db[_0x120001+_0x0694('0x69')],'as':_0x0694('0x69')},{'model':db[_0x120001+_0x3f43ce],'as':_0x0694('0x6a')}]});})['then'](function(_0x4f8d66){if(_[_0x0694('0x11')](_0x4f8d66)){throw new Error(_0x120001+'\x20Message\x20not\x20found');}_0x461a6d=_0x4f8d66;return _0x4f8d66[_0x0694('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0694('0x1c')](function(){var _0x128640={'uniqueid':_0x413ed7+'.'+_0x461a6d['id']+'.'+_0x461a6d['Interaction']['id'],'FromUserId':_0x34cdf8[_0x0694('0x2d')]['id'],'type':_0x0694('0x6c')};_0x128640[_0x120001+_0x0694('0x6d')]=_0x461a6d['id'];_0x128640[_0x120001+'InteractionId']=_0x461a6d['Interaction']['id'];_0x128640[_0x0694('0x6e')+_0x120001+_0x3f43ce+'Id']=_0x461a6d['Account']['id'];_0x128640['To'+_0x120001+_0x0694('0x6f')]=_0x36dd1e['id'];return db[_0x120001+_0x0694('0x70')][_0x0694('0x71')](_0x128640);})[_0x0694('0x1c')](function(){return respondWithRpcPromise('Start',{'channel':_0x413ed7,'interaction':_0x461a6d['Interaction'],'message':_0x461a6d,'account':_0x461a6d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0694('0x6c'),'appdata':_0x36dd1e[_0x0694('0xf')]+','+(_0x461a6d[_0x0694('0x6a')][_0x0694('0x72')]||0x12c),'interval':_0x0694('0x73')}]},routingClient);})[_0x0694('0x1c')](respondWithResult(_0x1c12f4,null))['catch'](handleError(_0x1c12f4,null));};};exports['agentNotify']=function(_0x25245b,_0x1969dc){var _0x421b4e,_0x5d5733;if(_['isNil'](_0x25245b[_0x0694('0x20')]['channel'])){throw new Error(_0x0694('0x74'));}var _0x21a424=_0x25245b['body'][_0x0694('0x75')];var _0x448c72=_[_0x0694('0x61')](_0x21a424);var _0x5110b2=_0x21a424===_0x0694('0x62')?_0x0694('0x63'):_0x0694('0x6a');return db[_0x0694('0x76')]['findOne']({'raw':!![],'where':{'id':_0x25245b[_0x0694('0x19')]['id'],'role':'agent'}})[_0x0694('0x1c')](function(_0x111022){if(_[_0x0694('0x11')](_0x111022)){throw new Error(_0x0694('0x77'));}_0x421b4e=_0x111022;return db[_0x448c72+_0x0694('0x67')]['findOne']({'where':{'id':_0x25245b['body'][_0x0694('0x68')]},'include':[{'model':db[_0x448c72+'Interaction'],'as':'Interaction'},{'model':db[_0x448c72+_0x5110b2],'as':'Account'}]});})[_0x0694('0x1c')](function(_0x3f13a8){if(_[_0x0694('0x11')](_0x3f13a8)){throw new Error(_0x448c72+'\x20Message\x20not\x20found');}_0x5d5733=_0x3f13a8;return _0x3f13a8[_0x0694('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x41d8a0={'uniqueid':_0x21a424+'.'+_0x5d5733['id']+'.'+_0x5d5733[_0x0694('0x69')]['id'],'FromUserId':_0x25245b[_0x0694('0x2d')]['id'],'type':'agent','ToUserId':_0x421b4e['id']};_0x41d8a0[_0x448c72+'MessageId']=_0x5d5733['id'];_0x41d8a0[_0x448c72+_0x0694('0x78')]=_0x5d5733['Interaction']['id'];_0x41d8a0[_0x0694('0x6e')+_0x448c72+_0x5110b2+'Id']=_0x5d5733['Account']['id'];return db[_0x448c72+_0x0694('0x70')][_0x0694('0x71')](_0x41d8a0);})[_0x0694('0x1c')](function(){return respondWithRpcPromise('Start',{'channel':_0x21a424,'interaction':_0x5d5733[_0x0694('0x69')],'message':_0x5d5733,'account':_0x5d5733['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x421b4e[_0x0694('0xf')]+','+(_0x5d5733[_0x0694('0x6a')][_0x0694('0x79')]||0x12c),'interval':_0x0694('0x73')}]},routingClient);})[_0x0694('0x1c')](respondWithResult(_0x1969dc,null))[_0x0694('0x16')](handleError(_0x1969dc,null));}; \ No newline at end of file +var _0xc9fe=['voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','capacity','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','TransferReport','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','capitalize','agent','Agent\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params'];(function(_0x19ea25,_0xff8d8e){var _0x4af914=function(_0x4e6f66){while(--_0x4e6f66){_0x19ea25['push'](_0x19ea25['shift']());}};_0x4af914(++_0xff8d8e);}(_0xc9fe,0x1cb));var _0xec9f=function(_0x21cbe4,_0x42de8f){_0x21cbe4=_0x21cbe4-0x0;var _0xb5d191=_0xc9fe[_0x21cbe4];return _0xb5d191;};'use strict';var BPromise=require(_0xec9f('0x0'));var moment=require(_0xec9f('0x1'));var _=require(_0xec9f('0x2'));var util=require('util');var db=require(_0xec9f('0x3'))['db'];var logger=require(_0xec9f('0x4'))(_0xec9f('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xec9f('0x6')]({'port':0x232a});var mailClient=jayson[_0xec9f('0x7')][_0xec9f('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xec9f('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x20e7d6,_0x1c3bd5,_0x2bd03f){return new BPromise(function(_0x415431,_0x4e199a){var _0x5c8df8=_0x2bd03f?_0x2bd03f:amiClient;return _0x5c8df8[_0xec9f('0x8')](_0x20e7d6,_0x1c3bd5)[_0xec9f('0x9')](function(_0x190e93){if(_0x190e93[_0xec9f('0xa')]){if(_0x190e93[_0xec9f('0xa')][_0xec9f('0xb')]===0x1f4){return _0x4e199a(_0x190e93[_0xec9f('0xa')][_0xec9f('0xc')]);}return _0x415431(_0x190e93['error'][_0xec9f('0xc')]);}else{_0x415431(_0x190e93[_0xec9f('0xd')]);}})[_0xec9f('0xe')](function(_0x4b77e6){_0x4e199a(_0x4b77e6);});});}function respondWithResult(_0xd86d22,_0x1afff8){_0x1afff8=_0x1afff8||0xc8;return function(_0x1b77d6){if(_0x1b77d6){return _0xd86d22['status'](_0x1afff8)[_0xec9f('0xf')](_0x1b77d6);}return _0xd86d22[_0xec9f('0x10')](0x194);};}function handleError(_0x1c3bf8,_0xe11359){_0xe11359=_0xe11359||0x1f4;return function(_0x234e0c){logger['error'](_0x234e0c[_0xec9f('0x11')]);if(_0x234e0c[_0xec9f('0x12')]){delete _0x234e0c[_0xec9f('0x12')];}_0x1c3bf8[_0xec9f('0x13')](_0xe11359)[_0xec9f('0x14')](_0x234e0c);};}function findById(_0x309b5b){return function(_0x4fdab6){if(!_[_0xec9f('0x15')](_0x309b5b)&&!_[_0xec9f('0x15')](_0x4fdab6)&&!_[_0xec9f('0x15')](_0x4fdab6[_0xec9f('0x16')])){return _['find'](_0x4fdab6['rows'],function(_0x37bb2b){return _0x37bb2b['id']==_0x309b5b;});}return null;};}exports['voiceChannels']=function(_0x3d573e,_0x44af27){return respondWithRpcPromise(_0xec9f('0x17'),_0x3d573e[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x44af27,null))[_0xec9f('0xe')](handleError(_0x44af27,null));};exports[_0xec9f('0x19')]=function(_0x579d6e,_0x24c895){return respondWithRpcPromise(_0xec9f('0x1a'),_[_0xec9f('0x1b')](_0x579d6e['query'],_0x579d6e[_0xec9f('0x1c')]))[_0xec9f('0x9')](respondWithResult(_0x24c895,null))[_0xec9f('0xe')](handleError(_0x24c895,null));};exports[_0xec9f('0x1d')]=function(_0x1dafe2,_0x502359){return respondWithRpcPromise(_0xec9f('0x1e'),_[_0xec9f('0x1b')](_0x1dafe2[_0xec9f('0x18')],_0x1dafe2['params']))[_0xec9f('0x9')](respondWithResult(_0x502359,null))['catch'](handleError(_0x502359,null));};exports['voiceQueues']=function(_0x4b57aa,_0x4e7362){return respondWithRpcPromise(_0xec9f('0x1f'),_0x4b57aa[_0xec9f('0x18')])['then'](respondWithResult(_0x4e7362,null))['catch'](handleError(_0x4e7362,null));};exports[_0xec9f('0x20')]=function(_0x10af64,_0x5934cc){return respondWithRpcPromise('VoiceQueues',_0x10af64[_0xec9f('0x18')])[_0xec9f('0x9')](findById(_0x10af64[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x5934cc,null))[_0xec9f('0xe')](handleError(_0x5934cc,null));};exports[_0xec9f('0x21')]=function(_0x322d86,_0x3912f1){return respondWithRpcPromise(_0xec9f('0x22'),_['merge'](_0x322d86[_0xec9f('0x23')],_0x322d86[_0xec9f('0x1c')]))['then'](respondWithResult(_0x3912f1,null))[_0xec9f('0xe')](handleError(_0x3912f1,null));};exports[_0xec9f('0x24')]=function(_0x351d5a,_0x7946e8){return respondWithRpcPromise(_0xec9f('0x25'),_[_0xec9f('0x1b')](_0x351d5a['query'],_0x351d5a['params']))[_0xec9f('0x9')](respondWithResult(_0x7946e8,null))[_0xec9f('0xe')](handleError(_0x7946e8,null));};exports[_0xec9f('0x26')]=function(_0x585826,_0x1fe7cc){return respondWithRpcPromise('VoiceQueuesChannels',_0x585826[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x1fe7cc,null))[_0xec9f('0xe')](handleError(_0x1fe7cc,null));};exports['voiceQueuesChannel']=function(_0xd2df48,_0x256dd3){return respondWithRpcPromise(_0xec9f('0x27'),_['merge'](_0xd2df48[_0xec9f('0x18')],_0xd2df48[_0xec9f('0x1c')]))[_0xec9f('0x9')](respondWithResult(_0x256dd3,null))[_0xec9f('0xe')](handleError(_0x256dd3,null));};exports[_0xec9f('0x28')]=function(_0x19f126,_0xcad580){return respondWithRpcPromise(_0xec9f('0x29'),_['merge'](_0x19f126[_0xec9f('0x18')],_0x19f126['params']))['then'](respondWithResult(_0xcad580,null))[_0xec9f('0xe')](handleError(_0xcad580,null));};exports[_0xec9f('0x2a')]=function(_0x245759,_0x4c958a){return respondWithRpcPromise(_0xec9f('0x2b'),_[_0xec9f('0x1b')](_0x245759['query'],_0x245759[_0xec9f('0x1c')]))['then'](respondWithResult(_0x4c958a,null))[_0xec9f('0xe')](handleError(_0x4c958a,null));};exports['outbound']=function(_0x4d27ca,_0x1eddf4){return respondWithRpcPromise(_0xec9f('0x2c'),_0x4d27ca[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x1eddf4,null))[_0xec9f('0xe')](handleError(_0x1eddf4,null));};exports[_0xec9f('0x2d')]=function(_0x58a4c3,_0x420851){return respondWithRpcPromise(_0xec9f('0x2e'),_0x58a4c3['query'])[_0xec9f('0x9')](respondWithResult(_0x420851,null))[_0xec9f('0xe')](handleError(_0x420851,null));};exports[_0xec9f('0x2f')]=function(_0x3caa22,_0x2736b5){var _0x18be74;return respondWithRpcPromise(_0xec9f('0x30'),_0x3caa22[_0xec9f('0x18')])['then'](function(_0x33cf41){_0x18be74=_0x33cf41;return respondWithRpcPromise(_0xec9f('0x30'),_0x3caa22['query'],routingClient);})['then'](function(_0x124815){return _[_0xec9f('0x1b')]({},_0x124815,_0x18be74);})['then'](respondWithResult(_0x2736b5,null))[_0xec9f('0xe')](handleError(_0x2736b5,null));};exports[_0xec9f('0x31')]=function(_0x48a133,_0x2c317c){if(_0x48a133['body']&&_0x48a133[_0xec9f('0x23')]['interaction']&&_0x48a133[_0xec9f('0x32')]&&_0x48a133[_0xec9f('0x32')]['name']){for(var _0x3b4aa0 in _0x48a133['body'][_0xec9f('0x33')]){if(_0x48a133[_0xec9f('0x23')][_0xec9f('0x33')][_0xec9f('0x34')](_0x3b4aa0)){db[_0xec9f('0x35')]['findAll']({'where':{'channel':_0x3b4aa0,'membername':_0x48a133['user'][_0xec9f('0x12')],'type':_0xec9f('0x36'),'exitAt':null,'uniqueid':_0x48a133['body'][_0xec9f('0x33')][_0x3b4aa0]&&_0x48a133[_0xec9f('0x23')]['interaction'][_0x3b4aa0][_0xec9f('0x37')]?{'$notIn':_0x48a133[_0xec9f('0x23')][_0xec9f('0x33')][_0x3b4aa0]}:{'$ne':null}}})[_0xec9f('0x9')](function(_0x451e03){var _0x351859=moment()[_0xec9f('0x38')](_0xec9f('0x39'));for(var _0x448c28=0x0,_0x21aca8=_0x451e03[_0xec9f('0x37')];_0x448c28<_0x21aca8;_0x448c28+=0x1){_0x451e03[_0x448c28][_0xec9f('0x3a')]({'exitAt':_0x351859});}});for(var _0x37c7b1=0x0;_0x37c7b1<_0x48a133[_0xec9f('0x23')]['interaction'][_0x3b4aa0][_0xec9f('0x37')];_0x37c7b1+=0x1){db[_0xec9f('0x35')][_0xec9f('0x3b')]({'where':{'channel':_0x3b4aa0,'membername':_0x48a133[_0xec9f('0x32')][_0xec9f('0x12')],'type':_0xec9f('0x36'),'uniqueid':_0x48a133[_0xec9f('0x23')][_0xec9f('0x33')][_0x3b4aa0][_0x37c7b1],'exitAt':null},'defaults':{'channel':_0x3b4aa0,'membername':_0x48a133[_0xec9f('0x32')][_0xec9f('0x12')],'interface':_[_0xec9f('0x15')](_0x48a133[_0xec9f('0x32')][_0xec9f('0x3c')])?util[_0xec9f('0x38')](_0xec9f('0x3d'),_0x48a133[_0xec9f('0x32')]['name']):_0x48a133['user'][_0xec9f('0x3c')],'type':_0xec9f('0x36'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x48a133['user']['internal'],'uniqueid':_0x48a133[_0xec9f('0x23')][_0xec9f('0x33')][_0x3b4aa0][_0x37c7b1]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x48a133[_0xec9f('0x1c')]['id'],'capacity':_0x48a133[_0xec9f('0x23')][_0xec9f('0x3e')]},routingClient)[_0xec9f('0x9')](respondWithResult(_0x2c317c,null))[_0xec9f('0xe')](handleError(_0x2c317c,null));};exports['telephones']=function(_0x293c63,_0x3957e9){return respondWithRpcPromise(_0xec9f('0x3f'),_0x293c63[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x3957e9,null))[_0xec9f('0xe')](handleError(_0x3957e9,null));};exports[_0xec9f('0x40')]=function(_0x380255,_0x32b130){return respondWithRpcPromise(_0xec9f('0x41'),_0x380255[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x32b130,null))[_0xec9f('0xe')](handleError(_0x32b130,null));};exports['campaigns']=function(_0x2aa35b,_0x5708af){return respondWithRpcPromise(_0xec9f('0x42'),_0x2aa35b[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x5708af,null))[_0xec9f('0xe')](handleError(_0x5708af,null));};exports[_0xec9f('0x43')]=function(_0x15352,_0x13fe6a){return respondWithRpcPromise(_0xec9f('0x44'),_0x15352[_0xec9f('0x18')],routingClient)['then'](respondWithResult(_0x13fe6a,null))[_0xec9f('0xe')](handleError(_0x13fe6a,null));};exports[_0xec9f('0x45')]=function(_0x1af6d4,_0x51a6e2){return respondWithRpcPromise(_0xec9f('0x44'),_0x1af6d4[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](findById(_0x1af6d4[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x51a6e2,null))[_0xec9f('0xe')](handleError(_0x51a6e2,null));};exports[_0xec9f('0x46')]=function(_0x505f29,_0x8199e9){return respondWithRpcPromise(_0xec9f('0x47'),_0x505f29[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](respondWithResult(_0x8199e9,null))['catch'](handleError(_0x8199e9,null));};exports[_0xec9f('0x48')]=function(_0x3ae23c,_0x297dc4){return respondWithRpcPromise(_0xec9f('0x47'),_0x3ae23c['query'],routingClient)[_0xec9f('0x9')](findById(_0x3ae23c[_0xec9f('0x1c')]['id']))['then'](respondWithResult(_0x297dc4,null))[_0xec9f('0xe')](handleError(_0x297dc4,null));};exports[_0xec9f('0x49')]=function(_0x21b20c,_0x4a0856){return respondWithRpcPromise(_0xec9f('0x4a'),_0x21b20c[_0xec9f('0x18')],mailClient)[_0xec9f('0x9')](respondWithResult(_0x4a0856,null))['catch'](handleError(_0x4a0856,null));};exports[_0xec9f('0x4b')]=function(_0xead4bf,_0x6f7fae){return respondWithRpcPromise(_0xec9f('0x4c'),_0xead4bf['query'],routingClient)['then'](respondWithResult(_0x6f7fae,null))[_0xec9f('0xe')](handleError(_0x6f7fae,null));};exports[_0xec9f('0x4d')]=function(_0x50a87d,_0x2498df){return respondWithRpcPromise(_0xec9f('0x4c'),_0x50a87d[_0xec9f('0x18')],routingClient)['then'](findById(_0x50a87d[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x2498df,null))[_0xec9f('0xe')](handleError(_0x2498df,null));};exports[_0xec9f('0x4e')]=function(_0x316fb6,_0x2e6461){return respondWithRpcPromise(_0xec9f('0x4f'),_0x316fb6[_0xec9f('0x18')],routingClient)['then'](respondWithResult(_0x2e6461,null))['catch'](handleError(_0x2e6461,null));};exports['showSmsQueues']=function(_0x3ae159,_0x181ac2){return respondWithRpcPromise(_0xec9f('0x4f'),_0x3ae159[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](findById(_0x3ae159[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x181ac2,null))['catch'](handleError(_0x181ac2,null));};exports[_0xec9f('0x50')]=function(_0x2933b9,_0x3cb800){return respondWithRpcPromise(_0xec9f('0x51'),_0x2933b9['query'],routingClient)['then'](respondWithResult(_0x3cb800,null))[_0xec9f('0xe')](handleError(_0x3cb800,null));};exports[_0xec9f('0x52')]=function(_0x210722,_0x58184d){return respondWithRpcPromise(_0xec9f('0x51'),_0x210722[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](findById(_0x210722[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x58184d,null))[_0xec9f('0xe')](handleError(_0x58184d,null));};exports['faxQueues']=function(_0x172448,_0xe08a8c){return respondWithRpcPromise(_0xec9f('0x53'),_0x172448[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](respondWithResult(_0xe08a8c,null))[_0xec9f('0xe')](handleError(_0xe08a8c,null));};exports[_0xec9f('0x54')]=function(_0x4eb7bf,_0x175e64){return respondWithRpcPromise('FaxQueues',_0x4eb7bf[_0xec9f('0x18')],routingClient)['then'](findById(_0x4eb7bf[_0xec9f('0x1c')]['id']))[_0xec9f('0x9')](respondWithResult(_0x175e64,null))['catch'](handleError(_0x175e64,null));};exports[_0xec9f('0x55')]=function(_0x30065e,_0x1f9787){return respondWithRpcPromise('FaxAccounts',_0x30065e[_0xec9f('0x18')])[_0xec9f('0x9')](respondWithResult(_0x1f9787,null))[_0xec9f('0xe')](handleError(_0x1f9787,null));};exports[_0xec9f('0x56')]=function(_0x115261,_0x1e2638){return respondWithRpcPromise(_0xec9f('0x57'),_0x115261[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](respondWithResult(_0x1e2638,null))['catch'](handleError(_0x1e2638,null));};exports['mailQueuesWaitingInteractions']=function(_0x5d6694,_0x50a6da){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5d6694['query'],routingClient)[_0xec9f('0x9')](respondWithResult(_0x50a6da,null))['catch'](handleError(_0x50a6da,null));};exports[_0xec9f('0x58')]=function(_0x3f795d,_0x10d004){return respondWithRpcPromise(_0xec9f('0x59'),_0x3f795d[_0xec9f('0x18')],routingClient)['then'](respondWithResult(_0x10d004,null))[_0xec9f('0xe')](handleError(_0x10d004,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0xc524bd,_0x2e5918){return respondWithRpcPromise(_0xec9f('0x59'),_0xc524bd[_0xec9f('0x18')],routingClient)['then'](function(_0x227dc0){if(_0xc524bd[_0xec9f('0x18')][_0xec9f('0x5a')]!==undefined){var _0x5410cb=_(_0x227dc0[_0xec9f('0x16')])[_0xec9f('0x5b')]([_0xc524bd[_0xec9f('0x18')][_0xec9f('0x5a')],_0xc524bd[_0xec9f('0x1c')]['id']])['map'](_0xec9f('0x5c'))['uniq']()['value']();return _0x227dc0['rows'][_0xec9f('0x5b')](function(_0x6dbdeb){return _0x5410cb[_0xec9f('0x5d')](_0x6dbdeb[_0xec9f('0x5c')])>-0x1;});}else{return _0x227dc0['rows'][_0xec9f('0x5b')](function(_0x1a2695){return _0x1a2695['queue_id']===parseInt(_0xc524bd[_0xec9f('0x1c')]['id']);});}})['then'](respondWithResult(_0x2e5918,null))['catch'](handleError(_0x2e5918,null));};exports[_0xec9f('0x5e')]=function(_0x1777ee,_0x1da7f8){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1777ee[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](respondWithResult(_0x1da7f8,null))['catch'](handleError(_0x1da7f8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x232f7c,_0xa6d341){return respondWithRpcPromise(_0xec9f('0x5f'),_0x232f7c['query'],routingClient)['then'](respondWithResult(_0xa6d341,null))['catch'](handleError(_0xa6d341,null));};exports['faxQueuesWaitingInteractions']=function(_0x5a0fb7,_0xdb0b19){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5a0fb7[_0xec9f('0x18')],routingClient)[_0xec9f('0x9')](respondWithResult(_0xdb0b19,null))[_0xec9f('0xe')](handleError(_0xdb0b19,null));};exports[_0xec9f('0x60')]=function(_0x52898d){return function(_0x9aeada,_0x5294ef){var _0xe282a9,_0x1f3248;var _0x3796e8=_['capitalize'](_0x52898d);var _0x27133f=_0x52898d==='chat'?_0xec9f('0x61'):_0xec9f('0x62');return db[_0x3796e8+_0xec9f('0x63')]['findOne']({'raw':!![],'where':{'id':_0x9aeada[_0xec9f('0x1c')]['id']}})[_0xec9f('0x9')](function(_0x5cb42d){if(_[_0xec9f('0x15')](_0x5cb42d)){throw new Error(_0x3796e8+_0xec9f('0x64'));}_0xe282a9=_0x5cb42d;return db[_0x3796e8+_0xec9f('0x65')][_0xec9f('0x66')]({'where':{'id':_0x9aeada[_0xec9f('0x23')][_0xec9f('0x67')]},'include':[{'model':db[_0x3796e8+_0xec9f('0x68')],'as':_0xec9f('0x68')},{'model':db[_0x3796e8+_0x27133f],'as':_0xec9f('0x62')}]});})['then'](function(_0x4f2595){if(_[_0xec9f('0x15')](_0x4f2595)){throw new Error(_0x3796e8+_0xec9f('0x69'));}_0x1f3248=_0x4f2595;return _0x4f2595[_0xec9f('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xec9f('0x9')](function(){var _0x7d260f={'uniqueid':_0x52898d+'.'+_0x1f3248['id']+'.'+_0x1f3248[_0xec9f('0x68')]['id'],'FromUserId':_0x9aeada[_0xec9f('0x32')]['id'],'type':_0xec9f('0x6b')};_0x7d260f[_0x3796e8+_0xec9f('0x6c')]=_0x1f3248['id'];_0x7d260f[_0x3796e8+_0xec9f('0x6d')]=_0x1f3248[_0xec9f('0x68')]['id'];_0x7d260f['From'+_0x3796e8+_0x27133f+'Id']=_0x1f3248['Account']['id'];_0x7d260f['To'+_0x3796e8+'QueueId']=_0xe282a9['id'];return db[_0x3796e8+_0xec9f('0x6e')]['create'](_0x7d260f);})[_0xec9f('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x52898d,'interaction':_0x1f3248[_0xec9f('0x68')],'message':_0x1f3248,'account':_0x1f3248['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xec9f('0x6b'),'appdata':_0xe282a9[_0xec9f('0x12')]+','+(_0x1f3248[_0xec9f('0x62')][_0xec9f('0x6f')]||0x12c),'interval':_0xec9f('0x70')}]},routingClient);})[_0xec9f('0x9')](respondWithResult(_0x5294ef,null))[_0xec9f('0xe')](handleError(_0x5294ef,null));};};exports['agentNotify']=function(_0xeeddc8,_0x57741b){var _0x59b9a5,_0xb7f81f;if(_[_0xec9f('0x15')](_0xeeddc8[_0xec9f('0x23')][_0xec9f('0x71')])){throw new Error(_0xec9f('0x72'));}var _0x266453=_0xeeddc8[_0xec9f('0x23')][_0xec9f('0x71')];var _0x245ec0=_[_0xec9f('0x73')](_0x266453);var _0x555a8=_0x266453==='chat'?'Website':_0xec9f('0x62');return db['User']['findOne']({'raw':!![],'where':{'id':_0xeeddc8[_0xec9f('0x1c')]['id'],'role':_0xec9f('0x74')}})[_0xec9f('0x9')](function(_0x45c4a4){if(_[_0xec9f('0x15')](_0x45c4a4)){throw new Error(_0xec9f('0x75'));}_0x59b9a5=_0x45c4a4;return db[_0x245ec0+_0xec9f('0x65')][_0xec9f('0x66')]({'where':{'id':_0xeeddc8['body']['messageId']},'include':[{'model':db[_0x245ec0+'Interaction'],'as':_0xec9f('0x68')},{'model':db[_0x245ec0+_0x555a8],'as':'Account'}]});})[_0xec9f('0x9')](function(_0x5b6fc3){if(_[_0xec9f('0x15')](_0x5b6fc3)){throw new Error(_0x245ec0+_0xec9f('0x69'));}_0xb7f81f=_0x5b6fc3;return _0x5b6fc3[_0xec9f('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xec9f('0x9')](function(){var _0x5058c1={'uniqueid':_0x266453+'.'+_0xb7f81f['id']+'.'+_0xb7f81f[_0xec9f('0x68')]['id'],'FromUserId':_0xeeddc8[_0xec9f('0x32')]['id'],'type':'agent','ToUserId':_0x59b9a5['id']};_0x5058c1[_0x245ec0+_0xec9f('0x6c')]=_0xb7f81f['id'];_0x5058c1[_0x245ec0+_0xec9f('0x6d')]=_0xb7f81f[_0xec9f('0x68')]['id'];_0x5058c1[_0xec9f('0x76')+_0x245ec0+_0x555a8+'Id']=_0xb7f81f[_0xec9f('0x62')]['id'];return db[_0x245ec0+_0xec9f('0x6e')][_0xec9f('0x77')](_0x5058c1);})[_0xec9f('0x9')](function(){return respondWithRpcPromise(_0xec9f('0x78'),{'channel':_0x266453,'interaction':_0xb7f81f['Interaction'],'message':_0xb7f81f,'account':_0xb7f81f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xec9f('0x74'),'appdata':_0x59b9a5[_0xec9f('0x12')]+','+(_0xb7f81f['Account'][_0xec9f('0x79')]||0x12c),'interval':_0xec9f('0x70')}]},routingClient);})[_0xec9f('0x9')](respondWithResult(_0x57741b,null))['catch'](handleError(_0x57741b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6ff1876..e188be5 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 _0x688b=['index','/:id','/:id/run','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x688b,0x95));var _0xb688=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x688b[_0x10d34b];return _0x92b0bf;};'use strict';var multer=require(_0xb688('0x0'));var util=require(_0xb688('0x1'));var path=require(_0xb688('0x2'));var timeout=require(_0xb688('0x3'));var express=require('express');var router=express[_0xb688('0x4')]();var fs_extra=require(_0xb688('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb688('0x6'));var config=require(_0xb688('0x7'));var controller=require(_0xb688('0x8'));router[_0xb688('0x9')]('/',auth[_0xb688('0xa')](),controller[_0xb688('0xb')]);router[_0xb688('0x9')](_0xb688('0xc'),auth[_0xb688('0xa')](),controller['show']);router[_0xb688('0x9')](_0xb688('0xd'),auth[_0xb688('0xa')](),controller['run']);router[_0xb688('0xe')]('/',auth[_0xb688('0xa')](),controller[_0xb688('0xf')]);router[_0xb688('0x10')]('/:id',auth[_0xb688('0xa')](),controller[_0xb688('0x11')]);router[_0xb688('0x12')]('/:id',auth[_0xb688('0xa')](),controller[_0xb688('0x13')]);module['exports']=router; \ No newline at end of file +var _0x296f=['/:id','show','/:id/run','run','create','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x296f,0x73));var _0xf296=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x296f[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require(_0xf296('0x0'));var path=require(_0xf296('0x1'));var timeout=require(_0xf296('0x2'));var express=require(_0xf296('0x3'));var router=express[_0xf296('0x4')]();var fs_extra=require(_0xf296('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf296('0x6'));var config=require('../../config/environment');var controller=require(_0xf296('0x7'));router[_0xf296('0x8')]('/',auth[_0xf296('0x9')](),controller[_0xf296('0xa')]);router[_0xf296('0x8')](_0xf296('0xb'),auth[_0xf296('0x9')](),controller[_0xf296('0xc')]);router[_0xf296('0x8')](_0xf296('0xd'),auth[_0xf296('0x9')](),controller[_0xf296('0xe')]);router['post']('/',auth[_0xf296('0x9')](),controller[_0xf296('0xf')]);router[_0xf296('0x10')]('/:id',auth[_0xf296('0x9')](),controller[_0xf296('0x11')]);router['delete']('/:id',auth[_0xf296('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2e98f55..054ea45 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 _0xecff=['DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','default','custom','TEXT','sequelize','STRING','BOOLEAN'];(function(_0x19b773,_0x3de260){var _0x822fcc=function(_0x3e4f38){while(--_0x3e4f38){_0x19b773['push'](_0x19b773['shift']());}};_0x822fcc(++_0x3de260);}(_0xecff,0xc9));var _0xfecf=function(_0xe43203,_0x3747b0){_0xe43203=_0xe43203-0x0;var _0x2eac57=_0xecff[_0xe43203];return _0x2eac57;};'use strict';var Sequelize=require(_0xfecf('0x0'));module['exports']={'name':{'type':Sequelize[_0xfecf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfecf('0x1')]},'active':{'type':Sequelize[_0xfecf('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfecf('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfecf('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfecf('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfecf('0x5')](_0xfecf('0x6'),_0xfecf('0x7'),_0xfecf('0x8'),'weeks',_0xfecf('0x9'),_0xfecf('0xa'),_0xfecf('0xb')),'allowNull':![],'defaultValue':_0xfecf('0x9')},'output':{'type':Sequelize[_0xfecf('0x5')](_0xfecf('0xc'),_0xfecf('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xfecf('0xc')},'type':{'type':Sequelize[_0xfecf('0x5')]('custom',_0xfecf('0xe')),'allowNull':![],'defaultValue':_0xfecf('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xfecf('0x1')]},'cc':{'type':Sequelize[_0xfecf('0x10')]},'bcc':{'type':Sequelize[_0xfecf('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5141=['csv','pdf','xlsx','custom','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','ENUM','years','quarters','months','weeks','days'];(function(_0x1cc795,_0x221381){var _0x216628=function(_0x457693){while(--_0x457693){_0x1cc795['push'](_0x1cc795['shift']());}};_0x216628(++_0x221381);}(_0x5141,0xe6));var _0x1514=function(_0x4e5af6,_0x4a6dfc){_0x4e5af6=_0x4e5af6-0x0;var _0xc2fa84=_0x5141[_0x4e5af6];return _0xc2fa84;};'use strict';var Sequelize=require(_0x1514('0x0'));module['exports']={'name':{'type':Sequelize[_0x1514('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1514('0x1')]},'active':{'type':Sequelize[_0x1514('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1514('0x1')],'allowNull':![],'defaultValue':_0x1514('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1514('0x4')](_0x1514('0x5'),_0x1514('0x6'),_0x1514('0x7'),_0x1514('0x8'),_0x1514('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0x1514('0x9')},'output':{'type':Sequelize[_0x1514('0x4')](_0x1514('0xa'),_0x1514('0xb'),_0x1514('0xc')),'allowNull':![],'defaultValue':_0x1514('0xa')},'type':{'type':Sequelize[_0x1514('0x4')](_0x1514('0xd'),'default'),'allowNull':![],'defaultValue':_0x1514('0xd')},'sendMail':{'type':Sequelize[_0x1514('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1514('0x1')]},'cc':{'type':Sequelize[_0x1514('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f220e8f..a2a9d22 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 _0xa087=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','Schedule','rows','catch','show','params','length','find'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa087,0x156));var _0x7a08=function(_0x2bf1ed,_0x5213e3){_0x2bf1ed=_0x2bf1ed-0x0;var _0x13b3a3=_0xa087[_0x2bf1ed];return _0x13b3a3;};'use strict';var emlformat=require(_0x7a08('0x0'));var rimraf=require(_0x7a08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a08('0x2'));var rp=require(_0x7a08('0x3'));var moment=require(_0x7a08('0x4'));var BPromise=require(_0x7a08('0x5'));var Mustache=require(_0x7a08('0x6'));var util=require('util');var path=require(_0x7a08('0x7'));var sox=require('sox');var csv=require(_0x7a08('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a08('0x9'));var _=require(_0x7a08('0xa'));var squel=require('squel');var crypto=require(_0x7a08('0xb'));var jsforce=require(_0x7a08('0xc'));var deskjs=require(_0x7a08('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a08('0xe'));var Papa=require(_0x7a08('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7a08('0x10'));var as=require(_0x7a08('0x11'));var hardwareService=require(_0x7a08('0x12'));var logger=require(_0x7a08('0x13'))(_0x7a08('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a08('0x15'));var db=require(_0x7a08('0x16'))['db'];function respondWithStatusCode(_0x1d1310,_0x5db8f5){_0x5db8f5=_0x5db8f5||0xcc;return function(_0x116b76){if(_0x116b76){return _0x1d1310[_0x7a08('0x17')](_0x5db8f5);}return _0x1d1310[_0x7a08('0x18')](_0x5db8f5)[_0x7a08('0x19')]();};}function respondWithResult(_0x25dc70,_0x24b908){_0x24b908=_0x24b908||0xc8;return function(_0x1dc8cc){if(_0x1dc8cc){return _0x25dc70['status'](_0x24b908)[_0x7a08('0x1a')](_0x1dc8cc);}};}function respondWithFilteredResult(_0x8ac134,_0x4aac8f){return function(_0x164a4f){if(_0x164a4f){var _0x2c9692=typeof _0x4aac8f[_0x7a08('0x1b')]==='undefined'&&typeof _0x4aac8f[_0x7a08('0x1c')]===_0x7a08('0x1d');var _0x2ad0c8=_0x164a4f['count'];var _0x5bf784=_0x2c9692?0x0:_0x4aac8f[_0x7a08('0x1b')];var _0x16e62d=_0x2c9692?_0x164a4f['count']:_0x4aac8f[_0x7a08('0x1b')]+_0x4aac8f[_0x7a08('0x1c')];var _0x65f5aa;if(_0x16e62d>=_0x2ad0c8){_0x16e62d=_0x2ad0c8;_0x65f5aa=0xc8;}else{_0x65f5aa=0xce;}_0x8ac134[_0x7a08('0x18')](_0x65f5aa);return _0x8ac134['set'](_0x7a08('0x1e'),_0x5bf784+'-'+_0x16e62d+'/'+_0x2ad0c8)[_0x7a08('0x1a')](_0x164a4f);}return null;};}function patchUpdates(_0x28055a){return function(_0x5c079d){try{jsonpatch['apply'](_0x5c079d,_0x28055a,!![]);}catch(_0x89a51e){return BPromise[_0x7a08('0x1f')](_0x89a51e);}return _0x5c079d[_0x7a08('0x20')]();};}function saveUpdates(_0x49c16e,_0x4a1cbf){return function(_0x12ba68){if(_0x12ba68){return _0x12ba68[_0x7a08('0x21')](_0x49c16e)[_0x7a08('0x22')](function(_0x540778){return _0x540778;});}return null;};}function removeEntity(_0x483278,_0x5e9343){return function(_0x3dae81){if(_0x3dae81){return _0x3dae81['destroy']()[_0x7a08('0x22')](function(){var _0x18245b=_0x3dae81[_0x7a08('0x23')]({'plain':!![]});var _0x3c10bd=_0x7a08('0x24');return db[_0x7a08('0x25')][_0x7a08('0x26')]({'where':{'type':_0x3c10bd,'resourceId':_0x18245b['id']}})[_0x7a08('0x22')](function(){return _0x3dae81;});})[_0x7a08('0x22')](function(){_0x483278[_0x7a08('0x18')](0xcc)[_0x7a08('0x19')]();});}};}function handleEntityNotFound(_0x51e199,_0x5bdfea){return function(_0x275740){if(!_0x275740){_0x51e199['sendStatus'](0x194);}return _0x275740;};}function handleError(_0x4b8b9f,_0x24d31e){_0x24d31e=_0x24d31e||0x1f4;return function(_0x17ce75){logger[_0x7a08('0x27')](_0x17ce75['stack']);if(_0x17ce75[_0x7a08('0x28')]){delete _0x17ce75[_0x7a08('0x28')];}_0x4b8b9f['status'](_0x24d31e)[_0x7a08('0x29')](_0x17ce75);};}exports['index']=function(_0xc7647c,_0x161c0f){var _0x4b35ba={},_0x3f5908={},_0x6123f6={'count':0x0,'rows':[]};var _0x12907f=_[_0x7a08('0x2a')](db['Schedule'][_0x7a08('0x2b')],function(_0x278912){return{'name':_0x278912[_0x7a08('0x2c')],'type':_0x278912[_0x7a08('0x2d')][_0x7a08('0x2e')]};});_0x3f5908[_0x7a08('0x2f')]=_[_0x7a08('0x2a')](_0x12907f,_0x7a08('0x28'));_0x3f5908['query']=_[_0x7a08('0x30')](_0xc7647c[_0x7a08('0x31')]);_0x3f5908[_0x7a08('0x32')]=_[_0x7a08('0x33')](_0x3f5908[_0x7a08('0x2f')],_0x3f5908[_0x7a08('0x31')]);_0x4b35ba[_0x7a08('0x34')]=_[_0x7a08('0x33')](_0x3f5908['model'],qs[_0x7a08('0x35')](_0xc7647c['query'][_0x7a08('0x35')]));_0x4b35ba[_0x7a08('0x34')]=_0x4b35ba[_0x7a08('0x34')]['length']?_0x4b35ba['attributes']:_0x3f5908[_0x7a08('0x2f')];if(!_0xc7647c[_0x7a08('0x31')][_0x7a08('0x36')](_0x7a08('0x37'))){_0x4b35ba[_0x7a08('0x1c')]=qs[_0x7a08('0x1c')](_0xc7647c['query'][_0x7a08('0x1c')]);_0x4b35ba[_0x7a08('0x1b')]=qs[_0x7a08('0x1b')](_0xc7647c[_0x7a08('0x31')][_0x7a08('0x1b')]);}_0x4b35ba[_0x7a08('0x38')]=qs[_0x7a08('0x39')](_0xc7647c[_0x7a08('0x31')][_0x7a08('0x39')]);_0x4b35ba['where']=qs[_0x7a08('0x32')](_[_0x7a08('0x3a')](_0xc7647c[_0x7a08('0x31')],_0x3f5908[_0x7a08('0x32')]),_0x12907f);if(_0xc7647c['query']['filter']){_0x4b35ba[_0x7a08('0x3b')]=_['merge'](_0x4b35ba[_0x7a08('0x3b')],{'$or':_[_0x7a08('0x2a')](_0x12907f,function(_0x162fb7){if(_0x162fb7[_0x7a08('0x2d')]!==_0x7a08('0x3c')){var _0xf2bf28={};_0xf2bf28[_0x162fb7['name']]={'$like':'%'+_0xc7647c[_0x7a08('0x31')][_0x7a08('0x3d')]+'%'};return _0xf2bf28;}})});}_0x4b35ba=_[_0x7a08('0x3e')]({},_0x4b35ba,_0xc7647c[_0x7a08('0x3f')]);var _0xf98fe0={'where':_0x4b35ba[_0x7a08('0x3b')]};return db['Schedule']['count'](_0xf98fe0)[_0x7a08('0x22')](function(_0x2be5bf){_0x6123f6['count']=_0x2be5bf;if(_0xc7647c[_0x7a08('0x31')][_0x7a08('0x40')]){_0x4b35ba[_0x7a08('0x41')]=[{'all':!![]}];}return db[_0x7a08('0x42')]['findAll'](_0x4b35ba);})[_0x7a08('0x22')](function(_0x2c6aed){_0x6123f6[_0x7a08('0x43')]=_0x2c6aed;return _0x6123f6;})[_0x7a08('0x22')](respondWithFilteredResult(_0x161c0f,_0x4b35ba))[_0x7a08('0x44')](handleError(_0x161c0f,null));};exports[_0x7a08('0x45')]=function(_0x38b084,_0x108dcb){var _0x5ee8f4={'raw':![],'where':{'id':_0x38b084[_0x7a08('0x46')]['id']}},_0x513bb0={};_0x513bb0[_0x7a08('0x2f')]=_[_0x7a08('0x30')](db[_0x7a08('0x42')][_0x7a08('0x2b')]);_0x513bb0[_0x7a08('0x31')]=_[_0x7a08('0x30')](_0x38b084[_0x7a08('0x31')]);_0x513bb0[_0x7a08('0x32')]=_[_0x7a08('0x33')](_0x513bb0[_0x7a08('0x2f')],_0x513bb0[_0x7a08('0x31')]);_0x5ee8f4[_0x7a08('0x34')]=_['intersection'](_0x513bb0[_0x7a08('0x2f')],qs[_0x7a08('0x35')](_0x38b084[_0x7a08('0x31')][_0x7a08('0x35')]));_0x5ee8f4[_0x7a08('0x34')]=_0x5ee8f4[_0x7a08('0x34')][_0x7a08('0x47')]?_0x5ee8f4[_0x7a08('0x34')]:_0x513bb0[_0x7a08('0x2f')];if(_0x38b084['query']['includeAll']){_0x5ee8f4[_0x7a08('0x41')]=[{'all':!![]}];}_0x5ee8f4=_[_0x7a08('0x3e')]({},_0x5ee8f4,_0x38b084['options']);return db['Schedule'][_0x7a08('0x48')](_0x5ee8f4)[_0x7a08('0x22')](handleEntityNotFound(_0x108dcb,null))[_0x7a08('0x22')](respondWithResult(_0x108dcb,null))[_0x7a08('0x44')](handleError(_0x108dcb,null));};exports[_0x7a08('0x49')]=function(_0xca6aad,_0x3ec605){return db[_0x7a08('0x42')][_0x7a08('0x49')](_0xca6aad[_0x7a08('0x4a')],{})[_0x7a08('0x22')](function(_0x11cba6){var _0x53a2a7=_0xca6aad[_0x7a08('0x4b')][_0x7a08('0x23')]({'plain':!![]});if(!_0x53a2a7)throw new Error(_0x7a08('0x4c'));if(_0x53a2a7[_0x7a08('0x4d')]==='user'){var _0x290229=_0x11cba6[_0x7a08('0x23')]({'plain':!![]});var _0x26c56b=_0x7a08('0x24');return db[_0x7a08('0x4e')][_0x7a08('0x48')]({'where':{'name':_0x26c56b,'userProfileId':_0x53a2a7[_0x7a08('0x4f')]},'raw':!![]})[_0x7a08('0x22')](function(_0x3824f1){if(_0x3824f1&&_0x3824f1[_0x7a08('0x50')]===0x0){return db[_0x7a08('0x25')][_0x7a08('0x49')]({'name':_0x290229[_0x7a08('0x28')],'resourceId':_0x290229['id'],'type':_0x3824f1[_0x7a08('0x28')],'sectionId':_0x3824f1['id']},{})['then'](function(){return _0x11cba6;});}else{return _0x11cba6;}})[_0x7a08('0x44')](function(_0x3f836d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f836d);throw _0x3f836d;});}return _0x11cba6;})[_0x7a08('0x22')](respondWithResult(_0x3ec605,0xc9))['catch'](handleError(_0x3ec605,null));};exports[_0x7a08('0x21')]=function(_0x332831,_0x45228e){if(_0x332831[_0x7a08('0x4a')]['id']){delete _0x332831[_0x7a08('0x4a')]['id'];}return db[_0x7a08('0x42')][_0x7a08('0x48')]({'where':{'id':_0x332831['params']['id']}})[_0x7a08('0x22')](handleEntityNotFound(_0x45228e,null))[_0x7a08('0x22')](saveUpdates(_0x332831[_0x7a08('0x4a')],null))[_0x7a08('0x22')](respondWithResult(_0x45228e,null))[_0x7a08('0x44')](handleError(_0x45228e,null));};exports[_0x7a08('0x26')]=function(_0x1af824,_0x8f4970){return db[_0x7a08('0x42')]['find']({'where':{'id':_0x1af824[_0x7a08('0x46')]['id']}})['then'](handleEntityNotFound(_0x8f4970,null))[_0x7a08('0x22')](removeEntity(_0x8f4970,null))[_0x7a08('0x44')](handleError(_0x8f4970,null));};exports[_0x7a08('0x51')]=function(_0x56ee10,_0x2dfd37,_0x382ef8){var _0x17436d=require(_0x7a08('0x52'));return db[_0x7a08('0x42')][_0x7a08('0x48')]({'where':{'id':_0x56ee10[_0x7a08('0x46')]['id']},'raw':!![]})[_0x7a08('0x22')](handleEntityNotFound(_0x2dfd37,null))[_0x7a08('0x22')](function(){_0x17436d[_0x7a08('0x51')](_0x56ee10['params']['id']);})['then'](respondWithStatusCode(_0x2dfd37,null))['catch'](handleError(_0x2dfd37,null));}; \ No newline at end of file +var _0x72f9=['limit','count','set','reject','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x72f9,0x18a));var _0x972f=function(_0x55ff21,_0x1540f0){_0x55ff21=_0x55ff21-0x0;var _0x4baf37=_0x72f9[_0x55ff21];return _0x4baf37;};'use strict';var emlformat=require(_0x972f('0x0'));var rimraf=require(_0x972f('0x1'));var zipdir=require(_0x972f('0x2'));var jsonpatch=require(_0x972f('0x3'));var rp=require('request-promise');var moment=require(_0x972f('0x4'));var BPromise=require(_0x972f('0x5'));var Mustache=require(_0x972f('0x6'));var util=require('util');var path=require(_0x972f('0x7'));var sox=require(_0x972f('0x8'));var csv=require(_0x972f('0x9'));var ejs=require(_0x972f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x972f('0xb'));var squel=require('squel');var crypto=require(_0x972f('0xc'));var jsforce=require(_0x972f('0xd'));var deskjs=require(_0x972f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x972f('0xf'));var Papa=require(_0x972f('0x10'));var Redis=require(_0x972f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x972f('0x12'));var as=require(_0x972f('0x13'));var hardwareService=require(_0x972f('0x14'));var logger=require(_0x972f('0x15'))(_0x972f('0x16'));var utils=require(_0x972f('0x17'));var config=require(_0x972f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e881,_0x56421c){_0x56421c=_0x56421c||0xcc;return function(_0x263997){if(_0x263997){return _0x23e881[_0x972f('0x19')](_0x56421c);}return _0x23e881['status'](_0x56421c)[_0x972f('0x1a')]();};}function respondWithResult(_0x57f788,_0x5910a3){_0x5910a3=_0x5910a3||0xc8;return function(_0x9aecb0){if(_0x9aecb0){return _0x57f788[_0x972f('0x1b')](_0x5910a3)[_0x972f('0x1c')](_0x9aecb0);}};}function respondWithFilteredResult(_0x55a857,_0x4c394d){return function(_0x9aeb45){if(_0x9aeb45){var _0x108671=typeof _0x4c394d[_0x972f('0x1d')]===_0x972f('0x1e')&&typeof _0x4c394d[_0x972f('0x1f')]===_0x972f('0x1e');var _0x21c92b=_0x9aeb45[_0x972f('0x20')];var _0x1db9c7=_0x108671?0x0:_0x4c394d[_0x972f('0x1d')];var _0x4e73b5=_0x108671?_0x9aeb45['count']:_0x4c394d['offset']+_0x4c394d['limit'];var _0x10c5cd;if(_0x4e73b5>=_0x21c92b){_0x4e73b5=_0x21c92b;_0x10c5cd=0xc8;}else{_0x10c5cd=0xce;}_0x55a857['status'](_0x10c5cd);return _0x55a857[_0x972f('0x21')]('Content-Range',_0x1db9c7+'-'+_0x4e73b5+'/'+_0x21c92b)[_0x972f('0x1c')](_0x9aeb45);}return null;};}function patchUpdates(_0x5bb903){return function(_0x5e346e){try{jsonpatch['apply'](_0x5e346e,_0x5bb903,!![]);}catch(_0xe0157b){return BPromise[_0x972f('0x22')](_0xe0157b);}return _0x5e346e[_0x972f('0x23')]();};}function saveUpdates(_0x4f1432,_0x4e4881){return function(_0x2bd9b8){if(_0x2bd9b8){return _0x2bd9b8[_0x972f('0x24')](_0x4f1432)[_0x972f('0x25')](function(_0x2e5b27){return _0x2e5b27;});}return null;};}function removeEntity(_0x23cb66,_0x3a925c){return function(_0x5e765e){if(_0x5e765e){return _0x5e765e['destroy']()['then'](function(){var _0xed67a2=_0x5e765e['get']({'plain':!![]});var _0x31d7d0=_0x972f('0x26');return db[_0x972f('0x27')][_0x972f('0x28')]({'where':{'type':_0x31d7d0,'resourceId':_0xed67a2['id']}})[_0x972f('0x25')](function(){return _0x5e765e;});})[_0x972f('0x25')](function(){_0x23cb66[_0x972f('0x1b')](0xcc)[_0x972f('0x1a')]();});}};}function handleEntityNotFound(_0x42692b,_0x64c20a){return function(_0x474cbe){if(!_0x474cbe){_0x42692b[_0x972f('0x19')](0x194);}return _0x474cbe;};}function handleError(_0x20a144,_0x153796){_0x153796=_0x153796||0x1f4;return function(_0x520389){logger[_0x972f('0x29')](_0x520389[_0x972f('0x2a')]);if(_0x520389[_0x972f('0x2b')]){delete _0x520389[_0x972f('0x2b')];}_0x20a144[_0x972f('0x1b')](_0x153796)[_0x972f('0x2c')](_0x520389);};}exports[_0x972f('0x2d')]=function(_0x5e49f1,_0x12c7db){var _0x1bee16={},_0x502489={},_0x3abd98={'count':0x0,'rows':[]};var _0x1f1646=_[_0x972f('0x2e')](db[_0x972f('0x2f')][_0x972f('0x30')],function(_0x4834ed){return{'name':_0x4834ed[_0x972f('0x31')],'type':_0x4834ed[_0x972f('0x32')][_0x972f('0x33')]};});_0x502489[_0x972f('0x34')]=_[_0x972f('0x2e')](_0x1f1646,_0x972f('0x2b'));_0x502489[_0x972f('0x35')]=_[_0x972f('0x36')](_0x5e49f1[_0x972f('0x35')]);_0x502489[_0x972f('0x37')]=_[_0x972f('0x38')](_0x502489[_0x972f('0x34')],_0x502489[_0x972f('0x35')]);_0x1bee16[_0x972f('0x39')]=_[_0x972f('0x38')](_0x502489[_0x972f('0x34')],qs[_0x972f('0x3a')](_0x5e49f1[_0x972f('0x35')]['fields']));_0x1bee16[_0x972f('0x39')]=_0x1bee16['attributes']['length']?_0x1bee16['attributes']:_0x502489[_0x972f('0x34')];if(!_0x5e49f1['query'][_0x972f('0x3b')](_0x972f('0x3c'))){_0x1bee16[_0x972f('0x1f')]=qs[_0x972f('0x1f')](_0x5e49f1[_0x972f('0x35')][_0x972f('0x1f')]);_0x1bee16['offset']=qs[_0x972f('0x1d')](_0x5e49f1[_0x972f('0x35')][_0x972f('0x1d')]);}_0x1bee16['order']=qs[_0x972f('0x3d')](_0x5e49f1[_0x972f('0x35')][_0x972f('0x3d')]);_0x1bee16['where']=qs[_0x972f('0x37')](_[_0x972f('0x3e')](_0x5e49f1[_0x972f('0x35')],_0x502489[_0x972f('0x37')]),_0x1f1646);if(_0x5e49f1['query'][_0x972f('0x3f')]){_0x1bee16['where']=_[_0x972f('0x40')](_0x1bee16[_0x972f('0x41')],{'$or':_[_0x972f('0x2e')](_0x1f1646,function(_0x133cb6){if(_0x133cb6[_0x972f('0x32')]!==_0x972f('0x42')){var _0x58b536={};_0x58b536[_0x133cb6[_0x972f('0x2b')]]={'$like':'%'+_0x5e49f1[_0x972f('0x35')][_0x972f('0x3f')]+'%'};return _0x58b536;}})});}_0x1bee16=_['merge']({},_0x1bee16,_0x5e49f1[_0x972f('0x43')]);var _0x503cb8={'where':_0x1bee16['where']};return db[_0x972f('0x2f')][_0x972f('0x20')](_0x503cb8)['then'](function(_0x52dadc){_0x3abd98[_0x972f('0x20')]=_0x52dadc;if(_0x5e49f1[_0x972f('0x35')][_0x972f('0x44')]){_0x1bee16[_0x972f('0x45')]=[{'all':!![]}];}return db[_0x972f('0x2f')][_0x972f('0x46')](_0x1bee16);})[_0x972f('0x25')](function(_0x3ac7c4){_0x3abd98[_0x972f('0x47')]=_0x3ac7c4;return _0x3abd98;})['then'](respondWithFilteredResult(_0x12c7db,_0x1bee16))[_0x972f('0x48')](handleError(_0x12c7db,null));};exports['show']=function(_0xa7db92,_0x2edf80){var _0x31b03a={'raw':![],'where':{'id':_0xa7db92[_0x972f('0x49')]['id']}},_0x6b5360={};_0x6b5360[_0x972f('0x34')]=_[_0x972f('0x36')](db[_0x972f('0x2f')][_0x972f('0x30')]);_0x6b5360[_0x972f('0x35')]=_[_0x972f('0x36')](_0xa7db92[_0x972f('0x35')]);_0x6b5360[_0x972f('0x37')]=_[_0x972f('0x38')](_0x6b5360['model'],_0x6b5360[_0x972f('0x35')]);_0x31b03a['attributes']=_[_0x972f('0x38')](_0x6b5360['model'],qs['fields'](_0xa7db92[_0x972f('0x35')]['fields']));_0x31b03a[_0x972f('0x39')]=_0x31b03a[_0x972f('0x39')][_0x972f('0x4a')]?_0x31b03a[_0x972f('0x39')]:_0x6b5360[_0x972f('0x34')];if(_0xa7db92[_0x972f('0x35')]['includeAll']){_0x31b03a['include']=[{'all':!![]}];}_0x31b03a=_[_0x972f('0x40')]({},_0x31b03a,_0xa7db92[_0x972f('0x43')]);return db[_0x972f('0x2f')][_0x972f('0x4b')](_0x31b03a)[_0x972f('0x25')](handleEntityNotFound(_0x2edf80,null))['then'](respondWithResult(_0x2edf80,null))['catch'](handleError(_0x2edf80,null));};exports[_0x972f('0x4c')]=function(_0x3217cb,_0x5ae2bd){return db[_0x972f('0x2f')]['create'](_0x3217cb['body'],{})[_0x972f('0x25')](function(_0x456e79){var _0x303ce3=_0x3217cb[_0x972f('0x4d')][_0x972f('0x4e')]({'plain':!![]});if(!_0x303ce3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x303ce3['role']===_0x972f('0x4d')){var _0xdaa541=_0x456e79[_0x972f('0x4e')]({'plain':!![]});var _0x2bec30='Scheduler';return db[_0x972f('0x4f')]['find']({'where':{'name':_0x2bec30,'userProfileId':_0x303ce3[_0x972f('0x50')]},'raw':!![]})[_0x972f('0x25')](function(_0x2e6a8b){if(_0x2e6a8b&&_0x2e6a8b['autoAssociation']===0x0){return db[_0x972f('0x27')][_0x972f('0x4c')]({'name':_0xdaa541[_0x972f('0x2b')],'resourceId':_0xdaa541['id'],'type':_0x2e6a8b[_0x972f('0x2b')],'sectionId':_0x2e6a8b['id']},{})[_0x972f('0x25')](function(){return _0x456e79;});}else{return _0x456e79;}})[_0x972f('0x48')](function(_0x52319e){logger[_0x972f('0x29')](_0x972f('0x51'),_0x52319e);throw _0x52319e;});}return _0x456e79;})['then'](respondWithResult(_0x5ae2bd,0xc9))['catch'](handleError(_0x5ae2bd,null));};exports['update']=function(_0x4af725,_0x1972cc){if(_0x4af725['body']['id']){delete _0x4af725[_0x972f('0x52')]['id'];}return db['Schedule'][_0x972f('0x4b')]({'where':{'id':_0x4af725[_0x972f('0x49')]['id']}})[_0x972f('0x25')](handleEntityNotFound(_0x1972cc,null))[_0x972f('0x25')](saveUpdates(_0x4af725['body'],null))[_0x972f('0x25')](respondWithResult(_0x1972cc,null))[_0x972f('0x48')](handleError(_0x1972cc,null));};exports['destroy']=function(_0x404a8c,_0x1398ef){return db[_0x972f('0x2f')][_0x972f('0x4b')]({'where':{'id':_0x404a8c[_0x972f('0x49')]['id']}})[_0x972f('0x25')](handleEntityNotFound(_0x1398ef,null))['then'](removeEntity(_0x1398ef,null))[_0x972f('0x48')](handleError(_0x1398ef,null));};exports[_0x972f('0x53')]=function(_0x386e27,_0x1f2251,_0x3f17c8){var _0xca22eb=require(_0x972f('0x54'));return db[_0x972f('0x2f')][_0x972f('0x4b')]({'where':{'id':_0x386e27[_0x972f('0x49')]['id']},'raw':!![]})[_0x972f('0x25')](handleEntityNotFound(_0x1f2251,null))[_0x972f('0x25')](function(){_0xca22eb[_0x972f('0x53')](_0x386e27[_0x972f('0x49')]['id']);})['then'](respondWithStatusCode(_0x1f2251,null))[_0x972f('0x48')](handleError(_0x1f2251,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 66eabbe..bc15b65 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 _0xd707=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd707,0x163));var _0x7d70=function(_0x244682,_0x4b174e){_0x244682=_0x244682-0x0;var _0x41dfc3=_0xd707[_0x244682];return _0x41dfc3;};'use strict';var _=require(_0x7d70('0x0'));var util=require(_0x7d70('0x1'));var logger=require(_0x7d70('0x2'))(_0x7d70('0x3'));var moment=require(_0x7d70('0x4'));var BPromise=require(_0x7d70('0x5'));var rp=require(_0x7d70('0x6'));var fs=require('fs');var path=require(_0x7d70('0x7'));var rimraf=require(_0x7d70('0x8'));var config=require(_0x7d70('0x9'));var attributes=require(_0x7d70('0xa'));module[_0x7d70('0xb')]=function(_0x4b0770,_0x526488){return _0x4b0770[_0x7d70('0xc')](_0x7d70('0xd'),attributes,{'tableName':_0x7d70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api'];(function(_0xa29b86,_0x91751d){var _0xe7dcf2=function(_0x2a2964){while(--_0x2a2964){_0xa29b86['push'](_0xa29b86['shift']());}};_0xe7dcf2(++_0x91751d);}(_0x30fa,0x1ca));var _0xa30f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x30fa[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa30f('0x0'));var util=require(_0xa30f('0x1'));var logger=require(_0xa30f('0x2'))(_0xa30f('0x3'));var moment=require(_0xa30f('0x4'));var BPromise=require(_0xa30f('0x5'));var rp=require(_0xa30f('0x6'));var fs=require('fs');var path=require(_0xa30f('0x7'));var rimraf=require(_0xa30f('0x8'));var config=require(_0xa30f('0x9'));var attributes=require(_0xa30f('0xa'));module[_0xa30f('0xb')]=function(_0x3dbf01,_0x547669){return _0x3dbf01[_0xa30f('0xc')]('Schedule',attributes,{'tableName':_0xa30f('0xd'),'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 ede6978..2512a5b 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 _0x0615=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','bluebird','randomstring'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x0615,0x189));var _0x5061=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0615[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5061('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5061('0x1'));var rs=require(_0x5061('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5061('0x3'))['db'];var utils=require(_0x5061('0x4'));var logger=require(_0x5061('0x5'))(_0x5061('0x6'));var config=require(_0x5061('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5061('0x8')][_0x5061('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319263,_0x36ea29,_0x31dab1){return new BPromise(function(_0x1912ae,_0x369cf5){return client[_0x5061('0xa')](_0x319263,_0x31dab1)[_0x5061('0xb')](function(_0x5501b2){logger['info'](_0x5061('0xc'),_0x36ea29,_0x5061('0xd'));logger[_0x5061('0xe')](_0x5061('0xf'),_0x36ea29,'request\x20sent',JSON['stringify'](_0x5501b2));if(_0x5501b2['error']){if(_0x5501b2[_0x5061('0x10')][_0x5061('0x11')]===0x1f4){logger['error'](_0x5061('0xc'),_0x36ea29,_0x5501b2[_0x5061('0x10')]['message']);return _0x369cf5(_0x5501b2[_0x5061('0x10')]['message']);}logger[_0x5061('0x10')]('Schedule,\x20%s,\x20%s',_0x36ea29,_0x5501b2[_0x5061('0x10')]['message']);return _0x1912ae(_0x5501b2[_0x5061('0x10')][_0x5061('0x12')]);}else{logger[_0x5061('0x13')](_0x5061('0xc'),_0x36ea29,_0x5061('0xd'));_0x1912ae(_0x5501b2[_0x5061('0x14')][_0x5061('0x12')]);}})[_0x5061('0x15')](function(_0x441c81){logger[_0x5061('0x10')]('Schedule,\x20%s,\x20%s',_0x36ea29,_0x441c81);_0x369cf5(_0x441c81);});});} \ No newline at end of file +var _0x43b9=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x593582,_0x3d82e1){var _0x31aa87=function(_0x165dc2){while(--_0x165dc2){_0x593582['push'](_0x593582['shift']());}};_0x31aa87(++_0x3d82e1);}(_0x43b9,0xd1));var _0x943b=function(_0x2316cc,_0x280bd8){_0x2316cc=_0x2316cc-0x0;var _0x439ba7=_0x43b9[_0x2316cc];return _0x439ba7;};'use strict';var _=require(_0x943b('0x0'));var util=require('util');var moment=require(_0x943b('0x1'));var BPromise=require(_0x943b('0x2'));var rs=require(_0x943b('0x3'));var fs=require('fs');var Redis=require(_0x943b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x943b('0x5'));var logger=require('../../config/logger')(_0x943b('0x6'));var config=require(_0x943b('0x7'));var jayson=require(_0x943b('0x8'));var client=jayson[_0x943b('0x9')][_0x943b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e7748,_0x392a9f,_0x30fc6e){return new BPromise(function(_0x1093df,_0x274c3d){return client[_0x943b('0xb')](_0x1e7748,_0x30fc6e)[_0x943b('0xc')](function(_0x132cbc){logger[_0x943b('0xd')](_0x943b('0xe'),_0x392a9f,_0x943b('0xf'));logger[_0x943b('0x10')](_0x943b('0x11'),_0x392a9f,'request\x20sent',JSON['stringify'](_0x132cbc));if(_0x132cbc['error']){if(_0x132cbc[_0x943b('0x12')][_0x943b('0x13')]===0x1f4){logger[_0x943b('0x12')]('Schedule,\x20%s,\x20%s',_0x392a9f,_0x132cbc[_0x943b('0x12')][_0x943b('0x14')]);return _0x274c3d(_0x132cbc[_0x943b('0x12')][_0x943b('0x14')]);}logger[_0x943b('0x12')](_0x943b('0xe'),_0x392a9f,_0x132cbc[_0x943b('0x12')][_0x943b('0x14')]);return _0x1093df(_0x132cbc[_0x943b('0x12')]['message']);}else{logger[_0x943b('0xd')]('Schedule,\x20%s,\x20%s',_0x392a9f,_0x943b('0xf'));_0x1093df(_0x132cbc[_0x943b('0x15')][_0x943b('0x14')]);}})[_0x943b('0x16')](function(_0x28a790){logger['error'](_0x943b('0xe'),_0x392a9f,_0x28a790);_0x274c3d(_0x28a790);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index dc945d7..e2c91a0 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 _0x4bdd=['isAuthenticated','index','/describe','/:id','show','download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x4ab84b,_0x503754){var _0x2eac97=function(_0x34c5f4){while(--_0x34c5f4){_0x4ab84b['push'](_0x4ab84b['shift']());}};_0x2eac97(++_0x503754);}(_0x4bdd,0x68));var _0xd4bd=function(_0x9a7281,_0x1558fe){_0x9a7281=_0x9a7281-0x0;var _0x3510e6=_0x4bdd[_0x9a7281];return _0x3510e6;};'use strict';var multer=require('multer');var util=require(_0xd4bd('0x0'));var path=require(_0xd4bd('0x1'));var timeout=require(_0xd4bd('0x2'));var express=require(_0xd4bd('0x3'));var router=express[_0xd4bd('0x4')]();var fs_extra=require(_0xd4bd('0x5'));var auth=require(_0xd4bd('0x6'));var interaction=require(_0xd4bd('0x7'));var config=require(_0xd4bd('0x8'));var controller=require(_0xd4bd('0x9'));router[_0xd4bd('0xa')]('/',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0xc')]);router[_0xd4bd('0xa')](_0xd4bd('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xd4bd('0xa')](_0xd4bd('0xe'),auth['isAuthenticated'](),controller[_0xd4bd('0xf')]);router[_0xd4bd('0xa')]('/:id/download',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0x10')]);router[_0xd4bd('0x11')]('/',auth[_0xd4bd('0xb')](),controller['create']);router[_0xd4bd('0x12')](_0xd4bd('0xe'),auth['isAuthenticated'](),controller[_0xd4bd('0x13')]);router[_0xd4bd('0x14')]('/:id',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0x15')]);module[_0xd4bd('0x16')]=router; \ No newline at end of file +var _0x50e7=['../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x215207,_0x7c95ca){var _0x830d43=function(_0xf56fff){while(--_0xf56fff){_0x215207['push'](_0x215207['shift']());}};_0x830d43(++_0x7c95ca);}(_0x50e7,0xa9));var _0x750e=function(_0x3f4f15,_0x45438a){_0x3f4f15=_0x3f4f15-0x0;var _0x25e7a9=_0x50e7[_0x3f4f15];return _0x25e7a9;};'use strict';var multer=require(_0x750e('0x0'));var util=require('util');var path=require(_0x750e('0x1'));var timeout=require(_0x750e('0x2'));var express=require(_0x750e('0x3'));var router=express[_0x750e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x750e('0x5'));var interaction=require(_0x750e('0x6'));var config=require(_0x750e('0x7'));var controller=require(_0x750e('0x8'));router[_0x750e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x750e('0x9')]('/describe',auth[_0x750e('0xa')](),controller[_0x750e('0xb')]);router[_0x750e('0x9')](_0x750e('0xc'),auth[_0x750e('0xa')](),controller[_0x750e('0xd')]);router['get'](_0x750e('0xe'),auth[_0x750e('0xa')](),controller[_0x750e('0xf')]);router[_0x750e('0x10')]('/',auth[_0x750e('0xa')](),controller['create']);router[_0x750e('0x11')](_0x750e('0xc'),auth[_0x750e('0xa')](),controller[_0x750e('0x12')]);router[_0x750e('0x13')](_0x750e('0xc'),auth[_0x750e('0xa')](),controller[_0x750e('0x14')]);module[_0x750e('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8599f9c..5413232 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 _0xab75=['startedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0xab75,0x11f));var _0x5ab7=function(_0x5a092d,_0x282356){_0x5a092d=_0x5a092d-0x0;var _0x2f38da=_0xab75[_0x5a092d];return _0x2f38da;};'use strict';var Sequelize=require(_0x5ab7('0x0'));var moment=require(_0x5ab7('0x1'));var path=require(_0x5ab7('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x5ab7('0x3')],'get':function(){return this[_0x5ab7('0x4')](_0x5ab7('0x5'))?path['extname'](this[_0x5ab7('0x4')](_0x5ab7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x5ab7('0x6')]},'channel':{'type':Sequelize[_0x5ab7('0x6')]},'value':{'type':Sequelize[_0x5ab7('0x6')],'set':function(_0x32b338){var _0x229f83=_0x32b338[_0x5ab7('0x7')](/\\/g,'/');this[_0x5ab7('0x8')](_0x5ab7('0x5'),_0x229f83);}},'rating':{'type':Sequelize[_0x5ab7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x216796){this[_0x5ab7('0x8')]('startedAt',moment()[_0x5ab7('0xa')](_0x216796,'ms'));this[_0x5ab7('0x8')](_0x5ab7('0xb'),moment());this[_0x5ab7('0x8')](_0x5ab7('0xc'),_0x216796);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x5ab7('0xd')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'closedAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this[_0x5ab7('0x4')](_0x5ab7('0xb')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'createdAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this['getDataValue'](_0x5ab7('0x12')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'updatedAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this[_0x5ab7('0x4')](_0x5ab7('0x13')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}}}; \ No newline at end of file +var _0xf8f2=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x5573e5,_0x294cdc){_0x5573e5=_0x5573e5-0x0;var _0xa91b77=_0xf8f2[_0x5573e5];return _0xa91b77;};'use strict';var Sequelize=require(_0x2f8f('0x0'));var moment=require(_0x2f8f('0x1'));var path=require(_0x2f8f('0x2'));var config=require(_0x2f8f('0x3'));module['exports']={'format':{'type':Sequelize[_0x2f8f('0x4')],'get':function(){return this[_0x2f8f('0x5')](_0x2f8f('0x6'))?path[_0x2f8f('0x7')](this[_0x2f8f('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x2f8f('0x8')]},'channel':{'type':Sequelize[_0x2f8f('0x8')]},'value':{'type':Sequelize[_0x2f8f('0x8')],'set':function(_0x107748){var _0x590ff4=_0x107748[_0x2f8f('0x9')](/\\/g,'/');this[_0x2f8f('0xa')](_0x2f8f('0x6'),_0x590ff4);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2f8f('0xb')],'set':function(_0x1ce821){this[_0x2f8f('0xa')](_0x2f8f('0xc'),moment()['subtract'](_0x1ce821,'ms'));this[_0x2f8f('0xa')](_0x2f8f('0xd'),moment());this['setDataValue'](_0x2f8f('0xe'),_0x1ce821);}},'startedAt':{'type':Sequelize[_0x2f8f('0xf')],'get':function(){return moment(this[_0x2f8f('0x5')](_0x2f8f('0xc')))['format'](_0x2f8f('0x10'))[_0x2f8f('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2f8f('0xd')))[_0x2f8f('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x2f8f('0x11')]();}},'createdAt':{'type':Sequelize[_0x2f8f('0xf')],'get':function(){return moment(this[_0x2f8f('0x5')](_0x2f8f('0x13')))[_0x2f8f('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2f8f('0x14')))[_0x2f8f('0x12')](_0x2f8f('0x10'))[_0x2f8f('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2953f68..31d24e4 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 _0xa41a=['unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','params','include','find','catch','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname'];(function(_0x2479f5,_0x290689){var _0x5af45f=function(_0x421d69){while(--_0x421d69){_0x2479f5['push'](_0x2479f5['shift']());}};_0x5af45f(++_0x290689);}(_0xa41a,0x6b));var _0xaa41=function(_0x12a815,_0x1b6944){_0x12a815=_0x12a815-0x0;var _0x18897c=_0xa41a[_0x12a815];return _0x18897c;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={},_0x1d8c2b={},_0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x2a')](db['ScreenRecording'][_0xaa41('0x2b')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x1d8c2b['model']=_[_0xaa41('0x2e')](_[_0xaa41('0x2a')](_0x30f88e,'name'),['format']);_0x1d8c2b['query']=_[_0xaa41('0x2f')](_0x1f0275[_0xaa41('0x30')]);_0x1d8c2b[_0xaa41('0x31')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],_0x1d8c2b[_0xaa41('0x30')]);_0x9a16e3[_0xaa41('0x33')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],qs[_0xaa41('0x34')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x34')]));_0x9a16e3['attributes']=_0x9a16e3[_0xaa41('0x33')][_0xaa41('0x35')]?_0x9a16e3['attributes']:_0x1d8c2b[_0xaa41('0x36')];if(!_0x1f0275[_0xaa41('0x30')][_0xaa41('0x37')]('nolimit')){_0x9a16e3[_0xaa41('0x1e')]=qs['limit'](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x1e')]);_0x9a16e3[_0xaa41('0x20')]=qs['offset'](_0x1f0275['query']['offset']);}_0x9a16e3[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x39')]);_0x9a16e3['where']=qs['filters'](_[_0xaa41('0x3a')](_0x1f0275[_0xaa41('0x30')],_0x1d8c2b[_0xaa41('0x31')]),_0x30f88e);if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]){_0x9a16e3[_0xaa41('0x3c')]=_[_0xaa41('0x3d')](_0x9a16e3['where'],{'$or':_[_0xaa41('0x2a')](_0x30f88e,function(_0x5cf689){if(_0x5cf689[_0xaa41('0x2c')]!==_0xaa41('0x3e')){var _0x57f1bf={};_0x57f1bf[_0x5cf689['name']]={'$like':'%'+_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]+'%'};return _0x57f1bf;}})});}_0x9a16e3=_['merge']({},_0x9a16e3,_0x1f0275[_0xaa41('0x3f')]);var _0x563687={'where':_0x9a16e3[_0xaa41('0x3c')]};return db[_0xaa41('0x40')][_0xaa41('0x1f')](_0x563687)[_0xaa41('0x25')](function(_0x3e6cac){_0x4466a3[_0xaa41('0x1f')]=_0x3e6cac;if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x41')]){_0x9a16e3['include']=[{'all':!![]}];}return db[_0xaa41('0x40')][_0xaa41('0x42')](_0x9a16e3);})[_0xaa41('0x25')](function(_0x398c35){_0x4466a3[_0xaa41('0x43')]=_0x398c35;return _0x4466a3;})[_0xaa41('0x25')](respondWithFilteredResult(_0x63c18c,_0x9a16e3))['catch'](handleError(_0x63c18c,null));};exports['show']=function(_0x87e2f4,_0x4f9086){var _0x1ed366={'raw':![],'where':{'id':_0x87e2f4[_0xaa41('0x44')]['id']}},_0x215896={};_0x215896[_0xaa41('0x36')]=_[_0xaa41('0x2f')](db[_0xaa41('0x40')][_0xaa41('0x2b')]);_0x215896['query']=_[_0xaa41('0x2f')](_0x87e2f4['query']);_0x215896['filters']=_[_0xaa41('0x32')](_0x215896['model'],_0x215896['query']);_0x1ed366['attributes']=_[_0xaa41('0x32')](_0x215896['model'],qs[_0xaa41('0x34')](_0x87e2f4[_0xaa41('0x30')]['fields']));_0x1ed366['attributes']=_0x1ed366[_0xaa41('0x33')][_0xaa41('0x35')]?_0x1ed366[_0xaa41('0x33')]:_0x215896[_0xaa41('0x36')];if(_0x87e2f4[_0xaa41('0x30')][_0xaa41('0x41')]){_0x1ed366[_0xaa41('0x45')]=[{'all':!![]}];}_0x1ed366=_[_0xaa41('0x3d')]({},_0x1ed366,_0x87e2f4[_0xaa41('0x3f')]);return db['ScreenRecording'][_0xaa41('0x46')](_0x1ed366)[_0xaa41('0x25')](handleEntityNotFound(_0x4f9086,null))[_0xaa41('0x25')](respondWithResult(_0x4f9086,null))[_0xaa41('0x47')](handleError(_0x4f9086,null));};exports[_0xaa41('0x48')]=function(_0x1d6112,_0x538b12){return db[_0xaa41('0x40')][_0xaa41('0x48')](_0x1d6112[_0xaa41('0x49')],{})[_0xaa41('0x25')](respondWithResult(_0x538b12,0xc9))['catch'](handleError(_0x538b12,null));};exports[_0xaa41('0x23')]=function(_0x5787f3,_0x49fedd){if(_0x5787f3[_0xaa41('0x49')]['id']){delete _0x5787f3[_0xaa41('0x49')]['id'];}delete _0x5787f3[_0xaa41('0x49')]['duration'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4a')];delete _0x5787f3[_0xaa41('0x49')]['closedAt'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4b')];return db[_0xaa41('0x40')][_0xaa41('0x46')]({'where':{'id':_0x5787f3[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x49fedd,null))[_0xaa41('0x25')](saveUpdates(_0x5787f3[_0xaa41('0x49')],null))['then'](respondWithResult(_0x49fedd,null))[_0xaa41('0x47')](handleError(_0x49fedd,null));};exports['describe']=function(_0x5ae65e,_0x1bdcd6){return db[_0xaa41('0x40')][_0xaa41('0x4c')]()[_0xaa41('0x25')](respondWithResult(_0x1bdcd6,null))[_0xaa41('0x47')](handleError(_0x1bdcd6,null));};exports[_0xaa41('0x4d')]=function(_0x48c4c7,_0x3c5082,_0x519e39){var _0xecb54=require(_0xaa41('0x4e'));var _0x1d518f=![];var _0x4f9e92={};if(_0x48c4c7[_0xaa41('0x30')][_0xaa41('0x2c')]&&_0x48c4c7['query'][_0xaa41('0x2c')]===_0xaa41('0x4f')){_0x4f9e92[_0xaa41('0x4f')]=_0x48c4c7['params']['id'];}else{_0x4f9e92['id']=_0x48c4c7[_0xaa41('0x44')]['id'];}return db[_0xaa41('0x40')]['find']({'where':_0x4f9e92,'attributes':['id','value'],'raw':!![]})[_0xaa41('0x25')](handleEntityNotFound(_0x3c5082,null))[_0xaa41('0x25')](function(_0x3a29d2){if(_0x3a29d2){var _0x4d20c6=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x3a29d2[_0xaa41('0x4b')]);var _0x2abb78=util['format'](_0xaa41('0x53'),_0x4d20c6);if(fs['existsSync'](_0x2abb78)){_0x1d518f=!![];return _0xecb54['decryptFile'](_0x2abb78,_0x4d20c6,config[_0xaa41('0x54')]['recording'])[_0xaa41('0x25')](function(){return _0x3a29d2;});}return _0x3a29d2;}})[_0xaa41('0x25')](function(_0x169ddf){if(_0x169ddf){var _0x5e83e1=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x169ddf[_0xaa41('0x4b')]);if(!fs[_0xaa41('0x55')](_0x5e83e1)){throw new db[(_0xaa41('0x56'))][(_0xaa41('0x57'))](_0xaa41('0x58'));}if(_0x169ddf[_0xaa41('0x59')]){return _0x3c5082['download'](_0x5e83e1,_0x169ddf[_0xaa41('0x59')]+path[_0xaa41('0x5a')](_0x5e83e1),function(){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}else{return _0x3c5082['download'](_0x5e83e1,function(_0x3fe47a){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}}})[_0xaa41('0x47')](function(_0x134579){if(_0x134579[_0xaa41('0x5c')]===_0xaa41('0x58')){_0x3c5082[_0xaa41('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x3c5082,null);}});};exports['destroy']=function(_0x540325,_0x4ec357){return db['ScreenRecording'][_0xaa41('0x46')]({'where':{'id':_0x540325['params']['id']}})['then'](function(_0x24c6f3){if(_[_0xaa41('0x5d')](_0x24c6f3)){throw new ReferenceError(_0xaa41('0x5e'));}return _0x24c6f3;})[_0xaa41('0x25')](function(_0x5cabc4){var _0x244d41=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x5cabc4[_0xaa41('0x4b')]);logger[_0xaa41('0x5f')](_0xaa41('0x60'),_0x244d41);if(!_[_0xaa41('0x5d')](_0x5cabc4[_0xaa41('0x4b')])&&fs['existsSync'](_0x244d41)){logger[_0xaa41('0x5f')](_0xaa41('0x61')+_0x244d41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x244d41);}_0x244d41=_0x244d41+'.cypher';if(!_[_0xaa41('0x5d')](_0x5cabc4['value'])&&fs[_0xaa41('0x55')](_0x244d41)){logger['info'](_0xaa41('0x61')+_0x244d41+_0xaa41('0x62'));fs['unlinkSync'](_0x244d41);}return _0x5cabc4;})[_0xaa41('0x25')](function(_0x33efc5){if(!_0x33efc5)throw new InternalError();return _0x33efc5[_0xaa41('0x24')]();})[_0xaa41('0x25')](function(){_0x4ec357['status'](0xcc)['end']();})[_0xaa41('0x47')](handleError(_0x4ec357,null));}; \ No newline at end of file +var _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x42733b,_0x5413fe){_0x42733b=_0x42733b-0x0;var _0xb41b36=_0xdbf5[_0x42733b];return _0xb41b36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5597d67..024ce18 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 _0xc2ec=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger','api','moment'];(function(_0x596975,_0x11f585){var _0x6fdd51=function(_0x57fdcb){while(--_0x57fdcb){_0x596975['push'](_0x596975['shift']());}};_0x6fdd51(++_0x11f585);}(_0xc2ec,0x10d));var _0xcc2e=function(_0xc9ea96,_0x48963a){_0xc9ea96=_0xc9ea96-0x0;var _0x201c20=_0xc2ec[_0xc9ea96];return _0x201c20;};'use strict';var _=require('lodash');var util=require(_0xcc2e('0x0'));var logger=require(_0xcc2e('0x1'))(_0xcc2e('0x2'));var moment=require(_0xcc2e('0x3'));var BPromise=require(_0xcc2e('0x4'));var rp=require(_0xcc2e('0x5'));var fs=require('fs');var path=require(_0xcc2e('0x6'));var rimraf=require(_0xcc2e('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc2e('0x8'));module[_0xcc2e('0x9')]=function(_0x366943,_0x4490f3){return _0x366943[_0xcc2e('0xa')]('ScreenRecording',attributes,{'tableName':_0xcc2e('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcc2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb80f=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xb80f,0x11d));var _0xfb80=function(_0x4e8bc3,_0x47860c){_0x4e8bc3=_0x4e8bc3-0x0;var _0x2fe112=_0xb80f[_0x4e8bc3];return _0x2fe112;};'use strict';var _=require(_0xfb80('0x0'));var util=require('util');var logger=require(_0xfb80('0x1'))('api');var moment=require(_0xfb80('0x2'));var BPromise=require(_0xfb80('0x3'));var rp=require(_0xfb80('0x4'));var fs=require('fs');var path=require(_0xfb80('0x5'));var rimraf=require('rimraf');var config=require(_0xfb80('0x6'));var attributes=require(_0xfb80('0x7'));module[_0xfb80('0x8')]=function(_0xd67d3b,_0x35572f){return _0xd67d3b[_0xfb80('0x9')](_0xfb80('0xa'),attributes,{'tableName':_0xfb80('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xfb80('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f0a9d69..92f42f3 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 _0x3a20=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis'];(function(_0xb2d229,_0x5ba299){var _0xc342d6=function(_0xafe3bc){while(--_0xafe3bc){_0xb2d229['push'](_0xb2d229['shift']());}};_0xc342d6(++_0x5ba299);}(_0x3a20,0x13b));var _0x03a2=function(_0x934528,_0x116b76){_0x934528=_0x934528-0x0;var _0x3eca3f=_0x3a20[_0x934528];return _0x3eca3f;};'use strict';var _=require('lodash');var util=require(_0x03a2('0x0'));var moment=require(_0x03a2('0x1'));var BPromise=require(_0x03a2('0x2'));var rs=require(_0x03a2('0x3'));var fs=require('fs');var Redis=require(_0x03a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03a2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x03a2('0x6'));var jayson=require(_0x03a2('0x7'));var client=jayson[_0x03a2('0x8')][_0x03a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c8be,_0x4e1b4e,_0x2f4c27){return new BPromise(function(_0xda8986,_0x4eeb2f){return client[_0x03a2('0xa')](_0x13c8be,_0x2f4c27)[_0x03a2('0xb')](function(_0x320975){logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x4e1b4e,_0x03a2('0xe'));logger[_0x03a2('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4e1b4e,_0x03a2('0xe'),JSON[_0x03a2('0x10')](_0x320975));if(_0x320975[_0x03a2('0x11')]){if(_0x320975[_0x03a2('0x11')][_0x03a2('0x12')]===0x1f4){logger[_0x03a2('0x11')](_0x03a2('0xd'),_0x4e1b4e,_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);return _0x4eeb2f(_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);}logger[_0x03a2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4e1b4e,_0x320975[_0x03a2('0x11')]['message']);return _0xda8986(_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);}else{logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x4e1b4e,_0x03a2('0xe'));_0xda8986(_0x320975['result'][_0x03a2('0x13')]);}})['catch'](function(_0xcbacca){logger[_0x03a2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4e1b4e,_0xcbacca);_0x4eeb2f(_0xcbacca);});});} \ No newline at end of file +var _0x4767=['../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4767,0xe1));var _0x7476=function(_0x2d72bf,_0x11bf08){_0x2d72bf=_0x2d72bf-0x0;var _0x1a3fc7=_0x4767[_0x2d72bf];return _0x1a3fc7;};'use strict';var _=require(_0x7476('0x0'));var util=require('util');var moment=require(_0x7476('0x1'));var BPromise=require('bluebird');var rs=require(_0x7476('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7476('0x3'));var logger=require(_0x7476('0x4'))(_0x7476('0x5'));var config=require(_0x7476('0x6'));var jayson=require(_0x7476('0x7'));var client=jayson['client'][_0x7476('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x355d8b,_0x5654ae,_0x183532){return new BPromise(function(_0x116a9d,_0x3611f3){return client[_0x7476('0x9')](_0x355d8b,_0x183532)['then'](function(_0x2d57b7){logger[_0x7476('0xa')](_0x7476('0xb'),_0x5654ae,_0x7476('0xc'));logger[_0x7476('0xd')](_0x7476('0xe'),_0x5654ae,'request\x20sent',JSON[_0x7476('0xf')](_0x2d57b7));if(_0x2d57b7[_0x7476('0x10')]){if(_0x2d57b7[_0x7476('0x10')][_0x7476('0x11')]===0x1f4){logger[_0x7476('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x5654ae,_0x2d57b7[_0x7476('0x10')]['message']);return _0x3611f3(_0x2d57b7[_0x7476('0x10')][_0x7476('0x12')]);}logger[_0x7476('0x10')](_0x7476('0xb'),_0x5654ae,_0x2d57b7[_0x7476('0x10')][_0x7476('0x12')]);return _0x116a9d(_0x2d57b7[_0x7476('0x10')]['message']);}else{logger[_0x7476('0xa')](_0x7476('0xb'),_0x5654ae,'request\x20sent');_0x116a9d(_0x2d57b7[_0x7476('0x13')]['message']);}})[_0x7476('0x14')](function(_0x566cda){logger[_0x7476('0x10')](_0x7476('0xb'),_0x5654ae,_0x566cda);_0x3611f3(_0x566cda);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f0f1d47..f41e303 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 _0xdb4f=['%s%s','logologin','addLogoLogin','single','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','file','addLogo'];(function(_0x55032d,_0x18d06c){var _0xa349da=function(_0x5c9e90){while(--_0x5c9e90){_0x55032d['push'](_0x55032d['shift']());}};_0xa349da(++_0x18d06c);}(_0xdb4f,0x159));var _0xfdb4=function(_0x2f7c40,_0xb36203){_0x2f7c40=_0x2f7c40-0x0;var _0x57a4a5=_0xdb4f[_0x2f7c40];return _0x57a4a5;};'use strict';var multer=require(_0xfdb4('0x0'));var util=require(_0xfdb4('0x1'));var path=require('path');var timeout=require(_0xfdb4('0x2'));var express=require(_0xfdb4('0x3'));var router=express[_0xfdb4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfdb4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfdb4('0x6'));var controller=require('./setting.controller');router[_0xfdb4('0x7')]('/',auth[_0xfdb4('0x8')](),controller[_0xfdb4('0x9')]);router['get'](_0xfdb4('0xa'),controller[_0xfdb4('0xb')]);router[_0xfdb4('0x7')](_0xfdb4('0xc'),controller['show']);router[_0xfdb4('0x7')](_0xfdb4('0xd'),controller[_0xfdb4('0xe')]);router[_0xfdb4('0x7')](_0xfdb4('0xf'),controller[_0xfdb4('0x10')]);router[_0xfdb4('0x7')](_0xfdb4('0x11'),controller[_0xfdb4('0x12')]);router[_0xfdb4('0x7')](_0xfdb4('0x13'),controller[_0xfdb4('0x14')]);router['get'](_0xfdb4('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x1bcfd3,_0x23080c,_0xc2efc5){_0xc2efc5(null,path[_0xfdb4('0x17')](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x2d0c1d,_0x486599,_0xd48158){_0xd48158(null,util[_0xfdb4('0x1a')]('%s%s',_0xfdb4('0x1b'),path[_0xfdb4('0x1c')](_0x486599[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0xd'),upload['single'](_0xfdb4('0x1f')),controller[_0xfdb4('0x20')]);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x26094f,_0x324f38,_0x4669ac){_0x4669ac(null,path['join'](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x556e3c,_0x4dd700,_0x343203){_0x343203(null,util[_0xfdb4('0x1a')](_0xfdb4('0x21'),_0xfdb4('0x22'),path[_0xfdb4('0x1c')](_0x4dd700[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0xf'),upload['single'](_0xfdb4('0x1f')),controller[_0xfdb4('0x23')]);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x15980a,_0x102114,_0x1f625a){_0x1f625a(null,path[_0xfdb4('0x17')](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x185166,_0x512047,_0x2c63be){_0x2c63be(null,util['format']('%s%s','preferred',path[_0xfdb4('0x1c')](_0x512047[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0x13'),upload[_0xfdb4('0x24')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x3d1f1e,_0x4bd31a,_0x2a1a46){_0x2a1a46(null,path[_0xfdb4('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5beb35,_0x36b5d1,_0x48bb9f){_0x48bb9f(null,util[_0xfdb4('0x1a')](_0xfdb4('0x21'),_0xfdb4('0x25'),path[_0xfdb4('0x1c')](_0x36b5d1[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0x15'),upload['single']('file'),controller[_0xfdb4('0x26')]);router[_0xfdb4('0x27')](_0xfdb4('0xc'),auth[_0xfdb4('0x8')](),controller[_0xfdb4('0x28')]);module[_0xfdb4('0x29')]=router; \ No newline at end of file +var _0x0171=['addLogo','originalname','file','addLogoLogin','addPreferred','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single'];(function(_0x4511e0,_0x2e642e){var _0x76458e=function(_0x118b37){while(--_0x118b37){_0x4511e0['push'](_0x4511e0['shift']());}};_0x76458e(++_0x2e642e);}(_0x0171,0xe0));var _0x1017=function(_0x2438f6,_0x5979d3){_0x2438f6=_0x2438f6-0x0;var _0x29bb92=_0x0171[_0x2438f6];return _0x29bb92;};'use strict';var multer=require(_0x1017('0x0'));var util=require(_0x1017('0x1'));var path=require(_0x1017('0x2'));var timeout=require(_0x1017('0x3'));var express=require('express');var router=express[_0x1017('0x4')]();var fs_extra=require(_0x1017('0x5'));var auth=require(_0x1017('0x6'));var interaction=require(_0x1017('0x7'));var config=require(_0x1017('0x8'));var controller=require(_0x1017('0x9'));router[_0x1017('0xa')]('/',auth[_0x1017('0xb')](),controller[_0x1017('0xc')]);router[_0x1017('0xa')](_0x1017('0xd'),controller[_0x1017('0xe')]);router['get']('/:id',controller[_0x1017('0xf')]);router[_0x1017('0xa')](_0x1017('0x10'),controller[_0x1017('0x11')]);router[_0x1017('0xa')](_0x1017('0x12'),controller[_0x1017('0x13')]);router[_0x1017('0xa')](_0x1017('0x14'),controller['gdpr']);router[_0x1017('0xa')](_0x1017('0x15'),controller[_0x1017('0x16')]);router[_0x1017('0xa')](_0x1017('0x17'),controller['getFavicon']);var upload=multer({'storage':multer[_0x1017('0x18')]({'destination':function(_0x119c6c,_0x287703,_0x37d826){_0x37d826(null,path[_0x1017('0x19')](config[_0x1017('0x1a')],_0x1017('0x1b')));},'filename':function(_0x2aa714,_0x2de2aa,_0x379557){_0x379557(null,util[_0x1017('0x1c')](_0x1017('0x1d'),_0x1017('0x1e'),path[_0x1017('0x1f')](_0x2de2aa['originalname'])));}})});router[_0x1017('0x20')]('/:id/logo',upload[_0x1017('0x21')]('file'),controller[_0x1017('0x22')]);var upload=multer({'storage':multer[_0x1017('0x18')]({'destination':function(_0x834cc3,_0x5ce1dd,_0x12251d){_0x12251d(null,path['join'](config[_0x1017('0x1a')],'server/files/images/logos/'));},'filename':function(_0x77e84c,_0x2ee12a,_0x3413b7){_0x3413b7(null,util[_0x1017('0x1c')](_0x1017('0x1d'),'logologin',path[_0x1017('0x1f')](_0x2ee12a[_0x1017('0x23')])));}})});router['post'](_0x1017('0x12'),upload[_0x1017('0x21')](_0x1017('0x24')),controller[_0x1017('0x25')]);var upload=multer({'storage':multer[_0x1017('0x18')]({'destination':function(_0x3af002,_0x2f34a7,_0x4920fb){_0x4920fb(null,path[_0x1017('0x19')](config[_0x1017('0x1a')],'server/files/images/logos/'));},'filename':function(_0xcaad94,_0x5529d7,_0x4ae7e4){_0x4ae7e4(null,util[_0x1017('0x1c')](_0x1017('0x1d'),'preferred',path[_0x1017('0x1f')](_0x5529d7[_0x1017('0x23')])));}})});router[_0x1017('0x20')](_0x1017('0x15'),upload['single'](_0x1017('0x24')),controller[_0x1017('0x26')]);var upload=multer({'storage':multer[_0x1017('0x18')]({'destination':function(_0x170ebd,_0x52a537,_0x519ad7){_0x519ad7(null,path[_0x1017('0x19')](config['root'],_0x1017('0x1b')));},'filename':function(_0x81a020,_0x5af889,_0x1ff654){_0x1ff654(null,util['format'](_0x1017('0x1d'),'favicon',path[_0x1017('0x1f')](_0x5af889[_0x1017('0x23')])));}})});router['post']('/:id/favicon',upload[_0x1017('0x21')](_0x1017('0x24')),controller[_0x1017('0x27')]);router['put'](_0x1017('0x28'),auth[_0x1017('0xb')](),controller[_0x1017('0x29')]);module[_0x1017('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fff5e16..dcf9774 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x41601c,_0x168fcf){var _0x2c3d23=function(_0x32393f){while(--_0x32393f){_0x41601c['push'](_0x41601c['shift']());}};_0x2c3d23(++_0x168fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x37de66,_0xa153f9){var _0x50d49e=function(_0x4f465a){while(--_0x4f465a){_0x37de66['push'](_0x37de66['shift']());}};_0x50d49e(++_0xa153f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d4f35f4..e9f8d8b 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 _0xc560=['favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','Setting','findAll','rows','show','params','length','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','join','root','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default','securePassword'];(function(_0x47a385,_0x5d8781){var _0x31abb9=function(_0x210f7a){while(--_0x210f7a){_0x47a385['push'](_0x47a385['shift']());}};_0x31abb9(++_0x5d8781);}(_0xc560,0x82));var _0x0c56=function(_0x22a3c4,_0x2f2160){_0x22a3c4=_0x22a3c4-0x0;var _0x2488e4=_0xc560[_0x22a3c4];return _0x2488e4;};'use strict';var emlformat=require(_0x0c56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c56('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c56('0x3'));var util=require(_0x0c56('0x4'));var path=require(_0x0c56('0x5'));var sox=require(_0x0c56('0x6'));var csv=require('to-csv');var ejs=require(_0x0c56('0x7'));var fs=require('fs');var fs_extra=require(_0x0c56('0x8'));var _=require(_0x0c56('0x9'));var squel=require(_0x0c56('0xa'));var crypto=require('crypto');var jsforce=require(_0x0c56('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0c56('0xc'));var querystring=require(_0x0c56('0xd'));var Papa=require(_0x0c56('0xe'));var Redis=require('ioredis');var authService=require(_0x0c56('0xf'));var qs=require(_0x0c56('0x10'));var as=require(_0x0c56('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c56('0x12'))(_0x0c56('0x13'));var utils=require(_0x0c56('0x14'));var config=require(_0x0c56('0x15'));var licenseUtil=require(_0x0c56('0x16'));var db=require(_0x0c56('0x17'))['db'];var jayson=require(_0x0c56('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eab48,_0x3220b1,_0x367417,_0x1bc521){return new BPromise(function(_0x2b220b,_0xdc4827){var _0x57e26b=_0x1bc521||client;return _0x57e26b[_0x0c56('0x19')](_0x2eab48,_0x367417)[_0x0c56('0x1a')](function(_0x218fd7){logger[_0x0c56('0x1b')](_0x0c56('0x1c'),_0x3220b1,'request\x20sent');logger[_0x0c56('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x3220b1,'request\x20sent',JSON[_0x0c56('0x1e')](_0x218fd7));if(_0x218fd7['error']){if(_0x218fd7[_0x0c56('0x1f')]['code']===0x1f4){logger['error'](_0x0c56('0x1c'),_0x3220b1,_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);return _0xdc4827(_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);}logger[_0x0c56('0x1f')](_0x0c56('0x1c'),_0x3220b1,_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);return _0x2b220b(_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);}else{logger[_0x0c56('0x1b')]('Setting,\x20%s,\x20%s',_0x3220b1,'request\x20sent');_0x2b220b(_0x218fd7[_0x0c56('0x21')][_0x0c56('0x20')]);}})[_0x0c56('0x22')](function(_0x12f7a0){logger[_0x0c56('0x1f')]('Setting,\x20%s,\x20%s',_0x3220b1,_0x12f7a0);_0xdc4827(_0x12f7a0);});});}function respondWithStatusCode(_0x39cac2,_0x1b6812){_0x1b6812=_0x1b6812||0xcc;return function(_0x448bad){if(_0x448bad){return _0x39cac2[_0x0c56('0x23')](_0x1b6812);}return _0x39cac2[_0x0c56('0x24')](_0x1b6812)['end']();};}function respondWithResult(_0x2b0c65,_0x58e79d){_0x58e79d=_0x58e79d||0xc8;return function(_0x2b2b07){if(_0x2b2b07){return _0x2b0c65['status'](_0x58e79d)[_0x0c56('0x25')](_0x2b2b07);}};}function respondWithFilteredResult(_0x1f2b4a,_0x885e5c){return function(_0x44d985){if(_0x44d985){var _0x47491=typeof _0x885e5c['offset']===_0x0c56('0x26')&&typeof _0x885e5c['limit']===_0x0c56('0x26');var _0x3a8f23=_0x44d985['count'];var _0x23fd09=_0x47491?0x0:_0x885e5c['offset'];var _0x6acf19=_0x47491?_0x44d985[_0x0c56('0x27')]:_0x885e5c[_0x0c56('0x28')]+_0x885e5c[_0x0c56('0x29')];var _0x3917fb;if(_0x6acf19>=_0x3a8f23){_0x6acf19=_0x3a8f23;_0x3917fb=0xc8;}else{_0x3917fb=0xce;}_0x1f2b4a[_0x0c56('0x24')](_0x3917fb);return _0x1f2b4a[_0x0c56('0x2a')](_0x0c56('0x2b'),_0x23fd09+'-'+_0x6acf19+'/'+_0x3a8f23)['json'](_0x44d985);}return null;};}function patchUpdates(_0x1b3262){return function(_0x10930f){try{jsonpatch['apply'](_0x10930f,_0x1b3262,!![]);}catch(_0x1599b0){return BPromise[_0x0c56('0x2c')](_0x1599b0);}return _0x10930f[_0x0c56('0x2d')]();};}function saveUpdates(_0xa4a241,_0x5c5a41){return function(_0x130278){if(_0x130278){return _0x130278[_0x0c56('0x2e')](_0xa4a241)['then'](function(_0x33b1ca){return _0x33b1ca;});}return null;};}function removeEntity(_0x58ea9e,_0x1fb4c8){return function(_0x199625){if(_0x199625){return _0x199625[_0x0c56('0x2f')]()[_0x0c56('0x1a')](function(){_0x58ea9e[_0x0c56('0x24')](0xcc)[_0x0c56('0x30')]();});}};}function handleEntityNotFound(_0x5a445e,_0x426eb3){return function(_0x24472a){if(!_0x24472a){_0x5a445e['sendStatus'](0x194);}return _0x24472a;};}function handleError(_0x30dd0d,_0xf6c157){_0xf6c157=_0xf6c157||0x1f4;return function(_0x32e3d1){logger[_0x0c56('0x1f')](_0x32e3d1[_0x0c56('0x31')]);if(_0x32e3d1[_0x0c56('0x32')]){delete _0x32e3d1[_0x0c56('0x32')];}_0x30dd0d[_0x0c56('0x24')](_0xf6c157)[_0x0c56('0x33')](_0x32e3d1);};}exports[_0x0c56('0x34')]=function(_0x12aca5,_0x54e7dc){var _0x4a11b6={},_0xf573fe={},_0xa2181c={'count':0x0,'rows':[]};var _0x16fc6f=_[_0x0c56('0x35')](db['Setting'][_0x0c56('0x36')],function(_0x5036ef){return{'name':_0x5036ef[_0x0c56('0x37')],'type':_0x5036ef['type']['key']};});_0xf573fe[_0x0c56('0x38')]=_[_0x0c56('0x35')](_0x16fc6f,'name');_0xf573fe['query']=_[_0x0c56('0x39')](_0x12aca5['query']);_0xf573fe[_0x0c56('0x3a')]=_[_0x0c56('0x3b')](_0xf573fe[_0x0c56('0x38')],_0xf573fe[_0x0c56('0x3c')]);_0x4a11b6[_0x0c56('0x3d')]=_[_0x0c56('0x3b')](_0xf573fe[_0x0c56('0x38')],qs['fields'](_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x3e')]));_0x4a11b6[_0x0c56('0x3d')]=_0x4a11b6['attributes']['length']?_0x4a11b6[_0x0c56('0x3d')]:_0xf573fe[_0x0c56('0x38')];if(!_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x3f')](_0x0c56('0x40'))){_0x4a11b6['limit']=qs[_0x0c56('0x29')](_0x12aca5[_0x0c56('0x3c')]['limit']);_0x4a11b6['offset']=qs[_0x0c56('0x28')](_0x12aca5[_0x0c56('0x3c')]['offset']);}_0x4a11b6[_0x0c56('0x41')]=qs[_0x0c56('0x42')](_0x12aca5[_0x0c56('0x3c')]['sort']);_0x4a11b6[_0x0c56('0x43')]=qs['filters'](_[_0x0c56('0x44')](_0x12aca5['query'],_0xf573fe[_0x0c56('0x3a')]),_0x16fc6f);if(_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x45')]){_0x4a11b6[_0x0c56('0x43')]=_[_0x0c56('0x46')](_0x4a11b6[_0x0c56('0x43')],{'$or':_[_0x0c56('0x35')](_0x16fc6f,function(_0x3015db){if(_0x3015db[_0x0c56('0x47')]!==_0x0c56('0x48')){var _0x12ae86={};_0x12ae86[_0x3015db[_0x0c56('0x32')]]={'$like':'%'+_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x45')]+'%'};return _0x12ae86;}})});}_0x4a11b6=_[_0x0c56('0x46')]({},_0x4a11b6,_0x12aca5[_0x0c56('0x49')]);var _0x5dd815={'where':_0x4a11b6['where']};return db['Setting'][_0x0c56('0x27')](_0x5dd815)[_0x0c56('0x1a')](function(_0x4e1ff6){_0xa2181c[_0x0c56('0x27')]=_0x4e1ff6;if(_0x12aca5['query'][_0x0c56('0x4a')]){_0x4a11b6['include']=[{'all':!![]}];}return db[_0x0c56('0x4b')][_0x0c56('0x4c')](_0x4a11b6);})[_0x0c56('0x1a')](function(_0x447723){_0xa2181c[_0x0c56('0x4d')]=_0x447723;return _0xa2181c;})['then'](respondWithFilteredResult(_0x54e7dc,_0x4a11b6))[_0x0c56('0x22')](handleError(_0x54e7dc,null));};exports[_0x0c56('0x4e')]=function(_0x4bb3ab,_0x496400){var _0x46a62a={'raw':![],'where':{'id':_0x4bb3ab[_0x0c56('0x4f')]['id']}},_0xbcddc2={};_0xbcddc2[_0x0c56('0x38')]=_[_0x0c56('0x39')](db[_0x0c56('0x4b')][_0x0c56('0x36')]);_0xbcddc2[_0x0c56('0x3c')]=_['keys'](_0x4bb3ab[_0x0c56('0x3c')]);_0xbcddc2['filters']=_[_0x0c56('0x3b')](_0xbcddc2[_0x0c56('0x38')],_0xbcddc2[_0x0c56('0x3c')]);_0x46a62a[_0x0c56('0x3d')]=_[_0x0c56('0x3b')](_0xbcddc2['model'],qs[_0x0c56('0x3e')](_0x4bb3ab[_0x0c56('0x3c')]['fields']));_0x46a62a[_0x0c56('0x3d')]=_0x46a62a['attributes'][_0x0c56('0x50')]?_0x46a62a['attributes']:_0xbcddc2[_0x0c56('0x38')];if(_0x4bb3ab[_0x0c56('0x3c')][_0x0c56('0x4a')]){_0x46a62a['include']=[{'all':!![]}];}_0x46a62a=_['merge']({},_0x46a62a,_0x4bb3ab['options']);return db[_0x0c56('0x4b')]['find'](_0x46a62a)['then'](handleEntityNotFound(_0x496400,null))['then'](respondWithResult(_0x496400,null))[_0x0c56('0x22')](handleError(_0x496400,null));};exports['update']=function(_0x26e4e0,_0x1f7711){if(_0x26e4e0['body']['id']){delete _0x26e4e0[_0x0c56('0x51')]['id'];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x26e4e0[_0x0c56('0x4f')]['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x1f7711,null))[_0x0c56('0x1a')](saveUpdates(_0x26e4e0[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x1f7711,null))[_0x0c56('0x22')](handleError(_0x1f7711,null));};exports[_0x0c56('0x53')]=function(_0x1cda0f,_0x1ba609,_0x39f4d8){if(_0x1cda0f[_0x0c56('0x54')]&&_0x1cda0f[_0x0c56('0x54')][_0x0c56('0x55')]){_0x1cda0f[_0x0c56('0x51')][_0x0c56('0x56')]=_0x1cda0f['file'][_0x0c56('0x55')];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x1cda0f[_0x0c56('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ba609,null))[_0x0c56('0x1a')](saveUpdates(_0x1cda0f[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x1ba609,null))[_0x0c56('0x22')](handleError(_0x1ba609,null));};exports[_0x0c56('0x57')]=function(_0x59c0f4,_0x410fb9,_0x17e459){if(_0x59c0f4[_0x0c56('0x54')]&&_0x59c0f4[_0x0c56('0x54')][_0x0c56('0x55')]){_0x59c0f4[_0x0c56('0x51')][_0x0c56('0x58')]=_0x59c0f4[_0x0c56('0x54')][_0x0c56('0x55')];}return db['Setting'][_0x0c56('0x52')]({'where':{'id':_0x59c0f4[_0x0c56('0x4f')]['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x410fb9,null))[_0x0c56('0x1a')](saveUpdates(_0x59c0f4[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x410fb9,null))[_0x0c56('0x22')](handleError(_0x410fb9,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x59')]=function(_0xfd18eb,_0x53d562,_0xc2e38e){var _0x3d58da='server/files/images/logos';var _0x36c4b1={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x20cc0e){if(_0x20cc0e){_0x36c4b1=_0x20cc0e;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0xfd18eb[_0x0c56('0x4f')]['id']},'attributes':['logo',_0x0c56('0x58'),_0x0c56('0x5b'),'favicon',_0x0c56('0x5c'),_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x53d562,null))['then'](function(_0x2f2e43){if(_0x2f2e43){var _0x460d21=_0x2f2e43[_0x0c56('0x56')]&&fs[_0x0c56('0x60')](path['join'](config['root'],_0x3d58da,_[_0x0c56('0x61')](_0x2f2e43[_0x0c56('0x56')])))?path[_0x0c56('0x62')](config['root'],_0x3d58da,_[_0x0c56('0x61')](_0x2f2e43[_0x0c56('0x56')])):path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x3d58da,_[_0x0c56('0x61')]('default_logo.svg'));var _0x3810ce='default'+_[_0x0c56('0x64')]('logo');if(_0x2f2e43[_0x3810ce]||!_0x36c4b1[_0x0c56('0x65')]){_0x460d21=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x3d58da,_['toLower']('default_logo.svg'));}if(!fs[_0x0c56('0x60')](_0x460d21)){throw new db[(_0x0c56('0x66'))][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x56'))+_0x0c56('0x68'));}return _0x53d562[_0x0c56('0x69')](_0x460d21);}})['catch'](handleError(_0x53d562,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x6a')]=function(_0x18b6df,_0x43656a,_0x5e92e4){var _0x520263=_0x0c56('0x6b');var _0x23368d={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x255c49){if(_0x255c49){_0x23368d=_0x255c49;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x18b6df[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x56'),_0x0c56('0x58'),_0x0c56('0x5b'),'favicon',_0x0c56('0x5c'),_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x43656a,null))[_0x0c56('0x1a')](function(_0xb3f2af){if(_0xb3f2af){var _0x189933=_0xb3f2af['loginLogo']&&fs[_0x0c56('0x60')](path['join'](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')](_0xb3f2af['loginLogo'])))?path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')](_0xb3f2af[_0x0c56('0x58')])):path[_0x0c56('0x62')](config['root'],_0x520263,_['toLower']('default_loginLogo.svg'));var _0x57f818=_0x0c56('0x6c')+_[_0x0c56('0x64')](_0x0c56('0x58'));if(_0xb3f2af[_0x57f818]||!_0x23368d[_0x0c56('0x65')]){_0x189933=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')]('default_loginLogo.svg'));}if(!fs[_0x0c56('0x60')](_0x189933)){throw new db[(_0x0c56('0x66'))]['ValidationError'](_[_0x0c56('0x64')]('loginLogo')+'\x20not\x20found');}return _0x43656a[_0x0c56('0x69')](_0x189933);}})['catch'](handleError(_0x43656a,null));};exports['gdpr']=function(_0x76dd5a,_0x7ece5d){return db['Setting']['find']({'where':{'id':_0x76dd5a[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x6d')]})[_0x0c56('0x1a')](respondWithResult(_0x7ece5d,null))[_0x0c56('0x22')](handleError(_0x7ece5d,null));};exports['addPreferred']=function(_0x2d2629,_0x594fc9,_0x3e43fc){if(_0x2d2629['file']&&_0x2d2629[_0x0c56('0x54')][_0x0c56('0x55')]){_0x2d2629[_0x0c56('0x51')][_0x0c56('0x5b')]=_0x2d2629[_0x0c56('0x54')][_0x0c56('0x55')];}return db['Setting'][_0x0c56('0x52')]({'where':{'id':_0x2d2629['params']['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x594fc9,null))['then'](saveUpdates(_0x2d2629[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x594fc9,null))[_0x0c56('0x22')](handleError(_0x594fc9,null));};var utilLicense=require(_0x0c56('0x16'));exports['getPreferred']=function(_0x4d24d7,_0x42ffcd,_0x17889a){var _0x4469f8='server/files/images/logos';var _0x451914={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x759e49){if(_0x759e49){_0x451914=_0x759e49;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x4d24d7[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x56'),'loginLogo',_0x0c56('0x5b'),_0x0c56('0x6e'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x42ffcd,null))[_0x0c56('0x1a')](function(_0x3a2514){if(_0x3a2514){var _0x45b70f=_0x3a2514[_0x0c56('0x5b')]&&fs[_0x0c56('0x60')](path[_0x0c56('0x62')](config['root'],_0x4469f8,_['toLower'](_0x3a2514[_0x0c56('0x5b')])))?path[_0x0c56('0x62')](config['root'],_0x4469f8,_[_0x0c56('0x61')](_0x3a2514[_0x0c56('0x5b')])):path[_0x0c56('0x62')](config['root'],_0x4469f8,_[_0x0c56('0x61')](_0x0c56('0x6f')));var _0x48a412=_0x0c56('0x6c')+_[_0x0c56('0x64')]('preferred');if(_0x3a2514[_0x48a412]||!_0x451914['custom']||!_0x451914[_0x0c56('0x5b')]){_0x45b70f=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x4469f8,_[_0x0c56('0x61')](_0x0c56('0x6f')));}if(!fs[_0x0c56('0x60')](_0x45b70f)){throw new db['Sequelize'][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x5b'))+'\x20not\x20found');}return _0x42ffcd[_0x0c56('0x69')](_0x45b70f);}})['catch'](handleError(_0x42ffcd,null));};exports[_0x0c56('0x70')]=function(_0x18c0db,_0x4e1a9e,_0x22cb46){if(_0x18c0db[_0x0c56('0x54')]&&_0x18c0db['file'][_0x0c56('0x55')]){_0x18c0db['body'][_0x0c56('0x6e')]=_0x18c0db[_0x0c56('0x54')][_0x0c56('0x55')];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x18c0db[_0x0c56('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4e1a9e,null))[_0x0c56('0x1a')](saveUpdates(_0x18c0db[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x4e1a9e,null))[_0x0c56('0x22')](handleError(_0x4e1a9e,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x71')]=function(_0x4348cd,_0x5ea823,_0x4b2bba){var _0x2a4995=_0x0c56('0x6b');var _0x30c73a={'custom':![]};return utilLicense[_0x0c56('0x5a')]()['then'](function(_0x44829b){if(_0x44829b){_0x30c73a=_0x44829b;}return db[_0x0c56('0x4b')]['find']({'where':{'id':_0x4348cd['params']['id']},'attributes':['logo',_0x0c56('0x58'),_0x0c56('0x5b'),'favicon','defaultLogo',_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x5ea823,null))['then'](function(_0x30b9a1){if(_0x30b9a1){var _0x2830f8=_0x30b9a1[_0x0c56('0x6e')]&&fs[_0x0c56('0x60')](path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_['toLower'](_0x30b9a1['favicon'])))?path['join'](config['root'],_0x2a4995,_[_0x0c56('0x61')](_0x30b9a1[_0x0c56('0x6e')])):path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_[_0x0c56('0x61')](_0x0c56('0x72')));var _0x3e7daa=_0x0c56('0x6c')+_[_0x0c56('0x64')](_0x0c56('0x6e'));if(_0x30b9a1[_0x3e7daa]||!_0x30c73a[_0x0c56('0x65')]){_0x2830f8=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_[_0x0c56('0x61')]('default_favicon.ico'));}if(!fs[_0x0c56('0x60')](_0x2830f8)){throw new db[(_0x0c56('0x66'))][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x6e'))+'\x20not\x20found');}return _0x5ea823[_0x0c56('0x69')](_0x2830f8);}})[_0x0c56('0x22')](handleError(_0x5ea823,null));};exports[_0x0c56('0x73')]=function(_0x54cbc2,_0x9f3306){var _0x5df555={'offset':moment()[_0x0c56('0x74')]()};_0x5df555[_0x0c56('0x75')]=moment()[_0x0c56('0x74')](_0x5df555[_0x0c56('0x28')])[_0x0c56('0x76')](_0x0c56('0x77'));return _0x9f3306[_0x0c56('0x24')](0xc8)[_0x0c56('0x33')](_0x5df555);}; \ No newline at end of file +var _0x1ac8=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','stack','name','send','index','map','Setting','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','body','addLogo','file','filename','params','addLogoLogin','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','../../config/license/util','getLogoLogin','loginLogo','defaultLogo','default_loginLogo.svg','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4848cf,_0x127821){var _0x587c5f=function(_0x38df40){while(--_0x38df40){_0x4848cf['push'](_0x4848cf['shift']());}};_0x587c5f(++_0x127821);}(_0x1ac8,0xed));var _0x81ac=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1ac8[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x81ac('0x0'));var rimraf=require(_0x81ac('0x1'));var zipdir=require(_0x81ac('0x2'));var jsonpatch=require(_0x81ac('0x3'));var rp=require(_0x81ac('0x4'));var moment=require('moment');var BPromise=require(_0x81ac('0x5'));var Mustache=require(_0x81ac('0x6'));var util=require(_0x81ac('0x7'));var path=require(_0x81ac('0x8'));var sox=require(_0x81ac('0x9'));var csv=require(_0x81ac('0xa'));var ejs=require(_0x81ac('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81ac('0xc'));var squel=require(_0x81ac('0xd'));var crypto=require(_0x81ac('0xe'));var jsforce=require(_0x81ac('0xf'));var deskjs=require(_0x81ac('0x10'));var toCsv=require(_0x81ac('0xa'));var querystring=require(_0x81ac('0x11'));var Papa=require(_0x81ac('0x12'));var Redis=require(_0x81ac('0x13'));var authService=require(_0x81ac('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x81ac('0x15'));var hardwareService=require(_0x81ac('0x16'));var logger=require('../../config/logger')(_0x81ac('0x17'));var utils=require('../../config/utils');var config=require(_0x81ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x81ac('0x19'))['db'];var jayson=require(_0x81ac('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14d758,_0x52f486,_0x37da51,_0x4bed6b){return new BPromise(function(_0x42f333,_0x58d43c){var _0x9174e=_0x4bed6b||client;return _0x9174e[_0x81ac('0x1b')](_0x14d758,_0x37da51)[_0x81ac('0x1c')](function(_0x53f61f){logger[_0x81ac('0x1d')](_0x81ac('0x1e'),_0x52f486,'request\x20sent');logger[_0x81ac('0x1f')](_0x81ac('0x20'),_0x52f486,_0x81ac('0x21'),JSON[_0x81ac('0x22')](_0x53f61f));if(_0x53f61f['error']){if(_0x53f61f[_0x81ac('0x23')]['code']===0x1f4){logger['error'](_0x81ac('0x1e'),_0x52f486,_0x53f61f[_0x81ac('0x23')][_0x81ac('0x24')]);return _0x58d43c(_0x53f61f[_0x81ac('0x23')][_0x81ac('0x24')]);}logger[_0x81ac('0x23')](_0x81ac('0x1e'),_0x52f486,_0x53f61f[_0x81ac('0x23')][_0x81ac('0x24')]);return _0x42f333(_0x53f61f['error'][_0x81ac('0x24')]);}else{logger[_0x81ac('0x1d')](_0x81ac('0x1e'),_0x52f486,_0x81ac('0x21'));_0x42f333(_0x53f61f[_0x81ac('0x25')][_0x81ac('0x24')]);}})[_0x81ac('0x26')](function(_0x50a509){logger['error'](_0x81ac('0x1e'),_0x52f486,_0x50a509);_0x58d43c(_0x50a509);});});}function respondWithStatusCode(_0x40692b,_0x2e69f6){_0x2e69f6=_0x2e69f6||0xcc;return function(_0x4e1f9d){if(_0x4e1f9d){return _0x40692b[_0x81ac('0x27')](_0x2e69f6);}return _0x40692b[_0x81ac('0x28')](_0x2e69f6)[_0x81ac('0x29')]();};}function respondWithResult(_0x5f4832,_0x427e59){_0x427e59=_0x427e59||0xc8;return function(_0x13b761){if(_0x13b761){return _0x5f4832['status'](_0x427e59)['json'](_0x13b761);}};}function respondWithFilteredResult(_0x1e26ad,_0x373887){return function(_0x173abc){if(_0x173abc){var _0x392023=typeof _0x373887[_0x81ac('0x2a')]===_0x81ac('0x2b')&&typeof _0x373887[_0x81ac('0x2c')]===_0x81ac('0x2b');var _0xacce02=_0x173abc[_0x81ac('0x2d')];var _0x44ef40=_0x392023?0x0:_0x373887['offset'];var _0x3f579b=_0x392023?_0x173abc[_0x81ac('0x2d')]:_0x373887[_0x81ac('0x2a')]+_0x373887['limit'];var _0x837d4f;if(_0x3f579b>=_0xacce02){_0x3f579b=_0xacce02;_0x837d4f=0xc8;}else{_0x837d4f=0xce;}_0x1e26ad['status'](_0x837d4f);return _0x1e26ad[_0x81ac('0x2e')](_0x81ac('0x2f'),_0x44ef40+'-'+_0x3f579b+'/'+_0xacce02)[_0x81ac('0x30')](_0x173abc);}return null;};}function patchUpdates(_0x27a94f){return function(_0x468ed6){try{jsonpatch[_0x81ac('0x31')](_0x468ed6,_0x27a94f,!![]);}catch(_0xb88008){return BPromise[_0x81ac('0x32')](_0xb88008);}return _0x468ed6['save']();};}function saveUpdates(_0x3fc0aa,_0x37a997){return function(_0x353ddf){if(_0x353ddf){return _0x353ddf[_0x81ac('0x33')](_0x3fc0aa)['then'](function(_0x49a4df){return _0x49a4df;});}return null;};}function removeEntity(_0x1cbef0,_0x3859c8){return function(_0x161f3a){if(_0x161f3a){return _0x161f3a['destroy']()['then'](function(){_0x1cbef0[_0x81ac('0x28')](0xcc)[_0x81ac('0x29')]();});}};}function handleEntityNotFound(_0x3974d1,_0x24dece){return function(_0x21b4ba){if(!_0x21b4ba){_0x3974d1[_0x81ac('0x27')](0x194);}return _0x21b4ba;};}function handleError(_0x1e2574,_0xed40e3){_0xed40e3=_0xed40e3||0x1f4;return function(_0xbeaaf1){logger['error'](_0xbeaaf1[_0x81ac('0x34')]);if(_0xbeaaf1['name']){delete _0xbeaaf1[_0x81ac('0x35')];}_0x1e2574[_0x81ac('0x28')](_0xed40e3)[_0x81ac('0x36')](_0xbeaaf1);};}exports[_0x81ac('0x37')]=function(_0x209e7b,_0x4ea195){var _0x4f6a4d={},_0x56eaa1={},_0x27b5da={'count':0x0,'rows':[]};var _0x38f55a=_[_0x81ac('0x38')](db[_0x81ac('0x39')]['rawAttributes'],function(_0x5815d9){return{'name':_0x5815d9['fieldName'],'type':_0x5815d9[_0x81ac('0x3a')][_0x81ac('0x3b')]};});_0x56eaa1[_0x81ac('0x3c')]=_[_0x81ac('0x38')](_0x38f55a,_0x81ac('0x35'));_0x56eaa1[_0x81ac('0x3d')]=_['keys'](_0x209e7b[_0x81ac('0x3d')]);_0x56eaa1[_0x81ac('0x3e')]=_[_0x81ac('0x3f')](_0x56eaa1[_0x81ac('0x3c')],_0x56eaa1[_0x81ac('0x3d')]);_0x4f6a4d[_0x81ac('0x40')]=_[_0x81ac('0x3f')](_0x56eaa1[_0x81ac('0x3c')],qs[_0x81ac('0x41')](_0x209e7b[_0x81ac('0x3d')][_0x81ac('0x41')]));_0x4f6a4d[_0x81ac('0x40')]=_0x4f6a4d[_0x81ac('0x40')][_0x81ac('0x42')]?_0x4f6a4d[_0x81ac('0x40')]:_0x56eaa1[_0x81ac('0x3c')];if(!_0x209e7b[_0x81ac('0x3d')][_0x81ac('0x43')](_0x81ac('0x44'))){_0x4f6a4d[_0x81ac('0x2c')]=qs[_0x81ac('0x2c')](_0x209e7b[_0x81ac('0x3d')][_0x81ac('0x2c')]);_0x4f6a4d[_0x81ac('0x2a')]=qs[_0x81ac('0x2a')](_0x209e7b[_0x81ac('0x3d')][_0x81ac('0x2a')]);}_0x4f6a4d['order']=qs[_0x81ac('0x45')](_0x209e7b[_0x81ac('0x3d')]['sort']);_0x4f6a4d['where']=qs[_0x81ac('0x3e')](_[_0x81ac('0x46')](_0x209e7b[_0x81ac('0x3d')],_0x56eaa1[_0x81ac('0x3e')]),_0x38f55a);if(_0x209e7b[_0x81ac('0x3d')][_0x81ac('0x47')]){_0x4f6a4d[_0x81ac('0x48')]=_[_0x81ac('0x49')](_0x4f6a4d[_0x81ac('0x48')],{'$or':_[_0x81ac('0x38')](_0x38f55a,function(_0x49d509){if(_0x49d509['type']!=='VIRTUAL'){var _0xfff966={};_0xfff966[_0x49d509[_0x81ac('0x35')]]={'$like':'%'+_0x209e7b[_0x81ac('0x3d')]['filter']+'%'};return _0xfff966;}})});}_0x4f6a4d=_[_0x81ac('0x49')]({},_0x4f6a4d,_0x209e7b[_0x81ac('0x4a')]);var _0x2c5b78={'where':_0x4f6a4d['where']};return db[_0x81ac('0x39')][_0x81ac('0x2d')](_0x2c5b78)[_0x81ac('0x1c')](function(_0x197892){_0x27b5da[_0x81ac('0x2d')]=_0x197892;if(_0x209e7b[_0x81ac('0x3d')]['includeAll']){_0x4f6a4d[_0x81ac('0x4b')]=[{'all':!![]}];}return db[_0x81ac('0x39')][_0x81ac('0x4c')](_0x4f6a4d);})[_0x81ac('0x1c')](function(_0x15f64f){_0x27b5da[_0x81ac('0x4d')]=_0x15f64f;return _0x27b5da;})[_0x81ac('0x1c')](respondWithFilteredResult(_0x4ea195,_0x4f6a4d))[_0x81ac('0x26')](handleError(_0x4ea195,null));};exports[_0x81ac('0x4e')]=function(_0x238058,_0x360945){var _0x4b8a6d={'raw':![],'where':{'id':_0x238058['params']['id']}},_0x2ccb70={};_0x2ccb70[_0x81ac('0x3c')]=_[_0x81ac('0x4f')](db[_0x81ac('0x39')][_0x81ac('0x50')]);_0x2ccb70[_0x81ac('0x3d')]=_['keys'](_0x238058['query']);_0x2ccb70['filters']=_[_0x81ac('0x3f')](_0x2ccb70['model'],_0x2ccb70['query']);_0x4b8a6d[_0x81ac('0x40')]=_['intersection'](_0x2ccb70['model'],qs[_0x81ac('0x41')](_0x238058[_0x81ac('0x3d')][_0x81ac('0x41')]));_0x4b8a6d[_0x81ac('0x40')]=_0x4b8a6d[_0x81ac('0x40')][_0x81ac('0x42')]?_0x4b8a6d[_0x81ac('0x40')]:_0x2ccb70['model'];if(_0x238058['query'][_0x81ac('0x51')]){_0x4b8a6d[_0x81ac('0x4b')]=[{'all':!![]}];}_0x4b8a6d=_[_0x81ac('0x49')]({},_0x4b8a6d,_0x238058[_0x81ac('0x4a')]);return db[_0x81ac('0x39')][_0x81ac('0x52')](_0x4b8a6d)[_0x81ac('0x1c')](handleEntityNotFound(_0x360945,null))['then'](respondWithResult(_0x360945,null))[_0x81ac('0x26')](handleError(_0x360945,null));};exports[_0x81ac('0x33')]=function(_0x36d1af,_0x36a0eb){if(_0x36d1af[_0x81ac('0x53')]['id']){delete _0x36d1af[_0x81ac('0x53')]['id'];}return db['Setting'][_0x81ac('0x52')]({'where':{'id':_0x36d1af['params']['id']}})['then'](handleEntityNotFound(_0x36a0eb,null))['then'](saveUpdates(_0x36d1af[_0x81ac('0x53')],null))[_0x81ac('0x1c')](respondWithResult(_0x36a0eb,null))[_0x81ac('0x26')](handleError(_0x36a0eb,null));};exports[_0x81ac('0x54')]=function(_0x57b354,_0x4eca88,_0x3bac4f){if(_0x57b354['file']&&_0x57b354[_0x81ac('0x55')][_0x81ac('0x56')]){_0x57b354[_0x81ac('0x53')]['logo']=_0x57b354['file'][_0x81ac('0x56')];}return db[_0x81ac('0x39')][_0x81ac('0x52')]({'where':{'id':_0x57b354[_0x81ac('0x57')]['id']}})[_0x81ac('0x1c')](handleEntityNotFound(_0x4eca88,null))[_0x81ac('0x1c')](saveUpdates(_0x57b354[_0x81ac('0x53')],null))['then'](respondWithResult(_0x4eca88,null))[_0x81ac('0x26')](handleError(_0x4eca88,null));};exports[_0x81ac('0x58')]=function(_0x5926b5,_0x104bbd,_0xe29c64){if(_0x5926b5['file']&&_0x5926b5[_0x81ac('0x55')]['filename']){_0x5926b5['body']['loginLogo']=_0x5926b5[_0x81ac('0x55')]['filename'];}return db[_0x81ac('0x39')][_0x81ac('0x52')]({'where':{'id':_0x5926b5[_0x81ac('0x57')]['id']}})['then'](handleEntityNotFound(_0x104bbd,null))[_0x81ac('0x1c')](saveUpdates(_0x5926b5[_0x81ac('0x53')],null))[_0x81ac('0x1c')](respondWithResult(_0x104bbd,null))[_0x81ac('0x26')](handleError(_0x104bbd,null));};var utilLicense=require('../../config/license/util');exports[_0x81ac('0x59')]=function(_0x1fa6d3,_0x217092,_0x5d3c87){var _0x1f7b1d=_0x81ac('0x5a');var _0x269aab={'custom':![]};return utilLicense[_0x81ac('0x5b')]()[_0x81ac('0x1c')](function(_0x4ff249){if(_0x4ff249){_0x269aab=_0x4ff249;}return db[_0x81ac('0x39')][_0x81ac('0x52')]({'where':{'id':_0x1fa6d3['params']['id']},'attributes':[_0x81ac('0x5c'),'loginLogo',_0x81ac('0x5d'),_0x81ac('0x5e'),'defaultLogo','defaultLoginLogo',_0x81ac('0x5f'),_0x81ac('0x60')],'raw':!![]});})[_0x81ac('0x1c')](handleEntityNotFound(_0x217092,null))[_0x81ac('0x1c')](function(_0x24f6bd){if(_0x24f6bd){var _0x494cbe=_0x24f6bd[_0x81ac('0x5c')]&&fs['existsSync'](path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x1f7b1d,_['toLower'](_0x24f6bd[_0x81ac('0x5c')])))?path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x1f7b1d,_[_0x81ac('0x63')](_0x24f6bd['logo'])):path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x1f7b1d,_[_0x81ac('0x63')](_0x81ac('0x64')));var _0x4a184c=_0x81ac('0x65')+_[_0x81ac('0x66')]('logo');if(_0x24f6bd[_0x4a184c]||!_0x269aab[_0x81ac('0x67')]){_0x494cbe=path[_0x81ac('0x61')](config['root'],_0x1f7b1d,_[_0x81ac('0x63')]('default_logo.svg'));}if(!fs[_0x81ac('0x68')](_0x494cbe)){throw new db[(_0x81ac('0x69'))][(_0x81ac('0x6a'))](_[_0x81ac('0x66')](_0x81ac('0x5c'))+_0x81ac('0x6b'));}return _0x217092[_0x81ac('0x6c')](_0x494cbe);}})[_0x81ac('0x26')](handleError(_0x217092,null));};var utilLicense=require(_0x81ac('0x6d'));exports[_0x81ac('0x6e')]=function(_0x1e8ce0,_0x23ada0,_0x567f54){var _0x25c189=_0x81ac('0x5a');var _0x21879a={'custom':![]};return utilLicense[_0x81ac('0x5b')]()[_0x81ac('0x1c')](function(_0x795e75){if(_0x795e75){_0x21879a=_0x795e75;}return db[_0x81ac('0x39')]['find']({'where':{'id':_0x1e8ce0[_0x81ac('0x57')]['id']},'attributes':[_0x81ac('0x5c'),_0x81ac('0x6f'),_0x81ac('0x5d'),'favicon',_0x81ac('0x70'),'defaultLoginLogo',_0x81ac('0x5f'),_0x81ac('0x60')],'raw':!![]});})[_0x81ac('0x1c')](handleEntityNotFound(_0x23ada0,null))[_0x81ac('0x1c')](function(_0x1b2738){if(_0x1b2738){var _0x4adcef=_0x1b2738[_0x81ac('0x6f')]&&fs['existsSync'](path[_0x81ac('0x61')](config['root'],_0x25c189,_[_0x81ac('0x63')](_0x1b2738[_0x81ac('0x6f')])))?path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x25c189,_[_0x81ac('0x63')](_0x1b2738[_0x81ac('0x6f')])):path['join'](config[_0x81ac('0x62')],_0x25c189,_[_0x81ac('0x63')](_0x81ac('0x71')));var _0x5f2cee=_0x81ac('0x65')+_[_0x81ac('0x66')](_0x81ac('0x6f'));if(_0x1b2738[_0x5f2cee]||!_0x21879a['custom']){_0x4adcef=path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x25c189,_['toLower'](_0x81ac('0x71')));}if(!fs[_0x81ac('0x68')](_0x4adcef)){throw new db['Sequelize'][(_0x81ac('0x6a'))](_[_0x81ac('0x66')]('loginLogo')+_0x81ac('0x6b'));}return _0x23ada0[_0x81ac('0x6c')](_0x4adcef);}})['catch'](handleError(_0x23ada0,null));};exports[_0x81ac('0x72')]=function(_0x3ddfce,_0x2149ed){return db[_0x81ac('0x39')]['find']({'where':{'id':_0x3ddfce[_0x81ac('0x57')]['id']},'attributes':['securePassword']})[_0x81ac('0x1c')](respondWithResult(_0x2149ed,null))[_0x81ac('0x26')](handleError(_0x2149ed,null));};exports['addPreferred']=function(_0x48a692,_0x3cddf8,_0x5cd5d4){if(_0x48a692[_0x81ac('0x55')]&&_0x48a692[_0x81ac('0x55')][_0x81ac('0x56')]){_0x48a692[_0x81ac('0x53')][_0x81ac('0x5d')]=_0x48a692[_0x81ac('0x55')]['filename'];}return db[_0x81ac('0x39')][_0x81ac('0x52')]({'where':{'id':_0x48a692[_0x81ac('0x57')]['id']}})[_0x81ac('0x1c')](handleEntityNotFound(_0x3cddf8,null))['then'](saveUpdates(_0x48a692[_0x81ac('0x53')],null))[_0x81ac('0x1c')](respondWithResult(_0x3cddf8,null))[_0x81ac('0x26')](handleError(_0x3cddf8,null));};var utilLicense=require(_0x81ac('0x6d'));exports['getPreferred']=function(_0xfa1a9,_0x265bba,_0x1ef47e){var _0x246b36=_0x81ac('0x5a');var _0x167770={'custom':![]};return utilLicense[_0x81ac('0x5b')]()[_0x81ac('0x1c')](function(_0x4861b1){if(_0x4861b1){_0x167770=_0x4861b1;}return db['Setting'][_0x81ac('0x52')]({'where':{'id':_0xfa1a9[_0x81ac('0x57')]['id']},'attributes':[_0x81ac('0x5c'),'loginLogo','preferred','favicon',_0x81ac('0x70'),'defaultLoginLogo','defaultPreferred',_0x81ac('0x60')],'raw':!![]});})[_0x81ac('0x1c')](handleEntityNotFound(_0x265bba,null))[_0x81ac('0x1c')](function(_0x37d0f1){if(_0x37d0f1){var _0x5436a9=_0x37d0f1[_0x81ac('0x5d')]&&fs['existsSync'](path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x246b36,_[_0x81ac('0x63')](_0x37d0f1[_0x81ac('0x5d')])))?path['join'](config[_0x81ac('0x62')],_0x246b36,_[_0x81ac('0x63')](_0x37d0f1[_0x81ac('0x5d')])):path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x246b36,_[_0x81ac('0x63')](_0x81ac('0x73')));var _0x29ae15='default'+_[_0x81ac('0x66')]('preferred');if(_0x37d0f1[_0x29ae15]||!_0x167770['custom']||!_0x167770[_0x81ac('0x5d')]){_0x5436a9=path['join'](config[_0x81ac('0x62')],_0x246b36,_[_0x81ac('0x63')](_0x81ac('0x73')));}if(!fs[_0x81ac('0x68')](_0x5436a9)){throw new db[(_0x81ac('0x69'))][(_0x81ac('0x6a'))](_['upperFirst'](_0x81ac('0x5d'))+_0x81ac('0x6b'));}return _0x265bba[_0x81ac('0x6c')](_0x5436a9);}})['catch'](handleError(_0x265bba,null));};exports[_0x81ac('0x74')]=function(_0x362bf4,_0x3b8a63,_0x3e16a6){if(_0x362bf4[_0x81ac('0x55')]&&_0x362bf4[_0x81ac('0x55')][_0x81ac('0x56')]){_0x362bf4[_0x81ac('0x53')]['favicon']=_0x362bf4['file']['filename'];}return db[_0x81ac('0x39')]['find']({'where':{'id':_0x362bf4[_0x81ac('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b8a63,null))['then'](saveUpdates(_0x362bf4[_0x81ac('0x53')],null))[_0x81ac('0x1c')](respondWithResult(_0x3b8a63,null))[_0x81ac('0x26')](handleError(_0x3b8a63,null));};var utilLicense=require(_0x81ac('0x6d'));exports[_0x81ac('0x75')]=function(_0x360d93,_0x1be688,_0x394c95){var _0x2ecdb6=_0x81ac('0x5a');var _0x142f96={'custom':![]};return utilLicense['getLicense']()[_0x81ac('0x1c')](function(_0x379076){if(_0x379076){_0x142f96=_0x379076;}return db[_0x81ac('0x39')][_0x81ac('0x52')]({'where':{'id':_0x360d93[_0x81ac('0x57')]['id']},'attributes':[_0x81ac('0x5c'),_0x81ac('0x6f'),_0x81ac('0x5d'),_0x81ac('0x5e'),_0x81ac('0x70'),'defaultLoginLogo',_0x81ac('0x5f'),_0x81ac('0x60')],'raw':!![]});})[_0x81ac('0x1c')](handleEntityNotFound(_0x1be688,null))[_0x81ac('0x1c')](function(_0x1e9129){if(_0x1e9129){var _0x431dd8=_0x1e9129['favicon']&&fs[_0x81ac('0x68')](path[_0x81ac('0x61')](config['root'],_0x2ecdb6,_[_0x81ac('0x63')](_0x1e9129[_0x81ac('0x5e')])))?path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x2ecdb6,_[_0x81ac('0x63')](_0x1e9129[_0x81ac('0x5e')])):path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x2ecdb6,_['toLower'](_0x81ac('0x76')));var _0x2eae08=_0x81ac('0x65')+_[_0x81ac('0x66')](_0x81ac('0x5e'));if(_0x1e9129[_0x2eae08]||!_0x142f96[_0x81ac('0x67')]){_0x431dd8=path[_0x81ac('0x61')](config[_0x81ac('0x62')],_0x2ecdb6,_[_0x81ac('0x63')]('default_favicon.ico'));}if(!fs[_0x81ac('0x68')](_0x431dd8)){throw new db[(_0x81ac('0x69'))]['ValidationError'](_[_0x81ac('0x66')](_0x81ac('0x5e'))+_0x81ac('0x6b'));}return _0x1be688[_0x81ac('0x6c')](_0x431dd8);}})[_0x81ac('0x26')](handleError(_0x1be688,null));};exports[_0x81ac('0x77')]=function(_0x397e95,_0x58b0f2){var _0x1d4c9c={'offset':moment()[_0x81ac('0x78')]()};_0x1d4c9c[_0x81ac('0x79')]=moment()[_0x81ac('0x78')](_0x1d4c9c[_0x81ac('0x2a')])[_0x81ac('0x7a')](_0x81ac('0x7b'));return _0x58b0f2['status'](0xc8)[_0x81ac('0x36')](_0x1d4c9c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7344f90..979afd9 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(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3e74,0x175));var _0x43e7=function(_0x590d82,_0x4beac2){_0x590d82=_0x590d82-0x0;var _0x4fa214=_0x3e74[_0x590d82];return _0x4fa214;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index dcf7bce..a4d123e 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 _0xd632=['request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xd632,0xd5));var _0x2d63=function(_0x35116d,_0x30c8c7){_0x35116d=_0x35116d-0x0;var _0x16b2ab=_0xd632[_0x35116d];return _0x16b2ab;};'use strict';var _=require(_0x2d63('0x0'));var util=require(_0x2d63('0x1'));var moment=require(_0x2d63('0x2'));var BPromise=require(_0x2d63('0x3'));var rs=require(_0x2d63('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d63('0x5'));var logger=require(_0x2d63('0x6'))('rpc');var config=require(_0x2d63('0x7'));var jayson=require(_0x2d63('0x8'));var client=jayson[_0x2d63('0x9')][_0x2d63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c2c9,_0x17f0ab,_0x224664){return new BPromise(function(_0x295af4,_0x4f841b){return client[_0x2d63('0xb')](_0x52c2c9,_0x224664)['then'](function(_0x52ba0d){logger[_0x2d63('0xc')]('Setting,\x20%s,\x20%s',_0x17f0ab,_0x2d63('0xd'));logger[_0x2d63('0xe')](_0x2d63('0xf'),_0x17f0ab,_0x2d63('0xd'),JSON['stringify'](_0x52ba0d));if(_0x52ba0d[_0x2d63('0x10')]){if(_0x52ba0d['error'][_0x2d63('0x11')]===0x1f4){logger[_0x2d63('0x10')](_0x2d63('0x12'),_0x17f0ab,_0x52ba0d[_0x2d63('0x10')][_0x2d63('0x13')]);return _0x4f841b(_0x52ba0d['error'][_0x2d63('0x13')]);}logger[_0x2d63('0x10')]('Setting,\x20%s,\x20%s',_0x17f0ab,_0x52ba0d[_0x2d63('0x10')]['message']);return _0x295af4(_0x52ba0d[_0x2d63('0x10')]['message']);}else{logger[_0x2d63('0xc')](_0x2d63('0x12'),_0x17f0ab,_0x2d63('0xd'));_0x295af4(_0x52ba0d['result'][_0x2d63('0x13')]);}})[_0x2d63('0x14')](function(_0x4065b5){logger['error'](_0x2d63('0x12'),_0x17f0ab,_0x4065b5);_0x4f841b(_0x4065b5);});});}exports[_0x2d63('0x15')]=function(_0x363803){var _0x2db3c2=this;return new Promise(function(_0x52648d,_0x34b42d){return db[_0x2d63('0x16')][_0x2d63('0x17')]({'raw':_0x363803[_0x2d63('0x18')]?_0x363803['options'][_0x2d63('0x19')]===undefined?!![]:![]:!![],'where':_0x363803[_0x2d63('0x18')]?_0x363803[_0x2d63('0x18')][_0x2d63('0x1a')]||null:null,'attributes':_0x363803[_0x2d63('0x18')]?_0x363803[_0x2d63('0x18')][_0x2d63('0x1b')]||null:null,'include':_0x363803['options']?_0x363803[_0x2d63('0x18')][_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x363803['options'][_0x2d63('0x1c')],function(_0x13c858){return{'model':db[_0x13c858[_0x2d63('0x1e')]],'as':_0x13c858['as'],'attributes':_0x13c858[_0x2d63('0x1b')],'include':_0x13c858[_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x13c858['include'],function(_0x1c2009){return{'model':db[_0x1c2009[_0x2d63('0x1e')]],'as':_0x1c2009['as'],'attributes':_0x1c2009[_0x2d63('0x1b')],'include':_0x1c2009[_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x1c2009[_0x2d63('0x1c')],function(_0x5d4f96){return{'model':db[_0x5d4f96[_0x2d63('0x1e')]],'as':_0x5d4f96['as'],'attributes':_0x5d4f96[_0x2d63('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa86127){logger[_0x2d63('0xc')](_0x2d63('0x15'),_0x363803);logger['debug'](_0x2d63('0x15'),_0x363803,JSON[_0x2d63('0x1f')](_0xa86127));_0x52648d(_0xa86127);})['catch'](function(_0x2a5324){logger['error']('ShowSetting',_0x2a5324[_0x2d63('0x13')],_0x363803);_0x34b42d(_0x2db3c2['error'](0x1f4,_0x2a5324[_0x2d63('0x13')]));});});}; \ No newline at end of file +var _0xaf5d=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','find','options','raw','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf5d,0x1f4));var _0xdaf5=function(_0x51c71b,_0x2ab01c){_0x51c71b=_0x51c71b-0x0;var _0x33ec5d=_0xaf5d[_0x51c71b];return _0x33ec5d;};'use strict';var _=require('lodash');var util=require(_0xdaf5('0x0'));var moment=require(_0xdaf5('0x1'));var BPromise=require(_0xdaf5('0x2'));var rs=require(_0xdaf5('0x3'));var fs=require('fs');var Redis=require(_0xdaf5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdaf5('0x5'))(_0xdaf5('0x6'));var config=require(_0xdaf5('0x7'));var jayson=require(_0xdaf5('0x8'));var client=jayson[_0xdaf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2684e7,_0x2e0447,_0x5455d6){return new BPromise(function(_0x41ba6d,_0x40ce18){return client[_0xdaf5('0xa')](_0x2684e7,_0x5455d6)[_0xdaf5('0xb')](function(_0x51d174){logger[_0xdaf5('0xc')](_0xdaf5('0xd'),_0x2e0447,_0xdaf5('0xe'));logger[_0xdaf5('0xf')](_0xdaf5('0x10'),_0x2e0447,'request\x20sent',JSON[_0xdaf5('0x11')](_0x51d174));if(_0x51d174[_0xdaf5('0x12')]){if(_0x51d174[_0xdaf5('0x12')][_0xdaf5('0x13')]===0x1f4){logger[_0xdaf5('0x12')](_0xdaf5('0xd'),_0x2e0447,_0x51d174[_0xdaf5('0x12')][_0xdaf5('0x14')]);return _0x40ce18(_0x51d174[_0xdaf5('0x12')]['message']);}logger[_0xdaf5('0x12')](_0xdaf5('0xd'),_0x2e0447,_0x51d174[_0xdaf5('0x12')]['message']);return _0x41ba6d(_0x51d174[_0xdaf5('0x12')][_0xdaf5('0x14')]);}else{logger[_0xdaf5('0xc')](_0xdaf5('0xd'),_0x2e0447,_0xdaf5('0xe'));_0x41ba6d(_0x51d174[_0xdaf5('0x15')][_0xdaf5('0x14')]);}})[_0xdaf5('0x16')](function(_0x2dc683){logger[_0xdaf5('0x12')](_0xdaf5('0xd'),_0x2e0447,_0x2dc683);_0x40ce18(_0x2dc683);});});}exports[_0xdaf5('0x17')]=function(_0x261bc0){var _0x3252d0=this;return new Promise(function(_0x42475f,_0x1ee2de){return db['Setting'][_0xdaf5('0x18')]({'raw':_0x261bc0[_0xdaf5('0x19')]?_0x261bc0[_0xdaf5('0x19')][_0xdaf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x261bc0[_0xdaf5('0x19')]?_0x261bc0[_0xdaf5('0x19')][_0xdaf5('0x1b')]||null:null,'attributes':_0x261bc0[_0xdaf5('0x19')]?_0x261bc0['options'][_0xdaf5('0x1c')]||null:null,'include':_0x261bc0[_0xdaf5('0x19')]?_0x261bc0[_0xdaf5('0x19')]['include']?_['map'](_0x261bc0['options'][_0xdaf5('0x1d')],function(_0x7f67e2){return{'model':db[_0x7f67e2['model']],'as':_0x7f67e2['as'],'attributes':_0x7f67e2[_0xdaf5('0x1c')],'include':_0x7f67e2[_0xdaf5('0x1d')]?_['map'](_0x7f67e2['include'],function(_0x342ac5){return{'model':db[_0x342ac5[_0xdaf5('0x1e')]],'as':_0x342ac5['as'],'attributes':_0x342ac5[_0xdaf5('0x1c')],'include':_0x342ac5['include']?_[_0xdaf5('0x1f')](_0x342ac5[_0xdaf5('0x1d')],function(_0xb67024){return{'model':db[_0xb67024[_0xdaf5('0x1e')]],'as':_0xb67024['as'],'attributes':_0xb67024[_0xdaf5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdaf5('0xb')](function(_0x3e6c3e){logger[_0xdaf5('0xc')]('ShowSetting',_0x261bc0);logger[_0xdaf5('0xf')](_0xdaf5('0x17'),_0x261bc0,JSON[_0xdaf5('0x11')](_0x3e6c3e));_0x42475f(_0x3e6c3e);})[_0xdaf5('0x16')](function(_0x107dd1){logger[_0xdaf5('0x12')](_0xdaf5('0x17'),_0x107dd1[_0xdaf5('0x14')],_0x261bc0);_0x1ee2de(_0x3252d0[_0xdaf5('0x12')](0x1f4,_0x107dd1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c7c5ed6..03fc665 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5777ca,_0x236c53){var _0x2c0fa7=function(_0x2ad1e7){while(--_0x2ad1e7){_0x5777ca['push'](_0x5777ca['shift']());}};_0x2c0fa7(++_0x236c53);}(_0x7a54,0x106));var _0x47a5=function(_0x388724,_0x337cb5){_0x388724=_0x388724-0x0;var _0x3957e1=_0x7a54[_0x388724];return _0x3957e1;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x12010d,_0x43e72c){var _0xcc8c1c=function(_0x4c845a){while(--_0x4c845a){_0x12010d['push'](_0x12010d['shift']());}};_0xcc8c1c(++_0x43e72c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 21135c1..62ee6c6 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 _0xf18b=['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','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','clicksend','plivo','bandwidth','csc','intelepeer','TEXT'];(function(_0x4713c2,_0x43d974){var _0x3b1705=function(_0x2475da){while(--_0x2475da){_0x4713c2['push'](_0x4713c2['shift']());}};_0x3b1705(++_0x43d974);}(_0xf18b,0x10a));var _0xbf18=function(_0x17967d,_0x48634f){_0x17967d=_0x17967d-0x0;var _0x32576b=_0xf18b[_0x17967d];return _0x32576b;};'use strict';var Sequelize=require(_0xbf18('0x0'));var rs=require(_0xbf18('0x1'));module[_0xbf18('0x2')]={'name':{'type':Sequelize[_0xbf18('0x3')],'unique':_0xbf18('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xbf18('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbf18('0x3')],'defaultValue':function(){return rs[_0xbf18('0x5')]();}},'phone':{'type':Sequelize[_0xbf18('0x3')]},'type':{'type':Sequelize['ENUM'](_0xbf18('0x6'),_0xbf18('0x7'),'connectel',_0xbf18('0x8'),_0xbf18('0x9'),'clickatell',_0xbf18('0xa'),_0xbf18('0xb'),'infobip',_0xbf18('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbf18('0x3')]},'authToken':{'type':Sequelize[_0xbf18('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xbf18('0x3')]},'password':{'type':Sequelize[_0xbf18('0x3')]},'apiKey':{'type':Sequelize[_0xbf18('0x3')]},'applicationId':{'type':Sequelize[_0xbf18('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xbf18('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xbf18('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbf18('0xd')],'defaultValue':function(){return _0xbf18('0xe');}},'notificationSound':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbf18('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf18('0x10')],'comment':_0xbf18('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2542bb){if(!_0x2542bb)this[_0xbf18('0x12')](_0xbf18('0x13'),null);this[_0xbf18('0x12')]('mandatoryDisposition',_0x2542bb);}}}; \ No newline at end of file +var _0x757c=['twilio','skebby','connectel','bandwidth','csc','infobip','intelepeer','ENUM','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate'];(function(_0x54d37e,_0x340479){var _0x3b4510=function(_0x3b7739){while(--_0x3b7739){_0x54d37e['push'](_0x54d37e['shift']());}};_0x3b4510(++_0x340479);}(_0x757c,0x1f3));var _0xc757=function(_0x2e0342,_0x65853f){_0x2e0342=_0x2e0342-0x0;var _0x119007=_0x757c[_0x2e0342];return _0x119007;};'use strict';var Sequelize=require(_0xc757('0x0'));var rs=require('randomstring');module[_0xc757('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc757('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xc757('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc757('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc757('0x3')],'defaultValue':function(){return rs[_0xc757('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xc757('0x5'),_0xc757('0x6'),_0xc757('0x7'),'clicksend','plivo','clickatell',_0xc757('0x8'),_0xc757('0x9'),_0xc757('0xa'),_0xc757('0xb'))},'accountSid':{'type':Sequelize[_0xc757('0x3')]},'authId':{'type':Sequelize[_0xc757('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xc757('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc757('0x3')]},'password':{'type':Sequelize[_0xc757('0x3')]},'apiKey':{'type':Sequelize[_0xc757('0x3')]},'applicationId':{'type':Sequelize[_0xc757('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc757('0x3')]},'deliveryReport':{'type':Sequelize[_0xc757('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc757('0xe');}},'notificationSound':{'type':Sequelize[_0xc757('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc757('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc757('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc757('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc757('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc757('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc757('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc757('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc757('0xf')],'comment':_0xc757('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xc757('0xd')],'defaultValue':![],'comment':_0xc757('0x11'),'set':function(_0x459d7b){if(!_0x459d7b)this[_0xc757('0x12')](_0xc757('0x13'),null);this[_0xc757('0x12')](_0xc757('0x14'),_0x459d7b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b8df976..7735a37 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 _0xc7c7=['SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','SmsInteraction','List','Contacts','out','SmsMessage','dataValues','Messages','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','clickatell','redif','inspect','infobip','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','statusGet','state','message-id','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','SmsAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','getAnswers','findAll','removeAnswers','notify','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','connectel','clicksend','Text','MessageUUID','results','originatingAddress','bandwidth','text','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','DESC','omit','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED'];(function(_0x486195,_0x457be4){var _0x2115e6=function(_0x3c90e4){while(--_0x3c90e4){_0x486195['push'](_0x486195['shift']());}};_0x2115e6(++_0x457be4);}(_0xc7c7,0x1e8));var _0x7c7c=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc7c7[_0x257642];return _0x3d813b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c7c('0x0'));var zipdir=require(_0x7c7c('0x1'));var jsonpatch=require(_0x7c7c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c7c('0x3'));var Mustache=require(_0x7c7c('0x4'));var util=require(_0x7c7c('0x5'));var path=require(_0x7c7c('0x6'));var sox=require(_0x7c7c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c7c('0x8'));var jsforce=require(_0x7c7c('0x9'));var deskjs=require(_0x7c7c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7c7c('0xb'));var Papa=require(_0x7c7c('0xc'));var Redis=require('ioredis');var authService=require(_0x7c7c('0xd'));var qs=require(_0x7c7c('0xe'));var as=require(_0x7c7c('0xf'));var hardwareService=require(_0x7c7c('0x10'));var logger=require(_0x7c7c('0x11'))(_0x7c7c('0x12'));var utils=require('../../config/utils');var config=require(_0x7c7c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c7c('0x14'))['db'];config['redis']=_[_0x7c7c('0x15')](config['redis'],{'host':_0x7c7c('0x16'),'port':0x18eb});var socket=require(_0x7c7c('0x17'))(new Redis(config['redis']));require(_0x7c7c('0x18'))[_0x7c7c('0x19')](socket);var jayson=require(_0x7c7c('0x1a'));var client=jayson[_0x7c7c('0x1b')][_0x7c7c('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1e1c59,_0x25892c,_0x47c42b,_0x4b9076){return new BPromise(function(_0x288a8f,_0x2ac54e){var _0x3df1d3=_0x4b9076||client;return _0x3df1d3['request'](_0x1e1c59,_0x47c42b)['then'](function(_0x121c30){logger[_0x7c7c('0x1d')](_0x7c7c('0x1e'),_0x25892c,_0x7c7c('0x1f'));logger['debug'](_0x7c7c('0x20'),_0x25892c,_0x7c7c('0x1f'),JSON['stringify'](_0x121c30));if(_0x121c30[_0x7c7c('0x21')]){if(_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x22')]===0x1f4){logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x23')]);return _0x2ac54e(_0x121c30['error'][_0x7c7c('0x23')]);}logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x23')]);return _0x288a8f(_0x121c30['error'][_0x7c7c('0x23')]);}else{logger[_0x7c7c('0x1d')](_0x7c7c('0x1e'),_0x25892c,_0x7c7c('0x1f'));_0x288a8f(_0x121c30[_0x7c7c('0x24')][_0x7c7c('0x23')]);}})[_0x7c7c('0x25')](function(_0x48ea75){logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x48ea75);_0x2ac54e(_0x48ea75);});});}function respondWithStatusCode(_0x206b5c,_0x2d7172){_0x2d7172=_0x2d7172||0xcc;return function(_0x160fc4){if(_0x160fc4){return _0x206b5c[_0x7c7c('0x26')](_0x2d7172);}return _0x206b5c[_0x7c7c('0x27')](_0x2d7172)[_0x7c7c('0x28')]();};}function respondWithResult(_0x20392a,_0x562e1e){_0x562e1e=_0x562e1e||0xc8;return function(_0x19c619){if(_0x19c619){return _0x20392a['status'](_0x562e1e)['json'](_0x19c619);}};}function respondWithFilteredResult(_0x480441,_0x3a4573){return function(_0x3416ec){if(_0x3416ec){var _0x53f3c6=typeof _0x3a4573[_0x7c7c('0x29')]===_0x7c7c('0x2a')&&typeof _0x3a4573['limit']===_0x7c7c('0x2a');var _0x4426ac=_0x3416ec[_0x7c7c('0x2b')];var _0x502b5a=_0x53f3c6?0x0:_0x3a4573[_0x7c7c('0x29')];var _0x44f7ed=_0x53f3c6?_0x3416ec[_0x7c7c('0x2b')]:_0x3a4573['offset']+_0x3a4573['limit'];var _0x138617;if(_0x44f7ed>=_0x4426ac){_0x44f7ed=_0x4426ac;_0x138617=0xc8;}else{_0x138617=0xce;}_0x480441[_0x7c7c('0x27')](_0x138617);return _0x480441[_0x7c7c('0x2c')](_0x7c7c('0x2d'),_0x502b5a+'-'+_0x44f7ed+'/'+_0x4426ac)[_0x7c7c('0x2e')](_0x3416ec);}return null;};}function patchUpdates(_0xff8fb2){return function(_0x15c7a7){try{jsonpatch[_0x7c7c('0x2f')](_0x15c7a7,_0xff8fb2,!![]);}catch(_0x597e3c){return BPromise[_0x7c7c('0x30')](_0x597e3c);}return _0x15c7a7[_0x7c7c('0x31')]();};}function saveUpdates(_0x308630,_0xce1df9){return function(_0x418142){if(_0x418142){return _0x418142[_0x7c7c('0x32')](_0x308630)[_0x7c7c('0x33')](function(_0x67dd9f){return _0x67dd9f;});}return null;};}function removeEntity(_0x3296f7,_0x47b4ce){return function(_0x3220f2){if(_0x3220f2){return _0x3220f2[_0x7c7c('0x34')]()['then'](function(){var _0x10857c=_0x3220f2['get']({'plain':!![]});var _0x2c57a4='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c57a4,'resourceId':_0x10857c['id']}})[_0x7c7c('0x33')](function(){return _0x3220f2;});})[_0x7c7c('0x33')](function(){_0x3296f7[_0x7c7c('0x27')](0xcc)[_0x7c7c('0x28')]();});}};}function handleEntityNotFound(_0x784d7f,_0x10f374){return function(_0xc962b2){if(!_0xc962b2){_0x784d7f[_0x7c7c('0x26')](0x194);}return _0xc962b2;};}function handleError(_0x385c7d,_0x57670f){_0x57670f=_0x57670f||0x1f4;return function(_0x206693){logger[_0x7c7c('0x21')](_0x206693[_0x7c7c('0x35')]);if(_0x206693[_0x7c7c('0x36')]){delete _0x206693['name'];}_0x385c7d[_0x7c7c('0x27')](_0x57670f)['send'](_0x206693);};}exports[_0x7c7c('0x37')]=function(_0x25b48a,_0x3b5fde){var _0x1d3122={'include':[{'model':db[_0x7c7c('0x38')],'as':_0x7c7c('0x39')}]},_0x1812cb={},_0x1afa10={'count':0x0,'rows':[]};var _0x29af3d=_['map'](db[_0x7c7c('0x3a')][_0x7c7c('0x3b')],function(_0x562c99){return{'name':_0x562c99['fieldName'],'type':_0x562c99[_0x7c7c('0x3c')][_0x7c7c('0x3d')]};});_0x1812cb[_0x7c7c('0x3e')]=_[_0x7c7c('0x3f')](_0x29af3d,_0x7c7c('0x36'));_0x1812cb['query']=_[_0x7c7c('0x40')](_0x25b48a[_0x7c7c('0x41')]);_0x1812cb[_0x7c7c('0x42')]=_['intersection'](_0x1812cb[_0x7c7c('0x3e')],_0x1812cb[_0x7c7c('0x41')]);_0x1d3122['attributes']=_[_0x7c7c('0x43')](_0x1812cb[_0x7c7c('0x3e')],qs['fields'](_0x25b48a['query'][_0x7c7c('0x44')]));_0x1d3122[_0x7c7c('0x45')]=_0x1d3122[_0x7c7c('0x45')][_0x7c7c('0x46')]?_0x1d3122[_0x7c7c('0x45')]:_0x1812cb['model'];if(!_0x25b48a['query'][_0x7c7c('0x47')]('nolimit')){_0x1d3122[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x1d3122['offset']=qs[_0x7c7c('0x29')](_0x25b48a[_0x7c7c('0x41')]['offset']);}_0x1d3122[_0x7c7c('0x49')]=qs['sort'](_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x1d3122[_0x7c7c('0x4b')]=qs['filters'](_[_0x7c7c('0x4c')](_0x25b48a['query'],_0x1812cb[_0x7c7c('0x42')]),_0x29af3d);if(_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x1d3122['where']=_[_0x7c7c('0x4e')](_0x1d3122[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x29af3d,function(_0x1e6957){if(_0x1e6957[_0x7c7c('0x3c')]!=='VIRTUAL'){var _0x2cb1e7={};_0x2cb1e7[_0x1e6957[_0x7c7c('0x36')]]={'$like':'%'+_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x2cb1e7;}})});}_0x1d3122=_[_0x7c7c('0x4e')]({},_0x1d3122,_0x25b48a[_0x7c7c('0x4f')]);var _0x13eb59={'where':_0x1d3122['where']};return db[_0x7c7c('0x3a')]['count'](_0x13eb59)[_0x7c7c('0x33')](function(_0x48165a){_0x1afa10['count']=_0x48165a;if(_0x25b48a['query'][_0x7c7c('0x50')]){_0x1d3122[_0x7c7c('0x51')]=[{'all':!![]}];}return db[_0x7c7c('0x3a')]['findAll'](_0x1d3122);})['then'](function(_0x1dbb73){_0x1afa10[_0x7c7c('0x52')]=_0x1dbb73;return _0x1afa10;})[_0x7c7c('0x33')](respondWithFilteredResult(_0x3b5fde,_0x1d3122))['catch'](handleError(_0x3b5fde,null));};exports[_0x7c7c('0x53')]=function(_0x75f229,_0x587141){var _0x13dc80={'raw':![],'where':{'id':_0x75f229['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x424e00={};_0x424e00[_0x7c7c('0x3e')]=_['keys'](db['SmsAccount'][_0x7c7c('0x3b')]);_0x424e00['query']=_[_0x7c7c('0x40')](_0x75f229[_0x7c7c('0x41')]);_0x424e00[_0x7c7c('0x42')]=_['intersection'](_0x424e00['model'],_0x424e00[_0x7c7c('0x41')]);_0x13dc80[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x424e00[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x75f229[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x13dc80[_0x7c7c('0x45')]=_0x13dc80[_0x7c7c('0x45')]['length']?_0x13dc80[_0x7c7c('0x45')]:_0x424e00[_0x7c7c('0x3e')];if(_0x75f229[_0x7c7c('0x41')]['includeAll']){_0x13dc80[_0x7c7c('0x51')]=[{'all':!![]}];}_0x13dc80=_[_0x7c7c('0x4e')]({},_0x13dc80,_0x75f229[_0x7c7c('0x4f')]);return db['SmsAccount'][_0x7c7c('0x54')](_0x13dc80)[_0x7c7c('0x33')](handleEntityNotFound(_0x587141,null))[_0x7c7c('0x33')](respondWithResult(_0x587141,null))[_0x7c7c('0x25')](handleError(_0x587141,null));};exports[_0x7c7c('0x55')]=function(_0x542455,_0x21eac5){return db[_0x7c7c('0x3a')][_0x7c7c('0x55')](_0x542455[_0x7c7c('0x56')],{})[_0x7c7c('0x33')](function(_0x56ec3b){var _0x31aff0=_0x542455['user']['get']({'plain':!![]});if(!_0x31aff0)throw new Error(_0x7c7c('0x57'));if(_0x31aff0['role']===_0x7c7c('0x58')){var _0x13d023=_0x56ec3b[_0x7c7c('0x59')]({'plain':!![]});var _0x5eb23c=_0x7c7c('0x5a');return db['UserProfileSection'][_0x7c7c('0x54')]({'where':{'name':_0x5eb23c,'userProfileId':_0x31aff0[_0x7c7c('0x5b')]},'raw':!![]})[_0x7c7c('0x33')](function(_0x5b2f33){if(_0x5b2f33&&_0x5b2f33[_0x7c7c('0x5c')]===0x0){return db[_0x7c7c('0x5d')][_0x7c7c('0x55')]({'name':_0x13d023[_0x7c7c('0x36')],'resourceId':_0x13d023['id'],'type':_0x5b2f33[_0x7c7c('0x36')],'sectionId':_0x5b2f33['id']},{})[_0x7c7c('0x33')](function(){return _0x56ec3b;});}else{return _0x56ec3b;}})['catch'](function(_0xb95294){logger[_0x7c7c('0x21')](_0x7c7c('0x5e'),_0xb95294);throw _0xb95294;});}return _0x56ec3b;})[_0x7c7c('0x33')](respondWithResult(_0x21eac5,0xc9))['catch'](handleError(_0x21eac5,null));};exports[_0x7c7c('0x32')]=function(_0x154493,_0x58887e){if(_0x154493['body']['id']){delete _0x154493['body']['id'];}return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x154493[_0x7c7c('0x5f')]['id']},'include':[{'model':db[_0x7c7c('0x38')],'as':_0x7c7c('0x39')}]})[_0x7c7c('0x33')](handleEntityNotFound(_0x58887e,null))[_0x7c7c('0x33')](saveUpdates(_0x154493[_0x7c7c('0x56')],null))[_0x7c7c('0x33')](respondWithResult(_0x58887e,null))[_0x7c7c('0x25')](handleError(_0x58887e,null));};exports[_0x7c7c('0x34')]=function(_0x371ad8,_0x4f1723){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x371ad8[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x4f1723,null))[_0x7c7c('0x33')](removeEntity(_0x4f1723,null))[_0x7c7c('0x25')](handleError(_0x4f1723,null));};exports[_0x7c7c('0x60')]=function(_0x43d496,_0x1f1daa){return db[_0x7c7c('0x3a')][_0x7c7c('0x60')]()[_0x7c7c('0x33')](respondWithResult(_0x1f1daa,null))[_0x7c7c('0x25')](handleError(_0x1f1daa,null));};exports[_0x7c7c('0x61')]=function(_0x53a039,_0x3b8f24,_0x3d7a09){if(_0x53a039['body']['id']){delete _0x53a039['body']['id'];}return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x53a039[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3b8f24,null))['then'](function(_0x28f1db){if(_0x28f1db){_0x53a039[_0x7c7c('0x56')][_0x7c7c('0x62')]=_0x28f1db['id'];return db['Disposition'][_0x7c7c('0x55')](_0x53a039[_0x7c7c('0x56')]);}})['then'](respondWithResult(_0x3b8f24,null))['catch'](handleError(_0x3b8f24,null));};exports[_0x7c7c('0x63')]=function(_0x41b615,_0x323f27,_0xca5997){var _0x225dd4={'raw':![],'where':{}};var _0x383fcd={};var _0x47551b={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x41b615[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x323f27,null))[_0x7c7c('0x33')](function(_0x161a4d){if(_0x161a4d){_0x383fcd[_0x7c7c('0x3e')]=_[_0x7c7c('0x40')](db[_0x7c7c('0x65')][_0x7c7c('0x3b')]);_0x383fcd[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x41b615[_0x7c7c('0x41')]);_0x383fcd[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x383fcd[_0x7c7c('0x3e')],_0x383fcd[_0x7c7c('0x41')]);_0x225dd4[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x383fcd['model'],qs[_0x7c7c('0x44')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x225dd4['attributes']=_0x225dd4['attributes'][_0x7c7c('0x46')]?_0x225dd4['attributes']:_0x383fcd['model'];if(!_0x41b615[_0x7c7c('0x41')]['hasOwnProperty'](_0x7c7c('0x66'))){_0x225dd4[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x225dd4[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x29')]);}_0x225dd4['order']=qs[_0x7c7c('0x4a')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x225dd4[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x41b615[_0x7c7c('0x41')],_0x383fcd['filters']));_0x225dd4[_0x7c7c('0x4b')][_0x7c7c('0x62')]=_0x161a4d['id'];if(_0x41b615['query']['filter']){_0x225dd4[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x225dd4['where'],{'$or':_[_0x7c7c('0x3f')](_0x225dd4[_0x7c7c('0x45')],function(_0x22bf72){var _0x3e8c3f={};_0x3e8c3f[_0x22bf72]={'$like':'%'+_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x3e8c3f;})});}_0x225dd4=_[_0x7c7c('0x4e')]({},_0x225dd4,_0x41b615[_0x7c7c('0x4f')]);return db[_0x7c7c('0x65')]['count']({'where':_0x225dd4[_0x7c7c('0x4b')]})[_0x7c7c('0x33')](function(_0x4f60d0){_0x47551b[_0x7c7c('0x2b')]=_0x4f60d0;if(_0x41b615['query']['includeAll']){_0x225dd4[_0x7c7c('0x51')]=[{'all':!![]}];}return db[_0x7c7c('0x65')]['findAll'](_0x225dd4);})[_0x7c7c('0x33')](function(_0x503887){_0x47551b[_0x7c7c('0x52')]=_0x503887;return _0x47551b;});}})[_0x7c7c('0x33')](respondWithFilteredResult(_0x323f27,_0x225dd4))[_0x7c7c('0x25')](handleError(_0x323f27,null));};exports[_0x7c7c('0x67')]=function(_0x2862cc,_0x1ff8f4,_0x2d415c){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x2862cc[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x1ff8f4,null))['then'](function(_0x39f765){if(_0x39f765){return _0x39f765['removeDispositions'](_0x2862cc['query'][_0x7c7c('0x68')]);}})[_0x7c7c('0x33')](respondWithStatusCode(_0x1ff8f4,null))['catch'](handleError(_0x1ff8f4,null));};exports['addAnswer']=function(_0x5971ef,_0x46700a,_0x188a51){if(_0x5971ef[_0x7c7c('0x56')]['id']){delete _0x5971ef[_0x7c7c('0x56')]['id'];}return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x5971ef[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46700a,null))[_0x7c7c('0x33')](function(_0x35f5d0){if(_0x35f5d0){_0x5971ef[_0x7c7c('0x56')][_0x7c7c('0x62')]=_0x35f5d0['id'];return db['CannedAnswer'][_0x7c7c('0x55')](_0x5971ef['body']);}})[_0x7c7c('0x33')](respondWithResult(_0x46700a,null))[_0x7c7c('0x25')](handleError(_0x46700a,null));};exports[_0x7c7c('0x69')]=function(_0x14997b,_0x2c44b8,_0x329949){var _0x37e64e={'raw':![],'where':{}};var _0x5a091a={};var _0x5e7aae={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')]['findOne']({'where':{'id':_0x14997b[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2c44b8,null))[_0x7c7c('0x33')](function(_0x5ba979){if(_0x5ba979){_0x5a091a[_0x7c7c('0x3e')]=_[_0x7c7c('0x40')](db['CannedAnswer']['rawAttributes']);_0x5a091a[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x14997b[_0x7c7c('0x41')]);_0x5a091a[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x5a091a[_0x7c7c('0x3e')],_0x5a091a[_0x7c7c('0x41')]);_0x37e64e[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x5a091a[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x14997b['query']['fields']));_0x37e64e[_0x7c7c('0x45')]=_0x37e64e[_0x7c7c('0x45')]['length']?_0x37e64e[_0x7c7c('0x45')]:_0x5a091a[_0x7c7c('0x3e')];if(!_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x47')](_0x7c7c('0x66'))){_0x37e64e[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x14997b[_0x7c7c('0x41')]['limit']);_0x37e64e[_0x7c7c('0x29')]=qs['offset'](_0x14997b['query'][_0x7c7c('0x29')]);}_0x37e64e['order']=qs[_0x7c7c('0x4a')](_0x14997b['query'][_0x7c7c('0x4a')]);_0x37e64e[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x14997b[_0x7c7c('0x41')],_0x5a091a[_0x7c7c('0x42')]));_0x37e64e['where'][_0x7c7c('0x62')]=_0x5ba979['id'];if(_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x37e64e[_0x7c7c('0x4b')]=_['merge'](_0x37e64e[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x37e64e[_0x7c7c('0x45')],function(_0x281115){var _0x45ee06={};_0x45ee06[_0x281115]={'$like':'%'+_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x45ee06;})});}_0x37e64e=_[_0x7c7c('0x4e')]({},_0x37e64e,_0x14997b[_0x7c7c('0x4f')]);return db['CannedAnswer'][_0x7c7c('0x2b')]({'where':_0x37e64e[_0x7c7c('0x4b')]})[_0x7c7c('0x33')](function(_0x4d58b6){_0x5e7aae['count']=_0x4d58b6;if(_0x14997b[_0x7c7c('0x41')]['includeAll']){_0x37e64e[_0x7c7c('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7c7c('0x6a')](_0x37e64e);})[_0x7c7c('0x33')](function(_0x1bee60){_0x5e7aae[_0x7c7c('0x52')]=_0x1bee60;return _0x5e7aae;});}})[_0x7c7c('0x33')](respondWithFilteredResult(_0x2c44b8,_0x37e64e))['catch'](handleError(_0x2c44b8,null));};exports[_0x7c7c('0x6b')]=function(_0x3d6881,_0x16fb09,_0x49563f){return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x3d6881['params']['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x16fb09,null))[_0x7c7c('0x33')](function(_0x26626d){if(_0x26626d){return _0x26626d[_0x7c7c('0x6b')](_0x3d6881[_0x7c7c('0x41')][_0x7c7c('0x68')]);}})[_0x7c7c('0x33')](respondWithStatusCode(_0x16fb09,null))['catch'](handleError(_0x16fb09,null));};exports[_0x7c7c('0x6c')]=function(_0x5f32d5,_0x3f38f6,_0x4d1697){var _0x1fe00e={'channel':'sms'};var _0x1745bd=[];var _0x2fb2b9=[];var _0x3d9647={};return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x5f32d5[_0x7c7c('0x5f')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x7c7c('0x6d')}]})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x985740){_0x1fe00e[_0x7c7c('0x6e')]=_0x985740;_0x1fe00e[_0x7c7c('0x6f')]=_[_0x7c7c('0x70')](_0x985740[_0x7c7c('0x6d')],[_0x7c7c('0x71')],[_0x7c7c('0x72')]);if(_0x1fe00e['account'][_0x7c7c('0x6d')]){delete _0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x6d')];}return db[_0x7c7c('0x73')][_0x7c7c('0x60')]();})['then'](function(_0x55aed9){if(!_0x55aed9){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))](_0x7c7c('0x76'));}_0x1745bd=_[_0x7c7c('0x77')](_[_0x7c7c('0x40')](_0x55aed9),[_0x7c7c('0x78'),_0x7c7c('0x79')]);_0x2fb2b9=_[_0x7c7c('0x77')](_[_0x7c7c('0x40')](_0x55aed9),[_0x7c7c('0x78'),'updatedAt',_0x7c7c('0x7a'),_0x7c7c('0x7b')]);_0x1fe00e[_0x7c7c('0x56')]={'mapKey':_0x7c7c('0x7c')};if(_0x1fe00e['account'][_0x7c7c('0x3c')]){switch(_0x1fe00e['account'][_0x7c7c('0x3c')]){case _0x7c7c('0x7d'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7f')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['Body'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x81')];break;case _0x7c7c('0x82'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]='+'+_0x5f32d5[_0x7c7c('0x56')]['sender'];_0x1fe00e['body'][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['text'];break;case _0x7c7c('0x83'):_0x1fe00e['body'][_0x7c7c('0x7e')]=_0x5f32d5['body'][_0x7c7c('0x7e')];_0x1fe00e['body']['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x23')];break;case _0x7c7c('0x84'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7e')];_0x1fe00e[_0x7c7c('0x56')]['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x56')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')]['message_id'];break;case'plivo':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7f')];_0x1fe00e[_0x7c7c('0x56')]['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x85')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5['body'][_0x7c7c('0x86')];break;case'infobip':_0x1fe00e['body'][_0x7c7c('0x7e')]='+'+_0x5f32d5['body'][_0x7c7c('0x87')][0x0]['from'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0]['text'];_0x1fe00e['body'][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0][_0x7c7c('0x80')];break;case'csc':_0x1fe00e[_0x7c7c('0x56')]['from']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x88')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5['body']['segmentedMessage'][_0x7c7c('0x23')];break;case'clickatell':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')]['fromNumber'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['text'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')]['replyMessageId'];break;case _0x7c7c('0x89'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5['body'][0x0]['message']['id'];_0x1fe00e[_0x7c7c('0x56')]['from']=_0x5f32d5[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')][_0x7c7c('0x7e')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')][0x0]['message'][_0x7c7c('0x8a')];break;case'intelepeer':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5['body']['from'];_0x1fe00e['body'][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['message'];_0x1fe00e['body']['messageId']=_0x5f32d5['body']['refid'];break;}}if(_0x1fe00e[_0x7c7c('0x56')]['id']){delete _0x1fe00e[_0x7c7c('0x56')]['id'];}if(_[_0x7c7c('0x8b')](_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')])){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1fe00e['body'][_0x7c7c('0x56')])||_0x1fe00e[_0x7c7c('0x56')]['body']===''){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7c7c('0x8b')](_0x1fe00e['body']['mapKey'])){throw new db['Sequelize'][(_0x7c7c('0x75'))](_0x7c7c('0x8c')+_0x2fb2b9);}if(!_['includes'](_0x2fb2b9,_0x1fe00e['body'][_0x7c7c('0x8d')])){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fb2b9);}_0x3d9647[_0x1fe00e['body'][_0x7c7c('0x8d')]]=_0x1fe00e['body'][_0x7c7c('0x7e')];return db[_0x7c7c('0x8e')][_0x7c7c('0x54')]({'where':{'id':_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x7b')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3d9647,'limit':0x1,'order':[[_0x7c7c('0x79'),_0x7c7c('0x8f')]]}]});})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x4f8365){if(_0x4f8365){_0x1fe00e['list']=_[_0x7c7c('0x90')](_0x4f8365,['Contacts']);if(_0x4f8365['Contacts'][_0x7c7c('0x46')]){return _0x4f8365['Contacts'][0x0];}var _0x48187f=_[_0x7c7c('0x15')](_0x1fe00e['body'],{'firstName':_0x1fe00e['body'][_0x7c7c('0x7e')],'ListId':_0x4f8365['id']});_0x48187f[_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x8d')]]=_0x1fe00e[_0x7c7c('0x56')]['from'];return db['CmContact']['create'](_0x48187f,{'fields':_0x1745bd,'raw':!![]});}})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x879bf6){if(_0x879bf6){_0x1fe00e['contact']=_0x879bf6;var _0x44ad1b={'ContactId':_0x879bf6['id'],'phone':_0x1fe00e[_0x7c7c('0x56')]['from'],'SmsAccountId':_0x5f32d5['params']['id']};var _0x5f28ad={'ContactId':_0x879bf6['id'],'SmsAccountId':_0x5f32d5['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x5f28ad})['then'](function(_0x4d6b1c){if(_0x4d6b1c){return[_0x4d6b1c,![]];}return db['SmsInteraction']['create'](_0x44ad1b)[_0x7c7c('0x33')](function(_0x1d1bae){return[_0x1d1bae,!![]];});});}})[_0x7c7c('0x91')](function(_0xf9822f,_0x198338){_0x1fe00e['interaction']=_0xf9822f[_0x7c7c('0x59')]({'plain':!![]});_0x1fe00e[_0x7c7c('0x92')]['created']=![];if(_0x198338){if(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x93')]){_0x1fe00e[_0x7c7c('0x6f')]['push']({'id':0x0,'priority':_0x1fe00e[_0x7c7c('0x6f')][_0x7c7c('0x46')]+0x1,'app':_0x7c7c('0x94'),'appdata':_0x7c7c('0x95'),'interval':_0x7c7c('0x96')});}_0x1fe00e['interaction'][_0x7c7c('0x97')]=!![];}return db['SmsMessage'][_0x7c7c('0x55')]({'phone':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')],'messageId':_0x1fe00e[_0x7c7c('0x56')]['messageId'],'body':_0x1fe00e['body'][_0x7c7c('0x56')],'SmsAccountId':_0x5f32d5[_0x7c7c('0x5f')]['id'],'SmsInteractionId':_0xf9822f['id'],'direction':'in','ContactId':_0xf9822f[_0x7c7c('0x98')],'AttachmentId':_0x1fe00e[_0x7c7c('0x56')]['AttachmentId']});})[_0x7c7c('0x33')](function(_0xea7758){_0x1fe00e['message']=_0xea7758;if(!_0x1fe00e['interaction']['UserId'])return;return db[_0x7c7c('0x99')][_0x7c7c('0x54')]({'attributes':['id',_0x7c7c('0x36')],'where':{'id':_0x1fe00e[_0x7c7c('0x92')][_0x7c7c('0x9a')]}});})[_0x7c7c('0x33')](function(_0x572048){if(_0x572048){_0x1fe00e[_0x7c7c('0x6f')][_0x7c7c('0x9b')]({'id':0x0,'priority':0x0,'app':_0x7c7c('0x9c'),'appdata':_0x572048['name']+','+(_0x1fe00e['account'][_0x7c7c('0x9d')]||0xa),'interval':'*,*,*,*'});}if(!_0x1fe00e[_0x7c7c('0x92')][_0x7c7c('0x9e')])return;return db[_0x7c7c('0x9f')][_0x7c7c('0x54')]({'attributes':['id','name'],'where':{'id':_0x1fe00e['interaction'][_0x7c7c('0x9e')]}});})['then'](function(_0xa54b3e){if(_0xa54b3e){_0x1fe00e['applications'][_0x7c7c('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xa54b3e[_0x7c7c('0x36')]+','+(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0xa0')]||0x12c),'interval':_0x7c7c('0x96')});}return respondWithRpcPromise(_0x7c7c('0xa1'),'startRouting',_0x1fe00e);})[_0x7c7c('0x33')](function(_0x41c7ec){if(_0x41c7ec){var _0x2a0931=0xc8;var _0x1d9506=_0x7c7c('0xa2');logger[_0x7c7c('0x1d')](_0x7c7c('0x20'),_0x1d9506,_0x2a0931,_0x7c7c('0xa3'));logger['debug'](_0x7c7c('0xa4'),_0x1d9506,_0x2a0931,_0x7c7c('0xa3'),JSON[_0x7c7c('0xa5')](_0x41c7ec));if(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x3c')]===_0x7c7c('0x7d')){return _0x3f38f6[_0x7c7c('0x27')](_0x2a0931)['set'](_0x7c7c('0xa6'),_0x7c7c('0xa7'))[_0x7c7c('0xa8')](_0x7c7c('0xa9'));}else{return _0x3f38f6[_0x7c7c('0x27')](_0x2a0931)[_0x7c7c('0x2e')](_0x41c7ec);}}})[_0x7c7c('0x25')](handleError(_0x3f38f6,null));};exports[_0x7c7c('0xaa')]=function(_0x1d21f4,_0x1631aa){var _0x581cec=_0x1d21f4[_0x7c7c('0x5f')]['id'];var _0x4354af=_0x1d21f4[_0x7c7c('0x56')];var _0x24e160=0xc8;var _0x22f21b=null;return db[_0x7c7c('0xab')][_0x7c7c('0xac')]({'isolationLevel':db[_0x7c7c('0xab')][_0x7c7c('0xad')]['ISOLATION_LEVELS'][_0x7c7c('0xae')]},function(_0x39791d){return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x581cec},'transaction':_0x39791d})[_0x7c7c('0x33')](function(_0x38687a){if(_0x38687a){return db[_0x7c7c('0xaf')][_0x7c7c('0x34')]({'where':{'SmsAccountId':_0x581cec},'transaction':_0x39791d})[_0x7c7c('0x33')](function(){var _0x3e521f=_[_0x7c7c('0x3f')](_0x4354af,function(_0x23c127){_0x23c127[_0x7c7c('0x62')]=_0x581cec;return _0x23c127;});return db[_0x7c7c('0xaf')][_0x7c7c('0xb0')](_0x3e521f,{'transaction':_0x39791d});});}else{_0x24e160=0x194;_0x22f21b=[];}});})['then'](function(){if(_0x24e160!==0x194){return db[_0x7c7c('0xaf')][_0x7c7c('0xb1')]({'where':{'SmsAccountId':_0x581cec},'order':_0x7c7c('0x71')})[_0x7c7c('0x33')](function(_0x50e31c){_0x22f21b=_0x50e31c;});}})[_0x7c7c('0x25')](function(_0x365ed3){_0x24e160=0x1f4;logger[_0x7c7c('0x21')](_0x365ed3[_0x7c7c('0x35')]);if(_0x365ed3[_0x7c7c('0x36')]){delete _0x365ed3[_0x7c7c('0x36')];}_0x22f21b=_0x365ed3;})['finally'](function(){if(_0x22f21b===null){_0x1631aa[_0x7c7c('0x26')](_0x24e160);}else{if(_0x24e160===0x1f4){_0x1631aa[_0x7c7c('0x27')](_0x24e160)['send'](_0x22f21b);}else{_0x1631aa['status'](_0x24e160)['json'](_0x22f21b);}}});};exports[_0x7c7c('0xb2')]=function(_0x3ac3e2,_0x59018a,_0x1c5d96){var _0x3e43ea={};var _0xdf1452={};var _0x5bb65f;var _0x39952f;return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x3ac3e2[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x59018a,null))[_0x7c7c('0x33')](function(_0x232d4a){if(_0x232d4a){_0x5bb65f=_0x232d4a;_0xdf1452['model']=_[_0x7c7c('0x40')](db[_0x7c7c('0xaf')][_0x7c7c('0x3b')]);_0xdf1452[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x3ac3e2[_0x7c7c('0x41')]);_0xdf1452['filters']=_[_0x7c7c('0x43')](_0xdf1452[_0x7c7c('0x3e')],_0xdf1452[_0x7c7c('0x41')]);_0x3e43ea[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0xdf1452['model'],qs[_0x7c7c('0x44')](_0x3ac3e2['query'][_0x7c7c('0x44')]));_0x3e43ea[_0x7c7c('0x45')]=_0x3e43ea['attributes']['length']?_0x3e43ea['attributes']:_0xdf1452[_0x7c7c('0x3e')];_0x3e43ea[_0x7c7c('0x49')]=qs[_0x7c7c('0x4a')](_0x3ac3e2['query'][_0x7c7c('0x4a')]);_0x3e43ea[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x3ac3e2['query'],_0xdf1452[_0x7c7c('0x42')]));if(_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x3e43ea[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x3e43ea[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x3e43ea[_0x7c7c('0x45')],function(_0x4ee8a4){var _0x5c5757={};_0x5c5757[_0x4ee8a4]={'$like':'%'+_0x3ac3e2[_0x7c7c('0x41')]['filter']+'%'};return _0x5c5757;})});}_0x3e43ea=_[_0x7c7c('0x4e')]({},_0x3e43ea,_0x3ac3e2[_0x7c7c('0x4f')]);return _0x5bb65f[_0x7c7c('0xb2')](_0x3e43ea);}})[_0x7c7c('0x33')](function(_0x174950){if(_0x174950){_0x39952f=_0x174950[_0x7c7c('0x46')];if(!_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x47')]('nolimit')){_0x3e43ea[_0x7c7c('0x48')]=qs['limit'](_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x3e43ea[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x3ac3e2['query'][_0x7c7c('0x29')]);}return _0x5bb65f[_0x7c7c('0xb2')](_0x3e43ea);}})[_0x7c7c('0x33')](function(_0x40e3f1){if(_0x40e3f1){return _0x40e3f1?{'count':_0x39952f,'rows':_0x40e3f1}:null;}})[_0x7c7c('0x33')](respondWithResult(_0x59018a,null))[_0x7c7c('0x25')](handleError(_0x59018a,null));};exports[_0x7c7c('0xb3')]=function(_0x1ec7df,_0xb0202d,_0x265f63){var _0x3daad5={'raw':![],'where':{}};var _0x417604={};var _0x301ca2={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')]['findOne']({'where':{'id':_0x1ec7df[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0xb0202d,null))[_0x7c7c('0x33')](function(_0x548b7e){if(_0x548b7e){_0x417604[_0x7c7c('0x3e')]=_['keys'](db['SmsInteraction'][_0x7c7c('0x3b')]);_0x417604[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x1ec7df[_0x7c7c('0x41')]);_0x417604['filters']=_[_0x7c7c('0x43')](_0x417604['model'],_0x417604[_0x7c7c('0x41')]);_0x3daad5[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x417604['model'],qs[_0x7c7c('0x44')](_0x1ec7df[_0x7c7c('0x41')]['fields']));_0x3daad5[_0x7c7c('0x45')]=_0x3daad5[_0x7c7c('0x45')][_0x7c7c('0x46')]?_0x3daad5['attributes']:_0x417604['model'];if(!_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x47')]('nolimit')){_0x3daad5[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x1ec7df['query'][_0x7c7c('0x48')]);_0x3daad5[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x1ec7df['query'][_0x7c7c('0x29')]);}_0x3daad5[_0x7c7c('0x49')]=qs[_0x7c7c('0x4a')](_0x1ec7df['query'][_0x7c7c('0x4a')]);_0x3daad5[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x1ec7df[_0x7c7c('0x41')],_0x417604['filters']));_0x3daad5[_0x7c7c('0x4b')][_0x7c7c('0x62')]=_0x548b7e['id'];if(_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x3daad5[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x3daad5['where'],{'$or':_[_0x7c7c('0x3f')](_0x3daad5['attributes'],function(_0x1a3048){var _0x1689c9={};_0x1689c9[_0x1a3048]={'$like':'%'+_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x1689c9;})});}_0x3daad5=_['merge']({},_0x3daad5,_0x1ec7df['options']);return db['SmsInteraction'][_0x7c7c('0x2b')]({'where':_0x3daad5[_0x7c7c('0x4b')]})['then'](function(_0x5a3370){_0x301ca2['count']=_0x5a3370;if(_0x1ec7df['query']['includeAll']){_0x3daad5[_0x7c7c('0x51')]=[{'model':db[_0x7c7c('0x73')],'as':_0x7c7c('0xb4'),'required':![]},{'model':db[_0x7c7c('0x99')],'as':_0x7c7c('0xb5'),'attributes':[_0x7c7c('0x36'),_0x7c7c('0xb6'),_0x7c7c('0xb7')],'required':![]},{'model':db[_0x7c7c('0xb8')],'as':_0x7c7c('0xb9'),'attributes':['id',_0x7c7c('0x36'),'color'],'where':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]?{'id':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]}:undefined,'required':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]?!![]:![]}];}return db[_0x7c7c('0xbb')][_0x7c7c('0x6a')](_0x3daad5);})[_0x7c7c('0x33')](function(_0x2248c7){_0x301ca2[_0x7c7c('0x52')]=_0x2248c7;return _0x301ca2;});}})['then'](respondWithFilteredResult(_0xb0202d,_0x3daad5))[_0x7c7c('0x25')](handleError(_0xb0202d,null));};exports[_0x7c7c('0xa8')]=function(_0x1e7670,_0x492e7a,_0xe46881){var _0x203661,_0x306e93,_0x3eba24;if(_[_0x7c7c('0x8b')](_0x1e7670[_0x7c7c('0x56')][_0x7c7c('0x56')])||_0x1e7670[_0x7c7c('0x56')]['body']===''){throw new db['Sequelize'][(_0x7c7c('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7c7c('0x8b')](_0x1e7670[_0x7c7c('0x56')]['to'])){throw new db[(_0x7c7c('0x74'))]['ValidationError']('to\x20is\x20mandatory');}_0x203661=_0x1e7670[_0x7c7c('0x56')]['to'];return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x1e7670[_0x7c7c('0x5f')]['id']},'include':[{'model':db[_0x7c7c('0x8e')],'as':_0x7c7c('0xbc'),'include':[{'model':db[_0x7c7c('0x73')],'as':_0x7c7c('0xbd'),'where':{'mobile':_0x203661},'limit':0x1,'order':[[_0x7c7c('0x79'),_0x7c7c('0x8f')]]}]}]})['then'](handleEntityNotFound(_0x492e7a,null))[_0x7c7c('0x33')](function(_0x388aa5){if(_0x388aa5&&_0x388aa5[_0x7c7c('0xbc')]){_0x306e93=_0x388aa5[_0x7c7c('0x59')]({'plain':!![]});if(_0x306e93[_0x7c7c('0xbc')]&&_0x306e93[_0x7c7c('0xbc')][_0x7c7c('0xbd')][_0x7c7c('0x46')]){return _0x306e93[_0x7c7c('0xbc')]['Contacts'][0x0];}return db[_0x7c7c('0x73')][_0x7c7c('0x55')](_[_0x7c7c('0x15')](_0x1e7670[_0x7c7c('0x56')],{'firstName':_0x203661,'mobile':_0x203661,'phone':_0x203661,'ListId':_0x306e93[_0x7c7c('0x7b')]}));}})[_0x7c7c('0x33')](handleEntityNotFound(_0x492e7a,null))[_0x7c7c('0x33')](function(_0x584e18){if(_0x584e18){_0x3eba24=_0x584e18;return db[_0x7c7c('0xbb')][_0x7c7c('0x54')]({'where':{'ContactId':_0x3eba24['id'],'closed':![],'SmsAccountId':_0x306e93['id']}})[_0x7c7c('0x33')](function(_0x11a550){if(_0x11a550){return[_0x11a550,![]];}return db['SmsInteraction'][_0x7c7c('0x55')]({'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id'],'SmsAccountId':_0x306e93['id'],'phone':_0x203661,'firstMsgDirection':_0x7c7c('0xbe'),'Messages':[_['merge'](_0x1e7670[_0x7c7c('0x56')],{'read':![],'body':_0x1e7670['body'][_0x7c7c('0x56')],'phone':_0x203661,'SmsAccountId':_0x306e93['id'],'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id']})]},{'include':[{'model':db[_0x7c7c('0xbf')],'as':'Messages'}]})[_0x7c7c('0x33')](function(_0x499fa4){return[_0x499fa4,!![]];});});}})[_0x7c7c('0x91')](function(_0x27239c,_0xe46dde){if(_0xe46dde){return _0x27239c;}return db[_0x7c7c('0xbf')][_0x7c7c('0x55')](_[_0x7c7c('0x4e')](_0x1e7670[_0x7c7c('0x56')],{'read':![],'body':_0x1e7670[_0x7c7c('0x56')][_0x7c7c('0x56')],'phone':_0x203661,'SmsAccountId':_0x306e93['id'],'SmsInteractionId':_0x27239c['id'],'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id']}))[_0x7c7c('0x33')](function(_0x308026){_0x27239c[_0x7c7c('0xc0')][_0x7c7c('0xc1')]=[];_0x27239c[_0x7c7c('0xc0')][_0x7c7c('0xc1')][_0x7c7c('0xc2')](_0x308026[_0x7c7c('0xc0')]);return _0x27239c;});})['then'](respondWithResult(_0x492e7a,null))[_0x7c7c('0x25')](handleError(_0x492e7a,null));};exports[_0x7c7c('0x27')]=function(_0xd442a9,_0x35abe2,_0x41525a){if(_0xd442a9[_0x7c7c('0x56')]['id']){delete _0xd442a9[_0x7c7c('0x56')]['id'];}var _0x495e78,_0xecb2da,_0x3bb6b5;return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0xd442a9[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x35abe2,null))[_0x7c7c('0x33')](function(_0x5bc224){if(_0x5bc224){_0x3bb6b5=_0x5bc224;logger['debug'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xc3'),_0x5bc224[_0x7c7c('0x3c')],util['inspect'](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));switch(_0x5bc224[_0x7c7c('0x3c')]){case'skebby':if(_0xd442a9['body']['skebby_dispatch_id']&&_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')]){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')];return db['SmsMessage'][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc4')]}});}break;case _0x7c7c('0x83'):if(_0xd442a9['body'][_0x7c7c('0xc5')]&&_0xd442a9['body']['statusInt']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc6')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9['body']['requestid']}});}break;case'clicksend':if(_0xd442a9['body'][_0x7c7c('0xc7')]&&_0xd442a9[_0x7c7c('0x56')]['status_code']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc8')];return db['SmsMessage'][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc7')]}});}break;case'infobip':var _0x2f4115=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0];if(_0x2f4115['messageId']&&_0x2f4115[_0x7c7c('0x27')][_0x7c7c('0xc9')]===_0x7c7c('0xca')){_0xecb2da=_0x2f4115[_0x7c7c('0x27')][_0x7c7c('0xc9')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0x2f4115[_0x7c7c('0x80')]}});}break;case _0x7c7c('0xcb'):if(_0xd442a9['body']['messageId']&&_0xd442a9['body']['status']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x80')]}});}break;case _0x7c7c('0x89'):if(_0xd442a9[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')]['id']){_0xecb2da=_0xd442a9['body'][0x0][_0x7c7c('0x3c')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')]['id']}});}break;case'intelepeer':if(_0xd442a9['body'][_0x7c7c('0xcc')]&&_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')]){_0xecb2da=_0xd442a9[_0x7c7c('0x56')]['status'];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9['body'][_0x7c7c('0xcc')]}});}break;}}})[_0x7c7c('0x33')](handleEntityNotFound(_0x35abe2,null))['then'](function(_0x151482){if(_0x151482){_0x495e78=_0x151482;switch(_0x3bb6b5[_0x7c7c('0x3c')]){case _0x7c7c('0x82'):if(_0xecb2da===_0x7c7c('0xca')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x82'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x83'):if(_0xecb2da==='1'){return _0x495e78['update']({'read':!![]});}else{logger['error'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x82'),util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x84'):if(!_0xd442a9[_0x7c7c('0x56')]['error_code']&&_0xecb2da>=0xc8&&_0xecb2da<=0xce){return _0x495e78['update']({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x84'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0xce'):var _0x59b95f=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0];if(_0x59b95f['status']['groupName']==='DELIVERED'){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c7c('0x27'),_0x7c7c('0xce'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xecb2da=='DELIVERED_TO_GATEWAY'||_0xecb2da==_0x7c7c('0xcf')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xcb'),util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x89'):if(_0xecb2da==_0x7c7c('0xd0')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),'bandwidth',util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xecb2da==='DELIVRD'||_0xecb2da==='ACCEPTD'){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c7c('0x27'),_0x7c7c('0xd1'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x495e78;}})['then'](respondWithResult(_0x35abe2,null))[_0x7c7c('0x25')](handleError(_0x35abe2,null));};exports[_0x7c7c('0xd2')]=function(_0x4fdee9,_0x18a671,_0x36dcdd){var _0x3167f2,_0x15144f,_0x4baffe;return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x4fdee9[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x18a671,null))['then'](function(_0x8c8aee){if(_0x8c8aee){_0x4baffe=_0x8c8aee;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7c7c('0xc3'),_0x8c8aee['type'],util[_0x7c7c('0xcd')](_0x4fdee9[_0x7c7c('0x41')],{'showHidden':![],'depth':null}));switch(_0x8c8aee['type']){case'csc':if(_0x4fdee9['query']['message-id']&&_0x4fdee9[_0x7c7c('0x41')][_0x7c7c('0xd3')]){_0x15144f=_0x4fdee9[_0x7c7c('0x41')][_0x7c7c('0xd3')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0x4fdee9['query'][_0x7c7c('0xd4')]}});}break;}}})[_0x7c7c('0x33')](handleEntityNotFound(_0x18a671,null))[_0x7c7c('0x33')](function(_0x284d08){if(_0x284d08){_0x3167f2=_0x284d08;switch(_0x4baffe['type']){case _0x7c7c('0xd5'):if(_0x15144f==='2'||_0x15144f==='6'){return _0x3167f2[_0x7c7c('0x32')]({'read':!![]});}else{logger['error'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xd5'),util[_0x7c7c('0xcd')](_0x4fdee9[_0x7c7c('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x3167f2;}})[_0x7c7c('0x33')](respondWithResult(_0x18a671,null))[_0x7c7c('0x25')](handleError(_0x18a671,null));};exports[_0x7c7c('0xd6')]=function(_0x160529,_0xb10d75,_0x2cf453){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x160529[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb10d75,null))[_0x7c7c('0x33')](function(_0x24cf40){if(_0x24cf40){return _0x24cf40['addAgents'](_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')],_['omit'](_0x160529['body'],[_0x7c7c('0x68'),'id'])||{})[_0x7c7c('0x91')](function(_0x466dd7){for(var _0x506229=0x0;_0x506229<_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')][_0x7c7c('0x46')];_0x506229+=0x1){socket[_0x7c7c('0xd7')](_0x7c7c('0xd8'),{'UserId':Number(_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')][_0x506229]),'SmsAccountId':Number(_0x160529['params']['id'])});}return _0x466dd7;});}})[_0x7c7c('0x33')](respondWithResult(_0xb10d75,null))[_0x7c7c('0x25')](handleError(_0xb10d75,null));};exports[_0x7c7c('0xd9')]=function(_0x2aea3f,_0x5e71bf,_0xe36efb){return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x2aea3f[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x5e71bf,null))['then'](function(_0x28d598){if(_0x28d598){return _0x28d598[_0x7c7c('0xd9')](_0x2aea3f['query']['ids'])[_0x7c7c('0x33')](function(){if(_[_0x7c7c('0xda')](_0x2aea3f[_0x7c7c('0x41')][_0x7c7c('0x68')])){for(var _0x4d5cfd=0x0;_0x4d5cfd<_0x2aea3f['query'][_0x7c7c('0x68')][_0x7c7c('0x46')];_0x4d5cfd+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2aea3f[_0x7c7c('0x41')]['ids'][_0x4d5cfd]),'SmsAccountId':Number(_0x2aea3f[_0x7c7c('0x5f')]['id'])});}}else{socket['emit'](_0x7c7c('0xdb'),{'UserId':Number(_0x2aea3f['query'][_0x7c7c('0x68')]),'SmsAccountId':Number(_0x2aea3f[_0x7c7c('0x5f')]['id'])});}});}})[_0x7c7c('0x33')](respondWithStatusCode(_0x5e71bf,null))['catch'](handleError(_0x5e71bf,null));};exports[_0x7c7c('0xdc')]=function(_0x18d1c5,_0x2257fc,_0x337e24){var _0x39021b={};var _0x33c3fd={};var _0xa20686;var _0x56e7c4;return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x18d1c5[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2257fc,null))[_0x7c7c('0x33')](function(_0x52dbf3){if(_0x52dbf3){_0xa20686=_0x52dbf3;_0x33c3fd['model']=_['keys'](db[_0x7c7c('0x99')][_0x7c7c('0x3b')]);_0x33c3fd[_0x7c7c('0x41')]=_['keys'](_0x18d1c5[_0x7c7c('0x41')]);_0x33c3fd[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x33c3fd[_0x7c7c('0x3e')],_0x33c3fd[_0x7c7c('0x41')]);_0x39021b[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x33c3fd[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x39021b[_0x7c7c('0x45')]=_0x39021b['attributes']['length']?_0x39021b[_0x7c7c('0x45')]:_0x33c3fd['model'];_0x39021b[_0x7c7c('0x49')]=qs['sort'](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x39021b['where']=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x18d1c5[_0x7c7c('0x41')],_0x33c3fd[_0x7c7c('0x42')]));if(_0x18d1c5['query'][_0x7c7c('0x4d')]){_0x39021b[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x39021b['where'],{'$or':_['map'](_0x39021b[_0x7c7c('0x45')],function(_0x3dfc66){var _0x2b4341={};_0x2b4341[_0x3dfc66]={'$like':'%'+_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x2b4341;})});}_0x39021b=_['merge']({},_0x39021b,_0x18d1c5[_0x7c7c('0x4f')]);return _0xa20686[_0x7c7c('0xdc')](_0x39021b);}})[_0x7c7c('0x33')](function(_0x18156f){if(_0x18156f){_0x56e7c4=_0x18156f[_0x7c7c('0x46')];if(!_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x47')](_0x7c7c('0x66'))){_0x39021b[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x18d1c5[_0x7c7c('0x41')]['limit']);_0x39021b[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x29')]);}return _0xa20686[_0x7c7c('0xdc')](_0x39021b);}})[_0x7c7c('0x33')](function(_0x413358){if(_0x413358){return _0x413358?{'count':_0x56e7c4,'rows':_0x413358}:null;}})[_0x7c7c('0x33')](respondWithResult(_0x2257fc,null))[_0x7c7c('0x25')](handleError(_0x2257fc,null));}; \ No newline at end of file +var _0x82e0=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','SmsAccount','includeAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','sender','text','connectel','clicksend','message_id','plivo','messageId','MessageUUID','infobip','results','csc','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','defaults','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','skebby','error_code','message-delivered','DELIVRD','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','SmsAccounts','name','index','Pause','mandatoryDispositionPause','map','fieldName','type'];(function(_0x40e6d9,_0x8cd668){var _0x54fdf8=function(_0x58ef66){while(--_0x58ef66){_0x40e6d9['push'](_0x40e6d9['shift']());}};_0x54fdf8(++_0x8cd668);}(_0x82e0,0x18c));var _0x082e=function(_0xe7fa94,_0x46046c){_0xe7fa94=_0xe7fa94-0x0;var _0x3d2416=_0x82e0[_0xe7fa94];return _0x3d2416;};'use strict';var emlformat=require(_0x082e('0x0'));var rimraf=require(_0x082e('0x1'));var zipdir=require(_0x082e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082e('0x3'));var moment=require(_0x082e('0x4'));var BPromise=require(_0x082e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x082e('0x6'));var sox=require(_0x082e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x082e('0x8'));var _=require(_0x082e('0x9'));var squel=require(_0x082e('0xa'));var crypto=require(_0x082e('0xb'));var jsforce=require(_0x082e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x082e('0xd'));var querystring=require(_0x082e('0xe'));var Papa=require(_0x082e('0xf'));var Redis=require(_0x082e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x082e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x082e('0x12'));var logger=require(_0x082e('0x13'))(_0x082e('0x14'));var utils=require(_0x082e('0x15'));var config=require(_0x082e('0x16'));var licenseUtil=require(_0x082e('0x17'));var db=require('../../mysqldb')['db'];config[_0x082e('0x18')]=_['defaults'](config['redis'],{'host':_0x082e('0x19'),'port':0x18eb});var socket=require(_0x082e('0x1a'))(new Redis(config[_0x082e('0x18')]));require(_0x082e('0x1b'))[_0x082e('0x1c')](socket);var jayson=require(_0x082e('0x1d'));var client=jayson[_0x082e('0x1e')][_0x082e('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2881de,_0x3537dd,_0x2eede4,_0x342a9e){return new BPromise(function(_0x5ef472,_0x47f27a){var _0x5ae0d8=_0x342a9e||client;return _0x5ae0d8['request'](_0x2881de,_0x2eede4)['then'](function(_0x3301af){logger[_0x082e('0x20')](_0x082e('0x21'),_0x3537dd,'request\x20sent');logger[_0x082e('0x22')](_0x082e('0x23'),_0x3537dd,_0x082e('0x24'),JSON[_0x082e('0x25')](_0x3301af));if(_0x3301af[_0x082e('0x26')]){if(_0x3301af[_0x082e('0x26')]['code']===0x1f4){logger[_0x082e('0x26')](_0x082e('0x21'),_0x3537dd,_0x3301af[_0x082e('0x26')][_0x082e('0x27')]);return _0x47f27a(_0x3301af['error'][_0x082e('0x27')]);}logger[_0x082e('0x26')](_0x082e('0x21'),_0x3537dd,_0x3301af[_0x082e('0x26')][_0x082e('0x27')]);return _0x5ef472(_0x3301af[_0x082e('0x26')][_0x082e('0x27')]);}else{logger[_0x082e('0x20')](_0x082e('0x21'),_0x3537dd,_0x082e('0x24'));_0x5ef472(_0x3301af['result']['message']);}})[_0x082e('0x28')](function(_0x28768f){logger['error'](_0x082e('0x21'),_0x3537dd,_0x28768f);_0x47f27a(_0x28768f);});});}function respondWithStatusCode(_0x338169,_0x105a77){_0x105a77=_0x105a77||0xcc;return function(_0xa76d60){if(_0xa76d60){return _0x338169[_0x082e('0x29')](_0x105a77);}return _0x338169[_0x082e('0x2a')](_0x105a77)[_0x082e('0x2b')]();};}function respondWithResult(_0x47b7f1,_0x52b405){_0x52b405=_0x52b405||0xc8;return function(_0x42526e){if(_0x42526e){return _0x47b7f1[_0x082e('0x2a')](_0x52b405)[_0x082e('0x2c')](_0x42526e);}};}function respondWithFilteredResult(_0x2ffe84,_0x27420a){return function(_0x5859a2){if(_0x5859a2){var _0x3ac16a=typeof _0x27420a['offset']===_0x082e('0x2d')&&typeof _0x27420a[_0x082e('0x2e')]===_0x082e('0x2d');var _0x5b87c7=_0x5859a2[_0x082e('0x2f')];var _0x2b462e=_0x3ac16a?0x0:_0x27420a['offset'];var _0x43e183=_0x3ac16a?_0x5859a2['count']:_0x27420a[_0x082e('0x30')]+_0x27420a[_0x082e('0x2e')];var _0x5c3a51;if(_0x43e183>=_0x5b87c7){_0x43e183=_0x5b87c7;_0x5c3a51=0xc8;}else{_0x5c3a51=0xce;}_0x2ffe84[_0x082e('0x2a')](_0x5c3a51);return _0x2ffe84['set'](_0x082e('0x31'),_0x2b462e+'-'+_0x43e183+'/'+_0x5b87c7)[_0x082e('0x2c')](_0x5859a2);}return null;};}function patchUpdates(_0x2773b3){return function(_0x3e8ab5){try{jsonpatch[_0x082e('0x32')](_0x3e8ab5,_0x2773b3,!![]);}catch(_0x5570ee){return BPromise['reject'](_0x5570ee);}return _0x3e8ab5[_0x082e('0x33')]();};}function saveUpdates(_0x12e98a,_0x3f9795){return function(_0x3bf67a){if(_0x3bf67a){return _0x3bf67a[_0x082e('0x34')](_0x12e98a)[_0x082e('0x35')](function(_0x444ddc){return _0x444ddc;});}return null;};}function removeEntity(_0x3ea867,_0xc31430){return function(_0x10aa5d){if(_0x10aa5d){return _0x10aa5d[_0x082e('0x36')]()[_0x082e('0x35')](function(){var _0x170751=_0x10aa5d[_0x082e('0x37')]({'plain':!![]});var _0x27a25f=_0x082e('0x38');return db['UserProfileResource'][_0x082e('0x36')]({'where':{'type':_0x27a25f,'resourceId':_0x170751['id']}})[_0x082e('0x35')](function(){return _0x10aa5d;});})[_0x082e('0x35')](function(){_0x3ea867['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ea54,_0x1ab2d5){return function(_0x4518f2){if(!_0x4518f2){_0x52ea54[_0x082e('0x29')](0x194);}return _0x4518f2;};}function handleError(_0x317e44,_0x4a3891){_0x4a3891=_0x4a3891||0x1f4;return function(_0x4c503a){logger[_0x082e('0x26')](_0x4c503a['stack']);if(_0x4c503a[_0x082e('0x39')]){delete _0x4c503a[_0x082e('0x39')];}_0x317e44[_0x082e('0x2a')](_0x4a3891)['send'](_0x4c503a);};}exports[_0x082e('0x3a')]=function(_0x52dd01,_0x4d0da8){var _0x21809d={'include':[{'model':db[_0x082e('0x3b')],'as':_0x082e('0x3c')}]},_0x238094={},_0x2afc2={'count':0x0,'rows':[]};var _0x3c6941=_[_0x082e('0x3d')](db['SmsAccount']['rawAttributes'],function(_0x2ec3a4){return{'name':_0x2ec3a4[_0x082e('0x3e')],'type':_0x2ec3a4[_0x082e('0x3f')][_0x082e('0x40')]};});_0x238094[_0x082e('0x41')]=_['map'](_0x3c6941,'name');_0x238094[_0x082e('0x42')]=_[_0x082e('0x43')](_0x52dd01['query']);_0x238094['filters']=_[_0x082e('0x44')](_0x238094[_0x082e('0x41')],_0x238094[_0x082e('0x42')]);_0x21809d[_0x082e('0x45')]=_[_0x082e('0x44')](_0x238094['model'],qs[_0x082e('0x46')](_0x52dd01[_0x082e('0x42')][_0x082e('0x46')]));_0x21809d[_0x082e('0x45')]=_0x21809d[_0x082e('0x45')][_0x082e('0x47')]?_0x21809d[_0x082e('0x45')]:_0x238094['model'];if(!_0x52dd01[_0x082e('0x42')][_0x082e('0x48')](_0x082e('0x49'))){_0x21809d[_0x082e('0x2e')]=qs['limit'](_0x52dd01[_0x082e('0x42')][_0x082e('0x2e')]);_0x21809d[_0x082e('0x30')]=qs[_0x082e('0x30')](_0x52dd01[_0x082e('0x42')][_0x082e('0x30')]);}_0x21809d[_0x082e('0x4a')]=qs[_0x082e('0x4b')](_0x52dd01[_0x082e('0x42')][_0x082e('0x4b')]);_0x21809d[_0x082e('0x4c')]=qs['filters'](_[_0x082e('0x4d')](_0x52dd01[_0x082e('0x42')],_0x238094[_0x082e('0x4e')]),_0x3c6941);if(_0x52dd01[_0x082e('0x42')]['filter']){_0x21809d[_0x082e('0x4c')]=_[_0x082e('0x4f')](_0x21809d[_0x082e('0x4c')],{'$or':_[_0x082e('0x3d')](_0x3c6941,function(_0x668ef5){if(_0x668ef5['type']!==_0x082e('0x50')){var _0x1502ba={};_0x1502ba[_0x668ef5[_0x082e('0x39')]]={'$like':'%'+_0x52dd01[_0x082e('0x42')][_0x082e('0x51')]+'%'};return _0x1502ba;}})});}_0x21809d=_[_0x082e('0x4f')]({},_0x21809d,_0x52dd01[_0x082e('0x52')]);var _0x2cf458={'where':_0x21809d['where']};return db[_0x082e('0x53')]['count'](_0x2cf458)[_0x082e('0x35')](function(_0x9fcdea){_0x2afc2[_0x082e('0x2f')]=_0x9fcdea;if(_0x52dd01[_0x082e('0x42')][_0x082e('0x54')]){_0x21809d['include']=[{'all':!![]}];}return db[_0x082e('0x53')]['findAll'](_0x21809d);})[_0x082e('0x35')](function(_0xf6ac35){_0x2afc2[_0x082e('0x55')]=_0xf6ac35;return _0x2afc2;})[_0x082e('0x35')](respondWithFilteredResult(_0x4d0da8,_0x21809d))[_0x082e('0x28')](handleError(_0x4d0da8,null));};exports[_0x082e('0x56')]=function(_0x237b8e,_0x2fcea8){var _0x4758d1={'raw':![],'where':{'id':_0x237b8e[_0x082e('0x57')]['id']},'include':[{'model':db[_0x082e('0x3b')],'as':_0x082e('0x3c')}]},_0x2fd542={};_0x2fd542[_0x082e('0x41')]=_[_0x082e('0x43')](db[_0x082e('0x53')][_0x082e('0x58')]);_0x2fd542[_0x082e('0x42')]=_[_0x082e('0x43')](_0x237b8e[_0x082e('0x42')]);_0x2fd542[_0x082e('0x4e')]=_[_0x082e('0x44')](_0x2fd542[_0x082e('0x41')],_0x2fd542[_0x082e('0x42')]);_0x4758d1['attributes']=_[_0x082e('0x44')](_0x2fd542[_0x082e('0x41')],qs[_0x082e('0x46')](_0x237b8e['query']['fields']));_0x4758d1[_0x082e('0x45')]=_0x4758d1[_0x082e('0x45')][_0x082e('0x47')]?_0x4758d1[_0x082e('0x45')]:_0x2fd542[_0x082e('0x41')];if(_0x237b8e[_0x082e('0x42')][_0x082e('0x54')]){_0x4758d1['include']=[{'all':!![]}];}_0x4758d1=_[_0x082e('0x4f')]({},_0x4758d1,_0x237b8e[_0x082e('0x52')]);return db[_0x082e('0x53')][_0x082e('0x59')](_0x4758d1)[_0x082e('0x35')](handleEntityNotFound(_0x2fcea8,null))['then'](respondWithResult(_0x2fcea8,null))['catch'](handleError(_0x2fcea8,null));};exports[_0x082e('0x5a')]=function(_0x511f3f,_0x444a92){return db[_0x082e('0x53')]['create'](_0x511f3f[_0x082e('0x5b')],{})[_0x082e('0x35')](function(_0x801797){var _0x198d2a=_0x511f3f[_0x082e('0x5c')]['get']({'plain':!![]});if(!_0x198d2a)throw new Error(_0x082e('0x5d'));if(_0x198d2a[_0x082e('0x5e')]===_0x082e('0x5c')){var _0xc88e2e=_0x801797['get']({'plain':!![]});var _0x391977=_0x082e('0x38');return db['UserProfileSection'][_0x082e('0x59')]({'where':{'name':_0x391977,'userProfileId':_0x198d2a[_0x082e('0x5f')]},'raw':!![]})[_0x082e('0x35')](function(_0x41c766){if(_0x41c766&&_0x41c766['autoAssociation']===0x0){return db[_0x082e('0x60')][_0x082e('0x5a')]({'name':_0xc88e2e['name'],'resourceId':_0xc88e2e['id'],'type':_0x41c766[_0x082e('0x39')],'sectionId':_0x41c766['id']},{})[_0x082e('0x35')](function(){return _0x801797;});}else{return _0x801797;}})['catch'](function(_0xc1b94e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc1b94e);throw _0xc1b94e;});}return _0x801797;})[_0x082e('0x35')](respondWithResult(_0x444a92,0xc9))[_0x082e('0x28')](handleError(_0x444a92,null));};exports['update']=function(_0x36b1ed,_0x1503c0){if(_0x36b1ed['body']['id']){delete _0x36b1ed['body']['id'];}return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x36b1ed[_0x082e('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x082e('0x35')](handleEntityNotFound(_0x1503c0,null))[_0x082e('0x35')](saveUpdates(_0x36b1ed[_0x082e('0x5b')],null))[_0x082e('0x35')](respondWithResult(_0x1503c0,null))[_0x082e('0x28')](handleError(_0x1503c0,null));};exports[_0x082e('0x36')]=function(_0x54fcc6,_0x12ccea){return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x54fcc6[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x12ccea,null))['then'](removeEntity(_0x12ccea,null))[_0x082e('0x28')](handleError(_0x12ccea,null));};exports[_0x082e('0x61')]=function(_0x5baa77,_0x224b93){return db[_0x082e('0x53')][_0x082e('0x61')]()[_0x082e('0x35')](respondWithResult(_0x224b93,null))[_0x082e('0x28')](handleError(_0x224b93,null));};exports[_0x082e('0x62')]=function(_0x4de530,_0x4eb39f,_0x2a0fc6){if(_0x4de530[_0x082e('0x5b')]['id']){delete _0x4de530[_0x082e('0x5b')]['id'];}return db[_0x082e('0x53')]['find']({'where':{'id':_0x4de530['params']['id']}})['then'](handleEntityNotFound(_0x4eb39f,null))['then'](function(_0x3bb8b9){if(_0x3bb8b9){_0x4de530[_0x082e('0x5b')][_0x082e('0x63')]=_0x3bb8b9['id'];return db[_0x082e('0x64')][_0x082e('0x5a')](_0x4de530[_0x082e('0x5b')]);}})[_0x082e('0x35')](respondWithResult(_0x4eb39f,null))[_0x082e('0x28')](handleError(_0x4eb39f,null));};exports[_0x082e('0x65')]=function(_0x4d9f99,_0x10c221,_0x19335b){var _0x2427db={'raw':![],'where':{}};var _0x850d89={};var _0x2e1521={'count':0x0,'rows':[]};return db[_0x082e('0x53')][_0x082e('0x66')]({'where':{'id':_0x4d9f99['params']['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x10c221,null))[_0x082e('0x35')](function(_0x2374e3){if(_0x2374e3){_0x850d89[_0x082e('0x41')]=_[_0x082e('0x43')](db[_0x082e('0x64')]['rawAttributes']);_0x850d89[_0x082e('0x42')]=_[_0x082e('0x43')](_0x4d9f99[_0x082e('0x42')]);_0x850d89[_0x082e('0x4e')]=_[_0x082e('0x44')](_0x850d89[_0x082e('0x41')],_0x850d89[_0x082e('0x42')]);_0x2427db[_0x082e('0x45')]=_[_0x082e('0x44')](_0x850d89[_0x082e('0x41')],qs[_0x082e('0x46')](_0x4d9f99[_0x082e('0x42')]['fields']));_0x2427db[_0x082e('0x45')]=_0x2427db[_0x082e('0x45')][_0x082e('0x47')]?_0x2427db[_0x082e('0x45')]:_0x850d89[_0x082e('0x41')];if(!_0x4d9f99['query']['hasOwnProperty']('nolimit')){_0x2427db[_0x082e('0x2e')]=qs[_0x082e('0x2e')](_0x4d9f99[_0x082e('0x42')][_0x082e('0x2e')]);_0x2427db[_0x082e('0x30')]=qs[_0x082e('0x30')](_0x4d9f99[_0x082e('0x42')][_0x082e('0x30')]);}_0x2427db[_0x082e('0x4a')]=qs[_0x082e('0x4b')](_0x4d9f99[_0x082e('0x42')]['sort']);_0x2427db[_0x082e('0x4c')]=qs[_0x082e('0x4e')](_[_0x082e('0x4d')](_0x4d9f99[_0x082e('0x42')],_0x850d89['filters']));_0x2427db[_0x082e('0x4c')][_0x082e('0x63')]=_0x2374e3['id'];if(_0x4d9f99[_0x082e('0x42')][_0x082e('0x51')]){_0x2427db[_0x082e('0x4c')]=_['merge'](_0x2427db[_0x082e('0x4c')],{'$or':_[_0x082e('0x3d')](_0x2427db['attributes'],function(_0x1d82fe){var _0x443afb={};_0x443afb[_0x1d82fe]={'$like':'%'+_0x4d9f99['query'][_0x082e('0x51')]+'%'};return _0x443afb;})});}_0x2427db=_[_0x082e('0x4f')]({},_0x2427db,_0x4d9f99[_0x082e('0x52')]);return db['Disposition'][_0x082e('0x2f')]({'where':_0x2427db['where']})[_0x082e('0x35')](function(_0xda538){_0x2e1521[_0x082e('0x2f')]=_0xda538;if(_0x4d9f99['query'][_0x082e('0x54')]){_0x2427db[_0x082e('0x67')]=[{'all':!![]}];}return db['Disposition'][_0x082e('0x68')](_0x2427db);})[_0x082e('0x35')](function(_0xd2f5a0){_0x2e1521[_0x082e('0x55')]=_0xd2f5a0;return _0x2e1521;});}})['then'](respondWithFilteredResult(_0x10c221,_0x2427db))[_0x082e('0x28')](handleError(_0x10c221,null));};exports[_0x082e('0x69')]=function(_0x49575b,_0x3c9f25,_0x313664){return db['SmsAccount']['find']({'where':{'id':_0x49575b[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x3c9f25,null))[_0x082e('0x35')](function(_0x22c928){if(_0x22c928){return _0x22c928[_0x082e('0x69')](_0x49575b[_0x082e('0x42')][_0x082e('0x6a')]);}})[_0x082e('0x35')](respondWithStatusCode(_0x3c9f25,null))[_0x082e('0x28')](handleError(_0x3c9f25,null));};exports[_0x082e('0x6b')]=function(_0x1170a1,_0x51a939,_0x5a78f2){if(_0x1170a1[_0x082e('0x5b')]['id']){delete _0x1170a1[_0x082e('0x5b')]['id'];}return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x1170a1['params']['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x51a939,null))['then'](function(_0x2f086b){if(_0x2f086b){_0x1170a1[_0x082e('0x5b')]['SmsAccountId']=_0x2f086b['id'];return db[_0x082e('0x6c')][_0x082e('0x5a')](_0x1170a1[_0x082e('0x5b')]);}})[_0x082e('0x35')](respondWithResult(_0x51a939,null))[_0x082e('0x28')](handleError(_0x51a939,null));};exports[_0x082e('0x6d')]=function(_0x3ff9f7,_0x936dc6,_0x32b403){var _0x2c7831={'raw':![],'where':{}};var _0x522dbe={};var _0xfb86ff={'count':0x0,'rows':[]};return db[_0x082e('0x53')][_0x082e('0x66')]({'where':{'id':_0x3ff9f7['params']['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x936dc6,null))[_0x082e('0x35')](function(_0x3c5962){if(_0x3c5962){_0x522dbe['model']=_[_0x082e('0x43')](db[_0x082e('0x6c')][_0x082e('0x58')]);_0x522dbe[_0x082e('0x42')]=_['keys'](_0x3ff9f7['query']);_0x522dbe[_0x082e('0x4e')]=_[_0x082e('0x44')](_0x522dbe[_0x082e('0x41')],_0x522dbe['query']);_0x2c7831[_0x082e('0x45')]=_[_0x082e('0x44')](_0x522dbe[_0x082e('0x41')],qs[_0x082e('0x46')](_0x3ff9f7[_0x082e('0x42')][_0x082e('0x46')]));_0x2c7831[_0x082e('0x45')]=_0x2c7831[_0x082e('0x45')][_0x082e('0x47')]?_0x2c7831['attributes']:_0x522dbe[_0x082e('0x41')];if(!_0x3ff9f7[_0x082e('0x42')][_0x082e('0x48')](_0x082e('0x49'))){_0x2c7831['limit']=qs[_0x082e('0x2e')](_0x3ff9f7['query'][_0x082e('0x2e')]);_0x2c7831[_0x082e('0x30')]=qs[_0x082e('0x30')](_0x3ff9f7[_0x082e('0x42')][_0x082e('0x30')]);}_0x2c7831['order']=qs['sort'](_0x3ff9f7[_0x082e('0x42')]['sort']);_0x2c7831['where']=qs[_0x082e('0x4e')](_[_0x082e('0x4d')](_0x3ff9f7[_0x082e('0x42')],_0x522dbe['filters']));_0x2c7831['where'][_0x082e('0x63')]=_0x3c5962['id'];if(_0x3ff9f7[_0x082e('0x42')][_0x082e('0x51')]){_0x2c7831[_0x082e('0x4c')]=_['merge'](_0x2c7831[_0x082e('0x4c')],{'$or':_[_0x082e('0x3d')](_0x2c7831[_0x082e('0x45')],function(_0x1eb6bf){var _0x4832d7={};_0x4832d7[_0x1eb6bf]={'$like':'%'+_0x3ff9f7[_0x082e('0x42')][_0x082e('0x51')]+'%'};return _0x4832d7;})});}_0x2c7831=_[_0x082e('0x4f')]({},_0x2c7831,_0x3ff9f7[_0x082e('0x52')]);return db[_0x082e('0x6c')][_0x082e('0x2f')]({'where':_0x2c7831['where']})[_0x082e('0x35')](function(_0x4b8b0e){_0xfb86ff[_0x082e('0x2f')]=_0x4b8b0e;if(_0x3ff9f7[_0x082e('0x42')][_0x082e('0x54')]){_0x2c7831[_0x082e('0x67')]=[{'all':!![]}];}return db[_0x082e('0x6c')][_0x082e('0x68')](_0x2c7831);})[_0x082e('0x35')](function(_0x476a77){_0xfb86ff['rows']=_0x476a77;return _0xfb86ff;});}})['then'](respondWithFilteredResult(_0x936dc6,_0x2c7831))[_0x082e('0x28')](handleError(_0x936dc6,null));};exports[_0x082e('0x6e')]=function(_0x2bf4f1,_0x26acd2,_0x144b3b){return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x2bf4f1[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x26acd2,null))['then'](function(_0x2dd635){if(_0x2dd635){return _0x2dd635[_0x082e('0x6e')](_0x2bf4f1[_0x082e('0x42')][_0x082e('0x6a')]);}})[_0x082e('0x35')](respondWithStatusCode(_0x26acd2,null))[_0x082e('0x28')](handleError(_0x26acd2,null));};exports[_0x082e('0x6f')]=function(_0x620dc7,_0x544558,_0xe563c1){var _0x321322={'channel':_0x082e('0x70')};var _0x4ada23=[];var _0x152cba=[];var _0x39938a={};return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x620dc7['params']['id']},'include':[{'model':db[_0x082e('0x71')],'as':_0x082e('0x72')}]})[_0x082e('0x35')](handleEntityNotFound(_0x544558,null))[_0x082e('0x35')](function(_0x3dcc19){_0x321322[_0x082e('0x73')]=_0x3dcc19;_0x321322[_0x082e('0x74')]=_['orderBy'](_0x3dcc19[_0x082e('0x72')],['priority'],[_0x082e('0x75')]);if(_0x321322[_0x082e('0x73')][_0x082e('0x72')]){delete _0x321322[_0x082e('0x73')]['Applications'];}return db[_0x082e('0x76')][_0x082e('0x61')]();})[_0x082e('0x35')](function(_0x46790a){if(!_0x46790a){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0x79'));}_0x4ada23=_['difference'](_[_0x082e('0x43')](_0x46790a),['createdAt',_0x082e('0x7a')]);_0x152cba=_[_0x082e('0x7b')](_[_0x082e('0x43')](_0x46790a),[_0x082e('0x7c'),_0x082e('0x7a'),_0x082e('0x7d'),'ListId']);_0x321322['body']={'mapKey':_0x082e('0x7e')};if(_0x321322['account'][_0x082e('0x3f')]){switch(_0x321322[_0x082e('0x73')]['type']){case _0x082e('0x7f'):_0x321322['body'][_0x082e('0x80')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x81')];_0x321322['body'][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x82')];_0x321322[_0x082e('0x5b')]['messageId']=_0x620dc7['body'][_0x082e('0x83')];break;case'skebby':_0x321322[_0x082e('0x5b')][_0x082e('0x80')]='+'+_0x620dc7['body'][_0x082e('0x84')];_0x321322['body']['body']=_0x620dc7[_0x082e('0x5b')][_0x082e('0x85')];break;case _0x082e('0x86'):_0x321322[_0x082e('0x5b')]['from']=_0x620dc7['body'][_0x082e('0x80')];_0x321322[_0x082e('0x5b')][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x27')];break;case _0x082e('0x87'):_0x321322['body'][_0x082e('0x80')]=_0x620dc7['body']['from'];_0x321322['body']['body']=_0x620dc7[_0x082e('0x5b')][_0x082e('0x5b')];_0x321322[_0x082e('0x5b')]['messageId']=_0x620dc7['body'][_0x082e('0x88')];break;case _0x082e('0x89'):_0x321322[_0x082e('0x5b')][_0x082e('0x80')]=_0x620dc7[_0x082e('0x5b')]['From'];_0x321322[_0x082e('0x5b')][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')]['Text'];_0x321322[_0x082e('0x5b')][_0x082e('0x8a')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x8b')];break;case _0x082e('0x8c'):_0x321322[_0x082e('0x5b')][_0x082e('0x80')]='+'+_0x620dc7[_0x082e('0x5b')]['results'][0x0][_0x082e('0x80')];_0x321322['body'][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x8d')][0x0]['text'];_0x321322[_0x082e('0x5b')][_0x082e('0x8a')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x8d')][0x0][_0x082e('0x8a')];break;case _0x082e('0x8e'):_0x321322[_0x082e('0x5b')][_0x082e('0x80')]=_0x620dc7[_0x082e('0x5b')]['originatingAddress'];_0x321322[_0x082e('0x5b')][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')]['segmentedMessage'][_0x082e('0x27')];break;case _0x082e('0x8f'):_0x321322['body'][_0x082e('0x80')]=_0x620dc7[_0x082e('0x5b')]['fromNumber'];_0x321322[_0x082e('0x5b')]['body']=_0x620dc7[_0x082e('0x5b')][_0x082e('0x85')];_0x321322[_0x082e('0x5b')][_0x082e('0x8a')]=_0x620dc7['body']['replyMessageId'];break;case _0x082e('0x90'):_0x321322[_0x082e('0x5b')][_0x082e('0x8a')]=_0x620dc7['body'][0x0]['message']['id'];_0x321322[_0x082e('0x5b')]['from']=_0x620dc7[_0x082e('0x5b')][0x0]['message']['from'];_0x321322[_0x082e('0x5b')][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')][0x0][_0x082e('0x27')][_0x082e('0x85')];break;case _0x082e('0x91'):_0x321322[_0x082e('0x5b')][_0x082e('0x80')]=_0x620dc7['body'][_0x082e('0x80')];_0x321322['body'][_0x082e('0x5b')]=_0x620dc7[_0x082e('0x5b')][_0x082e('0x27')];_0x321322[_0x082e('0x5b')][_0x082e('0x8a')]=_0x620dc7['body'][_0x082e('0x92')];break;}}if(_0x321322[_0x082e('0x5b')]['id']){delete _0x321322['body']['id'];}if(_[_0x082e('0x93')](_0x321322['body'][_0x082e('0x80')])){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0x94'));}if(_[_0x082e('0x93')](_0x321322[_0x082e('0x5b')][_0x082e('0x5b')])||_0x321322[_0x082e('0x5b')][_0x082e('0x5b')]===''){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0x95'));}if(_['isNil'](_0x321322[_0x082e('0x5b')][_0x082e('0x96')])){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0x97')+_0x152cba);}if(!_[_0x082e('0x98')](_0x152cba,_0x321322[_0x082e('0x5b')][_0x082e('0x96')])){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0x99')+_0x152cba);}_0x39938a[_0x321322[_0x082e('0x5b')][_0x082e('0x96')]]=_0x321322['body'][_0x082e('0x80')];return db[_0x082e('0x9a')]['find']({'where':{'id':_0x321322['account'][_0x082e('0x9b')]},'include':[{'model':db['CmContact'],'as':_0x082e('0x9c'),'where':_0x39938a,'limit':0x1,'order':[[_0x082e('0x7a'),'DESC']]}]});})[_0x082e('0x35')](handleEntityNotFound(_0x544558,null))[_0x082e('0x35')](function(_0x1c8b51){if(_0x1c8b51){_0x321322[_0x082e('0x9d')]=_['omit'](_0x1c8b51,[_0x082e('0x9c')]);if(_0x1c8b51[_0x082e('0x9c')][_0x082e('0x47')]){return _0x1c8b51[_0x082e('0x9c')][0x0];}var _0x52a265=_[_0x082e('0x9e')](_0x321322[_0x082e('0x5b')],{'firstName':_0x321322[_0x082e('0x5b')][_0x082e('0x80')],'ListId':_0x1c8b51['id']});_0x52a265[_0x321322['body'][_0x082e('0x96')]]=_0x321322[_0x082e('0x5b')][_0x082e('0x80')];return db[_0x082e('0x76')][_0x082e('0x5a')](_0x52a265,{'fields':_0x4ada23,'raw':!![]});}})['then'](handleEntityNotFound(_0x544558,null))[_0x082e('0x35')](function(_0x3c152c){if(_0x3c152c){_0x321322[_0x082e('0x9f')]=_0x3c152c;var _0x463137={'ContactId':_0x3c152c['id'],'phone':_0x321322[_0x082e('0x5b')][_0x082e('0x80')],'SmsAccountId':_0x620dc7[_0x082e('0x57')]['id']};var _0x1bdd0c={'ContactId':_0x3c152c['id'],'SmsAccountId':_0x620dc7[_0x082e('0x57')]['id'],'closed':![]};return db[_0x082e('0xa0')][_0x082e('0x59')]({'where':_0x1bdd0c})[_0x082e('0x35')](function(_0x39a300){if(_0x39a300){return[_0x39a300,![]];}return db[_0x082e('0xa0')][_0x082e('0x5a')](_0x463137)[_0x082e('0x35')](function(_0x28ce97){return[_0x28ce97,!![]];});});}})[_0x082e('0xa1')](function(_0x358655,_0x20155e){_0x321322[_0x082e('0xa2')]=_0x358655[_0x082e('0x37')]({'plain':!![]});_0x321322[_0x082e('0xa2')][_0x082e('0xa3')]=![];if(_0x20155e){if(_0x321322[_0x082e('0x73')]['autoclose']){_0x321322[_0x082e('0x74')][_0x082e('0xa4')]({'id':0x0,'priority':_0x321322[_0x082e('0x74')]['length']+0x1,'app':_0x082e('0xa5'),'appdata':_0x082e('0xa6'),'interval':_0x082e('0xa7')});}_0x321322[_0x082e('0xa2')][_0x082e('0xa3')]=!![];}return db[_0x082e('0xa8')][_0x082e('0x5a')]({'phone':_0x321322[_0x082e('0x5b')][_0x082e('0x80')],'messageId':_0x321322['body'][_0x082e('0x8a')],'body':_0x321322[_0x082e('0x5b')][_0x082e('0x5b')],'SmsAccountId':_0x620dc7[_0x082e('0x57')]['id'],'SmsInteractionId':_0x358655['id'],'direction':'in','ContactId':_0x358655['ContactId'],'AttachmentId':_0x321322[_0x082e('0x5b')][_0x082e('0xa9')]});})[_0x082e('0x35')](function(_0x5db1fd){_0x321322['message']=_0x5db1fd;if(!_0x321322[_0x082e('0xa2')][_0x082e('0xaa')])return;return db[_0x082e('0xab')][_0x082e('0x59')]({'attributes':['id',_0x082e('0x39')],'where':{'id':_0x321322[_0x082e('0xa2')]['UserId']}});})[_0x082e('0x35')](function(_0x831666){if(_0x831666){_0x321322[_0x082e('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':_0x082e('0xac'),'appdata':_0x831666[_0x082e('0x39')]+','+(_0x321322[_0x082e('0x73')][_0x082e('0xad')]||0xa),'interval':_0x082e('0xa7')});}if(!_0x321322[_0x082e('0xa2')]['queueId'])return;return db[_0x082e('0xae')][_0x082e('0x59')]({'attributes':['id',_0x082e('0x39')],'where':{'id':_0x321322[_0x082e('0xa2')][_0x082e('0xaf')]}});})['then'](function(_0x19f1a1){if(_0x19f1a1){_0x321322[_0x082e('0x74')]['unshift']({'id':0x0,'priority':0x1,'app':_0x082e('0xb0'),'appdata':_0x19f1a1[_0x082e('0x39')]+','+(_0x321322[_0x082e('0x73')]['waitForTheAssignedQueue']||0x12c),'interval':_0x082e('0xa7')});}return respondWithRpcPromise(_0x082e('0xb1'),_0x082e('0xb2'),_0x321322);})[_0x082e('0x35')](function(_0x204066){if(_0x204066){var _0x2bd08c=0xc8;var _0x5609ac='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5609ac,_0x2bd08c,_0x082e('0xb3'));logger[_0x082e('0x22')](_0x082e('0xb4'),_0x5609ac,_0x2bd08c,_0x082e('0xb3'),JSON['stringify'](_0x204066));if(_0x321322[_0x082e('0x73')][_0x082e('0x3f')]===_0x082e('0x7f')){return _0x544558[_0x082e('0x2a')](_0x2bd08c)[_0x082e('0xb5')]('Content-Type',_0x082e('0xb6'))[_0x082e('0xb7')](_0x082e('0xb8'));}else{return _0x544558['status'](_0x2bd08c)[_0x082e('0x2c')](_0x204066);}}})[_0x082e('0x28')](handleError(_0x544558,null));};exports[_0x082e('0xb9')]=function(_0x419a7c,_0x4bc247){var _0x258c63=_0x419a7c['params']['id'];var _0x4e5ed7=_0x419a7c[_0x082e('0x5b')];var _0x4845e3=0xc8;var _0x25aab1=null;return db['sequelize'][_0x082e('0xba')]({'isolationLevel':db[_0x082e('0xbb')][_0x082e('0xbc')][_0x082e('0xbd')][_0x082e('0xbe')]},function(_0x37c62c){return db['SmsAccount']['findOne']({'where':{'id':_0x258c63},'transaction':_0x37c62c})[_0x082e('0x35')](function(_0x552f64){if(_0x552f64){return db[_0x082e('0x71')]['destroy']({'where':{'SmsAccountId':_0x258c63},'transaction':_0x37c62c})[_0x082e('0x35')](function(){var _0x451dd0=_[_0x082e('0x3d')](_0x4e5ed7,function(_0x2b0d8c){_0x2b0d8c['SmsAccountId']=_0x258c63;return _0x2b0d8c;});return db[_0x082e('0x71')]['bulkCreate'](_0x451dd0,{'transaction':_0x37c62c});});}else{_0x4845e3=0x194;_0x25aab1=[];}});})['then'](function(){if(_0x4845e3!==0x194){return db[_0x082e('0x71')][_0x082e('0xbf')]({'where':{'SmsAccountId':_0x258c63},'order':_0x082e('0xc0')})['then'](function(_0x105d75){_0x25aab1=_0x105d75;});}})[_0x082e('0x28')](function(_0x4161cd){_0x4845e3=0x1f4;logger[_0x082e('0x26')](_0x4161cd[_0x082e('0xc1')]);if(_0x4161cd[_0x082e('0x39')]){delete _0x4161cd[_0x082e('0x39')];}_0x25aab1=_0x4161cd;})[_0x082e('0xc2')](function(){if(_0x25aab1===null){_0x4bc247[_0x082e('0x29')](_0x4845e3);}else{if(_0x4845e3===0x1f4){_0x4bc247[_0x082e('0x2a')](_0x4845e3)[_0x082e('0xb7')](_0x25aab1);}else{_0x4bc247[_0x082e('0x2a')](_0x4845e3)[_0x082e('0x2c')](_0x25aab1);}}});};exports[_0x082e('0xc3')]=function(_0x994a82,_0x34563f,_0x46d5e9){var _0x5e1bbe={};var _0x2b2c76={};var _0x387add;var _0x44e7ec;return db['SmsAccount'][_0x082e('0x66')]({'where':{'id':_0x994a82['params']['id']}})['then'](handleEntityNotFound(_0x34563f,null))[_0x082e('0x35')](function(_0xe66672){if(_0xe66672){_0x387add=_0xe66672;_0x2b2c76['model']=_['keys'](db[_0x082e('0x71')][_0x082e('0x58')]);_0x2b2c76['query']=_[_0x082e('0x43')](_0x994a82[_0x082e('0x42')]);_0x2b2c76[_0x082e('0x4e')]=_[_0x082e('0x44')](_0x2b2c76[_0x082e('0x41')],_0x2b2c76[_0x082e('0x42')]);_0x5e1bbe[_0x082e('0x45')]=_[_0x082e('0x44')](_0x2b2c76[_0x082e('0x41')],qs[_0x082e('0x46')](_0x994a82['query'][_0x082e('0x46')]));_0x5e1bbe[_0x082e('0x45')]=_0x5e1bbe[_0x082e('0x45')][_0x082e('0x47')]?_0x5e1bbe[_0x082e('0x45')]:_0x2b2c76['model'];_0x5e1bbe[_0x082e('0x4a')]=qs[_0x082e('0x4b')](_0x994a82[_0x082e('0x42')]['sort']);_0x5e1bbe['where']=qs[_0x082e('0x4e')](_[_0x082e('0x4d')](_0x994a82[_0x082e('0x42')],_0x2b2c76['filters']));if(_0x994a82[_0x082e('0x42')][_0x082e('0x51')]){_0x5e1bbe['where']=_[_0x082e('0x4f')](_0x5e1bbe['where'],{'$or':_[_0x082e('0x3d')](_0x5e1bbe[_0x082e('0x45')],function(_0x5321d0){var _0x5e37c5={};_0x5e37c5[_0x5321d0]={'$like':'%'+_0x994a82[_0x082e('0x42')][_0x082e('0x51')]+'%'};return _0x5e37c5;})});}_0x5e1bbe=_['merge']({},_0x5e1bbe,_0x994a82[_0x082e('0x52')]);return _0x387add[_0x082e('0xc3')](_0x5e1bbe);}})[_0x082e('0x35')](function(_0x4e044e){if(_0x4e044e){_0x44e7ec=_0x4e044e[_0x082e('0x47')];if(!_0x994a82[_0x082e('0x42')][_0x082e('0x48')](_0x082e('0x49'))){_0x5e1bbe['limit']=qs['limit'](_0x994a82['query'][_0x082e('0x2e')]);_0x5e1bbe[_0x082e('0x30')]=qs['offset'](_0x994a82[_0x082e('0x42')]['offset']);}return _0x387add[_0x082e('0xc3')](_0x5e1bbe);}})['then'](function(_0x48ea99){if(_0x48ea99){return _0x48ea99?{'count':_0x44e7ec,'rows':_0x48ea99}:null;}})[_0x082e('0x35')](respondWithResult(_0x34563f,null))['catch'](handleError(_0x34563f,null));};exports[_0x082e('0xc4')]=function(_0x451941,_0x5b2704,_0xca7841){var _0x4a32c8={'raw':![],'where':{}};var _0x10d307={};var _0x432a48={'count':0x0,'rows':[]};return db[_0x082e('0x53')][_0x082e('0x66')]({'where':{'id':_0x451941[_0x082e('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b2704,null))['then'](function(_0x216fc3){if(_0x216fc3){_0x10d307[_0x082e('0x41')]=_[_0x082e('0x43')](db[_0x082e('0xa0')][_0x082e('0x58')]);_0x10d307[_0x082e('0x42')]=_[_0x082e('0x43')](_0x451941[_0x082e('0x42')]);_0x10d307['filters']=_[_0x082e('0x44')](_0x10d307[_0x082e('0x41')],_0x10d307[_0x082e('0x42')]);_0x4a32c8['attributes']=_['intersection'](_0x10d307[_0x082e('0x41')],qs[_0x082e('0x46')](_0x451941[_0x082e('0x42')]['fields']));_0x4a32c8[_0x082e('0x45')]=_0x4a32c8['attributes'][_0x082e('0x47')]?_0x4a32c8[_0x082e('0x45')]:_0x10d307[_0x082e('0x41')];if(!_0x451941[_0x082e('0x42')][_0x082e('0x48')](_0x082e('0x49'))){_0x4a32c8[_0x082e('0x2e')]=qs[_0x082e('0x2e')](_0x451941[_0x082e('0x42')][_0x082e('0x2e')]);_0x4a32c8[_0x082e('0x30')]=qs['offset'](_0x451941[_0x082e('0x42')][_0x082e('0x30')]);}_0x4a32c8[_0x082e('0x4a')]=qs['sort'](_0x451941[_0x082e('0x42')]['sort']);_0x4a32c8[_0x082e('0x4c')]=qs[_0x082e('0x4e')](_[_0x082e('0x4d')](_0x451941[_0x082e('0x42')],_0x10d307['filters']));_0x4a32c8[_0x082e('0x4c')][_0x082e('0x63')]=_0x216fc3['id'];if(_0x451941[_0x082e('0x42')][_0x082e('0x51')]){_0x4a32c8[_0x082e('0x4c')]=_[_0x082e('0x4f')](_0x4a32c8[_0x082e('0x4c')],{'$or':_['map'](_0x4a32c8[_0x082e('0x45')],function(_0xb08b79){var _0xb16469={};_0xb16469[_0xb08b79]={'$like':'%'+_0x451941[_0x082e('0x42')][_0x082e('0x51')]+'%'};return _0xb16469;})});}_0x4a32c8=_[_0x082e('0x4f')]({},_0x4a32c8,_0x451941[_0x082e('0x52')]);return db[_0x082e('0xa0')]['count']({'where':_0x4a32c8[_0x082e('0x4c')]})['then'](function(_0x5f365e){_0x432a48[_0x082e('0x2f')]=_0x5f365e;if(_0x451941['query'][_0x082e('0x54')]){_0x4a32c8[_0x082e('0x67')]=[{'model':db[_0x082e('0x76')],'as':_0x082e('0xc5'),'required':![]},{'model':db[_0x082e('0xab')],'as':'Owner','attributes':[_0x082e('0x39'),_0x082e('0xc6'),_0x082e('0xc7')],'required':![]},{'model':db[_0x082e('0xc8')],'as':_0x082e('0xc9'),'attributes':['id',_0x082e('0x39'),'color'],'where':_0x451941[_0x082e('0x42')]['tag']?{'id':_0x451941[_0x082e('0x42')][_0x082e('0xca')]}:undefined,'required':_0x451941[_0x082e('0x42')][_0x082e('0xca')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4a32c8);})[_0x082e('0x35')](function(_0x5ca72e){_0x432a48[_0x082e('0x55')]=_0x5ca72e;return _0x432a48;});}})[_0x082e('0x35')](respondWithFilteredResult(_0x5b2704,_0x4a32c8))[_0x082e('0x28')](handleError(_0x5b2704,null));};exports[_0x082e('0xb7')]=function(_0x5283d5,_0x25edd1,_0x1e174c){var _0x13093f,_0x26f986,_0x4e4f57;if(_['isNil'](_0x5283d5[_0x082e('0x5b')][_0x082e('0x5b')])||_0x5283d5[_0x082e('0x5b')][_0x082e('0x5b')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x082e('0x93')](_0x5283d5['body']['to'])){throw new db[(_0x082e('0x77'))][(_0x082e('0x78'))](_0x082e('0xcb'));}_0x13093f=_0x5283d5[_0x082e('0x5b')]['to'];return db['SmsAccount'][_0x082e('0x59')]({'where':{'id':_0x5283d5[_0x082e('0x57')]['id']},'include':[{'model':db[_0x082e('0x9a')],'as':'List','include':[{'model':db[_0x082e('0x76')],'as':'Contacts','where':{'mobile':_0x13093f},'limit':0x1,'order':[[_0x082e('0x7a'),'DESC']]}]}]})[_0x082e('0x35')](handleEntityNotFound(_0x25edd1,null))[_0x082e('0x35')](function(_0x4f3238){if(_0x4f3238&&_0x4f3238[_0x082e('0xcc')]){_0x26f986=_0x4f3238[_0x082e('0x37')]({'plain':!![]});if(_0x26f986[_0x082e('0xcc')]&&_0x26f986['List'][_0x082e('0x9c')][_0x082e('0x47')]){return _0x26f986[_0x082e('0xcc')]['Contacts'][0x0];}return db[_0x082e('0x76')][_0x082e('0x5a')](_[_0x082e('0x9e')](_0x5283d5[_0x082e('0x5b')],{'firstName':_0x13093f,'mobile':_0x13093f,'phone':_0x13093f,'ListId':_0x26f986[_0x082e('0x9b')]}));}})[_0x082e('0x35')](handleEntityNotFound(_0x25edd1,null))[_0x082e('0x35')](function(_0x3dda79){if(_0x3dda79){_0x4e4f57=_0x3dda79;return db['SmsInteraction'][_0x082e('0x59')]({'where':{'ContactId':_0x4e4f57['id'],'closed':![],'SmsAccountId':_0x26f986['id']}})['then'](function(_0x1a21dd){if(_0x1a21dd){return[_0x1a21dd,![]];}return db[_0x082e('0xa0')]['create']({'UserId':_0x5283d5['user']['id'],'ContactId':_0x4e4f57['id'],'SmsAccountId':_0x26f986['id'],'phone':_0x13093f,'firstMsgDirection':_0x082e('0xcd'),'Messages':[_[_0x082e('0x4f')](_0x5283d5[_0x082e('0x5b')],{'read':![],'body':_0x5283d5[_0x082e('0x5b')]['body'],'phone':_0x13093f,'SmsAccountId':_0x26f986['id'],'UserId':_0x5283d5[_0x082e('0x5c')]['id'],'ContactId':_0x4e4f57['id']})]},{'include':[{'model':db[_0x082e('0xa8')],'as':_0x082e('0xce')}]})[_0x082e('0x35')](function(_0x49bb1d){return[_0x49bb1d,!![]];});});}})['spread'](function(_0x179635,_0x25a2e5){if(_0x25a2e5){return _0x179635;}return db[_0x082e('0xa8')]['create'](_[_0x082e('0x4f')](_0x5283d5['body'],{'read':![],'body':_0x5283d5[_0x082e('0x5b')][_0x082e('0x5b')],'phone':_0x13093f,'SmsAccountId':_0x26f986['id'],'SmsInteractionId':_0x179635['id'],'UserId':_0x5283d5[_0x082e('0x5c')]['id'],'ContactId':_0x4e4f57['id']}))[_0x082e('0x35')](function(_0xdefc2d){_0x179635[_0x082e('0xcf')][_0x082e('0xce')]=[];_0x179635['dataValues'][_0x082e('0xce')][_0x082e('0xa4')](_0xdefc2d[_0x082e('0xcf')]);return _0x179635;});})[_0x082e('0x35')](respondWithResult(_0x25edd1,null))[_0x082e('0x28')](handleError(_0x25edd1,null));};exports['status']=function(_0xeab5f3,_0x592d64,_0x58341f){if(_0xeab5f3[_0x082e('0x5b')]['id']){delete _0xeab5f3['body']['id'];}var _0x3fffc4,_0xfbc753,_0x1fd1b0;return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0xeab5f3[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x592d64,null))[_0x082e('0x35')](function(_0x264189){if(_0x264189){_0x1fd1b0=_0x264189;logger[_0x082e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x082e('0x2a'),_0x082e('0xd0'),_0x264189[_0x082e('0x3f')],util[_0x082e('0xd1')](_0xeab5f3['body'],{'showHidden':![],'depth':null}));switch(_0x264189[_0x082e('0x3f')]){case'skebby':if(_0xeab5f3['body']['skebby_dispatch_id']&&_0xeab5f3[_0x082e('0x5b')]['status']){_0xfbc753=_0xeab5f3[_0x082e('0x5b')][_0x082e('0x2a')];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0xeab5f3['body'][_0x082e('0xd2')]}});}break;case _0x082e('0x86'):if(_0xeab5f3['body'][_0x082e('0xd3')]&&_0xeab5f3[_0x082e('0x5b')][_0x082e('0xd4')]){_0xfbc753=_0xeab5f3[_0x082e('0x5b')][_0x082e('0xd4')];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0xeab5f3['body'][_0x082e('0xd3')]}});}break;case'clicksend':if(_0xeab5f3[_0x082e('0x5b')]['message_id']&&_0xeab5f3[_0x082e('0x5b')][_0x082e('0xd5')]){_0xfbc753=_0xeab5f3['body'][_0x082e('0xd5')];return db[_0x082e('0xa8')]['find']({'where':{'messageId':_0xeab5f3[_0x082e('0x5b')]['message_id']}});}break;case'infobip':var _0x41f466=_0xeab5f3['body']['results'][0x0];if(_0x41f466['messageId']&&_0x41f466[_0x082e('0x2a')][_0x082e('0xd6')]===_0x082e('0xd7')){_0xfbc753=_0x41f466[_0x082e('0x2a')]['groupName'];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0x41f466[_0x082e('0x8a')]}});}break;case'clickatell':if(_0xeab5f3['body'][_0x082e('0x8a')]&&_0xeab5f3[_0x082e('0x5b')][_0x082e('0x2a')]){_0xfbc753=_0xeab5f3[_0x082e('0x5b')][_0x082e('0x2a')];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0xeab5f3['body'][_0x082e('0x8a')]}});}break;case _0x082e('0x90'):if(_0xeab5f3['body'][0x0][_0x082e('0x27')]['id']){_0xfbc753=_0xeab5f3[_0x082e('0x5b')][0x0]['type'];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0xeab5f3['body'][0x0]['message']['id']}});}break;case'intelepeer':if(_0xeab5f3[_0x082e('0x5b')]['redif']&&_0xeab5f3[_0x082e('0x5b')][_0x082e('0x2a')]){_0xfbc753=_0xeab5f3[_0x082e('0x5b')][_0x082e('0x2a')];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0xeab5f3['body'][_0x082e('0xd8')]}});}break;}}})[_0x082e('0x35')](handleEntityNotFound(_0x592d64,null))[_0x082e('0x35')](function(_0x1d1ca0){if(_0x1d1ca0){_0x3fffc4=_0x1d1ca0;switch(_0x1fd1b0[_0x082e('0x3f')]){case _0x082e('0xd9'):if(_0xfbc753===_0x082e('0xd7')){return _0x3fffc4['update']({'read':!![]});}else{logger[_0x082e('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x082e('0x2a'),_0x082e('0xd9'),util[_0x082e('0xd1')](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xfbc753==='1'){return _0x3fffc4['update']({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),_0x082e('0x2a'),'skebby',util['inspect'](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xeab5f3[_0x082e('0x5b')][_0x082e('0xda')]&&_0xfbc753>=0xc8&&_0xfbc753<=0xce){return _0x3fffc4[_0x082e('0x34')]({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),'status','clicksend',util[_0x082e('0xd1')](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3b4161=_0xeab5f3[_0x082e('0x5b')][_0x082e('0x8d')][0x0];if(_0x3b4161[_0x082e('0x2a')]['groupName']===_0x082e('0xd7')){return _0x3fffc4[_0x082e('0x34')]({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),_0x082e('0x2a'),_0x082e('0x8c'),util[_0x082e('0xd1')](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x082e('0x8f'):if(_0xfbc753=='DELIVERED_TO_GATEWAY'||_0xfbc753=='RECEIVED_BY_RECIPIENT'){return _0x3fffc4[_0x082e('0x34')]({'read':!![]});}else{logger['error'](_0x082e('0x23'),_0x082e('0x2a'),'clickatell',util[_0x082e('0xd1')](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x082e('0x90'):if(_0xfbc753==_0x082e('0xdb')){return _0x3fffc4[_0x082e('0x34')]({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),_0x082e('0x2a'),_0x082e('0x90'),util[_0x082e('0xd1')](_0xeab5f3['body'],{'showHidden':![],'depth':null}));}break;case _0x082e('0x91'):if(_0xfbc753===_0x082e('0xdc')||_0xfbc753==='ACCEPTD'){return _0x3fffc4[_0x082e('0x34')]({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),'status','intelepeer',util[_0x082e('0xd1')](_0xeab5f3[_0x082e('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3fffc4;}})[_0x082e('0x35')](respondWithResult(_0x592d64,null))[_0x082e('0x28')](handleError(_0x592d64,null));};exports['statusGet']=function(_0x3d733a,_0x5cfdc1,_0xbbbd9d){var _0x3833c8,_0x121c4c,_0x7deb13;return db[_0x082e('0x53')][_0x082e('0x59')]({'where':{'id':_0x3d733a[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x5cfdc1,null))[_0x082e('0x35')](function(_0x354024){if(_0x354024){_0x7deb13=_0x354024;logger['debug'](_0x082e('0x23'),_0x082e('0x2a'),_0x082e('0xd0'),_0x354024['type'],util[_0x082e('0xd1')](_0x3d733a[_0x082e('0x42')],{'showHidden':![],'depth':null}));switch(_0x354024['type']){case _0x082e('0x8e'):if(_0x3d733a['query']['message-id']&&_0x3d733a[_0x082e('0x42')][_0x082e('0xdd')]){_0x121c4c=_0x3d733a['query'][_0x082e('0xdd')];return db[_0x082e('0xa8')][_0x082e('0x59')]({'where':{'messageId':_0x3d733a['query'][_0x082e('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x5cfdc1,null))[_0x082e('0x35')](function(_0x1e7648){if(_0x1e7648){_0x3833c8=_0x1e7648;switch(_0x7deb13[_0x082e('0x3f')]){case _0x082e('0x8e'):if(_0x121c4c==='2'||_0x121c4c==='6'){return _0x3833c8['update']({'read':!![]});}else{logger[_0x082e('0x26')](_0x082e('0x23'),_0x082e('0x2a'),_0x082e('0x8e'),util[_0x082e('0xd1')](_0x3d733a['query'],{'showHidden':![],'depth':null}));};break;}return _0x3833c8;}})[_0x082e('0x35')](respondWithResult(_0x5cfdc1,null))[_0x082e('0x28')](handleError(_0x5cfdc1,null));};exports[_0x082e('0xdf')]=function(_0x34720b,_0x170507,_0x5a2166){return db['SmsAccount'][_0x082e('0x59')]({'where':{'id':_0x34720b[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x170507,null))['then'](function(_0x55d64c){if(_0x55d64c){return _0x55d64c[_0x082e('0xdf')](_0x34720b[_0x082e('0x5b')][_0x082e('0x6a')],_['omit'](_0x34720b[_0x082e('0x5b')],[_0x082e('0x6a'),'id'])||{})[_0x082e('0xa1')](function(_0x556b9d){for(var _0x4a3eef=0x0;_0x4a3eef<_0x34720b[_0x082e('0x5b')][_0x082e('0x6a')][_0x082e('0x47')];_0x4a3eef+=0x1){socket[_0x082e('0xe0')](_0x082e('0xe1'),{'UserId':Number(_0x34720b[_0x082e('0x5b')][_0x082e('0x6a')][_0x4a3eef]),'SmsAccountId':Number(_0x34720b[_0x082e('0x57')]['id'])});}return _0x556b9d;});}})[_0x082e('0x35')](respondWithResult(_0x170507,null))['catch'](handleError(_0x170507,null));};exports[_0x082e('0xe2')]=function(_0x36a31a,_0x5199a2,_0x42429a){return db['SmsAccount'][_0x082e('0x59')]({'where':{'id':_0x36a31a[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x5199a2,null))[_0x082e('0x35')](function(_0x246111){if(_0x246111){return _0x246111[_0x082e('0xe2')](_0x36a31a[_0x082e('0x42')][_0x082e('0x6a')])[_0x082e('0x35')](function(){if(_[_0x082e('0xe3')](_0x36a31a[_0x082e('0x42')][_0x082e('0x6a')])){for(var _0x4c1c98=0x0;_0x4c1c98<_0x36a31a['query']['ids']['length'];_0x4c1c98+=0x1){socket[_0x082e('0xe0')](_0x082e('0xe4'),{'UserId':Number(_0x36a31a[_0x082e('0x42')][_0x082e('0x6a')][_0x4c1c98]),'SmsAccountId':Number(_0x36a31a[_0x082e('0x57')]['id'])});}}else{socket[_0x082e('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x36a31a[_0x082e('0x42')][_0x082e('0x6a')]),'SmsAccountId':Number(_0x36a31a[_0x082e('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5199a2,null))[_0x082e('0x28')](handleError(_0x5199a2,null));};exports['getAgents']=function(_0x128437,_0x13881d,_0x4d2257){var _0x57fa6b={};var _0x8891dc={};var _0x30cb78;var _0x3b995a;return db[_0x082e('0x53')][_0x082e('0x66')]({'where':{'id':_0x128437[_0x082e('0x57')]['id']}})[_0x082e('0x35')](handleEntityNotFound(_0x13881d,null))['then'](function(_0x117600){if(_0x117600){_0x30cb78=_0x117600;_0x8891dc[_0x082e('0x41')]=_[_0x082e('0x43')](db[_0x082e('0xab')][_0x082e('0x58')]);_0x8891dc['query']=_[_0x082e('0x43')](_0x128437[_0x082e('0x42')]);_0x8891dc[_0x082e('0x4e')]=_[_0x082e('0x44')](_0x8891dc[_0x082e('0x41')],_0x8891dc[_0x082e('0x42')]);_0x57fa6b['attributes']=_['intersection'](_0x8891dc[_0x082e('0x41')],qs['fields'](_0x128437[_0x082e('0x42')][_0x082e('0x46')]));_0x57fa6b[_0x082e('0x45')]=_0x57fa6b['attributes'][_0x082e('0x47')]?_0x57fa6b[_0x082e('0x45')]:_0x8891dc[_0x082e('0x41')];_0x57fa6b[_0x082e('0x4a')]=qs['sort'](_0x128437[_0x082e('0x42')]['sort']);_0x57fa6b['where']=qs[_0x082e('0x4e')](_['pick'](_0x128437[_0x082e('0x42')],_0x8891dc['filters']));if(_0x128437[_0x082e('0x42')]['filter']){_0x57fa6b[_0x082e('0x4c')]=_['merge'](_0x57fa6b[_0x082e('0x4c')],{'$or':_[_0x082e('0x3d')](_0x57fa6b[_0x082e('0x45')],function(_0x1f715c){var _0x2678b5={};_0x2678b5[_0x1f715c]={'$like':'%'+_0x128437[_0x082e('0x42')][_0x082e('0x51')]+'%'};return _0x2678b5;})});}_0x57fa6b=_[_0x082e('0x4f')]({},_0x57fa6b,_0x128437['options']);return _0x30cb78[_0x082e('0xe5')](_0x57fa6b);}})[_0x082e('0x35')](function(_0x10b7cd){if(_0x10b7cd){_0x3b995a=_0x10b7cd[_0x082e('0x47')];if(!_0x128437[_0x082e('0x42')][_0x082e('0x48')](_0x082e('0x49'))){_0x57fa6b[_0x082e('0x2e')]=qs[_0x082e('0x2e')](_0x128437[_0x082e('0x42')][_0x082e('0x2e')]);_0x57fa6b[_0x082e('0x30')]=qs[_0x082e('0x30')](_0x128437[_0x082e('0x42')][_0x082e('0x30')]);}return _0x30cb78[_0x082e('0xe5')](_0x57fa6b);}})['then'](function(_0x318784){if(_0x318784){return _0x318784?{'count':_0x3b995a,'rows':_0x318784}:null;}})['then'](respondWithResult(_0x13881d,null))[_0x082e('0x28')](handleError(_0x13881d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 392189f..438b535 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 _0xed24=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x1266a7,_0x70b96f){var _0x4fe162=function(_0x11a093){while(--_0x11a093){_0x1266a7['push'](_0x1266a7['shift']());}};_0x4fe162(++_0x70b96f);}(_0xed24,0xe0));var _0x4ed2=function(_0x15a89a,_0xa19b4b){_0x15a89a=_0x15a89a-0x0;var _0x17766e=_0xed24[_0x15a89a];return _0x17766e;};'use strict';var EventEmitter=require(_0x4ed2('0x0'));var SmsAccount=require(_0x4ed2('0x1'))['db'][_0x4ed2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4ed2('0x3')](0x0);var events={'afterCreate':_0x4ed2('0x4'),'afterUpdate':_0x4ed2('0x5'),'afterDestroy':_0x4ed2('0x6')};function emitEvent(_0x5e0922){return function(_0x1f3232,_0x188271,_0x54f415){SmsAccountEvents[_0x4ed2('0x7')](_0x5e0922+':'+_0x1f3232['id'],_0x1f3232);SmsAccountEvents[_0x4ed2('0x7')](_0x5e0922,_0x1f3232);_0x54f415(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4ed2('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x8c18=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x8c18,0x1ec));var _0x88c1=function(_0x3c7150,_0xd4d49c){_0x3c7150=_0x3c7150-0x0;var _0x162a37=_0x8c18[_0x3c7150];return _0x162a37;};'use strict';var EventEmitter=require(_0x88c1('0x0'));var SmsAccount=require(_0x88c1('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x88c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x88c1('0x3'),'afterDestroy':_0x88c1('0x4')};function emitEvent(_0x2684c4){return function(_0x262d68,_0x4306f5,_0x75f277){SmsAccountEvents[_0x88c1('0x5')](_0x2684c4+':'+_0x262d68['id'],_0x262d68);SmsAccountEvents[_0x88c1('0x5')](_0x2684c4,_0x262d68);_0x75f277(null);};}for(var e in events){if(events[_0x88c1('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x88c1('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6e6629e..e5d373c 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 _0x0771=['moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x1b2971,_0x320699){var _0x41fc8a=function(_0x4c3ce1){while(--_0x4c3ce1){_0x1b2971['push'](_0x1b2971['shift']());}};_0x41fc8a(++_0x320699);}(_0x0771,0x1b6));var _0x1077=function(_0x233811,_0x1283e9){_0x233811=_0x233811-0x0;var _0x292f41=_0x0771[_0x233811];return _0x292f41;};'use strict';var _=require(_0x1077('0x0'));var util=require(_0x1077('0x1'));var logger=require(_0x1077('0x2'))(_0x1077('0x3'));var moment=require(_0x1077('0x4'));var BPromise=require('bluebird');var rp=require(_0x1077('0x5'));var fs=require('fs');var path=require(_0x1077('0x6'));var rimraf=require(_0x1077('0x7'));var config=require(_0x1077('0x8'));var attributes=require(_0x1077('0x9'));module[_0x1077('0xa')]=function(_0x367d59,_0x525cb9){return _0x367d59[_0x1077('0xb')]('SmsAccount',attributes,{'tableName':_0x1077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bd6=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','sms_accounts'];(function(_0xfbaf9f,_0x41cc44){var _0x245e25=function(_0x3ca01d){while(--_0x3ca01d){_0xfbaf9f['push'](_0xfbaf9f['shift']());}};_0x245e25(++_0x41cc44);}(_0x0bd6,0x160));var _0x60bd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0bd6[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x60bd('0x0'));var util=require(_0x60bd('0x1'));var logger=require(_0x60bd('0x2'))(_0x60bd('0x3'));var moment=require('moment');var BPromise=require(_0x60bd('0x4'));var rp=require(_0x60bd('0x5'));var fs=require('fs');var path=require(_0x60bd('0x6'));var rimraf=require('rimraf');var config=require(_0x60bd('0x7'));var attributes=require(_0x60bd('0x8'));module['exports']=function(_0x11837d,_0x4bf62a){return _0x11837d[_0x60bd('0x9')]('SmsAccount',attributes,{'tableName':_0x60bd('0xa'),'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 56bcfd0..1552557 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 _0x0896=['../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0896,0x172));var _0x6089=function(_0x23f6bb,_0x20edd8){_0x23f6bb=_0x23f6bb-0x0;var _0x2c57d1=_0x0896[_0x23f6bb];return _0x2c57d1;};'use strict';var _=require(_0x6089('0x0'));var util=require(_0x6089('0x1'));var moment=require(_0x6089('0x2'));var BPromise=require(_0x6089('0x3'));var rs=require(_0x6089('0x4'));var fs=require('fs');var Redis=require(_0x6089('0x5'));var db=require(_0x6089('0x6'))['db'];var utils=require(_0x6089('0x7'));var logger=require(_0x6089('0x8'))(_0x6089('0x9'));var config=require(_0x6089('0xa'));var jayson=require(_0x6089('0xb'));var client=jayson['client'][_0x6089('0xc')]({'port':0x232a});config['redis']=_[_0x6089('0xd')](config['redis'],{'host':_0x6089('0xe'),'port':0x18eb});var socket=require(_0x6089('0xf'))(new Redis(config[_0x6089('0x10')]));require('./smsAccount.socket')[_0x6089('0x11')](socket);function respondWithRpcPromise(_0x57c2ef,_0x26c995,_0x1cb9fb){return new BPromise(function(_0x42c211,_0x1c5a11){return client[_0x6089('0x12')](_0x57c2ef,_0x1cb9fb)[_0x6089('0x13')](function(_0x5947e2){logger[_0x6089('0x14')](_0x6089('0x15'),_0x26c995,_0x6089('0x16'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x26c995,_0x6089('0x16'),JSON[_0x6089('0x17')](_0x5947e2));if(_0x5947e2[_0x6089('0x18')]){if(_0x5947e2[_0x6089('0x18')][_0x6089('0x19')]===0x1f4){logger[_0x6089('0x18')](_0x6089('0x15'),_0x26c995,_0x5947e2[_0x6089('0x18')][_0x6089('0x1a')]);return _0x1c5a11(_0x5947e2[_0x6089('0x18')]['message']);}logger[_0x6089('0x18')](_0x6089('0x15'),_0x26c995,_0x5947e2['error'][_0x6089('0x1a')]);return _0x42c211(_0x5947e2[_0x6089('0x18')][_0x6089('0x1a')]);}else{logger['info'](_0x6089('0x15'),_0x26c995,'request\x20sent');_0x42c211(_0x5947e2['result']['message']);}})['catch'](function(_0x215651){logger[_0x6089('0x18')]('SmsAccount,\x20%s,\x20%s',_0x26c995,_0x215651);_0x1c5a11(_0x215651);});});}exports[_0x6089('0x1b')]=function(_0x3765b5){var _0x36d5b1=this;return new Promise(function(_0x31b7cf,_0x23ae0b){return db[_0x6089('0x1c')][_0x6089('0x1d')]({'raw':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x1f')]===undefined?!![]:![]:!![],'where':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x20')]||null:null,'attributes':_0x3765b5['options']?_0x3765b5[_0x6089('0x1e')][_0x6089('0x21')]||null:null,'include':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x22')]?_[_0x6089('0x23')](_0x3765b5[_0x6089('0x1e')]['include'],function(_0x490ede){return{'model':db[_0x490ede['model']],'as':_0x490ede['as'],'attributes':_0x490ede[_0x6089('0x21')],'include':_0x490ede[_0x6089('0x22')]?_[_0x6089('0x23')](_0x490ede[_0x6089('0x22')],function(_0x27bbb7){return{'model':db[_0x27bbb7[_0x6089('0x24')]],'as':_0x27bbb7['as'],'attributes':_0x27bbb7[_0x6089('0x21')],'include':_0x27bbb7['include']?_['map'](_0x27bbb7[_0x6089('0x22')],function(_0x31829c){return{'model':db[_0x31829c[_0x6089('0x24')]],'as':_0x31829c['as'],'attributes':_0x31829c[_0x6089('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56f324){logger[_0x6089('0x14')](_0x6089('0x1b'),_0x3765b5);logger[_0x6089('0x25')](_0x6089('0x1b'),_0x3765b5,JSON[_0x6089('0x17')](_0x56f324));_0x31b7cf(_0x56f324);})['catch'](function(_0x5dcdcc){logger['error'](_0x6089('0x1b'),_0x5dcdcc[_0x6089('0x1a')],_0x3765b5);_0x23ae0b(_0x36d5b1[_0x6089('0x18')](0x1f4,_0x5dcdcc[_0x6089('0x1a')]));});});}; \ No newline at end of file +var _0x7007=['localhost','./smsAccount.socket','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x199717,_0x5e535e){var _0x40ebfd=function(_0x2236e4){while(--_0x2236e4){_0x199717['push'](_0x199717['shift']());}};_0x40ebfd(++_0x5e535e);}(_0x7007,0x130));var _0x7700=function(_0x5e83f0,_0x5b9d8c){_0x5e83f0=_0x5e83f0-0x0;var _0x95fa71=_0x7007[_0x5e83f0];return _0x95fa71;};'use strict';var _=require(_0x7700('0x0'));var util=require(_0x7700('0x1'));var moment=require(_0x7700('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7700('0x3'));var logger=require('../../config/logger')(_0x7700('0x4'));var config=require(_0x7700('0x5'));var jayson=require(_0x7700('0x6'));var client=jayson[_0x7700('0x7')][_0x7700('0x8')]({'port':0x232a});config[_0x7700('0x9')]=_[_0x7700('0xa')](config[_0x7700('0x9')],{'host':_0x7700('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7700('0x9')]));require(_0x7700('0xc'))[_0x7700('0xd')](socket);function respondWithRpcPromise(_0x1f4fae,_0x50b345,_0x2b393a){return new BPromise(function(_0x161535,_0x16ca27){return client['request'](_0x1f4fae,_0x2b393a)[_0x7700('0xe')](function(_0x395e16){logger['info']('SmsAccount,\x20%s,\x20%s',_0x50b345,_0x7700('0xf'));logger[_0x7700('0x10')](_0x7700('0x11'),_0x50b345,_0x7700('0xf'),JSON[_0x7700('0x12')](_0x395e16));if(_0x395e16[_0x7700('0x13')]){if(_0x395e16[_0x7700('0x13')]['code']===0x1f4){logger[_0x7700('0x13')](_0x7700('0x14'),_0x50b345,_0x395e16[_0x7700('0x13')][_0x7700('0x15')]);return _0x16ca27(_0x395e16[_0x7700('0x13')][_0x7700('0x15')]);}logger[_0x7700('0x13')](_0x7700('0x14'),_0x50b345,_0x395e16['error'][_0x7700('0x15')]);return _0x161535(_0x395e16[_0x7700('0x13')][_0x7700('0x15')]);}else{logger[_0x7700('0x16')](_0x7700('0x14'),_0x50b345,_0x7700('0xf'));_0x161535(_0x395e16[_0x7700('0x17')][_0x7700('0x15')]);}})[_0x7700('0x18')](function(_0x55cd0a){logger[_0x7700('0x13')](_0x7700('0x14'),_0x50b345,_0x55cd0a);_0x16ca27(_0x55cd0a);});});}exports[_0x7700('0x19')]=function(_0x18f18a){var _0x995589=this;return new Promise(function(_0x313f28,_0x36e3e7){return db[_0x7700('0x1a')][_0x7700('0x1b')]({'raw':_0x18f18a[_0x7700('0x1c')]?_0x18f18a[_0x7700('0x1c')][_0x7700('0x1d')]===undefined?!![]:![]:!![],'where':_0x18f18a[_0x7700('0x1c')]?_0x18f18a[_0x7700('0x1c')][_0x7700('0x1e')]||null:null,'attributes':_0x18f18a[_0x7700('0x1c')]?_0x18f18a[_0x7700('0x1c')][_0x7700('0x1f')]||null:null,'include':_0x18f18a['options']?_0x18f18a[_0x7700('0x1c')][_0x7700('0x20')]?_['map'](_0x18f18a[_0x7700('0x1c')][_0x7700('0x20')],function(_0x4f9d25){return{'model':db[_0x4f9d25[_0x7700('0x21')]],'as':_0x4f9d25['as'],'attributes':_0x4f9d25['attributes'],'include':_0x4f9d25[_0x7700('0x20')]?_['map'](_0x4f9d25[_0x7700('0x20')],function(_0x1051f8){return{'model':db[_0x1051f8[_0x7700('0x21')]],'as':_0x1051f8['as'],'attributes':_0x1051f8[_0x7700('0x1f')],'include':_0x1051f8[_0x7700('0x20')]?_[_0x7700('0x22')](_0x1051f8[_0x7700('0x20')],function(_0x4c4f8d){return{'model':db[_0x4c4f8d['model']],'as':_0x4c4f8d['as'],'attributes':_0x4c4f8d[_0x7700('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7700('0xe')](function(_0x4c1a52){logger[_0x7700('0x16')]('ShowSmsAccount',_0x18f18a);logger['debug'](_0x7700('0x19'),_0x18f18a,JSON[_0x7700('0x12')](_0x4c1a52));_0x313f28(_0x4c1a52);})['catch'](function(_0x2c49e3){logger[_0x7700('0x13')](_0x7700('0x19'),_0x2c49e3[_0x7700('0x15')],_0x18f18a);_0x36e3e7(_0x995589[_0x7700('0x13')](0x1f4,_0x2c49e3[_0x7700('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 85a91d1..bed2fc2 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 551a404..34c4fc6 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xdcbb99,_0x5af4ca){var _0x55ca74=function(_0x2662a3){while(--_0x2662a3){_0xdcbb99['push'](_0xdcbb99['shift']());}};_0x55ca74(++_0x5af4ca);}(_0x34e8,0x12c));var _0x834e=function(_0x420a60,_0x27ff8e){_0x420a60=_0x420a60-0x0;var _0x564bd1=_0x34e8[_0x420a60];return _0x564bd1;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x202569,_0x196b9b){var _0x5a5599=function(_0x1eb549){while(--_0x1eb549){_0x202569['push'](_0x202569['shift']());}};_0x5a5599(++_0x196b9b);}(_0xe14b,0x93));var _0xbe14=function(_0x10aaf1,_0x4c6e36){_0x10aaf1=_0x10aaf1-0x0;var _0x2e8261=_0xe14b[_0x10aaf1];return _0x2e8261;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 2c8e00b..bb3a7a5 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 _0xe857=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0xaac148,_0x460bf9){var _0x2315a2=function(_0x3a466f){while(--_0x3a466f){_0xaac148['push'](_0xaac148['shift']());}};_0x2315a2(++_0x460bf9);}(_0xe857,0x79));var _0x7e85=function(_0x1e40cb,_0x114707){_0x1e40cb=_0x1e40cb-0x0;var _0x2fb0ba=_0xe857[_0x1e40cb];return _0x2fb0ba;};'use strict';var Sequelize=require(_0x7e85('0x0'));module[_0x7e85('0x1')]={'priority':{'type':Sequelize[_0x7e85('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e85('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7e85('0x4')]()},'description':{'type':Sequelize[_0x7e85('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa60f=['INTEGER','noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x15a9cb,_0x2c5d45){var _0x4036e4=function(_0x4a97cf){while(--_0x4a97cf){_0x15a9cb['push'](_0x15a9cb['shift']());}};_0x4036e4(++_0x2c5d45);}(_0xa60f,0x18b));var _0xfa60=function(_0x3e462b,_0x40de00){_0x3e462b=_0x3e462b-0x0;var _0x39a3f5=_0xa60f[_0x3e462b];return _0x39a3f5;};'use strict';var Sequelize=require('sequelize');module[_0xfa60('0x0')]={'priority':{'type':Sequelize[_0xfa60('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa60('0x2')},'appdata':{'type':Sequelize[_0xfa60('0x3')]()},'description':{'type':Sequelize[_0xfa60('0x4')]},'interval':{'type':Sequelize[_0xfa60('0x4')],'defaultValue':_0xfa60('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0ea5666..60aff39 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 _0xe6b1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x3a64f1,_0x4ed202){var _0xb794e0=function(_0x228352){while(--_0x228352){_0x3a64f1['push'](_0x3a64f1['shift']());}};_0xb794e0(++_0x4ed202);}(_0xe6b1,0x88));var _0x1e6b=function(_0x378e57,_0x5a6b98){_0x378e57=_0x378e57-0x0;var _0x337857=_0xe6b1[_0x378e57];return _0x337857;};'use strict';var emlformat=require(_0x1e6b('0x0'));var rimraf=require(_0x1e6b('0x1'));var zipdir=require(_0x1e6b('0x2'));var jsonpatch=require(_0x1e6b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e6b('0x4'));var Mustache=require(_0x1e6b('0x5'));var util=require(_0x1e6b('0x6'));var path=require(_0x1e6b('0x7'));var sox=require(_0x1e6b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e6b('0x9'));var squel=require(_0x1e6b('0xa'));var crypto=require(_0x1e6b('0xb'));var jsforce=require(_0x1e6b('0xc'));var deskjs=require(_0x1e6b('0xd'));var toCsv=require(_0x1e6b('0xe'));var querystring=require('querystring');var Papa=require(_0x1e6b('0xf'));var Redis=require(_0x1e6b('0x10'));var authService=require(_0x1e6b('0x11'));var qs=require(_0x1e6b('0x12'));var as=require(_0x1e6b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e6b('0x14'));var utils=require(_0x1e6b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e6b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108713,_0x4a0a99){_0x4a0a99=_0x4a0a99||0xcc;return function(_0x31cda1){if(_0x31cda1){return _0x108713['sendStatus'](_0x4a0a99);}return _0x108713['status'](_0x4a0a99)[_0x1e6b('0x17')]();};}function respondWithResult(_0x594a83,_0x91199d){_0x91199d=_0x91199d||0xc8;return function(_0x175aa0){if(_0x175aa0){return _0x594a83[_0x1e6b('0x18')](_0x91199d)['json'](_0x175aa0);}};}function respondWithFilteredResult(_0xe07884,_0x189964){return function(_0xe5db34){if(_0xe5db34){var _0x59f319=typeof _0x189964[_0x1e6b('0x19')]===_0x1e6b('0x1a')&&typeof _0x189964[_0x1e6b('0x1b')]===_0x1e6b('0x1a');var _0x366140=_0xe5db34[_0x1e6b('0x1c')];var _0x25828b=_0x59f319?0x0:_0x189964['offset'];var _0x4fbe00=_0x59f319?_0xe5db34[_0x1e6b('0x1c')]:_0x189964[_0x1e6b('0x19')]+_0x189964[_0x1e6b('0x1b')];var _0x3e6565;if(_0x4fbe00>=_0x366140){_0x4fbe00=_0x366140;_0x3e6565=0xc8;}else{_0x3e6565=0xce;}_0xe07884[_0x1e6b('0x18')](_0x3e6565);return _0xe07884[_0x1e6b('0x1d')](_0x1e6b('0x1e'),_0x25828b+'-'+_0x4fbe00+'/'+_0x366140)[_0x1e6b('0x1f')](_0xe5db34);}return null;};}function patchUpdates(_0x3f252a){return function(_0x424066){try{jsonpatch[_0x1e6b('0x20')](_0x424066,_0x3f252a,!![]);}catch(_0x66b55e){return BPromise[_0x1e6b('0x21')](_0x66b55e);}return _0x424066[_0x1e6b('0x22')]();};}function saveUpdates(_0x496eab,_0x2dc430){return function(_0x1466df){if(_0x1466df){return _0x1466df['update'](_0x496eab)[_0x1e6b('0x23')](function(_0x5691cf){return _0x5691cf;});}return null;};}function removeEntity(_0x4521f5,_0x35f043){return function(_0x30a51a){if(_0x30a51a){return _0x30a51a['destroy']()[_0x1e6b('0x23')](function(){_0x4521f5[_0x1e6b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe23fce,_0x2821df){return function(_0x4d74f7){if(!_0x4d74f7){_0xe23fce[_0x1e6b('0x24')](0x194);}return _0x4d74f7;};}function handleError(_0xb8e992,_0x465c7f){_0x465c7f=_0x465c7f||0x1f4;return function(_0x23b8b5){logger[_0x1e6b('0x25')](_0x23b8b5[_0x1e6b('0x26')]);if(_0x23b8b5[_0x1e6b('0x27')]){delete _0x23b8b5[_0x1e6b('0x27')];}_0xb8e992[_0x1e6b('0x18')](_0x465c7f)[_0x1e6b('0x28')](_0x23b8b5);};}exports['index']=function(_0x19adf7,_0x25370b){var _0xf3ab01={},_0x54c7f5={},_0x1e1714={'count':0x0,'rows':[]};var _0x488827=_[_0x1e6b('0x29')](db[_0x1e6b('0x2a')][_0x1e6b('0x2b')],function(_0x17a16c){return{'name':_0x17a16c[_0x1e6b('0x2c')],'type':_0x17a16c['type'][_0x1e6b('0x2d')]};});_0x54c7f5[_0x1e6b('0x2e')]=_[_0x1e6b('0x29')](_0x488827,'name');_0x54c7f5[_0x1e6b('0x2f')]=_[_0x1e6b('0x30')](_0x19adf7[_0x1e6b('0x2f')]);_0x54c7f5[_0x1e6b('0x31')]=_[_0x1e6b('0x32')](_0x54c7f5[_0x1e6b('0x2e')],_0x54c7f5[_0x1e6b('0x2f')]);_0xf3ab01['attributes']=_[_0x1e6b('0x32')](_0x54c7f5[_0x1e6b('0x2e')],qs[_0x1e6b('0x33')](_0x19adf7['query'][_0x1e6b('0x33')]));_0xf3ab01[_0x1e6b('0x34')]=_0xf3ab01[_0x1e6b('0x34')]['length']?_0xf3ab01['attributes']:_0x54c7f5[_0x1e6b('0x2e')];if(!_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x35')](_0x1e6b('0x36'))){_0xf3ab01['limit']=qs[_0x1e6b('0x1b')](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x1b')]);_0xf3ab01[_0x1e6b('0x19')]=qs['offset'](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x19')]);}_0xf3ab01['order']=qs[_0x1e6b('0x37')](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x37')]);_0xf3ab01['where']=qs[_0x1e6b('0x31')](_[_0x1e6b('0x38')](_0x19adf7[_0x1e6b('0x2f')],_0x54c7f5[_0x1e6b('0x31')]),_0x488827);if(_0x19adf7['query'][_0x1e6b('0x39')]){_0xf3ab01[_0x1e6b('0x3a')]=_['merge'](_0xf3ab01[_0x1e6b('0x3a')],{'$or':_[_0x1e6b('0x29')](_0x488827,function(_0x49c36a){if(_0x49c36a[_0x1e6b('0x3b')]!==_0x1e6b('0x3c')){var _0x2fdbb6={};_0x2fdbb6[_0x49c36a[_0x1e6b('0x27')]]={'$like':'%'+_0x19adf7['query']['filter']+'%'};return _0x2fdbb6;}})});}_0xf3ab01=_[_0x1e6b('0x3d')]({},_0xf3ab01,_0x19adf7[_0x1e6b('0x3e')]);var _0x2502c9={'where':_0xf3ab01[_0x1e6b('0x3a')]};return db[_0x1e6b('0x2a')][_0x1e6b('0x1c')](_0x2502c9)[_0x1e6b('0x23')](function(_0xc1fc96){_0x1e1714['count']=_0xc1fc96;if(_0x19adf7['query'][_0x1e6b('0x3f')]){_0xf3ab01[_0x1e6b('0x40')]=[{'all':!![]}];}return db[_0x1e6b('0x2a')][_0x1e6b('0x41')](_0xf3ab01);})[_0x1e6b('0x23')](function(_0x179449){_0x1e1714[_0x1e6b('0x42')]=_0x179449;return _0x1e1714;})[_0x1e6b('0x23')](respondWithFilteredResult(_0x25370b,_0xf3ab01))[_0x1e6b('0x43')](handleError(_0x25370b,null));};exports[_0x1e6b('0x44')]=function(_0x3c835a,_0x596188){var _0x46b3d4={'raw':!![],'where':{'id':_0x3c835a[_0x1e6b('0x45')]['id']}},_0x3c8a6c={};_0x3c8a6c['model']=_['keys'](db[_0x1e6b('0x2a')][_0x1e6b('0x2b')]);_0x3c8a6c[_0x1e6b('0x2f')]=_[_0x1e6b('0x30')](_0x3c835a['query']);_0x3c8a6c[_0x1e6b('0x31')]=_[_0x1e6b('0x32')](_0x3c8a6c['model'],_0x3c8a6c[_0x1e6b('0x2f')]);_0x46b3d4[_0x1e6b('0x34')]=_['intersection'](_0x3c8a6c[_0x1e6b('0x2e')],qs[_0x1e6b('0x33')](_0x3c835a[_0x1e6b('0x2f')][_0x1e6b('0x33')]));_0x46b3d4[_0x1e6b('0x34')]=_0x46b3d4['attributes'][_0x1e6b('0x46')]?_0x46b3d4[_0x1e6b('0x34')]:_0x3c8a6c[_0x1e6b('0x2e')];if(_0x3c835a[_0x1e6b('0x2f')][_0x1e6b('0x3f')]){_0x46b3d4[_0x1e6b('0x40')]=[{'all':!![]}];}_0x46b3d4=_['merge']({},_0x46b3d4,_0x3c835a['options']);return db['SmsApplication']['find'](_0x46b3d4)[_0x1e6b('0x23')](handleEntityNotFound(_0x596188,null))[_0x1e6b('0x23')](respondWithResult(_0x596188,null))[_0x1e6b('0x43')](handleError(_0x596188,null));};exports[_0x1e6b('0x47')]=function(_0x5a7890,_0x41b940){return db[_0x1e6b('0x2a')][_0x1e6b('0x47')](_0x5a7890['body'],{})['then'](respondWithResult(_0x41b940,0xc9))[_0x1e6b('0x43')](handleError(_0x41b940,null));};exports[_0x1e6b('0x48')]=function(_0x50fa9d,_0x53a15a){if(_0x50fa9d[_0x1e6b('0x49')]['id']){delete _0x50fa9d[_0x1e6b('0x49')]['id'];}return db['SmsApplication'][_0x1e6b('0x4a')]({'where':{'id':_0x50fa9d[_0x1e6b('0x45')]['id']}})[_0x1e6b('0x23')](handleEntityNotFound(_0x53a15a,null))[_0x1e6b('0x23')](saveUpdates(_0x50fa9d['body'],null))[_0x1e6b('0x23')](respondWithResult(_0x53a15a,null))['catch'](handleError(_0x53a15a,null));};exports[_0x1e6b('0x4b')]=function(_0x3b3775,_0x33d7ac){return db[_0x1e6b('0x2a')][_0x1e6b('0x4a')]({'where':{'id':_0x3b3775[_0x1e6b('0x45')]['id']}})[_0x1e6b('0x23')](handleEntityNotFound(_0x33d7ac,null))[_0x1e6b('0x23')](removeEntity(_0x33d7ac,null))[_0x1e6b('0x43')](handleError(_0x33d7ac,null));}; \ No newline at end of file +var _0x80e9=['ioredis','../../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','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsApplication','findAll','catch','show','includeAll','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x397447,_0x590e7a){var _0xb1813f=function(_0x18f967){while(--_0x18f967){_0x397447['push'](_0x397447['shift']());}};_0xb1813f(++_0x590e7a);}(_0x80e9,0x1cc));var _0x980e=function(_0x584adb,_0x45790f){_0x584adb=_0x584adb-0x0;var _0x198b81=_0x80e9[_0x584adb];return _0x198b81;};'use strict';var emlformat=require(_0x980e('0x0'));var rimraf=require(_0x980e('0x1'));var zipdir=require(_0x980e('0x2'));var jsonpatch=require(_0x980e('0x3'));var rp=require(_0x980e('0x4'));var moment=require(_0x980e('0x5'));var BPromise=require(_0x980e('0x6'));var Mustache=require(_0x980e('0x7'));var util=require(_0x980e('0x8'));var path=require('path');var sox=require(_0x980e('0x9'));var csv=require(_0x980e('0xa'));var ejs=require(_0x980e('0xb'));var fs=require('fs');var fs_extra=require(_0x980e('0xc'));var _=require(_0x980e('0xd'));var squel=require(_0x980e('0xe'));var crypto=require(_0x980e('0xf'));var jsforce=require(_0x980e('0x10'));var deskjs=require(_0x980e('0x11'));var toCsv=require(_0x980e('0xa'));var querystring=require(_0x980e('0x12'));var Papa=require(_0x980e('0x13'));var Redis=require(_0x980e('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x980e('0x15'));var as=require(_0x980e('0x16'));var hardwareService=require(_0x980e('0x17'));var logger=require(_0x980e('0x18'))(_0x980e('0x19'));var utils=require(_0x980e('0x1a'));var config=require(_0x980e('0x1b'));var licenseUtil=require(_0x980e('0x1c'));var db=require(_0x980e('0x1d'))['db'];function respondWithStatusCode(_0xb8c175,_0x47f352){_0x47f352=_0x47f352||0xcc;return function(_0xd242b){if(_0xd242b){return _0xb8c175[_0x980e('0x1e')](_0x47f352);}return _0xb8c175['status'](_0x47f352)[_0x980e('0x1f')]();};}function respondWithResult(_0x473d0e,_0x144887){_0x144887=_0x144887||0xc8;return function(_0x29bf7b){if(_0x29bf7b){return _0x473d0e[_0x980e('0x20')](_0x144887)[_0x980e('0x21')](_0x29bf7b);}};}function respondWithFilteredResult(_0x3afe94,_0x1fef37){return function(_0xcc251a){if(_0xcc251a){var _0x57578b=typeof _0x1fef37[_0x980e('0x22')]===_0x980e('0x23')&&typeof _0x1fef37['limit']==='undefined';var _0x306f0a=_0xcc251a[_0x980e('0x24')];var _0x4f4b1d=_0x57578b?0x0:_0x1fef37[_0x980e('0x22')];var _0xc66351=_0x57578b?_0xcc251a[_0x980e('0x24')]:_0x1fef37['offset']+_0x1fef37['limit'];var _0x26b7f5;if(_0xc66351>=_0x306f0a){_0xc66351=_0x306f0a;_0x26b7f5=0xc8;}else{_0x26b7f5=0xce;}_0x3afe94['status'](_0x26b7f5);return _0x3afe94[_0x980e('0x25')](_0x980e('0x26'),_0x4f4b1d+'-'+_0xc66351+'/'+_0x306f0a)[_0x980e('0x21')](_0xcc251a);}return null;};}function patchUpdates(_0x53e4df){return function(_0x14d3c3){try{jsonpatch[_0x980e('0x27')](_0x14d3c3,_0x53e4df,!![]);}catch(_0x1eebc9){return BPromise[_0x980e('0x28')](_0x1eebc9);}return _0x14d3c3[_0x980e('0x29')]();};}function saveUpdates(_0x4cae52,_0x483916){return function(_0x535e36){if(_0x535e36){return _0x535e36[_0x980e('0x2a')](_0x4cae52)[_0x980e('0x2b')](function(_0x4cd9a3){return _0x4cd9a3;});}return null;};}function removeEntity(_0x50bebb,_0x4e9191){return function(_0x5d90a4){if(_0x5d90a4){return _0x5d90a4[_0x980e('0x2c')]()['then'](function(){_0x50bebb[_0x980e('0x20')](0xcc)[_0x980e('0x1f')]();});}};}function handleEntityNotFound(_0x5b5511,_0x4f4bd9){return function(_0x676acf){if(!_0x676acf){_0x5b5511[_0x980e('0x1e')](0x194);}return _0x676acf;};}function handleError(_0x194c0a,_0x260a3f){_0x260a3f=_0x260a3f||0x1f4;return function(_0x34743f){logger['error'](_0x34743f[_0x980e('0x2d')]);if(_0x34743f[_0x980e('0x2e')]){delete _0x34743f[_0x980e('0x2e')];}_0x194c0a['status'](_0x260a3f)[_0x980e('0x2f')](_0x34743f);};}exports[_0x980e('0x30')]=function(_0x426040,_0x16d0d0){var _0x1f2c83={},_0x1c05f7={},_0x4e9ad3={'count':0x0,'rows':[]};var _0x5b7cb5=_[_0x980e('0x31')](db['SmsApplication'][_0x980e('0x32')],function(_0x53eb7f){return{'name':_0x53eb7f['fieldName'],'type':_0x53eb7f['type'][_0x980e('0x33')]};});_0x1c05f7[_0x980e('0x34')]=_[_0x980e('0x31')](_0x5b7cb5,'name');_0x1c05f7[_0x980e('0x35')]=_[_0x980e('0x36')](_0x426040[_0x980e('0x35')]);_0x1c05f7[_0x980e('0x37')]=_['intersection'](_0x1c05f7['model'],_0x1c05f7[_0x980e('0x35')]);_0x1f2c83['attributes']=_[_0x980e('0x38')](_0x1c05f7['model'],qs[_0x980e('0x39')](_0x426040[_0x980e('0x35')]['fields']));_0x1f2c83[_0x980e('0x3a')]=_0x1f2c83[_0x980e('0x3a')][_0x980e('0x3b')]?_0x1f2c83[_0x980e('0x3a')]:_0x1c05f7[_0x980e('0x34')];if(!_0x426040['query'][_0x980e('0x3c')]('nolimit')){_0x1f2c83[_0x980e('0x3d')]=qs['limit'](_0x426040[_0x980e('0x35')][_0x980e('0x3d')]);_0x1f2c83[_0x980e('0x22')]=qs[_0x980e('0x22')](_0x426040['query'][_0x980e('0x22')]);}_0x1f2c83['order']=qs[_0x980e('0x3e')](_0x426040[_0x980e('0x35')]['sort']);_0x1f2c83[_0x980e('0x3f')]=qs[_0x980e('0x37')](_[_0x980e('0x40')](_0x426040[_0x980e('0x35')],_0x1c05f7[_0x980e('0x37')]),_0x5b7cb5);if(_0x426040[_0x980e('0x35')][_0x980e('0x41')]){_0x1f2c83[_0x980e('0x3f')]=_[_0x980e('0x42')](_0x1f2c83[_0x980e('0x3f')],{'$or':_[_0x980e('0x31')](_0x5b7cb5,function(_0x4d0065){if(_0x4d0065[_0x980e('0x43')]!==_0x980e('0x44')){var _0x38b9b6={};_0x38b9b6[_0x4d0065['name']]={'$like':'%'+_0x426040[_0x980e('0x35')][_0x980e('0x41')]+'%'};return _0x38b9b6;}})});}_0x1f2c83=_[_0x980e('0x42')]({},_0x1f2c83,_0x426040[_0x980e('0x45')]);var _0x199f80={'where':_0x1f2c83['where']};return db[_0x980e('0x46')]['count'](_0x199f80)[_0x980e('0x2b')](function(_0x1d79d6){_0x4e9ad3[_0x980e('0x24')]=_0x1d79d6;if(_0x426040[_0x980e('0x35')]['includeAll']){_0x1f2c83['include']=[{'all':!![]}];}return db[_0x980e('0x46')][_0x980e('0x47')](_0x1f2c83);})[_0x980e('0x2b')](function(_0x1611e1){_0x4e9ad3['rows']=_0x1611e1;return _0x4e9ad3;})[_0x980e('0x2b')](respondWithFilteredResult(_0x16d0d0,_0x1f2c83))[_0x980e('0x48')](handleError(_0x16d0d0,null));};exports[_0x980e('0x49')]=function(_0x3a2586,_0x3cc17f){var _0x67c1be={'raw':!![],'where':{'id':_0x3a2586['params']['id']}},_0x39652d={};_0x39652d[_0x980e('0x34')]=_[_0x980e('0x36')](db[_0x980e('0x46')][_0x980e('0x32')]);_0x39652d[_0x980e('0x35')]=_['keys'](_0x3a2586[_0x980e('0x35')]);_0x39652d[_0x980e('0x37')]=_[_0x980e('0x38')](_0x39652d['model'],_0x39652d[_0x980e('0x35')]);_0x67c1be[_0x980e('0x3a')]=_[_0x980e('0x38')](_0x39652d['model'],qs[_0x980e('0x39')](_0x3a2586['query']['fields']));_0x67c1be['attributes']=_0x67c1be[_0x980e('0x3a')]['length']?_0x67c1be['attributes']:_0x39652d[_0x980e('0x34')];if(_0x3a2586[_0x980e('0x35')][_0x980e('0x4a')]){_0x67c1be[_0x980e('0x4b')]=[{'all':!![]}];}_0x67c1be=_[_0x980e('0x42')]({},_0x67c1be,_0x3a2586['options']);return db[_0x980e('0x46')][_0x980e('0x4c')](_0x67c1be)[_0x980e('0x2b')](handleEntityNotFound(_0x3cc17f,null))[_0x980e('0x2b')](respondWithResult(_0x3cc17f,null))[_0x980e('0x48')](handleError(_0x3cc17f,null));};exports[_0x980e('0x4d')]=function(_0x554d40,_0x162725){return db[_0x980e('0x46')][_0x980e('0x4d')](_0x554d40[_0x980e('0x4e')],{})[_0x980e('0x2b')](respondWithResult(_0x162725,0xc9))['catch'](handleError(_0x162725,null));};exports[_0x980e('0x2a')]=function(_0x1e19a3,_0x1e3fa1){if(_0x1e19a3[_0x980e('0x4e')]['id']){delete _0x1e19a3[_0x980e('0x4e')]['id'];}return db[_0x980e('0x46')][_0x980e('0x4c')]({'where':{'id':_0x1e19a3[_0x980e('0x4f')]['id']}})[_0x980e('0x2b')](handleEntityNotFound(_0x1e3fa1,null))[_0x980e('0x2b')](saveUpdates(_0x1e19a3[_0x980e('0x4e')],null))[_0x980e('0x2b')](respondWithResult(_0x1e3fa1,null))[_0x980e('0x48')](handleError(_0x1e3fa1,null));};exports[_0x980e('0x2c')]=function(_0x1263bc,_0x3a5b07){return db[_0x980e('0x46')]['find']({'where':{'id':_0x1263bc['params']['id']}})[_0x980e('0x2b')](handleEntityNotFound(_0x3a5b07,null))[_0x980e('0x2b')](removeEntity(_0x3a5b07,null))['catch'](handleError(_0x3a5b07,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 464e3f2..0f6e74a 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 _0x1f1c=['utf8mb4','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsApplication','sms_applications'];(function(_0x33af1b,_0x318b5c){var _0x5d481f=function(_0x6e362){while(--_0x6e362){_0x33af1b['push'](_0x33af1b['shift']());}};_0x5d481f(++_0x318b5c);}(_0x1f1c,0x1ed));var _0xc1f1=function(_0x3862e5,_0x2e56bf){_0x3862e5=_0x3862e5-0x0;var _0x31fe64=_0x1f1c[_0x3862e5];return _0x31fe64;};'use strict';var _=require('lodash');var util=require(_0xc1f1('0x0'));var logger=require('../../config/logger')(_0xc1f1('0x1'));var moment=require(_0xc1f1('0x2'));var BPromise=require(_0xc1f1('0x3'));var rp=require(_0xc1f1('0x4'));var fs=require('fs');var path=require(_0xc1f1('0x5'));var rimraf=require('rimraf');var config=require(_0xc1f1('0x6'));var attributes=require('./smsApplication.attributes');module[_0xc1f1('0x7')]=function(_0x4902a8,_0x77601){return _0x4902a8[_0xc1f1('0x8')](_0xc1f1('0x9'),attributes,{'tableName':_0xc1f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1f1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x890f=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','util','../../config/logger','moment'];(function(_0x545913,_0x353f9b){var _0x13d315=function(_0x375de5){while(--_0x375de5){_0x545913['push'](_0x545913['shift']());}};_0x13d315(++_0x353f9b);}(_0x890f,0x1a1));var _0xf890=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0x890f[_0x2ccd5e];return _0x1a758e;};'use strict';var _=require('lodash');var util=require(_0xf890('0x0'));var logger=require(_0xf890('0x1'))('api');var moment=require(_0xf890('0x2'));var BPromise=require('bluebird');var rp=require(_0xf890('0x3'));var fs=require('fs');var path=require(_0xf890('0x4'));var rimraf=require(_0xf890('0x5'));var config=require(_0xf890('0x6'));var attributes=require(_0xf890('0x7'));module[_0xf890('0x8')]=function(_0x3df0dc,_0x343505){return _0x3df0dc['define']('SmsApplication',attributes,{'tableName':_0xf890('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8730ec0..f4fde69 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 _0x4123=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x31771a,_0x42fb1b){var _0x718b39=function(_0x1548a4){while(--_0x1548a4){_0x31771a['push'](_0x31771a['shift']());}};_0x718b39(++_0x42fb1b);}(_0x4123,0x87));var _0x3412=function(_0x19584e,_0x528482){_0x19584e=_0x19584e-0x0;var _0x5725b0=_0x4123[_0x19584e];return _0x5725b0;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var moment=require(_0x3412('0x2'));var BPromise=require(_0x3412('0x3'));var rs=require(_0x3412('0x4'));var fs=require('fs');var Redis=require(_0x3412('0x5'));var db=require(_0x3412('0x6'))['db'];var utils=require(_0x3412('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3412('0x8'));var jayson=require(_0x3412('0x9'));var client=jayson['client'][_0x3412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b42,_0x30d18b,_0x43f43c){return new BPromise(function(_0x40c825,_0x2617a6){return client['request'](_0x2c6b42,_0x43f43c)[_0x3412('0xb')](function(_0x2517b0){logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));logger[_0x3412('0xf')](_0x3412('0x10'),_0x30d18b,_0x3412('0xe'),JSON[_0x3412('0x11')](_0x2517b0));if(_0x2517b0['error']){if(_0x2517b0['error'][_0x3412('0x12')]===0x1f4){logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0['error']['message']);return _0x2617a6(_0x2517b0['error'][_0x3412('0x14')]);}logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);return _0x40c825(_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);}else{logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));_0x40c825(_0x2517b0[_0x3412('0x15')][_0x3412('0x14')]);}})[_0x3412('0x16')](function(_0x854010){logger['error'](_0x3412('0xd'),_0x30d18b,_0x854010);_0x2617a6(_0x854010);});});} \ No newline at end of file +var _0x1d63=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x1d63,0xa4));var _0x31d6=function(_0x2fe226,_0x37afc9){_0x2fe226=_0x2fe226-0x0;var _0x2bc65b=_0x1d63[_0x2fe226];return _0x2bc65b;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var moment=require(_0x31d6('0x2'));var BPromise=require(_0x31d6('0x3'));var rs=require(_0x31d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x5'))['db'];var utils=require(_0x31d6('0x6'));var logger=require(_0x31d6('0x7'))(_0x31d6('0x8'));var config=require(_0x31d6('0x9'));var jayson=require(_0x31d6('0xa'));var client=jayson[_0x31d6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b549,_0x6cc83b,_0x4fee16){return new BPromise(function(_0x34a5e3,_0x2c1b36){return client['request'](_0x36b549,_0x4fee16)['then'](function(_0x4b32f8){logger[_0x31d6('0xc')](_0x31d6('0xd'),_0x6cc83b,_0x31d6('0xe'));logger['debug'](_0x31d6('0xf'),_0x6cc83b,_0x31d6('0xe'),JSON[_0x31d6('0x10')](_0x4b32f8));if(_0x4b32f8[_0x31d6('0x11')]){if(_0x4b32f8[_0x31d6('0x11')]['code']===0x1f4){logger[_0x31d6('0x11')](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x2c1b36(_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);}logger['error'](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x34a5e3(_0x4b32f8[_0x31d6('0x11')]['message']);}else{logger[_0x31d6('0xc')]('SmsApplication,\x20%s,\x20%s',_0x6cc83b,_0x31d6('0xe'));_0x34a5e3(_0x4b32f8[_0x31d6('0x13')][_0x31d6('0x12')]);}})[_0x31d6('0x14')](function(_0x189784){logger[_0x31d6('0x11')]('SmsApplication,\x20%s,\x20%s',_0x6cc83b,_0x189784);_0x2c1b36(_0x189784);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9adcce3..2990f50 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 _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xae1fe4,_0x4b0378){var _0x34bed6=function(_0x44a3bc){while(--_0x44a3bc){_0xae1fe4['push'](_0xae1fe4['shift']());}};_0x34bed6(++_0x4b0378);}(_0xefda,0x96));var _0xaefd=function(_0x2eb39f,_0x17c21e){_0x2eb39f=_0x2eb39f-0x0;var _0x4e0c45=_0xefda[_0x2eb39f];return _0x4e0c45;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file +var _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x50cc2b,_0x1d8986){var _0x3567d3=function(_0x18cc47){while(--_0x18cc47){_0x50cc2b['push'](_0x50cc2b['shift']());}};_0x3567d3(++_0x1d8986);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0xe5b5[_0x282ccc];return _0x27c2dd;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2baee15..1182084 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 _0x50a8=['STRING','ENUM','out','INTEGER','moment','BOOLEAN','DATE'];(function(_0x1c9e37,_0x20d9a1){var _0x197736=function(_0x45b6d4){while(--_0x45b6d4){_0x1c9e37['push'](_0x1c9e37['shift']());}};_0x197736(++_0x20d9a1);}(_0x50a8,0x193));var _0x850a=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0x50a8[_0xf237f7];return _0x2c183b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x850a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x850a('0x2')]},'disposition':{'type':Sequelize[_0x850a('0x3')]},'secondDisposition':{'type':Sequelize[_0x850a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x850a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x850a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x850a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x850a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x850a('0x6')]}}; \ No newline at end of file +var _0x2cc4=['INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x2cc4[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0x42cc('0x0'));var moment=require(_0x42cc('0x1'));module[_0x42cc('0x2')]={'closed':{'type':Sequelize[_0x42cc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x42cc('0x4')]},'secondDisposition':{'type':Sequelize[_0x42cc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x42cc('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x42cc('0x6')]('in',_0x42cc('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x42cc('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x42cc('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x42cc('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x42cc('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9bd3ab8..0cc54ee 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 _0x9dd1=['unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','describe','SmsMessage','addMessage','omit','getMessages','keys','length','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','ids','spread','color','emit','removeTags','toString','join','files','tmp','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Messages','createdAt','read','SmsAccount','Account','fullname','Owner','N.A.','closed','closedAt','disposition','direction','System','secret','server','views','.pdf','createPdfFromHTML','err'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x9dd1,0x160));var _0x19dd=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x9dd1[_0x595013];return _0x2a29e3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x19dd('0x0'));var moment=require(_0x19dd('0x1'));var BPromise=require(_0x19dd('0x2'));var util=require(_0x19dd('0x3'));var path=require(_0x19dd('0x4'));var ejs=require(_0x19dd('0x5'));var fs=require('fs');var _=require(_0x19dd('0x6'));var Redis=require(_0x19dd('0x7'));var interaction=require(_0x19dd('0x8'));var qs=require(_0x19dd('0x9'));var pdf=require(_0x19dd('0xa'));var logger=require('../../config/logger')('api');var config=require(_0x19dd('0xb'));var db=require(_0x19dd('0xc'))['db'];config[_0x19dd('0xd')]=_[_0x19dd('0xe')](config[_0x19dd('0xd')],{'host':_0x19dd('0xf'),'port':0x18eb});var socket=require(_0x19dd('0x10'))(new Redis(config[_0x19dd('0xd')]));require(_0x19dd('0x11'))[_0x19dd('0x12')](socket);function respondWithStatusCode(_0x4fc12a,_0x5eb94b){_0x5eb94b=_0x5eb94b||0xcc;return function(_0x4b1d9d){if(_0x4b1d9d){return _0x4fc12a[_0x19dd('0x13')](_0x5eb94b);}return _0x4fc12a[_0x19dd('0x14')](_0x5eb94b)[_0x19dd('0x15')]();};}function respondWithResult(_0x183687,_0xe3de71){_0xe3de71=_0xe3de71||0xc8;return function(_0x588453){if(_0x588453){return _0x183687['status'](_0xe3de71)[_0x19dd('0x16')](_0x588453);}};}function respondWithFilteredResult(_0x33c379,_0x1928aa){return function(_0x2809b4){if(_0x2809b4){var _0x356c4d=typeof _0x1928aa[_0x19dd('0x17')]===_0x19dd('0x18')&&typeof _0x1928aa[_0x19dd('0x19')]===_0x19dd('0x18');var _0x259b74=_0x2809b4['count'];var _0x54d9a4=_0x356c4d?0x0:_0x1928aa['offset'];var _0x11e164=_0x356c4d?_0x2809b4[_0x19dd('0x1a')]:_0x1928aa[_0x19dd('0x17')]+_0x1928aa[_0x19dd('0x19')];var _0x5b1f01;if(_0x11e164>=_0x259b74){_0x11e164=_0x259b74;_0x5b1f01=0xc8;}else{_0x5b1f01=0xce;}_0x33c379[_0x19dd('0x14')](_0x5b1f01);return _0x33c379[_0x19dd('0x1b')](_0x19dd('0x1c'),_0x54d9a4+'-'+_0x11e164+'/'+_0x259b74)['json'](_0x2809b4);}return null;};}function saveUpdates(_0x1239b7){return function(_0x5699a1){if(_0x5699a1){return _0x5699a1[_0x19dd('0x1d')](_0x1239b7)[_0x19dd('0x1e')](function(_0x3ea7bb){return _0x3ea7bb;});}return null;};}function removeEntity(_0x40bc61){return function(_0x4517ca){if(_0x4517ca){return _0x4517ca[_0x19dd('0x1f')]()[_0x19dd('0x1e')](function(){_0x40bc61[_0x19dd('0x14')](0xcc)[_0x19dd('0x15')]();});}};}function handleEntityNotFound(_0x2b91cd){return function(_0x28587b){if(!_0x28587b){_0x2b91cd[_0x19dd('0x13')](0x194);}return _0x28587b;};}function handleError(_0x266aa3,_0x26f863){_0x26f863=_0x26f863||0x1f4;return function(_0x125c47){logger[_0x19dd('0x20')](_0x125c47[_0x19dd('0x21')]);if(_0x125c47[_0x19dd('0x22')]){delete _0x125c47[_0x19dd('0x22')];}_0x266aa3[_0x19dd('0x14')](_0x26f863)[_0x19dd('0x23')](_0x125c47);};}exports[_0x19dd('0x24')]=function(_0x42d3d5,_0x4d19c4){var _0x212277={};var _0xd0b053=_['map'](db[_0x19dd('0x25')][_0x19dd('0x26')],function(_0x5aa815){return{'name':_0x5aa815[_0x19dd('0x27')],'type':_0x5aa815[_0x19dd('0x28')][_0x19dd('0x29')]};});_0x212277=qs[_0x19dd('0x2a')](_0xd0b053,_0x42d3d5);return interaction[_0x19dd('0x2b')](_0x19dd('0x2c'),_0x42d3d5[_0x19dd('0x2d')],_0x42d3d5['user'],_0x212277,_0xd0b053)['then'](respondWithFilteredResult(_0x4d19c4,_0x212277))[_0x19dd('0x2e')](handleError(_0x4d19c4,null));};exports[_0x19dd('0x2f')]=function(_0xa232c9,_0x18b534){var _0x43d35b={'raw':![],'where':{'id':_0xa232c9[_0x19dd('0x30')]['id']}},_0xcd4106={};_0xcd4106[_0x19dd('0x31')]=_['keys'](db[_0x19dd('0x25')]['rawAttributes']);_0xcd4106[_0x19dd('0x2d')]=_['keys'](_0xa232c9[_0x19dd('0x2d')]);_0xcd4106['filters']=_[_0x19dd('0x32')](_0xcd4106['model'],_0xcd4106['query']);_0x43d35b[_0x19dd('0x33')]=_[_0x19dd('0x32')](_0xcd4106[_0x19dd('0x31')],qs['fields'](_0xa232c9[_0x19dd('0x2d')][_0x19dd('0x34')]));_0x43d35b[_0x19dd('0x33')]=_0x43d35b[_0x19dd('0x33')]['length']?_0x43d35b[_0x19dd('0x33')]:_0xcd4106[_0x19dd('0x31')];if(_0xa232c9[_0x19dd('0x2d')][_0x19dd('0x35')]){_0x43d35b[_0x19dd('0x36')]=[{'all':!![]}];}_0x43d35b=_[_0x19dd('0x37')]({},_0x43d35b,_0xa232c9[_0x19dd('0x38')]);return db[_0x19dd('0x25')]['find'](_0x43d35b)[_0x19dd('0x1e')](handleEntityNotFound(_0x18b534,null))[_0x19dd('0x1e')](respondWithResult(_0x18b534,null))['catch'](handleError(_0x18b534,null));};exports['create']=function(_0x5ebfa1,_0x401d0a){return db['SmsInteraction'][_0x19dd('0x39')](_0x5ebfa1['body'],{})['then'](respondWithResult(_0x401d0a,0xc9))[_0x19dd('0x2e')](handleError(_0x401d0a,null));};exports[_0x19dd('0x1d')]=function(_0x31ee95,_0x327bb9){if(_0x31ee95[_0x19dd('0x3a')]['id']){delete _0x31ee95['body']['id'];}return db[_0x19dd('0x25')]['find']({'where':{'id':_0x31ee95[_0x19dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x327bb9,null))[_0x19dd('0x1e')](saveUpdates(_0x31ee95[_0x19dd('0x3a')],null))[_0x19dd('0x1e')](respondWithResult(_0x327bb9,null))['catch'](handleError(_0x327bb9,null));};exports[_0x19dd('0x1f')]=function(_0x1f6e00,_0xaf0c68){return db['SmsInteraction'][_0x19dd('0x3b')]({'where':{'id':_0x1f6e00[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0xaf0c68,null))['then'](removeEntity(_0xaf0c68,null))[_0x19dd('0x2e')](handleError(_0xaf0c68,null));};exports[_0x19dd('0x3c')]=function(_0x1afb3d,_0x4c3569){return db[_0x19dd('0x25')][_0x19dd('0x3c')]()[_0x19dd('0x1e')](respondWithResult(_0x4c3569,null))['catch'](handleError(_0x4c3569,null));};exports['addMessage']=function(_0x5e262b,_0x31e504){return db[_0x19dd('0x3d')][_0x19dd('0x3b')]({'where':{'id':_0x5e262b[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x31e504,null))[_0x19dd('0x1e')](function(_0x4fe311){if(_0x4fe311){return _0x4fe311[_0x19dd('0x3e')](_0x5e262b[_0x19dd('0x3a')]['ids'],_[_0x19dd('0x3f')](_0x5e262b[_0x19dd('0x3a')],['ids','id'])||{});}})[_0x19dd('0x1e')](respondWithResult(_0x31e504,null))[_0x19dd('0x2e')](handleError(_0x31e504,null));};exports[_0x19dd('0x40')]=function(_0x4dced4,_0x3e691f){var _0x205873={'raw':![],'where':{}};var _0x104a8e={};var _0x2a19ca={'count':0x0,'rows':[]};return db[_0x19dd('0x25')]['findOne']({'where':{'id':_0x4dced4['params']['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x3e691f,null))['then'](function(_0x50e4ed){if(_0x50e4ed){_0x104a8e[_0x19dd('0x31')]=_[_0x19dd('0x41')](db['SmsMessage'][_0x19dd('0x26')]);_0x104a8e['query']=_[_0x19dd('0x41')](_0x4dced4[_0x19dd('0x2d')]);_0x104a8e['filters']=_['intersection'](_0x104a8e[_0x19dd('0x31')],_0x104a8e[_0x19dd('0x2d')]);_0x205873[_0x19dd('0x33')]=_['intersection'](_0x104a8e['model'],qs[_0x19dd('0x34')](_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x34')]));_0x205873['attributes']=_0x205873['attributes'][_0x19dd('0x42')]?_0x205873[_0x19dd('0x33')]:_0x104a8e[_0x19dd('0x31')];if(!_0x4dced4[_0x19dd('0x2d')]['hasOwnProperty'](_0x19dd('0x43'))){_0x205873[_0x19dd('0x19')]=qs['limit'](_0x4dced4[_0x19dd('0x2d')]['limit']);_0x205873[_0x19dd('0x17')]=qs[_0x19dd('0x17')](_0x4dced4[_0x19dd('0x2d')]['offset']);}_0x205873[_0x19dd('0x44')]=qs[_0x19dd('0x45')](_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x45')]);_0x205873[_0x19dd('0x46')]=qs[_0x19dd('0x47')](_[_0x19dd('0x48')](_0x4dced4[_0x19dd('0x2d')],_0x104a8e[_0x19dd('0x47')]));_0x205873[_0x19dd('0x46')][_0x19dd('0x49')]=_0x50e4ed['id'];if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4a')]){_0x205873['where']=_[_0x19dd('0x37')](_0x205873[_0x19dd('0x46')],{'$or':_['map'](_0x205873['attributes'],function(_0x4a4f65){var _0x4a97f5={};_0x4a97f5[_0x4a4f65]={'$like':'%'+_0x4dced4['query'][_0x19dd('0x4a')]+'%'};return _0x4a97f5;})});}if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4b')]){var _0x4dbeba=_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4b')][_0x19dd('0x4c')](',');var _0x200ea7={};_0x200ea7[_0x4dbeba[0x0]]={'$gte':moment(_0x4dbeba[0x1])[_0x19dd('0x4d')](_0x19dd('0x4e'))};_0x205873[_0x19dd('0x46')]=_[_0x19dd('0x37')](_0x205873[_0x19dd('0x46')],_0x200ea7);}_0x205873=_['merge']({},_0x205873,_0x4dced4[_0x19dd('0x38')]);return db[_0x19dd('0x3d')]['count']({'where':_0x205873['where']})[_0x19dd('0x1e')](function(_0x4cbadd){_0x2a19ca[_0x19dd('0x1a')]=_0x4cbadd;if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x35')]){_0x205873['include']=[{'all':!![]}];}return db['SmsMessage'][_0x19dd('0x2b')](_0x205873);})[_0x19dd('0x1e')](function(_0x473922){_0x2a19ca[_0x19dd('0x4f')]=_0x473922;return _0x2a19ca;});}})[_0x19dd('0x1e')](respondWithFilteredResult(_0x3e691f,_0x205873))[_0x19dd('0x2e')](handleError(_0x3e691f,null));};exports[_0x19dd('0x50')]=function(_0x9b2c08,_0x1c265b){return db['SmsInteraction']['find']({'where':{'id':_0x9b2c08[_0x19dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x1c265b,null))[_0x19dd('0x1e')](function(_0x5a0047){if(_0x5a0047){return _0x5a0047['setTags'](_0x9b2c08[_0x19dd('0x3a')]['ids'],_[_0x19dd('0x3f')](_0x9b2c08[_0x19dd('0x3a')],[_0x19dd('0x51'),'id'])||{})[_0x19dd('0x52')](function(){return db['Tag'][_0x19dd('0x2b')]({'attributes':['id',_0x19dd('0x22'),_0x19dd('0x53')],'where':{'id':_0x9b2c08[_0x19dd('0x3a')][_0x19dd('0x51')]}});})[_0x19dd('0x1e')](function(_0x3618ff){socket[_0x19dd('0x54')]('smsInteractionTags:save',{'id':Number(_0x9b2c08[_0x19dd('0x30')]['id']),'tags':_0x3618ff||[]});return{'id':Number(_0x9b2c08[_0x19dd('0x30')]['id']),'tags':_0x3618ff||[]};});}})[_0x19dd('0x1e')](respondWithResult(_0x1c265b,null))[_0x19dd('0x2e')](handleError(_0x1c265b,null));};exports[_0x19dd('0x55')]=function(_0x12df6d,_0x5e066a){return db['SmsInteraction'][_0x19dd('0x3b')]({'where':{'id':_0x12df6d[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x5e066a,null))[_0x19dd('0x1e')](function(_0x28c6fd){if(_0x28c6fd){return _0x28c6fd[_0x19dd('0x55')](_0x12df6d[_0x19dd('0x2d')][_0x19dd('0x51')]);}})[_0x19dd('0x1e')](respondWithStatusCode(_0x5e066a,null))['catch'](handleError(_0x5e066a,null));};exports['download']=function(_0xda5773,_0xf1c61f){var _0x40e850=moment()['unix']()[_0x19dd('0x56')]();var _0x3b965e=path[_0x19dd('0x57')](config['root'],'server',_0x19dd('0x58'),_0x19dd('0x59'));var _0x1678fd=path[_0x19dd('0x57')](_0x3b965e,_0x40e850);var _0x4d134d=util[_0x19dd('0x4d')](_0x19dd('0x5a'),_0xda5773[_0x19dd('0x30')]['id'],_0x40e850);var _0x5e9630=path['join'](_0x3b965e,_0x4d134d);var _0x47c204=[];_0x47c204['push']({'model':db[_0x19dd('0x5b')],'as':_0x19dd('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x47c204[_0x19dd('0x5c')]({'model':db[_0x19dd('0x5d')],'as':_0x19dd('0x5e'),'attributes':['id',_0x19dd('0x5f'),_0x19dd('0x60')],'raw':!![]});var _0x3933f1=[{'model':db['SmsMessage'],'as':_0x19dd('0x61'),'attributes':['id','body',_0x19dd('0x62'),'direction','secret',_0x19dd('0x63')],'include':_0x47c204}];_0x3933f1[_0x19dd('0x5c')]({'model':db[_0x19dd('0x64')],'as':_0x19dd('0x65'),'attributes':['id','name']});_0x3933f1['push']({'model':db[_0x19dd('0x5b')],'as':'Owner','attributes':['id',_0x19dd('0x66')]});return db[_0x19dd('0x25')][_0x19dd('0x3b')]({'where':{'id':_0xda5773[_0x19dd('0x30')]['id']},'include':_0x3933f1})['then'](handleEntityNotFound(_0xf1c61f,null))[_0x19dd('0x1e')](function(_0x627648){if(_0x627648){var _0x5c86c9=_0x627648['get']({'plain':!![]});fs['mkdirSync'](_0x1678fd);var _0x51e1bd={'channel':'Sms','account':_0x5c86c9[_0x19dd('0x65')][_0x19dd('0x22')],'agent':_0x5c86c9[_0x19dd('0x67')]?_0x5c86c9[_0x19dd('0x67')]['fullname']:_0x19dd('0x68'),'createdAt':moment(_0x5c86c9[_0x19dd('0x62')])['format'](_0x19dd('0x4e'))[_0x19dd('0x56')](),'closedAt':_0x5c86c9[_0x19dd('0x69')]?moment(_0x5c86c9[_0x19dd('0x6a')])[_0x19dd('0x4d')](_0x19dd('0x4e'))[_0x19dd('0x56')]():'','disposition':_0x5c86c9[_0x19dd('0x6b')],'messages':_(_0x5c86c9['Messages'])[_0x19dd('0x4a')]({'secret':![]})['map'](function(_0x3aa158){return{'date':moment(_0x3aa158['createdAt'])[_0x19dd('0x4d')](_0x19dd('0x4e'))[_0x19dd('0x56')](),'sender':_0x3aa158[_0x19dd('0x6c')]==='out'?_0x3aa158[_0x19dd('0x5b')]?_0x3aa158[_0x19dd('0x5b')][_0x19dd('0x66')]:_0x19dd('0x6d'):_0x3aa158[_0x19dd('0x5e')][_0x19dd('0x5f')]+(_0x3aa158['Contact'][_0x19dd('0x60')]?'\x20'+_0x3aa158[_0x19dd('0x5e')][_0x19dd('0x60')]:''),'body':_0x3aa158[_0x19dd('0x3a')],'direction':_0x3aa158[_0x19dd('0x6c')]==='out'?'A':'C','secret':_0x3aa158[_0x19dd('0x6e')],'read':_0x3aa158[_0x19dd('0x63')]};})['value']()};return ejs['renderFile'](path[_0x19dd('0x57')](config['root'],_0x19dd('0x6f'),_0x19dd('0x70'),'downloadInteraction.ejs'),{'interaction':_0x51e1bd})[_0x19dd('0x1e')](function(_0x873654){var _0x24c9f7=path[_0x19dd('0x57')](_0x1678fd,'transcript-'+_0x5c86c9['id']+'-'+_0x40e850+_0x19dd('0x71'));var _0x9b0013={'path':_0x24c9f7,'channel':'Sms','interactionId':_0x5c86c9['id']};return pdf[_0x19dd('0x72')](_0x873654,_0x9b0013);})[_0x19dd('0x1e')](function(){return new BPromise(function(_0x4fd088,_0x4e0c35){zipdir(_0x1678fd,{'saveTo':_0x5e9630},function(_0x19b8a4,_0x70bf39){if(_0x19b8a4)return _0x4e0c35(_0x19b8a4);return _0x4fd088(_0x70bf39);});})[_0x19dd('0x1e')](function(){return new BPromise(function(_0x132e35,_0x422ab3){rimraf(_0x1678fd,function(_0x2f3ecc){if(_0x2f3ecc)_0x422ab3(_0x2f3ecc);return _0x132e35();});});})[_0x19dd('0x1e')](function(){return _0xf1c61f['download'](_0x5e9630,_0x4d134d,function(_0x2b5f1b){if(_0x2b5f1b){console['log'](_0x19dd('0x73'),_0x2b5f1b);}else{fs[_0x19dd('0x74')](_0x5e9630);}});});});}else{return _0xf1c61f[_0x19dd('0x13')](0xc8);}})[_0x19dd('0x2e')](handleError(_0xf1c61f,null));}; \ No newline at end of file +var _0xeb0f=['color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','Messages','createdAt','SmsAccount','Owner','Sms','closedAt','direction','out','System','lastName','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','./smsInteraction.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','catch','show','params','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','SmsMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread'];(function(_0x1f09b0,_0x218835){var _0x497711=function(_0x409fb4){while(--_0x409fb4){_0x1f09b0['push'](_0x1f09b0['shift']());}};_0x497711(++_0x218835);}(_0xeb0f,0x10a));var _0xfeb0=function(_0x2cfc0c,_0x5b535b){_0x2cfc0c=_0x2cfc0c-0x0;var _0x1434ab=_0xeb0f[_0x2cfc0c];return _0x1434ab;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xfeb0('0x0'));var moment=require('moment');var BPromise=require(_0xfeb0('0x1'));var util=require(_0xfeb0('0x2'));var path=require(_0xfeb0('0x3'));var ejs=require(_0xfeb0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfeb0('0x5'));var interaction=require(_0xfeb0('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xfeb0('0x7'));var logger=require(_0xfeb0('0x8'))('api');var config=require('../../config/environment');var db=require(_0xfeb0('0x9'))['db'];config[_0xfeb0('0xa')]=_['defaults'](config['redis'],{'host':_0xfeb0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfeb0('0xa')]));require(_0xfeb0('0xc'))['register'](socket);function respondWithStatusCode(_0xec35d5,_0x36d4f9){_0x36d4f9=_0x36d4f9||0xcc;return function(_0xf5dc0){if(_0xf5dc0){return _0xec35d5[_0xfeb0('0xd')](_0x36d4f9);}return _0xec35d5[_0xfeb0('0xe')](_0x36d4f9)[_0xfeb0('0xf')]();};}function respondWithResult(_0x24369a,_0x245bb7){_0x245bb7=_0x245bb7||0xc8;return function(_0x56702d){if(_0x56702d){return _0x24369a[_0xfeb0('0xe')](_0x245bb7)['json'](_0x56702d);}};}function respondWithFilteredResult(_0x9cbfa,_0x6cf88f){return function(_0x4b78eb){if(_0x4b78eb){var _0x38f283=typeof _0x6cf88f['offset']===_0xfeb0('0x10')&&typeof _0x6cf88f[_0xfeb0('0x11')]==='undefined';var _0x49863b=_0x4b78eb[_0xfeb0('0x12')];var _0x46b386=_0x38f283?0x0:_0x6cf88f['offset'];var _0x443608=_0x38f283?_0x4b78eb[_0xfeb0('0x12')]:_0x6cf88f[_0xfeb0('0x13')]+_0x6cf88f[_0xfeb0('0x11')];var _0x4fa18f;if(_0x443608>=_0x49863b){_0x443608=_0x49863b;_0x4fa18f=0xc8;}else{_0x4fa18f=0xce;}_0x9cbfa['status'](_0x4fa18f);return _0x9cbfa[_0xfeb0('0x14')](_0xfeb0('0x15'),_0x46b386+'-'+_0x443608+'/'+_0x49863b)[_0xfeb0('0x16')](_0x4b78eb);}return null;};}function saveUpdates(_0x1b673b){return function(_0xf603c2){if(_0xf603c2){return _0xf603c2[_0xfeb0('0x17')](_0x1b673b)[_0xfeb0('0x18')](function(_0x49f2f0){return _0x49f2f0;});}return null;};}function removeEntity(_0x2be8fe){return function(_0x238e4b){if(_0x238e4b){return _0x238e4b['destroy']()[_0xfeb0('0x18')](function(){_0x2be8fe[_0xfeb0('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56705a){return function(_0x514d19){if(!_0x514d19){_0x56705a[_0xfeb0('0xd')](0x194);}return _0x514d19;};}function handleError(_0x471b69,_0x4d6a68){_0x4d6a68=_0x4d6a68||0x1f4;return function(_0x59d32d){logger['error'](_0x59d32d[_0xfeb0('0x19')]);if(_0x59d32d[_0xfeb0('0x1a')]){delete _0x59d32d[_0xfeb0('0x1a')];}_0x471b69[_0xfeb0('0xe')](_0x4d6a68)[_0xfeb0('0x1b')](_0x59d32d);};}exports[_0xfeb0('0x1c')]=function(_0x263946,_0x2f0022){var _0x43f216={};var _0x4db477=_[_0xfeb0('0x1d')](db[_0xfeb0('0x1e')][_0xfeb0('0x1f')],function(_0x43f519){return{'name':_0x43f519[_0xfeb0('0x20')],'type':_0x43f519[_0xfeb0('0x21')][_0xfeb0('0x22')]};});_0x43f216=qs[_0xfeb0('0x23')](_0x4db477,_0x263946);return interaction[_0xfeb0('0x24')](_0xfeb0('0x25'),_0x263946['query'],_0x263946['user'],_0x43f216,_0x4db477)[_0xfeb0('0x18')](respondWithFilteredResult(_0x2f0022,_0x43f216))[_0xfeb0('0x26')](handleError(_0x2f0022,null));};exports[_0xfeb0('0x27')]=function(_0x53d106,_0x47e29e){var _0x27c190={'raw':![],'where':{'id':_0x53d106[_0xfeb0('0x28')]['id']}},_0x21dcb9={};_0x21dcb9[_0xfeb0('0x29')]=_[_0xfeb0('0x2a')](db[_0xfeb0('0x1e')][_0xfeb0('0x1f')]);_0x21dcb9['query']=_[_0xfeb0('0x2a')](_0x53d106['query']);_0x21dcb9[_0xfeb0('0x2b')]=_[_0xfeb0('0x2c')](_0x21dcb9[_0xfeb0('0x29')],_0x21dcb9[_0xfeb0('0x2d')]);_0x27c190[_0xfeb0('0x2e')]=_[_0xfeb0('0x2c')](_0x21dcb9['model'],qs[_0xfeb0('0x2f')](_0x53d106[_0xfeb0('0x2d')][_0xfeb0('0x2f')]));_0x27c190['attributes']=_0x27c190[_0xfeb0('0x2e')][_0xfeb0('0x30')]?_0x27c190['attributes']:_0x21dcb9[_0xfeb0('0x29')];if(_0x53d106[_0xfeb0('0x2d')][_0xfeb0('0x31')]){_0x27c190[_0xfeb0('0x32')]=[{'all':!![]}];}_0x27c190=_[_0xfeb0('0x33')]({},_0x27c190,_0x53d106[_0xfeb0('0x34')]);return db['SmsInteraction'][_0xfeb0('0x35')](_0x27c190)[_0xfeb0('0x18')](handleEntityNotFound(_0x47e29e,null))[_0xfeb0('0x18')](respondWithResult(_0x47e29e,null))['catch'](handleError(_0x47e29e,null));};exports[_0xfeb0('0x36')]=function(_0x55db29,_0x1766e3){return db['SmsInteraction'][_0xfeb0('0x36')](_0x55db29[_0xfeb0('0x37')],{})[_0xfeb0('0x18')](respondWithResult(_0x1766e3,0xc9))[_0xfeb0('0x26')](handleError(_0x1766e3,null));};exports[_0xfeb0('0x17')]=function(_0x393cf1,_0x1d6de4){if(_0x393cf1[_0xfeb0('0x37')]['id']){delete _0x393cf1[_0xfeb0('0x37')]['id'];}return db[_0xfeb0('0x1e')][_0xfeb0('0x35')]({'where':{'id':_0x393cf1['params']['id']}})[_0xfeb0('0x18')](handleEntityNotFound(_0x1d6de4,null))[_0xfeb0('0x18')](saveUpdates(_0x393cf1[_0xfeb0('0x37')],null))[_0xfeb0('0x18')](respondWithResult(_0x1d6de4,null))[_0xfeb0('0x26')](handleError(_0x1d6de4,null));};exports[_0xfeb0('0x38')]=function(_0x114fe4,_0x374aa6){return db[_0xfeb0('0x1e')][_0xfeb0('0x35')]({'where':{'id':_0x114fe4['params']['id']}})[_0xfeb0('0x18')](handleEntityNotFound(_0x374aa6,null))['then'](removeEntity(_0x374aa6,null))[_0xfeb0('0x26')](handleError(_0x374aa6,null));};exports['describe']=function(_0xf52d77,_0x1e525a){return db[_0xfeb0('0x1e')][_0xfeb0('0x39')]()[_0xfeb0('0x18')](respondWithResult(_0x1e525a,null))[_0xfeb0('0x26')](handleError(_0x1e525a,null));};exports[_0xfeb0('0x3a')]=function(_0x1c67c0,_0x39ae63){return db[_0xfeb0('0x3b')][_0xfeb0('0x35')]({'where':{'id':_0x1c67c0[_0xfeb0('0x28')]['id']}})['then'](handleEntityNotFound(_0x39ae63,null))[_0xfeb0('0x18')](function(_0x13041f){if(_0x13041f){return _0x13041f[_0xfeb0('0x3a')](_0x1c67c0[_0xfeb0('0x37')][_0xfeb0('0x3c')],_['omit'](_0x1c67c0[_0xfeb0('0x37')],[_0xfeb0('0x3c'),'id'])||{});}})[_0xfeb0('0x18')](respondWithResult(_0x39ae63,null))[_0xfeb0('0x26')](handleError(_0x39ae63,null));};exports['getMessages']=function(_0x1960b1,_0x149c0d){var _0x4b0f72={'raw':![],'where':{}};var _0x39b419={};var _0x4c4502={'count':0x0,'rows':[]};return db[_0xfeb0('0x1e')][_0xfeb0('0x3d')]({'where':{'id':_0x1960b1[_0xfeb0('0x28')]['id']}})[_0xfeb0('0x18')](handleEntityNotFound(_0x149c0d,null))[_0xfeb0('0x18')](function(_0x43847e){if(_0x43847e){_0x39b419['model']=_['keys'](db['SmsMessage'][_0xfeb0('0x1f')]);_0x39b419['query']=_['keys'](_0x1960b1['query']);_0x39b419[_0xfeb0('0x2b')]=_[_0xfeb0('0x2c')](_0x39b419[_0xfeb0('0x29')],_0x39b419[_0xfeb0('0x2d')]);_0x4b0f72[_0xfeb0('0x2e')]=_[_0xfeb0('0x2c')](_0x39b419[_0xfeb0('0x29')],qs[_0xfeb0('0x2f')](_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x2f')]));_0x4b0f72[_0xfeb0('0x2e')]=_0x4b0f72[_0xfeb0('0x2e')][_0xfeb0('0x30')]?_0x4b0f72['attributes']:_0x39b419[_0xfeb0('0x29')];if(!_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x3e')](_0xfeb0('0x3f'))){_0x4b0f72['limit']=qs[_0xfeb0('0x11')](_0x1960b1[_0xfeb0('0x2d')]['limit']);_0x4b0f72[_0xfeb0('0x13')]=qs[_0xfeb0('0x13')](_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x13')]);}_0x4b0f72[_0xfeb0('0x40')]=qs[_0xfeb0('0x41')](_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x41')]);_0x4b0f72[_0xfeb0('0x42')]=qs[_0xfeb0('0x2b')](_['pick'](_0x1960b1[_0xfeb0('0x2d')],_0x39b419['filters']));_0x4b0f72[_0xfeb0('0x42')][_0xfeb0('0x43')]=_0x43847e['id'];if(_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x44')]){_0x4b0f72[_0xfeb0('0x42')]=_[_0xfeb0('0x33')](_0x4b0f72[_0xfeb0('0x42')],{'$or':_[_0xfeb0('0x1d')](_0x4b0f72['attributes'],function(_0x7d7b41){var _0x15c119={};_0x15c119[_0x7d7b41]={'$like':'%'+_0x1960b1['query']['filter']+'%'};return _0x15c119;})});}if(_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x45')]){var _0x501be4=_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x45')]['split'](',');var _0x47ecc9={};_0x47ecc9[_0x501be4[0x0]]={'$gte':moment(_0x501be4[0x1])['format'](_0xfeb0('0x46'))};_0x4b0f72[_0xfeb0('0x42')]=_['merge'](_0x4b0f72['where'],_0x47ecc9);}_0x4b0f72=_[_0xfeb0('0x33')]({},_0x4b0f72,_0x1960b1[_0xfeb0('0x34')]);return db['SmsMessage'][_0xfeb0('0x12')]({'where':_0x4b0f72[_0xfeb0('0x42')]})[_0xfeb0('0x18')](function(_0x447a52){_0x4c4502['count']=_0x447a52;if(_0x1960b1[_0xfeb0('0x2d')][_0xfeb0('0x31')]){_0x4b0f72['include']=[{'all':!![]}];}return db[_0xfeb0('0x3b')][_0xfeb0('0x24')](_0x4b0f72);})['then'](function(_0x1ebee3){_0x4c4502[_0xfeb0('0x47')]=_0x1ebee3;return _0x4c4502;});}})[_0xfeb0('0x18')](respondWithFilteredResult(_0x149c0d,_0x4b0f72))['catch'](handleError(_0x149c0d,null));};exports[_0xfeb0('0x48')]=function(_0x364e93,_0x3827e9){return db[_0xfeb0('0x1e')][_0xfeb0('0x35')]({'where':{'id':_0x364e93[_0xfeb0('0x28')]['id']}})['then'](handleEntityNotFound(_0x3827e9,null))[_0xfeb0('0x18')](function(_0x3829a4){if(_0x3829a4){return _0x3829a4[_0xfeb0('0x49')](_0x364e93[_0xfeb0('0x37')][_0xfeb0('0x3c')],_[_0xfeb0('0x4a')](_0x364e93['body'],['ids','id'])||{})[_0xfeb0('0x4b')](function(){return db['Tag'][_0xfeb0('0x24')]({'attributes':['id','name',_0xfeb0('0x4c')],'where':{'id':_0x364e93[_0xfeb0('0x37')][_0xfeb0('0x3c')]}});})['then'](function(_0x13f423){socket[_0xfeb0('0x4d')](_0xfeb0('0x4e'),{'id':Number(_0x364e93[_0xfeb0('0x28')]['id']),'tags':_0x13f423||[]});return{'id':Number(_0x364e93[_0xfeb0('0x28')]['id']),'tags':_0x13f423||[]};});}})[_0xfeb0('0x18')](respondWithResult(_0x3827e9,null))[_0xfeb0('0x26')](handleError(_0x3827e9,null));};exports[_0xfeb0('0x4f')]=function(_0x5d2f21,_0x30de66){return db[_0xfeb0('0x1e')][_0xfeb0('0x35')]({'where':{'id':_0x5d2f21[_0xfeb0('0x28')]['id']}})[_0xfeb0('0x18')](handleEntityNotFound(_0x30de66,null))[_0xfeb0('0x18')](function(_0x36b00c){if(_0x36b00c){return _0x36b00c[_0xfeb0('0x4f')](_0x5d2f21['query'][_0xfeb0('0x3c')]);}})[_0xfeb0('0x18')](respondWithStatusCode(_0x30de66,null))[_0xfeb0('0x26')](handleError(_0x30de66,null));};exports[_0xfeb0('0x50')]=function(_0x5317e,_0x47d318){var _0x1e797d=moment()[_0xfeb0('0x51')]()[_0xfeb0('0x52')]();var _0x562da3=path[_0xfeb0('0x53')](config[_0xfeb0('0x54')],_0xfeb0('0x55'),_0xfeb0('0x56'),'tmp');var _0x201132=path['join'](_0x562da3,_0x1e797d);var _0x2a3e33=util[_0xfeb0('0x57')](_0xfeb0('0x58'),_0x5317e['params']['id'],_0x1e797d);var _0x31dd62=path[_0xfeb0('0x53')](_0x562da3,_0x2a3e33);var _0xf0ff53=[];_0xf0ff53['push']({'model':db[_0xfeb0('0x59')],'as':_0xfeb0('0x59'),'attributes':['id',_0xfeb0('0x5a')],'raw':!![]});_0xf0ff53[_0xfeb0('0x5b')]({'model':db[_0xfeb0('0x5c')],'as':_0xfeb0('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x5a1a28=[{'model':db[_0xfeb0('0x3b')],'as':_0xfeb0('0x5e'),'attributes':['id',_0xfeb0('0x37'),_0xfeb0('0x5f'),'direction','secret','read'],'include':_0xf0ff53}];_0x5a1a28[_0xfeb0('0x5b')]({'model':db[_0xfeb0('0x60')],'as':'Account','attributes':['id',_0xfeb0('0x1a')]});_0x5a1a28[_0xfeb0('0x5b')]({'model':db[_0xfeb0('0x59')],'as':_0xfeb0('0x61'),'attributes':['id',_0xfeb0('0x5a')]});return db[_0xfeb0('0x1e')][_0xfeb0('0x35')]({'where':{'id':_0x5317e[_0xfeb0('0x28')]['id']},'include':_0x5a1a28})[_0xfeb0('0x18')](handleEntityNotFound(_0x47d318,null))['then'](function(_0x40ae8f){if(_0x40ae8f){var _0x1ff51b=_0x40ae8f['get']({'plain':!![]});fs['mkdirSync'](_0x201132);var _0x428612={'channel':_0xfeb0('0x62'),'account':_0x1ff51b['Account'][_0xfeb0('0x1a')],'agent':_0x1ff51b[_0xfeb0('0x61')]?_0x1ff51b[_0xfeb0('0x61')][_0xfeb0('0x5a')]:'N.A.','createdAt':moment(_0x1ff51b['createdAt'])[_0xfeb0('0x57')](_0xfeb0('0x46'))[_0xfeb0('0x52')](),'closedAt':_0x1ff51b['closed']?moment(_0x1ff51b[_0xfeb0('0x63')])[_0xfeb0('0x57')](_0xfeb0('0x46'))[_0xfeb0('0x52')]():'','disposition':_0x1ff51b['disposition'],'messages':_(_0x1ff51b['Messages'])[_0xfeb0('0x44')]({'secret':![]})[_0xfeb0('0x1d')](function(_0x33b516){return{'date':moment(_0x33b516['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xfeb0('0x52')](),'sender':_0x33b516[_0xfeb0('0x64')]===_0xfeb0('0x65')?_0x33b516[_0xfeb0('0x59')]?_0x33b516[_0xfeb0('0x59')]['fullname']:_0xfeb0('0x66'):_0x33b516['Contact']['firstName']+(_0x33b516[_0xfeb0('0x5d')][_0xfeb0('0x67')]?'\x20'+_0x33b516[_0xfeb0('0x5d')]['lastName']:''),'body':_0x33b516['body'],'direction':_0x33b516[_0xfeb0('0x64')]===_0xfeb0('0x65')?'A':'C','secret':_0x33b516['secret'],'read':_0x33b516[_0xfeb0('0x68')]};})['value']()};return ejs[_0xfeb0('0x69')](path[_0xfeb0('0x53')](config[_0xfeb0('0x54')],'server',_0xfeb0('0x6a'),_0xfeb0('0x6b')),{'interaction':_0x428612})['then'](function(_0x449dfa){var _0x1e6542=path['join'](_0x201132,_0xfeb0('0x6c')+_0x1ff51b['id']+'-'+_0x1e797d+_0xfeb0('0x6d'));var _0x116a29={'path':_0x1e6542,'channel':_0xfeb0('0x62'),'interactionId':_0x1ff51b['id']};return pdf[_0xfeb0('0x6e')](_0x449dfa,_0x116a29);})[_0xfeb0('0x18')](function(){return new BPromise(function(_0x4cd54c,_0x4faea8){zipdir(_0x201132,{'saveTo':_0x31dd62},function(_0x509bcc,_0x39b915){if(_0x509bcc)return _0x4faea8(_0x509bcc);return _0x4cd54c(_0x39b915);});})['then'](function(){return new BPromise(function(_0x50209f,_0x24640a){rimraf(_0x201132,function(_0x596404){if(_0x596404)_0x24640a(_0x596404);return _0x50209f();});});})['then'](function(){return _0x47d318['download'](_0x31dd62,_0x2a3e33,function(_0x4e2eb3){if(_0x4e2eb3){console[_0xfeb0('0x6f')](_0xfeb0('0x70'),_0x4e2eb3);}else{fs[_0xfeb0('0x71')](_0x31dd62);}});});});}else{return _0x47d318[_0xfeb0('0xd')](0xc8);}})[_0xfeb0('0x26')](handleError(_0x47d318,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5d57897..6339945 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 _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x94ccd8,_0x2f5a34){var _0x2df4ef=function(_0x58ded5){while(--_0x58ded5){_0x94ccd8['push'](_0x94ccd8['shift']());}};_0x2df4ef(++_0x2f5a34);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5c3c[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x3d04=['SmsInteraction','SmsMessage','setMaxListeners','save','update','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var SmsInteraction=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var SmsMessage=require(_0x43d0('0x1'))['db'][_0x43d0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x43d0('0x4')](0x0);var events={'afterCreate':_0x43d0('0x5'),'afterUpdate':_0x43d0('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2a4d4c){return function(_0x1a75d4,_0x746f5e,_0x617bf){_0x1a75d4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x50919e){_0x1a75d4['setDataValue'](_0x43d0('0x7'),_0x50919e[_0x43d0('0x8')](function(_0x331421){return{'id':_0x331421['id']};}));return SmsMessage[_0x43d0('0x9')]({'where':{'SmsInteractionId':_0x1a75d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43d0('0xa')](function(_0x4d75d9){_0x1a75d4['setDataValue'](_0x43d0('0xb'),_0x4d75d9['length']);SmsInteractionEvents['emit'](_0x2a4d4c+':'+_0x1a75d4['id'],_0x1a75d4);SmsInteractionEvents[_0x43d0('0xc')](_0x2a4d4c,_0x1a75d4);_0x617bf(null);})[_0x43d0('0xd')](_0x617bf(null));};}for(var e in events){if(events[_0x43d0('0xe')](e)){var event=events[e];SmsInteraction[_0x43d0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0fbd7a0..dcd83ce 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 _0xa66a=['rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x178ca4,_0x5aaa16){var _0x57f6a8=function(_0x237032){while(--_0x237032){_0x178ca4['push'](_0x178ca4['shift']());}};_0x57f6a8(++_0x5aaa16);}(_0xa66a,0x1b3));var _0xaa66=function(_0x4ecb45,_0x443e31){_0x4ecb45=_0x4ecb45-0x0;var _0x513d1b=_0xa66a[_0x4ecb45];return _0x513d1b;};'use strict';var _=require('lodash');var util=require(_0xaa66('0x0'));var logger=require(_0xaa66('0x1'))(_0xaa66('0x2'));var moment=require(_0xaa66('0x3'));var BPromise=require(_0xaa66('0x4'));var rp=require(_0xaa66('0x5'));var fs=require('fs');var path=require(_0xaa66('0x6'));var rimraf=require(_0xaa66('0x7'));var config=require(_0xaa66('0x8'));var attributes=require(_0xaa66('0x9'));module[_0xaa66('0xa')]=function(_0x1205c1,_0x4efdd7){return _0x1205c1['define'](_0xaa66('0xb'),attributes,{'tableName':_0xaa66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16b8f1,_0x2d1837,_0x41da11){if(_0x16b8f1[_0xaa66('0xd')]('closed')){_0x16b8f1[_0xaa66('0xe')]=moment()[_0xaa66('0xf')](_0xaa66('0x10'));}_0x41da11(null,_0x16b8f1);}}});}; \ No newline at end of file +var _0xe449=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','sms_interactions','changed'];(function(_0x393f7d,_0x3c1c4a){var _0x41c596=function(_0x299c77){while(--_0x299c77){_0x393f7d['push'](_0x393f7d['shift']());}};_0x41c596(++_0x3c1c4a);}(_0xe449,0x134));var _0x9e44=function(_0x442dc3,_0xc2941d){_0x442dc3=_0x442dc3-0x0;var _0xf853df=_0xe449[_0x442dc3];return _0xf853df;};'use strict';var _=require(_0x9e44('0x0'));var util=require('util');var logger=require(_0x9e44('0x1'))(_0x9e44('0x2'));var moment=require(_0x9e44('0x3'));var BPromise=require(_0x9e44('0x4'));var rp=require(_0x9e44('0x5'));var fs=require('fs');var path=require(_0x9e44('0x6'));var rimraf=require(_0x9e44('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x9e44('0x8')]=function(_0x52f436,_0x3b5d06){return _0x52f436[_0x9e44('0x9')]('SmsInteraction',attributes,{'tableName':_0x9e44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x956520,_0x53bfff,_0x2c8b49){if(_0x956520[_0x9e44('0xb')](_0x9e44('0xc'))){_0x956520[_0x9e44('0xd')]=moment()[_0x9e44('0xe')](_0x9e44('0xf'));}_0x2c8b49(null,_0x956520);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2a0adfd..35e5e62 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 _0x2025=['ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','update','body','options','where','attributes','info','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','then'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2025,0x155));var _0x5202=function(_0x21e11f,_0x591e71){_0x21e11f=_0x21e11f-0x0;var _0x4e9da1=_0x2025[_0x21e11f];return _0x4e9da1;};'use strict';var _=require(_0x5202('0x0'));var util=require(_0x5202('0x1'));var moment=require(_0x5202('0x2'));var BPromise=require(_0x5202('0x3'));var rs=require(_0x5202('0x4'));var fs=require('fs');var Redis=require(_0x5202('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5202('0x6'));var logger=require(_0x5202('0x7'))(_0x5202('0x8'));var config=require('../../config/environment');var jayson=require(_0x5202('0x9'));var client=jayson[_0x5202('0xa')][_0x5202('0xb')]({'port':0x232a});config[_0x5202('0xc')]=_[_0x5202('0xd')](config[_0x5202('0xc')],{'host':_0x5202('0xe'),'port':0x18eb});var socket=require(_0x5202('0xf'))(new Redis(config['redis']));require(_0x5202('0x10'))[_0x5202('0x11')](socket);function respondWithRpcPromise(_0x336fcf,_0x12a4e5,_0x466800){return new BPromise(function(_0x30e51d,_0x4a3e87){return client[_0x5202('0x12')](_0x336fcf,_0x466800)['then'](function(_0x954515){logger['info'](_0x5202('0x13'),_0x12a4e5,'request\x20sent');logger['debug'](_0x5202('0x14'),_0x12a4e5,_0x5202('0x15'),JSON[_0x5202('0x16')](_0x954515));if(_0x954515[_0x5202('0x17')]){if(_0x954515[_0x5202('0x17')][_0x5202('0x18')]===0x1f4){logger[_0x5202('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x12a4e5,_0x954515[_0x5202('0x17')]['message']);return _0x4a3e87(_0x954515[_0x5202('0x17')][_0x5202('0x19')]);}logger[_0x5202('0x17')](_0x5202('0x13'),_0x12a4e5,_0x954515[_0x5202('0x17')]['message']);return _0x30e51d(_0x954515[_0x5202('0x17')][_0x5202('0x19')]);}else{logger['info'](_0x5202('0x13'),_0x12a4e5,_0x5202('0x15'));_0x30e51d(_0x954515['result'][_0x5202('0x19')]);}})['catch'](function(_0x30cb62){logger[_0x5202('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x12a4e5,_0x30cb62);_0x4a3e87(_0x30cb62);});});}exports['UpdateSmsInteraction']=function(_0x293028){var _0x4e89f8=this;return new Promise(function(_0x38f455,_0x219cff){return db['SmsInteraction'][_0x5202('0x1a')](_0x293028[_0x5202('0x1b')],{'raw':_0x293028['options']?_0x293028[_0x5202('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293028['options']?_0x293028[_0x5202('0x1c')][_0x5202('0x1d')]||null:null,'attributes':_0x293028[_0x5202('0x1c')]?_0x293028[_0x5202('0x1c')][_0x5202('0x1e')]||null:null,'limit':_0x293028[_0x5202('0x1c')]?_0x293028[_0x5202('0x1c')]['limit']||null:null})['then'](function(_0x2553ab){logger[_0x5202('0x1f')]('UpdateSmsInteraction',_0x293028);logger[_0x5202('0x20')](_0x5202('0x21'),_0x293028,JSON[_0x5202('0x16')](_0x2553ab));_0x38f455(_0x2553ab);})['catch'](function(_0x10e0ab){logger['error'](_0x5202('0x21'),_0x10e0ab[_0x5202('0x19')],_0x293028);_0x219cff(_0x4e89f8[_0x5202('0x17')](0x1f4,_0x10e0ab[_0x5202('0x19')]));});});};exports[_0x5202('0x22')]=function(_0x8f219a){return new Promise(function(_0x1f1c95,_0x5c295d){return db[_0x5202('0x23')]['find']({'where':_0x8f219a[_0x5202('0x1c')]?_0x8f219a[_0x5202('0x1c')][_0x5202('0x1d')]||null:null})[_0x5202('0x24')](function(_0x210811){if(_0x210811){return _0x210811['addTags'](_0x8f219a[_0x5202('0x1b')][_0x5202('0x25')],_[_0x5202('0x26')](_0x8f219a[_0x5202('0x1b')],[_0x5202('0x25'),'id'])||{});}})[_0x5202('0x27')](function(_0x2a8395){logger[_0x5202('0x1f')]('AddTags',_0x8f219a);logger[_0x5202('0x20')](_0x5202('0x28'),_0x8f219a,JSON[_0x5202('0x16')](_0x2a8395));_0x1f1c95(_0x2a8395);})[_0x5202('0x29')](function(_0x3ce2c9){logger[_0x5202('0x17')](_0x5202('0x28'),_0x3ce2c9[_0x5202('0x19')],_0x8f219a);_0x5c295d(_this[_0x5202('0x17')](0x1f4,_0x3ce2c9[_0x5202('0x19')]));});});}; \ No newline at end of file +var _0x8127=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','update','body','options','where','attributes','AddTagsToSmsInteraction','SmsInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e5349,_0x5025cc){var _0x2fbaf0=function(_0x48d960){while(--_0x48d960){_0x1e5349['push'](_0x1e5349['shift']());}};_0x2fbaf0(++_0x5025cc);}(_0x8127,0x158));var _0x7812=function(_0x31973d,_0xf403c2){_0x31973d=_0x31973d-0x0;var _0x4e92fa=_0x8127[_0x31973d];return _0x4e92fa;};'use strict';var _=require(_0x7812('0x0'));var util=require(_0x7812('0x1'));var moment=require(_0x7812('0x2'));var BPromise=require(_0x7812('0x3'));var rs=require(_0x7812('0x4'));var fs=require('fs');var Redis=require(_0x7812('0x5'));var db=require(_0x7812('0x6'))['db'];var utils=require(_0x7812('0x7'));var logger=require(_0x7812('0x8'))(_0x7812('0x9'));var config=require(_0x7812('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7812('0xb')][_0x7812('0xc')]({'port':0x232a});config[_0x7812('0xd')]=_[_0x7812('0xe')](config[_0x7812('0xd')],{'host':_0x7812('0xf'),'port':0x18eb});var socket=require(_0x7812('0x10'))(new Redis(config[_0x7812('0xd')]));require(_0x7812('0x11'))[_0x7812('0x12')](socket);function respondWithRpcPromise(_0x23d9d1,_0x434ab1,_0x566930){return new BPromise(function(_0x4832ed,_0x1b1b77){return client[_0x7812('0x13')](_0x23d9d1,_0x566930)[_0x7812('0x14')](function(_0x17c186){logger[_0x7812('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x434ab1,_0x7812('0x16'));logger[_0x7812('0x17')](_0x7812('0x18'),_0x434ab1,_0x7812('0x16'),JSON[_0x7812('0x19')](_0x17c186));if(_0x17c186[_0x7812('0x1a')]){if(_0x17c186['error'][_0x7812('0x1b')]===0x1f4){logger[_0x7812('0x1a')](_0x7812('0x1c'),_0x434ab1,_0x17c186[_0x7812('0x1a')][_0x7812('0x1d')]);return _0x1b1b77(_0x17c186[_0x7812('0x1a')][_0x7812('0x1d')]);}logger[_0x7812('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x434ab1,_0x17c186[_0x7812('0x1a')][_0x7812('0x1d')]);return _0x4832ed(_0x17c186[_0x7812('0x1a')][_0x7812('0x1d')]);}else{logger[_0x7812('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x434ab1,_0x7812('0x16'));_0x4832ed(_0x17c186[_0x7812('0x1e')][_0x7812('0x1d')]);}})[_0x7812('0x1f')](function(_0x35bfd1){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x434ab1,_0x35bfd1);_0x1b1b77(_0x35bfd1);});});}exports[_0x7812('0x20')]=function(_0x3bb941){var _0x905f70=this;return new Promise(function(_0x2f6f3a,_0x467380){return db['SmsInteraction'][_0x7812('0x21')](_0x3bb941[_0x7812('0x22')],{'raw':_0x3bb941[_0x7812('0x23')]?_0x3bb941[_0x7812('0x23')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb941['options']?_0x3bb941[_0x7812('0x23')][_0x7812('0x24')]||null:null,'attributes':_0x3bb941['options']?_0x3bb941['options'][_0x7812('0x25')]||null:null,'limit':_0x3bb941[_0x7812('0x23')]?_0x3bb941['options']['limit']||null:null})[_0x7812('0x14')](function(_0x3d49f1){logger[_0x7812('0x15')](_0x7812('0x20'),_0x3bb941);logger['debug'](_0x7812('0x20'),_0x3bb941,JSON[_0x7812('0x19')](_0x3d49f1));_0x2f6f3a(_0x3d49f1);})['catch'](function(_0x59b20f){logger[_0x7812('0x1a')](_0x7812('0x20'),_0x59b20f[_0x7812('0x1d')],_0x3bb941);_0x467380(_0x905f70[_0x7812('0x1a')](0x1f4,_0x59b20f[_0x7812('0x1d')]));});});};exports[_0x7812('0x26')]=function(_0x4edc6b){return new Promise(function(_0x3ab856,_0x142595){return db[_0x7812('0x27')]['find']({'where':_0x4edc6b[_0x7812('0x23')]?_0x4edc6b[_0x7812('0x23')]['where']||null:null})[_0x7812('0x14')](function(_0x3fd3e3){if(_0x3fd3e3){return _0x3fd3e3['addTags'](_0x4edc6b['body'][_0x7812('0x28')],_[_0x7812('0x29')](_0x4edc6b[_0x7812('0x22')],[_0x7812('0x28'),'id'])||{});}})[_0x7812('0x2a')](function(_0x243216){logger[_0x7812('0x15')]('AddTags',_0x4edc6b);logger[_0x7812('0x17')](_0x7812('0x2b'),_0x4edc6b,JSON[_0x7812('0x19')](_0x243216));_0x3ab856(_0x243216);})[_0x7812('0x1f')](function(_0x49abee){logger[_0x7812('0x1a')](_0x7812('0x2b'),_0x49abee[_0x7812('0x1d')],_0x4edc6b);_0x142595(_this[_0x7812('0x1a')](0x1f4,_0x49abee['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f1fe025..d4df223 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 _0xc2f1=['smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','register'];(function(_0x2c6484,_0x4fe72c){var _0x3b9d94=function(_0x3d8bd4){while(--_0x3d8bd4){_0x2c6484['push'](_0x2c6484['shift']());}};_0x3b9d94(++_0x4fe72c);}(_0xc2f1,0x8d));var _0x1c2f=function(_0x1441d9,_0x1e7a04){_0x1441d9=_0x1441d9-0x0;var _0x1b712d=_0xc2f1[_0x1441d9];return _0x1b712d;};'use strict';var SmsInteractionEvents=require(_0x1c2f('0x0'));var events=[_0x1c2f('0x1'),'remove',_0x1c2f('0x2')];function createListener(_0x41a172,_0x20c88c){return function(_0x4eccfd){_0x20c88c[_0x1c2f('0x3')](_0x41a172,_0x4eccfd);};}function removeListener(_0x20c970,_0x518cb2){return function(){SmsInteractionEvents[_0x1c2f('0x4')](_0x20c970,_0x518cb2);};}exports[_0x1c2f('0x5')]=function(_0x56357e){for(var _0x3a8e1c=0x0,_0x57015c=events['length'];_0x3a8e1c<_0x57015c;_0x3a8e1c++){var _0x165de6=events[_0x3a8e1c];var _0x506b04=createListener(_0x1c2f('0x6')+_0x165de6,_0x56357e);SmsInteractionEvents['on'](_0x165de6,_0x506b04);}}; \ No newline at end of file +var _0x8bb4=['update','removeListener','register','smsInteraction:','./smsInteraction.events','remove'];(function(_0xd4ecb5,_0x5b97c0){var _0x49859e=function(_0x46ca86){while(--_0x46ca86){_0xd4ecb5['push'](_0xd4ecb5['shift']());}};_0x49859e(++_0x5b97c0);}(_0x8bb4,0x1d8));var _0x48bb=function(_0x5a6de0,_0x2c86d9){_0x5a6de0=_0x5a6de0-0x0;var _0x41f2f3=_0x8bb4[_0x5a6de0];return _0x41f2f3;};'use strict';var SmsInteractionEvents=require(_0x48bb('0x0'));var events=['save',_0x48bb('0x1'),_0x48bb('0x2')];function createListener(_0x5b7b78,_0x59ebe0){return function(_0x39c47c){_0x59ebe0['emit'](_0x5b7b78,_0x39c47c);};}function removeListener(_0x456c58,_0x519382){return function(){SmsInteractionEvents[_0x48bb('0x3')](_0x456c58,_0x519382);};}exports[_0x48bb('0x4')]=function(_0x323043){for(var _0x1cc813=0x0,_0x2938f7=events['length'];_0x1cc813<_0x2938f7;_0x1cc813++){var _0x10d169=events[_0x1cc813];var _0x5583dc=createListener(_0x48bb('0x5')+_0x10d169,_0x323043);SmsInteractionEvents['on'](_0x10d169,_0x5583dc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 217d4e4..5fc8562 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 _0xa515=['accept','reject','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept'];(function(_0x3a2005,_0x11d3bc){var _0x393aeb=function(_0x80eb9){while(--_0x80eb9){_0x3a2005['push'](_0x3a2005['shift']());}};_0x393aeb(++_0x11d3bc);}(_0xa515,0x108));var _0x5a51=function(_0x4beb54,_0x5cd337){_0x4beb54=_0x4beb54-0x0;var _0x3f7fde=_0xa515[_0x4beb54];return _0x3f7fde;};'use strict';var multer=require(_0x5a51('0x0'));var util=require(_0x5a51('0x1'));var path=require(_0x5a51('0x2'));var timeout=require(_0x5a51('0x3'));var express=require('express');var router=express[_0x5a51('0x4')]();var fs_extra=require(_0x5a51('0x5'));var auth=require(_0x5a51('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a51('0x7'));var controller=require('./smsMessage.controller');router[_0x5a51('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a51('0x9')]);router['get'](_0x5a51('0xa'),auth[_0x5a51('0xb')](),controller['describe']);router[_0x5a51('0x8')]('/:id',auth[_0x5a51('0xb')](),controller['show']);router[_0x5a51('0xc')]('/',auth[_0x5a51('0xb')](),interaction[_0x5a51('0xd')](_0x5a51('0xe'),_0x5a51('0xf')),controller[_0x5a51('0x10')]);router[_0x5a51('0xc')](_0x5a51('0x11'),controller['status']);router[_0x5a51('0x12')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller[_0x5a51('0x14')]);router[_0x5a51('0x12')](_0x5a51('0x15'),auth['isAuthenticated'](),controller[_0x5a51('0x16')]);router[_0x5a51('0x12')]('/:id/reject',auth[_0x5a51('0xb')](),controller[_0x5a51('0x17')]);router[_0x5a51('0x18')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller['destroy']);module[_0x5a51('0x19')]=router; \ No newline at end of file +var _0x560c=['/describe','isAuthenticated','describe','/:id','show','post','sms','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x560c,0xdc));var _0xc560=function(_0x3828f3,_0x5876b8){_0x3828f3=_0x3828f3-0x0;var _0x536e0a=_0x560c[_0x3828f3];return _0x536e0a;};'use strict';var multer=require(_0xc560('0x0'));var util=require(_0xc560('0x1'));var path=require(_0xc560('0x2'));var timeout=require(_0xc560('0x3'));var express=require(_0xc560('0x4'));var router=express[_0xc560('0x5')]();var fs_extra=require(_0xc560('0x6'));var auth=require(_0xc560('0x7'));var interaction=require(_0xc560('0x8'));var config=require(_0xc560('0x9'));var controller=require('./smsMessage.controller');router[_0xc560('0xa')]('/',auth['isAuthenticated'](),controller[_0xc560('0xb')]);router[_0xc560('0xa')](_0xc560('0xc'),auth[_0xc560('0xd')](),controller[_0xc560('0xe')]);router[_0xc560('0xa')](_0xc560('0xf'),auth['isAuthenticated'](),controller[_0xc560('0x10')]);router[_0xc560('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xc560('0x12'),'smsmessage:create'),controller[_0xc560('0x13')]);router[_0xc560('0x11')](_0xc560('0x14'),controller[_0xc560('0x15')]);router['put']('/:id',auth[_0xc560('0xd')](),controller[_0xc560('0x16')]);router[_0xc560('0x17')](_0xc560('0x18'),auth[_0xc560('0xd')](),controller[_0xc560('0x19')]);router[_0xc560('0x17')](_0xc560('0x1a'),auth[_0xc560('0xd')](),controller[_0xc560('0x1b')]);router['delete'](_0xc560('0xf'),auth[_0xc560('0xd')](),controller[_0xc560('0x1c')]);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 7cf0fd0..353cd7a 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 _0x2cbe=['STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x42d306,_0x26e098){var _0x2abdaf=function(_0xee2032){while(--_0xee2032){_0x42d306['push'](_0x42d306['shift']());}};_0x2abdaf(++_0x26e098);}(_0x2cbe,0x110));var _0xe2cb=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x2cbe[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require('sequelize');module[_0xe2cb('0x0')]={'body':{'type':Sequelize[_0xe2cb('0x1')](_0xe2cb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe2cb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe2cb('0x4')](0xbe)},'phone':{'type':Sequelize[_0xe2cb('0x4')]},'readAt':{'type':Sequelize[_0xe2cb('0x5')]},'secret':{'type':Sequelize[_0xe2cb('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe2cb('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x646b=['STRING','DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2b1dda,_0x4ca1a1){var _0x607195=function(_0x37a485){while(--_0x37a485){_0x2b1dda['push'](_0x2b1dda['shift']());}};_0x607195(++_0x4ca1a1);}(_0x646b,0xfe));var _0xb646=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x646b[_0x5806c3];return _0x48ac77;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb646('0x0')](_0xb646('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb646('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb646('0x3')]('in',_0xb646('0x4')),'defaultValue':_0xb646('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb646('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xb646('0x6')]},'secret':{'type':Sequelize[_0xb646('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb646('0x5')]},'providerResponse':{'type':Sequelize[_0xb646('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index edaca21..a885ace 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 _0x8ac5=['./smsMessage.socket','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','then','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','update','find','describe','../../config/logger','accept','read','format','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','event','EventManager','sms','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','fullname','email','channel','motionChannel','reject','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','delivered','Status','plivio','infobip','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x23d24f,_0x1e0b12){var _0x45b301=function(_0x12ac9d){while(--_0x12ac9d){_0x23d24f['push'](_0x23d24f['shift']());}};_0x45b301(++_0x1e0b12);}(_0x8ac5,0x105));var _0x58ac=function(_0x258feb,_0x59e01f){_0x258feb=_0x258feb-0x0;var _0x40fc52=_0x8ac5[_0x258feb];return _0x40fc52;};'use strict';var emlformat=require(_0x58ac('0x0'));var rimraf=require(_0x58ac('0x1'));var zipdir=require(_0x58ac('0x2'));var jsonpatch=require(_0x58ac('0x3'));var rp=require(_0x58ac('0x4'));var moment=require(_0x58ac('0x5'));var BPromise=require(_0x58ac('0x6'));var Mustache=require(_0x58ac('0x7'));var util=require(_0x58ac('0x8'));var path=require(_0x58ac('0x9'));var sox=require('sox');var csv=require(_0x58ac('0xa'));var ejs=require(_0x58ac('0xb'));var fs=require('fs');var fs_extra=require(_0x58ac('0xc'));var _=require(_0x58ac('0xd'));var squel=require(_0x58ac('0xe'));var crypto=require(_0x58ac('0xf'));var jsforce=require(_0x58ac('0x10'));var deskjs=require(_0x58ac('0x11'));var toCsv=require(_0x58ac('0xa'));var querystring=require(_0x58ac('0x12'));var Papa=require(_0x58ac('0x13'));var Redis=require(_0x58ac('0x14'));var authService=require(_0x58ac('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x58ac('0x16'));var hardwareService=require(_0x58ac('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x58ac('0x18'));var config=require(_0x58ac('0x19'));var licenseUtil=require(_0x58ac('0x1a'));var db=require(_0x58ac('0x1b'))['db'];config[_0x58ac('0x1c')]=_['defaults'](config[_0x58ac('0x1c')],{'host':_0x58ac('0x1d'),'port':0x18eb});var socket=require(_0x58ac('0x1e'))(new Redis(config[_0x58ac('0x1c')]));require(_0x58ac('0x1f'))[_0x58ac('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x58ac('0x21')][_0x58ac('0x22')]({'port':0x232c});var client9002=jayson[_0x58ac('0x21')][_0x58ac('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x370baa,_0x442f2a,_0x8939b1,_0x10c16c){return new BPromise(function(_0x1a9aa1,_0x52cede){var _0x5bb92f=_0x10c16c||client;return _0x5bb92f[_0x58ac('0x23')](_0x370baa,_0x8939b1)['then'](function(_0x2bffd6){logger[_0x58ac('0x24')](_0x58ac('0x25'),_0x442f2a,_0x58ac('0x26'));logger[_0x58ac('0x27')](_0x58ac('0x28'),_0x442f2a,_0x58ac('0x26'),JSON[_0x58ac('0x29')](_0x2bffd6));if(_0x2bffd6[_0x58ac('0x2a')]){if(_0x2bffd6[_0x58ac('0x2a')][_0x58ac('0x2b')]===0x1f4){logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x2bffd6['error'][_0x58ac('0x2c')]);return _0x52cede(_0x2bffd6[_0x58ac('0x2a')][_0x58ac('0x2c')]);}logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x2bffd6[_0x58ac('0x2a')]['message']);return _0x1a9aa1(_0x2bffd6[_0x58ac('0x2a')]['message']);}else{logger[_0x58ac('0x24')]('SmsMessage,\x20%s,\x20%s',_0x442f2a,_0x58ac('0x26'));_0x1a9aa1(_0x2bffd6[_0x58ac('0x2d')]['message']);}})[_0x58ac('0x2e')](function(_0x12c766){logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x12c766);_0x52cede(_0x12c766);});});}function respondWithStatusCode(_0x48dd57,_0x4e169d){_0x4e169d=_0x4e169d||0xcc;return function(_0x59ac25){if(_0x59ac25){return _0x48dd57[_0x58ac('0x2f')](_0x4e169d);}return _0x48dd57['status'](_0x4e169d)[_0x58ac('0x30')]();};}function respondWithResult(_0x466d3f,_0xc581f8){_0xc581f8=_0xc581f8||0xc8;return function(_0x5d359a){if(_0x5d359a){return _0x466d3f[_0x58ac('0x31')](_0xc581f8)[_0x58ac('0x32')](_0x5d359a);}};}function respondWithFilteredResult(_0x3adb8d,_0x36ad82){return function(_0x129fe1){if(_0x129fe1){var _0xad5e8d=typeof _0x36ad82[_0x58ac('0x33')]==='undefined'&&typeof _0x36ad82[_0x58ac('0x34')]==='undefined';var _0x3db01c=_0x129fe1[_0x58ac('0x35')];var _0x45e2b1=_0xad5e8d?0x0:_0x36ad82[_0x58ac('0x33')];var _0x40b11e=_0xad5e8d?_0x129fe1['count']:_0x36ad82[_0x58ac('0x33')]+_0x36ad82[_0x58ac('0x34')];var _0x11a6a5;if(_0x40b11e>=_0x3db01c){_0x40b11e=_0x3db01c;_0x11a6a5=0xc8;}else{_0x11a6a5=0xce;}_0x3adb8d[_0x58ac('0x31')](_0x11a6a5);return _0x3adb8d[_0x58ac('0x36')]('Content-Range',_0x45e2b1+'-'+_0x40b11e+'/'+_0x3db01c)[_0x58ac('0x32')](_0x129fe1);}return null;};}function patchUpdates(_0x58f8df){return function(_0x300ab2){try{jsonpatch['apply'](_0x300ab2,_0x58f8df,!![]);}catch(_0xd8f04f){return BPromise['reject'](_0xd8f04f);}return _0x300ab2['save']();};}function saveUpdates(_0x1a7182,_0x2526ef){return function(_0x383e7b){if(_0x383e7b){return _0x383e7b['update'](_0x1a7182)[_0x58ac('0x37')](function(_0x5888c2){return _0x5888c2;});}return null;};}function removeEntity(_0x3245f4,_0x2cc1ea){return function(_0x285dd1){if(_0x285dd1){return _0x285dd1[_0x58ac('0x38')]()[_0x58ac('0x37')](function(){_0x3245f4[_0x58ac('0x31')](0xcc)[_0x58ac('0x30')]();});}};}function handleEntityNotFound(_0x589ff1,_0x4d1099){return function(_0x23b150){if(!_0x23b150){_0x589ff1[_0x58ac('0x2f')](0x194);}return _0x23b150;};}function handleError(_0x13c09a,_0x49d9ed){_0x49d9ed=_0x49d9ed||0x1f4;return function(_0x2f743d){logger['error'](_0x2f743d[_0x58ac('0x39')]);if(_0x2f743d['name']){delete _0x2f743d[_0x58ac('0x3a')];}_0x13c09a[_0x58ac('0x31')](_0x49d9ed)[_0x58ac('0x3b')](_0x2f743d);};}exports[_0x58ac('0x3c')]=function(_0x37437a,_0x11b46f){var _0x204f97={},_0x47e497={},_0xc3c7f7={'count':0x0,'rows':[]};var _0x2105d7=_['map'](db[_0x58ac('0x3d')][_0x58ac('0x3e')],function(_0x4c264c){return{'name':_0x4c264c[_0x58ac('0x3f')],'type':_0x4c264c[_0x58ac('0x40')]['key']};});_0x47e497[_0x58ac('0x41')]=_[_0x58ac('0x42')](_0x2105d7,_0x58ac('0x3a'));_0x47e497[_0x58ac('0x43')]=_[_0x58ac('0x44')](_0x37437a[_0x58ac('0x43')]);_0x47e497[_0x58ac('0x45')]=_[_0x58ac('0x46')](_0x47e497[_0x58ac('0x41')],_0x47e497[_0x58ac('0x43')]);_0x204f97[_0x58ac('0x47')]=_['intersection'](_0x47e497[_0x58ac('0x41')],qs[_0x58ac('0x48')](_0x37437a[_0x58ac('0x43')]['fields']));_0x204f97[_0x58ac('0x47')]=_0x204f97['attributes']['length']?_0x204f97[_0x58ac('0x47')]:_0x47e497[_0x58ac('0x41')];if(!_0x37437a[_0x58ac('0x43')][_0x58ac('0x49')](_0x58ac('0x4a'))){_0x204f97[_0x58ac('0x34')]=qs[_0x58ac('0x34')](_0x37437a['query'][_0x58ac('0x34')]);_0x204f97[_0x58ac('0x33')]=qs[_0x58ac('0x33')](_0x37437a['query']['offset']);}_0x204f97['order']=qs['sort'](_0x37437a[_0x58ac('0x43')][_0x58ac('0x4b')]);_0x204f97[_0x58ac('0x4c')]=qs['filters'](_['pick'](_0x37437a[_0x58ac('0x43')],_0x47e497[_0x58ac('0x45')]),_0x2105d7);if(_0x37437a[_0x58ac('0x43')][_0x58ac('0x4d')]){_0x204f97[_0x58ac('0x4c')]=_[_0x58ac('0x4e')](_0x204f97[_0x58ac('0x4c')],{'$or':_[_0x58ac('0x42')](_0x2105d7,function(_0x26a42b){if(_0x26a42b['type']!==_0x58ac('0x4f')){var _0x47ff55={};_0x47ff55[_0x26a42b[_0x58ac('0x3a')]]={'$like':'%'+_0x37437a[_0x58ac('0x43')][_0x58ac('0x4d')]+'%'};return _0x47ff55;}})});}_0x204f97=_['merge']({},_0x204f97,_0x37437a[_0x58ac('0x50')]);var _0x45d5bc={'where':_0x204f97[_0x58ac('0x4c')]};return db[_0x58ac('0x3d')][_0x58ac('0x35')](_0x45d5bc)[_0x58ac('0x37')](function(_0x4afa81){_0xc3c7f7[_0x58ac('0x35')]=_0x4afa81;if(_0x37437a[_0x58ac('0x43')][_0x58ac('0x51')]){_0x204f97[_0x58ac('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x58ac('0x53')](_0x204f97);})[_0x58ac('0x37')](function(_0x3a2875){_0xc3c7f7[_0x58ac('0x54')]=_0x3a2875;return _0xc3c7f7;})[_0x58ac('0x37')](respondWithFilteredResult(_0x11b46f,_0x204f97))[_0x58ac('0x2e')](handleError(_0x11b46f,null));};exports[_0x58ac('0x55')]=function(_0x3fe6d4,_0x3591c8){var _0x1bf571={'raw':!![],'where':{'id':_0x3fe6d4[_0x58ac('0x56')]['id']}},_0x3f482e={};_0x3f482e[_0x58ac('0x41')]=_[_0x58ac('0x44')](db[_0x58ac('0x3d')][_0x58ac('0x3e')]);_0x3f482e['query']=_[_0x58ac('0x44')](_0x3fe6d4[_0x58ac('0x43')]);_0x3f482e[_0x58ac('0x45')]=_['intersection'](_0x3f482e[_0x58ac('0x41')],_0x3f482e[_0x58ac('0x43')]);_0x1bf571[_0x58ac('0x47')]=_['intersection'](_0x3f482e[_0x58ac('0x41')],qs[_0x58ac('0x48')](_0x3fe6d4['query'][_0x58ac('0x48')]));_0x1bf571['attributes']=_0x1bf571[_0x58ac('0x47')]['length']?_0x1bf571[_0x58ac('0x47')]:_0x3f482e['model'];if(_0x3fe6d4[_0x58ac('0x43')][_0x58ac('0x51')]){_0x1bf571[_0x58ac('0x52')]=[{'all':!![]}];}_0x1bf571=_[_0x58ac('0x4e')]({},_0x1bf571,_0x3fe6d4['options']);return db[_0x58ac('0x3d')]['find'](_0x1bf571)[_0x58ac('0x37')](handleEntityNotFound(_0x3591c8,null))[_0x58ac('0x37')](respondWithResult(_0x3591c8,null))[_0x58ac('0x2e')](handleError(_0x3591c8,null));};exports[_0x58ac('0x57')]=function(_0xa73d8d,_0x7957fd){return db[_0x58ac('0x3d')]['create'](_0xa73d8d[_0x58ac('0x58')],{})['then'](respondWithResult(_0x7957fd,0xc9))[_0x58ac('0x2e')](handleError(_0x7957fd,null));};exports[_0x58ac('0x59')]=function(_0x517307,_0xf4364f){if(_0x517307[_0x58ac('0x58')]['id']){delete _0x517307[_0x58ac('0x58')]['id'];}return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x517307['params']['id']}})['then'](handleEntityNotFound(_0xf4364f,null))['then'](saveUpdates(_0x517307[_0x58ac('0x58')],null))[_0x58ac('0x37')](respondWithResult(_0xf4364f,null))[_0x58ac('0x2e')](handleError(_0xf4364f,null));};exports['destroy']=function(_0x1c484f,_0x290225){return db['SmsMessage'][_0x58ac('0x5a')]({'where':{'id':_0x1c484f[_0x58ac('0x56')]['id']}})[_0x58ac('0x37')](handleEntityNotFound(_0x290225,null))[_0x58ac('0x37')](removeEntity(_0x290225,null))[_0x58ac('0x2e')](handleError(_0x290225,null));};exports[_0x58ac('0x5b')]=function(_0x6bbfe8,_0x3f716d){return db['SmsMessage'][_0x58ac('0x5b')]()[_0x58ac('0x37')](respondWithResult(_0x3f716d,null))[_0x58ac('0x2e')](handleError(_0x3f716d,null));};var interaction_log=require(_0x58ac('0x5c'))('sms-interactions');exports[_0x58ac('0x5d')]=function(_0x2b8117,_0x3deb1b,_0x5d84a0){var _0x43d41d={'agent':{},'channel':'sms'};if(_0x2b8117[_0x58ac('0x58')]['id']){delete _0x2b8117['body']['id'];}_0x2b8117[_0x58ac('0x58')][_0x58ac('0x5e')]=!![];_0x2b8117[_0x58ac('0x58')]['readAt']=moment()[_0x58ac('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b8117[_0x58ac('0x58')]['UserId']=_0x2b8117[_0x58ac('0x58')][_0x58ac('0x60')]||_0x2b8117[_0x58ac('0x61')]['id'];_0x43d41d[_0x58ac('0x62')]['id']=_0x2b8117['body'][_0x58ac('0x60')];return db[_0x58ac('0x3d')]['find']({'where':{'id':_0x2b8117['params']['id'],'UserId':null}})[_0x58ac('0x37')](handleEntityNotFound(_0x3deb1b,null))[_0x58ac('0x37')](saveUpdates(_0x2b8117['body'],null))[_0x58ac('0x37')](function(_0x44d4fd){if(_0x44d4fd){_0x43d41d[_0x58ac('0x2c')]=_0x44d4fd[_0x58ac('0x63')]({'plain':!![]});return db[_0x58ac('0x64')][_0x58ac('0x5a')]({'where':{'id':_0x44d4fd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3deb1b,null))['then'](function(_0x2bff96){if(_0x2bff96){return _0x2bff96[_0x58ac('0x59')]({'UserId':_0x2b8117['body'][_0x58ac('0x60')],'read1stAt':_[_0x58ac('0x65')](_0x2bff96[_0x58ac('0x66')])?moment()[_0x58ac('0x5f')](_0x58ac('0x67')):undefined});}return null;})[_0x58ac('0x37')](function(_0x2adc57){if(_0x2adc57){_0x43d41d[_0x58ac('0x68')]=_0x2adc57[_0x58ac('0x63')]({'plain':!![]});interaction_log[_0x58ac('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b8117['user']['id'],_0x2b8117['user']['name'],_0x2b8117[_0x58ac('0x61')]['role'],_0x43d41d[_0x58ac('0x68')]['id'],_0x2b8117[_0x58ac('0x58')]?JSON['stringify'](_0x2b8117[_0x58ac('0x58')]):_0x58ac('0x69'));return respondWithRpcPromise(_0x58ac('0x6a'),_0x58ac('0x6b'),_0x43d41d);}return null;})[_0x58ac('0x37')](function(_0x23b569){var _0x24e052=_0x58ac('0x6c')+_0x23b569[_0x58ac('0x2c')][_0x58ac('0x6d')];return db[_0x58ac('0x6e')][_0x58ac('0x43')](_0x24e052,{'type':db['Sequelize'][_0x58ac('0x6f')][_0x58ac('0x70')],'raw':!![]})['then'](function(_0x5165bd){return _0x5165bd;});})['then'](function(_0x54ce46){if(_0x54ce46){_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x71')]=_0x54ce46[0x0];if(!_0x2b8117[_0x58ac('0x58')][_0x58ac('0x60')])return;return db[_0x58ac('0x72')][_0x58ac('0x5a')]({'where':{'id':_0x2b8117['body']['UserId'],'role':'agent'},'attributes':['id',_0x58ac('0x3a'),'fullname','email',_0x58ac('0x73')],'raw':!![]});}return null;})['then'](function(_0x4db3af){if(!_0x4db3af)return null;_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x62')]=_0x4db3af;return _0x43d41d;})['then'](function(_0xd892f8){if(_0xd892f8){if(_0x2b8117[_0x58ac('0x58')][_0x58ac('0x74')]){_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x75')]=util['format'](_0x58ac('0x76'),_0x2b8117[_0x58ac('0x61')][_0x58ac('0x3a')]);_0x43d41d[_0x58ac('0x2c')]['channel']=_0x43d41d['channel'];_0x43d41d['message']['motionChannel']=_0x43d41d['channel'];_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x77')]=_0x58ac('0x5d');return respondWithRpcPromise(_0x58ac('0x78'),'EventManager',{'event':'acceptmessage','message':_0x43d41d[_0x58ac('0x2c')]},client9002)[_0x58ac('0x37')](function(){return _0x43d41d;});}return _0x43d41d;}return null;})[_0x58ac('0x37')](respondWithResult(_0x3deb1b,null))[_0x58ac('0x2e')](handleError(_0x3deb1b,null));};var interaction_log=require(_0x58ac('0x5c'))('sms-interactions');exports['reject']=function(_0x4c16a2,_0x57f7ca,_0x1d33d1){var _0x2b90bf={'agent':{},'channel':_0x58ac('0x79')};if(_0x4c16a2[_0x58ac('0x58')]['id']){delete _0x4c16a2[_0x58ac('0x58')]['id'];}_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')]=_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')]||_0x4c16a2[_0x58ac('0x61')]['id'];_0x2b90bf[_0x58ac('0x62')]['id']=_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')];return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x4c16a2[_0x58ac('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57f7ca,null))['then'](function(_0x3f30af){if(_0x3f30af){_0x2b90bf['message']=_0x3f30af[_0x58ac('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x58ac('0x5a')]({'where':{'id':_0x3f30af[_0x58ac('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x57f7ca,null))[_0x58ac('0x37')](function(_0x282c03){if(_0x282c03){_0x2b90bf[_0x58ac('0x68')]=_0x282c03['get']({'plain':!![]});interaction_log[_0x58ac('0x24')](_0x58ac('0x7b'),_0x4c16a2['user']['id'],_0x4c16a2[_0x58ac('0x61')]['name'],_0x4c16a2[_0x58ac('0x61')][_0x58ac('0x7c')],_0x2b90bf[_0x58ac('0x68')]['id'],_0x4c16a2[_0x58ac('0x58')]?JSON[_0x58ac('0x29')](_0x4c16a2['body']):_0x58ac('0x69'));return respondWithRpcPromise('RejectMessage',_0x58ac('0x7d'),_0x2b90bf);}return null;})[_0x58ac('0x37')](function(_0x20e290){var _0x44b7f6=_0x58ac('0x6c')+_0x20e290[_0x58ac('0x2c')][_0x58ac('0x6d')];return db[_0x58ac('0x6e')]['query'](_0x44b7f6,{'type':db['Sequelize']['QueryTypes'][_0x58ac('0x70')],'raw':!![]})[_0x58ac('0x37')](function(_0x2e4c36){return _0x2e4c36;});})[_0x58ac('0x37')](function(_0x224580){if(_0x224580){_0x2b90bf[_0x58ac('0x2c')]['contact']=_0x224580[0x0];if(!_0x4c16a2[_0x58ac('0x58')]['UserId'])return;return db[_0x58ac('0x72')]['find']({'where':{'id':_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')],'role':'agent'},'attributes':['id',_0x58ac('0x3a'),_0x58ac('0x7e'),_0x58ac('0x7f'),'internal'],'raw':!![]});}return null;})[_0x58ac('0x37')](function(_0x12fd23){if(!_0x12fd23)return null;_0x2b90bf[_0x58ac('0x2c')]['agent']=_0x12fd23;return _0x2b90bf;})[_0x58ac('0x37')](function(_0xf1a462){if(_0xf1a462){_0xf1a462['message'][_0x58ac('0x75')]=util[_0x58ac('0x5f')](_0x58ac('0x76'),_0x4c16a2['user'][_0x58ac('0x3a')]);_0xf1a462[_0x58ac('0x2c')]['channel']=_0x2b90bf[_0x58ac('0x80')];_0xf1a462[_0x58ac('0x2c')][_0x58ac('0x81')]=_0x2b90bf[_0x58ac('0x80')];_0xf1a462['message'][_0x58ac('0x77')]=_0x58ac('0x82');respondWithRpcPromise(_0x58ac('0x78'),'EventManager',{'event':_0x58ac('0x83'),'message':_0xf1a462[_0x58ac('0x2c')]},client9002);return _0x2b90bf;}return null;})[_0x58ac('0x37')](respondWithResult(_0x57f7ca,null))[_0x58ac('0x2e')](handleError(_0x57f7ca,null));};exports[_0x58ac('0x31')]=function(_0x289264,_0x428613,_0x562a5d){if(_0x289264[_0x58ac('0x58')]['id']){delete _0x289264[_0x58ac('0x58')]['id'];}var _0x40f014;return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x289264[_0x58ac('0x56')]['id']}})[_0x58ac('0x37')](handleEntityNotFound(_0x428613,null))['then'](function(_0x431f81){if(_0x431f81){_0x40f014=_0x431f81;return db[_0x58ac('0x84')][_0x58ac('0x5a')]({'where':{'id':_0x431f81['SmsAccountId']}});}})[_0x58ac('0x37')](handleEntityNotFound(_0x428613,null))[_0x58ac('0x37')](function(_0x29154f){if(_0x29154f){logger[_0x58ac('0x27')](_0x58ac('0x28'),_0x58ac('0x31'),'received\x20delivery\x20report\x20from',_0x29154f[_0x58ac('0x40')],util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));switch(_0x29154f[_0x58ac('0x40')]){case _0x58ac('0x86'):if(_0x289264[_0x58ac('0x58')][_0x58ac('0x87')]&&_0x289264[_0x58ac('0x58')][_0x58ac('0x87')]===_0x40f014[_0x58ac('0x88')]){return _0x40f014[_0x58ac('0x59')]({'read':!![]});}else{logger[_0x58ac('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58ac('0x31'),'twilio',util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;case _0x58ac('0x89'):if(_0x289264['body'][_0x58ac('0x8a')]&&_0x289264['body'][_0x58ac('0x8a')]===_0x40f014['messageId']&&_['indexOf'](['sent',_0x58ac('0x8b')],_0x289264['body'][_0x58ac('0x8c')])>=0x0){return _0x40f014[_0x58ac('0x59')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58ac('0x31'),_0x58ac('0x8d'),util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;case _0x58ac('0x8e'):var _0x389ed6=_0x289264[_0x58ac('0x58')][_0x58ac('0x8f')][0x0];if(_0x389ed6[_0x58ac('0x31')]['groupName']===_0x58ac('0x90')){return _0x40f014['update']({'read':!![]});}else{logger[_0x58ac('0x2a')](_0x58ac('0x91'),_0x58ac('0x31'),'infobip',util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x40f014;}})[_0x58ac('0x37')](respondWithResult(_0x428613,null))[_0x58ac('0x2e')](handleError(_0x428613,null));}; \ No newline at end of file +var _0xf7d9=['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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','catch','show','keys','fields','includeAll','include','find','create','body','params','describe','sms-interactions','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','format','channel','motionChannel','event','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','SIP/%s','rejectmessage','SmsAccount','debug','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs'];(function(_0x14d949,_0x4854c6){var _0x317e69=function(_0x128197){while(--_0x128197){_0x14d949['push'](_0x14d949['shift']());}};_0x317e69(++_0x4854c6);}(_0xf7d9,0x122));var _0x9f7d=function(_0x1f8f3b,_0x2e7233){_0x1f8f3b=_0x1f8f3b-0x0;var _0x3909ab=_0xf7d9[_0x1f8f3b];return _0x3909ab;};'use strict';var emlformat=require(_0x9f7d('0x0'));var rimraf=require(_0x9f7d('0x1'));var zipdir=require(_0x9f7d('0x2'));var jsonpatch=require(_0x9f7d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f7d('0x4'));var Mustache=require('mustache');var util=require(_0x9f7d('0x5'));var path=require(_0x9f7d('0x6'));var sox=require(_0x9f7d('0x7'));var csv=require(_0x9f7d('0x8'));var ejs=require(_0x9f7d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9f7d('0xa'));var crypto=require(_0x9f7d('0xb'));var jsforce=require(_0x9f7d('0xc'));var deskjs=require(_0x9f7d('0xd'));var toCsv=require(_0x9f7d('0x8'));var querystring=require(_0x9f7d('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f7d('0xf'));var authService=require(_0x9f7d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f7d('0x11'));var hardwareService=require(_0x9f7d('0x12'));var logger=require(_0x9f7d('0x13'))('api');var utils=require(_0x9f7d('0x14'));var config=require(_0x9f7d('0x15'));var licenseUtil=require(_0x9f7d('0x16'));var db=require(_0x9f7d('0x17'))['db'];config[_0x9f7d('0x18')]=_[_0x9f7d('0x19')](config['redis'],{'host':_0x9f7d('0x1a'),'port':0x18eb});var socket=require(_0x9f7d('0x1b'))(new Redis(config[_0x9f7d('0x18')]));require(_0x9f7d('0x1c'))['register'](socket);var jayson=require(_0x9f7d('0x1d'));var client=jayson[_0x9f7d('0x1e')][_0x9f7d('0x1f')]({'port':0x232c});var client9002=jayson[_0x9f7d('0x1e')][_0x9f7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2b1ad4,_0xd3449d,_0x513cf5,_0x587718){return new BPromise(function(_0x402609,_0x39cdb1){var _0x4cbe0b=_0x587718||client;return _0x4cbe0b[_0x9f7d('0x20')](_0x2b1ad4,_0x513cf5)[_0x9f7d('0x21')](function(_0x11d958){logger[_0x9f7d('0x22')](_0x9f7d('0x23'),_0xd3449d,_0x9f7d('0x24'));logger['debug'](_0x9f7d('0x25'),_0xd3449d,_0x9f7d('0x24'),JSON['stringify'](_0x11d958));if(_0x11d958['error']){if(_0x11d958['error'][_0x9f7d('0x26')]===0x1f4){logger[_0x9f7d('0x27')](_0x9f7d('0x23'),_0xd3449d,_0x11d958['error']['message']);return _0x39cdb1(_0x11d958[_0x9f7d('0x27')][_0x9f7d('0x28')]);}logger[_0x9f7d('0x27')](_0x9f7d('0x23'),_0xd3449d,_0x11d958[_0x9f7d('0x27')][_0x9f7d('0x28')]);return _0x402609(_0x11d958['error'][_0x9f7d('0x28')]);}else{logger['info'](_0x9f7d('0x23'),_0xd3449d,'request\x20sent');_0x402609(_0x11d958['result'][_0x9f7d('0x28')]);}})['catch'](function(_0x4bcfd0){logger[_0x9f7d('0x27')](_0x9f7d('0x23'),_0xd3449d,_0x4bcfd0);_0x39cdb1(_0x4bcfd0);});});}function respondWithStatusCode(_0xe5836d,_0x3600d4){_0x3600d4=_0x3600d4||0xcc;return function(_0x59191e){if(_0x59191e){return _0xe5836d['sendStatus'](_0x3600d4);}return _0xe5836d[_0x9f7d('0x29')](_0x3600d4)[_0x9f7d('0x2a')]();};}function respondWithResult(_0x21f0fd,_0x290ef9){_0x290ef9=_0x290ef9||0xc8;return function(_0x4f3550){if(_0x4f3550){return _0x21f0fd[_0x9f7d('0x29')](_0x290ef9)[_0x9f7d('0x2b')](_0x4f3550);}};}function respondWithFilteredResult(_0x8c6833,_0x2e61a3){return function(_0x4673bc){if(_0x4673bc){var _0x120169=typeof _0x2e61a3[_0x9f7d('0x2c')]===_0x9f7d('0x2d')&&typeof _0x2e61a3['limit']==='undefined';var _0x15fa20=_0x4673bc[_0x9f7d('0x2e')];var _0x1ca5cb=_0x120169?0x0:_0x2e61a3[_0x9f7d('0x2c')];var _0x1c9116=_0x120169?_0x4673bc[_0x9f7d('0x2e')]:_0x2e61a3[_0x9f7d('0x2c')]+_0x2e61a3[_0x9f7d('0x2f')];var _0x4c024f;if(_0x1c9116>=_0x15fa20){_0x1c9116=_0x15fa20;_0x4c024f=0xc8;}else{_0x4c024f=0xce;}_0x8c6833[_0x9f7d('0x29')](_0x4c024f);return _0x8c6833[_0x9f7d('0x30')](_0x9f7d('0x31'),_0x1ca5cb+'-'+_0x1c9116+'/'+_0x15fa20)['json'](_0x4673bc);}return null;};}function patchUpdates(_0x2c27fd){return function(_0x34170e){try{jsonpatch[_0x9f7d('0x32')](_0x34170e,_0x2c27fd,!![]);}catch(_0x5a37e3){return BPromise[_0x9f7d('0x33')](_0x5a37e3);}return _0x34170e[_0x9f7d('0x34')]();};}function saveUpdates(_0x5ae101,_0x14fcf0){return function(_0x3fe022){if(_0x3fe022){return _0x3fe022[_0x9f7d('0x35')](_0x5ae101)['then'](function(_0x54ddf7){return _0x54ddf7;});}return null;};}function removeEntity(_0x49bb98,_0xf9e13a){return function(_0x35b845){if(_0x35b845){return _0x35b845[_0x9f7d('0x36')]()[_0x9f7d('0x21')](function(){_0x49bb98[_0x9f7d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5d1b,_0x578222){return function(_0x4b52d3){if(!_0x4b52d3){_0x4b5d1b['sendStatus'](0x194);}return _0x4b52d3;};}function handleError(_0x33c070,_0x2dd9ff){_0x2dd9ff=_0x2dd9ff||0x1f4;return function(_0x133c4c){logger[_0x9f7d('0x27')](_0x133c4c['stack']);if(_0x133c4c[_0x9f7d('0x37')]){delete _0x133c4c['name'];}_0x33c070[_0x9f7d('0x29')](_0x2dd9ff)[_0x9f7d('0x38')](_0x133c4c);};}exports[_0x9f7d('0x39')]=function(_0x3ef0ba,_0x4bb270){var _0x328ac9={},_0x250fe5={},_0x46009c={'count':0x0,'rows':[]};var _0x8fee1c=_['map'](db[_0x9f7d('0x3a')][_0x9f7d('0x3b')],function(_0xb6167a){return{'name':_0xb6167a[_0x9f7d('0x3c')],'type':_0xb6167a[_0x9f7d('0x3d')][_0x9f7d('0x3e')]};});_0x250fe5[_0x9f7d('0x3f')]=_[_0x9f7d('0x40')](_0x8fee1c,_0x9f7d('0x37'));_0x250fe5[_0x9f7d('0x41')]=_['keys'](_0x3ef0ba[_0x9f7d('0x41')]);_0x250fe5['filters']=_['intersection'](_0x250fe5[_0x9f7d('0x3f')],_0x250fe5[_0x9f7d('0x41')]);_0x328ac9['attributes']=_[_0x9f7d('0x42')](_0x250fe5[_0x9f7d('0x3f')],qs['fields'](_0x3ef0ba[_0x9f7d('0x41')]['fields']));_0x328ac9['attributes']=_0x328ac9[_0x9f7d('0x43')][_0x9f7d('0x44')]?_0x328ac9[_0x9f7d('0x43')]:_0x250fe5[_0x9f7d('0x3f')];if(!_0x3ef0ba[_0x9f7d('0x41')][_0x9f7d('0x45')]('nolimit')){_0x328ac9[_0x9f7d('0x2f')]=qs[_0x9f7d('0x2f')](_0x3ef0ba[_0x9f7d('0x41')]['limit']);_0x328ac9['offset']=qs[_0x9f7d('0x2c')](_0x3ef0ba[_0x9f7d('0x41')][_0x9f7d('0x2c')]);}_0x328ac9[_0x9f7d('0x46')]=qs[_0x9f7d('0x47')](_0x3ef0ba[_0x9f7d('0x41')][_0x9f7d('0x47')]);_0x328ac9[_0x9f7d('0x48')]=qs['filters'](_[_0x9f7d('0x49')](_0x3ef0ba[_0x9f7d('0x41')],_0x250fe5[_0x9f7d('0x4a')]),_0x8fee1c);if(_0x3ef0ba[_0x9f7d('0x41')][_0x9f7d('0x4b')]){_0x328ac9[_0x9f7d('0x48')]=_[_0x9f7d('0x4c')](_0x328ac9['where'],{'$or':_[_0x9f7d('0x40')](_0x8fee1c,function(_0x590204){if(_0x590204[_0x9f7d('0x3d')]!==_0x9f7d('0x4d')){var _0x18d346={};_0x18d346[_0x590204['name']]={'$like':'%'+_0x3ef0ba[_0x9f7d('0x41')]['filter']+'%'};return _0x18d346;}})});}_0x328ac9=_[_0x9f7d('0x4c')]({},_0x328ac9,_0x3ef0ba[_0x9f7d('0x4e')]);var _0x2350a0={'where':_0x328ac9[_0x9f7d('0x48')]};return db[_0x9f7d('0x3a')][_0x9f7d('0x2e')](_0x2350a0)['then'](function(_0x5e0bb6){_0x46009c[_0x9f7d('0x2e')]=_0x5e0bb6;if(_0x3ef0ba[_0x9f7d('0x41')]['includeAll']){_0x328ac9['include']=[{'all':!![]}];}return db[_0x9f7d('0x3a')][_0x9f7d('0x4f')](_0x328ac9);})['then'](function(_0x3fb8ba){_0x46009c['rows']=_0x3fb8ba;return _0x46009c;})[_0x9f7d('0x21')](respondWithFilteredResult(_0x4bb270,_0x328ac9))[_0x9f7d('0x50')](handleError(_0x4bb270,null));};exports[_0x9f7d('0x51')]=function(_0x4437bc,_0x2855b6){var _0x54de21={'raw':!![],'where':{'id':_0x4437bc['params']['id']}},_0x2e0478={};_0x2e0478[_0x9f7d('0x3f')]=_[_0x9f7d('0x52')](db[_0x9f7d('0x3a')][_0x9f7d('0x3b')]);_0x2e0478[_0x9f7d('0x41')]=_[_0x9f7d('0x52')](_0x4437bc[_0x9f7d('0x41')]);_0x2e0478[_0x9f7d('0x4a')]=_[_0x9f7d('0x42')](_0x2e0478['model'],_0x2e0478[_0x9f7d('0x41')]);_0x54de21['attributes']=_[_0x9f7d('0x42')](_0x2e0478[_0x9f7d('0x3f')],qs['fields'](_0x4437bc[_0x9f7d('0x41')][_0x9f7d('0x53')]));_0x54de21[_0x9f7d('0x43')]=_0x54de21[_0x9f7d('0x43')][_0x9f7d('0x44')]?_0x54de21[_0x9f7d('0x43')]:_0x2e0478[_0x9f7d('0x3f')];if(_0x4437bc[_0x9f7d('0x41')][_0x9f7d('0x54')]){_0x54de21[_0x9f7d('0x55')]=[{'all':!![]}];}_0x54de21=_[_0x9f7d('0x4c')]({},_0x54de21,_0x4437bc[_0x9f7d('0x4e')]);return db[_0x9f7d('0x3a')][_0x9f7d('0x56')](_0x54de21)['then'](handleEntityNotFound(_0x2855b6,null))[_0x9f7d('0x21')](respondWithResult(_0x2855b6,null))[_0x9f7d('0x50')](handleError(_0x2855b6,null));};exports[_0x9f7d('0x57')]=function(_0x188321,_0x5df522){return db[_0x9f7d('0x3a')][_0x9f7d('0x57')](_0x188321[_0x9f7d('0x58')],{})[_0x9f7d('0x21')](respondWithResult(_0x5df522,0xc9))[_0x9f7d('0x50')](handleError(_0x5df522,null));};exports[_0x9f7d('0x35')]=function(_0x410be3,_0x554079){if(_0x410be3[_0x9f7d('0x58')]['id']){delete _0x410be3[_0x9f7d('0x58')]['id'];}return db[_0x9f7d('0x3a')][_0x9f7d('0x56')]({'where':{'id':_0x410be3['params']['id']}})[_0x9f7d('0x21')](handleEntityNotFound(_0x554079,null))['then'](saveUpdates(_0x410be3['body'],null))[_0x9f7d('0x21')](respondWithResult(_0x554079,null))['catch'](handleError(_0x554079,null));};exports[_0x9f7d('0x36')]=function(_0x295f0d,_0x254def){return db[_0x9f7d('0x3a')][_0x9f7d('0x56')]({'where':{'id':_0x295f0d[_0x9f7d('0x59')]['id']}})[_0x9f7d('0x21')](handleEntityNotFound(_0x254def,null))['then'](removeEntity(_0x254def,null))[_0x9f7d('0x50')](handleError(_0x254def,null));};exports[_0x9f7d('0x5a')]=function(_0x5e6eba,_0x2cc44c){return db[_0x9f7d('0x3a')][_0x9f7d('0x5a')]()[_0x9f7d('0x21')](respondWithResult(_0x2cc44c,null))[_0x9f7d('0x50')](handleError(_0x2cc44c,null));};var interaction_log=require('../../config/logger')(_0x9f7d('0x5b'));exports['accept']=function(_0x3c874e,_0x117535,_0x29792a){var _0x2bb6da={'agent':{},'channel':_0x9f7d('0x5c')};if(_0x3c874e[_0x9f7d('0x58')]['id']){delete _0x3c874e['body']['id'];}_0x3c874e[_0x9f7d('0x58')]['read']=!![];_0x3c874e[_0x9f7d('0x58')][_0x9f7d('0x5d')]=moment()['format'](_0x9f7d('0x5e'));_0x3c874e['body'][_0x9f7d('0x5f')]=_0x3c874e[_0x9f7d('0x58')][_0x9f7d('0x5f')]||_0x3c874e[_0x9f7d('0x60')]['id'];_0x2bb6da[_0x9f7d('0x61')]['id']=_0x3c874e[_0x9f7d('0x58')][_0x9f7d('0x5f')];return db[_0x9f7d('0x3a')][_0x9f7d('0x56')]({'where':{'id':_0x3c874e[_0x9f7d('0x59')]['id'],'UserId':null}})[_0x9f7d('0x21')](handleEntityNotFound(_0x117535,null))[_0x9f7d('0x21')](saveUpdates(_0x3c874e['body'],null))[_0x9f7d('0x21')](function(_0x2af20a){if(_0x2af20a){_0x2bb6da[_0x9f7d('0x28')]=_0x2af20a[_0x9f7d('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x9f7d('0x56')]({'where':{'id':_0x2af20a['SmsInteractionId']}});}return null;})[_0x9f7d('0x21')](handleEntityNotFound(_0x117535,null))[_0x9f7d('0x21')](function(_0x506454){if(_0x506454){return _0x506454['update']({'UserId':_0x3c874e['body'][_0x9f7d('0x5f')],'read1stAt':_[_0x9f7d('0x63')](_0x506454[_0x9f7d('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9f7d('0x21')](function(_0xe13d9f){if(_0xe13d9f){_0x2bb6da[_0x9f7d('0x65')]=_0xe13d9f['get']({'plain':!![]});interaction_log[_0x9f7d('0x22')](_0x9f7d('0x66'),_0x3c874e['user']['id'],_0x3c874e['user'][_0x9f7d('0x37')],_0x3c874e[_0x9f7d('0x60')][_0x9f7d('0x67')],_0x2bb6da[_0x9f7d('0x65')]['id'],_0x3c874e[_0x9f7d('0x58')]?JSON[_0x9f7d('0x68')](_0x3c874e[_0x9f7d('0x58')]):_0x9f7d('0x69'));return respondWithRpcPromise(_0x9f7d('0x6a'),_0x9f7d('0x6b'),_0x2bb6da);}return null;})['then'](function(_0xa33403){var _0x355844='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa33403[_0x9f7d('0x28')][_0x9f7d('0x6c')];return db[_0x9f7d('0x6d')]['query'](_0x355844,{'type':db['Sequelize'][_0x9f7d('0x6e')][_0x9f7d('0x6f')],'raw':!![]})[_0x9f7d('0x21')](function(_0x217acb){return _0x217acb;});})[_0x9f7d('0x21')](function(_0x2d39d6){if(_0x2d39d6){_0x2bb6da['message'][_0x9f7d('0x70')]=_0x2d39d6[0x0];if(!_0x3c874e[_0x9f7d('0x58')]['UserId'])return;return db[_0x9f7d('0x71')]['find']({'where':{'id':_0x3c874e[_0x9f7d('0x58')][_0x9f7d('0x5f')],'role':'agent'},'attributes':['id',_0x9f7d('0x37'),'fullname',_0x9f7d('0x72'),_0x9f7d('0x73')],'raw':!![]});}return null;})[_0x9f7d('0x21')](function(_0x23652b){if(!_0x23652b)return null;_0x2bb6da[_0x9f7d('0x28')]['agent']=_0x23652b;return _0x2bb6da;})['then'](function(_0x4d98b1){if(_0x4d98b1){if(_0x3c874e[_0x9f7d('0x58')][_0x9f7d('0x74')]){_0x2bb6da['message'][_0x9f7d('0x75')]=util[_0x9f7d('0x76')]('SIP/%s',_0x3c874e[_0x9f7d('0x60')]['name']);_0x2bb6da[_0x9f7d('0x28')]['channel']=_0x2bb6da[_0x9f7d('0x77')];_0x2bb6da['message'][_0x9f7d('0x78')]=_0x2bb6da[_0x9f7d('0x77')];_0x2bb6da[_0x9f7d('0x28')][_0x9f7d('0x79')]=_0x9f7d('0x7a');return respondWithRpcPromise(_0x9f7d('0x7b'),'EventManager',{'event':_0x9f7d('0x7c'),'message':_0x2bb6da[_0x9f7d('0x28')]},client9002)[_0x9f7d('0x21')](function(){return _0x2bb6da;});}return _0x2bb6da;}return null;})[_0x9f7d('0x21')](respondWithResult(_0x117535,null))['catch'](handleError(_0x117535,null));};var interaction_log=require('../../config/logger')(_0x9f7d('0x5b'));exports[_0x9f7d('0x33')]=function(_0x553682,_0x510fc0,_0x2ca92e){var _0x58c293={'agent':{},'channel':_0x9f7d('0x5c')};if(_0x553682['body']['id']){delete _0x553682[_0x9f7d('0x58')]['id'];}_0x553682[_0x9f7d('0x58')][_0x9f7d('0x5f')]=_0x553682[_0x9f7d('0x58')][_0x9f7d('0x5f')]||_0x553682[_0x9f7d('0x60')]['id'];_0x58c293['agent']['id']=_0x553682[_0x9f7d('0x58')][_0x9f7d('0x5f')];return db[_0x9f7d('0x3a')][_0x9f7d('0x56')]({'where':{'id':_0x553682[_0x9f7d('0x59')]['id'],'UserId':null}})[_0x9f7d('0x21')](handleEntityNotFound(_0x510fc0,null))[_0x9f7d('0x21')](function(_0x2b15f5){if(_0x2b15f5){_0x58c293['message']=_0x2b15f5[_0x9f7d('0x62')]({'plain':!![]});return db[_0x9f7d('0x7d')][_0x9f7d('0x56')]({'where':{'id':_0x2b15f5['SmsInteractionId']}});}return null;})[_0x9f7d('0x21')](handleEntityNotFound(_0x510fc0,null))['then'](function(_0x3d78e5){if(_0x3d78e5){_0x58c293['interaction']=_0x3d78e5['get']({'plain':!![]});interaction_log[_0x9f7d('0x22')](_0x9f7d('0x7e'),_0x553682['user']['id'],_0x553682[_0x9f7d('0x60')][_0x9f7d('0x37')],_0x553682['user'][_0x9f7d('0x67')],_0x58c293[_0x9f7d('0x65')]['id'],_0x553682[_0x9f7d('0x58')]?JSON[_0x9f7d('0x68')](_0x553682[_0x9f7d('0x58')]):_0x9f7d('0x69'));return respondWithRpcPromise('RejectMessage',_0x9f7d('0x7f'),_0x58c293);}return null;})[_0x9f7d('0x21')](function(_0x1dbb30){var _0x27f596=_0x9f7d('0x80')+_0x1dbb30[_0x9f7d('0x28')]['ContactId'];return db[_0x9f7d('0x6d')][_0x9f7d('0x41')](_0x27f596,{'type':db[_0x9f7d('0x81')][_0x9f7d('0x6e')][_0x9f7d('0x6f')],'raw':!![]})['then'](function(_0x599ee5){return _0x599ee5;});})[_0x9f7d('0x21')](function(_0x1ac404){if(_0x1ac404){_0x58c293['message']['contact']=_0x1ac404[0x0];if(!_0x553682[_0x9f7d('0x58')][_0x9f7d('0x5f')])return;return db[_0x9f7d('0x71')]['find']({'where':{'id':_0x553682[_0x9f7d('0x58')][_0x9f7d('0x5f')],'role':_0x9f7d('0x61')},'attributes':['id',_0x9f7d('0x37'),_0x9f7d('0x82'),_0x9f7d('0x72'),_0x9f7d('0x73')],'raw':!![]});}return null;})[_0x9f7d('0x21')](function(_0x18781e){if(!_0x18781e)return null;_0x58c293[_0x9f7d('0x28')]['agent']=_0x18781e;return _0x58c293;})[_0x9f7d('0x21')](function(_0xe0695){if(_0xe0695){_0xe0695[_0x9f7d('0x28')][_0x9f7d('0x75')]=util[_0x9f7d('0x76')](_0x9f7d('0x83'),_0x553682[_0x9f7d('0x60')]['name']);_0xe0695['message'][_0x9f7d('0x77')]=_0x58c293[_0x9f7d('0x77')];_0xe0695[_0x9f7d('0x28')][_0x9f7d('0x78')]=_0x58c293[_0x9f7d('0x77')];_0xe0695[_0x9f7d('0x28')][_0x9f7d('0x79')]=_0x9f7d('0x33');respondWithRpcPromise(_0x9f7d('0x7b'),_0x9f7d('0x7b'),{'event':_0x9f7d('0x84'),'message':_0xe0695[_0x9f7d('0x28')]},client9002);return _0x58c293;}return null;})[_0x9f7d('0x21')](respondWithResult(_0x510fc0,null))[_0x9f7d('0x50')](handleError(_0x510fc0,null));};exports[_0x9f7d('0x29')]=function(_0xd42acc,_0x235fd2,_0x559a6f){if(_0xd42acc['body']['id']){delete _0xd42acc[_0x9f7d('0x58')]['id'];}var _0x2a8e66;return db[_0x9f7d('0x3a')][_0x9f7d('0x56')]({'where':{'id':_0xd42acc[_0x9f7d('0x59')]['id']}})['then'](handleEntityNotFound(_0x235fd2,null))[_0x9f7d('0x21')](function(_0x423343){if(_0x423343){_0x2a8e66=_0x423343;return db[_0x9f7d('0x85')][_0x9f7d('0x56')]({'where':{'id':_0x423343['SmsAccountId']}});}})[_0x9f7d('0x21')](handleEntityNotFound(_0x235fd2,null))['then'](function(_0x51252a){if(_0x51252a){logger[_0x9f7d('0x86')](_0x9f7d('0x25'),_0x9f7d('0x29'),'received\x20delivery\x20report\x20from',_0x51252a['type'],util[_0x9f7d('0x87')](_0xd42acc[_0x9f7d('0x58')],{'showHidden':![],'depth':null}));switch(_0x51252a[_0x9f7d('0x3d')]){case'twilio':if(_0xd42acc[_0x9f7d('0x58')][_0x9f7d('0x88')]&&_0xd42acc[_0x9f7d('0x58')]['MessageSid']===_0x2a8e66[_0x9f7d('0x89')]){return _0x2a8e66[_0x9f7d('0x35')]({'read':!![]});}else{logger[_0x9f7d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9f7d('0x29'),_0x9f7d('0x8a'),util[_0x9f7d('0x87')](_0xd42acc[_0x9f7d('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9f7d('0x8b'):if(_0xd42acc['body'][_0x9f7d('0x8c')]&&_0xd42acc['body'][_0x9f7d('0x8c')]===_0x2a8e66[_0x9f7d('0x89')]&&_[_0x9f7d('0x8d')]([_0x9f7d('0x8e'),_0x9f7d('0x8f')],_0xd42acc[_0x9f7d('0x58')][_0x9f7d('0x90')])>=0x0){return _0x2a8e66[_0x9f7d('0x35')]({'read':!![]});}else{logger[_0x9f7d('0x27')](_0x9f7d('0x91'),_0x9f7d('0x29'),_0x9f7d('0x92'),util[_0x9f7d('0x87')](_0xd42acc[_0x9f7d('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9f7d('0x93'):var _0x16bd6a=_0xd42acc['body']['results'][0x0];if(_0x16bd6a[_0x9f7d('0x29')][_0x9f7d('0x94')]===_0x9f7d('0x95')){return _0x2a8e66[_0x9f7d('0x35')]({'read':!![]});}else{logger['error'](_0x9f7d('0x91'),_0x9f7d('0x29'),'infobip',util[_0x9f7d('0x87')](_0xd42acc['body'],{'showHidden':![],'depth':null}));}break;}return _0x2a8e66;}})[_0x9f7d('0x21')](respondWithResult(_0x235fd2,null))[_0x9f7d('0x50')](handleError(_0x235fd2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c913d8e..bc0ae40 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 _0x2891=['events','../../mysqldb','SmsMessage','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x2891,0x128));var _0x1289=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2891[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1289('0x0'));var SmsMessage=require(_0x1289('0x1'))['db'][_0x1289('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1289('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc6a3d){return function(_0x42ec3b,_0x1a4e3e,_0x1c06ac){SmsMessageEvents[_0x1289('0x4')](_0xc6a3d+':'+_0x42ec3b['id'],_0x42ec3b);SmsMessageEvents[_0x1289('0x4')](_0xc6a3d,_0x42ec3b);_0x1c06ac(null);};}for(var e in events){if(events[_0x1289('0x5')](e)){var event=events[e];SmsMessage[_0x1289('0x6')](e,emitEvent(event));}}module[_0x1289('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xb0bd=['emit','hasOwnProperty','hook','SmsMessage','setMaxListeners','update','remove'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xb0bd,0x184));var _0xdb0b=function(_0x1c9c6e,_0xefb7ab){_0x1c9c6e=_0x1c9c6e-0x0;var _0x537127=_0xb0bd[_0x1c9c6e];return _0x537127;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xdb0b('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdb0b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb0b('0x2'),'afterDestroy':_0xdb0b('0x3')};function emitEvent(_0x4ff55a){return function(_0x30b6ad,_0x140b60,_0x5a910c){SmsMessageEvents[_0xdb0b('0x4')](_0x4ff55a+':'+_0x30b6ad['id'],_0x30b6ad);SmsMessageEvents[_0xdb0b('0x4')](_0x4ff55a,_0x30b6ad);_0x5a910c(null);};}for(var e in events){if(events[_0xdb0b('0x5')](e)){var event=events[e];SmsMessage[_0xdb0b('0x6')](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 d61e6f2..dfb57b9 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 _0x5e65=['FULLTEXT','models','direction','toLowerCase','out','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','error','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/status?token=','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','Bearer\x20','refid','status','message','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body'];(function(_0x3c0c92,_0x267969){var _0xe3859b=function(_0x4d38f2){while(--_0x4d38f2){_0x3c0c92['push'](_0x3c0c92['shift']());}};_0xe3859b(++_0x267969);}(_0x5e65,0x6c));var _0x55e6=function(_0x2bb423,_0x7e7cf5){_0x2bb423=_0x2bb423-0x0;var _0x1679ca=_0x5e65[_0x2bb423];return _0x1679ca;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var logger=require(_0x55e6('0x2'))(_0x55e6('0x3'));var moment=require('moment');var BPromise=require(_0x55e6('0x4'));var rp=require(_0x55e6('0x5'));var fs=require('fs');var path=require(_0x55e6('0x6'));var rimraf=require('rimraf');var config=require(_0x55e6('0x7'));var attributes=require(_0x55e6('0x8'));module[_0x55e6('0x9')]=function(_0x18ed76,_0x163cd6){return _0x18ed76[_0x55e6('0xa')](_0x55e6('0xb'),attributes,{'tableName':_0x55e6('0xc'),'paranoid':![],'indexes':[{'name':_0x55e6('0xd'),'fields':[_0x55e6('0xd')]},{'name':_0x55e6('0xe'),'fields':[_0x55e6('0xf')],'type':_0x55e6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a449b,_0x126e50,_0x1e3ab2){var _0x38d462=_0x18ed76[_0x55e6('0x11')];var _0x144acd=_0x5a449b['get']({'plain':!![]});if(_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()==='in'||_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()===_0x55e6('0x14')&&!_0x144acd['secret']&&!_['isNil'](_0x144acd[_0x55e6('0x15')])&&!_[_0x55e6('0x16')](_0x144acd[_0x55e6('0x17')])){_0x38d462[_0x55e6('0x18')][_0x55e6('0x19')]({'where':{'id':_0x144acd[_0x55e6('0x17')]}})['then'](function(_0x23f2fc){if(_0x23f2fc){_0x23f2fc[_0x55e6('0x1a')]({'lastMsgAt':_0x144acd[_0x55e6('0x1b')],'lastMsgDirection':_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()});}})['catch'](function(_0x2d57ee){console[_0x55e6('0x1c')](_0x2d57ee);});}if(_0x144acd[_0x55e6('0x12')]===_0x55e6('0x14')&&!_0x144acd[_0x55e6('0x1d')]){var _0x1d3826;_0x38d462[_0x55e6('0x1e')][_0x55e6('0x1f')]({'where':{'id':_0x144acd[_0x55e6('0x20')]},'raw':!![]})[_0x55e6('0x21')](function(_0x4183f8){_0x1d3826=_0x4183f8;if(_0x1d3826&&_0x1d3826[_0x55e6('0x22')]){switch(_0x1d3826['type']){case _0x55e6('0x23'):var _0x1a75de=require(_0x55e6('0x23'));if(_0x1d3826[_0x55e6('0x24')]&&_0x1d3826[_0x55e6('0x25')]&&_0x1d3826[_0x55e6('0x26')]){var _0x1e1d9f=new _0x1a75de(_0x1d3826[_0x55e6('0x24')],_0x1d3826['authToken']);_0x1e1d9f[_0x55e6('0x27')]['create']({'body':_0x144acd[_0x55e6('0xf')],'to':_0x144acd[_0x55e6('0x26')],'from':_0x1d3826['phone'],'statusCallback':_0x1d3826['remote']+_0x55e6('0x28')+_0x144acd['id']+'/status?token='+_0x1d3826[_0x55e6('0x29')]})['then'](function(_0x416af6){if(_0x416af6[_0x55e6('0x2a')]){return _0x5a449b[_0x55e6('0x1a')]({'messageId':_0x416af6[_0x55e6('0x2a')]});}})[_0x55e6('0x2b')](function(_0x22afc8){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x23'),util[_0x55e6('0x2e')](_0x22afc8,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate','twilio',_0x55e6('0x2f'));}break;case _0x55e6('0x30'):var _0x512afb=_0x55e6('0x31');if(_0x1d3826['username']&&_0x1d3826[_0x55e6('0x32')]){var _0x1153bf={'recipient':[_0x144acd[_0x55e6('0x26')]],'message':_0x144acd['body'],'message_type':_0x1d3826['smsMethod']};if(_0x1d3826[_0x55e6('0x33')]&&_0x1d3826[_0x55e6('0x33')]!=='SI'){_0x1153bf[_0x55e6('0x34')]=_0x1d3826[_0x55e6('0x26')];}var _0x32cb2d={'url':_0x512afb+_0x55e6('0x35')+_0x1d3826[_0x55e6('0x36')]+_0x55e6('0x37')+_0x1d3826[_0x55e6('0x32')],'method':_0x55e6('0x38')};rp(_0x32cb2d)['then'](function(_0x118c0e){var _0x168b82=_0x118c0e[_0x55e6('0x39')](';');var _0xab289={'user_key':_0x168b82[0x0],'session_key':_0x168b82[0x1]};_0x32cb2d={'url':_0x512afb+_0x55e6('0x3a'),'method':_0x55e6('0x3b'),'headers':{'user_key':_0xab289[_0x55e6('0x3c')],'Session_key':_0xab289['session_key']},'json':!![],'body':_0x1153bf};return rp(_0x32cb2d);})[_0x55e6('0x21')](function(_0xbf83a1){if(_0xbf83a1[_0x55e6('0x3d')]>=0x1){var _0x4c5fe3={'messageId':_0xbf83a1[_0x55e6('0x3e')]};if(_0x1d3826['smsMethod']!=='GP'||!_0x1d3826['deliveryReport']){_0x4c5fe3[_0x55e6('0x3f')]=!![];}return _0x5a449b['update'](_0x4c5fe3);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x30'),util[_0x55e6('0x2e')](_0xbf83a1,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x2ec450){return logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),'skebby',util[_0x55e6('0x2e')](_0x2ec450,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x30'),_0x55e6('0x40'));}break;case _0x55e6('0x41'):if(_0x1d3826[_0x55e6('0x25')]){var _0x119e4f={'recipient':_0x144acd['phone'],'message':_0x144acd['body'],'sender':_0x1d3826[_0x55e6('0x42')]||_0x1d3826['phone'],'authorization':_0x1d3826[_0x55e6('0x25')]};var _0x126e50={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x43'),'body':_0x119e4f,'json':!![]};rp(_0x126e50)[_0x55e6('0x21')](function(_0x25baac){var _0x3339ff={'messageId':_0x25baac[_0x55e6('0x44')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x3339ff[_0x55e6('0x3f')]=!![];}return _0x5a449b['update'](_0x3339ff);})['catch'](function(_0x18bd02){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'connectel',util['inspect'](_0x18bd02,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x55e6('0x46'):if(_0x1d3826['username']&&_0x1d3826[_0x55e6('0x32')]){var _0x119e4f={'messages':[{'source':_0x55e6('0x47'),'to':_0x144acd[_0x55e6('0x26')],'body':_0x144acd[_0x55e6('0xf')],'from':_0x1d3826[_0x55e6('0x42')]||_0x1d3826[_0x55e6('0x26')]}]};var _0x59a7e3=util[_0x55e6('0x48')](_0x55e6('0x49'),_0x1d3826['username'],_0x1d3826[_0x55e6('0x32')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x119e4f,'headers':{'Authorization':util[_0x55e6('0x48')]('Basic\x20%s',new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)[_0x55e6('0x21')](function(_0x117b6e){if(_0x117b6e[_0x55e6('0x4c')]>=0xc8&&_0x117b6e['http_code']<=0xce){if(_0x117b6e[_0x55e6('0x4d')]&&_0x117b6e[_0x55e6('0x4d')][_0x55e6('0x4e')]>0x0){var _0x3f44a3=_[_0x55e6('0x4f')](_0x117b6e[_0x55e6('0x4d')][_0x55e6('0x27')]);var _0x13dc65={'messageId':_0x3f44a3['message_id']};if(!_0x1d3826[_0x55e6('0x45')]){_0x13dc65[_0x55e6('0x3f')]=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x13dc65);}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),util['inspect'](_0x117b6e,{'showHidden':![],'depth':null}));}}else{logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x55e6('0x50'),util[_0x55e6('0x2e')](_0x117b6e,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0xee9ed2){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),util[_0x55e6('0x2e')](_0xee9ed2,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),_0x55e6('0x40'));}break;case _0x55e6('0x51'):if(_0x1d3826[_0x55e6('0x52')]&&_0x1d3826[_0x55e6('0x25')]){var _0x119e4f={'dst':_0x144acd['phone'],'text':_0x144acd[_0x55e6('0xf')],'src':_0x1d3826[_0x55e6('0x42')]||_0x1d3826[_0x55e6('0x26')],'url':_0x1d3826['remote']+'/api/sms/messages/'+_0x144acd['id']+_0x55e6('0x53')+_0x1d3826[_0x55e6('0x29')]};var _0x59a7e3=util[_0x55e6('0x48')](_0x55e6('0x49'),_0x1d3826[_0x55e6('0x52')],_0x1d3826[_0x55e6('0x25')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':util[_0x55e6('0x48')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1d3826[_0x55e6('0x52')]),'body':_0x119e4f,'headers':{'Authorization':util[_0x55e6('0x48')](_0x55e6('0x54'),new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)['then'](function(_0x104860){var _0x24ffbb={'messageId':_0x104860[_0x55e6('0x55')][0x0]};return _0x5a449b[_0x55e6('0x1a')](_0x24ffbb);})[_0x55e6('0x2b')](function(_0x4fc2cf){logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x51'),util[_0x55e6('0x2e')](_0x4fc2cf,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x51'),_0x55e6('0x56'));}break;case _0x55e6('0x57'):if(_0x1d3826[_0x55e6('0x36')]&&_0x1d3826['password']){if(_0x1d3826[_0x55e6('0x58')]){var _0x6b2657={'method':_0x55e6('0x3b'),'uri':_0x1d3826['baseUrl']+'/auth/1/session','body':{'username':_0x1d3826[_0x55e6('0x36')],'password':_0x1d3826[_0x55e6('0x32')]},'json':!![]};return rp(_0x6b2657)[_0x55e6('0x21')](function(_0x19a54d){var _0x1b41f2={'method':'POST','uri':_0x1d3826[_0x55e6('0x58')]+_0x55e6('0x59'),'body':{'messages':[{'from':_0x1d3826[_0x55e6('0x26')],'destinations':[{'to':_0x144acd[_0x55e6('0x26')]}],'text':_0x144acd[_0x55e6('0xf')],'notifyUrl':_0x1d3826[_0x55e6('0x5a')]+_0x55e6('0x28')+_0x144acd['id']+_0x55e6('0x53')+_0x1d3826[_0x55e6('0x29')],'notifyContentType':_0x55e6('0x5b'),'callbackData':_0x1d3826[_0x55e6('0x26')]+';'+_0x144acd[_0x55e6('0xf')]}]},'headers':{'Authorization':_0x55e6('0x5c')+_0x19a54d['token']},'json':!![]};return rp(_0x1b41f2)[_0x55e6('0x21')](function(_0x45da89){if(_0x45da89[_0x55e6('0x27')]){var _0x23c41f={'messageId':_0x45da89[_0x55e6('0x27')][0x0][_0x55e6('0xd')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x23c41f['read']=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x23c41f);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),util[_0x55e6('0x2e')](_0x45da89,{'showHidden':![],'depth':null}));}});})[_0x55e6('0x2b')](function(_0x164d90){return logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),util[_0x55e6('0x2e')](_0x164d90,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x57'),_0x55e6('0x5d'));}}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),_0x55e6('0x40'));}break;case _0x55e6('0x5e'):var _0x457d18=require(_0x55e6('0x5f'));if(_0x1d3826[_0x55e6('0x60')]){var _0xa364d3={};_0xa364d3[_0x55e6('0x61')]=_0x1d3826[_0x55e6('0x36')];_0xa364d3[_0x55e6('0x26')]=_0x144acd[_0x55e6('0x26')];_0xa364d3[_0x55e6('0x34')]=_0x1d3826[_0x55e6('0x26')];_0xa364d3[_0x55e6('0x62')]=_0x144acd[_0x55e6('0xf')];_0xa364d3[_0x55e6('0x63')]=+new Date();var _0x10adfe='';var _0x41a6e8='';var _0x1ef238=Object[_0x55e6('0x64')](_0xa364d3);_0x1ef238[_0x55e6('0x65')]();for(var _0x4944a4=0x0;_0x4944a4<_0x1ef238[_0x55e6('0x66')];_0x4944a4++){if(_0x10adfe!=''){_0x10adfe+='&';}_0x10adfe+=_0x1ef238[_0x4944a4]+'='+encodeURIComponent(_0xa364d3[_0x1ef238[_0x4944a4]]);_0x41a6e8+=_0xa364d3[_0x1ef238[_0x4944a4]];}_0x41a6e8+=_0x1d3826[_0x55e6('0x60')];_0x41a6e8=_0x457d18[_0x55e6('0x67')](_0x55e6('0x68'))[_0x55e6('0x1a')](_0x41a6e8)[_0x55e6('0x69')]('hex');if(_0x10adfe!==''){_0x10adfe+='&';}_0x10adfe+=_0x55e6('0x6a')+_0x41a6e8;var _0x32cb2d={'method':_0x55e6('0x38'),'uri':_0x1d3826[_0x55e6('0x58')]+_0x55e6('0x6b')+_0x10adfe,'json':!![]};return rp(_0x32cb2d)[_0x55e6('0x21')](function(_0x196cbd){var _0x5cddff=Object[_0x55e6('0x64')](_0x196cbd);if(_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x1c')]&&parseInt(_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x1c')])===0x0){var _0x425d9f={'messageId':_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x6c')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x425d9f['read']=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x425d9f);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x5e'),util['inspect'](_0x196cbd[_0x55e6('0x1c')],{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x6027ac){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x5e'),util[_0x55e6('0x2e')](_0x6027ac,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),_0x55e6('0x5e'),_0x55e6('0x6d'));}break;case'clickatell':if(_0x1d3826[_0x55e6('0x60')]){var _0x5b0983={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x6e'),'headers':{'Authorization':_0x1d3826[_0x55e6('0x60')]},'body':{'content':_0x144acd[_0x55e6('0xf')],'to':[_0x144acd['phone']],'from':_0x1d3826[_0x55e6('0x26')],'binary':![],'clientMessageId':_0x55e6('0x6f'),'charset':'UTF-8'},'json':!![]};rp(_0x5b0983)['then'](function(_0x463599){if(!_0x463599[_0x55e6('0x1c')]){var _0x46333a={'messageId':_0x463599[_0x55e6('0x27')][0x0]['apiMessageId']};if(!_0x1d3826[_0x55e6('0x45')]){_0x46333a['read']=!![];}return _0x5a449b['update'](_0x46333a);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x70'),util[_0x55e6('0x2e')](_0x463599['error'],{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x4d966e){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x70'),util[_0x55e6('0x2e')](_0x4d966e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x70'),_0x55e6('0x6d'));}break;case'bandwidth':if(_0x1d3826[_0x55e6('0x36')]&&_0x1d3826[_0x55e6('0x32')]){var _0x59a7e3=util['format'](_0x55e6('0x49'),_0x1d3826['username'],_0x1d3826[_0x55e6('0x32')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1d3826['accountId']+'/messages','body':{'to':[_0x144acd[_0x55e6('0x26')]],'text':_0x144acd[_0x55e6('0xf')],'from':_0x1d3826[_0x55e6('0x26')],'applicationId':_0x1d3826['applicationId']},'headers':{'Authorization':util[_0x55e6('0x48')](_0x55e6('0x54'),new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)['then'](function(_0x3865f9){if(_0x3865f9['id']){var _0x554395={'messageId':_0x3865f9['id']};return _0x5a449b[_0x55e6('0x1a')](_0x554395);}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x71'),util[_0x55e6('0x2e')](_0x3865f9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3278c0){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate','bandwidth',util['inspect'](_0x3278c0,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x71'),_0x55e6('0x40'));}break;case _0x55e6('0x72'):if(_0x1d3826['apiKey']){var _0x9311d2={};var _0x32cb2d={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x1d3826[_0x55e6('0x60')],'Content-Type':_0x55e6('0x5b')},'body':{'from':_0x1d3826['phone'],'to':_0x144acd[_0x55e6('0x26')],'text':_0x144acd[_0x55e6('0xf')]},'json':!![]};return rp(_0x32cb2d)[_0x55e6('0x21')](function(_0x14a061){if(_0x14a061[_0x55e6('0x74')]==0xca){_0x9311d2['message']=_0x14a061;var _0x1c9390={'method':_0x55e6('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x55e6('0x75')+_0x1d3826[_0x55e6('0x60')],'Content-Type':'application/json'},'body':{'refid':_0x9311d2['message'][_0x55e6('0x76')]},'json':!![]};return rp(_0x1c9390)['then'](function(_0x53cb45){_0x9311d2[_0x55e6('0x77')]=_0x53cb45;var _0x536eea={'messageId':_0x9311d2[_0x55e6('0x78')]['refid'],'read':!![]};return _0x5a449b['update'](_0x536eea);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),_0x55e6('0x72'),util[_0x55e6('0x2e')](_0x14a061,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x2b3d81){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'intelepeer',util['inspect'](_0x2b3d81,{'showHidden':![],'depth':null}));});}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x72'),_0x55e6('0x79'));}break;}}})[_0x55e6('0x7a')](function(){_0x1e3ab2();});}else{_0x1e3ab2();}}},'charset':_0x55e6('0x7b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8060=['authId','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','timestamp','keys','apiKey','md5','hex','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','error','find','then','type','twilio','authToken','phone','accountSid','create','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','messages','message_id','update','clickSend','plivo'];(function(_0x51a417,_0x11fd46){var _0xf66ecd=function(_0x5a5bac){while(--_0x5a5bac){_0x51a417['push'](_0x51a417['shift']());}};_0xf66ecd(++_0x11fd46);}(_0x8060,0x125));var _0x0806=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x8060[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0x0806('0x0'));var util=require(_0x0806('0x1'));var logger=require(_0x0806('0x2'))(_0x0806('0x3'));var moment=require(_0x0806('0x4'));var BPromise=require(_0x0806('0x5'));var rp=require(_0x0806('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0806('0x7'));var config=require(_0x0806('0x8'));var attributes=require(_0x0806('0x9'));module[_0x0806('0xa')]=function(_0x1d4545,_0x5296fb){return _0x1d4545[_0x0806('0xb')](_0x0806('0xc'),attributes,{'tableName':_0x0806('0xd'),'paranoid':![],'indexes':[{'name':_0x0806('0xe'),'fields':['messageId']},{'name':_0x0806('0xf'),'fields':[_0x0806('0x10')],'type':_0x0806('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e8dd4,_0x325e79,_0x15ee7d){var _0x435ac5=_0x1d4545[_0x0806('0x12')];var _0x505371=_0x5e8dd4[_0x0806('0x13')]({'plain':!![]});if(_0x505371[_0x0806('0x14')][_0x0806('0x15')]()==='in'||_0x505371[_0x0806('0x14')][_0x0806('0x15')]()===_0x0806('0x16')&&!_0x505371[_0x0806('0x17')]&&!_[_0x0806('0x18')](_0x505371[_0x0806('0x19')])&&!_[_0x0806('0x18')](_0x505371[_0x0806('0x1a')])){_0x435ac5[_0x0806('0x1b')][_0x0806('0x1c')]({'where':{'id':_0x505371[_0x0806('0x1a')]}})['then'](function(_0x7ecd54){if(_0x7ecd54){_0x7ecd54['update']({'lastMsgAt':_0x505371[_0x0806('0x1d')],'lastMsgDirection':_0x505371[_0x0806('0x14')]['toLowerCase']()});}})['catch'](function(_0x3e7143){console[_0x0806('0x1e')](_0x3e7143);});}if(_0x505371[_0x0806('0x14')]===_0x0806('0x16')&&!_0x505371[_0x0806('0x17')]){var _0x35233c;_0x435ac5['SmsAccount'][_0x0806('0x1f')]({'where':{'id':_0x505371['SmsAccountId']},'raw':!![]})[_0x0806('0x20')](function(_0x141ce5){_0x35233c=_0x141ce5;if(_0x35233c&&_0x35233c[_0x0806('0x21')]){switch(_0x35233c[_0x0806('0x21')]){case _0x0806('0x22'):var _0x3591e5=require(_0x0806('0x22'));if(_0x35233c['accountSid']&&_0x35233c[_0x0806('0x23')]&&_0x35233c[_0x0806('0x24')]){var _0x2fe85f=new _0x3591e5(_0x35233c[_0x0806('0x25')],_0x35233c[_0x0806('0x23')]);_0x2fe85f['messages'][_0x0806('0x26')]({'body':_0x505371[_0x0806('0x10')],'to':_0x505371['phone'],'from':_0x35233c[_0x0806('0x24')],'statusCallback':_0x35233c['remote']+'/api/sms/messages/'+_0x505371['id']+_0x0806('0x27')+_0x35233c[_0x0806('0x28')]})['then'](function(_0x1a1580){if(_0x1a1580[_0x0806('0x29')]){return _0x5e8dd4['update']({'messageId':_0x1a1580['sid']});}})[_0x0806('0x2a')](function(_0x528c0d){logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x22'),util[_0x0806('0x2d')](_0x528c0d,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0806('0x2c'),_0x0806('0x22'),_0x0806('0x2e'));}break;case _0x0806('0x2f'):var _0x41537e=_0x0806('0x30');if(_0x35233c[_0x0806('0x31')]&&_0x35233c[_0x0806('0x32')]){var _0x217094={'recipient':[_0x505371[_0x0806('0x24')]],'message':_0x505371[_0x0806('0x10')],'message_type':_0x35233c['smsMethod']};if(_0x35233c[_0x0806('0x33')]&&_0x35233c[_0x0806('0x33')]!=='SI'){_0x217094[_0x0806('0x34')]=_0x35233c[_0x0806('0x24')];}var _0x498046={'url':_0x41537e+_0x0806('0x35')+_0x35233c[_0x0806('0x31')]+_0x0806('0x36')+_0x35233c[_0x0806('0x32')],'method':_0x0806('0x37')};rp(_0x498046)['then'](function(_0x220601){var _0xc053a8=_0x220601['split'](';');var _0x2828ca={'user_key':_0xc053a8[0x0],'session_key':_0xc053a8[0x1]};_0x498046={'url':_0x41537e+_0x0806('0x38'),'method':_0x0806('0x39'),'headers':{'user_key':_0x2828ca[_0x0806('0x3a')],'Session_key':_0x2828ca[_0x0806('0x3b')]},'json':!![],'body':_0x217094};return rp(_0x498046);})[_0x0806('0x20')](function(_0xcf4c67){if(_0xcf4c67[_0x0806('0x3c')]>=0x1){var _0x226b70={'messageId':_0xcf4c67[_0x0806('0x3d')]};if(_0x35233c[_0x0806('0x33')]!=='GP'||!_0x35233c[_0x0806('0x3e')]){_0x226b70[_0x0806('0x3f')]=!![];}return _0x5e8dd4['update'](_0x226b70);}else{return logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x2f'),util[_0x0806('0x2d')](_0xcf4c67,{'showHidden':![],'depth':null}));}})[_0x0806('0x2a')](function(_0x54d998){return logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x2f'),util['inspect'](_0x54d998,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x2f'),_0x0806('0x40'));}break;case _0x0806('0x41'):if(_0x35233c[_0x0806('0x23')]){var _0x4b4add={'recipient':_0x505371[_0x0806('0x24')],'message':_0x505371[_0x0806('0x10')],'sender':_0x35233c[_0x0806('0x42')]||_0x35233c[_0x0806('0x24')],'authorization':_0x35233c[_0x0806('0x23')]};var _0x325e79={'method':'POST','uri':_0x0806('0x43'),'body':_0x4b4add,'json':!![]};rp(_0x325e79)['then'](function(_0x56d996){var _0x38a000={'messageId':_0x56d996[_0x0806('0x44')]};if(!_0x35233c[_0x0806('0x3e')]){_0x38a000[_0x0806('0x3f')]=!![];}return _0x5e8dd4['update'](_0x38a000);})[_0x0806('0x2a')](function(_0x4c76ce){logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x41'),util[_0x0806('0x2d')](_0x4c76ce,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate','connectel',_0x0806('0x45'));}break;case _0x0806('0x46'):if(_0x35233c[_0x0806('0x31')]&&_0x35233c['password']){var _0x4b4add={'messages':[{'source':_0x0806('0x47'),'to':_0x505371[_0x0806('0x24')],'body':_0x505371[_0x0806('0x10')],'from':_0x35233c['senderString']||_0x35233c[_0x0806('0x24')]}]};var _0x1d348e=util[_0x0806('0x48')](_0x0806('0x49'),_0x35233c[_0x0806('0x31')],_0x35233c[_0x0806('0x32')]);var _0x325e79={'method':_0x0806('0x39'),'uri':_0x0806('0x4a'),'body':_0x4b4add,'headers':{'Authorization':util[_0x0806('0x48')](_0x0806('0x4b'),new Buffer(_0x1d348e)[_0x0806('0x4c')]('base64'))},'json':!![]};rp(_0x325e79)[_0x0806('0x20')](function(_0x20bdf7){if(_0x20bdf7['http_code']>=0xc8&&_0x20bdf7[_0x0806('0x4d')]<=0xce){if(_0x20bdf7[_0x0806('0x4e')]&&_0x20bdf7[_0x0806('0x4e')][_0x0806('0x4f')]>0x0){var _0xf5688f=_['head'](_0x20bdf7[_0x0806('0x4e')][_0x0806('0x50')]);var _0x3633c6={'messageId':_0xf5688f[_0x0806('0x51')]};if(!_0x35233c[_0x0806('0x3e')]){_0x3633c6['read']=!![];}return _0x5e8dd4[_0x0806('0x52')](_0x3633c6);}else{logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0806('0x53'),util[_0x0806('0x2d')](_0x20bdf7,{'showHidden':![],'depth':null}));}}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),'clickSend',util[_0x0806('0x2d')](_0x20bdf7,{'showHidden':![],'depth':null}));}})[_0x0806('0x2a')](function(_0x425383){logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate',_0x0806('0x53'),util['inspect'](_0x425383,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate',_0x0806('0x53'),_0x0806('0x40'));}break;case _0x0806('0x54'):if(_0x35233c[_0x0806('0x55')]&&_0x35233c[_0x0806('0x23')]){var _0x4b4add={'dst':_0x505371[_0x0806('0x24')],'text':_0x505371[_0x0806('0x10')],'src':_0x35233c['senderString']||_0x35233c['phone'],'url':_0x35233c[_0x0806('0x56')]+_0x0806('0x57')+_0x505371['id']+_0x0806('0x27')+_0x35233c[_0x0806('0x28')]};var _0x1d348e=util[_0x0806('0x48')](_0x0806('0x49'),_0x35233c[_0x0806('0x55')],_0x35233c[_0x0806('0x23')]);var _0x325e79={'method':_0x0806('0x39'),'uri':util[_0x0806('0x48')](_0x0806('0x58'),_0x35233c['authId']),'body':_0x4b4add,'headers':{'Authorization':util['format'](_0x0806('0x4b'),new Buffer(_0x1d348e)[_0x0806('0x4c')](_0x0806('0x59')))},'json':!![]};rp(_0x325e79)['then'](function(_0xf4742b){var _0x595977={'messageId':_0xf4742b[_0x0806('0x5a')][0x0]};return _0x5e8dd4[_0x0806('0x52')](_0x595977);})[_0x0806('0x2a')](function(_0x23ba0b){logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate',_0x0806('0x54'),util['inspect'](_0x23ba0b,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate','plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x0806('0x5b'):if(_0x35233c[_0x0806('0x31')]&&_0x35233c[_0x0806('0x32')]){if(_0x35233c['baseUrl']){var _0x1b261f={'method':_0x0806('0x39'),'uri':_0x35233c[_0x0806('0x5c')]+_0x0806('0x5d'),'body':{'username':_0x35233c[_0x0806('0x31')],'password':_0x35233c[_0x0806('0x32')]},'json':!![]};return rp(_0x1b261f)[_0x0806('0x20')](function(_0x35f85a){var _0x2240ca={'method':'POST','uri':_0x35233c['baseUrl']+_0x0806('0x5e'),'body':{'messages':[{'from':_0x35233c[_0x0806('0x24')],'destinations':[{'to':_0x505371[_0x0806('0x24')]}],'text':_0x505371[_0x0806('0x10')],'notifyUrl':_0x35233c['remote']+_0x0806('0x57')+_0x505371['id']+'/status?token='+_0x35233c[_0x0806('0x28')],'notifyContentType':'application/json','callbackData':_0x35233c[_0x0806('0x24')]+';'+_0x505371[_0x0806('0x10')]}]},'headers':{'Authorization':_0x0806('0x5f')+_0x35f85a['token']},'json':!![]};return rp(_0x2240ca)[_0x0806('0x20')](function(_0x5b39d8){if(_0x5b39d8[_0x0806('0x50')]){var _0x383dfc={'messageId':_0x5b39d8[_0x0806('0x50')][0x0][_0x0806('0xe')]};if(!_0x35233c[_0x0806('0x3e')]){_0x383dfc[_0x0806('0x3f')]=!![];}return _0x5e8dd4[_0x0806('0x52')](_0x383dfc);}else{return logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x5b'),util[_0x0806('0x2d')](_0x5b39d8,{'showHidden':![],'depth':null}));}});})[_0x0806('0x2a')](function(_0x1a0b01){return logger['error'](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x5b'),util[_0x0806('0x2d')](_0x1a0b01,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0806('0x2c'),_0x0806('0x5b'),_0x0806('0x60'));}}else{logger['error'](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x5b'),_0x0806('0x40'));}break;case _0x0806('0x61'):var _0x932d85=require(_0x0806('0x62'));if(_0x35233c['apiKey']){var _0x3f6821={};_0x3f6821['login']=_0x35233c['username'];_0x3f6821[_0x0806('0x24')]=_0x505371[_0x0806('0x24')];_0x3f6821['sender']=_0x35233c[_0x0806('0x24')];_0x3f6821[_0x0806('0x63')]=_0x505371['body'];_0x3f6821[_0x0806('0x64')]=+new Date();var _0x17113b='';var _0x564a35='';var _0x178c56=Object[_0x0806('0x65')](_0x3f6821);_0x178c56['sort']();for(var _0x3ebf96=0x0;_0x3ebf96<_0x178c56['length'];_0x3ebf96++){if(_0x17113b!=''){_0x17113b+='&';}_0x17113b+=_0x178c56[_0x3ebf96]+'='+encodeURIComponent(_0x3f6821[_0x178c56[_0x3ebf96]]);_0x564a35+=_0x3f6821[_0x178c56[_0x3ebf96]];}_0x564a35+=_0x35233c[_0x0806('0x66')];_0x564a35=_0x932d85['createHash'](_0x0806('0x67'))[_0x0806('0x52')](_0x564a35)['digest'](_0x0806('0x68'));if(_0x17113b!==''){_0x17113b+='&';}_0x17113b+='signature='+_0x564a35;var _0x498046={'method':_0x0806('0x37'),'uri':_0x35233c[_0x0806('0x5c')]+'/external/get/send.php?'+_0x17113b,'json':!![]};return rp(_0x498046)[_0x0806('0x20')](function(_0x7bae8b){var _0x5a217b=Object[_0x0806('0x65')](_0x7bae8b);if(_0x7bae8b[_0x5a217b[0x0]]['error']&&parseInt(_0x7bae8b[_0x5a217b[0x0]][_0x0806('0x1e')])===0x0){var _0x105787={'messageId':_0x7bae8b[_0x5a217b[0x0]][_0x0806('0x69')]};if(!_0x35233c[_0x0806('0x3e')]){_0x105787['read']=!![];}return _0x5e8dd4[_0x0806('0x52')](_0x105787);}else{return logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0806('0x2c'),'csc',util[_0x0806('0x2d')](_0x7bae8b[_0x0806('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1463d3){return logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0806('0x2c'),_0x0806('0x61'),util[_0x0806('0x2d')](_0x1463d3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0806('0x61'),_0x0806('0x6a'));}break;case _0x0806('0x6b'):if(_0x35233c[_0x0806('0x66')]){var _0x51ff0c={'method':_0x0806('0x39'),'uri':_0x0806('0x6c'),'headers':{'Authorization':_0x35233c[_0x0806('0x66')]},'body':{'content':_0x505371[_0x0806('0x10')],'to':[_0x505371[_0x0806('0x24')]],'from':_0x35233c[_0x0806('0x24')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x51ff0c)[_0x0806('0x20')](function(_0x132ee3){if(!_0x132ee3[_0x0806('0x1e')]){var _0x261a12={'messageId':_0x132ee3[_0x0806('0x50')][0x0][_0x0806('0x6d')]};if(!_0x35233c[_0x0806('0x3e')]){_0x261a12[_0x0806('0x3f')]=!![];}return _0x5e8dd4[_0x0806('0x52')](_0x261a12);}else{return logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0806('0x6b'),util['inspect'](_0x132ee3['error'],{'showHidden':![],'depth':null}));}})[_0x0806('0x2a')](function(_0x51005c){return logger[_0x0806('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0806('0x2c'),'clickatell',util[_0x0806('0x2d')](_0x51005c,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),'clickatell',_0x0806('0x6a'));}break;case _0x0806('0x6e'):if(_0x35233c[_0x0806('0x31')]&&_0x35233c[_0x0806('0x32')]){var _0x1d348e=util[_0x0806('0x48')]('%s:%s',_0x35233c[_0x0806('0x31')],_0x35233c[_0x0806('0x32')]);var _0x325e79={'method':'POST','uri':_0x0806('0x6f')+_0x35233c[_0x0806('0x70')]+_0x0806('0x71'),'body':{'to':[_0x505371[_0x0806('0x24')]],'text':_0x505371[_0x0806('0x10')],'from':_0x35233c[_0x0806('0x24')],'applicationId':_0x35233c[_0x0806('0x72')]},'headers':{'Authorization':util[_0x0806('0x48')](_0x0806('0x4b'),new Buffer(_0x1d348e)[_0x0806('0x4c')](_0x0806('0x59')))},'json':!![]};rp(_0x325e79)[_0x0806('0x20')](function(_0x54f55f){if(_0x54f55f['id']){var _0x280174={'messageId':_0x54f55f['id']};return _0x5e8dd4['update'](_0x280174);}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate',_0x0806('0x6e'),util['inspect'](_0x54f55f,{'showHidden':![],'depth':null}));}})[_0x0806('0x2a')](function(_0x26a8eb){logger['error'](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x6e'),util[_0x0806('0x2d')](_0x26a8eb,{'showHidden':![],'depth':null}));});}else{logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x6e'),_0x0806('0x40'));}break;case'intelepeer':if(_0x35233c['apiKey']){var _0x719379={};var _0x498046={'method':_0x0806('0x39'),'uri':_0x0806('0x73'),'headers':{'Authorization':_0x0806('0x74')+_0x35233c['apiKey'],'Content-Type':_0x0806('0x75')},'body':{'from':_0x35233c[_0x0806('0x24')],'to':_0x505371[_0x0806('0x24')],'text':_0x505371[_0x0806('0x10')]},'json':!![]};return rp(_0x498046)[_0x0806('0x20')](function(_0x1a8117){if(_0x1a8117[_0x0806('0x76')]==0xca){_0x719379[_0x0806('0x77')]=_0x1a8117;var _0x213d84={'method':_0x0806('0x39'),'uri':_0x0806('0x78'),'headers':{'Authorization':_0x0806('0x74')+_0x35233c[_0x0806('0x66')],'Content-Type':'application/json'},'body':{'refid':_0x719379[_0x0806('0x77')]['refid']},'json':!![]};return rp(_0x213d84)[_0x0806('0x20')](function(_0x7f806a){_0x719379['status']=_0x7f806a;var _0x379afe={'messageId':_0x719379[_0x0806('0x77')][_0x0806('0x79')],'read':!![]};return _0x5e8dd4[_0x0806('0x52')](_0x379afe);});}else{return logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x7a'),util[_0x0806('0x2d')](_0x1a8117,{'showHidden':![],'depth':null}));}})[_0x0806('0x2a')](function(_0x2594fa){return logger[_0x0806('0x1e')](_0x0806('0x2b'),'afterCreate',_0x0806('0x7a'),util[_0x0806('0x2d')](_0x2594fa,{'showHidden':![],'depth':null}));});}else{return logger[_0x0806('0x1e')](_0x0806('0x2b'),_0x0806('0x2c'),_0x0806('0x7a'),_0x0806('0x7b'));}break;}}})['finally'](function(){_0x15ee7d();});}else{_0x15ee7d();}}},'charset':_0x0806('0x7c'),'collate':_0x0806('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7f3cde6..c790351 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 _0xfb04=['localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults'];(function(_0x34d13a,_0x243b6a){var _0x2ba327=function(_0x39aec5){while(--_0x39aec5){_0x34d13a['push'](_0x34d13a['shift']());}};_0x2ba327(++_0x243b6a);}(_0xfb04,0x1e3));var _0x4fb0=function(_0x2b9b2f,_0x5b25e1){_0x2b9b2f=_0x2b9b2f-0x0;var _0xec0af7=_0xfb04[_0x2b9b2f];return _0xec0af7;};'use strict';var _=require('lodash');var util=require(_0x4fb0('0x0'));var moment=require(_0x4fb0('0x1'));var BPromise=require(_0x4fb0('0x2'));var rs=require(_0x4fb0('0x3'));var fs=require('fs');var Redis=require(_0x4fb0('0x4'));var db=require(_0x4fb0('0x5'))['db'];var utils=require(_0x4fb0('0x6'));var logger=require(_0x4fb0('0x7'))(_0x4fb0('0x8'));var config=require(_0x4fb0('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4fb0('0xa')]=_[_0x4fb0('0xb')](config['redis'],{'host':_0x4fb0('0xc'),'port':0x18eb});var socket=require(_0x4fb0('0xd'))(new Redis(config[_0x4fb0('0xa')]));require(_0x4fb0('0xe'))['register'](socket);function respondWithRpcPromise(_0xaca17f,_0x5b22e0,_0x2dbe5f){return new BPromise(function(_0x387c69,_0x518a4c){return client[_0x4fb0('0xf')](_0xaca17f,_0x2dbe5f)[_0x4fb0('0x10')](function(_0x1e8084){logger[_0x4fb0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5b22e0,'request\x20sent');logger[_0x4fb0('0x12')](_0x4fb0('0x13'),_0x5b22e0,_0x4fb0('0x14'),JSON['stringify'](_0x1e8084));if(_0x1e8084[_0x4fb0('0x15')]){if(_0x1e8084['error'][_0x4fb0('0x16')]===0x1f4){logger['error'](_0x4fb0('0x17'),_0x5b22e0,_0x1e8084['error']['message']);return _0x518a4c(_0x1e8084[_0x4fb0('0x15')][_0x4fb0('0x18')]);}logger[_0x4fb0('0x15')](_0x4fb0('0x17'),_0x5b22e0,_0x1e8084[_0x4fb0('0x15')]['message']);return _0x387c69(_0x1e8084[_0x4fb0('0x15')][_0x4fb0('0x18')]);}else{logger[_0x4fb0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5b22e0,_0x4fb0('0x14'));_0x387c69(_0x1e8084[_0x4fb0('0x19')]['message']);}})[_0x4fb0('0x1a')](function(_0x2869ab){logger[_0x4fb0('0x15')](_0x4fb0('0x17'),_0x5b22e0,_0x2869ab);_0x518a4c(_0x2869ab);});});}exports[_0x4fb0('0x1b')]=function(_0x417372){var _0x36a720=this;return new Promise(function(_0x3d098a,_0x2bbdf7){return db[_0x4fb0('0x1c')][_0x4fb0('0x1d')](_0x417372[_0x4fb0('0x1e')],{'raw':_0x417372[_0x4fb0('0x1f')]?_0x417372[_0x4fb0('0x1f')][_0x4fb0('0x20')]===undefined?!![]:![]:!![]})[_0x4fb0('0x10')](function(_0x141a50){logger[_0x4fb0('0x11')]('CreateSmsMessage',_0x417372);logger[_0x4fb0('0x12')](_0x4fb0('0x1b'),_0x417372,JSON['stringify'](_0x141a50));_0x3d098a(_0x141a50);})['catch'](function(_0x4b80e2){logger[_0x4fb0('0x15')]('CreateSmsMessage',_0x4b80e2[_0x4fb0('0x18')],_0x417372);_0x2bbdf7(_0x36a720['error'](0x1f4,_0x4b80e2[_0x4fb0('0x18')]));});});}; \ No newline at end of file +var _0x2de6=['raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2de6,0x1c5));var _0x62de=function(_0x5b602c,_0x402c26){_0x5b602c=_0x5b602c-0x0;var _0x1003f1=_0x2de6[_0x5b602c];return _0x1003f1;};'use strict';var _=require(_0x62de('0x0'));var util=require(_0x62de('0x1'));var moment=require(_0x62de('0x2'));var BPromise=require(_0x62de('0x3'));var rs=require(_0x62de('0x4'));var fs=require('fs');var Redis=require(_0x62de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x62de('0x6'));var logger=require('../../config/logger')(_0x62de('0x7'));var config=require('../../config/environment');var jayson=require(_0x62de('0x8'));var client=jayson['client'][_0x62de('0x9')]({'port':0x232a});config[_0x62de('0xa')]=_['defaults'](config[_0x62de('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62de('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x25ea6a,_0x1625fb,_0x2d414e){return new BPromise(function(_0x1d952f,_0x416408){return client[_0x62de('0xb')](_0x25ea6a,_0x2d414e)[_0x62de('0xc')](function(_0x3c36b7){logger[_0x62de('0xd')]('SmsMessage,\x20%s,\x20%s',_0x1625fb,_0x62de('0xe'));logger['debug'](_0x62de('0xf'),_0x1625fb,'request\x20sent',JSON['stringify'](_0x3c36b7));if(_0x3c36b7['error']){if(_0x3c36b7[_0x62de('0x10')][_0x62de('0x11')]===0x1f4){logger[_0x62de('0x10')](_0x62de('0x12'),_0x1625fb,_0x3c36b7[_0x62de('0x10')][_0x62de('0x13')]);return _0x416408(_0x3c36b7['error'][_0x62de('0x13')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1625fb,_0x3c36b7[_0x62de('0x10')]['message']);return _0x1d952f(_0x3c36b7[_0x62de('0x10')][_0x62de('0x13')]);}else{logger[_0x62de('0xd')](_0x62de('0x12'),_0x1625fb,'request\x20sent');_0x1d952f(_0x3c36b7[_0x62de('0x14')][_0x62de('0x13')]);}})[_0x62de('0x15')](function(_0x486a0f){logger[_0x62de('0x10')]('SmsMessage,\x20%s,\x20%s',_0x1625fb,_0x486a0f);_0x416408(_0x486a0f);});});}exports[_0x62de('0x16')]=function(_0x55670e){var _0x24a095=this;return new Promise(function(_0x326d88,_0x125910){return db[_0x62de('0x17')][_0x62de('0x18')](_0x55670e[_0x62de('0x19')],{'raw':_0x55670e[_0x62de('0x1a')]?_0x55670e[_0x62de('0x1a')][_0x62de('0x1b')]===undefined?!![]:![]:!![]})[_0x62de('0xc')](function(_0x5e1723){logger[_0x62de('0xd')](_0x62de('0x16'),_0x55670e);logger[_0x62de('0x1c')](_0x62de('0x16'),_0x55670e,JSON[_0x62de('0x1d')](_0x5e1723));_0x326d88(_0x5e1723);})[_0x62de('0x15')](function(_0x4a61d0){logger[_0x62de('0x10')]('CreateSmsMessage',_0x4a61d0[_0x62de('0x13')],_0x55670e);_0x125910(_0x24a095[_0x62de('0x10')](0x1f4,_0x4a61d0[_0x62de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5f64a11..b6ba91d 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 _0x41d2=['smsMessage:','./smsMessage.events','remove','emit','removeListener','register','length'];(function(_0x3b700,_0x470f32){var _0x38ebf2=function(_0x2f2ac8){while(--_0x2f2ac8){_0x3b700['push'](_0x3b700['shift']());}};_0x38ebf2(++_0x470f32);}(_0x41d2,0x119));var _0x241d=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x41d2[_0x120376];return _0x28c529;};'use strict';var SmsMessageEvents=require(_0x241d('0x0'));var events=['save',_0x241d('0x1'),'update'];function createListener(_0xcf2641,_0x2b301c){return function(_0x4eeba2){_0x2b301c[_0x241d('0x2')](_0xcf2641,_0x4eeba2);};}function removeListener(_0x2e2c7b,_0x34b222){return function(){SmsMessageEvents[_0x241d('0x3')](_0x2e2c7b,_0x34b222);};}exports[_0x241d('0x4')]=function(_0x12c23e){for(var _0x284c09=0x0,_0x49a0c9=events[_0x241d('0x5')];_0x284c09<_0x49a0c9;_0x284c09++){var _0x4c6bfa=events[_0x284c09];var _0x2c9489=createListener(_0x241d('0x6')+_0x4c6bfa,_0x12c23e);SmsMessageEvents['on'](_0x4c6bfa,_0x2c9489);}}; \ No newline at end of file +var _0xc32c=['removeListener','register','length','./smsMessage.events','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc32c,0xa3));var _0xcc32=function(_0x37a896,_0x5569de){_0x37a896=_0x37a896-0x0;var _0x510515=_0xc32c[_0x37a896];return _0x510515;};'use strict';var SmsMessageEvents=require(_0xcc32('0x0'));var events=['save','remove','update'];function createListener(_0x2d184b,_0x80dcb6){return function(_0x4980b2){_0x80dcb6[_0xcc32('0x1')](_0x2d184b,_0x4980b2);};}function removeListener(_0x257d44,_0x5d119c){return function(){SmsMessageEvents[_0xcc32('0x2')](_0x257d44,_0x5d119c);};}exports[_0xcc32('0x3')]=function(_0x4fe82b){for(var _0x12d616=0x0,_0x184ae6=events[_0xcc32('0x4')];_0x12d616<_0x184ae6;_0x12d616++){var _0x2a0260=events[_0x12d616];var _0x293fc6=createListener('smsMessage:'+_0x2a0260,_0x4fe82b);SmsMessageEvents['on'](_0x2a0260,_0x293fc6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5d37261..98f5ca7 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 _0x4c87=['post','create','addTeams','/:id/users','addAgents','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x310e70,_0x567a29){var _0x6af6da=function(_0x110eee){while(--_0x110eee){_0x310e70['push'](_0x310e70['shift']());}};_0x6af6da(++_0x567a29);}(_0x4c87,0x15e));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x74c8('0x0'));var path=require(_0x74c8('0x1'));var timeout=require(_0x74c8('0x2'));var express=require(_0x74c8('0x3'));var router=express[_0x74c8('0x4')]();var fs_extra=require(_0x74c8('0x5'));var auth=require(_0x74c8('0x6'));var interaction=require(_0x74c8('0x7'));var config=require(_0x74c8('0x8'));var controller=require(_0x74c8('0x9'));router[_0x74c8('0xa')]('/',auth[_0x74c8('0xb')](),controller[_0x74c8('0xc')]);router[_0x74c8('0xa')](_0x74c8('0xd'),auth[_0x74c8('0xb')](),controller[_0x74c8('0xe')]);router[_0x74c8('0xa')](_0x74c8('0xf'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x10')]);router['get'](_0x74c8('0x11'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x12')]);router['get'](_0x74c8('0x13'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x14')]);router['get']('/:id/users',auth[_0x74c8('0xb')](),controller[_0x74c8('0x15')]);router[_0x74c8('0x16')]('/',auth[_0x74c8('0xb')](),controller[_0x74c8('0x17')]);router[_0x74c8('0x16')](_0x74c8('0x13'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x18')]);router['post'](_0x74c8('0x19'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x1a')]);router['put'](_0x74c8('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x74c8('0xf'),auth['isAuthenticated'](),controller[_0x74c8('0x1b')]);router[_0x74c8('0x1c')]('/:id/teams',auth[_0x74c8('0xb')](),controller[_0x74c8('0x1d')]);router[_0x74c8('0x1c')](_0x74c8('0x19'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x74c8('0x1e')]=router; \ No newline at end of file +var _0x09bd=['/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams'];(function(_0x5cabac,_0x5ccb08){var _0x5f47b8=function(_0x1e478b){while(--_0x1e478b){_0x5cabac['push'](_0x5cabac['shift']());}};_0x5f47b8(++_0x5ccb08);}(_0x09bd,0x1c6));var _0xd09b=function(_0x1a2635,_0x2a33a8){_0x1a2635=_0x1a2635-0x0;var _0x2ccd92=_0x09bd[_0x1a2635];return _0x2ccd92;};'use strict';var multer=require(_0xd09b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd09b('0x1'));var auth=require(_0xd09b('0x2'));var interaction=require(_0xd09b('0x3'));var config=require(_0xd09b('0x4'));var controller=require('./smsQueue.controller');router[_0xd09b('0x5')]('/',auth['isAuthenticated'](),controller[_0xd09b('0x6')]);router['get'](_0xd09b('0x7'),auth[_0xd09b('0x8')](),controller['describe']);router[_0xd09b('0x5')](_0xd09b('0x9'),auth[_0xd09b('0x8')](),controller[_0xd09b('0xa')]);router[_0xd09b('0x5')]('/:id/members',auth['isAuthenticated'](),controller[_0xd09b('0xb')]);router[_0xd09b('0x5')](_0xd09b('0xc'),auth[_0xd09b('0x8')](),controller[_0xd09b('0xd')]);router[_0xd09b('0x5')](_0xd09b('0xe'),auth[_0xd09b('0x8')](),controller[_0xd09b('0xf')]);router['post']('/',auth[_0xd09b('0x8')](),controller[_0xd09b('0x10')]);router[_0xd09b('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd09b('0x12')]);router['post'](_0xd09b('0xe'),auth[_0xd09b('0x8')](),controller['addAgents']);router[_0xd09b('0x13')]('/:id',auth[_0xd09b('0x8')](),controller[_0xd09b('0x14')]);router[_0xd09b('0x15')](_0xd09b('0x9'),auth[_0xd09b('0x8')](),controller[_0xd09b('0x16')]);router['delete']('/:id/teams',auth[_0xd09b('0x8')](),controller[_0xd09b('0x17')]);router[_0xd09b('0x15')](_0xd09b('0xe'),auth['isAuthenticated'](),controller[_0xd09b('0x18')]);module[_0xd09b('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 309abdc..99b93e1 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 _0x9272=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9272,0x1c9));var _0x2927=function(_0x15972e,_0x269a49){_0x15972e=_0x15972e-0x0;var _0x5b2ead=_0x9272[_0x15972e];return _0x5b2ead;};'use strict';var Sequelize=require(_0x2927('0x0'));module[_0x2927('0x1')]={'name':{'type':Sequelize[_0x2927('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2927('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2927('0x4'),_0x2927('0x5'),_0x2927('0x6'))}}; \ No newline at end of file +var _0xa636=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x7979ab,_0x3a8ad0){var _0x457e78=function(_0x20a4ec){while(--_0x20a4ec){_0x7979ab['push'](_0x7979ab['shift']());}};_0x457e78(++_0x3a8ad0);}(_0xa636,0x1ab));var _0x6a63=function(_0x4ce3b8,_0x616767){_0x4ce3b8=_0x4ce3b8-0x0;var _0x302779=_0xa636[_0x4ce3b8];return _0x302779;};'use strict';var Sequelize=require(_0x6a63('0x0'));module[_0x6a63('0x1')]={'name':{'type':Sequelize[_0x6a63('0x2')],'unique':_0x6a63('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6a63('0x2')]},'timeout':{'type':Sequelize[_0x6a63('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a63('0x5')](_0x6a63('0x6'),_0x6a63('0x7'),_0x6a63('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e987f0c..f6e52da 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x209803,_0x205d7e){var _0x53ef29=function(_0x1dc858){while(--_0x1dc858){_0x209803['push'](_0x209803['shift']());}};_0x53ef29(++_0x205d7e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x515006,_0x2d3ae0){var _0xb30434=function(_0x1e4948){while(--_0x1e4948){_0x515006['push'](_0x515006['shift']());}};_0xb30434(++_0x2d3ae0);}(_0xdb28,0x106));var _0x8db2=function(_0x349e1f,_0x272c8d){_0x349e1f=_0x349e1f-0x0;var _0x41f944=_0xdb28[_0x349e1f];return _0x41f944;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ff7db0b..45e1b77 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 _0x8ace=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xc9873a,_0x5efdcb){var _0x2f7d84=function(_0xf6e70){while(--_0xf6e70){_0xc9873a['push'](_0xc9873a['shift']());}};_0x2f7d84(++_0x5efdcb);}(_0x8ace,0x1db));var _0xe8ac=function(_0x366ce0,_0x4c3fad){_0x366ce0=_0x366ce0-0x0;var _0x5ae1c0=_0x8ace[_0x366ce0];return _0x5ae1c0;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var SmsQueue=require(_0xe8ac('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe8ac('0x2')](0x0);var events={'afterCreate':_0xe8ac('0x3'),'afterUpdate':_0xe8ac('0x4'),'afterDestroy':_0xe8ac('0x5')};function emitEvent(_0x3be3e8){return function(_0x3990f1,_0x18ff24,_0x248776){SmsQueueEvents[_0xe8ac('0x6')](_0x3be3e8+':'+_0x3990f1['id'],_0x3990f1);SmsQueueEvents[_0xe8ac('0x6')](_0x3be3e8,_0x3990f1);_0x248776(null);};}for(var e in events){if(events[_0xe8ac('0x7')](e)){var event=events[e];SmsQueue[_0xe8ac('0x8')](e,emitEvent(event));}}module[_0xe8ac('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x249d=['emit','hook','exports','../../mysqldb','save','remove'];(function(_0x10a82b,_0x2d4bd2){var _0x5f191f=function(_0x2c8f05){while(--_0x2c8f05){_0x10a82b['push'](_0x10a82b['shift']());}};_0x5f191f(++_0x2d4bd2);}(_0x249d,0x1bf));var _0xd249=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x249d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xd249('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd249('0x1'),'afterUpdate':'update','afterDestroy':_0xd249('0x2')};function emitEvent(_0x35d370){return function(_0x4bd82b,_0x449e39,_0x552f0b){SmsQueueEvents[_0xd249('0x3')](_0x35d370+':'+_0x4bd82b['id'],_0x4bd82b);SmsQueueEvents[_0xd249('0x3')](_0x35d370,_0x4bd82b);_0x552f0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xd249('0x4')](e,emitEvent(event));}}module[_0xd249('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0fd09fa..4988d9f 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 _0x15f4=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x50ec10,_0x69f761){var _0x9faa7f=function(_0x34b2c9){while(--_0x34b2c9){_0x50ec10['push'](_0x50ec10['shift']());}};_0x9faa7f(++_0x69f761);}(_0x15f4,0x197));var _0x415f=function(_0xa0090,_0x4802a5){_0xa0090=_0xa0090-0x0;var _0x37e155=_0x15f4[_0xa0090];return _0x37e155;};'use strict';var _=require(_0x415f('0x0'));var util=require('util');var logger=require(_0x415f('0x1'))(_0x415f('0x2'));var moment=require('moment');var BPromise=require(_0x415f('0x3'));var rp=require(_0x415f('0x4'));var fs=require('fs');var path=require(_0x415f('0x5'));var rimraf=require('rimraf');var config=require(_0x415f('0x6'));var attributes=require(_0x415f('0x7'));module[_0x415f('0x8')]=function(_0x300779,_0x3c040a){return _0x300779[_0x415f('0x9')](_0x415f('0xa'),attributes,{'tableName':_0x415f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa960=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xa960,0x10f));var _0x0a96=function(_0x1399a7,_0x1a3135){_0x1399a7=_0x1399a7-0x0;var _0x15d846=_0xa960[_0x1399a7];return _0x15d846;};'use strict';var _=require(_0x0a96('0x0'));var util=require(_0x0a96('0x1'));var logger=require(_0x0a96('0x2'))(_0x0a96('0x3'));var moment=require(_0x0a96('0x4'));var BPromise=require(_0x0a96('0x5'));var rp=require(_0x0a96('0x6'));var fs=require('fs');var path=require(_0x0a96('0x7'));var rimraf=require(_0x0a96('0x8'));var config=require(_0x0a96('0x9'));var attributes=require(_0x0a96('0xa'));module[_0x0a96('0xb')]=function(_0x3750d1,_0x36e595){return _0x3750d1[_0x0a96('0xc')](_0x0a96('0xd'),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 a45ce4d..f016734 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 _0x906e=['stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetSmsQueue','ShowSmsQueue','find'];(function(_0x2caeae,_0x1c0bc8){var _0x12bcd6=function(_0x408a5f){while(--_0x408a5f){_0x2caeae['push'](_0x2caeae['shift']());}};_0x12bcd6(++_0x1c0bc8);}(_0x906e,0x119));var _0xe906=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0x906e[_0x45ad09];return _0x2084fd;};'use strict';var _=require(_0xe906('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe906('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe906('0x2'));var db=require(_0xe906('0x3'))['db'];var utils=require(_0xe906('0x4'));var logger=require(_0xe906('0x5'))(_0xe906('0x6'));var config=require('../../config/environment');var jayson=require(_0xe906('0x7'));var client=jayson[_0xe906('0x8')][_0xe906('0x9')]({'port':0x232a});config[_0xe906('0xa')]=_[_0xe906('0xb')](config[_0xe906('0xa')],{'host':_0xe906('0xc'),'port':0x18eb});var socket=require(_0xe906('0xd'))(new Redis(config[_0xe906('0xa')]));require(_0xe906('0xe'))[_0xe906('0xf')](socket);function respondWithRpcPromise(_0x535d07,_0x2b4e67,_0x34b66e){return new BPromise(function(_0x18bf6b,_0x2e2c78){return client[_0xe906('0x10')](_0x535d07,_0x34b66e)['then'](function(_0x59fe4e){logger[_0xe906('0x11')](_0xe906('0x12'),_0x2b4e67,'request\x20sent');logger[_0xe906('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2b4e67,'request\x20sent',JSON['stringify'](_0x59fe4e));if(_0x59fe4e['error']){if(_0x59fe4e[_0xe906('0x14')][_0xe906('0x15')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x59fe4e[_0xe906('0x14')][_0xe906('0x16')]);return _0x2e2c78(_0x59fe4e[_0xe906('0x14')]['message']);}logger[_0xe906('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x59fe4e[_0xe906('0x14')][_0xe906('0x16')]);return _0x18bf6b(_0x59fe4e['error'][_0xe906('0x16')]);}else{logger[_0xe906('0x11')](_0xe906('0x12'),_0x2b4e67,_0xe906('0x17'));_0x18bf6b(_0x59fe4e['result'][_0xe906('0x16')]);}})[_0xe906('0x18')](function(_0x1ccda0){logger[_0xe906('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x1ccda0);_0x2e2c78(_0x1ccda0);});});}exports['GetSmsQueue']=function(_0x3c49f1){var _0x4e5d34=this;return new Promise(function(_0x3eae3b,_0x5505d6){return db[_0xe906('0x19')][_0xe906('0x1a')]({'raw':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1d')]||null:null,'attributes':_0x3c49f1[_0xe906('0x1b')]?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1e')]||null:null,'limit':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1f')]||null:null,'include':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x20')]?_['map'](_0x3c49f1[_0xe906('0x1b')][_0xe906('0x20')],function(_0xd2691b){return{'model':db[_0xd2691b[_0xe906('0x21')]],'as':_0xd2691b['as'],'attributes':_0xd2691b[_0xe906('0x1e')],'include':_0xd2691b['include']?_[_0xe906('0x22')](_0xd2691b[_0xe906('0x20')],function(_0x4f4e3a){return{'model':db[_0x4f4e3a[_0xe906('0x21')]],'as':_0x4f4e3a['as'],'attributes':_0x4f4e3a[_0xe906('0x1e')],'include':_0x4f4e3a['include']?_[_0xe906('0x22')](_0x4f4e3a['include'],function(_0x378af3){return{'model':db[_0x378af3[_0xe906('0x21')]],'as':_0x378af3['as'],'attributes':_0x378af3['attributes']};}):[]};}):[]};}):[]:[]})[_0xe906('0x23')](function(_0x40fd45){logger[_0xe906('0x11')](_0xe906('0x24'),_0x3c49f1);logger['debug'](_0xe906('0x24'),_0x3c49f1,JSON['stringify'](_0x40fd45));_0x3eae3b(_0x40fd45);})[_0xe906('0x18')](function(_0x1acf31){logger['error'](_0xe906('0x24'),_0x1acf31[_0xe906('0x16')],_0x3c49f1);_0x5505d6(_0x4e5d34[_0xe906('0x14')](0x1f4,_0x1acf31[_0xe906('0x16')]));});});};exports[_0xe906('0x25')]=function(_0x18c7bb){var _0xe29e48=this;return new Promise(function(_0x2602d0,_0xcef0fd){return db[_0xe906('0x19')][_0xe906('0x26')]({'raw':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb['options'][_0xe906('0x1c')]===undefined?!![]:![]:!![],'where':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb[_0xe906('0x1b')][_0xe906('0x1d')]||null:null,'attributes':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb['options'][_0xe906('0x1e')]||null:null,'include':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb[_0xe906('0x1b')][_0xe906('0x20')]?_['map'](_0x18c7bb['options'][_0xe906('0x20')],function(_0x648c90){return{'model':db[_0x648c90[_0xe906('0x21')]],'as':_0x648c90['as'],'attributes':_0x648c90[_0xe906('0x1e')],'include':_0x648c90[_0xe906('0x20')]?_['map'](_0x648c90[_0xe906('0x20')],function(_0x377101){return{'model':db[_0x377101[_0xe906('0x21')]],'as':_0x377101['as'],'attributes':_0x377101[_0xe906('0x1e')],'include':_0x377101['include']?_[_0xe906('0x22')](_0x377101[_0xe906('0x20')],function(_0x379525){return{'model':db[_0x379525[_0xe906('0x21')]],'as':_0x379525['as'],'attributes':_0x379525[_0xe906('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe906('0x23')](function(_0x2f4c6c){logger[_0xe906('0x11')](_0xe906('0x25'),_0x18c7bb);logger[_0xe906('0x13')](_0xe906('0x25'),_0x18c7bb,JSON[_0xe906('0x27')](_0x2f4c6c));_0x2602d0(_0x2f4c6c);})[_0xe906('0x18')](function(_0x43f056){logger[_0xe906('0x14')](_0xe906('0x25'),_0x43f056[_0xe906('0x16')],_0x18c7bb);_0xcef0fd(_0xe29e48[_0xe906('0x14')](0x1f4,_0x43f056[_0xe906('0x16')]));});});}; \ No newline at end of file +var _0x4165=['ShowSmsQueue','find','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x208a2c,_0x383824){var _0x4ea1b6=function(_0x163d2e){while(--_0x163d2e){_0x208a2c['push'](_0x208a2c['shift']());}};_0x4ea1b6(++_0x383824);}(_0x4165,0x13b));var _0x5416=function(_0x58df14,_0x4de05d){_0x58df14=_0x58df14-0x0;var _0x1fc529=_0x4165[_0x58df14];return _0x1fc529;};'use strict';var _=require('lodash');var util=require(_0x5416('0x0'));var moment=require(_0x5416('0x1'));var BPromise=require(_0x5416('0x2'));var rs=require(_0x5416('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5416('0x4'))['db'];var utils=require(_0x5416('0x5'));var logger=require(_0x5416('0x6'))('rpc');var config=require(_0x5416('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5416('0x8')][_0x5416('0x9')]({'port':0x232a});config[_0x5416('0xa')]=_[_0x5416('0xb')](config[_0x5416('0xa')],{'host':_0x5416('0xc'),'port':0x18eb});var socket=require(_0x5416('0xd'))(new Redis(config['redis']));require(_0x5416('0xe'))[_0x5416('0xf')](socket);function respondWithRpcPromise(_0x46c946,_0x5636d6,_0x443627){return new BPromise(function(_0x37ff79,_0x2a46c6){return client['request'](_0x46c946,_0x443627)[_0x5416('0x10')](function(_0x5ea3fc){logger['info'](_0x5416('0x11'),_0x5636d6,_0x5416('0x12'));logger[_0x5416('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5636d6,'request\x20sent',JSON['stringify'](_0x5ea3fc));if(_0x5ea3fc['error']){if(_0x5ea3fc[_0x5416('0x14')]['code']===0x1f4){logger['error'](_0x5416('0x11'),_0x5636d6,_0x5ea3fc[_0x5416('0x14')][_0x5416('0x15')]);return _0x2a46c6(_0x5ea3fc[_0x5416('0x14')][_0x5416('0x15')]);}logger[_0x5416('0x14')]('SmsQueue,\x20%s,\x20%s',_0x5636d6,_0x5ea3fc[_0x5416('0x14')][_0x5416('0x15')]);return _0x37ff79(_0x5ea3fc['error'][_0x5416('0x15')]);}else{logger['info'](_0x5416('0x11'),_0x5636d6,_0x5416('0x12'));_0x37ff79(_0x5ea3fc[_0x5416('0x16')][_0x5416('0x15')]);}})[_0x5416('0x17')](function(_0x2f248a){logger[_0x5416('0x14')](_0x5416('0x11'),_0x5636d6,_0x2f248a);_0x2a46c6(_0x2f248a);});});}exports[_0x5416('0x18')]=function(_0x392fd3){var _0x1a94f3=this;return new Promise(function(_0x23ae55,_0x195769){return db[_0x5416('0x19')][_0x5416('0x1a')]({'raw':_0x392fd3['options']?_0x392fd3[_0x5416('0x1b')][_0x5416('0x1c')]===undefined?!![]:![]:!![],'where':_0x392fd3[_0x5416('0x1b')]?_0x392fd3[_0x5416('0x1b')][_0x5416('0x1d')]||null:null,'attributes':_0x392fd3[_0x5416('0x1b')]?_0x392fd3[_0x5416('0x1b')][_0x5416('0x1e')]||null:null,'limit':_0x392fd3[_0x5416('0x1b')]?_0x392fd3[_0x5416('0x1b')][_0x5416('0x1f')]||null:null,'include':_0x392fd3[_0x5416('0x1b')]?_0x392fd3['options'][_0x5416('0x20')]?_[_0x5416('0x21')](_0x392fd3[_0x5416('0x1b')][_0x5416('0x20')],function(_0x5c3c04){return{'model':db[_0x5c3c04[_0x5416('0x22')]],'as':_0x5c3c04['as'],'attributes':_0x5c3c04['attributes'],'include':_0x5c3c04[_0x5416('0x20')]?_[_0x5416('0x21')](_0x5c3c04['include'],function(_0x89fa9e){return{'model':db[_0x89fa9e['model']],'as':_0x89fa9e['as'],'attributes':_0x89fa9e[_0x5416('0x1e')],'include':_0x89fa9e[_0x5416('0x20')]?_['map'](_0x89fa9e[_0x5416('0x20')],function(_0x263fad){return{'model':db[_0x263fad[_0x5416('0x22')]],'as':_0x263fad['as'],'attributes':_0x263fad[_0x5416('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5416('0x10')](function(_0x1f35c5){logger[_0x5416('0x23')]('GetSmsQueue',_0x392fd3);logger[_0x5416('0x13')](_0x5416('0x18'),_0x392fd3,JSON['stringify'](_0x1f35c5));_0x23ae55(_0x1f35c5);})[_0x5416('0x17')](function(_0xd6a0e7){logger[_0x5416('0x14')](_0x5416('0x18'),_0xd6a0e7[_0x5416('0x15')],_0x392fd3);_0x195769(_0x1a94f3[_0x5416('0x14')](0x1f4,_0xd6a0e7[_0x5416('0x15')]));});});};exports[_0x5416('0x24')]=function(_0x5d9f2f){var _0x2ef289=this;return new Promise(function(_0x1dc5fc,_0x345e8e){return db['SmsQueue'][_0x5416('0x25')]({'raw':_0x5d9f2f[_0x5416('0x1b')]?_0x5d9f2f[_0x5416('0x1b')][_0x5416('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d9f2f[_0x5416('0x1b')]?_0x5d9f2f[_0x5416('0x1b')]['where']||null:null,'attributes':_0x5d9f2f[_0x5416('0x1b')]?_0x5d9f2f[_0x5416('0x1b')][_0x5416('0x1e')]||null:null,'include':_0x5d9f2f[_0x5416('0x1b')]?_0x5d9f2f[_0x5416('0x1b')]['include']?_['map'](_0x5d9f2f['options'][_0x5416('0x20')],function(_0x16f765){return{'model':db[_0x16f765[_0x5416('0x22')]],'as':_0x16f765['as'],'attributes':_0x16f765[_0x5416('0x1e')],'include':_0x16f765[_0x5416('0x20')]?_[_0x5416('0x21')](_0x16f765[_0x5416('0x20')],function(_0x2c27a8){return{'model':db[_0x2c27a8[_0x5416('0x22')]],'as':_0x2c27a8['as'],'attributes':_0x2c27a8[_0x5416('0x1e')],'include':_0x2c27a8['include']?_['map'](_0x2c27a8[_0x5416('0x20')],function(_0x3fce18){return{'model':db[_0x3fce18[_0x5416('0x22')]],'as':_0x3fce18['as'],'attributes':_0x3fce18['attributes']};}):[]};}):[]};}):[]:[]})[_0x5416('0x10')](function(_0x56da48){logger[_0x5416('0x23')]('ShowSmsQueue',_0x5d9f2f);logger[_0x5416('0x13')](_0x5416('0x24'),_0x5d9f2f,JSON[_0x5416('0x26')](_0x56da48));_0x1dc5fc(_0x56da48);})['catch'](function(_0x44b662){logger[_0x5416('0x14')]('ShowSmsQueue',_0x44b662['message'],_0x5d9f2f);_0x345e8e(_0x2ef289[_0x5416('0x14')](0x1f4,_0x44b662['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 793155d..70d0e48 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 _0x8e43=['length','smsQueue:','save','remove','update','emit','removeListener','register'];(function(_0x22bf47,_0x5b3cfd){var _0x63e280=function(_0x1bb6d6){while(--_0x1bb6d6){_0x22bf47['push'](_0x22bf47['shift']());}};_0x63e280(++_0x5b3cfd);}(_0x8e43,0x9a));var _0x38e4=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8e43[_0x1589dd];return _0x1bddd1;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x38e4('0x0'),_0x38e4('0x1'),_0x38e4('0x2')];function createListener(_0x47f4d2,_0x4dbcbf){return function(_0x190e55){_0x4dbcbf[_0x38e4('0x3')](_0x47f4d2,_0x190e55);};}function removeListener(_0x284ef7,_0x29ae6e){return function(){SmsQueueEvents[_0x38e4('0x4')](_0x284ef7,_0x29ae6e);};}exports[_0x38e4('0x5')]=function(_0x3a5df3){for(var _0xcb358a=0x0,_0x250e6b=events[_0x38e4('0x6')];_0xcb358a<_0x250e6b;_0xcb358a++){var _0x360f13=events[_0xcb358a];var _0x2c10ae=createListener(_0x38e4('0x7')+_0x360f13,_0x3a5df3);SmsQueueEvents['on'](_0x360f13,_0x2c10ae);}}; \ No newline at end of file +var _0xb910=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x45b1cd,_0x304e0f){var _0x24b9a2=function(_0xa8b32c){while(--_0xa8b32c){_0x45b1cd['push'](_0x45b1cd['shift']());}};_0x24b9a2(++_0x304e0f);}(_0xb910,0x13e));var _0x0b91=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb910[_0x1f9f37];return _0x21c080;};'use strict';var SmsQueueEvents=require(_0x0b91('0x0'));var events=[_0x0b91('0x1'),_0x0b91('0x2'),_0x0b91('0x3')];function createListener(_0x58ab32,_0x374fab){return function(_0x4104f8){_0x374fab[_0x0b91('0x4')](_0x58ab32,_0x4104f8);};}function removeListener(_0x3d5769,_0x161ed2){return function(){SmsQueueEvents[_0x0b91('0x5')](_0x3d5769,_0x161ed2);};}exports[_0x0b91('0x6')]=function(_0x5a2e37){for(var _0x1466b6=0x0,_0x1ca170=events[_0x0b91('0x7')];_0x1466b6<_0x1ca170;_0x1466b6++){var _0x5af4dd=events[_0x1466b6];var _0x310af3=createListener(_0x0b91('0x8')+_0x5af4dd,_0x5a2e37);SmsQueueEvents['on'](_0x5af4dd,_0x310af3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 0fb7660..9d2f4b4 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 _0xd8af=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path'];(function(_0x425e0c,_0x99e535){var _0x2bd841=function(_0x3a6715){while(--_0x3a6715){_0x425e0c['push'](_0x425e0c['shift']());}};_0x2bd841(++_0x99e535);}(_0xd8af,0x18d));var _0xfd8a=function(_0x4c18c6,_0x3790e3){_0x4c18c6=_0x4c18c6-0x0;var _0x20a09c=_0xd8af[_0x4c18c6];return _0x20a09c;};'use strict';var multer=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var path=require(_0xfd8a('0x2'));var timeout=require(_0xfd8a('0x3'));var express=require(_0xfd8a('0x4'));var router=express['Router']();var fs_extra=require(_0xfd8a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfd8a('0x6'));var config=require(_0xfd8a('0x7'));var controller=require(_0xfd8a('0x8'));router['get']('/',auth[_0xfd8a('0x9')](),controller['index']);router[_0xfd8a('0xa')](_0xfd8a('0xb'),auth[_0xfd8a('0x9')](),controller[_0xfd8a('0xc')]);router['get'](_0xfd8a('0xd'),auth[_0xfd8a('0x9')](),controller[_0xfd8a('0xe')]);router[_0xfd8a('0xf')]('/',auth[_0xfd8a('0x9')](),controller[_0xfd8a('0x10')]);router['put']('/:id',auth[_0xfd8a('0x9')](),controller[_0xfd8a('0x11')]);router[_0xfd8a('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd8a('0x13')]=router; \ No newline at end of file +var _0xe292=['path','connect-timeout','fs-extra','../../components/auth/service','./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x46e2e,_0x120a04){var _0x1489fa=function(_0x2f6080){while(--_0x2f6080){_0x46e2e['push'](_0x46e2e['shift']());}};_0x1489fa(++_0x120a04);}(_0xe292,0x19e));var _0x2e29=function(_0x11d163,_0x3dd010){_0x11d163=_0x11d163-0x0;var _0x282a5c=_0xe292[_0x11d163];return _0x282a5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e29('0x0'));var timeout=require(_0x2e29('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e29('0x2'));var auth=require(_0x2e29('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e29('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x2e29('0x5')]);router[_0x2e29('0x6')](_0x2e29('0x7'),auth[_0x2e29('0x8')](),controller[_0x2e29('0x9')]);router[_0x2e29('0x6')](_0x2e29('0xa'),auth[_0x2e29('0x8')](),controller[_0x2e29('0xb')]);router[_0x2e29('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e29('0xd')]);router[_0x2e29('0xe')]('/:id',auth[_0x2e29('0x8')](),controller[_0x2e29('0xf')]);router[_0x2e29('0x10')](_0x2e29('0xa'),auth[_0x2e29('0x8')](),controller[_0x2e29('0x11')]);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 6907337..322ff5d 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 _0x0af7=['exports','STRING','DATE','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0af7,0x17b));var _0x70af=function(_0x3bd387,_0x56c2a9){_0x3bd387=_0x3bd387-0x0;var _0x3d5b2f=_0x0af7[_0x3bd387];return _0x3d5b2f;};'use strict';var moment=require(_0x70af('0x0'));var Sequelize=require('sequelize');module[_0x70af('0x1')]={'uniqueid':{'type':Sequelize[_0x70af('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x70af('0x2')]},'joinAt':{'type':Sequelize[_0x70af('0x3')]},'leaveAt':{'type':Sequelize[_0x70af('0x3')]},'acceptAt':{'type':Sequelize[_0x70af('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x70af('0x2')]}}; \ No newline at end of file +var _0xa83b=['exports','DATE','STRING','moment','sequelize'];(function(_0x3ee6ea,_0x8b079f){var _0x3e9d1f=function(_0x5a2ed1){while(--_0x5a2ed1){_0x3ee6ea['push'](_0x3ee6ea['shift']());}};_0x3e9d1f(++_0x8b079f);}(_0xa83b,0x1f2));var _0xba83=function(_0x4a3703,_0x2646b7){_0x4a3703=_0x4a3703-0x0;var _0xaee0fb=_0xa83b[_0x4a3703];return _0xaee0fb;};'use strict';var moment=require(_0xba83('0x0'));var Sequelize=require(_0xba83('0x1'));module[_0xba83('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xba83('0x3')]},'leaveAt':{'type':Sequelize[_0xba83('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xba83('0x3')]},'reason':{'type':Sequelize[_0xba83('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 8b68f8a..383cf2f 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 _0xbe2f=['apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','includeAll','include','rows','params','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x543743,_0x24f0f3){var _0xe8bf81=function(_0x2a6206){while(--_0x2a6206){_0x543743['push'](_0x543743['shift']());}};_0xe8bf81(++_0x24f0f3);}(_0xbe2f,0x73));var _0xfbe2=function(_0x347813,_0xbc3d14){_0x347813=_0x347813-0x0;var _0x474565=_0xbe2f[_0x347813];return _0x474565;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbe2('0x0'));var zipdir=require(_0xfbe2('0x1'));var jsonpatch=require(_0xfbe2('0x2'));var rp=require('request-promise');var moment=require(_0xfbe2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfbe2('0x4'));var sox=require(_0xfbe2('0x5'));var csv=require(_0xfbe2('0x6'));var ejs=require(_0xfbe2('0x7'));var fs=require('fs');var fs_extra=require(_0xfbe2('0x8'));var _=require(_0xfbe2('0x9'));var squel=require(_0xfbe2('0xa'));var crypto=require(_0xfbe2('0xb'));var jsforce=require(_0xfbe2('0xc'));var deskjs=require(_0xfbe2('0xd'));var toCsv=require(_0xfbe2('0x6'));var querystring=require('querystring');var Papa=require(_0xfbe2('0xe'));var Redis=require('ioredis');var authService=require(_0xfbe2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbe2('0x10'));var hardwareService=require(_0xfbe2('0x11'));var logger=require('../../config/logger')(_0xfbe2('0x12'));var utils=require(_0xfbe2('0x13'));var config=require(_0xfbe2('0x14'));var licenseUtil=require(_0xfbe2('0x15'));var db=require(_0xfbe2('0x16'))['db'];function respondWithStatusCode(_0x3dda35,_0x22b193){_0x22b193=_0x22b193||0xcc;return function(_0x1b2b6c){if(_0x1b2b6c){return _0x3dda35[_0xfbe2('0x17')](_0x22b193);}return _0x3dda35[_0xfbe2('0x18')](_0x22b193)[_0xfbe2('0x19')]();};}function respondWithResult(_0x1b2f95,_0x1e5feb){_0x1e5feb=_0x1e5feb||0xc8;return function(_0x158aac){if(_0x158aac){return _0x1b2f95[_0xfbe2('0x18')](_0x1e5feb)[_0xfbe2('0x1a')](_0x158aac);}};}function respondWithFilteredResult(_0x444660,_0x1f5483){return function(_0x4d6e7f){if(_0x4d6e7f){var _0x4679e1=typeof _0x1f5483['offset']===_0xfbe2('0x1b')&&typeof _0x1f5483[_0xfbe2('0x1c')]===_0xfbe2('0x1b');var _0x2153df=_0x4d6e7f[_0xfbe2('0x1d')];var _0x45b52e=_0x4679e1?0x0:_0x1f5483[_0xfbe2('0x1e')];var _0x4daeb4=_0x4679e1?_0x4d6e7f[_0xfbe2('0x1d')]:_0x1f5483[_0xfbe2('0x1e')]+_0x1f5483[_0xfbe2('0x1c')];var _0x4fdece;if(_0x4daeb4>=_0x2153df){_0x4daeb4=_0x2153df;_0x4fdece=0xc8;}else{_0x4fdece=0xce;}_0x444660['status'](_0x4fdece);return _0x444660['set']('Content-Range',_0x45b52e+'-'+_0x4daeb4+'/'+_0x2153df)[_0xfbe2('0x1a')](_0x4d6e7f);}return null;};}function patchUpdates(_0x45c60a){return function(_0x3f8991){try{jsonpatch[_0xfbe2('0x1f')](_0x3f8991,_0x45c60a,!![]);}catch(_0x477fd4){return BPromise[_0xfbe2('0x20')](_0x477fd4);}return _0x3f8991[_0xfbe2('0x21')]();};}function saveUpdates(_0xed65f3,_0x562e9d){return function(_0x3f232b){if(_0x3f232b){return _0x3f232b[_0xfbe2('0x22')](_0xed65f3)[_0xfbe2('0x23')](function(_0x28a95a){return _0x28a95a;});}return null;};}function removeEntity(_0x125ab5,_0x15fac8){return function(_0x541787){if(_0x541787){return _0x541787[_0xfbe2('0x24')]()[_0xfbe2('0x23')](function(){_0x125ab5[_0xfbe2('0x18')](0xcc)[_0xfbe2('0x19')]();});}};}function handleEntityNotFound(_0x50d9ef,_0x2c304f){return function(_0x2e6c1c){if(!_0x2e6c1c){_0x50d9ef[_0xfbe2('0x17')](0x194);}return _0x2e6c1c;};}function handleError(_0x341e26,_0x288f88){_0x288f88=_0x288f88||0x1f4;return function(_0x49758d){logger[_0xfbe2('0x25')](_0x49758d[_0xfbe2('0x26')]);if(_0x49758d[_0xfbe2('0x27')]){delete _0x49758d[_0xfbe2('0x27')];}_0x341e26[_0xfbe2('0x18')](_0x288f88)[_0xfbe2('0x28')](_0x49758d);};}exports[_0xfbe2('0x29')]=function(_0x5c9f2c,_0x444f6d){var _0x17027e={},_0x1194b3={},_0x45c55c={'count':0x0,'rows':[]};var _0x5ddb62=_['map'](db[_0xfbe2('0x2a')][_0xfbe2('0x2b')],function(_0x2853d3){return{'name':_0x2853d3[_0xfbe2('0x2c')],'type':_0x2853d3['type'][_0xfbe2('0x2d')]};});_0x1194b3[_0xfbe2('0x2e')]=_[_0xfbe2('0x2f')](_0x5ddb62,_0xfbe2('0x27'));_0x1194b3[_0xfbe2('0x30')]=_[_0xfbe2('0x31')](_0x5c9f2c[_0xfbe2('0x30')]);_0x1194b3[_0xfbe2('0x32')]=_[_0xfbe2('0x33')](_0x1194b3['model'],_0x1194b3[_0xfbe2('0x30')]);_0x17027e[_0xfbe2('0x34')]=_[_0xfbe2('0x33')](_0x1194b3[_0xfbe2('0x2e')],qs[_0xfbe2('0x35')](_0x5c9f2c['query']['fields']));_0x17027e[_0xfbe2('0x34')]=_0x17027e[_0xfbe2('0x34')][_0xfbe2('0x36')]?_0x17027e['attributes']:_0x1194b3[_0xfbe2('0x2e')];if(!_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x37')](_0xfbe2('0x38'))){_0x17027e[_0xfbe2('0x1c')]=qs['limit'](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x1c')]);_0x17027e[_0xfbe2('0x1e')]=qs[_0xfbe2('0x1e')](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x1e')]);}_0x17027e['order']=qs[_0xfbe2('0x39')](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x39')]);_0x17027e[_0xfbe2('0x3a')]=qs['filters'](_['pick'](_0x5c9f2c['query'],_0x1194b3[_0xfbe2('0x32')]),_0x5ddb62);if(_0x5c9f2c['query']['filter']){_0x17027e[_0xfbe2('0x3a')]=_[_0xfbe2('0x3b')](_0x17027e[_0xfbe2('0x3a')],{'$or':_[_0xfbe2('0x2f')](_0x5ddb62,function(_0xc1225a){if(_0xc1225a[_0xfbe2('0x3c')]!==_0xfbe2('0x3d')){var _0x33bafc={};_0x33bafc[_0xc1225a[_0xfbe2('0x27')]]={'$like':'%'+_0x5c9f2c['query'][_0xfbe2('0x3e')]+'%'};return _0x33bafc;}})});}_0x17027e=_['merge']({},_0x17027e,_0x5c9f2c['options']);var _0x5f4574={'where':_0x17027e['where']};return db[_0xfbe2('0x2a')][_0xfbe2('0x1d')](_0x5f4574)[_0xfbe2('0x23')](function(_0x5eefa3){_0x45c55c['count']=_0x5eefa3;if(_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x3f')]){_0x17027e[_0xfbe2('0x40')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x17027e);})[_0xfbe2('0x23')](function(_0x5ec72b){_0x45c55c[_0xfbe2('0x41')]=_0x5ec72b;return _0x45c55c;})[_0xfbe2('0x23')](respondWithFilteredResult(_0x444f6d,_0x17027e))['catch'](handleError(_0x444f6d,null));};exports['show']=function(_0x4d3222,_0x3186e3){var _0x5acf0b={'raw':!![],'where':{'id':_0x4d3222[_0xfbe2('0x42')]['id']}},_0x548fdf={};_0x548fdf[_0xfbe2('0x2e')]=_[_0xfbe2('0x31')](db[_0xfbe2('0x2a')][_0xfbe2('0x2b')]);_0x548fdf[_0xfbe2('0x30')]=_['keys'](_0x4d3222[_0xfbe2('0x30')]);_0x548fdf['filters']=_[_0xfbe2('0x33')](_0x548fdf[_0xfbe2('0x2e')],_0x548fdf[_0xfbe2('0x30')]);_0x5acf0b[_0xfbe2('0x34')]=_[_0xfbe2('0x33')](_0x548fdf[_0xfbe2('0x2e')],qs['fields'](_0x4d3222[_0xfbe2('0x30')][_0xfbe2('0x35')]));_0x5acf0b[_0xfbe2('0x34')]=_0x5acf0b[_0xfbe2('0x34')]['length']?_0x5acf0b[_0xfbe2('0x34')]:_0x548fdf[_0xfbe2('0x2e')];if(_0x4d3222[_0xfbe2('0x30')][_0xfbe2('0x3f')]){_0x5acf0b['include']=[{'all':!![]}];}_0x5acf0b=_[_0xfbe2('0x3b')]({},_0x5acf0b,_0x4d3222[_0xfbe2('0x43')]);return db[_0xfbe2('0x2a')][_0xfbe2('0x44')](_0x5acf0b)[_0xfbe2('0x23')](handleEntityNotFound(_0x3186e3,null))[_0xfbe2('0x23')](respondWithResult(_0x3186e3,null))[_0xfbe2('0x45')](handleError(_0x3186e3,null));};exports['create']=function(_0x163e8b,_0x309362){return db['SmsQueueReport'][_0xfbe2('0x46')](_0x163e8b['body'],{})[_0xfbe2('0x23')](respondWithResult(_0x309362,0xc9))[_0xfbe2('0x45')](handleError(_0x309362,null));};exports[_0xfbe2('0x22')]=function(_0x5359ed,_0x2e3165){if(_0x5359ed[_0xfbe2('0x47')]['id']){delete _0x5359ed[_0xfbe2('0x47')]['id'];}return db['SmsQueueReport'][_0xfbe2('0x44')]({'where':{'id':_0x5359ed['params']['id']}})[_0xfbe2('0x23')](handleEntityNotFound(_0x2e3165,null))['then'](saveUpdates(_0x5359ed[_0xfbe2('0x47')],null))['then'](respondWithResult(_0x2e3165,null))['catch'](handleError(_0x2e3165,null));};exports[_0xfbe2('0x24')]=function(_0x458603,_0x2ce1ed){return db[_0xfbe2('0x2a')][_0xfbe2('0x44')]({'where':{'id':_0x458603[_0xfbe2('0x42')]['id']}})[_0xfbe2('0x23')](handleEntityNotFound(_0x2ce1ed,null))['then'](removeEntity(_0x2ce1ed,null))[_0xfbe2('0x45')](handleError(_0x2ce1ed,null));};exports[_0xfbe2('0x48')]=function(_0x10d64c,_0x503a4d){return db[_0xfbe2('0x2a')]['describe']()[_0xfbe2('0x23')](respondWithResult(_0x503a4d,null))[_0xfbe2('0x45')](handleError(_0x503a4d,null));}; \ No newline at end of file +var _0xd43b=['include','rows','params','keys','intersection','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','destroy','then','error','stack','name','send','index','SmsQueueReport','rawAttributes','type','key','model','map','filters','query','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x4f7da1,_0x21ae99){var _0x5473f4=function(_0x2c5adc){while(--_0x2c5adc){_0x4f7da1['push'](_0x4f7da1['shift']());}};_0x5473f4(++_0x21ae99);}(_0xd43b,0x19c));var _0xbd43=function(_0x20baf1,_0x5e2836){_0x20baf1=_0x20baf1-0x0;var _0x34162b=_0xd43b[_0x20baf1];return _0x34162b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd43('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd43('0x1'));var rp=require(_0xbd43('0x2'));var moment=require('moment');var BPromise=require(_0xbd43('0x3'));var Mustache=require(_0xbd43('0x4'));var util=require('util');var path=require(_0xbd43('0x5'));var sox=require(_0xbd43('0x6'));var csv=require(_0xbd43('0x7'));var ejs=require(_0xbd43('0x8'));var fs=require('fs');var fs_extra=require(_0xbd43('0x9'));var _=require('lodash');var squel=require(_0xbd43('0xa'));var crypto=require(_0xbd43('0xb'));var jsforce=require(_0xbd43('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbd43('0x7'));var querystring=require('querystring');var Papa=require(_0xbd43('0xd'));var Redis=require(_0xbd43('0xe'));var authService=require(_0xbd43('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd43('0x10'));var logger=require('../../config/logger')(_0xbd43('0x11'));var utils=require(_0xbd43('0x12'));var config=require(_0xbd43('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd43('0x14'))['db'];function respondWithStatusCode(_0x336106,_0x15cfa7){_0x15cfa7=_0x15cfa7||0xcc;return function(_0x308e69){if(_0x308e69){return _0x336106['sendStatus'](_0x15cfa7);}return _0x336106[_0xbd43('0x15')](_0x15cfa7)[_0xbd43('0x16')]();};}function respondWithResult(_0x300318,_0x1fb664){_0x1fb664=_0x1fb664||0xc8;return function(_0x1f6299){if(_0x1f6299){return _0x300318['status'](_0x1fb664)['json'](_0x1f6299);}};}function respondWithFilteredResult(_0x912e6a,_0x22d25e){return function(_0x2dc055){if(_0x2dc055){var _0x114e2d=typeof _0x22d25e[_0xbd43('0x17')]==='undefined'&&typeof _0x22d25e[_0xbd43('0x18')]===_0xbd43('0x19');var _0x4552e6=_0x2dc055['count'];var _0x41f7ff=_0x114e2d?0x0:_0x22d25e[_0xbd43('0x17')];var _0x339d2a=_0x114e2d?_0x2dc055[_0xbd43('0x1a')]:_0x22d25e['offset']+_0x22d25e['limit'];var _0x19a41a;if(_0x339d2a>=_0x4552e6){_0x339d2a=_0x4552e6;_0x19a41a=0xc8;}else{_0x19a41a=0xce;}_0x912e6a[_0xbd43('0x15')](_0x19a41a);return _0x912e6a[_0xbd43('0x1b')](_0xbd43('0x1c'),_0x41f7ff+'-'+_0x339d2a+'/'+_0x4552e6)[_0xbd43('0x1d')](_0x2dc055);}return null;};}function patchUpdates(_0x1475fd){return function(_0x551ac6){try{jsonpatch[_0xbd43('0x1e')](_0x551ac6,_0x1475fd,!![]);}catch(_0x1e20c2){return BPromise['reject'](_0x1e20c2);}return _0x551ac6[_0xbd43('0x1f')]();};}function saveUpdates(_0x2f77fe,_0x178b4c){return function(_0x1c550b){if(_0x1c550b){return _0x1c550b['update'](_0x2f77fe)['then'](function(_0x5d3251){return _0x5d3251;});}return null;};}function removeEntity(_0x3bafff,_0x26d286){return function(_0x706f29){if(_0x706f29){return _0x706f29[_0xbd43('0x20')]()[_0xbd43('0x21')](function(){_0x3bafff['status'](0xcc)[_0xbd43('0x16')]();});}};}function handleEntityNotFound(_0x1f404e,_0xe9520c){return function(_0x4ec959){if(!_0x4ec959){_0x1f404e['sendStatus'](0x194);}return _0x4ec959;};}function handleError(_0x143fcb,_0x210829){_0x210829=_0x210829||0x1f4;return function(_0x5d0ecf){logger[_0xbd43('0x22')](_0x5d0ecf[_0xbd43('0x23')]);if(_0x5d0ecf[_0xbd43('0x24')]){delete _0x5d0ecf['name'];}_0x143fcb[_0xbd43('0x15')](_0x210829)[_0xbd43('0x25')](_0x5d0ecf);};}exports[_0xbd43('0x26')]=function(_0x12bb87,_0x6e6afb){var _0x282f49={},_0x2c0ace={},_0x541595={'count':0x0,'rows':[]};var _0x259b36=_['map'](db[_0xbd43('0x27')][_0xbd43('0x28')],function(_0x43703d){return{'name':_0x43703d['fieldName'],'type':_0x43703d[_0xbd43('0x29')][_0xbd43('0x2a')]};});_0x2c0ace[_0xbd43('0x2b')]=_[_0xbd43('0x2c')](_0x259b36,'name');_0x2c0ace['query']=_['keys'](_0x12bb87['query']);_0x2c0ace[_0xbd43('0x2d')]=_['intersection'](_0x2c0ace[_0xbd43('0x2b')],_0x2c0ace[_0xbd43('0x2e')]);_0x282f49[_0xbd43('0x2f')]=_['intersection'](_0x2c0ace[_0xbd43('0x2b')],qs[_0xbd43('0x30')](_0x12bb87[_0xbd43('0x2e')][_0xbd43('0x30')]));_0x282f49[_0xbd43('0x2f')]=_0x282f49[_0xbd43('0x2f')][_0xbd43('0x31')]?_0x282f49[_0xbd43('0x2f')]:_0x2c0ace[_0xbd43('0x2b')];if(!_0x12bb87[_0xbd43('0x2e')]['hasOwnProperty'](_0xbd43('0x32'))){_0x282f49[_0xbd43('0x18')]=qs[_0xbd43('0x18')](_0x12bb87['query']['limit']);_0x282f49[_0xbd43('0x17')]=qs[_0xbd43('0x17')](_0x12bb87[_0xbd43('0x2e')]['offset']);}_0x282f49['order']=qs[_0xbd43('0x33')](_0x12bb87[_0xbd43('0x2e')][_0xbd43('0x33')]);_0x282f49[_0xbd43('0x34')]=qs['filters'](_['pick'](_0x12bb87['query'],_0x2c0ace['filters']),_0x259b36);if(_0x12bb87['query'][_0xbd43('0x35')]){_0x282f49[_0xbd43('0x34')]=_[_0xbd43('0x36')](_0x282f49['where'],{'$or':_[_0xbd43('0x2c')](_0x259b36,function(_0x4a1dfb){if(_0x4a1dfb[_0xbd43('0x29')]!==_0xbd43('0x37')){var _0x572704={};_0x572704[_0x4a1dfb['name']]={'$like':'%'+_0x12bb87[_0xbd43('0x2e')][_0xbd43('0x35')]+'%'};return _0x572704;}})});}_0x282f49=_[_0xbd43('0x36')]({},_0x282f49,_0x12bb87[_0xbd43('0x38')]);var _0x426909={'where':_0x282f49[_0xbd43('0x34')]};return db[_0xbd43('0x27')]['count'](_0x426909)[_0xbd43('0x21')](function(_0x11d451){_0x541595[_0xbd43('0x1a')]=_0x11d451;if(_0x12bb87[_0xbd43('0x2e')]['includeAll']){_0x282f49[_0xbd43('0x39')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x282f49);})[_0xbd43('0x21')](function(_0x523f6f){_0x541595[_0xbd43('0x3a')]=_0x523f6f;return _0x541595;})[_0xbd43('0x21')](respondWithFilteredResult(_0x6e6afb,_0x282f49))['catch'](handleError(_0x6e6afb,null));};exports['show']=function(_0x5daf08,_0x6126fc){var _0x56e018={'raw':!![],'where':{'id':_0x5daf08[_0xbd43('0x3b')]['id']}},_0x492cde={};_0x492cde[_0xbd43('0x2b')]=_['keys'](db[_0xbd43('0x27')][_0xbd43('0x28')]);_0x492cde[_0xbd43('0x2e')]=_[_0xbd43('0x3c')](_0x5daf08[_0xbd43('0x2e')]);_0x492cde[_0xbd43('0x2d')]=_[_0xbd43('0x3d')](_0x492cde[_0xbd43('0x2b')],_0x492cde[_0xbd43('0x2e')]);_0x56e018[_0xbd43('0x2f')]=_[_0xbd43('0x3d')](_0x492cde['model'],qs['fields'](_0x5daf08[_0xbd43('0x2e')][_0xbd43('0x30')]));_0x56e018[_0xbd43('0x2f')]=_0x56e018[_0xbd43('0x2f')]['length']?_0x56e018[_0xbd43('0x2f')]:_0x492cde[_0xbd43('0x2b')];if(_0x5daf08[_0xbd43('0x2e')]['includeAll']){_0x56e018[_0xbd43('0x39')]=[{'all':!![]}];}_0x56e018=_[_0xbd43('0x36')]({},_0x56e018,_0x5daf08['options']);return db[_0xbd43('0x27')][_0xbd43('0x3e')](_0x56e018)['then'](handleEntityNotFound(_0x6126fc,null))[_0xbd43('0x21')](respondWithResult(_0x6126fc,null))[_0xbd43('0x3f')](handleError(_0x6126fc,null));};exports[_0xbd43('0x40')]=function(_0x5f55e6,_0x2f3bc1){return db[_0xbd43('0x27')][_0xbd43('0x40')](_0x5f55e6[_0xbd43('0x41')],{})[_0xbd43('0x21')](respondWithResult(_0x2f3bc1,0xc9))['catch'](handleError(_0x2f3bc1,null));};exports['update']=function(_0x41e652,_0x4d5a55){if(_0x41e652[_0xbd43('0x41')]['id']){delete _0x41e652[_0xbd43('0x41')]['id'];}return db[_0xbd43('0x27')]['find']({'where':{'id':_0x41e652[_0xbd43('0x3b')]['id']}})[_0xbd43('0x21')](handleEntityNotFound(_0x4d5a55,null))['then'](saveUpdates(_0x41e652[_0xbd43('0x41')],null))['then'](respondWithResult(_0x4d5a55,null))[_0xbd43('0x3f')](handleError(_0x4d5a55,null));};exports[_0xbd43('0x20')]=function(_0x5f05da,_0x41bc36){return db[_0xbd43('0x27')][_0xbd43('0x3e')]({'where':{'id':_0x5f05da[_0xbd43('0x3b')]['id']}})[_0xbd43('0x21')](handleEntityNotFound(_0x41bc36,null))['then'](removeEntity(_0x41bc36,null))[_0xbd43('0x3f')](handleError(_0x41bc36,null));};exports['describe']=function(_0x489dd6,_0x3a3859){return db[_0xbd43('0x27')][_0xbd43('0x42')]()[_0xbd43('0x21')](respondWithResult(_0x3a3859,null))[_0xbd43('0x3f')](handleError(_0x3a3859,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3715e56..e67daa7 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x17f732,_0x20456f){var _0x5a0e67=function(_0x1ea071){while(--_0x1ea071){_0x17f732['push'](_0x17f732['shift']());}};_0x5a0e67(++_0x20456f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x27dafb,_0x40c7cb){var _0xffe081=function(_0x818dd7){while(--_0x818dd7){_0x27dafb['push'](_0x27dafb['shift']());}};_0xffe081(++_0x40c7cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xcb91[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 2f415a5..7a2bbb3 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 _0xe907=['UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','create','body','options','raw'];(function(_0x512917,_0x26f761){var _0x7375bf=function(_0x5cdb55){while(--_0x5cdb55){_0x512917['push'](_0x512917['shift']());}};_0x7375bf(++_0x26f761);}(_0xe907,0xd9));var _0x7e90=function(_0x26bb87,_0x16a44f){_0x26bb87=_0x26bb87-0x0;var _0xd7aabd=_0xe907[_0x26bb87];return _0xd7aabd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e90('0x0'));var BPromise=require(_0x7e90('0x1'));var rs=require(_0x7e90('0x2'));var fs=require('fs');var Redis=require(_0x7e90('0x3'));var db=require(_0x7e90('0x4'))['db'];var utils=require(_0x7e90('0x5'));var logger=require(_0x7e90('0x6'))(_0x7e90('0x7'));var config=require(_0x7e90('0x8'));var jayson=require(_0x7e90('0x9'));var client=jayson[_0x7e90('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411b80,_0x168a31,_0x3ae37e){return new BPromise(function(_0x2f94fd,_0x1b94c4){return client[_0x7e90('0xb')](_0x411b80,_0x3ae37e)[_0x7e90('0xc')](function(_0x520c93){logger[_0x7e90('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x168a31,_0x7e90('0xe'));logger['debug'](_0x7e90('0xf'),_0x168a31,_0x7e90('0xe'),JSON[_0x7e90('0x10')](_0x520c93));if(_0x520c93['error']){if(_0x520c93[_0x7e90('0x11')][_0x7e90('0x12')]===0x1f4){logger[_0x7e90('0x11')](_0x7e90('0x13'),_0x168a31,_0x520c93['error'][_0x7e90('0x14')]);return _0x1b94c4(_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);}logger[_0x7e90('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x168a31,_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);return _0x2f94fd(_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);}else{logger[_0x7e90('0xd')](_0x7e90('0x13'),_0x168a31,_0x7e90('0xe'));_0x2f94fd(_0x520c93[_0x7e90('0x15')][_0x7e90('0x14')]);}})[_0x7e90('0x16')](function(_0x5e13a8){logger[_0x7e90('0x11')](_0x7e90('0x13'),_0x168a31,_0x5e13a8);_0x1b94c4(_0x5e13a8);});});}exports[_0x7e90('0x17')]=function(_0x510b75){var _0x3ef04e=this;return new Promise(function(_0x34398e,_0x127a01){return db['SmsQueueReport'][_0x7e90('0x18')](_0x510b75[_0x7e90('0x19')],{'raw':_0x510b75['options']?_0x510b75[_0x7e90('0x1a')][_0x7e90('0x1b')]===undefined?!![]:![]:!![]})[_0x7e90('0xc')](function(_0x1e5164){logger['info'](_0x7e90('0x17'),_0x510b75);logger['debug']('CreateSmsQueueReport',_0x510b75,JSON[_0x7e90('0x10')](_0x1e5164));_0x34398e(_0x1e5164);})[_0x7e90('0x16')](function(_0x5f5a1c){logger[_0x7e90('0x11')](_0x7e90('0x17'),_0x5f5a1c[_0x7e90('0x14')],_0x510b75);_0x127a01(_0x3ef04e[_0x7e90('0x11')](0x1f4,_0x5f5a1c[_0x7e90('0x14')]));});});};exports[_0x7e90('0x1c')]=function(_0x50bbc5){var _0x464d3c=this;return new Promise(function(_0x30d7dc,_0x53c7ee){return db[_0x7e90('0x1d')][_0x7e90('0x1e')](_0x50bbc5[_0x7e90('0x19')],{'raw':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x1f')]||null:null,'attributes':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x20')]||null:null,'limit':_0x50bbc5['options']?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x21')]||null:null})[_0x7e90('0xc')](function(_0x43d881){logger[_0x7e90('0xd')]('UpdateSmsQueueReport',_0x50bbc5);logger[_0x7e90('0x22')](_0x7e90('0x1c'),_0x50bbc5,JSON[_0x7e90('0x10')](_0x43d881));_0x30d7dc(_0x43d881);})[_0x7e90('0x16')](function(_0x55c975){logger[_0x7e90('0x11')](_0x7e90('0x1c'),_0x55c975[_0x7e90('0x14')],_0x50bbc5);_0x53c7ee(_0x464d3c[_0x7e90('0x11')](0x1f4,_0x55c975['message']));});});}; \ No newline at end of file +var _0xbe98=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0x3bdc30,_0x119486){var _0x1a4986=function(_0x4a2ed0){while(--_0x4a2ed0){_0x3bdc30['push'](_0x3bdc30['shift']());}};_0x1a4986(++_0x119486);}(_0xbe98,0x1f2));var _0x8be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe98[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8be9('0x0'));var util=require(_0x8be9('0x1'));var moment=require(_0x8be9('0x2'));var BPromise=require(_0x8be9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8be9('0x4'));var db=require(_0x8be9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8be9('0x6'))(_0x8be9('0x7'));var config=require(_0x8be9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8be9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25aa48,_0x839746,_0x16cf0e){return new BPromise(function(_0x21c837,_0x444101){return client[_0x8be9('0xa')](_0x25aa48,_0x16cf0e)[_0x8be9('0xb')](function(_0x290e4d){logger[_0x8be9('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x839746,_0x8be9('0xd'));logger[_0x8be9('0xe')](_0x8be9('0xf'),_0x839746,_0x8be9('0xd'),JSON[_0x8be9('0x10')](_0x290e4d));if(_0x290e4d[_0x8be9('0x11')]){if(_0x290e4d['error'][_0x8be9('0x12')]===0x1f4){logger[_0x8be9('0x11')](_0x8be9('0x13'),_0x839746,_0x290e4d['error'][_0x8be9('0x14')]);return _0x444101(_0x290e4d['error'][_0x8be9('0x14')]);}logger[_0x8be9('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x839746,_0x290e4d[_0x8be9('0x11')][_0x8be9('0x14')]);return _0x21c837(_0x290e4d[_0x8be9('0x11')][_0x8be9('0x14')]);}else{logger['info'](_0x8be9('0x13'),_0x839746,_0x8be9('0xd'));_0x21c837(_0x290e4d[_0x8be9('0x15')][_0x8be9('0x14')]);}})[_0x8be9('0x16')](function(_0x4ad81d){logger['error'](_0x8be9('0x13'),_0x839746,_0x4ad81d);_0x444101(_0x4ad81d);});});}exports[_0x8be9('0x17')]=function(_0x2870de){var _0x42283d=this;return new Promise(function(_0x5729c9,_0x530b00){return db['SmsQueueReport']['create'](_0x2870de[_0x8be9('0x18')],{'raw':_0x2870de['options']?_0x2870de[_0x8be9('0x19')][_0x8be9('0x1a')]===undefined?!![]:![]:!![]})[_0x8be9('0xb')](function(_0xc43cdf){logger[_0x8be9('0xc')](_0x8be9('0x17'),_0x2870de);logger['debug'](_0x8be9('0x17'),_0x2870de,JSON['stringify'](_0xc43cdf));_0x5729c9(_0xc43cdf);})[_0x8be9('0x16')](function(_0x4cd36d){logger[_0x8be9('0x11')](_0x8be9('0x17'),_0x4cd36d[_0x8be9('0x14')],_0x2870de);_0x530b00(_0x42283d[_0x8be9('0x11')](0x1f4,_0x4cd36d[_0x8be9('0x14')]));});});};exports[_0x8be9('0x1b')]=function(_0x2e9f04){var _0x2f1b23=this;return new Promise(function(_0xb84a5c,_0x23d14e){return db[_0x8be9('0x1c')][_0x8be9('0x1d')](_0x2e9f04[_0x8be9('0x18')],{'raw':_0x2e9f04[_0x8be9('0x19')]?_0x2e9f04[_0x8be9('0x19')][_0x8be9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9f04[_0x8be9('0x19')]?_0x2e9f04[_0x8be9('0x19')][_0x8be9('0x1e')]||null:null,'attributes':_0x2e9f04[_0x8be9('0x19')]?_0x2e9f04['options'][_0x8be9('0x1f')]||null:null,'limit':_0x2e9f04[_0x8be9('0x19')]?_0x2e9f04['options']['limit']||null:null})[_0x8be9('0xb')](function(_0xd22313){logger[_0x8be9('0xc')](_0x8be9('0x1b'),_0x2e9f04);logger[_0x8be9('0xe')]('UpdateSmsQueueReport',_0x2e9f04,JSON[_0x8be9('0x10')](_0xd22313));_0xb84a5c(_0xd22313);})['catch'](function(_0x406bf2){logger[_0x8be9('0x11')](_0x8be9('0x1b'),_0x406bf2[_0x8be9('0x14')],_0x2e9f04);_0x23d14e(_0x2f1b23['error'](0x1f4,_0x406bf2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index df2cdf9..a3d60b5 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 _0x9649=['connect-timeout','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x3ea8eb,_0x238288){var _0x23b525=function(_0x5e9efc){while(--_0x5e9efc){_0x3ea8eb['push'](_0x3ea8eb['shift']());}};_0x23b525(++_0x238288);}(_0x9649,0x19f));var _0x9964=function(_0x238565,_0x50fdcb){_0x238565=_0x238565-0x0;var _0x59c353=_0x9649[_0x238565];return _0x59c353;};'use strict';var multer=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var path=require(_0x9964('0x2'));var timeout=require(_0x9964('0x3'));var express=require('express');var router=express[_0x9964('0x4')]();var fs_extra=require(_0x9964('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9964('0x6'));var config=require('../../config/environment');var controller=require(_0x9964('0x7'));router[_0x9964('0x8')]('/',auth[_0x9964('0x9')](),controller[_0x9964('0xa')]);router[_0x9964('0x8')](_0x9964('0xb'),auth[_0x9964('0x9')](),controller['describe']);router[_0x9964('0x8')](_0x9964('0xc'),auth['isAuthenticated'](),controller[_0x9964('0xd')]);router[_0x9964('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9964('0xf')](_0x9964('0xc'),auth[_0x9964('0x9')](),controller[_0x9964('0x10')]);router[_0x9964('0x11')]('/:id',auth[_0x9964('0x9')](),controller['destroy']);module[_0x9964('0x12')]=router; \ No newline at end of file +var _0xa41a=['/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe'];(function(_0x221dba,_0x350fb4){var _0x333201=function(_0x4d30c8){while(--_0x4d30c8){_0x221dba['push'](_0x221dba['shift']());}};_0x333201(++_0x350fb4);}(_0xa41a,0x6b));var _0xaa41=function(_0x93f498,_0x18df6b){_0x93f498=_0x93f498-0x0;var _0x20bae1=_0xa41a[_0x93f498];return _0x20bae1;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')]('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['update']);router[_0xaa41('0x12')](_0xaa41('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa41('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8822c09..2e3ec42 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5b2cd5,_0x5caa0f){var _0x45e9aa=function(_0x147280){while(--_0x147280){_0x5b2cd5['push'](_0x5b2cd5['shift']());}};_0x45e9aa(++_0x5caa0f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xf2662b,_0x4d8f41){var _0x257dc7=function(_0x46b1d1){while(--_0x46b1d1){_0xf2662b['push'](_0xf2662b['shift']());}};_0x257dc7(++_0x4d8f41);}(_0x54ef,0x112));var _0xf54e=function(_0x39d890,_0x239c07){_0x39d890=_0x39d890-0x0;var _0x30890b=_0x54ef[_0x39d890];return _0x30890b;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b6c9111..2648bb9 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 _0x636d=['includeAll','rows','catch','show','params','rawAttributes','merge','find','create','body','destroy','describe','eml-format','zip-dir','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/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','sendStatus','error','name','send','index','SmsTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','filters','pick','filter','where','map','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x636d,0xa0));var _0xd636=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x636d[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xd636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd636('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd636('0x2'));var moment=require('moment');var BPromise=require(_0xd636('0x3'));var Mustache=require(_0xd636('0x4'));var util=require(_0xd636('0x5'));var path=require(_0xd636('0x6'));var sox=require('sox');var csv=require(_0xd636('0x7'));var ejs=require(_0xd636('0x8'));var fs=require('fs');var fs_extra=require(_0xd636('0x9'));var _=require(_0xd636('0xa'));var squel=require(_0xd636('0xb'));var crypto=require(_0xd636('0xc'));var jsforce=require(_0xd636('0xd'));var deskjs=require(_0xd636('0xe'));var toCsv=require(_0xd636('0x7'));var querystring=require(_0xd636('0xf'));var Papa=require(_0xd636('0x10'));var Redis=require(_0xd636('0x11'));var authService=require(_0xd636('0x12'));var qs=require(_0xd636('0x13'));var as=require(_0xd636('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd636('0x15'));var utils=require(_0xd636('0x16'));var config=require(_0xd636('0x17'));var licenseUtil=require(_0xd636('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a60ab,_0x58c622){_0x58c622=_0x58c622||0xcc;return function(_0x1f09e2){if(_0x1f09e2){return _0x1a60ab['sendStatus'](_0x58c622);}return _0x1a60ab[_0xd636('0x19')](_0x58c622)[_0xd636('0x1a')]();};}function respondWithResult(_0x425fca,_0x33992d){_0x33992d=_0x33992d||0xc8;return function(_0x4435b2){if(_0x4435b2){return _0x425fca[_0xd636('0x19')](_0x33992d)['json'](_0x4435b2);}};}function respondWithFilteredResult(_0x337703,_0x21d455){return function(_0x1f084d){if(_0x1f084d){var _0x37bb85=typeof _0x21d455['offset']===_0xd636('0x1b')&&typeof _0x21d455[_0xd636('0x1c')]==='undefined';var _0xa0fb38=_0x1f084d[_0xd636('0x1d')];var _0x2a40ec=_0x37bb85?0x0:_0x21d455[_0xd636('0x1e')];var _0x5b3e3e=_0x37bb85?_0x1f084d['count']:_0x21d455[_0xd636('0x1e')]+_0x21d455[_0xd636('0x1c')];var _0x332a35;if(_0x5b3e3e>=_0xa0fb38){_0x5b3e3e=_0xa0fb38;_0x332a35=0xc8;}else{_0x332a35=0xce;}_0x337703[_0xd636('0x19')](_0x332a35);return _0x337703[_0xd636('0x1f')]('Content-Range',_0x2a40ec+'-'+_0x5b3e3e+'/'+_0xa0fb38)[_0xd636('0x20')](_0x1f084d);}return null;};}function patchUpdates(_0x2c1ad4){return function(_0x889830){try{jsonpatch[_0xd636('0x21')](_0x889830,_0x2c1ad4,!![]);}catch(_0x4eeb13){return BPromise[_0xd636('0x22')](_0x4eeb13);}return _0x889830[_0xd636('0x23')]();};}function saveUpdates(_0x3e52f2,_0x3a7d9a){return function(_0x83e19a){if(_0x83e19a){return _0x83e19a[_0xd636('0x24')](_0x3e52f2)[_0xd636('0x25')](function(_0x1c0f81){return _0x1c0f81;});}return null;};}function removeEntity(_0x100878,_0x265637){return function(_0x4a8f95){if(_0x4a8f95){return _0x4a8f95['destroy']()[_0xd636('0x25')](function(){_0x100878['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12735c,_0x22613a){return function(_0x2ad316){if(!_0x2ad316){_0x12735c[_0xd636('0x26')](0x194);}return _0x2ad316;};}function handleError(_0x38707c,_0x531aa0){_0x531aa0=_0x531aa0||0x1f4;return function(_0x214fff){logger[_0xd636('0x27')](_0x214fff['stack']);if(_0x214fff['name']){delete _0x214fff[_0xd636('0x28')];}_0x38707c['status'](_0x531aa0)[_0xd636('0x29')](_0x214fff);};}exports[_0xd636('0x2a')]=function(_0x442fb8,_0x3efd93){var _0x578ae2={},_0x379bcf={},_0x13a654={'count':0x0,'rows':[]};var _0xbdff6c=_['map'](db[_0xd636('0x2b')]['rawAttributes'],function(_0x3c7c62){return{'name':_0x3c7c62[_0xd636('0x2c')],'type':_0x3c7c62[_0xd636('0x2d')][_0xd636('0x2e')]};});_0x379bcf[_0xd636('0x2f')]=_['map'](_0xbdff6c,_0xd636('0x28'));_0x379bcf[_0xd636('0x30')]=_[_0xd636('0x31')](_0x442fb8[_0xd636('0x30')]);_0x379bcf['filters']=_[_0xd636('0x32')](_0x379bcf['model'],_0x379bcf[_0xd636('0x30')]);_0x578ae2[_0xd636('0x33')]=_['intersection'](_0x379bcf[_0xd636('0x2f')],qs['fields'](_0x442fb8['query'][_0xd636('0x34')]));_0x578ae2[_0xd636('0x33')]=_0x578ae2[_0xd636('0x33')][_0xd636('0x35')]?_0x578ae2['attributes']:_0x379bcf[_0xd636('0x2f')];if(!_0x442fb8[_0xd636('0x30')]['hasOwnProperty']('nolimit')){_0x578ae2[_0xd636('0x1c')]=qs['limit'](_0x442fb8[_0xd636('0x30')][_0xd636('0x1c')]);_0x578ae2[_0xd636('0x1e')]=qs[_0xd636('0x1e')](_0x442fb8[_0xd636('0x30')][_0xd636('0x1e')]);}_0x578ae2['order']=qs[_0xd636('0x36')](_0x442fb8['query'][_0xd636('0x36')]);_0x578ae2['where']=qs[_0xd636('0x37')](_[_0xd636('0x38')](_0x442fb8[_0xd636('0x30')],_0x379bcf['filters']),_0xbdff6c);if(_0x442fb8[_0xd636('0x30')][_0xd636('0x39')]){_0x578ae2[_0xd636('0x3a')]=_['merge'](_0x578ae2[_0xd636('0x3a')],{'$or':_[_0xd636('0x3b')](_0xbdff6c,function(_0x342c11){if(_0x342c11[_0xd636('0x2d')]!==_0xd636('0x3c')){var _0x1003fb={};_0x1003fb[_0x342c11[_0xd636('0x28')]]={'$like':'%'+_0x442fb8[_0xd636('0x30')][_0xd636('0x39')]+'%'};return _0x1003fb;}})});}_0x578ae2=_['merge']({},_0x578ae2,_0x442fb8[_0xd636('0x3d')]);var _0x2dfbce={'where':_0x578ae2[_0xd636('0x3a')]};return db[_0xd636('0x2b')]['count'](_0x2dfbce)[_0xd636('0x25')](function(_0x7171a0){_0x13a654[_0xd636('0x1d')]=_0x7171a0;if(_0x442fb8[_0xd636('0x30')][_0xd636('0x3e')]){_0x578ae2['include']=[{'all':!![]}];}return db[_0xd636('0x2b')]['findAll'](_0x578ae2);})[_0xd636('0x25')](function(_0x4baf46){_0x13a654[_0xd636('0x3f')]=_0x4baf46;return _0x13a654;})['then'](respondWithFilteredResult(_0x3efd93,_0x578ae2))[_0xd636('0x40')](handleError(_0x3efd93,null));};exports[_0xd636('0x41')]=function(_0x4796a2,_0x3d4683){var _0xd18a8f={'raw':!![],'where':{'id':_0x4796a2[_0xd636('0x42')]['id']}},_0x2a24d1={};_0x2a24d1['model']=_[_0xd636('0x31')](db[_0xd636('0x2b')][_0xd636('0x43')]);_0x2a24d1[_0xd636('0x30')]=_[_0xd636('0x31')](_0x4796a2[_0xd636('0x30')]);_0x2a24d1[_0xd636('0x37')]=_[_0xd636('0x32')](_0x2a24d1[_0xd636('0x2f')],_0x2a24d1[_0xd636('0x30')]);_0xd18a8f[_0xd636('0x33')]=_[_0xd636('0x32')](_0x2a24d1[_0xd636('0x2f')],qs['fields'](_0x4796a2[_0xd636('0x30')][_0xd636('0x34')]));_0xd18a8f[_0xd636('0x33')]=_0xd18a8f[_0xd636('0x33')][_0xd636('0x35')]?_0xd18a8f[_0xd636('0x33')]:_0x2a24d1['model'];if(_0x4796a2[_0xd636('0x30')][_0xd636('0x3e')]){_0xd18a8f['include']=[{'all':!![]}];}_0xd18a8f=_[_0xd636('0x44')]({},_0xd18a8f,_0x4796a2['options']);return db[_0xd636('0x2b')][_0xd636('0x45')](_0xd18a8f)[_0xd636('0x25')](handleEntityNotFound(_0x3d4683,null))[_0xd636('0x25')](respondWithResult(_0x3d4683,null))[_0xd636('0x40')](handleError(_0x3d4683,null));};exports[_0xd636('0x46')]=function(_0x2be92c,_0x2a8af8){return db[_0xd636('0x2b')][_0xd636('0x46')](_0x2be92c[_0xd636('0x47')],{})['then'](respondWithResult(_0x2a8af8,0xc9))[_0xd636('0x40')](handleError(_0x2a8af8,null));};exports['update']=function(_0x4d17f5,_0x333482){if(_0x4d17f5['body']['id']){delete _0x4d17f5[_0xd636('0x47')]['id'];}return db[_0xd636('0x2b')]['find']({'where':{'id':_0x4d17f5[_0xd636('0x42')]['id']}})[_0xd636('0x25')](handleEntityNotFound(_0x333482,null))[_0xd636('0x25')](saveUpdates(_0x4d17f5[_0xd636('0x47')],null))[_0xd636('0x25')](respondWithResult(_0x333482,null))['catch'](handleError(_0x333482,null));};exports[_0xd636('0x48')]=function(_0x1617b7,_0xeff7bb){return db[_0xd636('0x2b')][_0xd636('0x45')]({'where':{'id':_0x1617b7[_0xd636('0x42')]['id']}})[_0xd636('0x25')](handleEntityNotFound(_0xeff7bb,null))[_0xd636('0x25')](removeEntity(_0xeff7bb,null))[_0xd636('0x40')](handleError(_0xeff7bb,null));};exports[_0xd636('0x49')]=function(_0x138b94,_0x33867d){return db[_0xd636('0x2b')][_0xd636('0x49')]()[_0xd636('0x25')](respondWithResult(_0x33867d,null))['catch'](handleError(_0x33867d,null));}; \ No newline at end of file +var _0x9cfa=['findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','then','sendStatus','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','SmsTransferReport','include'];(function(_0x1f8789,_0x59351a){var _0x4896ba=function(_0x17dbaf){while(--_0x17dbaf){_0x1f8789['push'](_0x1f8789['shift']());}};_0x4896ba(++_0x59351a);}(_0x9cfa,0xa8));var _0xa9cf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9cfa[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9cf('0x0'));var zipdir=require(_0xa9cf('0x1'));var jsonpatch=require(_0xa9cf('0x2'));var rp=require(_0xa9cf('0x3'));var moment=require(_0xa9cf('0x4'));var BPromise=require(_0xa9cf('0x5'));var Mustache=require(_0xa9cf('0x6'));var util=require(_0xa9cf('0x7'));var path=require(_0xa9cf('0x8'));var sox=require(_0xa9cf('0x9'));var csv=require('to-csv');var ejs=require(_0xa9cf('0xa'));var fs=require('fs');var fs_extra=require(_0xa9cf('0xb'));var _=require(_0xa9cf('0xc'));var squel=require('squel');var crypto=require(_0xa9cf('0xd'));var jsforce=require(_0xa9cf('0xe'));var deskjs=require(_0xa9cf('0xf'));var toCsv=require(_0xa9cf('0x10'));var querystring=require('querystring');var Papa=require(_0xa9cf('0x11'));var Redis=require('ioredis');var authService=require(_0xa9cf('0x12'));var qs=require(_0xa9cf('0x13'));var as=require(_0xa9cf('0x14'));var hardwareService=require(_0xa9cf('0x15'));var logger=require(_0xa9cf('0x16'))(_0xa9cf('0x17'));var utils=require(_0xa9cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa9cf('0x19'))['db'];function respondWithStatusCode(_0x54d10d,_0x2a9283){_0x2a9283=_0x2a9283||0xcc;return function(_0x292c76){if(_0x292c76){return _0x54d10d['sendStatus'](_0x2a9283);}return _0x54d10d[_0xa9cf('0x1a')](_0x2a9283)[_0xa9cf('0x1b')]();};}function respondWithResult(_0x13ba93,_0x2e5dea){_0x2e5dea=_0x2e5dea||0xc8;return function(_0x545fba){if(_0x545fba){return _0x13ba93[_0xa9cf('0x1a')](_0x2e5dea)['json'](_0x545fba);}};}function respondWithFilteredResult(_0x4d7b0a,_0x4d447a){return function(_0x2b9168){if(_0x2b9168){var _0x5f5d22=typeof _0x4d447a['offset']===_0xa9cf('0x1c')&&typeof _0x4d447a[_0xa9cf('0x1d')]==='undefined';var _0x422c88=_0x2b9168[_0xa9cf('0x1e')];var _0x4c2079=_0x5f5d22?0x0:_0x4d447a[_0xa9cf('0x1f')];var _0x11e96f=_0x5f5d22?_0x2b9168[_0xa9cf('0x1e')]:_0x4d447a[_0xa9cf('0x1f')]+_0x4d447a[_0xa9cf('0x1d')];var _0x522a5d;if(_0x11e96f>=_0x422c88){_0x11e96f=_0x422c88;_0x522a5d=0xc8;}else{_0x522a5d=0xce;}_0x4d7b0a['status'](_0x522a5d);return _0x4d7b0a[_0xa9cf('0x20')](_0xa9cf('0x21'),_0x4c2079+'-'+_0x11e96f+'/'+_0x422c88)[_0xa9cf('0x22')](_0x2b9168);}return null;};}function patchUpdates(_0x2ae83a){return function(_0x199797){try{jsonpatch[_0xa9cf('0x23')](_0x199797,_0x2ae83a,!![]);}catch(_0x4f368e){return BPromise[_0xa9cf('0x24')](_0x4f368e);}return _0x199797['save']();};}function saveUpdates(_0x2b751c,_0x3b3df8){return function(_0x2482d7){if(_0x2482d7){return _0x2482d7['update'](_0x2b751c)[_0xa9cf('0x25')](function(_0x97b526){return _0x97b526;});}return null;};}function removeEntity(_0x1cb1d6,_0x2131f8){return function(_0x42d99b){if(_0x42d99b){return _0x42d99b['destroy']()[_0xa9cf('0x25')](function(){_0x1cb1d6[_0xa9cf('0x1a')](0xcc)[_0xa9cf('0x1b')]();});}};}function handleEntityNotFound(_0x1733bf,_0x1d0107){return function(_0x346498){if(!_0x346498){_0x1733bf[_0xa9cf('0x26')](0x194);}return _0x346498;};}function handleError(_0x4b46d2,_0x95f98a){_0x95f98a=_0x95f98a||0x1f4;return function(_0x468583){logger['error'](_0x468583['stack']);if(_0x468583[_0xa9cf('0x27')]){delete _0x468583[_0xa9cf('0x27')];}_0x4b46d2[_0xa9cf('0x1a')](_0x95f98a)[_0xa9cf('0x28')](_0x468583);};}exports[_0xa9cf('0x29')]=function(_0xd7443e,_0xe7480){var _0x340c92={},_0x501788={},_0x7ce16={'count':0x0,'rows':[]};var _0x51c448=_[_0xa9cf('0x2a')](db['SmsTransferReport']['rawAttributes'],function(_0x2625be){return{'name':_0x2625be[_0xa9cf('0x2b')],'type':_0x2625be['type'][_0xa9cf('0x2c')]};});_0x501788[_0xa9cf('0x2d')]=_[_0xa9cf('0x2a')](_0x51c448,'name');_0x501788[_0xa9cf('0x2e')]=_[_0xa9cf('0x2f')](_0xd7443e[_0xa9cf('0x2e')]);_0x501788['filters']=_[_0xa9cf('0x30')](_0x501788[_0xa9cf('0x2d')],_0x501788[_0xa9cf('0x2e')]);_0x340c92[_0xa9cf('0x31')]=_['intersection'](_0x501788[_0xa9cf('0x2d')],qs['fields'](_0xd7443e[_0xa9cf('0x2e')][_0xa9cf('0x32')]));_0x340c92['attributes']=_0x340c92[_0xa9cf('0x31')][_0xa9cf('0x33')]?_0x340c92[_0xa9cf('0x31')]:_0x501788[_0xa9cf('0x2d')];if(!_0xd7443e[_0xa9cf('0x2e')][_0xa9cf('0x34')](_0xa9cf('0x35'))){_0x340c92['limit']=qs[_0xa9cf('0x1d')](_0xd7443e['query']['limit']);_0x340c92[_0xa9cf('0x1f')]=qs[_0xa9cf('0x1f')](_0xd7443e[_0xa9cf('0x2e')]['offset']);}_0x340c92[_0xa9cf('0x36')]=qs[_0xa9cf('0x37')](_0xd7443e['query'][_0xa9cf('0x37')]);_0x340c92['where']=qs['filters'](_[_0xa9cf('0x38')](_0xd7443e['query'],_0x501788[_0xa9cf('0x39')]),_0x51c448);if(_0xd7443e['query'][_0xa9cf('0x3a')]){_0x340c92[_0xa9cf('0x3b')]=_[_0xa9cf('0x3c')](_0x340c92[_0xa9cf('0x3b')],{'$or':_[_0xa9cf('0x2a')](_0x51c448,function(_0x52ece5){if(_0x52ece5[_0xa9cf('0x3d')]!==_0xa9cf('0x3e')){var _0x344f28={};_0x344f28[_0x52ece5[_0xa9cf('0x27')]]={'$like':'%'+_0xd7443e[_0xa9cf('0x2e')][_0xa9cf('0x3a')]+'%'};return _0x344f28;}})});}_0x340c92=_[_0xa9cf('0x3c')]({},_0x340c92,_0xd7443e[_0xa9cf('0x3f')]);var _0x2dd5df={'where':_0x340c92[_0xa9cf('0x3b')]};return db[_0xa9cf('0x40')][_0xa9cf('0x1e')](_0x2dd5df)['then'](function(_0x461d73){_0x7ce16['count']=_0x461d73;if(_0xd7443e[_0xa9cf('0x2e')]['includeAll']){_0x340c92[_0xa9cf('0x41')]=[{'all':!![]}];}return db[_0xa9cf('0x40')][_0xa9cf('0x42')](_0x340c92);})[_0xa9cf('0x25')](function(_0xed5229){_0x7ce16[_0xa9cf('0x43')]=_0xed5229;return _0x7ce16;})['then'](respondWithFilteredResult(_0xe7480,_0x340c92))[_0xa9cf('0x44')](handleError(_0xe7480,null));};exports['show']=function(_0x2aedfd,_0xc98a89){var _0x9b13d1={'raw':!![],'where':{'id':_0x2aedfd[_0xa9cf('0x45')]['id']}},_0x1cdcb3={};_0x1cdcb3[_0xa9cf('0x2d')]=_[_0xa9cf('0x2f')](db[_0xa9cf('0x40')][_0xa9cf('0x46')]);_0x1cdcb3['query']=_[_0xa9cf('0x2f')](_0x2aedfd[_0xa9cf('0x2e')]);_0x1cdcb3[_0xa9cf('0x39')]=_[_0xa9cf('0x30')](_0x1cdcb3[_0xa9cf('0x2d')],_0x1cdcb3[_0xa9cf('0x2e')]);_0x9b13d1[_0xa9cf('0x31')]=_['intersection'](_0x1cdcb3['model'],qs[_0xa9cf('0x32')](_0x2aedfd[_0xa9cf('0x2e')]['fields']));_0x9b13d1[_0xa9cf('0x31')]=_0x9b13d1['attributes'][_0xa9cf('0x33')]?_0x9b13d1['attributes']:_0x1cdcb3[_0xa9cf('0x2d')];if(_0x2aedfd[_0xa9cf('0x2e')][_0xa9cf('0x47')]){_0x9b13d1[_0xa9cf('0x41')]=[{'all':!![]}];}_0x9b13d1=_[_0xa9cf('0x3c')]({},_0x9b13d1,_0x2aedfd[_0xa9cf('0x3f')]);return db['SmsTransferReport'][_0xa9cf('0x48')](_0x9b13d1)['then'](handleEntityNotFound(_0xc98a89,null))[_0xa9cf('0x25')](respondWithResult(_0xc98a89,null))['catch'](handleError(_0xc98a89,null));};exports[_0xa9cf('0x49')]=function(_0xf71068,_0x40f4b0){return db[_0xa9cf('0x40')][_0xa9cf('0x49')](_0xf71068[_0xa9cf('0x4a')],{})[_0xa9cf('0x25')](respondWithResult(_0x40f4b0,0xc9))[_0xa9cf('0x44')](handleError(_0x40f4b0,null));};exports[_0xa9cf('0x4b')]=function(_0x229f05,_0x25d2f7){if(_0x229f05[_0xa9cf('0x4a')]['id']){delete _0x229f05['body']['id'];}return db[_0xa9cf('0x40')][_0xa9cf('0x48')]({'where':{'id':_0x229f05[_0xa9cf('0x45')]['id']}})[_0xa9cf('0x25')](handleEntityNotFound(_0x25d2f7,null))[_0xa9cf('0x25')](saveUpdates(_0x229f05[_0xa9cf('0x4a')],null))[_0xa9cf('0x25')](respondWithResult(_0x25d2f7,null))['catch'](handleError(_0x25d2f7,null));};exports[_0xa9cf('0x4c')]=function(_0x4e2638,_0xf3d576){return db[_0xa9cf('0x40')]['find']({'where':{'id':_0x4e2638[_0xa9cf('0x45')]['id']}})[_0xa9cf('0x25')](handleEntityNotFound(_0xf3d576,null))[_0xa9cf('0x25')](removeEntity(_0xf3d576,null))['catch'](handleError(_0xf3d576,null));};exports['describe']=function(_0x18670c,_0x47a2c7){return db[_0xa9cf('0x40')][_0xa9cf('0x4d')]()[_0xa9cf('0x25')](respondWithResult(_0x47a2c7,null))[_0xa9cf('0x44')](handleError(_0x47a2c7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 350ced1..9b00d12 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 _0xfd3a=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','../../config/logger','bluebird','request-promise'];(function(_0x9c642a,_0x2bf217){var _0x2854e8=function(_0x13b323){while(--_0x13b323){_0x9c642a['push'](_0x9c642a['shift']());}};_0x2854e8(++_0x2bf217);}(_0xfd3a,0xb1));var _0xafd3=function(_0x25e211,_0x2778fd){_0x25e211=_0x25e211-0x0;var _0x4e3f93=_0xfd3a[_0x25e211];return _0x4e3f93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xafd3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xafd3('0x1'));var rp=require(_0xafd3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd3('0x3'));var config=require(_0xafd3('0x4'));var attributes=require(_0xafd3('0x5'));module['exports']=function(_0x1f9fd9,_0xbe660e){return _0x1f9fd9[_0xafd3('0x6')](_0xafd3('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xafd3('0x8'),'fields':[_0xafd3('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb439=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0xd5c66f,_0x3b8009){var _0x41228a=function(_0x445c54){while(--_0x445c54){_0xd5c66f['push'](_0xd5c66f['shift']());}};_0x41228a(++_0x3b8009);}(_0xb439,0x87));var _0x9b43=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb439[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x9b43('0x0'));var util=require(_0x9b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b43('0x2'));var BPromise=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b43('0x5'));var config=require(_0x9b43('0x6'));var attributes=require(_0x9b43('0x7'));module[_0x9b43('0x8')]=function(_0x3ab870,_0x3d2a05){return _0x3ab870[_0x9b43('0x9')](_0x9b43('0xa'),attributes,{'tableName':_0x9b43('0xb'),'paranoid':![],'indexes':[{'name':_0x9b43('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8899ee2..acf259a 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 _0x6c96=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x575917,_0x15a1fa){var _0x5dc843=function(_0x40a21a){while(--_0x40a21a){_0x575917['push'](_0x575917['shift']());}};_0x5dc843(++_0x15a1fa);}(_0x6c96,0x1c1));var _0x66c9=function(_0x2c9dfe,_0x18660c){_0x2c9dfe=_0x2c9dfe-0x0;var _0x2e6465=_0x6c96[_0x2c9dfe];return _0x2e6465;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var moment=require(_0x66c9('0x1'));var BPromise=require(_0x66c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66c9('0x3'));var db=require(_0x66c9('0x4'))['db'];var utils=require(_0x66c9('0x5'));var logger=require(_0x66c9('0x6'))(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var jayson=require(_0x66c9('0x9'));var client=jayson['client'][_0x66c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6baa,_0xb03819,_0x4d7692){return new BPromise(function(_0x55b488,_0xfc41a4){return client[_0x66c9('0xb')](_0x4c6baa,_0x4d7692)[_0x66c9('0xc')](function(_0x2e8ad5){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xb03819,'request\x20sent');logger['debug'](_0x66c9('0xd'),_0xb03819,_0x66c9('0xe'),JSON[_0x66c9('0xf')](_0x2e8ad5));if(_0x2e8ad5['error']){if(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x11')]===0x1f4){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5['error'][_0x66c9('0x13')]);return _0xfc41a4(_0x2e8ad5['error'][_0x66c9('0x13')]);}logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5[_0x66c9('0x10')]['message']);return _0x55b488(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x13')]);}else{logger['info'](_0x66c9('0x12'),_0xb03819,_0x66c9('0xe'));_0x55b488(_0x2e8ad5[_0x66c9('0x14')][_0x66c9('0x13')]);}})[_0x66c9('0x15')](function(_0x14d989){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x14d989);_0xfc41a4(_0x14d989);});});} \ No newline at end of file +var _0x39b3=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31acc7,_0x168431){var _0x10d549=function(_0x4b5412){while(--_0x4b5412){_0x31acc7['push'](_0x31acc7['shift']());}};_0x10d549(++_0x168431);}(_0x39b3,0xc9));var _0x339b=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x39b3[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x339b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x339b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x339b('0x3'));var logger=require(_0x339b('0x4'))(_0x339b('0x5'));var config=require(_0x339b('0x6'));var jayson=require(_0x339b('0x7'));var client=jayson[_0x339b('0x8')][_0x339b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f705f,_0x94b5c5,_0x3e604a){return new BPromise(function(_0x1621c7,_0x454ff5){return client[_0x339b('0xa')](_0x1f705f,_0x3e604a)[_0x339b('0xb')](function(_0x3a6400){logger[_0x339b('0xc')](_0x339b('0xd'),_0x94b5c5,_0x339b('0xe'));logger[_0x339b('0xf')](_0x339b('0x10'),_0x94b5c5,'request\x20sent',JSON['stringify'](_0x3a6400));if(_0x3a6400['error']){if(_0x3a6400['error'][_0x339b('0x11')]===0x1f4){logger[_0x339b('0x12')](_0x339b('0xd'),_0x94b5c5,_0x3a6400[_0x339b('0x12')]['message']);return _0x454ff5(_0x3a6400[_0x339b('0x12')][_0x339b('0x13')]);}logger[_0x339b('0x12')](_0x339b('0xd'),_0x94b5c5,_0x3a6400['error']['message']);return _0x1621c7(_0x3a6400['error'][_0x339b('0x13')]);}else{logger[_0x339b('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x94b5c5,_0x339b('0xe'));_0x1621c7(_0x3a6400['result']['message']);}})[_0x339b('0x14')](function(_0x60c245){logger[_0x339b('0x12')](_0x339b('0xd'),_0x94b5c5,_0x60c245);_0x454ff5(_0x60c245);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b5d4a38..3279d98 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 _0x32a8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x3bb15f,_0x3e4cb4){var _0x26050a=function(_0x7432be){while(--_0x7432be){_0x3bb15f['push'](_0x3bb15f['shift']());}};_0x26050a(++_0x3e4cb4);}(_0x32a8,0x17d));var _0x832a=function(_0x12ac1f,_0x461a52){_0x12ac1f=_0x12ac1f-0x0;var _0x724467=_0x32a8[_0x12ac1f];return _0x724467;};'use strict';var multer=require(_0x832a('0x0'));var util=require(_0x832a('0x1'));var path=require(_0x832a('0x2'));var timeout=require(_0x832a('0x3'));var express=require(_0x832a('0x4'));var router=express[_0x832a('0x5')]();var fs_extra=require(_0x832a('0x6'));var auth=require(_0x832a('0x7'));var interaction=require(_0x832a('0x8'));var config=require(_0x832a('0x9'));var controller=require(_0x832a('0xa'));router[_0x832a('0xb')]('/',auth[_0x832a('0xc')](),controller[_0x832a('0xd')]);router['get'](_0x832a('0xe'),auth[_0x832a('0xc')](),controller[_0x832a('0xf')]);router[_0x832a('0xb')](_0x832a('0x10'),auth[_0x832a('0xc')](),controller[_0x832a('0x11')]);var upload=multer({'storage':multer[_0x832a('0x12')]({'destination':function(_0x3d5b6d,_0xf43205,_0x10b586){_0x10b586(null,path[_0x832a('0x13')](config[_0x832a('0x14')],_0x832a('0x15')));},'filename':function(_0x444351,_0x472e04,_0x30f6e3){_0x472e04[_0x832a('0x16')]=_0x472e04[_0x832a('0x16')][_0x832a('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30f6e3(null,util[_0x832a('0x18')]('%s-%s%s',path[_0x832a('0x19')](_0x472e04['originalname'],path[_0x832a('0x1a')](_0x472e04['originalname'])),Date[_0x832a('0x1b')](),path[_0x832a('0x1a')](_0x472e04[_0x832a('0x16')])));}})});router[_0x832a('0x1c')]('/',upload[_0x832a('0x1d')](_0x832a('0x1e')),controller[_0x832a('0x1f')]);router[_0x832a('0x20')](_0x832a('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x832a('0xe'),auth[_0x832a('0xc')](),controller[_0x832a('0x21')]);module[_0x832a('0x22')]=router; \ No newline at end of file +var _0x4beb=['/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/download','download','diskStorage','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4beb,0x100));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb4be('0x0'));var util=require(_0xb4be('0x1'));var path=require(_0xb4be('0x2'));var timeout=require(_0xb4be('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb4be('0x4'));var config=require(_0xb4be('0x5'));var controller=require('./sound.controller');router[_0xb4be('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb4be('0x6')]('/:id',auth[_0xb4be('0x7')](),controller[_0xb4be('0x8')]);router[_0xb4be('0x6')](_0xb4be('0x9'),auth[_0xb4be('0x7')](),controller[_0xb4be('0xa')]);var upload=multer({'storage':multer[_0xb4be('0xb')]({'destination':function(_0x2c5030,_0x5476cd,_0x2d4028){_0x2d4028(null,path['join'](config[_0xb4be('0xc')],'server/files/sounds/original/'));},'filename':function(_0x4d1483,_0x94cc1,_0x530118){_0x94cc1[_0xb4be('0xd')]=_0x94cc1[_0xb4be('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x530118(null,util[_0xb4be('0xe')](_0xb4be('0xf'),path[_0xb4be('0x10')](_0x94cc1[_0xb4be('0xd')],path[_0xb4be('0x11')](_0x94cc1[_0xb4be('0xd')])),Date[_0xb4be('0x12')](),path[_0xb4be('0x11')](_0x94cc1['originalname'])));}})});router[_0xb4be('0x13')]('/',upload[_0xb4be('0x14')](_0xb4be('0x15')),controller[_0xb4be('0x16')]);router[_0xb4be('0x17')](_0xb4be('0x18'),auth[_0xb4be('0x7')](),controller[_0xb4be('0x19')]);router[_0xb4be('0x1a')](_0xb4be('0x18'),auth[_0xb4be('0x7')](),controller[_0xb4be('0x1a')]);module[_0xb4be('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0398149..4d64147 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 _0x231a=['FLOAT','exports','STRING','BIGINT','INTEGER'];(function(_0x7a3c59,_0x3835af){var _0x5183c0=function(_0x3e03ac){while(--_0x3e03ac){_0x7a3c59['push'](_0x7a3c59['shift']());}};_0x5183c0(++_0x3835af);}(_0x231a,0x1a5));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xa231('0x0')]={'name':{'type':Sequelize[_0xa231('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xa231('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa231('0x1')]},'original_format':{'type':Sequelize[_0xa231('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xa231('0x2')]},'original_channelCount':{'type':Sequelize[_0xa231('0x3')]},'original_bitRate':{'type':Sequelize[_0xa231('0x2')]},'original_sampleRate':{'type':Sequelize[_0xa231('0x3')]},'converted_format':{'type':Sequelize[_0xa231('0x1')]},'converted_duration':{'type':Sequelize[_0xa231('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xa231('0x2')]},'converted_channelCount':{'type':Sequelize[_0xa231('0x3')]},'converted_bitRate':{'type':Sequelize[_0xa231('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xa231('0x3')]}}; \ No newline at end of file +var _0xedfa=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x3f523e,_0x327290){var _0x41a4f7=function(_0x30d67a){while(--_0x30d67a){_0x3f523e['push'](_0x3f523e['shift']());}};_0x41a4f7(++_0x327290);}(_0xedfa,0xc6));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xaedf('0x0'));module['exports']={'name':{'type':Sequelize[_0xaedf('0x1')],'unique':_0xaedf('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xaedf('0x1')]},'display_name':{'type':Sequelize[_0xaedf('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xaedf('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xaedf('0x3')]},'original_sampleCount':{'type':Sequelize[_0xaedf('0x4')]},'original_channelCount':{'type':Sequelize[_0xaedf('0x5')]},'original_bitRate':{'type':Sequelize[_0xaedf('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xaedf('0x1')]},'converted_duration':{'type':Sequelize[_0xaedf('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xaedf('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xaedf('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xaedf('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 3290fb5..5ce8ed7 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 _0x3409=['ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Sounds','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','includeAll','include','findAll','catch','show','params','intersection','download','find','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','file','extname','filename','originalname','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','start','description','delete','server/files/sounds/original','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4ec0e9,_0x16f919){var _0x40ca33=function(_0x93faab){while(--_0x93faab){_0x4ec0e9['push'](_0x4ec0e9['shift']());}};_0x40ca33(++_0x16f919);}(_0x3409,0x15c));var _0x9340=function(_0x30e74d,_0x73f2c8){_0x30e74d=_0x30e74d-0x0;var _0x337ae2=_0x3409[_0x30e74d];return _0x337ae2;};'use strict';var emlformat=require(_0x9340('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9340('0x1'));var rp=require(_0x9340('0x2'));var moment=require(_0x9340('0x3'));var BPromise=require(_0x9340('0x4'));var Mustache=require(_0x9340('0x5'));var util=require('util');var path=require(_0x9340('0x6'));var sox=require(_0x9340('0x7'));var csv=require(_0x9340('0x8'));var ejs=require(_0x9340('0x9'));var fs=require('fs');var fs_extra=require(_0x9340('0xa'));var _=require('lodash');var squel=require(_0x9340('0xb'));var crypto=require('crypto');var jsforce=require(_0x9340('0xc'));var deskjs=require(_0x9340('0xd'));var toCsv=require(_0x9340('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9340('0xe'));var qs=require(_0x9340('0xf'));var as=require(_0x9340('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9340('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x9340('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9340('0x13'))['db'];function respondWithStatusCode(_0x8b8544,_0x217f9c){_0x217f9c=_0x217f9c||0xcc;return function(_0x246ac3){if(_0x246ac3){return _0x8b8544[_0x9340('0x14')](_0x217f9c);}return _0x8b8544[_0x9340('0x15')](_0x217f9c)[_0x9340('0x16')]();};}function respondWithResult(_0x44d799,_0x9d60d2){_0x9d60d2=_0x9d60d2||0xc8;return function(_0x27d085){if(_0x27d085){return _0x44d799['status'](_0x9d60d2)[_0x9340('0x17')](_0x27d085);}};}function respondWithFilteredResult(_0x42a882,_0x2c9a22){return function(_0x4e39c3){if(_0x4e39c3){var _0x2b5b27=typeof _0x2c9a22[_0x9340('0x18')]===_0x9340('0x19')&&typeof _0x2c9a22[_0x9340('0x1a')]==='undefined';var _0x40310b=_0x4e39c3['count'];var _0x1702ae=_0x2b5b27?0x0:_0x2c9a22[_0x9340('0x18')];var _0x15c66a=_0x2b5b27?_0x4e39c3[_0x9340('0x1b')]:_0x2c9a22[_0x9340('0x18')]+_0x2c9a22['limit'];var _0x2fb22b;if(_0x15c66a>=_0x40310b){_0x15c66a=_0x40310b;_0x2fb22b=0xc8;}else{_0x2fb22b=0xce;}_0x42a882[_0x9340('0x15')](_0x2fb22b);return _0x42a882[_0x9340('0x1c')](_0x9340('0x1d'),_0x1702ae+'-'+_0x15c66a+'/'+_0x40310b)[_0x9340('0x17')](_0x4e39c3);}return null;};}function patchUpdates(_0x115e52){return function(_0x331146){try{jsonpatch[_0x9340('0x1e')](_0x331146,_0x115e52,!![]);}catch(_0x572c5e){return BPromise[_0x9340('0x1f')](_0x572c5e);}return _0x331146['save']();};}function saveUpdates(_0x382bd0,_0x5d0265){return function(_0x5df7bd){if(_0x5df7bd){return _0x5df7bd[_0x9340('0x20')](_0x382bd0)['then'](function(_0x1284f6){return _0x1284f6;});}return null;};}function removeEntity(_0x26b60f,_0x13e556){return function(_0x3e253a){if(_0x3e253a){return _0x3e253a[_0x9340('0x21')]()[_0x9340('0x22')](function(){var _0x9dd9cb=_0x3e253a[_0x9340('0x23')]({'plain':!![]});var _0x57a430=_0x9340('0x24');return db['UserProfileResource'][_0x9340('0x21')]({'where':{'type':_0x57a430,'resourceId':_0x9dd9cb['id']}})[_0x9340('0x22')](function(){return _0x3e253a;});})[_0x9340('0x22')](function(){_0x26b60f[_0x9340('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca5d3,_0xe1c9a9){return function(_0x40dbfc){if(!_0x40dbfc){_0x1ca5d3[_0x9340('0x14')](0x194);}return _0x40dbfc;};}function handleError(_0x186baa,_0x4a5ccd){_0x4a5ccd=_0x4a5ccd||0x1f4;return function(_0x525a59){logger[_0x9340('0x25')](_0x525a59[_0x9340('0x26')]);if(_0x525a59[_0x9340('0x27')]){delete _0x525a59['name'];}_0x186baa[_0x9340('0x15')](_0x4a5ccd)[_0x9340('0x28')](_0x525a59);};}exports[_0x9340('0x29')]=function(_0x213bbf,_0x1801fa){var _0x2b48c0={},_0xfc781c={},_0x181ac8={'count':0x0,'rows':[]};var _0x209dea=_['map'](db[_0x9340('0x2a')][_0x9340('0x2b')],function(_0x5f20cb){return{'name':_0x5f20cb[_0x9340('0x2c')],'type':_0x5f20cb[_0x9340('0x2d')][_0x9340('0x2e')]};});_0xfc781c[_0x9340('0x2f')]=_['map'](_0x209dea,_0x9340('0x27'));_0xfc781c[_0x9340('0x30')]=_[_0x9340('0x31')](_0x213bbf[_0x9340('0x30')]);_0xfc781c[_0x9340('0x32')]=_['intersection'](_0xfc781c[_0x9340('0x2f')],_0xfc781c['query']);_0x2b48c0[_0x9340('0x33')]=_['intersection'](_0xfc781c['model'],qs[_0x9340('0x34')](_0x213bbf['query'][_0x9340('0x34')]));_0x2b48c0['attributes']=_0x2b48c0[_0x9340('0x33')][_0x9340('0x35')]?_0x2b48c0[_0x9340('0x33')]:_0xfc781c[_0x9340('0x2f')];if(!_0x213bbf[_0x9340('0x30')][_0x9340('0x36')](_0x9340('0x37'))){_0x2b48c0[_0x9340('0x1a')]=qs[_0x9340('0x1a')](_0x213bbf[_0x9340('0x30')][_0x9340('0x1a')]);_0x2b48c0[_0x9340('0x18')]=qs[_0x9340('0x18')](_0x213bbf['query']['offset']);}_0x2b48c0['order']=qs[_0x9340('0x38')](_0x213bbf[_0x9340('0x30')]['sort']);_0x2b48c0[_0x9340('0x39')]=qs[_0x9340('0x32')](_[_0x9340('0x3a')](_0x213bbf[_0x9340('0x30')],_0xfc781c['filters']),_0x209dea);if(_0x213bbf[_0x9340('0x30')][_0x9340('0x3b')]){_0x2b48c0[_0x9340('0x39')]=_['merge'](_0x2b48c0[_0x9340('0x39')],{'$or':_[_0x9340('0x3c')](_0x209dea,function(_0x9950){if(_0x9950[_0x9340('0x2d')]!=='VIRTUAL'){var _0x322ef4={};_0x322ef4[_0x9950['name']]={'$like':'%'+_0x213bbf[_0x9340('0x30')]['filter']+'%'};return _0x322ef4;}})});}_0x2b48c0=_['merge']({},_0x2b48c0,_0x213bbf[_0x9340('0x3d')]);var _0x282c6c={'where':_0x2b48c0[_0x9340('0x39')]};return db[_0x9340('0x2a')]['count'](_0x282c6c)[_0x9340('0x22')](function(_0x5b5c77){_0x181ac8[_0x9340('0x1b')]=_0x5b5c77;if(_0x213bbf['query'][_0x9340('0x3e')]){_0x2b48c0[_0x9340('0x3f')]=[{'all':!![]}];}return db[_0x9340('0x2a')][_0x9340('0x40')](_0x2b48c0);})[_0x9340('0x22')](function(_0x29b0b8){_0x181ac8['rows']=_0x29b0b8;return _0x181ac8;})[_0x9340('0x22')](respondWithFilteredResult(_0x1801fa,_0x2b48c0))[_0x9340('0x41')](handleError(_0x1801fa,null));};exports[_0x9340('0x42')]=function(_0x4e6b35,_0x47af2a){var _0x2ef450={'raw':!![],'where':{'id':_0x4e6b35[_0x9340('0x43')]['id']}},_0x397fbe={};_0x397fbe[_0x9340('0x2f')]=_[_0x9340('0x31')](db[_0x9340('0x2a')][_0x9340('0x2b')]);_0x397fbe[_0x9340('0x30')]=_[_0x9340('0x31')](_0x4e6b35[_0x9340('0x30')]);_0x397fbe[_0x9340('0x32')]=_[_0x9340('0x44')](_0x397fbe['model'],_0x397fbe[_0x9340('0x30')]);_0x2ef450['attributes']=_[_0x9340('0x44')](_0x397fbe[_0x9340('0x2f')],qs['fields'](_0x4e6b35[_0x9340('0x30')][_0x9340('0x34')]));_0x2ef450[_0x9340('0x33')]=_0x2ef450[_0x9340('0x33')]['length']?_0x2ef450[_0x9340('0x33')]:_0x397fbe['model'];if(_0x4e6b35[_0x9340('0x30')][_0x9340('0x3e')]){_0x2ef450[_0x9340('0x3f')]=[{'all':!![]}];}_0x2ef450=_['merge']({},_0x2ef450,_0x4e6b35[_0x9340('0x3d')]);return db[_0x9340('0x2a')]['find'](_0x2ef450)[_0x9340('0x22')](handleEntityNotFound(_0x47af2a,null))[_0x9340('0x22')](respondWithResult(_0x47af2a,null))[_0x9340('0x41')](handleError(_0x47af2a,null));};exports[_0x9340('0x45')]=function(_0x338a1b,_0x1b9a52,_0x4edb93){return db['Sound'][_0x9340('0x46')]({'where':{'id':_0x338a1b[_0x9340('0x43')]['id']},'attributes':[_0x9340('0x27'),'save_name',_0x9340('0x47')],'raw':!![]})[_0x9340('0x22')](handleEntityNotFound(_0x1b9a52,null))[_0x9340('0x22')](function(_0x34625d){if(_0x34625d){if(!fs[_0x9340('0x48')](path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x4b'),_0x34625d['save_name']+'.'+_0x34625d[_0x9340('0x47')]))){throw new db['Sequelize'][(_0x9340('0x4c'))](_0x9340('0x4d'));}return _0x1b9a52[_0x9340('0x45')](path['join'](config[_0x9340('0x4a')],_0x9340('0x4b'),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x34625d[_0x9340('0x50')],_0x34625d['converted_format'])),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x34625d['name'],_0x34625d[_0x9340('0x47')]));}return null;})['catch'](handleError(_0x1b9a52,null));};exports[_0x9340('0x51')]=function(_0x911251,_0x3012a4,_0x232214){var _0x2a6cab={'name':path[_0x9340('0x52')](_0x911251[_0x9340('0x53')]['originalname'],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')]['originalname'])),'save_name':path[_0x9340('0x52')](_0x911251[_0x9340('0x53')][_0x9340('0x55')],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x55')])),'original_format':path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x56')])['substring'](0x1),'converted_format':'wav'};var _0x1b2e4e=path['join'](config[_0x9340('0x4a')],'server/files/sounds/original',_0x911251[_0x9340('0x53')]['filename']);var _0xa94656=path[_0x9340('0x49')](config[_0x9340('0x4a')],'server/files/sounds/converted',util[_0x9340('0x4e')](_0x9340('0x4f'),path['basename'](_0x911251[_0x9340('0x53')]['filename'],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x55')])),_0x2a6cab['converted_format']));logger[_0x9340('0x57')]('Sound\x20upload\x20filepath:\x20%s',_0x1b2e4e);logger[_0x9340('0x57')](_0x9340('0x58'),_0xa94656);try{fs[_0x9340('0x59')](_0x1b2e4e,parseInt('0777',0x8));var _0x9b6502=sox[_0x9340('0x5a')](_0x1b2e4e,_0xa94656,{'sampleRate':0x1f40,'format':_0x9340('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x9b6502['on'](_0x9340('0x25'),function(_0x393f86){fs[_0x9340('0x5c')](_0x1b2e4e);_0x3012a4[_0x9340('0x15')](0x1f4)[_0x9340('0x28')](_0x393f86);});_0x9b6502['on'](_0x9340('0x5d'),function(_0x40b47b){_0x2a6cab[_0x9340('0x5e')]=isNaN(_0x40b47b['duration'])?null:_0x40b47b[_0x9340('0x5f')]*0x3e8;_0x2a6cab[_0x9340('0x60')]=isNaN(_0x40b47b[_0x9340('0x61')])?null:_0x40b47b[_0x9340('0x61')];_0x2a6cab['original_channelCount']=isNaN(_0x40b47b['channelCount'])?null:_0x40b47b[_0x9340('0x62')];_0x2a6cab[_0x9340('0x63')]=isNaN(_0x40b47b[_0x9340('0x64')])?null:_0x40b47b['bitRate'];_0x2a6cab[_0x9340('0x65')]=isNaN(_0x40b47b[_0x9340('0x66')])?null:_0x40b47b[_0x9340('0x66')];});_0x9b6502['on'](_0x9340('0x67'),function(_0x47f704){_0x2a6cab['converted_duration']=isNaN(_0x47f704['duration'])?null:_0x47f704[_0x9340('0x5f')]*0x3e8;_0x2a6cab[_0x9340('0x68')]=isNaN(_0x47f704['sampleCount'])?null:_0x47f704[_0x9340('0x61')];_0x2a6cab[_0x9340('0x69')]=isNaN(_0x47f704['channelCount'])?null:_0x47f704['channelCount'];_0x2a6cab['converted_bitRate']=isNaN(_0x47f704[_0x9340('0x64')])?null:_0x47f704[_0x9340('0x64')];_0x2a6cab[_0x9340('0x6a')]=isNaN(_0x47f704[_0x9340('0x66')])?null:_0x47f704['sampleRate'];});_0x9b6502['on'](_0x9340('0x16'),function(){fs[_0x9340('0x59')](_0xa94656,parseInt(_0x9340('0x6b'),0x8));return db[_0x9340('0x2a')][_0x9340('0x51')](_0x2a6cab)['then'](function(_0x5608ca){var _0x1bf8e8={'role':_0x911251[_0x9340('0x6c')]['role'],'userProfileId':_0x911251['body']['userProfileId']};if(!_0x1bf8e8)throw new Error(_0x9340('0x6d'));if(_0x1bf8e8['role']===_0x9340('0x6e')){var _0x2f12b9=_0x5608ca['get']({'plain':!![]});return db[_0x9340('0x6f')][_0x9340('0x46')]({'where':{'name':'Sounds','userProfileId':_0x1bf8e8[_0x9340('0x70')]},'raw':!![]})[_0x9340('0x22')](function(_0xce6292){if(_0xce6292&&_0xce6292[_0x9340('0x71')]===0x0){return db[_0x9340('0x72')][_0x9340('0x51')]({'name':_0x2f12b9[_0x9340('0x27')],'resourceId':_0x2f12b9['id'],'type':_0xce6292[_0x9340('0x27')],'sectionId':_0xce6292['id']},{})['then'](function(){return _0x5608ca;});}else{return _0x5608ca;}})[_0x9340('0x41')](function(_0x49a949){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a949);throw _0x49a949;});}return _0x5608ca;})[_0x9340('0x22')](respondWithResult(_0x3012a4,null))[_0x9340('0x41')](handleError(_0x3012a4,null));});_0x9b6502[_0x9340('0x73')]();}catch(_0x4b245d){_0x3012a4[_0x9340('0x15')](0x1f4)['send'](_0x4b245d);}};exports['update']=function(_0x68e137,_0x34303f,_0x4c06){return db[_0x9340('0x2a')][_0x9340('0x46')]({'where':{'id':_0x68e137[_0x9340('0x43')]['id']}})[_0x9340('0x22')](handleEntityNotFound(_0x34303f,null))['then'](saveUpdates(_[_0x9340('0x3a')](_0x68e137[_0x9340('0x6c')],['name',_0x9340('0x74')]),null))[_0x9340('0x22')](respondWithResult(_0x34303f,null))[_0x9340('0x41')](handleError(_0x34303f,null));};exports[_0x9340('0x75')]=function(_0x27cbd9,_0x5f1eb0,_0x1c9ba1){return db[_0x9340('0x2a')][_0x9340('0x46')]({'where':{'id':_0x27cbd9[_0x9340('0x43')]['id']}})[_0x9340('0x22')](function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x9340('0x21')]();}})[_0x9340('0x22')](function(_0x2714a2){var _0x3ebb69=path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x76'),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x2714a2[_0x9340('0x50')],_0x2714a2['original_format']));var _0x42b382=path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x4b'),util['format'](_0x9340('0x4f'),_0x2714a2[_0x9340('0x50')],_0x2714a2[_0x9340('0x47')]));fs[_0x9340('0x5c')](_0x3ebb69);fs['unlinkSync'](_0x42b382);return _0x2714a2;})['then'](function(_0x4857c9){if(_0x4857c9){return _0x5f1eb0[_0x9340('0x15')](0xcc)[_0x9340('0x16')]();}})[_0x9340('0x22')](handleEntityNotFound(_0x5f1eb0,null))['catch'](handleError(_0x5f1eb0,null));}; \ No newline at end of file +var _0xff31=['Sound\x20not\x20found','format','%s.%s','basename','originalname','extname','file','filename','wav','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','start','update','pick','delete','server/files/sounds/original','original_format','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','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','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','Sounds','end','error','send','index','map','Sound','rawAttributes','fieldName','key','name','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','where','type','VIRTUAL','filter','merge','options','includeAll','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','Sequelize'];(function(_0x788f70,_0x1d8f32){var _0x39039c=function(_0x14c4d1){while(--_0x14c4d1){_0x788f70['push'](_0x788f70['shift']());}};_0x39039c(++_0x1d8f32);}(_0xff31,0x125));var _0x1ff3=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xff31[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require(_0x1ff3('0x0'));var rimraf=require(_0x1ff3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ff3('0x2'));var rp=require('request-promise');var moment=require(_0x1ff3('0x3'));var BPromise=require(_0x1ff3('0x4'));var Mustache=require(_0x1ff3('0x5'));var util=require(_0x1ff3('0x6'));var path=require(_0x1ff3('0x7'));var sox=require(_0x1ff3('0x8'));var csv=require(_0x1ff3('0x9'));var ejs=require(_0x1ff3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1ff3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ff3('0xc'));var toCsv=require(_0x1ff3('0x9'));var querystring=require(_0x1ff3('0xd'));var Papa=require(_0x1ff3('0xe'));var Redis=require(_0x1ff3('0xf'));var authService=require(_0x1ff3('0x10'));var qs=require(_0x1ff3('0x11'));var as=require(_0x1ff3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ff3('0x13'))(_0x1ff3('0x14'));var utils=require(_0x1ff3('0x15'));var config=require(_0x1ff3('0x16'));var licenseUtil=require(_0x1ff3('0x17'));var db=require(_0x1ff3('0x18'))['db'];function respondWithStatusCode(_0x425e26,_0x501bea){_0x501bea=_0x501bea||0xcc;return function(_0x31ab64){if(_0x31ab64){return _0x425e26[_0x1ff3('0x19')](_0x501bea);}return _0x425e26[_0x1ff3('0x1a')](_0x501bea)['end']();};}function respondWithResult(_0x4fb66a,_0x2b1e44){_0x2b1e44=_0x2b1e44||0xc8;return function(_0x170749){if(_0x170749){return _0x4fb66a[_0x1ff3('0x1a')](_0x2b1e44)[_0x1ff3('0x1b')](_0x170749);}};}function respondWithFilteredResult(_0x451fd9,_0x1e3f1d){return function(_0x41a236){if(_0x41a236){var _0x107adb=typeof _0x1e3f1d[_0x1ff3('0x1c')]===_0x1ff3('0x1d')&&typeof _0x1e3f1d[_0x1ff3('0x1e')]===_0x1ff3('0x1d');var _0x30a31c=_0x41a236[_0x1ff3('0x1f')];var _0x5865e5=_0x107adb?0x0:_0x1e3f1d['offset'];var _0x39682f=_0x107adb?_0x41a236[_0x1ff3('0x1f')]:_0x1e3f1d[_0x1ff3('0x1c')]+_0x1e3f1d['limit'];var _0x215546;if(_0x39682f>=_0x30a31c){_0x39682f=_0x30a31c;_0x215546=0xc8;}else{_0x215546=0xce;}_0x451fd9[_0x1ff3('0x1a')](_0x215546);return _0x451fd9[_0x1ff3('0x20')](_0x1ff3('0x21'),_0x5865e5+'-'+_0x39682f+'/'+_0x30a31c)['json'](_0x41a236);}return null;};}function patchUpdates(_0x35e81d){return function(_0x2d419a){try{jsonpatch['apply'](_0x2d419a,_0x35e81d,!![]);}catch(_0x15995a){return BPromise[_0x1ff3('0x22')](_0x15995a);}return _0x2d419a[_0x1ff3('0x23')]();};}function saveUpdates(_0x4eeeb,_0xa20d20){return function(_0x1c4413){if(_0x1c4413){return _0x1c4413['update'](_0x4eeeb)[_0x1ff3('0x24')](function(_0x2829a9){return _0x2829a9;});}return null;};}function removeEntity(_0x2ea3ba,_0x4ba151){return function(_0x45efe8){if(_0x45efe8){return _0x45efe8[_0x1ff3('0x25')]()[_0x1ff3('0x24')](function(){var _0x5ee033=_0x45efe8['get']({'plain':!![]});var _0x2d1aa3=_0x1ff3('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2d1aa3,'resourceId':_0x5ee033['id']}})[_0x1ff3('0x24')](function(){return _0x45efe8;});})[_0x1ff3('0x24')](function(){_0x2ea3ba[_0x1ff3('0x1a')](0xcc)[_0x1ff3('0x27')]();});}};}function handleEntityNotFound(_0x588b3e,_0x443901){return function(_0x13ff07){if(!_0x13ff07){_0x588b3e[_0x1ff3('0x19')](0x194);}return _0x13ff07;};}function handleError(_0x968cc5,_0xafad47){_0xafad47=_0xafad47||0x1f4;return function(_0x35fd52){logger[_0x1ff3('0x28')](_0x35fd52['stack']);if(_0x35fd52['name']){delete _0x35fd52['name'];}_0x968cc5['status'](_0xafad47)[_0x1ff3('0x29')](_0x35fd52);};}exports[_0x1ff3('0x2a')]=function(_0x5be263,_0x38139d){var _0x2857d7={},_0x126212={},_0x4149cf={'count':0x0,'rows':[]};var _0x4d2673=_[_0x1ff3('0x2b')](db[_0x1ff3('0x2c')][_0x1ff3('0x2d')],function(_0x240946){return{'name':_0x240946[_0x1ff3('0x2e')],'type':_0x240946['type'][_0x1ff3('0x2f')]};});_0x126212['model']=_['map'](_0x4d2673,_0x1ff3('0x30'));_0x126212['query']=_[_0x1ff3('0x31')](_0x5be263[_0x1ff3('0x32')]);_0x126212[_0x1ff3('0x33')]=_['intersection'](_0x126212[_0x1ff3('0x34')],_0x126212['query']);_0x2857d7['attributes']=_[_0x1ff3('0x35')](_0x126212['model'],qs[_0x1ff3('0x36')](_0x5be263['query'][_0x1ff3('0x36')]));_0x2857d7[_0x1ff3('0x37')]=_0x2857d7[_0x1ff3('0x37')][_0x1ff3('0x38')]?_0x2857d7[_0x1ff3('0x37')]:_0x126212['model'];if(!_0x5be263[_0x1ff3('0x32')][_0x1ff3('0x39')]('nolimit')){_0x2857d7[_0x1ff3('0x1e')]=qs['limit'](_0x5be263[_0x1ff3('0x32')][_0x1ff3('0x1e')]);_0x2857d7[_0x1ff3('0x1c')]=qs['offset'](_0x5be263[_0x1ff3('0x32')][_0x1ff3('0x1c')]);}_0x2857d7['order']=qs['sort'](_0x5be263[_0x1ff3('0x32')]['sort']);_0x2857d7[_0x1ff3('0x3a')]=qs[_0x1ff3('0x33')](_['pick'](_0x5be263[_0x1ff3('0x32')],_0x126212['filters']),_0x4d2673);if(_0x5be263[_0x1ff3('0x32')]['filter']){_0x2857d7[_0x1ff3('0x3a')]=_['merge'](_0x2857d7[_0x1ff3('0x3a')],{'$or':_[_0x1ff3('0x2b')](_0x4d2673,function(_0x5e05ba){if(_0x5e05ba[_0x1ff3('0x3b')]!==_0x1ff3('0x3c')){var _0x3da500={};_0x3da500[_0x5e05ba[_0x1ff3('0x30')]]={'$like':'%'+_0x5be263[_0x1ff3('0x32')][_0x1ff3('0x3d')]+'%'};return _0x3da500;}})});}_0x2857d7=_[_0x1ff3('0x3e')]({},_0x2857d7,_0x5be263[_0x1ff3('0x3f')]);var _0x81b46d={'where':_0x2857d7[_0x1ff3('0x3a')]};return db[_0x1ff3('0x2c')]['count'](_0x81b46d)['then'](function(_0xdf83b4){_0x4149cf['count']=_0xdf83b4;if(_0x5be263[_0x1ff3('0x32')][_0x1ff3('0x40')]){_0x2857d7['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x2857d7);})[_0x1ff3('0x24')](function(_0x256eca){_0x4149cf['rows']=_0x256eca;return _0x4149cf;})[_0x1ff3('0x24')](respondWithFilteredResult(_0x38139d,_0x2857d7))[_0x1ff3('0x41')](handleError(_0x38139d,null));};exports[_0x1ff3('0x42')]=function(_0x4255f5,_0x54000c){var _0x4b52ca={'raw':!![],'where':{'id':_0x4255f5[_0x1ff3('0x43')]['id']}},_0x30beed={};_0x30beed[_0x1ff3('0x34')]=_['keys'](db[_0x1ff3('0x2c')][_0x1ff3('0x2d')]);_0x30beed[_0x1ff3('0x32')]=_[_0x1ff3('0x31')](_0x4255f5['query']);_0x30beed['filters']=_[_0x1ff3('0x35')](_0x30beed['model'],_0x30beed[_0x1ff3('0x32')]);_0x4b52ca[_0x1ff3('0x37')]=_[_0x1ff3('0x35')](_0x30beed[_0x1ff3('0x34')],qs[_0x1ff3('0x36')](_0x4255f5[_0x1ff3('0x32')][_0x1ff3('0x36')]));_0x4b52ca[_0x1ff3('0x37')]=_0x4b52ca['attributes'][_0x1ff3('0x38')]?_0x4b52ca[_0x1ff3('0x37')]:_0x30beed['model'];if(_0x4255f5[_0x1ff3('0x32')][_0x1ff3('0x40')]){_0x4b52ca['include']=[{'all':!![]}];}_0x4b52ca=_['merge']({},_0x4b52ca,_0x4255f5[_0x1ff3('0x3f')]);return db[_0x1ff3('0x2c')][_0x1ff3('0x44')](_0x4b52ca)[_0x1ff3('0x24')](handleEntityNotFound(_0x54000c,null))[_0x1ff3('0x24')](respondWithResult(_0x54000c,null))[_0x1ff3('0x41')](handleError(_0x54000c,null));};exports[_0x1ff3('0x45')]=function(_0x4bbe5f,_0x5b221d,_0x1a3f97){return db[_0x1ff3('0x2c')]['find']({'where':{'id':_0x4bbe5f['params']['id']},'attributes':[_0x1ff3('0x30'),_0x1ff3('0x46'),_0x1ff3('0x47')],'raw':!![]})[_0x1ff3('0x24')](handleEntityNotFound(_0x5b221d,null))[_0x1ff3('0x24')](function(_0x267270){if(_0x267270){if(!fs[_0x1ff3('0x48')](path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],'server/files/sounds/converted',_0x267270[_0x1ff3('0x46')]+'.'+_0x267270[_0x1ff3('0x47')]))){throw new db[(_0x1ff3('0x4b'))]['ValidationError'](_0x1ff3('0x4c'));}return _0x5b221d[_0x1ff3('0x45')](path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],'server/files/sounds/converted',util[_0x1ff3('0x4d')](_0x1ff3('0x4e'),_0x267270[_0x1ff3('0x46')],_0x267270[_0x1ff3('0x47')])),util[_0x1ff3('0x4d')](_0x1ff3('0x4e'),_0x267270[_0x1ff3('0x30')],_0x267270[_0x1ff3('0x47')]));}return null;})['catch'](handleError(_0x5b221d,null));};exports['create']=function(_0x5192fa,_0x303fef,_0x35ebd8){var _0x4374bf={'name':path[_0x1ff3('0x4f')](_0x5192fa['file'][_0x1ff3('0x50')],path[_0x1ff3('0x51')](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x50')])),'save_name':path[_0x1ff3('0x4f')](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x53')],path['extname'](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x53')])),'original_format':path[_0x1ff3('0x51')](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x50')])['substring'](0x1),'converted_format':_0x1ff3('0x54')};var _0x525d99=path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],'server/files/sounds/original',_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x53')]);var _0x2b31aa=path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],_0x1ff3('0x55'),util[_0x1ff3('0x4d')](_0x1ff3('0x4e'),path[_0x1ff3('0x4f')](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x53')],path[_0x1ff3('0x51')](_0x5192fa[_0x1ff3('0x52')][_0x1ff3('0x53')])),_0x4374bf[_0x1ff3('0x47')]));logger[_0x1ff3('0x56')](_0x1ff3('0x57'),_0x525d99);logger[_0x1ff3('0x56')](_0x1ff3('0x58'),_0x2b31aa);try{fs[_0x1ff3('0x59')](_0x525d99,parseInt(_0x1ff3('0x5a'),0x8));var _0x44d817=sox['transcode'](_0x525d99,_0x2b31aa,{'sampleRate':0x1f40,'format':_0x1ff3('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44d817['on'](_0x1ff3('0x28'),function(_0x1016d7){fs[_0x1ff3('0x5b')](_0x525d99);_0x303fef[_0x1ff3('0x1a')](0x1f4)['send'](_0x1016d7);});_0x44d817['on'](_0x1ff3('0x5c'),function(_0x502409){_0x4374bf[_0x1ff3('0x5d')]=isNaN(_0x502409[_0x1ff3('0x5e')])?null:_0x502409[_0x1ff3('0x5e')]*0x3e8;_0x4374bf[_0x1ff3('0x5f')]=isNaN(_0x502409['sampleCount'])?null:_0x502409[_0x1ff3('0x60')];_0x4374bf[_0x1ff3('0x61')]=isNaN(_0x502409[_0x1ff3('0x62')])?null:_0x502409['channelCount'];_0x4374bf[_0x1ff3('0x63')]=isNaN(_0x502409['bitRate'])?null:_0x502409[_0x1ff3('0x64')];_0x4374bf[_0x1ff3('0x65')]=isNaN(_0x502409[_0x1ff3('0x66')])?null:_0x502409[_0x1ff3('0x66')];});_0x44d817['on'](_0x1ff3('0x67'),function(_0x4d2c29){_0x4374bf['converted_duration']=isNaN(_0x4d2c29['duration'])?null:_0x4d2c29['duration']*0x3e8;_0x4374bf[_0x1ff3('0x68')]=isNaN(_0x4d2c29[_0x1ff3('0x60')])?null:_0x4d2c29[_0x1ff3('0x60')];_0x4374bf[_0x1ff3('0x69')]=isNaN(_0x4d2c29[_0x1ff3('0x62')])?null:_0x4d2c29['channelCount'];_0x4374bf[_0x1ff3('0x6a')]=isNaN(_0x4d2c29[_0x1ff3('0x64')])?null:_0x4d2c29[_0x1ff3('0x64')];_0x4374bf[_0x1ff3('0x6b')]=isNaN(_0x4d2c29[_0x1ff3('0x66')])?null:_0x4d2c29[_0x1ff3('0x66')];});_0x44d817['on']('end',function(){fs[_0x1ff3('0x59')](_0x2b31aa,parseInt('0777',0x8));return db['Sound'][_0x1ff3('0x6c')](_0x4374bf)[_0x1ff3('0x24')](function(_0x465987){var _0x1a7b15={'role':_0x5192fa['body']['role'],'userProfileId':_0x5192fa[_0x1ff3('0x6d')]['userProfileId']};if(!_0x1a7b15)throw new Error(_0x1ff3('0x6e'));if(_0x1a7b15[_0x1ff3('0x6f')]===_0x1ff3('0x70')){var _0x3aced8=_0x465987[_0x1ff3('0x71')]({'plain':!![]});return db[_0x1ff3('0x72')][_0x1ff3('0x44')]({'where':{'name':_0x1ff3('0x26'),'userProfileId':_0x1a7b15[_0x1ff3('0x73')]},'raw':!![]})[_0x1ff3('0x24')](function(_0x5c3a3f){if(_0x5c3a3f&&_0x5c3a3f[_0x1ff3('0x74')]===0x0){return db['UserProfileResource'][_0x1ff3('0x6c')]({'name':_0x3aced8[_0x1ff3('0x30')],'resourceId':_0x3aced8['id'],'type':_0x5c3a3f['name'],'sectionId':_0x5c3a3f['id']},{})[_0x1ff3('0x24')](function(){return _0x465987;});}else{return _0x465987;}})[_0x1ff3('0x41')](function(_0xd165c2){logger[_0x1ff3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd165c2);throw _0xd165c2;});}return _0x465987;})[_0x1ff3('0x24')](respondWithResult(_0x303fef,null))[_0x1ff3('0x41')](handleError(_0x303fef,null));});_0x44d817[_0x1ff3('0x75')]();}catch(_0x497c53){_0x303fef[_0x1ff3('0x1a')](0x1f4)[_0x1ff3('0x29')](_0x497c53);}};exports[_0x1ff3('0x76')]=function(_0x3bddcc,_0x1e59bc,_0x1365eb){return db[_0x1ff3('0x2c')][_0x1ff3('0x44')]({'where':{'id':_0x3bddcc[_0x1ff3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e59bc,null))['then'](saveUpdates(_[_0x1ff3('0x77')](_0x3bddcc[_0x1ff3('0x6d')],[_0x1ff3('0x30'),'description']),null))['then'](respondWithResult(_0x1e59bc,null))[_0x1ff3('0x41')](handleError(_0x1e59bc,null));};exports[_0x1ff3('0x78')]=function(_0x5e37f3,_0x24e423,_0x3e3e7c){return db[_0x1ff3('0x2c')]['find']({'where':{'id':_0x5e37f3[_0x1ff3('0x43')]['id']}})['then'](function(_0x539011){if(_0x539011){return _0x539011[_0x1ff3('0x25')]();}})[_0x1ff3('0x24')](function(_0xae0ad4){var _0x1bc5bb=path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],_0x1ff3('0x79'),util[_0x1ff3('0x4d')](_0x1ff3('0x4e'),_0xae0ad4[_0x1ff3('0x46')],_0xae0ad4[_0x1ff3('0x7a')]));var _0x5c3b79=path[_0x1ff3('0x49')](config[_0x1ff3('0x4a')],_0x1ff3('0x55'),util['format'](_0x1ff3('0x4e'),_0xae0ad4[_0x1ff3('0x46')],_0xae0ad4[_0x1ff3('0x47')]));fs['unlinkSync'](_0x1bc5bb);fs['unlinkSync'](_0x5c3b79);return _0xae0ad4;})[_0x1ff3('0x24')](function(_0x38e3e7){if(_0x38e3e7){return _0x24e423['status'](0xcc)[_0x1ff3('0x27')]();}})[_0x1ff3('0x24')](handleEntityNotFound(_0x24e423,null))[_0x1ff3('0x41')](handleError(_0x24e423,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f2314ad..5cc7cd6 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 _0xfce5=['tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xfce5,0x1d5));var _0x5fce=function(_0x2bfb31,_0xdd9aae){_0x2bfb31=_0x2bfb31-0x0;var _0x2b00ce=_0xfce5[_0x2bfb31];return _0x2b00ce;};'use strict';var _=require(_0x5fce('0x0'));var util=require(_0x5fce('0x1'));var logger=require(_0x5fce('0x2'))(_0x5fce('0x3'));var moment=require('moment');var BPromise=require(_0x5fce('0x4'));var rp=require(_0x5fce('0x5'));var fs=require('fs');var path=require(_0x5fce('0x6'));var rimraf=require('rimraf');var config=require(_0x5fce('0x7'));var attributes=require(_0x5fce('0x8'));module[_0x5fce('0x9')]=function(_0x3a1256,_0x47e830){return _0x3a1256[_0x5fce('0xa')](_0x5fce('0xb'),attributes,{'tableName':_0x5fce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb859=['moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','Sound','lodash','util','../../config/logger'];(function(_0x25cc1b,_0x463bba){var _0x26cf11=function(_0x24d0dc){while(--_0x24d0dc){_0x25cc1b['push'](_0x25cc1b['shift']());}};_0x26cf11(++_0x463bba);}(_0xb859,0xd9));var _0x9b85=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xb859[_0x349367];return _0x14179b;};'use strict';var _=require(_0x9b85('0x0'));var util=require(_0x9b85('0x1'));var logger=require(_0x9b85('0x2'))('api');var moment=require(_0x9b85('0x3'));var BPromise=require(_0x9b85('0x4'));var rp=require(_0x9b85('0x5'));var fs=require('fs');var path=require(_0x9b85('0x6'));var rimraf=require('rimraf');var config=require(_0x9b85('0x7'));var attributes=require(_0x9b85('0x8'));module[_0x9b85('0x9')]=function(_0x2cb699,_0x5d3492){return _0x2cb699['define'](_0x9b85('0xa'),attributes,{'tableName':'tools_sounds','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 80ce24e..e2ac807 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 _0xa1e8=['raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','Sound','find','options'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xa1e8,0xb1));var _0x8a1e=function(_0x3a85fd,_0x574d49){_0x3a85fd=_0x3a85fd-0x0;var _0x2b5c3d=_0xa1e8[_0x3a85fd];return _0x2b5c3d;};'use strict';var _=require(_0x8a1e('0x0'));var util=require(_0x8a1e('0x1'));var moment=require(_0x8a1e('0x2'));var BPromise=require(_0x8a1e('0x3'));var rs=require(_0x8a1e('0x4'));var fs=require('fs');var Redis=require(_0x8a1e('0x5'));var db=require(_0x8a1e('0x6'))['db'];var utils=require(_0x8a1e('0x7'));var logger=require(_0x8a1e('0x8'))(_0x8a1e('0x9'));var config=require('../../config/environment');var jayson=require(_0x8a1e('0xa'));var client=jayson[_0x8a1e('0xb')][_0x8a1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x105774,_0x18eeb5,_0x1cb8f8){return new BPromise(function(_0x521d21,_0x342fa){return client[_0x8a1e('0xd')](_0x105774,_0x1cb8f8)[_0x8a1e('0xe')](function(_0x2f59fc){logger[_0x8a1e('0xf')]('Sound,\x20%s,\x20%s',_0x18eeb5,'request\x20sent');logger[_0x8a1e('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x18eeb5,_0x8a1e('0x11'),JSON['stringify'](_0x2f59fc));if(_0x2f59fc[_0x8a1e('0x12')]){if(_0x2f59fc[_0x8a1e('0x12')]['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x18eeb5,_0x2f59fc[_0x8a1e('0x12')][_0x8a1e('0x13')]);return _0x342fa(_0x2f59fc[_0x8a1e('0x12')][_0x8a1e('0x13')]);}logger[_0x8a1e('0x12')](_0x8a1e('0x14'),_0x18eeb5,_0x2f59fc[_0x8a1e('0x12')]['message']);return _0x521d21(_0x2f59fc[_0x8a1e('0x12')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x18eeb5,_0x8a1e('0x11'));_0x521d21(_0x2f59fc[_0x8a1e('0x15')][_0x8a1e('0x13')]);}})[_0x8a1e('0x16')](function(_0x2ebe21){logger['error'](_0x8a1e('0x14'),_0x18eeb5,_0x2ebe21);_0x342fa(_0x2ebe21);});});}exports[_0x8a1e('0x17')]=function(_0x169d93){var _0xf895b8=this;return new Promise(function(_0x3e5d61,_0x1ae851){return db[_0x8a1e('0x18')][_0x8a1e('0x19')]({'raw':_0x169d93[_0x8a1e('0x1a')]?_0x169d93['options'][_0x8a1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x169d93[_0x8a1e('0x1a')]?_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1c')]||null:null,'attributes':_0x169d93['options']?_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1d')]||null:null,'include':_0x169d93[_0x8a1e('0x1a')]?_0x169d93['options'][_0x8a1e('0x1e')]?_['map'](_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1e')],function(_0x10de3d){return{'model':db[_0x10de3d['model']],'as':_0x10de3d['as'],'attributes':_0x10de3d[_0x8a1e('0x1d')],'include':_0x10de3d['include']?_[_0x8a1e('0x1f')](_0x10de3d[_0x8a1e('0x1e')],function(_0x2201a9){return{'model':db[_0x2201a9[_0x8a1e('0x20')]],'as':_0x2201a9['as'],'attributes':_0x2201a9[_0x8a1e('0x1d')],'include':_0x2201a9['include']?_[_0x8a1e('0x1f')](_0x2201a9[_0x8a1e('0x1e')],function(_0xbbacbc){return{'model':db[_0xbbacbc[_0x8a1e('0x20')]],'as':_0xbbacbc['as'],'attributes':_0xbbacbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a1e('0xe')](function(_0x3285b6){logger['info'](_0x8a1e('0x17'),_0x169d93);logger[_0x8a1e('0x10')]('ShowSound',_0x169d93,JSON[_0x8a1e('0x21')](_0x3285b6));_0x3e5d61(_0x3285b6);})[_0x8a1e('0x16')](function(_0x185281){logger[_0x8a1e('0x12')](_0x8a1e('0x17'),_0x185281['message'],_0x169d93);_0x1ae851(_0xf895b8[_0x8a1e('0x12')](0x1f4,_0x185281[_0x8a1e('0x13')]));});});}; \ No newline at end of file +var _0x7b2e=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound','find','options','raw','where','attributes','include','map','model','lodash','moment'];(function(_0x442939,_0x140e51){var _0x5bef5a=function(_0x1230f5){while(--_0x1230f5){_0x442939['push'](_0x442939['shift']());}};_0x5bef5a(++_0x140e51);}(_0x7b2e,0x1da));var _0xe7b2=function(_0x31881e,_0x2913b5){_0x31881e=_0x31881e-0x0;var _0x2f5bff=_0x7b2e[_0x31881e];return _0x2f5bff;};'use strict';var _=require(_0xe7b2('0x0'));var util=require('util');var moment=require(_0xe7b2('0x1'));var BPromise=require(_0xe7b2('0x2'));var rs=require(_0xe7b2('0x3'));var fs=require('fs');var Redis=require(_0xe7b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7b2('0x5'));var logger=require(_0xe7b2('0x6'))('rpc');var config=require(_0xe7b2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56e83,_0xbf416a,_0x2adb2d){return new BPromise(function(_0x3ac066,_0x4413d7){return client[_0xe7b2('0x8')](_0x56e83,_0x2adb2d)[_0xe7b2('0x9')](function(_0x35258b){logger[_0xe7b2('0xa')]('Sound,\x20%s,\x20%s',_0xbf416a,_0xe7b2('0xb'));logger[_0xe7b2('0xc')](_0xe7b2('0xd'),_0xbf416a,_0xe7b2('0xb'),JSON[_0xe7b2('0xe')](_0x35258b));if(_0x35258b['error']){if(_0x35258b[_0xe7b2('0xf')][_0xe7b2('0x10')]===0x1f4){logger[_0xe7b2('0xf')]('Sound,\x20%s,\x20%s',_0xbf416a,_0x35258b[_0xe7b2('0xf')][_0xe7b2('0x11')]);return _0x4413d7(_0x35258b[_0xe7b2('0xf')][_0xe7b2('0x11')]);}logger[_0xe7b2('0xf')]('Sound,\x20%s,\x20%s',_0xbf416a,_0x35258b['error'][_0xe7b2('0x11')]);return _0x3ac066(_0x35258b['error']['message']);}else{logger[_0xe7b2('0xa')]('Sound,\x20%s,\x20%s',_0xbf416a,'request\x20sent');_0x3ac066(_0x35258b['result']['message']);}})[_0xe7b2('0x12')](function(_0xd3f063){logger['error']('Sound,\x20%s,\x20%s',_0xbf416a,_0xd3f063);_0x4413d7(_0xd3f063);});});}exports[_0xe7b2('0x13')]=function(_0x2725cd){var _0x328dd7=this;return new Promise(function(_0x461c4b,_0x2ace29){return db['Sound'][_0xe7b2('0x14')]({'raw':_0x2725cd[_0xe7b2('0x15')]?_0x2725cd['options'][_0xe7b2('0x16')]===undefined?!![]:![]:!![],'where':_0x2725cd[_0xe7b2('0x15')]?_0x2725cd[_0xe7b2('0x15')][_0xe7b2('0x17')]||null:null,'attributes':_0x2725cd['options']?_0x2725cd[_0xe7b2('0x15')][_0xe7b2('0x18')]||null:null,'include':_0x2725cd[_0xe7b2('0x15')]?_0x2725cd['options'][_0xe7b2('0x19')]?_[_0xe7b2('0x1a')](_0x2725cd[_0xe7b2('0x15')]['include'],function(_0x3fbd15){return{'model':db[_0x3fbd15[_0xe7b2('0x1b')]],'as':_0x3fbd15['as'],'attributes':_0x3fbd15[_0xe7b2('0x18')],'include':_0x3fbd15[_0xe7b2('0x19')]?_[_0xe7b2('0x1a')](_0x3fbd15[_0xe7b2('0x19')],function(_0xf7e695){return{'model':db[_0xf7e695[_0xe7b2('0x1b')]],'as':_0xf7e695['as'],'attributes':_0xf7e695[_0xe7b2('0x18')],'include':_0xf7e695[_0xe7b2('0x19')]?_[_0xe7b2('0x1a')](_0xf7e695[_0xe7b2('0x19')],function(_0x1e6f65){return{'model':db[_0x1e6f65[_0xe7b2('0x1b')]],'as':_0x1e6f65['as'],'attributes':_0x1e6f65[_0xe7b2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x124425){logger[_0xe7b2('0xa')]('ShowSound',_0x2725cd);logger[_0xe7b2('0xc')](_0xe7b2('0x13'),_0x2725cd,JSON[_0xe7b2('0xe')](_0x124425));_0x461c4b(_0x124425);})['catch'](function(_0x247176){logger[_0xe7b2('0xf')](_0xe7b2('0x13'),_0x247176['message'],_0x2725cd);_0x2ace29(_0x328dd7[_0xe7b2('0xf')](0x1f4,_0x247176[_0xe7b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 09b946c..efd6ef2 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(_0x2a1c0f,_0xe26824){var _0x1f750c=function(_0xa4cf86){while(--_0xa4cf86){_0x2a1c0f['push'](_0x2a1c0f['shift']());}};_0x1f750c(++_0xe26824);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x4af199,_0x570f39){var _0x5e5625=function(_0x4929a4){while(--_0x4929a4){_0x4af199['push'](_0x4af199['shift']());}};_0x5e5625(++_0x570f39);}(_0x14a0,0x8e));var _0x014a=function(_0x25a0e5,_0x4ea577){_0x25a0e5=_0x25a0e5-0x0;var _0x30c109=_0x14a0[_0x25a0e5];return _0x30c109;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4fe82f6..9ec6776 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 _0xa9c7=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x3a00a1,_0x200672){var _0x3a97c1=function(_0x2e218f){while(--_0x2e218f){_0x3a00a1['push'](_0x3a00a1['shift']());}};_0x3a97c1(++_0x200672);}(_0xa9c7,0xa5));var _0x7a9c=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xa9c7[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0x7a9c('0x0'));module[_0x7a9c('0x1')]={'uniqueid':{'type':Sequelize[_0x7a9c('0x2')]},'body':{'type':Sequelize[_0x7a9c('0x3')](_0x7a9c('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x7a9c('0x5')]('in',_0x7a9c('0x6')),'defaultValue':_0x7a9c('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7a9c('0x2')]},'providerResponse':{'type':Sequelize[_0x7a9c('0x3')]}}; \ No newline at end of file +var _0x94be=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x1627cc,_0x5a2d2b){var _0x1ac9e2=function(_0x4d9922){while(--_0x4d9922){_0x1627cc['push'](_0x1627cc['shift']());}};_0x1ac9e2(++_0x5a2d2b);}(_0x94be,0x12b));var _0xe94b=function(_0x2cdf7a,_0x314fd4){_0x2cdf7a=_0x2cdf7a-0x0;var _0x1ad3e6=_0x94be[_0x2cdf7a];return _0x1ad3e6;};'use strict';var Sequelize=require(_0xe94b('0x0'));module[_0xe94b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xe94b('0x2')](_0xe94b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe94b('0x4')]('in',_0xe94b('0x5')),'defaultValue':_0xe94b('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe94b('0x6')]},'providerResponse':{'type':Sequelize[_0xe94b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a46c1cd..7301e91 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 _0xa3db=['SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','show','keys','includeAll','include','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x5a5dc6,_0x1ad6dd){var _0x4c47b9=function(_0x550e62){while(--_0x550e62){_0x5a5dc6['push'](_0x5a5dc6['shift']());}};_0x4c47b9(++_0x1ad6dd);}(_0xa3db,0x10c));var _0xba3d=function(_0x1b3916,_0x1af215){_0x1b3916=_0x1b3916-0x0;var _0x7e8121=_0xa3db[_0x1b3916];return _0x7e8121;};'use strict';var emlformat=require(_0xba3d('0x0'));var rimraf=require(_0xba3d('0x1'));var zipdir=require(_0xba3d('0x2'));var jsonpatch=require(_0xba3d('0x3'));var rp=require(_0xba3d('0x4'));var moment=require(_0xba3d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba3d('0x6'));var path=require('path');var sox=require(_0xba3d('0x7'));var csv=require('to-csv');var ejs=require(_0xba3d('0x8'));var fs=require('fs');var fs_extra=require(_0xba3d('0x9'));var _=require(_0xba3d('0xa'));var squel=require(_0xba3d('0xb'));var crypto=require(_0xba3d('0xc'));var jsforce=require(_0xba3d('0xd'));var deskjs=require(_0xba3d('0xe'));var toCsv=require(_0xba3d('0xf'));var querystring=require(_0xba3d('0x10'));var Papa=require(_0xba3d('0x11'));var Redis=require(_0xba3d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xba3d('0x13'));var as=require(_0xba3d('0x14'));var hardwareService=require(_0xba3d('0x15'));var logger=require(_0xba3d('0x16'))(_0xba3d('0x17'));var utils=require('../../config/utils');var config=require(_0xba3d('0x18'));var licenseUtil=require(_0xba3d('0x19'));var db=require(_0xba3d('0x1a'))['db'];function respondWithStatusCode(_0x526026,_0x47f11d){_0x47f11d=_0x47f11d||0xcc;return function(_0x1daf60){if(_0x1daf60){return _0x526026[_0xba3d('0x1b')](_0x47f11d);}return _0x526026['status'](_0x47f11d)['end']();};}function respondWithResult(_0xcdcbab,_0x497630){_0x497630=_0x497630||0xc8;return function(_0x446f86){if(_0x446f86){return _0xcdcbab[_0xba3d('0x1c')](_0x497630)[_0xba3d('0x1d')](_0x446f86);}};}function respondWithFilteredResult(_0x38fcc8,_0x327a3a){return function(_0x186bb){if(_0x186bb){var _0x19e521=typeof _0x327a3a[_0xba3d('0x1e')]===_0xba3d('0x1f')&&typeof _0x327a3a[_0xba3d('0x20')]==='undefined';var _0x208978=_0x186bb[_0xba3d('0x21')];var _0x1112ae=_0x19e521?0x0:_0x327a3a[_0xba3d('0x1e')];var _0xbb8168=_0x19e521?_0x186bb[_0xba3d('0x21')]:_0x327a3a[_0xba3d('0x1e')]+_0x327a3a[_0xba3d('0x20')];var _0x5b85e8;if(_0xbb8168>=_0x208978){_0xbb8168=_0x208978;_0x5b85e8=0xc8;}else{_0x5b85e8=0xce;}_0x38fcc8[_0xba3d('0x1c')](_0x5b85e8);return _0x38fcc8['set'](_0xba3d('0x22'),_0x1112ae+'-'+_0xbb8168+'/'+_0x208978)[_0xba3d('0x1d')](_0x186bb);}return null;};}function patchUpdates(_0x2001f5){return function(_0x3aaef4){try{jsonpatch[_0xba3d('0x23')](_0x3aaef4,_0x2001f5,!![]);}catch(_0x3ad698){return BPromise[_0xba3d('0x24')](_0x3ad698);}return _0x3aaef4[_0xba3d('0x25')]();};}function saveUpdates(_0x6db61d,_0x3b4655){return function(_0x2b10ee){if(_0x2b10ee){return _0x2b10ee[_0xba3d('0x26')](_0x6db61d)[_0xba3d('0x27')](function(_0x59f91f){return _0x59f91f;});}return null;};}function removeEntity(_0x4f2b74,_0x5ac59b){return function(_0x51bace){if(_0x51bace){return _0x51bace[_0xba3d('0x28')]()[_0xba3d('0x27')](function(){_0x4f2b74[_0xba3d('0x1c')](0xcc)[_0xba3d('0x29')]();});}};}function handleEntityNotFound(_0x17b9d9,_0x20d60f){return function(_0x4a8f81){if(!_0x4a8f81){_0x17b9d9[_0xba3d('0x1b')](0x194);}return _0x4a8f81;};}function handleError(_0x3cc662,_0x3e61d9){_0x3e61d9=_0x3e61d9||0x1f4;return function(_0x325861){logger[_0xba3d('0x2a')](_0x325861[_0xba3d('0x2b')]);if(_0x325861['name']){delete _0x325861[_0xba3d('0x2c')];}_0x3cc662[_0xba3d('0x1c')](_0x3e61d9)[_0xba3d('0x2d')](_0x325861);};}exports[_0xba3d('0x2e')]=function(_0x50e82a,_0x1a9b37){var _0x4e24d8={},_0x117b69={},_0x1bd4ec={'count':0x0,'rows':[]};var _0x25c4cc=_[_0xba3d('0x2f')](db[_0xba3d('0x30')][_0xba3d('0x31')],function(_0x3d953b){return{'name':_0x3d953b[_0xba3d('0x32')],'type':_0x3d953b[_0xba3d('0x33')][_0xba3d('0x34')]};});_0x117b69['model']=_[_0xba3d('0x2f')](_0x25c4cc,'name');_0x117b69['query']=_['keys'](_0x50e82a[_0xba3d('0x35')]);_0x117b69[_0xba3d('0x36')]=_[_0xba3d('0x37')](_0x117b69[_0xba3d('0x38')],_0x117b69[_0xba3d('0x35')]);_0x4e24d8['attributes']=_[_0xba3d('0x37')](_0x117b69[_0xba3d('0x38')],qs['fields'](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x39')]));_0x4e24d8['attributes']=_0x4e24d8[_0xba3d('0x3a')][_0xba3d('0x3b')]?_0x4e24d8['attributes']:_0x117b69[_0xba3d('0x38')];if(!_0x50e82a['query']['hasOwnProperty'](_0xba3d('0x3c'))){_0x4e24d8[_0xba3d('0x20')]=qs[_0xba3d('0x20')](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x20')]);_0x4e24d8[_0xba3d('0x1e')]=qs[_0xba3d('0x1e')](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x1e')]);}_0x4e24d8[_0xba3d('0x3d')]=qs[_0xba3d('0x3e')](_0x50e82a['query']['sort']);_0x4e24d8[_0xba3d('0x3f')]=qs['filters'](_[_0xba3d('0x40')](_0x50e82a[_0xba3d('0x35')],_0x117b69[_0xba3d('0x36')]),_0x25c4cc);if(_0x50e82a[_0xba3d('0x35')][_0xba3d('0x41')]){_0x4e24d8['where']=_[_0xba3d('0x42')](_0x4e24d8[_0xba3d('0x3f')],{'$or':_[_0xba3d('0x2f')](_0x25c4cc,function(_0x38362a){if(_0x38362a['type']!==_0xba3d('0x43')){var _0x3c754b={};_0x3c754b[_0x38362a[_0xba3d('0x2c')]]={'$like':'%'+_0x50e82a[_0xba3d('0x35')][_0xba3d('0x41')]+'%'};return _0x3c754b;}})});}_0x4e24d8=_[_0xba3d('0x42')]({},_0x4e24d8,_0x50e82a['options']);var _0x253ce2={'where':_0x4e24d8[_0xba3d('0x3f')]};return db[_0xba3d('0x30')][_0xba3d('0x21')](_0x253ce2)[_0xba3d('0x27')](function(_0x583eb5){_0x1bd4ec[_0xba3d('0x21')]=_0x583eb5;if(_0x50e82a['query']['includeAll']){_0x4e24d8['include']=[{'all':!![]}];}return db[_0xba3d('0x30')]['findAll'](_0x4e24d8);})['then'](function(_0x1f8588){_0x1bd4ec[_0xba3d('0x44')]=_0x1f8588;return _0x1bd4ec;})['then'](respondWithFilteredResult(_0x1a9b37,_0x4e24d8))['catch'](handleError(_0x1a9b37,null));};exports[_0xba3d('0x45')]=function(_0x4007e6,_0x1ab91d){var _0x17cd9d={'raw':!![],'where':{'id':_0x4007e6['params']['id']}},_0x117baa={};_0x117baa[_0xba3d('0x38')]=_[_0xba3d('0x46')](db[_0xba3d('0x30')]['rawAttributes']);_0x117baa[_0xba3d('0x35')]=_[_0xba3d('0x46')](_0x4007e6[_0xba3d('0x35')]);_0x117baa[_0xba3d('0x36')]=_[_0xba3d('0x37')](_0x117baa['model'],_0x117baa[_0xba3d('0x35')]);_0x17cd9d[_0xba3d('0x3a')]=_['intersection'](_0x117baa[_0xba3d('0x38')],qs[_0xba3d('0x39')](_0x4007e6[_0xba3d('0x35')][_0xba3d('0x39')]));_0x17cd9d['attributes']=_0x17cd9d['attributes']['length']?_0x17cd9d[_0xba3d('0x3a')]:_0x117baa[_0xba3d('0x38')];if(_0x4007e6[_0xba3d('0x35')][_0xba3d('0x47')]){_0x17cd9d[_0xba3d('0x48')]=[{'all':!![]}];}_0x17cd9d=_[_0xba3d('0x42')]({},_0x17cd9d,_0x4007e6[_0xba3d('0x49')]);return db['SquareMessage'][_0xba3d('0x4a')](_0x17cd9d)[_0xba3d('0x27')](handleEntityNotFound(_0x1ab91d,null))[_0xba3d('0x27')](respondWithResult(_0x1ab91d,null))[_0xba3d('0x4b')](handleError(_0x1ab91d,null));};exports[_0xba3d('0x4c')]=function(_0xeb7f49,_0x545f30){return db[_0xba3d('0x30')]['create'](_0xeb7f49[_0xba3d('0x4d')],{})[_0xba3d('0x27')](respondWithResult(_0x545f30,0xc9))[_0xba3d('0x4b')](handleError(_0x545f30,null));};exports[_0xba3d('0x26')]=function(_0x468c08,_0x48cfad){if(_0x468c08[_0xba3d('0x4d')]['id']){delete _0x468c08[_0xba3d('0x4d')]['id'];}return db['SquareMessage'][_0xba3d('0x4a')]({'where':{'id':_0x468c08[_0xba3d('0x4e')]['id']}})[_0xba3d('0x27')](handleEntityNotFound(_0x48cfad,null))[_0xba3d('0x27')](saveUpdates(_0x468c08[_0xba3d('0x4d')],null))[_0xba3d('0x27')](respondWithResult(_0x48cfad,null))[_0xba3d('0x4b')](handleError(_0x48cfad,null));};exports[_0xba3d('0x28')]=function(_0x5b84da,_0x57a073){return db[_0xba3d('0x30')][_0xba3d('0x4a')]({'where':{'id':_0x5b84da['params']['id']}})[_0xba3d('0x27')](handleEntityNotFound(_0x57a073,null))[_0xba3d('0x27')](removeEntity(_0x57a073,null))[_0xba3d('0x4b')](handleError(_0x57a073,null));}; \ No newline at end of file +var _0xeff9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','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','undefined','count','offset','limit','Content-Range','reject','save','update','then','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','eml-format'];(function(_0x3d34a9,_0x4df159){var _0x430f1e=function(_0xe88d2b){while(--_0xe88d2b){_0x3d34a9['push'](_0x3d34a9['shift']());}};_0x430f1e(++_0x4df159);}(_0xeff9,0x15d));var _0x9eff=function(_0x297e7b,_0x2ec5c4){_0x297e7b=_0x297e7b-0x0;var _0xd497b7=_0xeff9[_0x297e7b];return _0xd497b7;};'use strict';var emlformat=require(_0x9eff('0x0'));var rimraf=require(_0x9eff('0x1'));var zipdir=require(_0x9eff('0x2'));var jsonpatch=require(_0x9eff('0x3'));var rp=require(_0x9eff('0x4'));var moment=require(_0x9eff('0x5'));var BPromise=require(_0x9eff('0x6'));var Mustache=require(_0x9eff('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9eff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9eff('0x9'));var _=require('lodash');var squel=require(_0x9eff('0xa'));var crypto=require(_0x9eff('0xb'));var jsforce=require(_0x9eff('0xc'));var deskjs=require(_0x9eff('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9eff('0xe'));var Papa=require(_0x9eff('0xf'));var Redis=require('ioredis');var authService=require(_0x9eff('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9eff('0x11'));var hardwareService=require(_0x9eff('0x12'));var logger=require(_0x9eff('0x13'))('api');var utils=require(_0x9eff('0x14'));var config=require(_0x9eff('0x15'));var licenseUtil=require(_0x9eff('0x16'));var db=require(_0x9eff('0x17'))['db'];function respondWithStatusCode(_0x39d821,_0x3cc068){_0x3cc068=_0x3cc068||0xcc;return function(_0xe7e7b9){if(_0xe7e7b9){return _0x39d821[_0x9eff('0x18')](_0x3cc068);}return _0x39d821[_0x9eff('0x19')](_0x3cc068)[_0x9eff('0x1a')]();};}function respondWithResult(_0x1f4629,_0x1d3ec6){_0x1d3ec6=_0x1d3ec6||0xc8;return function(_0x3f4a26){if(_0x3f4a26){return _0x1f4629[_0x9eff('0x19')](_0x1d3ec6)[_0x9eff('0x1b')](_0x3f4a26);}};}function respondWithFilteredResult(_0x174be7,_0x24a3fa){return function(_0x328645){if(_0x328645){var _0x11aaae=typeof _0x24a3fa['offset']===_0x9eff('0x1c')&&typeof _0x24a3fa['limit']===_0x9eff('0x1c');var _0x1681b6=_0x328645[_0x9eff('0x1d')];var _0x24f460=_0x11aaae?0x0:_0x24a3fa[_0x9eff('0x1e')];var _0x1964a3=_0x11aaae?_0x328645[_0x9eff('0x1d')]:_0x24a3fa[_0x9eff('0x1e')]+_0x24a3fa[_0x9eff('0x1f')];var _0x5615f6;if(_0x1964a3>=_0x1681b6){_0x1964a3=_0x1681b6;_0x5615f6=0xc8;}else{_0x5615f6=0xce;}_0x174be7[_0x9eff('0x19')](_0x5615f6);return _0x174be7['set'](_0x9eff('0x20'),_0x24f460+'-'+_0x1964a3+'/'+_0x1681b6)['json'](_0x328645);}return null;};}function patchUpdates(_0x5458ec){return function(_0xacf6d9){try{jsonpatch['apply'](_0xacf6d9,_0x5458ec,!![]);}catch(_0x4761b5){return BPromise[_0x9eff('0x21')](_0x4761b5);}return _0xacf6d9[_0x9eff('0x22')]();};}function saveUpdates(_0x187158,_0x462f34){return function(_0x42927c){if(_0x42927c){return _0x42927c[_0x9eff('0x23')](_0x187158)[_0x9eff('0x24')](function(_0x35f56c){return _0x35f56c;});}return null;};}function removeEntity(_0x2101e0,_0x5d4ce9){return function(_0x5087d3){if(_0x5087d3){return _0x5087d3['destroy']()['then'](function(){_0x2101e0[_0x9eff('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461b80,_0x20c14b){return function(_0xa22f5){if(!_0xa22f5){_0x461b80[_0x9eff('0x18')](0x194);}return _0xa22f5;};}function handleError(_0x286ccb,_0x477d96){_0x477d96=_0x477d96||0x1f4;return function(_0x4f9694){logger[_0x9eff('0x25')](_0x4f9694[_0x9eff('0x26')]);if(_0x4f9694[_0x9eff('0x27')]){delete _0x4f9694[_0x9eff('0x27')];}_0x286ccb[_0x9eff('0x19')](_0x477d96)[_0x9eff('0x28')](_0x4f9694);};}exports['index']=function(_0x5ced4b,_0x3ae788){var _0x314778={},_0x2a7de2={},_0x26e6f7={'count':0x0,'rows':[]};var _0x4bacb2=_[_0x9eff('0x29')](db[_0x9eff('0x2a')][_0x9eff('0x2b')],function(_0x4e65dd){return{'name':_0x4e65dd[_0x9eff('0x2c')],'type':_0x4e65dd[_0x9eff('0x2d')][_0x9eff('0x2e')]};});_0x2a7de2[_0x9eff('0x2f')]=_[_0x9eff('0x29')](_0x4bacb2,_0x9eff('0x27'));_0x2a7de2[_0x9eff('0x30')]=_[_0x9eff('0x31')](_0x5ced4b[_0x9eff('0x30')]);_0x2a7de2[_0x9eff('0x32')]=_[_0x9eff('0x33')](_0x2a7de2[_0x9eff('0x2f')],_0x2a7de2['query']);_0x314778[_0x9eff('0x34')]=_[_0x9eff('0x33')](_0x2a7de2['model'],qs['fields'](_0x5ced4b[_0x9eff('0x30')]['fields']));_0x314778['attributes']=_0x314778[_0x9eff('0x34')][_0x9eff('0x35')]?_0x314778[_0x9eff('0x34')]:_0x2a7de2['model'];if(!_0x5ced4b[_0x9eff('0x30')]['hasOwnProperty']('nolimit')){_0x314778[_0x9eff('0x1f')]=qs[_0x9eff('0x1f')](_0x5ced4b[_0x9eff('0x30')][_0x9eff('0x1f')]);_0x314778[_0x9eff('0x1e')]=qs[_0x9eff('0x1e')](_0x5ced4b[_0x9eff('0x30')]['offset']);}_0x314778['order']=qs[_0x9eff('0x36')](_0x5ced4b['query'][_0x9eff('0x36')]);_0x314778[_0x9eff('0x37')]=qs[_0x9eff('0x32')](_[_0x9eff('0x38')](_0x5ced4b[_0x9eff('0x30')],_0x2a7de2[_0x9eff('0x32')]),_0x4bacb2);if(_0x5ced4b[_0x9eff('0x30')][_0x9eff('0x39')]){_0x314778[_0x9eff('0x37')]=_[_0x9eff('0x3a')](_0x314778[_0x9eff('0x37')],{'$or':_[_0x9eff('0x29')](_0x4bacb2,function(_0x24f5c1){if(_0x24f5c1[_0x9eff('0x2d')]!=='VIRTUAL'){var _0x648b2b={};_0x648b2b[_0x24f5c1[_0x9eff('0x27')]]={'$like':'%'+_0x5ced4b[_0x9eff('0x30')][_0x9eff('0x39')]+'%'};return _0x648b2b;}})});}_0x314778=_[_0x9eff('0x3a')]({},_0x314778,_0x5ced4b[_0x9eff('0x3b')]);var _0x56eb00={'where':_0x314778[_0x9eff('0x37')]};return db['SquareMessage']['count'](_0x56eb00)[_0x9eff('0x24')](function(_0x1cf02d){_0x26e6f7['count']=_0x1cf02d;if(_0x5ced4b['query'][_0x9eff('0x3c')]){_0x314778[_0x9eff('0x3d')]=[{'all':!![]}];}return db[_0x9eff('0x2a')]['findAll'](_0x314778);})[_0x9eff('0x24')](function(_0x40db50){_0x26e6f7[_0x9eff('0x3e')]=_0x40db50;return _0x26e6f7;})[_0x9eff('0x24')](respondWithFilteredResult(_0x3ae788,_0x314778))[_0x9eff('0x3f')](handleError(_0x3ae788,null));};exports[_0x9eff('0x40')]=function(_0x233327,_0x18a477){var _0x5a87ec={'raw':!![],'where':{'id':_0x233327[_0x9eff('0x41')]['id']}},_0x24d924={};_0x24d924[_0x9eff('0x2f')]=_['keys'](db['SquareMessage'][_0x9eff('0x2b')]);_0x24d924[_0x9eff('0x30')]=_['keys'](_0x233327[_0x9eff('0x30')]);_0x24d924[_0x9eff('0x32')]=_[_0x9eff('0x33')](_0x24d924[_0x9eff('0x2f')],_0x24d924[_0x9eff('0x30')]);_0x5a87ec[_0x9eff('0x34')]=_['intersection'](_0x24d924['model'],qs['fields'](_0x233327[_0x9eff('0x30')][_0x9eff('0x42')]));_0x5a87ec['attributes']=_0x5a87ec[_0x9eff('0x34')][_0x9eff('0x35')]?_0x5a87ec[_0x9eff('0x34')]:_0x24d924[_0x9eff('0x2f')];if(_0x233327[_0x9eff('0x30')]['includeAll']){_0x5a87ec[_0x9eff('0x3d')]=[{'all':!![]}];}_0x5a87ec=_[_0x9eff('0x3a')]({},_0x5a87ec,_0x233327[_0x9eff('0x3b')]);return db[_0x9eff('0x2a')][_0x9eff('0x43')](_0x5a87ec)['then'](handleEntityNotFound(_0x18a477,null))[_0x9eff('0x24')](respondWithResult(_0x18a477,null))[_0x9eff('0x3f')](handleError(_0x18a477,null));};exports[_0x9eff('0x44')]=function(_0x35e3e4,_0x5bb000){return db[_0x9eff('0x2a')]['create'](_0x35e3e4['body'],{})['then'](respondWithResult(_0x5bb000,0xc9))['catch'](handleError(_0x5bb000,null));};exports[_0x9eff('0x23')]=function(_0x1a273e,_0x1488b0){if(_0x1a273e[_0x9eff('0x45')]['id']){delete _0x1a273e[_0x9eff('0x45')]['id'];}return db[_0x9eff('0x2a')][_0x9eff('0x43')]({'where':{'id':_0x1a273e[_0x9eff('0x41')]['id']}})['then'](handleEntityNotFound(_0x1488b0,null))['then'](saveUpdates(_0x1a273e[_0x9eff('0x45')],null))[_0x9eff('0x24')](respondWithResult(_0x1488b0,null))[_0x9eff('0x3f')](handleError(_0x1488b0,null));};exports['destroy']=function(_0x12ba85,_0x36d05c){return db[_0x9eff('0x2a')][_0x9eff('0x43')]({'where':{'id':_0x12ba85['params']['id']}})['then'](handleEntityNotFound(_0x36d05c,null))['then'](removeEntity(_0x36d05c,null))['catch'](handleError(_0x36d05c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b9dd6df..2f48867 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 _0xe4db=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages'];(function(_0x3de6a3,_0x312259){var _0x3f7a4d=function(_0x6eb1c8){while(--_0x6eb1c8){_0x3de6a3['push'](_0x3de6a3['shift']());}};_0x3f7a4d(++_0x312259);}(_0xe4db,0x1e1));var _0xbe4d=function(_0x34d323,_0x17a187){_0x34d323=_0x34d323-0x0;var _0x36a73d=_0xe4db[_0x34d323];return _0x36a73d;};'use strict';var _=require(_0xbe4d('0x0'));var util=require('util');var logger=require(_0xbe4d('0x1'))(_0xbe4d('0x2'));var moment=require(_0xbe4d('0x3'));var BPromise=require(_0xbe4d('0x4'));var rp=require(_0xbe4d('0x5'));var fs=require('fs');var path=require(_0xbe4d('0x6'));var rimraf=require(_0xbe4d('0x7'));var config=require(_0xbe4d('0x8'));var attributes=require(_0xbe4d('0x9'));module['exports']=function(_0x33b22e,_0x31bbb2){return _0x33b22e[_0xbe4d('0xa')](_0xbe4d('0xb'),attributes,{'tableName':_0xbe4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3d3=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x29cdae,_0x2a47fd){var _0x4e11b4=function(_0x34857e){while(--_0x34857e){_0x29cdae['push'](_0x29cdae['shift']());}};_0x4e11b4(++_0x2a47fd);}(_0xf3d3,0x166));var _0x3f3d=function(_0x237a43,_0x54832e){_0x237a43=_0x237a43-0x0;var _0x311e1c=_0xf3d3[_0x237a43];return _0x311e1c;};'use strict';var _=require(_0x3f3d('0x0'));var util=require(_0x3f3d('0x1'));var logger=require(_0x3f3d('0x2'))(_0x3f3d('0x3'));var moment=require('moment');var BPromise=require(_0x3f3d('0x4'));var rp=require(_0x3f3d('0x5'));var fs=require('fs');var path=require(_0x3f3d('0x6'));var rimraf=require('rimraf');var config=require(_0x3f3d('0x7'));var attributes=require(_0x3f3d('0x8'));module[_0x3f3d('0x9')]=function(_0x521cf0,_0x403433){return _0x521cf0['define'](_0x3f3d('0xa'),attributes,{'tableName':_0x3f3d('0xb'),'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 a297b1a..647c82b 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 _0x7a76=['CreateSquareMessage','SquareMessage','create','body','options','raw','debug','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x7a76,0x6b));var _0x67a7=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x7a76[_0x44ae0b];return _0x69232a;};'use strict';var _=require('lodash');var util=require(_0x67a7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x67a7('0x1'));var fs=require('fs');var Redis=require(_0x67a7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x67a7('0x3'));var logger=require('../../config/logger')(_0x67a7('0x4'));var config=require(_0x67a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x67a7('0x6')][_0x67a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31b855,_0x57c5be,_0x583bd1){return new BPromise(function(_0x4392cf,_0x5edca4){return client[_0x67a7('0x8')](_0x31b855,_0x583bd1)['then'](function(_0x1f4e34){logger['info'](_0x67a7('0x9'),_0x57c5be,'request\x20sent');logger['debug'](_0x67a7('0xa'),_0x57c5be,_0x67a7('0xb'),JSON[_0x67a7('0xc')](_0x1f4e34));if(_0x1f4e34[_0x67a7('0xd')]){if(_0x1f4e34[_0x67a7('0xd')][_0x67a7('0xe')]===0x1f4){logger[_0x67a7('0xd')](_0x67a7('0x9'),_0x57c5be,_0x1f4e34['error'][_0x67a7('0xf')]);return _0x5edca4(_0x1f4e34[_0x67a7('0xd')]['message']);}logger[_0x67a7('0xd')](_0x67a7('0x9'),_0x57c5be,_0x1f4e34[_0x67a7('0xd')]['message']);return _0x4392cf(_0x1f4e34[_0x67a7('0xd')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x57c5be,_0x67a7('0xb'));_0x4392cf(_0x1f4e34[_0x67a7('0x10')]['message']);}})[_0x67a7('0x11')](function(_0x3a59b7){logger[_0x67a7('0xd')]('SquareMessage,\x20%s,\x20%s',_0x57c5be,_0x3a59b7);_0x5edca4(_0x3a59b7);});});}exports[_0x67a7('0x12')]=function(_0x10d965){var _0x5242a0=this;return new Promise(function(_0x397ab6,_0x5b7bd7){return db[_0x67a7('0x13')][_0x67a7('0x14')](_0x10d965[_0x67a7('0x15')],{'raw':_0x10d965[_0x67a7('0x16')]?_0x10d965[_0x67a7('0x16')][_0x67a7('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4b3df5){logger['info'](_0x67a7('0x12'),_0x10d965);logger[_0x67a7('0x18')](_0x67a7('0x12'),_0x10d965,JSON[_0x67a7('0xc')](_0x4b3df5));_0x397ab6(_0x4b3df5);})[_0x67a7('0x11')](function(_0x4fdd60){logger['error'](_0x67a7('0x12'),_0x4fdd60['message'],_0x10d965);_0x5b7bd7(_0x5242a0[_0x67a7('0xd')](0x1f4,_0x4fdd60[_0x67a7('0xf')]));});});}; \ No newline at end of file +var _0x4794=['lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareMessage','create','options','raw'];(function(_0x1ad0d0,_0x3e4614){var _0xa5e9ae=function(_0x4f22dc){while(--_0x4f22dc){_0x1ad0d0['push'](_0x1ad0d0['shift']());}};_0xa5e9ae(++_0x3e4614);}(_0x4794,0x15e));var _0x4479=function(_0x324ecc,_0x11e5f8){_0x324ecc=_0x324ecc-0x0;var _0xb7c8eb=_0x4794[_0x324ecc];return _0xb7c8eb;};'use strict';var _=require(_0x4479('0x0'));var util=require(_0x4479('0x1'));var moment=require('moment');var BPromise=require(_0x4479('0x2'));var rs=require(_0x4479('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4479('0x4'));var logger=require('../../config/logger')(_0x4479('0x5'));var config=require('../../config/environment');var jayson=require(_0x4479('0x6'));var client=jayson[_0x4479('0x7')][_0x4479('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c46a0,_0x1d3c44,_0x372d88){return new BPromise(function(_0x306776,_0xd2d59e){return client[_0x4479('0x9')](_0x5c46a0,_0x372d88)[_0x4479('0xa')](function(_0x4f3f17){logger['info'](_0x4479('0xb'),_0x1d3c44,_0x4479('0xc'));logger[_0x4479('0xd')](_0x4479('0xe'),_0x1d3c44,_0x4479('0xc'),JSON[_0x4479('0xf')](_0x4f3f17));if(_0x4f3f17['error']){if(_0x4f3f17[_0x4479('0x10')][_0x4479('0x11')]===0x1f4){logger[_0x4479('0x10')](_0x4479('0xb'),_0x1d3c44,_0x4f3f17[_0x4479('0x10')][_0x4479('0x12')]);return _0xd2d59e(_0x4f3f17['error'][_0x4479('0x12')]);}logger['error'](_0x4479('0xb'),_0x1d3c44,_0x4f3f17[_0x4479('0x10')][_0x4479('0x12')]);return _0x306776(_0x4f3f17[_0x4479('0x10')][_0x4479('0x12')]);}else{logger[_0x4479('0x13')](_0x4479('0xb'),_0x1d3c44,'request\x20sent');_0x306776(_0x4f3f17['result'][_0x4479('0x12')]);}})[_0x4479('0x14')](function(_0x3bbf6b){logger[_0x4479('0x10')](_0x4479('0xb'),_0x1d3c44,_0x3bbf6b);_0xd2d59e(_0x3bbf6b);});});}exports[_0x4479('0x15')]=function(_0x3585e4){var _0x5e7e78=this;return new Promise(function(_0x4ef44c,_0x27a308){return db['SquareMessage'][_0x4479('0x16')](_0x3585e4['body'],{'raw':_0x3585e4[_0x4479('0x17')]?_0x3585e4['options'][_0x4479('0x18')]===undefined?!![]:![]:!![]})[_0x4479('0xa')](function(_0x72d5a){logger[_0x4479('0x13')](_0x4479('0x15'),_0x3585e4);logger[_0x4479('0xd')](_0x4479('0x15'),_0x3585e4,JSON[_0x4479('0xf')](_0x72d5a));_0x4ef44c(_0x72d5a);})[_0x4479('0x14')](function(_0x4bcbf5){logger['error']('CreateSquareMessage',_0x4bcbf5[_0x4479('0x12')],_0x3585e4);_0x27a308(_0x5e7e78[_0x4479('0x10')](0x1f4,_0x4bcbf5[_0x4479('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 44cefa3..291d12d 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 _0xae95=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','post'];(function(_0x2c27f9,_0x120e57){var _0x38edef=function(_0x31c018){while(--_0x31c018){_0x2c27f9['push'](_0x2c27f9['shift']());}};_0x38edef(++_0x120e57);}(_0xae95,0x117));var _0x5ae9=function(_0x4de617,_0x2a9ad7){_0x4de617=_0x4de617-0x0;var _0x38df67=_0xae95[_0x4de617];return _0x38df67;};'use strict';var multer=require(_0x5ae9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ae9('0x1'));var express=require(_0x5ae9('0x2'));var router=express[_0x5ae9('0x3')]();var fs_extra=require(_0x5ae9('0x4'));var auth=require(_0x5ae9('0x5'));var interaction=require(_0x5ae9('0x6'));var config=require(_0x5ae9('0x7'));var controller=require(_0x5ae9('0x8'));router[_0x5ae9('0x9')]('/',auth[_0x5ae9('0xa')](),controller['index']);router[_0x5ae9('0x9')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0xc')]);router[_0x5ae9('0x9')](_0x5ae9('0xd'),auth[_0x5ae9('0xa')](),timeout('15s'),controller['test']);router[_0x5ae9('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ae9('0xf')]);router[_0x5ae9('0x10')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x11')]);router[_0x5ae9('0x12')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x13')]);module[_0x5ae9('0x14')]=router; \ No newline at end of file +var _0xd121=['get','index','/:id','isAuthenticated','show','/:id/test','15s','test','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0xacd13,_0x119f4e){var _0x230b40=function(_0x308666){while(--_0x308666){_0xacd13['push'](_0xacd13['shift']());}};_0x230b40(++_0x119f4e);}(_0xd121,0x18e));var _0x1d12=function(_0xd2ab0e,_0x50fad3){_0xd2ab0e=_0xd2ab0e-0x0;var _0x50c371=_0xd121[_0xd2ab0e];return _0x50c371;};'use strict';var multer=require(_0x1d12('0x0'));var util=require(_0x1d12('0x1'));var path=require(_0x1d12('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d12('0x3'));var router=express[_0x1d12('0x4')]();var fs_extra=require(_0x1d12('0x5'));var auth=require(_0x1d12('0x6'));var interaction=require(_0x1d12('0x7'));var config=require(_0x1d12('0x8'));var controller=require(_0x1d12('0x9'));router[_0x1d12('0xa')]('/',auth['isAuthenticated'](),controller[_0x1d12('0xb')]);router[_0x1d12('0xa')](_0x1d12('0xc'),auth[_0x1d12('0xd')](),controller[_0x1d12('0xe')]);router['get'](_0x1d12('0xf'),auth['isAuthenticated'](),timeout(_0x1d12('0x10')),controller[_0x1d12('0x11')]);router[_0x1d12('0x12')]('/',auth['isAuthenticated'](),controller[_0x1d12('0x13')]);router['put'](_0x1d12('0xc'),auth[_0x1d12('0xd')](),controller[_0x1d12('0x14')]);router[_0x1d12('0x15')]('/:id',auth[_0x1d12('0xd')](),controller[_0x1d12('0x16')]);module[_0x1d12('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d4b0880..793be74 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 _0x9e90=['sequelize','STRING','name'];(function(_0x1960b5,_0x1835a4){var _0x18f387=function(_0x4f781b){while(--_0x4f781b){_0x1960b5['push'](_0x1960b5['shift']());}};_0x18f387(++_0x1835a4);}(_0x9e90,0x1ce));var _0x09e9=function(_0x517124,_0x3a2900){_0x517124=_0x517124-0x0;var _0x35accd=_0x9e90[_0x517124];return _0x35accd;};'use strict';var Sequelize=require(_0x09e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x09e9('0x1')],'unique':_0x09e9('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x09e9('0x1')]},'description':{'type':Sequelize[_0x09e9('0x1')]}}; \ No newline at end of file +var _0xa961=['exports','STRING','sequelize'];(function(_0x520aca,_0xe2cb7a){var _0x206799=function(_0x2bd1fd){while(--_0x2bd1fd){_0x520aca['push'](_0x520aca['shift']());}};_0x206799(++_0xe2cb7a);}(_0xa961,0xda));var _0x1a96=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xa961[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require(_0x1a96('0x0'));module[_0x1a96('0x1')]={'name':{'type':Sequelize[_0x1a96('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x1a96('0x2')]},'description':{'type':Sequelize[_0x1a96('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3fb9f95..0eb4926 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 _0xc45f=['path','sox','to-csv','ejs','fs-extra','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x5dbd8c,_0x290203){var _0x277a82=function(_0x1fb90b){while(--_0x1fb90b){_0x5dbd8c['push'](_0x5dbd8c['shift']());}};_0x277a82(++_0x290203);}(_0xc45f,0xf5));var _0xfc45=function(_0x3e606f,_0x3166d6){_0x3e606f=_0x3e606f-0x0;var _0x419f84=_0xc45f[_0x3e606f];return _0x419f84;};'use strict';var emlformat=require(_0xfc45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc45('0x1'));var jsonpatch=require(_0xfc45('0x2'));var rp=require('request-promise');var moment=require(_0xfc45('0x3'));var BPromise=require(_0xfc45('0x4'));var Mustache=require(_0xfc45('0x5'));var util=require(_0xfc45('0x6'));var path=require(_0xfc45('0x7'));var sox=require(_0xfc45('0x8'));var csv=require(_0xfc45('0x9'));var ejs=require(_0xfc45('0xa'));var fs=require('fs');var fs_extra=require(_0xfc45('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc45('0xc'));var toCsv=require(_0xfc45('0x9'));var querystring=require('querystring');var Papa=require(_0xfc45('0xd'));var Redis=require(_0xfc45('0xe'));var authService=require(_0xfc45('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc45('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfc45('0x11'));var utils=require(_0xfc45('0x12'));var config=require(_0xfc45('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc45('0x14'))['db'];function respondWithStatusCode(_0x390679,_0x5a08ce){_0x5a08ce=_0x5a08ce||0xcc;return function(_0x4b359b){if(_0x4b359b){return _0x390679[_0xfc45('0x15')](_0x5a08ce);}return _0x390679[_0xfc45('0x16')](_0x5a08ce)[_0xfc45('0x17')]();};}function respondWithResult(_0x1a04c4,_0x17058a){_0x17058a=_0x17058a||0xc8;return function(_0x1cdaab){if(_0x1cdaab){return _0x1a04c4[_0xfc45('0x16')](_0x17058a)['json'](_0x1cdaab);}};}function respondWithFilteredResult(_0xaf867a,_0x2f84cd){return function(_0x437b2a){if(_0x437b2a){var _0x402e7c=typeof _0x2f84cd[_0xfc45('0x18')]===_0xfc45('0x19')&&typeof _0x2f84cd[_0xfc45('0x1a')]===_0xfc45('0x19');var _0x45386f=_0x437b2a['count'];var _0x2a0ab9=_0x402e7c?0x0:_0x2f84cd[_0xfc45('0x18')];var _0x539e62=_0x402e7c?_0x437b2a[_0xfc45('0x1b')]:_0x2f84cd[_0xfc45('0x18')]+_0x2f84cd[_0xfc45('0x1a')];var _0x123e8b;if(_0x539e62>=_0x45386f){_0x539e62=_0x45386f;_0x123e8b=0xc8;}else{_0x123e8b=0xce;}_0xaf867a['status'](_0x123e8b);return _0xaf867a[_0xfc45('0x1c')](_0xfc45('0x1d'),_0x2a0ab9+'-'+_0x539e62+'/'+_0x45386f)[_0xfc45('0x1e')](_0x437b2a);}return null;};}function patchUpdates(_0x2c168d){return function(_0x4cd4d8){try{jsonpatch[_0xfc45('0x1f')](_0x4cd4d8,_0x2c168d,!![]);}catch(_0x2e1695){return BPromise['reject'](_0x2e1695);}return _0x4cd4d8[_0xfc45('0x20')]();};}function saveUpdates(_0x535373,_0x1def14){return function(_0x117534){if(_0x117534){return _0x117534[_0xfc45('0x21')](_0x535373)[_0xfc45('0x22')](function(_0x1d9cc3){return _0x1d9cc3;});}return null;};}function removeEntity(_0x123465,_0x53df41){return function(_0x5ce183){if(_0x5ce183){return _0x5ce183[_0xfc45('0x23')]()[_0xfc45('0x22')](function(){var _0x20e2e6=_0x5ce183[_0xfc45('0x24')]({'plain':!![]});var _0x2d8dcf=_0xfc45('0x25');return db[_0xfc45('0x26')][_0xfc45('0x23')]({'where':{'type':_0x2d8dcf,'resourceId':_0x20e2e6['id']}})[_0xfc45('0x22')](function(){return _0x5ce183;});})['then'](function(){_0x123465[_0xfc45('0x16')](0xcc)[_0xfc45('0x17')]();});}};}function handleEntityNotFound(_0x8c8a1e,_0x4a2edb){return function(_0x4a19e9){if(!_0x4a19e9){_0x8c8a1e[_0xfc45('0x15')](0x194);}return _0x4a19e9;};}function handleError(_0x41d1c0,_0x385e29){_0x385e29=_0x385e29||0x1f4;return function(_0x528368){logger['error'](_0x528368[_0xfc45('0x27')]);if(_0x528368[_0xfc45('0x28')]){delete _0x528368['name'];}_0x41d1c0[_0xfc45('0x16')](_0x385e29)[_0xfc45('0x29')](_0x528368);};}exports['index']=function(_0x43e232,_0x398049){var _0x21263d={},_0x406286={},_0xc6fe61={'count':0x0,'rows':[]};var _0x544c55=_[_0xfc45('0x2a')](db[_0xfc45('0x2b')][_0xfc45('0x2c')],function(_0x5d42bf){return{'name':_0x5d42bf[_0xfc45('0x2d')],'type':_0x5d42bf[_0xfc45('0x2e')][_0xfc45('0x2f')]};});_0x406286[_0xfc45('0x30')]=_[_0xfc45('0x2a')](_0x544c55,_0xfc45('0x28'));_0x406286[_0xfc45('0x31')]=_[_0xfc45('0x32')](_0x43e232[_0xfc45('0x31')]);_0x406286[_0xfc45('0x33')]=_['intersection'](_0x406286[_0xfc45('0x30')],_0x406286[_0xfc45('0x31')]);_0x21263d[_0xfc45('0x34')]=_[_0xfc45('0x35')](_0x406286[_0xfc45('0x30')],qs['fields'](_0x43e232[_0xfc45('0x31')][_0xfc45('0x36')]));_0x21263d['attributes']=_0x21263d[_0xfc45('0x34')][_0xfc45('0x37')]?_0x21263d[_0xfc45('0x34')]:_0x406286[_0xfc45('0x30')];if(!_0x43e232[_0xfc45('0x31')][_0xfc45('0x38')](_0xfc45('0x39'))){_0x21263d['limit']=qs[_0xfc45('0x1a')](_0x43e232[_0xfc45('0x31')]['limit']);_0x21263d[_0xfc45('0x18')]=qs[_0xfc45('0x18')](_0x43e232[_0xfc45('0x31')]['offset']);}_0x21263d[_0xfc45('0x3a')]=qs[_0xfc45('0x3b')](_0x43e232[_0xfc45('0x31')]['sort']);_0x21263d[_0xfc45('0x3c')]=qs[_0xfc45('0x33')](_['pick'](_0x43e232['query'],_0x406286['filters']),_0x544c55);if(_0x43e232['query'][_0xfc45('0x3d')]){_0x21263d[_0xfc45('0x3c')]=_[_0xfc45('0x3e')](_0x21263d[_0xfc45('0x3c')],{'$or':_[_0xfc45('0x2a')](_0x544c55,function(_0x2edf37){if(_0x2edf37[_0xfc45('0x2e')]!=='VIRTUAL'){var _0x23e7f9={};_0x23e7f9[_0x2edf37[_0xfc45('0x28')]]={'$like':'%'+_0x43e232[_0xfc45('0x31')]['filter']+'%'};return _0x23e7f9;}})});}_0x21263d=_[_0xfc45('0x3e')]({},_0x21263d,_0x43e232['options']);var _0x404bab={'where':_0x21263d[_0xfc45('0x3c')]};return db[_0xfc45('0x2b')][_0xfc45('0x1b')](_0x404bab)[_0xfc45('0x22')](function(_0x59e938){_0xc6fe61[_0xfc45('0x1b')]=_0x59e938;if(_0x43e232[_0xfc45('0x31')][_0xfc45('0x3f')]){_0x21263d[_0xfc45('0x40')]=[{'all':!![]}];}return db[_0xfc45('0x2b')][_0xfc45('0x41')](_0x21263d);})['then'](function(_0x4bbd05){_0xc6fe61['rows']=_0x4bbd05;return _0xc6fe61;})['then'](respondWithFilteredResult(_0x398049,_0x21263d))[_0xfc45('0x42')](handleError(_0x398049,null));};exports[_0xfc45('0x43')]=function(_0x31b630,_0x22f6d9){var _0x265a5b={'raw':!![],'where':{'id':_0x31b630[_0xfc45('0x44')]['id']}},_0xd9aaf7={};_0xd9aaf7[_0xfc45('0x30')]=_[_0xfc45('0x32')](db[_0xfc45('0x2b')]['rawAttributes']);_0xd9aaf7['query']=_[_0xfc45('0x32')](_0x31b630['query']);_0xd9aaf7[_0xfc45('0x33')]=_['intersection'](_0xd9aaf7[_0xfc45('0x30')],_0xd9aaf7['query']);_0x265a5b[_0xfc45('0x34')]=_[_0xfc45('0x35')](_0xd9aaf7[_0xfc45('0x30')],qs[_0xfc45('0x36')](_0x31b630[_0xfc45('0x31')][_0xfc45('0x36')]));_0x265a5b['attributes']=_0x265a5b[_0xfc45('0x34')][_0xfc45('0x37')]?_0x265a5b[_0xfc45('0x34')]:_0xd9aaf7[_0xfc45('0x30')];if(_0x31b630[_0xfc45('0x31')][_0xfc45('0x3f')]){_0x265a5b[_0xfc45('0x40')]=[{'all':!![]}];}_0x265a5b=_[_0xfc45('0x3e')]({},_0x265a5b,_0x31b630['options']);return db[_0xfc45('0x2b')]['find'](_0x265a5b)[_0xfc45('0x22')](handleEntityNotFound(_0x22f6d9,null))[_0xfc45('0x22')](respondWithResult(_0x22f6d9,null))[_0xfc45('0x42')](handleError(_0x22f6d9,null));};exports[_0xfc45('0x45')]=function(_0x58c8ce,_0x105582){return db[_0xfc45('0x2b')][_0xfc45('0x45')](_0x58c8ce[_0xfc45('0x46')],{})[_0xfc45('0x22')](function(_0x22d3b4){var _0x24e445=_0x58c8ce[_0xfc45('0x47')][_0xfc45('0x24')]({'plain':!![]});if(!_0x24e445)throw new Error(_0xfc45('0x48'));if(_0x24e445[_0xfc45('0x49')]===_0xfc45('0x47')){var _0x5ef9a3=_0x22d3b4[_0xfc45('0x24')]({'plain':!![]});var _0x5a3f9e='ODBC';return db[_0xfc45('0x4a')][_0xfc45('0x4b')]({'where':{'name':_0x5a3f9e,'userProfileId':_0x24e445[_0xfc45('0x4c')]},'raw':!![]})[_0xfc45('0x22')](function(_0x584afe){if(_0x584afe&&_0x584afe[_0xfc45('0x4d')]===0x0){return db[_0xfc45('0x26')][_0xfc45('0x45')]({'name':_0x5ef9a3[_0xfc45('0x28')],'resourceId':_0x5ef9a3['id'],'type':_0x584afe[_0xfc45('0x28')],'sectionId':_0x584afe['id']},{})[_0xfc45('0x22')](function(){return _0x22d3b4;});}else{return _0x22d3b4;}})[_0xfc45('0x42')](function(_0x354786){logger['error'](_0xfc45('0x4e'),_0x354786);throw _0x354786;});}return _0x22d3b4;})['then'](respondWithResult(_0x105582,0xc9))[_0xfc45('0x42')](handleError(_0x105582,null));};exports[_0xfc45('0x21')]=function(_0x351075,_0xd323e3){if(_0x351075[_0xfc45('0x46')]['id']){delete _0x351075[_0xfc45('0x46')]['id'];}return db[_0xfc45('0x2b')]['find']({'where':{'id':_0x351075[_0xfc45('0x44')]['id']}})['then'](handleEntityNotFound(_0xd323e3,null))[_0xfc45('0x22')](saveUpdates(_0x351075['body'],null))[_0xfc45('0x22')](respondWithResult(_0xd323e3,null))[_0xfc45('0x42')](handleError(_0xd323e3,null));};exports[_0xfc45('0x23')]=function(_0x33dec3,_0x2b7b32){return db[_0xfc45('0x2b')][_0xfc45('0x4b')]({'where':{'id':_0x33dec3[_0xfc45('0x44')]['id']}})[_0xfc45('0x22')](handleEntityNotFound(_0x2b7b32,null))[_0xfc45('0x22')](removeEntity(_0x2b7b32,null))['catch'](handleError(_0x2b7b32,null));};exports[_0xfc45('0x4f')]=function(_0x32dd6e,_0x42416b,_0x2b4f16){var _0x3daa9b;return db[_0xfc45('0x2b')][_0xfc45('0x4b')]({'where':{'id':_0x32dd6e[_0xfc45('0x44')]['id']},'attributes':['id',_0xfc45('0x50')]})[_0xfc45('0x22')](handleEntityNotFound(_0x42416b,null))['then'](function(_0x3edcf7){if(_0x3edcf7){var _0x48059d=require(_0xfc45('0x51'))();_0x48059d[_0xfc45('0x52')](_0x3edcf7[_0xfc45('0x50')]);_0x48059d[_0xfc45('0x53')]();return _0x3edcf7;}})[_0xfc45('0x22')](respondWithResult(_0x42416b,null))[_0xfc45('0x42')](handleError(_0x42416b,null));}; \ No newline at end of file +var _0x1111=['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/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','ODBC','UserProfileResource','end','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','test','closeSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3d648e,_0x344357){var _0x1594b3=function(_0x19d3b0){while(--_0x19d3b0){_0x3d648e['push'](_0x3d648e['shift']());}};_0x1594b3(++_0x344357);}(_0x1111,0xa1));var _0x1111=function(_0x804c77,_0x4fc039){_0x804c77=_0x804c77-0x0;var _0xa45f1=_0x1111[_0x804c77];return _0xa45f1;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1111('0x2'));var moment=require(_0x1111('0x3'));var BPromise=require(_0x1111('0x4'));var Mustache=require(_0x1111('0x5'));var util=require(_0x1111('0x6'));var path=require(_0x1111('0x7'));var sox=require('sox');var csv=require(_0x1111('0x8'));var ejs=require(_0x1111('0x9'));var fs=require('fs');var fs_extra=require(_0x1111('0xa'));var _=require(_0x1111('0xb'));var squel=require(_0x1111('0xc'));var crypto=require(_0x1111('0xd'));var jsforce=require(_0x1111('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1111('0x8'));var querystring=require(_0x1111('0xf'));var Papa=require(_0x1111('0x10'));var Redis=require(_0x1111('0x11'));var authService=require(_0x1111('0x12'));var qs=require(_0x1111('0x13'));var as=require(_0x1111('0x14'));var hardwareService=require(_0x1111('0x15'));var logger=require(_0x1111('0x16'))(_0x1111('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1111('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24d951,_0x596157){_0x596157=_0x596157||0xcc;return function(_0x1bc612){if(_0x1bc612){return _0x24d951[_0x1111('0x19')](_0x596157);}return _0x24d951[_0x1111('0x1a')](_0x596157)['end']();};}function respondWithResult(_0x5deeed,_0x1e7715){_0x1e7715=_0x1e7715||0xc8;return function(_0x5524e0){if(_0x5524e0){return _0x5deeed[_0x1111('0x1a')](_0x1e7715)[_0x1111('0x1b')](_0x5524e0);}};}function respondWithFilteredResult(_0x3e6a2b,_0x59ca86){return function(_0x479c86){if(_0x479c86){var _0x1aaf11=typeof _0x59ca86['offset']===_0x1111('0x1c')&&typeof _0x59ca86[_0x1111('0x1d')]===_0x1111('0x1c');var _0x4091b6=_0x479c86[_0x1111('0x1e')];var _0x348089=_0x1aaf11?0x0:_0x59ca86[_0x1111('0x1f')];var _0x5e09b1=_0x1aaf11?_0x479c86[_0x1111('0x1e')]:_0x59ca86['offset']+_0x59ca86[_0x1111('0x1d')];var _0x1db7b5;if(_0x5e09b1>=_0x4091b6){_0x5e09b1=_0x4091b6;_0x1db7b5=0xc8;}else{_0x1db7b5=0xce;}_0x3e6a2b[_0x1111('0x1a')](_0x1db7b5);return _0x3e6a2b[_0x1111('0x20')](_0x1111('0x21'),_0x348089+'-'+_0x5e09b1+'/'+_0x4091b6)[_0x1111('0x1b')](_0x479c86);}return null;};}function patchUpdates(_0x8a7ef8){return function(_0x4a3c5d){try{jsonpatch['apply'](_0x4a3c5d,_0x8a7ef8,!![]);}catch(_0x329d66){return BPromise[_0x1111('0x22')](_0x329d66);}return _0x4a3c5d['save']();};}function saveUpdates(_0x2e84b9,_0xa13c6d){return function(_0x115caa){if(_0x115caa){return _0x115caa[_0x1111('0x23')](_0x2e84b9)[_0x1111('0x24')](function(_0x5b0185){return _0x5b0185;});}return null;};}function removeEntity(_0x2bf101,_0x5ee870){return function(_0x3c387f){if(_0x3c387f){return _0x3c387f[_0x1111('0x25')]()[_0x1111('0x24')](function(){var _0x11d1cc=_0x3c387f[_0x1111('0x26')]({'plain':!![]});var _0x3b0409=_0x1111('0x27');return db[_0x1111('0x28')][_0x1111('0x25')]({'where':{'type':_0x3b0409,'resourceId':_0x11d1cc['id']}})['then'](function(){return _0x3c387f;});})[_0x1111('0x24')](function(){_0x2bf101[_0x1111('0x1a')](0xcc)[_0x1111('0x29')]();});}};}function handleEntityNotFound(_0x270437,_0x3322e4){return function(_0x7d27ba){if(!_0x7d27ba){_0x270437['sendStatus'](0x194);}return _0x7d27ba;};}function handleError(_0x45a0b8,_0x17d095){_0x17d095=_0x17d095||0x1f4;return function(_0x1022ac){logger[_0x1111('0x2a')](_0x1022ac['stack']);if(_0x1022ac[_0x1111('0x2b')]){delete _0x1022ac[_0x1111('0x2b')];}_0x45a0b8[_0x1111('0x1a')](_0x17d095)[_0x1111('0x2c')](_0x1022ac);};}exports[_0x1111('0x2d')]=function(_0x312115,_0x1aaff6){var _0x4d26b3={},_0x11a947={},_0x2fb4e2={'count':0x0,'rows':[]};var _0x313735=_[_0x1111('0x2e')](db[_0x1111('0x2f')]['rawAttributes'],function(_0x1a2d2e){return{'name':_0x1a2d2e[_0x1111('0x30')],'type':_0x1a2d2e[_0x1111('0x31')][_0x1111('0x32')]};});_0x11a947[_0x1111('0x33')]=_[_0x1111('0x2e')](_0x313735,'name');_0x11a947[_0x1111('0x34')]=_[_0x1111('0x35')](_0x312115[_0x1111('0x34')]);_0x11a947[_0x1111('0x36')]=_[_0x1111('0x37')](_0x11a947[_0x1111('0x33')],_0x11a947[_0x1111('0x34')]);_0x4d26b3[_0x1111('0x38')]=_[_0x1111('0x37')](_0x11a947[_0x1111('0x33')],qs['fields'](_0x312115[_0x1111('0x34')][_0x1111('0x39')]));_0x4d26b3[_0x1111('0x38')]=_0x4d26b3[_0x1111('0x38')][_0x1111('0x3a')]?_0x4d26b3['attributes']:_0x11a947[_0x1111('0x33')];if(!_0x312115[_0x1111('0x34')]['hasOwnProperty'](_0x1111('0x3b'))){_0x4d26b3['limit']=qs['limit'](_0x312115[_0x1111('0x34')][_0x1111('0x1d')]);_0x4d26b3['offset']=qs[_0x1111('0x1f')](_0x312115['query'][_0x1111('0x1f')]);}_0x4d26b3[_0x1111('0x3c')]=qs[_0x1111('0x3d')](_0x312115['query']['sort']);_0x4d26b3['where']=qs[_0x1111('0x36')](_[_0x1111('0x3e')](_0x312115['query'],_0x11a947[_0x1111('0x36')]),_0x313735);if(_0x312115[_0x1111('0x34')][_0x1111('0x3f')]){_0x4d26b3[_0x1111('0x40')]=_['merge'](_0x4d26b3[_0x1111('0x40')],{'$or':_['map'](_0x313735,function(_0x2ae49b){if(_0x2ae49b[_0x1111('0x31')]!==_0x1111('0x41')){var _0xcd71a7={};_0xcd71a7[_0x2ae49b['name']]={'$like':'%'+_0x312115[_0x1111('0x34')][_0x1111('0x3f')]+'%'};return _0xcd71a7;}})});}_0x4d26b3=_[_0x1111('0x42')]({},_0x4d26b3,_0x312115['options']);var _0x5eff2a={'where':_0x4d26b3[_0x1111('0x40')]};return db[_0x1111('0x2f')]['count'](_0x5eff2a)[_0x1111('0x24')](function(_0x3def4d){_0x2fb4e2[_0x1111('0x1e')]=_0x3def4d;if(_0x312115[_0x1111('0x34')][_0x1111('0x43')]){_0x4d26b3[_0x1111('0x44')]=[{'all':!![]}];}return db[_0x1111('0x2f')][_0x1111('0x45')](_0x4d26b3);})['then'](function(_0x30caef){_0x2fb4e2[_0x1111('0x46')]=_0x30caef;return _0x2fb4e2;})['then'](respondWithFilteredResult(_0x1aaff6,_0x4d26b3))[_0x1111('0x47')](handleError(_0x1aaff6,null));};exports[_0x1111('0x48')]=function(_0x425e87,_0x582afd){var _0x4a124f={'raw':!![],'where':{'id':_0x425e87[_0x1111('0x49')]['id']}},_0x5a866b={};_0x5a866b[_0x1111('0x33')]=_[_0x1111('0x35')](db[_0x1111('0x2f')][_0x1111('0x4a')]);_0x5a866b['query']=_[_0x1111('0x35')](_0x425e87[_0x1111('0x34')]);_0x5a866b[_0x1111('0x36')]=_[_0x1111('0x37')](_0x5a866b[_0x1111('0x33')],_0x5a866b[_0x1111('0x34')]);_0x4a124f[_0x1111('0x38')]=_[_0x1111('0x37')](_0x5a866b[_0x1111('0x33')],qs[_0x1111('0x39')](_0x425e87[_0x1111('0x34')][_0x1111('0x39')]));_0x4a124f[_0x1111('0x38')]=_0x4a124f[_0x1111('0x38')][_0x1111('0x3a')]?_0x4a124f[_0x1111('0x38')]:_0x5a866b[_0x1111('0x33')];if(_0x425e87[_0x1111('0x34')][_0x1111('0x43')]){_0x4a124f[_0x1111('0x44')]=[{'all':!![]}];}_0x4a124f=_[_0x1111('0x42')]({},_0x4a124f,_0x425e87[_0x1111('0x4b')]);return db[_0x1111('0x2f')]['find'](_0x4a124f)[_0x1111('0x24')](handleEntityNotFound(_0x582afd,null))[_0x1111('0x24')](respondWithResult(_0x582afd,null))[_0x1111('0x47')](handleError(_0x582afd,null));};exports[_0x1111('0x4c')]=function(_0x5dfbd3,_0x369ed1){return db['SquareOdbc'][_0x1111('0x4c')](_0x5dfbd3[_0x1111('0x4d')],{})[_0x1111('0x24')](function(_0x3ecb05){var _0x59f29e=_0x5dfbd3[_0x1111('0x4e')][_0x1111('0x26')]({'plain':!![]});if(!_0x59f29e)throw new Error(_0x1111('0x4f'));if(_0x59f29e['role']===_0x1111('0x4e')){var _0x3b1f10=_0x3ecb05[_0x1111('0x26')]({'plain':!![]});var _0x3e6527=_0x1111('0x27');return db[_0x1111('0x50')][_0x1111('0x51')]({'where':{'name':_0x3e6527,'userProfileId':_0x59f29e['userProfileId']},'raw':!![]})[_0x1111('0x24')](function(_0x47410a){if(_0x47410a&&_0x47410a[_0x1111('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b1f10[_0x1111('0x2b')],'resourceId':_0x3b1f10['id'],'type':_0x47410a[_0x1111('0x2b')],'sectionId':_0x47410a['id']},{})[_0x1111('0x24')](function(){return _0x3ecb05;});}else{return _0x3ecb05;}})[_0x1111('0x47')](function(_0x236982){logger[_0x1111('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x236982);throw _0x236982;});}return _0x3ecb05;})[_0x1111('0x24')](respondWithResult(_0x369ed1,0xc9))['catch'](handleError(_0x369ed1,null));};exports[_0x1111('0x23')]=function(_0x5e0ca2,_0x2ad1a7){if(_0x5e0ca2[_0x1111('0x4d')]['id']){delete _0x5e0ca2[_0x1111('0x4d')]['id'];}return db[_0x1111('0x2f')][_0x1111('0x51')]({'where':{'id':_0x5e0ca2[_0x1111('0x49')]['id']}})[_0x1111('0x24')](handleEntityNotFound(_0x2ad1a7,null))[_0x1111('0x24')](saveUpdates(_0x5e0ca2[_0x1111('0x4d')],null))[_0x1111('0x24')](respondWithResult(_0x2ad1a7,null))[_0x1111('0x47')](handleError(_0x2ad1a7,null));};exports[_0x1111('0x25')]=function(_0x1be4c3,_0x36c125){return db[_0x1111('0x2f')][_0x1111('0x51')]({'where':{'id':_0x1be4c3[_0x1111('0x49')]['id']}})[_0x1111('0x24')](handleEntityNotFound(_0x36c125,null))['then'](removeEntity(_0x36c125,null))[_0x1111('0x47')](handleError(_0x36c125,null));};exports[_0x1111('0x53')]=function(_0x14ff8a,_0x522561,_0x55d8dd){var _0x20439b;return db[_0x1111('0x2f')][_0x1111('0x51')]({'where':{'id':_0x14ff8a['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x522561,null))['then'](function(_0x351e6e){if(_0x351e6e){var _0x19063b=require('odbc')();_0x19063b['openSync'](_0x351e6e['dsn']);_0x19063b[_0x1111('0x54')]();return _0x351e6e;}})[_0x1111('0x24')](respondWithResult(_0x522561,null))[_0x1111('0x47')](handleError(_0x522561,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b986662..b94f175 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 _0xf1f3=['exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareOdbc.attributes'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf1f3,0xee));var _0x3f1f=function(_0x3a2100,_0x3bd58b){_0x3a2100=_0x3a2100-0x0;var _0x15424d=_0xf1f3[_0x3a2100];return _0x15424d;};'use strict';var _=require(_0x3f1f('0x0'));var util=require(_0x3f1f('0x1'));var logger=require(_0x3f1f('0x2'))(_0x3f1f('0x3'));var moment=require(_0x3f1f('0x4'));var BPromise=require(_0x3f1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f1f('0x6'));var rimraf=require(_0x3f1f('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f1f('0x8'));module[_0x3f1f('0x9')]=function(_0xeb6df,_0x3c5f0f){return _0xeb6df[_0x3f1f('0xa')](_0x3f1f('0xb'),attributes,{'tableName':_0x3f1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1c0=['exports','define','square_odbc','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x53f7b7,_0x4d6ccf){var _0x1df4c2=function(_0x14102e){while(--_0x14102e){_0x53f7b7['push'](_0x53f7b7['shift']());}};_0x1df4c2(++_0x4d6ccf);}(_0xa1c0,0xd4));var _0x0a1c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa1c0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0a1c('0x0'));var logger=require(_0x0a1c('0x1'))('api');var moment=require(_0x0a1c('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a1c('0x3'));var fs=require('fs');var path=require(_0x0a1c('0x4'));var rimraf=require(_0x0a1c('0x5'));var config=require(_0x0a1c('0x6'));var attributes=require(_0x0a1c('0x7'));module[_0x0a1c('0x8')]=function(_0x39a87,_0x449020){return _0x39a87[_0x0a1c('0x9')]('SquareOdbc',attributes,{'tableName':_0x0a1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 3d447d6..d016d6f 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 _0xf505=['message','catch','SquareOdbc','find','options','raw','where','map','model','attributes','include','stringify','ShowSquareOdbc','util','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2be97c,_0x59eb7a){var _0xe8b143=function(_0x5097a2){while(--_0x5097a2){_0x2be97c['push'](_0x2be97c['shift']());}};_0xe8b143(++_0x59eb7a);}(_0xf505,0x1dd));var _0x5f50=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0xf505[_0x22cb5f];return _0x274d36;};'use strict';var _=require('lodash');var util=require(_0x5f50('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f50('0x1'))['db'];var utils=require(_0x5f50('0x2'));var logger=require(_0x5f50('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5f50('0x4'));var client=jayson[_0x5f50('0x5')][_0x5f50('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5734c9,_0x960b4a,_0x48e3bf){return new BPromise(function(_0xbbbc45,_0x1aef71){return client[_0x5f50('0x7')](_0x5734c9,_0x48e3bf)[_0x5f50('0x8')](function(_0x7d94b5){logger[_0x5f50('0x9')](_0x5f50('0xa'),_0x960b4a,'request\x20sent');logger[_0x5f50('0xb')](_0x5f50('0xc'),_0x960b4a,_0x5f50('0xd'),JSON['stringify'](_0x7d94b5));if(_0x7d94b5[_0x5f50('0xe')]){if(_0x7d94b5[_0x5f50('0xe')][_0x5f50('0xf')]===0x1f4){logger['error'](_0x5f50('0xa'),_0x960b4a,_0x7d94b5['error']['message']);return _0x1aef71(_0x7d94b5[_0x5f50('0xe')][_0x5f50('0x10')]);}logger['error'](_0x5f50('0xa'),_0x960b4a,_0x7d94b5[_0x5f50('0xe')][_0x5f50('0x10')]);return _0xbbbc45(_0x7d94b5['error'][_0x5f50('0x10')]);}else{logger[_0x5f50('0x9')](_0x5f50('0xa'),_0x960b4a,_0x5f50('0xd'));_0xbbbc45(_0x7d94b5['result'][_0x5f50('0x10')]);}})[_0x5f50('0x11')](function(_0x11bbeb){logger[_0x5f50('0xe')](_0x5f50('0xa'),_0x960b4a,_0x11bbeb);_0x1aef71(_0x11bbeb);});});}exports['ShowSquareOdbc']=function(_0x554a95){var _0x1eda90=this;return new Promise(function(_0x594a8f,_0x92f4e2){return db[_0x5f50('0x12')][_0x5f50('0x13')]({'raw':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')][_0x5f50('0x15')]===undefined?!![]:![]:!![],'where':_0x554a95['options']?_0x554a95[_0x5f50('0x14')][_0x5f50('0x16')]||null:null,'attributes':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')]['attributes']||null:null,'include':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')]['include']?_[_0x5f50('0x17')](_0x554a95['options']['include'],function(_0x30cd9a){return{'model':db[_0x30cd9a[_0x5f50('0x18')]],'as':_0x30cd9a['as'],'attributes':_0x30cd9a[_0x5f50('0x19')],'include':_0x30cd9a['include']?_['map'](_0x30cd9a['include'],function(_0x2d5076){return{'model':db[_0x2d5076['model']],'as':_0x2d5076['as'],'attributes':_0x2d5076[_0x5f50('0x19')],'include':_0x2d5076['include']?_['map'](_0x2d5076[_0x5f50('0x1a')],function(_0x4ba667){return{'model':db[_0x4ba667[_0x5f50('0x18')]],'as':_0x4ba667['as'],'attributes':_0x4ba667['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x868c2a){logger['info']('ShowSquareOdbc',_0x554a95);logger[_0x5f50('0xb')]('ShowSquareOdbc',_0x554a95,JSON[_0x5f50('0x1b')](_0x868c2a));_0x594a8f(_0x868c2a);})['catch'](function(_0x571c6e){logger[_0x5f50('0xe')](_0x5f50('0x1c'),_0x571c6e[_0x5f50('0x10')],_0x554a95);_0x92f4e2(_0x1eda90[_0x5f50('0xe')](0x1f4,_0x571c6e['message']));});});}; \ No newline at end of file +var _0xa19c=['stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x548003,_0x19cd0e){var _0x459a44=function(_0x1057c3){while(--_0x1057c3){_0x548003['push'](_0x548003['shift']());}};_0x459a44(++_0x19cd0e);}(_0xa19c,0x86));var _0xca19=function(_0x3eb36f,_0x2395a5){_0x3eb36f=_0x3eb36f-0x0;var _0x2bf875=_0xa19c[_0x3eb36f];return _0x2bf875;};'use strict';var _=require('lodash');var util=require(_0xca19('0x0'));var moment=require(_0xca19('0x1'));var BPromise=require(_0xca19('0x2'));var rs=require(_0xca19('0x3'));var fs=require('fs');var Redis=require(_0xca19('0x4'));var db=require(_0xca19('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca19('0x6'))(_0xca19('0x7'));var config=require(_0xca19('0x8'));var jayson=require(_0xca19('0x9'));var client=jayson[_0xca19('0xa')][_0xca19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a4cc8,_0x1833fc,_0x4f73be){return new BPromise(function(_0x55b917,_0x6c324d){return client['request'](_0x9a4cc8,_0x4f73be)[_0xca19('0xc')](function(_0x2773a1){logger[_0xca19('0xd')](_0xca19('0xe'),_0x1833fc,_0xca19('0xf'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x1833fc,_0xca19('0xf'),JSON[_0xca19('0x10')](_0x2773a1));if(_0x2773a1[_0xca19('0x11')]){if(_0x2773a1['error'][_0xca19('0x12')]===0x1f4){logger[_0xca19('0x11')](_0xca19('0xe'),_0x1833fc,_0x2773a1[_0xca19('0x11')][_0xca19('0x13')]);return _0x6c324d(_0x2773a1[_0xca19('0x11')][_0xca19('0x13')]);}logger[_0xca19('0x11')](_0xca19('0xe'),_0x1833fc,_0x2773a1['error'][_0xca19('0x13')]);return _0x55b917(_0x2773a1[_0xca19('0x11')][_0xca19('0x13')]);}else{logger[_0xca19('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x1833fc,_0xca19('0xf'));_0x55b917(_0x2773a1['result']['message']);}})[_0xca19('0x14')](function(_0xac790a){logger[_0xca19('0x11')](_0xca19('0xe'),_0x1833fc,_0xac790a);_0x6c324d(_0xac790a);});});}exports[_0xca19('0x15')]=function(_0x4fc9b7){var _0x7b3987=this;return new Promise(function(_0x2ff64a,_0x15da26){return db[_0xca19('0x16')]['find']({'raw':_0x4fc9b7[_0xca19('0x17')]?_0x4fc9b7['options'][_0xca19('0x18')]===undefined?!![]:![]:!![],'where':_0x4fc9b7[_0xca19('0x17')]?_0x4fc9b7['options'][_0xca19('0x19')]||null:null,'attributes':_0x4fc9b7[_0xca19('0x17')]?_0x4fc9b7['options'][_0xca19('0x1a')]||null:null,'include':_0x4fc9b7[_0xca19('0x17')]?_0x4fc9b7[_0xca19('0x17')][_0xca19('0x1b')]?_[_0xca19('0x1c')](_0x4fc9b7[_0xca19('0x17')][_0xca19('0x1b')],function(_0x51ddc5){return{'model':db[_0x51ddc5['model']],'as':_0x51ddc5['as'],'attributes':_0x51ddc5[_0xca19('0x1a')],'include':_0x51ddc5[_0xca19('0x1b')]?_[_0xca19('0x1c')](_0x51ddc5['include'],function(_0x313f98){return{'model':db[_0x313f98[_0xca19('0x1d')]],'as':_0x313f98['as'],'attributes':_0x313f98['attributes'],'include':_0x313f98['include']?_['map'](_0x313f98[_0xca19('0x1b')],function(_0x13a702){return{'model':db[_0x13a702[_0xca19('0x1d')]],'as':_0x13a702['as'],'attributes':_0x13a702[_0xca19('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196174){logger['info'](_0xca19('0x15'),_0x4fc9b7);logger['debug'](_0xca19('0x15'),_0x4fc9b7,JSON[_0xca19('0x10')](_0x196174));_0x2ff64a(_0x196174);})[_0xca19('0x14')](function(_0x4f9bb7){logger[_0xca19('0x11')]('ShowSquareOdbc',_0x4f9bb7[_0xca19('0x13')],_0x4fc9b7);_0x15da26(_0x7b3987[_0xca19('0x11')](0x1f4,_0x4f9bb7[_0xca19('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ba2665e..8fd1ba3 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 _0x9e59=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3ed8a2,_0x41eba8){var _0x242031=function(_0x5a4ac9){while(--_0x5a4ac9){_0x3ed8a2['push'](_0x3ed8a2['shift']());}};_0x242031(++_0x41eba8);}(_0x9e59,0xa8));var _0x99e5=function(_0x1a76d0,_0x3ffdca){_0x1a76d0=_0x1a76d0-0x0;var _0x51a54f=_0x9e59[_0x1a76d0];return _0x51a54f;};'use strict';var multer=require(_0x99e5('0x0'));var util=require(_0x99e5('0x1'));var path=require('path');var timeout=require(_0x99e5('0x2'));var express=require(_0x99e5('0x3'));var router=express[_0x99e5('0x4')]();var fs_extra=require(_0x99e5('0x5'));var auth=require(_0x99e5('0x6'));var interaction=require(_0x99e5('0x7'));var config=require(_0x99e5('0x8'));var controller=require(_0x99e5('0x9'));router[_0x99e5('0xa')]('/',auth[_0x99e5('0xb')](),controller['index']);router[_0x99e5('0xa')](_0x99e5('0xc'),auth[_0x99e5('0xb')](),controller['show']);router[_0x99e5('0xd')]('/',auth['isAuthenticated'](),controller[_0x99e5('0xe')]);router[_0x99e5('0xf')]('/:id',auth[_0x99e5('0xb')](),controller['update']);router[_0x99e5('0x10')](_0x99e5('0xc'),auth[_0x99e5('0xb')](),controller[_0x99e5('0x11')]);module[_0x99e5('0x12')]=router; \ No newline at end of file +var _0x79df=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0xfd084b,_0x26977e){var _0x375d60=function(_0xfec175){while(--_0xfec175){_0xfd084b['push'](_0xfd084b['shift']());}};_0x375d60(++_0x26977e);}(_0x79df,0x166));var _0xf79d=function(_0x5dca84,_0x463550){_0x5dca84=_0x5dca84-0x0;var _0x5046e8=_0x79df[_0x5dca84];return _0x5046e8;};'use strict';var multer=require(_0xf79d('0x0'));var util=require(_0xf79d('0x1'));var path=require(_0xf79d('0x2'));var timeout=require(_0xf79d('0x3'));var express=require(_0xf79d('0x4'));var router=express['Router']();var fs_extra=require(_0xf79d('0x5'));var auth=require(_0xf79d('0x6'));var interaction=require(_0xf79d('0x7'));var config=require(_0xf79d('0x8'));var controller=require(_0xf79d('0x9'));router['get']('/',auth[_0xf79d('0xa')](),controller[_0xf79d('0xb')]);router['get']('/:id',auth[_0xf79d('0xa')](),controller['show']);router[_0xf79d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf79d('0xd')]);router[_0xf79d('0xe')](_0xf79d('0xf'),auth[_0xf79d('0xa')](),controller[_0xf79d('0x10')]);router['delete'](_0xf79d('0xf'),auth[_0xf79d('0xa')](),controller[_0xf79d('0x11')]);module[_0xf79d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index bc269e9..ba4af50 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 _0xd566=['TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE','sequelize','exports','STRING','name'];(function(_0x511ff6,_0x426c0b){var _0x2ce7af=function(_0x52e7a5){while(--_0x52e7a5){_0x511ff6['push'](_0x511ff6['shift']());}};_0x2ce7af(++_0x426c0b);}(_0xd566,0x100));var _0x6d56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd566[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6d56('0x0'));module[_0x6d56('0x1')]={'name':{'type':Sequelize[_0x6d56('0x2')],'unique':_0x6d56('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6d56('0x2')]},'notes':{'type':Sequelize[_0x6d56('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x6d56('0x5')),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0x7'))){return this[_0x6d56('0x6')]('preproduction')['toString'](_0x6d56('0x8'));}}},'production':{'type':Sequelize[_0x6d56('0x9')]('long'),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0xa'))){return this[_0x6d56('0x6')](_0x6d56('0xa'))[_0x6d56('0xb')](_0x6d56('0x8'));}}},'savedAt':{'type':Sequelize[_0x6d56('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x67b1=['exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x16deea,_0x17b06d){var _0x2af2f4=function(_0x1cac91){while(--_0x1cac91){_0x16deea['push'](_0x16deea['shift']());}};_0x2af2f4(++_0x17b06d);}(_0x67b1,0xfd));var _0x167b=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0x67b1[_0x5ca52d];return _0x89e54e;};'use strict';var Sequelize=require('sequelize');module[_0x167b('0x0')]={'name':{'type':Sequelize[_0x167b('0x1')],'unique':_0x167b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x167b('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x167b('0x3')](_0x167b('0x4')),'get':function(){if(this[_0x167b('0x5')](_0x167b('0x6'))){return this[_0x167b('0x5')](_0x167b('0x6'))[_0x167b('0x7')](_0x167b('0x8'));}}},'production':{'type':Sequelize[_0x167b('0x3')](_0x167b('0x4')),'get':function(){if(this[_0x167b('0x5')](_0x167b('0x9'))){return this[_0x167b('0x5')](_0x167b('0x9'))[_0x167b('0x7')](_0x167b('0x8'));}}},'savedAt':{'type':Sequelize[_0x167b('0xa')]},'publishedAt':{'type':Sequelize[_0x167b('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2c2d053..e3cc5cb 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 _0x3359=['set','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','map','SquareProject','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','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','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./squareProject.socket','register','status','undefined','limit','count','offset'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3359,0x150));var _0x9335=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x3359[_0x5c846d];return _0xd064e4;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x9335('0x0'));var logger=require(_0x9335('0x1'))(_0x9335('0x2'));var config=require(_0x9335('0x3'));var db=require(_0x9335('0x4'))['db'];config['redis']=_[_0x9335('0x5')](config[_0x9335('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9335('0x6')]));require(_0x9335('0x7'))[_0x9335('0x8')](socket);function respondWithResult(_0x5e45ce,_0x463263){_0x463263=_0x463263||0xc8;return function(_0x3c99de){if(_0x3c99de){return _0x5e45ce[_0x9335('0x9')](_0x463263)['json'](_0x3c99de);}};}function respondWithFilteredResult(_0x4bbbaf,_0x2b3911){return function(_0x2f34f2){if(_0x2f34f2){var _0x1bbacc=typeof _0x2b3911['offset']===_0x9335('0xa')&&typeof _0x2b3911[_0x9335('0xb')]===_0x9335('0xa');var _0x3f233f=_0x2f34f2[_0x9335('0xc')];var _0x38c2cd=_0x1bbacc?0x0:_0x2b3911[_0x9335('0xd')];var _0x49468f=_0x1bbacc?_0x2f34f2[_0x9335('0xc')]:_0x2b3911['offset']+_0x2b3911[_0x9335('0xb')];var _0x4c828c;if(_0x49468f>=_0x3f233f){_0x49468f=_0x3f233f;_0x4c828c=0xc8;}else{_0x4c828c=0xce;}_0x4bbbaf[_0x9335('0x9')](_0x4c828c);return _0x4bbbaf[_0x9335('0xe')]('Content-Range',_0x38c2cd+'-'+_0x49468f+'/'+_0x3f233f)[_0x9335('0xf')](_0x2f34f2);}return null;};}function saveUpdates(_0x3c3b67){return function(_0x5222b2){if(_0x5222b2){return _0x5222b2[_0x9335('0x10')](_0x3c3b67)[_0x9335('0x11')](function(_0x459c46){return _0x459c46;});}return null;};}function removeEntity(_0x376e31){return function(_0xb5e56d){if(_0xb5e56d){return _0xb5e56d[_0x9335('0x12')]()[_0x9335('0x11')](function(){var _0x1ea502=_0xb5e56d[_0x9335('0x13')]({'plain':!![]});var _0x1f7bca=_0x9335('0x14');return db[_0x9335('0x15')][_0x9335('0x12')]({'where':{'type':_0x1f7bca,'resourceId':_0x1ea502['id']}})['then'](function(){return _0xb5e56d;});})[_0x9335('0x11')](function(){var _0x373f7c=new Redis(config[_0x9335('0x6')]);_0x373f7c[_0x9335('0x16')](_0x9335('0x17'),JSON[_0x9335('0x18')]({'id':_0xb5e56d['id'],'deleted':!![]}));})[_0x9335('0x11')](function(){_0x376e31[_0x9335('0x9')](0xcc)[_0x9335('0x19')]();});}};}function handleEntityNotFound(_0xe34bc2){return function(_0x190e22){if(!_0x190e22){_0xe34bc2[_0x9335('0x1a')](0x194);}return _0x190e22;};}function handleError(_0x4a875f,_0x2499ea){_0x2499ea=_0x2499ea||0x1f4;return function(_0x1e914b){logger[_0x9335('0x1b')](_0x1e914b['stack']);if(_0x1e914b[_0x9335('0x1c')]){delete _0x1e914b[_0x9335('0x1c')];}_0x4a875f[_0x9335('0x9')](_0x2499ea)[_0x9335('0x1d')](_0x1e914b);};}exports['index']=function(_0x5df468,_0x35c7e6){var _0x1d4927={},_0x76d8cc={},_0x57f3e2={'count':0x0,'rows':[]};var _0x52febb=_[_0x9335('0x1e')](db[_0x9335('0x1f')][_0x9335('0x20')],function(_0x5ec7b9){return{'name':_0x5ec7b9[_0x9335('0x21')],'type':_0x5ec7b9['type'][_0x9335('0x22')]};});_0x76d8cc['model']=_[_0x9335('0x1e')](_0x52febb,_0x9335('0x1c'));_0x76d8cc['query']=_['keys'](_0x5df468[_0x9335('0x23')]);_0x76d8cc[_0x9335('0x24')]=_[_0x9335('0x25')](_0x76d8cc[_0x9335('0x26')],_0x76d8cc['query']);_0x1d4927[_0x9335('0x27')]=_[_0x9335('0x25')](_0x76d8cc['model'],qs[_0x9335('0x28')](_0x5df468[_0x9335('0x23')][_0x9335('0x28')]));_0x1d4927[_0x9335('0x27')]=_0x1d4927[_0x9335('0x27')][_0x9335('0x29')]?_0x1d4927[_0x9335('0x27')]:_0x76d8cc[_0x9335('0x26')];if(!_0x5df468[_0x9335('0x23')]['hasOwnProperty'](_0x9335('0x2a'))){_0x1d4927['limit']=qs[_0x9335('0xb')](_0x5df468['query']['limit']);_0x1d4927[_0x9335('0xd')]=qs[_0x9335('0xd')](_0x5df468[_0x9335('0x23')]['offset']);}_0x1d4927[_0x9335('0x2b')]=qs[_0x9335('0x2c')](_0x5df468['query']['sort']);_0x1d4927[_0x9335('0x2d')]=qs[_0x9335('0x24')](_[_0x9335('0x2e')](_0x5df468['query'],_0x76d8cc[_0x9335('0x24')]),_0x52febb);if(_0x5df468[_0x9335('0x23')][_0x9335('0x2f')]){_0x1d4927['where']=_[_0x9335('0x30')](_0x1d4927[_0x9335('0x2d')],{'$or':_[_0x9335('0x1e')](_0x52febb,function(_0x5bb457){if(_0x5bb457[_0x9335('0x31')]!==_0x9335('0x32')){var _0x301cdf={};_0x301cdf[_0x5bb457['name']]={'$like':'%'+_0x5df468[_0x9335('0x23')][_0x9335('0x2f')]+'%'};return _0x301cdf;}})});}_0x1d4927=_['merge']({},_0x1d4927,_0x5df468['options']);var _0x15b12a={'where':_0x1d4927[_0x9335('0x2d')]};return db[_0x9335('0x1f')][_0x9335('0xc')](_0x15b12a)[_0x9335('0x11')](function(_0x32b210){_0x57f3e2[_0x9335('0xc')]=_0x32b210;if(_0x5df468[_0x9335('0x23')][_0x9335('0x33')]){_0x1d4927[_0x9335('0x34')]=[{'all':!![]}];}return db[_0x9335('0x1f')][_0x9335('0x35')](_0x1d4927);})[_0x9335('0x11')](function(_0x4f2f18){_0x57f3e2[_0x9335('0x36')]=_0x4f2f18;return _0x57f3e2;})[_0x9335('0x11')](respondWithFilteredResult(_0x35c7e6,_0x1d4927))[_0x9335('0x37')](handleError(_0x35c7e6,null));};exports[_0x9335('0x38')]=function(_0x28880f,_0x1c466d){var _0xea68c9={'raw':![],'where':{'id':_0x28880f[_0x9335('0x39')]['id']}},_0x4af319={};_0x4af319[_0x9335('0x26')]=_[_0x9335('0x3a')](db[_0x9335('0x1f')]['rawAttributes']);_0x4af319[_0x9335('0x23')]=_['keys'](_0x28880f[_0x9335('0x23')]);_0x4af319[_0x9335('0x24')]=_[_0x9335('0x25')](_0x4af319['model'],_0x4af319['query']);_0xea68c9[_0x9335('0x27')]=_[_0x9335('0x25')](_0x4af319[_0x9335('0x26')],qs['fields'](_0x28880f[_0x9335('0x23')][_0x9335('0x28')]));_0xea68c9[_0x9335('0x27')]=_0xea68c9[_0x9335('0x27')][_0x9335('0x29')]?_0xea68c9[_0x9335('0x27')]:_0x4af319['model'];if(_0x28880f['query'][_0x9335('0x33')]){_0xea68c9[_0x9335('0x34')]=[{'all':!![]}];}_0xea68c9=_[_0x9335('0x30')]({},_0xea68c9,_0x28880f[_0x9335('0x3b')]);return db['SquareProject'][_0x9335('0x3c')](_0xea68c9)[_0x9335('0x11')](handleEntityNotFound(_0x1c466d,null))[_0x9335('0x11')](respondWithResult(_0x1c466d,null))['catch'](handleError(_0x1c466d,null));};exports[_0x9335('0x3d')]=function(_0x27cf30,_0x422a48){return db[_0x9335('0x1f')][_0x9335('0x3d')](_0x27cf30[_0x9335('0x3e')],{})[_0x9335('0x11')](function(_0x2f3454){var _0x577490=_0x27cf30['user'][_0x9335('0x13')]({'plain':!![]});if(!_0x577490)throw new Error(_0x9335('0x3f'));if(_0x577490[_0x9335('0x40')]===_0x9335('0x41')){var _0x4835f5=_0x2f3454[_0x9335('0x13')]({'plain':!![]});var _0x18a80f=_0x9335('0x14');return db[_0x9335('0x42')][_0x9335('0x3c')]({'where':{'name':_0x18a80f,'userProfileId':_0x577490[_0x9335('0x43')]},'raw':!![]})[_0x9335('0x11')](function(_0x5508f8){if(_0x5508f8&&_0x5508f8[_0x9335('0x44')]===0x0){return db['UserProfileResource']['create']({'name':_0x4835f5['name'],'resourceId':_0x4835f5['id'],'type':_0x5508f8[_0x9335('0x1c')],'sectionId':_0x5508f8['id']},{})[_0x9335('0x11')](function(){return _0x2f3454;});}else{return _0x2f3454;}})[_0x9335('0x37')](function(_0x4e1323){logger[_0x9335('0x1b')](_0x9335('0x45'),_0x4e1323);throw _0x4e1323;});}return _0x2f3454;})[_0x9335('0x11')](respondWithResult(_0x422a48,0xc9))['catch'](handleError(_0x422a48,null));};exports[_0x9335('0x10')]=function(_0x3cbd93,_0x4288ef){if(_0x3cbd93['body']['id']){delete _0x3cbd93['body']['id'];}return db['SquareProject'][_0x9335('0x3c')]({'where':{'id':_0x3cbd93[_0x9335('0x39')]['id']}})['then'](handleEntityNotFound(_0x4288ef,null))[_0x9335('0x11')](saveUpdates(_0x3cbd93[_0x9335('0x3e')],null))[_0x9335('0x11')](function(_0x15fc7a){if(!_0x15fc7a)return;var _0x148b2c=_0x15fc7a[_0x9335('0x13')]({'plain':!![]});return _0x148b2c;})['then'](function(_0x16e24f){var _0x1c7ed8=new Redis(config[_0x9335('0x6')]);_0x1c7ed8[_0x9335('0x16')](_0x9335('0x17'),JSON[_0x9335('0x18')](_['pick'](_0x16e24f,['id',_0x9335('0x1c'),'production'])));return _0x16e24f;})[_0x9335('0x11')](respondWithResult(_0x4288ef,null))['catch'](handleError(_0x4288ef,null));};exports['destroy']=function(_0x546b97,_0x3621f5){return db[_0x9335('0x1f')][_0x9335('0x3c')]({'where':{'id':_0x546b97[_0x9335('0x39')]['id']}})[_0x9335('0x11')](handleEntityNotFound(_0x3621f5,null))['then'](removeEntity(_0x3621f5,null))['catch'](handleError(_0x3621f5,null));}; \ No newline at end of file +var _0x38b3=['end','sendStatus','error','name','send','map','SquareProject','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','publish','agi','production','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','count','Content-Range','update','then','destroy','get','SquareProjects','stringify'];(function(_0x2348ed,_0x2a9366){var _0x42ff82=function(_0x3f60a1){while(--_0x3f60a1){_0x2348ed['push'](_0x2348ed['shift']());}};_0x42ff82(++_0x2a9366);}(_0x38b3,0xae));var _0x338b=function(_0x6755da,_0x144c1c){_0x6755da=_0x6755da-0x0;var _0x8c0631=_0x38b3[_0x6755da];return _0x8c0631;};'use strict';var _=require(_0x338b('0x0'));var Redis=require('ioredis');var qs=require(_0x338b('0x1'));var logger=require('../../config/logger')(_0x338b('0x2'));var config=require(_0x338b('0x3'));var db=require(_0x338b('0x4'))['db'];config[_0x338b('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x338b('0x6'))(new Redis(config[_0x338b('0x5')]));require(_0x338b('0x7'))[_0x338b('0x8')](socket);function respondWithResult(_0x199323,_0x5212de){_0x5212de=_0x5212de||0xc8;return function(_0x58ba6d){if(_0x58ba6d){return _0x199323[_0x338b('0x9')](_0x5212de)[_0x338b('0xa')](_0x58ba6d);}};}function respondWithFilteredResult(_0x4a99f6,_0x242215){return function(_0xe36a48){if(_0xe36a48){var _0x1452da=typeof _0x242215[_0x338b('0xb')]==='undefined'&&typeof _0x242215[_0x338b('0xc')]==='undefined';var _0x5ecc00=_0xe36a48[_0x338b('0xd')];var _0x3f775d=_0x1452da?0x0:_0x242215[_0x338b('0xb')];var _0x183b81=_0x1452da?_0xe36a48['count']:_0x242215['offset']+_0x242215[_0x338b('0xc')];var _0x29cddb;if(_0x183b81>=_0x5ecc00){_0x183b81=_0x5ecc00;_0x29cddb=0xc8;}else{_0x29cddb=0xce;}_0x4a99f6['status'](_0x29cddb);return _0x4a99f6['set'](_0x338b('0xe'),_0x3f775d+'-'+_0x183b81+'/'+_0x5ecc00)[_0x338b('0xa')](_0xe36a48);}return null;};}function saveUpdates(_0x3790ac){return function(_0x3a4bb4){if(_0x3a4bb4){return _0x3a4bb4[_0x338b('0xf')](_0x3790ac)[_0x338b('0x10')](function(_0x41ca57){return _0x41ca57;});}return null;};}function removeEntity(_0x2be2e3){return function(_0x4275e1){if(_0x4275e1){return _0x4275e1[_0x338b('0x11')]()[_0x338b('0x10')](function(){var _0x5168b1=_0x4275e1[_0x338b('0x12')]({'plain':!![]});var _0x1743f7=_0x338b('0x13');return db['UserProfileResource'][_0x338b('0x11')]({'where':{'type':_0x1743f7,'resourceId':_0x5168b1['id']}})[_0x338b('0x10')](function(){return _0x4275e1;});})[_0x338b('0x10')](function(){var _0x5b8817=new Redis(config[_0x338b('0x5')]);_0x5b8817['publish']('agi',JSON[_0x338b('0x14')]({'id':_0x4275e1['id'],'deleted':!![]}));})[_0x338b('0x10')](function(){_0x2be2e3['status'](0xcc)[_0x338b('0x15')]();});}};}function handleEntityNotFound(_0x22fa24){return function(_0x14bb99){if(!_0x14bb99){_0x22fa24[_0x338b('0x16')](0x194);}return _0x14bb99;};}function handleError(_0x426a7c,_0x3ffcb1){_0x3ffcb1=_0x3ffcb1||0x1f4;return function(_0x86aa39){logger[_0x338b('0x17')](_0x86aa39['stack']);if(_0x86aa39[_0x338b('0x18')]){delete _0x86aa39['name'];}_0x426a7c[_0x338b('0x9')](_0x3ffcb1)[_0x338b('0x19')](_0x86aa39);};}exports['index']=function(_0x5464cd,_0x3ddb6c){var _0x4a976b={},_0x2ee30c={},_0x765dc5={'count':0x0,'rows':[]};var _0x5dc532=_[_0x338b('0x1a')](db[_0x338b('0x1b')]['rawAttributes'],function(_0x3b02af){return{'name':_0x3b02af[_0x338b('0x1c')],'type':_0x3b02af['type'][_0x338b('0x1d')]};});_0x2ee30c[_0x338b('0x1e')]=_[_0x338b('0x1a')](_0x5dc532,_0x338b('0x18'));_0x2ee30c[_0x338b('0x1f')]=_[_0x338b('0x20')](_0x5464cd[_0x338b('0x1f')]);_0x2ee30c[_0x338b('0x21')]=_[_0x338b('0x22')](_0x2ee30c[_0x338b('0x1e')],_0x2ee30c[_0x338b('0x1f')]);_0x4a976b[_0x338b('0x23')]=_[_0x338b('0x22')](_0x2ee30c['model'],qs['fields'](_0x5464cd[_0x338b('0x1f')][_0x338b('0x24')]));_0x4a976b[_0x338b('0x23')]=_0x4a976b[_0x338b('0x23')]['length']?_0x4a976b[_0x338b('0x23')]:_0x2ee30c[_0x338b('0x1e')];if(!_0x5464cd[_0x338b('0x1f')][_0x338b('0x25')]('nolimit')){_0x4a976b[_0x338b('0xc')]=qs[_0x338b('0xc')](_0x5464cd[_0x338b('0x1f')][_0x338b('0xc')]);_0x4a976b['offset']=qs[_0x338b('0xb')](_0x5464cd[_0x338b('0x1f')][_0x338b('0xb')]);}_0x4a976b[_0x338b('0x26')]=qs[_0x338b('0x27')](_0x5464cd[_0x338b('0x1f')]['sort']);_0x4a976b[_0x338b('0x28')]=qs['filters'](_[_0x338b('0x29')](_0x5464cd[_0x338b('0x1f')],_0x2ee30c['filters']),_0x5dc532);if(_0x5464cd['query'][_0x338b('0x2a')]){_0x4a976b['where']=_[_0x338b('0x2b')](_0x4a976b[_0x338b('0x28')],{'$or':_[_0x338b('0x1a')](_0x5dc532,function(_0xdf1d7d){if(_0xdf1d7d[_0x338b('0x2c')]!=='VIRTUAL'){var _0x182794={};_0x182794[_0xdf1d7d[_0x338b('0x18')]]={'$like':'%'+_0x5464cd[_0x338b('0x1f')][_0x338b('0x2a')]+'%'};return _0x182794;}})});}_0x4a976b=_[_0x338b('0x2b')]({},_0x4a976b,_0x5464cd[_0x338b('0x2d')]);var _0x2912c9={'where':_0x4a976b[_0x338b('0x28')]};return db[_0x338b('0x1b')][_0x338b('0xd')](_0x2912c9)['then'](function(_0x15875c){_0x765dc5[_0x338b('0xd')]=_0x15875c;if(_0x5464cd['query']['includeAll']){_0x4a976b[_0x338b('0x2e')]=[{'all':!![]}];}return db[_0x338b('0x1b')][_0x338b('0x2f')](_0x4a976b);})[_0x338b('0x10')](function(_0x3f8208){_0x765dc5[_0x338b('0x30')]=_0x3f8208;return _0x765dc5;})['then'](respondWithFilteredResult(_0x3ddb6c,_0x4a976b))[_0x338b('0x31')](handleError(_0x3ddb6c,null));};exports[_0x338b('0x32')]=function(_0x333ca3,_0x3c8bbb){var _0x488c42={'raw':![],'where':{'id':_0x333ca3[_0x338b('0x33')]['id']}},_0x3163e1={};_0x3163e1[_0x338b('0x1e')]=_[_0x338b('0x20')](db[_0x338b('0x1b')]['rawAttributes']);_0x3163e1[_0x338b('0x1f')]=_[_0x338b('0x20')](_0x333ca3['query']);_0x3163e1[_0x338b('0x21')]=_['intersection'](_0x3163e1[_0x338b('0x1e')],_0x3163e1['query']);_0x488c42[_0x338b('0x23')]=_['intersection'](_0x3163e1[_0x338b('0x1e')],qs[_0x338b('0x24')](_0x333ca3[_0x338b('0x1f')]['fields']));_0x488c42[_0x338b('0x23')]=_0x488c42['attributes'][_0x338b('0x34')]?_0x488c42[_0x338b('0x23')]:_0x3163e1[_0x338b('0x1e')];if(_0x333ca3['query'][_0x338b('0x35')]){_0x488c42[_0x338b('0x2e')]=[{'all':!![]}];}_0x488c42=_['merge']({},_0x488c42,_0x333ca3['options']);return db[_0x338b('0x1b')][_0x338b('0x36')](_0x488c42)[_0x338b('0x10')](handleEntityNotFound(_0x3c8bbb,null))[_0x338b('0x10')](respondWithResult(_0x3c8bbb,null))['catch'](handleError(_0x3c8bbb,null));};exports[_0x338b('0x37')]=function(_0x5e9d7b,_0x209390){return db[_0x338b('0x1b')][_0x338b('0x37')](_0x5e9d7b['body'],{})[_0x338b('0x10')](function(_0x523bc7){var _0x38f853=_0x5e9d7b['user'][_0x338b('0x12')]({'plain':!![]});if(!_0x38f853)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38f853[_0x338b('0x38')]===_0x338b('0x39')){var _0xd8fc09=_0x523bc7[_0x338b('0x12')]({'plain':!![]});var _0x55d100=_0x338b('0x13');return db[_0x338b('0x3a')]['find']({'where':{'name':_0x55d100,'userProfileId':_0x38f853[_0x338b('0x3b')]},'raw':!![]})[_0x338b('0x10')](function(_0x46ca54){if(_0x46ca54&&_0x46ca54['autoAssociation']===0x0){return db['UserProfileResource'][_0x338b('0x37')]({'name':_0xd8fc09[_0x338b('0x18')],'resourceId':_0xd8fc09['id'],'type':_0x46ca54[_0x338b('0x18')],'sectionId':_0x46ca54['id']},{})[_0x338b('0x10')](function(){return _0x523bc7;});}else{return _0x523bc7;}})['catch'](function(_0xed3752){logger[_0x338b('0x17')](_0x338b('0x3c'),_0xed3752);throw _0xed3752;});}return _0x523bc7;})[_0x338b('0x10')](respondWithResult(_0x209390,0xc9))[_0x338b('0x31')](handleError(_0x209390,null));};exports['update']=function(_0x5173a8,_0x409af2){if(_0x5173a8[_0x338b('0x3d')]['id']){delete _0x5173a8[_0x338b('0x3d')]['id'];}return db[_0x338b('0x1b')][_0x338b('0x36')]({'where':{'id':_0x5173a8['params']['id']}})[_0x338b('0x10')](handleEntityNotFound(_0x409af2,null))['then'](saveUpdates(_0x5173a8[_0x338b('0x3d')],null))[_0x338b('0x10')](function(_0x2390f3){if(!_0x2390f3)return;var _0x171d25=_0x2390f3[_0x338b('0x12')]({'plain':!![]});return _0x171d25;})[_0x338b('0x10')](function(_0x4d4679){var _0x5605bd=new Redis(config[_0x338b('0x5')]);_0x5605bd[_0x338b('0x3e')](_0x338b('0x3f'),JSON['stringify'](_['pick'](_0x4d4679,['id',_0x338b('0x18'),_0x338b('0x40')])));return _0x4d4679;})['then'](respondWithResult(_0x409af2,null))[_0x338b('0x31')](handleError(_0x409af2,null));};exports[_0x338b('0x11')]=function(_0x2c7004,_0x3d0efb){return db[_0x338b('0x1b')][_0x338b('0x36')]({'where':{'id':_0x2c7004[_0x338b('0x33')]['id']}})[_0x338b('0x10')](handleEntityNotFound(_0x3d0efb,null))[_0x338b('0x10')](removeEntity(_0x3d0efb,null))[_0x338b('0x31')](handleError(_0x3d0efb,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b6af373..1ef0d04 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 _0xb320=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x997e5a,_0x1bf92d){var _0x3fa9fc=function(_0x30e4db){while(--_0x30e4db){_0x997e5a['push'](_0x997e5a['shift']());}};_0x3fa9fc(++_0x1bf92d);}(_0xb320,0xfd));var _0x0b32=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xb320[_0x58fc2f];return _0x3a1312;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0b32('0x0'))['db'][_0x0b32('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0b32('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b32('0x3'),'afterDestroy':_0x0b32('0x4')};function emitEvent(_0x1a748c){return function(_0xd129fb,_0x2345b0,_0x3b804f){SquareProjectEvents['emit'](_0x1a748c+':'+_0xd129fb['id'],_0xd129fb);SquareProjectEvents['emit'](_0x1a748c,_0xd129fb);_0x3b804f(null);};}for(var e in events){if(events[_0x0b32('0x5')](e)){var event=events[e];SquareProject[_0x0b32('0x6')](e,emitEvent(event));}}module[_0x0b32('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xf940=['save','emit','hasOwnProperty','hook','exports','SquareProject'];(function(_0x37305c,_0x4c3a84){var _0x3bc0f2=function(_0x34d2e1){while(--_0x34d2e1){_0x37305c['push'](_0x37305c['shift']());}};_0x3bc0f2(++_0x4c3a84);}(_0xf940,0x15b));var _0x0f94=function(_0x30e804,_0x8d453b){_0x30e804=_0x30e804-0x0;var _0x529374=_0xf940[_0x30e804];return _0x529374;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x0f94('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f94('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2eede7){return function(_0x46205c,_0x4c7ce1,_0x8ca37b){SquareProjectEvents[_0x0f94('0x2')](_0x2eede7+':'+_0x46205c['id'],_0x46205c);SquareProjectEvents[_0x0f94('0x2')](_0x2eede7,_0x46205c);_0x8ca37b(null);};}for(var e in events){if(events[_0x0f94('0x3')](e)){var event=events[e];SquareProject[_0x0f94('0x4')](e,emitEvent(event));}}module[_0x0f94('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a054b33..75af417 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 _0x18a1=['changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x36d7d2,_0x5377ec){var _0x515f63=function(_0x314461){while(--_0x314461){_0x36d7d2['push'](_0x36d7d2['shift']());}};_0x515f63(++_0x5377ec);}(_0x18a1,0xde));var _0x118a=function(_0x14a0ff,_0x4947f5){_0x14a0ff=_0x14a0ff-0x0;var _0x2793f9=_0x18a1[_0x14a0ff];return _0x2793f9;};'use strict';var _=require(_0x118a('0x0'));var util=require('util');var logger=require(_0x118a('0x1'))(_0x118a('0x2'));var moment=require(_0x118a('0x3'));var BPromise=require(_0x118a('0x4'));var rp=require(_0x118a('0x5'));var fs=require('fs');var path=require(_0x118a('0x6'));var rimraf=require('rimraf');var config=require(_0x118a('0x7'));var attributes=require(_0x118a('0x8'));module[_0x118a('0x9')]=function(_0x1a5c50,_0x447d2c){return _0x1a5c50[_0x118a('0xa')](_0x118a('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ff678,_0x61de07,_0x44fe45){if(_0x5ff678[_0x118a('0xc')]('preproduction')){_0x5ff678[_0x118a('0xd')]=moment()[_0x118a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5ff678[_0x118a('0xc')](_0x118a('0xf'))){_0x5ff678[_0x118a('0x10')]=moment()['format'](_0x118a('0x11'));}_0x44fe45(null,_0x5ff678);}}});}; \ No newline at end of file +var _0x3553=['path','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x3553,0x13e));var _0x3355=function(_0x5cdf3d,_0x34a138){_0x5cdf3d=_0x5cdf3d-0x0;var _0x3faf3c=_0x3553[_0x5cdf3d];return _0x3faf3c;};'use strict';var _=require(_0x3355('0x0'));var util=require(_0x3355('0x1'));var logger=require('../../config/logger')(_0x3355('0x2'));var moment=require(_0x3355('0x3'));var BPromise=require(_0x3355('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3355('0x5'));var rimraf=require(_0x3355('0x6'));var config=require('../../config/environment');var attributes=require(_0x3355('0x7'));module[_0x3355('0x8')]=function(_0xc32b34,_0xf24344){return _0xc32b34[_0x3355('0x9')](_0x3355('0xa'),attributes,{'tableName':_0x3355('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cdbde,_0x533a9a,_0x255601){if(_0x4cdbde[_0x3355('0xc')](_0x3355('0xd'))){_0x4cdbde[_0x3355('0xe')]=moment()[_0x3355('0xf')](_0x3355('0x10'));}if(_0x4cdbde[_0x3355('0xc')]('production')){_0x4cdbde['publishedAt']=moment()[_0x3355('0xf')](_0x3355('0x10'));}_0x255601(null,_0x4cdbde);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 788e24e..499a295 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 _0x8a4e=['stringify','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','error','message','ShowSquareProject','debug'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8a4e,0xcd));var _0xe8a4=function(_0x54b648,_0x5648f0){_0x54b648=_0x54b648-0x0;var _0x4f7c5b=_0x8a4e[_0x54b648];return _0x4f7c5b;};'use strict';var _=require(_0xe8a4('0x0'));var Redis=require(_0xe8a4('0x1'));var db=require(_0xe8a4('0x2'))['db'];var logger=require(_0xe8a4('0x3'))(_0xe8a4('0x4'));var config=require(_0xe8a4('0x5'));config[_0xe8a4('0x6')]=_[_0xe8a4('0x7')](config[_0xe8a4('0x6')],{'host':_0xe8a4('0x8'),'port':0x18eb});var socket=require(_0xe8a4('0x9'))(new Redis(config['redis']));require(_0xe8a4('0xa'))['register'](socket);exports['GetSquareProjects']=function(_0x47dec0){var _0x43e05a=this;return new Promise(function(_0x1294e9,_0x3a319a){return db[_0xe8a4('0xb')]['findAll']({'raw':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0['options'][_0xe8a4('0xd')]===undefined?!![]:![]:!![],'where':_0x47dec0['options']?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0xe')]||null:null,'attributes':_0x47dec0['options']?_0x47dec0['options'][_0xe8a4('0xf')]||null:null,'limit':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x10')]||null:null,'include':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x11')],function(_0xf8abc1){return{'model':db[_0xf8abc1[_0xe8a4('0x13')]],'as':_0xf8abc1['as'],'attributes':_0xf8abc1['attributes'],'include':_0xf8abc1[_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0xf8abc1[_0xe8a4('0x11')],function(_0x137309){return{'model':db[_0x137309[_0xe8a4('0x13')]],'as':_0x137309['as'],'attributes':_0x137309['attributes'],'include':_0x137309['include']?_[_0xe8a4('0x12')](_0x137309[_0xe8a4('0x11')],function(_0x49b010){return{'model':db[_0x49b010[_0xe8a4('0x13')]],'as':_0x49b010['as'],'attributes':_0x49b010['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8a4('0x14')](function(_0x21e03f){logger[_0xe8a4('0x15')](_0xe8a4('0x16'),_0x47dec0);logger['debug']('GetSquareProjects',_0x47dec0,JSON['stringify'](_0x21e03f));_0x1294e9(_0x21e03f);})['catch'](function(_0x1da214){logger[_0xe8a4('0x17')](_0xe8a4('0x16'),_0x1da214[_0xe8a4('0x18')],_0x47dec0);_0x3a319a(_0x43e05a[_0xe8a4('0x17')](0x1f4,_0x1da214[_0xe8a4('0x18')]));});});};exports[_0xe8a4('0x19')]=function(_0x5dae3c){var _0x5d9b93=this;return new Promise(function(_0x1a001d,_0x25ab38){return db[_0xe8a4('0xb')]['find']({'raw':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0xd')]===undefined?!![]:![]:!![],'where':_0x5dae3c['options']?_0x5dae3c[_0xe8a4('0xc')]['where']||null:null,'attributes':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')]['attributes']||null:null,'include':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0x11')],function(_0x2177ec){return{'model':db[_0x2177ec['model']],'as':_0x2177ec['as'],'attributes':_0x2177ec[_0xe8a4('0xf')],'include':_0x2177ec[_0xe8a4('0x11')]?_['map'](_0x2177ec[_0xe8a4('0x11')],function(_0x49cf14){return{'model':db[_0x49cf14['model']],'as':_0x49cf14['as'],'attributes':_0x49cf14['attributes'],'include':_0x49cf14[_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x49cf14[_0xe8a4('0x11')],function(_0x193247){return{'model':db[_0x193247['model']],'as':_0x193247['as'],'attributes':_0x193247[_0xe8a4('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe8a4('0x14')](function(_0xb0f082){logger[_0xe8a4('0x15')]('ShowSquareProject',_0x5dae3c);logger[_0xe8a4('0x1a')](_0xe8a4('0x19'),_0x5dae3c,JSON[_0xe8a4('0x1b')](_0xb0f082));_0x1a001d(_0xb0f082);})[_0xe8a4('0x1c')](function(_0x3dc88a){logger[_0xe8a4('0x17')](_0xe8a4('0x19'),_0x3dc88a[_0xe8a4('0x18')],_0x5dae3c);_0x25ab38(_0x5d9b93[_0xe8a4('0x17')](0x1f4,_0x3dc88a[_0xe8a4('0x18')]));});});}; \ No newline at end of file +var _0x0e86=['stringify','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','SquareProject','findAll','options','where','attributes','limit','include','map','model','then','info','GetSquareProjects','catch','message','error','ShowSquareProject','find','raw'];(function(_0x50aea5,_0x5dd077){var _0x4657f1=function(_0x57fb40){while(--_0x57fb40){_0x50aea5['push'](_0x50aea5['shift']());}};_0x4657f1(++_0x5dd077);}(_0x0e86,0x1a5));var _0x60e8=function(_0x1a55c5,_0x4949a8){_0x1a55c5=_0x1a55c5-0x0;var _0x5eeeb2=_0x0e86[_0x1a55c5];return _0x5eeeb2;};'use strict';var _=require(_0x60e8('0x0'));var Redis=require(_0x60e8('0x1'));var db=require(_0x60e8('0x2'))['db'];var logger=require(_0x60e8('0x3'))('rpc');var config=require(_0x60e8('0x4'));config[_0x60e8('0x5')]=_[_0x60e8('0x6')](config[_0x60e8('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x60e8('0x7'))(new Redis(config[_0x60e8('0x5')]));require('./squareProject.socket')[_0x60e8('0x8')](socket);exports['GetSquareProjects']=function(_0x5a8930){var _0x182a6b=this;return new Promise(function(_0x59eec3,_0x1b8c73){return db[_0x60e8('0x9')][_0x60e8('0xa')]({'raw':_0x5a8930['options']?_0x5a8930['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a8930[_0x60e8('0xb')]?_0x5a8930[_0x60e8('0xb')][_0x60e8('0xc')]||null:null,'attributes':_0x5a8930[_0x60e8('0xb')]?_0x5a8930[_0x60e8('0xb')][_0x60e8('0xd')]||null:null,'limit':_0x5a8930[_0x60e8('0xb')]?_0x5a8930['options'][_0x60e8('0xe')]||null:null,'include':_0x5a8930[_0x60e8('0xb')]?_0x5a8930[_0x60e8('0xb')][_0x60e8('0xf')]?_[_0x60e8('0x10')](_0x5a8930[_0x60e8('0xb')]['include'],function(_0x4e18fc){return{'model':db[_0x4e18fc[_0x60e8('0x11')]],'as':_0x4e18fc['as'],'attributes':_0x4e18fc['attributes'],'include':_0x4e18fc[_0x60e8('0xf')]?_[_0x60e8('0x10')](_0x4e18fc[_0x60e8('0xf')],function(_0x2a5783){return{'model':db[_0x2a5783[_0x60e8('0x11')]],'as':_0x2a5783['as'],'attributes':_0x2a5783[_0x60e8('0xd')],'include':_0x2a5783[_0x60e8('0xf')]?_[_0x60e8('0x10')](_0x2a5783[_0x60e8('0xf')],function(_0x366f2e){return{'model':db[_0x366f2e[_0x60e8('0x11')]],'as':_0x366f2e['as'],'attributes':_0x366f2e['attributes']};}):[]};}):[]};}):[]:[]})[_0x60e8('0x12')](function(_0x10062b){logger[_0x60e8('0x13')](_0x60e8('0x14'),_0x5a8930);logger['debug'](_0x60e8('0x14'),_0x5a8930,JSON['stringify'](_0x10062b));_0x59eec3(_0x10062b);})[_0x60e8('0x15')](function(_0x1e27ab){logger['error'](_0x60e8('0x14'),_0x1e27ab[_0x60e8('0x16')],_0x5a8930);_0x1b8c73(_0x182a6b[_0x60e8('0x17')](0x1f4,_0x1e27ab[_0x60e8('0x16')]));});});};exports[_0x60e8('0x18')]=function(_0x407a5c){var _0x15f01e=this;return new Promise(function(_0x2de3c8,_0x1e867d){return db['SquareProject'][_0x60e8('0x19')]({'raw':_0x407a5c[_0x60e8('0xb')]?_0x407a5c[_0x60e8('0xb')][_0x60e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x407a5c[_0x60e8('0xb')]?_0x407a5c[_0x60e8('0xb')][_0x60e8('0xc')]||null:null,'attributes':_0x407a5c['options']?_0x407a5c['options'][_0x60e8('0xd')]||null:null,'include':_0x407a5c[_0x60e8('0xb')]?_0x407a5c[_0x60e8('0xb')][_0x60e8('0xf')]?_[_0x60e8('0x10')](_0x407a5c[_0x60e8('0xb')][_0x60e8('0xf')],function(_0x3ababe){return{'model':db[_0x3ababe[_0x60e8('0x11')]],'as':_0x3ababe['as'],'attributes':_0x3ababe[_0x60e8('0xd')],'include':_0x3ababe['include']?_[_0x60e8('0x10')](_0x3ababe[_0x60e8('0xf')],function(_0x19da9b){return{'model':db[_0x19da9b[_0x60e8('0x11')]],'as':_0x19da9b['as'],'attributes':_0x19da9b[_0x60e8('0xd')],'include':_0x19da9b['include']?_[_0x60e8('0x10')](_0x19da9b[_0x60e8('0xf')],function(_0x6cdd18){return{'model':db[_0x6cdd18[_0x60e8('0x11')]],'as':_0x6cdd18['as'],'attributes':_0x6cdd18[_0x60e8('0xd')]};}):[]};}):[]};}):[]:[]})[_0x60e8('0x12')](function(_0x5d4c81){logger[_0x60e8('0x13')](_0x60e8('0x18'),_0x407a5c);logger['debug'](_0x60e8('0x18'),_0x407a5c,JSON[_0x60e8('0x1b')](_0x5d4c81));_0x2de3c8(_0x5d4c81);})['catch'](function(_0xff0100){logger['error'](_0x60e8('0x18'),_0xff0100[_0x60e8('0x16')],_0x407a5c);_0x1e867d(_0x15f01e[_0x60e8('0x17')](0x1f4,_0xff0100['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4b59968..ca02f6d 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 _0xbc44=['removeListener','length','squareProject:','save','remove','update','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbc44,0xf8));var _0x4bc4=function(_0x387323,_0x9ac7d2){_0x387323=_0x387323-0x0;var _0x45c458=_0xbc44[_0x387323];return _0x45c458;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x4bc4('0x0'),_0x4bc4('0x1'),_0x4bc4('0x2')];function createListener(_0xf577c9,_0x3a94bb){return function(_0x32ea24){_0x3a94bb[_0x4bc4('0x3')](_0xf577c9,_0x32ea24);};}function removeListener(_0x32f7ad,_0x222d9c){return function(){SquareProjectEvents[_0x4bc4('0x4')](_0x32f7ad,_0x222d9c);};}exports['register']=function(_0x12cb7e){for(var _0x44525e=0x0,_0x1615fc=events[_0x4bc4('0x5')];_0x44525e<_0x1615fc;_0x44525e++){var _0x507aff=events[_0x44525e];var _0x4a7b2d=createListener(_0x4bc4('0x6')+_0x507aff,_0x12cb7e);SquareProjectEvents['on'](_0x507aff,_0x4a7b2d);}}; \ No newline at end of file +var _0x6416=['length','squareProject:','./squareProject.events','update','removeListener','register'];(function(_0x58384b,_0xc9dc35){var _0x4f039f=function(_0x413651){while(--_0x413651){_0x58384b['push'](_0x58384b['shift']());}};_0x4f039f(++_0xc9dc35);}(_0x6416,0x11c));var _0x6641=function(_0x2f4f1c,_0x1e2c9f){_0x2f4f1c=_0x2f4f1c-0x0;var _0x4c49a8=_0x6416[_0x2f4f1c];return _0x4c49a8;};'use strict';var SquareProjectEvents=require(_0x6641('0x0'));var events=['save','remove',_0x6641('0x1')];function createListener(_0x5e724c,_0x211c66){return function(_0x5bdacb){_0x211c66['emit'](_0x5e724c,_0x5bdacb);};}function removeListener(_0x1cb843,_0x140997){return function(){SquareProjectEvents[_0x6641('0x2')](_0x1cb843,_0x140997);};}exports[_0x6641('0x3')]=function(_0x17159c){for(var _0x408b2e=0x0,_0x12003b=events[_0x6641('0x4')];_0x408b2e<_0x12003b;_0x408b2e++){var _0x4aada6=events[_0x408b2e];var _0x67c25e=createListener(_0x6641('0x5')+_0x4aada6,_0x17159c);SquareProjectEvents['on'](_0x4aada6,_0x67c25e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f227554..bf41591 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x22437a,_0x58a642){var _0x793077=function(_0x2fc095){while(--_0x2fc095){_0x22437a['push'](_0x22437a['shift']());}};_0x793077(++_0x58a642);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x5fc3[_0x4c260a];return _0x17bbdd;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4e4a3c,_0x5eb4ec){var _0x417e84=function(_0x23beef){while(--_0x23beef){_0x4e4a3c['push'](_0x4e4a3c['shift']());}};_0x417e84(++_0x5eb4ec);}(_0xabce,0x103));var _0xeabc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xabce[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8512b55..798c10c 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 _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf494,0x1c6));var _0x4f49=function(_0x592726,_0x4430eb){_0x592726=_0x592726-0x0;var _0x436a50=_0xf494[_0x592726];return _0x436a50;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file +var _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x3244bf,_0x237273){var _0x181a5d=function(_0x3fd2db){while(--_0x3fd2db){_0x3244bf['push'](_0x3244bf['shift']());}};_0x181a5d(++_0x237273);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1b792c,_0x52526e){_0x1b792c=_0x1b792c-0x0;var _0x2a6675=_0xbd51[_0x1b792c];return _0x2a6675;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b053bbf..158fb02 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 _0x84e3=['name','index','map','SquareRecording','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','then','stack'];(function(_0x5973b8,_0xc5b4c2){var _0x1f2878=function(_0xab57dd){while(--_0xab57dd){_0x5973b8['push'](_0x5973b8['shift']());}};_0x1f2878(++_0xc5b4c2);}(_0x84e3,0xfb));var _0x384e=function(_0x4b2119,_0xaf829b){_0x4b2119=_0x4b2119-0x0;var _0x33d26e=_0x84e3[_0x4b2119];return _0x33d26e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x384e('0x0'));var jsonpatch=require(_0x384e('0x1'));var rp=require(_0x384e('0x2'));var moment=require(_0x384e('0x3'));var BPromise=require(_0x384e('0x4'));var Mustache=require(_0x384e('0x5'));var util=require(_0x384e('0x6'));var path=require(_0x384e('0x7'));var sox=require(_0x384e('0x8'));var csv=require('to-csv');var ejs=require(_0x384e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x384e('0xa'));var squel=require(_0x384e('0xb'));var crypto=require(_0x384e('0xc'));var jsforce=require(_0x384e('0xd'));var deskjs=require(_0x384e('0xe'));var toCsv=require(_0x384e('0xf'));var querystring=require(_0x384e('0x10'));var Papa=require(_0x384e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x384e('0x12'));var as=require(_0x384e('0x13'));var hardwareService=require(_0x384e('0x14'));var logger=require(_0x384e('0x15'))('api');var utils=require(_0x384e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x384e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209f0c,_0x3191c5){_0x3191c5=_0x3191c5||0xcc;return function(_0x42b3a5){if(_0x42b3a5){return _0x209f0c[_0x384e('0x18')](_0x3191c5);}return _0x209f0c['status'](_0x3191c5)[_0x384e('0x19')]();};}function respondWithResult(_0x58fce4,_0x16721e){_0x16721e=_0x16721e||0xc8;return function(_0x15e142){if(_0x15e142){return _0x58fce4[_0x384e('0x1a')](_0x16721e)[_0x384e('0x1b')](_0x15e142);}};}function respondWithFilteredResult(_0x19dca3,_0xbde9dd){return function(_0xf57e19){if(_0xf57e19){var _0xd9e6de=typeof _0xbde9dd['offset']===_0x384e('0x1c')&&typeof _0xbde9dd[_0x384e('0x1d')]===_0x384e('0x1c');var _0x1b79db=_0xf57e19[_0x384e('0x1e')];var _0x42b611=_0xd9e6de?0x0:_0xbde9dd[_0x384e('0x1f')];var _0x5d640f=_0xd9e6de?_0xf57e19['count']:_0xbde9dd[_0x384e('0x1f')]+_0xbde9dd[_0x384e('0x1d')];var _0x5c9a97;if(_0x5d640f>=_0x1b79db){_0x5d640f=_0x1b79db;_0x5c9a97=0xc8;}else{_0x5c9a97=0xce;}_0x19dca3[_0x384e('0x1a')](_0x5c9a97);return _0x19dca3[_0x384e('0x20')]('Content-Range',_0x42b611+'-'+_0x5d640f+'/'+_0x1b79db)[_0x384e('0x1b')](_0xf57e19);}return null;};}function patchUpdates(_0x19b5ac){return function(_0x57d8ba){try{jsonpatch[_0x384e('0x21')](_0x57d8ba,_0x19b5ac,!![]);}catch(_0x391c7f){return BPromise[_0x384e('0x22')](_0x391c7f);}return _0x57d8ba['save']();};}function saveUpdates(_0x2fc66f,_0x288aae){return function(_0xea3ec){if(_0xea3ec){return _0xea3ec['update'](_0x2fc66f)[_0x384e('0x23')](function(_0xb2c696){return _0xb2c696;});}return null;};}function removeEntity(_0x54fbe0,_0x3246d7){return function(_0x46e2fe){if(_0x46e2fe){return _0x46e2fe['destroy']()[_0x384e('0x23')](function(){_0x54fbe0[_0x384e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f780,_0x39f3c7){return function(_0x3c7bf6){if(!_0x3c7bf6){_0x13f780[_0x384e('0x18')](0x194);}return _0x3c7bf6;};}function handleError(_0x5db6af,_0x1d6e56){_0x1d6e56=_0x1d6e56||0x1f4;return function(_0x659f63){logger['error'](_0x659f63[_0x384e('0x24')]);if(_0x659f63['name']){delete _0x659f63[_0x384e('0x25')];}_0x5db6af[_0x384e('0x1a')](_0x1d6e56)['send'](_0x659f63);};}exports[_0x384e('0x26')]=function(_0x4be291,_0x3a0475){var _0x4bf23a={},_0x116847={},_0x57292e={'count':0x0,'rows':[]};var _0x1c58e9=_[_0x384e('0x27')](db[_0x384e('0x28')][_0x384e('0x29')],function(_0x335f29){return{'name':_0x335f29[_0x384e('0x2a')],'type':_0x335f29['type']['key']};});_0x116847[_0x384e('0x2b')]=_[_0x384e('0x27')](_0x1c58e9,'name');_0x116847[_0x384e('0x2c')]=_[_0x384e('0x2d')](_0x4be291[_0x384e('0x2c')]);_0x116847[_0x384e('0x2e')]=_[_0x384e('0x2f')](_0x116847[_0x384e('0x2b')],_0x116847['query']);_0x4bf23a[_0x384e('0x30')]=_[_0x384e('0x2f')](_0x116847[_0x384e('0x2b')],qs[_0x384e('0x31')](_0x4be291[_0x384e('0x2c')][_0x384e('0x31')]));_0x4bf23a[_0x384e('0x30')]=_0x4bf23a[_0x384e('0x30')][_0x384e('0x32')]?_0x4bf23a[_0x384e('0x30')]:_0x116847[_0x384e('0x2b')];if(!_0x4be291['query'][_0x384e('0x33')](_0x384e('0x34'))){_0x4bf23a[_0x384e('0x1d')]=qs[_0x384e('0x1d')](_0x4be291[_0x384e('0x2c')][_0x384e('0x1d')]);_0x4bf23a[_0x384e('0x1f')]=qs[_0x384e('0x1f')](_0x4be291[_0x384e('0x2c')][_0x384e('0x1f')]);}_0x4bf23a[_0x384e('0x35')]=qs[_0x384e('0x36')](_0x4be291[_0x384e('0x2c')][_0x384e('0x36')]);_0x4bf23a[_0x384e('0x37')]=qs[_0x384e('0x2e')](_['pick'](_0x4be291[_0x384e('0x2c')],_0x116847['filters']),_0x1c58e9);if(_0x4be291[_0x384e('0x2c')][_0x384e('0x38')]){_0x4bf23a[_0x384e('0x37')]=_[_0x384e('0x39')](_0x4bf23a[_0x384e('0x37')],{'$or':_[_0x384e('0x27')](_0x1c58e9,function(_0xeebefd){if(_0xeebefd[_0x384e('0x3a')]!=='VIRTUAL'){var _0x5b3828={};_0x5b3828[_0xeebefd[_0x384e('0x25')]]={'$like':'%'+_0x4be291[_0x384e('0x2c')][_0x384e('0x38')]+'%'};return _0x5b3828;}})});}_0x4bf23a=_[_0x384e('0x39')]({},_0x4bf23a,_0x4be291['options']);var _0x56473d={'where':_0x4bf23a['where']};return db[_0x384e('0x28')][_0x384e('0x1e')](_0x56473d)[_0x384e('0x23')](function(_0x1f1ffd){_0x57292e[_0x384e('0x1e')]=_0x1f1ffd;if(_0x4be291[_0x384e('0x2c')][_0x384e('0x3b')]){_0x4bf23a[_0x384e('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0x384e('0x3d')](_0x4bf23a);})['then'](function(_0x5aa9e0){_0x57292e[_0x384e('0x3e')]=_0x5aa9e0;return _0x57292e;})[_0x384e('0x23')](respondWithFilteredResult(_0x3a0475,_0x4bf23a))[_0x384e('0x3f')](handleError(_0x3a0475,null));};exports[_0x384e('0x40')]=function(_0x4d8cde,_0x51d110){var _0x51166c={'raw':!![],'where':{'id':_0x4d8cde['params']['id']}},_0x29255f={};_0x29255f[_0x384e('0x2b')]=_['keys'](db[_0x384e('0x28')][_0x384e('0x29')]);_0x29255f[_0x384e('0x2c')]=_[_0x384e('0x2d')](_0x4d8cde[_0x384e('0x2c')]);_0x29255f['filters']=_['intersection'](_0x29255f[_0x384e('0x2b')],_0x29255f[_0x384e('0x2c')]);_0x51166c[_0x384e('0x30')]=_['intersection'](_0x29255f['model'],qs[_0x384e('0x31')](_0x4d8cde['query'][_0x384e('0x31')]));_0x51166c['attributes']=_0x51166c['attributes'][_0x384e('0x32')]?_0x51166c[_0x384e('0x30')]:_0x29255f[_0x384e('0x2b')];if(_0x4d8cde['query']['includeAll']){_0x51166c['include']=[{'all':!![]}];}_0x51166c=_[_0x384e('0x39')]({},_0x51166c,_0x4d8cde[_0x384e('0x41')]);return db[_0x384e('0x28')]['find'](_0x51166c)[_0x384e('0x23')](handleEntityNotFound(_0x51d110,null))['then'](respondWithResult(_0x51d110,null))[_0x384e('0x3f')](handleError(_0x51d110,null));};exports[_0x384e('0x42')]=function(_0x4cec42,_0x3b8cc9){return db[_0x384e('0x28')]['create'](_0x4cec42[_0x384e('0x43')],{})[_0x384e('0x23')](respondWithResult(_0x3b8cc9,0xc9))[_0x384e('0x3f')](handleError(_0x3b8cc9,null));};exports['update']=function(_0x12ca3d,_0x31f5ea){if(_0x12ca3d[_0x384e('0x43')]['id']){delete _0x12ca3d[_0x384e('0x43')]['id'];}return db[_0x384e('0x28')][_0x384e('0x44')]({'where':{'id':_0x12ca3d[_0x384e('0x45')]['id']}})[_0x384e('0x23')](handleEntityNotFound(_0x31f5ea,null))[_0x384e('0x23')](saveUpdates(_0x12ca3d[_0x384e('0x43')],null))[_0x384e('0x23')](respondWithResult(_0x31f5ea,null))['catch'](handleError(_0x31f5ea,null));};exports[_0x384e('0x46')]=function(_0x5e6be6,_0x4d6d9b,_0x30280e){var _0x8e3210=require(_0x384e('0x47'));var _0x3b38ed=![];var _0x132fb4={};if(_0x5e6be6[_0x384e('0x2c')][_0x384e('0x3a')]&&_0x5e6be6[_0x384e('0x2c')]['type']===_0x384e('0x48')){_0x132fb4[_0x384e('0x48')]=_0x5e6be6[_0x384e('0x45')]['id'];}else{_0x132fb4['id']=_0x5e6be6[_0x384e('0x45')]['id'];}return db['SquareRecording'][_0x384e('0x44')]({'where':_0x132fb4,'attributes':['id',_0x384e('0x49'),_0x384e('0x4a')],'raw':!![]})[_0x384e('0x23')](handleEntityNotFound(_0x4d6d9b,null))[_0x384e('0x23')](function(_0x2da563){if(_0x2da563){var _0x2cc149=_0x2da563['savePath'];var _0x37a4d4=util[_0x384e('0x4b')](_0x384e('0x4c'),_0x2cc149);if(fs[_0x384e('0x4d')](_0x37a4d4)){_0x3b38ed=!![];return _0x8e3210[_0x384e('0x4e')](_0x37a4d4,_0x2cc149,config[_0x384e('0x4f')][_0x384e('0x50')])[_0x384e('0x23')](function(){return _0x2da563;});}return _0x2da563;}})[_0x384e('0x23')](function(_0x29321a){if(_0x29321a){var _0x31274d=_0x29321a[_0x384e('0x49')];if(!fs[_0x384e('0x4d')](_0x31274d)){throw new db[(_0x384e('0x51'))]['ValidationError'](_0x384e('0x52'));}if(_0x29321a[_0x384e('0x4a')]){return _0x4d6d9b['download'](_0x31274d,_0x29321a[_0x384e('0x4a')]+path[_0x384e('0x53')](_0x31274d),function(){if(_0x3b38ed){fs[_0x384e('0x54')](_0x31274d);}});}else{return _0x4d6d9b['download'](_0x31274d,function(_0x5d983e){if(_0x3b38ed){fs[_0x384e('0x54')](_0x31274d);}});}}})[_0x384e('0x3f')](function(_0x294f29){if(_0x294f29[_0x384e('0x55')]==='SquareRecording\x20not\x20found'){_0x4d6d9b[_0x384e('0x1a')](0x194)[_0x384e('0x56')](_0x384e('0x57'));}else{return handleError(_0x4d6d9b,null);}});};exports[_0x384e('0x58')]=function(_0xe70f6f,_0x25f7b0){return db[_0x384e('0x28')][_0x384e('0x44')]({'where':{'id':_0xe70f6f['params']['id']}})[_0x384e('0x23')](function(_0x5ddceb){if(_[_0x384e('0x59')](_0x5ddceb)){throw new ReferenceError(_0x384e('0x5a'));}return _0x5ddceb;})['then'](function(_0x130180){var _0x26da8e=_0x130180[_0x384e('0x49')];logger[_0x384e('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x26da8e);if(!_[_0x384e('0x59')](_0x130180['savePath'])&&fs[_0x384e('0x4d')](_0x26da8e)){logger[_0x384e('0x5b')](_0x384e('0x5c')+_0x26da8e+_0x384e('0x5d'));fs[_0x384e('0x5e')](_0x26da8e);}_0x26da8e=_0x26da8e+_0x384e('0x5f');if(!_[_0x384e('0x59')](_0x130180[_0x384e('0x49')])&&fs[_0x384e('0x4d')](_0x26da8e)){logger[_0x384e('0x5b')](_0x384e('0x5c')+_0x26da8e+_0x384e('0x5d'));fs[_0x384e('0x5e')](_0x26da8e);}return _0x130180;})[_0x384e('0x23')](function(_0x19d847){if(!_0x19d847)throw new InternalError();return _0x19d847[_0x384e('0x58')]();})['then'](function(){_0x25f7b0[_0x384e('0x1a')](0xcc)['end']();})[_0x384e('0x3f')](handleError(_0x25f7b0,null));}; \ No newline at end of file +var _0xf1a1=['fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0xd33957,_0x23e18d){var _0xc099bc=function(_0x339a38){while(--_0x339a38){_0xd33957['push'](_0xd33957['shift']());}};_0xc099bc(++_0x23e18d);}(_0xf1a1,0x8f));var _0x1f1a=function(_0x134790,_0x3c17d6){_0x134790=_0x134790-0x0;var _0x3aeeee=_0xf1a1[_0x134790];return _0x3aeeee;};'use strict';var emlformat=require(_0x1f1a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f1a('0x1'));var rp=require(_0x1f1a('0x2'));var moment=require('moment');var BPromise=require(_0x1f1a('0x3'));var Mustache=require(_0x1f1a('0x4'));var util=require(_0x1f1a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1f1a('0x6'));var ejs=require(_0x1f1a('0x7'));var fs=require('fs');var fs_extra=require(_0x1f1a('0x8'));var _=require('lodash');var squel=require(_0x1f1a('0x9'));var crypto=require(_0x1f1a('0xa'));var jsforce=require(_0x1f1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f1a('0x6'));var querystring=require(_0x1f1a('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f1a('0xd'));var authService=require(_0x1f1a('0xe'));var qs=require(_0x1f1a('0xf'));var as=require(_0x1f1a('0x10'));var hardwareService=require(_0x1f1a('0x11'));var logger=require(_0x1f1a('0x12'))('api');var utils=require(_0x1f1a('0x13'));var config=require(_0x1f1a('0x14'));var licenseUtil=require(_0x1f1a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5481d7,_0x67e574){_0x67e574=_0x67e574||0xcc;return function(_0x7bce35){if(_0x7bce35){return _0x5481d7[_0x1f1a('0x16')](_0x67e574);}return _0x5481d7['status'](_0x67e574)[_0x1f1a('0x17')]();};}function respondWithResult(_0x25f16e,_0x260a13){_0x260a13=_0x260a13||0xc8;return function(_0x179f16){if(_0x179f16){return _0x25f16e[_0x1f1a('0x18')](_0x260a13)[_0x1f1a('0x19')](_0x179f16);}};}function respondWithFilteredResult(_0x58514e,_0x4aae99){return function(_0x5e6ac5){if(_0x5e6ac5){var _0x23b1ba=typeof _0x4aae99['offset']==='undefined'&&typeof _0x4aae99[_0x1f1a('0x1a')]===_0x1f1a('0x1b');var _0x61296d=_0x5e6ac5[_0x1f1a('0x1c')];var _0x40dd32=_0x23b1ba?0x0:_0x4aae99[_0x1f1a('0x1d')];var _0x3c80fb=_0x23b1ba?_0x5e6ac5[_0x1f1a('0x1c')]:_0x4aae99[_0x1f1a('0x1d')]+_0x4aae99[_0x1f1a('0x1a')];var _0x4062c9;if(_0x3c80fb>=_0x61296d){_0x3c80fb=_0x61296d;_0x4062c9=0xc8;}else{_0x4062c9=0xce;}_0x58514e[_0x1f1a('0x18')](_0x4062c9);return _0x58514e[_0x1f1a('0x1e')](_0x1f1a('0x1f'),_0x40dd32+'-'+_0x3c80fb+'/'+_0x61296d)[_0x1f1a('0x19')](_0x5e6ac5);}return null;};}function patchUpdates(_0x30c5f5){return function(_0x5ecb52){try{jsonpatch[_0x1f1a('0x20')](_0x5ecb52,_0x30c5f5,!![]);}catch(_0x1b0433){return BPromise[_0x1f1a('0x21')](_0x1b0433);}return _0x5ecb52[_0x1f1a('0x22')]();};}function saveUpdates(_0x43e521,_0x484221){return function(_0x34b69c){if(_0x34b69c){return _0x34b69c[_0x1f1a('0x23')](_0x43e521)[_0x1f1a('0x24')](function(_0x34c12b){return _0x34c12b;});}return null;};}function removeEntity(_0x35b6c2,_0x4565ab){return function(_0x192983){if(_0x192983){return _0x192983[_0x1f1a('0x25')]()[_0x1f1a('0x24')](function(){_0x35b6c2[_0x1f1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2cc5,_0x10be54){return function(_0x77d6fe){if(!_0x77d6fe){_0x2d2cc5['sendStatus'](0x194);}return _0x77d6fe;};}function handleError(_0xf26bee,_0x118bb6){_0x118bb6=_0x118bb6||0x1f4;return function(_0x35f17f){logger['error'](_0x35f17f['stack']);if(_0x35f17f['name']){delete _0x35f17f[_0x1f1a('0x26')];}_0xf26bee[_0x1f1a('0x18')](_0x118bb6)[_0x1f1a('0x27')](_0x35f17f);};}exports['index']=function(_0x44d625,_0x499c84){var _0x519035={},_0x634f8a={},_0x298761={'count':0x0,'rows':[]};var _0x3300cb=_[_0x1f1a('0x28')](db[_0x1f1a('0x29')][_0x1f1a('0x2a')],function(_0x1991e7){return{'name':_0x1991e7[_0x1f1a('0x2b')],'type':_0x1991e7[_0x1f1a('0x2c')][_0x1f1a('0x2d')]};});_0x634f8a[_0x1f1a('0x2e')]=_['map'](_0x3300cb,'name');_0x634f8a[_0x1f1a('0x2f')]=_[_0x1f1a('0x30')](_0x44d625['query']);_0x634f8a[_0x1f1a('0x31')]=_[_0x1f1a('0x32')](_0x634f8a[_0x1f1a('0x2e')],_0x634f8a[_0x1f1a('0x2f')]);_0x519035['attributes']=_[_0x1f1a('0x32')](_0x634f8a[_0x1f1a('0x2e')],qs['fields'](_0x44d625[_0x1f1a('0x2f')][_0x1f1a('0x33')]));_0x519035['attributes']=_0x519035[_0x1f1a('0x34')][_0x1f1a('0x35')]?_0x519035[_0x1f1a('0x34')]:_0x634f8a['model'];if(!_0x44d625['query'][_0x1f1a('0x36')](_0x1f1a('0x37'))){_0x519035[_0x1f1a('0x1a')]=qs['limit'](_0x44d625[_0x1f1a('0x2f')]['limit']);_0x519035[_0x1f1a('0x1d')]=qs[_0x1f1a('0x1d')](_0x44d625[_0x1f1a('0x2f')][_0x1f1a('0x1d')]);}_0x519035[_0x1f1a('0x38')]=qs['sort'](_0x44d625[_0x1f1a('0x2f')]['sort']);_0x519035[_0x1f1a('0x39')]=qs['filters'](_[_0x1f1a('0x3a')](_0x44d625[_0x1f1a('0x2f')],_0x634f8a['filters']),_0x3300cb);if(_0x44d625['query'][_0x1f1a('0x3b')]){_0x519035['where']=_[_0x1f1a('0x3c')](_0x519035[_0x1f1a('0x39')],{'$or':_[_0x1f1a('0x28')](_0x3300cb,function(_0x2798c3){if(_0x2798c3[_0x1f1a('0x2c')]!==_0x1f1a('0x3d')){var _0x4333ee={};_0x4333ee[_0x2798c3[_0x1f1a('0x26')]]={'$like':'%'+_0x44d625[_0x1f1a('0x2f')][_0x1f1a('0x3b')]+'%'};return _0x4333ee;}})});}_0x519035=_[_0x1f1a('0x3c')]({},_0x519035,_0x44d625[_0x1f1a('0x3e')]);var _0x25e1b8={'where':_0x519035['where']};return db[_0x1f1a('0x29')][_0x1f1a('0x1c')](_0x25e1b8)[_0x1f1a('0x24')](function(_0x51d3c0){_0x298761[_0x1f1a('0x1c')]=_0x51d3c0;if(_0x44d625[_0x1f1a('0x2f')][_0x1f1a('0x3f')]){_0x519035[_0x1f1a('0x40')]=[{'all':!![]}];}return db[_0x1f1a('0x29')][_0x1f1a('0x41')](_0x519035);})['then'](function(_0x1fb76b){_0x298761[_0x1f1a('0x42')]=_0x1fb76b;return _0x298761;})['then'](respondWithFilteredResult(_0x499c84,_0x519035))['catch'](handleError(_0x499c84,null));};exports[_0x1f1a('0x43')]=function(_0x191997,_0x4d6e16){var _0x5a0b26={'raw':!![],'where':{'id':_0x191997[_0x1f1a('0x44')]['id']}},_0x392f6c={};_0x392f6c[_0x1f1a('0x2e')]=_['keys'](db[_0x1f1a('0x29')]['rawAttributes']);_0x392f6c[_0x1f1a('0x2f')]=_[_0x1f1a('0x30')](_0x191997[_0x1f1a('0x2f')]);_0x392f6c[_0x1f1a('0x31')]=_['intersection'](_0x392f6c[_0x1f1a('0x2e')],_0x392f6c[_0x1f1a('0x2f')]);_0x5a0b26[_0x1f1a('0x34')]=_[_0x1f1a('0x32')](_0x392f6c[_0x1f1a('0x2e')],qs[_0x1f1a('0x33')](_0x191997[_0x1f1a('0x2f')][_0x1f1a('0x33')]));_0x5a0b26[_0x1f1a('0x34')]=_0x5a0b26[_0x1f1a('0x34')][_0x1f1a('0x35')]?_0x5a0b26['attributes']:_0x392f6c[_0x1f1a('0x2e')];if(_0x191997[_0x1f1a('0x2f')]['includeAll']){_0x5a0b26[_0x1f1a('0x40')]=[{'all':!![]}];}_0x5a0b26=_[_0x1f1a('0x3c')]({},_0x5a0b26,_0x191997[_0x1f1a('0x3e')]);return db['SquareRecording'][_0x1f1a('0x45')](_0x5a0b26)[_0x1f1a('0x24')](handleEntityNotFound(_0x4d6e16,null))[_0x1f1a('0x24')](respondWithResult(_0x4d6e16,null))[_0x1f1a('0x46')](handleError(_0x4d6e16,null));};exports[_0x1f1a('0x47')]=function(_0x44b5e8,_0x11ca28){return db['SquareRecording']['create'](_0x44b5e8[_0x1f1a('0x48')],{})['then'](respondWithResult(_0x11ca28,0xc9))[_0x1f1a('0x46')](handleError(_0x11ca28,null));};exports['update']=function(_0x7ac6e6,_0x1f0eac){if(_0x7ac6e6[_0x1f1a('0x48')]['id']){delete _0x7ac6e6['body']['id'];}return db[_0x1f1a('0x29')][_0x1f1a('0x45')]({'where':{'id':_0x7ac6e6['params']['id']}})[_0x1f1a('0x24')](handleEntityNotFound(_0x1f0eac,null))[_0x1f1a('0x24')](saveUpdates(_0x7ac6e6[_0x1f1a('0x48')],null))[_0x1f1a('0x24')](respondWithResult(_0x1f0eac,null))[_0x1f1a('0x46')](handleError(_0x1f0eac,null));};exports[_0x1f1a('0x49')]=function(_0x1fe3d8,_0x4b8384,_0x2154db){var _0x43fd37=require('../../components/encryptor');var _0x7c3ad0=![];var _0xc3b14={};if(_0x1fe3d8[_0x1f1a('0x2f')]['type']&&_0x1fe3d8[_0x1f1a('0x2f')][_0x1f1a('0x2c')]==='uniqueid'){_0xc3b14[_0x1f1a('0x4a')]=_0x1fe3d8['params']['id'];}else{_0xc3b14['id']=_0x1fe3d8[_0x1f1a('0x44')]['id'];}return db['SquareRecording'][_0x1f1a('0x45')]({'where':_0xc3b14,'attributes':['id','savePath','filename'],'raw':!![]})[_0x1f1a('0x24')](handleEntityNotFound(_0x4b8384,null))[_0x1f1a('0x24')](function(_0x57764e){if(_0x57764e){var _0x1996fa=_0x57764e[_0x1f1a('0x4b')];var _0x7a9ecd=util[_0x1f1a('0x4c')](_0x1f1a('0x4d'),_0x1996fa);if(fs[_0x1f1a('0x4e')](_0x7a9ecd)){_0x7c3ad0=!![];return _0x43fd37[_0x1f1a('0x4f')](_0x7a9ecd,_0x1996fa,config[_0x1f1a('0x50')][_0x1f1a('0x51')])['then'](function(){return _0x57764e;});}return _0x57764e;}})[_0x1f1a('0x24')](function(_0x18fa0f){if(_0x18fa0f){var _0x4fba71=_0x18fa0f[_0x1f1a('0x4b')];if(!fs[_0x1f1a('0x4e')](_0x4fba71)){throw new db[(_0x1f1a('0x52'))][(_0x1f1a('0x53'))]('SquareRecording\x20not\x20found');}if(_0x18fa0f[_0x1f1a('0x54')]){return _0x4b8384['download'](_0x4fba71,_0x18fa0f[_0x1f1a('0x54')]+path[_0x1f1a('0x55')](_0x4fba71),function(){if(_0x7c3ad0){fs[_0x1f1a('0x56')](_0x4fba71);}});}else{return _0x4b8384[_0x1f1a('0x49')](_0x4fba71,function(_0x4b602c){if(_0x7c3ad0){fs[_0x1f1a('0x56')](_0x4fba71);}});}}})[_0x1f1a('0x46')](function(_0x44b2f){if(_0x44b2f[_0x1f1a('0x57')]===_0x1f1a('0x58')){_0x4b8384['status'](0x194)['send'](_0x1f1a('0x59'));}else{return handleError(_0x4b8384,null);}});};exports[_0x1f1a('0x25')]=function(_0x33ad09,_0x2411db){return db['SquareRecording']['find']({'where':{'id':_0x33ad09[_0x1f1a('0x44')]['id']}})['then'](function(_0x504c72){if(_[_0x1f1a('0x5a')](_0x504c72)){throw new ReferenceError(_0x1f1a('0x5b'));}return _0x504c72;})[_0x1f1a('0x24')](function(_0x31f230){var _0x316090=_0x31f230[_0x1f1a('0x4b')];logger['info'](_0x1f1a('0x5c'),_0x316090);if(!_[_0x1f1a('0x5a')](_0x31f230['savePath'])&&fs[_0x1f1a('0x4e')](_0x316090)){logger[_0x1f1a('0x5d')](_0x1f1a('0x5e')+_0x316090+_0x1f1a('0x5f'));fs[_0x1f1a('0x60')](_0x316090);}_0x316090=_0x316090+'.cypher';if(!_[_0x1f1a('0x5a')](_0x31f230[_0x1f1a('0x4b')])&&fs[_0x1f1a('0x4e')](_0x316090)){logger[_0x1f1a('0x5d')](_0x1f1a('0x5e')+_0x316090+_0x1f1a('0x5f'));fs[_0x1f1a('0x60')](_0x316090);}return _0x31f230;})[_0x1f1a('0x24')](function(_0x9b2162){if(!_0x9b2162)throw new InternalError();return _0x9b2162[_0x1f1a('0x25')]();})['then'](function(){_0x2411db[_0x1f1a('0x18')](0xcc)[_0x1f1a('0x17')]();})['catch'](handleError(_0x2411db,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6bd6b7e..8866648 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 _0x6c14=['square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x37fb12,_0x2b75ac){var _0x4479f3=function(_0x13111e){while(--_0x13111e){_0x37fb12['push'](_0x37fb12['shift']());}};_0x4479f3(++_0x2b75ac);}(_0x6c14,0xd1));var _0x46c1=function(_0x802994,_0x5194a7){_0x802994=_0x802994-0x0;var _0x27f1f7=_0x6c14[_0x802994];return _0x27f1f7;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var logger=require(_0x46c1('0x2'))(_0x46c1('0x3'));var moment=require(_0x46c1('0x4'));var BPromise=require('bluebird');var rp=require(_0x46c1('0x5'));var fs=require('fs');var path=require(_0x46c1('0x6'));var rimraf=require(_0x46c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x46c1('0x8'));module[_0x46c1('0x9')]=function(_0x30120b,_0x270204){return _0x30120b[_0x46c1('0xa')](_0x46c1('0xb'),attributes,{'tableName':_0x46c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x806b=['./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2d061e,_0x8b97da){var _0x4d3b98=function(_0x1066a6){while(--_0x1066a6){_0x2d061e['push'](_0x2d061e['shift']());}};_0x4d3b98(++_0x8b97da);}(_0x806b,0x163));var _0xb806=function(_0x42192b,_0x15fcf9){_0x42192b=_0x42192b-0x0;var _0x4ecd1d=_0x806b[_0x42192b];return _0x4ecd1d;};'use strict';var _=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var logger=require(_0xb806('0x2'))(_0xb806('0x3'));var moment=require(_0xb806('0x4'));var BPromise=require(_0xb806('0x5'));var rp=require(_0xb806('0x6'));var fs=require('fs');var path=require(_0xb806('0x7'));var rimraf=require('rimraf');var config=require(_0xb806('0x8'));var attributes=require(_0xb806('0x9'));module[_0xb806('0xa')]=function(_0xc0353b,_0x52107e){return _0xc0353b[_0xb806('0xb')](_0xb806('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 70e4643..ac1f1c4 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 _0xc982=['catch','CreateSquareRecording','SquareRecording','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x3e5006,_0x83e367){var _0x507ddd=function(_0x31ee45){while(--_0x31ee45){_0x3e5006['push'](_0x3e5006['shift']());}};_0x507ddd(++_0x83e367);}(_0xc982,0x11d));var _0x2c98=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0xc982[_0x835cb7];return _0x3ef599;};'use strict';var _=require(_0x2c98('0x0'));var util=require(_0x2c98('0x1'));var moment=require(_0x2c98('0x2'));var BPromise=require(_0x2c98('0x3'));var rs=require(_0x2c98('0x4'));var fs=require('fs');var Redis=require(_0x2c98('0x5'));var db=require(_0x2c98('0x6'))['db'];var utils=require(_0x2c98('0x7'));var logger=require(_0x2c98('0x8'))(_0x2c98('0x9'));var config=require('../../config/environment');var jayson=require(_0x2c98('0xa'));var client=jayson[_0x2c98('0xb')][_0x2c98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x205441,_0x6cca76,_0x26c6d4){return new BPromise(function(_0x587f0b,_0x4297e4){return client[_0x2c98('0xd')](_0x205441,_0x26c6d4)[_0x2c98('0xe')](function(_0x529a74){logger[_0x2c98('0xf')](_0x2c98('0x10'),_0x6cca76,'request\x20sent');logger[_0x2c98('0x11')](_0x2c98('0x12'),_0x6cca76,_0x2c98('0x13'),JSON[_0x2c98('0x14')](_0x529a74));if(_0x529a74[_0x2c98('0x15')]){if(_0x529a74[_0x2c98('0x15')]['code']===0x1f4){logger[_0x2c98('0x15')](_0x2c98('0x10'),_0x6cca76,_0x529a74[_0x2c98('0x15')]['message']);return _0x4297e4(_0x529a74[_0x2c98('0x15')][_0x2c98('0x16')]);}logger[_0x2c98('0x15')](_0x2c98('0x10'),_0x6cca76,_0x529a74[_0x2c98('0x15')][_0x2c98('0x16')]);return _0x587f0b(_0x529a74[_0x2c98('0x15')]['message']);}else{logger[_0x2c98('0xf')](_0x2c98('0x10'),_0x6cca76,_0x2c98('0x13'));_0x587f0b(_0x529a74['result']['message']);}})[_0x2c98('0x17')](function(_0x12e80d){logger['error'](_0x2c98('0x10'),_0x6cca76,_0x12e80d);_0x4297e4(_0x12e80d);});});}exports[_0x2c98('0x18')]=function(_0x47efab){var _0x3e3f40=this;return new Promise(function(_0x16df5d,_0x17aefe){return db[_0x2c98('0x19')]['create'](_0x47efab['body'],{'raw':_0x47efab[_0x2c98('0x1a')]?_0x47efab[_0x2c98('0x1a')][_0x2c98('0x1b')]===undefined?!![]:![]:!![]})[_0x2c98('0xe')](function(_0x2031af){logger[_0x2c98('0xf')](_0x2c98('0x18'),_0x47efab);logger[_0x2c98('0x11')]('CreateSquareRecording',_0x47efab,JSON['stringify'](_0x2031af));_0x16df5d(_0x2031af);})[_0x2c98('0x17')](function(_0x27bc1c){logger[_0x2c98('0x15')](_0x2c98('0x18'),_0x27bc1c[_0x2c98('0x16')],_0x47efab);_0x17aefe(_0x3e3f40[_0x2c98('0x15')](0x1f4,_0x27bc1c[_0x2c98('0x16')]));});});}; \ No newline at end of file +var _0x5270=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x5270,0x1ba));var _0x0527=function(_0x2be5c9,_0x2d3846){_0x2be5c9=_0x2be5c9-0x0;var _0x18743a=_0x5270[_0x2be5c9];return _0x18743a;};'use strict';var _=require(_0x0527('0x0'));var util=require(_0x0527('0x1'));var moment=require(_0x0527('0x2'));var BPromise=require(_0x0527('0x3'));var rs=require(_0x0527('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0527('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0527('0x6'));var config=require(_0x0527('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0527('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x123501,_0x1e9dc9,_0x3e3099){return new BPromise(function(_0x36744b,_0x38cd2e){return client[_0x0527('0x9')](_0x123501,_0x3e3099)[_0x0527('0xa')](function(_0x316fd3){logger[_0x0527('0xb')](_0x0527('0xc'),_0x1e9dc9,_0x0527('0xd'));logger[_0x0527('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1e9dc9,'request\x20sent',JSON[_0x0527('0xf')](_0x316fd3));if(_0x316fd3['error']){if(_0x316fd3[_0x0527('0x10')][_0x0527('0x11')]===0x1f4){logger[_0x0527('0x10')](_0x0527('0xc'),_0x1e9dc9,_0x316fd3[_0x0527('0x10')][_0x0527('0x12')]);return _0x38cd2e(_0x316fd3[_0x0527('0x10')][_0x0527('0x12')]);}logger[_0x0527('0x10')]('SquareRecording,\x20%s,\x20%s',_0x1e9dc9,_0x316fd3['error'][_0x0527('0x12')]);return _0x36744b(_0x316fd3[_0x0527('0x10')][_0x0527('0x12')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x1e9dc9,_0x0527('0xd'));_0x36744b(_0x316fd3[_0x0527('0x13')]['message']);}})[_0x0527('0x14')](function(_0x31aa27){logger['error']('SquareRecording,\x20%s,\x20%s',_0x1e9dc9,_0x31aa27);_0x38cd2e(_0x31aa27);});});}exports[_0x0527('0x15')]=function(_0x109a79){var _0x5929e2=this;return new Promise(function(_0x58b1f7,_0x1e4c63){return db[_0x0527('0x16')][_0x0527('0x17')](_0x109a79[_0x0527('0x18')],{'raw':_0x109a79['options']?_0x109a79[_0x0527('0x19')][_0x0527('0x1a')]===undefined?!![]:![]:!![]})[_0x0527('0xa')](function(_0x1bf24e){logger[_0x0527('0xb')](_0x0527('0x15'),_0x109a79);logger['debug'](_0x0527('0x15'),_0x109a79,JSON['stringify'](_0x1bf24e));_0x58b1f7(_0x1bf24e);})[_0x0527('0x14')](function(_0xef6c50){logger[_0x0527('0x10')](_0x0527('0x15'),_0xef6c50[_0x0527('0x12')],_0x109a79);_0x1e4c63(_0x5929e2[_0x0527('0x10')](0x1f4,_0xef6c50[_0x0527('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6504f53..02fa112 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 _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(_0x57b57d,_0x1edfc8){var _0x348290=function(_0x154f2f){while(--_0x154f2f){_0x57b57d['push'](_0x57b57d['shift']());}};_0x348290(++_0x1edfc8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b822b6c..2731aee 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 _0x7d6f=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x1069be,_0x486ca6){var _0xd1a765=function(_0x1b3cba){while(--_0x1b3cba){_0x1069be['push'](_0x1069be['shift']());}};_0xd1a765(++_0x486ca6);}(_0x7d6f,0xf9));var _0xf7d6=function(_0x328fd2,_0x99c719){_0x328fd2=_0x328fd2-0x0;var _0x5d46f9=_0x7d6f[_0x328fd2];return _0x5d46f9;};'use strict';var Sequelize=require(_0xf7d6('0x0'));module['exports']={'network':{'type':Sequelize[_0xf7d6('0x1')]},'network_script':{'type':Sequelize[_0xf7d6('0x1')]},'request':{'type':Sequelize[_0xf7d6('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf7d6('0x1')]},'type':{'type':Sequelize[_0xf7d6('0x1')]},'uniqueid':{'type':Sequelize[_0xf7d6('0x1')]},'version':{'type':Sequelize[_0xf7d6('0x1')]},'callerid':{'type':Sequelize[_0xf7d6('0x1')]},'calleridname':{'type':Sequelize[_0xf7d6('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xf7d6('0x1')]},'callingtns':{'type':Sequelize[_0xf7d6('0x1')]},'dnid':{'type':Sequelize[_0xf7d6('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf7d6('0x1')]},'extension':{'type':Sequelize[_0xf7d6('0x1')]},'priority':{'type':Sequelize[_0xf7d6('0x1')]},'enhanced':{'type':Sequelize[_0xf7d6('0x1')]},'accountcode':{'type':Sequelize[_0xf7d6('0x1')]},'threadid':{'type':Sequelize[_0xf7d6('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf7d6('0x2')]},'leaveAt':{'type':Sequelize[_0xf7d6('0x2')]},'bot':{'type':Sequelize[_0xf7d6('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4689=['sequelize','STRING','DATE'];(function(_0x5a51bf,_0x2f00e3){var _0x1fbf27=function(_0x14f457){while(--_0x14f457){_0x5a51bf['push'](_0x5a51bf['shift']());}};_0x1fbf27(++_0x2f00e3);}(_0x4689,0xf9));var _0x9468=function(_0x2bb46f,_0xc37720){_0x2bb46f=_0x2bb46f-0x0;var _0x5b2a98=_0x4689[_0x2bb46f];return _0x5b2a98;};'use strict';var Sequelize=require(_0x9468('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x9468('0x1')]},'request':{'type':Sequelize[_0x9468('0x1')]},'channel':{'type':Sequelize[_0x9468('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9468('0x1')]},'uniqueid':{'type':Sequelize[_0x9468('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9468('0x1')]},'calleridname':{'type':Sequelize[_0x9468('0x1')]},'callingpres':{'type':Sequelize[_0x9468('0x1')]},'callingani2':{'type':Sequelize[_0x9468('0x1')]},'callington':{'type':Sequelize[_0x9468('0x1')]},'callingtns':{'type':Sequelize[_0x9468('0x1')]},'dnid':{'type':Sequelize[_0x9468('0x1')]},'rdnis':{'type':Sequelize[_0x9468('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9468('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9468('0x1')]},'accountcode':{'type':Sequelize[_0x9468('0x1')]},'threadid':{'type':Sequelize[_0x9468('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9468('0x2')]},'leaveAt':{'type':Sequelize[_0x9468('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index e44088b..2757fef 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 _0xf8f3=['params','keys','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','end','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show'];(function(_0x4dd21f,_0x1af4ed){var _0x3981e4=function(_0x3ecfe1){while(--_0x3ecfe1){_0x4dd21f['push'](_0x4dd21f['shift']());}};_0x3981e4(++_0x1af4ed);}(_0xf8f3,0x191));var _0x3f8f=function(_0x579307,_0x5df80e){_0x579307=_0x579307-0x0;var _0x561a6f=_0xf8f3[_0x579307];return _0x561a6f;};'use strict';var emlformat=require(_0x3f8f('0x0'));var rimraf=require(_0x3f8f('0x1'));var zipdir=require(_0x3f8f('0x2'));var jsonpatch=require(_0x3f8f('0x3'));var rp=require(_0x3f8f('0x4'));var moment=require(_0x3f8f('0x5'));var BPromise=require(_0x3f8f('0x6'));var Mustache=require(_0x3f8f('0x7'));var util=require(_0x3f8f('0x8'));var path=require(_0x3f8f('0x9'));var sox=require(_0x3f8f('0xa'));var csv=require(_0x3f8f('0xb'));var ejs=require(_0x3f8f('0xc'));var fs=require('fs');var fs_extra=require(_0x3f8f('0xd'));var _=require(_0x3f8f('0xe'));var squel=require(_0x3f8f('0xf'));var crypto=require(_0x3f8f('0x10'));var jsforce=require(_0x3f8f('0x11'));var deskjs=require(_0x3f8f('0x12'));var toCsv=require(_0x3f8f('0xb'));var querystring=require(_0x3f8f('0x13'));var Papa=require(_0x3f8f('0x14'));var Redis=require(_0x3f8f('0x15'));var authService=require(_0x3f8f('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x3f8f('0x17'));var hardwareService=require(_0x3f8f('0x18'));var logger=require(_0x3f8f('0x19'))(_0x3f8f('0x1a'));var utils=require(_0x3f8f('0x1b'));var config=require(_0x3f8f('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f8f('0x1d'))['db'];function respondWithStatusCode(_0x33c543,_0xff5d5c){_0xff5d5c=_0xff5d5c||0xcc;return function(_0x35a72e){if(_0x35a72e){return _0x33c543[_0x3f8f('0x1e')](_0xff5d5c);}return _0x33c543['status'](_0xff5d5c)['end']();};}function respondWithResult(_0x85daf2,_0x1ec575){_0x1ec575=_0x1ec575||0xc8;return function(_0x4bb630){if(_0x4bb630){return _0x85daf2[_0x3f8f('0x1f')](_0x1ec575)['json'](_0x4bb630);}};}function respondWithFilteredResult(_0x52521e,_0xd6f07d){return function(_0x5f2c42){if(_0x5f2c42){var _0x4aac57=typeof _0xd6f07d[_0x3f8f('0x20')]===_0x3f8f('0x21')&&typeof _0xd6f07d[_0x3f8f('0x22')]===_0x3f8f('0x21');var _0xf192a4=_0x5f2c42[_0x3f8f('0x23')];var _0x172c9d=_0x4aac57?0x0:_0xd6f07d['offset'];var _0x26b6a9=_0x4aac57?_0x5f2c42[_0x3f8f('0x23')]:_0xd6f07d[_0x3f8f('0x20')]+_0xd6f07d[_0x3f8f('0x22')];var _0x347b3a;if(_0x26b6a9>=_0xf192a4){_0x26b6a9=_0xf192a4;_0x347b3a=0xc8;}else{_0x347b3a=0xce;}_0x52521e[_0x3f8f('0x1f')](_0x347b3a);return _0x52521e[_0x3f8f('0x24')]('Content-Range',_0x172c9d+'-'+_0x26b6a9+'/'+_0xf192a4)[_0x3f8f('0x25')](_0x5f2c42);}return null;};}function patchUpdates(_0x12535b){return function(_0x3af649){try{jsonpatch[_0x3f8f('0x26')](_0x3af649,_0x12535b,!![]);}catch(_0x9c9c9f){return BPromise['reject'](_0x9c9c9f);}return _0x3af649['save']();};}function saveUpdates(_0x5d2f4c,_0x512410){return function(_0x1b3a4d){if(_0x1b3a4d){return _0x1b3a4d[_0x3f8f('0x27')](_0x5d2f4c)[_0x3f8f('0x28')](function(_0x2459f0){return _0x2459f0;});}return null;};}function removeEntity(_0x375235,_0x778ac7){return function(_0x46c2c5){if(_0x46c2c5){return _0x46c2c5[_0x3f8f('0x29')]()[_0x3f8f('0x28')](function(){_0x375235['status'](0xcc)[_0x3f8f('0x2a')]();});}};}function handleEntityNotFound(_0x31559c,_0x3ceb57){return function(_0x485ed0){if(!_0x485ed0){_0x31559c[_0x3f8f('0x1e')](0x194);}return _0x485ed0;};}function handleError(_0x17356b,_0x59ba41){_0x59ba41=_0x59ba41||0x1f4;return function(_0x10a229){logger[_0x3f8f('0x2b')](_0x10a229['stack']);if(_0x10a229[_0x3f8f('0x2c')]){delete _0x10a229[_0x3f8f('0x2c')];}_0x17356b[_0x3f8f('0x1f')](_0x59ba41)[_0x3f8f('0x2d')](_0x10a229);};}exports[_0x3f8f('0x2e')]=function(_0x493d18,_0x209f98){var _0x1e268d={},_0x1027b1={},_0x352641={'count':0x0,'rows':[]};var _0x1e4fd8=_[_0x3f8f('0x2f')](db[_0x3f8f('0x30')][_0x3f8f('0x31')],function(_0x4ba9ea){return{'name':_0x4ba9ea[_0x3f8f('0x32')],'type':_0x4ba9ea[_0x3f8f('0x33')][_0x3f8f('0x34')]};});_0x1027b1['model']=_[_0x3f8f('0x2f')](_0x1e4fd8,_0x3f8f('0x2c'));_0x1027b1[_0x3f8f('0x35')]=_['keys'](_0x493d18[_0x3f8f('0x35')]);_0x1027b1[_0x3f8f('0x36')]=_[_0x3f8f('0x37')](_0x1027b1[_0x3f8f('0x38')],_0x1027b1[_0x3f8f('0x35')]);_0x1e268d[_0x3f8f('0x39')]=_[_0x3f8f('0x37')](_0x1027b1[_0x3f8f('0x38')],qs[_0x3f8f('0x3a')](_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3a')]));_0x1e268d[_0x3f8f('0x39')]=_0x1e268d['attributes'][_0x3f8f('0x3b')]?_0x1e268d[_0x3f8f('0x39')]:_0x1027b1[_0x3f8f('0x38')];if(!_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3c')](_0x3f8f('0x3d'))){_0x1e268d[_0x3f8f('0x22')]=qs[_0x3f8f('0x22')](_0x493d18[_0x3f8f('0x35')]['limit']);_0x1e268d[_0x3f8f('0x20')]=qs[_0x3f8f('0x20')](_0x493d18['query'][_0x3f8f('0x20')]);}_0x1e268d[_0x3f8f('0x3e')]=qs[_0x3f8f('0x3f')](_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3f')]);_0x1e268d['where']=qs[_0x3f8f('0x36')](_['pick'](_0x493d18[_0x3f8f('0x35')],_0x1027b1['filters']),_0x1e4fd8);if(_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x40')]){_0x1e268d[_0x3f8f('0x41')]=_[_0x3f8f('0x42')](_0x1e268d['where'],{'$or':_['map'](_0x1e4fd8,function(_0x3222cd){if(_0x3222cd[_0x3f8f('0x33')]!=='VIRTUAL'){var _0x35ad41={};_0x35ad41[_0x3222cd[_0x3f8f('0x2c')]]={'$like':'%'+_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x40')]+'%'};return _0x35ad41;}})});}_0x1e268d=_[_0x3f8f('0x42')]({},_0x1e268d,_0x493d18[_0x3f8f('0x43')]);var _0x124c95={'where':_0x1e268d['where']};return db[_0x3f8f('0x30')]['count'](_0x124c95)[_0x3f8f('0x28')](function(_0x5691a3){_0x352641[_0x3f8f('0x23')]=_0x5691a3;if(_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x44')]){_0x1e268d[_0x3f8f('0x45')]=[{'all':!![]}];}return db[_0x3f8f('0x30')][_0x3f8f('0x46')](_0x1e268d);})[_0x3f8f('0x28')](function(_0x4e0ed2){_0x352641[_0x3f8f('0x47')]=_0x4e0ed2;return _0x352641;})[_0x3f8f('0x28')](respondWithFilteredResult(_0x209f98,_0x1e268d))['catch'](handleError(_0x209f98,null));};exports[_0x3f8f('0x48')]=function(_0x368107,_0x1d4ecc){var _0x5a7ace={'raw':!![],'where':{'id':_0x368107[_0x3f8f('0x49')]['id']}},_0x1ef161={};_0x1ef161[_0x3f8f('0x38')]=_[_0x3f8f('0x4a')](db[_0x3f8f('0x30')][_0x3f8f('0x31')]);_0x1ef161[_0x3f8f('0x35')]=_[_0x3f8f('0x4a')](_0x368107['query']);_0x1ef161[_0x3f8f('0x36')]=_[_0x3f8f('0x37')](_0x1ef161[_0x3f8f('0x38')],_0x1ef161[_0x3f8f('0x35')]);_0x5a7ace[_0x3f8f('0x39')]=_[_0x3f8f('0x37')](_0x1ef161[_0x3f8f('0x38')],qs[_0x3f8f('0x3a')](_0x368107[_0x3f8f('0x35')][_0x3f8f('0x3a')]));_0x5a7ace[_0x3f8f('0x39')]=_0x5a7ace[_0x3f8f('0x39')]['length']?_0x5a7ace[_0x3f8f('0x39')]:_0x1ef161[_0x3f8f('0x38')];if(_0x368107[_0x3f8f('0x35')]['includeAll']){_0x5a7ace[_0x3f8f('0x45')]=[{'all':!![]}];}_0x5a7ace=_[_0x3f8f('0x42')]({},_0x5a7ace,_0x368107[_0x3f8f('0x43')]);return db[_0x3f8f('0x30')]['find'](_0x5a7ace)[_0x3f8f('0x28')](handleEntityNotFound(_0x1d4ecc,null))['then'](respondWithResult(_0x1d4ecc,null))[_0x3f8f('0x4b')](handleError(_0x1d4ecc,null));};exports[_0x3f8f('0x4c')]=function(_0x45cc83,_0x29febb){return db[_0x3f8f('0x30')]['create'](_0x45cc83[_0x3f8f('0x4d')],{})[_0x3f8f('0x28')](respondWithResult(_0x29febb,0xc9))[_0x3f8f('0x4b')](handleError(_0x29febb,null));};exports[_0x3f8f('0x27')]=function(_0x32aefd,_0x1769a7){if(_0x32aefd[_0x3f8f('0x4d')]['id']){delete _0x32aefd['body']['id'];}return db[_0x3f8f('0x30')][_0x3f8f('0x4e')]({'where':{'id':_0x32aefd[_0x3f8f('0x49')]['id']}})[_0x3f8f('0x28')](handleEntityNotFound(_0x1769a7,null))[_0x3f8f('0x28')](saveUpdates(_0x32aefd[_0x3f8f('0x4d')],null))['then'](respondWithResult(_0x1769a7,null))['catch'](handleError(_0x1769a7,null));};exports[_0x3f8f('0x29')]=function(_0x3a926c,_0x4ba8b3){return db[_0x3f8f('0x30')][_0x3f8f('0x4e')]({'where':{'id':_0x3a926c[_0x3f8f('0x49')]['id']}})[_0x3f8f('0x28')](handleEntityNotFound(_0x4ba8b3,null))['then'](removeEntity(_0x4ba8b3,null))[_0x3f8f('0x4b')](handleError(_0x4ba8b3,null));};exports['describe']=function(_0x1c3e3d,_0x316fdc){return db['SquareReport']['describe']()['then'](respondWithResult(_0x316fdc,null))[_0x3f8f('0x4b')](handleError(_0x316fdc,null));}; \ No newline at end of file +var _0xf078=['request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch'];(function(_0x53daa0,_0x1000a6){var _0x1231cb=function(_0xeb95a7){while(--_0xeb95a7){_0x53daa0['push'](_0x53daa0['shift']());}};_0x1231cb(++_0x1000a6);}(_0xf078,0x12d));var _0x8f07=function(_0x114aee,_0x2d56bb){_0x114aee=_0x114aee-0x0;var _0x2ac8b6=_0xf078[_0x114aee];return _0x2ac8b6;};'use strict';var emlformat=require(_0x8f07('0x0'));var rimraf=require(_0x8f07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f07('0x2'));var rp=require(_0x8f07('0x3'));var moment=require(_0x8f07('0x4'));var BPromise=require(_0x8f07('0x5'));var Mustache=require(_0x8f07('0x6'));var util=require(_0x8f07('0x7'));var path=require(_0x8f07('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f07('0x9'));var fs=require('fs');var fs_extra=require(_0x8f07('0xa'));var _=require(_0x8f07('0xb'));var squel=require('squel');var crypto=require(_0x8f07('0xc'));var jsforce=require(_0x8f07('0xd'));var deskjs=require(_0x8f07('0xe'));var toCsv=require(_0x8f07('0xf'));var querystring=require(_0x8f07('0x10'));var Papa=require(_0x8f07('0x11'));var Redis=require(_0x8f07('0x12'));var authService=require(_0x8f07('0x13'));var qs=require(_0x8f07('0x14'));var as=require(_0x8f07('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f07('0x16'));var utils=require(_0x8f07('0x17'));var config=require(_0x8f07('0x18'));var licenseUtil=require(_0x8f07('0x19'));var db=require(_0x8f07('0x1a'))['db'];function respondWithStatusCode(_0x506faa,_0x475754){_0x475754=_0x475754||0xcc;return function(_0x348d53){if(_0x348d53){return _0x506faa['sendStatus'](_0x475754);}return _0x506faa[_0x8f07('0x1b')](_0x475754)[_0x8f07('0x1c')]();};}function respondWithResult(_0x3f48ca,_0x2b15a5){_0x2b15a5=_0x2b15a5||0xc8;return function(_0x1d8e3d){if(_0x1d8e3d){return _0x3f48ca[_0x8f07('0x1b')](_0x2b15a5)['json'](_0x1d8e3d);}};}function respondWithFilteredResult(_0x5104cc,_0x25add9){return function(_0xc10502){if(_0xc10502){var _0x406878=typeof _0x25add9['offset']===_0x8f07('0x1d')&&typeof _0x25add9[_0x8f07('0x1e')]===_0x8f07('0x1d');var _0x5bdcae=_0xc10502[_0x8f07('0x1f')];var _0x4d7584=_0x406878?0x0:_0x25add9[_0x8f07('0x20')];var _0x5f227d=_0x406878?_0xc10502[_0x8f07('0x1f')]:_0x25add9[_0x8f07('0x20')]+_0x25add9['limit'];var _0x5f2326;if(_0x5f227d>=_0x5bdcae){_0x5f227d=_0x5bdcae;_0x5f2326=0xc8;}else{_0x5f2326=0xce;}_0x5104cc[_0x8f07('0x1b')](_0x5f2326);return _0x5104cc[_0x8f07('0x21')](_0x8f07('0x22'),_0x4d7584+'-'+_0x5f227d+'/'+_0x5bdcae)['json'](_0xc10502);}return null;};}function patchUpdates(_0x313b64){return function(_0x1c63c8){try{jsonpatch[_0x8f07('0x23')](_0x1c63c8,_0x313b64,!![]);}catch(_0x40c7bf){return BPromise[_0x8f07('0x24')](_0x40c7bf);}return _0x1c63c8[_0x8f07('0x25')]();};}function saveUpdates(_0x544784,_0x627d05){return function(_0x14fb35){if(_0x14fb35){return _0x14fb35[_0x8f07('0x26')](_0x544784)[_0x8f07('0x27')](function(_0xf000de){return _0xf000de;});}return null;};}function removeEntity(_0xe4a7b,_0x1b3aad){return function(_0x2ab0ca){if(_0x2ab0ca){return _0x2ab0ca[_0x8f07('0x28')]()[_0x8f07('0x27')](function(){_0xe4a7b[_0x8f07('0x1b')](0xcc)[_0x8f07('0x1c')]();});}};}function handleEntityNotFound(_0x6ff530,_0x449dcc){return function(_0x5992c6){if(!_0x5992c6){_0x6ff530['sendStatus'](0x194);}return _0x5992c6;};}function handleError(_0x3fa8dd,_0x22aed7){_0x22aed7=_0x22aed7||0x1f4;return function(_0x5fbe69){logger[_0x8f07('0x29')](_0x5fbe69[_0x8f07('0x2a')]);if(_0x5fbe69[_0x8f07('0x2b')]){delete _0x5fbe69[_0x8f07('0x2b')];}_0x3fa8dd[_0x8f07('0x1b')](_0x22aed7)[_0x8f07('0x2c')](_0x5fbe69);};}exports['index']=function(_0x6504d7,_0x48255f){var _0x16b9be={},_0x5c99ec={},_0x4db5b9={'count':0x0,'rows':[]};var _0x41a9df=_[_0x8f07('0x2d')](db[_0x8f07('0x2e')][_0x8f07('0x2f')],function(_0x4e58ee){return{'name':_0x4e58ee[_0x8f07('0x30')],'type':_0x4e58ee['type'][_0x8f07('0x31')]};});_0x5c99ec[_0x8f07('0x32')]=_[_0x8f07('0x2d')](_0x41a9df,'name');_0x5c99ec['query']=_[_0x8f07('0x33')](_0x6504d7[_0x8f07('0x34')]);_0x5c99ec[_0x8f07('0x35')]=_[_0x8f07('0x36')](_0x5c99ec[_0x8f07('0x32')],_0x5c99ec[_0x8f07('0x34')]);_0x16b9be[_0x8f07('0x37')]=_[_0x8f07('0x36')](_0x5c99ec[_0x8f07('0x32')],qs['fields'](_0x6504d7[_0x8f07('0x34')][_0x8f07('0x38')]));_0x16b9be['attributes']=_0x16b9be[_0x8f07('0x37')][_0x8f07('0x39')]?_0x16b9be[_0x8f07('0x37')]:_0x5c99ec['model'];if(!_0x6504d7[_0x8f07('0x34')][_0x8f07('0x3a')](_0x8f07('0x3b'))){_0x16b9be['limit']=qs[_0x8f07('0x1e')](_0x6504d7['query'][_0x8f07('0x1e')]);_0x16b9be[_0x8f07('0x20')]=qs[_0x8f07('0x20')](_0x6504d7[_0x8f07('0x34')][_0x8f07('0x20')]);}_0x16b9be[_0x8f07('0x3c')]=qs[_0x8f07('0x3d')](_0x6504d7['query']['sort']);_0x16b9be[_0x8f07('0x3e')]=qs[_0x8f07('0x35')](_[_0x8f07('0x3f')](_0x6504d7[_0x8f07('0x34')],_0x5c99ec['filters']),_0x41a9df);if(_0x6504d7[_0x8f07('0x34')][_0x8f07('0x40')]){_0x16b9be[_0x8f07('0x3e')]=_[_0x8f07('0x41')](_0x16b9be[_0x8f07('0x3e')],{'$or':_['map'](_0x41a9df,function(_0x16a580){if(_0x16a580['type']!=='VIRTUAL'){var _0x68c3ca={};_0x68c3ca[_0x16a580[_0x8f07('0x2b')]]={'$like':'%'+_0x6504d7['query'][_0x8f07('0x40')]+'%'};return _0x68c3ca;}})});}_0x16b9be=_[_0x8f07('0x41')]({},_0x16b9be,_0x6504d7[_0x8f07('0x42')]);var _0x52c790={'where':_0x16b9be[_0x8f07('0x3e')]};return db['SquareReport']['count'](_0x52c790)[_0x8f07('0x27')](function(_0x177af2){_0x4db5b9['count']=_0x177af2;if(_0x6504d7[_0x8f07('0x34')][_0x8f07('0x43')]){_0x16b9be['include']=[{'all':!![]}];}return db[_0x8f07('0x2e')][_0x8f07('0x44')](_0x16b9be);})[_0x8f07('0x27')](function(_0x36b872){_0x4db5b9['rows']=_0x36b872;return _0x4db5b9;})[_0x8f07('0x27')](respondWithFilteredResult(_0x48255f,_0x16b9be))[_0x8f07('0x45')](handleError(_0x48255f,null));};exports['show']=function(_0x464f8e,_0x58cdf0){var _0x449a9a={'raw':!![],'where':{'id':_0x464f8e['params']['id']}},_0x5c214f={};_0x5c214f['model']=_[_0x8f07('0x33')](db[_0x8f07('0x2e')][_0x8f07('0x2f')]);_0x5c214f[_0x8f07('0x34')]=_[_0x8f07('0x33')](_0x464f8e[_0x8f07('0x34')]);_0x5c214f['filters']=_[_0x8f07('0x36')](_0x5c214f[_0x8f07('0x32')],_0x5c214f[_0x8f07('0x34')]);_0x449a9a[_0x8f07('0x37')]=_[_0x8f07('0x36')](_0x5c214f[_0x8f07('0x32')],qs['fields'](_0x464f8e[_0x8f07('0x34')]['fields']));_0x449a9a[_0x8f07('0x37')]=_0x449a9a[_0x8f07('0x37')][_0x8f07('0x39')]?_0x449a9a[_0x8f07('0x37')]:_0x5c214f[_0x8f07('0x32')];if(_0x464f8e[_0x8f07('0x34')][_0x8f07('0x43')]){_0x449a9a[_0x8f07('0x46')]=[{'all':!![]}];}_0x449a9a=_[_0x8f07('0x41')]({},_0x449a9a,_0x464f8e['options']);return db[_0x8f07('0x2e')][_0x8f07('0x47')](_0x449a9a)[_0x8f07('0x27')](handleEntityNotFound(_0x58cdf0,null))['then'](respondWithResult(_0x58cdf0,null))[_0x8f07('0x45')](handleError(_0x58cdf0,null));};exports[_0x8f07('0x48')]=function(_0x502f43,_0x4ff656){return db[_0x8f07('0x2e')]['create'](_0x502f43['body'],{})['then'](respondWithResult(_0x4ff656,0xc9))[_0x8f07('0x45')](handleError(_0x4ff656,null));};exports['update']=function(_0x22b4e6,_0x1262cd){if(_0x22b4e6[_0x8f07('0x49')]['id']){delete _0x22b4e6['body']['id'];}return db['SquareReport'][_0x8f07('0x47')]({'where':{'id':_0x22b4e6[_0x8f07('0x4a')]['id']}})[_0x8f07('0x27')](handleEntityNotFound(_0x1262cd,null))[_0x8f07('0x27')](saveUpdates(_0x22b4e6[_0x8f07('0x49')],null))['then'](respondWithResult(_0x1262cd,null))[_0x8f07('0x45')](handleError(_0x1262cd,null));};exports[_0x8f07('0x28')]=function(_0x4d3dad,_0x85ff33){return db[_0x8f07('0x2e')]['find']({'where':{'id':_0x4d3dad[_0x8f07('0x4a')]['id']}})[_0x8f07('0x27')](handleEntityNotFound(_0x85ff33,null))[_0x8f07('0x27')](removeEntity(_0x85ff33,null))[_0x8f07('0x45')](handleError(_0x85ff33,null));};exports[_0x8f07('0x4b')]=function(_0xcf9a55,_0x5c1d65){return db['SquareReport']['describe']()[_0x8f07('0x27')](respondWithResult(_0x5c1d65,null))['catch'](handleError(_0x5c1d65,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1645940..841392b 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 _0xaab0=['./squareReport.attributes','define','SquareReport','uid_pname','project_name','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x27e868,_0xa52d2a){var _0x4a9b8a=function(_0x32abfd){while(--_0x32abfd){_0x27e868['push'](_0x27e868['shift']());}};_0x4a9b8a(++_0xa52d2a);}(_0xaab0,0xc5));var _0x0aab=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xaab0[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x0aab('0x0'));var util=require(_0x0aab('0x1'));var logger=require(_0x0aab('0x2'))('api');var moment=require(_0x0aab('0x3'));var BPromise=require('bluebird');var rp=require(_0x0aab('0x4'));var fs=require('fs');var path=require(_0x0aab('0x5'));var rimraf=require('rimraf');var config=require(_0x0aab('0x6'));var attributes=require(_0x0aab('0x7'));module['exports']=function(_0x3bd34a,_0x11c36e){return _0x3bd34a[_0x0aab('0x8')](_0x0aab('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x0aab('0xa'),'fields':['uniqueid',_0x0aab('0xb')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfc1=['api','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger'];(function(_0x518f10,_0x131b94){var _0x237a0f=function(_0x26a451){while(--_0x26a451){_0x518f10['push'](_0x518f10['shift']());}};_0x237a0f(++_0x131b94);}(_0xcfc1,0x1ed));var _0x1cfc=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xcfc1[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0x1cfc('0x0'));var logger=require(_0x1cfc('0x1'))(_0x1cfc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cfc('0x3'));var fs=require('fs');var path=require(_0x1cfc('0x4'));var rimraf=require(_0x1cfc('0x5'));var config=require(_0x1cfc('0x6'));var attributes=require(_0x1cfc('0x7'));module['exports']=function(_0x492821,_0x2e5230){return _0x492821[_0x1cfc('0x8')](_0x1cfc('0x9'),attributes,{'tableName':_0x1cfc('0xa'),'paranoid':![],'indexes':[{'name':_0x1cfc('0xb'),'fields':[_0x1cfc('0xc'),_0x1cfc('0xd')]},{'name':_0x1cfc('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 72a89ac..c03ded0 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 _0x47a2=['raw','then','debug','stringify','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSquareReport','SquareReport','options'];(function(_0x4652e2,_0x51f2cd){var _0x2cf96b=function(_0x5dfbf6){while(--_0x5dfbf6){_0x4652e2['push'](_0x4652e2['shift']());}};_0x2cf96b(++_0x51f2cd);}(_0x47a2,0x12a));var _0x247a=function(_0x3a6a37,_0x30743f){_0x3a6a37=_0x3a6a37-0x0;var _0xd802a8=_0x47a2[_0x3a6a37];return _0xd802a8;};'use strict';var _=require(_0x247a('0x0'));var util=require(_0x247a('0x1'));var moment=require(_0x247a('0x2'));var BPromise=require(_0x247a('0x3'));var rs=require(_0x247a('0x4'));var fs=require('fs');var Redis=require(_0x247a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x247a('0x6'))('rpc');var config=require(_0x247a('0x7'));var jayson=require(_0x247a('0x8'));var client=jayson[_0x247a('0x9')][_0x247a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247c99,_0x14cf15,_0x3639cb){return new BPromise(function(_0x2671bf,_0x504e29){return client[_0x247a('0xb')](_0x247c99,_0x3639cb)['then'](function(_0x2e3b5a){logger[_0x247a('0xc')](_0x247a('0xd'),_0x14cf15,_0x247a('0xe'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x14cf15,_0x247a('0xe'),JSON['stringify'](_0x2e3b5a));if(_0x2e3b5a[_0x247a('0xf')]){if(_0x2e3b5a[_0x247a('0xf')][_0x247a('0x10')]===0x1f4){logger['error'](_0x247a('0xd'),_0x14cf15,_0x2e3b5a['error'][_0x247a('0x11')]);return _0x504e29(_0x2e3b5a['error'][_0x247a('0x11')]);}logger['error'](_0x247a('0xd'),_0x14cf15,_0x2e3b5a[_0x247a('0xf')][_0x247a('0x11')]);return _0x2671bf(_0x2e3b5a['error'][_0x247a('0x11')]);}else{logger[_0x247a('0xc')](_0x247a('0xd'),_0x14cf15,'request\x20sent');_0x2671bf(_0x2e3b5a['result'][_0x247a('0x11')]);}})[_0x247a('0x12')](function(_0x42a59d){logger[_0x247a('0xf')](_0x247a('0xd'),_0x14cf15,_0x42a59d);_0x504e29(_0x42a59d);});});}exports[_0x247a('0x13')]=function(_0x5ad4a3){var _0x51974d=this;return new Promise(function(_0x177544,_0x1d5f0a){return db[_0x247a('0x14')]['create'](_0x5ad4a3['body'],{'raw':_0x5ad4a3[_0x247a('0x15')]?_0x5ad4a3['options'][_0x247a('0x16')]===undefined?!![]:![]:!![]})[_0x247a('0x17')](function(_0x2a3af2){logger[_0x247a('0xc')](_0x247a('0x13'),_0x5ad4a3);logger[_0x247a('0x18')](_0x247a('0x13'),_0x5ad4a3,JSON[_0x247a('0x19')](_0x2a3af2));_0x177544(_0x2a3af2);})['catch'](function(_0xf8a2c3){logger[_0x247a('0xf')](_0x247a('0x13'),_0xf8a2c3[_0x247a('0x11')],_0x5ad4a3);_0x1d5f0a(_0x51974d[_0x247a('0xf')](0x1f4,_0xf8a2c3[_0x247a('0x11')]));});});};exports[_0x247a('0x1a')]=function(_0xcde5c1){var _0x2f1446=this;return new Promise(function(_0x2de424,_0x370876){return db[_0x247a('0x14')][_0x247a('0x1b')](_0xcde5c1[_0x247a('0x1c')],{'raw':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1[_0x247a('0x15')][_0x247a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcde5c1['options']?_0xcde5c1[_0x247a('0x15')][_0x247a('0x1d')]||null:null,'attributes':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1['options'][_0x247a('0x1e')]||null:null,'limit':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1[_0x247a('0x15')][_0x247a('0x1f')]||null:null})[_0x247a('0x17')](function(_0x4569d8){logger['info'](_0x247a('0x1a'),_0xcde5c1);logger[_0x247a('0x18')]('UpdateSquareReport',_0xcde5c1,JSON[_0x247a('0x19')](_0x4569d8));_0x2de424(_0x4569d8);})[_0x247a('0x12')](function(_0x558773){logger[_0x247a('0xf')]('UpdateSquareReport',_0x558773[_0x247a('0x11')],_0xcde5c1);_0x370876(_0x2f1446[_0x247a('0xf')](0x1f4,_0x558773[_0x247a('0x11')]));});});}; \ No newline at end of file +var _0xc818=['stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','body','options','raw','catch','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ec7d5,_0xe09e2a){var _0x284b15=function(_0x496641){while(--_0x496641){_0x3ec7d5['push'](_0x3ec7d5['shift']());}};_0x284b15(++_0xe09e2a);}(_0xc818,0xa6));var _0x8c81=function(_0x4d8231,_0x1b9d15){_0x4d8231=_0x4d8231-0x0;var _0x1be4e2=_0xc818[_0x4d8231];return _0x1be4e2;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require(_0x8c81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c81('0x5'));var logger=require('../../config/logger')(_0x8c81('0x6'));var config=require(_0x8c81('0x7'));var jayson=require(_0x8c81('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4254db,_0x597e22,_0x2e5778){return new BPromise(function(_0x4e0fe1,_0x10f649){return client[_0x8c81('0x9')](_0x4254db,_0x2e5778)[_0x8c81('0xa')](function(_0x499ae5){logger[_0x8c81('0xb')]('SquareReport,\x20%s,\x20%s',_0x597e22,'request\x20sent');logger[_0x8c81('0xc')](_0x8c81('0xd'),_0x597e22,'request\x20sent',JSON[_0x8c81('0xe')](_0x499ae5));if(_0x499ae5[_0x8c81('0xf')]){if(_0x499ae5[_0x8c81('0xf')][_0x8c81('0x10')]===0x1f4){logger[_0x8c81('0xf')](_0x8c81('0x11'),_0x597e22,_0x499ae5['error'][_0x8c81('0x12')]);return _0x10f649(_0x499ae5[_0x8c81('0xf')][_0x8c81('0x12')]);}logger[_0x8c81('0xf')]('SquareReport,\x20%s,\x20%s',_0x597e22,_0x499ae5[_0x8c81('0xf')]['message']);return _0x4e0fe1(_0x499ae5[_0x8c81('0xf')][_0x8c81('0x12')]);}else{logger['info'](_0x8c81('0x11'),_0x597e22,'request\x20sent');_0x4e0fe1(_0x499ae5[_0x8c81('0x13')][_0x8c81('0x12')]);}})['catch'](function(_0x2ca420){logger[_0x8c81('0xf')](_0x8c81('0x11'),_0x597e22,_0x2ca420);_0x10f649(_0x2ca420);});});}exports[_0x8c81('0x14')]=function(_0x4e2f55){var _0x3e7245=this;return new Promise(function(_0xaaafa,_0x54e9f1){return db['SquareReport']['create'](_0x4e2f55[_0x8c81('0x15')],{'raw':_0x4e2f55['options']?_0x4e2f55[_0x8c81('0x16')][_0x8c81('0x17')]===undefined?!![]:![]:!![]})[_0x8c81('0xa')](function(_0x295078){logger[_0x8c81('0xb')](_0x8c81('0x14'),_0x4e2f55);logger[_0x8c81('0xc')]('CreateSquareReport',_0x4e2f55,JSON[_0x8c81('0xe')](_0x295078));_0xaaafa(_0x295078);})[_0x8c81('0x18')](function(_0x4128f4){logger[_0x8c81('0xf')](_0x8c81('0x14'),_0x4128f4['message'],_0x4e2f55);_0x54e9f1(_0x3e7245[_0x8c81('0xf')](0x1f4,_0x4128f4['message']));});});};exports[_0x8c81('0x19')]=function(_0x2af769){var _0x44b3d2=this;return new Promise(function(_0x22df7b,_0x54a4ec){return db[_0x8c81('0x1a')]['update'](_0x2af769['body'],{'raw':_0x2af769[_0x8c81('0x16')]?_0x2af769[_0x8c81('0x16')][_0x8c81('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af769[_0x8c81('0x16')]?_0x2af769[_0x8c81('0x16')][_0x8c81('0x1b')]||null:null,'attributes':_0x2af769['options']?_0x2af769[_0x8c81('0x16')][_0x8c81('0x1c')]||null:null,'limit':_0x2af769[_0x8c81('0x16')]?_0x2af769['options'][_0x8c81('0x1d')]||null:null})[_0x8c81('0xa')](function(_0x454b9b){logger[_0x8c81('0xb')]('UpdateSquareReport',_0x2af769);logger[_0x8c81('0xc')](_0x8c81('0x19'),_0x2af769,JSON[_0x8c81('0xe')](_0x454b9b));_0x22df7b(_0x454b9b);})[_0x8c81('0x18')](function(_0x9b5815){logger[_0x8c81('0xf')](_0x8c81('0x19'),_0x9b5815[_0x8c81('0x12')],_0x2af769);_0x54a4ec(_0x44b3d2['error'](0x1f4,_0x9b5815['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 36beaa1..26645bc 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 _0xc0e7=['post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5759b5,_0x3ae4cf){var _0x1cdf60=function(_0x21345c){while(--_0x21345c){_0x5759b5['push'](_0x5759b5['shift']());}};_0x1cdf60(++_0x3ae4cf);}(_0xc0e7,0xa7));var _0x7c0e=function(_0x1b65f1,_0x1d91f0){_0x1b65f1=_0x1b65f1-0x0;var _0x4add6d=_0xc0e7[_0x1b65f1];return _0x4add6d;};'use strict';var multer=require(_0x7c0e('0x0'));var util=require(_0x7c0e('0x1'));var path=require('path');var timeout=require(_0x7c0e('0x2'));var express=require(_0x7c0e('0x3'));var router=express[_0x7c0e('0x4')]();var fs_extra=require(_0x7c0e('0x5'));var auth=require(_0x7c0e('0x6'));var interaction=require(_0x7c0e('0x7'));var config=require(_0x7c0e('0x8'));var controller=require(_0x7c0e('0x9'));router[_0x7c0e('0xa')]('/',auth[_0x7c0e('0xb')](),controller[_0x7c0e('0xc')]);router[_0x7c0e('0xa')](_0x7c0e('0xd'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0xe')]);router[_0x7c0e('0xa')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x10')]);router[_0x7c0e('0x11')]('/',auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x12')]);router[_0x7c0e('0x13')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x14')]);router[_0x7c0e('0x15')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb3a1=['/describe','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get'];(function(_0x545ddd,_0x3b47ce){var _0x4c77b5=function(_0x377d70){while(--_0x377d70){_0x545ddd['push'](_0x545ddd['shift']());}};_0x4c77b5(++_0x3b47ce);}(_0xb3a1,0xb4));var _0x1b3a=function(_0x256d97,_0x17b56d){_0x256d97=_0x256d97-0x0;var _0x487ee1=_0xb3a1[_0x256d97];return _0x487ee1;};'use strict';var multer=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var path=require(_0x1b3a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b3a('0x3')]();var fs_extra=require(_0x1b3a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1b3a('0x5'));var config=require('../../config/environment');var controller=require(_0x1b3a('0x6'));router['get']('/',auth[_0x1b3a('0x7')](),controller[_0x1b3a('0x8')]);router[_0x1b3a('0x9')](_0x1b3a('0xa'),auth[_0x1b3a('0x7')](),controller[_0x1b3a('0xb')]);router['get'](_0x1b3a('0xc'),auth['isAuthenticated'](),controller[_0x1b3a('0xd')]);router[_0x1b3a('0xe')]('/',auth[_0x1b3a('0x7')](),controller['create']);router[_0x1b3a('0xf')](_0x1b3a('0xc'),auth[_0x1b3a('0x7')](),controller[_0x1b3a('0x10')]);router[_0x1b3a('0x11')](_0x1b3a('0xc'),auth['isAuthenticated'](),controller[_0x1b3a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index d4e2c5c..b176564 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 _0x8ea1=['sequelize','STRING','TEXT'];(function(_0x3439b4,_0x3c235c){var _0x38d9f8=function(_0x4a3a54){while(--_0x4a3a54){_0x3439b4['push'](_0x3439b4['shift']());}};_0x38d9f8(++_0x3c235c);}(_0x8ea1,0x1bc));var _0x18ea=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x8ea1[_0x21f3bf];return _0x249d08;};'use strict';var Sequelize=require(_0x18ea('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x18ea('0x1')]},'application':{'type':Sequelize[_0x18ea('0x1')]},'data':{'type':Sequelize[_0x18ea('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x18ea('0x1')]}}; \ No newline at end of file +var _0x0a87=['TEXT','sequelize','STRING'];(function(_0x501883,_0xbae06){var _0x20482c=function(_0x2367b6){while(--_0x2367b6){_0x501883['push'](_0x501883['shift']());}};_0x20482c(++_0xbae06);}(_0x0a87,0x1b4));var _0x70a8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a87[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x70a8('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x70a8('0x1')]},'application':{'type':Sequelize[_0x70a8('0x1')]},'data':{'type':Sequelize[_0x70a8('0x2')]},'project_name':{'type':Sequelize[_0x70a8('0x1')]},'callerid':{'type':Sequelize[_0x70a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e5c74af..2001bd5 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 _0x34b5=['../../config/license/util','../../mysqldb','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','name','send','index','SquareDetailsReport','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x14bfae,_0x1a3392){var _0x44822d=function(_0x413c9b){while(--_0x413c9b){_0x14bfae['push'](_0x14bfae['shift']());}};_0x44822d(++_0x1a3392);}(_0x34b5,0x1b7));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x534b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x534b('0x1'));var rp=require(_0x534b('0x2'));var moment=require(_0x534b('0x3'));var BPromise=require(_0x534b('0x4'));var Mustache=require(_0x534b('0x5'));var util=require(_0x534b('0x6'));var path=require('path');var sox=require(_0x534b('0x7'));var csv=require('to-csv');var ejs=require(_0x534b('0x8'));var fs=require('fs');var fs_extra=require(_0x534b('0x9'));var _=require('lodash');var squel=require(_0x534b('0xa'));var crypto=require('crypto');var jsforce=require(_0x534b('0xb'));var deskjs=require(_0x534b('0xc'));var toCsv=require(_0x534b('0xd'));var querystring=require(_0x534b('0xe'));var Papa=require('papaparse');var Redis=require(_0x534b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534b('0x10'));var as=require(_0x534b('0x11'));var hardwareService=require(_0x534b('0x12'));var logger=require(_0x534b('0x13'))(_0x534b('0x14'));var utils=require(_0x534b('0x15'));var config=require(_0x534b('0x16'));var licenseUtil=require(_0x534b('0x17'));var db=require(_0x534b('0x18'))['db'];function respondWithStatusCode(_0x586d07,_0x409529){_0x409529=_0x409529||0xcc;return function(_0x4645b6){if(_0x4645b6){return _0x586d07['sendStatus'](_0x409529);}return _0x586d07['status'](_0x409529)['end']();};}function respondWithResult(_0x2c0eb5,_0x16caa1){_0x16caa1=_0x16caa1||0xc8;return function(_0x4c18a7){if(_0x4c18a7){return _0x2c0eb5['status'](_0x16caa1)[_0x534b('0x19')](_0x4c18a7);}};}function respondWithFilteredResult(_0x26ba35,_0x37cae1){return function(_0xbfe02c){if(_0xbfe02c){var _0x1fcd8b=typeof _0x37cae1['offset']===_0x534b('0x1a')&&typeof _0x37cae1[_0x534b('0x1b')]===_0x534b('0x1a');var _0x5332cc=_0xbfe02c[_0x534b('0x1c')];var _0x1fac97=_0x1fcd8b?0x0:_0x37cae1[_0x534b('0x1d')];var _0x4e085c=_0x1fcd8b?_0xbfe02c[_0x534b('0x1c')]:_0x37cae1[_0x534b('0x1d')]+_0x37cae1[_0x534b('0x1b')];var _0x3410d5;if(_0x4e085c>=_0x5332cc){_0x4e085c=_0x5332cc;_0x3410d5=0xc8;}else{_0x3410d5=0xce;}_0x26ba35['status'](_0x3410d5);return _0x26ba35[_0x534b('0x1e')](_0x534b('0x1f'),_0x1fac97+'-'+_0x4e085c+'/'+_0x5332cc)[_0x534b('0x19')](_0xbfe02c);}return null;};}function patchUpdates(_0x143649){return function(_0x21adf1){try{jsonpatch[_0x534b('0x20')](_0x21adf1,_0x143649,!![]);}catch(_0x54eaef){return BPromise[_0x534b('0x21')](_0x54eaef);}return _0x21adf1[_0x534b('0x22')]();};}function saveUpdates(_0x1fa326,_0x344174){return function(_0x13acc5){if(_0x13acc5){return _0x13acc5[_0x534b('0x23')](_0x1fa326)[_0x534b('0x24')](function(_0x50b6c7){return _0x50b6c7;});}return null;};}function removeEntity(_0x4b811d,_0x1f4c00){return function(_0x4abe34){if(_0x4abe34){return _0x4abe34[_0x534b('0x25')]()['then'](function(){_0x4b811d[_0x534b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121b44,_0x3dc0e0){return function(_0x227320){if(!_0x227320){_0x121b44[_0x534b('0x27')](0x194);}return _0x227320;};}function handleError(_0x179cbb,_0xb6039b){_0xb6039b=_0xb6039b||0x1f4;return function(_0x32f944){logger[_0x534b('0x28')](_0x32f944['stack']);if(_0x32f944[_0x534b('0x29')]){delete _0x32f944[_0x534b('0x29')];}_0x179cbb[_0x534b('0x26')](_0xb6039b)[_0x534b('0x2a')](_0x32f944);};}exports[_0x534b('0x2b')]=function(_0x138371,_0x204a13){var _0x2a4a9b={},_0x382d19={},_0x378889={'count':0x0,'rows':[]};var _0x19fdff=_['map'](db[_0x534b('0x2c')]['rawAttributes'],function(_0x2b7d71){return{'name':_0x2b7d71['fieldName'],'type':_0x2b7d71[_0x534b('0x2d')][_0x534b('0x2e')]};});_0x382d19[_0x534b('0x2f')]=_[_0x534b('0x30')](_0x19fdff,_0x534b('0x29'));_0x382d19[_0x534b('0x31')]=_[_0x534b('0x32')](_0x138371[_0x534b('0x31')]);_0x382d19[_0x534b('0x33')]=_[_0x534b('0x34')](_0x382d19[_0x534b('0x2f')],_0x382d19['query']);_0x2a4a9b['attributes']=_['intersection'](_0x382d19[_0x534b('0x2f')],qs[_0x534b('0x35')](_0x138371[_0x534b('0x31')][_0x534b('0x35')]));_0x2a4a9b[_0x534b('0x36')]=_0x2a4a9b['attributes'][_0x534b('0x37')]?_0x2a4a9b[_0x534b('0x36')]:_0x382d19[_0x534b('0x2f')];if(!_0x138371[_0x534b('0x31')][_0x534b('0x38')](_0x534b('0x39'))){_0x2a4a9b[_0x534b('0x1b')]=qs[_0x534b('0x1b')](_0x138371[_0x534b('0x31')][_0x534b('0x1b')]);_0x2a4a9b[_0x534b('0x1d')]=qs[_0x534b('0x1d')](_0x138371[_0x534b('0x31')][_0x534b('0x1d')]);}_0x2a4a9b['order']=qs[_0x534b('0x3a')](_0x138371[_0x534b('0x31')]['sort']);_0x2a4a9b[_0x534b('0x3b')]=qs[_0x534b('0x33')](_[_0x534b('0x3c')](_0x138371[_0x534b('0x31')],_0x382d19[_0x534b('0x33')]),_0x19fdff);if(_0x138371['query'][_0x534b('0x3d')]){_0x2a4a9b['where']=_[_0x534b('0x3e')](_0x2a4a9b[_0x534b('0x3b')],{'$or':_[_0x534b('0x30')](_0x19fdff,function(_0x3e29bf){if(_0x3e29bf['type']!==_0x534b('0x3f')){var _0x2e52b3={};_0x2e52b3[_0x3e29bf[_0x534b('0x29')]]={'$like':'%'+_0x138371[_0x534b('0x31')][_0x534b('0x3d')]+'%'};return _0x2e52b3;}})});}_0x2a4a9b=_[_0x534b('0x3e')]({},_0x2a4a9b,_0x138371[_0x534b('0x40')]);var _0x4a3f02={'where':_0x2a4a9b[_0x534b('0x3b')]};return db[_0x534b('0x2c')][_0x534b('0x1c')](_0x4a3f02)[_0x534b('0x24')](function(_0x1cca62){_0x378889[_0x534b('0x1c')]=_0x1cca62;if(_0x138371[_0x534b('0x31')][_0x534b('0x41')]){_0x2a4a9b[_0x534b('0x42')]=[{'all':!![]}];}return db[_0x534b('0x2c')][_0x534b('0x43')](_0x2a4a9b);})[_0x534b('0x24')](function(_0x3e7c95){_0x378889[_0x534b('0x44')]=_0x3e7c95;return _0x378889;})[_0x534b('0x24')](respondWithFilteredResult(_0x204a13,_0x2a4a9b))['catch'](handleError(_0x204a13,null));};exports[_0x534b('0x45')]=function(_0x59fecd,_0x854cda){var _0x1ce72f={'raw':!![],'where':{'id':_0x59fecd[_0x534b('0x46')]['id']}},_0x4adde7={};_0x4adde7[_0x534b('0x2f')]=_[_0x534b('0x32')](db[_0x534b('0x2c')][_0x534b('0x47')]);_0x4adde7[_0x534b('0x31')]=_[_0x534b('0x32')](_0x59fecd[_0x534b('0x31')]);_0x4adde7[_0x534b('0x33')]=_[_0x534b('0x34')](_0x4adde7['model'],_0x4adde7['query']);_0x1ce72f[_0x534b('0x36')]=_[_0x534b('0x34')](_0x4adde7[_0x534b('0x2f')],qs[_0x534b('0x35')](_0x59fecd[_0x534b('0x31')][_0x534b('0x35')]));_0x1ce72f[_0x534b('0x36')]=_0x1ce72f[_0x534b('0x36')][_0x534b('0x37')]?_0x1ce72f[_0x534b('0x36')]:_0x4adde7[_0x534b('0x2f')];if(_0x59fecd[_0x534b('0x31')][_0x534b('0x41')]){_0x1ce72f[_0x534b('0x42')]=[{'all':!![]}];}_0x1ce72f=_[_0x534b('0x3e')]({},_0x1ce72f,_0x59fecd[_0x534b('0x40')]);return db[_0x534b('0x2c')][_0x534b('0x48')](_0x1ce72f)[_0x534b('0x24')](handleEntityNotFound(_0x854cda,null))[_0x534b('0x24')](respondWithResult(_0x854cda,null))[_0x534b('0x49')](handleError(_0x854cda,null));};exports['create']=function(_0x556802,_0x1d00df){return db[_0x534b('0x2c')][_0x534b('0x4a')](_0x556802[_0x534b('0x4b')],{})['then'](respondWithResult(_0x1d00df,0xc9))[_0x534b('0x49')](handleError(_0x1d00df,null));};exports[_0x534b('0x23')]=function(_0x444883,_0x2c3437){if(_0x444883[_0x534b('0x4b')]['id']){delete _0x444883[_0x534b('0x4b')]['id'];}return db['SquareDetailsReport'][_0x534b('0x48')]({'where':{'id':_0x444883['params']['id']}})['then'](handleEntityNotFound(_0x2c3437,null))['then'](saveUpdates(_0x444883['body'],null))[_0x534b('0x24')](respondWithResult(_0x2c3437,null))['catch'](handleError(_0x2c3437,null));};exports[_0x534b('0x25')]=function(_0x10ce4c,_0x2df7ab){return db[_0x534b('0x2c')][_0x534b('0x48')]({'where':{'id':_0x10ce4c[_0x534b('0x46')]['id']}})[_0x534b('0x24')](handleEntityNotFound(_0x2df7ab,null))[_0x534b('0x24')](removeEntity(_0x2df7ab,null))[_0x534b('0x49')](handleError(_0x2df7ab,null));};exports[_0x534b('0x4c')]=function(_0x3076f4,_0x16ef3f){return db[_0x534b('0x2c')][_0x534b('0x4c')]()[_0x534b('0x24')](respondWithResult(_0x16ef3f,null))['catch'](handleError(_0x16ef3f,null));}; \ No newline at end of file +var _0x5600=['../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x5600,0x10c));var _0x0560=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x5600[_0x52f159];return _0x156799;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0560('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0560('0x1'));var rp=require(_0x0560('0x2'));var moment=require(_0x0560('0x3'));var BPromise=require(_0x0560('0x4'));var Mustache=require(_0x0560('0x5'));var util=require(_0x0560('0x6'));var path=require(_0x0560('0x7'));var sox=require('sox');var csv=require(_0x0560('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0560('0x9'));var _=require('lodash');var squel=require(_0x0560('0xa'));var crypto=require('crypto');var jsforce=require(_0x0560('0xb'));var deskjs=require(_0x0560('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0560('0xd'));var Papa=require('papaparse');var Redis=require(_0x0560('0xe'));var authService=require(_0x0560('0xf'));var qs=require(_0x0560('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0560('0x11'));var logger=require(_0x0560('0x12'))('api');var utils=require(_0x0560('0x13'));var config=require(_0x0560('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0560('0x15'))['db'];function respondWithStatusCode(_0x2a73e8,_0x1c46c8){_0x1c46c8=_0x1c46c8||0xcc;return function(_0x3568ac){if(_0x3568ac){return _0x2a73e8['sendStatus'](_0x1c46c8);}return _0x2a73e8[_0x0560('0x16')](_0x1c46c8)['end']();};}function respondWithResult(_0x2b4061,_0x3c8e57){_0x3c8e57=_0x3c8e57||0xc8;return function(_0x41a749){if(_0x41a749){return _0x2b4061[_0x0560('0x16')](_0x3c8e57)[_0x0560('0x17')](_0x41a749);}};}function respondWithFilteredResult(_0x2c3d09,_0x53c842){return function(_0x2433a9){if(_0x2433a9){var _0x433e35=typeof _0x53c842[_0x0560('0x18')]===_0x0560('0x19')&&typeof _0x53c842[_0x0560('0x1a')]===_0x0560('0x19');var _0x2e3f1e=_0x2433a9[_0x0560('0x1b')];var _0x5b46fd=_0x433e35?0x0:_0x53c842[_0x0560('0x18')];var _0x5eae35=_0x433e35?_0x2433a9['count']:_0x53c842[_0x0560('0x18')]+_0x53c842[_0x0560('0x1a')];var _0x105ba5;if(_0x5eae35>=_0x2e3f1e){_0x5eae35=_0x2e3f1e;_0x105ba5=0xc8;}else{_0x105ba5=0xce;}_0x2c3d09[_0x0560('0x16')](_0x105ba5);return _0x2c3d09['set'](_0x0560('0x1c'),_0x5b46fd+'-'+_0x5eae35+'/'+_0x2e3f1e)[_0x0560('0x17')](_0x2433a9);}return null;};}function patchUpdates(_0x25823c){return function(_0x221161){try{jsonpatch[_0x0560('0x1d')](_0x221161,_0x25823c,!![]);}catch(_0x151bbc){return BPromise[_0x0560('0x1e')](_0x151bbc);}return _0x221161[_0x0560('0x1f')]();};}function saveUpdates(_0x661181,_0x32ea75){return function(_0x5dcd4e){if(_0x5dcd4e){return _0x5dcd4e['update'](_0x661181)[_0x0560('0x20')](function(_0x189684){return _0x189684;});}return null;};}function removeEntity(_0x28a30b,_0x1c37d9){return function(_0xf055d9){if(_0xf055d9){return _0xf055d9[_0x0560('0x21')]()['then'](function(){_0x28a30b[_0x0560('0x16')](0xcc)[_0x0560('0x22')]();});}};}function handleEntityNotFound(_0x540e49,_0x567882){return function(_0x4c6826){if(!_0x4c6826){_0x540e49['sendStatus'](0x194);}return _0x4c6826;};}function handleError(_0x56adb0,_0x49eda7){_0x49eda7=_0x49eda7||0x1f4;return function(_0x314881){logger['error'](_0x314881[_0x0560('0x23')]);if(_0x314881[_0x0560('0x24')]){delete _0x314881['name'];}_0x56adb0[_0x0560('0x16')](_0x49eda7)[_0x0560('0x25')](_0x314881);};}exports[_0x0560('0x26')]=function(_0x333d83,_0x16dc1e){var _0x15e76b={},_0x102178={},_0x371e20={'count':0x0,'rows':[]};var _0x288d2e=_[_0x0560('0x27')](db[_0x0560('0x28')][_0x0560('0x29')],function(_0x4b3625){return{'name':_0x4b3625[_0x0560('0x2a')],'type':_0x4b3625[_0x0560('0x2b')][_0x0560('0x2c')]};});_0x102178[_0x0560('0x2d')]=_['map'](_0x288d2e,_0x0560('0x24'));_0x102178[_0x0560('0x2e')]=_[_0x0560('0x2f')](_0x333d83[_0x0560('0x2e')]);_0x102178[_0x0560('0x30')]=_[_0x0560('0x31')](_0x102178[_0x0560('0x2d')],_0x102178[_0x0560('0x2e')]);_0x15e76b[_0x0560('0x32')]=_[_0x0560('0x31')](_0x102178[_0x0560('0x2d')],qs[_0x0560('0x33')](_0x333d83[_0x0560('0x2e')]['fields']));_0x15e76b['attributes']=_0x15e76b[_0x0560('0x32')][_0x0560('0x34')]?_0x15e76b[_0x0560('0x32')]:_0x102178[_0x0560('0x2d')];if(!_0x333d83['query']['hasOwnProperty'](_0x0560('0x35'))){_0x15e76b[_0x0560('0x1a')]=qs[_0x0560('0x1a')](_0x333d83[_0x0560('0x2e')]['limit']);_0x15e76b[_0x0560('0x18')]=qs[_0x0560('0x18')](_0x333d83['query'][_0x0560('0x18')]);}_0x15e76b[_0x0560('0x36')]=qs[_0x0560('0x37')](_0x333d83[_0x0560('0x2e')][_0x0560('0x37')]);_0x15e76b['where']=qs[_0x0560('0x30')](_['pick'](_0x333d83[_0x0560('0x2e')],_0x102178[_0x0560('0x30')]),_0x288d2e);if(_0x333d83['query'][_0x0560('0x38')]){_0x15e76b[_0x0560('0x39')]=_['merge'](_0x15e76b[_0x0560('0x39')],{'$or':_[_0x0560('0x27')](_0x288d2e,function(_0x2d3435){if(_0x2d3435['type']!==_0x0560('0x3a')){var _0x14fb6d={};_0x14fb6d[_0x2d3435[_0x0560('0x24')]]={'$like':'%'+_0x333d83[_0x0560('0x2e')][_0x0560('0x38')]+'%'};return _0x14fb6d;}})});}_0x15e76b=_[_0x0560('0x3b')]({},_0x15e76b,_0x333d83[_0x0560('0x3c')]);var _0x4fa468={'where':_0x15e76b[_0x0560('0x39')]};return db['SquareDetailsReport'][_0x0560('0x1b')](_0x4fa468)[_0x0560('0x20')](function(_0x57a472){_0x371e20[_0x0560('0x1b')]=_0x57a472;if(_0x333d83[_0x0560('0x2e')][_0x0560('0x3d')]){_0x15e76b[_0x0560('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x0560('0x3f')](_0x15e76b);})[_0x0560('0x20')](function(_0x10968f){_0x371e20[_0x0560('0x40')]=_0x10968f;return _0x371e20;})['then'](respondWithFilteredResult(_0x16dc1e,_0x15e76b))['catch'](handleError(_0x16dc1e,null));};exports[_0x0560('0x41')]=function(_0x4258a5,_0x4c0a62){var _0x35741e={'raw':!![],'where':{'id':_0x4258a5[_0x0560('0x42')]['id']}},_0x464766={};_0x464766[_0x0560('0x2d')]=_['keys'](db[_0x0560('0x28')]['rawAttributes']);_0x464766[_0x0560('0x2e')]=_[_0x0560('0x2f')](_0x4258a5[_0x0560('0x2e')]);_0x464766[_0x0560('0x30')]=_[_0x0560('0x31')](_0x464766[_0x0560('0x2d')],_0x464766[_0x0560('0x2e')]);_0x35741e[_0x0560('0x32')]=_[_0x0560('0x31')](_0x464766[_0x0560('0x2d')],qs[_0x0560('0x33')](_0x4258a5['query'][_0x0560('0x33')]));_0x35741e[_0x0560('0x32')]=_0x35741e[_0x0560('0x32')]['length']?_0x35741e[_0x0560('0x32')]:_0x464766[_0x0560('0x2d')];if(_0x4258a5[_0x0560('0x2e')][_0x0560('0x3d')]){_0x35741e[_0x0560('0x3e')]=[{'all':!![]}];}_0x35741e=_[_0x0560('0x3b')]({},_0x35741e,_0x4258a5[_0x0560('0x3c')]);return db['SquareDetailsReport']['find'](_0x35741e)[_0x0560('0x20')](handleEntityNotFound(_0x4c0a62,null))[_0x0560('0x20')](respondWithResult(_0x4c0a62,null))[_0x0560('0x43')](handleError(_0x4c0a62,null));};exports[_0x0560('0x44')]=function(_0x182f6a,_0x4832f6){return db[_0x0560('0x28')][_0x0560('0x44')](_0x182f6a[_0x0560('0x45')],{})[_0x0560('0x20')](respondWithResult(_0x4832f6,0xc9))[_0x0560('0x43')](handleError(_0x4832f6,null));};exports['update']=function(_0xcd5bbb,_0x2e5bf6){if(_0xcd5bbb['body']['id']){delete _0xcd5bbb[_0x0560('0x45')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0xcd5bbb['params']['id']}})[_0x0560('0x20')](handleEntityNotFound(_0x2e5bf6,null))[_0x0560('0x20')](saveUpdates(_0xcd5bbb[_0x0560('0x45')],null))['then'](respondWithResult(_0x2e5bf6,null))[_0x0560('0x43')](handleError(_0x2e5bf6,null));};exports[_0x0560('0x21')]=function(_0x2328be,_0x5283a8){return db['SquareDetailsReport'][_0x0560('0x46')]({'where':{'id':_0x2328be['params']['id']}})['then'](handleEntityNotFound(_0x5283a8,null))[_0x0560('0x20')](removeEntity(_0x5283a8,null))[_0x0560('0x43')](handleError(_0x5283a8,null));};exports[_0x0560('0x47')]=function(_0x4c98ba,_0x13932e){return db['SquareDetailsReport'][_0x0560('0x47')]()[_0x0560('0x20')](respondWithResult(_0x13932e,null))[_0x0560('0x43')](handleError(_0x13932e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 71c2ff6..b956053 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 _0x6785=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','moment'];(function(_0x1ce3aa,_0x37b150){var _0x2a243d=function(_0x104fda){while(--_0x104fda){_0x1ce3aa['push'](_0x1ce3aa['shift']());}};_0x2a243d(++_0x37b150);}(_0x6785,0x128));var _0x5678=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x6785[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x5678('0x0'));var util=require('util');var logger=require(_0x5678('0x1'))('api');var moment=require(_0x5678('0x2'));var BPromise=require(_0x5678('0x3'));var rp=require(_0x5678('0x4'));var fs=require('fs');var path=require(_0x5678('0x5'));var rimraf=require(_0x5678('0x6'));var config=require(_0x5678('0x7'));var attributes=require(_0x5678('0x8'));module[_0x5678('0x9')]=function(_0x1ec705,_0x4589d4){return _0x1ec705[_0x5678('0xa')](_0x5678('0xb'),attributes,{'tableName':_0x5678('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaaf=['path','rimraf','../../config/environment','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','request-promise'];(function(_0x74a540,_0x125810){var _0x5550c5=function(_0x5ac6a3){while(--_0x5ac6a3){_0x74a540['push'](_0x74a540['shift']());}};_0x5550c5(++_0x125810);}(_0xaaaf,0x1d1));var _0xfaaa=function(_0x4b245c,_0x195fae){_0x4b245c=_0x4b245c-0x0;var _0x419a32=_0xaaaf[_0x4b245c];return _0x419a32;};'use strict';var _=require(_0xfaaa('0x0'));var util=require(_0xfaaa('0x1'));var logger=require('../../config/logger')(_0xfaaa('0x2'));var moment=require('moment');var BPromise=require(_0xfaaa('0x3'));var rp=require(_0xfaaa('0x4'));var fs=require('fs');var path=require(_0xfaaa('0x5'));var rimraf=require(_0xfaaa('0x6'));var config=require(_0xfaaa('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x20aedb,_0x216104){return _0x20aedb['define'](_0xfaaa('0x8'),attributes,{'tableName':_0xfaaa('0x9'),'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 469e126..001d4f3 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 _0x253d=['create','options','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SquareDetailsReport,\x20%s,\x20%s','CreateSquareDetailsReport'];(function(_0x5200c4,_0x4d59a6){var _0x36cb24=function(_0x41bf1f){while(--_0x41bf1f){_0x5200c4['push'](_0x5200c4['shift']());}};_0x36cb24(++_0x4d59a6);}(_0x253d,0x1b3));var _0xd253=function(_0x3a6685,_0x917fa4){_0x3a6685=_0x3a6685-0x0;var _0x4549d7=_0x253d[_0x3a6685];return _0x4549d7;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd253('0x1'));var db=require(_0xd253('0x2'))['db'];var utils=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var jayson=require(_0xd253('0x6'));var client=jayson[_0xd253('0x7')][_0xd253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17589a,_0xf4b457,_0x487f4e){return new BPromise(function(_0x2c4de4,_0x712c81){return client[_0xd253('0x9')](_0x17589a,_0x487f4e)[_0xd253('0xa')](function(_0x351047){logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,'request\x20sent');logger[_0xd253('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'),JSON[_0xd253('0xe')](_0x351047));if(_0x351047[_0xd253('0xf')]){if(_0x351047[_0xd253('0xf')][_0xd253('0x10')]===0x1f4){logger[_0xd253('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047['error'][_0xd253('0x11')]);return _0x712c81(_0x351047[_0xd253('0xf')][_0xd253('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047[_0xd253('0xf')][_0xd253('0x11')]);return _0x2c4de4(_0x351047[_0xd253('0xf')]['message']);}else{logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'));_0x2c4de4(_0x351047[_0xd253('0x12')][_0xd253('0x11')]);}})['catch'](function(_0x1b7ed1){logger['error'](_0xd253('0x13'),_0xf4b457,_0x1b7ed1);_0x712c81(_0x1b7ed1);});});}exports[_0xd253('0x14')]=function(_0x5e4051){var _0x2496cb=this;return new Promise(function(_0x2a2adc,_0x5b24ff){return db['SquareDetailsReport'][_0xd253('0x15')](_0x5e4051['body'],{'raw':_0x5e4051['options']?_0x5e4051[_0xd253('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd253('0xa')](function(_0x1e48c3){logger[_0xd253('0xb')](_0xd253('0x14'),_0x5e4051);logger['debug'](_0xd253('0x14'),_0x5e4051,JSON['stringify'](_0x1e48c3));_0x2a2adc(_0x1e48c3);})[_0xd253('0x17')](function(_0x50f8b5){logger[_0xd253('0xf')](_0xd253('0x14'),_0x50f8b5[_0xd253('0x11')],_0x5e4051);_0x5b24ff(_0x2496cb[_0xd253('0xf')](0x1f4,_0x50f8b5['message']));});});}; \ No newline at end of file +var _0xb78e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','lodash','util'];(function(_0x4282a4,_0x23de10){var _0x11e300=function(_0x811aed){while(--_0x811aed){_0x4282a4['push'](_0x4282a4['shift']());}};_0x11e300(++_0x23de10);}(_0xb78e,0x1c9));var _0xeb78=function(_0x186071,_0x30286c){_0x186071=_0x186071-0x0;var _0x1ec04a=_0xb78e[_0x186071];return _0x1ec04a;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateSquareDetailsReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9bfeb55..ed90119 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 _0xd30b=['isAuthenticated','index','exports','express','Router','../../components/auth/service','get'];(function(_0x5f3cbd,_0x1466fe){var _0x5d4b86=function(_0xb72a02){while(--_0xb72a02){_0x5f3cbd['push'](_0x5f3cbd['shift']());}};_0x5d4b86(++_0x1466fe);}(_0xd30b,0x1a7));var _0xbd30=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xd30b[_0x119705];return _0x2affc2;};'use strict';var express=require(_0xbd30('0x0'));var router=express[_0xbd30('0x1')]();var auth=require(_0xbd30('0x2'));var controller=require('./system.controller');router[_0xbd30('0x3')]('/',auth[_0xbd30('0x4')](),controller[_0xbd30('0x5')]);router[_0xbd30('0x3')]('/process/:pid/kill',auth[_0xbd30('0x4')](),controller['killProcess']);module[_0xbd30('0x6')]=router; \ No newline at end of file +var _0x8433=['express','Router','../../components/auth/service','get','isAuthenticated','killProcess'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x8433,0x1e0));var _0x3843=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x8433[_0x5da0d9];return _0x4b6d2f;};'use strict';var express=require(_0x3843('0x0'));var router=express[_0x3843('0x1')]();var auth=require(_0x3843('0x2'));var controller=require('./system.controller');router[_0x3843('0x3')]('/',auth[_0x3843('0x4')](),controller['index']);router['get']('/process/:pid/kill',auth[_0x3843('0x4')](),controller[_0x3843('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 143696e..d9882a3 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 _0xa5b2=['api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','then','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','../../config/logger'];(function(_0x5ef939,_0x16d68f){var _0x15cbfb=function(_0x5748d){while(--_0x5748d){_0x5ef939['push'](_0x5ef939['shift']());}};_0x15cbfb(++_0x16d68f);}(_0xa5b2,0x6b));var _0x2a5b=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xa5b2[_0x296809];return _0x18c0d3;};'use strict';var info=require(_0x2a5b('0x0'));var exec=require('child_process')[_0x2a5b('0x1')];var logger=require(_0x2a5b('0x2'))(_0x2a5b('0x3'));var util=require(_0x2a5b('0x4'));var BPromise=require(_0x2a5b('0x5'));var _=require(_0x2a5b('0x6'));function handleError(_0x41a52c,_0x1bb4a1,_0x3e66a1){_0x1bb4a1=_0x1bb4a1||0x1f4;return function(_0x3599a9){logger['error'](_0x2a5b('0x7'),_0x3e66a1,_0x1bb4a1,util['inspect'](_0x3599a9,{'showHidden':![],'depth':null}));delete _0x3599a9['name'];_0x41a52c[_0x2a5b('0x8')](_0x1bb4a1)[_0x2a5b('0x9')](_0x3599a9);};}exports[_0x2a5b('0xa')]=function(_0x1942f4,_0x553a2e){return info['getAllData']()[_0x2a5b('0xb')](function(_0x2a3a2f){return _0x553a2e[_0x2a5b('0x8')](0xc8)['json'](_0x2a3a2f);})['catch'](function(_0x59c3b5){return _0x553a2e[_0x2a5b('0x8')](0x1f4)['json'](_0x59c3b5);});};exports['killProcess']=function(_0x1b0893,_0x3b8c56){var _0x554843=['components/import/cm'];return new BPromise(function(_0x2ef1eb,_0x2d57ad){return exec(util[_0x2a5b('0xc')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b0893[_0x2a5b('0xd')][_0x2a5b('0xe')]),function(_0x284275,_0x5d36d,_0x490e78){if(_0x284275){return _0x2d57ad(_0x284275);}return _0x2ef1eb(_0x5d36d);});})['then'](function(_0x139ed3){var _0x10dc16=![];var _0x20436f=_0x139ed3[_0x2a5b('0xf')](/\n/);for(var _0x3ea2e7=0x0,_0x1243af=_0x554843[_0x2a5b('0x10')];_0x3ea2e7<_0x1243af,_0x10dc16===![];_0x3ea2e7+=0x1){if(_0x139ed3[_0x2a5b('0x11')](_0x554843[_0x3ea2e7])>=0x0){_0x10dc16=!![];}}if(!_0x10dc16){throw new Error(util['format'](_0x2a5b('0x12'),_0x1b0893[_0x2a5b('0xd')]['pid']));}process['kill'](_0x1b0893[_0x2a5b('0xd')][_0x2a5b('0xe')],'SIGINT');return _0x3b8c56[_0x2a5b('0x8')](0xc8)[_0x2a5b('0x13')]({'message':util[_0x2a5b('0xc')](_0x2a5b('0x14'),_0x1b0893['params']['pid'])});})['catch'](handleError(_0x3b8c56,null,_0x2a5b('0x15')));}; \ No newline at end of file +var _0x1abc=['send','index','getAllData','json','catch','killProcess','format','params','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x1abc,0x6b));var _0xc1ab=function(_0x278c68,_0x50f399){_0x278c68=_0x278c68-0x0;var _0x4e9442=_0x1abc[_0x278c68];return _0x4e9442;};'use strict';var info=require('systeminformation');var exec=require(_0xc1ab('0x0'))['exec'];var logger=require(_0xc1ab('0x1'))('api');var util=require(_0xc1ab('0x2'));var BPromise=require('bluebird');var _=require(_0xc1ab('0x3'));function handleError(_0x3f9436,_0x2bae10,_0x16ff36){_0x2bae10=_0x2bae10||0x1f4;return function(_0x165ab4){logger[_0xc1ab('0x4')](_0xc1ab('0x5'),_0x16ff36,_0x2bae10,util[_0xc1ab('0x6')](_0x165ab4,{'showHidden':![],'depth':null}));delete _0x165ab4['name'];_0x3f9436[_0xc1ab('0x7')](_0x2bae10)[_0xc1ab('0x8')](_0x165ab4);};}exports[_0xc1ab('0x9')]=function(_0x31f56a,_0x5f2e78){return info[_0xc1ab('0xa')]()['then'](function(_0x299641){return _0x5f2e78[_0xc1ab('0x7')](0xc8)[_0xc1ab('0xb')](_0x299641);})[_0xc1ab('0xc')](function(_0x54c87f){return _0x5f2e78[_0xc1ab('0x7')](0x1f4)['json'](_0x54c87f);});};exports[_0xc1ab('0xd')]=function(_0xe0924b,_0x1b2f6c){var _0x846fa5=['components/import/cm'];return new BPromise(function(_0x493946,_0x286e68){return exec(util[_0xc1ab('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0xe0924b[_0xc1ab('0xf')][_0xc1ab('0x10')]),function(_0x1953ca,_0x430be7,_0x31777d){if(_0x1953ca){return _0x286e68(_0x1953ca);}return _0x493946(_0x430be7);});})[_0xc1ab('0x11')](function(_0x20e9e7){var _0x70f245=![];var _0x5f04be=_0x20e9e7[_0xc1ab('0x12')](/\n/);for(var _0x50d71f=0x0,_0x1ace5c=_0x846fa5[_0xc1ab('0x13')];_0x50d71f<_0x1ace5c,_0x70f245===![];_0x50d71f+=0x1){if(_0x20e9e7['indexOf'](_0x846fa5[_0x50d71f])>=0x0){_0x70f245=!![];}}if(!_0x70f245){throw new Error(util[_0xc1ab('0xe')](_0xc1ab('0x14'),_0xe0924b['params'][_0xc1ab('0x10')]));}process[_0xc1ab('0x15')](_0xe0924b[_0xc1ab('0xf')]['pid'],'SIGINT');return _0x1b2f6c[_0xc1ab('0x7')](0xc8)[_0xc1ab('0xb')]({'message':util[_0xc1ab('0xe')](_0xc1ab('0x16'),_0xe0924b[_0xc1ab('0xf')][_0xc1ab('0x10')])});})[_0xc1ab('0xc')](handleError(_0x1b2f6c,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 87138af..bb10a24 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 _0x225b=['express','fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x225b,0xb1));var _0xb225=function(_0x3b9ffe,_0x43d77e){_0x3b9ffe=_0x3b9ffe-0x0;var _0x3aca13=_0x225b[_0x3b9ffe];return _0x3aca13;};'use strict';var multer=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var path=require('path');var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var fs_extra=require(_0xb225('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb225('0x5'));var config=require('../../config/environment');var controller=require(_0xb225('0x6'));router[_0xb225('0x7')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0x9')]);router[_0xb225('0x7')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller['show']);router[_0xb225('0xb')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0xc')]);router[_0xb225('0xd')]('/:id',auth[_0xb225('0x8')](),controller[_0xb225('0xe')]);router[_0xb225('0xf')]('/:id',auth[_0xb225('0x8')](),controller[_0xb225('0x10')]);module[_0xb225('0x11')]=router; \ No newline at end of file +var _0xe55d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util'];(function(_0x32464e,_0x2fa13a){var _0x4bd30d=function(_0x115761){while(--_0x115761){_0x32464e['push'](_0x32464e['shift']());}};_0x4bd30d(++_0x2fa13a);}(_0xe55d,0x9f));var _0xde55=function(_0x46b1c9,_0x169f87){_0x46b1c9=_0x46b1c9-0x0;var _0x17569c=_0xe55d[_0x46b1c9];return _0x17569c;};'use strict';var multer=require('multer');var util=require(_0xde55('0x0'));var path=require(_0xde55('0x1'));var timeout=require(_0xde55('0x2'));var express=require(_0xde55('0x3'));var router=express[_0xde55('0x4')]();var fs_extra=require(_0xde55('0x5'));var auth=require(_0xde55('0x6'));var interaction=require(_0xde55('0x7'));var config=require(_0xde55('0x8'));var controller=require(_0xde55('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xde55('0xa')]);router['get'](_0xde55('0xb'),auth[_0xde55('0xc')](),controller[_0xde55('0xd')]);router[_0xde55('0xe')]('/',auth[_0xde55('0xc')](),controller['create']);router[_0xde55('0xf')](_0xde55('0xb'),auth['isAuthenticated'](),controller[_0xde55('0x10')]);router[_0xde55('0x11')](_0xde55('0xb'),auth[_0xde55('0xc')](),controller[_0xde55('0x12')]);module[_0xde55('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9d66c3b..0c986da 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 _0x3306=['STRING','name','#0091EA','sequelize','exports'];(function(_0x25afd8,_0x3b1b68){var _0x5cdc6c=function(_0x4da052){while(--_0x4da052){_0x25afd8['push'](_0x25afd8['shift']());}};_0x5cdc6c(++_0x3b1b68);}(_0x3306,0x107));var _0x6330=function(_0x3174a4,_0x1bcf37){_0x3174a4=_0x3174a4-0x0;var _0x18d2d7=_0x3306[_0x3174a4];return _0x18d2d7;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'name':{'type':Sequelize[_0x6330('0x2')],'unique':_0x6330('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6330('0x4')},'description':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file +var _0x76d2=['sequelize','exports','STRING','#0091EA'];(function(_0x4ee8f2,_0x341ceb){var _0x59d6c8=function(_0x519f9c){while(--_0x519f9c){_0x4ee8f2['push'](_0x4ee8f2['shift']());}};_0x59d6c8(++_0x341ceb);}(_0x76d2,0xf8));var _0x276d=function(_0x4c54c6,_0x24ba89){_0x4c54c6=_0x4c54c6-0x0;var _0x9814c3=_0x76d2[_0x4c54c6];return _0x9814c3;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x276d('0x2')],'defaultValue':_0x276d('0x3')},'description':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0906d4d..5d56933 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 _0xaaa2=['keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params'];(function(_0x5235be,_0xf7abdd){var _0xaab683=function(_0x2e90b3){while(--_0x2e90b3){_0x5235be['push'](_0x5235be['shift']());}};_0xaab683(++_0xf7abdd);}(_0xaaa2,0xac));var _0x2aaa=function(_0x358e63,_0x459f5f){_0x358e63=_0x358e63-0x0;var _0x358366=_0xaaa2[_0x358e63];return _0x358366;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){var _0x4e41ee=_0x4d7151[_0x2aaa('0x24')]({'plain':!![]});var _0x3b99d8='Tags';return db[_0x2aaa('0x25')][_0x2aaa('0x23')]({'where':{'type':_0x3b99d8,'resourceId':_0x4e41ee['id']}})[_0x2aaa('0x22')](function(){return _0x4d7151;});})['then'](function(){_0x4d35aa[_0x2aaa('0x17')](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x47a9fa,_0x565860){return function(_0x3af929){if(!_0x3af929){_0x47a9fa[_0x2aaa('0x16')](0x194);}return _0x3af929;};}function handleError(_0x2f9772,_0xd9891d){_0xd9891d=_0xd9891d||0x1f4;return function(_0x3a6a63){logger[_0x2aaa('0x26')](_0x3a6a63[_0x2aaa('0x27')]);if(_0x3a6a63[_0x2aaa('0x28')]){delete _0x3a6a63[_0x2aaa('0x28')];}_0x2f9772[_0x2aaa('0x17')](_0xd9891d)[_0x2aaa('0x29')](_0x3a6a63);};}exports[_0x2aaa('0x2a')]=function(_0x4f837f,_0x101b6e){var _0x5e29de={},_0xd6482a={},_0xb22a8d={'count':0x0,'rows':[]};var _0x3dd818=_[_0x2aaa('0x2b')](db[_0x2aaa('0x2c')][_0x2aaa('0x2d')],function(_0x436179){return{'name':_0x436179[_0x2aaa('0x2e')],'type':_0x436179[_0x2aaa('0x2f')][_0x2aaa('0x30')]};});_0xd6482a['model']=_['map'](_0x3dd818,'name');_0xd6482a['query']=_['keys'](_0x4f837f[_0x2aaa('0x31')]);_0xd6482a[_0x2aaa('0x32')]=_[_0x2aaa('0x33')](_0xd6482a[_0x2aaa('0x34')],_0xd6482a[_0x2aaa('0x31')]);_0x5e29de[_0x2aaa('0x35')]=_[_0x2aaa('0x33')](_0xd6482a[_0x2aaa('0x34')],qs['fields'](_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x36')]));_0x5e29de['attributes']=_0x5e29de[_0x2aaa('0x35')][_0x2aaa('0x37')]?_0x5e29de['attributes']:_0xd6482a[_0x2aaa('0x34')];if(!_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x38')](_0x2aaa('0x39'))){_0x5e29de[_0x2aaa('0x1c')]=qs[_0x2aaa('0x1c')](_0x4f837f[_0x2aaa('0x31')]['limit']);_0x5e29de['offset']=qs[_0x2aaa('0x1b')](_0x4f837f['query'][_0x2aaa('0x1b')]);}_0x5e29de[_0x2aaa('0x3a')]=qs['sort'](_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x3b')]);_0x5e29de[_0x2aaa('0x3c')]=qs['filters'](_[_0x2aaa('0x3d')](_0x4f837f[_0x2aaa('0x31')],_0xd6482a[_0x2aaa('0x32')]),_0x3dd818);if(_0x4f837f[_0x2aaa('0x31')]['filter']){_0x5e29de[_0x2aaa('0x3c')]=_[_0x2aaa('0x3e')](_0x5e29de[_0x2aaa('0x3c')],{'$or':_[_0x2aaa('0x2b')](_0x3dd818,function(_0x372cae){if(_0x372cae[_0x2aaa('0x2f')]!==_0x2aaa('0x3f')){var _0x1a7fbd={};_0x1a7fbd[_0x372cae[_0x2aaa('0x28')]]={'$like':'%'+_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x40')]+'%'};return _0x1a7fbd;}})});}_0x5e29de=_[_0x2aaa('0x3e')]({},_0x5e29de,_0x4f837f[_0x2aaa('0x41')]);var _0x54a9c8={'where':_0x5e29de[_0x2aaa('0x3c')]};return db[_0x2aaa('0x2c')][_0x2aaa('0x1a')](_0x54a9c8)['then'](function(_0x17042f){_0xb22a8d[_0x2aaa('0x1a')]=_0x17042f;if(_0x4f837f[_0x2aaa('0x31')]['includeAll']){_0x5e29de[_0x2aaa('0x42')]=[{'all':!![]}];}return db[_0x2aaa('0x2c')][_0x2aaa('0x43')](_0x5e29de);})['then'](function(_0x57554e){_0xb22a8d[_0x2aaa('0x44')]=_0x57554e;return _0xb22a8d;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x101b6e,_0x5e29de))[_0x2aaa('0x45')](handleError(_0x101b6e,null));};exports['show']=function(_0x333786,_0x127a5a){var _0x2ec436={'raw':!![],'where':{'id':_0x333786[_0x2aaa('0x46')]['id']}},_0x2d639a={};_0x2d639a[_0x2aaa('0x34')]=_[_0x2aaa('0x47')](db[_0x2aaa('0x2c')]['rawAttributes']);_0x2d639a['query']=_[_0x2aaa('0x47')](_0x333786['query']);_0x2d639a[_0x2aaa('0x32')]=_['intersection'](_0x2d639a['model'],_0x2d639a['query']);_0x2ec436[_0x2aaa('0x35')]=_[_0x2aaa('0x33')](_0x2d639a['model'],qs[_0x2aaa('0x36')](_0x333786[_0x2aaa('0x31')]['fields']));_0x2ec436[_0x2aaa('0x35')]=_0x2ec436['attributes'][_0x2aaa('0x37')]?_0x2ec436[_0x2aaa('0x35')]:_0x2d639a['model'];if(_0x333786[_0x2aaa('0x31')][_0x2aaa('0x48')]){_0x2ec436[_0x2aaa('0x42')]=[{'all':!![]}];}_0x2ec436=_[_0x2aaa('0x3e')]({},_0x2ec436,_0x333786[_0x2aaa('0x41')]);return db['Tag']['find'](_0x2ec436)['then'](handleEntityNotFound(_0x127a5a,null))[_0x2aaa('0x22')](respondWithResult(_0x127a5a,null))[_0x2aaa('0x45')](handleError(_0x127a5a,null));};exports[_0x2aaa('0x49')]=function(_0x393073,_0x23290d){return db[_0x2aaa('0x2c')][_0x2aaa('0x49')](_0x393073[_0x2aaa('0x4a')],{})[_0x2aaa('0x22')](function(_0x54d9bb){var _0x22ccf0=_0x393073[_0x2aaa('0x4b')][_0x2aaa('0x24')]({'plain':!![]});if(!_0x22ccf0)throw new Error(_0x2aaa('0x4c'));if(_0x22ccf0['role']===_0x2aaa('0x4b')){var _0xe935c3=_0x54d9bb[_0x2aaa('0x24')]({'plain':!![]});var _0x5aeb05='Tags';return db[_0x2aaa('0x4d')][_0x2aaa('0x4e')]({'where':{'name':_0x5aeb05,'userProfileId':_0x22ccf0[_0x2aaa('0x4f')]},'raw':!![]})[_0x2aaa('0x22')](function(_0x4ca930){if(_0x4ca930&&_0x4ca930['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xe935c3[_0x2aaa('0x28')],'resourceId':_0xe935c3['id'],'type':_0x4ca930[_0x2aaa('0x28')],'sectionId':_0x4ca930['id']},{})[_0x2aaa('0x22')](function(){return _0x54d9bb;});}else{return _0x54d9bb;}})['catch'](function(_0x1e690d){logger[_0x2aaa('0x26')](_0x2aaa('0x50'),_0x1e690d);throw _0x1e690d;});}return _0x54d9bb;})[_0x2aaa('0x22')](respondWithResult(_0x23290d,0xc9))[_0x2aaa('0x45')](handleError(_0x23290d,null));};exports[_0x2aaa('0x21')]=function(_0x1c74de,_0x5f3ebb){if(_0x1c74de[_0x2aaa('0x4a')]['id']){delete _0x1c74de['body']['id'];}return db['Tag'][_0x2aaa('0x4e')]({'where':{'id':_0x1c74de[_0x2aaa('0x46')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x5f3ebb,null))[_0x2aaa('0x22')](saveUpdates(_0x1c74de[_0x2aaa('0x4a')],null))['then'](respondWithResult(_0x5f3ebb,null))[_0x2aaa('0x45')](handleError(_0x5f3ebb,null));};exports[_0x2aaa('0x23')]=function(_0x1a5d71,_0x2639f4){return db[_0x2aaa('0x2c')][_0x2aaa('0x4e')]({'where':{'id':_0x1a5d71[_0x2aaa('0x46')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x2639f4,null))[_0x2aaa('0x22')](removeEntity(_0x2639f4,null))[_0x2aaa('0x45')](handleError(_0x2639f4,null));}; \ No newline at end of file +var _0x0f9f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','Tag','include','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4e1b9d,_0x248086){var _0xcbc689=function(_0x2bc348){while(--_0x2bc348){_0x4e1b9d['push'](_0x4e1b9d['shift']());}};_0xcbc689(++_0x248086);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x3c2c62,_0x2033c2){_0x3c2c62=_0x3c2c62-0x0;var _0x58bcb8=_0x0f9f[_0x3c2c62];return _0x58bcb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=typeof _0x2e2955[_0xf0f9('0x1d')]===_0xf0f9('0x1e')&&typeof _0x2e2955[_0xf0f9('0x1f')]===_0xf0f9('0x1e');var _0x4d3534=_0x2b05e3['count'];var _0x350a48=_0x2f5bec?0x0:_0x2e2955[_0xf0f9('0x1d')];var _0x4c4e17=_0x2f5bec?_0x2b05e3[_0xf0f9('0x20')]:_0x2e2955['offset']+_0x2e2955['limit'];var _0x42c157;if(_0x4c4e17>=_0x4d3534){_0x4c4e17=_0x4d3534;_0x42c157=0xc8;}else{_0x42c157=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x42c157);return _0xa7d48c[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x350a48+'-'+_0x4c4e17+'/'+_0x4d3534)[_0xf0f9('0x1c')](_0x2b05e3);}return null;};}function patchUpdates(_0x4ed9ff){return function(_0x5ccbc9){try{jsonpatch['apply'](_0x5ccbc9,_0x4ed9ff,!![]);}catch(_0x102336){return BPromise[_0xf0f9('0x23')](_0x102336);}return _0x5ccbc9[_0xf0f9('0x24')]();};}function saveUpdates(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['update'](_0x5d87a9)[_0xf0f9('0x25')](function(_0x414f87){return _0x414f87;});}return null;};}function removeEntity(_0x173c79,_0x570c68){return function(_0x33dfca){if(_0x33dfca){return _0x33dfca[_0xf0f9('0x26')]()[_0xf0f9('0x25')](function(){var _0x49a2dd=_0x33dfca[_0xf0f9('0x27')]({'plain':!![]});var _0x33f070=_0xf0f9('0x28');return db[_0xf0f9('0x29')][_0xf0f9('0x26')]({'where':{'type':_0x33f070,'resourceId':_0x49a2dd['id']}})[_0xf0f9('0x25')](function(){return _0x33dfca;});})['then'](function(){_0x173c79[_0xf0f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1288e0,_0x30e85c){return function(_0x519a46){if(!_0x519a46){_0x1288e0['sendStatus'](0x194);}return _0x519a46;};}function handleError(_0x119793,_0x50e7f6){_0x50e7f6=_0x50e7f6||0x1f4;return function(_0x2121b8){logger[_0xf0f9('0x2a')](_0x2121b8[_0xf0f9('0x2b')]);if(_0x2121b8[_0xf0f9('0x2c')]){delete _0x2121b8[_0xf0f9('0x2c')];}_0x119793[_0xf0f9('0x1a')](_0x50e7f6)[_0xf0f9('0x2d')](_0x2121b8);};}exports[_0xf0f9('0x2e')]=function(_0x37c093,_0x4e4e08){var _0x2e79f9={},_0x28da31={},_0x534083={'count':0x0,'rows':[]};var _0x48ef2a=_[_0xf0f9('0x2f')](db['Tag']['rawAttributes'],function(_0x14f3cb){return{'name':_0x14f3cb['fieldName'],'type':_0x14f3cb[_0xf0f9('0x30')][_0xf0f9('0x31')]};});_0x28da31['model']=_['map'](_0x48ef2a,_0xf0f9('0x2c'));_0x28da31[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0x37c093[_0xf0f9('0x32')]);_0x28da31[_0xf0f9('0x34')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],_0x28da31[_0xf0f9('0x32')]);_0x2e79f9[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0x37c093[_0xf0f9('0x32')]['fields']));_0x2e79f9[_0xf0f9('0x37')]=_0x2e79f9['attributes'][_0xf0f9('0x39')]?_0x2e79f9[_0xf0f9('0x37')]:_0x28da31[_0xf0f9('0x36')];if(!_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3a')](_0xf0f9('0x3b'))){_0x2e79f9[_0xf0f9('0x1f')]=qs['limit'](_0x37c093['query'][_0xf0f9('0x1f')]);_0x2e79f9[_0xf0f9('0x1d')]=qs[_0xf0f9('0x1d')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x1d')]);}_0x2e79f9['order']=qs[_0xf0f9('0x3c')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3c')]);_0x2e79f9[_0xf0f9('0x3d')]=qs[_0xf0f9('0x34')](_['pick'](_0x37c093[_0xf0f9('0x32')],_0x28da31[_0xf0f9('0x34')]),_0x48ef2a);if(_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]){_0x2e79f9[_0xf0f9('0x3d')]=_[_0xf0f9('0x3f')](_0x2e79f9['where'],{'$or':_[_0xf0f9('0x2f')](_0x48ef2a,function(_0x1b84ef){if(_0x1b84ef[_0xf0f9('0x30')]!=='VIRTUAL'){var _0x3b52e3={};_0x3b52e3[_0x1b84ef[_0xf0f9('0x2c')]]={'$like':'%'+_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]+'%'};return _0x3b52e3;}})});}_0x2e79f9=_[_0xf0f9('0x3f')]({},_0x2e79f9,_0x37c093[_0xf0f9('0x40')]);var _0x1e1805={'where':_0x2e79f9[_0xf0f9('0x3d')]};return db[_0xf0f9('0x41')][_0xf0f9('0x20')](_0x1e1805)[_0xf0f9('0x25')](function(_0x149870){_0x534083[_0xf0f9('0x20')]=_0x149870;if(_0x37c093['query']['includeAll']){_0x2e79f9[_0xf0f9('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2e79f9);})['then'](function(_0x2cb95d){_0x534083[_0xf0f9('0x43')]=_0x2cb95d;return _0x534083;})[_0xf0f9('0x25')](respondWithFilteredResult(_0x4e4e08,_0x2e79f9))[_0xf0f9('0x44')](handleError(_0x4e4e08,null));};exports[_0xf0f9('0x45')]=function(_0xfef8ad,_0xc0c34c){var _0x2e1556={'raw':!![],'where':{'id':_0xfef8ad['params']['id']}},_0x1a3a6b={};_0x1a3a6b[_0xf0f9('0x36')]=_[_0xf0f9('0x33')](db[_0xf0f9('0x41')]['rawAttributes']);_0x1a3a6b[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0xfef8ad[_0xf0f9('0x32')]);_0x1a3a6b['filters']=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],_0x1a3a6b['query']);_0x2e1556[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0xfef8ad['query'][_0xf0f9('0x38')]));_0x2e1556[_0xf0f9('0x37')]=_0x2e1556[_0xf0f9('0x37')][_0xf0f9('0x39')]?_0x2e1556[_0xf0f9('0x37')]:_0x1a3a6b[_0xf0f9('0x36')];if(_0xfef8ad['query'][_0xf0f9('0x46')]){_0x2e1556['include']=[{'all':!![]}];}_0x2e1556=_[_0xf0f9('0x3f')]({},_0x2e1556,_0xfef8ad[_0xf0f9('0x40')]);return db[_0xf0f9('0x41')][_0xf0f9('0x47')](_0x2e1556)[_0xf0f9('0x25')](handleEntityNotFound(_0xc0c34c,null))[_0xf0f9('0x25')](respondWithResult(_0xc0c34c,null))[_0xf0f9('0x44')](handleError(_0xc0c34c,null));};exports[_0xf0f9('0x48')]=function(_0x1f47fa,_0x13bb13){return db[_0xf0f9('0x41')][_0xf0f9('0x48')](_0x1f47fa[_0xf0f9('0x49')],{})[_0xf0f9('0x25')](function(_0x45a165){var _0x3cb91a=_0x1f47fa[_0xf0f9('0x4a')][_0xf0f9('0x27')]({'plain':!![]});if(!_0x3cb91a)throw new Error(_0xf0f9('0x4b'));if(_0x3cb91a[_0xf0f9('0x4c')]===_0xf0f9('0x4a')){var _0x40711c=_0x45a165[_0xf0f9('0x27')]({'plain':!![]});var _0x37a928='Tags';return db['UserProfileSection'][_0xf0f9('0x47')]({'where':{'name':_0x37a928,'userProfileId':_0x3cb91a['userProfileId']},'raw':!![]})[_0xf0f9('0x25')](function(_0x2c364c){if(_0x2c364c&&_0x2c364c[_0xf0f9('0x4d')]===0x0){return db['UserProfileResource'][_0xf0f9('0x48')]({'name':_0x40711c['name'],'resourceId':_0x40711c['id'],'type':_0x2c364c[_0xf0f9('0x2c')],'sectionId':_0x2c364c['id']},{})[_0xf0f9('0x25')](function(){return _0x45a165;});}else{return _0x45a165;}})[_0xf0f9('0x44')](function(_0xfe9072){logger[_0xf0f9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe9072);throw _0xfe9072;});}return _0x45a165;})[_0xf0f9('0x25')](respondWithResult(_0x13bb13,0xc9))['catch'](handleError(_0x13bb13,null));};exports[_0xf0f9('0x4e')]=function(_0x1b0186,_0xb3467e){if(_0x1b0186[_0xf0f9('0x49')]['id']){delete _0x1b0186[_0xf0f9('0x49')]['id'];}return db['Tag'][_0xf0f9('0x47')]({'where':{'id':_0x1b0186[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0xb3467e,null))[_0xf0f9('0x25')](saveUpdates(_0x1b0186[_0xf0f9('0x49')],null))[_0xf0f9('0x25')](respondWithResult(_0xb3467e,null))[_0xf0f9('0x44')](handleError(_0xb3467e,null));};exports[_0xf0f9('0x26')]=function(_0x15f3b3,_0x406b45){return db[_0xf0f9('0x41')][_0xf0f9('0x47')]({'where':{'id':_0x15f3b3[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x406b45,null))['then'](removeEntity(_0x406b45,null))[_0xf0f9('0x44')](handleError(_0x406b45,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 99915f6..9dcc510 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 _0xd8c4=['bluebird','path','rimraf','exports','define','Tag','lodash','api','moment'];(function(_0x22e18d,_0x5b9f41){var _0x5473e6=function(_0x5cdf7c){while(--_0x5cdf7c){_0x22e18d['push'](_0x22e18d['shift']());}};_0x5473e6(++_0x5b9f41);}(_0xd8c4,0x126));var _0x4d8c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xd8c4[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x4d8c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d8c('0x1'));var moment=require(_0x4d8c('0x2'));var BPromise=require(_0x4d8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d8c('0x4'));var rimraf=require(_0x4d8c('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x4d8c('0x6')]=function(_0x3c8258,_0x4ec848){return _0x3c8258[_0x4d8c('0x7')](_0x4d8c('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9315=['rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','api','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9315,0xe4));var _0x5931=function(_0xb8e0b5,_0x383b7d){_0xb8e0b5=_0xb8e0b5-0x0;var _0x4b7d63=_0x9315[_0xb8e0b5];return _0x4b7d63;};'use strict';var _=require('lodash');var util=require(_0x5931('0x0'));var logger=require(_0x5931('0x1'))(_0x5931('0x2'));var moment=require(_0x5931('0x3'));var BPromise=require('bluebird');var rp=require(_0x5931('0x4'));var fs=require('fs');var path=require(_0x5931('0x5'));var rimraf=require(_0x5931('0x6'));var config=require(_0x5931('0x7'));var attributes=require(_0x5931('0x8'));module[_0x5931('0x9')]=function(_0x25bd3d,_0x46212f){return _0x25bd3d[_0x5931('0xa')](_0x5931('0xb'),attributes,{'tableName':_0x5931('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index eabc2cf..0a501c5 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 _0x8d0e=['info','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x36fb81,_0x34bcdb){var _0x61e477=function(_0x1852d8){while(--_0x1852d8){_0x36fb81['push'](_0x36fb81['shift']());}};_0x61e477(++_0x34bcdb);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x300272,_0x45ec90){_0x300272=_0x300272-0x0;var _0x346323=_0x8d0e[_0x300272];return _0x346323;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('Tag,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('Tag,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('Tag,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file +var _0x984b=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x557dde,_0x2f10be){var _0x5d7a3f=function(_0x5ac556){while(--_0x5ac556){_0x557dde['push'](_0x557dde['shift']());}};_0x5d7a3f(++_0x2f10be);}(_0x984b,0xee));var _0xb984=function(_0x50aaee,_0x38f9ea){_0x50aaee=_0x50aaee-0x0;var _0x45bb1a=_0x984b[_0x50aaee];return _0x45bb1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b27e62a..dc42e49 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 791195b..fd2f59f 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(_0x2e6423,_0x4a4f4b){var _0x3e70d9=function(_0x33d026){while(--_0x33d026){_0x2e6423['push'](_0x2e6423['shift']());}};_0x3e70d9(++_0x4a4f4b);}(_0x757a,0xde));var _0xa757=function(_0x14ca7f,_0x258d2a){_0x14ca7f=_0x14ca7f-0x0;var _0x52a251=_0x757a[_0x14ca7f];return _0x52a251;};'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 _0x0713=['STRING','name'];(function(_0x34f222,_0x5ab125){var _0x30a60c=function(_0x3651b4){while(--_0x3651b4){_0x34f222['push'](_0x34f222['shift']());}};_0x30a60c(++_0x5ab125);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 08c859c..9483ace 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 _0x2b81=['save','then','stack','name','index','map','Team','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','include','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','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','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','capitalize','Queues','addQueues','findOne','toLowerCase','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','status','end','json','offset','count','set','Content-Range','apply','reject'];(function(_0x31d721,_0x5ad391){var _0x331be2=function(_0x3abc00){while(--_0x3abc00){_0x31d721['push'](_0x31d721['shift']());}};_0x331be2(++_0x5ad391);}(_0x2b81,0x11b));var _0x12b8=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0x2b81[_0x84a85];return _0x1c2943;};'use strict';var emlformat=require(_0x12b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12b8('0x1'));var jsonpatch=require(_0x12b8('0x2'));var rp=require(_0x12b8('0x3'));var moment=require(_0x12b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12b8('0x5'));var util=require(_0x12b8('0x6'));var path=require(_0x12b8('0x7'));var sox=require(_0x12b8('0x8'));var csv=require('to-csv');var ejs=require(_0x12b8('0x9'));var fs=require('fs');var fs_extra=require(_0x12b8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12b8('0xb'));var jsforce=require(_0x12b8('0xc'));var deskjs=require(_0x12b8('0xd'));var toCsv=require(_0x12b8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x12b8('0xf'));var authService=require(_0x12b8('0x10'));var qs=require(_0x12b8('0x11'));var as=require(_0x12b8('0x12'));var hardwareService=require(_0x12b8('0x13'));var logger=require('../../config/logger')(_0x12b8('0x14'));var utils=require(_0x12b8('0x15'));var config=require(_0x12b8('0x16'));var licenseUtil=require(_0x12b8('0x17'));var db=require(_0x12b8('0x18'))['db'];config['redis']=_[_0x12b8('0x19')](config[_0x12b8('0x1a')],{'host':_0x12b8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x27ea3e,_0x1815a8){_0x1815a8=_0x1815a8||0xcc;return function(_0x4a3a03){if(_0x4a3a03){return _0x27ea3e['sendStatus'](_0x1815a8);}return _0x27ea3e[_0x12b8('0x1c')](_0x1815a8)[_0x12b8('0x1d')]();};}function respondWithResult(_0x410f55,_0x3d2fbd){_0x3d2fbd=_0x3d2fbd||0xc8;return function(_0x1f71a6){if(_0x1f71a6){return _0x410f55['status'](_0x3d2fbd)[_0x12b8('0x1e')](_0x1f71a6);}};}function respondWithFilteredResult(_0x164e9d,_0xabe979){return function(_0x5b2061){if(_0x5b2061){var _0x36ab3b=typeof _0xabe979[_0x12b8('0x1f')]==='undefined'&&typeof _0xabe979['limit']==='undefined';var _0x22f6d1=_0x5b2061['count'];var _0x1fca43=_0x36ab3b?0x0:_0xabe979['offset'];var _0xa86ca5=_0x36ab3b?_0x5b2061[_0x12b8('0x20')]:_0xabe979[_0x12b8('0x1f')]+_0xabe979['limit'];var _0x4ede16;if(_0xa86ca5>=_0x22f6d1){_0xa86ca5=_0x22f6d1;_0x4ede16=0xc8;}else{_0x4ede16=0xce;}_0x164e9d['status'](_0x4ede16);return _0x164e9d[_0x12b8('0x21')](_0x12b8('0x22'),_0x1fca43+'-'+_0xa86ca5+'/'+_0x22f6d1)[_0x12b8('0x1e')](_0x5b2061);}return null;};}function patchUpdates(_0x179cb5){return function(_0xd42dc){try{jsonpatch[_0x12b8('0x23')](_0xd42dc,_0x179cb5,!![]);}catch(_0xe0c238){return BPromise[_0x12b8('0x24')](_0xe0c238);}return _0xd42dc[_0x12b8('0x25')]();};}function saveUpdates(_0x1828c2,_0x38e3b0){return function(_0x37fe7c){if(_0x37fe7c){return _0x37fe7c['update'](_0x1828c2)[_0x12b8('0x26')](function(_0x5c933a){return _0x5c933a;});}return null;};}function handleEntityNotFound(_0x43743e,_0x1a36b1){return function(_0x2735c7){if(!_0x2735c7){_0x43743e['sendStatus'](0x194);}return _0x2735c7;};}function handleError(_0xf0a71d,_0x26067b){_0x26067b=_0x26067b||0x1f4;return function(_0x47aea9){logger['error'](_0x47aea9[_0x12b8('0x27')]);if(_0x47aea9[_0x12b8('0x28')]){delete _0x47aea9[_0x12b8('0x28')];}_0xf0a71d[_0x12b8('0x1c')](_0x26067b)['send'](_0x47aea9);};}exports[_0x12b8('0x29')]=function(_0x2c68af,_0x51dbee){var _0x317d46={},_0x264487={},_0x36446c={'count':0x0,'rows':[]};var _0x252011=_[_0x12b8('0x2a')](db[_0x12b8('0x2b')][_0x12b8('0x2c')],function(_0xfd3f9d){return{'name':_0xfd3f9d[_0x12b8('0x2d')],'type':_0xfd3f9d[_0x12b8('0x2e')]['key']};});_0x264487['model']=_[_0x12b8('0x2a')](_0x252011,_0x12b8('0x28'));_0x264487[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x2c68af[_0x12b8('0x2f')]);_0x264487[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x264487[_0x12b8('0x33')],_0x264487[_0x12b8('0x2f')]);_0x317d46[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x264487[_0x12b8('0x33')],qs['fields'](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x317d46[_0x12b8('0x34')]=_0x317d46['attributes'][_0x12b8('0x36')]?_0x317d46[_0x12b8('0x34')]:_0x264487[_0x12b8('0x33')];if(!_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x37')]('nolimit')){_0x317d46[_0x12b8('0x38')]=qs[_0x12b8('0x38')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x38')]);_0x317d46[_0x12b8('0x1f')]=qs[_0x12b8('0x1f')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x1f')]);}_0x317d46[_0x12b8('0x39')]=qs[_0x12b8('0x3a')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x317d46['where']=qs[_0x12b8('0x31')](_[_0x12b8('0x3b')](_0x2c68af[_0x12b8('0x2f')],_0x264487[_0x12b8('0x31')]),_0x252011);if(_0x2c68af['query'][_0x12b8('0x3c')]){_0x317d46[_0x12b8('0x3d')]=_[_0x12b8('0x3e')](_0x317d46[_0x12b8('0x3d')],{'$or':_[_0x12b8('0x2a')](_0x252011,function(_0x57fda9){if(_0x57fda9['type']!=='VIRTUAL'){var _0xa7d730={};_0xa7d730[_0x57fda9['name']]={'$like':'%'+_0x2c68af['query'][_0x12b8('0x3c')]+'%'};return _0xa7d730;}})});}_0x317d46=_['merge']({},_0x317d46,_0x2c68af[_0x12b8('0x3f')]);var _0x55f3fe={'where':_0x317d46[_0x12b8('0x3d')]};return db['Team'][_0x12b8('0x20')](_0x55f3fe)[_0x12b8('0x26')](function(_0x4ad13f){_0x36446c[_0x12b8('0x20')]=_0x4ad13f;if(_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x40')]){_0x317d46['include']=[{'all':!![]}];}return db[_0x12b8('0x2b')][_0x12b8('0x41')](_0x317d46);})[_0x12b8('0x26')](function(_0x28cd2e){_0x36446c[_0x12b8('0x42')]=_0x28cd2e;return _0x36446c;})[_0x12b8('0x26')](respondWithFilteredResult(_0x51dbee,_0x317d46))[_0x12b8('0x43')](handleError(_0x51dbee,null));};exports['show']=function(_0x1eda9a,_0x1931a7){var _0x18941a={'raw':![],'where':{'id':_0x1eda9a['params']['id']}},_0x13cf9c={};_0x13cf9c[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_0x12b8('0x2b')]['rawAttributes']);_0x13cf9c[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x1eda9a['query']);_0x13cf9c[_0x12b8('0x31')]=_['intersection'](_0x13cf9c[_0x12b8('0x33')],_0x13cf9c[_0x12b8('0x2f')]);_0x18941a['attributes']=_[_0x12b8('0x32')](_0x13cf9c[_0x12b8('0x33')],qs[_0x12b8('0x35')](_0x1eda9a[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x18941a[_0x12b8('0x34')]=_0x18941a[_0x12b8('0x34')][_0x12b8('0x36')]?_0x18941a[_0x12b8('0x34')]:_0x13cf9c[_0x12b8('0x33')];if(_0x1eda9a[_0x12b8('0x2f')]['includeAll']){_0x18941a[_0x12b8('0x44')]=[{'all':!![]}];}_0x18941a=_[_0x12b8('0x3e')]({},_0x18941a,_0x1eda9a[_0x12b8('0x3f')]);return db[_0x12b8('0x2b')][_0x12b8('0x45')](_0x18941a)['then'](handleEntityNotFound(_0x1931a7,null))[_0x12b8('0x26')](respondWithResult(_0x1931a7,null))[_0x12b8('0x43')](handleError(_0x1931a7,null));};exports[_0x12b8('0x46')]=function(_0x2be0ff,_0x1c1adf){return db[_0x12b8('0x2b')]['create'](_0x2be0ff[_0x12b8('0x47')],{})[_0x12b8('0x26')](function(_0xe56c43){var _0x105949=_0x2be0ff[_0x12b8('0x48')][_0x12b8('0x49')]({'plain':!![]});if(!_0x105949)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105949[_0x12b8('0x4a')]===_0x12b8('0x48')){var _0x12b736=_0xe56c43['get']({'plain':!![]});var _0x255e7f=_0x12b8('0x4b');return db[_0x12b8('0x4c')][_0x12b8('0x45')]({'where':{'name':_0x255e7f,'userProfileId':_0x105949[_0x12b8('0x4d')]},'raw':!![]})['then'](function(_0x5ebbca){if(_0x5ebbca&&_0x5ebbca[_0x12b8('0x4e')]===0x0){return db[_0x12b8('0x4f')][_0x12b8('0x46')]({'name':_0x12b736['name'],'resourceId':_0x12b736['id'],'type':_0x5ebbca['name'],'sectionId':_0x5ebbca['id']},{})[_0x12b8('0x26')](function(){return _0xe56c43;});}else{return _0xe56c43;}})[_0x12b8('0x43')](function(_0x934ba6){logger[_0x12b8('0x50')](_0x12b8('0x51'),_0x934ba6);throw _0x934ba6;});}return _0xe56c43;})['then'](respondWithResult(_0x1c1adf,0xc9))['catch'](handleError(_0x1c1adf,null));};exports[_0x12b8('0x52')]=function(_0x29af0d,_0x4f1c5c){if(_0x29af0d[_0x12b8('0x47')]['id']){delete _0x29af0d[_0x12b8('0x47')]['id'];}return db[_0x12b8('0x2b')]['find']({'where':{'id':_0x29af0d[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0x4f1c5c,null))[_0x12b8('0x26')](saveUpdates(_0x29af0d['body'],null))[_0x12b8('0x26')](respondWithResult(_0x4f1c5c,null))[_0x12b8('0x43')](handleError(_0x4f1c5c,null));};exports[_0x12b8('0x54')]=function(_0x120482,_0x1f5573){var _0xeacf5=_0x120482[_0x12b8('0x53')]['id'];var _0x20a2b1=[];return db[_0x12b8('0x55')][_0x12b8('0x56')](function(_0x571e96){var _0x33c554=_0x12b8('0x57')+_0xeacf5;return db[_0x12b8('0x55')]['query'](_0x33c554,{'type':db[_0x12b8('0x58')]['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96})[_0x12b8('0x26')](function(_0x4374d6){_0x20a2b1=_['map'](_0x4374d6,function(_0x216813){return Number(_0x216813[_0x12b8('0x5a')]);});})['then'](function(){var _0x1015b7=_0x12b8('0x5b')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x1015b7,{'type':db['Sequelize']['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x579363){var _0x361840=_[_0x12b8('0x2a')](_0x579363,function(_0x227502){return Number(_0x227502[_0x12b8('0x5c')]);});return db[_0x12b8('0x5d')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'VoiceQueueId':{'$in':_0x361840}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x2ba9a4=_0x12b8('0x5e')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x2ba9a4,{'type':db[_0x12b8('0x58')]['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x1bb6d4){var _0x1b95b0=_[_0x12b8('0x2a')](_0x1bb6d4,function(_0x53ec0f){return Number(_0x53ec0f[_0x12b8('0x5f')]);});return db[_0x12b8('0x60')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'MailQueueId':{'$in':_0x1b95b0}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x59ff3e=_0x12b8('0x61')+_0xeacf5;return db[_0x12b8('0x55')]['query'](_0x59ff3e,{'type':db['Sequelize'][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x480197){var _0x44b408=_[_0x12b8('0x2a')](_0x480197,function(_0x1022aa){return Number(_0x1022aa[_0x12b8('0x63')]);});return db[_0x12b8('0x64')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'SmsQueueId':{'$in':_0x44b408}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x40be9c=_0x12b8('0x65')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x40be9c,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')]['SELECT'],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x1b32db){var _0x2705b3=_[_0x12b8('0x2a')](_0x1b32db,function(_0x35e17a){return Number(_0x35e17a[_0x12b8('0x66')]);});return db[_0x12b8('0x67')]['destroy']({'where':{'UserId':{'$in':_0x20a2b1},'ChatQueueId':{'$in':_0x2705b3}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x26e731=_0x12b8('0x68')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x26e731,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x9b5882){var _0x571de2=_['map'](_0x9b5882,function(_0x5cac32){return Number(_0x5cac32[_0x12b8('0x69')]);});return db[_0x12b8('0x6a')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'FaxQueueId':{'$in':_0x571de2}},'transaction':_0x571e96});})['then'](function(){var _0x3e277f=_0x12b8('0x6b')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x3e277f,{'type':db['Sequelize']['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x42e8be){var _0x39c181=_[_0x12b8('0x2a')](_0x42e8be,function(_0x416c23){return Number(_0x416c23[_0x12b8('0x6c')]);});return db[_0x12b8('0x6d')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'OpenchannelQueueId':{'$in':_0x39c181}},'transaction':_0x571e96});})['then'](function(){var _0x52a078=_0x12b8('0x6e')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x52a078,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x40a984){var _0x3af680=_[_0x12b8('0x2a')](_0x40a984,function(_0x29912b){return Number(_0x29912b['WhatsappQueueId']);});return db[_0x12b8('0x6f')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'WhatsappQueueId':{'$in':_0x3af680}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x70')][_0x12b8('0x45')]({'where':{'TeamId':_0xeacf5}});})[_0x12b8('0x26')](function(_0x4d094f){if(_0x4d094f===null){return;}return db[_0x12b8('0x71')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'VoicePrefixId':_0x4d094f[_0x12b8('0x72')]},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x2b')]['destroy']({'where':{'id':_0xeacf5},'cascade':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x2ea66e){if(_0x2ea66e===0x0){_0x1f5573['sendStatus'](0x194);}else{return db[_0x12b8('0x4f')][_0x12b8('0x54')]({'where':{'type':_0x12b8('0x4b'),'resourceId':_0xeacf5},'cascade':!![],'transaction':_0x571e96})[_0x12b8('0x26')](function(){_0x1f5573[_0x12b8('0x1c')](0xcc)['end']();});}})['catch'](function(_0x25b044){_0x1f5573['status'](0x1f4)[_0x12b8('0x73')](_0x25b044);});});};exports[_0x12b8('0x74')]=function(_0x3261f7,_0x3173e7,_0x8d3d4){return db[_0x12b8('0x2b')]['findOne']({'where':{'id':_0x3261f7[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0x3173e7,null))['then'](function(_0x63cf5){if(!_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')]||!utils[_0x12b8('0x76')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}var _0x3f733e={};var _0x40455a={};_0x40455a[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_['capitalize'](_0x3261f7['query']['channel']['toLowerCase']())+_0x12b8('0x79')][_0x12b8('0x2c')]);_0x40455a[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x3261f7[_0x12b8('0x2f')]);_0x40455a[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x40455a[_0x12b8('0x33')],_0x40455a['query']);_0x3f733e[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x40455a['model'],qs[_0x12b8('0x35')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x3f733e['attributes']=_0x3f733e['attributes']['length']?_0x3f733e['attributes']:_0x40455a[_0x12b8('0x33')];_0x3f733e[_0x12b8('0x38')]=qs[_0x12b8('0x38')](_0x3261f7[_0x12b8('0x2f')]['limit']);_0x3f733e[_0x12b8('0x1f')]=qs[_0x12b8('0x1f')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x1f')]);_0x3f733e[_0x12b8('0x39')]=qs['sort'](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x3f733e[_0x12b8('0x3d')]=qs[_0x12b8('0x31')](_[_0x12b8('0x3b')](_0x3261f7[_0x12b8('0x2f')],_0x40455a['filters']));_0x3f733e=_[_0x12b8('0x3e')]({},_0x3f733e,_0x3261f7[_0x12b8('0x3f')]);return _0x63cf5[_0x12b8('0x49')+_[_0x12b8('0x7a')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')]['toLowerCase']())+_0x12b8('0x7b')](_0x3f733e);})[_0x12b8('0x26')](respondWithResult(_0x3173e7,null))[_0x12b8('0x43')](handleError(_0x3173e7,null));};exports[_0x12b8('0x7c')]=function(_0x37bfef,_0xb013e1,_0xcd95b4){return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x37bfef['params']['id']}})[_0x12b8('0x26')](function(_0x5f97b4){if(_0x5f97b4){if(!_0x37bfef[_0x12b8('0x47')]['channel']||!utils[_0x12b8('0x76')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}return _0x5f97b4['add'+_[_0x12b8('0x7a')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x75')][_0x12b8('0x7e')]())+_0x12b8('0x7b')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x7f')]);}return null;})['then'](handleEntityNotFound(_0xb013e1,null))['then'](respondWithStatusCode(_0xb013e1,null))['catch'](handleError(_0xb013e1,null));};exports[_0x12b8('0x80')]=function(_0x3ed924,_0x3c470a,_0x254897){return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x3ed924[_0x12b8('0x53')]['id']}})['then'](function(_0x2b6e1f){if(_0x2b6e1f){if(!_0x3ed924[_0x12b8('0x2f')]['channel']||!utils[_0x12b8('0x76')](_0x3ed924[_0x12b8('0x2f')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}return _0x2b6e1f[_0x12b8('0x81')+_[_0x12b8('0x7a')](_0x3ed924['query'][_0x12b8('0x75')]['toLowerCase']())+_0x12b8('0x7b')](_0x3ed924[_0x12b8('0x2f')]['ids']);}return null;})[_0x12b8('0x26')](handleEntityNotFound(_0x3c470a,null))[_0x12b8('0x26')](respondWithStatusCode(_0x3c470a,null))['catch'](handleError(_0x3c470a,null));};exports[_0x12b8('0x82')]=function(_0x244713,_0x25836b){var _0x666da1=_[_0x12b8('0x83')](_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')])?_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')]:[_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')]];var _0x598c47=_0x244713[_0x12b8('0x53')]['id'];return db[_0x12b8('0x2b')][_0x12b8('0x45')]({'where':{'id':_0x598c47}})['then'](handleEntityNotFound(_0x25836b,null))[_0x12b8('0x26')](function(_0x201e4a){if(_0x201e4a){var _0x2e2018=[_0x12b8('0x84'),_0x12b8('0x85'),_0x12b8('0x86'),'Sms',_0x12b8('0x87'),_0x12b8('0x88'),_0x12b8('0x89')];return db[_0x12b8('0x55')]['transaction'](function(_0x884699){var _0x254d81=_[_0x12b8('0x2a')](_0x2e2018,function(_0x4b6ef4){var _0x502639={'attributes':['id',_0x12b8('0x28')]};if(_0x4b6ef4===_0x12b8('0x84')){_0x502639[_0x12b8('0x8a')]={'attributes':[_0x12b8('0x8b')]};}return _0x201e4a[_0x12b8('0x49')+_0x4b6ef4+'Queues'](_0x502639)[_0x12b8('0x26')](function(_0x894304){var _0x205932=_['map'](_0x894304,function(_0x4f9f6e){var _0x4b1464=_[_0x12b8('0x2a')](_0x666da1,function(_0x315a3f){var _0x580214={'where':{'UserId':_0x315a3f,[_0x4b6ef4+_0x12b8('0x8c')]:_0x4f9f6e['id']},'transaction':_0x884699};if(_0x4b6ef4===_0x12b8('0x84')){_0x580214[_0x12b8('0x19')]={'penalty':_0x4f9f6e[_0x12b8('0x8d')][_0x12b8('0x8b')]};}return db['User'+_0x4b6ef4+_0x12b8('0x79')][_0x12b8('0x8e')](_0x580214)['then'](function(){socket[_0x12b8('0x8f')](_0x12b8('0x48')+_0x4b6ef4+_0x12b8('0x90'),{'UserId':_0x315a3f,[_0x4b6ef4+_0x12b8('0x8c')]:_0x4f9f6e['id']});if(_0x4b6ef4!==_0x12b8('0x84')){return;}return db['User'][_0x12b8('0x41')]({'where':{'id':_0x666da1,'online':0x1},'attributes':['id',_0x12b8('0x28'),_0x12b8('0x91'),_0x12b8('0x92'),_0x12b8('0x93')],'raw':!![]})['then'](function(_0x49c3ac){var _0x58abb5=_[_0x12b8('0x2a')](_0x49c3ac,function(_0x7b51b2){return db[_0x12b8('0x94')][_0x12b8('0x95')]({'membername':_0x7b51b2[_0x12b8('0x28')],'UserId':_0x7b51b2['id'],'queue_name':_0x4f9f6e['name'],'VoiceQueueId':_0x4f9f6e['id'],'interface':_[_0x12b8('0x96')](_0x7b51b2[_0x12b8('0x93')])?util[_0x12b8('0x97')](_0x12b8('0x98'),_0x7b51b2['name']):_0x7b51b2[_0x12b8('0x93')],'paused':_0x7b51b2[_0x12b8('0x92')]||![],'penalty':_0x4f9f6e['TeamVoiceQueue'][_0x12b8('0x8b')]},{'transaction':_0x884699});});return Promise[_0x12b8('0x99')](_0x58abb5);});});});return Promise['all'](_0x4b1464);});return Promise['all'](_0x205932);})['then'](function(){return db[_0x12b8('0x70')][_0x12b8('0x7d')]({'where':{'teamId':_0x598c47}})['then'](function(_0x32d23e){if(_0x32d23e){var _0x3c6d06=_[_0x12b8('0x2a')](_0x666da1,function(_0x4a990e){db['UserVoicePrefix']['upsert']({'UserId':_0x4a990e,'VoicePrefixId':_0x32d23e['VoicePrefixId']});});return Promise[_0x12b8('0x99')](_0x3c6d06);}});});});return Promise[_0x12b8('0x99')](_0x254d81)['then'](function(){return _0x201e4a[_0x12b8('0x82')](_0x666da1,{'transaction':_0x884699})[_0x12b8('0x9a')](function(_0x5a7d98){return _0x5a7d98;});});});}})[_0x12b8('0x26')](respondWithResult(_0x25836b,null))[_0x12b8('0x43')](handleError(_0x25836b,null));};exports[_0x12b8('0x9b')]=function(_0x15ff51,_0x264ff0){var _0x57f442=_[_0x12b8('0x83')](_0x15ff51[_0x12b8('0x2f')][_0x12b8('0x7f')])?_0x15ff51[_0x12b8('0x2f')][_0x12b8('0x7f')]:[_0x15ff51['query'][_0x12b8('0x7f')]];var _0x9ba81e=_0x15ff51[_0x12b8('0x53')]['id'];return db[_0x12b8('0x2b')][_0x12b8('0x45')]({'where':{'id':_0x9ba81e}})[_0x12b8('0x26')](handleEntityNotFound(_0x264ff0,null))[_0x12b8('0x26')](function(_0x277093){if(_0x277093){var _0x5da14c=[_0x12b8('0x84'),_0x12b8('0x85'),_0x12b8('0x86'),_0x12b8('0x9c'),_0x12b8('0x87'),_0x12b8('0x88'),_0x12b8('0x89')];return db[_0x12b8('0x55')][_0x12b8('0x56')](function(_0x2de3b1){var _0x336f54=_['map'](_0x5da14c,function(_0x3690f6){var _0x51a2b2={'attributes':['id',_0x12b8('0x28')]};return _0x277093[_0x12b8('0x49')+_0x3690f6+_0x12b8('0x7b')](_0x51a2b2)[_0x12b8('0x26')](function(_0x43ae83){var _0x10b255=_[_0x12b8('0x2a')](_0x43ae83,function(_0x1867d8){return _0x1867d8[_0x12b8('0x9b')](_0x57f442,{'transaction':_0x2de3b1})[_0x12b8('0x26')](function(){var _0x408cf0=_[_0x12b8('0x2a')](_0x57f442,function(_0x35e4e3){socket['emit'](_0x12b8('0x48')+_0x3690f6+_0x12b8('0x9d'),{'UserId':Number(_0x35e4e3),[_0x3690f6+_0x12b8('0x8c')]:_0x1867d8['id']});if(_0x3690f6!==_0x12b8('0x84')){return;}return db['UserVoiceQueueRt'][_0x12b8('0x54')]({'where':{'VoiceQueueId':_0x1867d8['id'],'UserId':_0x35e4e3},'transaction':_0x2de3b1});});return Promise[_0x12b8('0x99')](_0x408cf0);});});return Promise[_0x12b8('0x99')](_0x10b255);});});return Promise[_0x12b8('0x99')](_0x336f54)['then'](function(){return _0x277093['removeAgents'](_0x57f442,{'transaction':_0x2de3b1});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x70')][_0x12b8('0x7d')]({'where':{'teamId':_0x9ba81e}})['then'](function(_0x484cac){if(_0x484cac){var _0x3b490e=_[_0x12b8('0x2a')](_0x57f442,function(_0x7b5658){db['UserVoicePrefix'][_0x12b8('0x54')]({'where':{'UserId':_0x7b5658,'VoicePrefixId':_0x484cac[_0x12b8('0x72')]}});});return Promise['all'](_0x3b490e);}});});});}})[_0x12b8('0x26')](respondWithStatusCode(_0x264ff0,null))[_0x12b8('0x43')](handleError(_0x264ff0,null));};exports[_0x12b8('0x9e')]=function(_0x5e8bee,_0xb1855a,_0x1bb2c3){var _0x99336e={};var _0x231c17={};var _0x2b9ea5;var _0x148503;return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x5e8bee[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0xb1855a,null))[_0x12b8('0x26')](function(_0x46f11a){if(_0x46f11a){_0x2b9ea5=_0x46f11a;_0x231c17[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_0x12b8('0x9f')][_0x12b8('0x2c')]);_0x231c17['query']=_[_0x12b8('0x30')](_0x5e8bee['query']);_0x231c17[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x231c17[_0x12b8('0x33')],_0x231c17[_0x12b8('0x2f')]);_0x99336e[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x231c17['model'],qs['fields'](_0x5e8bee[_0x12b8('0x2f')]['fields']));_0x99336e[_0x12b8('0x34')]=_0x99336e['attributes'][_0x12b8('0x36')]?_0x99336e[_0x12b8('0x34')]:_0x231c17[_0x12b8('0x33')];_0x99336e[_0x12b8('0x39')]=qs[_0x12b8('0x3a')](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x99336e['where']=qs['filters'](_[_0x12b8('0x3b')](_0x5e8bee[_0x12b8('0x2f')],_0x231c17['filters']));if(_0x5e8bee[_0x12b8('0x2f')]['filter']){_0x99336e[_0x12b8('0x3d')]=_[_0x12b8('0x3e')](_0x99336e[_0x12b8('0x3d')],{'$or':_[_0x12b8('0x2a')](_0x99336e[_0x12b8('0x34')],function(_0x25170a){var _0x3568d4={};_0x3568d4[_0x25170a]={'$like':'%'+_0x5e8bee[_0x12b8('0x2f')]['filter']+'%'};return _0x3568d4;})});}_0x99336e=_[_0x12b8('0x3e')]({},_0x99336e,_0x5e8bee[_0x12b8('0x3f')]);return _0x2b9ea5[_0x12b8('0x9e')](_0x99336e);}})[_0x12b8('0x26')](function(_0x252b36){if(_0x252b36){_0x148503=_0x252b36[_0x12b8('0x36')];if(!_0x5e8bee['query'][_0x12b8('0x37')]('nolimit')){_0x99336e[_0x12b8('0x38')]=qs['limit'](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x38')]);_0x99336e[_0x12b8('0x1f')]=qs['offset'](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x1f')]);}return _0x2b9ea5[_0x12b8('0x9e')](_0x99336e);}})['then'](function(_0x4f0e8a){if(_0x4f0e8a){return _0x4f0e8a?{'count':_0x148503,'rows':_0x4f0e8a}:null;}})[_0x12b8('0x26')](respondWithResult(_0xb1855a,null))['catch'](handleError(_0xb1855a,null));}; \ No newline at end of file +var _0x7ed1=['nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','isValidChannel','ids','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','all','upsert','removeAgents','Whatsapp','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','error','name','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1b4170,_0x3ca8b1){var _0x39cb98=function(_0x3770bc){while(--_0x3770bc){_0x1b4170['push'](_0x1b4170['shift']());}};_0x39cb98(++_0x3ca8b1);}(_0x7ed1,0xf6));var _0x17ed=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7ed1[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x17ed('0x0'));var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require(_0x17ed('0x7'));var util=require(_0x17ed('0x8'));var path=require(_0x17ed('0x9'));var sox=require(_0x17ed('0xa'));var csv=require(_0x17ed('0xb'));var ejs=require(_0x17ed('0xc'));var fs=require('fs');var fs_extra=require(_0x17ed('0xd'));var _=require(_0x17ed('0xe'));var squel=require(_0x17ed('0xf'));var crypto=require(_0x17ed('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x17ed('0x11'));var toCsv=require(_0x17ed('0xb'));var querystring=require(_0x17ed('0x12'));var Papa=require(_0x17ed('0x13'));var Redis=require(_0x17ed('0x14'));var authService=require(_0x17ed('0x15'));var qs=require(_0x17ed('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17ed('0x17'));var logger=require('../../config/logger')(_0x17ed('0x18'));var utils=require(_0x17ed('0x19'));var config=require(_0x17ed('0x1a'));var licenseUtil=require(_0x17ed('0x1b'));var db=require(_0x17ed('0x1c'))['db'];config[_0x17ed('0x1d')]=_['defaults'](config[_0x17ed('0x1d')],{'host':_0x17ed('0x1e'),'port':0x18eb});var socket=require(_0x17ed('0x1f'))(new Redis(config[_0x17ed('0x1d')]));require('./team.socket')[_0x17ed('0x20')](socket);function respondWithStatusCode(_0x12bb62,_0x4f187b){_0x4f187b=_0x4f187b||0xcc;return function(_0x1b4db9){if(_0x1b4db9){return _0x12bb62[_0x17ed('0x21')](_0x4f187b);}return _0x12bb62[_0x17ed('0x22')](_0x4f187b)[_0x17ed('0x23')]();};}function respondWithResult(_0x261e36,_0x14ae41){_0x14ae41=_0x14ae41||0xc8;return function(_0x21b2e2){if(_0x21b2e2){return _0x261e36['status'](_0x14ae41)['json'](_0x21b2e2);}};}function respondWithFilteredResult(_0x96050e,_0x2cdf6b){return function(_0x45beb6){if(_0x45beb6){var _0x521dc2=typeof _0x2cdf6b[_0x17ed('0x24')]==='undefined'&&typeof _0x2cdf6b['limit']===_0x17ed('0x25');var _0x2e8ecb=_0x45beb6[_0x17ed('0x26')];var _0x50083f=_0x521dc2?0x0:_0x2cdf6b['offset'];var _0x49275e=_0x521dc2?_0x45beb6[_0x17ed('0x26')]:_0x2cdf6b[_0x17ed('0x24')]+_0x2cdf6b[_0x17ed('0x27')];var _0x374b5c;if(_0x49275e>=_0x2e8ecb){_0x49275e=_0x2e8ecb;_0x374b5c=0xc8;}else{_0x374b5c=0xce;}_0x96050e[_0x17ed('0x22')](_0x374b5c);return _0x96050e['set'](_0x17ed('0x28'),_0x50083f+'-'+_0x49275e+'/'+_0x2e8ecb)[_0x17ed('0x29')](_0x45beb6);}return null;};}function patchUpdates(_0x20fdd6){return function(_0x7e8b54){try{jsonpatch[_0x17ed('0x2a')](_0x7e8b54,_0x20fdd6,!![]);}catch(_0x34e676){return BPromise[_0x17ed('0x2b')](_0x34e676);}return _0x7e8b54[_0x17ed('0x2c')]();};}function saveUpdates(_0x10122a,_0xf16e62){return function(_0x1db47e){if(_0x1db47e){return _0x1db47e[_0x17ed('0x2d')](_0x10122a)[_0x17ed('0x2e')](function(_0x39f17c){return _0x39f17c;});}return null;};}function handleEntityNotFound(_0x3ee8c9,_0x45a9c3){return function(_0x1c7f36){if(!_0x1c7f36){_0x3ee8c9['sendStatus'](0x194);}return _0x1c7f36;};}function handleError(_0x2449b3,_0x5979e8){_0x5979e8=_0x5979e8||0x1f4;return function(_0x8d13ca){logger[_0x17ed('0x2f')](_0x8d13ca['stack']);if(_0x8d13ca['name']){delete _0x8d13ca[_0x17ed('0x30')];}_0x2449b3[_0x17ed('0x22')](_0x5979e8)['send'](_0x8d13ca);};}exports[_0x17ed('0x31')]=function(_0x349ea3,_0x51d371){var _0x4f94cc={},_0xf6ee3e={},_0x582ee3={'count':0x0,'rows':[]};var _0x34cae5=_[_0x17ed('0x32')](db[_0x17ed('0x33')][_0x17ed('0x34')],function(_0x34455b){return{'name':_0x34455b[_0x17ed('0x35')],'type':_0x34455b['type'][_0x17ed('0x36')]};});_0xf6ee3e[_0x17ed('0x37')]=_[_0x17ed('0x32')](_0x34cae5,'name');_0xf6ee3e[_0x17ed('0x38')]=_[_0x17ed('0x39')](_0x349ea3[_0x17ed('0x38')]);_0xf6ee3e[_0x17ed('0x3a')]=_[_0x17ed('0x3b')](_0xf6ee3e['model'],_0xf6ee3e['query']);_0x4f94cc[_0x17ed('0x3c')]=_[_0x17ed('0x3b')](_0xf6ee3e['model'],qs[_0x17ed('0x3d')](_0x349ea3[_0x17ed('0x38')][_0x17ed('0x3d')]));_0x4f94cc[_0x17ed('0x3c')]=_0x4f94cc[_0x17ed('0x3c')][_0x17ed('0x3e')]?_0x4f94cc['attributes']:_0xf6ee3e[_0x17ed('0x37')];if(!_0x349ea3[_0x17ed('0x38')][_0x17ed('0x3f')](_0x17ed('0x40'))){_0x4f94cc[_0x17ed('0x27')]=qs[_0x17ed('0x27')](_0x349ea3[_0x17ed('0x38')][_0x17ed('0x27')]);_0x4f94cc[_0x17ed('0x24')]=qs['offset'](_0x349ea3[_0x17ed('0x38')][_0x17ed('0x24')]);}_0x4f94cc['order']=qs['sort'](_0x349ea3['query'][_0x17ed('0x41')]);_0x4f94cc['where']=qs[_0x17ed('0x3a')](_[_0x17ed('0x42')](_0x349ea3[_0x17ed('0x38')],_0xf6ee3e[_0x17ed('0x3a')]),_0x34cae5);if(_0x349ea3[_0x17ed('0x38')]['filter']){_0x4f94cc[_0x17ed('0x43')]=_[_0x17ed('0x44')](_0x4f94cc[_0x17ed('0x43')],{'$or':_[_0x17ed('0x32')](_0x34cae5,function(_0x1f686e){if(_0x1f686e[_0x17ed('0x45')]!==_0x17ed('0x46')){var _0xde56b9={};_0xde56b9[_0x1f686e[_0x17ed('0x30')]]={'$like':'%'+_0x349ea3['query'][_0x17ed('0x47')]+'%'};return _0xde56b9;}})});}_0x4f94cc=_[_0x17ed('0x44')]({},_0x4f94cc,_0x349ea3[_0x17ed('0x48')]);var _0x53bac0={'where':_0x4f94cc[_0x17ed('0x43')]};return db[_0x17ed('0x33')][_0x17ed('0x26')](_0x53bac0)[_0x17ed('0x2e')](function(_0x4c0c23){_0x582ee3[_0x17ed('0x26')]=_0x4c0c23;if(_0x349ea3[_0x17ed('0x38')][_0x17ed('0x49')]){_0x4f94cc[_0x17ed('0x4a')]=[{'all':!![]}];}return db['Team'][_0x17ed('0x4b')](_0x4f94cc);})[_0x17ed('0x2e')](function(_0x1c2552){_0x582ee3[_0x17ed('0x4c')]=_0x1c2552;return _0x582ee3;})[_0x17ed('0x2e')](respondWithFilteredResult(_0x51d371,_0x4f94cc))[_0x17ed('0x4d')](handleError(_0x51d371,null));};exports[_0x17ed('0x4e')]=function(_0x329d5b,_0x356259){var _0x3854fe={'raw':![],'where':{'id':_0x329d5b[_0x17ed('0x4f')]['id']}},_0x3fbe23={};_0x3fbe23[_0x17ed('0x37')]=_[_0x17ed('0x39')](db[_0x17ed('0x33')]['rawAttributes']);_0x3fbe23[_0x17ed('0x38')]=_[_0x17ed('0x39')](_0x329d5b[_0x17ed('0x38')]);_0x3fbe23[_0x17ed('0x3a')]=_[_0x17ed('0x3b')](_0x3fbe23[_0x17ed('0x37')],_0x3fbe23[_0x17ed('0x38')]);_0x3854fe[_0x17ed('0x3c')]=_[_0x17ed('0x3b')](_0x3fbe23[_0x17ed('0x37')],qs[_0x17ed('0x3d')](_0x329d5b[_0x17ed('0x38')][_0x17ed('0x3d')]));_0x3854fe[_0x17ed('0x3c')]=_0x3854fe['attributes']['length']?_0x3854fe[_0x17ed('0x3c')]:_0x3fbe23['model'];if(_0x329d5b[_0x17ed('0x38')][_0x17ed('0x49')]){_0x3854fe[_0x17ed('0x4a')]=[{'all':!![]}];}_0x3854fe=_[_0x17ed('0x44')]({},_0x3854fe,_0x329d5b[_0x17ed('0x48')]);return db[_0x17ed('0x33')]['find'](_0x3854fe)['then'](handleEntityNotFound(_0x356259,null))[_0x17ed('0x2e')](respondWithResult(_0x356259,null))[_0x17ed('0x4d')](handleError(_0x356259,null));};exports[_0x17ed('0x50')]=function(_0x2e271d,_0x18d4e2){return db[_0x17ed('0x33')][_0x17ed('0x50')](_0x2e271d['body'],{})['then'](function(_0x28bbc8){var _0x168ee5=_0x2e271d[_0x17ed('0x51')][_0x17ed('0x52')]({'plain':!![]});if(!_0x168ee5)throw new Error(_0x17ed('0x53'));if(_0x168ee5[_0x17ed('0x54')]===_0x17ed('0x51')){var _0x5a192a=_0x28bbc8['get']({'plain':!![]});var _0x22f07d=_0x17ed('0x55');return db[_0x17ed('0x56')][_0x17ed('0x57')]({'where':{'name':_0x22f07d,'userProfileId':_0x168ee5[_0x17ed('0x58')]},'raw':!![]})[_0x17ed('0x2e')](function(_0x512fbb){if(_0x512fbb&&_0x512fbb['autoAssociation']===0x0){return db['UserProfileResource'][_0x17ed('0x50')]({'name':_0x5a192a[_0x17ed('0x30')],'resourceId':_0x5a192a['id'],'type':_0x512fbb[_0x17ed('0x30')],'sectionId':_0x512fbb['id']},{})[_0x17ed('0x2e')](function(){return _0x28bbc8;});}else{return _0x28bbc8;}})[_0x17ed('0x4d')](function(_0x69f975){logger[_0x17ed('0x2f')](_0x17ed('0x59'),_0x69f975);throw _0x69f975;});}return _0x28bbc8;})[_0x17ed('0x2e')](respondWithResult(_0x18d4e2,0xc9))[_0x17ed('0x4d')](handleError(_0x18d4e2,null));};exports[_0x17ed('0x2d')]=function(_0x2c68d0,_0x1a3659){if(_0x2c68d0[_0x17ed('0x5a')]['id']){delete _0x2c68d0[_0x17ed('0x5a')]['id'];}return db[_0x17ed('0x33')][_0x17ed('0x57')]({'where':{'id':_0x2c68d0[_0x17ed('0x4f')]['id']}})[_0x17ed('0x2e')](handleEntityNotFound(_0x1a3659,null))[_0x17ed('0x2e')](saveUpdates(_0x2c68d0['body'],null))[_0x17ed('0x2e')](respondWithResult(_0x1a3659,null))['catch'](handleError(_0x1a3659,null));};exports['destroy']=function(_0x1d9eae,_0x57d314){var _0x5a3098=_0x1d9eae[_0x17ed('0x4f')]['id'];var _0x4bcf10=[];return db[_0x17ed('0x5b')]['transaction'](function(_0x370d12){var _0x10f2ab=_0x17ed('0x5c')+_0x5a3098;return db[_0x17ed('0x5b')][_0x17ed('0x38')](_0x10f2ab,{'type':db[_0x17ed('0x5d')]['QueryTypes'][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12})[_0x17ed('0x2e')](function(_0x2d9880){_0x4bcf10=_[_0x17ed('0x32')](_0x2d9880,function(_0x929195){return Number(_0x929195[_0x17ed('0x5f')]);});})[_0x17ed('0x2e')](function(){var _0x33a3c8=_0x17ed('0x60')+_0x5a3098;return db[_0x17ed('0x5b')]['query'](_0x33a3c8,{'type':db[_0x17ed('0x5d')][_0x17ed('0x61')][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x84efee){var _0x2fb127=_['map'](_0x84efee,function(_0xefc5f3){return Number(_0xefc5f3[_0x17ed('0x62')]);});return db[_0x17ed('0x63')][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'VoiceQueueId':{'$in':_0x2fb127}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){var _0x1abf7c='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5a3098;return db['sequelize'][_0x17ed('0x38')](_0x1abf7c,{'type':db[_0x17ed('0x5d')][_0x17ed('0x61')]['SELECT'],'raw':!![],'transaction':_0x370d12});})['then'](function(_0x424e43){var _0x5bdecd=_[_0x17ed('0x32')](_0x424e43,function(_0x406344){return Number(_0x406344['MailQueueId']);});return db['UserMailQueue'][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'MailQueueId':{'$in':_0x5bdecd}},'transaction':_0x370d12});})['then'](function(){var _0x47967a='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5a3098;return db[_0x17ed('0x5b')][_0x17ed('0x38')](_0x47967a,{'type':db[_0x17ed('0x5d')]['QueryTypes'][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x28990c){var _0x293181=_[_0x17ed('0x32')](_0x28990c,function(_0x22fbf1){return Number(_0x22fbf1['SmsQueueId']);});return db['UserSmsQueue'][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'SmsQueueId':{'$in':_0x293181}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){var _0x40ddd1=_0x17ed('0x65')+_0x5a3098;return db['sequelize'][_0x17ed('0x38')](_0x40ddd1,{'type':db['Sequelize']['QueryTypes'][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x5975cd){var _0x43da3e=_['map'](_0x5975cd,function(_0x22865d){return Number(_0x22865d[_0x17ed('0x66')]);});return db[_0x17ed('0x67')][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'ChatQueueId':{'$in':_0x43da3e}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){var _0x4b8c48=_0x17ed('0x68')+_0x5a3098;return db[_0x17ed('0x5b')][_0x17ed('0x38')](_0x4b8c48,{'type':db[_0x17ed('0x5d')][_0x17ed('0x61')][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x4e7be2){var _0x2c515c=_[_0x17ed('0x32')](_0x4e7be2,function(_0x43876d){return Number(_0x43876d[_0x17ed('0x69')]);});return db[_0x17ed('0x6a')][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'FaxQueueId':{'$in':_0x2c515c}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){var _0x1d3d8b=_0x17ed('0x6b')+_0x5a3098;return db[_0x17ed('0x5b')][_0x17ed('0x38')](_0x1d3d8b,{'type':db[_0x17ed('0x5d')][_0x17ed('0x61')][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x2aa2e3){var _0x57700c=_[_0x17ed('0x32')](_0x2aa2e3,function(_0x18c2de){return Number(_0x18c2de[_0x17ed('0x6c')]);});return db['UserOpenchannelQueue'][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'OpenchannelQueueId':{'$in':_0x57700c}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){var _0x4e1f76=_0x17ed('0x6d')+_0x5a3098;return db['sequelize'][_0x17ed('0x38')](_0x4e1f76,{'type':db[_0x17ed('0x5d')]['QueryTypes'][_0x17ed('0x5e')],'raw':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x5d987d){var _0x2d36d2=_[_0x17ed('0x32')](_0x5d987d,function(_0x26bf1b){return Number(_0x26bf1b[_0x17ed('0x6e')]);});return db[_0x17ed('0x6f')][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'WhatsappQueueId':{'$in':_0x2d36d2}},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){return db[_0x17ed('0x70')][_0x17ed('0x57')]({'where':{'TeamId':_0x5a3098}});})[_0x17ed('0x2e')](function(_0x1d6c69){if(_0x1d6c69===null){return;}return db[_0x17ed('0x71')][_0x17ed('0x64')]({'where':{'UserId':{'$in':_0x4bcf10},'VoicePrefixId':_0x1d6c69[_0x17ed('0x72')]},'transaction':_0x370d12});})[_0x17ed('0x2e')](function(){return db[_0x17ed('0x33')]['destroy']({'where':{'id':_0x5a3098},'cascade':!![],'transaction':_0x370d12});})[_0x17ed('0x2e')](function(_0x479b09){if(_0x479b09===0x0){_0x57d314[_0x17ed('0x21')](0x194);}else{return db['UserProfileResource'][_0x17ed('0x64')]({'where':{'type':_0x17ed('0x55'),'resourceId':_0x5a3098},'cascade':!![],'transaction':_0x370d12})[_0x17ed('0x2e')](function(){_0x57d314[_0x17ed('0x22')](0xcc)['end']();});}})[_0x17ed('0x4d')](function(_0x131af7){_0x57d314[_0x17ed('0x22')](0x1f4)[_0x17ed('0x73')](_0x131af7);});});};exports['getQueues']=function(_0x1f73b1,_0x5e3efe,_0x541709){return db['Team'][_0x17ed('0x74')]({'where':{'id':_0x1f73b1[_0x17ed('0x4f')]['id']}})[_0x17ed('0x2e')](handleEntityNotFound(_0x5e3efe,null))['then'](function(_0x237f8b){if(!_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x75')]||!utils['isValidChannel'](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x75')])){throw new db[(_0x17ed('0x5d'))][(_0x17ed('0x76'))](_0x17ed('0x77'));}var _0x88d12c={};var _0x233739={};_0x233739[_0x17ed('0x37')]=_[_0x17ed('0x39')](db[_[_0x17ed('0x78')](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x75')][_0x17ed('0x79')]())+_0x17ed('0x7a')][_0x17ed('0x34')]);_0x233739[_0x17ed('0x38')]=_[_0x17ed('0x39')](_0x1f73b1[_0x17ed('0x38')]);_0x233739[_0x17ed('0x3a')]=_[_0x17ed('0x3b')](_0x233739['model'],_0x233739[_0x17ed('0x38')]);_0x88d12c[_0x17ed('0x3c')]=_[_0x17ed('0x3b')](_0x233739[_0x17ed('0x37')],qs['fields'](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x3d')]));_0x88d12c[_0x17ed('0x3c')]=_0x88d12c[_0x17ed('0x3c')][_0x17ed('0x3e')]?_0x88d12c[_0x17ed('0x3c')]:_0x233739[_0x17ed('0x37')];_0x88d12c['limit']=qs[_0x17ed('0x27')](_0x1f73b1['query'][_0x17ed('0x27')]);_0x88d12c['offset']=qs[_0x17ed('0x24')](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x24')]);_0x88d12c[_0x17ed('0x7b')]=qs[_0x17ed('0x41')](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x41')]);_0x88d12c[_0x17ed('0x43')]=qs[_0x17ed('0x3a')](_[_0x17ed('0x42')](_0x1f73b1[_0x17ed('0x38')],_0x233739['filters']));_0x88d12c=_[_0x17ed('0x44')]({},_0x88d12c,_0x1f73b1[_0x17ed('0x48')]);return _0x237f8b['get'+_[_0x17ed('0x78')](_0x1f73b1[_0x17ed('0x38')][_0x17ed('0x75')]['toLowerCase']())+_0x17ed('0x7c')](_0x88d12c);})[_0x17ed('0x2e')](respondWithResult(_0x5e3efe,null))[_0x17ed('0x4d')](handleError(_0x5e3efe,null));};exports[_0x17ed('0x7d')]=function(_0x2d8069,_0x3d9521,_0xf937c2){return db[_0x17ed('0x33')][_0x17ed('0x74')]({'where':{'id':_0x2d8069[_0x17ed('0x4f')]['id']}})[_0x17ed('0x2e')](function(_0x44f299){if(_0x44f299){if(!_0x2d8069[_0x17ed('0x5a')][_0x17ed('0x75')]||!utils[_0x17ed('0x7e')](_0x2d8069[_0x17ed('0x5a')][_0x17ed('0x75')])){throw new db[(_0x17ed('0x5d'))][(_0x17ed('0x76'))](_0x17ed('0x77'));}return _0x44f299['add'+_[_0x17ed('0x78')](_0x2d8069[_0x17ed('0x5a')]['channel'][_0x17ed('0x79')]())+_0x17ed('0x7c')](_0x2d8069[_0x17ed('0x5a')]['ids']);}return null;})[_0x17ed('0x2e')](handleEntityNotFound(_0x3d9521,null))[_0x17ed('0x2e')](respondWithStatusCode(_0x3d9521,null))['catch'](handleError(_0x3d9521,null));};exports['removeQueues']=function(_0x2a5e2c,_0x5a696c,_0x5afc9a){return db['Team'][_0x17ed('0x74')]({'where':{'id':_0x2a5e2c[_0x17ed('0x4f')]['id']}})['then'](function(_0x127275){if(_0x127275){if(!_0x2a5e2c['query'][_0x17ed('0x75')]||!utils[_0x17ed('0x7e')](_0x2a5e2c[_0x17ed('0x38')]['channel'])){throw new db[(_0x17ed('0x5d'))]['ValidationError'](_0x17ed('0x77'));}return _0x127275['remove'+_['capitalize'](_0x2a5e2c['query'][_0x17ed('0x75')][_0x17ed('0x79')]())+_0x17ed('0x7c')](_0x2a5e2c[_0x17ed('0x38')][_0x17ed('0x7f')]);}return null;})[_0x17ed('0x2e')](handleEntityNotFound(_0x5a696c,null))[_0x17ed('0x2e')](respondWithStatusCode(_0x5a696c,null))[_0x17ed('0x4d')](handleError(_0x5a696c,null));};exports[_0x17ed('0x80')]=function(_0x474868,_0xfc4ce5){var _0x52f93c=_[_0x17ed('0x81')](_0x474868['body'][_0x17ed('0x7f')])?_0x474868['body'][_0x17ed('0x7f')]:[_0x474868['body'][_0x17ed('0x7f')]];var _0x26abb1=_0x474868[_0x17ed('0x4f')]['id'];return db[_0x17ed('0x33')][_0x17ed('0x57')]({'where':{'id':_0x26abb1}})[_0x17ed('0x2e')](handleEntityNotFound(_0xfc4ce5,null))['then'](function(_0x3275c7){if(_0x3275c7){var _0x4ebb4e=[_0x17ed('0x82'),_0x17ed('0x83'),'Mail',_0x17ed('0x84'),_0x17ed('0x85'),_0x17ed('0x86'),'Whatsapp'];return db[_0x17ed('0x5b')][_0x17ed('0x87')](function(_0x15f913){var _0x208f4a=_[_0x17ed('0x32')](_0x4ebb4e,function(_0x549b6d){var _0x253052={'attributes':['id',_0x17ed('0x30')]};if(_0x549b6d==='Voice'){_0x253052[_0x17ed('0x88')]={'attributes':[_0x17ed('0x89')]};}return _0x3275c7['get'+_0x549b6d+_0x17ed('0x7c')](_0x253052)[_0x17ed('0x2e')](function(_0xbce117){var _0x2257a6=_[_0x17ed('0x32')](_0xbce117,function(_0x1e12f2){var _0x40ae4b=_[_0x17ed('0x32')](_0x52f93c,function(_0x5b66ad){var _0x8a2983={'where':{'UserId':_0x5b66ad,[_0x549b6d+'QueueId']:_0x1e12f2['id']},'transaction':_0x15f913};if(_0x549b6d===_0x17ed('0x82')){_0x8a2983['defaults']={'penalty':_0x1e12f2[_0x17ed('0x8a')]['penalty']};}return db[_0x17ed('0x8b')+_0x549b6d+'Queue'][_0x17ed('0x8c')](_0x8a2983)[_0x17ed('0x2e')](function(){socket['emit'](_0x17ed('0x51')+_0x549b6d+_0x17ed('0x8d'),{'UserId':_0x5b66ad,[_0x549b6d+'QueueId']:_0x1e12f2['id']});if(_0x549b6d!==_0x17ed('0x82')){return;}return db[_0x17ed('0x8b')][_0x17ed('0x4b')]({'where':{'id':_0x52f93c,'online':0x1},'attributes':['id','name',_0x17ed('0x8e'),_0x17ed('0x8f'),_0x17ed('0x90')],'raw':!![]})['then'](function(_0x2e9b95){var _0x433201=_['map'](_0x2e9b95,function(_0x574a5c){return db[_0x17ed('0x91')]['upsert']({'membername':_0x574a5c['name'],'UserId':_0x574a5c['id'],'queue_name':_0x1e12f2[_0x17ed('0x30')],'VoiceQueueId':_0x1e12f2['id'],'interface':_[_0x17ed('0x92')](_0x574a5c[_0x17ed('0x90')])?util[_0x17ed('0x93')]('SIP/%s',_0x574a5c[_0x17ed('0x30')]):_0x574a5c[_0x17ed('0x90')],'paused':_0x574a5c[_0x17ed('0x8f')]||![],'penalty':_0x1e12f2[_0x17ed('0x8a')][_0x17ed('0x89')]},{'transaction':_0x15f913});});return Promise[_0x17ed('0x94')](_0x433201);});});});return Promise[_0x17ed('0x94')](_0x40ae4b);});return Promise[_0x17ed('0x94')](_0x2257a6);})[_0x17ed('0x2e')](function(){return db['TeamVoicePrefix'][_0x17ed('0x74')]({'where':{'teamId':_0x26abb1}})['then'](function(_0x25a86f){if(_0x25a86f){var _0x9c1845=_[_0x17ed('0x32')](_0x52f93c,function(_0xbe8af3){db['UserVoicePrefix'][_0x17ed('0x95')]({'UserId':_0xbe8af3,'VoicePrefixId':_0x25a86f[_0x17ed('0x72')]});});return Promise[_0x17ed('0x94')](_0x9c1845);}});});});return Promise['all'](_0x208f4a)[_0x17ed('0x2e')](function(){return _0x3275c7[_0x17ed('0x80')](_0x52f93c,{'transaction':_0x15f913})['spread'](function(_0x52578c){return _0x52578c;});});});}})['then'](respondWithResult(_0xfc4ce5,null))[_0x17ed('0x4d')](handleError(_0xfc4ce5,null));};exports[_0x17ed('0x96')]=function(_0x25e927,_0x47d50c){var _0x4e53de=_[_0x17ed('0x81')](_0x25e927[_0x17ed('0x38')][_0x17ed('0x7f')])?_0x25e927[_0x17ed('0x38')][_0x17ed('0x7f')]:[_0x25e927[_0x17ed('0x38')][_0x17ed('0x7f')]];var _0x37f75a=_0x25e927['params']['id'];return db['Team'][_0x17ed('0x57')]({'where':{'id':_0x37f75a}})['then'](handleEntityNotFound(_0x47d50c,null))[_0x17ed('0x2e')](function(_0x24f82b){if(_0x24f82b){var _0x3443bd=[_0x17ed('0x82'),'Chat','Mail',_0x17ed('0x84'),_0x17ed('0x85'),'Openchannel',_0x17ed('0x97')];return db[_0x17ed('0x5b')][_0x17ed('0x87')](function(_0x359277){var _0x25eab7=_[_0x17ed('0x32')](_0x3443bd,function(_0x5603c3){var _0x4e00dc={'attributes':['id',_0x17ed('0x30')]};return _0x24f82b[_0x17ed('0x52')+_0x5603c3+_0x17ed('0x7c')](_0x4e00dc)[_0x17ed('0x2e')](function(_0x3bc34f){var _0x43433e=_[_0x17ed('0x32')](_0x3bc34f,function(_0x45f423){return _0x45f423[_0x17ed('0x96')](_0x4e53de,{'transaction':_0x359277})[_0x17ed('0x2e')](function(){var _0x419add=_[_0x17ed('0x32')](_0x4e53de,function(_0x35923d){socket[_0x17ed('0x98')](_0x17ed('0x51')+_0x5603c3+_0x17ed('0x99'),{'UserId':Number(_0x35923d),[_0x5603c3+'QueueId']:_0x45f423['id']});if(_0x5603c3!=='Voice'){return;}return db[_0x17ed('0x91')][_0x17ed('0x64')]({'where':{'VoiceQueueId':_0x45f423['id'],'UserId':_0x35923d},'transaction':_0x359277});});return Promise[_0x17ed('0x94')](_0x419add);});});return Promise['all'](_0x43433e);});});return Promise['all'](_0x25eab7)['then'](function(){return _0x24f82b['removeAgents'](_0x4e53de,{'transaction':_0x359277});})[_0x17ed('0x2e')](function(){return db[_0x17ed('0x70')][_0x17ed('0x74')]({'where':{'teamId':_0x37f75a}})['then'](function(_0x4e89f9){if(_0x4e89f9){var _0x39cd0d=_[_0x17ed('0x32')](_0x4e53de,function(_0x597153){db['UserVoicePrefix'][_0x17ed('0x64')]({'where':{'UserId':_0x597153,'VoicePrefixId':_0x4e89f9[_0x17ed('0x72')]}});});return Promise[_0x17ed('0x94')](_0x39cd0d);}});});});}})[_0x17ed('0x2e')](respondWithStatusCode(_0x47d50c,null))[_0x17ed('0x4d')](handleError(_0x47d50c,null));};exports[_0x17ed('0x9a')]=function(_0x32115f,_0x503454,_0x4bbd7b){var _0x2d9d9b={};var _0xbbbd99={};var _0xc35ff2;var _0x5a9e11;return db[_0x17ed('0x33')][_0x17ed('0x74')]({'where':{'id':_0x32115f['params']['id']}})['then'](handleEntityNotFound(_0x503454,null))[_0x17ed('0x2e')](function(_0xd81466){if(_0xd81466){_0xc35ff2=_0xd81466;_0xbbbd99[_0x17ed('0x37')]=_[_0x17ed('0x39')](db['User'][_0x17ed('0x34')]);_0xbbbd99[_0x17ed('0x38')]=_[_0x17ed('0x39')](_0x32115f[_0x17ed('0x38')]);_0xbbbd99[_0x17ed('0x3a')]=_[_0x17ed('0x3b')](_0xbbbd99[_0x17ed('0x37')],_0xbbbd99[_0x17ed('0x38')]);_0x2d9d9b[_0x17ed('0x3c')]=_[_0x17ed('0x3b')](_0xbbbd99['model'],qs[_0x17ed('0x3d')](_0x32115f[_0x17ed('0x38')]['fields']));_0x2d9d9b['attributes']=_0x2d9d9b[_0x17ed('0x3c')]['length']?_0x2d9d9b['attributes']:_0xbbbd99[_0x17ed('0x37')];_0x2d9d9b['order']=qs[_0x17ed('0x41')](_0x32115f['query'][_0x17ed('0x41')]);_0x2d9d9b[_0x17ed('0x43')]=qs[_0x17ed('0x3a')](_['pick'](_0x32115f[_0x17ed('0x38')],_0xbbbd99[_0x17ed('0x3a')]));if(_0x32115f[_0x17ed('0x38')][_0x17ed('0x47')]){_0x2d9d9b['where']=_[_0x17ed('0x44')](_0x2d9d9b[_0x17ed('0x43')],{'$or':_[_0x17ed('0x32')](_0x2d9d9b[_0x17ed('0x3c')],function(_0x14fc4d){var _0x7e5c9c={};_0x7e5c9c[_0x14fc4d]={'$like':'%'+_0x32115f[_0x17ed('0x38')][_0x17ed('0x47')]+'%'};return _0x7e5c9c;})});}_0x2d9d9b=_[_0x17ed('0x44')]({},_0x2d9d9b,_0x32115f[_0x17ed('0x48')]);return _0xc35ff2['getAgents'](_0x2d9d9b);}})[_0x17ed('0x2e')](function(_0x49f5c7){if(_0x49f5c7){_0x5a9e11=_0x49f5c7[_0x17ed('0x3e')];if(!_0x32115f[_0x17ed('0x38')]['hasOwnProperty'](_0x17ed('0x40'))){_0x2d9d9b[_0x17ed('0x27')]=qs[_0x17ed('0x27')](_0x32115f['query']['limit']);_0x2d9d9b['offset']=qs['offset'](_0x32115f[_0x17ed('0x38')][_0x17ed('0x24')]);}return _0xc35ff2[_0x17ed('0x9a')](_0x2d9d9b);}})['then'](function(_0x474e37){if(_0x474e37){return _0x474e37?{'count':_0x5a9e11,'rows':_0x474e37}:null;}})[_0x17ed('0x2e')](respondWithResult(_0x503454,null))[_0x17ed('0x4d')](handleError(_0x503454,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cb54ced..ef2d568 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 _0xe525=['save','remove','emit','hasOwnProperty','events','../../mysqldb','Team'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xe525,0xc8));var _0x5e52=function(_0x444fda,_0x118823){_0x444fda=_0x444fda-0x0;var _0x2c7df0=_0xe525[_0x444fda];return _0x2c7df0;};'use strict';var EventEmitter=require(_0x5e52('0x0'));var Team=require(_0x5e52('0x1'))['db'][_0x5e52('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e52('0x3'),'afterUpdate':'update','afterDestroy':_0x5e52('0x4')};function emitEvent(_0x3c7c07){return function(_0x367ed8,_0x327505,_0x43a7dc){TeamEvents[_0x5e52('0x5')](_0x3c7c07+':'+_0x367ed8['id'],_0x367ed8);TeamEvents[_0x5e52('0x5')](_0x3c7c07,_0x367ed8);_0x43a7dc(null);};}for(var e in events){if(events[_0x5e52('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x6c61=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','Team'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c61,0xbe));var _0x16c6=function(_0x3e9f06,_0x1f83e6){_0x3e9f06=_0x3e9f06-0x0;var _0x482ec7=_0x6c61[_0x3e9f06];return _0x482ec7;};'use strict';var EventEmitter=require('events');var Team=require(_0x16c6('0x0'))['db'][_0x16c6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x16c6('0x2')](0x0);var events={'afterCreate':_0x16c6('0x3'),'afterUpdate':_0x16c6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5982d1){return function(_0x26e986,_0x3fff68,_0x4e12c9){TeamEvents[_0x16c6('0x5')](_0x5982d1+':'+_0x26e986['id'],_0x26e986);TeamEvents[_0x16c6('0x5')](_0x5982d1,_0x26e986);_0x4e12c9(null);};}for(var e in events){if(events[_0x16c6('0x6')](e)){var event=events[e];Team[_0x16c6('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4e9b074..d42e13b 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 _0xe89a=['Chat','Mail','Openchannel','Whatsapp','resolve','then','all','./team.attributes','get','Queues','map','setDataValue','catch','exports','define','teams'];(function(_0x44d0cd,_0x512c33){var _0x152450=function(_0x4395e8){while(--_0x4395e8){_0x44d0cd['push'](_0x44d0cd['shift']());}};_0x152450(++_0x512c33);}(_0xe89a,0x1e7));var _0xae89=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe89a[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var attributes=require(_0xae89('0x0'));function getQueuesByChannel(_0x4f1528,_0x237962){var _0x526472=_0xae89('0x1')+_0x237962+_0xae89('0x2');return _0x4f1528[_0x526472]()['then'](function(_0x4a2ad9){return _[_0xae89('0x3')](_0x4a2ad9,function(_0x137ab3){_0x137ab3[_0xae89('0x4')]('channel',_0x237962);return _0x137ab3;});})[_0xae89('0x5')](function(_0x26cb43){throw _0x26cb43;});}module[_0xae89('0x6')]=function(_0x1205b8){return _0x1205b8[_0xae89('0x7')]('Team',attributes,{'tableName':_0xae89('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x35ff52=this;var _0x328685=[_0xae89('0x9'),'Fax',_0xae89('0xa'),_0xae89('0xb'),'Sms','Voice',_0xae89('0xc')];return Promise[_0xae89('0xd')]()[_0xae89('0xe')](function(){var _0x1f4bfd=_[_0xae89('0x3')](_0x328685,function(_0x295a51){return getQueuesByChannel(_0x35ff52,_0x295a51);});return Promise[_0xae89('0xf')](_0x1f4bfd);})['catch'](function(_0x555cc8){throw _0x555cc8;});}}});}; \ No newline at end of file +var _0x6872=['Chat','Fax','Voice','Whatsapp','resolve','map','all','./team.attributes','get','then','channel','catch','exports','define','Team','teams'];(function(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0x6872,0x97));var _0x2687=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x6872[_0x39e283];return _0x7de89f;};'use strict';var _=require('lodash');var attributes=require(_0x2687('0x0'));function getQueuesByChannel(_0x42d4b6,_0x214882){var _0x26bbf2=_0x2687('0x1')+_0x214882+'Queues';return _0x42d4b6[_0x26bbf2]()[_0x2687('0x2')](function(_0x3ba7f3){return _['map'](_0x3ba7f3,function(_0x3a6867){_0x3a6867['setDataValue'](_0x2687('0x3'),_0x214882);return _0x3a6867;});})[_0x2687('0x4')](function(_0x9cc7a5){throw _0x9cc7a5;});}module[_0x2687('0x5')]=function(_0x825099){return _0x825099[_0x2687('0x6')](_0x2687('0x7'),attributes,{'tableName':_0x2687('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5bdd12=this;var _0x5d123f=[_0x2687('0x9'),_0x2687('0xa'),'Mail','Openchannel','Sms',_0x2687('0xb'),_0x2687('0xc')];return Promise[_0x2687('0xd')]()[_0x2687('0x2')](function(){var _0x5c1880=_[_0x2687('0xe')](_0x5d123f,function(_0xf5f59e){return getQueuesByChannel(_0x5bdd12,_0xf5f59e);});return Promise[_0x2687('0xf')](_0x5c1880);})[_0x2687('0x4')](function(_0x38f273){throw _0x38f273;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index cfe1a7c..dbe9134 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 _0xa17e=['then','info','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request'];(function(_0x204825,_0x28d681){var _0x42775b=function(_0x450410){while(--_0x450410){_0x204825['push'](_0x204825['shift']());}};_0x42775b(++_0x28d681);}(_0xa17e,0x10e));var _0xea17=function(_0x1fdb4e,_0x33ec99){_0x1fdb4e=_0x1fdb4e-0x0;var _0x5d1baf=_0xa17e[_0x1fdb4e];return _0x5d1baf;};'use strict';var _=require(_0xea17('0x0'));var util=require('util');var moment=require(_0xea17('0x1'));var BPromise=require(_0xea17('0x2'));var rs=require(_0xea17('0x3'));var fs=require('fs');var Redis=require(_0xea17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea17('0x5'));var logger=require(_0xea17('0x6'))(_0xea17('0x7'));var config=require(_0xea17('0x8'));var jayson=require(_0xea17('0x9'));var client=jayson[_0xea17('0xa')][_0xea17('0xb')]({'port':0x232a});config[_0xea17('0xc')]=_[_0xea17('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea17('0xc')]));require('./team.socket')[_0xea17('0xe')](socket);function respondWithRpcPromise(_0x1a1c2a,_0x4cfcc0,_0x20b2b1){return new BPromise(function(_0x44e842,_0x55a287){return client[_0xea17('0xf')](_0x1a1c2a,_0x20b2b1)[_0xea17('0x10')](function(_0x2e15fd){logger[_0xea17('0x11')]('Team,\x20%s,\x20%s',_0x4cfcc0,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4cfcc0,_0xea17('0x12'),JSON[_0xea17('0x13')](_0x2e15fd));if(_0x2e15fd['error']){if(_0x2e15fd[_0xea17('0x14')][_0xea17('0x15')]===0x1f4){logger['error'](_0xea17('0x16'),_0x4cfcc0,_0x2e15fd[_0xea17('0x14')][_0xea17('0x17')]);return _0x55a287(_0x2e15fd['error'][_0xea17('0x17')]);}logger[_0xea17('0x14')](_0xea17('0x16'),_0x4cfcc0,_0x2e15fd[_0xea17('0x14')][_0xea17('0x17')]);return _0x44e842(_0x2e15fd['error'][_0xea17('0x17')]);}else{logger[_0xea17('0x11')](_0xea17('0x16'),_0x4cfcc0,'request\x20sent');_0x44e842(_0x2e15fd[_0xea17('0x18')][_0xea17('0x17')]);}})[_0xea17('0x19')](function(_0x416a3c){logger[_0xea17('0x14')](_0xea17('0x16'),_0x4cfcc0,_0x416a3c);_0x55a287(_0x416a3c);});});} \ No newline at end of file +var _0x36ca=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x36ca,0x12b));var _0xa36c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x36ca[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xa36c('0x0'));var util=require(_0xa36c('0x1'));var moment=require(_0xa36c('0x2'));var BPromise=require(_0xa36c('0x3'));var rs=require(_0xa36c('0x4'));var fs=require('fs');var Redis=require(_0xa36c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa36c('0x6'));var logger=require(_0xa36c('0x7'))(_0xa36c('0x8'));var config=require(_0xa36c('0x9'));var jayson=require(_0xa36c('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa36c('0xb')]=_['defaults'](config[_0xa36c('0xb')],{'host':_0xa36c('0xc'),'port':0x18eb});var socket=require(_0xa36c('0xd'))(new Redis(config[_0xa36c('0xb')]));require(_0xa36c('0xe'))['register'](socket);function respondWithRpcPromise(_0x3b414c,_0x1d5a80,_0x5d31ea){return new BPromise(function(_0x4d23db,_0x281b04){return client[_0xa36c('0xf')](_0x3b414c,_0x5d31ea)[_0xa36c('0x10')](function(_0xecbdcc){logger['info'](_0xa36c('0x11'),_0x1d5a80,_0xa36c('0x12'));logger[_0xa36c('0x13')](_0xa36c('0x14'),_0x1d5a80,'request\x20sent',JSON[_0xa36c('0x15')](_0xecbdcc));if(_0xecbdcc[_0xa36c('0x16')]){if(_0xecbdcc[_0xa36c('0x16')][_0xa36c('0x17')]===0x1f4){logger[_0xa36c('0x16')](_0xa36c('0x11'),_0x1d5a80,_0xecbdcc[_0xa36c('0x16')]['message']);return _0x281b04(_0xecbdcc[_0xa36c('0x16')]['message']);}logger['error'](_0xa36c('0x11'),_0x1d5a80,_0xecbdcc[_0xa36c('0x16')]['message']);return _0x4d23db(_0xecbdcc[_0xa36c('0x16')][_0xa36c('0x18')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x1d5a80,_0xa36c('0x12'));_0x4d23db(_0xecbdcc['result'][_0xa36c('0x18')]);}})['catch'](function(_0x12c4f2){logger[_0xa36c('0x16')](_0xa36c('0x11'),_0x1d5a80,_0x12c4f2);_0x281b04(_0x12c4f2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8738040..a6df430 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 _0x8caf=['save','remove','update','removeListener','register','length','team:'];(function(_0x496d35,_0x5c29a2){var _0x3b4d30=function(_0x34c84e){while(--_0x34c84e){_0x496d35['push'](_0x496d35['shift']());}};_0x3b4d30(++_0x5c29a2);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x5bf79a,_0x2eaa1d){_0x5bf79a=_0x5bf79a-0x0;var _0x3ff10f=_0x8caf[_0x5bf79a];return _0x3ff10f;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf8ca('0x0'),_0xf8ca('0x1'),_0xf8ca('0x2')];function createListener(_0x2306e8,_0xedc446){return function(_0x35d47c){_0xedc446['emit'](_0x2306e8,_0x35d47c);};}function removeListener(_0x129ca9,_0x23939c){return function(){TeamEvents[_0xf8ca('0x3')](_0x129ca9,_0x23939c);};}exports[_0xf8ca('0x4')]=function(_0x1e2888){for(var _0x20c10a=0x0,_0x562eea=events[_0xf8ca('0x5')];_0x20c10a<_0x562eea;_0x20c10a++){var _0x3abd58=events[_0x20c10a];var _0x3a91d3=createListener(_0xf8ca('0x6')+_0x3abd58,_0x1e2888);TeamEvents['on'](_0x3abd58,_0x3a91d3);}}; \ No newline at end of file +var _0x8c2c=['remove','update','emit','register','length','team:','save'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x8c2c,0x92));var _0xc8c2=function(_0x543884,_0x568d8f){_0x543884=_0x543884-0x0;var _0x45ee3c=_0x8c2c[_0x543884];return _0x45ee3c;};'use strict';var TeamEvents=require('./team.events');var events=[_0xc8c2('0x0'),_0xc8c2('0x1'),_0xc8c2('0x2')];function createListener(_0x409381,_0x149d48){return function(_0x315813){_0x149d48[_0xc8c2('0x3')](_0x409381,_0x315813);};}function removeListener(_0x170876,_0x5e8d3a){return function(){TeamEvents['removeListener'](_0x170876,_0x5e8d3a);};}exports[_0xc8c2('0x4')]=function(_0x460317){for(var _0x22177d=0x0,_0x2579ad=events[_0xc8c2('0x5')];_0x22177d<_0x2579ad;_0x22177d++){var _0x5acf62=events[_0x22177d];var _0x54b165=createListener(_0xc8c2('0x6')+_0x5acf62,_0x460317);TeamEvents['on'](_0x5acf62,_0x54b165);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6439c35..2e20043 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 _0xbe0c=['exports','INTEGER','sequelize'];(function(_0x369ed8,_0x15af6c){var _0x3b02f7=function(_0x2d4c6d){while(--_0x2d4c6d){_0x369ed8['push'](_0x369ed8['shift']());}};_0x3b02f7(++_0x15af6c);}(_0xbe0c,0x155));var _0xcbe0=function(_0x4c5a24,_0x5ef60c){_0x4c5a24=_0x4c5a24-0x0;var _0x4b067e=_0xbe0c[_0x4c5a24];return _0x4b067e;};'use strict';var Sequelize=require(_0xcbe0('0x0'));module[_0xcbe0('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xcbe0('0x2')]}}; \ No newline at end of file +var _0x19ea=['sequelize','INTEGER'];(function(_0x3a1eb5,_0x1c2bc2){var _0x3f24c1=function(_0x191d8b){while(--_0x191d8b){_0x3a1eb5['push'](_0x3a1eb5['shift']());}};_0x3f24c1(++_0x1c2bc2);}(_0x19ea,0xfe));var _0xa19e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x19ea[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xa19e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b4661e9..2e2eb08 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 _0x2e16=['bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','moment'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2e16,0x8d));var _0x62e1=function(_0x526c54,_0x5b4ab5){_0x526c54=_0x526c54-0x0;var _0x41ba47=_0x2e16[_0x526c54];return _0x41ba47;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x62e1('0x1'));var BPromise=require(_0x62e1('0x2'));var rp=require(_0x62e1('0x3'));var fs=require('fs');var path=require(_0x62e1('0x4'));var rimraf=require('rimraf');var config=require(_0x62e1('0x5'));var attributes=require(_0x62e1('0x6'));module[_0x62e1('0x7')]=function(_0x6d1e6f,_0x3cac6e){return _0x6d1e6f[_0x62e1('0x8')](_0x62e1('0x9'),attributes,{'tableName':_0x62e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d8=['moment','bluebird','request-promise','../../config/environment','define','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x3ce9e8,_0x323bf5){var _0x3ae015=function(_0x32966f){while(--_0x32966f){_0x3ce9e8['push'](_0x3ce9e8['shift']());}};_0x3ae015(++_0x323bf5);}(_0x98d8,0xce));var _0x898d=function(_0x530c53,_0x546020){_0x530c53=_0x530c53-0x0;var _0x5408ca=_0x98d8[_0x530c53];return _0x5408ca;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var logger=require(_0x898d('0x2'))(_0x898d('0x3'));var moment=require(_0x898d('0x4'));var BPromise=require(_0x898d('0x5'));var rp=require(_0x898d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x898d('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x4047bd,_0x5215bf){return _0x4047bd[_0x898d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x898d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 611886f..f7df292 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d19c1,_0x3e9b6b){var _0x231051=function(_0x1ae913){while(--_0x1ae913){_0x4d19c1['push'](_0x4d19c1['shift']());}};_0x231051(++_0x3e9b6b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb4a59c,_0x2795a6){var _0x42fd14=function(_0x1ca725){while(--_0x1ca725){_0xb4a59c['push'](_0xb4a59c['shift']());}};_0x42fd14(++_0x2795a6);}(_0xe706,0xa3));var _0x6e70=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xe706[_0x48d6a3];return _0x38bfa0;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d79b73d..b4a6a7a 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 _0x0c9f=['INTEGER','sequelize','exports'];(function(_0x34eb4c,_0x1e2dda){var _0x7a0cca=function(_0x44b76d){while(--_0x44b76d){_0x34eb4c['push'](_0x34eb4c['shift']());}};_0x7a0cca(++_0x1e2dda);}(_0x0c9f,0x12a));var _0xf0c9=function(_0x15edb9,_0x1ad393){_0x15edb9=_0x15edb9-0x0;var _0x45fb17=_0x0c9f[_0x15edb9];return _0x45fb17;};'use strict';var Sequelize=require(_0xf0c9('0x0'));module[_0xf0c9('0x1')]={'penalty':{'type':Sequelize[_0xf0c9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8c04=['sequelize','exports','INTEGER'];(function(_0xc9e90e,_0x2bb127){var _0x53d368=function(_0x335cb1){while(--_0x335cb1){_0xc9e90e['push'](_0xc9e90e['shift']());}};_0x53d368(++_0x2bb127);}(_0x8c04,0x1a7));var _0x48c0=function(_0x2ae174,_0x3f1048){_0x2ae174=_0x2ae174-0x0;var _0x1b0506=_0x8c04[_0x2ae174];return _0x1b0506;};'use strict';var Sequelize=require(_0x48c0('0x0'));module[_0x48c0('0x1')]={'penalty':{'type':Sequelize[_0x48c0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2d28ad0..402d626 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 _0xf194=['define','lodash','util','../../config/logger','api','bluebird','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x521e09,_0x1e131f){var _0x1f0238=function(_0xc4cec5){while(--_0xc4cec5){_0x521e09['push'](_0x521e09['shift']());}};_0x1f0238(++_0x1e131f);}(_0xf194,0x91));var _0x4f19=function(_0x5f2220,_0x21f341){_0x5f2220=_0x5f2220-0x0;var _0x13bf62=_0xf194[_0x5f2220];return _0x13bf62;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var logger=require(_0x4f19('0x2'))(_0x4f19('0x3'));var moment=require('moment');var BPromise=require(_0x4f19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f19('0x5'));var attributes=require(_0x4f19('0x6'));module[_0x4f19('0x7')]=function(_0x57c148,_0x1fbd23){return _0x57c148[_0x4f19('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cd8=['./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x1b40ca,_0x194ad5){var _0x190d21=function(_0x564505){while(--_0x564505){_0x1b40ca['push'](_0x1b40ca['shift']());}};_0x190d21(++_0x194ad5);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x3b086c,_0x1b8103){_0x3b086c=_0x3b086c-0x0;var _0x5b0c1f=_0x5cd8[_0x3b086c];return _0x5b0c1f;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');var logger=require(_0x85cd('0x1'))(_0x85cd('0x2'));var moment=require(_0x85cd('0x3'));var BPromise=require(_0x85cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85cd('0x5'));var rimraf=require('rimraf');var config=require(_0x85cd('0x6'));var attributes=require(_0x85cd('0x7'));module[_0x85cd('0x8')]=function(_0x322e08,_0xcfad76){return _0x322e08['define'](_0x85cd('0x9'),attributes,{'tableName':_0x85cd('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 3ec064d..3a63a73 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 _0x07b9=['rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3b4ded,_0xf61a79){var _0x2df583=function(_0x5c7075){while(--_0x5c7075){_0x3b4ded['push'](_0x3b4ded['shift']());}};_0x2df583(++_0xf61a79);}(_0x07b9,0x143));var _0x907b=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x07b9[_0x350182];return _0x4a0892;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var moment=require(_0x907b('0x2'));var BPromise=require(_0x907b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x907b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x907b('0x5'));var logger=require(_0x907b('0x6'))(_0x907b('0x7'));var config=require(_0x907b('0x8'));var jayson=require(_0x907b('0x9'));var client=jayson[_0x907b('0xa')][_0x907b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c124a,_0x78f108,_0x3804a7){return new BPromise(function(_0x43c574,_0x1ff1ca){return client['request'](_0x5c124a,_0x3804a7)['then'](function(_0x34767a){logger[_0x907b('0xc')](_0x907b('0xd'),_0x78f108,_0x907b('0xe'));logger[_0x907b('0xf')](_0x907b('0x10'),_0x78f108,_0x907b('0xe'),JSON[_0x907b('0x11')](_0x34767a));if(_0x34767a[_0x907b('0x12')]){if(_0x34767a[_0x907b('0x12')]['code']===0x1f4){logger[_0x907b('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x78f108,_0x34767a['error'][_0x907b('0x13')]);return _0x1ff1ca(_0x34767a[_0x907b('0x12')][_0x907b('0x13')]);}logger[_0x907b('0x12')](_0x907b('0xd'),_0x78f108,_0x34767a[_0x907b('0x12')]['message']);return _0x43c574(_0x34767a[_0x907b('0x12')][_0x907b('0x13')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x78f108,_0x907b('0xe'));_0x43c574(_0x34767a[_0x907b('0x14')][_0x907b('0x13')]);}})[_0x907b('0x15')](function(_0x70dcd5){logger['error'](_0x907b('0xd'),_0x78f108,_0x70dcd5);_0x1ff1ca(_0x70dcd5);});});} \ No newline at end of file +var _0x66e5=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util'];(function(_0x356beb,_0x308032){var _0x4e2281=function(_0x25ee23){while(--_0x25ee23){_0x356beb['push'](_0x356beb['shift']());}};_0x4e2281(++_0x308032);}(_0x66e5,0x1a2));var _0x566e=function(_0x10e3f7,_0x353b97){_0x10e3f7=_0x10e3f7-0x0;var _0x3ee398=_0x66e5[_0x10e3f7];return _0x3ee398;};'use strict';var _=require(_0x566e('0x0'));var util=require(_0x566e('0x1'));var moment=require('moment');var BPromise=require(_0x566e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x566e('0x3'));var db=require(_0x566e('0x4'))['db'];var utils=require(_0x566e('0x5'));var logger=require(_0x566e('0x6'))(_0x566e('0x7'));var config=require('../../config/environment');var jayson=require(_0x566e('0x8'));var client=jayson[_0x566e('0x9')][_0x566e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe74b76,_0x2a5eab,_0x38eeca){return new BPromise(function(_0x4eb877,_0x2c143e){return client[_0x566e('0xb')](_0xe74b76,_0x38eeca)[_0x566e('0xc')](function(_0x4d98b2){logger[_0x566e('0xd')](_0x566e('0xe'),_0x2a5eab,_0x566e('0xf'));logger[_0x566e('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2a5eab,'request\x20sent',JSON['stringify'](_0x4d98b2));if(_0x4d98b2[_0x566e('0x11')]){if(_0x4d98b2[_0x566e('0x11')][_0x566e('0x12')]===0x1f4){logger[_0x566e('0x11')](_0x566e('0xe'),_0x2a5eab,_0x4d98b2[_0x566e('0x11')]['message']);return _0x2c143e(_0x4d98b2['error'][_0x566e('0x13')]);}logger[_0x566e('0x11')](_0x566e('0xe'),_0x2a5eab,_0x4d98b2['error'][_0x566e('0x13')]);return _0x4eb877(_0x4d98b2[_0x566e('0x11')]['message']);}else{logger[_0x566e('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2a5eab,_0x566e('0xf'));_0x4eb877(_0x4d98b2['result'][_0x566e('0x13')]);}})[_0x566e('0x14')](function(_0x35ebcb){logger[_0x566e('0x11')](_0x566e('0xe'),_0x2a5eab,_0x35ebcb);_0x2c143e(_0x35ebcb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 9ff5625..ca3dacc 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 _0x15b8=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x4f2d1f,_0x2dfd87){var _0x7fbb02=function(_0x904d3c){while(--_0x904d3c){_0x4f2d1f['push'](_0x4f2d1f['shift']());}};_0x7fbb02(++_0x2dfd87);}(_0x15b8,0xcd));var _0x815b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x15b8[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require(_0x815b('0x0'));var path=require(_0x815b('0x1'));var timeout=require(_0x815b('0x2'));var express=require(_0x815b('0x3'));var router=express[_0x815b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x815b('0x5'));var interaction=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var controller=require(_0x815b('0x8'));router[_0x815b('0x9')]('/',auth[_0x815b('0xa')](),controller['index']);router[_0x815b('0x9')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0xc')]);router[_0x815b('0xd')]('/',auth[_0x815b('0xa')](),controller[_0x815b('0xe')]);router[_0x815b('0xf')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0x10')]);router[_0x815b('0x11')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0x12')]);module[_0x815b('0x13')]=router; \ No newline at end of file +var _0x2d07=['get','index','/:id','post','isAuthenticated','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x14e359,_0x31cb17){var _0x390b10=function(_0x32f80a){while(--_0x32f80a){_0x14e359['push'](_0x14e359['shift']());}};_0x390b10(++_0x31cb17);}(_0x2d07,0x13a));var _0x72d0=function(_0x3042d5,_0x349534){_0x3042d5=_0x3042d5-0x0;var _0x1acfef=_0x2d07[_0x3042d5];return _0x1acfef;};'use strict';var multer=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var path=require('path');var timeout=require(_0x72d0('0x2'));var express=require(_0x72d0('0x3'));var router=express['Router']();var fs_extra=require(_0x72d0('0x4'));var auth=require(_0x72d0('0x5'));var interaction=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var controller=require(_0x72d0('0x8'));router[_0x72d0('0x9')]('/',auth['isAuthenticated'](),controller[_0x72d0('0xa')]);router[_0x72d0('0x9')](_0x72d0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x72d0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x72d0('0xb'),auth[_0x72d0('0xd')](),controller[_0x72d0('0xe')]);router[_0x72d0('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x72d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 5ff4f88..07c8539 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 _0xe015=['TEXT','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe015,0xbb));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x5e01('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e01('0x1')]},'description':{'type':Sequelize[_0x5e01('0x1')]},'html':{'type':Sequelize[_0x5e01('0x2')]}}; \ No newline at end of file +var _0xeebd=['sequelize','exports','STRING','TEXT'];(function(_0x4ffc34,_0x5db65f){var _0x46b4df=function(_0x39f86b){while(--_0x39f86b){_0x4ffc34['push'](_0x4ffc34['shift']());}};_0x46b4df(++_0x5db65f);}(_0xeebd,0xb8));var _0xdeeb=function(_0x26e9e3,_0x173f0b){_0x26e9e3=_0x26e9e3-0x0;var _0x251ced=_0xeebd[_0x26e9e3];return _0x251ced;};'use strict';var Sequelize=require(_0xdeeb('0x0'));module[_0xdeeb('0x1')]={'name':{'type':Sequelize[_0xdeeb('0x2')]},'description':{'type':Sequelize[_0xdeeb('0x2')]},'html':{'type':Sequelize[_0xdeeb('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index fba4e3a..02626c3 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 _0xbef4=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','sendStatus','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','findAll','show','params','include','create'];(function(_0x5b29f7,_0x335b71){var _0x47d235=function(_0x5bf7b7){while(--_0x5bf7b7){_0x5b29f7['push'](_0x5b29f7['shift']());}};_0x47d235(++_0x335b71);}(_0xbef4,0x100));var _0x4bef=function(_0x251ae7,_0xa8af83){_0x251ae7=_0x251ae7-0x0;var _0x38aed7=_0xbef4[_0x251ae7];return _0x38aed7;};'use strict';var emlformat=require(_0x4bef('0x0'));var rimraf=require(_0x4bef('0x1'));var zipdir=require(_0x4bef('0x2'));var jsonpatch=require(_0x4bef('0x3'));var rp=require(_0x4bef('0x4'));var moment=require(_0x4bef('0x5'));var BPromise=require(_0x4bef('0x6'));var Mustache=require(_0x4bef('0x7'));var util=require(_0x4bef('0x8'));var path=require(_0x4bef('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4bef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bef('0xb'));var squel=require(_0x4bef('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bef('0xd'));var deskjs=require(_0x4bef('0xe'));var toCsv=require(_0x4bef('0xf'));var querystring=require(_0x4bef('0x10'));var Papa=require(_0x4bef('0x11'));var Redis=require(_0x4bef('0x12'));var authService=require(_0x4bef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4bef('0x14'));var hardwareService=require(_0x4bef('0x15'));var logger=require(_0x4bef('0x16'))('api');var utils=require(_0x4bef('0x17'));var config=require(_0x4bef('0x18'));var licenseUtil=require(_0x4bef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd92535,_0x2e234b){_0x2e234b=_0x2e234b||0xcc;return function(_0x4525d0){if(_0x4525d0){return _0xd92535['sendStatus'](_0x2e234b);}return _0xd92535['status'](_0x2e234b)['end']();};}function respondWithResult(_0x295c66,_0x194f80){_0x194f80=_0x194f80||0xc8;return function(_0x25d607){if(_0x25d607){return _0x295c66[_0x4bef('0x1a')](_0x194f80)[_0x4bef('0x1b')](_0x25d607);}};}function respondWithFilteredResult(_0xa307da,_0x2db2af){return function(_0x409399){if(_0x409399){var _0x25c180=typeof _0x2db2af[_0x4bef('0x1c')]===_0x4bef('0x1d')&&typeof _0x2db2af[_0x4bef('0x1e')]===_0x4bef('0x1d');var _0x24019d=_0x409399['count'];var _0x427e8e=_0x25c180?0x0:_0x2db2af[_0x4bef('0x1c')];var _0x3d8316=_0x25c180?_0x409399[_0x4bef('0x1f')]:_0x2db2af[_0x4bef('0x1c')]+_0x2db2af[_0x4bef('0x1e')];var _0x413766;if(_0x3d8316>=_0x24019d){_0x3d8316=_0x24019d;_0x413766=0xc8;}else{_0x413766=0xce;}_0xa307da['status'](_0x413766);return _0xa307da[_0x4bef('0x20')](_0x4bef('0x21'),_0x427e8e+'-'+_0x3d8316+'/'+_0x24019d)[_0x4bef('0x1b')](_0x409399);}return null;};}function patchUpdates(_0x17fc8e){return function(_0x5440de){try{jsonpatch[_0x4bef('0x22')](_0x5440de,_0x17fc8e,!![]);}catch(_0x3d2f4a){return BPromise[_0x4bef('0x23')](_0x3d2f4a);}return _0x5440de[_0x4bef('0x24')]();};}function saveUpdates(_0x39f6e5,_0x27d6e3){return function(_0x14469f){if(_0x14469f){return _0x14469f[_0x4bef('0x25')](_0x39f6e5)[_0x4bef('0x26')](function(_0x384685){return _0x384685;});}return null;};}function removeEntity(_0x2e20b5,_0x1567df){return function(_0x1fe081){if(_0x1fe081){return _0x1fe081[_0x4bef('0x27')]()[_0x4bef('0x26')](function(){var _0x4c9c10=_0x1fe081[_0x4bef('0x28')]({'plain':!![]});var _0x1e11d5=_0x4bef('0x29');return db[_0x4bef('0x2a')][_0x4bef('0x27')]({'where':{'type':_0x1e11d5,'resourceId':_0x4c9c10['id']}})['then'](function(){return _0x1fe081;});})[_0x4bef('0x26')](function(){_0x2e20b5[_0x4bef('0x1a')](0xcc)[_0x4bef('0x2b')]();});}};}function handleEntityNotFound(_0x3abd66,_0x2e8d7f){return function(_0x39cc0b){if(!_0x39cc0b){_0x3abd66[_0x4bef('0x2c')](0x194);}return _0x39cc0b;};}function handleError(_0x58a9b7,_0x1b6860){_0x1b6860=_0x1b6860||0x1f4;return function(_0x462025){logger['error'](_0x462025['stack']);if(_0x462025[_0x4bef('0x2d')]){delete _0x462025['name'];}_0x58a9b7[_0x4bef('0x1a')](_0x1b6860)[_0x4bef('0x2e')](_0x462025);};}exports[_0x4bef('0x2f')]=function(_0x23f021,_0x59aa77){var _0x4a33b3={},_0x5d923e={},_0x287f7c={'count':0x0,'rows':[]};var _0x34c868=_['map'](db['Template'][_0x4bef('0x30')],function(_0x5af544){return{'name':_0x5af544['fieldName'],'type':_0x5af544[_0x4bef('0x31')][_0x4bef('0x32')]};});_0x5d923e[_0x4bef('0x33')]=_[_0x4bef('0x34')](_0x34c868,_0x4bef('0x2d'));_0x5d923e[_0x4bef('0x35')]=_[_0x4bef('0x36')](_0x23f021[_0x4bef('0x35')]);_0x5d923e[_0x4bef('0x37')]=_[_0x4bef('0x38')](_0x5d923e['model'],_0x5d923e['query']);_0x4a33b3[_0x4bef('0x39')]=_[_0x4bef('0x38')](_0x5d923e[_0x4bef('0x33')],qs['fields'](_0x23f021[_0x4bef('0x35')][_0x4bef('0x3a')]));_0x4a33b3[_0x4bef('0x39')]=_0x4a33b3[_0x4bef('0x39')][_0x4bef('0x3b')]?_0x4a33b3['attributes']:_0x5d923e[_0x4bef('0x33')];if(!_0x23f021['query'][_0x4bef('0x3c')](_0x4bef('0x3d'))){_0x4a33b3['limit']=qs['limit'](_0x23f021[_0x4bef('0x35')]['limit']);_0x4a33b3[_0x4bef('0x1c')]=qs[_0x4bef('0x1c')](_0x23f021['query'][_0x4bef('0x1c')]);}_0x4a33b3['order']=qs[_0x4bef('0x3e')](_0x23f021[_0x4bef('0x35')]['sort']);_0x4a33b3['where']=qs[_0x4bef('0x37')](_[_0x4bef('0x3f')](_0x23f021[_0x4bef('0x35')],_0x5d923e[_0x4bef('0x37')]),_0x34c868);if(_0x23f021[_0x4bef('0x35')][_0x4bef('0x40')]){_0x4a33b3[_0x4bef('0x41')]=_[_0x4bef('0x42')](_0x4a33b3[_0x4bef('0x41')],{'$or':_['map'](_0x34c868,function(_0x3b38d7){if(_0x3b38d7[_0x4bef('0x31')]!==_0x4bef('0x43')){var _0x1016b2={};_0x1016b2[_0x3b38d7['name']]={'$like':'%'+_0x23f021['query'][_0x4bef('0x40')]+'%'};return _0x1016b2;}})});}_0x4a33b3=_[_0x4bef('0x42')]({},_0x4a33b3,_0x23f021[_0x4bef('0x44')]);var _0x37f9a4={'where':_0x4a33b3[_0x4bef('0x41')]};return db[_0x4bef('0x45')][_0x4bef('0x1f')](_0x37f9a4)[_0x4bef('0x26')](function(_0x38b47b){_0x287f7c[_0x4bef('0x1f')]=_0x38b47b;if(_0x23f021[_0x4bef('0x35')][_0x4bef('0x46')]){_0x4a33b3['include']=[{'all':!![]}];}return db[_0x4bef('0x45')][_0x4bef('0x47')](_0x4a33b3);})[_0x4bef('0x26')](function(_0x9e249d){_0x287f7c['rows']=_0x9e249d;return _0x287f7c;})['then'](respondWithFilteredResult(_0x59aa77,_0x4a33b3))['catch'](handleError(_0x59aa77,null));};exports[_0x4bef('0x48')]=function(_0x5a2b8e,_0x26455c){var _0x2900ef={'raw':!![],'where':{'id':_0x5a2b8e[_0x4bef('0x49')]['id']}},_0x5c2c49={};_0x5c2c49[_0x4bef('0x33')]=_['keys'](db[_0x4bef('0x45')][_0x4bef('0x30')]);_0x5c2c49[_0x4bef('0x35')]=_[_0x4bef('0x36')](_0x5a2b8e[_0x4bef('0x35')]);_0x5c2c49['filters']=_[_0x4bef('0x38')](_0x5c2c49[_0x4bef('0x33')],_0x5c2c49[_0x4bef('0x35')]);_0x2900ef[_0x4bef('0x39')]=_[_0x4bef('0x38')](_0x5c2c49[_0x4bef('0x33')],qs[_0x4bef('0x3a')](_0x5a2b8e[_0x4bef('0x35')][_0x4bef('0x3a')]));_0x2900ef[_0x4bef('0x39')]=_0x2900ef['attributes'][_0x4bef('0x3b')]?_0x2900ef[_0x4bef('0x39')]:_0x5c2c49['model'];if(_0x5a2b8e['query'][_0x4bef('0x46')]){_0x2900ef[_0x4bef('0x4a')]=[{'all':!![]}];}_0x2900ef=_[_0x4bef('0x42')]({},_0x2900ef,_0x5a2b8e[_0x4bef('0x44')]);return db[_0x4bef('0x45')]['find'](_0x2900ef)[_0x4bef('0x26')](handleEntityNotFound(_0x26455c,null))['then'](respondWithResult(_0x26455c,null))['catch'](handleError(_0x26455c,null));};exports[_0x4bef('0x4b')]=function(_0xc69f53,_0x1a58fa){return db[_0x4bef('0x45')][_0x4bef('0x4b')](_0xc69f53[_0x4bef('0x4c')],{})[_0x4bef('0x26')](function(_0x987050){var _0x1f6b85=_0xc69f53[_0x4bef('0x4d')][_0x4bef('0x28')]({'plain':!![]});if(!_0x1f6b85)throw new Error(_0x4bef('0x4e'));if(_0x1f6b85['role']===_0x4bef('0x4d')){var _0x535371=_0x987050[_0x4bef('0x28')]({'plain':!![]});var _0x4863da=_0x4bef('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x4863da,'userProfileId':_0x1f6b85['userProfileId']},'raw':!![]})['then'](function(_0x8433a7){if(_0x8433a7&&_0x8433a7[_0x4bef('0x4f')]===0x0){return db['UserProfileResource'][_0x4bef('0x4b')]({'name':_0x535371[_0x4bef('0x2d')],'resourceId':_0x535371['id'],'type':_0x8433a7['name'],'sectionId':_0x8433a7['id']},{})[_0x4bef('0x26')](function(){return _0x987050;});}else{return _0x987050;}})[_0x4bef('0x50')](function(_0x267c1a){logger['error'](_0x4bef('0x51'),_0x267c1a);throw _0x267c1a;});}return _0x987050;})['then'](respondWithResult(_0x1a58fa,0xc9))[_0x4bef('0x50')](handleError(_0x1a58fa,null));};exports[_0x4bef('0x25')]=function(_0x4f8f84,_0x445faf){if(_0x4f8f84['body']['id']){delete _0x4f8f84[_0x4bef('0x4c')]['id'];}return db['Template'][_0x4bef('0x52')]({'where':{'id':_0x4f8f84[_0x4bef('0x49')]['id']}})[_0x4bef('0x26')](handleEntityNotFound(_0x445faf,null))[_0x4bef('0x26')](saveUpdates(_0x4f8f84[_0x4bef('0x4c')],null))[_0x4bef('0x26')](respondWithResult(_0x445faf,null))[_0x4bef('0x50')](handleError(_0x445faf,null));};exports[_0x4bef('0x27')]=function(_0x5bd671,_0xf0ef4e){return db[_0x4bef('0x45')]['find']({'where':{'id':_0x5bd671[_0x4bef('0x49')]['id']}})[_0x4bef('0x26')](handleEntityNotFound(_0xf0ef4e,null))[_0x4bef('0x26')](removeEntity(_0xf0ef4e,null))['catch'](handleError(_0xf0ef4e,null));}; \ No newline at end of file +var _0x6b99=['ejs','fs-extra','squel','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x5f4ad5,_0xa3b62e){var _0x47b6e9=function(_0x1bf347){while(--_0x1bf347){_0x5f4ad5['push'](_0x5f4ad5['shift']());}};_0x47b6e9(++_0xa3b62e);}(_0x6b99,0x12b));var _0x96b9=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x6b99[_0x3e5bc8];return _0xfd84bc;};'use strict';var emlformat=require(_0x96b9('0x0'));var rimraf=require(_0x96b9('0x1'));var zipdir=require(_0x96b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96b9('0x3'));var moment=require(_0x96b9('0x4'));var BPromise=require(_0x96b9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x96b9('0x6'));var sox=require(_0x96b9('0x7'));var csv=require(_0x96b9('0x8'));var ejs=require(_0x96b9('0x9'));var fs=require('fs');var fs_extra=require(_0x96b9('0xa'));var _=require('lodash');var squel=require(_0x96b9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x96b9('0xc'));var toCsv=require(_0x96b9('0x8'));var querystring=require(_0x96b9('0xd'));var Papa=require('papaparse');var Redis=require(_0x96b9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b9('0xf'));var logger=require(_0x96b9('0x10'))('api');var utils=require(_0x96b9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x96b9('0x12'));var db=require(_0x96b9('0x13'))['db'];function respondWithStatusCode(_0x43b667,_0x546203){_0x546203=_0x546203||0xcc;return function(_0x41bc46){if(_0x41bc46){return _0x43b667[_0x96b9('0x14')](_0x546203);}return _0x43b667[_0x96b9('0x15')](_0x546203)[_0x96b9('0x16')]();};}function respondWithResult(_0x2a64c2,_0x1143ee){_0x1143ee=_0x1143ee||0xc8;return function(_0x2e7985){if(_0x2e7985){return _0x2a64c2[_0x96b9('0x15')](_0x1143ee)[_0x96b9('0x17')](_0x2e7985);}};}function respondWithFilteredResult(_0x3e66b3,_0x97560e){return function(_0x51b596){if(_0x51b596){var _0x2ef265=typeof _0x97560e[_0x96b9('0x18')]==='undefined'&&typeof _0x97560e[_0x96b9('0x19')]===_0x96b9('0x1a');var _0x38b66f=_0x51b596[_0x96b9('0x1b')];var _0xb327d9=_0x2ef265?0x0:_0x97560e[_0x96b9('0x18')];var _0x219182=_0x2ef265?_0x51b596['count']:_0x97560e[_0x96b9('0x18')]+_0x97560e[_0x96b9('0x19')];var _0x7ad7e7;if(_0x219182>=_0x38b66f){_0x219182=_0x38b66f;_0x7ad7e7=0xc8;}else{_0x7ad7e7=0xce;}_0x3e66b3[_0x96b9('0x15')](_0x7ad7e7);return _0x3e66b3[_0x96b9('0x1c')](_0x96b9('0x1d'),_0xb327d9+'-'+_0x219182+'/'+_0x38b66f)[_0x96b9('0x17')](_0x51b596);}return null;};}function patchUpdates(_0x28b0de){return function(_0x269820){try{jsonpatch['apply'](_0x269820,_0x28b0de,!![]);}catch(_0x5cccdd){return BPromise['reject'](_0x5cccdd);}return _0x269820[_0x96b9('0x1e')]();};}function saveUpdates(_0x2cc6f1,_0x2287ca){return function(_0x5da444){if(_0x5da444){return _0x5da444[_0x96b9('0x1f')](_0x2cc6f1)[_0x96b9('0x20')](function(_0x58baa7){return _0x58baa7;});}return null;};}function removeEntity(_0x19c18f,_0x5259f9){return function(_0xb08ba4){if(_0xb08ba4){return _0xb08ba4[_0x96b9('0x21')]()[_0x96b9('0x20')](function(){var _0x187baa=_0xb08ba4[_0x96b9('0x22')]({'plain':!![]});var _0x5b7276=_0x96b9('0x23');return db[_0x96b9('0x24')][_0x96b9('0x21')]({'where':{'type':_0x5b7276,'resourceId':_0x187baa['id']}})[_0x96b9('0x20')](function(){return _0xb08ba4;});})['then'](function(){_0x19c18f[_0x96b9('0x15')](0xcc)[_0x96b9('0x16')]();});}};}function handleEntityNotFound(_0x442878,_0xddf06f){return function(_0x5ddb05){if(!_0x5ddb05){_0x442878[_0x96b9('0x14')](0x194);}return _0x5ddb05;};}function handleError(_0x2b3434,_0x5ceaab){_0x5ceaab=_0x5ceaab||0x1f4;return function(_0x5f3b1d){logger[_0x96b9('0x25')](_0x5f3b1d[_0x96b9('0x26')]);if(_0x5f3b1d['name']){delete _0x5f3b1d[_0x96b9('0x27')];}_0x2b3434[_0x96b9('0x15')](_0x5ceaab)[_0x96b9('0x28')](_0x5f3b1d);};}exports['index']=function(_0x15ebf8,_0x3670eb){var _0x443b7e={},_0xf1b2cc={},_0x1c10c7={'count':0x0,'rows':[]};var _0x3493e8=_[_0x96b9('0x29')](db[_0x96b9('0x2a')][_0x96b9('0x2b')],function(_0xe0ead4){return{'name':_0xe0ead4[_0x96b9('0x2c')],'type':_0xe0ead4[_0x96b9('0x2d')][_0x96b9('0x2e')]};});_0xf1b2cc[_0x96b9('0x2f')]=_[_0x96b9('0x29')](_0x3493e8,'name');_0xf1b2cc[_0x96b9('0x30')]=_[_0x96b9('0x31')](_0x15ebf8[_0x96b9('0x30')]);_0xf1b2cc[_0x96b9('0x32')]=_[_0x96b9('0x33')](_0xf1b2cc['model'],_0xf1b2cc[_0x96b9('0x30')]);_0x443b7e[_0x96b9('0x34')]=_[_0x96b9('0x33')](_0xf1b2cc[_0x96b9('0x2f')],qs[_0x96b9('0x35')](_0x15ebf8[_0x96b9('0x30')]['fields']));_0x443b7e[_0x96b9('0x34')]=_0x443b7e['attributes'][_0x96b9('0x36')]?_0x443b7e[_0x96b9('0x34')]:_0xf1b2cc['model'];if(!_0x15ebf8['query'][_0x96b9('0x37')]('nolimit')){_0x443b7e[_0x96b9('0x19')]=qs[_0x96b9('0x19')](_0x15ebf8['query'][_0x96b9('0x19')]);_0x443b7e[_0x96b9('0x18')]=qs[_0x96b9('0x18')](_0x15ebf8[_0x96b9('0x30')][_0x96b9('0x18')]);}_0x443b7e[_0x96b9('0x38')]=qs[_0x96b9('0x39')](_0x15ebf8[_0x96b9('0x30')][_0x96b9('0x39')]);_0x443b7e[_0x96b9('0x3a')]=qs[_0x96b9('0x32')](_['pick'](_0x15ebf8[_0x96b9('0x30')],_0xf1b2cc[_0x96b9('0x32')]),_0x3493e8);if(_0x15ebf8[_0x96b9('0x30')][_0x96b9('0x3b')]){_0x443b7e[_0x96b9('0x3a')]=_[_0x96b9('0x3c')](_0x443b7e[_0x96b9('0x3a')],{'$or':_[_0x96b9('0x29')](_0x3493e8,function(_0x3a479b){if(_0x3a479b['type']!==_0x96b9('0x3d')){var _0x470daf={};_0x470daf[_0x3a479b[_0x96b9('0x27')]]={'$like':'%'+_0x15ebf8[_0x96b9('0x30')][_0x96b9('0x3b')]+'%'};return _0x470daf;}})});}_0x443b7e=_[_0x96b9('0x3c')]({},_0x443b7e,_0x15ebf8[_0x96b9('0x3e')]);var _0x4b23a9={'where':_0x443b7e[_0x96b9('0x3a')]};return db[_0x96b9('0x2a')][_0x96b9('0x1b')](_0x4b23a9)[_0x96b9('0x20')](function(_0x19a421){_0x1c10c7[_0x96b9('0x1b')]=_0x19a421;if(_0x15ebf8[_0x96b9('0x30')]['includeAll']){_0x443b7e[_0x96b9('0x3f')]=[{'all':!![]}];}return db[_0x96b9('0x2a')][_0x96b9('0x40')](_0x443b7e);})[_0x96b9('0x20')](function(_0x580005){_0x1c10c7[_0x96b9('0x41')]=_0x580005;return _0x1c10c7;})[_0x96b9('0x20')](respondWithFilteredResult(_0x3670eb,_0x443b7e))[_0x96b9('0x42')](handleError(_0x3670eb,null));};exports[_0x96b9('0x43')]=function(_0xe418fa,_0x49adcc){var _0x5e2b59={'raw':!![],'where':{'id':_0xe418fa[_0x96b9('0x44')]['id']}},_0x5da8d7={};_0x5da8d7[_0x96b9('0x2f')]=_[_0x96b9('0x31')](db[_0x96b9('0x2a')][_0x96b9('0x2b')]);_0x5da8d7[_0x96b9('0x30')]=_[_0x96b9('0x31')](_0xe418fa[_0x96b9('0x30')]);_0x5da8d7[_0x96b9('0x32')]=_[_0x96b9('0x33')](_0x5da8d7[_0x96b9('0x2f')],_0x5da8d7[_0x96b9('0x30')]);_0x5e2b59[_0x96b9('0x34')]=_[_0x96b9('0x33')](_0x5da8d7['model'],qs[_0x96b9('0x35')](_0xe418fa[_0x96b9('0x30')]['fields']));_0x5e2b59[_0x96b9('0x34')]=_0x5e2b59['attributes'][_0x96b9('0x36')]?_0x5e2b59[_0x96b9('0x34')]:_0x5da8d7[_0x96b9('0x2f')];if(_0xe418fa[_0x96b9('0x30')][_0x96b9('0x45')]){_0x5e2b59[_0x96b9('0x3f')]=[{'all':!![]}];}_0x5e2b59=_[_0x96b9('0x3c')]({},_0x5e2b59,_0xe418fa[_0x96b9('0x3e')]);return db[_0x96b9('0x2a')]['find'](_0x5e2b59)[_0x96b9('0x20')](handleEntityNotFound(_0x49adcc,null))[_0x96b9('0x20')](respondWithResult(_0x49adcc,null))[_0x96b9('0x42')](handleError(_0x49adcc,null));};exports['create']=function(_0x5ee593,_0x22e820){return db[_0x96b9('0x2a')][_0x96b9('0x46')](_0x5ee593[_0x96b9('0x47')],{})[_0x96b9('0x20')](function(_0x7c9cab){var _0xe3d948=_0x5ee593[_0x96b9('0x48')][_0x96b9('0x22')]({'plain':!![]});if(!_0xe3d948)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe3d948['role']===_0x96b9('0x48')){var _0x30f65e=_0x7c9cab[_0x96b9('0x22')]({'plain':!![]});var _0x32fb54=_0x96b9('0x23');return db[_0x96b9('0x49')][_0x96b9('0x4a')]({'where':{'name':_0x32fb54,'userProfileId':_0xe3d948['userProfileId']},'raw':!![]})[_0x96b9('0x20')](function(_0x2f748c){if(_0x2f748c&&_0x2f748c[_0x96b9('0x4b')]===0x0){return db['UserProfileResource'][_0x96b9('0x46')]({'name':_0x30f65e[_0x96b9('0x27')],'resourceId':_0x30f65e['id'],'type':_0x2f748c['name'],'sectionId':_0x2f748c['id']},{})[_0x96b9('0x20')](function(){return _0x7c9cab;});}else{return _0x7c9cab;}})[_0x96b9('0x42')](function(_0x4a7007){logger[_0x96b9('0x25')](_0x96b9('0x4c'),_0x4a7007);throw _0x4a7007;});}return _0x7c9cab;})[_0x96b9('0x20')](respondWithResult(_0x22e820,0xc9))['catch'](handleError(_0x22e820,null));};exports[_0x96b9('0x1f')]=function(_0x2a1d29,_0x482c6a){if(_0x2a1d29[_0x96b9('0x47')]['id']){delete _0x2a1d29[_0x96b9('0x47')]['id'];}return db[_0x96b9('0x2a')][_0x96b9('0x4a')]({'where':{'id':_0x2a1d29['params']['id']}})[_0x96b9('0x20')](handleEntityNotFound(_0x482c6a,null))[_0x96b9('0x20')](saveUpdates(_0x2a1d29['body'],null))['then'](respondWithResult(_0x482c6a,null))['catch'](handleError(_0x482c6a,null));};exports[_0x96b9('0x21')]=function(_0x5b35b4,_0x235b20){return db[_0x96b9('0x2a')][_0x96b9('0x4a')]({'where':{'id':_0x5b35b4['params']['id']}})[_0x96b9('0x20')](handleEntityNotFound(_0x235b20,null))['then'](removeEntity(_0x235b20,null))[_0x96b9('0x42')](handleError(_0x235b20,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 310dec5..1ea704d 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 _0xe1ea=['request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1ea,0x13c));var _0xae1e=function(_0xbcc1e9,_0x11270e){_0xbcc1e9=_0xbcc1e9-0x0;var _0x1fb04a=_0xe1ea[_0xbcc1e9];return _0x1fb04a;};'use strict';var _=require(_0xae1e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xae1e('0x1'));var BPromise=require(_0xae1e('0x2'));var rp=require(_0xae1e('0x3'));var fs=require('fs');var path=require(_0xae1e('0x4'));var rimraf=require(_0xae1e('0x5'));var config=require(_0xae1e('0x6'));var attributes=require('./template.attributes');module[_0xae1e('0x7')]=function(_0xa84083,_0xb537c3){return _0xa84083[_0xae1e('0x8')](_0xae1e('0x9'),attributes,{'tableName':_0xae1e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aab=['util','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash'];(function(_0x2f7e50,_0x1053b8){var _0x59f3cd=function(_0x4d2a95){while(--_0x4d2a95){_0x2f7e50['push'](_0x2f7e50['shift']());}};_0x59f3cd(++_0x1053b8);}(_0x1aab,0x1a3));var _0xb1aa=function(_0x9915a3,_0x394ee3){_0x9915a3=_0x9915a3-0x0;var _0x482cfb=_0x1aab[_0x9915a3];return _0x482cfb;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb1aa('0x2'));var BPromise=require(_0xb1aa('0x3'));var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1aa('0x7'));module[_0xb1aa('0x8')]=function(_0x4dbc03,_0x5a2f){return _0x4dbc03[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'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 f166e52..78b5ee4 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 _0xb418=['model','then','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','GetTemplate','Template','findAll','options','raw','where','attributes','include','map'];(function(_0x1a8bc4,_0x732fea){var _0x580f19=function(_0x27715a){while(--_0x27715a){_0x1a8bc4['push'](_0x1a8bc4['shift']());}};_0x580f19(++_0x732fea);}(_0xb418,0x1b6));var _0x8b41=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb418[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var moment=require(_0x8b41('0x2'));var BPromise=require(_0x8b41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b41('0x4'));var db=require(_0x8b41('0x5'))['db'];var utils=require(_0x8b41('0x6'));var logger=require('../../config/logger')(_0x8b41('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b41('0x8'));var client=jayson['client'][_0x8b41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x394d2d,_0x592c42,_0x154bd8){return new BPromise(function(_0x38a039,_0x518063){return client['request'](_0x394d2d,_0x154bd8)['then'](function(_0x4c22c0){logger[_0x8b41('0xa')]('Template,\x20%s,\x20%s',_0x592c42,'request\x20sent');logger['debug'](_0x8b41('0xb'),_0x592c42,'request\x20sent',JSON[_0x8b41('0xc')](_0x4c22c0));if(_0x4c22c0[_0x8b41('0xd')]){if(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xe')]===0x1f4){logger[_0x8b41('0xd')]('Template,\x20%s,\x20%s',_0x592c42,_0x4c22c0[_0x8b41('0xd')]['message']);return _0x518063(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xf')]);}logger[_0x8b41('0xd')](_0x8b41('0x10'),_0x592c42,_0x4c22c0[_0x8b41('0xd')]['message']);return _0x38a039(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xf')]);}else{logger['info'](_0x8b41('0x10'),_0x592c42,'request\x20sent');_0x38a039(_0x4c22c0[_0x8b41('0x11')]['message']);}})['catch'](function(_0x384ca0){logger[_0x8b41('0xd')](_0x8b41('0x10'),_0x592c42,_0x384ca0);_0x518063(_0x384ca0);});});}exports[_0x8b41('0x12')]=function(_0x3fa054){var _0x49047c=this;return new Promise(function(_0x4d0580,_0x5eb8ac){return db[_0x8b41('0x13')][_0x8b41('0x14')]({'raw':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x16')]===undefined?!![]:![]:!![],'where':_0x3fa054['options']?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x17')]||null:null,'attributes':_0x3fa054['options']?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x18')]||null:null,'limit':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')]['limit']||null:null,'include':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x3fa054['options'][_0x8b41('0x19')],function(_0x42f16d){return{'model':db[_0x42f16d['model']],'as':_0x42f16d['as'],'attributes':_0x42f16d['attributes'],'include':_0x42f16d[_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x42f16d[_0x8b41('0x19')],function(_0x32d35e){return{'model':db[_0x32d35e[_0x8b41('0x1b')]],'as':_0x32d35e['as'],'attributes':_0x32d35e[_0x8b41('0x18')],'include':_0x32d35e[_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x32d35e[_0x8b41('0x19')],function(_0x21ff61){return{'model':db[_0x21ff61[_0x8b41('0x1b')]],'as':_0x21ff61['as'],'attributes':_0x21ff61[_0x8b41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8b41('0x1c')](function(_0x18a254){logger['info'](_0x8b41('0x12'),_0x3fa054);logger[_0x8b41('0x1d')](_0x8b41('0x12'),_0x3fa054,JSON['stringify'](_0x18a254));_0x4d0580(_0x18a254);})[_0x8b41('0x1e')](function(_0x24c13f){logger[_0x8b41('0xd')](_0x8b41('0x12'),_0x24c13f[_0x8b41('0xf')],_0x3fa054);_0x5eb8ac(_0x49047c[_0x8b41('0xd')](0x1f4,_0x24c13f['message']));});});}; \ No newline at end of file +var _0x48f9=['rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','info','result','catch','GetTemplate','findAll','options','attributes','limit','include','map','model','stringify','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f3eb9,_0x244f91){var _0x2047b3=function(_0x111dd0){while(--_0x111dd0){_0x2f3eb9['push'](_0x2f3eb9['shift']());}};_0x2047b3(++_0x244f91);}(_0x48f9,0x1d9));var _0x948f=function(_0x3aa096,_0x293dd8){_0x3aa096=_0x3aa096-0x0;var _0x47809e=_0x48f9[_0x3aa096];return _0x47809e;};'use strict';var _=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var moment=require('moment');var BPromise=require(_0x948f('0x2'));var rs=require(_0x948f('0x3'));var fs=require('fs');var Redis=require(_0x948f('0x4'));var db=require(_0x948f('0x5'))['db'];var utils=require(_0x948f('0x6'));var logger=require('../../config/logger')(_0x948f('0x7'));var config=require(_0x948f('0x8'));var jayson=require(_0x948f('0x9'));var client=jayson[_0x948f('0xa')][_0x948f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32c7bf,_0x8012f1,_0x41051f){return new BPromise(function(_0x582e53,_0x341734){return client['request'](_0x32c7bf,_0x41051f)[_0x948f('0xc')](function(_0x337ece){logger['info']('Template,\x20%s,\x20%s',_0x8012f1,_0x948f('0xd'));logger[_0x948f('0xe')](_0x948f('0xf'),_0x8012f1,'request\x20sent',JSON['stringify'](_0x337ece));if(_0x337ece['error']){if(_0x337ece[_0x948f('0x10')][_0x948f('0x11')]===0x1f4){logger['error'](_0x948f('0x12'),_0x8012f1,_0x337ece[_0x948f('0x10')]['message']);return _0x341734(_0x337ece['error']['message']);}logger[_0x948f('0x10')](_0x948f('0x12'),_0x8012f1,_0x337ece[_0x948f('0x10')]['message']);return _0x582e53(_0x337ece['error']['message']);}else{logger[_0x948f('0x13')](_0x948f('0x12'),_0x8012f1,_0x948f('0xd'));_0x582e53(_0x337ece[_0x948f('0x14')]['message']);}})[_0x948f('0x15')](function(_0x11cf77){logger[_0x948f('0x10')]('Template,\x20%s,\x20%s',_0x8012f1,_0x11cf77);_0x341734(_0x11cf77);});});}exports[_0x948f('0x16')]=function(_0x525866){var _0x353bef=this;return new Promise(function(_0x3b9f61,_0x57fb41){return db['Template'][_0x948f('0x17')]({'raw':_0x525866['options']?_0x525866[_0x948f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x525866[_0x948f('0x18')]?_0x525866[_0x948f('0x18')]['where']||null:null,'attributes':_0x525866[_0x948f('0x18')]?_0x525866[_0x948f('0x18')][_0x948f('0x19')]||null:null,'limit':_0x525866[_0x948f('0x18')]?_0x525866[_0x948f('0x18')][_0x948f('0x1a')]||null:null,'include':_0x525866[_0x948f('0x18')]?_0x525866[_0x948f('0x18')][_0x948f('0x1b')]?_[_0x948f('0x1c')](_0x525866[_0x948f('0x18')][_0x948f('0x1b')],function(_0x2e0de5){return{'model':db[_0x2e0de5[_0x948f('0x1d')]],'as':_0x2e0de5['as'],'attributes':_0x2e0de5[_0x948f('0x19')],'include':_0x2e0de5[_0x948f('0x1b')]?_[_0x948f('0x1c')](_0x2e0de5[_0x948f('0x1b')],function(_0x469da5){return{'model':db[_0x469da5['model']],'as':_0x469da5['as'],'attributes':_0x469da5[_0x948f('0x19')],'include':_0x469da5[_0x948f('0x1b')]?_[_0x948f('0x1c')](_0x469da5['include'],function(_0x4bd880){return{'model':db[_0x4bd880['model']],'as':_0x4bd880['as'],'attributes':_0x4bd880[_0x948f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x948f('0xc')](function(_0x35f363){logger['info'](_0x948f('0x16'),_0x525866);logger[_0x948f('0xe')](_0x948f('0x16'),_0x525866,JSON[_0x948f('0x1e')](_0x35f363));_0x3b9f61(_0x35f363);})[_0x948f('0x15')](function(_0x20758e){logger[_0x948f('0x10')]('GetTemplate',_0x20758e[_0x948f('0x1f')],_0x525866);_0x57fb41(_0x353bef[_0x948f('0x10')](0x1f4,_0x20758e[_0x948f('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9e06673..b74f02c 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 _0x579a=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x579a,0x9d));var _0xa579=function(_0x237d34,_0x284bdf){_0x237d34=_0x237d34-0x0;var _0x36b9e5=_0x579a[_0x237d34];return _0x36b9e5;};'use strict';var multer=require(_0xa579('0x0'));var util=require(_0xa579('0x1'));var path=require(_0xa579('0x2'));var timeout=require(_0xa579('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa579('0x4'));var auth=require(_0xa579('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xa579('0x6')]('/',auth['isAuthenticated'](),controller[_0xa579('0x7')]);router[_0xa579('0x6')](_0xa579('0x8'),auth[_0xa579('0x9')](),controller[_0xa579('0xa')]);router[_0xa579('0x6')](_0xa579('0xb'),auth[_0xa579('0x9')](),controller['getAllConditions']);router[_0xa579('0x6')](_0xa579('0xc'),auth[_0xa579('0x9')](),controller[_0xa579('0xd')]);router['get'](_0xa579('0xe'),auth[_0xa579('0x9')](),controller[_0xa579('0xf')]);router[_0xa579('0x10')]('/',auth['isAuthenticated'](),controller[_0xa579('0x11')]);router[_0xa579('0x10')](_0xa579('0xb'),auth[_0xa579('0x9')](),controller[_0xa579('0x12')]);router[_0xa579('0x10')]('/:id/any_conditions',auth[_0xa579('0x9')](),controller['addAnyCondition']);router[_0xa579('0x10')](_0xa579('0xe'),auth[_0xa579('0x9')](),controller[_0xa579('0x13')]);router[_0xa579('0x14')](_0xa579('0x8'),auth[_0xa579('0x9')](),controller[_0xa579('0x15')]);router['delete'](_0xa579('0x8'),auth['isAuthenticated'](),controller[_0xa579('0x16')]);module[_0xa579('0x17')]=router; \ No newline at end of file +var _0xba40=['./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAllCondition','addAction','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b932d,_0x18a362){var _0x1abd79=function(_0x4efab5){while(--_0x4efab5){_0x4b932d['push'](_0x4b932d['shift']());}};_0x1abd79(++_0x18a362);}(_0xba40,0x75));var _0x0ba4=function(_0x3a7368,_0x185789){_0x3a7368=_0x3a7368-0x0;var _0x1aa883=_0xba40[_0x3a7368];return _0x1aa883;};'use strict';var multer=require(_0x0ba4('0x0'));var util=require('util');var path=require(_0x0ba4('0x1'));var timeout=require(_0x0ba4('0x2'));var express=require(_0x0ba4('0x3'));var router=express[_0x0ba4('0x4')]();var fs_extra=require(_0x0ba4('0x5'));var auth=require(_0x0ba4('0x6'));var interaction=require(_0x0ba4('0x7'));var config=require('../../config/environment');var controller=require(_0x0ba4('0x8'));router[_0x0ba4('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ba4('0xa')]);router[_0x0ba4('0x9')](_0x0ba4('0xb'),auth[_0x0ba4('0xc')](),controller[_0x0ba4('0xd')]);router[_0x0ba4('0x9')]('/:id/all_conditions',auth[_0x0ba4('0xc')](),controller[_0x0ba4('0xe')]);router[_0x0ba4('0x9')](_0x0ba4('0xf'),auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x10')]);router[_0x0ba4('0x9')](_0x0ba4('0x11'),auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x12')]);router['post']('/',auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x13')]);router[_0x0ba4('0x14')](_0x0ba4('0x15'),auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x16')]);router[_0x0ba4('0x14')](_0x0ba4('0xf'),auth[_0x0ba4('0xc')](),controller['addAnyCondition']);router[_0x0ba4('0x14')]('/:id/actions',auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x17')]);router['put'](_0x0ba4('0xb'),auth[_0x0ba4('0xc')](),controller['update']);router['delete'](_0x0ba4('0xb'),auth[_0x0ba4('0xc')](),controller[_0x0ba4('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index bdf442b..d7a15d6 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 _0xf6c2=['exports','STRING','sequelize'];(function(_0x45e4ff,_0x4230f7){var _0x2d34c1=function(_0x244e8c){while(--_0x244e8c){_0x45e4ff['push'](_0x45e4ff['shift']());}};_0x2d34c1(++_0x4230f7);}(_0xf6c2,0x1e8));var _0x2f6c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf6c2[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2f6c('0x0'));module[_0x2f6c('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2f6c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xad05=['exports','STRING','BOOLEAN','sequelize'];(function(_0x48826e,_0x45f6b8){var _0xddd825=function(_0x5a60d5){while(--_0x5a60d5){_0x48826e['push'](_0x48826e['shift']());}};_0xddd825(++_0x45f6b8);}(_0xad05,0x1c7));var _0x5ad0=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0xad05[_0x55ef8b];return _0x359c84;};'use strict';var Sequelize=require(_0x5ad0('0x0'));module[_0x5ad0('0x1')]={'name':{'type':Sequelize[_0x5ad0('0x2')]},'channel':{'type':Sequelize[_0x5ad0('0x2')]},'description':{'type':Sequelize[_0x5ad0('0x2')]},'status':{'type':Sequelize[_0x5ad0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3dbad24..ccf0fd4 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 _0xd6f5=['params','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','Trigger','findAll','rows','show'];(function(_0x571c65,_0x321f37){var _0x563767=function(_0x2e9f2a){while(--_0x2e9f2a){_0x571c65['push'](_0x571c65['shift']());}};_0x563767(++_0x321f37);}(_0xd6f5,0x75));var _0x5d6f=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xd6f5[_0x2678d6];return _0x475503;};'use strict';var emlformat=require(_0x5d6f('0x0'));var rimraf=require(_0x5d6f('0x1'));var zipdir=require(_0x5d6f('0x2'));var jsonpatch=require(_0x5d6f('0x3'));var rp=require(_0x5d6f('0x4'));var moment=require(_0x5d6f('0x5'));var BPromise=require(_0x5d6f('0x6'));var Mustache=require(_0x5d6f('0x7'));var util=require(_0x5d6f('0x8'));var path=require('path');var sox=require(_0x5d6f('0x9'));var csv=require(_0x5d6f('0xa'));var ejs=require(_0x5d6f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d6f('0xc'));var squel=require('squel');var crypto=require(_0x5d6f('0xd'));var jsforce=require(_0x5d6f('0xe'));var deskjs=require(_0x5d6f('0xf'));var toCsv=require(_0x5d6f('0xa'));var querystring=require(_0x5d6f('0x10'));var Papa=require(_0x5d6f('0x11'));var Redis=require(_0x5d6f('0x12'));var authService=require(_0x5d6f('0x13'));var qs=require(_0x5d6f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d6f('0x15'));var logger=require(_0x5d6f('0x16'))(_0x5d6f('0x17'));var utils=require('../../config/utils');var config=require(_0x5d6f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d6f('0x19'))['db'];function respondWithStatusCode(_0x489493,_0x4790dc){_0x4790dc=_0x4790dc||0xcc;return function(_0x32735a){if(_0x32735a){return _0x489493[_0x5d6f('0x1a')](_0x4790dc);}return _0x489493[_0x5d6f('0x1b')](_0x4790dc)['end']();};}function respondWithResult(_0x13c132,_0x5e451a){_0x5e451a=_0x5e451a||0xc8;return function(_0x9df947){if(_0x9df947){return _0x13c132[_0x5d6f('0x1b')](_0x5e451a)[_0x5d6f('0x1c')](_0x9df947);}};}function respondWithFilteredResult(_0x413b9c,_0x3c0cad){return function(_0x5773e2){if(_0x5773e2){var _0x2a408e=typeof _0x3c0cad[_0x5d6f('0x1d')]===_0x5d6f('0x1e')&&typeof _0x3c0cad[_0x5d6f('0x1f')]==='undefined';var _0x1c6ef6=_0x5773e2[_0x5d6f('0x20')];var _0xb4cdac=_0x2a408e?0x0:_0x3c0cad[_0x5d6f('0x1d')];var _0x34d7c7=_0x2a408e?_0x5773e2[_0x5d6f('0x20')]:_0x3c0cad[_0x5d6f('0x1d')]+_0x3c0cad[_0x5d6f('0x1f')];var _0x520e24;if(_0x34d7c7>=_0x1c6ef6){_0x34d7c7=_0x1c6ef6;_0x520e24=0xc8;}else{_0x520e24=0xce;}_0x413b9c['status'](_0x520e24);return _0x413b9c[_0x5d6f('0x21')]('Content-Range',_0xb4cdac+'-'+_0x34d7c7+'/'+_0x1c6ef6)[_0x5d6f('0x1c')](_0x5773e2);}return null;};}function patchUpdates(_0x1cdfdb){return function(_0xe65fc9){try{jsonpatch[_0x5d6f('0x22')](_0xe65fc9,_0x1cdfdb,!![]);}catch(_0x4a5ecf){return BPromise['reject'](_0x4a5ecf);}return _0xe65fc9[_0x5d6f('0x23')]();};}function saveUpdates(_0x1fc615,_0x4ba0d8){return function(_0x36d745){if(_0x36d745){return _0x36d745[_0x5d6f('0x24')](_0x1fc615)[_0x5d6f('0x25')](function(_0x485aba){return _0x485aba;});}return null;};}function removeEntity(_0x29630b,_0x10b13a){return function(_0x33c040){if(_0x33c040){return _0x33c040[_0x5d6f('0x26')]()[_0x5d6f('0x25')](function(){var _0x14c62d=_0x33c040[_0x5d6f('0x27')]({'plain':!![]});var _0x3d4bd6='Triggers';return db['UserProfileResource'][_0x5d6f('0x26')]({'where':{'type':_0x3d4bd6,'resourceId':_0x14c62d['id']}})['then'](function(){return _0x33c040;});})[_0x5d6f('0x25')](function(){_0x29630b[_0x5d6f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b580f,_0x5c6226){return function(_0x491716){if(!_0x491716){_0x4b580f[_0x5d6f('0x1a')](0x194);}return _0x491716;};}function handleError(_0x1bd8c2,_0x5f58de){_0x5f58de=_0x5f58de||0x1f4;return function(_0x940f4d){logger[_0x5d6f('0x28')](_0x940f4d[_0x5d6f('0x29')]);if(_0x940f4d['name']){delete _0x940f4d[_0x5d6f('0x2a')];}_0x1bd8c2[_0x5d6f('0x1b')](_0x5f58de)[_0x5d6f('0x2b')](_0x940f4d);};}exports['index']=function(_0x2395c9,_0x2f85b8){var _0x4f6bea={},_0x3c1e26={},_0x7689bc={'count':0x0,'rows':[]};var _0x2cc99c=_[_0x5d6f('0x2c')](db['Trigger'][_0x5d6f('0x2d')],function(_0x5bff01){return{'name':_0x5bff01[_0x5d6f('0x2e')],'type':_0x5bff01[_0x5d6f('0x2f')]['key']};});_0x3c1e26[_0x5d6f('0x30')]=_[_0x5d6f('0x2c')](_0x2cc99c,'name');_0x3c1e26['query']=_[_0x5d6f('0x31')](_0x2395c9[_0x5d6f('0x32')]);_0x3c1e26['filters']=_[_0x5d6f('0x33')](_0x3c1e26[_0x5d6f('0x30')],_0x3c1e26['query']);_0x4f6bea[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x3c1e26['model'],qs['fields'](_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x4f6bea[_0x5d6f('0x34')]=_0x4f6bea['attributes']['length']?_0x4f6bea[_0x5d6f('0x34')]:_0x3c1e26[_0x5d6f('0x30')];if(!_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x4f6bea['limit']=qs['limit'](_0x2395c9['query'][_0x5d6f('0x1f')]);_0x4f6bea[_0x5d6f('0x1d')]=qs[_0x5d6f('0x1d')](_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}_0x4f6bea[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x2395c9[_0x5d6f('0x32')]['sort']);_0x4f6bea['where']=qs[_0x5d6f('0x3a')](_['pick'](_0x2395c9['query'],_0x3c1e26[_0x5d6f('0x3a')]),_0x2cc99c);if(_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x4f6bea[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x4f6bea[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x2cc99c,function(_0x24ec2f){if(_0x24ec2f['type']!==_0x5d6f('0x3e')){var _0x4f1b62={};_0x4f1b62[_0x24ec2f[_0x5d6f('0x2a')]]={'$like':'%'+_0x2395c9['query'][_0x5d6f('0x3b')]+'%'};return _0x4f1b62;}})});}_0x4f6bea=_[_0x5d6f('0x3d')]({},_0x4f6bea,_0x2395c9[_0x5d6f('0x3f')]);var _0xe0d925={'where':_0x4f6bea[_0x5d6f('0x3c')]};return db['Trigger']['count'](_0xe0d925)[_0x5d6f('0x25')](function(_0x2c867d){_0x7689bc[_0x5d6f('0x20')]=_0x2c867d;if(_0x2395c9[_0x5d6f('0x32')]['includeAll']){_0x4f6bea[_0x5d6f('0x40')]=[{'all':!![]}];}return db[_0x5d6f('0x41')][_0x5d6f('0x42')](_0x4f6bea);})[_0x5d6f('0x25')](function(_0x3af4fd){_0x7689bc[_0x5d6f('0x43')]=_0x3af4fd;return _0x7689bc;})['then'](respondWithFilteredResult(_0x2f85b8,_0x4f6bea))['catch'](handleError(_0x2f85b8,null));};exports[_0x5d6f('0x44')]=function(_0x5e5832,_0x1c020a){var _0x2f7a32={'raw':![],'where':{'id':_0x5e5832[_0x5d6f('0x45')]['id']}},_0x50f8fe={};_0x50f8fe[_0x5d6f('0x30')]=_['keys'](db['Trigger'][_0x5d6f('0x2d')]);_0x50f8fe['query']=_['keys'](_0x5e5832['query']);_0x50f8fe['filters']=_[_0x5d6f('0x33')](_0x50f8fe['model'],_0x50f8fe[_0x5d6f('0x32')]);_0x2f7a32[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x50f8fe[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x5e5832[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x2f7a32[_0x5d6f('0x34')]=_0x2f7a32[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x2f7a32['attributes']:_0x50f8fe[_0x5d6f('0x30')];if(_0x5e5832['query'][_0x5d6f('0x47')]){_0x2f7a32[_0x5d6f('0x40')]=[{'all':!![]}];}_0x2f7a32=_[_0x5d6f('0x3d')]({},_0x2f7a32,_0x5e5832[_0x5d6f('0x3f')]);return db[_0x5d6f('0x41')]['find'](_0x2f7a32)[_0x5d6f('0x25')](handleEntityNotFound(_0x1c020a,null))['then'](respondWithResult(_0x1c020a,null))[_0x5d6f('0x48')](handleError(_0x1c020a,null));};exports[_0x5d6f('0x49')]=function(_0x3ed31d,_0x5138cf){return db[_0x5d6f('0x41')][_0x5d6f('0x49')](_0x3ed31d[_0x5d6f('0x4a')],{})['then'](function(_0x418785){var _0x2bcea0=_0x3ed31d[_0x5d6f('0x4b')][_0x5d6f('0x27')]({'plain':!![]});if(!_0x2bcea0)throw new Error(_0x5d6f('0x4c'));if(_0x2bcea0['role']===_0x5d6f('0x4b')){var _0xe2e8cb=_0x418785[_0x5d6f('0x27')]({'plain':!![]});var _0x1e2117='Triggers';return db[_0x5d6f('0x4d')][_0x5d6f('0x4e')]({'where':{'name':_0x1e2117,'userProfileId':_0x2bcea0[_0x5d6f('0x4f')]},'raw':!![]})[_0x5d6f('0x25')](function(_0xc43d27){if(_0xc43d27&&_0xc43d27[_0x5d6f('0x50')]===0x0){return db['UserProfileResource'][_0x5d6f('0x49')]({'name':_0xe2e8cb[_0x5d6f('0x2a')],'resourceId':_0xe2e8cb['id'],'type':_0xc43d27[_0x5d6f('0x2a')],'sectionId':_0xc43d27['id']},{})[_0x5d6f('0x25')](function(){return _0x418785;});}else{return _0x418785;}})[_0x5d6f('0x48')](function(_0xf596db){logger[_0x5d6f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf596db);throw _0xf596db;});}return _0x418785;})[_0x5d6f('0x25')](respondWithResult(_0x5138cf,0xc9))[_0x5d6f('0x48')](handleError(_0x5138cf,null));};exports[_0x5d6f('0x24')]=function(_0x404212,_0x14742b){if(_0x404212[_0x5d6f('0x4a')]['id']){delete _0x404212[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x404212[_0x5d6f('0x45')]['id']}})['then'](handleEntityNotFound(_0x14742b,null))['then'](saveUpdates(_0x404212[_0x5d6f('0x4a')],null))[_0x5d6f('0x25')](respondWithResult(_0x14742b,null))[_0x5d6f('0x48')](handleError(_0x14742b,null));};exports[_0x5d6f('0x26')]=function(_0x31dafe,_0x4af3c4){return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x31dafe['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x4af3c4,null))[_0x5d6f('0x25')](removeEntity(_0x4af3c4,null))[_0x5d6f('0x48')](handleError(_0x4af3c4,null));};exports[_0x5d6f('0x51')]=function(_0x28ae72,_0x438146,_0x22654a){if(_0x28ae72['body']['id']){delete _0x28ae72[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x28ae72['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x438146,null))[_0x5d6f('0x25')](function(_0x308630){if(_0x308630){_0x28ae72[_0x5d6f('0x4a')][_0x5d6f('0x52')]=_0x308630['id'];return db[_0x5d6f('0x53')]['create'](_0x28ae72[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x438146,null))[_0x5d6f('0x48')](handleError(_0x438146,null));};exports[_0x5d6f('0x54')]=function(_0x3d88f2,_0x3c0bc1,_0x1d0db5){if(_0x3d88f2[_0x5d6f('0x4a')]['id']){delete _0x3d88f2[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')]['find']({'where':{'id':_0x3d88f2['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x3c0bc1,null))[_0x5d6f('0x25')](function(_0x51c638){if(_0x51c638){_0x3d88f2[_0x5d6f('0x4a')][_0x5d6f('0x55')]=_0x51c638['id'];return db[_0x5d6f('0x53')][_0x5d6f('0x49')](_0x3d88f2[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x3c0bc1,null))[_0x5d6f('0x48')](handleError(_0x3c0bc1,null));};exports[_0x5d6f('0x56')]=function(_0x572b45,_0x379d11,_0x9610e5){var _0x1b210b={};var _0x4ac75c={};var _0x4aba42;var _0x41e055;return db[_0x5d6f('0x41')][_0x5d6f('0x57')]({'where':{'id':_0x572b45[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x379d11,null))[_0x5d6f('0x25')](function(_0xd0b154){if(_0xd0b154){_0x4aba42=_0xd0b154;_0x4ac75c['model']=_[_0x5d6f('0x31')](db[_0x5d6f('0x53')][_0x5d6f('0x2d')]);_0x4ac75c[_0x5d6f('0x32')]=_['keys'](_0x572b45['query']);_0x4ac75c['filters']=_[_0x5d6f('0x33')](_0x4ac75c['model'],_0x4ac75c['query']);_0x1b210b[_0x5d6f('0x34')]=_['intersection'](_0x4ac75c[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x1b210b[_0x5d6f('0x34')]=_0x1b210b[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x1b210b['attributes']:_0x4ac75c[_0x5d6f('0x30')];_0x1b210b[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x572b45[_0x5d6f('0x32')]['sort']);_0x1b210b[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x572b45[_0x5d6f('0x32')],_0x4ac75c[_0x5d6f('0x3a')]));if(_0x572b45[_0x5d6f('0x32')]['filter']){_0x1b210b[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x1b210b[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x1b210b[_0x5d6f('0x34')],function(_0x25a200){var _0x49d264={};_0x49d264[_0x25a200]={'$like':'%'+_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x3b')]+'%'};return _0x49d264;})});}_0x1b210b=_[_0x5d6f('0x3d')]({},_0x1b210b,_0x572b45['options']);return _0x4aba42['getAllConditions'](_0x1b210b);}})['then'](function(_0x92b63a){if(_0x92b63a){_0x41e055=_0x92b63a[_0x5d6f('0x46')];if(!_0x572b45[_0x5d6f('0x32')]['hasOwnProperty']('nolimit')){_0x1b210b[_0x5d6f('0x1f')]=qs[_0x5d6f('0x1f')](_0x572b45['query'][_0x5d6f('0x1f')]);_0x1b210b['offset']=qs[_0x5d6f('0x1d')](_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}return _0x4aba42['getAllConditions'](_0x1b210b);}})[_0x5d6f('0x25')](function(_0x56b39c){if(_0x56b39c){return _0x56b39c?{'count':_0x41e055,'rows':_0x56b39c}:null;}})['then'](respondWithResult(_0x379d11,null))[_0x5d6f('0x48')](handleError(_0x379d11,null));};exports[_0x5d6f('0x59')]=function(_0x13998d,_0x10fcd0,_0x373370){var _0x94d5d5={};var _0x835515={};var _0x55be67;var _0x1e2645;return db['Trigger'][_0x5d6f('0x57')]({'where':{'id':_0x13998d[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x10fcd0,null))[_0x5d6f('0x25')](function(_0x2507b4){if(_0x2507b4){_0x55be67=_0x2507b4;_0x835515['model']=_[_0x5d6f('0x31')](db['Condition']['rawAttributes']);_0x835515[_0x5d6f('0x32')]=_[_0x5d6f('0x31')](_0x13998d[_0x5d6f('0x32')]);_0x835515['filters']=_[_0x5d6f('0x33')](_0x835515[_0x5d6f('0x30')],_0x835515[_0x5d6f('0x32')]);_0x94d5d5[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x835515[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x94d5d5[_0x5d6f('0x34')]=_0x94d5d5['attributes'][_0x5d6f('0x46')]?_0x94d5d5[_0x5d6f('0x34')]:_0x835515[_0x5d6f('0x30')];_0x94d5d5[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x39')]);_0x94d5d5[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x13998d[_0x5d6f('0x32')],_0x835515[_0x5d6f('0x3a')]));if(_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x94d5d5[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x94d5d5[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x94d5d5[_0x5d6f('0x34')],function(_0x2b71f8){var _0x3b3304={};_0x3b3304[_0x2b71f8]={'$like':'%'+_0x13998d['query'][_0x5d6f('0x3b')]+'%'};return _0x3b3304;})});}_0x94d5d5=_[_0x5d6f('0x3d')]({},_0x94d5d5,_0x13998d[_0x5d6f('0x3f')]);return _0x55be67[_0x5d6f('0x59')](_0x94d5d5);}})[_0x5d6f('0x25')](function(_0x434898){if(_0x434898){_0x1e2645=_0x434898[_0x5d6f('0x46')];if(!_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x94d5d5[_0x5d6f('0x1f')]=qs[_0x5d6f('0x1f')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x1f')]);_0x94d5d5['offset']=qs['offset'](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}return _0x55be67['getAnyConditions'](_0x94d5d5);}})[_0x5d6f('0x25')](function(_0x5ee6a2){if(_0x5ee6a2){return _0x5ee6a2?{'count':_0x1e2645,'rows':_0x5ee6a2}:null;}})['then'](respondWithResult(_0x10fcd0,null))[_0x5d6f('0x48')](handleError(_0x10fcd0,null));};exports[_0x5d6f('0x5a')]=function(_0x58a127,_0x4de6a6,_0x4e6b11){if(_0x58a127[_0x5d6f('0x4a')]['id']){delete _0x58a127[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x58a127[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x4de6a6,null))[_0x5d6f('0x25')](function(_0x3ae0d1){if(_0x3ae0d1){_0x58a127['body'][_0x5d6f('0x5b')]=_0x3ae0d1['id'];return db['Action'][_0x5d6f('0x49')](_0x58a127[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x4de6a6,null))['catch'](handleError(_0x4de6a6,null));};exports[_0x5d6f('0x5c')]=function(_0x6f6410,_0x5c3b3d,_0x26d190){var _0x57a1c8={};var _0x109852={};var _0x19f3f3;var _0x4a9f3d;return db[_0x5d6f('0x41')][_0x5d6f('0x57')]({'where':{'id':_0x6f6410[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x5c3b3d,null))[_0x5d6f('0x25')](function(_0x1a573a){if(_0x1a573a){_0x19f3f3=_0x1a573a;_0x109852[_0x5d6f('0x30')]=_[_0x5d6f('0x31')](db['Action']['rawAttributes']);_0x109852[_0x5d6f('0x32')]=_[_0x5d6f('0x31')](_0x6f6410[_0x5d6f('0x32')]);_0x109852[_0x5d6f('0x3a')]=_['intersection'](_0x109852[_0x5d6f('0x30')],_0x109852[_0x5d6f('0x32')]);_0x57a1c8[_0x5d6f('0x34')]=_['intersection'](_0x109852[_0x5d6f('0x30')],qs['fields'](_0x6f6410[_0x5d6f('0x32')]['fields']));_0x57a1c8['attributes']=_0x57a1c8[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x57a1c8[_0x5d6f('0x34')]:_0x109852['model'];_0x57a1c8['order']=qs[_0x5d6f('0x39')](_0x6f6410['query'][_0x5d6f('0x39')]);_0x57a1c8[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x6f6410[_0x5d6f('0x32')],_0x109852['filters']));if(_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x57a1c8[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x57a1c8[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x57a1c8[_0x5d6f('0x34')],function(_0x5e4a14){var _0x1f346b={};_0x1f346b[_0x5e4a14]={'$like':'%'+_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x3b')]+'%'};return _0x1f346b;})});}_0x57a1c8=_['merge']({},_0x57a1c8,_0x6f6410['options']);return _0x19f3f3[_0x5d6f('0x5c')](_0x57a1c8);}})[_0x5d6f('0x25')](function(_0x566cdc){if(_0x566cdc){_0x4a9f3d=_0x566cdc[_0x5d6f('0x46')];if(!_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x57a1c8['limit']=qs[_0x5d6f('0x1f')](_0x6f6410[_0x5d6f('0x32')]['limit']);_0x57a1c8['offset']=qs[_0x5d6f('0x1d')](_0x6f6410['query'][_0x5d6f('0x1d')]);}return _0x19f3f3[_0x5d6f('0x5c')](_0x57a1c8);}})[_0x5d6f('0x25')](function(_0xb72484){if(_0xb72484){return _0xb72484?{'count':_0x4a9f3d,'rows':_0xb72484}:null;}})[_0x5d6f('0x25')](respondWithResult(_0x5c3b3d,null))['catch'](handleError(_0x5c3b3d,null));}; \ No newline at end of file +var _0x2800=['map','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','pick','filter','merge','include','rows','catch','show','params','Trigger','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index'];(function(_0x37ba7e,_0x39c47c){var _0x3a65b3=function(_0x4764ee){while(--_0x4764ee){_0x37ba7e['push'](_0x37ba7e['shift']());}};_0x3a65b3(++_0x39c47c);}(_0x2800,0x1aa));var _0x0280=function(_0x5d06b9,_0x218131){_0x5d06b9=_0x5d06b9-0x0;var _0x14ea3a=_0x2800[_0x5d06b9];return _0x14ea3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0280('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0280('0x1'));var rp=require(_0x0280('0x2'));var moment=require(_0x0280('0x3'));var BPromise=require(_0x0280('0x4'));var Mustache=require(_0x0280('0x5'));var util=require(_0x0280('0x6'));var path=require(_0x0280('0x7'));var sox=require(_0x0280('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0280('0x9'));var _=require('lodash');var squel=require(_0x0280('0xa'));var crypto=require(_0x0280('0xb'));var jsforce=require(_0x0280('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0280('0xd'));var Papa=require(_0x0280('0xe'));var Redis=require('ioredis');var authService=require(_0x0280('0xf'));var qs=require(_0x0280('0x10'));var as=require(_0x0280('0x11'));var hardwareService=require(_0x0280('0x12'));var logger=require(_0x0280('0x13'))(_0x0280('0x14'));var utils=require('../../config/utils');var config=require(_0x0280('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0280('0x16'))['db'];function respondWithStatusCode(_0x4f96b8,_0x45f552){_0x45f552=_0x45f552||0xcc;return function(_0xf41f90){if(_0xf41f90){return _0x4f96b8[_0x0280('0x17')](_0x45f552);}return _0x4f96b8['status'](_0x45f552)[_0x0280('0x18')]();};}function respondWithResult(_0x10136b,_0x2a9a9d){_0x2a9a9d=_0x2a9a9d||0xc8;return function(_0x149248){if(_0x149248){return _0x10136b[_0x0280('0x19')](_0x2a9a9d)[_0x0280('0x1a')](_0x149248);}};}function respondWithFilteredResult(_0x59d898,_0x27faa9){return function(_0x160f0c){if(_0x160f0c){var _0x319b42=typeof _0x27faa9[_0x0280('0x1b')]==='undefined'&&typeof _0x27faa9[_0x0280('0x1c')]===_0x0280('0x1d');var _0xe80328=_0x160f0c[_0x0280('0x1e')];var _0x27c734=_0x319b42?0x0:_0x27faa9[_0x0280('0x1b')];var _0xf26375=_0x319b42?_0x160f0c[_0x0280('0x1e')]:_0x27faa9[_0x0280('0x1b')]+_0x27faa9['limit'];var _0x225918;if(_0xf26375>=_0xe80328){_0xf26375=_0xe80328;_0x225918=0xc8;}else{_0x225918=0xce;}_0x59d898[_0x0280('0x19')](_0x225918);return _0x59d898['set']('Content-Range',_0x27c734+'-'+_0xf26375+'/'+_0xe80328)[_0x0280('0x1a')](_0x160f0c);}return null;};}function patchUpdates(_0xab746c){return function(_0x110fa7){try{jsonpatch[_0x0280('0x1f')](_0x110fa7,_0xab746c,!![]);}catch(_0x2b0f06){return BPromise[_0x0280('0x20')](_0x2b0f06);}return _0x110fa7[_0x0280('0x21')]();};}function saveUpdates(_0x2ff553,_0x22b35a){return function(_0x491368){if(_0x491368){return _0x491368[_0x0280('0x22')](_0x2ff553)[_0x0280('0x23')](function(_0x30d2b9){return _0x30d2b9;});}return null;};}function removeEntity(_0x357888,_0x604ca8){return function(_0x5cc6d9){if(_0x5cc6d9){return _0x5cc6d9[_0x0280('0x24')]()[_0x0280('0x23')](function(){var _0x5bd375=_0x5cc6d9[_0x0280('0x25')]({'plain':!![]});var _0x2b85cd=_0x0280('0x26');return db[_0x0280('0x27')][_0x0280('0x24')]({'where':{'type':_0x2b85cd,'resourceId':_0x5bd375['id']}})[_0x0280('0x23')](function(){return _0x5cc6d9;});})[_0x0280('0x23')](function(){_0x357888[_0x0280('0x19')](0xcc)[_0x0280('0x18')]();});}};}function handleEntityNotFound(_0x183bfc,_0x107202){return function(_0x19ed5e){if(!_0x19ed5e){_0x183bfc['sendStatus'](0x194);}return _0x19ed5e;};}function handleError(_0x58e2b3,_0x2a0a80){_0x2a0a80=_0x2a0a80||0x1f4;return function(_0x5e0c63){logger[_0x0280('0x28')](_0x5e0c63['stack']);if(_0x5e0c63[_0x0280('0x29')]){delete _0x5e0c63[_0x0280('0x29')];}_0x58e2b3[_0x0280('0x19')](_0x2a0a80)[_0x0280('0x2a')](_0x5e0c63);};}exports[_0x0280('0x2b')]=function(_0x27aada,_0x45fe27){var _0x37e5bc={},_0x5e8e6b={},_0x2c854c={'count':0x0,'rows':[]};var _0x202328=_[_0x0280('0x2c')](db['Trigger'][_0x0280('0x2d')],function(_0xa0b41b){return{'name':_0xa0b41b[_0x0280('0x2e')],'type':_0xa0b41b[_0x0280('0x2f')][_0x0280('0x30')]};});_0x5e8e6b['model']=_['map'](_0x202328,_0x0280('0x29'));_0x5e8e6b[_0x0280('0x31')]=_[_0x0280('0x32')](_0x27aada[_0x0280('0x31')]);_0x5e8e6b['filters']=_[_0x0280('0x33')](_0x5e8e6b['model'],_0x5e8e6b[_0x0280('0x31')]);_0x37e5bc['attributes']=_[_0x0280('0x33')](_0x5e8e6b['model'],qs['fields'](_0x27aada[_0x0280('0x31')][_0x0280('0x34')]));_0x37e5bc[_0x0280('0x35')]=_0x37e5bc['attributes'][_0x0280('0x36')]?_0x37e5bc[_0x0280('0x35')]:_0x5e8e6b[_0x0280('0x37')];if(!_0x27aada[_0x0280('0x31')]['hasOwnProperty'](_0x0280('0x38'))){_0x37e5bc[_0x0280('0x1c')]=qs[_0x0280('0x1c')](_0x27aada[_0x0280('0x31')][_0x0280('0x1c')]);_0x37e5bc['offset']=qs[_0x0280('0x1b')](_0x27aada[_0x0280('0x31')][_0x0280('0x1b')]);}_0x37e5bc[_0x0280('0x39')]=qs[_0x0280('0x3a')](_0x27aada[_0x0280('0x31')][_0x0280('0x3a')]);_0x37e5bc[_0x0280('0x3b')]=qs[_0x0280('0x3c')](_[_0x0280('0x3d')](_0x27aada['query'],_0x5e8e6b[_0x0280('0x3c')]),_0x202328);if(_0x27aada[_0x0280('0x31')][_0x0280('0x3e')]){_0x37e5bc[_0x0280('0x3b')]=_[_0x0280('0x3f')](_0x37e5bc[_0x0280('0x3b')],{'$or':_[_0x0280('0x2c')](_0x202328,function(_0x29c839){if(_0x29c839['type']!=='VIRTUAL'){var _0x209166={};_0x209166[_0x29c839[_0x0280('0x29')]]={'$like':'%'+_0x27aada[_0x0280('0x31')][_0x0280('0x3e')]+'%'};return _0x209166;}})});}_0x37e5bc=_[_0x0280('0x3f')]({},_0x37e5bc,_0x27aada['options']);var _0x663b2b={'where':_0x37e5bc[_0x0280('0x3b')]};return db['Trigger']['count'](_0x663b2b)['then'](function(_0x426587){_0x2c854c['count']=_0x426587;if(_0x27aada[_0x0280('0x31')]['includeAll']){_0x37e5bc[_0x0280('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x37e5bc);})['then'](function(_0x3d5d72){_0x2c854c[_0x0280('0x41')]=_0x3d5d72;return _0x2c854c;})[_0x0280('0x23')](respondWithFilteredResult(_0x45fe27,_0x37e5bc))[_0x0280('0x42')](handleError(_0x45fe27,null));};exports[_0x0280('0x43')]=function(_0xad8e86,_0x1f4cab){var _0x4f22e8={'raw':![],'where':{'id':_0xad8e86[_0x0280('0x44')]['id']}},_0x39bf40={};_0x39bf40[_0x0280('0x37')]=_[_0x0280('0x32')](db[_0x0280('0x45')]['rawAttributes']);_0x39bf40[_0x0280('0x31')]=_[_0x0280('0x32')](_0xad8e86[_0x0280('0x31')]);_0x39bf40[_0x0280('0x3c')]=_[_0x0280('0x33')](_0x39bf40[_0x0280('0x37')],_0x39bf40['query']);_0x4f22e8[_0x0280('0x35')]=_[_0x0280('0x33')](_0x39bf40[_0x0280('0x37')],qs['fields'](_0xad8e86['query'][_0x0280('0x34')]));_0x4f22e8[_0x0280('0x35')]=_0x4f22e8['attributes'][_0x0280('0x36')]?_0x4f22e8[_0x0280('0x35')]:_0x39bf40['model'];if(_0xad8e86['query'][_0x0280('0x46')]){_0x4f22e8['include']=[{'all':!![]}];}_0x4f22e8=_['merge']({},_0x4f22e8,_0xad8e86[_0x0280('0x47')]);return db[_0x0280('0x45')][_0x0280('0x48')](_0x4f22e8)['then'](handleEntityNotFound(_0x1f4cab,null))[_0x0280('0x23')](respondWithResult(_0x1f4cab,null))['catch'](handleError(_0x1f4cab,null));};exports[_0x0280('0x49')]=function(_0x13add3,_0x14d545){return db[_0x0280('0x45')][_0x0280('0x49')](_0x13add3['body'],{})[_0x0280('0x23')](function(_0xec8670){var _0x51a64f=_0x13add3[_0x0280('0x4a')][_0x0280('0x25')]({'plain':!![]});if(!_0x51a64f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51a64f[_0x0280('0x4b')]===_0x0280('0x4a')){var _0x324246=_0xec8670[_0x0280('0x25')]({'plain':!![]});var _0x53c970='Triggers';return db[_0x0280('0x4c')][_0x0280('0x48')]({'where':{'name':_0x53c970,'userProfileId':_0x51a64f[_0x0280('0x4d')]},'raw':!![]})['then'](function(_0xb1a7a0){if(_0xb1a7a0&&_0xb1a7a0[_0x0280('0x4e')]===0x0){return db['UserProfileResource'][_0x0280('0x49')]({'name':_0x324246[_0x0280('0x29')],'resourceId':_0x324246['id'],'type':_0xb1a7a0['name'],'sectionId':_0xb1a7a0['id']},{})[_0x0280('0x23')](function(){return _0xec8670;});}else{return _0xec8670;}})[_0x0280('0x42')](function(_0x135f1d){logger[_0x0280('0x28')](_0x0280('0x4f'),_0x135f1d);throw _0x135f1d;});}return _0xec8670;})[_0x0280('0x23')](respondWithResult(_0x14d545,0xc9))[_0x0280('0x42')](handleError(_0x14d545,null));};exports['update']=function(_0x88d4c5,_0x51597c){if(_0x88d4c5['body']['id']){delete _0x88d4c5[_0x0280('0x50')]['id'];}return db[_0x0280('0x45')][_0x0280('0x48')]({'where':{'id':_0x88d4c5[_0x0280('0x44')]['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x51597c,null))[_0x0280('0x23')](saveUpdates(_0x88d4c5[_0x0280('0x50')],null))[_0x0280('0x23')](respondWithResult(_0x51597c,null))[_0x0280('0x42')](handleError(_0x51597c,null));};exports[_0x0280('0x24')]=function(_0x54c766,_0x341d78){return db[_0x0280('0x45')]['find']({'where':{'id':_0x54c766['params']['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x341d78,null))[_0x0280('0x23')](removeEntity(_0x341d78,null))['catch'](handleError(_0x341d78,null));};exports[_0x0280('0x51')]=function(_0x29a7e9,_0x58712d,_0x4873a3){if(_0x29a7e9['body']['id']){delete _0x29a7e9[_0x0280('0x50')]['id'];}return db[_0x0280('0x45')][_0x0280('0x48')]({'where':{'id':_0x29a7e9['params']['id']}})['then'](handleEntityNotFound(_0x58712d,null))['then'](function(_0x52efad){if(_0x52efad){_0x29a7e9[_0x0280('0x50')][_0x0280('0x52')]=_0x52efad['id'];return db['Condition'][_0x0280('0x49')](_0x29a7e9[_0x0280('0x50')]);}})[_0x0280('0x23')](respondWithResult(_0x58712d,null))[_0x0280('0x42')](handleError(_0x58712d,null));};exports[_0x0280('0x53')]=function(_0x1b11c7,_0x4c7a22,_0x5a7e63){if(_0x1b11c7['body']['id']){delete _0x1b11c7[_0x0280('0x50')]['id'];}return db[_0x0280('0x45')][_0x0280('0x48')]({'where':{'id':_0x1b11c7[_0x0280('0x44')]['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x4c7a22,null))['then'](function(_0x3bc5e0){if(_0x3bc5e0){_0x1b11c7['body'][_0x0280('0x54')]=_0x3bc5e0['id'];return db[_0x0280('0x55')]['create'](_0x1b11c7[_0x0280('0x50')]);}})['then'](respondWithResult(_0x4c7a22,null))[_0x0280('0x42')](handleError(_0x4c7a22,null));};exports[_0x0280('0x56')]=function(_0x48be4b,_0x10d08b,_0x294314){var _0x918738={};var _0x52ece3={};var _0x48692d;var _0x37e70c;return db[_0x0280('0x45')][_0x0280('0x57')]({'where':{'id':_0x48be4b['params']['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x10d08b,null))[_0x0280('0x23')](function(_0x45f741){if(_0x45f741){_0x48692d=_0x45f741;_0x52ece3[_0x0280('0x37')]=_[_0x0280('0x32')](db[_0x0280('0x55')]['rawAttributes']);_0x52ece3['query']=_[_0x0280('0x32')](_0x48be4b[_0x0280('0x31')]);_0x52ece3['filters']=_[_0x0280('0x33')](_0x52ece3[_0x0280('0x37')],_0x52ece3[_0x0280('0x31')]);_0x918738[_0x0280('0x35')]=_['intersection'](_0x52ece3[_0x0280('0x37')],qs[_0x0280('0x34')](_0x48be4b['query'][_0x0280('0x34')]));_0x918738[_0x0280('0x35')]=_0x918738['attributes'][_0x0280('0x36')]?_0x918738[_0x0280('0x35')]:_0x52ece3['model'];_0x918738[_0x0280('0x39')]=qs['sort'](_0x48be4b[_0x0280('0x31')][_0x0280('0x3a')]);_0x918738[_0x0280('0x3b')]=qs[_0x0280('0x3c')](_[_0x0280('0x3d')](_0x48be4b[_0x0280('0x31')],_0x52ece3['filters']));if(_0x48be4b[_0x0280('0x31')][_0x0280('0x3e')]){_0x918738[_0x0280('0x3b')]=_[_0x0280('0x3f')](_0x918738[_0x0280('0x3b')],{'$or':_[_0x0280('0x2c')](_0x918738[_0x0280('0x35')],function(_0x3e328d){var _0x37ccc4={};_0x37ccc4[_0x3e328d]={'$like':'%'+_0x48be4b[_0x0280('0x31')][_0x0280('0x3e')]+'%'};return _0x37ccc4;})});}_0x918738=_[_0x0280('0x3f')]({},_0x918738,_0x48be4b['options']);return _0x48692d['getAllConditions'](_0x918738);}})['then'](function(_0x330228){if(_0x330228){_0x37e70c=_0x330228[_0x0280('0x36')];if(!_0x48be4b['query']['hasOwnProperty'](_0x0280('0x38'))){_0x918738[_0x0280('0x1c')]=qs[_0x0280('0x1c')](_0x48be4b[_0x0280('0x31')][_0x0280('0x1c')]);_0x918738[_0x0280('0x1b')]=qs[_0x0280('0x1b')](_0x48be4b[_0x0280('0x31')]['offset']);}return _0x48692d[_0x0280('0x56')](_0x918738);}})['then'](function(_0x31790c){if(_0x31790c){return _0x31790c?{'count':_0x37e70c,'rows':_0x31790c}:null;}})['then'](respondWithResult(_0x10d08b,null))[_0x0280('0x42')](handleError(_0x10d08b,null));};exports[_0x0280('0x58')]=function(_0x181ff0,_0x2a91f3,_0x1a277c){var _0x124bf1={};var _0x21f36b={};var _0x316dbe;var _0x18eb90;return db[_0x0280('0x45')][_0x0280('0x57')]({'where':{'id':_0x181ff0[_0x0280('0x44')]['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x2a91f3,null))[_0x0280('0x23')](function(_0x5dd016){if(_0x5dd016){_0x316dbe=_0x5dd016;_0x21f36b[_0x0280('0x37')]=_[_0x0280('0x32')](db['Condition'][_0x0280('0x2d')]);_0x21f36b['query']=_['keys'](_0x181ff0[_0x0280('0x31')]);_0x21f36b['filters']=_[_0x0280('0x33')](_0x21f36b[_0x0280('0x37')],_0x21f36b[_0x0280('0x31')]);_0x124bf1[_0x0280('0x35')]=_['intersection'](_0x21f36b['model'],qs[_0x0280('0x34')](_0x181ff0[_0x0280('0x31')][_0x0280('0x34')]));_0x124bf1[_0x0280('0x35')]=_0x124bf1[_0x0280('0x35')][_0x0280('0x36')]?_0x124bf1[_0x0280('0x35')]:_0x21f36b['model'];_0x124bf1['order']=qs[_0x0280('0x3a')](_0x181ff0[_0x0280('0x31')][_0x0280('0x3a')]);_0x124bf1[_0x0280('0x3b')]=qs['filters'](_[_0x0280('0x3d')](_0x181ff0[_0x0280('0x31')],_0x21f36b[_0x0280('0x3c')]));if(_0x181ff0[_0x0280('0x31')][_0x0280('0x3e')]){_0x124bf1[_0x0280('0x3b')]=_['merge'](_0x124bf1['where'],{'$or':_[_0x0280('0x2c')](_0x124bf1[_0x0280('0x35')],function(_0x4bfd98){var _0x498927={};_0x498927[_0x4bfd98]={'$like':'%'+_0x181ff0[_0x0280('0x31')][_0x0280('0x3e')]+'%'};return _0x498927;})});}_0x124bf1=_[_0x0280('0x3f')]({},_0x124bf1,_0x181ff0[_0x0280('0x47')]);return _0x316dbe[_0x0280('0x58')](_0x124bf1);}})[_0x0280('0x23')](function(_0x2453ca){if(_0x2453ca){_0x18eb90=_0x2453ca[_0x0280('0x36')];if(!_0x181ff0[_0x0280('0x31')][_0x0280('0x59')](_0x0280('0x38'))){_0x124bf1[_0x0280('0x1c')]=qs[_0x0280('0x1c')](_0x181ff0['query'][_0x0280('0x1c')]);_0x124bf1['offset']=qs[_0x0280('0x1b')](_0x181ff0[_0x0280('0x31')]['offset']);}return _0x316dbe['getAnyConditions'](_0x124bf1);}})[_0x0280('0x23')](function(_0x2e9bb1){if(_0x2e9bb1){return _0x2e9bb1?{'count':_0x18eb90,'rows':_0x2e9bb1}:null;}})[_0x0280('0x23')](respondWithResult(_0x2a91f3,null))[_0x0280('0x42')](handleError(_0x2a91f3,null));};exports[_0x0280('0x5a')]=function(_0x4ed207,_0x1b040c,_0x474454){if(_0x4ed207[_0x0280('0x50')]['id']){delete _0x4ed207[_0x0280('0x50')]['id'];}return db[_0x0280('0x45')][_0x0280('0x48')]({'where':{'id':_0x4ed207[_0x0280('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b040c,null))[_0x0280('0x23')](function(_0x1dd2cb){if(_0x1dd2cb){_0x4ed207[_0x0280('0x50')][_0x0280('0x5b')]=_0x1dd2cb['id'];return db[_0x0280('0x5c')][_0x0280('0x49')](_0x4ed207['body']);}})[_0x0280('0x23')](respondWithResult(_0x1b040c,null))[_0x0280('0x42')](handleError(_0x1b040c,null));};exports['getActions']=function(_0x3f54ff,_0x25aa6b,_0x57a470){var _0x1aba70={};var _0x185e64={};var _0x56487c;var _0x15033d;return db[_0x0280('0x45')][_0x0280('0x57')]({'where':{'id':_0x3f54ff['params']['id']}})[_0x0280('0x23')](handleEntityNotFound(_0x25aa6b,null))['then'](function(_0x3ac8f5){if(_0x3ac8f5){_0x56487c=_0x3ac8f5;_0x185e64[_0x0280('0x37')]=_['keys'](db[_0x0280('0x5c')][_0x0280('0x2d')]);_0x185e64[_0x0280('0x31')]=_[_0x0280('0x32')](_0x3f54ff[_0x0280('0x31')]);_0x185e64[_0x0280('0x3c')]=_[_0x0280('0x33')](_0x185e64['model'],_0x185e64[_0x0280('0x31')]);_0x1aba70['attributes']=_[_0x0280('0x33')](_0x185e64[_0x0280('0x37')],qs[_0x0280('0x34')](_0x3f54ff[_0x0280('0x31')][_0x0280('0x34')]));_0x1aba70['attributes']=_0x1aba70[_0x0280('0x35')][_0x0280('0x36')]?_0x1aba70[_0x0280('0x35')]:_0x185e64[_0x0280('0x37')];_0x1aba70[_0x0280('0x39')]=qs[_0x0280('0x3a')](_0x3f54ff[_0x0280('0x31')][_0x0280('0x3a')]);_0x1aba70['where']=qs[_0x0280('0x3c')](_['pick'](_0x3f54ff[_0x0280('0x31')],_0x185e64[_0x0280('0x3c')]));if(_0x3f54ff[_0x0280('0x31')][_0x0280('0x3e')]){_0x1aba70[_0x0280('0x3b')]=_['merge'](_0x1aba70['where'],{'$or':_['map'](_0x1aba70[_0x0280('0x35')],function(_0x27993a){var _0x515440={};_0x515440[_0x27993a]={'$like':'%'+_0x3f54ff['query'][_0x0280('0x3e')]+'%'};return _0x515440;})});}_0x1aba70=_['merge']({},_0x1aba70,_0x3f54ff[_0x0280('0x47')]);return _0x56487c[_0x0280('0x5d')](_0x1aba70);}})[_0x0280('0x23')](function(_0x3c227b){if(_0x3c227b){_0x15033d=_0x3c227b[_0x0280('0x36')];if(!_0x3f54ff[_0x0280('0x31')]['hasOwnProperty']('nolimit')){_0x1aba70[_0x0280('0x1c')]=qs['limit'](_0x3f54ff['query'][_0x0280('0x1c')]);_0x1aba70[_0x0280('0x1b')]=qs['offset'](_0x3f54ff['query'][_0x0280('0x1b')]);}return _0x56487c[_0x0280('0x5d')](_0x1aba70);}})[_0x0280('0x23')](function(_0x59497c){if(_0x59497c){return _0x59497c?{'count':_0x15033d,'rows':_0x59497c}:null;}})[_0x0280('0x23')](respondWithResult(_0x25aa6b,null))[_0x0280('0x42')](handleError(_0x25aa6b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fc8c497..b12f7ab 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 _0x9b9b=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0xe4d2fa,_0x1e8116){var _0x34ec66=function(_0x4426c6){while(--_0x4426c6){_0xe4d2fa['push'](_0xe4d2fa['shift']());}};_0x34ec66(++_0x1e8116);}(_0x9b9b,0x114));var _0xb9b9=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x9b9b[_0x197185];return _0x2c8af1;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x544a=['util','../../config/logger','bluebird','path','rimraf','./trigger.attributes','exports','define','tools_triggers','lodash'];(function(_0x1cc9a6,_0x1a80ed){var _0x2fe9a5=function(_0x4993bd){while(--_0x4993bd){_0x1cc9a6['push'](_0x1cc9a6['shift']());}};_0x2fe9a5(++_0x1a80ed);}(_0x544a,0xbd));var _0xa544=function(_0x409be6,_0x26af75){_0x409be6=_0x409be6-0x0;var _0xd31dc0=_0x544a[_0x409be6];return _0xd31dc0;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa544('0x4'));var rimraf=require(_0xa544('0x5'));var config=require('../../config/environment');var attributes=require(_0xa544('0x6'));module[_0xa544('0x7')]=function(_0x2f5992,_0x15a604){return _0x2f5992[_0xa544('0x8')]('Trigger',attributes,{'tableName':_0xa544('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 4ff2a25..485938b 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 _0xeb8f=['catch','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0xeb8f,0xde));var _0xfeb8=function(_0x8582c4,_0x206cbf){_0x8582c4=_0x8582c4-0x0;var _0x581f5f=_0xeb8f[_0x8582c4];return _0x581f5f;};'use strict';var _=require(_0xfeb8('0x0'));var util=require(_0xfeb8('0x1'));var moment=require(_0xfeb8('0x2'));var BPromise=require(_0xfeb8('0x3'));var rs=require(_0xfeb8('0x4'));var fs=require('fs');var Redis=require(_0xfeb8('0x5'));var db=require(_0xfeb8('0x6'))['db'];var utils=require(_0xfeb8('0x7'));var logger=require(_0xfeb8('0x8'))('rpc');var config=require(_0xfeb8('0x9'));var jayson=require(_0xfeb8('0xa'));var client=jayson[_0xfeb8('0xb')][_0xfeb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c637e,_0x98ed5d,_0x16cb05){return new BPromise(function(_0x584955,_0x3407ab){return client[_0xfeb8('0xd')](_0x3c637e,_0x16cb05)[_0xfeb8('0xe')](function(_0x4d7a15){logger['info']('Trigger,\x20%s,\x20%s',_0x98ed5d,_0xfeb8('0xf'));logger['debug'](_0xfeb8('0x10'),_0x98ed5d,_0xfeb8('0xf'),JSON[_0xfeb8('0x11')](_0x4d7a15));if(_0x4d7a15['error']){if(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x13')]===0x1f4){logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);return _0x3407ab(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);}logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);return _0x584955(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);}else{logger[_0xfeb8('0x16')](_0xfeb8('0x14'),_0x98ed5d,_0xfeb8('0xf'));_0x584955(_0x4d7a15['result'][_0xfeb8('0x15')]);}})[_0xfeb8('0x17')](function(_0x4eb6ac){logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4eb6ac);_0x3407ab(_0x4eb6ac);});});}exports[_0xfeb8('0x18')]=function(_0xe1e8d){var _0x119b42=this;return new Promise(function(_0x50cf91,_0x44233d){return db[_0xfeb8('0x19')]['findAll']({'raw':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1b')]===undefined?!![]:![]:!![],'where':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1c')]||null:null,'attributes':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1d')]||null:null,'limit':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')]['limit']||null:null,'include':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1e')],function(_0x284d81){return{'model':db[_0x284d81[_0xfeb8('0x20')]],'as':_0x284d81['as'],'attributes':_0x284d81[_0xfeb8('0x1d')],'include':_0x284d81['include']?_[_0xfeb8('0x1f')](_0x284d81['include'],function(_0x5a7314){return{'model':db[_0x5a7314[_0xfeb8('0x20')]],'as':_0x5a7314['as'],'attributes':_0x5a7314[_0xfeb8('0x1d')],'include':_0x5a7314['include']?_[_0xfeb8('0x1f')](_0x5a7314[_0xfeb8('0x1e')],function(_0x24a68e){return{'model':db[_0x24a68e[_0xfeb8('0x20')]],'as':_0x24a68e['as'],'attributes':_0x24a68e[_0xfeb8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34eefb){logger[_0xfeb8('0x16')]('GetTrigger',_0xe1e8d);logger[_0xfeb8('0x21')](_0xfeb8('0x18'),_0xe1e8d,JSON[_0xfeb8('0x11')](_0x34eefb));_0x50cf91(_0x34eefb);})[_0xfeb8('0x17')](function(_0x2b4e65){logger[_0xfeb8('0x12')](_0xfeb8('0x18'),_0x2b4e65[_0xfeb8('0x15')],_0xe1e8d);_0x44233d(_0x119b42[_0xfeb8('0x12')](0x1f4,_0x2b4e65[_0xfeb8('0x15')]));});});};exports[_0xfeb8('0x22')]=function(_0x1e0288){var _0x1af8ce=this;return new Promise(function(_0x15b36d,_0x5c9f09){return db['Trigger']['find']({'raw':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288['options'][_0xfeb8('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0288['options']?_0x1e0288[_0xfeb8('0x1a')][_0xfeb8('0x1c')]||null:null,'attributes':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288[_0xfeb8('0x1a')]['attributes']||null:null,'include':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288[_0xfeb8('0x1a')][_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0x1e0288['options'][_0xfeb8('0x1e')],function(_0x585ee9){return{'model':db[_0x585ee9[_0xfeb8('0x20')]],'as':_0x585ee9['as'],'attributes':_0x585ee9[_0xfeb8('0x1d')],'include':_0x585ee9['include']?_[_0xfeb8('0x1f')](_0x585ee9[_0xfeb8('0x1e')],function(_0x5c3148){return{'model':db[_0x5c3148[_0xfeb8('0x20')]],'as':_0x5c3148['as'],'attributes':_0x5c3148[_0xfeb8('0x1d')],'include':_0x5c3148[_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0x5c3148[_0xfeb8('0x1e')],function(_0x39c1ea){return{'model':db[_0x39c1ea[_0xfeb8('0x20')]],'as':_0x39c1ea['as'],'attributes':_0x39c1ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xfeb8('0xe')](function(_0x549a){logger['info'](_0xfeb8('0x22'),_0x1e0288);logger[_0xfeb8('0x21')](_0xfeb8('0x22'),_0x1e0288,JSON[_0xfeb8('0x11')](_0x549a));_0x15b36d(_0x549a);})[_0xfeb8('0x17')](function(_0x2d8ffa){logger[_0xfeb8('0x12')]('ShowTrigger',_0x2d8ffa[_0xfeb8('0x15')],_0x1e0288);_0x5c9f09(_0x1af8ce[_0xfeb8('0x12')](0x1f4,_0x2d8ffa['message']));});});}; \ No newline at end of file +var _0x6f72=['findAll','options','attributes','limit','include','model','map','then','ShowTrigger','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger'];(function(_0x5b6b27,_0x2bc626){var _0x2405b5=function(_0x21128a){while(--_0x21128a){_0x5b6b27['push'](_0x5b6b27['shift']());}};_0x2405b5(++_0x2bc626);}(_0x6f72,0x12b));var _0x26f7=function(_0x219e63,_0x48cc87){_0x219e63=_0x219e63-0x0;var _0x255887=_0x6f72[_0x219e63];return _0x255887;};'use strict';var _=require(_0x26f7('0x0'));var util=require(_0x26f7('0x1'));var moment=require(_0x26f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x26f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26f7('0x4'))['db'];var utils=require(_0x26f7('0x5'));var logger=require('../../config/logger')(_0x26f7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26f7('0x7')][_0x26f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e070f,_0x3075e8,_0x4cfd73){return new BPromise(function(_0x1013d4,_0x1e795e){return client['request'](_0x4e070f,_0x4cfd73)['then'](function(_0xbc43d9){logger[_0x26f7('0x9')](_0x26f7('0xa'),_0x3075e8,_0x26f7('0xb'));logger[_0x26f7('0xc')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3075e8,_0x26f7('0xb'),JSON[_0x26f7('0xd')](_0xbc43d9));if(_0xbc43d9['error']){if(_0xbc43d9[_0x26f7('0xe')][_0x26f7('0xf')]===0x1f4){logger['error'](_0x26f7('0xa'),_0x3075e8,_0xbc43d9[_0x26f7('0xe')]['message']);return _0x1e795e(_0xbc43d9[_0x26f7('0xe')][_0x26f7('0x10')]);}logger[_0x26f7('0xe')](_0x26f7('0xa'),_0x3075e8,_0xbc43d9[_0x26f7('0xe')][_0x26f7('0x10')]);return _0x1013d4(_0xbc43d9[_0x26f7('0xe')][_0x26f7('0x10')]);}else{logger[_0x26f7('0x9')](_0x26f7('0xa'),_0x3075e8,_0x26f7('0xb'));_0x1013d4(_0xbc43d9[_0x26f7('0x11')][_0x26f7('0x10')]);}})[_0x26f7('0x12')](function(_0x5a31a2){logger['error']('Trigger,\x20%s,\x20%s',_0x3075e8,_0x5a31a2);_0x1e795e(_0x5a31a2);});});}exports[_0x26f7('0x13')]=function(_0x37b975){var _0x24633f=this;return new Promise(function(_0x1fc84a,_0x515e35){return db[_0x26f7('0x14')][_0x26f7('0x15')]({'raw':_0x37b975[_0x26f7('0x16')]?_0x37b975[_0x26f7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x37b975[_0x26f7('0x16')]?_0x37b975[_0x26f7('0x16')]['where']||null:null,'attributes':_0x37b975['options']?_0x37b975[_0x26f7('0x16')][_0x26f7('0x17')]||null:null,'limit':_0x37b975['options']?_0x37b975[_0x26f7('0x16')][_0x26f7('0x18')]||null:null,'include':_0x37b975[_0x26f7('0x16')]?_0x37b975[_0x26f7('0x16')][_0x26f7('0x19')]?_['map'](_0x37b975['options'][_0x26f7('0x19')],function(_0x588f53){return{'model':db[_0x588f53[_0x26f7('0x1a')]],'as':_0x588f53['as'],'attributes':_0x588f53[_0x26f7('0x17')],'include':_0x588f53['include']?_[_0x26f7('0x1b')](_0x588f53['include'],function(_0x2a3781){return{'model':db[_0x2a3781[_0x26f7('0x1a')]],'as':_0x2a3781['as'],'attributes':_0x2a3781[_0x26f7('0x17')],'include':_0x2a3781['include']?_[_0x26f7('0x1b')](_0x2a3781[_0x26f7('0x19')],function(_0x6bef2c){return{'model':db[_0x6bef2c['model']],'as':_0x6bef2c['as'],'attributes':_0x6bef2c[_0x26f7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x26f7('0x1c')](function(_0x25da70){logger[_0x26f7('0x9')](_0x26f7('0x13'),_0x37b975);logger['debug'](_0x26f7('0x13'),_0x37b975,JSON[_0x26f7('0xd')](_0x25da70));_0x1fc84a(_0x25da70);})[_0x26f7('0x12')](function(_0x3dfffb){logger[_0x26f7('0xe')]('GetTrigger',_0x3dfffb[_0x26f7('0x10')],_0x37b975);_0x515e35(_0x24633f['error'](0x1f4,_0x3dfffb[_0x26f7('0x10')]));});});};exports[_0x26f7('0x1d')]=function(_0x17de40){var _0x1dd398=this;return new Promise(function(_0x509664,_0x38f18e){return db[_0x26f7('0x14')]['find']({'raw':_0x17de40[_0x26f7('0x16')]?_0x17de40[_0x26f7('0x16')][_0x26f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x17de40[_0x26f7('0x16')]?_0x17de40[_0x26f7('0x16')][_0x26f7('0x1f')]||null:null,'attributes':_0x17de40[_0x26f7('0x16')]?_0x17de40[_0x26f7('0x16')]['attributes']||null:null,'include':_0x17de40[_0x26f7('0x16')]?_0x17de40[_0x26f7('0x16')][_0x26f7('0x19')]?_[_0x26f7('0x1b')](_0x17de40[_0x26f7('0x16')][_0x26f7('0x19')],function(_0x3dd256){return{'model':db[_0x3dd256[_0x26f7('0x1a')]],'as':_0x3dd256['as'],'attributes':_0x3dd256[_0x26f7('0x17')],'include':_0x3dd256['include']?_[_0x26f7('0x1b')](_0x3dd256[_0x26f7('0x19')],function(_0x5cb63a){return{'model':db[_0x5cb63a[_0x26f7('0x1a')]],'as':_0x5cb63a['as'],'attributes':_0x5cb63a[_0x26f7('0x17')],'include':_0x5cb63a[_0x26f7('0x19')]?_[_0x26f7('0x1b')](_0x5cb63a[_0x26f7('0x19')],function(_0x4aa1a6){return{'model':db[_0x4aa1a6[_0x26f7('0x1a')]],'as':_0x4aa1a6['as'],'attributes':_0x4aa1a6[_0x26f7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x26f7('0x1c')](function(_0x234686){logger[_0x26f7('0x9')](_0x26f7('0x1d'),_0x17de40);logger[_0x26f7('0xc')](_0x26f7('0x1d'),_0x17de40,JSON[_0x26f7('0xd')](_0x234686));_0x509664(_0x234686);})[_0x26f7('0x12')](function(_0x48cdaf){logger[_0x26f7('0xe')]('ShowTrigger',_0x48cdaf[_0x26f7('0x10')],_0x17de40);_0x38f18e(_0x1dd398[_0x26f7('0xe')](0x1f4,_0x48cdaf[_0x26f7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 60a5663..1af8f58 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 _0x8bdc=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','clone'];(function(_0x10e902,_0x3c6cab){var _0x4f083c=function(_0x17c795){while(--_0x17c795){_0x10e902['push'](_0x10e902['shift']());}};_0x4f083c(++_0x3c6cab);}(_0x8bdc,0xf9));var _0xc8bd=function(_0x207185,_0xb1d561){_0x207185=_0x207185-0x0;var _0x3b614f=_0x8bdc[_0x207185];return _0x3b614f;};'use strict';var multer=require('multer');var util=require(_0xc8bd('0x0'));var path=require(_0xc8bd('0x1'));var timeout=require(_0xc8bd('0x2'));var express=require(_0xc8bd('0x3'));var router=express[_0xc8bd('0x4')]();var fs_extra=require(_0xc8bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8bd('0x6'));var config=require(_0xc8bd('0x7'));var controller=require(_0xc8bd('0x8'));router[_0xc8bd('0x9')]('/',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xb')]);router[_0xc8bd('0x9')]('/:id',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xc')]);router[_0xc8bd('0xd')]('/:id/clone',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xe')]);router[_0xc8bd('0xd')]('/',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xf')]);router[_0xc8bd('0x10')](_0xc8bd('0x11'),auth[_0xc8bd('0xa')](),controller[_0xc8bd('0x12')]);router[_0xc8bd('0x13')](_0xc8bd('0x11'),auth['isAuthenticated'](),controller[_0xc8bd('0x14')]);module[_0xc8bd('0x15')]=router; \ No newline at end of file +var _0x684f=['post','/:id/clone','clone','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','index','/:id','isAuthenticated','show'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x684f,0x105));var _0xf684=function(_0x3d1cb1,_0x550062){_0x3d1cb1=_0x3d1cb1-0x0;var _0xbdb9ea=_0x684f[_0x3d1cb1];return _0xbdb9ea;};'use strict';var multer=require('multer');var util=require(_0xf684('0x0'));var path=require(_0xf684('0x1'));var timeout=require(_0xf684('0x2'));var express=require('express');var router=express[_0xf684('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf684('0x4'));var interaction=require(_0xf684('0x5'));var config=require('../../config/environment');var controller=require(_0xf684('0x6'));router[_0xf684('0x7')]('/',auth['isAuthenticated'](),controller[_0xf684('0x8')]);router[_0xf684('0x7')](_0xf684('0x9'),auth[_0xf684('0xa')](),controller[_0xf684('0xb')]);router[_0xf684('0xc')](_0xf684('0xd'),auth['isAuthenticated'](),controller[_0xf684('0xe')]);router[_0xf684('0xc')]('/',auth['isAuthenticated'](),controller[_0xf684('0xf')]);router[_0xf684('0x10')](_0xf684('0x9'),auth[_0xf684('0xa')](),controller[_0xf684('0x11')]);router[_0xf684('0x12')](_0xf684('0x9'),auth[_0xf684('0xa')](),controller[_0xf684('0x13')]);module[_0xf684('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 14fcc14..9395bb5 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 _0x6fb6=['shortinfo','inband','auto','nonat','update','yes','force_rport,comedia','getDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x3914ec,_0x251e79){var _0x2149ba=function(_0x8081f5){while(--_0x8081f5){_0x3914ec['push'](_0x3914ec['shift']());}};_0x2149ba(++_0x251e79);}(_0x6fb6,0x87));var _0x66fb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6fb6[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x66fb('0x0'));module[_0x66fb('0x1')]={'name':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'unique':_0x66fb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x5'),_0x66fb('0x6'),'peer'),'allowNull':![],'defaultValue':_0x66fb('0x5')},'context':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'defaultValue':_0x66fb('0x7')},'callingpres':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x8'),_0x66fb('0x9'),_0x66fb('0xa'),_0x66fb('0xb'),_0x66fb('0xc'),_0x66fb('0xd'),_0x66fb('0xe'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x66fb('0x2')]},'md5secret':{'type':Sequelize[_0x66fb('0x2')]},'remotesecret':{'type':Sequelize[_0x66fb('0x2')]},'transport':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':'udp','set':function(_0x467d6b){this[_0x66fb('0xf')]('transport',_0x467d6b?_0x467d6b[_0x66fb('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x66fb('0x11'))['split'](','):null;},'comment':_0x66fb('0x12')},'dtmfmode':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x13'),_0x66fb('0x14'),_0x66fb('0x15'),_0x66fb('0x16'),_0x66fb('0x17')),'defaultValue':_0x66fb('0x13')},'directmedia':{'type':Sequelize[_0x66fb('0x4')]('yes','no',_0x66fb('0x18'),_0x66fb('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x66fb('0x2')]},'directmediadeny':{'type':Sequelize[_0x66fb('0x2')]},'nat':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x1b'),'set':function(_0x3e5181){this[_0x66fb('0xf')]('nat',_0x3e5181?_0x3e5181['join'](','):null);},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x1d'))?this[_0x66fb('0x1c')](_0x66fb('0x1d'))[_0x66fb('0x1e')](','):null;},'comment':_0x66fb('0x1f')},'callgroup':{'type':Sequelize[_0x66fb('0x2')]},'namedcallgroup':{'type':Sequelize[_0x66fb('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x66fb('0x2')]},'language':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x66fb('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x20')},'allow':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'defaultValue':_0x66fb('0x21'),'set':function(_0x55b419){this[_0x66fb('0xf')](_0x66fb('0x22'),_0x55b419?_0x55b419[_0x66fb('0x10')](';'):_0x66fb('0x21'));},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x22'))?this[_0x66fb('0x1c')](_0x66fb('0x22'))[_0x66fb('0x1e')](';'):null;},'comment':_0x66fb('0x23')},'autoframing':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x66fb('0x24'),'set':function(_0x315ccf){this['setDataValue']('insecure',_0x315ccf?_0x315ccf[_0x66fb('0x10')](','):null);},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x25'))?this[_0x66fb('0x1c')](_0x66fb('0x25'))[_0x66fb('0x1e')](','):null;},'comment':_0x66fb('0x26')},'trustrpid':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x66fb('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x66fb('0x27')](0xb)},'setvar':{'type':Sequelize[_0x66fb('0x2')]},'callerid':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x28')},'amaflags':{'type':Sequelize[_0x66fb('0x2')]},'callcounter':{'type':Sequelize[_0x66fb('0x4')]('yes','no'),'defaultValue':_0x66fb('0x1a')},'busylevel':{'type':Sequelize[_0x66fb('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x66fb('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x66fb('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no',_0x66fb('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x66fb('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x66fb('0x2')]},'session_timers':{'type':Sequelize[_0x66fb('0x4')]('accept',_0x66fb('0x2a'),_0x66fb('0x2b'))},'session_expires':{'type':Sequelize[_0x66fb('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x66fb('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x66fb('0x2c'),_0x66fb('0x2d')),'defaultValue':_0x66fb('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x66fb('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x66fb('0x2')]},'fromuser':{'type':Sequelize[_0x66fb('0x2')]},'port':{'type':Sequelize[_0x66fb('0x27')](0x5)},'qualify':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':_0x66fb('0x1a')},'keepalive':{'type':Sequelize[_0x66fb('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x66fb('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x66fb('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x66fb('0x2')]},'callbackextension':{'type':Sequelize[_0x66fb('0x2')]},'timert1':{'type':Sequelize[_0x66fb('0x27')](0xb)},'timerb':{'type':Sequelize[_0x66fb('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x66fb('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x66fb('0x2')]},'contactacl':{'type':Sequelize[_0x66fb('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x66fb('0x2')]},'use_q850_reason':{'type':Sequelize[_0x66fb('0x2')]},'maxforwards':{'type':Sequelize[_0x66fb('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x66fb('0x4')]('yes','no',_0x66fb('0x2e'),_0x66fb('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x66fb('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x66fb('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x66fb('0x2')]},'dtlscipher':{'type':Sequelize[_0x66fb('0x2')]},'dtlscafile':{'type':Sequelize[_0x66fb('0x2')]},'dtlscapath':{'type':Sequelize[_0x66fb('0x2')]},'dtlssetup':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x30'),_0x66fb('0x31'),_0x66fb('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x66fb('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x66fb('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x66fb('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x66fb('0x2')]},'mohinterpret':{'type':Sequelize[_0x66fb('0x2')]},'mohsuggest':{'type':Sequelize[_0x66fb('0x2')]},'parkinglot':{'type':Sequelize[_0x66fb('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x66fb('0x33')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x66fb('0x18'),_0x66fb('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x66fb('0x2')]},'otherFields':{'type':Sequelize[_0x66fb('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe0c7=['outgoing','force_rport,comedia','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]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','accept','originate','uas','pai','certificate','active','actpass','nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update'];(function(_0x3a5b2b,_0x48a3cc){var _0x37ddfe=function(_0x55dd78){while(--_0x55dd78){_0x3a5b2b['push'](_0x3a5b2b['shift']());}};_0x37ddfe(++_0x48a3cc);}(_0xe0c7,0x17c));var _0x7e0c=function(_0x3a856e,_0x26a506){_0x3a856e=_0x3a856e-0x0;var _0x4289fb=_0xe0c7[_0x3a856e];return _0x4289fb;};'use strict';var Sequelize=require(_0x7e0c('0x0'));module[_0x7e0c('0x1')]={'name':{'type':Sequelize[_0x7e0c('0x2')],'allowNull':![],'unique':_0x7e0c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x5'),_0x7e0c('0x6'),_0x7e0c('0x7')),'allowNull':![],'defaultValue':_0x7e0c('0x5')},'context':{'type':Sequelize[_0x7e0c('0x2')],'allowNull':![],'defaultValue':_0x7e0c('0x8')},'callingpres':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x9'),'ALLOWED_PASSED_SCREEN',_0x7e0c('0xa'),_0x7e0c('0xb'),_0x7e0c('0xc'),'PROHIB_PASSED_SCREEN',_0x7e0c('0xd'),_0x7e0c('0xe'))},'deny':{'type':Sequelize[_0x7e0c('0x2')]},'permit':{'type':Sequelize[_0x7e0c('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7e0c('0x2')]},'remotesecret':{'type':Sequelize[_0x7e0c('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7e0c('0xf'),'set':function(_0x5a4ef3){this['setDataValue'](_0x7e0c('0x10'),_0x5a4ef3?_0x5a4ef3[_0x7e0c('0x11')](','):null);},'get':function(){return this[_0x7e0c('0x12')]('transport')?this[_0x7e0c('0x12')](_0x7e0c('0x10'))[_0x7e0c('0x13')](','):null;},'comment':_0x7e0c('0x14')},'dtmfmode':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x15'),_0x7e0c('0x16'),_0x7e0c('0x17'),_0x7e0c('0x18'),_0x7e0c('0x19')),'defaultValue':_0x7e0c('0x15')},'directmedia':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no','nonat',_0x7e0c('0x1b'),_0x7e0c('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7e0c('0x2')]},'directmediadeny':{'type':Sequelize[_0x7e0c('0x2')]},'nat':{'type':Sequelize[_0x7e0c('0x2')],'defaultValue':_0x7e0c('0x1d'),'set':function(_0x599471){this[_0x7e0c('0x1e')](_0x7e0c('0x1f'),_0x599471?_0x599471[_0x7e0c('0x11')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x7e0c('0x12')](_0x7e0c('0x1f'))[_0x7e0c('0x13')](','):null;},'comment':_0x7e0c('0x20')},'callgroup':{'type':Sequelize[_0x7e0c('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7e0c('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7e0c('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7e0c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7e0c('0x2')],'defaultValue':_0x7e0c('0x21')},'allow':{'type':Sequelize[_0x7e0c('0x2')],'allowNull':![],'defaultValue':_0x7e0c('0x22'),'set':function(_0x5101ae){this['setDataValue'](_0x7e0c('0x23'),_0x5101ae?_0x5101ae['join'](';'):_0x7e0c('0x22'));},'get':function(){return this[_0x7e0c('0x12')](_0x7e0c('0x23'))?this[_0x7e0c('0x12')](_0x7e0c('0x23'))['split'](';'):null;},'comment':_0x7e0c('0x24')},'autoframing':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7e0c('0x25'),'set':function(_0x146338){this[_0x7e0c('0x1e')]('insecure',_0x146338?_0x146338['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x7e0c('0x12')](_0x7e0c('0x26'))[_0x7e0c('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7e0c('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no',_0x7e0c('0x27'))},'promiscredir':{'type':Sequelize[_0x7e0c('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x7e0c('0x2')]},'callerid':{'type':Sequelize[_0x7e0c('0x2')],'defaultValue':_0x7e0c('0x28')},'amaflags':{'type':Sequelize[_0x7e0c('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no'),'defaultValue':_0x7e0c('0x1a')},'busylevel':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x7e0c('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7e0c('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x7e0c('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x7e0c('0x2')]},'session_timers':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x2a'),'refuse',_0x7e0c('0x2b'))},'session_expires':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0x7e0c('0x4')]('uac',_0x7e0c('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7e0c('0x2')]},'regexten':{'type':Sequelize[_0x7e0c('0x2')]},'fromdomain':{'type':Sequelize[_0x7e0c('0x2')]},'fromuser':{'type':Sequelize[_0x7e0c('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no'),'defaultValue':_0x7e0c('0x1a')},'keepalive':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'defaultip':{'type':Sequelize[_0x7e0c('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no',_0x7e0c('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7e0c('0x2')]},'callbackextension':{'type':Sequelize[_0x7e0c('0x2')]},'timert1':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0x7e0c('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7e0c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x7e0c('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x7e0c('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no','fingerprint',_0x7e0c('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x7e0c('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7e0c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x7e0c('0x2')]},'dtlscipher':{'type':Sequelize[_0x7e0c('0x2')]},'dtlscafile':{'type':Sequelize[_0x7e0c('0x2')]},'dtlscapath':{'type':Sequelize[_0x7e0c('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7e0c('0x2f'),'passive',_0x7e0c('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7e0c('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x7e0c('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7e0c('0x2')]},'recordofffeature':{'type':Sequelize[_0x7e0c('0x2')]},'call_limit':{'type':Sequelize[_0x7e0c('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x7e0c('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x7e0c('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x7e0c('0x2')]},'parkinglot':{'type':Sequelize[_0x7e0c('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7e0c('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x7e0c('0x4')](_0x7e0c('0x1a'),'no',_0x7e0c('0x31'),_0x7e0c('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7e0c('0x2')]},'otherFields':{'type':Sequelize[_0x7e0c('0x2')]},'active':{'type':Sequelize[_0x7e0c('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index b1a29d1..db452bd 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x10fabc,_0x38a95b){var _0x11472f=function(_0x5ad663){while(--_0x5ad663){_0x10fabc['push'](_0x10fabc['shift']());}};_0x11472f(++_0x38a95b);}(_0x6aa7,0x178));var _0x76aa=function(_0x47da0f,_0x5239f6){_0x47da0f=_0x47da0f-0x0;var _0x1ec262=_0x6aa7[_0x47da0f];return _0x1ec262;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x190e1f,_0x11e558){var _0x2ba93a=function(_0x395440){while(--_0x395440){_0x190e1f['push'](_0x190e1f['shift']());}};_0x2ba93a(++_0x11e558);}(_0x54ef,0x112));var _0xf54e=function(_0x32515c,_0x36f54d){_0x32515c=_0x32515c-0x0;var _0x1a28ae=_0x54ef[_0x32515c];return _0x1a28ae;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e334a6e..babf45e 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 _0x92eb=['Trunk','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0xa16401,_0x9a9949){var _0x3d5676=function(_0x2e639f){while(--_0x2e639f){_0xa16401['push'](_0xa16401['shift']());}};_0x3d5676(++_0x9a9949);}(_0x92eb,0x156));var _0xb92e=function(_0x3ce0b6,_0x2e1e86){_0x3ce0b6=_0x3ce0b6-0x0;var _0x399f48=_0x92eb[_0x3ce0b6];return _0x399f48;};'use strict';var _=require('lodash');var util=require(_0xb92e('0x0'));var logger=require(_0xb92e('0x1'))(_0xb92e('0x2'));var moment=require(_0xb92e('0x3'));var BPromise=require(_0xb92e('0x4'));var rp=require(_0xb92e('0x5'));var fs=require('fs');var path=require(_0xb92e('0x6'));var rimraf=require(_0xb92e('0x7'));var config=require(_0xb92e('0x8'));var attributes=require(_0xb92e('0x9'));module['exports']=function(_0x3d64ac,_0x1e1923){return _0x3d64ac['define'](_0xb92e('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd556=['tools_trunks','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x5a250a,_0x226c7c){var _0x529483=function(_0x36bc90){while(--_0x36bc90){_0x5a250a['push'](_0x5a250a['shift']());}};_0x529483(++_0x226c7c);}(_0xd556,0x7a));var _0x6d55=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd556[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x6d55('0x0'));var util=require(_0x6d55('0x1'));var logger=require('../../config/logger')(_0x6d55('0x2'));var moment=require(_0x6d55('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d55('0x4'));var fs=require('fs');var path=require(_0x6d55('0x5'));var rimraf=require(_0x6d55('0x6'));var config=require(_0x6d55('0x7'));var attributes=require(_0x6d55('0x8'));module[_0x6d55('0x9')]=function(_0x4675dc,_0x551847){return _0x4675dc['define']('Trunk',attributes,{'tableName':_0x6d55('0xa'),'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 1044a21..bb2e31d 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 _0x61af=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetTrunk','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','util'];(function(_0x59ddd3,_0x21440c){var _0x49fb32=function(_0x35d5dd){while(--_0x35d5dd){_0x59ddd3['push'](_0x59ddd3['shift']());}};_0x49fb32(++_0x21440c);}(_0x61af,0x196));var _0xf61a=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0x61af[_0x1e93fa];return _0xd4e1e6;};'use strict';var _=require(_0xf61a('0x0'));var util=require(_0xf61a('0x1'));var moment=require(_0xf61a('0x2'));var BPromise=require(_0xf61a('0x3'));var rs=require(_0xf61a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf61a('0x5'))['db'];var utils=require(_0xf61a('0x6'));var logger=require('../../config/logger')(_0xf61a('0x7'));var config=require(_0xf61a('0x8'));var jayson=require(_0xf61a('0x9'));var client=jayson[_0xf61a('0xa')][_0xf61a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13c804,_0x493d87,_0x446478){return new BPromise(function(_0xf4a25a,_0x44d535){return client[_0xf61a('0xc')](_0x13c804,_0x446478)[_0xf61a('0xd')](function(_0x12ceb2){logger['info'](_0xf61a('0xe'),_0x493d87,'request\x20sent');logger[_0xf61a('0xf')](_0xf61a('0x10'),_0x493d87,_0xf61a('0x11'),JSON[_0xf61a('0x12')](_0x12ceb2));if(_0x12ceb2[_0xf61a('0x13')]){if(_0x12ceb2[_0xf61a('0x13')]['code']===0x1f4){logger[_0xf61a('0x13')](_0xf61a('0xe'),_0x493d87,_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);return _0x44d535(_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);}logger[_0xf61a('0x13')](_0xf61a('0xe'),_0x493d87,_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);return _0xf4a25a(_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);}else{logger[_0xf61a('0x15')](_0xf61a('0xe'),_0x493d87,_0xf61a('0x11'));_0xf4a25a(_0x12ceb2['result']['message']);}})[_0xf61a('0x16')](function(_0x5cfca7){logger['error'](_0xf61a('0xe'),_0x493d87,_0x5cfca7);_0x44d535(_0x5cfca7);});});}exports[_0xf61a('0x17')]=function(_0x4435ae){var _0x28e064=this;return new Promise(function(_0x47ff27,_0x37c060){return db['Trunk']['findAll']({'raw':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x19')]===undefined?!![]:![]:!![],'where':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')]['where']||null:null,'attributes':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1a')]||null:null,'limit':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1b')]||null:null,'include':_0x4435ae['options']?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1c')],function(_0x448f33){return{'model':db[_0x448f33['model']],'as':_0x448f33['as'],'attributes':_0x448f33[_0xf61a('0x1a')],'include':_0x448f33[_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x448f33[_0xf61a('0x1c')],function(_0x29e286){return{'model':db[_0x29e286[_0xf61a('0x1e')]],'as':_0x29e286['as'],'attributes':_0x29e286[_0xf61a('0x1a')],'include':_0x29e286[_0xf61a('0x1c')]?_['map'](_0x29e286[_0xf61a('0x1c')],function(_0x1a2e87){return{'model':db[_0x1a2e87[_0xf61a('0x1e')]],'as':_0x1a2e87['as'],'attributes':_0x1a2e87[_0xf61a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e1e87){logger['info'](_0xf61a('0x17'),_0x4435ae);logger['debug']('GetTrunk',_0x4435ae,JSON['stringify'](_0x5e1e87));_0x47ff27(_0x5e1e87);})[_0xf61a('0x16')](function(_0x63f0f2){logger[_0xf61a('0x13')](_0xf61a('0x17'),_0x63f0f2[_0xf61a('0x14')],_0x4435ae);_0x37c060(_0x28e064[_0xf61a('0x13')](0x1f4,_0x63f0f2[_0xf61a('0x14')]));});});};exports[_0xf61a('0x1f')]=function(_0x1b2144){var _0x2bab58=this;return new Promise(function(_0x918595,_0x16b5ac){return db['Trunk'][_0xf61a('0x20')]({'raw':_0x1b2144['options']?_0x1b2144['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b2144[_0xf61a('0x18')]?_0x1b2144[_0xf61a('0x18')][_0xf61a('0x21')]||null:null,'attributes':_0x1b2144[_0xf61a('0x18')]?_0x1b2144['options']['attributes']||null:null,'include':_0x1b2144[_0xf61a('0x18')]?_0x1b2144[_0xf61a('0x18')][_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x1b2144[_0xf61a('0x18')][_0xf61a('0x1c')],function(_0x126daf){return{'model':db[_0x126daf[_0xf61a('0x1e')]],'as':_0x126daf['as'],'attributes':_0x126daf['attributes'],'include':_0x126daf['include']?_[_0xf61a('0x1d')](_0x126daf[_0xf61a('0x1c')],function(_0x4a9080){return{'model':db[_0x4a9080[_0xf61a('0x1e')]],'as':_0x4a9080['as'],'attributes':_0x4a9080[_0xf61a('0x1a')],'include':_0x4a9080['include']?_['map'](_0x4a9080[_0xf61a('0x1c')],function(_0x592889){return{'model':db[_0x592889[_0xf61a('0x1e')]],'as':_0x592889['as'],'attributes':_0x592889[_0xf61a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f599d){logger[_0xf61a('0x15')](_0xf61a('0x1f'),_0x1b2144);logger[_0xf61a('0xf')](_0xf61a('0x1f'),_0x1b2144,JSON['stringify'](_0x4f599d));_0x918595(_0x4f599d);})['catch'](function(_0x45a18d){logger[_0xf61a('0x13')](_0xf61a('0x1f'),_0x45a18d[_0xf61a('0x14')],_0x1b2144);_0x16b5ac(_0x2bab58[_0xf61a('0x13')](0x1f4,_0x45a18d[_0xf61a('0x14')]));});});}; \ No newline at end of file +var _0x94f2=['jayson/promise','client','http','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','find','info','ShowTrunk','util','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0xabd16f,_0x2e5e88){var _0x45cfd3=function(_0x4c8f9e){while(--_0x4c8f9e){_0xabd16f['push'](_0xabd16f['shift']());}};_0x45cfd3(++_0x2e5e88);}(_0x94f2,0x1c9));var _0x294f=function(_0x38f739,_0x1ddc46){_0x38f739=_0x38f739-0x0;var _0x2bf327=_0x94f2[_0x38f739];return _0x2bf327;};'use strict';var _=require('lodash');var util=require(_0x294f('0x0'));var moment=require('moment');var BPromise=require(_0x294f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x294f('0x2'));var db=require(_0x294f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x294f('0x4'));var jayson=require(_0x294f('0x5'));var client=jayson[_0x294f('0x6')][_0x294f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8c63a0,_0x58a275,_0x4dd8d8){return new BPromise(function(_0x3c92bf,_0x4186dc){return client['request'](_0x8c63a0,_0x4dd8d8)[_0x294f('0x8')](function(_0x3634b3){logger['info']('Trunk,\x20%s,\x20%s',_0x58a275,_0x294f('0x9'));logger[_0x294f('0xa')](_0x294f('0xb'),_0x58a275,_0x294f('0x9'),JSON[_0x294f('0xc')](_0x3634b3));if(_0x3634b3[_0x294f('0xd')]){if(_0x3634b3['error'][_0x294f('0xe')]===0x1f4){logger['error'](_0x294f('0xf'),_0x58a275,_0x3634b3[_0x294f('0xd')]['message']);return _0x4186dc(_0x3634b3['error'][_0x294f('0x10')]);}logger[_0x294f('0xd')](_0x294f('0xf'),_0x58a275,_0x3634b3['error'][_0x294f('0x10')]);return _0x3c92bf(_0x3634b3[_0x294f('0xd')][_0x294f('0x10')]);}else{logger['info'](_0x294f('0xf'),_0x58a275,_0x294f('0x9'));_0x3c92bf(_0x3634b3[_0x294f('0x11')][_0x294f('0x10')]);}})[_0x294f('0x12')](function(_0x2ea1d5){logger['error']('Trunk,\x20%s,\x20%s',_0x58a275,_0x2ea1d5);_0x4186dc(_0x2ea1d5);});});}exports[_0x294f('0x13')]=function(_0x473887){var _0x194338=this;return new Promise(function(_0x12c9fb,_0x3c0868){return db[_0x294f('0x14')][_0x294f('0x15')]({'raw':_0x473887[_0x294f('0x16')]?_0x473887['options'][_0x294f('0x17')]===undefined?!![]:![]:!![],'where':_0x473887[_0x294f('0x16')]?_0x473887['options'][_0x294f('0x18')]||null:null,'attributes':_0x473887[_0x294f('0x16')]?_0x473887[_0x294f('0x16')][_0x294f('0x19')]||null:null,'limit':_0x473887[_0x294f('0x16')]?_0x473887[_0x294f('0x16')][_0x294f('0x1a')]||null:null,'include':_0x473887[_0x294f('0x16')]?_0x473887['options']['include']?_[_0x294f('0x1b')](_0x473887[_0x294f('0x16')][_0x294f('0x1c')],function(_0x31fefe){return{'model':db[_0x31fefe['model']],'as':_0x31fefe['as'],'attributes':_0x31fefe[_0x294f('0x19')],'include':_0x31fefe[_0x294f('0x1c')]?_[_0x294f('0x1b')](_0x31fefe[_0x294f('0x1c')],function(_0x270037){return{'model':db[_0x270037[_0x294f('0x1d')]],'as':_0x270037['as'],'attributes':_0x270037[_0x294f('0x19')],'include':_0x270037[_0x294f('0x1c')]?_[_0x294f('0x1b')](_0x270037[_0x294f('0x1c')],function(_0x364c44){return{'model':db[_0x364c44[_0x294f('0x1d')]],'as':_0x364c44['as'],'attributes':_0x364c44[_0x294f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x294f('0x8')](function(_0x3eef9e){logger['info']('GetTrunk',_0x473887);logger[_0x294f('0xa')](_0x294f('0x13'),_0x473887,JSON[_0x294f('0xc')](_0x3eef9e));_0x12c9fb(_0x3eef9e);})[_0x294f('0x12')](function(_0x47a6ba){logger['error'](_0x294f('0x13'),_0x47a6ba[_0x294f('0x10')],_0x473887);_0x3c0868(_0x194338[_0x294f('0xd')](0x1f4,_0x47a6ba['message']));});});};exports['ShowTrunk']=function(_0x2855d8){var _0x59e7c9=this;return new Promise(function(_0x158cbf,_0x45d314){return db[_0x294f('0x14')][_0x294f('0x1e')]({'raw':_0x2855d8[_0x294f('0x16')]?_0x2855d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2855d8[_0x294f('0x16')]?_0x2855d8[_0x294f('0x16')][_0x294f('0x18')]||null:null,'attributes':_0x2855d8[_0x294f('0x16')]?_0x2855d8[_0x294f('0x16')][_0x294f('0x19')]||null:null,'include':_0x2855d8['options']?_0x2855d8[_0x294f('0x16')][_0x294f('0x1c')]?_[_0x294f('0x1b')](_0x2855d8[_0x294f('0x16')]['include'],function(_0x572f15){return{'model':db[_0x572f15[_0x294f('0x1d')]],'as':_0x572f15['as'],'attributes':_0x572f15[_0x294f('0x19')],'include':_0x572f15[_0x294f('0x1c')]?_[_0x294f('0x1b')](_0x572f15[_0x294f('0x1c')],function(_0x3310f5){return{'model':db[_0x3310f5[_0x294f('0x1d')]],'as':_0x3310f5['as'],'attributes':_0x3310f5[_0x294f('0x19')],'include':_0x3310f5['include']?_[_0x294f('0x1b')](_0x3310f5[_0x294f('0x1c')],function(_0x146087){return{'model':db[_0x146087[_0x294f('0x1d')]],'as':_0x146087['as'],'attributes':_0x146087[_0x294f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x294f('0x8')](function(_0x1b881a){logger[_0x294f('0x1f')]('ShowTrunk',_0x2855d8);logger['debug'](_0x294f('0x20'),_0x2855d8,JSON['stringify'](_0x1b881a));_0x158cbf(_0x1b881a);})[_0x294f('0x12')](function(_0x101ae4){logger['error']('ShowTrunk',_0x101ae4[_0x294f('0x10')],_0x2855d8);_0x45d314(_0x59e7c9[_0x294f('0xd')](0x1f4,_0x101ae4[_0x294f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 075cf8e..953b93d 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1760=['express','../../components/auth/service','./user-setting.controller','/:id','update','exports'];(function(_0x3794e9,_0x5af1fb){var _0x54c61c=function(_0x5c4872){while(--_0x5c4872){_0x3794e9['push'](_0x3794e9['shift']());}};_0x54c61c(++_0x5af1fb);}(_0x1760,0xd2));var _0x0176=function(_0x4086ea,_0x1f652f){_0x4086ea=_0x4086ea-0x0;var _0x5bab0f=_0x1760[_0x4086ea];return _0x5bab0f;};'use strict';var express=require(_0x0176('0x0'));var router=express['Router']();var auth=require(_0x0176('0x1'));var controller=require(_0x0176('0x2'));router['put'](_0x0176('0x3'),auth['isAuthenticated'](),controller[_0x0176('0x4')]);module[_0x0176('0x5')]=router; \ No newline at end of file +var _0xb3f1=['update','exports','Router','../../components/auth/service','put'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xb3f1,0x8e));var _0x1b3f=function(_0x192e03,_0x9d1127){_0x192e03=_0x192e03-0x0;var _0x390436=_0xb3f1[_0x192e03];return _0x390436;};'use strict';var express=require('express');var router=express[_0x1b3f('0x0')]();var auth=require(_0x1b3f('0x1'));var controller=require('./user-setting.controller');router[_0x1b3f('0x2')]('/:id',auth['isAuthenticated'](),controller[_0x1b3f('0x3')]);module[_0x1b3f('0x4')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 7e9f3c7..8ec3009 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6e4=['DATE','INTEGER','UserId','error','warning','info','debug','BOOLEAN'];(function(_0x11a383,_0x4e05ae){var _0x49f2bb=function(_0x52e0ee){while(--_0x52e0ee){_0x11a383['push'](_0x11a383['shift']());}};_0x49f2bb(++_0x4e05ae);}(_0xe6e4,0x123));var _0x4e6e=function(_0x12ce1d,_0x27dad7){_0x12ce1d=_0x12ce1d-0x0;var _0x3e987f=_0xe6e4[_0x12ce1d];return _0x3e987f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x4e6e('0x0'),_0x4e6e('0x1'),_0x4e6e('0x2'),_0x4e6e('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4e6e('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4e6e('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x4e6e('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4e6e('0x6')],'unique':_0x4e6e('0x7')}}; \ No newline at end of file +var _0xad7b=['error','warning','info','debug','exports','ENUM','TEXT','DATE','sequelize'];(function(_0x5132ca,_0x3d9cee){var _0x2ebd1b=function(_0xcc092f){while(--_0xcc092f){_0x5132ca['push'](_0x5132ca['shift']());}};_0x2ebd1b(++_0x3d9cee);}(_0xad7b,0x1af));var _0xbad7=function(_0x2d97d2,_0x5d3f85){_0x2d97d2=_0x2d97d2-0x0;var _0x96f257=_0xad7b[_0x2d97d2];return _0x96f257;};'use strict';var Sequelize=require(_0xbad7('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xbad7('0x1'),_0xbad7('0x2'),_0xbad7('0x3'),_0xbad7('0x4')];module[_0xbad7('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xbad7('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xbad7('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xbad7('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbad7('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index d9208f4..d8f9722 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfda=['status','json','update','then','sendStatus','error','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xbfda,0x1dc));var _0xabfd=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xbfda[_0x5c72ee];return _0x231876;};'use strict';var _=require(_0xabfd('0x0'));var Redis=require(_0xabfd('0x1'));var logger=require(_0xabfd('0x2'))('api');var config=require(_0xabfd('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xabfd('0x4'))(new Redis(config[_0xabfd('0x5')]));require(_0xabfd('0x6'))[_0xabfd('0x7')](socket);config['redis']=_[_0xabfd('0x8')](config['redis'],{'host':_0xabfd('0x9'),'port':0x18eb});function respondWithResult(_0x537d54,_0x27ca51){_0x27ca51=_0x27ca51||0xc8;return function(_0x49368e){if(_0x49368e){return _0x537d54[_0xabfd('0xa')](_0x27ca51)[_0xabfd('0xb')](_0x49368e);}};}function saveUpdates(_0x1b4264){return function(_0x3ddf0e){if(_0x3ddf0e){return _0x3ddf0e[_0xabfd('0xc')](_0x1b4264)[_0xabfd('0xd')](function(_0x557b3f){return _0x557b3f;});}return null;};}function handleEntityNotFound(_0x3d3448){return function(_0xfef859){if(!_0xfef859){_0x3d3448[_0xabfd('0xe')](0x194);}return _0xfef859;};}function handleError(_0x285d2c,_0x3d779a){_0x3d779a=_0x3d779a||0x1f4;return function(_0x2b2469){logger[_0xabfd('0xf')](_0x2b2469[_0xabfd('0x10')]);if(_0x2b2469[_0xabfd('0x11')]){delete _0x2b2469[_0xabfd('0x11')];}_0x285d2c[_0xabfd('0xa')](_0x3d779a)[_0xabfd('0x12')](_0x2b2469);};}exports[_0xabfd('0xc')]=function(_0x53e590,_0x1c0216){if(_0x53e590[_0xabfd('0x13')]['role']!==_0xabfd('0x14'))throw new Error(_0xabfd('0x15'));if(isNaN(Number(_0x53e590[_0xabfd('0x16')]['id'])))throw new Error(_0xabfd('0x17'));return db[_0xabfd('0x18')][_0xabfd('0x19')]({'where':{'id':_0x53e590[_0xabfd('0x16')]['id']}})[_0xabfd('0xd')](handleEntityNotFound(_0x1c0216,null))[_0xabfd('0xd')](saveUpdates(_0x53e590['body'],null))[_0xabfd('0xd')](respondWithResult(_0x1c0216,null))[_0xabfd('0x1a')](handleError(_0x1c0216,null));}; \ No newline at end of file +var _0x5ed2=['catch','lodash','../../config/logger','api','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','update','then','sendStatus','stack','name','status','send','user','role','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','body'];(function(_0x4f3b10,_0x35cc88){var _0x454404=function(_0x28fecf){while(--_0x28fecf){_0x4f3b10['push'](_0x4f3b10['shift']());}};_0x454404(++_0x35cc88);}(_0x5ed2,0x114));var _0x25ed=function(_0x1301aa,_0x4da5c4){_0x1301aa=_0x1301aa-0x0;var _0x5146a1=_0x5ed2[_0x1301aa];return _0x5146a1;};'use strict';var _=require(_0x25ed('0x0'));var Redis=require('ioredis');var logger=require(_0x25ed('0x1'))(_0x25ed('0x2'));var config=require('../../config/environment');var db=require(_0x25ed('0x3'))['db'];var socket=require(_0x25ed('0x4'))(new Redis(config['redis']));require(_0x25ed('0x5'))[_0x25ed('0x6')](socket);config[_0x25ed('0x7')]=_[_0x25ed('0x8')](config['redis'],{'host':_0x25ed('0x9'),'port':0x18eb});function respondWithResult(_0x3c499f,_0x6a8a4c){_0x6a8a4c=_0x6a8a4c||0xc8;return function(_0x8f0fac){if(_0x8f0fac){return _0x3c499f['status'](_0x6a8a4c)['json'](_0x8f0fac);}};}function saveUpdates(_0x513fd3){return function(_0x53b7d8){if(_0x53b7d8){return _0x53b7d8[_0x25ed('0xa')](_0x513fd3)[_0x25ed('0xb')](function(_0x3eef35){return _0x3eef35;});}return null;};}function handleEntityNotFound(_0x465329){return function(_0x5d74d9){if(!_0x5d74d9){_0x465329[_0x25ed('0xc')](0x194);}return _0x5d74d9;};}function handleError(_0x252c54,_0xdaabdf){_0xdaabdf=_0xdaabdf||0x1f4;return function(_0x4fc537){logger['error'](_0x4fc537[_0x25ed('0xd')]);if(_0x4fc537[_0x25ed('0xe')]){delete _0x4fc537[_0x25ed('0xe')];}_0x252c54[_0x25ed('0xf')](_0xdaabdf)[_0x25ed('0x10')](_0x4fc537);};}exports[_0x25ed('0xa')]=function(_0x4aecfd,_0x2830f6){if(_0x4aecfd[_0x25ed('0x11')][_0x25ed('0x12')]!=='admin')throw new Error(_0x25ed('0x13'));if(isNaN(Number(_0x4aecfd['params']['id'])))throw new Error(_0x25ed('0x14'));return db[_0x25ed('0x15')][_0x25ed('0x16')]({'where':{'id':_0x4aecfd['params']['id']}})[_0x25ed('0xb')](handleEntityNotFound(_0x2830f6,null))[_0x25ed('0xb')](saveUpdates(_0x4aecfd[_0x25ed('0x17')],null))[_0x25ed('0xb')](respondWithResult(_0x2830f6,null))[_0x25ed('0x18')](handleError(_0x2830f6,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 7b99098..b548326 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc9a=['events','../../mysqldb','UserSetting','setMaxListeners','update','remove','hasOwnProperty','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc9a,0xc8));var _0xadc9=function(_0x33f5b4,_0x576c15){_0x33f5b4=_0x33f5b4-0x0;var _0xa76b08=_0xdc9a[_0x33f5b4];return _0xa76b08;};'use strict';var EventEmitter=require(_0xadc9('0x0'));var UserSetting=require(_0xadc9('0x1'))['db'][_0xadc9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xadc9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xadc9('0x4'),'afterDestroy':_0xadc9('0x5')};function emitEvent(_0x3de9c5){return function(_0x2967fb,_0x4f8d04,_0x201aef){UserSettingEvents['emit'](_0x3de9c5+':'+_0x2967fb['id'],_0x2967fb);UserSettingEvents['emit'](_0x3de9c5,_0x2967fb);_0x201aef(null);};}for(var e in events){if(events[_0xadc9('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xadc9('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xf4e3=['../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0xf4e3,0xef));var _0x3f4e=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xf4e3[_0x29ae80];return _0x5d6d71;};'use strict';var EventEmitter=require(_0x3f4e('0x0'));var UserSetting=require(_0x3f4e('0x1'))['db'][_0x3f4e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3f4e('0x3')](0x0);var events={'afterCreate':_0x3f4e('0x4'),'afterUpdate':_0x3f4e('0x5'),'afterDestroy':_0x3f4e('0x6')};function emitEvent(_0x55a5e5){return function(_0x5cdb11,_0x4339c4,_0x1a7df0){UserSettingEvents[_0x3f4e('0x7')](_0x55a5e5+':'+_0x5cdb11['id'],_0x5cdb11);UserSettingEvents[_0x3f4e('0x7')](_0x55a5e5,_0x5cdb11);_0x1a7df0(null);};}for(var e in events){if(events[_0x3f4e('0x8')](e)){var event=events[e];UserSetting[_0x3f4e('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index b99be68..dc91fc1 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ed=['define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0x80ed,0x11c));var _0xd80e=function(_0x41e001,_0x114672){_0x41e001=_0x41e001-0x0;var _0x12bb76=_0x80ed[_0x41e001];return _0x12bb76;};'use strict';var attributes=require(_0xd80e('0x0'));module['exports']=function(_0x1bb10e){return _0x1bb10e[_0xd80e('0x1')](_0xd80e('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47617b){if(!_0x47617b[_0xd80e('0x3')])_0x47617b[_0xd80e('0x4')]=null;else if(_0x47617b[_0xd80e('0x4')]===null)_0x47617b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x6e6c=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x38798a,_0x5d3718){var _0x530c0d=function(_0x3d2f17){while(--_0x3d2f17){_0x38798a['push'](_0x38798a['shift']());}};_0x530c0d(++_0x5d3718);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var attributes=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c){return _0x545f2c[_0xc6e6('0x2')](_0xc6e6('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x550e47){if(!_0x550e47[_0xc6e6('0x4')])_0x550e47['clientSideLoggingEnabledSince']=null;else if(_0x550e47[_0xc6e6('0x5')]===null)_0x550e47['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 6874495..d7e7d81 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc85d=['length','save','update','emit','user-setting:update:user-','UserId'];(function(_0x246568,_0x57af04){var _0x19b302=function(_0x4ae034){while(--_0x4ae034){_0x246568['push'](_0x246568['shift']());}};_0x19b302(++_0x57af04);}(_0xc85d,0x19f));var _0xdc85=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0xc85d[_0x3a2a3c];return _0x50ac9a;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xdc85('0x0'),'remove',_0xdc85('0x1')];function createListener(_0x372b96,_0x41e058){return function(_0x486f71){_0x41e058['emit'](_0x372b96,_0x486f71);if(_0x372b96==='user-setting:update'){_0x41e058[_0xdc85('0x2')](_0xdc85('0x3')+_0x486f71[_0xdc85('0x4')],_0x486f71);}};}exports['register']=function(_0x526bfa){for(var _0x4349d6=0x0,_0x260f12=events[_0xdc85('0x5')];_0x4349d6<_0x260f12;_0x4349d6++){var _0x470f3e=events[_0x4349d6];var _0x19560c=createListener('user-setting:'+_0x470f3e,_0x526bfa);UserSettingEvents['on'](_0x470f3e,_0x19560c);}}; \ No newline at end of file +var _0x867f=['user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','remove'];(function(_0x5cf70a,_0x2f75bd){var _0x13df04=function(_0xc68e6){while(--_0xc68e6){_0x5cf70a['push'](_0x5cf70a['shift']());}};_0x13df04(++_0x2f75bd);}(_0x867f,0x15d));var _0xf867=function(_0x4fadaf,_0x179d85){_0x4fadaf=_0x4fadaf-0x0;var _0x4738a8=_0x867f[_0x4fadaf];return _0x4738a8;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xf867('0x0'),'update'];function createListener(_0x52572e,_0x4fb436){return function(_0x40d9d2){_0x4fb436['emit'](_0x52572e,_0x40d9d2);if(_0x52572e===_0xf867('0x1')){_0x4fb436['emit'](_0xf867('0x2')+_0x40d9d2[_0xf867('0x3')],_0x40d9d2);}};}exports[_0xf867('0x4')]=function(_0x1e0cbd){for(var _0x2bf476=0x0,_0x31e6d2=events[_0xf867('0x5')];_0x2bf476<_0x31e6d2;_0x2bf476++){var _0x40dc25=events[_0x2bf476];var _0x1d3e9c=createListener(_0xf867('0x6')+_0x40dc25,_0x1e0cbd);UserSettingEvents['on'](_0x40dc25,_0x1d3e9c);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0e20011..3f9d6f0 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 _0xadb5=['/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','post','/:id/contacts','addContacts','create','/create_many','/:id/queues','addQueues','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/logout','logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','/:id/messengerSoundNotification','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists'];(function(_0xc00ba1,_0x4b9460){var _0x3f991f=function(_0x7725d8){while(--_0x7725d8){_0xc00ba1['push'](_0xc00ba1['shift']());}};_0x3f991f(++_0x4b9460);}(_0xadb5,0xad));var _0x5adb=function(_0x11835a,_0x19e3d2){_0x11835a=_0x11835a-0x0;var _0x372f9b=_0xadb5[_0x11835a];return _0x372f9b;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./user.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getPresence']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),controller['getAvatar']);router[_0x5adb('0x7')]('/:id/open_tabs',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x7')]('/:id/contacts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x7')]('/:id/queues',auth[_0x5adb('0x8')](),controller['getQueues']);router[_0x5adb('0x7')](_0x5adb('0x14'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x7')](_0x5adb('0x16'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x7')]('/:id/recordings',auth[_0x5adb('0x8')](),controller['getRecordings']);router[_0x5adb('0x7')]('/:id/screen_recordings',auth[_0x5adb('0x8')](),controller['getScreenRecordings']);router['get'](_0x5adb('0x18'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x7')](_0x5adb('0x1a'),auth['isAuthenticated'](),controller[_0x5adb('0x1b')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x7')](_0x5adb('0x1d'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x1e')]);router[_0x5adb('0x7')]('/:id/fax/interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1f')]);router[_0x5adb('0x7')](_0x5adb('0x20'),auth[_0x5adb('0x8')](),controller['getWhatsappInteractions']);router[_0x5adb('0x7')](_0x5adb('0x21'),auth['isAuthenticated'](),controller[_0x5adb('0x22')]);router[_0x5adb('0x7')](_0x5adb('0x23'),auth['isAuthenticated'](),controller[_0x5adb('0x24')]);router[_0x5adb('0x7')](_0x5adb('0x25'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x26')]);router[_0x5adb('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x5adb('0x7')](_0x5adb('0x27'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x28')]);router[_0x5adb('0x7')]('/:id/mail_accounts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x29')]);router[_0x5adb('0x7')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x2b')]);router[_0x5adb('0x7')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x2d')]);router['get'](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x2f')]);router[_0x5adb('0x7')]('/:id/whatsapp_accounts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x7')]('/:id/scheduled_calls',auth[_0x5adb('0x8')](),controller[_0x5adb('0x31')]);router['get']('/:id/api_key',auth[_0x5adb('0x8')](),controller['getApiKey']);router[_0x5adb('0x32')](_0x5adb('0x33'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x32')]('/',auth['isAuthenticated'](),controller[_0x5adb('0x35')]);router[_0x5adb('0x32')](_0x5adb('0x36'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x5adb('0x32')](_0x5adb('0x37'),auth['isAuthenticated'](),controller[_0x5adb('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x199d3b,_0x58cc5d,_0x11cb37){_0x11cb37(null,path['join'](config[_0x5adb('0x39')],_0x5adb('0x3a')));},'filename':function(_0x4ccb27,_0x4761e3,_0x5a6a79){_0x5a6a79(null,util[_0x5adb('0x3b')](_0x5adb('0x3c'),Date[_0x5adb('0x3d')](),_0x4761e3['originalname']));}})});router[_0x5adb('0x32')](_0x5adb('0x11'),upload[_0x5adb('0x3e')](_0x5adb('0x3f')),controller[_0x5adb('0x40')]);router['post']('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x5adb('0x32')](_0x5adb('0x41'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x42')]);router[_0x5adb('0x32')](_0x5adb('0x43'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x44')]);router['post']('/:id/unpause',auth[_0x5adb('0x8')](),controller['unpause']);router[_0x5adb('0x32')](_0x5adb('0x21'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x45')]);router[_0x5adb('0x32')]('/:id/chat_interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x46')]);router['post'](_0x5adb('0x47'),auth[_0x5adb('0x8')](),controller['addMailInteractions']);router[_0x5adb('0x32')](_0x5adb('0x48'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x32')](_0x5adb('0x4a'),auth[_0x5adb('0x8')](),controller['addSmsInteractions']);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x32')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4d')]);router[_0x5adb('0x32')](_0x5adb('0x27'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x4e')]);router['post'](_0x5adb('0x4f'),auth[_0x5adb('0x8')](),controller['addMailAccounts']);router[_0x5adb('0x32')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x32')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x51')]);router['post'](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x5adb('0x52'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x53')]);router['post'](_0x5adb('0x54'),auth['isAuthenticated'](),controller[_0x5adb('0x55')]);router[_0x5adb('0x56')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x57')]);router['put'](_0x5adb('0x58'),auth[_0x5adb('0x8')](),controller['changePassword']);router[_0x5adb('0x59')](_0x5adb('0x37'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x5a')]);router[_0x5adb('0x59')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x5b')]);router[_0x5adb('0x59')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x5c')]);router[_0x5adb('0x59')](_0x5adb('0x5d'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x59')](_0x5adb('0x47'),auth[_0x5adb('0x8')](),controller['removeMailInteractions']);router[_0x5adb('0x59')](_0x5adb('0x48'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x5f')]);router[_0x5adb('0x59')]('/:id/sms_interactions',auth[_0x5adb('0x8')](),controller['removeSmsInteractions']);router[_0x5adb('0x59')]('/:id/openchannel_interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x60')]);router[_0x5adb('0x59')](_0x5adb('0x61'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router[_0x5adb('0x59')](_0x5adb('0x27'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x5adb('0x4f'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x63')]);router[_0x5adb('0x59')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x64')]);router[_0x5adb('0x59')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x65')]);router[_0x5adb('0x59')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x5adb('0x59')](_0x5adb('0x52'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x66')]);router['delete'](_0x5adb('0x54'),auth[_0x5adb('0x8')](),controller['removeApiKey']);router[_0x5adb('0x32')](_0x5adb('0x67'),auth[_0x5adb('0x8')](),controller['messengerSoundNotification']);module[_0x5adb('0x68')]=router; \ No newline at end of file +var _0x50e5=['getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/api_key','getApiKey','post','create','server/files/images/','%s-%s','now','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','/:id/mail_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions'];(function(_0x13d37b,_0xca86c){var _0x1d7629=function(_0x51e77a){while(--_0x51e77a){_0x13d37b['push'](_0x13d37b['shift']());}};_0x1d7629(++_0xca86c);}(_0x50e5,0xb7));var _0x550e=function(_0x281704,_0x145c5e){_0x281704=_0x281704-0x0;var _0x920356=_0x50e5[_0x281704];return _0x920356;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var fs_extra=require(_0x550e('0x5'));var auth=require(_0x550e('0x6'));var interaction=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var controller=require(_0x550e('0x9'));router[_0x550e('0xa')]('/',auth[_0x550e('0xb')](),controller[_0x550e('0xc')]);router[_0x550e('0xa')]('/describe',auth[_0x550e('0xb')](),controller[_0x550e('0xd')]);router['get'](_0x550e('0xe'),auth[_0x550e('0xb')](),controller[_0x550e('0xf')]);router['get'](_0x550e('0x10'),auth['isAuthenticated'](),controller['getPresence']);router[_0x550e('0xa')](_0x550e('0x11'),auth['isAuthenticated'](),controller[_0x550e('0x12')]);router[_0x550e('0xa')](_0x550e('0x13'),controller[_0x550e('0x14')]);router['get'](_0x550e('0x15'),auth['isAuthenticated'](),controller[_0x550e('0x16')]);router['get'](_0x550e('0x17'),auth[_0x550e('0xb')](),controller[_0x550e('0x18')]);router[_0x550e('0xa')](_0x550e('0x19'),auth['isAuthenticated'](),controller[_0x550e('0x1a')]);router['get'](_0x550e('0x1b'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x550e('0xa')](_0x550e('0x1c'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x550e('0x1d'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x550e('0xa')](_0x550e('0x1e'),auth[_0x550e('0xb')](),controller[_0x550e('0x1f')]);router[_0x550e('0xa')](_0x550e('0x20'),auth[_0x550e('0xb')](),controller[_0x550e('0x21')]);router[_0x550e('0xa')]('/:id/openchannel/interactions',auth[_0x550e('0xb')](),controller[_0x550e('0x22')]);router['get']('/:id/mail/interactions',auth[_0x550e('0xb')](),controller[_0x550e('0x23')]);router['get'](_0x550e('0x24'),auth[_0x550e('0xb')](),controller[_0x550e('0x25')]);router[_0x550e('0xa')](_0x550e('0x26'),auth[_0x550e('0xb')](),controller['getFaxInteractions']);router[_0x550e('0xa')](_0x550e('0x27'),auth[_0x550e('0xb')](),controller[_0x550e('0x28')]);router[_0x550e('0xa')](_0x550e('0x29'),auth[_0x550e('0xb')](),controller[_0x550e('0x2a')]);router[_0x550e('0xa')](_0x550e('0x2b'),auth[_0x550e('0xb')](),controller[_0x550e('0x2c')]);router['get'](_0x550e('0x2d'),auth[_0x550e('0xb')](),controller['getAgents']);router[_0x550e('0xa')](_0x550e('0x2e'),auth[_0x550e('0xb')](),controller[_0x550e('0x2f')]);router[_0x550e('0xa')](_0x550e('0x30'),auth[_0x550e('0xb')](),controller[_0x550e('0x31')]);router[_0x550e('0xa')](_0x550e('0x32'),auth[_0x550e('0xb')](),controller[_0x550e('0x33')]);router[_0x550e('0xa')](_0x550e('0x34'),auth['isAuthenticated'](),controller[_0x550e('0x35')]);router[_0x550e('0xa')]('/:id/sms_accounts',auth[_0x550e('0xb')](),controller[_0x550e('0x36')]);router['get'](_0x550e('0x37'),auth[_0x550e('0xb')](),controller[_0x550e('0x38')]);router[_0x550e('0xa')](_0x550e('0x39'),auth[_0x550e('0xb')](),controller[_0x550e('0x3a')]);router[_0x550e('0xa')]('/:id/scheduled_calls',auth[_0x550e('0xb')](),controller['getScheduledCalls']);router[_0x550e('0xa')](_0x550e('0x3b'),auth['isAuthenticated'](),controller[_0x550e('0x3c')]);router[_0x550e('0x3d')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x550e('0xb')](),controller[_0x550e('0x3e')]);router[_0x550e('0x3d')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0x550e('0x3d')](_0x550e('0x19'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2fcbd4,_0x1a3419,_0x252e62){_0x252e62(null,path['join'](config['root'],_0x550e('0x3f')));},'filename':function(_0x380f85,_0x7f8c15,_0xb54bf8){_0xb54bf8(null,util['format'](_0x550e('0x40'),Date[_0x550e('0x41')](),_0x7f8c15['originalname']));}})});router['post'](_0x550e('0x13'),upload[_0x550e('0x42')](_0x550e('0x43')),controller[_0x550e('0x44')]);router['post'](_0x550e('0x45'),auth[_0x550e('0xb')](),controller[_0x550e('0x46')]);router[_0x550e('0x3d')]('/:id/logout',auth[_0x550e('0xb')](),controller[_0x550e('0x47')]);router[_0x550e('0x3d')](_0x550e('0x48'),auth[_0x550e('0xb')](),controller[_0x550e('0x49')]);router['post'](_0x550e('0x4a'),auth[_0x550e('0xb')](),controller[_0x550e('0x4b')]);router[_0x550e('0x3d')](_0x550e('0x29'),auth['isAuthenticated'](),controller[_0x550e('0x4c')]);router[_0x550e('0x3d')]('/:id/chat_interactions',auth[_0x550e('0xb')](),controller[_0x550e('0x4d')]);router[_0x550e('0x3d')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x550e('0x4e')]);router[_0x550e('0x3d')]('/:id/fax_interactions',auth[_0x550e('0xb')](),controller[_0x550e('0x4f')]);router['post'](_0x550e('0x50'),auth[_0x550e('0xb')](),controller[_0x550e('0x51')]);router[_0x550e('0x3d')](_0x550e('0x52'),auth[_0x550e('0xb')](),controller['addOpenchannelInteractions']);router[_0x550e('0x3d')]('/:id/whatsapp_interactions',auth[_0x550e('0xb')](),controller[_0x550e('0x53')]);router['post'](_0x550e('0x30'),auth[_0x550e('0xb')](),controller[_0x550e('0x54')]);router[_0x550e('0x3d')](_0x550e('0x32'),auth[_0x550e('0xb')](),controller['addMailAccounts']);router[_0x550e('0x3d')](_0x550e('0x34'),auth[_0x550e('0xb')](),controller[_0x550e('0x55')]);router[_0x550e('0x3d')](_0x550e('0x56'),auth[_0x550e('0xb')](),controller[_0x550e('0x57')]);router[_0x550e('0x3d')](_0x550e('0x37'),auth[_0x550e('0xb')](),controller[_0x550e('0x58')]);router[_0x550e('0x3d')](_0x550e('0x39'),auth[_0x550e('0xb')](),controller[_0x550e('0x59')]);router[_0x550e('0x3d')](_0x550e('0x3b'),auth[_0x550e('0xb')](),controller[_0x550e('0x5a')]);router[_0x550e('0x5b')](_0x550e('0x11'),auth['isAuthenticated'](),controller[_0x550e('0x5c')]);router[_0x550e('0x5b')](_0x550e('0x5d'),auth[_0x550e('0xb')](),controller[_0x550e('0x5e')]);router[_0x550e('0x5f')](_0x550e('0x19'),auth['isAuthenticated'](),controller[_0x550e('0x60')]);router[_0x550e('0x5f')](_0x550e('0x29'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x550e('0x11'),auth[_0x550e('0xb')](),controller[_0x550e('0x61')]);router[_0x550e('0x5f')](_0x550e('0x62'),auth[_0x550e('0xb')](),controller['removeChatInteractions']);router[_0x550e('0x5f')](_0x550e('0x63'),auth[_0x550e('0xb')](),controller['removeMailInteractions']);router[_0x550e('0x5f')]('/:id/fax_interactions',auth[_0x550e('0xb')](),controller['removeFaxInteractions']);router[_0x550e('0x5f')](_0x550e('0x50'),auth['isAuthenticated'](),controller[_0x550e('0x64')]);router['delete'](_0x550e('0x52'),auth['isAuthenticated'](),controller[_0x550e('0x65')]);router[_0x550e('0x5f')]('/:id/whatsapp_interactions',auth[_0x550e('0xb')](),controller['removeWhatsappInteractions']);router[_0x550e('0x5f')](_0x550e('0x30'),auth[_0x550e('0xb')](),controller[_0x550e('0x66')]);router['delete']('/:id/mail_accounts',auth[_0x550e('0xb')](),controller['removeMailAccounts']);router['delete'](_0x550e('0x34'),auth[_0x550e('0xb')](),controller[_0x550e('0x67')]);router[_0x550e('0x5f')](_0x550e('0x56'),auth[_0x550e('0xb')](),controller['removeSmsAccounts']);router[_0x550e('0x5f')](_0x550e('0x37'),auth[_0x550e('0xb')](),controller[_0x550e('0x68')]);router[_0x550e('0x5f')](_0x550e('0x39'),auth[_0x550e('0xb')](),controller[_0x550e('0x69')]);router[_0x550e('0x5f')]('/:id/api_key',auth[_0x550e('0xb')](),controller[_0x550e('0x6a')]);router[_0x550e('0x3d')](_0x550e('0x6b'),auth[_0x550e('0xb')](),controller[_0x550e('0x6c')]);module[_0x550e('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5ca7015..de8e918 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 _0xad7e=['update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','accountcode','format','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','transport','join','getDataValue','split','info','shortinfo','inband','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','actpass'];(function(_0x5514e0,_0x18edcc){var _0x3aa3d1=function(_0x1c6b3c){while(--_0x1c6b3c){_0x5514e0['push'](_0x5514e0['shift']());}};_0x3aa3d1(++_0x18edcc);}(_0xad7e,0x195));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xead7('0x0'));var moment=require(_0xead7('0x1'));var util=require(_0xead7('0x2'));var _=require(_0xead7('0x3'));module[_0xead7('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xead7('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x52d4ce){this[_0xead7('0x6')]('name',_0x52d4ce);this[_0xead7('0x6')]('defaultuser',_0x52d4ce);},'comment':_0xead7('0x7')},'fullname':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'set':function(_0x3b0cf4){this[_0xead7('0x6')]('fullname',_0x3b0cf4);this[_0xead7('0x6')](_0xead7('0x9'),util['format'](_0xead7('0xa'),_0x3b0cf4,this['getDataValue'](_0xead7('0xb'))));}},'alias':{'type':Sequelize[_0xead7('0x8')]},'email':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'unique':_0xead7('0xc'),'validate':{'isEmail':!![]},'set':function(_0x33c594){if(_0x33c594){this['setDataValue'](_0xead7('0xc'),_0x33c594[_0xead7('0xd')]());}}},'role':{'type':Sequelize[_0xead7('0xe')](_0xead7('0xf'),_0xead7('0x10'),'agent',_0xead7('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':![],'unique':_0xead7('0xb'),'set':function(_0x4078bf){this[_0xead7('0x6')](_0xead7('0xb'),_0x4078bf);this[_0xead7('0x6')](_0xead7('0x13'),_0x4078bf);this['setDataValue'](_0xead7('0x9'),util[_0xead7('0x14')](_0xead7('0xa'),this['getDataValue'](_0xead7('0x15')),_0x4078bf));}},'salt':{'type':Sequelize[_0xead7('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xead7('0x8')]},'address':{'type':Sequelize[_0xead7('0x8')]},'zipcode':{'type':Sequelize[_0xead7('0x8')]},'userpic':{'type':Sequelize[_0xead7('0x8')]},'city':{'type':Sequelize[_0xead7('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xead7('0x16')]},'voicePause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xead7('0x8')],'defaultValue':_0xead7('0x18')},'lastPauseAt':{'type':Sequelize[_0xead7('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xead7('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xead7('0x19')},'ipaddr':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x1a'),'user',_0xead7('0x1b')),'allowNull':!![],'defaultValue':_0xead7('0x1a')},'context':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x1c')},'callingpres':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x1d'),_0xead7('0x1e'),_0xead7('0x1f'),_0xead7('0x20'),_0xead7('0x21'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xead7('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x23'),'set':function(_0x18c752){this[_0xead7('0x6')](_0xead7('0x24'),_0x18c752?_0x18c752[_0xead7('0x25')](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x24'))?this[_0xead7('0x26')]('transport')[_0xead7('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xead7('0xe')]('rfc2833',_0xead7('0x28'),_0xead7('0x29'),_0xead7('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0xead7('0x2b')},'directmedia':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x2d'),_0xead7('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x2f'),'set':function(_0x2ddbf7){this[_0xead7('0x6')](_0xead7('0x30'),_0x2ddbf7?_0x2ddbf7['join'](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x30'))?this[_0xead7('0x26')](_0xead7('0x30'))[_0xead7('0x27')](','):null;},'comment':_0xead7('0x31')},'callgroup':{'type':Sequelize[_0xead7('0x8')]},'namedcallgroup':{'type':Sequelize[_0xead7('0x8')]},'pickupgroup':{'type':Sequelize[_0xead7('0x8')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xead7('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'defaultValue':_0xead7('0x32')},'allow':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'defaultValue':_0xead7('0x33'),'set':function(_0x1fa1fe){this[_0xead7('0x6')](_0xead7('0x34'),_0x1fa1fe?_0x1fa1fe['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xead7('0x26')]('allow')?this[_0xead7('0x26')](_0xead7('0x34'))[_0xead7('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'set':function(_0x468c00){this[_0xead7('0x6')]('insecure',_0x468c00?_0x468c00[_0xead7('0x25')](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x35'))?this[_0xead7('0x26')](_0xead7('0x35'))[_0xead7('0x27')](','):null;},'comment':_0xead7('0x36')},'trustrpid':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x38')},'amaflags':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xead7('0x2c')},'busylevel':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xead7('0xe')]('yes','no',_0xead7('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xead7('0xe')]('accept',_0xead7('0x3a'),_0xead7('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x3c'),_0xead7('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xead7('0x2c')},'keepalive':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xead7('0xe')]('yes','no','fingerprint',_0xead7('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x3f'),'passive',_0xead7('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x2d'),_0xead7('0x2e'),_0xead7('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xead7('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xead7('0x16')]},'passwordResetAt':{'type':Sequelize[_0xead7('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xead7('0x42')]},'showWebBar':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0,'set':function(_0x5ea564){this[_0xead7('0x6')](_0xead7('0x43'),_0x5ea564);var _0x500917=this[_0xead7('0x44')]({'plain':!![]});switch(_0x5ea564){case 0x0:case 0x1:var _0x110037=_0x500917[_0xead7('0x24')]?_[_0xead7('0x45')](_0x500917[_0xead7('0x24')])?_0x500917[_0xead7('0x24')][_0xead7('0x25')]():_0x500917[_0xead7('0x24')]:_0xead7('0x23');if(_0x110037===_0xead7('0x46')){_0x110037=_0xead7('0x23');}this['setDataValue'](_0xead7('0x24'),_0x110037);this[_0xead7('0x6')](_0xead7('0x47'),'no');this[_0xead7('0x6')](_0xead7('0x48'),null);this[_0xead7('0x6')](_0xead7('0x49'),null);this[_0xead7('0x6')](_0xead7('0x4a'),null);this[_0xead7('0x6')]('dtlsenable',null);this[_0xead7('0x6')](_0xead7('0x4b'),null);this['setDataValue'](_0xead7('0x4c'),null);this[_0xead7('0x6')](_0xead7('0x4d'),null);this[_0xead7('0x6')](_0xead7('0x4e'),null);this[_0xead7('0x6')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0xead7('0x24'),'wss');this[_0xead7('0x6')](_0xead7('0x47'),_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x48'),_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x49'),'yes');this[_0xead7('0x6')]('icesupport',_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x4f'),'yes');this[_0xead7('0x6')]('dtlsverify','no');this['setDataValue'](_0xead7('0x4c'),_0xead7('0x40'));this[_0xead7('0x6')](_0xead7('0x4d'),_0x500917[_0xead7('0x4d')]||_0xead7('0x50'));this[_0xead7('0x6')](_0xead7('0x4e'),_0x500917[_0xead7('0x4e')]||_0xead7('0x51'));this[_0xead7('0x6')](_0xead7('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xead7('0x42')],'set':function(_0x3fdd5f){this[_0xead7('0x6')](_0xead7('0x53'),_0x3fdd5f?_0x3fdd5f[_0xead7('0x25')](','):[]);},'get':function(){return this[_0xead7('0x26')]('permissions')?_[_0xead7('0x54')](this[_0xead7('0x26')]('permissions')['split'](','),function(_0xb37da1){return parseInt(_0xb37da1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xead7('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xead7('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xead7('0x55')],'get':function(){return this['getDataValue'](_0xead7('0x56'))?this[_0xead7('0x26')](_0xead7('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xead7('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![],'set':function(_0x2e794b){if(typeof _0x2e794b===_0xead7('0x57')){var _0xb548b6=_0x2e794b==='1'?!![]:_0x2e794b==='0'?![]:_0x2e794b==='true'?!![]:_0x2e794b===_0xead7('0x58')?![]:![];this[_0xead7('0x6')]('screenrecording',_0xb548b6);}else{this[_0xead7('0x6')](_0xead7('0x59'),_0x2e794b);}}},'blocked':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![],'set':function(_0x43f2e5){this[_0xead7('0x6')](_0xead7('0x5a'),_0x43f2e5);if(_0x43f2e5===!![]){this[_0xead7('0x6')](_0xead7('0x5b'),moment());this[_0xead7('0x6')](_0xead7('0x5c'),0x0);}else{this[_0xead7('0x6')](_0xead7('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xead7('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xead7('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x798a=['originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','encryption','icesupport','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','\x22%s\x22\x20<%s>','email','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse'];(function(_0x552e90,_0x40f013){var _0x248456=function(_0x405df3){while(--_0x405df3){_0x552e90['push'](_0x552e90['shift']());}};_0x248456(++_0x40f013);}(_0x798a,0x1df));var _0xa798=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x798a[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xa798('0x0'));var _=require(_0xa798('0x1'));module[_0xa798('0x2')]={'name':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'unique':_0xa798('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x754298){this[_0xa798('0x5')](_0xa798('0x4'),_0x754298);this[_0xa798('0x5')](_0xa798('0x6'),_0x754298);},'comment':_0xa798('0x7')},'fullname':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'set':function(_0x145d79){this['setDataValue'](_0xa798('0x8'),_0x145d79);this[_0xa798('0x5')]('callerid',util['format'](_0xa798('0x9'),_0x145d79,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xa798('0x3')]},'email':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x496e42){if(_0x496e42){this[_0xa798('0x5')](_0xa798('0xa'),_0x496e42['toLowerCase']());}}},'role':{'type':Sequelize[_0xa798('0xb')](_0xa798('0xc'),_0xa798('0xd'),_0xa798('0xe'),_0xa798('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa798('0x3')],'defaultValue':_0xa798('0x10')},'internal':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':![],'unique':_0xa798('0x12'),'set':function(_0x2133ab){this['setDataValue']('internal',_0x2133ab);this[_0xa798('0x5')](_0xa798('0x13'),_0x2133ab);this[_0xa798('0x5')](_0xa798('0x14'),util['format']('\x22%s\x22\x20<%s>',this[_0xa798('0x15')]('fullname'),_0x2133ab));}},'salt':{'type':Sequelize[_0xa798('0x3')]},'phone':{'type':Sequelize[_0xa798('0x3')]},'mobile':{'type':Sequelize[_0xa798('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xa798('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa798('0x3')]},'country':{'type':Sequelize[_0xa798('0x3')]},'online':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa798('0x17')]},'voicePause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa798('0x3')],'defaultValue':_0xa798('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa798('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0xa798('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa798('0x1a')},'callingpres':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x1b'),_0xa798('0x1c'),'ALLOWED_FAILED_SCREEN',_0xa798('0x1d'),_0xa798('0x1e'),_0xa798('0x1f'),'PROHIB_FAILED_SCREEN',_0xa798('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![],'defaultValue':_0xa798('0x21'),'set':function(_0x28421b){this[_0xa798('0x5')](_0xa798('0x22'),_0x28421b?_0x28421b[_0xa798('0x23')](','):null);},'get':function(){return this[_0xa798('0x15')](_0xa798('0x22'))?this[_0xa798('0x15')]('transport')[_0xa798('0x24')](','):null;},'comment':_0xa798('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa798('0x26'),'info','shortinfo','inband',_0xa798('0x27')),'allowNull':!![],'defaultValue':_0xa798('0x26')},'directmedia':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no',_0xa798('0x29'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa798('0x2a'),'set':function(_0x257bba){this[_0xa798('0x5')](_0xa798('0x2b'),_0x257bba?_0x257bba['join'](','):null);},'get':function(){return this[_0xa798('0x15')](_0xa798('0x2b'))?this['getDataValue'](_0xa798('0x2b'))[_0xa798('0x24')](','):null;},'comment':_0xa798('0x2c')},'callgroup':{'type':Sequelize[_0xa798('0x3')]},'namedcallgroup':{'type':Sequelize[_0xa798('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa798('0x3')]},'language':{'type':Sequelize[_0xa798('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa798('0x3')],'allowNull':![],'defaultValue':_0xa798('0x2d'),'set':function(_0x3c00e3){this['setDataValue'](_0xa798('0x2e'),_0x3c00e3?_0x3c00e3['join'](';'):_0xa798('0x2d'));},'get':function(){return this['getDataValue'](_0xa798('0x2e'))?this[_0xa798('0x15')]('allow')[_0xa798('0x24')](';'):null;},'comment':_0xa798('0x2f')},'autoframing':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![],'set':function(_0x2866ab){this[_0xa798('0x5')](_0xa798('0x30'),_0x2866ab?_0x2866ab[_0xa798('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xa798('0x30'))?this['getDataValue'](_0xa798('0x30'))[_0xa798('0x24')](','):null;},'comment':_0xa798('0x31')},'trustrpid':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no',_0xa798('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![],'defaultValue':_0xa798('0x33')},'amaflags':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':_0xa798('0x28')},'busylevel':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa798('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xa798('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x35'),_0xa798('0x36'),_0xa798('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa798('0xb')]('uac','uas'),'allowNull':!![],'defaultValue':_0xa798('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':_0xa798('0x28')},'keepalive':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa798('0xb')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa798('0xb')]('yes','no',_0xa798('0x39'),_0xa798('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa798('0x3b'),_0xa798('0x3c'),_0xa798('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa798('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa798('0xb')](_0xa798('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no','nonat','update',_0xa798('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa798('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xa798('0x17')]},'passwordResetAt':{'type':Sequelize[_0xa798('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa798('0x3f')]},'showWebBar':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0,'set':function(_0x308cf9){this['setDataValue'](_0xa798('0x40'),_0x308cf9);var _0x3dbf9d=this[_0xa798('0x41')]({'plain':!![]});switch(_0x308cf9){case 0x0:case 0x1:var _0x4bea9f=_0x3dbf9d[_0xa798('0x22')]?_[_0xa798('0x42')](_0x3dbf9d['transport'])?_0x3dbf9d[_0xa798('0x22')][_0xa798('0x23')]():_0x3dbf9d[_0xa798('0x22')]:_0xa798('0x21');if(_0x4bea9f===_0xa798('0x43')){_0x4bea9f=_0xa798('0x21');}this[_0xa798('0x5')](_0xa798('0x22'),_0x4bea9f);this['setDataValue']('encryption','no');this['setDataValue'](_0xa798('0x44'),null);this[_0xa798('0x5')](_0xa798('0x45'),null);this[_0xa798('0x5')]('icesupport',null);this[_0xa798('0x5')](_0xa798('0x46'),null);this[_0xa798('0x5')](_0xa798('0x47'),null);this[_0xa798('0x5')](_0xa798('0x48'),null);this[_0xa798('0x5')](_0xa798('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xa798('0x5')](_0xa798('0x22'),'wss');this[_0xa798('0x5')](_0xa798('0x4a'),_0xa798('0x28'));this[_0xa798('0x5')]('avpf',_0xa798('0x28'));this[_0xa798('0x5')]('force_avp',_0xa798('0x28'));this['setDataValue'](_0xa798('0x4b'),'yes');this[_0xa798('0x5')](_0xa798('0x46'),_0xa798('0x28'));this[_0xa798('0x5')](_0xa798('0x47'),'no');this[_0xa798('0x5')](_0xa798('0x48'),_0xa798('0x3d'));this['setDataValue'](_0xa798('0x49'),_0x3dbf9d[_0xa798('0x49')]||_0xa798('0x4c'));this[_0xa798('0x5')]('dtlsprivatekey',_0x3dbf9d[_0xa798('0x4d')]||_0xa798('0x4e'));this[_0xa798('0x5')](_0xa798('0x4f'),_0xa798('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xa798('0x3f')],'set':function(_0x4ecb0e){this[_0xa798('0x5')]('permissions',_0x4ecb0e?_0x4ecb0e[_0xa798('0x23')](','):[]);},'get':function(){return this[_0xa798('0x15')](_0xa798('0x50'))?_[_0xa798('0x51')](this[_0xa798('0x15')](_0xa798('0x50'))[_0xa798('0x24')](','),function(_0x19ee97){return parseInt(_0x19ee97,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa798('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa798('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa798('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa798('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xa798('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa798('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa798('0x52')],'get':function(){return this[_0xa798('0x15')](_0xa798('0x53'))?this[_0xa798('0x15')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa798('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa798('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x499353){if(typeof _0x499353===_0xa798('0x54')){var _0x2f1f43=_0x499353==='1'?!![]:_0x499353==='0'?![]:_0x499353==='true'?!![]:_0x499353===_0xa798('0x55')?![]:![];this[_0xa798('0x5')](_0xa798('0x56'),_0x2f1f43);}else{this[_0xa798('0x5')](_0xa798('0x56'),_0x499353);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xad8c8){this['setDataValue']('blocked',_0xad8c8);if(_0xad8c8===!![]){this[_0xa798('0x5')]('blockedAt',moment());this[_0xa798('0x5')](_0xa798('0x57'),0x0);}else{this[_0xa798('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa798('0x11')](0x5)[_0xa798('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa798('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa798('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa798('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c6bfffa..d742475 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 _0xebae=['intrf','user:forcelogout','headers','connection','remoteAddress','socket','destroy','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','concat','isMiddleware','logout','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','getTeams','Team','addTeams','getAssociatedQueues','addAgent','getDataValue','Voice','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','Contact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','idle','unknown','ringing','teams','flatten','toString','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','toUpperCase','select','field','user_has_','_interactions','ui.UserId\x20=\x20?','enabled','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','role','agent','emit','userNotification:recalc:','then','get','admin','Users','user','Telephones','telephone','map','value','includes','find','error','name','send','User','fieldName','type','key','password','previousPasswords','resetPasswordExpires','md5secret','index','count','query','includeAll','include','userSetting','true','UserSetting','attributes','openTabs','rows','length','push','chat','dataValues','sms','fax','openchannel','params','options','whatsapp','mail','all','catch','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','103','113','104','106','107','108','100','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','findAll','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','Queues','penalty','spread','toLowerCase','QueueId','Queue:save','VoiceQueue','voice','online','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','isArray','Queue:remove','file','filename','join','root','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','format','User\x20with\x20id\x20%s\x20not\x20found','getOptions','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','keys','model','intersection','fields','sort','where','filters','pick','filter','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','rawAttributes','order','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n'];(function(_0x383ac2,_0x5e38c3){var _0x3c0089=function(_0x1dd1fb){while(--_0x1dd1fb){_0x383ac2['push'](_0x383ac2['shift']());}};_0x3c0089(++_0x5e38c3);}(_0xebae,0x9c));var _0xeeba=function(_0x5f50eb,_0x3e7d18){_0x5f50eb=_0x5f50eb-0x0;var _0xb912b6=_0xebae[_0x5f50eb];return _0xb912b6;};'use strict';var moment=require('moment');var util=require('util');var path=require(_0xeeba('0x0'));var fs=require('fs');var _=require(_0xeeba('0x1'));var squel=require(_0xeeba('0x2'));var Redis=require(_0xeeba('0x3'));var authService=require(_0xeeba('0x4'));var contacts=require(_0xeeba('0x5'));var qs=require(_0xeeba('0x6'));var rta=require('../../components/realtime/agents');var logger=require(_0xeeba('0x7'))(_0xeeba('0x8'));var utils=require(_0xeeba('0x9'));var config=require(_0xeeba('0xa'));var licenseUtil=require(_0xeeba('0xb'));var APIBadRequestError=require(_0xeeba('0xc'))[_0xeeba('0xd')];var APINotFoundError=require(_0xeeba('0xc'))[_0xeeba('0xe')];var APIHandleError=require('../../errors/api')[_0xeeba('0xf')];var db=require(_0xeeba('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xeeba('0x11')]));require(_0xeeba('0x12'))[_0xeeba('0x13')](socket);config[_0xeeba('0x11')]=_[_0xeeba('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x2d7812,_0x2058ea){_0x2058ea=_0x2058ea||0xcc;return function(_0x38c16c){if(_0x38c16c){return _0x2d7812[_0xeeba('0x15')](_0x2058ea);}return _0x2d7812[_0xeeba('0x16')](_0x2058ea)[_0xeeba('0x17')]();};}function respondWithResult(_0x52bcf7,_0x4c970b){_0x4c970b=_0x4c970b||0xc8;return function(_0x22200f){if(_0x22200f){return _0x52bcf7[_0xeeba('0x16')](_0x4c970b)[_0xeeba('0x18')](_0x22200f);}};}function respondWithFilteredResult(_0x520385,_0x352180){return function(_0x29033e){if(_0x29033e){var _0xbeac39=typeof _0x352180[_0xeeba('0x19')]===_0xeeba('0x1a')&&typeof _0x352180['limit']===_0xeeba('0x1a');var _0x40ca7f=_0x29033e['count'];var _0x505b0a=_0xbeac39?0x0:_0x352180['offset'];var _0x40e8f9=_0xbeac39?_0x29033e['count']:_0x352180[_0xeeba('0x19')]+_0x352180[_0xeeba('0x1b')];var _0xa4f181;if(_0x40e8f9>=_0x40ca7f){_0x40e8f9=_0x40ca7f;_0xa4f181=0xc8;}else{_0xa4f181=0xce;}_0x520385[_0xeeba('0x16')](_0xa4f181);return _0x520385['set'](_0xeeba('0x1c'),_0x505b0a+'-'+_0x40e8f9+'/'+_0x40ca7f)[_0xeeba('0x18')](_0x29033e);}return null;};}function saveUpdates(_0x1d549a){return function(_0x3716fc){if(_0x3716fc){return _0x3716fc[_0xeeba('0x1d')](_0x1d549a)['then'](function(_0xc9556a){if(_0xc9556a[_0xeeba('0x1e')]===_0xeeba('0x1f')){socket[_0xeeba('0x20')](_0xeeba('0x21')+_0xc9556a['id'],_0xc9556a);}return _0xc9556a;});}return null;};}function removeEntity(_0x4a6762){return function(_0x5cf27b){if(_0x5cf27b){return _0x5cf27b['destroy']()[_0xeeba('0x22')](function(){var _0x4f5832=_0x5cf27b[_0xeeba('0x23')]({'plain':!![]});if(_0x4f5832[_0xeeba('0x1e')]===_0xeeba('0x24'))return;var _0xe363a4=[{'name':_0xeeba('0x25'),'value':_0xeeba('0x26'),'ignore':!![]},{'name':'Agents','value':_0xeeba('0x1f'),'ignore':![]},{'name':_0xeeba('0x27'),'value':_0xeeba('0x28'),'ignore':![]}];var _0x3b8ed6=_(_0xe363a4)['filter']('ignore')[_0xeeba('0x29')](_0xeeba('0x2a'))['value']();if(_[_0xeeba('0x2b')](_0x3b8ed6,_0x4f5832[_0xeeba('0x1e')])){return;}var _0x3f1978=_[_0xeeba('0x2c')](_0xe363a4,['value',_0x4f5832['role']])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x3f1978,'resourceId':_0x4f5832['id']}})['then'](function(){return _0x5cf27b;});})[_0xeeba('0x22')](function(){_0x4a6762[_0xeeba('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5faa){return function(_0x200f6e){if(!_0x200f6e){_0x2a5faa[_0xeeba('0x15')](0x194);}return _0x200f6e;};}function handleError(_0x44eb14,_0xffd638){_0xffd638=_0xffd638||0x1f4;return function(_0x23c05c){logger[_0xeeba('0x2d')](_0x23c05c['stack']);if(_0x23c05c[_0xeeba('0x2e')]){delete _0x23c05c[_0xeeba('0x2e')];}_0x44eb14['status'](_0xffd638)[_0xeeba('0x2f')](_0x23c05c);};}function getUserAttributes(){return _(db[_0xeeba('0x30')]['rawAttributes'])[_0xeeba('0x29')](function(_0xe1086f){return{'name':_0xe1086f[_0xeeba('0x31')],'type':_0xe1086f[_0xeeba('0x32')][_0xeeba('0x33')]};})['filter'](function(_0x5d299c){return![_0xeeba('0x34'),'salt',_0xeeba('0x35'),'resetPasswordToken',_0xeeba('0x36'),_0xeeba('0x37')][_0xeeba('0x2b')](_0x5d299c[_0xeeba('0x2e')]);})[_0xeeba('0x2a')]();}exports[_0xeeba('0x38')]=function(_0x75c670,_0x278548){var _0x187f4a={},_0x4f1021={'count':0x0,'rows':[]};var _0x1dff70=getUserAttributes();_0x187f4a=qs['getOptions'](_0x1dff70,_0x75c670);var _0x25e56c={'where':_0x187f4a['where']};return db[_0xeeba('0x30')][_0xeeba('0x39')](_0x25e56c)['then'](function(_0xe53e87){_0x4f1021[_0xeeba('0x39')]=_0xe53e87;if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x3b')]){_0x187f4a[_0xeeba('0x3c')]=[{'all':!![]}];}if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x3d')]===_0xeeba('0x3e')){_0x187f4a[_0xeeba('0x3c')]=[{'model':db[_0xeeba('0x3f')],'as':'userSetting'}];}if(!_['includes'](_0x187f4a['attributes'],'id')){_0x187f4a[_0xeeba('0x40')]['push']('id');}return db[_0xeeba('0x30')]['findAll'](_0x187f4a);})[_0xeeba('0x22')](function(_0x41b085){_0x4f1021['rows']=_0x41b085;if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x41')]===_0xeeba('0x3e')){var _0x7a2e3=[];for(var _0x59130c=0x0;_0x59130c<_0x4f1021[_0xeeba('0x42')][_0xeeba('0x43')];_0x59130c++){_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x45'),_0x4f1021['rows'][_0x59130c][_0xeeba('0x46')]));_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x47'),_0x4f1021[_0xeeba('0x42')][_0x59130c][_0xeeba('0x46')]));_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x48'),_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3[_0xeeba('0x44')](get_open_tabs('mail',_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3['push'](get_open_tabs(_0xeeba('0x49'),_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3[_0xeeba('0x44')](get_open_tabs('whatsapp',_0x4f1021['rows'][_0x59130c][_0xeeba('0x46')]));}return Promise['all'](_0x7a2e3)[_0xeeba('0x22')](function(){return _0x4f1021;});}else{return _0x4f1021;}})[_0xeeba('0x22')](respondWithFilteredResult(_0x278548,_0x187f4a))['catch'](handleError(_0x278548,null));};exports['show']=function(_0x47441b,_0x1d7ea7){var _0x3dd813=getUserAttributes();_0x47441b[_0xeeba('0x3a')]['id']=_0x47441b[_0xeeba('0x4a')]['id'];var _0x1053cf=qs['getOptions'](_0x3dd813,_0x47441b);if(_0x47441b['query'][_0xeeba('0x3b')]){_0x1053cf[_0xeeba('0x3c')]=[{'all':!![]}];}if(_0x47441b[_0xeeba('0x3a')]['userSetting']===_0xeeba('0x3e')){_0x1053cf['include']=[{'model':db[_0xeeba('0x3f')],'as':_0xeeba('0x3d')}];}_0x1053cf=_['merge']({},_0x1053cf,_0x47441b[_0xeeba('0x4b')]);if(!_[_0xeeba('0x2b')](_0x1053cf[_0xeeba('0x40')],'id')){_0x1053cf[_0xeeba('0x40')][_0xeeba('0x44')]('id');}return db[_0xeeba('0x30')][_0xeeba('0x2c')](_0x1053cf)[_0xeeba('0x22')](handleEntityNotFound(_0x1d7ea7,null))[_0xeeba('0x22')](function(_0x1d33f4){var _0x407321=[];values=_0x1d33f4;if(_0x47441b[_0xeeba('0x3a')][_0xeeba('0x41')]==='true'){_0x407321[_0xeeba('0x44')](get_open_tabs('chat',_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x47'),_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x49'),_0x1d33f4['dataValues']));_0x407321['push'](get_open_tabs(_0xeeba('0x4c'),_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x48'),_0x1d33f4['dataValues']));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x4d'),_0x1d33f4[_0xeeba('0x46')]));return Promise[_0xeeba('0x4e')](_0x407321);}else{return values;}})[_0xeeba('0x22')](function(){return values;})[_0xeeba('0x22')](respondWithResult(_0x1d7ea7,null))[_0xeeba('0x4f')](handleError(_0x1d7ea7,null));};exports['update']=function(_0x1f97e9,_0x4b3134){if(_0x1f97e9[_0xeeba('0x50')]['id']){delete _0x1f97e9[_0xeeba('0x50')]['id'];}delete _0x1f97e9[_0xeeba('0x50')][_0xeeba('0x1e')];return db['User'][_0xeeba('0x2c')]({'where':{'id':_0x1f97e9[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x4b3134,null))[_0xeeba('0x22')](saveUpdates(_0x1f97e9['body'],null))[_0xeeba('0x22')](respondWithResult(_0x4b3134,null))[_0xeeba('0x4f')](handleError(_0x4b3134,null));};exports['describe']=function(_0x92ad44,_0x5c400c){return db[_0xeeba('0x30')][_0xeeba('0x51')]()[_0xeeba('0x22')](respondWithResult(_0x5c400c,null))[_0xeeba('0x4f')](handleError(_0x5c400c,null));};exports[_0xeeba('0x52')]=function(_0x588b4b,_0x1db146){return db[_0xeeba('0x30')]['find']({'where':{'id':_0x588b4b['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x1db146,null))[_0xeeba('0x22')](function(_0x3f4ef1){if(_0x3f4ef1){return _0x3f4ef1[_0xeeba('0x52')](_0x588b4b[_0xeeba('0x50')][_0xeeba('0x53')],_[_0xeeba('0x54')](_0x588b4b['body'],[_0xeeba('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1db146,null))[_0xeeba('0x4f')](handleError(_0x1db146,null));};function validateUser(_0x281f15){return new Promise(function(_0x34d61c,_0x108581){if(_0x281f15[_0xeeba('0x55')])return _0x34d61c(_0x281f15);return db[_0xeeba('0x56')][_0xeeba('0x57')](0x1)['then'](function(_0x2ace3f){if(_0x2ace3f['securePassword'])authService[_0xeeba('0x58')](_0x281f15[_0xeeba('0x34')]);db[_0xeeba('0x30')][_0xeeba('0x59')](_0xeeba('0x55'))[_0xeeba('0x22')](function(_0x96144c){if(_[_0xeeba('0x5a')](_0x96144c)){_0x281f15['internal']=_0x2ace3f[_0xeeba('0x5b')]||0x1;return;}if(_[_0xeeba('0x5a')](_0x2ace3f[_0xeeba('0x5b')])||_0x2ace3f[_0xeeba('0x5b')]===_0x96144c){_0x281f15[_0xeeba('0x55')]=_0x96144c+0x1;return;}if(_0x2ace3f[_0xeeba('0x5b')]>_0x96144c){_0x281f15[_0xeeba('0x55')]=_0x2ace3f[_0xeeba('0x5b')];return;}return db['sequelize']['query']('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[_0xeeba('0x5c')][_0xeeba('0x5d')][_0xeeba('0x5e')]})[_0xeeba('0x22')](function(_0xe8b8fd){if(_0xe8b8fd&&_0xe8b8fd[_0xeeba('0x43')]){for(var _0x2f41d1=0x0,_0x46b9e9=_0xe8b8fd['length'];_0x2f41d1<_0x46b9e9&&_['isNil'](_0x281f15[_0xeeba('0x55')]);_0x2f41d1++){if(_0x2ace3f[_0xeeba('0x5b')]<=_0xe8b8fd[_0x2f41d1]['from']){_0x281f15[_0xeeba('0x55')]=_0xe8b8fd[_0x2f41d1][_0xeeba('0x5f')];}else if(_0x2ace3f['min_internal']>_0xe8b8fd[_0x2f41d1]['from']&&_0x2ace3f[_0xeeba('0x5b')]<=_0xe8b8fd[_0x2f41d1]['to']){_0x281f15[_0xeeba('0x55')]=_0x2ace3f[_0xeeba('0x5b')];}}}if(_['isNil'](_0x281f15[_0xeeba('0x55')])){_0x281f15['internal']=_0x96144c+0x1;}return _0x34d61c(_0x281f15);});});})[_0xeeba('0x4f')](function(_0x2ba7cb){_0x108581(_0x2ba7cb);});});}function updateUser(_0x306b01){return new Promise(function(_0x205584,_0xc5d82f){try{if(_0x306b01[_0xeeba('0x60')]){_0x306b01[_0xeeba('0x61')]=_0x306b01[_0xeeba('0x55')];_0x306b01[_0xeeba('0x62')]={'mailbox':_0x306b01[_0xeeba('0x55')],'password':_0x306b01[_0xeeba('0x34')],'fullname':_0x306b01[_0xeeba('0x63')],'email':_0x306b01[_0xeeba('0x64')]};}if(_0x306b01[_0xeeba('0x1e')]===_0xeeba('0x1f')){if(!_0x306b01['permissions'])_0x306b01['permissions']=[_0xeeba('0x65'),_0xeeba('0x66'),_0xeeba('0x67'),_0xeeba('0x68'),'110',_0xeeba('0x69'),'105',_0xeeba('0x6a'),_0xeeba('0x6b'),_0xeeba('0x6c'),'109',_0xeeba('0x6d'),'111',_0xeeba('0x6e'),_0xeeba('0x6f')];}_0x205584(_0x306b01);}catch(_0x41b6ff){_0xc5d82f(_0x41b6ff);}});}exports[_0xeeba('0x70')]=function(_0x32c027,_0x3dda32){if(_0x32c027[_0xeeba('0x26')][_0xeeba('0x1e')]===_0xeeba('0x1f'))throw new Error('Unauthorized');if(_0x32c027[_0xeeba('0x50')][_0xeeba('0x1e')]===_0xeeba('0x26')&&_0x32c027[_0xeeba('0x26')][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error(_0xeeba('0x71'));}if(_0x32c027['body'][_0xeeba('0x1e')]==='admin'&&_0x32c027[_0xeeba('0x26')]['role']!==_0xeeba('0x24')){throw new Error(_0xeeba('0x72'));}return licenseUtil[_0xeeba('0x73')]([_0x32c027[_0xeeba('0x50')]])[_0xeeba('0x22')](function(){return validateUser(_0x32c027[_0xeeba('0x50')]);})[_0xeeba('0x22')](function(_0x3a8435){return updateUser(_0x3a8435)['then'](function(_0x53586b){if(_0x53586b['role']===_0xeeba('0x24')){_0x53586b['settingsEnabled']=_0x32c027['user'][_0xeeba('0x74')];delete _0x53586b[_0xeeba('0x75')];}return _0x53586b;});})[_0xeeba('0x22')](function(_0x1f0225){return db[_0xeeba('0x30')][_0xeeba('0x70')](_0x1f0225,{'include':[{'model':db[_0xeeba('0x62')],'as':'VoiceMail'}]});})[_0xeeba('0x22')](function(_0x33052a){if(_0x32c027['body']['role']==='user')return _0x33052a;if(_0x32c027['user']['role']!==_0xeeba('0x26'))return _0x33052a;return db[_0xeeba('0x76')][_0xeeba('0x2c')]({'where':{'name':_0x33052a[_0xeeba('0x1e')]===_0xeeba('0x1f')?_0xeeba('0x77'):_0xeeba('0x27'),'userProfileId':_0x32c027[_0xeeba('0x26')]['userProfileId']},'raw':!![]})[_0xeeba('0x22')](function(_0x8eaa21){if(!_0x8eaa21||_0x8eaa21['autoAssociation']!=0x0)return _0x33052a;return db[_0xeeba('0x78')][_0xeeba('0x70')]({'name':_0x33052a['name'],'resourceId':_0x33052a['id'],'type':_0x8eaa21['name'],'sectionId':_0x8eaa21['id']},{})['then'](function(){return _0x33052a;});})[_0xeeba('0x4f')](function(_0x5f11b9){logger[_0xeeba('0x2d')](_0xeeba('0x79'),_0x5f11b9);throw _0x5f11b9;});})['then'](respondWithResult(_0x3dda32,0xc9))[_0xeeba('0x4f')](handleError(_0x3dda32,null));};exports['bulkCreate']=function(_0x5857bb,_0x3f0070){var _0x35704f=_0x5857bb[_0xeeba('0x50')];var _0x33d731=[];if(_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]===_0xeeba('0x1f'))throw new Error(_0xeeba('0x7a'));if(_[_0xeeba('0x7b')](_0x35704f,['role',_0xeeba('0x26')])&&_0x5857bb['user'][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error(_0xeeba('0x71'));}if(_[_0xeeba('0x7b')](_0x35704f,[_0xeeba('0x1e'),_0xeeba('0x24')])&&_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xeeba('0x73')](_0x35704f)[_0xeeba('0x22')](function(){return validateUser(_0x35704f[0x0]);})[_0xeeba('0x22')](function(){for(var _0x386e17=0x1;_0x386e17<_0x35704f[_0xeeba('0x43')];_0x386e17++){var _0x468f3c=_0x35704f[_0x386e17-0x1]['internal'];if(!_0x35704f[_0x386e17][_0xeeba('0x55')])_0x35704f[_0x386e17]['internal']=_0x468f3c+0x1;_0x33d731['push'](validateUser(_0x35704f[_0x386e17]));}return Promise[_0xeeba('0x4e')](_0x33d731);})[_0xeeba('0x22')](function(){_0x33d731=[];for(var _0x5dd5f0=0x0;_0x5dd5f0<_0x35704f[_0xeeba('0x43')];_0x5dd5f0++){_0x33d731[_0xeeba('0x44')](updateUser(_0x35704f[_0x5dd5f0]));}return Promise[_0xeeba('0x4e')](_0x33d731);})[_0xeeba('0x22')](function(){_0x33d731=_0x35704f[_0xeeba('0x29')](function(_0x3a0ff3){return db['User'][_0xeeba('0x70')](_0x3a0ff3,{'include':[{'model':db['VoiceMail'],'as':_0xeeba('0x62')}]})[_0xeeba('0x22')](function(_0x2e1e18){_0x3a0ff3['id']=_0x2e1e18['id'];return _0x3a0ff3;});});return Promise[_0xeeba('0x4e')](_0x33d731);})['then'](function(_0x2f5bfa){if(_0x5857bb[_0xeeba('0x50')][_0xeeba('0x1e')]===_0xeeba('0x26'))return _0x2f5bfa;if(_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]!=='user')return _0x2f5bfa;var _0x379cf4=_[_0xeeba('0x7b')](_0x2f5bfa,function(_0x421d41){return _0x421d41[_0xeeba('0x1e')]===_0xeeba('0x1f')||_0x421d41[_0xeeba('0x1e')]==='telephone';});if(!_0x379cf4)return _0x2f5bfa;return db[_0xeeba('0x76')][_0xeeba('0x7c')]({'where':{'name':{'$or':[_0xeeba('0x77'),_0xeeba('0x27')]},'userProfileId':_0x5857bb[_0xeeba('0x26')][_0xeeba('0x75')]},'raw':!![]})[_0xeeba('0x22')](function(_0x141447){if(_['isEmpty'](_0x141447)||!_[_0xeeba('0x7b')](_0x141447,[_0xeeba('0x7d'),0x0]))return _0x2f5bfa;_0x33d731=[];var _0x3fb8d2=_(_0x141447)[_0xeeba('0x29')](function(_0xa6d034){if(_0xa6d034['autoAssociation']===0x1)return;return _0xa6d034['name']===_0xeeba('0x77')?_0xeeba('0x1f'):'telephone';})[_0xeeba('0x7e')]()[_0xeeba('0x2a')]();for(var _0x4f1cd9=0x0;_0x4f1cd9<_0x2f5bfa['length'];_0x4f1cd9++){if(!_['includes'](_0x3fb8d2,_0x2f5bfa[_0x4f1cd9][_0xeeba('0x1e')]))return;var _0x139e64=_0x2f5bfa[_0x4f1cd9][_0xeeba('0x1e')]==='agent'?_0xeeba('0x77'):_0xeeba('0x27');_0x33d731[_0xeeba('0x44')](db['UserProfileResource'][_0xeeba('0x70')]({'name':_0x2f5bfa[_0x4f1cd9][_0xeeba('0x2e')],'resourceId':_0x2f5bfa[_0x4f1cd9]['id'],'type':_0x139e64,'sectionId':_[_0xeeba('0x2c')](_0x141447,[_0xeeba('0x2e'),_0x139e64])['id']},{}));}return Promise[_0xeeba('0x4e')](_0x33d731);});})['then'](respondWithResult(_0x3f0070,0xc9))[_0xeeba('0x4f')](handleError(_0x3f0070,null));};exports[_0xeeba('0x7f')]=function(_0x504784,_0x5332e4){if(_0x504784[_0xeeba('0x50')]['id']){delete _0x504784[_0xeeba('0x50')]['id'];}return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x504784['params']['id']}})[_0xeeba('0x22')](function(_0xed3310){if(!_0xed3310)return null;if(_0xed3310['id']===_0x504784[_0xeeba('0x26')]['id']){if(!_0x504784[_0xeeba('0x50')][_0xeeba('0x80')]||!_0x504784['body'][_0xeeba('0x81')]){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x84'));}if(!_0xed3310[_0xeeba('0x85')](_0x504784[_0xeeba('0x50')][_0xeeba('0x80')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x504784[_0xeeba('0x50')]['oldPassword']===_0x504784[_0xeeba('0x50')]['newPassword']){throw new db['Sequelize'][(_0xeeba('0x83'))](_0xeeba('0x86'));}}else if(_0x504784[_0xeeba('0x26')][_0xeeba('0x1e')]==='admin'){if(!_0x504784['body']['newPassword']){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x87'));}}else if(_0x504784[_0xeeba('0x26')][_0xeeba('0x1e')]==='user'){if(!_0x504784[_0xeeba('0x50')][_0xeeba('0x81')]){throw new db['Sequelize'][(_0xeeba('0x83'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0xed3310[_0xeeba('0x1e')]!==_0xeeba('0x1f')){throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x7a'));}}else{throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x7a'));}return _0xed3310;})[_0xeeba('0x22')](handleEntityNotFound(_0x5332e4,null))['then'](function(_0x4b5ca1){return db[_0xeeba('0x56')][_0xeeba('0x88')]({'attributes':['id',_0xeeba('0x89'),_0xeeba('0x8a'),_0xeeba('0x8b')]})[_0xeeba('0x22')](function(_0x3cf0b4){if(_0x3cf0b4[_0xeeba('0x89')])authService[_0xeeba('0x58')](_0x504784['body'][_0xeeba('0x81')]);if(!_0x3cf0b4[_0xeeba('0x8a')]||!_0x4b5ca1[_0xeeba('0x35')])return _0x4b5ca1;authService[_0xeeba('0x8c')](_0x504784[_0xeeba('0x50')][_0xeeba('0x81')],_0x4b5ca1[_0xeeba('0x35')],_0x3cf0b4[_0xeeba('0x8b')]);return _0x4b5ca1;})[_0xeeba('0x22')](saveUpdates({'password':_0x504784['body'][_0xeeba('0x81')],'passwordResetAt':_0x504784[_0xeeba('0x26')]['id']==_0x504784[_0xeeba('0x4a')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x504784['body'][_0xeeba('0x81')],_0x4b5ca1['previousPasswords'])},null));})[_0xeeba('0x22')](respondWithResult(_0x5332e4,null))[_0xeeba('0x4f')](handleError(_0x5332e4,null));};exports['addQueues']=function(_0x1e9a0d,_0x1053a3){var _0x5b4107=_0x1e9a0d[_0xeeba('0x50')]['channel'];return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x1e9a0d[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),'role','online',_0xeeba('0x8d'),_0xeeba('0x8e'),_0xeeba('0x8f')]})[_0xeeba('0x22')](handleEntityNotFound(_0x1053a3,null))[_0xeeba('0x22')](function(_0x1517bf){if(_0x1517bf){if(!utils[_0xeeba('0x90')](_0x5b4107)){throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x91'));}return _0x1517bf['add'+_[_0xeeba('0x92')](_0x5b4107['toLowerCase']())+_0xeeba('0x93')](_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')],{'penalty':_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x94')]||0x0})[_0xeeba('0x95')](function(_0x3fed55){for(var _0x5aa282=0x0;_0x5aa282<_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')][_0xeeba('0x43')];_0x5aa282+=0x1){var _0x305ae0={'UserId':Number(_0x1e9a0d[_0xeeba('0x4a')]['id'])};_0x305ae0[_[_0xeeba('0x92')](_0x5b4107[_0xeeba('0x96')]())+_0xeeba('0x97')]=Number(_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')][_0x5aa282]);socket[_0xeeba('0x20')](_0xeeba('0x26')+_[_0xeeba('0x92')](_0x5b4107['toLowerCase']())+_0xeeba('0x98'),_0x305ae0);}return _0x3fed55;})[_0xeeba('0x22')](function(){if(_0x5b4107==='voice'){return db[_0xeeba('0x99')][_0xeeba('0x7c')]({'where':{'id':_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')]||[]},'raw':!![],'attributes':['id',_0xeeba('0x2e')]});}})[_0xeeba('0x22')](function(_0x2d9e71){var _0x35b9d3=_0x1517bf[_0xeeba('0x23')]({'plain':!![]});var _0x1043e1=[];if(_0x5b4107===_0xeeba('0x9a')&&_0x35b9d3['role']==='agent'&&_0x35b9d3[_0xeeba('0x9b')]){for(let _0x53bbf4=0x0;_0x53bbf4<_0x2d9e71[_0xeeba('0x43')];_0x53bbf4+=0x1){_0x1043e1[_0xeeba('0x44')]({'membername':_0x35b9d3[_0xeeba('0x2e')],'UserId':_0x35b9d3['id'],'queue_name':_0x2d9e71[_0x53bbf4][_0xeeba('0x2e')],'VoiceQueueId':_0x2d9e71[_0x53bbf4]['id'],'interface':_[_0xeeba('0x5a')](_0x35b9d3[_0xeeba('0x8f')])?util['format'](_0xeeba('0x9c'),_0x35b9d3[_0xeeba('0x2e')]):_0x35b9d3[_0xeeba('0x8f')],'paused':_0x35b9d3[_0xeeba('0x8e')]||![],'penalty':_0x1e9a0d[_0xeeba('0x50')]['penalty']||0x0});}return Promise['all'](_0x1043e1[_0xeeba('0x29')](function(_0x32583b){return db[_0xeeba('0x9d')]['upsert'](_0x32583b);}));}return _0x1517bf;});}})['then'](respondWithStatusCode(_0x1053a3,null))['catch'](handleError(_0x1053a3,null));};exports[_0xeeba('0x9e')]=function(_0xc34d75,_0x225229){var _0x3ac29c,_0x3fdfe4;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0xc34d75[_0xeeba('0x4a')]['id']},'attributes':['id','name',_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x225229,null))['then'](function(_0x27f258){if(_0x27f258){_0x3ac29c=_0x27f258;if(!_0xc34d75['query'][_0xeeba('0x9f')]||!utils[_0xeeba('0x90')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')])){throw new db['Sequelize'][(_0xeeba('0x83'))](_0xeeba('0x91'));}return _0x27f258[_0xeeba('0xa0')+_[_0xeeba('0x92')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')][_0xeeba('0x96')]())+_0xeeba('0x93')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')]);}})[_0xeeba('0x22')](function(_0x5caff2){if(_[_0xeeba('0xa1')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')])){for(var _0xb329d0=0x0;_0xb329d0<_0xc34d75[_0xeeba('0x3a')]['ids'][_0xeeba('0x43')];_0xb329d0+=0x1){_0x3fdfe4={'UserId':Number(_0xc34d75[_0xeeba('0x4a')]['id'])};_0x3fdfe4[_['capitalize'](_0xc34d75['query'][_0xeeba('0x9f')][_0xeeba('0x96')]())+'QueueId']=Number(_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')][_0xb329d0]);socket['emit'](_0xeeba('0x26')+_[_0xeeba('0x92')](_0xc34d75['query'][_0xeeba('0x9f')][_0xeeba('0x96')]())+'Queue:remove',_0x3fdfe4);}}else{_0x3fdfe4={'UserId':Number(_0xc34d75['params']['id'])};_0x3fdfe4[_['capitalize'](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')]['toLowerCase']())+_0xeeba('0x97')]=Number(_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')]);socket[_0xeeba('0x20')]('user'+_[_0xeeba('0x92')](_0xc34d75[_0xeeba('0x3a')]['channel'][_0xeeba('0x96')]())+_0xeeba('0xa2'),_0x3fdfe4);}return _0x5caff2;})['then'](function(){if(_0xc34d75['query'][_0xeeba('0x9f')]===_0xeeba('0x9a')){return db[_0xeeba('0x9d')]['destroy']({'where':{'UserId':_0xc34d75['params']['id'],'VoiceQueueId':_0xc34d75['query'][_0xeeba('0x53')]},'individualHooks':!![]})[_0xeeba('0x22')](function(){return _0x3ac29c;});}return _0x3ac29c;})[_0xeeba('0x22')](respondWithStatusCode(_0x225229,null))['catch'](handleError(_0x225229,null));};exports['addAvatar']=function(_0x2fccf6,_0x28c70f){_0x2fccf6[_0xeeba('0x50')]['userpic']=_0x2fccf6[_0xeeba('0xa3')][_0xeeba('0xa4')];return db[_0xeeba('0x30')]['find']({'where':{'id':_0x2fccf6[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x28c70f,null))[_0xeeba('0x22')](saveUpdates(_0x2fccf6[_0xeeba('0x50')],null))[_0xeeba('0x22')](respondWithResult(_0x28c70f,null))[_0xeeba('0x4f')](handleError(_0x28c70f,null));};exports['getAvatar']=function(_0x1ea41b,_0x54dc3c){var _0x275e02=path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x1ea41b[_0xeeba('0x4a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xeeba('0x22')](handleEntityNotFound(_0x54dc3c,null))[_0xeeba('0x22')](function(_0xb9b150){if(_0xb9b150){if(_[_0xeeba('0x5a')](_0xb9b150[_0xeeba('0xa7')])){return _0x54dc3c[_0xeeba('0xa8')](_0x275e02);}else{if(!fs[_0xeeba('0xa9')](path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],'server/files/images/',_0xb9b150['userpic']))){return _0x54dc3c[_0xeeba('0xa8')](_0x275e02);}return _0x54dc3c[_0xeeba('0xa8')](path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],_0xeeba('0xaa'),_0xb9b150[_0xeeba('0xa7')]));}}})[_0xeeba('0x4f')](handleError(_0x54dc3c,null));};exports[_0xeeba('0xab')]=function(_0x1441df,_0x421e48){return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x1441df['params']['id']},'attributes':['id']})[_0xeeba('0x22')](handleEntityNotFound(_0x421e48,null))[_0xeeba('0x22')](function(_0x2b2eca){var _0x626388=[];values=_0x2b2eca['dataValues'];_0x626388[_0xeeba('0x44')](get_open_tabs('chat',_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x47'),_0x2b2eca[_0xeeba('0x46')]));_0x626388[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x49'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x4c'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x48'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs('mail',_0x2b2eca['dataValues']));return Promise['all'](_0x626388);})[_0xeeba('0x22')](function(_0x41ea1c){if(_0x41ea1c){var _0x29ee98=_[_0xeeba('0x29')](values[_0xeeba('0xac')],function(_0x25e378){return{'channel':_0xeeba('0xad'),'id':_0x25e378['id'],'createdAt':_0x25e378[_0xeeba('0xae')]};});var _0x26b8b6=_[_0xeeba('0x29')](values['FaxOpenTabs'],function(_0x19ccfa){return{'channel':_0xeeba('0xaf'),'id':_0x19ccfa['id'],'createdAt':_0x19ccfa[_0xeeba('0xae')]};});var _0x4cc9dc=_[_0xeeba('0x29')](values['OpenchannelOpenTabs'],function(_0x1efb1d){return{'channel':_0xeeba('0xb0'),'id':_0x1efb1d['id'],'createdAt':_0x1efb1d[_0xeeba('0xae')]};});var _0x519b2d=_[_0xeeba('0x29')](values[_0xeeba('0xb1')],function(_0x38142f){return{'channel':_0xeeba('0xb2'),'id':_0x38142f['id'],'createdAt':_0x38142f[_0xeeba('0xae')]};});var _0x5b4073=_[_0xeeba('0x29')](values[_0xeeba('0xb3')],function(_0x2655d0){return{'channel':_0xeeba('0xb4'),'id':_0x2655d0['id'],'createdAt':_0x2655d0['createdAt']};});var _0x1db2da=_[_0xeeba('0x29')](values['WhatsappOpenTabs'],function(_0x5f6393){return{'channel':_0xeeba('0xb5'),'id':_0x5f6393['id'],'createdAt':_0x5f6393[_0xeeba('0xae')]};});var _0x534f5c=_['concat'](_0x29ee98,_0x26b8b6,_0x4cc9dc,_0x519b2d,_0x5b4073,_0x1db2da);var _0x4d3d15={'count':_0x534f5c[_0xeeba('0x43')],'rows':_0x534f5c};return _0x4d3d15;}else return null;})[_0xeeba('0x22')](respondWithResult(_0x421e48,null))[_0xeeba('0x4f')](handleError(_0x421e48,null));};exports['getContacts']=function(_0x598095,_0x377a89){var _0x2ada34={};return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x598095[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](function(_0x5a7e9d){if(!_0x5a7e9d){throw new APINotFoundError(util[_0xeeba('0xb6')](_0xeeba('0xb7'),_0x598095[_0xeeba('0x4a')]['id']));}return contacts[_0xeeba('0x51')]();})['then'](function(_0x303391){_0x598095['query'][_0xeeba('0x30')]=_0x598095['params']['id'];_0x2ada34=qs[_0xeeba('0xb8')](_0x303391,_0x598095);if(_0x598095[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0x3b'))){_0x2ada34['include']=[{'model':db[_0xeeba('0xba')],'as':_0xeeba('0xbb'),'required':![]},{'model':db[_0xeeba('0xbc')],'as':_0xeeba('0xbd'),'attributes':['id',_0xeeba('0x2e'),_0xeeba('0xbe')],'where':_0x598095[_0xeeba('0x3a')][_0xeeba('0xbf')]?{'id':_0x598095['query'][_0xeeba('0xbf')]}:undefined,'required':_0x598095[_0xeeba('0x3a')][_0xeeba('0xbf')]?!![]:![]}];}return contacts['findAll'](_0x598095[_0xeeba('0x3a')],_0x598095['user'],_0x2ada34,_0x303391);})[_0xeeba('0x22')](respondWithFilteredResult(_0x377a89,_0x2ada34))['catch'](APIHandleError(_0x377a89));};exports['getQueues']=function(_0x36b0b0,_0x42f438){var _0x584b13;var _0x2ae7be={};var _0x3124e8;return db['User'][_0xeeba('0x88')]({'where':{'id':_0x36b0b0[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x42f438,null))['then'](function(_0x25665a){if(!utils['isValidChannel'](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x91'));}_0x584b13=_0x25665a;var _0x3a33f4={};_0x3a33f4['model']=_['keys'](db[_['capitalize'](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0xc0')]['rawAttributes']);_0x3a33f4[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x36b0b0[_0xeeba('0x3a')]);_0x3a33f4['filters']=_['intersection'](_0x3a33f4[_0xeeba('0xc2')],_0x3a33f4[_0xeeba('0x3a')]);_0x2ae7be[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x3a33f4[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x36b0b0['query'][_0xeeba('0xc4')]));_0x2ae7be[_0xeeba('0x40')]=_0x2ae7be[_0xeeba('0x40')][_0xeeba('0x43')]?_0x2ae7be[_0xeeba('0x40')]:_0x3a33f4['model'];_0x2ae7be['order']=qs[_0xeeba('0xc5')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x2ae7be[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x36b0b0[_0xeeba('0x3a')],_0x3a33f4[_0xeeba('0xc7')]));if(_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x2ae7be[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x2ae7be[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x2ae7be[_0xeeba('0x40')],function(_0xbd9783){var _0x20fc79={};_0x20fc79[_0xbd9783]={'$like':'%'+_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x20fc79;})});}_0x2ae7be=_['merge']({},_0x2ae7be,_0x36b0b0[_0xeeba('0x4b')]);switch(_0x584b13[_0xeeba('0x1e')]){case'admin':return db[_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0xc0')][_0xeeba('0x7c')](_0x2ae7be);case'user':case _0xeeba('0x1f'):return _0x584b13['get'+_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0x93')](_0x2ae7be);default:throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0xcb'));}})[_0xeeba('0x22')](function(_0x4b1f23){_0x3124e8=_0x4b1f23[_0xeeba('0x43')];if(!_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x2ae7be[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x36b0b0[_0xeeba('0x3a')]['limit']);_0x2ae7be[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x36b0b0['query']['offset']);}switch(_0x584b13[_0xeeba('0x1e')]){case _0xeeba('0x24'):return db[_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')]['channel'])+_0xeeba('0xc0')][_0xeeba('0x7c')](_0x2ae7be);case _0xeeba('0x26'):case'agent':return _0x584b13[_0xeeba('0x23')+_[_0xeeba('0x92')](_0x36b0b0['query'][_0xeeba('0x9f')])+_0xeeba('0x93')](_0x2ae7be);}})[_0xeeba('0x22')](function(_0x3a1c6f){return{'count':_0x3124e8,'rows':_0x3a1c6f};})[_0xeeba('0x22')](respondWithResult(_0x42f438,null))['catch'](handleError(_0x42f438,null));};exports[_0xeeba('0xcd')]=function(_0x5a943b,_0x122b05){var _0x370775={};var _0x46e6c6={};var _0xfd7dc1;var _0x57df49;return db['User']['findOne']({'where':{'id':_0x5a943b[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x122b05,null))['then'](function(_0x385964){if(_0x385964){_0xfd7dc1=_0x385964;_0x46e6c6['model']=_['keys'](db[_0xeeba('0x9d')][_0xeeba('0xce')]);_0x46e6c6['query']=_['keys'](_0x5a943b[_0xeeba('0x3a')]);_0x46e6c6[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x46e6c6[_0xeeba('0xc2')],_0x46e6c6[_0xeeba('0x3a')]);_0x370775[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x46e6c6[_0xeeba('0xc2')],qs['fields'](_0x5a943b[_0xeeba('0x3a')]['fields']));_0x370775[_0xeeba('0x40')]=_0x370775['attributes'][_0xeeba('0x43')]?_0x370775[_0xeeba('0x40')]:_0x46e6c6[_0xeeba('0xc2')];_0x370775[_0xeeba('0xcf')]=qs['sort'](_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x370775[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5a943b[_0xeeba('0x3a')],_0x46e6c6['filters']));if(_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x370775[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x370775['where'],{'$or':_['map'](_0x370775[_0xeeba('0x40')],function(_0x30363e){var _0x4730e6={};_0x4730e6[_0x30363e]={'$like':'%'+_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x4730e6;})});}_0x370775=_[_0xeeba('0xca')]({},_0x370775,_0x5a943b[_0xeeba('0x4b')]);return _0xfd7dc1[_0xeeba('0xcd')](_0x370775);}})[_0xeeba('0x22')](function(_0x45f9a1){if(_0x45f9a1){_0x57df49=_0x45f9a1[_0xeeba('0x43')];if(!_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x370775['limit']=qs['limit'](_0x5a943b['query'][_0xeeba('0x1b')]);_0x370775[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x5a943b[_0xeeba('0x3a')]['offset']);}return _0xfd7dc1['getVoiceQueuesRt'](_0x370775);}})[_0xeeba('0x22')](function(_0x3cd7ae){if(_0x3cd7ae){return _0x3cd7ae?{'count':_0x57df49,'rows':_0x3cd7ae}:null;}})[_0xeeba('0x22')](respondWithResult(_0x122b05,null))[_0xeeba('0x4f')](handleError(_0x122b05,null));};exports[_0xeeba('0xd0')]=function(_0x163b16,_0x33d0eb){var _0x13d3d7={};var _0x2d7cb7={};var _0x33434b;var _0x505e16;return db['User'][_0xeeba('0x88')]({'where':{'id':_0x163b16['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x33d0eb,null))[_0xeeba('0x22')](function(_0x1a8563){if(_0x1a8563){_0x33434b=_0x1a8563;_0x2d7cb7['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xd1')][_0xeeba('0xce')]);_0x2d7cb7[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x163b16[_0xeeba('0x3a')]);_0x2d7cb7[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x2d7cb7[_0xeeba('0xc2')],_0x2d7cb7[_0xeeba('0x3a')]);_0x13d3d7[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x2d7cb7['model'],qs[_0xeeba('0xc4')](_0x163b16[_0xeeba('0x3a')]['fields']));_0x13d3d7['attributes']=_0x13d3d7['attributes']['length']?_0x13d3d7[_0xeeba('0x40')]:_0x2d7cb7['model'];_0x13d3d7['order']=qs[_0xeeba('0xc5')](_0x163b16['query'][_0xeeba('0xc5')]);_0x13d3d7[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x163b16[_0xeeba('0x3a')],_0x2d7cb7['filters']));if(_0x163b16['query']['filter']){_0x13d3d7[_0xeeba('0xc6')]=_['merge'](_0x13d3d7[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x13d3d7[_0xeeba('0x40')],function(_0x1d53ff){var _0x3440d9={};_0x3440d9[_0x1d53ff]={'$like':'%'+_0x163b16[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x3440d9;})});}_0x13d3d7=_[_0xeeba('0xca')]({},_0x13d3d7,_0x163b16[_0xeeba('0x4b')]);return _0x33434b[_0xeeba('0xd0')](_0x13d3d7);}})['then'](function(_0x5c1943){if(_0x5c1943){_0x505e16=_0x5c1943[_0xeeba('0x43')];if(!_0x163b16[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x13d3d7[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x163b16[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x13d3d7[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x163b16['query']['offset']);}return _0x33434b[_0xeeba('0xd0')](_0x13d3d7);}})['then'](function(_0x5716bd){if(_0x5716bd){return _0x5716bd?{'count':_0x505e16,'rows':_0x5716bd}:null;}})[_0xeeba('0x22')](respondWithResult(_0x33d0eb,null))[_0xeeba('0x4f')](handleError(_0x33d0eb,null));};exports[_0xeeba('0xd2')]=function(_0x39fb5c,_0x4b5af1){var _0x2d20d0={'raw':!![],'where':{}};var _0x3bed32={};var _0x49928f={'count':0x0,'rows':[]};return db['User'][_0xeeba('0x88')]({'where':{'id':_0x39fb5c[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x4b5af1,null))[_0xeeba('0x22')](function(_0x59a496){if(_0x59a496){_0x3bed32['model']=_['keys'](db['VoiceRecording']['rawAttributes']);_0x3bed32[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x39fb5c[_0xeeba('0x3a')]);_0x3bed32[_0xeeba('0xc7')]=_['intersection'](_0x3bed32[_0xeeba('0xc2')],_0x3bed32[_0xeeba('0x3a')]);_0x2d20d0[_0xeeba('0x40')]=_['intersection'](_0x3bed32[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x2d20d0[_0xeeba('0x40')]=_0x2d20d0[_0xeeba('0x40')][_0xeeba('0x43')]?_0x2d20d0[_0xeeba('0x40')]:_0x3bed32[_0xeeba('0xc2')];if(!_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x2d20d0['limit']=qs[_0xeeba('0x1b')](_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x2d20d0[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x39fb5c['query'][_0xeeba('0x19')]);}_0x2d20d0['order']=qs[_0xeeba('0xc5')](_0x39fb5c['query'][_0xeeba('0xc5')]);_0x2d20d0[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x39fb5c['query'],_0x3bed32[_0xeeba('0xc7')]));_0x2d20d0[_0xeeba('0xc6')]['UserId']=_0x59a496['id'];if(_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x2d20d0[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x2d20d0[_0xeeba('0xc6')],{'$or':_['map'](_0x2d20d0[_0xeeba('0x40')],function(_0x56b276){var _0x5ef033={};_0x5ef033[_0x56b276]={'$like':'%'+_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x5ef033;})});}_0x2d20d0=_[_0xeeba('0xca')]({},_0x2d20d0,_0x39fb5c[_0xeeba('0x4b')]);return db[_0xeeba('0xd3')]['count']({'where':_0x2d20d0['where']})[_0xeeba('0x22')](function(_0x1e2fb9){_0x49928f[_0xeeba('0x39')]=_0x1e2fb9;if(_0x39fb5c[_0xeeba('0x3a')]['includeAll']){_0x2d20d0[_0xeeba('0x3c')]=[{'all':!![]}];}return db[_0xeeba('0xd3')][_0xeeba('0x7c')](_0x2d20d0);})[_0xeeba('0x22')](function(_0x1a6edb){_0x49928f[_0xeeba('0x42')]=_0x1a6edb;return _0x49928f;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x4b5af1,_0x2d20d0))[_0xeeba('0x4f')](handleError(_0x4b5af1,null));};exports[_0xeeba('0xd4')]=function(_0x53e5be,_0x922043){var _0x57f1ca={'raw':!![],'where':{}};var _0x5aa3f7={};var _0x21e3bc={'count':0x0,'rows':[]};return db['User'][_0xeeba('0x88')]({'where':{'id':_0x53e5be['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x922043,null))['then'](function(_0x3555bd){if(_0x3555bd){_0x5aa3f7[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xd5')][_0xeeba('0xce')]);_0x5aa3f7[_0xeeba('0x3a')]=_['keys'](_0x53e5be[_0xeeba('0x3a')]);_0x5aa3f7[_0xeeba('0xc7')]=_['intersection'](_0x5aa3f7[_0xeeba('0xc2')],_0x5aa3f7['query']);_0x57f1ca[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x5aa3f7[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x53e5be[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x57f1ca['attributes']=_0x57f1ca[_0xeeba('0x40')][_0xeeba('0x43')]?_0x57f1ca[_0xeeba('0x40')]:_0x5aa3f7[_0xeeba('0xc2')];if(!_0x53e5be['query'][_0xeeba('0xb9')]('nolimit')){_0x57f1ca[_0xeeba('0x1b')]=qs['limit'](_0x53e5be[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x57f1ca[_0xeeba('0x19')]=qs['offset'](_0x53e5be['query'][_0xeeba('0x19')]);}_0x57f1ca[_0xeeba('0xcf')]=qs['sort'](_0x53e5be['query'][_0xeeba('0xc5')]);_0x57f1ca[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x53e5be[_0xeeba('0x3a')],_0x5aa3f7[_0xeeba('0xc7')]));_0x57f1ca[_0xeeba('0xc6')][_0xeeba('0xd6')]=_0x3555bd['id'];if(_0x53e5be[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x57f1ca[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x57f1ca[_0xeeba('0xc6')],{'$or':_['map'](_0x57f1ca[_0xeeba('0x40')],function(_0x41ba9c){var _0x3b3c2e={};_0x3b3c2e[_0x41ba9c]={'$like':'%'+_0x53e5be['query'][_0xeeba('0xc9')]+'%'};return _0x3b3c2e;})});}_0x57f1ca=_[_0xeeba('0xca')]({},_0x57f1ca,_0x53e5be[_0xeeba('0x4b')]);return db[_0xeeba('0xd5')][_0xeeba('0x39')]({'where':_0x57f1ca[_0xeeba('0xc6')]})[_0xeeba('0x22')](function(_0x1dc502){_0x21e3bc[_0xeeba('0x39')]=_0x1dc502;if(_0x53e5be[_0xeeba('0x3a')][_0xeeba('0x3b')]){_0x57f1ca[_0xeeba('0x3c')]=[{'all':!![]}];}return db[_0xeeba('0xd5')]['findAll'](_0x57f1ca);})['then'](function(_0x5f2a7d){_0x21e3bc['rows']=_0x5f2a7d;return _0x21e3bc;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x922043,_0x57f1ca))[_0xeeba('0x4f')](handleError(_0x922043,null));};exports[_0xeeba('0xd7')]=function(_0x1427d5,_0x497a8d){var _0x5eea13={};var _0x19165a={};var _0x33db20;var _0x32cb03;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x1427d5['params']['id']}})['then'](handleEntityNotFound(_0x497a8d,null))[_0xeeba('0x22')](function(_0x163024){if(_0x163024){_0x33db20=_0x163024;_0x19165a['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xd8')]['rawAttributes']);_0x19165a[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x1427d5[_0xeeba('0x3a')]);_0x19165a[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x19165a[_0xeeba('0xc2')],_0x19165a[_0xeeba('0x3a')]);_0x5eea13[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x19165a['model'],qs[_0xeeba('0xc4')](_0x1427d5[_0xeeba('0x3a')]['fields']));_0x5eea13[_0xeeba('0x40')]=_0x5eea13[_0xeeba('0x40')][_0xeeba('0x43')]?_0x5eea13[_0xeeba('0x40')]:_0x19165a['model'];_0x5eea13['order']=qs[_0xeeba('0xc5')](_0x1427d5['query'][_0xeeba('0xc5')]);_0x5eea13['where']=qs['filters'](_['pick'](_0x1427d5[_0xeeba('0x3a')],_0x19165a[_0xeeba('0xc7')]));if(_0x1427d5['query'][_0xeeba('0xc9')]){_0x5eea13[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x5eea13[_0xeeba('0xc6')],{'$or':_['map'](_0x5eea13[_0xeeba('0x40')],function(_0x43f851){var _0x1d0a17={};_0x1d0a17[_0x43f851]={'$like':'%'+_0x1427d5['query']['filter']+'%'};return _0x1d0a17;})});}_0x5eea13=_['merge']({},_0x5eea13,_0x1427d5[_0xeeba('0x4b')]);return _0x33db20['getChatInteractions'](_0x5eea13);}})[_0xeeba('0x22')](function(_0x503665){if(_0x503665){_0x32cb03=_0x503665[_0xeeba('0x43')];if(!_0x1427d5[_0xeeba('0x3a')][_0xeeba('0xb9')]('nolimit')){_0x5eea13[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x1427d5[_0xeeba('0x3a')]['limit']);_0x5eea13[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x1427d5['query'][_0xeeba('0x19')]);}return _0x33db20[_0xeeba('0xd7')](_0x5eea13);}})[_0xeeba('0x22')](function(_0x3b5c72){if(_0x3b5c72){return _0x3b5c72?{'count':_0x32cb03,'rows':_0x3b5c72}:null;}})['then'](respondWithResult(_0x497a8d,null))[_0xeeba('0x4f')](handleError(_0x497a8d,null));};exports[_0xeeba('0xd9')]=function(_0xcb8953,_0x31c2df){var _0x134d06={};var _0xf91f84={};var _0x15a7b4;var _0x3c21d5;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0xcb8953[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x31c2df,null))[_0xeeba('0x22')](function(_0x369131){if(_0x369131){_0x15a7b4=_0x369131;_0xf91f84[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db['OpenchannelInteraction'][_0xeeba('0xce')]);_0xf91f84[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0xcb8953[_0xeeba('0x3a')]);_0xf91f84[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0xf91f84['model'],_0xf91f84[_0xeeba('0x3a')]);_0x134d06[_0xeeba('0x40')]=_['intersection'](_0xf91f84[_0xeeba('0xc2')],qs['fields'](_0xcb8953[_0xeeba('0x3a')]['fields']));_0x134d06[_0xeeba('0x40')]=_0x134d06[_0xeeba('0x40')][_0xeeba('0x43')]?_0x134d06[_0xeeba('0x40')]:_0xf91f84[_0xeeba('0xc2')];_0x134d06['order']=qs['sort'](_0xcb8953[_0xeeba('0x3a')]['sort']);_0x134d06['where']=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0xcb8953[_0xeeba('0x3a')],_0xf91f84['filters']));if(_0xcb8953[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x134d06[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x134d06[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x134d06['attributes'],function(_0x32721d){var _0x17a3ad={};_0x17a3ad[_0x32721d]={'$like':'%'+_0xcb8953['query'][_0xeeba('0xc9')]+'%'};return _0x17a3ad;})});}_0x134d06=_[_0xeeba('0xca')]({},_0x134d06,_0xcb8953[_0xeeba('0x4b')]);return _0x15a7b4[_0xeeba('0xd9')](_0x134d06);}})[_0xeeba('0x22')](function(_0x5cdecd){if(_0x5cdecd){_0x3c21d5=_0x5cdecd[_0xeeba('0x43')];if(!_0xcb8953['query'][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x134d06[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0xcb8953['query'][_0xeeba('0x1b')]);_0x134d06[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0xcb8953['query']['offset']);}return _0x15a7b4['getOpenchannelInteractions'](_0x134d06);}})[_0xeeba('0x22')](function(_0x26b2ac){if(_0x26b2ac){return _0x26b2ac?{'count':_0x3c21d5,'rows':_0x26b2ac}:null;}})[_0xeeba('0x22')](respondWithResult(_0x31c2df,null))[_0xeeba('0x4f')](handleError(_0x31c2df,null));};exports[_0xeeba('0xda')]=function(_0x5ca169,_0x3a5e60){var _0x513286={'raw':!![],'where':{}};var _0x222ce3={};var _0x55fca6={'count':0x0,'rows':[]};return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x5ca169[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x3a5e60,null))[_0xeeba('0x22')](function(_0x5d85b2){if(_0x5d85b2){_0x222ce3['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xdb')][_0xeeba('0xce')]);_0x222ce3['query']=_[_0xeeba('0xc1')](_0x5ca169[_0xeeba('0x3a')]);_0x222ce3[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x222ce3[_0xeeba('0xc2')],_0x222ce3[_0xeeba('0x3a')]);_0x513286[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x222ce3[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x513286[_0xeeba('0x40')]=_0x513286[_0xeeba('0x40')][_0xeeba('0x43')]?_0x513286[_0xeeba('0x40')]:_0x222ce3[_0xeeba('0xc2')];if(!_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x513286['limit']=qs[_0xeeba('0x1b')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x513286['offset']=qs['offset'](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0x19')]);}_0x513286[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x513286[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5ca169[_0xeeba('0x3a')],_0x222ce3[_0xeeba('0xc7')]));_0x513286[_0xeeba('0xc6')]['UserId']=_0x5d85b2['id'];if(_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x513286[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x513286[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x513286[_0xeeba('0x40')],function(_0xaaf759){var _0x5be46e={};_0x5be46e[_0xaaf759]={'$like':'%'+_0x5ca169['query']['filter']+'%'};return _0x5be46e;})});}_0x513286=_[_0xeeba('0xca')]({},_0x513286,_0x5ca169[_0xeeba('0x4b')]);return db['MailInteraction'][_0xeeba('0x39')]({'where':_0x513286[_0xeeba('0xc6')]})[_0xeeba('0x22')](function(_0x584dd6){_0x55fca6[_0xeeba('0x39')]=_0x584dd6;if(_0x5ca169['query'][_0xeeba('0x3b')]){_0x513286['include']=[{'all':!![]}];}return db['MailInteraction'][_0xeeba('0x7c')](_0x513286);})[_0xeeba('0x22')](function(_0x430e57){_0x55fca6[_0xeeba('0x42')]=_0x430e57;return _0x55fca6;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x3a5e60,_0x513286))['catch'](handleError(_0x3a5e60,null));};exports['getSmsInteractions']=function(_0x3f0b6d,_0x3250b9){var _0x18df88={};var _0x4d3d99={};var _0x48820f;var _0x4c6f9d;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x3f0b6d[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3250b9,null))['then'](function(_0x5bc513){if(_0x5bc513){_0x48820f=_0x5bc513;_0x4d3d99[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xdc')][_0xeeba('0xce')]);_0x4d3d99[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x3f0b6d[_0xeeba('0x3a')]);_0x4d3d99[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x4d3d99['model'],_0x4d3d99[_0xeeba('0x3a')]);_0x18df88[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x4d3d99['model'],qs[_0xeeba('0xc4')](_0x3f0b6d['query'][_0xeeba('0xc4')]));_0x18df88[_0xeeba('0x40')]=_0x18df88[_0xeeba('0x40')]['length']?_0x18df88[_0xeeba('0x40')]:_0x4d3d99['model'];_0x18df88['order']=qs[_0xeeba('0xc5')](_0x3f0b6d[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x18df88[_0xeeba('0xc6')]=qs['filters'](_['pick'](_0x3f0b6d[_0xeeba('0x3a')],_0x4d3d99[_0xeeba('0xc7')]));if(_0x3f0b6d['query']['filter']){_0x18df88['where']=_[_0xeeba('0xca')](_0x18df88[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x18df88[_0xeeba('0x40')],function(_0x4dd04e){var _0x6ca5ac={};_0x6ca5ac[_0x4dd04e]={'$like':'%'+_0x3f0b6d[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x6ca5ac;})});}_0x18df88=_[_0xeeba('0xca')]({},_0x18df88,_0x3f0b6d[_0xeeba('0x4b')]);return _0x48820f['getSmsInteractions'](_0x18df88);}})[_0xeeba('0x22')](function(_0x5d3a56){if(_0x5d3a56){_0x4c6f9d=_0x5d3a56[_0xeeba('0x43')];if(!_0x3f0b6d['query'][_0xeeba('0xb9')]('nolimit')){_0x18df88[_0xeeba('0x1b')]=qs['limit'](_0x3f0b6d[_0xeeba('0x3a')]['limit']);_0x18df88['offset']=qs[_0xeeba('0x19')](_0x3f0b6d[_0xeeba('0x3a')]['offset']);}return _0x48820f['getSmsInteractions'](_0x18df88);}})[_0xeeba('0x22')](function(_0xd5eb48){if(_0xd5eb48){return _0xd5eb48?{'count':_0x4c6f9d,'rows':_0xd5eb48}:null;}})[_0xeeba('0x22')](respondWithResult(_0x3250b9,null))[_0xeeba('0x4f')](handleError(_0x3250b9,null));};exports[_0xeeba('0xdd')]=function(_0x20856a,_0x3ff61e){var _0x5b6fb5={};var _0xc6fc3b={};var _0x27557e;var _0x1d3f63;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x20856a['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x3ff61e,null))[_0xeeba('0x22')](function(_0xd4d00d){if(_0xd4d00d){_0x27557e=_0xd4d00d;_0xc6fc3b[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db['FaxInteraction']['rawAttributes']);_0xc6fc3b['query']=_[_0xeeba('0xc1')](_0x20856a[_0xeeba('0x3a')]);_0xc6fc3b[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0xc6fc3b['model'],_0xc6fc3b[_0xeeba('0x3a')]);_0x5b6fb5[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0xc6fc3b[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x20856a[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x5b6fb5[_0xeeba('0x40')]=_0x5b6fb5[_0xeeba('0x40')]['length']?_0x5b6fb5[_0xeeba('0x40')]:_0xc6fc3b[_0xeeba('0xc2')];_0x5b6fb5[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x20856a[_0xeeba('0x3a')]['sort']);_0x5b6fb5[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_['pick'](_0x20856a[_0xeeba('0x3a')],_0xc6fc3b[_0xeeba('0xc7')]));if(_0x20856a[_0xeeba('0x3a')]['filter']){_0x5b6fb5[_0xeeba('0xc6')]=_['merge'](_0x5b6fb5[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x5b6fb5[_0xeeba('0x40')],function(_0x34c2af){var _0x4805e2={};_0x4805e2[_0x34c2af]={'$like':'%'+_0x20856a['query'][_0xeeba('0xc9')]+'%'};return _0x4805e2;})});}_0x5b6fb5=_[_0xeeba('0xca')]({},_0x5b6fb5,_0x20856a['options']);return _0x27557e[_0xeeba('0xdd')](_0x5b6fb5);}})['then'](function(_0x115baf){if(_0x115baf){_0x1d3f63=_0x115baf[_0xeeba('0x43')];if(!_0x20856a['query']['hasOwnProperty']('nolimit')){_0x5b6fb5[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x20856a[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x5b6fb5[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x20856a['query'][_0xeeba('0x19')]);}return _0x27557e['getFaxInteractions'](_0x5b6fb5);}})[_0xeeba('0x22')](function(_0x498dea){if(_0x498dea){return _0x498dea?{'count':_0x1d3f63,'rows':_0x498dea}:null;}})[_0xeeba('0x22')](respondWithResult(_0x3ff61e,null))['catch'](handleError(_0x3ff61e,null));};exports[_0xeeba('0xde')]=function(_0x5e78d8,_0x20cac0){var _0x32205d={};var _0x27ac3f={};var _0x203288;var _0x46714b;return db['User']['findOne']({'where':{'id':_0x5e78d8[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20cac0,null))[_0xeeba('0x22')](function(_0x443927){if(_0x443927){_0x203288=_0x443927;_0x27ac3f['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xdf')]['rawAttributes']);_0x27ac3f[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x5e78d8[_0xeeba('0x3a')]);_0x27ac3f['filters']=_[_0xeeba('0xc3')](_0x27ac3f[_0xeeba('0xc2')],_0x27ac3f[_0xeeba('0x3a')]);_0x32205d[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x27ac3f['model'],qs[_0xeeba('0xc4')](_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x32205d[_0xeeba('0x40')]=_0x32205d['attributes'][_0xeeba('0x43')]?_0x32205d[_0xeeba('0x40')]:_0x27ac3f['model'];_0x32205d[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x5e78d8['query'][_0xeeba('0xc5')]);_0x32205d[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5e78d8[_0xeeba('0x3a')],_0x27ac3f[_0xeeba('0xc7')]));if(_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x32205d['where']=_[_0xeeba('0xca')](_0x32205d[_0xeeba('0xc6')],{'$or':_['map'](_0x32205d[_0xeeba('0x40')],function(_0x527c70){var _0xffca03={};_0xffca03[_0x527c70]={'$like':'%'+_0x5e78d8['query'][_0xeeba('0xc9')]+'%'};return _0xffca03;})});}_0x32205d=_['merge']({},_0x32205d,_0x5e78d8['options']);return _0x203288[_0xeeba('0xde')](_0x32205d);}})[_0xeeba('0x22')](function(_0x324bc8){if(_0x324bc8){_0x46714b=_0x324bc8[_0xeeba('0x43')];if(!_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x32205d[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x5e78d8[_0xeeba('0x3a')]['limit']);_0x32205d[_0xeeba('0x19')]=qs['offset'](_0x5e78d8['query'][_0xeeba('0x19')]);}return _0x203288[_0xeeba('0xde')](_0x32205d);}})[_0xeeba('0x22')](function(_0x3eb5f0){if(_0x3eb5f0){return _0x3eb5f0?{'count':_0x46714b,'rows':_0x3eb5f0}:null;}})[_0xeeba('0x22')](respondWithResult(_0x20cac0,null))[_0xeeba('0x4f')](handleError(_0x20cac0,null));};exports[_0xeeba('0xe0')]=function(_0x387876,_0x36d85d,_0x1bb01c){var _0x5167e7;var _0x3b1acb;var _0x5a0be8;var _0x5f5680=!_['isNil'](_0x387876[_0xeeba('0x4a')]['id'])?_0x387876[_0xeeba('0x4a')]['id']:!_[_0xeeba('0x5a')](_0x387876[_0xeeba('0x26')]['id'])?_0x387876[_0xeeba('0x26')]['id']:null;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x5f5680,'role':{'$or':[_0xeeba('0x24'),_0xeeba('0x26'),_0xeeba('0x1f')]}},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0xe1'),'mobile',_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8d')]})[_0xeeba('0x22')](function(_0xb1040d){if(_0xb1040d){if(_0xb1040d[_0xeeba('0x1e')]===_0xeeba('0x1f')){_0x5167e7=_0xb1040d;if(_0x387876[_0xeeba('0x50')][_0xeeba('0x8f')]){_0x5a0be8=util['format'](_0xeeba('0xe2'),_0x5167e7[_0x387876[_0xeeba('0x50')][_0xeeba('0x8f')]]);}else if(_0x387876[_0xeeba('0x50')][_0xeeba('0xe3')]){_0x5a0be8=util['format'](_0xeeba('0x9c'),_0x387876[_0xeeba('0x50')][_0xeeba('0xe3')]);}else{_0x5a0be8=util['format'](_0xeeba('0x9c'),_0x5167e7[_0xeeba('0x2e')]);}socket['to'](util[_0xeeba('0xb6')]('user:%s',_0x5167e7[_0xeeba('0x2e')]))[_0xeeba('0x20')](_0xeeba('0xe4'),{'user':{'id':_0x5167e7['id'],'name':_0x5167e7[_0xeeba('0x2e')]},'ip':_0x387876[_0xeeba('0xe5')]['x-forwarded-for']||_0x387876[_0xeeba('0xe6')][_0xeeba('0xe7')]||_0x387876[_0xeeba('0xe8')]['remoteAddress']||_0x387876[_0xeeba('0xe6')][_0xeeba('0xe8')][_0xeeba('0xe7')]});return db[_0xeeba('0x9d')][_0xeeba('0xe9')]({'where':{'membername':_0x5167e7[_0xeeba('0x2e')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xeeba('0x22')](function(){if(_0x5167e7){return _0x5167e7[_0xeeba('0xea')]({'raw':!![]});}})[_0xeeba('0x22')](function(_0x487f8d){if(_0x5167e7){if(_0x487f8d){_0x3b1acb=_0x487f8d;if(_0x3b1acb[_0xeeba('0x43')]){var _0xc919ac=_0x3b1acb[_0xeeba('0x29')](function(_0x37330e){var _0x1e99ef={'membername':_0x5167e7[_0xeeba('0x2e')],'UserId':_0x5167e7['id'],'queue_name':_0x37330e[_0xeeba('0x2e')],'VoiceQueueId':_0x37330e['id'],'interface':_0x5a0be8,'paused':_0x5167e7['loginInPause']||![],'penalty':_0x37330e[_0xeeba('0xeb')]||0x0};return db[_0xeeba('0x9d')]['upsert'](_0x1e99ef);});return Promise[_0xeeba('0x4e')](_0xc919ac);}}}})['then'](function(){if(_0x5167e7){return db['MemberReport'][_0xeeba('0x7c')]({'where':{'membername':_0x5167e7[_0xeeba('0x2e')],'exitAt':null}});}})[_0xeeba('0x22')](function(_0xb28d2){if(_0x5167e7){var _0x46d3f7=[];_0xb28d2[_0xeeba('0xec')](function(_0x1597b3){_0x46d3f7[_0xeeba('0x44')](_0x1597b3[_0xeeba('0x1d')]({'exitAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))}));});return Promise['all'](_0x46d3f7);}})[_0xeeba('0x22')](function(){if(_0x5167e7){var _0x453b8f=[];var _0x1be21b=[];var _0x2c27b6=utils[_0xeeba('0xee')]();var _0x4e21f2={'membername':_0x5167e7[_0xeeba('0x2e')],'interface':_0x5a0be8,'enterAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed')),'role':_0x5167e7['role'],'internal':_0x5167e7[_0xeeba('0x55')]};_0x2c27b6[_0xeeba('0xec')](function(_0x14e724){_0x453b8f[_0xeeba('0x44')](_[_0xeeba('0xca')]({'channel':_0x14e724,'type':'LOGIN','data1':_0x387876['body'][_0xeeba('0xef')],'data2':_0x5a0be8},_0x4e21f2));if(_0x5167e7[_0xeeba('0x8d')]){_0x1be21b[_0xeeba('0x44')](_[_0xeeba('0xca')]({'channel':_0x14e724,'type':_0xeeba('0xf0'),'data1':_0xeeba('0xf1')},_0x4e21f2));}});return db[_0xeeba('0xf2')][_0xeeba('0xf3')](_0x453b8f[_0xeeba('0xf4')](_0x1be21b),{'individualHooks':!![]});}})[_0xeeba('0x22')](function(){if(_0x5167e7){return _0x5167e7['update']({'online':!![],'lastLoginAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed')),'voicePause':_0x5167e7[_0xeeba('0x8d')]||![],'mailPause':_0x5167e7['loginInPause']||![],'chatPause':_0x5167e7[_0xeeba('0x8d')]||![],'faxPause':_0x5167e7[_0xeeba('0x8d')]||![],'smsPause':_0x5167e7[_0xeeba('0x8d')]||![],'openchannelPause':_0x5167e7[_0xeeba('0x8d')]||![],'whatsappPause':_0x5167e7[_0xeeba('0x8d')]||![],'pauseType':_0x5167e7[_0xeeba('0x8d')]?_0xeeba('0xf1'):null,'interface':_0x5a0be8,'lastPauseAt':moment()['format'](_0xeeba('0xed'))});}})[_0xeeba('0x22')](function(_0x6dedb3){if(_0x387876[_0xeeba('0xf5')]){return _0x1bb01c();}else{return Promise['resolve'](_0x6dedb3)[_0xeeba('0x22')](respondWithResult(_0x36d85d,null));}})[_0xeeba('0x4f')](handleError(_0x36d85d,null));};exports[_0xeeba('0xf6')]=function(_0x4e7def,_0x4af872){var _0x159b68;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x4e7def['params']['id'],'role':_0xeeba('0x1f')},'attributes':['id','name',_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x4af872,null))[_0xeeba('0x22')](function(_0x245877){if(_0x245877){_0x159b68=_0x245877;return db[_0xeeba('0x9d')]['destroy']({'where':{'membername':_0x159b68[_0xeeba('0x2e')]},'individualHooks':!![]});}})[_0xeeba('0x22')](function(){return db[_0xeeba('0xf2')][_0xeeba('0x7c')]({'where':{'membername':_0x159b68[_0xeeba('0x2e')],'exitAt':null}});})[_0xeeba('0x22')](function(_0x4fe870){var _0x2c7ab1=[];_0x4fe870['forEach'](function(_0x5d6da5){_0x2c7ab1[_0xeeba('0x44')](_0x5d6da5[_0xeeba('0x1d')]({'exitAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))}));});return Promise['all'](_0x2c7ab1);})[_0xeeba('0x22')](function(){return _0x159b68['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xeeba('0x22')](respondWithResult(_0x4af872,null))[_0xeeba('0x4f')](handleError(_0x4af872,null));};exports[_0xeeba('0xf7')]=function(_0x13066a,_0x312afd){var _0xc1413c;return db[_0xeeba('0x9d')][_0xeeba('0x1d')]({'paused':0x1},{'where':{'UserId':_0x13066a[_0xeeba('0x4a')]['id']},'individualHooks':!![]})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x13066a['params']['id'],'role':'agent'},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8f'),_0xeeba('0x9b')]});})['then'](handleEntityNotFound(_0x312afd,null))['then'](function(_0x2e0d9a){if(_0x2e0d9a){_0xc1413c=_0x2e0d9a;return db[_0xeeba('0xf2')][_0xeeba('0x7c')]({'where':{'membername':_0xc1413c[_0xeeba('0x2e')],'type':_0xeeba('0xf0'),'exitAt':null}});}})[_0xeeba('0x22')](function(_0x1983c2){if(_0x1983c2['length']){var _0x61fcbf=moment()[_0xeeba('0xb6')](_0xeeba('0xed'));for(var _0x33821f=0x0,_0x3bc105=_0x1983c2[_0xeeba('0x43')];_0x33821f<_0x3bc105;_0x33821f++){_0x1983c2[_0x33821f]['updateAttributes']({'exitAt':_0x61fcbf});}}})[_0xeeba('0x22')](function(){var _0x10d0f6=[];var _0x25c889=utils[_0xeeba('0xee')]();_0x25c889[_0xeeba('0xec')](function(_0x5e0c35){_0x10d0f6[_0xeeba('0x44')]({'channel':_0x5e0c35,'membername':_0xc1413c[_0xeeba('0x2e')],'interface':_[_0xeeba('0x5a')](_0xc1413c[_0xeeba('0x8f')])?util['format'](_0xeeba('0x9c'),_0xc1413c[_0xeeba('0x2e')]):_0xc1413c['interface'],'type':_0xeeba('0xf0'),'enterAt':moment()[_0xeeba('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x13066a['body'][_0xeeba('0x32')]||'DEFAULT\x20PAUSE','role':_0xc1413c[_0xeeba('0x1e')],'internal':_0xc1413c[_0xeeba('0x55')]});});return db[_0xeeba('0xf2')][_0xeeba('0xf3')](_0x10d0f6,{'individualHooks':!![]});})['then'](function(){return _0xc1413c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x13066a['body']['type']||_0xeeba('0xf8'),'lastPauseAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))});})[_0xeeba('0x22')](respondWithResult(_0x312afd,null))[_0xeeba('0x4f')](handleError(_0x312afd,null));};exports[_0xeeba('0xf9')]=function(_0x590774,_0x2ab53d){if(_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]&&!utils['isValidChannel'](_0x590774['body'][_0xeeba('0x9f')])){throw new APIBadRequestError(util[_0xeeba('0xb6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]));}return db['User'][_0xeeba('0x2c')]({'where':{'id':_0x590774[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8f'),_0xeeba('0x9b'),'voicePause',_0xeeba('0xfa'),_0xeeba('0xfb'),_0xeeba('0xfc'),_0xeeba('0xfd'),_0xeeba('0xfe'),_0xeeba('0xff'),_0xeeba('0x100'),'lastPauseAt']})[_0xeeba('0x22')](function(_0x440688){if(!_0x440688){throw new APINotFoundError(util[_0xeeba('0xb6')](_0xeeba('0xb7'),_0x590774['params']['id']));}return _0x440688['unpause'](_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]);})[_0xeeba('0x22')](respondWithResult(_0x2ab53d,null))[_0xeeba('0x4f')](APIHandleError(_0x2ab53d));};exports[_0xeeba('0x101')]=function(_0x4a7d5e,_0xdb8720){var _0x13db64={};var _0x382201={};var _0x1a773d;var _0x435ac5;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x4a7d5e[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0xdb8720,null))['then'](function(_0x3a5a9b){if(_0x3a5a9b){_0x1a773d=_0x3a5a9b;_0x382201[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0x102')][_0xeeba('0xce')]);_0x382201[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x4a7d5e[_0xeeba('0x3a')]);_0x382201['filters']=_[_0xeeba('0xc3')](_0x382201[_0xeeba('0xc2')],_0x382201[_0xeeba('0x3a')]);_0x13db64[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x382201[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x13db64[_0xeeba('0x40')]=_0x13db64[_0xeeba('0x40')][_0xeeba('0x43')]?_0x13db64[_0xeeba('0x40')]:_0x382201['model'];_0x13db64[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x13db64['where']=qs[_0xeeba('0xc7')](_['pick'](_0x4a7d5e[_0xeeba('0x3a')],_0x382201[_0xeeba('0xc7')]));if(_0x4a7d5e['query'][_0xeeba('0xc9')]){_0x13db64['where']=_[_0xeeba('0xca')](_0x13db64[_0xeeba('0xc6')],{'$or':_['map'](_0x13db64[_0xeeba('0x40')],function(_0x268dec){var _0x52a093={};_0x52a093[_0x268dec]={'$like':'%'+_0x4a7d5e[_0xeeba('0x3a')]['filter']+'%'};return _0x52a093;})});}_0x13db64=_['merge']({},_0x13db64,_0x4a7d5e[_0xeeba('0x4b')]);return _0x1a773d[_0xeeba('0x101')](_0x13db64);}})['then'](function(_0x14e95f){if(_0x14e95f){_0x435ac5=_0x14e95f[_0xeeba('0x43')];if(!_0x4a7d5e['query'][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x13db64[_0xeeba('0x1b')]=qs['limit'](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x13db64[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0x19')]);}return _0x1a773d[_0xeeba('0x101')](_0x13db64);}})[_0xeeba('0x22')](function(_0x1906bf){if(_0x1906bf){return _0x1906bf?{'count':_0x435ac5,'rows':_0x1906bf}:null;}})['then'](respondWithResult(_0xdb8720,null))['catch'](handleError(_0xdb8720,null));};exports[_0xeeba('0x103')]=function(_0x5e6714,_0xc38326){var _0x43920a=_0x5e6714[_0xeeba('0x4a')]['id'];var _0x459bae=_0x5e6714['body']?_0x5e6714[_0xeeba('0x50')][_0xeeba('0x53')]:null;var _0x38e6af=[];return Promise['resolve']()[_0xeeba('0x22')](function(){if(!_0x459bae)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x43920a}});})[_0xeeba('0x22')](function(_0x3e7e5b){if(!_0x3e7e5b)throw new APINotFoundError(util['format'](_0xeeba('0xb7'),_0x5e6714[_0xeeba('0x4a')]['id']));return db['sequelize']['transaction'](function(_0x4f96b0){return _0x3e7e5b['addTeams'](_0x459bae,{'transaction':_0x4f96b0})[_0xeeba('0x22')](function(){return db['Team'][_0xeeba('0x7c')]({'where':{'id':{'$in':_0x459bae}}});})['then'](function(_0x6b26ce){var _0x3d947d=_[_0xeeba('0x29')](_0x6b26ce,function(_0x3a9ff7){return _0x3a9ff7[_0xeeba('0x104')]();});return Promise[_0xeeba('0x4e')](_0x3d947d);})[_0xeeba('0x22')](function(_0x35241a){_0x38e6af=_['flattenDeep'](_0x35241a);var _0x15bdbb=_[_0xeeba('0x29')](_0x38e6af,function(_0x590b69){return _0x590b69[_0xeeba('0x105')](_0x3e7e5b['id'],{'transaction':_0x4f96b0});});return Promise[_0xeeba('0x4e')](_0x15bdbb);})[_0xeeba('0x22')](function(){if(!_0x3e7e5b[_0xeeba('0x9b')])return;var _0x275dab=_[_0xeeba('0xc9')](_0x38e6af,function(_0x4591f5){return _0x4591f5[_0xeeba('0x106')](_0xeeba('0x9f'))===_0xeeba('0x107');});var _0x38c9e1=_[_0xeeba('0x29')](_0x275dab,function(_0x21659f){return db['UserVoiceQueueRt'][_0xeeba('0x108')]({'membername':_0x3e7e5b[_0xeeba('0x2e')],'UserId':_0x3e7e5b['id'],'queue_name':_0x21659f[_0xeeba('0x2e')],'VoiceQueueId':_0x21659f['id'],'interface':_['isNil'](_0x3e7e5b[_0xeeba('0x8f')])?util[_0xeeba('0xb6')](_0xeeba('0x9c'),_0x3e7e5b[_0xeeba('0x2e')]):_0x3e7e5b[_0xeeba('0x8f')],'paused':_0x3e7e5b[_0xeeba('0x8e')]||![],'penalty':_0x3e7e5b[_0xeeba('0x94')]},{'transaction':_0x4f96b0});});return Promise['all'](_0x38c9e1);})[_0xeeba('0x22')](function(){return db[_0xeeba('0x109')]['findAll']({'where':{'teamId':{'$in':_0x459bae}}});})[_0xeeba('0x22')](function(_0x425043){var _0x3e5080=_[_0xeeba('0x29')](_0x425043,function(_0xb57f81){return db[_0xeeba('0x10a')]['create']({'UserId':_0x3e7e5b['id'],'VoicePrefixId':_0xb57f81[_0xeeba('0x10b')]},{'transaction':_0x4f96b0});});return Promise[_0xeeba('0x4e')](_0x3e5080);});});})['then'](function(){for(var _0x50cc12=0x0;_0x50cc12<_0x38e6af['length'];_0x50cc12++){var _0x45045d=_0x38e6af[_0x50cc12][_0xeeba('0x106')](_0xeeba('0x9f'));var _0x57be4a=_0x45045d+_0xeeba('0x97');socket[_0xeeba('0x20')](_0xeeba('0x26')+_0x45045d+_0xeeba('0x98'),{'UserId':_0x43920a,['queueField']:_0x38e6af[_0x50cc12]['id']});}})[_0xeeba('0x22')](respondWithStatusCode(_0xc38326,null))[_0xeeba('0x4f')](APIHandleError(_0xc38326));};exports[_0xeeba('0x10c')]=function(_0x308e40,_0x541e1e){var _0x282874=_0x308e40[_0xeeba('0x4a')]['id'];var _0x4f2339=null;if(_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')]){_0x4f2339=_['isArray'](_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')])?_0x308e40['query'][_0xeeba('0x53')]:[_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')]];}var _0x45a2d7=[];return Promise['resolve']()[_0xeeba('0x22')](function(){if(!_0x4f2339)throw new APIBadRequestError(_0xeeba('0x10d'));})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x282874}});})[_0xeeba('0x22')](function(_0x32df42){if(!_0x32df42)throw new APINotFoundError(util['format'](_0xeeba('0xb7'),_0x308e40[_0xeeba('0x4a')]['id']));return db[_0xeeba('0x5c')][_0xeeba('0x10e')](function(_0x109514){return _0x32df42['removeTeams'](_0x4f2339,{'transaction':_0x109514})[_0xeeba('0x22')](function(){return db[_0xeeba('0x102')]['findAll']({'where':{'id':{'$in':_0x4f2339}}});})[_0xeeba('0x22')](function(_0x2d85ac){var _0x196584=_['map'](_0x2d85ac,function(_0x578d8b){return _0x578d8b[_0xeeba('0x104')]();});return Promise[_0xeeba('0x4e')](_0x196584);})[_0xeeba('0x22')](function(_0x2ab8b7){_0x45a2d7=_[_0xeeba('0x10f')](_0x2ab8b7);var _0x1d94fc=_[_0xeeba('0x29')](_0x45a2d7,function(_0x3bb941){return _0x3bb941[_0xeeba('0x110')](_0x32df42['id'],{'transaction':_0x109514});});return Promise[_0xeeba('0x4e')](_0x1d94fc);})[_0xeeba('0x22')](function(){if(!_0x32df42['online'])return;var _0x3f88c9=_['filter'](_0x45a2d7,function(_0x144410){return _0x144410[_0xeeba('0x106')]('channel')===_0xeeba('0x107');});var _0x57f3f8=_[_0xeeba('0x29')](_0x3f88c9,function(_0x54b5d0){return db[_0xeeba('0x9d')][_0xeeba('0xe9')]({'where':{'VoiceQueueId':_0x54b5d0['id'],'UserId':_0x32df42['id']},'transaction':_0x109514});});return Promise[_0xeeba('0x4e')](_0x57f3f8);})[_0xeeba('0x22')](function(){return db[_0xeeba('0x109')][_0xeeba('0x7c')]({'where':{'teamId':{'$in':_0x4f2339}}});})[_0xeeba('0x22')](function(_0x6d2451){var _0x560d6d=_[_0xeeba('0x29')](_0x6d2451,function(_0x16920b){return db[_0xeeba('0x10a')][_0xeeba('0xe9')]({'where':{'UserId':_0x32df42['id'],'VoicePrefixId':_0x16920b['VoicePrefixId']}},{'transaction':_0x109514});});return Promise['all'](_0x560d6d);});});})[_0xeeba('0x22')](function(){for(var _0x6d94ea=0x0;_0x6d94ea<_0x45a2d7['length'];_0x6d94ea++){var _0x50cc63=_0x45a2d7[_0x6d94ea]['getDataValue'](_0xeeba('0x9f'));var _0x3108e2=_0x50cc63+_0xeeba('0x97');socket[_0xeeba('0x20')](_0xeeba('0x26')+_0x50cc63+_0xeeba('0xa2'),{'UserId':_0x282874,['queueField']:_0x45a2d7[_0x6d94ea]['id']});}})[_0xeeba('0x22')](respondWithStatusCode(_0x541e1e,null))[_0xeeba('0x4f')](APIHandleError(_0x541e1e));};exports[_0xeeba('0x111')]=function(_0x2bbc5b,_0x125f53){var _0x1ca26d={};var _0x359c48={};var _0x302442;var _0x1ccdf1;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x2bbc5b[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x125f53,null))['then'](function(_0xd80a44){if(_0xd80a44){_0x302442=_0xd80a44;_0x359c48[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xba')][_0xeeba('0xce')]);_0x359c48[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x2bbc5b[_0xeeba('0x3a')]);_0x359c48[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x359c48[_0xeeba('0xc2')],_0x359c48[_0xeeba('0x3a')]);_0x1ca26d['attributes']=_[_0xeeba('0xc3')](_0x359c48[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x1ca26d[_0xeeba('0x40')]=_0x1ca26d[_0xeeba('0x40')][_0xeeba('0x43')]?_0x1ca26d[_0xeeba('0x40')]:_0x359c48[_0xeeba('0xc2')];_0x1ca26d[_0xeeba('0xcf')]=qs['sort'](_0x2bbc5b[_0xeeba('0x3a')]['sort']);_0x1ca26d['where']=qs['filters'](_[_0xeeba('0xc8')](_0x2bbc5b[_0xeeba('0x3a')],_0x359c48[_0xeeba('0xc7')]));if(_0x2bbc5b['query']['filter']){_0x1ca26d[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x1ca26d[_0xeeba('0xc6')],{'$or':_['map'](_0x1ca26d[_0xeeba('0x40')],function(_0x44cf80){var _0x45613e={};_0x45613e[_0x44cf80]={'$like':'%'+_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x45613e;})});}_0x1ca26d=_['merge']({},_0x1ca26d,_0x2bbc5b[_0xeeba('0x4b')]);return _0x302442[_0xeeba('0x111')](_0x1ca26d);}})[_0xeeba('0x22')](function(_0x2974ce){if(_0x2974ce){_0x1ccdf1=_0x2974ce[_0xeeba('0x43')];if(!_0x2bbc5b[_0xeeba('0x3a')]['hasOwnProperty'](_0xeeba('0xcc'))){_0x1ca26d[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x1ca26d['offset']=qs['offset'](_0x2bbc5b['query'][_0xeeba('0x19')]);}return _0x302442[_0xeeba('0x111')](_0x1ca26d);}})[_0xeeba('0x22')](function(_0x53d16a){if(_0x53d16a){return _0x53d16a?{'count':_0x1ccdf1,'rows':_0x53d16a}:null;}})['then'](respondWithResult(_0x125f53,null))[_0xeeba('0x4f')](handleError(_0x125f53,null));};exports[_0xeeba('0x112')]=function(_0x58f7a0,_0x242d4b){var _0x23c755={};var _0x1d2cf6={};var _0x4043d5;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x58f7a0[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x242d4b,null))['then'](function(_0x11eede){if(_0x11eede){_0x4043d5=_0x11eede;_0x1d2cf6[_0xeeba('0xc2')]=_['keys'](db[_0xeeba('0x30')]['rawAttributes']);_0x1d2cf6[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x58f7a0['query']);_0x1d2cf6[_0xeeba('0xc7')]=_['intersection'](_0x1d2cf6[_0xeeba('0xc2')],_0x1d2cf6[_0xeeba('0x3a')]);_0x23c755[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x1d2cf6['model'],qs[_0xeeba('0xc4')](_0x58f7a0[_0xeeba('0x3a')]['fields']));_0x23c755[_0xeeba('0x40')]=_0x23c755[_0xeeba('0x40')][_0xeeba('0x43')]?_0x23c755[_0xeeba('0x40')]:_0x1d2cf6[_0xeeba('0xc2')];_0x23c755[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x23c755[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x58f7a0[_0xeeba('0x3a')],_0x1d2cf6['filters']));if(_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x23c755[_0xeeba('0xc6')]=_['merge'](_0x23c755[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x23c755[_0xeeba('0x40')],function(_0x4d06ba){var _0x5851c1={};_0x5851c1[_0x4d06ba]={'$like':'%'+_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x5851c1;})});}_0x23c755[_0xeeba('0xc2')]=db[_0xeeba('0x30')];_0x23c755['as']='Agents';_0x23c755=_[_0xeeba('0xca')]({},_0x23c755,_0x58f7a0['options']);return _0x4043d5['getVoiceQueues']({'include':[_0x23c755]});}})[_0xeeba('0x22')](function(_0x3dff68){if(_0x3dff68){var _0x48bc72={},_0x176491=[];for(var _0x3ddad1=0x0;_0x3ddad1<_0x3dff68['length'];_0x3ddad1+=0x1){for(var _0x5ac566=0x0,_0x42208f;_0x5ac566<_0x3dff68[_0x3ddad1][_0xeeba('0x77')][_0xeeba('0x43')];_0x5ac566+=0x1){_0x42208f=_0x3dff68[_0x3ddad1][_0xeeba('0x77')][_0x5ac566][_0xeeba('0x23')]({'plain':!![]});_0x48bc72[_0x42208f['id']]=_0x42208f;}}_0x48bc72=_[_0xeeba('0x113')](_0x48bc72);for(var _0x3c7d3e=qs['offset'](_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0x19')]);_0x3c7d3e<_0x48bc72['length']&&_0x176491[_0xeeba('0x43')]=_0x37b5cc){_0x3dbb8f=_0x37b5cc;_0x3ca09a=0xc8;}else{_0x3ca09a=0xce;}_0x32fda0[_0x6f60('0x15')](_0x3ca09a);return _0x32fda0['set'](_0x6f60('0x1b'),_0x25bff7+'-'+_0x3dbb8f+'/'+_0x37b5cc)[_0x6f60('0x1c')](_0x33e9ee);}return null;};}function saveUpdates(_0x3f130d){return function(_0x583741){if(_0x583741){return _0x583741[_0x6f60('0x1d')](_0x3f130d)['then'](function(_0x5e32d6){if(_0x5e32d6[_0x6f60('0x1e')]===_0x6f60('0x1f')){socket[_0x6f60('0x20')](_0x6f60('0x21')+_0x5e32d6['id'],_0x5e32d6);}return _0x5e32d6;});}return null;};}function removeEntity(_0x3b12ce){return function(_0x2b034b){if(_0x2b034b){return _0x2b034b[_0x6f60('0x22')]()['then'](function(){var _0x4a58f1=_0x2b034b[_0x6f60('0x23')]({'plain':!![]});if(_0x4a58f1['role']===_0x6f60('0x24'))return;var _0x45d130=[{'name':_0x6f60('0x25'),'value':_0x6f60('0x26'),'ignore':!![]},{'name':_0x6f60('0x27'),'value':_0x6f60('0x1f'),'ignore':![]},{'name':_0x6f60('0x28'),'value':'telephone','ignore':![]}];var _0x235a7e=_(_0x45d130)[_0x6f60('0x29')](_0x6f60('0x2a'))[_0x6f60('0x2b')](_0x6f60('0x2c'))['value']();if(_[_0x6f60('0x2d')](_0x235a7e,_0x4a58f1[_0x6f60('0x1e')])){return;}var _0x197d20=_[_0x6f60('0x2e')](_0x45d130,[_0x6f60('0x2c'),_0x4a58f1[_0x6f60('0x1e')]])[_0x6f60('0x2f')];return db[_0x6f60('0x30')]['destroy']({'where':{'type':_0x197d20,'resourceId':_0x4a58f1['id']}})['then'](function(){return _0x2b034b;});})[_0x6f60('0x31')](function(){_0x3b12ce[_0x6f60('0x15')](0xcc)[_0x6f60('0x16')]();});}};}function handleEntityNotFound(_0x521b27){return function(_0x187985){if(!_0x187985){_0x521b27[_0x6f60('0x14')](0x194);}return _0x187985;};}function handleError(_0x5b7f6d,_0x53ec2a){_0x53ec2a=_0x53ec2a||0x1f4;return function(_0x266541){logger['error'](_0x266541[_0x6f60('0x32')]);if(_0x266541[_0x6f60('0x2f')]){delete _0x266541[_0x6f60('0x2f')];}_0x5b7f6d[_0x6f60('0x15')](_0x53ec2a)[_0x6f60('0x33')](_0x266541);};}function getUserAttributes(){return _(db[_0x6f60('0x34')][_0x6f60('0x35')])[_0x6f60('0x2b')](function(_0x289b0a){return{'name':_0x289b0a[_0x6f60('0x36')],'type':_0x289b0a[_0x6f60('0x37')][_0x6f60('0x38')]};})['filter'](function(_0x3f8b69){return![_0x6f60('0x39'),_0x6f60('0x3a'),_0x6f60('0x3b'),_0x6f60('0x3c'),_0x6f60('0x3d'),_0x6f60('0x3e')][_0x6f60('0x2d')](_0x3f8b69[_0x6f60('0x2f')]);})[_0x6f60('0x2c')]();}exports[_0x6f60('0x3f')]=function(_0x5e03f0,_0x214657){var _0x58e545={},_0x1d5953={'count':0x0,'rows':[]};var _0xb1727e=getUserAttributes();_0x58e545=qs['getOptions'](_0xb1727e,_0x5e03f0);var _0x4e80d4={'where':_0x58e545[_0x6f60('0x40')]};return db['User'][_0x6f60('0x1a')](_0x4e80d4)[_0x6f60('0x31')](function(_0x4acaec){_0x1d5953[_0x6f60('0x1a')]=_0x4acaec;if(_0x5e03f0['query'][_0x6f60('0x41')]){_0x58e545[_0x6f60('0x42')]=[{'all':!![]}];}if(_0x5e03f0[_0x6f60('0x43')]['userSetting']===_0x6f60('0x44')){_0x58e545['include']=[{'model':db[_0x6f60('0x45')],'as':_0x6f60('0x46')}];}if(!_['includes'](_0x58e545[_0x6f60('0x47')],'id')){_0x58e545[_0x6f60('0x47')]['push']('id');}return db[_0x6f60('0x34')][_0x6f60('0x48')](_0x58e545);})['then'](function(_0x1116d2){_0x1d5953['rows']=_0x1116d2;if(_0x5e03f0[_0x6f60('0x43')]['openTabs']===_0x6f60('0x44')){var _0x333f63=[];for(var _0x51ac35=0x0;_0x51ac35<_0x1d5953[_0x6f60('0x49')][_0x6f60('0x4a')];_0x51ac35++){_0x333f63[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4c'),_0x1d5953['rows'][_0x51ac35][_0x6f60('0x4d')]));_0x333f63[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4e'),_0x1d5953[_0x6f60('0x49')][_0x51ac35][_0x6f60('0x4d')]));_0x333f63[_0x6f60('0x4b')](get_open_tabs('fax',_0x1d5953[_0x6f60('0x49')][_0x51ac35][_0x6f60('0x4d')]));_0x333f63[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4f'),_0x1d5953['rows'][_0x51ac35][_0x6f60('0x4d')]));_0x333f63[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x50'),_0x1d5953[_0x6f60('0x49')][_0x51ac35]['dataValues']));_0x333f63[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x51'),_0x1d5953['rows'][_0x51ac35][_0x6f60('0x4d')]));}return Promise[_0x6f60('0x52')](_0x333f63)['then'](function(){return _0x1d5953;});}else{return _0x1d5953;}})[_0x6f60('0x31')](respondWithFilteredResult(_0x214657,_0x58e545))['catch'](handleError(_0x214657,null));};exports[_0x6f60('0x53')]=function(_0x1bc1c2,_0x5281de){var _0x586fcb=getUserAttributes();_0x1bc1c2[_0x6f60('0x43')]['id']=_0x1bc1c2[_0x6f60('0x54')]['id'];var _0x2dfb77=qs[_0x6f60('0x55')](_0x586fcb,_0x1bc1c2);if(_0x1bc1c2[_0x6f60('0x43')][_0x6f60('0x41')]){_0x2dfb77[_0x6f60('0x42')]=[{'all':!![]}];}if(_0x1bc1c2['query'][_0x6f60('0x46')]===_0x6f60('0x44')){_0x2dfb77[_0x6f60('0x42')]=[{'model':db[_0x6f60('0x45')],'as':_0x6f60('0x46')}];}_0x2dfb77=_[_0x6f60('0x56')]({},_0x2dfb77,_0x1bc1c2[_0x6f60('0x57')]);if(!_[_0x6f60('0x2d')](_0x2dfb77[_0x6f60('0x47')],'id')){_0x2dfb77[_0x6f60('0x47')][_0x6f60('0x4b')]('id');}return db[_0x6f60('0x34')][_0x6f60('0x2e')](_0x2dfb77)[_0x6f60('0x31')](handleEntityNotFound(_0x5281de,null))[_0x6f60('0x31')](function(_0x4e05a4){var _0x5c3415=[];values=_0x4e05a4;if(_0x1bc1c2[_0x6f60('0x43')]['openTabs']===_0x6f60('0x44')){_0x5c3415[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4c'),_0x4e05a4[_0x6f60('0x4d')]));_0x5c3415[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4e'),_0x4e05a4[_0x6f60('0x4d')]));_0x5c3415['push'](get_open_tabs(_0x6f60('0x50'),_0x4e05a4[_0x6f60('0x4d')]));_0x5c3415[_0x6f60('0x4b')](get_open_tabs('whatsapp',_0x4e05a4[_0x6f60('0x4d')]));_0x5c3415[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x58'),_0x4e05a4[_0x6f60('0x4d')]));_0x5c3415[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4f'),_0x4e05a4[_0x6f60('0x4d')]));return Promise[_0x6f60('0x52')](_0x5c3415);}else{return values;}})[_0x6f60('0x31')](function(){return values;})[_0x6f60('0x31')](respondWithResult(_0x5281de,null))[_0x6f60('0x59')](handleError(_0x5281de,null));};exports[_0x6f60('0x1d')]=function(_0x4fcf08,_0x4622e7){if(_0x4fcf08[_0x6f60('0x5a')]['id']){delete _0x4fcf08[_0x6f60('0x5a')]['id'];}delete _0x4fcf08[_0x6f60('0x5a')][_0x6f60('0x1e')];return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x4fcf08[_0x6f60('0x54')]['id']}})['then'](handleEntityNotFound(_0x4622e7,null))['then'](saveUpdates(_0x4fcf08['body'],null))[_0x6f60('0x31')](respondWithResult(_0x4622e7,null))[_0x6f60('0x59')](handleError(_0x4622e7,null));};exports['describe']=function(_0x18e91e,_0x3a06ef){return db[_0x6f60('0x34')]['describe']()[_0x6f60('0x31')](respondWithResult(_0x3a06ef,null))[_0x6f60('0x59')](handleError(_0x3a06ef,null));};exports[_0x6f60('0x5b')]=function(_0x4e5aa2,_0x29826c){return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x4e5aa2['params']['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x29826c,null))[_0x6f60('0x31')](function(_0x261d23){if(_0x261d23){return _0x261d23[_0x6f60('0x5b')](_0x4e5aa2[_0x6f60('0x5a')]['ids'],_['omit'](_0x4e5aa2[_0x6f60('0x5a')],['ids','id'])||{});}})[_0x6f60('0x31')](respondWithResult(_0x29826c,null))[_0x6f60('0x59')](handleError(_0x29826c,null));};function validateUser(_0x42796b){return new Promise(function(_0x3efe25,_0x2b624c){if(_0x42796b[_0x6f60('0x5c')])return _0x3efe25(_0x42796b);return db[_0x6f60('0x5d')]['findById'](0x1)[_0x6f60('0x31')](function(_0x1b7400){if(_0x1b7400[_0x6f60('0x5e')])authService[_0x6f60('0x5f')](_0x42796b[_0x6f60('0x39')]);db['User']['max']('internal')[_0x6f60('0x31')](function(_0x5d8710){if(_['isNil'](_0x5d8710)){_0x42796b[_0x6f60('0x5c')]=_0x1b7400['min_internal']||0x1;return;}if(_['isNil'](_0x1b7400[_0x6f60('0x60')])||_0x1b7400[_0x6f60('0x60')]===_0x5d8710){_0x42796b[_0x6f60('0x5c')]=_0x5d8710+0x1;return;}if(_0x1b7400['min_internal']>_0x5d8710){_0x42796b[_0x6f60('0x5c')]=_0x1b7400[_0x6f60('0x60')];return;}return db[_0x6f60('0x61')]['query']('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[_0x6f60('0x61')][_0x6f60('0x62')][_0x6f60('0x63')]})['then'](function(_0x5b2be6){if(_0x5b2be6&&_0x5b2be6[_0x6f60('0x4a')]){for(var _0x2a9a22=0x0,_0x32d330=_0x5b2be6[_0x6f60('0x4a')];_0x2a9a22<_0x32d330&&_['isNil'](_0x42796b['internal']);_0x2a9a22++){if(_0x1b7400[_0x6f60('0x60')]<=_0x5b2be6[_0x2a9a22][_0x6f60('0x64')]){_0x42796b['internal']=_0x5b2be6[_0x2a9a22][_0x6f60('0x64')];}else if(_0x1b7400[_0x6f60('0x60')]>_0x5b2be6[_0x2a9a22][_0x6f60('0x64')]&&_0x1b7400['min_internal']<=_0x5b2be6[_0x2a9a22]['to']){_0x42796b[_0x6f60('0x5c')]=_0x1b7400['min_internal'];}}}if(_['isNil'](_0x42796b[_0x6f60('0x5c')])){_0x42796b[_0x6f60('0x5c')]=_0x5d8710+0x1;}return _0x3efe25(_0x42796b);});});})[_0x6f60('0x59')](function(_0x49c938){_0x2b624c(_0x49c938);});});}function updateUser(_0x5730a8){return new Promise(function(_0x48520d,_0x4238a9){try{if(_0x5730a8['voicemail']){_0x5730a8[_0x6f60('0x65')]=_0x5730a8[_0x6f60('0x5c')];_0x5730a8[_0x6f60('0x66')]={'mailbox':_0x5730a8[_0x6f60('0x5c')],'password':_0x5730a8[_0x6f60('0x39')],'fullname':_0x5730a8[_0x6f60('0x67')],'email':_0x5730a8[_0x6f60('0x68')]};}if(_0x5730a8[_0x6f60('0x1e')]===_0x6f60('0x1f')){if(!_0x5730a8[_0x6f60('0x69')])_0x5730a8['permissions']=[_0x6f60('0x6a'),_0x6f60('0x6b'),_0x6f60('0x6c'),_0x6f60('0x6d'),_0x6f60('0x6e'),_0x6f60('0x6f'),_0x6f60('0x70'),_0x6f60('0x71'),_0x6f60('0x72'),'108',_0x6f60('0x73'),_0x6f60('0x74'),'111','114',_0x6f60('0x75')];}_0x48520d(_0x5730a8);}catch(_0x5cb40d){_0x4238a9(_0x5cb40d);}});}exports['create']=function(_0x5847c9,_0x36f461){if(_0x5847c9[_0x6f60('0x26')]['role']===_0x6f60('0x1f'))throw new Error(_0x6f60('0x76'));if(_0x5847c9[_0x6f60('0x5a')][_0x6f60('0x1e')]===_0x6f60('0x26')&&_0x5847c9[_0x6f60('0x26')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5847c9[_0x6f60('0x5a')][_0x6f60('0x1e')]===_0x6f60('0x24')&&_0x5847c9[_0x6f60('0x26')][_0x6f60('0x1e')]!==_0x6f60('0x24')){throw new Error(_0x6f60('0x77'));}return licenseUtil[_0x6f60('0x78')]([_0x5847c9['body']])[_0x6f60('0x31')](function(){return validateUser(_0x5847c9[_0x6f60('0x5a')]);})[_0x6f60('0x31')](function(_0x337825){return updateUser(_0x337825)[_0x6f60('0x31')](function(_0x38e679){if(_0x38e679[_0x6f60('0x1e')]===_0x6f60('0x24')){_0x38e679[_0x6f60('0x79')]=_0x5847c9[_0x6f60('0x26')]['settingsEnabled'];delete _0x38e679[_0x6f60('0x7a')];}return _0x38e679;});})['then'](function(_0x168b41){return db[_0x6f60('0x34')][_0x6f60('0x7b')](_0x168b41,{'include':[{'model':db['VoiceMail'],'as':_0x6f60('0x66')}]});})['then'](function(_0x73d5c3){if(_0x5847c9[_0x6f60('0x5a')]['role']==='user')return _0x73d5c3;if(_0x5847c9[_0x6f60('0x26')][_0x6f60('0x1e')]!==_0x6f60('0x26'))return _0x73d5c3;return db[_0x6f60('0x7c')][_0x6f60('0x2e')]({'where':{'name':_0x73d5c3[_0x6f60('0x1e')]===_0x6f60('0x1f')?_0x6f60('0x27'):_0x6f60('0x28'),'userProfileId':_0x5847c9[_0x6f60('0x26')][_0x6f60('0x7a')]},'raw':!![]})[_0x6f60('0x31')](function(_0x350a9c){if(!_0x350a9c||_0x350a9c['autoAssociation']!=0x0)return _0x73d5c3;return db[_0x6f60('0x30')][_0x6f60('0x7b')]({'name':_0x73d5c3[_0x6f60('0x2f')],'resourceId':_0x73d5c3['id'],'type':_0x350a9c[_0x6f60('0x2f')],'sectionId':_0x350a9c['id']},{})[_0x6f60('0x31')](function(){return _0x73d5c3;});})['catch'](function(_0x330976){logger[_0x6f60('0x7d')](_0x6f60('0x7e'),_0x330976);throw _0x330976;});})[_0x6f60('0x31')](respondWithResult(_0x36f461,0xc9))['catch'](handleError(_0x36f461,null));};exports['bulkCreate']=function(_0x1b3732,_0x3f242a){var _0x4bd38b=_0x1b3732[_0x6f60('0x5a')];var _0x17fb77=[];if(_0x1b3732[_0x6f60('0x26')][_0x6f60('0x1e')]===_0x6f60('0x1f'))throw new Error(_0x6f60('0x76'));if(_[_0x6f60('0x7f')](_0x4bd38b,[_0x6f60('0x1e'),'user'])&&_0x1b3732[_0x6f60('0x26')]['role']!==_0x6f60('0x24')){throw new Error(_0x6f60('0x80'));}if(_[_0x6f60('0x7f')](_0x4bd38b,[_0x6f60('0x1e'),_0x6f60('0x24')])&&_0x1b3732[_0x6f60('0x26')][_0x6f60('0x1e')]!==_0x6f60('0x24')){throw new Error(_0x6f60('0x81'));}return licenseUtil[_0x6f60('0x78')](_0x4bd38b)[_0x6f60('0x31')](function(){return validateUser(_0x4bd38b[0x0]);})[_0x6f60('0x31')](function(){for(var _0x13a31e=0x1;_0x13a31e<_0x4bd38b[_0x6f60('0x4a')];_0x13a31e++){var _0x359da7=_0x4bd38b[_0x13a31e-0x1][_0x6f60('0x5c')];if(!_0x4bd38b[_0x13a31e][_0x6f60('0x5c')])_0x4bd38b[_0x13a31e][_0x6f60('0x5c')]=_0x359da7+0x1;_0x17fb77[_0x6f60('0x4b')](validateUser(_0x4bd38b[_0x13a31e]));}return Promise[_0x6f60('0x52')](_0x17fb77);})[_0x6f60('0x31')](function(){_0x17fb77=[];for(var _0x1bb3a5=0x0;_0x1bb3a5<_0x4bd38b[_0x6f60('0x4a')];_0x1bb3a5++){_0x17fb77[_0x6f60('0x4b')](updateUser(_0x4bd38b[_0x1bb3a5]));}return Promise['all'](_0x17fb77);})[_0x6f60('0x31')](function(){_0x17fb77=_0x4bd38b['map'](function(_0x10f2be){return db['User'][_0x6f60('0x7b')](_0x10f2be,{'include':[{'model':db[_0x6f60('0x66')],'as':'VoiceMail'}]})['then'](function(_0x2dfd43){_0x10f2be['id']=_0x2dfd43['id'];return _0x10f2be;});});return Promise[_0x6f60('0x52')](_0x17fb77);})[_0x6f60('0x31')](function(_0xcde70b){if(_0x1b3732[_0x6f60('0x5a')][_0x6f60('0x1e')]===_0x6f60('0x26'))return _0xcde70b;if(_0x1b3732['user'][_0x6f60('0x1e')]!==_0x6f60('0x26'))return _0xcde70b;var _0x11ad68=_[_0x6f60('0x7f')](_0xcde70b,function(_0x423374){return _0x423374['role']===_0x6f60('0x1f')||_0x423374[_0x6f60('0x1e')]===_0x6f60('0x82');});if(!_0x11ad68)return _0xcde70b;return db[_0x6f60('0x7c')][_0x6f60('0x48')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x1b3732[_0x6f60('0x26')][_0x6f60('0x7a')]},'raw':!![]})[_0x6f60('0x31')](function(_0x4cf678){if(_[_0x6f60('0x83')](_0x4cf678)||!_[_0x6f60('0x7f')](_0x4cf678,[_0x6f60('0x84'),0x0]))return _0xcde70b;_0x17fb77=[];var _0x326ea1=_(_0x4cf678)['map'](function(_0x5594cf){if(_0x5594cf[_0x6f60('0x84')]===0x1)return;return _0x5594cf[_0x6f60('0x2f')]===_0x6f60('0x27')?'agent':'telephone';})[_0x6f60('0x85')]()[_0x6f60('0x2c')]();for(var _0x2dbdb9=0x0;_0x2dbdb9<_0xcde70b[_0x6f60('0x4a')];_0x2dbdb9++){if(!_['includes'](_0x326ea1,_0xcde70b[_0x2dbdb9][_0x6f60('0x1e')]))return;var _0x3b6a8d=_0xcde70b[_0x2dbdb9]['role']==='agent'?_0x6f60('0x27'):'Telephones';_0x17fb77[_0x6f60('0x4b')](db['UserProfileResource'][_0x6f60('0x7b')]({'name':_0xcde70b[_0x2dbdb9][_0x6f60('0x2f')],'resourceId':_0xcde70b[_0x2dbdb9]['id'],'type':_0x3b6a8d,'sectionId':_[_0x6f60('0x2e')](_0x4cf678,[_0x6f60('0x2f'),_0x3b6a8d])['id']},{}));}return Promise[_0x6f60('0x52')](_0x17fb77);});})['then'](respondWithResult(_0x3f242a,0xc9))[_0x6f60('0x59')](handleError(_0x3f242a,null));};exports[_0x6f60('0x86')]=function(_0x35a291,_0x2ff07f){if(_0x35a291[_0x6f60('0x5a')]['id']){delete _0x35a291['body']['id'];}return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x35a291[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](function(_0x5a0dbd){if(!_0x5a0dbd)return null;if(_0x5a0dbd['id']===_0x35a291[_0x6f60('0x26')]['id']){if(!_0x35a291[_0x6f60('0x5a')][_0x6f60('0x87')]||!_0x35a291['body'][_0x6f60('0x88')]){throw new db[(_0x6f60('0x89'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5a0dbd[_0x6f60('0x8a')](_0x35a291[_0x6f60('0x5a')]['oldPassword'])){throw new db[(_0x6f60('0x89'))][(_0x6f60('0x8b'))](_0x6f60('0x8c'));}if(_0x35a291[_0x6f60('0x5a')][_0x6f60('0x87')]===_0x35a291[_0x6f60('0x5a')]['newPassword']){throw new db[(_0x6f60('0x89'))]['ValidationError'](_0x6f60('0x8d'));}}else if(_0x35a291[_0x6f60('0x26')][_0x6f60('0x1e')]===_0x6f60('0x24')){if(!_0x35a291[_0x6f60('0x5a')]['newPassword']){throw new db[(_0x6f60('0x89'))]['ValidationError'](_0x6f60('0x8e'));}}else if(_0x35a291['user'][_0x6f60('0x1e')]===_0x6f60('0x26')){if(!_0x35a291[_0x6f60('0x5a')][_0x6f60('0x88')]){throw new db['Sequelize'][(_0x6f60('0x8b'))](_0x6f60('0x8e'));}if(_0x5a0dbd[_0x6f60('0x1e')]!==_0x6f60('0x1f')){throw new db[(_0x6f60('0x89'))]['ValidationError'](_0x6f60('0x76'));}}else{throw new db[(_0x6f60('0x89'))][(_0x6f60('0x8b'))]('Unauthorized');}return _0x5a0dbd;})[_0x6f60('0x31')](handleEntityNotFound(_0x2ff07f,null))['then'](function(_0x13d8a6){return db['Setting'][_0x6f60('0x8f')]({'attributes':['id','securePassword',_0x6f60('0x90'),_0x6f60('0x91')]})['then'](function(_0x541dc1){if(_0x541dc1[_0x6f60('0x5e')])authService[_0x6f60('0x5f')](_0x35a291[_0x6f60('0x5a')][_0x6f60('0x88')]);if(!_0x541dc1['enforcePasswordHistory']||!_0x13d8a6[_0x6f60('0x3b')])return _0x13d8a6;authService['validatePasswordHistory'](_0x35a291[_0x6f60('0x5a')][_0x6f60('0x88')],_0x13d8a6[_0x6f60('0x3b')],_0x541dc1['passwordHistoryLimit']);return _0x13d8a6;})[_0x6f60('0x31')](saveUpdates({'password':_0x35a291[_0x6f60('0x5a')][_0x6f60('0x88')],'passwordResetAt':_0x35a291[_0x6f60('0x26')]['id']==_0x35a291['params']['id']?moment():null,'previousPasswords':authService[_0x6f60('0x92')](_0x35a291[_0x6f60('0x5a')][_0x6f60('0x88')],_0x13d8a6[_0x6f60('0x3b')])},null));})[_0x6f60('0x31')](respondWithResult(_0x2ff07f,null))[_0x6f60('0x59')](handleError(_0x2ff07f,null));};exports[_0x6f60('0x93')]=function(_0x3e6bbd,_0x2801c3){var _0x48118d=_0x3e6bbd['body'][_0x6f60('0x94')];return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x3e6bbd['params']['id']},'attributes':['id',_0x6f60('0x2f'),_0x6f60('0x1e'),_0x6f60('0x95'),_0x6f60('0x96'),_0x6f60('0x97'),_0x6f60('0x98')]})[_0x6f60('0x31')](handleEntityNotFound(_0x2801c3,null))[_0x6f60('0x31')](function(_0x255243){if(_0x255243){if(!utils[_0x6f60('0x99')](_0x48118d)){throw new db[(_0x6f60('0x89'))][(_0x6f60('0x8b'))](_0x6f60('0x9a'));}return _0x255243[_0x6f60('0x9b')+_['capitalize'](_0x48118d[_0x6f60('0x9c')]())+'Queues'](_0x3e6bbd[_0x6f60('0x5a')][_0x6f60('0x9d')],{'penalty':_0x3e6bbd['body'][_0x6f60('0x9e')]||0x0})['spread'](function(_0x5a817f){for(var _0x1ff7ea=0x0;_0x1ff7ea<_0x3e6bbd[_0x6f60('0x5a')]['ids']['length'];_0x1ff7ea+=0x1){var _0x1fec8b={'UserId':Number(_0x3e6bbd['params']['id'])};_0x1fec8b[_[_0x6f60('0x9f')](_0x48118d[_0x6f60('0x9c')]())+_0x6f60('0xa0')]=Number(_0x3e6bbd['body'][_0x6f60('0x9d')][_0x1ff7ea]);socket[_0x6f60('0x20')]('user'+_['capitalize'](_0x48118d[_0x6f60('0x9c')]())+_0x6f60('0xa1'),_0x1fec8b);}return _0x5a817f;})[_0x6f60('0x31')](function(){if(_0x48118d===_0x6f60('0xa2')){return db['VoiceQueue'][_0x6f60('0x48')]({'where':{'id':_0x3e6bbd[_0x6f60('0x5a')][_0x6f60('0x9d')]||[]},'raw':!![],'attributes':['id',_0x6f60('0x2f')]});}})['then'](function(_0x4aa65f){var _0x3790d2=_0x255243['get']({'plain':!![]});var _0x637b15=[];if(_0x48118d===_0x6f60('0xa2')&&_0x3790d2[_0x6f60('0x1e')]===_0x6f60('0x1f')&&_0x3790d2[_0x6f60('0x95')]){for(let _0x3e16d0=0x0;_0x3e16d0<_0x4aa65f[_0x6f60('0x4a')];_0x3e16d0+=0x1){_0x637b15[_0x6f60('0x4b')]({'membername':_0x3790d2[_0x6f60('0x2f')],'UserId':_0x3790d2['id'],'queue_name':_0x4aa65f[_0x3e16d0]['name'],'VoiceQueueId':_0x4aa65f[_0x3e16d0]['id'],'interface':_[_0x6f60('0xa3')](_0x3790d2[_0x6f60('0x98')])?util[_0x6f60('0xa4')](_0x6f60('0xa5'),_0x3790d2[_0x6f60('0x2f')]):_0x3790d2[_0x6f60('0x98')],'paused':_0x3790d2[_0x6f60('0x97')]||![],'penalty':_0x3e6bbd[_0x6f60('0x5a')][_0x6f60('0x9e')]||0x0});}return Promise[_0x6f60('0x52')](_0x637b15[_0x6f60('0x2b')](function(_0x53488a){return db[_0x6f60('0xa6')][_0x6f60('0xa7')](_0x53488a);}));}return _0x255243;});}})[_0x6f60('0x31')](respondWithStatusCode(_0x2801c3,null))[_0x6f60('0x59')](handleError(_0x2801c3,null));};exports[_0x6f60('0xa8')]=function(_0x364d6c,_0x525c15){var _0x70fa0d,_0x122045;return db[_0x6f60('0x34')]['find']({'where':{'id':_0x364d6c[_0x6f60('0x54')]['id']},'attributes':['id','name',_0x6f60('0x1e')]})[_0x6f60('0x31')](handleEntityNotFound(_0x525c15,null))[_0x6f60('0x31')](function(_0xa8df8){if(_0xa8df8){_0x70fa0d=_0xa8df8;if(!_0x364d6c[_0x6f60('0x43')]['channel']||!utils[_0x6f60('0x99')](_0x364d6c[_0x6f60('0x43')]['channel'])){throw new db['Sequelize'][(_0x6f60('0x8b'))](_0x6f60('0x9a'));}return _0xa8df8[_0x6f60('0xa9')+_[_0x6f60('0x9f')](_0x364d6c[_0x6f60('0x43')][_0x6f60('0x94')]['toLowerCase']())+'Queues'](_0x364d6c['query']['ids']);}})[_0x6f60('0x31')](function(_0x1d4230){if(_['isArray'](_0x364d6c['query'][_0x6f60('0x9d')])){for(var _0x1276a5=0x0;_0x1276a5<_0x364d6c['query']['ids'][_0x6f60('0x4a')];_0x1276a5+=0x1){_0x122045={'UserId':Number(_0x364d6c[_0x6f60('0x54')]['id'])};_0x122045[_[_0x6f60('0x9f')](_0x364d6c[_0x6f60('0x43')][_0x6f60('0x94')][_0x6f60('0x9c')]())+_0x6f60('0xa0')]=Number(_0x364d6c[_0x6f60('0x43')][_0x6f60('0x9d')][_0x1276a5]);socket[_0x6f60('0x20')](_0x6f60('0x26')+_[_0x6f60('0x9f')](_0x364d6c[_0x6f60('0x43')]['channel']['toLowerCase']())+_0x6f60('0xaa'),_0x122045);}}else{_0x122045={'UserId':Number(_0x364d6c['params']['id'])};_0x122045[_[_0x6f60('0x9f')](_0x364d6c['query']['channel']['toLowerCase']())+_0x6f60('0xa0')]=Number(_0x364d6c[_0x6f60('0x43')][_0x6f60('0x9d')]);socket[_0x6f60('0x20')](_0x6f60('0x26')+_[_0x6f60('0x9f')](_0x364d6c[_0x6f60('0x43')][_0x6f60('0x94')][_0x6f60('0x9c')]())+_0x6f60('0xaa'),_0x122045);}return _0x1d4230;})[_0x6f60('0x31')](function(){if(_0x364d6c[_0x6f60('0x43')]['channel']===_0x6f60('0xa2')){return db['UserVoiceQueueRt'][_0x6f60('0x22')]({'where':{'UserId':_0x364d6c[_0x6f60('0x54')]['id'],'VoiceQueueId':_0x364d6c[_0x6f60('0x43')][_0x6f60('0x9d')]},'individualHooks':!![]})[_0x6f60('0x31')](function(){return _0x70fa0d;});}return _0x70fa0d;})[_0x6f60('0x31')](respondWithStatusCode(_0x525c15,null))[_0x6f60('0x59')](handleError(_0x525c15,null));};exports[_0x6f60('0xab')]=function(_0x3239f5,_0x454826){_0x3239f5[_0x6f60('0x5a')][_0x6f60('0xac')]=_0x3239f5[_0x6f60('0xad')][_0x6f60('0xae')];return db['User']['find']({'where':{'id':_0x3239f5[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x454826,null))[_0x6f60('0x31')](saveUpdates(_0x3239f5[_0x6f60('0x5a')],null))['then'](respondWithResult(_0x454826,null))[_0x6f60('0x59')](handleError(_0x454826,null));};exports[_0x6f60('0xaf')]=function(_0x445c9e,_0x36d0ac){var _0x115c67=path[_0x6f60('0xb0')](config['root'],_0x6f60('0xb1'));return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x445c9e['params']['id']},'attributes':['id',_0x6f60('0xac')],'raw':!![]})['then'](handleEntityNotFound(_0x36d0ac,null))['then'](function(_0x5e3f02){if(_0x5e3f02){if(_[_0x6f60('0xa3')](_0x5e3f02[_0x6f60('0xac')])){return _0x36d0ac[_0x6f60('0xb2')](_0x115c67);}else{if(!fs[_0x6f60('0xb3')](path[_0x6f60('0xb0')](config['root'],_0x6f60('0xb4'),_0x5e3f02[_0x6f60('0xac')]))){return _0x36d0ac[_0x6f60('0xb2')](_0x115c67);}return _0x36d0ac[_0x6f60('0xb2')](path[_0x6f60('0xb0')](config[_0x6f60('0xb5')],'server/files/images/',_0x5e3f02[_0x6f60('0xac')]));}}})[_0x6f60('0x59')](handleError(_0x36d0ac,null));};exports[_0x6f60('0xb6')]=function(_0x2ef0f3,_0x4aebe6){return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x2ef0f3[_0x6f60('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4aebe6,null))['then'](function(_0x3b73f2){var _0x1d283f=[];values=_0x3b73f2[_0x6f60('0x4d')];_0x1d283f[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4c'),_0x3b73f2[_0x6f60('0x4d')]));_0x1d283f[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4e'),_0x3b73f2[_0x6f60('0x4d')]));_0x1d283f['push'](get_open_tabs(_0x6f60('0x50'),_0x3b73f2[_0x6f60('0x4d')]));_0x1d283f['push'](get_open_tabs(_0x6f60('0x51'),_0x3b73f2['dataValues']));_0x1d283f[_0x6f60('0x4b')](get_open_tabs('fax',_0x3b73f2[_0x6f60('0x4d')]));_0x1d283f[_0x6f60('0x4b')](get_open_tabs(_0x6f60('0x4f'),_0x3b73f2[_0x6f60('0x4d')]));return Promise[_0x6f60('0x52')](_0x1d283f);})['then'](function(_0x30fb47){if(_0x30fb47){var _0x2832fe=_['map'](values['ChatOpenTabs'],function(_0x13e903){return{'channel':_0x6f60('0xb7'),'id':_0x13e903['id'],'createdAt':_0x13e903[_0x6f60('0xb8')]};});var _0x314765=_[_0x6f60('0x2b')](values[_0x6f60('0xb9')],function(_0x27f1c3){return{'channel':_0x6f60('0xba'),'id':_0x27f1c3['id'],'createdAt':_0x27f1c3['createdAt']};});var _0x33db31=_[_0x6f60('0x2b')](values[_0x6f60('0xbb')],function(_0x490462){return{'channel':'OPENCHANNEL','id':_0x490462['id'],'createdAt':_0x490462[_0x6f60('0xb8')]};});var _0x59ceda=_['map'](values[_0x6f60('0xbc')],function(_0xfa28c3){return{'channel':_0x6f60('0xbd'),'id':_0xfa28c3['id'],'createdAt':_0xfa28c3[_0x6f60('0xb8')]};});var _0x31d977=_[_0x6f60('0x2b')](values[_0x6f60('0xbe')],function(_0x36be33){return{'channel':_0x6f60('0xbf'),'id':_0x36be33['id'],'createdAt':_0x36be33[_0x6f60('0xb8')]};});var _0x737378=_[_0x6f60('0x2b')](values['WhatsappOpenTabs'],function(_0x4c6db2){return{'channel':_0x6f60('0xc0'),'id':_0x4c6db2['id'],'createdAt':_0x4c6db2[_0x6f60('0xb8')]};});var _0x3a2721=_[_0x6f60('0xc1')](_0x2832fe,_0x314765,_0x33db31,_0x59ceda,_0x31d977,_0x737378);var _0x5c09b3={'count':_0x3a2721[_0x6f60('0x4a')],'rows':_0x3a2721};return _0x5c09b3;}else return null;})['then'](respondWithResult(_0x4aebe6,null))[_0x6f60('0x59')](handleError(_0x4aebe6,null));};exports[_0x6f60('0xc2')]=function(_0x42572a,_0x2a1459){var _0x22b68f={};return db['User']['findOne']({'where':{'id':_0x42572a[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](function(_0x558f4b){if(!_0x558f4b){throw new APINotFoundError(util[_0x6f60('0xa4')](_0x6f60('0xc3'),_0x42572a[_0x6f60('0x54')]['id']));}return contacts['describe']();})[_0x6f60('0x31')](function(_0x5e74c0){_0x42572a[_0x6f60('0x43')][_0x6f60('0x34')]=_0x42572a[_0x6f60('0x54')]['id'];_0x22b68f=qs['getOptions'](_0x5e74c0,_0x42572a);if(_0x42572a['query'][_0x6f60('0xc4')](_0x6f60('0x41'))){_0x22b68f['include']=[{'model':db['CmList'],'as':_0x6f60('0xc5'),'required':![]},{'model':db['Tag'],'as':_0x6f60('0xc6'),'attributes':['id',_0x6f60('0x2f'),_0x6f60('0xc7')],'where':_0x42572a['query'][_0x6f60('0xc8')]?{'id':_0x42572a[_0x6f60('0x43')][_0x6f60('0xc8')]}:undefined,'required':_0x42572a[_0x6f60('0x43')][_0x6f60('0xc8')]?!![]:![]}];}return contacts[_0x6f60('0x48')](_0x42572a[_0x6f60('0x43')],_0x42572a[_0x6f60('0x26')],_0x22b68f,_0x5e74c0);})['then'](respondWithFilteredResult(_0x2a1459,_0x22b68f))['catch'](APIHandleError(_0x2a1459));};exports[_0x6f60('0xc9')]=function(_0xc0fb52,_0x28b83d){var _0x3c5fb1;var _0x233f15={};var _0x4f9c65;return db[_0x6f60('0x34')]['findOne']({'where':{'id':_0xc0fb52[_0x6f60('0x54')]['id']},'attributes':['id',_0x6f60('0x2f'),_0x6f60('0x1e')]})[_0x6f60('0x31')](handleEntityNotFound(_0x28b83d,null))[_0x6f60('0x31')](function(_0x18199b){if(!utils['isValidChannel'](_0xc0fb52[_0x6f60('0x43')]['channel'])){throw new db[(_0x6f60('0x89'))]['ValidationError'](_0x6f60('0x9a'));}_0x3c5fb1=_0x18199b;var _0x15fd93={};_0x15fd93['model']=_['keys'](db[_[_0x6f60('0x9f')](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0x94')])+'Queue'][_0x6f60('0x35')]);_0x15fd93[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0xc0fb52[_0x6f60('0x43')]);_0x15fd93[_0x6f60('0xcb')]=_['intersection'](_0x15fd93[_0x6f60('0xcc')],_0x15fd93[_0x6f60('0x43')]);_0x233f15[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x15fd93[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0xce')]));_0x233f15[_0x6f60('0x47')]=_0x233f15[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x233f15[_0x6f60('0x47')]:_0x15fd93[_0x6f60('0xcc')];_0x233f15[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x233f15[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_['pick'](_0xc0fb52['query'],_0x15fd93[_0x6f60('0xcb')]));if(_0xc0fb52['query'][_0x6f60('0x29')]){_0x233f15[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x233f15[_0x6f60('0x40')],{'$or':_['map'](_0x233f15['attributes'],function(_0x336f65){var _0x581621={};_0x581621[_0x336f65]={'$like':'%'+_0xc0fb52[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x581621;})});}_0x233f15=_[_0x6f60('0x56')]({},_0x233f15,_0xc0fb52['options']);switch(_0x3c5fb1[_0x6f60('0x1e')]){case _0x6f60('0x24'):return db[_[_0x6f60('0x9f')](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0x94')])+_0x6f60('0xd1')][_0x6f60('0x48')](_0x233f15);case'user':case _0x6f60('0x1f'):return _0x3c5fb1[_0x6f60('0x23')+_['capitalize'](_0xc0fb52[_0x6f60('0x43')]['channel'])+_0x6f60('0xd2')](_0x233f15);default:throw new db[(_0x6f60('0x89'))][(_0x6f60('0x8b'))]('Unknown\x20role');}})[_0x6f60('0x31')](function(_0x29f258){_0x4f9c65=_0x29f258[_0x6f60('0x4a')];if(!_0xc0fb52[_0x6f60('0x43')][_0x6f60('0xc4')]('nolimit')){_0x233f15[_0x6f60('0x19')]=qs['limit'](_0xc0fb52['query'][_0x6f60('0x19')]);_0x233f15[_0x6f60('0x17')]=qs['offset'](_0xc0fb52['query'][_0x6f60('0x17')]);}switch(_0x3c5fb1[_0x6f60('0x1e')]){case _0x6f60('0x24'):return db[_[_0x6f60('0x9f')](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0x94')])+'Queue'][_0x6f60('0x48')](_0x233f15);case _0x6f60('0x26'):case _0x6f60('0x1f'):return _0x3c5fb1['get'+_['capitalize'](_0xc0fb52[_0x6f60('0x43')][_0x6f60('0x94')])+_0x6f60('0xd2')](_0x233f15);}})[_0x6f60('0x31')](function(_0x36a76a){return{'count':_0x4f9c65,'rows':_0x36a76a};})[_0x6f60('0x31')](respondWithResult(_0x28b83d,null))[_0x6f60('0x59')](handleError(_0x28b83d,null));};exports[_0x6f60('0xd3')]=function(_0x3d8ad7,_0x2a36ed){var _0x30388a={};var _0x1102ef={};var _0x4faaf1;var _0x151b73;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x3d8ad7[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x2a36ed,null))[_0x6f60('0x31')](function(_0xe22b93){if(_0xe22b93){_0x4faaf1=_0xe22b93;_0x1102ef[_0x6f60('0xcc')]=_[_0x6f60('0xca')](db[_0x6f60('0xa6')][_0x6f60('0x35')]);_0x1102ef[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x3d8ad7[_0x6f60('0x43')]);_0x1102ef[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x1102ef[_0x6f60('0xcc')],_0x1102ef['query']);_0x30388a[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x1102ef[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x3d8ad7[_0x6f60('0x43')][_0x6f60('0xce')]));_0x30388a[_0x6f60('0x47')]=_0x30388a[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x30388a['attributes']:_0x1102ef[_0x6f60('0xcc')];_0x30388a[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x3d8ad7['query'][_0x6f60('0xd0')]);_0x30388a[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x3d8ad7['query'],_0x1102ef[_0x6f60('0xcb')]));if(_0x3d8ad7[_0x6f60('0x43')]['filter']){_0x30388a[_0x6f60('0x40')]=_['merge'](_0x30388a[_0x6f60('0x40')],{'$or':_['map'](_0x30388a['attributes'],function(_0x1d0ea1){var _0x1c560d={};_0x1c560d[_0x1d0ea1]={'$like':'%'+_0x3d8ad7[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x1c560d;})});}_0x30388a=_[_0x6f60('0x56')]({},_0x30388a,_0x3d8ad7[_0x6f60('0x57')]);return _0x4faaf1[_0x6f60('0xd3')](_0x30388a);}})[_0x6f60('0x31')](function(_0x3490e1){if(_0x3490e1){_0x151b73=_0x3490e1[_0x6f60('0x4a')];if(!_0x3d8ad7['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x30388a[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x3d8ad7[_0x6f60('0x43')][_0x6f60('0x19')]);_0x30388a['offset']=qs[_0x6f60('0x17')](_0x3d8ad7[_0x6f60('0x43')][_0x6f60('0x17')]);}return _0x4faaf1['getVoiceQueuesRt'](_0x30388a);}})[_0x6f60('0x31')](function(_0x1e8747){if(_0x1e8747){return _0x1e8747?{'count':_0x151b73,'rows':_0x1e8747}:null;}})['then'](respondWithResult(_0x2a36ed,null))[_0x6f60('0x59')](handleError(_0x2a36ed,null));};exports[_0x6f60('0xd6')]=function(_0x2be420,_0x56ad77){var _0x9a79c5={};var _0x24c31f={};var _0x4037ba;var _0x8e354;return db['User'][_0x6f60('0x8f')]({'where':{'id':_0x2be420[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x56ad77,null))[_0x6f60('0x31')](function(_0x4f71f1){if(_0x4f71f1){_0x4037ba=_0x4f71f1;_0x24c31f[_0x6f60('0xcc')]=_['keys'](db[_0x6f60('0xd7')]['rawAttributes']);_0x24c31f[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x2be420[_0x6f60('0x43')]);_0x24c31f[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x24c31f[_0x6f60('0xcc')],_0x24c31f[_0x6f60('0x43')]);_0x9a79c5[_0x6f60('0x47')]=_['intersection'](_0x24c31f[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x2be420[_0x6f60('0x43')]['fields']));_0x9a79c5[_0x6f60('0x47')]=_0x9a79c5['attributes']['length']?_0x9a79c5[_0x6f60('0x47')]:_0x24c31f['model'];_0x9a79c5[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x2be420[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x9a79c5['where']=qs['filters'](_[_0x6f60('0xd4')](_0x2be420[_0x6f60('0x43')],_0x24c31f[_0x6f60('0xcb')]));if(_0x2be420[_0x6f60('0x43')][_0x6f60('0x29')]){_0x9a79c5[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x9a79c5['where'],{'$or':_[_0x6f60('0x2b')](_0x9a79c5[_0x6f60('0x47')],function(_0x53c6ee){var _0x4a933b={};_0x4a933b[_0x53c6ee]={'$like':'%'+_0x2be420[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x4a933b;})});}_0x9a79c5=_[_0x6f60('0x56')]({},_0x9a79c5,_0x2be420[_0x6f60('0x57')]);return _0x4037ba[_0x6f60('0xd6')](_0x9a79c5);}})['then'](function(_0x4fee79){if(_0x4fee79){_0x8e354=_0x4fee79[_0x6f60('0x4a')];if(!_0x2be420[_0x6f60('0x43')][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x9a79c5[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x2be420[_0x6f60('0x43')]['limit']);_0x9a79c5[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x2be420[_0x6f60('0x43')][_0x6f60('0x17')]);}return _0x4037ba[_0x6f60('0xd6')](_0x9a79c5);}})[_0x6f60('0x31')](function(_0x3616eb){if(_0x3616eb){return _0x3616eb?{'count':_0x8e354,'rows':_0x3616eb}:null;}})[_0x6f60('0x31')](respondWithResult(_0x56ad77,null))['catch'](handleError(_0x56ad77,null));};exports[_0x6f60('0xd8')]=function(_0x44d18c,_0x479714){var _0x224ae9={'raw':!![],'where':{}};var _0x653962={};var _0x25b33f={'count':0x0,'rows':[]};return db['User'][_0x6f60('0x8f')]({'where':{'id':_0x44d18c[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x479714,null))[_0x6f60('0x31')](function(_0x95d9b1){if(_0x95d9b1){_0x653962['model']=_[_0x6f60('0xca')](db[_0x6f60('0xd9')][_0x6f60('0x35')]);_0x653962[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x44d18c['query']);_0x653962[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x653962[_0x6f60('0xcc')],_0x653962['query']);_0x224ae9['attributes']=_[_0x6f60('0xcd')](_0x653962[_0x6f60('0xcc')],qs['fields'](_0x44d18c['query'][_0x6f60('0xce')]));_0x224ae9['attributes']=_0x224ae9[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x224ae9[_0x6f60('0x47')]:_0x653962['model'];if(!_0x44d18c['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x224ae9[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x44d18c[_0x6f60('0x43')][_0x6f60('0x19')]);_0x224ae9[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x44d18c['query'][_0x6f60('0x17')]);}_0x224ae9['order']=qs[_0x6f60('0xd0')](_0x44d18c['query'][_0x6f60('0xd0')]);_0x224ae9[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x44d18c[_0x6f60('0x43')],_0x653962[_0x6f60('0xcb')]));_0x224ae9['where'][_0x6f60('0xda')]=_0x95d9b1['id'];if(_0x44d18c[_0x6f60('0x43')][_0x6f60('0x29')]){_0x224ae9[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x224ae9[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x224ae9[_0x6f60('0x47')],function(_0xd9aa96){var _0xda23bf={};_0xda23bf[_0xd9aa96]={'$like':'%'+_0x44d18c[_0x6f60('0x43')]['filter']+'%'};return _0xda23bf;})});}_0x224ae9=_['merge']({},_0x224ae9,_0x44d18c['options']);return db['VoiceRecording'][_0x6f60('0x1a')]({'where':_0x224ae9['where']})[_0x6f60('0x31')](function(_0x4336aa){_0x25b33f[_0x6f60('0x1a')]=_0x4336aa;if(_0x44d18c[_0x6f60('0x43')][_0x6f60('0x41')]){_0x224ae9['include']=[{'all':!![]}];}return db[_0x6f60('0xd9')][_0x6f60('0x48')](_0x224ae9);})['then'](function(_0x5b4aae){_0x25b33f[_0x6f60('0x49')]=_0x5b4aae;return _0x25b33f;});}})[_0x6f60('0x31')](respondWithFilteredResult(_0x479714,_0x224ae9))['catch'](handleError(_0x479714,null));};exports[_0x6f60('0xdb')]=function(_0x464c2d,_0x31ef0c){var _0x2b854c={'raw':!![],'where':{}};var _0xa74829={};var _0x3b00d3={'count':0x0,'rows':[]};return db[_0x6f60('0x34')]['findOne']({'where':{'id':_0x464c2d['params']['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x31ef0c,null))[_0x6f60('0x31')](function(_0x26775e){if(_0x26775e){_0xa74829[_0x6f60('0xcc')]=_['keys'](db[_0x6f60('0xdc')][_0x6f60('0x35')]);_0xa74829[_0x6f60('0x43')]=_['keys'](_0x464c2d[_0x6f60('0x43')]);_0xa74829[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0xa74829[_0x6f60('0xcc')],_0xa74829[_0x6f60('0x43')]);_0x2b854c[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0xa74829[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x464c2d[_0x6f60('0x43')][_0x6f60('0xce')]));_0x2b854c[_0x6f60('0x47')]=_0x2b854c[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x2b854c[_0x6f60('0x47')]:_0xa74829[_0x6f60('0xcc')];if(!_0x464c2d['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x2b854c[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x464c2d[_0x6f60('0x43')][_0x6f60('0x19')]);_0x2b854c[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x464c2d[_0x6f60('0x43')]['offset']);}_0x2b854c[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x464c2d[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x2b854c[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x464c2d[_0x6f60('0x43')],_0xa74829[_0x6f60('0xcb')]));_0x2b854c[_0x6f60('0x40')][_0x6f60('0xda')]=_0x26775e['id'];if(_0x464c2d[_0x6f60('0x43')]['filter']){_0x2b854c[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x2b854c[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x2b854c['attributes'],function(_0x2c14b5){var _0x3d31b7={};_0x3d31b7[_0x2c14b5]={'$like':'%'+_0x464c2d['query'][_0x6f60('0x29')]+'%'};return _0x3d31b7;})});}_0x2b854c=_[_0x6f60('0x56')]({},_0x2b854c,_0x464c2d[_0x6f60('0x57')]);return db[_0x6f60('0xdc')][_0x6f60('0x1a')]({'where':_0x2b854c['where']})[_0x6f60('0x31')](function(_0x3cfdeb){_0x3b00d3[_0x6f60('0x1a')]=_0x3cfdeb;if(_0x464c2d[_0x6f60('0x43')][_0x6f60('0x41')]){_0x2b854c['include']=[{'all':!![]}];}return db[_0x6f60('0xdc')][_0x6f60('0x48')](_0x2b854c);})['then'](function(_0xb7c4cc){_0x3b00d3[_0x6f60('0x49')]=_0xb7c4cc;return _0x3b00d3;});}})[_0x6f60('0x31')](respondWithFilteredResult(_0x31ef0c,_0x2b854c))[_0x6f60('0x59')](handleError(_0x31ef0c,null));};exports[_0x6f60('0xdd')]=function(_0x4f9341,_0xfcdf9){var _0x511257={};var _0x32e43c={};var _0x3d7cfa;var _0x2128cc;return db['User']['findOne']({'where':{'id':_0x4f9341[_0x6f60('0x54')]['id']}})['then'](handleEntityNotFound(_0xfcdf9,null))[_0x6f60('0x31')](function(_0x196cc0){if(_0x196cc0){_0x3d7cfa=_0x196cc0;_0x32e43c['model']=_[_0x6f60('0xca')](db[_0x6f60('0xde')][_0x6f60('0x35')]);_0x32e43c[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x4f9341[_0x6f60('0x43')]);_0x32e43c[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x32e43c[_0x6f60('0xcc')],_0x32e43c[_0x6f60('0x43')]);_0x511257[_0x6f60('0x47')]=_['intersection'](_0x32e43c['model'],qs[_0x6f60('0xce')](_0x4f9341[_0x6f60('0x43')][_0x6f60('0xce')]));_0x511257['attributes']=_0x511257['attributes'][_0x6f60('0x4a')]?_0x511257[_0x6f60('0x47')]:_0x32e43c['model'];_0x511257[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x4f9341[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x511257[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x4f9341[_0x6f60('0x43')],_0x32e43c[_0x6f60('0xcb')]));if(_0x4f9341[_0x6f60('0x43')][_0x6f60('0x29')]){_0x511257[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x511257[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x511257[_0x6f60('0x47')],function(_0x38f9f2){var _0x2636b5={};_0x2636b5[_0x38f9f2]={'$like':'%'+_0x4f9341[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x2636b5;})});}_0x511257=_[_0x6f60('0x56')]({},_0x511257,_0x4f9341[_0x6f60('0x57')]);return _0x3d7cfa[_0x6f60('0xdd')](_0x511257);}})[_0x6f60('0x31')](function(_0x587df4){if(_0x587df4){_0x2128cc=_0x587df4[_0x6f60('0x4a')];if(!_0x4f9341[_0x6f60('0x43')][_0x6f60('0xc4')]('nolimit')){_0x511257['limit']=qs[_0x6f60('0x19')](_0x4f9341[_0x6f60('0x43')][_0x6f60('0x19')]);_0x511257[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x4f9341['query'][_0x6f60('0x17')]);}return _0x3d7cfa['getChatInteractions'](_0x511257);}})[_0x6f60('0x31')](function(_0x54109e){if(_0x54109e){return _0x54109e?{'count':_0x2128cc,'rows':_0x54109e}:null;}})[_0x6f60('0x31')](respondWithResult(_0xfcdf9,null))['catch'](handleError(_0xfcdf9,null));};exports['getOpenchannelInteractions']=function(_0x1f3cbc,_0x2f0810){var _0x18378f={};var _0x85e3f1={};var _0x43af89;var _0x1c8a23;return db[_0x6f60('0x34')]['findOne']({'where':{'id':_0x1f3cbc[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x2f0810,null))['then'](function(_0x1810a2){if(_0x1810a2){_0x43af89=_0x1810a2;_0x85e3f1['model']=_[_0x6f60('0xca')](db['OpenchannelInteraction'][_0x6f60('0x35')]);_0x85e3f1[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x1f3cbc[_0x6f60('0x43')]);_0x85e3f1['filters']=_[_0x6f60('0xcd')](_0x85e3f1['model'],_0x85e3f1[_0x6f60('0x43')]);_0x18378f[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x85e3f1['model'],qs[_0x6f60('0xce')](_0x1f3cbc[_0x6f60('0x43')]['fields']));_0x18378f[_0x6f60('0x47')]=_0x18378f[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x18378f[_0x6f60('0x47')]:_0x85e3f1[_0x6f60('0xcc')];_0x18378f[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x1f3cbc[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x18378f[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x1f3cbc[_0x6f60('0x43')],_0x85e3f1[_0x6f60('0xcb')]));if(_0x1f3cbc[_0x6f60('0x43')][_0x6f60('0x29')]){_0x18378f[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x18378f[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x18378f[_0x6f60('0x47')],function(_0x14f6b7){var _0xe825e6={};_0xe825e6[_0x14f6b7]={'$like':'%'+_0x1f3cbc[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0xe825e6;})});}_0x18378f=_[_0x6f60('0x56')]({},_0x18378f,_0x1f3cbc[_0x6f60('0x57')]);return _0x43af89[_0x6f60('0xdf')](_0x18378f);}})['then'](function(_0x505a9b){if(_0x505a9b){_0x1c8a23=_0x505a9b['length'];if(!_0x1f3cbc['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x18378f[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x1f3cbc[_0x6f60('0x43')][_0x6f60('0x19')]);_0x18378f[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x1f3cbc['query'][_0x6f60('0x17')]);}return _0x43af89[_0x6f60('0xdf')](_0x18378f);}})[_0x6f60('0x31')](function(_0x7177be){if(_0x7177be){return _0x7177be?{'count':_0x1c8a23,'rows':_0x7177be}:null;}})[_0x6f60('0x31')](respondWithResult(_0x2f0810,null))[_0x6f60('0x59')](handleError(_0x2f0810,null));};exports[_0x6f60('0xe0')]=function(_0x44c1cc,_0x21fc29){var _0x160110={'raw':!![],'where':{}};var _0x561df1={};var _0x304956={'count':0x0,'rows':[]};return db[_0x6f60('0x34')]['findOne']({'where':{'id':_0x44c1cc[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x21fc29,null))[_0x6f60('0x31')](function(_0x1063d5){if(_0x1063d5){_0x561df1[_0x6f60('0xcc')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x561df1[_0x6f60('0x43')]=_['keys'](_0x44c1cc['query']);_0x561df1[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x561df1['model'],_0x561df1['query']);_0x160110[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x561df1[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x44c1cc['query'][_0x6f60('0xce')]));_0x160110[_0x6f60('0x47')]=_0x160110['attributes']['length']?_0x160110['attributes']:_0x561df1[_0x6f60('0xcc')];if(!_0x44c1cc['query']['hasOwnProperty'](_0x6f60('0xd5'))){_0x160110[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x44c1cc[_0x6f60('0x43')][_0x6f60('0x19')]);_0x160110[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x44c1cc[_0x6f60('0x43')]['offset']);}_0x160110[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x44c1cc[_0x6f60('0x43')]['sort']);_0x160110[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x44c1cc[_0x6f60('0x43')],_0x561df1[_0x6f60('0xcb')]));_0x160110[_0x6f60('0x40')][_0x6f60('0xda')]=_0x1063d5['id'];if(_0x44c1cc[_0x6f60('0x43')][_0x6f60('0x29')]){_0x160110[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x160110[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x160110[_0x6f60('0x47')],function(_0x4cedb6){var _0x9bdb44={};_0x9bdb44[_0x4cedb6]={'$like':'%'+_0x44c1cc[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x9bdb44;})});}_0x160110=_['merge']({},_0x160110,_0x44c1cc[_0x6f60('0x57')]);return db[_0x6f60('0xe1')][_0x6f60('0x1a')]({'where':_0x160110['where']})[_0x6f60('0x31')](function(_0x5ceca3){_0x304956['count']=_0x5ceca3;if(_0x44c1cc[_0x6f60('0x43')][_0x6f60('0x41')]){_0x160110['include']=[{'all':!![]}];}return db[_0x6f60('0xe1')][_0x6f60('0x48')](_0x160110);})['then'](function(_0x4d9d71){_0x304956['rows']=_0x4d9d71;return _0x304956;});}})['then'](respondWithFilteredResult(_0x21fc29,_0x160110))[_0x6f60('0x59')](handleError(_0x21fc29,null));};exports[_0x6f60('0xe2')]=function(_0x2495c4,_0x58ee44){var _0x49903b={};var _0x3732bc={};var _0x241cb4;var _0x3cba6f;return db['User'][_0x6f60('0x8f')]({'where':{'id':_0x2495c4[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x58ee44,null))[_0x6f60('0x31')](function(_0x539e12){if(_0x539e12){_0x241cb4=_0x539e12;_0x3732bc['model']=_['keys'](db[_0x6f60('0xe3')][_0x6f60('0x35')]);_0x3732bc['query']=_[_0x6f60('0xca')](_0x2495c4[_0x6f60('0x43')]);_0x3732bc['filters']=_[_0x6f60('0xcd')](_0x3732bc[_0x6f60('0xcc')],_0x3732bc[_0x6f60('0x43')]);_0x49903b['attributes']=_[_0x6f60('0xcd')](_0x3732bc[_0x6f60('0xcc')],qs['fields'](_0x2495c4[_0x6f60('0x43')][_0x6f60('0xce')]));_0x49903b[_0x6f60('0x47')]=_0x49903b[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x49903b['attributes']:_0x3732bc[_0x6f60('0xcc')];_0x49903b[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x2495c4['query']['sort']);_0x49903b[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x2495c4[_0x6f60('0x43')],_0x3732bc[_0x6f60('0xcb')]));if(_0x2495c4['query'][_0x6f60('0x29')]){_0x49903b[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x49903b[_0x6f60('0x40')],{'$or':_['map'](_0x49903b[_0x6f60('0x47')],function(_0x36f260){var _0x1fdcad={};_0x1fdcad[_0x36f260]={'$like':'%'+_0x2495c4['query'][_0x6f60('0x29')]+'%'};return _0x1fdcad;})});}_0x49903b=_['merge']({},_0x49903b,_0x2495c4[_0x6f60('0x57')]);return _0x241cb4[_0x6f60('0xe2')](_0x49903b);}})['then'](function(_0x52d137){if(_0x52d137){_0x3cba6f=_0x52d137[_0x6f60('0x4a')];if(!_0x2495c4[_0x6f60('0x43')][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x49903b[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x2495c4[_0x6f60('0x43')][_0x6f60('0x19')]);_0x49903b['offset']=qs['offset'](_0x2495c4[_0x6f60('0x43')][_0x6f60('0x17')]);}return _0x241cb4[_0x6f60('0xe2')](_0x49903b);}})[_0x6f60('0x31')](function(_0x741b48){if(_0x741b48){return _0x741b48?{'count':_0x3cba6f,'rows':_0x741b48}:null;}})[_0x6f60('0x31')](respondWithResult(_0x58ee44,null))[_0x6f60('0x59')](handleError(_0x58ee44,null));};exports[_0x6f60('0xe4')]=function(_0x576e7a,_0x27085e){var _0xe118b0={};var _0x366609={};var _0x4ae7ed;var _0x44d889;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x576e7a[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x27085e,null))[_0x6f60('0x31')](function(_0x357d8d){if(_0x357d8d){_0x4ae7ed=_0x357d8d;_0x366609[_0x6f60('0xcc')]=_[_0x6f60('0xca')](db['FaxInteraction'][_0x6f60('0x35')]);_0x366609['query']=_[_0x6f60('0xca')](_0x576e7a[_0x6f60('0x43')]);_0x366609[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0x366609['model'],_0x366609['query']);_0xe118b0[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x366609[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x576e7a['query'][_0x6f60('0xce')]));_0xe118b0['attributes']=_0xe118b0[_0x6f60('0x47')]['length']?_0xe118b0[_0x6f60('0x47')]:_0x366609[_0x6f60('0xcc')];_0xe118b0[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x576e7a[_0x6f60('0x43')]['sort']);_0xe118b0[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_['pick'](_0x576e7a[_0x6f60('0x43')],_0x366609[_0x6f60('0xcb')]));if(_0x576e7a[_0x6f60('0x43')]['filter']){_0xe118b0[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0xe118b0[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0xe118b0[_0x6f60('0x47')],function(_0x4db95c){var _0x572912={};_0x572912[_0x4db95c]={'$like':'%'+_0x576e7a[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x572912;})});}_0xe118b0=_[_0x6f60('0x56')]({},_0xe118b0,_0x576e7a['options']);return _0x4ae7ed[_0x6f60('0xe4')](_0xe118b0);}})['then'](function(_0x23b705){if(_0x23b705){_0x44d889=_0x23b705[_0x6f60('0x4a')];if(!_0x576e7a['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0xe118b0[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x576e7a['query'][_0x6f60('0x19')]);_0xe118b0['offset']=qs[_0x6f60('0x17')](_0x576e7a[_0x6f60('0x43')][_0x6f60('0x17')]);}return _0x4ae7ed['getFaxInteractions'](_0xe118b0);}})[_0x6f60('0x31')](function(_0x27b203){if(_0x27b203){return _0x27b203?{'count':_0x44d889,'rows':_0x27b203}:null;}})[_0x6f60('0x31')](respondWithResult(_0x27085e,null))[_0x6f60('0x59')](handleError(_0x27085e,null));};exports[_0x6f60('0xe5')]=function(_0x519781,_0x2f932d){var _0x2e94cc={};var _0x327b82={};var _0x30783d;var _0xe8c73e;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x519781[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x2f932d,null))[_0x6f60('0x31')](function(_0x1bdcf0){if(_0x1bdcf0){_0x30783d=_0x1bdcf0;_0x327b82[_0x6f60('0xcc')]=_['keys'](db[_0x6f60('0xe6')][_0x6f60('0x35')]);_0x327b82[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x519781[_0x6f60('0x43')]);_0x327b82['filters']=_[_0x6f60('0xcd')](_0x327b82['model'],_0x327b82['query']);_0x2e94cc[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x327b82[_0x6f60('0xcc')],qs[_0x6f60('0xce')](_0x519781[_0x6f60('0x43')][_0x6f60('0xce')]));_0x2e94cc[_0x6f60('0x47')]=_0x2e94cc['attributes']['length']?_0x2e94cc[_0x6f60('0x47')]:_0x327b82[_0x6f60('0xcc')];_0x2e94cc['order']=qs[_0x6f60('0xd0')](_0x519781[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x2e94cc[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_['pick'](_0x519781[_0x6f60('0x43')],_0x327b82['filters']));if(_0x519781[_0x6f60('0x43')][_0x6f60('0x29')]){_0x2e94cc[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x2e94cc['where'],{'$or':_[_0x6f60('0x2b')](_0x2e94cc[_0x6f60('0x47')],function(_0x2c3216){var _0x182168={};_0x182168[_0x2c3216]={'$like':'%'+_0x519781['query'][_0x6f60('0x29')]+'%'};return _0x182168;})});}_0x2e94cc=_[_0x6f60('0x56')]({},_0x2e94cc,_0x519781[_0x6f60('0x57')]);return _0x30783d[_0x6f60('0xe5')](_0x2e94cc);}})[_0x6f60('0x31')](function(_0x5713aa){if(_0x5713aa){_0xe8c73e=_0x5713aa['length'];if(!_0x519781['query'][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x2e94cc[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x519781[_0x6f60('0x43')][_0x6f60('0x19')]);_0x2e94cc[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x519781[_0x6f60('0x43')][_0x6f60('0x17')]);}return _0x30783d['getWhatsappInteractions'](_0x2e94cc);}})[_0x6f60('0x31')](function(_0xacf4ff){if(_0xacf4ff){return _0xacf4ff?{'count':_0xe8c73e,'rows':_0xacf4ff}:null;}})[_0x6f60('0x31')](respondWithResult(_0x2f932d,null))['catch'](handleError(_0x2f932d,null));};exports['login']=function(_0x4cc273,_0x55c45d,_0x2e9c3c){var _0xed60cb;var _0x53fb83;var _0x198b3a;var _0x7640e6=!_['isNil'](_0x4cc273[_0x6f60('0x54')]['id'])?_0x4cc273[_0x6f60('0x54')]['id']:!_[_0x6f60('0xa3')](_0x4cc273[_0x6f60('0x26')]['id'])?_0x4cc273[_0x6f60('0x26')]['id']:null;return db['User']['find']({'where':{'id':_0x7640e6,'role':{'$or':[_0x6f60('0x24'),_0x6f60('0x26'),_0x6f60('0x1f')]}},'attributes':['id',_0x6f60('0x2f'),_0x6f60('0xe7'),_0x6f60('0xe8'),'role',_0x6f60('0x5c'),_0x6f60('0x96')]})[_0x6f60('0x31')](function(_0x18fe6e){if(_0x18fe6e){if(_0x18fe6e[_0x6f60('0x1e')]===_0x6f60('0x1f')){_0xed60cb=_0x18fe6e;if(_0x4cc273[_0x6f60('0x5a')]['interface']){_0x198b3a=util[_0x6f60('0xa4')]('LOCAL/%s@from-sip/n',_0xed60cb[_0x4cc273[_0x6f60('0x5a')][_0x6f60('0x98')]]);}else if(_0x4cc273[_0x6f60('0x5a')][_0x6f60('0xe9')]){_0x198b3a=util[_0x6f60('0xa4')]('SIP/%s',_0x4cc273[_0x6f60('0x5a')][_0x6f60('0xe9')]);}else{_0x198b3a=util[_0x6f60('0xa4')](_0x6f60('0xa5'),_0xed60cb['name']);}socket['to'](util[_0x6f60('0xa4')](_0x6f60('0xea'),_0xed60cb[_0x6f60('0x2f')]))[_0x6f60('0x20')](_0x6f60('0xeb'),{'user':{'id':_0xed60cb['id'],'name':_0xed60cb[_0x6f60('0x2f')]},'ip':_0x4cc273[_0x6f60('0xec')][_0x6f60('0xed')]||_0x4cc273[_0x6f60('0xee')]['remoteAddress']||_0x4cc273[_0x6f60('0xef')][_0x6f60('0xf0')]||_0x4cc273[_0x6f60('0xee')][_0x6f60('0xef')][_0x6f60('0xf0')]});return db[_0x6f60('0xa6')][_0x6f60('0x22')]({'where':{'membername':_0xed60cb[_0x6f60('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0x6f60('0x89'))][(_0x6f60('0x8b'))](_0x6f60('0xf1'));}})[_0x6f60('0x31')](function(){if(_0xed60cb){return _0xed60cb[_0x6f60('0xf2')]({'raw':!![]});}})[_0x6f60('0x31')](function(_0x50605c){if(_0xed60cb){if(_0x50605c){_0x53fb83=_0x50605c;if(_0x53fb83[_0x6f60('0x4a')]){var _0x3a5e6c=_0x53fb83[_0x6f60('0x2b')](function(_0xaa3c3f){var _0x2c1735={'membername':_0xed60cb[_0x6f60('0x2f')],'UserId':_0xed60cb['id'],'queue_name':_0xaa3c3f['name'],'VoiceQueueId':_0xaa3c3f['id'],'interface':_0x198b3a,'paused':_0xed60cb['loginInPause']||![],'penalty':_0xaa3c3f[_0x6f60('0xf3')]||0x0};return db[_0x6f60('0xa6')][_0x6f60('0xa7')](_0x2c1735);});return Promise[_0x6f60('0x52')](_0x3a5e6c);}}}})[_0x6f60('0x31')](function(){if(_0xed60cb){return db[_0x6f60('0xf4')][_0x6f60('0x48')]({'where':{'membername':_0xed60cb['name'],'exitAt':null}});}})[_0x6f60('0x31')](function(_0x6a7e51){if(_0xed60cb){var _0x2ebd08=[];_0x6a7e51[_0x6f60('0xf5')](function(_0xd6b8ea){_0x2ebd08[_0x6f60('0x4b')](_0xd6b8ea['update']({'exitAt':moment()[_0x6f60('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x6f60('0x52')](_0x2ebd08);}})['then'](function(){if(_0xed60cb){var _0x4ce865=[];var _0x285280=[];var _0x12d78c=utils[_0x6f60('0xf6')]();var _0x2af317={'membername':_0xed60cb[_0x6f60('0x2f')],'interface':_0x198b3a,'enterAt':moment()[_0x6f60('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xed60cb[_0x6f60('0x1e')],'internal':_0xed60cb['internal']};_0x12d78c[_0x6f60('0xf5')](function(_0x3ad45e){_0x4ce865['push'](_[_0x6f60('0x56')]({'channel':_0x3ad45e,'type':_0x6f60('0xf7'),'data1':_0x4cc273[_0x6f60('0x5a')][_0x6f60('0xf8')],'data2':_0x198b3a},_0x2af317));if(_0xed60cb[_0x6f60('0x96')]){_0x285280[_0x6f60('0x4b')](_[_0x6f60('0x56')]({'channel':_0x3ad45e,'type':'PAUSE','data1':_0x6f60('0xf9')},_0x2af317));}});return db['MemberReport'][_0x6f60('0xfa')](_0x4ce865['concat'](_0x285280),{'individualHooks':!![]});}})[_0x6f60('0x31')](function(){if(_0xed60cb){return _0xed60cb[_0x6f60('0x1d')]({'online':!![],'lastLoginAt':moment()[_0x6f60('0xa4')](_0x6f60('0xfb')),'voicePause':_0xed60cb[_0x6f60('0x96')]||![],'mailPause':_0xed60cb['loginInPause']||![],'chatPause':_0xed60cb['loginInPause']||![],'faxPause':_0xed60cb['loginInPause']||![],'smsPause':_0xed60cb['loginInPause']||![],'openchannelPause':_0xed60cb['loginInPause']||![],'whatsappPause':_0xed60cb[_0x6f60('0x96')]||![],'pauseType':_0xed60cb[_0x6f60('0x96')]?'LOGININPAUSE':null,'interface':_0x198b3a,'lastPauseAt':moment()[_0x6f60('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6f60('0x31')](function(_0x3f7351){if(_0x4cc273['isMiddleware']){return _0x2e9c3c();}else{return Promise[_0x6f60('0xfc')](_0x3f7351)[_0x6f60('0x31')](respondWithResult(_0x55c45d,null));}})[_0x6f60('0x59')](handleError(_0x55c45d,null));};exports[_0x6f60('0xfd')]=function(_0x139e10,_0x16c619){var _0x156c61;return db[_0x6f60('0x34')][_0x6f60('0x2e')]({'where':{'id':_0x139e10['params']['id'],'role':_0x6f60('0x1f')},'attributes':['id',_0x6f60('0x2f'),_0x6f60('0x1e')]})[_0x6f60('0x31')](handleEntityNotFound(_0x16c619,null))['then'](function(_0x31a751){if(_0x31a751){_0x156c61=_0x31a751;return db[_0x6f60('0xa6')][_0x6f60('0x22')]({'where':{'membername':_0x156c61['name']},'individualHooks':!![]});}})[_0x6f60('0x31')](function(){return db[_0x6f60('0xf4')]['findAll']({'where':{'membername':_0x156c61[_0x6f60('0x2f')],'exitAt':null}});})[_0x6f60('0x31')](function(_0x59f35c){var _0x2b3eec=[];_0x59f35c[_0x6f60('0xf5')](function(_0x28b72e){_0x2b3eec[_0x6f60('0x4b')](_0x28b72e[_0x6f60('0x1d')]({'exitAt':moment()[_0x6f60('0xa4')](_0x6f60('0xfb'))}));});return Promise[_0x6f60('0x52')](_0x2b3eec);})[_0x6f60('0x31')](function(){return _0x156c61[_0x6f60('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x16c619,null))['catch'](handleError(_0x16c619,null));};exports[_0x6f60('0xfe')]=function(_0x11161b,_0x1c363a){var _0x1059e2;return db['UserVoiceQueueRt'][_0x6f60('0x1d')]({'paused':0x1},{'where':{'UserId':_0x11161b[_0x6f60('0x54')]['id']},'individualHooks':!![]})[_0x6f60('0x31')](function(){return db['User'][_0x6f60('0x2e')]({'where':{'id':_0x11161b[_0x6f60('0x54')]['id'],'role':_0x6f60('0x1f')},'attributes':['id',_0x6f60('0x2f'),_0x6f60('0x1e'),_0x6f60('0x5c'),_0x6f60('0x98'),'online']});})[_0x6f60('0x31')](handleEntityNotFound(_0x1c363a,null))[_0x6f60('0x31')](function(_0x15f384){if(_0x15f384){_0x1059e2=_0x15f384;return db[_0x6f60('0xf4')][_0x6f60('0x48')]({'where':{'membername':_0x1059e2[_0x6f60('0x2f')],'type':_0x6f60('0xff'),'exitAt':null}});}})[_0x6f60('0x31')](function(_0x71534a){if(_0x71534a[_0x6f60('0x4a')]){var _0x14d602=moment()[_0x6f60('0xa4')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18ac32=0x0,_0x2760aa=_0x71534a[_0x6f60('0x4a')];_0x18ac32<_0x2760aa;_0x18ac32++){_0x71534a[_0x18ac32][_0x6f60('0x100')]({'exitAt':_0x14d602});}}})[_0x6f60('0x31')](function(){var _0x411791=[];var _0x5069cd=utils[_0x6f60('0xf6')]();_0x5069cd['forEach'](function(_0x5e588b){_0x411791[_0x6f60('0x4b')]({'channel':_0x5e588b,'membername':_0x1059e2[_0x6f60('0x2f')],'interface':_['isNil'](_0x1059e2['interface'])?util['format'](_0x6f60('0xa5'),_0x1059e2[_0x6f60('0x2f')]):_0x1059e2['interface'],'type':_0x6f60('0xff'),'enterAt':moment()[_0x6f60('0xa4')](_0x6f60('0xfb')),'data1':_0x11161b['body'][_0x6f60('0x37')]||'DEFAULT\x20PAUSE','role':_0x1059e2['role'],'internal':_0x1059e2[_0x6f60('0x5c')]});});return db[_0x6f60('0xf4')][_0x6f60('0xfa')](_0x411791,{'individualHooks':!![]});})[_0x6f60('0x31')](function(){return _0x1059e2[_0x6f60('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x11161b[_0x6f60('0x5a')]['type']||_0x6f60('0x101'),'lastPauseAt':moment()[_0x6f60('0xa4')](_0x6f60('0xfb'))});})[_0x6f60('0x31')](respondWithResult(_0x1c363a,null))['catch'](handleError(_0x1c363a,null));};exports[_0x6f60('0x102')]=function(_0x247480,_0x5031a8){if(_0x247480[_0x6f60('0x5a')][_0x6f60('0x94')]&&!utils[_0x6f60('0x99')](_0x247480[_0x6f60('0x5a')]['channel'])){throw new APIBadRequestError(util[_0x6f60('0xa4')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x247480['body'][_0x6f60('0x94')]));}return db[_0x6f60('0x34')]['find']({'where':{'id':_0x247480[_0x6f60('0x54')]['id']},'attributes':['id','name',_0x6f60('0x1e'),'internal','interface','online','voicePause',_0x6f60('0x103'),'chatPause',_0x6f60('0x104'),_0x6f60('0x105'),_0x6f60('0x106'),_0x6f60('0x107'),_0x6f60('0x108'),_0x6f60('0x109')]})[_0x6f60('0x31')](function(_0x330ad0){if(!_0x330ad0){throw new APINotFoundError(util[_0x6f60('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x247480[_0x6f60('0x54')]['id']));}return _0x330ad0[_0x6f60('0x102')](_0x247480['body'][_0x6f60('0x94')]);})[_0x6f60('0x31')](respondWithResult(_0x5031a8,null))[_0x6f60('0x59')](APIHandleError(_0x5031a8));};exports[_0x6f60('0x10a')]=function(_0x268f52,_0x34d47b){var _0x3e6c1d={};var _0xb3d5d3={};var _0x33f369;var _0x575b6f;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x268f52[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x34d47b,null))['then'](function(_0x22c2ee){if(_0x22c2ee){_0x33f369=_0x22c2ee;_0xb3d5d3[_0x6f60('0xcc')]=_[_0x6f60('0xca')](db[_0x6f60('0x10b')]['rawAttributes']);_0xb3d5d3[_0x6f60('0x43')]=_['keys'](_0x268f52[_0x6f60('0x43')]);_0xb3d5d3[_0x6f60('0xcb')]=_[_0x6f60('0xcd')](_0xb3d5d3[_0x6f60('0xcc')],_0xb3d5d3[_0x6f60('0x43')]);_0x3e6c1d[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0xb3d5d3['model'],qs['fields'](_0x268f52['query']['fields']));_0x3e6c1d[_0x6f60('0x47')]=_0x3e6c1d['attributes'][_0x6f60('0x4a')]?_0x3e6c1d[_0x6f60('0x47')]:_0xb3d5d3[_0x6f60('0xcc')];_0x3e6c1d['order']=qs[_0x6f60('0xd0')](_0x268f52[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x3e6c1d[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x268f52[_0x6f60('0x43')],_0xb3d5d3['filters']));if(_0x268f52[_0x6f60('0x43')][_0x6f60('0x29')]){_0x3e6c1d[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x3e6c1d[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x3e6c1d['attributes'],function(_0x5aeccf){var _0x25ded4={};_0x25ded4[_0x5aeccf]={'$like':'%'+_0x268f52['query']['filter']+'%'};return _0x25ded4;})});}_0x3e6c1d=_['merge']({},_0x3e6c1d,_0x268f52[_0x6f60('0x57')]);return _0x33f369['getTeams'](_0x3e6c1d);}})[_0x6f60('0x31')](function(_0x100c9a){if(_0x100c9a){_0x575b6f=_0x100c9a[_0x6f60('0x4a')];if(!_0x268f52[_0x6f60('0x43')]['hasOwnProperty'](_0x6f60('0xd5'))){_0x3e6c1d['limit']=qs[_0x6f60('0x19')](_0x268f52[_0x6f60('0x43')][_0x6f60('0x19')]);_0x3e6c1d[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x268f52[_0x6f60('0x43')]['offset']);}return _0x33f369[_0x6f60('0x10a')](_0x3e6c1d);}})['then'](function(_0x57ca9a){if(_0x57ca9a){return _0x57ca9a?{'count':_0x575b6f,'rows':_0x57ca9a}:null;}})['then'](respondWithResult(_0x34d47b,null))[_0x6f60('0x59')](handleError(_0x34d47b,null));};exports[_0x6f60('0x10c')]=function(_0x3a7110,_0x263e81){var _0x227344=_0x3a7110[_0x6f60('0x54')]['id'];var _0x4713dd=_0x3a7110[_0x6f60('0x5a')]?_0x3a7110['body'][_0x6f60('0x9d')]:null;var _0x497758=[];return Promise[_0x6f60('0xfc')]()[_0x6f60('0x31')](function(){if(!_0x4713dd)throw new APIBadRequestError(_0x6f60('0x10d'));})[_0x6f60('0x31')](function(){return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x227344}});})[_0x6f60('0x31')](function(_0x1e8d82){if(!_0x1e8d82)throw new APINotFoundError(util[_0x6f60('0xa4')](_0x6f60('0xc3'),_0x3a7110[_0x6f60('0x54')]['id']));return db[_0x6f60('0x61')][_0x6f60('0x10e')](function(_0x146660){return _0x1e8d82[_0x6f60('0x10c')](_0x4713dd,{'transaction':_0x146660})[_0x6f60('0x31')](function(){return db[_0x6f60('0x10b')][_0x6f60('0x48')]({'where':{'id':{'$in':_0x4713dd}}});})[_0x6f60('0x31')](function(_0x1a28ea){var _0x5d8b8f=_[_0x6f60('0x2b')](_0x1a28ea,function(_0x4d78d2){return _0x4d78d2[_0x6f60('0x10f')]();});return Promise[_0x6f60('0x52')](_0x5d8b8f);})['then'](function(_0x112a38){_0x497758=_[_0x6f60('0x110')](_0x112a38);var _0xe18757=_['map'](_0x497758,function(_0xa61370){return _0xa61370[_0x6f60('0x111')](_0x1e8d82['id'],{'transaction':_0x146660});});return Promise[_0x6f60('0x52')](_0xe18757);})[_0x6f60('0x31')](function(){if(!_0x1e8d82[_0x6f60('0x95')])return;var _0x1fcbf7=_[_0x6f60('0x29')](_0x497758,function(_0x1af727){return _0x1af727[_0x6f60('0x112')]('channel')==='Voice';});var _0x58bfaa=_[_0x6f60('0x2b')](_0x1fcbf7,function(_0x398e07){return db[_0x6f60('0xa6')]['upsert']({'membername':_0x1e8d82[_0x6f60('0x2f')],'UserId':_0x1e8d82['id'],'queue_name':_0x398e07[_0x6f60('0x2f')],'VoiceQueueId':_0x398e07['id'],'interface':_['isNil'](_0x1e8d82[_0x6f60('0x98')])?util['format'](_0x6f60('0xa5'),_0x1e8d82['name']):_0x1e8d82[_0x6f60('0x98')],'paused':_0x1e8d82[_0x6f60('0x97')]||![],'penalty':_0x1e8d82[_0x6f60('0x9e')]},{'transaction':_0x146660});});return Promise[_0x6f60('0x52')](_0x58bfaa);})[_0x6f60('0x31')](function(){return db[_0x6f60('0x113')][_0x6f60('0x48')]({'where':{'teamId':{'$in':_0x4713dd}}});})[_0x6f60('0x31')](function(_0x15c52f){var _0x1a0a50=_[_0x6f60('0x2b')](_0x15c52f,function(_0x2d304d){return db[_0x6f60('0x114')][_0x6f60('0x7b')]({'UserId':_0x1e8d82['id'],'VoicePrefixId':_0x2d304d[_0x6f60('0x115')]},{'transaction':_0x146660});});return Promise[_0x6f60('0x52')](_0x1a0a50);});});})['then'](function(){for(var _0xad541b=0x0;_0xad541b<_0x497758[_0x6f60('0x4a')];_0xad541b++){var _0x10aa2e=_0x497758[_0xad541b]['getDataValue'](_0x6f60('0x94'));var _0x3604d3=_0x10aa2e+_0x6f60('0xa0');socket[_0x6f60('0x20')](_0x6f60('0x26')+_0x10aa2e+_0x6f60('0xa1'),{'UserId':_0x227344,['queueField']:_0x497758[_0xad541b]['id']});}})['then'](respondWithStatusCode(_0x263e81,null))[_0x6f60('0x59')](APIHandleError(_0x263e81));};exports[_0x6f60('0x116')]=function(_0x22c73b,_0x26005e){var _0x317b70=_0x22c73b[_0x6f60('0x54')]['id'];var _0x2e5daf=null;if(_0x22c73b[_0x6f60('0x43')]['ids']){_0x2e5daf=_[_0x6f60('0x117')](_0x22c73b['query']['ids'])?_0x22c73b[_0x6f60('0x43')][_0x6f60('0x9d')]:[_0x22c73b[_0x6f60('0x43')][_0x6f60('0x9d')]];}var _0x1888f0=[];return Promise[_0x6f60('0xfc')]()[_0x6f60('0x31')](function(){if(!_0x2e5daf)throw new APIBadRequestError(_0x6f60('0x118'));})[_0x6f60('0x31')](function(){return db[_0x6f60('0x34')]['findOne']({'where':{'id':_0x317b70}});})[_0x6f60('0x31')](function(_0x454c87){if(!_0x454c87)throw new APINotFoundError(util[_0x6f60('0xa4')](_0x6f60('0xc3'),_0x22c73b[_0x6f60('0x54')]['id']));return db[_0x6f60('0x61')]['transaction'](function(_0xa5fa60){return _0x454c87[_0x6f60('0x116')](_0x2e5daf,{'transaction':_0xa5fa60})[_0x6f60('0x31')](function(){return db[_0x6f60('0x10b')][_0x6f60('0x48')]({'where':{'id':{'$in':_0x2e5daf}}});})[_0x6f60('0x31')](function(_0x4748dc){var _0x5114bc=_['map'](_0x4748dc,function(_0x3a5dcb){return _0x3a5dcb[_0x6f60('0x10f')]();});return Promise[_0x6f60('0x52')](_0x5114bc);})[_0x6f60('0x31')](function(_0x32d164){_0x1888f0=_[_0x6f60('0x110')](_0x32d164);var _0x26f8b9=_['map'](_0x1888f0,function(_0x2c0172){return _0x2c0172[_0x6f60('0x119')](_0x454c87['id'],{'transaction':_0xa5fa60});});return Promise['all'](_0x26f8b9);})[_0x6f60('0x31')](function(){if(!_0x454c87['online'])return;var _0x81cc49=_[_0x6f60('0x29')](_0x1888f0,function(_0x42abe6){return _0x42abe6[_0x6f60('0x112')](_0x6f60('0x94'))===_0x6f60('0x11a');});var _0x284650=_['map'](_0x81cc49,function(_0x364a35){return db[_0x6f60('0xa6')]['destroy']({'where':{'VoiceQueueId':_0x364a35['id'],'UserId':_0x454c87['id']},'transaction':_0xa5fa60});});return Promise[_0x6f60('0x52')](_0x284650);})[_0x6f60('0x31')](function(){return db[_0x6f60('0x113')][_0x6f60('0x48')]({'where':{'teamId':{'$in':_0x2e5daf}}});})[_0x6f60('0x31')](function(_0x22536d){var _0x4c17ad=_[_0x6f60('0x2b')](_0x22536d,function(_0x10fed1){return db['UserVoicePrefix'][_0x6f60('0x22')]({'where':{'UserId':_0x454c87['id'],'VoicePrefixId':_0x10fed1['VoicePrefixId']}},{'transaction':_0xa5fa60});});return Promise['all'](_0x4c17ad);});});})[_0x6f60('0x31')](function(){for(var _0x5d9308=0x0;_0x5d9308<_0x1888f0[_0x6f60('0x4a')];_0x5d9308++){var _0x322c7b=_0x1888f0[_0x5d9308][_0x6f60('0x112')](_0x6f60('0x94'));var _0x44abc5=_0x322c7b+_0x6f60('0xa0');socket[_0x6f60('0x20')](_0x6f60('0x26')+_0x322c7b+'Queue:remove',{'UserId':_0x317b70,['queueField']:_0x1888f0[_0x5d9308]['id']});}})[_0x6f60('0x31')](respondWithStatusCode(_0x26005e,null))['catch'](APIHandleError(_0x26005e));};exports['getLists']=function(_0x1aa6df,_0x34c2d6){var _0x3b4333={};var _0x1390dc={};var _0x31e7f2;var _0x54475a;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x1aa6df[_0x6f60('0x54')]['id']}})['then'](handleEntityNotFound(_0x34c2d6,null))[_0x6f60('0x31')](function(_0x2e75a8){if(_0x2e75a8){_0x31e7f2=_0x2e75a8;_0x1390dc[_0x6f60('0xcc')]=_[_0x6f60('0xca')](db[_0x6f60('0x11b')][_0x6f60('0x35')]);_0x1390dc[_0x6f60('0x43')]=_['keys'](_0x1aa6df['query']);_0x1390dc['filters']=_[_0x6f60('0xcd')](_0x1390dc[_0x6f60('0xcc')],_0x1390dc['query']);_0x3b4333[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x1390dc['model'],qs[_0x6f60('0xce')](_0x1aa6df['query'][_0x6f60('0xce')]));_0x3b4333[_0x6f60('0x47')]=_0x3b4333[_0x6f60('0x47')][_0x6f60('0x4a')]?_0x3b4333[_0x6f60('0x47')]:_0x1390dc[_0x6f60('0xcc')];_0x3b4333[_0x6f60('0xcf')]=qs[_0x6f60('0xd0')](_0x1aa6df[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x3b4333[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_['pick'](_0x1aa6df[_0x6f60('0x43')],_0x1390dc[_0x6f60('0xcb')]));if(_0x1aa6df[_0x6f60('0x43')][_0x6f60('0x29')]){_0x3b4333[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x3b4333[_0x6f60('0x40')],{'$or':_[_0x6f60('0x2b')](_0x3b4333[_0x6f60('0x47')],function(_0xaaf1b9){var _0x3ccebf={};_0x3ccebf[_0xaaf1b9]={'$like':'%'+_0x1aa6df[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x3ccebf;})});}_0x3b4333=_[_0x6f60('0x56')]({},_0x3b4333,_0x1aa6df[_0x6f60('0x57')]);return _0x31e7f2[_0x6f60('0x11c')](_0x3b4333);}})[_0x6f60('0x31')](function(_0x4b207e){if(_0x4b207e){_0x54475a=_0x4b207e[_0x6f60('0x4a')];if(!_0x1aa6df[_0x6f60('0x43')][_0x6f60('0xc4')](_0x6f60('0xd5'))){_0x3b4333[_0x6f60('0x19')]=qs[_0x6f60('0x19')](_0x1aa6df[_0x6f60('0x43')][_0x6f60('0x19')]);_0x3b4333[_0x6f60('0x17')]=qs[_0x6f60('0x17')](_0x1aa6df[_0x6f60('0x43')]['offset']);}return _0x31e7f2[_0x6f60('0x11c')](_0x3b4333);}})[_0x6f60('0x31')](function(_0x341164){if(_0x341164){return _0x341164?{'count':_0x54475a,'rows':_0x341164}:null;}})['then'](respondWithResult(_0x34c2d6,null))['catch'](handleError(_0x34c2d6,null));};exports['getAgents']=function(_0x3019b7,_0x294935){var _0x1d2656={};var _0x497013={};var _0xa891fe;return db[_0x6f60('0x34')][_0x6f60('0x8f')]({'where':{'id':_0x3019b7[_0x6f60('0x54')]['id']}})[_0x6f60('0x31')](handleEntityNotFound(_0x294935,null))[_0x6f60('0x31')](function(_0x4192e5){if(_0x4192e5){_0xa891fe=_0x4192e5;_0x497013[_0x6f60('0xcc')]=_['keys'](db[_0x6f60('0x34')][_0x6f60('0x35')]);_0x497013[_0x6f60('0x43')]=_[_0x6f60('0xca')](_0x3019b7['query']);_0x497013[_0x6f60('0xcb')]=_['intersection'](_0x497013[_0x6f60('0xcc')],_0x497013[_0x6f60('0x43')]);_0x1d2656[_0x6f60('0x47')]=_[_0x6f60('0xcd')](_0x497013[_0x6f60('0xcc')],qs['fields'](_0x3019b7['query']['fields']));_0x1d2656[_0x6f60('0x47')]=_0x1d2656[_0x6f60('0x47')]['length']?_0x1d2656['attributes']:_0x497013['model'];_0x1d2656['order']=qs['sort'](_0x3019b7[_0x6f60('0x43')][_0x6f60('0xd0')]);_0x1d2656[_0x6f60('0x40')]=qs[_0x6f60('0xcb')](_[_0x6f60('0xd4')](_0x3019b7[_0x6f60('0x43')],_0x497013[_0x6f60('0xcb')]));if(_0x3019b7[_0x6f60('0x43')][_0x6f60('0x29')]){_0x1d2656[_0x6f60('0x40')]=_[_0x6f60('0x56')](_0x1d2656['where'],{'$or':_[_0x6f60('0x2b')](_0x1d2656['attributes'],function(_0x1cfdf2){var _0x1c7248={};_0x1c7248[_0x1cfdf2]={'$like':'%'+_0x3019b7[_0x6f60('0x43')][_0x6f60('0x29')]+'%'};return _0x1c7248;})});}_0x1d2656[_0x6f60('0xcc')]=db[_0x6f60('0x34')];_0x1d2656['as']=_0x6f60('0x27');_0x1d2656=_[_0x6f60('0x56')]({},_0x1d2656,_0x3019b7[_0x6f60('0x57')]);return _0xa891fe[_0x6f60('0xf2')]({'include':[_0x1d2656]});}})[_0x6f60('0x31')](function(_0x22860){if(_0x22860){var _0xe3d11={},_0x17bfeb=[];for(var _0x2db92f=0x0;_0x2db92f<_0x22860['length'];_0x2db92f+=0x1){for(var _0x102baa=0x0,_0x6d4205;_0x102baa<_0x22860[_0x2db92f][_0x6f60('0x27')][_0x6f60('0x4a')];_0x102baa+=0x1){_0x6d4205=_0x22860[_0x2db92f]['Agents'][_0x102baa][_0x6f60('0x23')]({'plain':!![]});_0xe3d11[_0x6d4205['id']]=_0x6d4205;}}_0xe3d11=_[_0x6f60('0x11d')](_0xe3d11);for(var _0x1493f5=qs[_0x6f60('0x17')](_0x3019b7[_0x6f60('0x43')][_0x6f60('0x17')]);_0x1493f5<_0xe3d11[_0x6f60('0x4a')]&&_0x17bfeb['length']=_0x466d37['agents']){throw new Error(_0xca19('0x4b'));}})[_0xca19('0x17')](function(){if(_0x5cb76b){return db[_0xca19('0x28')]['destroy']({'where':{'membername':_0x5cb76b[_0xca19('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x5cb76b){return _0x5cb76b[_0xca19('0x4c')]({'raw':!![]});}})[_0xca19('0x17')](function(_0x435b38){if(_0x5cb76b){if(_0x435b38){var _0x37904b=[];_0x69c214=_0x435b38;if(_0x69c214[_0xca19('0x4d')]){for(var _0x593585=0x0;_0x593585<_0x69c214['length'];_0x593585++){_0x37904b[_0xca19('0x2d')](db['UserVoiceQueueRt'][_0xca19('0x4e')]({'membername':_0x5cb76b[_0xca19('0x21')],'UserId':_0x5cb76b['id'],'queue_name':_0x69c214[_0x593585][_0xca19('0x21')],'VoiceQueueId':_0x69c214[_0x593585]['id'],'interface':_0xe93edc,'paused':_0x5cb76b[_0xca19('0x45')]||![],'penalty':_0x69c214[_0x593585][_0xca19('0x4f')]||0x0}));}return BPromise[_0xca19('0x50')](_0x37904b);}}}})[_0xca19('0x17')](function(){if(_0x5cb76b){return db[_0xca19('0x29')][_0xca19('0xe')]({'where':{'membername':_0x5cb76b[_0xca19('0x21')],'exitAt':null}});}})['then'](function(_0x1b7560){if(_0x5cb76b){if(_0x1b7560&&_0x1b7560[_0xca19('0x4d')]){var _0x53683b=[];_0x1b7560['forEach'](function(_0xcbcc67){_0x53683b[_0xca19('0x2d')](_0xcbcc67[_0xca19('0x32')]({'exitAt':moment()[_0xca19('0x25')](_0xca19('0x33'))}));});return BPromise[_0xca19('0x50')](_0x53683b);}}})[_0xca19('0x17')](function(){if(_0x5cb76b){var _0x5b81d3=[];var _0x25a6d6=[];var _0x5a14ab=utils[_0xca19('0x2b')]();var _0x264929={'membername':_0x5cb76b['name'],'interface':_0xe93edc,'enterAt':moment()[_0xca19('0x25')](_0xca19('0x33')),'role':_0x5cb76b[_0xca19('0x22')],'internal':_0x5cb76b[_0xca19('0x23')]};_0x5a14ab[_0xca19('0x2c')](function(_0xc513fd){_0x5b81d3[_0xca19('0x2d')](_[_0xca19('0x51')]({'channel':_0xc513fd,'type':_0xca19('0x52'),'data1':_0xca19('0x53'),'data2':_0xe93edc},_0x264929));if(_0x5cb76b['loginInPause']){_0x25a6d6[_0xca19('0x2d')](_[_0xca19('0x51')]({'channel':_0xc513fd,'type':_0xca19('0x2a'),'data1':_0xca19('0x54')},_0x264929));}});return db['MemberReport'][_0xca19('0x55')](_0x5b81d3[_0xca19('0x56')](_0x25a6d6),{'individualHooks':!![]});}})[_0xca19('0x17')](function(){if(_0x5cb76b){return _0x5cb76b[_0xca19('0x32')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5cb76b[_0xca19('0x45')]||![],'mailPause':_0x5cb76b[_0xca19('0x45')]||![],'chatPause':_0x5cb76b[_0xca19('0x45')]||![],'faxPause':_0x5cb76b['loginInPause']||![],'smsPause':_0x5cb76b['loginInPause']||![],'openchannelPause':_0x5cb76b[_0xca19('0x45')]||![],'pauseType':_0x5cb76b[_0xca19('0x45')]?_0xca19('0x54'):null,'lastPauseAt':moment()['format'](_0xca19('0x33')),'interface':_0xe93edc});}})[_0xca19('0x17')](function(_0x51e071){_0x534359(_0x51e071);})['catch'](function(_0x476932){_0x4b7c0e(_0x356475['error'](0x1f4,_0x476932[_0xca19('0x1f')]));});});}; \ No newline at end of file +var _0xf714=['rpc','../../config/environment','redis','defaults','./user.socket','GetUser','findAll','raw','options','where','limit','include','map','model','attributes','debug','stringify','catch','error','message','ShowUser','User','then','PauseUser','find','name','interface','params','UserVoiceQueueRt','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','role','internal','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','chatPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','LogoutUser','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','all','merge','LOGIN','concat','LOGININPAUSE','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x205755,_0x306ce4){var _0x5b6ca8=function(_0x46a531){while(--_0x46a531){_0x205755['push'](_0x205755['shift']());}};_0x5b6ca8(++_0x306ce4);}(_0xf714,0xf0));var _0x4f71=function(_0x39c8f2,_0x23df6c){_0x39c8f2=_0x39c8f2-0x0;var _0x445526=_0xf714[_0x39c8f2];return _0x445526;};'use strict';var _=require(_0x4f71('0x0'));var util=require('util');var moment=require(_0x4f71('0x1'));var BPromise=require(_0x4f71('0x2'));var Redis=require(_0x4f71('0x3'));var db=require(_0x4f71('0x4'))['db'];var utils=require(_0x4f71('0x5'));var logger=require('../../config/logger')(_0x4f71('0x6'));var config=require(_0x4f71('0x7'));config[_0x4f71('0x8')]=_[_0x4f71('0x9')](config[_0x4f71('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f71('0x8')]));require(_0x4f71('0xa'))['register'](socket);exports[_0x4f71('0xb')]=function(_0x53c8f4){var _0x587fc2=this;return new Promise(function(_0x503c44,_0x4c02c6){return db['User'][_0x4f71('0xc')]({'raw':_0x53c8f4['options']?_0x53c8f4['options'][_0x4f71('0xd')]===undefined?!![]:![]:!![],'where':_0x53c8f4[_0x4f71('0xe')]?_0x53c8f4[_0x4f71('0xe')][_0x4f71('0xf')]||null:null,'attributes':_0x53c8f4[_0x4f71('0xe')]?_0x53c8f4[_0x4f71('0xe')]['attributes']||null:null,'limit':_0x53c8f4[_0x4f71('0xe')]?_0x53c8f4['options'][_0x4f71('0x10')]||null:null,'include':_0x53c8f4[_0x4f71('0xe')]?_0x53c8f4[_0x4f71('0xe')][_0x4f71('0x11')]?_[_0x4f71('0x12')](_0x53c8f4[_0x4f71('0xe')][_0x4f71('0x11')],function(_0x2311b6){return{'model':db[_0x2311b6[_0x4f71('0x13')]],'as':_0x2311b6['as'],'attributes':_0x2311b6['attributes'],'include':_0x2311b6['include']?_[_0x4f71('0x12')](_0x2311b6[_0x4f71('0x11')],function(_0x10c6d8){return{'model':db[_0x10c6d8[_0x4f71('0x13')]],'as':_0x10c6d8['as'],'attributes':_0x10c6d8[_0x4f71('0x14')],'include':_0x10c6d8['include']?_['map'](_0x10c6d8[_0x4f71('0x11')],function(_0x2e2f86){return{'model':db[_0x2e2f86[_0x4f71('0x13')]],'as':_0x2e2f86['as'],'attributes':_0x2e2f86[_0x4f71('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50c4db){logger['info']('GetUser',_0x53c8f4);logger[_0x4f71('0x15')](_0x4f71('0xb'),_0x53c8f4,JSON[_0x4f71('0x16')](_0x50c4db));_0x503c44(_0x50c4db);})[_0x4f71('0x17')](function(_0x592b91){logger[_0x4f71('0x18')](_0x4f71('0xb'),_0x592b91[_0x4f71('0x19')],_0x53c8f4);_0x4c02c6(_0x587fc2[_0x4f71('0x18')](0x1f4,_0x592b91[_0x4f71('0x19')]));});});};exports[_0x4f71('0x1a')]=function(_0x52157c){var _0x562d3e=this;return new Promise(function(_0xec6d43,_0x551ca4){return db[_0x4f71('0x1b')]['find']({'raw':_0x52157c[_0x4f71('0xe')]?_0x52157c['options'][_0x4f71('0xd')]===undefined?!![]:![]:!![],'where':_0x52157c[_0x4f71('0xe')]?_0x52157c[_0x4f71('0xe')]['where']||null:null,'attributes':_0x52157c[_0x4f71('0xe')]?_0x52157c['options'][_0x4f71('0x14')]||null:null,'include':_0x52157c['options']?_0x52157c[_0x4f71('0xe')]['include']?_['map'](_0x52157c[_0x4f71('0xe')]['include'],function(_0x3e1da3){return{'model':db[_0x3e1da3['model']],'as':_0x3e1da3['as'],'attributes':_0x3e1da3[_0x4f71('0x14')],'include':_0x3e1da3[_0x4f71('0x11')]?_[_0x4f71('0x12')](_0x3e1da3[_0x4f71('0x11')],function(_0x38a813){return{'model':db[_0x38a813[_0x4f71('0x13')]],'as':_0x38a813['as'],'attributes':_0x38a813[_0x4f71('0x14')],'include':_0x38a813[_0x4f71('0x11')]?_['map'](_0x38a813['include'],function(_0x16bc7b){return{'model':db[_0x16bc7b[_0x4f71('0x13')]],'as':_0x16bc7b['as'],'attributes':_0x16bc7b[_0x4f71('0x14')]};}):[]};}):[]};}):[]:[]})[_0x4f71('0x1c')](function(_0x165dfc){logger['info']('ShowUser',_0x52157c);logger[_0x4f71('0x15')]('ShowUser',_0x52157c,JSON[_0x4f71('0x16')](_0x165dfc));_0xec6d43(_0x165dfc);})['catch'](function(_0x3a85ca){logger[_0x4f71('0x18')](_0x4f71('0x1a'),_0x3a85ca['message'],_0x52157c);_0x551ca4(_0x562d3e['error'](0x1f4,_0x3a85ca['message']));});});};exports[_0x4f71('0x1d')]=function(_0x24753c){var _0x4a64a0;return db[_0x4f71('0x1b')][_0x4f71('0x1e')]({'where':_0x24753c[_0x4f71('0xe')][_0x4f71('0xf')]||{},'attributes':['id',_0x4f71('0x1f'),'role','internal',_0x4f71('0x20')]})[_0x4f71('0x1c')](function(_0x2e48a5){if(!_0x2e48a5){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x24753c[_0x4f71('0x21')]['id']));}_0x4a64a0=_0x2e48a5;return db[_0x4f71('0x22')][_0x4f71('0x23')]({'paused':0x1},{'where':{'UserId':_0x4a64a0['id']},'individualHooks':!![]});})[_0x4f71('0x1c')](function(){return db[_0x4f71('0x24')][_0x4f71('0xc')]({'where':{'membername':_0x4a64a0[_0x4f71('0x1f')],'type':_0x4f71('0x25'),'exitAt':null}});})[_0x4f71('0x1c')](function(_0x4281ab){if(_0x4281ab&&_0x4281ab['length']){var _0x49dc19=moment()[_0x4f71('0x26')](_0x4f71('0x27'));for(var _0x624462=0x0,_0x4d8fdd=_0x4281ab[_0x4f71('0x28')];_0x624462<_0x4d8fdd;_0x624462++){_0x4281ab[_0x624462][_0x4f71('0x29')]({'exitAt':_0x49dc19});}}})[_0x4f71('0x1c')](function(){var _0x1b4cc0=[];var _0xf0540=utils[_0x4f71('0x2a')]();_0xf0540[_0x4f71('0x2b')](function(_0x6aff95){_0x1b4cc0[_0x4f71('0x2c')]({'channel':_0x6aff95,'membername':_0x4a64a0[_0x4f71('0x1f')],'interface':_[_0x4f71('0x2d')](_0x4a64a0['interface'])?util[_0x4f71('0x26')](_0x4f71('0x2e'),_0x4a64a0[_0x4f71('0x1f')]):_0x4a64a0[_0x4f71('0x20')],'type':'PAUSE','enterAt':moment()[_0x4f71('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x24753c[_0x4f71('0x2f')][_0x4f71('0x30')]||'DEFAULT\x20PAUSE','role':_0x4a64a0[_0x4f71('0x31')],'internal':_0x4a64a0[_0x4f71('0x32')],'uniqueid':_0x24753c[_0x4f71('0x2f')][_0x4f71('0x33')]||null});});return db[_0x4f71('0x24')][_0x4f71('0x34')](_0x1b4cc0,{'individualHooks':!![]});})[_0x4f71('0x1c')](function(){return _0x4a64a0[_0x4f71('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x24753c[_0x4f71('0x2f')][_0x4f71('0x30')]||_0x4f71('0x35'),'lastPauseAt':moment()[_0x4f71('0x26')](_0x4f71('0x27'))});})[_0x4f71('0x17')](function(_0x2a841e){throw _0x2a841e;});};exports[_0x4f71('0x36')]=function(_0x243c83){return Promise[_0x4f71('0x37')]()['then'](function(){if(_0x243c83[_0x4f71('0x2f')][_0x4f71('0x38')]&&!utils[_0x4f71('0x39')](_0x243c83[_0x4f71('0x2f')][_0x4f71('0x38')])){throw new Error(util[_0x4f71('0x26')](_0x4f71('0x3a'),_0x243c83[_0x4f71('0x2f')][_0x4f71('0x38')]));}return db[_0x4f71('0x1b')][_0x4f71('0x3b')]({'where':_0x243c83[_0x4f71('0xe')]['where']||{},'attributes':['id',_0x4f71('0x1f'),_0x4f71('0x31'),_0x4f71('0x32'),_0x4f71('0x20'),'online',_0x4f71('0x3c'),'mailPause',_0x4f71('0x3d'),'faxPause',_0x4f71('0x3e'),'smsPause',_0x4f71('0x3f'),_0x4f71('0x40'),_0x4f71('0x41')]});})[_0x4f71('0x1c')](function(_0x35f394){if(!_0x35f394){throw new Error(util[_0x4f71('0x26')](_0x4f71('0x42'),_0x243c83[_0x4f71('0x21')]['id']));}return _0x35f394[_0x4f71('0x43')](_0x243c83[_0x4f71('0x2f')][_0x4f71('0x38')],'system');})[_0x4f71('0x17')](function(_0x5426a9){throw _0x5426a9;});};exports[_0x4f71('0x44')]=function(_0x3b8d3b){var _0x26d80f=this;return new Promise(function(_0x37d4d1,_0x36c717){var _0x3657a7;return db[_0x4f71('0x1b')]['findOne']({'where':_0x3b8d3b[_0x4f71('0xe')][_0x4f71('0xf')]||{},'attributes':['id',_0x4f71('0x1f')]})[_0x4f71('0x1c')](function(_0x1e139f){if(_0x1e139f){_0x3657a7=_0x1e139f;return db[_0x4f71('0x22')]['destroy']({'where':{'membername':_0x3657a7[_0x4f71('0x1f')]},'individualHooks':!![]});}})[_0x4f71('0x1c')](function(){if(_0x3657a7){return db[_0x4f71('0x24')][_0x4f71('0xc')]({'where':{'membername':_0x3657a7[_0x4f71('0x1f')],'exitAt':null}});}})['then'](function(_0x347956){if(_0x3657a7){if(_0x347956&&_0x347956['length']){var _0x143c43=[];_0x347956['forEach'](function(_0x5cfbc8){_0x143c43[_0x4f71('0x2c')](_0x5cfbc8['update']({'exitAt':moment()[_0x4f71('0x26')](_0x4f71('0x27'))}));});return BPromise['all'](_0x143c43);}}})[_0x4f71('0x1c')](function(){if(_0x3657a7){return _0x3657a7['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4f71('0x1c')](function(_0xbceb57){_0x37d4d1(_0xbceb57);})[_0x4f71('0x17')](function(_0x10b042){_0x36c717(_0x26d80f[_0x4f71('0x18')](0x1f4,_0x10b042[_0x4f71('0x19')]));});});};exports['LoginUser']=function(_0x5b7a58){var _0x573c41=this;return new Promise(function(_0x28695c,_0x4c3247){var _0x3aa930;var _0x1b87ac;var _0x45728e;var _0x4f909b;return db['User'][_0x4f71('0x3b')]({'where':_0x5b7a58[_0x4f71('0xe')][_0x4f71('0xf')]||{},'attributes':['id','name',_0x4f71('0x31'),'mobile','phone',_0x4f71('0x32'),'loginInPause','interface']})[_0x4f71('0x1c')](function(_0x466d5c){if(_0x466d5c){_0x3aa930=_0x466d5c;_0x4f909b=_0x5b7a58[_0x4f71('0x2f')]['interface']?_0x5b7a58[_0x4f71('0x2f')][_0x4f71('0x20')]:util[_0x4f71('0x26')]('SIP/%s',_0x3aa930['name']);return db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3aa930['id']}}});}})['then'](function(_0x383eca){if(_0x383eca){_0x45728e=_0x383eca;return require(_0x4f71('0x45'))[_0x4f71('0x46')]();}})[_0x4f71('0x1c')](function(_0x49e078){if(_0x49e078&&_0x49e078[_0x4f71('0x47')]&&_0x45728e>=_0x49e078['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4f71('0x1c')](function(){if(_0x3aa930){return db['UserVoiceQueueRt'][_0x4f71('0x48')]({'where':{'membername':_0x3aa930[_0x4f71('0x1f')]},'individualHooks':!![]});}})[_0x4f71('0x1c')](function(){if(_0x3aa930){return _0x3aa930[_0x4f71('0x49')]({'raw':!![]});}})['then'](function(_0x19553f){if(_0x3aa930){if(_0x19553f){var _0xb01a2c=[];_0x1b87ac=_0x19553f;if(_0x1b87ac[_0x4f71('0x28')]){for(var _0x1279af=0x0;_0x1279af<_0x1b87ac[_0x4f71('0x28')];_0x1279af++){_0xb01a2c[_0x4f71('0x2c')](db[_0x4f71('0x22')][_0x4f71('0x4a')]({'membername':_0x3aa930[_0x4f71('0x1f')],'UserId':_0x3aa930['id'],'queue_name':_0x1b87ac[_0x1279af][_0x4f71('0x1f')],'VoiceQueueId':_0x1b87ac[_0x1279af]['id'],'interface':_0x4f909b,'paused':_0x3aa930[_0x4f71('0x4b')]||![],'penalty':_0x1b87ac[_0x1279af][_0x4f71('0x4c')]||0x0}));}return BPromise['all'](_0xb01a2c);}}}})['then'](function(){if(_0x3aa930){return db[_0x4f71('0x24')]['findAll']({'where':{'membername':_0x3aa930[_0x4f71('0x1f')],'exitAt':null}});}})[_0x4f71('0x1c')](function(_0xc1c9fc){if(_0x3aa930){if(_0xc1c9fc&&_0xc1c9fc[_0x4f71('0x28')]){var _0x59e57e=[];_0xc1c9fc['forEach'](function(_0x351ee6){_0x59e57e[_0x4f71('0x2c')](_0x351ee6['update']({'exitAt':moment()[_0x4f71('0x26')](_0x4f71('0x27'))}));});return BPromise[_0x4f71('0x4d')](_0x59e57e);}}})[_0x4f71('0x1c')](function(){if(_0x3aa930){var _0x1a66a1=[];var _0x5648f9=[];var _0x39398e=utils[_0x4f71('0x2a')]();var _0x2394e5={'membername':_0x3aa930['name'],'interface':_0x4f909b,'enterAt':moment()[_0x4f71('0x26')](_0x4f71('0x27')),'role':_0x3aa930[_0x4f71('0x31')],'internal':_0x3aa930[_0x4f71('0x32')]};_0x39398e['forEach'](function(_0x1c2758){_0x1a66a1[_0x4f71('0x2c')](_[_0x4f71('0x4e')]({'channel':_0x1c2758,'type':_0x4f71('0x4f'),'data1':'callysquare','data2':_0x4f909b},_0x2394e5));if(_0x3aa930[_0x4f71('0x4b')]){_0x5648f9[_0x4f71('0x2c')](_[_0x4f71('0x4e')]({'channel':_0x1c2758,'type':_0x4f71('0x25'),'data1':'LOGININPAUSE'},_0x2394e5));}});return db['MemberReport'][_0x4f71('0x34')](_0x1a66a1[_0x4f71('0x50')](_0x5648f9),{'individualHooks':!![]});}})[_0x4f71('0x1c')](function(){if(_0x3aa930){return _0x3aa930[_0x4f71('0x23')]({'online':!![],'lastLoginAt':moment()[_0x4f71('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3aa930[_0x4f71('0x4b')]||![],'mailPause':_0x3aa930[_0x4f71('0x4b')]||![],'chatPause':_0x3aa930[_0x4f71('0x4b')]||![],'faxPause':_0x3aa930[_0x4f71('0x4b')]||![],'smsPause':_0x3aa930['loginInPause']||![],'openchannelPause':_0x3aa930[_0x4f71('0x4b')]||![],'pauseType':_0x3aa930[_0x4f71('0x4b')]?_0x4f71('0x51'):null,'lastPauseAt':moment()[_0x4f71('0x26')](_0x4f71('0x27')),'interface':_0x4f909b});}})['then'](function(_0x205b8c){_0x28695c(_0x205b8c);})[_0x4f71('0x17')](function(_0x16a166){_0x4c3247(_0x573c41['error'](0x1f4,_0x16a166[_0x4f71('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3b18f16..3bbdeab 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 _0x8920=['emit','removeListener','register','length','user:','./user.events','remove'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x8920,0x1e8));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var UserEvents=require(_0x0892('0x0'));var events=['save',_0x0892('0x1'),'update'];function createListener(_0x1f7d12,_0x1b9026){return function(_0x3d7256){_0x1b9026[_0x0892('0x2')](_0x1f7d12,_0x3d7256);};}function removeListener(_0x2d3ae2,_0x4f4b11){return function(){UserEvents[_0x0892('0x3')](_0x2d3ae2,_0x4f4b11);};}exports[_0x0892('0x4')]=function(_0x5aa12e){for(var _0x4ce214=0x0,_0x13b6aa=events[_0x0892('0x5')];_0x4ce214<_0x13b6aa;_0x4ce214++){var _0x38628f=events[_0x4ce214];var _0x5ddfc1=createListener(_0x0892('0x6')+_0x38628f,_0x5aa12e);UserEvents['on'](_0x38628f,_0x5ddfc1);}}; \ No newline at end of file +var _0xc037=['emit','removeListener','register','length','user:','./user.events','save','update'];(function(_0x438770,_0x10b65b){var _0x2f5e64=function(_0x3bcaee){while(--_0x3bcaee){_0x438770['push'](_0x438770['shift']());}};_0x2f5e64(++_0x10b65b);}(_0xc037,0x75));var _0x7c03=function(_0x42ed32,_0x1d23de){_0x42ed32=_0x42ed32-0x0;var _0x4b808d=_0xc037[_0x42ed32];return _0x4b808d;};'use strict';var UserEvents=require(_0x7c03('0x0'));var events=[_0x7c03('0x1'),'remove',_0x7c03('0x2')];function createListener(_0x273e74,_0x1eb15b){return function(_0x288959){_0x1eb15b[_0x7c03('0x3')](_0x273e74,_0x288959);};}function removeListener(_0x221474,_0x30e26f){return function(){UserEvents[_0x7c03('0x4')](_0x221474,_0x30e26f);};}exports[_0x7c03('0x5')]=function(_0x348490){for(var _0x11eacc=0x0,_0x388eb8=events[_0x7c03('0x6')];_0x11eacc<_0x388eb8;_0x11eacc++){var _0x472c3e=events[_0x11eacc];var _0x287a3f=createListener(_0x7c03('0x7')+_0x472c3e,_0x348490);UserEvents['on'](_0x472c3e,_0x287a3f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6c91e7c..3b1b888 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e52bf,_0x4cfa32){var _0x2fdc63=function(_0x243d06){while(--_0x243d06){_0x1e52bf['push'](_0x1e52bf['shift']());}};_0x2fdc63(++_0x4cfa32);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x598b5d,_0x3f4d1e){var _0x54ab06=function(_0x1cf62e){while(--_0x1cf62e){_0x598b5d['push'](_0x598b5d['shift']());}};_0x54ab06(++_0x3f4d1e);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..f4cbbac 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa850=['sequelize','exports','INTEGER'];(function(_0x4549cf,_0x119501){var _0x283e7b=function(_0x520e71){while(--_0x520e71){_0x4549cf['push'](_0x4549cf['shift']());}};_0x283e7b(++_0x119501);}(_0xa850,0xb7));var _0x0a85=function(_0x1c5d4d,_0x4fe22c){_0x1c5d4d=_0x1c5d4d-0x0;var _0x58bbd2=_0xa850[_0x1c5d4d];return _0x58bbd2;};'use strict';var Sequelize=require(_0x0a85('0x0'));module[_0x0a85('0x1')]={'penalty':{'type':Sequelize[_0x0a85('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 01da586..67e6b65 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 _0x2bc1=['api','moment','bluebird','request-promise','path','rimraf','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x47598a,_0x11b181){var _0xbe321c=function(_0x5e9c32){while(--_0x5e9c32){_0x47598a['push'](_0x47598a['shift']());}};_0xbe321c(++_0x11b181);}(_0x2bc1,0xd1));var _0x12bc=function(_0x43e0c6,_0x4a7e28){_0x43e0c6=_0x43e0c6-0x0;var _0x2f98da=_0x2bc1[_0x43e0c6];return _0x2f98da;};'use strict';var _=require(_0x12bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12bc('0x1'));var moment=require(_0x12bc('0x2'));var BPromise=require(_0x12bc('0x3'));var rp=require(_0x12bc('0x4'));var fs=require('fs');var path=require(_0x12bc('0x5'));var rimraf=require(_0x12bc('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x12bc('0x7')]=function(_0x3b649d,_0x4b3ed5){return _0x3b649d['define'](_0x12bc('0x8'),attributes,{'tableName':_0x12bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c92=['exports','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes'];(function(_0xb8fd40,_0x23030a){var _0x46fcde=function(_0x1a22ff){while(--_0x1a22ff){_0xb8fd40['push'](_0xb8fd40['shift']());}};_0x46fcde(++_0x23030a);}(_0x7c92,0x136));var _0x27c9=function(_0x406d6c,_0x512e41){_0x406d6c=_0x406d6c-0x0;var _0x4b4792=_0x7c92[_0x406d6c];return _0x4b4792;};'use strict';var _=require(_0x27c9('0x0'));var util=require(_0x27c9('0x1'));var logger=require(_0x27c9('0x2'))('api');var moment=require(_0x27c9('0x3'));var BPromise=require(_0x27c9('0x4'));var rp=require(_0x27c9('0x5'));var fs=require('fs');var path=require(_0x27c9('0x6'));var rimraf=require(_0x27c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x27c9('0x8'));module[_0x27c9('0x9')]=function(_0x2fa9c4,_0x5781c6){return _0x2fa9c4['define']('UserChatQueue',attributes,{'tableName':_0x27c9('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 da5c3cd..df85be1 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 _0x03f0=['../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0x03f0,0xa9));var _0x003f=function(_0x2df752,_0x6a411c){_0x2df752=_0x2df752-0x0;var _0x1ed254=_0x03f0[_0x2df752];return _0x1ed254;};'use strict';var _=require(_0x003f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x003f('0x1'));var fs=require('fs');var Redis=require(_0x003f('0x2'));var db=require(_0x003f('0x3'))['db'];var utils=require(_0x003f('0x4'));var logger=require(_0x003f('0x5'))(_0x003f('0x6'));var config=require(_0x003f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x003f('0x8')][_0x003f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12989c,_0x1f5d12,_0xaf179a){return new BPromise(function(_0x3e58f3,_0x407dba){return client[_0x003f('0xa')](_0x12989c,_0xaf179a)[_0x003f('0xb')](function(_0x39769a){logger[_0x003f('0xc')](_0x003f('0xd'),_0x1f5d12,_0x003f('0xe'));logger[_0x003f('0xf')](_0x003f('0x10'),_0x1f5d12,_0x003f('0xe'),JSON[_0x003f('0x11')](_0x39769a));if(_0x39769a[_0x003f('0x12')]){if(_0x39769a[_0x003f('0x12')]['code']===0x1f4){logger[_0x003f('0x12')](_0x003f('0xd'),_0x1f5d12,_0x39769a['error'][_0x003f('0x13')]);return _0x407dba(_0x39769a[_0x003f('0x12')]['message']);}logger[_0x003f('0x12')](_0x003f('0xd'),_0x1f5d12,_0x39769a[_0x003f('0x12')][_0x003f('0x13')]);return _0x3e58f3(_0x39769a[_0x003f('0x12')][_0x003f('0x13')]);}else{logger[_0x003f('0xc')](_0x003f('0xd'),_0x1f5d12,_0x003f('0xe'));_0x3e58f3(_0x39769a[_0x003f('0x14')]['message']);}})[_0x003f('0x15')](function(_0x3cbc7a){logger[_0x003f('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x1f5d12,_0x3cbc7a);_0x407dba(_0x3cbc7a);});});} \ No newline at end of file +var _0xb4a5=['jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','rpc','../../config/environment'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0xb4a5,0x10c));var _0x5b4a=function(_0xf4c553,_0x417ba6){_0xf4c553=_0xf4c553-0x0;var _0x2946c1=_0xb4a5[_0xf4c553];return _0x2946c1;};'use strict';var _=require(_0x5b4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b4a('0x1'));var fs=require('fs');var Redis=require(_0x5b4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b4a('0x3'));var config=require(_0x5b4a('0x4'));var jayson=require(_0x5b4a('0x5'));var client=jayson[_0x5b4a('0x6')][_0x5b4a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16f718,_0x7cf0d0,_0x5e8214){return new BPromise(function(_0x636711,_0x4011b6){return client[_0x5b4a('0x8')](_0x16f718,_0x5e8214)[_0x5b4a('0x9')](function(_0x208daa){logger['info'](_0x5b4a('0xa'),_0x7cf0d0,_0x5b4a('0xb'));logger[_0x5b4a('0xc')](_0x5b4a('0xd'),_0x7cf0d0,_0x5b4a('0xb'),JSON[_0x5b4a('0xe')](_0x208daa));if(_0x208daa[_0x5b4a('0xf')]){if(_0x208daa[_0x5b4a('0xf')][_0x5b4a('0x10')]===0x1f4){logger[_0x5b4a('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x7cf0d0,_0x208daa[_0x5b4a('0xf')][_0x5b4a('0x11')]);return _0x4011b6(_0x208daa[_0x5b4a('0xf')][_0x5b4a('0x11')]);}logger[_0x5b4a('0xf')](_0x5b4a('0xa'),_0x7cf0d0,_0x208daa[_0x5b4a('0xf')]['message']);return _0x636711(_0x208daa[_0x5b4a('0xf')][_0x5b4a('0x11')]);}else{logger[_0x5b4a('0x12')](_0x5b4a('0xa'),_0x7cf0d0,_0x5b4a('0xb'));_0x636711(_0x208daa[_0x5b4a('0x13')][_0x5b4a('0x11')]);}})[_0x5b4a('0x14')](function(_0x4ed3f0){logger[_0x5b4a('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x7cf0d0,_0x4ed3f0);_0x4011b6(_0x4ed3f0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 80fbdac..054bc9e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b9759,_0x1b4663){var _0x586588=function(_0x28b4cb){while(--_0x28b4cb){_0x5b9759['push'](_0x5b9759['shift']());}};_0x586588(++_0x1b4663);}(_0xe706,0xa3));var _0x6e70=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0xe706[_0x1b0597];return _0x2b6a2a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x24ce50,_0x1bb25a){var _0x183922=function(_0x189d38){while(--_0x189d38){_0x24ce50['push'](_0x24ce50['shift']());}};_0x183922(++_0x1bb25a);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c4586c7..d983514 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 _0x5d85=['sequelize','exports','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5d85,0xf9));var _0x55d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d85[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x55d8('0x0'));module[_0x55d8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x55d8('0x2')]}}; \ No newline at end of file +var _0x967f=['STRING','sequelize','exports','INTEGER'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x967f,0x18d));var _0xf967=function(_0x169c86,_0x438e8d){_0x169c86=_0x169c86-0x0;var _0x1d01c9=_0x967f[_0x169c86];return _0x1d01c9;};'use strict';var Sequelize=require(_0xf967('0x0'));module[_0xf967('0x1')]={'penalty':{'type':Sequelize[_0xf967('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf967('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf967('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bf94ca2..c709a46 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 _0x25d1=['./userFaxQueue.attributes','define','user_has_fax_queues','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x67cade,_0x37f580){var _0x5f4f0d=function(_0x537036){while(--_0x537036){_0x67cade['push'](_0x67cade['shift']());}};_0x5f4f0d(++_0x37f580);}(_0x25d1,0x157));var _0x125d=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0x25d1[_0x3a902a];return _0x24f2d5;};'use strict';var _=require('lodash');var util=require(_0x125d('0x0'));var logger=require(_0x125d('0x1'))(_0x125d('0x2'));var moment=require(_0x125d('0x3'));var BPromise=require('bluebird');var rp=require(_0x125d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x125d('0x5'));var config=require(_0x125d('0x6'));var attributes=require(_0x125d('0x7'));module['exports']=function(_0x195b67,_0x4ea44c){return _0x195b67[_0x125d('0x8')]('UserFaxQueue',attributes,{'tableName':_0x125d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x597e=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x234ee4,_0xd7dcdf){var _0x237f54=function(_0x23dc1d){while(--_0x23dc1d){_0x234ee4['push'](_0x234ee4['shift']());}};_0x237f54(++_0xd7dcdf);}(_0x597e,0xd0));var _0xe597=function(_0x599f29,_0x27ccea){_0x599f29=_0x599f29-0x0;var _0x593965=_0x597e[_0x599f29];return _0x593965;};'use strict';var _=require(_0xe597('0x0'));var util=require(_0xe597('0x1'));var logger=require(_0xe597('0x2'))('api');var moment=require(_0xe597('0x3'));var BPromise=require(_0xe597('0x4'));var rp=require(_0xe597('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe597('0x6'));var attributes=require(_0xe597('0x7'));module[_0xe597('0x8')]=function(_0x4da0c3,_0x4fe480){return _0x4da0c3['define'](_0xe597('0x9'),attributes,{'tableName':_0xe597('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4f92c86..f48bdb0 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 _0x65b6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2f67ea,_0x5962d9){var _0x108f66=function(_0x11501a){while(--_0x11501a){_0x2f67ea['push'](_0x2f67ea['shift']());}};_0x108f66(++_0x5962d9);}(_0x65b6,0x9c));var _0x665b=function(_0x8a84e7,_0x5296e0){_0x8a84e7=_0x8a84e7-0x0;var _0x2e4353=_0x65b6[_0x8a84e7];return _0x2e4353;};'use strict';var _=require('lodash');var util=require(_0x665b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x665b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x665b('0x2'))['db'];var utils=require(_0x665b('0x3'));var logger=require('../../config/logger')(_0x665b('0x4'));var config=require(_0x665b('0x5'));var jayson=require(_0x665b('0x6'));var client=jayson[_0x665b('0x7')][_0x665b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493451,_0x13ca90,_0x318974){return new BPromise(function(_0x1befb2,_0x17f893){return client[_0x665b('0x9')](_0x493451,_0x318974)[_0x665b('0xa')](function(_0x3ef3e6){logger[_0x665b('0xb')](_0x665b('0xc'),_0x13ca90,_0x665b('0xd'));logger[_0x665b('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x13ca90,_0x665b('0xd'),JSON['stringify'](_0x3ef3e6));if(_0x3ef3e6[_0x665b('0xf')]){if(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x10')]===0x1f4){logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);return _0x17f893(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);}logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);return _0x1befb2(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);}else{logger[_0x665b('0xb')](_0x665b('0xc'),_0x13ca90,_0x665b('0xd'));_0x1befb2(_0x3ef3e6[_0x665b('0x12')][_0x665b('0x11')]);}})[_0x665b('0x13')](function(_0xb94fb0){logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0xb94fb0);_0x17f893(_0xb94fb0);});});} \ No newline at end of file +var _0x3094=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x56db08,_0x250fe1){var _0x293806=function(_0x110049){while(--_0x110049){_0x56db08['push'](_0x56db08['shift']());}};_0x293806(++_0x250fe1);}(_0x3094,0x186));var _0x4309=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3094[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4309('0x0'));var util=require(_0x4309('0x1'));var moment=require(_0x4309('0x2'));var BPromise=require(_0x4309('0x3'));var rs=require(_0x4309('0x4'));var fs=require('fs');var Redis=require(_0x4309('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4309('0x6'));var logger=require(_0x4309('0x7'))(_0x4309('0x8'));var config=require(_0x4309('0x9'));var jayson=require(_0x4309('0xa'));var client=jayson[_0x4309('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25aee6,_0x3e8ac7,_0x51c10e){return new BPromise(function(_0x41713d,_0x75114d){return client[_0x4309('0xc')](_0x25aee6,_0x51c10e)[_0x4309('0xd')](function(_0xb60473){logger[_0x4309('0xe')](_0x4309('0xf'),_0x3e8ac7,_0x4309('0x10'));logger[_0x4309('0x11')](_0x4309('0x12'),_0x3e8ac7,_0x4309('0x10'),JSON[_0x4309('0x13')](_0xb60473));if(_0xb60473[_0x4309('0x14')]){if(_0xb60473[_0x4309('0x14')]['code']===0x1f4){logger[_0x4309('0x14')](_0x4309('0xf'),_0x3e8ac7,_0xb60473[_0x4309('0x14')][_0x4309('0x15')]);return _0x75114d(_0xb60473[_0x4309('0x14')][_0x4309('0x15')]);}logger[_0x4309('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x3e8ac7,_0xb60473[_0x4309('0x14')][_0x4309('0x15')]);return _0x41713d(_0xb60473[_0x4309('0x14')][_0x4309('0x15')]);}else{logger['info'](_0x4309('0xf'),_0x3e8ac7,_0x4309('0x10'));_0x41713d(_0xb60473[_0x4309('0x16')][_0x4309('0x15')]);}})['catch'](function(_0x3c365a){logger[_0x4309('0x14')](_0x4309('0xf'),_0x3e8ac7,_0x3c365a);_0x75114d(_0x3c365a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 60c4de8..b020ad6 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(_0xbf8f73,_0x2ca243){var _0x53d9a9=function(_0x7c851d){while(--_0x7c851d){_0xbf8f73['push'](_0xbf8f73['shift']());}};_0x53d9a9(++_0x2ca243);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35a6c1,_0x2e3174){var _0x59dcfa=function(_0x124edd){while(--_0x124edd){_0x35a6c1['push'](_0x35a6c1['shift']());}};_0x59dcfa(++_0x2e3174);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xcb91[_0x420b24];return _0x4da552;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f86e5cf..3c09254 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 _0x599e=['sequelize'];(function(_0x2e04bf,_0xa06a0e){var _0x3281af=function(_0x489bb0){while(--_0x489bb0){_0x2e04bf['push'](_0x2e04bf['shift']());}};_0x3281af(++_0xa06a0e);}(_0x599e,0x1a9));var _0xe599=function(_0x527191,_0x51329d){_0x527191=_0x527191-0x0;var _0x57f753=_0x599e[_0x527191];return _0x57f753;};'use strict';var Sequelize=require(_0xe599('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa12e=['sequelize','exports','INTEGER'];(function(_0x2bca3e,_0x2baaf5){var _0x1177c5=function(_0x409e79){while(--_0x409e79){_0x2bca3e['push'](_0x2bca3e['shift']());}};_0x1177c5(++_0x2baaf5);}(_0xa12e,0x6f));var _0xea12=function(_0x4d1be0,_0x135738){_0x4d1be0=_0x4d1be0-0x0;var _0x47d662=_0xa12e[_0x4d1be0];return _0x47d662;};'use strict';var Sequelize=require(_0xea12('0x0'));module[_0xea12('0x1')]={'penalty':{'type':Sequelize[_0xea12('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 87a9fa1..7c7e85d 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 _0xe008=['bluebird','request-promise','./userMailQueue.attributes','exports','user_has_mail_queues','lodash','../../config/logger','api','moment'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0xe008,0xdd));var _0x8e00=function(_0x5d695b,_0x3f9907){_0x5d695b=_0x5d695b-0x0;var _0x2fdda7=_0xe008[_0x5d695b];return _0x2fdda7;};'use strict';var _=require(_0x8e00('0x0'));var util=require('util');var logger=require(_0x8e00('0x1'))(_0x8e00('0x2'));var moment=require(_0x8e00('0x3'));var BPromise=require(_0x8e00('0x4'));var rp=require(_0x8e00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e00('0x6'));module[_0x8e00('0x7')]=function(_0x39b658,_0x38ed02){return _0x39b658['define']('UserMailQueue',attributes,{'tableName':_0x8e00('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe55e=['rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xe55e,0x1d1));var _0xee55=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe55e[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee55('0x0'))(_0xee55('0x1'));var moment=require('moment');var BPromise=require(_0xee55('0x2'));var rp=require(_0xee55('0x3'));var fs=require('fs');var path=require(_0xee55('0x4'));var rimraf=require(_0xee55('0x5'));var config=require(_0xee55('0x6'));var attributes=require(_0xee55('0x7'));module['exports']=function(_0x2145e6,_0x47fc76){return _0x2145e6[_0xee55('0x8')](_0xee55('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e77fa26..fd2b88b 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2cd777,_0x35d9da){var _0x44e91b=function(_0x1a4f4d){while(--_0x1a4f4d){_0x2cd777['push'](_0x2cd777['shift']());}};_0x44e91b(++_0x35d9da);}(_0xa41a,0x6b));var _0xaa41=function(_0x1ef618,_0x2194a0){_0x1ef618=_0x1ef618-0x0;var _0x24f8ab=_0xa41a[_0x1ef618];return _0x24f8ab;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x008c,0x188));var _0xc008=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x008c[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f5e2164..6463725 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 _0x8c22=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x190343,_0x42789b){var _0x53556a=function(_0x159fa2){while(--_0x159fa2){_0x190343['push'](_0x190343['shift']());}};_0x53556a(++_0x42789b);}(_0x8c22,0xc4));var _0x28c2=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x8c22[_0x4ddfe1];return _0x4aaf51;};'use strict';var multer=require(_0x28c2('0x0'));var util=require(_0x28c2('0x1'));var path=require(_0x28c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x28c2('0x3'));var router=express['Router']();var fs_extra=require(_0x28c2('0x4'));var auth=require(_0x28c2('0x5'));var interaction=require(_0x28c2('0x6'));var config=require(_0x28c2('0x7'));var controller=require(_0x28c2('0x8'));router[_0x28c2('0x9')]('/',auth[_0x28c2('0xa')](),controller[_0x28c2('0xb')]);module[_0x28c2('0xc')]=router; \ No newline at end of file +var _0x51d8=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x51d8,0x1e1));var _0x851d=function(_0x154be6,_0x23a225){_0x154be6=_0x154be6-0x0;var _0x204cac=_0x51d8[_0x154be6];return _0x204cac;};'use strict';var multer=require('multer');var util=require(_0x851d('0x0'));var path=require(_0x851d('0x1'));var timeout=require(_0x851d('0x2'));var express=require('express');var router=express[_0x851d('0x3')]();var fs_extra=require(_0x851d('0x4'));var auth=require(_0x851d('0x5'));var interaction=require(_0x851d('0x6'));var config=require(_0x851d('0x7'));var controller=require(_0x851d('0x8'));router['post']('/',auth[_0x851d('0x9')](),controller[_0x851d('0xa')]);module[_0x851d('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 7cb2ffb..0f7ac25 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 _0xc3b7=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xc3b7,0x193));var _0x7c3b=function(_0x5d7bb7,_0xfa7e5e){_0x5d7bb7=_0x5d7bb7-0x0;var _0x38f4ea=_0xc3b7[_0x5d7bb7];return _0x38f4ea;};'use strict';var Sequelize=require(_0x7c3b('0x0'));module[_0x7c3b('0x1')]={'body':{'type':Sequelize[_0x7c3b('0x2')]},'senderName':{'type':Sequelize[_0x7c3b('0x3')]},'recipientsId':{'type':Sequelize[_0x7c3b('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7c3b('0x3')]},'beep':{'type':Sequelize[_0x7c3b('0x4')]}}; \ No newline at end of file +var _0x07df=['STRING','TEXT'];(function(_0x361d1a,_0x23ddda){var _0x2fa81a=function(_0x37f5ba){while(--_0x37f5ba){_0x361d1a['push'](_0x361d1a['shift']());}};_0x2fa81a(++_0x23ddda);}(_0x07df,0x19b));var _0xf07d=function(_0x7c0634,_0x3fcf6b){_0x7c0634=_0x7c0634-0x0;var _0x28b384=_0x07df[_0x7c0634];return _0x28b384;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xf07d('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xf07d('0x0')]},'recipientsDescription':{'type':Sequelize[_0xf07d('0x1')]},'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 65a7b38..721b298 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 _0xe06b=['some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','model','queue','Queue','ids','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','undefined','offset','count','apply','reject','save','update','then','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user'];(function(_0x5b192c,_0x56bb3f){var _0x41c977=function(_0x3d7441){while(--_0x3d7441){_0x5b192c['push'](_0x5b192c['shift']());}};_0x41c977(++_0x56bb3f);}(_0xe06b,0x13e));var _0xbe06=function(_0x16d013,_0x3e8f09){_0x16d013=_0x16d013-0x0;var _0x9b3d93=_0xe06b[_0x16d013];return _0x9b3d93;};'use strict';var emlformat=require(_0xbe06('0x0'));var rimraf=require(_0xbe06('0x1'));var zipdir=require(_0xbe06('0x2'));var jsonpatch=require(_0xbe06('0x3'));var rp=require('request-promise');var moment=require(_0xbe06('0x4'));var BPromise=require(_0xbe06('0x5'));var Mustache=require(_0xbe06('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbe06('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe06('0x8'));var _=require(_0xbe06('0x9'));var squel=require(_0xbe06('0xa'));var crypto=require(_0xbe06('0xb'));var jsforce=require(_0xbe06('0xc'));var deskjs=require(_0xbe06('0xd'));var toCsv=require(_0xbe06('0x7'));var querystring=require('querystring');var Papa=require(_0xbe06('0xe'));var Redis=require(_0xbe06('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe06('0x10'));var as=require(_0xbe06('0x11'));var hardwareService=require(_0xbe06('0x12'));var logger=require(_0xbe06('0x13'))(_0xbe06('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe06('0x15'));var db=require(_0xbe06('0x16'))['db'];config[_0xbe06('0x17')]=_['defaults'](config[_0xbe06('0x17')],{'host':_0xbe06('0x18'),'port':0x18eb});var socket=require(_0xbe06('0x19'))(new Redis(config[_0xbe06('0x17')]));require(_0xbe06('0x1a'))[_0xbe06('0x1b')](socket);function respondWithStatusCode(_0x1a8e49,_0x4d3ac5){_0x4d3ac5=_0x4d3ac5||0xcc;return function(_0x41765d){if(_0x41765d){return _0x1a8e49[_0xbe06('0x1c')](_0x4d3ac5);}return _0x1a8e49['status'](_0x4d3ac5)['end']();};}function respondWithResult(_0x4b2d9a,_0x539983){_0x539983=_0x539983||0xc8;return function(_0x5457ec){if(_0x5457ec){return _0x4b2d9a[_0xbe06('0x1d')](_0x539983)[_0xbe06('0x1e')](_0x5457ec);}};}function respondWithFilteredResult(_0x251b09,_0x1c18a7){return function(_0xf6f37e){if(_0xf6f37e){var _0x56f8db=typeof _0x1c18a7['offset']===_0xbe06('0x1f')&&typeof _0x1c18a7['limit']===_0xbe06('0x1f');var _0x428cd8=_0xf6f37e['count'];var _0x1ee4e9=_0x56f8db?0x0:_0x1c18a7[_0xbe06('0x20')];var _0x4c9cab=_0x56f8db?_0xf6f37e[_0xbe06('0x21')]:_0x1c18a7[_0xbe06('0x20')]+_0x1c18a7['limit'];var _0x45e62b;if(_0x4c9cab>=_0x428cd8){_0x4c9cab=_0x428cd8;_0x45e62b=0xc8;}else{_0x45e62b=0xce;}_0x251b09[_0xbe06('0x1d')](_0x45e62b);return _0x251b09['set']('Content-Range',_0x1ee4e9+'-'+_0x4c9cab+'/'+_0x428cd8)[_0xbe06('0x1e')](_0xf6f37e);}return null;};}function patchUpdates(_0x3f46a0){return function(_0x35c239){try{jsonpatch[_0xbe06('0x22')](_0x35c239,_0x3f46a0,!![]);}catch(_0x1180d8){return BPromise[_0xbe06('0x23')](_0x1180d8);}return _0x35c239[_0xbe06('0x24')]();};}function saveUpdates(_0x20cd41,_0x4c2397){return function(_0x3e570a){if(_0x3e570a){return _0x3e570a[_0xbe06('0x25')](_0x20cd41)[_0xbe06('0x26')](function(_0x9ad8a3){return _0x9ad8a3;});}return null;};}function removeEntity(_0x84fcaa,_0x2e1a71){return function(_0x20368c){if(_0x20368c){return _0x20368c['destroy']()['then'](function(){_0x84fcaa['status'](0xcc)[_0xbe06('0x27')]();});}};}function handleEntityNotFound(_0x46380e,_0x2ae2a3){return function(_0x54cc13){if(!_0x54cc13){_0x46380e[_0xbe06('0x1c')](0x194);}return _0x54cc13;};}function handleError(_0x5854fe,_0x31b418){_0x31b418=_0x31b418||0x1f4;return function(_0x881edd){logger[_0xbe06('0x28')](_0x881edd[_0xbe06('0x29')]);if(_0x881edd[_0xbe06('0x2a')]){delete _0x881edd[_0xbe06('0x2a')];}_0x5854fe['status'](_0x31b418)[_0xbe06('0x2b')](_0x881edd);};}exports[_0xbe06('0x2c')]=function(_0x1886f8,_0x16473b,_0x26ebaf){if(!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')]('text')&&!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0xbe06('0x2f'))](_0xbe06('0x30'));}else{if(_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x31'))&&!_0x1886f8[_0xbe06('0x2d')]['hasOwnProperty'](_0xbe06('0x32'))){throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x34'))){throw new db[(_0xbe06('0x33'))]['ValidationError'](_0xbe06('0x35'));}else{try{var _0x101de7=JSON[_0xbe06('0x36')](_0x1886f8['body'][_0xbe06('0x34')]);}catch(_0x520cd1){logger[_0xbe06('0x28')](_0x520cd1);throw new db['Sequelize']['ValidationError'](_0xbe06('0x37'));}var _0x30aac4=['chatqueue',_0xbe06('0x38'),_0xbe06('0x39'),_0xbe06('0x3a'),'smsqueue',_0xbe06('0x3b'),'whatsappqueue',_0xbe06('0x3c'),_0xbe06('0x3d')];if(_[_0xbe06('0x3e')](_0x101de7,function(_0x564384){return!_[_0xbe06('0x3f')](_0x30aac4,_0x564384['model'][_0xbe06('0x40')]());})){throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))](_0xbe06('0x41'));}}}var _0x290f0b={};_0x290f0b[_0xbe06('0x42')]=_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x42'))?_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x42')]:_0x1886f8[_0xbe06('0x3d')][_0xbe06('0x43')];_0x290f0b[_0xbe06('0x44')]=_['isEmpty'](_0x1886f8['body'][_0xbe06('0x44')])?null:_0x1886f8['body'][_0xbe06('0x44')];_0x290f0b[_0xbe06('0x45')]=_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x45')]||![];_0x290f0b['SenderId']=_0x1886f8[_0xbe06('0x3d')]['id'];return getContent(_0x1886f8['body'])['then'](function(_0x4c9c08){_0x290f0b[_0xbe06('0x2d')]=_0x4c9c08;return getRecipients(_0x101de7);})[_0xbe06('0x26')](function(_0x2d9f85){_0x290f0b[_0xbe06('0x46')]=_['sortBy'](_0x2d9f85)[_0xbe06('0x47')](',');return db[_0xbe06('0x48')][_0xbe06('0x49')](function(_0x20f95f){return db[_0xbe06('0x4a')][_0xbe06('0x4b')](_0x290f0b,{'raw':!![],'transaction':_0x20f95f})[_0xbe06('0x26')](function(_0x1d9a53){var _0x5c0886={'sender':_0x290f0b['senderName'],'description':_0x290f0b[_0xbe06('0x44')],'content':_0x290f0b[_0xbe06('0x2d')],'beep':_0x290f0b[_0xbe06('0x45')]};_0x2d9f85[_0xbe06('0x4c')](function(_0x1fecc1){_0x5c0886[_0xbe06('0x4d')]=_0x1fecc1;socket[_0xbe06('0x4e')]('userNotification:send',_0x5c0886);});return _0x1d9a53;});});})[_0xbe06('0x26')](respondWithResult(_0x16473b,0xc9))[_0xbe06('0x4f')](handleError(_0x16473b,null));};function getContent(_0x14b8a9){return new BPromise(function(_0x1ef58c,_0x18f964){if(_0x14b8a9[_0xbe06('0x50')]){_0x1ef58c(_0x14b8a9[_0xbe06('0x50')]);return;}return db[_0xbe06('0x51')][_0xbe06('0x52')]({'attributes':['html'],'where':{'id':_0x14b8a9[_0xbe06('0x31')]},'raw':!![]})[_0xbe06('0x26')](function(_0x18024f){if(!_0x18024f)throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))](_0xbe06('0x53'));var _0x59cef9=Mustache[_0xbe06('0x54')](_0x18024f[_0xbe06('0x55')],_0x14b8a9['view']);_0x1ef58c(_0x59cef9);})[_0xbe06('0x4f')](function(_0x149083){_0x18f964(_0x149083);});});}function getRecipients(_0x1859e6){return new BPromise(function(_0x5648bc,_0x3b4329){var _0x53c628=[];var _0x15c488=[];_0x1859e6[_0xbe06('0x4c')](function(_0x372170){var _0x5e3ab6=_[_0xbe06('0x56')](_0x372170[_0xbe06('0x57')][_0xbe06('0x40')]());if(_0x5e3ab6==='User'){_0x53c628=_['union'](_0x53c628,_0x372170['ids']);}else{if(_[_0xbe06('0x3f')](_0x5e3ab6,_0xbe06('0x58')))_0x5e3ab6=_0x5e3ab6['replace'](_0xbe06('0x58'),_0xbe06('0x59'));_0x372170[_0xbe06('0x5a')]['forEach'](function(_0x46dda9){_0x15c488[_0xbe06('0x5b')](getAgents(_0x5e3ab6,_0x46dda9));});}});return BPromise[_0xbe06('0x5c')](_0x15c488)[_0xbe06('0x26')](function(_0x352070){_0x53c628=_['union'](_0x53c628,_[_0xbe06('0x5d')](_0x352070));_0x5648bc(_0x53c628);})[_0xbe06('0x4f')](function(_0x14800a){_0x3b4329(_0x14800a);});});}function getAgents(_0x40786b,_0x11da60){return new BPromise(function(_0x3cf6b2,_0x4b7c2a){return db[_0x40786b][_0xbe06('0x52')]({'where':{'id':_0x11da60}})[_0xbe06('0x26')](function(_0xa44881){return _0xa44881['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x53c95a){var _0x386b9e=_[_0xbe06('0x5e')](_0x53c95a,'id');_0x3cf6b2(_0x386b9e);});})[_0xbe06('0x4f')](function(_0x113d10){_0x4b7c2a(_0x113d10);});});} \ No newline at end of file +var _0xfcd0=['limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','replace','queue','Queue','push','all','union','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','undefined'];(function(_0x4d845f,_0x536172){var _0x49fd7d=function(_0xf1aaf9){while(--_0xf1aaf9){_0x4d845f['push'](_0x4d845f['shift']());}};_0x49fd7d(++_0x536172);}(_0xfcd0,0x17a));var _0x0fcd=function(_0x5c2cc5,_0x415783){_0x5c2cc5=_0x5c2cc5-0x0;var _0x4b8f5a=_0xfcd0[_0x5c2cc5];return _0x4b8f5a;};'use strict';var emlformat=require(_0x0fcd('0x0'));var rimraf=require(_0x0fcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcd('0x2'));var rp=require('request-promise');var moment=require(_0x0fcd('0x3'));var BPromise=require(_0x0fcd('0x4'));var Mustache=require(_0x0fcd('0x5'));var util=require(_0x0fcd('0x6'));var path=require(_0x0fcd('0x7'));var sox=require(_0x0fcd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fcd('0x9'));var squel=require(_0x0fcd('0xa'));var crypto=require('crypto');var jsforce=require(_0x0fcd('0xb'));var deskjs=require(_0x0fcd('0xc'));var toCsv=require(_0x0fcd('0xd'));var querystring=require(_0x0fcd('0xe'));var Papa=require(_0x0fcd('0xf'));var Redis=require(_0x0fcd('0x10'));var authService=require(_0x0fcd('0x11'));var qs=require(_0x0fcd('0x12'));var as=require(_0x0fcd('0x13'));var hardwareService=require(_0x0fcd('0x14'));var logger=require('../../config/logger')(_0x0fcd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0fcd('0x16'));var db=require(_0x0fcd('0x17'))['db'];config[_0x0fcd('0x18')]=_[_0x0fcd('0x19')](config['redis'],{'host':_0x0fcd('0x1a'),'port':0x18eb});var socket=require(_0x0fcd('0x1b'))(new Redis(config[_0x0fcd('0x18')]));require(_0x0fcd('0x1c'))[_0x0fcd('0x1d')](socket);function respondWithStatusCode(_0xbf1b08,_0x5f0cf6){_0x5f0cf6=_0x5f0cf6||0xcc;return function(_0x148c0d){if(_0x148c0d){return _0xbf1b08[_0x0fcd('0x1e')](_0x5f0cf6);}return _0xbf1b08['status'](_0x5f0cf6)[_0x0fcd('0x1f')]();};}function respondWithResult(_0xe13238,_0x472f63){_0x472f63=_0x472f63||0xc8;return function(_0x38f159){if(_0x38f159){return _0xe13238[_0x0fcd('0x20')](_0x472f63)['json'](_0x38f159);}};}function respondWithFilteredResult(_0x64fc1d,_0x19bc86){return function(_0x2b0d17){if(_0x2b0d17){var _0x5b2adb=typeof _0x19bc86['offset']===_0x0fcd('0x21')&&typeof _0x19bc86[_0x0fcd('0x22')]===_0x0fcd('0x21');var _0x653487=_0x2b0d17['count'];var _0x4bb614=_0x5b2adb?0x0:_0x19bc86['offset'];var _0x147c42=_0x5b2adb?_0x2b0d17[_0x0fcd('0x23')]:_0x19bc86[_0x0fcd('0x24')]+_0x19bc86['limit'];var _0x31aa48;if(_0x147c42>=_0x653487){_0x147c42=_0x653487;_0x31aa48=0xc8;}else{_0x31aa48=0xce;}_0x64fc1d[_0x0fcd('0x20')](_0x31aa48);return _0x64fc1d[_0x0fcd('0x25')](_0x0fcd('0x26'),_0x4bb614+'-'+_0x147c42+'/'+_0x653487)['json'](_0x2b0d17);}return null;};}function patchUpdates(_0x1666c6){return function(_0x4c65ec){try{jsonpatch['apply'](_0x4c65ec,_0x1666c6,!![]);}catch(_0x4bdbc4){return BPromise[_0x0fcd('0x27')](_0x4bdbc4);}return _0x4c65ec[_0x0fcd('0x28')]();};}function saveUpdates(_0x3a0241,_0x33327d){return function(_0x21be08){if(_0x21be08){return _0x21be08[_0x0fcd('0x29')](_0x3a0241)[_0x0fcd('0x2a')](function(_0x76100e){return _0x76100e;});}return null;};}function removeEntity(_0x5f349c,_0xda3b98){return function(_0x6ead4a){if(_0x6ead4a){return _0x6ead4a[_0x0fcd('0x2b')]()['then'](function(){_0x5f349c[_0x0fcd('0x20')](0xcc)[_0x0fcd('0x1f')]();});}};}function handleEntityNotFound(_0x18b836,_0x29a1b9){return function(_0x2b0763){if(!_0x2b0763){_0x18b836[_0x0fcd('0x1e')](0x194);}return _0x2b0763;};}function handleError(_0x275f0f,_0x83035){_0x83035=_0x83035||0x1f4;return function(_0x4cd43e){logger[_0x0fcd('0x2c')](_0x4cd43e[_0x0fcd('0x2d')]);if(_0x4cd43e['name']){delete _0x4cd43e[_0x0fcd('0x2e')];}_0x275f0f[_0x0fcd('0x20')](_0x83035)[_0x0fcd('0x2f')](_0x4cd43e);};}exports[_0x0fcd('0x30')]=function(_0x12eae9,_0x2ebb8e,_0x47675a){if(!_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x32')](_0x0fcd('0x33'))&&!_0x12eae9[_0x0fcd('0x31')]['hasOwnProperty']('TemplateId')){throw new db[(_0x0fcd('0x34'))][(_0x0fcd('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x32')](_0x0fcd('0x36'))&&!_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x32')](_0x0fcd('0x37'))){throw new db[(_0x0fcd('0x34'))][(_0x0fcd('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x12eae9[_0x0fcd('0x31')]['hasOwnProperty'](_0x0fcd('0x38'))){throw new db['Sequelize'][(_0x0fcd('0x35'))](_0x0fcd('0x39'));}else{try{var _0x1bfe8e=JSON[_0x0fcd('0x3a')](_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x38')]);}catch(_0x10b90b){logger[_0x0fcd('0x2c')](_0x10b90b);throw new db[(_0x0fcd('0x34'))]['ValidationError'](_0x0fcd('0x3b'));}var _0x203c81=[_0x0fcd('0x3c'),_0x0fcd('0x3d'),_0x0fcd('0x3e'),_0x0fcd('0x3f'),_0x0fcd('0x40'),_0x0fcd('0x41'),_0x0fcd('0x42'),'team',_0x0fcd('0x43')];if(_[_0x0fcd('0x44')](_0x1bfe8e,function(_0x229544){return!_[_0x0fcd('0x45')](_0x203c81,_0x229544['model'][_0x0fcd('0x46')]());})){throw new db[(_0x0fcd('0x34'))]['ValidationError'](_0x0fcd('0x47'));}}}var _0x56fd60={};_0x56fd60[_0x0fcd('0x48')]=_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x32')]('senderName')?_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x48')]:_0x12eae9[_0x0fcd('0x43')][_0x0fcd('0x49')];_0x56fd60[_0x0fcd('0x4a')]=_['isEmpty'](_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x4a')])?null:_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x4a')];_0x56fd60[_0x0fcd('0x4b')]=_0x12eae9[_0x0fcd('0x31')][_0x0fcd('0x4b')]||![];_0x56fd60[_0x0fcd('0x4c')]=_0x12eae9[_0x0fcd('0x43')]['id'];return getContent(_0x12eae9['body'])[_0x0fcd('0x2a')](function(_0x320b69){_0x56fd60[_0x0fcd('0x31')]=_0x320b69;return getRecipients(_0x1bfe8e);})[_0x0fcd('0x2a')](function(_0x57b0dd){_0x56fd60['recipientsId']=_['sortBy'](_0x57b0dd)[_0x0fcd('0x4d')](',');return db[_0x0fcd('0x4e')][_0x0fcd('0x4f')](function(_0x1d316e){return db[_0x0fcd('0x50')]['create'](_0x56fd60,{'raw':!![],'transaction':_0x1d316e})['then'](function(_0x116871){var _0x587cc5={'sender':_0x56fd60[_0x0fcd('0x48')],'description':_0x56fd60[_0x0fcd('0x4a')],'content':_0x56fd60[_0x0fcd('0x31')],'beep':_0x56fd60[_0x0fcd('0x4b')]};_0x57b0dd[_0x0fcd('0x51')](function(_0x34b83a){_0x587cc5[_0x0fcd('0x52')]=_0x34b83a;socket[_0x0fcd('0x53')](_0x0fcd('0x54'),_0x587cc5);});return _0x116871;});});})[_0x0fcd('0x2a')](respondWithResult(_0x2ebb8e,0xc9))[_0x0fcd('0x55')](handleError(_0x2ebb8e,null));};function getContent(_0x90762b){return new BPromise(function(_0x163a80,_0x4ecea2){if(_0x90762b['text']){_0x163a80(_0x90762b[_0x0fcd('0x33')]);return;}return db[_0x0fcd('0x56')][_0x0fcd('0x57')]({'attributes':[_0x0fcd('0x58')],'where':{'id':_0x90762b['TemplateId']},'raw':!![]})[_0x0fcd('0x2a')](function(_0x47d957){if(!_0x47d957)throw new db[(_0x0fcd('0x34'))][(_0x0fcd('0x35'))](_0x0fcd('0x59'));var _0x4c9746=Mustache[_0x0fcd('0x5a')](_0x47d957[_0x0fcd('0x58')],_0x90762b[_0x0fcd('0x37')]);_0x163a80(_0x4c9746);})['catch'](function(_0x162441){_0x4ecea2(_0x162441);});});}function getRecipients(_0x1a51ab){return new BPromise(function(_0x418872,_0xa3bb34){var _0x577cba=[];var _0x40dde1=[];_0x1a51ab[_0x0fcd('0x51')](function(_0x1e990f){var _0x297b5b=_[_0x0fcd('0x5b')](_0x1e990f[_0x0fcd('0x5c')][_0x0fcd('0x46')]());if(_0x297b5b===_0x0fcd('0x5d')){_0x577cba=_['union'](_0x577cba,_0x1e990f['ids']);}else{if(_[_0x0fcd('0x45')](_0x297b5b,'queue'))_0x297b5b=_0x297b5b[_0x0fcd('0x5e')](_0x0fcd('0x5f'),_0x0fcd('0x60'));_0x1e990f['ids'][_0x0fcd('0x51')](function(_0x3b7de3){_0x40dde1[_0x0fcd('0x61')](getAgents(_0x297b5b,_0x3b7de3));});}});return BPromise[_0x0fcd('0x62')](_0x40dde1)['then'](function(_0x10f01e){_0x577cba=_[_0x0fcd('0x63')](_0x577cba,_[_0x0fcd('0x64')](_0x10f01e));_0x418872(_0x577cba);})['catch'](function(_0x539cd1){_0xa3bb34(_0x539cd1);});});}function getAgents(_0x3d8319,_0x429619){return new BPromise(function(_0x303097,_0x37a93a){return db[_0x3d8319][_0x0fcd('0x57')]({'where':{'id':_0x429619}})[_0x0fcd('0x2a')](function(_0x4d51ae){return _0x4d51ae[_0x0fcd('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x401aed){var _0x2832c0=_[_0x0fcd('0x66')](_0x401aed,'id');_0x303097(_0x2832c0);});})[_0x0fcd('0x55')](function(_0x369f1a){_0x37a93a(_0x369f1a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7671b6d..2e2c53c 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 _0x9624=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x4b6346,_0x56e206){var _0x5edfd1=function(_0x35a79b){while(--_0x35a79b){_0x4b6346['push'](_0x4b6346['shift']());}};_0x5edfd1(++_0x56e206);}(_0x9624,0x1d0));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x4962('0x0'))['db'][_0x4962('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4962('0x2')](0x0);var events={'afterCreate':_0x4962('0x3'),'afterUpdate':'update','afterDestroy':_0x4962('0x4')};function emitEvent(_0x314218){return function(_0x59d8a3,_0x178f25,_0x11261c){UserNotificationEvents[_0x4962('0x5')](_0x314218+':'+_0x59d8a3['id'],_0x59d8a3);UserNotificationEvents[_0x4962('0x5')](_0x314218,_0x59d8a3);_0x11261c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x4962('0x6')](e,emitEvent(event));}}module[_0x4962('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xac25=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0xe54cf6,_0x3358d5){var _0x2e4a38=function(_0x3f449d){while(--_0x3f449d){_0xe54cf6['push'](_0xe54cf6['shift']());}};_0x2e4a38(++_0x3358d5);}(_0xac25,0x126));var _0x5ac2=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xac25[_0x412e27];return _0x53da42;};'use strict';var EventEmitter=require(_0x5ac2('0x0'));var UserNotification=require(_0x5ac2('0x1'))['db'][_0x5ac2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5ac2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ac2('0x4'),'afterDestroy':_0x5ac2('0x5')};function emitEvent(_0x4bddb8){return function(_0x29b4bb,_0xf6dcb9,_0x178d4b){UserNotificationEvents[_0x5ac2('0x6')](_0x4bddb8+':'+_0x29b4bb['id'],_0x29b4bb);UserNotificationEvents['emit'](_0x4bddb8,_0x29b4bb);_0x178d4b(null);};}for(var e in events){if(events[_0x5ac2('0x7')](e)){var event=events[e];UserNotification[_0x5ac2('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b4a125a..17e24ca 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 _0x24f1=['util','api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x147356,_0x213c81){var _0x179172=function(_0x1901d7){while(--_0x1901d7){_0x147356['push'](_0x147356['shift']());}};_0x179172(++_0x213c81);}(_0x24f1,0xb5));var _0x124f=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x24f1[_0x31c19c];return _0x1a87f7;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));var logger=require('../../config/logger')(_0x124f('0x2'));var moment=require('moment');var BPromise=require(_0x124f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x124f('0x4'));var rimraf=require(_0x124f('0x5'));var config=require(_0x124f('0x6'));var attributes=require(_0x124f('0x7'));module[_0x124f('0x8')]=function(_0x4713,_0x53f235){return _0x4713['define'](_0x124f('0x9'),attributes,{'tableName':_0x124f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x124f('0xb'),'collate':_0x124f('0xc')});}; \ No newline at end of file +var _0xba97=['exports','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./userNotification.attributes'];(function(_0x34ea22,_0x1270b3){var _0x1ca470=function(_0xf63cf4){while(--_0xf63cf4){_0x34ea22['push'](_0x34ea22['shift']());}};_0x1ca470(++_0x1270b3);}(_0xba97,0x1f0));var _0x7ba9=function(_0x4d2940,_0x1a4321){_0x4d2940=_0x4d2940-0x0;var _0x194501=_0xba97[_0x4d2940];return _0x194501;};'use strict';var _=require(_0x7ba9('0x0'));var util=require(_0x7ba9('0x1'));var logger=require(_0x7ba9('0x2'))(_0x7ba9('0x3'));var moment=require(_0x7ba9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ba9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ba9('0x6'));var attributes=require(_0x7ba9('0x7'));module[_0x7ba9('0x8')]=function(_0x523728,_0x2063a3){return _0x523728['define'](_0x7ba9('0x9'),attributes,{'tableName':_0x7ba9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ba9('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6f9f978..760026b 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 _0x19f2=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x19f2,0xb9));var _0x219f=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x19f2[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x219f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x219f('0x1'));var rs=require(_0x219f('0x2'));var fs=require('fs');var Redis=require(_0x219f('0x3'));var db=require(_0x219f('0x4'))['db'];var utils=require(_0x219f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x219f('0x6'));var jayson=require(_0x219f('0x7'));var client=jayson[_0x219f('0x8')][_0x219f('0x9')]({'port':0x232a});config['redis']=_[_0x219f('0xa')](config['redis'],{'host':_0x219f('0xb'),'port':0x18eb});var socket=require(_0x219f('0xc'))(new Redis(config['redis']));require(_0x219f('0xd'))[_0x219f('0xe')](socket);function respondWithRpcPromise(_0x3cd930,_0x4e0596,_0x15ff2c){return new BPromise(function(_0x375bd8,_0x38dd8e){return client[_0x219f('0xf')](_0x3cd930,_0x15ff2c)[_0x219f('0x10')](function(_0xe6e0be){logger[_0x219f('0x11')]('UserNotification,\x20%s,\x20%s',_0x4e0596,_0x219f('0x12'));logger[_0x219f('0x13')](_0x219f('0x14'),_0x4e0596,'request\x20sent',JSON[_0x219f('0x15')](_0xe6e0be));if(_0xe6e0be[_0x219f('0x16')]){if(_0xe6e0be[_0x219f('0x16')][_0x219f('0x17')]===0x1f4){logger[_0x219f('0x16')]('UserNotification,\x20%s,\x20%s',_0x4e0596,_0xe6e0be['error'][_0x219f('0x18')]);return _0x38dd8e(_0xe6e0be[_0x219f('0x16')][_0x219f('0x18')]);}logger[_0x219f('0x16')](_0x219f('0x19'),_0x4e0596,_0xe6e0be[_0x219f('0x16')][_0x219f('0x18')]);return _0x375bd8(_0xe6e0be[_0x219f('0x16')]['message']);}else{logger[_0x219f('0x11')]('UserNotification,\x20%s,\x20%s',_0x4e0596,'request\x20sent');_0x375bd8(_0xe6e0be[_0x219f('0x1a')][_0x219f('0x18')]);}})['catch'](function(_0x27e73b){logger[_0x219f('0x16')](_0x219f('0x19'),_0x4e0596,_0x27e73b);_0x38dd8e(_0x27e73b);});});} \ No newline at end of file +var _0xd1d8=['UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then'];(function(_0x12d62f,_0x54e199){var _0x1c1636=function(_0x37bd1b){while(--_0x37bd1b){_0x12d62f['push'](_0x12d62f['shift']());}};_0x1c1636(++_0x54e199);}(_0xd1d8,0x15b));var _0x8d1d=function(_0x5ce2e3,_0x3dc503){_0x5ce2e3=_0x5ce2e3-0x0;var _0x3b53ab=_0xd1d8[_0x5ce2e3];return _0x3b53ab;};'use strict';var _=require(_0x8d1d('0x0'));var util=require('util');var moment=require(_0x8d1d('0x1'));var BPromise=require(_0x8d1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d1d('0x3'));var db=require(_0x8d1d('0x4'))['db'];var utils=require(_0x8d1d('0x5'));var logger=require(_0x8d1d('0x6'))(_0x8d1d('0x7'));var config=require(_0x8d1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8d1d('0x9')][_0x8d1d('0xa')]({'port':0x232a});config[_0x8d1d('0xb')]=_[_0x8d1d('0xc')](config[_0x8d1d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d1d('0xd'))(new Redis(config['redis']));require('./userNotification.socket')[_0x8d1d('0xe')](socket);function respondWithRpcPromise(_0x4d85db,_0x10f529,_0x3a1c7d){return new BPromise(function(_0x212335,_0x1f7996){return client[_0x8d1d('0xf')](_0x4d85db,_0x3a1c7d)[_0x8d1d('0x10')](function(_0x7dca35){logger['info'](_0x8d1d('0x11'),_0x10f529,'request\x20sent');logger[_0x8d1d('0x12')](_0x8d1d('0x13'),_0x10f529,'request\x20sent',JSON[_0x8d1d('0x14')](_0x7dca35));if(_0x7dca35[_0x8d1d('0x15')]){if(_0x7dca35[_0x8d1d('0x15')][_0x8d1d('0x16')]===0x1f4){logger[_0x8d1d('0x15')](_0x8d1d('0x11'),_0x10f529,_0x7dca35[_0x8d1d('0x15')]['message']);return _0x1f7996(_0x7dca35['error'][_0x8d1d('0x17')]);}logger['error'](_0x8d1d('0x11'),_0x10f529,_0x7dca35[_0x8d1d('0x15')][_0x8d1d('0x17')]);return _0x212335(_0x7dca35[_0x8d1d('0x15')][_0x8d1d('0x17')]);}else{logger[_0x8d1d('0x18')](_0x8d1d('0x11'),_0x10f529,'request\x20sent');_0x212335(_0x7dca35['result'][_0x8d1d('0x17')]);}})[_0x8d1d('0x19')](function(_0x4f6a21){logger[_0x8d1d('0x15')]('UserNotification,\x20%s,\x20%s',_0x10f529,_0x4f6a21);_0x1f7996(_0x4f6a21);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c9f0fd4..08acdbb 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 _0xf229=['update','emit','register'];(function(_0x870f4a,_0x3ba461){var _0x46c8ea=function(_0x5bfed0){while(--_0x5bfed0){_0x870f4a['push'](_0x870f4a['shift']());}};_0x46c8ea(++_0x3ba461);}(_0xf229,0xb1));var _0x9f22=function(_0x5b15f0,_0x405f5f){_0x5b15f0=_0x5b15f0-0x0;var _0x54cba6=_0xf229[_0x5b15f0];return _0x54cba6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x9f22('0x0')];function createListener(_0x28d40a,_0x5e4cb3){return function(_0x404773){_0x5e4cb3[_0x9f22('0x1')](_0x28d40a,_0x404773);};}function removeListener(_0x1aa25e,_0x12f033){return function(){UserNotificationEvents['removeListener'](_0x1aa25e,_0x12f033);};}exports[_0x9f22('0x2')]=function(_0x4366d6){for(var _0x3f2c39=0x0,_0x47eabe=events['length'];_0x3f2c39<_0x47eabe;_0x3f2c39++){var _0x37a75a=events[_0x3f2c39];var _0x3365e8=createListener('userNotification:'+_0x37a75a,_0x4366d6);UserNotificationEvents['on'](_0x37a75a,_0x3365e8);}}; \ No newline at end of file +var _0x350e=['emit','register','userNotification:','./userNotification.events','remove','update'];(function(_0x215712,_0x5dd4b5){var _0x26aef3=function(_0x29ebe5){while(--_0x29ebe5){_0x215712['push'](_0x215712['shift']());}};_0x26aef3(++_0x5dd4b5);}(_0x350e,0x6f));var _0xe350=function(_0x46c760,_0x59a1a2){_0x46c760=_0x46c760-0x0;var _0x3369ea=_0x350e[_0x46c760];return _0x3369ea;};'use strict';var UserNotificationEvents=require(_0xe350('0x0'));var events=['save',_0xe350('0x1'),_0xe350('0x2')];function createListener(_0x4dbd1e,_0x5af73d){return function(_0x976e35){_0x5af73d[_0xe350('0x3')](_0x4dbd1e,_0x976e35);};}function removeListener(_0x242341,_0x2ceed6){return function(){UserNotificationEvents['removeListener'](_0x242341,_0x2ceed6);};}exports[_0xe350('0x4')]=function(_0x1f3be1){for(var _0x14bf78=0x0,_0x3c814b=events['length'];_0x14bf78<_0x3c814b;_0x14bf78++){var _0x352500=events[_0x14bf78];var _0x4213f3=createListener(_0xe350('0x5')+_0x352500,_0x1f3be1);UserNotificationEvents['on'](_0x352500,_0x4213f3);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f516e56..1babff1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x40f310,_0x33f8ba){var _0x414b2d=function(_0x23aa85){while(--_0x23aa85){_0x40f310['push'](_0x40f310['shift']());}};_0x414b2d(++_0x33f8ba);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a30cf,_0x312dd4){var _0x4d975b=function(_0x170368){while(--_0x170368){_0x4a30cf['push'](_0x4a30cf['shift']());}};_0x4d975b(++_0x312dd4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9a4f2be..b45cd80 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 _0xaa45=['INTEGER','exports'];(function(_0x56c27a,_0x4760e7){var _0x5a61ad=function(_0x41480a){while(--_0x41480a){_0x56c27a['push'](_0x56c27a['shift']());}};_0x5a61ad(++_0x4760e7);}(_0xaa45,0x17d));var _0x5aa4=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xaa45[_0x16ea87];return _0x6e7b1c;};'use strict';var Sequelize=require('sequelize');module[_0x5aa4('0x0')]={'penalty':{'type':Sequelize[_0x5aa4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe083=['exports','INTEGER','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe083,0x1a6));var _0x3e08=function(_0x4fb6e7,_0x2f90fe){_0x4fb6e7=_0x4fb6e7-0x0;var _0x558fea=_0xe083[_0x4fb6e7];return _0x558fea;};'use strict';var Sequelize=require(_0x3e08('0x0'));module[_0x3e08('0x1')]={'penalty':{'type':Sequelize[_0x3e08('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 5d53212..4c85730 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 _0x029d=['../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x390e4b,_0x202f91){var _0x1d2603=function(_0x21b29f){while(--_0x21b29f){_0x390e4b['push'](_0x390e4b['shift']());}};_0x1d2603(++_0x202f91);}(_0x029d,0x19c));var _0xd029=function(_0x2243a1,_0x34b228){_0x2243a1=_0x2243a1-0x0;var _0x47d17d=_0x029d[_0x2243a1];return _0x47d17d;};'use strict';var _=require('lodash');var util=require(_0xd029('0x0'));var logger=require(_0xd029('0x1'))(_0xd029('0x2'));var moment=require(_0xd029('0x3'));var BPromise=require('bluebird');var rp=require(_0xd029('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd029('0x5'));var config=require(_0xd029('0x6'));var attributes=require(_0xd029('0x7'));module[_0xd029('0x8')]=function(_0x219327,_0x59db61){return _0x219327['define'](_0xd029('0x9'),attributes,{'tableName':_0xd029('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8f3=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd8f3,0x191));var _0x3d8f=function(_0x4dc475,_0x9cfae5){_0x4dc475=_0x4dc475-0x0;var _0xcc0891=_0xd8f3[_0x4dc475];return _0xcc0891;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d8f('0x0'))(_0x3d8f('0x1'));var moment=require(_0x3d8f('0x2'));var BPromise=require('bluebird');var rp=require(_0x3d8f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d8f('0x4'));var config=require(_0x3d8f('0x5'));var attributes=require(_0x3d8f('0x6'));module[_0x3d8f('0x7')]=function(_0xcebfe5,_0x531e73){return _0xcebfe5[_0x3d8f('0x8')](_0x3d8f('0x9'),attributes,{'tableName':_0x3d8f('0xa'),'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 4ff2803..c79479d 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 _0x6b54=['http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x24d1fb,_0x3368ea){var _0x35ff97=function(_0x4ac9e4){while(--_0x4ac9e4){_0x24d1fb['push'](_0x24d1fb['shift']());}};_0x35ff97(++_0x3368ea);}(_0x6b54,0x68));var _0x46b5=function(_0x283e0e,_0x3f29df){_0x283e0e=_0x283e0e-0x0;var _0x37f29a=_0x6b54[_0x283e0e];return _0x37f29a;};'use strict';var _=require(_0x46b5('0x0'));var util=require(_0x46b5('0x1'));var moment=require(_0x46b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x46b5('0x3'));var fs=require('fs');var Redis=require(_0x46b5('0x4'));var db=require(_0x46b5('0x5'))['db'];var utils=require(_0x46b5('0x6'));var logger=require(_0x46b5('0x7'))('rpc');var config=require(_0x46b5('0x8'));var jayson=require(_0x46b5('0x9'));var client=jayson[_0x46b5('0xa')][_0x46b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a53c3,_0x354f48,_0x12a546){return new BPromise(function(_0x29d787,_0x265768){return client[_0x46b5('0xc')](_0x3a53c3,_0x12a546)[_0x46b5('0xd')](function(_0x4cab52){logger[_0x46b5('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x46b5('0xf'));logger['debug'](_0x46b5('0x10'),_0x354f48,_0x46b5('0xf'),JSON[_0x46b5('0x11')](_0x4cab52));if(_0x4cab52[_0x46b5('0x12')]){if(_0x4cab52[_0x46b5('0x12')][_0x46b5('0x13')]===0x1f4){logger[_0x46b5('0x12')](_0x46b5('0x14'),_0x354f48,_0x4cab52[_0x46b5('0x12')][_0x46b5('0x15')]);return _0x265768(_0x4cab52['error']['message']);}logger[_0x46b5('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x4cab52['error']['message']);return _0x29d787(_0x4cab52[_0x46b5('0x12')][_0x46b5('0x15')]);}else{logger[_0x46b5('0xe')](_0x46b5('0x14'),_0x354f48,_0x46b5('0xf'));_0x29d787(_0x4cab52['result'][_0x46b5('0x15')]);}})[_0x46b5('0x16')](function(_0x275444){logger[_0x46b5('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x275444);_0x265768(_0x275444);});});} \ No newline at end of file +var _0xfa1a=['stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x43a5cd,_0x1bf484){var _0x10d186=function(_0x5b0f08){while(--_0x5b0f08){_0x43a5cd['push'](_0x43a5cd['shift']());}};_0x10d186(++_0x1bf484);}(_0xfa1a,0x1c6));var _0xafa1=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xfa1a[_0x4fc80b];return _0x119dba;};'use strict';var _=require(_0xafa1('0x0'));var util=require(_0xafa1('0x1'));var moment=require(_0xafa1('0x2'));var BPromise=require(_0xafa1('0x3'));var rs=require(_0xafa1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafa1('0x5'))['db'];var utils=require(_0xafa1('0x6'));var logger=require('../../config/logger')(_0xafa1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xafa1('0x8')][_0xafa1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ced9d,_0x404980,_0x194917){return new BPromise(function(_0xcd96f2,_0x2e8e5d){return client[_0xafa1('0xa')](_0x1ced9d,_0x194917)['then'](function(_0x342da6){logger[_0xafa1('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x404980,_0xafa1('0xc'));logger['debug'](_0xafa1('0xd'),_0x404980,_0xafa1('0xc'),JSON[_0xafa1('0xe')](_0x342da6));if(_0x342da6['error']){if(_0x342da6[_0xafa1('0xf')]['code']===0x1f4){logger['error'](_0xafa1('0x10'),_0x404980,_0x342da6[_0xafa1('0xf')]['message']);return _0x2e8e5d(_0x342da6[_0xafa1('0xf')][_0xafa1('0x11')]);}logger[_0xafa1('0xf')](_0xafa1('0x10'),_0x404980,_0x342da6[_0xafa1('0xf')]['message']);return _0xcd96f2(_0x342da6[_0xafa1('0xf')][_0xafa1('0x11')]);}else{logger[_0xafa1('0xb')](_0xafa1('0x10'),_0x404980,_0xafa1('0xc'));_0xcd96f2(_0x342da6['result'][_0xafa1('0x11')]);}})['catch'](function(_0x3e37b9){logger[_0xafa1('0xf')](_0xafa1('0x10'),_0x404980,_0x3e37b9);_0x2e8e5d(_0x3e37b9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ea60f19..42d8327 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 _0x2922=['/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','/:id','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x4b645d,_0x2634a6){var _0x288b7b=function(_0x5d7f91){while(--_0x5d7f91){_0x4b645d['push'](_0x4b645d['shift']());}};_0x288b7b(++_0x2634a6);}(_0x2922,0x6c));var _0x2292=function(_0x46709b,_0x48d0ea){_0x46709b=_0x46709b-0x0;var _0x24ee56=_0x2922[_0x46709b];return _0x24ee56;};'use strict';var multer=require(_0x2292('0x0'));var util=require(_0x2292('0x1'));var path=require(_0x2292('0x2'));var timeout=require(_0x2292('0x3'));var express=require(_0x2292('0x4'));var router=express[_0x2292('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2292('0x6'));var interaction=require(_0x2292('0x7'));var config=require(_0x2292('0x8'));var controller=require(_0x2292('0x9'));router[_0x2292('0xa')]('/',auth['isAuthenticated'](),controller[_0x2292('0xb')]);router['get'](_0x2292('0xc'),auth[_0x2292('0xd')](),controller[_0x2292('0xe')]);router[_0x2292('0xa')]('/:id',auth[_0x2292('0xd')](),controller[_0x2292('0xf')]);router['get'](_0x2292('0x10'),auth[_0x2292('0xd')](),controller[_0x2292('0x11')]);router[_0x2292('0xa')](_0x2292('0x12'),auth[_0x2292('0xd')](),controller[_0x2292('0x13')]);router['post']('/',auth[_0x2292('0xd')](),controller[_0x2292('0x14')]);router[_0x2292('0x15')](_0x2292('0x16'),auth['isAuthenticated'](),controller[_0x2292('0x17')]);router[_0x2292('0x15')](_0x2292('0x10'),auth['isAuthenticated'](),controller[_0x2292('0x18')]);router[_0x2292('0x15')](_0x2292('0x12'),auth['isAuthenticated'](),controller[_0x2292('0x19')]);router['put'](_0x2292('0x1a'),auth[_0x2292('0xd')](),controller['update']);router[_0x2292('0x1b')](_0x2292('0x1a'),auth[_0x2292('0xd')](),controller[_0x2292('0x1c')]);router[_0x2292('0x1b')](_0x2292('0x10'),auth[_0x2292('0xd')](),controller[_0x2292('0x1d')]);router['delete'](_0x2292('0x12'),auth[_0x2292('0xd')](),controller['removeResources']);module[_0x2292('0x1e')]=router; \ No newline at end of file +var _0x8e8f=['removeSections','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','delete'];(function(_0x1831f0,_0x3ab690){var _0x275869=function(_0x5a8c02){while(--_0x5a8c02){_0x1831f0['push'](_0x1831f0['shift']());}};_0x275869(++_0x3ab690);}(_0x8e8f,0x1cd));var _0xf8e8=function(_0x3eff39,_0x4d37a7){_0x3eff39=_0x3eff39-0x0;var _0x7ac104=_0x8e8f[_0x3eff39];return _0x7ac104;};'use strict';var multer=require(_0xf8e8('0x0'));var util=require('util');var path=require(_0xf8e8('0x1'));var timeout=require(_0xf8e8('0x2'));var express=require('express');var router=express[_0xf8e8('0x3')]();var fs_extra=require(_0xf8e8('0x4'));var auth=require(_0xf8e8('0x5'));var interaction=require(_0xf8e8('0x6'));var config=require(_0xf8e8('0x7'));var controller=require(_0xf8e8('0x8'));router['get']('/',auth[_0xf8e8('0x9')](),controller['index']);router[_0xf8e8('0xa')](_0xf8e8('0xb'),auth[_0xf8e8('0x9')](),controller[_0xf8e8('0xc')]);router[_0xf8e8('0xa')](_0xf8e8('0xd'),auth['isAuthenticated'](),controller[_0xf8e8('0xe')]);router['get'](_0xf8e8('0xf'),auth[_0xf8e8('0x9')](),controller['getSections']);router['get'](_0xf8e8('0x10'),auth[_0xf8e8('0x9')](),controller[_0xf8e8('0x11')]);router[_0xf8e8('0x12')]('/',auth['isAuthenticated'](),controller[_0xf8e8('0x13')]);router[_0xf8e8('0x12')]('/:id/clone',auth[_0xf8e8('0x9')](),controller[_0xf8e8('0x14')]);router[_0xf8e8('0x12')](_0xf8e8('0xf'),auth[_0xf8e8('0x9')](),controller[_0xf8e8('0x15')]);router[_0xf8e8('0x12')](_0xf8e8('0x10'),auth['isAuthenticated'](),controller[_0xf8e8('0x16')]);router[_0xf8e8('0x17')](_0xf8e8('0xd'),auth[_0xf8e8('0x9')](),controller['update']);router[_0xf8e8('0x18')](_0xf8e8('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xf8e8('0x18')]('/:id/sections',auth[_0xf8e8('0x9')](),controller[_0xf8e8('0x19')]);router['delete'](_0xf8e8('0x10'),auth[_0xf8e8('0x9')](),controller['removeResources']);module[_0xf8e8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b94041a..abfc5bf 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 _0x2e88=['split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x31cc4b,_0x2c2bf0){var _0x2b9fb2=function(_0x260fe3){while(--_0x260fe3){_0x31cc4b['push'](_0x31cc4b['shift']());}};_0x2b9fb2(++_0x2c2bf0);}(_0x2e88,0x1c4));var _0x82e8=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x2e88[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0x82e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x82e8('0x1')],'allowNull':![],'unique':_0x82e8('0x2')},'crudPermissions':{'type':Sequelize[_0x82e8('0x1')],'set':function(_0xfd1e22){this[_0x82e8('0x3')](_0x82e8('0x4'),_0xfd1e22?_0xfd1e22[_0x82e8('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x82e8('0x6')](_0x82e8('0x4'))[_0x82e8('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd995=['BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd995,0x189));var _0x5d99=function(_0x64de5,_0x27dfa2){_0x64de5=_0x64de5-0x0;var _0x36b149=_0xd995[_0x64de5];return _0x36b149;};'use strict';var Sequelize=require(_0x5d99('0x0'));module[_0x5d99('0x1')]={'name':{'type':Sequelize[_0x5d99('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x5d99('0x2')],'set':function(_0x6eb665){this[_0x5d99('0x3')](_0x5d99('0x4'),_0x6eb665?_0x6eb665[_0x5d99('0x5')](''):[]);},'get':function(){return this[_0x5d99('0x6')]('crudPermissions')?this[_0x5d99('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5d99('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5d99('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 82681b5..ff63e91 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 _0x4efc=['findAll','rows','show','params','keys','include','find','catch','create','body','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','removeSections','ids','getSections','includes','subsections','enabled','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','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','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','end','error','name','send','index','UserProfile','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4efc,0x10b));var _0xc4ef=function(_0x1e14ad,_0x4b15a6){_0x1e14ad=_0x1e14ad-0x0;var _0x27128a=_0x4efc[_0x1e14ad];return _0x27128a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4ef('0x0'));var zipdir=require(_0xc4ef('0x1'));var jsonpatch=require(_0xc4ef('0x2'));var rp=require('request-promise');var moment=require(_0xc4ef('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc4ef('0x4'));var sox=require(_0xc4ef('0x5'));var csv=require('to-csv');var ejs=require(_0xc4ef('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4ef('0x7'));var squel=require(_0xc4ef('0x8'));var crypto=require(_0xc4ef('0x9'));var jsforce=require(_0xc4ef('0xa'));var deskjs=require(_0xc4ef('0xb'));var toCsv=require(_0xc4ef('0xc'));var querystring=require('querystring');var Papa=require(_0xc4ef('0xd'));var Redis=require(_0xc4ef('0xe'));var authService=require(_0xc4ef('0xf'));var qs=require(_0xc4ef('0x10'));var as=require(_0xc4ef('0x11'));var hardwareService=require(_0xc4ef('0x12'));var logger=require(_0xc4ef('0x13'))(_0xc4ef('0x14'));var utils=require(_0xc4ef('0x15'));var config=require(_0xc4ef('0x16'));var licenseUtil=require(_0xc4ef('0x17'));var db=require(_0xc4ef('0x18'))['db'];config['redis']=_['defaults'](config[_0xc4ef('0x19')],{'host':_0xc4ef('0x1a'),'port':0x18eb});var socket=require(_0xc4ef('0x1b'))(new Redis(config[_0xc4ef('0x19')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x256e1b,_0x51bc65){_0x51bc65=_0x51bc65||0xcc;return function(_0x42843b){if(_0x42843b){return _0x256e1b[_0xc4ef('0x1c')](_0x51bc65);}return _0x256e1b[_0xc4ef('0x1d')](_0x51bc65)['end']();};}function respondWithResult(_0x302781,_0x161c0f){_0x161c0f=_0x161c0f||0xc8;return function(_0x5b577c){if(_0x5b577c){return _0x302781[_0xc4ef('0x1d')](_0x161c0f)[_0xc4ef('0x1e')](_0x5b577c);}};}function respondWithFilteredResult(_0x3d7e43,_0x6ece60){return function(_0x8e72c3){if(_0x8e72c3){var _0x45fc35=typeof _0x6ece60['offset']==='undefined'&&typeof _0x6ece60[_0xc4ef('0x1f')]===_0xc4ef('0x20');var _0x5e2a0b=_0x8e72c3[_0xc4ef('0x21')];var _0x420d0c=_0x45fc35?0x0:_0x6ece60[_0xc4ef('0x22')];var _0x3f25b1=_0x45fc35?_0x8e72c3[_0xc4ef('0x21')]:_0x6ece60[_0xc4ef('0x22')]+_0x6ece60[_0xc4ef('0x1f')];var _0x2d375d;if(_0x3f25b1>=_0x5e2a0b){_0x3f25b1=_0x5e2a0b;_0x2d375d=0xc8;}else{_0x2d375d=0xce;}_0x3d7e43['status'](_0x2d375d);return _0x3d7e43[_0xc4ef('0x23')](_0xc4ef('0x24'),_0x420d0c+'-'+_0x3f25b1+'/'+_0x5e2a0b)[_0xc4ef('0x1e')](_0x8e72c3);}return null;};}function patchUpdates(_0x33d3d){return function(_0x454fea){try{jsonpatch['apply'](_0x454fea,_0x33d3d,!![]);}catch(_0x127a8a){return BPromise[_0xc4ef('0x25')](_0x127a8a);}return _0x454fea[_0xc4ef('0x26')]();};}function saveUpdates(_0x479a61,_0x13b01a){return function(_0x4663f0){if(_0x4663f0){return _0x4663f0['update'](_0x479a61)[_0xc4ef('0x27')](function(_0x5c19c4){return _0x5c19c4;});}return null;};}function removeEntity(_0x43539b,_0x532a48){return function(_0x23dcd9){if(_0x23dcd9){return _0x23dcd9[_0xc4ef('0x28')]()[_0xc4ef('0x27')](function(){_0x43539b[_0xc4ef('0x1d')](0xcc)[_0xc4ef('0x29')]();});}};}function handleEntityNotFound(_0xa755c0,_0x3bf652){return function(_0x1a42b8){if(!_0x1a42b8){_0xa755c0[_0xc4ef('0x1c')](0x194);}return _0x1a42b8;};}function handleError(_0x13a785,_0x1a6bb3){_0x1a6bb3=_0x1a6bb3||0x1f4;return function(_0x3b899b){logger[_0xc4ef('0x2a')](_0x3b899b['stack']);if(_0x3b899b[_0xc4ef('0x2b')]){delete _0x3b899b[_0xc4ef('0x2b')];}_0x13a785['status'](_0x1a6bb3)[_0xc4ef('0x2c')](_0x3b899b);};}exports[_0xc4ef('0x2d')]=function(_0xb4274f,_0x344201){var _0x29b6ea={},_0x550308={},_0x4803ed={'count':0x0,'rows':[]};var _0x3676b6=_['map'](db[_0xc4ef('0x2e')][_0xc4ef('0x2f')],function(_0x136230){return{'name':_0x136230['fieldName'],'type':_0x136230[_0xc4ef('0x30')][_0xc4ef('0x31')]};});_0x550308[_0xc4ef('0x32')]=_['map'](_0x3676b6,_0xc4ef('0x2b'));_0x550308[_0xc4ef('0x33')]=_['keys'](_0xb4274f[_0xc4ef('0x33')]);_0x550308[_0xc4ef('0x34')]=_[_0xc4ef('0x35')](_0x550308[_0xc4ef('0x32')],_0x550308['query']);_0x29b6ea[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x550308[_0xc4ef('0x32')],qs['fields'](_0xb4274f['query'][_0xc4ef('0x37')]));_0x29b6ea[_0xc4ef('0x36')]=_0x29b6ea[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x29b6ea[_0xc4ef('0x36')]:_0x550308[_0xc4ef('0x32')];if(!_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x39')](_0xc4ef('0x3a'))){_0x29b6ea[_0xc4ef('0x1f')]=qs[_0xc4ef('0x1f')](_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x1f')]);_0x29b6ea['offset']=qs['offset'](_0xb4274f[_0xc4ef('0x33')]['offset']);}_0x29b6ea[_0xc4ef('0x3b')]=qs['sort'](_0xb4274f['query'][_0xc4ef('0x3c')]);_0x29b6ea[_0xc4ef('0x3d')]=qs[_0xc4ef('0x34')](_[_0xc4ef('0x3e')](_0xb4274f[_0xc4ef('0x33')],_0x550308[_0xc4ef('0x34')]),_0x3676b6);if(_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x3f')]){_0x29b6ea[_0xc4ef('0x3d')]=_[_0xc4ef('0x40')](_0x29b6ea[_0xc4ef('0x3d')],{'$or':_[_0xc4ef('0x41')](_0x3676b6,function(_0x504a7e){if(_0x504a7e[_0xc4ef('0x30')]!==_0xc4ef('0x42')){var _0x2ad67d={};_0x2ad67d[_0x504a7e[_0xc4ef('0x2b')]]={'$like':'%'+_0xb4274f['query'][_0xc4ef('0x3f')]+'%'};return _0x2ad67d;}})});}_0x29b6ea=_[_0xc4ef('0x40')]({},_0x29b6ea,_0xb4274f[_0xc4ef('0x43')]);var _0x54e333={'where':_0x29b6ea[_0xc4ef('0x3d')]};return db['UserProfile']['count'](_0x54e333)[_0xc4ef('0x27')](function(_0x1db64a){_0x4803ed[_0xc4ef('0x21')]=_0x1db64a;if(_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x44')]){_0x29b6ea['include']=[{'all':!![]}];}return db['UserProfile'][_0xc4ef('0x45')](_0x29b6ea);})[_0xc4ef('0x27')](function(_0x4f8222){_0x4803ed[_0xc4ef('0x46')]=_0x4f8222;return _0x4803ed;})[_0xc4ef('0x27')](respondWithFilteredResult(_0x344201,_0x29b6ea))['catch'](handleError(_0x344201,null));};exports[_0xc4ef('0x47')]=function(_0x1f4e15,_0x406a3a){var _0x43159f={'raw':![],'where':{'id':_0x1f4e15[_0xc4ef('0x48')]['id']}},_0x2bbe94={};_0x2bbe94['model']=_[_0xc4ef('0x49')](db['UserProfile'][_0xc4ef('0x2f')]);_0x2bbe94['query']=_['keys'](_0x1f4e15['query']);_0x2bbe94[_0xc4ef('0x34')]=_[_0xc4ef('0x35')](_0x2bbe94[_0xc4ef('0x32')],_0x2bbe94[_0xc4ef('0x33')]);_0x43159f[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x2bbe94['model'],qs[_0xc4ef('0x37')](_0x1f4e15[_0xc4ef('0x33')]['fields']));_0x43159f['attributes']=_0x43159f[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x43159f['attributes']:_0x2bbe94[_0xc4ef('0x32')];if(_0x1f4e15[_0xc4ef('0x33')]['includeAll']){_0x43159f[_0xc4ef('0x4a')]=[{'all':!![]}];}_0x43159f=_[_0xc4ef('0x40')]({},_0x43159f,_0x1f4e15[_0xc4ef('0x43')]);return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')](_0x43159f)[_0xc4ef('0x27')](handleEntityNotFound(_0x406a3a,null))[_0xc4ef('0x27')](respondWithResult(_0x406a3a,null))[_0xc4ef('0x4c')](handleError(_0x406a3a,null));};exports[_0xc4ef('0x4d')]=function(_0x1e732d,_0x870faa){return db['UserProfile'][_0xc4ef('0x4d')](_0x1e732d[_0xc4ef('0x4e')],{})[_0xc4ef('0x27')](respondWithResult(_0x870faa,0xc9))[_0xc4ef('0x4c')](handleError(_0x870faa,null));};exports['clone']=function(_0x5c60cc,_0x40bdd3){var _0x2846c3={'where':{'id':_0x5c60cc['params']['id']}},_0x447a15={};_0x447a15[_0xc4ef('0x32')]=_['keys'](db['UserProfile'][_0xc4ef('0x2f')]);_0x2846c3[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x447a15[_0xc4ef('0x32')],qs[_0xc4ef('0x37')](_0x5c60cc[_0xc4ef('0x33')][_0xc4ef('0x37')]));_0x2846c3[_0xc4ef('0x36')]=_0x2846c3[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x2846c3[_0xc4ef('0x36')]:_0x447a15[_0xc4ef('0x32')];if(_0x5c60cc[_0xc4ef('0x33')][_0xc4ef('0x44')]){_0x2846c3[_0xc4ef('0x4a')]=[{'all':!![]}];}_0x2846c3=_[_0xc4ef('0x40')]({},_0x2846c3,_0x5c60cc[_0xc4ef('0x43')]);return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')](_0x2846c3)[_0xc4ef('0x27')](handleEntityNotFound(_0x40bdd3,null))['then'](function(_0x26d0b7){if(_0x26d0b7){var _0x3bb148=_0x26d0b7[_0xc4ef('0x4f')]({'plain':!![]});_0x3bb148=qs[_0xc4ef('0x50')](_0x3bb148,['id','createdAt',_0xc4ef('0x51'),_0xc4ef('0x52')]);_0x5c60cc['body']=_['omit'](_0x5c60cc[_0xc4ef('0x4e')],['id',_0xc4ef('0x53'),'updatedAt']);return db[_0xc4ef('0x54')][_0xc4ef('0x55')](function(_0x26f07f){return db['UserProfile'][_0xc4ef('0x4d')](_[_0xc4ef('0x40')](_0x3bb148,_0x5c60cc['body']),{'include':_0x5c60cc['query'][_0xc4ef('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x26f07f})[_0xc4ef('0x27')](function(_0x394ab9){var _0x3208df=_0x394ab9[_0xc4ef('0x4f')]({'plain':!![]});return db[_0xc4ef('0x56')]['findAll']({'where':{'userProfileId':_0x5c60cc[_0xc4ef('0x48')]['id']},'raw':!![]})['then'](function(_0x5ed529){if(_0x5ed529){return BPromise['each'](_0x5ed529,function(_0x23930f){return new BPromise(function(_0x507e23,_0x200c75){if(_0x23930f['autoAssociation']===null||_0x23930f[_0xc4ef('0x57')]===0x1)_0x507e23(null);return db[_0xc4ef('0x58')][_0xc4ef('0x45')]({'where':{'sectionId':_0x23930f['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x1aeafa){var _0x48f3e6=_['map'](_0x1aeafa,function(_0x59447d){return qs['omit'](_0x59447d,['id',_0xc4ef('0x53'),_0xc4ef('0x51'),_0xc4ef('0x59')]);});_0x507e23(_0x48f3e6);})[_0xc4ef('0x4c')](function(_0x2b12d6){_0x200c75(_0x2b12d6);});})[_0xc4ef('0x27')](function(_0xde1ee6){var _0x20fee2=qs[_0xc4ef('0x50')](_0x23930f,['id',_0xc4ef('0x53'),_0xc4ef('0x51')]);_0x20fee2[_0xc4ef('0x5a')]=_0x3208df['id'];if(_0xde1ee6)_0x20fee2['Resources']=_0xde1ee6;return _0x20fee2;})[_0xc4ef('0x27')](function(_0x32a18e){return db['UserProfileSection']['create'](_0x32a18e,{'include':[{'model':db[_0xc4ef('0x58')],'as':_0xc4ef('0x5b')}],'raw':!![],'transaction':_0x26f07f});});})[_0xc4ef('0x27')](function(){return _0x3208df;});}});});});}})[_0xc4ef('0x27')](respondWithResult(_0x40bdd3,0xc9))[_0xc4ef('0x4c')](handleError(_0x40bdd3,null));};exports['update']=function(_0x545f43,_0x26fab9){if(_0x545f43[_0xc4ef('0x4e')]['id']){delete _0x545f43['body']['id'];}return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x545f43[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x26fab9,null))[_0xc4ef('0x27')](saveUpdates(_0x545f43['body'],null))['then'](respondWithResult(_0x26fab9,null))[_0xc4ef('0x4c')](handleError(_0x26fab9,null));};exports[_0xc4ef('0x28')]=function(_0x3b76d8,_0x526742){return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x3b76d8[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x526742,null))[_0xc4ef('0x27')](removeEntity(_0x526742,null))['catch'](handleError(_0x526742,null));};exports['describe']=function(_0x21fe1f,_0x3658bf){return db[_0xc4ef('0x2e')][_0xc4ef('0x5c')]()[_0xc4ef('0x27')](respondWithResult(_0x3658bf,null))[_0xc4ef('0x4c')](handleError(_0x3658bf,null));};exports[_0xc4ef('0x5d')]=function(_0x385d13,_0x448f5f){var _0x40ecf8=_0x385d13[_0xc4ef('0x4e')];return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x385d13['params']['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x448f5f,null))[_0xc4ef('0x27')](function(_0x44a2e6){if(_0x44a2e6){return db[_0xc4ef('0x54')]['transaction'](function(_0x220d42){return db[_0xc4ef('0x56')][_0xc4ef('0x28')]({'where':{'userProfileId':_0x385d13['params']['id'],'sectionId':_[_0xc4ef('0x41')](_0x40ecf8,function(_0x32b13c){return _0x32b13c[_0xc4ef('0x59')];})},'transaction':_0x220d42})[_0xc4ef('0x27')](function(){var _0x58af66=_[_0xc4ef('0x41')](_0x40ecf8,function(_0x199e7a){_0x199e7a[_0xc4ef('0x5a')]=_0x385d13[_0xc4ef('0x48')]['id'];return _0x199e7a;});var _0x3f5717=[];return BPromise[_0xc4ef('0x5e')](_0x58af66,function(_0x837d0a){return db[_0xc4ef('0x56')][_0xc4ef('0x4d')](_0x837d0a,{'include':[{'model':db[_0xc4ef('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x220d42})[_0xc4ef('0x27')](function(_0x2bdb9a){_0x3f5717['push'](_0x2bdb9a[_0xc4ef('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x3f5717;});});});}})['then'](function(_0x288d45){return _0x288d45;})[_0xc4ef('0x27')](respondWithResult(_0x448f5f,null))[_0xc4ef('0x4c')](handleError(_0x448f5f,null));};exports[_0xc4ef('0x5f')]=function(_0x29e90c,_0x50054d){var _0x19daef;return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x29e90c[_0xc4ef('0x48')]['id']},'attributes':['id','name']})[_0xc4ef('0x27')](handleEntityNotFound(_0x50054d,null))[_0xc4ef('0x27')](function(_0x57ff47){if(_0x57ff47){_0x19daef=_0x57ff47;return db['UserProfileSection'][_0xc4ef('0x28')]({'where':{'userProfileId':_0x29e90c[_0xc4ef('0x48')]['id'],'sectionId':_0x29e90c['query'][_0xc4ef('0x60')]}});}})[_0xc4ef('0x27')](function(){return _0x19daef;})[_0xc4ef('0x27')](respondWithStatusCode(_0x50054d,null))['catch'](handleError(_0x50054d,null));};exports[_0xc4ef('0x61')]=function(_0x50cd09,_0x3ccdc5){var _0x58729e=[];var _0x37d601=[];return db[_0xc4ef('0x56')]['findAll']({'where':{'userProfileId':_0x50cd09[_0xc4ef('0x48')]['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x36caff){_0x58729e=_[_0xc4ef('0x3f')](_0x36caff,function(_0xd4f0db){return _0xd4f0db['enabled']===0x1||_[_0xc4ef('0x62')]([0x3eb,0x709],_0xd4f0db[_0xc4ef('0x59')]);});if(!_['isEmpty'](_0x58729e)){return _[_0xc4ef('0x41')](_0x58729e,function(_0x4d60bb){return _0x4d60bb[_0xc4ef('0x59')];});}else{return;}})[_0xc4ef('0x27')](function(_0x389f50){if(_0x389f50)_0x37d601=_0x389f50;if(_[_0xc4ef('0x62')](_0x37d601,0x64)){var _0x5b4c70=_['find'](_0x58729e,{'sectionId':0x64});return hasDefaultDashboard(_0x5b4c70)[_0xc4ef('0x27')](function(_0x597fee){return _[_0xc4ef('0x41')](_0x58729e,function(_0x318eaf){if(_0x318eaf[_0xc4ef('0x59')]===0x64){_0x318eaf[_0xc4ef('0x63')]=_0x597fee;}return _0x318eaf;});});}else{return;}})[_0xc4ef('0x27')](function(_0x52ea4b){if(_0x52ea4b)_0x58729e=_0x52ea4b;if(_[_0xc4ef('0x62')](_0x37d601,0x3eb)){var _0x47eb34=_[_0xc4ef('0x4b')](_0x58729e,{'sectionId':0x3eb});return getCustomDashboards(_0x47eb34)[_0xc4ef('0x27')](function(_0x35ddcd){return _[_0xc4ef('0x41')](_0x58729e,function(_0x2c4e73){if(_0x47eb34[_0xc4ef('0x64')]){if(_0x2c4e73['sectionId']===0x3eb){_0x2c4e73[_0xc4ef('0x63')]=_0x35ddcd;}}else{if(_0x2c4e73[_0xc4ef('0x59')]===0x64){if(!_0x2c4e73[_0xc4ef('0x63')]){_0x2c4e73['subsections']=[];}_0x2c4e73[_0xc4ef('0x63')]=_0x2c4e73[_0xc4ef('0x63')]['concat'](_0x35ddcd);}}return _0x2c4e73;});});}else{return;}})[_0xc4ef('0x27')](function(_0x4ce4e4){if(_0x4ce4e4)_0x58729e=_0x4ce4e4;if(_[_0xc4ef('0x62')](_0x37d601,0x709)){var _0x2d7c3b=_['find'](_0x58729e,{'sectionId':0x709});return getPlugins(_0x2d7c3b)[_0xc4ef('0x27')](function(_0xd75790){if(_0x2d7c3b[_0xc4ef('0x64')]){return _[_0xc4ef('0x41')](_0x58729e,function(_0x26a420){if(_0x26a420[_0xc4ef('0x59')]===0x709){_0x26a420[_0xc4ef('0x63')]=_0xd75790;}return _0x26a420;});}else{var _0x9adfb5={'sectionId':0x76c,'enabled':0x1,'subsections':_0xd75790};var _0x403da6=_[_0xc4ef('0x41')](_0x58729e);_0x403da6[_0xc4ef('0x65')](_0x9adfb5);return _0x403da6;}});}else{return;}})['then'](function(_0x35108f){if(_0x35108f)_0x58729e=_0x35108f;return _[_0xc4ef('0x3f')](_0x58729e,[_0xc4ef('0x64'),0x1]);})[_0xc4ef('0x27')](respondWithResult(_0x3ccdc5,null))[_0xc4ef('0x4c')](handleError(_0x3ccdc5,null));};function hasDefaultDashboard(_0x3a6e95){var _0x306c24=[0x65];return new BPromise(function(_0x412ca9,_0x312088){try{if(_0x3a6e95['autoAssociation']){_0x412ca9(_0x306c24);}else{return db[_0xc4ef('0x58')][_0xc4ef('0x66')]({'where':{'sectionId':_0x3a6e95['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x54078b){_0x54078b?_0x412ca9(_0x306c24):_0x412ca9();});}}catch(_0x1a54d7){_0x312088(_0x1a54d7);}});}function getCustomDashboards(_0x12b56a){var _0xf2a7e4=[];return new BPromise(function(_0x25f51a,_0x518553){try{if(_0x12b56a[_0xc4ef('0x57')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xc4ef('0x27')](function(_0xc7abf2){_0xc7abf2[_0xc4ef('0x67')](function(_0x4a4b2a){_0xf2a7e4[_0xc4ef('0x65')](_0x4a4b2a['id']+0x1869f);});_0x25f51a(_0xf2a7e4);});}else{return db['UserProfileResource'][_0xc4ef('0x45')]({'where':{'sectionId':_0x12b56a['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x1df7ed){_0x1df7ed[_0xc4ef('0x67')](function(_0x230679){_0xf2a7e4['push'](_0x230679[_0xc4ef('0x68')]+0x1869f);});_0x25f51a(_0xf2a7e4);});}}catch(_0x3f992b){_0x518553(_0x3f992b);}});}function getPlugins(_0x185f4d){var _0x5bcbf2=[];return new BPromise(function(_0x45be44,_0x4b5d48){try{if(_0x185f4d['autoAssociation']){return db[_0xc4ef('0x69')]['findAll']({'raw':!![]})[_0xc4ef('0x27')](function(_0x45cf11){_0x45cf11[_0xc4ef('0x67')](function(_0x45bfdb){_0x5bcbf2[_0xc4ef('0x65')](_0x45bfdb['id']+0x15b38);});_0x45be44(_0x5bcbf2);});}else{return db[_0xc4ef('0x58')][_0xc4ef('0x45')]({'where':{'sectionId':_0x185f4d['id']},'raw':!![]})['then'](function(_0x53b037){_0x53b037[_0xc4ef('0x67')](function(_0x47c991){_0x5bcbf2[_0xc4ef('0x65')](_0x47c991[_0xc4ef('0x68')]+0x15b38);});_0x45be44(_0x5bcbf2);});}}catch(_0x167b76){_0x4b5d48(_0x167b76);}});}exports[_0xc4ef('0x6a')]=function(_0x4b039c,_0xfd8bbd){return db[_0xc4ef('0x2e')]['find']({'where':{'id':_0x4b039c[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0xfd8bbd,null))[_0xc4ef('0x27')](function(_0x1d08e4){if(_0x1d08e4){return db[_0xc4ef('0x54')][_0xc4ef('0x55')](function(_0x2f625b){return db['UserProfileSection'][_0xc4ef('0x45')]({'where':{'userProfileId':_0x4b039c[_0xc4ef('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x428ddf){if(_0x428ddf){return db[_0xc4ef('0x56')][_0xc4ef('0x28')]({'where':{'userProfileId':_0x4b039c[_0xc4ef('0x48')]['id'],'id':_[_0xc4ef('0x41')](_0x428ddf,function(_0xd7cf0b){return _0xd7cf0b['id'];})},'transaction':_0x2f625b});}})['then'](function(_0x575712){var _0x486bda=_[_0xc4ef('0x41')](_0x4b039c[_0xc4ef('0x4e')],function(_0x625a7c){_0x625a7c[_0xc4ef('0x5a')]=_0x4b039c[_0xc4ef('0x48')]['id'];return _0x625a7c;});return db[_0xc4ef('0x56')]['bulkCreate'](_0x486bda,{'raw':!![],'transaction':_0x2f625b});})[_0xc4ef('0x27')](function(_0x3dd3da){var _0x154549=_['filter'](_[_0xc4ef('0x41')](_0x3dd3da,function(_0x5c282d){return _0x5c282d[_0xc4ef('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x154549){return db[_0xc4ef('0x56')][_0xc4ef('0x45')]({'where':{'userProfileId':_0x4b039c['params']['id'],'sectionId':_[_0xc4ef('0x41')](_0x154549,function(_0x595c49){return _0x595c49[_0xc4ef('0x59')];})},'attributes':['id',_0xc4ef('0x59')],'raw':!![]})[_0xc4ef('0x27')](function(_0x213701){var _0x303f51=_[_0xc4ef('0x41')](_0x4b039c[_0xc4ef('0x4e')],function(_0x19d235){_0x19d235['userProfileId']=_0x4b039c[_0xc4ef('0x48')]['id'];return _0x19d235;});return db[_0xc4ef('0x58')][_0xc4ef('0x6b')](_0x303f51,{'raw':!![],'transaction':_0x2f625b});});}})[_0xc4ef('0x4c')](handleError(_0xfd8bbd,null));});}})[_0xc4ef('0x27')](function(_0x3e9d4e){var _0x4bd2bc=_[_0xc4ef('0x41')](_0x3e9d4e,function(_0x338243){return _0x338243[_0xc4ef('0x4f')]({'plain':!![]});});})[_0xc4ef('0x27')](respondWithResult(_0xfd8bbd,null))[_0xc4ef('0x4c')](handleError(_0xfd8bbd,null));};exports[_0xc4ef('0x6c')]=function(_0x5e28e6,_0x2cb874,_0x2316fc){return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x5e28e6[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x2cb874,null))['then'](function(_0x14e9e4){if(_0x14e9e4){return _0x14e9e4[_0xc4ef('0x6c')](_0x5e28e6[_0xc4ef('0x33')][_0xc4ef('0x60')]);}})['then'](respondWithStatusCode(_0x2cb874,null))['catch'](handleError(_0x2cb874,null));};exports[_0xc4ef('0x6d')]=function(_0x123d31,_0x48b115){var _0x5383e2={};if(!_0x123d31['query']['section'])throw new Error(_0xc4ef('0x6e'));if(!_0x123d31[_0xc4ef('0x33')][_0xc4ef('0x39')](_0xc4ef('0x3a'))){_0x5383e2[_0xc4ef('0x1f')]=qs[_0xc4ef('0x1f')](_0x123d31['query'][_0xc4ef('0x1f')]);_0x5383e2[_0xc4ef('0x22')]=qs['offset'](_0x123d31[_0xc4ef('0x33')][_0xc4ef('0x22')]);}return db[_0xc4ef('0x2e')]['find']({'where':{'id':_0x123d31['params']['id']}})[_0xc4ef('0x27')](function(_0x5781d2){if(!_0x5781d2)throw new Error(_0xc4ef('0x6f')+_0x123d31[_0xc4ef('0x48')]['id']);return db['UserProfile'][_0xc4ef('0x6d')](_0x123d31);})[_0xc4ef('0x27')](respondWithFilteredResult(_0x48b115,_0x5383e2))[_0xc4ef('0x4c')](handleError(_0x48b115,null));}; \ No newline at end of file +var _0x3e3f=['forEach','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','request-promise','util','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','find','create','body','omit','createdAt','updatedAt','crudPermissions','transaction','get','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','addSections','sequelize','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','push','findOne'];(function(_0x3c9694,_0x162894){var _0x18d4f6=function(_0x13c344){while(--_0x13c344){_0x3c9694['push'](_0x3c9694['shift']());}};_0x18d4f6(++_0x162894);}(_0x3e3f,0xe8));var _0xf3e3=function(_0x312387,_0x134ed2){_0x312387=_0x312387-0x0;var _0x38fdf8=_0x3e3f[_0x312387];return _0x38fdf8;};'use strict';var emlformat=require(_0xf3e3('0x0'));var rimraf=require(_0xf3e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf3e3('0x3'));var path=require(_0xf3e3('0x4'));var sox=require(_0xf3e3('0x5'));var csv=require(_0xf3e3('0x6'));var ejs=require(_0xf3e3('0x7'));var fs=require('fs');var fs_extra=require(_0xf3e3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3e3('0x9'));var jsforce=require(_0xf3e3('0xa'));var deskjs=require(_0xf3e3('0xb'));var toCsv=require(_0xf3e3('0x6'));var querystring=require(_0xf3e3('0xc'));var Papa=require(_0xf3e3('0xd'));var Redis=require(_0xf3e3('0xe'));var authService=require(_0xf3e3('0xf'));var qs=require(_0xf3e3('0x10'));var as=require(_0xf3e3('0x11'));var hardwareService=require(_0xf3e3('0x12'));var logger=require(_0xf3e3('0x13'))(_0xf3e3('0x14'));var utils=require(_0xf3e3('0x15'));var config=require(_0xf3e3('0x16'));var licenseUtil=require(_0xf3e3('0x17'));var db=require('../../mysqldb')['db'];config[_0xf3e3('0x18')]=_[_0xf3e3('0x19')](config[_0xf3e3('0x18')],{'host':_0xf3e3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3e3('0x18')]));require(_0xf3e3('0x1b'))[_0xf3e3('0x1c')](socket);function respondWithStatusCode(_0x584364,_0x4ac116){_0x4ac116=_0x4ac116||0xcc;return function(_0x44b383){if(_0x44b383){return _0x584364['sendStatus'](_0x4ac116);}return _0x584364[_0xf3e3('0x1d')](_0x4ac116)['end']();};}function respondWithResult(_0x25ab11,_0x85a902){_0x85a902=_0x85a902||0xc8;return function(_0x464884){if(_0x464884){return _0x25ab11[_0xf3e3('0x1d')](_0x85a902)['json'](_0x464884);}};}function respondWithFilteredResult(_0x494fe9,_0x47ac29){return function(_0x50f72a){if(_0x50f72a){var _0x3a6a5b=typeof _0x47ac29['offset']==='undefined'&&typeof _0x47ac29[_0xf3e3('0x1e')]===_0xf3e3('0x1f');var _0xf0bb94=_0x50f72a[_0xf3e3('0x20')];var _0x326c97=_0x3a6a5b?0x0:_0x47ac29['offset'];var _0x1feb03=_0x3a6a5b?_0x50f72a[_0xf3e3('0x20')]:_0x47ac29[_0xf3e3('0x21')]+_0x47ac29[_0xf3e3('0x1e')];var _0x55b85c;if(_0x1feb03>=_0xf0bb94){_0x1feb03=_0xf0bb94;_0x55b85c=0xc8;}else{_0x55b85c=0xce;}_0x494fe9['status'](_0x55b85c);return _0x494fe9[_0xf3e3('0x22')]('Content-Range',_0x326c97+'-'+_0x1feb03+'/'+_0xf0bb94)[_0xf3e3('0x23')](_0x50f72a);}return null;};}function patchUpdates(_0x55562e){return function(_0x1a87af){try{jsonpatch[_0xf3e3('0x24')](_0x1a87af,_0x55562e,!![]);}catch(_0xa8abca){return BPromise[_0xf3e3('0x25')](_0xa8abca);}return _0x1a87af[_0xf3e3('0x26')]();};}function saveUpdates(_0x14073e,_0x137cde){return function(_0x30c42c){if(_0x30c42c){return _0x30c42c[_0xf3e3('0x27')](_0x14073e)[_0xf3e3('0x28')](function(_0x403553){return _0x403553;});}return null;};}function removeEntity(_0x2007bc,_0x432d73){return function(_0x27b42c){if(_0x27b42c){return _0x27b42c[_0xf3e3('0x29')]()[_0xf3e3('0x28')](function(){_0x2007bc[_0xf3e3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x657be0,_0x195a1e){return function(_0x5cfbae){if(!_0x5cfbae){_0x657be0[_0xf3e3('0x2a')](0x194);}return _0x5cfbae;};}function handleError(_0x49a250,_0x25c660){_0x25c660=_0x25c660||0x1f4;return function(_0x222253){logger[_0xf3e3('0x2b')](_0x222253[_0xf3e3('0x2c')]);if(_0x222253[_0xf3e3('0x2d')]){delete _0x222253['name'];}_0x49a250['status'](_0x25c660)[_0xf3e3('0x2e')](_0x222253);};}exports[_0xf3e3('0x2f')]=function(_0x3d6ff4,_0x136f11){var _0x31423c={},_0x42ebd1={},_0x21a449={'count':0x0,'rows':[]};var _0x5aacde=_[_0xf3e3('0x30')](db[_0xf3e3('0x31')]['rawAttributes'],function(_0x352972){return{'name':_0x352972[_0xf3e3('0x32')],'type':_0x352972[_0xf3e3('0x33')][_0xf3e3('0x34')]};});_0x42ebd1[_0xf3e3('0x35')]=_[_0xf3e3('0x30')](_0x5aacde,_0xf3e3('0x2d'));_0x42ebd1[_0xf3e3('0x36')]=_[_0xf3e3('0x37')](_0x3d6ff4[_0xf3e3('0x36')]);_0x42ebd1[_0xf3e3('0x38')]=_[_0xf3e3('0x39')](_0x42ebd1[_0xf3e3('0x35')],_0x42ebd1[_0xf3e3('0x36')]);_0x31423c[_0xf3e3('0x3a')]=_[_0xf3e3('0x39')](_0x42ebd1[_0xf3e3('0x35')],qs[_0xf3e3('0x3b')](_0x3d6ff4['query'][_0xf3e3('0x3b')]));_0x31423c[_0xf3e3('0x3a')]=_0x31423c[_0xf3e3('0x3a')][_0xf3e3('0x3c')]?_0x31423c[_0xf3e3('0x3a')]:_0x42ebd1[_0xf3e3('0x35')];if(!_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x3d')](_0xf3e3('0x3e'))){_0x31423c[_0xf3e3('0x1e')]=qs[_0xf3e3('0x1e')](_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x1e')]);_0x31423c['offset']=qs[_0xf3e3('0x21')](_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x21')]);}_0x31423c[_0xf3e3('0x3f')]=qs[_0xf3e3('0x40')](_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x40')]);_0x31423c[_0xf3e3('0x41')]=qs['filters'](_['pick'](_0x3d6ff4[_0xf3e3('0x36')],_0x42ebd1['filters']),_0x5aacde);if(_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x42')]){_0x31423c['where']=_[_0xf3e3('0x43')](_0x31423c[_0xf3e3('0x41')],{'$or':_[_0xf3e3('0x30')](_0x5aacde,function(_0x13faf5){if(_0x13faf5[_0xf3e3('0x33')]!==_0xf3e3('0x44')){var _0x1cda1a={};_0x1cda1a[_0x13faf5[_0xf3e3('0x2d')]]={'$like':'%'+_0x3d6ff4['query'][_0xf3e3('0x42')]+'%'};return _0x1cda1a;}})});}_0x31423c=_[_0xf3e3('0x43')]({},_0x31423c,_0x3d6ff4[_0xf3e3('0x45')]);var _0x1aeb16={'where':_0x31423c[_0xf3e3('0x41')]};return db[_0xf3e3('0x31')][_0xf3e3('0x20')](_0x1aeb16)[_0xf3e3('0x28')](function(_0x49a028){_0x21a449['count']=_0x49a028;if(_0x3d6ff4[_0xf3e3('0x36')][_0xf3e3('0x46')]){_0x31423c['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x31423c);})[_0xf3e3('0x28')](function(_0x217cf0){_0x21a449['rows']=_0x217cf0;return _0x21a449;})[_0xf3e3('0x28')](respondWithFilteredResult(_0x136f11,_0x31423c))[_0xf3e3('0x47')](handleError(_0x136f11,null));};exports[_0xf3e3('0x48')]=function(_0x57c6f0,_0x2590c1){var _0x4fab8e={'raw':![],'where':{'id':_0x57c6f0[_0xf3e3('0x49')]['id']}},_0x48efa9={};_0x48efa9[_0xf3e3('0x35')]=_[_0xf3e3('0x37')](db[_0xf3e3('0x31')][_0xf3e3('0x4a')]);_0x48efa9[_0xf3e3('0x36')]=_[_0xf3e3('0x37')](_0x57c6f0['query']);_0x48efa9[_0xf3e3('0x38')]=_[_0xf3e3('0x39')](_0x48efa9[_0xf3e3('0x35')],_0x48efa9[_0xf3e3('0x36')]);_0x4fab8e[_0xf3e3('0x3a')]=_['intersection'](_0x48efa9[_0xf3e3('0x35')],qs[_0xf3e3('0x3b')](_0x57c6f0[_0xf3e3('0x36')]['fields']));_0x4fab8e[_0xf3e3('0x3a')]=_0x4fab8e[_0xf3e3('0x3a')][_0xf3e3('0x3c')]?_0x4fab8e[_0xf3e3('0x3a')]:_0x48efa9[_0xf3e3('0x35')];if(_0x57c6f0[_0xf3e3('0x36')][_0xf3e3('0x46')]){_0x4fab8e['include']=[{'all':!![]}];}_0x4fab8e=_['merge']({},_0x4fab8e,_0x57c6f0[_0xf3e3('0x45')]);return db['UserProfile'][_0xf3e3('0x4b')](_0x4fab8e)[_0xf3e3('0x28')](handleEntityNotFound(_0x2590c1,null))[_0xf3e3('0x28')](respondWithResult(_0x2590c1,null))[_0xf3e3('0x47')](handleError(_0x2590c1,null));};exports[_0xf3e3('0x4c')]=function(_0x4d06b4,_0x928888){return db[_0xf3e3('0x31')][_0xf3e3('0x4c')](_0x4d06b4[_0xf3e3('0x4d')],{})[_0xf3e3('0x28')](respondWithResult(_0x928888,0xc9))[_0xf3e3('0x47')](handleError(_0x928888,null));};exports['clone']=function(_0x31a7d7,_0x1915b3){var _0x3e851d={'where':{'id':_0x31a7d7[_0xf3e3('0x49')]['id']}},_0xb20eb6={};_0xb20eb6[_0xf3e3('0x35')]=_[_0xf3e3('0x37')](db['UserProfile'][_0xf3e3('0x4a')]);_0x3e851d[_0xf3e3('0x3a')]=_[_0xf3e3('0x39')](_0xb20eb6[_0xf3e3('0x35')],qs['fields'](_0x31a7d7[_0xf3e3('0x36')]['fields']));_0x3e851d[_0xf3e3('0x3a')]=_0x3e851d[_0xf3e3('0x3a')][_0xf3e3('0x3c')]?_0x3e851d['attributes']:_0xb20eb6[_0xf3e3('0x35')];if(_0x31a7d7['query']['includeAll']){_0x3e851d['include']=[{'all':!![]}];}_0x3e851d=_['merge']({},_0x3e851d,_0x31a7d7[_0xf3e3('0x45')]);return db[_0xf3e3('0x31')]['find'](_0x3e851d)['then'](handleEntityNotFound(_0x1915b3,null))['then'](function(_0xe8be96){if(_0xe8be96){var _0x2036af=_0xe8be96['get']({'plain':!![]});_0x2036af=qs[_0xf3e3('0x4e')](_0x2036af,['id',_0xf3e3('0x4f'),_0xf3e3('0x50'),_0xf3e3('0x51')]);_0x31a7d7['body']=_[_0xf3e3('0x4e')](_0x31a7d7[_0xf3e3('0x4d')],['id','createdAt',_0xf3e3('0x50')]);return db['sequelize'][_0xf3e3('0x52')](function(_0x4219ee){return db['UserProfile']['create'](_[_0xf3e3('0x43')](_0x2036af,_0x31a7d7[_0xf3e3('0x4d')]),{'include':_0x31a7d7[_0xf3e3('0x36')][_0xf3e3('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4219ee})[_0xf3e3('0x28')](function(_0x506601){var _0xc63ca0=_0x506601[_0xf3e3('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xf3e3('0x54')]({'where':{'userProfileId':_0x31a7d7[_0xf3e3('0x49')]['id']},'raw':!![]})['then'](function(_0x1a6e60){if(_0x1a6e60){return BPromise[_0xf3e3('0x55')](_0x1a6e60,function(_0x404146){return new BPromise(function(_0x1c069a,_0x58d551){if(_0x404146[_0xf3e3('0x56')]===null||_0x404146['autoAssociation']===0x1)_0x1c069a(null);return db[_0xf3e3('0x57')]['findAll']({'where':{'sectionId':_0x404146['id']},'raw':!![]})[_0xf3e3('0x28')](function(_0x37d91a){var _0x264243=_[_0xf3e3('0x30')](_0x37d91a,function(_0x2e7fea){return qs['omit'](_0x2e7fea,['id',_0xf3e3('0x4f'),_0xf3e3('0x50'),_0xf3e3('0x58')]);});_0x1c069a(_0x264243);})[_0xf3e3('0x47')](function(_0x466f23){_0x58d551(_0x466f23);});})['then'](function(_0x1c77c6){var _0x2e8009=qs[_0xf3e3('0x4e')](_0x404146,['id',_0xf3e3('0x4f'),_0xf3e3('0x50')]);_0x2e8009[_0xf3e3('0x59')]=_0xc63ca0['id'];if(_0x1c77c6)_0x2e8009[_0xf3e3('0x5a')]=_0x1c77c6;return _0x2e8009;})[_0xf3e3('0x28')](function(_0x29e454){return db[_0xf3e3('0x5b')][_0xf3e3('0x4c')](_0x29e454,{'include':[{'model':db[_0xf3e3('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x4219ee});});})['then'](function(){return _0xc63ca0;});}});});});}})[_0xf3e3('0x28')](respondWithResult(_0x1915b3,0xc9))[_0xf3e3('0x47')](handleError(_0x1915b3,null));};exports[_0xf3e3('0x27')]=function(_0x54d15d,_0x2ec737){if(_0x54d15d[_0xf3e3('0x4d')]['id']){delete _0x54d15d['body']['id'];}return db['UserProfile'][_0xf3e3('0x4b')]({'where':{'id':_0x54d15d['params']['id']}})[_0xf3e3('0x28')](handleEntityNotFound(_0x2ec737,null))['then'](saveUpdates(_0x54d15d[_0xf3e3('0x4d')],null))[_0xf3e3('0x28')](respondWithResult(_0x2ec737,null))[_0xf3e3('0x47')](handleError(_0x2ec737,null));};exports[_0xf3e3('0x29')]=function(_0x32d901,_0x18d5bc){return db[_0xf3e3('0x31')]['find']({'where':{'id':_0x32d901[_0xf3e3('0x49')]['id']}})[_0xf3e3('0x28')](handleEntityNotFound(_0x18d5bc,null))[_0xf3e3('0x28')](removeEntity(_0x18d5bc,null))['catch'](handleError(_0x18d5bc,null));};exports['describe']=function(_0x37ea3e,_0xe08df6){return db[_0xf3e3('0x31')]['describe']()[_0xf3e3('0x28')](respondWithResult(_0xe08df6,null))['catch'](handleError(_0xe08df6,null));};exports[_0xf3e3('0x5c')]=function(_0x38feaa,_0x3626a2){var _0x200868=_0x38feaa[_0xf3e3('0x4d')];return db[_0xf3e3('0x31')][_0xf3e3('0x4b')]({'where':{'id':_0x38feaa[_0xf3e3('0x49')]['id']}})['then'](handleEntityNotFound(_0x3626a2,null))['then'](function(_0xa91f4){if(_0xa91f4){return db[_0xf3e3('0x5d')][_0xf3e3('0x52')](function(_0x5ab48b){return db[_0xf3e3('0x5b')][_0xf3e3('0x29')]({'where':{'userProfileId':_0x38feaa[_0xf3e3('0x49')]['id'],'sectionId':_[_0xf3e3('0x30')](_0x200868,function(_0x1213cb){return _0x1213cb[_0xf3e3('0x58')];})},'transaction':_0x5ab48b})[_0xf3e3('0x28')](function(){var _0x123f19=_['map'](_0x200868,function(_0x4f8098){_0x4f8098[_0xf3e3('0x59')]=_0x38feaa[_0xf3e3('0x49')]['id'];return _0x4f8098;});var _0x9809=[];return BPromise['each'](_0x123f19,function(_0x446383){return db[_0xf3e3('0x5b')][_0xf3e3('0x4c')](_0x446383,{'include':[{'model':db[_0xf3e3('0x57')],'as':_0xf3e3('0x5a')}],'raw':!![],'transaction':_0x5ab48b})[_0xf3e3('0x28')](function(_0x4f4caa){_0x9809['push'](_0x4f4caa[_0xf3e3('0x53')]({'plain':!![]}));});})[_0xf3e3('0x28')](function(){return _0x9809;});});});}})[_0xf3e3('0x28')](function(_0x3f1a79){return _0x3f1a79;})[_0xf3e3('0x28')](respondWithResult(_0x3626a2,null))[_0xf3e3('0x47')](handleError(_0x3626a2,null));};exports[_0xf3e3('0x5e')]=function(_0x10fb9e,_0x5a036b){var _0x2c4da0;return db['UserProfile'][_0xf3e3('0x4b')]({'where':{'id':_0x10fb9e[_0xf3e3('0x49')]['id']},'attributes':['id',_0xf3e3('0x2d')]})['then'](handleEntityNotFound(_0x5a036b,null))[_0xf3e3('0x28')](function(_0x50ce9f){if(_0x50ce9f){_0x2c4da0=_0x50ce9f;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x10fb9e[_0xf3e3('0x49')]['id'],'sectionId':_0x10fb9e[_0xf3e3('0x36')][_0xf3e3('0x5f')]}});}})[_0xf3e3('0x28')](function(){return _0x2c4da0;})[_0xf3e3('0x28')](respondWithStatusCode(_0x5a036b,null))['catch'](handleError(_0x5a036b,null));};exports[_0xf3e3('0x60')]=function(_0x42dd86,_0x3bb153){var _0x28c923=[];var _0x52d9d0=[];return db[_0xf3e3('0x5b')][_0xf3e3('0x54')]({'where':{'userProfileId':_0x42dd86['params']['id']},'raw':!![]})[_0xf3e3('0x28')](function(_0x256a79){_0x28c923=_['filter'](_0x256a79,function(_0x243447){return _0x243447[_0xf3e3('0x61')]===0x1||_[_0xf3e3('0x62')]([0x3eb,0x709],_0x243447[_0xf3e3('0x58')]);});if(!_[_0xf3e3('0x63')](_0x28c923)){return _[_0xf3e3('0x30')](_0x28c923,function(_0x539bc2){return _0x539bc2[_0xf3e3('0x58')];});}else{return;}})['then'](function(_0xeea61c){if(_0xeea61c)_0x52d9d0=_0xeea61c;if(_[_0xf3e3('0x62')](_0x52d9d0,0x64)){var _0x315285=_[_0xf3e3('0x4b')](_0x28c923,{'sectionId':0x64});return hasDefaultDashboard(_0x315285)[_0xf3e3('0x28')](function(_0x260cbe){return _['map'](_0x28c923,function(_0x5569e9){if(_0x5569e9[_0xf3e3('0x58')]===0x64){_0x5569e9[_0xf3e3('0x64')]=_0x260cbe;}return _0x5569e9;});});}else{return;}})[_0xf3e3('0x28')](function(_0x170eb0){if(_0x170eb0)_0x28c923=_0x170eb0;if(_[_0xf3e3('0x62')](_0x52d9d0,0x3eb)){var _0x2847b7=_[_0xf3e3('0x4b')](_0x28c923,{'sectionId':0x3eb});return getCustomDashboards(_0x2847b7)[_0xf3e3('0x28')](function(_0xad31fd){return _[_0xf3e3('0x30')](_0x28c923,function(_0x267a8e){if(_0x2847b7[_0xf3e3('0x61')]){if(_0x267a8e[_0xf3e3('0x58')]===0x3eb){_0x267a8e['subsections']=_0xad31fd;}}else{if(_0x267a8e[_0xf3e3('0x58')]===0x64){if(!_0x267a8e[_0xf3e3('0x64')]){_0x267a8e[_0xf3e3('0x64')]=[];}_0x267a8e[_0xf3e3('0x64')]=_0x267a8e[_0xf3e3('0x64')][_0xf3e3('0x65')](_0xad31fd);}}return _0x267a8e;});});}else{return;}})[_0xf3e3('0x28')](function(_0x2ba42b){if(_0x2ba42b)_0x28c923=_0x2ba42b;if(_[_0xf3e3('0x62')](_0x52d9d0,0x709)){var _0x210a0a=_[_0xf3e3('0x4b')](_0x28c923,{'sectionId':0x709});return getPlugins(_0x210a0a)['then'](function(_0x4f8bf3){if(_0x210a0a[_0xf3e3('0x61')]){return _[_0xf3e3('0x30')](_0x28c923,function(_0x470b6f){if(_0x470b6f[_0xf3e3('0x58')]===0x709){_0x470b6f[_0xf3e3('0x64')]=_0x4f8bf3;}return _0x470b6f;});}else{var _0x545fa8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4f8bf3};var _0x1fc700=_['map'](_0x28c923);_0x1fc700[_0xf3e3('0x66')](_0x545fa8);return _0x1fc700;}});}else{return;}})[_0xf3e3('0x28')](function(_0x26af59){if(_0x26af59)_0x28c923=_0x26af59;return _[_0xf3e3('0x42')](_0x28c923,[_0xf3e3('0x61'),0x1]);})['then'](respondWithResult(_0x3bb153,null))[_0xf3e3('0x47')](handleError(_0x3bb153,null));};function hasDefaultDashboard(_0x37c803){var _0x54aa=[0x65];return new BPromise(function(_0x42c3cf,_0x54e762){try{if(_0x37c803[_0xf3e3('0x56')]){_0x42c3cf(_0x54aa);}else{return db[_0xf3e3('0x57')][_0xf3e3('0x67')]({'where':{'sectionId':_0x37c803['id']},'raw':!![]})['then'](function(_0x27c88d){_0x27c88d?_0x42c3cf(_0x54aa):_0x42c3cf();});}}catch(_0x4348b1){_0x54e762(_0x4348b1);}});}function getCustomDashboards(_0x2fb298){var _0x42a3a9=[];return new BPromise(function(_0x29c5de,_0x46c11f){try{if(_0x2fb298[_0xf3e3('0x56')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xf3e3('0x28')](function(_0x682df){_0x682df[_0xf3e3('0x68')](function(_0x2eb5b6){_0x42a3a9[_0xf3e3('0x66')](_0x2eb5b6['id']+0x1869f);});_0x29c5de(_0x42a3a9);});}else{return db[_0xf3e3('0x57')][_0xf3e3('0x54')]({'where':{'sectionId':_0x2fb298['id']},'raw':!![]})[_0xf3e3('0x28')](function(_0x4570e7){_0x4570e7[_0xf3e3('0x68')](function(_0x11f0c2){_0x42a3a9['push'](_0x11f0c2[_0xf3e3('0x69')]+0x1869f);});_0x29c5de(_0x42a3a9);});}}catch(_0x39531a){_0x46c11f(_0x39531a);}});}function getPlugins(_0x1ccbe8){var _0xa646de=[];return new BPromise(function(_0x4be3b2,_0xf090b){try{if(_0x1ccbe8[_0xf3e3('0x56')]){return db['Plugin'][_0xf3e3('0x54')]({'raw':!![]})['then'](function(_0x429d7a){_0x429d7a[_0xf3e3('0x68')](function(_0x1f2739){_0xa646de[_0xf3e3('0x66')](_0x1f2739['id']+0x15b38);});_0x4be3b2(_0xa646de);});}else{return db[_0xf3e3('0x57')][_0xf3e3('0x54')]({'where':{'sectionId':_0x1ccbe8['id']},'raw':!![]})[_0xf3e3('0x28')](function(_0x512880){_0x512880['forEach'](function(_0x1de4ce){_0xa646de[_0xf3e3('0x66')](_0x1de4ce[_0xf3e3('0x69')]+0x15b38);});_0x4be3b2(_0xa646de);});}}catch(_0xc143be){_0xf090b(_0xc143be);}});}exports[_0xf3e3('0x6a')]=function(_0x1e99bf,_0xc7e28b){return db[_0xf3e3('0x31')][_0xf3e3('0x4b')]({'where':{'id':_0x1e99bf[_0xf3e3('0x49')]['id']}})[_0xf3e3('0x28')](handleEntityNotFound(_0xc7e28b,null))[_0xf3e3('0x28')](function(_0x28a783){if(_0x28a783){return db['sequelize'][_0xf3e3('0x52')](function(_0x5282a3){return db[_0xf3e3('0x5b')][_0xf3e3('0x54')]({'where':{'userProfileId':_0x1e99bf[_0xf3e3('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xf3e3('0x28')](function(_0x13d8d7){if(_0x13d8d7){return db[_0xf3e3('0x5b')][_0xf3e3('0x29')]({'where':{'userProfileId':_0x1e99bf[_0xf3e3('0x49')]['id'],'id':_[_0xf3e3('0x30')](_0x13d8d7,function(_0xe81c3){return _0xe81c3['id'];})},'transaction':_0x5282a3});}})[_0xf3e3('0x28')](function(_0x571e68){var _0x1666a7=_[_0xf3e3('0x30')](_0x1e99bf[_0xf3e3('0x4d')],function(_0x2f699d){_0x2f699d[_0xf3e3('0x59')]=_0x1e99bf['params']['id'];return _0x2f699d;});return db[_0xf3e3('0x5b')][_0xf3e3('0x6b')](_0x1666a7,{'raw':!![],'transaction':_0x5282a3});})[_0xf3e3('0x28')](function(_0x2db4ac){var _0x2bd9f4=_['filter'](_[_0xf3e3('0x30')](_0x2db4ac,function(_0x4652a8){return _0x4652a8['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2bd9f4){return db[_0xf3e3('0x5b')][_0xf3e3('0x54')]({'where':{'userProfileId':_0x1e99bf[_0xf3e3('0x49')]['id'],'sectionId':_[_0xf3e3('0x30')](_0x2bd9f4,function(_0x4ec508){return _0x4ec508[_0xf3e3('0x58')];})},'attributes':['id',_0xf3e3('0x58')],'raw':!![]})[_0xf3e3('0x28')](function(_0x1640c5){var _0x2f1443=_[_0xf3e3('0x30')](_0x1e99bf['body'],function(_0x2bebb1){_0x2bebb1[_0xf3e3('0x59')]=_0x1e99bf[_0xf3e3('0x49')]['id'];return _0x2bebb1;});return db[_0xf3e3('0x57')]['bulkCreate'](_0x2f1443,{'raw':!![],'transaction':_0x5282a3});});}})[_0xf3e3('0x47')](handleError(_0xc7e28b,null));});}})[_0xf3e3('0x28')](function(_0x374e5c){var _0x4ad55c=_['map'](_0x374e5c,function(_0x57d0e7){return _0x57d0e7[_0xf3e3('0x53')]({'plain':!![]});});})[_0xf3e3('0x28')](respondWithResult(_0xc7e28b,null))[_0xf3e3('0x47')](handleError(_0xc7e28b,null));};exports[_0xf3e3('0x6c')]=function(_0x49022f,_0x35352e,_0x686c86){return db['UserProfile'][_0xf3e3('0x4b')]({'where':{'id':_0x49022f[_0xf3e3('0x49')]['id']}})[_0xf3e3('0x28')](handleEntityNotFound(_0x35352e,null))['then'](function(_0x41ba9b){if(_0x41ba9b){return _0x41ba9b[_0xf3e3('0x6c')](_0x49022f['query'][_0xf3e3('0x5f')]);}})[_0xf3e3('0x28')](respondWithStatusCode(_0x35352e,null))[_0xf3e3('0x47')](handleError(_0x35352e,null));};exports[_0xf3e3('0x6d')]=function(_0xeb0337,_0x57d375){var _0x291f8a={};if(!_0xeb0337[_0xf3e3('0x36')]['section'])throw new Error(_0xf3e3('0x6e'));if(!_0xeb0337[_0xf3e3('0x36')][_0xf3e3('0x3d')](_0xf3e3('0x3e'))){_0x291f8a['limit']=qs[_0xf3e3('0x1e')](_0xeb0337[_0xf3e3('0x36')][_0xf3e3('0x1e')]);_0x291f8a[_0xf3e3('0x21')]=qs[_0xf3e3('0x21')](_0xeb0337[_0xf3e3('0x36')][_0xf3e3('0x21')]);}return db[_0xf3e3('0x31')]['find']({'where':{'id':_0xeb0337['params']['id']}})['then'](function(_0x513e0a){if(!_0x513e0a)throw new Error(_0xf3e3('0x6f')+_0xeb0337[_0xf3e3('0x49')]['id']);return db[_0xf3e3('0x31')][_0xf3e3('0x6d')](_0xeb0337);})[_0xf3e3('0x28')](respondWithFilteredResult(_0x57d375,_0x291f8a))[_0xf3e3('0x47')](handleError(_0x57d375,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5fea4d4..27c77e7 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 _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x2fd954,_0x508b80){var _0x94ad9f=function(_0x541fe7){while(--_0x541fe7){_0x2fd954['push'](_0x2fd954['shift']());}};_0x94ad9f(++_0x508b80);}(_0xcf71,0xba));var _0x1cf7=function(_0xcedf57,_0x335b10){_0xcedf57=_0xcedf57-0x0;var _0x35eccf=_0xcf71[_0xcedf57];return _0x35eccf;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var UserProfile=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];UserProfile[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xc1fc=['emit','hook','exports','../../mysqldb','UserProfile','save','update','remove'];(function(_0x37899c,_0x4090e2){var _0x478dee=function(_0x443ad0){while(--_0x443ad0){_0x37899c['push'](_0x37899c['shift']());}};_0x478dee(++_0x4090e2);}(_0xc1fc,0x93));var _0xcc1f=function(_0x2e0ad8,_0x4b814d){_0x2e0ad8=_0x2e0ad8-0x0;var _0x1a80df=_0xc1fc[_0x2e0ad8];return _0x1a80df;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xcc1f('0x0'))['db'][_0xcc1f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc1f('0x2'),'afterUpdate':_0xcc1f('0x3'),'afterDestroy':_0xcc1f('0x4')};function emitEvent(_0x3f57ea){return function(_0x26d3b2,_0x52703d,_0x42d563){UserProfileEvents[_0xcc1f('0x5')](_0x3f57ea+':'+_0x26d3b2['id'],_0x26d3b2);UserProfileEvents['emit'](_0x3f57ea,_0x26d3b2);_0x42d563(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcc1f('0x6')](e,emitEvent(event));}}module[_0xcc1f('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 098a4ad..027a050 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 _0xfe13=['extractedreports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','mergeResources','isEmpty','length','UserProfileSection','params','ignore','find','autoAssociation','push','model','all','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','include','findAll','forEach','reportType','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tag','Tags','color','tag','ThroughTags','true','chat','dataValues','fax','mail','openchannel','whatsapp','exports','filter','field','then','associatedResources','map','value','name','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin'];(function(_0x2ed98b,_0x131330){var _0x57db25=function(_0x4eb4ee){while(--_0x4eb4ee){_0x2ed98b['push'](_0x2ed98b['shift']());}};_0x57db25(++_0x131330);}(_0xfe13,0x10b));var _0x3fe1=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xfe13[_0x329437];return _0x3789d9;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0x3fe1('0x0')]=function(_0x461405){var _0x7a2bba=_0x461405['models'];function _0x882e25(_0x1b1e99,_0x13df76){return new Promise(function(_0x30452d,_0x531ec4){if(!_0x13df76)return _0x30452d(null);var _0x55e425=_0x13df76[_0x3fe1('0x1')]?{[_0x13df76[_0x3fe1('0x1')][_0x3fe1('0x2')]]:_0x13df76[_0x3fe1('0x1')]['value']}:undefined;return _0x7a2bba[_0x1b1e99]['findAll']({'where':_0x55e425,'raw':!![]})[_0x3fe1('0x3')](function(_0x440e0d){_0x13df76[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x440e0d,'id');_0x30452d(_0x13df76);})['catch'](function(_0x453335){_0x531ec4(_0x453335);});});}function _0x45beb8(_0x2f4f80,_0x2ccda6){return new Promise(function(_0x3e5dd2,_0x533adc){var _0x480a29=_0x2f4f80['filter']?{[_0x2f4f80[_0x3fe1('0x1')][_0x3fe1('0x2')]]:_0x2f4f80[_0x3fe1('0x1')][_0x3fe1('0x6')]}:undefined;return _0x7a2bba[_0x2f4f80['model']]['findAll']({'where':_0x480a29,'raw':!![]})[_0x3fe1('0x3')](function(_0x16c623){_0x2ccda6[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x16c623,function(_0x522862){return _0x522862[_0x3fe1('0x7')];});_0x3e5dd2(_0x2ccda6);})['catch'](function(_0x4c18d7){_0x533adc(_0x4c18d7);});});}function _0x290924(_0x2c734e,_0xed8388,_0x3ca36d){if(!_0xed8388)return Promise['resolve'](null);return new Promise(function(_0x1fe99e,_0x4c7aca){return _0x7a2bba['UserProfileResource']['findAll']({'where':{'sectionId':_0xed8388['id']},'raw':!![]})['then'](function(_0x4ac09f){if(_0x2c734e[_0x3fe1('0x2')]&&_0x2c734e[_0x3fe1('0x2')]!=='id'){_0xed8388['associatedResources']=_[_0x3fe1('0x5')](_0x4ac09f,function(_0x3a5c8d){return _0x3a5c8d[_0x2c734e[_0x3fe1('0x2')]];});}else{if(_0x3ca36d===_0x3fe1('0x8')){_0xed8388[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x4ac09f,function(_0x273a9e){return{'id':_0x273a9e[_0x3fe1('0x9')],'type':_0x273a9e[_0x3fe1('0xa')]};});}else{_0xed8388[_0x3fe1('0x4')]=_['map'](_0x4ac09f,function(_0x25e04b){return _0x25e04b[_0x3fe1('0x9')];});}}_0x1fe99e(_0xed8388);})[_0x3fe1('0xb')](function(_0x154b78){_0x4c7aca(_0x154b78);});});}function _0x26b678(_0x4f9114,_0x3e22c0){var _0x3ab3ab={'parentSections':[]};switch(_0x4f9114[_0x3fe1('0xc')]()){case _0x3fe1('0xd'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0xf');break;case'odbc':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x10');break;case'squarerecordings':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x11');_0x3ab3ab['parentSections']=[{'name':'SquareProjects','field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x12')}];break;case _0x3fe1('0x13'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x14');break;case _0x3fe1('0x15'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x16');_0x3ab3ab['parentSections']=[{'name':_0x3fe1('0x17'),'field':'id','foreignKey':_0x3fe1('0x18')}];break;case'lists':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x19');break;case _0x3fe1('0x1a'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1b');break;case _0x3fe1('0x1c'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1d');break;case'chatqueues':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1e');break;case _0x3fe1('0x1f'):_0x3ab3ab[_0x3fe1('0xe')]='ChatWebsite';break;case _0x3fe1('0x20'):_0x3ab3ab['childModel']=_0x3fe1('0x21');break;case'faxaccounts':_0x3ab3ab['childModel']=_0x3fe1('0x22');break;case'inboundroutes':case'internalroutes':case _0x3fe1('0x23'):_0x3ab3ab['childModel']='VoiceExtension';break;case _0x3fe1('0x24'):_0x3ab3ab['childModel']=_0x3fe1('0x25');break;case _0x3fe1('0x26'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x27');break;case _0x3fe1('0x28'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x29');_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':_0x3fe1('0x2b'),'field':'name','foreignKey':_0x3fe1('0x2c'),'model':_0x3fe1('0x2d'),'filter':{'field':_0x3fe1('0x2e'),'value':[_0x3fe1('0x2f')]}},{'name':'Telephones','field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x2c'),'model':_0x3fe1('0x2d'),'filter':{'field':_0x3fe1('0x2e'),'value':[_0x3fe1('0x30')]}},{'name':_0x3fe1('0x31'),'field':'name','foreignKey':_0x3fe1('0x32'),'model':_0x3fe1('0x33'),'filter':{'field':_0x3fe1('0xa'),'value':[_0x3fe1('0x34')]}},{'name':_0x3fe1('0x35'),'field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x32'),'model':_0x3fe1('0x33'),'filter':{'field':_0x3fe1('0xa'),'value':['outbound']}}];break;case _0x3fe1('0x36'):_0x3ab3ab[_0x3fe1('0xe')]='VoiceMusicOnHold';break;case _0x3fe1('0x37'):_0x3ab3ab['childModel']=_0x3fe1('0x38');break;case'voiceprefixes':_0x3ab3ab['childModel']=_0x3fe1('0x39');break;case _0x3fe1('0x3a'):_0x3ab3ab[_0x3fe1('0xe')]='Campaign';break;case _0x3fe1('0x3b'):_0x3ab3ab['childModel']=_0x3fe1('0x3c');break;case _0x3fe1('0x3d'):_0x3ab3ab['childModel']='MailAccount';break;case _0x3fe1('0x3e'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x3f');break;case _0x3fe1('0x40'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x41');break;case _0x3fe1('0x42'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x43');break;case _0x3fe1('0x44'):_0x3ab3ab['childModel']='SmsQueue';break;case _0x3fe1('0x45'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x46');break;case _0x3fe1('0x47'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x48');break;case _0x3fe1('0x49'):_0x3ab3ab['childModel']='WhatsappAccount';break;case _0x3fe1('0x4a'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x4b');break;case _0x3fe1('0x4c'):case _0x3fe1('0x4d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x33');if(_0x3e22c0){_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x3fe1('0x4e'):case _0x3fe1('0x4f'):case _0x3fe1('0x50'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x2d');if(_0x3e22c0){_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':_0x3fe1('0x51'),'filter':{'field':_0x3fe1('0x2e'),'value':['admin',_0x3fe1('0x52')]},'ignore':!![]},{'name':_0x3fe1('0x2b')},{'name':_0x3fe1('0x53')}];}break;case'zendeskaccounts':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x54');break;case'salesforceaccounts':_0x3ab3ab['childModel']=_0x3fe1('0x55');break;case _0x3fe1('0x56'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x57');break;case _0x3fe1('0x58'):_0x3ab3ab[_0x3fe1('0xe')]='SugarcrmAccount';break;case _0x3fe1('0x59'):_0x3ab3ab['childModel']=_0x3fe1('0x5a');break;case _0x3fe1('0x5b'):_0x3ab3ab[_0x3fe1('0xe')]='ZohoAccount';break;case _0x3fe1('0x5c'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x2d');break;case _0x3fe1('0x5d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x5e');break;case _0x3fe1('0x5f'):_0x3ab3ab[_0x3fe1('0xe')]='Disposition';break;case _0x3fe1('0x60'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x61');break;case _0x3fe1('0x62'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x63');break;case _0x3fe1('0x64'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x65');break;case _0x3fe1('0x66'):_0x3ab3ab['childModel']=_0x3fe1('0x67');break;case'sounds':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x68');break;case'tags':_0x3ab3ab[_0x3fe1('0xe')]='Tag';break;case _0x3fe1('0x69'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6a');break;case _0x3fe1('0x6b'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6c');break;case _0x3fe1('0x6d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6e');break;case _0x3fe1('0x6f'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x70');break;case _0x3fe1('0x71'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x72');break;case _0x3fe1('0x73'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x8');_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':'Reports','field':'id','foreignKey':_0x3fe1('0x74')}];break;case _0x3fe1('0x75'):_0x3ab3ab[_0x3fe1('0xe')]='AnalyticMetric';break;}return _0x3ab3ab;}function _0x297e7f(_0x38a6fa,_0x213c32){var _0x177693=_0x38a6fa[_0x3fe1('0x76')](0x0)[_0x3fe1('0x77')]()+_0x38a6fa[_0x3fe1('0x78')](0x1);var _0x3429b7={'type':_0x7a2bba[_0x3fe1('0x79')][_0x3fe1('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0xdba0c4,_0x49fa04){var _0x5ca35c=squel[_0x3fe1('0x7b')]()[_0x3fe1('0x2')]('ui.'+_0x177693+_0x3fe1('0x7c'),'id')['field'](_0x3fe1('0x7d'))[_0x3fe1('0x7e')](_0x3fe1('0x7f')+_0x38a6fa+_0x3fe1('0x80'),'ui')[_0x3fe1('0x81')](_0x3fe1('0x82'),_0x213c32['id']);return _0x7a2bba[_0x3fe1('0x83')][_0x3fe1('0x84')](_0x5ca35c[_0x3fe1('0x85')](),_0x3429b7)[_0x3fe1('0x3')](function(_0x4cdca2){_0x213c32[_0x177693+_0x3fe1('0x86')]=_0x4cdca2;_0xdba0c4(_0x4cdca2);})[_0x3fe1('0xb')](function(_0x378787){_0x49fa04(_0x378787);});});}return _0x461405[_0x3fe1('0x87')](_0x3fe1('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4810bc){var _0x55c648=require(_0x3fe1('0x89'));var _0x505eb1={'raw':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x8a')],'where':{}};var _0x1d49ac={};var _0x424d29={'count':0x0,'rows':[]};var _0x5c0335=_0x4810bc['query']['section'];var _0x3b0e07=_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x8b')]||![];var _0x2186cd=_0x26b678(_0x5c0335,_0x3b0e07);if(!_0x2186cd['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x5c0335+'\x27');var _0x4044ab=[{'name':_0x5c0335}];if(!_[_0x3fe1('0x8c')](_0x2186cd[_0x3fe1('0x2a')]))_0x4044ab=_0x2186cd[_0x3fe1('0x2a')];var _0xd21668=[];for(var _0x1fef0e=0x0;_0x1fef0e<_0x4044ab[_0x3fe1('0x8d')];_0x1fef0e++){_0xd21668['push'](_0x7a2bba[_0x3fe1('0x8e')]['find']({'where':{'userProfileId':_0x4810bc[_0x3fe1('0x8f')]['id'],'name':_0x4044ab[_0x1fef0e][_0x3fe1('0x7')]},'raw':!![]}));}return Promise['all'](_0xd21668)[_0x3fe1('0x3')](function(_0x237bd0){var _0x373dd2=_[_0x3fe1('0x1')](_0x237bd0,function(_0x3a919f){return _0x3a919f?_0x3a919f:undefined;});var _0x1f280f=_[_0x3fe1('0x1')](_0x4044ab,[_0x3fe1('0x90'),!![]]);var _0x1eddb9=_['isEmpty'](_0x373dd2)&&_['isEmpty'](_0x1f280f)?null:_['union'](_0x1f280f,_0x373dd2);if(!_0x1eddb9)return null;var _0x47578c=[];for(var _0x50a961=0x0;_0x50a961<_0x1eddb9['length'];_0x50a961++){var _0x4e00a1=_[_0x3fe1('0x91')](_0x4044ab,function(_0x4a2d6e){return _0x1eddb9[_0x50a961]?_0x4a2d6e[_0x3fe1('0x7')]===_0x1eddb9[_0x50a961][_0x3fe1('0x7')]:null;});if(_0x4e00a1){if(_0x1eddb9[_0x50a961]['ignore']){_0x47578c['push'](_0x882e25(_0x2186cd[_0x3fe1('0xe')],_0x1eddb9[_0x50a961]));}else{if(!_0x1eddb9[_0x50a961][_0x3fe1('0x92')]){_0x47578c[_0x3fe1('0x93')](_0x290924(_0x4e00a1,_0x1eddb9[_0x50a961],_0x2186cd[_0x3fe1('0xe')]));}else{if(_0x4e00a1[_0x3fe1('0x94')]){_0x47578c[_0x3fe1('0x93')](_0x45beb8(_0x4e00a1,_0x1eddb9[_0x50a961]));}}}}}return Promise[_0x3fe1('0x95')](_0x47578c);})[_0x3fe1('0x3')](function(_0x16a4bd){var _0x4c0ac4=_0x16a4bd;var _0x52524a=null;if(_0x4c0ac4){_0x52524a=_0x4c0ac4[_0x3fe1('0x8d')]===0x1?_0x4c0ac4[0x0]:null;}if(!_0x52524a&&!_0x4c0ac4)return _0x424d29;var _0x30ceab=_0x7a2bba[_0x2186cd['childModel']][_0x3fe1('0x96')];_0x1d49ac[_0x3fe1('0x94')]=_[_0x3fe1('0x97')](_0x30ceab);_0x1d49ac['query']=_['keys'](_0x4810bc[_0x3fe1('0x84')]);_0x1d49ac[_0x3fe1('0x98')]=_[_0x3fe1('0x99')](_0x1d49ac['model'],_0x1d49ac[_0x3fe1('0x84')]);_0x505eb1['attributes']=_[_0x3fe1('0x99')](_0x1d49ac['model'],_0x55c648['fields'](_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x9a')]));_0x505eb1['attributes']=_0x505eb1[_0x3fe1('0x9b')][_0x3fe1('0x8d')]?_0x505eb1[_0x3fe1('0x9b')]:_0x1d49ac[_0x3fe1('0x94')];if(!_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x9c')](_0x3fe1('0x9d'))){_0x505eb1[_0x3fe1('0x9e')]=_0x55c648[_0x3fe1('0x9e')](_0x4810bc['query'][_0x3fe1('0x9e')]);_0x505eb1[_0x3fe1('0x9f')]=_0x55c648['offset'](_0x4810bc['query'][_0x3fe1('0x9f')]);}_0x505eb1[_0x3fe1('0xa0')]=_0x55c648[_0x3fe1('0xa1')](_0x4810bc[_0x3fe1('0x84')]['sort']);_0x505eb1[_0x3fe1('0x81')]=_0x55c648['filters'](_[_0x3fe1('0xa2')](_0x4810bc[_0x3fe1('0x84')],_0x1d49ac[_0x3fe1('0x98')]));if(_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x1')]){_0x505eb1[_0x3fe1('0x81')]=_[_0x3fe1('0xa3')](_0x505eb1[_0x3fe1('0x81')],{'$or':_[_0x3fe1('0x5')](_0x30ceab,function(_0x5a3cc4){if(_0x5a3cc4['type'][_0x3fe1('0xa4')]!==_0x3fe1('0xa5')){var _0x106d63={};_0x106d63[_0x5a3cc4[_0x3fe1('0x2')]]={'$like':'%'+_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x1')]+'%'};return _0x106d63;}})});}var _0x1cab83=[];var _0x3b402e=null;var _0x103fad={};if(_0x52524a){_0x3b402e=_[_0x3fe1('0x91')](_0x4044ab,[_0x3fe1('0x7'),_0x52524a[_0x3fe1('0x7')]]);if(_0x3b402e[_0x3fe1('0x2')]){_0x103fad={};if(_0x2186cd[_0x3fe1('0xe')]==='AnalyticExtractedReport'){_0x103fad[_0x3b402e['foreignKey']]=_[_0x3fe1('0x5')](_0x52524a[_0x3fe1('0x4')],'id');}else{_0x103fad[_0x3b402e['foreignKey']]=_0x52524a[_0x3fe1('0x4')];}_0x1cab83[_0x3fe1('0x93')](_0x103fad);}else{_0x505eb1['where']['id']=_0x52524a[_0x3fe1('0x4')];}}else{for(var _0x25ac89=0x0;_0x25ac89<_0x4c0ac4[_0x3fe1('0x8d')];_0x25ac89++){_0x3b402e=_[_0x3fe1('0x91')](_0x4044ab,[_0x3fe1('0x7'),_0x4c0ac4[_0x25ac89][_0x3fe1('0x7')]]);if(_0x3b402e[_0x3fe1('0x2')]){_0x103fad={};_0x103fad[_0x3b402e[_0x3fe1('0xa6')]]=_0x4c0ac4[_0x25ac89][_0x3fe1('0x4')];_0x1cab83['push'](_0x103fad);}else{if(!_0x505eb1['where']['id'])_0x505eb1[_0x3fe1('0x81')]['id']=[];_0x4c0ac4[_0x25ac89]['associatedResources']['forEach'](function(_0x15d334){_0x505eb1[_0x3fe1('0x81')]['id']['push'](_0x15d334);});}}}if(!_['isEmpty'](_0x1cab83)){_0x505eb1[_0x3fe1('0x81')]=_[_0x3fe1('0xa3')](_0x505eb1['where'],{'$and':{'$or':_0x1cab83}});}_0x505eb1=_[_0x3fe1('0xa3')]({},_0x505eb1,_0x4810bc['options']);if(_0x52524a&&!_0x52524a[_0x3fe1('0x92')]&&_0x2186cd[_0x3fe1('0xe')]==='AnalyticExtractedReport'){if(_0x4810bc[_0x3fe1('0x84')]['includeAll']){_0x505eb1[_0x3fe1('0xa7')]=[{'all':!![]}];}return _0x7a2bba[_0x2186cd[_0x3fe1('0xe')]][_0x3fe1('0xa8')](_0x505eb1)[_0x3fe1('0x3')](function(_0x52ddce){var _0x363a40=[];_0x52ddce[_0x3fe1('0xa9')](function(_0x4f51d3){var _0x1e519e;switch(_0x4f51d3[_0x3fe1('0xaa')]){case'default':_0x1e519e=_[_0x3fe1('0x91')](_0x52524a['associatedResources'],function(_0x10f908){return _0x10f908['id']===_0x4f51d3[_0x3fe1('0x74')]&&_0x10f908['type']==='DefaultReports';});break;case _0x3fe1('0xab'):_0x1e519e=_[_0x3fe1('0x91')](_0x52524a[_0x3fe1('0x4')],function(_0x5d7492){return _0x5d7492['id']===_0x4f51d3[_0x3fe1('0x74')]&&_0x5d7492[_0x3fe1('0xa')]===_0x3fe1('0xac');});break;}if(_0x1e519e)_0x363a40[_0x3fe1('0x93')](_0x4f51d3);});_0x424d29[_0x3fe1('0xad')]=_0x363a40['length'];_0x424d29[_0x3fe1('0xae')]=_0x363a40;return _0x424d29;});}else{if(!_[_0x3fe1('0x8c')](_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')])){_0x505eb1['where']['id']=_0x505eb1[_0x3fe1('0x81')]['id']?_['intersection'](_0x505eb1[_0x3fe1('0x81')]['id'],_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')]):_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')];if(_0x4810bc['query'][_0x3fe1('0xb0')]){_0x505eb1['order']=_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb0')];}}if(_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb1')]){_0x505eb1['where']=_[_0x3fe1('0xa3')](_0x505eb1[_0x3fe1('0x81')],{'$and':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb1')]});}return _0x7a2bba[_0x2186cd[_0x3fe1('0xe')]]['count']({'where':_0x505eb1[_0x3fe1('0x81')]})['then'](function(_0x4df7c2){_0x424d29['count']=_0x4df7c2;if(_0x4810bc['query'][_0x3fe1('0xb2')]){if(_0x2186cd['childModel']===_0x3fe1('0x16')){_0x505eb1['include']=[{'model':_0x7a2bba[_0x3fe1('0xb3')],'as':_0x3fe1('0xb4'),'attributes':['id',_0x3fe1('0x7'),_0x3fe1('0xb5')],'required':_0x4810bc['query'][_0x3fe1('0xb6')]?!![]:![]},{'model':_0x7a2bba[_0x3fe1('0xb3')],'as':_0x3fe1('0xb7'),'attributes':['id',_0x3fe1('0x7'),_0x3fe1('0xb5')],'through':_0x4810bc['query'][_0x3fe1('0xb6')]?{'attributes':[],'where':{'TagId':_0x4810bc['query'][_0x3fe1('0xb6')]||undefined}}:{},'required':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb6')]?!![]:![]}];}else{_0x505eb1[_0x3fe1('0xa7')]=[{'all':!![]}];}}return _0x7a2bba[_0x2186cd['childModel']][_0x3fe1('0xa8')](_0x505eb1);})['then'](function(_0xfe9351){_0x424d29[_0x3fe1('0xae')]=_0xfe9351;if(_0x5c0335===_0x3fe1('0x2b')&&_0x4810bc[_0x3fe1('0x84')]['openTabs']===_0x3fe1('0xb8')){var _0x76cfc2=[];for(var _0x485b99=0x0;_0x485b99<_0x424d29['rows'][_0x3fe1('0x8d')];_0x485b99++){_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xb9'),_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f('sms',_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2['push'](_0x297e7f(_0x3fe1('0xbb'),_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbc'),_0x424d29['rows'][_0x485b99]['dataValues']));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbd'),_0x424d29[_0x3fe1('0xae')][_0x485b99]['dataValues']));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbe'),_0x424d29['rows'][_0x485b99]['dataValues']));}return Promise[_0x3fe1('0x95')](_0x76cfc2)['then'](function(){return _0x424d29;});}return _0x424d29;});}});}}});}; \ No newline at end of file +var _0x9e2e=['Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','length','push','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','key','VIRTUAL','foreignKey','forEach','merge','options','reportType','default','DefaultReports','custom','reportId','CustomReports','ids','customSorting','extraQueryConditions','count','includeAll','color','tag','ThroughTags','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','then','associatedResources','catch','name','resolve','UserProfileResource','field','AnalyticExtractedReport','resourceId','type','map','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','contacts','CmContact','Lists','CmList','companies','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','sounds','Sound','tags','Tag','Template','triggers','trunks'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x9e2e,0x1e5));var _0xe9e2=function(_0x3f23c8,_0x4b3e27){_0x3f23c8=_0x3f23c8-0x0;var _0x4b5f2a=_0x9e2e[_0x3f23c8];return _0x4b5f2a;};'use strict';var _=require(_0xe9e2('0x0'));var attributes=require(_0xe9e2('0x1'));var squel=require(_0xe9e2('0x2'));module[_0xe9e2('0x3')]=function(_0xb0445b){var _0x430158=_0xb0445b['models'];function _0x30bb1f(_0x111df0,_0x1cccac){return new Promise(function(_0x3c3418,_0xb339fd){if(!_0x1cccac)return _0x3c3418(null);var _0x4a78a0=_0x1cccac[_0xe9e2('0x4')]?{[_0x1cccac[_0xe9e2('0x4')]['field']]:_0x1cccac[_0xe9e2('0x4')][_0xe9e2('0x5')]}:undefined;return _0x430158[_0x111df0][_0xe9e2('0x6')]({'where':_0x4a78a0,'raw':!![]})[_0xe9e2('0x7')](function(_0x2d4b6d){_0x1cccac[_0xe9e2('0x8')]=_['map'](_0x2d4b6d,'id');_0x3c3418(_0x1cccac);})[_0xe9e2('0x9')](function(_0x207907){_0xb339fd(_0x207907);});});}function _0x49a2ee(_0x1a339f,_0x284dad){return new Promise(function(_0x7f6feb,_0x4048b0){var _0x449bb6=_0x1a339f[_0xe9e2('0x4')]?{[_0x1a339f['filter']['field']]:_0x1a339f[_0xe9e2('0x4')][_0xe9e2('0x5')]}:undefined;return _0x430158[_0x1a339f['model']][_0xe9e2('0x6')]({'where':_0x449bb6,'raw':!![]})[_0xe9e2('0x7')](function(_0xa946e4){_0x284dad[_0xe9e2('0x8')]=_['map'](_0xa946e4,function(_0x566b56){return _0x566b56[_0xe9e2('0xa')];});_0x7f6feb(_0x284dad);})[_0xe9e2('0x9')](function(_0x505dc2){_0x4048b0(_0x505dc2);});});}function _0xf0aa49(_0x1cc52e,_0x23c656,_0x2f52e2){if(!_0x23c656)return Promise[_0xe9e2('0xb')](null);return new Promise(function(_0x3106a7,_0x14b5af){return _0x430158[_0xe9e2('0xc')]['findAll']({'where':{'sectionId':_0x23c656['id']},'raw':!![]})['then'](function(_0x2d14a7){if(_0x1cc52e[_0xe9e2('0xd')]&&_0x1cc52e[_0xe9e2('0xd')]!=='id'){_0x23c656[_0xe9e2('0x8')]=_['map'](_0x2d14a7,function(_0x31aab5){return _0x31aab5[_0x1cc52e['field']];});}else{if(_0x2f52e2===_0xe9e2('0xe')){_0x23c656[_0xe9e2('0x8')]=_['map'](_0x2d14a7,function(_0x4db552){return{'id':_0x4db552[_0xe9e2('0xf')],'type':_0x4db552[_0xe9e2('0x10')]};});}else{_0x23c656['associatedResources']=_[_0xe9e2('0x11')](_0x2d14a7,function(_0x5c712c){return _0x5c712c[_0xe9e2('0xf')];});}}_0x3106a7(_0x23c656);})[_0xe9e2('0x9')](function(_0x3fd5b8){_0x14b5af(_0x3fd5b8);});});}function _0xd911de(_0x37729f,_0x7f3575){var _0x2fbea4={'parentSections':[]};switch(_0x37729f['toLowerCase']()){case _0xe9e2('0x12'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x14');break;case _0xe9e2('0x15'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x16');break;case _0xe9e2('0x17'):_0x2fbea4['childModel']='SquareRecording';_0x2fbea4[_0xe9e2('0x18')]=[{'name':_0xe9e2('0x19'),'field':_0xe9e2('0xa'),'foreignKey':_0xe9e2('0x1a')}];break;case'projects':_0x2fbea4[_0xe9e2('0x13')]='JscriptyProject';break;case _0xe9e2('0x1b'):_0x2fbea4['childModel']=_0xe9e2('0x1c');_0x2fbea4['parentSections']=[{'name':_0xe9e2('0x1d'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x1e');break;case _0xe9e2('0x1f'):_0x2fbea4[_0xe9e2('0x13')]='CmCompany';break;case _0xe9e2('0x20'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x21');break;case'chatqueues':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x22');break;case'chatwebsites':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x23');break;case _0xe9e2('0x24'):_0x2fbea4[_0xe9e2('0x13')]='FaxQueue';break;case _0xe9e2('0x25'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x26');break;case _0xe9e2('0x27'):case _0xe9e2('0x28'):case _0xe9e2('0x29'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x2a');break;case _0xe9e2('0x2b'):_0x2fbea4['childModel']=_0xe9e2('0x2c');break;case'voicemails':_0x2fbea4[_0xe9e2('0x13')]='VoiceMail';break;case _0xe9e2('0x2d'):_0x2fbea4['childModel']=_0xe9e2('0x2e');_0x2fbea4['parentSections']=[{'name':_0xe9e2('0x2f'),'field':'name','foreignKey':_0xe9e2('0x30'),'model':_0xe9e2('0x31'),'filter':{'field':_0xe9e2('0x32'),'value':[_0xe9e2('0x33')]}},{'name':_0xe9e2('0x34'),'field':'name','foreignKey':_0xe9e2('0x30'),'model':'User','filter':{'field':'role','value':[_0xe9e2('0x35')]}},{'name':_0xe9e2('0x36'),'field':_0xe9e2('0xa'),'foreignKey':_0xe9e2('0x37'),'model':'VoiceQueue','filter':{'field':_0xe9e2('0x10'),'value':[_0xe9e2('0x38')]}},{'name':_0xe9e2('0x39'),'field':'name','foreignKey':_0xe9e2('0x37'),'model':_0xe9e2('0x3a'),'filter':{'field':_0xe9e2('0x10'),'value':[_0xe9e2('0x3b')]}}];break;case _0xe9e2('0x3c'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x3d');break;case _0xe9e2('0x3e'):_0x2fbea4['childModel']=_0xe9e2('0x3f');break;case _0xe9e2('0x40'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x41');break;case _0xe9e2('0x42'):_0x2fbea4[_0xe9e2('0x13')]='Campaign';break;case _0xe9e2('0x43'):_0x2fbea4['childModel']=_0xe9e2('0x44');break;case _0xe9e2('0x45'):_0x2fbea4['childModel']=_0xe9e2('0x46');break;case _0xe9e2('0x47'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x48');break;case _0xe9e2('0x49'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x4a');break;case _0xe9e2('0x4b'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x4c');break;case _0xe9e2('0x4d'):_0x2fbea4[_0xe9e2('0x13')]='SmsQueue';break;case'smsaccounts':_0x2fbea4['childModel']=_0xe9e2('0x4e');break;case _0xe9e2('0x4f'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x50');break;case'whatsappaccounts':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x51');break;case'teams':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x52');break;case _0xe9e2('0x53'):case _0xe9e2('0x54'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x3a');if(_0x7f3575){_0x2fbea4['parentSections']=[{'name':_0xe9e2('0x36')},{'name':_0xe9e2('0x39')}];}break;case _0xe9e2('0x55'):case _0xe9e2('0x56'):case _0xe9e2('0x57'):_0x2fbea4[_0xe9e2('0x13')]='User';if(_0x7f3575){_0x2fbea4[_0xe9e2('0x18')]=[{'name':_0xe9e2('0x58'),'filter':{'field':'role','value':['admin',_0xe9e2('0x59')]},'ignore':!![]},{'name':_0xe9e2('0x2f')},{'name':_0xe9e2('0x34')}];}break;case _0xe9e2('0x5a'):_0x2fbea4[_0xe9e2('0x13')]='ZendeskAccount';break;case _0xe9e2('0x5b'):_0x2fbea4[_0xe9e2('0x13')]='SalesforceAccount';break;case _0xe9e2('0x5c'):_0x2fbea4['childModel']='FreshdeskAccount';break;case _0xe9e2('0x5d'):_0x2fbea4['childModel']='SugarcrmAccount';break;case _0xe9e2('0x5e'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x5f');break;case _0xe9e2('0x60'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x61');break;case'vtigeraccounts':_0x2fbea4[_0xe9e2('0x13')]='User';break;case _0xe9e2('0x62'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x63');break;case _0xe9e2('0x64'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x65');break;case _0xe9e2('0x66'):_0x2fbea4['childModel']=_0xe9e2('0x67');break;case _0xe9e2('0x68'):_0x2fbea4['childModel']='Interval';break;case _0xe9e2('0x69'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x6a');break;case _0xe9e2('0x6b'):_0x2fbea4[_0xe9e2('0x13')]='Schedule';break;case _0xe9e2('0x6c'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x6d');break;case _0xe9e2('0x6e'):_0x2fbea4['childModel']=_0xe9e2('0x6f');break;case'templates':_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x70');break;case _0xe9e2('0x71'):_0x2fbea4[_0xe9e2('0x13')]='Trigger';break;case _0xe9e2('0x72'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x73');break;case _0xe9e2('0x74'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x75');break;case _0xe9e2('0x76'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x77');break;case _0xe9e2('0x78'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0xe');_0x2fbea4[_0xe9e2('0x18')]=[{'name':_0xe9e2('0x79'),'field':'id','foreignKey':'reportId'}];break;case _0xe9e2('0x7a'):_0x2fbea4[_0xe9e2('0x13')]=_0xe9e2('0x7b');break;}return _0x2fbea4;}function _0x103929(_0x1b9d8b,_0x6dd625){var _0x2343f9=_0x1b9d8b[_0xe9e2('0x7c')](0x0)['toUpperCase']()+_0x1b9d8b[_0xe9e2('0x7d')](0x1);var _0x2c2a4d={'type':_0x430158['Sequelize'][_0xe9e2('0x7e')][_0xe9e2('0x7f')],'raw':!![]};return new Promise(function(_0x5a4e30,_0x9ce64f){var _0x581903=squel[_0xe9e2('0x80')]()['field'](_0xe9e2('0x81')+_0x2343f9+_0xe9e2('0x82'),'id')['field'](_0xe9e2('0x83'))[_0xe9e2('0x84')](_0xe9e2('0x85')+_0x1b9d8b+_0xe9e2('0x86'),'ui')[_0xe9e2('0x87')](_0xe9e2('0x88'),_0x6dd625['id']);return _0x430158[_0xe9e2('0x89')]['query'](_0x581903[_0xe9e2('0x8a')](),_0x2c2a4d)[_0xe9e2('0x7')](function(_0x53bfed){_0x6dd625[_0x2343f9+_0xe9e2('0x8b')]=_0x53bfed;_0x5a4e30(_0x53bfed);})['catch'](function(_0x14becb){_0x9ce64f(_0x14becb);});});}return _0xb0445b[_0xe9e2('0x8c')](_0xe9e2('0x8d'),attributes,{'tableName':_0xe9e2('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4b33bf){var _0x393226=require('../../components/parsers/qs');var _0x7f3437={'raw':_0x4b33bf['query'][_0xe9e2('0x8f')],'where':{}};var _0x1a25fd={};var _0x1cd959={'count':0x0,'rows':[]};var _0x23786e=_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0x91')];var _0x5d4c84=_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0x92')]||![];var _0x4e9d62=_0xd911de(_0x23786e,_0x5d4c84);if(!_0x4e9d62[_0xe9e2('0x13')])throw new Error(_0xe9e2('0x93')+_0x23786e+'\x27');var _0x5729ef=[{'name':_0x23786e}];if(!_[_0xe9e2('0x94')](_0x4e9d62[_0xe9e2('0x18')]))_0x5729ef=_0x4e9d62[_0xe9e2('0x18')];var _0x5354fc=[];for(var _0x5e72c9=0x0;_0x5e72c9<_0x5729ef['length'];_0x5e72c9++){_0x5354fc['push'](_0x430158[_0xe9e2('0x95')][_0xe9e2('0x96')]({'where':{'userProfileId':_0x4b33bf[_0xe9e2('0x97')]['id'],'name':_0x5729ef[_0x5e72c9][_0xe9e2('0xa')]},'raw':!![]}));}return Promise[_0xe9e2('0x98')](_0x5354fc)['then'](function(_0x4f727c){var _0x30c15d=_['filter'](_0x4f727c,function(_0x7f0f0d){return _0x7f0f0d?_0x7f0f0d:undefined;});var _0x67b8c7=_[_0xe9e2('0x4')](_0x5729ef,[_0xe9e2('0x99'),!![]]);var _0x52300e=_[_0xe9e2('0x94')](_0x30c15d)&&_[_0xe9e2('0x94')](_0x67b8c7)?null:_[_0xe9e2('0x9a')](_0x67b8c7,_0x30c15d);if(!_0x52300e)return null;var _0x28c859=[];for(var _0x21071b=0x0;_0x21071b<_0x52300e[_0xe9e2('0x9b')];_0x21071b++){var _0x1c4d47=_[_0xe9e2('0x96')](_0x5729ef,function(_0x57d5fc){return _0x52300e[_0x21071b]?_0x57d5fc[_0xe9e2('0xa')]===_0x52300e[_0x21071b][_0xe9e2('0xa')]:null;});if(_0x1c4d47){if(_0x52300e[_0x21071b]['ignore']){_0x28c859[_0xe9e2('0x9c')](_0x30bb1f(_0x4e9d62['childModel'],_0x52300e[_0x21071b]));}else{if(!_0x52300e[_0x21071b][_0xe9e2('0x9d')]){_0x28c859[_0xe9e2('0x9c')](_0xf0aa49(_0x1c4d47,_0x52300e[_0x21071b],_0x4e9d62['childModel']));}else{if(_0x1c4d47[_0xe9e2('0x9e')]){_0x28c859[_0xe9e2('0x9c')](_0x49a2ee(_0x1c4d47,_0x52300e[_0x21071b]));}}}}}return Promise['all'](_0x28c859);})[_0xe9e2('0x7')](function(_0x52e781){var _0x5173a4=_0x52e781;var _0x59bf1b=null;if(_0x5173a4){_0x59bf1b=_0x5173a4[_0xe9e2('0x9b')]===0x1?_0x5173a4[0x0]:null;}if(!_0x59bf1b&&!_0x5173a4)return _0x1cd959;var _0x5028f4=_0x430158[_0x4e9d62['childModel']][_0xe9e2('0x9f')];_0x1a25fd[_0xe9e2('0x9e')]=_[_0xe9e2('0xa0')](_0x5028f4);_0x1a25fd[_0xe9e2('0x90')]=_[_0xe9e2('0xa0')](_0x4b33bf['query']);_0x1a25fd['filters']=_[_0xe9e2('0xa1')](_0x1a25fd['model'],_0x1a25fd[_0xe9e2('0x90')]);_0x7f3437[_0xe9e2('0xa2')]=_[_0xe9e2('0xa1')](_0x1a25fd[_0xe9e2('0x9e')],_0x393226[_0xe9e2('0xa3')](_0x4b33bf['query']['fields']));_0x7f3437[_0xe9e2('0xa2')]=_0x7f3437[_0xe9e2('0xa2')][_0xe9e2('0x9b')]?_0x7f3437[_0xe9e2('0xa2')]:_0x1a25fd[_0xe9e2('0x9e')];if(!_0x4b33bf['query'][_0xe9e2('0xa4')](_0xe9e2('0xa5'))){_0x7f3437['limit']=_0x393226['limit'](_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xa6')]);_0x7f3437[_0xe9e2('0xa7')]=_0x393226[_0xe9e2('0xa7')](_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xa7')]);}_0x7f3437[_0xe9e2('0xa8')]=_0x393226[_0xe9e2('0xa9')](_0x4b33bf[_0xe9e2('0x90')]['sort']);_0x7f3437['where']=_0x393226[_0xe9e2('0xaa')](_[_0xe9e2('0xab')](_0x4b33bf[_0xe9e2('0x90')],_0x1a25fd[_0xe9e2('0xaa')]));if(_0x4b33bf[_0xe9e2('0x90')]['filter']){_0x7f3437[_0xe9e2('0x87')]=_['merge'](_0x7f3437[_0xe9e2('0x87')],{'$or':_[_0xe9e2('0x11')](_0x5028f4,function(_0x396a5c){if(_0x396a5c[_0xe9e2('0x10')][_0xe9e2('0xac')]!==_0xe9e2('0xad')){var _0x3c210b={};_0x3c210b[_0x396a5c[_0xe9e2('0xd')]]={'$like':'%'+_0x4b33bf[_0xe9e2('0x90')]['filter']+'%'};return _0x3c210b;}})});}var _0x45c4e8=[];var _0x37c0a7=null;var _0x57a71f={};if(_0x59bf1b){_0x37c0a7=_['find'](_0x5729ef,[_0xe9e2('0xa'),_0x59bf1b[_0xe9e2('0xa')]]);if(_0x37c0a7[_0xe9e2('0xd')]){_0x57a71f={};if(_0x4e9d62[_0xe9e2('0x13')]==='AnalyticExtractedReport'){_0x57a71f[_0x37c0a7[_0xe9e2('0xae')]]=_[_0xe9e2('0x11')](_0x59bf1b['associatedResources'],'id');}else{_0x57a71f[_0x37c0a7[_0xe9e2('0xae')]]=_0x59bf1b['associatedResources'];}_0x45c4e8[_0xe9e2('0x9c')](_0x57a71f);}else{_0x7f3437[_0xe9e2('0x87')]['id']=_0x59bf1b[_0xe9e2('0x8')];}}else{for(var _0xcd7f69=0x0;_0xcd7f69<_0x5173a4[_0xe9e2('0x9b')];_0xcd7f69++){_0x37c0a7=_[_0xe9e2('0x96')](_0x5729ef,[_0xe9e2('0xa'),_0x5173a4[_0xcd7f69][_0xe9e2('0xa')]]);if(_0x37c0a7[_0xe9e2('0xd')]){_0x57a71f={};_0x57a71f[_0x37c0a7[_0xe9e2('0xae')]]=_0x5173a4[_0xcd7f69][_0xe9e2('0x8')];_0x45c4e8[_0xe9e2('0x9c')](_0x57a71f);}else{if(!_0x7f3437[_0xe9e2('0x87')]['id'])_0x7f3437[_0xe9e2('0x87')]['id']=[];_0x5173a4[_0xcd7f69][_0xe9e2('0x8')][_0xe9e2('0xaf')](function(_0x3eaee1){_0x7f3437[_0xe9e2('0x87')]['id']['push'](_0x3eaee1);});}}}if(!_[_0xe9e2('0x94')](_0x45c4e8)){_0x7f3437[_0xe9e2('0x87')]=_[_0xe9e2('0xb0')](_0x7f3437[_0xe9e2('0x87')],{'$and':{'$or':_0x45c4e8}});}_0x7f3437=_[_0xe9e2('0xb0')]({},_0x7f3437,_0x4b33bf[_0xe9e2('0xb1')]);if(_0x59bf1b&&!_0x59bf1b['autoAssociation']&&_0x4e9d62[_0xe9e2('0x13')]===_0xe9e2('0xe')){if(_0x4b33bf[_0xe9e2('0x90')]['includeAll']){_0x7f3437['include']=[{'all':!![]}];}return _0x430158[_0x4e9d62[_0xe9e2('0x13')]][_0xe9e2('0x6')](_0x7f3437)[_0xe9e2('0x7')](function(_0x1183bc){var _0x2f54fb=[];_0x1183bc[_0xe9e2('0xaf')](function(_0x1f867a){var _0x1c0cbf;switch(_0x1f867a[_0xe9e2('0xb2')]){case _0xe9e2('0xb3'):_0x1c0cbf=_[_0xe9e2('0x96')](_0x59bf1b[_0xe9e2('0x8')],function(_0x1f7291){return _0x1f7291['id']===_0x1f867a['reportId']&&_0x1f7291[_0xe9e2('0x10')]===_0xe9e2('0xb4');});break;case _0xe9e2('0xb5'):_0x1c0cbf=_[_0xe9e2('0x96')](_0x59bf1b[_0xe9e2('0x8')],function(_0x389f74){return _0x389f74['id']===_0x1f867a[_0xe9e2('0xb6')]&&_0x389f74[_0xe9e2('0x10')]===_0xe9e2('0xb7');});break;}if(_0x1c0cbf)_0x2f54fb[_0xe9e2('0x9c')](_0x1f867a);});_0x1cd959['count']=_0x2f54fb[_0xe9e2('0x9b')];_0x1cd959['rows']=_0x2f54fb;return _0x1cd959;});}else{if(!_[_0xe9e2('0x94')](_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xb8')])){_0x7f3437[_0xe9e2('0x87')]['id']=_0x7f3437[_0xe9e2('0x87')]['id']?_[_0xe9e2('0xa1')](_0x7f3437[_0xe9e2('0x87')]['id'],_0x4b33bf[_0xe9e2('0x90')]['ids']):_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xb8')];if(_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xb9')]){_0x7f3437['order']=_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xb9')];}}if(_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xba')]){_0x7f3437[_0xe9e2('0x87')]=_[_0xe9e2('0xb0')](_0x7f3437[_0xe9e2('0x87')],{'$and':_0x4b33bf['query'][_0xe9e2('0xba')]});}return _0x430158[_0x4e9d62[_0xe9e2('0x13')]][_0xe9e2('0xbb')]({'where':_0x7f3437['where']})['then'](function(_0x423bb6){_0x1cd959[_0xe9e2('0xbb')]=_0x423bb6;if(_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xbc')]){if(_0x4e9d62[_0xe9e2('0x13')]===_0xe9e2('0x1c')){_0x7f3437['include']=[{'model':_0x430158[_0xe9e2('0x6f')],'as':'Tags','attributes':['id',_0xe9e2('0xa'),_0xe9e2('0xbd')],'required':_0x4b33bf['query'][_0xe9e2('0xbe')]?!![]:![]},{'model':_0x430158['Tag'],'as':_0xe9e2('0xbf'),'attributes':['id','name',_0xe9e2('0xbd')],'through':_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xbe')]?{'attributes':[],'where':{'TagId':_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xbe')]||undefined}}:{},'required':_0x4b33bf[_0xe9e2('0x90')][_0xe9e2('0xbe')]?!![]:![]}];}else{_0x7f3437['include']=[{'all':!![]}];}}return _0x430158[_0x4e9d62[_0xe9e2('0x13')]][_0xe9e2('0x6')](_0x7f3437);})[_0xe9e2('0x7')](function(_0x2f5d0f){_0x1cd959[_0xe9e2('0xc0')]=_0x2f5d0f;if(_0x23786e===_0xe9e2('0x2f')&&_0x4b33bf[_0xe9e2('0x90')]['openTabs']==='true'){var _0x50ed9f=[];for(var _0x28c202=0x0;_0x28c202<_0x1cd959[_0xe9e2('0xc0')][_0xe9e2('0x9b')];_0x28c202++){_0x50ed9f['push'](_0x103929(_0xe9e2('0xc1'),_0x1cd959[_0xe9e2('0xc0')][_0x28c202][_0xe9e2('0xc2')]));_0x50ed9f[_0xe9e2('0x9c')](_0x103929(_0xe9e2('0xc3'),_0x1cd959['rows'][_0x28c202][_0xe9e2('0xc2')]));_0x50ed9f['push'](_0x103929(_0xe9e2('0xc4'),_0x1cd959['rows'][_0x28c202][_0xe9e2('0xc2')]));_0x50ed9f[_0xe9e2('0x9c')](_0x103929(_0xe9e2('0xc5'),_0x1cd959[_0xe9e2('0xc0')][_0x28c202][_0xe9e2('0xc2')]));_0x50ed9f[_0xe9e2('0x9c')](_0x103929(_0xe9e2('0xc6'),_0x1cd959['rows'][_0x28c202][_0xe9e2('0xc2')]));_0x50ed9f[_0xe9e2('0x9c')](_0x103929(_0xe9e2('0xc7'),_0x1cd959[_0xe9e2('0xc0')][_0x28c202][_0xe9e2('0xc2')]));}return Promise[_0xe9e2('0x98')](_0x50ed9f)[_0xe9e2('0x7')](function(){return _0x1cd959;});}return _0x1cd959;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0940729..6489c0c 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 _0x1883=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x358321,_0x1a50ae){var _0xd03c42=function(_0x40ba75){while(--_0x40ba75){_0x358321['push'](_0x358321['shift']());}};_0xd03c42(++_0x1a50ae);}(_0x1883,0xab));var _0x3188=function(_0x943413,_0x4c18f2){_0x943413=_0x943413-0x0;var _0x50d5d9=_0x1883[_0x943413];return _0x50d5d9;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});config[_0x3188('0xe')]=_[_0x3188('0xf')](config[_0x3188('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3188('0x10'))(new Redis(config[_0x3188('0xe')]));require('./userProfile.socket')[_0x3188('0x11')](socket);function respondWithRpcPromise(_0x5b7f47,_0xc6040,_0x34fc82){return new BPromise(function(_0x209e31,_0x43b69){return client['request'](_0x5b7f47,_0x34fc82)[_0x3188('0x12')](function(_0x2cdcb2){logger['info']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x3188('0x13'));logger[_0x3188('0x14')](_0x3188('0x15'),_0xc6040,_0x3188('0x13'),JSON[_0x3188('0x16')](_0x2cdcb2));if(_0x2cdcb2[_0x3188('0x17')]){if(_0x2cdcb2['error'][_0x3188('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x2cdcb2[_0x3188('0x17')]['message']);return _0x43b69(_0x2cdcb2['error'][_0x3188('0x19')]);}logger[_0x3188('0x17')](_0x3188('0x1a'),_0xc6040,_0x2cdcb2[_0x3188('0x17')][_0x3188('0x19')]);return _0x209e31(_0x2cdcb2[_0x3188('0x17')]['message']);}else{logger[_0x3188('0x1b')](_0x3188('0x1a'),_0xc6040,_0x3188('0x13'));_0x209e31(_0x2cdcb2[_0x3188('0x1c')][_0x3188('0x19')]);}})[_0x3188('0x1d')](function(_0xac7f48){logger[_0x3188('0x17')]('UserProfile,\x20%s,\x20%s',_0xc6040,_0xac7f48);_0x43b69(_0xac7f48);});});} \ No newline at end of file +var _0x28b1=['../../mysqldb','../../config/utils','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x28b1,0x1d6));var _0x128b=function(_0x502588,_0x5dbdd8){_0x502588=_0x502588-0x0;var _0x55779c=_0x28b1[_0x502588];return _0x55779c;};'use strict';var _=require(_0x128b('0x0'));var util=require(_0x128b('0x1'));var moment=require(_0x128b('0x2'));var BPromise=require('bluebird');var rs=require(_0x128b('0x3'));var fs=require('fs');var Redis=require(_0x128b('0x4'));var db=require(_0x128b('0x5'))['db'];var utils=require(_0x128b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x128b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x128b('0x8')]({'port':0x232a});config['redis']=_[_0x128b('0x9')](config[_0x128b('0xa')],{'host':_0x128b('0xb'),'port':0x18eb});var socket=require(_0x128b('0xc'))(new Redis(config[_0x128b('0xa')]));require(_0x128b('0xd'))['register'](socket);function respondWithRpcPromise(_0x5252ca,_0xcc2756,_0x568534){return new BPromise(function(_0x5c73a3,_0x2d807b){return client[_0x128b('0xe')](_0x5252ca,_0x568534)[_0x128b('0xf')](function(_0x2f8056){logger[_0x128b('0x10')]('UserProfile,\x20%s,\x20%s',_0xcc2756,_0x128b('0x11'));logger['debug'](_0x128b('0x12'),_0xcc2756,_0x128b('0x11'),JSON[_0x128b('0x13')](_0x2f8056));if(_0x2f8056[_0x128b('0x14')]){if(_0x2f8056[_0x128b('0x14')][_0x128b('0x15')]===0x1f4){logger[_0x128b('0x14')](_0x128b('0x16'),_0xcc2756,_0x2f8056[_0x128b('0x14')][_0x128b('0x17')]);return _0x2d807b(_0x2f8056[_0x128b('0x14')][_0x128b('0x17')]);}logger[_0x128b('0x14')]('UserProfile,\x20%s,\x20%s',_0xcc2756,_0x2f8056['error']['message']);return _0x5c73a3(_0x2f8056['error']['message']);}else{logger[_0x128b('0x10')](_0x128b('0x16'),_0xcc2756,_0x128b('0x11'));_0x5c73a3(_0x2f8056[_0x128b('0x18')][_0x128b('0x17')]);}})['catch'](function(_0x7b16bf){logger[_0x128b('0x14')](_0x128b('0x16'),_0xcc2756,_0x7b16bf);_0x2d807b(_0x7b16bf);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6131272..ec5b00b 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 _0x6bff=['save','remove','update','emit','removeListener','register','length','./userProfile.events'];(function(_0x294c42,_0xbd23ad){var _0x4c73d9=function(_0x4f140e){while(--_0x4f140e){_0x294c42['push'](_0x294c42['shift']());}};_0x4c73d9(++_0xbd23ad);}(_0x6bff,0x67));var _0xf6bf=function(_0x40a04c,_0x1efbab){_0x40a04c=_0x40a04c-0x0;var _0x45be51=_0x6bff[_0x40a04c];return _0x45be51;};'use strict';var UserProfileEvents=require(_0xf6bf('0x0'));var events=[_0xf6bf('0x1'),_0xf6bf('0x2'),_0xf6bf('0x3')];function createListener(_0x165d3f,_0xf8c6be){return function(_0x462ce0){_0xf8c6be[_0xf6bf('0x4')](_0x165d3f,_0x462ce0);};}function removeListener(_0x5c3371,_0x4fbf28){return function(){UserProfileEvents[_0xf6bf('0x5')](_0x5c3371,_0x4fbf28);};}exports[_0xf6bf('0x6')]=function(_0x440c30){for(var _0x58d071=0x0,_0x28cf05=events[_0xf6bf('0x7')];_0x58d071<_0x28cf05;_0x58d071++){var _0xf47a85=events[_0x58d071];var _0x2b6347=createListener('userProfile:'+_0xf47a85,_0x440c30);UserProfileEvents['on'](_0xf47a85,_0x2b6347);}}; \ No newline at end of file +var _0x74eb=['userProfile:','remove','update','emit','removeListener','register','length'];(function(_0x4bb328,_0x3da104){var _0x28874c=function(_0x40ca0d){while(--_0x40ca0d){_0x4bb328['push'](_0x4bb328['shift']());}};_0x28874c(++_0x3da104);}(_0x74eb,0x1e4));var _0xb74e=function(_0x548425,_0x4bfb2d){_0x548425=_0x548425-0x0;var _0x2941b8=_0x74eb[_0x548425];return _0x2941b8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xb74e('0x0'),_0xb74e('0x1')];function createListener(_0xda8a3f,_0x488632){return function(_0x1f9084){_0x488632[_0xb74e('0x2')](_0xda8a3f,_0x1f9084);};}function removeListener(_0x2971d8,_0x16d75a){return function(){UserProfileEvents[_0xb74e('0x3')](_0x2971d8,_0x16d75a);};}exports[_0xb74e('0x4')]=function(_0x3270b4){for(var _0x500ee5=0x0,_0x460605=events[_0xb74e('0x5')];_0x500ee5<_0x460605;_0x500ee5++){var _0x1f98cb=events[_0x500ee5];var _0x2cfaaa=createListener(_0xb74e('0x6')+_0x1f98cb,_0x3270b4);UserProfileEvents['on'](_0x1f98cb,_0x2cfaaa);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d62a534..34adbe7 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 _0x2379=['post','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x4c2af9,_0x4c241d){var _0x45d4a5=function(_0x36fdf4){while(--_0x36fdf4){_0x4c2af9['push'](_0x4c2af9['shift']());}};_0x45d4a5(++_0x4c241d);}(_0x2379,0x82));var _0x9237=function(_0x2cad0c,_0x5b9dc0){_0x2cad0c=_0x2cad0c-0x0;var _0x16aae0=_0x2379[_0x2cad0c];return _0x16aae0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9237('0x0'));var express=require(_0x9237('0x1'));var router=express[_0x9237('0x2')]();var fs_extra=require(_0x9237('0x3'));var auth=require(_0x9237('0x4'));var interaction=require(_0x9237('0x5'));var config=require(_0x9237('0x6'));var controller=require(_0x9237('0x7'));router[_0x9237('0x8')]('/',auth[_0x9237('0x9')](),controller[_0x9237('0xa')]);router['get']('/describe',auth[_0x9237('0x9')](),controller[_0x9237('0xb')]);router[_0x9237('0x8')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller[_0x9237('0xd')]);router[_0x9237('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9237('0xc'),auth['isAuthenticated'](),controller[_0x9237('0xf')]);router[_0x9237('0x10')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller['destroy']);module[_0x9237('0x11')]=router; \ No newline at end of file +var _0xe270=['./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3765d3,_0x5502f2){var _0x218e4f=function(_0x5e041f){while(--_0x5e041f){_0x3765d3['push'](_0x3765d3['shift']());}};_0x218e4f(++_0x5502f2);}(_0xe270,0xf4));var _0x0e27=function(_0x106b58,_0x2db14f){_0x106b58=_0x106b58-0x0;var _0x87ae17=_0xe270[_0x106b58];return _0x87ae17;};'use strict';var multer=require(_0x0e27('0x0'));var util=require(_0x0e27('0x1'));var path=require(_0x0e27('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e27('0x3'));var router=express[_0x0e27('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e27('0x5'));var interaction=require(_0x0e27('0x6'));var config=require(_0x0e27('0x7'));var controller=require(_0x0e27('0x8'));router[_0x0e27('0x9')]('/',auth['isAuthenticated'](),controller[_0x0e27('0xa')]);router[_0x0e27('0x9')](_0x0e27('0xb'),auth[_0x0e27('0xc')](),controller[_0x0e27('0xd')]);router[_0x0e27('0x9')]('/:id',auth[_0x0e27('0xc')](),controller[_0x0e27('0xe')]);router[_0x0e27('0xf')]('/',auth[_0x0e27('0xc')](),controller[_0x0e27('0x10')]);router['put'](_0x0e27('0x11'),auth[_0x0e27('0xc')](),controller[_0x0e27('0x12')]);router['delete'](_0x0e27('0x11'),auth[_0x0e27('0xc')](),controller[_0x0e27('0x13')]);module[_0x0e27('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c0d3ebb..71e0a64 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 _0x0cba=['sequelize','exports','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x0cba,0x1b6));var _0xa0cb=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x0cba[_0x53056c];return _0x5cec88;};'use strict';var Sequelize=require(_0xa0cb('0x0'));module[_0xa0cb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa0cb('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf01b=['sequelize','exports','STRING'];(function(_0x217e20,_0xe21b54){var _0x11c042=function(_0x2795ae){while(--_0x2795ae){_0x217e20['push'](_0x217e20['shift']());}};_0x11c042(++_0xe21b54);}(_0xf01b,0x1c8));var _0xbf01=function(_0x21b038,_0xb658a7){_0x21b038=_0x21b038-0x0;var _0xf3268c=_0xf01b[_0x21b038];return _0xf3268c;};'use strict';var Sequelize=require(_0xbf01('0x0'));module[_0xbf01('0x1')]={'name':{'type':Sequelize[_0xbf01('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2ec4a3d..a8f2443 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 _0x2a07=['index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0x2873d2,_0x3178b6){_0x2873d2=_0x2873d2-0x0;var _0x31b7c1=_0x2a07[_0x2873d2];return _0x31b7c1;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['UserProfileResource'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['UserProfileResource']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','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'];(function(_0x2cc5b8,_0x1ae35e){var _0x19d73d=function(_0x429847){while(--_0x429847){_0x2cc5b8['push'](_0x2cc5b8['shift']());}};_0x19d73d(++_0x1ae35e);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a92eb,_0x5d1659){_0x4a92eb=_0x4a92eb-0x0;var _0x3961d6=_0x2ef3[_0x4a92eb];return _0x3961d6;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1e83968..f733661 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 _0x41fe=['UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userProfileResource.attributes','exports','define'];(function(_0xfaf019,_0x1b75da){var _0x136640=function(_0x2ace91){while(--_0x2ace91){_0xfaf019['push'](_0xfaf019['shift']());}};_0x136640(++_0x1b75da);}(_0x41fe,0x14e));var _0xe41f=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x41fe[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var logger=require(_0xe41f('0x2'))(_0xe41f('0x3'));var moment=require(_0xe41f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe41f('0x5'));var fs=require('fs');var path=require(_0xe41f('0x6'));var rimraf=require(_0xe41f('0x7'));var config=require('../../config/environment');var attributes=require(_0xe41f('0x8'));module[_0xe41f('0x9')]=function(_0x447869,_0xd95b2){return _0x447869[_0xe41f('0xa')](_0xe41f('0xb'),attributes,{'tableName':_0xe41f('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe41f('0xd'),_0xe41f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6644=['define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x58a058,_0x5965eb){var _0x347664=function(_0x2d24db){while(--_0x2d24db){_0x58a058['push'](_0x58a058['shift']());}};_0x347664(++_0x5965eb);}(_0x6644,0x122));var _0x4664=function(_0x24beb4,_0x2926e2){_0x24beb4=_0x24beb4-0x0;var _0x1b6dda=_0x6644[_0x24beb4];return _0x1b6dda;};'use strict';var _=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var logger=require(_0x4664('0x2'))(_0x4664('0x3'));var moment=require(_0x4664('0x4'));var BPromise=require('bluebird');var rp=require(_0x4664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4664('0x6'));var config=require(_0x4664('0x7'));var attributes=require(_0x4664('0x8'));module[_0x4664('0x9')]=function(_0x10e1e5,_0x2716f2){return _0x10e1e5[_0x4664('0xa')](_0x4664('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x4664('0xc'),'fields':[_0x4664('0xd'),_0x4664('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6f55634..eb4ff47 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 _0x9fda=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','bluebird','randomstring','ioredis'];(function(_0x8672b2,_0x3230c){var _0x4e9e0b=function(_0x3ab163){while(--_0x3ab163){_0x8672b2['push'](_0x8672b2['shift']());}};_0x4e9e0b(++_0x3230c);}(_0x9fda,0x8c));var _0xa9fd=function(_0x2fad4b,_0x221269){_0x2fad4b=_0x2fad4b-0x0;var _0x5e1fc0=_0x9fda[_0x2fad4b];return _0x5e1fc0;};'use strict';var _=require(_0xa9fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa9fd('0x1'));var rs=require(_0xa9fd('0x2'));var fs=require('fs');var Redis=require(_0xa9fd('0x3'));var db=require(_0xa9fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9fd('0x5'))(_0xa9fd('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9fd('0x7'));var client=jayson[_0xa9fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2d27,_0x3e5143,_0x1e249e){return new BPromise(function(_0x4072e3,_0x1b1c2e){return client[_0xa9fd('0x9')](_0x5f2d27,_0x1e249e)['then'](function(_0x7bc6c4){logger[_0xa9fd('0xa')](_0xa9fd('0xb'),_0x3e5143,'request\x20sent');logger[_0xa9fd('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3e5143,'request\x20sent',JSON[_0xa9fd('0xd')](_0x7bc6c4));if(_0x7bc6c4[_0xa9fd('0xe')]){if(_0x7bc6c4[_0xa9fd('0xe')]['code']===0x1f4){logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);return _0x1b1c2e(_0x7bc6c4['error'][_0xa9fd('0xf')]);}logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);return _0x4072e3(_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);}else{logger[_0xa9fd('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x3e5143,_0xa9fd('0x10'));_0x4072e3(_0x7bc6c4[_0xa9fd('0x11')]['message']);}})['catch'](function(_0x42d7d9){logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x42d7d9);_0x1b1c2e(_0x42d7d9);});});} \ No newline at end of file +var _0x883b=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x75e4d0,_0xe7be52){var _0x27302c=function(_0x4e6ed1){while(--_0x4e6ed1){_0x75e4d0['push'](_0x75e4d0['shift']());}};_0x27302c(++_0xe7be52);}(_0x883b,0x105));var _0xb883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb883('0x0'));var util=require(_0xb883('0x1'));var moment=require(_0xb883('0x2'));var BPromise=require('bluebird');var rs=require(_0xb883('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb883('0x4'));var logger=require(_0xb883('0x5'))(_0xb883('0x6'));var config=require(_0xb883('0x7'));var jayson=require(_0xb883('0x8'));var client=jayson[_0xb883('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c5cc,_0x452f22,_0x589df1){return new BPromise(function(_0x3addc5,_0x4912e1){return client['request'](_0x24c5cc,_0x589df1)['then'](function(_0x27adf1){logger['info'](_0xb883('0xa'),_0x452f22,_0xb883('0xb'));logger[_0xb883('0xc')](_0xb883('0xd'),_0x452f22,'request\x20sent',JSON[_0xb883('0xe')](_0x27adf1));if(_0x27adf1[_0xb883('0xf')]){if(_0x27adf1[_0xb883('0xf')][_0xb883('0x10')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x452f22,_0x27adf1[_0xb883('0xf')][_0xb883('0x11')]);return _0x4912e1(_0x27adf1[_0xb883('0xf')][_0xb883('0x11')]);}logger[_0xb883('0xf')](_0xb883('0xa'),_0x452f22,_0x27adf1[_0xb883('0xf')][_0xb883('0x11')]);return _0x3addc5(_0x27adf1[_0xb883('0xf')][_0xb883('0x11')]);}else{logger[_0xb883('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x452f22,_0xb883('0xb'));_0x3addc5(_0x27adf1[_0xb883('0x13')][_0xb883('0x11')]);}})[_0xb883('0x14')](function(_0x43a00e){logger[_0xb883('0xf')](_0xb883('0xa'),_0x452f22,_0x43a00e);_0x4912e1(_0x43a00e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 47565dc..581ef7c 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 _0xb853=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x4b9292,_0x563a24){var _0x16ddbb=function(_0x56f077){while(--_0x56f077){_0x4b9292['push'](_0x4b9292['shift']());}};_0x16ddbb(++_0x563a24);}(_0xb853,0x1aa));var _0x3b85=function(_0x2a86ee,_0x16910a){_0x2a86ee=_0x2a86ee-0x0;var _0x5dcebb=_0xb853[_0x2a86ee];return _0x5dcebb;};'use strict';var multer=require(_0x3b85('0x0'));var util=require('util');var path=require(_0x3b85('0x1'));var timeout=require(_0x3b85('0x2'));var express=require(_0x3b85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b85('0x4'));var interaction=require(_0x3b85('0x5'));var config=require(_0x3b85('0x6'));var controller=require(_0x3b85('0x7'));router[_0x3b85('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b85('0x9')]);router['get']('/describe',auth[_0x3b85('0xa')](),controller[_0x3b85('0xb')]);router[_0x3b85('0x8')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b85('0xe')]);router[_0x3b85('0xf')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0x10')]);router[_0x3b85('0x11')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0x12')]);module[_0x3b85('0x13')]=router; \ No newline at end of file +var _0xcca4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x68d9de,_0x4a0463){var _0x11adb1=function(_0x20e312){while(--_0x20e312){_0x68d9de['push'](_0x68d9de['shift']());}};_0x11adb1(++_0x4a0463);}(_0xcca4,0x176));var _0x4cca=function(_0x29197b,_0x224e39){_0x29197b=_0x29197b-0x0;var _0x5d1949=_0xcca4[_0x29197b];return _0x5d1949;};'use strict';var multer=require(_0x4cca('0x0'));var util=require('util');var path=require(_0x4cca('0x1'));var timeout=require(_0x4cca('0x2'));var express=require(_0x4cca('0x3'));var router=express[_0x4cca('0x4')]();var fs_extra=require(_0x4cca('0x5'));var auth=require(_0x4cca('0x6'));var interaction=require(_0x4cca('0x7'));var config=require(_0x4cca('0x8'));var controller=require('./userProfileSection.controller');router[_0x4cca('0x9')]('/',auth['isAuthenticated'](),controller[_0x4cca('0xa')]);router[_0x4cca('0x9')](_0x4cca('0xb'),auth[_0x4cca('0xc')](),controller['describe']);router[_0x4cca('0x9')](_0x4cca('0xd'),auth[_0x4cca('0xc')](),controller['show']);router[_0x4cca('0xe')]('/',auth[_0x4cca('0xc')](),controller[_0x4cca('0xf')]);router[_0x4cca('0x10')](_0x4cca('0xd'),auth[_0x4cca('0xc')](),controller['update']);router[_0x4cca('0x11')](_0x4cca('0xd'),auth[_0x4cca('0xc')](),controller[_0x4cca('0x12')]);module[_0x4cca('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index aff4a39..17aa504 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 _0x28f2=['join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x566e8c,_0x26e1f2){var _0x2849b9=function(_0x386a81){while(--_0x386a81){_0x566e8c['push'](_0x566e8c['shift']());}};_0x2849b9(++_0x26e1f2);}(_0x28f2,0x193));var _0x228f=function(_0x125152,_0x476352){_0x125152=_0x125152-0x0;var _0x31c206=_0x28f2[_0x125152];return _0x31c206;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x228f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x228f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x228f('0x2')],'set':function(_0x79ed5f){this[_0x228f('0x5')](_0x228f('0x6'),_0x79ed5f?_0x79ed5f[_0x228f('0x7')](''):[]);},'get':function(){return this[_0x228f('0x8')]('crudPermissions')?this[_0x228f('0x8')]('crudPermissions')[_0x228f('0x9')](''):[];}}}; \ No newline at end of file +var _0xd8b0=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','BOOLEAN'];(function(_0x314559,_0x356f1a){var _0x373db8=function(_0x1e869e){while(--_0x1e869e){_0x314559['push'](_0x314559['shift']());}};_0x373db8(++_0x356f1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x364286){this[_0x0d8b('0x4')]('crudPermissions',_0x364286?_0x364286['join'](''):[]);},'get':function(){return this[_0x0d8b('0x5')](_0x0d8b('0x6'))?this[_0x0d8b('0x5')]('crudPermissions')[_0x0d8b('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ebfea13..aebe1c4 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 _0xa776=['undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','catch','create','body','find','describe','eml-format','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset'];(function(_0x1e6de6,_0x1af547){var _0x3e2360=function(_0x52d8fa){while(--_0x52d8fa){_0x1e6de6['push'](_0x1e6de6['shift']());}};_0x3e2360(++_0x1af547);}(_0xa776,0x78));var _0x6a77=function(_0x430d02,_0x478a32){_0x430d02=_0x430d02-0x0;var _0x423273=_0xa776[_0x430d02];return _0x423273;};'use strict';var emlformat=require(_0x6a77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a77('0x1'));var moment=require(_0x6a77('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a77('0x3'));var path=require(_0x6a77('0x4'));var sox=require(_0x6a77('0x5'));var csv=require(_0x6a77('0x6'));var ejs=require(_0x6a77('0x7'));var fs=require('fs');var fs_extra=require(_0x6a77('0x8'));var _=require(_0x6a77('0x9'));var squel=require(_0x6a77('0xa'));var crypto=require(_0x6a77('0xb'));var jsforce=require(_0x6a77('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a77('0x6'));var querystring=require(_0x6a77('0xd'));var Papa=require(_0x6a77('0xe'));var Redis=require(_0x6a77('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6a77('0x10'));var as=require(_0x6a77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a77('0x12'))('api');var utils=require(_0x6a77('0x13'));var config=require(_0x6a77('0x14'));var licenseUtil=require(_0x6a77('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d78ab,_0x5a3a5a){_0x5a3a5a=_0x5a3a5a||0xcc;return function(_0x21555a){if(_0x21555a){return _0x4d78ab[_0x6a77('0x16')](_0x5a3a5a);}return _0x4d78ab[_0x6a77('0x17')](_0x5a3a5a)[_0x6a77('0x18')]();};}function respondWithResult(_0x4f6c37,_0x1d4459){_0x1d4459=_0x1d4459||0xc8;return function(_0x1c8310){if(_0x1c8310){return _0x4f6c37[_0x6a77('0x17')](_0x1d4459)['json'](_0x1c8310);}};}function respondWithFilteredResult(_0x16724d,_0x339325){return function(_0x504189){if(_0x504189){var _0x28118a=typeof _0x339325[_0x6a77('0x19')]===_0x6a77('0x1a')&&typeof _0x339325['limit']===_0x6a77('0x1a');var _0xba960c=_0x504189['count'];var _0x2adc97=_0x28118a?0x0:_0x339325[_0x6a77('0x19')];var _0x1b5ecc=_0x28118a?_0x504189[_0x6a77('0x1b')]:_0x339325[_0x6a77('0x19')]+_0x339325['limit'];var _0x70e175;if(_0x1b5ecc>=_0xba960c){_0x1b5ecc=_0xba960c;_0x70e175=0xc8;}else{_0x70e175=0xce;}_0x16724d['status'](_0x70e175);return _0x16724d[_0x6a77('0x1c')](_0x6a77('0x1d'),_0x2adc97+'-'+_0x1b5ecc+'/'+_0xba960c)[_0x6a77('0x1e')](_0x504189);}return null;};}function patchUpdates(_0x30f4d2){return function(_0x409072){try{jsonpatch[_0x6a77('0x1f')](_0x409072,_0x30f4d2,!![]);}catch(_0x10fe83){return BPromise[_0x6a77('0x20')](_0x10fe83);}return _0x409072[_0x6a77('0x21')]();};}function saveUpdates(_0x14623f,_0x32bc2b){return function(_0x10957f){if(_0x10957f){return _0x10957f['update'](_0x14623f)[_0x6a77('0x22')](function(_0xc3edf2){return _0xc3edf2;});}return null;};}function removeEntity(_0x1472a9,_0x29be79){return function(_0x12001e){if(_0x12001e){return _0x12001e[_0x6a77('0x23')]()[_0x6a77('0x22')](function(){_0x1472a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de4f0,_0x3362a8){return function(_0x7d2d4){if(!_0x7d2d4){_0x3de4f0[_0x6a77('0x16')](0x194);}return _0x7d2d4;};}function handleError(_0x1cb3e4,_0x853600){_0x853600=_0x853600||0x1f4;return function(_0x4ca6b2){logger[_0x6a77('0x24')](_0x4ca6b2[_0x6a77('0x25')]);if(_0x4ca6b2['name']){delete _0x4ca6b2['name'];}_0x1cb3e4[_0x6a77('0x17')](_0x853600)['send'](_0x4ca6b2);};}exports[_0x6a77('0x26')]=function(_0x24a8cb,_0x1a9381){var _0x5d4659={},_0x51f8fd={},_0xc02a2e={'count':0x0,'rows':[]};var _0x1b65b7=_[_0x6a77('0x27')](db[_0x6a77('0x28')][_0x6a77('0x29')],function(_0xe25f84){return{'name':_0xe25f84[_0x6a77('0x2a')],'type':_0xe25f84[_0x6a77('0x2b')][_0x6a77('0x2c')]};});_0x51f8fd[_0x6a77('0x2d')]=_['map'](_0x1b65b7,_0x6a77('0x2e'));_0x51f8fd[_0x6a77('0x2f')]=_[_0x6a77('0x30')](_0x24a8cb[_0x6a77('0x2f')]);_0x51f8fd[_0x6a77('0x31')]=_[_0x6a77('0x32')](_0x51f8fd[_0x6a77('0x2d')],_0x51f8fd[_0x6a77('0x2f')]);_0x5d4659[_0x6a77('0x33')]=_[_0x6a77('0x32')](_0x51f8fd[_0x6a77('0x2d')],qs['fields'](_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x34')]));_0x5d4659[_0x6a77('0x33')]=_0x5d4659[_0x6a77('0x33')][_0x6a77('0x35')]?_0x5d4659['attributes']:_0x51f8fd['model'];if(!_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x36')](_0x6a77('0x37'))){_0x5d4659[_0x6a77('0x38')]=qs[_0x6a77('0x38')](_0x24a8cb['query'][_0x6a77('0x38')]);_0x5d4659[_0x6a77('0x19')]=qs[_0x6a77('0x19')](_0x24a8cb['query'][_0x6a77('0x19')]);}_0x5d4659['order']=qs[_0x6a77('0x39')](_0x24a8cb['query'][_0x6a77('0x39')]);_0x5d4659[_0x6a77('0x3a')]=qs['filters'](_['pick'](_0x24a8cb[_0x6a77('0x2f')],_0x51f8fd[_0x6a77('0x31')]),_0x1b65b7);if(_0x24a8cb[_0x6a77('0x2f')]['filter']){_0x5d4659[_0x6a77('0x3a')]=_[_0x6a77('0x3b')](_0x5d4659[_0x6a77('0x3a')],{'$or':_[_0x6a77('0x27')](_0x1b65b7,function(_0x142702){if(_0x142702['type']!==_0x6a77('0x3c')){var _0x5ea316={};_0x5ea316[_0x142702['name']]={'$like':'%'+_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x3d')]+'%'};return _0x5ea316;}})});}_0x5d4659=_[_0x6a77('0x3b')]({},_0x5d4659,_0x24a8cb['options']);var _0x2fb90b={'where':_0x5d4659['where']};return db['UserProfileSection'][_0x6a77('0x1b')](_0x2fb90b)[_0x6a77('0x22')](function(_0x20d679){_0xc02a2e[_0x6a77('0x1b')]=_0x20d679;if(_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x3e')]){_0x5d4659[_0x6a77('0x3f')]=[{'all':!![]}];}return db[_0x6a77('0x28')][_0x6a77('0x40')](_0x5d4659);})['then'](function(_0x14b10d){_0xc02a2e[_0x6a77('0x41')]=_0x14b10d;return _0xc02a2e;})['then'](respondWithFilteredResult(_0x1a9381,_0x5d4659))['catch'](handleError(_0x1a9381,null));};exports['show']=function(_0x199792,_0x56fe6c){var _0x31b610={'raw':![],'where':{'id':_0x199792[_0x6a77('0x42')]['id']}},_0x276190={};_0x276190[_0x6a77('0x2d')]=_['keys'](db[_0x6a77('0x28')][_0x6a77('0x29')]);_0x276190['query']=_[_0x6a77('0x30')](_0x199792['query']);_0x276190['filters']=_['intersection'](_0x276190[_0x6a77('0x2d')],_0x276190[_0x6a77('0x2f')]);_0x31b610[_0x6a77('0x33')]=_[_0x6a77('0x32')](_0x276190[_0x6a77('0x2d')],qs[_0x6a77('0x34')](_0x199792['query']['fields']));_0x31b610[_0x6a77('0x33')]=_0x31b610[_0x6a77('0x33')][_0x6a77('0x35')]?_0x31b610[_0x6a77('0x33')]:_0x276190[_0x6a77('0x2d')];if(_0x199792['query']['includeAll']){_0x31b610[_0x6a77('0x3f')]=[{'all':!![]}];}_0x31b610=_[_0x6a77('0x3b')]({},_0x31b610,_0x199792[_0x6a77('0x43')]);return db[_0x6a77('0x28')]['find'](_0x31b610)[_0x6a77('0x22')](handleEntityNotFound(_0x56fe6c,null))[_0x6a77('0x22')](respondWithResult(_0x56fe6c,null))[_0x6a77('0x44')](handleError(_0x56fe6c,null));};exports['create']=function(_0x440810,_0x1da26b){return db[_0x6a77('0x28')][_0x6a77('0x45')](_0x440810[_0x6a77('0x46')],{})[_0x6a77('0x22')](respondWithResult(_0x1da26b,0xc9))[_0x6a77('0x44')](handleError(_0x1da26b,null));};exports['update']=function(_0x16e588,_0x17debf){if(_0x16e588[_0x6a77('0x46')]['id']){delete _0x16e588[_0x6a77('0x46')]['id'];}return db[_0x6a77('0x28')][_0x6a77('0x47')]({'where':{'id':_0x16e588[_0x6a77('0x42')]['id']}})[_0x6a77('0x22')](handleEntityNotFound(_0x17debf,null))[_0x6a77('0x22')](saveUpdates(_0x16e588['body'],null))[_0x6a77('0x22')](respondWithResult(_0x17debf,null))[_0x6a77('0x44')](handleError(_0x17debf,null));};exports[_0x6a77('0x23')]=function(_0x2aab00,_0x11f0ba){return db[_0x6a77('0x28')][_0x6a77('0x47')]({'where':{'id':_0x2aab00[_0x6a77('0x42')]['id']}})[_0x6a77('0x22')](handleEntityNotFound(_0x11f0ba,null))[_0x6a77('0x22')](removeEntity(_0x11f0ba,null))[_0x6a77('0x44')](handleError(_0x11f0ba,null));};exports[_0x6a77('0x48')]=function(_0xf33e81,_0x4a80d6){return db[_0x6a77('0x28')]['describe']()[_0x6a77('0x22')](respondWithResult(_0x4a80d6,null))[_0x6a77('0x44')](handleError(_0x4a80d6,null));}; \ No newline at end of file +var _0xd7bb=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','rows','catch','params','length','merge','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields'];(function(_0x2d8189,_0x2757fd){var _0x23846b=function(_0x11889d){while(--_0x11889d){_0x2d8189['push'](_0x2d8189['shift']());}};_0x23846b(++_0x2757fd);}(_0xd7bb,0xb1));var _0xbd7b=function(_0x164022,_0x2bdc8e){_0x164022=_0x164022-0x0;var _0x407397=_0xd7bb[_0x164022];return _0x407397;};'use strict';var emlformat=require(_0xbd7b('0x0'));var rimraf=require(_0xbd7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd7b('0x2'));var rp=require(_0xbd7b('0x3'));var moment=require('moment');var BPromise=require(_0xbd7b('0x4'));var Mustache=require(_0xbd7b('0x5'));var util=require(_0xbd7b('0x6'));var path=require(_0xbd7b('0x7'));var sox=require(_0xbd7b('0x8'));var csv=require(_0xbd7b('0x9'));var ejs=require(_0xbd7b('0xa'));var fs=require('fs');var fs_extra=require(_0xbd7b('0xb'));var _=require(_0xbd7b('0xc'));var squel=require('squel');var crypto=require(_0xbd7b('0xd'));var jsforce=require(_0xbd7b('0xe'));var deskjs=require(_0xbd7b('0xf'));var toCsv=require(_0xbd7b('0x9'));var querystring=require('querystring');var Papa=require(_0xbd7b('0x10'));var Redis=require(_0xbd7b('0x11'));var authService=require(_0xbd7b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbd7b('0x13'));var hardwareService=require(_0xbd7b('0x14'));var logger=require(_0xbd7b('0x15'))(_0xbd7b('0x16'));var utils=require('../../config/utils');var config=require(_0xbd7b('0x17'));var licenseUtil=require(_0xbd7b('0x18'));var db=require(_0xbd7b('0x19'))['db'];function respondWithStatusCode(_0x2e9b1c,_0x406da6){_0x406da6=_0x406da6||0xcc;return function(_0x25b476){if(_0x25b476){return _0x2e9b1c[_0xbd7b('0x1a')](_0x406da6);}return _0x2e9b1c[_0xbd7b('0x1b')](_0x406da6)[_0xbd7b('0x1c')]();};}function respondWithResult(_0x537632,_0x540956){_0x540956=_0x540956||0xc8;return function(_0x10b033){if(_0x10b033){return _0x537632['status'](_0x540956)[_0xbd7b('0x1d')](_0x10b033);}};}function respondWithFilteredResult(_0x2a1f12,_0x35f898){return function(_0x391682){if(_0x391682){var _0x2fa36b=typeof _0x35f898['offset']===_0xbd7b('0x1e')&&typeof _0x35f898[_0xbd7b('0x1f')]===_0xbd7b('0x1e');var _0x27e7fe=_0x391682[_0xbd7b('0x20')];var _0x4b4e7f=_0x2fa36b?0x0:_0x35f898[_0xbd7b('0x21')];var _0x21969b=_0x2fa36b?_0x391682[_0xbd7b('0x20')]:_0x35f898[_0xbd7b('0x21')]+_0x35f898[_0xbd7b('0x1f')];var _0x2368d7;if(_0x21969b>=_0x27e7fe){_0x21969b=_0x27e7fe;_0x2368d7=0xc8;}else{_0x2368d7=0xce;}_0x2a1f12[_0xbd7b('0x1b')](_0x2368d7);return _0x2a1f12[_0xbd7b('0x22')](_0xbd7b('0x23'),_0x4b4e7f+'-'+_0x21969b+'/'+_0x27e7fe)['json'](_0x391682);}return null;};}function patchUpdates(_0x29c954){return function(_0xc930fc){try{jsonpatch['apply'](_0xc930fc,_0x29c954,!![]);}catch(_0x55f741){return BPromise[_0xbd7b('0x24')](_0x55f741);}return _0xc930fc[_0xbd7b('0x25')]();};}function saveUpdates(_0x4f957d,_0x37ac79){return function(_0xbb5ee5){if(_0xbb5ee5){return _0xbb5ee5[_0xbd7b('0x26')](_0x4f957d)[_0xbd7b('0x27')](function(_0x4372b0){return _0x4372b0;});}return null;};}function removeEntity(_0xa073eb,_0x328d56){return function(_0x4d0098){if(_0x4d0098){return _0x4d0098['destroy']()[_0xbd7b('0x27')](function(){_0xa073eb[_0xbd7b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x499323,_0x14d81c){return function(_0x4d293f){if(!_0x4d293f){_0x499323['sendStatus'](0x194);}return _0x4d293f;};}function handleError(_0x4a93d3,_0x4c2691){_0x4c2691=_0x4c2691||0x1f4;return function(_0x226e92){logger[_0xbd7b('0x28')](_0x226e92[_0xbd7b('0x29')]);if(_0x226e92[_0xbd7b('0x2a')]){delete _0x226e92[_0xbd7b('0x2a')];}_0x4a93d3[_0xbd7b('0x1b')](_0x4c2691)[_0xbd7b('0x2b')](_0x226e92);};}exports[_0xbd7b('0x2c')]=function(_0x2356f5,_0x163b77){var _0x4a7928={},_0x32bdb9={},_0x259061={'count':0x0,'rows':[]};var _0x18da31=_[_0xbd7b('0x2d')](db[_0xbd7b('0x2e')][_0xbd7b('0x2f')],function(_0x500039){return{'name':_0x500039[_0xbd7b('0x30')],'type':_0x500039[_0xbd7b('0x31')][_0xbd7b('0x32')]};});_0x32bdb9[_0xbd7b('0x33')]=_[_0xbd7b('0x2d')](_0x18da31,'name');_0x32bdb9['query']=_[_0xbd7b('0x34')](_0x2356f5[_0xbd7b('0x35')]);_0x32bdb9['filters']=_['intersection'](_0x32bdb9[_0xbd7b('0x33')],_0x32bdb9[_0xbd7b('0x35')]);_0x4a7928[_0xbd7b('0x36')]=_[_0xbd7b('0x37')](_0x32bdb9[_0xbd7b('0x33')],qs[_0xbd7b('0x38')](_0x2356f5[_0xbd7b('0x35')][_0xbd7b('0x38')]));_0x4a7928[_0xbd7b('0x36')]=_0x4a7928[_0xbd7b('0x36')]['length']?_0x4a7928['attributes']:_0x32bdb9[_0xbd7b('0x33')];if(!_0x2356f5[_0xbd7b('0x35')][_0xbd7b('0x39')](_0xbd7b('0x3a'))){_0x4a7928['limit']=qs[_0xbd7b('0x1f')](_0x2356f5['query'][_0xbd7b('0x1f')]);_0x4a7928[_0xbd7b('0x21')]=qs['offset'](_0x2356f5[_0xbd7b('0x35')][_0xbd7b('0x21')]);}_0x4a7928[_0xbd7b('0x3b')]=qs[_0xbd7b('0x3c')](_0x2356f5['query'][_0xbd7b('0x3c')]);_0x4a7928[_0xbd7b('0x3d')]=qs[_0xbd7b('0x3e')](_[_0xbd7b('0x3f')](_0x2356f5[_0xbd7b('0x35')],_0x32bdb9[_0xbd7b('0x3e')]),_0x18da31);if(_0x2356f5['query'][_0xbd7b('0x40')]){_0x4a7928[_0xbd7b('0x3d')]=_['merge'](_0x4a7928[_0xbd7b('0x3d')],{'$or':_[_0xbd7b('0x2d')](_0x18da31,function(_0x2e19b6){if(_0x2e19b6['type']!==_0xbd7b('0x41')){var _0x460c68={};_0x460c68[_0x2e19b6[_0xbd7b('0x2a')]]={'$like':'%'+_0x2356f5[_0xbd7b('0x35')][_0xbd7b('0x40')]+'%'};return _0x460c68;}})});}_0x4a7928=_['merge']({},_0x4a7928,_0x2356f5['options']);var _0x50b266={'where':_0x4a7928[_0xbd7b('0x3d')]};return db[_0xbd7b('0x2e')][_0xbd7b('0x20')](_0x50b266)['then'](function(_0x85aa05){_0x259061[_0xbd7b('0x20')]=_0x85aa05;if(_0x2356f5[_0xbd7b('0x35')][_0xbd7b('0x42')]){_0x4a7928[_0xbd7b('0x43')]=[{'all':!![]}];}return db[_0xbd7b('0x2e')]['findAll'](_0x4a7928);})[_0xbd7b('0x27')](function(_0xd5490){_0x259061[_0xbd7b('0x44')]=_0xd5490;return _0x259061;})[_0xbd7b('0x27')](respondWithFilteredResult(_0x163b77,_0x4a7928))[_0xbd7b('0x45')](handleError(_0x163b77,null));};exports['show']=function(_0x3d4ff1,_0x243373){var _0x4734f4={'raw':![],'where':{'id':_0x3d4ff1[_0xbd7b('0x46')]['id']}},_0x3650bd={};_0x3650bd['model']=_[_0xbd7b('0x34')](db[_0xbd7b('0x2e')][_0xbd7b('0x2f')]);_0x3650bd['query']=_[_0xbd7b('0x34')](_0x3d4ff1[_0xbd7b('0x35')]);_0x3650bd[_0xbd7b('0x3e')]=_['intersection'](_0x3650bd[_0xbd7b('0x33')],_0x3650bd['query']);_0x4734f4[_0xbd7b('0x36')]=_['intersection'](_0x3650bd[_0xbd7b('0x33')],qs['fields'](_0x3d4ff1[_0xbd7b('0x35')]['fields']));_0x4734f4[_0xbd7b('0x36')]=_0x4734f4[_0xbd7b('0x36')][_0xbd7b('0x47')]?_0x4734f4[_0xbd7b('0x36')]:_0x3650bd[_0xbd7b('0x33')];if(_0x3d4ff1['query'][_0xbd7b('0x42')]){_0x4734f4['include']=[{'all':!![]}];}_0x4734f4=_[_0xbd7b('0x48')]({},_0x4734f4,_0x3d4ff1[_0xbd7b('0x49')]);return db['UserProfileSection'][_0xbd7b('0x4a')](_0x4734f4)[_0xbd7b('0x27')](handleEntityNotFound(_0x243373,null))[_0xbd7b('0x27')](respondWithResult(_0x243373,null))[_0xbd7b('0x45')](handleError(_0x243373,null));};exports[_0xbd7b('0x4b')]=function(_0x362cc0,_0x10b635){return db[_0xbd7b('0x2e')][_0xbd7b('0x4b')](_0x362cc0[_0xbd7b('0x4c')],{})[_0xbd7b('0x27')](respondWithResult(_0x10b635,0xc9))['catch'](handleError(_0x10b635,null));};exports['update']=function(_0x412994,_0x2ba4d1){if(_0x412994[_0xbd7b('0x4c')]['id']){delete _0x412994[_0xbd7b('0x4c')]['id'];}return db['UserProfileSection'][_0xbd7b('0x4a')]({'where':{'id':_0x412994[_0xbd7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ba4d1,null))[_0xbd7b('0x27')](saveUpdates(_0x412994[_0xbd7b('0x4c')],null))['then'](respondWithResult(_0x2ba4d1,null))['catch'](handleError(_0x2ba4d1,null));};exports[_0xbd7b('0x4d')]=function(_0x312b32,_0x1fcb07){return db['UserProfileSection']['find']({'where':{'id':_0x312b32[_0xbd7b('0x46')]['id']}})[_0xbd7b('0x27')](handleEntityNotFound(_0x1fcb07,null))[_0xbd7b('0x27')](removeEntity(_0x1fcb07,null))['catch'](handleError(_0x1fcb07,null));};exports['describe']=function(_0x21e60c,_0x1a1f2d){return db['UserProfileSection']['describe']()[_0xbd7b('0x27')](respondWithResult(_0x1a1f2d,null))[_0xbd7b('0x45')](handleError(_0x1a1f2d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 36fcb4e..7c56923 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 _0x2c9f=['bluebird','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','../../config/logger','api','moment'];(function(_0xebc70a,_0xe4088a){var _0x4da0bd=function(_0xe4dbf3){while(--_0xe4dbf3){_0xebc70a['push'](_0xebc70a['shift']());}};_0x4da0bd(++_0xe4088a);}(_0x2c9f,0x110));var _0xf2c9=function(_0x24bab5,_0x39049e){_0x24bab5=_0x24bab5-0x0;var _0x714a1a=_0x2c9f[_0x24bab5];return _0x714a1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf2c9('0x0'))(_0xf2c9('0x1'));var moment=require(_0xf2c9('0x2'));var BPromise=require(_0xf2c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2c9('0x4'));var rimraf=require(_0xf2c9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2c9('0x6'));module[_0xf2c9('0x7')]=function(_0x78987,_0x3ce30d){return _0x78987[_0xf2c9('0x8')](_0xf2c9('0x9'),attributes,{'tableName':_0xf2c9('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5af7=['UserProfileSection','user_profile_has_sections','compositeIndex','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','define'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5af7,0x6b));var _0x75af=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x5af7[_0x1d8119];return _0x3e30f6;};'use strict';var _=require(_0x75af('0x0'));var util=require('util');var logger=require(_0x75af('0x1'))(_0x75af('0x2'));var moment=require(_0x75af('0x3'));var BPromise=require(_0x75af('0x4'));var rp=require(_0x75af('0x5'));var fs=require('fs');var path=require(_0x75af('0x6'));var rimraf=require('rimraf');var config=require(_0x75af('0x7'));var attributes=require(_0x75af('0x8'));module['exports']=function(_0x423e25,_0x46edb8){return _0x423e25[_0x75af('0x9')](_0x75af('0xa'),attributes,{'tableName':_0x75af('0xb'),'paranoid':![],'indexes':[{'name':_0x75af('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c111201..690e548 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 _0xd2c7=['bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x56e620,_0x1fbca8){var _0x5d0439=function(_0x5cb4bb){while(--_0x5cb4bb){_0x56e620['push'](_0x56e620['shift']());}};_0x5d0439(++_0x1fbca8);}(_0xd2c7,0x1e5));var _0x7d2c=function(_0x5860b4,_0x1b0c8a){_0x5860b4=_0x5860b4-0x0;var _0xd71fca=_0xd2c7[_0x5860b4];return _0xd71fca;};'use strict';var _=require('lodash');var util=require(_0x7d2c('0x0'));var moment=require('moment');var BPromise=require(_0x7d2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d2c('0x2'))['db'];var utils=require(_0x7d2c('0x3'));var logger=require('../../config/logger')(_0x7d2c('0x4'));var config=require('../../config/environment');var jayson=require(_0x7d2c('0x5'));var client=jayson[_0x7d2c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59532b,_0x6b8d65,_0x2d04b3){return new BPromise(function(_0x41037b,_0x2b5f18){return client[_0x7d2c('0x7')](_0x59532b,_0x2d04b3)['then'](function(_0x163fb7){logger[_0x7d2c('0x8')](_0x7d2c('0x9'),_0x6b8d65,_0x7d2c('0xa'));logger[_0x7d2c('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x6b8d65,_0x7d2c('0xa'),JSON[_0x7d2c('0xc')](_0x163fb7));if(_0x163fb7[_0x7d2c('0xd')]){if(_0x163fb7['error'][_0x7d2c('0xe')]===0x1f4){logger[_0x7d2c('0xd')](_0x7d2c('0x9'),_0x6b8d65,_0x163fb7[_0x7d2c('0xd')][_0x7d2c('0xf')]);return _0x2b5f18(_0x163fb7['error']['message']);}logger['error'](_0x7d2c('0x9'),_0x6b8d65,_0x163fb7['error'][_0x7d2c('0xf')]);return _0x41037b(_0x163fb7[_0x7d2c('0xd')][_0x7d2c('0xf')]);}else{logger['info'](_0x7d2c('0x9'),_0x6b8d65,'request\x20sent');_0x41037b(_0x163fb7[_0x7d2c('0x10')]['message']);}})[_0x7d2c('0x11')](function(_0x5ec473){logger[_0x7d2c('0xd')](_0x7d2c('0x9'),_0x6b8d65,_0x5ec473);_0x2b5f18(_0x5ec473);});});} \ No newline at end of file +var _0xba37=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3a94a0,_0xc9d868){var _0x325a69=function(_0x108428){while(--_0x108428){_0x3a94a0['push'](_0x3a94a0['shift']());}};_0x325a69(++_0xc9d868);}(_0xba37,0x93));var _0x7ba3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xba37[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x7ba3('0x0'));var moment=require(_0x7ba3('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ba3('0x2'));var fs=require('fs');var Redis=require(_0x7ba3('0x3'));var db=require(_0x7ba3('0x4'))['db'];var utils=require(_0x7ba3('0x5'));var logger=require(_0x7ba3('0x6'))(_0x7ba3('0x7'));var config=require('../../config/environment');var jayson=require(_0x7ba3('0x8'));var client=jayson[_0x7ba3('0x9')][_0x7ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15d739,_0xec1391,_0x162e92){return new BPromise(function(_0x514e0,_0x3d525f){return client[_0x7ba3('0xb')](_0x15d739,_0x162e92)['then'](function(_0x269cb0){logger[_0x7ba3('0xc')](_0x7ba3('0xd'),_0xec1391,_0x7ba3('0xe'));logger['debug'](_0x7ba3('0xf'),_0xec1391,_0x7ba3('0xe'),JSON[_0x7ba3('0x10')](_0x269cb0));if(_0x269cb0[_0x7ba3('0x11')]){if(_0x269cb0[_0x7ba3('0x11')][_0x7ba3('0x12')]===0x1f4){logger[_0x7ba3('0x11')](_0x7ba3('0xd'),_0xec1391,_0x269cb0[_0x7ba3('0x11')][_0x7ba3('0x13')]);return _0x3d525f(_0x269cb0[_0x7ba3('0x11')][_0x7ba3('0x13')]);}logger[_0x7ba3('0x11')](_0x7ba3('0xd'),_0xec1391,_0x269cb0[_0x7ba3('0x11')][_0x7ba3('0x13')]);return _0x514e0(_0x269cb0[_0x7ba3('0x11')]['message']);}else{logger[_0x7ba3('0xc')](_0x7ba3('0xd'),_0xec1391,_0x7ba3('0xe'));_0x514e0(_0x269cb0['result'][_0x7ba3('0x13')]);}})[_0x7ba3('0x14')](function(_0xe88c6b){logger['error']('UserProfileSection,\x20%s,\x20%s',_0xec1391,_0xe88c6b);_0x3d525f(_0xe88c6b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 042ba9a..b144360 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x499c7f,_0x2d8184){var _0x433bee=function(_0xd1543a){while(--_0xd1543a){_0x499c7f['push'](_0x499c7f['shift']());}};_0x433bee(++_0x2d8184);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x18bd2f,_0x5375b4){var _0x366ae0=function(_0x430221){while(--_0x430221){_0x18bd2f['push'](_0x18bd2f['shift']());}};_0x366ae0(++_0x5375b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x350dee,_0x243191){_0x350dee=_0x350dee-0x0;var _0xe33b0d=_0xedd9[_0x350dee];return _0xe33b0d;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5919358..43e7583 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 _0x2c9b=['INTEGER','sequelize'];(function(_0x296ebb,_0x3b5f33){var _0x2406c1=function(_0x26f29c){while(--_0x26f29c){_0x296ebb['push'](_0x296ebb['shift']());}};_0x2406c1(++_0x3b5f33);}(_0x2c9b,0x1e9));var _0xb2c9=function(_0x301a90,_0xbf9228){_0x301a90=_0x301a90-0x0;var _0x4e3e9d=_0x2c9b[_0x301a90];return _0x4e3e9d;};'use strict';var Sequelize=require(_0xb2c9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb2c9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0032=['INTEGER','exports'];(function(_0x14601d,_0x5eea6f){var _0x2e235e=function(_0x1a8107){while(--_0x1a8107){_0x14601d['push'](_0x14601d['shift']());}};_0x2e235e(++_0x5eea6f);}(_0x0032,0x127));var _0x2003=function(_0x378ee1,_0x2786a0){_0x378ee1=_0x378ee1-0x0;var _0xdb7a8e=_0x0032[_0x378ee1];return _0xdb7a8e;};'use strict';var Sequelize=require('sequelize');module[_0x2003('0x0')]={'penalty':{'type':Sequelize[_0x2003('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0f89df1..b1ff5b5 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 _0x0af5=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x270296,_0xcf0837){var _0x4f47ea=function(_0x127fcb){while(--_0x127fcb){_0x270296['push'](_0x270296['shift']());}};_0x4f47ea(++_0xcf0837);}(_0x0af5,0x158));var _0x50af=function(_0x17c17d,_0x2b894f){_0x17c17d=_0x17c17d-0x0;var _0x5782df=_0x0af5[_0x17c17d];return _0x5782df;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var logger=require(_0x50af('0x1'))(_0x50af('0x2'));var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var rp=require(_0x50af('0x5'));var fs=require('fs');var path=require(_0x50af('0x6'));var rimraf=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var attributes=require(_0x50af('0x9'));module[_0x50af('0xa')]=function(_0xe37b1,_0x5e94f8){return _0xe37b1['define'](_0x50af('0xb'),attributes,{'tableName':_0x50af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x3a6d,0x143));var _0xd3a6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3a6d[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('UserSmsQueue',attributes,{'tableName':_0xd3a6('0xb'),'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 76a3178..d8d2566 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 _0x825c=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x825c,0x170));var _0xc825=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x825c[_0x21b706];return _0x13b94a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc825('0x0'));var BPromise=require(_0xc825('0x1'));var rs=require(_0xc825('0x2'));var fs=require('fs');var Redis=require(_0xc825('0x3'));var db=require(_0xc825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc825('0x5'))(_0xc825('0x6'));var config=require(_0xc825('0x7'));var jayson=require(_0xc825('0x8'));var client=jayson[_0xc825('0x9')][_0xc825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6df4,_0x399fb4,_0x5aa690){return new BPromise(function(_0xb0cf99,_0x2cb6a5){return client[_0xc825('0xb')](_0x2e6df4,_0x5aa690)[_0xc825('0xc')](function(_0x567d8f){logger[_0xc825('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x399fb4,_0xc825('0xe'));logger[_0xc825('0xf')](_0xc825('0x10'),_0x399fb4,_0xc825('0xe'),JSON[_0xc825('0x11')](_0x567d8f));if(_0x567d8f['error']){if(_0x567d8f['error'][_0xc825('0x12')]===0x1f4){logger[_0xc825('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x399fb4,_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);return _0x2cb6a5(_0x567d8f['error'][_0xc825('0x14')]);}logger[_0xc825('0x13')](_0xc825('0x15'),_0x399fb4,_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);return _0xb0cf99(_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);}else{logger['info'](_0xc825('0x15'),_0x399fb4,'request\x20sent');_0xb0cf99(_0x567d8f[_0xc825('0x16')]['message']);}})[_0xc825('0x17')](function(_0xdda754){logger[_0xc825('0x13')](_0xc825('0x15'),_0x399fb4,_0xdda754);_0x2cb6a5(_0xdda754);});});} \ No newline at end of file +var _0x5f6d=['request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c7069,_0x3fd858){var _0xea897b=function(_0x322673){while(--_0x322673){_0x4c7069['push'](_0x4c7069['shift']());}};_0xea897b(++_0x3fd858);}(_0x5f6d,0x75));var _0xd5f6=function(_0x2360b8,_0x4f4f03){_0x2360b8=_0x2360b8-0x0;var _0x1cfe64=_0x5f6d[_0x2360b8];return _0x1cfe64;};'use strict';var _=require(_0xd5f6('0x0'));var util=require(_0xd5f6('0x1'));var moment=require(_0xd5f6('0x2'));var BPromise=require(_0xd5f6('0x3'));var rs=require(_0xd5f6('0x4'));var fs=require('fs');var Redis=require(_0xd5f6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5f6('0x6'));var logger=require(_0xd5f6('0x7'))(_0xd5f6('0x8'));var config=require(_0xd5f6('0x9'));var jayson=require(_0xd5f6('0xa'));var client=jayson[_0xd5f6('0xb')][_0xd5f6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a5972,_0x3cd67b,_0x36a22b){return new BPromise(function(_0x253100,_0xa87cce){return client[_0xd5f6('0xd')](_0x4a5972,_0x36a22b)[_0xd5f6('0xe')](function(_0x59a8a1){logger[_0xd5f6('0xf')](_0xd5f6('0x10'),_0x3cd67b,'request\x20sent');logger[_0xd5f6('0x11')](_0xd5f6('0x12'),_0x3cd67b,'request\x20sent',JSON[_0xd5f6('0x13')](_0x59a8a1));if(_0x59a8a1['error']){if(_0x59a8a1[_0xd5f6('0x14')][_0xd5f6('0x15')]===0x1f4){logger['error'](_0xd5f6('0x10'),_0x3cd67b,_0x59a8a1['error'][_0xd5f6('0x16')]);return _0xa87cce(_0x59a8a1[_0xd5f6('0x14')][_0xd5f6('0x16')]);}logger['error'](_0xd5f6('0x10'),_0x3cd67b,_0x59a8a1[_0xd5f6('0x14')][_0xd5f6('0x16')]);return _0x253100(_0x59a8a1['error'][_0xd5f6('0x16')]);}else{logger[_0xd5f6('0xf')](_0xd5f6('0x10'),_0x3cd67b,_0xd5f6('0x17'));_0x253100(_0x59a8a1[_0xd5f6('0x18')]['message']);}})[_0xd5f6('0x19')](function(_0x504b3b){logger[_0xd5f6('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x3cd67b,_0x504b3b);_0xa87cce(_0x504b3b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5f6e433..8974046 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 _0xb00e=['INTEGER'];(function(_0x29374a,_0x5788c7){var _0x2bed8f=function(_0x54a84c){while(--_0x54a84c){_0x29374a['push'](_0x29374a['shift']());}};_0x2bed8f(++_0x5788c7);}(_0xb00e,0x1a5));var _0xeb00=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xb00e[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xeb00('0x0')]}}; \ No newline at end of file +var _0x50f9=['sequelize','INTEGER'];(function(_0x317633,_0x715640){var _0x320dd8=function(_0x4be922){while(--_0x4be922){_0x317633['push'](_0x317633['shift']());}};_0x320dd8(++_0x715640);}(_0x50f9,0x14c));var _0x950f=function(_0x47832b,_0x41ef03){_0x47832b=_0x47832b-0x0;var _0x248fc2=_0x50f9[_0x47832b];return _0x248fc2;};'use strict';var Sequelize=require(_0x950f('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x950f('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8a4864c..2a13757 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(_0x3701e6,_0x7c6ca1){var _0x3071bf=function(_0x70f77c){while(--_0x70f77c){_0x3701e6['push'](_0x3701e6['shift']());}};_0x3071bf(++_0x7c6ca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x17a3e0,_0x2c5c9d){var _0x43aa2f=function(_0x50f185){while(--_0x50f185){_0x17a3e0['push'](_0x17a3e0['shift']());}};_0x43aa2f(++_0x2c5c9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 0dbe9b9..9abb62c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1090df,_0x16f8c4){var _0x3c8d10=function(_0x1ca425){while(--_0x1ca425){_0x1090df['push'](_0x1090df['shift']());}};_0x3c8d10(++_0x16f8c4);}(_0xe706,0xa3));var _0x6e70=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0xe706[_0x1cd5b1];return _0x25b4c7;};'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(_0x11162d,_0x3c7e4f){var _0x5f4aeb=function(_0x25dc99){while(--_0x25dc99){_0x11162d['push'](_0x11162d['shift']());}};_0x5f4aeb(++_0x3c7e4f);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 522c635..7bd8b9a 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 _0xfa59=['INTEGER'];(function(_0x17d1b2,_0x2b5596){var _0x21e5ec=function(_0x3df4cf){while(--_0x3df4cf){_0x17d1b2['push'](_0x17d1b2['shift']());}};_0x21e5ec(++_0x2b5596);}(_0xfa59,0x121));var _0x9fa5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa59[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9fa5('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2187=['sequelize','exports','INTEGER'];(function(_0x289642,_0xa28560){var _0x3f30ff=function(_0x17ca01){while(--_0x17ca01){_0x289642['push'](_0x289642['shift']());}};_0x3f30ff(++_0xa28560);}(_0x2187,0x1ad));var _0x7218=function(_0x145b24,_0x352c14){_0x145b24=_0x145b24-0x0;var _0x1111e1=_0x2187[_0x145b24];return _0x1111e1;};'use strict';var Sequelize=require(_0x7218('0x0'));module[_0x7218('0x1')]={'penalty':{'type':Sequelize[_0x7218('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 46ba418..f578f1d 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 _0xd0f7=['user_has_voice_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xd0f7,0x109));var _0x7d0f=function(_0x736e2,_0x316ff9){_0x736e2=_0x736e2-0x0;var _0x523195=_0xd0f7[_0x736e2];return _0x523195;};'use strict';var _=require(_0x7d0f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d0f('0x1'));var BPromise=require(_0x7d0f('0x2'));var rp=require(_0x7d0f('0x3'));var fs=require('fs');var path=require(_0x7d0f('0x4'));var rimraf=require(_0x7d0f('0x5'));var config=require(_0x7d0f('0x6'));var attributes=require(_0x7d0f('0x7'));module[_0x7d0f('0x8')]=function(_0x396e2f,_0x4767e6){return _0x396e2f[_0x7d0f('0x9')](_0x7d0f('0xa'),attributes,{'tableName':_0x7d0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a3=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment'];(function(_0x1e909d,_0x4a8f3d){var _0x4762cd=function(_0x30cc4e){while(--_0x30cc4e){_0x1e909d['push'](_0x1e909d['shift']());}};_0x4762cd(++_0x4a8f3d);}(_0x29a3,0x8c));var _0x329a=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x29a3[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x329a('0x0'));var util=require(_0x329a('0x1'));var logger=require('../../config/logger')(_0x329a('0x2'));var moment=require(_0x329a('0x3'));var BPromise=require(_0x329a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x329a('0x5'));var rimraf=require(_0x329a('0x6'));var config=require(_0x329a('0x7'));var attributes=require(_0x329a('0x8'));module['exports']=function(_0x59f987,_0x501b75){return _0x59f987[_0x329a('0x9')](_0x329a('0xa'),attributes,{'tableName':_0x329a('0xb'),'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 9aca03c..9098986 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 _0xc9d2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash'];(function(_0x19b9d1,_0x4f603f){var _0x1ca4f7=function(_0x2d1ea7){while(--_0x2d1ea7){_0x19b9d1['push'](_0x19b9d1['shift']());}};_0x1ca4f7(++_0x4f603f);}(_0xc9d2,0x179));var _0x2c9d=function(_0x173bb6,_0x3a6f85){_0x173bb6=_0x173bb6-0x0;var _0x222877=_0xc9d2[_0x173bb6];return _0x222877;};'use strict';var _=require(_0x2c9d('0x0'));var util=require(_0x2c9d('0x1'));var moment=require(_0x2c9d('0x2'));var BPromise=require(_0x2c9d('0x3'));var rs=require(_0x2c9d('0x4'));var fs=require('fs');var Redis=require(_0x2c9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c9d('0x6'));var logger=require(_0x2c9d('0x7'))(_0x2c9d('0x8'));var config=require(_0x2c9d('0x9'));var jayson=require(_0x2c9d('0xa'));var client=jayson[_0x2c9d('0xb')][_0x2c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fad20,_0x5cc5db,_0x4275ae){return new BPromise(function(_0x49d87f,_0x51685d){return client[_0x2c9d('0xd')](_0x4fad20,_0x4275ae)['then'](function(_0x27f2ed){logger['info'](_0x2c9d('0xe'),_0x5cc5db,'request\x20sent');logger[_0x2c9d('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5cc5db,_0x2c9d('0x10'),JSON['stringify'](_0x27f2ed));if(_0x27f2ed[_0x2c9d('0x11')]){if(_0x27f2ed[_0x2c9d('0x11')][_0x2c9d('0x12')]===0x1f4){logger['error'](_0x2c9d('0xe'),_0x5cc5db,_0x27f2ed['error'][_0x2c9d('0x13')]);return _0x51685d(_0x27f2ed['error'][_0x2c9d('0x13')]);}logger[_0x2c9d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5db,_0x27f2ed['error'][_0x2c9d('0x13')]);return _0x49d87f(_0x27f2ed[_0x2c9d('0x11')][_0x2c9d('0x13')]);}else{logger[_0x2c9d('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5db,_0x2c9d('0x10'));_0x49d87f(_0x27f2ed['result'][_0x2c9d('0x13')]);}})['catch'](function(_0x3fef93){logger[_0x2c9d('0x11')](_0x2c9d('0xe'),_0x5cc5db,_0x3fef93);_0x51685d(_0x3fef93);});});} \ No newline at end of file +var _0xb0f0=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c4c82,_0x32767c){var _0x30507c=function(_0x3a7e0d){while(--_0x3a7e0d){_0x1c4c82['push'](_0x1c4c82['shift']());}};_0x30507c(++_0x32767c);}(_0xb0f0,0xf4));var _0x0b0f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb0f0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0b0f('0x0'));var moment=require('moment');var BPromise=require(_0x0b0f('0x1'));var rs=require(_0x0b0f('0x2'));var fs=require('fs');var Redis=require(_0x0b0f('0x3'));var db=require(_0x0b0f('0x4'))['db'];var utils=require(_0x0b0f('0x5'));var logger=require(_0x0b0f('0x6'))(_0x0b0f('0x7'));var config=require(_0x0b0f('0x8'));var jayson=require(_0x0b0f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16918c,_0x9081ef,_0x5cbb48){return new BPromise(function(_0x1e57d6,_0x2b394e){return client['request'](_0x16918c,_0x5cbb48)[_0x0b0f('0xa')](function(_0x517c03){logger[_0x0b0f('0xb')](_0x0b0f('0xc'),_0x9081ef,_0x0b0f('0xd'));logger[_0x0b0f('0xe')](_0x0b0f('0xf'),_0x9081ef,_0x0b0f('0xd'),JSON[_0x0b0f('0x10')](_0x517c03));if(_0x517c03[_0x0b0f('0x11')]){if(_0x517c03[_0x0b0f('0x11')][_0x0b0f('0x12')]===0x1f4){logger[_0x0b0f('0x11')](_0x0b0f('0xc'),_0x9081ef,_0x517c03[_0x0b0f('0x11')][_0x0b0f('0x13')]);return _0x2b394e(_0x517c03[_0x0b0f('0x11')][_0x0b0f('0x13')]);}logger[_0x0b0f('0x11')](_0x0b0f('0xc'),_0x9081ef,_0x517c03[_0x0b0f('0x11')][_0x0b0f('0x13')]);return _0x1e57d6(_0x517c03[_0x0b0f('0x11')][_0x0b0f('0x13')]);}else{logger['info'](_0x0b0f('0xc'),_0x9081ef,'request\x20sent');_0x1e57d6(_0x517c03[_0x0b0f('0x14')][_0x0b0f('0x13')]);}})[_0x0b0f('0x15')](function(_0x4e1ec0){logger['error'](_0x0b0f('0xc'),_0x9081ef,_0x4e1ec0);_0x2b394e(_0x4e1ec0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 90d9ff4..e29baad 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3876a2,_0x146b65){var _0x374d28=function(_0x240396){while(--_0x240396){_0x3876a2['push'](_0x3876a2['shift']());}};_0x374d28(++_0x146b65);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xcb91[_0x134d5e];return _0x1e166a;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36a560,_0x57378b){var _0x10923a=function(_0xd1fa18){while(--_0xd1fa18){_0x36a560['push'](_0x36a560['shift']());}};_0x10923a(++_0x57378b);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ceebeda..1588d3f 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 _0x4de9=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x323b01,_0x3a3ad2){var _0x128c3e=function(_0x2a3214){while(--_0x2a3214){_0x323b01['push'](_0x323b01['shift']());}};_0x128c3e(++_0x3a3ad2);}(_0x4de9,0xb0));var _0x94de=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x4de9[_0xf16b1];return _0x26f94d;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x94de('0x0')},'membername':{'type':Sequelize[_0x94de('0x1')],'allowNull':![],'comment':_0x94de('0x0')},'UserId':{'type':Sequelize[_0x94de('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94de('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x94de('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94de('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x94de('0x2')](0xb),'defaultValue':0x0,'comment':_0x94de('0x0')},'paused':{'type':Sequelize[_0x94de('0x2')](0xb),'defaultValue':0x0,'comment':_0x94de('0x0')}}; \ No newline at end of file +var _0xd743=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x3891e8,_0x3b6b95){var _0xc34c60=function(_0x1c62a9){while(--_0x1c62a9){_0x3891e8['push'](_0x3891e8['shift']());}};_0xc34c60(++_0x3b6b95);}(_0xd743,0xee));var _0x3d74=function(_0x853d2e,_0x174541){_0x853d2e=_0x853d2e-0x0;var _0x48f4e3=_0xd743[_0x853d2e];return _0x48f4e3;};'use strict';var Sequelize=require('sequelize');module[_0x3d74('0x0')]={'uniqueid':{'type':Sequelize[_0x3d74('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3d74('0x2')},'membername':{'type':Sequelize[_0x3d74('0x3')],'allowNull':![],'comment':_0x3d74('0x2')},'UserId':{'type':Sequelize[_0x3d74('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3d74('0x3')],'allowNull':![],'unique':_0x3d74('0x4'),'comment':_0x3d74('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3d74('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x3d74('0x3')],'allowNull':![],'unique':_0x3d74('0x4'),'comment':_0x3d74('0x2')},'penalty':{'type':Sequelize[_0x3d74('0x1')](0xb),'defaultValue':0x0,'comment':_0x3d74('0x2')},'paused':{'type':Sequelize[_0x3d74('0x1')](0xb),'defaultValue':0x0,'comment':_0x3d74('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a5716bb..307e96e 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 _0x6616=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x55e367,_0x184f21){var _0x3080c3=function(_0x1a2fdf){while(--_0x1a2fdf){_0x55e367['push'](_0x55e367['shift']());}};_0x3080c3(++_0x184f21);}(_0x6616,0x103));var _0x6661=function(_0xc2296b,_0x5bbcbd){_0xc2296b=_0xc2296b-0x0;var _0x424505=_0x6616[_0xc2296b];return _0x424505;};'use strict';var EventEmitter=require(_0x6661('0x0'));var UserVoiceQueueRt=require(_0x6661('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6661('0x2')](0x0);var events={'afterCreate':_0x6661('0x3'),'afterUpdate':_0x6661('0x4'),'afterDestroy':_0x6661('0x5')};function emitEvent(_0x4b2ef0){return function(_0x4d4d77,_0x8ffa8,_0x3e8882){UserVoiceQueueRtEvents['emit'](_0x4b2ef0+':'+_0x4d4d77['id'],_0x4d4d77);UserVoiceQueueRtEvents[_0x6661('0x6')](_0x4b2ef0,_0x4d4d77);_0x3e8882(null);};}for(var e in events){if(events[_0x6661('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6661('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7f96=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f96,0x95));var _0x67f9=function(_0x1ca9f8,_0x2ccb7e){_0x1ca9f8=_0x1ca9f8-0x0;var _0x47ba1e=_0x7f96[_0x1ca9f8];return _0x47ba1e;};'use strict';var EventEmitter=require(_0x67f9('0x0'));var UserVoiceQueueRt=require(_0x67f9('0x1'))['db'][_0x67f9('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x67f9('0x3')](0x0);var events={'afterCreate':_0x67f9('0x4'),'afterUpdate':'update','afterDestroy':_0x67f9('0x5')};function emitEvent(_0x225cdf){return function(_0x5de46c,_0x56be0,_0x58fb0e){UserVoiceQueueRtEvents[_0x67f9('0x6')](_0x225cdf+':'+_0x5de46c['id'],_0x5de46c);UserVoiceQueueRtEvents[_0x67f9('0x6')](_0x225cdf,_0x5de46c);_0x58fb0e(null);};}for(var e in events){if(events[_0x67f9('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x67f9('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d1aa8e4..5c3f29f 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 _0xef63=['exports','define','UserVoiceQueueRt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x596a1b,_0x53ce62){var _0x43b5fc=function(_0x77c8bd){while(--_0x77c8bd){_0x596a1b['push'](_0x596a1b['shift']());}};_0x43b5fc(++_0x53ce62);}(_0xef63,0x12e));var _0x3ef6=function(_0x1b3fe4,_0x1ef110){_0x1b3fe4=_0x1b3fe4-0x0;var _0x5a7c45=_0xef63[_0x1b3fe4];return _0x5a7c45;};'use strict';var _=require('lodash');var util=require(_0x3ef6('0x0'));var logger=require(_0x3ef6('0x1'))(_0x3ef6('0x2'));var moment=require(_0x3ef6('0x3'));var BPromise=require(_0x3ef6('0x4'));var rp=require(_0x3ef6('0x5'));var fs=require('fs');var path=require(_0x3ef6('0x6'));var rimraf=require(_0x3ef6('0x7'));var config=require(_0x3ef6('0x8'));var attributes=require(_0x3ef6('0x9'));module[_0x3ef6('0xa')]=function(_0x5ae04f,_0x4ce064){return _0x5ae04f[_0x3ef6('0xb')](_0x3ef6('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfadd=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d2c7a,_0x37c635){var _0x59971b=function(_0x220cad){while(--_0x220cad){_0x1d2c7a['push'](_0x1d2c7a['shift']());}};_0x59971b(++_0x37c635);}(_0xfadd,0x1b0));var _0xdfad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfadd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var logger=require(_0xdfad('0x2'))(_0xdfad('0x3'));var moment=require(_0xdfad('0x4'));var BPromise=require(_0xdfad('0x5'));var rp=require(_0xdfad('0x6'));var fs=require('fs');var path=require(_0xdfad('0x7'));var rimraf=require(_0xdfad('0x8'));var config=require(_0xdfad('0x9'));var attributes=require(_0xdfad('0xa'));module['exports']=function(_0x58ec91,_0x765cbe){return _0x58ec91[_0xdfad('0xb')](_0xdfad('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b30f44c..cef09e5 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 _0x290c=['raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x290c,0x91));var _0xc290=function(_0x561a9d,_0x2df671){_0x561a9d=_0x561a9d-0x0;var _0x3a9a37=_0x290c[_0x561a9d];return _0x3a9a37;};'use strict';var _=require('lodash');var util=require(_0xc290('0x0'));var moment=require(_0xc290('0x1'));var BPromise=require(_0xc290('0x2'));var rs=require(_0xc290('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc290('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc290('0x5'))('rpc');var config=require(_0xc290('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc290('0x7')][_0xc290('0x8')]({'port':0x232a});config['redis']=_[_0xc290('0x9')](config['redis'],{'host':_0xc290('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc290('0xb'))[_0xc290('0xc')](socket);function respondWithRpcPromise(_0x1b73bc,_0x3833db,_0x5a3906){return new BPromise(function(_0x3bb26e,_0x357dc9){return client[_0xc290('0xd')](_0x1b73bc,_0x5a3906)[_0xc290('0xe')](function(_0x2ac3be){logger[_0xc290('0xf')](_0xc290('0x10'),_0x3833db,_0xc290('0x11'));logger[_0xc290('0x12')](_0xc290('0x13'),_0x3833db,'request\x20sent',JSON[_0xc290('0x14')](_0x2ac3be));if(_0x2ac3be[_0xc290('0x15')]){if(_0x2ac3be[_0xc290('0x15')][_0xc290('0x16')]===0x1f4){logger[_0xc290('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3833db,_0x2ac3be[_0xc290('0x15')][_0xc290('0x17')]);return _0x357dc9(_0x2ac3be[_0xc290('0x15')][_0xc290('0x17')]);}logger[_0xc290('0x15')](_0xc290('0x10'),_0x3833db,_0x2ac3be['error'][_0xc290('0x17')]);return _0x3bb26e(_0x2ac3be['error'][_0xc290('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3833db,_0xc290('0x11'));_0x3bb26e(_0x2ac3be[_0xc290('0x18')][_0xc290('0x17')]);}})[_0xc290('0x19')](function(_0x567df9){logger['error'](_0xc290('0x10'),_0x3833db,_0x567df9);_0x357dc9(_0x567df9);});});}exports[_0xc290('0x1a')]=function(_0x5d487f){var _0x202e5b=this;return new Promise(function(_0xaf7679,_0x51de94){return db[_0xc290('0x1b')][_0xc290('0x1c')]({'raw':_0x5d487f[_0xc290('0x1d')]?_0x5d487f[_0xc290('0x1d')][_0xc290('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d487f[_0xc290('0x1d')]?_0x5d487f['options']['where']||null:null,'attributes':[[db[_0xc290('0x1f')]['fn']('COUNT',db[_0xc290('0x1f')]['fn']('IF',db[_0xc290('0x1f')][_0xc290('0x20')](_0xc290('0x21')))),_0xc290('0x22')]]})['then'](function(_0x5e2b6b){logger['info']('GetVoiceQueueRtPauses',_0x5d487f);logger[_0xc290('0x12')](_0xc290('0x1a'),_0x5d487f,JSON['stringify'](_0x5e2b6b));_0xaf7679(_0x5e2b6b);})[_0xc290('0x19')](function(_0x49d246){logger['error'](_0xc290('0x1a'),_0x49d246[_0xc290('0x17')],_0x5d487f);_0x51de94(_0x202e5b[_0xc290('0x15')](0x1f4,_0x49d246[_0xc290('0x17')]));});});}; \ No newline at end of file +var _0xee92=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','util'];(function(_0x327363,_0x47087d){var _0xf695d8=function(_0x5e5b46){while(--_0x5e5b46){_0x327363['push'](_0x327363['shift']());}};_0xf695d8(++_0x47087d);}(_0xee92,0x13a));var _0x2ee9=function(_0x36cb8d,_0x1450d4){_0x36cb8d=_0x36cb8d-0x0;var _0x2e19fd=_0xee92[_0x36cb8d];return _0x2e19fd;};'use strict';var _=require('lodash');var util=require(_0x2ee9('0x0'));var moment=require(_0x2ee9('0x1'));var BPromise=require(_0x2ee9('0x2'));var rs=require(_0x2ee9('0x3'));var fs=require('fs');var Redis=require(_0x2ee9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ee9('0x5'));var logger=require(_0x2ee9('0x6'))(_0x2ee9('0x7'));var config=require(_0x2ee9('0x8'));var jayson=require(_0x2ee9('0x9'));var client=jayson[_0x2ee9('0xa')]['http']({'port':0x232a});config[_0x2ee9('0xb')]=_[_0x2ee9('0xc')](config[_0x2ee9('0xb')],{'host':_0x2ee9('0xd'),'port':0x18eb});var socket=require(_0x2ee9('0xe'))(new Redis(config[_0x2ee9('0xb')]));require(_0x2ee9('0xf'))[_0x2ee9('0x10')](socket);function respondWithRpcPromise(_0x4505da,_0x3f541d,_0x2862ef){return new BPromise(function(_0x38b9f7,_0xaf4415){return client[_0x2ee9('0x11')](_0x4505da,_0x2862ef)[_0x2ee9('0x12')](function(_0x136fc7){logger['info'](_0x2ee9('0x13'),_0x3f541d,_0x2ee9('0x14'));logger[_0x2ee9('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3f541d,'request\x20sent',JSON[_0x2ee9('0x16')](_0x136fc7));if(_0x136fc7[_0x2ee9('0x17')]){if(_0x136fc7[_0x2ee9('0x17')][_0x2ee9('0x18')]===0x1f4){logger[_0x2ee9('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3f541d,_0x136fc7['error']['message']);return _0xaf4415(_0x136fc7['error'][_0x2ee9('0x19')]);}logger['error'](_0x2ee9('0x13'),_0x3f541d,_0x136fc7[_0x2ee9('0x17')][_0x2ee9('0x19')]);return _0x38b9f7(_0x136fc7[_0x2ee9('0x17')][_0x2ee9('0x19')]);}else{logger[_0x2ee9('0x1a')](_0x2ee9('0x13'),_0x3f541d,_0x2ee9('0x14'));_0x38b9f7(_0x136fc7[_0x2ee9('0x1b')][_0x2ee9('0x19')]);}})[_0x2ee9('0x1c')](function(_0xf6f3ba){logger[_0x2ee9('0x17')](_0x2ee9('0x13'),_0x3f541d,_0xf6f3ba);_0xaf4415(_0xf6f3ba);});});}exports[_0x2ee9('0x1d')]=function(_0xa08ced){var _0x2073ef=this;return new Promise(function(_0xa13d11,_0x3d1b5){return db['UserVoiceQueueRt']['findAll']({'raw':_0xa08ced['options']?_0xa08ced[_0x2ee9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xa08ced[_0x2ee9('0x1e')]?_0xa08ced[_0x2ee9('0x1e')][_0x2ee9('0x1f')]||null:null,'attributes':[[db[_0x2ee9('0x20')]['fn'](_0x2ee9('0x21'),db['sequelize']['fn']('IF',db[_0x2ee9('0x20')]['literal'](_0x2ee9('0x22')))),'outboundQueuePauses']]})[_0x2ee9('0x12')](function(_0x520d00){logger[_0x2ee9('0x1a')](_0x2ee9('0x1d'),_0xa08ced);logger[_0x2ee9('0x15')](_0x2ee9('0x1d'),_0xa08ced,JSON[_0x2ee9('0x16')](_0x520d00));_0xa13d11(_0x520d00);})[_0x2ee9('0x1c')](function(_0x2a1bb3){logger[_0x2ee9('0x17')](_0x2ee9('0x1d'),_0x2a1bb3[_0x2ee9('0x19')],_0xa08ced);_0x3d1b5(_0x2073ef[_0x2ee9('0x17')](0x1f4,_0x2a1bb3[_0x2ee9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index b0d2e51..1aae701 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 _0x979e=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x1e16c4,_0x1fc1f4){var _0x33e028=function(_0x1c1714){while(--_0x1c1714){_0x1e16c4['push'](_0x1e16c4['shift']());}};_0x33e028(++_0x1fc1f4);}(_0x979e,0x195));var _0xe979=function(_0x48c81d,_0x305c82){_0x48c81d=_0x48c81d-0x0;var _0x45f51e=_0x979e[_0x48c81d];return _0x45f51e;};'use strict';var UserVoiceQueueRtEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),_0xe979('0x2'),_0xe979('0x3')];function createListener(_0x5ce889,_0x10fb90){return function(_0x47321a){_0x10fb90[_0xe979('0x4')](_0x5ce889,_0x47321a);};}function removeListener(_0x3b4b06,_0x2d62dd){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3b4b06,_0x2d62dd);};}exports[_0xe979('0x5')]=function(_0x580e20){for(var _0x1a0d35=0x0,_0x13a9ee=events[_0xe979('0x6')];_0x1a0d35<_0x13a9ee;_0x1a0d35++){var _0xc63524=events[_0x1a0d35];var _0xc79c06=createListener(_0xe979('0x7')+_0xc63524,_0x580e20);UserVoiceQueueRtEvents['on'](_0xc63524,_0xc79c06);}}; \ No newline at end of file +var _0x9a6b=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x487fb2,_0x2da7ad){var _0x2ceb80=function(_0x397e4){while(--_0x397e4){_0x487fb2['push'](_0x487fb2['shift']());}};_0x2ceb80(++_0x2da7ad);}(_0x9a6b,0x77));var _0xb9a6=function(_0x96a05,_0x1f4b8c){_0x96a05=_0x96a05-0x0;var _0x253e31=_0x9a6b[_0x96a05];return _0x253e31;};'use strict';var UserVoiceQueueRtEvents=require(_0xb9a6('0x0'));var events=[_0xb9a6('0x1'),_0xb9a6('0x2'),_0xb9a6('0x3')];function createListener(_0x13259f,_0x2889d6){return function(_0x5c0cf3){_0x2889d6[_0xb9a6('0x4')](_0x13259f,_0x5c0cf3);};}function removeListener(_0x4f9462,_0x1cb7b4){return function(){UserVoiceQueueRtEvents[_0xb9a6('0x5')](_0x4f9462,_0x1cb7b4);};}exports[_0xb9a6('0x6')]=function(_0x2ca15b){for(var _0x160e75=0x0,_0x555d54=events[_0xb9a6('0x7')];_0x160e75<_0x555d54;_0x160e75++){var _0x2afba5=events[_0x160e75];var _0x15cb33=createListener(_0xb9a6('0x8')+_0x2afba5,_0x2ca15b);UserVoiceQueueRtEvents['on'](_0x2afba5,_0x15cb33);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 72ca8a5..f4fb229 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5530a9,_0x48e4c2){var _0x1c69f4=function(_0x2577e0){while(--_0x2577e0){_0x5530a9['push'](_0x5530a9['shift']());}};_0x1c69f4(++_0x48e4c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x6b239b,_0x2ca34e){var _0xfbd99b=function(_0x576c01){while(--_0x576c01){_0x6b239b['push'](_0x6b239b['shift']());}};_0xfbd99b(++_0x2ca34e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index cefcc67..55c4bdb 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 _0xdd23=['sequelize'];(function(_0x4919a8,_0x4c4863){var _0x5851d8=function(_0x52d353){while(--_0x52d353){_0x4919a8['push'](_0x4919a8['shift']());}};_0x5851d8(++_0x4c4863);}(_0xdd23,0x109));var _0x3dd2=function(_0x394579,_0x144e6d){_0x394579=_0x394579-0x0;var _0x111e75=_0xdd23[_0x394579];return _0x111e75;};'use strict';var Sequelize=require(_0x3dd2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ead=['INTEGER','sequelize','exports'];(function(_0x4b389e,_0xdba71a){var _0xb3875d=function(_0x5be330){while(--_0x5be330){_0x4b389e['push'](_0x4b389e['shift']());}};_0xb3875d(++_0xdba71a);}(_0x8ead,0xc4));var _0xd8ea=function(_0x436813,_0x3479c4){_0x436813=_0x436813-0x0;var _0x312f75=_0x8ead[_0x436813];return _0x312f75;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'penalty':{'type':Sequelize[_0xd8ea('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 97b5f4b..bd4c406 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 _0x3dbd=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x1de2a6,_0xc4c40e){var _0x14ab99=function(_0x52e506){while(--_0x52e506){_0x1de2a6['push'](_0x1de2a6['shift']());}};_0x14ab99(++_0xc4c40e);}(_0x3dbd,0x9c));var _0xd3db=function(_0x21946b,_0x165c02){_0x21946b=_0x21946b-0x0;var _0xa7f04=_0x3dbd[_0x21946b];return _0xa7f04;};'use strict';var _=require(_0xd3db('0x0'));var util=require(_0xd3db('0x1'));var logger=require(_0xd3db('0x2'))(_0xd3db('0x3'));var moment=require('moment');var BPromise=require(_0xd3db('0x4'));var rp=require(_0xd3db('0x5'));var fs=require('fs');var path=require(_0xd3db('0x6'));var rimraf=require(_0xd3db('0x7'));var config=require(_0xd3db('0x8'));var attributes=require(_0xd3db('0x9'));module[_0xd3db('0xa')]=function(_0x398742,_0x5902bb){return _0x398742[_0xd3db('0xb')](_0xd3db('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3a1=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x3b8576,_0x241739){var _0x410744=function(_0x513d7a){while(--_0x513d7a){_0x3b8576['push'](_0x3b8576['shift']());}};_0x410744(++_0x241739);}(_0xa3a1,0xe3));var _0x1a3a=function(_0x474b30,_0x20853f){_0x474b30=_0x474b30-0x0;var _0x17aaf4=_0xa3a1[_0x474b30];return _0x17aaf4;};'use strict';var _=require(_0x1a3a('0x0'));var util=require(_0x1a3a('0x1'));var logger=require(_0x1a3a('0x2'))('api');var moment=require(_0x1a3a('0x3'));var BPromise=require(_0x1a3a('0x4'));var rp=require(_0x1a3a('0x5'));var fs=require('fs');var path=require(_0x1a3a('0x6'));var rimraf=require(_0x1a3a('0x7'));var config=require(_0x1a3a('0x8'));var attributes=require(_0x1a3a('0x9'));module[_0x1a3a('0xa')]=function(_0x579ade,_0x4bf21f){return _0x579ade[_0x1a3a('0xb')](_0x1a3a('0xc'),attributes,{'tableName':_0x1a3a('0xd'),'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 671dfa8..35dac60 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 _0xae3c=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1e8031,_0x49e326){var _0x331793=function(_0xce13eb){while(--_0xce13eb){_0x1e8031['push'](_0x1e8031['shift']());}};_0x331793(++_0x49e326);}(_0xae3c,0x12b));var _0xcae3=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xae3c[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0xcae3('0x0'));var util=require(_0xcae3('0x1'));var moment=require(_0xcae3('0x2'));var BPromise=require(_0xcae3('0x3'));var rs=require(_0xcae3('0x4'));var fs=require('fs');var Redis=require(_0xcae3('0x5'));var db=require(_0xcae3('0x6'))['db'];var utils=require(_0xcae3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcae3('0x8'));var jayson=require(_0xcae3('0x9'));var client=jayson[_0xcae3('0xa')][_0xcae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1c76,_0x2b9d21,_0x2a07c1){return new BPromise(function(_0x1dd2cb,_0x414e33){return client[_0xcae3('0xc')](_0x2e1c76,_0x2a07c1)['then'](function(_0x409e27){logger[_0xcae3('0xd')](_0xcae3('0xe'),_0x2b9d21,_0xcae3('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2b9d21,_0xcae3('0xf'),JSON[_0xcae3('0x10')](_0x409e27));if(_0x409e27[_0xcae3('0x11')]){if(_0x409e27[_0xcae3('0x11')]['code']===0x1f4){logger[_0xcae3('0x11')](_0xcae3('0xe'),_0x2b9d21,_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);return _0x414e33(_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);}logger[_0xcae3('0x11')](_0xcae3('0xe'),_0x2b9d21,_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);return _0x1dd2cb(_0x409e27[_0xcae3('0x11')]['message']);}else{logger[_0xcae3('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2b9d21,_0xcae3('0xf'));_0x1dd2cb(_0x409e27[_0xcae3('0x13')][_0xcae3('0x12')]);}})[_0xcae3('0x14')](function(_0x5323c3){logger['error'](_0xcae3('0xe'),_0x2b9d21,_0x5323c3);_0x414e33(_0x5323c3);});});} \ No newline at end of file +var _0xb779=['stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xb779,0x197));var _0x9b77=function(_0x39a328,_0x3231af){_0x39a328=_0x39a328-0x0;var _0x70f1fb=_0xb779[_0x39a328];return _0x70f1fb;};'use strict';var _=require(_0x9b77('0x0'));var util=require('util');var moment=require(_0x9b77('0x1'));var BPromise=require(_0x9b77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b77('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b77('0x4'))(_0x9b77('0x5'));var config=require(_0x9b77('0x6'));var jayson=require(_0x9b77('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3aff49,_0x3f0faa,_0x963e66){return new BPromise(function(_0x45f5fa,_0x5a249e){return client[_0x9b77('0x8')](_0x3aff49,_0x963e66)[_0x9b77('0x9')](function(_0x57b7de){logger[_0x9b77('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3f0faa,_0x9b77('0xb'));logger['debug'](_0x9b77('0xc'),_0x3f0faa,_0x9b77('0xb'),JSON[_0x9b77('0xd')](_0x57b7de));if(_0x57b7de[_0x9b77('0xe')]){if(_0x57b7de['error'][_0x9b77('0xf')]===0x1f4){logger['error'](_0x9b77('0x10'),_0x3f0faa,_0x57b7de[_0x9b77('0xe')][_0x9b77('0x11')]);return _0x5a249e(_0x57b7de[_0x9b77('0xe')][_0x9b77('0x11')]);}logger[_0x9b77('0xe')](_0x9b77('0x10'),_0x3f0faa,_0x57b7de[_0x9b77('0xe')][_0x9b77('0x11')]);return _0x45f5fa(_0x57b7de[_0x9b77('0xe')][_0x9b77('0x11')]);}else{logger['info'](_0x9b77('0x10'),_0x3f0faa,_0x9b77('0xb'));_0x45f5fa(_0x57b7de[_0x9b77('0x12')][_0x9b77('0x11')]);}})[_0x9b77('0x13')](function(_0x3a50bc){logger[_0x9b77('0xe')](_0x9b77('0x10'),_0x3f0faa,_0x3a50bc);_0x5a249e(_0x3a50bc);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b6b7c9d..190768d 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 _0xac65=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x55056c,_0x5a8d1b){var _0x257f13=function(_0x39422f){while(--_0x39422f){_0x55056c['push'](_0x55056c['shift']());}};_0x257f13(++_0x5a8d1b);}(_0xac65,0x11d));var _0x5ac6=function(_0x30eb72,_0x228296){_0x30eb72=_0x30eb72-0x0;var _0x63ecec=_0xac65[_0x30eb72];return _0x63ecec;};'use strict';var multer=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var path=require(_0x5ac6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ac6('0x3'));var router=express[_0x5ac6('0x4')]();var fs_extra=require(_0x5ac6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var controller=require(_0x5ac6('0x8'));router['get']('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xa')]);router[_0x5ac6('0xb')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xd')]);router[_0x5ac6('0xe')]('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xf')]);router[_0x5ac6('0x10')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x11')]);router[_0x5ac6('0x12')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x13')]);module[_0x5ac6('0x14')]=router; \ No newline at end of file +var _0x0b40=['put','update','delete','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x23a2b1,_0x18774e){var _0x5423bd=function(_0x14f29d){while(--_0x14f29d){_0x23a2b1['push'](_0x23a2b1['shift']());}};_0x5423bd(++_0x18774e);}(_0x0b40,0xba));var _0x00b4=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x0b40[_0xc40b9f];return _0x535b9c;};'use strict';var multer=require('multer');var util=require(_0x00b4('0x0'));var path=require(_0x00b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x00b4('0x2'));var router=express[_0x00b4('0x3')]();var fs_extra=require(_0x00b4('0x4'));var auth=require(_0x00b4('0x5'));var interaction=require(_0x00b4('0x6'));var config=require(_0x00b4('0x7'));var controller=require('./variable.controller');router[_0x00b4('0x8')]('/',auth[_0x00b4('0x9')](),controller[_0x00b4('0xa')]);router[_0x00b4('0x8')]('/:id',auth[_0x00b4('0x9')](),controller[_0x00b4('0xb')]);router[_0x00b4('0xc')]('/',auth['isAuthenticated'](),controller[_0x00b4('0xd')]);router[_0x00b4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x00b4('0xf')]);router[_0x00b4('0x10')](_0x00b4('0x11'),auth[_0x00b4('0x9')](),controller[_0x00b4('0x12')]);module[_0x00b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0e1fe4f..d309b39 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 _0x81f3=['sequelize','STRING'];(function(_0x20bb71,_0x1e3fd7){var _0x5935ce=function(_0x425c7a){while(--_0x425c7a){_0x20bb71['push'](_0x20bb71['shift']());}};_0x5935ce(++_0x1e3fd7);}(_0x81f3,0x1b8));var _0x381f=function(_0x4034cf,_0xabd1f9){_0x4034cf=_0x4034cf-0x0;var _0x41a719=_0x81f3[_0x4034cf];return _0x41a719;};'use strict';var Sequelize=require(_0x381f('0x0'));module['exports']={'name':{'type':Sequelize[_0x381f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x381f('0x1')]}}; \ No newline at end of file +var _0xa063=['sequelize','exports','STRING','name'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa063,0x100));var _0x3a06=function(_0x52da07,_0x28f039){_0x52da07=_0x52da07-0x0;var _0x34a643=_0xa063[_0x52da07];return _0x34a643;};'use strict';var Sequelize=require(_0x3a06('0x0'));module[_0x3a06('0x1')]={'name':{'type':Sequelize[_0x3a06('0x2')],'unique':_0x3a06('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 99d1808..6b82b88 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 _0x7c19=['attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','Variables','stack','name','send','index','Variable','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x7c19,0x163));var _0x97c1=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x7c19[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x97c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c1('0x2'));var moment=require(_0x97c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x97c1('0x4'));var util=require(_0x97c1('0x5'));var path=require(_0x97c1('0x6'));var sox=require(_0x97c1('0x7'));var csv=require(_0x97c1('0x8'));var ejs=require(_0x97c1('0x9'));var fs=require('fs');var fs_extra=require(_0x97c1('0xa'));var _=require(_0x97c1('0xb'));var squel=require('squel');var crypto=require(_0x97c1('0xc'));var jsforce=require(_0x97c1('0xd'));var deskjs=require(_0x97c1('0xe'));var toCsv=require(_0x97c1('0x8'));var querystring=require('querystring');var Papa=require(_0x97c1('0xf'));var Redis=require(_0x97c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x97c1('0x11'));var as=require(_0x97c1('0x12'));var hardwareService=require(_0x97c1('0x13'));var logger=require(_0x97c1('0x14'))(_0x97c1('0x15'));var utils=require(_0x97c1('0x16'));var config=require(_0x97c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x97c1('0x18'))['db'];function respondWithStatusCode(_0x5be4ae,_0x2ae15a){_0x2ae15a=_0x2ae15a||0xcc;return function(_0x475cf3){if(_0x475cf3){return _0x5be4ae[_0x97c1('0x19')](_0x2ae15a);}return _0x5be4ae[_0x97c1('0x1a')](_0x2ae15a)[_0x97c1('0x1b')]();};}function respondWithResult(_0x4a2b0e,_0x6c35cb){_0x6c35cb=_0x6c35cb||0xc8;return function(_0x21b3ea){if(_0x21b3ea){return _0x4a2b0e[_0x97c1('0x1a')](_0x6c35cb)[_0x97c1('0x1c')](_0x21b3ea);}};}function respondWithFilteredResult(_0x3d0490,_0x45f4cf){return function(_0x4e75e4){if(_0x4e75e4){var _0x3d48c7=typeof _0x45f4cf['offset']===_0x97c1('0x1d')&&typeof _0x45f4cf[_0x97c1('0x1e')]==='undefined';var _0x63af7d=_0x4e75e4[_0x97c1('0x1f')];var _0x48a11d=_0x3d48c7?0x0:_0x45f4cf[_0x97c1('0x20')];var _0x2f2899=_0x3d48c7?_0x4e75e4[_0x97c1('0x1f')]:_0x45f4cf[_0x97c1('0x20')]+_0x45f4cf[_0x97c1('0x1e')];var _0x797b88;if(_0x2f2899>=_0x63af7d){_0x2f2899=_0x63af7d;_0x797b88=0xc8;}else{_0x797b88=0xce;}_0x3d0490['status'](_0x797b88);return _0x3d0490[_0x97c1('0x21')]('Content-Range',_0x48a11d+'-'+_0x2f2899+'/'+_0x63af7d)[_0x97c1('0x1c')](_0x4e75e4);}return null;};}function patchUpdates(_0x128616){return function(_0x3e5a5a){try{jsonpatch[_0x97c1('0x22')](_0x3e5a5a,_0x128616,!![]);}catch(_0x27390f){return BPromise['reject'](_0x27390f);}return _0x3e5a5a[_0x97c1('0x23')]();};}function saveUpdates(_0x2137b4,_0x420086){return function(_0x300788){if(_0x300788){return _0x300788[_0x97c1('0x24')](_0x2137b4)[_0x97c1('0x25')](function(_0x1e80e0){return _0x1e80e0;});}return null;};}function removeEntity(_0x250548,_0x2bbcd4){return function(_0x57ca29){if(_0x57ca29){return _0x57ca29[_0x97c1('0x26')]()[_0x97c1('0x25')](function(){var _0x223e93=_0x57ca29[_0x97c1('0x27')]({'plain':!![]});var _0x24ff6b=_0x97c1('0x28');return db['UserProfileResource'][_0x97c1('0x26')]({'where':{'type':_0x24ff6b,'resourceId':_0x223e93['id']}})[_0x97c1('0x25')](function(){return _0x57ca29;});})[_0x97c1('0x25')](function(){_0x250548[_0x97c1('0x1a')](0xcc)[_0x97c1('0x1b')]();});}};}function handleEntityNotFound(_0x5ab1c8,_0x2e3c0d){return function(_0x1c14f4){if(!_0x1c14f4){_0x5ab1c8[_0x97c1('0x19')](0x194);}return _0x1c14f4;};}function handleError(_0x541ece,_0x27868b){_0x27868b=_0x27868b||0x1f4;return function(_0x413b21){logger['error'](_0x413b21[_0x97c1('0x29')]);if(_0x413b21[_0x97c1('0x2a')]){delete _0x413b21[_0x97c1('0x2a')];}_0x541ece['status'](_0x27868b)[_0x97c1('0x2b')](_0x413b21);};}exports[_0x97c1('0x2c')]=function(_0x59f3e7,_0x532249){var _0x5bc497={},_0x14d51b={},_0x1a581b={'count':0x0,'rows':[]};var _0x1ad8f6=_['map'](db[_0x97c1('0x2d')]['rawAttributes'],function(_0x32ac0d){return{'name':_0x32ac0d['fieldName'],'type':_0x32ac0d[_0x97c1('0x2e')][_0x97c1('0x2f')]};});_0x14d51b[_0x97c1('0x30')]=_[_0x97c1('0x31')](_0x1ad8f6,'name');_0x14d51b[_0x97c1('0x32')]=_[_0x97c1('0x33')](_0x59f3e7[_0x97c1('0x32')]);_0x14d51b[_0x97c1('0x34')]=_[_0x97c1('0x35')](_0x14d51b['model'],_0x14d51b[_0x97c1('0x32')]);_0x5bc497['attributes']=_['intersection'](_0x14d51b[_0x97c1('0x30')],qs[_0x97c1('0x36')](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x36')]));_0x5bc497[_0x97c1('0x37')]=_0x5bc497[_0x97c1('0x37')][_0x97c1('0x38')]?_0x5bc497[_0x97c1('0x37')]:_0x14d51b[_0x97c1('0x30')];if(!_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x39')](_0x97c1('0x3a'))){_0x5bc497['limit']=qs[_0x97c1('0x1e')](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x1e')]);_0x5bc497[_0x97c1('0x20')]=qs['offset'](_0x59f3e7[_0x97c1('0x32')]['offset']);}_0x5bc497[_0x97c1('0x3b')]=qs['sort'](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x3c')]);_0x5bc497[_0x97c1('0x3d')]=qs['filters'](_['pick'](_0x59f3e7[_0x97c1('0x32')],_0x14d51b[_0x97c1('0x34')]),_0x1ad8f6);if(_0x59f3e7[_0x97c1('0x32')]['filter']){_0x5bc497['where']=_[_0x97c1('0x3e')](_0x5bc497['where'],{'$or':_[_0x97c1('0x31')](_0x1ad8f6,function(_0x23930a){if(_0x23930a[_0x97c1('0x2e')]!=='VIRTUAL'){var _0x3a48c3={};_0x3a48c3[_0x23930a[_0x97c1('0x2a')]]={'$like':'%'+_0x59f3e7['query'][_0x97c1('0x3f')]+'%'};return _0x3a48c3;}})});}_0x5bc497=_[_0x97c1('0x3e')]({},_0x5bc497,_0x59f3e7[_0x97c1('0x40')]);var _0x447438={'where':_0x5bc497[_0x97c1('0x3d')]};return db['Variable'][_0x97c1('0x1f')](_0x447438)[_0x97c1('0x25')](function(_0xd4e91e){_0x1a581b[_0x97c1('0x1f')]=_0xd4e91e;if(_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x41')]){_0x5bc497['include']=[{'all':!![]}];}return db[_0x97c1('0x2d')][_0x97c1('0x42')](_0x5bc497);})[_0x97c1('0x25')](function(_0x2cec45){_0x1a581b[_0x97c1('0x43')]=_0x2cec45;return _0x1a581b;})[_0x97c1('0x25')](respondWithFilteredResult(_0x532249,_0x5bc497))[_0x97c1('0x44')](handleError(_0x532249,null));};exports['show']=function(_0x5fad66,_0x1388b1){var _0x1e7e3e={'raw':!![],'where':{'id':_0x5fad66[_0x97c1('0x45')]['id']}},_0x51bfb3={};_0x51bfb3[_0x97c1('0x30')]=_[_0x97c1('0x33')](db['Variable'][_0x97c1('0x46')]);_0x51bfb3['query']=_[_0x97c1('0x33')](_0x5fad66[_0x97c1('0x32')]);_0x51bfb3[_0x97c1('0x34')]=_['intersection'](_0x51bfb3['model'],_0x51bfb3[_0x97c1('0x32')]);_0x1e7e3e[_0x97c1('0x37')]=_[_0x97c1('0x35')](_0x51bfb3[_0x97c1('0x30')],qs[_0x97c1('0x36')](_0x5fad66[_0x97c1('0x32')][_0x97c1('0x36')]));_0x1e7e3e[_0x97c1('0x37')]=_0x1e7e3e[_0x97c1('0x37')][_0x97c1('0x38')]?_0x1e7e3e[_0x97c1('0x37')]:_0x51bfb3[_0x97c1('0x30')];if(_0x5fad66[_0x97c1('0x32')][_0x97c1('0x41')]){_0x1e7e3e[_0x97c1('0x47')]=[{'all':!![]}];}_0x1e7e3e=_['merge']({},_0x1e7e3e,_0x5fad66['options']);return db[_0x97c1('0x2d')][_0x97c1('0x48')](_0x1e7e3e)[_0x97c1('0x25')](handleEntityNotFound(_0x1388b1,null))['then'](respondWithResult(_0x1388b1,null))[_0x97c1('0x44')](handleError(_0x1388b1,null));};exports['create']=function(_0x10ad60,_0x48e651){return db[_0x97c1('0x2d')][_0x97c1('0x49')](_0x10ad60[_0x97c1('0x4a')],{})[_0x97c1('0x25')](function(_0x4834bc){var _0x23f05d=_0x10ad60[_0x97c1('0x4b')][_0x97c1('0x27')]({'plain':!![]});if(!_0x23f05d)throw new Error(_0x97c1('0x4c'));if(_0x23f05d[_0x97c1('0x4d')]===_0x97c1('0x4b')){var _0x2507c0=_0x4834bc[_0x97c1('0x27')]({'plain':!![]});var _0x3f89dc=_0x97c1('0x28');return db[_0x97c1('0x4e')][_0x97c1('0x48')]({'where':{'name':_0x3f89dc,'userProfileId':_0x23f05d[_0x97c1('0x4f')]},'raw':!![]})[_0x97c1('0x25')](function(_0x212cd4){if(_0x212cd4&&_0x212cd4[_0x97c1('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2507c0[_0x97c1('0x2a')],'resourceId':_0x2507c0['id'],'type':_0x212cd4[_0x97c1('0x2a')],'sectionId':_0x212cd4['id']},{})[_0x97c1('0x25')](function(){return _0x4834bc;});}else{return _0x4834bc;}})[_0x97c1('0x44')](function(_0x216d3f){logger['error'](_0x97c1('0x51'),_0x216d3f);throw _0x216d3f;});}return _0x4834bc;})['then'](respondWithResult(_0x48e651,0xc9))[_0x97c1('0x44')](handleError(_0x48e651,null));};exports[_0x97c1('0x24')]=function(_0x5780b1,_0x5703d3){if(_0x5780b1['body']['id']){delete _0x5780b1[_0x97c1('0x4a')]['id'];}return db[_0x97c1('0x2d')][_0x97c1('0x48')]({'where':{'id':_0x5780b1[_0x97c1('0x45')]['id']}})[_0x97c1('0x25')](handleEntityNotFound(_0x5703d3,null))[_0x97c1('0x25')](saveUpdates(_0x5780b1['body'],null))[_0x97c1('0x25')](respondWithResult(_0x5703d3,null))['catch'](handleError(_0x5703d3,null));};exports[_0x97c1('0x26')]=function(_0x529b9f,_0x2c617d){return db[_0x97c1('0x2d')][_0x97c1('0x48')]({'where':{'id':_0x529b9f[_0x97c1('0x45')]['id']}})[_0x97c1('0x25')](handleEntityNotFound(_0x2c617d,null))['then'](removeEntity(_0x2c617d,null))[_0x97c1('0x44')](handleError(_0x2c617d,null));}; \ No newline at end of file +var _0x2891=['length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','Variables','UserProfileResource','end','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2891,0x141));var _0x1289=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x2891[_0x187ee1];return _0x388160;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1289('0x0'));var zipdir=require(_0x1289('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1289('0x2'));var moment=require(_0x1289('0x3'));var BPromise=require(_0x1289('0x4'));var Mustache=require(_0x1289('0x5'));var util=require(_0x1289('0x6'));var path=require(_0x1289('0x7'));var sox=require('sox');var csv=require(_0x1289('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1289('0x9'));var squel=require('squel');var crypto=require(_0x1289('0xa'));var jsforce=require(_0x1289('0xb'));var deskjs=require(_0x1289('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1289('0xd'));var Papa=require(_0x1289('0xe'));var Redis=require(_0x1289('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1289('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1289('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1289('0x12'));var licenseUtil=require(_0x1289('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c7eb,_0x447b4b){_0x447b4b=_0x447b4b||0xcc;return function(_0xd8cade){if(_0xd8cade){return _0x36c7eb['sendStatus'](_0x447b4b);}return _0x36c7eb[_0x1289('0x14')](_0x447b4b)['end']();};}function respondWithResult(_0x1b3443,_0x3e4bc0){_0x3e4bc0=_0x3e4bc0||0xc8;return function(_0x192bdb){if(_0x192bdb){return _0x1b3443[_0x1289('0x14')](_0x3e4bc0)[_0x1289('0x15')](_0x192bdb);}};}function respondWithFilteredResult(_0x4280c3,_0x37175e){return function(_0x321424){if(_0x321424){var _0x195278=typeof _0x37175e[_0x1289('0x16')]===_0x1289('0x17')&&typeof _0x37175e[_0x1289('0x18')]===_0x1289('0x17');var _0x3fcd86=_0x321424[_0x1289('0x19')];var _0x1ee32b=_0x195278?0x0:_0x37175e[_0x1289('0x16')];var _0x5eeafd=_0x195278?_0x321424['count']:_0x37175e['offset']+_0x37175e[_0x1289('0x18')];var _0x3a78e4;if(_0x5eeafd>=_0x3fcd86){_0x5eeafd=_0x3fcd86;_0x3a78e4=0xc8;}else{_0x3a78e4=0xce;}_0x4280c3[_0x1289('0x14')](_0x3a78e4);return _0x4280c3[_0x1289('0x1a')]('Content-Range',_0x1ee32b+'-'+_0x5eeafd+'/'+_0x3fcd86)[_0x1289('0x15')](_0x321424);}return null;};}function patchUpdates(_0x260027){return function(_0x5edc7c){try{jsonpatch[_0x1289('0x1b')](_0x5edc7c,_0x260027,!![]);}catch(_0x529717){return BPromise['reject'](_0x529717);}return _0x5edc7c[_0x1289('0x1c')]();};}function saveUpdates(_0x11a961,_0x10e136){return function(_0x2c0cbc){if(_0x2c0cbc){return _0x2c0cbc[_0x1289('0x1d')](_0x11a961)['then'](function(_0x246b27){return _0x246b27;});}return null;};}function removeEntity(_0x393da8,_0x4b03a1){return function(_0x33b584){if(_0x33b584){return _0x33b584[_0x1289('0x1e')]()[_0x1289('0x1f')](function(){var _0x20616a=_0x33b584['get']({'plain':!![]});var _0x590914=_0x1289('0x20');return db[_0x1289('0x21')][_0x1289('0x1e')]({'where':{'type':_0x590914,'resourceId':_0x20616a['id']}})[_0x1289('0x1f')](function(){return _0x33b584;});})[_0x1289('0x1f')](function(){_0x393da8['status'](0xcc)[_0x1289('0x22')]();});}};}function handleEntityNotFound(_0x4ad32d,_0x153612){return function(_0x4c381b){if(!_0x4c381b){_0x4ad32d['sendStatus'](0x194);}return _0x4c381b;};}function handleError(_0x5cee87,_0x449578){_0x449578=_0x449578||0x1f4;return function(_0x615213){logger[_0x1289('0x23')](_0x615213[_0x1289('0x24')]);if(_0x615213['name']){delete _0x615213[_0x1289('0x25')];}_0x5cee87[_0x1289('0x14')](_0x449578)[_0x1289('0x26')](_0x615213);};}exports[_0x1289('0x27')]=function(_0x866f12,_0x58e286){var _0x15c22d={},_0x11ddbb={},_0x1496d9={'count':0x0,'rows':[]};var _0x3be14f=_['map'](db[_0x1289('0x28')][_0x1289('0x29')],function(_0x354f7c){return{'name':_0x354f7c[_0x1289('0x2a')],'type':_0x354f7c[_0x1289('0x2b')]['key']};});_0x11ddbb[_0x1289('0x2c')]=_[_0x1289('0x2d')](_0x3be14f,'name');_0x11ddbb[_0x1289('0x2e')]=_[_0x1289('0x2f')](_0x866f12[_0x1289('0x2e')]);_0x11ddbb[_0x1289('0x30')]=_['intersection'](_0x11ddbb[_0x1289('0x2c')],_0x11ddbb[_0x1289('0x2e')]);_0x15c22d['attributes']=_[_0x1289('0x31')](_0x11ddbb['model'],qs['fields'](_0x866f12[_0x1289('0x2e')][_0x1289('0x32')]));_0x15c22d[_0x1289('0x33')]=_0x15c22d[_0x1289('0x33')]['length']?_0x15c22d['attributes']:_0x11ddbb[_0x1289('0x2c')];if(!_0x866f12[_0x1289('0x2e')]['hasOwnProperty'](_0x1289('0x34'))){_0x15c22d[_0x1289('0x18')]=qs[_0x1289('0x18')](_0x866f12[_0x1289('0x2e')][_0x1289('0x18')]);_0x15c22d[_0x1289('0x16')]=qs['offset'](_0x866f12['query']['offset']);}_0x15c22d['order']=qs['sort'](_0x866f12[_0x1289('0x2e')]['sort']);_0x15c22d[_0x1289('0x35')]=qs[_0x1289('0x30')](_[_0x1289('0x36')](_0x866f12[_0x1289('0x2e')],_0x11ddbb[_0x1289('0x30')]),_0x3be14f);if(_0x866f12[_0x1289('0x2e')][_0x1289('0x37')]){_0x15c22d[_0x1289('0x35')]=_[_0x1289('0x38')](_0x15c22d[_0x1289('0x35')],{'$or':_[_0x1289('0x2d')](_0x3be14f,function(_0x554152){if(_0x554152[_0x1289('0x2b')]!==_0x1289('0x39')){var _0x537a59={};_0x537a59[_0x554152[_0x1289('0x25')]]={'$like':'%'+_0x866f12[_0x1289('0x2e')]['filter']+'%'};return _0x537a59;}})});}_0x15c22d=_[_0x1289('0x38')]({},_0x15c22d,_0x866f12[_0x1289('0x3a')]);var _0x5c4b83={'where':_0x15c22d[_0x1289('0x35')]};return db[_0x1289('0x28')][_0x1289('0x19')](_0x5c4b83)['then'](function(_0x49d233){_0x1496d9['count']=_0x49d233;if(_0x866f12[_0x1289('0x2e')][_0x1289('0x3b')]){_0x15c22d[_0x1289('0x3c')]=[{'all':!![]}];}return db[_0x1289('0x28')][_0x1289('0x3d')](_0x15c22d);})[_0x1289('0x1f')](function(_0x25c14e){_0x1496d9[_0x1289('0x3e')]=_0x25c14e;return _0x1496d9;})[_0x1289('0x1f')](respondWithFilteredResult(_0x58e286,_0x15c22d))['catch'](handleError(_0x58e286,null));};exports[_0x1289('0x3f')]=function(_0x40c59f,_0x5d6294){var _0x448742={'raw':!![],'where':{'id':_0x40c59f['params']['id']}},_0x54a854={};_0x54a854[_0x1289('0x2c')]=_[_0x1289('0x2f')](db[_0x1289('0x28')][_0x1289('0x29')]);_0x54a854['query']=_[_0x1289('0x2f')](_0x40c59f[_0x1289('0x2e')]);_0x54a854['filters']=_[_0x1289('0x31')](_0x54a854[_0x1289('0x2c')],_0x54a854[_0x1289('0x2e')]);_0x448742[_0x1289('0x33')]=_[_0x1289('0x31')](_0x54a854[_0x1289('0x2c')],qs['fields'](_0x40c59f[_0x1289('0x2e')][_0x1289('0x32')]));_0x448742[_0x1289('0x33')]=_0x448742['attributes'][_0x1289('0x40')]?_0x448742[_0x1289('0x33')]:_0x54a854[_0x1289('0x2c')];if(_0x40c59f[_0x1289('0x2e')][_0x1289('0x3b')]){_0x448742[_0x1289('0x3c')]=[{'all':!![]}];}_0x448742=_[_0x1289('0x38')]({},_0x448742,_0x40c59f[_0x1289('0x3a')]);return db['Variable'][_0x1289('0x41')](_0x448742)['then'](handleEntityNotFound(_0x5d6294,null))[_0x1289('0x1f')](respondWithResult(_0x5d6294,null))[_0x1289('0x42')](handleError(_0x5d6294,null));};exports[_0x1289('0x43')]=function(_0x2ff12c,_0x3c5e18){return db['Variable'][_0x1289('0x43')](_0x2ff12c['body'],{})['then'](function(_0x2847fe){var _0x33ad76=_0x2ff12c[_0x1289('0x44')][_0x1289('0x45')]({'plain':!![]});if(!_0x33ad76)throw new Error(_0x1289('0x46'));if(_0x33ad76[_0x1289('0x47')]==='user'){var _0x386f6c=_0x2847fe[_0x1289('0x45')]({'plain':!![]});var _0x1a00e4=_0x1289('0x20');return db[_0x1289('0x48')]['find']({'where':{'name':_0x1a00e4,'userProfileId':_0x33ad76['userProfileId']},'raw':!![]})[_0x1289('0x1f')](function(_0x1710e3){if(_0x1710e3&&_0x1710e3[_0x1289('0x49')]===0x0){return db[_0x1289('0x21')][_0x1289('0x43')]({'name':_0x386f6c['name'],'resourceId':_0x386f6c['id'],'type':_0x1710e3['name'],'sectionId':_0x1710e3['id']},{})[_0x1289('0x1f')](function(){return _0x2847fe;});}else{return _0x2847fe;}})[_0x1289('0x42')](function(_0x575a24){logger[_0x1289('0x23')](_0x1289('0x4a'),_0x575a24);throw _0x575a24;});}return _0x2847fe;})[_0x1289('0x1f')](respondWithResult(_0x3c5e18,0xc9))[_0x1289('0x42')](handleError(_0x3c5e18,null));};exports['update']=function(_0xa89562,_0xf7ad57){if(_0xa89562['body']['id']){delete _0xa89562['body']['id'];}return db[_0x1289('0x28')][_0x1289('0x41')]({'where':{'id':_0xa89562[_0x1289('0x4b')]['id']}})[_0x1289('0x1f')](handleEntityNotFound(_0xf7ad57,null))[_0x1289('0x1f')](saveUpdates(_0xa89562[_0x1289('0x4c')],null))[_0x1289('0x1f')](respondWithResult(_0xf7ad57,null))[_0x1289('0x42')](handleError(_0xf7ad57,null));};exports['destroy']=function(_0xd9bb45,_0x2e9957){return db['Variable']['find']({'where':{'id':_0xd9bb45[_0x1289('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e9957,null))[_0x1289('0x1f')](removeEntity(_0x2e9957,null))[_0x1289('0x42')](handleError(_0x2e9957,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a10ed5e..d17b274 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 _0xfce2=['moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','../../config/logger','api'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xfce2,0xbe));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fce('0x0'))(_0x2fce('0x1'));var moment=require(_0x2fce('0x2'));var BPromise=require(_0x2fce('0x3'));var rp=require(_0x2fce('0x4'));var fs=require('fs');var path=require(_0x2fce('0x5'));var rimraf=require(_0x2fce('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fce('0x7'));module[_0x2fce('0x8')]=function(_0x5e76ef,_0x949f3){return _0x5e76ef[_0x2fce('0x9')](_0x2fce('0xa'),attributes,{'tableName':_0x2fce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x043b=['../../config/environment','./variable.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x16b46b,_0x5e78e6){var _0xafea56=function(_0x193325){while(--_0x193325){_0x16b46b['push'](_0x16b46b['shift']());}};_0xafea56(++_0x5e78e6);}(_0x043b,0x126));var _0xb043=function(_0x5e05e7,_0x3e524f){_0x5e05e7=_0x5e05e7-0x0;var _0x8c2590=_0x043b[_0x5e05e7];return _0x8c2590;};'use strict';var _=require('lodash');var util=require(_0xb043('0x0'));var logger=require(_0xb043('0x1'))('api');var moment=require(_0xb043('0x2'));var BPromise=require(_0xb043('0x3'));var rp=require(_0xb043('0x4'));var fs=require('fs');var path=require(_0xb043('0x5'));var rimraf=require('rimraf');var config=require(_0xb043('0x6'));var attributes=require(_0xb043('0x7'));module[_0xb043('0x8')]=function(_0x31a83,_0x30e39f){return _0x31a83[_0xb043('0x9')]('Variable',attributes,{'tableName':'tools_variables','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 656ad68..2e1500e 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x5a427c,_0x1c7b6f){var _0xc17e0d=function(_0x3b82a7){while(--_0x3b82a7){_0x5a427c['push'](_0x5a427c['shift']());}};_0xc17e0d(++_0x1c7b6f);}(_0x55ca,0x126));var _0xa55c=function(_0x4dbda8,_0xbce830){_0x4dbda8=_0x4dbda8-0x0;var _0x1149ed=_0x55ca[_0x4dbda8];return _0x1149ed;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x2d7827,_0x5afb3d){var _0x2ef080=function(_0x27fd0f){while(--_0x27fd0f){_0x2d7827['push'](_0x2d7827['shift']());}};_0x2ef080(++_0x5afb3d);}(_0x55ca,0x126));var _0xa55c=function(_0x156b03,_0x238b09){_0x156b03=_0x156b03-0x0;var _0x302cc5=_0x55ca[_0x156b03];return _0x302cc5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 20fe555..7dceaae 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 _0xb64f=['reset','pull','/restart','restart','/migrations','exports','express','Router','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x16c6d7,_0x31e4a6){var _0x44d166=function(_0x242e6a){while(--_0x242e6a){_0x16c6d7['push'](_0x16c6d7['shift']());}};_0x44d166(++_0x31e4a6);}(_0xb64f,0xc9));var _0xfb64=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0xb64f[_0x204047];return _0x5956d2;};'use strict';var express=require(_0xfb64('0x0'));var router=express[_0xfb64('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xfb64('0x2')]('/',controller[_0xfb64('0x3')]);router['get'](_0xfb64('0x4'),auth[_0xfb64('0x5')](),auth[_0xfb64('0x6')](),controller[_0xfb64('0x7')]);router[_0xfb64('0x2')](_0xfb64('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfb64('0x9')]);router[_0xfb64('0x2')]('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfb64('0xa')]);router['get'](_0xfb64('0xb'),auth['isAuthenticated'](),controller[_0xfb64('0xc')]);router[_0xfb64('0x2')](_0xfb64('0xd'),controller['migrations']);module[_0xfb64('0xe')]=router; \ No newline at end of file +var _0x471b=['../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','isAuthenticated','/pull','/restart','restart','/migrations','migrations','exports','express','Router'];(function(_0x29db25,_0x457467){var _0x48b1a5=function(_0x5cb05f){while(--_0x5cb05f){_0x29db25['push'](_0x29db25['shift']());}};_0x48b1a5(++_0x457467);}(_0x471b,0x16e));var _0xb471=function(_0x6de5f0,_0x1eba5c){_0x6de5f0=_0x6de5f0-0x0;var _0x5e92e9=_0x471b[_0x6de5f0];return _0x5e92e9;};'use strict';var express=require(_0xb471('0x0'));var router=express[_0xb471('0x1')]();var auth=require(_0xb471('0x2'));var controller=require(_0xb471('0x3'));router[_0xb471('0x4')]('/',controller[_0xb471('0x5')]);router[_0xb471('0x4')](_0xb471('0x6'),auth['isAuthenticated'](),auth[_0xb471('0x7')](),controller[_0xb471('0x8')]);router[_0xb471('0x4')]('/reset',auth[_0xb471('0x9')](),auth[_0xb471('0x7')](),controller['reset']);router[_0xb471('0x4')](_0xb471('0xa'),auth[_0xb471('0x9')](),auth[_0xb471('0x7')](),controller['pull']);router[_0xb471('0x4')](_0xb471('0xb'),auth[_0xb471('0x9')](),controller[_0xb471('0xc')]);router[_0xb471('0x4')](_0xb471('0xd'),controller[_0xb471('0xe')]);module[_0xb471('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 7a2a370..fb2be7e 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 _0xdedd=['update','simple-git','root','exports','query','latest','tags','status','json','fetch','origin','master','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','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','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../config/environment','../../config/logger'];(function(_0x3ca865,_0x38555e){var _0x1cd03c=function(_0x22aeb3){while(--_0x22aeb3){_0x3ca865['push'](_0x3ca865['shift']());}};_0x1cd03c(++_0x38555e);}(_0xdedd,0x99));var _0xdded=function(_0x3815e8,_0x4c22cc){_0x3815e8=_0x3815e8-0x0;var _0x157ac2=_0xdedd[_0x3815e8];return _0x157ac2;};'use strict';var Umzug=require(_0xdded('0x0'));var path=require(_0xdded('0x1'));var fs=require('fs');var _=require(_0xdded('0x2'));var pkginfo=require(_0xdded('0x3'))(module,_0xdded('0x4'));var compareVersions=require(_0xdded('0x5'));var exec=require('child_process')[_0xdded('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xdded('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xdded('0x8'))(_0xdded('0x9'));var git=require(_0xdded('0xa'))(config[_0xdded('0xb')]);exports['index']=function(_0x59b59b,_0x13556f){var _0x518b2b={'current':module[_0xdded('0xc')][_0xdded('0x4')],'phonebar':0x2};if(_0x59b59b[_0xdded('0xd')]&&_0x59b59b[_0xdded('0xd')][_0xdded('0xe')]){return git['fetch']()[_0xdded('0xf')](function(_0x3f5a64,_0x47a249){_0x518b2b['latest']=(_0x3f5a64?module[_0xdded('0xc')][_0xdded('0x4')]:_0x47a249[_0xdded('0xe')])||'2.0.0';return _0x13556f[_0xdded('0x10')](0xc8)['json'](_0x518b2b);});}else{return _0x13556f[_0xdded('0x10')](0xc8)[_0xdded('0x11')](_0x518b2b);}};exports[_0xdded('0x12')]=function(_0x4e7d71,_0x205ae9){return git[_0xdded('0x12')]([_0xdded('0x13'),_0xdded('0x14')],function(_0x3ee3a4){if(_0x3ee3a4){logger['error'](_0x3ee3a4);return _0x205ae9[_0xdded('0x10')](0x1f4)[_0xdded('0x11')](_0x3ee3a4);}logger[_0xdded('0x15')]('git\x20fetch');return _0x205ae9[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x16')});});};exports[_0xdded('0x17')]=function(_0x5d1ccb,_0x3fc0c1){return git['reset']([_0xdded('0x18'),_0xdded('0x19')],function(_0x107ab7){if(_0x107ab7){logger[_0xdded('0x1a')](_0x107ab7);return _0x3fc0c1['status'](0x1f4)[_0xdded('0x11')](_0x107ab7);}logger[_0xdded('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3fc0c1[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x1b')});});};exports[_0xdded('0x1c')]=function(_0x2db3dc,_0x4d8969){exec(_0xdded('0x1d'),function(_0x38080a,_0x1dc1b1,_0x323973){logger['info'](_0x1dc1b1);logger[_0xdded('0x15')](_0x323973);if(_0x38080a){logger['error'](_0x38080a);return _0x4d8969['status'](0x1f4)[_0xdded('0x11')](_0x38080a);}return _0x4d8969[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0x1dc1b1});});};exports[_0xdded('0x1e')]=function(_0x270946,_0x217204){return pm2['restart'](_0xdded('0x1f'))[_0xdded('0x20')](function(_0x3cf9b8){logger[_0xdded('0x15')](_0xdded('0x21'),_0x3cf9b8);return _0x217204[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x22')});})[_0xdded('0x23')](function(_0x288bd2){logger[_0xdded('0x1a')](_0x288bd2);return _0x217204['status'](0x1f4)[_0xdded('0x11')](_0x288bd2);});};exports[_0xdded('0x24')]=function(_0x3d5c32,_0x3a97bb){var _0x140e96=fs[_0xdded('0x25')](path[_0xdded('0x26')](config[_0xdded('0xb')],_0xdded('0x27'),_0xdded('0x24')));var _0x55c242=[];for(var _0x2d14f4=0x0;_0x2d14f4<_0x140e96['length'];_0x2d14f4++){var _0x1f6c69=_0x140e96[_0x2d14f4][_0xdded('0x28')](_0xdded('0x29'),'');if(compareVersions(module[_0xdded('0xc')]['version'],_0x1f6c69)===-0x1){_0x55c242['push'](_0x1f6c69);}}if(_0x55c242['length']){var _0x1e0ca3=_0x55c242[_0xdded('0x2a')](compareVersions);var _0x544f1d=new Umzug({'storage':_0xdded('0x2b'),'storageOptions':{'model':db[_0xdded('0x2c')],'modelName':_0xdded('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xdded('0x2b')][_0xdded('0x2d')](),db[_0xdded('0x2b')][_0xdded('0x2e')],function(){throw new Error(_0xdded('0x2f'));}],'path':path['join'](config[_0xdded('0xb')],_0xdded('0x27'),_0xdded('0x24')),'pattern':/\.js$/}});_0x544f1d['up']({'migrations':_[_0xdded('0x30')](_0x1e0ca3,function(_0x1c04bc){return _0x1c04bc+_0xdded('0x29');})})[_0xdded('0x20')](function(){return _0x3a97bb['status'](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x31')+module[_0xdded('0xc')]['version']+_0xdded('0x32')+_[_0xdded('0x33')](_0x1e0ca3),'migrations':_[_0xdded('0x26')](_0x1e0ca3)});})[_0xdded('0x23')](function(_0x1cb24c){if(_0x1cb24c instanceof db[_0xdded('0x2b')][_0xdded('0x34')]){return _0x3a97bb[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x35')});}else{return _0x3a97bb[_0xdded('0x10')](0x1f4)[_0xdded('0x11')](_0x1cb24c);}});}else{return _0x3a97bb[_0xdded('0x10')](0xc8)['json']({'output':_0xdded('0x35')});}}; \ No newline at end of file +var _0x45eb=['2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','.js','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','Database\x20migrated\x20successfully\x20from\x20version\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/logger','update','simple-git','root','exports','query','tags','latest'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45eb,0xe4));var _0xb45e=function(_0x599b36,_0x449b2e){_0x599b36=_0x599b36-0x0;var _0x39c72d=_0x45eb[_0x599b36];return _0x39c72d;};'use strict';var Umzug=require(_0xb45e('0x0'));var path=require(_0xb45e('0x1'));var fs=require('fs');var _=require(_0xb45e('0x2'));var pkginfo=require(_0xb45e('0x3'))(module,_0xb45e('0x4'));var compareVersions=require(_0xb45e('0x5'));var exec=require(_0xb45e('0x6'))[_0xb45e('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0xb45e('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xb45e('0x9'))(_0xb45e('0xa'));var git=require(_0xb45e('0xb'))(config[_0xb45e('0xc')]);exports['index']=function(_0x33476d,_0x5918e7){var _0x4781c8={'current':module[_0xb45e('0xd')][_0xb45e('0x4')],'phonebar':0x2};if(_0x33476d[_0xb45e('0xe')]&&_0x33476d[_0xb45e('0xe')]['latest']){return git['fetch']()[_0xb45e('0xf')](function(_0xcdcecc,_0x16c6ac){_0x4781c8[_0xb45e('0x10')]=(_0xcdcecc?module['exports']['version']:_0x16c6ac[_0xb45e('0x10')])||_0xb45e('0x11');return _0x5918e7[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')](_0x4781c8);});}else{return _0x5918e7[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')](_0x4781c8);}};exports[_0xb45e('0x14')]=function(_0x7778b9,_0x1cc6e7){return git['fetch']([_0xb45e('0x15'),_0xb45e('0x16')],function(_0x104b0c){if(_0x104b0c){logger[_0xb45e('0x17')](_0x104b0c);return _0x1cc6e7[_0xb45e('0x12')](0x1f4)['json'](_0x104b0c);}logger[_0xb45e('0x18')](_0xb45e('0x19'));return _0x1cc6e7[_0xb45e('0x12')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xb45e('0x1a')]=function(_0x2b57e7,_0x4c6e01){return git['reset'](['--hard',_0xb45e('0x1b')],function(_0x2acf69){if(_0x2acf69){logger['error'](_0x2acf69);return _0x4c6e01[_0xb45e('0x12')](0x1f4)[_0xb45e('0x13')](_0x2acf69);}logger[_0xb45e('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4c6e01[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')]({'output':_0xb45e('0x1c')});});};exports[_0xb45e('0x1d')]=function(_0x2240cf,_0x32939b){exec(_0xb45e('0x1e'),function(_0x48c22b,_0x371e43,_0x3a02e3){logger[_0xb45e('0x18')](_0x371e43);logger[_0xb45e('0x18')](_0x3a02e3);if(_0x48c22b){logger[_0xb45e('0x17')](_0x48c22b);return _0x32939b[_0xb45e('0x12')](0x1f4)[_0xb45e('0x13')](_0x48c22b);}return _0x32939b['status'](0xc8)[_0xb45e('0x13')]({'output':_0x371e43});});};exports[_0xb45e('0x1f')]=function(_0x40e9a2,_0x13f7fa){return pm2['restart']('motion2')[_0xb45e('0x20')](function(_0x96e4aa){logger[_0xb45e('0x18')]('pm2\x20restart\x20motion\x20%s',_0x96e4aa);return _0x13f7fa[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')]({'output':_0xb45e('0x21')});})['catch'](function(_0x300003){logger[_0xb45e('0x17')](_0x300003);return _0x13f7fa[_0xb45e('0x12')](0x1f4)[_0xb45e('0x13')](_0x300003);});};exports[_0xb45e('0x22')]=function(_0x2c4858,_0x5cfde4){var _0x214dc7=fs['readdirSync'](path[_0xb45e('0x23')](config[_0xb45e('0xc')],_0xb45e('0x24'),_0xb45e('0x22')));var _0x2cffc5=[];for(var _0xaf1292=0x0;_0xaf1292<_0x214dc7[_0xb45e('0x25')];_0xaf1292++){var _0x23311a=_0x214dc7[_0xaf1292]['replace'](_0xb45e('0x26'),'');if(compareVersions(module[_0xb45e('0xd')][_0xb45e('0x4')],_0x23311a)===-0x1){_0x2cffc5['push'](_0x23311a);}}if(_0x2cffc5[_0xb45e('0x25')]){var _0x50fd30=_0x2cffc5['sort'](compareVersions);var _0x1bc3e2=new Umzug({'storage':_0xb45e('0x27'),'storageOptions':{'model':db[_0xb45e('0x28')],'modelName':_0xb45e('0x28'),'columnName':'version'},'migrations':{'params':[db[_0xb45e('0x27')][_0xb45e('0x29')](),db['sequelize'][_0xb45e('0x2a')],function(){throw new Error(_0xb45e('0x2b'));}],'path':path[_0xb45e('0x23')](config[_0xb45e('0xc')],'server',_0xb45e('0x22')),'pattern':/\.js$/}});_0x1bc3e2['up']({'migrations':_[_0xb45e('0x2c')](_0x50fd30,function(_0x4b3f5a){return _0x4b3f5a+'.js';})})[_0xb45e('0x20')](function(){return _0x5cfde4[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')]({'output':_0xb45e('0x2d')+module[_0xb45e('0xd')][_0xb45e('0x4')]+'\x20to\x20'+_['last'](_0x50fd30),'migrations':_[_0xb45e('0x23')](_0x50fd30)});})[_0xb45e('0x2e')](function(_0x460afc){if(_0x460afc instanceof db['sequelize'][_0xb45e('0x2f')]){return _0x5cfde4[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')]({'output':_0xb45e('0x30')});}else{return _0x5cfde4[_0xb45e('0x12')](0x1f4)[_0xb45e('0x13')](_0x460afc);}});}else{return _0x5cfde4[_0xb45e('0x12')](0xc8)[_0xb45e('0x13')]({'output':_0xb45e('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9615789..3b9c810 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 _0xf802=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x357bef,_0x9d6d9e){var _0x28e822=function(_0x152f53){while(--_0x152f53){_0x357bef['push'](_0x357bef['shift']());}};_0x28e822(++_0x9d6d9e);}(_0xf802,0x185));var _0x2f80=function(_0x495cf1,_0x361bc8){_0x495cf1=_0x495cf1-0x0;var _0xc77dbd=_0xf802[_0x495cf1];return _0xc77dbd;};'use strict';var multer=require(_0x2f80('0x0'));var util=require(_0x2f80('0x1'));var path=require(_0x2f80('0x2'));var timeout=require(_0x2f80('0x3'));var express=require('express');var router=express[_0x2f80('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f80('0x5'));var controller=require(_0x2f80('0x6'));router[_0x2f80('0x7')]('/',auth[_0x2f80('0x8')](),controller[_0x2f80('0x9')]);router[_0x2f80('0x7')](_0x2f80('0xa'),auth['isAuthenticated'](),controller[_0x2f80('0xb')]);router[_0x2f80('0x7')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0xd')]);router[_0x2f80('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f80('0xf')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0x10')]);router[_0x2f80('0x11')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0x12')]);module[_0x2f80('0x13')]=router; \ No newline at end of file +var _0x2e87=['describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3b0dfb,_0x206a42){var _0x4f1606=function(_0x12bb2f){while(--_0x12bb2f){_0x3b0dfb['push'](_0x3b0dfb['shift']());}};_0x4f1606(++_0x206a42);}(_0x2e87,0x171));var _0x72e8=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x2e87[_0x3fa7d3];return _0x4c51bd;};'use strict';var multer=require(_0x72e8('0x0'));var util=require('util');var path=require(_0x72e8('0x1'));var timeout=require(_0x72e8('0x2'));var express=require(_0x72e8('0x3'));var router=express[_0x72e8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x72e8('0x5'));var config=require(_0x72e8('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x72e8('0x7')]('/',auth[_0x72e8('0x8')](),controller[_0x72e8('0x9')]);router['get'](_0x72e8('0xa'),auth['isAuthenticated'](),controller[_0x72e8('0xb')]);router[_0x72e8('0x7')](_0x72e8('0xc'),auth[_0x72e8('0x8')](),controller['show']);router[_0x72e8('0xd')]('/',auth[_0x72e8('0x8')](),controller[_0x72e8('0xe')]);router[_0x72e8('0xf')](_0x72e8('0xc'),auth[_0x72e8('0x8')](),controller[_0x72e8('0x10')]);router[_0x72e8('0x11')](_0x72e8('0xc'),auth[_0x72e8('0x8')](),controller['destroy']);module[_0x72e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 29d4ed7..230dfea 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 _0x34b7=['INTEGER','BOOLEAN','STRING','DATE'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x34b7,0x196));var _0x734b=function(_0x30f2d1,_0x5710ac){_0x30f2d1=_0x30f2d1-0x0;var _0x44605d=_0x34b7[_0x30f2d1];return _0x44605d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x734b('0x0')]},'uniqueid':{'type':Sequelize[_0x734b('0x0')]},'calleridnum':{'type':Sequelize[_0x734b('0x0')]},'calleridname':{'type':Sequelize[_0x734b('0x0')]},'queue':{'type':Sequelize[_0x734b('0x0')]},'interface':{'type':Sequelize[_0x734b('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x734b('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x734b('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x734b('0x1')]},'agentdumpAt':{'type':Sequelize[_0x734b('0x1')]},'holdtime':{'type':Sequelize[_0x734b('0x2')]},'agentcomplete':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x734b('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x734b('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x734b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x734b('0x0')]},'connectedlinenum':{'type':Sequelize[_0x734b('0x0')]},'connectedlinename':{'type':Sequelize[_0x734b('0x0')]},'language':{'type':Sequelize[_0x734b('0x0')]},'accountcode':{'type':Sequelize[_0x734b('0x0')]},'context':{'type':Sequelize[_0x734b('0x0')]},'exten':{'type':Sequelize[_0x734b('0x0')]},'priority':{'type':Sequelize[_0x734b('0x0')]},'destchannel':{'type':Sequelize[_0x734b('0x0')]},'destchannelstate':{'type':Sequelize[_0x734b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x734b('0x0')]},'destcalleridnum':{'type':Sequelize[_0x734b('0x0')]},'destcalleridname':{'type':Sequelize[_0x734b('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x734b('0x0')]},'destlanguage':{'type':Sequelize[_0x734b('0x0')]},'destaccountcode':{'type':Sequelize[_0x734b('0x0')]},'destcontext':{'type':Sequelize[_0x734b('0x0')]},'destexten':{'type':Sequelize[_0x734b('0x0')]},'destpriority':{'type':Sequelize[_0x734b('0x0')]},'destuniqueid':{'type':Sequelize[_0x734b('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x734b('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x734b('0x0')]},'transfer':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x734b('0x0')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x734b('0x0')]},'transferuniqueid':{'type':Sequelize[_0x734b('0x0')]},'agententerreason':{'type':Sequelize[_0x734b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8cb=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xb8cb,0xd9));var _0xbb8c=function(_0xcbdb51,_0x286e7f){_0xcbdb51=_0xcbdb51-0x0;var _0x4113f4=_0xb8cb[_0xcbdb51];return _0x4113f4;};'use strict';var Sequelize=require(_0xbb8c('0x0'));module[_0xbb8c('0x1')]={'type':{'type':Sequelize[_0xbb8c('0x2')]},'uniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'calleridnum':{'type':Sequelize[_0xbb8c('0x2')]},'calleridname':{'type':Sequelize[_0xbb8c('0x2')]},'queue':{'type':Sequelize[_0xbb8c('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbb8c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbb8c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xbb8c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbb8c('0x3')]},'holdtime':{'type':Sequelize[_0xbb8c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbb8c('0x4')]},'agentacw':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbb8c('0x4')]},'reason':{'type':Sequelize[_0xbb8c('0x2')]},'lastevent':{'type':Sequelize[_0xbb8c('0x2')]},'channel':{'type':Sequelize[_0xbb8c('0x2')]},'channelstate':{'type':Sequelize[_0xbb8c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xbb8c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbb8c('0x2')]},'connectedlinename':{'type':Sequelize[_0xbb8c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbb8c('0x2')]},'context':{'type':Sequelize[_0xbb8c('0x2')]},'exten':{'type':Sequelize[_0xbb8c('0x2')]},'priority':{'type':Sequelize[_0xbb8c('0x2')]},'destchannel':{'type':Sequelize[_0xbb8c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbb8c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbb8c('0x2')]},'destcalleridname':{'type':Sequelize[_0xbb8c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbb8c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbb8c('0x2')]},'destlanguage':{'type':Sequelize[_0xbb8c('0x2')]},'destaccountcode':{'type':Sequelize[_0xbb8c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbb8c('0x2')]},'destpriority':{'type':Sequelize[_0xbb8c('0x2')]},'destuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbb8c('0x2')]},'transfer':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbb8c('0x2')],'comment':_0xbb8c('0x6')},'transferexten':{'type':Sequelize[_0xbb8c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a1e995d..30313eb 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(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 1bca53e..dc54b84 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 _0x9957=['rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7995('0xc'),_0x7995('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x58b8a3,_0x141140){var _0x318854=function(_0x46063a){while(--_0x46063a){_0x58b8a3['push'](_0x58b8a3['shift']());}};_0x318854(++_0x141140);}(_0x6f47,0xc7));var _0x76f4=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x6f47[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x76f4('0xa'),_0x76f4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cce821a..cc8db03 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 _0x0c36=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1722bf,_0x2fa7f4){var _0x58c607=function(_0x4b13f5){while(--_0x4b13f5){_0x1722bf['push'](_0x1722bf['shift']());}};_0x58c607(++_0x2fa7f4);}(_0x0c36,0x162));var _0x60c3=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x0c36[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0x60c3('0x0'));var util=require(_0x60c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60c3('0x2'));var fs=require('fs');var Redis=require(_0x60c3('0x3'));var db=require(_0x60c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x60c3('0x5'));var jayson=require(_0x60c3('0x6'));var client=jayson[_0x60c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0054,_0x17b293,_0x51239a){return new BPromise(function(_0x1ce18d,_0x45bf9c){return client[_0x60c3('0x8')](_0x5f0054,_0x51239a)[_0x60c3('0x9')](function(_0x284776){logger[_0x60c3('0xa')](_0x60c3('0xb'),_0x17b293,_0x60c3('0xc'));logger[_0x60c3('0xd')](_0x60c3('0xe'),_0x17b293,_0x60c3('0xc'),JSON['stringify'](_0x284776));if(_0x284776[_0x60c3('0xf')]){if(_0x284776[_0x60c3('0xf')]['code']===0x1f4){logger[_0x60c3('0xf')](_0x60c3('0xb'),_0x17b293,_0x284776[_0x60c3('0xf')]['message']);return _0x45bf9c(_0x284776['error'][_0x60c3('0x10')]);}logger[_0x60c3('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x17b293,_0x284776[_0x60c3('0xf')]['message']);return _0x1ce18d(_0x284776[_0x60c3('0xf')][_0x60c3('0x10')]);}else{logger[_0x60c3('0xa')](_0x60c3('0xb'),_0x17b293,_0x60c3('0xc'));_0x1ce18d(_0x284776[_0x60c3('0x11')][_0x60c3('0x10')]);}})[_0x60c3('0x12')](function(_0x3d0143){logger['error'](_0x60c3('0xb'),_0x17b293,_0x3d0143);_0x45bf9c(_0x3d0143);});});}exports[_0x60c3('0x13')]=function(_0x1ddb66){var _0x2fff94=this;return new Promise(function(_0x57ce97,_0x3c2bef){return db[_0x60c3('0x14')][_0x60c3('0x15')](_0x1ddb66[_0x60c3('0x16')],{'raw':_0x1ddb66[_0x60c3('0x17')]?_0x1ddb66[_0x60c3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x60c3('0x9')](function(_0x4c06de){logger[_0x60c3('0xa')]('CreateVoiceAgentReport',_0x1ddb66);logger[_0x60c3('0xd')](_0x60c3('0x13'),_0x1ddb66,JSON[_0x60c3('0x18')](_0x4c06de));_0x57ce97(_0x4c06de);})['catch'](function(_0x56338f){logger[_0x60c3('0xf')](_0x60c3('0x13'),_0x56338f['message'],_0x1ddb66);_0x3c2bef(_0x2fff94['error'](0x1f4,_0x56338f[_0x60c3('0x10')]));});});};exports[_0x60c3('0x19')]=function(_0x33fe7a){var _0x6e849b=this;return new Promise(function(_0x59c4ce,_0x4195ae){return db[_0x60c3('0x14')][_0x60c3('0x1a')](_0x33fe7a[_0x60c3('0x16')],{'raw':_0x33fe7a['options']?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fe7a[_0x60c3('0x17')]?_0x33fe7a['options'][_0x60c3('0x1c')]||null:null,'attributes':_0x33fe7a['options']?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1d')]||null:null,'limit':_0x33fe7a[_0x60c3('0x17')]?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1e')]||null:null})[_0x60c3('0x9')](function(_0xc5ed2c){logger[_0x60c3('0xa')]('UpdateVoiceAgentReport',_0x33fe7a);logger[_0x60c3('0xd')](_0x60c3('0x19'),_0x33fe7a,JSON[_0x60c3('0x18')](_0xc5ed2c));_0x59c4ce(_0xc5ed2c);})['catch'](function(_0x468975){logger[_0x60c3('0xf')](_0x60c3('0x19'),_0x468975[_0x60c3('0x10')],_0x33fe7a);_0x4195ae(_0x6e849b[_0x60c3('0xf')](0x1f4,_0x468975[_0x60c3('0x10')]));});});}; \ No newline at end of file +var _0x5b81=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','catch','UpdateVoiceAgentReport','raw'];(function(_0x2d580b,_0x2b11f3){var _0x7c1374=function(_0x4c1a85){while(--_0x4c1a85){_0x2d580b['push'](_0x2d580b['shift']());}};_0x7c1374(++_0x2b11f3);}(_0x5b81,0x18f));var _0x15b8=function(_0x38ec97,_0x1040c9){_0x38ec97=_0x38ec97-0x0;var _0x35e008=_0x5b81[_0x38ec97];return _0x35e008;};'use strict';var _=require(_0x15b8('0x0'));var util=require(_0x15b8('0x1'));var moment=require(_0x15b8('0x2'));var BPromise=require(_0x15b8('0x3'));var rs=require(_0x15b8('0x4'));var fs=require('fs');var Redis=require(_0x15b8('0x5'));var db=require(_0x15b8('0x6'))['db'];var utils=require(_0x15b8('0x7'));var logger=require(_0x15b8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15b8('0x9'));var client=jayson[_0x15b8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bec1a,_0x306c70,_0x470bf0){return new BPromise(function(_0x2d4f41,_0x3b1646){return client[_0x15b8('0xb')](_0x1bec1a,_0x470bf0)[_0x15b8('0xc')](function(_0xed06db){logger[_0x15b8('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x306c70,_0x15b8('0xe'));logger[_0x15b8('0xf')](_0x15b8('0x10'),_0x306c70,_0x15b8('0xe'),JSON[_0x15b8('0x11')](_0xed06db));if(_0xed06db[_0x15b8('0x12')]){if(_0xed06db['error'][_0x15b8('0x13')]===0x1f4){logger[_0x15b8('0x12')](_0x15b8('0x14'),_0x306c70,_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);return _0x3b1646(_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x306c70,_0xed06db[_0x15b8('0x12')]['message']);return _0x2d4f41(_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);}else{logger[_0x15b8('0xd')](_0x15b8('0x14'),_0x306c70,_0x15b8('0xe'));_0x2d4f41(_0xed06db['result'][_0x15b8('0x15')]);}})['catch'](function(_0x27d520){logger['error'](_0x15b8('0x14'),_0x306c70,_0x27d520);_0x3b1646(_0x27d520);});});}exports[_0x15b8('0x16')]=function(_0x262361){var _0x4f537f=this;return new Promise(function(_0x4830ab,_0x209173){return db[_0x15b8('0x17')][_0x15b8('0x18')](_0x262361[_0x15b8('0x19')],{'raw':_0x262361[_0x15b8('0x1a')]?_0x262361[_0x15b8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x15b8('0xc')](function(_0x55686b){logger[_0x15b8('0xd')]('CreateVoiceAgentReport',_0x262361);logger[_0x15b8('0xf')]('CreateVoiceAgentReport',_0x262361,JSON[_0x15b8('0x11')](_0x55686b));_0x4830ab(_0x55686b);})[_0x15b8('0x1b')](function(_0x345f79){logger[_0x15b8('0x12')](_0x15b8('0x16'),_0x345f79[_0x15b8('0x15')],_0x262361);_0x209173(_0x4f537f[_0x15b8('0x12')](0x1f4,_0x345f79[_0x15b8('0x15')]));});});};exports[_0x15b8('0x1c')]=function(_0x426d9c){var _0x23f7ad=this;return new Promise(function(_0x49857b,_0x286837){return db[_0x15b8('0x17')]['update'](_0x426d9c[_0x15b8('0x19')],{'raw':_0x426d9c['options']?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1e')]||null:null,'attributes':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1f')]||null:null,'limit':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x20')]||null:null})[_0x15b8('0xc')](function(_0x14646f){logger[_0x15b8('0xd')](_0x15b8('0x1c'),_0x426d9c);logger[_0x15b8('0xf')](_0x15b8('0x1c'),_0x426d9c,JSON[_0x15b8('0x11')](_0x14646f));_0x49857b(_0x14646f);})['catch'](function(_0x33e55c){logger['error'](_0x15b8('0x1c'),_0x33e55c[_0x15b8('0x15')],_0x426d9c);_0x286837(_0x23f7ad['error'](0x1f4,_0x33e55c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6210ffa..11c3dcd 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 _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x3243ca,_0x47c495){var _0x3b74e7=function(_0x3f147b){while(--_0x3f147b){_0x3243ca['push'](_0x3243ca['shift']());}};_0x3b74e7(++_0x47c495);}(_0x98a8,0x12c));var _0x898a=function(_0x397fcf,_0x5ab4fe){_0x397fcf=_0x397fcf-0x0;var _0x33b24c=_0x98a8[_0x397fcf];return _0x33b24c;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('0x13')]=router; \ No newline at end of file +var _0xcca7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0xb43d1b,_0x3935cf){var _0x4aafca=function(_0x3b26d2){while(--_0x3b26d2){_0xb43d1b['push'](_0xb43d1b['shift']());}};_0x4aafca(++_0x3935cf);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1c45f1,_0x191a36){_0x1c45f1=_0x1c45f1-0x0;var _0x1387e7=_0xcca7[_0x1c45f1];return _0x1387e7;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xa')]);router['get']('/describe',auth[_0x7cca('0x9')](),controller[_0x7cca('0xb')]);router[_0x7cca('0x8')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xd')]);router[_0x7cca('0xe')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xf')]);router[_0x7cca('0x10')]('/:id',auth[_0x7cca('0x9')](),controller[_0x7cca('0x11')]);router[_0x7cca('0x12')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller['destroy']);module[_0x7cca('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 30ae2d5..9d81e81 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 _0x7df3=['sequelize','exports','ENUM','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x2283a9,_0x4e2e63){var _0x3cbc8c=function(_0x282ab5){while(--_0x282ab5){_0x2283a9['push'](_0x2283a9['shift']());}};_0x3cbc8c(++_0x4e2e63);}(_0x7df3,0x1cc));var _0x37df=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7df3[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x37df('0x2')]('inbound',_0x37df('0x3'),'outbound',_0x37df('0x4'),'outbound-fax',_0x37df('0x5'))},'tag':{'type':Sequelize[_0x37df('0x6')]},'accountcode':{'type':Sequelize[_0x37df('0x6')]},'source':{'type':Sequelize[_0x37df('0x6')]},'destination':{'type':Sequelize[_0x37df('0x6')]},'destinationcontext':{'type':Sequelize[_0x37df('0x6')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x37df('0x6')]},'lastdata':{'type':Sequelize[_0x37df('0x7')]},'starttime':{'type':Sequelize[_0x37df('0x8')]},'systemanswertime':{'type':Sequelize[_0x37df('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x37df('0x8')]},'duration':{'type':Sequelize[_0x37df('0x9')]},'billableseconds':{'type':Sequelize[_0x37df('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x37df('0x6')]},'amaflags':{'type':Sequelize[_0x37df('0x6')]},'userfield':{'type':Sequelize[_0x37df('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x37df('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x37df('0x6')]},'note':{'type':Sequelize[_0x37df('0x6')]},'prefix':{'type':Sequelize[_0x37df('0x6')]},'routeid':{'type':Sequelize[_0x37df('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6216=['INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x3bfca5,_0x3167d9){var _0x5c750b=function(_0x58f062){while(--_0x58f062){_0x3bfca5['push'](_0x3bfca5['shift']());}};_0x5c750b(++_0x3167d9);}(_0x6216,0x90));var _0x6621=function(_0x5b258e,_0x4e4366){_0x5b258e=_0x5b258e-0x0;var _0x3d3d75=_0x6216[_0x5b258e];return _0x3d3d75;};'use strict';var Sequelize=require(_0x6621('0x0'));module[_0x6621('0x1')]={'uniqueid':{'type':Sequelize[_0x6621('0x2')]},'type':{'type':Sequelize[_0x6621('0x3')](_0x6621('0x4'),_0x6621('0x5'),_0x6621('0x6'),_0x6621('0x7'),_0x6621('0x8'),_0x6621('0x9'))},'tag':{'type':Sequelize[_0x6621('0x2')]},'accountcode':{'type':Sequelize[_0x6621('0x2')]},'source':{'type':Sequelize[_0x6621('0x2')]},'destination':{'type':Sequelize[_0x6621('0x2')]},'destinationcontext':{'type':Sequelize[_0x6621('0x2')]},'callerid':{'type':Sequelize[_0x6621('0x2')]},'channel':{'type':Sequelize[_0x6621('0x2')]},'destinationchannel':{'type':Sequelize[_0x6621('0x2')]},'lastapplication':{'type':Sequelize[_0x6621('0x2')]},'lastdata':{'type':Sequelize[_0x6621('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x6621('0xb')]},'answertime':{'type':Sequelize[_0x6621('0xb')]},'endtime':{'type':Sequelize[_0x6621('0xb')]},'duration':{'type':Sequelize[_0x6621('0xc')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6621('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x6621('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6621('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6621('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6621('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c7232c4..9d1bdfe 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39e8df,_0x5890ce){_0x39e8df=_0x39e8df-0x0;var _0xe14d45=_0x5f2f[_0x39e8df];return _0xe14d45;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x2ef3,0xba));var _0x32ef=function(_0x8af750,_0x51d27a){_0x8af750=_0x8af750-0x0;var _0x4477af=_0x2ef3[_0x8af750];return _0x4477af;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3eefdef..efd4474 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 _0xbec5=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xbec5,0xe5));var _0x5bec=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xbec5[_0x1bc0ae];return _0x501104;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[{'fields':[_0x5bec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c83=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceCallReport','report_call','lodash','util'];(function(_0x5648e5,_0x157357){var _0x1ed2e1=function(_0x5dc3d0){while(--_0x5dc3d0){_0x5648e5['push'](_0x5648e5['shift']());}};_0x1ed2e1(++_0x157357);}(_0x2c83,0x15a));var _0x32c8=function(_0x5364f8,_0x2128b3){_0x5364f8=_0x5364f8-0x0;var _0x14caaa=_0x2c83[_0x5364f8];return _0x14caaa;};'use strict';var _=require(_0x32c8('0x0'));var util=require(_0x32c8('0x1'));var logger=require(_0x32c8('0x2'))('api');var moment=require(_0x32c8('0x3'));var BPromise=require(_0x32c8('0x4'));var rp=require(_0x32c8('0x5'));var fs=require('fs');var path=require(_0x32c8('0x6'));var rimraf=require('rimraf');var config=require(_0x32c8('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x32c8('0x8')]=function(_0x25bbb8,_0x72e38c){return _0x25bbb8[_0x32c8('0x9')](_0x32c8('0xa'),attributes,{'tableName':_0x32c8('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index dd3da3f..5502927 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 _0x238d=['model','then','GetVoiceCallReport','CreateVoiceCallReport','catch','body','UpdateVoiceCallReport','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','VoiceCallReport','options','raw','where','attributes','limit','include','map'];(function(_0x20fa66,_0xc3ac7f){var _0x462bab=function(_0x573fc2){while(--_0x573fc2){_0x20fa66['push'](_0x20fa66['shift']());}};_0x462bab(++_0xc3ac7f);}(_0x238d,0x17a));var _0xd238=function(_0x5035c1,_0x1325fc){_0x5035c1=_0x5035c1-0x0;var _0x1b12e9=_0x238d[_0x5035c1];return _0x1b12e9;};'use strict';var _=require(_0xd238('0x0'));var util=require('util');var moment=require(_0xd238('0x1'));var BPromise=require(_0xd238('0x2'));var rs=require(_0xd238('0x3'));var fs=require('fs');var Redis=require(_0xd238('0x4'));var db=require(_0xd238('0x5'))['db'];var utils=require(_0xd238('0x6'));var logger=require(_0xd238('0x7'))(_0xd238('0x8'));var config=require(_0xd238('0x9'));var jayson=require(_0xd238('0xa'));var client=jayson[_0xd238('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ec98,_0x5e7730,_0x579dff){return new BPromise(function(_0x42d61a,_0x42ecc0){return client[_0xd238('0xc')](_0x29ec98,_0x579dff)['then'](function(_0x52a8e7){logger['info'](_0xd238('0xd'),_0x5e7730,'request\x20sent');logger[_0xd238('0xe')](_0xd238('0xf'),_0x5e7730,'request\x20sent',JSON['stringify'](_0x52a8e7));if(_0x52a8e7[_0xd238('0x10')]){if(_0x52a8e7[_0xd238('0x10')]['code']===0x1f4){logger[_0xd238('0x10')](_0xd238('0xd'),_0x5e7730,_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);return _0x42ecc0(_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);}logger[_0xd238('0x10')](_0xd238('0xd'),_0x5e7730,_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);return _0x42d61a(_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);}else{logger[_0xd238('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5e7730,_0xd238('0x13'));_0x42d61a(_0x52a8e7[_0xd238('0x14')][_0xd238('0x11')]);}})['catch'](function(_0x2bd725){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5e7730,_0x2bd725);_0x42ecc0(_0x2bd725);});});}exports['GetVoiceCallReport']=function(_0x4daceb){var _0x4792ac=this;return new Promise(function(_0x536af5,_0x56ed0c){return db[_0xd238('0x15')]['findAll']({'raw':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x17')]===undefined?!![]:![]:!![],'where':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x18')]||null:null,'attributes':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x19')]||null:null,'limit':_0x4daceb['options']?_0x4daceb['options'][_0xd238('0x1a')]||null:null,'include':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x1b')]?_[_0xd238('0x1c')](_0x4daceb['options'][_0xd238('0x1b')],function(_0x57b23f){return{'model':db[_0x57b23f[_0xd238('0x1d')]],'as':_0x57b23f['as'],'attributes':_0x57b23f[_0xd238('0x19')],'include':_0x57b23f['include']?_[_0xd238('0x1c')](_0x57b23f[_0xd238('0x1b')],function(_0x411641){return{'model':db[_0x411641[_0xd238('0x1d')]],'as':_0x411641['as'],'attributes':_0x411641[_0xd238('0x19')],'include':_0x411641[_0xd238('0x1b')]?_[_0xd238('0x1c')](_0x411641[_0xd238('0x1b')],function(_0x1ccaae){return{'model':db[_0x1ccaae[_0xd238('0x1d')]],'as':_0x1ccaae['as'],'attributes':_0x1ccaae['attributes']};}):[]};}):[]};}):[]:[]})[_0xd238('0x1e')](function(_0x48a7f5){logger[_0xd238('0x12')]('GetVoiceCallReport',_0x4daceb);logger['debug'](_0xd238('0x1f'),_0x4daceb,JSON['stringify'](_0x48a7f5));_0x536af5(_0x48a7f5);})['catch'](function(_0xfa99e0){logger[_0xd238('0x10')](_0xd238('0x1f'),_0xfa99e0[_0xd238('0x11')],_0x4daceb);_0x56ed0c(_0x4792ac[_0xd238('0x10')](0x1f4,_0xfa99e0[_0xd238('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x101bab){var _0x5b8876=this;return new Promise(function(_0x27826b,_0x185214){return db[_0xd238('0x15')]['create'](_0x101bab['body'],{'raw':_0x101bab[_0xd238('0x16')]?_0x101bab['options'][_0xd238('0x17')]===undefined?!![]:![]:!![]})[_0xd238('0x1e')](function(_0x2a6039){logger[_0xd238('0x12')](_0xd238('0x20'),_0x101bab);logger['debug'](_0xd238('0x20'),_0x101bab,JSON['stringify'](_0x2a6039));_0x27826b(_0x2a6039);})[_0xd238('0x21')](function(_0x33245c){logger[_0xd238('0x10')]('CreateVoiceCallReport',_0x33245c['message'],_0x101bab);_0x185214(_0x5b8876['error'](0x1f4,_0x33245c['message']));});});};exports['UpdateVoiceCallReport']=function(_0x500dfc){var _0x1c4aef=this;return new Promise(function(_0x119926,_0x1adbc2){return db[_0xd238('0x15')]['update'](_0x500dfc[_0xd238('0x22')],{'raw':_0x500dfc[_0xd238('0x16')]?_0x500dfc['options'][_0xd238('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')][_0xd238('0x18')]||null:null,'attributes':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')]['attributes']||null:null,'limit':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')][_0xd238('0x1a')]||null:null})[_0xd238('0x1e')](function(_0x1f30aa){logger[_0xd238('0x12')](_0xd238('0x23'),_0x500dfc);logger[_0xd238('0xe')](_0xd238('0x23'),_0x500dfc,JSON[_0xd238('0x24')](_0x1f30aa));_0x119926(_0x1f30aa);})[_0xd238('0x21')](function(_0x3e34f8){logger[_0xd238('0x10')](_0xd238('0x23'),_0x3e34f8[_0xd238('0x11')],_0x500dfc);_0x1adbc2(_0x1c4aef['error'](0x1f4,_0x3e34f8[_0xd238('0x11')]));});});}; \ No newline at end of file +var _0x1fd5=['CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','attributes','limit','include','model','map','catch','create','body'];(function(_0xccd216,_0x1e7ee3){var _0x3f79c2=function(_0x37e9a9){while(--_0x37e9a9){_0xccd216['push'](_0xccd216['shift']());}};_0x3f79c2(++_0x1e7ee3);}(_0x1fd5,0xe1));var _0x51fd=function(_0x29a7be,_0x4fb65c){_0x29a7be=_0x29a7be-0x0;var _0x44140d=_0x1fd5[_0x29a7be];return _0x44140d;};'use strict';var _=require(_0x51fd('0x0'));var util=require(_0x51fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51fd('0x2'));var db=require(_0x51fd('0x3'))['db'];var utils=require(_0x51fd('0x4'));var logger=require(_0x51fd('0x5'))(_0x51fd('0x6'));var config=require(_0x51fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x51fd('0x8')][_0x51fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38d087,_0x110378,_0x5782cd){return new BPromise(function(_0x3f1159,_0x547421){return client[_0x51fd('0xa')](_0x38d087,_0x5782cd)[_0x51fd('0xb')](function(_0x4cf174){logger[_0x51fd('0xc')](_0x51fd('0xd'),_0x110378,'request\x20sent');logger[_0x51fd('0xe')](_0x51fd('0xf'),_0x110378,'request\x20sent',JSON[_0x51fd('0x10')](_0x4cf174));if(_0x4cf174['error']){if(_0x4cf174['error'][_0x51fd('0x11')]===0x1f4){logger['error'](_0x51fd('0xd'),_0x110378,_0x4cf174['error'][_0x51fd('0x12')]);return _0x547421(_0x4cf174[_0x51fd('0x13')][_0x51fd('0x12')]);}logger[_0x51fd('0x13')](_0x51fd('0xd'),_0x110378,_0x4cf174[_0x51fd('0x13')][_0x51fd('0x12')]);return _0x3f1159(_0x4cf174[_0x51fd('0x13')][_0x51fd('0x12')]);}else{logger[_0x51fd('0xc')](_0x51fd('0xd'),_0x110378,'request\x20sent');_0x3f1159(_0x4cf174['result']['message']);}})['catch'](function(_0x13d426){logger[_0x51fd('0x13')](_0x51fd('0xd'),_0x110378,_0x13d426);_0x547421(_0x13d426);});});}exports[_0x51fd('0x14')]=function(_0x54bfdf){var _0x51d92e=this;return new Promise(function(_0x4e3900,_0x3bffa6){return db[_0x51fd('0x15')][_0x51fd('0x16')]({'raw':_0x54bfdf['options']?_0x54bfdf['options'][_0x51fd('0x17')]===undefined?!![]:![]:!![],'where':_0x54bfdf[_0x51fd('0x18')]?_0x54bfdf[_0x51fd('0x18')][_0x51fd('0x19')]||null:null,'attributes':_0x54bfdf['options']?_0x54bfdf[_0x51fd('0x18')][_0x51fd('0x1a')]||null:null,'limit':_0x54bfdf[_0x51fd('0x18')]?_0x54bfdf[_0x51fd('0x18')][_0x51fd('0x1b')]||null:null,'include':_0x54bfdf['options']?_0x54bfdf['options']['include']?_['map'](_0x54bfdf[_0x51fd('0x18')][_0x51fd('0x1c')],function(_0x537067){return{'model':db[_0x537067[_0x51fd('0x1d')]],'as':_0x537067['as'],'attributes':_0x537067[_0x51fd('0x1a')],'include':_0x537067[_0x51fd('0x1c')]?_[_0x51fd('0x1e')](_0x537067[_0x51fd('0x1c')],function(_0x2f4164){return{'model':db[_0x2f4164[_0x51fd('0x1d')]],'as':_0x2f4164['as'],'attributes':_0x2f4164[_0x51fd('0x1a')],'include':_0x2f4164['include']?_[_0x51fd('0x1e')](_0x2f4164['include'],function(_0x488618){return{'model':db[_0x488618['model']],'as':_0x488618['as'],'attributes':_0x488618[_0x51fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x51fd('0xb')](function(_0x431a99){logger[_0x51fd('0xc')](_0x51fd('0x14'),_0x54bfdf);logger[_0x51fd('0xe')]('GetVoiceCallReport',_0x54bfdf,JSON['stringify'](_0x431a99));_0x4e3900(_0x431a99);})[_0x51fd('0x1f')](function(_0x37504d){logger[_0x51fd('0x13')](_0x51fd('0x14'),_0x37504d[_0x51fd('0x12')],_0x54bfdf);_0x3bffa6(_0x51d92e[_0x51fd('0x13')](0x1f4,_0x37504d[_0x51fd('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x9fb145){var _0x46c051=this;return new Promise(function(_0x33167a,_0x38165b){return db['VoiceCallReport'][_0x51fd('0x20')](_0x9fb145[_0x51fd('0x21')],{'raw':_0x9fb145['options']?_0x9fb145[_0x51fd('0x18')][_0x51fd('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4d8b4e){logger[_0x51fd('0xc')](_0x51fd('0x22'),_0x9fb145);logger[_0x51fd('0xe')](_0x51fd('0x22'),_0x9fb145,JSON[_0x51fd('0x10')](_0x4d8b4e));_0x33167a(_0x4d8b4e);})[_0x51fd('0x1f')](function(_0x9945c7){logger[_0x51fd('0x13')]('CreateVoiceCallReport',_0x9945c7[_0x51fd('0x12')],_0x9fb145);_0x38165b(_0x46c051[_0x51fd('0x13')](0x1f4,_0x9945c7['message']));});});};exports[_0x51fd('0x23')]=function(_0x778b7f){var _0xed6d54=this;return new Promise(function(_0x1f6ea9,_0x144347){return db[_0x51fd('0x15')][_0x51fd('0x24')](_0x778b7f[_0x51fd('0x21')],{'raw':_0x778b7f[_0x51fd('0x18')]?_0x778b7f[_0x51fd('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x778b7f['options']?_0x778b7f[_0x51fd('0x18')][_0x51fd('0x19')]||null:null,'attributes':_0x778b7f['options']?_0x778b7f[_0x51fd('0x18')][_0x51fd('0x1a')]||null:null,'limit':_0x778b7f['options']?_0x778b7f['options'][_0x51fd('0x1b')]||null:null})[_0x51fd('0xb')](function(_0xc29e4c){logger[_0x51fd('0xc')](_0x51fd('0x23'),_0x778b7f);logger[_0x51fd('0xe')](_0x51fd('0x23'),_0x778b7f,JSON['stringify'](_0xc29e4c));_0x1f6ea9(_0xc29e4c);})[_0x51fd('0x1f')](function(_0x2f9294){logger[_0x51fd('0x13')](_0x51fd('0x23'),_0x2f9294[_0x51fd('0x12')],_0x778b7f);_0x144347(_0xed6d54[_0x51fd('0x13')](0x1f4,_0x2f9294[_0x51fd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b1693eb..b4ffd52 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 _0xf486=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xb96f50,_0xa21d9b){var _0x1caf5d=function(_0x3bfde6){while(--_0x3bfde6){_0xb96f50['push'](_0xb96f50['shift']());}};_0x1caf5d(++_0xa21d9b);}(_0xf486,0x91));var _0x6f48=function(_0x2803be,_0x11979c){_0x2803be=_0x2803be-0x0;var _0x109bdb=_0xf486[_0x2803be];return _0x109bdb;};'use strict';var multer=require(_0x6f48('0x0'));var util=require(_0x6f48('0x1'));var path=require(_0x6f48('0x2'));var timeout=require(_0x6f48('0x3'));var express=require(_0x6f48('0x4'));var router=express[_0x6f48('0x5')]();var fs_extra=require(_0x6f48('0x6'));var auth=require(_0x6f48('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f48('0x8'));var controller=require(_0x6f48('0x9'));router[_0x6f48('0xa')]('/',auth[_0x6f48('0xb')](),controller[_0x6f48('0xc')]);router[_0x6f48('0xa')](_0x6f48('0xd'),auth[_0x6f48('0xb')](),controller[_0x6f48('0xe')]);router[_0x6f48('0xf')]('/',auth[_0x6f48('0xb')](),controller[_0x6f48('0x10')]);router['put']('/:id',auth[_0x6f48('0xb')](),controller['update']);router[_0x6f48('0x11')](_0x6f48('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe077=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x3c02d6,_0x1125bd){var _0x2a5219=function(_0x3f2f38){while(--_0x3f2f38){_0x3c02d6['push'](_0x3c02d6['shift']());}};_0x2a5219(++_0x1125bd);}(_0xe077,0x6f));var _0x7e07=function(_0x169c64,_0x4f79ae){_0x169c64=_0x169c64-0x0;var _0x13bb93=_0xe077[_0x169c64];return _0x13bb93;};'use strict';var multer=require(_0x7e07('0x0'));var util=require(_0x7e07('0x1'));var path=require(_0x7e07('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e07('0x3'));var router=express[_0x7e07('0x4')]();var fs_extra=require(_0x7e07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e07('0x6'));var config=require(_0x7e07('0x7'));var controller=require(_0x7e07('0x8'));router['get']('/',auth[_0x7e07('0x9')](),controller[_0x7e07('0xa')]);router[_0x7e07('0xb')](_0x7e07('0xc'),auth[_0x7e07('0x9')](),controller[_0x7e07('0xd')]);router[_0x7e07('0xe')]('/',auth[_0x7e07('0x9')](),controller[_0x7e07('0xf')]);router[_0x7e07('0x10')](_0x7e07('0xc'),auth[_0x7e07('0x9')](),controller[_0x7e07('0x11')]);router[_0x7e07('0x12')](_0x7e07('0xc'),auth[_0x7e07('0x9')](),controller['destroy']);module[_0x7e07('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 3eb8f1f..69ba016 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 _0xba6e=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue','options'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xba6e,0x1d3));var _0xeba6=function(_0x52383c,_0xc5e099){_0x52383c=_0x52383c-0x0;var _0x461723=_0xba6e[_0x52383c];return _0x461723;};'use strict';var Sequelize=require(_0xeba6('0x0'));module[_0xeba6('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xeba6('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xeba6('0x2')],'set':function(_0x3963b2){this[_0xeba6('0x3')](_0xeba6('0x4'),_0x3963b2?_0x3963b2[_0xeba6('0x5')](''):[]);},'get':function(){return this[_0xeba6('0x6')](_0xeba6('0x4'))?this[_0xeba6('0x6')](_0xeba6('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xeba6('0x2')]},'record':{'type':Sequelize[_0xeba6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xeba6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ebb=['options','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x4ebb,0x96));var _0xb4eb=function(_0x34b6fc,_0x6ae1b3){_0x34b6fc=_0x34b6fc-0x0;var _0x9c49c0=_0x4ebb[_0x34b6fc];return _0x9c49c0;};'use strict';var Sequelize=require(_0xb4eb('0x0'));module[_0xb4eb('0x1')]={'name':{'type':Sequelize[_0xb4eb('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xb4eb('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb4eb('0x2')],'set':function(_0x5f8b4d){this['setDataValue'](_0xb4eb('0x4'),_0x5f8b4d?_0x5f8b4d['join'](''):[]);},'get':function(){return this['getDataValue'](_0xb4eb('0x4'))?this[_0xb4eb('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xb4eb('0x2')]},'record':{'type':Sequelize[_0xb4eb('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e80f7db..ad1e25d 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 _0x757f=['crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','VoiceChanSpy','include','findAll','rows','catch','show','filters','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','find','autoAssociation','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0xd30f66,_0x5ad5eb){var _0x32b253=function(_0x17303e){while(--_0x17303e){_0xd30f66['push'](_0xd30f66['shift']());}};_0x32b253(++_0x5ad5eb);}(_0x757f,0xee));var _0xf757=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x757f[_0x33925b];return _0x375e21;};'use strict';var emlformat=require(_0xf757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf757('0x1'));var jsonpatch=require(_0xf757('0x2'));var rp=require(_0xf757('0x3'));var moment=require(_0xf757('0x4'));var BPromise=require(_0xf757('0x5'));var Mustache=require(_0xf757('0x6'));var util=require(_0xf757('0x7'));var path=require(_0xf757('0x8'));var sox=require(_0xf757('0x9'));var csv=require('to-csv');var ejs=require(_0xf757('0xa'));var fs=require('fs');var fs_extra=require(_0xf757('0xb'));var _=require(_0xf757('0xc'));var squel=require(_0xf757('0xd'));var crypto=require(_0xf757('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf757('0xf'));var querystring=require(_0xf757('0x10'));var Papa=require(_0xf757('0x11'));var Redis=require(_0xf757('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf757('0x13'));var as=require(_0xf757('0x14'));var hardwareService=require(_0xf757('0x15'));var logger=require(_0xf757('0x16'))(_0xf757('0x17'));var utils=require(_0xf757('0x18'));var config=require(_0xf757('0x19'));var licenseUtil=require(_0xf757('0x1a'));var db=require(_0xf757('0x1b'))['db'];function respondWithStatusCode(_0x3b7033,_0xc839ec){_0xc839ec=_0xc839ec||0xcc;return function(_0x20b497){if(_0x20b497){return _0x3b7033[_0xf757('0x1c')](_0xc839ec);}return _0x3b7033[_0xf757('0x1d')](_0xc839ec)[_0xf757('0x1e')]();};}function respondWithResult(_0x22a2d9,_0x6dd606){_0x6dd606=_0x6dd606||0xc8;return function(_0x3fb479){if(_0x3fb479){return _0x22a2d9['status'](_0x6dd606)[_0xf757('0x1f')](_0x3fb479);}};}function respondWithFilteredResult(_0x12fb35,_0x5c297e){return function(_0x1ad422){if(_0x1ad422){var _0x2b3540=typeof _0x5c297e[_0xf757('0x20')]==='undefined'&&typeof _0x5c297e[_0xf757('0x21')]===_0xf757('0x22');var _0x2f3d50=_0x1ad422[_0xf757('0x23')];var _0x54af52=_0x2b3540?0x0:_0x5c297e[_0xf757('0x20')];var _0x4124a0=_0x2b3540?_0x1ad422[_0xf757('0x23')]:_0x5c297e[_0xf757('0x20')]+_0x5c297e[_0xf757('0x21')];var _0x4d6580;if(_0x4124a0>=_0x2f3d50){_0x4124a0=_0x2f3d50;_0x4d6580=0xc8;}else{_0x4d6580=0xce;}_0x12fb35['status'](_0x4d6580);return _0x12fb35[_0xf757('0x24')]('Content-Range',_0x54af52+'-'+_0x4124a0+'/'+_0x2f3d50)['json'](_0x1ad422);}return null;};}function patchUpdates(_0x323bff){return function(_0x366c60){try{jsonpatch['apply'](_0x366c60,_0x323bff,!![]);}catch(_0x3c0bc8){return BPromise[_0xf757('0x25')](_0x3c0bc8);}return _0x366c60[_0xf757('0x26')]();};}function saveUpdates(_0x383bb2,_0x47db84){return function(_0x495bad){if(_0x495bad){return _0x495bad[_0xf757('0x27')](_0x383bb2)[_0xf757('0x28')](function(_0x1e347f){return _0x1e347f;});}return null;};}function removeEntity(_0x180005,_0x3d38dd){return function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d[_0xf757('0x29')]()[_0xf757('0x28')](function(){var _0x355d70=_0x12ee1d[_0xf757('0x2a')]({'plain':!![]});var _0x4d9012='ChanSpies';return db[_0xf757('0x2b')][_0xf757('0x29')]({'where':{'type':_0x4d9012,'resourceId':_0x355d70['id']}})[_0xf757('0x28')](function(){return _0x12ee1d;});})[_0xf757('0x28')](function(){_0x180005[_0xf757('0x1d')](0xcc)[_0xf757('0x1e')]();});}};}function handleEntityNotFound(_0x155a13,_0x180882){return function(_0x58ac7a){if(!_0x58ac7a){_0x155a13['sendStatus'](0x194);}return _0x58ac7a;};}function handleError(_0x1b61bf,_0x524397){_0x524397=_0x524397||0x1f4;return function(_0x1fa192){logger['error'](_0x1fa192[_0xf757('0x2c')]);if(_0x1fa192[_0xf757('0x2d')]){delete _0x1fa192['name'];}_0x1b61bf[_0xf757('0x1d')](_0x524397)[_0xf757('0x2e')](_0x1fa192);};}exports[_0xf757('0x2f')]=function(_0x3ad266,_0x542b16){var _0x216832={},_0x4f490d={},_0x356d13={'count':0x0,'rows':[]};var _0x5643e6=_[_0xf757('0x30')](db['VoiceChanSpy'][_0xf757('0x31')],function(_0x2077d0){return{'name':_0x2077d0['fieldName'],'type':_0x2077d0[_0xf757('0x32')]['key']};});_0x4f490d[_0xf757('0x33')]=_['map'](_0x5643e6,_0xf757('0x2d'));_0x4f490d[_0xf757('0x34')]=_[_0xf757('0x35')](_0x3ad266[_0xf757('0x34')]);_0x4f490d['filters']=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],_0x4f490d[_0xf757('0x34')]);_0x216832[_0xf757('0x37')]=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],qs[_0xf757('0x38')](_0x3ad266[_0xf757('0x34')][_0xf757('0x38')]));_0x216832['attributes']=_0x216832[_0xf757('0x37')][_0xf757('0x39')]?_0x216832[_0xf757('0x37')]:_0x4f490d[_0xf757('0x33')];if(!_0x3ad266[_0xf757('0x34')][_0xf757('0x3a')](_0xf757('0x3b'))){_0x216832[_0xf757('0x21')]=qs[_0xf757('0x21')](_0x3ad266[_0xf757('0x34')]['limit']);_0x216832['offset']=qs['offset'](_0x3ad266['query'][_0xf757('0x20')]);}_0x216832[_0xf757('0x3c')]=qs[_0xf757('0x3d')](_0x3ad266[_0xf757('0x34')][_0xf757('0x3d')]);_0x216832['where']=qs['filters'](_[_0xf757('0x3e')](_0x3ad266[_0xf757('0x34')],_0x4f490d['filters']),_0x5643e6);if(_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]){_0x216832['where']=_[_0xf757('0x40')](_0x216832[_0xf757('0x41')],{'$or':_[_0xf757('0x30')](_0x5643e6,function(_0x14796c){if(_0x14796c['type']!==_0xf757('0x42')){var _0x9f3609={};_0x9f3609[_0x14796c[_0xf757('0x2d')]]={'$like':'%'+_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]+'%'};return _0x9f3609;}})});}_0x216832=_['merge']({},_0x216832,_0x3ad266['options']);var _0x3bcd45={'where':_0x216832[_0xf757('0x41')]};return db[_0xf757('0x43')][_0xf757('0x23')](_0x3bcd45)[_0xf757('0x28')](function(_0x544659){_0x356d13['count']=_0x544659;if(_0x3ad266[_0xf757('0x34')]['includeAll']){_0x216832[_0xf757('0x44')]=[{'all':!![]}];}return db[_0xf757('0x43')][_0xf757('0x45')](_0x216832);})['then'](function(_0x3f4e63){_0x356d13[_0xf757('0x46')]=_0x3f4e63;return _0x356d13;})['then'](respondWithFilteredResult(_0x542b16,_0x216832))[_0xf757('0x47')](handleError(_0x542b16,null));};exports[_0xf757('0x48')]=function(_0x3e7efe,_0xba2238){var _0xfd8913={'raw':![],'where':{'id':_0x3e7efe['params']['id']}},_0x1a021f={};_0x1a021f[_0xf757('0x33')]=_['keys'](db[_0xf757('0x43')][_0xf757('0x31')]);_0x1a021f[_0xf757('0x34')]=_['keys'](_0x3e7efe[_0xf757('0x34')]);_0x1a021f[_0xf757('0x49')]=_['intersection'](_0x1a021f[_0xf757('0x33')],_0x1a021f[_0xf757('0x34')]);_0xfd8913[_0xf757('0x37')]=_[_0xf757('0x36')](_0x1a021f['model'],qs[_0xf757('0x38')](_0x3e7efe['query'][_0xf757('0x38')]));_0xfd8913[_0xf757('0x37')]=_0xfd8913[_0xf757('0x37')][_0xf757('0x39')]?_0xfd8913[_0xf757('0x37')]:_0x1a021f[_0xf757('0x33')];if(_0x3e7efe['query'][_0xf757('0x4a')]){_0xfd8913[_0xf757('0x44')]=[{'all':!![]}];}_0xfd8913=_['merge']({},_0xfd8913,_0x3e7efe['options']);return db[_0xf757('0x43')]['find'](_0xfd8913)[_0xf757('0x28')](handleEntityNotFound(_0xba2238,null))[_0xf757('0x28')](respondWithResult(_0xba2238,null))[_0xf757('0x47')](handleError(_0xba2238,null));};exports[_0xf757('0x4b')]=function(_0x6e4d0b,_0x27ac4d){return db[_0xf757('0x43')][_0xf757('0x4b')](_0x6e4d0b[_0xf757('0x4c')],{})[_0xf757('0x28')](function(_0x2905c2){var _0x1a8b0b=_0x6e4d0b['user'][_0xf757('0x2a')]({'plain':!![]});if(!_0x1a8b0b)throw new Error(_0xf757('0x4d'));if(_0x1a8b0b[_0xf757('0x4e')]==='user'){var _0x5d9f03=_0x2905c2[_0xf757('0x2a')]({'plain':!![]});var _0x6015d4=_0xf757('0x4f');return db['UserProfileSection'][_0xf757('0x50')]({'where':{'name':_0x6015d4,'userProfileId':_0x1a8b0b['userProfileId']},'raw':!![]})[_0xf757('0x28')](function(_0x141d02){if(_0x141d02&&_0x141d02[_0xf757('0x51')]===0x0){return db[_0xf757('0x2b')][_0xf757('0x4b')]({'name':_0x5d9f03['name'],'resourceId':_0x5d9f03['id'],'type':_0x141d02['name'],'sectionId':_0x141d02['id']},{})[_0xf757('0x28')](function(){return _0x2905c2;});}else{return _0x2905c2;}})[_0xf757('0x47')](function(_0x5a95fe){logger[_0xf757('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a95fe);throw _0x5a95fe;});}return _0x2905c2;})[_0xf757('0x28')](respondWithResult(_0x27ac4d,0xc9))[_0xf757('0x47')](handleError(_0x27ac4d,null));};exports[_0xf757('0x27')]=function(_0x53c26a,_0x174ac5){if(_0x53c26a[_0xf757('0x4c')]['id']){delete _0x53c26a['body']['id'];}return db[_0xf757('0x43')]['find']({'where':{'id':_0x53c26a[_0xf757('0x53')]['id']}})['then'](handleEntityNotFound(_0x174ac5,null))[_0xf757('0x28')](saveUpdates(_0x53c26a[_0xf757('0x4c')],null))[_0xf757('0x28')](respondWithResult(_0x174ac5,null))['catch'](handleError(_0x174ac5,null));};exports[_0xf757('0x29')]=function(_0x41692f,_0xa59237){return db[_0xf757('0x43')][_0xf757('0x50')]({'where':{'id':_0x41692f['params']['id']}})[_0xf757('0x28')](handleEntityNotFound(_0xa59237,null))[_0xf757('0x28')](removeEntity(_0xa59237,null))['catch'](handleError(_0xa59237,null));}; \ No newline at end of file +var _0x6308=['nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1563e6,_0x5e44ff){var _0x3860c1=function(_0x4cd819){while(--_0x4cd819){_0x1563e6['push'](_0x1563e6['shift']());}};_0x3860c1(++_0x5e44ff);}(_0x6308,0x1f2));var _0x8630=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x6308[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require(_0x8630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8630('0x2'));var BPromise=require(_0x8630('0x3'));var Mustache=require(_0x8630('0x4'));var util=require(_0x8630('0x5'));var path=require(_0x8630('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8630('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0xd'));var querystring=require('querystring');var Papa=require(_0x8630('0xe'));var Redis=require('ioredis');var authService=require(_0x8630('0xf'));var qs=require(_0x8630('0x10'));var as=require(_0x8630('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x12'))(_0x8630('0x13'));var utils=require(_0x8630('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8630('0x15'));var db=require(_0x8630('0x16'))['db'];function respondWithStatusCode(_0x5b6d75,_0x54073b){_0x54073b=_0x54073b||0xcc;return function(_0x303e3a){if(_0x303e3a){return _0x5b6d75[_0x8630('0x17')](_0x54073b);}return _0x5b6d75['status'](_0x54073b)[_0x8630('0x18')]();};}function respondWithResult(_0x4db686,_0xf31c17){_0xf31c17=_0xf31c17||0xc8;return function(_0x4cc542){if(_0x4cc542){return _0x4db686[_0x8630('0x19')](_0xf31c17)['json'](_0x4cc542);}};}function respondWithFilteredResult(_0x53f236,_0x29a42d){return function(_0x86c262){if(_0x86c262){var _0x49fce1=typeof _0x29a42d['offset']===_0x8630('0x1a')&&typeof _0x29a42d['limit']===_0x8630('0x1a');var _0x18a874=_0x86c262[_0x8630('0x1b')];var _0x20f462=_0x49fce1?0x0:_0x29a42d[_0x8630('0x1c')];var _0x1e9780=_0x49fce1?_0x86c262[_0x8630('0x1b')]:_0x29a42d[_0x8630('0x1c')]+_0x29a42d[_0x8630('0x1d')];var _0x5dd2e0;if(_0x1e9780>=_0x18a874){_0x1e9780=_0x18a874;_0x5dd2e0=0xc8;}else{_0x5dd2e0=0xce;}_0x53f236['status'](_0x5dd2e0);return _0x53f236[_0x8630('0x1e')](_0x8630('0x1f'),_0x20f462+'-'+_0x1e9780+'/'+_0x18a874)['json'](_0x86c262);}return null;};}function patchUpdates(_0x5cff5c){return function(_0x1325dc){try{jsonpatch[_0x8630('0x20')](_0x1325dc,_0x5cff5c,!![]);}catch(_0x1ac046){return BPromise['reject'](_0x1ac046);}return _0x1325dc['save']();};}function saveUpdates(_0xcc7454,_0x58c0b5){return function(_0x30fb4d){if(_0x30fb4d){return _0x30fb4d[_0x8630('0x21')](_0xcc7454)[_0x8630('0x22')](function(_0x469de3){return _0x469de3;});}return null;};}function removeEntity(_0x4c2851,_0x37c224){return function(_0xf24c11){if(_0xf24c11){return _0xf24c11[_0x8630('0x23')]()[_0x8630('0x22')](function(){var _0x41871a=_0xf24c11[_0x8630('0x24')]({'plain':!![]});var _0x37b7aa='ChanSpies';return db['UserProfileResource'][_0x8630('0x23')]({'where':{'type':_0x37b7aa,'resourceId':_0x41871a['id']}})[_0x8630('0x22')](function(){return _0xf24c11;});})[_0x8630('0x22')](function(){_0x4c2851[_0x8630('0x19')](0xcc)[_0x8630('0x18')]();});}};}function handleEntityNotFound(_0x1c012d,_0x149a8e){return function(_0x349c4d){if(!_0x349c4d){_0x1c012d[_0x8630('0x17')](0x194);}return _0x349c4d;};}function handleError(_0x357c15,_0x221841){_0x221841=_0x221841||0x1f4;return function(_0x41f74c){logger[_0x8630('0x25')](_0x41f74c[_0x8630('0x26')]);if(_0x41f74c[_0x8630('0x27')]){delete _0x41f74c[_0x8630('0x27')];}_0x357c15[_0x8630('0x19')](_0x221841)['send'](_0x41f74c);};}exports[_0x8630('0x28')]=function(_0x4545c2,_0x24d85d){var _0xe3ed67={},_0x55653d={},_0x43e470={'count':0x0,'rows':[]};var _0x1eb036=_[_0x8630('0x29')](db[_0x8630('0x2a')][_0x8630('0x2b')],function(_0x32f4fd){return{'name':_0x32f4fd['fieldName'],'type':_0x32f4fd[_0x8630('0x2c')][_0x8630('0x2d')]};});_0x55653d[_0x8630('0x2e')]=_['map'](_0x1eb036,_0x8630('0x27'));_0x55653d[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x4545c2[_0x8630('0x2f')]);_0x55653d[_0x8630('0x31')]=_[_0x8630('0x32')](_0x55653d['model'],_0x55653d[_0x8630('0x2f')]);_0xe3ed67[_0x8630('0x33')]=_[_0x8630('0x32')](_0x55653d[_0x8630('0x2e')],qs[_0x8630('0x34')](_0x4545c2[_0x8630('0x2f')][_0x8630('0x34')]));_0xe3ed67[_0x8630('0x33')]=_0xe3ed67[_0x8630('0x33')][_0x8630('0x35')]?_0xe3ed67[_0x8630('0x33')]:_0x55653d[_0x8630('0x2e')];if(!_0x4545c2[_0x8630('0x2f')][_0x8630('0x36')](_0x8630('0x37'))){_0xe3ed67[_0x8630('0x1d')]=qs[_0x8630('0x1d')](_0x4545c2['query'][_0x8630('0x1d')]);_0xe3ed67[_0x8630('0x1c')]=qs['offset'](_0x4545c2['query'][_0x8630('0x1c')]);}_0xe3ed67[_0x8630('0x38')]=qs[_0x8630('0x39')](_0x4545c2[_0x8630('0x2f')][_0x8630('0x39')]);_0xe3ed67['where']=qs[_0x8630('0x31')](_[_0x8630('0x3a')](_0x4545c2[_0x8630('0x2f')],_0x55653d[_0x8630('0x31')]),_0x1eb036);if(_0x4545c2['query'][_0x8630('0x3b')]){_0xe3ed67[_0x8630('0x3c')]=_[_0x8630('0x3d')](_0xe3ed67[_0x8630('0x3c')],{'$or':_[_0x8630('0x29')](_0x1eb036,function(_0x16c041){if(_0x16c041[_0x8630('0x2c')]!=='VIRTUAL'){var _0x1076f4={};_0x1076f4[_0x16c041[_0x8630('0x27')]]={'$like':'%'+_0x4545c2[_0x8630('0x2f')][_0x8630('0x3b')]+'%'};return _0x1076f4;}})});}_0xe3ed67=_[_0x8630('0x3d')]({},_0xe3ed67,_0x4545c2[_0x8630('0x3e')]);var _0x25cb36={'where':_0xe3ed67[_0x8630('0x3c')]};return db[_0x8630('0x2a')][_0x8630('0x1b')](_0x25cb36)['then'](function(_0x358431){_0x43e470['count']=_0x358431;if(_0x4545c2[_0x8630('0x2f')][_0x8630('0x3f')]){_0xe3ed67[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x2a')][_0x8630('0x41')](_0xe3ed67);})[_0x8630('0x22')](function(_0x5bcf39){_0x43e470[_0x8630('0x42')]=_0x5bcf39;return _0x43e470;})[_0x8630('0x22')](respondWithFilteredResult(_0x24d85d,_0xe3ed67))[_0x8630('0x43')](handleError(_0x24d85d,null));};exports['show']=function(_0x79385,_0x1ea295){var _0x40914f={'raw':![],'where':{'id':_0x79385[_0x8630('0x44')]['id']}},_0x327466={};_0x327466[_0x8630('0x2e')]=_['keys'](db[_0x8630('0x2a')][_0x8630('0x2b')]);_0x327466[_0x8630('0x2f')]=_['keys'](_0x79385[_0x8630('0x2f')]);_0x327466[_0x8630('0x31')]=_['intersection'](_0x327466[_0x8630('0x2e')],_0x327466[_0x8630('0x2f')]);_0x40914f[_0x8630('0x33')]=_['intersection'](_0x327466['model'],qs[_0x8630('0x34')](_0x79385['query']['fields']));_0x40914f[_0x8630('0x33')]=_0x40914f['attributes'][_0x8630('0x35')]?_0x40914f[_0x8630('0x33')]:_0x327466['model'];if(_0x79385[_0x8630('0x2f')][_0x8630('0x3f')]){_0x40914f[_0x8630('0x40')]=[{'all':!![]}];}_0x40914f=_[_0x8630('0x3d')]({},_0x40914f,_0x79385[_0x8630('0x3e')]);return db['VoiceChanSpy'][_0x8630('0x45')](_0x40914f)[_0x8630('0x22')](handleEntityNotFound(_0x1ea295,null))['then'](respondWithResult(_0x1ea295,null))[_0x8630('0x43')](handleError(_0x1ea295,null));};exports[_0x8630('0x46')]=function(_0x3ff20b,_0x47aa03){return db[_0x8630('0x2a')][_0x8630('0x46')](_0x3ff20b[_0x8630('0x47')],{})[_0x8630('0x22')](function(_0x8b467a){var _0xefe57b=_0x3ff20b[_0x8630('0x48')][_0x8630('0x24')]({'plain':!![]});if(!_0xefe57b)throw new Error(_0x8630('0x49'));if(_0xefe57b['role']==='user'){var _0x1b8328=_0x8b467a[_0x8630('0x24')]({'plain':!![]});var _0x34619c=_0x8630('0x4a');return db[_0x8630('0x4b')][_0x8630('0x45')]({'where':{'name':_0x34619c,'userProfileId':_0xefe57b[_0x8630('0x4c')]},'raw':!![]})['then'](function(_0x2af827){if(_0x2af827&&_0x2af827[_0x8630('0x4d')]===0x0){return db[_0x8630('0x4e')][_0x8630('0x46')]({'name':_0x1b8328[_0x8630('0x27')],'resourceId':_0x1b8328['id'],'type':_0x2af827['name'],'sectionId':_0x2af827['id']},{})[_0x8630('0x22')](function(){return _0x8b467a;});}else{return _0x8b467a;}})[_0x8630('0x43')](function(_0xeacec4){logger[_0x8630('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeacec4);throw _0xeacec4;});}return _0x8b467a;})[_0x8630('0x22')](respondWithResult(_0x47aa03,0xc9))[_0x8630('0x43')](handleError(_0x47aa03,null));};exports['update']=function(_0x2edc3d,_0x1ecb2a){if(_0x2edc3d[_0x8630('0x47')]['id']){delete _0x2edc3d[_0x8630('0x47')]['id'];}return db['VoiceChanSpy'][_0x8630('0x45')]({'where':{'id':_0x2edc3d[_0x8630('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ecb2a,null))['then'](saveUpdates(_0x2edc3d[_0x8630('0x47')],null))[_0x8630('0x22')](respondWithResult(_0x1ecb2a,null))['catch'](handleError(_0x1ecb2a,null));};exports[_0x8630('0x23')]=function(_0x510113,_0x2e49c8){return db[_0x8630('0x2a')][_0x8630('0x45')]({'where':{'id':_0x510113['params']['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x2e49c8,null))[_0x8630('0x22')](removeEntity(_0x2e49c8,null))[_0x8630('0x43')](handleError(_0x2e49c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4a292e7..9fc4007 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 _0xa1dd=['from-sip','%s%s','prefix','system','push','merge','Set','format','chanspy','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0x3484ef,_0x8f7086){var _0xae6ed2=function(_0x266fb5){while(--_0x266fb5){_0x3484ef['push'](_0x3484ef['shift']());}};_0xae6ed2(++_0x8f7086);}(_0xa1dd,0x152));var _0xda1d=function(_0x105c48,_0x2d5490){_0x105c48=_0x105c48-0x0;var _0xbc087a=_0xa1dd[_0x105c48];return _0xbc087a;};'use strict';var _=require('lodash');var util=require(_0xda1d('0x0'));var BPromise=require(_0xda1d('0x1'));var attributes=require(_0xda1d('0x2'));var getUserApplications=function(_0x12049f,_0x20b48f,_0x5d20e8){var _0x118386=0x1;var _0xed9b26=[];var _0x3efc10={'context':_0x20b48f[_0xda1d('0x3')]||_0xda1d('0x4'),'exten':util['format'](_0xda1d('0x5'),_0x12049f[_0xda1d('0x6')],_0x5d20e8),'type':_0xda1d('0x7'),'isApp':![],'ChanSpyId':_0x12049f['id'],'UserId':_0x20b48f['id']};_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0xa'),'appdata':util[_0xda1d('0xb')]('CDR(type)=%s',_0xda1d('0xc')),'priority':_0x118386++},_0x3efc10));if(_0x12049f['record']){_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':'MixMonitor','appdata':util[_0xda1d('0xb')]('${UNIQUEID}.%s,a',_0x12049f[_0xda1d('0xd')]),'priority':_0x118386++},_0x3efc10));}if(_0x12049f[_0xda1d('0xe')]){_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0xf'),'appdata':_0x12049f[_0xda1d('0x10')],'priority':_0x118386++},_0x3efc10));}_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0x11'),'appdata':util[_0xda1d('0xb')](_0xda1d('0x12'),_0x20b48f[_0xda1d('0x13')],_0x12049f[_0xda1d('0x14')]?_0x12049f[_0xda1d('0x14')][_0xda1d('0x15')](''):''),'priority':_0x118386++},_0x3efc10));if(_0x12049f[_0xda1d('0x16')]){_0xed9b26['push'](_[_0xda1d('0x9')]({'app':_0xda1d('0x17'),'priority':_0x118386++},_0x3efc10));}return _0xed9b26;};var getChanSpyApplications=function(_0x1a76e3,_0x1cca7d){var _0x4704f0=[];for(var _0x28d1a7=0x0,_0x1a06bd=0x1;_0x28d1a7<_0x1cca7d[_0xda1d('0x18')];_0x28d1a7++,_0x1a06bd=0x1){_0x4704f0=_0x4704f0[_0xda1d('0x19')](getUserApplications(_0x1a76e3,_0x1cca7d[_0x28d1a7],_0x1cca7d[_0x28d1a7][_0xda1d('0x1a')]));if(_0x1cca7d[_0x28d1a7]['internal']!=_0x1cca7d[_0x28d1a7]['name']){_0x4704f0=_0x4704f0[_0xda1d('0x19')](getUserApplications(_0x1a76e3,_0x1cca7d[_0x28d1a7],_0x1cca7d[_0x28d1a7][_0xda1d('0x13')]));}}return _0x4704f0;};var getChanSpyPromise=function(_0x5d7ad2,_0x5d66ac){return new BPromise(function(_0x12571e,_0x4e95a6){return _0x5d7ad2[_0xda1d('0x1b')][_0xda1d('0x1c')]({'attributes':['id',_0xda1d('0x13'),'internal'],'where':{'role':_0xda1d('0x1d'),'chanspy':!![]},'raw':!![]})[_0xda1d('0x1e')](function(_0x1a0b13){if(_0x1a0b13){return _0x12571e(getChanSpyApplications(_0x5d66ac,_0x1a0b13));}return _0x12571e([]);})[_0xda1d('0x1f')](function(_0x491dd3){_0x4e95a6(_0x491dd3);});});};module[_0xda1d('0x20')]=function(_0x1a5d97,_0x4d314a){var _0x36031f=_0x1a5d97[_0xda1d('0x21')];return _0x1a5d97['define']('VoiceChanSpy',attributes,{'tableName':_0xda1d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d1e21,_0x50a7d4,_0x5c88b6){return getChanSpyPromise(_0x36031f,_0x5d1e21)[_0xda1d('0x1e')](function(_0x876d6d){if(_0x876d6d&&_0x876d6d[_0xda1d('0x18')]){return _0x36031f[_0xda1d('0x23')][_0xda1d('0x24')](_0x876d6d);}})['then'](function(){_0x5c88b6();})[_0xda1d('0x1f')](function(_0x331139){_0x5c88b6(_0x331139);});},'afterUpdate':function(_0x670712,_0x373415,_0x71b7ba){return _0x36031f['VoiceExtension'][_0xda1d('0x25')]({'where':{'ChanSpyId':_0x670712['id']}})['then'](function(){return getChanSpyPromise(_0x36031f,_0x670712);})[_0xda1d('0x1e')](function(_0x447dbe){if(_0x447dbe&&_0x447dbe['length']){return _0x36031f[_0xda1d('0x23')][_0xda1d('0x24')](_0x447dbe);}})[_0xda1d('0x1e')](function(){_0x71b7ba();})['catch'](function(_0x1d786d){_0x71b7ba(_0x1d786d);});},'afterDestroy':function(_0xebf234,_0x49b1bc,_0x5dec81){return _0x36031f['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xebf234['id']}})['then'](function(){_0x5dec81();})[_0xda1d('0x1f')](function(_0x15881c){_0x5dec81(_0x15881c);});}}});}; \ No newline at end of file +var _0x4f60=['then','length','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','system','push','Set','CDR(type)=%s','record','merge','recordingFormat','auth','Authenticate','ChanSpy','name','options','join','StopMixMonitor','internal','concat','User','catch','define','VoiceChanSpy','voice_chanspy'];(function(_0x394cdf,_0x5c7122){var _0x37f7df=function(_0x3ec9c1){while(--_0x3ec9c1){_0x394cdf['push'](_0x394cdf['shift']());}};_0x37f7df(++_0x5c7122);}(_0x4f60,0x105));var _0x04f6=function(_0x3fe3bc,_0x3451de){_0x3fe3bc=_0x3fe3bc-0x0;var _0x24e5bb=_0x4f60[_0x3fe3bc];return _0x24e5bb;};'use strict';var _=require('lodash');var util=require(_0x04f6('0x0'));var BPromise=require(_0x04f6('0x1'));var attributes=require(_0x04f6('0x2'));var getUserApplications=function(_0x5a33e8,_0x4db524,_0x3ba46b){var _0x22e2e5=0x1;var _0x576cd7=[];var _0x48a3b5={'context':_0x4db524[_0x04f6('0x3')]||'from-sip','exten':util[_0x04f6('0x4')]('%s%s',_0x5a33e8[_0x04f6('0x5')],_0x3ba46b),'type':_0x04f6('0x6'),'isApp':![],'ChanSpyId':_0x5a33e8['id'],'UserId':_0x4db524['id']};_0x576cd7[_0x04f6('0x7')](_['merge']({'app':_0x04f6('0x8'),'appdata':util[_0x04f6('0x4')](_0x04f6('0x9'),'chanspy'),'priority':_0x22e2e5++},_0x48a3b5));if(_0x5a33e8[_0x04f6('0xa')]){_0x576cd7[_0x04f6('0x7')](_[_0x04f6('0xb')]({'app':'MixMonitor','appdata':util[_0x04f6('0x4')]('${UNIQUEID}.%s,a',_0x5a33e8[_0x04f6('0xc')]),'priority':_0x22e2e5++},_0x48a3b5));}if(_0x5a33e8[_0x04f6('0xd')]){_0x576cd7[_0x04f6('0x7')](_['merge']({'app':_0x04f6('0xe'),'appdata':_0x5a33e8['password'],'priority':_0x22e2e5++},_0x48a3b5));}_0x576cd7[_0x04f6('0x7')](_[_0x04f6('0xb')]({'app':_0x04f6('0xf'),'appdata':util[_0x04f6('0x4')]('SIP/%s,%s',_0x4db524[_0x04f6('0x10')],_0x5a33e8[_0x04f6('0x11')]?_0x5a33e8[_0x04f6('0x11')][_0x04f6('0x12')](''):''),'priority':_0x22e2e5++},_0x48a3b5));if(_0x5a33e8[_0x04f6('0xa')]){_0x576cd7[_0x04f6('0x7')](_[_0x04f6('0xb')]({'app':_0x04f6('0x13'),'priority':_0x22e2e5++},_0x48a3b5));}return _0x576cd7;};var getChanSpyApplications=function(_0x351a28,_0x7334ae){var _0x44a30d=[];for(var _0x2e653a=0x0,_0x1ecf97=0x1;_0x2e653a<_0x7334ae['length'];_0x2e653a++,_0x1ecf97=0x1){_0x44a30d=_0x44a30d['concat'](getUserApplications(_0x351a28,_0x7334ae[_0x2e653a],_0x7334ae[_0x2e653a][_0x04f6('0x14')]));if(_0x7334ae[_0x2e653a][_0x04f6('0x14')]!=_0x7334ae[_0x2e653a][_0x04f6('0x10')]){_0x44a30d=_0x44a30d[_0x04f6('0x15')](getUserApplications(_0x351a28,_0x7334ae[_0x2e653a],_0x7334ae[_0x2e653a]['name']));}}return _0x44a30d;};var getChanSpyPromise=function(_0x4d3ae1,_0x5ba17b){return new BPromise(function(_0x2c99ec,_0x119224){return _0x4d3ae1[_0x04f6('0x16')]['findAll']({'attributes':['id',_0x04f6('0x10'),_0x04f6('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x339bcc){if(_0x339bcc){return _0x2c99ec(getChanSpyApplications(_0x5ba17b,_0x339bcc));}return _0x2c99ec([]);})[_0x04f6('0x17')](function(_0xb11e3c){_0x119224(_0xb11e3c);});});};module['exports']=function(_0x3df899,_0x1510fa){var _0x392959=_0x3df899['models'];return _0x3df899[_0x04f6('0x18')](_0x04f6('0x19'),attributes,{'tableName':_0x04f6('0x1a'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f2a7b,_0x434bdd,_0x4b4847){return getChanSpyPromise(_0x392959,_0x1f2a7b)[_0x04f6('0x1b')](function(_0x1f4c87){if(_0x1f4c87&&_0x1f4c87[_0x04f6('0x1c')]){return _0x392959['VoiceExtension']['bulkCreate'](_0x1f4c87);}})['then'](function(){_0x4b4847();})['catch'](function(_0x1b9fdc){_0x4b4847(_0x1b9fdc);});},'afterUpdate':function(_0x5f54be,_0x5e5be1,_0x25ac8b){return _0x392959[_0x04f6('0x1d')][_0x04f6('0x1e')]({'where':{'ChanSpyId':_0x5f54be['id']}})[_0x04f6('0x1b')](function(){return getChanSpyPromise(_0x392959,_0x5f54be);})[_0x04f6('0x1b')](function(_0x11bc18){if(_0x11bc18&&_0x11bc18[_0x04f6('0x1c')]){return _0x392959[_0x04f6('0x1d')][_0x04f6('0x1f')](_0x11bc18);}})[_0x04f6('0x1b')](function(){_0x25ac8b();})[_0x04f6('0x17')](function(_0x56894d){_0x25ac8b(_0x56894d);});},'afterDestroy':function(_0x58d56a,_0x1754a9,_0x45c14c){return _0x392959[_0x04f6('0x1d')][_0x04f6('0x1e')]({'where':{'ChanSpyId':_0x58d56a['id']}})[_0x04f6('0x1b')](function(){_0x45c14c();})['catch'](function(_0x586806){_0x45c14c(_0x586806);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c84c0dd..82c31da 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 _0xe130=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x293aae,_0x116c8e){var _0x3f10ec=function(_0x30b586){while(--_0x30b586){_0x293aae['push'](_0x293aae['shift']());}};_0x3f10ec(++_0x116c8e);}(_0xe130,0x127));var _0x0e13=function(_0x17622d,_0x30d571){_0x17622d=_0x17622d-0x0;var _0x5e7819=_0xe130[_0x17622d];return _0x5e7819;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});} \ No newline at end of file +var _0x1b73=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1b73,0x1d5));var _0x31b7=function(_0x46f8e1,_0x2a92d3){_0x46f8e1=_0x46f8e1-0x0;var _0x2c97d7=_0x1b73[_0x46f8e1];return _0x2c97d7;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index feb93df..4ec0083 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 _0xe144=['show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe144,0xf1));var _0x4e14=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xe144[_0xa8b370];return _0x643e37;};'use strict';var multer=require(_0x4e14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e14('0x1'));var express=require(_0x4e14('0x2'));var router=express[_0x4e14('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4e14('0x4'));var config=require(_0x4e14('0x5'));var controller=require(_0x4e14('0x6'));router[_0x4e14('0x7')]('/',auth[_0x4e14('0x8')](),controller[_0x4e14('0x9')]);router[_0x4e14('0x7')](_0x4e14('0xa'),auth[_0x4e14('0x8')](),controller[_0x4e14('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e14('0xc')]);router[_0x4e14('0xd')]('/:id',auth[_0x4e14('0x8')](),controller[_0x4e14('0xe')]);router[_0x4e14('0xf')](_0x4e14('0xa'),auth[_0x4e14('0x8')](),controller[_0x4e14('0x10')]);module[_0x4e14('0x11')]=router; \ No newline at end of file +var _0x8f7b=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5b2c20,_0x104c98){var _0x4eae34=function(_0x3f156b){while(--_0x3f156b){_0x5b2c20['push'](_0x5b2c20['shift']());}};_0x4eae34(++_0x104c98);}(_0x8f7b,0x150));var _0xb8f7=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8f7b[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xb8f7('0x0'));var util=require(_0xb8f7('0x1'));var path=require(_0xb8f7('0x2'));var timeout=require(_0xb8f7('0x3'));var express=require(_0xb8f7('0x4'));var router=express[_0xb8f7('0x5')]();var fs_extra=require(_0xb8f7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8f7('0x7'));var controller=require('./voiceContext.controller');router[_0xb8f7('0x8')]('/',auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xa')]);router['get'](_0xb8f7('0xb'),auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xc')]);router[_0xb8f7('0xd')]('/',auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xe')]);router[_0xb8f7('0xf')]('/:id',auth[_0xb8f7('0x9')](),controller[_0xb8f7('0x10')]);router[_0xb8f7('0x11')](_0xb8f7('0xb'),auth[_0xb8f7('0x9')](),controller[_0xb8f7('0x12')]);module[_0xb8f7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 33c5e42..4bd0c9f 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 _0x84ae=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0xab26a9,_0x47f187){var _0x4f4dd9=function(_0x4c551e){while(--_0x4c551e){_0xab26a9['push'](_0xab26a9['shift']());}};_0x4f4dd9(++_0x47f187);}(_0x84ae,0x1cb));var _0xe84a=function(_0x55a525,_0xceb707){_0x55a525=_0x55a525-0x0;var _0x345ffd=_0x84ae[_0x55a525];return _0x345ffd;};'use strict';var Sequelize=require(_0xe84a('0x0'));module[_0xe84a('0x1')]={'name':{'type':Sequelize[_0xe84a('0x2')],'unique':_0xe84a('0x3')},'description':{'type':Sequelize[_0xe84a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe84a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b79=['sequelize','exports','STRING'];(function(_0x323f13,_0x5975ae){var _0x755a38=function(_0x5292f4){while(--_0x5292f4){_0x323f13['push'](_0x323f13['shift']());}};_0x755a38(++_0x5975ae);}(_0x8b79,0x17d));var _0x98b7=function(_0x4c69cf,_0x5e1982){_0x4c69cf=_0x4c69cf-0x0;var _0x54a943=_0x8b79[_0x4c69cf];return _0x54a943;};'use strict';var Sequelize=require(_0x98b7('0x0'));module[_0x98b7('0x1')]={'name':{'type':Sequelize[_0x98b7('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x98b7('0x2')],'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 441b27f..3aef852 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 _0x1dd0=['Reload','chan_sip.so','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','rows','params','rawAttributes','includeAll','include','find','catch','create','readFileSync','root','utf8','render','writeFileSync'];(function(_0x1919fc,_0x1667db){var _0x49305a=function(_0x1ee4dd){while(--_0x1ee4dd){_0x1919fc['push'](_0x1919fc['shift']());}};_0x49305a(++_0x1667db);}(_0x1dd0,0x182));var _0x01dd=function(_0x26beeb,_0x92477e){_0x26beeb=_0x26beeb-0x0;var _0x27aeaa=_0x1dd0[_0x26beeb];return _0x27aeaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01dd('0x1'));var moment=require(_0x01dd('0x2'));var BPromise=require(_0x01dd('0x3'));var Mustache=require(_0x01dd('0x4'));var util=require(_0x01dd('0x5'));var path=require(_0x01dd('0x6'));var sox=require(_0x01dd('0x7'));var csv=require(_0x01dd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01dd('0x9'));var squel=require(_0x01dd('0xa'));var crypto=require(_0x01dd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x01dd('0xc'));var Redis=require('ioredis');var authService=require(_0x01dd('0xd'));var qs=require(_0x01dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01dd('0xf'));var logger=require(_0x01dd('0x10'))('api');var utils=require(_0x01dd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x01dd('0x12'));var db=require(_0x01dd('0x13'))['db'];var jayson=require(_0x01dd('0x14'));var client=jayson[_0x01dd('0x15')][_0x01dd('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4b9c92,_0x151cb2,_0x5ed854,_0x30ac78){return new BPromise(function(_0x446070,_0x1cd4ef){var _0x11e718=_0x30ac78||client;return _0x11e718['request'](_0x4b9c92,_0x5ed854)[_0x01dd('0x17')](function(_0x32d5ec){logger[_0x01dd('0x18')](_0x01dd('0x19'),_0x151cb2,_0x01dd('0x1a'));logger[_0x01dd('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x151cb2,_0x01dd('0x1a'),JSON[_0x01dd('0x1c')](_0x32d5ec));if(_0x32d5ec[_0x01dd('0x1d')]){if(_0x32d5ec[_0x01dd('0x1d')]['code']===0x1f4){logger['error'](_0x01dd('0x19'),_0x151cb2,_0x32d5ec['error'][_0x01dd('0x1e')]);return _0x1cd4ef(_0x32d5ec['error'][_0x01dd('0x1e')]);}logger['error'](_0x01dd('0x19'),_0x151cb2,_0x32d5ec['error']['message']);return _0x446070(_0x32d5ec[_0x01dd('0x1d')][_0x01dd('0x1e')]);}else{logger['info'](_0x01dd('0x19'),_0x151cb2,_0x01dd('0x1a'));_0x446070(_0x32d5ec[_0x01dd('0x1f')][_0x01dd('0x1e')]);}})['catch'](function(_0x16f55e){logger[_0x01dd('0x1d')](_0x01dd('0x19'),_0x151cb2,_0x16f55e);_0x1cd4ef(_0x16f55e);});});}function respondWithStatusCode(_0x5672a4,_0x5213af){_0x5213af=_0x5213af||0xcc;return function(_0x5d923c){if(_0x5d923c){return _0x5672a4[_0x01dd('0x20')](_0x5213af);}return _0x5672a4[_0x01dd('0x21')](_0x5213af)[_0x01dd('0x22')]();};}function respondWithResult(_0x4eb731,_0x3f7838){_0x3f7838=_0x3f7838||0xc8;return function(_0x297eff){if(_0x297eff){return _0x4eb731['status'](_0x3f7838)[_0x01dd('0x23')](_0x297eff);}};}function respondWithFilteredResult(_0x266e49,_0x97e6b7){return function(_0x5ec68d){if(_0x5ec68d){var _0x335784=typeof _0x97e6b7[_0x01dd('0x24')]==='undefined'&&typeof _0x97e6b7[_0x01dd('0x25')]===_0x01dd('0x26');var _0x563105=_0x5ec68d[_0x01dd('0x27')];var _0x285a91=_0x335784?0x0:_0x97e6b7[_0x01dd('0x24')];var _0x31d014=_0x335784?_0x5ec68d[_0x01dd('0x27')]:_0x97e6b7[_0x01dd('0x24')]+_0x97e6b7[_0x01dd('0x25')];var _0x5f783b;if(_0x31d014>=_0x563105){_0x31d014=_0x563105;_0x5f783b=0xc8;}else{_0x5f783b=0xce;}_0x266e49[_0x01dd('0x21')](_0x5f783b);return _0x266e49['set'](_0x01dd('0x28'),_0x285a91+'-'+_0x31d014+'/'+_0x563105)[_0x01dd('0x23')](_0x5ec68d);}return null;};}function patchUpdates(_0x2d470a){return function(_0x2785d6){try{jsonpatch[_0x01dd('0x29')](_0x2785d6,_0x2d470a,!![]);}catch(_0x3bb0d6){return BPromise[_0x01dd('0x2a')](_0x3bb0d6);}return _0x2785d6['save']();};}function saveUpdates(_0x3fc022,_0x4dd7fa){return function(_0x198c4e){if(_0x198c4e){return _0x198c4e[_0x01dd('0x2b')](_0x3fc022)[_0x01dd('0x17')](function(_0x2d7f33){return _0x2d7f33;});}return null;};}function removeEntity(_0x3f615f,_0x7f44bf){return function(_0xae26a9){if(_0xae26a9){return _0xae26a9[_0x01dd('0x2c')]()['then'](function(){var _0x3661e5=_0xae26a9[_0x01dd('0x2d')]({'plain':!![]});var _0x130871=_0x01dd('0x2e');return db[_0x01dd('0x2f')]['destroy']({'where':{'type':_0x130871,'resourceId':_0x3661e5['id']}})[_0x01dd('0x17')](function(){return _0xae26a9;});})[_0x01dd('0x17')](function(){_0x3f615f[_0x01dd('0x21')](0xcc)[_0x01dd('0x22')]();});}};}function handleEntityNotFound(_0x83619,_0x37507a){return function(_0x1c7a58){if(!_0x1c7a58){_0x83619[_0x01dd('0x20')](0x194);}return _0x1c7a58;};}function handleError(_0x27b4a0,_0x444b92){_0x444b92=_0x444b92||0x1f4;return function(_0x237208){logger[_0x01dd('0x1d')](_0x237208[_0x01dd('0x30')]);if(_0x237208[_0x01dd('0x31')]){delete _0x237208[_0x01dd('0x31')];}_0x27b4a0[_0x01dd('0x21')](_0x444b92)[_0x01dd('0x32')](_0x237208);};}exports[_0x01dd('0x33')]=function(_0x2c5adc,_0xc64be6){var _0x482788={},_0x1c89ca={},_0x416c08={'count':0x0,'rows':[]};var _0x400258=_[_0x01dd('0x34')](db[_0x01dd('0x35')]['rawAttributes'],function(_0x3071ab){return{'name':_0x3071ab[_0x01dd('0x36')],'type':_0x3071ab[_0x01dd('0x37')][_0x01dd('0x38')]};});_0x1c89ca['model']=_[_0x01dd('0x34')](_0x400258,_0x01dd('0x31'));_0x1c89ca[_0x01dd('0x39')]=_[_0x01dd('0x3a')](_0x2c5adc[_0x01dd('0x39')]);_0x1c89ca[_0x01dd('0x3b')]=_[_0x01dd('0x3c')](_0x1c89ca[_0x01dd('0x3d')],_0x1c89ca[_0x01dd('0x39')]);_0x482788[_0x01dd('0x3e')]=_[_0x01dd('0x3c')](_0x1c89ca[_0x01dd('0x3d')],qs[_0x01dd('0x3f')](_0x2c5adc[_0x01dd('0x39')]['fields']));_0x482788[_0x01dd('0x3e')]=_0x482788[_0x01dd('0x3e')][_0x01dd('0x40')]?_0x482788[_0x01dd('0x3e')]:_0x1c89ca[_0x01dd('0x3d')];if(!_0x2c5adc[_0x01dd('0x39')]['hasOwnProperty']('nolimit')){_0x482788[_0x01dd('0x25')]=qs[_0x01dd('0x25')](_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x25')]);_0x482788[_0x01dd('0x24')]=qs[_0x01dd('0x24')](_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x24')]);}_0x482788['order']=qs[_0x01dd('0x41')](_0x2c5adc['query']['sort']);_0x482788[_0x01dd('0x42')]=qs[_0x01dd('0x3b')](_['pick'](_0x2c5adc[_0x01dd('0x39')],_0x1c89ca[_0x01dd('0x3b')]),_0x400258);if(_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x43')]){_0x482788[_0x01dd('0x42')]=_[_0x01dd('0x44')](_0x482788[_0x01dd('0x42')],{'$or':_[_0x01dd('0x34')](_0x400258,function(_0x51184c){if(_0x51184c[_0x01dd('0x37')]!==_0x01dd('0x45')){var _0x24b7f6={};_0x24b7f6[_0x51184c['name']]={'$like':'%'+_0x2c5adc['query'][_0x01dd('0x43')]+'%'};return _0x24b7f6;}})});}_0x482788=_['merge']({},_0x482788,_0x2c5adc[_0x01dd('0x46')]);var _0x107b7b={'where':_0x482788[_0x01dd('0x42')]};return db[_0x01dd('0x35')][_0x01dd('0x27')](_0x107b7b)[_0x01dd('0x17')](function(_0x3e526f){_0x416c08[_0x01dd('0x27')]=_0x3e526f;if(_0x2c5adc['query']['includeAll']){_0x482788['include']=[{'all':!![]}];}return db[_0x01dd('0x35')]['findAll'](_0x482788);})['then'](function(_0x143ef7){_0x416c08[_0x01dd('0x47')]=_0x143ef7;return _0x416c08;})['then'](respondWithFilteredResult(_0xc64be6,_0x482788))['catch'](handleError(_0xc64be6,null));};exports['show']=function(_0x3226e2,_0x54412b){var _0x37b329={'raw':![],'where':{'id':_0x3226e2[_0x01dd('0x48')]['id']}},_0x2a79dd={};_0x2a79dd[_0x01dd('0x3d')]=_[_0x01dd('0x3a')](db['VoiceContext'][_0x01dd('0x49')]);_0x2a79dd[_0x01dd('0x39')]=_[_0x01dd('0x3a')](_0x3226e2['query']);_0x2a79dd[_0x01dd('0x3b')]=_[_0x01dd('0x3c')](_0x2a79dd[_0x01dd('0x3d')],_0x2a79dd[_0x01dd('0x39')]);_0x37b329[_0x01dd('0x3e')]=_[_0x01dd('0x3c')](_0x2a79dd[_0x01dd('0x3d')],qs[_0x01dd('0x3f')](_0x3226e2[_0x01dd('0x39')][_0x01dd('0x3f')]));_0x37b329[_0x01dd('0x3e')]=_0x37b329[_0x01dd('0x3e')][_0x01dd('0x40')]?_0x37b329[_0x01dd('0x3e')]:_0x2a79dd[_0x01dd('0x3d')];if(_0x3226e2[_0x01dd('0x39')][_0x01dd('0x4a')]){_0x37b329[_0x01dd('0x4b')]=[{'all':!![]}];}_0x37b329=_[_0x01dd('0x44')]({},_0x37b329,_0x3226e2[_0x01dd('0x46')]);return db[_0x01dd('0x35')][_0x01dd('0x4c')](_0x37b329)['then'](handleEntityNotFound(_0x54412b,null))[_0x01dd('0x17')](respondWithResult(_0x54412b,null))[_0x01dd('0x4d')](handleError(_0x54412b,null));};exports[_0x01dd('0x4e')]=function(_0x17645f,_0x135d4a,_0x4be441){var _0x363f1d;return db['VoiceContext'][_0x01dd('0x4e')](_0x17645f['body'],{'raw':!![]})[_0x01dd('0x17')](function(_0x108026){_0x363f1d=_0x108026;return db[_0x01dd('0x35')]['findAll']({'raw':!![]});})[_0x01dd('0x17')](function(_0x55f397){var _0x54c17f=fs[_0x01dd('0x4f')](path['join'](config[_0x01dd('0x50')],'server/files/templates/context.ejs'),_0x01dd('0x51'));var _0x146f21=ejs[_0x01dd('0x52')](_0x54c17f,{'contexts':_0x55f397||[]});fs[_0x01dd('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x146f21);})[_0x01dd('0x17')](function(){return respondWithRpcPromise(_0x01dd('0x54'),_0x01dd('0x4e'),{'module':_0x01dd('0x55')});})[_0x01dd('0x17')](function(){var _0x584fd5=_0x17645f['user'][_0x01dd('0x2d')]({'plain':!![]});if(!_0x584fd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x584fd5[_0x01dd('0x56')]===_0x01dd('0x57')){var _0x193238=_0x363f1d[_0x01dd('0x2d')]({'plain':!![]});return db[_0x01dd('0x58')]['find']({'where':{'name':'Contexts','userProfileId':_0x584fd5['userProfileId']},'raw':!![]})[_0x01dd('0x17')](function(_0x5185af){if(_0x5185af&&_0x5185af['autoAssociation']===0x0){return db[_0x01dd('0x2f')][_0x01dd('0x4e')]({'name':_0x193238[_0x01dd('0x31')],'resourceId':_0x193238['id'],'type':_0x5185af[_0x01dd('0x31')],'sectionId':_0x5185af['id']},{})['then'](function(){return _0x363f1d;});}else{return _0x363f1d;}})[_0x01dd('0x4d')](function(_0x5dfa3b){logger[_0x01dd('0x1d')](_0x01dd('0x59'),_0x5dfa3b);throw _0x5dfa3b;});}return _0x363f1d;})[_0x01dd('0x17')](respondWithResult(_0x135d4a,0xc9))[_0x01dd('0x4d')](handleError(_0x135d4a,null));};exports[_0x01dd('0x2b')]=function(_0x2753fa,_0x221854,_0x48b9ca){var _0x2aea28;return db[_0x01dd('0x35')][_0x01dd('0x4c')]({'where':{'id':_0x2753fa[_0x01dd('0x48')]['id']}})['then'](handleEntityNotFound(_0x221854,null))[_0x01dd('0x17')](saveUpdates(_0x2753fa['body'],null))['then'](function(_0x483755){if(_0x483755){_0x2aea28=_0x483755;return db[_0x01dd('0x35')][_0x01dd('0x5a')]({'raw':!![]});}})[_0x01dd('0x17')](function(_0x3d876c){var _0x342b0f=fs['readFileSync'](path[_0x01dd('0x5b')](config[_0x01dd('0x50')],_0x01dd('0x5c')),_0x01dd('0x51'));var _0x34805c=ejs[_0x01dd('0x52')](_0x342b0f,{'contexts':_0x3d876c||[]});fs['writeFileSync'](_0x01dd('0x5d'),_0x34805c);})[_0x01dd('0x17')](function(){return respondWithRpcPromise('Reload',_0x01dd('0x2b'),{'module':_0x01dd('0x55')});})[_0x01dd('0x17')](function(){return _0x2aea28;})[_0x01dd('0x17')](respondWithResult(_0x221854,null))['catch'](handleError(_0x221854,null));};exports[_0x01dd('0x2c')]=function(_0x352450,_0x1b3378,_0x2aad36){var _0x34aaf8;return db[_0x01dd('0x35')][_0x01dd('0x4c')]({'where':{'id':_0x352450['params']['id']}})[_0x01dd('0x17')](handleEntityNotFound(_0x1b3378,null))[_0x01dd('0x17')](removeEntity(_0x1b3378,null))[_0x01dd('0x17')](function(){return db['VoiceContext'][_0x01dd('0x5a')]({'raw':!![]});})[_0x01dd('0x17')](function(_0x3b1ee0){var _0x450473=fs['readFileSync'](path[_0x01dd('0x5b')](config[_0x01dd('0x50')],_0x01dd('0x5c')),_0x01dd('0x51'));var _0x168d30=ejs[_0x01dd('0x52')](_0x450473,{'contexts':_0x3b1ee0});fs['writeFileSync'](_0x01dd('0x5d'),_0x168d30);return respondWithRpcPromise(_0x01dd('0x54'),'destroy',{'module':_0x01dd('0x55')});})[_0x01dd('0x4d')](handleError(_0x1b3378,null));}; \ No newline at end of file +var _0x85ba=['intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','Reload','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Contexts','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','filters'];(function(_0x4b4fbc,_0x1a4bce){var _0x249462=function(_0x1f1d1e){while(--_0x1f1d1e){_0x4b4fbc['push'](_0x4b4fbc['shift']());}};_0x249462(++_0x1a4bce);}(_0x85ba,0x91));var _0xa85b=function(_0x3313be,_0x42ec40){_0x3313be=_0x3313be-0x0;var _0x348cc8=_0x85ba[_0x3313be];return _0x348cc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa85b('0x0'));var zipdir=require(_0xa85b('0x1'));var jsonpatch=require(_0xa85b('0x2'));var rp=require(_0xa85b('0x3'));var moment=require(_0xa85b('0x4'));var BPromise=require(_0xa85b('0x5'));var Mustache=require(_0xa85b('0x6'));var util=require('util');var path=require(_0xa85b('0x7'));var sox=require(_0xa85b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa85b('0x9'));var _=require('lodash');var squel=require(_0xa85b('0xa'));var crypto=require(_0xa85b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa85b('0xc'));var querystring=require(_0xa85b('0xd'));var Papa=require('papaparse');var Redis=require(_0xa85b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa85b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa85b('0x10'))(_0xa85b('0x11'));var utils=require(_0xa85b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa85b('0x13'));var db=require(_0xa85b('0x14'))['db'];var jayson=require(_0xa85b('0x15'));var client=jayson[_0xa85b('0x16')][_0xa85b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2d78d5,_0x3ed6d3,_0x2f1f08,_0x405aa3){return new BPromise(function(_0x2b03f6,_0x214cec){var _0x7f2b73=_0x405aa3||client;return _0x7f2b73['request'](_0x2d78d5,_0x2f1f08)['then'](function(_0x4ad9b9){logger[_0xa85b('0x18')](_0xa85b('0x19'),_0x3ed6d3,_0xa85b('0x1a'));logger[_0xa85b('0x1b')](_0xa85b('0x1c'),_0x3ed6d3,_0xa85b('0x1a'),JSON[_0xa85b('0x1d')](_0x4ad9b9));if(_0x4ad9b9[_0xa85b('0x1e')]){if(_0x4ad9b9[_0xa85b('0x1e')][_0xa85b('0x1f')]===0x1f4){logger[_0xa85b('0x1e')](_0xa85b('0x19'),_0x3ed6d3,_0x4ad9b9['error'][_0xa85b('0x20')]);return _0x214cec(_0x4ad9b9['error'][_0xa85b('0x20')]);}logger['error'](_0xa85b('0x19'),_0x3ed6d3,_0x4ad9b9['error'][_0xa85b('0x20')]);return _0x2b03f6(_0x4ad9b9['error'][_0xa85b('0x20')]);}else{logger[_0xa85b('0x18')](_0xa85b('0x19'),_0x3ed6d3,_0xa85b('0x1a'));_0x2b03f6(_0x4ad9b9[_0xa85b('0x21')]['message']);}})[_0xa85b('0x22')](function(_0x2d87d4){logger[_0xa85b('0x1e')](_0xa85b('0x19'),_0x3ed6d3,_0x2d87d4);_0x214cec(_0x2d87d4);});});}function respondWithStatusCode(_0x5aa84e,_0x4eab0){_0x4eab0=_0x4eab0||0xcc;return function(_0x1f227b){if(_0x1f227b){return _0x5aa84e[_0xa85b('0x23')](_0x4eab0);}return _0x5aa84e['status'](_0x4eab0)['end']();};}function respondWithResult(_0x45d605,_0x19a7c4){_0x19a7c4=_0x19a7c4||0xc8;return function(_0xf61975){if(_0xf61975){return _0x45d605[_0xa85b('0x24')](_0x19a7c4)['json'](_0xf61975);}};}function respondWithFilteredResult(_0x2c8f3a,_0x207f02){return function(_0x1ba940){if(_0x1ba940){var _0x26b3b0=typeof _0x207f02[_0xa85b('0x25')]===_0xa85b('0x26')&&typeof _0x207f02[_0xa85b('0x27')]==='undefined';var _0x86a2e=_0x1ba940[_0xa85b('0x28')];var _0x1a4ab3=_0x26b3b0?0x0:_0x207f02['offset'];var _0x2643aa=_0x26b3b0?_0x1ba940[_0xa85b('0x28')]:_0x207f02[_0xa85b('0x25')]+_0x207f02[_0xa85b('0x27')];var _0x1093ac;if(_0x2643aa>=_0x86a2e){_0x2643aa=_0x86a2e;_0x1093ac=0xc8;}else{_0x1093ac=0xce;}_0x2c8f3a['status'](_0x1093ac);return _0x2c8f3a[_0xa85b('0x29')](_0xa85b('0x2a'),_0x1a4ab3+'-'+_0x2643aa+'/'+_0x86a2e)[_0xa85b('0x2b')](_0x1ba940);}return null;};}function patchUpdates(_0x4e79fb){return function(_0x1a2b0a){try{jsonpatch[_0xa85b('0x2c')](_0x1a2b0a,_0x4e79fb,!![]);}catch(_0x12f897){return BPromise['reject'](_0x12f897);}return _0x1a2b0a[_0xa85b('0x2d')]();};}function saveUpdates(_0x53ebcf,_0x265cfa){return function(_0x56e6ff){if(_0x56e6ff){return _0x56e6ff[_0xa85b('0x2e')](_0x53ebcf)[_0xa85b('0x2f')](function(_0x1d7a24){return _0x1d7a24;});}return null;};}function removeEntity(_0x4d758c,_0x4517b5){return function(_0x43481a){if(_0x43481a){return _0x43481a[_0xa85b('0x30')]()['then'](function(){var _0x1de9e4=_0x43481a[_0xa85b('0x31')]({'plain':!![]});var _0x38787c=_0xa85b('0x32');return db[_0xa85b('0x33')]['destroy']({'where':{'type':_0x38787c,'resourceId':_0x1de9e4['id']}})['then'](function(){return _0x43481a;});})[_0xa85b('0x2f')](function(){_0x4d758c[_0xa85b('0x24')](0xcc)[_0xa85b('0x34')]();});}};}function handleEntityNotFound(_0x13828b,_0x5f00ce){return function(_0x232fa6){if(!_0x232fa6){_0x13828b[_0xa85b('0x23')](0x194);}return _0x232fa6;};}function handleError(_0x1b707b,_0x40ba8e){_0x40ba8e=_0x40ba8e||0x1f4;return function(_0x473c04){logger[_0xa85b('0x1e')](_0x473c04[_0xa85b('0x35')]);if(_0x473c04['name']){delete _0x473c04[_0xa85b('0x36')];}_0x1b707b['status'](_0x40ba8e)[_0xa85b('0x37')](_0x473c04);};}exports[_0xa85b('0x38')]=function(_0x73b83a,_0x5d4858){var _0xbee269={},_0x4be7f8={},_0x37c3f9={'count':0x0,'rows':[]};var _0x50bcb0=_[_0xa85b('0x39')](db[_0xa85b('0x3a')][_0xa85b('0x3b')],function(_0x20c1f7){return{'name':_0x20c1f7[_0xa85b('0x3c')],'type':_0x20c1f7[_0xa85b('0x3d')][_0xa85b('0x3e')]};});_0x4be7f8[_0xa85b('0x3f')]=_[_0xa85b('0x39')](_0x50bcb0,'name');_0x4be7f8['query']=_['keys'](_0x73b83a['query']);_0x4be7f8[_0xa85b('0x40')]=_[_0xa85b('0x41')](_0x4be7f8['model'],_0x4be7f8['query']);_0xbee269[_0xa85b('0x42')]=_[_0xa85b('0x41')](_0x4be7f8[_0xa85b('0x3f')],qs[_0xa85b('0x43')](_0x73b83a[_0xa85b('0x44')][_0xa85b('0x43')]));_0xbee269[_0xa85b('0x42')]=_0xbee269[_0xa85b('0x42')][_0xa85b('0x45')]?_0xbee269[_0xa85b('0x42')]:_0x4be7f8[_0xa85b('0x3f')];if(!_0x73b83a[_0xa85b('0x44')][_0xa85b('0x46')]('nolimit')){_0xbee269[_0xa85b('0x27')]=qs[_0xa85b('0x27')](_0x73b83a[_0xa85b('0x44')]['limit']);_0xbee269[_0xa85b('0x25')]=qs[_0xa85b('0x25')](_0x73b83a[_0xa85b('0x44')]['offset']);}_0xbee269[_0xa85b('0x47')]=qs[_0xa85b('0x48')](_0x73b83a[_0xa85b('0x44')][_0xa85b('0x48')]);_0xbee269[_0xa85b('0x49')]=qs[_0xa85b('0x40')](_['pick'](_0x73b83a[_0xa85b('0x44')],_0x4be7f8[_0xa85b('0x40')]),_0x50bcb0);if(_0x73b83a['query'][_0xa85b('0x4a')]){_0xbee269[_0xa85b('0x49')]=_[_0xa85b('0x4b')](_0xbee269[_0xa85b('0x49')],{'$or':_['map'](_0x50bcb0,function(_0x254c1e){if(_0x254c1e['type']!==_0xa85b('0x4c')){var _0x112a45={};_0x112a45[_0x254c1e[_0xa85b('0x36')]]={'$like':'%'+_0x73b83a['query'][_0xa85b('0x4a')]+'%'};return _0x112a45;}})});}_0xbee269=_[_0xa85b('0x4b')]({},_0xbee269,_0x73b83a['options']);var _0xa8b5e4={'where':_0xbee269[_0xa85b('0x49')]};return db[_0xa85b('0x3a')][_0xa85b('0x28')](_0xa8b5e4)['then'](function(_0x5499e1){_0x37c3f9[_0xa85b('0x28')]=_0x5499e1;if(_0x73b83a[_0xa85b('0x44')][_0xa85b('0x4d')]){_0xbee269[_0xa85b('0x4e')]=[{'all':!![]}];}return db[_0xa85b('0x3a')][_0xa85b('0x4f')](_0xbee269);})['then'](function(_0x1109b1){_0x37c3f9[_0xa85b('0x50')]=_0x1109b1;return _0x37c3f9;})[_0xa85b('0x2f')](respondWithFilteredResult(_0x5d4858,_0xbee269))[_0xa85b('0x22')](handleError(_0x5d4858,null));};exports[_0xa85b('0x51')]=function(_0x313587,_0x13676e){var _0x45bde0={'raw':![],'where':{'id':_0x313587[_0xa85b('0x52')]['id']}},_0x59d0b7={};_0x59d0b7[_0xa85b('0x3f')]=_[_0xa85b('0x53')](db['VoiceContext'][_0xa85b('0x3b')]);_0x59d0b7[_0xa85b('0x44')]=_['keys'](_0x313587[_0xa85b('0x44')]);_0x59d0b7['filters']=_[_0xa85b('0x41')](_0x59d0b7[_0xa85b('0x3f')],_0x59d0b7[_0xa85b('0x44')]);_0x45bde0[_0xa85b('0x42')]=_['intersection'](_0x59d0b7[_0xa85b('0x3f')],qs[_0xa85b('0x43')](_0x313587[_0xa85b('0x44')][_0xa85b('0x43')]));_0x45bde0['attributes']=_0x45bde0[_0xa85b('0x42')][_0xa85b('0x45')]?_0x45bde0['attributes']:_0x59d0b7[_0xa85b('0x3f')];if(_0x313587[_0xa85b('0x44')][_0xa85b('0x4d')]){_0x45bde0[_0xa85b('0x4e')]=[{'all':!![]}];}_0x45bde0=_['merge']({},_0x45bde0,_0x313587[_0xa85b('0x54')]);return db[_0xa85b('0x3a')][_0xa85b('0x55')](_0x45bde0)['then'](handleEntityNotFound(_0x13676e,null))['then'](respondWithResult(_0x13676e,null))[_0xa85b('0x22')](handleError(_0x13676e,null));};exports[_0xa85b('0x56')]=function(_0x15eb62,_0x3a3568,_0x63d1fa){var _0x35ac78;return db['VoiceContext'][_0xa85b('0x56')](_0x15eb62[_0xa85b('0x57')],{'raw':!![]})[_0xa85b('0x2f')](function(_0x390ebf){_0x35ac78=_0x390ebf;return db['VoiceContext'][_0xa85b('0x4f')]({'raw':!![]});})['then'](function(_0x1262b){var _0x335f9b=fs[_0xa85b('0x58')](path[_0xa85b('0x59')](config[_0xa85b('0x5a')],_0xa85b('0x5b')),_0xa85b('0x5c'));var _0x330a63=ejs['render'](_0x335f9b,{'contexts':_0x1262b||[]});fs[_0xa85b('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x330a63);})['then'](function(){return respondWithRpcPromise('Reload',_0xa85b('0x56'),{'module':'chan_sip.so'});})['then'](function(){var _0x3692fa=_0x15eb62[_0xa85b('0x5e')]['get']({'plain':!![]});if(!_0x3692fa)throw new Error(_0xa85b('0x5f'));if(_0x3692fa[_0xa85b('0x60')]===_0xa85b('0x5e')){var _0x1ca8a8=_0x35ac78[_0xa85b('0x31')]({'plain':!![]});return db[_0xa85b('0x61')]['find']({'where':{'name':'Contexts','userProfileId':_0x3692fa[_0xa85b('0x62')]},'raw':!![]})[_0xa85b('0x2f')](function(_0x3898c0){if(_0x3898c0&&_0x3898c0[_0xa85b('0x63')]===0x0){return db['UserProfileResource'][_0xa85b('0x56')]({'name':_0x1ca8a8['name'],'resourceId':_0x1ca8a8['id'],'type':_0x3898c0[_0xa85b('0x36')],'sectionId':_0x3898c0['id']},{})[_0xa85b('0x2f')](function(){return _0x35ac78;});}else{return _0x35ac78;}})[_0xa85b('0x22')](function(_0x73174e){logger[_0xa85b('0x1e')](_0xa85b('0x64'),_0x73174e);throw _0x73174e;});}return _0x35ac78;})[_0xa85b('0x2f')](respondWithResult(_0x3a3568,0xc9))[_0xa85b('0x22')](handleError(_0x3a3568,null));};exports[_0xa85b('0x2e')]=function(_0x9cb117,_0xc4d732,_0x2853c6){var _0x4f4166;return db[_0xa85b('0x3a')][_0xa85b('0x55')]({'where':{'id':_0x9cb117[_0xa85b('0x52')]['id']}})[_0xa85b('0x2f')](handleEntityNotFound(_0xc4d732,null))['then'](saveUpdates(_0x9cb117['body'],null))[_0xa85b('0x2f')](function(_0x54df65){if(_0x54df65){_0x4f4166=_0x54df65;return db[_0xa85b('0x3a')][_0xa85b('0x4f')]({'raw':!![]});}})[_0xa85b('0x2f')](function(_0x2ba415){var _0x47ee9f=fs[_0xa85b('0x58')](path[_0xa85b('0x59')](config[_0xa85b('0x5a')],'server/files/templates/context.ejs'),_0xa85b('0x5c'));var _0x183213=ejs[_0xa85b('0x65')](_0x47ee9f,{'contexts':_0x2ba415||[]});fs[_0xa85b('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x183213);})['then'](function(){return respondWithRpcPromise(_0xa85b('0x66'),_0xa85b('0x2e'),{'module':_0xa85b('0x67')});})[_0xa85b('0x2f')](function(){return _0x4f4166;})['then'](respondWithResult(_0xc4d732,null))['catch'](handleError(_0xc4d732,null));};exports['destroy']=function(_0x518b52,_0x48b323,_0x2c0b6c){var _0x260a3e;return db[_0xa85b('0x3a')][_0xa85b('0x55')]({'where':{'id':_0x518b52['params']['id']}})['then'](handleEntityNotFound(_0x48b323,null))[_0xa85b('0x2f')](removeEntity(_0x48b323,null))[_0xa85b('0x2f')](function(){return db[_0xa85b('0x3a')][_0xa85b('0x4f')]({'raw':!![]});})[_0xa85b('0x2f')](function(_0x1f82a0){var _0x306d65=fs['readFileSync'](path['join'](config[_0xa85b('0x5a')],'server/files/templates/context.ejs'),_0xa85b('0x5c'));var _0x28861b=ejs[_0xa85b('0x65')](_0x306d65,{'contexts':_0x1f82a0});fs[_0xa85b('0x5d')](_0xa85b('0x68'),_0x28861b);return respondWithRpcPromise(_0xa85b('0x66'),_0xa85b('0x30'),{'module':_0xa85b('0x67')});})[_0xa85b('0x22')](handleError(_0x48b323,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fd63df7..5ffb596 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 _0x19bd=['./voiceContext.attributes','VoiceContext','voice_contexts','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4c054b,_0x56ebdf){var _0x2a3b76=function(_0x25a2c4){while(--_0x25a2c4){_0x4c054b['push'](_0x4c054b['shift']());}};_0x2a3b76(++_0x56ebdf);}(_0x19bd,0xe4));var _0xd19b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x19bd[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xd19b('0x0'));var logger=require(_0xd19b('0x1'))(_0xd19b('0x2'));var moment=require(_0xd19b('0x3'));var BPromise=require('bluebird');var rp=require(_0xd19b('0x4'));var fs=require('fs');var path=require(_0xd19b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd19b('0x6'));module['exports']=function(_0x57e10c,_0x1f0166){return _0x57e10c['define'](_0xd19b('0x7'),attributes,{'tableName':_0xd19b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e5f=['voice_contexts','util','api','bluebird','path','rimraf','exports','define'];(function(_0x8aa8b,_0x5283c0){var _0x44d31f=function(_0x5e9c69){while(--_0x5e9c69){_0x8aa8b['push'](_0x8aa8b['shift']());}};_0x44d31f(++_0x5283c0);}(_0x6e5f,0x139));var _0xf6e5=function(_0x167aa5,_0xb34328){_0x167aa5=_0x167aa5-0x0;var _0xc9bc62=_0x6e5f[_0x167aa5];return _0xc9bc62;};'use strict';var _=require('lodash');var util=require(_0xf6e5('0x0'));var logger=require('../../config/logger')(_0xf6e5('0x1'));var moment=require('moment');var BPromise=require(_0xf6e5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6e5('0x3'));var rimraf=require(_0xf6e5('0x4'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xf6e5('0x5')]=function(_0x3a04a2,_0x62f928){return _0x3a04a2[_0xf6e5('0x6')]('VoiceContext',attributes,{'tableName':_0xf6e5('0x7'),'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 aa4dfac..c260d55 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 _0xb4c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment'];(function(_0x5326df,_0x4babd6){var _0x6a86fd=function(_0x53f53c){while(--_0x53f53c){_0x5326df['push'](_0x5326df['shift']());}};_0x6a86fd(++_0x4babd6);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x4aaa48,_0x720763){_0x4aaa48=_0x4aaa48-0x0;var _0x5dca80=_0xb4c2[_0x4aaa48];return _0x5dca80;};'use strict';var _=require('lodash');var util=require(_0x2b4c('0x0'));var moment=require(_0x2b4c('0x1'));var BPromise=require(_0x2b4c('0x2'));var rs=require(_0x2b4c('0x3'));var fs=require('fs');var Redis=require(_0x2b4c('0x4'));var db=require(_0x2b4c('0x5'))['db'];var utils=require(_0x2b4c('0x6'));var logger=require(_0x2b4c('0x7'))(_0x2b4c('0x8'));var config=require(_0x2b4c('0x9'));var jayson=require(_0x2b4c('0xa'));var client=jayson['client'][_0x2b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x519953,_0xd1f8e6,_0x5f529b){return new BPromise(function(_0x4251f8,_0x42590a){return client['request'](_0x519953,_0x5f529b)[_0x2b4c('0xc')](function(_0x3445c4){logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,'request\x20sent');logger[_0x2b4c('0xf')](_0x2b4c('0x10'),_0xd1f8e6,_0x2b4c('0x11'),JSON[_0x2b4c('0x12')](_0x3445c4));if(_0x3445c4[_0x2b4c('0x13')]){if(_0x3445c4['error'][_0x2b4c('0x14')]===0x1f4){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);return _0x42590a(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')]['message']);return _0x4251f8(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}else{logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,_0x2b4c('0x11'));_0x4251f8(_0x3445c4[_0x2b4c('0x16')][_0x2b4c('0x15')]);}})['catch'](function(_0x45f8dd){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x45f8dd);_0x42590a(_0x45f8dd);});});} \ No newline at end of file +var _0xbaca=['jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaca,0xfc));var _0xabac=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0xbaca[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0xabac('0x0'));var util=require(_0xabac('0x1'));var moment=require('moment');var BPromise=require(_0xabac('0x2'));var rs=require(_0xabac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xabac('0x5'))(_0xabac('0x6'));var config=require(_0xabac('0x7'));var jayson=require(_0xabac('0x8'));var client=jayson[_0xabac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe9ff,_0x2e7faa,_0x683dde){return new BPromise(function(_0x4fa18f,_0x5b6f00){return client[_0xabac('0xa')](_0x4fe9ff,_0x683dde)[_0xabac('0xb')](function(_0x42f38a){logger['info'](_0xabac('0xc'),_0x2e7faa,_0xabac('0xd'));logger['debug'](_0xabac('0xe'),_0x2e7faa,'request\x20sent',JSON[_0xabac('0xf')](_0x42f38a));if(_0x42f38a[_0xabac('0x10')]){if(_0x42f38a[_0xabac('0x10')]['code']===0x1f4){logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x42f38a[_0xabac('0x10')]['message']);return _0x5b6f00(_0x42f38a['error']['message']);}logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x42f38a[_0xabac('0x10')][_0xabac('0x11')]);return _0x4fa18f(_0x42f38a['error'][_0xabac('0x11')]);}else{logger[_0xabac('0x12')](_0xabac('0xc'),_0x2e7faa,_0xabac('0xd'));_0x4fa18f(_0x42f38a['result'][_0xabac('0x11')]);}})[_0xabac('0x13')](function(_0x8f07d4){logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x8f07d4);_0x5b6f00(_0x8f07d4);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9c7229e..75d33a7 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 _0x8f2f=['post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x8f2f[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0xf8f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf8f2('0x1'));var express=require(_0xf8f2('0x2'));var router=express[_0xf8f2('0x3')]();var fs_extra=require(_0xf8f2('0x4'));var auth=require(_0xf8f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8f2('0x6'));var controller=require('./voiceDialReport.controller');router[_0xf8f2('0x7')]('/',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0x9')]);router[_0xf8f2('0x7')]('/describe',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xa')]);router[_0xf8f2('0x7')]('/:id',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xb')]);router[_0xf8f2('0xc')]('/',auth[_0xf8f2('0x8')](),controller['create']);router['put'](_0xf8f2('0xd'),auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xe')]);router[_0xf8f2('0xf')](_0xf8f2('0xd'),auth[_0xf8f2('0x8')](),controller[_0xf8f2('0x10')]);module[_0xf8f2('0x11')]=router; \ No newline at end of file +var _0x9d46=['show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x1c4537,_0x263676){var _0x23c2f9=function(_0x1f4641){while(--_0x1f4641){_0x1c4537['push'](_0x1c4537['shift']());}};_0x23c2f9(++_0x263676);}(_0x9d46,0x1f4));var _0x69d4=function(_0x4cf58c,_0x2f3edf){_0x4cf58c=_0x4cf58c-0x0;var _0x1a110c=_0x9d46[_0x4cf58c];return _0x1a110c;};'use strict';var multer=require(_0x69d4('0x0'));var util=require(_0x69d4('0x1'));var path=require(_0x69d4('0x2'));var timeout=require(_0x69d4('0x3'));var express=require(_0x69d4('0x4'));var router=express[_0x69d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x69d4('0x6'));var interaction=require(_0x69d4('0x7'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x69d4('0x8')]('/',auth[_0x69d4('0x9')](),controller[_0x69d4('0xa')]);router[_0x69d4('0x8')]('/describe',auth[_0x69d4('0x9')](),controller[_0x69d4('0xb')]);router['get'](_0x69d4('0xc'),auth[_0x69d4('0x9')](),controller[_0x69d4('0xd')]);router[_0x69d4('0xe')]('/',auth[_0x69d4('0x9')](),controller['create']);router[_0x69d4('0xf')](_0x69d4('0xc'),auth[_0x69d4('0x9')](),controller[_0x69d4('0x10')]);router[_0x69d4('0x11')](_0x69d4('0xc'),auth['isAuthenticated'](),controller[_0x69d4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 63a0c3b..537c89a 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 _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x56223f,_0x4eba12){var _0x2892f4=function(_0xc93462){while(--_0xc93462){_0x56223f['push'](_0x56223f['shift']());}};_0x2892f4(++_0x4eba12);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3764bd,_0x2fa892){_0x3764bd=_0x3764bd-0x0;var _0x511474=_0xd6d6[_0x3764bd];return _0x511474;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0xf2d20c,_0x3773f3){var _0x5d4d8c=function(_0x1ce453){while(--_0x1ce453){_0xf2d20c['push'](_0xf2d20c['shift']());}};_0x5d4d8c(++_0x3773f3);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8c87985..1ae03a4 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 _0xf872=['rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','filter','options','includeAll','findAll'];(function(_0x55a38a,_0x1ed975){var _0x133484=function(_0xd2f86b){while(--_0xd2f86b){_0x55a38a['push'](_0x55a38a['shift']());}};_0x133484(++_0x1ed975);}(_0xf872,0x18a));var _0x2f87=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xf872[_0x20ebb5];return _0x487182;};'use strict';var emlformat=require(_0x2f87('0x0'));var rimraf=require(_0x2f87('0x1'));var zipdir=require(_0x2f87('0x2'));var jsonpatch=require(_0x2f87('0x3'));var rp=require(_0x2f87('0x4'));var moment=require(_0x2f87('0x5'));var BPromise=require(_0x2f87('0x6'));var Mustache=require('mustache');var util=require(_0x2f87('0x7'));var path=require(_0x2f87('0x8'));var sox=require('sox');var csv=require(_0x2f87('0x9'));var ejs=require(_0x2f87('0xa'));var fs=require('fs');var fs_extra=require(_0x2f87('0xb'));var _=require(_0x2f87('0xc'));var squel=require(_0x2f87('0xd'));var crypto=require(_0x2f87('0xe'));var jsforce=require(_0x2f87('0xf'));var deskjs=require(_0x2f87('0x10'));var toCsv=require(_0x2f87('0x9'));var querystring=require('querystring');var Papa=require(_0x2f87('0x11'));var Redis=require(_0x2f87('0x12'));var authService=require(_0x2f87('0x13'));var qs=require(_0x2f87('0x14'));var as=require(_0x2f87('0x15'));var hardwareService=require(_0x2f87('0x16'));var logger=require(_0x2f87('0x17'))(_0x2f87('0x18'));var utils=require(_0x2f87('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eb6c0,_0x5ab35f){_0x5ab35f=_0x5ab35f||0xcc;return function(_0x82ddcd){if(_0x82ddcd){return _0x4eb6c0[_0x2f87('0x1a')](_0x5ab35f);}return _0x4eb6c0['status'](_0x5ab35f)[_0x2f87('0x1b')]();};}function respondWithResult(_0x53da1d,_0x976b25){_0x976b25=_0x976b25||0xc8;return function(_0x5c0362){if(_0x5c0362){return _0x53da1d[_0x2f87('0x1c')](_0x976b25)[_0x2f87('0x1d')](_0x5c0362);}};}function respondWithFilteredResult(_0x306575,_0x4c4850){return function(_0x19bdaf){if(_0x19bdaf){var _0x351104=typeof _0x4c4850[_0x2f87('0x1e')]===_0x2f87('0x1f')&&typeof _0x4c4850[_0x2f87('0x20')]===_0x2f87('0x1f');var _0x35a9e9=_0x19bdaf[_0x2f87('0x21')];var _0x52b3eb=_0x351104?0x0:_0x4c4850[_0x2f87('0x1e')];var _0xb5ac4e=_0x351104?_0x19bdaf['count']:_0x4c4850[_0x2f87('0x1e')]+_0x4c4850['limit'];var _0x18130d;if(_0xb5ac4e>=_0x35a9e9){_0xb5ac4e=_0x35a9e9;_0x18130d=0xc8;}else{_0x18130d=0xce;}_0x306575[_0x2f87('0x1c')](_0x18130d);return _0x306575[_0x2f87('0x22')]('Content-Range',_0x52b3eb+'-'+_0xb5ac4e+'/'+_0x35a9e9)[_0x2f87('0x1d')](_0x19bdaf);}return null;};}function patchUpdates(_0x233bee){return function(_0x4e7838){try{jsonpatch[_0x2f87('0x23')](_0x4e7838,_0x233bee,!![]);}catch(_0x54c477){return BPromise[_0x2f87('0x24')](_0x54c477);}return _0x4e7838[_0x2f87('0x25')]();};}function saveUpdates(_0x467711,_0x1bd7f5){return function(_0x234f8d){if(_0x234f8d){return _0x234f8d[_0x2f87('0x26')](_0x467711)['then'](function(_0x46f866){return _0x46f866;});}return null;};}function removeEntity(_0x36d706,_0x3e646f){return function(_0x245dc8){if(_0x245dc8){return _0x245dc8[_0x2f87('0x27')]()[_0x2f87('0x28')](function(){_0x36d706[_0x2f87('0x1c')](0xcc)[_0x2f87('0x1b')]();});}};}function handleEntityNotFound(_0x42e8b7,_0x42ea52){return function(_0x4eee58){if(!_0x4eee58){_0x42e8b7[_0x2f87('0x1a')](0x194);}return _0x4eee58;};}function handleError(_0xa397b4,_0x30ac1a){_0x30ac1a=_0x30ac1a||0x1f4;return function(_0x2b702f){logger[_0x2f87('0x29')](_0x2b702f[_0x2f87('0x2a')]);if(_0x2b702f['name']){delete _0x2b702f[_0x2f87('0x2b')];}_0xa397b4[_0x2f87('0x1c')](_0x30ac1a)[_0x2f87('0x2c')](_0x2b702f);};}exports[_0x2f87('0x2d')]=function(_0x2c5ec1,_0x563e71){var _0x57d474={},_0x127c79={},_0x53f26f={'count':0x0,'rows':[]};var _0x11fc68=_[_0x2f87('0x2e')](db[_0x2f87('0x2f')][_0x2f87('0x30')],function(_0x43fef5){return{'name':_0x43fef5[_0x2f87('0x31')],'type':_0x43fef5[_0x2f87('0x32')][_0x2f87('0x33')]};});_0x127c79[_0x2f87('0x34')]=_['map'](_0x11fc68,_0x2f87('0x2b'));_0x127c79[_0x2f87('0x35')]=_[_0x2f87('0x36')](_0x2c5ec1[_0x2f87('0x35')]);_0x127c79[_0x2f87('0x37')]=_['intersection'](_0x127c79[_0x2f87('0x34')],_0x127c79['query']);_0x57d474['attributes']=_[_0x2f87('0x38')](_0x127c79[_0x2f87('0x34')],qs[_0x2f87('0x39')](_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x39')]));_0x57d474[_0x2f87('0x3a')]=_0x57d474[_0x2f87('0x3a')]['length']?_0x57d474[_0x2f87('0x3a')]:_0x127c79['model'];if(!_0x2c5ec1[_0x2f87('0x35')]['hasOwnProperty']('nolimit')){_0x57d474[_0x2f87('0x20')]=qs[_0x2f87('0x20')](_0x2c5ec1['query'][_0x2f87('0x20')]);_0x57d474[_0x2f87('0x1e')]=qs['offset'](_0x2c5ec1[_0x2f87('0x35')]['offset']);}_0x57d474[_0x2f87('0x3b')]=qs['sort'](_0x2c5ec1['query'][_0x2f87('0x3c')]);_0x57d474[_0x2f87('0x3d')]=qs[_0x2f87('0x37')](_[_0x2f87('0x3e')](_0x2c5ec1[_0x2f87('0x35')],_0x127c79['filters']),_0x11fc68);if(_0x2c5ec1[_0x2f87('0x35')]['filter']){_0x57d474[_0x2f87('0x3d')]=_[_0x2f87('0x3f')](_0x57d474['where'],{'$or':_[_0x2f87('0x2e')](_0x11fc68,function(_0x557ec2){if(_0x557ec2[_0x2f87('0x32')]!=='VIRTUAL'){var _0x1ec217={};_0x1ec217[_0x557ec2['name']]={'$like':'%'+_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x40')]+'%'};return _0x1ec217;}})});}_0x57d474=_[_0x2f87('0x3f')]({},_0x57d474,_0x2c5ec1[_0x2f87('0x41')]);var _0xee86ea={'where':_0x57d474[_0x2f87('0x3d')]};return db[_0x2f87('0x2f')][_0x2f87('0x21')](_0xee86ea)[_0x2f87('0x28')](function(_0x4f57c1){_0x53f26f[_0x2f87('0x21')]=_0x4f57c1;if(_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x42')]){_0x57d474['include']=[{'all':!![]}];}return db[_0x2f87('0x2f')][_0x2f87('0x43')](_0x57d474);})[_0x2f87('0x28')](function(_0x5a93b4){_0x53f26f[_0x2f87('0x44')]=_0x5a93b4;return _0x53f26f;})['then'](respondWithFilteredResult(_0x563e71,_0x57d474))[_0x2f87('0x45')](handleError(_0x563e71,null));};exports[_0x2f87('0x46')]=function(_0x216da9,_0x4ae7d5){var _0x4f1cb8={'raw':!![],'where':{'id':_0x216da9['params']['id']}},_0x21d994={};_0x21d994['model']=_[_0x2f87('0x36')](db[_0x2f87('0x2f')][_0x2f87('0x30')]);_0x21d994[_0x2f87('0x35')]=_[_0x2f87('0x36')](_0x216da9['query']);_0x21d994[_0x2f87('0x37')]=_[_0x2f87('0x38')](_0x21d994[_0x2f87('0x34')],_0x21d994[_0x2f87('0x35')]);_0x4f1cb8[_0x2f87('0x3a')]=_['intersection'](_0x21d994[_0x2f87('0x34')],qs[_0x2f87('0x39')](_0x216da9[_0x2f87('0x35')][_0x2f87('0x39')]));_0x4f1cb8['attributes']=_0x4f1cb8[_0x2f87('0x3a')][_0x2f87('0x47')]?_0x4f1cb8['attributes']:_0x21d994[_0x2f87('0x34')];if(_0x216da9['query'][_0x2f87('0x42')]){_0x4f1cb8['include']=[{'all':!![]}];}_0x4f1cb8=_['merge']({},_0x4f1cb8,_0x216da9[_0x2f87('0x41')]);return db[_0x2f87('0x2f')][_0x2f87('0x48')](_0x4f1cb8)['then'](handleEntityNotFound(_0x4ae7d5,null))[_0x2f87('0x28')](respondWithResult(_0x4ae7d5,null))['catch'](handleError(_0x4ae7d5,null));};exports[_0x2f87('0x49')]=function(_0x561b7e,_0x206863){return db[_0x2f87('0x2f')][_0x2f87('0x49')](_0x561b7e[_0x2f87('0x4a')],{})[_0x2f87('0x28')](respondWithResult(_0x206863,0xc9))[_0x2f87('0x45')](handleError(_0x206863,null));};exports[_0x2f87('0x26')]=function(_0x11b8c5,_0x10b43d){if(_0x11b8c5['body']['id']){delete _0x11b8c5[_0x2f87('0x4a')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x11b8c5[_0x2f87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10b43d,null))[_0x2f87('0x28')](saveUpdates(_0x11b8c5[_0x2f87('0x4a')],null))['then'](respondWithResult(_0x10b43d,null))[_0x2f87('0x45')](handleError(_0x10b43d,null));};exports[_0x2f87('0x27')]=function(_0x373984,_0x2a51a9){return db[_0x2f87('0x2f')][_0x2f87('0x48')]({'where':{'id':_0x373984[_0x2f87('0x4b')]['id']}})[_0x2f87('0x28')](handleEntityNotFound(_0x2a51a9,null))[_0x2f87('0x28')](removeEntity(_0x2a51a9,null))['catch'](handleError(_0x2a51a9,null));};exports[_0x2f87('0x4c')]=function(_0x3007e7,_0x1052d){return db['VoiceDialReport'][_0x2f87('0x4c')]()[_0x2f87('0x28')](respondWithResult(_0x1052d,null))[_0x2f87('0x45')](handleError(_0x1052d,null));}; \ No newline at end of file +var _0x062c=['jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','undefined','offset','count','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x37add7,_0x396960){var _0x41053d=function(_0x242477){while(--_0x242477){_0x37add7['push'](_0x37add7['shift']());}};_0x41053d(++_0x396960);}(_0x062c,0x1f4));var _0xc062=function(_0x2239b7,_0x8b8b71){_0x2239b7=_0x2239b7-0x0;var _0x446131=_0x062c[_0x2239b7];return _0x446131;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc062('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc062('0x1'));var rp=require('request-promise');var moment=require(_0xc062('0x2'));var BPromise=require(_0xc062('0x3'));var Mustache=require(_0xc062('0x4'));var util=require('util');var path=require(_0xc062('0x5'));var sox=require(_0xc062('0x6'));var csv=require(_0xc062('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc062('0x8'));var _=require(_0xc062('0x9'));var squel=require('squel');var crypto=require(_0xc062('0xa'));var jsforce=require(_0xc062('0xb'));var deskjs=require(_0xc062('0xc'));var toCsv=require(_0xc062('0x7'));var querystring=require(_0xc062('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc062('0xe'));var as=require(_0xc062('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc062('0x10'))(_0xc062('0x11'));var utils=require(_0xc062('0x12'));var config=require(_0xc062('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc062('0x14'))['db'];function respondWithStatusCode(_0x19c104,_0x5692c9){_0x5692c9=_0x5692c9||0xcc;return function(_0x3bd55a){if(_0x3bd55a){return _0x19c104['sendStatus'](_0x5692c9);}return _0x19c104[_0xc062('0x15')](_0x5692c9)[_0xc062('0x16')]();};}function respondWithResult(_0x2eac0b,_0x13c44a){_0x13c44a=_0x13c44a||0xc8;return function(_0x1cf8ef){if(_0x1cf8ef){return _0x2eac0b[_0xc062('0x15')](_0x13c44a)['json'](_0x1cf8ef);}};}function respondWithFilteredResult(_0x2b7f83,_0x465846){return function(_0x450a50){if(_0x450a50){var _0x2abd11=typeof _0x465846['offset']==='undefined'&&typeof _0x465846[_0xc062('0x17')]===_0xc062('0x18');var _0x505b97=_0x450a50['count'];var _0x51b21c=_0x2abd11?0x0:_0x465846[_0xc062('0x19')];var _0x568f43=_0x2abd11?_0x450a50[_0xc062('0x1a')]:_0x465846[_0xc062('0x19')]+_0x465846[_0xc062('0x17')];var _0x10956e;if(_0x568f43>=_0x505b97){_0x568f43=_0x505b97;_0x10956e=0xc8;}else{_0x10956e=0xce;}_0x2b7f83['status'](_0x10956e);return _0x2b7f83[_0xc062('0x1b')](_0xc062('0x1c'),_0x51b21c+'-'+_0x568f43+'/'+_0x505b97)[_0xc062('0x1d')](_0x450a50);}return null;};}function patchUpdates(_0x7c43ae){return function(_0x17fe36){try{jsonpatch['apply'](_0x17fe36,_0x7c43ae,!![]);}catch(_0x365cdf){return BPromise[_0xc062('0x1e')](_0x365cdf);}return _0x17fe36[_0xc062('0x1f')]();};}function saveUpdates(_0x596571,_0x64b07d){return function(_0x5d538d){if(_0x5d538d){return _0x5d538d[_0xc062('0x20')](_0x596571)['then'](function(_0x1091b0){return _0x1091b0;});}return null;};}function removeEntity(_0x545ca6,_0x1fcbd3){return function(_0x712fe6){if(_0x712fe6){return _0x712fe6[_0xc062('0x21')]()[_0xc062('0x22')](function(){_0x545ca6[_0xc062('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22dbdb,_0x4767bc){return function(_0x302217){if(!_0x302217){_0x22dbdb[_0xc062('0x23')](0x194);}return _0x302217;};}function handleError(_0x38ba65,_0x39b6e9){_0x39b6e9=_0x39b6e9||0x1f4;return function(_0x3b3a73){logger[_0xc062('0x24')](_0x3b3a73[_0xc062('0x25')]);if(_0x3b3a73['name']){delete _0x3b3a73[_0xc062('0x26')];}_0x38ba65[_0xc062('0x15')](_0x39b6e9)[_0xc062('0x27')](_0x3b3a73);};}exports['index']=function(_0x5db094,_0x4d4c4c){var _0x513932={},_0x406b27={},_0x379afb={'count':0x0,'rows':[]};var _0x414bb3=_['map'](db['VoiceDialReport'][_0xc062('0x28')],function(_0x25dd82){return{'name':_0x25dd82[_0xc062('0x29')],'type':_0x25dd82['type'][_0xc062('0x2a')]};});_0x406b27['model']=_[_0xc062('0x2b')](_0x414bb3,_0xc062('0x26'));_0x406b27[_0xc062('0x2c')]=_[_0xc062('0x2d')](_0x5db094['query']);_0x406b27[_0xc062('0x2e')]=_[_0xc062('0x2f')](_0x406b27[_0xc062('0x30')],_0x406b27['query']);_0x513932[_0xc062('0x31')]=_[_0xc062('0x2f')](_0x406b27['model'],qs['fields'](_0x5db094[_0xc062('0x2c')]['fields']));_0x513932[_0xc062('0x31')]=_0x513932[_0xc062('0x31')]['length']?_0x513932[_0xc062('0x31')]:_0x406b27[_0xc062('0x30')];if(!_0x5db094[_0xc062('0x2c')][_0xc062('0x32')](_0xc062('0x33'))){_0x513932['limit']=qs[_0xc062('0x17')](_0x5db094['query'][_0xc062('0x17')]);_0x513932[_0xc062('0x19')]=qs[_0xc062('0x19')](_0x5db094[_0xc062('0x2c')][_0xc062('0x19')]);}_0x513932[_0xc062('0x34')]=qs[_0xc062('0x35')](_0x5db094[_0xc062('0x2c')][_0xc062('0x35')]);_0x513932[_0xc062('0x36')]=qs[_0xc062('0x2e')](_['pick'](_0x5db094[_0xc062('0x2c')],_0x406b27[_0xc062('0x2e')]),_0x414bb3);if(_0x5db094[_0xc062('0x2c')][_0xc062('0x37')]){_0x513932[_0xc062('0x36')]=_[_0xc062('0x38')](_0x513932['where'],{'$or':_[_0xc062('0x2b')](_0x414bb3,function(_0x346b4a){if(_0x346b4a[_0xc062('0x39')]!==_0xc062('0x3a')){var _0x2d186e={};_0x2d186e[_0x346b4a[_0xc062('0x26')]]={'$like':'%'+_0x5db094[_0xc062('0x2c')]['filter']+'%'};return _0x2d186e;}})});}_0x513932=_[_0xc062('0x38')]({},_0x513932,_0x5db094[_0xc062('0x3b')]);var _0x17b8fc={'where':_0x513932[_0xc062('0x36')]};return db[_0xc062('0x3c')][_0xc062('0x1a')](_0x17b8fc)[_0xc062('0x22')](function(_0x210e2f){_0x379afb[_0xc062('0x1a')]=_0x210e2f;if(_0x5db094[_0xc062('0x2c')][_0xc062('0x3d')]){_0x513932[_0xc062('0x3e')]=[{'all':!![]}];}return db[_0xc062('0x3c')][_0xc062('0x3f')](_0x513932);})[_0xc062('0x22')](function(_0xd114c6){_0x379afb[_0xc062('0x40')]=_0xd114c6;return _0x379afb;})[_0xc062('0x22')](respondWithFilteredResult(_0x4d4c4c,_0x513932))['catch'](handleError(_0x4d4c4c,null));};exports[_0xc062('0x41')]=function(_0x5cc1b5,_0x1d9abc){var _0x384726={'raw':!![],'where':{'id':_0x5cc1b5[_0xc062('0x42')]['id']}},_0x744bd3={};_0x744bd3['model']=_[_0xc062('0x2d')](db[_0xc062('0x3c')][_0xc062('0x28')]);_0x744bd3['query']=_[_0xc062('0x2d')](_0x5cc1b5['query']);_0x744bd3['filters']=_[_0xc062('0x2f')](_0x744bd3['model'],_0x744bd3[_0xc062('0x2c')]);_0x384726[_0xc062('0x31')]=_[_0xc062('0x2f')](_0x744bd3[_0xc062('0x30')],qs['fields'](_0x5cc1b5[_0xc062('0x2c')][_0xc062('0x43')]));_0x384726[_0xc062('0x31')]=_0x384726['attributes']['length']?_0x384726['attributes']:_0x744bd3[_0xc062('0x30')];if(_0x5cc1b5[_0xc062('0x2c')]['includeAll']){_0x384726[_0xc062('0x3e')]=[{'all':!![]}];}_0x384726=_[_0xc062('0x38')]({},_0x384726,_0x5cc1b5[_0xc062('0x3b')]);return db['VoiceDialReport']['find'](_0x384726)[_0xc062('0x22')](handleEntityNotFound(_0x1d9abc,null))[_0xc062('0x22')](respondWithResult(_0x1d9abc,null))[_0xc062('0x44')](handleError(_0x1d9abc,null));};exports[_0xc062('0x45')]=function(_0x1a2a73,_0x4db85a){return db[_0xc062('0x3c')][_0xc062('0x45')](_0x1a2a73['body'],{})[_0xc062('0x22')](respondWithResult(_0x4db85a,0xc9))[_0xc062('0x44')](handleError(_0x4db85a,null));};exports[_0xc062('0x20')]=function(_0x1bf9ed,_0x17f764){if(_0x1bf9ed['body']['id']){delete _0x1bf9ed[_0xc062('0x46')]['id'];}return db['VoiceDialReport'][_0xc062('0x47')]({'where':{'id':_0x1bf9ed[_0xc062('0x42')]['id']}})[_0xc062('0x22')](handleEntityNotFound(_0x17f764,null))[_0xc062('0x22')](saveUpdates(_0x1bf9ed[_0xc062('0x46')],null))['then'](respondWithResult(_0x17f764,null))[_0xc062('0x44')](handleError(_0x17f764,null));};exports['destroy']=function(_0x8c145,_0xb3fc4a){return db[_0xc062('0x3c')][_0xc062('0x47')]({'where':{'id':_0x8c145[_0xc062('0x42')]['id']}})[_0xc062('0x22')](handleEntityNotFound(_0xb3fc4a,null))[_0xc062('0x22')](removeEntity(_0xb3fc4a,null))[_0xc062('0x44')](handleError(_0xb3fc4a,null));};exports['describe']=function(_0xe7f173,_0x2c0fd3){return db[_0xc062('0x3c')][_0xc062('0x48')]()[_0xc062('0x22')](respondWithResult(_0x2c0fd3,null))[_0xc062('0x44')](handleError(_0x2c0fd3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1bae81d..f088fad 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 _0x0f09=['report_dial','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','VoiceDialReport'];(function(_0xbe39b2,_0x4af135){var _0x5714af=function(_0x401b57){while(--_0x401b57){_0xbe39b2['push'](_0xbe39b2['shift']());}};_0x5714af(++_0x4af135);}(_0x0f09,0x1a5));var _0x90f0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0f09[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var logger=require(_0x90f0('0x1'))(_0x90f0('0x2'));var moment=require(_0x90f0('0x3'));var BPromise=require(_0x90f0('0x4'));var rp=require(_0x90f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90f0('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x32a8c2,_0x58878c){return _0x32a8c2[_0x90f0('0x7')](_0x90f0('0x8'),attributes,{'tableName':_0x90f0('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b1=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2b1,0x1a1));var _0x1c2b=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xc2b1[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c2b('0x0'))('api');var moment=require(_0x1c2b('0x1'));var BPromise=require(_0x1c2b('0x2'));var rp=require(_0x1c2b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c2b('0x4'));var config=require(_0x1c2b('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x1c2b('0x6')]=function(_0xa1e2cd,_0x3ad7da){return _0xa1e2cd[_0x1c2b('0x7')](_0x1c2b('0x8'),attributes,{'tableName':_0x1c2b('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1c2b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6811685..249cfa8 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 _0x30f3=['error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','code'];(function(_0x24e0c9,_0x284109){var _0x4448f0=function(_0x576980){while(--_0x576980){_0x24e0c9['push'](_0x24e0c9['shift']());}};_0x4448f0(++_0x284109);}(_0x30f3,0x117));var _0x330f=function(_0x268fdf,_0x174349){_0x268fdf=_0x268fdf-0x0;var _0x27986e=_0x30f3[_0x268fdf];return _0x27986e;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var moment=require(_0x330f('0x2'));var BPromise=require(_0x330f('0x3'));var rs=require(_0x330f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x330f('0x5'))['db'];var utils=require(_0x330f('0x6'));var logger=require(_0x330f('0x7'))('rpc');var config=require(_0x330f('0x8'));var jayson=require(_0x330f('0x9'));var client=jayson[_0x330f('0xa')][_0x330f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460884,_0xdbeb41,_0x1cdb3b){return new BPromise(function(_0x2d0aa6,_0x14c206){return client['request'](_0x460884,_0x1cdb3b)[_0x330f('0xc')](function(_0x3c8669){logger[_0x330f('0xd')](_0x330f('0xe'),_0xdbeb41,_0x330f('0xf'));logger[_0x330f('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xdbeb41,'request\x20sent',JSON['stringify'](_0x3c8669));if(_0x3c8669['error']){if(_0x3c8669['error'][_0x330f('0x11')]===0x1f4){logger[_0x330f('0x12')](_0x330f('0xe'),_0xdbeb41,_0x3c8669[_0x330f('0x12')][_0x330f('0x13')]);return _0x14c206(_0x3c8669['error'][_0x330f('0x13')]);}logger[_0x330f('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x3c8669[_0x330f('0x12')][_0x330f('0x13')]);return _0x2d0aa6(_0x3c8669[_0x330f('0x12')]['message']);}else{logger[_0x330f('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x330f('0xf'));_0x2d0aa6(_0x3c8669[_0x330f('0x14')][_0x330f('0x13')]);}})[_0x330f('0x15')](function(_0x21d638){logger[_0x330f('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x21d638);_0x14c206(_0x21d638);});});}exports[_0x330f('0x16')]=function(_0x577474){var _0x5f28bf=this;return new Promise(function(_0x32cb5b,_0x12ec5d){return db[_0x330f('0x17')][_0x330f('0x18')](_0x577474['body'],{'raw':_0x577474[_0x330f('0x19')]?_0x577474['options'][_0x330f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1432c9){logger[_0x330f('0xd')]('CreateVoiceDialReport',_0x577474);logger['debug']('CreateVoiceDialReport',_0x577474,JSON[_0x330f('0x1b')](_0x1432c9));_0x32cb5b(_0x1432c9);})[_0x330f('0x15')](function(_0x169773){logger['error'](_0x330f('0x16'),_0x169773[_0x330f('0x13')],_0x577474);_0x12ec5d(_0x5f28bf[_0x330f('0x12')](0x1f4,_0x169773['message']));});});};exports['UpdateVoiceDialReport']=function(_0x130bd1){var _0xabd311=this;return new Promise(function(_0x574225,_0x53ba4c){return db[_0x330f('0x17')][_0x330f('0x1c')](_0x130bd1['body'],{'raw':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1d')]||null:null,'attributes':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1e')]||null:null,'limit':_0x130bd1[_0x330f('0x19')]?_0x130bd1['options'][_0x330f('0x1f')]||null:null})['then'](function(_0x4b70e8){logger['info'](_0x330f('0x20'),_0x130bd1);logger[_0x330f('0x10')](_0x330f('0x20'),_0x130bd1,JSON['stringify'](_0x4b70e8));_0x574225(_0x4b70e8);})[_0x330f('0x15')](function(_0x50cefb){logger['error']('UpdateVoiceDialReport',_0x50cefb['message'],_0x130bd1);_0x53ba4c(_0xabd311[_0x330f('0x12')](0x1f4,_0x50cefb[_0x330f('0x13')]));});});}; \ No newline at end of file +var _0x40a7=['../../config/logger','client','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','then','UpdateVoiceDialReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x6ea106,_0x181b3d){var _0x49ecfe=function(_0x750f7b){while(--_0x750f7b){_0x6ea106['push'](_0x6ea106['shift']());}};_0x49ecfe(++_0x181b3d);}(_0x40a7,0x8b));var _0x740a=function(_0x20eac5,_0x54ea9e){_0x20eac5=_0x20eac5-0x0;var _0xeb42a2=_0x40a7[_0x20eac5];return _0xeb42a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x740a('0x0'));var BPromise=require(_0x740a('0x1'));var rs=require(_0x740a('0x2'));var fs=require('fs');var Redis=require(_0x740a('0x3'));var db=require(_0x740a('0x4'))['db'];var utils=require(_0x740a('0x5'));var logger=require(_0x740a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x740a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2266f8,_0x4453b9,_0x145c82){return new BPromise(function(_0x2e3b09,_0x391d6b){return client['request'](_0x2266f8,_0x145c82)['then'](function(_0x193d74){logger[_0x740a('0x8')](_0x740a('0x9'),_0x4453b9,'request\x20sent');logger[_0x740a('0xa')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4453b9,_0x740a('0xb'),JSON[_0x740a('0xc')](_0x193d74));if(_0x193d74['error']){if(_0x193d74['error'][_0x740a('0xd')]===0x1f4){logger[_0x740a('0xe')](_0x740a('0x9'),_0x4453b9,_0x193d74[_0x740a('0xe')][_0x740a('0xf')]);return _0x391d6b(_0x193d74[_0x740a('0xe')][_0x740a('0xf')]);}logger[_0x740a('0xe')](_0x740a('0x9'),_0x4453b9,_0x193d74[_0x740a('0xe')][_0x740a('0xf')]);return _0x2e3b09(_0x193d74[_0x740a('0xe')][_0x740a('0xf')]);}else{logger[_0x740a('0x8')](_0x740a('0x9'),_0x4453b9,'request\x20sent');_0x2e3b09(_0x193d74[_0x740a('0x10')][_0x740a('0xf')]);}})[_0x740a('0x11')](function(_0x557183){logger['error'](_0x740a('0x9'),_0x4453b9,_0x557183);_0x391d6b(_0x557183);});});}exports[_0x740a('0x12')]=function(_0x4edcc1){var _0x888633=this;return new Promise(function(_0x1a1231,_0x38c97d){return db[_0x740a('0x13')]['create'](_0x4edcc1[_0x740a('0x14')],{'raw':_0x4edcc1[_0x740a('0x15')]?_0x4edcc1[_0x740a('0x15')][_0x740a('0x16')]===undefined?!![]:![]:!![]})[_0x740a('0x17')](function(_0x224006){logger[_0x740a('0x8')](_0x740a('0x12'),_0x4edcc1);logger['debug'](_0x740a('0x12'),_0x4edcc1,JSON[_0x740a('0xc')](_0x224006));_0x1a1231(_0x224006);})[_0x740a('0x11')](function(_0x397f99){logger[_0x740a('0xe')](_0x740a('0x12'),_0x397f99[_0x740a('0xf')],_0x4edcc1);_0x38c97d(_0x888633[_0x740a('0xe')](0x1f4,_0x397f99[_0x740a('0xf')]));});});};exports[_0x740a('0x18')]=function(_0xadad2f){var _0x2b156b=this;return new Promise(function(_0x2fee0c,_0x24befa){return db['VoiceDialReport'][_0x740a('0x19')](_0xadad2f[_0x740a('0x14')],{'raw':_0xadad2f[_0x740a('0x15')]?_0xadad2f[_0x740a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xadad2f[_0x740a('0x15')]?_0xadad2f[_0x740a('0x15')][_0x740a('0x1a')]||null:null,'attributes':_0xadad2f['options']?_0xadad2f[_0x740a('0x15')][_0x740a('0x1b')]||null:null,'limit':_0xadad2f['options']?_0xadad2f[_0x740a('0x15')][_0x740a('0x1c')]||null:null})[_0x740a('0x17')](function(_0x1e431c){logger['info'](_0x740a('0x18'),_0xadad2f);logger[_0x740a('0xa')](_0x740a('0x18'),_0xadad2f,JSON[_0x740a('0xc')](_0x1e431c));_0x2fee0c(_0x1e431c);})[_0x740a('0x11')](function(_0x37989e){logger[_0x740a('0xe')](_0x740a('0x18'),_0x37989e[_0x740a('0xf')],_0xadad2f);_0x24befa(_0x2b156b['error'](0x1f4,_0x37989e[_0x740a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 614755d..0a3fb58 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 _0x18f5=['Router','fs-extra','../../components/auth/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','/:id/applications','addApplications','put','update','delete','exports','util','connect-timeout','express'];(function(_0x239bbf,_0x1687e1){var _0x56b4c2=function(_0x13c6dd){while(--_0x13c6dd){_0x239bbf['push'](_0x239bbf['shift']());}};_0x56b4c2(++_0x1687e1);}(_0x18f5,0x95));var _0x518f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x18f5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x518f('0x0'));var path=require('path');var timeout=require(_0x518f('0x1'));var express=require(_0x518f('0x2'));var router=express[_0x518f('0x3')]();var fs_extra=require(_0x518f('0x4'));var auth=require(_0x518f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x518f('0x6'));router[_0x518f('0x7')]('/',auth['isAuthenticated'](),controller[_0x518f('0x8')]);router[_0x518f('0x7')](_0x518f('0x9'),auth[_0x518f('0xa')](),controller[_0x518f('0xb')]);router[_0x518f('0xc')]('/',auth[_0x518f('0xa')](),controller['create']);router[_0x518f('0xc')](_0x518f('0xd'),auth[_0x518f('0xa')](),controller[_0x518f('0xe')]);router[_0x518f('0xf')]('/:id',auth[_0x518f('0xa')](),controller[_0x518f('0x10')]);router[_0x518f('0x11')](_0x518f('0x9'),auth[_0x518f('0xa')](),controller['destroy']);module[_0x518f('0x12')]=router; \ No newline at end of file +var _0x00a9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','show','post','isAuthenticated','addApplications','put','delete','destroy','exports','multer'];(function(_0x17575f,_0x2ac70a){var _0x3741d4=function(_0x13c92c){while(--_0x13c92c){_0x17575f['push'](_0x17575f['shift']());}};_0x3741d4(++_0x2ac70a);}(_0x00a9,0x103));var _0x900a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x00a9[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var path=require(_0x900a('0x2'));var timeout=require(_0x900a('0x3'));var express=require(_0x900a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x900a('0x5'));var interaction=require(_0x900a('0x6'));var config=require(_0x900a('0x7'));var controller=require(_0x900a('0x8'));router[_0x900a('0x9')]('/',auth['isAuthenticated'](),controller[_0x900a('0xa')]);router[_0x900a('0x9')](_0x900a('0xb'),auth['isAuthenticated'](),controller[_0x900a('0xc')]);router[_0x900a('0xd')]('/',auth[_0x900a('0xe')](),controller['create']);router[_0x900a('0xd')]('/:id/applications',auth['isAuthenticated'](),controller[_0x900a('0xf')]);router[_0x900a('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x900a('0x11')](_0x900a('0xb'),auth[_0x900a('0xe')](),controller[_0x900a('0x12')]);module[_0x900a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 20968d9..3e9a03f 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 _0x1e0d=['INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','any'];(function(_0x678c26,_0x16b906){var _0x565724=function(_0x39f54b){while(--_0x39f54b){_0x678c26['push'](_0x678c26['shift']());}};_0x565724(++_0x16b906);}(_0x1e0d,0x1a5));var _0xd1e0=function(_0x516dca,_0x2fa321){_0x516dca=_0x516dca-0x0;var _0x120176=_0x1e0d[_0x516dca];return _0x120176;};'use strict';var Sequelize=require(_0xd1e0('0x0'));module[_0xd1e0('0x1')]={'context':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'unique':_0xd1e0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':_0xd1e0('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd1e0('0x5')](_0xd1e0('0x6'),_0xd1e0('0x7'),_0xd1e0('0x8'),_0xd1e0('0x9'),'outbound-fax','system',_0xd1e0('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xd1e0('0x2')]},'interval':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd1e0('0xb')]},'isApp':{'type':Sequelize[_0xd1e0('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd1e0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd1e0('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd1e0('0xb')]},'recordingFormat':{'type':Sequelize[_0xd1e0('0x2')],'defaultValue':_0xd1e0('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1b504a){return this[_0xd1e0('0xe')](_0xd1e0('0xf'));}},'alias':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2c7e=['BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x2b49f0,_0x389a66){var _0x3599ec=function(_0x4cf177){while(--_0x4cf177){_0x2b49f0['push'](_0x2b49f0['shift']());}};_0x3599ec(++_0x389a66);}(_0x2c7e,0xe4));var _0xe2c7=function(_0xa50924,_0x2e075a){_0xa50924=_0xa50924-0x0;var _0x2e5fc5=_0x2c7e[_0xa50924];return _0x2e5fc5;};'use strict';var Sequelize=require(_0xe2c7('0x0'));module[_0xe2c7('0x1')]={'context':{'type':Sequelize[_0xe2c7('0x2')],'allowNull':![],'unique':_0xe2c7('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe2c7('0x2')],'allowNull':![],'unique':_0xe2c7('0x3')},'priority':{'type':Sequelize[_0xe2c7('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xe2c7('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe2c7('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xe2c7('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe2c7('0x4')]('inbound',_0xe2c7('0x5'),'internal',_0xe2c7('0x6'),_0xe2c7('0x7'),_0xe2c7('0x8'),_0xe2c7('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xe2c7('0x2')]},'interval':{'type':Sequelize[_0xe2c7('0x2')],'allowNull':![],'defaultValue':_0xe2c7('0xa')},'IntervalId':{'type':Sequelize[_0xe2c7('0xb')]},'isApp':{'type':Sequelize[_0xe2c7('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe2c7('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xe2c7('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe2c7('0xb')]},'recordingFormat':{'type':Sequelize[_0xe2c7('0x2')],'defaultValue':_0xe2c7('0xd')},'answer':{'type':Sequelize[_0xe2c7('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x459d39){return this[_0xe2c7('0xe')](_0xe2c7('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b9c7bc4..901ee8b 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 _0x2a5a=['pick','filters','merge','where','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','keys','includeAll','create','body','startsWith','exten','concat','user','InboundRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','set','then','get','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x3583b0,_0x59ba89){var _0x5ecee8=function(_0x268147){while(--_0x268147){_0x3583b0['push'](_0x3583b0['shift']());}};_0x5ecee8(++_0x59ba89);}(_0x2a5a,0x142));var _0xa2a5=function(_0x8da2f1,_0x31df6e){_0x8da2f1=_0x8da2f1-0x0;var _0x3035a2=_0x2a5a[_0x8da2f1];return _0x3035a2;};'use strict';var _=require(_0xa2a5('0x0'));var Redis=require(_0xa2a5('0x1'));var qs=require(_0xa2a5('0x2'));var logger=require(_0xa2a5('0x3'))(_0xa2a5('0x4'));var config=require(_0xa2a5('0x5'));var db=require('../../mysqldb')['db'];config[_0xa2a5('0x6')]=_[_0xa2a5('0x7')](config['redis'],{'host':_0xa2a5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2a5('0x6')]));require('./voiceExtension.socket')[_0xa2a5('0x9')](socket);function respondWithStatusCode(_0x405385,_0x1f0332){_0x1f0332=_0x1f0332||0xcc;return function(_0x3fb315){if(_0x3fb315){return _0x405385[_0xa2a5('0xa')](_0x1f0332);}return _0x405385[_0xa2a5('0xb')](_0x1f0332)[_0xa2a5('0xc')]();};}function respondWithResult(_0x38b6e6,_0x2870f4){_0x2870f4=_0x2870f4||0xc8;return function(_0x851e50){if(_0x851e50){return _0x38b6e6[_0xa2a5('0xb')](_0x2870f4)[_0xa2a5('0xd')](_0x851e50);}};}function respondWithFilteredResult(_0x4fb618,_0x576533){return function(_0x58eaef){if(_0x58eaef){var _0x381434=typeof _0x576533[_0xa2a5('0xe')]==='undefined'&&typeof _0x576533['limit']===_0xa2a5('0xf');var _0x58a6b0=_0x58eaef[_0xa2a5('0x10')];var _0x48cd02=_0x381434?0x0:_0x576533[_0xa2a5('0xe')];var _0x1fedc9=_0x381434?_0x58eaef['count']:_0x576533[_0xa2a5('0xe')]+_0x576533['limit'];var _0x5cc15b;if(_0x1fedc9>=_0x58a6b0){_0x1fedc9=_0x58a6b0;_0x5cc15b=0xc8;}else{_0x5cc15b=0xce;}_0x4fb618[_0xa2a5('0xb')](_0x5cc15b);return _0x4fb618[_0xa2a5('0x11')]('Content-Range',_0x48cd02+'-'+_0x1fedc9+'/'+_0x58a6b0)[_0xa2a5('0xd')](_0x58eaef);}return null;};}function removeEntity(_0x14bc3c){return function(_0x3a02b7){if(_0x3a02b7){return _0x3a02b7['destroy']()[_0xa2a5('0x12')](function(){var _0x4ad9c6=_0x3a02b7[_0xa2a5('0x13')]({'plain':!![]});var _0x3c106a=[{'name':'InboundRoutes','value':_0xa2a5('0x14'),'ignore':![]},{'name':_0xa2a5('0x15'),'value':_0xa2a5('0x16'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x2908f1=_(_0x3c106a)[_0xa2a5('0x17')](_0xa2a5('0x18'))[_0xa2a5('0x19')](_0xa2a5('0x1a'))[_0xa2a5('0x1a')]();if(_[_0xa2a5('0x1b')](_0x2908f1,_0x4ad9c6[_0xa2a5('0x1c')])){return;}var _0x1f92c3=_[_0xa2a5('0x1d')](_0x3c106a,[_0xa2a5('0x1a'),_0x4ad9c6[_0xa2a5('0x1c')]])['name'];return db[_0xa2a5('0x1e')][_0xa2a5('0x1f')]({'where':{'type':_0x1f92c3,'resourceId':_0x4ad9c6['id']}})[_0xa2a5('0x12')](function(){return _0x3a02b7;});})[_0xa2a5('0x12')](function(){_0x14bc3c[_0xa2a5('0xb')](0xcc)[_0xa2a5('0xc')]();});}};}function handleEntityNotFound(_0x58dff1){return function(_0x122b70){if(!_0x122b70){_0x58dff1[_0xa2a5('0xa')](0x194);}return _0x122b70;};}function handleError(_0x2641e6,_0x2eaff2){_0x2eaff2=_0x2eaff2||0x1f4;return function(_0x48b48c){logger[_0xa2a5('0x20')](_0x48b48c[_0xa2a5('0x21')]);if(_0x48b48c['name']){delete _0x48b48c[_0xa2a5('0x22')];}_0x2641e6[_0xa2a5('0xb')](_0x2eaff2)[_0xa2a5('0x23')](_0x48b48c);};}exports['index']=function(_0x210252,_0x506804){var _0x3fc6ee={},_0x49913d={},_0x1b0f21={'count':0x0,'rows':[]};var _0x3794a8=_['map'](db['VoiceExtension'][_0xa2a5('0x24')],function(_0x4e1bc4){return{'name':_0x4e1bc4[_0xa2a5('0x25')],'type':_0x4e1bc4['type'][_0xa2a5('0x26')]};});_0x49913d[_0xa2a5('0x27')]=_['map'](_0x3794a8,'name');_0x49913d[_0xa2a5('0x28')]=_['keys'](_0x210252['query']);_0x49913d['filters']=_[_0xa2a5('0x29')](_0x49913d[_0xa2a5('0x27')],_0x49913d[_0xa2a5('0x28')]);_0x3fc6ee[_0xa2a5('0x2a')]=_[_0xa2a5('0x29')](_0x49913d[_0xa2a5('0x27')],qs[_0xa2a5('0x2b')](_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2b')]));_0x3fc6ee[_0xa2a5('0x2a')]=_0x3fc6ee['attributes'][_0xa2a5('0x2c')]?_0x3fc6ee[_0xa2a5('0x2a')]:_0x49913d['model'];if(!_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2d')](_0xa2a5('0x2e'))){_0x3fc6ee['limit']=qs['limit'](_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2f')]);_0x3fc6ee['offset']=qs[_0xa2a5('0xe')](_0x210252[_0xa2a5('0x28')][_0xa2a5('0xe')]);}_0x3fc6ee[_0xa2a5('0x30')]=qs[_0xa2a5('0x31')](_0x210252[_0xa2a5('0x28')]['sort']);_0x3fc6ee['where']=qs['filters'](_[_0xa2a5('0x32')](_0x210252['query'],_0x49913d[_0xa2a5('0x33')]),_0x3794a8);if(_0x210252['query'][_0xa2a5('0x17')]){_0x3fc6ee['where']=_[_0xa2a5('0x34')](_0x3fc6ee[_0xa2a5('0x35')],{'$or':_[_0xa2a5('0x19')](_0x3794a8,function(_0x32d7aa){if(_0x32d7aa['type']!==_0xa2a5('0x36')){var _0x197a9c={};_0x197a9c[_0x32d7aa[_0xa2a5('0x22')]]={'$like':'%'+_0x210252[_0xa2a5('0x28')][_0xa2a5('0x17')]+'%'};return _0x197a9c;}})});}_0x3fc6ee=_[_0xa2a5('0x34')]({},_0x3fc6ee,_0x210252[_0xa2a5('0x37')]);var _0x5b3fbc={'where':_0x3fc6ee['where']};return db[_0xa2a5('0x38')][_0xa2a5('0x10')](_0x5b3fbc)[_0xa2a5('0x12')](function(_0x4150a9){_0x1b0f21[_0xa2a5('0x10')]=_0x4150a9;if(_0x210252[_0xa2a5('0x28')]['includeAll']){_0x3fc6ee[_0xa2a5('0x39')]=[{'all':!![]}];}return db[_0xa2a5('0x38')][_0xa2a5('0x3a')](_0x3fc6ee);})[_0xa2a5('0x12')](function(_0x11b19e){_0x1b0f21[_0xa2a5('0x3b')]=_0x11b19e;return _0x1b0f21;})[_0xa2a5('0x12')](respondWithFilteredResult(_0x506804,_0x3fc6ee))[_0xa2a5('0x3c')](handleError(_0x506804,null));};exports[_0xa2a5('0x3d')]=function(_0x3c455e,_0x32bf58){var _0x31949f={'raw':![],'where':{'id':_0x3c455e[_0xa2a5('0x3e')]['id']}},_0xf2b7e5={};_0xf2b7e5['model']=_[_0xa2a5('0x3f')](db[_0xa2a5('0x38')]['rawAttributes']);_0xf2b7e5[_0xa2a5('0x28')]=_[_0xa2a5('0x3f')](_0x3c455e[_0xa2a5('0x28')]);_0xf2b7e5[_0xa2a5('0x33')]=_['intersection'](_0xf2b7e5['model'],_0xf2b7e5[_0xa2a5('0x28')]);_0x31949f[_0xa2a5('0x2a')]=_[_0xa2a5('0x29')](_0xf2b7e5[_0xa2a5('0x27')],qs['fields'](_0x3c455e[_0xa2a5('0x28')]['fields']));_0x31949f['attributes']=_0x31949f['attributes'][_0xa2a5('0x2c')]?_0x31949f[_0xa2a5('0x2a')]:_0xf2b7e5[_0xa2a5('0x27')];if(_0x3c455e['query'][_0xa2a5('0x40')]){_0x31949f['include']=[{'all':!![]}];}_0x31949f=_[_0xa2a5('0x34')]({},_0x31949f,_0x3c455e[_0xa2a5('0x37')]);return db[_0xa2a5('0x38')][_0xa2a5('0x1d')](_0x31949f)['then'](handleEntityNotFound(_0x32bf58,null))[_0xa2a5('0x12')](respondWithResult(_0x32bf58,null))[_0xa2a5('0x3c')](handleError(_0x32bf58,null));};exports[_0xa2a5('0x1f')]=function(_0x269c3e,_0x38da5c){return db['VoiceExtension'][_0xa2a5('0x1d')]({'where':{'id':_0x269c3e[_0xa2a5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x38da5c,null))[_0xa2a5('0x12')](removeEntity(_0x38da5c,null))[_0xa2a5('0x3c')](handleError(_0x38da5c,null));};exports[_0xa2a5('0x41')]=function(_0x290ab8,_0x213a88){if(_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x1c')]===_0xa2a5('0x16')&&!_[_0xa2a5('0x43')](_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x44')],'_')){_0x290ab8[_0xa2a5('0x42')]['exten']='_'[_0xa2a5('0x45')](_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x44')]);}return db[_0xa2a5('0x38')]['create'](_0x290ab8[_0xa2a5('0x42')],{'raw':![]})[_0xa2a5('0x12')](function(_0x1b339b){var _0x348e75=_0x290ab8[_0xa2a5('0x46')]['get']({'plain':!![]});if(!_0x348e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x348e75['role']==='user'){var _0xb1220d=_0x1b339b[_0xa2a5('0x13')]({'plain':!![]});var _0x351bdb=[{'name':_0xa2a5('0x47'),'value':'inbound'},{'name':_0xa2a5('0x15'),'value':'outbound'},{'name':'InternalRoutes','value':_0xa2a5('0x48')}];var _0x15e55f=_['find'](_0x351bdb,[_0xa2a5('0x1a'),_0xb1220d[_0xa2a5('0x1c')]])[_0xa2a5('0x22')];return db['UserProfileSection'][_0xa2a5('0x1d')]({'where':{'name':_0x15e55f,'userProfileId':_0x348e75['userProfileId']},'raw':!![]})['then'](function(_0x5b7a2f){if(_0x5b7a2f&&_0x5b7a2f[_0xa2a5('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xb1220d[_0xa2a5('0x22')],'resourceId':_0xb1220d['id'],'type':_0x5b7a2f[_0xa2a5('0x22')],'sectionId':_0x5b7a2f['id']},{})['then'](function(){return _0x1b339b;});}else{return _0x1b339b;}})[_0xa2a5('0x3c')](function(_0x9a4537){logger[_0xa2a5('0x20')](_0xa2a5('0x4a'),_0x9a4537);throw _0x9a4537;});}return _0x1b339b;})[_0xa2a5('0x12')](respondWithResult(_0x213a88,0xc9))[_0xa2a5('0x3c')](handleError(_0x213a88,null));};exports[_0xa2a5('0x4b')]=function(_0x56a287,_0x1a9552){if(_0x56a287[_0xa2a5('0x42')]['id']){delete _0x56a287[_0xa2a5('0x42')]['id'];}return db[_0xa2a5('0x38')][_0xa2a5('0x1d')]({'where':{'id':_0x56a287[_0xa2a5('0x3e')]['id']}})[_0xa2a5('0x12')](handleEntityNotFound(_0x1a9552,null))[_0xa2a5('0x12')](function(_0xfa11){if(_0xfa11){return db[_0xa2a5('0x38')][_0xa2a5('0x4b')](_[_0xa2a5('0x32')](_0x56a287['body'],[_0xa2a5('0x44'),_0xa2a5('0x4c'),_0xa2a5('0x4d'),'recordingFormat',_0xa2a5('0x4e'),_0xa2a5('0x4f'),_0xa2a5('0x50')]),{'where':{'context':_0xfa11[_0xa2a5('0x4c')],'exten':_0xfa11[_0xa2a5('0x44')]},'individualHooks':!![]})['then'](function(_0x4cc246){return _0x4cc246;});}return null;})['then'](respondWithStatusCode(_0x1a9552,null))[_0xa2a5('0x3c')](handleError(_0x1a9552,null));};exports[_0xa2a5('0x51')]=function(_0x35ec99,_0x5302b7){var _0xb10073=_0x35ec99[_0xa2a5('0x3e')]['id'];var _0x343fda=_0x35ec99['body'];var _0x3f6366=0xc8;var _0x4566d0=null;return db[_0xa2a5('0x52')][_0xa2a5('0x53')]({'isolationLevel':db[_0xa2a5('0x52')][_0xa2a5('0x54')][_0xa2a5('0x55')][_0xa2a5('0x56')]},function(_0x199aaa){return db['VoiceExtension'][_0xa2a5('0x57')]({'where':{'id':_0xb10073},'transaction':_0x199aaa})[_0xa2a5('0x12')](function(_0x53095b){if(_0x53095b){return db[_0xa2a5('0x38')]['destroy']({'where':{'VoiceExtensionId':_0xb10073},'transaction':_0x199aaa})['then'](function(){var _0x126892=_[_0xa2a5('0x19')](_0x343fda,function(_0x340108){_0x340108[_0xa2a5('0x58')]=_0xb10073;_0x340108['isApp']=!![];return _0x340108;});return _0x53095b[_0xa2a5('0x59')](_0x126892);})[_0xa2a5('0x12')](function(_0x385c11){return db[_0xa2a5('0x38')][_0xa2a5('0x5a')](_0x385c11,{'transaction':_0x199aaa});});}else{_0x3f6366=0x194;_0x4566d0=[];}});})[_0xa2a5('0x12')](function(){if(_0x3f6366!==0x194){return db['VoiceExtension'][_0xa2a5('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xb10073},'order':_0xa2a5('0x5c')})['then'](function(_0x1889ed){_0x4566d0=_0x1889ed;});}})[_0xa2a5('0x3c')](function(_0x24fb65){_0x3f6366=0x1f4;logger['error'](_0x24fb65['stack']);if(_0x24fb65[_0xa2a5('0x22')]){delete _0x24fb65[_0xa2a5('0x22')];}_0x4566d0=_0x24fb65;})['finally'](function(){if(_0x4566d0===null){_0x5302b7[_0xa2a5('0xa')](_0x3f6366);}else{if(_0x3f6366===0x1f4){_0x5302b7['status'](_0x3f6366)[_0xa2a5('0x23')](_0x4566d0);}else{_0x5302b7[_0xa2a5('0xb')](_0x3f6366)[_0xa2a5('0xd')](_0x4566d0);}}});}; \ No newline at end of file +var _0x5dac=['find','name','UserProfileResource','destroy','error','send','VoiceExtension','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','catch','show','params','attributes','include','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','stack','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./voiceExtension.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5dac,0xf4));var _0xc5da=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5dac[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xc5da('0x0'));var Redis=require(_0xc5da('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc5da('0x2'))(_0xc5da('0x3'));var config=require(_0xc5da('0x4'));var db=require(_0xc5da('0x5'))['db'];config['redis']=_[_0xc5da('0x6')](config[_0xc5da('0x7')],{'host':_0xc5da('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5da('0x7')]));require(_0xc5da('0x9'))[_0xc5da('0xa')](socket);function respondWithStatusCode(_0x3ffaf8,_0xc337c4){_0xc337c4=_0xc337c4||0xcc;return function(_0xd14178){if(_0xd14178){return _0x3ffaf8[_0xc5da('0xb')](_0xc337c4);}return _0x3ffaf8['status'](_0xc337c4)[_0xc5da('0xc')]();};}function respondWithResult(_0x4cbd09,_0x436b86){_0x436b86=_0x436b86||0xc8;return function(_0x3366f7){if(_0x3366f7){return _0x4cbd09['status'](_0x436b86)[_0xc5da('0xd')](_0x3366f7);}};}function respondWithFilteredResult(_0x353b47,_0x343f53){return function(_0xa7fc91){if(_0xa7fc91){var _0x1cecde=typeof _0x343f53[_0xc5da('0xe')]===_0xc5da('0xf')&&typeof _0x343f53['limit']===_0xc5da('0xf');var _0x57722b=_0xa7fc91['count'];var _0x2359b2=_0x1cecde?0x0:_0x343f53[_0xc5da('0xe')];var _0x3f1e02=_0x1cecde?_0xa7fc91[_0xc5da('0x10')]:_0x343f53['offset']+_0x343f53[_0xc5da('0x11')];var _0x2a2870;if(_0x3f1e02>=_0x57722b){_0x3f1e02=_0x57722b;_0x2a2870=0xc8;}else{_0x2a2870=0xce;}_0x353b47[_0xc5da('0x12')](_0x2a2870);return _0x353b47[_0xc5da('0x13')]('Content-Range',_0x2359b2+'-'+_0x3f1e02+'/'+_0x57722b)[_0xc5da('0xd')](_0xa7fc91);}return null;};}function removeEntity(_0x267a2d){return function(_0x239c24){if(_0x239c24){return _0x239c24['destroy']()[_0xc5da('0x14')](function(){var _0x1150d6=_0x239c24[_0xc5da('0x15')]({'plain':!![]});var _0x349d02=[{'name':_0xc5da('0x16'),'value':_0xc5da('0x17'),'ignore':![]},{'name':_0xc5da('0x18'),'value':_0xc5da('0x19'),'ignore':![]},{'name':_0xc5da('0x1a'),'value':'internal','ignore':![]}];var _0x416c72=_(_0x349d02)[_0xc5da('0x1b')](_0xc5da('0x1c'))[_0xc5da('0x1d')]('value')[_0xc5da('0x1e')]();if(_['includes'](_0x416c72,_0x1150d6[_0xc5da('0x1f')])){return;}var _0x55e950=_[_0xc5da('0x20')](_0x349d02,[_0xc5da('0x1e'),_0x1150d6[_0xc5da('0x1f')]])[_0xc5da('0x21')];return db[_0xc5da('0x22')][_0xc5da('0x23')]({'where':{'type':_0x55e950,'resourceId':_0x1150d6['id']}})[_0xc5da('0x14')](function(){return _0x239c24;});})['then'](function(){_0x267a2d[_0xc5da('0x12')](0xcc)[_0xc5da('0xc')]();});}};}function handleEntityNotFound(_0xdaeb6){return function(_0x562fda){if(!_0x562fda){_0xdaeb6[_0xc5da('0xb')](0x194);}return _0x562fda;};}function handleError(_0x2fe335,_0x48f02b){_0x48f02b=_0x48f02b||0x1f4;return function(_0x4636f0){logger[_0xc5da('0x24')](_0x4636f0['stack']);if(_0x4636f0[_0xc5da('0x21')]){delete _0x4636f0[_0xc5da('0x21')];}_0x2fe335[_0xc5da('0x12')](_0x48f02b)[_0xc5da('0x25')](_0x4636f0);};}exports['index']=function(_0x543851,_0x3ea6a9){var _0x4b77c7={},_0x2873ce={},_0x15bd13={'count':0x0,'rows':[]};var _0x25ea00=_[_0xc5da('0x1d')](db[_0xc5da('0x26')][_0xc5da('0x27')],function(_0x4c29ed){return{'name':_0x4c29ed[_0xc5da('0x28')],'type':_0x4c29ed[_0xc5da('0x1f')]['key']};});_0x2873ce['model']=_[_0xc5da('0x1d')](_0x25ea00,'name');_0x2873ce[_0xc5da('0x29')]=_[_0xc5da('0x2a')](_0x543851[_0xc5da('0x29')]);_0x2873ce[_0xc5da('0x2b')]=_[_0xc5da('0x2c')](_0x2873ce[_0xc5da('0x2d')],_0x2873ce[_0xc5da('0x29')]);_0x4b77c7['attributes']=_[_0xc5da('0x2c')](_0x2873ce['model'],qs[_0xc5da('0x2e')](_0x543851['query'][_0xc5da('0x2e')]));_0x4b77c7['attributes']=_0x4b77c7['attributes'][_0xc5da('0x2f')]?_0x4b77c7['attributes']:_0x2873ce[_0xc5da('0x2d')];if(!_0x543851[_0xc5da('0x29')][_0xc5da('0x30')](_0xc5da('0x31'))){_0x4b77c7['limit']=qs[_0xc5da('0x11')](_0x543851[_0xc5da('0x29')]['limit']);_0x4b77c7[_0xc5da('0xe')]=qs[_0xc5da('0xe')](_0x543851[_0xc5da('0x29')][_0xc5da('0xe')]);}_0x4b77c7[_0xc5da('0x32')]=qs[_0xc5da('0x33')](_0x543851['query']['sort']);_0x4b77c7[_0xc5da('0x34')]=qs[_0xc5da('0x2b')](_[_0xc5da('0x35')](_0x543851['query'],_0x2873ce[_0xc5da('0x2b')]),_0x25ea00);if(_0x543851[_0xc5da('0x29')][_0xc5da('0x1b')]){_0x4b77c7['where']=_['merge'](_0x4b77c7[_0xc5da('0x34')],{'$or':_[_0xc5da('0x1d')](_0x25ea00,function(_0x5e97fd){if(_0x5e97fd['type']!=='VIRTUAL'){var _0x5b73ad={};_0x5b73ad[_0x5e97fd['name']]={'$like':'%'+_0x543851[_0xc5da('0x29')]['filter']+'%'};return _0x5b73ad;}})});}_0x4b77c7=_[_0xc5da('0x36')]({},_0x4b77c7,_0x543851[_0xc5da('0x37')]);var _0x4b7530={'where':_0x4b77c7['where']};return db[_0xc5da('0x26')][_0xc5da('0x10')](_0x4b7530)[_0xc5da('0x14')](function(_0x200729){_0x15bd13[_0xc5da('0x10')]=_0x200729;if(_0x543851[_0xc5da('0x29')][_0xc5da('0x38')]){_0x4b77c7['include']=[{'all':!![]}];}return db[_0xc5da('0x26')]['findAll'](_0x4b77c7);})[_0xc5da('0x14')](function(_0x3ca6c7){_0x15bd13['rows']=_0x3ca6c7;return _0x15bd13;})[_0xc5da('0x14')](respondWithFilteredResult(_0x3ea6a9,_0x4b77c7))[_0xc5da('0x39')](handleError(_0x3ea6a9,null));};exports[_0xc5da('0x3a')]=function(_0x2cd974,_0x42ccd8){var _0x1eacd7={'raw':![],'where':{'id':_0x2cd974[_0xc5da('0x3b')]['id']}},_0x5f33bf={};_0x5f33bf[_0xc5da('0x2d')]=_[_0xc5da('0x2a')](db[_0xc5da('0x26')][_0xc5da('0x27')]);_0x5f33bf[_0xc5da('0x29')]=_[_0xc5da('0x2a')](_0x2cd974['query']);_0x5f33bf['filters']=_['intersection'](_0x5f33bf[_0xc5da('0x2d')],_0x5f33bf[_0xc5da('0x29')]);_0x1eacd7[_0xc5da('0x3c')]=_[_0xc5da('0x2c')](_0x5f33bf[_0xc5da('0x2d')],qs[_0xc5da('0x2e')](_0x2cd974[_0xc5da('0x29')][_0xc5da('0x2e')]));_0x1eacd7[_0xc5da('0x3c')]=_0x1eacd7['attributes'][_0xc5da('0x2f')]?_0x1eacd7['attributes']:_0x5f33bf[_0xc5da('0x2d')];if(_0x2cd974[_0xc5da('0x29')][_0xc5da('0x38')]){_0x1eacd7[_0xc5da('0x3d')]=[{'all':!![]}];}_0x1eacd7=_[_0xc5da('0x36')]({},_0x1eacd7,_0x2cd974[_0xc5da('0x37')]);return db[_0xc5da('0x26')][_0xc5da('0x20')](_0x1eacd7)[_0xc5da('0x14')](handleEntityNotFound(_0x42ccd8,null))['then'](respondWithResult(_0x42ccd8,null))['catch'](handleError(_0x42ccd8,null));};exports[_0xc5da('0x23')]=function(_0x573363,_0x363698){return db['VoiceExtension'][_0xc5da('0x20')]({'where':{'id':_0x573363[_0xc5da('0x3b')]['id']}})[_0xc5da('0x14')](handleEntityNotFound(_0x363698,null))['then'](removeEntity(_0x363698,null))[_0xc5da('0x39')](handleError(_0x363698,null));};exports[_0xc5da('0x3e')]=function(_0x311d89,_0x29bee4){if(_0x311d89['body'][_0xc5da('0x1f')]===_0xc5da('0x19')&&!_[_0xc5da('0x3f')](_0x311d89[_0xc5da('0x40')][_0xc5da('0x41')],'_')){_0x311d89[_0xc5da('0x40')][_0xc5da('0x41')]='_'[_0xc5da('0x42')](_0x311d89['body'][_0xc5da('0x41')]);}return db[_0xc5da('0x26')][_0xc5da('0x3e')](_0x311d89[_0xc5da('0x40')],{'raw':![]})[_0xc5da('0x14')](function(_0x5368d8){var _0x330088=_0x311d89[_0xc5da('0x43')][_0xc5da('0x15')]({'plain':!![]});if(!_0x330088)throw new Error(_0xc5da('0x44'));if(_0x330088['role']===_0xc5da('0x43')){var _0x4b1032=_0x5368d8['get']({'plain':!![]});var _0x436cb0=[{'name':_0xc5da('0x16'),'value':_0xc5da('0x17')},{'name':_0xc5da('0x18'),'value':_0xc5da('0x19')},{'name':_0xc5da('0x1a'),'value':_0xc5da('0x45')}];var _0xe8d837=_['find'](_0x436cb0,[_0xc5da('0x1e'),_0x4b1032[_0xc5da('0x1f')]])[_0xc5da('0x21')];return db[_0xc5da('0x46')][_0xc5da('0x20')]({'where':{'name':_0xe8d837,'userProfileId':_0x330088['userProfileId']},'raw':!![]})[_0xc5da('0x14')](function(_0x383b3e){if(_0x383b3e&&_0x383b3e[_0xc5da('0x47')]===0x0){return db[_0xc5da('0x22')][_0xc5da('0x3e')]({'name':_0x4b1032[_0xc5da('0x21')],'resourceId':_0x4b1032['id'],'type':_0x383b3e[_0xc5da('0x21')],'sectionId':_0x383b3e['id']},{})[_0xc5da('0x14')](function(){return _0x5368d8;});}else{return _0x5368d8;}})[_0xc5da('0x39')](function(_0x568d72){logger[_0xc5da('0x24')](_0xc5da('0x48'),_0x568d72);throw _0x568d72;});}return _0x5368d8;})[_0xc5da('0x14')](respondWithResult(_0x29bee4,0xc9))['catch'](handleError(_0x29bee4,null));};exports['update']=function(_0x9c6b72,_0x32d561){if(_0x9c6b72['body']['id']){delete _0x9c6b72[_0xc5da('0x40')]['id'];}return db[_0xc5da('0x26')]['find']({'where':{'id':_0x9c6b72[_0xc5da('0x3b')]['id']}})[_0xc5da('0x14')](handleEntityNotFound(_0x32d561,null))[_0xc5da('0x14')](function(_0x18f87b){if(_0x18f87b){return db[_0xc5da('0x26')][_0xc5da('0x49')](_[_0xc5da('0x35')](_0x9c6b72[_0xc5da('0x40')],[_0xc5da('0x41'),_0xc5da('0x4a'),_0xc5da('0x4b'),_0xc5da('0x4c'),_0xc5da('0x4d'),_0xc5da('0x4e'),_0xc5da('0x4f')]),{'where':{'context':_0x18f87b[_0xc5da('0x4a')],'exten':_0x18f87b[_0xc5da('0x41')]},'individualHooks':!![]})[_0xc5da('0x14')](function(_0x183930){return _0x183930;});}return null;})['then'](respondWithStatusCode(_0x32d561,null))[_0xc5da('0x39')](handleError(_0x32d561,null));};exports[_0xc5da('0x50')]=function(_0x14a90b,_0x2dff97){var _0x4cb7ea=_0x14a90b[_0xc5da('0x3b')]['id'];var _0x4670f2=_0x14a90b[_0xc5da('0x40')];var _0x586111=0xc8;var _0x143e50=null;return db[_0xc5da('0x51')]['transaction']({'isolationLevel':db[_0xc5da('0x51')]['Transaction'][_0xc5da('0x52')][_0xc5da('0x53')]},function(_0x5c66f8){return db[_0xc5da('0x26')][_0xc5da('0x54')]({'where':{'id':_0x4cb7ea},'transaction':_0x5c66f8})[_0xc5da('0x14')](function(_0x12d586){if(_0x12d586){return db['VoiceExtension'][_0xc5da('0x23')]({'where':{'VoiceExtensionId':_0x4cb7ea},'transaction':_0x5c66f8})[_0xc5da('0x14')](function(){var _0x284b2b=_[_0xc5da('0x1d')](_0x4670f2,function(_0x46ee6b){_0x46ee6b[_0xc5da('0x55')]=_0x4cb7ea;_0x46ee6b[_0xc5da('0x56')]=!![];return _0x46ee6b;});return _0x12d586[_0xc5da('0x57')](_0x284b2b);})[_0xc5da('0x14')](function(_0x22e0f7){return db[_0xc5da('0x26')][_0xc5da('0x58')](_0x22e0f7,{'transaction':_0x5c66f8});});}else{_0x586111=0x194;_0x143e50=[];}});})[_0xc5da('0x14')](function(){if(_0x586111!==0x194){return db[_0xc5da('0x26')][_0xc5da('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4cb7ea},'order':'cast(priority\x20as\x20unsigned)'})[_0xc5da('0x14')](function(_0x51cd86){_0x143e50=_0x51cd86;});}})[_0xc5da('0x39')](function(_0x545954){_0x586111=0x1f4;logger[_0xc5da('0x24')](_0x545954[_0xc5da('0x5a')]);if(_0x545954[_0xc5da('0x21')]){delete _0x545954[_0xc5da('0x21')];}_0x143e50=_0x545954;})[_0xc5da('0x5b')](function(){if(_0x143e50===null){_0x2dff97['sendStatus'](_0x586111);}else{if(_0x586111===0x1f4){_0x2dff97[_0xc5da('0x12')](_0x586111)[_0xc5da('0x25')](_0x143e50);}else{_0x2dff97[_0xc5da('0x12')](_0x586111)['json'](_0x143e50);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 66549a2..9a1c42b 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 _0xdd2f=['remove','emit','exports','VoiceExtension','setMaxListeners','save','update'];(function(_0x3f0e5b,_0x2da514){var _0x152e34=function(_0x4ca9a9){while(--_0x4ca9a9){_0x3f0e5b['push'](_0x3f0e5b['shift']());}};_0x152e34(++_0x2da514);}(_0xdd2f,0xb9));var _0xfdd2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdd2f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xfdd2('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfdd2('0x1')](0x0);var events={'afterCreate':_0xfdd2('0x2'),'afterUpdate':_0xfdd2('0x3'),'afterDestroy':_0xfdd2('0x4')};function emitEvent(_0x20481c){return function(_0x5ed7d8,_0x5156a8,_0x1fb678){VoiceExtensionEvents[_0xfdd2('0x5')](_0x20481c+':'+_0x5ed7d8['id'],_0x5ed7d8);VoiceExtensionEvents[_0xfdd2('0x5')](_0x20481c,_0x5ed7d8);_0x1fb678(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfdd2('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd494=['VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd494,0x13f));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x4d49('0x0'))['db'][_0x4d49('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4d49('0x2')](0x0);var events={'afterCreate':_0x4d49('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x357878){return function(_0x496bdb,_0x555887,_0x415a83){VoiceExtensionEvents[_0x4d49('0x4')](_0x357878+':'+_0x496bdb['id'],_0x496bdb);VoiceExtensionEvents[_0x4d49('0x4')](_0x357878,_0x496bdb);_0x415a83(null);};}for(var e in events){if(events[_0x4d49('0x5')](e)){var event=events[e];VoiceExtension[_0x4d49('0x6')](e,emitEvent(event));}}module[_0x4d49('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 691bfe9..96705a9 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 _0x4917=['findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','define','VoiceExtension','voice_extensions','get','last','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','context','inbound','push','exten','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','split','phone','prefix','param','SIP','join','none','U(xcally-mixmonitor-context)'];(function(_0x5eff86,_0x2cdd22){var _0x4b3010=function(_0x319012){while(--_0x319012){_0x5eff86['push'](_0x5eff86['shift']());}};_0x4b3010(++_0x2cdd22);}(_0x4917,0x116));var _0x7491=function(_0x263855,_0x362961){_0x263855=_0x263855-0x0;var _0x24eb25=_0x4917[_0x263855];return _0x24eb25;};'use strict';var _=require(_0x7491('0x0'));var attributes=require(_0x7491('0x1'));module[_0x7491('0x2')]=function(_0x4c4994){var _0x55d91c=_0x4c4994[_0x7491('0x3')];function _0x2c7abe(_0x392031){var _0x380785=0x2;var _0x4d516f=[{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0x6')+_0x392031[_0x7491('0x4')],'context':_0x392031['context'],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x392031['alias']?'Set':_0x7491('0x7'),'appdata':_0x392031['alias']?_0x7491('0x8')+_0x392031[_0x7491('0x9')]:_0x7491('0xa'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']}];if(_0x392031[_0x7491('0x4')]===_0x7491('0xc')){_0x4d516f[_0x7491('0xd')]({'type':_0x7491('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x392031['id'],'context':_0x392031['context'],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']});}_0x4d516f[_0x7491('0xd')]({'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0xf'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x392031[_0x7491('0xb')],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0x10'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']});return _0x4d516f;}function _0x134b67(_0x1ff9ab){var _0x2d134e=0x2;var _0x5e7995=[{'type':_0x7491('0x11'),'app':'Set','appdata':_0x7491('0x12'),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x1ff9ab[_0x7491('0x9')]?_0x7491('0x5'):_0x7491('0x7'),'appdata':_0x1ff9ab['alias']?'CDR(routeAlias)='+_0x1ff9ab[_0x7491('0x9')]:'No\x20alias\x20set','context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x13')+(_0x1ff9ab[_0x7491('0x14')]?_0x7491('0x15')+_0x1ff9ab['cutdigits']+'}':_0x7491('0x16')),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0x17')+_0x1ff9ab['id'],'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':'ExecIf','appdata':_0x7491('0x18')+(_0x2d134e+0x2)+_0x7491('0x19')+(_0x2d134e+0x1)+')','context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x1ff9ab[_0x7491('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x1ff9ab['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab['exten'],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0xf'),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0x1a'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':_0x7491('0x5'),'appdata':_0x7491('0x10'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab['exten'],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x1b')+_0x1ff9ab['id'],'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']}];if(_0x1ff9ab[_0x7491('0x1c')](_0x7491('0x1d'))&&_0x1ff9ab['recordingFormat']!=='none'){_0x5e7995[_0x7491('0xd')]({'type':'outbound','app':_0x7491('0x5'),'appdata':_0x7491('0x1e'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x1f')+_0x1ff9ab[_0x7491('0x1d')]||_0x7491('0x20'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']});}return _0x5e7995;}function _0x5accb6(_0x595337,_0x192023){var _0xf9ab78=[{'name':_0x7491('0x21'),'param':0x0},{'name':_0x7491('0x22'),'param':0x1},{'name':_0x7491('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x579ee4={};var _0x3ca6e2=_0x192023['split'](',');var _0x486317=[];for(var _0x22378f=0x0;_0x22378f<_0xf9ab78[_0x7491('0x24')];_0x22378f++){switch(_0xf9ab78[_0x22378f][_0x7491('0x25')]){case _0x7491('0x21'):_0x579ee4[_0x7491('0x21')]=_0x3ca6e2[_0xf9ab78[_0x22378f]['param']][_0x7491('0x26')]('/')[0x1];_0x579ee4[_0x7491('0x27')]=_0x3ca6e2[_0xf9ab78[_0x22378f]['param']]['split']('/')[0x2];_0x579ee4[_0x7491('0x28')]=_0x579ee4[_0x7491('0x27')]?_0x579ee4[_0x7491('0x27')][_0x7491('0x26')]('$')[0x0]:undefined;_0x579ee4[_0x7491('0x27')]=_0x595337[_0x7491('0x14')]?(_0x579ee4[_0x7491('0x28')]||'')+'${EXTEN:'+_0x595337[_0x7491('0x14')]+'}':(_0x579ee4[_0x7491('0x28')]||'')+'${EXTEN}';_0x486317[_0xf9ab78[_0x22378f][_0x7491('0x29')]]=[_0x7491('0x2a'),_0x579ee4[_0x7491('0x21')],_0x579ee4[_0x7491('0x27')]][_0x7491('0x2b')]('/');break;case _0x7491('0x23'):_0x579ee4['options']=_0x3ca6e2[_0xf9ab78[_0x22378f][_0x7491('0x29')]];if(_0x595337[_0x7491('0x1d')]!==_0x7491('0x2c')){if(_0x579ee4['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x579ee4[_0x7491('0x23')]+=_0x7491('0x2d');}}else{_0x579ee4[_0x7491('0x23')]=_0x579ee4['options']['replace'](_0x7491('0x2d'),'');}_0x486317[_0xf9ab78[_0x22378f]['param']]=_0x579ee4[_0x7491('0x23')];break;default:_0x486317[_0xf9ab78[_0x22378f]['param']]=_0x3ca6e2[_0xf9ab78[_0x22378f][_0x7491('0x29')]];}}return _0x486317[_0x7491('0x2b')](',');}function _0x1371ab(_0x3a8d73,_0x9c3bf0,_0x533d8a){return new Promise(function(_0x47085f,_0x31d0ef){var _0x1c9c05=[];if(_['isEmpty'](_0x9c3bf0))return _0x47085f(_0x1c9c05);_0x55d91c['Interval'][_0x7491('0x2e')]({'attributes':['id',_0x7491('0x2f'),_0x7491('0x30')],'raw':!![]})[_0x7491('0x31')](function(_0x182448){for(var _0x1fb7ac=0x0,_0x37d318=0x0;_0x1fb7ac<_0x9c3bf0[_0x7491('0x24')];_0x1fb7ac++,_0x37d318=0x0){var _0x5d3df6=_0x9c3bf0[_0x1fb7ac];var _0x3228ef=[];var _0x1d31a5=[];delete _0x5d3df6['id'];if(_0x5d3df6[_0x7491('0x2f')]!=='*,*,*,*'){_0x5d3df6[_0x7491('0x32')]=[_0x5d3df6[_0x7491('0x2f')]];}else{_0x5d3df6['intervals']=_0x5d3df6[_0x7491('0x30')]?_[_0x7491('0x33')](_[_0x7491('0x34')](_0x182448,{'IntervalId':_0x5d3df6[_0x7491('0x30')]}),'interval'):[];}_0x5d3df6[_0x7491('0xb')]=_0x3a8d73[_0x7491('0xb')];_0x5d3df6[_0x7491('0xe')]=_0x3a8d73[_0x7491('0xe')];if(_0x5d3df6[_0x7491('0x4')])_0x5d3df6[_0x7491('0x4')]=_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')]();if(_0x3a8d73['type']===_0x7491('0x11')){if(_0x5d3df6[_0x7491('0x1c')](_0x7491('0x36'))&&_0x5d3df6[_0x7491('0x36')]&&_0x5d3df6[_0x7491('0x36')]!=='--'){_0x3228ef['push']({'type':_0x5d3df6[_0x7491('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x7491('0x37')+_0x5d3df6[_0x7491('0x36')],'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6['intervals'][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x38'),'appdata':_0x7491('0x39')+(_0x5d3df6[_0x7491('0x3a')]?_0x7491('0x3b')+_0x5d3df6[_0x7491('0x3a')]+')':_0x7491('0x3c')),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}else{if(_0x5d3df6[_0x7491('0x1c')](_0x7491('0x3d'))){if([_0x7491('0x3e'),_0x7491('0x3f')][_0x7491('0x40')](_0x5d3df6[_0x7491('0x41')]['toLowerCase']())&&_0x5d3df6[_0x7491('0x42')]!=='custom'){if(_0x5d3df6[_0x7491('0x3d')]){_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':'ExecIf','appdata':_0x7491('0x43'),'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x5'),'appdata':_0x7491('0x44'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')]['length']+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}else{_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x38'),'appdata':_0x7491('0x45'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6['type']['toLowerCase'](),'app':'Set','appdata':_0x7491('0x46'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6['intervals'][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}}}}for(var _0x24d0e4=0x0;_0x24d0e4<_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')];_0x24d0e4++){var _0x57fb8b=_0x533d8a+_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')];var _0x16934a=_0x24d0e4===_0x5d3df6['intervals'][_0x7491('0x24')]-0x1?_0x533d8a+_0x3228ef[_0x7491('0x24')]+_0x1d31a5[_0x7491('0x24')]+0x2:_0x533d8a+_0x24d0e4+0x1;_0x3228ef[_0x7491('0x47')](_0x24d0e4,0x0,{'type':_0x3a8d73['type'],'app':_0x7491('0x48'),'appdata':_0x5d3df6[_0x7491('0x32')][_0x24d0e4]+'?'+_0x3a8d73[_0x7491('0xb')]+',${EXTEN},'+_0x57fb8b+':'+_0x3a8d73[_0x7491('0xb')]+',${EXTEN},'+_0x16934a,'exten':_0x3a8d73[_0x7491('0xe')],'context':_0x3a8d73['context'],'priority':_0x533d8a+_0x24d0e4,'VoiceExtensionId':_0x3a8d73['id']});}if(_0x5d3df6[_0x7491('0x42')]==='outboundDial'){_0x5d3df6['appdata']=_0x5accb6(_0x3a8d73,_0x5d3df6['appdata']);}if(_0x5d3df6[_0x7491('0x42')]==='agi'){_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6['type'][_0x7491('0x35')](),'app':_0x7491('0x5'),'appdata':_0x7491('0x49'),'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')]['length']+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}_0x5d3df6[_0x7491('0x4a')]=_0x3228ef[_0x7491('0x24')]?_['last'](_0x3228ef)['priority']+0x1:_0x533d8a;_0x1c9c05=_[_0x7491('0x4b')](_0x1c9c05,_0x3228ef,[_0x5d3df6],_0x1d31a5);_0x533d8a=_['last'](_0x1c9c05)['priority']+0x1;}return _0x47085f(_0x1c9c05);})['catch'](function(_0x3514ab){_0x31d0ef(_0x3514ab);});});}return _0x4c4994[_0x7491('0x4c')](_0x7491('0x4d'),attributes,{'tableName':_0x7491('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x90f560){var _0x553475=this[_0x7491('0x4f')]({'plain':!![]});var _0x3f879b=_0x553475[_0x7491('0x4')]==='outbound'?_0x134b67(_0x553475):_0x2c7abe(_0x553475);return _0x1371ab(_0x553475,_0x90f560,_[_0x7491('0x50')](_0x3f879b)['priority']+0x1)['then'](function(_0x56d2a1){var _0x69f7a4=_[_0x7491('0x4b')](_0x3f879b,_0x56d2a1);_0x69f7a4['push']({'type':_0x553475[_0x7491('0x4')],'app':'Hangup','exten':_0x553475[_0x7491('0xe')],'context':_0x553475['context'],'priority':_[_0x7491('0x50')](_0x69f7a4)[_0x7491('0x4a')]+0x1,'VoiceExtensionId':_0x553475['id']});return _0x69f7a4;});}}});}; \ No newline at end of file +var _0xb005=['Hangup','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','then','interval','intervals','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','VoiceExtension','get'];(function(_0x40f093,_0x1dfc9f){var _0x3a4e84=function(_0x587e7f){while(--_0x587e7f){_0x40f093['push'](_0x40f093['shift']());}};_0x3a4e84(++_0x1dfc9f);}(_0xb005,0x159));var _0x5b00=function(_0x2a9919,_0x528008){_0x2a9919=_0x2a9919-0x0;var _0x37084d=_0xb005[_0x2a9919];return _0x37084d;};'use strict';var _=require(_0x5b00('0x0'));var attributes=require(_0x5b00('0x1'));module[_0x5b00('0x2')]=function(_0x431f44){var _0x3dfefe=_0x431f44[_0x5b00('0x3')];function _0x300450(_0x211d32){var _0x2241b4=0x2;var _0x293cc3=[{'type':_0x211d32['type'],'app':'Set','appdata':_0x5b00('0x4')+_0x211d32[_0x5b00('0x5')],'context':_0x211d32[_0x5b00('0x6')],'exten':_0x211d32['exten'],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']},{'type':_0x211d32[_0x5b00('0x5')],'app':_0x211d32[_0x5b00('0x7')]?_0x5b00('0x8'):_0x5b00('0x9'),'appdata':_0x211d32[_0x5b00('0x7')]?_0x5b00('0xa')+_0x211d32['alias']:_0x5b00('0xb'),'context':_0x211d32[_0x5b00('0x6')],'exten':_0x211d32[_0x5b00('0xc')],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']}];if(_0x211d32[_0x5b00('0x5')]===_0x5b00('0xd')){_0x293cc3[_0x5b00('0xe')]({'type':_0x5b00('0xd'),'app':'Set','appdata':_0x5b00('0xf')+_0x211d32['id'],'context':_0x211d32['context'],'exten':_0x211d32['exten'],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']});}_0x293cc3[_0x5b00('0xe')]({'type':_0x211d32[_0x5b00('0x5')],'app':'Set','appdata':_0x5b00('0x10'),'context':_0x211d32[_0x5b00('0x6')],'exten':_0x211d32[_0x5b00('0xc')],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']},{'type':_0x211d32[_0x5b00('0x5')],'app':_0x5b00('0x8'),'appdata':_0x5b00('0x11'),'context':_0x211d32[_0x5b00('0x6')],'exten':_0x211d32['exten'],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']},{'type':_0x211d32['type'],'app':'Set','appdata':_0x5b00('0x12'),'context':_0x211d32[_0x5b00('0x6')],'exten':_0x211d32[_0x5b00('0xc')],'priority':_0x2241b4++,'VoiceExtensionId':_0x211d32['id']});return _0x293cc3;}function _0x2a38f4(_0x306967){var _0x20951d=0x2;var _0x25f8b4=[{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x14'),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x306967[_0x5b00('0x7')]?_0x5b00('0x8'):'NoOp','appdata':_0x306967['alias']?_0x5b00('0xa')+_0x306967[_0x5b00('0x7')]:'No\x20alias\x20set','context':_0x306967['context'],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x15')+(_0x306967[_0x5b00('0x16')]?_0x5b00('0x17')+_0x306967[_0x5b00('0x16')]+'}':_0x5b00('0x18')),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967['exten'],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0xf')+_0x306967['id'],'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':'outbound','app':'ExecIf','appdata':_0x5b00('0x19')+(_0x20951d+0x2)+_0x5b00('0x1a')+(_0x20951d+0x1)+')','context':_0x306967[_0x5b00('0x6')],'exten':_0x306967['exten'],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':'Set','appdata':_0x306967[_0x5b00('0x16')]?_0x5b00('0x1b')+_0x306967[_0x5b00('0x16')]+'}':_0x5b00('0x1c'),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967['exten'],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':'outbound','app':_0x5b00('0x8'),'appdata':_0x5b00('0x10'),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x11'),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967['exten'],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x306967['context'],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x1d')+_0x306967['id'],'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']}];if(_0x306967[_0x5b00('0x1e')]('recordingFormat')&&_0x306967[_0x5b00('0x1f')]!==_0x5b00('0x20')){_0x25f8b4['push']({'type':_0x5b00('0x13'),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x21'),'context':_0x306967['context'],'exten':_0x306967[_0x5b00('0xc')],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']},{'type':_0x5b00('0x13'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x306967['recordingFormat']||_0x5b00('0x22'),'context':_0x306967[_0x5b00('0x6')],'exten':_0x306967['exten'],'priority':_0x20951d++,'VoiceExtensionId':_0x306967['id']});}return _0x25f8b4;}function _0x4daa35(_0x18c124,_0x71686e){var _0x3d9711=[{'name':_0x5b00('0x23'),'param':0x0},{'name':_0x5b00('0x24'),'param':0x1},{'name':_0x5b00('0x25'),'param':0x2},{'name':_0x5b00('0x26'),'param':0x3}];var _0x20c0d6={};var _0x1d7bb1=_0x71686e[_0x5b00('0x27')](',');var _0x340a39=[];for(var _0x4223d1=0x0;_0x4223d1<_0x3d9711[_0x5b00('0x28')];_0x4223d1++){switch(_0x3d9711[_0x4223d1][_0x5b00('0x29')]){case _0x5b00('0x23'):_0x20c0d6[_0x5b00('0x23')]=_0x1d7bb1[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]]['split']('/')[0x1];_0x20c0d6[_0x5b00('0x2b')]=_0x1d7bb1[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]][_0x5b00('0x27')]('/')[0x2];_0x20c0d6[_0x5b00('0x2c')]=_0x20c0d6[_0x5b00('0x2b')]?_0x20c0d6['phone']['split']('$')[0x0]:undefined;_0x20c0d6[_0x5b00('0x2b')]=_0x18c124[_0x5b00('0x16')]?(_0x20c0d6['prefix']||'')+_0x5b00('0x17')+_0x18c124['cutdigits']+'}':(_0x20c0d6[_0x5b00('0x2c')]||'')+'${EXTEN}';_0x340a39[_0x3d9711[_0x4223d1]['param']]=[_0x5b00('0x2d'),_0x20c0d6[_0x5b00('0x23')],_0x20c0d6[_0x5b00('0x2b')]][_0x5b00('0x2e')]('/');break;case'options':_0x20c0d6[_0x5b00('0x25')]=_0x1d7bb1[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]];if(_0x18c124[_0x5b00('0x1f')]!==_0x5b00('0x20')){if(_0x20c0d6['options']['indexOf'](_0x5b00('0x2f'))<0x0){_0x20c0d6[_0x5b00('0x25')]+='U(xcally-mixmonitor-context)';}}else{_0x20c0d6[_0x5b00('0x25')]=_0x20c0d6[_0x5b00('0x25')][_0x5b00('0x30')](_0x5b00('0x2f'),'');}_0x340a39[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]]=_0x20c0d6['options'];break;default:_0x340a39[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]]=_0x1d7bb1[_0x3d9711[_0x4223d1][_0x5b00('0x2a')]];}}return _0x340a39[_0x5b00('0x2e')](',');}function _0x23fa94(_0x1b40d5,_0x392b40,_0x1cac40){return new Promise(function(_0x1ba092,_0x2ba615){var _0xf1b743=[];if(_[_0x5b00('0x31')](_0x392b40))return _0x1ba092(_0xf1b743);_0x3dfefe['Interval'][_0x5b00('0x32')]({'attributes':['id','interval',_0x5b00('0x33')],'raw':!![]})[_0x5b00('0x34')](function(_0x2c7e5a){for(var _0x37b494=0x0,_0x12090f=0x0;_0x37b494<_0x392b40['length'];_0x37b494++,_0x12090f=0x0){var _0x3db9b1=_0x392b40[_0x37b494];var _0x4f4160=[];var _0x33eb8b=[];delete _0x3db9b1['id'];if(_0x3db9b1[_0x5b00('0x35')]!=='*,*,*,*'){_0x3db9b1[_0x5b00('0x36')]=[_0x3db9b1[_0x5b00('0x35')]];}else{_0x3db9b1[_0x5b00('0x36')]=_0x3db9b1[_0x5b00('0x33')]?_['map'](_[_0x5b00('0x37')](_0x2c7e5a,{'IntervalId':_0x3db9b1[_0x5b00('0x33')]}),_0x5b00('0x35')):[];}_0x3db9b1[_0x5b00('0x6')]=_0x1b40d5[_0x5b00('0x6')];_0x3db9b1[_0x5b00('0xc')]=_0x1b40d5['exten'];if(_0x3db9b1[_0x5b00('0x5')])_0x3db9b1[_0x5b00('0x5')]=_0x3db9b1['type'][_0x5b00('0x38')]();if(_0x1b40d5[_0x5b00('0x5')]===_0x5b00('0x13')){if(_0x3db9b1[_0x5b00('0x1e')](_0x5b00('0x39'))&&_0x3db9b1[_0x5b00('0x39')]&&_0x3db9b1[_0x5b00('0x39')]!=='--'){_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')][_0x5b00('0x38')](),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x3a')+_0x3db9b1[_0x5b00('0x39')],'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5[_0x5b00('0xc')],'priority':_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')]+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});}_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')][_0x5b00('0x38')](),'app':_0x5b00('0x3b'),'appdata':_0x5b00('0x3c')+(_0x3db9b1[_0x5b00('0x3d')]?_0x5b00('0x3e')+_0x3db9b1['callerID']+')':_0x5b00('0x3f')),'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5['exten'],'priority':_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')]+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});}else{if(_0x3db9b1[_0x5b00('0x1e')](_0x5b00('0x40'))){if([_0x5b00('0x41'),_0x5b00('0x42')][_0x5b00('0x43')](_0x3db9b1[_0x5b00('0x44')]['toLowerCase']())&&_0x3db9b1[_0x5b00('0x45')]!=='custom'){if(_0x3db9b1[_0x5b00('0x40')]){_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')]['toLowerCase'](),'app':_0x5b00('0x3b'),'appdata':_0x5b00('0x46'),'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5['exten'],'priority':_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')]+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')][_0x5b00('0x38')](),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x47'),'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5[_0x5b00('0xc')],'priority':_0x3db9b1[_0x5b00('0x36')]['length']+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});}else{_0x4f4160['push']({'type':_0x3db9b1['type'][_0x5b00('0x38')](),'app':_0x5b00('0x3b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5[_0x5b00('0xc')],'priority':_0x3db9b1[_0x5b00('0x36')]['length']+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')][_0x5b00('0x38')](),'app':_0x5b00('0x8'),'appdata':_0x5b00('0x48'),'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5[_0x5b00('0xc')],'priority':_0x3db9b1['intervals']['length']+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});}}}}for(var _0x3a2d94=0x0;_0x3a2d94<_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')];_0x3a2d94++){var _0x1f441b=_0x1cac40+_0x3db9b1['intervals'][_0x5b00('0x28')];var _0x3301bb=_0x3a2d94===_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')]-0x1?_0x1cac40+_0x4f4160[_0x5b00('0x28')]+_0x33eb8b[_0x5b00('0x28')]+0x2:_0x1cac40+_0x3a2d94+0x1;_0x4f4160[_0x5b00('0x49')](_0x3a2d94,0x0,{'type':_0x1b40d5[_0x5b00('0x5')],'app':_0x5b00('0x4a'),'appdata':_0x3db9b1[_0x5b00('0x36')][_0x3a2d94]+'?'+_0x1b40d5['context']+',${EXTEN},'+_0x1f441b+':'+_0x1b40d5['context']+_0x5b00('0x4b')+_0x3301bb,'exten':_0x1b40d5[_0x5b00('0xc')],'context':_0x1b40d5[_0x5b00('0x6')],'priority':_0x1cac40+_0x3a2d94,'VoiceExtensionId':_0x1b40d5['id']});}if(_0x3db9b1[_0x5b00('0x45')]==='outboundDial'){_0x3db9b1[_0x5b00('0x4c')]=_0x4daa35(_0x1b40d5,_0x3db9b1[_0x5b00('0x4c')]);}if(_0x3db9b1[_0x5b00('0x45')]===_0x5b00('0x4d')){_0x4f4160[_0x5b00('0xe')]({'type':_0x3db9b1[_0x5b00('0x5')][_0x5b00('0x38')](),'app':'Set','appdata':_0x5b00('0x4e'),'context':_0x1b40d5[_0x5b00('0x6')],'exten':_0x1b40d5[_0x5b00('0xc')],'priority':_0x3db9b1[_0x5b00('0x36')][_0x5b00('0x28')]+_0x1cac40+_0x12090f++,'VoiceExtensionId':_0x1b40d5['id']});}_0x3db9b1[_0x5b00('0x4f')]=_0x4f4160[_0x5b00('0x28')]?_['last'](_0x4f4160)[_0x5b00('0x4f')]+0x1:_0x1cac40;_0xf1b743=_[_0x5b00('0x50')](_0xf1b743,_0x4f4160,[_0x3db9b1],_0x33eb8b);_0x1cac40=_[_0x5b00('0x51')](_0xf1b743)[_0x5b00('0x4f')]+0x1;}return _0x1ba092(_0xf1b743);})[_0x5b00('0x52')](function(_0x3b6ba1){_0x2ba615(_0x3b6ba1);});});}return _0x431f44['define'](_0x5b00('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x36efb0){var _0x1c62cc=this[_0x5b00('0x54')]({'plain':!![]});var _0x2e4436=_0x1c62cc[_0x5b00('0x5')]==='outbound'?_0x2a38f4(_0x1c62cc):_0x300450(_0x1c62cc);return _0x23fa94(_0x1c62cc,_0x36efb0,_[_0x5b00('0x51')](_0x2e4436)[_0x5b00('0x4f')]+0x1)[_0x5b00('0x34')](function(_0x31ddeb){var _0x455d1d=_[_0x5b00('0x50')](_0x2e4436,_0x31ddeb);_0x455d1d[_0x5b00('0xe')]({'type':_0x1c62cc[_0x5b00('0x5')],'app':_0x5b00('0x55'),'exten':_0x1c62cc['exten'],'context':_0x1c62cc['context'],'priority':_[_0x5b00('0x51')](_0x455d1d)[_0x5b00('0x4f')]+0x1,'VoiceExtensionId':_0x1c62cc['id']});return _0x455d1d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8e51e45..8c2d8e1 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 _0x5b5a=['limit','include','map','model','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0x5b5a[_0x1bf57f];return _0x23a86b;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var moment=require(_0xa5b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b5('0x2'));var fs=require('fs');var Redis=require(_0xa5b5('0x3'));var db=require(_0xa5b5('0x4'))['db'];var utils=require(_0xa5b5('0x5'));var logger=require(_0xa5b5('0x6'))(_0xa5b5('0x7'));var config=require(_0xa5b5('0x8'));var jayson=require(_0xa5b5('0x9'));var client=jayson['client'][_0xa5b5('0xa')]({'port':0x232a});config[_0xa5b5('0xb')]=_['defaults'](config[_0xa5b5('0xb')],{'host':_0xa5b5('0xc'),'port':0x18eb});var socket=require(_0xa5b5('0xd'))(new Redis(config[_0xa5b5('0xb')]));require(_0xa5b5('0xe'))[_0xa5b5('0xf')](socket);function respondWithRpcPromise(_0x3d635d,_0x396c44,_0x37489f){return new BPromise(function(_0x1a35a0,_0x529bc3){return client['request'](_0x3d635d,_0x37489f)['then'](function(_0x5ad9f4){logger[_0xa5b5('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x396c44,_0xa5b5('0x11'));logger['debug'](_0xa5b5('0x12'),_0x396c44,_0xa5b5('0x11'),JSON[_0xa5b5('0x13')](_0x5ad9f4));if(_0x5ad9f4[_0xa5b5('0x14')]){if(_0x5ad9f4[_0xa5b5('0x14')][_0xa5b5('0x15')]===0x1f4){logger[_0xa5b5('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x396c44,_0x5ad9f4['error'][_0xa5b5('0x16')]);return _0x529bc3(_0x5ad9f4['error'][_0xa5b5('0x16')]);}logger[_0xa5b5('0x14')](_0xa5b5('0x17'),_0x396c44,_0x5ad9f4['error']['message']);return _0x1a35a0(_0x5ad9f4['error']['message']);}else{logger[_0xa5b5('0x10')](_0xa5b5('0x17'),_0x396c44,_0xa5b5('0x11'));_0x1a35a0(_0x5ad9f4[_0xa5b5('0x18')][_0xa5b5('0x16')]);}})[_0xa5b5('0x19')](function(_0x590620){logger[_0xa5b5('0x14')](_0xa5b5('0x17'),_0x396c44,_0x590620);_0x529bc3(_0x590620);});});}exports[_0xa5b5('0x1a')]=function(_0x4f31d4){var _0x21aa02=this;return new Promise(function(_0x243708,_0x5c64a9){return db[_0xa5b5('0x1b')][_0xa5b5('0x1c')]({'raw':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x1f')]||null:null,'attributes':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x20')]||null:null,'limit':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x21')]||null:null,'include':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x22')]?_[_0xa5b5('0x23')](_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x22')],function(_0x39f19b){return{'model':db[_0x39f19b[_0xa5b5('0x24')]],'as':_0x39f19b['as'],'attributes':_0x39f19b[_0xa5b5('0x20')],'include':_0x39f19b[_0xa5b5('0x22')]?_['map'](_0x39f19b[_0xa5b5('0x22')],function(_0x159bcd){return{'model':db[_0x159bcd[_0xa5b5('0x24')]],'as':_0x159bcd['as'],'attributes':_0x159bcd[_0xa5b5('0x20')],'include':_0x159bcd['include']?_[_0xa5b5('0x23')](_0x159bcd[_0xa5b5('0x22')],function(_0x39a721){return{'model':db[_0x39a721[_0xa5b5('0x24')]],'as':_0x39a721['as'],'attributes':_0x39a721[_0xa5b5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x365b73){logger['info'](_0xa5b5('0x1a'),_0x4f31d4);logger[_0xa5b5('0x25')](_0xa5b5('0x1a'),_0x4f31d4,JSON['stringify'](_0x365b73));_0x243708(_0x365b73);})[_0xa5b5('0x19')](function(_0x4b0134){logger[_0xa5b5('0x14')](_0xa5b5('0x1a'),_0x4b0134[_0xa5b5('0x16')],_0x4f31d4);_0x5c64a9(_0x21aa02[_0xa5b5('0x14')](0x1f4,_0x4b0134[_0xa5b5('0x16')]));});});}; \ No newline at end of file +var _0xf88f=['map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include'];(function(_0x2971e6,_0x4a962e){var _0x5e6392=function(_0x16e6cf){while(--_0x16e6cf){_0x2971e6['push'](_0x2971e6['shift']());}};_0x5e6392(++_0x4a962e);}(_0xf88f,0x1bb));var _0xff88=function(_0x442c2d,_0x44da71){_0x442c2d=_0x442c2d-0x0;var _0x4895b8=_0xf88f[_0x442c2d];return _0x4895b8;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var moment=require(_0xff88('0x2'));var BPromise=require(_0xff88('0x3'));var rs=require(_0xff88('0x4'));var fs=require('fs');var Redis=require(_0xff88('0x5'));var db=require(_0xff88('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xff88('0x7'))(_0xff88('0x8'));var config=require(_0xff88('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff88('0xa')][_0xff88('0xb')]({'port':0x232a});config[_0xff88('0xc')]=_[_0xff88('0xd')](config[_0xff88('0xc')],{'host':_0xff88('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff88('0xc')]));require(_0xff88('0xf'))[_0xff88('0x10')](socket);function respondWithRpcPromise(_0x4715fc,_0x3d5534,_0x3dcefc){return new BPromise(function(_0x22bca3,_0x178fc4){return client[_0xff88('0x11')](_0x4715fc,_0x3dcefc)[_0xff88('0x12')](function(_0xc1ee70){logger[_0xff88('0x13')](_0xff88('0x14'),_0x3d5534,_0xff88('0x15'));logger[_0xff88('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3d5534,_0xff88('0x15'),JSON[_0xff88('0x17')](_0xc1ee70));if(_0xc1ee70[_0xff88('0x18')]){if(_0xc1ee70['error'][_0xff88('0x19')]===0x1f4){logger[_0xff88('0x18')](_0xff88('0x14'),_0x3d5534,_0xc1ee70[_0xff88('0x18')][_0xff88('0x1a')]);return _0x178fc4(_0xc1ee70[_0xff88('0x18')][_0xff88('0x1a')]);}logger[_0xff88('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3d5534,_0xc1ee70[_0xff88('0x18')][_0xff88('0x1a')]);return _0x22bca3(_0xc1ee70['error']['message']);}else{logger[_0xff88('0x13')](_0xff88('0x14'),_0x3d5534,'request\x20sent');_0x22bca3(_0xc1ee70[_0xff88('0x1b')][_0xff88('0x1a')]);}})['catch'](function(_0x2bafb1){logger[_0xff88('0x18')](_0xff88('0x14'),_0x3d5534,_0x2bafb1);_0x178fc4(_0x2bafb1);});});}exports[_0xff88('0x1c')]=function(_0x3eba3e){var _0x31f899=this;return new Promise(function(_0x30fba4,_0x529e55){return db[_0xff88('0x1d')][_0xff88('0x1e')]({'raw':_0x3eba3e[_0xff88('0x1f')]?_0x3eba3e[_0xff88('0x1f')][_0xff88('0x20')]===undefined?!![]:![]:!![],'where':_0x3eba3e[_0xff88('0x1f')]?_0x3eba3e['options'][_0xff88('0x21')]||null:null,'attributes':_0x3eba3e[_0xff88('0x1f')]?_0x3eba3e[_0xff88('0x1f')][_0xff88('0x22')]||null:null,'limit':_0x3eba3e[_0xff88('0x1f')]?_0x3eba3e[_0xff88('0x1f')][_0xff88('0x23')]||null:null,'include':_0x3eba3e['options']?_0x3eba3e[_0xff88('0x1f')][_0xff88('0x24')]?_['map'](_0x3eba3e[_0xff88('0x1f')][_0xff88('0x24')],function(_0x2326f2){return{'model':db[_0x2326f2['model']],'as':_0x2326f2['as'],'attributes':_0x2326f2[_0xff88('0x22')],'include':_0x2326f2[_0xff88('0x24')]?_['map'](_0x2326f2[_0xff88('0x24')],function(_0x362d60){return{'model':db[_0x362d60['model']],'as':_0x362d60['as'],'attributes':_0x362d60[_0xff88('0x22')],'include':_0x362d60[_0xff88('0x24')]?_[_0xff88('0x25')](_0x362d60[_0xff88('0x24')],function(_0x1e97af){return{'model':db[_0x1e97af[_0xff88('0x26')]],'as':_0x1e97af['as'],'attributes':_0x1e97af['attributes']};}):[]};}):[]};}):[]:[]})[_0xff88('0x12')](function(_0x281831){logger['info'](_0xff88('0x1c'),_0x3eba3e);logger[_0xff88('0x16')](_0xff88('0x1c'),_0x3eba3e,JSON[_0xff88('0x17')](_0x281831));_0x30fba4(_0x281831);})[_0xff88('0x27')](function(_0x68a5c0){logger['error'](_0xff88('0x1c'),_0x68a5c0[_0xff88('0x1a')],_0x3eba3e);_0x529e55(_0x31f899[_0xff88('0x18')](0x1f4,_0x68a5c0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0ba1ad0..ef4309f 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(_0x3d7bc7,_0x526d29){var _0x1f26c6=function(_0x32b186){while(--_0x32b186){_0x3d7bc7['push'](_0x3d7bc7['shift']());}};_0x1f26c6(++_0x526d29);}(_0x0295,0x1f0));var _0x5029=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0x0295[_0x5fb9da];return _0x528081;};'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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x814b,0x1a2));var _0xb814=function(_0x552c27,_0x478dc2){_0x552c27=_0x552c27-0x0;var _0x2a0922=_0x814b[_0x552c27];return _0x2a0922;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1646e32..94975c4 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 _0xacf4=['index','/:id','isAuthenticated','show','post','create','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x477f6e,_0x21814f){var _0x1af2fe=function(_0x1d01f8){while(--_0x1d01f8){_0x477f6e['push'](_0x477f6e['shift']());}};_0x1af2fe(++_0x21814f);}(_0xacf4,0xe7));var _0x4acf=function(_0x2e48bf,_0x4bde87){_0x2e48bf=_0x2e48bf-0x0;var _0x2b6b2d=_0xacf4[_0x2e48bf];return _0x2b6b2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id/messages',auth[_0x4acf('0xb')](),controller['getMessages']);router[_0x4acf('0xd')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0xe')]);router['put'](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller['update']);router['delete'](_0x4acf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0xf')]=router; \ No newline at end of file +var _0x4819=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','/:id','show','get','/:id/messages','getMessages','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x164455,_0xe24a53){var _0x372db3=function(_0x50cf50){while(--_0x50cf50){_0x164455['push'](_0x164455['shift']());}};_0x372db3(++_0xe24a53);}(_0x4819,0xcd));var _0x9481=function(_0x203a88,_0x32521b){_0x203a88=_0x203a88-0x0;var _0x46e6ce=_0x4819[_0x203a88];return _0x46e6ce;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['post']('/',auth[_0x9481('0xa')](),controller['create']);router[_0x9481('0x10')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 226b745..217e06a 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 _0x5619=['sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x4c27d5,_0x574816){var _0x3a0d7e=function(_0xe5aa3a){while(--_0xe5aa3a){_0x4c27d5['push'](_0x4c27d5['shift']());}};_0x3a0d7e(++_0x574816);}(_0x5619,0x130));var _0x9561=function(_0x136cb4,_0x22a5e3){_0x136cb4=_0x136cb4-0x0;var _0x4190bb=_0x5619[_0x136cb4];return _0x4190bb;};'use strict';var Sequelize=require(_0x9561('0x0'));module[_0x9561('0x1')]={'customer_id':{'type':Sequelize[_0x9561('0x2')]},'context':{'type':Sequelize[_0x9561('0x2')],'defaultValue':'from-voicemail','unique':_0x9561('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9561('0x3')},'password':{'type':Sequelize[_0x9561('0x2')]},'fullname':{'type':Sequelize[_0x9561('0x2')]},'email':{'type':Sequelize[_0x9561('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe79b5e){this[_0x9561('0x4')](_0x9561('0x5'),typeof _0xe79b5e==='string'&&_0xe79b5e[_0x9561('0x6')]()?_0xe79b5e[_0x9561('0x6')]():null);}},'pager':{'type':Sequelize[_0x9561('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x9561('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9561('0x2')]},'review':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9561('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'stamp':{'type':_0x9561('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9561('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9561('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9561('0xc')],'get':function(){return this[_0x9561('0xd')](_0x9561('0xe'))+_0x9561('0xf')+this[_0x9561('0xd')]('mailbox');}}}; \ No newline at end of file +var _0xbca8=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM'];(function(_0x22b34d,_0x180cdc){var _0x126404=function(_0x4ec08a){while(--_0x4ec08a){_0x22b34d['push'](_0x22b34d['shift']());}};_0x126404(++_0x180cdc);}(_0xbca8,0x17d));var _0x8bca=function(_0x41116f,_0xf9ff90){_0x41116f=_0x41116f-0x0;var _0x488154=_0xbca8[_0x41116f];return _0x488154;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'customer_id':{'type':Sequelize[_0x8bca('0x2')]},'context':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':_0x8bca('0x3'),'unique':_0x8bca('0x4')},'mailbox':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8bca('0x2')]},'fullname':{'type':Sequelize[_0x8bca('0x2')]},'email':{'type':Sequelize[_0x8bca('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1d6b38){this['setDataValue'](_0x8bca('0x5'),typeof _0x1d6b38===_0x8bca('0x6')&&_0x1d6b38['trim']()?_0x1d6b38[_0x8bca('0x7')]():null);}},'pager':{'type':Sequelize[_0x8bca('0x2')]},'tz':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':_0x8bca('0x8')},'attach':{'type':Sequelize[_0x8bca('0x9')]('yes','no'),'defaultValue':_0x8bca('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8bca('0xa'),'no'),'defaultValue':_0x8bca('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8bca('0x2')]},'review':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8bca('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':_0x8bca('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8bca('0x9')](_0x8bca('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8bca('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8bca('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x8bca('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x8bca('0x2')]},'maxsecs':{'type':Sequelize[_0x8bca('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8bca('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8bca('0xd')],'get':function(){return this[_0x8bca('0xe')](_0x8bca('0xf'))+'\x20-\x20'+this[_0x8bca('0xe')](_0x8bca('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aca238c..e119650 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 _0x4e81=['merge','VIRTUAL','filter','options','rows','catch','show','params','length','includeAll','include','find','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Voicemails','UserProfileResource','end','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x4e81,0x1bc));var _0x14e8=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x4e81[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){var _0x4a758c=_0x4ffc8b[_0x14e8('0x25')]({'plain':!![]});var _0x3eae0b=_0x14e8('0x26');return db[_0x14e8('0x27')]['destroy']({'where':{'type':_0x3eae0b,'resourceId':_0x4a758c['id']}})[_0x14e8('0x24')](function(){return _0x4ffc8b;});})[_0x14e8('0x24')](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x28')]();});}};}function handleEntityNotFound(_0x28035a,_0xfc0545){return function(_0x2813ae){if(!_0x2813ae){_0x28035a['sendStatus'](0x194);}return _0x2813ae;};}function handleError(_0x38d7a7,_0x151090){_0x151090=_0x151090||0x1f4;return function(_0x393ab0){logger['error'](_0x393ab0['stack']);if(_0x393ab0['name']){delete _0x393ab0[_0x14e8('0x29')];}_0x38d7a7[_0x14e8('0x1a')](_0x151090)['send'](_0x393ab0);};}exports[_0x14e8('0x2a')]=function(_0x1d71ca,_0x176e8f){var _0xa83433={},_0x5c2635={},_0x1f1259={'count':0x0,'rows':[]};var _0x260d51=_[_0x14e8('0x2b')](db[_0x14e8('0x2c')][_0x14e8('0x2d')],function(_0x54068d){return{'name':_0x54068d[_0x14e8('0x2e')],'type':_0x54068d[_0x14e8('0x2f')][_0x14e8('0x30')]};});_0x5c2635[_0x14e8('0x31')]=_['map'](_0x260d51,_0x14e8('0x29'));_0x5c2635['query']=_[_0x14e8('0x32')](_0x1d71ca[_0x14e8('0x33')]);_0x5c2635[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],_0x5c2635[_0x14e8('0x33')]);_0xa83433[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x37')]));_0xa83433['attributes']=_0xa83433['attributes']['length']?_0xa83433[_0x14e8('0x36')]:_0x5c2635['model'];if(!_0x1d71ca[_0x14e8('0x33')]['hasOwnProperty'](_0x14e8('0x38'))){_0xa83433[_0x14e8('0x1e')]=qs[_0x14e8('0x1e')](_0x1d71ca[_0x14e8('0x33')]['limit']);_0xa83433[_0x14e8('0x1c')]=qs['offset'](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0xa83433[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3a')]);_0xa83433['where']=qs[_0x14e8('0x34')](_['pick'](_0x1d71ca[_0x14e8('0x33')],_0x5c2635[_0x14e8('0x34')]),_0x260d51);if(_0x1d71ca[_0x14e8('0x33')]['filter']){_0xa83433[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0xa83433['where'],{'$or':_[_0x14e8('0x2b')](_0x260d51,function(_0x38b874){if(_0x38b874[_0x14e8('0x2f')]!==_0x14e8('0x3d')){var _0x77e8a0={};_0x77e8a0[_0x38b874[_0x14e8('0x29')]]={'$like':'%'+_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3e')]+'%'};return _0x77e8a0;}})});}_0xa83433=_[_0x14e8('0x3c')]({},_0xa83433,_0x1d71ca[_0x14e8('0x3f')]);var _0x11f0ee={'where':_0xa83433[_0x14e8('0x3b')]};return db[_0x14e8('0x2c')][_0x14e8('0x1f')](_0x11f0ee)[_0x14e8('0x24')](function(_0x596ac7){_0x1f1259[_0x14e8('0x1f')]=_0x596ac7;if(_0x1d71ca['query']['includeAll']){_0xa83433['include']=[{'all':!![]}];}return db[_0x14e8('0x2c')]['findAll'](_0xa83433);})[_0x14e8('0x24')](function(_0x45bff0){_0x1f1259[_0x14e8('0x40')]=_0x45bff0;return _0x1f1259;})[_0x14e8('0x24')](respondWithFilteredResult(_0x176e8f,_0xa83433))[_0x14e8('0x41')](handleError(_0x176e8f,null));};exports[_0x14e8('0x42')]=function(_0x125af5,_0xd52530){var _0x2ccd6c={'raw':!![],'where':{'id':_0x125af5[_0x14e8('0x43')]['id']}},_0x3f9da0={};_0x3f9da0['model']=_[_0x14e8('0x32')](db[_0x14e8('0x2c')][_0x14e8('0x2d')]);_0x3f9da0[_0x14e8('0x33')]=_['keys'](_0x125af5[_0x14e8('0x33')]);_0x3f9da0[_0x14e8('0x34')]=_['intersection'](_0x3f9da0['model'],_0x3f9da0[_0x14e8('0x33')]);_0x2ccd6c['attributes']=_['intersection'](_0x3f9da0[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x125af5['query'][_0x14e8('0x37')]));_0x2ccd6c[_0x14e8('0x36')]=_0x2ccd6c['attributes'][_0x14e8('0x44')]?_0x2ccd6c[_0x14e8('0x36')]:_0x3f9da0[_0x14e8('0x31')];if(_0x125af5[_0x14e8('0x33')][_0x14e8('0x45')]){_0x2ccd6c[_0x14e8('0x46')]=[{'all':!![]}];}_0x2ccd6c=_[_0x14e8('0x3c')]({},_0x2ccd6c,_0x125af5[_0x14e8('0x3f')]);return db[_0x14e8('0x2c')][_0x14e8('0x47')](_0x2ccd6c)[_0x14e8('0x24')](handleEntityNotFound(_0xd52530,null))[_0x14e8('0x24')](respondWithResult(_0xd52530,null))[_0x14e8('0x41')](handleError(_0xd52530,null));};exports[_0x14e8('0x48')]=function(_0x1bf742,_0x1f50bc){return db['VoiceMail'][_0x14e8('0x48')](_0x1bf742['body'],{})[_0x14e8('0x24')](function(_0x3fadc2){var _0x403628=_0x1bf742[_0x14e8('0x49')]['get']({'plain':!![]});if(!_0x403628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403628['role']===_0x14e8('0x49')){var _0x49657e=_0x3fadc2['get']({'plain':!![]});var _0xd2b281=_0x14e8('0x26');return db['UserProfileSection'][_0x14e8('0x47')]({'where':{'name':_0xd2b281,'userProfileId':_0x403628[_0x14e8('0x4a')]},'raw':!![]})[_0x14e8('0x24')](function(_0x416e65){if(_0x416e65&&_0x416e65['autoAssociation']===0x0){return db['UserProfileResource'][_0x14e8('0x48')]({'name':_0x49657e[_0x14e8('0x29')],'resourceId':_0x49657e['id'],'type':_0x416e65[_0x14e8('0x29')],'sectionId':_0x416e65['id']},{})[_0x14e8('0x24')](function(){return _0x3fadc2;});}else{return _0x3fadc2;}})[_0x14e8('0x41')](function(_0x2fbac7){logger['error'](_0x14e8('0x4b'),_0x2fbac7);throw _0x2fbac7;});}return _0x3fadc2;})[_0x14e8('0x24')](respondWithResult(_0x1f50bc,0xc9))[_0x14e8('0x41')](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4c')]=function(_0x5e6083,_0x2af48f){if(_0x5e6083[_0x14e8('0x4d')]['id']){delete _0x5e6083[_0x14e8('0x4d')]['id'];}return db[_0x14e8('0x2c')]['find']({'where':{'id':_0x5e6083[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x2af48f,null))[_0x14e8('0x24')](saveUpdates(_0x5e6083[_0x14e8('0x4d')],null))[_0x14e8('0x24')](respondWithResult(_0x2af48f,null))[_0x14e8('0x41')](handleError(_0x2af48f,null));};exports[_0x14e8('0x4e')]=function(_0x168b8a,_0x5ab659){return db['VoiceMail'][_0x14e8('0x47')]({'where':{'id':_0x168b8a[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x5ab659,null))[_0x14e8('0x24')](removeEntity(_0x5ab659,null))[_0x14e8('0x41')](handleError(_0x5ab659,null));};exports['getMessages']=function(_0x4a631a,_0x4c49e5,_0xf8a05d){return db[_0x14e8('0x2c')][_0x14e8('0x4f')]({'where':{'id':_0x4a631a['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x4c49e5,null))[_0x14e8('0x24')](function(_0x1d6683){var _0x54e164;var _0x274837={},_0x63b342={};_0x63b342[_0x14e8('0x31')]=_[_0x14e8('0x32')](db[_0x14e8('0x50')][_0x14e8('0x2d')]);_0x63b342[_0x14e8('0x33')]=_[_0x14e8('0x32')](_0x4a631a[_0x14e8('0x33')]);_0x63b342[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x63b342['model'],_0x63b342[_0x14e8('0x33')]);_0x274837[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x63b342[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x37')]));_0x274837[_0x14e8('0x36')]=_0x274837[_0x14e8('0x36')][_0x14e8('0x44')]?_0x274837[_0x14e8('0x36')]:_0x63b342[_0x14e8('0x31')];if(!_0x4a631a['query'][_0x14e8('0x51')](_0x14e8('0x38'))){_0x274837['limit']=qs[_0x14e8('0x1e')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1e')]);_0x274837[_0x14e8('0x1c')]=qs[_0x14e8('0x1c')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0x274837['order']=qs['sort'](_0x4a631a['query'][_0x14e8('0x3a')]);_0x274837[_0x14e8('0x3b')]=qs[_0x14e8('0x34')](_[_0x14e8('0x52')](_0x4a631a[_0x14e8('0x33')],_0x63b342[_0x14e8('0x34')]));if(_0x4a631a[_0x14e8('0x33')]['filter']){_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837['where'],{'$or':_[_0x14e8('0x2b')](_0x274837[_0x14e8('0x36')],function(_0x4c3ead){var _0x58fa2e={};_0x58fa2e[_0x4c3ead]={'$like':'%'+_0x4a631a['query'][_0x14e8('0x3e')]+'%'};return _0x58fa2e;})});}_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837[_0x14e8('0x3b')],{'mailboxuser':_0x1d6683['mailbox']});_0x274837=_[_0x14e8('0x3c')]({},_0x274837,_0x4a631a[_0x14e8('0x3f')]);return db[_0x14e8('0x50')][_0x14e8('0x53')](_0x274837)[_0x14e8('0x24')](respondWithFilteredResult(_0x4c49e5,_0x274837));})[_0x14e8('0x41')](handleError(_0x4c49e5,null));}; \ No newline at end of file +var _0x6324=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','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','getMessages','findOne','rawAttributes','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../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','reject','save','update'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x6324,0x142));var _0x4632=function(_0x5a3fd7,_0x5919da){_0x5a3fd7=_0x5a3fd7-0x0;var _0x572299=_0x6324[_0x5a3fd7];return _0x572299;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':!![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x25')]=function(_0x32cd35,_0x6c2864){if(_0x32cd35[_0x4632('0x51')]['id']){delete _0x32cd35[_0x4632('0x51')]['id'];}return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x32cd35[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](saveUpdates(_0x32cd35[_0x4632('0x51')],null))[_0x4632('0x26')](respondWithResult(_0x6c2864,null))['catch'](handleError(_0x6c2864,null));};exports[_0x4632('0x27')]=function(_0x433fea,_0x41409d){return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x433fea[_0x4632('0x44')]['id']}})['then'](handleEntityNotFound(_0x41409d,null))[_0x4632('0x26')](removeEntity(_0x41409d,null))[_0x4632('0x42')](handleError(_0x41409d,null));};exports[_0x4632('0x52')]=function(_0x4b91cf,_0x3aeefd,_0x334a8e){return db[_0x4632('0x30')][_0x4632('0x53')]({'where':{'id':_0x4b91cf[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3aeefd,null))[_0x4632('0x26')](function(_0x4658de){var _0x2965df;var _0x3abcbf={},_0x58d39a={};_0x58d39a[_0x4632('0x37')]=_[_0x4632('0x33')](db['VoiceMailMessage'][_0x4632('0x54')]);_0x58d39a['query']=_['keys'](_0x4b91cf[_0x4632('0x34')]);_0x58d39a[_0x4632('0x35')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],_0x58d39a[_0x4632('0x34')]);_0x3abcbf[_0x4632('0x38')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],qs[_0x4632('0x45')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x45')]));_0x3abcbf[_0x4632('0x38')]=_0x3abcbf[_0x4632('0x38')][_0x4632('0x46')]?_0x3abcbf['attributes']:_0x58d39a['model'];if(!_0x4b91cf[_0x4632('0x34')][_0x4632('0x55')](_0x4632('0x39'))){_0x3abcbf[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x4b91cf[_0x4632('0x34')]['limit']);_0x3abcbf[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x1c')]);}_0x3abcbf['order']=qs['sort'](_0x4b91cf[_0x4632('0x34')]['sort']);_0x3abcbf[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x56')](_0x4b91cf[_0x4632('0x34')],_0x58d39a[_0x4632('0x35')]));if(_0x4b91cf['query'][_0x4632('0x3c')]){_0x3abcbf[_0x4632('0x3b')]=_['merge'](_0x3abcbf['where'],{'$or':_[_0x4632('0x2f')](_0x3abcbf[_0x4632('0x38')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x4b91cf['query']['filter']+'%'};return _0x3090d6;})});}_0x3abcbf['where']=_[_0x4632('0x3d')](_0x3abcbf['where'],{'mailboxuser':_0x4658de[_0x4632('0x57')]});_0x3abcbf=_[_0x4632('0x3d')]({},_0x3abcbf,_0x4b91cf[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x59')](_0x3abcbf)[_0x4632('0x26')](respondWithFilteredResult(_0x3aeefd,_0x3abcbf));})[_0x4632('0x42')](handleError(_0x3aeefd,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index cba740c..71739b1 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 _0x727b=['mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail'];(function(_0x3748a9,_0x1b3508){var _0x2f3bbe=function(_0x36a8f5){while(--_0x36a8f5){_0x3748a9['push'](_0x3748a9['shift']());}};_0x2f3bbe(++_0x1b3508);}(_0x727b,0x122));var _0xb727=function(_0x42dcb1,_0x40352b){_0x42dcb1=_0x42dcb1-0x0;var _0x1d59aa=_0x727b[_0x42dcb1];return _0x1d59aa;};'use strict';var _=require(_0xb727('0x0'));var util=require(_0xb727('0x1'));var logger=require(_0xb727('0x2'))(_0xb727('0x3'));var moment=require(_0xb727('0x4'));var BPromise=require('bluebird');var rp=require(_0xb727('0x5'));var fs=require('fs');var path=require(_0xb727('0x6'));var rimraf=require(_0xb727('0x7'));var config=require('../../config/environment');var attributes=require(_0xb727('0x8'));module['exports']=function(_0x5d9d80,_0x158aad){return _0x5d9d80['define'](_0xb727('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xb727('0xa'),_0xb727('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc779=['util','../../config/logger','api','moment','path','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','mailbox','context'];(function(_0x1b3758,_0x2dbf03){var _0x3fc6c5=function(_0x4092de){while(--_0x4092de){_0x1b3758['push'](_0x1b3758['shift']());}};_0x3fc6c5(++_0x2dbf03);}(_0xc779,0x198));var _0x9c77=function(_0x1a090e,_0x333ba8){_0x1a090e=_0x1a090e-0x0;var _0xaa56ca=_0xc779[_0x1a090e];return _0xaa56ca;};'use strict';var _=require('lodash');var util=require(_0x9c77('0x0'));var logger=require(_0x9c77('0x1'))(_0x9c77('0x2'));var moment=require(_0x9c77('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c77('0x4'));var rimraf=require('rimraf');var config=require(_0x9c77('0x5'));var attributes=require(_0x9c77('0x6'));module[_0x9c77('0x7')]=function(_0xc2102f,_0x2dc6a4){return _0xc2102f[_0x9c77('0x8')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9c77('0x9'),'fields':[_0x9c77('0xa'),_0x9c77('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index cf4099b..cacd730 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 _0x7b0d=['then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5fc11b,_0x363fa5){var _0x34fa91=function(_0x1639e7){while(--_0x1639e7){_0x5fc11b['push'](_0x5fc11b['shift']());}};_0x34fa91(++_0x363fa5);}(_0x7b0d,0xba));var _0xd7b0=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7b0d[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xd7b0('0x0'));var util=require(_0xd7b0('0x1'));var moment=require(_0xd7b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7b0('0x3'));var fs=require('fs');var Redis=require(_0xd7b0('0x4'));var db=require(_0xd7b0('0x5'))['db'];var utils=require(_0xd7b0('0x6'));var logger=require(_0xd7b0('0x7'))(_0xd7b0('0x8'));var config=require(_0xd7b0('0x9'));var jayson=require(_0xd7b0('0xa'));var client=jayson[_0xd7b0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0d5b,_0x2a24cc,_0x140f36){return new BPromise(function(_0x54918d,_0x6847fd){return client['request'](_0x3b0d5b,_0x140f36)[_0xd7b0('0xc')](function(_0x4da5c9){logger['info'](_0xd7b0('0xd'),_0x2a24cc,_0xd7b0('0xe'));logger['debug'](_0xd7b0('0xf'),_0x2a24cc,_0xd7b0('0xe'),JSON[_0xd7b0('0x10')](_0x4da5c9));if(_0x4da5c9[_0xd7b0('0x11')]){if(_0x4da5c9[_0xd7b0('0x11')][_0xd7b0('0x12')]===0x1f4){logger[_0xd7b0('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0x4da5c9[_0xd7b0('0x11')]['message']);return _0x6847fd(_0x4da5c9[_0xd7b0('0x11')]['message']);}logger[_0xd7b0('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0x4da5c9[_0xd7b0('0x11')][_0xd7b0('0x13')]);return _0x54918d(_0x4da5c9['error']['message']);}else{logger[_0xd7b0('0x14')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0xd7b0('0xe'));_0x54918d(_0x4da5c9['result']['message']);}})[_0xd7b0('0x15')](function(_0x422679){logger[_0xd7b0('0x11')](_0xd7b0('0xd'),_0x2a24cc,_0x422679);_0x6847fd(_0x422679);});});} \ No newline at end of file +var _0x3d48=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x51ae9b,_0x568e04){var _0x31bb60=function(_0x141004){while(--_0x141004){_0x51ae9b['push'](_0x51ae9b['shift']());}};_0x31bb60(++_0x568e04);}(_0x3d48,0xe1));var _0x83d4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3d48[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x83d4('0x0'));var util=require(_0x83d4('0x1'));var moment=require(_0x83d4('0x2'));var BPromise=require(_0x83d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83d4('0x4'));var db=require(_0x83d4('0x5'))['db'];var utils=require(_0x83d4('0x6'));var logger=require(_0x83d4('0x7'))('rpc');var config=require(_0x83d4('0x8'));var jayson=require(_0x83d4('0x9'));var client=jayson[_0x83d4('0xa')][_0x83d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f3e74,_0x5521fd,_0x30867a){return new BPromise(function(_0x20edc0,_0xf01fe4){return client[_0x83d4('0xc')](_0x5f3e74,_0x30867a)[_0x83d4('0xd')](function(_0x48f9ec){logger[_0x83d4('0xe')](_0x83d4('0xf'),_0x5521fd,_0x83d4('0x10'));logger[_0x83d4('0x11')](_0x83d4('0x12'),_0x5521fd,'request\x20sent',JSON['stringify'](_0x48f9ec));if(_0x48f9ec[_0x83d4('0x13')]){if(_0x48f9ec[_0x83d4('0x13')]['code']===0x1f4){logger[_0x83d4('0x13')](_0x83d4('0xf'),_0x5521fd,_0x48f9ec[_0x83d4('0x13')][_0x83d4('0x14')]);return _0xf01fe4(_0x48f9ec[_0x83d4('0x13')][_0x83d4('0x14')]);}logger[_0x83d4('0x13')]('VoiceMail,\x20%s,\x20%s',_0x5521fd,_0x48f9ec[_0x83d4('0x13')]['message']);return _0x20edc0(_0x48f9ec['error']['message']);}else{logger[_0x83d4('0xe')](_0x83d4('0xf'),_0x5521fd,_0x83d4('0x10'));_0x20edc0(_0x48f9ec[_0x83d4('0x15')][_0x83d4('0x14')]);}})[_0x83d4('0x16')](function(_0x16635c){logger[_0x83d4('0x13')]('VoiceMail,\x20%s,\x20%s',_0x5521fd,_0x16635c);_0xf01fe4(_0x16635c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 96fb4ae..a6d1ee2 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 _0x8370=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x55dd30,_0x4eab62){var _0x10677d=function(_0x552974){while(--_0x552974){_0x55dd30['push'](_0x55dd30['shift']());}};_0x10677d(++_0x4eab62);}(_0x8370,0x16f));var _0x0837=function(_0x57f39f,_0x3b563e){_0x57f39f=_0x57f39f-0x0;var _0x246b22=_0x8370[_0x57f39f];return _0x246b22;};'use strict';var multer=require('multer');var util=require(_0x0837('0x0'));var path=require(_0x0837('0x1'));var timeout=require(_0x0837('0x2'));var express=require(_0x0837('0x3'));var router=express[_0x0837('0x4')]();var fs_extra=require(_0x0837('0x5'));var auth=require(_0x0837('0x6'));var interaction=require(_0x0837('0x7'));var config=require(_0x0837('0x8'));var controller=require(_0x0837('0x9'));router[_0x0837('0xa')]('/',auth[_0x0837('0xb')](),controller['index']);router[_0x0837('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0837('0xc')]);router['get'](_0x0837('0xd'),auth[_0x0837('0xb')](),controller[_0x0837('0xe')]);router[_0x0837('0xf')]('/',auth['isAuthenticated'](),controller[_0x0837('0x10')]);router[_0x0837('0x11')](_0x0837('0x12'),auth[_0x0837('0xb')](),controller[_0x0837('0x13')]);router[_0x0837('0x14')](_0x0837('0x12'),auth[_0x0837('0xb')](),controller[_0x0837('0x15')]);module['exports']=router; \ No newline at end of file +var _0xcf19=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','create','put','update','delete','destroy','exports'];(function(_0x22f22c,_0x5c8dd2){var _0x5b8e2f=function(_0x41d0ff){while(--_0x41d0ff){_0x22f22c['push'](_0x22f22c['shift']());}};_0x5b8e2f(++_0x5c8dd2);}(_0xcf19,0x90));var _0x9cf1=function(_0x5545f7,_0x570414){_0x5545f7=_0x5545f7-0x0;var _0x52a979=_0xcf19[_0x5545f7];return _0x52a979;};'use strict';var multer=require(_0x9cf1('0x0'));var util=require(_0x9cf1('0x1'));var path=require(_0x9cf1('0x2'));var timeout=require(_0x9cf1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9cf1('0x4'));var interaction=require(_0x9cf1('0x5'));var config=require(_0x9cf1('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x9cf1('0x7')]('/',auth[_0x9cf1('0x8')](),controller['index']);router['get'](_0x9cf1('0x9'),auth[_0x9cf1('0x8')](),controller[_0x9cf1('0xa')]);router[_0x9cf1('0x7')](_0x9cf1('0xb'),auth[_0x9cf1('0x8')](),controller['download']);router['post']('/',auth[_0x9cf1('0x8')](),controller[_0x9cf1('0xc')]);router[_0x9cf1('0xd')](_0x9cf1('0x9'),auth[_0x9cf1('0x8')](),controller[_0x9cf1('0xe')]);router[_0x9cf1('0xf')]('/:id',auth[_0x9cf1('0x8')](),controller[_0x9cf1('0x10')]);module[_0x9cf1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 567149f..bcf807e 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 _0x6726=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x359358,_0x210b55){var _0x2d24aa=function(_0x3bfa6c){while(--_0x3bfa6c){_0x359358['push'](_0x359358['shift']());}};_0x2d24aa(++_0x210b55);}(_0x6726,0x1f1));var _0x6672=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6726[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x6672('0x0'));module['exports']={'name':{'type':Sequelize[_0x6672('0x1')],'get':function(_0x3dda96){return this[_0x6672('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6672('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6672('0x5')](_0x6672('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'stamp':{'type':_0x6672('0x7'),'defaultValue':Sequelize[_0x6672('0x8')](_0x6672('0x9'))}}; \ No newline at end of file +var _0x270c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP','literal'];(function(_0x1335f5,_0x1d6f12){var _0xa78c23=function(_0x413114){while(--_0x413114){_0x1335f5['push'](_0x1335f5['shift']());}};_0xa78c23(++_0x1d6f12);}(_0x270c,0x106));var _0xc270=function(_0x55e1fe,_0x1c120e){_0x55e1fe=_0x55e1fe-0x0;var _0x2238b4=_0x270c[_0x55e1fe];return _0x2238b4;};'use strict';var Sequelize=require(_0xc270('0x0'));module[_0xc270('0x1')]={'name':{'type':Sequelize[_0xc270('0x2')],'get':function(_0x50bb1){return this[_0xc270('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc270('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc270('0x5')],'defaultValue':''},'stamp':{'type':_0xc270('0x6'),'defaultValue':Sequelize[_0xc270('0x7')](_0xc270('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c605eb9..b1d6938 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 _0x1adc=['../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','update','then','end','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','set','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x1adc,0x179));var _0xc1ad=function(_0x4ababe,_0x19df6b){_0x4ababe=_0x4ababe-0x0;var _0x500ed9=_0x1adc[_0x4ababe];return _0x500ed9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1ad('0x0'));var zipdir=require(_0xc1ad('0x1'));var jsonpatch=require(_0xc1ad('0x2'));var rp=require(_0xc1ad('0x3'));var moment=require(_0xc1ad('0x4'));var BPromise=require(_0xc1ad('0x5'));var Mustache=require(_0xc1ad('0x6'));var util=require(_0xc1ad('0x7'));var path=require(_0xc1ad('0x8'));var sox=require(_0xc1ad('0x9'));var csv=require('to-csv');var ejs=require(_0xc1ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc1ad('0xb'));var crypto=require(_0xc1ad('0xc'));var jsforce=require(_0xc1ad('0xd'));var deskjs=require(_0xc1ad('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1ad('0xf'));var Papa=require(_0xc1ad('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1ad('0x12'));var logger=require('../../config/logger')(_0xc1ad('0x13'));var utils=require(_0xc1ad('0x14'));var config=require(_0xc1ad('0x15'));var licenseUtil=require(_0xc1ad('0x16'));var db=require(_0xc1ad('0x17'))['db'];function respondWithStatusCode(_0x1a0e72,_0x1a5418){_0x1a5418=_0x1a5418||0xcc;return function(_0x58cd06){if(_0x58cd06){return _0x1a0e72[_0xc1ad('0x18')](_0x1a5418);}return _0x1a0e72[_0xc1ad('0x19')](_0x1a5418)['end']();};}function respondWithResult(_0x5b2a15,_0x49843f){_0x49843f=_0x49843f||0xc8;return function(_0x3f037d){if(_0x3f037d){return _0x5b2a15[_0xc1ad('0x19')](_0x49843f)[_0xc1ad('0x1a')](_0x3f037d);}};}function respondWithFilteredResult(_0x157a98,_0x54d9bc){return function(_0x3d27e7){if(_0x3d27e7){var _0x38da0b=typeof _0x54d9bc[_0xc1ad('0x1b')]==='undefined'&&typeof _0x54d9bc[_0xc1ad('0x1c')]==='undefined';var _0x2a7d90=_0x3d27e7[_0xc1ad('0x1d')];var _0x430ca0=_0x38da0b?0x0:_0x54d9bc[_0xc1ad('0x1b')];var _0x1fbf98=_0x38da0b?_0x3d27e7[_0xc1ad('0x1d')]:_0x54d9bc[_0xc1ad('0x1b')]+_0x54d9bc[_0xc1ad('0x1c')];var _0x592ab6;if(_0x1fbf98>=_0x2a7d90){_0x1fbf98=_0x2a7d90;_0x592ab6=0xc8;}else{_0x592ab6=0xce;}_0x157a98['status'](_0x592ab6);return _0x157a98['set']('Content-Range',_0x430ca0+'-'+_0x1fbf98+'/'+_0x2a7d90)[_0xc1ad('0x1a')](_0x3d27e7);}return null;};}function patchUpdates(_0x33f9b4){return function(_0x47e6eb){try{jsonpatch[_0xc1ad('0x1e')](_0x47e6eb,_0x33f9b4,!![]);}catch(_0x30c226){return BPromise[_0xc1ad('0x1f')](_0x30c226);}return _0x47e6eb['save']();};}function saveUpdates(_0x9ad945,_0x3c80be){return function(_0x45add3){if(_0x45add3){return _0x45add3[_0xc1ad('0x20')](_0x9ad945)[_0xc1ad('0x21')](function(_0x48ae44){return _0x48ae44;});}return null;};}function removeEntity(_0x279e23,_0x592c06){return function(_0x133e26){if(_0x133e26){return _0x133e26['destroy']()[_0xc1ad('0x21')](function(){_0x279e23[_0xc1ad('0x19')](0xcc)[_0xc1ad('0x22')]();});}};}function handleEntityNotFound(_0x15f4ce,_0x130da6){return function(_0x710c54){if(!_0x710c54){_0x15f4ce[_0xc1ad('0x18')](0x194);}return _0x710c54;};}function handleError(_0x3a045b,_0x90a0d9){_0x90a0d9=_0x90a0d9||0x1f4;return function(_0x4f253d){logger['error'](_0x4f253d[_0xc1ad('0x23')]);if(_0x4f253d[_0xc1ad('0x24')]){delete _0x4f253d[_0xc1ad('0x24')];}_0x3a045b[_0xc1ad('0x19')](_0x90a0d9)[_0xc1ad('0x25')](_0x4f253d);};}exports[_0xc1ad('0x26')]=function(_0x5632b6,_0x56a1db){var _0x5af7ea={},_0x17a026={},_0x1885c9={'count':0x0,'rows':[]};var _0xf8fdf0=_['map'](db[_0xc1ad('0x27')][_0xc1ad('0x28')],function(_0x1a1abc){return{'name':_0x1a1abc['fieldName'],'type':_0x1a1abc[_0xc1ad('0x29')][_0xc1ad('0x2a')]};});_0x17a026[_0xc1ad('0x2b')]=_[_0xc1ad('0x2c')](_[_0xc1ad('0x2d')](_0xf8fdf0,_0xc1ad('0x24')),[_0xc1ad('0x24')]);_0x17a026[_0xc1ad('0x2e')]=_[_0xc1ad('0x2f')](_0x5632b6['query']);_0x17a026[_0xc1ad('0x30')]=_[_0xc1ad('0x31')](_0x17a026[_0xc1ad('0x2b')],_0x17a026[_0xc1ad('0x2e')]);_0x5af7ea[_0xc1ad('0x32')]=_[_0xc1ad('0x31')](_0x17a026[_0xc1ad('0x2b')],qs[_0xc1ad('0x33')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x33')]));_0x5af7ea[_0xc1ad('0x32')]=_0x5af7ea[_0xc1ad('0x32')]['length']?_0x5af7ea[_0xc1ad('0x32')]:_0x17a026['model'];if(!_0x5632b6[_0xc1ad('0x2e')]['hasOwnProperty']('nolimit')){_0x5af7ea[_0xc1ad('0x1c')]=qs[_0xc1ad('0x1c')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x1c')]);_0x5af7ea[_0xc1ad('0x1b')]=qs[_0xc1ad('0x1b')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x1b')]);}_0x5af7ea[_0xc1ad('0x34')]=qs[_0xc1ad('0x35')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x35')]);_0x5af7ea['where']=qs['filters'](_[_0xc1ad('0x36')](_0x5632b6['query'],_0x17a026['filters']),_0xf8fdf0);if(_0x5632b6['query'][_0xc1ad('0x37')]){_0x5af7ea[_0xc1ad('0x38')]=_['merge'](_0x5af7ea[_0xc1ad('0x38')],{'$or':_['map'](_0xf8fdf0,function(_0x4c9132){if(_0x4c9132[_0xc1ad('0x29')]!==_0xc1ad('0x39')){var _0x30c770={};_0x30c770[_0x4c9132[_0xc1ad('0x24')]]={'$like':'%'+_0x5632b6[_0xc1ad('0x2e')]['filter']+'%'};return _0x30c770;}})});}_0x5af7ea=_[_0xc1ad('0x3a')]({},_0x5af7ea,_0x5632b6[_0xc1ad('0x3b')]);var _0xc5f19d={'where':_0x5af7ea['where']};return db['VoiceMailMessage']['count'](_0xc5f19d)['then'](function(_0x1edc38){_0x1885c9[_0xc1ad('0x1d')]=_0x1edc38;if(_0x5632b6['query'][_0xc1ad('0x3c')]){_0x5af7ea[_0xc1ad('0x3d')]=[{'all':!![]}];}return db[_0xc1ad('0x27')][_0xc1ad('0x3e')](_0x5af7ea);})[_0xc1ad('0x21')](function(_0x2b3cde){_0x1885c9[_0xc1ad('0x3f')]=_0x2b3cde;return _0x1885c9;})[_0xc1ad('0x21')](respondWithFilteredResult(_0x56a1db,_0x5af7ea))['catch'](handleError(_0x56a1db,null));};exports[_0xc1ad('0x40')]=function(_0x3a819,_0x170f89){var _0x3e4420={'raw':!![],'where':{'id':_0x3a819[_0xc1ad('0x41')]['id']}},_0x55f21f={};_0x55f21f['model']=_[_0xc1ad('0x2f')](db[_0xc1ad('0x27')]['rawAttributes']);_0x55f21f[_0xc1ad('0x2e')]=_[_0xc1ad('0x2f')](_0x3a819[_0xc1ad('0x2e')]);_0x55f21f[_0xc1ad('0x30')]=_[_0xc1ad('0x31')](_0x55f21f['model'],_0x55f21f[_0xc1ad('0x2e')]);_0x3e4420[_0xc1ad('0x32')]=_[_0xc1ad('0x31')](_0x55f21f['model'],qs[_0xc1ad('0x33')](_0x3a819[_0xc1ad('0x2e')]['fields']));_0x3e4420[_0xc1ad('0x32')]=_0x3e4420[_0xc1ad('0x32')][_0xc1ad('0x42')]?_0x3e4420[_0xc1ad('0x32')]:_0x55f21f[_0xc1ad('0x2b')];if(_0x3a819[_0xc1ad('0x2e')][_0xc1ad('0x3c')]){_0x3e4420['include']=[{'all':!![]}];}_0x3e4420=_[_0xc1ad('0x3a')]({},_0x3e4420,_0x3a819[_0xc1ad('0x3b')]);return db[_0xc1ad('0x27')][_0xc1ad('0x43')](_0x3e4420)[_0xc1ad('0x21')](handleEntityNotFound(_0x170f89,null))[_0xc1ad('0x21')](respondWithResult(_0x170f89,null))[_0xc1ad('0x44')](handleError(_0x170f89,null));};exports['create']=function(_0x810042,_0x436fde){return db[_0xc1ad('0x27')]['create'](_0x810042[_0xc1ad('0x45')],{})[_0xc1ad('0x21')](respondWithResult(_0x436fde,0xc9))[_0xc1ad('0x44')](handleError(_0x436fde,null));};exports['update']=function(_0x5bb4b1,_0x3acc02){if(_0x5bb4b1[_0xc1ad('0x45')]['id']){delete _0x5bb4b1[_0xc1ad('0x45')]['id'];}return db['VoiceMailMessage'][_0xc1ad('0x43')]({'where':{'id':_0x5bb4b1[_0xc1ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x3acc02,null))[_0xc1ad('0x21')](saveUpdates(_0x5bb4b1[_0xc1ad('0x45')],null))[_0xc1ad('0x21')](respondWithResult(_0x3acc02,null))[_0xc1ad('0x44')](handleError(_0x3acc02,null));};exports[_0xc1ad('0x46')]=function(_0x3e0574,_0x5e4bf4){return db[_0xc1ad('0x27')][_0xc1ad('0x43')]({'where':{'id':_0x3e0574[_0xc1ad('0x41')]['id']}})[_0xc1ad('0x21')](handleEntityNotFound(_0x5e4bf4,null))['then'](removeEntity(_0x5e4bf4,null))[_0xc1ad('0x44')](handleError(_0x5e4bf4,null));};exports[_0xc1ad('0x47')]=function(_0x4d4200,_0x35f2be,_0x4d590e){return db[_0xc1ad('0x27')]['find']({'where':{'id':_0x4d4200['params']['id']},'attributes':['id',_0xc1ad('0x48'),_0xc1ad('0x49')]})[_0xc1ad('0x21')](handleEntityNotFound(_0x35f2be,null))[_0xc1ad('0x21')](function(_0x441b2a){if(_0x441b2a){if(!_0x441b2a[_0xc1ad('0x48')]){throw new db[(_0xc1ad('0x4a'))][(_0xc1ad('0x4b'))](_0xc1ad('0x4c'));}var _0x15fdfa={'Content-Type':_0xc1ad('0x4d'),'Content-Disposition':_0xc1ad('0x4e')};if(_0x441b2a[_0xc1ad('0x49')]){_0x15fdfa['Content-Disposition']='attachment;\x20filename=\x22'+_0x441b2a[_0xc1ad('0x49')]+'.wav\x22';}_0x35f2be[_0xc1ad('0x4f')](_0x15fdfa);return _0x35f2be['send'](new Buffer(_0x441b2a[_0xc1ad('0x48')]));}})[_0xc1ad('0x44')](handleError(_0x35f2be,null));}; \ No newline at end of file +var _0x7bb9=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','then','destroy','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','update','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4d610f,_0x39c24f){var _0x440478=function(_0x115bac){while(--_0x115bac){_0x4d610f['push'](_0x4d610f['shift']());}};_0x440478(++_0x39c24f);}(_0x7bb9,0x107));var _0x97bb=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7bb9[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require(_0x97bb('0x5'));var BPromise=require(_0x97bb('0x6'));var Mustache=require(_0x97bb('0x7'));var util=require(_0x97bb('0x8'));var path=require(_0x97bb('0x9'));var sox=require(_0x97bb('0xa'));var csv=require(_0x97bb('0xb'));var ejs=require(_0x97bb('0xc'));var fs=require('fs');var fs_extra=require(_0x97bb('0xd'));var _=require(_0x97bb('0xe'));var squel=require(_0x97bb('0xf'));var crypto=require(_0x97bb('0x10'));var jsforce=require(_0x97bb('0x11'));var deskjs=require(_0x97bb('0x12'));var toCsv=require('to-csv');var querystring=require(_0x97bb('0x13'));var Papa=require(_0x97bb('0x14'));var Redis=require(_0x97bb('0x15'));var authService=require(_0x97bb('0x16'));var qs=require(_0x97bb('0x17'));var as=require(_0x97bb('0x18'));var hardwareService=require(_0x97bb('0x19'));var logger=require(_0x97bb('0x1a'))(_0x97bb('0x1b'));var utils=require('../../config/utils');var config=require(_0x97bb('0x1c'));var licenseUtil=require(_0x97bb('0x1d'));var db=require(_0x97bb('0x1e'))['db'];function respondWithStatusCode(_0x25369f,_0x51770d){_0x51770d=_0x51770d||0xcc;return function(_0x40e9b7){if(_0x40e9b7){return _0x25369f[_0x97bb('0x1f')](_0x51770d);}return _0x25369f[_0x97bb('0x20')](_0x51770d)[_0x97bb('0x21')]();};}function respondWithResult(_0x16a560,_0x38fb96){_0x38fb96=_0x38fb96||0xc8;return function(_0x1b67fd){if(_0x1b67fd){return _0x16a560['status'](_0x38fb96)[_0x97bb('0x22')](_0x1b67fd);}};}function respondWithFilteredResult(_0x32a090,_0x356ae5){return function(_0x53bdb7){if(_0x53bdb7){var _0x19bf8a=typeof _0x356ae5[_0x97bb('0x23')]==='undefined'&&typeof _0x356ae5[_0x97bb('0x24')]===_0x97bb('0x25');var _0x11c4fb=_0x53bdb7['count'];var _0x1bcc9a=_0x19bf8a?0x0:_0x356ae5['offset'];var _0x2c8be5=_0x19bf8a?_0x53bdb7[_0x97bb('0x26')]:_0x356ae5[_0x97bb('0x23')]+_0x356ae5[_0x97bb('0x24')];var _0x248ff5;if(_0x2c8be5>=_0x11c4fb){_0x2c8be5=_0x11c4fb;_0x248ff5=0xc8;}else{_0x248ff5=0xce;}_0x32a090[_0x97bb('0x20')](_0x248ff5);return _0x32a090['set'](_0x97bb('0x27'),_0x1bcc9a+'-'+_0x2c8be5+'/'+_0x11c4fb)['json'](_0x53bdb7);}return null;};}function patchUpdates(_0x28c5ff){return function(_0x1cbafa){try{jsonpatch['apply'](_0x1cbafa,_0x28c5ff,!![]);}catch(_0x3011c7){return BPromise['reject'](_0x3011c7);}return _0x1cbafa[_0x97bb('0x28')]();};}function saveUpdates(_0x643fee,_0x11f9f7){return function(_0x2395d9){if(_0x2395d9){return _0x2395d9['update'](_0x643fee)[_0x97bb('0x29')](function(_0x4bcc62){return _0x4bcc62;});}return null;};}function removeEntity(_0x42d0bc,_0x29d5f1){return function(_0x1977b8){if(_0x1977b8){return _0x1977b8[_0x97bb('0x2a')]()['then'](function(){_0x42d0bc[_0x97bb('0x20')](0xcc)[_0x97bb('0x21')]();});}};}function handleEntityNotFound(_0x58dbdc,_0x1236c0){return function(_0x25bd56){if(!_0x25bd56){_0x58dbdc[_0x97bb('0x1f')](0x194);}return _0x25bd56;};}function handleError(_0x4263ed,_0x2eed49){_0x2eed49=_0x2eed49||0x1f4;return function(_0x25eed4){logger['error'](_0x25eed4[_0x97bb('0x2b')]);if(_0x25eed4[_0x97bb('0x2c')]){delete _0x25eed4[_0x97bb('0x2c')];}_0x4263ed['status'](_0x2eed49)['send'](_0x25eed4);};}exports[_0x97bb('0x2d')]=function(_0x216ed7,_0x51ea9a){var _0x59fead={},_0x3dc681={},_0x3cd896={'count':0x0,'rows':[]};var _0x1bad0b=_['map'](db[_0x97bb('0x2e')][_0x97bb('0x2f')],function(_0x37eef1){return{'name':_0x37eef1[_0x97bb('0x30')],'type':_0x37eef1['type'][_0x97bb('0x31')]};});_0x3dc681['model']=_['differenceBy'](_[_0x97bb('0x32')](_0x1bad0b,_0x97bb('0x2c')),['name']);_0x3dc681[_0x97bb('0x33')]=_[_0x97bb('0x34')](_0x216ed7[_0x97bb('0x33')]);_0x3dc681['filters']=_[_0x97bb('0x35')](_0x3dc681[_0x97bb('0x36')],_0x3dc681[_0x97bb('0x33')]);_0x59fead[_0x97bb('0x37')]=_[_0x97bb('0x35')](_0x3dc681[_0x97bb('0x36')],qs[_0x97bb('0x38')](_0x216ed7[_0x97bb('0x33')][_0x97bb('0x38')]));_0x59fead[_0x97bb('0x37')]=_0x59fead[_0x97bb('0x37')][_0x97bb('0x39')]?_0x59fead['attributes']:_0x3dc681[_0x97bb('0x36')];if(!_0x216ed7[_0x97bb('0x33')][_0x97bb('0x3a')](_0x97bb('0x3b'))){_0x59fead[_0x97bb('0x24')]=qs['limit'](_0x216ed7[_0x97bb('0x33')][_0x97bb('0x24')]);_0x59fead[_0x97bb('0x23')]=qs[_0x97bb('0x23')](_0x216ed7[_0x97bb('0x33')]['offset']);}_0x59fead[_0x97bb('0x3c')]=qs[_0x97bb('0x3d')](_0x216ed7[_0x97bb('0x33')][_0x97bb('0x3d')]);_0x59fead[_0x97bb('0x3e')]=qs[_0x97bb('0x3f')](_['pick'](_0x216ed7[_0x97bb('0x33')],_0x3dc681['filters']),_0x1bad0b);if(_0x216ed7[_0x97bb('0x33')][_0x97bb('0x40')]){_0x59fead[_0x97bb('0x3e')]=_[_0x97bb('0x41')](_0x59fead[_0x97bb('0x3e')],{'$or':_['map'](_0x1bad0b,function(_0x2e5d89){if(_0x2e5d89[_0x97bb('0x42')]!==_0x97bb('0x43')){var _0x5948e7={};_0x5948e7[_0x2e5d89[_0x97bb('0x2c')]]={'$like':'%'+_0x216ed7['query'][_0x97bb('0x40')]+'%'};return _0x5948e7;}})});}_0x59fead=_[_0x97bb('0x41')]({},_0x59fead,_0x216ed7['options']);var _0x3e82ed={'where':_0x59fead[_0x97bb('0x3e')]};return db['VoiceMailMessage']['count'](_0x3e82ed)[_0x97bb('0x29')](function(_0x41a754){_0x3cd896['count']=_0x41a754;if(_0x216ed7[_0x97bb('0x33')][_0x97bb('0x44')]){_0x59fead[_0x97bb('0x45')]=[{'all':!![]}];}return db[_0x97bb('0x2e')]['findAll'](_0x59fead);})[_0x97bb('0x29')](function(_0x2a7aa3){_0x3cd896[_0x97bb('0x46')]=_0x2a7aa3;return _0x3cd896;})[_0x97bb('0x29')](respondWithFilteredResult(_0x51ea9a,_0x59fead))[_0x97bb('0x47')](handleError(_0x51ea9a,null));};exports[_0x97bb('0x48')]=function(_0x574b1a,_0x438927){var _0x408a35={'raw':!![],'where':{'id':_0x574b1a[_0x97bb('0x49')]['id']}},_0x366f95={};_0x366f95['model']=_[_0x97bb('0x34')](db[_0x97bb('0x2e')][_0x97bb('0x2f')]);_0x366f95[_0x97bb('0x33')]=_[_0x97bb('0x34')](_0x574b1a['query']);_0x366f95[_0x97bb('0x3f')]=_['intersection'](_0x366f95[_0x97bb('0x36')],_0x366f95[_0x97bb('0x33')]);_0x408a35[_0x97bb('0x37')]=_[_0x97bb('0x35')](_0x366f95['model'],qs['fields'](_0x574b1a['query'][_0x97bb('0x38')]));_0x408a35[_0x97bb('0x37')]=_0x408a35[_0x97bb('0x37')][_0x97bb('0x39')]?_0x408a35[_0x97bb('0x37')]:_0x366f95[_0x97bb('0x36')];if(_0x574b1a[_0x97bb('0x33')]['includeAll']){_0x408a35['include']=[{'all':!![]}];}_0x408a35=_[_0x97bb('0x41')]({},_0x408a35,_0x574b1a['options']);return db['VoiceMailMessage'][_0x97bb('0x4a')](_0x408a35)['then'](handleEntityNotFound(_0x438927,null))[_0x97bb('0x29')](respondWithResult(_0x438927,null))['catch'](handleError(_0x438927,null));};exports[_0x97bb('0x4b')]=function(_0x2c3f34,_0x28c828){return db[_0x97bb('0x2e')][_0x97bb('0x4b')](_0x2c3f34['body'],{})[_0x97bb('0x29')](respondWithResult(_0x28c828,0xc9))[_0x97bb('0x47')](handleError(_0x28c828,null));};exports[_0x97bb('0x4c')]=function(_0xa32453,_0x55f986){if(_0xa32453[_0x97bb('0x4d')]['id']){delete _0xa32453['body']['id'];}return db[_0x97bb('0x2e')][_0x97bb('0x4a')]({'where':{'id':_0xa32453[_0x97bb('0x49')]['id']}})[_0x97bb('0x29')](handleEntityNotFound(_0x55f986,null))[_0x97bb('0x29')](saveUpdates(_0xa32453[_0x97bb('0x4d')],null))['then'](respondWithResult(_0x55f986,null))['catch'](handleError(_0x55f986,null));};exports[_0x97bb('0x2a')]=function(_0x12e044,_0x5b5438){return db['VoiceMailMessage']['find']({'where':{'id':_0x12e044[_0x97bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b5438,null))[_0x97bb('0x29')](removeEntity(_0x5b5438,null))[_0x97bb('0x47')](handleError(_0x5b5438,null));};exports[_0x97bb('0x4e')]=function(_0x20c698,_0x2f68b9,_0x2df4aa){return db[_0x97bb('0x2e')][_0x97bb('0x4a')]({'where':{'id':_0x20c698[_0x97bb('0x49')]['id']},'attributes':['id',_0x97bb('0x4f'),_0x97bb('0x50')]})[_0x97bb('0x29')](handleEntityNotFound(_0x2f68b9,null))[_0x97bb('0x29')](function(_0x684c5e){if(_0x684c5e){if(!_0x684c5e[_0x97bb('0x4f')]){throw new db[(_0x97bb('0x51'))]['ValidationError'](_0x97bb('0x52'));}var _0x56cc4b={'Content-Type':'audio/wav','Content-Disposition':_0x97bb('0x53')};if(_0x684c5e['msg_id']){_0x56cc4b[_0x97bb('0x54')]=_0x97bb('0x55')+_0x684c5e[_0x97bb('0x50')]+_0x97bb('0x56');}_0x2f68b9[_0x97bb('0x57')](_0x56cc4b);return _0x2f68b9[_0x97bb('0x58')](new Buffer(_0x684c5e['recording']));}})[_0x97bb('0x47')](handleError(_0x2f68b9,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 735016d..27ca761 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 _0xa95c=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0xa95c,0x14c));var _0xca95=function(_0x21e4d0,_0x1aef26){_0x21e4d0=_0x21e4d0-0x0;var _0x476d20=_0xa95c[_0x21e4d0];return _0x476d20;};'use strict';var _=require(_0xca95('0x0'));var util=require(_0xca95('0x1'));var logger=require(_0xca95('0x2'))(_0xca95('0x3'));var moment=require(_0xca95('0x4'));var BPromise=require(_0xca95('0x5'));var rp=require(_0xca95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca95('0x7'));var config=require(_0xca95('0x8'));var attributes=require(_0xca95('0x9'));module['exports']=function(_0x5daeb3,_0xaf447){return _0x5daeb3[_0xca95('0xa')](_0xca95('0xb'),attributes,{'tableName':_0xca95('0xc'),'paranoid':![],'indexes':[{'name':_0xca95('0xd'),'fields':[_0xca95('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x25de=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x161c02,_0x4a37c7){var _0x31ed05=function(_0x207fb0){while(--_0x207fb0){_0x161c02['push'](_0x161c02['shift']());}};_0x31ed05(++_0x4a37c7);}(_0x25de,0xbc));var _0xe25d=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x25de[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0xe25d('0x0'));var util=require(_0xe25d('0x1'));var logger=require(_0xe25d('0x2'))(_0xe25d('0x3'));var moment=require('moment');var BPromise=require(_0xe25d('0x4'));var rp=require(_0xe25d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe25d('0x6'));var config=require(_0xe25d('0x7'));var attributes=require(_0xe25d('0x8'));module[_0xe25d('0x9')]=function(_0x221c4d,_0x419a62){return _0x221c4d[_0xe25d('0xa')](_0xe25d('0xb'),attributes,{'tableName':_0xe25d('0xc'),'paranoid':![],'indexes':[{'name':_0xe25d('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index dd99133..2d7b849 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 _0x7c88=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x176729,_0x1706ed){var _0x2a2e35=function(_0x514437){while(--_0x514437){_0x176729['push'](_0x176729['shift']());}};_0x2a2e35(++_0x1706ed);}(_0x7c88,0x154));var _0x87c8=function(_0x179bb0,_0x14c538){_0x179bb0=_0x179bb0-0x0;var _0x27e5ff=_0x7c88[_0x179bb0];return _0x27e5ff;};'use strict';var _=require(_0x87c8('0x0'));var util=require(_0x87c8('0x1'));var moment=require(_0x87c8('0x2'));var BPromise=require(_0x87c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87c8('0x4'));var db=require(_0x87c8('0x5'))['db'];var utils=require(_0x87c8('0x6'));var logger=require(_0x87c8('0x7'))(_0x87c8('0x8'));var config=require(_0x87c8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ef5c,_0x180ac6,_0x544664){return new BPromise(function(_0x3cd219,_0x186350){return client[_0x87c8('0xb')](_0x54ef5c,_0x544664)[_0x87c8('0xc')](function(_0x40b258){logger[_0x87c8('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x180ac6,_0x87c8('0xe'));logger[_0x87c8('0xf')](_0x87c8('0x10'),_0x180ac6,_0x87c8('0xe'),JSON['stringify'](_0x40b258));if(_0x40b258[_0x87c8('0x11')]){if(_0x40b258[_0x87c8('0x11')][_0x87c8('0x12')]===0x1f4){logger[_0x87c8('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x180ac6,_0x40b258['error']['message']);return _0x186350(_0x40b258[_0x87c8('0x11')][_0x87c8('0x13')]);}logger[_0x87c8('0x11')](_0x87c8('0x14'),_0x180ac6,_0x40b258['error'][_0x87c8('0x13')]);return _0x3cd219(_0x40b258['error'][_0x87c8('0x13')]);}else{logger[_0x87c8('0xd')](_0x87c8('0x14'),_0x180ac6,_0x87c8('0xe'));_0x3cd219(_0x40b258[_0x87c8('0x15')][_0x87c8('0x13')]);}})[_0x87c8('0x16')](function(_0xd768f1){logger[_0x87c8('0x11')](_0x87c8('0x14'),_0x180ac6,_0xd768f1);_0x186350(_0xd768f1);});});} \ No newline at end of file +var _0x0877=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0877,0x14a));var _0x7087=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x0877[_0x4cc492];return _0x1f36b9;};'use strict';var _=require('lodash');var util=require(_0x7087('0x0'));var moment=require(_0x7087('0x1'));var BPromise=require(_0x7087('0x2'));var rs=require(_0x7087('0x3'));var fs=require('fs');var Redis=require(_0x7087('0x4'));var db=require(_0x7087('0x5'))['db'];var utils=require(_0x7087('0x6'));var logger=require(_0x7087('0x7'))(_0x7087('0x8'));var config=require(_0x7087('0x9'));var jayson=require(_0x7087('0xa'));var client=jayson[_0x7087('0xb')][_0x7087('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f6197,_0x56c9a5,_0xfe59c4){return new BPromise(function(_0x5598f3,_0x336e67){return client[_0x7087('0xd')](_0x3f6197,_0xfe59c4)[_0x7087('0xe')](function(_0x2ecb22){logger[_0x7087('0xf')](_0x7087('0x10'),_0x56c9a5,_0x7087('0x11'));logger['debug'](_0x7087('0x12'),_0x56c9a5,_0x7087('0x11'),JSON['stringify'](_0x2ecb22));if(_0x2ecb22[_0x7087('0x13')]){if(_0x2ecb22[_0x7087('0x13')][_0x7087('0x14')]===0x1f4){logger[_0x7087('0x13')](_0x7087('0x10'),_0x56c9a5,_0x2ecb22[_0x7087('0x13')][_0x7087('0x15')]);return _0x336e67(_0x2ecb22['error'][_0x7087('0x15')]);}logger[_0x7087('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x56c9a5,_0x2ecb22[_0x7087('0x13')]['message']);return _0x5598f3(_0x2ecb22['error'][_0x7087('0x15')]);}else{logger[_0x7087('0xf')](_0x7087('0x10'),_0x56c9a5,'request\x20sent');_0x5598f3(_0x2ecb22['result'][_0x7087('0x15')]);}})[_0x7087('0x16')](function(_0x351a15){logger[_0x7087('0x13')](_0x7087('0x10'),_0x56c9a5,_0x351a15);_0x336e67(_0x351a15);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ad998bf..ebbf6a9 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 _0xbfc6=['put','/:id','update','destroy','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','post','create'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbfc6,0x177));var _0x6bfc=function(_0x20e3ef,_0x5a5e35){_0x20e3ef=_0x20e3ef-0x0;var _0x5bd92b=_0xbfc6[_0x20e3ef];return _0x5bd92b;};'use strict';var multer=require(_0x6bfc('0x0'));var util=require(_0x6bfc('0x1'));var path=require(_0x6bfc('0x2'));var timeout=require(_0x6bfc('0x3'));var express=require(_0x6bfc('0x4'));var router=express[_0x6bfc('0x5')]();var fs_extra=require(_0x6bfc('0x6'));var auth=require(_0x6bfc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6bfc('0x8'));var controller=require(_0x6bfc('0x9'));router[_0x6bfc('0xa')]('/',auth[_0x6bfc('0xb')](),controller['index']);router[_0x6bfc('0xa')]('/:id',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0xc')]);router['get'](_0x6bfc('0xd'),auth[_0x6bfc('0xb')](),controller['getSounds']);router[_0x6bfc('0xe')]('/',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0xf')]);router[_0x6bfc('0xe')](_0x6bfc('0xd'),auth[_0x6bfc('0xb')](),controller['addSound']);router[_0x6bfc('0x10')](_0x6bfc('0x11'),auth[_0x6bfc('0xb')](),controller[_0x6bfc('0x12')]);router['delete'](_0x6bfc('0x11'),auth['isAuthenticated'](),controller[_0x6bfc('0x13')]);router[_0x6bfc('0x14')]('/:id/sounds/:id2',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0x15')]);module[_0x6bfc('0x16')]=router; \ No newline at end of file +var _0xb93f=['get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xa6b085,_0x7728a0){var _0x1a1e4c=function(_0x2680e7){while(--_0x2680e7){_0xa6b085['push'](_0xa6b085['shift']());}};_0x1a1e4c(++_0x7728a0);}(_0xb93f,0xd5));var _0xfb93=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb93f[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var path=require('path');var timeout=require(_0xfb93('0x2'));var express=require('express');var router=express[_0xfb93('0x3')]();var fs_extra=require(_0xfb93('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb93('0x5'));var config=require(_0xfb93('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xfb93('0x7')]('/',auth[_0xfb93('0x8')](),controller[_0xfb93('0x9')]);router[_0xfb93('0x7')](_0xfb93('0xa'),auth[_0xfb93('0x8')](),controller[_0xfb93('0xb')]);router[_0xfb93('0x7')]('/:id/sounds',auth[_0xfb93('0x8')](),controller[_0xfb93('0xc')]);router[_0xfb93('0xd')]('/',auth[_0xfb93('0x8')](),controller['create']);router[_0xfb93('0xd')](_0xfb93('0xe'),auth[_0xfb93('0x8')](),controller[_0xfb93('0xf')]);router['put'](_0xfb93('0xa'),auth[_0xfb93('0x8')](),controller[_0xfb93('0x10')]);router[_0xfb93('0x11')](_0xfb93('0xa'),auth[_0xfb93('0x8')](),controller[_0xfb93('0x12')]);router[_0xfb93('0x11')](_0xfb93('0x13'),auth[_0xfb93('0x8')](),controller[_0xfb93('0x14')]);module[_0xfb93('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 855dfc0..527137c 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 _0x1adc=['mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','custom','files','mp3nb','quietmp3nb'];(function(_0x137d0c,_0x133d7e){var _0x51f5ea=function(_0x28b1e6){while(--_0x28b1e6){_0x137d0c['push'](_0x137d0c['shift']());}};_0x51f5ea(++_0x133d7e);}(_0x1adc,0x72));var _0xc1ad=function(_0x19d174,_0x37eb66){_0x19d174=_0x19d174-0x0;var _0x383dba=_0x1adc[_0x19d174];return _0x383dba;};'use strict';var Sequelize=require('sequelize');module[_0xc1ad('0x0')]={'name':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xc1ad('0x2'),_0xc1ad('0x3'),_0xc1ad('0x4'),_0xc1ad('0x5'),'quietmp3',_0xc1ad('0x6')),'allowNull':!![],'defaultValue':_0xc1ad('0x3')},'directory':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![],'defaultValue':_0xc1ad('0x7')},'format':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'stamp':{'type':_0xc1ad('0x8')},'defaultEntry':{'type':Sequelize[_0xc1ad('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2995=['STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','exports'];(function(_0x1c9704,_0x11b6b1){var _0x2ea007=function(_0x3986e7){while(--_0x3986e7){_0x1c9704['push'](_0x1c9704['shift']());}};_0x2ea007(++_0x11b6b1);}(_0x2995,0xe6));var _0x5299=function(_0x172c56,_0x5ddfea){_0x172c56=_0x172c56-0x0;var _0x422d61=_0x2995[_0x172c56];return _0x422d61;};'use strict';var Sequelize=require('sequelize');module[_0x5299('0x0')]={'name':{'type':Sequelize[_0x5299('0x1')],'allowNull':![],'unique':_0x5299('0x2')},'mode':{'type':Sequelize[_0x5299('0x3')](_0x5299('0x4'),_0x5299('0x5'),_0x5299('0x6'),'quietmp3nb',_0x5299('0x7'),_0x5299('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x5299('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x5299('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5299('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x5299('0x9')},'defaultEntry':{'type':Sequelize[_0x5299('0xa')],'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 5286c84..946801b 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 _0xf045=['MusicOnHolds','UserProfileResource','end','error','stack','index','map','VoiceMusicOnHold','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','find','catch','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','Sound','save_name','converted_format','createdAt','%s.%s','basename','symlinkSync','message','removeSound','findOne','id2','format','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x1169c5,_0x2f8cc9){var _0x4b7f30=function(_0x1c96fe){while(--_0x1c96fe){_0x1169c5['push'](_0x1169c5['shift']());}};_0x4b7f30(++_0x2f8cc9);}(_0xf045,0xbc));var _0x5f04=function(_0x4ff9c8,_0x38ac9b){_0x4ff9c8=_0x4ff9c8-0x0;var _0x3ee9c3=_0xf045[_0x4ff9c8];return _0x3ee9c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f04('0x0'));var zipdir=require(_0x5f04('0x1'));var jsonpatch=require(_0x5f04('0x2'));var rp=require(_0x5f04('0x3'));var moment=require('moment');var BPromise=require(_0x5f04('0x4'));var Mustache=require(_0x5f04('0x5'));var util=require('util');var path=require(_0x5f04('0x6'));var sox=require(_0x5f04('0x7'));var csv=require('to-csv');var ejs=require(_0x5f04('0x8'));var fs=require('fs');var fs_extra=require(_0x5f04('0x9'));var _=require(_0x5f04('0xa'));var squel=require(_0x5f04('0xb'));var crypto=require(_0x5f04('0xc'));var jsforce=require(_0x5f04('0xd'));var deskjs=require(_0x5f04('0xe'));var toCsv=require(_0x5f04('0xf'));var querystring=require(_0x5f04('0x10'));var Papa=require(_0x5f04('0x11'));var Redis=require(_0x5f04('0x12'));var authService=require(_0x5f04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5f04('0x14'));var hardwareService=require(_0x5f04('0x15'));var logger=require('../../config/logger')(_0x5f04('0x16'));var utils=require(_0x5f04('0x17'));var config=require(_0x5f04('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f04('0x19'))['db'];function respondWithStatusCode(_0x478d8e,_0x465a21){_0x465a21=_0x465a21||0xcc;return function(_0x3ed7a1){if(_0x3ed7a1){return _0x478d8e[_0x5f04('0x1a')](_0x465a21);}return _0x478d8e[_0x5f04('0x1b')](_0x465a21)['end']();};}function respondWithResult(_0xb9c5d5,_0x118f25){_0x118f25=_0x118f25||0xc8;return function(_0x3e1ae8){if(_0x3e1ae8){return _0xb9c5d5[_0x5f04('0x1b')](_0x118f25)[_0x5f04('0x1c')](_0x3e1ae8);}};}function respondWithFilteredResult(_0x534d37,_0x57fcf1){return function(_0x50dcc3){if(_0x50dcc3){var _0x178d3e=typeof _0x57fcf1[_0x5f04('0x1d')]===_0x5f04('0x1e')&&typeof _0x57fcf1['limit']==='undefined';var _0x37516b=_0x50dcc3[_0x5f04('0x1f')];var _0xfa00f9=_0x178d3e?0x0:_0x57fcf1['offset'];var _0x1dbcc3=_0x178d3e?_0x50dcc3['count']:_0x57fcf1[_0x5f04('0x1d')]+_0x57fcf1[_0x5f04('0x20')];var _0x28f387;if(_0x1dbcc3>=_0x37516b){_0x1dbcc3=_0x37516b;_0x28f387=0xc8;}else{_0x28f387=0xce;}_0x534d37[_0x5f04('0x1b')](_0x28f387);return _0x534d37[_0x5f04('0x21')](_0x5f04('0x22'),_0xfa00f9+'-'+_0x1dbcc3+'/'+_0x37516b)[_0x5f04('0x1c')](_0x50dcc3);}return null;};}function patchUpdates(_0x257415){return function(_0x322ff7){try{jsonpatch[_0x5f04('0x23')](_0x322ff7,_0x257415,!![]);}catch(_0x53edac){return BPromise[_0x5f04('0x24')](_0x53edac);}return _0x322ff7[_0x5f04('0x25')]();};}function saveUpdates(_0x2fa9f4,_0x15e959){return function(_0xaf9a3a){if(_0xaf9a3a){return _0xaf9a3a[_0x5f04('0x26')](_0x2fa9f4)['then'](function(_0x84a485){return _0x84a485;});}return null;};}function removeEntity(_0xe9d870,_0x999e86){return function(_0x310a43){if(_0x310a43){return _0x310a43[_0x5f04('0x27')]()[_0x5f04('0x28')](function(){var _0x8fe2dc=_0x310a43[_0x5f04('0x29')]({'plain':!![]});var _0x1f4637=_0x5f04('0x2a');return db[_0x5f04('0x2b')][_0x5f04('0x27')]({'where':{'type':_0x1f4637,'resourceId':_0x8fe2dc['id']}})[_0x5f04('0x28')](function(){return _0x310a43;});})[_0x5f04('0x28')](function(){_0xe9d870[_0x5f04('0x1b')](0xcc)[_0x5f04('0x2c')]();});}};}function handleEntityNotFound(_0x4154f4,_0x23d23b){return function(_0x490598){if(!_0x490598){_0x4154f4[_0x5f04('0x1a')](0x194);}return _0x490598;};}function handleError(_0x122b87,_0x1d253f){_0x1d253f=_0x1d253f||0x1f4;return function(_0x4c3490){logger[_0x5f04('0x2d')](_0x4c3490[_0x5f04('0x2e')]);if(_0x4c3490['name']){delete _0x4c3490['name'];}_0x122b87[_0x5f04('0x1b')](_0x1d253f)['send'](_0x4c3490);};}exports[_0x5f04('0x2f')]=function(_0x5e7c56,_0x427461){var _0x2dda4e={},_0x2de800={},_0xca74a6={'count':0x0,'rows':[]};var _0x32c36a=_[_0x5f04('0x30')](db[_0x5f04('0x31')]['rawAttributes'],function(_0x562b72){return{'name':_0x562b72[_0x5f04('0x32')],'type':_0x562b72[_0x5f04('0x33')]['key']};});_0x2de800['model']=_['map'](_0x32c36a,_0x5f04('0x34'));_0x2de800[_0x5f04('0x35')]=_['keys'](_0x5e7c56[_0x5f04('0x35')]);_0x2de800[_0x5f04('0x36')]=_[_0x5f04('0x37')](_0x2de800[_0x5f04('0x38')],_0x2de800[_0x5f04('0x35')]);_0x2dda4e[_0x5f04('0x39')]=_['intersection'](_0x2de800['model'],qs[_0x5f04('0x3a')](_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x3a')]));_0x2dda4e[_0x5f04('0x39')]=_0x2dda4e[_0x5f04('0x39')][_0x5f04('0x3b')]?_0x2dda4e[_0x5f04('0x39')]:_0x2de800[_0x5f04('0x38')];if(!_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x3c')](_0x5f04('0x3d'))){_0x2dda4e[_0x5f04('0x20')]=qs['limit'](_0x5e7c56[_0x5f04('0x35')]['limit']);_0x2dda4e[_0x5f04('0x1d')]=qs['offset'](_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x1d')]);}_0x2dda4e['order']=qs[_0x5f04('0x3e')](_0x5e7c56['query'][_0x5f04('0x3e')]);delete _0x5e7c56[_0x5f04('0x35')]['sort'];_0x2dda4e['where']=qs['filters'](_[_0x5f04('0x3f')](_0x5e7c56[_0x5f04('0x35')],_0x2de800[_0x5f04('0x36')]),_0x32c36a);if(_0x5e7c56[_0x5f04('0x35')]['filter']){_0x2dda4e[_0x5f04('0x40')]=_[_0x5f04('0x41')](_0x2dda4e[_0x5f04('0x40')],{'$or':_['map'](_0x32c36a,function(_0x4ba3b3){if(_0x4ba3b3[_0x5f04('0x33')]!==_0x5f04('0x42')){var _0x52e15b={};_0x52e15b[_0x4ba3b3['name']]={'$like':'%'+_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x43')]+'%'};return _0x52e15b;}})});}_0x2dda4e=_[_0x5f04('0x41')]({},_0x2dda4e,_0x5e7c56['options']);var _0xce1303={'where':_0x2dda4e[_0x5f04('0x40')]};return db[_0x5f04('0x31')][_0x5f04('0x1f')](_0xce1303)[_0x5f04('0x28')](function(_0x1f5139){_0xca74a6['count']=_0x1f5139;if(_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x44')]){_0x2dda4e[_0x5f04('0x45')]=[{'all':!![]}];}return db[_0x5f04('0x31')][_0x5f04('0x46')](_0x2dda4e);})[_0x5f04('0x28')](function(_0xb9fff6){_0xca74a6['rows']=_0xb9fff6;return _0xca74a6;})[_0x5f04('0x28')](respondWithFilteredResult(_0x427461,_0x2dda4e))['catch'](handleError(_0x427461,null));};exports[_0x5f04('0x47')]=function(_0x333880,_0x59c1fc){var _0xa1ec8c={'raw':![],'where':{'id':_0x333880[_0x5f04('0x48')]['id']}},_0x2fdb88={};_0x2fdb88['model']=_[_0x5f04('0x49')](db[_0x5f04('0x31')]['rawAttributes']);_0x2fdb88[_0x5f04('0x35')]=_[_0x5f04('0x49')](_0x333880[_0x5f04('0x35')]);_0x2fdb88[_0x5f04('0x36')]=_['intersection'](_0x2fdb88['model'],_0x2fdb88[_0x5f04('0x35')]);_0xa1ec8c[_0x5f04('0x39')]=_[_0x5f04('0x37')](_0x2fdb88[_0x5f04('0x38')],qs[_0x5f04('0x3a')](_0x333880[_0x5f04('0x35')][_0x5f04('0x3a')]));_0xa1ec8c['attributes']=_0xa1ec8c['attributes'][_0x5f04('0x3b')]?_0xa1ec8c[_0x5f04('0x39')]:_0x2fdb88['model'];if(_0x333880[_0x5f04('0x35')]['includeAll']){_0xa1ec8c[_0x5f04('0x45')]=[{'all':!![]}];}_0xa1ec8c=_['merge']({},_0xa1ec8c,_0x333880[_0x5f04('0x4a')]);return db[_0x5f04('0x31')][_0x5f04('0x4b')](_0xa1ec8c)[_0x5f04('0x28')](handleEntityNotFound(_0x59c1fc,null))[_0x5f04('0x28')](respondWithResult(_0x59c1fc,null))[_0x5f04('0x4c')](handleError(_0x59c1fc,null));};exports['update']=function(_0x23be7a,_0x1f5104){if(_0x23be7a[_0x5f04('0x4d')]['id']){delete _0x23be7a[_0x5f04('0x4d')]['id'];}return db[_0x5f04('0x31')]['find']({'where':{'id':_0x23be7a[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0x1f5104,null))[_0x5f04('0x28')](saveUpdates(_0x23be7a[_0x5f04('0x4d')],null))[_0x5f04('0x28')](respondWithResult(_0x1f5104,null))[_0x5f04('0x4c')](handleError(_0x1f5104,null));};exports[_0x5f04('0x4e')]=function(_0x400f33,_0x3bec18,_0x38c944){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0xa2bedb){if(_0x400f33[_0x5f04('0x4d')][_0x5f04('0x51')]===_0x5f04('0x52')){_0x400f33[_0x5f04('0x4d')][_0x5f04('0x53')]=path[_0x5f04('0x54')](config[_0x5f04('0x55')],_0x5f04('0x56'),_0x400f33[_0x5f04('0x4d')][_0x5f04('0x34')]);}return db['VoiceMusicOnHold']['create'](_0x400f33[_0x5f04('0x4d')],{'transaction':_0xa2bedb})[_0x5f04('0x28')](function(_0x33fb44){if(_0x400f33[_0x5f04('0x4d')]['mode']===_0x5f04('0x52')){fs[_0x5f04('0x57')](_0x33fb44[_0x5f04('0x53')],parseInt(_0x5f04('0x58'),0x8));}var _0xd3319a=_0x400f33[_0x5f04('0x59')][_0x5f04('0x29')]({'plain':!![]});if(!_0xd3319a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd3319a[_0x5f04('0x5a')]===_0x5f04('0x59')){var _0x2f39ab=_0x33fb44[_0x5f04('0x29')]({'plain':!![]});return db[_0x5f04('0x5b')][_0x5f04('0x4b')]({'where':{'name':_0x5f04('0x2a'),'userProfileId':_0xd3319a[_0x5f04('0x5c')]},'raw':!![]})[_0x5f04('0x28')](function(_0x5696de){if(_0x5696de&&_0x5696de[_0x5f04('0x5d')]===0x0){return db['UserProfileResource'][_0x5f04('0x4e')]({'name':_0x2f39ab[_0x5f04('0x34')],'resourceId':_0x2f39ab['id'],'type':_0x5696de['name'],'sectionId':_0x5696de['id']},{})['then'](function(){return _0x33fb44;});}else{return _0x33fb44;}})['catch'](function(_0x506fb3){logger[_0x5f04('0x2d')](_0x5f04('0x5e'),_0x506fb3);});}return _0x33fb44;});})[_0x5f04('0x28')](respondWithResult(_0x3bec18,0xc9))[_0x5f04('0x4c')](handleError(_0x3bec18,null));};exports['destroy']=function(_0x5e409a,_0x14d316,_0x11d282){var _0x1ab903;return db[_0x5f04('0x31')]['find']({'where':{'id':_0x5e409a['params']['id']}})['then'](function(_0x514730){if(_0x514730){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x58f88d){return _0x514730[_0x5f04('0x27')]({'transaction':_0x58f88d,'raw':!![]})['then'](function(_0x37c560){if(_0x37c560[_0x5f04('0x53')]){fs[_0x5f04('0x5f')](_0x37c560[_0x5f04('0x53')])[_0x5f04('0x60')](function(_0x17156d){fs[_0x5f04('0x61')](path[_0x5f04('0x54')](_0x37c560[_0x5f04('0x53')],_0x17156d));});fs[_0x5f04('0x62')](_0x37c560[_0x5f04('0x53')]);}return _0x37c560;});})[_0x5f04('0x4c')](function(_0x49b017){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0x49b017['message']);});}})[_0x5f04('0x28')](handleEntityNotFound(_0x14d316,null))[_0x5f04('0x28')](removeEntity(_0x14d316,null))['catch'](handleError(_0x14d316,null));};exports['addSound']=function(_0x59850a,_0x316434,_0x56388c){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x34aff4){var _0x1fb15c;return db[_0x5f04('0x31')][_0x5f04('0x4b')]({'where':{'id':_0x59850a[_0x5f04('0x48')]['id']}})['then'](function(_0x44c4e9){if(_0x44c4e9){_0x1fb15c=_0x44c4e9;return _0x44c4e9['addSound'](_0x59850a[_0x5f04('0x4d')]['id'],{'transaction':_0x34aff4});}})[_0x5f04('0x28')](function(_0x2b89a9){if(_0x2b89a9){return db[_0x5f04('0x65')]['findOne']({'where':{'id':_0x59850a[_0x5f04('0x4d')]['id']},'attributes':['id',_0x5f04('0x34'),_0x5f04('0x66'),_0x5f04('0x67'),_0x5f04('0x68')],'raw':!![]});}})[_0x5f04('0x28')](function(_0x43ab03){if(_0x43ab03){var _0x182a86=path[_0x5f04('0x54')](config['root'],'server/files/sounds/converted',util['format'](_0x5f04('0x69'),path[_0x5f04('0x6a')](_0x43ab03['save_name'],path['extname'](_0x43ab03['save_name'])),_0x43ab03['converted_format']));var _0x1953aa=path['join'](config[_0x5f04('0x55')],_0x5f04('0x56'),_0x1fb15c[_0x5f04('0x34')],util['format'](_0x5f04('0x69'),_0x43ab03[_0x5f04('0x34')],_0x43ab03[_0x5f04('0x67')]));fs[_0x5f04('0x6b')](_0x182a86,_0x1953aa);return _0x43ab03;}})['catch'](function(_0xc8d52f){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0xc8d52f[_0x5f04('0x6c')]);});})['then'](handleEntityNotFound(_0x316434,null))['then'](respondWithResult(_0x316434,0xc9))[_0x5f04('0x4c')](handleError(_0x316434,null));};exports[_0x5f04('0x6d')]=function(_0x42555a,_0xd1d2bd,_0x5da516){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x32491a){var _0x1e4cce;return db[_0x5f04('0x31')][_0x5f04('0x6e')]({'where':{'id':_0x42555a[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0xd1d2bd,null))[_0x5f04('0x28')](function(_0x53a9a4){if(_0x53a9a4){_0x1e4cce=_0x53a9a4;return _0x53a9a4['removeSound'](_0x42555a[_0x5f04('0x48')][_0x5f04('0x6f')]);}})[_0x5f04('0x28')](function(_0xf910a4){if(_0xf910a4){return db[_0x5f04('0x65')][_0x5f04('0x6e')]({'where':{'id':_0x42555a['params'][_0x5f04('0x6f')]},'attributes':['id','name',_0x5f04('0x66'),_0x5f04('0x67'),'createdAt'],'raw':!![]});}})[_0x5f04('0x28')](function(_0x29aaed){if(_0x29aaed){fs[_0x5f04('0x61')](path['join'](_0x1e4cce[_0x5f04('0x53')],util[_0x5f04('0x70')](_0x5f04('0x69'),_0x29aaed[_0x5f04('0x34')],_0x29aaed['converted_format'])));return _0x29aaed;}})[_0x5f04('0x4c')](function(_0x4593ab){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0x4593ab[_0x5f04('0x6c')]);});})[_0x5f04('0x28')](handleEntityNotFound(_0xd1d2bd,null))[_0x5f04('0x28')](respondWithStatusCode(_0xd1d2bd,0xcc))['catch'](handleError(_0xd1d2bd,null));};exports[_0x5f04('0x71')]=function(_0x71f62f,_0x1ee114,_0x73072a){var _0x425473={};var _0x1fb0db={};var _0x409ca6;var _0x228685;return db[_0x5f04('0x31')]['findOne']({'where':{'id':_0x71f62f[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0x1ee114,null))[_0x5f04('0x28')](function(_0x3ab9a5){if(_0x3ab9a5){_0x409ca6=_0x3ab9a5;_0x1fb0db[_0x5f04('0x38')]=_[_0x5f04('0x49')](db['Sound']['rawAttributes']);_0x1fb0db[_0x5f04('0x35')]=_[_0x5f04('0x49')](_0x71f62f[_0x5f04('0x35')]);_0x1fb0db['filters']=_['intersection'](_0x1fb0db['model'],_0x1fb0db['query']);_0x425473[_0x5f04('0x39')]=_[_0x5f04('0x37')](_0x1fb0db[_0x5f04('0x38')],qs[_0x5f04('0x3a')](_0x71f62f['query'][_0x5f04('0x3a')]));_0x425473[_0x5f04('0x39')]=_0x425473[_0x5f04('0x39')][_0x5f04('0x3b')]?_0x425473[_0x5f04('0x39')]:_0x1fb0db[_0x5f04('0x38')];_0x425473[_0x5f04('0x72')]=qs[_0x5f04('0x3e')](_0x71f62f[_0x5f04('0x35')]['sort']);_0x425473[_0x5f04('0x40')]=qs[_0x5f04('0x36')](_[_0x5f04('0x3f')](_0x71f62f[_0x5f04('0x35')],_0x1fb0db['filters']));if(_0x71f62f[_0x5f04('0x35')][_0x5f04('0x43')]){_0x425473[_0x5f04('0x40')]=_[_0x5f04('0x41')](_0x425473['where'],{'$or':_[_0x5f04('0x30')](_0x425473[_0x5f04('0x39')],function(_0x24ca15){var _0x131038={};_0x131038[_0x24ca15]={'$like':'%'+_0x71f62f['query'][_0x5f04('0x43')]+'%'};return _0x131038;})});}_0x425473=_[_0x5f04('0x41')]({},_0x425473,_0x71f62f[_0x5f04('0x4a')]);return _0x409ca6[_0x5f04('0x71')](_0x425473);}})['then'](function(_0x1c345e){if(_0x1c345e){_0x228685=_0x1c345e['length'];if(!_0x71f62f[_0x5f04('0x35')][_0x5f04('0x3c')](_0x5f04('0x3d'))){_0x425473[_0x5f04('0x20')]=qs[_0x5f04('0x20')](_0x71f62f[_0x5f04('0x35')][_0x5f04('0x20')]);_0x425473['offset']=qs[_0x5f04('0x1d')](_0x71f62f[_0x5f04('0x35')]['offset']);}return _0x409ca6[_0x5f04('0x71')](_0x425473);}})[_0x5f04('0x28')](function(_0x46837b){if(_0x46837b){return _0x46837b?{'count':_0x228685,'rows':_0x46837b}:null;}})[_0x5f04('0x28')](respondWithResult(_0x1ee114,null))[_0x5f04('0x4c')](handleError(_0x1ee114,null));}; \ No newline at end of file +var _0xc6cb=['symlinkSync','Sequelize','removeSound','id2','getSounds','length','nolimit','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname'];(function(_0x211736,_0xe792a4){var _0x5bef36=function(_0x35ce58){while(--_0x35ce58){_0x211736['push'](_0x211736['shift']());}};_0x5bef36(++_0xe792a4);}(_0xc6cb,0x15a));var _0xbc6c=function(_0x5ee80f,_0x4eafa5){_0x5ee80f=_0x5ee80f-0x0;var _0x213b29=_0xc6cb[_0x5ee80f];return _0x213b29;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc6c('0x0'));var rp=require(_0xbc6c('0x1'));var moment=require(_0xbc6c('0x2'));var BPromise=require(_0xbc6c('0x3'));var Mustache=require(_0xbc6c('0x4'));var util=require('util');var path=require(_0xbc6c('0x5'));var sox=require(_0xbc6c('0x6'));var csv=require(_0xbc6c('0x7'));var ejs=require(_0xbc6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc6c('0x9'));var jsforce=require(_0xbc6c('0xa'));var deskjs=require(_0xbc6c('0xb'));var toCsv=require(_0xbc6c('0x7'));var querystring=require(_0xbc6c('0xc'));var Papa=require(_0xbc6c('0xd'));var Redis=require(_0xbc6c('0xe'));var authService=require(_0xbc6c('0xf'));var qs=require(_0xbc6c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc6c('0x11'));var utils=require(_0xbc6c('0x12'));var config=require(_0xbc6c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc6c('0x14'))['db'];function respondWithStatusCode(_0x2b491a,_0x4e1ed2){_0x4e1ed2=_0x4e1ed2||0xcc;return function(_0x3f7c50){if(_0x3f7c50){return _0x2b491a[_0xbc6c('0x15')](_0x4e1ed2);}return _0x2b491a[_0xbc6c('0x16')](_0x4e1ed2)[_0xbc6c('0x17')]();};}function respondWithResult(_0x2abfe4,_0x24b68f){_0x24b68f=_0x24b68f||0xc8;return function(_0x3a2f51){if(_0x3a2f51){return _0x2abfe4['status'](_0x24b68f)[_0xbc6c('0x18')](_0x3a2f51);}};}function respondWithFilteredResult(_0xb4ca6,_0x566e71){return function(_0xedc523){if(_0xedc523){var _0x4b3a65=typeof _0x566e71[_0xbc6c('0x19')]===_0xbc6c('0x1a')&&typeof _0x566e71[_0xbc6c('0x1b')]===_0xbc6c('0x1a');var _0x30009d=_0xedc523[_0xbc6c('0x1c')];var _0x2a73cf=_0x4b3a65?0x0:_0x566e71[_0xbc6c('0x19')];var _0x397211=_0x4b3a65?_0xedc523[_0xbc6c('0x1c')]:_0x566e71['offset']+_0x566e71[_0xbc6c('0x1b')];var _0x3ea367;if(_0x397211>=_0x30009d){_0x397211=_0x30009d;_0x3ea367=0xc8;}else{_0x3ea367=0xce;}_0xb4ca6[_0xbc6c('0x16')](_0x3ea367);return _0xb4ca6[_0xbc6c('0x1d')]('Content-Range',_0x2a73cf+'-'+_0x397211+'/'+_0x30009d)['json'](_0xedc523);}return null;};}function patchUpdates(_0x192e0b){return function(_0x368b59){try{jsonpatch[_0xbc6c('0x1e')](_0x368b59,_0x192e0b,!![]);}catch(_0x2eb71c){return BPromise[_0xbc6c('0x1f')](_0x2eb71c);}return _0x368b59[_0xbc6c('0x20')]();};}function saveUpdates(_0x444777,_0x3db38e){return function(_0x46c2f5){if(_0x46c2f5){return _0x46c2f5[_0xbc6c('0x21')](_0x444777)['then'](function(_0x45cf67){return _0x45cf67;});}return null;};}function removeEntity(_0x1f2232,_0x34d346){return function(_0xf9d281){if(_0xf9d281){return _0xf9d281['destroy']()[_0xbc6c('0x22')](function(){var _0x2c192c=_0xf9d281[_0xbc6c('0x23')]({'plain':!![]});var _0x1bd3c5=_0xbc6c('0x24');return db[_0xbc6c('0x25')]['destroy']({'where':{'type':_0x1bd3c5,'resourceId':_0x2c192c['id']}})[_0xbc6c('0x22')](function(){return _0xf9d281;});})[_0xbc6c('0x22')](function(){_0x1f2232[_0xbc6c('0x16')](0xcc)[_0xbc6c('0x17')]();});}};}function handleEntityNotFound(_0x32ed81,_0x538fff){return function(_0x26310c){if(!_0x26310c){_0x32ed81['sendStatus'](0x194);}return _0x26310c;};}function handleError(_0x39e6c7,_0x459e7b){_0x459e7b=_0x459e7b||0x1f4;return function(_0x5c4cf5){logger['error'](_0x5c4cf5[_0xbc6c('0x26')]);if(_0x5c4cf5[_0xbc6c('0x27')]){delete _0x5c4cf5[_0xbc6c('0x27')];}_0x39e6c7['status'](_0x459e7b)[_0xbc6c('0x28')](_0x5c4cf5);};}exports[_0xbc6c('0x29')]=function(_0x3c2191,_0x1db144){var _0x5b179a={},_0x160188={},_0x1d6a08={'count':0x0,'rows':[]};var _0xa2101c=_[_0xbc6c('0x2a')](db[_0xbc6c('0x2b')]['rawAttributes'],function(_0x4dbc2e){return{'name':_0x4dbc2e[_0xbc6c('0x2c')],'type':_0x4dbc2e[_0xbc6c('0x2d')]['key']};});_0x160188['model']=_['map'](_0xa2101c,_0xbc6c('0x27'));_0x160188[_0xbc6c('0x2e')]=_['keys'](_0x3c2191[_0xbc6c('0x2e')]);_0x160188[_0xbc6c('0x2f')]=_[_0xbc6c('0x30')](_0x160188['model'],_0x160188[_0xbc6c('0x2e')]);_0x5b179a['attributes']=_[_0xbc6c('0x30')](_0x160188[_0xbc6c('0x31')],qs[_0xbc6c('0x32')](_0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x32')]));_0x5b179a[_0xbc6c('0x33')]=_0x5b179a[_0xbc6c('0x33')]['length']?_0x5b179a[_0xbc6c('0x33')]:_0x160188[_0xbc6c('0x31')];if(!_0x3c2191['query'][_0xbc6c('0x34')]('nolimit')){_0x5b179a[_0xbc6c('0x1b')]=qs[_0xbc6c('0x1b')](_0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x1b')]);_0x5b179a[_0xbc6c('0x19')]=qs[_0xbc6c('0x19')](_0x3c2191[_0xbc6c('0x2e')]['offset']);}_0x5b179a[_0xbc6c('0x35')]=qs[_0xbc6c('0x36')](_0x3c2191['query'][_0xbc6c('0x36')]);delete _0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x36')];_0x5b179a[_0xbc6c('0x37')]=qs[_0xbc6c('0x2f')](_[_0xbc6c('0x38')](_0x3c2191[_0xbc6c('0x2e')],_0x160188[_0xbc6c('0x2f')]),_0xa2101c);if(_0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x39')]){_0x5b179a['where']=_[_0xbc6c('0x3a')](_0x5b179a[_0xbc6c('0x37')],{'$or':_[_0xbc6c('0x2a')](_0xa2101c,function(_0x4637de){if(_0x4637de[_0xbc6c('0x2d')]!==_0xbc6c('0x3b')){var _0x43c1ef={};_0x43c1ef[_0x4637de['name']]={'$like':'%'+_0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x39')]+'%'};return _0x43c1ef;}})});}_0x5b179a=_[_0xbc6c('0x3a')]({},_0x5b179a,_0x3c2191[_0xbc6c('0x3c')]);var _0x3f6e71={'where':_0x5b179a[_0xbc6c('0x37')]};return db[_0xbc6c('0x2b')]['count'](_0x3f6e71)[_0xbc6c('0x22')](function(_0x422732){_0x1d6a08[_0xbc6c('0x1c')]=_0x422732;if(_0x3c2191[_0xbc6c('0x2e')][_0xbc6c('0x3d')]){_0x5b179a[_0xbc6c('0x3e')]=[{'all':!![]}];}return db[_0xbc6c('0x2b')]['findAll'](_0x5b179a);})['then'](function(_0x24a148){_0x1d6a08[_0xbc6c('0x3f')]=_0x24a148;return _0x1d6a08;})[_0xbc6c('0x22')](respondWithFilteredResult(_0x1db144,_0x5b179a))[_0xbc6c('0x40')](handleError(_0x1db144,null));};exports[_0xbc6c('0x41')]=function(_0x4bf1a0,_0x55eceb){var _0x2e8483={'raw':![],'where':{'id':_0x4bf1a0[_0xbc6c('0x42')]['id']}},_0x563238={};_0x563238[_0xbc6c('0x31')]=_[_0xbc6c('0x43')](db[_0xbc6c('0x2b')][_0xbc6c('0x44')]);_0x563238[_0xbc6c('0x2e')]=_['keys'](_0x4bf1a0[_0xbc6c('0x2e')]);_0x563238[_0xbc6c('0x2f')]=_['intersection'](_0x563238['model'],_0x563238[_0xbc6c('0x2e')]);_0x2e8483[_0xbc6c('0x33')]=_['intersection'](_0x563238['model'],qs['fields'](_0x4bf1a0[_0xbc6c('0x2e')][_0xbc6c('0x32')]));_0x2e8483[_0xbc6c('0x33')]=_0x2e8483[_0xbc6c('0x33')]['length']?_0x2e8483[_0xbc6c('0x33')]:_0x563238['model'];if(_0x4bf1a0[_0xbc6c('0x2e')][_0xbc6c('0x3d')]){_0x2e8483[_0xbc6c('0x3e')]=[{'all':!![]}];}_0x2e8483=_[_0xbc6c('0x3a')]({},_0x2e8483,_0x4bf1a0[_0xbc6c('0x3c')]);return db[_0xbc6c('0x2b')][_0xbc6c('0x45')](_0x2e8483)[_0xbc6c('0x22')](handleEntityNotFound(_0x55eceb,null))[_0xbc6c('0x22')](respondWithResult(_0x55eceb,null))[_0xbc6c('0x40')](handleError(_0x55eceb,null));};exports[_0xbc6c('0x21')]=function(_0x31ee0a,_0x49b8c3){if(_0x31ee0a[_0xbc6c('0x46')]['id']){delete _0x31ee0a[_0xbc6c('0x46')]['id'];}return db[_0xbc6c('0x2b')]['find']({'where':{'id':_0x31ee0a[_0xbc6c('0x42')]['id']}})[_0xbc6c('0x22')](handleEntityNotFound(_0x49b8c3,null))['then'](saveUpdates(_0x31ee0a[_0xbc6c('0x46')],null))['then'](respondWithResult(_0x49b8c3,null))['catch'](handleError(_0x49b8c3,null));};exports[_0xbc6c('0x47')]=function(_0x4176eb,_0x45c2a4,_0x2212cc){return db[_0xbc6c('0x48')]['transaction'](function(_0x2f6f03){if(_0x4176eb[_0xbc6c('0x46')][_0xbc6c('0x49')]===_0xbc6c('0x4a')){_0x4176eb['body'][_0xbc6c('0x4b')]=path[_0xbc6c('0x4c')](config[_0xbc6c('0x4d')],_0xbc6c('0x4e'),_0x4176eb[_0xbc6c('0x46')][_0xbc6c('0x27')]);}return db[_0xbc6c('0x2b')][_0xbc6c('0x47')](_0x4176eb[_0xbc6c('0x46')],{'transaction':_0x2f6f03})[_0xbc6c('0x22')](function(_0x3600aa){if(_0x4176eb[_0xbc6c('0x46')][_0xbc6c('0x49')]===_0xbc6c('0x4a')){fs[_0xbc6c('0x4f')](_0x3600aa[_0xbc6c('0x4b')],parseInt(_0xbc6c('0x50'),0x8));}var _0x2879f0=_0x4176eb[_0xbc6c('0x51')][_0xbc6c('0x23')]({'plain':!![]});if(!_0x2879f0)throw new Error(_0xbc6c('0x52'));if(_0x2879f0['role']===_0xbc6c('0x51')){var _0xecf1a4=_0x3600aa[_0xbc6c('0x23')]({'plain':!![]});return db[_0xbc6c('0x53')][_0xbc6c('0x45')]({'where':{'name':_0xbc6c('0x24'),'userProfileId':_0x2879f0[_0xbc6c('0x54')]},'raw':!![]})['then'](function(_0x3fc8bc){if(_0x3fc8bc&&_0x3fc8bc[_0xbc6c('0x55')]===0x0){return db[_0xbc6c('0x25')][_0xbc6c('0x47')]({'name':_0xecf1a4['name'],'resourceId':_0xecf1a4['id'],'type':_0x3fc8bc[_0xbc6c('0x27')],'sectionId':_0x3fc8bc['id']},{})[_0xbc6c('0x22')](function(){return _0x3600aa;});}else{return _0x3600aa;}})[_0xbc6c('0x40')](function(_0x35bd12){logger[_0xbc6c('0x56')](_0xbc6c('0x57'),_0x35bd12);});}return _0x3600aa;});})[_0xbc6c('0x22')](respondWithResult(_0x45c2a4,0xc9))[_0xbc6c('0x40')](handleError(_0x45c2a4,null));};exports[_0xbc6c('0x58')]=function(_0x2747a8,_0xee99ff,_0x4869cf){var _0x5511b1;return db[_0xbc6c('0x2b')]['find']({'where':{'id':_0x2747a8[_0xbc6c('0x42')]['id']}})[_0xbc6c('0x22')](function(_0x3c5f13){if(_0x3c5f13){return db[_0xbc6c('0x48')]['transaction'](function(_0x4169f2){return _0x3c5f13[_0xbc6c('0x58')]({'transaction':_0x4169f2,'raw':!![]})[_0xbc6c('0x22')](function(_0x379dcb){if(_0x379dcb[_0xbc6c('0x4b')]){fs[_0xbc6c('0x59')](_0x379dcb[_0xbc6c('0x4b')])[_0xbc6c('0x5a')](function(_0x6bea17){fs[_0xbc6c('0x5b')](path['join'](_0x379dcb[_0xbc6c('0x4b')],_0x6bea17));});fs['rmdirSync'](_0x379dcb['directory']);}return _0x379dcb;});})[_0xbc6c('0x40')](function(_0x10b418){throw new db['Sequelize'][(_0xbc6c('0x5c'))](_0x10b418[_0xbc6c('0x5d')]);});}})[_0xbc6c('0x22')](handleEntityNotFound(_0xee99ff,null))['then'](removeEntity(_0xee99ff,null))['catch'](handleError(_0xee99ff,null));};exports[_0xbc6c('0x5e')]=function(_0xe4eadc,_0x5439b4,_0x32edf6){return db[_0xbc6c('0x48')][_0xbc6c('0x5f')](function(_0x5bbb16){var _0x199a4c;return db[_0xbc6c('0x2b')][_0xbc6c('0x45')]({'where':{'id':_0xe4eadc[_0xbc6c('0x42')]['id']}})['then'](function(_0x12f921){if(_0x12f921){_0x199a4c=_0x12f921;return _0x12f921[_0xbc6c('0x5e')](_0xe4eadc[_0xbc6c('0x46')]['id'],{'transaction':_0x5bbb16});}})[_0xbc6c('0x22')](function(_0x3c4fbb){if(_0x3c4fbb){return db[_0xbc6c('0x60')][_0xbc6c('0x61')]({'where':{'id':_0xe4eadc[_0xbc6c('0x46')]['id']},'attributes':['id',_0xbc6c('0x27'),_0xbc6c('0x62'),_0xbc6c('0x63'),_0xbc6c('0x64')],'raw':!![]});}})[_0xbc6c('0x22')](function(_0x4ebf9e){if(_0x4ebf9e){var _0x489d06=path[_0xbc6c('0x4c')](config['root'],_0xbc6c('0x65'),util[_0xbc6c('0x66')](_0xbc6c('0x67'),path[_0xbc6c('0x68')](_0x4ebf9e[_0xbc6c('0x62')],path[_0xbc6c('0x69')](_0x4ebf9e[_0xbc6c('0x62')])),_0x4ebf9e[_0xbc6c('0x63')]));var _0x337f92=path[_0xbc6c('0x4c')](config['root'],_0xbc6c('0x4e'),_0x199a4c[_0xbc6c('0x27')],util[_0xbc6c('0x66')](_0xbc6c('0x67'),_0x4ebf9e[_0xbc6c('0x27')],_0x4ebf9e[_0xbc6c('0x63')]));fs[_0xbc6c('0x6a')](_0x489d06,_0x337f92);return _0x4ebf9e;}})[_0xbc6c('0x40')](function(_0x332aa1){throw new db[(_0xbc6c('0x6b'))][(_0xbc6c('0x5c'))](_0x332aa1[_0xbc6c('0x5d')]);});})[_0xbc6c('0x22')](handleEntityNotFound(_0x5439b4,null))[_0xbc6c('0x22')](respondWithResult(_0x5439b4,0xc9))['catch'](handleError(_0x5439b4,null));};exports['removeSound']=function(_0x5eb2da,_0x138919,_0x5a8758){return db[_0xbc6c('0x48')][_0xbc6c('0x5f')](function(_0x5944c9){var _0x530bcf;return db[_0xbc6c('0x2b')][_0xbc6c('0x61')]({'where':{'id':_0x5eb2da[_0xbc6c('0x42')]['id']}})['then'](handleEntityNotFound(_0x138919,null))[_0xbc6c('0x22')](function(_0x4239a1){if(_0x4239a1){_0x530bcf=_0x4239a1;return _0x4239a1[_0xbc6c('0x6c')](_0x5eb2da['params'][_0xbc6c('0x6d')]);}})[_0xbc6c('0x22')](function(_0x1456f1){if(_0x1456f1){return db['Sound'][_0xbc6c('0x61')]({'where':{'id':_0x5eb2da[_0xbc6c('0x42')][_0xbc6c('0x6d')]},'attributes':['id',_0xbc6c('0x27'),_0xbc6c('0x62'),_0xbc6c('0x63'),_0xbc6c('0x64')],'raw':!![]});}})[_0xbc6c('0x22')](function(_0x1a5fdd){if(_0x1a5fdd){fs['unlinkSync'](path[_0xbc6c('0x4c')](_0x530bcf[_0xbc6c('0x4b')],util['format'](_0xbc6c('0x67'),_0x1a5fdd[_0xbc6c('0x27')],_0x1a5fdd['converted_format'])));return _0x1a5fdd;}})[_0xbc6c('0x40')](function(_0xb25422){throw new db[(_0xbc6c('0x6b'))][(_0xbc6c('0x5c'))](_0xb25422[_0xbc6c('0x5d')]);});})[_0xbc6c('0x22')](handleEntityNotFound(_0x138919,null))[_0xbc6c('0x22')](respondWithStatusCode(_0x138919,0xcc))[_0xbc6c('0x40')](handleError(_0x138919,null));};exports[_0xbc6c('0x6e')]=function(_0x2965e,_0x29130d,_0x13a688){var _0x529b88={};var _0x2c64f7={};var _0x10202a;var _0x4be92a;return db[_0xbc6c('0x2b')][_0xbc6c('0x61')]({'where':{'id':_0x2965e[_0xbc6c('0x42')]['id']}})[_0xbc6c('0x22')](handleEntityNotFound(_0x29130d,null))[_0xbc6c('0x22')](function(_0x2e2df8){if(_0x2e2df8){_0x10202a=_0x2e2df8;_0x2c64f7[_0xbc6c('0x31')]=_[_0xbc6c('0x43')](db['Sound'][_0xbc6c('0x44')]);_0x2c64f7['query']=_[_0xbc6c('0x43')](_0x2965e[_0xbc6c('0x2e')]);_0x2c64f7[_0xbc6c('0x2f')]=_[_0xbc6c('0x30')](_0x2c64f7[_0xbc6c('0x31')],_0x2c64f7[_0xbc6c('0x2e')]);_0x529b88['attributes']=_[_0xbc6c('0x30')](_0x2c64f7[_0xbc6c('0x31')],qs['fields'](_0x2965e[_0xbc6c('0x2e')][_0xbc6c('0x32')]));_0x529b88[_0xbc6c('0x33')]=_0x529b88[_0xbc6c('0x33')]['length']?_0x529b88[_0xbc6c('0x33')]:_0x2c64f7[_0xbc6c('0x31')];_0x529b88[_0xbc6c('0x35')]=qs['sort'](_0x2965e['query'][_0xbc6c('0x36')]);_0x529b88[_0xbc6c('0x37')]=qs[_0xbc6c('0x2f')](_[_0xbc6c('0x38')](_0x2965e['query'],_0x2c64f7['filters']));if(_0x2965e[_0xbc6c('0x2e')][_0xbc6c('0x39')]){_0x529b88[_0xbc6c('0x37')]=_['merge'](_0x529b88[_0xbc6c('0x37')],{'$or':_[_0xbc6c('0x2a')](_0x529b88['attributes'],function(_0x4b55b7){var _0x142f7f={};_0x142f7f[_0x4b55b7]={'$like':'%'+_0x2965e[_0xbc6c('0x2e')][_0xbc6c('0x39')]+'%'};return _0x142f7f;})});}_0x529b88=_[_0xbc6c('0x3a')]({},_0x529b88,_0x2965e[_0xbc6c('0x3c')]);return _0x10202a[_0xbc6c('0x6e')](_0x529b88);}})['then'](function(_0x22d01e){if(_0x22d01e){_0x4be92a=_0x22d01e[_0xbc6c('0x6f')];if(!_0x2965e[_0xbc6c('0x2e')][_0xbc6c('0x34')](_0xbc6c('0x70'))){_0x529b88['limit']=qs[_0xbc6c('0x1b')](_0x2965e[_0xbc6c('0x2e')][_0xbc6c('0x1b')]);_0x529b88['offset']=qs[_0xbc6c('0x19')](_0x2965e['query'][_0xbc6c('0x19')]);}return _0x10202a[_0xbc6c('0x6e')](_0x529b88);}})['then'](function(_0x5975d5){if(_0x5975d5){return _0x5975d5?{'count':_0x4be92a,'rows':_0x5975d5}:null;}})[_0xbc6c('0x22')](respondWithResult(_0x29130d,null))[_0xbc6c('0x40')](handleError(_0x29130d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 60ce27c..4069d2a 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 _0xe632=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','rimraf','./voiceMusicOnHold.attributes'];(function(_0x4315cf,_0x5a1ac5){var _0x2913b1=function(_0x43c6ab){while(--_0x43c6ab){_0x4315cf['push'](_0x4315cf['shift']());}};_0x2913b1(++_0x5a1ac5);}(_0xe632,0x1b2));var _0x2e63=function(_0x4b1cae,_0x2a415f){_0x4b1cae=_0x4b1cae-0x0;var _0x5eb298=_0xe632[_0x4b1cae];return _0x5eb298;};'use strict';var _=require(_0x2e63('0x0'));var util=require(_0x2e63('0x1'));var logger=require(_0x2e63('0x2'))('api');var moment=require(_0x2e63('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e63('0x4'));var config=require('../../config/environment');var attributes=require(_0x2e63('0x5'));module['exports']=function(_0xed3ca2,_0x30f098){return _0xed3ca2['define'](_0x2e63('0x6'),attributes,{'tableName':_0x2e63('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41fe=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x32a8f7,_0x2d5b26){var _0x55cb4c=function(_0xb748b3){while(--_0xb748b3){_0x32a8f7['push'](_0x32a8f7['shift']());}};_0x55cb4c(++_0x2d5b26);}(_0x41fe,0xd5));var _0xe41f=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x41fe[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var logger=require(_0xe41f('0x2'))('api');var moment=require(_0xe41f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe41f('0x4'));var fs=require('fs');var path=require(_0xe41f('0x5'));var rimraf=require(_0xe41f('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xe41f('0x7')]=function(_0x4b6073,_0x302d56){return _0x4b6073[_0xe41f('0x8')](_0xe41f('0x9'),attributes,{'tableName':_0xe41f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5f9d6e9..295cc38 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x4ed1c3,_0x231957){var _0x4cb38d=function(_0x1dba62){while(--_0x1dba62){_0x4ed1c3['push'](_0x4ed1c3['shift']());}};_0x4cb38d(++_0x231957);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x36beac,_0x2fb544){var _0x24b356=function(_0xb5940a){while(--_0xb5940a){_0x36beac['push'](_0x36beac['shift']());}};_0x24b356(++_0x2fb544);}(_0x70e0,0x17b));var _0x070e=function(_0x52a619,_0x45b45a){_0x52a619=_0x52a619-0x0;var _0x3c46af=_0x70e0[_0x52a619];return _0x3c46af;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index dd055b4..1a09b4b 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 _0x059d=['put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams'];(function(_0x24eabd,_0x258e8d){var _0x2ab3f4=function(_0x1d4e7b){while(--_0x1d4e7b){_0x24eabd['push'](_0x24eabd['shift']());}};_0x2ab3f4(++_0x258e8d);}(_0x059d,0x1b9));var _0xd059=function(_0x3ab4ff,_0x2b749a){_0x3ab4ff=_0x3ab4ff-0x0;var _0x2c08b7=_0x059d[_0x3ab4ff];return _0x2c08b7;};'use strict';var multer=require(_0xd059('0x0'));var util=require(_0xd059('0x1'));var path=require(_0xd059('0x2'));var timeout=require(_0xd059('0x3'));var express=require(_0xd059('0x4'));var router=express[_0xd059('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd059('0x6'));var interaction=require(_0xd059('0x7'));var config=require(_0xd059('0x8'));var controller=require(_0xd059('0x9'));router['get']('/',auth[_0xd059('0xa')](),controller[_0xd059('0xb')]);router[_0xd059('0xc')]('/describe',auth[_0xd059('0xa')](),controller[_0xd059('0xd')]);router[_0xd059('0xc')](_0xd059('0xe'),auth[_0xd059('0xa')](),controller[_0xd059('0xf')]);router['get']('/:id/users',auth[_0xd059('0xa')](),controller['getAgents']);router['get'](_0xd059('0x10'),auth['isAuthenticated'](),controller[_0xd059('0x11')]);router[_0xd059('0x12')]('/',auth[_0xd059('0xa')](),controller[_0xd059('0x13')]);router['post'](_0xd059('0x14'),auth[_0xd059('0xa')](),controller[_0xd059('0x15')]);router[_0xd059('0x12')](_0xd059('0x10'),auth[_0xd059('0xa')](),controller[_0xd059('0x16')]);router[_0xd059('0x17')](_0xd059('0xe'),auth[_0xd059('0xa')](),controller[_0xd059('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd059('0x19')]);router['delete'](_0xd059('0x14'),auth[_0xd059('0xa')](),controller['removeAgents']);router[_0xd059('0x1a')]('/:id/teams',auth[_0xd059('0xa')](),controller[_0xd059('0x1b')]);module[_0xd059('0x1c')]=router; \ No newline at end of file +var _0x5eb8=['delete','/:id/teams','removeTeams','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/users','post','create','addAgents','put'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x209f9c,_0x4ea385){_0x209f9c=_0x209f9c-0x0;var _0x13c1ef=_0x5eb8[_0x209f9c];return _0x13c1ef;};'use strict';var multer=require('multer');var util=require(_0x85eb('0x0'));var path=require(_0x85eb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85eb('0x2')]();var fs_extra=require(_0x85eb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x85eb('0x4'));var config=require(_0x85eb('0x5'));var controller=require(_0x85eb('0x6'));router[_0x85eb('0x7')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x8')]);router[_0x85eb('0x7')](_0x85eb('0x9'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x85eb('0x7')](_0x85eb('0xd'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/teams',auth[_0x85eb('0xa')](),controller['getTeams']);router[_0x85eb('0xe')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0xe')]('/:id/users',auth[_0x85eb('0xa')](),controller[_0x85eb('0x10')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x85eb('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85eb('0x12')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);router[_0x85eb('0x12')]('/:id/users',auth[_0x85eb('0xa')](),controller['removeAgents']);router['delete'](_0x85eb('0x13'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5d1b15c..9e0bd42 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 _0xa7c2=['STRING','VIRTUAL','system-','name','INTEGER','sequelize','exports'];(function(_0x30d961,_0x1c5f90){var _0x470b0d=function(_0x9f3509){while(--_0x9f3509){_0x30d961['push'](_0x30d961['shift']());}};_0x470b0d(++_0x1c5f90);}(_0xa7c2,0x8a));var _0x2a7c=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xa7c2[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x2a7c('0x0'));module[_0x2a7c('0x1')]={'name':{'type':Sequelize[_0x2a7c('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x2a7c('0x3')],'get':function(_0xeadbe7){return _0x2a7c('0x4')+this['getDataValue'](_0x2a7c('0x5'))+'-';}},'description':{'type':Sequelize[_0x2a7c('0x2')]},'callerIdAll':{'type':Sequelize[_0x2a7c('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2a7c('0x6')]}}; \ No newline at end of file +var _0x455e=['getDataValue','INTEGER','STRING','name','VIRTUAL','system-'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x455e,0xb6));var _0xe455=function(_0x5d2516,_0x30862b){_0x5d2516=_0x5d2516-0x0;var _0x55cf98=_0x455e[_0x5d2516];return _0x55cf98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe455('0x0')],'allowNull':![],'unique':_0xe455('0x1')},'prefix':{'type':Sequelize[_0xe455('0x2')],'get':function(_0x5e1450){return _0xe455('0x3')+this[_0xe455('0x4')](_0xe455('0x1'))+'-';}},'description':{'type':Sequelize[_0xe455('0x0')]},'callerIdAll':{'type':Sequelize[_0xe455('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xe455('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index d76ed28..42578e7 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 _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','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','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x373d,0x1e2));var _0xd373=function(_0x4eb59e,_0x1b60b4){_0x4eb59e=_0x4eb59e-0x0;var _0x595d0d=_0x373d[_0x4eb59e];return _0x595d0d;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file +var _0xda2d=['UserProfileResource','destroy','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoicePrefix','includeAll','findAll','catch','show','params','rawAttributes','include','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','options','getTeams','findOne','Team','online','voicePause','interface','flatMap','Agents','addTeams','each','UserVoicePrefix','forEach','userVoicePrefix:save','removeTeams','field','tq.TeamId','from','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','TeamId','includes','all','union','compact','value','isEmpty','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','VoicePrefixes'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xda2d,0x102));var _0xdda2=function(_0x15ee45,_0x543b6b){_0x15ee45=_0x15ee45-0x0;var _0x13660f=_0xda2d[_0x15ee45];return _0x13660f;};'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 hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdda2('0x19')](config[_0xdda2('0x1a')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x1a')]));require(_0xdda2('0x1d'))[_0xdda2('0x1e')](socket);function respondWithStatusCode(_0x4df902,_0x79c6d4){_0x79c6d4=_0x79c6d4||0xcc;return function(_0x4b0220){if(_0x4b0220){return _0x4df902[_0xdda2('0x1f')](_0x79c6d4);}return _0x4df902[_0xdda2('0x20')](_0x79c6d4)[_0xdda2('0x21')]();};}function respondWithResult(_0x457764,_0x1922b1){_0x1922b1=_0x1922b1||0xc8;return function(_0x5d8a83){if(_0x5d8a83){return _0x457764['status'](_0x1922b1)[_0xdda2('0x22')](_0x5d8a83);}};}function respondWithFilteredResult(_0x518c6d,_0x1a5192){return function(_0x1a3b35){if(_0x1a3b35){var _0x335fb5=typeof _0x1a5192[_0xdda2('0x23')]===_0xdda2('0x24')&&typeof _0x1a5192[_0xdda2('0x25')]===_0xdda2('0x24');var _0x351151=_0x1a3b35[_0xdda2('0x26')];var _0x337b0b=_0x335fb5?0x0:_0x1a5192[_0xdda2('0x23')];var _0x6fdede=_0x335fb5?_0x1a3b35['count']:_0x1a5192[_0xdda2('0x23')]+_0x1a5192['limit'];var _0xc4567c;if(_0x6fdede>=_0x351151){_0x6fdede=_0x351151;_0xc4567c=0xc8;}else{_0xc4567c=0xce;}_0x518c6d[_0xdda2('0x20')](_0xc4567c);return _0x518c6d[_0xdda2('0x27')]('Content-Range',_0x337b0b+'-'+_0x6fdede+'/'+_0x351151)[_0xdda2('0x22')](_0x1a3b35);}return null;};}function patchUpdates(_0x5a9bb8){return function(_0x425489){try{jsonpatch[_0xdda2('0x28')](_0x425489,_0x5a9bb8,!![]);}catch(_0x4ac3eb){return BPromise[_0xdda2('0x29')](_0x4ac3eb);}return _0x425489[_0xdda2('0x2a')]();};}function saveUpdates(_0x2528d7,_0x13b0f3){return function(_0x45ee9d){if(_0x45ee9d){return _0x45ee9d['update'](_0x2528d7)[_0xdda2('0x2b')](function(_0x4be5ea){return _0x4be5ea;});}return null;};}function removeEntity(_0x2391a5,_0x31d48b){return function(_0x5436d1){if(_0x5436d1){return _0x5436d1['destroy']()[_0xdda2('0x2b')](function(){var _0x4567e7=_0x5436d1[_0xdda2('0x2c')]({'plain':!![]});var _0x5e9e74=_0xdda2('0x2d');return db[_0xdda2('0x2e')][_0xdda2('0x2f')]({'where':{'type':_0x5e9e74,'resourceId':_0x4567e7['id']}})[_0xdda2('0x2b')](function(){return _0x5436d1;});})[_0xdda2('0x2b')](function(){_0x2391a5[_0xdda2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c37d,_0x255bbc){return function(_0x53acb5){if(!_0x53acb5){_0x24c37d[_0xdda2('0x1f')](0x194);}return _0x53acb5;};}function handleError(_0x2cfaca,_0x3b18b8){_0x3b18b8=_0x3b18b8||0x1f4;return function(_0x15e511){logger['error'](_0x15e511[_0xdda2('0x30')]);if(_0x15e511[_0xdda2('0x31')]){delete _0x15e511['name'];}_0x2cfaca[_0xdda2('0x20')](_0x3b18b8)['send'](_0x15e511);};}exports[_0xdda2('0x32')]=function(_0x55809a,_0x53ff76){var _0x510b7b={},_0x239c25={},_0x5bfc17={'count':0x0,'rows':[]};var _0x1b13f4=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4637c1){return{'name':_0x4637c1[_0xdda2('0x33')],'type':_0x4637c1[_0xdda2('0x34')][_0xdda2('0x35')]};});_0x239c25[_0xdda2('0x36')]=_[_0xdda2('0x37')](_0x1b13f4,_0xdda2('0x31'));_0x239c25[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x55809a[_0xdda2('0x38')]);_0x239c25['filters']=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],_0x239c25[_0xdda2('0x38')]);_0x510b7b[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],qs[_0xdda2('0x3c')](_0x55809a['query']['fields']));_0x510b7b[_0xdda2('0x3b')]=_0x510b7b[_0xdda2('0x3b')][_0xdda2('0x3d')]?_0x510b7b['attributes']:_0x239c25['model'];if(!_0x55809a[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x510b7b[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x55809a['query'][_0xdda2('0x25')]);_0x510b7b[_0xdda2('0x23')]=qs['offset'](_0x55809a['query'][_0xdda2('0x23')]);}_0x510b7b[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x55809a[_0xdda2('0x38')][_0xdda2('0x41')]);_0x510b7b['where']=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x55809a[_0xdda2('0x38')],_0x239c25[_0xdda2('0x42')]),_0x1b13f4);if(_0x55809a['query']['filter']){_0x510b7b[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x510b7b[_0xdda2('0x44')],{'$or':_['map'](_0x1b13f4,function(_0x1bb2a7){if(_0x1bb2a7['type']!==_0xdda2('0x46')){var _0x4c68d7={};_0x4c68d7[_0x1bb2a7[_0xdda2('0x31')]]={'$like':'%'+_0x55809a[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4c68d7;}})});}_0x510b7b=_[_0xdda2('0x45')]({},_0x510b7b,_0x55809a['options']);var _0x1c5195={'where':_0x510b7b['where']};return db[_0xdda2('0x48')]['count'](_0x1c5195)[_0xdda2('0x2b')](function(_0x12589b){_0x5bfc17[_0xdda2('0x26')]=_0x12589b;if(_0x55809a[_0xdda2('0x38')][_0xdda2('0x49')]){_0x510b7b['include']=[{'all':!![]}];}return db[_0xdda2('0x48')][_0xdda2('0x4a')](_0x510b7b);})['then'](function(_0x2caced){_0x5bfc17['rows']=_0x2caced;return _0x5bfc17;})[_0xdda2('0x2b')](respondWithFilteredResult(_0x53ff76,_0x510b7b))[_0xdda2('0x4b')](handleError(_0x53ff76,null));};exports[_0xdda2('0x4c')]=function(_0x355b6a,_0x3f1f9b){var _0x6718ea={'raw':![],'where':{'id':_0x355b6a[_0xdda2('0x4d')]['id']}},_0x550351={};_0x550351[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x48')][_0xdda2('0x4e')]);_0x550351[_0xdda2('0x38')]=_['keys'](_0x355b6a['query']);_0x550351['filters']=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],_0x550351['query']);_0x6718ea[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],qs['fields'](_0x355b6a[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x6718ea['attributes']=_0x6718ea['attributes'][_0xdda2('0x3d')]?_0x6718ea['attributes']:_0x550351[_0xdda2('0x36')];if(_0x355b6a['query'][_0xdda2('0x49')]){_0x6718ea[_0xdda2('0x4f')]=[{'all':!![]}];}_0x6718ea=_['merge']({},_0x6718ea,_0x355b6a['options']);return db[_0xdda2('0x48')][_0xdda2('0x50')](_0x6718ea)[_0xdda2('0x2b')](handleEntityNotFound(_0x3f1f9b,null))[_0xdda2('0x2b')](respondWithResult(_0x3f1f9b,null))['catch'](handleError(_0x3f1f9b,null));};exports[_0xdda2('0x2f')]=function(_0x3bba94,_0x3d2cb0){return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x3bba94['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x3d2cb0,null))[_0xdda2('0x2b')](removeEntity(_0x3d2cb0,null))['catch'](handleError(_0x3d2cb0,null));};exports[_0xdda2('0x51')]=function(_0x123c2d,_0x143670){return db[_0xdda2('0x48')][_0xdda2('0x51')]()[_0xdda2('0x2b')](respondWithResult(_0x143670,null))['catch'](handleError(_0x143670,null));};exports[_0xdda2('0x52')]=function(_0x4a9814,_0x361038){var _0x4a70ff;return db[_0xdda2('0x53')]['transaction'](function(_0x3b5bbf){return db[_0xdda2('0x48')][_0xdda2('0x52')](_0x4a9814[_0xdda2('0x54')],{'transaction':_0x3b5bbf})[_0xdda2('0x2b')](function(_0x2b45f3){_0x4a70ff=_0x2b45f3[_0xdda2('0x2c')]({'plain':!![]});return db[_0xdda2('0x55')]['find']({'where':{'id':_0x4a70ff[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x1b24f2){return createVoicePrefixExtensions(_0x4a70ff,_0x1b24f2,_0x3b5bbf);});});})['then'](function(){var _0xf380b0=_0x4a9814[_0xdda2('0x57')]['get']({'plain':!![]});if(!_0xf380b0)throw new Error(_0xdda2('0x58'));if(_0xf380b0['role']===_0xdda2('0x57')){var _0x10fbac=_0x4a70ff;return db[_0xdda2('0x59')][_0xdda2('0x50')]({'where':{'name':_0xdda2('0x2d'),'userProfileId':_0xf380b0['userProfileId']},'raw':!![]})['then'](function(_0x5c2cb2){if(_0x5c2cb2&&_0x5c2cb2[_0xdda2('0x5a')]===0x0){return db[_0xdda2('0x2e')]['create']({'name':_0x10fbac[_0xdda2('0x31')],'resourceId':_0x10fbac['id'],'type':_0x5c2cb2[_0xdda2('0x31')],'sectionId':_0x5c2cb2['id']},{})[_0xdda2('0x2b')](function(){return _0x4a70ff;});}else{return _0x4a70ff;}})['catch'](function(_0x3fd76c){logger[_0xdda2('0x5b')](_0xdda2('0x5c'),_0x3fd76c);throw _0x3fd76c;});}return _0x4a70ff;})['then'](respondWithResult(_0x361038,null))[_0xdda2('0x4b')](handleError(_0x361038,null));};function Extension(_0x4495e5,_0x7eb83f,_0x25c9a9,_0x5d8602){this[_0xdda2('0x5d')]='from-sip';this['exten']=_0x4495e5;this['app']=_0x25c9a9;this[_0xdda2('0x34')]=_0xdda2('0x5e');this[_0xdda2('0x5f')]=_0xdda2('0x60');this[_0xdda2('0x61')]=_0x7eb83f;this[_0xdda2('0x62')]=_0x5d8602;}function createVoicePrefixExtensions(_0x29a739,_0x3ac33a,_0x269ad1){return new BPromise(function(_0x138c2f,_0x26e7de){var _0x5e6dcf=new Extension(formatPrefixName(_0x29a739[_0xdda2('0x63')]),0x1,_0xdda2('0x64'),_0xdda2('0x65'));_0x5e6dcf[_0xdda2('0x66')]=_0x29a739['id'];return db[_0xdda2('0x55')][_0xdda2('0x52')](_0x5e6dcf,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x57fb41){var _0x23518f=_0x57fb41[_0xdda2('0x2c')]({'plain':!![]});var _0x19e650=_[_0xdda2('0x37')](addVoicePrefixExtensions(_0x29a739,_0x3ac33a),function(_0x44f619){_0x44f619['VoiceExtensionId']=_0x23518f['id'];_0x44f619[_0xdda2('0x66')]=_0x29a739['id'];return _0x44f619;});return db[_0xdda2('0x55')][_0xdda2('0x67')](_0x19e650,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x21d0e4){if(!_0x21d0e4){return _0x26e7de('Extensions\x20creation\x20failed');}else{return _0x138c2f(_0x21d0e4);}})[_0xdda2('0x4b')](function(_0x18d251){return _0x26e7de(_0x18d251);});});;});};function addVoicePrefixExtensions(_0x3d49e8,_0x4530b7){var _0x1ac15a=[];var _0x5d34d7=formatPrefixName(_0x3d49e8[_0xdda2('0x63')]);_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x2,_0xdda2('0x69'),'CDR(prefix)='+_0x3d49e8[_0xdda2('0x31')]));if(_0x3d49e8['callerIdAll']){_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x69'),_0xdda2('0x6a')+_0x3d49e8['callerIdAll']));}else{_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x64'),'No\x20callerid\x20available'));}_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x4,'goto',_0x4530b7[_0xdda2('0x5d')]+','+_0xdda2('0x6b')+(0x8+_0x3d49e8[_0xdda2('0x31')][_0xdda2('0x3d')])+'}'+','+0x1));return _0x1ac15a;}function formatPrefixName(_0x10d1de){var _0x4a061a='_';for(var _0x586ca1=0x0;_0x586ca1<_0x10d1de[_0xdda2('0x3d')];_0x586ca1++){if(_0x10d1de[_0xdda2('0x6c')](_0x586ca1)=='-'){_0x4a061a+=_0x10d1de['charAt'](_0x586ca1);}else{_0x4a061a+='['+_0x10d1de['charAt'](_0x586ca1)+']';}}_0x4a061a+='.';return _0x4a061a;}exports[_0xdda2('0x6d')]=function(_0x501336,_0x12a052,_0x1a33ba){var _0x4910a6=_0x501336[_0xdda2('0x54')];_0x4910a6[_0xdda2('0x63')]=_0xdda2('0x6e')+_0x4910a6[_0xdda2('0x31')]+'-';return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x4eebb0){return db[_0xdda2('0x48')][_0xdda2('0x6d')](_0x4910a6,{'where':{'id':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension'][_0xdda2('0x2f')]({'where':{'VoicePrefixId':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x4910a6[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x2f03b9){return createVoicePrefixExtensions(_0x4910a6,_0x2f03b9,_0x4eebb0);});});});})['then'](function(){return db['VoicePrefix'][_0xdda2('0x70')](_0x4910a6['id']);})['then'](respondWithResult(_0x12a052,null))[_0xdda2('0x4b')](handleError(_0x12a052,null));};exports[_0xdda2('0x71')]=function(_0x19d92e,_0x12fd67,_0x597b09){return db[_0xdda2('0x48')]['find']({'where':{'id':_0x19d92e['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x12fd67,null))['then'](function(_0x2de01c){if(_0x2de01c){return _0x2de01c[_0xdda2('0x71')](_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')],_[_0xdda2('0x73')](_0x19d92e[_0xdda2('0x54')],[_0xdda2('0x72'),'id'])||{})[_0xdda2('0x74')](function(_0x37c547){for(var _0x495a28=0x0;_0x495a28<_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x495a28+=0x1){socket[_0xdda2('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0x495a28]),'VoicePrefixId':Number(_0x19d92e[_0xdda2('0x4d')]['id'])});}return _0x37c547;});}})[_0xdda2('0x2b')](respondWithResult(_0x12fd67,null))['catch'](handleError(_0x12fd67,null));};exports['removeAgents']=function(_0xe4110b,_0xdef266,_0x423e1f){return db[_0xdda2('0x48')]['find']({'where':{'id':_0xe4110b[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0xdef266,null))[_0xdda2('0x2b')](function(_0x152ba3){if(_0x152ba3){return _0x152ba3[_0xdda2('0x76')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])[_0xdda2('0x2b')](function(){if(_[_0xdda2('0x77')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])){for(var _0x23a80a=0x0;_0x23a80a<_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x23a80a+=0x1){socket['emit'](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')]['ids'][_0x23a80a]),'VoicePrefixId':Number(_0xe4110b['params']['id'])});}}else{socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')]),'VoicePrefixId':Number(_0xe4110b[_0xdda2('0x4d')]['id'])});}});}})[_0xdda2('0x2b')](respondWithStatusCode(_0xdef266,null))['catch'](handleError(_0xdef266,null));};exports[_0xdda2('0x79')]=function(_0x1f3abe,_0x447bd2,_0x2bb4f3){var _0x563be8={};var _0xbf1248={};var _0x5c3d67;var _0x20ebf7;return db[_0xdda2('0x48')]['findOne']({'where':{'id':_0x1f3abe[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x447bd2,null))[_0xdda2('0x2b')](function(_0x1dfe6d){if(_0x1dfe6d){_0x5c3d67=_0x1dfe6d;_0xbf1248[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x7a')][_0xdda2('0x4e')]);_0xbf1248[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x1f3abe[_0xdda2('0x38')]);_0xbf1248['filters']=_[_0xdda2('0x3a')](_0xbf1248[_0xdda2('0x36')],_0xbf1248[_0xdda2('0x38')]);_0x563be8[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xbf1248['model'],qs[_0xdda2('0x3c')](_0x1f3abe[_0xdda2('0x38')]['fields']));_0x563be8[_0xdda2('0x3b')]=_0x563be8[_0xdda2('0x3b')]['length']?_0x563be8['attributes']:_0xbf1248[_0xdda2('0x36')];_0x563be8[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x41')]);_0x563be8[_0xdda2('0x44')]=qs['filters'](_[_0xdda2('0x43')](_0x1f3abe[_0xdda2('0x38')],_0xbf1248['filters']));if(_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]){_0x563be8['where']=_[_0xdda2('0x45')](_0x563be8[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x563be8['attributes'],function(_0xe6f37b){var _0x4a34ee={};_0x4a34ee[_0xe6f37b]={'$like':'%'+_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4a34ee;})});}_0x563be8=_[_0xdda2('0x45')]({},_0x563be8,_0x1f3abe[_0xdda2('0x7b')]);return _0x5c3d67['getAgents'](_0x563be8);}})['then'](function(_0x2b8c0c){if(_0x2b8c0c){_0x20ebf7=_0x2b8c0c[_0xdda2('0x3d')];if(!_0x1f3abe['query'][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x563be8[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x25')]);_0x563be8[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x23')]);}return _0x5c3d67[_0xdda2('0x79')](_0x563be8);}})[_0xdda2('0x2b')](function(_0x528185){if(_0x528185){return _0x528185?{'count':_0x20ebf7,'rows':_0x528185}:null;}})['then'](respondWithResult(_0x447bd2,null))['catch'](handleError(_0x447bd2,null));};exports[_0xdda2('0x7c')]=function(_0x4edf20,_0x2910b0,_0x323af8){var _0x2f18a0={};var _0xe797aa={};var _0x558ab6;var _0x374fc4;return db[_0xdda2('0x48')][_0xdda2('0x7d')]({'where':{'id':_0x4edf20['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x2910b0,null))[_0xdda2('0x2b')](function(_0x2588f5){if(_0x2588f5){_0x558ab6=_0x2588f5;_0xe797aa['model']=_['keys'](db[_0xdda2('0x7e')][_0xdda2('0x4e')]);_0xe797aa[_0xdda2('0x38')]=_['keys'](_0x4edf20[_0xdda2('0x38')]);_0xe797aa[_0xdda2('0x42')]=_[_0xdda2('0x3a')](_0xe797aa[_0xdda2('0x36')],_0xe797aa[_0xdda2('0x38')]);_0x2f18a0[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xe797aa['model'],qs[_0xdda2('0x3c')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x2f18a0[_0xdda2('0x3b')]=_0x2f18a0['attributes'][_0xdda2('0x3d')]?_0x2f18a0[_0xdda2('0x3b')]:_0xe797aa[_0xdda2('0x36')];_0x2f18a0[_0xdda2('0x40')]=qs['sort'](_0x4edf20['query']['sort']);_0x2f18a0[_0xdda2('0x44')]=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x4edf20[_0xdda2('0x38')],_0xe797aa[_0xdda2('0x42')]));if(_0x4edf20[_0xdda2('0x38')]['filter']){_0x2f18a0[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x2f18a0[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x2f18a0[_0xdda2('0x3b')],function(_0x39ee74){var _0xcbf57f={};_0xcbf57f[_0x39ee74]={'$like':'%'+_0x4edf20[_0xdda2('0x38')]['filter']+'%'};return _0xcbf57f;})});}_0x2f18a0=_[_0xdda2('0x45')]({},_0x2f18a0,_0x4edf20['options']);return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x15066f){if(_0x15066f){_0x374fc4=_0x15066f['length'];if(!_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x2f18a0[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x25')]);_0x2f18a0[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x4edf20['query'][_0xdda2('0x23')]);}return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x42db44){if(_0x42db44){return _0x42db44?{'count':_0x374fc4,'rows':_0x42db44}:null;}})[_0xdda2('0x2b')](respondWithResult(_0x2910b0,null))[_0xdda2('0x4b')](handleError(_0x2910b0,null));};exports['addTeams']=function(_0x1702ae,_0x21ade3,_0x251408){var _0x311e34=_0x1702ae[_0xdda2('0x54')][_0xdda2('0x72')];var _0x4124a5;return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x311e34},'attributes':['id'],'include':[{'model':db[_0xdda2('0x7a')],'as':'Agents','attributes':['id',_0xdda2('0x31'),_0xdda2('0x7f'),_0xdda2('0x80'),_0xdda2('0x81')],'raw':!![]}]})[_0xdda2('0x2b')](function(_0x4c540d){if(_0x4c540d){_0x4124a5=_0x4c540d;var _0x320cf1=_[_0xdda2('0x82')](_0x4c540d,function(_0xdd343d){var _0x56cd13=_0xdd343d[_0xdda2('0x2c')]({'plain':!![]});return _0x56cd13[_0xdda2('0x83')];});return db[_0xdda2('0x48')]['find']({'where':{'id':_0x1702ae[_0xdda2('0x4d')]['id']}})['then'](function(_0x579fc9){return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x3752bf){return _0x579fc9[_0xdda2('0x84')](_0x311e34,{'transaction':_0x3752bf})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x4124a5,function(_0x14baa0){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x14baa0['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},{'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x320cf1,function(_0x16b910){return db[_0xdda2('0x86')]['findOrCreate']({'where':{'UserId':_0x16b910['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){_0x320cf1[_0xdda2('0x87')](function(_0x233494){socket[_0xdda2('0x75')](_0xdda2('0x88'),{'UserId':_0x233494['id'],'VoicePrefixId':_0x579fc9['id']});});});});});}})[_0xdda2('0x2b')](respondWithStatusCode(_0x21ade3,null))[_0xdda2('0x4b')](handleError(_0x21ade3,null));};exports[_0xdda2('0x89')]=function(_0x44e93d,_0x2defb2,_0x53c44d){return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdda2('0x83'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2defb2,null))[_0xdda2('0x2b')](function(_0x4f2d5c){var _0x240048=_['map'](_0x4f2d5c,'id');var _0x1da0dd=[];var _0xb93d3b=[];var _0x3d59cb=squel['select']();_0x3d59cb[_0xdda2('0x8a')](_0xdda2('0x8b'))[_0xdda2('0x8c')]('team_has_voice_prefixes','tq')['join'](_0xdda2('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdda2('0x44')](_0xdda2('0x8e'),_0x44e93d[_0xdda2('0x4d')]['id']);for(var _0x182570=0x0;_0x182570<_0x4f2d5c['length'];_0x182570+=0x1){let _0x28a217=_0x4f2d5c[_0x182570];for(var _0x54cd55=0x0;_0x54cd55<_0x28a217['Agents']['length'];_0x54cd55+=0x1){let _0x5235d5=_0x28a217[_0xdda2('0x83')][_0x54cd55];var _0x4a6058=_0x3d59cb[_0xdda2('0x8f')]();_0x4a6058[_0xdda2('0x44')]('ut.UserId\x20=\x20?',_0x5235d5['id']);_0xb93d3b['push'](db[_0xdda2('0x53')][_0xdda2('0x38')](_0x4a6058[_0xdda2('0x90')](),{'type':db[_0xdda2('0x53')]['QueryTypes']['SELECT']})[_0xdda2('0x2b')](function(_0x19c1eb){if(_0x19c1eb[_0xdda2('0x3d')]===0x1){return _0x5235d5['id'];}else{var _0x22e01a=_['every'](_[_0xdda2('0x37')](_0x19c1eb,_0xdda2('0x91')),function(_0x3867b3){return _[_0xdda2('0x92')](_0x240048,_0x3867b3);});if(_0x22e01a){return _0x5235d5['id'];}}}));}}return BPromise[_0xdda2('0x93')](_0xb93d3b)[_0xdda2('0x2b')](function(_0xa798dc){_0x1da0dd=_(_0x1da0dd)[_0xdda2('0x94')](_0xa798dc)[_0xdda2('0x95')]()[_0xdda2('0x96')]();return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x44e93d[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](function(_0x3cb988){return db[_0xdda2('0x53')]['transaction'](function(_0xe54b68){return _0x3cb988[_0xdda2('0x89')](_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')],{'transaction':_0xe54b68})[_0xdda2('0x2b')](function(){if(!_[_0xdda2('0x97')](_0x1da0dd)){return _0x3cb988[_0xdda2('0x76')](_0x1da0dd,{'transaction':_0xe54b68});}})[_0xdda2('0x2b')](function(){_0x1da0dd[_0xdda2('0x87')](function(_0x1c008c){socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':_0x1c008c,'VoicePrefixId':_0x3cb988['id']});});});});});});})[_0xdda2('0x2b')](respondWithStatusCode(_0x2defb2,null))[_0xdda2('0x4b')](handleError(_0x2defb2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f575078..1b291c7 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 _0x5b47=['hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit'];(function(_0x5905d3,_0xf3d13){var _0x236b29=function(_0x496ae3){while(--_0x496ae3){_0x5905d3['push'](_0x5905d3['shift']());}};_0x236b29(++_0xf3d13);}(_0x5b47,0x1a0));var _0x75b4=function(_0x44a678,_0x515562){_0x44a678=_0x44a678-0x0;var _0x41fe2a=_0x5b47[_0x44a678];return _0x41fe2a;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var VoicePrefix=require(_0x75b4('0x1'))['db'][_0x75b4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x75b4('0x3')](0x0);var events={'afterCreate':_0x75b4('0x4'),'afterUpdate':'update','afterDestroy':_0x75b4('0x5')};function emitEvent(_0x3bbd0d){return function(_0x10831c,_0x2a9a53,_0x1685d0){VoicePrefixEvents[_0x75b4('0x6')](_0x3bbd0d+':'+_0x10831c['id'],_0x10831c);VoicePrefixEvents['emit'](_0x3bbd0d,_0x10831c);_0x1685d0(null);};}for(var e in events){if(events[_0x75b4('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x75b4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xfa27=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa27,0x17a));var _0x7fa2=function(_0x3ede90,_0xbb015f){_0x3ede90=_0x3ede90-0x0;var _0x3a34ef=_0xfa27[_0x3ede90];return _0x3a34ef;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x7fa2('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7fa2('0x1')](0x0);var events={'afterCreate':_0x7fa2('0x2'),'afterUpdate':_0x7fa2('0x3'),'afterDestroy':_0x7fa2('0x4')};function emitEvent(_0x31fa33){return function(_0x1a3f64,_0x4d60db,_0xeb5a3c){VoicePrefixEvents[_0x7fa2('0x5')](_0x31fa33+':'+_0x1a3f64['id'],_0x1a3f64);VoicePrefixEvents['emit'](_0x31fa33,_0x1a3f64);_0xeb5a3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7fa2('0x6')](e,emitEvent(event));}}module[_0x7fa2('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a7d3312..d589e59 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 _0x7ba9=['voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x5831c1,_0xdd9935){var _0x3d0e97=function(_0x39ddb7){while(--_0x39ddb7){_0x5831c1['push'](_0x5831c1['shift']());}};_0x3d0e97(++_0xdd9935);}(_0x7ba9,0x15f));var _0x97ba=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x7ba9[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x97ba('0x0'));var util=require('util');var logger=require(_0x97ba('0x1'))(_0x97ba('0x2'));var moment=require(_0x97ba('0x3'));var BPromise=require(_0x97ba('0x4'));var rp=require(_0x97ba('0x5'));var fs=require('fs');var path=require(_0x97ba('0x6'));var rimraf=require(_0x97ba('0x7'));var config=require(_0x97ba('0x8'));var attributes=require(_0x97ba('0x9'));module[_0x97ba('0xa')]=function(_0x2d7a71,_0x7b0596){return _0x2d7a71[_0x97ba('0xb')](_0x97ba('0xc'),attributes,{'tableName':_0x97ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c5c=['path','rimraf','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x7c5c,0x1c0));var _0xc7c5=function(_0x4cdb37,_0x2aa998){_0x4cdb37=_0x4cdb37-0x0;var _0x5ef6d6=_0x7c5c[_0x4cdb37];return _0x5ef6d6;};'use strict';var _=require(_0xc7c5('0x0'));var util=require(_0xc7c5('0x1'));var logger=require(_0xc7c5('0x2'))(_0xc7c5('0x3'));var moment=require(_0xc7c5('0x4'));var BPromise=require(_0xc7c5('0x5'));var rp=require(_0xc7c5('0x6'));var fs=require('fs');var path=require(_0xc7c5('0x7'));var rimraf=require(_0xc7c5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc7c5('0x9'));module[_0xc7c5('0xa')]=function(_0x52ec25,_0x3a3319){return _0x52ec25[_0xc7c5('0xb')]('VoicePrefix',attributes,{'tableName':_0xc7c5('0xc'),'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 bf6ce14..66c95b5 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 _0xd47f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd47f,0x1bd));var _0xfd47=function(_0x26d741,_0x18409b){_0x26d741=_0x26d741-0x0;var _0x564540=_0xd47f[_0x26d741];return _0x564540;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var moment=require(_0xfd47('0x1'));var BPromise=require(_0xfd47('0x2'));var rs=require(_0xfd47('0x3'));var fs=require('fs');var Redis=require(_0xfd47('0x4'));var db=require(_0xfd47('0x5'))['db'];var utils=require(_0xfd47('0x6'));var logger=require(_0xfd47('0x7'))(_0xfd47('0x8'));var config=require(_0xfd47('0x9'));var jayson=require(_0xfd47('0xa'));var client=jayson[_0xfd47('0xb')][_0xfd47('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfd47('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd47('0xe'))[_0xfd47('0xf')](socket);function respondWithRpcPromise(_0x180808,_0x2bd687,_0x3a174a){return new BPromise(function(_0x2cb7c2,_0x5a6644){return client['request'](_0x180808,_0x3a174a)[_0xfd47('0x10')](function(_0x5e5ad4){logger['info'](_0xfd47('0x11'),_0x2bd687,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2bd687,_0xfd47('0x12'),JSON['stringify'](_0x5e5ad4));if(_0x5e5ad4[_0xfd47('0x13')]){if(_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x14')]===0x1f4){logger['error'](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x15')]);return _0x5a6644(_0x5e5ad4[_0xfd47('0x13')]['message']);}logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')]['message']);return _0x2cb7c2(_0x5e5ad4['error'][_0xfd47('0x15')]);}else{logger[_0xfd47('0x16')](_0xfd47('0x11'),_0x2bd687,_0xfd47('0x12'));_0x2cb7c2(_0x5e5ad4[_0xfd47('0x17')]['message']);}})[_0xfd47('0x18')](function(_0x471472){logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x471472);_0x5a6644(_0x471472);});});} \ No newline at end of file +var _0x307e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x19f75d,_0x2a743a){var _0x4a3311=function(_0x120a12){while(--_0x120a12){_0x19f75d['push'](_0x19f75d['shift']());}};_0x4a3311(++_0x2a743a);}(_0x307e,0xc9));var _0xe307=function(_0x12b24a,_0x4cb0ba){_0x12b24a=_0x12b24a-0x0;var _0x3e7205=_0x307e[_0x12b24a];return _0x3e7205;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rs=require(_0xe307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require('../../config/logger')(_0xe307('0x7'));var config=require('../../config/environment');var jayson=require(_0xe307('0x8'));var client=jayson[_0xe307('0x9')][_0xe307('0xa')]({'port':0x232a});config['redis']=_[_0xe307('0xb')](config[_0xe307('0xc')],{'host':_0xe307('0xd'),'port':0x18eb});var socket=require(_0xe307('0xe'))(new Redis(config[_0xe307('0xc')]));require(_0xe307('0xf'))[_0xe307('0x10')](socket);function respondWithRpcPromise(_0x3ab559,_0x231b98,_0x393a82){return new BPromise(function(_0x217f0a,_0x4219b1){return client[_0xe307('0x11')](_0x3ab559,_0x393a82)[_0xe307('0x12')](function(_0xc521b8){logger[_0xe307('0x13')](_0xe307('0x14'),_0x231b98,_0xe307('0x15'));logger[_0xe307('0x16')](_0xe307('0x17'),_0x231b98,'request\x20sent',JSON[_0xe307('0x18')](_0xc521b8));if(_0xc521b8[_0xe307('0x19')]){if(_0xc521b8['error'][_0xe307('0x1a')]===0x1f4){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x4219b1(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}logger['error'](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x217f0a(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x231b98,_0xe307('0x15'));_0x217f0a(_0xc521b8['result'][_0xe307('0x1b')]);}})[_0xe307('0x1c')](function(_0xe8354d){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xe8354d);_0x4219b1(_0xe8354d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7ba8551..b753a7b 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 _0xd816=['update','emit','removeListener','./voicePrefix.events','save'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd816,0xd5));var _0x6d81=function(_0x22fad0,_0x5857fb){_0x22fad0=_0x22fad0-0x0;var _0x90db33=_0xd816[_0x22fad0];return _0x90db33;};'use strict';var VoicePrefixEvents=require(_0x6d81('0x0'));var events=[_0x6d81('0x1'),'remove',_0x6d81('0x2')];function createListener(_0x538e21,_0x540f68){return function(_0x5d99e4){_0x540f68[_0x6d81('0x3')](_0x538e21,_0x5d99e4);};}function removeListener(_0x39a52f,_0x3511a2){return function(){VoicePrefixEvents[_0x6d81('0x4')](_0x39a52f,_0x3511a2);};}exports['register']=function(_0x6c01ef){for(var _0x4ba95f=0x0,_0x10f1a7=events['length'];_0x4ba95f<_0x10f1a7;_0x4ba95f++){var _0x96d1ac=events[_0x4ba95f];var _0x15d634=createListener('voicePrefix:'+_0x96d1ac,_0x6c01ef);VoicePrefixEvents['on'](_0x96d1ac,_0x15d634);}}; \ No newline at end of file +var _0xa788=['./voicePrefix.events','save','remove','update'];(function(_0x517f81,_0x46b4cc){var _0x4e3691=function(_0x29a182){while(--_0x29a182){_0x517f81['push'](_0x517f81['shift']());}};_0x4e3691(++_0x46b4cc);}(_0xa788,0x70));var _0x8a78=function(_0x515302,_0x3f5dd9){_0x515302=_0x515302-0x0;var _0x3dd08c=_0xa788[_0x515302];return _0x3dd08c;};'use strict';var VoicePrefixEvents=require(_0x8a78('0x0'));var events=[_0x8a78('0x1'),_0x8a78('0x2'),_0x8a78('0x3')];function createListener(_0x4c4a34,_0x3a648f){return function(_0x83f5a6){_0x3a648f['emit'](_0x4c4a34,_0x83f5a6);};}function removeListener(_0x627de3,_0x12ce72){return function(){VoicePrefixEvents['removeListener'](_0x627de3,_0x12ce72);};}exports['register']=function(_0x506edf){for(var _0x316a62=0x0,_0x344c6d=events['length'];_0x316a62<_0x344c6d;_0x316a62++){var _0x4def98=events[_0x316a62];var _0x22ebca=createListener('voicePrefix:'+_0x4def98,_0x506edf);VoicePrefixEvents['on'](_0x4def98,_0x22ebca);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e3426d9..db4c776 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(_0x578835,_0x4e291d){var _0x4a627f=function(_0xaf7a1c){while(--_0xaf7a1c){_0x578835['push'](_0x578835['shift']());}};_0x4a627f(++_0x4e291d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x12522c,_0x111384){var _0x11c87e=function(_0x373a50){while(--_0x373a50){_0x12522c['push'](_0x12522c['shift']());}};_0x11c87e(++_0x111384);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 792f810..c0b6209 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 _0x83f6=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','preview','includes','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power'];(function(_0x4adf06,_0x23beb5){var _0x42d1eb=function(_0x371bb6){while(--_0x371bb6){_0x4adf06['push'](_0x4adf06['shift']());}};_0x42d1eb(++_0x23beb5);}(_0x83f6,0x1e2));var _0x683f=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x83f6[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require(_0x683f('0x0'));module[_0x683f('0x1')]={'name':{'type':Sequelize[_0x683f('0x2')],'allowNull':![],'unique':_0x683f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x5'),_0x683f('0x6')),'allowNull':![],'defaultValue':_0x683f('0x5')},'musiconhold':{'type':Sequelize[_0x683f('0x2')],'defaultValue':_0x683f('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x683f('0x4')]('rr',_0x683f('0x8'),_0x683f('0x9'),_0x683f('0xa'),_0x683f('0xb'),_0x683f('0xc'),_0x683f('0xd'),_0x683f('0xe'),_0x683f('0xf')),'allowNull':![],'defaultValue':_0x683f('0x8'),'set':function(_0x5ff16d){this[_0x683f('0x10')]('strategy',_0x5ff16d?_0x5ff16d:_0x683f('0xc'));},'get':function(){var _0x506f1e=this[_0x683f('0x11')]('type');var _0x4bcd22=this[_0x683f('0x11')](_0x683f('0x12'));var _0x31044d=this[_0x683f('0x11')](_0x683f('0x13'));if(_0x506f1e===_0x683f('0x6')){if(_0x4bcd22===_0x683f('0x14')){return null;}if(_0x4bcd22==='booked'&&![_0x683f('0xc'),'roundrobin'][_0x683f('0x15')](_0x31044d)){this[_0x683f('0x10')]('strategy',_0x683f('0xc'));}}return _0x31044d;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x683f('0x16')](0xb)},'timeout':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x683f('0x2')]},'weight':{'type':Sequelize[_0x683f('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':_0x683f('0x17')},'autopause':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no',_0x683f('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x683f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':_0x683f('0x17')},'announce_holdtime':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x683f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x683f('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x683f('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x683f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x683f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x683f('0x2')]},'queue_youarenext':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x683f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x683f('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x683f('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x683f('0x2')]},'queue_less_than':{'type':Sequelize[_0x683f('0x2')]},'periodic_announce':{'type':Sequelize[_0x683f('0x19')],'set':function(_0xf8ca8){this[_0x683f('0x10')](_0x683f('0x1a'),_0xf8ca8?_0xf8ca8[_0x683f('0x1b')](','):[]);},'get':function(){return this[_0x683f('0x11')](_0x683f('0x1a'))?this[_0x683f('0x11')](_0x683f('0x1a'))[_0x683f('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x683f('0x17'),'set':function(_0x2b67d1){this[_0x683f('0x10')](_0x683f('0x1d'),_0x2b67d1?_0x2b67d1[_0x683f('0x1b')](','):undefined);},'get':function(){return this[_0x683f('0x11')](_0x683f('0x1d'))?this[_0x683f('0x11')](_0x683f('0x1d'))[_0x683f('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x683f('0x2')],'defaultValue':'no','set':function(_0xc26bbf){this[_0x683f('0x10')](_0x683f('0x1e'),_0xc26bbf?_0xc26bbf[_0x683f('0x1b')](','):undefined);},'get':function(){return this[_0x683f('0x11')]('leavewhenempty')?this[_0x683f('0x11')](_0x683f('0x1e'))[_0x683f('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x683f('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'set':function(_0x1edbc6){this[_0x683f('0x10')]('acw',_0x1edbc6);if(_0x1edbc6){if(this[_0x683f('0x11')](_0x683f('0x20'))<0x2){this[_0x683f('0x10')](_0x683f('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'comment':_0x683f('0x21')},'dialMethod':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x14'),_0x683f('0x22'),_0x683f('0x23'),'predictive','booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x683f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x683f('0x24')},'dialLimitQueue':{'type':Sequelize[_0x683f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x683f('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x683f('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x683f('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x683f('0x4')]('agentBusyFactor','dropRate'),'defaultValue':_0x683f('0x28'),'comment':_0x683f('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x683f('0x2a')](0x2)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x683f('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x683f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x683f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x683f('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x683f('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x683f('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x683f('0x31')},'dialTimezone':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x683f('0x2')],'defaultValue':_0x683f('0x32')},'dialPrefix':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x33'),_0x683f('0x34'),_0x683f('0x35')),'defaultValue':_0x683f('0x33')},'dialAMDActive':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x683f('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x683f('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x683f('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x683f('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x683f('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x683f('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x683f('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x683f('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x3d'),_0x683f('0x3e')),'defaultValue':_0x683f('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x683f('0x2')],'comment':_0x683f('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x683f('0x3f')},'dialCutDigit':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x683f('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x683f('0x48')},'mandatoryDisposition':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4eb8e4){if(!_0x4eb8e4)this[_0x683f('0x10')](_0x683f('0x49'),null);this[_0x683f('0x10')]('mandatoryDisposition',_0x4eb8e4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x3250=['leastrecent','fewestcalls','random','rrmemory','linear','rrordered','getDataValue','type','strategy','preview','booked','INTEGER','yes','once','TEXT','periodic_announce','join','split','setDataValue','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\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,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default'];(function(_0x389af3,_0xa2d896){var _0x16c5d6=function(_0x3b935a){while(--_0x3b935a){_0x389af3['push'](_0x389af3['shift']());}};_0x16c5d6(++_0xa2d896);}(_0x3250,0xe3));var _0x0325=function(_0xee650b,_0x5749eb){_0xee650b=_0xee650b-0x0;var _0x16dd2d=_0x3250[_0xee650b];return _0x16dd2d;};'use strict';var Sequelize=require(_0x0325('0x0'));module['exports']={'name':{'type':Sequelize[_0x0325('0x1')],'allowNull':![],'unique':_0x0325('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x4'),_0x0325('0x5')),'allowNull':![],'defaultValue':_0x0325('0x4')},'musiconhold':{'type':Sequelize[_0x0325('0x1')],'defaultValue':_0x0325('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0325('0x3')]('rr','ringall',_0x0325('0x7'),_0x0325('0x8'),_0x0325('0x9'),_0x0325('0xa'),_0x0325('0xb'),'wrandom',_0x0325('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x406b18){this['setDataValue']('strategy',_0x406b18?_0x406b18:_0x0325('0xa'));},'get':function(){var _0x498f0f=this[_0x0325('0xd')](_0x0325('0xe'));var _0xe14c22=this[_0x0325('0xd')]('dialMethod');var _0x1e2397=this['getDataValue'](_0x0325('0xf'));if(_0x498f0f===_0x0325('0x5')){if(_0xe14c22===_0x0325('0x10')){return null;}if(_0xe14c22===_0x0325('0x11')&&![_0x0325('0xa'),'roundrobin']['includes'](_0x1e2397)){this['setDataValue'](_0x0325('0xf'),_0x0325('0xa'));}}return _0x1e2397;}},'servicelevel':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0325('0x12')](0xb)},'timeout':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0325('0x1')]},'weight':{'type':Sequelize[_0x0325('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0325('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0325('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no'),'defaultValue':_0x0325('0x13')},'announce_holdtime':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no',_0x0325('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0325('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x0325('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0325('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0325('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0325('0x1')]},'queue_quantity1':{'type':Sequelize[_0x0325('0x1')]},'queue_quantity2':{'type':Sequelize[_0x0325('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x0325('0x15')],'set':function(_0x2e3b5f){this['setDataValue'](_0x0325('0x16'),_0x2e3b5f?_0x2e3b5f[_0x0325('0x17')](','):[]);},'get':function(){return this[_0x0325('0xd')](_0x0325('0x16'))?this[_0x0325('0xd')](_0x0325('0x16'))[_0x0325('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x0325('0x1')],'defaultValue':_0x0325('0x13'),'set':function(_0x5196c9){this[_0x0325('0x19')](_0x0325('0x1a'),_0x5196c9?_0x5196c9[_0x0325('0x17')](','):undefined);},'get':function(){return this[_0x0325('0xd')](_0x0325('0x1a'))?this['getDataValue'](_0x0325('0x1a'))[_0x0325('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x265053){this[_0x0325('0x19')](_0x0325('0x1b'),_0x265053?_0x265053['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x0325('0xd')](_0x0325('0x1b'))[_0x0325('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0325('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':0x0,'set':function(_0x513031){this[_0x0325('0x19')](_0x0325('0x1d'),_0x513031);if(_0x513031){if(this['getDataValue']('wrapuptime')<0x2){this[_0x0325('0x19')](_0x0325('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0325('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':0x0,'comment':_0x0325('0x1f')},'dialMethod':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x10'),_0x0325('0x20'),_0x0325('0x21'),_0x0325('0x22'),_0x0325('0x11')),'defaultValue':_0x0325('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x0325('0x12')](0x4)[_0x0325('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0325('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0325('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0325('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0325('0x25'),'dropRate'),'defaultValue':_0x0325('0x26'),'comment':_0x0325('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0325('0x28')](0x2)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0325('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0325('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0325('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x0325('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0325('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x3,'comment':_0x0325('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0325('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0325('0x32')},'dialTimezone':{'type':Sequelize[_0x0325('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0325('0x1')],'defaultValue':_0x0325('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0325('0x3')]('always',_0x0325('0x34'),_0x0325('0x35')),'defaultValue':_0x0325('0x36')},'dialAMDActive':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':0x0,'comment':_0x0325('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x0325('0x12')](0x9)[_0x0325('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0325('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0325('0x12')](0x9)[_0x0325('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0325('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0325('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0325('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0325('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x0325('0x12')](0x9)[_0x0325('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0325('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0325('0x12')](0x9)[_0x0325('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0325('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0325('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0325('0x12')](0x5)[_0x0325('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0325('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0325('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0325('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0325('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':0x0,'comment':_0x0325('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0325('0x3')](_0x0325('0x41'),_0x0325('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x0325('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0325('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0325('0x44')},'dialCutDigit':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0325('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0325('0x12')](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0325('0x12')](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0325('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0325('0x12')](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0325('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0325('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0325('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':![],'comment':_0x0325('0x4c'),'set':function(_0x26cb6c){if(!_0x26cb6c)this[_0x0325('0x19')]('mandatoryDispositionPauseId',null);this[_0x0325('0x19')](_0x0325('0x4d'),_0x26cb6c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0325('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0325('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x0325('0x12')](0x3)[_0x0325('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c68b8f2..a2c6ec4 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x804fc5,_0x3e8af6){var _0x4855d8=function(_0x993918){while(--_0x993918){_0x804fc5['push'](_0x804fc5['shift']());}};_0x4855d8(++_0x3e8af6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x52a6df,_0x45b0a5){_0x52a6df=_0x52a6df-0x0;var _0x536f67=_0x8ef6[_0x52a6df];return _0x536f67;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x1cb9,0x14e));var _0x91cb=function(_0x31e400,_0x5afa15){_0x31e400=_0x31e400-0x0;var _0x53f696=_0x1cb9[_0x31e400];return _0x53f696;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1821c8b..b95eac6 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 _0x6e00=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x387ed5,_0x44e590){var _0x20a79e=function(_0x54f5e5){while(--_0x54f5e5){_0x387ed5['push'](_0x387ed5['shift']());}};_0x20a79e(++_0x44e590);}(_0x6e00,0x75));var _0x06e0=function(_0x4f74dd,_0x512666){_0x4f74dd=_0x4f74dd-0x0;var _0x251e19=_0x6e00[_0x4f74dd];return _0x251e19;};'use strict';var EventEmitter=require(_0x06e0('0x0'));var VoiceQueue=require(_0x06e0('0x1'))['db'][_0x06e0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x06e0('0x3')](0x0);var events={'afterCreate':_0x06e0('0x4'),'afterUpdate':_0x06e0('0x5'),'afterDestroy':_0x06e0('0x6')};function emitEvent(_0x20918f){return function(_0x1c9b32,_0x505b57,_0x22f920){VoiceQueueEvents[_0x06e0('0x7')](_0x20918f+':'+_0x1c9b32['id'],_0x1c9b32);VoiceQueueEvents['emit'](_0x20918f,_0x1c9b32);_0x22f920(null);};}for(var e in events){if(events[_0x06e0('0x8')](e)){var event=events[e];VoiceQueue[_0x06e0('0x9')](e,emitEvent(event));}}module[_0x06e0('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x9726=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x9726,0x16a));var _0x6972=function(_0x49db1e,_0x2c755d){_0x49db1e=_0x49db1e-0x0;var _0x2a3a1d=_0x9726[_0x49db1e];return _0x2a3a1d;};'use strict';var EventEmitter=require(_0x6972('0x0'));var VoiceQueue=require(_0x6972('0x1'))['db'][_0x6972('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6972('0x3')](0x0);var events={'afterCreate':_0x6972('0x4'),'afterUpdate':_0x6972('0x5'),'afterDestroy':_0x6972('0x6')};function emitEvent(_0x430f24){return function(_0x3e761e,_0x51b827,_0x3bcbda){VoiceQueueEvents['emit'](_0x430f24+':'+_0x3e761e['id'],_0x3e761e);VoiceQueueEvents[_0x6972('0x7')](_0x430f24,_0x3e761e);_0x3bcbda(null);};}for(var e in events){if(events[_0x6972('0x8')](e)){var event=events[e];VoiceQueue[_0x6972('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 255e3a4..7be20d9 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x58be03,_0x208cd6){var _0x514a44=function(_0x319510){while(--_0x319510){_0x58be03['push'](_0x58be03['shift']());}};_0x514a44(++_0x208cd6);}(_0xedd9,0xfc));var _0x9edd=function(_0x5489c4,_0x1e7a17){_0x5489c4=_0x5489c4-0x0;var _0x2c4624=_0xedd9[_0x5489c4];return _0x2c4624;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x4886ee,_0x5bfa69){var _0x437c3a=function(_0x3f4e6a){while(--_0x3f4e6a){_0x4886ee['push'](_0x4886ee['shift']());}};_0x437c3a(++_0x5bfa69);}(_0xedd9,0xfc));var _0x9edd=function(_0x447602,_0x1a7052){_0x447602=_0x447602-0x0;var _0x43437b=_0xedd9[_0x447602];return _0x43437b;};'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':'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 428038a..c166a26 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 _0x0fcf=['map','model','debug','GetVoiceQueue','stringify','find','raw','ShowVoiceQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','VoiceQueue','findAll','options','where','attributes','limit','include'];(function(_0x54135c,_0x57499b){var _0x4621c4=function(_0x1c242c){while(--_0x1c242c){_0x54135c['push'](_0x54135c['shift']());}};_0x4621c4(++_0x57499b);}(_0x0fcf,0x17a));var _0xf0fc=function(_0x242e67,_0x1ee0d1){_0x242e67=_0x242e67-0x0;var _0x13e618=_0x0fcf[_0x242e67];return _0x13e618;};'use strict';var _=require('lodash');var util=require(_0xf0fc('0x0'));var moment=require(_0xf0fc('0x1'));var BPromise=require(_0xf0fc('0x2'));var rs=require(_0xf0fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0fc('0x4'))['db'];var utils=require(_0xf0fc('0x5'));var logger=require('../../config/logger')(_0xf0fc('0x6'));var config=require(_0xf0fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf0fc('0x8')][_0xf0fc('0x9')]({'port':0x232a});config[_0xf0fc('0xa')]=_[_0xf0fc('0xb')](config[_0xf0fc('0xa')],{'host':_0xf0fc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4625b9,_0x2e8268,_0x37f990){return new BPromise(function(_0x20a1ad,_0x396a91){return client[_0xf0fc('0xd')](_0x4625b9,_0x37f990)[_0xf0fc('0xe')](function(_0x22c86c){logger[_0xf0fc('0xf')](_0xf0fc('0x10'),_0x2e8268,_0xf0fc('0x11'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e8268,_0xf0fc('0x11'),JSON['stringify'](_0x22c86c));if(_0x22c86c[_0xf0fc('0x12')]){if(_0x22c86c[_0xf0fc('0x12')]['code']===0x1f4){logger[_0xf0fc('0x12')](_0xf0fc('0x10'),_0x2e8268,_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);return _0x396a91(_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);}logger['error'](_0xf0fc('0x10'),_0x2e8268,_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);return _0x20a1ad(_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);}else{logger['info'](_0xf0fc('0x10'),_0x2e8268,_0xf0fc('0x11'));_0x20a1ad(_0x22c86c[_0xf0fc('0x14')][_0xf0fc('0x13')]);}})[_0xf0fc('0x15')](function(_0xf309e0){logger['error'](_0xf0fc('0x10'),_0x2e8268,_0xf309e0);_0x396a91(_0xf309e0);});});}exports['GetVoiceQueue']=function(_0x5bf434){var _0x181afe=this;return new Promise(function(_0x2f7890,_0x367b58){return db[_0xf0fc('0x16')][_0xf0fc('0x17')]({'raw':_0x5bf434['options']?_0x5bf434['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf434[_0xf0fc('0x18')]?_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x19')]||null:null,'attributes':_0x5bf434['options']?_0x5bf434['options'][_0xf0fc('0x1a')]||null:null,'limit':_0x5bf434['options']?_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x1b')]||null:null,'include':_0x5bf434[_0xf0fc('0x18')]?_0x5bf434['options'][_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x1c')],function(_0xb1962c){return{'model':db[_0xb1962c[_0xf0fc('0x1e')]],'as':_0xb1962c['as'],'attributes':_0xb1962c[_0xf0fc('0x1a')],'include':_0xb1962c['include']?_[_0xf0fc('0x1d')](_0xb1962c[_0xf0fc('0x1c')],function(_0x555b94){return{'model':db[_0x555b94[_0xf0fc('0x1e')]],'as':_0x555b94['as'],'attributes':_0x555b94['attributes'],'include':_0x555b94['include']?_[_0xf0fc('0x1d')](_0x555b94[_0xf0fc('0x1c')],function(_0x51e794){return{'model':db[_0x51e794[_0xf0fc('0x1e')]],'as':_0x51e794['as'],'attributes':_0x51e794[_0xf0fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf0fc('0xe')](function(_0x3e261e){logger[_0xf0fc('0xf')]('GetVoiceQueue',_0x5bf434);logger[_0xf0fc('0x1f')](_0xf0fc('0x20'),_0x5bf434,JSON[_0xf0fc('0x21')](_0x3e261e));_0x2f7890(_0x3e261e);})[_0xf0fc('0x15')](function(_0x2b90ac){logger[_0xf0fc('0x12')]('GetVoiceQueue',_0x2b90ac[_0xf0fc('0x13')],_0x5bf434);_0x367b58(_0x181afe[_0xf0fc('0x12')](0x1f4,_0x2b90ac[_0xf0fc('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x1fe49d){var _0x3bb474=this;return new Promise(function(_0x1af6b8,_0xac3e96){return db[_0xf0fc('0x16')][_0xf0fc('0x22')]({'raw':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d['options'][_0xf0fc('0x23')]===undefined?!![]:![]:!![],'where':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d[_0xf0fc('0x18')]['where']||null:null,'attributes':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d[_0xf0fc('0x18')]['attributes']||null:null,'include':_0x1fe49d['options']?_0x1fe49d[_0xf0fc('0x18')][_0xf0fc('0x1c')]?_['map'](_0x1fe49d[_0xf0fc('0x18')]['include'],function(_0x578577){return{'model':db[_0x578577[_0xf0fc('0x1e')]],'as':_0x578577['as'],'attributes':_0x578577['attributes'],'include':_0x578577[_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x578577[_0xf0fc('0x1c')],function(_0x24dca0){return{'model':db[_0x24dca0[_0xf0fc('0x1e')]],'as':_0x24dca0['as'],'attributes':_0x24dca0[_0xf0fc('0x1a')],'include':_0x24dca0[_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x24dca0[_0xf0fc('0x1c')],function(_0x21d3e5){return{'model':db[_0x21d3e5[_0xf0fc('0x1e')]],'as':_0x21d3e5['as'],'attributes':_0x21d3e5[_0xf0fc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x368814){logger[_0xf0fc('0xf')](_0xf0fc('0x24'),_0x1fe49d);logger[_0xf0fc('0x1f')]('ShowVoiceQueue',_0x1fe49d,JSON[_0xf0fc('0x21')](_0x368814));_0x1af6b8(_0x368814);})['catch'](function(_0x27a05d){logger[_0xf0fc('0x12')](_0xf0fc('0x24'),_0x27a05d[_0xf0fc('0x13')],_0x1fe49d);_0xac3e96(_0x3bb474[_0xf0fc('0x12')](0x1f4,_0x27a05d[_0xf0fc('0x13')]));});});}; \ No newline at end of file +var _0x99a4=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f027c,_0x316550){var _0x381bfb=function(_0x139e40){while(--_0x139e40){_0x2f027c['push'](_0x2f027c['shift']());}};_0x381bfb(++_0x316550);}(_0x99a4,0x1f4));var _0x499a=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x99a4[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x499a('0x0'));var util=require(_0x499a('0x1'));var moment=require(_0x499a('0x2'));var BPromise=require('bluebird');var rs=require(_0x499a('0x3'));var fs=require('fs');var Redis=require(_0x499a('0x4'));var db=require(_0x499a('0x5'))['db'];var utils=require(_0x499a('0x6'));var logger=require('../../config/logger')(_0x499a('0x7'));var config=require(_0x499a('0x8'));var jayson=require(_0x499a('0x9'));var client=jayson[_0x499a('0xa')][_0x499a('0xb')]({'port':0x232a});config[_0x499a('0xc')]=_[_0x499a('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x499a('0xe'))(new Redis(config[_0x499a('0xc')]));require(_0x499a('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fe592,_0x368cbd,_0x3529f9){return new BPromise(function(_0xcc802b,_0x429167){return client[_0x499a('0x10')](_0x3fe592,_0x3529f9)['then'](function(_0x508f77){logger[_0x499a('0x11')](_0x499a('0x12'),_0x368cbd,_0x499a('0x13'));logger[_0x499a('0x14')](_0x499a('0x15'),_0x368cbd,'request\x20sent',JSON[_0x499a('0x16')](_0x508f77));if(_0x508f77[_0x499a('0x17')]){if(_0x508f77['error']['code']===0x1f4){logger['error'](_0x499a('0x12'),_0x368cbd,_0x508f77[_0x499a('0x17')][_0x499a('0x18')]);return _0x429167(_0x508f77[_0x499a('0x17')][_0x499a('0x18')]);}logger[_0x499a('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x368cbd,_0x508f77[_0x499a('0x17')]['message']);return _0xcc802b(_0x508f77[_0x499a('0x17')]['message']);}else{logger['info'](_0x499a('0x12'),_0x368cbd,_0x499a('0x13'));_0xcc802b(_0x508f77[_0x499a('0x19')][_0x499a('0x18')]);}})[_0x499a('0x1a')](function(_0x3d7c53){logger[_0x499a('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x368cbd,_0x3d7c53);_0x429167(_0x3d7c53);});});}exports[_0x499a('0x1b')]=function(_0x126611){var _0x2ac39c=this;return new Promise(function(_0x3810c3,_0x23b905){return db[_0x499a('0x1c')][_0x499a('0x1d')]({'raw':_0x126611[_0x499a('0x1e')]?_0x126611[_0x499a('0x1e')][_0x499a('0x1f')]===undefined?!![]:![]:!![],'where':_0x126611[_0x499a('0x1e')]?_0x126611[_0x499a('0x1e')]['where']||null:null,'attributes':_0x126611['options']?_0x126611[_0x499a('0x1e')][_0x499a('0x20')]||null:null,'limit':_0x126611[_0x499a('0x1e')]?_0x126611[_0x499a('0x1e')][_0x499a('0x21')]||null:null,'include':_0x126611[_0x499a('0x1e')]?_0x126611['options'][_0x499a('0x22')]?_[_0x499a('0x23')](_0x126611[_0x499a('0x1e')][_0x499a('0x22')],function(_0x3e0b8f){return{'model':db[_0x3e0b8f['model']],'as':_0x3e0b8f['as'],'attributes':_0x3e0b8f[_0x499a('0x20')],'include':_0x3e0b8f[_0x499a('0x22')]?_[_0x499a('0x23')](_0x3e0b8f[_0x499a('0x22')],function(_0x1b9b09){return{'model':db[_0x1b9b09[_0x499a('0x24')]],'as':_0x1b9b09['as'],'attributes':_0x1b9b09[_0x499a('0x20')],'include':_0x1b9b09[_0x499a('0x22')]?_[_0x499a('0x23')](_0x1b9b09[_0x499a('0x22')],function(_0x424866){return{'model':db[_0x424866[_0x499a('0x24')]],'as':_0x424866['as'],'attributes':_0x424866['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x131567){logger['info'](_0x499a('0x1b'),_0x126611);logger[_0x499a('0x14')](_0x499a('0x1b'),_0x126611,JSON[_0x499a('0x16')](_0x131567));_0x3810c3(_0x131567);})[_0x499a('0x1a')](function(_0x2e7b4b){logger[_0x499a('0x17')](_0x499a('0x1b'),_0x2e7b4b['message'],_0x126611);_0x23b905(_0x2ac39c[_0x499a('0x17')](0x1f4,_0x2e7b4b[_0x499a('0x18')]));});});};exports[_0x499a('0x25')]=function(_0x1946cb){var _0x4b0cf9=this;return new Promise(function(_0x441df3,_0x16ddd3){return db[_0x499a('0x1c')]['find']({'raw':_0x1946cb[_0x499a('0x1e')]?_0x1946cb[_0x499a('0x1e')][_0x499a('0x1f')]===undefined?!![]:![]:!![],'where':_0x1946cb[_0x499a('0x1e')]?_0x1946cb[_0x499a('0x1e')][_0x499a('0x26')]||null:null,'attributes':_0x1946cb['options']?_0x1946cb[_0x499a('0x1e')]['attributes']||null:null,'include':_0x1946cb[_0x499a('0x1e')]?_0x1946cb['options'][_0x499a('0x22')]?_[_0x499a('0x23')](_0x1946cb['options'][_0x499a('0x22')],function(_0x3bee38){return{'model':db[_0x3bee38[_0x499a('0x24')]],'as':_0x3bee38['as'],'attributes':_0x3bee38[_0x499a('0x20')],'include':_0x3bee38['include']?_[_0x499a('0x23')](_0x3bee38[_0x499a('0x22')],function(_0x4a4ee7){return{'model':db[_0x4a4ee7[_0x499a('0x24')]],'as':_0x4a4ee7['as'],'attributes':_0x4a4ee7[_0x499a('0x20')],'include':_0x4a4ee7[_0x499a('0x22')]?_['map'](_0x4a4ee7['include'],function(_0x519933){return{'model':db[_0x519933[_0x499a('0x24')]],'as':_0x519933['as'],'attributes':_0x519933['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55b414){logger[_0x499a('0x11')](_0x499a('0x25'),_0x1946cb);logger[_0x499a('0x14')](_0x499a('0x25'),_0x1946cb,JSON['stringify'](_0x55b414));_0x441df3(_0x55b414);})[_0x499a('0x1a')](function(_0x38562a){logger['error']('ShowVoiceQueue',_0x38562a['message'],_0x1946cb);_0x16ddd3(_0x4b0cf9[_0x499a('0x17')](0x1f4,_0x38562a[_0x499a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f66429e..988b034 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 _0x0adb=['./voiceQueue.events','save','remove','update','emit','removeListener','length'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x0adb,0x188));var _0xb0ad=function(_0x7f73c9,_0x547cb9){_0x7f73c9=_0x7f73c9-0x0;var _0x20cd2b=_0x0adb[_0x7f73c9];return _0x20cd2b;};'use strict';var VoiceQueueEvents=require(_0xb0ad('0x0'));var events=[_0xb0ad('0x1'),_0xb0ad('0x2'),_0xb0ad('0x3')];function createListener(_0x2b42fd,_0x49ab0e){return function(_0x142e54){_0x49ab0e[_0xb0ad('0x4')](_0x2b42fd,_0x142e54);};}function removeListener(_0x143104,_0x1ef34b){return function(){VoiceQueueEvents[_0xb0ad('0x5')](_0x143104,_0x1ef34b);};}exports['register']=function(_0x495897){for(var _0x376517=0x0,_0x52ba1c=events[_0xb0ad('0x6')];_0x376517<_0x52ba1c;_0x376517++){var _0x177ae5=events[_0x376517];var _0x26facf=createListener('voiceQueue:'+_0x177ae5,_0x495897);VoiceQueueEvents['on'](_0x177ae5,_0x26facf);}}; \ No newline at end of file +var _0xa50d=['removeListener','register','length','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0xde7895,_0xfb0291){var _0x3e5eb9=function(_0x20506e){while(--_0x20506e){_0xde7895['push'](_0xde7895['shift']());}};_0x3e5eb9(++_0xfb0291);}(_0xa50d,0xf9));var _0xda50=function(_0x4c2f2c,_0x1e4c0f){_0x4c2f2c=_0x4c2f2c-0x0;var _0x1d5cca=_0xa50d[_0x4c2f2c];return _0x1d5cca;};'use strict';var VoiceQueueEvents=require(_0xda50('0x0'));var events=['save',_0xda50('0x1'),_0xda50('0x2')];function createListener(_0x379f68,_0xaf44bf){return function(_0x12bc5d){_0xaf44bf['emit'](_0x379f68,_0x12bc5d);};}function removeListener(_0x2e43c8,_0x40c10f){return function(){VoiceQueueEvents[_0xda50('0x3')](_0x2e43c8,_0x40c10f);};}exports[_0xda50('0x4')]=function(_0x191515){for(var _0x122b33=0x0,_0x550097=events[_0xda50('0x5')];_0x122b33<_0x550097;_0x122b33++){var _0x381088=events[_0x122b33];var _0x2df3a5=createListener(_0xda50('0x6')+_0x381088,_0x191515);VoiceQueueEvents['on'](_0x381088,_0x2df3a5);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ebe6523..080f5ca 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 _0x9e5e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','update','delete'];(function(_0x5cb972,_0x47c23e){var _0x1ea098=function(_0x5e5be7){while(--_0x5e5be7){_0x5cb972['push'](_0x5cb972['shift']());}};_0x1ea098(++_0x47c23e);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9e5e[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var path=require('path');var timeout=require(_0xe9e5('0x2'));var express=require(_0xe9e5('0x3'));var router=express[_0xe9e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe9e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe9e5('0x6'));var controller=require(_0xe9e5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe9e5('0x8')]);router[_0xe9e5('0x9')]('/describe',auth[_0xe9e5('0xa')](),controller[_0xe9e5('0xb')]);router[_0xe9e5('0x9')](_0xe9e5('0xc'),auth[_0xe9e5('0xa')](),controller[_0xe9e5('0xd')]);router[_0xe9e5('0x9')](_0xe9e5('0xe'),auth[_0xe9e5('0xa')](),controller['show']);router[_0xe9e5('0xf')]('/',auth[_0xe9e5('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe9e5('0x10')]);router[_0xe9e5('0x11')](_0xe9e5('0xe'),auth[_0xe9e5('0xa')](),controller[_0xe9e5('0x12')]);module[_0xe9e5('0x13')]=router; \ No newline at end of file +var _0xf06c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','post','put','/:id','destroy','exports','multer'];(function(_0x16dbd8,_0x2dbbc8){var _0xa65b87=function(_0x2cb0ab){while(--_0x2cb0ab){_0x16dbd8['push'](_0x16dbd8['shift']());}};_0xa65b87(++_0x2dbbc8);}(_0xf06c,0xb3));var _0xcf06=function(_0x5555b9,_0x38c211){_0x5555b9=_0x5555b9-0x0;var _0x1694d0=_0xf06c[_0x5555b9];return _0x1694d0;};'use strict';var multer=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var path=require(_0xcf06('0x2'));var timeout=require(_0xcf06('0x3'));var express=require(_0xcf06('0x4'));var router=express['Router']();var fs_extra=require(_0xcf06('0x5'));var auth=require(_0xcf06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf06('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xcf06('0x8')]('/',auth[_0xcf06('0x9')](),controller[_0xcf06('0xa')]);router['get'](_0xcf06('0xb'),auth[_0xcf06('0x9')](),controller[_0xcf06('0xc')]);router[_0xcf06('0x8')](_0xcf06('0xd'),auth['isAuthenticated'](),controller[_0xcf06('0xe')]);router[_0xcf06('0x8')]('/:id',auth[_0xcf06('0x9')](),controller['show']);router[_0xcf06('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcf06('0x10')](_0xcf06('0x11'),auth[_0xcf06('0x9')](),controller['update']);router['delete'](_0xcf06('0x11'),auth['isAuthenticated'](),controller[_0xcf06('0x12')]);module[_0xcf06('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2ea5076..b83f437 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 _0xaf31=['sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x4f5aa4,_0x226cdd){var _0x17bd0b=function(_0x17ef20){while(--_0x17ef20){_0x4f5aa4['push'](_0x4f5aa4['shift']());}};_0x17bd0b(++_0x226cdd);}(_0xaf31,0x1d4));var _0x1af3=function(_0x553b2e,_0x24f535){_0x553b2e=_0x553b2e-0x0;var _0x325652=_0xaf31[_0x553b2e];return _0x325652;};'use strict';var Sequelize=require(_0x1af3('0x0'));var moment=require(_0x1af3('0x1'));module[_0x1af3('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1af3('0x3')]},'calleridname':{'type':Sequelize[_0x1af3('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1af3('0x4')],'set':function(_0x491c06){var _0x3bdc10=moment(_0x491c06);var _0x5ab94a=moment(this[_0x1af3('0x5')]('queuecallerjoinAt'))[_0x1af3('0x6')](_0x1af3('0x7'));var _0x49f82b=_0x3bdc10[_0x1af3('0x8')](_0x5ab94a,'seconds');this['setDataValue'](_0x1af3('0x9'),_0x491c06);this['setDataValue']('holdtime',_0x49f82b||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerexit':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1af3('0x3')],'comment':_0x1af3('0xb')},'originalposition':{'type':Sequelize[_0x1af3('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1af3('0x3')]},'accountcode':{'type':Sequelize[_0x1af3('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1af3('0x3')]},'priority':{'type':Sequelize[_0x1af3('0x3')]},'holdtime':{'type':Sequelize[_0x1af3('0xc')]},'mohtime':{'type':Sequelize[_0x1af3('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1af3('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1af3('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1af3('0x3')]},'secondDisposition':{'type':Sequelize[_0x1af3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x1af3('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x253b=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x83a93e,_0x4be8d6){var _0x173a9d=function(_0x183658){while(--_0x183658){_0x83a93e['push'](_0x83a93e['shift']());}};_0x173a9d(++_0x4be8d6);}(_0x253b,0xba));var _0xb253=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x253b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb253('0x0'));module[_0xb253('0x1')]={'type':{'type':Sequelize[_0xb253('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb253('0x2')]},'calleridname':{'type':Sequelize[_0xb253('0x2')]},'queue':{'type':Sequelize[_0xb253('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xb253('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xb253('0x3')],'set':function(_0x26affe){var _0x4a5f29=moment(_0x26affe);var _0x1de9a1=moment(this[_0xb253('0x4')](_0xb253('0x5')))[_0xb253('0x6')](_0xb253('0x7'));var _0x136f2f=_0x4a5f29[_0xb253('0x8')](_0x1de9a1,_0xb253('0x9'));this[_0xb253('0xa')](_0xb253('0xb'),_0x26affe);this[_0xb253('0xa')](_0xb253('0xc'),_0x136f2f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xb253('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb253('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xb253('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb253('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb253('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xb253('0x2')],'comment':_0xb253('0xe')},'originalposition':{'type':Sequelize[_0xb253('0xf')]},'channel':{'type':Sequelize[_0xb253('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb253('0x2')]},'connectedlinename':{'type':Sequelize[_0xb253('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb253('0x2')]},'priority':{'type':Sequelize[_0xb253('0x2')]},'holdtime':{'type':Sequelize[_0xb253('0xf')]},'mohtime':{'type':Sequelize[_0xb253('0xf')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb253('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb253('0x2')]},'transfer':{'type':Sequelize[_0xb253('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb253('0x2')],'comment':_0xb253('0x10')},'transferexten':{'type':Sequelize[_0xb253('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb253('0x2')]},'secondDisposition':{'type':Sequelize[_0xb253('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb253('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xb253('0xf')],'defaultValue':0x0},'note':{'type':Sequelize[_0xb253('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 7e8066f..bba48bf 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 _0x6fe3=['describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','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','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','options','VoiceQueueReport','findAll','rows','catch','show','length','includeAll','include','create','body','find','params'];(function(_0x4c2508,_0x220e3b){var _0x5ce988=function(_0x1eefe2){while(--_0x1eefe2){_0x4c2508['push'](_0x4c2508['shift']());}};_0x5ce988(++_0x220e3b);}(_0x6fe3,0x143));var _0x36fe=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x6fe3[_0xf44d98];return _0x5ebb04;};'use strict';var emlformat=require(_0x36fe('0x0'));var rimraf=require(_0x36fe('0x1'));var zipdir=require(_0x36fe('0x2'));var jsonpatch=require(_0x36fe('0x3'));var rp=require(_0x36fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36fe('0x5'));var util=require(_0x36fe('0x6'));var path=require('path');var sox=require(_0x36fe('0x7'));var csv=require(_0x36fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36fe('0x9'));var _=require(_0x36fe('0xa'));var squel=require('squel');var crypto=require(_0x36fe('0xb'));var jsforce=require(_0x36fe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x36fe('0x8'));var querystring=require(_0x36fe('0xd'));var Papa=require(_0x36fe('0xe'));var Redis=require('ioredis');var authService=require(_0x36fe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x36fe('0x10'));var hardwareService=require(_0x36fe('0x11'));var logger=require(_0x36fe('0x12'))(_0x36fe('0x13'));var utils=require(_0x36fe('0x14'));var config=require(_0x36fe('0x15'));var licenseUtil=require(_0x36fe('0x16'));var db=require(_0x36fe('0x17'))['db'];config[_0x36fe('0x18')]=_[_0x36fe('0x19')](config[_0x36fe('0x18')],{'host':_0x36fe('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36fe('0x18')]));require(_0x36fe('0x1b'))[_0x36fe('0x1c')](socket);function respondWithStatusCode(_0x4dc20a,_0x527371){_0x527371=_0x527371||0xcc;return function(_0x24b291){if(_0x24b291){return _0x4dc20a[_0x36fe('0x1d')](_0x527371);}return _0x4dc20a[_0x36fe('0x1e')](_0x527371)['end']();};}function respondWithResult(_0x2e290d,_0x1e1e6f){_0x1e1e6f=_0x1e1e6f||0xc8;return function(_0x219983){if(_0x219983){return _0x2e290d[_0x36fe('0x1e')](_0x1e1e6f)[_0x36fe('0x1f')](_0x219983);}};}function respondWithFilteredResult(_0x54883c,_0x29095f){return function(_0x53c480){if(_0x53c480){var _0x43c37d=typeof _0x29095f[_0x36fe('0x20')]===_0x36fe('0x21')&&typeof _0x29095f['limit']==='undefined';var _0x36f51e=_0x53c480[_0x36fe('0x22')];var _0x221300=_0x43c37d?0x0:_0x29095f[_0x36fe('0x20')];var _0x1d1dc4=_0x43c37d?_0x53c480['count']:_0x29095f[_0x36fe('0x20')]+_0x29095f[_0x36fe('0x23')];var _0x3251df;if(_0x1d1dc4>=_0x36f51e){_0x1d1dc4=_0x36f51e;_0x3251df=0xc8;}else{_0x3251df=0xce;}_0x54883c[_0x36fe('0x1e')](_0x3251df);return _0x54883c[_0x36fe('0x24')]('Content-Range',_0x221300+'-'+_0x1d1dc4+'/'+_0x36f51e)[_0x36fe('0x1f')](_0x53c480);}return null;};}function patchUpdates(_0x4d390f){return function(_0x378b73){try{jsonpatch['apply'](_0x378b73,_0x4d390f,!![]);}catch(_0x1629d8){return BPromise[_0x36fe('0x25')](_0x1629d8);}return _0x378b73['save']();};}function saveUpdates(_0x576908,_0x7fce11){return function(_0x18f0a3){if(_0x18f0a3){return _0x18f0a3[_0x36fe('0x26')](_0x576908)[_0x36fe('0x27')](function(_0x30328f){return _0x30328f;});}return null;};}function removeEntity(_0xa01e1,_0x7882b9){return function(_0x5e50be){if(_0x5e50be){return _0x5e50be[_0x36fe('0x28')]()[_0x36fe('0x27')](function(){_0xa01e1['status'](0xcc)[_0x36fe('0x29')]();});}};}function handleEntityNotFound(_0x340110,_0x4c3766){return function(_0x42257d){if(!_0x42257d){_0x340110[_0x36fe('0x1d')](0x194);}return _0x42257d;};}function handleError(_0x2b7086,_0x266f4f){_0x266f4f=_0x266f4f||0x1f4;return function(_0x5c5a4e){logger[_0x36fe('0x2a')](_0x5c5a4e[_0x36fe('0x2b')]);if(_0x5c5a4e['name']){delete _0x5c5a4e[_0x36fe('0x2c')];}_0x2b7086['status'](_0x266f4f)[_0x36fe('0x2d')](_0x5c5a4e);};}exports['index']=function(_0x5d6f47,_0x121715){var _0x3a75b8={},_0x2e565f={},_0x2b0f2f={'count':0x0,'rows':[]};var _0x56f5b6=_[_0x36fe('0x2e')](db['VoiceQueueReport'][_0x36fe('0x2f')],function(_0x6533b5){return{'name':_0x6533b5[_0x36fe('0x30')],'type':_0x6533b5[_0x36fe('0x31')][_0x36fe('0x32')]};});_0x2e565f['model']=_[_0x36fe('0x2e')](_0x56f5b6,_0x36fe('0x2c'));_0x2e565f[_0x36fe('0x33')]=_[_0x36fe('0x34')](_0x5d6f47[_0x36fe('0x33')]);_0x2e565f[_0x36fe('0x35')]=_[_0x36fe('0x36')](_0x2e565f[_0x36fe('0x37')],_0x2e565f[_0x36fe('0x33')]);_0x3a75b8[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x2e565f[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x39')]));_0x3a75b8[_0x36fe('0x38')]=_0x3a75b8[_0x36fe('0x38')]['length']?_0x3a75b8[_0x36fe('0x38')]:_0x2e565f[_0x36fe('0x37')];if(!_0x5d6f47[_0x36fe('0x33')]['hasOwnProperty'](_0x36fe('0x3a'))){_0x3a75b8['limit']=qs[_0x36fe('0x23')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x23')]);_0x3a75b8[_0x36fe('0x20')]=qs[_0x36fe('0x20')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x20')]);}_0x3a75b8['order']=qs[_0x36fe('0x3b')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x3b')]);_0x3a75b8[_0x36fe('0x3c')]=qs['filters'](_[_0x36fe('0x3d')](_0x5d6f47['query'],_0x2e565f[_0x36fe('0x35')]),_0x56f5b6);if(_0x5d6f47['query'][_0x36fe('0x3e')]){_0x3a75b8['where']=_[_0x36fe('0x3f')](_0x3a75b8[_0x36fe('0x3c')],{'$or':_['map'](_0x56f5b6,function(_0xde7dac){if(_0xde7dac['type']!=='VIRTUAL'){var _0x252f37={};_0x252f37[_0xde7dac[_0x36fe('0x2c')]]={'$like':'%'+_0x5d6f47['query']['filter']+'%'};return _0x252f37;}})});}_0x3a75b8=_[_0x36fe('0x3f')]({},_0x3a75b8,_0x5d6f47[_0x36fe('0x40')]);var _0x2e044f={'where':_0x3a75b8[_0x36fe('0x3c')]};return db[_0x36fe('0x41')][_0x36fe('0x22')](_0x2e044f)[_0x36fe('0x27')](function(_0xedcfba){_0x2b0f2f['count']=_0xedcfba;if(_0x5d6f47['query']['includeAll']){_0x3a75b8['include']=[{'all':!![]}];}return db[_0x36fe('0x41')][_0x36fe('0x42')](_0x3a75b8);})[_0x36fe('0x27')](function(_0x33b62b){_0x2b0f2f[_0x36fe('0x43')]=_0x33b62b;return _0x2b0f2f;})['then'](respondWithFilteredResult(_0x121715,_0x3a75b8))[_0x36fe('0x44')](handleError(_0x121715,null));};exports[_0x36fe('0x45')]=function(_0x5c0812,_0x6897b8){var _0x46bde0={'raw':![],'where':{'id':_0x5c0812['params']['id']}},_0x3d7421={};_0x3d7421['model']=_[_0x36fe('0x34')](db['VoiceQueueReport'][_0x36fe('0x2f')]);_0x3d7421['query']=_['keys'](_0x5c0812[_0x36fe('0x33')]);_0x3d7421[_0x36fe('0x35')]=_[_0x36fe('0x36')](_0x3d7421[_0x36fe('0x37')],_0x3d7421['query']);_0x46bde0[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x3d7421[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x5c0812[_0x36fe('0x33')][_0x36fe('0x39')]));_0x46bde0[_0x36fe('0x38')]=_0x46bde0[_0x36fe('0x38')][_0x36fe('0x46')]?_0x46bde0[_0x36fe('0x38')]:_0x3d7421['model'];if(_0x5c0812['query'][_0x36fe('0x47')]){_0x46bde0[_0x36fe('0x48')]=[{'all':!![]}];}_0x46bde0=_[_0x36fe('0x3f')]({},_0x46bde0,_0x5c0812[_0x36fe('0x40')]);return db['VoiceQueueReport']['find'](_0x46bde0)[_0x36fe('0x27')](handleEntityNotFound(_0x6897b8,null))[_0x36fe('0x27')](respondWithResult(_0x6897b8,null))[_0x36fe('0x44')](handleError(_0x6897b8,null));};exports[_0x36fe('0x49')]=function(_0x51732d,_0x33075a){return db[_0x36fe('0x41')][_0x36fe('0x49')](_0x51732d[_0x36fe('0x4a')],{})[_0x36fe('0x27')](respondWithResult(_0x33075a,0xc9))[_0x36fe('0x44')](handleError(_0x33075a,null));};exports['update']=function(_0x97837a,_0x50a3d4){if(_0x97837a['body']['id']){delete _0x97837a['body']['id'];}return db[_0x36fe('0x41')][_0x36fe('0x4b')]({'where':{'id':_0x97837a[_0x36fe('0x4c')]['id']}})[_0x36fe('0x27')](handleEntityNotFound(_0x50a3d4,null))[_0x36fe('0x27')](saveUpdates(_0x97837a['body'],null))['then'](respondWithResult(_0x50a3d4,null))['catch'](handleError(_0x50a3d4,null));};exports[_0x36fe('0x28')]=function(_0x5bd841,_0x2ad0b1){return db['VoiceQueueReport']['find']({'where':{'id':_0x5bd841['params']['id']}})[_0x36fe('0x27')](handleEntityNotFound(_0x2ad0b1,null))[_0x36fe('0x27')](removeEntity(_0x2ad0b1,null))[_0x36fe('0x44')](handleError(_0x2ad0b1,null));};exports[_0x36fe('0x4d')]=function(_0x44f42f,_0x49a7c8){return db[_0x36fe('0x41')][_0x36fe('0x4d')]()[_0x36fe('0x27')](respondWithResult(_0x49a7c8,null))[_0x36fe('0x44')](handleError(_0x49a7c8,null));};exports[_0x36fe('0x4e')]=function(_0x48a736,_0xeab8d6){var _0x1ff06a={},_0x2994b5={},_0x5e4177={'count':0x0,'rows':[]};_0x2994b5[_0x36fe('0x37')]=_[_0x36fe('0x34')](db[_0x36fe('0x41')]['rawAttributes']);_0x2994b5['query']=_[_0x36fe('0x34')](_0x48a736[_0x36fe('0x33')]);_0x2994b5['filters']=_[_0x36fe('0x36')](_0x2994b5[_0x36fe('0x37')],_0x2994b5[_0x36fe('0x33')]);_0x1ff06a[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x2994b5[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x48a736['query'][_0x36fe('0x39')]));_0x1ff06a[_0x36fe('0x38')]=_0x1ff06a['attributes'][_0x36fe('0x46')]?_0x1ff06a['attributes']:_0x2994b5['model'];if(!_0x48a736[_0x36fe('0x33')][_0x36fe('0x4f')](_0x36fe('0x3a'))){_0x1ff06a[_0x36fe('0x23')]=qs[_0x36fe('0x23')](_0x48a736[_0x36fe('0x33')][_0x36fe('0x23')]);_0x1ff06a['offset']=qs[_0x36fe('0x20')](_0x48a736[_0x36fe('0x33')][_0x36fe('0x20')]);}_0x1ff06a['order']=qs[_0x36fe('0x3b')](_0x48a736['query'][_0x36fe('0x3b')]);_0x1ff06a[_0x36fe('0x3c')]=qs['filters'](_[_0x36fe('0x3d')](_0x48a736['query'],_0x2994b5[_0x36fe('0x35')]));if(_0x48a736['query'][_0x36fe('0x3e')]){_0x1ff06a['where']=_[_0x36fe('0x3f')](_0x1ff06a['where'],{'$or':_[_0x36fe('0x2e')](_0x1ff06a[_0x36fe('0x38')],function(_0x4eb5d0){var _0x2a1820={};_0x2a1820[_0x4eb5d0]={'$like':'%'+_0x48a736['query']['filter']+'%'};return _0x2a1820;})});}_0x1ff06a=_['merge']({},_0x1ff06a,_0x48a736['options']);var _0x24e3e0={'where':_0x1ff06a[_0x36fe('0x3c')]};return db[_0x36fe('0x41')][_0x36fe('0x22')](_0x24e3e0)[_0x36fe('0x27')](function(_0xe9efc0){_0x5e4177['count']=_0xe9efc0;if(_0x48a736[_0x36fe('0x33')][_0x36fe('0x47')]){_0x1ff06a['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1ff06a);})[_0x36fe('0x27')](function(_0x375ce8){_0x5e4177[_0x36fe('0x43')]=_0x375ce8;return _0x5e4177;})[_0x36fe('0x27')](respondWithFilteredResult(_0xeab8d6,_0x1ff06a,_0x36fe('0x4e')))[_0x36fe('0x44')](handleError(_0xeab8d6,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x8774=['sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','register','end','json','undefined','limit','count','status','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceQueueReport','rows','catch','show','params','find','create','body','update','describe','hasOwnProperty','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x31453a,_0x4232e2){var _0x468e0f=function(_0x151e97){while(--_0x151e97){_0x31453a['push'](_0x31453a['shift']());}};_0x468e0f(++_0x4232e2);}(_0x8774,0x1d6));var _0x4877=function(_0x5c5bd8,_0x510df3){_0x5c5bd8=_0x5c5bd8-0x0;var _0x331358=_0x8774[_0x5c5bd8];return _0x331358;};'use strict';var emlformat=require(_0x4877('0x0'));var rimraf=require(_0x4877('0x1'));var zipdir=require(_0x4877('0x2'));var jsonpatch=require(_0x4877('0x3'));var rp=require(_0x4877('0x4'));var moment=require(_0x4877('0x5'));var BPromise=require(_0x4877('0x6'));var Mustache=require(_0x4877('0x7'));var util=require(_0x4877('0x8'));var path=require(_0x4877('0x9'));var sox=require(_0x4877('0xa'));var csv=require(_0x4877('0xb'));var ejs=require(_0x4877('0xc'));var fs=require('fs');var fs_extra=require(_0x4877('0xd'));var _=require(_0x4877('0xe'));var squel=require(_0x4877('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4877('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4877('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4877('0x12'));var hardwareService=require(_0x4877('0x13'));var logger=require('../../config/logger')(_0x4877('0x14'));var utils=require(_0x4877('0x15'));var config=require(_0x4877('0x16'));var licenseUtil=require(_0x4877('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4877('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4877('0x19'))(new Redis(config[_0x4877('0x1a')]));require('./voiceQueueReport.socket')[_0x4877('0x1b')](socket);function respondWithStatusCode(_0x363bd4,_0x1a00dc){_0x1a00dc=_0x1a00dc||0xcc;return function(_0xd53673){if(_0xd53673){return _0x363bd4['sendStatus'](_0x1a00dc);}return _0x363bd4['status'](_0x1a00dc)[_0x4877('0x1c')]();};}function respondWithResult(_0x1f14c7,_0xcfe221){_0xcfe221=_0xcfe221||0xc8;return function(_0x419d2e){if(_0x419d2e){return _0x1f14c7['status'](_0xcfe221)[_0x4877('0x1d')](_0x419d2e);}};}function respondWithFilteredResult(_0xe4b8f3,_0xc068e9){return function(_0x13ff14){if(_0x13ff14){var _0x1febba=typeof _0xc068e9['offset']===_0x4877('0x1e')&&typeof _0xc068e9[_0x4877('0x1f')]===_0x4877('0x1e');var _0x1187c1=_0x13ff14[_0x4877('0x20')];var _0x4c4974=_0x1febba?0x0:_0xc068e9['offset'];var _0x535048=_0x1febba?_0x13ff14[_0x4877('0x20')]:_0xc068e9['offset']+_0xc068e9[_0x4877('0x1f')];var _0xf044f0;if(_0x535048>=_0x1187c1){_0x535048=_0x1187c1;_0xf044f0=0xc8;}else{_0xf044f0=0xce;}_0xe4b8f3[_0x4877('0x21')](_0xf044f0);return _0xe4b8f3[_0x4877('0x22')]('Content-Range',_0x4c4974+'-'+_0x535048+'/'+_0x1187c1)[_0x4877('0x1d')](_0x13ff14);}return null;};}function patchUpdates(_0x255d55){return function(_0x34b87e){try{jsonpatch[_0x4877('0x23')](_0x34b87e,_0x255d55,!![]);}catch(_0x52ddc2){return BPromise[_0x4877('0x24')](_0x52ddc2);}return _0x34b87e[_0x4877('0x25')]();};}function saveUpdates(_0x274e36,_0x135916){return function(_0x54b860){if(_0x54b860){return _0x54b860['update'](_0x274e36)[_0x4877('0x26')](function(_0x232d86){return _0x232d86;});}return null;};}function removeEntity(_0x288af1,_0x589e9a){return function(_0x11bf1c){if(_0x11bf1c){return _0x11bf1c[_0x4877('0x27')]()['then'](function(){_0x288af1['status'](0xcc)[_0x4877('0x1c')]();});}};}function handleEntityNotFound(_0x47d76d,_0x5e9485){return function(_0xbf6500){if(!_0xbf6500){_0x47d76d[_0x4877('0x28')](0x194);}return _0xbf6500;};}function handleError(_0x3211b5,_0x4e81b6){_0x4e81b6=_0x4e81b6||0x1f4;return function(_0x2ed5bf){logger[_0x4877('0x29')](_0x2ed5bf[_0x4877('0x2a')]);if(_0x2ed5bf[_0x4877('0x2b')]){delete _0x2ed5bf[_0x4877('0x2b')];}_0x3211b5[_0x4877('0x21')](_0x4e81b6)['send'](_0x2ed5bf);};}exports[_0x4877('0x2c')]=function(_0x4eae1a,_0x39acad){var _0x5e09c3={},_0x21b647={},_0x752890={'count':0x0,'rows':[]};var _0x41683c=_[_0x4877('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x3e288f){return{'name':_0x3e288f['fieldName'],'type':_0x3e288f[_0x4877('0x2e')]['key']};});_0x21b647[_0x4877('0x2f')]=_[_0x4877('0x2d')](_0x41683c,_0x4877('0x2b'));_0x21b647[_0x4877('0x30')]=_[_0x4877('0x31')](_0x4eae1a[_0x4877('0x30')]);_0x21b647[_0x4877('0x32')]=_[_0x4877('0x33')](_0x21b647[_0x4877('0x2f')],_0x21b647[_0x4877('0x30')]);_0x5e09c3[_0x4877('0x34')]=_[_0x4877('0x33')](_0x21b647[_0x4877('0x2f')],qs[_0x4877('0x35')](_0x4eae1a['query']['fields']));_0x5e09c3['attributes']=_0x5e09c3[_0x4877('0x34')][_0x4877('0x36')]?_0x5e09c3[_0x4877('0x34')]:_0x21b647[_0x4877('0x2f')];if(!_0x4eae1a[_0x4877('0x30')]['hasOwnProperty'](_0x4877('0x37'))){_0x5e09c3[_0x4877('0x1f')]=qs[_0x4877('0x1f')](_0x4eae1a[_0x4877('0x30')][_0x4877('0x1f')]);_0x5e09c3[_0x4877('0x38')]=qs[_0x4877('0x38')](_0x4eae1a[_0x4877('0x30')]['offset']);}_0x5e09c3[_0x4877('0x39')]=qs[_0x4877('0x3a')](_0x4eae1a['query'][_0x4877('0x3a')]);_0x5e09c3[_0x4877('0x3b')]=qs[_0x4877('0x32')](_[_0x4877('0x3c')](_0x4eae1a[_0x4877('0x30')],_0x21b647[_0x4877('0x32')]),_0x41683c);if(_0x4eae1a[_0x4877('0x30')][_0x4877('0x3d')]){_0x5e09c3[_0x4877('0x3b')]=_['merge'](_0x5e09c3[_0x4877('0x3b')],{'$or':_[_0x4877('0x2d')](_0x41683c,function(_0x4138aa){if(_0x4138aa['type']!==_0x4877('0x3e')){var _0x2f827f={};_0x2f827f[_0x4138aa[_0x4877('0x2b')]]={'$like':'%'+_0x4eae1a[_0x4877('0x30')][_0x4877('0x3d')]+'%'};return _0x2f827f;}})});}_0x5e09c3=_[_0x4877('0x3f')]({},_0x5e09c3,_0x4eae1a[_0x4877('0x40')]);var _0x4ec68d={'where':_0x5e09c3[_0x4877('0x3b')]};return db['VoiceQueueReport'][_0x4877('0x20')](_0x4ec68d)['then'](function(_0x42c64){_0x752890[_0x4877('0x20')]=_0x42c64;if(_0x4eae1a['query'][_0x4877('0x41')]){_0x5e09c3[_0x4877('0x42')]=[{'all':!![]}];}return db[_0x4877('0x43')]['findAll'](_0x5e09c3);})['then'](function(_0x48f566){_0x752890[_0x4877('0x44')]=_0x48f566;return _0x752890;})[_0x4877('0x26')](respondWithFilteredResult(_0x39acad,_0x5e09c3))[_0x4877('0x45')](handleError(_0x39acad,null));};exports[_0x4877('0x46')]=function(_0x22185b,_0x360222){var _0x39e391={'raw':![],'where':{'id':_0x22185b[_0x4877('0x47')]['id']}},_0xd385d6={};_0xd385d6[_0x4877('0x2f')]=_[_0x4877('0x31')](db[_0x4877('0x43')]['rawAttributes']);_0xd385d6[_0x4877('0x30')]=_[_0x4877('0x31')](_0x22185b[_0x4877('0x30')]);_0xd385d6[_0x4877('0x32')]=_[_0x4877('0x33')](_0xd385d6[_0x4877('0x2f')],_0xd385d6[_0x4877('0x30')]);_0x39e391[_0x4877('0x34')]=_[_0x4877('0x33')](_0xd385d6['model'],qs['fields'](_0x22185b[_0x4877('0x30')]['fields']));_0x39e391[_0x4877('0x34')]=_0x39e391['attributes'][_0x4877('0x36')]?_0x39e391[_0x4877('0x34')]:_0xd385d6[_0x4877('0x2f')];if(_0x22185b[_0x4877('0x30')]['includeAll']){_0x39e391[_0x4877('0x42')]=[{'all':!![]}];}_0x39e391=_[_0x4877('0x3f')]({},_0x39e391,_0x22185b[_0x4877('0x40')]);return db['VoiceQueueReport'][_0x4877('0x48')](_0x39e391)[_0x4877('0x26')](handleEntityNotFound(_0x360222,null))[_0x4877('0x26')](respondWithResult(_0x360222,null))[_0x4877('0x45')](handleError(_0x360222,null));};exports['create']=function(_0x46de6a,_0x2838fc){return db[_0x4877('0x43')][_0x4877('0x49')](_0x46de6a[_0x4877('0x4a')],{})[_0x4877('0x26')](respondWithResult(_0x2838fc,0xc9))['catch'](handleError(_0x2838fc,null));};exports[_0x4877('0x4b')]=function(_0x94011d,_0x5b40f6){if(_0x94011d[_0x4877('0x4a')]['id']){delete _0x94011d['body']['id'];}return db[_0x4877('0x43')]['find']({'where':{'id':_0x94011d[_0x4877('0x47')]['id']}})[_0x4877('0x26')](handleEntityNotFound(_0x5b40f6,null))[_0x4877('0x26')](saveUpdates(_0x94011d[_0x4877('0x4a')],null))[_0x4877('0x26')](respondWithResult(_0x5b40f6,null))[_0x4877('0x45')](handleError(_0x5b40f6,null));};exports[_0x4877('0x27')]=function(_0x2d078f,_0x41d0fc){return db[_0x4877('0x43')][_0x4877('0x48')]({'where':{'id':_0x2d078f[_0x4877('0x47')]['id']}})['then'](handleEntityNotFound(_0x41d0fc,null))[_0x4877('0x26')](removeEntity(_0x41d0fc,null))[_0x4877('0x45')](handleError(_0x41d0fc,null));};exports['describe']=function(_0x32ceb1,_0x516668){return db[_0x4877('0x43')][_0x4877('0x4c')]()[_0x4877('0x26')](respondWithResult(_0x516668,null))[_0x4877('0x45')](handleError(_0x516668,null));};exports['getVoiceQueuesReport']=function(_0x54cc45,_0x1f1337){var _0x3166fe={},_0x477c1d={},_0x20b23d={'count':0x0,'rows':[]};_0x477c1d[_0x4877('0x2f')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x477c1d['query']=_[_0x4877('0x31')](_0x54cc45[_0x4877('0x30')]);_0x477c1d[_0x4877('0x32')]=_['intersection'](_0x477c1d[_0x4877('0x2f')],_0x477c1d[_0x4877('0x30')]);_0x3166fe[_0x4877('0x34')]=_['intersection'](_0x477c1d[_0x4877('0x2f')],qs['fields'](_0x54cc45['query'][_0x4877('0x35')]));_0x3166fe[_0x4877('0x34')]=_0x3166fe[_0x4877('0x34')][_0x4877('0x36')]?_0x3166fe[_0x4877('0x34')]:_0x477c1d[_0x4877('0x2f')];if(!_0x54cc45['query'][_0x4877('0x4d')]('nolimit')){_0x3166fe[_0x4877('0x1f')]=qs['limit'](_0x54cc45[_0x4877('0x30')][_0x4877('0x1f')]);_0x3166fe['offset']=qs[_0x4877('0x38')](_0x54cc45[_0x4877('0x30')][_0x4877('0x38')]);}_0x3166fe['order']=qs['sort'](_0x54cc45[_0x4877('0x30')][_0x4877('0x3a')]);_0x3166fe[_0x4877('0x3b')]=qs[_0x4877('0x32')](_[_0x4877('0x3c')](_0x54cc45[_0x4877('0x30')],_0x477c1d[_0x4877('0x32')]));if(_0x54cc45[_0x4877('0x30')][_0x4877('0x3d')]){_0x3166fe[_0x4877('0x3b')]=_['merge'](_0x3166fe[_0x4877('0x3b')],{'$or':_[_0x4877('0x2d')](_0x3166fe[_0x4877('0x34')],function(_0x48698a){var _0x3717ad={};_0x3717ad[_0x48698a]={'$like':'%'+_0x54cc45[_0x4877('0x30')]['filter']+'%'};return _0x3717ad;})});}_0x3166fe=_[_0x4877('0x3f')]({},_0x3166fe,_0x54cc45['options']);var _0x54242a={'where':_0x3166fe[_0x4877('0x3b')]};return db[_0x4877('0x43')][_0x4877('0x20')](_0x54242a)[_0x4877('0x26')](function(_0x57e281){_0x20b23d[_0x4877('0x20')]=_0x57e281;if(_0x54cc45[_0x4877('0x30')][_0x4877('0x41')]){_0x3166fe[_0x4877('0x42')]=[{'all':!![]}];}return db[_0x4877('0x43')][_0x4877('0x4e')](_0x3166fe);})[_0x4877('0x26')](function(_0x43e6fa){_0x20b23d[_0x4877('0x44')]=_0x43e6fa;return _0x20b23d;})[_0x4877('0x26')](respondWithFilteredResult(_0x1f1337,_0x3166fe,_0x4877('0x4f')))[_0x4877('0x45')](handleError(_0x1f1337,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d26da90..cc23fb1 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 _0x9ffc=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0x9ffc,0x1c7));var _0xc9ff=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x9ffc[_0x545fe3];return _0x480702;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xc9ff('0x0'))['db'][_0xc9ff('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc9ff('0x2')](0x0);var events={'afterCreate':_0xc9ff('0x3'),'afterUpdate':_0xc9ff('0x4'),'afterDestroy':_0xc9ff('0x5')};function emitEvent(_0x4842f4){return function(_0x36279d,_0x3a8d14,_0x35e55f){VoiceQueueReportEvents[_0xc9ff('0x6')](_0x4842f4+':'+_0x36279d['id'],_0x36279d);VoiceQueueReportEvents[_0xc9ff('0x6')](_0x4842f4,_0x36279d);_0x35e55f(null);};}for(var e in events){if(events[_0xc9ff('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc9ff('0x8')](e,emitEvent(event));}}module[_0xc9ff('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe47c=['hook','exports','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x34046c,_0x44481f){var _0x3e4b13=function(_0x114253){while(--_0x114253){_0x34046c['push'](_0x34046c['shift']());}};_0x3e4b13(++_0x44481f);}(_0xe47c,0x194));var _0xce47=function(_0x207cfc,_0x30d563){_0x207cfc=_0x207cfc-0x0;var _0x1a2acc=_0xe47c[_0x207cfc];return _0x1a2acc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xce47('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xce47('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17a323){return function(_0x4e3576,_0x4f839d,_0x39da18){VoiceQueueReportEvents['emit'](_0x17a323+':'+_0x4e3576['id'],_0x4e3576);VoiceQueueReportEvents[_0xce47('0x2')](_0x17a323,_0x4e3576);_0x39da18(null);};}for(var e in events){if(events[_0xce47('0x3')](e)){var event=events[e];VoiceQueueReport[_0xce47('0x4')](e,emitEvent(event));}}module[_0xce47('0x5')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8b5c8a2..b829d27 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 _0xb0d3=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x57194e,_0x35731d){var _0x5da5d2=function(_0x586328){while(--_0x586328){_0x57194e['push'](_0x57194e['shift']());}};_0x5da5d2(++_0x35731d);}(_0xb0d3,0xd5));var _0x3b0d=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xb0d3[_0x44c935];return _0x465bee;};'use strict';var _=require(_0x3b0d('0x0'));var util=require(_0x3b0d('0x1'));var logger=require(_0x3b0d('0x2'))('api');var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var rp=require(_0x3b0d('0x5'));var fs=require('fs');var path=require(_0x3b0d('0x6'));var rimraf=require(_0x3b0d('0x7'));var config=require(_0x3b0d('0x8'));var attributes=require(_0x3b0d('0x9'));module[_0x3b0d('0xa')]=function(_0x4ce158,_0x1834dc){return _0x4ce158[_0x3b0d('0xb')](_0x3b0d('0xc'),attributes,{'tableName':_0x3b0d('0xd'),'paranoid':![],'indexes':[{'fields':[_0x3b0d('0xe')]},{'fields':[_0x3b0d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x619e=['exports','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','../../config/environment','./voiceQueueReport.attributes'];(function(_0x141cdc,_0xa038e9){var _0x2d7d88=function(_0x5d161f){while(--_0x5d161f){_0x141cdc['push'](_0x141cdc['shift']());}};_0x2d7d88(++_0xa038e9);}(_0x619e,0x19b));var _0xe619=function(_0x5524a1,_0x37c171){_0x5524a1=_0x5524a1-0x0;var _0x4ea5e3=_0x619e[_0x5524a1];return _0x4ea5e3;};'use strict';var _=require(_0xe619('0x0'));var util=require(_0xe619('0x1'));var logger=require(_0xe619('0x2'))(_0xe619('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe619('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe619('0x5'));var attributes=require(_0xe619('0x6'));module[_0xe619('0x7')]=function(_0x199d4e,_0x4054f6){return _0x199d4e['define'](_0xe619('0x8'),attributes,{'tableName':_0xe619('0x9'),'paranoid':![],'indexes':[{'fields':[_0xe619('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3c3c441..af46781 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 _0xf0d0=['http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x52c553,_0x273e5a){var _0x425607=function(_0x25f443){while(--_0x25f443){_0x52c553['push'](_0x52c553['shift']());}};_0x425607(++_0x273e5a);}(_0xf0d0,0x179));var _0x0f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0f0d('0x0'));var moment=require(_0x0f0d('0x1'));var BPromise=require(_0x0f0d('0x2'));var rs=require(_0x0f0d('0x3'));var fs=require('fs');var Redis=require(_0x0f0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f0d('0x5'));var logger=require('../../config/logger')(_0x0f0d('0x6'));var config=require(_0x0f0d('0x7'));var jayson=require(_0x0f0d('0x8'));var client=jayson[_0x0f0d('0x9')][_0x0f0d('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0f0d('0xb')],{'host':_0x0f0d('0xc'),'port':0x18eb});var socket=require(_0x0f0d('0xd'))(new Redis(config[_0x0f0d('0xb')]));require(_0x0f0d('0xe'))[_0x0f0d('0xf')](socket);function respondWithRpcPromise(_0x5be910,_0x1e713a,_0x4deaaf){return new BPromise(function(_0x205533,_0x39d625){return client[_0x0f0d('0x10')](_0x5be910,_0x4deaaf)[_0x0f0d('0x11')](function(_0x3748d0){logger[_0x0f0d('0x12')](_0x0f0d('0x13'),_0x1e713a,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1e713a,'request\x20sent',JSON[_0x0f0d('0x14')](_0x3748d0));if(_0x3748d0[_0x0f0d('0x15')]){if(_0x3748d0['error']['code']===0x1f4){logger[_0x0f0d('0x15')](_0x0f0d('0x13'),_0x1e713a,_0x3748d0['error'][_0x0f0d('0x16')]);return _0x39d625(_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);}logger[_0x0f0d('0x15')](_0x0f0d('0x13'),_0x1e713a,_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);return _0x205533(_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);}else{logger['info'](_0x0f0d('0x13'),_0x1e713a,_0x0f0d('0x17'));_0x205533(_0x3748d0[_0x0f0d('0x18')][_0x0f0d('0x16')]);}})[_0x0f0d('0x19')](function(_0x2c75f6){logger['error'](_0x0f0d('0x13'),_0x1e713a,_0x2c75f6);_0x39d625(_0x2c75f6);});});}exports[_0x0f0d('0x1a')]=function(_0x4cc866){var _0x232774=this;return new Promise(function(_0x2a1525,_0x2b6070){return db['VoiceQueueReport'][_0x0f0d('0x1b')]({'raw':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4cc866[_0x0f0d('0x1c')]?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x1d')]||null:null,'attributes':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x1e')]||null:null,'limit':_0x4cc866[_0x0f0d('0x1c')]?_0x4cc866['options'][_0x0f0d('0x1f')]||null:null,'include':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x20')],function(_0x577b03){return{'model':db[_0x577b03[_0x0f0d('0x22')]],'as':_0x577b03['as'],'attributes':_0x577b03['attributes'],'include':_0x577b03[_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x577b03[_0x0f0d('0x20')],function(_0x3d2c54){return{'model':db[_0x3d2c54[_0x0f0d('0x22')]],'as':_0x3d2c54['as'],'attributes':_0x3d2c54['attributes'],'include':_0x3d2c54[_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x3d2c54['include'],function(_0x5432ad){return{'model':db[_0x5432ad[_0x0f0d('0x22')]],'as':_0x5432ad['as'],'attributes':_0x5432ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f0d('0x11')](function(_0x24f594){logger[_0x0f0d('0x12')](_0x0f0d('0x1a'),_0x4cc866);logger[_0x0f0d('0x23')]('GetVoiceQueueReport',_0x4cc866,JSON[_0x0f0d('0x14')](_0x24f594));_0x2a1525(_0x24f594);})[_0x0f0d('0x19')](function(_0x36467f){logger[_0x0f0d('0x15')](_0x0f0d('0x1a'),_0x36467f['message'],_0x4cc866);_0x2b6070(_0x232774[_0x0f0d('0x15')](0x1f4,_0x36467f[_0x0f0d('0x16')]));});});};exports[_0x0f0d('0x24')]=function(_0x4b315a){var _0x240451=this;return new Promise(function(_0x381b93,_0x5bde79){return db[_0x0f0d('0x25')][_0x0f0d('0x26')](_0x4b315a[_0x0f0d('0x27')],{'raw':_0x4b315a[_0x0f0d('0x1c')]?_0x4b315a[_0x0f0d('0x1c')][_0x0f0d('0x28')]===undefined?!![]:![]:!![]})[_0x0f0d('0x11')](function(_0x4ddbbf){logger[_0x0f0d('0x12')](_0x0f0d('0x24'),_0x4b315a);logger[_0x0f0d('0x23')]('CreateVoiceQueueReport',_0x4b315a,JSON['stringify'](_0x4ddbbf));_0x381b93(_0x4ddbbf);})[_0x0f0d('0x19')](function(_0x594c8a){logger[_0x0f0d('0x15')](_0x0f0d('0x24'),_0x594c8a['message'],_0x4b315a);_0x5bde79(_0x240451[_0x0f0d('0x15')](0x1f4,_0x594c8a['message']));});});};exports[_0x0f0d('0x29')]=function(_0x45c928){var _0x3284f5=this;return new Promise(function(_0x84ec4e,_0x3f1508){return db[_0x0f0d('0x25')][_0x0f0d('0x2a')](_0x45c928[_0x0f0d('0x27')],{'raw':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')][_0x0f0d('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c928['options']?_0x45c928['options'][_0x0f0d('0x1d')]||null:null,'attributes':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')]['attributes']||null:null,'limit':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')][_0x0f0d('0x1f')]||null:null})['then'](function(_0x2bda5a){logger['info']('UpdateVoiceQueueReport',_0x45c928);logger[_0x0f0d('0x23')](_0x0f0d('0x29'),_0x45c928,JSON[_0x0f0d('0x14')](_0x2bda5a));_0x84ec4e(_0x2bda5a);})['catch'](function(_0x463cb6){logger[_0x0f0d('0x15')](_0x0f0d('0x29'),_0x463cb6[_0x0f0d('0x16')],_0x45c928);_0x3f1508(_0x3284f5['error'](0x1f4,_0x463cb6[_0x0f0d('0x16')]));});});}; \ No newline at end of file +var _0x6af0=['socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','body','then','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6af0,0x15b));var _0x06af=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x6af0[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x06af('0x0'));var util=require(_0x06af('0x1'));var moment=require('moment');var BPromise=require(_0x06af('0x2'));var rs=require(_0x06af('0x3'));var fs=require('fs');var Redis=require(_0x06af('0x4'));var db=require(_0x06af('0x5'))['db'];var utils=require(_0x06af('0x6'));var logger=require('../../config/logger')(_0x06af('0x7'));var config=require('../../config/environment');var jayson=require(_0x06af('0x8'));var client=jayson['client'][_0x06af('0x9')]({'port':0x232a});config[_0x06af('0xa')]=_[_0x06af('0xb')](config[_0x06af('0xa')],{'host':_0x06af('0xc'),'port':0x18eb});var socket=require(_0x06af('0xd'))(new Redis(config[_0x06af('0xa')]));require('./voiceQueueReport.socket')[_0x06af('0xe')](socket);function respondWithRpcPromise(_0x59b1a4,_0x2b8519,_0x2b3fff){return new BPromise(function(_0x456dd1,_0x636b74){return client[_0x06af('0xf')](_0x59b1a4,_0x2b3fff)['then'](function(_0x389574){logger[_0x06af('0x10')](_0x06af('0x11'),_0x2b8519,'request\x20sent');logger[_0x06af('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2b8519,_0x06af('0x13'),JSON[_0x06af('0x14')](_0x389574));if(_0x389574[_0x06af('0x15')]){if(_0x389574[_0x06af('0x15')]['code']===0x1f4){logger[_0x06af('0x15')](_0x06af('0x11'),_0x2b8519,_0x389574[_0x06af('0x15')]['message']);return _0x636b74(_0x389574[_0x06af('0x15')][_0x06af('0x16')]);}logger[_0x06af('0x15')](_0x06af('0x11'),_0x2b8519,_0x389574['error'][_0x06af('0x16')]);return _0x456dd1(_0x389574[_0x06af('0x15')][_0x06af('0x16')]);}else{logger[_0x06af('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x2b8519,_0x06af('0x13'));_0x456dd1(_0x389574[_0x06af('0x17')]['message']);}})[_0x06af('0x18')](function(_0x407b59){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2b8519,_0x407b59);_0x636b74(_0x407b59);});});}exports['GetVoiceQueueReport']=function(_0x143b04){var _0x184e8e=this;return new Promise(function(_0x58e175,_0x3ba0c6){return db['VoiceQueueReport']['findAll']({'raw':_0x143b04['options']?_0x143b04[_0x06af('0x19')][_0x06af('0x1a')]===undefined?!![]:![]:!![],'where':_0x143b04[_0x06af('0x19')]?_0x143b04['options'][_0x06af('0x1b')]||null:null,'attributes':_0x143b04['options']?_0x143b04[_0x06af('0x19')][_0x06af('0x1c')]||null:null,'limit':_0x143b04['options']?_0x143b04[_0x06af('0x19')][_0x06af('0x1d')]||null:null,'include':_0x143b04[_0x06af('0x19')]?_0x143b04['options']['include']?_[_0x06af('0x1e')](_0x143b04[_0x06af('0x19')][_0x06af('0x1f')],function(_0x167c5a){return{'model':db[_0x167c5a[_0x06af('0x20')]],'as':_0x167c5a['as'],'attributes':_0x167c5a[_0x06af('0x1c')],'include':_0x167c5a[_0x06af('0x1f')]?_[_0x06af('0x1e')](_0x167c5a[_0x06af('0x1f')],function(_0x1b039a){return{'model':db[_0x1b039a[_0x06af('0x20')]],'as':_0x1b039a['as'],'attributes':_0x1b039a[_0x06af('0x1c')],'include':_0x1b039a[_0x06af('0x1f')]?_[_0x06af('0x1e')](_0x1b039a['include'],function(_0x2640da){return{'model':db[_0x2640da[_0x06af('0x20')]],'as':_0x2640da['as'],'attributes':_0x2640da[_0x06af('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f6393){logger[_0x06af('0x10')](_0x06af('0x21'),_0x143b04);logger[_0x06af('0x12')]('GetVoiceQueueReport',_0x143b04,JSON[_0x06af('0x14')](_0x4f6393));_0x58e175(_0x4f6393);})[_0x06af('0x18')](function(_0x39903a){logger[_0x06af('0x15')](_0x06af('0x21'),_0x39903a[_0x06af('0x16')],_0x143b04);_0x3ba0c6(_0x184e8e[_0x06af('0x15')](0x1f4,_0x39903a[_0x06af('0x16')]));});});};exports[_0x06af('0x22')]=function(_0x28c942){var _0x448082=this;return new Promise(function(_0x56003c,_0x50c483){return db[_0x06af('0x23')]['create'](_0x28c942[_0x06af('0x24')],{'raw':_0x28c942[_0x06af('0x19')]?_0x28c942[_0x06af('0x19')][_0x06af('0x1a')]===undefined?!![]:![]:!![]})[_0x06af('0x25')](function(_0xea1b6){logger['info'](_0x06af('0x22'),_0x28c942);logger[_0x06af('0x12')](_0x06af('0x22'),_0x28c942,JSON[_0x06af('0x14')](_0xea1b6));_0x56003c(_0xea1b6);})[_0x06af('0x18')](function(_0x41af24){logger[_0x06af('0x15')](_0x06af('0x22'),_0x41af24[_0x06af('0x16')],_0x28c942);_0x50c483(_0x448082[_0x06af('0x15')](0x1f4,_0x41af24[_0x06af('0x16')]));});});};exports[_0x06af('0x26')]=function(_0x4e683f){var _0x128d94=this;return new Promise(function(_0x152bc4,_0x4bf11c){return db['VoiceQueueReport'][_0x06af('0x27')](_0x4e683f[_0x06af('0x24')],{'raw':_0x4e683f['options']?_0x4e683f[_0x06af('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e683f[_0x06af('0x19')]?_0x4e683f['options']['where']||null:null,'attributes':_0x4e683f[_0x06af('0x19')]?_0x4e683f[_0x06af('0x19')][_0x06af('0x1c')]||null:null,'limit':_0x4e683f['options']?_0x4e683f[_0x06af('0x19')][_0x06af('0x1d')]||null:null})['then'](function(_0x446199){logger[_0x06af('0x10')]('UpdateVoiceQueueReport',_0x4e683f);logger[_0x06af('0x12')](_0x06af('0x26'),_0x4e683f,JSON[_0x06af('0x14')](_0x446199));_0x152bc4(_0x446199);})[_0x06af('0x18')](function(_0x201940){logger[_0x06af('0x15')](_0x06af('0x26'),_0x201940[_0x06af('0x16')],_0x4e683f);_0x4bf11c(_0x128d94['error'](0x1f4,_0x201940[_0x06af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 30fc040..4f084b6 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 _0x180b=['removeListener','register','length','./voiceQueueReport.events','save','remove','emit'];(function(_0x35acd9,_0x46b90a){var _0x421948=function(_0x231930){while(--_0x231930){_0x35acd9['push'](_0x35acd9['shift']());}};_0x421948(++_0x46b90a);}(_0x180b,0xdc));var _0xb180=function(_0x6c532f,_0x7cd1bd){_0x6c532f=_0x6c532f-0x0;var _0x1c30a0=_0x180b[_0x6c532f];return _0x1c30a0;};'use strict';var VoiceQueueReportEvents=require(_0xb180('0x0'));var events=[_0xb180('0x1'),_0xb180('0x2'),'update'];function createListener(_0x2ca54c,_0x73572d){return function(_0xcf0588){_0x73572d[_0xb180('0x3')](_0x2ca54c,_0xcf0588);};}function removeListener(_0x3e3627,_0x19d2d3){return function(){VoiceQueueReportEvents[_0xb180('0x4')](_0x3e3627,_0x19d2d3);};}exports[_0xb180('0x5')]=function(_0x417150){for(var _0x21e952=0x0,_0xb4f0ac=events[_0xb180('0x6')];_0x21e952<_0xb4f0ac;_0x21e952++){var _0x30b656=events[_0x21e952];var _0x274aac=createListener('voiceQueueReport:'+_0x30b656,_0x417150);VoiceQueueReportEvents['on'](_0x30b656,_0x274aac);}}; \ No newline at end of file +var _0x6183=['update','emit','removeListener','register','voiceQueueReport:','save','remove'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x6183,0x19b));var _0x3618=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x6183[_0xed4881];return _0x7fcbd5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x3618('0x0'),_0x3618('0x1'),_0x3618('0x2')];function createListener(_0x576aad,_0x2d9b70){return function(_0x3ec8a8){_0x2d9b70[_0x3618('0x3')](_0x576aad,_0x3ec8a8);};}function removeListener(_0x2d62a7,_0x21af62){return function(){VoiceQueueReportEvents[_0x3618('0x4')](_0x2d62a7,_0x21af62);};}exports[_0x3618('0x5')]=function(_0x1caf4f){for(var _0x3d1f08=0x0,_0x1fe4b5=events['length'];_0x3d1f08<_0x1fe4b5;_0x3d1f08++){var _0x50b4ab=events[_0x3d1f08];var _0x42e73a=createListener(_0x3618('0x6')+_0x50b4ab,_0x1caf4f);VoiceQueueReportEvents['on'](_0x50b4ab,_0x42e73a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ad12529..932f563 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 _0x96a2=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x34cbea,_0x5f0505){var _0x1874e5=function(_0x48923b){while(--_0x48923b){_0x34cbea['push'](_0x34cbea['shift']());}};_0x1874e5(++_0x5f0505);}(_0x96a2,0x96));var _0x296a=function(_0x3a12e7,_0x13fef6){_0x3a12e7=_0x3a12e7-0x0;var _0x390777=_0x96a2[_0x3a12e7];return _0x390777;};'use strict';var multer=require(_0x296a('0x0'));var util=require('util');var path=require(_0x296a('0x1'));var timeout=require(_0x296a('0x2'));var express=require(_0x296a('0x3'));var router=express[_0x296a('0x4')]();var fs_extra=require(_0x296a('0x5'));var auth=require(_0x296a('0x6'));var interaction=require(_0x296a('0x7'));var config=require(_0x296a('0x8'));var controller=require(_0x296a('0x9'));router[_0x296a('0xa')]('/',auth[_0x296a('0xb')](),controller[_0x296a('0xc')]);router[_0x296a('0xa')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0xe')]);router[_0x296a('0xf')]('/',auth[_0x296a('0xb')](),controller['create']);router[_0x296a('0x10')](_0x296a('0xd'),auth['isAuthenticated'](),controller[_0x296a('0x11')]);router[_0x296a('0x12')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0x13')]);module[_0x296a('0x14')]=router; \ No newline at end of file +var _0x6c32=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x2821f0,_0x28ad07){var _0x1ce1b0=function(_0x47b3be){while(--_0x47b3be){_0x2821f0['push'](_0x2821f0['shift']());}};_0x1ce1b0(++_0x28ad07);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var fs_extra=require(_0x26c3('0x6'));var auth=require(_0x26c3('0x7'));var interaction=require(_0x26c3('0x8'));var config=require('../../config/environment');var controller=require(_0x26c3('0x9'));router[_0x26c3('0xa')]('/',auth[_0x26c3('0xb')](),controller['index']);router[_0x26c3('0xa')]('/:id',auth[_0x26c3('0xb')](),controller[_0x26c3('0xc')]);router[_0x26c3('0xd')]('/',auth[_0x26c3('0xb')](),controller[_0x26c3('0xe')]);router[_0x26c3('0xf')](_0x26c3('0x10'),auth[_0x26c3('0xb')](),controller[_0x26c3('0x11')]);router[_0x26c3('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c1263df..6d226df 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 _0xb974=['sequelize','moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x357e60,_0x19aee5){var _0x594546=function(_0x476db3){while(--_0x476db3){_0x357e60['push'](_0x357e60['shift']());}};_0x594546(++_0x19aee5);}(_0xb974,0x1b6));var _0x4b97=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb974[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4b97('0x0'));var moment=require(_0x4b97('0x1'));module[_0x4b97('0x2')]={'time':{'type':Sequelize[_0x4b97('0x3')]},'callid':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4b97('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x4b97('0x5'))}}; \ No newline at end of file +var _0x622d=['sequelize','moment','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x622d,0x108));var _0xd622=function(_0x25e259,_0x3233b8){_0x25e259=_0x25e259-0x0;var _0x51f2be=_0x622d[_0x25e259];return _0x51f2be;};'use strict';var Sequelize=require(_0xd622('0x0'));var moment=require(_0xd622('0x1'));module['exports']={'time':{'type':Sequelize[_0xd622('0x2')]},'callid':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd622('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd622('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xd622('0x4')](_0xd622('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f3c65e8..a4d50bb 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 _0x2833=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','include','rows','show','params','keys','rawAttributes','body','catch','find','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','name','send','index','map','VoiceQueuesLog','type','key','model','query','filters'];(function(_0x4080bd,_0x1680da){var _0x55aa34=function(_0x5f7294){while(--_0x5f7294){_0x4080bd['push'](_0x4080bd['shift']());}};_0x55aa34(++_0x1680da);}(_0x2833,0x165));var _0x3283=function(_0x4fd1f9,_0x7d3902){_0x4fd1f9=_0x4fd1f9-0x0;var _0x3f74e8=_0x2833[_0x4fd1f9];return _0x3f74e8;};'use strict';var emlformat=require(_0x3283('0x0'));var rimraf=require(_0x3283('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3283('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3283('0x3'));var Mustache=require(_0x3283('0x4'));var util=require(_0x3283('0x5'));var path=require(_0x3283('0x6'));var sox=require(_0x3283('0x7'));var csv=require(_0x3283('0x8'));var ejs=require(_0x3283('0x9'));var fs=require('fs');var fs_extra=require(_0x3283('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3283('0xb'));var jsforce=require(_0x3283('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3283('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3283('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3283('0xe'));var as=require(_0x3283('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3283('0x10'))(_0x3283('0x11'));var utils=require(_0x3283('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3283('0x13'))['db'];function respondWithStatusCode(_0x3bc663,_0xe25d5a){_0xe25d5a=_0xe25d5a||0xcc;return function(_0x47de91){if(_0x47de91){return _0x3bc663[_0x3283('0x14')](_0xe25d5a);}return _0x3bc663[_0x3283('0x15')](_0xe25d5a)[_0x3283('0x16')]();};}function respondWithResult(_0x4e3379,_0x5d12a4){_0x5d12a4=_0x5d12a4||0xc8;return function(_0x48c211){if(_0x48c211){return _0x4e3379['status'](_0x5d12a4)['json'](_0x48c211);}};}function respondWithFilteredResult(_0x2c9b48,_0x5c13e5){return function(_0x32718d){if(_0x32718d){var _0x13bdf6=typeof _0x5c13e5[_0x3283('0x17')]===_0x3283('0x18')&&typeof _0x5c13e5[_0x3283('0x19')]===_0x3283('0x18');var _0x127b9f=_0x32718d['count'];var _0x5908fb=_0x13bdf6?0x0:_0x5c13e5[_0x3283('0x17')];var _0x42cffc=_0x13bdf6?_0x32718d[_0x3283('0x1a')]:_0x5c13e5[_0x3283('0x17')]+_0x5c13e5['limit'];var _0x50b6d1;if(_0x42cffc>=_0x127b9f){_0x42cffc=_0x127b9f;_0x50b6d1=0xc8;}else{_0x50b6d1=0xce;}_0x2c9b48[_0x3283('0x15')](_0x50b6d1);return _0x2c9b48[_0x3283('0x1b')](_0x3283('0x1c'),_0x5908fb+'-'+_0x42cffc+'/'+_0x127b9f)[_0x3283('0x1d')](_0x32718d);}return null;};}function patchUpdates(_0x3d1b62){return function(_0xb2f26){try{jsonpatch['apply'](_0xb2f26,_0x3d1b62,!![]);}catch(_0x27bace){return BPromise[_0x3283('0x1e')](_0x27bace);}return _0xb2f26[_0x3283('0x1f')]();};}function saveUpdates(_0x34b3d8,_0x4db89a){return function(_0x215ff5){if(_0x215ff5){return _0x215ff5[_0x3283('0x20')](_0x34b3d8)['then'](function(_0x39d1cf){return _0x39d1cf;});}return null;};}function removeEntity(_0x50efea,_0x3ab096){return function(_0x2c12b3){if(_0x2c12b3){return _0x2c12b3[_0x3283('0x21')]()['then'](function(){_0x50efea['status'](0xcc)[_0x3283('0x16')]();});}};}function handleEntityNotFound(_0x1f9ef6,_0x1454e5){return function(_0x3426da){if(!_0x3426da){_0x1f9ef6[_0x3283('0x14')](0x194);}return _0x3426da;};}function handleError(_0x4f479c,_0x3c1584){_0x3c1584=_0x3c1584||0x1f4;return function(_0x1e2a32){logger[_0x3283('0x22')](_0x1e2a32['stack']);if(_0x1e2a32[_0x3283('0x23')]){delete _0x1e2a32[_0x3283('0x23')];}_0x4f479c[_0x3283('0x15')](_0x3c1584)[_0x3283('0x24')](_0x1e2a32);};}exports[_0x3283('0x25')]=function(_0x47386d,_0x95e762){var _0x5b0982={},_0x1c7ec5={},_0x148b1f={'count':0x0,'rows':[]};var _0x4e3d77=_[_0x3283('0x26')](db[_0x3283('0x27')]['rawAttributes'],function(_0x29d7a8){return{'name':_0x29d7a8['fieldName'],'type':_0x29d7a8[_0x3283('0x28')][_0x3283('0x29')]};});_0x1c7ec5[_0x3283('0x2a')]=_[_0x3283('0x26')](_0x4e3d77,'name');_0x1c7ec5[_0x3283('0x2b')]=_['keys'](_0x47386d[_0x3283('0x2b')]);_0x1c7ec5[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0x1c7ec5['model'],_0x1c7ec5[_0x3283('0x2b')]);_0x5b0982[_0x3283('0x2e')]=_['intersection'](_0x1c7ec5[_0x3283('0x2a')],qs['fields'](_0x47386d[_0x3283('0x2b')]['fields']));_0x5b0982['attributes']=_0x5b0982['attributes'][_0x3283('0x2f')]?_0x5b0982[_0x3283('0x2e')]:_0x1c7ec5[_0x3283('0x2a')];if(!_0x47386d[_0x3283('0x2b')][_0x3283('0x30')](_0x3283('0x31'))){_0x5b0982[_0x3283('0x19')]=qs[_0x3283('0x19')](_0x47386d[_0x3283('0x2b')]['limit']);_0x5b0982[_0x3283('0x17')]=qs[_0x3283('0x17')](_0x47386d[_0x3283('0x2b')][_0x3283('0x17')]);}_0x5b0982[_0x3283('0x32')]=qs[_0x3283('0x33')](_0x47386d[_0x3283('0x2b')]['sort']);_0x5b0982[_0x3283('0x34')]=qs['filters'](_[_0x3283('0x35')](_0x47386d[_0x3283('0x2b')],_0x1c7ec5[_0x3283('0x2c')]),_0x4e3d77);if(_0x47386d['query']['filter']){_0x5b0982[_0x3283('0x34')]=_[_0x3283('0x36')](_0x5b0982[_0x3283('0x34')],{'$or':_[_0x3283('0x26')](_0x4e3d77,function(_0x426200){if(_0x426200[_0x3283('0x28')]!==_0x3283('0x37')){var _0x5ed034={};_0x5ed034[_0x426200[_0x3283('0x23')]]={'$like':'%'+_0x47386d['query']['filter']+'%'};return _0x5ed034;}})});}_0x5b0982=_['merge']({},_0x5b0982,_0x47386d[_0x3283('0x38')]);var _0x2ea829={'where':_0x5b0982[_0x3283('0x34')]};return db[_0x3283('0x27')][_0x3283('0x1a')](_0x2ea829)[_0x3283('0x39')](function(_0x1c500d){_0x148b1f[_0x3283('0x1a')]=_0x1c500d;if(_0x47386d['query']['includeAll']){_0x5b0982[_0x3283('0x3a')]=[{'all':!![]}];}return db[_0x3283('0x27')]['findAll'](_0x5b0982);})[_0x3283('0x39')](function(_0x53891c){_0x148b1f[_0x3283('0x3b')]=_0x53891c;return _0x148b1f;})[_0x3283('0x39')](respondWithFilteredResult(_0x95e762,_0x5b0982))['catch'](handleError(_0x95e762,null));};exports[_0x3283('0x3c')]=function(_0x532cad,_0x17953c){var _0x158299={'raw':!![],'where':{'id':_0x532cad[_0x3283('0x3d')]['id']}},_0x389fff={};_0x389fff[_0x3283('0x2a')]=_[_0x3283('0x3e')](db['VoiceQueuesLog'][_0x3283('0x3f')]);_0x389fff[_0x3283('0x2b')]=_[_0x3283('0x3e')](_0x532cad[_0x3283('0x2b')]);_0x389fff[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0x389fff[_0x3283('0x2a')],_0x389fff[_0x3283('0x2b')]);_0x158299[_0x3283('0x2e')]=_[_0x3283('0x2d')](_0x389fff[_0x3283('0x2a')],qs['fields'](_0x532cad[_0x3283('0x2b')]['fields']));_0x158299[_0x3283('0x2e')]=_0x158299[_0x3283('0x2e')]['length']?_0x158299[_0x3283('0x2e')]:_0x389fff['model'];if(_0x532cad[_0x3283('0x2b')]['includeAll']){_0x158299[_0x3283('0x3a')]=[{'all':!![]}];}_0x158299=_['merge']({},_0x158299,_0x532cad[_0x3283('0x38')]);return db['VoiceQueuesLog']['find'](_0x158299)[_0x3283('0x39')](handleEntityNotFound(_0x17953c,null))[_0x3283('0x39')](respondWithResult(_0x17953c,null))['catch'](handleError(_0x17953c,null));};exports['create']=function(_0x5cf535,_0x42a4c5){return db[_0x3283('0x27')]['create'](_0x5cf535[_0x3283('0x40')],{})[_0x3283('0x39')](respondWithResult(_0x42a4c5,0xc9))[_0x3283('0x41')](handleError(_0x42a4c5,null));};exports[_0x3283('0x20')]=function(_0xe4e372,_0x5ef400){if(_0xe4e372['body']['id']){delete _0xe4e372[_0x3283('0x40')]['id'];}return db[_0x3283('0x27')]['find']({'where':{'id':_0xe4e372['params']['id']}})[_0x3283('0x39')](handleEntityNotFound(_0x5ef400,null))[_0x3283('0x39')](saveUpdates(_0xe4e372[_0x3283('0x40')],null))['then'](respondWithResult(_0x5ef400,null))['catch'](handleError(_0x5ef400,null));};exports[_0x3283('0x21')]=function(_0x70722c,_0x2280d0){return db[_0x3283('0x27')][_0x3283('0x42')]({'where':{'id':_0x70722c['params']['id']}})[_0x3283('0x39')](handleEntityNotFound(_0x2280d0,null))[_0x3283('0x39')](removeEntity(_0x2280d0,null))[_0x3283('0x41')](handleError(_0x2280d0,null));}; \ No newline at end of file +var _0x7f05=['rows','show','params','keys','include','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0x12664f,_0x50e66f){var _0x2e8767=function(_0x224c56){while(--_0x224c56){_0x12664f['push'](_0x12664f['shift']());}};_0x2e8767(++_0x50e66f);}(_0x7f05,0x1bf));var _0x57f0=function(_0x39baa4,_0x4b7dd5){_0x39baa4=_0x39baa4-0x0;var _0x337b6c=_0x7f05[_0x39baa4];return _0x337b6c;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57f0('0x1'));var rp=require(_0x57f0('0x2'));var moment=require(_0x57f0('0x3'));var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require(_0x57f0('0x6'));var path=require(_0x57f0('0x7'));var sox=require('sox');var csv=require(_0x57f0('0x8'));var ejs=require(_0x57f0('0x9'));var fs=require('fs');var fs_extra=require(_0x57f0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57f0('0xb'));var toCsv=require(_0x57f0('0x8'));var querystring=require(_0x57f0('0xc'));var Papa=require(_0x57f0('0xd'));var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57f0('0x12'))(_0x57f0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57f0('0x14'))['db'];function respondWithStatusCode(_0x526231,_0x35243b){_0x35243b=_0x35243b||0xcc;return function(_0x2bef1a){if(_0x2bef1a){return _0x526231['sendStatus'](_0x35243b);}return _0x526231[_0x57f0('0x15')](_0x35243b)[_0x57f0('0x16')]();};}function respondWithResult(_0x5c1474,_0x3ae194){_0x3ae194=_0x3ae194||0xc8;return function(_0x3d59){if(_0x3d59){return _0x5c1474[_0x57f0('0x15')](_0x3ae194)[_0x57f0('0x17')](_0x3d59);}};}function respondWithFilteredResult(_0x35a6ff,_0x19dac4){return function(_0xfa44a0){if(_0xfa44a0){var _0x2be641=typeof _0x19dac4[_0x57f0('0x18')]===_0x57f0('0x19')&&typeof _0x19dac4[_0x57f0('0x1a')]===_0x57f0('0x19');var _0x9331c8=_0xfa44a0['count'];var _0x55ac6c=_0x2be641?0x0:_0x19dac4[_0x57f0('0x18')];var _0x4dd396=_0x2be641?_0xfa44a0[_0x57f0('0x1b')]:_0x19dac4[_0x57f0('0x18')]+_0x19dac4[_0x57f0('0x1a')];var _0x5e99ba;if(_0x4dd396>=_0x9331c8){_0x4dd396=_0x9331c8;_0x5e99ba=0xc8;}else{_0x5e99ba=0xce;}_0x35a6ff[_0x57f0('0x15')](_0x5e99ba);return _0x35a6ff[_0x57f0('0x1c')]('Content-Range',_0x55ac6c+'-'+_0x4dd396+'/'+_0x9331c8)[_0x57f0('0x17')](_0xfa44a0);}return null;};}function patchUpdates(_0x4e1951){return function(_0xba4ca0){try{jsonpatch[_0x57f0('0x1d')](_0xba4ca0,_0x4e1951,!![]);}catch(_0x3e7ce3){return BPromise[_0x57f0('0x1e')](_0x3e7ce3);}return _0xba4ca0[_0x57f0('0x1f')]();};}function saveUpdates(_0x9bc24e,_0x5e481c){return function(_0xc89b44){if(_0xc89b44){return _0xc89b44[_0x57f0('0x20')](_0x9bc24e)['then'](function(_0x55be0d){return _0x55be0d;});}return null;};}function removeEntity(_0x5329bd,_0x4b9dc0){return function(_0x36d7e2){if(_0x36d7e2){return _0x36d7e2[_0x57f0('0x21')]()[_0x57f0('0x22')](function(){_0x5329bd['status'](0xcc)[_0x57f0('0x16')]();});}};}function handleEntityNotFound(_0x564e2b,_0x14ae30){return function(_0x378d3c){if(!_0x378d3c){_0x564e2b['sendStatus'](0x194);}return _0x378d3c;};}function handleError(_0x5ca989,_0x482a31){_0x482a31=_0x482a31||0x1f4;return function(_0x14ed8a){logger[_0x57f0('0x23')](_0x14ed8a[_0x57f0('0x24')]);if(_0x14ed8a['name']){delete _0x14ed8a[_0x57f0('0x25')];}_0x5ca989[_0x57f0('0x15')](_0x482a31)[_0x57f0('0x26')](_0x14ed8a);};}exports['index']=function(_0x3f124e,_0x3df6d8){var _0x5d50ec={},_0x39fca7={},_0x169d31={'count':0x0,'rows':[]};var _0x3b68a1=_[_0x57f0('0x27')](db[_0x57f0('0x28')][_0x57f0('0x29')],function(_0x2dd93c){return{'name':_0x2dd93c[_0x57f0('0x2a')],'type':_0x2dd93c['type'][_0x57f0('0x2b')]};});_0x39fca7[_0x57f0('0x2c')]=_[_0x57f0('0x27')](_0x3b68a1,_0x57f0('0x25'));_0x39fca7[_0x57f0('0x2d')]=_['keys'](_0x3f124e[_0x57f0('0x2d')]);_0x39fca7[_0x57f0('0x2e')]=_[_0x57f0('0x2f')](_0x39fca7[_0x57f0('0x2c')],_0x39fca7[_0x57f0('0x2d')]);_0x5d50ec[_0x57f0('0x30')]=_[_0x57f0('0x2f')](_0x39fca7[_0x57f0('0x2c')],qs[_0x57f0('0x31')](_0x3f124e['query'][_0x57f0('0x31')]));_0x5d50ec['attributes']=_0x5d50ec[_0x57f0('0x30')][_0x57f0('0x32')]?_0x5d50ec[_0x57f0('0x30')]:_0x39fca7[_0x57f0('0x2c')];if(!_0x3f124e[_0x57f0('0x2d')][_0x57f0('0x33')](_0x57f0('0x34'))){_0x5d50ec[_0x57f0('0x1a')]=qs[_0x57f0('0x1a')](_0x3f124e['query'][_0x57f0('0x1a')]);_0x5d50ec['offset']=qs[_0x57f0('0x18')](_0x3f124e[_0x57f0('0x2d')][_0x57f0('0x18')]);}_0x5d50ec[_0x57f0('0x35')]=qs['sort'](_0x3f124e[_0x57f0('0x2d')][_0x57f0('0x36')]);_0x5d50ec['where']=qs[_0x57f0('0x2e')](_[_0x57f0('0x37')](_0x3f124e[_0x57f0('0x2d')],_0x39fca7[_0x57f0('0x2e')]),_0x3b68a1);if(_0x3f124e[_0x57f0('0x2d')][_0x57f0('0x38')]){_0x5d50ec[_0x57f0('0x39')]=_[_0x57f0('0x3a')](_0x5d50ec[_0x57f0('0x39')],{'$or':_['map'](_0x3b68a1,function(_0x5dcb49){if(_0x5dcb49[_0x57f0('0x3b')]!==_0x57f0('0x3c')){var _0x3d6883={};_0x3d6883[_0x5dcb49[_0x57f0('0x25')]]={'$like':'%'+_0x3f124e['query'][_0x57f0('0x38')]+'%'};return _0x3d6883;}})});}_0x5d50ec=_[_0x57f0('0x3a')]({},_0x5d50ec,_0x3f124e[_0x57f0('0x3d')]);var _0x1f4dff={'where':_0x5d50ec[_0x57f0('0x39')]};return db['VoiceQueuesLog'][_0x57f0('0x1b')](_0x1f4dff)['then'](function(_0xce8c2c){_0x169d31[_0x57f0('0x1b')]=_0xce8c2c;if(_0x3f124e[_0x57f0('0x2d')][_0x57f0('0x3e')]){_0x5d50ec['include']=[{'all':!![]}];}return db[_0x57f0('0x28')][_0x57f0('0x3f')](_0x5d50ec);})[_0x57f0('0x22')](function(_0x1de96f){_0x169d31[_0x57f0('0x40')]=_0x1de96f;return _0x169d31;})[_0x57f0('0x22')](respondWithFilteredResult(_0x3df6d8,_0x5d50ec))['catch'](handleError(_0x3df6d8,null));};exports[_0x57f0('0x41')]=function(_0x3e3461,_0xbe51f5){var _0x4e2413={'raw':!![],'where':{'id':_0x3e3461[_0x57f0('0x42')]['id']}},_0x2d4e7c={};_0x2d4e7c['model']=_[_0x57f0('0x43')](db[_0x57f0('0x28')][_0x57f0('0x29')]);_0x2d4e7c['query']=_[_0x57f0('0x43')](_0x3e3461['query']);_0x2d4e7c[_0x57f0('0x2e')]=_[_0x57f0('0x2f')](_0x2d4e7c[_0x57f0('0x2c')],_0x2d4e7c[_0x57f0('0x2d')]);_0x4e2413[_0x57f0('0x30')]=_['intersection'](_0x2d4e7c['model'],qs['fields'](_0x3e3461[_0x57f0('0x2d')][_0x57f0('0x31')]));_0x4e2413[_0x57f0('0x30')]=_0x4e2413[_0x57f0('0x30')][_0x57f0('0x32')]?_0x4e2413[_0x57f0('0x30')]:_0x2d4e7c[_0x57f0('0x2c')];if(_0x3e3461[_0x57f0('0x2d')][_0x57f0('0x3e')]){_0x4e2413[_0x57f0('0x44')]=[{'all':!![]}];}_0x4e2413=_[_0x57f0('0x3a')]({},_0x4e2413,_0x3e3461[_0x57f0('0x3d')]);return db['VoiceQueuesLog'][_0x57f0('0x45')](_0x4e2413)[_0x57f0('0x22')](handleEntityNotFound(_0xbe51f5,null))['then'](respondWithResult(_0xbe51f5,null))[_0x57f0('0x46')](handleError(_0xbe51f5,null));};exports[_0x57f0('0x47')]=function(_0x1a776e,_0x39f3fe){return db[_0x57f0('0x28')][_0x57f0('0x47')](_0x1a776e[_0x57f0('0x48')],{})[_0x57f0('0x22')](respondWithResult(_0x39f3fe,0xc9))[_0x57f0('0x46')](handleError(_0x39f3fe,null));};exports[_0x57f0('0x20')]=function(_0xbf42a6,_0x154bf7){if(_0xbf42a6['body']['id']){delete _0xbf42a6[_0x57f0('0x48')]['id'];}return db[_0x57f0('0x28')][_0x57f0('0x45')]({'where':{'id':_0xbf42a6[_0x57f0('0x42')]['id']}})[_0x57f0('0x22')](handleEntityNotFound(_0x154bf7,null))['then'](saveUpdates(_0xbf42a6['body'],null))['then'](respondWithResult(_0x154bf7,null))[_0x57f0('0x46')](handleError(_0x154bf7,null));};exports['destroy']=function(_0x10699e,_0x14c4a5){return db[_0x57f0('0x28')][_0x57f0('0x45')]({'where':{'id':_0x10699e['params']['id']}})['then'](handleEntityNotFound(_0x14c4a5,null))[_0x57f0('0x22')](removeEntity(_0x14c4a5,null))[_0x57f0('0x46')](handleError(_0x14c4a5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2ff260f..c3e0519 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 _0xaba3=['event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaba3,0x123));var _0x3aba=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xaba3[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x3aba('0x0'));var util=require(_0x3aba('0x1'));var logger=require(_0x3aba('0x2'))(_0x3aba('0x3'));var moment=require(_0x3aba('0x4'));var BPromise=require(_0x3aba('0x5'));var rp=require(_0x3aba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aba('0x7'));var config=require(_0x3aba('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x3aba('0x9')]=function(_0x4744b6,_0x244b06){return _0x4744b6[_0x3aba('0xa')](_0x3aba('0xb'),attributes,{'tableName':_0x3aba('0xc'),'paranoid':![],'indexes':[{'name':_0x3aba('0xd'),'fields':[_0x3aba('0xe'),_0x3aba('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xefc8=['rimraf','../../config/environment','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1f6553,_0x278aa0){var _0x5206da=function(_0x22510d){while(--_0x22510d){_0x1f6553['push'](_0x1f6553['shift']());}};_0x5206da(++_0x278aa0);}(_0xefc8,0xf8));var _0x8efc=function(_0x4a2d7f,_0x12e713){_0x4a2d7f=_0x4a2d7f-0x0;var _0x5d498c=_0xefc8[_0x4a2d7f];return _0x5d498c;};'use strict';var _=require(_0x8efc('0x0'));var util=require(_0x8efc('0x1'));var logger=require('../../config/logger')(_0x8efc('0x2'));var moment=require(_0x8efc('0x3'));var BPromise=require(_0x8efc('0x4'));var rp=require(_0x8efc('0x5'));var fs=require('fs');var path=require(_0x8efc('0x6'));var rimraf=require(_0x8efc('0x7'));var config=require(_0x8efc('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4fb691,_0x5aee43){return _0x4fb691[_0x8efc('0x9')](_0x8efc('0xa'),attributes,{'tableName':_0x8efc('0xb'),'paranoid':![],'indexes':[{'name':_0x8efc('0xc'),'fields':[_0x8efc('0xd'),_0x8efc('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index be250f2..acf0f66 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 _0x7f8c=['http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xd8afde,_0xb44716){var _0xac65e8=function(_0x27e613){while(--_0x27e613){_0xd8afde['push'](_0xd8afde['shift']());}};_0xac65e8(++_0xb44716);}(_0x7f8c,0x139));var _0xc7f8=function(_0x251fb0,_0x529c14){_0x251fb0=_0x251fb0-0x0;var _0x1519c5=_0x7f8c[_0x251fb0];return _0x1519c5;};'use strict';var _=require(_0xc7f8('0x0'));var util=require(_0xc7f8('0x1'));var moment=require(_0xc7f8('0x2'));var BPromise=require(_0xc7f8('0x3'));var rs=require(_0xc7f8('0x4'));var fs=require('fs');var Redis=require(_0xc7f8('0x5'));var db=require(_0xc7f8('0x6'))['db'];var utils=require(_0xc7f8('0x7'));var logger=require(_0xc7f8('0x8'))('rpc');var config=require(_0xc7f8('0x9'));var jayson=require(_0xc7f8('0xa'));var client=jayson[_0xc7f8('0xb')][_0xc7f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e747c,_0x4103c2,_0x289b0c){return new BPromise(function(_0x504ac1,_0xf64a22){return client['request'](_0x2e747c,_0x289b0c)[_0xc7f8('0xd')](function(_0x4d1667){logger[_0xc7f8('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,_0xc7f8('0xf'));logger[_0xc7f8('0x10')](_0xc7f8('0x11'),_0x4103c2,'request\x20sent',JSON[_0xc7f8('0x12')](_0x4d1667));if(_0x4d1667[_0xc7f8('0x13')]){if(_0x4d1667[_0xc7f8('0x13')][_0xc7f8('0x14')]===0x1f4){logger[_0xc7f8('0x13')](_0xc7f8('0x15'),_0x4103c2,_0x4d1667[_0xc7f8('0x13')]['message']);return _0xf64a22(_0x4d1667['error'][_0xc7f8('0x16')]);}logger[_0xc7f8('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,_0x4d1667['error'][_0xc7f8('0x16')]);return _0x504ac1(_0x4d1667[_0xc7f8('0x13')][_0xc7f8('0x16')]);}else{logger[_0xc7f8('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,'request\x20sent');_0x504ac1(_0x4d1667[_0xc7f8('0x17')][_0xc7f8('0x16')]);}})[_0xc7f8('0x18')](function(_0x5098fe){logger[_0xc7f8('0x13')](_0xc7f8('0x15'),_0x4103c2,_0x5098fe);_0xf64a22(_0x5098fe);});});} \ No newline at end of file +var _0x3ce2=['../../config/utils','rpc','../../config/environment','client','http','request','then','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2c6527,_0x13f73d){var _0x3fec5f=function(_0x104d88){while(--_0x104d88){_0x2c6527['push'](_0x2c6527['shift']());}};_0x3fec5f(++_0x13f73d);}(_0x3ce2,0x192));var _0x23ce=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x3ce2[_0x1344d6];return _0xf45b24;};'use strict';var _=require(_0x23ce('0x0'));var util=require(_0x23ce('0x1'));var moment=require('moment');var BPromise=require(_0x23ce('0x2'));var rs=require(_0x23ce('0x3'));var fs=require('fs');var Redis=require(_0x23ce('0x4'));var db=require(_0x23ce('0x5'))['db'];var utils=require(_0x23ce('0x6'));var logger=require('../../config/logger')(_0x23ce('0x7'));var config=require(_0x23ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23ce('0x9')][_0x23ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cc37c,_0x310467,_0x21a757){return new BPromise(function(_0x443d5f,_0x5f03c6){return client[_0x23ce('0xb')](_0x3cc37c,_0x21a757)[_0x23ce('0xc')](function(_0x5cf7a9){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x310467,'request\x20sent');logger[_0x23ce('0xd')](_0x23ce('0xe'),_0x310467,_0x23ce('0xf'),JSON[_0x23ce('0x10')](_0x5cf7a9));if(_0x5cf7a9[_0x23ce('0x11')]){if(_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x12')]===0x1f4){logger['error'](_0x23ce('0x13'),_0x310467,_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x14')]);return _0x5f03c6(_0x5cf7a9['error'][_0x23ce('0x14')]);}logger['error'](_0x23ce('0x13'),_0x310467,_0x5cf7a9['error']['message']);return _0x443d5f(_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x14')]);}else{logger[_0x23ce('0x15')](_0x23ce('0x13'),_0x310467,_0x23ce('0xf'));_0x443d5f(_0x5cf7a9[_0x23ce('0x16')][_0x23ce('0x14')]);}})[_0x23ce('0x17')](function(_0x25f787){logger[_0x23ce('0x11')](_0x23ce('0x13'),_0x310467,_0x25f787);_0x5f03c6(_0x25f787);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index fafcdbb..a493950 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 _0xe20d=['downloadTranscribe','post','create','/:id/transcribe','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xe20d,0x175));var _0xde20=function(_0x49f2bf,_0x461315){_0x49f2bf=_0x49f2bf-0x0;var _0x1897ac=_0xe20d[_0x49f2bf];return _0x1897ac;};'use strict';var multer=require(_0xde20('0x0'));var util=require('util');var path=require(_0xde20('0x1'));var timeout=require(_0xde20('0x2'));var express=require(_0xde20('0x3'));var router=express[_0xde20('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde20('0x5'));var interaction=require(_0xde20('0x6'));var config=require(_0xde20('0x7'));var controller=require(_0xde20('0x8'));router[_0xde20('0x9')]('/',auth['isAuthenticated'](),controller[_0xde20('0xa')]);router[_0xde20('0x9')]('/describe',auth[_0xde20('0xb')](),controller[_0xde20('0xc')]);router[_0xde20('0x9')](_0xde20('0xd'),auth[_0xde20('0xb')](),controller['show']);router[_0xde20('0x9')](_0xde20('0xe'),auth[_0xde20('0xb')](),controller[_0xde20('0xf')]);router[_0xde20('0x9')](_0xde20('0x10'),controller['downloads']);router[_0xde20('0x9')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xde20('0x11')]);router[_0xde20('0x12')]('/',auth[_0xde20('0xb')](),controller[_0xde20('0x13')]);router[_0xde20('0x12')](_0xde20('0x14'),auth[_0xde20('0xb')](),controller['runTranscribe']);router[_0xde20('0x15')](_0xde20('0xd'),auth['isAuthenticated'](),controller[_0xde20('0x16')]);router[_0xde20('0x17')](_0xde20('0xd'),auth['isAuthenticated'](),controller[_0xde20('0x18')]);module[_0xde20('0x19')]=router; \ No newline at end of file +var _0x1907=['download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download'];(function(_0x809314,_0xaf27c0){var _0x1a94b6=function(_0x450f50){while(--_0x450f50){_0x809314['push'](_0x809314['shift']());}};_0x1a94b6(++_0xaf27c0);}(_0x1907,0xb5));var _0x7190=function(_0x11df8c,_0x4eb038){_0x11df8c=_0x11df8c-0x0;var _0x4d16b1=_0x1907[_0x11df8c];return _0x4d16b1;};'use strict';var multer=require(_0x7190('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7190('0x1'));var express=require(_0x7190('0x2'));var router=express['Router']();var fs_extra=require(_0x7190('0x3'));var auth=require(_0x7190('0x4'));var interaction=require(_0x7190('0x5'));var config=require(_0x7190('0x6'));var controller=require(_0x7190('0x7'));router[_0x7190('0x8')]('/',auth[_0x7190('0x9')](),controller[_0x7190('0xa')]);router[_0x7190('0x8')]('/describe',auth[_0x7190('0x9')](),controller[_0x7190('0xb')]);router[_0x7190('0x8')](_0x7190('0xc'),auth[_0x7190('0x9')](),controller[_0x7190('0xd')]);router[_0x7190('0x8')](_0x7190('0xe'),auth[_0x7190('0x9')](),controller[_0x7190('0xf')]);router[_0x7190('0x8')](_0x7190('0x10'),controller[_0x7190('0x11')]);router[_0x7190('0x8')](_0x7190('0x12'),auth['isAuthenticated'](),controller[_0x7190('0x13')]);router[_0x7190('0x14')]('/',auth['isAuthenticated'](),controller[_0x7190('0x15')]);router[_0x7190('0x14')](_0x7190('0x12'),auth[_0x7190('0x9')](),controller[_0x7190('0x16')]);router[_0x7190('0x17')]('/:id',auth[_0x7190('0x9')](),controller[_0x7190('0x18')]);router[_0x7190('0x19')](_0x7190('0xc'),auth['isAuthenticated'](),controller[_0x7190('0x1a')]);module[_0x7190('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 64a5339..e512160 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 b46f437..d3c5374 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 _0xe6c6=['pick','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','length','include','create','body','update','describe','download','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','Sequelize','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','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','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x769a35,_0x2ac76a){var _0x3c21af=function(_0x502ac3){while(--_0x502ac3){_0x769a35['push'](_0x769a35['shift']());}};_0x3c21af(++_0x2ac76a);}(_0xe6c6,0xf9));var _0x6e6c=function(_0x33a75c,_0x4b9993){_0x33a75c=_0x33a75c-0x0;var _0x5e4aa7=_0xe6c6[_0x33a75c];return _0x5e4aa7;};'use strict';var emlformat=require(_0x6e6c('0x0'));var rimraf=require(_0x6e6c('0x1'));var zipdir=require(_0x6e6c('0x2'));var jsonpatch=require(_0x6e6c('0x3'));var rp=require(_0x6e6c('0x4'));var moment=require(_0x6e6c('0x5'));var BPromise=require(_0x6e6c('0x6'));var Mustache=require(_0x6e6c('0x7'));var util=require(_0x6e6c('0x8'));var path=require(_0x6e6c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e6c('0xa'));var fs=require('fs');var fs_extra=require(_0x6e6c('0xb'));var _=require(_0x6e6c('0xc'));var squel=require(_0x6e6c('0xd'));var crypto=require(_0x6e6c('0xe'));var jsforce=require(_0x6e6c('0xf'));var deskjs=require(_0x6e6c('0x10'));var toCsv=require(_0x6e6c('0x11'));var querystring=require(_0x6e6c('0x12'));var Papa=require(_0x6e6c('0x13'));var AWS=require(_0x6e6c('0x14'));var uuidv4=require(_0x6e6c('0x15'));var Redis=require(_0x6e6c('0x16'));var authService=require(_0x6e6c('0x17'));var qs=require(_0x6e6c('0x18'));var as=require(_0x6e6c('0x19'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e6c('0x1a'))(_0x6e6c('0x1b'));var utils=require(_0x6e6c('0x1c'));var config=require(_0x6e6c('0x1d'));var licenseUtil=require(_0x6e6c('0x1e'));var db=require(_0x6e6c('0x1f'))['db'];function respondWithStatusCode(_0x17f996,_0xdbb83c){_0xdbb83c=_0xdbb83c||0xcc;return function(_0x5502ed){if(_0x5502ed){return _0x17f996[_0x6e6c('0x20')](_0xdbb83c);}return _0x17f996[_0x6e6c('0x21')](_0xdbb83c)[_0x6e6c('0x22')]();};}function respondWithResult(_0x31efa6,_0x3a731c){_0x3a731c=_0x3a731c||0xc8;return function(_0x58ad2e){if(_0x58ad2e){return _0x31efa6[_0x6e6c('0x21')](_0x3a731c)[_0x6e6c('0x23')](_0x58ad2e);}};}function respondWithFilteredResult(_0xe58846,_0x4a9d6f){return function(_0x3f91f5){if(_0x3f91f5){var _0x2bcf50=typeof _0x4a9d6f[_0x6e6c('0x24')]===_0x6e6c('0x25')&&typeof _0x4a9d6f[_0x6e6c('0x26')]===_0x6e6c('0x25');var _0x275109=_0x3f91f5['count'];var _0x54fa0d=_0x2bcf50?0x0:_0x4a9d6f[_0x6e6c('0x24')];var _0x56d7de=_0x2bcf50?_0x3f91f5[_0x6e6c('0x27')]:_0x4a9d6f[_0x6e6c('0x24')]+_0x4a9d6f[_0x6e6c('0x26')];var _0x4c3644;if(_0x56d7de>=_0x275109){_0x56d7de=_0x275109;_0x4c3644=0xc8;}else{_0x4c3644=0xce;}_0xe58846[_0x6e6c('0x21')](_0x4c3644);return _0xe58846['set'](_0x6e6c('0x28'),_0x54fa0d+'-'+_0x56d7de+'/'+_0x275109)[_0x6e6c('0x23')](_0x3f91f5);}return null;};}function patchUpdates(_0x1a8102){return function(_0x26c8a2){try{jsonpatch[_0x6e6c('0x29')](_0x26c8a2,_0x1a8102,!![]);}catch(_0x420db0){return BPromise[_0x6e6c('0x2a')](_0x420db0);}return _0x26c8a2['save']();};}function saveUpdates(_0x5c603f,_0x542719){return function(_0x5f5d68){if(_0x5f5d68){return _0x5f5d68['update'](_0x5c603f)[_0x6e6c('0x2b')](function(_0x2ddf04){return _0x2ddf04;});}return null;};}function removeEntity(_0x272f29,_0x4518a9){return function(_0x2b3ab6){if(_0x2b3ab6){return _0x2b3ab6[_0x6e6c('0x2c')]()[_0x6e6c('0x2b')](function(){_0x272f29[_0x6e6c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378e2f,_0x43ad4b){return function(_0x59a749){if(!_0x59a749){_0x378e2f[_0x6e6c('0x20')](0x194);}return _0x59a749;};}function handleError(_0x2418e0,_0x42845f){_0x42845f=_0x42845f||0x1f4;return function(_0x38b7d3){logger[_0x6e6c('0x2d')](_0x38b7d3['stack']);if(_0x38b7d3[_0x6e6c('0x2e')]){delete _0x38b7d3[_0x6e6c('0x2e')];}_0x2418e0[_0x6e6c('0x21')](_0x42845f)[_0x6e6c('0x2f')](_0x38b7d3);};}exports[_0x6e6c('0x30')]=function(_0x43d79a,_0x2d6500){var _0x473f7f={},_0x48cdf5={},_0x5a5814={'count':0x0,'rows':[]};var _0xb4f945=_[_0x6e6c('0x31')](db[_0x6e6c('0x32')][_0x6e6c('0x33')],function(_0x2a8013){return{'name':_0x2a8013[_0x6e6c('0x34')],'type':_0x2a8013[_0x6e6c('0x35')]['key']};});_0x48cdf5[_0x6e6c('0x36')]=_['differenceBy'](_[_0x6e6c('0x31')](_0xb4f945,_0x6e6c('0x2e')),[_0x6e6c('0x37')]);_0x48cdf5[_0x6e6c('0x38')]=_[_0x6e6c('0x39')](_0x43d79a[_0x6e6c('0x38')]);_0x48cdf5['filters']=_[_0x6e6c('0x3a')](_0x48cdf5[_0x6e6c('0x36')],_0x48cdf5[_0x6e6c('0x38')]);_0x473f7f[_0x6e6c('0x3b')]=_[_0x6e6c('0x3a')](_0x48cdf5[_0x6e6c('0x36')],qs[_0x6e6c('0x3c')](_0x43d79a['query'][_0x6e6c('0x3c')]));_0x473f7f[_0x6e6c('0x3b')]=_0x473f7f[_0x6e6c('0x3b')]['length']?_0x473f7f['attributes']:_0x48cdf5[_0x6e6c('0x36')];if(!_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x3d')](_0x6e6c('0x3e'))){_0x473f7f[_0x6e6c('0x26')]=qs[_0x6e6c('0x26')](_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x26')]);_0x473f7f[_0x6e6c('0x24')]=qs['offset'](_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x24')]);}_0x473f7f['order']=qs[_0x6e6c('0x3f')](_0x43d79a[_0x6e6c('0x38')]['sort']);_0x473f7f[_0x6e6c('0x40')]=qs['filters'](_[_0x6e6c('0x41')](_0x43d79a[_0x6e6c('0x38')],_0x48cdf5[_0x6e6c('0x42')]),_0xb4f945);if(_0x43d79a[_0x6e6c('0x38')]['filter']){_0x473f7f[_0x6e6c('0x40')]=_['merge'](_0x473f7f[_0x6e6c('0x40')],{'$or':_[_0x6e6c('0x31')](_0xb4f945,function(_0x5a98b0){if(_0x5a98b0[_0x6e6c('0x35')]!==_0x6e6c('0x43')){var _0x59bdf7={};_0x59bdf7[_0x5a98b0[_0x6e6c('0x2e')]]={'$like':'%'+_0x43d79a['query'][_0x6e6c('0x44')]+'%'};return _0x59bdf7;}})});}_0x473f7f=_[_0x6e6c('0x45')]({},_0x473f7f,_0x43d79a[_0x6e6c('0x46')]);var _0x126449={'where':_0x473f7f[_0x6e6c('0x40')]};return db[_0x6e6c('0x32')][_0x6e6c('0x27')](_0x126449)[_0x6e6c('0x2b')](function(_0x137645){_0x5a5814[_0x6e6c('0x27')]=_0x137645;if(_0x43d79a['query'][_0x6e6c('0x47')]){_0x473f7f['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x6e6c('0x48')](_0x473f7f);})['then'](function(_0x15d1d4){_0x5a5814[_0x6e6c('0x49')]=_0x15d1d4;return _0x5a5814;})[_0x6e6c('0x2b')](respondWithFilteredResult(_0x2d6500,_0x473f7f))[_0x6e6c('0x4a')](handleError(_0x2d6500,null));};exports['show']=function(_0x40623e,_0x1cdb89){var _0x416ff9={'raw':![],'where':{'id':_0x40623e[_0x6e6c('0x4b')]['id']}},_0x47e087={};_0x47e087[_0x6e6c('0x36')]=_[_0x6e6c('0x39')](db[_0x6e6c('0x32')][_0x6e6c('0x33')]);_0x47e087[_0x6e6c('0x38')]=_['keys'](_0x40623e['query']);_0x47e087['filters']=_[_0x6e6c('0x3a')](_0x47e087[_0x6e6c('0x36')],_0x47e087[_0x6e6c('0x38')]);_0x416ff9[_0x6e6c('0x3b')]=_[_0x6e6c('0x3a')](_0x47e087[_0x6e6c('0x36')],qs[_0x6e6c('0x3c')](_0x40623e['query'][_0x6e6c('0x3c')]));_0x416ff9[_0x6e6c('0x3b')]=_0x416ff9[_0x6e6c('0x3b')][_0x6e6c('0x4c')]?_0x416ff9[_0x6e6c('0x3b')]:_0x47e087[_0x6e6c('0x36')];if(_0x40623e['query'][_0x6e6c('0x47')]){_0x416ff9[_0x6e6c('0x4d')]=[{'all':!![]}];}_0x416ff9=_[_0x6e6c('0x45')]({},_0x416ff9,_0x40623e['options']);return db[_0x6e6c('0x32')]['find'](_0x416ff9)['then'](handleEntityNotFound(_0x1cdb89,null))['then'](respondWithResult(_0x1cdb89,null))[_0x6e6c('0x4a')](handleError(_0x1cdb89,null));};exports[_0x6e6c('0x4e')]=function(_0xd550d9,_0x3dd040){return db['VoiceRecording'][_0x6e6c('0x4e')](_0xd550d9[_0x6e6c('0x4f')],{})[_0x6e6c('0x2b')](respondWithResult(_0x3dd040,0xc9))[_0x6e6c('0x4a')](handleError(_0x3dd040,null));};exports[_0x6e6c('0x50')]=function(_0x1d915b,_0xe49b36){if(_0x1d915b['body']['id']){delete _0x1d915b['body']['id'];}return db[_0x6e6c('0x32')]['find']({'where':{'id':_0x1d915b[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](handleEntityNotFound(_0xe49b36,null))['then'](saveUpdates(_0x1d915b[_0x6e6c('0x4f')],null))[_0x6e6c('0x2b')](respondWithResult(_0xe49b36,null))[_0x6e6c('0x4a')](handleError(_0xe49b36,null));};exports[_0x6e6c('0x51')]=function(_0x18a919,_0x2b6944){return db[_0x6e6c('0x32')][_0x6e6c('0x51')]()[_0x6e6c('0x2b')](respondWithResult(_0x2b6944,null))[_0x6e6c('0x4a')](handleError(_0x2b6944,null));};exports[_0x6e6c('0x52')]=function(_0x56431b,_0x29857d,_0x5358e7){var _0x36ecb1=require('../../components/encryptor');var _0x4d13fb=![];var _0x4dab82={};if(_0x56431b['query'][_0x6e6c('0x35')]&&_0x56431b[_0x6e6c('0x38')]['type']==='uniqueid'){_0x4dab82[_0x6e6c('0x53')]=_0x56431b[_0x6e6c('0x4b')]['id'];}else{_0x4dab82['id']=_0x56431b[_0x6e6c('0x4b')]['id'];}return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':_0x4dab82,'attributes':['id',_0x6e6c('0x55')],'raw':!![]})[_0x6e6c('0x2b')](handleEntityNotFound(_0x29857d,null))[_0x6e6c('0x2b')](function(_0x32f048){if(_0x32f048){var _0x452217=_0x32f048[_0x6e6c('0x55')];var _0x47a7d5=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x452217);if(fs[_0x6e6c('0x57')](_0x47a7d5)){_0x4d13fb=!![];return _0x36ecb1[_0x6e6c('0x58')](_0x47a7d5,_0x452217,config[_0x6e6c('0x59')][_0x6e6c('0x5a')])['then'](function(){return _0x32f048;});}return _0x32f048;}})[_0x6e6c('0x2b')](function(_0x48cf6e){if(_0x48cf6e){var _0x1c7243=_0x48cf6e[_0x6e6c('0x55')];if(!fs[_0x6e6c('0x57')](_0x1c7243)){throw new db['Sequelize'][(_0x6e6c('0x5b'))](_0x6e6c('0x5c'));}if(_0x48cf6e[_0x6e6c('0x5d')]){return _0x29857d[_0x6e6c('0x52')](_0x1c7243,_0x48cf6e[_0x6e6c('0x5d')]+path['extname'](_0x1c7243),function(){if(_0x4d13fb){fs[_0x6e6c('0x5e')](_0x1c7243);}});}else{return _0x29857d[_0x6e6c('0x52')](_0x1c7243,function(_0x1cc366){if(_0x4d13fb){fs[_0x6e6c('0x5e')](_0x1c7243);}});}}})[_0x6e6c('0x4a')](function(_0x1f396a){if(_0x1f396a[_0x6e6c('0x5f')]==='VoiceRecording\x20not\x20found'){_0x29857d[_0x6e6c('0x21')](0x194)[_0x6e6c('0x2f')](_0x6e6c('0x60'));}else{return handleError(_0x29857d,null);}});};exports[_0x6e6c('0x61')]=function(_0x99624a,_0x15d3a9,_0x475060){var _0x58c5a4=require(_0x6e6c('0x62'));var _0x192762=![];var _0x4ba9fd={'$and':[db[_0x6e6c('0x63')][_0x6e6c('0x40')](db[_0x6e6c('0x63')]['fn'](_0x6e6c('0x64'),db[_0x6e6c('0x63')][_0x6e6c('0x65')]('uniqueid')),_0x99624a['query']['token'])]};if(_0x99624a[_0x6e6c('0x38')][_0x6e6c('0x35')]&&_0x99624a[_0x6e6c('0x38')]['type']===_0x6e6c('0x53')){_0x4ba9fd[_0x6e6c('0x66')]['push']({'uniqueid':_0x99624a['params']['id']});}else{_0x4ba9fd[_0x6e6c('0x66')][_0x6e6c('0x67')]({'id':_0x99624a[_0x6e6c('0x4b')]['id']});}return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':_0x4ba9fd,'attributes':['id',_0x6e6c('0x55')],'raw':!![]})[_0x6e6c('0x2b')](handleEntityNotFound(_0x15d3a9,null))[_0x6e6c('0x2b')](function(_0x2761ab){if(_0x2761ab){var _0x195abf=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x2761ab['value']);if(fs[_0x6e6c('0x57')](_0x195abf)){_0x192762=!![];return _0x58c5a4[_0x6e6c('0x58')](_0x195abf,_0x2761ab[_0x6e6c('0x55')],config['secrets'][_0x6e6c('0x5a')])[_0x6e6c('0x2b')](function(){return _0x2761ab;});}return _0x2761ab;}})[_0x6e6c('0x2b')](function(_0x4bd608){if(_0x4bd608){if(!fs[_0x6e6c('0x57')](_0x4bd608['value'])){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))](_0x6e6c('0x5c'));}if(_0x4bd608[_0x6e6c('0x5d')]){return _0x15d3a9['download'](_0x4bd608['value'],_0x4bd608[_0x6e6c('0x5d')]+path[_0x6e6c('0x69')](_0x4bd608[_0x6e6c('0x55')]),function(){if(_0x192762){fs[_0x6e6c('0x5e')](_0x4bd608[_0x6e6c('0x55')]);}});}else{return _0x15d3a9['download'](_0x4bd608[_0x6e6c('0x55')],function(_0x4b5de5){if(_0x192762){fs[_0x6e6c('0x5e')](_0x4bd608['value']);}});}}})[_0x6e6c('0x4a')](handleError(_0x15d3a9,null));};exports[_0x6e6c('0x2c')]=function(_0x1e76f7,_0x389276){return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':{'id':_0x1e76f7['params']['id']}})[_0x6e6c('0x2b')](function(_0x29a1ef){if(_[_0x6e6c('0x6a')](_0x29a1ef)){throw new ReferenceError(_0x6e6c('0x6b'));}return _0x29a1ef;})['then'](function(_0x1d5e05){var _0x5e7fb1=_0x1d5e05[_0x6e6c('0x55')];logger[_0x6e6c('0x6c')](_0x6e6c('0x6d'),_0x5e7fb1);if(!_[_0x6e6c('0x6a')](_0x1d5e05[_0x6e6c('0x55')])&&fs[_0x6e6c('0x57')](_0x5e7fb1)){logger[_0x6e6c('0x6c')](_0x6e6c('0x6e')+_0x5e7fb1+_0x6e6c('0x6f'));fs[_0x6e6c('0x70')](_0x5e7fb1);}_0x5e7fb1=_0x5e7fb1+'.cypher';if(!_['isNil'](_0x1d5e05[_0x6e6c('0x55')])&&fs['existsSync'](_0x5e7fb1)){logger[_0x6e6c('0x6c')](_0x6e6c('0x6e')+_0x5e7fb1+_0x6e6c('0x6f'));fs[_0x6e6c('0x70')](_0x5e7fb1);}return _0x1d5e05;})['then'](function(_0x264f78){if(!_0x264f78)throw new InternalError();return _0x264f78[_0x6e6c('0x2c')]();})['then'](function(){_0x389276[_0x6e6c('0x21')](0xcc)[_0x6e6c('0x22')]();})[_0x6e6c('0x4a')](handleError(_0x389276,null));};function getBucketslist(_0x2e1891,_0xc1f4e,_0x366e00){return new Promise(function(_0x3b5f31,_0x1be532){var _0x37d56e=new AWS['S3']({'accessKeyId':_0xc1f4e,'secretAccessKey':_0x2e1891,'region':_0x366e00});_0x37d56e[_0x6e6c('0x71')]({},function(_0x35c1b6,_0x32faa9){if(_0x35c1b6){return _0x1be532(_0x35c1b6);}else{return _0x3b5f31(_0x32faa9);}});});}function createBucket(_0x52a04a,_0x4421fb,_0x1c2913,_0xd3d5d2){return new Promise(function(_0x59fb2b,_0x258517){var _0x5bff9d=new AWS['S3']({'accessKeyId':_0x4421fb,'secretAccessKey':_0x52a04a,'region':_0x1c2913});_0x5bff9d['createBucket']({'Bucket':_0xd3d5d2},function(_0x4a824a,_0x23d6df){if(_0x4a824a){return _0x258517(_0x4a824a);}else{return _0x59fb2b(_0x23d6df);}});});}function uploadFile(_0x2103bc,_0x1da89f,_0x3842b1,_0x536b8d,_0x1c7ec8,_0x25ff9c){return new Promise(function(_0x445526,_0x442afd){var _0x2dbd6b=new AWS['S3']({'accessKeyId':_0x1da89f,'secretAccessKey':_0x2103bc,'region':_0x3842b1});_0x2dbd6b[_0x6e6c('0x72')]({'Bucket':_0x536b8d,'Key':_0x1c7ec8,'Body':_0x25ff9c},function(_0x154c85,_0x1fa4a3){if(_0x154c85){return _0x442afd(_0x154c85);}else{return _0x445526(_0x1fa4a3);}});});}function startTranscribe(_0x4ce854,_0xb7d34a,_0x1ef718,_0x670685,_0x463ec6,_0x15a6f8){return new Promise(function(_0xa70228,_0x296896){var _0x3b6d2b=new AWS[(_0x6e6c('0x73'))]({'accessKeyId':_0xb7d34a,'secretAccessKey':_0x4ce854,'region':_0x1ef718});_0x3b6d2b[_0x6e6c('0x74')]({'TranscriptionJobName':_0x670685,'LanguageCode':_0x463ec6,'Media':{'MediaFileUri':_0x15a6f8}},function(_0x3cea15,_0x2d674b){if(_0x3cea15){return _0x296896(_0x3cea15);}else{return _0xa70228(_0x2d674b);}});});}function transcribe(_0x4e5b42,_0x4217ab,_0x490512,_0x11c38f,_0x4bdd82,_0x46b86b,_0x35dc74){return new Promise(function(_0x419874,_0x241913){var _0x1aa152={};logger[_0x6e6c('0x6c')](util[_0x6e6c('0x37')](_0x6e6c('0x75'),_0x4e5b42,_0x4bdd82));return uploadFile(_0x4217ab,_0x490512,_0x11c38f,_0x4bdd82,path[_0x6e6c('0x76')](_0x46b86b),fs['readFileSync'](_0x46b86b))[_0x6e6c('0x2b')](function(_0x244caf){logger[_0x6e6c('0x6c')](util['format'](_0x6e6c('0x77'),_0x4e5b42,_0x4bdd82,_0x244caf[_0x6e6c('0x78')]));_0x1aa152[_0x6e6c('0x79')]=_0x244caf[_0x6e6c('0x7a')];_0x1aa152[_0x6e6c('0x7b')]=_0x244caf[_0x6e6c('0x78')];logger[_0x6e6c('0x6c')](util[_0x6e6c('0x37')](_0x6e6c('0x7c'),_0x4e5b42));return startTranscribe(_0x4217ab,_0x490512,_0x11c38f,uuidv4(),_0x35dc74,_0x244caf['Location']);})['then'](function(_0x22354e){logger[_0x6e6c('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4e5b42,_0x22354e['TranscriptionJob']['TranscriptionJobName']));_0x1aa152[_0x6e6c('0x7d')]=_0x22354e['TranscriptionJob']['TranscriptionJobName'];_0x1aa152['transcribeStatus']=_0x22354e[_0x6e6c('0x7e')][_0x6e6c('0x7f')];return _0x419874(_0x1aa152);})[_0x6e6c('0x4a')](function(_0x498afa){return _0x241913(_0x498afa);});});}exports[_0x6e6c('0x80')]=function(_0x22c6d4,_0x2a11ef,_0x4621de){var _0x306826;var _0x3ed98d;var _0x5141f5;var _0x158692=require(_0x6e6c('0x62'));return db[_0x6e6c('0x32')]['findOne']({'where':{'id':_0x22c6d4[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](function(_0x187b55){if(_0x187b55){var _0x57da4d=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x187b55['value']);if(fs[_0x6e6c('0x57')](_0x57da4d)){cypher=!![];return _0x158692[_0x6e6c('0x58')](_0x57da4d,_0x187b55[_0x6e6c('0x55')],config[_0x6e6c('0x59')]['recording'])[_0x6e6c('0x2b')](function(){return _0x187b55;});}return _0x187b55;}})[_0x6e6c('0x2b')](function(_0x4e552a){if(!_0x4e552a){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))]('Voice\x20Recording\x20not\x20found');}_0x3ed98d=_0x4e552a;return db[_0x6e6c('0x81')][_0x6e6c('0x82')]({'where':{'id':0x1}});})[_0x6e6c('0x2b')](handleEntityNotFound(_0x2a11ef,null))[_0x6e6c('0x2b')](function(_0x5217fe){if(_0x5217fe){_0x306826=_0x5217fe;if(!_0x306826[_0x6e6c('0x83')]||!_0x306826[_0x6e6c('0x84')]||!_0x306826['transcribeRegion']||!_0x306826[_0x6e6c('0x85')]||!_0x306826[_0x6e6c('0x79')]){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))](_0x6e6c('0x86'));}if(_0x22c6d4[_0x6e6c('0x4f')]['runSentiment']&&(!_0x306826[_0x6e6c('0x87')]||!_0x306826[_0x6e6c('0x88')]||!_0x306826[_0x6e6c('0x89')]||!_0x306826[_0x6e6c('0x85')]||!_0x306826[_0x6e6c('0x79')])){throw new db[(_0x6e6c('0x68'))]['ValidationError'](_0x6e6c('0x8a'));}return db[_0x6e6c('0x8b')][_0x6e6c('0x82')]({'where':{'id':_0x306826[_0x6e6c('0x84')]}});}})[_0x6e6c('0x2b')](function(_0x4a9b74){if(!_0x4a9b74){throw new db['Sequelize'][(_0x6e6c('0x5b'))](_0x6e6c('0x8c'));}if(!_0x4a9b74[_0x6e6c('0x8d')]||!_0x4a9b74['data2']){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x5141f5=_0x4a9b74;return getBucketslist(_0x5141f5[_0x6e6c('0x8d')],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')]);})[_0x6e6c('0x2b')](function(_0x204ad0){if(_0x204ad0&&_0x204ad0['Buckets']){var _0x4c1886=_['find'](_0x204ad0['Buckets'],function(_0x62b391){return _0x62b391['Name']===_0x306826[_0x6e6c('0x79')];});if(!_0x4c1886){logger['info'](util['format'](_0x6e6c('0x90'),_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x306826[_0x6e6c('0x79')]));return createBucket(_0x5141f5['data1'],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')],_0x306826[_0x6e6c('0x79')]);}logger[_0x6e6c('0x6c')](util['format'](_0x6e6c('0x91'),_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x306826['bucket']));return;}})['then'](function(_0x117d15){if(_0x3ed98d[_0x6e6c('0x92')]===_0x6e6c('0x93')){return transcribe(_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x5141f5[_0x6e6c('0x8d')],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')],_0x306826['bucket'],_0x3ed98d[_0x6e6c('0x55')],_0x306826['language']);}else{logger[_0x6e6c('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x22c6d4[_0x6e6c('0x4b')]['id']));return{'transcribeStatus':_0x6e6c('0x94')};}})['then'](function(_0x2d3a2d){if(_0x2d3a2d){_0x2d3a2d['tempSentiment']=_0x22c6d4[_0x6e6c('0x4f')][_0x6e6c('0x95')];return _0x3ed98d[_0x6e6c('0x96')](_0x2d3a2d);}})[_0x6e6c('0x2b')](respondWithResult(_0x2a11ef,null))['catch'](handleError(_0x2a11ef,null));};function writeFile(_0x1303c6,_0x441f20){return new Promise(function(_0x4a2faa,_0x5e6a78){fs[_0x6e6c('0x97')](_0x441f20,_0x1303c6,function(_0xcf70f8,_0x578cca){if(_0xcf70f8){return _0x5e6a78(_0xcf70f8);}else{return _0x4a2faa(_0x578cca);}});});}exports[_0x6e6c('0x98')]=function(_0x117d8d,_0x712fe0,_0xe338cd){return db[_0x6e6c('0x32')][_0x6e6c('0x82')]({'where':{'id':_0x117d8d[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](handleEntityNotFound(_0x712fe0))[_0x6e6c('0x2b')](function(_0x582a8e){if(_0x582a8e&&_0x582a8e[_0x6e6c('0x99')]){var _0x1450d5=_0x582a8e[_0x6e6c('0x99')];var _0x28197c=config[_0x6e6c('0x9a')]+_0x6e6c('0x9b')+_0x582a8e['id']+_0x6e6c('0x9c');if(fs['existsSync'](_0x28197c)){return _0x28197c;}return writeFile(_0x1450d5,_0x28197c)['then'](function(){return _0x28197c;});}else{throw new db[(_0x6e6c('0x68'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x6e6c('0x2b')](function(_0x4d224a){return _0x712fe0[_0x6e6c('0x52')](_0x4d224a);})[_0x6e6c('0x4a')](handleError(_0x712fe0));}; \ No newline at end of file +var _0x3bfa=['apply','reject','update','then','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','format','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','params','keys','find','create','body','catch','describe','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','VoiceRecording\x20not\x20found','download','filename','extname','unlink','downloads','../../components/encryptor','MD5','sequelize','col','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','recording','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set'];(function(_0x3859ea,_0x100232){var _0xab0da9=function(_0x7117ad){while(--_0x7117ad){_0x3859ea['push'](_0x3859ea['shift']());}};_0xab0da9(++_0x100232);}(_0x3bfa,0x75));var _0xa3bf=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3bfa[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0xa3bf('0x0'));var rimraf=require(_0xa3bf('0x1'));var zipdir=require(_0xa3bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3bf('0x3'));var moment=require(_0xa3bf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa3bf('0x5'));var util=require(_0xa3bf('0x6'));var path=require(_0xa3bf('0x7'));var sox=require(_0xa3bf('0x8'));var csv=require(_0xa3bf('0x9'));var ejs=require(_0xa3bf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3bf('0xb'));var squel=require(_0xa3bf('0xc'));var crypto=require(_0xa3bf('0xd'));var jsforce=require(_0xa3bf('0xe'));var deskjs=require(_0xa3bf('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa3bf('0x10'));var Papa=require(_0xa3bf('0x11'));var AWS=require(_0xa3bf('0x12'));var uuidv4=require(_0xa3bf('0x13'));var Redis=require(_0xa3bf('0x14'));var authService=require(_0xa3bf('0x15'));var qs=require(_0xa3bf('0x16'));var as=require(_0xa3bf('0x17'));var hardwareService=require(_0xa3bf('0x18'));var logger=require(_0xa3bf('0x19'))(_0xa3bf('0x1a'));var utils=require(_0xa3bf('0x1b'));var config=require(_0xa3bf('0x1c'));var licenseUtil=require(_0xa3bf('0x1d'));var db=require(_0xa3bf('0x1e'))['db'];function respondWithStatusCode(_0x30b5eb,_0x446d57){_0x446d57=_0x446d57||0xcc;return function(_0x7366ff){if(_0x7366ff){return _0x30b5eb[_0xa3bf('0x1f')](_0x446d57);}return _0x30b5eb['status'](_0x446d57)[_0xa3bf('0x20')]();};}function respondWithResult(_0x3ac473,_0x5432bc){_0x5432bc=_0x5432bc||0xc8;return function(_0x1c92ff){if(_0x1c92ff){return _0x3ac473[_0xa3bf('0x21')](_0x5432bc)[_0xa3bf('0x22')](_0x1c92ff);}};}function respondWithFilteredResult(_0x30b178,_0x8c6c4f){return function(_0x3331ca){if(_0x3331ca){var _0x46a28f=typeof _0x8c6c4f[_0xa3bf('0x23')]===_0xa3bf('0x24')&&typeof _0x8c6c4f['limit']===_0xa3bf('0x24');var _0x140588=_0x3331ca[_0xa3bf('0x25')];var _0x110e80=_0x46a28f?0x0:_0x8c6c4f[_0xa3bf('0x23')];var _0x5098f4=_0x46a28f?_0x3331ca[_0xa3bf('0x25')]:_0x8c6c4f[_0xa3bf('0x23')]+_0x8c6c4f[_0xa3bf('0x26')];var _0x19d477;if(_0x5098f4>=_0x140588){_0x5098f4=_0x140588;_0x19d477=0xc8;}else{_0x19d477=0xce;}_0x30b178[_0xa3bf('0x21')](_0x19d477);return _0x30b178[_0xa3bf('0x27')]('Content-Range',_0x110e80+'-'+_0x5098f4+'/'+_0x140588)[_0xa3bf('0x22')](_0x3331ca);}return null;};}function patchUpdates(_0x523ad8){return function(_0x20f644){try{jsonpatch[_0xa3bf('0x28')](_0x20f644,_0x523ad8,!![]);}catch(_0x5701c7){return BPromise[_0xa3bf('0x29')](_0x5701c7);}return _0x20f644['save']();};}function saveUpdates(_0x5340bc,_0x5472ee){return function(_0x1cace1){if(_0x1cace1){return _0x1cace1[_0xa3bf('0x2a')](_0x5340bc)[_0xa3bf('0x2b')](function(_0x4372c4){return _0x4372c4;});}return null;};}function removeEntity(_0x505220,_0x3035fa){return function(_0x558262){if(_0x558262){return _0x558262['destroy']()[_0xa3bf('0x2b')](function(){_0x505220[_0xa3bf('0x21')](0xcc)[_0xa3bf('0x20')]();});}};}function handleEntityNotFound(_0xdf9847,_0x3d76aa){return function(_0x553265){if(!_0x553265){_0xdf9847[_0xa3bf('0x1f')](0x194);}return _0x553265;};}function handleError(_0x384e1d,_0x562d9c){_0x562d9c=_0x562d9c||0x1f4;return function(_0x2839f3){logger[_0xa3bf('0x2c')](_0x2839f3[_0xa3bf('0x2d')]);if(_0x2839f3[_0xa3bf('0x2e')]){delete _0x2839f3['name'];}_0x384e1d[_0xa3bf('0x21')](_0x562d9c)[_0xa3bf('0x2f')](_0x2839f3);};}exports[_0xa3bf('0x30')]=function(_0xe38d39,_0x757c48){var _0x1e1620={},_0x822e69={},_0x19441a={'count':0x0,'rows':[]};var _0x270d9=_['map'](db[_0xa3bf('0x31')][_0xa3bf('0x32')],function(_0x358ef4){return{'name':_0x358ef4[_0xa3bf('0x33')],'type':_0x358ef4['type'][_0xa3bf('0x34')]};});_0x822e69[_0xa3bf('0x35')]=_[_0xa3bf('0x36')](_[_0xa3bf('0x37')](_0x270d9,_0xa3bf('0x2e')),[_0xa3bf('0x38')]);_0x822e69[_0xa3bf('0x39')]=_['keys'](_0xe38d39[_0xa3bf('0x39')]);_0x822e69['filters']=_['intersection'](_0x822e69['model'],_0x822e69[_0xa3bf('0x39')]);_0x1e1620['attributes']=_[_0xa3bf('0x3a')](_0x822e69[_0xa3bf('0x35')],qs[_0xa3bf('0x3b')](_0xe38d39[_0xa3bf('0x39')][_0xa3bf('0x3b')]));_0x1e1620['attributes']=_0x1e1620[_0xa3bf('0x3c')][_0xa3bf('0x3d')]?_0x1e1620['attributes']:_0x822e69[_0xa3bf('0x35')];if(!_0xe38d39[_0xa3bf('0x39')][_0xa3bf('0x3e')](_0xa3bf('0x3f'))){_0x1e1620[_0xa3bf('0x26')]=qs[_0xa3bf('0x26')](_0xe38d39['query'][_0xa3bf('0x26')]);_0x1e1620['offset']=qs[_0xa3bf('0x23')](_0xe38d39['query'][_0xa3bf('0x23')]);}_0x1e1620[_0xa3bf('0x40')]=qs[_0xa3bf('0x41')](_0xe38d39[_0xa3bf('0x39')]['sort']);_0x1e1620['where']=qs[_0xa3bf('0x42')](_[_0xa3bf('0x43')](_0xe38d39[_0xa3bf('0x39')],_0x822e69[_0xa3bf('0x42')]),_0x270d9);if(_0xe38d39[_0xa3bf('0x39')][_0xa3bf('0x44')]){_0x1e1620[_0xa3bf('0x45')]=_[_0xa3bf('0x46')](_0x1e1620[_0xa3bf('0x45')],{'$or':_[_0xa3bf('0x37')](_0x270d9,function(_0x30d89b){if(_0x30d89b[_0xa3bf('0x47')]!==_0xa3bf('0x48')){var _0x15263d={};_0x15263d[_0x30d89b[_0xa3bf('0x2e')]]={'$like':'%'+_0xe38d39['query']['filter']+'%'};return _0x15263d;}})});}_0x1e1620=_[_0xa3bf('0x46')]({},_0x1e1620,_0xe38d39[_0xa3bf('0x49')]);var _0x2d0518={'where':_0x1e1620[_0xa3bf('0x45')]};return db['VoiceRecording'][_0xa3bf('0x25')](_0x2d0518)['then'](function(_0x353994){_0x19441a[_0xa3bf('0x25')]=_0x353994;if(_0xe38d39['query'][_0xa3bf('0x4a')]){_0x1e1620[_0xa3bf('0x4b')]=[{'all':!![]}];}return db['VoiceRecording'][_0xa3bf('0x4c')](_0x1e1620);})[_0xa3bf('0x2b')](function(_0x6167be){_0x19441a['rows']=_0x6167be;return _0x19441a;})[_0xa3bf('0x2b')](respondWithFilteredResult(_0x757c48,_0x1e1620))['catch'](handleError(_0x757c48,null));};exports['show']=function(_0x4b8ea4,_0x1f70db){var _0x28b0ad={'raw':![],'where':{'id':_0x4b8ea4[_0xa3bf('0x4d')]['id']}},_0xeab242={};_0xeab242[_0xa3bf('0x35')]=_[_0xa3bf('0x4e')](db[_0xa3bf('0x31')][_0xa3bf('0x32')]);_0xeab242[_0xa3bf('0x39')]=_[_0xa3bf('0x4e')](_0x4b8ea4[_0xa3bf('0x39')]);_0xeab242[_0xa3bf('0x42')]=_[_0xa3bf('0x3a')](_0xeab242[_0xa3bf('0x35')],_0xeab242[_0xa3bf('0x39')]);_0x28b0ad['attributes']=_['intersection'](_0xeab242[_0xa3bf('0x35')],qs[_0xa3bf('0x3b')](_0x4b8ea4[_0xa3bf('0x39')][_0xa3bf('0x3b')]));_0x28b0ad[_0xa3bf('0x3c')]=_0x28b0ad['attributes']['length']?_0x28b0ad[_0xa3bf('0x3c')]:_0xeab242[_0xa3bf('0x35')];if(_0x4b8ea4[_0xa3bf('0x39')][_0xa3bf('0x4a')]){_0x28b0ad['include']=[{'all':!![]}];}_0x28b0ad=_[_0xa3bf('0x46')]({},_0x28b0ad,_0x4b8ea4[_0xa3bf('0x49')]);return db[_0xa3bf('0x31')][_0xa3bf('0x4f')](_0x28b0ad)[_0xa3bf('0x2b')](handleEntityNotFound(_0x1f70db,null))[_0xa3bf('0x2b')](respondWithResult(_0x1f70db,null))['catch'](handleError(_0x1f70db,null));};exports[_0xa3bf('0x50')]=function(_0x57e766,_0x18de95){return db[_0xa3bf('0x31')][_0xa3bf('0x50')](_0x57e766[_0xa3bf('0x51')],{})[_0xa3bf('0x2b')](respondWithResult(_0x18de95,0xc9))[_0xa3bf('0x52')](handleError(_0x18de95,null));};exports[_0xa3bf('0x2a')]=function(_0x14ebd7,_0xa1234b){if(_0x14ebd7[_0xa3bf('0x51')]['id']){delete _0x14ebd7['body']['id'];}return db[_0xa3bf('0x31')][_0xa3bf('0x4f')]({'where':{'id':_0x14ebd7[_0xa3bf('0x4d')]['id']}})[_0xa3bf('0x2b')](handleEntityNotFound(_0xa1234b,null))[_0xa3bf('0x2b')](saveUpdates(_0x14ebd7[_0xa3bf('0x51')],null))[_0xa3bf('0x2b')](respondWithResult(_0xa1234b,null))[_0xa3bf('0x52')](handleError(_0xa1234b,null));};exports['describe']=function(_0x3cf009,_0x592f2e){return db[_0xa3bf('0x31')][_0xa3bf('0x53')]()['then'](respondWithResult(_0x592f2e,null))['catch'](handleError(_0x592f2e,null));};exports['download']=function(_0x11c5e6,_0x164f22,_0x5c4e59){var _0x40e8f0=require('../../components/encryptor');var _0x40da3e=![];var _0x55dff5={};if(_0x11c5e6[_0xa3bf('0x39')][_0xa3bf('0x47')]&&_0x11c5e6[_0xa3bf('0x39')][_0xa3bf('0x47')]===_0xa3bf('0x54')){_0x55dff5[_0xa3bf('0x54')]=_0x11c5e6['params']['id'];}else{_0x55dff5['id']=_0x11c5e6['params']['id'];}return db[_0xa3bf('0x31')][_0xa3bf('0x4f')]({'where':_0x55dff5,'attributes':['id',_0xa3bf('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x164f22,null))['then'](function(_0x4fc851){if(_0x4fc851){var _0x57e36d=_0x4fc851[_0xa3bf('0x55')];var _0x1ab803=util[_0xa3bf('0x38')](_0xa3bf('0x56'),_0x57e36d);if(fs[_0xa3bf('0x57')](_0x1ab803)){_0x40da3e=!![];return _0x40e8f0['decryptFile'](_0x1ab803,_0x57e36d,config[_0xa3bf('0x58')]['recording'])[_0xa3bf('0x2b')](function(){return _0x4fc851;});}return _0x4fc851;}})[_0xa3bf('0x2b')](function(_0x2d166f){if(_0x2d166f){var _0xa39a58=_0x2d166f[_0xa3bf('0x55')];if(!fs[_0xa3bf('0x57')](_0xa39a58)){throw new db[(_0xa3bf('0x59'))]['ValidationError'](_0xa3bf('0x5a'));}if(_0x2d166f['filename']){return _0x164f22[_0xa3bf('0x5b')](_0xa39a58,_0x2d166f[_0xa3bf('0x5c')]+path[_0xa3bf('0x5d')](_0xa39a58),function(){if(_0x40da3e){fs[_0xa3bf('0x5e')](_0xa39a58);}});}else{return _0x164f22['download'](_0xa39a58,function(_0x171cef){if(_0x40da3e){fs['unlink'](_0xa39a58);}});}}})['catch'](function(_0x360982){if(_0x360982['message']===_0xa3bf('0x5a')){_0x164f22['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x164f22,null);}});};exports[_0xa3bf('0x5f')]=function(_0x363a5c,_0x4e9603,_0x51e1dd){var _0x4aa747=require(_0xa3bf('0x60'));var _0x879eaf=![];var _0x50bc78={'$and':[db['sequelize'][_0xa3bf('0x45')](db['sequelize']['fn'](_0xa3bf('0x61'),db[_0xa3bf('0x62')][_0xa3bf('0x63')](_0xa3bf('0x54'))),_0x363a5c['query'][_0xa3bf('0x64')])]};if(_0x363a5c[_0xa3bf('0x39')]['type']&&_0x363a5c[_0xa3bf('0x39')][_0xa3bf('0x47')]===_0xa3bf('0x54')){_0x50bc78[_0xa3bf('0x65')][_0xa3bf('0x66')]({'uniqueid':_0x363a5c[_0xa3bf('0x4d')]['id']});}else{_0x50bc78[_0xa3bf('0x65')][_0xa3bf('0x66')]({'id':_0x363a5c[_0xa3bf('0x4d')]['id']});}return db['VoiceRecording'][_0xa3bf('0x4f')]({'where':_0x50bc78,'attributes':['id',_0xa3bf('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x4e9603,null))[_0xa3bf('0x2b')](function(_0x16c245){if(_0x16c245){var _0x146a1d=util[_0xa3bf('0x38')](_0xa3bf('0x56'),_0x16c245[_0xa3bf('0x55')]);if(fs['existsSync'](_0x146a1d)){_0x879eaf=!![];return _0x4aa747[_0xa3bf('0x67')](_0x146a1d,_0x16c245['value'],config[_0xa3bf('0x58')]['recording'])[_0xa3bf('0x2b')](function(){return _0x16c245;});}return _0x16c245;}})[_0xa3bf('0x2b')](function(_0xbf6ffc){if(_0xbf6ffc){if(!fs[_0xa3bf('0x57')](_0xbf6ffc[_0xa3bf('0x55')])){throw new db[(_0xa3bf('0x59'))]['ValidationError'](_0xa3bf('0x5a'));}if(_0xbf6ffc['filename']){return _0x4e9603[_0xa3bf('0x5b')](_0xbf6ffc[_0xa3bf('0x55')],_0xbf6ffc[_0xa3bf('0x5c')]+path['extname'](_0xbf6ffc['value']),function(){if(_0x879eaf){fs[_0xa3bf('0x5e')](_0xbf6ffc[_0xa3bf('0x55')]);}});}else{return _0x4e9603[_0xa3bf('0x5b')](_0xbf6ffc['value'],function(_0x9f448d){if(_0x879eaf){fs[_0xa3bf('0x5e')](_0xbf6ffc[_0xa3bf('0x55')]);}});}}})['catch'](handleError(_0x4e9603,null));};exports['destroy']=function(_0x538794,_0x571e9a){return db[_0xa3bf('0x31')][_0xa3bf('0x4f')]({'where':{'id':_0x538794[_0xa3bf('0x4d')]['id']}})[_0xa3bf('0x2b')](function(_0x2e93a2){if(_[_0xa3bf('0x68')](_0x2e93a2)){throw new ReferenceError(_0xa3bf('0x69'));}return _0x2e93a2;})[_0xa3bf('0x2b')](function(_0x512061){var _0x5d4c20=_0x512061[_0xa3bf('0x55')];logger[_0xa3bf('0x6a')](_0xa3bf('0x6b'),_0x5d4c20);if(!_[_0xa3bf('0x68')](_0x512061['value'])&&fs[_0xa3bf('0x57')](_0x5d4c20)){logger[_0xa3bf('0x6a')]('File:\x20\x22'+_0x5d4c20+_0xa3bf('0x6c'));fs[_0xa3bf('0x6d')](_0x5d4c20);}_0x5d4c20=_0x5d4c20+_0xa3bf('0x6e');if(!_[_0xa3bf('0x68')](_0x512061['value'])&&fs[_0xa3bf('0x57')](_0x5d4c20)){logger['info']('File:\x20\x22'+_0x5d4c20+_0xa3bf('0x6c'));fs['unlinkSync'](_0x5d4c20);}return _0x512061;})[_0xa3bf('0x2b')](function(_0xa49a8c){if(!_0xa49a8c)throw new InternalError();return _0xa49a8c[_0xa3bf('0x6f')]();})['then'](function(){_0x571e9a[_0xa3bf('0x21')](0xcc)['end']();})[_0xa3bf('0x52')](handleError(_0x571e9a,null));};function getBucketslist(_0xb62d53,_0x26f44b,_0x18dada){return new Promise(function(_0x454a03,_0x261efd){var _0xd1c0a0=new AWS['S3']({'accessKeyId':_0x26f44b,'secretAccessKey':_0xb62d53,'region':_0x18dada});_0xd1c0a0[_0xa3bf('0x70')]({},function(_0x4ce078,_0xbaef2f){if(_0x4ce078){return _0x261efd(_0x4ce078);}else{return _0x454a03(_0xbaef2f);}});});}function createBucket(_0x1fdac6,_0x1f9c4c,_0x555dc9,_0x32315b){return new Promise(function(_0x582029,_0x39ae69){var _0x12cd31=new AWS['S3']({'accessKeyId':_0x1f9c4c,'secretAccessKey':_0x1fdac6,'region':_0x555dc9});_0x12cd31[_0xa3bf('0x71')]({'Bucket':_0x32315b},function(_0x404de9,_0x42da7d){if(_0x404de9){return _0x39ae69(_0x404de9);}else{return _0x582029(_0x42da7d);}});});}function uploadFile(_0x226ae3,_0x3c0f91,_0x433afb,_0x4b238b,_0x194b14,_0xed99af){return new Promise(function(_0x12c009,_0x43863){var _0x2878e2=new AWS['S3']({'accessKeyId':_0x3c0f91,'secretAccessKey':_0x226ae3,'region':_0x433afb});_0x2878e2[_0xa3bf('0x72')]({'Bucket':_0x4b238b,'Key':_0x194b14,'Body':_0xed99af},function(_0x3f3693,_0x28ebeb){if(_0x3f3693){return _0x43863(_0x3f3693);}else{return _0x12c009(_0x28ebeb);}});});}function startTranscribe(_0x3fd6ab,_0x52cd90,_0x1e67a3,_0x40697f,_0x1fad03,_0x2021f2){return new Promise(function(_0x3c2e4a,_0x146af9){var _0x38d08d=new AWS[(_0xa3bf('0x73'))]({'accessKeyId':_0x52cd90,'secretAccessKey':_0x3fd6ab,'region':_0x1e67a3});_0x38d08d['startTranscriptionJob']({'TranscriptionJobName':_0x40697f,'LanguageCode':_0x1fad03,'Media':{'MediaFileUri':_0x2021f2}},function(_0x1808f5,_0x349622){if(_0x1808f5){return _0x146af9(_0x1808f5);}else{return _0x3c2e4a(_0x349622);}});});}function transcribe(_0x59b8dc,_0x9689c4,_0x83e95a,_0x1dbb71,_0x1f8be0,_0xc54c31,_0x2265f2){return new Promise(function(_0x366aba,_0x3dc12b){var _0x3903ab={};logger[_0xa3bf('0x6a')](util[_0xa3bf('0x38')](_0xa3bf('0x74'),_0x59b8dc,_0x1f8be0));return uploadFile(_0x9689c4,_0x83e95a,_0x1dbb71,_0x1f8be0,path[_0xa3bf('0x75')](_0xc54c31),fs[_0xa3bf('0x76')](_0xc54c31))[_0xa3bf('0x2b')](function(_0x198667){logger[_0xa3bf('0x6a')](util[_0xa3bf('0x38')](_0xa3bf('0x77'),_0x59b8dc,_0x1f8be0,_0x198667[_0xa3bf('0x78')]));_0x3903ab[_0xa3bf('0x79')]=_0x198667['Bucket'];_0x3903ab['location']=_0x198667[_0xa3bf('0x78')];logger[_0xa3bf('0x6a')](util[_0xa3bf('0x38')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x59b8dc));return startTranscribe(_0x9689c4,_0x83e95a,_0x1dbb71,uuidv4(),_0x2265f2,_0x198667[_0xa3bf('0x78')]);})[_0xa3bf('0x2b')](function(_0x38c01a){logger[_0xa3bf('0x6a')](util['format'](_0xa3bf('0x7a'),_0x59b8dc,_0x38c01a[_0xa3bf('0x7b')][_0xa3bf('0x7c')]));_0x3903ab['transcribeName']=_0x38c01a[_0xa3bf('0x7b')][_0xa3bf('0x7c')];_0x3903ab[_0xa3bf('0x7d')]=_0x38c01a['TranscriptionJob'][_0xa3bf('0x7e')];return _0x366aba(_0x3903ab);})[_0xa3bf('0x52')](function(_0x2b8f04){return _0x3dc12b(_0x2b8f04);});});}exports[_0xa3bf('0x7f')]=function(_0x8bc626,_0x2dcc4a,_0x3f0ee0){var _0x332cab;var _0x363436;var _0x25fc2e;var _0x41c346=require(_0xa3bf('0x60'));return db[_0xa3bf('0x31')][_0xa3bf('0x80')]({'where':{'id':_0x8bc626['params']['id']}})[_0xa3bf('0x2b')](function(_0x393fae){if(_0x393fae){var _0x3f157a=util[_0xa3bf('0x38')]('%s.cypher',_0x393fae['value']);if(fs['existsSync'](_0x3f157a)){cypher=!![];return _0x41c346[_0xa3bf('0x67')](_0x3f157a,_0x393fae['value'],config[_0xa3bf('0x58')][_0xa3bf('0x81')])[_0xa3bf('0x2b')](function(){return _0x393fae;});}return _0x393fae;}})[_0xa3bf('0x2b')](function(_0x33b240){if(!_0x33b240){throw new db['Sequelize'][(_0xa3bf('0x82'))](_0xa3bf('0x83'));}_0x363436=_0x33b240;return db[_0xa3bf('0x84')][_0xa3bf('0x80')]({'where':{'id':0x1}});})[_0xa3bf('0x2b')](handleEntityNotFound(_0x2dcc4a,null))[_0xa3bf('0x2b')](function(_0x3a47c1){if(_0x3a47c1){_0x332cab=_0x3a47c1;if(!_0x332cab[_0xa3bf('0x85')]||!_0x332cab[_0xa3bf('0x86')]||!_0x332cab[_0xa3bf('0x87')]||!_0x332cab[_0xa3bf('0x88')]||!_0x332cab['bucket']){throw new db[(_0xa3bf('0x59'))][(_0xa3bf('0x82'))]('Transcribe\x20not\x20configured');}if(_0x8bc626['body'][_0xa3bf('0x89')]&&(!_0x332cab[_0xa3bf('0x8a')]||!_0x332cab['sentimentAccountId']||!_0x332cab['sentimentRegion']||!_0x332cab[_0xa3bf('0x88')]||!_0x332cab['bucket'])){throw new db[(_0xa3bf('0x59'))]['ValidationError'](_0xa3bf('0x8b'));}return db[_0xa3bf('0x8c')][_0xa3bf('0x80')]({'where':{'id':_0x332cab['transcribeAccountId']}});}})[_0xa3bf('0x2b')](function(_0x38bebf){if(!_0x38bebf){throw new db[(_0xa3bf('0x59'))][(_0xa3bf('0x82'))](_0xa3bf('0x8d'));}if(!_0x38bebf[_0xa3bf('0x8e')]||!_0x38bebf[_0xa3bf('0x8f')]){throw new db['Sequelize']['ValidationError'](_0xa3bf('0x90'));}_0x25fc2e=_0x38bebf;return getBucketslist(_0x25fc2e['data1'],_0x25fc2e['data2'],_0x332cab['transcribeRegion']);})[_0xa3bf('0x2b')](function(_0x39557b){if(_0x39557b&&_0x39557b[_0xa3bf('0x91')]){var _0x258833=_[_0xa3bf('0x4f')](_0x39557b[_0xa3bf('0x91')],function(_0x3000a4){return _0x3000a4[_0xa3bf('0x92')]===_0x332cab['bucket'];});if(!_0x258833){logger[_0xa3bf('0x6a')](util[_0xa3bf('0x38')](_0xa3bf('0x93'),_0x8bc626[_0xa3bf('0x4d')]['id'],_0x332cab[_0xa3bf('0x79')]));return createBucket(_0x25fc2e[_0xa3bf('0x8e')],_0x25fc2e[_0xa3bf('0x8f')],_0x332cab['transcribeRegion'],_0x332cab['bucket']);}logger[_0xa3bf('0x6a')](util[_0xa3bf('0x38')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x8bc626[_0xa3bf('0x4d')]['id'],_0x332cab[_0xa3bf('0x79')]));return;}})['then'](function(_0x416278){if(_0x363436[_0xa3bf('0x7d')]===_0xa3bf('0x94')){return transcribe(_0x8bc626[_0xa3bf('0x4d')]['id'],_0x25fc2e[_0xa3bf('0x8e')],_0x25fc2e['data2'],_0x332cab['transcribeRegion'],_0x332cab[_0xa3bf('0x79')],_0x363436[_0xa3bf('0x55')],_0x332cab[_0xa3bf('0x88')]);}else{logger['info'](util[_0xa3bf('0x38')](_0xa3bf('0x95'),_0x8bc626[_0xa3bf('0x4d')]['id']));return{'transcribeStatus':_0xa3bf('0x96')};}})[_0xa3bf('0x2b')](function(_0x50a1a2){if(_0x50a1a2){_0x50a1a2['tempSentiment']=_0x8bc626[_0xa3bf('0x51')][_0xa3bf('0x89')];return _0x363436[_0xa3bf('0x97')](_0x50a1a2);}})[_0xa3bf('0x2b')](respondWithResult(_0x2dcc4a,null))[_0xa3bf('0x52')](handleError(_0x2dcc4a,null));};function writeFile(_0x4aead7,_0x2f8165){return new Promise(function(_0x42977b,_0x1be72a){fs[_0xa3bf('0x98')](_0x2f8165,_0x4aead7,function(_0x3a51c3,_0x14b87d){if(_0x3a51c3){return _0x1be72a(_0x3a51c3);}else{return _0x42977b(_0x14b87d);}});});}exports[_0xa3bf('0x99')]=function(_0x12b0ba,_0x11315b,_0x1385e){return db[_0xa3bf('0x31')][_0xa3bf('0x80')]({'where':{'id':_0x12b0ba[_0xa3bf('0x4d')]['id']}})[_0xa3bf('0x2b')](handleEntityNotFound(_0x11315b))[_0xa3bf('0x2b')](function(_0x4c70f2){if(_0x4c70f2&&_0x4c70f2[_0xa3bf('0x9a')]){var _0x3712a6=_0x4c70f2[_0xa3bf('0x9a')];var _0x5abd69=config['root']+'/server/files/transcribes/transcribe_'+_0x4c70f2['id']+_0xa3bf('0x9b');if(fs[_0xa3bf('0x57')](_0x5abd69)){return _0x5abd69;}return writeFile(_0x3712a6,_0x5abd69)['then'](function(){return _0x5abd69;});}else{throw new db['Sequelize'][(_0xa3bf('0x82'))](_0xa3bf('0x9c'));}})[_0xa3bf('0x2b')](function(_0x1cfc85){return _0x11315b['download'](_0x1cfc85);})[_0xa3bf('0x52')](handleError(_0x11315b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 1c5e819..b3933e3 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 _0x2bd6=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x4d8cc3,_0x5eba5c){var _0x287c9d=function(_0x358da9){while(--_0x358da9){_0x4d8cc3['push'](_0x4d8cc3['shift']());}};_0x287c9d(++_0x5eba5c);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2bd6[_0x618414];return _0x21c19a;};'use strict';var attributes=require(_0x62bd('0x0'));module[_0x62bd('0x1')]=function(_0x469dda,_0x30ace1){return _0x469dda[_0x62bd('0x2')]('VoiceRecording',attributes,{'tableName':_0x62bd('0x3'),'paranoid':![],'indexes':[{'name':_0x62bd('0x4'),'fields':[_0x62bd('0x4')]},{'name':'transcribeStatus','fields':[_0x62bd('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd6=['exports','define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x297220,_0x49bec5){var _0x532a3e=function(_0x117fd2){while(--_0x117fd2){_0x297220['push'](_0x297220['shift']());}};_0x532a3e(++_0x49bec5);}(_0x0cd6,0x113));var _0x60cd=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x0cd6[_0x439d59];return _0x3670c7;};'use strict';var attributes=require(_0x60cd('0x0'));module[_0x60cd('0x1')]=function(_0x4c0666,_0x9cec58){return _0x4c0666[_0x60cd('0x2')]('VoiceRecording',attributes,{'tableName':_0x60cd('0x3'),'paranoid':![],'indexes':[{'name':_0x60cd('0x4'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x60cd('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ed5d971..631af01 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 _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2b426e,_0x491a20){var _0x409d2e=function(_0x40d404){while(--_0x40d404){_0x2b426e['push'](_0x2b426e['shift']());}};_0x409d2e(++_0x491a20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x499341,_0xefcdbb){_0x499341=_0x499341-0x0;var _0x2aa252=_0x5f2f[_0x499341];return _0x2aa252;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x47c5=['secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','UpdateVoiceRecording','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher'];(function(_0x2777f3,_0x1526f9){var _0x413144=function(_0xda1157){while(--_0xda1157){_0x2777f3['push'](_0x2777f3['shift']());}};_0x413144(++_0x1526f9);}(_0x47c5,0x165));var _0x547c=function(_0x60b834,_0x3ccdda){_0x60b834=_0x60b834-0x0;var _0x832e5e=_0x47c5[_0x60b834];return _0x832e5e;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['UpdateVoiceRecording']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fa9e['options']?_0x23fa9e['options'][_0x547c('0x1d')]||null:null,'attributes':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1e')]||null:null,'limit':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1f')]||null:null})[_0x547c('0xc')](function(_0x436e67){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x436e67));_0xeb059e(_0x436e67);})[_0x547c('0x17')](function(_0x2663bc){logger[_0x547c('0x13')](_0x547c('0x20'),_0x2663bc['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2663bc['message']));});});};exports['CreateVoiceRecording']=function(_0x4855fd){var _0x478f04=this;return new Promise(function(_0x2c725d,_0x4c5256){var _0x93985c=require('../../components/encryptor');var _0x3ea493;return db['Setting'][_0x547c('0x21')]({'attributes':['id',_0x547c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x547c('0xc')](function(_0x30a96c){_0x3ea493=_0x30a96c;return db[_0x547c('0x18')]['create'](_0x4855fd['body']);})[_0x547c('0xc')](function(_0x54de6f){if(_0x3ea493[_0x547c('0x22')]&&fs[_0x547c('0x23')](_0x54de6f[_0x547c('0x24')])){var _0x1695be=util[_0x547c('0x25')](_0x547c('0x26'),_0x54de6f[_0x547c('0x24')]);return _0x93985c['encryptFile'](_0x54de6f['value'],_0x1695be,config[_0x547c('0x27')][_0x547c('0x28')])[_0x547c('0xc')](function(){fs[_0x547c('0x29')](_0x54de6f[_0x547c('0x24')]);logger[_0x547c('0xd')](_0x547c('0x2a'));return _0x54de6f;});}return _0x54de6f;})[_0x547c('0xc')](function(_0x378bac){logger[_0x547c('0xd')](_0x547c('0x2b'),_0x4855fd);logger[_0x547c('0x10')](_0x547c('0x2b'),_0x4855fd,JSON[_0x547c('0x12')](_0x378bac));_0x2c725d(_0x378bac);})['catch'](function(_0x3afc28){logger['error']('CreateVoiceRecording',_0x3afc28['message'],_0x4855fd);_0x4c5256(_0x478f04[_0x547c('0x13')](0x1f4,_0x3afc28[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9e433df..1a81bf8 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 _0x6c1f=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0x6c1f,0x1cb));var _0xf6c1=function(_0x2ce055,_0x754ee6){_0x2ce055=_0x2ce055-0x0;var _0x31dd95=_0x6c1f[_0x2ce055];return _0x31dd95;};'use strict';var multer=require('multer');var util=require(_0xf6c1('0x0'));var path=require(_0xf6c1('0x1'));var timeout=require(_0xf6c1('0x2'));var express=require(_0xf6c1('0x3'));var router=express[_0xf6c1('0x4')]();var fs_extra=require(_0xf6c1('0x5'));var auth=require(_0xf6c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6c1('0x7'));var controller=require(_0xf6c1('0x8'));router['get']('/',auth[_0xf6c1('0x9')](),controller['index']);router['get'](_0xf6c1('0xa'),auth['isAuthenticated'](),controller[_0xf6c1('0xb')]);router[_0xf6c1('0xc')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0xe')]);router[_0xf6c1('0xf')]('/',auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x10')]);router[_0xf6c1('0x11')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller['update']);router[_0xf6c1('0x12')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x13')]);module[_0xf6c1('0x14')]=router; \ No newline at end of file +var _0x8530=['isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x169b8e,_0x33c877){var _0x39bd4d=function(_0x207ee1){while(--_0x207ee1){_0x169b8e['push'](_0x169b8e['shift']());}};_0x39bd4d(++_0x33c877);}(_0x8530,0x90));var _0x0853=function(_0x3a4f4b,_0x5103c2){_0x3a4f4b=_0x3a4f4b-0x0;var _0x173d0e=_0x8530[_0x3a4f4b];return _0x173d0e;};'use strict';var multer=require(_0x0853('0x0'));var util=require(_0x0853('0x1'));var path=require('path');var timeout=require(_0x0853('0x2'));var express=require('express');var router=express[_0x0853('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0853('0x4'));var interaction=require(_0x0853('0x5'));var config=require(_0x0853('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x0853('0x7')]('/',auth[_0x0853('0x8')](),controller[_0x0853('0x9')]);router['get'](_0x0853('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0853('0x7')](_0x0853('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0853('0xc')]('/',auth[_0x0853('0x8')](),controller[_0x0853('0xd')]);router[_0x0853('0xe')](_0x0853('0xb'),auth[_0x0853('0x8')](),controller[_0x0853('0xf')]);router[_0x0853('0x10')](_0x0853('0xb'),auth[_0x0853('0x8')](),controller[_0x0853('0x11')]);module[_0x0853('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 6a93bf4..6326b06 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 _0x214b=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1c8fdc,_0x4210b1){var _0x39e241=function(_0x1c1faf){while(--_0x1c1faf){_0x1c8fdc['push'](_0x1c8fdc['shift']());}};_0x39e241(++_0x4210b1);}(_0x214b,0xfb));var _0xb214=function(_0x5ab38f,_0x596fdb){_0x5ab38f=_0x5ab38f-0x0;var _0x224fef=_0x214b[_0x5ab38f];return _0x224fef;};'use strict';var Sequelize=require(_0xb214('0x0'));var moment=require(_0xb214('0x1'));module[_0xb214('0x2')]={'type':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x4'),_0xb214('0x5'))},'result':{'type':Sequelize[_0xb214('0x6')]},'transfererchannel':{'type':Sequelize[_0xb214('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb214('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xb214('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb214('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb214('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb214('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb214('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb214('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xb214('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xb214('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xb214('0x6')]},'isexternal':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x7'),'No')},'context':{'type':Sequelize[_0xb214('0x6')]},'extension':{'type':Sequelize[_0xb214('0x6')]}}; \ No newline at end of file +var _0x9182=['Yes','sequelize','moment','exports','ENUM','blind','STRING'];(function(_0x44f82a,_0x6e7a70){var _0x4618d1=function(_0x8395a7){while(--_0x8395a7){_0x44f82a['push'](_0x44f82a['shift']());}};_0x4618d1(++_0x6e7a70);}(_0x9182,0x9b));var _0x2918=function(_0x2a8e43,_0x585e9d){_0x2a8e43=_0x2a8e43-0x0;var _0x49d13f=_0x9182[_0x2a8e43];return _0x49d13f;};'use strict';var Sequelize=require(_0x2918('0x0'));var moment=require(_0x2918('0x1'));module[_0x2918('0x2')]={'type':{'type':Sequelize[_0x2918('0x3')](_0x2918('0x4'),'attended')},'result':{'type':Sequelize[_0x2918('0x5')]},'transfererchannel':{'type':Sequelize[_0x2918('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x2918('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x2918('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x2918('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x2918('0x5')]},'transfererexten':{'type':Sequelize[_0x2918('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x2918('0x5')]},'transfereechannel':{'type':Sequelize[_0x2918('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x2918('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x2918('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2918('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2918('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x2918('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x2918('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2918('0x5')]},'isexternal':{'type':Sequelize[_0x2918('0x3')](_0x2918('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2918('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 512709f..e5a8f7c 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 _0x80bd=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceTransferReport','include','findAll','rows','catch','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x525dc2,_0x24f1b7){var _0x31349b=function(_0x83582c){while(--_0x83582c){_0x525dc2['push'](_0x525dc2['shift']());}};_0x31349b(++_0x24f1b7);}(_0x80bd,0x154));var _0xd80b=function(_0x9c0e2c,_0x1bf761){_0x9c0e2c=_0x9c0e2c-0x0;var _0x5b15ae=_0x80bd[_0x9c0e2c];return _0x5b15ae;};'use strict';var emlformat=require(_0xd80b('0x0'));var rimraf=require(_0xd80b('0x1'));var zipdir=require(_0xd80b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd80b('0x3'));var moment=require(_0xd80b('0x4'));var BPromise=require(_0xd80b('0x5'));var Mustache=require(_0xd80b('0x6'));var util=require(_0xd80b('0x7'));var path=require(_0xd80b('0x8'));var sox=require(_0xd80b('0x9'));var csv=require(_0xd80b('0xa'));var ejs=require(_0xd80b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd80b('0xc'));var squel=require(_0xd80b('0xd'));var crypto=require(_0xd80b('0xe'));var jsforce=require(_0xd80b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd80b('0x10'));var Papa=require(_0xd80b('0x11'));var Redis=require(_0xd80b('0x12'));var authService=require(_0xd80b('0x13'));var qs=require(_0xd80b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80b('0x15'));var logger=require(_0xd80b('0x16'))(_0xd80b('0x17'));var utils=require(_0xd80b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd80b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3adbbf,_0x13e38c){_0x13e38c=_0x13e38c||0xcc;return function(_0x4bd7bb){if(_0x4bd7bb){return _0x3adbbf[_0xd80b('0x1a')](_0x13e38c);}return _0x3adbbf[_0xd80b('0x1b')](_0x13e38c)[_0xd80b('0x1c')]();};}function respondWithResult(_0x50c3b5,_0x384a78){_0x384a78=_0x384a78||0xc8;return function(_0x58ad65){if(_0x58ad65){return _0x50c3b5['status'](_0x384a78)['json'](_0x58ad65);}};}function respondWithFilteredResult(_0x262eb1,_0x4ba5fa){return function(_0x19bc53){if(_0x19bc53){var _0x16ec59=typeof _0x4ba5fa[_0xd80b('0x1d')]===_0xd80b('0x1e')&&typeof _0x4ba5fa[_0xd80b('0x1f')]===_0xd80b('0x1e');var _0x3a39b1=_0x19bc53[_0xd80b('0x20')];var _0x541daf=_0x16ec59?0x0:_0x4ba5fa[_0xd80b('0x1d')];var _0x1da7ec=_0x16ec59?_0x19bc53[_0xd80b('0x20')]:_0x4ba5fa[_0xd80b('0x1d')]+_0x4ba5fa[_0xd80b('0x1f')];var _0x3168b1;if(_0x1da7ec>=_0x3a39b1){_0x1da7ec=_0x3a39b1;_0x3168b1=0xc8;}else{_0x3168b1=0xce;}_0x262eb1[_0xd80b('0x1b')](_0x3168b1);return _0x262eb1[_0xd80b('0x21')](_0xd80b('0x22'),_0x541daf+'-'+_0x1da7ec+'/'+_0x3a39b1)[_0xd80b('0x23')](_0x19bc53);}return null;};}function patchUpdates(_0x425c13){return function(_0x231e64){try{jsonpatch[_0xd80b('0x24')](_0x231e64,_0x425c13,!![]);}catch(_0x851fe5){return BPromise[_0xd80b('0x25')](_0x851fe5);}return _0x231e64[_0xd80b('0x26')]();};}function saveUpdates(_0x358d35,_0x1e1363){return function(_0x28d737){if(_0x28d737){return _0x28d737[_0xd80b('0x27')](_0x358d35)[_0xd80b('0x28')](function(_0x32e1d9){return _0x32e1d9;});}return null;};}function removeEntity(_0x4ae22d,_0x720693){return function(_0x1d1f43){if(_0x1d1f43){return _0x1d1f43[_0xd80b('0x29')]()[_0xd80b('0x28')](function(){_0x4ae22d[_0xd80b('0x1b')](0xcc)[_0xd80b('0x1c')]();});}};}function handleEntityNotFound(_0x2059c7,_0x2e2d50){return function(_0x5796f5){if(!_0x5796f5){_0x2059c7[_0xd80b('0x1a')](0x194);}return _0x5796f5;};}function handleError(_0x4d105,_0x30e01c){_0x30e01c=_0x30e01c||0x1f4;return function(_0x886dd){logger['error'](_0x886dd[_0xd80b('0x2a')]);if(_0x886dd[_0xd80b('0x2b')]){delete _0x886dd[_0xd80b('0x2b')];}_0x4d105[_0xd80b('0x1b')](_0x30e01c)[_0xd80b('0x2c')](_0x886dd);};}exports['index']=function(_0x8b9517,_0x3ec23f){var _0x1edf09={},_0x28b11b={},_0x1c4ec6={'count':0x0,'rows':[]};var _0x4f12b3=_[_0xd80b('0x2d')](db['VoiceTransferReport'][_0xd80b('0x2e')],function(_0x22bdb3){return{'name':_0x22bdb3[_0xd80b('0x2f')],'type':_0x22bdb3[_0xd80b('0x30')][_0xd80b('0x31')]};});_0x28b11b['model']=_[_0xd80b('0x2d')](_0x4f12b3,'name');_0x28b11b[_0xd80b('0x32')]=_[_0xd80b('0x33')](_0x8b9517[_0xd80b('0x32')]);_0x28b11b[_0xd80b('0x34')]=_[_0xd80b('0x35')](_0x28b11b[_0xd80b('0x36')],_0x28b11b[_0xd80b('0x32')]);_0x1edf09[_0xd80b('0x37')]=_['intersection'](_0x28b11b[_0xd80b('0x36')],qs['fields'](_0x8b9517['query'][_0xd80b('0x38')]));_0x1edf09['attributes']=_0x1edf09[_0xd80b('0x37')]['length']?_0x1edf09[_0xd80b('0x37')]:_0x28b11b[_0xd80b('0x36')];if(!_0x8b9517[_0xd80b('0x32')][_0xd80b('0x39')]('nolimit')){_0x1edf09[_0xd80b('0x1f')]=qs[_0xd80b('0x1f')](_0x8b9517[_0xd80b('0x32')]['limit']);_0x1edf09[_0xd80b('0x1d')]=qs[_0xd80b('0x1d')](_0x8b9517[_0xd80b('0x32')][_0xd80b('0x1d')]);}_0x1edf09[_0xd80b('0x3a')]=qs[_0xd80b('0x3b')](_0x8b9517[_0xd80b('0x32')][_0xd80b('0x3b')]);_0x1edf09['where']=qs[_0xd80b('0x34')](_[_0xd80b('0x3c')](_0x8b9517['query'],_0x28b11b[_0xd80b('0x34')]),_0x4f12b3);if(_0x8b9517[_0xd80b('0x32')]['filter']){_0x1edf09[_0xd80b('0x3d')]=_['merge'](_0x1edf09['where'],{'$or':_['map'](_0x4f12b3,function(_0x21e6e1){if(_0x21e6e1[_0xd80b('0x30')]!==_0xd80b('0x3e')){var _0x17fd5c={};_0x17fd5c[_0x21e6e1[_0xd80b('0x2b')]]={'$like':'%'+_0x8b9517['query'][_0xd80b('0x3f')]+'%'};return _0x17fd5c;}})});}_0x1edf09=_[_0xd80b('0x40')]({},_0x1edf09,_0x8b9517[_0xd80b('0x41')]);var _0x44cbc7={'where':_0x1edf09[_0xd80b('0x3d')]};return db[_0xd80b('0x42')][_0xd80b('0x20')](_0x44cbc7)[_0xd80b('0x28')](function(_0x244622){_0x1c4ec6[_0xd80b('0x20')]=_0x244622;if(_0x8b9517['query']['includeAll']){_0x1edf09[_0xd80b('0x43')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xd80b('0x44')](_0x1edf09);})[_0xd80b('0x28')](function(_0x39ed7a){_0x1c4ec6[_0xd80b('0x45')]=_0x39ed7a;return _0x1c4ec6;})[_0xd80b('0x28')](respondWithFilteredResult(_0x3ec23f,_0x1edf09))[_0xd80b('0x46')](handleError(_0x3ec23f,null));};exports['show']=function(_0x2c6bd4,_0x19176a){var _0xb5ad33={'raw':!![],'where':{'id':_0x2c6bd4['params']['id']}},_0x34212b={};_0x34212b[_0xd80b('0x36')]=_['keys'](db[_0xd80b('0x42')][_0xd80b('0x2e')]);_0x34212b['query']=_[_0xd80b('0x33')](_0x2c6bd4[_0xd80b('0x32')]);_0x34212b[_0xd80b('0x34')]=_[_0xd80b('0x35')](_0x34212b[_0xd80b('0x36')],_0x34212b['query']);_0xb5ad33[_0xd80b('0x37')]=_[_0xd80b('0x35')](_0x34212b[_0xd80b('0x36')],qs[_0xd80b('0x38')](_0x2c6bd4[_0xd80b('0x32')][_0xd80b('0x38')]));_0xb5ad33[_0xd80b('0x37')]=_0xb5ad33['attributes'][_0xd80b('0x47')]?_0xb5ad33[_0xd80b('0x37')]:_0x34212b[_0xd80b('0x36')];if(_0x2c6bd4['query'][_0xd80b('0x48')]){_0xb5ad33[_0xd80b('0x43')]=[{'all':!![]}];}_0xb5ad33=_[_0xd80b('0x40')]({},_0xb5ad33,_0x2c6bd4[_0xd80b('0x41')]);return db['VoiceTransferReport'][_0xd80b('0x49')](_0xb5ad33)[_0xd80b('0x28')](handleEntityNotFound(_0x19176a,null))[_0xd80b('0x28')](respondWithResult(_0x19176a,null))[_0xd80b('0x46')](handleError(_0x19176a,null));};exports['create']=function(_0x197ee9,_0x12e396){return db['VoiceTransferReport'][_0xd80b('0x4a')](_0x197ee9[_0xd80b('0x4b')],{})[_0xd80b('0x28')](respondWithResult(_0x12e396,0xc9))[_0xd80b('0x46')](handleError(_0x12e396,null));};exports['update']=function(_0x2bed87,_0x2d7d6d){if(_0x2bed87[_0xd80b('0x4b')]['id']){delete _0x2bed87[_0xd80b('0x4b')]['id'];}return db[_0xd80b('0x42')][_0xd80b('0x49')]({'where':{'id':_0x2bed87[_0xd80b('0x4c')]['id']}})[_0xd80b('0x28')](handleEntityNotFound(_0x2d7d6d,null))[_0xd80b('0x28')](saveUpdates(_0x2bed87['body'],null))[_0xd80b('0x28')](respondWithResult(_0x2d7d6d,null))[_0xd80b('0x46')](handleError(_0x2d7d6d,null));};exports[_0xd80b('0x29')]=function(_0x43f31a,_0x6142e7){return db['VoiceTransferReport']['find']({'where':{'id':_0x43f31a[_0xd80b('0x4c')]['id']}})[_0xd80b('0x28')](handleEntityNotFound(_0x6142e7,null))[_0xd80b('0x28')](removeEntity(_0x6142e7,null))[_0xd80b('0x46')](handleError(_0x6142e7,null));};exports[_0xd80b('0x4d')]=function(_0x6924ea,_0x27a4e4){return db[_0xd80b('0x42')][_0xd80b('0x4d')]()[_0xd80b('0x28')](respondWithResult(_0x27a4e4,null))[_0xd80b('0x46')](handleError(_0x27a4e4,null));}; \ No newline at end of file +var _0xe05c=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','request-promise','bluebird'];(function(_0x15101c,_0x6c04fc){var _0x4a930e=function(_0x4759fe){while(--_0x4759fe){_0x15101c['push'](_0x15101c['shift']());}};_0x4a930e(++_0x6c04fc);}(_0xe05c,0x12e));var _0xce05=function(_0x29855a,_0x4af79f){_0x29855a=_0x29855a-0x0;var _0x2896f1=_0xe05c[_0x29855a];return _0x2896f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce05('0x0'));var moment=require('moment');var BPromise=require(_0xce05('0x1'));var Mustache=require(_0xce05('0x2'));var util=require('util');var path=require(_0xce05('0x3'));var sox=require(_0xce05('0x4'));var csv=require(_0xce05('0x5'));var ejs=require(_0xce05('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce05('0x7'));var squel=require(_0xce05('0x8'));var crypto=require(_0xce05('0x9'));var jsforce=require(_0xce05('0xa'));var deskjs=require(_0xce05('0xb'));var toCsv=require('to-csv');var querystring=require(_0xce05('0xc'));var Papa=require(_0xce05('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce05('0xe'));var as=require(_0xce05('0xf'));var hardwareService=require(_0xce05('0x10'));var logger=require(_0xce05('0x11'))(_0xce05('0x12'));var utils=require(_0xce05('0x13'));var config=require(_0xce05('0x14'));var licenseUtil=require(_0xce05('0x15'));var db=require(_0xce05('0x16'))['db'];function respondWithStatusCode(_0x4d921a,_0x2db910){_0x2db910=_0x2db910||0xcc;return function(_0x6ecde6){if(_0x6ecde6){return _0x4d921a[_0xce05('0x17')](_0x2db910);}return _0x4d921a[_0xce05('0x18')](_0x2db910)[_0xce05('0x19')]();};}function respondWithResult(_0x1030b0,_0x2217b5){_0x2217b5=_0x2217b5||0xc8;return function(_0x18513c){if(_0x18513c){return _0x1030b0[_0xce05('0x18')](_0x2217b5)[_0xce05('0x1a')](_0x18513c);}};}function respondWithFilteredResult(_0x47ecd6,_0x72f362){return function(_0x4c3a5e){if(_0x4c3a5e){var _0x11eb76=typeof _0x72f362[_0xce05('0x1b')]===_0xce05('0x1c')&&typeof _0x72f362[_0xce05('0x1d')]===_0xce05('0x1c');var _0x5941df=_0x4c3a5e['count'];var _0x293e7b=_0x11eb76?0x0:_0x72f362[_0xce05('0x1b')];var _0x446d46=_0x11eb76?_0x4c3a5e[_0xce05('0x1e')]:_0x72f362[_0xce05('0x1b')]+_0x72f362[_0xce05('0x1d')];var _0x1acede;if(_0x446d46>=_0x5941df){_0x446d46=_0x5941df;_0x1acede=0xc8;}else{_0x1acede=0xce;}_0x47ecd6['status'](_0x1acede);return _0x47ecd6[_0xce05('0x1f')](_0xce05('0x20'),_0x293e7b+'-'+_0x446d46+'/'+_0x5941df)['json'](_0x4c3a5e);}return null;};}function patchUpdates(_0x23a8a3){return function(_0x423665){try{jsonpatch[_0xce05('0x21')](_0x423665,_0x23a8a3,!![]);}catch(_0x35048c){return BPromise[_0xce05('0x22')](_0x35048c);}return _0x423665[_0xce05('0x23')]();};}function saveUpdates(_0x17006a,_0x20d503){return function(_0x20df6d){if(_0x20df6d){return _0x20df6d[_0xce05('0x24')](_0x17006a)[_0xce05('0x25')](function(_0x1076a5){return _0x1076a5;});}return null;};}function removeEntity(_0x31b4d3,_0x2a9301){return function(_0x1b9679){if(_0x1b9679){return _0x1b9679[_0xce05('0x26')]()[_0xce05('0x25')](function(){_0x31b4d3['status'](0xcc)[_0xce05('0x19')]();});}};}function handleEntityNotFound(_0x4bafe0,_0x25fb99){return function(_0x17bf29){if(!_0x17bf29){_0x4bafe0[_0xce05('0x17')](0x194);}return _0x17bf29;};}function handleError(_0x4cbe95,_0x3aca09){_0x3aca09=_0x3aca09||0x1f4;return function(_0x12d04a){logger[_0xce05('0x27')](_0x12d04a[_0xce05('0x28')]);if(_0x12d04a[_0xce05('0x29')]){delete _0x12d04a[_0xce05('0x29')];}_0x4cbe95['status'](_0x3aca09)[_0xce05('0x2a')](_0x12d04a);};}exports['index']=function(_0x493314,_0x5a147b){var _0x388ca6={},_0x3ad74e={},_0x538fbd={'count':0x0,'rows':[]};var _0x4c5fcf=_[_0xce05('0x2b')](db[_0xce05('0x2c')][_0xce05('0x2d')],function(_0x18e2b7){return{'name':_0x18e2b7[_0xce05('0x2e')],'type':_0x18e2b7['type']['key']};});_0x3ad74e['model']=_[_0xce05('0x2b')](_0x4c5fcf,_0xce05('0x29'));_0x3ad74e[_0xce05('0x2f')]=_[_0xce05('0x30')](_0x493314[_0xce05('0x2f')]);_0x3ad74e[_0xce05('0x31')]=_[_0xce05('0x32')](_0x3ad74e[_0xce05('0x33')],_0x3ad74e[_0xce05('0x2f')]);_0x388ca6[_0xce05('0x34')]=_[_0xce05('0x32')](_0x3ad74e[_0xce05('0x33')],qs['fields'](_0x493314[_0xce05('0x2f')][_0xce05('0x35')]));_0x388ca6[_0xce05('0x34')]=_0x388ca6[_0xce05('0x34')][_0xce05('0x36')]?_0x388ca6[_0xce05('0x34')]:_0x3ad74e[_0xce05('0x33')];if(!_0x493314['query'][_0xce05('0x37')](_0xce05('0x38'))){_0x388ca6[_0xce05('0x1d')]=qs[_0xce05('0x1d')](_0x493314[_0xce05('0x2f')]['limit']);_0x388ca6['offset']=qs[_0xce05('0x1b')](_0x493314['query'][_0xce05('0x1b')]);}_0x388ca6[_0xce05('0x39')]=qs[_0xce05('0x3a')](_0x493314[_0xce05('0x2f')][_0xce05('0x3a')]);_0x388ca6[_0xce05('0x3b')]=qs[_0xce05('0x31')](_[_0xce05('0x3c')](_0x493314[_0xce05('0x2f')],_0x3ad74e[_0xce05('0x31')]),_0x4c5fcf);if(_0x493314[_0xce05('0x2f')]['filter']){_0x388ca6[_0xce05('0x3b')]=_[_0xce05('0x3d')](_0x388ca6[_0xce05('0x3b')],{'$or':_[_0xce05('0x2b')](_0x4c5fcf,function(_0x994f17){if(_0x994f17[_0xce05('0x3e')]!==_0xce05('0x3f')){var _0x34c173={};_0x34c173[_0x994f17['name']]={'$like':'%'+_0x493314[_0xce05('0x2f')][_0xce05('0x40')]+'%'};return _0x34c173;}})});}_0x388ca6=_['merge']({},_0x388ca6,_0x493314[_0xce05('0x41')]);var _0x5a1b62={'where':_0x388ca6[_0xce05('0x3b')]};return db['VoiceTransferReport'][_0xce05('0x1e')](_0x5a1b62)['then'](function(_0x101be2){_0x538fbd[_0xce05('0x1e')]=_0x101be2;if(_0x493314[_0xce05('0x2f')][_0xce05('0x42')]){_0x388ca6['include']=[{'all':!![]}];}return db[_0xce05('0x2c')][_0xce05('0x43')](_0x388ca6);})['then'](function(_0x3b320d){_0x538fbd[_0xce05('0x44')]=_0x3b320d;return _0x538fbd;})[_0xce05('0x25')](respondWithFilteredResult(_0x5a147b,_0x388ca6))[_0xce05('0x45')](handleError(_0x5a147b,null));};exports[_0xce05('0x46')]=function(_0x27d522,_0x92b23){var _0x4174d2={'raw':!![],'where':{'id':_0x27d522[_0xce05('0x47')]['id']}},_0x432abb={};_0x432abb['model']=_[_0xce05('0x30')](db[_0xce05('0x2c')][_0xce05('0x2d')]);_0x432abb['query']=_[_0xce05('0x30')](_0x27d522[_0xce05('0x2f')]);_0x432abb[_0xce05('0x31')]=_[_0xce05('0x32')](_0x432abb['model'],_0x432abb[_0xce05('0x2f')]);_0x4174d2[_0xce05('0x34')]=_[_0xce05('0x32')](_0x432abb[_0xce05('0x33')],qs[_0xce05('0x35')](_0x27d522[_0xce05('0x2f')][_0xce05('0x35')]));_0x4174d2['attributes']=_0x4174d2[_0xce05('0x34')]['length']?_0x4174d2[_0xce05('0x34')]:_0x432abb[_0xce05('0x33')];if(_0x27d522[_0xce05('0x2f')][_0xce05('0x42')]){_0x4174d2['include']=[{'all':!![]}];}_0x4174d2=_[_0xce05('0x3d')]({},_0x4174d2,_0x27d522[_0xce05('0x41')]);return db[_0xce05('0x2c')][_0xce05('0x48')](_0x4174d2)[_0xce05('0x25')](handleEntityNotFound(_0x92b23,null))[_0xce05('0x25')](respondWithResult(_0x92b23,null))['catch'](handleError(_0x92b23,null));};exports['create']=function(_0xafe15e,_0x4f996a){return db[_0xce05('0x2c')][_0xce05('0x49')](_0xafe15e['body'],{})['then'](respondWithResult(_0x4f996a,0xc9))[_0xce05('0x45')](handleError(_0x4f996a,null));};exports[_0xce05('0x24')]=function(_0x5d5654,_0x15ca45){if(_0x5d5654[_0xce05('0x4a')]['id']){delete _0x5d5654[_0xce05('0x4a')]['id'];}return db[_0xce05('0x2c')]['find']({'where':{'id':_0x5d5654['params']['id']}})[_0xce05('0x25')](handleEntityNotFound(_0x15ca45,null))[_0xce05('0x25')](saveUpdates(_0x5d5654['body'],null))[_0xce05('0x25')](respondWithResult(_0x15ca45,null))[_0xce05('0x45')](handleError(_0x15ca45,null));};exports[_0xce05('0x26')]=function(_0x4c7b2e,_0x1c74a0){return db[_0xce05('0x2c')][_0xce05('0x48')]({'where':{'id':_0x4c7b2e[_0xce05('0x47')]['id']}})[_0xce05('0x25')](handleEntityNotFound(_0x1c74a0,null))[_0xce05('0x25')](removeEntity(_0x1c74a0,null))[_0xce05('0x45')](handleError(_0x1c74a0,null));};exports[_0xce05('0x4b')]=function(_0xce380,_0x10d459){return db['VoiceTransferReport'][_0xce05('0x4b')]()[_0xce05('0x25')](respondWithResult(_0x10d459,null))['catch'](handleError(_0x10d459,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e0670d4..514e2aa 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 _0x9d43=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0xe2dc9e,_0xeb3bc6){var _0x279417=function(_0x32475f){while(--_0x32475f){_0xe2dc9e['push'](_0xe2dc9e['shift']());}};_0x279417(++_0xeb3bc6);}(_0x9d43,0x11e));var _0x39d4=function(_0x581440,_0x23043c){_0x581440=_0x581440-0x0;var _0x21b59f=_0x9d43[_0x581440];return _0x21b59f;};'use strict';var _=require(_0x39d4('0x0'));var util=require(_0x39d4('0x1'));var logger=require(_0x39d4('0x2'))(_0x39d4('0x3'));var moment=require(_0x39d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x39d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x39d4('0x7'));module[_0x39d4('0x8')]=function(_0x286334,_0x3daa19){return _0x286334[_0x39d4('0x9')](_0x39d4('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59bf=['../../config/environment','exports','define','VoiceTransferReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x342548,_0x31c72e){var _0x107140=function(_0x32c2ab){while(--_0x32c2ab){_0x342548['push'](_0x342548['shift']());}};_0x107140(++_0x31c72e);}(_0x59bf,0xb8));var _0xf59b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x59bf[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0xf59b('0x0'));var logger=require(_0xf59b('0x1'))(_0xf59b('0x2'));var moment=require(_0xf59b('0x3'));var BPromise=require(_0xf59b('0x4'));var rp=require(_0xf59b('0x5'));var fs=require('fs');var path=require(_0xf59b('0x6'));var rimraf=require(_0xf59b('0x7'));var config=require(_0xf59b('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xf59b('0x9')]=function(_0x3010b9,_0x404ca6){return _0x3010b9[_0xf59b('0xa')](_0xf59b('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 51059ed..d888229 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 _0x04af=['rpc','../../config/environment','client','http','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x40a357,_0x52d576){var _0x1473fb=function(_0x327c91){while(--_0x327c91){_0x40a357['push'](_0x40a357['shift']());}};_0x1473fb(++_0x52d576);}(_0x04af,0xf4));var _0xf04a=function(_0x74dc61,_0x3cd9cb){_0x74dc61=_0x74dc61-0x0;var _0x29a24c=_0x04af[_0x74dc61];return _0x29a24c;};'use strict';var _=require(_0xf04a('0x0'));var util=require(_0xf04a('0x1'));var moment=require(_0xf04a('0x2'));var BPromise=require(_0xf04a('0x3'));var rs=require(_0xf04a('0x4'));var fs=require('fs');var Redis=require(_0xf04a('0x5'));var db=require(_0xf04a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf04a('0x7'))(_0xf04a('0x8'));var config=require(_0xf04a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf04a('0xa')][_0xf04a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1772ce,_0x52f4e6,_0x4efa4a){return new BPromise(function(_0x3d75bd,_0xf5f34b){return client['request'](_0x1772ce,_0x4efa4a)[_0xf04a('0xc')](function(_0x28f5f4){logger['info'](_0xf04a('0xd'),_0x52f4e6,_0xf04a('0xe'));logger[_0xf04a('0xf')](_0xf04a('0x10'),_0x52f4e6,_0xf04a('0xe'),JSON[_0xf04a('0x11')](_0x28f5f4));if(_0x28f5f4[_0xf04a('0x12')]){if(_0x28f5f4[_0xf04a('0x12')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x52f4e6,_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);return _0xf5f34b(_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);}logger[_0xf04a('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x52f4e6,_0x28f5f4[_0xf04a('0x12')]['message']);return _0x3d75bd(_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);}else{logger[_0xf04a('0x14')](_0xf04a('0xd'),_0x52f4e6,_0xf04a('0xe'));_0x3d75bd(_0x28f5f4[_0xf04a('0x15')][_0xf04a('0x13')]);}})[_0xf04a('0x16')](function(_0x169a9e){logger[_0xf04a('0x12')](_0xf04a('0xd'),_0x52f4e6,_0x169a9e);_0xf5f34b(_0x169a9e);});});}exports['CreateVoiceTransferReport']=function(_0x12cdd1){var _0x437c88=this;return new Promise(function(_0xe80cd0,_0x3f9039){return db['VoiceTransferReport'][_0xf04a('0x17')](_0x12cdd1[_0xf04a('0x18')],{'raw':_0x12cdd1[_0xf04a('0x19')]?_0x12cdd1[_0xf04a('0x19')][_0xf04a('0x1a')]===undefined?!![]:![]:!![]})[_0xf04a('0xc')](function(_0x4e94c8){logger[_0xf04a('0x14')](_0xf04a('0x1b'),_0x12cdd1);logger[_0xf04a('0xf')](_0xf04a('0x1b'),_0x12cdd1,JSON[_0xf04a('0x11')](_0x4e94c8));_0xe80cd0(_0x4e94c8);})[_0xf04a('0x16')](function(_0x53518c){logger[_0xf04a('0x12')](_0xf04a('0x1b'),_0x53518c[_0xf04a('0x13')],_0x12cdd1);_0x3f9039(_0x437c88[_0xf04a('0x12')](0x1f4,_0x53518c['message']));});});}; \ No newline at end of file +var _0xd635=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xd635,0xd0));var _0x5d63=function(_0x513eca,_0x593007){_0x513eca=_0x513eca-0x0;var _0x2c4e0b=_0xd635[_0x513eca];return _0x2c4e0b;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var moment=require('moment');var BPromise=require(_0x5d63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d63('0x3'))(_0x5d63('0x4'));var config=require(_0x5d63('0x5'));var jayson=require(_0x5d63('0x6'));var client=jayson['client'][_0x5d63('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35d3df,_0x1e4547,_0x28eea3){return new BPromise(function(_0x2dcea6,_0x22e15f){return client[_0x5d63('0x8')](_0x35d3df,_0x28eea3)[_0x5d63('0x9')](function(_0x4e1af6){logger[_0x5d63('0xa')](_0x5d63('0xb'),_0x1e4547,_0x5d63('0xc'));logger[_0x5d63('0xd')](_0x5d63('0xe'),_0x1e4547,'request\x20sent',JSON[_0x5d63('0xf')](_0x4e1af6));if(_0x4e1af6['error']){if(_0x4e1af6[_0x5d63('0x10')][_0x5d63('0x11')]===0x1f4){logger[_0x5d63('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e4547,_0x4e1af6[_0x5d63('0x10')]['message']);return _0x22e15f(_0x4e1af6[_0x5d63('0x10')]['message']);}logger[_0x5d63('0x10')](_0x5d63('0xb'),_0x1e4547,_0x4e1af6[_0x5d63('0x10')]['message']);return _0x2dcea6(_0x4e1af6['error'][_0x5d63('0x12')]);}else{logger[_0x5d63('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e4547,_0x5d63('0xc'));_0x2dcea6(_0x4e1af6[_0x5d63('0x13')][_0x5d63('0x12')]);}})[_0x5d63('0x14')](function(_0x32793f){logger[_0x5d63('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e4547,_0x32793f);_0x22e15f(_0x32793f);});});}exports[_0x5d63('0x15')]=function(_0x2cfe11){var _0x2032de=this;return new Promise(function(_0x55c4d9,_0xd615ce){return db[_0x5d63('0x16')][_0x5d63('0x17')](_0x2cfe11[_0x5d63('0x18')],{'raw':_0x2cfe11[_0x5d63('0x19')]?_0x2cfe11[_0x5d63('0x19')][_0x5d63('0x1a')]===undefined?!![]:![]:!![]})[_0x5d63('0x9')](function(_0x5e1f4a){logger[_0x5d63('0xa')]('CreateVoiceTransferReport',_0x2cfe11);logger[_0x5d63('0xd')](_0x5d63('0x15'),_0x2cfe11,JSON[_0x5d63('0xf')](_0x5e1f4a));_0x55c4d9(_0x5e1f4a);})[_0x5d63('0x14')](function(_0x3a7cda){logger[_0x5d63('0x10')](_0x5d63('0x15'),_0x3a7cda['message'],_0x2cfe11);_0xd615ce(_0x2032de['error'](0x1f4,_0x3a7cda['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 25671e5..ec4276c 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 _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x2b3e44,_0x1c6aad){var _0x21263f=function(_0x423de7){while(--_0x423de7){_0x2b3e44['push'](_0x2b3e44['shift']());}};_0x21263f(++_0x1c6aad);}(_0xe5b3,0x133));var _0x3e5b=function(_0x54cc90,_0x23e1db){_0x54cc90=_0x54cc90-0x0;var _0x11c062=_0xe5b3[_0x54cc90];return _0x11c062;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x41ce34,_0x22932a){var _0x580c63=function(_0x46a806){while(--_0x46a806){_0x41ce34['push'](_0x41ce34['shift']());}};_0x580c63(++_0x22932a);}(_0xe14d,0x1ee));var _0xde14=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe14d[_0x4dbaad];return _0x226c72;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f710c8b..968fd0f 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 _0xaa7c=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer'];(function(_0x5264fd,_0x1cfed9){var _0x1f97c1=function(_0x1501cd){while(--_0x1501cd){_0x5264fd['push'](_0x5264fd['shift']());}};_0x1f97c1(++_0x1cfed9);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x44f1d0,_0x361cfb){_0x44f1d0=_0x44f1d0-0x0;var _0x37468b=_0xaa7c[_0x44f1d0];return _0x37468b;};'use strict';var path=require(_0xcaa7('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xcaa7('0x1'));var jayson=require(_0xcaa7('0x2'));var amiClient=jayson['client'][_0xcaa7('0x3')]({'port':0x232a});var logger=require(_0xcaa7('0x4'))(_0xcaa7('0x5'));var Redis=require(_0xcaa7('0x6'));config[_0xcaa7('0x7')]=_['defaults'](config[_0xcaa7('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcaa7('0x7')]));var Schema=require(_0xcaa7('0x8'));var originateValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xb')]},'callerId':{'type':_0xcaa7('0xa')},'callbackUrl':{'type':_0xcaa7('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':'string','required':[!![],_0xcaa7('0xd')]},'transferNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});function emit(_0x49a218,_0x98c3e2,_0x13f970){logger[_0xcaa7('0xf')](_0x49a218,_0x98c3e2,JSON[_0xcaa7('0x10')](_0x13f970));io['to'](_0x49a218)[_0xcaa7('0x11')](_0x98c3e2,_0x13f970);}function handleError(_0xc46e37){return function(_0x20ede0){console['log']('handleError:',_0x20ede0,_0x20ede0 instanceof RangeError);logger[_0xcaa7('0x12')](_0x20ede0[_0xcaa7('0x13')]);if(_0x20ede0 instanceof RangeError){if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0[_0xcaa7('0x14')];}_0xc46e37[_0xcaa7('0x15')](0x194)[_0xcaa7('0x16')](_0x20ede0);}else{if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0['name'];}_0xc46e37[_0xcaa7('0x15')](0x1f4)[_0xcaa7('0x16')](_0x20ede0);}};}function checkError(){return function(_0x1aa4d2){if(!_0x1aa4d2){throw new RangeError(_0xcaa7('0x17'));}return _0x1aa4d2;};}function respondWithRpcPromise(_0x31ce99,_0x2fcdf7){return new BPromise(function(_0x3119d5,_0x4259b7){var _0x2a9a79=amiClient;return _0x2a9a79[_0xcaa7('0x18')](_0x31ce99,_0x2fcdf7)[_0xcaa7('0x19')](function(_0x140c5a){if(_0x140c5a[_0xcaa7('0x12')]){if(_0x140c5a['error'][_0xcaa7('0x1a')]===0x1f4){return _0x4259b7(_0x140c5a[_0xcaa7('0x12')]['message']);}return _0x3119d5(_0x140c5a[_0xcaa7('0x12')][_0xcaa7('0x1b')]);}else{_0x3119d5(_0x140c5a[_0xcaa7('0x1c')]);}})[_0xcaa7('0x1d')](function(_0x58384f){_0x4259b7(_0x58384f);});});}function getAgent(_0x5d4e7e){return db[_0xcaa7('0x1e')][_0xcaa7('0x1f')]({'where':{'id':_0x5d4e7e,'role':_0xcaa7('0x20')}})[_0xcaa7('0x19')](checkError());}function getAgentCheckSession(_0x4391a9,_0x4ec9e9){return new BPromise(function(_0x1a2577,_0x4c6e87){var _0x5b4914=respondWithRpcPromise(_0xcaa7('0x21'));var _0x492362=getAgent(_0x4391a9);Promise[_0xcaa7('0x22')]([_0x5b4914,_0x492362])[_0xcaa7('0x19')](function(_0x748bda){var _0x1c4200=_0x748bda[0x0];var _0x248ca5=_0x748bda[0x1];var _0x292222=_[_0xcaa7('0x23')](_0x1c4200[_0xcaa7('0x24')],function(_0x492843){return _0x492843[_0xcaa7('0x25')]==_0x248ca5['id']&&_0x492843[_0xcaa7('0x26')]==_0x4ec9e9;});if(_0x292222[_0xcaa7('0x27')]==0x1){_0x1a2577(_0x248ca5);}else{_0x4c6e87(new RangeError(_0xcaa7('0x28')+_0x4ec9e9+_0xcaa7('0x29')));}});});}exports['originate']=function(_0x25c847,_0x394da5){logger[_0xcaa7('0xf')](_0xcaa7('0x2a'),_0x25c847[_0xcaa7('0x2b')]);var _0x483b44=originateValidation[_0xcaa7('0x8')](_0x25c847['body']);if(_0x483b44[_0xcaa7('0x27')]>0x0){return _0x394da5[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x483b44);}var _0x59f2c7=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x133114=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2e')];var _0x27be59=_0x25c847['body'][_0xcaa7('0x2f')];var _0x2b6708=_0x25c847['body'][_0xcaa7('0x30')];return getAgent(_0x59f2c7)[_0xcaa7('0x19')](function(_0x444add){logger[_0xcaa7('0xf')]('entityFound:',_0x444add[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x444add[_0xcaa7('0x14')]),_0xcaa7('0x33'),{'callNumber':_0x133114,'callerId':_0x27be59,'callbackUrl':_0x2b6708});return _0x394da5[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x34')});})[_0xcaa7('0x1d')](handleError(_0x394da5));};exports[_0xcaa7('0x35')]=function(_0xf55432,_0x266d5f){logger['info'](_0xcaa7('0x36'),_0xf55432[_0xcaa7('0x2b')]);var _0x2a57ed=hangupValidation[_0xcaa7('0x8')](_0xf55432[_0xcaa7('0x2b')]);if(_0x2a57ed['length']>0x0){return _0x266d5f[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2a57ed);}var _0x387b12=_0xf55432['body'][_0xcaa7('0x2d')];var _0x3016f1=_0xf55432[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x387b12)['then'](function(_0x3b7884){logger['info'](_0xcaa7('0x37'),_0x3b7884['name']);emit(util[_0xcaa7('0x31')]('user:%s',_0x3b7884['name']),_0xcaa7('0x38'),{'sessionId':_0x3016f1});return _0x266d5f[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x39')});})[_0xcaa7('0x1d')](handleError(_0x266d5f));};exports[_0xcaa7('0x3a')]=function(_0x202572,_0x341e41){logger[_0xcaa7('0xf')](_0xcaa7('0x3b'),_0x202572[_0xcaa7('0x2b')]);var _0x55caaa=answerValidation[_0xcaa7('0x8')](_0x202572[_0xcaa7('0x2b')]);if(_0x55caaa[_0xcaa7('0x27')]>0x0){return _0x341e41[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x55caaa);}var _0x3d6c26=_0x202572['body'][_0xcaa7('0x2d')];var _0x3da46d=_0x202572[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3d6c26)[_0xcaa7('0x19')](function(_0x4df9a6){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x4df9a6[_0xcaa7('0x14')]);emit(util['format'](_0xcaa7('0x32'),_0x4df9a6['name']),_0xcaa7('0x3c'),{'sessionId':_0x3da46d});return _0x341e41[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x3d')});})[_0xcaa7('0x1d')](handleError(_0x341e41));};exports[_0xcaa7('0x3e')]=function(_0x3827b8,_0x53a482){logger['info'](_0xcaa7('0x3f'),_0x3827b8['body']);var _0xa2dbac=holdValidation['validate'](_0x3827b8[_0xcaa7('0x2b')]);if(_0xa2dbac['length']>0x0){return _0x53a482[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0xa2dbac);}var _0x1304a1=_0x3827b8[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x46c790=_0x3827b8['body']['sessionId'];return getAgent(_0x1304a1)[_0xcaa7('0x19')](function(_0x3a5f1f){logger['info'](_0xcaa7('0x37'),_0x3a5f1f[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x3a5f1f[_0xcaa7('0x14')]),_0xcaa7('0x40'),{'sessionId':_0x46c790});return _0x53a482[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x41')});})[_0xcaa7('0x1d')](handleError(_0x53a482));};exports[_0xcaa7('0x42')]=function(_0x3cc7ae,_0x6dfe9e){logger[_0xcaa7('0xf')](_0xcaa7('0x43'),_0x3cc7ae[_0xcaa7('0x2b')]);var _0x5dcc42=unholdValidation[_0xcaa7('0x8')](_0x3cc7ae['body']);if(_0x5dcc42[_0xcaa7('0x27')]>0x0){return _0x6dfe9e[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x5dcc42);}var _0x3e88bb=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1a2e55=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3e88bb)[_0xcaa7('0x19')](function(_0x1df544){logger['info'](_0xcaa7('0x37'),_0x1df544[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')]('user:%s',_0x1df544[_0xcaa7('0x14')]),'webbar:unhold',{'sessionId':_0x1a2e55});return _0x6dfe9e[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x44')});})[_0xcaa7('0x1d')](handleError(_0x6dfe9e));};exports['calls']=function(_0x13c14b,_0x1da84b){logger[_0xcaa7('0xf')](_0xcaa7('0x45'),_0x1da84b[_0xcaa7('0x2b')]);var _0x2d219a=callsValidation[_0xcaa7('0x8')](_0x13c14b[_0xcaa7('0x2b')]);if(_0x2d219a['length']>0x0){return _0x1da84b[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2d219a);}var _0x42795f=_0x13c14b[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0xb7a21b=respondWithRpcPromise('VoiceChannels');var _0xcf623b=getAgent(_0x42795f);return Promise[_0xcaa7('0x22')]([_0xb7a21b,_0xcf623b])['then'](function(_0x9cb6ca){var _0x1a4a4c=_0x9cb6ca[0x0];var _0x39558c=_0x9cb6ca[0x1];var _0x48272e=_[_0xcaa7('0x23')](_0x1a4a4c[_0xcaa7('0x24')],function(_0x49cfd6){return _0x49cfd6[_0xcaa7('0x25')]==_0x39558c['id'];});return _0x1da84b[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'count':_0x48272e[_0xcaa7('0x27')],'rows':_0x48272e});})[_0xcaa7('0x1d')](handleError(_0x1da84b));};exports[_0xcaa7('0x46')]=function(_0x3d4743,_0x206df4){logger[_0xcaa7('0xf')](_0xcaa7('0x47'),_0x3d4743[_0xcaa7('0x2b')]);var _0x994af2=conferenceValidation[_0xcaa7('0x8')](_0x3d4743[_0xcaa7('0x2b')]);if(_0x994af2[_0xcaa7('0x27')]>0x0){return _0x206df4[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x994af2);}var _0x145444=_0x3d4743['body'][_0xcaa7('0x2d')];return getAgent(_0x145444)['then'](function(_0x20b9f4){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x20b9f4['name']);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x20b9f4[_0xcaa7('0x14')]),_0xcaa7('0x48'));return _0x206df4[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x49')});})[_0xcaa7('0x1d')](handleError(_0x206df4));};exports[_0xcaa7('0x4a')]=function(_0x75be2c,_0x525dfb){logger[_0xcaa7('0xf')](_0xcaa7('0x4b'),_0x75be2c['body']);var _0x5ce1e9=transferValidation[_0xcaa7('0x8')](_0x75be2c['body']);if(_0x5ce1e9[_0xcaa7('0x27')]>0x0){return _0x525dfb['status'](0x190)[_0xcaa7('0x2c')](_0x5ce1e9);}var _0x4b87f5=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1645f2=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x26')];var _0x43e4f6=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x4c')];return getAgent(_0x4b87f5)[_0xcaa7('0x19')](function(_0x34d5df){logger['info'](_0xcaa7('0x37'),_0x34d5df[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x34d5df[_0xcaa7('0x14')]),_0xcaa7('0x4d'),{'sessionId':_0x1645f2,'transferNumber':_0x43e4f6});return _0x525dfb[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x4e')});})[_0xcaa7('0x1d')](handleError(_0x525dfb));}; \ No newline at end of file +var _0x2750=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','agent','then','VoiceChannels','all','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','filter','rows','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path'];(function(_0x50ce0c,_0x541b68){var _0x3c988c=function(_0x1684ee){while(--_0x1684ee){_0x50ce0c['push'](_0x50ce0c['shift']());}};_0x3c988c(++_0x541b68);}(_0x2750,0x13b));var _0x0275=function(_0x9d8ad,_0x2af4d5){_0x9d8ad=_0x9d8ad-0x0;var _0x4eff06=_0x2750[_0x9d8ad];return _0x4eff06;};'use strict';var path=require(_0x0275('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x0275('0x1'))['db'];var config=require(_0x0275('0x2'));var util=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var jayson=require(_0x0275('0x5'));var amiClient=jayson[_0x0275('0x6')][_0x0275('0x7')]({'port':0x232a});var logger=require(_0x0275('0x8'))(_0x0275('0x9'));var Redis=require(_0x0275('0xa'));config['redis']=_[_0x0275('0xb')](config[_0x0275('0xc')],{'host':_0x0275('0xd'),'port':0x18eb});var io=require(_0x0275('0xe'))(new Redis(config['redis']));var Schema=require(_0x0275('0xf'));var originateValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x0275('0x12')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'sessionId':{'type':_0x0275('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'sessionId':{'type':_0x0275('0x12'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x0275('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'sessionId':{'type':_0x0275('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0275('0x10'),'required':[!![],_0x0275('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0275('0x11')]}});function emit(_0xaae367,_0x4a40da,_0x10dd2c){logger[_0x0275('0x14')](_0xaae367,_0x4a40da,JSON['stringify'](_0x10dd2c));io['to'](_0xaae367)['emit'](_0x4a40da,_0x10dd2c);}function handleError(_0x56e719){return function(_0x591d27){console['log'](_0x0275('0x15'),_0x591d27,_0x591d27 instanceof RangeError);logger[_0x0275('0x16')](_0x591d27[_0x0275('0x17')]);if(_0x591d27 instanceof RangeError){if(_0x591d27['name']){delete _0x591d27[_0x0275('0x18')];}_0x56e719[_0x0275('0x19')](0x194)[_0x0275('0x1a')](_0x591d27);}else{if(_0x591d27['name']){delete _0x591d27[_0x0275('0x18')];}_0x56e719[_0x0275('0x19')](0x1f4)['send'](_0x591d27);}};}function checkError(){return function(_0x4a5bc1){if(!_0x4a5bc1){throw new RangeError(_0x0275('0x1b'));}return _0x4a5bc1;};}function respondWithRpcPromise(_0xfe9f2f,_0x562c82){return new BPromise(function(_0x592a53,_0xf3b68e){var _0x5ab9e7=amiClient;return _0x5ab9e7[_0x0275('0x1c')](_0xfe9f2f,_0x562c82)['then'](function(_0x26f2c2){if(_0x26f2c2[_0x0275('0x16')]){if(_0x26f2c2['error'][_0x0275('0x1d')]===0x1f4){return _0xf3b68e(_0x26f2c2[_0x0275('0x16')][_0x0275('0x1e')]);}return _0x592a53(_0x26f2c2['error'][_0x0275('0x1e')]);}else{_0x592a53(_0x26f2c2[_0x0275('0x1f')]);}})[_0x0275('0x20')](function(_0x15813f){_0xf3b68e(_0x15813f);});});}function getAgent(_0x1a2024){return db[_0x0275('0x21')]['findOne']({'where':{'id':_0x1a2024,'role':_0x0275('0x22')}})[_0x0275('0x23')](checkError());}function getAgentCheckSession(_0x1d24b2,_0x275dac){return new BPromise(function(_0x4689a3,_0x512d26){var _0x1ffd57=respondWithRpcPromise(_0x0275('0x24'));var _0x3246ea=getAgent(_0x1d24b2);Promise[_0x0275('0x25')]([_0x1ffd57,_0x3246ea])[_0x0275('0x23')](function(_0x49e645){var _0x2d49b4=_0x49e645[0x0];var _0x287be3=_0x49e645[0x1];var _0x127bbd=_['filter'](_0x2d49b4['rows'],function(_0x3cb2d7){return _0x3cb2d7[_0x0275('0x26')]==_0x287be3['id']&&_0x3cb2d7['sessionId']==_0x275dac;});if(_0x127bbd[_0x0275('0x27')]==0x1){_0x4689a3(_0x287be3);}else{_0x512d26(new RangeError(_0x0275('0x28')+_0x275dac+_0x0275('0x29')));}});});}exports[_0x0275('0x2a')]=function(_0x5d763d,_0x24c762){logger[_0x0275('0x14')](_0x0275('0x2b'),_0x5d763d[_0x0275('0x2c')]);var _0x58da2d=originateValidation[_0x0275('0xf')](_0x5d763d['body']);if(_0x58da2d[_0x0275('0x27')]>0x0){return _0x24c762['status'](0x190)[_0x0275('0x2d')](_0x58da2d);}var _0x165157=_0x5d763d['body'][_0x0275('0x2e')];var _0x459f83=_0x5d763d[_0x0275('0x2c')][_0x0275('0x2f')];var _0x487b97=_0x5d763d[_0x0275('0x2c')][_0x0275('0x30')];var _0xbe4741=_0x5d763d[_0x0275('0x2c')][_0x0275('0x31')];return getAgent(_0x165157)['then'](function(_0x2a18c3){logger[_0x0275('0x14')](_0x0275('0x32'),_0x2a18c3[_0x0275('0x18')]);emit(util[_0x0275('0x33')](_0x0275('0x34'),_0x2a18c3[_0x0275('0x18')]),_0x0275('0x35'),{'callNumber':_0x459f83,'callerId':_0x487b97,'callbackUrl':_0xbe4741});return _0x24c762[_0x0275('0x19')](0xc8)[_0x0275('0x2d')]({'error':![],'message':_0x0275('0x36')});})['catch'](handleError(_0x24c762));};exports[_0x0275('0x37')]=function(_0xa93bae,_0xc7d2fe){logger[_0x0275('0x14')](_0x0275('0x38'),_0xa93bae[_0x0275('0x2c')]);var _0x1a2424=hangupValidation[_0x0275('0xf')](_0xa93bae[_0x0275('0x2c')]);if(_0x1a2424[_0x0275('0x27')]>0x0){return _0xc7d2fe[_0x0275('0x19')](0x190)[_0x0275('0x2d')](_0x1a2424);}var _0x32f0cf=_0xa93bae[_0x0275('0x2c')]['userId'];var _0x3c81fc=_0xa93bae[_0x0275('0x2c')]['sessionId'];return getAgent(_0x32f0cf)[_0x0275('0x23')](function(_0x76b8fa){logger[_0x0275('0x14')](_0x0275('0x32'),_0x76b8fa[_0x0275('0x18')]);emit(util[_0x0275('0x33')](_0x0275('0x34'),_0x76b8fa['name']),_0x0275('0x39'),{'sessionId':_0x3c81fc});return _0xc7d2fe[_0x0275('0x19')](0xc8)[_0x0275('0x2d')]({'error':![],'message':_0x0275('0x3a')});})['catch'](handleError(_0xc7d2fe));};exports[_0x0275('0x3b')]=function(_0x1f781b,_0x3f37cb){logger[_0x0275('0x14')]('answer\x20fired:',_0x1f781b[_0x0275('0x2c')]);var _0x52f69c=answerValidation[_0x0275('0xf')](_0x1f781b[_0x0275('0x2c')]);if(_0x52f69c[_0x0275('0x27')]>0x0){return _0x3f37cb[_0x0275('0x19')](0x190)['json'](_0x52f69c);}var _0x13c651=_0x1f781b[_0x0275('0x2c')]['userId'];var _0x1e143e=_0x1f781b[_0x0275('0x2c')][_0x0275('0x3c')];return getAgent(_0x13c651)['then'](function(_0x162327){logger[_0x0275('0x14')]('entityFound:',_0x162327[_0x0275('0x18')]);emit(util[_0x0275('0x33')](_0x0275('0x34'),_0x162327[_0x0275('0x18')]),_0x0275('0x3d'),{'sessionId':_0x1e143e});return _0x3f37cb[_0x0275('0x19')](0xc8)[_0x0275('0x2d')]({'error':![],'message':_0x0275('0x3e')});})[_0x0275('0x20')](handleError(_0x3f37cb));};exports[_0x0275('0x3f')]=function(_0x28b9ad,_0x4d6757){logger[_0x0275('0x14')](_0x0275('0x40'),_0x28b9ad[_0x0275('0x2c')]);var _0x33617b=holdValidation[_0x0275('0xf')](_0x28b9ad[_0x0275('0x2c')]);if(_0x33617b[_0x0275('0x27')]>0x0){return _0x4d6757[_0x0275('0x19')](0x190)[_0x0275('0x2d')](_0x33617b);}var _0x3ac454=_0x28b9ad[_0x0275('0x2c')]['userId'];var _0x589401=_0x28b9ad[_0x0275('0x2c')][_0x0275('0x3c')];return getAgent(_0x3ac454)[_0x0275('0x23')](function(_0x3bd019){logger[_0x0275('0x14')]('entityFound:',_0x3bd019[_0x0275('0x18')]);emit(util['format'](_0x0275('0x34'),_0x3bd019[_0x0275('0x18')]),_0x0275('0x41'),{'sessionId':_0x589401});return _0x4d6757[_0x0275('0x19')](0xc8)['json']({'error':![],'message':_0x0275('0x42')});})['catch'](handleError(_0x4d6757));};exports['unhold']=function(_0x515860,_0x28e90f){logger['info'](_0x0275('0x43'),_0x515860[_0x0275('0x2c')]);var _0x21375e=unholdValidation[_0x0275('0xf')](_0x515860[_0x0275('0x2c')]);if(_0x21375e[_0x0275('0x27')]>0x0){return _0x28e90f[_0x0275('0x19')](0x190)['json'](_0x21375e);}var _0xe6f266=_0x515860['body'][_0x0275('0x2e')];var _0x1c70ed=_0x515860[_0x0275('0x2c')][_0x0275('0x3c')];return getAgent(_0xe6f266)[_0x0275('0x23')](function(_0x4097e8){logger[_0x0275('0x14')](_0x0275('0x32'),_0x4097e8[_0x0275('0x18')]);emit(util[_0x0275('0x33')]('user:%s',_0x4097e8['name']),_0x0275('0x44'),{'sessionId':_0x1c70ed});return _0x28e90f['status'](0xc8)['json']({'error':![],'message':_0x0275('0x45')});})[_0x0275('0x20')](handleError(_0x28e90f));};exports[_0x0275('0x46')]=function(_0x39961c,_0x35994c){logger[_0x0275('0x14')]('calls\x20fired:',_0x35994c[_0x0275('0x2c')]);var _0x163ce2=callsValidation[_0x0275('0xf')](_0x39961c[_0x0275('0x2c')]);if(_0x163ce2[_0x0275('0x27')]>0x0){return _0x35994c[_0x0275('0x19')](0x190)['json'](_0x163ce2);}var _0x33556f=_0x39961c[_0x0275('0x2c')]['userId'];var _0x19d33f=respondWithRpcPromise('VoiceChannels');var _0x4f4e13=getAgent(_0x33556f);return Promise[_0x0275('0x25')]([_0x19d33f,_0x4f4e13])[_0x0275('0x23')](function(_0x3ae09e){var _0x2258f1=_0x3ae09e[0x0];var _0x7749c4=_0x3ae09e[0x1];var _0x30ad5b=_[_0x0275('0x47')](_0x2258f1[_0x0275('0x48')],function(_0x442a7a){return _0x442a7a[_0x0275('0x26')]==_0x7749c4['id'];});return _0x35994c['status'](0xc8)[_0x0275('0x2d')]({'count':_0x30ad5b[_0x0275('0x27')],'rows':_0x30ad5b});})[_0x0275('0x20')](handleError(_0x35994c));};exports['conference']=function(_0x1d408f,_0x126f05){logger['info'](_0x0275('0x49'),_0x1d408f['body']);var _0x4542b0=conferenceValidation[_0x0275('0xf')](_0x1d408f[_0x0275('0x2c')]);if(_0x4542b0[_0x0275('0x27')]>0x0){return _0x126f05['status'](0x190)[_0x0275('0x2d')](_0x4542b0);}var _0x59947e=_0x1d408f[_0x0275('0x2c')][_0x0275('0x2e')];return getAgent(_0x59947e)['then'](function(_0x29f71d){logger[_0x0275('0x14')]('entityFound:',_0x29f71d[_0x0275('0x18')]);emit(util[_0x0275('0x33')]('user:%s',_0x29f71d['name']),_0x0275('0x4a'));return _0x126f05[_0x0275('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x0275('0x20')](handleError(_0x126f05));};exports[_0x0275('0x4b')]=function(_0x93831b,_0x14b5ab){logger[_0x0275('0x14')](_0x0275('0x4c'),_0x93831b[_0x0275('0x2c')]);var _0x2b7a93=transferValidation['validate'](_0x93831b[_0x0275('0x2c')]);if(_0x2b7a93[_0x0275('0x27')]>0x0){return _0x14b5ab[_0x0275('0x19')](0x190)[_0x0275('0x2d')](_0x2b7a93);}var _0x3e4e09=_0x93831b[_0x0275('0x2c')]['userId'];var _0x1a4b01=_0x93831b['body'][_0x0275('0x3c')];var _0x287429=_0x93831b[_0x0275('0x2c')][_0x0275('0x4d')];return getAgent(_0x3e4e09)['then'](function(_0x38d006){logger[_0x0275('0x14')](_0x0275('0x32'),_0x38d006[_0x0275('0x18')]);emit(util[_0x0275('0x33')](_0x0275('0x34'),_0x38d006[_0x0275('0x18')]),_0x0275('0x4e'),{'sessionId':_0x1a4b01,'transferNumber':_0x287429});return _0x14b5ab[_0x0275('0x19')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14b5ab));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0dc6ecc..888c410 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 _0xaea1=['./whatsappAccount.controller','get','index','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAgents','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/users','/:id/applications','addApplications','notify','/:id/send','send','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaea1,0x1e8));var _0x1aea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaea1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x1aea('0x0'));var util=require(_0x1aea('0x1'));var path=require(_0x1aea('0x2'));var timeout=require('connect-timeout');var express=require(_0x1aea('0x3'));var router=express['Router']();var fs_extra=require(_0x1aea('0x4'));var auth=require(_0x1aea('0x5'));var interaction=require(_0x1aea('0x6'));var config=require('../../config/environment');var controller=require(_0x1aea('0x7'));router[_0x1aea('0x8')]('/',auth['isAuthenticated'](),controller[_0x1aea('0x9')]);router[_0x1aea('0x8')]('/describe',auth[_0x1aea('0xa')](),controller[_0x1aea('0xb')]);router[_0x1aea('0x8')](_0x1aea('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1aea('0x8')](_0x1aea('0xd'),auth['isAuthenticated'](),controller[_0x1aea('0xe')]);router[_0x1aea('0x8')]('/:id/canned_answers',auth[_0x1aea('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x1aea('0xa')](),controller[_0x1aea('0xf')]);router[_0x1aea('0x8')]('/:id/applications',auth[_0x1aea('0xa')](),controller[_0x1aea('0x10')]);router[_0x1aea('0x11')]('/',auth[_0x1aea('0xa')](),controller[_0x1aea('0x12')]);router[_0x1aea('0x11')](_0x1aea('0xd'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x13')]);router[_0x1aea('0x11')](_0x1aea('0x14'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x15')]);router[_0x1aea('0x11')](_0x1aea('0x16'),auth[_0x1aea('0xa')](),controller['addAgents']);router['post'](_0x1aea('0x17'),auth['isAuthenticated'](),controller[_0x1aea('0x18')]);router[_0x1aea('0x11')]('/:id/notify',controller[_0x1aea('0x19')]);router[_0x1aea('0x11')](_0x1aea('0x1a'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x1b')]);router[_0x1aea('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x1aea('0x1d')]);router[_0x1aea('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x1aea('0x1f')]);router[_0x1aea('0x1e')](_0x1aea('0xd'),auth[_0x1aea('0xa')](),controller['removeDispositions']);router[_0x1aea('0x1e')](_0x1aea('0x14'),auth[_0x1aea('0xa')](),controller['removeAnswers']);router['delete'](_0x1aea('0x16'),auth[_0x1aea('0xa')](),controller['removeAgents']);module[_0x1aea('0x20')]=router; \ No newline at end of file +var _0x98f1=['create','addAnswer','addApplications','/:id/notify','/:id/send','send','put','destroy','removeDispositions','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post'];(function(_0x463ad4,_0x4686c7){var _0x29ec8b=function(_0x4d3c7e){while(--_0x4d3c7e){_0x463ad4['push'](_0x463ad4['shift']());}};_0x29ec8b(++_0x4686c7);}(_0x98f1,0xde));var _0x198f=function(_0x2eb35d,_0x4a7a45){_0x2eb35d=_0x2eb35d-0x0;var _0x1f9854=_0x98f1[_0x2eb35d];return _0x1f9854;};'use strict';var multer=require(_0x198f('0x0'));var util=require(_0x198f('0x1'));var path=require('path');var timeout=require(_0x198f('0x2'));var express=require(_0x198f('0x3'));var router=express[_0x198f('0x4')]();var fs_extra=require(_0x198f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x198f('0x6'));var controller=require(_0x198f('0x7'));router[_0x198f('0x8')]('/',auth['isAuthenticated'](),controller[_0x198f('0x9')]);router[_0x198f('0x8')](_0x198f('0xa'),auth[_0x198f('0xb')](),controller[_0x198f('0xc')]);router[_0x198f('0x8')](_0x198f('0xd'),auth[_0x198f('0xb')](),controller[_0x198f('0xe')]);router[_0x198f('0x8')](_0x198f('0xf'),auth[_0x198f('0xb')](),controller['getDispositions']);router[_0x198f('0x8')](_0x198f('0x10'),auth[_0x198f('0xb')](),controller[_0x198f('0x11')]);router[_0x198f('0x8')](_0x198f('0x12'),auth[_0x198f('0xb')](),controller[_0x198f('0x13')]);router[_0x198f('0x8')](_0x198f('0x14'),auth[_0x198f('0xb')](),controller[_0x198f('0x15')]);router[_0x198f('0x16')]('/',auth[_0x198f('0xb')](),controller[_0x198f('0x17')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x198f('0x16')](_0x198f('0x10'),auth[_0x198f('0xb')](),controller[_0x198f('0x18')]);router[_0x198f('0x16')]('/:id/users',auth[_0x198f('0xb')](),controller['addAgents']);router[_0x198f('0x16')](_0x198f('0x14'),auth[_0x198f('0xb')](),controller[_0x198f('0x19')]);router['post'](_0x198f('0x1a'),controller['notify']);router[_0x198f('0x16')](_0x198f('0x1b'),auth['isAuthenticated'](),controller[_0x198f('0x1c')]);router[_0x198f('0x1d')](_0x198f('0xd'),auth[_0x198f('0xb')](),controller['update']);router['delete'](_0x198f('0xd'),auth[_0x198f('0xb')](),controller[_0x198f('0x1e')]);router['delete'](_0x198f('0xf'),auth['isAuthenticated'](),controller[_0x198f('0x1f')]);router[_0x198f('0x20')](_0x198f('0x10'),auth[_0x198f('0xb')](),controller['removeAnswers']);router['delete'](_0x198f('0x12'),auth[_0x198f('0xb')](),controller[_0x198f('0x21')]);module[_0x198f('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 c9fa57b..a4a4213 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 _0x5991=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x5991,0x1f4));var _0x1599=function(_0x4afd61,_0x10dfd9){_0x4afd61=_0x4afd61-0x0;var _0xcb0190=_0x5991[_0x4afd61];return _0xcb0190;};'use strict';var Sequelize=require(_0x1599('0x0'));var rs=require(_0x1599('0x1'));module[_0x1599('0x2')]={'name':{'type':Sequelize[_0x1599('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1599('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1599('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1599('0x3')]},'type':{'type':Sequelize[_0x1599('0x4')](_0x1599('0x5'),_0x1599('0x6'))},'accountSid':{'type':Sequelize[_0x1599('0x3')]},'baseUrl':{'type':Sequelize[_0x1599('0x3')]},'authToken':{'type':Sequelize[_0x1599('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1599('0x7')],'defaultValue':function(){return _0x1599('0x8');}},'notificationSound':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1599('0xa')],'comment':_0x1599('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![],'comment':_0x1599('0xc'),'set':function(_0x288652){if(!_0x288652){this[_0x1599('0xd')]('mandatoryDispositionPauseId',null);}this[_0x1599('0xd')](_0x1599('0xe'),_0x288652);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb8f0=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb8f0,0xf2));var _0x0b8f=function(_0x44d3bd,_0x31be4d){_0x44d3bd=_0x44d3bd-0x0;var _0x360748=_0xb8f0[_0x44d3bd];return _0x360748;};'use strict';var Sequelize=require(_0x0b8f('0x0'));var rs=require('randomstring');module[_0x0b8f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0b8f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0b8f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0b8f('0x3')],'defaultValue':function(){return rs[_0x0b8f('0x4')]();}},'phone':{'type':Sequelize[_0x0b8f('0x3')]},'type':{'type':Sequelize[_0x0b8f('0x5')](_0x0b8f('0x6'),_0x0b8f('0x7'))},'accountSid':{'type':Sequelize[_0x0b8f('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0b8f('0x3')]},'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[_0x0b8f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b8f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b8f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b8f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b8f('0x9')],'comment':_0x0b8f('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0b8f('0x8')],'defaultValue':![],'comment':_0x0b8f('0xb'),'set':function(_0xefe89a){if(!_0xefe89a){this[_0x0b8f('0xc')](_0x0b8f('0xd'),null);}this[_0x0b8f('0xc')](_0x0b8f('0xe'),_0xefe89a);}},'description':{'type':Sequelize[_0x0b8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8a8f9dd..a6c4a35 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 _0xf943=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','get','role','user','userProfileId','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','list','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','WhatsappAccounts','UserProfileResource','then','stack','name','send','index','Pause','map'];(function(_0x512672,_0x240349){var _0x20ea9d=function(_0x5ab15a){while(--_0x5ab15a){_0x512672['push'](_0x512672['shift']());}};_0x20ea9d(++_0x240349);}(_0xf943,0x150));var _0x3f94=function(_0xf38b17,_0x492fc7){_0xf38b17=_0xf38b17-0x0;var _0x43d3f7=_0xf943[_0xf38b17];return _0x43d3f7;};'use strict';var emlformat=require(_0x3f94('0x0'));var rimraf=require(_0x3f94('0x1'));var zipdir=require(_0x3f94('0x2'));var jsonpatch=require(_0x3f94('0x3'));var rp=require(_0x3f94('0x4'));var moment=require(_0x3f94('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f94('0x6'));var util=require(_0x3f94('0x7'));var path=require('path');var sox=require(_0x3f94('0x8'));var csv=require('to-csv');var ejs=require(_0x3f94('0x9'));var fs=require('fs');var fs_extra=require(_0x3f94('0xa'));var _=require(_0x3f94('0xb'));var squel=require(_0x3f94('0xc'));var crypto=require(_0x3f94('0xd'));var jsforce=require(_0x3f94('0xe'));var deskjs=require(_0x3f94('0xf'));var toCsv=require(_0x3f94('0x10'));var querystring=require(_0x3f94('0x11'));var Papa=require(_0x3f94('0x12'));var Redis=require('ioredis');var authService=require(_0x3f94('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f94('0x14'));var logger=require(_0x3f94('0x15'))('api');var utils=require(_0x3f94('0x16'));var config=require(_0x3f94('0x17'));var licenseUtil=require(_0x3f94('0x18'));var db=require(_0x3f94('0x19'))['db'];config['redis']=_[_0x3f94('0x1a')](config[_0x3f94('0x1b')],{'host':_0x3f94('0x1c'),'port':0x18eb});var socket=require(_0x3f94('0x1d'))(new Redis(config[_0x3f94('0x1b')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3f94('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2cbd17,_0x2abc45,_0xdafe3,_0x56a84c){return new BPromise(function(_0x303d26,_0x55a923){var _0x16f927=_0x56a84c||client;return _0x16f927['request'](_0x2cbd17,_0xdafe3)['then'](function(_0x147785){logger[_0x3f94('0x1f')](_0x3f94('0x20'),_0x2abc45,_0x3f94('0x21'));logger[_0x3f94('0x22')](_0x3f94('0x23'),_0x2abc45,_0x3f94('0x21'),JSON[_0x3f94('0x24')](_0x147785));if(_0x147785[_0x3f94('0x25')]){if(_0x147785[_0x3f94('0x25')][_0x3f94('0x26')]===0x1f4){logger[_0x3f94('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);return _0x55a923(_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);}logger[_0x3f94('0x25')](_0x3f94('0x20'),_0x2abc45,_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);return _0x303d26(_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,'request\x20sent');_0x303d26(_0x147785[_0x3f94('0x28')][_0x3f94('0x27')]);}})[_0x3f94('0x29')](function(_0x4e8858){logger[_0x3f94('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,_0x4e8858);_0x55a923(_0x4e8858);});});}function respondWithStatusCode(_0x29b26a,_0x28d173){_0x28d173=_0x28d173||0xcc;return function(_0x122d70){if(_0x122d70){return _0x29b26a[_0x3f94('0x2a')](_0x28d173);}return _0x29b26a[_0x3f94('0x2b')](_0x28d173)[_0x3f94('0x2c')]();};}function respondWithResult(_0x1e9d7e,_0x386160){_0x386160=_0x386160||0xc8;return function(_0x176c03){if(_0x176c03){return _0x1e9d7e[_0x3f94('0x2b')](_0x386160)[_0x3f94('0x2d')](_0x176c03);}};}function respondWithFilteredResult(_0xc78c14,_0x402add){return function(_0x13ef65){if(_0x13ef65){var _0x3e0661=typeof _0x402add[_0x3f94('0x2e')]===_0x3f94('0x2f')&&typeof _0x402add[_0x3f94('0x30')]==='undefined';var _0x1a12d3=_0x13ef65[_0x3f94('0x31')];var _0x5a7f24=_0x3e0661?0x0:_0x402add['offset'];var _0x4212e6=_0x3e0661?_0x13ef65[_0x3f94('0x31')]:_0x402add[_0x3f94('0x2e')]+_0x402add[_0x3f94('0x30')];var _0x594296;if(_0x4212e6>=_0x1a12d3){_0x4212e6=_0x1a12d3;_0x594296=0xc8;}else{_0x594296=0xce;}_0xc78c14[_0x3f94('0x2b')](_0x594296);return _0xc78c14[_0x3f94('0x32')](_0x3f94('0x33'),_0x5a7f24+'-'+_0x4212e6+'/'+_0x1a12d3)[_0x3f94('0x2d')](_0x13ef65);}return null;};}function patchUpdates(_0x377c6b){return function(_0xf08d60){try{jsonpatch[_0x3f94('0x34')](_0xf08d60,_0x377c6b,!![]);}catch(_0xf305ac){return BPromise[_0x3f94('0x35')](_0xf305ac);}return _0xf08d60['save']();};}function saveUpdates(_0x500133,_0x263195){return function(_0x35fdda){if(_0x35fdda){return _0x35fdda['update'](_0x500133)['then'](function(_0x4a4697){return _0x4a4697;});}return null;};}function removeEntity(_0x54ff40,_0x55feb6){return function(_0x254c41){if(_0x254c41){return _0x254c41[_0x3f94('0x36')]()['then'](function(){var _0x465104=_0x254c41['get']({'plain':!![]});var _0x9fca99=_0x3f94('0x37');return db[_0x3f94('0x38')][_0x3f94('0x36')]({'where':{'type':_0x9fca99,'resourceId':_0x465104['id']}})['then'](function(){return _0x254c41;});})[_0x3f94('0x39')](function(){_0x54ff40[_0x3f94('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549484,_0xd8e46f){return function(_0x12463d){if(!_0x12463d){_0x549484['sendStatus'](0x194);}return _0x12463d;};}function handleError(_0x4c8c58,_0x1fbe74){_0x1fbe74=_0x1fbe74||0x1f4;return function(_0x4c5b8a){logger[_0x3f94('0x25')](_0x4c5b8a[_0x3f94('0x3a')]);if(_0x4c5b8a[_0x3f94('0x3b')]){delete _0x4c5b8a[_0x3f94('0x3b')];}_0x4c8c58['status'](_0x1fbe74)[_0x3f94('0x3c')](_0x4c5b8a);};}exports[_0x3f94('0x3d')]=function(_0x5e6d4a,_0x495196){var _0x5d7468={'include':[{'model':db[_0x3f94('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3bae04={},_0x24201d={'count':0x0,'rows':[]};var _0xd01f2d=_[_0x3f94('0x3f')](db['WhatsappAccount'][_0x3f94('0x40')],function(_0x3541c6){return{'name':_0x3541c6[_0x3f94('0x41')],'type':_0x3541c6[_0x3f94('0x42')]['key']};});_0x3bae04[_0x3f94('0x43')]=_[_0x3f94('0x3f')](_0xd01f2d,'name');_0x3bae04[_0x3f94('0x44')]=_[_0x3f94('0x45')](_0x5e6d4a[_0x3f94('0x44')]);_0x3bae04[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x3bae04['model'],_0x3bae04[_0x3f94('0x44')]);_0x5d7468['attributes']=_['intersection'](_0x3bae04[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x5e6d4a['query'][_0x3f94('0x48')]));_0x5d7468['attributes']=_0x5d7468[_0x3f94('0x49')][_0x3f94('0x4a')]?_0x5d7468[_0x3f94('0x49')]:_0x3bae04[_0x3f94('0x43')];if(!_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x4b')]('nolimit')){_0x5d7468[_0x3f94('0x30')]=qs['limit'](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x30')]);_0x5d7468[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x2e')]);}_0x5d7468[_0x3f94('0x4c')]=qs['sort'](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x5d7468[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x5e6d4a['query'],_0x3bae04['filters']),_0xd01f2d);if(_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x50')]){_0x5d7468['where']=_[_0x3f94('0x51')](_0x5d7468[_0x3f94('0x4e')],{'$or':_[_0x3f94('0x3f')](_0xd01f2d,function(_0x577b49){if(_0x577b49['type']!==_0x3f94('0x52')){var _0x1457c5={};_0x1457c5[_0x577b49[_0x3f94('0x3b')]]={'$like':'%'+_0x5e6d4a[_0x3f94('0x44')]['filter']+'%'};return _0x1457c5;}})});}_0x5d7468=_[_0x3f94('0x51')]({},_0x5d7468,_0x5e6d4a[_0x3f94('0x53')]);var _0x2ff4c2={'where':_0x5d7468[_0x3f94('0x4e')]};return db[_0x3f94('0x54')][_0x3f94('0x31')](_0x2ff4c2)[_0x3f94('0x39')](function(_0x28c475){_0x24201d[_0x3f94('0x31')]=_0x28c475;if(_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x55')]){_0x5d7468[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x54')][_0x3f94('0x57')](_0x5d7468);})['then'](function(_0x251b15){_0x24201d[_0x3f94('0x58')]=_0x251b15;return _0x24201d;})[_0x3f94('0x39')](respondWithFilteredResult(_0x495196,_0x5d7468))[_0x3f94('0x29')](handleError(_0x495196,null));};exports[_0x3f94('0x59')]=function(_0x3537af,_0x43f064){var _0xc9d750={'raw':![],'where':{'id':_0x3537af[_0x3f94('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3f94('0x5b')}]},_0x3f01a3={};_0x3f01a3[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x54')][_0x3f94('0x40')]);_0x3f01a3[_0x3f94('0x44')]=_['keys'](_0x3537af[_0x3f94('0x44')]);_0x3f01a3[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x3f01a3['model'],_0x3f01a3['query']);_0xc9d750[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x3f01a3[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x3537af[_0x3f94('0x44')][_0x3f94('0x48')]));_0xc9d750[_0x3f94('0x49')]=_0xc9d750['attributes'][_0x3f94('0x4a')]?_0xc9d750[_0x3f94('0x49')]:_0x3f01a3[_0x3f94('0x43')];if(_0x3537af[_0x3f94('0x44')][_0x3f94('0x55')]){_0xc9d750['include']=[{'all':!![]}];}_0xc9d750=_[_0x3f94('0x51')]({},_0xc9d750,_0x3537af[_0x3f94('0x53')]);return db['WhatsappAccount'][_0x3f94('0x5c')](_0xc9d750)[_0x3f94('0x39')](handleEntityNotFound(_0x43f064,null))['then'](respondWithResult(_0x43f064,null))[_0x3f94('0x29')](handleError(_0x43f064,null));};exports[_0x3f94('0x5d')]=function(_0x3f5dc3,_0x41317b){return db['WhatsappAccount'][_0x3f94('0x5d')](_0x3f5dc3[_0x3f94('0x5e')],{})[_0x3f94('0x39')](function(_0x23f71b){var _0x908a9=_0x3f5dc3['user'][_0x3f94('0x5f')]({'plain':!![]});if(!_0x908a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x908a9[_0x3f94('0x60')]===_0x3f94('0x61')){var _0x424695=_0x23f71b[_0x3f94('0x5f')]({'plain':!![]});var _0x29eed5=_0x3f94('0x37');return db['UserProfileSection'][_0x3f94('0x5c')]({'where':{'name':_0x29eed5,'userProfileId':_0x908a9[_0x3f94('0x62')]},'raw':!![]})['then'](function(_0x9af88){if(_0x9af88&&_0x9af88['autoAssociation']===0x0){return db[_0x3f94('0x38')][_0x3f94('0x5d')]({'name':_0x424695[_0x3f94('0x3b')],'resourceId':_0x424695['id'],'type':_0x9af88[_0x3f94('0x3b')],'sectionId':_0x9af88['id']},{})[_0x3f94('0x39')](function(){return _0x23f71b;});}else{return _0x23f71b;}})['catch'](function(_0x4779bb){logger[_0x3f94('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4779bb);throw _0x4779bb;});}return _0x23f71b;})[_0x3f94('0x39')](respondWithResult(_0x41317b,0xc9))[_0x3f94('0x29')](handleError(_0x41317b,null));};exports[_0x3f94('0x63')]=function(_0x47fd5c,_0xd433ec){if(_0x47fd5c[_0x3f94('0x5e')]['id']){delete _0x47fd5c[_0x3f94('0x5e')]['id'];}return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x47fd5c['params']['id']},'include':[{'model':db[_0x3f94('0x3e')],'as':_0x3f94('0x5b')}]})[_0x3f94('0x39')](handleEntityNotFound(_0xd433ec,null))[_0x3f94('0x39')](saveUpdates(_0x47fd5c[_0x3f94('0x5e')],null))[_0x3f94('0x39')](respondWithResult(_0xd433ec,null))[_0x3f94('0x29')](handleError(_0xd433ec,null));};exports[_0x3f94('0x36')]=function(_0x1124b0,_0x3e9fd3){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x1124b0['params']['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x3e9fd3,null))['then'](removeEntity(_0x3e9fd3,null))[_0x3f94('0x29')](handleError(_0x3e9fd3,null));};exports[_0x3f94('0x64')]=function(_0x2f5c1a,_0x2e0a54){return db[_0x3f94('0x54')][_0x3f94('0x64')]()[_0x3f94('0x39')](respondWithResult(_0x2e0a54,null))[_0x3f94('0x29')](handleError(_0x2e0a54,null));};exports[_0x3f94('0x65')]=function(_0x36f1a7,_0x13a313,_0x43d88c){if(_0x36f1a7[_0x3f94('0x5e')]['id']){delete _0x36f1a7[_0x3f94('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x36f1a7[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x13a313,null))[_0x3f94('0x39')](function(_0x478e41){if(_0x478e41){_0x36f1a7[_0x3f94('0x5e')][_0x3f94('0x66')]=_0x478e41['id'];return db[_0x3f94('0x67')][_0x3f94('0x5d')](_0x36f1a7[_0x3f94('0x5e')]);}})[_0x3f94('0x39')](respondWithResult(_0x13a313,null))['catch'](handleError(_0x13a313,null));};exports[_0x3f94('0x68')]=function(_0x11ad49,_0x3c3119,_0xa1566b){var _0x3d7561={'raw':![],'where':{}};var _0x4fc4c5={};var _0x30cfc6={'count':0x0,'rows':[]};return db[_0x3f94('0x54')]['findOne']({'where':{'id':_0x11ad49[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x3c3119,null))['then'](function(_0x62d61b){if(_0x62d61b){_0x4fc4c5[_0x3f94('0x43')]=_['keys'](db[_0x3f94('0x67')][_0x3f94('0x40')]);_0x4fc4c5['query']=_[_0x3f94('0x45')](_0x11ad49[_0x3f94('0x44')]);_0x4fc4c5[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x4fc4c5[_0x3f94('0x43')],_0x4fc4c5[_0x3f94('0x44')]);_0x3d7561[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x4fc4c5['model'],qs[_0x3f94('0x48')](_0x11ad49[_0x3f94('0x44')]['fields']));_0x3d7561[_0x3f94('0x49')]=_0x3d7561['attributes'][_0x3f94('0x4a')]?_0x3d7561[_0x3f94('0x49')]:_0x4fc4c5[_0x3f94('0x43')];if(!_0x11ad49[_0x3f94('0x44')][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x3d7561[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x11ad49['query'][_0x3f94('0x30')]);_0x3d7561['offset']=qs[_0x3f94('0x2e')](_0x11ad49[_0x3f94('0x44')]['offset']);}_0x3d7561[_0x3f94('0x4c')]=qs['sort'](_0x11ad49[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x3d7561['where']=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x11ad49['query'],_0x4fc4c5[_0x3f94('0x46')]));_0x3d7561[_0x3f94('0x4e')][_0x3f94('0x66')]=_0x62d61b['id'];if(_0x11ad49[_0x3f94('0x44')]['filter']){_0x3d7561[_0x3f94('0x4e')]=_[_0x3f94('0x51')](_0x3d7561['where'],{'$or':_[_0x3f94('0x3f')](_0x3d7561[_0x3f94('0x49')],function(_0x56df21){var _0x53e90a={};_0x53e90a[_0x56df21]={'$like':'%'+_0x11ad49[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x53e90a;})});}_0x3d7561=_[_0x3f94('0x51')]({},_0x3d7561,_0x11ad49[_0x3f94('0x53')]);return db[_0x3f94('0x67')][_0x3f94('0x31')]({'where':_0x3d7561[_0x3f94('0x4e')]})[_0x3f94('0x39')](function(_0x16b887){_0x30cfc6[_0x3f94('0x31')]=_0x16b887;if(_0x11ad49[_0x3f94('0x44')]['includeAll']){_0x3d7561[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x67')][_0x3f94('0x57')](_0x3d7561);})[_0x3f94('0x39')](function(_0x49535d){_0x30cfc6['rows']=_0x49535d;return _0x30cfc6;});}})['then'](respondWithFilteredResult(_0x3c3119,_0x3d7561))[_0x3f94('0x29')](handleError(_0x3c3119,null));};exports[_0x3f94('0x6a')]=function(_0x2d4c30,_0x23319b,_0x2401c8){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x2d4c30[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x23319b,null))['then'](function(_0x21043e){if(_0x21043e){return _0x21043e['removeDispositions'](_0x2d4c30[_0x3f94('0x44')][_0x3f94('0x6b')]);}})[_0x3f94('0x39')](respondWithStatusCode(_0x23319b,null))[_0x3f94('0x29')](handleError(_0x23319b,null));};exports[_0x3f94('0x6c')]=function(_0x5c920a,_0xab487a,_0x803a9){if(_0x5c920a[_0x3f94('0x5e')]['id']){delete _0x5c920a[_0x3f94('0x5e')]['id'];}return db[_0x3f94('0x54')]['find']({'where':{'id':_0x5c920a['params']['id']}})['then'](handleEntityNotFound(_0xab487a,null))[_0x3f94('0x39')](function(_0x5a2af){if(_0x5a2af){_0x5c920a['body'][_0x3f94('0x66')]=_0x5a2af['id'];return db[_0x3f94('0x6d')][_0x3f94('0x5d')](_0x5c920a['body']);}})[_0x3f94('0x39')](respondWithResult(_0xab487a,null))[_0x3f94('0x29')](handleError(_0xab487a,null));};exports[_0x3f94('0x6e')]=function(_0x500d78,_0x4b4855,_0x4e90e4){var _0x5df0a1={'raw':![],'where':{}};var _0x812fa8={};var _0x150b7a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3f94('0x6f')]({'where':{'id':_0x500d78[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x4b4855,null))[_0x3f94('0x39')](function(_0x4ed5e5){if(_0x4ed5e5){_0x812fa8[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x6d')][_0x3f94('0x40')]);_0x812fa8[_0x3f94('0x44')]=_[_0x3f94('0x45')](_0x500d78[_0x3f94('0x44')]);_0x812fa8[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x812fa8[_0x3f94('0x43')],_0x812fa8[_0x3f94('0x44')]);_0x5df0a1[_0x3f94('0x49')]=_['intersection'](_0x812fa8[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x48')]));_0x5df0a1[_0x3f94('0x49')]=_0x5df0a1[_0x3f94('0x49')][_0x3f94('0x4a')]?_0x5df0a1[_0x3f94('0x49')]:_0x812fa8['model'];if(!_0x500d78[_0x3f94('0x44')]['hasOwnProperty'](_0x3f94('0x69'))){_0x5df0a1[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x500d78[_0x3f94('0x44')]['limit']);_0x5df0a1[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x2e')]);}_0x5df0a1[_0x3f94('0x4c')]=qs[_0x3f94('0x4d')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x5df0a1[_0x3f94('0x4e')]=qs['filters'](_[_0x3f94('0x4f')](_0x500d78[_0x3f94('0x44')],_0x812fa8[_0x3f94('0x46')]));_0x5df0a1[_0x3f94('0x4e')][_0x3f94('0x66')]=_0x4ed5e5['id'];if(_0x500d78['query']['filter']){_0x5df0a1['where']=_[_0x3f94('0x51')](_0x5df0a1['where'],{'$or':_[_0x3f94('0x3f')](_0x5df0a1[_0x3f94('0x49')],function(_0x1de727){var _0x5e4234={};_0x5e4234[_0x1de727]={'$like':'%'+_0x500d78[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x5e4234;})});}_0x5df0a1=_[_0x3f94('0x51')]({},_0x5df0a1,_0x500d78[_0x3f94('0x53')]);return db[_0x3f94('0x6d')]['count']({'where':_0x5df0a1['where']})[_0x3f94('0x39')](function(_0xbe6916){_0x150b7a[_0x3f94('0x31')]=_0xbe6916;if(_0x500d78['query'][_0x3f94('0x55')]){_0x5df0a1[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x6d')][_0x3f94('0x57')](_0x5df0a1);})[_0x3f94('0x39')](function(_0x5dbaf2){_0x150b7a[_0x3f94('0x58')]=_0x5dbaf2;return _0x150b7a;});}})[_0x3f94('0x39')](respondWithFilteredResult(_0x4b4855,_0x5df0a1))[_0x3f94('0x29')](handleError(_0x4b4855,null));};exports[_0x3f94('0x70')]=function(_0x4b1db9,_0x29c8f4,_0x75f03c){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x4b1db9['params']['id']}})['then'](handleEntityNotFound(_0x29c8f4,null))[_0x3f94('0x39')](function(_0x2a3c09){if(_0x2a3c09){return _0x2a3c09['removeAnswers'](_0x4b1db9[_0x3f94('0x44')]['ids']);}})[_0x3f94('0x39')](respondWithStatusCode(_0x29c8f4,null))[_0x3f94('0x29')](handleError(_0x29c8f4,null));};exports[_0x3f94('0x71')]=function(_0x4e170d,_0x4d062c,_0x14b115){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x4e170d[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x4d062c,null))[_0x3f94('0x39')](function(_0x5a9d63){if(_0x5a9d63){return _0x5a9d63['addAgents'](_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')],_[_0x3f94('0x72')](_0x4e170d[_0x3f94('0x5e')],['ids','id'])||{})[_0x3f94('0x73')](function(_0x69726f){for(var _0x4aec98=0x0;_0x4aec98<_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')][_0x3f94('0x4a')];_0x4aec98+=0x1){socket[_0x3f94('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')][_0x4aec98]),'WhatsappAccountId':Number(_0x4e170d[_0x3f94('0x5a')]['id'])});}return _0x69726f;});}})[_0x3f94('0x39')](respondWithResult(_0x4d062c,null))[_0x3f94('0x29')](handleError(_0x4d062c,null));};exports['removeAgents']=function(_0x5a9357,_0x32a59d,_0x40df45){return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x5a9357[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x32a59d,null))['then'](function(_0x59f64d){if(_0x59f64d){return _0x59f64d[_0x3f94('0x75')](_0x5a9357[_0x3f94('0x44')]['ids'])[_0x3f94('0x39')](function(){if(_[_0x3f94('0x76')](_0x5a9357['query'][_0x3f94('0x6b')])){for(var _0x22edf8=0x0;_0x22edf8<_0x5a9357[_0x3f94('0x44')][_0x3f94('0x6b')][_0x3f94('0x4a')];_0x22edf8+=0x1){socket[_0x3f94('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x5a9357[_0x3f94('0x44')]['ids'][_0x22edf8]),'WhatsappAccountId':Number(_0x5a9357[_0x3f94('0x5a')]['id'])});}}else{socket['emit'](_0x3f94('0x77'),{'UserId':Number(_0x5a9357[_0x3f94('0x44')][_0x3f94('0x6b')]),'WhatsappAccountId':Number(_0x5a9357[_0x3f94('0x5a')]['id'])});}});}})[_0x3f94('0x39')](respondWithStatusCode(_0x32a59d,null))['catch'](handleError(_0x32a59d,null));};exports[_0x3f94('0x78')]=function(_0x133c3a,_0x377c5e,_0x11de6f){var _0x46c09c={};var _0x4a783e={};var _0x398eb9;var _0x377db3;return db[_0x3f94('0x54')][_0x3f94('0x6f')]({'where':{'id':_0x133c3a[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x377c5e,null))[_0x3f94('0x39')](function(_0x312d50){if(_0x312d50){_0x398eb9=_0x312d50;_0x4a783e[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x79')]['rawAttributes']);_0x4a783e[_0x3f94('0x44')]=_['keys'](_0x133c3a[_0x3f94('0x44')]);_0x4a783e[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x4a783e[_0x3f94('0x43')],_0x4a783e['query']);_0x46c09c[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x4a783e[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x133c3a[_0x3f94('0x44')]['fields']));_0x46c09c[_0x3f94('0x49')]=_0x46c09c['attributes']['length']?_0x46c09c[_0x3f94('0x49')]:_0x4a783e[_0x3f94('0x43')];_0x46c09c[_0x3f94('0x4c')]=qs['sort'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x46c09c[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_['pick'](_0x133c3a[_0x3f94('0x44')],_0x4a783e[_0x3f94('0x46')]));if(_0x133c3a[_0x3f94('0x44')][_0x3f94('0x50')]){_0x46c09c['where']=_[_0x3f94('0x51')](_0x46c09c[_0x3f94('0x4e')],{'$or':_[_0x3f94('0x3f')](_0x46c09c[_0x3f94('0x49')],function(_0x81bde4){var _0x4fb6ed={};_0x4fb6ed[_0x81bde4]={'$like':'%'+_0x133c3a[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x4fb6ed;})});}_0x46c09c=_[_0x3f94('0x51')]({},_0x46c09c,_0x133c3a[_0x3f94('0x53')]);return _0x398eb9['getAgents'](_0x46c09c);}})[_0x3f94('0x39')](function(_0x33f01b){if(_0x33f01b){_0x377db3=_0x33f01b[_0x3f94('0x4a')];if(!_0x133c3a[_0x3f94('0x44')][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x46c09c[_0x3f94('0x30')]=qs['limit'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x30')]);_0x46c09c[_0x3f94('0x2e')]=qs['offset'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x2e')]);}return _0x398eb9[_0x3f94('0x78')](_0x46c09c);}})[_0x3f94('0x39')](function(_0x38aeb3){if(_0x38aeb3){return _0x38aeb3?{'count':_0x377db3,'rows':_0x38aeb3}:null;}})[_0x3f94('0x39')](respondWithResult(_0x377c5e,null))['catch'](handleError(_0x377c5e,null));};exports['addApplications']=function(_0x2b7f05,_0x4160d2){var _0x5628d8=_0x2b7f05[_0x3f94('0x5a')]['id'];var _0x5014f2=_0x2b7f05[_0x3f94('0x5e')];var _0xf26f4a=0xc8;var _0x534c68=null;return db[_0x3f94('0x7a')][_0x3f94('0x7b')]({'isolationLevel':db[_0x3f94('0x7a')][_0x3f94('0x7c')][_0x3f94('0x7d')][_0x3f94('0x7e')]},function(_0x3e0691){return db[_0x3f94('0x54')][_0x3f94('0x6f')]({'where':{'id':_0x5628d8},'transaction':_0x3e0691})[_0x3f94('0x39')](function(_0x2ea836){if(_0x2ea836){return db[_0x3f94('0x7f')][_0x3f94('0x36')]({'where':{'WhatsappAccountId':_0x5628d8},'transaction':_0x3e0691})['then'](function(){var _0x3ba0a8=_[_0x3f94('0x3f')](_0x5014f2,function(_0x19a8b8){_0x19a8b8['WhatsappAccountId']=_0x5628d8;return _0x19a8b8;});return db[_0x3f94('0x7f')][_0x3f94('0x80')](_0x3ba0a8,{'transaction':_0x3e0691});});}else{_0xf26f4a=0x194;_0x534c68=[];}});})[_0x3f94('0x39')](function(){if(_0xf26f4a!==0x194){return db[_0x3f94('0x7f')][_0x3f94('0x81')]({'where':{'WhatsappAccountId':_0x5628d8},'order':_0x3f94('0x82')})[_0x3f94('0x39')](function(_0x153be9){_0x534c68=_0x153be9;});}})[_0x3f94('0x29')](function(_0x104bfb){_0xf26f4a=0x1f4;logger[_0x3f94('0x25')](_0x104bfb[_0x3f94('0x3a')]);if(_0x104bfb[_0x3f94('0x3b')]){delete _0x104bfb[_0x3f94('0x3b')];}_0x534c68=_0x104bfb;})[_0x3f94('0x83')](function(){if(_0x534c68===null){_0x4160d2[_0x3f94('0x2a')](_0xf26f4a);}else{if(_0xf26f4a===0x1f4){_0x4160d2['status'](_0xf26f4a)[_0x3f94('0x3c')](_0x534c68);}else{_0x4160d2['status'](_0xf26f4a)['json'](_0x534c68);}}});};exports[_0x3f94('0x84')]=function(_0x26db89,_0x13b402,_0x20c641){var _0x14659e={};var _0x2def48={};var _0x586ef3;var _0x5f48a2;return db[_0x3f94('0x54')]['findOne']({'where':{'id':_0x26db89[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x13b402,null))[_0x3f94('0x39')](function(_0x10a218){if(_0x10a218){_0x586ef3=_0x10a218;_0x2def48[_0x3f94('0x43')]=_['keys'](db[_0x3f94('0x7f')][_0x3f94('0x40')]);_0x2def48['query']=_['keys'](_0x26db89[_0x3f94('0x44')]);_0x2def48['filters']=_[_0x3f94('0x47')](_0x2def48[_0x3f94('0x43')],_0x2def48[_0x3f94('0x44')]);_0x14659e['attributes']=_[_0x3f94('0x47')](_0x2def48[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x48')]));_0x14659e['attributes']=_0x14659e['attributes'][_0x3f94('0x4a')]?_0x14659e[_0x3f94('0x49')]:_0x2def48[_0x3f94('0x43')];_0x14659e['order']=qs[_0x3f94('0x4d')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x14659e[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x26db89[_0x3f94('0x44')],_0x2def48[_0x3f94('0x46')]));if(_0x26db89[_0x3f94('0x44')][_0x3f94('0x50')]){_0x14659e[_0x3f94('0x4e')]=_[_0x3f94('0x51')](_0x14659e[_0x3f94('0x4e')],{'$or':_['map'](_0x14659e[_0x3f94('0x49')],function(_0x294482){var _0x5d8946={};_0x5d8946[_0x294482]={'$like':'%'+_0x26db89[_0x3f94('0x44')]['filter']+'%'};return _0x5d8946;})});}_0x14659e=_[_0x3f94('0x51')]({},_0x14659e,_0x26db89[_0x3f94('0x53')]);return _0x586ef3[_0x3f94('0x84')](_0x14659e);}})[_0x3f94('0x39')](function(_0x1b748b){if(_0x1b748b){_0x5f48a2=_0x1b748b['length'];if(!_0x26db89['query'][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x14659e[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x26db89['query'][_0x3f94('0x30')]);_0x14659e[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x2e')]);}return _0x586ef3[_0x3f94('0x84')](_0x14659e);}})['then'](function(_0x5e1b07){if(_0x5e1b07){return _0x5e1b07?{'count':_0x5f48a2,'rows':_0x5e1b07}:null;}})[_0x3f94('0x39')](respondWithResult(_0x13b402,null))[_0x3f94('0x29')](handleError(_0x13b402,null));};exports[_0x3f94('0x85')]=function(_0xe86953,_0x40a4b1,_0x2df1f4){var _0x51f65b={'channel':'whatsapp'};var _0x153887=[];var _0x2c9640=[];var _0x29f5cb={};return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0xe86953[_0x3f94('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3f94('0x86')}]})[_0x3f94('0x39')](handleEntityNotFound(_0x40a4b1,null))[_0x3f94('0x39')](function(_0x429a57){_0x51f65b[_0x3f94('0x87')]=_0x429a57;if(_0x51f65b['account']&&_0x51f65b['account']['type']===_0x3f94('0x88')&&_0xe86953[_0x3f94('0x5e')]['statuses']){if(_0xe86953[_0x3f94('0x5e')]['statuses'][_0x3f94('0x4a')]===0x0)return;if(_0xe86953[_0x3f94('0x5e')][_0x3f94('0x89')][0x0][_0x3f94('0x8a')]!==_0x3f94('0x8b'))return;return db[_0x3f94('0x8c')]['update']({'read':!![],'readAt':_0xe86953[_0x3f94('0x5e')]['statuses'][0x0][_0x3f94('0x8d')]},{'where':{'messageId':_0xe86953['body'][_0x3f94('0x89')][0x0][_0x3f94('0x8e')]},'individualHooks':!![]})[_0x3f94('0x39')](function(_0x1b7daf){return _0x40a4b1[_0x3f94('0x2b')](0xc8)[_0x3f94('0x2d')](_0x1b7daf);});}_0x51f65b[_0x3f94('0x8f')]=_['orderBy'](_0x429a57['Applications'],[_0x3f94('0x82')],['asc']);if(_0x51f65b['account'][_0x3f94('0x86')]){delete _0x51f65b[_0x3f94('0x87')][_0x3f94('0x86')];}return db['CmContact'][_0x3f94('0x64')]()[_0x3f94('0x39')](function(_0x7c85d5){if(!_0x7c85d5){throw new db[(_0x3f94('0x90'))]['ValidationError']('no\x20available\x20attributes');}_0x153887=_[_0x3f94('0x91')](_[_0x3f94('0x45')](_0x7c85d5),[_0x3f94('0x92'),_0x3f94('0x93')]);_0x2c9640=_[_0x3f94('0x91')](_[_0x3f94('0x45')](_0x7c85d5),[_0x3f94('0x92'),_0x3f94('0x93'),_0x3f94('0x94'),_0x3f94('0x95')]);_0x51f65b[_0x3f94('0x5e')]={'mapKey':_0x3f94('0x96')};if(_0x51f65b[_0x3f94('0x87')]&&_0x51f65b['account'][_0x3f94('0x42')]===_0x3f94('0x97')){_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x99')][_0x3f94('0x9a')](_0x3f94('0x9b'),'');_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x9c')];_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x9d')]=_0xe86953['body'][_0x3f94('0x9e')];}if(_0x51f65b[_0x3f94('0x87')]&&_0x51f65b[_0x3f94('0x87')][_0x3f94('0x42')]===_0x3f94('0x88')){_0x51f65b['body'][_0x3f94('0x98')]=_0xe86953[_0x3f94('0x5e')]['notifications'][0x0][_0x3f94('0x98')];_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x9f')][0x0][_0x3f94('0x27')]['body'];_0x51f65b['body'][_0x3f94('0x9d')]=_0xe86953[_0x3f94('0x5e')]['notifications'][0x0][_0x3f94('0x8e')];}if(_0x51f65b[_0x3f94('0x5e')]['id']){delete _0x51f65b[_0x3f94('0x5e')]['id'];}if(_[_0x3f94('0xa0')](_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')])){throw new db[(_0x3f94('0x90'))]['ValidationError'](_0x3f94('0xa1'));}if(_['isNil'](_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')])||_0x51f65b['body'][_0x3f94('0x5e')]===''){throw new db['Sequelize'][(_0x3f94('0xa2'))](_0x3f94('0xa3'));}if(_[_0x3f94('0xa0')](_0x51f65b['body']['mapKey'])){throw new db[(_0x3f94('0x90'))]['ValidationError'](_0x3f94('0xa4')+_0x2c9640);}if(!_['includes'](_0x2c9640,_0x51f65b[_0x3f94('0x5e')]['mapKey'])){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xa5')+_0x2c9640);}_0x29f5cb[_0x51f65b['body'][_0x3f94('0xa6')]]=_0x51f65b['body'][_0x3f94('0x98')];return db[_0x3f94('0xa7')][_0x3f94('0x5c')]({'where':{'id':_0x51f65b[_0x3f94('0x87')][_0x3f94('0x95')]},'include':[{'model':db[_0x3f94('0xa8')],'as':_0x3f94('0xa9'),'where':_0x29f5cb,'limit':0x1,'order':[[_0x3f94('0x93'),_0x3f94('0xaa')]]}]});})['then'](handleEntityNotFound(_0x40a4b1,null))[_0x3f94('0x39')](function(_0x980b4d){if(_0x980b4d){_0x51f65b[_0x3f94('0xab')]=_['omit'](_0x980b4d,['Contacts']);if(_0x980b4d['Contacts'][_0x3f94('0x4a')]){return _0x980b4d[_0x3f94('0xa9')][0x0];}var _0x52888e=_[_0x3f94('0x1a')](_0x51f65b['body'],{'firstName':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')],'ListId':_0x980b4d['id']});_0x52888e[_0x51f65b[_0x3f94('0x5e')][_0x3f94('0xa6')]]=_0x51f65b['body'][_0x3f94('0x98')];return db[_0x3f94('0xa8')][_0x3f94('0x5d')](_0x52888e,{'fields':_0x153887,'raw':!![]});}})[_0x3f94('0x39')](handleEntityNotFound(_0x40a4b1,null))['then'](function(_0x745dda){if(_0x745dda){_0x51f65b['contact']=_0x745dda;var _0xd64ea5={'ContactId':_0x745dda['id'],'phone':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')],'WhatsappAccountId':_0xe86953[_0x3f94('0x5a')]['id']};var _0x7c8e94={'ContactId':_0x745dda['id'],'WhatsappAccountId':_0xe86953['params']['id'],'closed':![]};return db[_0x3f94('0xac')][_0x3f94('0x5c')]({'where':_0x7c8e94})['then'](function(_0x59c2a3){if(_0x59c2a3){return[_0x59c2a3,![]];}return db['WhatsappInteraction'][_0x3f94('0x5d')](_0xd64ea5)[_0x3f94('0x39')](function(_0x510d9a){return[_0x510d9a,!![]];});});}})[_0x3f94('0x73')](function(_0x4b7725,_0x164ade){_0x51f65b[_0x3f94('0xad')]=_0x4b7725[_0x3f94('0x5f')]({'plain':!![]});_0x51f65b[_0x3f94('0xad')]['created']=![];if(_0x164ade){if(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xae')]){_0x51f65b['applications'][_0x3f94('0xaf')]({'id':0x0,'priority':_0x51f65b[_0x3f94('0x8f')][_0x3f94('0x4a')]+0x1,'app':_0x3f94('0xb0'),'appdata':_0x3f94('0xb1'),'interval':_0x3f94('0xb2')});}_0x51f65b[_0x3f94('0xad')][_0x3f94('0xb3')]=!![];}return db['WhatsappMessage'][_0x3f94('0x5d')]({'phone':_0x51f65b['body'][_0x3f94('0x98')],'messageId':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x9d')],'body':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')],'WhatsappAccountId':_0xe86953[_0x3f94('0x5a')]['id'],'WhatsappInteractionId':_0x4b7725['id'],'direction':'in','ContactId':_0x4b7725['ContactId'],'AttachmentId':_0x51f65b[_0x3f94('0x5e')]['AttachmentId']});})['then'](function(_0x5ccf07){_0x51f65b[_0x3f94('0x27')]=_0x5ccf07;if(!_0x51f65b['interaction'][_0x3f94('0xb4')])return;return db[_0x3f94('0x79')]['find']({'attributes':['id',_0x3f94('0x3b')],'where':{'id':_0x51f65b[_0x3f94('0xad')]['UserId']}});})[_0x3f94('0x39')](function(_0x1af2a4){if(_0x1af2a4){_0x51f65b[_0x3f94('0x8f')][_0x3f94('0xb5')]({'id':0x0,'priority':0x0,'app':_0x3f94('0xb6'),'appdata':_0x1af2a4[_0x3f94('0x3b')]+','+(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xb7')]||0xa),'interval':_0x3f94('0xb2')});}if(!_0x51f65b[_0x3f94('0xad')]['queueId'])return;return db[_0x3f94('0xb8')][_0x3f94('0x5c')]({'attributes':['id','name'],'where':{'id':_0x51f65b['interaction']['queueId']}});})[_0x3f94('0x39')](function(_0x13b8e7){if(_0x13b8e7){_0x51f65b[_0x3f94('0x8f')][_0x3f94('0xb5')]({'id':0x0,'priority':0x1,'app':_0x3f94('0xb9'),'appdata':_0x13b8e7['name']+','+(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xba')]||0x12c),'interval':_0x3f94('0xb2')});}return respondWithRpcPromise(_0x3f94('0xbb'),_0x3f94('0xbc'),_0x51f65b);})[_0x3f94('0x39')](function(_0x49ad75){if(_0x49ad75){var _0x22d9cd=0xc8;var _0x380874=_0x3f94('0xbd');logger[_0x3f94('0x1f')](_0x3f94('0x23'),_0x380874,_0x22d9cd,_0x3f94('0xbe'));logger['debug'](_0x3f94('0xbf'),_0x380874,_0x22d9cd,'entity\x20found',JSON[_0x3f94('0x24')](_0x49ad75));if(_0x51f65b[_0x3f94('0x87')][_0x3f94('0x42')]==='twilio'){return _0x40a4b1['status'](_0x22d9cd)['set'](_0x3f94('0xc0'),_0x3f94('0xc1'))['send'](_0x3f94('0xc2'));}else{return _0x40a4b1['status'](_0x22d9cd)[_0x3f94('0x2d')](_0x49ad75);}}});})[_0x3f94('0x29')](handleError(_0x40a4b1,null));};exports[_0x3f94('0x3c')]=function(_0x3c25cc,_0x39e387,_0x4f490d){var _0x48755b,_0xf0f793,_0x10b850;if(_[_0x3f94('0xa0')](_0x3c25cc[_0x3f94('0x5e')]['body'])||_0x3c25cc[_0x3f94('0x5e')][_0x3f94('0x5e')]===''){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xa3'));}if(_[_0x3f94('0xa0')](_0x3c25cc[_0x3f94('0x5e')]['to'])){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xc3'));}_0x48755b=_0x3c25cc[_0x3f94('0x5e')]['to'];return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x3c25cc[_0x3f94('0x5a')]['id']},'include':[{'model':db[_0x3f94('0xa7')],'as':_0x3f94('0xc4'),'include':[{'model':db[_0x3f94('0xa8')],'as':'Contacts','where':{'mobile':_0x48755b},'limit':0x1,'order':[[_0x3f94('0x93'),_0x3f94('0xaa')]]}]}]})[_0x3f94('0x39')](handleEntityNotFound(_0x39e387,null))['then'](function(_0x252909){if(_0x252909&&_0x252909[_0x3f94('0xc4')]){_0xf0f793=_0x252909[_0x3f94('0x5f')]({'plain':!![]});if(_0xf0f793[_0x3f94('0xc4')]&&_0xf0f793[_0x3f94('0xc4')][_0x3f94('0xa9')]['length']){return _0xf0f793['List'][_0x3f94('0xa9')][0x0];}return db[_0x3f94('0xa8')]['create'](_[_0x3f94('0x1a')](_0x3c25cc[_0x3f94('0x5e')],{'firstName':_0x48755b,'mobile':_0x48755b,'phone':_0x48755b,'ListId':_0xf0f793[_0x3f94('0x95')]}));}})['then'](handleEntityNotFound(_0x39e387,null))['then'](function(_0x582a85){if(_0x582a85){_0x10b850=_0x582a85;return db[_0x3f94('0xac')]['find']({'where':{'ContactId':_0x10b850['id'],'closed':![],'WhatsappAccountId':_0xf0f793['id']}})[_0x3f94('0x39')](function(_0x14af0c){if(_0x14af0c){return[_0x14af0c,![]];}return db['WhatsappInteraction'][_0x3f94('0x5d')]({'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id'],'WhatsappAccountId':_0xf0f793['id'],'phone':_0x48755b,'firstMsgDirection':_0x3f94('0xc5'),'Messages':[_[_0x3f94('0x51')](_0x3c25cc[_0x3f94('0x5e')],{'read':![],'body':_0x3c25cc['body']['body'],'phone':_0x48755b,'WhatsappAccountId':_0xf0f793['id'],'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id']})]},{'include':[{'model':db[_0x3f94('0x8c')],'as':_0x3f94('0xc6')}]})[_0x3f94('0x39')](function(_0x1a092e){return[_0x1a092e,!![]];});});}})[_0x3f94('0x73')](function(_0x1afad2,_0x11b6c7){if(_0x11b6c7){return _0x1afad2;}return db[_0x3f94('0x8c')][_0x3f94('0x5d')](_[_0x3f94('0x51')](_0x3c25cc['body'],{'read':![],'body':_0x3c25cc[_0x3f94('0x5e')][_0x3f94('0x5e')],'phone':_0x48755b,'WhatsappAccountId':_0xf0f793['id'],'WhatsappInteractionId':_0x1afad2['id'],'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id']}))[_0x3f94('0x39')](function(_0x7ba463){_0x1afad2[_0x3f94('0xc7')][_0x3f94('0xc6')]=[];_0x1afad2[_0x3f94('0xc7')][_0x3f94('0xc6')][_0x3f94('0xaf')](_0x7ba463[_0x3f94('0xc7')]);return _0x1afad2;});})[_0x3f94('0x39')](respondWithResult(_0x39e387,null))[_0x3f94('0x29')](handleError(_0x39e387,null));}; \ No newline at end of file +var _0x59b9=['status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','findOne','nolimit','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','timestamp','applications','orderBy','Applications','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','replace','Body','MessageSid','notifications','message_id','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end'];(function(_0x170394,_0x161950){var _0x6f7580=function(_0x5d9e10){while(--_0x5d9e10){_0x170394['push'](_0x170394['shift']());}};_0x6f7580(++_0x161950);}(_0x59b9,0x15b));var _0x959b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x59b9[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x959b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x959b('0x1'));var jsonpatch=require(_0x959b('0x2'));var rp=require(_0x959b('0x3'));var moment=require(_0x959b('0x4'));var BPromise=require(_0x959b('0x5'));var Mustache=require(_0x959b('0x6'));var util=require(_0x959b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x959b('0x8'));var ejs=require(_0x959b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x959b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x959b('0xb'));var toCsv=require(_0x959b('0x8'));var querystring=require(_0x959b('0xc'));var Papa=require(_0x959b('0xd'));var Redis=require(_0x959b('0xe'));var authService=require(_0x959b('0xf'));var qs=require(_0x959b('0x10'));var as=require(_0x959b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x959b('0x12'))(_0x959b('0x13'));var utils=require(_0x959b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x959b('0x15'))['db'];config[_0x959b('0x16')]=_[_0x959b('0x17')](config[_0x959b('0x16')],{'host':_0x959b('0x18'),'port':0x18eb});var socket=require(_0x959b('0x19'))(new Redis(config[_0x959b('0x16')]));require(_0x959b('0x1a'))[_0x959b('0x1b')](socket);var jayson=require(_0x959b('0x1c'));var client=jayson[_0x959b('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x403cff,_0x3280b4,_0x3d708c,_0x30a696){return new BPromise(function(_0x1e06f5,_0x5c3f24){var _0x2fdd8d=_0x30a696||client;return _0x2fdd8d['request'](_0x403cff,_0x3d708c)['then'](function(_0x1f6974){logger[_0x959b('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x3280b4,_0x959b('0x1f'));logger['debug'](_0x959b('0x20'),_0x3280b4,_0x959b('0x1f'),JSON[_0x959b('0x21')](_0x1f6974));if(_0x1f6974['error']){if(_0x1f6974[_0x959b('0x22')]['code']===0x1f4){logger['error'](_0x959b('0x23'),_0x3280b4,_0x1f6974[_0x959b('0x22')][_0x959b('0x24')]);return _0x5c3f24(_0x1f6974[_0x959b('0x22')][_0x959b('0x24')]);}logger[_0x959b('0x22')](_0x959b('0x23'),_0x3280b4,_0x1f6974[_0x959b('0x22')][_0x959b('0x24')]);return _0x1e06f5(_0x1f6974[_0x959b('0x22')][_0x959b('0x24')]);}else{logger[_0x959b('0x1e')](_0x959b('0x23'),_0x3280b4,_0x959b('0x1f'));_0x1e06f5(_0x1f6974[_0x959b('0x25')]['message']);}})[_0x959b('0x26')](function(_0x478a54){logger['error'](_0x959b('0x23'),_0x3280b4,_0x478a54);_0x5c3f24(_0x478a54);});});}function respondWithStatusCode(_0x28b9b9,_0x9d1de5){_0x9d1de5=_0x9d1de5||0xcc;return function(_0x42b686){if(_0x42b686){return _0x28b9b9[_0x959b('0x27')](_0x9d1de5);}return _0x28b9b9['status'](_0x9d1de5)[_0x959b('0x28')]();};}function respondWithResult(_0x20367b,_0x4924cb){_0x4924cb=_0x4924cb||0xc8;return function(_0x5de5b8){if(_0x5de5b8){return _0x20367b[_0x959b('0x29')](_0x4924cb)[_0x959b('0x2a')](_0x5de5b8);}};}function respondWithFilteredResult(_0x3e2ad8,_0x4df5fe){return function(_0x55c3ec){if(_0x55c3ec){var _0x8e7fcc=typeof _0x4df5fe['offset']===_0x959b('0x2b')&&typeof _0x4df5fe[_0x959b('0x2c')]===_0x959b('0x2b');var _0x513478=_0x55c3ec['count'];var _0x2dfec7=_0x8e7fcc?0x0:_0x4df5fe['offset'];var _0x34d63d=_0x8e7fcc?_0x55c3ec[_0x959b('0x2d')]:_0x4df5fe[_0x959b('0x2e')]+_0x4df5fe[_0x959b('0x2c')];var _0x2efa56;if(_0x34d63d>=_0x513478){_0x34d63d=_0x513478;_0x2efa56=0xc8;}else{_0x2efa56=0xce;}_0x3e2ad8['status'](_0x2efa56);return _0x3e2ad8[_0x959b('0x2f')](_0x959b('0x30'),_0x2dfec7+'-'+_0x34d63d+'/'+_0x513478)[_0x959b('0x2a')](_0x55c3ec);}return null;};}function patchUpdates(_0x262e34){return function(_0x253ba0){try{jsonpatch['apply'](_0x253ba0,_0x262e34,!![]);}catch(_0x21cf5f){return BPromise[_0x959b('0x31')](_0x21cf5f);}return _0x253ba0[_0x959b('0x32')]();};}function saveUpdates(_0x2ec416,_0x569ed3){return function(_0x4104bb){if(_0x4104bb){return _0x4104bb[_0x959b('0x33')](_0x2ec416)['then'](function(_0x226981){return _0x226981;});}return null;};}function removeEntity(_0x5903dd,_0x5b1948){return function(_0x482951){if(_0x482951){return _0x482951[_0x959b('0x34')]()[_0x959b('0x35')](function(){var _0x3bfc5f=_0x482951[_0x959b('0x36')]({'plain':!![]});var _0x27b940=_0x959b('0x37');return db[_0x959b('0x38')][_0x959b('0x34')]({'where':{'type':_0x27b940,'resourceId':_0x3bfc5f['id']}})[_0x959b('0x35')](function(){return _0x482951;});})[_0x959b('0x35')](function(){_0x5903dd[_0x959b('0x29')](0xcc)[_0x959b('0x28')]();});}};}function handleEntityNotFound(_0x10cfd3,_0x1d6bdc){return function(_0xd20bb3){if(!_0xd20bb3){_0x10cfd3[_0x959b('0x27')](0x194);}return _0xd20bb3;};}function handleError(_0x1400de,_0x19bc6e){_0x19bc6e=_0x19bc6e||0x1f4;return function(_0x20ddcb){logger['error'](_0x20ddcb[_0x959b('0x39')]);if(_0x20ddcb[_0x959b('0x3a')]){delete _0x20ddcb[_0x959b('0x3a')];}_0x1400de[_0x959b('0x29')](_0x19bc6e)[_0x959b('0x3b')](_0x20ddcb);};}exports['index']=function(_0x399d54,_0x4b5946){var _0x5edbd7={'include':[{'model':db[_0x959b('0x3c')],'as':_0x959b('0x3d')}]},_0x624a99={},_0x4c3115={'count':0x0,'rows':[]};var _0x18db2f=_[_0x959b('0x3e')](db[_0x959b('0x3f')][_0x959b('0x40')],function(_0x400e11){return{'name':_0x400e11[_0x959b('0x41')],'type':_0x400e11['type'][_0x959b('0x42')]};});_0x624a99[_0x959b('0x43')]=_['map'](_0x18db2f,_0x959b('0x3a'));_0x624a99['query']=_[_0x959b('0x44')](_0x399d54['query']);_0x624a99[_0x959b('0x45')]=_['intersection'](_0x624a99[_0x959b('0x43')],_0x624a99[_0x959b('0x46')]);_0x5edbd7[_0x959b('0x47')]=_[_0x959b('0x48')](_0x624a99[_0x959b('0x43')],qs['fields'](_0x399d54['query'][_0x959b('0x49')]));_0x5edbd7[_0x959b('0x47')]=_0x5edbd7[_0x959b('0x47')][_0x959b('0x4a')]?_0x5edbd7[_0x959b('0x47')]:_0x624a99[_0x959b('0x43')];if(!_0x399d54[_0x959b('0x46')][_0x959b('0x4b')]('nolimit')){_0x5edbd7[_0x959b('0x2c')]=qs[_0x959b('0x2c')](_0x399d54['query'][_0x959b('0x2c')]);_0x5edbd7[_0x959b('0x2e')]=qs[_0x959b('0x2e')](_0x399d54[_0x959b('0x46')][_0x959b('0x2e')]);}_0x5edbd7[_0x959b('0x4c')]=qs[_0x959b('0x4d')](_0x399d54[_0x959b('0x46')][_0x959b('0x4d')]);_0x5edbd7[_0x959b('0x4e')]=qs['filters'](_[_0x959b('0x4f')](_0x399d54[_0x959b('0x46')],_0x624a99[_0x959b('0x45')]),_0x18db2f);if(_0x399d54[_0x959b('0x46')][_0x959b('0x50')]){_0x5edbd7[_0x959b('0x4e')]=_['merge'](_0x5edbd7[_0x959b('0x4e')],{'$or':_[_0x959b('0x3e')](_0x18db2f,function(_0x4bd453){if(_0x4bd453[_0x959b('0x51')]!==_0x959b('0x52')){var _0x3de5be={};_0x3de5be[_0x4bd453[_0x959b('0x3a')]]={'$like':'%'+_0x399d54[_0x959b('0x46')][_0x959b('0x50')]+'%'};return _0x3de5be;}})});}_0x5edbd7=_[_0x959b('0x53')]({},_0x5edbd7,_0x399d54[_0x959b('0x54')]);var _0x5f1ef3={'where':_0x5edbd7[_0x959b('0x4e')]};return db[_0x959b('0x3f')][_0x959b('0x2d')](_0x5f1ef3)[_0x959b('0x35')](function(_0x20b804){_0x4c3115[_0x959b('0x2d')]=_0x20b804;if(_0x399d54[_0x959b('0x46')][_0x959b('0x55')]){_0x5edbd7[_0x959b('0x56')]=[{'all':!![]}];}return db[_0x959b('0x3f')][_0x959b('0x57')](_0x5edbd7);})[_0x959b('0x35')](function(_0x283554){_0x4c3115[_0x959b('0x58')]=_0x283554;return _0x4c3115;})[_0x959b('0x35')](respondWithFilteredResult(_0x4b5946,_0x5edbd7))['catch'](handleError(_0x4b5946,null));};exports[_0x959b('0x59')]=function(_0x295f90,_0x1e0386){var _0x26082a={'raw':![],'where':{'id':_0x295f90[_0x959b('0x5a')]['id']},'include':[{'model':db[_0x959b('0x3c')],'as':_0x959b('0x3d')}]},_0x927dd6={};_0x927dd6[_0x959b('0x43')]=_[_0x959b('0x44')](db[_0x959b('0x3f')][_0x959b('0x40')]);_0x927dd6['query']=_[_0x959b('0x44')](_0x295f90[_0x959b('0x46')]);_0x927dd6[_0x959b('0x45')]=_[_0x959b('0x48')](_0x927dd6[_0x959b('0x43')],_0x927dd6[_0x959b('0x46')]);_0x26082a[_0x959b('0x47')]=_[_0x959b('0x48')](_0x927dd6[_0x959b('0x43')],qs[_0x959b('0x49')](_0x295f90[_0x959b('0x46')][_0x959b('0x49')]));_0x26082a[_0x959b('0x47')]=_0x26082a[_0x959b('0x47')]['length']?_0x26082a[_0x959b('0x47')]:_0x927dd6[_0x959b('0x43')];if(_0x295f90[_0x959b('0x46')][_0x959b('0x55')]){_0x26082a['include']=[{'all':!![]}];}_0x26082a=_[_0x959b('0x53')]({},_0x26082a,_0x295f90[_0x959b('0x54')]);return db[_0x959b('0x3f')][_0x959b('0x5b')](_0x26082a)[_0x959b('0x35')](handleEntityNotFound(_0x1e0386,null))['then'](respondWithResult(_0x1e0386,null))[_0x959b('0x26')](handleError(_0x1e0386,null));};exports[_0x959b('0x5c')]=function(_0x4418a4,_0x150bf6){return db[_0x959b('0x3f')][_0x959b('0x5c')](_0x4418a4[_0x959b('0x5d')],{})[_0x959b('0x35')](function(_0x4169ac){var _0xd3ceef=_0x4418a4[_0x959b('0x5e')]['get']({'plain':!![]});if(!_0xd3ceef)throw new Error(_0x959b('0x5f'));if(_0xd3ceef[_0x959b('0x60')]===_0x959b('0x5e')){var _0x23d9e0=_0x4169ac[_0x959b('0x36')]({'plain':!![]});var _0x2fbb90='WhatsappAccounts';return db[_0x959b('0x61')][_0x959b('0x5b')]({'where':{'name':_0x2fbb90,'userProfileId':_0xd3ceef[_0x959b('0x62')]},'raw':!![]})[_0x959b('0x35')](function(_0x23d4fd){if(_0x23d4fd&&_0x23d4fd[_0x959b('0x63')]===0x0){return db[_0x959b('0x38')]['create']({'name':_0x23d9e0[_0x959b('0x3a')],'resourceId':_0x23d9e0['id'],'type':_0x23d4fd[_0x959b('0x3a')],'sectionId':_0x23d4fd['id']},{})[_0x959b('0x35')](function(){return _0x4169ac;});}else{return _0x4169ac;}})[_0x959b('0x26')](function(_0x2642b1){logger[_0x959b('0x22')](_0x959b('0x64'),_0x2642b1);throw _0x2642b1;});}return _0x4169ac;})[_0x959b('0x35')](respondWithResult(_0x150bf6,0xc9))[_0x959b('0x26')](handleError(_0x150bf6,null));};exports[_0x959b('0x33')]=function(_0x1a3a56,_0x4c0c9d){if(_0x1a3a56[_0x959b('0x5d')]['id']){delete _0x1a3a56[_0x959b('0x5d')]['id'];}return db[_0x959b('0x3f')][_0x959b('0x5b')]({'where':{'id':_0x1a3a56['params']['id']},'include':[{'model':db[_0x959b('0x3c')],'as':_0x959b('0x3d')}]})['then'](handleEntityNotFound(_0x4c0c9d,null))[_0x959b('0x35')](saveUpdates(_0x1a3a56[_0x959b('0x5d')],null))['then'](respondWithResult(_0x4c0c9d,null))[_0x959b('0x26')](handleError(_0x4c0c9d,null));};exports[_0x959b('0x34')]=function(_0x2bc0a1,_0x2da9ea){return db[_0x959b('0x3f')][_0x959b('0x5b')]({'where':{'id':_0x2bc0a1[_0x959b('0x5a')]['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x2da9ea,null))['then'](removeEntity(_0x2da9ea,null))['catch'](handleError(_0x2da9ea,null));};exports[_0x959b('0x65')]=function(_0x2d1b37,_0x54d028){return db['WhatsappAccount'][_0x959b('0x65')]()[_0x959b('0x35')](respondWithResult(_0x54d028,null))[_0x959b('0x26')](handleError(_0x54d028,null));};exports['addDisposition']=function(_0x290205,_0x2a75f5,_0x35444a){if(_0x290205[_0x959b('0x5d')]['id']){delete _0x290205[_0x959b('0x5d')]['id'];}return db[_0x959b('0x3f')]['find']({'where':{'id':_0x290205[_0x959b('0x5a')]['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x2a75f5,null))[_0x959b('0x35')](function(_0x334065){if(_0x334065){_0x290205[_0x959b('0x5d')][_0x959b('0x66')]=_0x334065['id'];return db['Disposition'][_0x959b('0x5c')](_0x290205[_0x959b('0x5d')]);}})[_0x959b('0x35')](respondWithResult(_0x2a75f5,null))['catch'](handleError(_0x2a75f5,null));};exports['getDispositions']=function(_0x52b111,_0x3d29ef,_0x4bcfea){var _0x208f6a={'raw':![],'where':{}};var _0x2dc222={};var _0x369bc7={'count':0x0,'rows':[]};return db[_0x959b('0x3f')][_0x959b('0x67')]({'where':{'id':_0x52b111['params']['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x3d29ef,null))[_0x959b('0x35')](function(_0x244595){if(_0x244595){_0x2dc222[_0x959b('0x43')]=_[_0x959b('0x44')](db['Disposition'][_0x959b('0x40')]);_0x2dc222[_0x959b('0x46')]=_[_0x959b('0x44')](_0x52b111['query']);_0x2dc222[_0x959b('0x45')]=_[_0x959b('0x48')](_0x2dc222[_0x959b('0x43')],_0x2dc222[_0x959b('0x46')]);_0x208f6a[_0x959b('0x47')]=_[_0x959b('0x48')](_0x2dc222[_0x959b('0x43')],qs[_0x959b('0x49')](_0x52b111['query'][_0x959b('0x49')]));_0x208f6a[_0x959b('0x47')]=_0x208f6a[_0x959b('0x47')]['length']?_0x208f6a[_0x959b('0x47')]:_0x2dc222[_0x959b('0x43')];if(!_0x52b111[_0x959b('0x46')][_0x959b('0x4b')](_0x959b('0x68'))){_0x208f6a[_0x959b('0x2c')]=qs['limit'](_0x52b111[_0x959b('0x46')][_0x959b('0x2c')]);_0x208f6a[_0x959b('0x2e')]=qs[_0x959b('0x2e')](_0x52b111['query'][_0x959b('0x2e')]);}_0x208f6a['order']=qs['sort'](_0x52b111['query'][_0x959b('0x4d')]);_0x208f6a['where']=qs[_0x959b('0x45')](_[_0x959b('0x4f')](_0x52b111['query'],_0x2dc222[_0x959b('0x45')]));_0x208f6a[_0x959b('0x4e')]['WhatsappAccountId']=_0x244595['id'];if(_0x52b111[_0x959b('0x46')][_0x959b('0x50')]){_0x208f6a[_0x959b('0x4e')]=_['merge'](_0x208f6a['where'],{'$or':_['map'](_0x208f6a[_0x959b('0x47')],function(_0x276e78){var _0x2ac5c0={};_0x2ac5c0[_0x276e78]={'$like':'%'+_0x52b111[_0x959b('0x46')][_0x959b('0x50')]+'%'};return _0x2ac5c0;})});}_0x208f6a=_[_0x959b('0x53')]({},_0x208f6a,_0x52b111['options']);return db['Disposition'][_0x959b('0x2d')]({'where':_0x208f6a[_0x959b('0x4e')]})[_0x959b('0x35')](function(_0x140987){_0x369bc7[_0x959b('0x2d')]=_0x140987;if(_0x52b111[_0x959b('0x46')][_0x959b('0x55')]){_0x208f6a[_0x959b('0x56')]=[{'all':!![]}];}return db[_0x959b('0x69')][_0x959b('0x57')](_0x208f6a);})[_0x959b('0x35')](function(_0x45058f){_0x369bc7[_0x959b('0x58')]=_0x45058f;return _0x369bc7;});}})[_0x959b('0x35')](respondWithFilteredResult(_0x3d29ef,_0x208f6a))['catch'](handleError(_0x3d29ef,null));};exports[_0x959b('0x6a')]=function(_0x1f6e10,_0x2f174d,_0x1d3256){return db['WhatsappAccount']['find']({'where':{'id':_0x1f6e10['params']['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x2f174d,null))[_0x959b('0x35')](function(_0x36d831){if(_0x36d831){return _0x36d831[_0x959b('0x6a')](_0x1f6e10[_0x959b('0x46')]['ids']);}})[_0x959b('0x35')](respondWithStatusCode(_0x2f174d,null))[_0x959b('0x26')](handleError(_0x2f174d,null));};exports[_0x959b('0x6b')]=function(_0x17d5b4,_0x276b30,_0x9695a7){if(_0x17d5b4['body']['id']){delete _0x17d5b4[_0x959b('0x5d')]['id'];}return db['WhatsappAccount'][_0x959b('0x5b')]({'where':{'id':_0x17d5b4[_0x959b('0x5a')]['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x276b30,null))[_0x959b('0x35')](function(_0x3942b7){if(_0x3942b7){_0x17d5b4[_0x959b('0x5d')][_0x959b('0x66')]=_0x3942b7['id'];return db[_0x959b('0x6c')][_0x959b('0x5c')](_0x17d5b4['body']);}})[_0x959b('0x35')](respondWithResult(_0x276b30,null))['catch'](handleError(_0x276b30,null));};exports[_0x959b('0x6d')]=function(_0x39ec89,_0x58cc29,_0x53ed84){var _0x5c2f7a={'raw':![],'where':{}};var _0x203b21={};var _0x2ea547={'count':0x0,'rows':[]};return db[_0x959b('0x3f')][_0x959b('0x67')]({'where':{'id':_0x39ec89['params']['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x58cc29,null))[_0x959b('0x35')](function(_0x3c0516){if(_0x3c0516){_0x203b21[_0x959b('0x43')]=_[_0x959b('0x44')](db[_0x959b('0x6c')]['rawAttributes']);_0x203b21['query']=_['keys'](_0x39ec89[_0x959b('0x46')]);_0x203b21[_0x959b('0x45')]=_[_0x959b('0x48')](_0x203b21[_0x959b('0x43')],_0x203b21[_0x959b('0x46')]);_0x5c2f7a[_0x959b('0x47')]=_[_0x959b('0x48')](_0x203b21[_0x959b('0x43')],qs[_0x959b('0x49')](_0x39ec89[_0x959b('0x46')][_0x959b('0x49')]));_0x5c2f7a[_0x959b('0x47')]=_0x5c2f7a[_0x959b('0x47')][_0x959b('0x4a')]?_0x5c2f7a[_0x959b('0x47')]:_0x203b21['model'];if(!_0x39ec89[_0x959b('0x46')]['hasOwnProperty'](_0x959b('0x68'))){_0x5c2f7a[_0x959b('0x2c')]=qs['limit'](_0x39ec89['query']['limit']);_0x5c2f7a[_0x959b('0x2e')]=qs['offset'](_0x39ec89[_0x959b('0x46')][_0x959b('0x2e')]);}_0x5c2f7a[_0x959b('0x4c')]=qs[_0x959b('0x4d')](_0x39ec89['query'][_0x959b('0x4d')]);_0x5c2f7a[_0x959b('0x4e')]=qs['filters'](_[_0x959b('0x4f')](_0x39ec89[_0x959b('0x46')],_0x203b21[_0x959b('0x45')]));_0x5c2f7a[_0x959b('0x4e')]['WhatsappAccountId']=_0x3c0516['id'];if(_0x39ec89[_0x959b('0x46')][_0x959b('0x50')]){_0x5c2f7a[_0x959b('0x4e')]=_[_0x959b('0x53')](_0x5c2f7a[_0x959b('0x4e')],{'$or':_[_0x959b('0x3e')](_0x5c2f7a[_0x959b('0x47')],function(_0x33c84e){var _0x1b37c2={};_0x1b37c2[_0x33c84e]={'$like':'%'+_0x39ec89[_0x959b('0x46')]['filter']+'%'};return _0x1b37c2;})});}_0x5c2f7a=_[_0x959b('0x53')]({},_0x5c2f7a,_0x39ec89[_0x959b('0x54')]);return db[_0x959b('0x6c')]['count']({'where':_0x5c2f7a[_0x959b('0x4e')]})[_0x959b('0x35')](function(_0x392950){_0x2ea547[_0x959b('0x2d')]=_0x392950;if(_0x39ec89['query'][_0x959b('0x55')]){_0x5c2f7a[_0x959b('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5c2f7a);})[_0x959b('0x35')](function(_0x66b795){_0x2ea547[_0x959b('0x58')]=_0x66b795;return _0x2ea547;});}})[_0x959b('0x35')](respondWithFilteredResult(_0x58cc29,_0x5c2f7a))[_0x959b('0x26')](handleError(_0x58cc29,null));};exports[_0x959b('0x6e')]=function(_0x254eb3,_0x3d0612,_0xd296b4){return db[_0x959b('0x3f')][_0x959b('0x5b')]({'where':{'id':_0x254eb3[_0x959b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3d0612,null))[_0x959b('0x35')](function(_0x4db60a){if(_0x4db60a){return _0x4db60a[_0x959b('0x6e')](_0x254eb3[_0x959b('0x46')][_0x959b('0x6f')]);}})[_0x959b('0x35')](respondWithStatusCode(_0x3d0612,null))[_0x959b('0x26')](handleError(_0x3d0612,null));};exports[_0x959b('0x70')]=function(_0x4ddba9,_0x2bcd64,_0x51ef21){return db[_0x959b('0x3f')][_0x959b('0x5b')]({'where':{'id':_0x4ddba9['params']['id']}})['then'](handleEntityNotFound(_0x2bcd64,null))['then'](function(_0x14c87c){if(_0x14c87c){return _0x14c87c[_0x959b('0x70')](_0x4ddba9[_0x959b('0x5d')][_0x959b('0x6f')],_[_0x959b('0x71')](_0x4ddba9['body'],['ids','id'])||{})[_0x959b('0x72')](function(_0x52eb21){for(var _0x42a427=0x0;_0x42a427<_0x4ddba9[_0x959b('0x5d')][_0x959b('0x6f')]['length'];_0x42a427+=0x1){socket[_0x959b('0x73')](_0x959b('0x74'),{'UserId':Number(_0x4ddba9[_0x959b('0x5d')][_0x959b('0x6f')][_0x42a427]),'WhatsappAccountId':Number(_0x4ddba9[_0x959b('0x5a')]['id'])});}return _0x52eb21;});}})[_0x959b('0x35')](respondWithResult(_0x2bcd64,null))['catch'](handleError(_0x2bcd64,null));};exports[_0x959b('0x75')]=function(_0x2b8cb0,_0x3481d7,_0x465cd3){return db[_0x959b('0x3f')][_0x959b('0x5b')]({'where':{'id':_0x2b8cb0[_0x959b('0x5a')]['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x3481d7,null))[_0x959b('0x35')](function(_0xac0e89){if(_0xac0e89){return _0xac0e89[_0x959b('0x75')](_0x2b8cb0['query'][_0x959b('0x6f')])[_0x959b('0x35')](function(){if(_['isArray'](_0x2b8cb0[_0x959b('0x46')][_0x959b('0x6f')])){for(var _0x3c4e90=0x0;_0x3c4e90<_0x2b8cb0[_0x959b('0x46')]['ids'][_0x959b('0x4a')];_0x3c4e90+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x2b8cb0[_0x959b('0x46')][_0x959b('0x6f')][_0x3c4e90]),'WhatsappAccountId':Number(_0x2b8cb0[_0x959b('0x5a')]['id'])});}}else{socket['emit'](_0x959b('0x76'),{'UserId':Number(_0x2b8cb0[_0x959b('0x46')][_0x959b('0x6f')]),'WhatsappAccountId':Number(_0x2b8cb0[_0x959b('0x5a')]['id'])});}});}})[_0x959b('0x35')](respondWithStatusCode(_0x3481d7,null))[_0x959b('0x26')](handleError(_0x3481d7,null));};exports[_0x959b('0x77')]=function(_0xff4d90,_0x4f8d6f,_0x32370b){var _0x5eaf00={};var _0x80f33e={};var _0x317c21;var _0xd07790;return db[_0x959b('0x3f')][_0x959b('0x67')]({'where':{'id':_0xff4d90['params']['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x4f8d6f,null))[_0x959b('0x35')](function(_0x32dc1e){if(_0x32dc1e){_0x317c21=_0x32dc1e;_0x80f33e[_0x959b('0x43')]=_[_0x959b('0x44')](db[_0x959b('0x78')][_0x959b('0x40')]);_0x80f33e['query']=_[_0x959b('0x44')](_0xff4d90[_0x959b('0x46')]);_0x80f33e[_0x959b('0x45')]=_[_0x959b('0x48')](_0x80f33e[_0x959b('0x43')],_0x80f33e[_0x959b('0x46')]);_0x5eaf00[_0x959b('0x47')]=_[_0x959b('0x48')](_0x80f33e[_0x959b('0x43')],qs['fields'](_0xff4d90[_0x959b('0x46')]['fields']));_0x5eaf00[_0x959b('0x47')]=_0x5eaf00['attributes']['length']?_0x5eaf00['attributes']:_0x80f33e[_0x959b('0x43')];_0x5eaf00[_0x959b('0x4c')]=qs['sort'](_0xff4d90[_0x959b('0x46')][_0x959b('0x4d')]);_0x5eaf00[_0x959b('0x4e')]=qs[_0x959b('0x45')](_[_0x959b('0x4f')](_0xff4d90[_0x959b('0x46')],_0x80f33e[_0x959b('0x45')]));if(_0xff4d90[_0x959b('0x46')][_0x959b('0x50')]){_0x5eaf00['where']=_[_0x959b('0x53')](_0x5eaf00[_0x959b('0x4e')],{'$or':_['map'](_0x5eaf00['attributes'],function(_0x43b8ca){var _0x184b0f={};_0x184b0f[_0x43b8ca]={'$like':'%'+_0xff4d90[_0x959b('0x46')]['filter']+'%'};return _0x184b0f;})});}_0x5eaf00=_[_0x959b('0x53')]({},_0x5eaf00,_0xff4d90[_0x959b('0x54')]);return _0x317c21['getAgents'](_0x5eaf00);}})[_0x959b('0x35')](function(_0x4b47f7){if(_0x4b47f7){_0xd07790=_0x4b47f7['length'];if(!_0xff4d90[_0x959b('0x46')]['hasOwnProperty']('nolimit')){_0x5eaf00[_0x959b('0x2c')]=qs['limit'](_0xff4d90[_0x959b('0x46')][_0x959b('0x2c')]);_0x5eaf00['offset']=qs[_0x959b('0x2e')](_0xff4d90[_0x959b('0x46')][_0x959b('0x2e')]);}return _0x317c21['getAgents'](_0x5eaf00);}})['then'](function(_0x5583f0){if(_0x5583f0){return _0x5583f0?{'count':_0xd07790,'rows':_0x5583f0}:null;}})[_0x959b('0x35')](respondWithResult(_0x4f8d6f,null))['catch'](handleError(_0x4f8d6f,null));};exports['addApplications']=function(_0x9daa31,_0x47da04){var _0x5cc5a7=_0x9daa31[_0x959b('0x5a')]['id'];var _0x35804a=_0x9daa31['body'];var _0x1fa449=0xc8;var _0x1fb34d=null;return db[_0x959b('0x79')]['transaction']({'isolationLevel':db[_0x959b('0x79')][_0x959b('0x7a')][_0x959b('0x7b')][_0x959b('0x7c')]},function(_0x261093){return db[_0x959b('0x3f')]['findOne']({'where':{'id':_0x5cc5a7},'transaction':_0x261093})[_0x959b('0x35')](function(_0x4ed1a8){if(_0x4ed1a8){return db[_0x959b('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x5cc5a7},'transaction':_0x261093})[_0x959b('0x35')](function(){var _0x316580=_[_0x959b('0x3e')](_0x35804a,function(_0x369a58){_0x369a58['WhatsappAccountId']=_0x5cc5a7;return _0x369a58;});return db[_0x959b('0x7d')]['bulkCreate'](_0x316580,{'transaction':_0x261093});});}else{_0x1fa449=0x194;_0x1fb34d=[];}});})['then'](function(){if(_0x1fa449!==0x194){return db['WhatsappApplication'][_0x959b('0x7e')]({'where':{'WhatsappAccountId':_0x5cc5a7},'order':_0x959b('0x7f')})['then'](function(_0xcea8b5){_0x1fb34d=_0xcea8b5;});}})[_0x959b('0x26')](function(_0x330b6e){_0x1fa449=0x1f4;logger['error'](_0x330b6e['stack']);if(_0x330b6e[_0x959b('0x3a')]){delete _0x330b6e[_0x959b('0x3a')];}_0x1fb34d=_0x330b6e;})[_0x959b('0x80')](function(){if(_0x1fb34d===null){_0x47da04[_0x959b('0x27')](_0x1fa449);}else{if(_0x1fa449===0x1f4){_0x47da04[_0x959b('0x29')](_0x1fa449)[_0x959b('0x3b')](_0x1fb34d);}else{_0x47da04[_0x959b('0x29')](_0x1fa449)['json'](_0x1fb34d);}}});};exports[_0x959b('0x81')]=function(_0x457931,_0x425cc4,_0x33c34b){var _0x349f8f={};var _0x267566={};var _0x7fa470;var _0x40e5c0;return db[_0x959b('0x3f')][_0x959b('0x67')]({'where':{'id':_0x457931[_0x959b('0x5a')]['id']}})[_0x959b('0x35')](handleEntityNotFound(_0x425cc4,null))[_0x959b('0x35')](function(_0x5c19a5){if(_0x5c19a5){_0x7fa470=_0x5c19a5;_0x267566['model']=_[_0x959b('0x44')](db['WhatsappApplication'][_0x959b('0x40')]);_0x267566[_0x959b('0x46')]=_['keys'](_0x457931[_0x959b('0x46')]);_0x267566[_0x959b('0x45')]=_['intersection'](_0x267566[_0x959b('0x43')],_0x267566[_0x959b('0x46')]);_0x349f8f['attributes']=_[_0x959b('0x48')](_0x267566[_0x959b('0x43')],qs['fields'](_0x457931[_0x959b('0x46')][_0x959b('0x49')]));_0x349f8f[_0x959b('0x47')]=_0x349f8f[_0x959b('0x47')][_0x959b('0x4a')]?_0x349f8f[_0x959b('0x47')]:_0x267566[_0x959b('0x43')];_0x349f8f['order']=qs[_0x959b('0x4d')](_0x457931['query'][_0x959b('0x4d')]);_0x349f8f[_0x959b('0x4e')]=qs[_0x959b('0x45')](_[_0x959b('0x4f')](_0x457931[_0x959b('0x46')],_0x267566[_0x959b('0x45')]));if(_0x457931[_0x959b('0x46')][_0x959b('0x50')]){_0x349f8f[_0x959b('0x4e')]=_[_0x959b('0x53')](_0x349f8f[_0x959b('0x4e')],{'$or':_[_0x959b('0x3e')](_0x349f8f[_0x959b('0x47')],function(_0x1a92c6){var _0x1529ff={};_0x1529ff[_0x1a92c6]={'$like':'%'+_0x457931['query']['filter']+'%'};return _0x1529ff;})});}_0x349f8f=_[_0x959b('0x53')]({},_0x349f8f,_0x457931[_0x959b('0x54')]);return _0x7fa470[_0x959b('0x81')](_0x349f8f);}})[_0x959b('0x35')](function(_0x3df99e){if(_0x3df99e){_0x40e5c0=_0x3df99e[_0x959b('0x4a')];if(!_0x457931[_0x959b('0x46')]['hasOwnProperty'](_0x959b('0x68'))){_0x349f8f[_0x959b('0x2c')]=qs[_0x959b('0x2c')](_0x457931[_0x959b('0x46')]['limit']);_0x349f8f[_0x959b('0x2e')]=qs[_0x959b('0x2e')](_0x457931[_0x959b('0x46')]['offset']);}return _0x7fa470[_0x959b('0x81')](_0x349f8f);}})[_0x959b('0x35')](function(_0x226789){if(_0x226789){return _0x226789?{'count':_0x40e5c0,'rows':_0x226789}:null;}})[_0x959b('0x35')](respondWithResult(_0x425cc4,null))[_0x959b('0x26')](handleError(_0x425cc4,null));};exports[_0x959b('0x82')]=function(_0x5926d9,_0x5c4ab6,_0x1c7d01){var _0x52647b={'channel':_0x959b('0x83')};var _0x347f1c=[];var _0x4e257c=[];var _0x1299bd={};return db['WhatsappAccount'][_0x959b('0x5b')]({'where':{'id':_0x5926d9[_0x959b('0x5a')]['id']},'include':[{'model':db[_0x959b('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x5c4ab6,null))[_0x959b('0x35')](function(_0x5581e8){_0x52647b[_0x959b('0x84')]=_0x5581e8;if(_0x52647b[_0x959b('0x84')]&&_0x52647b[_0x959b('0x84')][_0x959b('0x51')]===_0x959b('0x85')&&_0x5926d9['body'][_0x959b('0x86')]){if(_0x5926d9['body']['statuses'][_0x959b('0x4a')]===0x0)return;if(_0x5926d9['body'][_0x959b('0x86')][0x0]['state']!==_0x959b('0x87'))return;return db[_0x959b('0x88')][_0x959b('0x33')]({'read':!![],'readAt':_0x5926d9[_0x959b('0x5d')][_0x959b('0x86')][0x0][_0x959b('0x89')]},{'where':{'messageId':_0x5926d9[_0x959b('0x5d')][_0x959b('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x959b('0x35')](function(_0x1cc041){return _0x5c4ab6[_0x959b('0x29')](0xc8)[_0x959b('0x2a')](_0x1cc041);});}_0x52647b[_0x959b('0x8a')]=_[_0x959b('0x8b')](_0x5581e8[_0x959b('0x8c')],['priority'],['asc']);if(_0x52647b[_0x959b('0x84')]['Applications']){delete _0x52647b[_0x959b('0x84')]['Applications'];}return db[_0x959b('0x8d')]['describe']()[_0x959b('0x35')](function(_0x33f93e){if(!_0x33f93e){throw new db[(_0x959b('0x8e'))]['ValidationError'](_0x959b('0x8f'));}_0x347f1c=_[_0x959b('0x90')](_[_0x959b('0x44')](_0x33f93e),['createdAt',_0x959b('0x91')]);_0x4e257c=_[_0x959b('0x90')](_[_0x959b('0x44')](_0x33f93e),[_0x959b('0x92'),_0x959b('0x91'),'CompanyId',_0x959b('0x93')]);_0x52647b[_0x959b('0x5d')]={'mapKey':_0x959b('0x94')};if(_0x52647b[_0x959b('0x84')]&&_0x52647b[_0x959b('0x84')][_0x959b('0x51')]===_0x959b('0x95')){_0x52647b['body'][_0x959b('0x96')]=_0x5926d9[_0x959b('0x5d')][_0x959b('0x97')][_0x959b('0x98')]('whatsapp:','');_0x52647b['body'][_0x959b('0x5d')]=_0x5926d9[_0x959b('0x5d')][_0x959b('0x99')];_0x52647b[_0x959b('0x5d')]['messageId']=_0x5926d9[_0x959b('0x5d')][_0x959b('0x9a')];}if(_0x52647b[_0x959b('0x84')]&&_0x52647b[_0x959b('0x84')][_0x959b('0x51')]===_0x959b('0x85')){_0x52647b[_0x959b('0x5d')][_0x959b('0x96')]=_0x5926d9[_0x959b('0x5d')][_0x959b('0x9b')][0x0][_0x959b('0x96')];_0x52647b[_0x959b('0x5d')][_0x959b('0x5d')]=_0x5926d9[_0x959b('0x5d')]['notifications'][0x0][_0x959b('0x24')][_0x959b('0x5d')];_0x52647b['body']['messageId']=_0x5926d9[_0x959b('0x5d')][_0x959b('0x9b')][0x0][_0x959b('0x9c')];}if(_0x52647b[_0x959b('0x5d')]['id']){delete _0x52647b[_0x959b('0x5d')]['id'];}if(_[_0x959b('0x9d')](_0x52647b['body']['from'])){throw new db[(_0x959b('0x8e'))][(_0x959b('0x9e'))](_0x959b('0x9f'));}if(_['isNil'](_0x52647b[_0x959b('0x5d')][_0x959b('0x5d')])||_0x52647b['body']['body']===''){throw new db[(_0x959b('0x8e'))]['ValidationError'](_0x959b('0xa0'));}if(_[_0x959b('0x9d')](_0x52647b[_0x959b('0x5d')][_0x959b('0xa1')])){throw new db[(_0x959b('0x8e'))][(_0x959b('0x9e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e257c);}if(!_[_0x959b('0xa2')](_0x4e257c,_0x52647b[_0x959b('0x5d')][_0x959b('0xa1')])){throw new db[(_0x959b('0x8e'))][(_0x959b('0x9e'))](_0x959b('0xa3')+_0x4e257c);}_0x1299bd[_0x52647b[_0x959b('0x5d')]['mapKey']]=_0x52647b[_0x959b('0x5d')][_0x959b('0x96')];return db[_0x959b('0xa4')][_0x959b('0x5b')]({'where':{'id':_0x52647b['account'][_0x959b('0x93')]},'include':[{'model':db[_0x959b('0x8d')],'as':_0x959b('0xa5'),'where':_0x1299bd,'limit':0x1,'order':[[_0x959b('0x91'),'DESC']]}]});})['then'](handleEntityNotFound(_0x5c4ab6,null))['then'](function(_0x52e5af){if(_0x52e5af){_0x52647b[_0x959b('0xa6')]=_[_0x959b('0x71')](_0x52e5af,[_0x959b('0xa5')]);if(_0x52e5af['Contacts'][_0x959b('0x4a')]){return _0x52e5af['Contacts'][0x0];}var _0x54c9aa=_[_0x959b('0x17')](_0x52647b[_0x959b('0x5d')],{'firstName':_0x52647b['body'][_0x959b('0x96')],'ListId':_0x52e5af['id']});_0x54c9aa[_0x52647b[_0x959b('0x5d')][_0x959b('0xa1')]]=_0x52647b[_0x959b('0x5d')][_0x959b('0x96')];return db[_0x959b('0x8d')][_0x959b('0x5c')](_0x54c9aa,{'fields':_0x347f1c,'raw':!![]});}})[_0x959b('0x35')](handleEntityNotFound(_0x5c4ab6,null))[_0x959b('0x35')](function(_0xf4e5f2){if(_0xf4e5f2){_0x52647b[_0x959b('0xa7')]=_0xf4e5f2;var _0x13cbc0={'ContactId':_0xf4e5f2['id'],'phone':_0x52647b['body'][_0x959b('0x96')],'WhatsappAccountId':_0x5926d9[_0x959b('0x5a')]['id']};var _0x40967f={'ContactId':_0xf4e5f2['id'],'WhatsappAccountId':_0x5926d9[_0x959b('0x5a')]['id'],'closed':![]};return db[_0x959b('0xa8')][_0x959b('0x5b')]({'where':_0x40967f})[_0x959b('0x35')](function(_0xc93687){if(_0xc93687){return[_0xc93687,![]];}return db['WhatsappInteraction']['create'](_0x13cbc0)[_0x959b('0x35')](function(_0x49e2be){return[_0x49e2be,!![]];});});}})[_0x959b('0x72')](function(_0x5ad019,_0x4a5e57){_0x52647b[_0x959b('0xa9')]=_0x5ad019[_0x959b('0x36')]({'plain':!![]});_0x52647b[_0x959b('0xa9')][_0x959b('0xaa')]=![];if(_0x4a5e57){if(_0x52647b[_0x959b('0x84')][_0x959b('0xab')]){_0x52647b[_0x959b('0x8a')][_0x959b('0xac')]({'id':0x0,'priority':_0x52647b[_0x959b('0x8a')][_0x959b('0x4a')]+0x1,'app':_0x959b('0xad'),'appdata':_0x959b('0xae'),'interval':'*,*,*,*'});}_0x52647b[_0x959b('0xa9')]['created']=!![];}return db[_0x959b('0x88')][_0x959b('0x5c')]({'phone':_0x52647b[_0x959b('0x5d')][_0x959b('0x96')],'messageId':_0x52647b['body']['messageId'],'body':_0x52647b['body'][_0x959b('0x5d')],'WhatsappAccountId':_0x5926d9[_0x959b('0x5a')]['id'],'WhatsappInteractionId':_0x5ad019['id'],'direction':'in','ContactId':_0x5ad019['ContactId'],'AttachmentId':_0x52647b[_0x959b('0x5d')][_0x959b('0xaf')]});})[_0x959b('0x35')](function(_0x3286d2){_0x52647b[_0x959b('0x24')]=_0x3286d2;if(!_0x52647b[_0x959b('0xa9')][_0x959b('0xb0')])return;return db[_0x959b('0x78')][_0x959b('0x5b')]({'attributes':['id',_0x959b('0x3a')],'where':{'id':_0x52647b[_0x959b('0xa9')]['UserId']}});})[_0x959b('0x35')](function(_0x102531){if(_0x102531){_0x52647b['applications'][_0x959b('0xb1')]({'id':0x0,'priority':0x0,'app':_0x959b('0xb2'),'appdata':_0x102531['name']+','+(_0x52647b['account'][_0x959b('0xb3')]||0xa),'interval':_0x959b('0xb4')});}if(!_0x52647b['interaction'][_0x959b('0xb5')])return;return db[_0x959b('0xb6')][_0x959b('0x5b')]({'attributes':['id','name'],'where':{'id':_0x52647b[_0x959b('0xa9')][_0x959b('0xb5')]}});})[_0x959b('0x35')](function(_0x1843a0){if(_0x1843a0){_0x52647b[_0x959b('0x8a')][_0x959b('0xb1')]({'id':0x0,'priority':0x1,'app':_0x959b('0xb7'),'appdata':_0x1843a0[_0x959b('0x3a')]+','+(_0x52647b['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x959b('0xb4')});}return respondWithRpcPromise(_0x959b('0xb8'),_0x959b('0xb9'),_0x52647b);})['then'](function(_0x165c54){if(_0x165c54){var _0x14116f=0xc8;var _0x2b36b0=_0x959b('0xba');logger[_0x959b('0x1e')](_0x959b('0x20'),_0x2b36b0,_0x14116f,_0x959b('0xbb'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2b36b0,_0x14116f,_0x959b('0xbb'),JSON['stringify'](_0x165c54));if(_0x52647b[_0x959b('0x84')][_0x959b('0x51')]===_0x959b('0x95')){return _0x5c4ab6['status'](_0x14116f)['set'](_0x959b('0xbc'),'text/xml')['send'](_0x959b('0xbd'));}else{return _0x5c4ab6['status'](_0x14116f)[_0x959b('0x2a')](_0x165c54);}}});})[_0x959b('0x26')](handleError(_0x5c4ab6,null));};exports[_0x959b('0x3b')]=function(_0x2defd7,_0x30f7be,_0x1c64a5){var _0x5e9814,_0x183b74,_0x48548e;if(_[_0x959b('0x9d')](_0x2defd7[_0x959b('0x5d')][_0x959b('0x5d')])||_0x2defd7[_0x959b('0x5d')][_0x959b('0x5d')]===''){throw new db[(_0x959b('0x8e'))]['ValidationError'](_0x959b('0xa0'));}if(_[_0x959b('0x9d')](_0x2defd7[_0x959b('0x5d')]['to'])){throw new db['Sequelize'][(_0x959b('0x9e'))]('to\x20is\x20mandatory');}_0x5e9814=_0x2defd7[_0x959b('0x5d')]['to'];return db['WhatsappAccount'][_0x959b('0x5b')]({'where':{'id':_0x2defd7[_0x959b('0x5a')]['id']},'include':[{'model':db[_0x959b('0xa4')],'as':_0x959b('0xbe'),'include':[{'model':db[_0x959b('0x8d')],'as':'Contacts','where':{'mobile':_0x5e9814},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x30f7be,null))[_0x959b('0x35')](function(_0x231c9c){if(_0x231c9c&&_0x231c9c[_0x959b('0xbe')]){_0x183b74=_0x231c9c['get']({'plain':!![]});if(_0x183b74[_0x959b('0xbe')]&&_0x183b74[_0x959b('0xbe')][_0x959b('0xa5')][_0x959b('0x4a')]){return _0x183b74[_0x959b('0xbe')][_0x959b('0xa5')][0x0];}return db[_0x959b('0x8d')][_0x959b('0x5c')](_[_0x959b('0x17')](_0x2defd7[_0x959b('0x5d')],{'firstName':_0x5e9814,'mobile':_0x5e9814,'phone':_0x5e9814,'ListId':_0x183b74[_0x959b('0x93')]}));}})['then'](handleEntityNotFound(_0x30f7be,null))[_0x959b('0x35')](function(_0x5e4a0f){if(_0x5e4a0f){_0x48548e=_0x5e4a0f;return db[_0x959b('0xa8')][_0x959b('0x5b')]({'where':{'ContactId':_0x48548e['id'],'closed':![],'WhatsappAccountId':_0x183b74['id']}})[_0x959b('0x35')](function(_0x27a799){if(_0x27a799){return[_0x27a799,![]];}return db['WhatsappInteraction'][_0x959b('0x5c')]({'UserId':_0x2defd7[_0x959b('0x5e')]['id'],'ContactId':_0x48548e['id'],'WhatsappAccountId':_0x183b74['id'],'phone':_0x5e9814,'firstMsgDirection':_0x959b('0xbf'),'Messages':[_['merge'](_0x2defd7['body'],{'read':![],'body':_0x2defd7[_0x959b('0x5d')][_0x959b('0x5d')],'phone':_0x5e9814,'WhatsappAccountId':_0x183b74['id'],'UserId':_0x2defd7[_0x959b('0x5e')]['id'],'ContactId':_0x48548e['id']})]},{'include':[{'model':db[_0x959b('0x88')],'as':_0x959b('0xc0')}]})[_0x959b('0x35')](function(_0x1dfe80){return[_0x1dfe80,!![]];});});}})[_0x959b('0x72')](function(_0x349e55,_0x25ec5d){if(_0x25ec5d){return _0x349e55;}return db['WhatsappMessage']['create'](_['merge'](_0x2defd7['body'],{'read':![],'body':_0x2defd7[_0x959b('0x5d')][_0x959b('0x5d')],'phone':_0x5e9814,'WhatsappAccountId':_0x183b74['id'],'WhatsappInteractionId':_0x349e55['id'],'UserId':_0x2defd7[_0x959b('0x5e')]['id'],'ContactId':_0x48548e['id']}))[_0x959b('0x35')](function(_0x23a017){_0x349e55[_0x959b('0xc1')]['Messages']=[];_0x349e55['dataValues']['Messages'][_0x959b('0xac')](_0x23a017[_0x959b('0xc1')]);return _0x349e55;});})[_0x959b('0x35')](respondWithResult(_0x30f7be,null))[_0x959b('0x26')](handleError(_0x30f7be,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3c2f072..a0888b6 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 _0xb5df=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x44e6b3,_0x47fc06){var _0x320086=function(_0x3f0eeb){while(--_0x3f0eeb){_0x44e6b3['push'](_0x44e6b3['shift']());}};_0x320086(++_0x47fc06);}(_0xb5df,0x97));var _0xfb5d=function(_0x4644ac,_0x4cfc5d){_0x4644ac=_0x4644ac-0x0;var _0x2dc79c=_0xb5df[_0x4644ac];return _0x2dc79c;};'use strict';var EventEmitter=require(_0xfb5d('0x0'));var WhatsappAccount=require(_0xfb5d('0x1'))['db'][_0xfb5d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfb5d('0x3')](0x0);var events={'afterCreate':_0xfb5d('0x4'),'afterUpdate':_0xfb5d('0x5'),'afterDestroy':_0xfb5d('0x6')};function emitEvent(_0x5be09d){return function(_0x8748f5,_0x1ddc33,_0x280e49){WhatsappAccountEvents[_0xfb5d('0x7')](_0x5be09d+':'+_0x8748f5['id'],_0x8748f5);WhatsappAccountEvents[_0xfb5d('0x7')](_0x5be09d,_0x8748f5);_0x280e49(null);};}for(var e in events){if(events[_0xfb5d('0x8')](e)){var event=events[e];WhatsappAccount[_0xfb5d('0x9')](e,emitEvent(event));}}module[_0xfb5d('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2282=['events','../../mysqldb','WhatsappAccount','save','update','remove','emit','exports'];(function(_0x31080a,_0x55b5cd){var _0x58d2fc=function(_0x446558){while(--_0x446558){_0x31080a['push'](_0x31080a['shift']());}};_0x58d2fc(++_0x55b5cd);}(_0x2282,0x180));var _0x2228=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x2282[_0x3b3cc6];return _0x1161e4;};'use strict';var EventEmitter=require(_0x2228('0x0'));var WhatsappAccount=require(_0x2228('0x1'))['db'][_0x2228('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2228('0x3'),'afterUpdate':_0x2228('0x4'),'afterDestroy':_0x2228('0x5')};function emitEvent(_0x3f7572){return function(_0xc80be5,_0x5cac2a,_0x131a39){WhatsappAccountEvents[_0x2228('0x6')](_0x3f7572+':'+_0xc80be5['id'],_0xc80be5);WhatsappAccountEvents[_0x2228('0x6')](_0x3f7572,_0xc80be5);_0x131a39(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2228('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0a6488e..4d522ec 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 _0x10ff=['api','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x22e5a2,_0x24d072){var _0x500b45=function(_0x4e8be8){while(--_0x4e8be8){_0x22e5a2['push'](_0x22e5a2['shift']());}};_0x500b45(++_0x24d072);}(_0x10ff,0xce));var _0xf10f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10ff[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf10f('0x0'));var util=require(_0xf10f('0x1'));var logger=require(_0xf10f('0x2'))(_0xf10f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf10f('0x4'));var fs=require('fs');var path=require(_0xf10f('0x5'));var rimraf=require('rimraf');var config=require(_0xf10f('0x6'));var attributes=require(_0xf10f('0x7'));module[_0xf10f('0x8')]=function(_0xd7c777,_0x193e76){return _0xd7c777[_0xf10f('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf10f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24a6=['api','moment','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','util','../../config/logger'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x24a6,0xb9));var _0x624a=function(_0x37f654,_0x1c9dcb){_0x37f654=_0x37f654-0x0;var _0x1bf78f=_0x24a6[_0x37f654];return _0x1bf78f;};'use strict';var _=require('lodash');var util=require(_0x624a('0x0'));var logger=require(_0x624a('0x1'))(_0x624a('0x2'));var moment=require(_0x624a('0x3'));var BPromise=require(_0x624a('0x4'));var rp=require(_0x624a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x624a('0x6'));var attributes=require(_0x624a('0x7'));module[_0x624a('0x8')]=function(_0x8fcc3c,_0x3193c8){return _0x8fcc3c[_0x624a('0x9')](_0x624a('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index fe97605..8197d08 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 _0xb652=['stringify','error','message','result','ShowWhatsappAccount','find','raw','options','where','include','map','model','attributes','catch','util','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0xb652,0x1ce));var _0x2b65=function(_0x588a1d,_0x505aeb){_0x588a1d=_0x588a1d-0x0;var _0x4d59af=_0xb652[_0x588a1d];return _0x4d59af;};'use strict';var _=require('lodash');var util=require(_0x2b65('0x0'));var moment=require('moment');var BPromise=require(_0x2b65('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(_0x2b65('0x2'))('rpc');var config=require(_0x2b65('0x3'));var jayson=require(_0x2b65('0x4'));var client=jayson[_0x2b65('0x5')][_0x2b65('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2b65('0x7')],{'host':_0x2b65('0x8'),'port':0x18eb});var socket=require(_0x2b65('0x9'))(new Redis(config['redis']));require(_0x2b65('0xa'))['register'](socket);function respondWithRpcPromise(_0x3e18c8,_0x4f4815,_0x18c0cc){return new BPromise(function(_0x217cb3,_0x1033bf){return client[_0x2b65('0xb')](_0x3e18c8,_0x18c0cc)[_0x2b65('0xc')](function(_0x4d7b87){logger[_0x2b65('0xd')](_0x2b65('0xe'),_0x4f4815,_0x2b65('0xf'));logger[_0x2b65('0x10')](_0x2b65('0x11'),_0x4f4815,'request\x20sent',JSON[_0x2b65('0x12')](_0x4d7b87));if(_0x4d7b87['error']){if(_0x4d7b87[_0x2b65('0x13')]['code']===0x1f4){logger['error'](_0x2b65('0xe'),_0x4f4815,_0x4d7b87['error'][_0x2b65('0x14')]);return _0x1033bf(_0x4d7b87[_0x2b65('0x13')]['message']);}logger[_0x2b65('0x13')](_0x2b65('0xe'),_0x4f4815,_0x4d7b87[_0x2b65('0x13')][_0x2b65('0x14')]);return _0x217cb3(_0x4d7b87[_0x2b65('0x13')][_0x2b65('0x14')]);}else{logger[_0x2b65('0xd')](_0x2b65('0xe'),_0x4f4815,_0x2b65('0xf'));_0x217cb3(_0x4d7b87[_0x2b65('0x15')][_0x2b65('0x14')]);}})['catch'](function(_0x38d99c){logger[_0x2b65('0x13')](_0x2b65('0xe'),_0x4f4815,_0x38d99c);_0x1033bf(_0x38d99c);});});}exports[_0x2b65('0x16')]=function(_0x331bdb){var _0x44aff7=this;return new Promise(function(_0x55908c,_0x57e3ed){return db['WhatsappAccount'][_0x2b65('0x17')]({'raw':_0x331bdb['options']?_0x331bdb['options'][_0x2b65('0x18')]===undefined?!![]:![]:!![],'where':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')][_0x2b65('0x1a')]||null:null,'attributes':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')]['attributes']||null:null,'include':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')][_0x2b65('0x1b')]?_[_0x2b65('0x1c')](_0x331bdb[_0x2b65('0x19')]['include'],function(_0x32eeb9){return{'model':db[_0x32eeb9[_0x2b65('0x1d')]],'as':_0x32eeb9['as'],'attributes':_0x32eeb9[_0x2b65('0x1e')],'include':_0x32eeb9['include']?_['map'](_0x32eeb9[_0x2b65('0x1b')],function(_0x38991e){return{'model':db[_0x38991e['model']],'as':_0x38991e['as'],'attributes':_0x38991e[_0x2b65('0x1e')],'include':_0x38991e['include']?_[_0x2b65('0x1c')](_0x38991e[_0x2b65('0x1b')],function(_0x1f7b20){return{'model':db[_0x1f7b20[_0x2b65('0x1d')]],'as':_0x1f7b20['as'],'attributes':_0x1f7b20[_0x2b65('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2b65('0xc')](function(_0x47d4e5){logger[_0x2b65('0xd')](_0x2b65('0x16'),_0x331bdb);logger[_0x2b65('0x10')](_0x2b65('0x16'),_0x331bdb,JSON[_0x2b65('0x12')](_0x47d4e5));_0x55908c(_0x47d4e5);})[_0x2b65('0x1f')](function(_0x1011d0){logger[_0x2b65('0x13')](_0x2b65('0x16'),_0x1011d0[_0x2b65('0x14')],_0x331bdb);_0x57e3ed(_0x44aff7[_0x2b65('0x13')](0x1f4,_0x1011d0['message']));});});}; \ No newline at end of file +var _0x340f=['WhatsappAccount','find','options','raw','where','include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./whatsappAccount.socket','register','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','ShowWhatsappAccount'];(function(_0x5b6f5c,_0x22d5f0){var _0x24a08f=function(_0x23cca4){while(--_0x23cca4){_0x5b6f5c['push'](_0x5b6f5c['shift']());}};_0x24a08f(++_0x22d5f0);}(_0x340f,0x157));var _0xf340=function(_0x583ed2,_0x130f0b){_0x583ed2=_0x583ed2-0x0;var _0x20a31d=_0x340f[_0x583ed2];return _0x20a31d;};'use strict';var _=require(_0xf340('0x0'));var util=require(_0xf340('0x1'));var moment=require(_0xf340('0x2'));var BPromise=require(_0xf340('0x3'));var rs=require(_0xf340('0x4'));var fs=require('fs');var Redis=require(_0xf340('0x5'));var db=require(_0xf340('0x6'))['db'];var utils=require(_0xf340('0x7'));var logger=require(_0xf340('0x8'))('rpc');var config=require(_0xf340('0x9'));var jayson=require(_0xf340('0xa'));var client=jayson['client'][_0xf340('0xb')]({'port':0x232a});config[_0xf340('0xc')]=_['defaults'](config[_0xf340('0xc')],{'host':_0xf340('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf340('0xc')]));require(_0xf340('0xe'))[_0xf340('0xf')](socket);function respondWithRpcPromise(_0x5351d0,_0x292e89,_0x35b057){return new BPromise(function(_0x3cceb7,_0x22e297){return client[_0xf340('0x10')](_0x5351d0,_0x35b057)[_0xf340('0x11')](function(_0x5e848b){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x292e89,_0xf340('0x12'));logger['debug'](_0xf340('0x13'),_0x292e89,_0xf340('0x12'),JSON[_0xf340('0x14')](_0x5e848b));if(_0x5e848b['error']){if(_0x5e848b['error'][_0xf340('0x15')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x292e89,_0x5e848b[_0xf340('0x16')][_0xf340('0x17')]);return _0x22e297(_0x5e848b[_0xf340('0x16')]['message']);}logger[_0xf340('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x292e89,_0x5e848b['error'][_0xf340('0x17')]);return _0x3cceb7(_0x5e848b['error'][_0xf340('0x17')]);}else{logger[_0xf340('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x292e89,_0xf340('0x12'));_0x3cceb7(_0x5e848b['result'][_0xf340('0x17')]);}})[_0xf340('0x19')](function(_0x28bb33){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x292e89,_0x28bb33);_0x22e297(_0x28bb33);});});}exports[_0xf340('0x1a')]=function(_0xe9f7c3){var _0x23addd=this;return new Promise(function(_0x312434,_0x4d62ef){return db[_0xf340('0x1b')][_0xf340('0x1c')]({'raw':_0xe9f7c3[_0xf340('0x1d')]?_0xe9f7c3['options'][_0xf340('0x1e')]===undefined?!![]:![]:!![],'where':_0xe9f7c3['options']?_0xe9f7c3[_0xf340('0x1d')][_0xf340('0x1f')]||null:null,'attributes':_0xe9f7c3[_0xf340('0x1d')]?_0xe9f7c3[_0xf340('0x1d')]['attributes']||null:null,'include':_0xe9f7c3[_0xf340('0x1d')]?_0xe9f7c3[_0xf340('0x1d')][_0xf340('0x20')]?_[_0xf340('0x21')](_0xe9f7c3[_0xf340('0x1d')]['include'],function(_0x5c8973){return{'model':db[_0x5c8973[_0xf340('0x22')]],'as':_0x5c8973['as'],'attributes':_0x5c8973[_0xf340('0x23')],'include':_0x5c8973[_0xf340('0x20')]?_[_0xf340('0x21')](_0x5c8973['include'],function(_0x208707){return{'model':db[_0x208707[_0xf340('0x22')]],'as':_0x208707['as'],'attributes':_0x208707['attributes'],'include':_0x208707[_0xf340('0x20')]?_[_0xf340('0x21')](_0x208707['include'],function(_0x5cdc3c){return{'model':db[_0x5cdc3c[_0xf340('0x22')]],'as':_0x5cdc3c['as'],'attributes':_0x5cdc3c[_0xf340('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf340('0x11')](function(_0x5d94f7){logger[_0xf340('0x18')]('ShowWhatsappAccount',_0xe9f7c3);logger[_0xf340('0x24')]('ShowWhatsappAccount',_0xe9f7c3,JSON[_0xf340('0x14')](_0x5d94f7));_0x312434(_0x5d94f7);})[_0xf340('0x19')](function(_0x4b4c6c){logger['error'](_0xf340('0x1a'),_0x4b4c6c['message'],_0xe9f7c3);_0x4d62ef(_0x23addd[_0xf340('0x16')](0x1f4,_0x4b4c6c[_0xf340('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 457a439..d9d81d0 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 _0x9304=['emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9304,0x100));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0x4930('0x0'));var events=[_0x4930('0x1'),_0x4930('0x2'),'update'];function createListener(_0xe4d173,_0xbbdd0b){return function(_0x472662){_0xbbdd0b[_0x4930('0x3')](_0xe4d173,_0x472662);};}function removeListener(_0x40e28f,_0x1e61aa){return function(){WhatsappAccountEvents[_0x4930('0x4')](_0x40e28f,_0x1e61aa);};}exports[_0x4930('0x5')]=function(_0x38378f){for(var _0x5c463e=0x0,_0xfa8abf=events['length'];_0x5c463e<_0xfa8abf;_0x5c463e++){var _0xbd794c=events[_0x5c463e];var _0x3e1cb4=createListener(_0x4930('0x6')+_0xbd794c,_0x38378f);WhatsappAccountEvents['on'](_0xbd794c,_0x3e1cb4);}}; \ No newline at end of file +var _0xcd9b=['./whatsappAccount.events','save','update','emit','register','whatsappAccount:'];(function(_0x1cfc39,_0x15adef){var _0x1ae59b=function(_0x153274){while(--_0x153274){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x1ae59b(++_0x15adef);}(_0xcd9b,0x96));var _0xbcd9=function(_0x35bbb6,_0x2a78c0){_0x35bbb6=_0x35bbb6-0x0;var _0x206d00=_0xcd9b[_0x35bbb6];return _0x206d00;};'use strict';var WhatsappAccountEvents=require(_0xbcd9('0x0'));var events=[_0xbcd9('0x1'),'remove',_0xbcd9('0x2')];function createListener(_0x2ed85e,_0x366284){return function(_0x55f7f3){_0x366284[_0xbcd9('0x3')](_0x2ed85e,_0x55f7f3);};}function removeListener(_0x274580,_0x3f87f2){return function(){WhatsappAccountEvents['removeListener'](_0x274580,_0x3f87f2);};}exports[_0xbcd9('0x4')]=function(_0x22ef51){for(var _0x57ee62=0x0,_0x1425cb=events['length'];_0x57ee62<_0x1425cb;_0x57ee62++){var _0x281351=events[_0x57ee62];var _0x4408b4=createListener(_0xbcd9('0x5')+_0x281351,_0x22ef51);WhatsappAccountEvents['on'](_0x281351,_0x4408b4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 72dfd7d..58c2220 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 _0x9e20=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','multer','util','path','connect-timeout'];(function(_0x12e682,_0x33f3a3){var _0x26e600=function(_0x4d79dc){while(--_0x4d79dc){_0x12e682['push'](_0x12e682['shift']());}};_0x26e600(++_0x33f3a3);}(_0x9e20,0xb0));var _0x09e2=function(_0x226936,_0x367ec4){_0x226936=_0x226936-0x0;var _0x338e92=_0x9e20[_0x226936];return _0x338e92;};'use strict';var multer=require(_0x09e2('0x0'));var util=require(_0x09e2('0x1'));var path=require(_0x09e2('0x2'));var timeout=require(_0x09e2('0x3'));var express=require(_0x09e2('0x4'));var router=express[_0x09e2('0x5')]();var fs_extra=require(_0x09e2('0x6'));var auth=require(_0x09e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x09e2('0x8'));var controller=require(_0x09e2('0x9'));router[_0x09e2('0xa')]('/',auth[_0x09e2('0xb')](),controller[_0x09e2('0xc')]);router[_0x09e2('0xa')](_0x09e2('0xd'),auth[_0x09e2('0xb')](),controller[_0x09e2('0xe')]);router[_0x09e2('0xf')]('/',auth[_0x09e2('0xb')](),controller[_0x09e2('0x10')]);router['put']('/:id',auth[_0x09e2('0xb')](),controller[_0x09e2('0x11')]);router['delete'](_0x09e2('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x24e8=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x24e8,0x7d));var _0x824e=function(_0x58418a,_0x3d9f06){_0x58418a=_0x58418a-0x0;var _0x2716bf=_0x24e8[_0x58418a];return _0x2716bf;};'use strict';var multer=require(_0x824e('0x0'));var util=require(_0x824e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x824e('0x2'));var router=express['Router']();var fs_extra=require(_0x824e('0x3'));var auth=require(_0x824e('0x4'));var interaction=require(_0x824e('0x5'));var config=require('../../config/environment');var controller=require(_0x824e('0x6'));router[_0x824e('0x7')]('/',auth[_0x824e('0x8')](),controller[_0x824e('0x9')]);router[_0x824e('0x7')](_0x824e('0xa'),auth[_0x824e('0x8')](),controller[_0x824e('0xb')]);router[_0x824e('0xc')]('/',auth['isAuthenticated'](),controller[_0x824e('0xd')]);router[_0x824e('0xe')](_0x824e('0xa'),auth[_0x824e('0x8')](),controller['update']);router[_0x824e('0xf')](_0x824e('0xa'),auth[_0x824e('0x8')](),controller[_0x824e('0x10')]);module[_0x824e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index de05a99..1a8d6e8 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 _0x5bd4=['sequelize','exports','noop','STRING','*,*,*,*'];(function(_0x20d9e7,_0x293309){var _0x3e3e52=function(_0x3f9c90){while(--_0x3f9c90){_0x20d9e7['push'](_0x20d9e7['shift']());}};_0x3e3e52(++_0x293309);}(_0x5bd4,0x163));var _0x45bd=function(_0x4597c4,_0x2ca900){_0x4597c4=_0x4597c4-0x0;var _0x53003e=_0x5bd4[_0x4597c4];return _0x53003e;};'use strict';var Sequelize=require(_0x45bd('0x0'));module[_0x45bd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x45bd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x45bd('0x3')]},'interval':{'type':Sequelize[_0x45bd('0x3')],'defaultValue':_0x45bd('0x4')}}; \ No newline at end of file +var _0x9e4b=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x56784e,_0x4ab2a2){var _0x2bf9f7=function(_0x18cb3e){while(--_0x18cb3e){_0x56784e['push'](_0x56784e['shift']());}};_0x2bf9f7(++_0x4ab2a2);}(_0x9e4b,0x141));var _0xb9e4=function(_0x292771,_0x2a6f3b){_0x292771=_0x292771-0x0;var _0x2acbba=_0x9e4b[_0x292771];return _0x2acbba;};'use strict';var Sequelize=require(_0xb9e4('0x0'));module[_0xb9e4('0x1')]={'priority':{'type':Sequelize[_0xb9e4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb9e4('0x3')],'allowNull':![],'defaultValue':_0xb9e4('0x4')},'appdata':{'type':Sequelize[_0xb9e4('0x5')]()},'description':{'type':Sequelize[_0xb9e4('0x3')]},'interval':{'type':Sequelize[_0xb9e4('0x3')],'defaultValue':_0xb9e4('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index aa48d09..4aef8ec 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 _0x97b2=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','length','find','create','body','update'];(function(_0x456eb7,_0x2830c8){var _0x6f6ee0=function(_0x54a594){while(--_0x54a594){_0x456eb7['push'](_0x456eb7['shift']());}};_0x6f6ee0(++_0x2830c8);}(_0x97b2,0x1b7));var _0x297b=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x97b2[_0x51ac09];return _0x3f827d;};'use strict';var emlformat=require(_0x297b('0x0'));var rimraf=require(_0x297b('0x1'));var zipdir=require(_0x297b('0x2'));var jsonpatch=require(_0x297b('0x3'));var rp=require(_0x297b('0x4'));var moment=require(_0x297b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x297b('0x6'));var util=require(_0x297b('0x7'));var path=require('path');var sox=require(_0x297b('0x8'));var csv=require(_0x297b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x297b('0xa'));var crypto=require(_0x297b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x297b('0xc'));var toCsv=require(_0x297b('0x9'));var querystring=require('querystring');var Papa=require(_0x297b('0xd'));var Redis=require('ioredis');var authService=require(_0x297b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x297b('0xf'));var hardwareService=require(_0x297b('0x10'));var logger=require(_0x297b('0x11'))(_0x297b('0x12'));var utils=require(_0x297b('0x13'));var config=require(_0x297b('0x14'));var licenseUtil=require(_0x297b('0x15'));var db=require(_0x297b('0x16'))['db'];function respondWithStatusCode(_0x17c231,_0xd833be){_0xd833be=_0xd833be||0xcc;return function(_0xf8a700){if(_0xf8a700){return _0x17c231[_0x297b('0x17')](_0xd833be);}return _0x17c231[_0x297b('0x18')](_0xd833be)[_0x297b('0x19')]();};}function respondWithResult(_0x27f44b,_0x56c7ed){_0x56c7ed=_0x56c7ed||0xc8;return function(_0x3446e6){if(_0x3446e6){return _0x27f44b[_0x297b('0x18')](_0x56c7ed)['json'](_0x3446e6);}};}function respondWithFilteredResult(_0x376287,_0x1a1434){return function(_0x4455f3){if(_0x4455f3){var _0x241ff6=typeof _0x1a1434[_0x297b('0x1a')]===_0x297b('0x1b')&&typeof _0x1a1434['limit']===_0x297b('0x1b');var _0x34854d=_0x4455f3[_0x297b('0x1c')];var _0x5618eb=_0x241ff6?0x0:_0x1a1434['offset'];var _0x161a40=_0x241ff6?_0x4455f3['count']:_0x1a1434[_0x297b('0x1a')]+_0x1a1434[_0x297b('0x1d')];var _0x2379dd;if(_0x161a40>=_0x34854d){_0x161a40=_0x34854d;_0x2379dd=0xc8;}else{_0x2379dd=0xce;}_0x376287[_0x297b('0x18')](_0x2379dd);return _0x376287[_0x297b('0x1e')]('Content-Range',_0x5618eb+'-'+_0x161a40+'/'+_0x34854d)[_0x297b('0x1f')](_0x4455f3);}return null;};}function patchUpdates(_0x250b19){return function(_0x5d2fa5){try{jsonpatch[_0x297b('0x20')](_0x5d2fa5,_0x250b19,!![]);}catch(_0x367c09){return BPromise[_0x297b('0x21')](_0x367c09);}return _0x5d2fa5[_0x297b('0x22')]();};}function saveUpdates(_0x4776e1,_0xa5bf63){return function(_0x402c1d){if(_0x402c1d){return _0x402c1d['update'](_0x4776e1)[_0x297b('0x23')](function(_0x19d8f3){return _0x19d8f3;});}return null;};}function removeEntity(_0x3df595,_0x56ed4b){return function(_0x279451){if(_0x279451){return _0x279451[_0x297b('0x24')]()[_0x297b('0x23')](function(){_0x3df595[_0x297b('0x18')](0xcc)[_0x297b('0x19')]();});}};}function handleEntityNotFound(_0x4e995f,_0x578d13){return function(_0x27ab73){if(!_0x27ab73){_0x4e995f[_0x297b('0x17')](0x194);}return _0x27ab73;};}function handleError(_0x46c23d,_0x2894b0){_0x2894b0=_0x2894b0||0x1f4;return function(_0x3f63dc){logger[_0x297b('0x25')](_0x3f63dc[_0x297b('0x26')]);if(_0x3f63dc['name']){delete _0x3f63dc['name'];}_0x46c23d['status'](_0x2894b0)[_0x297b('0x27')](_0x3f63dc);};}exports['index']=function(_0x5c2c26,_0x861618){var _0x323c47={},_0x2d64a={},_0xe51de={'count':0x0,'rows':[]};var _0x1caa2b=_[_0x297b('0x28')](db['WhatsappApplication'][_0x297b('0x29')],function(_0x50d2d0){return{'name':_0x50d2d0[_0x297b('0x2a')],'type':_0x50d2d0[_0x297b('0x2b')][_0x297b('0x2c')]};});_0x2d64a[_0x297b('0x2d')]=_[_0x297b('0x28')](_0x1caa2b,_0x297b('0x2e'));_0x2d64a[_0x297b('0x2f')]=_[_0x297b('0x30')](_0x5c2c26[_0x297b('0x2f')]);_0x2d64a[_0x297b('0x31')]=_[_0x297b('0x32')](_0x2d64a[_0x297b('0x2d')],_0x2d64a['query']);_0x323c47['attributes']=_[_0x297b('0x32')](_0x2d64a[_0x297b('0x2d')],qs[_0x297b('0x33')](_0x5c2c26[_0x297b('0x2f')]['fields']));_0x323c47[_0x297b('0x34')]=_0x323c47['attributes']['length']?_0x323c47[_0x297b('0x34')]:_0x2d64a[_0x297b('0x2d')];if(!_0x5c2c26[_0x297b('0x2f')][_0x297b('0x35')]('nolimit')){_0x323c47[_0x297b('0x1d')]=qs['limit'](_0x5c2c26[_0x297b('0x2f')][_0x297b('0x1d')]);_0x323c47['offset']=qs[_0x297b('0x1a')](_0x5c2c26[_0x297b('0x2f')]['offset']);}_0x323c47['order']=qs[_0x297b('0x36')](_0x5c2c26[_0x297b('0x2f')][_0x297b('0x36')]);_0x323c47['where']=qs[_0x297b('0x31')](_['pick'](_0x5c2c26[_0x297b('0x2f')],_0x2d64a['filters']),_0x1caa2b);if(_0x5c2c26[_0x297b('0x2f')][_0x297b('0x37')]){_0x323c47[_0x297b('0x38')]=_[_0x297b('0x39')](_0x323c47[_0x297b('0x38')],{'$or':_['map'](_0x1caa2b,function(_0x3895af){if(_0x3895af[_0x297b('0x2b')]!==_0x297b('0x3a')){var _0x581897={};_0x581897[_0x3895af[_0x297b('0x2e')]]={'$like':'%'+_0x5c2c26[_0x297b('0x2f')][_0x297b('0x37')]+'%'};return _0x581897;}})});}_0x323c47=_[_0x297b('0x39')]({},_0x323c47,_0x5c2c26[_0x297b('0x3b')]);var _0x32ce4c={'where':_0x323c47[_0x297b('0x38')]};return db[_0x297b('0x3c')][_0x297b('0x1c')](_0x32ce4c)[_0x297b('0x23')](function(_0x54ea17){_0xe51de['count']=_0x54ea17;if(_0x5c2c26[_0x297b('0x2f')][_0x297b('0x3d')]){_0x323c47[_0x297b('0x3e')]=[{'all':!![]}];}return db[_0x297b('0x3c')][_0x297b('0x3f')](_0x323c47);})[_0x297b('0x23')](function(_0x4a3e31){_0xe51de[_0x297b('0x40')]=_0x4a3e31;return _0xe51de;})[_0x297b('0x23')](respondWithFilteredResult(_0x861618,_0x323c47))[_0x297b('0x41')](handleError(_0x861618,null));};exports[_0x297b('0x42')]=function(_0x45a868,_0x1168ea){var _0x31780c={'raw':!![],'where':{'id':_0x45a868['params']['id']}},_0x3b89e3={};_0x3b89e3[_0x297b('0x2d')]=_['keys'](db[_0x297b('0x3c')][_0x297b('0x29')]);_0x3b89e3[_0x297b('0x2f')]=_[_0x297b('0x30')](_0x45a868[_0x297b('0x2f')]);_0x3b89e3[_0x297b('0x31')]=_[_0x297b('0x32')](_0x3b89e3['model'],_0x3b89e3[_0x297b('0x2f')]);_0x31780c[_0x297b('0x34')]=_['intersection'](_0x3b89e3[_0x297b('0x2d')],qs[_0x297b('0x33')](_0x45a868[_0x297b('0x2f')]['fields']));_0x31780c[_0x297b('0x34')]=_0x31780c[_0x297b('0x34')][_0x297b('0x43')]?_0x31780c['attributes']:_0x3b89e3[_0x297b('0x2d')];if(_0x45a868[_0x297b('0x2f')][_0x297b('0x3d')]){_0x31780c['include']=[{'all':!![]}];}_0x31780c=_[_0x297b('0x39')]({},_0x31780c,_0x45a868[_0x297b('0x3b')]);return db[_0x297b('0x3c')][_0x297b('0x44')](_0x31780c)[_0x297b('0x23')](handleEntityNotFound(_0x1168ea,null))['then'](respondWithResult(_0x1168ea,null))[_0x297b('0x41')](handleError(_0x1168ea,null));};exports[_0x297b('0x45')]=function(_0x5895b4,_0x3469f1){return db[_0x297b('0x3c')][_0x297b('0x45')](_0x5895b4[_0x297b('0x46')],{})[_0x297b('0x23')](respondWithResult(_0x3469f1,0xc9))[_0x297b('0x41')](handleError(_0x3469f1,null));};exports[_0x297b('0x47')]=function(_0x4e7e7e,_0x17d098){if(_0x4e7e7e[_0x297b('0x46')]['id']){delete _0x4e7e7e[_0x297b('0x46')]['id'];}return db[_0x297b('0x3c')]['find']({'where':{'id':_0x4e7e7e[_0x297b('0x48')]['id']}})[_0x297b('0x23')](handleEntityNotFound(_0x17d098,null))[_0x297b('0x23')](saveUpdates(_0x4e7e7e['body'],null))[_0x297b('0x23')](respondWithResult(_0x17d098,null))[_0x297b('0x41')](handleError(_0x17d098,null));};exports[_0x297b('0x24')]=function(_0xc11452,_0x5411e6){return db['WhatsappApplication'][_0x297b('0x44')]({'where':{'id':_0xc11452[_0x297b('0x48')]['id']}})[_0x297b('0x23')](handleEntityNotFound(_0x5411e6,null))['then'](removeEntity(_0x5411e6,null))[_0x297b('0x41')](handleError(_0x5411e6,null));}; \ No newline at end of file +var _0x6efe=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','WhatsappApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x129b53,_0x2110ef){var _0x2fdc2c=function(_0x2e7e34){while(--_0x2e7e34){_0x129b53['push'](_0x129b53['shift']());}};_0x2fdc2c(++_0x2110ef);}(_0x6efe,0xc6));var _0xe6ef=function(_0x393233,_0x1f9175){_0x393233=_0x393233-0x0;var _0x339128=_0x6efe[_0x393233];return _0x339128;};'use strict';var emlformat=require(_0xe6ef('0x0'));var rimraf=require(_0xe6ef('0x1'));var zipdir=require(_0xe6ef('0x2'));var jsonpatch=require(_0xe6ef('0x3'));var rp=require(_0xe6ef('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe6ef('0x5'));var util=require(_0xe6ef('0x6'));var path=require(_0xe6ef('0x7'));var sox=require(_0xe6ef('0x8'));var csv=require(_0xe6ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6ef('0xa'));var _=require(_0xe6ef('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6ef('0xc'));var toCsv=require(_0xe6ef('0x9'));var querystring=require(_0xe6ef('0xd'));var Papa=require('papaparse');var Redis=require(_0xe6ef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe6ef('0xf'));var as=require(_0xe6ef('0x10'));var hardwareService=require(_0xe6ef('0x11'));var logger=require(_0xe6ef('0x12'))(_0xe6ef('0x13'));var utils=require(_0xe6ef('0x14'));var config=require(_0xe6ef('0x15'));var licenseUtil=require(_0xe6ef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e1d2,_0x19d00d){_0x19d00d=_0x19d00d||0xcc;return function(_0xc934c9){if(_0xc934c9){return _0x35e1d2[_0xe6ef('0x17')](_0x19d00d);}return _0x35e1d2['status'](_0x19d00d)[_0xe6ef('0x18')]();};}function respondWithResult(_0x530479,_0x2093fa){_0x2093fa=_0x2093fa||0xc8;return function(_0x2fb9a8){if(_0x2fb9a8){return _0x530479[_0xe6ef('0x19')](_0x2093fa)[_0xe6ef('0x1a')](_0x2fb9a8);}};}function respondWithFilteredResult(_0x1d952c,_0x42d9b4){return function(_0xac08cc){if(_0xac08cc){var _0x469ac9=typeof _0x42d9b4[_0xe6ef('0x1b')]===_0xe6ef('0x1c')&&typeof _0x42d9b4[_0xe6ef('0x1d')]===_0xe6ef('0x1c');var _0x27c458=_0xac08cc[_0xe6ef('0x1e')];var _0x491c6f=_0x469ac9?0x0:_0x42d9b4['offset'];var _0x3e11ce=_0x469ac9?_0xac08cc['count']:_0x42d9b4[_0xe6ef('0x1b')]+_0x42d9b4['limit'];var _0x331ebc;if(_0x3e11ce>=_0x27c458){_0x3e11ce=_0x27c458;_0x331ebc=0xc8;}else{_0x331ebc=0xce;}_0x1d952c[_0xe6ef('0x19')](_0x331ebc);return _0x1d952c[_0xe6ef('0x1f')](_0xe6ef('0x20'),_0x491c6f+'-'+_0x3e11ce+'/'+_0x27c458)[_0xe6ef('0x1a')](_0xac08cc);}return null;};}function patchUpdates(_0x34210b){return function(_0x3232c9){try{jsonpatch[_0xe6ef('0x21')](_0x3232c9,_0x34210b,!![]);}catch(_0x50988c){return BPromise[_0xe6ef('0x22')](_0x50988c);}return _0x3232c9[_0xe6ef('0x23')]();};}function saveUpdates(_0x479b84,_0x14b90a){return function(_0x30633c){if(_0x30633c){return _0x30633c[_0xe6ef('0x24')](_0x479b84)[_0xe6ef('0x25')](function(_0x23ae10){return _0x23ae10;});}return null;};}function removeEntity(_0x511476,_0xcc677f){return function(_0x7562f2){if(_0x7562f2){return _0x7562f2[_0xe6ef('0x26')]()['then'](function(){_0x511476[_0xe6ef('0x19')](0xcc)[_0xe6ef('0x18')]();});}};}function handleEntityNotFound(_0x4dfd37,_0x448911){return function(_0xb9c909){if(!_0xb9c909){_0x4dfd37[_0xe6ef('0x17')](0x194);}return _0xb9c909;};}function handleError(_0x511714,_0x4345c6){_0x4345c6=_0x4345c6||0x1f4;return function(_0xd9ceb0){logger['error'](_0xd9ceb0[_0xe6ef('0x27')]);if(_0xd9ceb0[_0xe6ef('0x28')]){delete _0xd9ceb0[_0xe6ef('0x28')];}_0x511714[_0xe6ef('0x19')](_0x4345c6)[_0xe6ef('0x29')](_0xd9ceb0);};}exports['index']=function(_0x20cb35,_0x2fb026){var _0x877caf={},_0x2b840a={},_0x5396ea={'count':0x0,'rows':[]};var _0x2d65fc=_['map'](db[_0xe6ef('0x2a')][_0xe6ef('0x2b')],function(_0x1b626a){return{'name':_0x1b626a[_0xe6ef('0x2c')],'type':_0x1b626a[_0xe6ef('0x2d')]['key']};});_0x2b840a[_0xe6ef('0x2e')]=_[_0xe6ef('0x2f')](_0x2d65fc,_0xe6ef('0x28'));_0x2b840a[_0xe6ef('0x30')]=_[_0xe6ef('0x31')](_0x20cb35[_0xe6ef('0x30')]);_0x2b840a[_0xe6ef('0x32')]=_['intersection'](_0x2b840a['model'],_0x2b840a[_0xe6ef('0x30')]);_0x877caf[_0xe6ef('0x33')]=_[_0xe6ef('0x34')](_0x2b840a[_0xe6ef('0x2e')],qs[_0xe6ef('0x35')](_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x35')]));_0x877caf['attributes']=_0x877caf[_0xe6ef('0x33')][_0xe6ef('0x36')]?_0x877caf[_0xe6ef('0x33')]:_0x2b840a['model'];if(!_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x37')]('nolimit')){_0x877caf[_0xe6ef('0x1d')]=qs[_0xe6ef('0x1d')](_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x1d')]);_0x877caf[_0xe6ef('0x1b')]=qs['offset'](_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x1b')]);}_0x877caf[_0xe6ef('0x38')]=qs[_0xe6ef('0x39')](_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x39')]);_0x877caf['where']=qs[_0xe6ef('0x32')](_[_0xe6ef('0x3a')](_0x20cb35['query'],_0x2b840a[_0xe6ef('0x32')]),_0x2d65fc);if(_0x20cb35[_0xe6ef('0x30')]['filter']){_0x877caf[_0xe6ef('0x3b')]=_[_0xe6ef('0x3c')](_0x877caf[_0xe6ef('0x3b')],{'$or':_[_0xe6ef('0x2f')](_0x2d65fc,function(_0x2b0104){if(_0x2b0104['type']!==_0xe6ef('0x3d')){var _0x2b64f4={};_0x2b64f4[_0x2b0104[_0xe6ef('0x28')]]={'$like':'%'+_0x20cb35['query'][_0xe6ef('0x3e')]+'%'};return _0x2b64f4;}})});}_0x877caf=_[_0xe6ef('0x3c')]({},_0x877caf,_0x20cb35[_0xe6ef('0x3f')]);var _0x4d1264={'where':_0x877caf[_0xe6ef('0x3b')]};return db['WhatsappApplication']['count'](_0x4d1264)[_0xe6ef('0x25')](function(_0x431de4){_0x5396ea[_0xe6ef('0x1e')]=_0x431de4;if(_0x20cb35[_0xe6ef('0x30')][_0xe6ef('0x40')]){_0x877caf[_0xe6ef('0x41')]=[{'all':!![]}];}return db[_0xe6ef('0x2a')][_0xe6ef('0x42')](_0x877caf);})['then'](function(_0x510aed){_0x5396ea[_0xe6ef('0x43')]=_0x510aed;return _0x5396ea;})[_0xe6ef('0x25')](respondWithFilteredResult(_0x2fb026,_0x877caf))[_0xe6ef('0x44')](handleError(_0x2fb026,null));};exports[_0xe6ef('0x45')]=function(_0x3d2633,_0x22c3b6){var _0x4267df={'raw':!![],'where':{'id':_0x3d2633['params']['id']}},_0x566840={};_0x566840[_0xe6ef('0x2e')]=_['keys'](db['WhatsappApplication'][_0xe6ef('0x2b')]);_0x566840[_0xe6ef('0x30')]=_[_0xe6ef('0x31')](_0x3d2633['query']);_0x566840['filters']=_[_0xe6ef('0x34')](_0x566840[_0xe6ef('0x2e')],_0x566840[_0xe6ef('0x30')]);_0x4267df[_0xe6ef('0x33')]=_[_0xe6ef('0x34')](_0x566840[_0xe6ef('0x2e')],qs[_0xe6ef('0x35')](_0x3d2633[_0xe6ef('0x30')][_0xe6ef('0x35')]));_0x4267df[_0xe6ef('0x33')]=_0x4267df[_0xe6ef('0x33')][_0xe6ef('0x36')]?_0x4267df[_0xe6ef('0x33')]:_0x566840[_0xe6ef('0x2e')];if(_0x3d2633[_0xe6ef('0x30')][_0xe6ef('0x40')]){_0x4267df[_0xe6ef('0x41')]=[{'all':!![]}];}_0x4267df=_['merge']({},_0x4267df,_0x3d2633['options']);return db[_0xe6ef('0x2a')][_0xe6ef('0x46')](_0x4267df)['then'](handleEntityNotFound(_0x22c3b6,null))['then'](respondWithResult(_0x22c3b6,null))[_0xe6ef('0x44')](handleError(_0x22c3b6,null));};exports[_0xe6ef('0x47')]=function(_0x376f7a,_0x1c06db){return db['WhatsappApplication']['create'](_0x376f7a[_0xe6ef('0x48')],{})[_0xe6ef('0x25')](respondWithResult(_0x1c06db,0xc9))['catch'](handleError(_0x1c06db,null));};exports[_0xe6ef('0x24')]=function(_0x5251f4,_0x45b1e8){if(_0x5251f4[_0xe6ef('0x48')]['id']){delete _0x5251f4[_0xe6ef('0x48')]['id'];}return db[_0xe6ef('0x2a')]['find']({'where':{'id':_0x5251f4[_0xe6ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x45b1e8,null))[_0xe6ef('0x25')](saveUpdates(_0x5251f4['body'],null))[_0xe6ef('0x25')](respondWithResult(_0x45b1e8,null))[_0xe6ef('0x44')](handleError(_0x45b1e8,null));};exports[_0xe6ef('0x26')]=function(_0x24d610,_0x2a4e3f){return db[_0xe6ef('0x2a')][_0xe6ef('0x46')]({'where':{'id':_0x24d610[_0xe6ef('0x49')]['id']}})[_0xe6ef('0x25')](handleEntityNotFound(_0x2a4e3f,null))[_0xe6ef('0x25')](removeEntity(_0x2a4e3f,null))['catch'](handleError(_0x2a4e3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f4615d0..abfd998 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 _0x2b83=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2f6d16,_0x516c0c){var _0xf706a=function(_0x43dd25){while(--_0x43dd25){_0x2f6d16['push'](_0x2f6d16['shift']());}};_0xf706a(++_0x516c0c);}(_0x2b83,0x1d3));var _0x32b8=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x2b83[_0x166e96];return _0x553d73;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require(_0x32b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32b8('0x5'));var attributes=require(_0x32b8('0x6'));module['exports']=function(_0x6bbc3d,_0x55abd0){return _0x6bbc3d[_0x32b8('0x7')](_0x32b8('0x8'),attributes,{'tableName':_0x32b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32b8('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x34aa=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0xa5c63f,_0x2aaaa8){var _0xf352b1=function(_0x1291db){while(--_0x1291db){_0xa5c63f['push'](_0xa5c63f['shift']());}};_0xf352b1(++_0x2aaaa8);}(_0x34aa,0x171));var _0xa34a=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x34aa[_0x33554b];return _0x256954;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var moment=require(_0xa34a('0x3'));var BPromise=require(_0xa34a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa34a('0x5'));var rimraf=require(_0xa34a('0x6'));var config=require(_0xa34a('0x7'));var attributes=require(_0xa34a('0x8'));module[_0xa34a('0x9')]=function(_0x475f8f,_0x27349c){return _0x475f8f[_0xa34a('0xa')](_0xa34a('0xb'),attributes,{'tableName':_0xa34a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa34a('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a735474..2b80e60 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 _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x470d42,_0x1a35cb){var _0x2a7b75=function(_0x1a14cc){while(--_0x1a14cc){_0x470d42['push'](_0x470d42['shift']());}};_0x2a7b75(++_0x1a35cb);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3b8ff3,_0x3e3cd5){_0x3b8ff3=_0x3b8ff3-0x0;var _0x441aa4=_0x6f0d[_0x3b8ff3];return _0x441aa4;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x45615c,_0x5cb016){var _0x24b3f5=function(_0x45ff09){while(--_0x45ff09){_0x45615c['push'](_0x45615c['shift']());}};_0x24b3f5(++_0x5cb016);}(_0x032e,0x124));var _0xe032=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x032e[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cd69ce3..3523f2d 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 _0x6ec2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x95a11f,_0x3fa19f){var _0x370d93=function(_0x4212ef){while(--_0x4212ef){_0x95a11f['push'](_0x95a11f['shift']());}};_0x370d93(++_0x3fa19f);}(_0x6ec2,0x78));var _0x26ec=function(_0x55043f,_0x2e6e99){_0x55043f=_0x55043f-0x0;var _0x5d810c=_0x6ec2[_0x55043f];return _0x5d810c;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/describe',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id',auth[_0x26ec('0xc')](),controller['show']);router[_0x26ec('0xa')](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0xa')](_0x26ec('0x10'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x11')]);router[_0x26ec('0x12')]('/',auth[_0x26ec('0xc')](),controller['create']);router['post'](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x13')]);router[_0x26ec('0x12')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp',_0x26ec('0x16')),controller[_0x26ec('0x17')]);router[_0x26ec('0x18')](_0x26ec('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x26ec('0x1a'),_0x26ec('0x1b')),controller[_0x26ec('0x1c')]);router[_0x26ec('0x1d')]('/:id',auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x26ec('0x1d')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x475705,_0x3ffcd8){var _0x2bed9e=function(_0x21bb97){while(--_0x21bb97){_0x475705['push'](_0x475705['shift']());}};_0x2bed9e(++_0x3ffcd8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xfeda20,_0x558ccb){_0xfeda20=_0xfeda20-0x0;var _0x5d2ec5=_0xc1c6[_0xfeda20];return _0x5d2ec5;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9bb124d..e69d5d4 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 _0xb10d=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0xb10d,0x17f));var _0xdb10=function(_0x1f2791,_0x42ad62){_0x1f2791=_0x1f2791-0x0;var _0x3ed363=_0xb10d[_0x1f2791];return _0x3ed363;};'use strict';var Sequelize=require(_0xdb10('0x0'));var moment=require('moment');module[_0xdb10('0x1')]={'closed':{'type':Sequelize[_0xdb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdb10('0x3')]},'disposition':{'type':Sequelize[_0xdb10('0x4')]},'secondDisposition':{'type':Sequelize[_0xdb10('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdb10('0x4')]},'note':{'type':Sequelize[_0xdb10('0x4')]},'phone':{'type':Sequelize[_0xdb10('0x4')]},'read1stAt':{'type':Sequelize[_0xdb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdb10('0x5')]('in',_0xdb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xdb10('0x5')]('in',_0xdb10('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdb10('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdb10('0x7')]}}; \ No newline at end of file +var _0xb6da=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x525370,_0x5abe18){var _0x4a1ae9=function(_0x257f97){while(--_0x257f97){_0x525370['push'](_0x525370['shift']());}};_0x4a1ae9(++_0x5abe18);}(_0xb6da,0x8e));var _0xab6d=function(_0x5af789,_0x135b75){_0x5af789=_0x5af789-0x0;var _0x5ae55b=_0xb6da[_0x5af789];return _0x5ae55b;};'use strict';var Sequelize=require(_0xab6d('0x0'));var moment=require('moment');module[_0xab6d('0x1')]={'closed':{'type':Sequelize[_0xab6d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab6d('0x3')]},'disposition':{'type':Sequelize[_0xab6d('0x4')]},'secondDisposition':{'type':Sequelize[_0xab6d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xab6d('0x4')]},'note':{'type':Sequelize[_0xab6d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xab6d('0x5')]('in',_0xab6d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab6d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xab6d('0x5')]('in',_0xab6d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab6d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 6add103..414ee1a 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 _0x601c=['toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','fullname','get','Whatsapp','Account','N.A.','createdAt','closedAt','disposition','createReadStream','pipe','createWriteStream','basename','out','System','firstName','read','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','zip-dir','util','path','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','status','end','json','offset','undefined','count','limit','then','destroy','error','stack','name','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','catch','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','body','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','sort','where','pick','WhatsappInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix'];(function(_0x46e182,_0x1046a8){var _0x42ade0=function(_0xb5288f){while(--_0xb5288f){_0x46e182['push'](_0x46e182['shift']());}};_0x42ade0(++_0x1046a8);}(_0x601c,0xa3));var _0xc601=function(_0x46d864,_0x29c503){_0x46d864=_0x46d864-0x0;var _0x3a318b=_0x601c[_0x46d864];return _0x3a318b;};'use strict';var rimraf=require(_0xc601('0x0'));var zipdir=require(_0xc601('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc601('0x2'));var path=require(_0xc601('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc601('0x4'));var interaction=require(_0xc601('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc601('0x6'));var logger=require(_0xc601('0x7'))(_0xc601('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc601('0x9')]=_[_0xc601('0xa')](config[_0xc601('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc601('0xb'))(new Redis(config[_0xc601('0x9')]));require(_0xc601('0xc'))['register'](socket);function respondWithStatusCode(_0x3b2552,_0x101460){_0x101460=_0x101460||0xcc;return function(_0x2f1702){if(_0x2f1702){return _0x3b2552['sendStatus'](_0x101460);}return _0x3b2552[_0xc601('0xd')](_0x101460)[_0xc601('0xe')]();};}function respondWithResult(_0x15958a,_0x34d3df){_0x34d3df=_0x34d3df||0xc8;return function(_0x427224){if(_0x427224){return _0x15958a[_0xc601('0xd')](_0x34d3df)[_0xc601('0xf')](_0x427224);}};}function respondWithFilteredResult(_0x445237,_0x6d0e9c){return function(_0x6e04ad){if(_0x6e04ad){var _0x435b2b=typeof _0x6d0e9c[_0xc601('0x10')]==='undefined'&&typeof _0x6d0e9c['limit']===_0xc601('0x11');var _0x28cd61=_0x6e04ad[_0xc601('0x12')];var _0x405c22=_0x435b2b?0x0:_0x6d0e9c[_0xc601('0x10')];var _0x7476ae=_0x435b2b?_0x6e04ad['count']:_0x6d0e9c['offset']+_0x6d0e9c[_0xc601('0x13')];var _0x4d1a20;if(_0x7476ae>=_0x28cd61){_0x7476ae=_0x28cd61;_0x4d1a20=0xc8;}else{_0x4d1a20=0xce;}_0x445237[_0xc601('0xd')](_0x4d1a20);return _0x445237['set']('Content-Range',_0x405c22+'-'+_0x7476ae+'/'+_0x28cd61)[_0xc601('0xf')](_0x6e04ad);}return null;};}function saveUpdates(_0x25fd14){return function(_0x39d557){if(_0x39d557){return _0x39d557['update'](_0x25fd14)[_0xc601('0x14')](function(_0x1388d5){return _0x1388d5;});}return null;};}function removeEntity(_0x4782d6){return function(_0x5c6000){if(_0x5c6000){return _0x5c6000[_0xc601('0x15')]()[_0xc601('0x14')](function(){_0x4782d6[_0xc601('0xd')](0xcc)[_0xc601('0xe')]();});}};}function handleEntityNotFound(_0x32b25d){return function(_0x112a1a){if(!_0x112a1a){_0x32b25d['sendStatus'](0x194);}return _0x112a1a;};}function handleError(_0x83d5a7,_0x37948e){_0x37948e=_0x37948e||0x1f4;return function(_0x4f0532){logger[_0xc601('0x16')](_0x4f0532[_0xc601('0x17')]);if(_0x4f0532[_0xc601('0x18')]){delete _0x4f0532['name'];}_0x83d5a7[_0xc601('0xd')](_0x37948e)['send'](_0x4f0532);};}exports[_0xc601('0x19')]=function(_0x5f0e52,_0x11718a){var _0x5761b3={};var _0x2cf7ae=_['map'](db[_0xc601('0x1a')][_0xc601('0x1b')],function(_0x230387){return{'name':_0x230387[_0xc601('0x1c')],'type':_0x230387[_0xc601('0x1d')][_0xc601('0x1e')]};});_0x5761b3=qs[_0xc601('0x1f')](_0x2cf7ae,_0x5f0e52);return interaction[_0xc601('0x20')]('whatsapp',_0x5f0e52['query'],_0x5f0e52['user'],_0x5761b3,_0x2cf7ae)[_0xc601('0x14')](respondWithFilteredResult(_0x11718a,_0x5761b3))[_0xc601('0x21')](handleError(_0x11718a,null));};exports[_0xc601('0x22')]=function(_0x4ae1fb,_0x46c98b){var _0x773145={'raw':![],'where':{'id':_0x4ae1fb['params']['id']}},_0x79d1cb={};_0x79d1cb['model']=_[_0xc601('0x23')](db[_0xc601('0x1a')][_0xc601('0x1b')]);_0x79d1cb[_0xc601('0x24')]=_[_0xc601('0x23')](_0x4ae1fb[_0xc601('0x24')]);_0x79d1cb[_0xc601('0x25')]=_[_0xc601('0x26')](_0x79d1cb[_0xc601('0x27')],_0x79d1cb[_0xc601('0x24')]);_0x773145[_0xc601('0x28')]=_[_0xc601('0x26')](_0x79d1cb[_0xc601('0x27')],qs[_0xc601('0x29')](_0x4ae1fb[_0xc601('0x24')][_0xc601('0x29')]));_0x773145[_0xc601('0x28')]=_0x773145[_0xc601('0x28')][_0xc601('0x2a')]?_0x773145[_0xc601('0x28')]:_0x79d1cb['model'];if(_0x4ae1fb['query'][_0xc601('0x2b')]){_0x773145['include']=[{'all':!![]}];}_0x773145=_['merge']({},_0x773145,_0x4ae1fb[_0xc601('0x2c')]);return db[_0xc601('0x1a')][_0xc601('0x2d')](_0x773145)['then'](handleEntityNotFound(_0x46c98b,null))['then'](respondWithResult(_0x46c98b,null))[_0xc601('0x21')](handleError(_0x46c98b,null));};exports[_0xc601('0x2e')]=function(_0x4b35be,_0x49660d){return db[_0xc601('0x1a')][_0xc601('0x2e')](_0x4b35be[_0xc601('0x2f')],{})[_0xc601('0x14')](respondWithResult(_0x49660d,0xc9))['catch'](handleError(_0x49660d,null));};exports[_0xc601('0x30')]=function(_0x9bd42a,_0x4d2d85){if(_0x9bd42a[_0xc601('0x2f')]['id']){delete _0x9bd42a[_0xc601('0x2f')]['id'];}return db[_0xc601('0x1a')][_0xc601('0x2d')]({'where':{'id':_0x9bd42a['params']['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x4d2d85,null))[_0xc601('0x14')](saveUpdates(_0x9bd42a[_0xc601('0x2f')],null))['then'](respondWithResult(_0x4d2d85,null))[_0xc601('0x21')](handleError(_0x4d2d85,null));};exports['destroy']=function(_0x236271,_0x2c8ef5){return db[_0xc601('0x1a')]['find']({'where':{'id':_0x236271[_0xc601('0x31')]['id']}})['then'](handleEntityNotFound(_0x2c8ef5,null))[_0xc601('0x14')](removeEntity(_0x2c8ef5,null))[_0xc601('0x21')](handleError(_0x2c8ef5,null));};exports[_0xc601('0x32')]=function(_0xa892c3,_0x332798){return db['WhatsappInteraction'][_0xc601('0x32')]()[_0xc601('0x14')](respondWithResult(_0x332798,null))[_0xc601('0x21')](handleError(_0x332798,null));};exports[_0xc601('0x33')]=function(_0x3e2c79,_0x2cdac1){return db[_0xc601('0x34')]['find']({'where':{'id':_0x3e2c79[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x2cdac1,null))[_0xc601('0x14')](function(_0x1ce1c1){if(_0x1ce1c1){return _0x1ce1c1[_0xc601('0x33')](_0x3e2c79[_0xc601('0x2f')][_0xc601('0x35')],_[_0xc601('0x36')](_0x3e2c79[_0xc601('0x2f')],[_0xc601('0x35'),'id'])||{});}})[_0xc601('0x14')](respondWithResult(_0x2cdac1,null))['catch'](handleError(_0x2cdac1,null));};exports[_0xc601('0x37')]=function(_0x59aa29,_0x5ce949){var _0x5e25b1={'raw':![],'where':{}};var _0x43cf7a={};var _0x3f8a52={'count':0x0,'rows':[]};return db[_0xc601('0x1a')]['findOne']({'where':{'id':_0x59aa29[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x5ce949,null))['then'](function(_0x23bbd2){if(_0x23bbd2){_0x43cf7a[_0xc601('0x27')]=_['keys'](db[_0xc601('0x34')][_0xc601('0x1b')]);_0x43cf7a[_0xc601('0x24')]=_[_0xc601('0x23')](_0x59aa29[_0xc601('0x24')]);_0x43cf7a[_0xc601('0x25')]=_[_0xc601('0x26')](_0x43cf7a[_0xc601('0x27')],_0x43cf7a[_0xc601('0x24')]);_0x5e25b1[_0xc601('0x28')]=_['intersection'](_0x43cf7a[_0xc601('0x27')],qs[_0xc601('0x29')](_0x59aa29[_0xc601('0x24')][_0xc601('0x29')]));_0x5e25b1[_0xc601('0x28')]=_0x5e25b1[_0xc601('0x28')][_0xc601('0x2a')]?_0x5e25b1['attributes']:_0x43cf7a[_0xc601('0x27')];if(!_0x59aa29[_0xc601('0x24')][_0xc601('0x38')]('nolimit')){_0x5e25b1[_0xc601('0x13')]=qs[_0xc601('0x13')](_0x59aa29['query'][_0xc601('0x13')]);_0x5e25b1['offset']=qs[_0xc601('0x10')](_0x59aa29[_0xc601('0x24')][_0xc601('0x10')]);}_0x5e25b1['order']=qs[_0xc601('0x39')](_0x59aa29['query']['sort']);_0x5e25b1[_0xc601('0x3a')]=qs[_0xc601('0x25')](_[_0xc601('0x3b')](_0x59aa29[_0xc601('0x24')],_0x43cf7a[_0xc601('0x25')]));_0x5e25b1[_0xc601('0x3a')][_0xc601('0x3c')]=_0x23bbd2['id'];if(_0x59aa29['query'][_0xc601('0x3d')]){_0x5e25b1[_0xc601('0x3a')]=_[_0xc601('0x3e')](_0x5e25b1['where'],{'$or':_[_0xc601('0x3f')](_0x5e25b1['attributes'],function(_0xfaea1d){var _0x1b042c={};_0x1b042c[_0xfaea1d]={'$like':'%'+_0x59aa29[_0xc601('0x24')][_0xc601('0x3d')]+'%'};return _0x1b042c;})});}if(_0x59aa29[_0xc601('0x24')][_0xc601('0x40')]){var _0x3b3df0=_0x59aa29[_0xc601('0x24')][_0xc601('0x40')]['split'](',');var _0x32e2e4={};_0x32e2e4[_0x3b3df0[0x0]]={'$gte':moment(_0x3b3df0[0x1])[_0xc601('0x41')](_0xc601('0x42'))};_0x5e25b1[_0xc601('0x3a')]=_[_0xc601('0x3e')](_0x5e25b1['where'],_0x32e2e4);}_0x5e25b1=_[_0xc601('0x3e')]({},_0x5e25b1,_0x59aa29[_0xc601('0x2c')]);return db['WhatsappMessage'][_0xc601('0x12')]({'where':_0x5e25b1[_0xc601('0x3a')]})['then'](function(_0x4f64c1){_0x3f8a52[_0xc601('0x12')]=_0x4f64c1;if(_0x59aa29[_0xc601('0x24')][_0xc601('0x2b')]){_0x5e25b1[_0xc601('0x43')]=[{'all':!![]}];}return db[_0xc601('0x34')]['findAll'](_0x5e25b1);})[_0xc601('0x14')](function(_0xa6967c){_0x3f8a52['rows']=_0xa6967c;return _0x3f8a52;});}})['then'](respondWithFilteredResult(_0x5ce949,_0x5e25b1))[_0xc601('0x21')](handleError(_0x5ce949,null));};exports[_0xc601('0x44')]=function(_0x113297,_0x12a8ce){return db[_0xc601('0x1a')]['find']({'where':{'id':_0x113297[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x12a8ce,null))[_0xc601('0x14')](function(_0x2a3dbc){if(_0x2a3dbc){return _0x2a3dbc[_0xc601('0x45')](_0x113297['body']['ids'],_['omit'](_0x113297[_0xc601('0x2f')],['ids','id'])||{})[_0xc601('0x46')](function(){return db[_0xc601('0x47')]['findAll']({'attributes':['id',_0xc601('0x18'),_0xc601('0x48')],'where':{'id':_0x113297['body'][_0xc601('0x35')]}});})['then'](function(_0x575f58){socket[_0xc601('0x49')](_0xc601('0x4a'),{'id':Number(_0x113297[_0xc601('0x31')]['id']),'tags':_0x575f58||[]});return{'id':Number(_0x113297[_0xc601('0x31')]['id']),'tags':_0x575f58||[]};});}})[_0xc601('0x14')](respondWithResult(_0x12a8ce,null))[_0xc601('0x21')](handleError(_0x12a8ce,null));};exports[_0xc601('0x4b')]=function(_0x51c717,_0x14e5b0){return db[_0xc601('0x1a')][_0xc601('0x2d')]({'where':{'id':_0x51c717[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x14e5b0,null))['then'](function(_0x1739fb){if(_0x1739fb){return _0x1739fb[_0xc601('0x4b')](_0x51c717[_0xc601('0x24')][_0xc601('0x35')]);}})[_0xc601('0x14')](respondWithStatusCode(_0x14e5b0,null))[_0xc601('0x21')](handleError(_0x14e5b0,null));};exports['download']=function(_0x21fc1d,_0x1d890d){var _0x3587ca=moment()[_0xc601('0x4c')]()[_0xc601('0x4d')]();var _0x2fe654=path[_0xc601('0x4e')](config[_0xc601('0x4f')],_0xc601('0x50'),'files',_0xc601('0x51'));var _0x238cc1=path[_0xc601('0x4e')](config[_0xc601('0x4f')],_0xc601('0x50'),_0xc601('0x52'),_0xc601('0x53'));var _0x4ecec3=path[_0xc601('0x4e')](_0x2fe654,_0x3587ca);var _0x2d9fe0=util['format'](_0xc601('0x54'),_0x21fc1d[_0xc601('0x31')]['id'],_0x3587ca);var _0x12fb2f=path[_0xc601('0x4e')](_0x2fe654,_0x2d9fe0);var _0x413337=[];_0x413337[_0xc601('0x55')]({'model':db[_0xc601('0x56')],'as':_0xc601('0x56'),'attributes':['id','fullname'],'raw':!![]});_0x413337['push']({'model':db[_0xc601('0x57')],'as':_0xc601('0x58'),'attributes':['id','firstName',_0xc601('0x59')],'raw':!![]});if(_0x21fc1d[_0xc601('0x24')][_0xc601('0x53')]){_0x413337[_0xc601('0x55')]({'model':db[_0xc601('0x5a')],'as':_0xc601('0x5a'),'raw':!![]});}var _0x5e5627=[{'model':db[_0xc601('0x34')],'as':_0xc601('0x5b'),'attributes':['id',_0xc601('0x2f'),'createdAt',_0xc601('0x5c'),_0xc601('0x5d'),'read'],'include':_0x413337}];_0x5e5627[_0xc601('0x55')]({'model':db[_0xc601('0x5e')],'as':'Account','attributes':['id',_0xc601('0x18')]});_0x5e5627['push']({'model':db['User'],'as':_0xc601('0x5f'),'attributes':['id',_0xc601('0x60')]});return db['WhatsappInteraction'][_0xc601('0x2d')]({'where':{'id':_0x21fc1d[_0xc601('0x31')]['id']},'include':_0x5e5627})['then'](handleEntityNotFound(_0x1d890d,null))[_0xc601('0x14')](function(_0x1a7fc1){if(_0x1a7fc1){var _0x33f218=_0x1a7fc1[_0xc601('0x61')]({'plain':!![]});fs['mkdirSync'](_0x4ecec3);var _0x5221f3={'channel':_0xc601('0x62'),'account':_0x33f218[_0xc601('0x63')]['name'],'agent':_0x33f218['Owner']?_0x33f218[_0xc601('0x5f')]['fullname']:_0xc601('0x64'),'createdAt':moment(_0x33f218[_0xc601('0x65')])['format'](_0xc601('0x42'))[_0xc601('0x4d')](),'closedAt':_0x33f218['closed']?moment(_0x33f218[_0xc601('0x66')])[_0xc601('0x41')](_0xc601('0x42'))['toString']():'','disposition':_0x33f218[_0xc601('0x67')],'messages':_(_0x33f218[_0xc601('0x5b')])[_0xc601('0x3d')]({'secret':![]})[_0xc601('0x3f')](function(_0x966a30){if(_0x966a30['Attachment']){var _0x515c30=path['join'](_0x238cc1,_0x966a30['Attachment']['basename']);if(fs['existsSync'](_0x515c30)){fs[_0xc601('0x68')](_0x515c30)[_0xc601('0x69')](fs[_0xc601('0x6a')](path['join'](_0x4ecec3,_0x966a30[_0xc601('0x5a')][_0xc601('0x6b')])));}}return{'date':moment(_0x966a30[_0xc601('0x65')])[_0xc601('0x41')](_0xc601('0x42'))[_0xc601('0x4d')](),'sender':_0x966a30[_0xc601('0x5c')]===_0xc601('0x6c')?_0x966a30[_0xc601('0x56')]?_0x966a30['User'][_0xc601('0x60')]:_0xc601('0x6d'):_0x966a30['Contact'][_0xc601('0x6e')]+(_0x966a30[_0xc601('0x58')]['lastName']?'\x20'+_0x966a30['Contact'][_0xc601('0x59')]:''),'body':_0x966a30[_0xc601('0x5a')]?_0x966a30[_0xc601('0x5a')][_0xc601('0x6b')]:_0x966a30[_0xc601('0x2f')],'direction':_0x966a30[_0xc601('0x5c')]===_0xc601('0x6c')?'A':'C','secret':_0x966a30[_0xc601('0x5d')],'read':_0x966a30[_0xc601('0x6f')],'attachment':_0x966a30['Attachment']};})['value']()};return ejs[_0xc601('0x70')](path[_0xc601('0x4e')](config['root'],_0xc601('0x50'),'views',_0xc601('0x71')),{'interaction':_0x5221f3})[_0xc601('0x14')](function(_0x30522a){var _0x80345=path['join'](_0x4ecec3,_0xc601('0x72')+_0x33f218['id']+'-'+_0x3587ca+'.pdf');var _0x4b7197={'path':_0x80345,'channel':_0xc601('0x62'),'interactionId':_0x33f218['id']};return pdf[_0xc601('0x73')](_0x30522a,_0x4b7197);})[_0xc601('0x14')](function(){return new BPromise(function(_0x3ca008,_0x3c779c){zipdir(_0x4ecec3,{'saveTo':_0x12fb2f},function(_0x51731b,_0x11754c){if(_0x51731b)return _0x3c779c(_0x51731b);return _0x3ca008(_0x11754c);});})[_0xc601('0x14')](function(){return new BPromise(function(_0x3a2bf5,_0x46d336){rimraf(_0x4ecec3,function(_0x461ede){if(_0x461ede)_0x46d336(_0x461ede);return _0x3a2bf5();});});})[_0xc601('0x14')](function(){return _0x1d890d['download'](_0x12fb2f,_0x2d9fe0,function(_0x28f79b){if(_0x28f79b){console[_0xc601('0x74')](_0xc601('0x75'),_0x28f79b);}else{fs[_0xc601('0x76')](_0x12fb2f);}});});});}else{return _0x1d890d[_0xc601('0x77')](0xc8);}})[_0xc601('0x21')](handleError(_0x1d890d,null));}; \ No newline at end of file +var _0x8270=['spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Owner','mkdirSync','N.A.','closed','closedAt','disposition','filter','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','sendStatus','zip-dir','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','then','error','stack','name','index','rawAttributes','type','key','getOptions','query','user','catch','show','params','WhatsappInteraction','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','update','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','WhatsappInteractionId','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags'];(function(_0x40d71a,_0x43b392){var _0x5b8785=function(_0x5fb647){while(--_0x5fb647){_0x40d71a['push'](_0x40d71a['shift']());}};_0x5b8785(++_0x43b392);}(_0x8270,0xb4));var _0x0827=function(_0x176d88,_0x3d0bc4){_0x176d88=_0x176d88-0x0;var _0x38a86f=_0x8270[_0x176d88];return _0x38a86f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0827('0x0'));var moment=require('moment');var BPromise=require(_0x0827('0x1'));var util=require(_0x0827('0x2'));var path=require(_0x0827('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0827('0x4'));var Redis=require('ioredis');var interaction=require(_0x0827('0x5'));var qs=require(_0x0827('0x6'));var pdf=require(_0x0827('0x7'));var logger=require(_0x0827('0x8'))('api');var config=require(_0x0827('0x9'));var db=require(_0x0827('0xa'))['db'];config[_0x0827('0xb')]=_[_0x0827('0xc')](config[_0x0827('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0827('0xd'))[_0x0827('0xe')](socket);function respondWithStatusCode(_0x2ed2e0,_0x4547f6){_0x4547f6=_0x4547f6||0xcc;return function(_0x324a4d){if(_0x324a4d){return _0x2ed2e0['sendStatus'](_0x4547f6);}return _0x2ed2e0[_0x0827('0xf')](_0x4547f6)[_0x0827('0x10')]();};}function respondWithResult(_0x7bf560,_0x3f568c){_0x3f568c=_0x3f568c||0xc8;return function(_0x4d708c){if(_0x4d708c){return _0x7bf560[_0x0827('0xf')](_0x3f568c)['json'](_0x4d708c);}};}function respondWithFilteredResult(_0x16b718,_0x21c17a){return function(_0x41e41c){if(_0x41e41c){var _0x42e684=typeof _0x21c17a[_0x0827('0x11')]===_0x0827('0x12')&&typeof _0x21c17a[_0x0827('0x13')]==='undefined';var _0x230ed6=_0x41e41c[_0x0827('0x14')];var _0xf5caff=_0x42e684?0x0:_0x21c17a[_0x0827('0x11')];var _0x3978b2=_0x42e684?_0x41e41c[_0x0827('0x14')]:_0x21c17a['offset']+_0x21c17a[_0x0827('0x13')];var _0x19f6fe;if(_0x3978b2>=_0x230ed6){_0x3978b2=_0x230ed6;_0x19f6fe=0xc8;}else{_0x19f6fe=0xce;}_0x16b718['status'](_0x19f6fe);return _0x16b718[_0x0827('0x15')](_0x0827('0x16'),_0xf5caff+'-'+_0x3978b2+'/'+_0x230ed6)[_0x0827('0x17')](_0x41e41c);}return null;};}function saveUpdates(_0x34b289){return function(_0x18632e){if(_0x18632e){return _0x18632e['update'](_0x34b289)[_0x0827('0x18')](function(_0x339a44){return _0x339a44;});}return null;};}function removeEntity(_0x473242){return function(_0x3f1e54){if(_0x3f1e54){return _0x3f1e54['destroy']()[_0x0827('0x18')](function(){_0x473242[_0x0827('0xf')](0xcc)[_0x0827('0x10')]();});}};}function handleEntityNotFound(_0x4d184b){return function(_0x2d44dd){if(!_0x2d44dd){_0x4d184b['sendStatus'](0x194);}return _0x2d44dd;};}function handleError(_0x206147,_0x3e6c35){_0x3e6c35=_0x3e6c35||0x1f4;return function(_0x2a8104){logger[_0x0827('0x19')](_0x2a8104[_0x0827('0x1a')]);if(_0x2a8104[_0x0827('0x1b')]){delete _0x2a8104[_0x0827('0x1b')];}_0x206147[_0x0827('0xf')](_0x3e6c35)['send'](_0x2a8104);};}exports[_0x0827('0x1c')]=function(_0x5ec3f8,_0x45b453){var _0x20f49b={};var _0x51698b=_['map'](db['WhatsappInteraction'][_0x0827('0x1d')],function(_0x3920a8){return{'name':_0x3920a8['fieldName'],'type':_0x3920a8[_0x0827('0x1e')][_0x0827('0x1f')]};});_0x20f49b=qs[_0x0827('0x20')](_0x51698b,_0x5ec3f8);return interaction['findAll']('whatsapp',_0x5ec3f8[_0x0827('0x21')],_0x5ec3f8[_0x0827('0x22')],_0x20f49b,_0x51698b)['then'](respondWithFilteredResult(_0x45b453,_0x20f49b))[_0x0827('0x23')](handleError(_0x45b453,null));};exports[_0x0827('0x24')]=function(_0x4d1d4d,_0x4b1d20){var _0x5a51b3={'raw':![],'where':{'id':_0x4d1d4d[_0x0827('0x25')]['id']}},_0x304a61={};_0x304a61['model']=_['keys'](db[_0x0827('0x26')][_0x0827('0x1d')]);_0x304a61[_0x0827('0x21')]=_[_0x0827('0x27')](_0x4d1d4d[_0x0827('0x21')]);_0x304a61[_0x0827('0x28')]=_[_0x0827('0x29')](_0x304a61[_0x0827('0x2a')],_0x304a61[_0x0827('0x21')]);_0x5a51b3[_0x0827('0x2b')]=_['intersection'](_0x304a61['model'],qs['fields'](_0x4d1d4d[_0x0827('0x21')][_0x0827('0x2c')]));_0x5a51b3[_0x0827('0x2b')]=_0x5a51b3[_0x0827('0x2b')][_0x0827('0x2d')]?_0x5a51b3[_0x0827('0x2b')]:_0x304a61[_0x0827('0x2a')];if(_0x4d1d4d[_0x0827('0x21')][_0x0827('0x2e')]){_0x5a51b3[_0x0827('0x2f')]=[{'all':!![]}];}_0x5a51b3=_[_0x0827('0x30')]({},_0x5a51b3,_0x4d1d4d['options']);return db[_0x0827('0x26')][_0x0827('0x31')](_0x5a51b3)[_0x0827('0x18')](handleEntityNotFound(_0x4b1d20,null))[_0x0827('0x18')](respondWithResult(_0x4b1d20,null))[_0x0827('0x23')](handleError(_0x4b1d20,null));};exports[_0x0827('0x32')]=function(_0x4c01ed,_0x9a684f){return db[_0x0827('0x26')][_0x0827('0x32')](_0x4c01ed['body'],{})[_0x0827('0x18')](respondWithResult(_0x9a684f,0xc9))['catch'](handleError(_0x9a684f,null));};exports[_0x0827('0x33')]=function(_0x44a24d,_0x32a278){if(_0x44a24d['body']['id']){delete _0x44a24d[_0x0827('0x34')]['id'];}return db['WhatsappInteraction'][_0x0827('0x31')]({'where':{'id':_0x44a24d[_0x0827('0x25')]['id']}})[_0x0827('0x18')](handleEntityNotFound(_0x32a278,null))[_0x0827('0x18')](saveUpdates(_0x44a24d[_0x0827('0x34')],null))[_0x0827('0x18')](respondWithResult(_0x32a278,null))['catch'](handleError(_0x32a278,null));};exports['destroy']=function(_0x387945,_0x375343){return db['WhatsappInteraction'][_0x0827('0x31')]({'where':{'id':_0x387945[_0x0827('0x25')]['id']}})[_0x0827('0x18')](handleEntityNotFound(_0x375343,null))[_0x0827('0x18')](removeEntity(_0x375343,null))[_0x0827('0x23')](handleError(_0x375343,null));};exports[_0x0827('0x35')]=function(_0x3e5ecf,_0x4868e3){return db[_0x0827('0x26')][_0x0827('0x35')]()[_0x0827('0x18')](respondWithResult(_0x4868e3,null))[_0x0827('0x23')](handleError(_0x4868e3,null));};exports[_0x0827('0x36')]=function(_0x159ecd,_0x59e39e){return db[_0x0827('0x37')][_0x0827('0x31')]({'where':{'id':_0x159ecd[_0x0827('0x25')]['id']}})['then'](handleEntityNotFound(_0x59e39e,null))[_0x0827('0x18')](function(_0xa90a05){if(_0xa90a05){return _0xa90a05[_0x0827('0x36')](_0x159ecd['body'][_0x0827('0x38')],_[_0x0827('0x39')](_0x159ecd['body'],[_0x0827('0x38'),'id'])||{});}})[_0x0827('0x18')](respondWithResult(_0x59e39e,null))[_0x0827('0x23')](handleError(_0x59e39e,null));};exports[_0x0827('0x3a')]=function(_0x13c359,_0x32d0f4){var _0x31e81c={'raw':![],'where':{}};var _0x361c73={};var _0x502f20={'count':0x0,'rows':[]};return db[_0x0827('0x26')][_0x0827('0x3b')]({'where':{'id':_0x13c359[_0x0827('0x25')]['id']}})[_0x0827('0x18')](handleEntityNotFound(_0x32d0f4,null))[_0x0827('0x18')](function(_0xc8aae9){if(_0xc8aae9){_0x361c73[_0x0827('0x2a')]=_[_0x0827('0x27')](db['WhatsappMessage'][_0x0827('0x1d')]);_0x361c73[_0x0827('0x21')]=_[_0x0827('0x27')](_0x13c359[_0x0827('0x21')]);_0x361c73[_0x0827('0x28')]=_[_0x0827('0x29')](_0x361c73[_0x0827('0x2a')],_0x361c73[_0x0827('0x21')]);_0x31e81c['attributes']=_[_0x0827('0x29')](_0x361c73[_0x0827('0x2a')],qs['fields'](_0x13c359[_0x0827('0x21')][_0x0827('0x2c')]));_0x31e81c[_0x0827('0x2b')]=_0x31e81c[_0x0827('0x2b')]['length']?_0x31e81c['attributes']:_0x361c73[_0x0827('0x2a')];if(!_0x13c359['query'][_0x0827('0x3c')]('nolimit')){_0x31e81c[_0x0827('0x13')]=qs[_0x0827('0x13')](_0x13c359[_0x0827('0x21')][_0x0827('0x13')]);_0x31e81c[_0x0827('0x11')]=qs[_0x0827('0x11')](_0x13c359[_0x0827('0x21')][_0x0827('0x11')]);}_0x31e81c['order']=qs[_0x0827('0x3d')](_0x13c359[_0x0827('0x21')][_0x0827('0x3d')]);_0x31e81c['where']=qs[_0x0827('0x28')](_['pick'](_0x13c359[_0x0827('0x21')],_0x361c73[_0x0827('0x28')]));_0x31e81c['where'][_0x0827('0x3e')]=_0xc8aae9['id'];if(_0x13c359['query']['filter']){_0x31e81c[_0x0827('0x3f')]=_[_0x0827('0x30')](_0x31e81c[_0x0827('0x3f')],{'$or':_[_0x0827('0x40')](_0x31e81c[_0x0827('0x2b')],function(_0x27cbca){var _0x3c2c05={};_0x3c2c05[_0x27cbca]={'$like':'%'+_0x13c359['query']['filter']+'%'};return _0x3c2c05;})});}if(_0x13c359[_0x0827('0x21')][_0x0827('0x41')]){var _0x305864=_0x13c359[_0x0827('0x21')][_0x0827('0x41')][_0x0827('0x42')](',');var _0x427737={};_0x427737[_0x305864[0x0]]={'$gte':moment(_0x305864[0x1])[_0x0827('0x43')](_0x0827('0x44'))};_0x31e81c['where']=_[_0x0827('0x30')](_0x31e81c[_0x0827('0x3f')],_0x427737);}_0x31e81c=_[_0x0827('0x30')]({},_0x31e81c,_0x13c359[_0x0827('0x45')]);return db[_0x0827('0x37')][_0x0827('0x14')]({'where':_0x31e81c[_0x0827('0x3f')]})[_0x0827('0x18')](function(_0x470bc4){_0x502f20[_0x0827('0x14')]=_0x470bc4;if(_0x13c359[_0x0827('0x21')][_0x0827('0x2e')]){_0x31e81c[_0x0827('0x2f')]=[{'all':!![]}];}return db[_0x0827('0x37')][_0x0827('0x46')](_0x31e81c);})[_0x0827('0x18')](function(_0x39cf37){_0x502f20['rows']=_0x39cf37;return _0x502f20;});}})['then'](respondWithFilteredResult(_0x32d0f4,_0x31e81c))[_0x0827('0x23')](handleError(_0x32d0f4,null));};exports['addTags']=function(_0xd28171,_0x504b65){return db[_0x0827('0x26')][_0x0827('0x31')]({'where':{'id':_0xd28171[_0x0827('0x25')]['id']}})[_0x0827('0x18')](handleEntityNotFound(_0x504b65,null))[_0x0827('0x18')](function(_0x52aca4){if(_0x52aca4){return _0x52aca4[_0x0827('0x47')](_0xd28171['body'][_0x0827('0x38')],_[_0x0827('0x39')](_0xd28171[_0x0827('0x34')],[_0x0827('0x38'),'id'])||{})[_0x0827('0x48')](function(){return db[_0x0827('0x49')][_0x0827('0x46')]({'attributes':['id',_0x0827('0x1b'),_0x0827('0x4a')],'where':{'id':_0xd28171['body']['ids']}});})[_0x0827('0x18')](function(_0x3aed01){socket[_0x0827('0x4b')](_0x0827('0x4c'),{'id':Number(_0xd28171[_0x0827('0x25')]['id']),'tags':_0x3aed01||[]});return{'id':Number(_0xd28171[_0x0827('0x25')]['id']),'tags':_0x3aed01||[]};});}})['then'](respondWithResult(_0x504b65,null))[_0x0827('0x23')](handleError(_0x504b65,null));};exports['removeTags']=function(_0x2d2bc7,_0x2c5569){return db[_0x0827('0x26')][_0x0827('0x31')]({'where':{'id':_0x2d2bc7[_0x0827('0x25')]['id']}})[_0x0827('0x18')](handleEntityNotFound(_0x2c5569,null))[_0x0827('0x18')](function(_0x24b7ff){if(_0x24b7ff){return _0x24b7ff[_0x0827('0x4d')](_0x2d2bc7[_0x0827('0x21')][_0x0827('0x38')]);}})[_0x0827('0x18')](respondWithStatusCode(_0x2c5569,null))[_0x0827('0x23')](handleError(_0x2c5569,null));};exports[_0x0827('0x4e')]=function(_0xde2f8f,_0x20a459){var _0x3bc94e=moment()[_0x0827('0x4f')]()[_0x0827('0x50')]();var _0x567e11=path[_0x0827('0x51')](config[_0x0827('0x52')],_0x0827('0x53'),_0x0827('0x54'),_0x0827('0x55'));var _0x25d64b=path[_0x0827('0x51')](config[_0x0827('0x52')],_0x0827('0x53'),_0x0827('0x54'),_0x0827('0x56'));var _0x59d5d8=path[_0x0827('0x51')](_0x567e11,_0x3bc94e);var _0x1063ad=util[_0x0827('0x43')](_0x0827('0x57'),_0xde2f8f[_0x0827('0x25')]['id'],_0x3bc94e);var _0x59f892=path['join'](_0x567e11,_0x1063ad);var _0x1838ff=[];_0x1838ff[_0x0827('0x58')]({'model':db[_0x0827('0x59')],'as':_0x0827('0x59'),'attributes':['id',_0x0827('0x5a')],'raw':!![]});_0x1838ff[_0x0827('0x58')]({'model':db[_0x0827('0x5b')],'as':'Contact','attributes':['id',_0x0827('0x5c'),_0x0827('0x5d')],'raw':!![]});if(_0xde2f8f[_0x0827('0x21')][_0x0827('0x56')]){_0x1838ff[_0x0827('0x58')]({'model':db[_0x0827('0x5e')],'as':_0x0827('0x5e'),'raw':!![]});}var _0x54e10d=[{'model':db[_0x0827('0x37')],'as':_0x0827('0x5f'),'attributes':['id','body',_0x0827('0x60'),_0x0827('0x61'),_0x0827('0x62'),_0x0827('0x63')],'include':_0x1838ff}];_0x54e10d[_0x0827('0x58')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x0827('0x1b')]});_0x54e10d[_0x0827('0x58')]({'model':db[_0x0827('0x59')],'as':_0x0827('0x64'),'attributes':['id','fullname']});return db[_0x0827('0x26')]['find']({'where':{'id':_0xde2f8f[_0x0827('0x25')]['id']},'include':_0x54e10d})['then'](handleEntityNotFound(_0x20a459,null))[_0x0827('0x18')](function(_0x3ff120){if(_0x3ff120){var _0x2c19ea=_0x3ff120['get']({'plain':!![]});fs[_0x0827('0x65')](_0x59d5d8);var _0x4e265c={'channel':'Whatsapp','account':_0x2c19ea['Account']['name'],'agent':_0x2c19ea[_0x0827('0x64')]?_0x2c19ea[_0x0827('0x64')][_0x0827('0x5a')]:_0x0827('0x66'),'createdAt':moment(_0x2c19ea['createdAt'])[_0x0827('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0827('0x50')](),'closedAt':_0x2c19ea[_0x0827('0x67')]?moment(_0x2c19ea[_0x0827('0x68')])[_0x0827('0x43')](_0x0827('0x44'))[_0x0827('0x50')]():'','disposition':_0x2c19ea[_0x0827('0x69')],'messages':_(_0x2c19ea[_0x0827('0x5f')])[_0x0827('0x6a')]({'secret':![]})[_0x0827('0x40')](function(_0x163fed){if(_0x163fed[_0x0827('0x5e')]){var _0x95b9ac=path['join'](_0x25d64b,_0x163fed[_0x0827('0x5e')][_0x0827('0x6b')]);if(fs[_0x0827('0x6c')](_0x95b9ac)){fs[_0x0827('0x6d')](_0x95b9ac)[_0x0827('0x6e')](fs[_0x0827('0x6f')](path[_0x0827('0x51')](_0x59d5d8,_0x163fed['Attachment']['basename'])));}}return{'date':moment(_0x163fed[_0x0827('0x60')])[_0x0827('0x43')](_0x0827('0x44'))[_0x0827('0x50')](),'sender':_0x163fed[_0x0827('0x61')]===_0x0827('0x70')?_0x163fed['User']?_0x163fed['User'][_0x0827('0x5a')]:_0x0827('0x71'):_0x163fed[_0x0827('0x72')][_0x0827('0x5c')]+(_0x163fed[_0x0827('0x72')][_0x0827('0x5d')]?'\x20'+_0x163fed[_0x0827('0x72')][_0x0827('0x5d')]:''),'body':_0x163fed['Attachment']?_0x163fed['Attachment'][_0x0827('0x6b')]:_0x163fed[_0x0827('0x34')],'direction':_0x163fed['direction']==='out'?'A':'C','secret':_0x163fed['secret'],'read':_0x163fed[_0x0827('0x63')],'attachment':_0x163fed['Attachment']};})[_0x0827('0x73')]()};return ejs[_0x0827('0x74')](path['join'](config[_0x0827('0x52')],'server',_0x0827('0x75'),_0x0827('0x76')),{'interaction':_0x4e265c})['then'](function(_0x182cb1){var _0x5adcc7=path[_0x0827('0x51')](_0x59d5d8,_0x0827('0x77')+_0x2c19ea['id']+'-'+_0x3bc94e+_0x0827('0x78'));var _0x2d75f5={'path':_0x5adcc7,'channel':_0x0827('0x79'),'interactionId':_0x2c19ea['id']};return pdf[_0x0827('0x7a')](_0x182cb1,_0x2d75f5);})[_0x0827('0x18')](function(){return new BPromise(function(_0x3dc651,_0x3d9aaa){zipdir(_0x59d5d8,{'saveTo':_0x59f892},function(_0x4f731d,_0x4d8002){if(_0x4f731d)return _0x3d9aaa(_0x4f731d);return _0x3dc651(_0x4d8002);});})[_0x0827('0x18')](function(){return new BPromise(function(_0x1984d2,_0x5d5217){rimraf(_0x59d5d8,function(_0x2c1baa){if(_0x2c1baa)_0x5d5217(_0x2c1baa);return _0x1984d2();});});})[_0x0827('0x18')](function(){return _0x20a459[_0x0827('0x4e')](_0x59f892,_0x1063ad,function(_0x253b15){if(_0x253b15){console[_0x0827('0x7b')](_0x0827('0x7c'),_0x253b15);}else{fs['unlinkSync'](_0x59f892);}});});});}else{return _0x20a459[_0x0827('0x7d')](0xc8);}})[_0x0827('0x23')](handleError(_0x20a459,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 8047c55..16eab14 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 _0x1a83=['map','findAll','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x115b2e,_0x3f07bd){var _0x1e98ad=function(_0x58e8ff){while(--_0x58e8ff){_0x115b2e['push'](_0x115b2e['shift']());}};_0x1e98ad(++_0x3f07bd);}(_0x1a83,0x1c0));var _0x31a8=function(_0x5e798d,_0x5dcb0b){_0x5e798d=_0x5e798d-0x0;var _0x1fcda6=_0x1a83[_0x5e798d];return _0x1fcda6;};'use strict';var EventEmitter=require(_0x31a8('0x0'));var WhatsappInteraction=require(_0x31a8('0x1'))['db'][_0x31a8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x31a8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a8('0x4'),'afterUpdate':_0x31a8('0x5'),'afterDestroy':_0x31a8('0x6')};function emitEvent(_0x26aa71){return function(_0x4f18c3,_0x5e07ea,_0xde01e8){_0x4f18c3[_0x31a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x31a8('0x8')](function(_0x2c4b45){_0x4f18c3[_0x31a8('0x9')](_0x31a8('0xa'),_0x2c4b45[_0x31a8('0xb')](function(_0x12e5c8){return{'id':_0x12e5c8['id']};}));return WhatsappMessage[_0x31a8('0xc')]({'where':{'WhatsappInteractionId':_0x4f18c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31a8('0x8')](function(_0x4f1881){_0x4f18c3[_0x31a8('0x9')]('unreadMessages',_0x4f1881['length']);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71+':'+_0x4f18c3['id'],_0x4f18c3);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71,_0x4f18c3);_0xde01e8(null);})['catch'](_0xde01e8(null));};}for(var e in events){if(events[_0x31a8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x31a8('0xf')](e,emitEvent(event));}}module[_0x31a8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xb63f=['catch','hasOwnProperty','hook','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x573836,_0x599996){var _0x3d9709=function(_0x5b9e90){while(--_0x5b9e90){_0x573836['push'](_0x573836['shift']());}};_0x3d9709(++_0x599996);}(_0xb63f,0xa3));var _0xfb63=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xb63f[_0x3e6729];return _0x535bcd;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xfb63('0x0')];var WhatsappMessage=require(_0xfb63('0x1'))['db'][_0xfb63('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xfb63('0x3')](0x0);var events={'afterCreate':_0xfb63('0x4'),'afterUpdate':_0xfb63('0x5'),'afterDestroy':_0xfb63('0x6')};function emitEvent(_0x3fe487){return function(_0x99ddbb,_0x5b4439,_0x39cc2c){_0x99ddbb['getUsers']({'attributes':['id'],'raw':!![]})[_0xfb63('0x7')](function(_0xcf49af){_0x99ddbb['setDataValue']('Users',_0xcf49af['map'](function(_0x2b1a0f){return{'id':_0x2b1a0f['id']};}));return WhatsappMessage[_0xfb63('0x8')]({'where':{'WhatsappInteractionId':_0x99ddbb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfb63('0x7')](function(_0x55c21b){_0x99ddbb[_0xfb63('0x9')](_0xfb63('0xa'),_0x55c21b[_0xfb63('0xb')]);WhatsappInteractionEvents[_0xfb63('0xc')](_0x3fe487+':'+_0x99ddbb['id'],_0x99ddbb);WhatsappInteractionEvents[_0xfb63('0xc')](_0x3fe487,_0x99ddbb);_0x39cc2c(null);})[_0xfb63('0xd')](_0x39cc2c(null));};}for(var e in events){if(events[_0xfb63('0xe')](e)){var event=events[e];WhatsappInteraction[_0xfb63('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8bceaf7..1dba719 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 _0xd7b1=['../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xd7b1,0x1ab));var _0x1d7b=function(_0x405708,_0x5ec09b){_0x405708=_0x405708-0x0;var _0x52924f=_0xd7b1[_0x405708];return _0x52924f;};'use strict';var _=require(_0x1d7b('0x0'));var util=require('util');var logger=require(_0x1d7b('0x1'))(_0x1d7b('0x2'));var moment=require(_0x1d7b('0x3'));var BPromise=require(_0x1d7b('0x4'));var rp=require(_0x1d7b('0x5'));var fs=require('fs');var path=require(_0x1d7b('0x6'));var rimraf=require(_0x1d7b('0x7'));var config=require(_0x1d7b('0x8'));var attributes=require(_0x1d7b('0x9'));module[_0x1d7b('0xa')]=function(_0x288bbd,_0xa83ea7){return _0x288bbd['define'](_0x1d7b('0xb'),attributes,{'tableName':_0x1d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x217213,_0x47c343,_0x4a2fb0){if(_0x217213['changed']('closed')){_0x217213[_0x1d7b('0xd')]=moment()['format'](_0x1d7b('0xe'));}_0x4a2fb0(null,_0x217213);}}});}; \ No newline at end of file +var _0xa645=['request-promise','path','rimraf','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xa645,0xcb));var _0x5a64=function(_0x1cf369,_0x239015){_0x1cf369=_0x1cf369-0x0;var _0x5b73c8=_0xa645[_0x1cf369];return _0x5b73c8;};'use strict';var _=require('lodash');var util=require(_0x5a64('0x0'));var logger=require(_0x5a64('0x1'))(_0x5a64('0x2'));var moment=require(_0x5a64('0x3'));var BPromise=require(_0x5a64('0x4'));var rp=require(_0x5a64('0x5'));var fs=require('fs');var path=require(_0x5a64('0x6'));var rimraf=require(_0x5a64('0x7'));var config=require('../../config/environment');var attributes=require(_0x5a64('0x8'));module['exports']=function(_0x8f60b,_0x3eab27){return _0x8f60b[_0x5a64('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x5a64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f4bdf,_0x43869a,_0x19c8cc){if(_0x4f4bdf[_0x5a64('0xb')](_0x5a64('0xc'))){_0x4f4bdf[_0x5a64('0xd')]=moment()[_0x5a64('0xe')](_0x5a64('0xf'));}_0x19c8cc(null,_0x4f4bdf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cfd9f1e..da6539d 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 _0xf050=['request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','attributes','limit','AddTagsToWhatsappInteraction','ids','omit','body','AddTags','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','then','info','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x2b7924,_0x293315){var _0x3cfc1b=function(_0x421cde){while(--_0x421cde){_0x2b7924['push'](_0x2b7924['shift']());}};_0x3cfc1b(++_0x293315);}(_0xf050,0x1e4));var _0x0f05=function(_0x195a84,_0x37a11b){_0x195a84=_0x195a84-0x0;var _0x35fa94=_0xf050[_0x195a84];return _0x35fa94;};'use strict';var _=require(_0x0f05('0x0'));var util=require('util');var moment=require(_0x0f05('0x1'));var BPromise=require(_0x0f05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f05('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f05('0x4'))(_0x0f05('0x5'));var config=require(_0x0f05('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0f05('0x7')](config[_0x0f05('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f05('0x8')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x442a42,_0x5d5e53,_0x20560d){return new BPromise(function(_0x9e2a30,_0xa741ed){return client['request'](_0x442a42,_0x20560d)[_0x0f05('0x9')](function(_0x274e11){logger[_0x0f05('0xa')](_0x0f05('0xb'),_0x5d5e53,_0x0f05('0xc'));logger[_0x0f05('0xd')](_0x0f05('0xe'),_0x5d5e53,_0x0f05('0xc'),JSON[_0x0f05('0xf')](_0x274e11));if(_0x274e11[_0x0f05('0x10')]){if(_0x274e11['error']['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5d5e53,_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);return _0xa741ed(_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);}logger[_0x0f05('0x10')](_0x0f05('0xb'),_0x5d5e53,_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);return _0x9e2a30(_0x274e11['error'][_0x0f05('0x11')]);}else{logger[_0x0f05('0xa')](_0x0f05('0xb'),_0x5d5e53,_0x0f05('0xc'));_0x9e2a30(_0x274e11[_0x0f05('0x12')][_0x0f05('0x11')]);}})[_0x0f05('0x13')](function(_0x129880){logger[_0x0f05('0x10')](_0x0f05('0xb'),_0x5d5e53,_0x129880);_0xa741ed(_0x129880);});});}exports[_0x0f05('0x14')]=function(_0x33b81a){var _0x4233aa=this;return new Promise(function(_0x21923a,_0x1f36d8){return db[_0x0f05('0x15')][_0x0f05('0x16')](_0x33b81a['body'],{'raw':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')]['where']||null:null,'attributes':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')][_0x0f05('0x18')]||null:null,'limit':_0x33b81a['options']?_0x33b81a['options'][_0x0f05('0x19')]||null:null})['then'](function(_0x4e6f0d){logger[_0x0f05('0xa')](_0x0f05('0x14'),_0x33b81a);logger[_0x0f05('0xd')](_0x0f05('0x14'),_0x33b81a,JSON[_0x0f05('0xf')](_0x4e6f0d));_0x21923a(_0x4e6f0d);})['catch'](function(_0xb4139b){logger[_0x0f05('0x10')](_0x0f05('0x14'),_0xb4139b['message'],_0x33b81a);_0x1f36d8(_0x4233aa[_0x0f05('0x10')](0x1f4,_0xb4139b['message']));});});};exports[_0x0f05('0x1a')]=function(_0x349c60){return new Promise(function(_0x2d025b,_0x562c63){return db[_0x0f05('0x15')]['find']({'where':_0x349c60['options']?_0x349c60[_0x0f05('0x17')]['where']||null:null})[_0x0f05('0x9')](function(_0x415722){if(_0x415722){return _0x415722['addTags'](_0x349c60['body'][_0x0f05('0x1b')],_[_0x0f05('0x1c')](_0x349c60[_0x0f05('0x1d')],['ids','id'])||{});}})['spread'](function(_0x406961){logger['info']('AddTags',_0x349c60);logger[_0x0f05('0xd')](_0x0f05('0x1e'),_0x349c60,JSON[_0x0f05('0xf')](_0x406961));_0x2d025b(_0x406961);})[_0x0f05('0x13')](function(_0x2d1bb3){logger[_0x0f05('0x10')](_0x0f05('0x1e'),_0x2d1bb3[_0x0f05('0x11')],_0x349c60);_0x562c63(_this[_0x0f05('0x10')](0x1f4,_0x2d1bb3['message']));});});}; \ No newline at end of file +var _0x73ad=['stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','info','AddTagsToWhatsappInteraction','addTags','body','omit','ids','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2d3eaf,_0x4de619){var _0x419292=function(_0x76a80c){while(--_0x76a80c){_0x2d3eaf['push'](_0x2d3eaf['shift']());}};_0x419292(++_0x4de619);}(_0x73ad,0x109));var _0xd73a=function(_0x1912ae,_0x5551c0){_0x1912ae=_0x1912ae-0x0;var _0x4fa2c4=_0x73ad[_0x1912ae];return _0x4fa2c4;};'use strict';var _=require(_0xd73a('0x0'));var util=require('util');var moment=require(_0xd73a('0x1'));var BPromise=require(_0xd73a('0x2'));var rs=require(_0xd73a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd73a('0x4'));var logger=require(_0xd73a('0x5'))(_0xd73a('0x6'));var config=require(_0xd73a('0x7'));var jayson=require(_0xd73a('0x8'));var client=jayson[_0xd73a('0x9')][_0xd73a('0xa')]({'port':0x232a});config[_0xd73a('0xb')]=_[_0xd73a('0xc')](config['redis'],{'host':_0xd73a('0xd'),'port':0x18eb});var socket=require(_0xd73a('0xe'))(new Redis(config[_0xd73a('0xb')]));require(_0xd73a('0xf'))[_0xd73a('0x10')](socket);function respondWithRpcPromise(_0x3d0206,_0x250336,_0x56d4e3){return new BPromise(function(_0x223d5f,_0x187570){return client['request'](_0x3d0206,_0x56d4e3)[_0xd73a('0x11')](function(_0x3bf9ed){logger['info'](_0xd73a('0x12'),_0x250336,_0xd73a('0x13'));logger[_0xd73a('0x14')](_0xd73a('0x15'),_0x250336,_0xd73a('0x13'),JSON[_0xd73a('0x16')](_0x3bf9ed));if(_0x3bf9ed[_0xd73a('0x17')]){if(_0x3bf9ed['error'][_0xd73a('0x18')]===0x1f4){logger[_0xd73a('0x17')](_0xd73a('0x12'),_0x250336,_0x3bf9ed['error'][_0xd73a('0x19')]);return _0x187570(_0x3bf9ed['error'][_0xd73a('0x19')]);}logger['error'](_0xd73a('0x12'),_0x250336,_0x3bf9ed[_0xd73a('0x17')][_0xd73a('0x19')]);return _0x223d5f(_0x3bf9ed[_0xd73a('0x17')][_0xd73a('0x19')]);}else{logger['info'](_0xd73a('0x12'),_0x250336,_0xd73a('0x13'));_0x223d5f(_0x3bf9ed['result'][_0xd73a('0x19')]);}})[_0xd73a('0x1a')](function(_0x5a7c38){logger['error'](_0xd73a('0x12'),_0x250336,_0x5a7c38);_0x187570(_0x5a7c38);});});}exports[_0xd73a('0x1b')]=function(_0x23cad9){var _0x543657=this;return new Promise(function(_0x519530,_0x16fdea){return db[_0xd73a('0x1c')][_0xd73a('0x1d')](_0x23cad9['body'],{'raw':_0x23cad9['options']?_0x23cad9[_0xd73a('0x1e')][_0xd73a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23cad9[_0xd73a('0x1e')]?_0x23cad9[_0xd73a('0x1e')][_0xd73a('0x20')]||null:null,'attributes':_0x23cad9[_0xd73a('0x1e')]?_0x23cad9['options'][_0xd73a('0x21')]||null:null,'limit':_0x23cad9['options']?_0x23cad9['options']['limit']||null:null})['then'](function(_0x5caec1){logger[_0xd73a('0x22')](_0xd73a('0x1b'),_0x23cad9);logger[_0xd73a('0x14')](_0xd73a('0x1b'),_0x23cad9,JSON[_0xd73a('0x16')](_0x5caec1));_0x519530(_0x5caec1);})['catch'](function(_0x29ebb9){logger[_0xd73a('0x17')](_0xd73a('0x1b'),_0x29ebb9[_0xd73a('0x19')],_0x23cad9);_0x16fdea(_0x543657[_0xd73a('0x17')](0x1f4,_0x29ebb9[_0xd73a('0x19')]));});});};exports[_0xd73a('0x23')]=function(_0x122dc3){return new Promise(function(_0xd4ecf0,_0x3924f3){return db[_0xd73a('0x1c')]['find']({'where':_0x122dc3[_0xd73a('0x1e')]?_0x122dc3[_0xd73a('0x1e')][_0xd73a('0x20')]||null:null})['then'](function(_0x3f60d5){if(_0x3f60d5){return _0x3f60d5[_0xd73a('0x24')](_0x122dc3[_0xd73a('0x25')]['ids'],_[_0xd73a('0x26')](_0x122dc3[_0xd73a('0x25')],[_0xd73a('0x27'),'id'])||{});}})['spread'](function(_0xdc8139){logger[_0xd73a('0x22')]('AddTags',_0x122dc3);logger[_0xd73a('0x14')]('AddTags',_0x122dc3,JSON[_0xd73a('0x16')](_0xdc8139));_0xd4ecf0(_0xdc8139);})['catch'](function(_0x1283b7){logger['error'](_0xd73a('0x28'),_0x1283b7[_0xd73a('0x19')],_0x122dc3);_0x3924f3(_this[_0xd73a('0x17')](0x1f4,_0x1283b7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index af29aa5..5aa8a62 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 _0x1586=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1586,0x104));var _0x6158=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x1586[_0x1db831];return _0x39ba56;};'use strict';var WhatsappInteractionEvents=require(_0x6158('0x0'));var events=[_0x6158('0x1'),'remove',_0x6158('0x2')];function createListener(_0x44496b,_0x516624){return function(_0x4e2af9){_0x516624[_0x6158('0x3')](_0x44496b,_0x4e2af9);};}function removeListener(_0x4608ab,_0x33f0c8){return function(){WhatsappInteractionEvents[_0x6158('0x4')](_0x4608ab,_0x33f0c8);};}exports[_0x6158('0x5')]=function(_0x12c23f){for(var _0xe15ce4=0x0,_0x330cf3=events[_0x6158('0x6')];_0xe15ce4<_0x330cf3;_0xe15ce4++){var _0x156ec5=events[_0xe15ce4];var _0x480247=createListener(_0x6158('0x7')+_0x156ec5,_0x12c23f);WhatsappInteractionEvents['on'](_0x156ec5,_0x480247);}}; \ No newline at end of file +var _0x6546=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x39b01b,_0x5fb3bb){var _0x2e1926=function(_0x381bbb){while(--_0x381bbb){_0x39b01b['push'](_0x39b01b['shift']());}};_0x2e1926(++_0x5fb3bb);}(_0x6546,0x9e));var _0x6654=function(_0x293dd2,_0xbfa0c2){_0x293dd2=_0x293dd2-0x0;var _0x410e53=_0x6546[_0x293dd2];return _0x410e53;};'use strict';var WhatsappInteractionEvents=require(_0x6654('0x0'));var events=[_0x6654('0x1'),'remove',_0x6654('0x2')];function createListener(_0x5db8e8,_0x3acf35){return function(_0x3bb916){_0x3acf35[_0x6654('0x3')](_0x5db8e8,_0x3bb916);};}function removeListener(_0x2a2c9a,_0x390274){return function(){WhatsappInteractionEvents[_0x6654('0x4')](_0x2a2c9a,_0x390274);};}exports[_0x6654('0x5')]=function(_0x5d462e){for(var _0x38979e=0x0,_0x127110=events[_0x6654('0x6')];_0x38979e<_0x127110;_0x38979e++){var _0x1f51ef=events[_0x38979e];var _0x3e2580=createListener(_0x6654('0x7')+_0x1f51ef,_0x5d462e);WhatsappInteractionEvents['on'](_0x1f51ef,_0x3e2580);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8b8f8fa..cf3938d 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 _0x38ed=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','update','/:id/accept','put','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x26ec70,_0x233756){var _0x21b933=function(_0x3aab67){while(--_0x3aab67){_0x26ec70['push'](_0x26ec70['shift']());}};_0x21b933(++_0x233756);}(_0x38ed,0x1c5));var _0xd38e=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x38ed[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xd38e('0x0'));var util=require(_0xd38e('0x1'));var path=require(_0xd38e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd38e('0x3'));var router=express[_0xd38e('0x4')]();var fs_extra=require(_0xd38e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd38e('0x6'));var controller=require(_0xd38e('0x7'));router[_0xd38e('0x8')]('/',auth[_0xd38e('0x9')](),controller['index']);router[_0xd38e('0x8')](_0xd38e('0xa'),auth[_0xd38e('0x9')](),controller[_0xd38e('0xb')]);router[_0xd38e('0x8')](_0xd38e('0xc'),auth[_0xd38e('0x9')](),controller[_0xd38e('0xd')]);router[_0xd38e('0xe')]('/',auth[_0xd38e('0x9')](),interaction[_0xd38e('0xf')]('whatsapp',_0xd38e('0x10')),controller[_0xd38e('0x11')]);router[_0xd38e('0xe')](_0xd38e('0x12'),controller[_0xd38e('0x13')]);router['put']('/:id',auth[_0xd38e('0x9')](),controller[_0xd38e('0x14')]);router['put'](_0xd38e('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xd38e('0x16')](_0xd38e('0x17'),auth[_0xd38e('0x9')](),controller[_0xd38e('0x18')]);router['delete']('/:id',auth[_0xd38e('0x9')](),controller[_0xd38e('0x19')]);module[_0xd38e('0x1a')]=router; \ No newline at end of file +var _0x28e4=['delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','reject'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x28e4,0x120));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x428e('0x0'));var util=require('util');var path=require(_0x428e('0x1'));var timeout=require(_0x428e('0x2'));var express=require('express');var router=express[_0x428e('0x3')]();var fs_extra=require(_0x428e('0x4'));var auth=require(_0x428e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x428e('0x6'));var controller=require('./whatsappMessage.controller');router[_0x428e('0x7')]('/',auth[_0x428e('0x8')](),controller[_0x428e('0x9')]);router[_0x428e('0x7')](_0x428e('0xa'),auth[_0x428e('0x8')](),controller[_0x428e('0xb')]);router[_0x428e('0x7')](_0x428e('0xc'),auth['isAuthenticated'](),controller[_0x428e('0xd')]);router['post']('/',auth[_0x428e('0x8')](),interaction[_0x428e('0xe')](_0x428e('0xf'),_0x428e('0x10')),controller[_0x428e('0x11')]);router['post'](_0x428e('0x12'),controller[_0x428e('0x13')]);router[_0x428e('0x14')](_0x428e('0xc'),auth[_0x428e('0x8')](),controller[_0x428e('0x15')]);router[_0x428e('0x14')](_0x428e('0x16'),auth[_0x428e('0x8')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x428e('0x17')]);router[_0x428e('0x18')](_0x428e('0xc'),auth[_0x428e('0x8')](),controller[_0x428e('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ade8ad9..1e79011 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 _0x448a=['out','STRING','DATE','exports','TEXT','BOOLEAN'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x448a,0x1ef));var _0xa448=function(_0xc3629e,_0x286d5c){_0xc3629e=_0xc3629e-0x0;var _0x117f8d=_0x448a[_0xc3629e];return _0x117f8d;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'body':{'type':Sequelize[_0xa448('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa448('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa448('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa448('0x5')]},'secret':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa448('0x4')]},'providerResponse':{'type':Sequelize[_0xa448('0x1')]}}; \ No newline at end of file +var _0x7f5f=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x7f5f,0xa0));var _0xf7f5=function(_0x48c19b,_0x3a1721){_0x48c19b=_0x48c19b-0x0;var _0x7b88f=_0x7f5f[_0x48c19b];return _0x7b88f;};'use strict';var Sequelize=require(_0xf7f5('0x0'));module[_0xf7f5('0x1')]={'body':{'type':Sequelize[_0xf7f5('0x2')](_0xf7f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf7f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf7f5('0x5')]('in',_0xf7f5('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf7f5('0x7')](0xbe)},'phone':{'type':Sequelize[_0xf7f5('0x7')]},'readAt':{'type':Sequelize[_0xf7f5('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5a88ba9..332f29a 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 _0x913b=['keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappMessage','include','rows','show','params','includeAll','find','body','describe','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','../../config/logger','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','User','fullname','email','SIP/%s','WhatsappAccountId','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0x2f0db1,_0x53ecfe){var _0x45381a=function(_0x536287){while(--_0x536287){_0x2f0db1['push'](_0x2f0db1['shift']());}};_0x45381a(++_0x53ecfe);}(_0x913b,0x1e8));var _0xb913=function(_0x2757fc,_0xfbd23){_0x2757fc=_0x2757fc-0x0;var _0x58efc4=_0x913b[_0x2757fc];return _0x58efc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb913('0x0'));var jsonpatch=require(_0xb913('0x1'));var rp=require(_0xb913('0x2'));var moment=require(_0xb913('0x3'));var BPromise=require(_0xb913('0x4'));var Mustache=require(_0xb913('0x5'));var util=require(_0xb913('0x6'));var path=require(_0xb913('0x7'));var sox=require(_0xb913('0x8'));var csv=require(_0xb913('0x9'));var ejs=require(_0xb913('0xa'));var fs=require('fs');var fs_extra=require(_0xb913('0xb'));var _=require(_0xb913('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb913('0xd'));var toCsv=require(_0xb913('0x9'));var querystring=require(_0xb913('0xe'));var Papa=require(_0xb913('0xf'));var Redis=require(_0xb913('0x10'));var authService=require(_0xb913('0x11'));var qs=require(_0xb913('0x12'));var as=require(_0xb913('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb913('0x14'));var utils=require(_0xb913('0x15'));var config=require(_0xb913('0x16'));var licenseUtil=require(_0xb913('0x17'));var db=require(_0xb913('0x18'))['db'];config[_0xb913('0x19')]=_['defaults'](config[_0xb913('0x19')],{'host':_0xb913('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb913('0x19')]));require(_0xb913('0x1b'))[_0xb913('0x1c')](socket);var jayson=require(_0xb913('0x1d'));var client=jayson['client'][_0xb913('0x1e')]({'port':0x232c});var client9002=jayson[_0xb913('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599fb6,_0x4874f9,_0x471b3f,_0x435fdf){return new BPromise(function(_0x359c88,_0x1c7b97){var _0x2746a2=_0x435fdf||client;return _0x2746a2[_0xb913('0x20')](_0x599fb6,_0x471b3f)[_0xb913('0x21')](function(_0x126e95){logger[_0xb913('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4874f9,_0xb913('0x23'));logger[_0xb913('0x24')](_0xb913('0x25'),_0x4874f9,_0xb913('0x23'),JSON[_0xb913('0x26')](_0x126e95));if(_0x126e95[_0xb913('0x27')]){if(_0x126e95['error'][_0xb913('0x28')]===0x1f4){logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x126e95['error'][_0xb913('0x2a')]);return _0x1c7b97(_0x126e95[_0xb913('0x27')][_0xb913('0x2a')]);}logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x126e95['error']['message']);return _0x359c88(_0x126e95[_0xb913('0x27')][_0xb913('0x2a')]);}else{logger['info'](_0xb913('0x29'),_0x4874f9,'request\x20sent');_0x359c88(_0x126e95['result']['message']);}})[_0xb913('0x2b')](function(_0x431e37){logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x431e37);_0x1c7b97(_0x431e37);});});}function respondWithStatusCode(_0x3eed7e,_0xbaabcc){_0xbaabcc=_0xbaabcc||0xcc;return function(_0x3fb45a){if(_0x3fb45a){return _0x3eed7e[_0xb913('0x2c')](_0xbaabcc);}return _0x3eed7e['status'](_0xbaabcc)[_0xb913('0x2d')]();};}function respondWithResult(_0x1ba4db,_0x2cdb2c){_0x2cdb2c=_0x2cdb2c||0xc8;return function(_0xae010f){if(_0xae010f){return _0x1ba4db[_0xb913('0x2e')](_0x2cdb2c)[_0xb913('0x2f')](_0xae010f);}};}function respondWithFilteredResult(_0x42467c,_0x1606e0){return function(_0x186638){if(_0x186638){var _0xb20088=typeof _0x1606e0['offset']===_0xb913('0x30')&&typeof _0x1606e0['limit']===_0xb913('0x30');var _0x136812=_0x186638[_0xb913('0x31')];var _0x5c914f=_0xb20088?0x0:_0x1606e0[_0xb913('0x32')];var _0x55e45d=_0xb20088?_0x186638[_0xb913('0x31')]:_0x1606e0[_0xb913('0x32')]+_0x1606e0[_0xb913('0x33')];var _0x1dd0b3;if(_0x55e45d>=_0x136812){_0x55e45d=_0x136812;_0x1dd0b3=0xc8;}else{_0x1dd0b3=0xce;}_0x42467c[_0xb913('0x2e')](_0x1dd0b3);return _0x42467c[_0xb913('0x34')]('Content-Range',_0x5c914f+'-'+_0x55e45d+'/'+_0x136812)[_0xb913('0x2f')](_0x186638);}return null;};}function patchUpdates(_0x281fc6){return function(_0x564852){try{jsonpatch['apply'](_0x564852,_0x281fc6,!![]);}catch(_0x14827d){return BPromise['reject'](_0x14827d);}return _0x564852['save']();};}function saveUpdates(_0x5732dd,_0x514d2c){return function(_0x5d37cc){if(_0x5d37cc){return _0x5d37cc[_0xb913('0x35')](_0x5732dd)[_0xb913('0x21')](function(_0x20e260){return _0x20e260;});}return null;};}function removeEntity(_0x3333fb,_0x3c1ede){return function(_0x2d9cbc){if(_0x2d9cbc){return _0x2d9cbc[_0xb913('0x36')]()[_0xb913('0x21')](function(){_0x3333fb['status'](0xcc)[_0xb913('0x2d')]();});}};}function handleEntityNotFound(_0x360d53,_0x2002ef){return function(_0x43bd55){if(!_0x43bd55){_0x360d53[_0xb913('0x2c')](0x194);}return _0x43bd55;};}function handleError(_0x21e329,_0x497f3c){_0x497f3c=_0x497f3c||0x1f4;return function(_0x45a696){logger[_0xb913('0x27')](_0x45a696['stack']);if(_0x45a696[_0xb913('0x37')]){delete _0x45a696['name'];}_0x21e329[_0xb913('0x2e')](_0x497f3c)[_0xb913('0x38')](_0x45a696);};}exports[_0xb913('0x39')]=function(_0x2604a8,_0x3b8300){var _0x59fd2f={},_0x430cc2={},_0x5f1e95={'count':0x0,'rows':[]};var _0xc299a0=_[_0xb913('0x3a')](db['WhatsappMessage'][_0xb913('0x3b')],function(_0x2846d8){return{'name':_0x2846d8[_0xb913('0x3c')],'type':_0x2846d8[_0xb913('0x3d')][_0xb913('0x3e')]};});_0x430cc2['model']=_[_0xb913('0x3a')](_0xc299a0,_0xb913('0x37'));_0x430cc2[_0xb913('0x3f')]=_[_0xb913('0x40')](_0x2604a8[_0xb913('0x3f')]);_0x430cc2['filters']=_[_0xb913('0x41')](_0x430cc2['model'],_0x430cc2[_0xb913('0x3f')]);_0x59fd2f['attributes']=_[_0xb913('0x41')](_0x430cc2[_0xb913('0x42')],qs[_0xb913('0x43')](_0x2604a8[_0xb913('0x3f')][_0xb913('0x43')]));_0x59fd2f[_0xb913('0x44')]=_0x59fd2f[_0xb913('0x44')][_0xb913('0x45')]?_0x59fd2f['attributes']:_0x430cc2[_0xb913('0x42')];if(!_0x2604a8['query']['hasOwnProperty'](_0xb913('0x46'))){_0x59fd2f[_0xb913('0x33')]=qs[_0xb913('0x33')](_0x2604a8[_0xb913('0x3f')][_0xb913('0x33')]);_0x59fd2f[_0xb913('0x32')]=qs[_0xb913('0x32')](_0x2604a8['query'][_0xb913('0x32')]);}_0x59fd2f[_0xb913('0x47')]=qs['sort'](_0x2604a8[_0xb913('0x3f')][_0xb913('0x48')]);_0x59fd2f[_0xb913('0x49')]=qs[_0xb913('0x4a')](_[_0xb913('0x4b')](_0x2604a8[_0xb913('0x3f')],_0x430cc2[_0xb913('0x4a')]),_0xc299a0);if(_0x2604a8[_0xb913('0x3f')][_0xb913('0x4c')]){_0x59fd2f[_0xb913('0x49')]=_[_0xb913('0x4d')](_0x59fd2f[_0xb913('0x49')],{'$or':_[_0xb913('0x3a')](_0xc299a0,function(_0x4a0f3a){if(_0x4a0f3a[_0xb913('0x3d')]!==_0xb913('0x4e')){var _0x4039e4={};_0x4039e4[_0x4a0f3a[_0xb913('0x37')]]={'$like':'%'+_0x2604a8[_0xb913('0x3f')][_0xb913('0x4c')]+'%'};return _0x4039e4;}})});}_0x59fd2f=_[_0xb913('0x4d')]({},_0x59fd2f,_0x2604a8[_0xb913('0x4f')]);var _0xc7f17d={'where':_0x59fd2f['where']};return db[_0xb913('0x50')][_0xb913('0x31')](_0xc7f17d)[_0xb913('0x21')](function(_0x5e43b3){_0x5f1e95['count']=_0x5e43b3;if(_0x2604a8[_0xb913('0x3f')]['includeAll']){_0x59fd2f[_0xb913('0x51')]=[{'all':!![]}];}return db[_0xb913('0x50')]['findAll'](_0x59fd2f);})[_0xb913('0x21')](function(_0x2b2340){_0x5f1e95[_0xb913('0x52')]=_0x2b2340;return _0x5f1e95;})[_0xb913('0x21')](respondWithFilteredResult(_0x3b8300,_0x59fd2f))[_0xb913('0x2b')](handleError(_0x3b8300,null));};exports[_0xb913('0x53')]=function(_0x1e58a8,_0x50f20b){var _0x246946={'raw':!![],'where':{'id':_0x1e58a8[_0xb913('0x54')]['id']}},_0x5464ee={};_0x5464ee[_0xb913('0x42')]=_[_0xb913('0x40')](db[_0xb913('0x50')][_0xb913('0x3b')]);_0x5464ee['query']=_[_0xb913('0x40')](_0x1e58a8[_0xb913('0x3f')]);_0x5464ee['filters']=_[_0xb913('0x41')](_0x5464ee['model'],_0x5464ee['query']);_0x246946['attributes']=_['intersection'](_0x5464ee[_0xb913('0x42')],qs[_0xb913('0x43')](_0x1e58a8['query'][_0xb913('0x43')]));_0x246946['attributes']=_0x246946[_0xb913('0x44')]['length']?_0x246946[_0xb913('0x44')]:_0x5464ee['model'];if(_0x1e58a8[_0xb913('0x3f')][_0xb913('0x55')]){_0x246946[_0xb913('0x51')]=[{'all':!![]}];}_0x246946=_[_0xb913('0x4d')]({},_0x246946,_0x1e58a8[_0xb913('0x4f')]);return db['WhatsappMessage'][_0xb913('0x56')](_0x246946)[_0xb913('0x21')](handleEntityNotFound(_0x50f20b,null))[_0xb913('0x21')](respondWithResult(_0x50f20b,null))[_0xb913('0x2b')](handleError(_0x50f20b,null));};exports['create']=function(_0x217f03,_0x52204e){return db['WhatsappMessage']['create'](_0x217f03[_0xb913('0x57')],{})[_0xb913('0x21')](respondWithResult(_0x52204e,0xc9))[_0xb913('0x2b')](handleError(_0x52204e,null));};exports['update']=function(_0x49af90,_0x477c71){if(_0x49af90['body']['id']){delete _0x49af90[_0xb913('0x57')]['id'];}return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x49af90[_0xb913('0x54')]['id']}})[_0xb913('0x21')](handleEntityNotFound(_0x477c71,null))[_0xb913('0x21')](saveUpdates(_0x49af90[_0xb913('0x57')],null))[_0xb913('0x21')](respondWithResult(_0x477c71,null))['catch'](handleError(_0x477c71,null));};exports['destroy']=function(_0x3cd478,_0xb32deb){return db[_0xb913('0x50')]['find']({'where':{'id':_0x3cd478['params']['id']}})['then'](handleEntityNotFound(_0xb32deb,null))[_0xb913('0x21')](removeEntity(_0xb32deb,null))['catch'](handleError(_0xb32deb,null));};exports[_0xb913('0x58')]=function(_0x4510d7,_0x3d760c){return db['WhatsappMessage']['describe']()[_0xb913('0x21')](respondWithResult(_0x3d760c,null))['catch'](handleError(_0x3d760c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x18d94a,_0x7d362c,_0x1290ec){var _0x41488c={'agent':{},'channel':_0xb913('0x59')};if(_0x18d94a['body']['id']){delete _0x18d94a[_0xb913('0x57')]['id'];}_0x18d94a['body'][_0xb913('0x5a')]=!![];_0x18d94a[_0xb913('0x57')][_0xb913('0x5b')]=moment()['format'](_0xb913('0x5c'));_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')]=_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')]||_0x18d94a[_0xb913('0x5e')]['id'];_0x41488c[_0xb913('0x5f')]['id']=_0x18d94a[_0xb913('0x57')]['UserId'];return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x18d94a[_0xb913('0x54')]['id'],'UserId':null}})[_0xb913('0x21')](handleEntityNotFound(_0x7d362c,null))[_0xb913('0x21')](saveUpdates(_0x18d94a[_0xb913('0x57')],null))[_0xb913('0x21')](function(_0x706c90){if(_0x706c90){_0x41488c[_0xb913('0x2a')]=_0x706c90[_0xb913('0x60')]({'plain':!![]});return db[_0xb913('0x61')][_0xb913('0x56')]({'where':{'id':_0x706c90[_0xb913('0x62')]}});}return null;})[_0xb913('0x21')](handleEntityNotFound(_0x7d362c,null))['then'](function(_0x192fd7){if(_0x192fd7){return _0x192fd7[_0xb913('0x35')]({'UserId':_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')],'read1stAt':_[_0xb913('0x63')](_0x192fd7[_0xb913('0x64')])?moment()[_0xb913('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb913('0x21')](function(_0xdd18b){if(_0xdd18b){_0x41488c[_0xb913('0x66')]=_0xdd18b[_0xb913('0x60')]({'plain':!![]});interaction_log[_0xb913('0x22')](_0xb913('0x67'),_0x18d94a[_0xb913('0x5e')]['id'],_0x18d94a[_0xb913('0x5e')][_0xb913('0x37')],_0x18d94a[_0xb913('0x5e')][_0xb913('0x68')],_0x41488c[_0xb913('0x66')]['id'],_0x18d94a[_0xb913('0x57')]?JSON[_0xb913('0x26')](_0x18d94a['body']):_0xb913('0x69'));return respondWithRpcPromise(_0xb913('0x6a'),_0xb913('0x6b'),_0x41488c);}return null;})[_0xb913('0x21')](function(_0xd0206d){var _0x3e0ca9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd0206d[_0xb913('0x2a')][_0xb913('0x6c')];return db['sequelize']['query'](_0x3e0ca9,{'type':db[_0xb913('0x6d')][_0xb913('0x6e')][_0xb913('0x6f')],'raw':!![]})['then'](function(_0x117b99){return _0x117b99;});})[_0xb913('0x21')](function(_0x537b6a){if(_0x537b6a){_0x41488c[_0xb913('0x2a')][_0xb913('0x70')]=_0x537b6a[0x0];if(!_0x18d94a['body'][_0xb913('0x5d')])return;return db['User'][_0xb913('0x56')]({'where':{'id':_0x18d94a[_0xb913('0x57')]['UserId'],'role':_0xb913('0x5f')},'attributes':['id',_0xb913('0x37'),'fullname','email',_0xb913('0x71')],'raw':!![]});}return null;})[_0xb913('0x21')](function(_0x58d243){if(!_0x58d243)return null;_0x41488c[_0xb913('0x2a')]['agent']=_0x58d243;return _0x41488c;})['then'](function(_0x16deb0){if(_0x16deb0){if(_0x18d94a['body'][_0xb913('0x72')]){_0x41488c[_0xb913('0x2a')][_0xb913('0x73')]=util[_0xb913('0x65')]('SIP/%s',_0x18d94a['user'][_0xb913('0x37')]);_0x41488c['message'][_0xb913('0x74')]=_0x41488c[_0xb913('0x74')];_0x41488c['message'][_0xb913('0x75')]=_0x41488c[_0xb913('0x74')];_0x41488c['message'][_0xb913('0x76')]=_0xb913('0x77');return respondWithRpcPromise(_0xb913('0x78'),_0xb913('0x78'),{'event':_0xb913('0x79'),'message':_0x41488c[_0xb913('0x2a')]},client9002)[_0xb913('0x21')](function(){return _0x41488c;});}return _0x41488c;}return null;})[_0xb913('0x21')](respondWithResult(_0x7d362c,null))[_0xb913('0x2b')](handleError(_0x7d362c,null));};var interaction_log=require(_0xb913('0x7a'))('whatsapp-interactions');exports[_0xb913('0x7b')]=function(_0x2d70c2,_0x48cba0,_0x5de7aa){var _0x7d83d3={'agent':{},'channel':_0xb913('0x59')};if(_0x2d70c2[_0xb913('0x57')]['id']){delete _0x2d70c2[_0xb913('0x57')]['id'];}_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')]=_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')]||_0x2d70c2[_0xb913('0x5e')]['id'];_0x7d83d3['agent']['id']=_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')];return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x2d70c2['params']['id'],'UserId':null}})[_0xb913('0x21')](handleEntityNotFound(_0x48cba0,null))[_0xb913('0x21')](function(_0x573aec){if(_0x573aec){_0x7d83d3[_0xb913('0x2a')]=_0x573aec['get']({'plain':!![]});return db[_0xb913('0x61')][_0xb913('0x56')]({'where':{'id':_0x573aec['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x48cba0,null))[_0xb913('0x21')](function(_0x144a99){if(_0x144a99){_0x7d83d3['interaction']=_0x144a99['get']({'plain':!![]});interaction_log[_0xb913('0x22')](_0xb913('0x7c'),_0x2d70c2[_0xb913('0x5e')]['id'],_0x2d70c2['user'][_0xb913('0x37')],_0x2d70c2['user'][_0xb913('0x68')],_0x7d83d3[_0xb913('0x66')]['id'],_0x2d70c2[_0xb913('0x57')]?JSON[_0xb913('0x26')](_0x2d70c2[_0xb913('0x57')]):_0xb913('0x69'));return respondWithRpcPromise('RejectMessage',_0xb913('0x7d'),_0x7d83d3);}return null;})[_0xb913('0x21')](function(_0x2cb8cc){var _0xe47ba7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cb8cc['message']['ContactId'];return db[_0xb913('0x7e')][_0xb913('0x3f')](_0xe47ba7,{'type':db[_0xb913('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xb913('0x21')](function(_0x14dfcb){return _0x14dfcb;});})['then'](function(_0x39ee4f){if(_0x39ee4f){_0x7d83d3[_0xb913('0x2a')][_0xb913('0x70')]=_0x39ee4f[0x0];if(!_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')])return;return db[_0xb913('0x7f')][_0xb913('0x56')]({'where':{'id':_0x2d70c2[_0xb913('0x57')]['UserId'],'role':_0xb913('0x5f')},'attributes':['id','name',_0xb913('0x80'),_0xb913('0x81'),_0xb913('0x71')],'raw':!![]});}return null;})[_0xb913('0x21')](function(_0xf5cd29){if(!_0xf5cd29)return null;_0x7d83d3[_0xb913('0x2a')][_0xb913('0x5f')]=_0xf5cd29;return _0x7d83d3;})[_0xb913('0x21')](function(_0x4891fb){if(_0x4891fb){_0x4891fb['message']['interface']=util['format'](_0xb913('0x82'),_0x2d70c2[_0xb913('0x5e')][_0xb913('0x37')]);_0x4891fb[_0xb913('0x2a')][_0xb913('0x74')]=_0x7d83d3[_0xb913('0x74')];_0x4891fb[_0xb913('0x2a')][_0xb913('0x75')]=_0x7d83d3[_0xb913('0x74')];_0x4891fb[_0xb913('0x2a')][_0xb913('0x76')]=_0xb913('0x7b');respondWithRpcPromise(_0xb913('0x78'),'EventManager',{'event':'rejectmessage','message':_0x4891fb[_0xb913('0x2a')]},client9002);return _0x7d83d3;}return null;})['then'](respondWithResult(_0x48cba0,null))['catch'](handleError(_0x48cba0,null));};exports[_0xb913('0x2e')]=function(_0x22b05a,_0xc75a4f,_0x393151){if(_0x22b05a[_0xb913('0x57')]['id']){delete _0x22b05a[_0xb913('0x57')]['id'];}var _0x46a888;return db['WhatsappMessage'][_0xb913('0x56')]({'where':{'id':_0x22b05a[_0xb913('0x54')]['id']}})[_0xb913('0x21')](handleEntityNotFound(_0xc75a4f,null))[_0xb913('0x21')](function(_0x3652b3){if(_0x3652b3){_0x46a888=_0x3652b3;return db['WhatsappAccount'][_0xb913('0x56')]({'where':{'id':_0x3652b3[_0xb913('0x83')]}});}})[_0xb913('0x21')](handleEntityNotFound(_0xc75a4f,null))[_0xb913('0x21')](function(_0x4b476f){if(_0x4b476f){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xb913('0x2e'),'received\x20delivery\x20report\x20from',_0x4b476f[_0xb913('0x3d')],util[_0xb913('0x84')](_0x22b05a[_0xb913('0x57')],{'showHidden':![],'depth':null}));switch(_0x4b476f[_0xb913('0x3d')]){case'twilio':if(_0x22b05a['body'][_0xb913('0x85')]&&_0x22b05a[_0xb913('0x57')]['MessageSid']===_0x46a888[_0xb913('0x86')]&&_0x22b05a['body'][_0xb913('0x87')]&&_0x22b05a[_0xb913('0x57')][_0xb913('0x87')]===_0xb913('0x5a')){return _0x46a888[_0xb913('0x35')]({'read':!![]});}else{logger['error'](_0xb913('0x88'),_0xb913('0x2e'),_0xb913('0x89'),util[_0xb913('0x84')](_0x22b05a[_0xb913('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x46a888;}})[_0xb913('0x21')](respondWithResult(_0xc75a4f,null))[_0xb913('0x2b')](handleError(_0xc75a4f,null));}; \ No newline at end of file +var _0xaf5f=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','params','describe','whatsapp-interactions','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','reject','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','save','update','destroy','index','map','WhatsappMessage','rawAttributes','fieldName','key','name','query','keys','filters','model'];(function(_0x210731,_0x4b9861){var _0x58fbe5=function(_0x3738b6){while(--_0x3738b6){_0x210731['push'](_0x210731['shift']());}};_0x58fbe5(++_0x4b9861);}(_0xaf5f,0x1dd));var _0xfaf5=function(_0x3497f0,_0x1f371d){_0x3497f0=_0x3497f0-0x0;var _0x5bb32b=_0xaf5f[_0x3497f0];return _0x5bb32b;};'use strict';var emlformat=require(_0xfaf5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfaf5('0x1'));var jsonpatch=require(_0xfaf5('0x2'));var rp=require(_0xfaf5('0x3'));var moment=require('moment');var BPromise=require(_0xfaf5('0x4'));var Mustache=require(_0xfaf5('0x5'));var util=require(_0xfaf5('0x6'));var path=require('path');var sox=require(_0xfaf5('0x7'));var csv=require('to-csv');var ejs=require(_0xfaf5('0x8'));var fs=require('fs');var fs_extra=require(_0xfaf5('0x9'));var _=require(_0xfaf5('0xa'));var squel=require(_0xfaf5('0xb'));var crypto=require(_0xfaf5('0xc'));var jsforce=require(_0xfaf5('0xd'));var deskjs=require(_0xfaf5('0xe'));var toCsv=require(_0xfaf5('0xf'));var querystring=require('querystring');var Papa=require(_0xfaf5('0x10'));var Redis=require(_0xfaf5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfaf5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfaf5('0x13'));var logger=require(_0xfaf5('0x14'))('api');var utils=require(_0xfaf5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfaf5('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfaf5('0x17')](config[_0xfaf5('0x18')],{'host':_0xfaf5('0x19'),'port':0x18eb});var socket=require(_0xfaf5('0x1a'))(new Redis(config[_0xfaf5('0x18')]));require('./whatsappMessage.socket')[_0xfaf5('0x1b')](socket);var jayson=require(_0xfaf5('0x1c'));var client=jayson[_0xfaf5('0x1d')][_0xfaf5('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xfaf5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5ef94c,_0x1ab301,_0x481d99,_0x232c51){return new BPromise(function(_0x414471,_0x5c760b){var _0xe5ee2f=_0x232c51||client;return _0xe5ee2f[_0xfaf5('0x1f')](_0x5ef94c,_0x481d99)[_0xfaf5('0x20')](function(_0x458676){logger[_0xfaf5('0x21')](_0xfaf5('0x22'),_0x1ab301,_0xfaf5('0x23'));logger[_0xfaf5('0x24')](_0xfaf5('0x25'),_0x1ab301,_0xfaf5('0x23'),JSON[_0xfaf5('0x26')](_0x458676));if(_0x458676['error']){if(_0x458676['error']['code']===0x1f4){logger[_0xfaf5('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1ab301,_0x458676[_0xfaf5('0x27')][_0xfaf5('0x28')]);return _0x5c760b(_0x458676['error'][_0xfaf5('0x28')]);}logger['error'](_0xfaf5('0x22'),_0x1ab301,_0x458676['error'][_0xfaf5('0x28')]);return _0x414471(_0x458676[_0xfaf5('0x27')][_0xfaf5('0x28')]);}else{logger[_0xfaf5('0x21')](_0xfaf5('0x22'),_0x1ab301,'request\x20sent');_0x414471(_0x458676[_0xfaf5('0x29')][_0xfaf5('0x28')]);}})[_0xfaf5('0x2a')](function(_0x5b7640){logger[_0xfaf5('0x27')](_0xfaf5('0x22'),_0x1ab301,_0x5b7640);_0x5c760b(_0x5b7640);});});}function respondWithStatusCode(_0x2fb995,_0x54a206){_0x54a206=_0x54a206||0xcc;return function(_0x10a87d){if(_0x10a87d){return _0x2fb995[_0xfaf5('0x2b')](_0x54a206);}return _0x2fb995['status'](_0x54a206)[_0xfaf5('0x2c')]();};}function respondWithResult(_0x527117,_0x552bec){_0x552bec=_0x552bec||0xc8;return function(_0x3bf6db){if(_0x3bf6db){return _0x527117['status'](_0x552bec)[_0xfaf5('0x2d')](_0x3bf6db);}};}function respondWithFilteredResult(_0x39223b,_0x4e81a6){return function(_0x5bee6b){if(_0x5bee6b){var _0x8ae3b6=typeof _0x4e81a6[_0xfaf5('0x2e')]==='undefined'&&typeof _0x4e81a6[_0xfaf5('0x2f')]===_0xfaf5('0x30');var _0xa2233a=_0x5bee6b[_0xfaf5('0x31')];var _0x295998=_0x8ae3b6?0x0:_0x4e81a6[_0xfaf5('0x2e')];var _0x5c1809=_0x8ae3b6?_0x5bee6b['count']:_0x4e81a6[_0xfaf5('0x2e')]+_0x4e81a6[_0xfaf5('0x2f')];var _0x5ec68e;if(_0x5c1809>=_0xa2233a){_0x5c1809=_0xa2233a;_0x5ec68e=0xc8;}else{_0x5ec68e=0xce;}_0x39223b[_0xfaf5('0x32')](_0x5ec68e);return _0x39223b[_0xfaf5('0x33')]('Content-Range',_0x295998+'-'+_0x5c1809+'/'+_0xa2233a)[_0xfaf5('0x2d')](_0x5bee6b);}return null;};}function patchUpdates(_0x2bf3bb){return function(_0x4a6505){try{jsonpatch[_0xfaf5('0x34')](_0x4a6505,_0x2bf3bb,!![]);}catch(_0x27cb36){return BPromise['reject'](_0x27cb36);}return _0x4a6505[_0xfaf5('0x35')]();};}function saveUpdates(_0xe31b65,_0x37003a){return function(_0x381d0d){if(_0x381d0d){return _0x381d0d[_0xfaf5('0x36')](_0xe31b65)[_0xfaf5('0x20')](function(_0xd57783){return _0xd57783;});}return null;};}function removeEntity(_0x1ed2f5,_0x387b93){return function(_0x35d354){if(_0x35d354){return _0x35d354[_0xfaf5('0x37')]()[_0xfaf5('0x20')](function(){_0x1ed2f5[_0xfaf5('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bb146,_0x23669c){return function(_0x2358ca){if(!_0x2358ca){_0x3bb146[_0xfaf5('0x2b')](0x194);}return _0x2358ca;};}function handleError(_0x3c07e7,_0x2f593e){_0x2f593e=_0x2f593e||0x1f4;return function(_0x1c1546){logger[_0xfaf5('0x27')](_0x1c1546['stack']);if(_0x1c1546['name']){delete _0x1c1546['name'];}_0x3c07e7[_0xfaf5('0x32')](_0x2f593e)['send'](_0x1c1546);};}exports[_0xfaf5('0x38')]=function(_0x65fb9d,_0x1bb3dd){var _0x1da7b2={},_0x5477ae={},_0x2c93b0={'count':0x0,'rows':[]};var _0x4ad15b=_[_0xfaf5('0x39')](db[_0xfaf5('0x3a')][_0xfaf5('0x3b')],function(_0xa4f545){return{'name':_0xa4f545[_0xfaf5('0x3c')],'type':_0xa4f545['type'][_0xfaf5('0x3d')]};});_0x5477ae['model']=_[_0xfaf5('0x39')](_0x4ad15b,_0xfaf5('0x3e'));_0x5477ae[_0xfaf5('0x3f')]=_[_0xfaf5('0x40')](_0x65fb9d[_0xfaf5('0x3f')]);_0x5477ae[_0xfaf5('0x41')]=_['intersection'](_0x5477ae[_0xfaf5('0x42')],_0x5477ae[_0xfaf5('0x3f')]);_0x1da7b2[_0xfaf5('0x43')]=_[_0xfaf5('0x44')](_0x5477ae['model'],qs['fields'](_0x65fb9d['query'][_0xfaf5('0x45')]));_0x1da7b2[_0xfaf5('0x43')]=_0x1da7b2[_0xfaf5('0x43')][_0xfaf5('0x46')]?_0x1da7b2[_0xfaf5('0x43')]:_0x5477ae[_0xfaf5('0x42')];if(!_0x65fb9d[_0xfaf5('0x3f')][_0xfaf5('0x47')](_0xfaf5('0x48'))){_0x1da7b2[_0xfaf5('0x2f')]=qs[_0xfaf5('0x2f')](_0x65fb9d['query']['limit']);_0x1da7b2['offset']=qs[_0xfaf5('0x2e')](_0x65fb9d[_0xfaf5('0x3f')]['offset']);}_0x1da7b2['order']=qs['sort'](_0x65fb9d[_0xfaf5('0x3f')][_0xfaf5('0x49')]);_0x1da7b2[_0xfaf5('0x4a')]=qs['filters'](_['pick'](_0x65fb9d[_0xfaf5('0x3f')],_0x5477ae[_0xfaf5('0x41')]),_0x4ad15b);if(_0x65fb9d[_0xfaf5('0x3f')]['filter']){_0x1da7b2[_0xfaf5('0x4a')]=_[_0xfaf5('0x4b')](_0x1da7b2['where'],{'$or':_[_0xfaf5('0x39')](_0x4ad15b,function(_0x24f23e){if(_0x24f23e['type']!==_0xfaf5('0x4c')){var _0x24161f={};_0x24161f[_0x24f23e[_0xfaf5('0x3e')]]={'$like':'%'+_0x65fb9d[_0xfaf5('0x3f')]['filter']+'%'};return _0x24161f;}})});}_0x1da7b2=_['merge']({},_0x1da7b2,_0x65fb9d[_0xfaf5('0x4d')]);var _0xe17de0={'where':_0x1da7b2[_0xfaf5('0x4a')]};return db[_0xfaf5('0x3a')][_0xfaf5('0x31')](_0xe17de0)[_0xfaf5('0x20')](function(_0x2f38fa){_0x2c93b0[_0xfaf5('0x31')]=_0x2f38fa;if(_0x65fb9d[_0xfaf5('0x3f')][_0xfaf5('0x4e')]){_0x1da7b2[_0xfaf5('0x4f')]=[{'all':!![]}];}return db[_0xfaf5('0x3a')][_0xfaf5('0x50')](_0x1da7b2);})[_0xfaf5('0x20')](function(_0x35e154){_0x2c93b0['rows']=_0x35e154;return _0x2c93b0;})[_0xfaf5('0x20')](respondWithFilteredResult(_0x1bb3dd,_0x1da7b2))[_0xfaf5('0x2a')](handleError(_0x1bb3dd,null));};exports[_0xfaf5('0x51')]=function(_0x26647b,_0x8e83b4){var _0x1cdd22={'raw':!![],'where':{'id':_0x26647b['params']['id']}},_0xa120f1={};_0xa120f1[_0xfaf5('0x42')]=_['keys'](db[_0xfaf5('0x3a')][_0xfaf5('0x3b')]);_0xa120f1[_0xfaf5('0x3f')]=_['keys'](_0x26647b[_0xfaf5('0x3f')]);_0xa120f1[_0xfaf5('0x41')]=_[_0xfaf5('0x44')](_0xa120f1[_0xfaf5('0x42')],_0xa120f1['query']);_0x1cdd22[_0xfaf5('0x43')]=_[_0xfaf5('0x44')](_0xa120f1[_0xfaf5('0x42')],qs['fields'](_0x26647b['query'][_0xfaf5('0x45')]));_0x1cdd22[_0xfaf5('0x43')]=_0x1cdd22[_0xfaf5('0x43')][_0xfaf5('0x46')]?_0x1cdd22[_0xfaf5('0x43')]:_0xa120f1[_0xfaf5('0x42')];if(_0x26647b[_0xfaf5('0x3f')][_0xfaf5('0x4e')]){_0x1cdd22[_0xfaf5('0x4f')]=[{'all':!![]}];}_0x1cdd22=_[_0xfaf5('0x4b')]({},_0x1cdd22,_0x26647b[_0xfaf5('0x4d')]);return db[_0xfaf5('0x3a')][_0xfaf5('0x52')](_0x1cdd22)[_0xfaf5('0x20')](handleEntityNotFound(_0x8e83b4,null))[_0xfaf5('0x20')](respondWithResult(_0x8e83b4,null))[_0xfaf5('0x2a')](handleError(_0x8e83b4,null));};exports[_0xfaf5('0x53')]=function(_0x1d5e0d,_0x5ce317){return db[_0xfaf5('0x3a')][_0xfaf5('0x53')](_0x1d5e0d[_0xfaf5('0x54')],{})[_0xfaf5('0x20')](respondWithResult(_0x5ce317,0xc9))['catch'](handleError(_0x5ce317,null));};exports[_0xfaf5('0x36')]=function(_0x116e3e,_0x1d7224){if(_0x116e3e[_0xfaf5('0x54')]['id']){delete _0x116e3e[_0xfaf5('0x54')]['id'];}return db[_0xfaf5('0x3a')][_0xfaf5('0x52')]({'where':{'id':_0x116e3e[_0xfaf5('0x55')]['id']}})[_0xfaf5('0x20')](handleEntityNotFound(_0x1d7224,null))['then'](saveUpdates(_0x116e3e['body'],null))[_0xfaf5('0x20')](respondWithResult(_0x1d7224,null))[_0xfaf5('0x2a')](handleError(_0x1d7224,null));};exports[_0xfaf5('0x37')]=function(_0xa67030,_0x57561d){return db[_0xfaf5('0x3a')][_0xfaf5('0x52')]({'where':{'id':_0xa67030['params']['id']}})[_0xfaf5('0x20')](handleEntityNotFound(_0x57561d,null))['then'](removeEntity(_0x57561d,null))[_0xfaf5('0x2a')](handleError(_0x57561d,null));};exports[_0xfaf5('0x56')]=function(_0x33fa8f,_0x15fff3){return db[_0xfaf5('0x3a')][_0xfaf5('0x56')]()[_0xfaf5('0x20')](respondWithResult(_0x15fff3,null))[_0xfaf5('0x2a')](handleError(_0x15fff3,null));};var interaction_log=require(_0xfaf5('0x14'))(_0xfaf5('0x57'));exports['accept']=function(_0x224663,_0x5e172a,_0x27d71f){var _0x2f20a9={'agent':{},'channel':'whatsapp'};if(_0x224663[_0xfaf5('0x54')]['id']){delete _0x224663['body']['id'];}_0x224663[_0xfaf5('0x54')]['read']=!![];_0x224663[_0xfaf5('0x54')]['readAt']=moment()[_0xfaf5('0x58')](_0xfaf5('0x59'));_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')]=_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')]||_0x224663[_0xfaf5('0x5b')]['id'];_0x2f20a9[_0xfaf5('0x5c')]['id']=_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')];return db['WhatsappMessage'][_0xfaf5('0x52')]({'where':{'id':_0x224663[_0xfaf5('0x55')]['id'],'UserId':null}})[_0xfaf5('0x20')](handleEntityNotFound(_0x5e172a,null))[_0xfaf5('0x20')](saveUpdates(_0x224663[_0xfaf5('0x54')],null))['then'](function(_0x49ba40){if(_0x49ba40){_0x2f20a9[_0xfaf5('0x28')]=_0x49ba40[_0xfaf5('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0xfaf5('0x52')]({'where':{'id':_0x49ba40[_0xfaf5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5e172a,null))[_0xfaf5('0x20')](function(_0x5a9aa6){if(_0x5a9aa6){return _0x5a9aa6['update']({'UserId':_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')],'read1stAt':_[_0xfaf5('0x5f')](_0x5a9aa6[_0xfaf5('0x60')])?moment()['format'](_0xfaf5('0x59')):undefined});}return null;})[_0xfaf5('0x20')](function(_0x56e660){if(_0x56e660){_0x2f20a9['interaction']=_0x56e660['get']({'plain':!![]});interaction_log[_0xfaf5('0x21')](_0xfaf5('0x61'),_0x224663[_0xfaf5('0x5b')]['id'],_0x224663[_0xfaf5('0x5b')][_0xfaf5('0x3e')],_0x224663[_0xfaf5('0x5b')][_0xfaf5('0x62')],_0x2f20a9['interaction']['id'],_0x224663[_0xfaf5('0x54')]?JSON['stringify'](_0x224663['body']):_0xfaf5('0x63'));return respondWithRpcPromise(_0xfaf5('0x64'),'acceptMessage',_0x2f20a9);}return null;})['then'](function(_0x3560ae){var _0x5a0503=_0xfaf5('0x65')+_0x3560ae[_0xfaf5('0x28')]['ContactId'];return db[_0xfaf5('0x66')][_0xfaf5('0x3f')](_0x5a0503,{'type':db['Sequelize'][_0xfaf5('0x67')]['SELECT'],'raw':!![]})[_0xfaf5('0x20')](function(_0x2f58aa){return _0x2f58aa;});})['then'](function(_0x3bf826){if(_0x3bf826){_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x68')]=_0x3bf826[0x0];if(!_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')])return;return db[_0xfaf5('0x69')]['find']({'where':{'id':_0x224663[_0xfaf5('0x54')][_0xfaf5('0x5a')],'role':_0xfaf5('0x5c')},'attributes':['id',_0xfaf5('0x3e'),_0xfaf5('0x6a'),'email',_0xfaf5('0x6b')],'raw':!![]});}return null;})[_0xfaf5('0x20')](function(_0x24ff6c){if(!_0x24ff6c)return null;_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x5c')]=_0x24ff6c;return _0x2f20a9;})[_0xfaf5('0x20')](function(_0x50c381){if(_0x50c381){if(_0x224663[_0xfaf5('0x54')]['manual']){_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x6c')]=util[_0xfaf5('0x58')](_0xfaf5('0x6d'),_0x224663['user'][_0xfaf5('0x3e')]);_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x6e')]=_0x2f20a9[_0xfaf5('0x6e')];_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x6f')]=_0x2f20a9['channel'];_0x2f20a9[_0xfaf5('0x28')][_0xfaf5('0x70')]=_0xfaf5('0x71');return respondWithRpcPromise(_0xfaf5('0x72'),_0xfaf5('0x72'),{'event':_0xfaf5('0x73'),'message':_0x2f20a9[_0xfaf5('0x28')]},client9002)['then'](function(){return _0x2f20a9;});}return _0x2f20a9;}return null;})['then'](respondWithResult(_0x5e172a,null))[_0xfaf5('0x2a')](handleError(_0x5e172a,null));};var interaction_log=require(_0xfaf5('0x14'))(_0xfaf5('0x57'));exports['reject']=function(_0x30dc2c,_0x1ff898,_0x1c681f){var _0x5ad5ee={'agent':{},'channel':_0xfaf5('0x74')};if(_0x30dc2c[_0xfaf5('0x54')]['id']){delete _0x30dc2c['body']['id'];}_0x30dc2c[_0xfaf5('0x54')][_0xfaf5('0x5a')]=_0x30dc2c[_0xfaf5('0x54')][_0xfaf5('0x5a')]||_0x30dc2c[_0xfaf5('0x5b')]['id'];_0x5ad5ee[_0xfaf5('0x5c')]['id']=_0x30dc2c[_0xfaf5('0x54')][_0xfaf5('0x5a')];return db[_0xfaf5('0x3a')][_0xfaf5('0x52')]({'where':{'id':_0x30dc2c['params']['id'],'UserId':null}})[_0xfaf5('0x20')](handleEntityNotFound(_0x1ff898,null))['then'](function(_0x5d46ca){if(_0x5d46ca){_0x5ad5ee[_0xfaf5('0x28')]=_0x5d46ca[_0xfaf5('0x5d')]({'plain':!![]});return db[_0xfaf5('0x75')][_0xfaf5('0x52')]({'where':{'id':_0x5d46ca[_0xfaf5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x1ff898,null))['then'](function(_0x3a090f){if(_0x3a090f){_0x5ad5ee[_0xfaf5('0x76')]=_0x3a090f[_0xfaf5('0x5d')]({'plain':!![]});interaction_log[_0xfaf5('0x21')](_0xfaf5('0x77'),_0x30dc2c[_0xfaf5('0x5b')]['id'],_0x30dc2c[_0xfaf5('0x5b')][_0xfaf5('0x3e')],_0x30dc2c['user']['role'],_0x5ad5ee['interaction']['id'],_0x30dc2c[_0xfaf5('0x54')]?JSON[_0xfaf5('0x26')](_0x30dc2c['body']):'null');return respondWithRpcPromise(_0xfaf5('0x78'),_0xfaf5('0x79'),_0x5ad5ee);}return null;})[_0xfaf5('0x20')](function(_0x2d1a26){var _0x2c1dd1=_0xfaf5('0x65')+_0x2d1a26['message'][_0xfaf5('0x7a')];return db[_0xfaf5('0x66')][_0xfaf5('0x3f')](_0x2c1dd1,{'type':db[_0xfaf5('0x7b')][_0xfaf5('0x67')][_0xfaf5('0x7c')],'raw':!![]})[_0xfaf5('0x20')](function(_0x59e07d){return _0x59e07d;});})[_0xfaf5('0x20')](function(_0x512f8e){if(_0x512f8e){_0x5ad5ee[_0xfaf5('0x28')][_0xfaf5('0x68')]=_0x512f8e[0x0];if(!_0x30dc2c[_0xfaf5('0x54')][_0xfaf5('0x5a')])return;return db['User'][_0xfaf5('0x52')]({'where':{'id':_0x30dc2c['body'][_0xfaf5('0x5a')],'role':_0xfaf5('0x5c')},'attributes':['id',_0xfaf5('0x3e'),_0xfaf5('0x6a'),'email',_0xfaf5('0x6b')],'raw':!![]});}return null;})[_0xfaf5('0x20')](function(_0x37bfa8){if(!_0x37bfa8)return null;_0x5ad5ee[_0xfaf5('0x28')][_0xfaf5('0x5c')]=_0x37bfa8;return _0x5ad5ee;})['then'](function(_0x16cb93){if(_0x16cb93){_0x16cb93['message'][_0xfaf5('0x6c')]=util[_0xfaf5('0x58')](_0xfaf5('0x6d'),_0x30dc2c[_0xfaf5('0x5b')]['name']);_0x16cb93['message'][_0xfaf5('0x6e')]=_0x5ad5ee['channel'];_0x16cb93[_0xfaf5('0x28')][_0xfaf5('0x6f')]=_0x5ad5ee['channel'];_0x16cb93[_0xfaf5('0x28')]['event']=_0xfaf5('0x7d');respondWithRpcPromise('EventManager',_0xfaf5('0x72'),{'event':'rejectmessage','message':_0x16cb93['message']},client9002);return _0x5ad5ee;}return null;})[_0xfaf5('0x20')](respondWithResult(_0x1ff898,null))[_0xfaf5('0x2a')](handleError(_0x1ff898,null));};exports[_0xfaf5('0x32')]=function(_0xa19fc6,_0xa4e62,_0x1a5c24){if(_0xa19fc6[_0xfaf5('0x54')]['id']){delete _0xa19fc6[_0xfaf5('0x54')]['id'];}var _0xd9a7bf;return db[_0xfaf5('0x3a')][_0xfaf5('0x52')]({'where':{'id':_0xa19fc6[_0xfaf5('0x55')]['id']}})[_0xfaf5('0x20')](handleEntityNotFound(_0xa4e62,null))[_0xfaf5('0x20')](function(_0x5856c3){if(_0x5856c3){_0xd9a7bf=_0x5856c3;return db['WhatsappAccount'][_0xfaf5('0x52')]({'where':{'id':_0x5856c3[_0xfaf5('0x7e')]}});}})['then'](handleEntityNotFound(_0xa4e62,null))[_0xfaf5('0x20')](function(_0x13926d){if(_0x13926d){logger[_0xfaf5('0x24')](_0xfaf5('0x7f'),'status',_0xfaf5('0x80'),_0x13926d[_0xfaf5('0x81')],util['inspect'](_0xa19fc6[_0xfaf5('0x54')],{'showHidden':![],'depth':null}));switch(_0x13926d[_0xfaf5('0x81')]){case'twilio':if(_0xa19fc6[_0xfaf5('0x54')][_0xfaf5('0x82')]&&_0xa19fc6[_0xfaf5('0x54')][_0xfaf5('0x82')]===_0xd9a7bf['messageId']&&_0xa19fc6[_0xfaf5('0x54')][_0xfaf5('0x83')]&&_0xa19fc6['body'][_0xfaf5('0x83')]===_0xfaf5('0x84')){return _0xd9a7bf[_0xfaf5('0x36')]({'read':!![]});}else{logger[_0xfaf5('0x27')](_0xfaf5('0x85'),_0xfaf5('0x32'),_0xfaf5('0x86'),util[_0xfaf5('0x87')](_0xa19fc6[_0xfaf5('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xd9a7bf;}})[_0xfaf5('0x20')](respondWithResult(_0xa4e62,null))[_0xfaf5('0x2a')](handleError(_0xa4e62,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c59dfb6..e05bb34 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){WhatsappMessageEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);WhatsappMessageEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];WhatsappMessage[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x373d=['update','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x107bd0,_0x24cd45){var _0x5d8a64=function(_0x2c3173){while(--_0x2c3173){_0x107bd0['push'](_0x107bd0['shift']());}};_0x5d8a64(++_0x24cd45);}(_0x373d,0x1e2));var _0xd373=function(_0x442cac,_0x5748b3){_0x442cac=_0x442cac-0x0;var _0xd96f05=_0x373d[_0x442cac];return _0xd96f05;};'use strict';var EventEmitter=require(_0xd373('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd373('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd373('0x2')](0x0);var events={'afterCreate':_0xd373('0x3'),'afterUpdate':_0xd373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x151fe9){return function(_0x547fca,_0x2b6e64,_0x598692){WhatsappMessageEvents['emit'](_0x151fe9+':'+_0x547fca['id'],_0x547fca);WhatsappMessageEvents[_0xd373('0x5')](_0x151fe9,_0x547fca);_0x598692(null);};}for(var e in events){if(events[_0xd373('0x6')](e)){var event=events[e];WhatsappMessage[_0xd373('0x7')](e,emitEvent(event));}}module[_0xd373('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c655593..333d8cc 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 _0x9787=['out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','create','body','whatsapp:','remote','/api/whatsapp/messages/','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4e44db,_0x200c73){var _0x4a614f=function(_0x507b26){while(--_0x507b26){_0x4e44db['push'](_0x4e44db['shift']());}};_0x4a614f(++_0x200c73);}(_0x9787,0x122));var _0x7978=function(_0x3c3039,_0xd0a1dc){_0x3c3039=_0x3c3039-0x0;var _0xc9710d=_0x9787[_0x3c3039];return _0xc9710d;};'use strict';var _=require(_0x7978('0x0'));var util=require(_0x7978('0x1'));var logger=require(_0x7978('0x2'))(_0x7978('0x3'));var moment=require('moment');var BPromise=require(_0x7978('0x4'));var rp=require(_0x7978('0x5'));var fetch=require(_0x7978('0x6'));var fs=require('fs');var path=require(_0x7978('0x7'));var rimraf=require('rimraf');var config=require(_0x7978('0x8'));var attributes=require(_0x7978('0x9'));module['exports']=function(_0x46f605,_0x3b2c26){return _0x46f605[_0x7978('0xa')](_0x7978('0xb'),attributes,{'tableName':_0x7978('0xc'),'paranoid':![],'indexes':[{'name':_0x7978('0xd'),'fields':[_0x7978('0xd')]},{'name':_0x7978('0xe'),'fields':['body'],'type':_0x7978('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58dd02,_0x50d0fc,_0x10b887){var _0x2d91ab=_0x46f605[_0x7978('0x10')];var _0x4f2a19=_0x58dd02[_0x7978('0x11')]({'plain':!![]});if(_0x4f2a19[_0x7978('0x12')]['toLowerCase']()==='in'||_0x4f2a19['direction'][_0x7978('0x13')]()===_0x7978('0x14')&&!_0x4f2a19[_0x7978('0x15')]&&!_[_0x7978('0x16')](_0x4f2a19[_0x7978('0x17')])){_0x2d91ab[_0x7978('0x18')][_0x7978('0x19')]({'where':{'id':_0x4f2a19[_0x7978('0x1a')]}})['then'](function(_0x37255a){if(_0x37255a){_0x37255a[_0x7978('0x1b')]({'lastMsgAt':_0x4f2a19[_0x7978('0x1c')],'lastMsgDirection':_0x4f2a19[_0x7978('0x12')][_0x7978('0x13')]()});}})[_0x7978('0x1d')](function(_0x3235b9){console['error'](_0x3235b9);});}if(_0x4f2a19[_0x7978('0x12')]===_0x7978('0x14')&&!_0x4f2a19[_0x7978('0x15')]){var _0x19b315;_0x2d91ab[_0x7978('0x1e')][_0x7978('0x1f')]({'where':{'id':_0x4f2a19[_0x7978('0x20')]},'raw':!![]})[_0x7978('0x21')](function(_0x2ecdf3){_0x19b315=_0x2ecdf3;if(_0x19b315&&_0x19b315[_0x7978('0x22')]){switch(_0x19b315[_0x7978('0x22')]){case _0x7978('0x23'):var _0x3459cd=require(_0x7978('0x23'));if(_0x19b315['accountSid']&&_0x19b315[_0x7978('0x24')]&&_0x19b315[_0x7978('0x25')]){var _0xd59243=new _0x3459cd(_0x19b315[_0x7978('0x26')],_0x19b315['authToken']);_0xd59243['messages'][_0x7978('0x27')]({'body':_0x4f2a19[_0x7978('0x28')],'to':_0x7978('0x29')+_0x4f2a19[_0x7978('0x25')],'from':_0x7978('0x29')+_0x19b315['phone'],'statusCallback':_0x19b315[_0x7978('0x2a')]+_0x7978('0x2b')+_0x4f2a19['id']+'/status?token='+_0x19b315['token']})[_0x7978('0x21')](function(_0xa15677){if(_0xa15677[_0x7978('0x2c')]){return _0x58dd02[_0x7978('0x1b')]({'messageId':_0xa15677[_0x7978('0x2c')]});}})[_0x7978('0x1d')](function(_0x1b6b6a){logger[_0x7978('0x2d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7978('0x2e'),_0x7978('0x23'),util[_0x7978('0x2f')](_0x1b6b6a,{'showHidden':![],'depth':null}));});}else{logger[_0x7978('0x2d')](_0x7978('0x30'),_0x7978('0x2e'),_0x7978('0x23'),_0x7978('0x31'));}break;case _0x7978('0x32'):var _0x4bdc06=_0x19b315[_0x7978('0x26')];var _0x1692a3=_0x19b315[_0x7978('0x24')];var _0x3b3c38=_0x19b315[_0x7978('0x33')]+_0x7978('0x34')+_0x4bdc06+_0x7978('0x35');var _0xd7cdd0={'to':[_0x4f2a19[_0x7978('0x25')]],'message':{'type':_0x7978('0x36'),'text':_0x4f2a19[_0x7978('0x28')]}};var _0x2c8416={'method':'POST','uri':_0x3b3c38,'headers':{'Authorization':_0x7978('0x37')+_0x1692a3,'Content-Type':_0x7978('0x38')},'body':_0xd7cdd0,'json':!![]};rp(_0x2c8416)[_0x7978('0x21')](function(_0x23fa03){if(_0x23fa03[_0x7978('0x39')][0x0]['message_id']){return _0x58dd02[_0x7978('0x1b')]({'messageId':_0x23fa03[_0x7978('0x39')][0x0]['message_id']});}})[_0x7978('0x1d')](function(_0x4c3321){logger[_0x7978('0x3a')](_0x7978('0x3b'),_0x4c3321);});break;}}})['finally'](function(){_0x10b887();});}else{_0x10b887();}}},'charset':_0x7978('0x3c'),'collate':_0x7978('0x3d')});}; \ No newline at end of file +var _0xf3d0=['sinch','baseUrl','/messages/','text','POST','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','find','WhatsappAccountId','type','twilio','phone','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x12b399,_0x38f379){var _0x4ea90f=function(_0x10be05){while(--_0x10be05){_0x12b399['push'](_0x12b399['shift']());}};_0x4ea90f(++_0x38f379);}(_0xf3d0,0x1bf));var _0x0f3d=function(_0x3600b0,_0x2ba868){_0x3600b0=_0x3600b0-0x0;var _0x3d7899=_0xf3d0[_0x3600b0];return _0x3d7899;};'use strict';var _=require(_0x0f3d('0x0'));var util=require('util');var logger=require(_0x0f3d('0x1'))(_0x0f3d('0x2'));var moment=require(_0x0f3d('0x3'));var BPromise=require(_0x0f3d('0x4'));var rp=require(_0x0f3d('0x5'));var fetch=require(_0x0f3d('0x6'));var fs=require('fs');var path=require(_0x0f3d('0x7'));var rimraf=require(_0x0f3d('0x8'));var config=require(_0x0f3d('0x9'));var attributes=require(_0x0f3d('0xa'));module[_0x0f3d('0xb')]=function(_0x26f57d,_0x55b185){return _0x26f57d[_0x0f3d('0xc')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x0f3d('0xd'),'fields':[_0x0f3d('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x0f3d('0xe')],'type':_0x0f3d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x919422,_0x32ccfb,_0x1b15d4){var _0x3e199c=_0x26f57d['models'];var _0x12a9c1=_0x919422[_0x0f3d('0x10')]({'plain':!![]});if(_0x12a9c1[_0x0f3d('0x11')]['toLowerCase']()==='in'||_0x12a9c1[_0x0f3d('0x11')][_0x0f3d('0x12')]()===_0x0f3d('0x13')&&!_0x12a9c1[_0x0f3d('0x14')]&&!_[_0x0f3d('0x15')](_0x12a9c1['UserId'])){_0x3e199c[_0x0f3d('0x16')][_0x0f3d('0x17')]({'where':{'id':_0x12a9c1[_0x0f3d('0x18')]}})[_0x0f3d('0x19')](function(_0x4c0bec){if(_0x4c0bec){_0x4c0bec[_0x0f3d('0x1a')]({'lastMsgAt':_0x12a9c1[_0x0f3d('0x1b')],'lastMsgDirection':_0x12a9c1[_0x0f3d('0x11')][_0x0f3d('0x12')]()});}})[_0x0f3d('0x1c')](function(_0x26ebcc){console[_0x0f3d('0x1d')](_0x26ebcc);});}if(_0x12a9c1[_0x0f3d('0x11')]===_0x0f3d('0x13')&&!_0x12a9c1[_0x0f3d('0x14')]){var _0x42457f;_0x3e199c['WhatsappAccount'][_0x0f3d('0x1e')]({'where':{'id':_0x12a9c1[_0x0f3d('0x1f')]},'raw':!![]})[_0x0f3d('0x19')](function(_0x34ac81){_0x42457f=_0x34ac81;if(_0x42457f&&_0x42457f[_0x0f3d('0x20')]){switch(_0x42457f[_0x0f3d('0x20')]){case _0x0f3d('0x21'):var _0x391d90=require('twilio');if(_0x42457f['accountSid']&&_0x42457f['authToken']&&_0x42457f[_0x0f3d('0x22')]){var _0x39cd7a=new _0x391d90(_0x42457f[_0x0f3d('0x23')],_0x42457f[_0x0f3d('0x24')]);_0x39cd7a[_0x0f3d('0x25')][_0x0f3d('0x26')]({'body':_0x12a9c1[_0x0f3d('0xe')],'to':_0x0f3d('0x27')+_0x12a9c1['phone'],'from':'whatsapp:'+_0x42457f[_0x0f3d('0x22')],'statusCallback':_0x42457f[_0x0f3d('0x28')]+_0x0f3d('0x29')+_0x12a9c1['id']+_0x0f3d('0x2a')+_0x42457f[_0x0f3d('0x2b')]})[_0x0f3d('0x19')](function(_0x91879a){if(_0x91879a[_0x0f3d('0x2c')]){return _0x919422[_0x0f3d('0x1a')]({'messageId':_0x91879a[_0x0f3d('0x2c')]});}})[_0x0f3d('0x1c')](function(_0x560a78){logger[_0x0f3d('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0f3d('0x2d'),'twilio',util[_0x0f3d('0x2e')](_0x560a78,{'showHidden':![],'depth':null}));});}else{logger[_0x0f3d('0x1d')](_0x0f3d('0x2f'),_0x0f3d('0x2d'),_0x0f3d('0x21'),_0x0f3d('0x30'));}break;case _0x0f3d('0x31'):var _0x1c2bc2=_0x42457f[_0x0f3d('0x23')];var _0x29ff14=_0x42457f[_0x0f3d('0x24')];var _0x4c46fa=_0x42457f[_0x0f3d('0x32')]+'/whatsapp/v1/'+_0x1c2bc2+_0x0f3d('0x33');var _0x5f403c={'to':[_0x12a9c1[_0x0f3d('0x22')]],'message':{'type':_0x0f3d('0x34'),'text':_0x12a9c1[_0x0f3d('0xe')]}};var _0x5a3101={'method':_0x0f3d('0x35'),'uri':_0x4c46fa,'headers':{'Authorization':'Bearer\x20'+_0x29ff14,'Content-Type':_0x0f3d('0x36')},'body':_0x5f403c,'json':!![]};rp(_0x5a3101)[_0x0f3d('0x19')](function(_0x1aea74){if(_0x1aea74['statuses'][0x0][_0x0f3d('0x37')]){return _0x919422[_0x0f3d('0x1a')]({'messageId':_0x1aea74[_0x0f3d('0x38')][0x0][_0x0f3d('0x37')]});}})['catch'](function(_0x38ec3e){logger[_0x0f3d('0x39')](_0x0f3d('0x3a'),_0x38ec3e);});break;}}})[_0x0f3d('0x3b')](function(){_0x1b15d4();});}else{_0x1b15d4();}}},'charset':_0x0f3d('0x3c'),'collate':_0x0f3d('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b035958..1b1cee2 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 _0x4e48=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappMessage.socket','register'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0x4e48,0x1ed));var _0x84e4=function(_0x4d5058,_0x404e7c){_0x4d5058=_0x4d5058-0x0;var _0x43006a=_0x4e48[_0x4d5058];return _0x43006a;};'use strict';var _=require(_0x84e4('0x0'));var util=require(_0x84e4('0x1'));var moment=require(_0x84e4('0x2'));var BPromise=require(_0x84e4('0x3'));var rs=require(_0x84e4('0x4'));var fs=require('fs');var Redis=require(_0x84e4('0x5'));var db=require(_0x84e4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84e4('0x7'))(_0x84e4('0x8'));var config=require(_0x84e4('0x9'));var jayson=require(_0x84e4('0xa'));var client=jayson[_0x84e4('0xb')]['http']({'port':0x232a});config[_0x84e4('0xc')]=_[_0x84e4('0xd')](config[_0x84e4('0xc')],{'host':_0x84e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84e4('0xc')]));require(_0x84e4('0xf'))[_0x84e4('0x10')](socket);function respondWithRpcPromise(_0xa6cd7,_0x33d33a,_0x3eb3af){return new BPromise(function(_0x36ea52,_0x2f985f){return client[_0x84e4('0x11')](_0xa6cd7,_0x3eb3af)[_0x84e4('0x12')](function(_0x184cdf){logger[_0x84e4('0x13')](_0x84e4('0x14'),_0x33d33a,_0x84e4('0x15'));logger['debug'](_0x84e4('0x16'),_0x33d33a,_0x84e4('0x15'),JSON['stringify'](_0x184cdf));if(_0x184cdf[_0x84e4('0x17')]){if(_0x184cdf[_0x84e4('0x17')]['code']===0x1f4){logger[_0x84e4('0x17')](_0x84e4('0x14'),_0x33d33a,_0x184cdf['error']['message']);return _0x2f985f(_0x184cdf['error']['message']);}logger[_0x84e4('0x17')](_0x84e4('0x14'),_0x33d33a,_0x184cdf[_0x84e4('0x17')][_0x84e4('0x18')]);return _0x36ea52(_0x184cdf[_0x84e4('0x17')][_0x84e4('0x18')]);}else{logger[_0x84e4('0x13')](_0x84e4('0x14'),_0x33d33a,_0x84e4('0x15'));_0x36ea52(_0x184cdf[_0x84e4('0x19')]['message']);}})[_0x84e4('0x1a')](function(_0x4313c1){logger[_0x84e4('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x33d33a,_0x4313c1);_0x2f985f(_0x4313c1);});});}exports[_0x84e4('0x1b')]=function(_0x13704a){var _0x355527=this;return new Promise(function(_0x41c3c4,_0x15e2a8){return db[_0x84e4('0x1c')][_0x84e4('0x1d')](_0x13704a['body'],{'raw':_0x13704a[_0x84e4('0x1e')]?_0x13704a['options'][_0x84e4('0x1f')]===undefined?!![]:![]:!![]})[_0x84e4('0x12')](function(_0x2a8184){logger[_0x84e4('0x13')]('CreateWhatsappMessage',_0x13704a);logger[_0x84e4('0x20')](_0x84e4('0x1b'),_0x13704a,JSON[_0x84e4('0x21')](_0x2a8184));_0x41c3c4(_0x2a8184);})[_0x84e4('0x1a')](function(_0x4a78db){logger['error'](_0x84e4('0x1b'),_0x4a78db[_0x84e4('0x18')],_0x13704a);_0x15e2a8(_0x355527[_0x84e4('0x17')](0x1f4,_0x4a78db[_0x84e4('0x18')]));});});}; \ No newline at end of file +var _0x8321=['body','options','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x4ba17c,_0x310611){var _0xfcd88d=function(_0x431148){while(--_0x431148){_0x4ba17c['push'](_0x4ba17c['shift']());}};_0xfcd88d(++_0x310611);}(_0x8321,0x12f));var _0x1832=function(_0x597305,_0x1edd45){_0x597305=_0x597305-0x0;var _0x4239d1=_0x8321[_0x597305];return _0x4239d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1832('0x0'));var BPromise=require('bluebird');var rs=require(_0x1832('0x1'));var fs=require('fs');var Redis=require(_0x1832('0x2'));var db=require(_0x1832('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1832('0x4'))(_0x1832('0x5'));var config=require('../../config/environment');var jayson=require(_0x1832('0x6'));var client=jayson['client'][_0x1832('0x7')]({'port':0x232a});config[_0x1832('0x8')]=_[_0x1832('0x9')](config['redis'],{'host':_0x1832('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1832('0x8')]));require(_0x1832('0xb'))[_0x1832('0xc')](socket);function respondWithRpcPromise(_0x237102,_0x1f3cc5,_0x29d88d){return new BPromise(function(_0x5afea7,_0x384ef4){return client[_0x1832('0xd')](_0x237102,_0x29d88d)[_0x1832('0xe')](function(_0x2d0a3e){logger[_0x1832('0xf')](_0x1832('0x10'),_0x1f3cc5,_0x1832('0x11'));logger[_0x1832('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f3cc5,'request\x20sent',JSON[_0x1832('0x13')](_0x2d0a3e));if(_0x2d0a3e['error']){if(_0x2d0a3e[_0x1832('0x14')][_0x1832('0x15')]===0x1f4){logger[_0x1832('0x14')](_0x1832('0x10'),_0x1f3cc5,_0x2d0a3e[_0x1832('0x14')][_0x1832('0x16')]);return _0x384ef4(_0x2d0a3e[_0x1832('0x14')][_0x1832('0x16')]);}logger[_0x1832('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1f3cc5,_0x2d0a3e[_0x1832('0x14')]['message']);return _0x5afea7(_0x2d0a3e[_0x1832('0x14')][_0x1832('0x16')]);}else{logger[_0x1832('0xf')](_0x1832('0x10'),_0x1f3cc5,'request\x20sent');_0x5afea7(_0x2d0a3e[_0x1832('0x17')][_0x1832('0x16')]);}})['catch'](function(_0x3154c4){logger[_0x1832('0x14')](_0x1832('0x10'),_0x1f3cc5,_0x3154c4);_0x384ef4(_0x3154c4);});});}exports[_0x1832('0x18')]=function(_0x4161ca){var _0x1e7cb1=this;return new Promise(function(_0x5aaff9,_0x1debfc){return db[_0x1832('0x19')][_0x1832('0x1a')](_0x4161ca[_0x1832('0x1b')],{'raw':_0x4161ca['options']?_0x4161ca[_0x1832('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1832('0xe')](function(_0x32c7b0){logger[_0x1832('0xf')](_0x1832('0x18'),_0x4161ca);logger[_0x1832('0x12')](_0x1832('0x18'),_0x4161ca,JSON[_0x1832('0x13')](_0x32c7b0));_0x5aaff9(_0x32c7b0);})[_0x1832('0x1d')](function(_0x21e373){logger[_0x1832('0x14')](_0x1832('0x18'),_0x21e373[_0x1832('0x16')],_0x4161ca);_0x1debfc(_0x1e7cb1[_0x1832('0x14')](0x1f4,_0x21e373[_0x1832('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3ad5119..2ea0c21 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 _0x8925=['length','./whatsappMessage.events','remove','update','emit','removeListener','register'];(function(_0x4fe111,_0x1fdbbd){var _0xe676b6=function(_0x47679d){while(--_0x47679d){_0x4fe111['push'](_0x4fe111['shift']());}};_0xe676b6(++_0x1fdbbd);}(_0x8925,0x15f));var _0x5892=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x8925[_0x175a8c];return _0x37b0b0;};'use strict';var WhatsappMessageEvents=require(_0x5892('0x0'));var events=['save',_0x5892('0x1'),_0x5892('0x2')];function createListener(_0x18bf6e,_0x968314){return function(_0x40ea29){_0x968314[_0x5892('0x3')](_0x18bf6e,_0x40ea29);};}function removeListener(_0x3f2623,_0x46fdcc){return function(){WhatsappMessageEvents[_0x5892('0x4')](_0x3f2623,_0x46fdcc);};}exports[_0x5892('0x5')]=function(_0x344f36){for(var _0xdb3a36=0x0,_0x2a9014=events[_0x5892('0x6')];_0xdb3a36<_0x2a9014;_0xdb3a36++){var _0x1838ad=events[_0xdb3a36];var _0x4ba33a=createListener('whatsappMessage:'+_0x1838ad,_0x344f36);WhatsappMessageEvents['on'](_0x1838ad,_0x4ba33a);}}; \ No newline at end of file +var _0x0310=['removeListener','length','save','remove','update'];(function(_0x14dd26,_0x3cc881){var _0x4a7ab0=function(_0x15b151){while(--_0x15b151){_0x14dd26['push'](_0x14dd26['shift']());}};_0x4a7ab0(++_0x3cc881);}(_0x0310,0x188));var _0x0031=function(_0x49c781,_0x5cc3f6){_0x49c781=_0x49c781-0x0;var _0x45eb63=_0x0310[_0x49c781];return _0x45eb63;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x0031('0x0'),_0x0031('0x1'),_0x0031('0x2')];function createListener(_0x1ecddb,_0x5349fd){return function(_0x3f1d21){_0x5349fd['emit'](_0x1ecddb,_0x3f1d21);};}function removeListener(_0x130fa3,_0x129114){return function(){WhatsappMessageEvents[_0x0031('0x3')](_0x130fa3,_0x129114);};}exports['register']=function(_0xa4b4dc){for(var _0x396051=0x0,_0x528437=events[_0x0031('0x4')];_0x396051<_0x528437;_0x396051++){var _0x26576d=events[_0x396051];var _0x2454c8=createListener('whatsappMessage:'+_0x26576d,_0xa4b4dc);WhatsappMessageEvents['on'](_0x26576d,_0x2454c8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c2800ff..6164dbe 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 _0x8eac=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x363ffd,_0x4bfd50){var _0x448a7d=function(_0x16088a){while(--_0x16088a){_0x363ffd['push'](_0x363ffd['shift']());}};_0x448a7d(++_0x4bfd50);}(_0x8eac,0x133));var _0xc8ea=function(_0x5bdbfd,_0x3aaf24){_0x5bdbfd=_0x5bdbfd-0x0;var _0x5711c0=_0x8eac[_0x5bdbfd];return _0x5711c0;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require('util');var path=require(_0xc8ea('0x1'));var timeout=require(_0xc8ea('0x2'));var express=require(_0xc8ea('0x3'));var router=express['Router']();var fs_extra=require(_0xc8ea('0x4'));var auth=require(_0xc8ea('0x5'));var interaction=require(_0xc8ea('0x6'));var config=require(_0xc8ea('0x7'));var controller=require(_0xc8ea('0x8'));router['get']('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xa')]);router[_0xc8ea('0xb')](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xd')]);router[_0xc8ea('0xb')](_0xc8ea('0xe'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xf')]);router[_0xc8ea('0xb')](_0xc8ea('0x10'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x11')]);router[_0xc8ea('0xb')](_0xc8ea('0x12'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x13')]);router[_0xc8ea('0xb')](_0xc8ea('0x14'),auth[_0xc8ea('0x9')](),controller['getAgents']);router[_0xc8ea('0x15')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x16')]);router[_0xc8ea('0x15')]('/:id/teams',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x17')]);router[_0xc8ea('0x15')](_0xc8ea('0x14'),auth['isAuthenticated'](),controller[_0xc8ea('0x18')]);router[_0xc8ea('0x19')]('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x1a')]);router[_0xc8ea('0x1b')]('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x1c')]);router[_0xc8ea('0x1b')](_0xc8ea('0x12'),auth['isAuthenticated'](),controller[_0xc8ea('0x1d')]);router['delete'](_0xc8ea('0x14'),auth[_0xc8ea('0x9')](),controller['removeAgents']);module[_0xc8ea('0x1e')]=router; \ No newline at end of file +var _0x1059=['/:id/teams','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','/:id','show','/:id/members','getMembers','getAgents','post','create'];(function(_0x15864b,_0x20cd1c){var _0x37d3b9=function(_0x5dd317){while(--_0x5dd317){_0x15864b['push'](_0x15864b['shift']());}};_0x37d3b9(++_0x20cd1c);}(_0x1059,0x176));var _0x9105=function(_0x4bef5a,_0xc3f8ed){_0x4bef5a=_0x4bef5a-0x0;var _0x50344e=_0x1059[_0x4bef5a];return _0x50344e;};'use strict';var multer=require(_0x9105('0x0'));var util=require(_0x9105('0x1'));var path=require('path');var timeout=require(_0x9105('0x2'));var express=require(_0x9105('0x3'));var router=express[_0x9105('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9105('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9105('0x6'));var controller=require(_0x9105('0x7'));router['get']('/',auth[_0x9105('0x8')](),controller['index']);router[_0x9105('0x9')](_0x9105('0xa'),auth[_0x9105('0x8')](),controller['describe']);router[_0x9105('0x9')](_0x9105('0xb'),auth[_0x9105('0x8')](),controller[_0x9105('0xc')]);router['get'](_0x9105('0xd'),auth[_0x9105('0x8')](),controller[_0x9105('0xe')]);router[_0x9105('0x9')]('/:id/teams',auth[_0x9105('0x8')](),controller['getTeams']);router[_0x9105('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x9105('0xf')]);router[_0x9105('0x10')]('/',auth[_0x9105('0x8')](),controller[_0x9105('0x11')]);router['post'](_0x9105('0x12'),auth['isAuthenticated'](),controller[_0x9105('0x13')]);router[_0x9105('0x10')](_0x9105('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9105('0x15')](_0x9105('0xb'),auth[_0x9105('0x8')](),controller[_0x9105('0x16')]);router[_0x9105('0x17')](_0x9105('0xb'),auth[_0x9105('0x8')](),controller[_0x9105('0x18')]);router[_0x9105('0x17')](_0x9105('0x12'),auth[_0x9105('0x8')](),controller[_0x9105('0x19')]);router['delete']('/:id/users',auth[_0x9105('0x8')](),controller[_0x9105('0x1a')]);module[_0x9105('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e022432..126e244 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 _0xa477=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x595444,_0x32d561){var _0x51cbac=function(_0x431ea9){while(--_0x431ea9){_0x595444['push'](_0x595444['shift']());}};_0x51cbac(++_0x32d561);}(_0xa477,0xe6));var _0x7a47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa477[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x7a47('0x0'));module[_0x7a47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7a47('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7a47('0x4')](_0x7a47('0x5'),_0x7a47('0x6'),_0x7a47('0x7'))},'description':{'type':Sequelize[_0x7a47('0x8')]}}; \ No newline at end of file +var _0x9780=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9780,0x1d4));var _0x0978=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0x9780[_0x97c6ea];return _0x2d7f50;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0978('0x0')],'unique':_0x0978('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0978('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0978('0x3')](_0x0978('0x4'),_0x0978('0x5'),_0x0978('0x6'))},'description':{'type':Sequelize[_0x0978('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 37e82e8..70d37cf 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 _0x6729=['params','model','keys','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','intersection','nolimit','limit','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','map','UserId','rows','name','format','SIP','whatsappPause','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show'];(function(_0x373b37,_0x201bbf){var _0x144a38=function(_0x367ab8){while(--_0x367ab8){_0x373b37['push'](_0x373b37['shift']());}};_0x144a38(++_0x201bbf);}(_0x6729,0x15b));var _0x9672=function(_0x213194,_0x306849){_0x213194=_0x213194-0x0;var _0x4b74f3=_0x6729[_0x213194];return _0x4b74f3;};'use strict';var BPromise=require('bluebird');var util=require(_0x9672('0x0'));var _=require(_0x9672('0x1'));var squel=require(_0x9672('0x2'));var Redis=require(_0x9672('0x3'));var qs=require(_0x9672('0x4'));var logger=require('../../config/logger')(_0x9672('0x5'));var config=require(_0x9672('0x6'));var db=require(_0x9672('0x7'))['db'];config[_0x9672('0x8')]=_[_0x9672('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9672('0xa'))(new Redis(config[_0x9672('0x8')]));require(_0x9672('0xb'))[_0x9672('0xc')](socket);function respondWithStatusCode(_0x4774ad,_0x260c97){_0x260c97=_0x260c97||0xcc;return function(_0x37cbf8){if(_0x37cbf8){return _0x4774ad[_0x9672('0xd')](_0x260c97);}return _0x4774ad[_0x9672('0xe')](_0x260c97)[_0x9672('0xf')]();};}function respondWithResult(_0x4dcb26,_0x1c5252){_0x1c5252=_0x1c5252||0xc8;return function(_0x21f63a){if(_0x21f63a){return _0x4dcb26[_0x9672('0xe')](_0x1c5252)[_0x9672('0x10')](_0x21f63a);}};}function respondWithFilteredResult(_0x1b5fca,_0x268456){return function(_0x1b0c0c){if(_0x1b0c0c){var _0x103af2=typeof _0x268456[_0x9672('0x11')]===_0x9672('0x12')&&typeof _0x268456['limit']==='undefined';var _0x241201=_0x1b0c0c[_0x9672('0x13')];var _0x23f6a3=_0x103af2?0x0:_0x268456[_0x9672('0x11')];var _0x26cc1f=_0x103af2?_0x1b0c0c[_0x9672('0x13')]:_0x268456['offset']+_0x268456['limit'];var _0x4344f2;if(_0x26cc1f>=_0x241201){_0x26cc1f=_0x241201;_0x4344f2=0xc8;}else{_0x4344f2=0xce;}_0x1b5fca[_0x9672('0xe')](_0x4344f2);return _0x1b5fca[_0x9672('0x14')]('Content-Range',_0x23f6a3+'-'+_0x26cc1f+'/'+_0x241201)[_0x9672('0x10')](_0x1b0c0c);}return null;};}function saveUpdates(_0x1ef6e7){return function(_0x2eda52){if(_0x2eda52){return _0x2eda52[_0x9672('0x15')](_0x1ef6e7)[_0x9672('0x16')](function(_0x2f7b04){return _0x2f7b04;});}return null;};}function removeEntity(_0x2afa0f){return function(_0x1f2f19){if(_0x1f2f19){return _0x1f2f19['destroy']()[_0x9672('0x16')](function(){var _0x4d9f60=_0x1f2f19[_0x9672('0x17')]({'plain':!![]});var _0x5d7b05=_0x9672('0x18');return db[_0x9672('0x19')][_0x9672('0x1a')]({'where':{'type':_0x5d7b05,'resourceId':_0x4d9f60['id']}})['then'](function(){return _0x1f2f19;});})[_0x9672('0x16')](function(){_0x2afa0f[_0x9672('0xe')](0xcc)[_0x9672('0xf')]();});}};}function handleEntityNotFound(_0xf11957){return function(_0x2ccf9b){if(!_0x2ccf9b){_0xf11957['sendStatus'](0x194);}return _0x2ccf9b;};}function handleError(_0x2c7b3b,_0x548588){_0x548588=_0x548588||0x1f4;return function(_0x46f3ca){logger[_0x9672('0x1b')](_0x46f3ca[_0x9672('0x1c')]);if(_0x46f3ca['name']){delete _0x46f3ca['name'];}_0x2c7b3b[_0x9672('0xe')](_0x548588)[_0x9672('0x1d')](_0x46f3ca);};}exports[_0x9672('0x1e')]=function(_0x2c4f2c,_0x2cdeb0){var _0x36dd79={};var _0x1acc49={'count':0x0,'rows':[]};var _0x2c1aea=_['map'](db[_0x9672('0x1f')][_0x9672('0x20')],function(_0x46939a){return{'name':_0x46939a[_0x9672('0x21')],'type':_0x46939a[_0x9672('0x22')][_0x9672('0x23')]};});_0x36dd79=qs[_0x9672('0x24')](_0x2c1aea,_0x2c4f2c);var _0x2680e0={'where':_0x36dd79[_0x9672('0x25')]};return db[_0x9672('0x1f')][_0x9672('0x13')](_0x2680e0)[_0x9672('0x16')](function(_0x2f9722){_0x1acc49['count']=_0x2f9722;_0x36dd79['include']=qs[_0x9672('0x26')](_0x2c4f2c[_0x9672('0x27')]);return db[_0x9672('0x1f')][_0x9672('0x28')](_0x36dd79);})[_0x9672('0x16')](function(_0xd88ac7){_0x1acc49['rows']=_0xd88ac7;return _0x1acc49;})[_0x9672('0x16')](respondWithFilteredResult(_0x2cdeb0,_0x36dd79))[_0x9672('0x29')](handleError(_0x2cdeb0,null));};exports[_0x9672('0x2a')]=function(_0x520c5e,_0x384efd){var _0x3f548e={'raw':!![],'where':{'id':_0x520c5e[_0x9672('0x2b')]['id']}},_0x367e23={};_0x367e23[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x1f')][_0x9672('0x20')]);_0x367e23[_0x9672('0x27')]=_[_0x9672('0x2d')](_0x520c5e['query']);_0x367e23['filters']=_['intersection'](_0x367e23[_0x9672('0x2c')],_0x367e23[_0x9672('0x27')]);_0x3f548e['attributes']=_['intersection'](_0x367e23[_0x9672('0x2c')],qs[_0x9672('0x2e')](_0x520c5e['query'][_0x9672('0x2e')]));_0x3f548e[_0x9672('0x2f')]=_0x3f548e[_0x9672('0x2f')][_0x9672('0x30')]?_0x3f548e[_0x9672('0x2f')]:_0x367e23['model'];if(_0x520c5e[_0x9672('0x27')]['includeAll']){_0x3f548e[_0x9672('0x26')]=[{'all':!![]}];}_0x3f548e=_[_0x9672('0x31')]({},_0x3f548e,_0x520c5e[_0x9672('0x32')]);return db[_0x9672('0x1f')][_0x9672('0x33')](_0x3f548e)[_0x9672('0x16')](handleEntityNotFound(_0x384efd,null))[_0x9672('0x16')](respondWithResult(_0x384efd,null))['catch'](handleError(_0x384efd,null));};exports['create']=function(_0x66aa80,_0x463ccb){return db['WhatsappQueue'][_0x9672('0x34')](_0x66aa80[_0x9672('0x35')],{})[_0x9672('0x16')](function(_0x55a22b){var _0x187232=_0x66aa80[_0x9672('0x36')][_0x9672('0x17')]({'plain':!![]});if(!_0x187232)throw new Error(_0x9672('0x37'));if(_0x187232[_0x9672('0x38')]===_0x9672('0x36')){var _0x350954=_0x55a22b['get']({'plain':!![]});var _0x229f55='WhatsappQueues';return db[_0x9672('0x39')][_0x9672('0x33')]({'where':{'name':_0x229f55,'userProfileId':_0x187232[_0x9672('0x3a')]},'raw':!![]})[_0x9672('0x16')](function(_0x16d278){if(_0x16d278&&_0x16d278[_0x9672('0x3b')]===0x0){return db[_0x9672('0x19')]['create']({'name':_0x350954['name'],'resourceId':_0x350954['id'],'type':_0x16d278['name'],'sectionId':_0x16d278['id']},{})['then'](function(){return _0x55a22b;});}else{return _0x55a22b;}})['catch'](function(_0x5cd4e3){logger['error'](_0x9672('0x3c'),_0x5cd4e3);throw _0x5cd4e3;});}return _0x55a22b;})[_0x9672('0x16')](respondWithResult(_0x463ccb,0xc9))[_0x9672('0x29')](handleError(_0x463ccb,null));};exports[_0x9672('0x15')]=function(_0x4e609c,_0x59f2d){if(_0x4e609c[_0x9672('0x35')]['id']){delete _0x4e609c[_0x9672('0x35')]['id'];}return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x4e609c[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x59f2d,null))['then'](saveUpdates(_0x4e609c['body'],null))[_0x9672('0x16')](respondWithResult(_0x59f2d,null))[_0x9672('0x29')](handleError(_0x59f2d,null));};exports['destroy']=function(_0x4919bc,_0x1e5401){return db[_0x9672('0x1f')][_0x9672('0x33')]({'where':{'id':_0x4919bc['params']['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x1e5401,null))[_0x9672('0x16')](removeEntity(_0x1e5401,null))[_0x9672('0x29')](handleError(_0x1e5401,null));};exports[_0x9672('0x3d')]=function(_0x2818d7,_0x578b59){return db['WhatsappQueue'][_0x9672('0x3d')]()[_0x9672('0x16')](respondWithResult(_0x578b59,null))[_0x9672('0x29')](handleError(_0x578b59,null));};exports[_0x9672('0x3e')]=function(_0x115342,_0x319c0f){var _0x3f7e7e={'raw':!![],'where':{}},_0x3fbf30={},_0x313360;return db['WhatsappQueue'][_0x9672('0x3f')]({'where':{'id':_0x115342[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x319c0f,null))['then'](function(_0xcaef76){if(_0xcaef76){_0x313360=_0xcaef76['get']({'plain':!![]});_0x3fbf30[_0x9672('0x2c')]=_[_0x9672('0x2d')](db['UserWhatsappQueue'][_0x9672('0x20')]);_0x3fbf30[_0x9672('0x27')]=_[_0x9672('0x2d')](_0x115342['query']);_0x3fbf30[_0x9672('0x40')]=_[_0x9672('0x41')](_0x3fbf30[_0x9672('0x2c')],_0x3fbf30[_0x9672('0x27')]);_0x3f7e7e[_0x9672('0x2f')]=_[_0x9672('0x41')](_0x3fbf30['model'],qs[_0x9672('0x2e')](_0x115342[_0x9672('0x27')]['fields']));_0x3f7e7e['attributes']=_0x3f7e7e[_0x9672('0x2f')][_0x9672('0x30')]?_0x3f7e7e['attributes']:_0x3fbf30[_0x9672('0x2c')];if(!_0x115342[_0x9672('0x27')]['hasOwnProperty'](_0x9672('0x42'))){_0x3f7e7e[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x115342[_0x9672('0x27')][_0x9672('0x43')]);_0x3f7e7e['offset']=qs[_0x9672('0x11')](_0x115342[_0x9672('0x27')]['offset']);}_0x3f7e7e[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x115342[_0x9672('0x27')][_0x9672('0x45')]);_0x3f7e7e[_0x9672('0x25')]=qs[_0x9672('0x40')](_[_0x9672('0x46')](_0x115342[_0x9672('0x27')],_0x3fbf30[_0x9672('0x40')]));_0x3f7e7e[_0x9672('0x25')][_0x9672('0x47')]=_0xcaef76['id'];if(_0x115342['query'][_0x9672('0x48')]){_0x3f7e7e[_0x9672('0x25')]=_[_0x9672('0x31')](_0x3f7e7e[_0x9672('0x25')],{'$or':_['map'](_0x3f7e7e[_0x9672('0x2f')],function(_0xec294b){var _0x3b968b={};_0x3b968b[_0xec294b]={'$like':'%'+_0x115342[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x3b968b;})});}_0x3f7e7e=_['merge']({},_0x3f7e7e,_0x115342[_0x9672('0x32')]);return db[_0x9672('0x49')][_0x9672('0x28')](_0x3f7e7e);}})[_0x9672('0x16')](function(_0x4c8d6b){if(_0x4c8d6b){return db[_0x9672('0x4a')][_0x9672('0x4b')]({'where':{'id':_[_0x9672('0x4c')](_0x4c8d6b,_0x9672('0x4d')),'role':'agent'},'attributes':['id','name','whatsappPause','updatedAt','createdAt']});}})[_0x9672('0x16')](function(_0x459492){if(_0x459492){return{'count':_0x459492['count'],'rows':_['map'](_0x459492[_0x9672('0x4e')],function(_0x57e487){return{'membername':_0x57e487[_0x9672('0x4f')],'UserId':_0x57e487['id'],'queue_name':_0x313360['name'],'WhatsappQueueId':_0x313360['id'],'interface':util[_0x9672('0x50')]('%s/%s',_0x9672('0x51'),_0x57e487[_0x9672('0x4f')]),'penalty':0x0,'paused':_0x57e487[_0x9672('0x52')],'createdAt':_0x57e487[_0x9672('0x53')],'updatedAt':_0x57e487[_0x9672('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9672('0x16')](respondWithFilteredResult(_0x319c0f,_0x3f7e7e))[_0x9672('0x29')](handleError(_0x319c0f,null));};exports[_0x9672('0x55')]=function(_0x2b37f7,_0x2fba62){var _0x14b4c0={};var _0x432a40={};var _0x27c348;var _0x221fff;return db[_0x9672('0x1f')][_0x9672('0x3f')]({'where':{'id':_0x2b37f7[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x2fba62,null))['then'](function(_0x29855a){if(_0x29855a){_0x27c348=_0x29855a;_0x432a40[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x56')][_0x9672('0x20')]);_0x432a40['query']=_[_0x9672('0x2d')](_0x2b37f7[_0x9672('0x27')]);_0x432a40['filters']=_[_0x9672('0x41')](_0x432a40[_0x9672('0x2c')],_0x432a40[_0x9672('0x27')]);_0x14b4c0['attributes']=_['intersection'](_0x432a40[_0x9672('0x2c')],qs['fields'](_0x2b37f7[_0x9672('0x27')]['fields']));_0x14b4c0[_0x9672('0x2f')]=_0x14b4c0[_0x9672('0x2f')]['length']?_0x14b4c0['attributes']:_0x432a40[_0x9672('0x2c')];_0x14b4c0[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x2b37f7[_0x9672('0x27')][_0x9672('0x45')]);_0x14b4c0['where']=qs['filters'](_[_0x9672('0x46')](_0x2b37f7[_0x9672('0x27')],_0x432a40[_0x9672('0x40')]));if(_0x2b37f7[_0x9672('0x27')][_0x9672('0x48')]){_0x14b4c0[_0x9672('0x25')]=_[_0x9672('0x31')](_0x14b4c0['where'],{'$or':_[_0x9672('0x4c')](_0x14b4c0[_0x9672('0x2f')],function(_0x13a1cb){var _0x393cd5={};_0x393cd5[_0x13a1cb]={'$like':'%'+_0x2b37f7[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x393cd5;})});}_0x14b4c0=_[_0x9672('0x31')]({},_0x14b4c0,_0x2b37f7[_0x9672('0x32')]);return _0x27c348[_0x9672('0x55')](_0x14b4c0);}})['then'](function(_0x12d350){if(_0x12d350){_0x221fff=_0x12d350[_0x9672('0x30')];if(!_0x2b37f7['query'][_0x9672('0x57')]('nolimit')){_0x14b4c0[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x2b37f7[_0x9672('0x27')]['limit']);_0x14b4c0[_0x9672('0x11')]=qs[_0x9672('0x11')](_0x2b37f7[_0x9672('0x27')][_0x9672('0x11')]);}return _0x27c348['getTeams'](_0x14b4c0);}})['then'](function(_0xc46966){if(_0xc46966){return _0xc46966?{'count':_0x221fff,'rows':_0xc46966}:null;}})[_0x9672('0x16')](respondWithResult(_0x2fba62,null))['catch'](handleError(_0x2fba62,null));};exports[_0x9672('0x58')]=function(_0x59a207,_0x332763){var _0x486e18=_0x59a207[_0x9672('0x35')][_0x9672('0x59')];return db[_0x9672('0x56')][_0x9672('0x28')]({'where':{'id':_0x486e18},'attributes':['id'],'include':[{'model':db[_0x9672('0x4a')],'as':_0x9672('0x5a'),'attributes':['id',_0x9672('0x4f'),_0x9672('0x5b'),'voicePause',_0x9672('0x5c')],'raw':!![]}]})[_0x9672('0x16')](function(_0x467636){if(_0x467636){var _0x1a4471=_['flatMap'](_0x467636,function(_0x5adb99){var _0x2a99b8=_0x5adb99['get']({'plain':!![]});return _0x2a99b8[_0x9672('0x5a')];});return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x59a207[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](function(_0x5e2ad9){return db[_0x9672('0x5d')][_0x9672('0x5e')](function(_0x4599be){return _0x5e2ad9[_0x9672('0x58')](_0x486e18,{'transaction':_0x4599be})[_0x9672('0x16')](function(){return BPromise[_0x9672('0x5f')](_0x1a4471,function(_0x23306a){return db[_0x9672('0x49')][_0x9672('0x60')]({'where':{'UserId':_0x23306a['id'],'WhatsappQueueId':_0x59a207['params']['id']},'transaction':_0x4599be});});})['then'](function(){_0x1a4471['forEach'](function(_0x471678){socket[_0x9672('0x61')](_0x9672('0x62'),{'UserId':_0x471678['id'],'WhatsappQueueId':_0x5e2ad9['id']});});});});});}})[_0x9672('0x16')](respondWithStatusCode(_0x332763,null))[_0x9672('0x29')](handleError(_0x332763,null));};exports[_0x9672('0x63')]=function(_0x3ba988,_0x575daf){return db['Team'][_0x9672('0x28')]({'where':{'id':_0x3ba988['query'][_0x9672('0x59')]},'attributes':['id'],'include':[{'model':db[_0x9672('0x4a')],'as':_0x9672('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x9672('0x16')](handleEntityNotFound(_0x575daf,null))['then'](function(_0x56edd0){var _0x3a8326=_['map'](_0x56edd0,'id');var _0x473a4d=[];var _0x3e06ea=[];var _0x40d98a=squel[_0x9672('0x64')]();_0x40d98a[_0x9672('0x65')](_0x9672('0x66'))[_0x9672('0x67')](_0x9672('0x68'),'tq')[_0x9672('0x69')](_0x9672('0x6a'),'ut',_0x9672('0x6b'))[_0x9672('0x25')](_0x9672('0x6c'),_0x3ba988[_0x9672('0x2b')]['id']);for(var _0x3edc08=0x0;_0x3edc08<_0x56edd0[_0x9672('0x30')];_0x3edc08+=0x1){let _0x2abdab=_0x56edd0[_0x3edc08];for(var _0x59abd9=0x0;_0x59abd9<_0x2abdab[_0x9672('0x5a')][_0x9672('0x30')];_0x59abd9+=0x1){let _0x400e0=_0x2abdab[_0x9672('0x5a')][_0x59abd9];var _0x2213c2=_0x40d98a[_0x9672('0x6d')]();_0x2213c2[_0x9672('0x25')](_0x9672('0x6e'),_0x400e0['id']);_0x3e06ea[_0x9672('0x6f')](db[_0x9672('0x5d')][_0x9672('0x27')](_0x2213c2[_0x9672('0x70')](),{'type':db[_0x9672('0x5d')][_0x9672('0x71')][_0x9672('0x72')]})['then'](function(_0x1c4dbe){if(_0x1c4dbe[_0x9672('0x30')]===0x1){return _0x400e0['id'];}else{var _0x4cd68e=_[_0x9672('0x73')](_['map'](_0x1c4dbe,_0x9672('0x74')),function(_0x1523ce){return _[_0x9672('0x75')](_0x3a8326,_0x1523ce);});if(_0x4cd68e){return _0x400e0['id'];}}}));}}return BPromise[_0x9672('0x76')](_0x3e06ea)[_0x9672('0x16')](function(_0x35b9ea){_0x473a4d=_(_0x473a4d)['union'](_0x35b9ea)[_0x9672('0x77')]()[_0x9672('0x78')]();return db[_0x9672('0x1f')][_0x9672('0x33')]({'where':{'id':_0x3ba988[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](function(_0xc3418a){return db['sequelize'][_0x9672('0x5e')](function(_0x4411db){return _0xc3418a[_0x9672('0x63')](_0x3ba988[_0x9672('0x27')]['ids'],{'transaction':_0x4411db})[_0x9672('0x16')](function(){if(!_[_0x9672('0x79')](_0x473a4d)){return _0xc3418a[_0x9672('0x7a')](_0x473a4d,{'transaction':_0x4411db});}})[_0x9672('0x16')](function(){_0x473a4d[_0x9672('0x7b')](function(_0x3f692c){socket[_0x9672('0x61')](_0x9672('0x7c'),{'UserId':_0x3f692c,'WhatsappQueueId':_0xc3418a['id']});});});});});});})[_0x9672('0x16')](respondWithStatusCode(_0x575daf,null))[_0x9672('0x29')](handleError(_0x575daf,null));};exports[_0x9672('0x7d')]=function(_0x22eef9,_0x2f3c6e){return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x22eef9[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x2f3c6e,null))[_0x9672('0x16')](function(_0x3648cd){if(_0x3648cd){return _0x3648cd['addAgents'](_0x22eef9['body']['ids'],_[_0x9672('0x7e')](_0x22eef9[_0x9672('0x35')],[_0x9672('0x59'),'id'])||{})[_0x9672('0x7f')](function(_0x206f5a){for(var _0x394e9d=0x0;_0x394e9d<_0x22eef9['body'][_0x9672('0x59')][_0x9672('0x30')];_0x394e9d+=0x1){socket[_0x9672('0x61')]('userWhatsappQueue:save',{'UserId':Number(_0x22eef9[_0x9672('0x35')][_0x9672('0x59')][_0x394e9d]),'WhatsappQueueId':Number(_0x22eef9[_0x9672('0x2b')]['id'])});}return _0x206f5a;});}})[_0x9672('0x16')](respondWithResult(_0x2f3c6e,null))[_0x9672('0x29')](handleError(_0x2f3c6e,null));};exports[_0x9672('0x7a')]=function(_0x453337,_0x344114){return db[_0x9672('0x1f')]['find']({'where':{'id':_0x453337['params']['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x344114,null))[_0x9672('0x16')](function(_0x1bb945){if(_0x1bb945){return _0x1bb945[_0x9672('0x7a')](_0x453337['query'][_0x9672('0x59')])[_0x9672('0x16')](function(){if(_[_0x9672('0x80')](_0x453337['query'][_0x9672('0x59')])){for(var _0xe9993b=0x0;_0xe9993b<_0x453337[_0x9672('0x27')][_0x9672('0x59')][_0x9672('0x30')];_0xe9993b+=0x1){socket['emit'](_0x9672('0x7c'),{'UserId':Number(_0x453337[_0x9672('0x27')][_0x9672('0x59')][_0xe9993b]),'WhatsappQueueId':Number(_0x453337[_0x9672('0x2b')]['id'])});}}else{socket[_0x9672('0x61')]('userWhatsappQueue:remove',{'UserId':Number(_0x453337[_0x9672('0x27')][_0x9672('0x59')]),'WhatsappQueueId':Number(_0x453337['params']['id'])});}});}})[_0x9672('0x16')](respondWithStatusCode(_0x344114,null))[_0x9672('0x29')](handleError(_0x344114,null));};exports['getAgents']=function(_0x4e5ad5,_0x5e2e60){var _0x4d2536={};var _0x13088d={};var _0x3c4878;var _0x5c3a96;return db[_0x9672('0x1f')][_0x9672('0x3f')]({'where':{'id':_0x4e5ad5[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x5e2e60,null))[_0x9672('0x16')](function(_0x1f2362){if(_0x1f2362){_0x3c4878=_0x1f2362;_0x13088d[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x4a')][_0x9672('0x20')]);_0x13088d['query']=_[_0x9672('0x2d')](_0x4e5ad5[_0x9672('0x27')]);_0x13088d[_0x9672('0x40')]=_['intersection'](_0x13088d[_0x9672('0x2c')],_0x13088d[_0x9672('0x27')]);_0x4d2536[_0x9672('0x2f')]=_['intersection'](_0x13088d['model'],qs[_0x9672('0x2e')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x2e')]));_0x4d2536['attributes']=_0x4d2536[_0x9672('0x2f')]['length']?_0x4d2536['attributes']:_0x13088d[_0x9672('0x2c')];_0x4d2536[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x4e5ad5[_0x9672('0x27')]['sort']);_0x4d2536[_0x9672('0x25')]=qs[_0x9672('0x40')](_[_0x9672('0x46')](_0x4e5ad5['query'],_0x13088d[_0x9672('0x40')]));if(_0x4e5ad5[_0x9672('0x27')][_0x9672('0x48')]){_0x4d2536['where']=_[_0x9672('0x31')](_0x4d2536[_0x9672('0x25')],{'$or':_[_0x9672('0x4c')](_0x4d2536['attributes'],function(_0x2e8c95){var _0x7ccd08={};_0x7ccd08[_0x2e8c95]={'$like':'%'+_0x4e5ad5[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x7ccd08;})});}_0x4d2536=_[_0x9672('0x31')]({},_0x4d2536,_0x4e5ad5[_0x9672('0x32')]);return _0x3c4878[_0x9672('0x81')](_0x4d2536);}})[_0x9672('0x16')](function(_0x82180f){if(_0x82180f){_0x5c3a96=_0x82180f[_0x9672('0x30')];if(!_0x4e5ad5[_0x9672('0x27')][_0x9672('0x57')]('nolimit')){_0x4d2536[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x43')]);_0x4d2536['offset']=qs[_0x9672('0x11')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x11')]);}return _0x3c4878[_0x9672('0x81')](_0x4d2536);}})[_0x9672('0x16')](function(_0x5a546b){if(_0x5a546b){return _0x5a546b?{'count':_0x5c3a96,'rows':_0x5a546b}:null;}})[_0x9672('0x16')](respondWithResult(_0x5e2e60,null))[_0x9672('0x29')](handleError(_0x5e2e60,null));}; \ No newline at end of file +var _0xf1dd=['ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','destroy','get','WhatsappQueues','UserProfileResource','then','error','name','send','index','map','rawAttributes','type','key','getOptions','include','query','findAll','rows','params','model','keys','WhatsappQueue','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','limit','order','where','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','createdAt','format','SIP','updatedAt','findOne','Team','pick','getTeams','hasOwnProperty','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','getAgents','sort','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1dd,0xf3));var _0xdf1d=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xf1dd[_0x184759];return _0xf26d5f;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require(_0xdf1d('0x0'));var Redis=require(_0xdf1d('0x1'));var qs=require(_0xdf1d('0x2'));var logger=require(_0xdf1d('0x3'))(_0xdf1d('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xdf1d('0x5')]=_[_0xdf1d('0x6')](config[_0xdf1d('0x5')],{'host':_0xdf1d('0x7'),'port':0x18eb});var socket=require(_0xdf1d('0x8'))(new Redis(config[_0xdf1d('0x5')]));require('./whatsappQueue.socket')[_0xdf1d('0x9')](socket);function respondWithStatusCode(_0x5690c1,_0x198d54){_0x198d54=_0x198d54||0xcc;return function(_0x8e5fc2){if(_0x8e5fc2){return _0x5690c1[_0xdf1d('0xa')](_0x198d54);}return _0x5690c1[_0xdf1d('0xb')](_0x198d54)[_0xdf1d('0xc')]();};}function respondWithResult(_0x55b776,_0x203717){_0x203717=_0x203717||0xc8;return function(_0xbcde14){if(_0xbcde14){return _0x55b776['status'](_0x203717)[_0xdf1d('0xd')](_0xbcde14);}};}function respondWithFilteredResult(_0x366af2,_0x101e90){return function(_0x1b02a1){if(_0x1b02a1){var _0x2fd037=typeof _0x101e90['offset']===_0xdf1d('0xe')&&typeof _0x101e90['limit']==='undefined';var _0x17f030=_0x1b02a1[_0xdf1d('0xf')];var _0x5a3e92=_0x2fd037?0x0:_0x101e90[_0xdf1d('0x10')];var _0x516d30=_0x2fd037?_0x1b02a1['count']:_0x101e90[_0xdf1d('0x10')]+_0x101e90['limit'];var _0x525719;if(_0x516d30>=_0x17f030){_0x516d30=_0x17f030;_0x525719=0xc8;}else{_0x525719=0xce;}_0x366af2['status'](_0x525719);return _0x366af2[_0xdf1d('0x11')](_0xdf1d('0x12'),_0x5a3e92+'-'+_0x516d30+'/'+_0x17f030)[_0xdf1d('0xd')](_0x1b02a1);}return null;};}function saveUpdates(_0x49ad19){return function(_0x591358){if(_0x591358){return _0x591358[_0xdf1d('0x13')](_0x49ad19)['then'](function(_0x1d3169){return _0x1d3169;});}return null;};}function removeEntity(_0x174742){return function(_0x30e7bd){if(_0x30e7bd){return _0x30e7bd[_0xdf1d('0x14')]()['then'](function(){var _0x3df1be=_0x30e7bd[_0xdf1d('0x15')]({'plain':!![]});var _0x438c6c=_0xdf1d('0x16');return db[_0xdf1d('0x17')][_0xdf1d('0x14')]({'where':{'type':_0x438c6c,'resourceId':_0x3df1be['id']}})[_0xdf1d('0x18')](function(){return _0x30e7bd;});})[_0xdf1d('0x18')](function(){_0x174742[_0xdf1d('0xb')](0xcc)[_0xdf1d('0xc')]();});}};}function handleEntityNotFound(_0x20f436){return function(_0x9b8775){if(!_0x9b8775){_0x20f436[_0xdf1d('0xa')](0x194);}return _0x9b8775;};}function handleError(_0x1522b8,_0x50ffc9){_0x50ffc9=_0x50ffc9||0x1f4;return function(_0x4755f1){logger[_0xdf1d('0x19')](_0x4755f1['stack']);if(_0x4755f1[_0xdf1d('0x1a')]){delete _0x4755f1[_0xdf1d('0x1a')];}_0x1522b8[_0xdf1d('0xb')](_0x50ffc9)[_0xdf1d('0x1b')](_0x4755f1);};}exports[_0xdf1d('0x1c')]=function(_0x3ebf06,_0x13d93d){var _0x5e37b9={};var _0x377992={'count':0x0,'rows':[]};var _0x136421=_[_0xdf1d('0x1d')](db['WhatsappQueue'][_0xdf1d('0x1e')],function(_0x1d43b2){return{'name':_0x1d43b2['fieldName'],'type':_0x1d43b2[_0xdf1d('0x1f')][_0xdf1d('0x20')]};});_0x5e37b9=qs[_0xdf1d('0x21')](_0x136421,_0x3ebf06);var _0x4a5459={'where':_0x5e37b9['where']};return db['WhatsappQueue']['count'](_0x4a5459)[_0xdf1d('0x18')](function(_0x19819e){_0x377992['count']=_0x19819e;_0x5e37b9[_0xdf1d('0x22')]=qs[_0xdf1d('0x22')](_0x3ebf06[_0xdf1d('0x23')]);return db['WhatsappQueue'][_0xdf1d('0x24')](_0x5e37b9);})['then'](function(_0x3a0814){_0x377992[_0xdf1d('0x25')]=_0x3a0814;return _0x377992;})[_0xdf1d('0x18')](respondWithFilteredResult(_0x13d93d,_0x5e37b9))['catch'](handleError(_0x13d93d,null));};exports['show']=function(_0x1210e2,_0x187c3c){var _0x12c16c={'raw':!![],'where':{'id':_0x1210e2[_0xdf1d('0x26')]['id']}},_0x22aa2f={};_0x22aa2f[_0xdf1d('0x27')]=_[_0xdf1d('0x28')](db[_0xdf1d('0x29')][_0xdf1d('0x1e')]);_0x22aa2f[_0xdf1d('0x23')]=_[_0xdf1d('0x28')](_0x1210e2[_0xdf1d('0x23')]);_0x22aa2f[_0xdf1d('0x2a')]=_[_0xdf1d('0x2b')](_0x22aa2f[_0xdf1d('0x27')],_0x22aa2f[_0xdf1d('0x23')]);_0x12c16c[_0xdf1d('0x2c')]=_[_0xdf1d('0x2b')](_0x22aa2f[_0xdf1d('0x27')],qs[_0xdf1d('0x2d')](_0x1210e2[_0xdf1d('0x23')][_0xdf1d('0x2d')]));_0x12c16c[_0xdf1d('0x2c')]=_0x12c16c[_0xdf1d('0x2c')][_0xdf1d('0x2e')]?_0x12c16c[_0xdf1d('0x2c')]:_0x22aa2f[_0xdf1d('0x27')];if(_0x1210e2[_0xdf1d('0x23')][_0xdf1d('0x2f')]){_0x12c16c['include']=[{'all':!![]}];}_0x12c16c=_[_0xdf1d('0x30')]({},_0x12c16c,_0x1210e2[_0xdf1d('0x31')]);return db[_0xdf1d('0x29')][_0xdf1d('0x32')](_0x12c16c)['then'](handleEntityNotFound(_0x187c3c,null))[_0xdf1d('0x18')](respondWithResult(_0x187c3c,null))[_0xdf1d('0x33')](handleError(_0x187c3c,null));};exports[_0xdf1d('0x34')]=function(_0x9245ee,_0x55471d){return db[_0xdf1d('0x29')][_0xdf1d('0x34')](_0x9245ee[_0xdf1d('0x35')],{})[_0xdf1d('0x18')](function(_0x5d0e29){var _0x581400=_0x9245ee[_0xdf1d('0x36')][_0xdf1d('0x15')]({'plain':!![]});if(!_0x581400)throw new Error(_0xdf1d('0x37'));if(_0x581400[_0xdf1d('0x38')]===_0xdf1d('0x36')){var _0x80e33a=_0x5d0e29[_0xdf1d('0x15')]({'plain':!![]});var _0xd79601=_0xdf1d('0x16');return db[_0xdf1d('0x39')]['find']({'where':{'name':_0xd79601,'userProfileId':_0x581400[_0xdf1d('0x3a')]},'raw':!![]})['then'](function(_0x210286){if(_0x210286&&_0x210286[_0xdf1d('0x3b')]===0x0){return db[_0xdf1d('0x17')][_0xdf1d('0x34')]({'name':_0x80e33a[_0xdf1d('0x1a')],'resourceId':_0x80e33a['id'],'type':_0x210286[_0xdf1d('0x1a')],'sectionId':_0x210286['id']},{})[_0xdf1d('0x18')](function(){return _0x5d0e29;});}else{return _0x5d0e29;}})[_0xdf1d('0x33')](function(_0x1d120c){logger['error'](_0xdf1d('0x3c'),_0x1d120c);throw _0x1d120c;});}return _0x5d0e29;})[_0xdf1d('0x18')](respondWithResult(_0x55471d,0xc9))[_0xdf1d('0x33')](handleError(_0x55471d,null));};exports[_0xdf1d('0x13')]=function(_0xe61801,_0x23a251){if(_0xe61801[_0xdf1d('0x35')]['id']){delete _0xe61801['body']['id'];}return db[_0xdf1d('0x29')]['find']({'where':{'id':_0xe61801[_0xdf1d('0x26')]['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x23a251,null))['then'](saveUpdates(_0xe61801[_0xdf1d('0x35')],null))[_0xdf1d('0x18')](respondWithResult(_0x23a251,null))['catch'](handleError(_0x23a251,null));};exports['destroy']=function(_0x354764,_0x30c2ec){return db[_0xdf1d('0x29')][_0xdf1d('0x32')]({'where':{'id':_0x354764['params']['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x30c2ec,null))[_0xdf1d('0x18')](removeEntity(_0x30c2ec,null))[_0xdf1d('0x33')](handleError(_0x30c2ec,null));};exports[_0xdf1d('0x3d')]=function(_0x3776ee,_0xebc9ba){return db[_0xdf1d('0x29')]['describe']()[_0xdf1d('0x18')](respondWithResult(_0xebc9ba,null))[_0xdf1d('0x33')](handleError(_0xebc9ba,null));};exports[_0xdf1d('0x3e')]=function(_0x358bd4,_0x40b01f){var _0x1a2840={'raw':!![],'where':{}},_0x333a4c={},_0x5eb967;return db[_0xdf1d('0x29')]['findOne']({'where':{'id':_0x358bd4['params']['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x40b01f,null))[_0xdf1d('0x18')](function(_0x37d502){if(_0x37d502){_0x5eb967=_0x37d502[_0xdf1d('0x15')]({'plain':!![]});_0x333a4c[_0xdf1d('0x27')]=_['keys'](db[_0xdf1d('0x3f')][_0xdf1d('0x1e')]);_0x333a4c[_0xdf1d('0x23')]=_[_0xdf1d('0x28')](_0x358bd4[_0xdf1d('0x23')]);_0x333a4c[_0xdf1d('0x2a')]=_[_0xdf1d('0x2b')](_0x333a4c[_0xdf1d('0x27')],_0x333a4c[_0xdf1d('0x23')]);_0x1a2840[_0xdf1d('0x2c')]=_['intersection'](_0x333a4c['model'],qs[_0xdf1d('0x2d')](_0x358bd4[_0xdf1d('0x23')][_0xdf1d('0x2d')]));_0x1a2840[_0xdf1d('0x2c')]=_0x1a2840[_0xdf1d('0x2c')][_0xdf1d('0x2e')]?_0x1a2840[_0xdf1d('0x2c')]:_0x333a4c[_0xdf1d('0x27')];if(!_0x358bd4[_0xdf1d('0x23')]['hasOwnProperty'](_0xdf1d('0x40'))){_0x1a2840[_0xdf1d('0x41')]=qs[_0xdf1d('0x41')](_0x358bd4[_0xdf1d('0x23')][_0xdf1d('0x41')]);_0x1a2840[_0xdf1d('0x10')]=qs[_0xdf1d('0x10')](_0x358bd4['query'][_0xdf1d('0x10')]);}_0x1a2840[_0xdf1d('0x42')]=qs['sort'](_0x358bd4[_0xdf1d('0x23')]['sort']);_0x1a2840[_0xdf1d('0x43')]=qs[_0xdf1d('0x2a')](_['pick'](_0x358bd4[_0xdf1d('0x23')],_0x333a4c[_0xdf1d('0x2a')]));_0x1a2840['where'][_0xdf1d('0x44')]=_0x37d502['id'];if(_0x358bd4[_0xdf1d('0x23')][_0xdf1d('0x45')]){_0x1a2840[_0xdf1d('0x43')]=_[_0xdf1d('0x30')](_0x1a2840[_0xdf1d('0x43')],{'$or':_[_0xdf1d('0x1d')](_0x1a2840[_0xdf1d('0x2c')],function(_0x55aca4){var _0x57c2a1={};_0x57c2a1[_0x55aca4]={'$like':'%'+_0x358bd4['query'][_0xdf1d('0x45')]+'%'};return _0x57c2a1;})});}_0x1a2840=_['merge']({},_0x1a2840,_0x358bd4[_0xdf1d('0x31')]);return db[_0xdf1d('0x3f')]['findAll'](_0x1a2840);}})[_0xdf1d('0x18')](function(_0xb93944){if(_0xb93944){return db[_0xdf1d('0x46')][_0xdf1d('0x47')]({'where':{'id':_['map'](_0xb93944,_0xdf1d('0x48')),'role':_0xdf1d('0x49')},'attributes':['id',_0xdf1d('0x1a'),'whatsappPause','updatedAt',_0xdf1d('0x4a')]});}})[_0xdf1d('0x18')](function(_0x1ebf70){if(_0x1ebf70){return{'count':_0x1ebf70[_0xdf1d('0xf')],'rows':_[_0xdf1d('0x1d')](_0x1ebf70['rows'],function(_0x1642e2){return{'membername':_0x1642e2[_0xdf1d('0x1a')],'UserId':_0x1642e2['id'],'queue_name':_0x5eb967[_0xdf1d('0x1a')],'WhatsappQueueId':_0x5eb967['id'],'interface':util[_0xdf1d('0x4b')]('%s/%s',_0xdf1d('0x4c'),_0x1642e2[_0xdf1d('0x1a')]),'penalty':0x0,'paused':_0x1642e2['whatsappPause'],'createdAt':_0x1642e2[_0xdf1d('0x4a')],'updatedAt':_0x1642e2[_0xdf1d('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40b01f,_0x1a2840))[_0xdf1d('0x33')](handleError(_0x40b01f,null));};exports['getTeams']=function(_0x3c4be9,_0x50aeca){var _0x5cc125={};var _0x318b4c={};var _0x2ab9af;var _0x4d98d6;return db[_0xdf1d('0x29')][_0xdf1d('0x4e')]({'where':{'id':_0x3c4be9[_0xdf1d('0x26')]['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x50aeca,null))[_0xdf1d('0x18')](function(_0x402671){if(_0x402671){_0x2ab9af=_0x402671;_0x318b4c[_0xdf1d('0x27')]=_[_0xdf1d('0x28')](db[_0xdf1d('0x4f')][_0xdf1d('0x1e')]);_0x318b4c['query']=_['keys'](_0x3c4be9[_0xdf1d('0x23')]);_0x318b4c[_0xdf1d('0x2a')]=_[_0xdf1d('0x2b')](_0x318b4c[_0xdf1d('0x27')],_0x318b4c['query']);_0x5cc125[_0xdf1d('0x2c')]=_[_0xdf1d('0x2b')](_0x318b4c[_0xdf1d('0x27')],qs['fields'](_0x3c4be9['query'][_0xdf1d('0x2d')]));_0x5cc125[_0xdf1d('0x2c')]=_0x5cc125[_0xdf1d('0x2c')]['length']?_0x5cc125[_0xdf1d('0x2c')]:_0x318b4c['model'];_0x5cc125[_0xdf1d('0x42')]=qs['sort'](_0x3c4be9[_0xdf1d('0x23')]['sort']);_0x5cc125[_0xdf1d('0x43')]=qs[_0xdf1d('0x2a')](_[_0xdf1d('0x50')](_0x3c4be9[_0xdf1d('0x23')],_0x318b4c['filters']));if(_0x3c4be9['query'][_0xdf1d('0x45')]){_0x5cc125[_0xdf1d('0x43')]=_[_0xdf1d('0x30')](_0x5cc125[_0xdf1d('0x43')],{'$or':_[_0xdf1d('0x1d')](_0x5cc125[_0xdf1d('0x2c')],function(_0x644758){var _0x5e97f9={};_0x5e97f9[_0x644758]={'$like':'%'+_0x3c4be9['query'][_0xdf1d('0x45')]+'%'};return _0x5e97f9;})});}_0x5cc125=_[_0xdf1d('0x30')]({},_0x5cc125,_0x3c4be9[_0xdf1d('0x31')]);return _0x2ab9af[_0xdf1d('0x51')](_0x5cc125);}})[_0xdf1d('0x18')](function(_0x46acc5){if(_0x46acc5){_0x4d98d6=_0x46acc5['length'];if(!_0x3c4be9[_0xdf1d('0x23')][_0xdf1d('0x52')](_0xdf1d('0x40'))){_0x5cc125['limit']=qs['limit'](_0x3c4be9[_0xdf1d('0x23')][_0xdf1d('0x41')]);_0x5cc125[_0xdf1d('0x10')]=qs[_0xdf1d('0x10')](_0x3c4be9[_0xdf1d('0x23')][_0xdf1d('0x10')]);}return _0x2ab9af[_0xdf1d('0x51')](_0x5cc125);}})[_0xdf1d('0x18')](function(_0x588f7a){if(_0x588f7a){return _0x588f7a?{'count':_0x4d98d6,'rows':_0x588f7a}:null;}})[_0xdf1d('0x18')](respondWithResult(_0x50aeca,null))[_0xdf1d('0x33')](handleError(_0x50aeca,null));};exports[_0xdf1d('0x53')]=function(_0x506ff2,_0x2ace51){var _0x133e4a=_0x506ff2[_0xdf1d('0x35')][_0xdf1d('0x54')];return db[_0xdf1d('0x4f')]['findAll']({'where':{'id':_0x133e4a},'attributes':['id'],'include':[{'model':db[_0xdf1d('0x46')],'as':'Agents','attributes':['id',_0xdf1d('0x1a'),_0xdf1d('0x55'),_0xdf1d('0x56'),_0xdf1d('0x57')],'raw':!![]}]})[_0xdf1d('0x18')](function(_0x39dd52){if(_0x39dd52){var _0x16cd36=_[_0xdf1d('0x58')](_0x39dd52,function(_0x21bafa){var _0x1cb01f=_0x21bafa[_0xdf1d('0x15')]({'plain':!![]});return _0x1cb01f[_0xdf1d('0x59')];});return db[_0xdf1d('0x29')][_0xdf1d('0x32')]({'where':{'id':_0x506ff2[_0xdf1d('0x26')]['id']}})['then'](function(_0x14cc72){return db[_0xdf1d('0x5a')][_0xdf1d('0x5b')](function(_0x5f0ee4){return _0x14cc72[_0xdf1d('0x53')](_0x133e4a,{'transaction':_0x5f0ee4})[_0xdf1d('0x18')](function(){return BPromise[_0xdf1d('0x5c')](_0x16cd36,function(_0x5ec7df){return db[_0xdf1d('0x3f')][_0xdf1d('0x5d')]({'where':{'UserId':_0x5ec7df['id'],'WhatsappQueueId':_0x506ff2[_0xdf1d('0x26')]['id']},'transaction':_0x5f0ee4});});})[_0xdf1d('0x18')](function(){_0x16cd36[_0xdf1d('0x5e')](function(_0x1bc0a1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x1bc0a1['id'],'WhatsappQueueId':_0x14cc72['id']});});});});});}})[_0xdf1d('0x18')](respondWithStatusCode(_0x2ace51,null))[_0xdf1d('0x33')](handleError(_0x2ace51,null));};exports[_0xdf1d('0x5f')]=function(_0x1e0f1f,_0x3ef0cd){return db['Team']['findAll']({'where':{'id':_0x1e0f1f[_0xdf1d('0x23')][_0xdf1d('0x54')]},'attributes':['id'],'include':[{'model':db[_0xdf1d('0x46')],'as':_0xdf1d('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ef0cd,null))[_0xdf1d('0x18')](function(_0x49dcae){var _0x315a40=_['map'](_0x49dcae,'id');var _0x37ae80=[];var _0x4836b5=[];var _0x2cf3d5=squel['select']();_0x2cf3d5['field'](_0xdf1d('0x60'))[_0xdf1d('0x61')](_0xdf1d('0x62'),'tq')[_0xdf1d('0x63')](_0xdf1d('0x64'),'ut',_0xdf1d('0x65'))[_0xdf1d('0x43')](_0xdf1d('0x66'),_0x1e0f1f[_0xdf1d('0x26')]['id']);for(var _0x6e99a9=0x0;_0x6e99a9<_0x49dcae[_0xdf1d('0x2e')];_0x6e99a9+=0x1){let _0x1fd401=_0x49dcae[_0x6e99a9];for(var _0x24e4e0=0x0;_0x24e4e0<_0x1fd401[_0xdf1d('0x59')][_0xdf1d('0x2e')];_0x24e4e0+=0x1){let _0x397c81=_0x1fd401[_0xdf1d('0x59')][_0x24e4e0];var _0x24ee15=_0x2cf3d5['clone']();_0x24ee15[_0xdf1d('0x43')](_0xdf1d('0x67'),_0x397c81['id']);_0x4836b5['push'](db[_0xdf1d('0x5a')][_0xdf1d('0x23')](_0x24ee15['toString'](),{'type':db['sequelize'][_0xdf1d('0x68')][_0xdf1d('0x69')]})[_0xdf1d('0x18')](function(_0x2e97fd){if(_0x2e97fd['length']===0x1){return _0x397c81['id'];}else{var _0x37733=_[_0xdf1d('0x6a')](_['map'](_0x2e97fd,_0xdf1d('0x6b')),function(_0x35c677){return _[_0xdf1d('0x6c')](_0x315a40,_0x35c677);});if(_0x37733){return _0x397c81['id'];}}}));}}return BPromise[_0xdf1d('0x6d')](_0x4836b5)[_0xdf1d('0x18')](function(_0x349e98){_0x37ae80=_(_0x37ae80)[_0xdf1d('0x6e')](_0x349e98)['compact']()[_0xdf1d('0x6f')]();return db[_0xdf1d('0x29')]['find']({'where':{'id':_0x1e0f1f['params']['id']}})['then'](function(_0x255f7c){return db[_0xdf1d('0x5a')][_0xdf1d('0x5b')](function(_0x4cd564){return _0x255f7c[_0xdf1d('0x5f')](_0x1e0f1f[_0xdf1d('0x23')][_0xdf1d('0x54')],{'transaction':_0x4cd564})[_0xdf1d('0x18')](function(){if(!_[_0xdf1d('0x70')](_0x37ae80)){return _0x255f7c['removeAgents'](_0x37ae80,{'transaction':_0x4cd564});}})[_0xdf1d('0x18')](function(){_0x37ae80[_0xdf1d('0x5e')](function(_0x552104){socket[_0xdf1d('0x71')](_0xdf1d('0x72'),{'UserId':_0x552104,'WhatsappQueueId':_0x255f7c['id']});});});});});});})[_0xdf1d('0x18')](respondWithStatusCode(_0x3ef0cd,null))[_0xdf1d('0x33')](handleError(_0x3ef0cd,null));};exports[_0xdf1d('0x73')]=function(_0x42b066,_0x58e5b9){return db[_0xdf1d('0x29')][_0xdf1d('0x32')]({'where':{'id':_0x42b066[_0xdf1d('0x26')]['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x58e5b9,null))[_0xdf1d('0x18')](function(_0x192990){if(_0x192990){return _0x192990['addAgents'](_0x42b066[_0xdf1d('0x35')]['ids'],_[_0xdf1d('0x74')](_0x42b066[_0xdf1d('0x35')],[_0xdf1d('0x54'),'id'])||{})[_0xdf1d('0x75')](function(_0x449035){for(var _0x4d8006=0x0;_0x4d8006<_0x42b066['body']['ids']['length'];_0x4d8006+=0x1){socket[_0xdf1d('0x71')](_0xdf1d('0x76'),{'UserId':Number(_0x42b066[_0xdf1d('0x35')][_0xdf1d('0x54')][_0x4d8006]),'WhatsappQueueId':Number(_0x42b066[_0xdf1d('0x26')]['id'])});}return _0x449035;});}})[_0xdf1d('0x18')](respondWithResult(_0x58e5b9,null))[_0xdf1d('0x33')](handleError(_0x58e5b9,null));};exports[_0xdf1d('0x77')]=function(_0x54332f,_0x1a17f8){return db['WhatsappQueue'][_0xdf1d('0x32')]({'where':{'id':_0x54332f[_0xdf1d('0x26')]['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x1a17f8,null))[_0xdf1d('0x18')](function(_0x48f204){if(_0x48f204){return _0x48f204[_0xdf1d('0x77')](_0x54332f[_0xdf1d('0x23')][_0xdf1d('0x54')])[_0xdf1d('0x18')](function(){if(_['isArray'](_0x54332f[_0xdf1d('0x23')]['ids'])){for(var _0x4357c9=0x0;_0x4357c9<_0x54332f[_0xdf1d('0x23')][_0xdf1d('0x54')][_0xdf1d('0x2e')];_0x4357c9+=0x1){socket['emit'](_0xdf1d('0x72'),{'UserId':Number(_0x54332f['query']['ids'][_0x4357c9]),'WhatsappQueueId':Number(_0x54332f[_0xdf1d('0x26')]['id'])});}}else{socket[_0xdf1d('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x54332f[_0xdf1d('0x23')]['ids']),'WhatsappQueueId':Number(_0x54332f['params']['id'])});}});}})[_0xdf1d('0x18')](respondWithStatusCode(_0x1a17f8,null))['catch'](handleError(_0x1a17f8,null));};exports[_0xdf1d('0x78')]=function(_0x5449ff,_0x125978){var _0x73b45b={};var _0xbff000={};var _0x2a1239;var _0x1b8251;return db[_0xdf1d('0x29')][_0xdf1d('0x4e')]({'where':{'id':_0x5449ff['params']['id']}})[_0xdf1d('0x18')](handleEntityNotFound(_0x125978,null))[_0xdf1d('0x18')](function(_0x5c4c64){if(_0x5c4c64){_0x2a1239=_0x5c4c64;_0xbff000['model']=_[_0xdf1d('0x28')](db[_0xdf1d('0x46')][_0xdf1d('0x1e')]);_0xbff000[_0xdf1d('0x23')]=_['keys'](_0x5449ff[_0xdf1d('0x23')]);_0xbff000[_0xdf1d('0x2a')]=_['intersection'](_0xbff000[_0xdf1d('0x27')],_0xbff000['query']);_0x73b45b[_0xdf1d('0x2c')]=_[_0xdf1d('0x2b')](_0xbff000[_0xdf1d('0x27')],qs[_0xdf1d('0x2d')](_0x5449ff[_0xdf1d('0x23')]['fields']));_0x73b45b[_0xdf1d('0x2c')]=_0x73b45b[_0xdf1d('0x2c')][_0xdf1d('0x2e')]?_0x73b45b[_0xdf1d('0x2c')]:_0xbff000[_0xdf1d('0x27')];_0x73b45b[_0xdf1d('0x42')]=qs['sort'](_0x5449ff[_0xdf1d('0x23')][_0xdf1d('0x79')]);_0x73b45b['where']=qs[_0xdf1d('0x2a')](_[_0xdf1d('0x50')](_0x5449ff[_0xdf1d('0x23')],_0xbff000[_0xdf1d('0x2a')]));if(_0x5449ff[_0xdf1d('0x23')][_0xdf1d('0x45')]){_0x73b45b[_0xdf1d('0x43')]=_[_0xdf1d('0x30')](_0x73b45b[_0xdf1d('0x43')],{'$or':_[_0xdf1d('0x1d')](_0x73b45b['attributes'],function(_0x2313de){var _0x54ab9c={};_0x54ab9c[_0x2313de]={'$like':'%'+_0x5449ff[_0xdf1d('0x23')]['filter']+'%'};return _0x54ab9c;})});}_0x73b45b=_[_0xdf1d('0x30')]({},_0x73b45b,_0x5449ff[_0xdf1d('0x31')]);return _0x2a1239[_0xdf1d('0x78')](_0x73b45b);}})['then'](function(_0x3308d1){if(_0x3308d1){_0x1b8251=_0x3308d1[_0xdf1d('0x2e')];if(!_0x5449ff[_0xdf1d('0x23')][_0xdf1d('0x52')](_0xdf1d('0x40'))){_0x73b45b['limit']=qs['limit'](_0x5449ff[_0xdf1d('0x23')][_0xdf1d('0x41')]);_0x73b45b[_0xdf1d('0x10')]=qs['offset'](_0x5449ff[_0xdf1d('0x23')]['offset']);}return _0x2a1239[_0xdf1d('0x78')](_0x73b45b);}})['then'](function(_0x454c22){if(_0x454c22){return _0x454c22?{'count':_0x1b8251,'rows':_0x454c22}:null;}})[_0xdf1d('0x18')](respondWithResult(_0x125978,null))[_0xdf1d('0x33')](handleError(_0x125978,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a63bbde..5f3fd71 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 _0x4a27=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x41ea8b,_0x2842c4){var _0x4e3e6a=function(_0x5dab34){while(--_0x5dab34){_0x41ea8b['push'](_0x41ea8b['shift']());}};_0x4e3e6a(++_0x2842c4);}(_0x4a27,0x1b7));var _0x74a2=function(_0x2969a3,_0x801e59){_0x2969a3=_0x2969a3-0x0;var _0x40f909=_0x4a27[_0x2969a3];return _0x40f909;};'use strict';var EventEmitter=require(_0x74a2('0x0'));var WhatsappQueue=require(_0x74a2('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x74a2('0x2')](0x0);var events={'afterCreate':_0x74a2('0x3'),'afterUpdate':'update','afterDestroy':_0x74a2('0x4')};function emitEvent(_0x4944fe){return function(_0x32c502,_0x562007,_0x57edd6){WhatsappQueueEvents[_0x74a2('0x5')](_0x4944fe+':'+_0x32c502['id'],_0x32c502);WhatsappQueueEvents[_0x74a2('0x5')](_0x4944fe,_0x32c502);_0x57edd6(null);};}for(var e in events){if(events[_0x74a2('0x6')](e)){var event=events[e];WhatsappQueue[_0x74a2('0x7')](e,emitEvent(event));}}module[_0x74a2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xed76=['emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x25c714,_0x42c526){var _0x5e6ce9=function(_0xbc07b9){while(--_0xbc07b9){_0x25c714['push'](_0x25c714['shift']());}};_0x5e6ce9(++_0x42c526);}(_0xed76,0x9a));var _0x6ed7=function(_0x2c6270,_0x2cbbf1){_0x2c6270=_0x2c6270-0x0;var _0x414bc3=_0xed76[_0x2c6270];return _0x414bc3;};'use strict';var EventEmitter=require(_0x6ed7('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6ed7('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6ed7('0x2')](0x0);var events={'afterCreate':_0x6ed7('0x3'),'afterUpdate':_0x6ed7('0x4'),'afterDestroy':_0x6ed7('0x5')};function emitEvent(_0x23a783){return function(_0x1ca754,_0x2ba867,_0x2e5c97){WhatsappQueueEvents[_0x6ed7('0x6')](_0x23a783+':'+_0x1ca754['id'],_0x1ca754);WhatsappQueueEvents['emit'](_0x23a783,_0x1ca754);_0x2e5c97(null);};}for(var e in events){if(events[_0x6ed7('0x7')](e)){var event=events[e];WhatsappQueue[_0x6ed7('0x8')](e,emitEvent(event));}}module[_0x6ed7('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index de9be73..ba2cb3d 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 _0xbfca=['util','../../config/logger','moment','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues'];(function(_0xfbbc8b,_0xce223f){var _0x2a4175=function(_0x328a58){while(--_0x328a58){_0xfbbc8b['push'](_0xfbbc8b['shift']());}};_0x2a4175(++_0xce223f);}(_0xbfca,0x190));var _0xabfc=function(_0x238825,_0x5e1931){_0x238825=_0x238825-0x0;var _0x3724a4=_0xbfca[_0x238825];return _0x3724a4;};'use strict';var _=require('lodash');var util=require(_0xabfc('0x0'));var logger=require(_0xabfc('0x1'))('api');var moment=require(_0xabfc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabfc('0x3'));var rimraf=require(_0xabfc('0x4'));var config=require(_0xabfc('0x5'));var attributes=require(_0xabfc('0x6'));module[_0xabfc('0x7')]=function(_0x4d10d6,_0x53e0f7){return _0x4d10d6[_0xabfc('0x8')]('WhatsappQueue',attributes,{'tableName':_0xabfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x845b=['./whatsappQueue.attributes','exports','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x37b1d8,_0x614312){var _0x3739e7=function(_0x15a5bb){while(--_0x15a5bb){_0x37b1d8['push'](_0x37b1d8['shift']());}};_0x3739e7(++_0x614312);}(_0x845b,0x161));var _0xb845=function(_0x41b8fa,_0x5b9877){_0x41b8fa=_0x41b8fa-0x0;var _0x5ba5aa=_0x845b[_0x41b8fa];return _0x5ba5aa;};'use strict';var _=require(_0xb845('0x0'));var util=require('util');var logger=require(_0xb845('0x1'))(_0xb845('0x2'));var moment=require('moment');var BPromise=require(_0xb845('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb845('0x4'));var rimraf=require(_0xb845('0x5'));var config=require(_0xb845('0x6'));var attributes=require(_0xb845('0x7'));module[_0xb845('0x8')]=function(_0x248073,_0x4851b2){return _0x248073['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 1620d71..8517db0 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 _0x0201=['WhatsappQueue','options','raw','where','attributes','include','map','model','catch','find','then','ShowWhatsappQueue','lodash','bluebird','randomstring','../../config/utils','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','info','result','GetWhatsappQueue'];(function(_0x52be3a,_0x4c9e7a){var _0xc6a151=function(_0xcbd150){while(--_0xcbd150){_0x52be3a['push'](_0x52be3a['shift']());}};_0xc6a151(++_0x4c9e7a);}(_0x0201,0x182));var _0x1020=function(_0x512058,_0x2d1bfb){_0x512058=_0x512058-0x0;var _0x289456=_0x0201[_0x512058];return _0x289456;};'use strict';var _=require(_0x1020('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1020('0x1'));var rs=require(_0x1020('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1020('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1020('0x4')]({'port':0x232a});config[_0x1020('0x5')]=_[_0x1020('0x6')](config[_0x1020('0x5')],{'host':_0x1020('0x7'),'port':0x18eb});var socket=require(_0x1020('0x8'))(new Redis(config[_0x1020('0x5')]));require(_0x1020('0x9'))[_0x1020('0xa')](socket);function respondWithRpcPromise(_0x5bd9cf,_0x28b991,_0x3f6a6d){return new BPromise(function(_0x2eebaf,_0x28cb06){return client['request'](_0x5bd9cf,_0x3f6a6d)['then'](function(_0x118a1a){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x28b991,_0x1020('0xb'));logger[_0x1020('0xc')](_0x1020('0xd'),_0x28b991,_0x1020('0xb'),JSON[_0x1020('0xe')](_0x118a1a));if(_0x118a1a[_0x1020('0xf')]){if(_0x118a1a[_0x1020('0xf')][_0x1020('0x10')]===0x1f4){logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x118a1a[_0x1020('0xf')][_0x1020('0x12')]);return _0x28cb06(_0x118a1a['error'][_0x1020('0x12')]);}logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x118a1a[_0x1020('0xf')]['message']);return _0x2eebaf(_0x118a1a[_0x1020('0xf')][_0x1020('0x12')]);}else{logger[_0x1020('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x28b991,_0x1020('0xb'));_0x2eebaf(_0x118a1a[_0x1020('0x14')][_0x1020('0x12')]);}})['catch'](function(_0x4a999b){logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x4a999b);_0x28cb06(_0x4a999b);});});}exports[_0x1020('0x15')]=function(_0x118a13){var _0x436b51=this;return new Promise(function(_0x15731d,_0x55c034){return db[_0x1020('0x16')]['findAll']({'raw':_0x118a13[_0x1020('0x17')]?_0x118a13[_0x1020('0x17')][_0x1020('0x18')]===undefined?!![]:![]:!![],'where':_0x118a13[_0x1020('0x17')]?_0x118a13[_0x1020('0x17')][_0x1020('0x19')]||null:null,'attributes':_0x118a13[_0x1020('0x17')]?_0x118a13['options'][_0x1020('0x1a')]||null:null,'limit':_0x118a13[_0x1020('0x17')]?_0x118a13['options']['limit']||null:null,'include':_0x118a13[_0x1020('0x17')]?_0x118a13['options'][_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x118a13[_0x1020('0x17')][_0x1020('0x1b')],function(_0x36b58b){return{'model':db[_0x36b58b['model']],'as':_0x36b58b['as'],'attributes':_0x36b58b[_0x1020('0x1a')],'include':_0x36b58b['include']?_[_0x1020('0x1c')](_0x36b58b[_0x1020('0x1b')],function(_0x4bd38e){return{'model':db[_0x4bd38e[_0x1020('0x1d')]],'as':_0x4bd38e['as'],'attributes':_0x4bd38e[_0x1020('0x1a')],'include':_0x4bd38e[_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x4bd38e[_0x1020('0x1b')],function(_0x5eed92){return{'model':db[_0x5eed92[_0x1020('0x1d')]],'as':_0x5eed92['as'],'attributes':_0x5eed92[_0x1020('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe81fa){logger[_0x1020('0x13')](_0x1020('0x15'),_0x118a13);logger['debug'](_0x1020('0x15'),_0x118a13,JSON[_0x1020('0xe')](_0xfe81fa));_0x15731d(_0xfe81fa);})[_0x1020('0x1e')](function(_0x167eca){logger[_0x1020('0xf')]('GetWhatsappQueue',_0x167eca[_0x1020('0x12')],_0x118a13);_0x55c034(_0x436b51[_0x1020('0xf')](0x1f4,_0x167eca[_0x1020('0x12')]));});});};exports['ShowWhatsappQueue']=function(_0x19973b){var _0x4ac15e=this;return new Promise(function(_0x3dc903,_0x30299c){return db[_0x1020('0x16')][_0x1020('0x1f')]({'raw':_0x19973b['options']?_0x19973b[_0x1020('0x17')][_0x1020('0x18')]===undefined?!![]:![]:!![],'where':_0x19973b[_0x1020('0x17')]?_0x19973b[_0x1020('0x17')][_0x1020('0x19')]||null:null,'attributes':_0x19973b[_0x1020('0x17')]?_0x19973b[_0x1020('0x17')][_0x1020('0x1a')]||null:null,'include':_0x19973b['options']?_0x19973b['options'][_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x19973b[_0x1020('0x17')]['include'],function(_0x5ca493){return{'model':db[_0x5ca493[_0x1020('0x1d')]],'as':_0x5ca493['as'],'attributes':_0x5ca493['attributes'],'include':_0x5ca493[_0x1020('0x1b')]?_['map'](_0x5ca493[_0x1020('0x1b')],function(_0x4e2de2){return{'model':db[_0x4e2de2['model']],'as':_0x4e2de2['as'],'attributes':_0x4e2de2[_0x1020('0x1a')],'include':_0x4e2de2[_0x1020('0x1b')]?_['map'](_0x4e2de2['include'],function(_0x20c499){return{'model':db[_0x20c499['model']],'as':_0x20c499['as'],'attributes':_0x20c499[_0x1020('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1020('0x20')](function(_0x187ecb){logger[_0x1020('0x13')](_0x1020('0x21'),_0x19973b);logger[_0x1020('0xc')]('ShowWhatsappQueue',_0x19973b,JSON['stringify'](_0x187ecb));_0x3dc903(_0x187ecb);})['catch'](function(_0x1f3a04){logger['error']('ShowWhatsappQueue',_0x1f3a04[_0x1020('0x12')],_0x19973b);_0x30299c(_0x4ac15e['error'](0x1f4,_0x1f3a04[_0x1020('0x12')]));});});}; \ No newline at end of file +var _0xc146=['findAll','options','where','attributes','limit','include','map','model','then','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','info','request\x20sent','debug','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue'];(function(_0x52cc4e,_0x59b827){var _0x53a5c7=function(_0x33305f){while(--_0x33305f){_0x52cc4e['push'](_0x52cc4e['shift']());}};_0x53a5c7(++_0x59b827);}(_0xc146,0x17e));var _0x6c14=function(_0x18214f,_0x27af7c){_0x18214f=_0x18214f-0x0;var _0x5a5374=_0xc146[_0x18214f];return _0x5a5374;};'use strict';var _=require(_0x6c14('0x0'));var util=require(_0x6c14('0x1'));var moment=require(_0x6c14('0x2'));var BPromise=require(_0x6c14('0x3'));var rs=require(_0x6c14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c14('0x6'))('rpc');var config=require(_0x6c14('0x7'));var jayson=require(_0x6c14('0x8'));var client=jayson['client'][_0x6c14('0x9')]({'port':0x232a});config[_0x6c14('0xa')]=_[_0x6c14('0xb')](config['redis'],{'host':_0x6c14('0xc'),'port':0x18eb});var socket=require(_0x6c14('0xd'))(new Redis(config[_0x6c14('0xa')]));require(_0x6c14('0xe'))['register'](socket);function respondWithRpcPromise(_0x40895d,_0x761f58,_0x4ab8e3){return new BPromise(function(_0x4514ea,_0x1eaadc){return client['request'](_0x40895d,_0x4ab8e3)['then'](function(_0x12c0f3){logger[_0x6c14('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x761f58,_0x6c14('0x10'));logger[_0x6c14('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x761f58,_0x6c14('0x10'),JSON[_0x6c14('0x12')](_0x12c0f3));if(_0x12c0f3[_0x6c14('0x13')]){if(_0x12c0f3[_0x6c14('0x13')]['code']===0x1f4){logger[_0x6c14('0x13')](_0x6c14('0x14'),_0x761f58,_0x12c0f3[_0x6c14('0x13')][_0x6c14('0x15')]);return _0x1eaadc(_0x12c0f3[_0x6c14('0x13')]['message']);}logger[_0x6c14('0x13')](_0x6c14('0x14'),_0x761f58,_0x12c0f3['error'][_0x6c14('0x15')]);return _0x4514ea(_0x12c0f3[_0x6c14('0x13')]['message']);}else{logger[_0x6c14('0xf')](_0x6c14('0x14'),_0x761f58,'request\x20sent');_0x4514ea(_0x12c0f3[_0x6c14('0x16')][_0x6c14('0x15')]);}})[_0x6c14('0x17')](function(_0x1884ac){logger['error'](_0x6c14('0x14'),_0x761f58,_0x1884ac);_0x1eaadc(_0x1884ac);});});}exports[_0x6c14('0x18')]=function(_0x4cf4dd){var _0x1d42ea=this;return new Promise(function(_0x359ba3,_0x2ca8b8){return db['WhatsappQueue'][_0x6c14('0x19')]({'raw':_0x4cf4dd['options']?_0x4cf4dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cf4dd[_0x6c14('0x1a')]?_0x4cf4dd[_0x6c14('0x1a')][_0x6c14('0x1b')]||null:null,'attributes':_0x4cf4dd[_0x6c14('0x1a')]?_0x4cf4dd[_0x6c14('0x1a')][_0x6c14('0x1c')]||null:null,'limit':_0x4cf4dd['options']?_0x4cf4dd[_0x6c14('0x1a')][_0x6c14('0x1d')]||null:null,'include':_0x4cf4dd[_0x6c14('0x1a')]?_0x4cf4dd['options'][_0x6c14('0x1e')]?_[_0x6c14('0x1f')](_0x4cf4dd[_0x6c14('0x1a')]['include'],function(_0x9c4321){return{'model':db[_0x9c4321[_0x6c14('0x20')]],'as':_0x9c4321['as'],'attributes':_0x9c4321[_0x6c14('0x1c')],'include':_0x9c4321[_0x6c14('0x1e')]?_[_0x6c14('0x1f')](_0x9c4321[_0x6c14('0x1e')],function(_0x4fb044){return{'model':db[_0x4fb044['model']],'as':_0x4fb044['as'],'attributes':_0x4fb044['attributes'],'include':_0x4fb044[_0x6c14('0x1e')]?_[_0x6c14('0x1f')](_0x4fb044[_0x6c14('0x1e')],function(_0x4af48e){return{'model':db[_0x4af48e[_0x6c14('0x20')]],'as':_0x4af48e['as'],'attributes':_0x4af48e[_0x6c14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c14('0x21')](function(_0x3f22b5){logger[_0x6c14('0xf')]('GetWhatsappQueue',_0x4cf4dd);logger['debug'](_0x6c14('0x18'),_0x4cf4dd,JSON[_0x6c14('0x12')](_0x3f22b5));_0x359ba3(_0x3f22b5);})['catch'](function(_0x10dc2a){logger[_0x6c14('0x13')](_0x6c14('0x18'),_0x10dc2a['message'],_0x4cf4dd);_0x2ca8b8(_0x1d42ea[_0x6c14('0x13')](0x1f4,_0x10dc2a[_0x6c14('0x15')]));});});};exports[_0x6c14('0x22')]=function(_0x5db249){var _0x1d4258=this;return new Promise(function(_0x6e4b22,_0x36a245){return db[_0x6c14('0x23')][_0x6c14('0x24')]({'raw':_0x5db249[_0x6c14('0x1a')]?_0x5db249[_0x6c14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5db249[_0x6c14('0x1a')]?_0x5db249['options']['where']||null:null,'attributes':_0x5db249[_0x6c14('0x1a')]?_0x5db249[_0x6c14('0x1a')][_0x6c14('0x1c')]||null:null,'include':_0x5db249['options']?_0x5db249['options']['include']?_[_0x6c14('0x1f')](_0x5db249[_0x6c14('0x1a')][_0x6c14('0x1e')],function(_0x4e8da8){return{'model':db[_0x4e8da8[_0x6c14('0x20')]],'as':_0x4e8da8['as'],'attributes':_0x4e8da8[_0x6c14('0x1c')],'include':_0x4e8da8[_0x6c14('0x1e')]?_[_0x6c14('0x1f')](_0x4e8da8[_0x6c14('0x1e')],function(_0x3a6662){return{'model':db[_0x3a6662[_0x6c14('0x20')]],'as':_0x3a6662['as'],'attributes':_0x3a6662[_0x6c14('0x1c')],'include':_0x3a6662['include']?_[_0x6c14('0x1f')](_0x3a6662[_0x6c14('0x1e')],function(_0x23d430){return{'model':db[_0x23d430[_0x6c14('0x20')]],'as':_0x23d430['as'],'attributes':_0x23d430[_0x6c14('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ba36a){logger[_0x6c14('0xf')](_0x6c14('0x22'),_0x5db249);logger[_0x6c14('0x11')](_0x6c14('0x22'),_0x5db249,JSON[_0x6c14('0x12')](_0x3ba36a));_0x6e4b22(_0x3ba36a);})[_0x6c14('0x17')](function(_0x5234d4){logger['error'](_0x6c14('0x22'),_0x5234d4['message'],_0x5db249);_0x36a245(_0x1d4258['error'](0x1f4,_0x5234d4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index efe6d9f..625ac3d 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 _0x5d19=['update','emit','removeListener','register','./whatsappQueue.events','save','remove'];(function(_0x4c6550,_0x15cea5){var _0x5dc57a=function(_0xe43ed4){while(--_0xe43ed4){_0x4c6550['push'](_0x4c6550['shift']());}};_0x5dc57a(++_0x15cea5);}(_0x5d19,0x1c4));var _0x95d1=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x5d19[_0x90a39a];return _0x2b62f7;};'use strict';var WhatsappQueueEvents=require(_0x95d1('0x0'));var events=[_0x95d1('0x1'),_0x95d1('0x2'),_0x95d1('0x3')];function createListener(_0x49f616,_0x2dd834){return function(_0x46abbe){_0x2dd834[_0x95d1('0x4')](_0x49f616,_0x46abbe);};}function removeListener(_0x425dd2,_0x11e49c){return function(){WhatsappQueueEvents[_0x95d1('0x5')](_0x425dd2,_0x11e49c);};}exports[_0x95d1('0x6')]=function(_0xc12798){for(var _0x560607=0x0,_0x538e6a=events['length'];_0x560607<_0x538e6a;_0x560607++){var _0x48320c=events[_0x560607];var _0x4856ca=createListener('whatsappQueue:'+_0x48320c,_0xc12798);WhatsappQueueEvents['on'](_0x48320c,_0x4856ca);}}; \ No newline at end of file +var _0x386a=['whatsappQueue:','remove','update','emit','removeListener','register','length'];(function(_0x2f93d3,_0x26788c){var _0x9e7106=function(_0x5bc28b){while(--_0x5bc28b){_0x2f93d3['push'](_0x2f93d3['shift']());}};_0x9e7106(++_0x26788c);}(_0x386a,0x197));var _0xa386=function(_0x5b523c,_0x13398e){_0x5b523c=_0x5b523c-0x0;var _0x48ece8=_0x386a[_0x5b523c];return _0x48ece8;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xa386('0x0'),_0xa386('0x1')];function createListener(_0x391e62,_0x2e54f4){return function(_0x2e3b73){_0x2e54f4[_0xa386('0x2')](_0x391e62,_0x2e3b73);};}function removeListener(_0xb49aa,_0x7dae57){return function(){WhatsappQueueEvents[_0xa386('0x3')](_0xb49aa,_0x7dae57);};}exports[_0xa386('0x4')]=function(_0x1b294d){for(var _0x1a1c6a=0x0,_0x326efe=events[_0xa386('0x5')];_0x1a1c6a<_0x326efe;_0x1a1c6a++){var _0x20ebf6=events[_0x1a1c6a];var _0x15aac6=createListener(_0xa386('0x6')+_0x20ebf6,_0x1b294d);WhatsappQueueEvents['on'](_0x20ebf6,_0x15aac6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 91dbcc6..171718e 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 _0xbb56=['isAuthenticated','index','get','/describe','/:id','show','create','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0xa9d39f,_0x4d85cd){var _0x4e306f=function(_0x52b7bc){while(--_0x52b7bc){_0xa9d39f['push'](_0xa9d39f['shift']());}};_0x4e306f(++_0x4d85cd);}(_0xbb56,0x13b));var _0x6bb5=function(_0x291086,_0x5b7274){_0x291086=_0x291086-0x0;var _0xe42533=_0xbb56[_0x291086];return _0xe42533;};'use strict';var multer=require(_0x6bb5('0x0'));var util=require('util');var path=require(_0x6bb5('0x1'));var timeout=require(_0x6bb5('0x2'));var express=require(_0x6bb5('0x3'));var router=express[_0x6bb5('0x4')]();var fs_extra=require(_0x6bb5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6bb5('0x6'));var config=require(_0x6bb5('0x7'));var controller=require(_0x6bb5('0x8'));router['get']('/',auth[_0x6bb5('0x9')](),controller[_0x6bb5('0xa')]);router[_0x6bb5('0xb')](_0x6bb5('0xc'),auth[_0x6bb5('0x9')](),controller['describe']);router[_0x6bb5('0xb')](_0x6bb5('0xd'),auth['isAuthenticated'](),controller[_0x6bb5('0xe')]);router['post']('/',auth[_0x6bb5('0x9')](),controller[_0x6bb5('0xf')]);router[_0x6bb5('0x10')](_0x6bb5('0xd'),auth[_0x6bb5('0x9')](),controller[_0x6bb5('0x11')]);router['delete'](_0x6bb5('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa17d=['index','describe','/:id','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x3cb530,_0x170e8c){var _0x4168ea=function(_0x83990a){while(--_0x83990a){_0x3cb530['push'](_0x3cb530['shift']());}};_0x4168ea(++_0x170e8c);}(_0xa17d,0x8d));var _0xda17=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0xa17d[_0x9db5d3];return _0x477a81;};'use strict';var multer=require(_0xda17('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda17('0x1'));var express=require(_0xda17('0x2'));var router=express[_0xda17('0x3')]();var fs_extra=require(_0xda17('0x4'));var auth=require(_0xda17('0x5'));var interaction=require(_0xda17('0x6'));var config=require(_0xda17('0x7'));var controller=require(_0xda17('0x8'));router[_0xda17('0x9')]('/',auth[_0xda17('0xa')](),controller[_0xda17('0xb')]);router[_0xda17('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xda17('0xc')]);router[_0xda17('0x9')](_0xda17('0xd'),auth[_0xda17('0xa')](),controller['show']);router['post']('/',auth[_0xda17('0xa')](),controller[_0xda17('0xe')]);router['put'](_0xda17('0xd'),auth[_0xda17('0xa')](),controller[_0xda17('0xf')]);router[_0xda17('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xda17('0x11')]);module[_0xda17('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 92e608e..022c033 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(_0x4f8c17,_0x187a28){var _0x239088=function(_0x4de7a5){while(--_0x4de7a5){_0x4f8c17['push'](_0x4f8c17['shift']());}};_0x239088(++_0x187a28);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4b30ba,_0xe7fb0){var _0x50ee59=function(_0x12139e){while(--_0x12139e){_0x4b30ba['push'](_0x4b30ba['shift']());}};_0x50ee59(++_0xe7fb0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 74b1f10..a51e9ca 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 _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject'];(function(_0x1ee44b,_0x2a6fbe){var _0x152037=function(_0x55816a){while(--_0x55816a){_0x1ee44b['push'](_0x1ee44b['shift']());}};_0x152037(++_0x2a6fbe);}(_0x9348,0x10d));var _0x8934=function(_0x5dd386,_0x5b27a6){_0x5dd386=_0x5dd386-0x0;var _0xc31bfb=_0x9348[_0x5dd386];return _0xc31bfb;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));}; \ No newline at end of file +var _0xa478=['filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys'];(function(_0x44343f,_0x5436dc){var _0x4c2cb2=function(_0xbe6647){while(--_0xbe6647){_0x44343f['push'](_0x44343f['shift']());}};_0x4c2cb2(++_0x5436dc);}(_0xa478,0x136));var _0x8a47=function(_0x469393,_0x247969){_0x469393=_0x469393-0x0;var _0x5f720d=_0xa478[_0x469393];return _0x5f720d;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e3166,_0x59efc7){_0x59efc7=_0x59efc7||0xcc;return function(_0x36941a){if(_0x36941a){return _0x5e3166[_0x8a47('0x1a')](_0x59efc7);}return _0x5e3166['status'](_0x59efc7)[_0x8a47('0x1b')]();};}function respondWithResult(_0x28bbc5,_0x1a9a6f){_0x1a9a6f=_0x1a9a6f||0xc8;return function(_0x55985c){if(_0x55985c){return _0x28bbc5[_0x8a47('0x1c')](_0x1a9a6f)[_0x8a47('0x1d')](_0x55985c);}};}function respondWithFilteredResult(_0x2f682e,_0x1c8488){return function(_0x41bdaf){if(_0x41bdaf){var _0x18f2be=typeof _0x1c8488[_0x8a47('0x1e')]===_0x8a47('0x1f')&&typeof _0x1c8488[_0x8a47('0x20')]==='undefined';var _0x20fbf7=_0x41bdaf[_0x8a47('0x21')];var _0x3f9093=_0x18f2be?0x0:_0x1c8488['offset'];var _0x341089=_0x18f2be?_0x41bdaf['count']:_0x1c8488['offset']+_0x1c8488[_0x8a47('0x20')];var _0x2174b1;if(_0x341089>=_0x20fbf7){_0x341089=_0x20fbf7;_0x2174b1=0xc8;}else{_0x2174b1=0xce;}_0x2f682e[_0x8a47('0x1c')](_0x2174b1);return _0x2f682e[_0x8a47('0x22')](_0x8a47('0x23'),_0x3f9093+'-'+_0x341089+'/'+_0x20fbf7)[_0x8a47('0x1d')](_0x41bdaf);}return null;};}function patchUpdates(_0x44e119){return function(_0x1bbed6){try{jsonpatch[_0x8a47('0x24')](_0x1bbed6,_0x44e119,!![]);}catch(_0xc2065a){return BPromise['reject'](_0xc2065a);}return _0x1bbed6[_0x8a47('0x25')]();};}function saveUpdates(_0x5923ec,_0x289f28){return function(_0x3d7993){if(_0x3d7993){return _0x3d7993[_0x8a47('0x26')](_0x5923ec)[_0x8a47('0x27')](function(_0x5d4b6c){return _0x5d4b6c;});}return null;};}function removeEntity(_0x116b5e,_0x5ae186){return function(_0x50f6ba){if(_0x50f6ba){return _0x50f6ba['destroy']()['then'](function(){_0x116b5e[_0x8a47('0x1c')](0xcc)[_0x8a47('0x1b')]();});}};}function handleEntityNotFound(_0x5bed3e,_0x2bb0d4){return function(_0xb4590d){if(!_0xb4590d){_0x5bed3e[_0x8a47('0x1a')](0x194);}return _0xb4590d;};}function handleError(_0xfb9ae0,_0x44cf20){_0x44cf20=_0x44cf20||0x1f4;return function(_0xd06be6){logger[_0x8a47('0x28')](_0xd06be6['stack']);if(_0xd06be6[_0x8a47('0x29')]){delete _0xd06be6['name'];}_0xfb9ae0[_0x8a47('0x1c')](_0x44cf20)[_0x8a47('0x2a')](_0xd06be6);};}exports['index']=function(_0x1e89b1,_0x526571){var _0x4d5d32={},_0x12470a={},_0x9b51b8={'count':0x0,'rows':[]};var _0x1ddbcf=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')][_0x8a47('0x2d')],function(_0x58aa06){return{'name':_0x58aa06[_0x8a47('0x2e')],'type':_0x58aa06['type']['key']};});_0x12470a[_0x8a47('0x2f')]=_[_0x8a47('0x2b')](_0x1ddbcf,_0x8a47('0x29'));_0x12470a[_0x8a47('0x30')]=_[_0x8a47('0x31')](_0x1e89b1[_0x8a47('0x30')]);_0x12470a[_0x8a47('0x32')]=_[_0x8a47('0x33')](_0x12470a[_0x8a47('0x2f')],_0x12470a[_0x8a47('0x30')]);_0x4d5d32['attributes']=_[_0x8a47('0x33')](_0x12470a[_0x8a47('0x2f')],qs[_0x8a47('0x34')](_0x1e89b1['query'][_0x8a47('0x34')]));_0x4d5d32[_0x8a47('0x35')]=_0x4d5d32['attributes'][_0x8a47('0x36')]?_0x4d5d32[_0x8a47('0x35')]:_0x12470a[_0x8a47('0x2f')];if(!_0x1e89b1[_0x8a47('0x30')]['hasOwnProperty']('nolimit')){_0x4d5d32[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x20')]);_0x4d5d32[_0x8a47('0x1e')]=qs[_0x8a47('0x1e')](_0x1e89b1[_0x8a47('0x30')]['offset']);}_0x4d5d32['order']=qs[_0x8a47('0x37')](_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x37')]);_0x4d5d32[_0x8a47('0x38')]=qs[_0x8a47('0x32')](_[_0x8a47('0x39')](_0x1e89b1[_0x8a47('0x30')],_0x12470a[_0x8a47('0x32')]),_0x1ddbcf);if(_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3a')]){_0x4d5d32[_0x8a47('0x38')]=_['merge'](_0x4d5d32[_0x8a47('0x38')],{'$or':_['map'](_0x1ddbcf,function(_0x541832){if(_0x541832['type']!=='VIRTUAL'){var _0x57d38e={};_0x57d38e[_0x541832[_0x8a47('0x29')]]={'$like':'%'+_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3a')]+'%'};return _0x57d38e;}})});}_0x4d5d32=_[_0x8a47('0x3b')]({},_0x4d5d32,_0x1e89b1[_0x8a47('0x3c')]);var _0x20ba1c={'where':_0x4d5d32[_0x8a47('0x38')]};return db[_0x8a47('0x2c')]['count'](_0x20ba1c)['then'](function(_0x442870){_0x9b51b8[_0x8a47('0x21')]=_0x442870;if(_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3d')]){_0x4d5d32['include']=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3e')](_0x4d5d32);})[_0x8a47('0x27')](function(_0x369dd5){_0x9b51b8[_0x8a47('0x3f')]=_0x369dd5;return _0x9b51b8;})['then'](respondWithFilteredResult(_0x526571,_0x4d5d32))[_0x8a47('0x40')](handleError(_0x526571,null));};exports[_0x8a47('0x41')]=function(_0x3010af,_0x5d23ed){var _0x2b3874={'raw':!![],'where':{'id':_0x3010af[_0x8a47('0x42')]['id']}},_0x2c70ea={};_0x2c70ea[_0x8a47('0x2f')]=_['keys'](db[_0x8a47('0x2c')][_0x8a47('0x2d')]);_0x2c70ea[_0x8a47('0x30')]=_[_0x8a47('0x31')](_0x3010af[_0x8a47('0x30')]);_0x2c70ea[_0x8a47('0x32')]=_['intersection'](_0x2c70ea['model'],_0x2c70ea[_0x8a47('0x30')]);_0x2b3874[_0x8a47('0x35')]=_[_0x8a47('0x33')](_0x2c70ea['model'],qs[_0x8a47('0x34')](_0x3010af[_0x8a47('0x30')]['fields']));_0x2b3874['attributes']=_0x2b3874[_0x8a47('0x35')]['length']?_0x2b3874[_0x8a47('0x35')]:_0x2c70ea[_0x8a47('0x2f')];if(_0x3010af[_0x8a47('0x30')][_0x8a47('0x3d')]){_0x2b3874[_0x8a47('0x43')]=[{'all':!![]}];}_0x2b3874=_[_0x8a47('0x3b')]({},_0x2b3874,_0x3010af['options']);return db['WhatsappQueueReport'][_0x8a47('0x44')](_0x2b3874)[_0x8a47('0x27')](handleEntityNotFound(_0x5d23ed,null))[_0x8a47('0x27')](respondWithResult(_0x5d23ed,null))[_0x8a47('0x40')](handleError(_0x5d23ed,null));};exports[_0x8a47('0x45')]=function(_0x55dd7c,_0x4898d0){return db[_0x8a47('0x2c')]['create'](_0x55dd7c[_0x8a47('0x46')],{})[_0x8a47('0x27')](respondWithResult(_0x4898d0,0xc9))['catch'](handleError(_0x4898d0,null));};exports[_0x8a47('0x26')]=function(_0x237ed1,_0x14e22c){if(_0x237ed1[_0x8a47('0x46')]['id']){delete _0x237ed1[_0x8a47('0x46')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x44')]({'where':{'id':_0x237ed1[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x14e22c,null))[_0x8a47('0x27')](saveUpdates(_0x237ed1[_0x8a47('0x46')],null))[_0x8a47('0x27')](respondWithResult(_0x14e22c,null))[_0x8a47('0x40')](handleError(_0x14e22c,null));};exports['destroy']=function(_0x11db4e,_0xa428dd){return db[_0x8a47('0x2c')][_0x8a47('0x44')]({'where':{'id':_0x11db4e[_0x8a47('0x42')]['id']}})[_0x8a47('0x27')](handleEntityNotFound(_0xa428dd,null))['then'](removeEntity(_0xa428dd,null))['catch'](handleError(_0xa428dd,null));};exports[_0x8a47('0x47')]=function(_0x5db5d3,_0x1da8b7){return db[_0x8a47('0x2c')]['describe']()[_0x8a47('0x27')](respondWithResult(_0x1da8b7,null))['catch'](handleError(_0x1da8b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 25e685a..9a24157 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 _0x3821=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51a303,_0xe0cc5e){var _0x24f28d=function(_0x5ee8c5){while(--_0x5ee8c5){_0x51a303['push'](_0x51a303['shift']());}};_0x24f28d(++_0xe0cc5e);}(_0x3821,0xac));var _0x1382=function(_0x183ae8,_0x14edea){_0x183ae8=_0x183ae8-0x0;var _0x560c13=_0x3821[_0x183ae8];return _0x560c13;};'use strict';var _=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var logger=require(_0x1382('0x2'))(_0x1382('0x3'));var moment=require(_0x1382('0x4'));var BPromise=require(_0x1382('0x5'));var rp=require(_0x1382('0x6'));var fs=require('fs');var path=require(_0x1382('0x7'));var rimraf=require(_0x1382('0x8'));var config=require(_0x1382('0x9'));var attributes=require(_0x1382('0xa'));module[_0x1382('0xb')]=function(_0x59cff6,_0x828205){return _0x59cff6[_0x1382('0xc')](_0x1382('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1382('0xe'),'fields':[_0x1382('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x898e=['api','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','uniqueid','lodash','../../config/logger'];(function(_0x4901f1,_0x257334){var _0x4f1894=function(_0x492bd3){while(--_0x492bd3){_0x4901f1['push'](_0x4901f1['shift']());}};_0x4f1894(++_0x257334);}(_0x898e,0x6c));var _0xe898=function(_0x4a4177,_0x2baf10){_0x4a4177=_0x4a4177-0x0;var _0x20ad96=_0x898e[_0x4a4177];return _0x20ad96;};'use strict';var _=require(_0xe898('0x0'));var util=require('util');var logger=require(_0xe898('0x1'))(_0xe898('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe898('0x3'));var fs=require('fs');var path=require(_0xe898('0x4'));var rimraf=require(_0xe898('0x5'));var config=require('../../config/environment');var attributes=require(_0xe898('0x6'));module[_0xe898('0x7')]=function(_0x500e2c,_0x1541a8){return _0x500e2c['define']('WhatsappQueueReport',attributes,{'tableName':_0xe898('0x8'),'paranoid':![],'indexes':[{'name':_0xe898('0x9'),'fields':[_0xe898('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ffc06cb..06c8eae 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 _0x2930=['client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','debug','stringify','catch','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xe37c84,_0x4559e7){var _0x51674a=function(_0x1b6e94){while(--_0x1b6e94){_0xe37c84['push'](_0xe37c84['shift']());}};_0x51674a(++_0x4559e7);}(_0x2930,0x120));var _0x0293=function(_0x10f6b9,_0x1221b7){_0x10f6b9=_0x10f6b9-0x0;var _0x224308=_0x2930[_0x10f6b9];return _0x224308;};'use strict';var _=require(_0x0293('0x0'));var util=require(_0x0293('0x1'));var moment=require(_0x0293('0x2'));var BPromise=require(_0x0293('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0293('0x4'));var db=require(_0x0293('0x5'))['db'];var utils=require(_0x0293('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0293('0x7'));var jayson=require(_0x0293('0x8'));var client=jayson[_0x0293('0x9')][_0x0293('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeaf019,_0x2c44d3,_0x5d10db){return new BPromise(function(_0x32042d,_0x3ee84a){return client[_0x0293('0xb')](_0xeaf019,_0x5d10db)[_0x0293('0xc')](function(_0x54e719){logger['info'](_0x0293('0xd'),_0x2c44d3,_0x0293('0xe'));logger['debug'](_0x0293('0xf'),_0x2c44d3,_0x0293('0xe'),JSON['stringify'](_0x54e719));if(_0x54e719[_0x0293('0x10')]){if(_0x54e719[_0x0293('0x10')][_0x0293('0x11')]===0x1f4){logger[_0x0293('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c44d3,_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);return _0x3ee84a(_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);}logger[_0x0293('0x10')](_0x0293('0xd'),_0x2c44d3,_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);return _0x32042d(_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);}else{logger[_0x0293('0x13')](_0x0293('0xd'),_0x2c44d3,'request\x20sent');_0x32042d(_0x54e719[_0x0293('0x14')][_0x0293('0x12')]);}})['catch'](function(_0x4f2314){logger[_0x0293('0x10')](_0x0293('0xd'),_0x2c44d3,_0x4f2314);_0x3ee84a(_0x4f2314);});});}exports['CreateWhatsappQueueReport']=function(_0x1d216c){var _0x31d8d=this;return new Promise(function(_0x5703cf,_0x2714bb){return db[_0x0293('0x15')][_0x0293('0x16')](_0x1d216c['body'],{'raw':_0x1d216c['options']?_0x1d216c[_0x0293('0x17')][_0x0293('0x18')]===undefined?!![]:![]:!![]})[_0x0293('0xc')](function(_0x4da532){logger[_0x0293('0x13')](_0x0293('0x19'),_0x1d216c);logger[_0x0293('0x1a')](_0x0293('0x19'),_0x1d216c,JSON[_0x0293('0x1b')](_0x4da532));_0x5703cf(_0x4da532);})[_0x0293('0x1c')](function(_0x5ac69f){logger[_0x0293('0x10')](_0x0293('0x19'),_0x5ac69f[_0x0293('0x12')],_0x1d216c);_0x2714bb(_0x31d8d[_0x0293('0x10')](0x1f4,_0x5ac69f[_0x0293('0x12')]));});});};exports[_0x0293('0x1d')]=function(_0x1414b5){var _0x4bbaae=this;return new Promise(function(_0x221d55,_0x501505){return db[_0x0293('0x15')][_0x0293('0x1e')](_0x1414b5['body'],{'raw':_0x1414b5[_0x0293('0x17')]?_0x1414b5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1414b5[_0x0293('0x17')]?_0x1414b5[_0x0293('0x17')][_0x0293('0x1f')]||null:null,'attributes':_0x1414b5['options']?_0x1414b5['options'][_0x0293('0x20')]||null:null,'limit':_0x1414b5[_0x0293('0x17')]?_0x1414b5['options']['limit']||null:null})[_0x0293('0xc')](function(_0x402512){logger[_0x0293('0x13')](_0x0293('0x1d'),_0x1414b5);logger[_0x0293('0x1a')]('UpdateWhatsappQueueReport',_0x1414b5,JSON[_0x0293('0x1b')](_0x402512));_0x221d55(_0x402512);})[_0x0293('0x1c')](function(_0x4a3dee){logger[_0x0293('0x10')]('UpdateWhatsappQueueReport',_0x4a3dee['message'],_0x1414b5);_0x501505(_0x4bbaae[_0x0293('0x10')](0x1f4,_0x4a3dee[_0x0293('0x12')]));});});}; \ No newline at end of file +var _0x081c=['catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x081c,0xd7));var _0xc081=function(_0x3d3e50,_0x67882c){_0x3d3e50=_0x3d3e50-0x0;var _0x4273cb=_0x081c[_0x3d3e50];return _0x4273cb;};'use strict';var _=require(_0xc081('0x0'));var util=require(_0xc081('0x1'));var moment=require(_0xc081('0x2'));var BPromise=require(_0xc081('0x3'));var rs=require(_0xc081('0x4'));var fs=require('fs');var Redis=require(_0xc081('0x5'));var db=require(_0xc081('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc081('0x7'))(_0xc081('0x8'));var config=require(_0xc081('0x9'));var jayson=require(_0xc081('0xa'));var client=jayson[_0xc081('0xb')][_0xc081('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85f165,_0x29539d,_0x16089f){return new BPromise(function(_0x43d6f3,_0x1cfbe2){return client[_0xc081('0xd')](_0x85f165,_0x16089f)[_0xc081('0xe')](function(_0x50e75a){logger[_0xc081('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29539d,_0xc081('0x10'));logger['debug'](_0xc081('0x11'),_0x29539d,_0xc081('0x10'),JSON[_0xc081('0x12')](_0x50e75a));if(_0x50e75a['error']){if(_0x50e75a['error'][_0xc081('0x13')]===0x1f4){logger[_0xc081('0x14')](_0xc081('0x15'),_0x29539d,_0x50e75a['error'][_0xc081('0x16')]);return _0x1cfbe2(_0x50e75a[_0xc081('0x14')][_0xc081('0x16')]);}logger[_0xc081('0x14')](_0xc081('0x15'),_0x29539d,_0x50e75a[_0xc081('0x14')][_0xc081('0x16')]);return _0x43d6f3(_0x50e75a['error'][_0xc081('0x16')]);}else{logger[_0xc081('0xf')](_0xc081('0x15'),_0x29539d,'request\x20sent');_0x43d6f3(_0x50e75a['result'][_0xc081('0x16')]);}})[_0xc081('0x17')](function(_0x56e454){logger['error'](_0xc081('0x15'),_0x29539d,_0x56e454);_0x1cfbe2(_0x56e454);});});}exports['CreateWhatsappQueueReport']=function(_0x529e49){var _0x3b0e22=this;return new Promise(function(_0x5c837a,_0x43ab94){return db[_0xc081('0x18')]['create'](_0x529e49[_0xc081('0x19')],{'raw':_0x529e49['options']?_0x529e49[_0xc081('0x1a')][_0xc081('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xb14a50){logger[_0xc081('0xf')](_0xc081('0x1c'),_0x529e49);logger[_0xc081('0x1d')](_0xc081('0x1c'),_0x529e49,JSON['stringify'](_0xb14a50));_0x5c837a(_0xb14a50);})[_0xc081('0x17')](function(_0x2ef1b3){logger['error'](_0xc081('0x1c'),_0x2ef1b3[_0xc081('0x16')],_0x529e49);_0x43ab94(_0x3b0e22['error'](0x1f4,_0x2ef1b3[_0xc081('0x16')]));});});};exports[_0xc081('0x1e')]=function(_0x29c0fa){var _0x5f5410=this;return new Promise(function(_0x33d506,_0x5aa45c){return db[_0xc081('0x18')]['update'](_0x29c0fa[_0xc081('0x19')],{'raw':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa['options'][_0xc081('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29c0fa['options']?_0x29c0fa['options'][_0xc081('0x1f')]||null:null,'attributes':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa[_0xc081('0x1a')][_0xc081('0x20')]||null:null,'limit':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa[_0xc081('0x1a')][_0xc081('0x21')]||null:null})[_0xc081('0xe')](function(_0x55d712){logger[_0xc081('0xf')](_0xc081('0x1e'),_0x29c0fa);logger[_0xc081('0x1d')](_0xc081('0x1e'),_0x29c0fa,JSON[_0xc081('0x12')](_0x55d712));_0x33d506(_0x55d712);})[_0xc081('0x17')](function(_0x1ad3ef){logger['error']('UpdateWhatsappQueueReport',_0x1ad3ef[_0xc081('0x16')],_0x29c0fa);_0x5aa45c(_0x5f5410[_0xc081('0x14')](0x1f4,_0x1ad3ef['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8cfc182..eda1d18 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 _0x74e3=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy'];(function(_0x3ae2a9,_0x2b7b4c){var _0x4de542=function(_0x55af20){while(--_0x55af20){_0x3ae2a9['push'](_0x3ae2a9['shift']());}};_0x4de542(++_0x2b7b4c);}(_0x74e3,0x79));var _0x374e=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0x74e3[_0x465b0c];return _0x502ff0;};'use strict';var multer=require(_0x374e('0x0'));var util=require(_0x374e('0x1'));var path=require(_0x374e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x374e('0x3')]();var fs_extra=require(_0x374e('0x4'));var auth=require(_0x374e('0x5'));var interaction=require(_0x374e('0x6'));var config=require(_0x374e('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x374e('0x8')]('/',auth[_0x374e('0x9')](),controller[_0x374e('0xa')]);router[_0x374e('0x8')](_0x374e('0xb'),auth[_0x374e('0x9')](),controller[_0x374e('0xc')]);router['get'](_0x374e('0xd'),auth['isAuthenticated'](),controller[_0x374e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x374e('0xf')]);router[_0x374e('0x10')]('/:id',auth[_0x374e('0x9')](),controller['update']);router[_0x374e('0x11')]('/:id',auth[_0x374e('0x9')](),controller[_0x374e('0x12')]);module[_0x374e('0x13')]=router; \ No newline at end of file +var _0x13f5=['isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0xa8d1eb,_0x359d9c){var _0x198fef=function(_0x84dd88){while(--_0x84dd88){_0xa8d1eb['push'](_0xa8d1eb['shift']());}};_0x198fef(++_0x359d9c);}(_0x13f5,0x1ee));var _0x513f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x13f5[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x513f('0x0'));var timeout=require(_0x513f('0x1'));var express=require(_0x513f('0x2'));var router=express[_0x513f('0x3')]();var fs_extra=require(_0x513f('0x4'));var auth=require(_0x513f('0x5'));var interaction=require(_0x513f('0x6'));var config=require(_0x513f('0x7'));var controller=require(_0x513f('0x8'));router[_0x513f('0x9')]('/',auth[_0x513f('0xa')](),controller[_0x513f('0xb')]);router['get'](_0x513f('0xc'),auth[_0x513f('0xa')](),controller[_0x513f('0xd')]);router[_0x513f('0x9')](_0x513f('0xe'),auth[_0x513f('0xa')](),controller[_0x513f('0xf')]);router[_0x513f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x513f('0x11')](_0x513f('0xe'),auth[_0x513f('0xa')](),controller['update']);router[_0x513f('0x12')]('/:id',auth[_0x513f('0xa')](),controller[_0x513f('0x13')]);module[_0x513f('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 5bbfb92..fd5257c 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 _0x4cdf=['exports','STRING','ENUM','account','agent','DATE','sequelize'];(function(_0x1de127,_0x28afde){var _0x4641fc=function(_0x149765){while(--_0x149765){_0x1de127['push'](_0x1de127['shift']());}};_0x4641fc(++_0x28afde);}(_0x4cdf,0x180));var _0xf4cd=function(_0x510986,_0x1992ce){_0x510986=_0x510986-0x0;var _0x5e896f=_0x4cdf[_0x510986];return _0x5e896f;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'uniqueid':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf4cd('0x3')](_0xf4cd('0x4'),_0xf4cd('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf4cd('0x6')]}}; \ No newline at end of file +var _0xb077=['queue','DATE','sequelize','ENUM','agent'];(function(_0x34cc78,_0xea3ab1){var _0xfa6e6d=function(_0x5a2b7c){while(--_0x5a2b7c){_0x34cc78['push'](_0x34cc78['shift']());}};_0xfa6e6d(++_0xea3ab1);}(_0xb077,0x7a));var _0x7b07=function(_0x2e5bc5,_0x33ef34){_0x2e5bc5=_0x2e5bc5-0x0;var _0x5b9de2=_0xb077[_0x2e5bc5];return _0x5b9de2;};'use strict';var Sequelize=require(_0x7b07('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7b07('0x1')]('account',_0x7b07('0x2'),_0x7b07('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7b07('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 76af05c..fb7179a 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 _0xf24b=['stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','update','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','then','destroy','error'];(function(_0x178a41,_0x551fb9){var _0xf74971=function(_0xb4a0f3){while(--_0xb4a0f3){_0x178a41['push'](_0x178a41['shift']());}};_0xf74971(++_0x551fb9);}(_0xf24b,0xad));var _0xbf24=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xf24b[_0x2fa1c6];return _0x5f3257;};'use strict';var emlformat=require(_0xbf24('0x0'));var rimraf=require(_0xbf24('0x1'));var zipdir=require(_0xbf24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf24('0x3'));var moment=require('moment');var BPromise=require(_0xbf24('0x4'));var Mustache=require(_0xbf24('0x5'));var util=require('util');var path=require(_0xbf24('0x6'));var sox=require(_0xbf24('0x7'));var csv=require(_0xbf24('0x8'));var ejs=require(_0xbf24('0x9'));var fs=require('fs');var fs_extra=require(_0xbf24('0xa'));var _=require('lodash');var squel=require(_0xbf24('0xb'));var crypto=require(_0xbf24('0xc'));var jsforce=require(_0xbf24('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf24('0xe'));var Papa=require(_0xbf24('0xf'));var Redis=require(_0xbf24('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf24('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbf24('0x13'));var config=require(_0xbf24('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf24('0x15'))['db'];function respondWithStatusCode(_0x582416,_0x3d5e1a){_0x3d5e1a=_0x3d5e1a||0xcc;return function(_0x131e4e){if(_0x131e4e){return _0x582416[_0xbf24('0x16')](_0x3d5e1a);}return _0x582416[_0xbf24('0x17')](_0x3d5e1a)['end']();};}function respondWithResult(_0x427955,_0xe8167d){_0xe8167d=_0xe8167d||0xc8;return function(_0x48b88a){if(_0x48b88a){return _0x427955['status'](_0xe8167d)[_0xbf24('0x18')](_0x48b88a);}};}function respondWithFilteredResult(_0x3bbe79,_0x57a64f){return function(_0x1c47f2){if(_0x1c47f2){var _0xadde70=typeof _0x57a64f[_0xbf24('0x19')]==='undefined'&&typeof _0x57a64f[_0xbf24('0x1a')]==='undefined';var _0x49bea9=_0x1c47f2[_0xbf24('0x1b')];var _0x1897fe=_0xadde70?0x0:_0x57a64f[_0xbf24('0x19')];var _0x4907b9=_0xadde70?_0x1c47f2[_0xbf24('0x1b')]:_0x57a64f[_0xbf24('0x19')]+_0x57a64f[_0xbf24('0x1a')];var _0x3ffac2;if(_0x4907b9>=_0x49bea9){_0x4907b9=_0x49bea9;_0x3ffac2=0xc8;}else{_0x3ffac2=0xce;}_0x3bbe79['status'](_0x3ffac2);return _0x3bbe79[_0xbf24('0x1c')](_0xbf24('0x1d'),_0x1897fe+'-'+_0x4907b9+'/'+_0x49bea9)['json'](_0x1c47f2);}return null;};}function patchUpdates(_0x4c849a){return function(_0xb8d31d){try{jsonpatch['apply'](_0xb8d31d,_0x4c849a,!![]);}catch(_0x451bbd){return BPromise[_0xbf24('0x1e')](_0x451bbd);}return _0xb8d31d['save']();};}function saveUpdates(_0x28cf58,_0x147032){return function(_0x23622a){if(_0x23622a){return _0x23622a['update'](_0x28cf58)[_0xbf24('0x1f')](function(_0x28a6bb){return _0x28a6bb;});}return null;};}function removeEntity(_0x1c5020,_0x375291){return function(_0x292646){if(_0x292646){return _0x292646[_0xbf24('0x20')]()[_0xbf24('0x1f')](function(){_0x1c5020['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d51c,_0x225ea6){return function(_0x47289a){if(!_0x47289a){_0x38d51c[_0xbf24('0x16')](0x194);}return _0x47289a;};}function handleError(_0x35669c,_0x25c0dc){_0x25c0dc=_0x25c0dc||0x1f4;return function(_0x400a95){logger[_0xbf24('0x21')](_0x400a95[_0xbf24('0x22')]);if(_0x400a95[_0xbf24('0x23')]){delete _0x400a95[_0xbf24('0x23')];}_0x35669c[_0xbf24('0x17')](_0x25c0dc)[_0xbf24('0x24')](_0x400a95);};}exports[_0xbf24('0x25')]=function(_0x235985,_0x195750){var _0x182661={},_0x11ec9b={},_0x32fc32={'count':0x0,'rows':[]};var _0x53c150=_[_0xbf24('0x26')](db[_0xbf24('0x27')][_0xbf24('0x28')],function(_0x58eafa){return{'name':_0x58eafa[_0xbf24('0x29')],'type':_0x58eafa[_0xbf24('0x2a')]['key']};});_0x11ec9b['model']=_[_0xbf24('0x26')](_0x53c150,_0xbf24('0x23'));_0x11ec9b['query']=_[_0xbf24('0x2b')](_0x235985[_0xbf24('0x2c')]);_0x11ec9b['filters']=_[_0xbf24('0x2d')](_0x11ec9b['model'],_0x11ec9b['query']);_0x182661[_0xbf24('0x2e')]=_[_0xbf24('0x2d')](_0x11ec9b[_0xbf24('0x2f')],qs[_0xbf24('0x30')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x30')]));_0x182661['attributes']=_0x182661[_0xbf24('0x2e')][_0xbf24('0x31')]?_0x182661[_0xbf24('0x2e')]:_0x11ec9b[_0xbf24('0x2f')];if(!_0x235985[_0xbf24('0x2c')]['hasOwnProperty'](_0xbf24('0x32'))){_0x182661[_0xbf24('0x1a')]=qs[_0xbf24('0x1a')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x1a')]);_0x182661[_0xbf24('0x19')]=qs['offset'](_0x235985[_0xbf24('0x2c')]['offset']);}_0x182661['order']=qs[_0xbf24('0x33')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x33')]);_0x182661[_0xbf24('0x34')]=qs[_0xbf24('0x35')](_[_0xbf24('0x36')](_0x235985[_0xbf24('0x2c')],_0x11ec9b['filters']),_0x53c150);if(_0x235985[_0xbf24('0x2c')][_0xbf24('0x37')]){_0x182661[_0xbf24('0x34')]=_[_0xbf24('0x38')](_0x182661['where'],{'$or':_[_0xbf24('0x26')](_0x53c150,function(_0x2f4833){if(_0x2f4833[_0xbf24('0x2a')]!==_0xbf24('0x39')){var _0x3a8b57={};_0x3a8b57[_0x2f4833[_0xbf24('0x23')]]={'$like':'%'+_0x235985[_0xbf24('0x2c')][_0xbf24('0x37')]+'%'};return _0x3a8b57;}})});}_0x182661=_[_0xbf24('0x38')]({},_0x182661,_0x235985[_0xbf24('0x3a')]);var _0x24d5e9={'where':_0x182661[_0xbf24('0x34')]};return db[_0xbf24('0x27')]['count'](_0x24d5e9)[_0xbf24('0x1f')](function(_0xaf80c8){_0x32fc32[_0xbf24('0x1b')]=_0xaf80c8;if(_0x235985[_0xbf24('0x2c')][_0xbf24('0x3b')]){_0x182661['include']=[{'all':!![]}];}return db[_0xbf24('0x27')][_0xbf24('0x3c')](_0x182661);})[_0xbf24('0x1f')](function(_0x154b6c){_0x32fc32['rows']=_0x154b6c;return _0x32fc32;})[_0xbf24('0x1f')](respondWithFilteredResult(_0x195750,_0x182661))[_0xbf24('0x3d')](handleError(_0x195750,null));};exports[_0xbf24('0x3e')]=function(_0x341bce,_0x19ebae){var _0x1cfdd0={'raw':!![],'where':{'id':_0x341bce[_0xbf24('0x3f')]['id']}},_0x5d0fc0={};_0x5d0fc0[_0xbf24('0x2f')]=_[_0xbf24('0x2b')](db[_0xbf24('0x27')]['rawAttributes']);_0x5d0fc0[_0xbf24('0x2c')]=_[_0xbf24('0x2b')](_0x341bce[_0xbf24('0x2c')]);_0x5d0fc0['filters']=_[_0xbf24('0x2d')](_0x5d0fc0[_0xbf24('0x2f')],_0x5d0fc0[_0xbf24('0x2c')]);_0x1cfdd0[_0xbf24('0x2e')]=_[_0xbf24('0x2d')](_0x5d0fc0[_0xbf24('0x2f')],qs[_0xbf24('0x30')](_0x341bce[_0xbf24('0x2c')][_0xbf24('0x30')]));_0x1cfdd0[_0xbf24('0x2e')]=_0x1cfdd0[_0xbf24('0x2e')][_0xbf24('0x31')]?_0x1cfdd0[_0xbf24('0x2e')]:_0x5d0fc0[_0xbf24('0x2f')];if(_0x341bce['query']['includeAll']){_0x1cfdd0[_0xbf24('0x40')]=[{'all':!![]}];}_0x1cfdd0=_[_0xbf24('0x38')]({},_0x1cfdd0,_0x341bce[_0xbf24('0x3a')]);return db[_0xbf24('0x27')][_0xbf24('0x41')](_0x1cfdd0)[_0xbf24('0x1f')](handleEntityNotFound(_0x19ebae,null))[_0xbf24('0x1f')](respondWithResult(_0x19ebae,null))['catch'](handleError(_0x19ebae,null));};exports['create']=function(_0x73c63e,_0x4a0670){return db[_0xbf24('0x27')]['create'](_0x73c63e['body'],{})[_0xbf24('0x1f')](respondWithResult(_0x4a0670,0xc9))['catch'](handleError(_0x4a0670,null));};exports[_0xbf24('0x42')]=function(_0x2796c2,_0x5aed65){if(_0x2796c2[_0xbf24('0x43')]['id']){delete _0x2796c2[_0xbf24('0x43')]['id'];}return db[_0xbf24('0x27')][_0xbf24('0x41')]({'where':{'id':_0x2796c2[_0xbf24('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5aed65,null))[_0xbf24('0x1f')](saveUpdates(_0x2796c2[_0xbf24('0x43')],null))[_0xbf24('0x1f')](respondWithResult(_0x5aed65,null))[_0xbf24('0x3d')](handleError(_0x5aed65,null));};exports[_0xbf24('0x20')]=function(_0x367c4e,_0x55d6f8){return db[_0xbf24('0x27')][_0xbf24('0x41')]({'where':{'id':_0x367c4e[_0xbf24('0x3f')]['id']}})[_0xbf24('0x1f')](handleEntityNotFound(_0x55d6f8,null))[_0xbf24('0x1f')](removeEntity(_0x55d6f8,null))['catch'](handleError(_0x55d6f8,null));};exports[_0xbf24('0x44')]=function(_0x50aae7,_0x2b6bb6){return db[_0xbf24('0x27')][_0xbf24('0x44')]()[_0xbf24('0x1f')](respondWithResult(_0x2b6bb6,null))['catch'](handleError(_0x2b6bb6,null));}; \ No newline at end of file +var _0x1117=['filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x3fae0c,_0xee426f){var _0x582dd5=function(_0x213177){while(--_0x213177){_0x3fae0c['push'](_0x3fae0c['shift']());}};_0x582dd5(++_0xee426f);}(_0x1117,0x18e));var _0x7111=function(_0x4660b9,_0x172664){_0x4660b9=_0x4660b9-0x0;var _0x3d0b6b=_0x1117[_0x4660b9];return _0x3d0b6b;};'use strict';var emlformat=require(_0x7111('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7111('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7111('0x2'));var moment=require(_0x7111('0x3'));var BPromise=require(_0x7111('0x4'));var Mustache=require(_0x7111('0x5'));var util=require(_0x7111('0x6'));var path=require(_0x7111('0x7'));var sox=require('sox');var csv=require(_0x7111('0x8'));var ejs=require(_0x7111('0x9'));var fs=require('fs');var fs_extra=require(_0x7111('0xa'));var _=require(_0x7111('0xb'));var squel=require(_0x7111('0xc'));var crypto=require(_0x7111('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7111('0xe'));var toCsv=require(_0x7111('0x8'));var querystring=require(_0x7111('0xf'));var Papa=require(_0x7111('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7111('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7111('0x12'));var utils=require(_0x7111('0x13'));var config=require(_0x7111('0x14'));var licenseUtil=require(_0x7111('0x15'));var db=require(_0x7111('0x16'))['db'];function respondWithStatusCode(_0x1f1291,_0x530b57){_0x530b57=_0x530b57||0xcc;return function(_0x1d541b){if(_0x1d541b){return _0x1f1291['sendStatus'](_0x530b57);}return _0x1f1291[_0x7111('0x17')](_0x530b57)[_0x7111('0x18')]();};}function respondWithResult(_0x11e359,_0x510966){_0x510966=_0x510966||0xc8;return function(_0x2f78f2){if(_0x2f78f2){return _0x11e359[_0x7111('0x17')](_0x510966)[_0x7111('0x19')](_0x2f78f2);}};}function respondWithFilteredResult(_0x3886a3,_0x58b239){return function(_0x3dc135){if(_0x3dc135){var _0x60060e=typeof _0x58b239[_0x7111('0x1a')]===_0x7111('0x1b')&&typeof _0x58b239['limit']===_0x7111('0x1b');var _0x531e61=_0x3dc135[_0x7111('0x1c')];var _0x2569c4=_0x60060e?0x0:_0x58b239['offset'];var _0x33530b=_0x60060e?_0x3dc135['count']:_0x58b239[_0x7111('0x1a')]+_0x58b239[_0x7111('0x1d')];var _0x1a8b71;if(_0x33530b>=_0x531e61){_0x33530b=_0x531e61;_0x1a8b71=0xc8;}else{_0x1a8b71=0xce;}_0x3886a3[_0x7111('0x17')](_0x1a8b71);return _0x3886a3['set'](_0x7111('0x1e'),_0x2569c4+'-'+_0x33530b+'/'+_0x531e61)[_0x7111('0x19')](_0x3dc135);}return null;};}function patchUpdates(_0x174abf){return function(_0x40f61e){try{jsonpatch[_0x7111('0x1f')](_0x40f61e,_0x174abf,!![]);}catch(_0x55ddfc){return BPromise[_0x7111('0x20')](_0x55ddfc);}return _0x40f61e[_0x7111('0x21')]();};}function saveUpdates(_0x289291,_0x5dd4f6){return function(_0x310e1d){if(_0x310e1d){return _0x310e1d['update'](_0x289291)[_0x7111('0x22')](function(_0x2c0b1c){return _0x2c0b1c;});}return null;};}function removeEntity(_0x42f979,_0x4e3ac2){return function(_0x304814){if(_0x304814){return _0x304814[_0x7111('0x23')]()[_0x7111('0x22')](function(){_0x42f979[_0x7111('0x17')](0xcc)[_0x7111('0x18')]();});}};}function handleEntityNotFound(_0x4c13f8,_0x42d601){return function(_0x632ef0){if(!_0x632ef0){_0x4c13f8['sendStatus'](0x194);}return _0x632ef0;};}function handleError(_0x349a06,_0x270b73){_0x270b73=_0x270b73||0x1f4;return function(_0xc23399){logger[_0x7111('0x24')](_0xc23399[_0x7111('0x25')]);if(_0xc23399[_0x7111('0x26')]){delete _0xc23399[_0x7111('0x26')];}_0x349a06[_0x7111('0x17')](_0x270b73)['send'](_0xc23399);};}exports[_0x7111('0x27')]=function(_0x2e23e6,_0x389808){var _0x1a17e4={},_0x54fc62={},_0x29ed30={'count':0x0,'rows':[]};var _0x1d3f34=_[_0x7111('0x28')](db[_0x7111('0x29')][_0x7111('0x2a')],function(_0x21dd68){return{'name':_0x21dd68[_0x7111('0x2b')],'type':_0x21dd68['type'][_0x7111('0x2c')]};});_0x54fc62[_0x7111('0x2d')]=_['map'](_0x1d3f34,_0x7111('0x26'));_0x54fc62[_0x7111('0x2e')]=_['keys'](_0x2e23e6[_0x7111('0x2e')]);_0x54fc62['filters']=_[_0x7111('0x2f')](_0x54fc62[_0x7111('0x2d')],_0x54fc62[_0x7111('0x2e')]);_0x1a17e4[_0x7111('0x30')]=_[_0x7111('0x2f')](_0x54fc62['model'],qs['fields'](_0x2e23e6[_0x7111('0x2e')][_0x7111('0x31')]));_0x1a17e4['attributes']=_0x1a17e4['attributes'][_0x7111('0x32')]?_0x1a17e4[_0x7111('0x30')]:_0x54fc62['model'];if(!_0x2e23e6[_0x7111('0x2e')][_0x7111('0x33')](_0x7111('0x34'))){_0x1a17e4['limit']=qs[_0x7111('0x1d')](_0x2e23e6['query'][_0x7111('0x1d')]);_0x1a17e4['offset']=qs[_0x7111('0x1a')](_0x2e23e6[_0x7111('0x2e')][_0x7111('0x1a')]);}_0x1a17e4[_0x7111('0x35')]=qs['sort'](_0x2e23e6[_0x7111('0x2e')][_0x7111('0x36')]);_0x1a17e4[_0x7111('0x37')]=qs['filters'](_[_0x7111('0x38')](_0x2e23e6[_0x7111('0x2e')],_0x54fc62[_0x7111('0x39')]),_0x1d3f34);if(_0x2e23e6[_0x7111('0x2e')][_0x7111('0x3a')]){_0x1a17e4['where']=_[_0x7111('0x3b')](_0x1a17e4[_0x7111('0x37')],{'$or':_[_0x7111('0x28')](_0x1d3f34,function(_0x473f30){if(_0x473f30[_0x7111('0x3c')]!==_0x7111('0x3d')){var _0x4a260f={};_0x4a260f[_0x473f30[_0x7111('0x26')]]={'$like':'%'+_0x2e23e6[_0x7111('0x2e')]['filter']+'%'};return _0x4a260f;}})});}_0x1a17e4=_[_0x7111('0x3b')]({},_0x1a17e4,_0x2e23e6[_0x7111('0x3e')]);var _0x481de3={'where':_0x1a17e4['where']};return db[_0x7111('0x29')][_0x7111('0x1c')](_0x481de3)[_0x7111('0x22')](function(_0x3c1f85){_0x29ed30[_0x7111('0x1c')]=_0x3c1f85;if(_0x2e23e6['query']['includeAll']){_0x1a17e4[_0x7111('0x3f')]=[{'all':!![]}];}return db[_0x7111('0x29')][_0x7111('0x40')](_0x1a17e4);})[_0x7111('0x22')](function(_0x502007){_0x29ed30[_0x7111('0x41')]=_0x502007;return _0x29ed30;})[_0x7111('0x22')](respondWithFilteredResult(_0x389808,_0x1a17e4))[_0x7111('0x42')](handleError(_0x389808,null));};exports[_0x7111('0x43')]=function(_0x47a8cf,_0x41b790){var _0x558d9c={'raw':!![],'where':{'id':_0x47a8cf[_0x7111('0x44')]['id']}},_0x2c0d10={};_0x2c0d10['model']=_[_0x7111('0x45')](db[_0x7111('0x29')][_0x7111('0x2a')]);_0x2c0d10[_0x7111('0x2e')]=_[_0x7111('0x45')](_0x47a8cf[_0x7111('0x2e')]);_0x2c0d10['filters']=_[_0x7111('0x2f')](_0x2c0d10[_0x7111('0x2d')],_0x2c0d10['query']);_0x558d9c[_0x7111('0x30')]=_[_0x7111('0x2f')](_0x2c0d10['model'],qs[_0x7111('0x31')](_0x47a8cf[_0x7111('0x2e')][_0x7111('0x31')]));_0x558d9c[_0x7111('0x30')]=_0x558d9c['attributes'][_0x7111('0x32')]?_0x558d9c[_0x7111('0x30')]:_0x2c0d10[_0x7111('0x2d')];if(_0x47a8cf[_0x7111('0x2e')][_0x7111('0x46')]){_0x558d9c['include']=[{'all':!![]}];}_0x558d9c=_['merge']({},_0x558d9c,_0x47a8cf[_0x7111('0x3e')]);return db[_0x7111('0x29')]['find'](_0x558d9c)['then'](handleEntityNotFound(_0x41b790,null))[_0x7111('0x22')](respondWithResult(_0x41b790,null))[_0x7111('0x42')](handleError(_0x41b790,null));};exports[_0x7111('0x47')]=function(_0x4d3b2f,_0x1625b0){return db[_0x7111('0x29')][_0x7111('0x47')](_0x4d3b2f[_0x7111('0x48')],{})['then'](respondWithResult(_0x1625b0,0xc9))['catch'](handleError(_0x1625b0,null));};exports[_0x7111('0x49')]=function(_0x12339e,_0x53df00){if(_0x12339e[_0x7111('0x48')]['id']){delete _0x12339e[_0x7111('0x48')]['id'];}return db[_0x7111('0x29')][_0x7111('0x4a')]({'where':{'id':_0x12339e['params']['id']}})[_0x7111('0x22')](handleEntityNotFound(_0x53df00,null))[_0x7111('0x22')](saveUpdates(_0x12339e[_0x7111('0x48')],null))[_0x7111('0x22')](respondWithResult(_0x53df00,null))[_0x7111('0x42')](handleError(_0x53df00,null));};exports['destroy']=function(_0x1a984b,_0x569f32){return db['WhatsappTransferReport'][_0x7111('0x4a')]({'where':{'id':_0x1a984b['params']['id']}})[_0x7111('0x22')](handleEntityNotFound(_0x569f32,null))[_0x7111('0x22')](removeEntity(_0x569f32,null))['catch'](handleError(_0x569f32,null));};exports[_0x7111('0x4b')]=function(_0x5b9448,_0x23c8c1){return db[_0x7111('0x29')][_0x7111('0x4b')]()['then'](respondWithResult(_0x23c8c1,null))[_0x7111('0x42')](handleError(_0x23c8c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 56a7a57..0f8d512 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 _0x9b54=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46b63f,_0x6a3b94){var _0x2fbced=function(_0x528094){while(--_0x528094){_0x46b63f['push'](_0x46b63f['shift']());}};_0x2fbced(++_0x6a3b94);}(_0x9b54,0x11c));var _0x49b5=function(_0x2c0aaa,_0x6e6d95){_0x2c0aaa=_0x2c0aaa-0x0;var _0x5b6b77=_0x9b54[_0x2c0aaa];return _0x5b6b77;};'use strict';var _=require(_0x49b5('0x0'));var util=require(_0x49b5('0x1'));var logger=require(_0x49b5('0x2'))(_0x49b5('0x3'));var moment=require(_0x49b5('0x4'));var BPromise=require(_0x49b5('0x5'));var rp=require(_0x49b5('0x6'));var fs=require('fs');var path=require(_0x49b5('0x7'));var rimraf=require(_0x49b5('0x8'));var config=require(_0x49b5('0x9'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3eec28,_0x34b4fb){return _0x3eec28[_0x49b5('0xa')](_0x49b5('0xb'),attributes,{'tableName':_0x49b5('0xc'),'paranoid':![],'indexes':[{'name':_0x49b5('0xd'),'fields':[_0x49b5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4a5=['request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','lodash','util','../../config/logger','bluebird'];(function(_0x5dc5c5,_0xeb3e09){var _0x48da6a=function(_0x17ac6e){while(--_0x17ac6e){_0x5dc5c5['push'](_0x5dc5c5['shift']());}};_0x48da6a(++_0xeb3e09);}(_0xd4a5,0x151));var _0x5d4a=function(_0x51c863,_0x461e9e){_0x51c863=_0x51c863-0x0;var _0x8d1518=_0xd4a5[_0x51c863];return _0x8d1518;};'use strict';var _=require(_0x5d4a('0x0'));var util=require(_0x5d4a('0x1'));var logger=require(_0x5d4a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d4a('0x3'));var rp=require(_0x5d4a('0x4'));var fs=require('fs');var path=require(_0x5d4a('0x5'));var rimraf=require('rimraf');var config=require(_0x5d4a('0x6'));var attributes=require(_0x5d4a('0x7'));module[_0x5d4a('0x8')]=function(_0x4c6c06,_0x4eb48d){return _0x4c6c06[_0x5d4a('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x5d4a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ae7d255..ff836cb 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 _0x20f4=['request\x20sent','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b79ce,_0x362343){var _0x13ac3e=function(_0x380569){while(--_0x380569){_0x4b79ce['push'](_0x4b79ce['shift']());}};_0x13ac3e(++_0x362343);}(_0x20f4,0x11a));var _0x420f=function(_0x164fdd,_0x571315){_0x164fdd=_0x164fdd-0x0;var _0x3735ea=_0x20f4[_0x164fdd];return _0x3735ea;};'use strict';var _=require(_0x420f('0x0'));var util=require('util');var moment=require(_0x420f('0x1'));var BPromise=require(_0x420f('0x2'));var rs=require(_0x420f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x420f('0x4'))['db'];var utils=require(_0x420f('0x5'));var logger=require(_0x420f('0x6'))(_0x420f('0x7'));var config=require(_0x420f('0x8'));var jayson=require(_0x420f('0x9'));var client=jayson['client'][_0x420f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba935,_0x147437,_0x1b098e){return new BPromise(function(_0x16fd9a,_0x29f850){return client[_0x420f('0xb')](_0x5ba935,_0x1b098e)[_0x420f('0xc')](function(_0x28a5a2){logger[_0x420f('0xd')](_0x420f('0xe'),_0x147437,'request\x20sent');logger[_0x420f('0xf')](_0x420f('0x10'),_0x147437,_0x420f('0x11'),JSON['stringify'](_0x28a5a2));if(_0x28a5a2['error']){if(_0x28a5a2['error'][_0x420f('0x12')]===0x1f4){logger[_0x420f('0x13')](_0x420f('0xe'),_0x147437,_0x28a5a2[_0x420f('0x13')]['message']);return _0x29f850(_0x28a5a2[_0x420f('0x13')]['message']);}logger[_0x420f('0x13')](_0x420f('0xe'),_0x147437,_0x28a5a2[_0x420f('0x13')]['message']);return _0x16fd9a(_0x28a5a2[_0x420f('0x13')][_0x420f('0x14')]);}else{logger['info'](_0x420f('0xe'),_0x147437,_0x420f('0x11'));_0x16fd9a(_0x28a5a2[_0x420f('0x15')][_0x420f('0x14')]);}})[_0x420f('0x16')](function(_0x4b9333){logger[_0x420f('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x147437,_0x4b9333);_0x29f850(_0x4b9333);});});} \ No newline at end of file +var _0x4eee=['rpc','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xb4f705,_0x39327b){var _0x48e5b6=function(_0x37527e){while(--_0x37527e){_0xb4f705['push'](_0xb4f705['shift']());}};_0x48e5b6(++_0x39327b);}(_0x4eee,0x159));var _0xe4ee=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0x4eee[_0x55cc58];return _0x26062e;};'use strict';var _=require('lodash');var util=require(_0xe4ee('0x0'));var moment=require(_0xe4ee('0x1'));var BPromise=require(_0xe4ee('0x2'));var rs=require(_0xe4ee('0x3'));var fs=require('fs');var Redis=require(_0xe4ee('0x4'));var db=require(_0xe4ee('0x5'))['db'];var utils=require(_0xe4ee('0x6'));var logger=require('../../config/logger')(_0xe4ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xe4ee('0x8'));var client=jayson[_0xe4ee('0x9')][_0xe4ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588590,_0x4fd659,_0x3ef231){return new BPromise(function(_0x239760,_0x5a8f77){return client[_0xe4ee('0xb')](_0x588590,_0x3ef231)[_0xe4ee('0xc')](function(_0xa2d4f7){logger['info'](_0xe4ee('0xd'),_0x4fd659,'request\x20sent');logger['debug'](_0xe4ee('0xe'),_0x4fd659,_0xe4ee('0xf'),JSON[_0xe4ee('0x10')](_0xa2d4f7));if(_0xa2d4f7[_0xe4ee('0x11')]){if(_0xa2d4f7[_0xe4ee('0x11')]['code']===0x1f4){logger[_0xe4ee('0x11')](_0xe4ee('0xd'),_0x4fd659,_0xa2d4f7['error'][_0xe4ee('0x12')]);return _0x5a8f77(_0xa2d4f7['error'][_0xe4ee('0x12')]);}logger[_0xe4ee('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4fd659,_0xa2d4f7[_0xe4ee('0x11')]['message']);return _0x239760(_0xa2d4f7['error'][_0xe4ee('0x12')]);}else{logger[_0xe4ee('0x13')](_0xe4ee('0xd'),_0x4fd659,'request\x20sent');_0x239760(_0xa2d4f7[_0xe4ee('0x14')][_0xe4ee('0x12')]);}})[_0xe4ee('0x15')](function(_0x15cbd3){logger[_0xe4ee('0x11')](_0xe4ee('0xd'),_0x4fd659,_0x15cbd3);_0x5a8f77(_0x15cbd3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b5056ab..460c437 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bde=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','App\x20Ready!','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','start','info','filter','exitCode'];(function(_0xed7322,_0x22ca67){var _0x5ac672=function(_0x52850f){while(--_0x52850f){_0xed7322['push'](_0xed7322['shift']());}};_0x5ac672(++_0x22ca67);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var db=require(_0xe0bd('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xe0bd('0x1'));var rpc=require(_0xe0bd('0x2'));var config=require(_0xe0bd('0x3'));var logger=require(_0xe0bd('0x4'))(_0xe0bd('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe0bd('0x6'));var schedule=require(_0xe0bd('0x7'));var chat=require(_0xe0bd('0x8'));var whatsapp=require(_0xe0bd('0x9'));var transcribe=require(_0xe0bd('0xa'));var provider=require(_0xe0bd('0xb'));function main(){return db[_0xe0bd('0xc')]['sync']()[_0xe0bd('0xd')](function(){if(config[_0xe0bd('0xe')]){return seedDb[_0xe0bd('0xf')]();}})[_0xe0bd('0xd')](function(){return checkLicense[_0xe0bd('0xf')]();})[_0xe0bd('0xd')](function(){return rpc[_0xe0bd('0x10')]();})[_0xe0bd('0xd')](function(_0x561b74){logger['info'](_0x561b74);return chat['start']();})[_0xe0bd('0xd')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xe0bd('0x11')]();})[_0xe0bd('0xd')](function(){return transcribe['start']();})[_0xe0bd('0xd')](function(){return provider['start']();})[_0xe0bd('0xd')](function(_0x436535){logger[_0xe0bd('0x12')](_0x436535);return pm2[_0xe0bd('0x11')](pm2Config);})[_0xe0bd('0xd')](function(_0x335f17){var _0x342a68=_0x335f17[_0xe0bd('0x13')](function(_0x4f63fa){return typeof _0x4f63fa['exitCode']==='number'&&_0x4f63fa[_0xe0bd('0x14')]>=0x0;});if(_0x342a68[_0xe0bd('0x15')]>0x0){throw new Error(_0x342a68[_0xe0bd('0x15')]+_0xe0bd('0x16')+_[_0xe0bd('0x17')](_0x342a68,function(_0x55f304){return'\x22'+_0x55f304['pm2_env'][_0xe0bd('0x18')]+'\x22';}));}logger['info'](_0xe0bd('0x19'),_[_0xe0bd('0x17')](_[_0xe0bd('0x13')](_0x335f17,{'status':_0xe0bd('0x1a')}),'name')[_0xe0bd('0x1b')]());logger[_0xe0bd('0x12')](_0xe0bd('0x1c'),_['map'](_[_0xe0bd('0x13')](_0x335f17,function(_0x25f595){return _0x25f595[_0xe0bd('0x1d')]!=='online';}),_0xe0bd('0x18'))[_0xe0bd('0x1b')]()||_0xe0bd('0x1e'));console['log'](_0xe0bd('0x1f'));})['catch'](function(_0x12e236){console[_0xe0bd('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x12e236);logger[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x12e236);process[_0xe0bd('0x23')](0x1);});}main(); \ No newline at end of file +var _0x3d9f=['lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','join','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x4cec25,_0x530694){var _0x331ad2=function(_0x7008c5){while(--_0x7008c5){_0x4cec25['push'](_0x4cec25['shift']());}};_0x331ad2(++_0x530694);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3d9f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf3d9('0x0'));var db=require(_0xf3d9('0x1'))['db'];var seedDb=require(_0xf3d9('0x2'));var checkLicense=require(_0xf3d9('0x3'));var rpc=require(_0xf3d9('0x4'));var config=require(_0xf3d9('0x5'));var logger=require(_0xf3d9('0x6'))(_0xf3d9('0x7'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xf3d9('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xf3d9('0x9'));var provider=require(_0xf3d9('0xa'));function main(){return db['sequelize']['sync']()[_0xf3d9('0xb')](function(){if(config[_0xf3d9('0xc')]){return seedDb[_0xf3d9('0xd')]();}})[_0xf3d9('0xb')](function(){return checkLicense[_0xf3d9('0xd')]();})[_0xf3d9('0xb')](function(){return rpc['listen']();})['then'](function(_0x142568){logger[_0xf3d9('0xe')](_0x142568);return chat[_0xf3d9('0xf')]();})[_0xf3d9('0xb')](function(){return whatsapp[_0xf3d9('0xf')]();})['then'](function(){return schedule[_0xf3d9('0xf')]();})['then'](function(){return transcribe[_0xf3d9('0xf')]();})[_0xf3d9('0xb')](function(){return provider[_0xf3d9('0xf')]();})['then'](function(_0x10fb3d){logger[_0xf3d9('0xe')](_0x10fb3d);return pm2[_0xf3d9('0xf')](pm2Config);})[_0xf3d9('0xb')](function(_0x55e310){var _0x686429=_0x55e310[_0xf3d9('0x10')](function(_0x1f3f9b){return typeof _0x1f3f9b['exitCode']===_0xf3d9('0x11')&&_0x1f3f9b[_0xf3d9('0x12')]>=0x0;});if(_0x686429[_0xf3d9('0x13')]>0x0){throw new Error(_0x686429[_0xf3d9('0x13')]+_0xf3d9('0x14')+_['map'](_0x686429,function(_0x18393a){return'\x22'+_0x18393a[_0xf3d9('0x15')][_0xf3d9('0x16')]+'\x22';}));}logger[_0xf3d9('0xe')](_0xf3d9('0x17'),_[_0xf3d9('0x18')](_[_0xf3d9('0x10')](_0x55e310,{'status':_0xf3d9('0x19')}),_0xf3d9('0x16'))[_0xf3d9('0x1a')]());logger[_0xf3d9('0xe')]('Offline\x20apps:',_['map'](_[_0xf3d9('0x10')](_0x55e310,function(_0x2145b3){return _0x2145b3[_0xf3d9('0x1b')]!==_0xf3d9('0x19');}),_0xf3d9('0x16'))[_0xf3d9('0x1a')]()||_0xf3d9('0x1c'));console[_0xf3d9('0x1d')](_0xf3d9('0x1e'));})[_0xf3d9('0x1f')](function(_0x88686a){console[_0xf3d9('0x1d')](_0xf3d9('0x20'),_0x88686a);logger['error'](_0xf3d9('0x21'),_0x88686a);process[_0xf3d9('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9be6f2c..3e482ae 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 _0xdd4f=['allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','Forbidden','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','split','length','splice','unshift','encryptString','promisify','sign','secret','payload','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x27d636,_0x23e82d){_0x27d636=_0x27d636-0x0;var _0x4dbf9e=_0xdd4f[_0x27d636];return _0x4dbf9e;};'use strict';var db=require(_0xfdd4('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfdd4('0x1'));var _=require(_0xfdd4('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xfdd4('0x3'));var compose=require(_0xfdd4('0x4'));var basicAuth=require(_0xfdd4('0x5'));var crypto=require('crypto');var BPromise=require(_0xfdd4('0x6'));var util=require(_0xfdd4('0x7'));var moment=require(_0xfdd4('0x8'));var validateJwt=expressJwt({'secret':config[_0xfdd4('0x9')][_0xfdd4('0xa')]});var userAttributes=['id','role',_0xfdd4('0xb'),'name',_0xfdd4('0xc'),_0xfdd4('0xd'),_0xfdd4('0xe'),'permissions',_0xfdd4('0xf'),'voicePause',_0xfdd4('0x10'),_0xfdd4('0x11'),_0xfdd4('0x12'),_0xfdd4('0x13'),_0xfdd4('0x14'),_0xfdd4('0x15'),_0xfdd4('0x16'),_0xfdd4('0x17'),_0xfdd4('0x18'),_0xfdd4('0x19'),_0xfdd4('0x1a'),'passwordResetAt',_0xfdd4('0x1b'),_0xfdd4('0x1c'),_0xfdd4('0x1d'),'phoneBarDnd',_0xfdd4('0x1e'),'phoneBarEnableDtmfTone',_0xfdd4('0x1f'),_0xfdd4('0x20'),_0xfdd4('0x21'),_0xfdd4('0x22'),_0xfdd4('0x23'),'hotdesk','interface','userProfileId',_0xfdd4('0x24'),_0xfdd4('0x25'),_0xfdd4('0x26'),_0xfdd4('0x27'),_0xfdd4('0x28'),_0xfdd4('0x29'),_0xfdd4('0x2a'),_0xfdd4('0x2b'),_0xfdd4('0x2c'),'chatAutoanswerDelay',_0xfdd4('0x2d'),_0xfdd4('0x2e'),_0xfdd4('0x2f'),_0xfdd4('0x30'),_0xfdd4('0x31'),_0xfdd4('0x32'),_0xfdd4('0x33'),_0xfdd4('0x34'),'whatsappAutoanswer',_0xfdd4('0x35'),_0xfdd4('0x36')];exports[_0xfdd4('0x37')]=function(){return this[_0xfdd4('0x38')](!![])[_0xfdd4('0x39')](function(_0x144acd,_0x451767,_0x277ec1){if(_0x144acd['user']){_0x277ec1();}else{return db[_0xfdd4('0x3a')][_0xfdd4('0x3b')]({'where':{'id':_0x144acd[_0xfdd4('0x3c')]['id']},'attributes':['id','closed',_0xfdd4('0x3d')],'raw':!![]})[_0xfdd4('0x3e')](function(_0xf9c346){if(_0xf9c346&&_0xf9c346[_0xfdd4('0x3f')]){return _0x451767[_0xfdd4('0x40')](_0xf9c346['disposition']===_0xfdd4('0x41')?0x195:0x193)[_0xfdd4('0x42')]({'message':_0xf9c346[_0xfdd4('0x3d')]===_0xfdd4('0x41')?_0xfdd4('0x43'):_0xfdd4('0x44')});}else{_0x277ec1();}})[_0xfdd4('0x45')](function(_0x37b7a2){_0x277ec1(_0x37b7a2);});}});};exports['isAuthenticated']=function isAuthenticated(_0xcbd1fb){return compose()[_0xfdd4('0x39')](function(_0x385a68,_0xef012e,_0x2207ae){var _0x4a36a2;if(_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')]){if(_[_0xfdd4('0x48')](_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')],'Basic')){var _0x374e98=basicAuth(_0x385a68);db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'name':_0x374e98['name']}})[_0xfdd4('0x3e')](function(_0x502776){if(!_0x502776||!_0x502776[_0xfdd4('0x4b')](_0x374e98[_0xfdd4('0x4c')])){return _0xef012e['status'](0x191)['json']({'message':_0xfdd4('0x4d')});}_0x385a68[_0xfdd4('0x4e')]={'id':_0x502776['id']};_0x2207ae();})['catch'](function(_0x557d7b){_0x2207ae(_0x557d7b);});}else if(_[_0xfdd4('0x48')](_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')],_0xfdd4('0x4f'))){validateJwt(_0x385a68,_0xef012e,_0x2207ae);}else{if(_0xcbd1fb){_0x2207ae();}else{return _0xef012e[_0xfdd4('0x40')](0x193)[_0xfdd4('0x42')]({'message':_0xfdd4('0x50')});}}}else if(_0x385a68[_0xfdd4('0x51')][_0xfdd4('0x52')]){try{var _0x457ab5={'audience':hardwareConf[_0xfdd4('0x53')](),'issuer':hardwareConf[_0xfdd4('0x53')]()};verifyJwt(_0x385a68[_0xfdd4('0x51')][_0xfdd4('0x52')],_0x457ab5)[_0xfdd4('0x3e')](function(_0x3f5c5a){return db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'id':_0x3f5c5a[_0xfdd4('0x54')]}})[_0xfdd4('0x3e')](function(_0xc9549b){_0x4a36a2=_0xc9549b;return db[_0xfdd4('0x55')][_0xfdd4('0x3b')]({'where':{'id':0x1},'attributes':[_0xfdd4('0x56'),_0xfdd4('0x57')],'raw':!![]});})[_0xfdd4('0x3e')](function(_0x5348a6){if(!_0x4a36a2||!_[_0xfdd4('0x58')](_0x4a36a2[_0xfdd4('0x59')],_0x3f5c5a[_0xfdd4('0x5a')])){return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5b')});}if(_0x4a36a2['disabled']){return _0xef012e[_0xfdd4('0x40')](0x191)['json']({'message':_0xfdd4('0x5c')});}if(_0x4a36a2[_0xfdd4('0x5d')]){if(_0x5348a6[_0xfdd4('0x57')]>0x0){if(moment(_0x4a36a2[_0xfdd4('0x5e')])['add'](_0x5348a6[_0xfdd4('0x57')],_0xfdd4('0x5f'))>moment()){return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});}}else{return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});}}_0x385a68[_0xfdd4('0x4e')]={'id':_0x4a36a2['id']};_0x2207ae();});})[_0xfdd4('0x45')](function(){return _0xef012e['status'](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});});}catch(_0x210a15){_0x2207ae(_0x210a15);}}else if(_0xcbd1fb){_0x2207ae();}else{return _0xef012e[_0xfdd4('0x40')](0x193)['json']({'message':_0xfdd4('0x50')});}})[_0xfdd4('0x39')](function(_0x30524f,_0x2341e5,_0x362c4f){if(_0x30524f['user']){db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'id':_0x30524f[_0xfdd4('0x4e')]['id']},'attributes':userAttributes})[_0xfdd4('0x3e')](function(_0x912520){if(!_0x912520){return _0x2341e5[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':'User\x20not\x20found.'});}_0x30524f[_0xfdd4('0x4e')]=_0x912520;_0x362c4f();})['catch'](function(_0x3a0de9){_0x362c4f(_0x3a0de9);});}else if(_0xcbd1fb){_0x362c4f();}else{return _0x2341e5[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':_0xfdd4('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfdd4('0x39')](function(_0x11e90a,_0x4d1dfe,_0x2916ea){return licenseUtil[_0xfdd4('0x61')]()['then'](function(_0x218ca5){if(_0x218ca5['update']){_0x2916ea();}else{return _0x4d1dfe['status'](0x193)['json']({'message':_0xfdd4('0x62')});}})[_0xfdd4('0x45')](function(_0xc3933e){_0x2916ea(_0xc3933e);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xfdd4('0x39')](function(_0x169d72,_0x4d11d1,_0x25e3c9){return licenseUtil[_0xfdd4('0x61')]()[_0xfdd4('0x3e')](function(_0x2bb94a){if(_0x2bb94a[_0xfdd4('0x63')]){_0x25e3c9();}else{return _0x4d11d1[_0xfdd4('0x40')](0x193)[_0xfdd4('0x42')]({'message':_0xfdd4('0x62')});}})[_0xfdd4('0x45')](function(_0xe82eff){_0x25e3c9(_0xe82eff);});});};exports[_0xfdd4('0x64')]=function(_0x2aab84,_0x300965,_0x3c0ee1){_0x2aab84['isMiddleware']=!![];return _0x3c0ee1();};exports['signToken']=function signToken(_0x43e631){return signJwt(_0x43e631);};exports[_0xfdd4('0x65')]=function(_0x1296e6,_0x1932ef){if(!_0x1296e6['user']){return _0x1932ef[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x58cdab={'payload':{'id':_0x1296e6['user']['id'],'role':_0x1296e6['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x58cdab)[_0xfdd4('0x3e')](function(_0x88e9ef){_0x1932ef[_0xfdd4('0x66')](_0xfdd4('0x67'),_0x88e9ef);_0x1932ef[_0xfdd4('0x68')](_0xfdd4('0x69'));})['catch'](function(_0x17bbab){return _0x1932ef[_0xfdd4('0x40')](0x1f4)[_0xfdd4('0x6a')](_0x17bbab);});};exports[_0xfdd4('0x6b')]=function(_0x4e790d){if(_[_0xfdd4('0x6c')](_0x4e790d[_0xfdd4('0x59')])||_['isNil'](_0x4e790d[_0xfdd4('0x6d')])){return null;}else{return createJwt(_0x4e790d);}};exports[_0xfdd4('0x6e')]=function(_0x555e50){_0x555e50['apiKeyNonce']=generateNonce();_0x555e50[_0xfdd4('0x6d')]=generateIssuedAt();return createJwt(_0x555e50);};exports[_0xfdd4('0x6f')]=function(_0x18f071,_0x30ce95){var _0xce9f02=_0x18f071[_0xfdd4('0x51')][_0xfdd4('0x52')];if(_0xce9f02){var _0x3de4fd={'nonce':_0x30ce95['apiKeyNonce'],'iat':_0x30ce95[_0xfdd4('0x6d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xce9f02,_0x3de4fd)[_0xfdd4('0x3e')](function(){return generateApiKey(_0x30ce95);});}else{throw{'message':_0xfdd4('0x70')};}};exports['validatePasswordPattern']=function(_0x4f2160){var _0x4df9d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4df9d4[_0xfdd4('0x71')](_0x4f2160))throw new db[(_0xfdd4('0x72'))]['ValidationError'](_0xfdd4('0x73'));return;};exports[_0xfdd4('0x74')]=function(_0x466b75,_0xe6c601,_0x24d995){var _0x52887d=encryptor['decryptString'](_0xe6c601)['split'](',');for(var _0x5d0136=0x0;_0x5d0136<_0x24d995;_0x5d0136++){if(!_0x52887d[_0x5d0136])break;if(_0x466b75[_0xfdd4('0x75')]()===_0x52887d[_0x5d0136][_0xfdd4('0x75')]()){var _0x5ddc25=util[_0xfdd4('0x76')](_0xfdd4('0x77'),_0x24d995);if(_0x24d995===0x1){_0x5ddc25='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfdd4('0x72'))][(_0xfdd4('0x78'))](_0x5ddc25);}}return;};exports['updatePasswordsHistory']=function(_0x1497ff,_0x2b7081){var _0xd4e5e4=_0x2b7081?encryptor['decryptString'](_0x2b7081)[_0xfdd4('0x79')](','):[];if(_0xd4e5e4[_0xfdd4('0x7a')]===0x5){_0xd4e5e4[_0xfdd4('0x7b')](-0x1,0x1);}_0xd4e5e4[_0xfdd4('0x7c')](_0x1497ff);return encryptor[_0xfdd4('0x7d')](_0xd4e5e4['join'](','));};function signJwt(_0x2cc3e2){var _0x2ee4b6=BPromise[_0xfdd4('0x7e')](jwt[_0xfdd4('0x7f')],{'context':jwt});var _0x3dd05c=_0x2cc3e2[_0xfdd4('0x80')]||config[_0xfdd4('0x9')][_0xfdd4('0xa')];return new BPromise(function(_0x38b58b,_0x5e0a1c){_0x2ee4b6(_0x2cc3e2[_0xfdd4('0x81')],_0x3dd05c,_0x2cc3e2[_0xfdd4('0x82')])[_0xfdd4('0x3e')](function(_0x2ad8e8){_0x38b58b(_0x2ad8e8);})[_0xfdd4('0x45')](function(_0x593f5c){_0x5e0a1c(_0x593f5c);});});}function verifyJwt(_0x46e7eb,_0x3b809a,_0x255175){var _0x12e917=BPromise[_0xfdd4('0x7e')](jwt[_0xfdd4('0x83')],{'context':jwt});var _0x180ad9=_0x255175||config[_0xfdd4('0x9')][_0xfdd4('0xa')];return new BPromise(function(_0x2a0dd8,_0x2fff30){_0x12e917(_0x46e7eb,_0x180ad9,_0x3b809a)[_0xfdd4('0x3e')](function(_0x1205b8){_0x2a0dd8(_0x1205b8);})['catch'](function(_0xb9d86a){_0x2fff30(_0xb9d86a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfdd4('0x84')](_0xfdd4('0x85'));}function generateIssuedAt(){return Math[_0xfdd4('0x86')](Date[_0xfdd4('0x87')]()/0x3e8)[_0xfdd4('0x84')]();}function createJwt(_0x3a89a4){var _0xea89a1={'payload':{'iat':_0x3a89a4[_0xfdd4('0x6d')],'nonce':_0x3a89a4[_0xfdd4('0x59')]},'options':{'algorithm':_0xfdd4('0x88'),'subject':_0x3a89a4['id'][_0xfdd4('0x84')](),'issuer':hardwareConf[_0xfdd4('0x53')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xea89a1)['then'](function(_0x55a566){return{'iat':_0x3a89a4[_0xfdd4('0x6d')],'nonce':_0x3a89a4[_0xfdd4('0x59')],'token':_0x55a566};});} \ No newline at end of file +var _0xb10b=['split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','secret','session','options','promisify','verify','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','User','find','authenticate','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x19cf7a,_0x1dd21e){_0x19cf7a=_0x19cf7a-0x0;var _0x1a75bb=_0xb10b[_0x19cf7a];return _0x1a75bb;};'use strict';var db=require(_0xbb10('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xbb10('0x1'));var licenseUtil=require(_0xbb10('0x2'));var encryptor=require(_0xbb10('0x3'));var _=require('lodash');var jwt=require(_0xbb10('0x4'));var expressJwt=require(_0xbb10('0x5'));var compose=require(_0xbb10('0x6'));var basicAuth=require(_0xbb10('0x7'));var crypto=require(_0xbb10('0x8'));var BPromise=require(_0xbb10('0x9'));var util=require('util');var moment=require(_0xbb10('0xa'));var validateJwt=expressJwt({'secret':config[_0xbb10('0xb')]['session']});var userAttributes=['id',_0xbb10('0xc'),_0xbb10('0xd'),_0xbb10('0xe'),_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11'),_0xbb10('0x12'),_0xbb10('0x13'),'voicePause','chatPause',_0xbb10('0x14'),_0xbb10('0x15'),_0xbb10('0x16'),'openchannelPause',_0xbb10('0x17'),'showWebBar',_0xbb10('0x18'),_0xbb10('0x19'),_0xbb10('0x1a'),_0xbb10('0x1b'),_0xbb10('0x1c'),_0xbb10('0x1d'),'phoneBarAutoAnswer',_0xbb10('0x1e'),_0xbb10('0x1f'),_0xbb10('0x20'),_0xbb10('0x21'),_0xbb10('0x22'),_0xbb10('0x23'),_0xbb10('0x24'),_0xbb10('0x25'),_0xbb10('0x26'),_0xbb10('0x27'),'interface',_0xbb10('0x28'),_0xbb10('0x29'),_0xbb10('0x2a'),_0xbb10('0x2b'),_0xbb10('0x2c'),_0xbb10('0x2d'),_0xbb10('0x2e'),_0xbb10('0x2f'),_0xbb10('0x30'),_0xbb10('0x31'),'chatAutoanswerDelay',_0xbb10('0x32'),_0xbb10('0x33'),_0xbb10('0x34'),_0xbb10('0x35'),_0xbb10('0x36'),_0xbb10('0x37'),'faxAutoanswer',_0xbb10('0x38'),_0xbb10('0x39'),'whatsappAutoanswerDelay','messengerSoundNotification'];exports[_0xbb10('0x3a')]=function(){return this[_0xbb10('0x3b')](!![])[_0xbb10('0x3c')](function(_0x317da4,_0x445761,_0x1824b7){if(_0x317da4[_0xbb10('0x3d')]){_0x1824b7();}else{return db[_0xbb10('0x3e')][_0xbb10('0x3f')]({'where':{'id':_0x317da4[_0xbb10('0x40')]['id']},'attributes':['id',_0xbb10('0x41'),_0xbb10('0x42')],'raw':!![]})['then'](function(_0x4fedac){if(_0x4fedac&&_0x4fedac['closed']){return _0x445761[_0xbb10('0x43')](_0x4fedac[_0xbb10('0x42')]===_0xbb10('0x44')?0x195:0x193)['json']({'message':_0x4fedac[_0xbb10('0x42')]===_0xbb10('0x44')?_0xbb10('0x45'):_0xbb10('0x46')});}else{_0x1824b7();}})[_0xbb10('0x47')](function(_0x20d946){_0x1824b7(_0x20d946);});}});};exports[_0xbb10('0x3b')]=function isAuthenticated(_0x4aabb9){return compose()[_0xbb10('0x3c')](function(_0x21ac54,_0xfc3595,_0x2e0249){var _0x1d30aa;if(_0x21ac54[_0xbb10('0x48')]['authorization']){if(_[_0xbb10('0x49')](_0x21ac54['headers'][_0xbb10('0x4a')],'Basic')){var _0x16ad2a=basicAuth(_0x21ac54);db[_0xbb10('0x4b')][_0xbb10('0x4c')]({'where':{'name':_0x16ad2a['name']}})['then'](function(_0x4c3744){if(!_0x4c3744||!_0x4c3744[_0xbb10('0x4d')](_0x16ad2a['pass'])){return _0xfc3595[_0xbb10('0x43')](0x191)[_0xbb10('0x4e')]({'message':_0xbb10('0x4f')});}_0x21ac54[_0xbb10('0x3d')]={'id':_0x4c3744['id']};_0x2e0249();})[_0xbb10('0x47')](function(_0x138bc6){_0x2e0249(_0x138bc6);});}else if(_[_0xbb10('0x49')](_0x21ac54['headers'][_0xbb10('0x4a')],_0xbb10('0x50'))){validateJwt(_0x21ac54,_0xfc3595,_0x2e0249);}else{if(_0x4aabb9){_0x2e0249();}else{return _0xfc3595[_0xbb10('0x43')](0x193)[_0xbb10('0x4e')]({'message':_0xbb10('0x51')});}}}else if(_0x21ac54[_0xbb10('0x52')][_0xbb10('0x53')]){try{var _0x10202c={'audience':hardwareConf[_0xbb10('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ac54[_0xbb10('0x52')][_0xbb10('0x53')],_0x10202c)[_0xbb10('0x55')](function(_0x3c3c45){return db['User'][_0xbb10('0x4c')]({'where':{'id':_0x3c3c45['sub']}})['then'](function(_0x3eb3cc){_0x1d30aa=_0x3eb3cc;return db[_0xbb10('0x56')][_0xbb10('0x3f')]({'where':{'id':0x1},'attributes':[_0xbb10('0x57'),_0xbb10('0x58')],'raw':!![]});})[_0xbb10('0x55')](function(_0x547062){if(!_0x1d30aa||!_[_0xbb10('0x59')](_0x1d30aa[_0xbb10('0x5a')],_0x3c3c45['nonce'])){return _0xfc3595['status'](0x191)['json']({'message':_0xbb10('0x5b')});}if(_0x1d30aa[_0xbb10('0x5c')]){return _0xfc3595[_0xbb10('0x43')](0x191)['json']({'message':_0xbb10('0x5d')});}if(_0x1d30aa[_0xbb10('0x5e')]){if(_0x547062[_0xbb10('0x58')]>0x0){if(moment(_0x1d30aa['blockedAt'])[_0xbb10('0x5f')](_0x547062[_0xbb10('0x58')],_0xbb10('0x60'))>moment()){return _0xfc3595[_0xbb10('0x43')](0x191)['json']({'message':_0xbb10('0x5d')});}}else{return _0xfc3595[_0xbb10('0x43')](0x191)['json']({'message':_0xbb10('0x5d')});}}_0x21ac54[_0xbb10('0x3d')]={'id':_0x1d30aa['id']};_0x2e0249();});})[_0xbb10('0x47')](function(){return _0xfc3595[_0xbb10('0x43')](0x191)[_0xbb10('0x4e')]({'message':_0xbb10('0x5d')});});}catch(_0x5f3d67){_0x2e0249(_0x5f3d67);}}else if(_0x4aabb9){_0x2e0249();}else{return _0xfc3595[_0xbb10('0x43')](0x193)[_0xbb10('0x4e')]({'message':_0xbb10('0x51')});}})[_0xbb10('0x3c')](function(_0x4943d9,_0x3fff6c,_0x331751){if(_0x4943d9[_0xbb10('0x3d')]){db[_0xbb10('0x4b')]['find']({'where':{'id':_0x4943d9[_0xbb10('0x3d')]['id']},'attributes':userAttributes})[_0xbb10('0x55')](function(_0x54ac18){if(!_0x54ac18){return _0x3fff6c['status'](0x194)[_0xbb10('0x4e')]({'message':'User\x20not\x20found.'});}_0x4943d9[_0xbb10('0x3d')]=_0x54ac18;_0x331751();})[_0xbb10('0x47')](function(_0x4c66d8){_0x331751(_0x4c66d8);});}else if(_0x4aabb9){_0x331751();}else{return _0x3fff6c[_0xbb10('0x43')](0x194)[_0xbb10('0x4e')]({'message':_0xbb10('0x61')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb10('0x3c')](function(_0xebd70c,_0x3b9fdf,_0x32b729){return licenseUtil[_0xbb10('0x62')]()[_0xbb10('0x55')](function(_0x190781){if(_0x190781[_0xbb10('0x63')]){_0x32b729();}else{return _0x3b9fdf[_0xbb10('0x43')](0x193)[_0xbb10('0x4e')]({'message':_0xbb10('0x64')});}})[_0xbb10('0x47')](function(_0x4d30d6){_0x32b729(_0x4d30d6);});});};exports[_0xbb10('0x65')]=function isWebrtcLicence(){return compose()[_0xbb10('0x3c')](function(_0x4a1248,_0x14e1cb,_0x2f5027){return licenseUtil[_0xbb10('0x62')]()[_0xbb10('0x55')](function(_0x41ea91){if(_0x41ea91[_0xbb10('0x66')]){_0x2f5027();}else{return _0x14e1cb[_0xbb10('0x43')](0x193)['json']({'message':'Forbidden'});}})[_0xbb10('0x47')](function(_0x76a208){_0x2f5027(_0x76a208);});});};exports[_0xbb10('0x67')]=function(_0x57d2c0,_0x5f0c12,_0x3cd6f3){_0x57d2c0[_0xbb10('0x67')]=!![];return _0x3cd6f3();};exports[_0xbb10('0x68')]=function signToken(_0xf820fe){return signJwt(_0xf820fe);};exports[_0xbb10('0x69')]=function(_0x22b315,_0x2f2552){if(!_0x22b315[_0xbb10('0x3d')]){return _0x2f2552[_0xbb10('0x43')](0x194)[_0xbb10('0x4e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5eafac={'payload':{'id':_0x22b315[_0xbb10('0x3d')]['id'],'role':_0x22b315[_0xbb10('0x3d')][_0xbb10('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5eafac)[_0xbb10('0x55')](function(_0x36aa7d){_0x2f2552[_0xbb10('0x6a')](_0xbb10('0x6b'),_0x36aa7d);_0x2f2552[_0xbb10('0x6c')](_0xbb10('0x6d'));})[_0xbb10('0x47')](function(_0x19ca3e){return _0x2f2552[_0xbb10('0x43')](0x1f4)[_0xbb10('0x6e')](_0x19ca3e);});};exports[_0xbb10('0x6f')]=function(_0x1d15f4){if(_['isNil'](_0x1d15f4[_0xbb10('0x5a')])||_['isNil'](_0x1d15f4[_0xbb10('0x70')])){return null;}else{return createJwt(_0x1d15f4);}};exports[_0xbb10('0x71')]=function(_0x1ffe20){_0x1ffe20[_0xbb10('0x5a')]=generateNonce();_0x1ffe20[_0xbb10('0x70')]=generateIssuedAt();return createJwt(_0x1ffe20);};exports[_0xbb10('0x72')]=function(_0x2e3326,_0x44eec1){var _0x180400=_0x2e3326[_0xbb10('0x52')][_0xbb10('0x53')];if(_0x180400){var _0x1c2dce={'nonce':_0x44eec1[_0xbb10('0x5a')],'iat':_0x44eec1[_0xbb10('0x70')],'audience':hardwareConf[_0xbb10('0x54')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x180400,_0x1c2dce)[_0xbb10('0x55')](function(){return generateApiKey(_0x44eec1);});}else{throw{'message':_0xbb10('0x73')};}};exports[_0xbb10('0x74')]=function(_0x4ce8e7){var _0xbffa3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xbffa3c[_0xbb10('0x75')](_0x4ce8e7))throw new db['Sequelize'][(_0xbb10('0x76'))](_0xbb10('0x77'));return;};exports[_0xbb10('0x78')]=function(_0x14fed3,_0x432728,_0x22de7f){var _0x175872=encryptor[_0xbb10('0x79')](_0x432728)[_0xbb10('0x7a')](',');for(var _0x40c4fb=0x0;_0x40c4fb<_0x22de7f;_0x40c4fb++){if(!_0x175872[_0x40c4fb])break;if(_0x14fed3[_0xbb10('0x7b')]()===_0x175872[_0x40c4fb][_0xbb10('0x7b')]()){var _0x16932f=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x22de7f);if(_0x22de7f===0x1){_0x16932f=_0xbb10('0x7c');}throw new db[(_0xbb10('0x7d'))][(_0xbb10('0x76'))](_0x16932f);}}return;};exports[_0xbb10('0x7e')]=function(_0x5573bb,_0x506498){var _0x79411e=_0x506498?encryptor[_0xbb10('0x79')](_0x506498)[_0xbb10('0x7a')](','):[];if(_0x79411e[_0xbb10('0x7f')]===0x5){_0x79411e[_0xbb10('0x80')](-0x1,0x1);}_0x79411e[_0xbb10('0x81')](_0x5573bb);return encryptor[_0xbb10('0x82')](_0x79411e['join'](','));};function signJwt(_0x117e84){var _0x216cff=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x5a231f=_0x117e84[_0xbb10('0x83')]||config[_0xbb10('0xb')][_0xbb10('0x84')];return new BPromise(function(_0x5bd1c0,_0x4e6e7c){_0x216cff(_0x117e84['payload'],_0x5a231f,_0x117e84[_0xbb10('0x85')])[_0xbb10('0x55')](function(_0x45167a){_0x5bd1c0(_0x45167a);})['catch'](function(_0xa1bbd9){_0x4e6e7c(_0xa1bbd9);});});}function verifyJwt(_0x13131c,_0x5a6538,_0x4a560c){var _0x27d7b9=BPromise[_0xbb10('0x86')](jwt[_0xbb10('0x87')],{'context':jwt});var _0x237246=_0x4a560c||config['secrets'][_0xbb10('0x84')];return new BPromise(function(_0xec48ac,_0xa7179d){_0x27d7b9(_0x13131c,_0x237246,_0x5a6538)['then'](function(_0x402a01){_0xec48ac(_0x402a01);})[_0xbb10('0x47')](function(_0x3e3617){_0xa7179d(_0x3e3617);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xbb10('0x88')](_0xbb10('0x89'));}function generateIssuedAt(){return Math[_0xbb10('0x8a')](Date[_0xbb10('0x8b')]()/0x3e8)['toString']();}function createJwt(_0x251417){var _0x258e55={'payload':{'iat':_0x251417[_0xbb10('0x70')],'nonce':_0x251417[_0xbb10('0x5a')]},'options':{'algorithm':'HS512','subject':_0x251417['id'][_0xbb10('0x88')](),'issuer':hardwareConf[_0xbb10('0x54')](),'audience':hardwareConf[_0xbb10('0x54')]()}};return signJwt(_0x258e55)[_0xbb10('0x55')](function(_0x12f750){return{'iat':_0x251417[_0xbb10('0x70')],'nonce':_0x251417[_0xbb10('0x5a')],'token':_0x12f750};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 85a55e9..c83a1f8 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d95=['parseQueryParameters','where','default','fields','filter','clause','checkListsRestrictions','tag','count','User','buildContactsQuery','catch','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','all','length','fieldType','type','map','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4d95,0x183));var _0x54d9=function(_0x51cd13,_0x498761){_0x51cd13=_0x51cd13-0x0;var _0x282dc7=_0x4d95[_0x51cd13];return _0x282dc7;};'use strict';var _=require(_0x54d9('0x0'));var sqlUtils=require(_0x54d9('0x1'));var db=require(_0x54d9('0x2'))['db'];exports['findAll']=function(_0x2c6a8c,_0x5d41fb,_0x5b17c7,_0x20e355){var _0x2bd74a={'count':0x0,'rows':[]};var _0x5e8a96=sqlUtils[_0x54d9('0x3')](_0x5d41fb,_0x2c6a8c);if(_0x5e8a96){return Promise[_0x54d9('0x4')](_0x2bd74a);}var _0x2706e7=sqlUtils[_0x54d9('0x5')]();var _0x2529be={};var _0x1dd9de=![];var _0x2afafe=![];return Promise['resolve']()[_0x54d9('0x6')](function(){if(_0x2c6a8c[_0x54d9('0x7')]){return sqlUtils[_0x54d9('0x8')](_0x2c6a8c[_0x54d9('0x7')],_0x20e355);}else{return sqlUtils[_0x54d9('0x9')](_0x2c6a8c,_0x20e355);}})['then'](function(_0x1fa5f8){_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xb')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xc')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xd')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8['user'][_0x54d9('0xe')]);_0x2529be=_0x1fa5f8['tags'];_0x2afafe=_0x1fa5f8['user']['skip'];return sqlUtils[_0x54d9('0xf')](_0x5d41fb,_0x2c6a8c,_0x2afafe);})[_0x54d9('0x6')](function(_0x48871d){_0x2706e7[_0x54d9('0xa')](_0x48871d);var _0x5a955b=_0x2c6a8c['search']?_0x2529be['ids']:_0x2c6a8c[_0x54d9('0x10')];_0x1dd9de=_0x5a955b?!![]:![];return sqlUtils['countFilteredContacts'](_0x2706e7,_0x5a955b);})['then'](function(_0x341db1){_0x2bd74a[_0x54d9('0x11')]=_0x341db1;if(_0x2bd74a[_0x54d9('0x11')]===0x0){return;}if(_0x2c6a8c[_0x54d9('0x12')]){_0x2afafe=!![];}return sqlUtils[_0x54d9('0x13')](_0x2706e7,_0x2c6a8c[_0x54d9('0xc')],_0x5b17c7,_0x1dd9de,_0x2529be[_0x54d9('0xe')],_0x2afafe);})[_0x54d9('0x6')](function(_0x1c1c2f){if(!_0x1c1c2f){return[];}return sqlUtils['getFilteredContacts'](_0x1c1c2f,_0x2c6a8c,_0x5b17c7);})[_0x54d9('0x6')](function(_0xbf1a9e){_0x2bd74a['rows']=_0xbf1a9e;return _0x2bd74a;})[_0x54d9('0x14')](function(_0x35df84){throw _0x35df84;});};exports[_0x54d9('0x15')]=function(){var _0x51c628={};var _0x50be0a=[];return db[_0x54d9('0x16')][_0x54d9('0x15')]()['then'](function(_0x5b0ab4){_0x51c628=_0x5b0ab4;var _0x17dc45=Object[_0x54d9('0x17')](_0x51c628)[_0x54d9('0xd')](function(_0x45684e){return _[_0x54d9('0x18')](_0x45684e,_0x54d9('0x19'))?_0x45684e:undefined;});var _0x51ef8c=_0x17dc45['map'](function(_0x4dcfdd){return db[_0x54d9('0x1a')][_0x54d9('0x1b')]({'where':{'id':_0x4dcfdd['slice'](0x3)},'raw':!![]});});return Promise[_0x54d9('0x1c')](_0x51ef8c);})[_0x54d9('0x6')](function(_0x49c1bc){for(var _0x4bf6ca=0x0;_0x4bf6ca<_0x49c1bc[_0x54d9('0x1d')];_0x4bf6ca++){if(_0x49c1bc[_0x4bf6ca]){var _0x50be8f=_0x54d9('0x19')+_0x49c1bc[_0x4bf6ca]['id'];_0x51c628[_0x50be8f][_0x54d9('0x1e')]=_0x49c1bc[_0x4bf6ca][_0x54d9('0x1f')];}}_0x50be0a=_[_0x54d9('0x20')](Object[_0x54d9('0x17')](_0x51c628),function(_0x586480){return{'name':_0x586480,'type':_0x51c628[_0x586480][_0x54d9('0x1f')]};});return _0x50be0a;})[_0x54d9('0x14')](function(_0x5c7cc6){throw _0x5c7cc6;});}; \ No newline at end of file +var _0xf91a=['filter','startsWith','map','CmCustomField','findOne','all','length','fieldType','type','keys','lodash','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','user','clause','tags','skip','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact'];(function(_0x5c5609,_0x1e5463){var _0x4be95b=function(_0x49dde2){while(--_0x49dde2){_0x5c5609['push'](_0x5c5609['shift']());}};_0x4be95b(++_0x1e5463);}(_0xf91a,0x168));var _0xaf91=function(_0x2bcc08,_0x1c1b17){_0x2bcc08=_0x2bcc08-0x0;var _0x3dd5db=_0xf91a[_0x2bcc08];return _0x3dd5db;};'use strict';var _=require(_0xaf91('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xaf91('0x1')]=function(_0x31399c,_0x55b52b,_0x2e10c6,_0x51df23){var _0x2c2515={'count':0x0,'rows':[]};var _0x587c72=sqlUtils[_0xaf91('0x2')](_0x55b52b,_0x31399c);if(_0x587c72){return Promise[_0xaf91('0x3')](_0x2c2515);}var _0x1ea674=sqlUtils[_0xaf91('0x4')]();var _0x332554={};var _0x1271b8=![];var _0x484118=![];return Promise['resolve']()[_0xaf91('0x5')](function(){if(_0x31399c[_0xaf91('0x6')]){return sqlUtils[_0xaf91('0x7')](_0x31399c['search'],_0x51df23);}else{return sqlUtils[_0xaf91('0x8')](_0x31399c,_0x51df23);}})[_0xaf91('0x5')](function(_0x20e513){_0x1ea674[_0xaf91('0x9')](_0x20e513['default']);_0x1ea674['where'](_0x20e513[_0xaf91('0xa')]);_0x1ea674['where'](_0x20e513['filter']);_0x1ea674[_0xaf91('0x9')](_0x20e513[_0xaf91('0xb')][_0xaf91('0xc')]);_0x332554=_0x20e513[_0xaf91('0xd')];_0x484118=_0x20e513[_0xaf91('0xb')][_0xaf91('0xe')];return sqlUtils['checkListsRestrictions'](_0x55b52b,_0x31399c,_0x484118);})[_0xaf91('0x5')](function(_0x47d890){_0x1ea674[_0xaf91('0x9')](_0x47d890);var _0x5745df=_0x31399c['search']?_0x332554[_0xaf91('0xf')]:_0x31399c['tag'];_0x1271b8=_0x5745df?!![]:![];return sqlUtils[_0xaf91('0x10')](_0x1ea674,_0x5745df);})[_0xaf91('0x5')](function(_0x189243){_0x2c2515[_0xaf91('0x11')]=_0x189243;if(_0x2c2515['count']===0x0){return;}if(_0x31399c[_0xaf91('0x12')]){_0x484118=!![];}return sqlUtils[_0xaf91('0x13')](_0x1ea674,_0x31399c['fields'],_0x2e10c6,_0x1271b8,_0x332554[_0xaf91('0xc')],_0x484118);})['then'](function(_0x33b6bf){if(!_0x33b6bf){return[];}return sqlUtils[_0xaf91('0x14')](_0x33b6bf,_0x31399c,_0x2e10c6);})[_0xaf91('0x5')](function(_0xcd36a5){_0x2c2515[_0xaf91('0x15')]=_0xcd36a5;return _0x2c2515;})[_0xaf91('0x16')](function(_0x1970ad){throw _0x1970ad;});};exports[_0xaf91('0x17')]=function(){var _0x53e199={};var _0x5e68ea=[];return db[_0xaf91('0x18')][_0xaf91('0x17')]()[_0xaf91('0x5')](function(_0x47c859){_0x53e199=_0x47c859;var _0x1b67e7=Object['keys'](_0x53e199)[_0xaf91('0x19')](function(_0x437590){return _[_0xaf91('0x1a')](_0x437590,'cf_')?_0x437590:undefined;});var _0x582bd4=_0x1b67e7[_0xaf91('0x1b')](function(_0x58373b){return db[_0xaf91('0x1c')][_0xaf91('0x1d')]({'where':{'id':_0x58373b['slice'](0x3)},'raw':!![]});});return Promise[_0xaf91('0x1e')](_0x582bd4);})['then'](function(_0x28ee30){for(var _0x38bea6=0x0;_0x38bea6<_0x28ee30[_0xaf91('0x1f')];_0x38bea6++){if(_0x28ee30[_0x38bea6]){var _0x5d2654='cf_'+_0x28ee30[_0x38bea6]['id'];_0x53e199[_0x5d2654][_0xaf91('0x20')]=_0x28ee30[_0x38bea6][_0xaf91('0x21')];}}_0x5e68ea=_[_0xaf91('0x1b')](Object[_0xaf91('0x22')](_0x53e199),function(_0x32eb87){return{'name':_0x32eb87,'type':_0x53e199[_0x32eb87]['type']};});return _0x5e68ea;})[_0xaf91('0x16')](function(_0x2aac3d){throw _0x2aac3d;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index f95bf05..18e789d 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b4b=['clause','skip','map','some','name','Contact','forEach','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','tag','filter','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','limit','offset','group','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','toString','Tags','clone','COUNT(*)','c.id','isEmpty','where','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','left_join','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','createdAt','updatedAt','deletedAt','TagIds','includes','push','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','type','default','text','value','start','end','Tag','tags','ids','User','user'];(function(_0x67554c,_0x823180){var _0x23554d=function(_0x384ae1){while(--_0x384ae1){_0x67554c['push'](_0x67554c['shift']());}};_0x23554d(++_0x823180);}(_0x0b4b,0xfa));var _0xb0b4=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x0b4b[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0xb0b4('0x0'));var squel=require('squel');var as=require(_0xb0b4('0x1'));var qs=require(_0xb0b4('0x2'));var utils=require(_0xb0b4('0x3'));var db=require(_0xb0b4('0x4'))['db'];function skipContactsQuery(_0xb32891,_0x4e99d6){var _0x331889=![];if(_0xb32891[_0xb0b4('0x5')]===_0xb0b4('0x6')&&!_0x4e99d6[_0xb0b4('0x7')]&&!_0x4e99d6[_0xb0b4('0x8')]&&_0x4e99d6[_0xb0b4('0x9')]!=='true'){_0x331889=!![];}return _0x331889;}function getContactsSubquery(){return squel[_0xb0b4('0xa')]()['from'](_0xb0b4('0xb'),'c')['where'](_0xb0b4('0xc'));}function applyJoinClauses(_0x14833f,_0x246d20){var _0x39e407=_0x246d20?'c':_0xb0b4('0xd');_0x14833f['left_join'](_0xb0b4('0xe'),'uc',_0xb0b4('0xf')+_0x39e407+_0xb0b4('0x10'))['left_join']('cm_contact_has_tags','ct',_0xb0b4('0x11')+_0x39e407+_0xb0b4('0x10'))[_0xb0b4('0x12')]('tools_tags','t',_0xb0b4('0x13'));return _0x14833f;}function addFieldsToQuery(_0x4665e5,_0x526ca5,_0x24f1b4,_0x202f8c,_0x40aea8){var _0x18363f=_0x40aea8?'c':_0xb0b4('0xd');if(!_0x526ca5){_0x526ca5=['id',_0xb0b4('0x14'),_0xb0b4('0x15'),_0xb0b4('0x16'),_0xb0b4('0x17'),_0xb0b4('0x18'),'email',_0xb0b4('0x8'),'CompanyId',_0xb0b4('0x19'),_0xb0b4('0x1a'),_0xb0b4('0x1b'),_0xb0b4('0x1c')];}else if(!_0x526ca5[_0xb0b4('0x1d')]('id')){_0x526ca5[_0xb0b4('0x1e')]('id');}var _0x20dd30=_0x24f1b4&&_0x40aea8||!_0x24f1b4&&!_0x40aea8;if(_0x202f8c){_0x20dd30=_0x202f8c&&_0x40aea8||!_0x202f8c&&!_0x40aea8;}_0x526ca5['forEach'](function(_0x2ae90f){if(_0x2ae90f===_0xb0b4('0x1c')){if(_0x20dd30){_0x4665e5['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ae90f);}else if(_0x24f1b4||_0x202f8c){_0x4665e5[_0xb0b4('0x1f')](_0x18363f+'.'+_0x2ae90f);}}else{_0x4665e5['field'](_0x18363f+'.'+_0x2ae90f);}});return _0x4665e5;}function getSqlClauses(){var _0x2b2ace={'default':squel[_0xb0b4('0x20')](),'fields':squel[_0xb0b4('0x20')](),'filter':squel[_0xb0b4('0x20')](),'tags':{'clause':squel[_0xb0b4('0x20')](),'ids':null},'user':{'clause':squel[_0xb0b4('0x20')](),'skip':![]}};return _0x2b2ace;}function parseTagParameter(_0x5ba934){var _0x33c44c=squel[_0xb0b4('0x20')]();if(_0x5ba934){var _0x37b8f4=utils[_0xb0b4('0x21')](_0x5ba934);_0x37b8f4['forEach'](function(_0x4f9346){_0x33c44c['or'](_0xb0b4('0x22'),'%,'+_0x4f9346+',%');});}return _0x33c44c;}function parseSearchFilter(_0x19e7d6){var _0x210839=squel[_0xb0b4('0x20')]();if(_0x19e7d6){var _0x351b9f=_0x19e7d6[_0xb0b4('0x23')]('\x5c','\x5c\x5c')[_0xb0b4('0x23')](/'/g,'\x27\x27');if(_0x351b9f[_0xb0b4('0x24')]('\x20')[_0xb0b4('0x25')]>0x1){_0x210839['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0b4('0x26')](_0x351b9f,!![]),null);}else{if(qs[_0xb0b4('0x27')](_0x351b9f)){_0x210839['or'](_0xb0b4('0x28'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x29'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2a'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2b'),_0x351b9f+'%');}else if(qs['isEmail'](_0x351b9f)){_0x210839['or']('c.email\x20LIKE\x20?',_0x351b9f+'%');}else{_0x210839['or'](_0xb0b4('0x2c'),'%'+_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2d'),'%'+_0x351b9f+'%');_0x210839['or']('c.email\x20LIKE\x20?','%'+_0x351b9f+'%');}}}return _0x210839;}function parseAdvancedSearchFilter(_0x292530,_0x137a53){var _0xcd6988=getSqlClauses();var _0x3d9bb7=as[_0xb0b4('0x2e')](_0x292530);var _0x368588=_0x3d9bb7[_0xb0b4('0x2f')];for(var _0x258178=0x0;_0x258178<_0x3d9bb7['conditions'][_0xb0b4('0x25')];_0x258178++){var _0x2b14b3=_0x3d9bb7[_0xb0b4('0x30')][_0x258178];var _0x3769bc='c';var _0x58325a=_[_0xb0b4('0x31')](_0x137a53,['name',_0x2b14b3[_0xb0b4('0x1f')]]);if(_0x58325a){if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x32')||_0x58325a[_0xb0b4('0x33')]==='datetime'){_0x2b14b3[_0xb0b4('0x34')]=_0xb0b4('0x35');}var _0x1ec03b=as['buildExpression'](_0x3769bc,_0x58325a[_0xb0b4('0x36')],_0x2b14b3);_0xcd6988[_0xb0b4('0x37')][_0x368588](_0x1ec03b[_0xb0b4('0x38')],_0x1ec03b[_0xb0b4('0x39')][_0xb0b4('0x3a')],_0x1ec03b[_0xb0b4('0x39')][_0xb0b4('0x3b')]);}else{if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x3c')){var _0x4df370=_0x2b14b3[_0xb0b4('0x39')]['split'](',')['map'](function(_0x3b638c){return Number(_0x3b638c);});var _0x405be5=parseTagParameter(_0x4df370);_0xcd6988[_0xb0b4('0x3d')]['clause']['and'](_0x405be5);_0xcd6988[_0xb0b4('0x3d')][_0xb0b4('0x3e')]=_0x4df370;}else if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x3f')){_0xcd6988[_0xb0b4('0x40')][_0xb0b4('0x41')]['and']('uc.UserId\x20=\x20?',_0x2b14b3[_0xb0b4('0x39')]);_0xcd6988['user'][_0xb0b4('0x42')]=!![];}}}return _0xcd6988;}function parseModelFields(_0x21ecd4,_0x1d8634){var _0xf96021=squel[_0xb0b4('0x20')]();var _0xcbdbe7=_(_0x21ecd4)['keys']()[_0xb0b4('0x43')](function(_0x471063){return _[_0xb0b4('0x44')](_0x1d8634,[_0xb0b4('0x45'),_0x471063])?_0x471063:undefined;})['compact']()[_0xb0b4('0x39')]();if(_0x21ecd4[_0xb0b4('0x46')]){_0xcbdbe7['push'](_0xb0b4('0x46'));}if(_0x21ecd4['User']){_0xcbdbe7[_0xb0b4('0x1e')]('User');}if(_0xcbdbe7[_0xb0b4('0x25')]>0x0){_0xcbdbe7[_0xb0b4('0x47')](function(_0xe09240){if(_0xe09240==='ListId'){_0xf96021[_0xb0b4('0x48')]('c.ListId\x20IN\x20?',[][_0xb0b4('0x49')](_0x21ecd4[_0xe09240]));}else if(_0xe09240==='Contact'){var _0xdd43f1='%'+_0x21ecd4[_0xe09240]+'%';_0xf96021['and'](_0xb0b4('0x4a'),_0xdd43f1);}else if(_0xe09240===_0xb0b4('0x3f')){_0xf96021[_0xb0b4('0x48')](_0xb0b4('0x4b'),_0x21ecd4[_0xe09240]);}else{_0xf96021[_0xb0b4('0x48')]('c.'+_0xe09240+_0xb0b4('0x4c'),_0x21ecd4[_0xe09240]);}});}return _0xf96021;}function parseQueryParameters(_0x1ac960,_0x21c819){var _0x5cd01b=getSqlClauses();return Promise[_0xb0b4('0x4d')]()[_0xb0b4('0x4e')](function(){return parseModelFields(_0x1ac960,_0x21c819);})['then'](function(_0x284479){_0x5cd01b['fields'][_0xb0b4('0x48')](_0x284479);return parseTagParameter(_0x1ac960[_0xb0b4('0x4f')]);})[_0xb0b4('0x4e')](function(_0x57e365){_0x5cd01b[_0xb0b4('0x3d')][_0xb0b4('0x41')][_0xb0b4('0x48')](_0x57e365);return parseSearchFilter(_0x1ac960[_0xb0b4('0x50')]);})['then'](function(_0x479f88){_0x5cd01b[_0xb0b4('0x50')]=_0x479f88;return _0x5cd01b;});}function checkListsRestrictions(_0x4466c5,_0x49d5ef,_0x48b2e9){var _0x2c9bf3=squel['expr']();return Promise[_0xb0b4('0x4d')]()[_0xb0b4('0x4e')](function(){if(_0x49d5ef[_0xb0b4('0x7')]&&_0x4466c5[_0xb0b4('0x5')]===_0xb0b4('0x6')&&!_0x48b2e9){return _0x4466c5['getLists']({'attributes':['id'],'raw':!![]});}})[_0xb0b4('0x4e')](function(_0x193606){if(_0x193606){if(_0x193606[_0xb0b4('0x25')]===0x0){_0x2c9bf3['and'](_0xb0b4('0x51'));}else{_0x2c9bf3[_0xb0b4('0x48')](_0xb0b4('0x52'),_[_0xb0b4('0x43')](_0x193606,'id'));}}})[_0xb0b4('0x4e')](function(){return _0x2c9bf3;});}function buildContactsQuery(_0x2554d6,_0x1e4b33,_0x124e31,_0x5b690f,_0x2742ce,_0x23ec4f){if(_0x1e4b33){_0x1e4b33=_0x124e31['attributes'];}_0x2554d6=addFieldsToQuery(_0x2554d6,_0x1e4b33,_0x5b690f,_0x23ec4f,!![]);var _0x4d967c=squel['select']();_0x4d967c=addFieldsToQuery(_0x4d967c,_0x1e4b33,_0x5b690f,_0x23ec4f,![]);if(_0x5b690f||_0x23ec4f){_0x2554d6=applyJoinClauses(_0x2554d6,!![]);_0x2554d6['group']('c.id');if(_0x124e31['limit']){_0x4d967c[_0xb0b4('0x53')](_0x124e31[_0xb0b4('0x53')]);}if(_0x124e31[_0xb0b4('0x54')]){_0x4d967c[_0xb0b4('0x54')](_0x124e31['offset']);}}else{_0x4d967c=applyJoinClauses(_0x4d967c,![]);_0x4d967c[_0xb0b4('0x55')]('subqry.id');if(_0x124e31[_0xb0b4('0x53')]){_0x2554d6[_0xb0b4('0x53')](_0x124e31[_0xb0b4('0x53')]);}if(_0x124e31[_0xb0b4('0x54')]){_0x2554d6[_0xb0b4('0x54')](_0x124e31[_0xb0b4('0x54')]);}}_0x4d967c[_0xb0b4('0x56')](_0x2742ce);if(_0x124e31[_0xb0b4('0x57')]){_0x124e31[_0xb0b4('0x57')][_0xb0b4('0x47')](function(_0x89b9a1){_0x2554d6[_0xb0b4('0x57')]('c.'+_0x89b9a1[0x0],_0x89b9a1[0x1]===_0xb0b4('0x58')?![]:!![]);_0x4d967c[_0xb0b4('0x57')](_0xb0b4('0x59')+_0x89b9a1[0x0],_0x89b9a1[0x1]===_0xb0b4('0x58')?![]:!![]);});}_0x4d967c['from'](_0x2554d6,'subqry');return _0x4d967c;}function getFilteredContacts(_0x1d1f16){var _0x2d69d2=[];return db[_0xb0b4('0x3c')][_0xb0b4('0x5a')]({'attributes':['id',_0xb0b4('0x45'),_0xb0b4('0x5b')],'raw':!![]})['then'](function(_0x57c10d){_0x2d69d2=_[_0xb0b4('0x5c')](_0x57c10d,'id');var _0x1462ca={'type':db[_0xb0b4('0x5d')][_0xb0b4('0x5e')][_0xb0b4('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb0b4('0x60')]['query'](_0x1d1f16[_0xb0b4('0x61')](),_0x1462ca);})['then'](function(_0xf56a5a){_0xf56a5a[_0xb0b4('0x47')](function(_0x440a95){if(_0x440a95[_0xb0b4('0x1c')]){_0x440a95[_0xb0b4('0x62')]=[];_0x440a95['TagIds'][_0xb0b4('0x24')](',')[_0xb0b4('0x47')](function(_0x50b968){_0x440a95[_0xb0b4('0x62')][_0xb0b4('0x1e')](_0x2d69d2[_0x50b968]);});}delete _0x440a95[_0xb0b4('0x1c')];});return _0xf56a5a;});}function countFilteredContacts(_0x24f6e9,_0x5b55d5){var _0x19f53a=_0x24f6e9[_0xb0b4('0x63')]();_0x19f53a[_0xb0b4('0x1f')](_0xb0b4('0x64'));_0x19f53a=applyJoinClauses(_0x19f53a,!![]);_0x24f6e9['group'](_0xb0b4('0x65'));var _0x54e99f=utils['getSelectedTags'](_0x5b55d5);if(!_[_0xb0b4('0x66')](_0x54e99f)){_0x19f53a[_0xb0b4('0x67')](_0xb0b4('0x68'),_0x54e99f);}var _0x39bdc5={'type':db[_0xb0b4('0x5d')][_0xb0b4('0x5e')][_0xb0b4('0x5f')],'raw':!![]};return db[_0xb0b4('0x60')]['query'](_0x19f53a[_0xb0b4('0x61')](),_0x39bdc5)['then'](function(_0x13392d){return _0x13392d[0x0][_0xb0b4('0x64')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe3f5=['filter','then','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','query','toString','Tags','split','clone','COUNT(*)','isEmpty','where','SELECT','sequelize','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','parseSearch','find','name','fieldType','datetime','castTo','DATE','buildExpression','type','default','value','Tag','map','clause','and','tags','ids','User','user','skip','keys','some','compact','push','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','fields','tag'];(function(_0x3f2116,_0x24e88d){var _0x442698=function(_0x52e250){while(--_0x52e250){_0x3f2116['push'](_0x3f2116['shift']());}};_0x442698(++_0x24e88d);}(_0xe3f5,0x15f));var _0x5e3f=function(_0x10e05,_0x4d99dd){_0x10e05=_0x10e05-0x0;var _0xd0153=_0xe3f5[_0x10e05];return _0xd0153;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x5e3f('0x0'));var qs=require(_0x5e3f('0x1'));var utils=require(_0x5e3f('0x2'));var db=require(_0x5e3f('0x3'))['db'];function skipContactsQuery(_0x593708,_0x23c7f5){var _0x3af68f=![];if(_0x593708[_0x5e3f('0x4')]===_0x5e3f('0x5')&&!_0x23c7f5[_0x5e3f('0x6')]&&!_0x23c7f5[_0x5e3f('0x7')]&&_0x23c7f5[_0x5e3f('0x8')]!=='true'){_0x3af68f=!![];}return _0x3af68f;}function getContactsSubquery(){return squel[_0x5e3f('0x9')]()['from'](_0x5e3f('0xa'),'c')['where'](_0x5e3f('0xb'));}function applyJoinClauses(_0x4bbcf1,_0x2ab1dc){var _0x2aee38=_0x2ab1dc?'c':_0x5e3f('0xc');_0x4bbcf1[_0x5e3f('0xd')](_0x5e3f('0xe'),'uc',_0x5e3f('0xf')+_0x2aee38+_0x5e3f('0x10'))[_0x5e3f('0xd')](_0x5e3f('0x11'),'ct',_0x5e3f('0x12')+_0x2aee38+'.id')[_0x5e3f('0xd')](_0x5e3f('0x13'),'t',_0x5e3f('0x14'));return _0x4bbcf1;}function addFieldsToQuery(_0x3d9cfc,_0x22f4f7,_0x376329,_0x2da70e,_0x4a2fea){var _0x3de6ce=_0x4a2fea?'c':_0x5e3f('0xc');if(!_0x22f4f7){_0x22f4f7=['id',_0x5e3f('0x15'),_0x5e3f('0x16'),'phone',_0x5e3f('0x17'),_0x5e3f('0x18'),'email','ListId',_0x5e3f('0x19'),_0x5e3f('0x1a'),_0x5e3f('0x1b'),_0x5e3f('0x1c'),_0x5e3f('0x1d')];}else if(!_0x22f4f7[_0x5e3f('0x1e')]('id')){_0x22f4f7['push']('id');}var _0x3b5b70=_0x376329&&_0x4a2fea||!_0x376329&&!_0x4a2fea;if(_0x2da70e){_0x3b5b70=_0x2da70e&&_0x4a2fea||!_0x2da70e&&!_0x4a2fea;}_0x22f4f7[_0x5e3f('0x1f')](function(_0x3401e2){if(_0x3401e2===_0x5e3f('0x1d')){if(_0x3b5b70){_0x3d9cfc[_0x5e3f('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3401e2);}else if(_0x376329||_0x2da70e){_0x3d9cfc[_0x5e3f('0x20')](_0x3de6ce+'.'+_0x3401e2);}}else{_0x3d9cfc[_0x5e3f('0x20')](_0x3de6ce+'.'+_0x3401e2);}});return _0x3d9cfc;}function getSqlClauses(){var _0x3b7adf={'default':squel[_0x5e3f('0x21')](),'fields':squel[_0x5e3f('0x21')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x5e3f('0x21')](),'ids':null},'user':{'clause':squel[_0x5e3f('0x21')](),'skip':![]}};return _0x3b7adf;}function parseTagParameter(_0x18b216){var _0x116c70=squel[_0x5e3f('0x21')]();if(_0x18b216){var _0x345355=utils[_0x5e3f('0x22')](_0x18b216);_0x345355[_0x5e3f('0x1f')](function(_0x4c26c2){_0x116c70['or'](_0x5e3f('0x23'),'%,'+_0x4c26c2+',%');});}return _0x116c70;}function parseSearchFilter(_0x4e58b2){var _0xb9ba16=squel[_0x5e3f('0x21')]();if(_0x4e58b2){var _0x3d3e51=_0x4e58b2[_0x5e3f('0x24')]('\x5c','\x5c\x5c')[_0x5e3f('0x24')](/'/g,'\x27\x27');if(_0x3d3e51['split']('\x20')[_0x5e3f('0x25')]>0x1){_0xb9ba16['or'](_0x5e3f('0x26'),qs[_0x5e3f('0x27')](_0x3d3e51,!![]),null);}else{if(qs['isNumeric'](_0x3d3e51)){_0xb9ba16['or'](_0x5e3f('0x28'),_0x3d3e51+'%');_0xb9ba16['or'](_0x5e3f('0x29'),_0x3d3e51+'%');_0xb9ba16['or'](_0x5e3f('0x2a'),_0x3d3e51+'%');_0xb9ba16['or'](_0x5e3f('0x2b'),_0x3d3e51+'%');}else if(qs[_0x5e3f('0x2c')](_0x3d3e51)){_0xb9ba16['or']('c.email\x20LIKE\x20?',_0x3d3e51+'%');}else{_0xb9ba16['or']('c.firstName\x20LIKE\x20?','%'+_0x3d3e51+'%');_0xb9ba16['or'](_0x5e3f('0x2d'),'%'+_0x3d3e51+'%');_0xb9ba16['or']('c.email\x20LIKE\x20?','%'+_0x3d3e51+'%');}}}return _0xb9ba16;}function parseAdvancedSearchFilter(_0x1ade49,_0x2db772){var _0x457d66=getSqlClauses();var _0x9f0745=as[_0x5e3f('0x2e')](_0x1ade49);var _0x3d5928=_0x9f0745['sqlOperator'];for(var _0x2bb49d=0x0;_0x2bb49d<_0x9f0745['conditions']['length'];_0x2bb49d++){var _0x51e25e=_0x9f0745['conditions'][_0x2bb49d];var _0x278b00='c';var _0x2bfb0c=_[_0x5e3f('0x2f')](_0x2db772,[_0x5e3f('0x30'),_0x51e25e['field']]);if(_0x2bfb0c){if(_0x51e25e[_0x5e3f('0x20')]==='dateOfBirth'||_0x2bfb0c[_0x5e3f('0x31')]===_0x5e3f('0x32')){_0x51e25e[_0x5e3f('0x33')]=_0x5e3f('0x34');}var _0x5c3b96=as[_0x5e3f('0x35')](_0x278b00,_0x2bfb0c[_0x5e3f('0x36')],_0x51e25e);_0x457d66[_0x5e3f('0x37')][_0x3d5928](_0x5c3b96['text'],_0x5c3b96[_0x5e3f('0x38')]['start'],_0x5c3b96[_0x5e3f('0x38')]['end']);}else{if(_0x51e25e[_0x5e3f('0x20')]===_0x5e3f('0x39')){var _0x3b6177=_0x51e25e[_0x5e3f('0x38')]['split'](',')[_0x5e3f('0x3a')](function(_0x58bcd0){return Number(_0x58bcd0);});var _0x162cde=parseTagParameter(_0x3b6177);_0x457d66['tags'][_0x5e3f('0x3b')][_0x5e3f('0x3c')](_0x162cde);_0x457d66[_0x5e3f('0x3d')][_0x5e3f('0x3e')]=_0x3b6177;}else if(_0x51e25e[_0x5e3f('0x20')]===_0x5e3f('0x3f')){_0x457d66[_0x5e3f('0x40')][_0x5e3f('0x3b')][_0x5e3f('0x3c')]('uc.UserId\x20=\x20?',_0x51e25e['value']);_0x457d66[_0x5e3f('0x40')][_0x5e3f('0x41')]=!![];}}}return _0x457d66;}function parseModelFields(_0x3ee108,_0x14d134){var _0x313ca9=squel['expr']();var _0x512940=_(_0x3ee108)[_0x5e3f('0x42')]()[_0x5e3f('0x3a')](function(_0x4969d4){return _[_0x5e3f('0x43')](_0x14d134,[_0x5e3f('0x30'),_0x4969d4])?_0x4969d4:undefined;})[_0x5e3f('0x44')]()[_0x5e3f('0x38')]();if(_0x3ee108['Contact']){_0x512940[_0x5e3f('0x45')](_0x5e3f('0x46'));}if(_0x3ee108[_0x5e3f('0x3f')]){_0x512940[_0x5e3f('0x45')](_0x5e3f('0x3f'));}if(_0x512940[_0x5e3f('0x25')]>0x0){_0x512940[_0x5e3f('0x1f')](function(_0x2f9f5a){if(_0x2f9f5a==='ListId'){_0x313ca9[_0x5e3f('0x3c')](_0x5e3f('0x47'),[][_0x5e3f('0x48')](_0x3ee108[_0x2f9f5a]));}else if(_0x2f9f5a===_0x5e3f('0x46')){var _0x8d8601='%'+_0x3ee108[_0x2f9f5a]+'%';_0x313ca9[_0x5e3f('0x3c')](_0x5e3f('0x49'),_0x8d8601);}else if(_0x2f9f5a===_0x5e3f('0x3f')){_0x313ca9[_0x5e3f('0x3c')](_0x5e3f('0x4a'),_0x3ee108[_0x2f9f5a]);}else{_0x313ca9[_0x5e3f('0x3c')]('c.'+_0x2f9f5a+'\x20=\x20?',_0x3ee108[_0x2f9f5a]);}});}return _0x313ca9;}function parseQueryParameters(_0x257421,_0x46b453){var _0x4f9c16=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x257421,_0x46b453);})['then'](function(_0x3a997b){_0x4f9c16[_0x5e3f('0x4b')]['and'](_0x3a997b);return parseTagParameter(_0x257421[_0x5e3f('0x4c')]);})['then'](function(_0x2463d5){_0x4f9c16['tags'][_0x5e3f('0x3b')][_0x5e3f('0x3c')](_0x2463d5);return parseSearchFilter(_0x257421[_0x5e3f('0x4d')]);})[_0x5e3f('0x4e')](function(_0x159ec0){_0x4f9c16['filter']=_0x159ec0;return _0x4f9c16;});}function checkListsRestrictions(_0x946df1,_0x24ad4e,_0x24af83){var _0x43436c=squel['expr']();return Promise['resolve']()[_0x5e3f('0x4e')](function(){if(_0x24ad4e['search']&&_0x946df1['role']===_0x5e3f('0x5')&&!_0x24af83){return _0x946df1[_0x5e3f('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x5e3f('0x4e')](function(_0x4ce354){if(_0x4ce354){if(_0x4ce354[_0x5e3f('0x25')]===0x0){_0x43436c[_0x5e3f('0x3c')](_0x5e3f('0x50'));}else{_0x43436c[_0x5e3f('0x3c')](_0x5e3f('0x47'),_[_0x5e3f('0x3a')](_0x4ce354,'id'));}}})[_0x5e3f('0x4e')](function(){return _0x43436c;});}function buildContactsQuery(_0x3c791a,_0x4a7b12,_0xee8a2f,_0x2ac6e5,_0x268317,_0x46d1f0){if(_0x4a7b12){_0x4a7b12=_0xee8a2f['attributes'];}_0x3c791a=addFieldsToQuery(_0x3c791a,_0x4a7b12,_0x2ac6e5,_0x46d1f0,!![]);var _0x52ad63=squel[_0x5e3f('0x9')]();_0x52ad63=addFieldsToQuery(_0x52ad63,_0x4a7b12,_0x2ac6e5,_0x46d1f0,![]);if(_0x2ac6e5||_0x46d1f0){_0x3c791a=applyJoinClauses(_0x3c791a,!![]);_0x3c791a[_0x5e3f('0x51')](_0x5e3f('0x52'));if(_0xee8a2f['limit']){_0x52ad63[_0x5e3f('0x53')](_0xee8a2f[_0x5e3f('0x53')]);}if(_0xee8a2f[_0x5e3f('0x54')]){_0x52ad63[_0x5e3f('0x54')](_0xee8a2f[_0x5e3f('0x54')]);}}else{_0x52ad63=applyJoinClauses(_0x52ad63,![]);_0x52ad63[_0x5e3f('0x51')]('subqry.id');if(_0xee8a2f[_0x5e3f('0x53')]){_0x3c791a['limit'](_0xee8a2f[_0x5e3f('0x53')]);}if(_0xee8a2f['offset']){_0x3c791a[_0x5e3f('0x54')](_0xee8a2f[_0x5e3f('0x54')]);}}_0x52ad63[_0x5e3f('0x55')](_0x268317);if(_0xee8a2f[_0x5e3f('0x56')]){_0xee8a2f['order'][_0x5e3f('0x1f')](function(_0x20fa67){_0x3c791a[_0x5e3f('0x56')]('c.'+_0x20fa67[0x0],_0x20fa67[0x1]===_0x5e3f('0x57')?![]:!![]);_0x52ad63[_0x5e3f('0x56')](_0x5e3f('0x58')+_0x20fa67[0x0],_0x20fa67[0x1]==='DESC'?![]:!![]);});}_0x52ad63[_0x5e3f('0x59')](_0x3c791a,_0x5e3f('0xc'));return _0x52ad63;}function getFilteredContacts(_0x16d092){var _0x3bf692=[];return db[_0x5e3f('0x39')][_0x5e3f('0x5a')]({'attributes':['id',_0x5e3f('0x30'),_0x5e3f('0x5b')],'raw':!![]})[_0x5e3f('0x4e')](function(_0x605a5b){_0x3bf692=_[_0x5e3f('0x5c')](_0x605a5b,'id');var _0x245948={'type':db[_0x5e3f('0x5d')][_0x5e3f('0x5e')]['SELECT'],'model':db[_0x5e3f('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x5e3f('0x60')](_0x16d092[_0x5e3f('0x61')](),_0x245948);})[_0x5e3f('0x4e')](function(_0x1c7c64){_0x1c7c64['forEach'](function(_0x1f0c9d){if(_0x1f0c9d['TagIds']){_0x1f0c9d[_0x5e3f('0x62')]=[];_0x1f0c9d[_0x5e3f('0x1d')][_0x5e3f('0x63')](',')[_0x5e3f('0x1f')](function(_0x237a0f){_0x1f0c9d[_0x5e3f('0x62')][_0x5e3f('0x45')](_0x3bf692[_0x237a0f]);});}delete _0x1f0c9d[_0x5e3f('0x1d')];});return _0x1c7c64;});}function countFilteredContacts(_0x22b0f9,_0x278797){var _0x6d6c1e=_0x22b0f9[_0x5e3f('0x64')]();_0x6d6c1e['field'](_0x5e3f('0x65'));_0x6d6c1e=applyJoinClauses(_0x6d6c1e,!![]);_0x22b0f9[_0x5e3f('0x51')](_0x5e3f('0x52'));var _0x55d9ca=utils[_0x5e3f('0x22')](_0x278797);if(!_[_0x5e3f('0x66')](_0x55d9ca)){_0x6d6c1e[_0x5e3f('0x67')]('t.id\x20IN\x20?',_0x55d9ca);}var _0x1cd015={'type':db[_0x5e3f('0x5d')]['QueryTypes'][_0x5e3f('0x68')],'raw':!![]};return db[_0x5e3f('0x69')][_0x5e3f('0x60')](_0x6d6c1e[_0x5e3f('0x61')](),_0x1cd015)['then'](function(_0x1301bb){return _0x1301bb[0x0][_0x5e3f('0x65')];});}module[_0x5e3f('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b5d7a82..e48aa4d 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 _0x6dfa=['../../config/environment','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','binary','write','close','unlink','decryptFile','createDecipher','end','final','update','utf8','base64','decryptString','secret','crypto','bluebird'];(function(_0x2d21d6,_0x30d4d4){var _0x4fe398=function(_0x1d7107){while(--_0x1d7107){_0x2d21d6['push'](_0x2d21d6['shift']());}};_0x4fe398(++_0x30d4d4);}(_0x6dfa,0x1de));var _0xa6df=function(_0x56c4cc,_0x2e9510){_0x56c4cc=_0x56c4cc-0x0;var _0x1d2067=_0x6dfa[_0x56c4cc];return _0x1d2067;};'use strict';var crypto=require(_0xa6df('0x0'));var fs=require('fs');var BPromise=require(_0xa6df('0x1'));var _=require('lodash');var config=require(_0xa6df('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xa6df('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa6df('0x4')};if(config[_0xa6df('0x5')]&&config['encrypt'][_0xa6df('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xa6df('0x6')]);if(isSupported){fileOptions[_0xa6df('0x6')]=config[_0xa6df('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa6df('0x7')](',\x20');logger['error'](config['encrypt'][_0xa6df('0x6')],_0xa6df('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0xe619c7){return AES_SUPPORTED_RX[_0xa6df('0x9')](_0xe619c7);}function getSupportedCiphers(){return crypto[_0xa6df('0xa')]()[_0xa6df('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3dbb74){return getSupportedCiphers()[_0xa6df('0xc')](_0x3dbb74)>-0x1;}function combineOptions(_0x3a69e3){var _0x2de973={};for(var _0x4ce1e0 in fileOptions){if(fileOptions[_0xa6df('0xd')](_0x4ce1e0)){_0x2de973[_0x4ce1e0]=fileOptions[_0x4ce1e0];}}if(_0x3a69e3){for(var _0x5cf1be in _0x3a69e3){if(_0x3a69e3[_0xa6df('0xd')](_0x5cf1be)){_0x2de973[_0x5cf1be]=_0x3a69e3[_0x5cf1be];}}}return _0x2de973;}exports['encryptFile']=function(_0x524928,_0x3ec483,_0x15ed82,_0x335962){return new BPromise(function(_0x15ecb9,_0x276b6b){_0x335962=combineOptions(_0x335962);var _0x4d7a7d=new Buffer(_0x15ed82);var _0x293aa2=fs[_0xa6df('0xe')](_0x524928);var _0x4825a7=fs[_0xa6df('0xf')](_0x3ec483);var _0x28b1a4=crypto['createCipher'](_0x335962[_0xa6df('0x6')],_0x4d7a7d);_0x293aa2['on'](_0xa6df('0x10'),function(_0x4a6e7e){var _0x20f3a9=new Buffer(_0x28b1a4['update'](_0x4a6e7e),_0xa6df('0x11'));_0x4825a7[_0xa6df('0x12')](_0x20f3a9);});_0x293aa2['on']('end',function(){try{var _0x1d55d6=new Buffer(_0x28b1a4['final'](_0xa6df('0x11')),_0xa6df('0x11'));_0x4825a7[_0xa6df('0x12')](_0x1d55d6);_0x4825a7['end']();_0x4825a7['on'](_0xa6df('0x13'),function(){return _0x15ecb9(_0x3ec483);});}catch(_0x12bb71){fs[_0xa6df('0x14')](_0x3ec483);return _0x276b6b(_0x12bb71);}});});};exports[_0xa6df('0x15')]=function(_0x200040,_0x46db43,_0x1d217b,_0x463d63){return new BPromise(function(_0x4a9929,_0x258648){_0x463d63=combineOptions(_0x463d63);var _0x176868=new Buffer(_0x1d217b);var _0xed6c8f=fs[_0xa6df('0xe')](_0x200040);var _0x4401aa=fs[_0xa6df('0xf')](_0x46db43);var _0x50ea8d=crypto[_0xa6df('0x16')](_0x463d63[_0xa6df('0x6')],_0x176868);_0xed6c8f['on'](_0xa6df('0x10'),function(_0x59be92){var _0x3844a0=new Buffer(_0x50ea8d['update'](_0x59be92),'binary');_0x4401aa[_0xa6df('0x12')](_0x3844a0);});_0xed6c8f['on'](_0xa6df('0x17'),function(){try{var _0xf9c196=new Buffer(_0x50ea8d[_0xa6df('0x18')]('binary'),_0xa6df('0x11'));_0x4401aa[_0xa6df('0x12')](_0xf9c196);_0x4401aa[_0xa6df('0x17')]();_0x4401aa['on'](_0xa6df('0x13'),function(){return _0x4a9929(_0x46db43);});}catch(_0x3e4b90){fs[_0xa6df('0x14')](_0x46db43);return _0x258648(_0x3e4b90);}});});};exports['encryptString']=function(_0x3feaac,_0x542d72,_0x3708d2){var _0x122e8d=_0x3708d2||stringOptions['algorithm'];var _0x3ba348=_0x542d72||stringOptions['secret'];var _0x5bf5f3=crypto['createCipher'](_0x122e8d,_0x3ba348);var _0x3de1ac=_0x5bf5f3[_0xa6df('0x19')](_0x3feaac,_0xa6df('0x1a'),_0xa6df('0x1b'));_0x3de1ac+=_0x5bf5f3['final'](_0xa6df('0x1b'));return _0x3de1ac;};exports[_0xa6df('0x1c')]=function(_0x5a6cd6,_0x184f61,_0xa67df8){var _0x38607b=_0xa67df8||stringOptions['algorithm'];var _0x3c1401=_0x184f61||stringOptions[_0xa6df('0x1d')];var _0x3a9237=crypto['createDecipher'](_0x38607b,_0x3c1401);var _0x34b0ed=_0x3a9237[_0xa6df('0x19')](_0x5a6cd6,_0xa6df('0x1b'),_0xa6df('0x1a'));_0x34b0ed+=_0x3a9237[_0xa6df('0x18')](_0xa6df('0x1a'));return _0x34b0ed;}; \ No newline at end of file +var _0x69bc=['close','decryptFile','createReadStream','createDecipher','final','unlink','encryptString','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','data','update','write','end','binary'];(function(_0x1b4bdc,_0x11f92c){var _0x246255=function(_0x52ca0b){while(--_0x52ca0b){_0x1b4bdc['push'](_0x1b4bdc['shift']());}};_0x246255(++_0x11f92c);}(_0x69bc,0x71));var _0xc69b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x69bc[_0x14add3];return _0x4a174f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc69b('0x0'));var _=require(_0xc69b('0x1'));var config=require(_0xc69b('0x2'));var logger=require(_0xc69b('0x3'))(_0xc69b('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc69b('0x5')][_0xc69b('0x6')],'algorithm':_0xc69b('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xc69b('0x8')]&&config[_0xc69b('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc69b('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0xc69b('0x8')][_0xc69b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xc69b('0xa')](config[_0xc69b('0x8')][_0xc69b('0x9')],_0xc69b('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5037d8){return AES_SUPPORTED_RX[_0xc69b('0xc')](_0x5037d8);}function getSupportedCiphers(){return crypto[_0xc69b('0xd')]()[_0xc69b('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x31e561){return getSupportedCiphers()[_0xc69b('0xf')](_0x31e561)>-0x1;}function combineOptions(_0x2fc545){var _0x3d1d89={};for(var _0x37fa03 in fileOptions){if(fileOptions[_0xc69b('0x10')](_0x37fa03)){_0x3d1d89[_0x37fa03]=fileOptions[_0x37fa03];}}if(_0x2fc545){for(var _0x3fe9bc in _0x2fc545){if(_0x2fc545[_0xc69b('0x10')](_0x3fe9bc)){_0x3d1d89[_0x3fe9bc]=_0x2fc545[_0x3fe9bc];}}}return _0x3d1d89;}exports[_0xc69b('0x11')]=function(_0x34355a,_0x13b421,_0x56141f,_0x274087){return new BPromise(function(_0x5ad270,_0x22eff3){_0x274087=combineOptions(_0x274087);var _0x3ad2d3=new Buffer(_0x56141f);var _0x10173a=fs['createReadStream'](_0x34355a);var _0x50c6dc=fs['createWriteStream'](_0x13b421);var _0xb06534=crypto['createCipher'](_0x274087['algorithm'],_0x3ad2d3);_0x10173a['on'](_0xc69b('0x12'),function(_0x17708a){var _0x3e56ad=new Buffer(_0xb06534[_0xc69b('0x13')](_0x17708a),'binary');_0x50c6dc[_0xc69b('0x14')](_0x3e56ad);});_0x10173a['on'](_0xc69b('0x15'),function(){try{var _0x4d0c93=new Buffer(_0xb06534['final'](_0xc69b('0x16')),_0xc69b('0x16'));_0x50c6dc[_0xc69b('0x14')](_0x4d0c93);_0x50c6dc['end']();_0x50c6dc['on'](_0xc69b('0x17'),function(){return _0x5ad270(_0x13b421);});}catch(_0x5fda9){fs['unlink'](_0x13b421);return _0x22eff3(_0x5fda9);}});});};exports[_0xc69b('0x18')]=function(_0x363a19,_0x4a8b4d,_0x54cc0c,_0xc66306){return new BPromise(function(_0x5e2ba8,_0x692b88){_0xc66306=combineOptions(_0xc66306);var _0x2389fd=new Buffer(_0x54cc0c);var _0x17d6d6=fs[_0xc69b('0x19')](_0x363a19);var _0x597ad5=fs['createWriteStream'](_0x4a8b4d);var _0x511f55=crypto[_0xc69b('0x1a')](_0xc66306[_0xc69b('0x9')],_0x2389fd);_0x17d6d6['on'](_0xc69b('0x12'),function(_0x20570c){var _0x140564=new Buffer(_0x511f55['update'](_0x20570c),_0xc69b('0x16'));_0x597ad5[_0xc69b('0x14')](_0x140564);});_0x17d6d6['on'](_0xc69b('0x15'),function(){try{var _0x30fa65=new Buffer(_0x511f55[_0xc69b('0x1b')]('binary'),_0xc69b('0x16'));_0x597ad5[_0xc69b('0x14')](_0x30fa65);_0x597ad5[_0xc69b('0x15')]();_0x597ad5['on'](_0xc69b('0x17'),function(){return _0x5e2ba8(_0x4a8b4d);});}catch(_0x5ddf93){fs[_0xc69b('0x1c')](_0x4a8b4d);return _0x692b88(_0x5ddf93);}});});};exports[_0xc69b('0x1d')]=function(_0x4399e4,_0x5bb9ff,_0x528c57){var _0x2099c7=_0x528c57||stringOptions['algorithm'];var _0x42f835=_0x5bb9ff||stringOptions[_0xc69b('0x1e')];var _0x1960b5=crypto['createCipher'](_0x2099c7,_0x42f835);var _0x2300d0=_0x1960b5[_0xc69b('0x13')](_0x4399e4,_0xc69b('0x1f'),_0xc69b('0x20'));_0x2300d0+=_0x1960b5[_0xc69b('0x1b')]('base64');return _0x2300d0;};exports[_0xc69b('0x21')]=function(_0x236da4,_0x371f7d,_0x58f403){var _0x34f5ed=_0x58f403||stringOptions['algorithm'];var _0x277091=_0x371f7d||stringOptions[_0xc69b('0x1e')];var _0x5dfe9b=crypto[_0xc69b('0x1a')](_0x34f5ed,_0x277091);var _0x149634=_0x5dfe9b[_0xc69b('0x13')](_0x236da4,'base64','utf8');_0x149634+=_0x5dfe9b[_0xc69b('0x1b')]('utf8');return _0x149634;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 426fbbe..377d6a6 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 _0x3270=['lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','push','QueryTypes','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path'];(function(_0x2a8b3b,_0x5efd92){var _0x546b6c=function(_0x38f46a){while(--_0x38f46a){_0x2a8b3b['push'](_0x2a8b3b['shift']());}};_0x546b6c(++_0x5efd92);}(_0x3270,0x171));var _0x0327=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3270[_0x4e7d25];return _0x526fe6;};'use strict';var util=require(_0x0327('0x0'));var path=require(_0x0327('0x1'));var _=require(_0x0327('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0327('0x3'));var zipdir=require(_0x0327('0x4'));var rimraf=require('rimraf');var db=require(_0x0327('0x5'))['db'];var dbH=require(_0x0327('0x5'))[_0x0327('0x6')];var logger=require(_0x0327('0x7'))(_0x0327('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0327('0x9')][0x2]);var QUERY=process[_0x0327('0x9')][0x3];var PATH=process[_0x0327('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x183b37,_0x5b8d48){var _0x7cd64c={'status':_0x183b37};var _0x134c33={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5b8d48){_0x7cd64c[_0x0327('0xa')]=_0x5b8d48;}return db[_0x0327('0xb')][_0x0327('0xc')](_0x7cd64c,_0x134c33);}function main(){var _0x20bb6d=0x1388;var _0x4bb134;logger['info'](util[_0x0327('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0327('0xe')));return db[_0x0327('0xf')][_0x0327('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0327('0x11'),_0x0327('0x12')]})[_0x0327('0x13')](function(_0x45ee34){if(_0x45ee34){_0x4bb134=_0x45ee34;_0x20bb6d=_0x4bb134[_0x0327('0x12')]||0x1388;}})[_0x0327('0x13')](function(){return dbH[_0x0327('0x14')]['query'](util['format'](_0x0327('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x0327('0x16')]});})['then'](function(_0x39172b){if(!_0x39172b[0x0][_0x0327('0x17')]){return analyticExtractedReport(_0x0327('0x18'));}var _0x250ea4=[];var _0x52af3f=0x0;if(_0x4bb134['split']){if(_0x39172b&&_0x39172b[_0x0327('0x19')]){var _0x3106cf=_[_0x0327('0x1a')](_0x39172b[0x0]['num']/_0x20bb6d);var _0x593364=Number[_0x0327('0x1b')](_0x39172b[0x0][_0x0327('0x17')]/_0x20bb6d)?_0x39172b[0x0][_0x0327('0x17')]%_0x20bb6d:0x0;_0x3106cf[_0x0327('0x1c')](function(_0x53a5c4){if(_0x53a5c4>0x0){_0x52af3f+=_0x20bb6d;}_0x250ea4[_0x0327('0x1d')](dbH[_0x0327('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x20bb6d,_0x52af3f),{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));});if(_0x593364>0x0){_0x52af3f+=_0x20bb6d;_0x250ea4[_0x0327('0x1d')](dbH['sequelize'][_0x0327('0x1f')](util[_0x0327('0xd')](_0x0327('0x20'),QUERY,_0x593364,_0x52af3f),{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));}}}else{_0x250ea4[_0x0327('0x1d')](dbH[_0x0327('0x14')][_0x0327('0x1f')](QUERY,{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));}var _0x53a175=path[_0x0327('0x21')](PATH);var _0x13675a=path[_0x0327('0x22')](PATH,_0x0327('0x23'));var _0x502fcd=_0x4bb134[_0x0327('0x11')]&&_0x250ea4[_0x0327('0x19')]>0x1;var _0xb07d58=[];if(!fs['existsSync'](path[_0x0327('0x24')](_0x53a175,_0x13675a))&&_0x502fcd){fs[_0x0327('0x25')](path[_0x0327('0x24')](_0x53a175,_0x13675a));}return BPromise[_0x0327('0x26')](_0x250ea4,function(_0x287c88){_0xb07d58['push'](_0x287c88);})[_0x0327('0x13')](function(){for(var _0x5434b8=0x0;_0x5434b8<_0xb07d58['length'];_0x5434b8+=0x1){var _0x26c1f9;var _0x4ef27a=_0xb07d58[_0x5434b8];if(_0x502fcd){_0x26c1f9=path[_0x0327('0x24')](_0x53a175,_0x13675a,util[_0x0327('0xd')](_0x0327('0x27'),_0x13675a,_0x5434b8,'csv'));}else{_0x26c1f9=path[_0x0327('0x24')](_0x53a175,util[_0x0327('0xd')](_0x0327('0x28'),_0x13675a,_0x0327('0x29')));}fs[_0x0327('0x2a')](_0x26c1f9,csv(_0x4ef27a));}})['then'](function(){if(_0x502fcd){return new Promise(function(_0x50f244){zipdir(path[_0x0327('0x24')](_0x53a175,_0x13675a),{'saveTo':path[_0x0327('0x24')](_0x53a175,util[_0x0327('0xd')](_0x0327('0x28'),_0x13675a,_0x0327('0x2b')))},function(_0x47180a,_0x427182){rimraf(path[_0x0327('0x24')](_0x53a175,_0x13675a),function(){});_0x50f244(_0x0327('0x2c'));});});}})[_0x0327('0x13')](function(){logger[_0x0327('0x2d')](util['format'](_0x0327('0x2e'),EXTRACTED_REPORT_ID,_0x0327('0xe')));return analyticExtractedReport('Completed',_0x502fcd?util['format'](_0x0327('0x28'),_0x13675a,_0x502fcd?_0x0327('0x2b'):'csv'):null);});})[_0x0327('0x2f')](function(_0x23b4cf){logger['info'](util[_0x0327('0xd')](_0x0327('0x30'),EXTRACTED_REPORT_ID,_0x0327('0xe')),util[_0x0327('0x31')](_0x23b4cf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0327('0x32'));})[_0x0327('0x33')](function(){process[_0x0327('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xea85=['%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','range','num','isInteger','query','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each'];(function(_0x377ab9,_0x2f4b16){var _0x18d9eb=function(_0x155cc4){while(--_0x155cc4){_0x377ab9['push'](_0x377ab9['shift']());}};_0x18d9eb(++_0x2f4b16);}(_0xea85,0x137));var _0x5ea8=function(_0x259e6f,_0x4d570b){_0x259e6f=_0x259e6f-0x0;var _0x2c8e23=_0xea85[_0x259e6f];return _0x2c8e23;};'use strict';var util=require(_0x5ea8('0x0'));var path=require(_0x5ea8('0x1'));var _=require(_0x5ea8('0x2'));var csv=require(_0x5ea8('0x3'));var fs=require('fs');var BPromise=require(_0x5ea8('0x4'));var zipdir=require(_0x5ea8('0x5'));var rimraf=require(_0x5ea8('0x6'));var db=require(_0x5ea8('0x7'))['db'];var dbH=require(_0x5ea8('0x7'))[_0x5ea8('0x8')];var logger=require(_0x5ea8('0x9'))(_0x5ea8('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5ea8('0xb')][0x2]);var QUERY=process[_0x5ea8('0xb')][0x3];var PATH=process[_0x5ea8('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x49ee0c,_0x91676d){var _0x434189={'status':_0x49ee0c};var _0x425f8d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x91676d){_0x434189[_0x5ea8('0xc')]=_0x91676d;}return db[_0x5ea8('0xd')][_0x5ea8('0xe')](_0x434189,_0x425f8d);}function main(){var _0x501f10=0x1388;var _0x4551ce;logger[_0x5ea8('0xf')](util[_0x5ea8('0x10')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x5ea8('0x11')][_0x5ea8('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5ea8('0x13'),_0x5ea8('0x14')]})[_0x5ea8('0x15')](function(_0x51221d){if(_0x51221d){_0x4551ce=_0x51221d;_0x501f10=_0x4551ce['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x5ea8('0x16')]['query'](util[_0x5ea8('0x10')](_0x5ea8('0x17'),QUERY),{'type':dbH[_0x5ea8('0x16')]['QueryTypes'][_0x5ea8('0x18')]});})[_0x5ea8('0x15')](function(_0x4ddf99){if(!_0x4ddf99[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1d75aa=[];var _0x5a6540=0x0;if(_0x4551ce[_0x5ea8('0x13')]){if(_0x4ddf99&&_0x4ddf99[_0x5ea8('0x19')]){var _0x2ee32a=_[_0x5ea8('0x1a')](_0x4ddf99[0x0][_0x5ea8('0x1b')]/_0x501f10);var _0x1e9626=Number[_0x5ea8('0x1c')](_0x4ddf99[0x0][_0x5ea8('0x1b')]/_0x501f10)?_0x4ddf99[0x0][_0x5ea8('0x1b')]%_0x501f10:0x0;_0x2ee32a['forEach'](function(_0x4f924c){if(_0x4f924c>0x0){_0x5a6540+=_0x501f10;}_0x1d75aa['push'](dbH[_0x5ea8('0x16')][_0x5ea8('0x1d')](util[_0x5ea8('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x501f10,_0x5a6540),{'type':dbH[_0x5ea8('0x16')][_0x5ea8('0x1e')][_0x5ea8('0x18')]}));});if(_0x1e9626>0x0){_0x5a6540+=_0x501f10;_0x1d75aa[_0x5ea8('0x1f')](dbH[_0x5ea8('0x16')][_0x5ea8('0x1d')](util[_0x5ea8('0x10')](_0x5ea8('0x20'),QUERY,_0x1e9626,_0x5a6540),{'type':dbH[_0x5ea8('0x16')][_0x5ea8('0x1e')][_0x5ea8('0x18')]}));}}}else{_0x1d75aa['push'](dbH[_0x5ea8('0x16')]['query'](QUERY,{'type':dbH[_0x5ea8('0x16')][_0x5ea8('0x1e')][_0x5ea8('0x18')]}));}var _0x4ffc0d=path[_0x5ea8('0x21')](PATH);var _0xae45e8=path[_0x5ea8('0x22')](PATH,'.csv');var _0x48d1af=_0x4551ce[_0x5ea8('0x13')]&&_0x1d75aa['length']>0x1;var _0x1745f5=[];if(!fs[_0x5ea8('0x23')](path[_0x5ea8('0x24')](_0x4ffc0d,_0xae45e8))&&_0x48d1af){fs[_0x5ea8('0x25')](path[_0x5ea8('0x24')](_0x4ffc0d,_0xae45e8));}return BPromise[_0x5ea8('0x26')](_0x1d75aa,function(_0xda3f85){_0x1745f5['push'](_0xda3f85);})['then'](function(){for(var _0x4a7e0f=0x0;_0x4a7e0f<_0x1745f5[_0x5ea8('0x19')];_0x4a7e0f+=0x1){var _0xb9ec2c;var _0x2b3f4a=_0x1745f5[_0x4a7e0f];if(_0x48d1af){_0xb9ec2c=path[_0x5ea8('0x24')](_0x4ffc0d,_0xae45e8,util[_0x5ea8('0x10')](_0x5ea8('0x27'),_0xae45e8,_0x4a7e0f,_0x5ea8('0x28')));}else{_0xb9ec2c=path[_0x5ea8('0x24')](_0x4ffc0d,util[_0x5ea8('0x10')](_0x5ea8('0x29'),_0xae45e8,'csv'));}fs[_0x5ea8('0x2a')](_0xb9ec2c,csv(_0x2b3f4a));}})['then'](function(){if(_0x48d1af){return new Promise(function(_0x2231bd){zipdir(path[_0x5ea8('0x24')](_0x4ffc0d,_0xae45e8),{'saveTo':path[_0x5ea8('0x24')](_0x4ffc0d,util[_0x5ea8('0x10')](_0x5ea8('0x29'),_0xae45e8,'zip'))},function(_0x1208fe,_0x392c80){rimraf(path['join'](_0x4ffc0d,_0xae45e8),function(){});_0x2231bd(_0x5ea8('0x2b'));});});}})[_0x5ea8('0x15')](function(){logger[_0x5ea8('0xf')](util['format'](_0x5ea8('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5ea8('0x2d'),_0x48d1af?util[_0x5ea8('0x10')](_0x5ea8('0x29'),_0xae45e8,_0x48d1af?'zip':_0x5ea8('0x28')):null);});})[_0x5ea8('0x2e')](function(_0x2db237){logger[_0x5ea8('0xf')](util[_0x5ea8('0x10')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5ea8('0x2f')),util[_0x5ea8('0x30')](_0x2db237,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5ea8('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 63601ad..483b3b3 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 _0x33c6=['%s%d.%s','%s.%s','pdf','all','zip','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','push','body','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','length','range','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument'];(function(_0x202576,_0x194384){var _0x27dd3d=function(_0xa46bb5){while(--_0xa46bb5){_0x202576['push'](_0x202576['shift']());}};_0x27dd3d(++_0x194384);}(_0x33c6,0x73));var _0x633c=function(_0x5d5a02,_0x36fa21){_0x5d5a02=_0x5d5a02-0x0;var _0x30ff94=_0x33c6[_0x5d5a02];return _0x30ff94;};'use strict';var _=require(_0x633c('0x0'));var fs=require('fs');var util=require(_0x633c('0x1'));var path=require(_0x633c('0x2'));var moment=require(_0x633c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x633c('0x4'));var zipdir=require(_0x633c('0x5'));var rimraf=require(_0x633c('0x6'));var JSDOM=require(_0x633c('0x7'))[_0x633c('0x8')];var window=new JSDOM('')[_0x633c('0x9')];var BPromise=require(_0x633c('0xa'));var db=require(_0x633c('0xb'))['db'];var dbH=require(_0x633c('0xb'))['dbH'];var logger=require(_0x633c('0xc'))(_0x633c('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x633c('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x633c('0xe')][0x4];var NAME=process[_0x633c('0xe')][0x5];var FORMAT=_0x633c('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x92c4bc,_0x57966a){var _0x497f34={'status':_0x92c4bc};var _0x3d8d20={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57966a){_0x497f34[_0x633c('0x10')]=_0x57966a;}return db['AnalyticExtractedReport'][_0x633c('0x11')](_0x497f34,_0x3d8d20);}function getHeaders(_0x326155){return _[_0x633c('0x12')](_0x326155,function(_0x57838b){return{'text':_0x57838b,'style':_0x633c('0x13')};});}function getRows(_0x746646,_0x48a601){return _[_0x633c('0x12')](_0x48a601,function(_0x1e9a9f){return _(_0x1e9a9f)[_0x633c('0x14')](_0x746646)[_0x633c('0x12')](function(_0x2077fd){return _0x2077fd?_[_0x633c('0x15')](_0x2077fd):'';})[_0x633c('0x16')]();});}function createTable(_0x3b43e3,_0x2b642e){var _0x1df647={'widths':_[_0x633c('0x17')](Array(_0x3b43e3['length']),0x91),'heights':function(_0x49dda9){return _0x49dda9===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x13fbc5=getHeaders(_0x3b43e3);_0x1df647['body'][_0x633c('0x18')](_0x13fbc5);var _0xa16afe=getRows(_0x3b43e3,_0x2b642e);_0x1df647[_0x633c('0x19')]=_0x1df647['body']['concat'](_0xa16afe);return _0x1df647;}function createTables(_0x527445){var _0x263df1=[];var _0x2b8c8b=_['chunk'](Object[_0x633c('0x1a')](_0x527445[0x0]),0x5);_0x2b8c8b[_0x633c('0x1b')](function(_0x19718d){_0x263df1[_0x633c('0x18')](createTable(_0x19718d,_0x527445));});return _0x263df1;}function getPDFDocDefinition(_0x573952){var _0x56e57b=util['format'](_0x633c('0x1c'),NAME,EXTRACTED_REPORT[_0x633c('0x1d')],moment(EXTRACTED_REPORT[_0x633c('0x1e')])[_0x633c('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x633c('0x20')])['format'](FORMAT));var _0x54bbb2=[];for(var _0x336895=0x0;_0x336895<_0x573952['length'];_0x336895++){var _0x844356=[];if(_0x336895===0x0){_0x844356[_0x633c('0x18')]({'text':_0x56e57b,'style':_0x633c('0x21')});}var _0x1089db={'table':_0x573952[_0x336895]};if(_0x336895>0x0){_0x1089db[_0x633c('0x22')]=_0x633c('0x23');_0x1089db['margin']=[0x0,0x46,0x0,0x0];}_0x844356[_0x633c('0x18')](_0x1089db);_0x54bbb2[_0x633c('0x18')](_0x844356);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x54bbb2,'footer':function(_0x42be4b,_0x16a8d5){return{'text':_0x42be4b[_0x633c('0x15')]()+_0x633c('0x24')+_0x16a8d5,'style':_0x633c('0x25')};},'defaultStyle':{'font':_0x633c('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x633c('0x27')},'footer':{'alignment':_0x633c('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2975f2){var _0x21b3ef=0x1388;var _0xdd6bf2;if(!_0x2975f2[0x0][_0x633c('0x29')]){return analyticExtractedReport(_0x633c('0x2a'));}return db[_0x633c('0x2b')][_0x633c('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x633c('0x2d'),_0x633c('0x2e')]})[_0x633c('0x2f')](function(_0x21e994){if(_0x21e994){_0xdd6bf2=_0x21e994;_0x21b3ef=_0xdd6bf2[_0x633c('0x2e')]||0x3e8;}})[_0x633c('0x2f')](function(){var _0x3c09ea=[];var _0x14d0ef=0x0;if(_0xdd6bf2['split']){if(_0x2975f2&&_0x2975f2[_0x633c('0x30')]){var _0x1ff11e=_[_0x633c('0x31')](_0x2975f2[0x0]['num']/_0x21b3ef);var _0x9480a5=Number[_0x633c('0x32')](_0x2975f2[0x0][_0x633c('0x29')]/_0x21b3ef)?_0x2975f2[0x0][_0x633c('0x29')]%_0x21b3ef:0x0;_0x1ff11e[_0x633c('0x1b')](function(_0x2bce17){if(_0x2bce17>0x0){_0x14d0ef+=_0x21b3ef;}_0x3c09ea[_0x633c('0x18')](dbH['sequelize'][_0x633c('0x33')](util[_0x633c('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21b3ef,_0x14d0ef),{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]}));});if(_0x9480a5>0x0){_0x14d0ef+=_0x21b3ef;_0x3c09ea['push'](dbH[_0x633c('0x34')]['query'](util[_0x633c('0x1f')](_0x633c('0x37'),QUERY,_0x9480a5,_0x14d0ef),{'type':dbH[_0x633c('0x34')]['QueryTypes'][_0x633c('0x36')]}));}}}else{_0x3c09ea[_0x633c('0x18')](dbH[_0x633c('0x34')][_0x633c('0x33')](QUERY,{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]}));}var _0x15f94c=path['dirname'](PATH);var _0x2e2696=path[_0x633c('0x38')](PATH,'.pdf');var _0x57ce7f=_0xdd6bf2['split']&&_0x3c09ea[_0x633c('0x30')]>0x1;var _0x3295cd=[];if(!fs[_0x633c('0x39')](path['join'](_0x15f94c,_0x2e2696))&&_0x57ce7f){fs[_0x633c('0x3a')](path[_0x633c('0x3b')](_0x15f94c,_0x2e2696));}return BPromise[_0x633c('0x3c')](_0x3c09ea,function(_0x2cf3d3){_0x3295cd['push'](_0x2cf3d3);})[_0x633c('0x2f')](function(){var _0xb7b593=[];for(var _0x31e77b=0x0;_0x31e77b<_0x3295cd[_0x633c('0x30')];_0x31e77b+=0x1){var _0x4de7a1=_0x3295cd[_0x31e77b];var _0x5193bd=createTables(_[_0x633c('0x3d')](_0x4de7a1));var _0x59b809;var _0x16037f=getPDFDocDefinition(_0x5193bd);var _0xbda1ff=getPDFPrinter();var _0x237b50=_0xbda1ff[_0x633c('0x3e')](_0x16037f);if(_0x57ce7f){_0x59b809=path[_0x633c('0x3b')](_0x15f94c,_0x2e2696,util[_0x633c('0x1f')](_0x633c('0x3f'),_0x2e2696,_0x31e77b,'pdf'));}else{_0x59b809=path[_0x633c('0x3b')](_0x15f94c,util[_0x633c('0x1f')](_0x633c('0x40'),_0x2e2696,_0x633c('0x41')));}_0xb7b593['push'](writePDFDocument(_0x237b50,_0x59b809));}return Promise[_0x633c('0x42')](_0xb7b593);})['then'](function(){if(_0x57ce7f){return new Promise(function(_0x390af8){zipdir(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),{'saveTo':path[_0x633c('0x3b')](_0x15f94c,util[_0x633c('0x1f')](_0x633c('0x40'),_0x2e2696,_0x633c('0x43')))},function(){rimraf(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),function(){});_0x390af8('zip\x20finished');});});}})[_0x633c('0x2f')](function(){if(!_0x57ce7f)return;rimraf(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),function(){});})[_0x633c('0x2f')](function(){logger['info'](util[_0x633c('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x633c('0x44'),_0x57ce7f?util['format'](_0x633c('0x40'),_0x2e2696,_0x57ce7f?'zip':_0x633c('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x633c('0x45')](util[_0x633c('0x1f')](_0x633c('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x633c('0x47')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x633c('0x2f')](function(_0x3367aa){EXTRACTED_REPORT=_0x3367aa;return dbH[_0x633c('0x34')]['query'](util[_0x633c('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]});})['then'](extractReport)['catch'](function(_0x11bdd5){logger[_0x633c('0x45')](util[_0x633c('0x1f')](_0x633c('0x48'),EXTRACTED_REPORT_ID,_0x633c('0x49')),util['inspect'](_0x11bdd5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x633c('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4b0614=new PdfPrinter({'Arial':{'normal':__dirname+_0x633c('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x633c('0x4c'),'bolditalics':__dirname+_0x633c('0x4d')}});return _0x4b0614;}function getPDFDocDefinitionFromHTML(_0x15b62f,_0x6e41b){var _0x13bd16=util['format'](_0x633c('0x4e'),_0x6e41b['channel'],_0x6e41b[_0x633c('0x4f')]);var _0x57b544=moment()['format']('YYYY-MM-DD')[_0x633c('0x15')]();var _0x200633=htmlToPdfmake(_0x15b62f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x200633],'defaultStyle':{'font':_0x633c('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x633c('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x633c('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x633c('0x50')}},'header':function(){return[{'text':_0x633c('0x51'),'style':'header'}];},'footer':function(_0x2d82e4,_0x541022){return[{'text':util['format'](_0x633c('0x52'),_0x13bd16,_0x2d82e4,_0x541022,_0x57b544),'style':_0x633c('0x25')}];}};}function writePDFDocument(_0x58258a,_0x4106f4){return new Promise(function(_0x42132c,_0x2106ad){var _0x4788ca=_0x58258a[_0x633c('0x53')](fs['createWriteStream'](_0x4106f4));_0x4788ca['on'](_0x633c('0x54'),function(){_0x42132c(_0x633c('0x54'));});_0x4788ca['on'](_0x633c('0x55'),function(_0x466070){_0x2106ad(_0x466070);});_0x58258a[_0x633c('0x56')]();});}exports[_0x633c('0x57')]=function(_0x5d01e9,_0x5b2700){var _0x46df64=getPDFPrinter();var _0x4a6ff4=getPDFDocDefinitionFromHTML(_0x5d01e9,_0x5b2700);var _0x436303=_0x46df64['createPdfKitDocument'](_0x4a6ff4);return writePDFDocument(_0x436303,_0x5b2700[_0x633c('0x2')])[_0x633c('0x58')](function(_0x10e686){throw _0x10e686;});}; \ No newline at end of file +var _0x4820=['interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','fill','body','push','concat','keys','forEach','format','startDate','endDate','length','before','margin','landscape','footer','Arial','black','right','num','split','splitSizePdf','then','range','isInteger','query','SELECT','sequelize','dirname','basename','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','catch','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d'];(function(_0x26ce71,_0x18e803){var _0x20b38f=function(_0x40b5f4){while(--_0x40b5f4){_0x26ce71['push'](_0x26ce71['shift']());}};_0x20b38f(++_0x18e803);}(_0x4820,0x114));var _0x0482=function(_0x562c97,_0x38a1dd){_0x562c97=_0x562c97-0x0;var _0x218726=_0x4820[_0x562c97];return _0x218726;};'use strict';var _=require(_0x0482('0x0'));var fs=require('fs');var util=require(_0x0482('0x1'));var path=require(_0x0482('0x2'));var moment=require(_0x0482('0x3'));var htmlToPdfmake=require(_0x0482('0x4'));var PdfPrinter=require(_0x0482('0x5'));var zipdir=require(_0x0482('0x6'));var rimraf=require(_0x0482('0x7'));var JSDOM=require(_0x0482('0x8'))[_0x0482('0x9')];var window=new JSDOM('')[_0x0482('0xa')];var BPromise=require(_0x0482('0xb'));var db=require(_0x0482('0xc'))['db'];var dbH=require(_0x0482('0xc'))['dbH'];var logger=require(_0x0482('0xd'))(_0x0482('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x0482('0xf')][0x2]);var QUERY=process[_0x0482('0xf')][0x3];var PATH=process[_0x0482('0xf')][0x4];var NAME=process[_0x0482('0xf')][0x5];var FORMAT=_0x0482('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x42ae8c,_0x4c1495){var _0x165b93={'status':_0x42ae8c};var _0xd0e473={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c1495){_0x165b93[_0x0482('0x11')]=_0x4c1495;}return db[_0x0482('0x12')][_0x0482('0x13')](_0x165b93,_0xd0e473);}function getHeaders(_0x116802){return _['map'](_0x116802,function(_0x2cb431){return{'text':_0x2cb431,'style':_0x0482('0x14')};});}function getRows(_0x4da5ef,_0x358daa){return _[_0x0482('0x15')](_0x358daa,function(_0x1777fa){return _(_0x1777fa)[_0x0482('0x16')](_0x4da5ef)[_0x0482('0x15')](function(_0x1e1002){return _0x1e1002?_[_0x0482('0x17')](_0x1e1002):'';})['value']();});}function createTable(_0x1772f9,_0x309842){var _0x1b8845={'widths':_[_0x0482('0x18')](Array(_0x1772f9['length']),0x91),'heights':function(_0x1ad8c5){return _0x1ad8c5===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x26a36b=getHeaders(_0x1772f9);_0x1b8845[_0x0482('0x19')][_0x0482('0x1a')](_0x26a36b);var _0x30f323=getRows(_0x1772f9,_0x309842);_0x1b8845[_0x0482('0x19')]=_0x1b8845['body'][_0x0482('0x1b')](_0x30f323);return _0x1b8845;}function createTables(_0x1eaf5b){var _0x4054db=[];var _0x4f4bec=_['chunk'](Object[_0x0482('0x1c')](_0x1eaf5b[0x0]),0x5);_0x4f4bec[_0x0482('0x1d')](function(_0x10ea66){_0x4054db[_0x0482('0x1a')](createTable(_0x10ea66,_0x1eaf5b));});return _0x4054db;}function getPDFDocDefinition(_0x58681b){var _0x2d4a53=util[_0x0482('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x0482('0x1f')])[_0x0482('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x0482('0x20')])[_0x0482('0x1e')](FORMAT));var _0x139814=[];for(var _0xb47953=0x0;_0xb47953<_0x58681b[_0x0482('0x21')];_0xb47953++){var _0x599457=[];if(_0xb47953===0x0){_0x599457['push']({'text':_0x2d4a53,'style':'header'});}var _0x3cbeb2={'table':_0x58681b[_0xb47953]};if(_0xb47953>0x0){_0x3cbeb2['pageBreak']=_0x0482('0x22');_0x3cbeb2[_0x0482('0x23')]=[0x0,0x46,0x0,0x0];}_0x599457[_0x0482('0x1a')](_0x3cbeb2);_0x139814[_0x0482('0x1a')](_0x599457);}return{'pageSize':'A4','pageOrientation':_0x0482('0x24'),'content':_0x139814,'footer':function(_0x4fd5bc,_0x160499){return{'text':_0x4fd5bc[_0x0482('0x17')]()+'\x20/\x20'+_0x160499,'style':_0x0482('0x25')};},'defaultStyle':{'font':_0x0482('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0482('0x27')},'footer':{'alignment':_0x0482('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x981285){var _0x590dfb=0x1388;var _0xc04b90;if(!_0x981285[0x0][_0x0482('0x29')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0482('0x2a'),_0x0482('0x2b')]})[_0x0482('0x2c')](function(_0x2a1200){if(_0x2a1200){_0xc04b90=_0x2a1200;_0x590dfb=_0xc04b90[_0x0482('0x2b')]||0x3e8;}})[_0x0482('0x2c')](function(){var _0x48e9be=[];var _0xf91e16=0x0;if(_0xc04b90[_0x0482('0x2a')]){if(_0x981285&&_0x981285[_0x0482('0x21')]){var _0x3cdebf=_[_0x0482('0x2d')](_0x981285[0x0][_0x0482('0x29')]/_0x590dfb);var _0x4f1291=Number[_0x0482('0x2e')](_0x981285[0x0][_0x0482('0x29')]/_0x590dfb)?_0x981285[0x0]['num']%_0x590dfb:0x0;_0x3cdebf[_0x0482('0x1d')](function(_0x1b558c){if(_0x1b558c>0x0){_0xf91e16+=_0x590dfb;}_0x48e9be['push'](dbH['sequelize'][_0x0482('0x2f')](util[_0x0482('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x590dfb,_0xf91e16),{'type':dbH['sequelize']['QueryTypes'][_0x0482('0x30')]}));});if(_0x4f1291>0x0){_0xf91e16+=_0x590dfb;_0x48e9be['push'](dbH[_0x0482('0x31')]['query'](util[_0x0482('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f1291,_0xf91e16),{'type':dbH[_0x0482('0x31')]['QueryTypes']['SELECT']}));}}}else{_0x48e9be[_0x0482('0x1a')](dbH[_0x0482('0x31')][_0x0482('0x2f')](QUERY,{'type':dbH[_0x0482('0x31')]['QueryTypes'][_0x0482('0x30')]}));}var _0x5aac4c=path[_0x0482('0x32')](PATH);var _0x28d998=path[_0x0482('0x33')](PATH,'.pdf');var _0x455fa8=_0xc04b90[_0x0482('0x2a')]&&_0x48e9be[_0x0482('0x21')]>0x1;var _0x1fe100=[];if(!fs[_0x0482('0x34')](path['join'](_0x5aac4c,_0x28d998))&&_0x455fa8){fs['mkdirSync'](path[_0x0482('0x35')](_0x5aac4c,_0x28d998));}return BPromise['each'](_0x48e9be,function(_0x23c2d6){_0x1fe100['push'](_0x23c2d6);})[_0x0482('0x2c')](function(){var _0x510a8e=[];for(var _0x42d258=0x0;_0x42d258<_0x1fe100[_0x0482('0x21')];_0x42d258+=0x1){var _0x46abcc=_0x1fe100[_0x42d258];var _0x570832=createTables(_[_0x0482('0x36')](_0x46abcc));var _0x371d03;var _0x49675b=getPDFDocDefinition(_0x570832);var _0x4b4c4d=getPDFPrinter();var _0x9b5b7c=_0x4b4c4d[_0x0482('0x37')](_0x49675b);if(_0x455fa8){_0x371d03=path[_0x0482('0x35')](_0x5aac4c,_0x28d998,util[_0x0482('0x1e')](_0x0482('0x38'),_0x28d998,_0x42d258,_0x0482('0x39')));}else{_0x371d03=path[_0x0482('0x35')](_0x5aac4c,util[_0x0482('0x1e')](_0x0482('0x3a'),_0x28d998,_0x0482('0x39')));}_0x510a8e[_0x0482('0x1a')](writePDFDocument(_0x9b5b7c,_0x371d03));}return Promise[_0x0482('0x3b')](_0x510a8e);})[_0x0482('0x2c')](function(){if(_0x455fa8){return new Promise(function(_0x509e38){zipdir(path['join'](_0x5aac4c,_0x28d998),{'saveTo':path[_0x0482('0x35')](_0x5aac4c,util[_0x0482('0x1e')](_0x0482('0x3a'),_0x28d998,_0x0482('0x3c')))},function(){rimraf(path[_0x0482('0x35')](_0x5aac4c,_0x28d998),function(){});_0x509e38(_0x0482('0x3d'));});});}})[_0x0482('0x2c')](function(){if(!_0x455fa8)return;rimraf(path[_0x0482('0x35')](_0x5aac4c,_0x28d998),function(){});})[_0x0482('0x2c')](function(){logger['info'](util['format'](_0x0482('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x0482('0x3f'),_0x455fa8?util[_0x0482('0x1e')]('%s.%s',_0x28d998,_0x455fa8?_0x0482('0x3c'):_0x0482('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0482('0x40')](util['format'](_0x0482('0x41'),EXTRACTED_REPORT_ID,_0x0482('0x42')));return db[_0x0482('0x12')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0482('0x2c')](function(_0x2521f3){EXTRACTED_REPORT=_0x2521f3;return dbH[_0x0482('0x31')][_0x0482('0x2f')](util[_0x0482('0x1e')](_0x0482('0x43'),QUERY),{'type':dbH[_0x0482('0x31')][_0x0482('0x44')]['SELECT']});})[_0x0482('0x2c')](extractReport)[_0x0482('0x45')](function(_0x2e1da1){logger[_0x0482('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0482('0x42')),util['inspect'](_0x2e1da1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0482('0x46')](function(){process[_0x0482('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x426a15=new PdfPrinter({'Arial':{'normal':__dirname+_0x0482('0x48'),'bold':__dirname+_0x0482('0x49'),'italics':__dirname+_0x0482('0x4a'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x426a15;}function getPDFDocDefinitionFromHTML(_0x283e31,_0x2a3edb){var _0x4981e0=util[_0x0482('0x1e')](_0x0482('0x4b'),_0x2a3edb['channel'],_0x2a3edb[_0x0482('0x4c')]);var _0x504e6f=moment()[_0x0482('0x1e')](_0x0482('0x4d'))[_0x0482('0x17')]();var _0x218985=htmlToPdfmake(_0x283e31,{'window':window,'tableAutoSize':!![]});return{'content':[_0x218985],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0482('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0482('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0482('0x4e')}},'header':function(){return[{'text':_0x0482('0x4f'),'style':_0x0482('0x50')}];},'footer':function(_0x562014,_0x1e1073){return[{'text':util[_0x0482('0x1e')](_0x0482('0x51'),_0x4981e0,_0x562014,_0x1e1073,_0x504e6f),'style':_0x0482('0x25')}];}};}function writePDFDocument(_0x1044d9,_0x433454){return new Promise(function(_0x4eab78,_0x51f7ed){var _0xdcaf=_0x1044d9[_0x0482('0x52')](fs[_0x0482('0x53')](_0x433454));_0xdcaf['on'](_0x0482('0x54'),function(){_0x4eab78('finish');});_0xdcaf['on'](_0x0482('0x55'),function(_0x4ec50f){_0x51f7ed(_0x4ec50f);});_0x1044d9[_0x0482('0x56')]();});}exports[_0x0482('0x57')]=function(_0x1b6fc6,_0x35b9e1){var _0x3b3b00=getPDFPrinter();var _0x22bc06=getPDFDocDefinitionFromHTML(_0x1b6fc6,_0x35b9e1);var _0x1d7a60=_0x3b3b00['createPdfKitDocument'](_0x22bc06);return writePDFDocument(_0x1d7a60,_0x35b9e1[_0x0482('0x2')])[_0x0482('0x45')](function(_0x44e5bc){throw _0x44e5bc;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4a780fb..8f245cf 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 _0x13ea=['num','Empty','split','range','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','length','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','format','QueryTypes'];(function(_0x16e491,_0x56fef6){var _0x38be44=function(_0x89d03e){while(--_0x89d03e){_0x16e491['push'](_0x16e491['shift']());}};_0x38be44(++_0x56fef6);}(_0x13ea,0xa9));var _0xa13e=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0x13ea[_0x1cec84];return _0x12b7d3;};'use strict';var util=require('util');var path=require('path');var _=require(_0xa13e('0x0'));var fs=require('fs');var json2xls=require(_0xa13e('0x1'));var BPromise=require(_0xa13e('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xa13e('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa13e('0x4'))['dbH'];var logger=require(_0xa13e('0x5'))(_0xa13e('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x53dceb,_0x72089){var _0x200db4={'status':_0x53dceb};var _0x2f2b68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x72089){_0x200db4['savename']=_0x72089;}return db[_0xa13e('0x7')][_0xa13e('0x8')](_0x200db4,_0x2f2b68);}function main(){var _0x2f870a=0x1388;var _0x2aa20a;logger[_0xa13e('0x9')](util['format'](_0xa13e('0xa'),EXTRACTED_REPORT_ID,_0xa13e('0xb')));return db[_0xa13e('0xc')][_0xa13e('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa13e('0xe')]})[_0xa13e('0xf')](function(_0x17a949){if(_0x17a949){_0x2aa20a=_0x17a949;_0x2f870a=_0x2aa20a[_0xa13e('0xe')]||0x1388;}})[_0xa13e('0xf')](function(){return dbH['sequelize'][_0xa13e('0x10')](util[_0xa13e('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xa13e('0x12')]['SELECT']});})[_0xa13e('0xf')](function(_0x513019){if(!_0x513019[0x0][_0xa13e('0x13')]){return analyticExtractedReport(_0xa13e('0x14'));}var _0x1c5b14=[];var _0x35b021=0x0;if(_0x2aa20a[_0xa13e('0x15')]){if(_0x513019&&_0x513019['length']){var _0x74f9e0=_[_0xa13e('0x16')](_0x513019[0x0][_0xa13e('0x13')]/_0x2f870a);var _0x4f8af2=Number[_0xa13e('0x17')](_0x513019[0x0][_0xa13e('0x13')]/_0x2f870a)?_0x513019[0x0]['num']%_0x2f870a:0x0;_0x74f9e0[_0xa13e('0x18')](function(_0xa9e2d7){if(_0xa9e2d7>0x0){_0x35b021+=_0x2f870a;}_0x1c5b14[_0xa13e('0x19')](dbH[_0xa13e('0x1a')]['query'](util[_0xa13e('0x11')](_0xa13e('0x1b'),QUERY,_0x2f870a,_0x35b021),{'type':dbH[_0xa13e('0x1a')][_0xa13e('0x12')][_0xa13e('0x1c')]}));});if(_0x4f8af2>0x0){_0x35b021+=_0x2f870a;_0x1c5b14[_0xa13e('0x19')](dbH['sequelize'][_0xa13e('0x10')](util[_0xa13e('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f8af2,_0x35b021),{'type':dbH['sequelize'][_0xa13e('0x12')][_0xa13e('0x1c')]}));}}}else{_0x1c5b14[_0xa13e('0x19')](dbH[_0xa13e('0x1a')][_0xa13e('0x10')](QUERY,{'type':dbH[_0xa13e('0x1a')]['QueryTypes'][_0xa13e('0x1c')]}));}var _0x364e70=path['dirname'](PATH);var _0x1dd290=path[_0xa13e('0x1d')](PATH,_0xa13e('0x1e'));var _0x27810c=_0x2aa20a[_0xa13e('0x15')]&&_0x1c5b14[_0xa13e('0x1f')]>0x1;var _0x348b7e=[];if(!fs['existsSync'](path[_0xa13e('0x20')](_0x364e70,_0x1dd290))&&_0x27810c){fs[_0xa13e('0x21')](path[_0xa13e('0x20')](_0x364e70,_0x1dd290));}return BPromise[_0xa13e('0x22')](_0x1c5b14,function(_0x4e8405){_0x348b7e[_0xa13e('0x19')](_0x4e8405);})[_0xa13e('0xf')](function(){for(var _0x1194eb=0x0;_0x1194eb<_0x348b7e[_0xa13e('0x1f')];_0x1194eb+=0x1){var _0x4bfc3f;var _0x4e89f5=_0x348b7e[_0x1194eb];if(_0x27810c){_0x4bfc3f=path[_0xa13e('0x20')](_0x364e70,_0x1dd290,util[_0xa13e('0x11')](_0xa13e('0x23'),_0x1dd290,_0x1194eb,'xlsx'));}else{_0x4bfc3f=path[_0xa13e('0x20')](_0x364e70,util[_0xa13e('0x11')]('%s.%s',_0x1dd290,_0xa13e('0x24')));}fs[_0xa13e('0x25')](_0x4bfc3f,json2xls(_0x4e89f5),_0xa13e('0x26'));}})[_0xa13e('0xf')](function(){if(_0x27810c){return new Promise(function(_0x2dcb20){zipdir(path[_0xa13e('0x20')](_0x364e70,_0x1dd290),{'saveTo':path['join'](_0x364e70,util[_0xa13e('0x11')](_0xa13e('0x27'),_0x1dd290,_0xa13e('0x28')))},function(_0x48cb94,_0x4fa170){rimraf(path[_0xa13e('0x20')](_0x364e70,_0x1dd290),function(){});_0x2dcb20('zip\x20finished');});});}})['then'](function(){logger[_0xa13e('0x9')](util[_0xa13e('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa13e('0x29'),_0x27810c?util[_0xa13e('0x11')](_0xa13e('0x27'),_0x1dd290,_0x27810c?_0xa13e('0x28'):'xlsx'):null);});})['catch'](function(_0x1bd2a9){logger['info'](util['format'](_0xa13e('0x2a'),EXTRACTED_REPORT_ID,_0xa13e('0xb')),util[_0xa13e('0x2b')](_0x1bd2a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa13e('0x2c'));})[_0xa13e('0x2d')](function(){process[_0xa13e('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1b8e=['range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes','num','Empty','length'];(function(_0xedf3d2,_0x13fcde){var _0x40efbe=function(_0x5418c7){while(--_0x5418c7){_0xedf3d2['push'](_0xedf3d2['shift']());}};_0x40efbe(++_0x13fcde);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x1ed1c2,_0x1f11c2){_0x1ed1c2=_0x1ed1c2-0x0;var _0x59fbe7=_0x1b8e[_0x1ed1c2];return _0x59fbe7;};'use strict';var util=require(_0xe1b8('0x0'));var path=require(_0xe1b8('0x1'));var _=require(_0xe1b8('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe1b8('0x3'));var zipdir=require(_0xe1b8('0x4'));var rimraf=require('rimraf');var db=require(_0xe1b8('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xe1b8('0x6'))(_0xe1b8('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xe1b8('0x8')][0x2]);var QUERY=process[_0xe1b8('0x8')][0x3];var PATH=process[_0xe1b8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44e4f1,_0x3ad550){var _0x395abd={'status':_0x44e4f1};var _0x619866={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3ad550){_0x395abd[_0xe1b8('0x9')]=_0x3ad550;}return db[_0xe1b8('0xa')][_0xe1b8('0xb')](_0x395abd,_0x619866);}function main(){var _0x3efb28=0x1388;var _0x3519cf;logger[_0xe1b8('0xc')](util[_0xe1b8('0xd')](_0xe1b8('0xe'),EXTRACTED_REPORT_ID,_0xe1b8('0xf')));return db[_0xe1b8('0x10')][_0xe1b8('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe1b8('0x12'),_0xe1b8('0x13')]})[_0xe1b8('0x14')](function(_0x51e442){if(_0x51e442){_0x3519cf=_0x51e442;_0x3efb28=_0x3519cf[_0xe1b8('0x13')]||0x1388;}})['then'](function(){return dbH[_0xe1b8('0x15')]['query'](util[_0xe1b8('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe1b8('0x15')][_0xe1b8('0x16')]['SELECT']});})['then'](function(_0x596dde){if(!_0x596dde[0x0][_0xe1b8('0x17')]){return analyticExtractedReport(_0xe1b8('0x18'));}var _0x8e0b45=[];var _0x548bc7=0x0;if(_0x3519cf['split']){if(_0x596dde&&_0x596dde[_0xe1b8('0x19')]){var _0x55e1c1=_[_0xe1b8('0x1a')](_0x596dde[0x0][_0xe1b8('0x17')]/_0x3efb28);var _0x2434d8=Number[_0xe1b8('0x1b')](_0x596dde[0x0][_0xe1b8('0x17')]/_0x3efb28)?_0x596dde[0x0][_0xe1b8('0x17')]%_0x3efb28:0x0;_0x55e1c1[_0xe1b8('0x1c')](function(_0x160812){if(_0x160812>0x0){_0x548bc7+=_0x3efb28;}_0x8e0b45[_0xe1b8('0x1d')](dbH[_0xe1b8('0x15')][_0xe1b8('0x1e')](util['format'](_0xe1b8('0x1f'),QUERY,_0x3efb28,_0x548bc7),{'type':dbH['sequelize'][_0xe1b8('0x16')][_0xe1b8('0x20')]}));});if(_0x2434d8>0x0){_0x548bc7+=_0x3efb28;_0x8e0b45[_0xe1b8('0x1d')](dbH[_0xe1b8('0x15')][_0xe1b8('0x1e')](util[_0xe1b8('0xd')](_0xe1b8('0x1f'),QUERY,_0x2434d8,_0x548bc7),{'type':dbH['sequelize'][_0xe1b8('0x16')][_0xe1b8('0x20')]}));}}}else{_0x8e0b45[_0xe1b8('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xe1b8('0x15')][_0xe1b8('0x16')][_0xe1b8('0x20')]}));}var _0x13cb23=path[_0xe1b8('0x21')](PATH);var _0x16a2d3=path[_0xe1b8('0x22')](PATH,_0xe1b8('0x23'));var _0x36398d=_0x3519cf[_0xe1b8('0x12')]&&_0x8e0b45['length']>0x1;var _0x235669=[];if(!fs[_0xe1b8('0x24')](path[_0xe1b8('0x25')](_0x13cb23,_0x16a2d3))&&_0x36398d){fs[_0xe1b8('0x26')](path['join'](_0x13cb23,_0x16a2d3));}return BPromise['each'](_0x8e0b45,function(_0x58c93e){_0x235669[_0xe1b8('0x1d')](_0x58c93e);})['then'](function(){for(var _0x226aa2=0x0;_0x226aa2<_0x235669[_0xe1b8('0x19')];_0x226aa2+=0x1){var _0x4d7db8;var _0x59bc1b=_0x235669[_0x226aa2];if(_0x36398d){_0x4d7db8=path['join'](_0x13cb23,_0x16a2d3,util['format'](_0xe1b8('0x27'),_0x16a2d3,_0x226aa2,_0xe1b8('0x28')));}else{_0x4d7db8=path[_0xe1b8('0x25')](_0x13cb23,util[_0xe1b8('0xd')]('%s.%s',_0x16a2d3,_0xe1b8('0x28')));}fs[_0xe1b8('0x29')](_0x4d7db8,json2xls(_0x59bc1b),_0xe1b8('0x2a'));}})[_0xe1b8('0x14')](function(){if(_0x36398d){return new Promise(function(_0x31c8ba){zipdir(path['join'](_0x13cb23,_0x16a2d3),{'saveTo':path[_0xe1b8('0x25')](_0x13cb23,util['format'](_0xe1b8('0x2b'),_0x16a2d3,_0xe1b8('0x2c')))},function(_0x3977a7,_0x573d9d){rimraf(path[_0xe1b8('0x25')](_0x13cb23,_0x16a2d3),function(){});_0x31c8ba('zip\x20finished');});});}})[_0xe1b8('0x14')](function(){logger[_0xe1b8('0xc')](util[_0xe1b8('0xd')](_0xe1b8('0x2d'),EXTRACTED_REPORT_ID,_0xe1b8('0xf')));return analyticExtractedReport('Completed',_0x36398d?util[_0xe1b8('0xd')](_0xe1b8('0x2b'),_0x16a2d3,_0x36398d?_0xe1b8('0x2c'):_0xe1b8('0x28')):null);});})['catch'](function(_0x1b0bbc){logger[_0xe1b8('0xc')](util[_0xe1b8('0xd')](_0xe1b8('0x2e'),EXTRACTED_REPORT_ID,_0xe1b8('0xf')),util['inspect'](_0x1b0bbc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe1b8('0x2f'));})['finally'](function(){process[_0xe1b8('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 29c6834..8f8e68a 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 _0x48a9=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','extensions','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','priority','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','extension','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq'];(function(_0x5ce038,_0x54cfc8){var _0x44f591=function(_0x480d75){while(--_0x480d75){_0x5ce038['push'](_0x5ce038['shift']());}};_0x44f591(++_0x54cfc8);}(_0x48a9,0x14b));var _0x948a=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x48a9[_0x414f67];return _0x338537;};'use strict';var _=require(_0x948a('0x0'));var util=require(_0x948a('0x1'));function rewrite(_0x481003,_0x275b25){var _0x5dab3a=this;return _0x481003[_0x948a('0x2')]['Interval'][_0x948a('0x3')]({'raw':!![]})['then'](function(_0x2393f9){_0x5dab3a[_0x948a('0x4')]=_0x2393f9;return _0x481003['models'][_0x948a('0x5')][_0x948a('0x3')]({'where':{'IntervalId':_0x275b25[_0x948a('0x6')]},'raw':!![]});})[_0x948a('0x7')](function(_0x461a53){return _0x481003[_0x948a('0x2')][_0x948a('0x5')][_0x948a('0x3')]({'where':{'exten':{'$in':_[_0x948a('0x8')](_['map'](_0x461a53,_0x948a('0x9')))}},'order':[{'raw':_0x948a('0xa')}],'raw':!![]});})[_0x948a('0x7')](function(_0x21595e){var _0x33be62=_[_0x948a('0xb')](_0x21595e,{'priority':'1'});var _0x4eb39d=_['filter'](_0x21595e,{'isApp':0x1});var _0x460e94=_['groupBy'](_0x4eb39d,'exten');var _0x27a0a6=['queue',_0x948a('0xc')];var _0x5c3a5f=[];var _0x578d21=[];for(var _0x4c310a in _0x460e94){if(_0x460e94['hasOwnProperty'](_0x4c310a)){_0x5dab3a['priority']=0x2;_0x5dab3a[_0x948a('0xd')]=[];_0x5dab3a['extension']=_[_0x948a('0xe')](_0x33be62,{'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')]});_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':util[_0x948a('0x12')](_0x948a('0x13'),_0x460e94[_0x4c310a][0x0][_0x948a('0x10')]),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a['priority']++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x460e94[_0x4c310a][0x0][_0x948a('0x10')]==='inbound'){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x948a('0x16')+_0x460e94[_0x4c310a][0x0][_0x948a('0x15')],'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}else if(_0x460e94[_0x4c310a][0x0]['type']===_0x948a('0x18')){if(_0x5dab3a['extension']){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x19')+(_0x5dab3a['extension']['cutdigits']?_0x948a('0x1a')+_0x5dab3a['extension'][_0x948a('0x1b')]+'}':_0x948a('0x1c')),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x5dab3a['extensions']['push']({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':'CDR(routeid)='+_0x460e94[_0x4c310a][0x0][_0x948a('0x15')],'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a['priority']++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});var _0x69461d=_0x5dab3a['priority']++;_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x1d'),'appdata':_0x948a('0x1e')+(_0x69461d+0x2)+_0x948a('0x1f')+(_0x69461d+0x1)+')','context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x69461d,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x5dab3a[_0x948a('0x20')]){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x5dab3a[_0x948a('0x20')][_0x948a('0x1b')]?_0x948a('0x21')+_0x5dab3a[_0x948a('0x20')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':'outboundrouteid='+_0x460e94[_0x4c310a][0x0]['VoiceExtensionId'],'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x5dab3a[_0x948a('0x20')]&&_0x5dab3a[_0x948a('0x20')][_0x948a('0x22')]('recordingFormat')&&_0x5dab3a[_0x948a('0x20')][_0x948a('0x23')]!==_0x948a('0x24')){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x25'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x948a('0x26')+_0x5dab3a['extension']['recordingFormat']||_0x948a('0x27'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0]['VoiceExtensionId']});}}_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x28'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0]['exten'],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x29'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a[_0x948a('0xd')]['push']({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x2a'),'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0]['exten'],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});for(var _0x27c05f=0x0,_0x14ac93=0x0;_0x27c05f<_0x460e94[_0x4c310a][_0x948a('0x2b')];_0x27c05f+=0x1,_0x14ac93=0x0){var _0x3006a1=_0x460e94[_0x4c310a][_0x27c05f];if(_0x3006a1[_0x948a('0x10')]){_0x3006a1[_0x948a('0x10')]=_0x3006a1[_0x948a('0x10')][_0x948a('0x2c')]();}var _0x48a274=[];var _0x4b3e60=[];delete _0x3006a1['id'];delete _0x3006a1[_0x948a('0x2d')];delete _0x3006a1['updatedAt'];var _0x4b8030=_0x3006a1[_0x948a('0x2e')]!==_0x948a('0x2f')?[_0x3006a1['interval']]:_0x3006a1[_0x948a('0x6')]?_[_0x948a('0x30')](_[_0x948a('0xb')](_0x5dab3a[_0x948a('0x4')],{'IntervalId':_0x3006a1[_0x948a('0x6')]}),_0x948a('0x2e')):[];if(_0x3006a1['hasOwnProperty']('tag')){if(_0x3006a1[_0x948a('0x31')]&&_0x3006a1['tag']!=='--'){_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':'CDR(tag)='+_0x3006a1['tag'],'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030['length']+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}if(_0x3006a1[_0x948a('0x10')]==='outbound'&&_0x3006a1[_0x948a('0x22')](_0x948a('0x32'))){if(_0x3006a1[_0x948a('0x32')]){_0x48a274['push']({'type':_0x3006a1['type'],'app':_0x948a('0x1d'),'appdata':_0x948a('0x33')+_0x3006a1['callerID']+')','context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}else{_0x48a274[_0x948a('0xf')]({'type':_0x3006a1['type'],'app':_0x948a('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}if(_0x3006a1['hasOwnProperty'](_0x948a('0x34'))){if(_0x27a0a6[_0x948a('0x35')](_0x3006a1['app'][_0x948a('0x2c')]())>=0x0&&_0x3006a1['appType']!==_0x948a('0x36')){if(_0x3006a1[_0x948a('0x34')]){_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x1d'),'appdata':_0x948a('0x37'),'context':_0x3006a1['context'],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x38'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}else{_0x48a274['push']({'type':_0x3006a1[_0x948a('0x10')],'app':'ExecIf','appdata':_0x948a('0x39'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});_0x48a274[_0x948a('0xf')]({'type':_0x3006a1['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x3a'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}}for(var _0x582ca3=0x0;_0x582ca3<_0x4b8030[_0x948a('0x2b')];_0x582ca3+=0x1){var _0x4f01cd=_0x5dab3a['priority']+_0x4b8030[_0x948a('0x2b')];var _0x2493a7=_0x582ca3===_0x4b8030['length']-0x1?_0x5dab3a[_0x948a('0x17')]+_0x48a274[_0x948a('0x2b')]+_0x4b3e60['length']+0x2:_0x5dab3a[_0x948a('0x17')]+_0x582ca3+0x1;_0x48a274[_0x948a('0x3b')](_0x582ca3,0x0,{'type':_0x3006a1['type'],'app':_0x948a('0x3c'),'appdata':_0x4b8030[_0x582ca3]+'?'+_0x3006a1[_0x948a('0x14')]+_0x948a('0x3d')+_0x4f01cd+':'+_0x3006a1[_0x948a('0x14')]+_0x948a('0x3d')+_0x2493a7,'exten':_0x3006a1[_0x948a('0x9')],'context':_0x3006a1[_0x948a('0x14')],'priority':_0x5dab3a['priority']+_0x582ca3,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x3006a1[_0x948a('0x17')]=_0x48a274['length']?_[_0x948a('0x3e')](_0x48a274)[_0x948a('0x17')]+0x1:_0x5dab3a[_0x948a('0x17')];_0x5dab3a[_0x948a('0x17')]=(_0x4b3e60['length']?_[_0x948a('0x3e')](_0x4b3e60)['priority']:_0x3006a1['priority'])+0x1;_0x5dab3a[_0x948a('0xd')]=_[_0x948a('0x3f')](_0x5dab3a[_0x948a('0xd')],_0x48a274,[_0x3006a1],_0x4b3e60);}_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Hangup','exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'priority':_0x5dab3a[_0x948a('0x17')],'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5c3a5f[_0x948a('0xf')](_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]);_0x578d21=_['concat'](_0x578d21,_0x5dab3a[_0x948a('0xd')]);}}return _0x481003['transaction'](function(_0xbc6571){return _0x481003['models'][_0x948a('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5c3a5f}},'transaction':_0xbc6571})[_0x948a('0x7')](function(_0x58e73a){return _0x481003[_0x948a('0x2')][_0x948a('0x5')]['bulkCreate'](_[_0x948a('0x40')](_0x578d21,'priority'),{'transaction':_0xbc6571});});});})[_0x948a('0x41')](function(_0x482da5){console[_0x948a('0x42')](_0x482da5);});}exports[_0x948a('0x43')]=rewrite; \ No newline at end of file +var _0x8eed=['interval','tag','CDR(tag)=','outbound','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','find','type','Set','format','VoiceExtensionId','inbound','push','CDR(routeid)=','context','extension','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','IntervalId'];(function(_0x11045b,_0x552f4b){var _0x4f30ed=function(_0x10ab9b){while(--_0x10ab9b){_0x11045b['push'](_0x11045b['shift']());}};_0x4f30ed(++_0x552f4b);}(_0x8eed,0xeb));var _0xd8ee=function(_0xd752f8,_0x53c255){_0xd752f8=_0xd752f8-0x0;var _0x351296=_0x8eed[_0xd752f8];return _0x351296;};'use strict';var _=require(_0xd8ee('0x0'));var util=require(_0xd8ee('0x1'));function rewrite(_0x418728,_0x1f2f4a){var _0x38ad9e=this;return _0x418728[_0xd8ee('0x2')][_0xd8ee('0x3')][_0xd8ee('0x4')]({'raw':!![]})[_0xd8ee('0x5')](function(_0x40daaf){_0x38ad9e[_0xd8ee('0x6')]=_0x40daaf;return _0x418728[_0xd8ee('0x2')][_0xd8ee('0x7')][_0xd8ee('0x4')]({'where':{'IntervalId':_0x1f2f4a['IntervalId']},'raw':!![]});})['then'](function(_0x562832){return _0x418728[_0xd8ee('0x2')][_0xd8ee('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xd8ee('0x8')](_[_0xd8ee('0x9')](_0x562832,_0xd8ee('0xa')))}},'order':[{'raw':_0xd8ee('0xb')}],'raw':!![]});})['then'](function(_0x207226){var _0xdfb136=_[_0xd8ee('0xc')](_0x207226,{'priority':'1'});var _0x11d946=_[_0xd8ee('0xc')](_0x207226,{'isApp':0x1});var _0x57c212=_['groupBy'](_0x11d946,'exten');var _0x217a12=[_0xd8ee('0xd'),'playback'];var _0x53a833=[];var _0x1ef25b=[];for(var _0x211c47 in _0x57c212){if(_0x57c212[_0xd8ee('0xe')](_0x211c47)){_0x38ad9e[_0xd8ee('0xf')]=0x2;_0x38ad9e[_0xd8ee('0x10')]=[];_0x38ad9e['extension']=_[_0xd8ee('0x11')](_0xdfb136,{'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')]});_0x38ad9e[_0xd8ee('0x10')]['push']({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':util[_0xd8ee('0x14')]('CDR(type)=%s',_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')]),'context':_0x57c212[_0x211c47][0x0]['context'],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});if(_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')]===_0xd8ee('0x16')){_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x18')+_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')],'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});}else if(_0x57c212[_0x211c47][0x0]['type']==='outbound'){if(_0x38ad9e[_0xd8ee('0x1a')]){_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0]['type'],'app':_0xd8ee('0x13'),'appdata':'CDR(destination)='+(_0x38ad9e[_0xd8ee('0x1a')][_0xd8ee('0x1b')]?_0xd8ee('0x1c')+_0x38ad9e[_0xd8ee('0x1a')][_0xd8ee('0x1b')]+'}':_0xd8ee('0x1d')),'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});}_0x38ad9e[_0xd8ee('0x10')]['push']({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':'CDR(routeid)='+_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')],'context':_0x57c212[_0x211c47][0x0]['context'],'exten':_0x57c212[_0x211c47][0x0]['exten'],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});var _0x17fa70=_0x38ad9e[_0xd8ee('0xf')]++;_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x17fa70+0x2)+'):Goto('+(_0x17fa70+0x1)+')','context':_0x57c212[_0x211c47][0x0]['context'],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x17fa70,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});if(_0x38ad9e[_0xd8ee('0x1a')]){_0x38ad9e[_0xd8ee('0x10')]['push']({'type':_0x57c212[_0x211c47][0x0]['type'],'app':'Set','appdata':_0x38ad9e[_0xd8ee('0x1a')][_0xd8ee('0x1b')]?_0xd8ee('0x1f')+_0x38ad9e[_0xd8ee('0x1a')][_0xd8ee('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0]['VoiceExtensionId']});}_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x20')+_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')],'context':_0x57c212[_0x211c47][0x0]['context'],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e[_0xd8ee('0xf')]++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});if(_0x38ad9e[_0xd8ee('0x1a')]&&_0x38ad9e[_0xd8ee('0x1a')]['hasOwnProperty']('recordingFormat')&&_0x38ad9e['extension'][_0xd8ee('0x21')]!==_0xd8ee('0x22')){_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0]['type'],'app':'Set','appdata':_0xd8ee('0x23'),'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x24')+_0x38ad9e[_0xd8ee('0x1a')][_0xd8ee('0x21')]||_0xd8ee('0x25'),'context':_0x57c212[_0x211c47][0x0]['context'],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e[_0xd8ee('0xf')]++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});}}_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':'Set','appdata':_0xd8ee('0x26'),'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e['priority']++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0]['VoiceExtensionId']});_0x38ad9e['extensions'][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x27'),'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0]['exten'],'priority':_0x38ad9e[_0xd8ee('0xf')]++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});_0x38ad9e[_0xd8ee('0x10')]['push']({'type':_0x57c212[_0x211c47][0x0][_0xd8ee('0x12')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'priority':_0x38ad9e[_0xd8ee('0xf')]++,'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});for(var _0x6f4b2c=0x0,_0x163ea6=0x0;_0x6f4b2c<_0x57c212[_0x211c47][_0xd8ee('0x28')];_0x6f4b2c+=0x1,_0x163ea6=0x0){var _0x1c627c=_0x57c212[_0x211c47][_0x6f4b2c];if(_0x1c627c[_0xd8ee('0x12')]){_0x1c627c[_0xd8ee('0x12')]=_0x1c627c[_0xd8ee('0x12')][_0xd8ee('0x29')]();}var _0x4b7131=[];var _0x340528=[];delete _0x1c627c['id'];delete _0x1c627c[_0xd8ee('0x2a')];delete _0x1c627c[_0xd8ee('0x2b')];var _0x114068=_0x1c627c['interval']!=='*,*,*,*'?[_0x1c627c['interval']]:_0x1c627c[_0xd8ee('0x2c')]?_[_0xd8ee('0x9')](_['filter'](_0x38ad9e[_0xd8ee('0x6')],{'IntervalId':_0x1c627c['IntervalId']}),_0xd8ee('0x2d')):[];if(_0x1c627c[_0xd8ee('0xe')](_0xd8ee('0x2e'))){if(_0x1c627c[_0xd8ee('0x2e')]&&_0x1c627c[_0xd8ee('0x2e')]!=='--'){_0x4b7131['push']({'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x2f')+_0x1c627c[_0xd8ee('0x2e')],'context':_0x1c627c['context'],'exten':_0x1c627c[_0xd8ee('0xa')],'priority':_0x114068[_0xd8ee('0x28')]+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c['VoiceExtensionId']});}}if(_0x1c627c['type']===_0xd8ee('0x30')&&_0x1c627c['hasOwnProperty'](_0xd8ee('0x31'))){if(_0x1c627c['callerID']){_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c[_0xd8ee('0x12')],'app':'ExecIf','appdata':_0xd8ee('0x32')+_0x1c627c['callerID']+')','context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c[_0xd8ee('0xa')],'priority':_0x114068[_0xd8ee('0x28')]+_0x38ad9e['priority']+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});}else{_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x1e'),'appdata':_0xd8ee('0x33'),'context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c['exten'],'priority':_0x114068[_0xd8ee('0x28')]+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});}}if(_0x1c627c[_0xd8ee('0xe')](_0xd8ee('0x34'))){if(_0x217a12['indexOf'](_0x1c627c[_0xd8ee('0x35')][_0xd8ee('0x29')]())>=0x0&&_0x1c627c[_0xd8ee('0x36')]!==_0xd8ee('0x37')){if(_0x1c627c[_0xd8ee('0x34')]){_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x1e'),'appdata':_0xd8ee('0x38'),'context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c[_0xd8ee('0xa')],'priority':_0x114068['length']+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x39'),'context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c['exten'],'priority':_0x114068['length']+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});}else{_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c['type'],'app':'ExecIf','appdata':_0xd8ee('0x3a'),'context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c[_0xd8ee('0xa')],'priority':_0x114068[_0xd8ee('0x28')]+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});_0x4b7131[_0xd8ee('0x17')]({'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x13'),'appdata':_0xd8ee('0x3b'),'context':_0x1c627c[_0xd8ee('0x19')],'exten':_0x1c627c[_0xd8ee('0xa')],'priority':_0x114068[_0xd8ee('0x28')]+_0x38ad9e[_0xd8ee('0xf')]+_0x163ea6++,'VoiceExtensionId':_0x1c627c[_0xd8ee('0x15')]});}}}for(var _0x5a8eef=0x0;_0x5a8eef<_0x114068[_0xd8ee('0x28')];_0x5a8eef+=0x1){var _0x5bf102=_0x38ad9e['priority']+_0x114068[_0xd8ee('0x28')];var _0xd94a34=_0x5a8eef===_0x114068[_0xd8ee('0x28')]-0x1?_0x38ad9e[_0xd8ee('0xf')]+_0x4b7131['length']+_0x340528[_0xd8ee('0x28')]+0x2:_0x38ad9e[_0xd8ee('0xf')]+_0x5a8eef+0x1;_0x4b7131[_0xd8ee('0x3c')](_0x5a8eef,0x0,{'type':_0x1c627c[_0xd8ee('0x12')],'app':_0xd8ee('0x3d'),'appdata':_0x114068[_0x5a8eef]+'?'+_0x1c627c[_0xd8ee('0x19')]+_0xd8ee('0x3e')+_0x5bf102+':'+_0x1c627c[_0xd8ee('0x19')]+_0xd8ee('0x3e')+_0xd94a34,'exten':_0x1c627c[_0xd8ee('0xa')],'context':_0x1c627c['context'],'priority':_0x38ad9e['priority']+_0x5a8eef,'VoiceExtensionId':_0x57c212[_0x211c47][0x0]['VoiceExtensionId']});}_0x1c627c['priority']=_0x4b7131[_0xd8ee('0x28')]?_[_0xd8ee('0x3f')](_0x4b7131)[_0xd8ee('0xf')]+0x1:_0x38ad9e[_0xd8ee('0xf')];_0x38ad9e['priority']=(_0x340528[_0xd8ee('0x28')]?_[_0xd8ee('0x3f')](_0x340528)['priority']:_0x1c627c[_0xd8ee('0xf')])+0x1;_0x38ad9e[_0xd8ee('0x10')]=_[_0xd8ee('0x40')](_0x38ad9e[_0xd8ee('0x10')],_0x4b7131,[_0x1c627c],_0x340528);}_0x38ad9e[_0xd8ee('0x10')][_0xd8ee('0x17')]({'type':_0x57c212[_0x211c47][0x0]['type'],'app':_0xd8ee('0x41'),'exten':_0x57c212[_0x211c47][0x0][_0xd8ee('0xa')],'context':_0x57c212[_0x211c47][0x0][_0xd8ee('0x19')],'priority':_0x38ad9e['priority'],'VoiceExtensionId':_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]});_0x53a833[_0xd8ee('0x17')](_0x57c212[_0x211c47][0x0][_0xd8ee('0x15')]);_0x1ef25b=_[_0xd8ee('0x40')](_0x1ef25b,_0x38ad9e['extensions']);}}return _0x418728[_0xd8ee('0x42')](function(_0x231a48){return _0x418728[_0xd8ee('0x2')][_0xd8ee('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x53a833}},'transaction':_0x231a48})['then'](function(_0x165f54){return _0x418728['models']['VoiceExtension'][_0xd8ee('0x43')](_[_0xd8ee('0x44')](_0x1ef25b,'priority'),{'transaction':_0x231a48});});});})[_0xd8ee('0x45')](function(_0x512823){console['error'](_0x512823);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c758419..aff469b 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 _0xbded=['fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','createdAt','from','id\x20IN\x20?','str','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','outbound','CmList','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','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','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper'];(function(_0x5a0eff,_0x4e3613){var _0x40f4d6=function(_0x2eb934){while(--_0x2eb934){_0x5a0eff['push'](_0x5a0eff['shift']());}};_0x40f4d6(++_0x4e3613);}(_0xbded,0x194));var _0xdbde=function(_0x3bb0d4,_0xe492ec){_0x3bb0d4=_0x3bb0d4-0x0;var _0x269be3=_0xbded[_0x3bb0d4];return _0x269be3;};'use strict';var BPromise=require(_0xdbde('0x0'));var util=require(_0xdbde('0x1'));var _=require(_0xdbde('0x2'));var fs=require('fs');var squel=require(_0xdbde('0x3'));var Papa=require(_0xdbde('0x4'));var Redis=require(_0xdbde('0x5'));var db=require(_0xdbde('0x6'))['db'];var config=require(_0xdbde('0x7'));var logger=require('../../../config/logger')(_0xdbde('0x8'));config[_0xdbde('0x9')]=_[_0xdbde('0xa')](config['redis'],{'host':_0xdbde('0xb'),'port':0x18eb});var socket=require(_0xdbde('0xc'))(new Redis(config[_0xdbde('0x9')]));require(_0xdbde('0xd'))[_0xdbde('0xe')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xdbde('0xf')||process[_0xdbde('0x10')][0x2]==='null'){throw new Error(_0xdbde('0x11'));}var FILEPATH=process[_0xdbde('0x10')][0x2];if(!process['argv'][0x3]||process[_0xdbde('0x10')][0x3]==='undefined'||process[_0xdbde('0x10')][0x3]===_0xdbde('0x12')||!process['argv'][0x4]||process['argv'][0x4]===_0xdbde('0xf')||process[_0xdbde('0x10')][0x4]==='null'){throw new Error(_0xdbde('0x13'));}var FIELDS=_[_0xdbde('0x14')](process['argv'][0x3][_0xdbde('0x15')](','),process['argv'][0x4][_0xdbde('0x15')](','));if(!process[_0xdbde('0x10')][0x5]||process[_0xdbde('0x10')][0x5]==='undefined'||process[_0xdbde('0x10')][0x5]==='null'){throw new Error(_0xdbde('0x16'));}var LISTID=process[_0xdbde('0x10')][0x5];var COMPANYID=process[_0xdbde('0x10')][0x6]&&process['argv'][0x6]!==_0xdbde('0xf')&&process['argv'][0x6]!==_0xdbde('0x12')?process[_0xdbde('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xdbde('0x10')][0x7]!==_0xdbde('0xf')&&process['argv'][0x7]!==_0xdbde('0x12')?process[_0xdbde('0x10')][0x7]:null;if(!process['argv'][0x8]||process[_0xdbde('0x10')][0x8]===_0xdbde('0xf')||process['argv'][0x8]===_0xdbde('0x12')){throw new Error(_0xdbde('0x17'));}var SOCKET_TIMESTAMP=process[_0xdbde('0x10')][0x8];}catch(_0x9d6d36){logger['error'](_0x9d6d36);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(_0x27f579,_0x254ab9,_0x42d8d4,_0x5d27e8){var _0x4833d2={'message':_0x254ab9};_0x4833d2[_0x27f579]=!![];if(_0x42d8d4){_0x4833d2[_0xdbde('0x18')]=_0x42d8d4;}if(_0x5d27e8){_0x4833d2[_0xdbde('0x19')]=_0x5d27e8;}return _0x4833d2;}function isEmail(_0x120bb3){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))*$/[_0xdbde('0x1a')](_0x120bb3);}function checkRow(_0xe1e2ae,_0x14af87,_0x500c71){return new BPromise(function(_0x2aa293,_0x3b4f76){if(_[_0xdbde('0x1b')](_0xe1e2ae)){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0xdbde('0x1d'),null,_0x500c71));}if(_0xe1e2ae[_0xdbde('0x1e')]&&_0xe1e2ae[_0xdbde('0x1e')][_0xdbde('0x1f')]){var _0x1518fa=_['map'](_0xe1e2ae[_0xdbde('0x1e')],_0xdbde('0x20'))['join'](';');return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0x1518fa,null,_0x500c71));}var _0x34d0c8={};for(var _0x5ec888 in FIELDS){if(FIELDS[_0xdbde('0x21')](_0x5ec888)&&FIELDS[_0x5ec888]){_0x34d0c8[_0x5ec888]=_0xe1e2ae[_0xdbde('0x22')][0x0][FIELDS[_0x5ec888]]||_0xe1e2ae[_0xdbde('0x22')][0x0]['\ufeff'+FIELDS[_0x5ec888]];}}if(!_0x34d0c8[_0xdbde('0x23')]){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x24'),null,_0x500c71));}if(!_0x34d0c8[_0xdbde('0x25')]){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x26'),null,_0x500c71));}if(_0x34d0c8[_0xdbde('0x27')]){var _0x10c034=moment(_0x34d0c8[_0xdbde('0x27')],_0xdbde('0x28'));if(!_0x10c034[_0xdbde('0x29')]()){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0xdbde('0x2a'),null,_0x500c71));}}if(_0x34d0c8['email']){if(!isEmail(_0x34d0c8[_0xdbde('0x2b')])){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),'email\x20format\x20is\x20not\x20valid!',null,_0x500c71));}}_0x34d0c8['ListId']=LISTID;_0x34d0c8[_0xdbde('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdbde('0x1f')]&&_0x14af87){var _0x3fe663={};for(var _0x2e840a=0x0,_0x5614ba=DUPLICATES[_0xdbde('0x1f')];_0x2e840a<_0x5614ba;_0x2e840a+=0x1){_0x3fe663[DUPLICATES[_0x2e840a]]=_0x34d0c8[DUPLICATES[_0x2e840a]];}var _0x2d49b7=_[_0xdbde('0x2d')](_0x14af87,_0x3fe663);if(_0x2d49b7){return _0x3b4f76(handleCheckRowError(_0xdbde('0x2e'),_0xdbde('0x2f'),_0x2d49b7,_0x500c71));}}return db[_0xdbde('0x30')]['create'](_0x34d0c8,{'raw':!![],'hooks':![],'fields':_[_0xdbde('0x31')](_0x34d0c8)})[_0xdbde('0x32')](function(_0x42cecf){if(DUPLICATES&&DUPLICATES[_0xdbde('0x1f')]&&_0x14af87){_0x14af87[_0xdbde('0x33')](_[_0xdbde('0x34')](_0x34d0c8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42cecf['id'];return _0x2aa293();})['catch'](function(_0x3409b3){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x35')+(_0x3409b3[_0xdbde('0x20')]||JSON['stringify'](_0x3409b3)),null,_0x500c71));});});}function checkHopper(){function _0x2193e4(){return function(_0x4a8a0a){logger[_0xdbde('0x1c')](_0xdbde('0x36'),_0xdbde('0x37'),util[_0xdbde('0x38')](_0x4a8a0a,{'showHidden':![],'depth':null}));};}var _0x25772d=function(_0x3c81c6,_0x1b0402){var _0x4f5e88=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')](_0xdbde('0x3b'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3d'),_0xdbde('0x3e'),_0xdbde('0x3f'),_0x1b0402,'createdAt',_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'),'phone')['field'](_0xdbde('0x43'),'scheduledAt')[_0xdbde('0x42')]('id','ContactId')[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))['field'](_0x3c81c6['id']['toString'](),_0x1b0402)[_0xdbde('0x42')](_0xdbde('0x43'),'createdAt')[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x40'))['from'](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))['where'](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())['where'](_0xdbde('0x49'))[_0xdbde('0x46')](_0xdbde('0x4a'),squel['select']()[_0xdbde('0x42')]('phone')['from'](_0xdbde('0x3b'))[_0xdbde('0x46')](_0x1b0402+'\x20=\x20?',_0x3c81c6['id'][_0xdbde('0x44')]())))[_0xdbde('0x44')]();return _0x4f5e88;};var _0x499742=function(_0x5e0a56,_0x287741){var _0x5131c6=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')](_0xdbde('0x3b'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3d'),_0xdbde('0x3e'),_0xdbde('0x3f'),_0x287741,_0xdbde('0x4b'),_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'),_0xdbde('0x25'))[_0xdbde('0x42')]('NOW()','scheduledAt')[_0xdbde('0x42')]('id',_0xdbde('0x3e'))[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))[_0xdbde('0x42')](_0x5e0a56['id'][_0xdbde('0x44')](),_0x287741)[_0xdbde('0x42')](_0xdbde('0x43'),'createdAt')[_0xdbde('0x42')](_0xdbde('0x43'),'updatedAt')[_0xdbde('0x4c')]('cm_contacts')[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())[_0xdbde('0x46')](_0xdbde('0x4d'),squel[_0xdbde('0x4e')](hopperContacts))['where'](_0xdbde('0x49'))[_0xdbde('0x46')](_0xdbde('0x4a'),squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x4f'))[_0xdbde('0x4c')]('cm_hopper_final')[_0xdbde('0x46')](_0x287741+_0xdbde('0x50'),_0x5e0a56['id'][_0xdbde('0x44')]()))[_0xdbde('0x46')](_0xdbde('0x4a'),squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'))[_0xdbde('0x4c')](_0xdbde('0x3b'))['where'](_0x287741+_0xdbde('0x50'),_0x5e0a56['id'][_0xdbde('0x44')]())))[_0xdbde('0x44')]();return _0x5131c6;};function _0x53cc4a(_0x19c402,_0x5568f5){var _0x235739=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')]('cm_hopper')['fromQuery'](['phone',_0xdbde('0x3d'),'ContactId',_0xdbde('0x3f'),_0x5568f5,_0xdbde('0x4b'),_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')]('phone',_0xdbde('0x25'))[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x3d'))[_0xdbde('0x42')]('id','ContactId')[_0xdbde('0x42')](LISTID['toString'](),'ListId')[_0xdbde('0x42')](_0x19c402['id'][_0xdbde('0x44')](),_0x5568f5)[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x4b'))[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x40'))[_0xdbde('0x4c')](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xdbde('0x46')](_0xdbde('0x49')))[_0xdbde('0x44')]();return _0x235739;}function _0x4ee335(_0x2a5e94,_0x35f153){var _0x45ca9c=squel['insert']()[_0xdbde('0x3a')](_0xdbde('0x51'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3e'),'ListId',_0x35f153,'createdAt',_0xdbde('0x40')],squel['select']()[_0xdbde('0x42')](_0xdbde('0x25'),_0xdbde('0x25'))['field']('id',_0xdbde('0x3e'))[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))[_0xdbde('0x42')](_0x2a5e94['id'][_0xdbde('0x44')](),_0x35f153)[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x4b'))[_0xdbde('0x42')](_0xdbde('0x43'),'updatedAt')[_0xdbde('0x4c')](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())[_0xdbde('0x46')]('id\x20IN\x20?',squel[_0xdbde('0x4e')](hopperContacts))[_0xdbde('0x46')](_0xdbde('0x49')))[_0xdbde('0x44')]();return _0x45ca9c;}return db[_0xdbde('0x52')][_0xdbde('0x53')]({'where':{'type':'outbound'},'attributes':['id',_0xdbde('0x54')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x10e507){var _0x1f5e28=[];if(_0x10e507){var _0x44433e;for(var _0x38e76d=0x0,_0xf658f4;_0x38e76d<_0x10e507['length'];_0x38e76d+=0x1){_0xf658f4=_0x10e507[_0x38e76d][_0xdbde('0x55')]({'plain':!![]});switch(_0xf658f4['dialCheckDuplicateType']){case _0xdbde('0x56'):_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x499742(_0xf658f4,_0xdbde('0x59')))['then'](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;case _0xdbde('0x5b'):_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')]['query'](_0x25772d(_0xf658f4,_0xdbde('0x59')))['then'](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;default:_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x53cc4a(_0xf658f4,_0xdbde('0x59')))['then'](function(){})['catch'](_0x2193e4()));}}}return _0x1f5e28;})[_0xdbde('0x5c')]()[_0xdbde('0x32')](function(){return db[_0xdbde('0x52')][_0xdbde('0x53')]({'where':{'type':_0xdbde('0x5d')},'attributes':['id'],'include':[{'model':db[_0xdbde('0x5e')],'as':_0xdbde('0x5f'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x4145f0){var _0x53ce46=[];if(_0x4145f0){var _0x32ebc2;for(var _0x853b8a=0x0,_0x29beff;_0x853b8a<_0x4145f0[_0xdbde('0x1f')];_0x853b8a+=0x1){_0x29beff=_0x4145f0[_0x853b8a][_0xdbde('0x55')]({'plain':!![]});_0x53ce46[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x4ee335(_0x29beff,_0xdbde('0x59')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}return _0x53ce46;})[_0xdbde('0x5c')]();})[_0xdbde('0x32')](function(){return db[_0xdbde('0x60')][_0xdbde('0x53')]({'attributes':['id',_0xdbde('0x54')],'include':[{'model':db[_0xdbde('0x5e')],'as':_0xdbde('0x61'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x35a62e){var _0x5ff885=[];if(_0x35a62e){for(var _0x24300a=0x0,_0x48e2e4;_0x24300a<_0x35a62e['length'];_0x24300a+=0x1){_0x48e2e4=_0x35a62e[_0x24300a][_0xdbde('0x55')]({'plain':!![]});switch(_0x48e2e4[_0xdbde('0x54')]){case _0xdbde('0x56'):_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x499742(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;case'onlyIfOpen':_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')]['query'](_0x25772d(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;default:_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x53cc4a(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}}return _0x5ff885;})[_0xdbde('0x5c')]();})['then'](function(){return db[_0xdbde('0x60')][_0xdbde('0x53')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdbde('0x5f'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0xe614cd){var _0x1dacfe=[];if(_0xe614cd){for(var _0x4c8238=0x0,_0x186ba5;_0x4c8238<_0xe614cd['length'];_0x4c8238+=0x1){_0x186ba5=_0xe614cd[_0x4c8238][_0xdbde('0x55')]({'plain':!![]});_0x1dacfe['push'](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x4ee335(_0x186ba5,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}return _0x1dacfe;})[_0xdbde('0x5c')]();})[_0xdbde('0x5a')](function(_0x47a645){logger[_0xdbde('0x1c')](_0xdbde('0x63'),'generalCheckHopper',_0x47a645[_0xdbde('0x20')]);});}var processPromises=function(_0x4ed10d){return BPromise['all'](promises)[_0xdbde('0x32')](function(_0x31e226){})[_0xdbde('0x5a')](function(_0x3f5ef6){logger['error'](_0xdbde('0x64'),JSON[_0xdbde('0x65')](_0x3f5ef6));})[_0xdbde('0x66')](function(){socket[_0xdbde('0x67')](_0xdbde('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4ed10d){return _0x4ed10d[_0xdbde('0x69')]();}});};var endCsv=function(){return BPromise[_0xdbde('0x6a')]()[_0xdbde('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xdbde('0x67')](_0xdbde('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdbde('0x6b')](FILEPATH);}catch(_0xccdd75){logger[_0xdbde('0x1c')](_0xdbde('0x6c'),JSON[_0xdbde('0x65')](_0xccdd75));}finally{process['exit'](0x0);}});};process['on'](_0xdbde('0x6d'),function(){logger[_0xdbde('0x6e')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xdbde('0x6a')]()[_0xdbde('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdbde('0x15')](',');return db['CmContact'][_0xdbde('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x40c2c8){var _0x566f92=fs[_0xdbde('0x6f')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdbde('0x70')](_0x566f92,{'header':!![],'skipEmptyLines':!![],'step':function(_0x365118,_0x2943ce){total+=0x1;var _0x3900ac=total;promises[_0xdbde('0x33')](checkRow(_0x365118,_0x40c2c8,_0x3900ac)[_0xdbde('0x32')](function(){success+=0x1;})['catch'](function(_0x5c2016){if(_0x5c2016[_0xdbde('0x1c')]){errors+=0x1;delete _0x5c2016['error'];}else if(_0x5c2016[_0xdbde('0x2e')]){duplicates+=0x1;delete _0x5c2016[_0xdbde('0x2e')];}rows['push'](_0x5c2016);}));if(total%0xc8===0x0){_0x2943ce[_0xdbde('0x71')]();return processPromises(_0x2943ce);}},'complete':function(){return processPromises()[_0xdbde('0x32')](function(){logger[_0xdbde('0x6e')](_0xdbde('0x72'));endCsv();});},'error':function(_0x5f2655,_0x4fffdb){logger[_0xdbde('0x6e')]('CSV\x20parse\x20error',JSON['stringify'](_0x5f2655));endCsv();}});})[_0xdbde('0x5a')](function(_0x10c3ab){logger[_0xdbde('0x1c')](_0xdbde('0x73'),JSON[_0xdbde('0x65')](_0x10c3ab));});}main(); \ No newline at end of file +var _0xf040=['Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','createdAt','updatedAt','select','field','phone','NOW()','scheduledAt','ContactId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','Lists','sequelize','query','VoiceQueueId','catch','findAll','outbound','BlackLists','get','all','CampaignId','Campaign','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resume','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','length','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf040,0x1ef));var _0x0f04=function(_0x3539c0,_0x228e11){_0x3539c0=_0x3539c0-0x0;var _0x344ba8=_0xf040[_0x3539c0];return _0x344ba8;};'use strict';var BPromise=require(_0x0f04('0x0'));var util=require('util');var _=require(_0x0f04('0x1'));var fs=require('fs');var squel=require(_0x0f04('0x2'));var Papa=require(_0x0f04('0x3'));var Redis=require(_0x0f04('0x4'));var db=require(_0x0f04('0x5'))['db'];var config=require(_0x0f04('0x6'));var logger=require(_0x0f04('0x7'))(_0x0f04('0x8'));config[_0x0f04('0x9')]=_['defaults'](config[_0x0f04('0x9')],{'host':_0x0f04('0xa'),'port':0x18eb});var socket=require(_0x0f04('0xb'))(new Redis(config[_0x0f04('0x9')]));require(_0x0f04('0xc'))[_0x0f04('0xd')](socket);try{if(!process[_0x0f04('0xe')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0f04('0xe')][0x2]===_0x0f04('0xf')){throw new Error(_0x0f04('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x0f04('0xe')][0x3]||process[_0x0f04('0xe')][0x3]===_0x0f04('0x11')||process['argv'][0x3]===_0x0f04('0xf')||!process[_0x0f04('0xe')][0x4]||process[_0x0f04('0xe')][0x4]===_0x0f04('0x11')||process[_0x0f04('0xe')][0x4]===_0x0f04('0xf')){throw new Error(_0x0f04('0x12'));}var FIELDS=_['zipObject'](process[_0x0f04('0xe')][0x3]['split'](','),process[_0x0f04('0xe')][0x4][_0x0f04('0x13')](','));if(!process[_0x0f04('0xe')][0x5]||process[_0x0f04('0xe')][0x5]==='undefined'||process[_0x0f04('0xe')][0x5]===_0x0f04('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0f04('0xe')][0x5];var COMPANYID=process[_0x0f04('0xe')][0x6]&&process[_0x0f04('0xe')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x0f04('0xf')?process[_0x0f04('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0f04('0xe')][0x7]!=='undefined'&&process[_0x0f04('0xe')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x0f04('0xe')][0x8]||process['argv'][0x8]===_0x0f04('0x11')||process[_0x0f04('0xe')][0x8]===_0x0f04('0xf')){throw new Error(_0x0f04('0x14'));}var SOCKET_TIMESTAMP=process[_0x0f04('0xe')][0x8];}catch(_0x43a63e){logger[_0x0f04('0x15')](_0x43a63e);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(_0x6df7a6,_0x4da6f0,_0x340827,_0x36fb0c){var _0x2a7e81={'message':_0x4da6f0};_0x2a7e81[_0x6df7a6]=!![];if(_0x340827){_0x2a7e81[_0x0f04('0x16')]=_0x340827;}if(_0x36fb0c){_0x2a7e81[_0x0f04('0x17')]=_0x36fb0c;}return _0x2a7e81;}function isEmail(_0x439a12){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))*$/[_0x0f04('0x18')](_0x439a12);}function checkRow(_0x3b4a2f,_0x1b163c,_0x49b5aa){return new BPromise(function(_0x308f5f,_0x5b41b6){if(_[_0x0f04('0x19')](_0x3b4a2f)){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),_0x0f04('0x1a'),null,_0x49b5aa));}if(_0x3b4a2f[_0x0f04('0x1b')]&&_0x3b4a2f[_0x0f04('0x1b')]['length']){var _0x6efc00=_[_0x0f04('0x1c')](_0x3b4a2f[_0x0f04('0x1b')],_0x0f04('0x1d'))[_0x0f04('0x1e')](';');return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),_0x6efc00,null,_0x49b5aa));}var _0x253518={};for(var _0x4bdf8d in FIELDS){if(FIELDS[_0x0f04('0x1f')](_0x4bdf8d)&&FIELDS[_0x4bdf8d]){_0x253518[_0x4bdf8d]=_0x3b4a2f[_0x0f04('0x20')][0x0][FIELDS[_0x4bdf8d]]||_0x3b4a2f['data'][0x0]['\ufeff'+FIELDS[_0x4bdf8d]];}}if(!_0x253518[_0x0f04('0x21')]){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),'firstName\x20not\x20specified!',null,_0x49b5aa));}if(!_0x253518['phone']){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),_0x0f04('0x22'),null,_0x49b5aa));}if(_0x253518['birthDate']){var _0x395520=moment(_0x253518['birthDate'],_0x0f04('0x23'));if(!_0x395520[_0x0f04('0x24')]()){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x49b5aa));}}if(_0x253518[_0x0f04('0x25')]){if(!isEmail(_0x253518[_0x0f04('0x25')])){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),_0x0f04('0x26'),null,_0x49b5aa));}}_0x253518[_0x0f04('0x27')]=LISTID;_0x253518[_0x0f04('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1b163c){var _0x2ed5a8={};for(var _0x457de6=0x0,_0x35fb4d=DUPLICATES['length'];_0x457de6<_0x35fb4d;_0x457de6+=0x1){_0x2ed5a8[DUPLICATES[_0x457de6]]=_0x253518[DUPLICATES[_0x457de6]];}var _0x5e6043=_[_0x0f04('0x29')](_0x1b163c,_0x2ed5a8);if(_0x5e6043){return _0x5b41b6(handleCheckRowError(_0x0f04('0x2a'),_0x0f04('0x2b'),_0x5e6043,_0x49b5aa));}}return db[_0x0f04('0x2c')][_0x0f04('0x2d')](_0x253518,{'raw':!![],'hooks':![],'fields':_[_0x0f04('0x2e')](_0x253518)})[_0x0f04('0x2f')](function(_0x107898){if(DUPLICATES&&DUPLICATES[_0x0f04('0x30')]&&_0x1b163c){_0x1b163c[_0x0f04('0x31')](_['pick'](_0x253518,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x107898['id'];return _0x308f5f();})['catch'](function(_0x43b057){return _0x5b41b6(handleCheckRowError(_0x0f04('0x15'),_0x0f04('0x32')+(_0x43b057['message']||JSON[_0x0f04('0x33')](_0x43b057)),null,_0x49b5aa));});});}function checkHopper(){function _0x48acda(){return function(_0x3203e3){logger[_0x0f04('0x15')]('cmContact',_0x0f04('0x34'),util[_0x0f04('0x35')](_0x3203e3,{'showHidden':![],'depth':null}));};}var _0x2144cc=function(_0x527f47,_0x1b6bcf){var _0x40acec=squel[_0x0f04('0x36')]()[_0x0f04('0x37')](_0x0f04('0x38'))['fromQuery'](['phone','scheduledAt','ContactId',_0x0f04('0x27'),_0x1b6bcf,_0x0f04('0x39'),_0x0f04('0x3a')],squel[_0x0f04('0x3b')]()[_0x0f04('0x3c')](_0x0f04('0x3d'),_0x0f04('0x3d'))[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x3f'))[_0x0f04('0x3c')]('id',_0x0f04('0x40'))['field'](LISTID['toString'](),_0x0f04('0x27'))[_0x0f04('0x3c')](_0x527f47['id']['toString'](),_0x1b6bcf)[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x39'))['field'](_0x0f04('0x3e'),_0x0f04('0x3a'))[_0x0f04('0x41')](_0x0f04('0x42'))['where'](_0x0f04('0x43'))[_0x0f04('0x44')](_0x0f04('0x45'),LISTID[_0x0f04('0x46')]())[_0x0f04('0x44')](_0x0f04('0x47'))[_0x0f04('0x44')](_0x0f04('0x48'),squel[_0x0f04('0x3b')]()[_0x0f04('0x3c')](_0x0f04('0x3d'))['from'](_0x0f04('0x38'))[_0x0f04('0x44')](_0x1b6bcf+_0x0f04('0x49'),_0x527f47['id'][_0x0f04('0x46')]())))[_0x0f04('0x46')]();return _0x40acec;};var _0x96c012=function(_0x81a61c,_0x37f17d){var _0x49cb99=squel[_0x0f04('0x36')]()[_0x0f04('0x37')](_0x0f04('0x38'))[_0x0f04('0x4a')]([_0x0f04('0x3d'),'scheduledAt','ContactId',_0x0f04('0x27'),_0x37f17d,_0x0f04('0x39'),_0x0f04('0x3a')],squel[_0x0f04('0x3b')]()[_0x0f04('0x3c')](_0x0f04('0x3d'),_0x0f04('0x3d'))[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x3f'))['field']('id','ContactId')[_0x0f04('0x3c')](LISTID[_0x0f04('0x46')](),_0x0f04('0x27'))[_0x0f04('0x3c')](_0x81a61c['id']['toString'](),_0x37f17d)['field'](_0x0f04('0x3e'),'createdAt')['field']('NOW()',_0x0f04('0x3a'))[_0x0f04('0x41')](_0x0f04('0x42'))[_0x0f04('0x44')]('deletedAt\x20IS\x20NULL')['where'](_0x0f04('0x45'),LISTID[_0x0f04('0x46')]())[_0x0f04('0x44')](_0x0f04('0x4b'),squel[_0x0f04('0x4c')](hopperContacts))['where'](_0x0f04('0x47'))[_0x0f04('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0f04('0x3c')](_0x0f04('0x4d'))[_0x0f04('0x41')](_0x0f04('0x4e'))['where'](_0x37f17d+_0x0f04('0x49'),_0x81a61c['id'][_0x0f04('0x46')]()))[_0x0f04('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0f04('0x3c')]('phone')[_0x0f04('0x41')](_0x0f04('0x38'))['where'](_0x37f17d+'\x20=\x20?',_0x81a61c['id'][_0x0f04('0x46')]())))[_0x0f04('0x46')]();return _0x49cb99;};function _0x12b27f(_0x589a55,_0x737097){var _0x1473c2=squel['insert']()[_0x0f04('0x37')]('cm_hopper')[_0x0f04('0x4a')]([_0x0f04('0x3d'),_0x0f04('0x3f'),_0x0f04('0x40'),'ListId',_0x737097,_0x0f04('0x39'),_0x0f04('0x3a')],squel[_0x0f04('0x3b')]()[_0x0f04('0x3c')](_0x0f04('0x3d'),_0x0f04('0x3d'))['field'](_0x0f04('0x3e'),_0x0f04('0x3f'))[_0x0f04('0x3c')]('id',_0x0f04('0x40'))[_0x0f04('0x3c')](LISTID['toString'](),_0x0f04('0x27'))[_0x0f04('0x3c')](_0x589a55['id'][_0x0f04('0x46')](),_0x737097)[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x39'))[_0x0f04('0x3c')]('NOW()','updatedAt')[_0x0f04('0x41')]('cm_contacts')[_0x0f04('0x44')]('deletedAt\x20IS\x20NULL')[_0x0f04('0x44')]('ListId\x20=\x20?',LISTID[_0x0f04('0x46')]())[_0x0f04('0x44')](_0x0f04('0x4b'),squel[_0x0f04('0x4c')](hopperContacts))[_0x0f04('0x44')](_0x0f04('0x47')))[_0x0f04('0x46')]();return _0x1473c2;}function _0x9371b3(_0x11d471,_0x857894){var _0x2dafa8=squel[_0x0f04('0x36')]()[_0x0f04('0x37')](_0x0f04('0x4f'))[_0x0f04('0x4a')](['phone',_0x0f04('0x40'),'ListId',_0x857894,'createdAt',_0x0f04('0x3a')],squel[_0x0f04('0x3b')]()[_0x0f04('0x3c')]('phone',_0x0f04('0x3d'))['field']('id',_0x0f04('0x40'))[_0x0f04('0x3c')](LISTID[_0x0f04('0x46')](),_0x0f04('0x27'))['field'](_0x11d471['id'][_0x0f04('0x46')](),_0x857894)[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x39'))[_0x0f04('0x3c')](_0x0f04('0x3e'),_0x0f04('0x3a'))['from'](_0x0f04('0x42'))['where'](_0x0f04('0x43'))[_0x0f04('0x44')](_0x0f04('0x45'),LISTID['toString']())[_0x0f04('0x44')](_0x0f04('0x4b'),squel[_0x0f04('0x4c')](hopperContacts))[_0x0f04('0x44')](_0x0f04('0x47')))[_0x0f04('0x46')]();return _0x2dafa8;}return db[_0x0f04('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x0f04('0x51')],'include':[{'model':db['CmList'],'as':_0x0f04('0x52'),'where':{'id':LISTID}}]})[_0x0f04('0x2f')](function(_0xf10c65){var _0x4fa51f=[];if(_0xf10c65){var _0x8b64b4;for(var _0x210d24=0x0,_0x52f042;_0x210d24<_0xf10c65['length'];_0x210d24+=0x1){_0x52f042=_0xf10c65[_0x210d24]['get']({'plain':!![]});switch(_0x52f042[_0x0f04('0x51')]){case'always':_0x4fa51f['push'](db[_0x0f04('0x53')][_0x0f04('0x54')](_0x96c012(_0x52f042,_0x0f04('0x55')))['then'](function(){})[_0x0f04('0x56')](_0x48acda()));break;case'onlyIfOpen':_0x4fa51f[_0x0f04('0x31')](db[_0x0f04('0x53')]['query'](_0x2144cc(_0x52f042,_0x0f04('0x55')))['then'](function(){})[_0x0f04('0x56')](_0x48acda()));break;default:_0x4fa51f[_0x0f04('0x31')](db['sequelize'][_0x0f04('0x54')](_0x12b27f(_0x52f042,_0x0f04('0x55')))[_0x0f04('0x2f')](function(){})[_0x0f04('0x56')](_0x48acda()));}}}return _0x4fa51f;})['all']()[_0x0f04('0x2f')](function(){return db[_0x0f04('0x50')][_0x0f04('0x57')]({'where':{'type':_0x0f04('0x58')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0f04('0x59'),'where':{'id':LISTID}}]})[_0x0f04('0x2f')](function(_0x3fbbe2){var _0x405416=[];if(_0x3fbbe2){var _0x1f3058;for(var _0x33d8e0=0x0,_0x212dcb;_0x33d8e0<_0x3fbbe2['length'];_0x33d8e0+=0x1){_0x212dcb=_0x3fbbe2[_0x33d8e0][_0x0f04('0x5a')]({'plain':!![]});_0x405416[_0x0f04('0x31')](db[_0x0f04('0x53')]['query'](_0x9371b3(_0x212dcb,_0x0f04('0x55')))[_0x0f04('0x2f')](function(){})[_0x0f04('0x56')](_0x48acda()));}}return _0x405416;})[_0x0f04('0x5b')]();})[_0x0f04('0x2f')](function(){return db['Campaign'][_0x0f04('0x57')]({'attributes':['id',_0x0f04('0x51')],'include':[{'model':db['CmList'],'as':_0x0f04('0x52'),'where':{'id':LISTID}}]})[_0x0f04('0x2f')](function(_0x7fb5eb){var _0x1d86ea=[];if(_0x7fb5eb){for(var _0x11f876=0x0,_0x90db7f;_0x11f876<_0x7fb5eb[_0x0f04('0x30')];_0x11f876+=0x1){_0x90db7f=_0x7fb5eb[_0x11f876][_0x0f04('0x5a')]({'plain':!![]});switch(_0x90db7f['dialCheckDuplicateType']){case'always':_0x1d86ea[_0x0f04('0x31')](db['sequelize']['query'](_0x96c012(_0x90db7f,'CampaignId'))[_0x0f04('0x2f')](function(){})['catch'](_0x48acda()));break;case'onlyIfOpen':_0x1d86ea['push'](db[_0x0f04('0x53')][_0x0f04('0x54')](_0x2144cc(_0x90db7f,_0x0f04('0x5c')))[_0x0f04('0x2f')](function(){})['catch'](_0x48acda()));break;default:_0x1d86ea[_0x0f04('0x31')](db[_0x0f04('0x53')][_0x0f04('0x54')](_0x12b27f(_0x90db7f,_0x0f04('0x5c')))[_0x0f04('0x2f')](function(){})[_0x0f04('0x56')](_0x48acda()));}}}return _0x1d86ea;})[_0x0f04('0x5b')]();})['then'](function(){return db[_0x0f04('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0f04('0x2f')](function(_0x2a8a8f){var _0x48e218=[];if(_0x2a8a8f){for(var _0x257611=0x0,_0xe0c7b4;_0x257611<_0x2a8a8f[_0x0f04('0x30')];_0x257611+=0x1){_0xe0c7b4=_0x2a8a8f[_0x257611][_0x0f04('0x5a')]({'plain':!![]});_0x48e218[_0x0f04('0x31')](db[_0x0f04('0x53')][_0x0f04('0x54')](_0x9371b3(_0xe0c7b4,_0x0f04('0x5c')))[_0x0f04('0x2f')](function(){})[_0x0f04('0x56')](_0x48acda()));}}return _0x48e218;})[_0x0f04('0x5b')]();})['catch'](function(_0x5bf777){logger['error'](_0x0f04('0x5e'),'generalCheckHopper',_0x5bf777[_0x0f04('0x1d')]);});}var processPromises=function(_0x168585){return BPromise['all'](promises)[_0x0f04('0x2f')](function(_0x4c6018){})[_0x0f04('0x56')](function(_0x1a184f){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x0f04('0x33')](_0x1a184f));})[_0x0f04('0x5f')](function(){socket[_0x0f04('0x60')](_0x0f04('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x168585){return _0x168585[_0x0f04('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x0f04('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x0f04('0x2f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x338099){logger[_0x0f04('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0f04('0x33')](_0x338099));}finally{process[_0x0f04('0x63')](0x0);}});};process['on'](_0x0f04('0x64'),function(){logger[_0x0f04('0x65')](_0x0f04('0x66'));endCsv();});function main(){return BPromise[_0x0f04('0x67')]()[_0x0f04('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x0f04('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0f04('0x2f')](function(_0xdc440e){var _0x20f954=fs[_0x0f04('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0f04('0x69')](_0x20f954,{'header':!![],'skipEmptyLines':!![],'step':function(_0x48b0ad,_0x521f9e){total+=0x1;var _0x571543=total;promises[_0x0f04('0x31')](checkRow(_0x48b0ad,_0xdc440e,_0x571543)['then'](function(){success+=0x1;})[_0x0f04('0x56')](function(_0x24cf7a){if(_0x24cf7a[_0x0f04('0x15')]){errors+=0x1;delete _0x24cf7a[_0x0f04('0x15')];}else if(_0x24cf7a[_0x0f04('0x2a')]){duplicates+=0x1;delete _0x24cf7a[_0x0f04('0x2a')];}rows[_0x0f04('0x31')](_0x24cf7a);}));if(total%0xc8===0x0){_0x521f9e[_0x0f04('0x6a')]();return processPromises(_0x521f9e);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x0f04('0x6b'));endCsv();});},'error':function(_0x404ea6,_0x1d933d){logger[_0x0f04('0x65')](_0x0f04('0x6c'),JSON['stringify'](_0x404ea6));endCsv();}});})[_0x0f04('0x56')](function(_0x3381c8){logger[_0x0f04('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x3381c8));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ff4c361..f06489c 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 _0x9012=['CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','error','message','errors','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','send','start','clone','socket_timestamp','server/files/tmp','includes','ContactItemType','name','_description','header','writeFileSync','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns','unlink','exit','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','priority','recallme','into','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9012,0x6c));var _0x2901=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x9012[_0x13b330];return _0x1f666c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2901('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x2901('0x1'));var moment=require(_0x2901('0x2'));var squel=require(_0x2901('0x3'));var Redis=require(_0x2901('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x2901('0x5'));var shared=require(_0x2901('0x6'));var logger=require('../../../config/logger')(_0x2901('0x7'));config[_0x2901('0x8')]=_[_0x2901('0x9')](config[_0x2901('0x8')],{'host':_0x2901('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2901('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2901('0xb')](_0x2901('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2901('0xb')](_0x2901('0xc'));function isEmail(_0x4a5291){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4a5291);}function selectNotIn(_0x28a3e3,_0x13dd39,_0x16bfd9,_0x416444,_0xe09588){return squel[_0x2901('0xd')]()[_0x2901('0xe')](_0x2901('0xf'))[_0x2901('0x10')](_0x416444)['join'](_0x13dd39,null,_0x13dd39+'.id\x20=\x20'+_0x416444+'.'+_0x16bfd9)[_0x2901('0x11')](_0x416444+'.'+_0x16bfd9+_0x2901('0x12')+_0x28a3e3+'.'+_0x16bfd9)['where'](_0x13dd39+_0x2901('0x13')+_0xe09588[_0x2901('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4bad33,_0x4ef76f){promisesAdditionalPhones=[];return db[_0x2901('0x15')]['findAll']({'raw':!![],'attributes':['id',_0x2901('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2901('0x17')](function(_0x401593){if(_0x401593!==null){var _0x1ae9d5=[];for(var _0x49fba3=0x0;_0x49fba3<_0x401593[_0x2901('0x18')];_0x49fba3++){var _0x1a5c2e=_0x401593[_0x49fba3];_0x1ae9d5[_0x2901('0x19')](insertAdditionalPhones(_0x1a5c2e));}}Promise['all'](_0x1ae9d5)[_0x2901('0x17')](function(){_0x4bad33({'val':0x1});});});});}function insertAdditionalPhones(_0x54a829){return new Promise(function(_0x5ed38a,_0x394384){var _0x458202=_0x54a829['AdditionalPhones'];var _0x217aaf=_0x458202[_0x2901('0x1a')](';');var _0x4eeb71=[];orderBy=0x0;for(var _0xa98927=0x0;_0xa98927<_0x217aaf[_0x2901('0x18')];_0xa98927++){_0x4eeb71[_0x2901('0x19')](splitAdditionalPhone(_0x54a829['id'],_0x217aaf[_0xa98927]));}Promise[_0x2901('0x1b')](_0x4eeb71)[_0x2901('0x17')](function(){_0x5ed38a({'val':_0x217aaf[_0x2901('0x18')]});});});}function splitAdditionalPhone(_0x464b84,_0x142350){return new Promise(function(_0xf3530e,_0x169352){var _0x1e6745=_0x142350['split'](':');var _0x4a76f6=_0x1e6745[0x0];var _0x4b5058=_0x1e6745[0x1];if(!_['isNil'](_0x4b5058)){var _0xabf58f=_0x4b5058['split']('|');var _0x35ecb7=[];for(var _0x2fadae=0x0;_0x2fadae<_0xabf58f['length'];_0x2fadae++){if(_0xabf58f[_0x2fadae]!==''){var _0x4ee893=_[_0x2901('0x1c')](promisesAdditionalPhones,{'contactId':_0x464b84,'phone':_0xabf58f[_0x2fadae]});if(_0x4ee893[_0x2901('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x464b84,'contactTypeId':_0x4a76f6,'phone':_0xabf58f[_0x2fadae],'orderBy':orderBy});}}}_0xf3530e({'ok':0x1});}else _0xf3530e({'res':0x0});});}function createAdditionalPhone(_0x915be1,_0x26d033,_0x4eb595,_0x4f7302){var _0x2c5e0a='';var _0x10e47e='';var _0x5d7d8f=_0x4eb595[_0x2901('0x1a')]('§');_0x2c5e0a=_0x5d7d8f[0x0];if(_0x5d7d8f[_0x2901('0x18')]==0x2)_0x10e47e=_0x5d7d8f[0x1];return new Promise(function(_0x41fdbf,_0x539e4e){return db[_0x2901('0x1d')][_0x2901('0x1e')]({'where':{'CmContactId':_0x915be1,'item':_0x2c5e0a}})['then'](function(_0x1174e5){if(_0x1174e5){return db[_0x2901('0x1d')][_0x2901('0x1f')]({'ItemTypeId':_0x26d033,'description':_0x10e47e,'OrderBy':_0x4f7302},{'where':{'CmContactId':_0x915be1,'item':_0x2c5e0a}})[_0x2901('0x17')](function(_0xee1838){_0x41fdbf({'res':_0x2901('0x20')});});}else{return db[_0x2901('0x1d')]['create']({'CmContactId':_0x915be1,'item':_0x2c5e0a,'description':_0x10e47e,'ItemTypeId':_0x26d033,'OrderBy':_0x4f7302,'ItemClass':_0x2901('0x21')})[_0x2901('0x17')](function(_0xda953c){_0x41fdbf({'res':_0x2901('0x22')});});}});});}function insertCmHopper(_0x2a46f1,_0x548161,_0xc51d8c,_0x2b1869,_0x254802){var _0x12fbdb=[_0x2901('0x23'),'cm_contacts.scheduledat',_0x2901('0x24'),_0x2901('0x25'),_0x548161+'.'+_0x2b1869,_0x2901('0x26'),'cm_contacts.updatedAt',_0x2901('0x27'),'cm_contacts.UserId','\x22'+_0x254802+'\x22'];return squel[_0x2901('0x28')]()['into'](_0x2901('0x29'))[_0x2901('0x2a')]([_0x2901('0xf'),'scheduledat',_0x2901('0x2b'),_0x2901('0x2c'),_0x2b1869,_0x2901('0x2d'),_0x2901('0x2e'),'priority',_0x2901('0x2f'),'recallme'],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x12fbdb)[_0x2901('0x10')](_0x548161)[_0x2901('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x548161+_0x2901('0x31'))[_0x2901('0x14')](_0xc51d8c,null,_0xc51d8c+'.id\x20=\x20'+_0x548161+'.'+_0x2b1869)['where'](_0x548161+_0x2901('0x32'),_0x2a46f1)[_0x2901('0x11')](_0x2901('0x33'),NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x548161,_0xc51d8c,_0x2b1869,_0x2901('0x29'),['\x22always\x22',_0x2901('0x34')]))['where'](_0x2901('0x35'),selectNotIn(_0x548161,_0xc51d8c,_0x2b1869,_0x2901('0x29'),[_0x2901('0x36')])))[_0x2901('0x37')]();}function insertCmHopperBlack(_0x27530b,_0x1cd725,_0x31f51e,_0x54b017){var _0x2e82a3=['cm_contacts.phone','cm_contacts.id',_0x2901('0x25'),_0x1cd725+'.'+_0x54b017,_0x2901('0x26'),'cm_contacts.updatedAt'];return squel[_0x2901('0x28')]()['into'](_0x2901('0x38'))['fromQuery']([_0x2901('0xf'),'ContactId',_0x2901('0x2c'),_0x54b017,'createdAt',_0x2901('0x2e')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x2e82a3)[_0x2901('0x10')](_0x1cd725)[_0x2901('0x14')](_0x2901('0x39'),null,_0x2901('0x3a')+_0x1cd725+_0x2901('0x31'))['join'](_0x31f51e,null,_0x31f51e+_0x2901('0x3b')+_0x1cd725+'.'+_0x54b017)['where'](_0x1cd725+_0x2901('0x32'),_0x27530b)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2901('0xe')](_0x2901('0xf'))[_0x2901('0x10')](_0x2901('0x38'))['where'](_0x2901('0x3c'),_0x27530b)['where'](_0x54b017+_0x2901('0x12')+_0x1cd725+'.'+_0x54b017)))[_0x2901('0x37')]();}function insertTzCmHopper(_0x2f9b27,_0x3a87e9,_0x842b53,_0x3180d6,_0x2ccced,_0x302bd5){var _0x59a60f=[_0x2901('0x23'),_0x2901('0x3d')+_0x302bd5+_0x2901('0x3e'),'cm_contacts.id',_0x2901('0x25'),_0x3a87e9+'.'+_0x3180d6,_0x2901('0x26'),_0x2901('0x3f'),_0x2901('0x27'),'cm_contacts.UserId','\x22'+_0x2ccced+'\x22'];var _0x2373e7=squel['insert']()['into'](_0x2901('0x29'))[_0x2901('0x2a')]([_0x2901('0xf'),_0x2901('0x40'),_0x2901('0x2b'),_0x2901('0x2c'),_0x3180d6,_0x2901('0x2d'),_0x2901('0x2e'),_0x2901('0x41'),_0x2901('0x2f'),_0x2901('0x42')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x59a60f)[_0x2901('0x10')](_0x3a87e9)[_0x2901('0x14')]('cm_contacts',null,_0x2901('0x3a')+_0x3a87e9+'.CmListId')[_0x2901('0x14')](_0x842b53,null,_0x842b53+_0x2901('0x3b')+_0x3a87e9+'.'+_0x3180d6)[_0x2901('0x14')](_0x302bd5,null,_0x302bd5+_0x2901('0x3b')+_0x3a87e9+'.'+_0x3180d6)['where'](_0x3a87e9+'.CmListId\x20=\x20?',_0x2f9b27)[_0x2901('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2901('0x11')](_0x2901('0x35'),selectNotIn(_0x3a87e9,_0x842b53,_0x3180d6,_0x2901('0x29'),[_0x2901('0x36'),_0x2901('0x34')]))[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a87e9,_0x842b53,_0x3180d6,'cm_hopper',[_0x2901('0x36')])))['toString']();return _0x2373e7;}function insertTzCmHopperBlack(_0xd298a7,_0x1b82f3,_0x9909f0,_0x1590ed){var _0x1a2d27=[_0x2901('0x23'),'cm_contacts.id',_0x2901('0x25'),_0x1b82f3+'.'+_0x1590ed,_0x2901('0x26'),_0x2901('0x3f')];return squel['insert']()[_0x2901('0x43')](_0x2901('0x38'))[_0x2901('0x2a')]([_0x2901('0xf'),_0x2901('0x2b'),_0x2901('0x2c'),_0x1590ed,'createdAt',_0x2901('0x2e')],squel['select']()[_0x2901('0x30')](_0x1a2d27)[_0x2901('0x10')](_0x1b82f3)['join'](_0x2901('0x39'),null,_0x2901('0x3a')+_0x1b82f3+'.CmListId')['join'](_0x9909f0,null,_0x9909f0+_0x2901('0x3b')+_0x1b82f3+'.'+_0x1590ed)[_0x2901('0x11')](_0x1b82f3+_0x2901('0x32'),_0xd298a7)['where'](_0x2901('0x33'),NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2901('0xe')](_0x2901('0xf'))['from'](_0x2901('0x38'))[_0x2901('0x11')](_0x2901('0x3c'),_0xd298a7)[_0x2901('0x11')](_0x1590ed+_0x2901('0x12')+_0x1b82f3+'.'+_0x1590ed)))[_0x2901('0x37')]();}function insertCmHopperAdditionalPhones(_0x4a1444){var _0x3b99c4=['cm_hopper.id',_0x2901('0x44'),'cm_contact_has_items.OrderBy',_0x2901('0x45'),'cm_contact_has_items.updatedAt'];return squel[_0x2901('0x28')]()[_0x2901('0x43')](_0x2901('0x46'))[_0x2901('0x2a')]([_0x2901('0x47'),'phone','OrderBy','createdAt',_0x2901('0x2e')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x3b99c4)['from'](_0x2901('0x29'))[_0x2901('0x14')](_0x2901('0x39'),null,_0x2901('0x48'))[_0x2901('0x14')](_0x2901('0x49'),null,_0x2901('0x4a'))['where'](_0x2901('0x4b'),_0x4a1444)[_0x2901('0x11')](_0x2901('0x33'),NOW))['toString']();}function insertCmContact(_0x5aca03,_0x329d61,_0x1c1e05,_0x58c18d){var _0x477781=_[_0x2901('0x4c')](_[_0x2901('0x4d')](_0x58c18d),['ListId',_0x2901('0x4e'),_0x2901('0x2d'),'updatedAt','scheduledAt']);return squel[_0x2901('0x28')]()[_0x2901('0x43')](_0x2901('0x39'))['fromQuery'](_0x477781,squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x477781)[_0x2901('0x10')](_0x329d61)[_0x2901('0x11')]('('+_0x1c1e05['join'](',')+_0x2901('0x4f'),squel[_0x2901('0xd')]()['fields'](_0x1c1e05)['from']('cm_contacts')[_0x2901('0x11')](_0x2901('0x3c'),_0x5aca03)[_0x2901('0x11')](_0x2901('0x50')))['where'](_0x2901('0x51'),squel[_0x2901('0xd')]()['field'](_0x2901('0x52'),'min_id')[_0x2901('0x10')](_0x329d61)[_0x2901('0x53')](_0x1c1e05[_0x2901('0x14')](','))))['toString']();}function handleStop(){logger[_0x2901('0x54')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5bbedd){logger[_0x2901('0x55')](_0x5bbedd[_0x2901('0x56')]);process['exit'](0x1);}function handleError(_0x2929bd,_0x2f228f){stats[_0x2901('0x57')][_0x2901('0x19')]({'name':_0x2f228f[_0x2901('0x58')],'message':_0x2f228f[_0x2901('0x56')],'row':_0x2929bd});}function handleQuery(_0x306957){logger[_0x2901('0x54')](_0x306957);return db[_0x2901('0x59')][_0x2901('0x5a')](_0x306957)['spread'](function(_0x186632){results[_0x2901('0x19')](_0x186632);})[_0x2901('0x5b')](function(_0x480b57){logger[_0x2901('0x55')](_0x480b57[_0x2901('0x56')]);});}function updateTzCampaigns(_0x57d8ed){return new Promise(function(_0x14ae2e,_0x55b364){var _0x2d0287=squel[_0x2901('0xd')]()[_0x2901('0x30')]([_0x2901('0x5c'),_0x2901('0x5d')])[_0x2901('0x10')]('campaigns')[_0x2901('0x14')](_0x2901('0x5e'),null,_0x2901('0x5f'))[_0x2901('0x11')](_0x2901('0x60')+_0x57d8ed);db[_0x2901('0x59')]['query'](_0x2d0287[_0x2901('0x37')]())[_0x2901('0x61')](function(_0x1c8f93){var _0x116d6f=[];for(var _0x149b6a=0x0;_0x149b6a<_0x1c8f93[_0x2901('0x18')];_0x149b6a++){_0x116d6f['push'](getTimezoneData(_0x1c8f93[_0x149b6a],tmp_campaigns));}BPromise[_0x2901('0x1b')](_0x116d6f)[_0x2901('0x17')](function(){_0x14ae2e({'val':0x1});});})['catch'](function(_0x78c30e){logger[_0x2901('0x55')](_0x78c30e[_0x2901('0x56')]);_0x14ae2e({'val':0x0});});});}function updateTzVoiceQueues(_0x4510f4){return new Promise(function(_0x270851,_0x40ff93){var _0x156646=squel[_0x2901('0xd')]()[_0x2901('0x30')]([_0x2901('0x62'),_0x2901('0x63')])[_0x2901('0x10')](_0x2901('0x64'))[_0x2901('0x14')](_0x2901('0x65'),null,_0x2901('0x66'))[_0x2901('0x11')](_0x2901('0x67')+_0x4510f4);db[_0x2901('0x59')][_0x2901('0x5a')](_0x156646[_0x2901('0x37')]())[_0x2901('0x61')](function(_0x24ef7e){var _0x26b596=[];for(var _0x567816=0x0;_0x567816<_0x24ef7e[_0x2901('0x18')];_0x567816++){_0x26b596[_0x2901('0x19')](getTimezoneData(_0x24ef7e[_0x567816],tmp_voice_queues));}BPromise['all'](_0x26b596)[_0x2901('0x17')](function(){_0x270851({'val':0x1});});})[_0x2901('0x5b')](function(_0x54ab7b){logger['error'](_0x54ab7b[_0x2901('0x56')]);_0x270851({'val':0x0});});});}function getTimezoneData(_0x49cad3,_0x15345b){return new Promise(function(_0x3d4c62,_0x532c6b){var _0x41ae19=shared[_0x2901('0x68')];var _0x5558c4=_0x41ae19[_0x49cad3[_0x2901('0x69')]];if(_[_0x2901('0x6a')](_0x5558c4)){_0x3d4c62({'ret':0x1});}else{var _0x5005e1=_0x5558c4[_0x2901('0x6b')];var _0x3cf00e=squel['insert']()[_0x2901('0x43')](_0x15345b)[_0x2901('0x6c')]('id',_0x49cad3['id'])[_0x2901('0x6c')](_0x2901('0x6d'),_0x5005e1)[_0x2901('0x6c')]('dialTimezone',_0x49cad3['dialTimezone'])[_0x2901('0x37')]();return db['sequelize'][_0x2901('0x5a')](_0x3cf00e)['spread'](function(_0x2aa87f){_0x3d4c62({'ret':0x1});})['catch'](function(_0x466a41){logger[_0x2901('0x55')](_0x466a41['message']);_0x532c6b({'ret':0x1});});}});}function handleTZQuery(_0x16fa7a){logger[_0x2901('0x54')](_0x16fa7a);return db['sequelize'][_0x2901('0x5a')](_0x16fa7a)[_0x2901('0x61')](function(_0x339cb3){})[_0x2901('0x5b')](function(_0x25ad70){logger[_0x2901('0x55')](_0x25ad70[_0x2901('0x56')]);});}function main(_0x2a68ad,_0x26a877,_0x27f9ef,_0x424deb){logger['info'](_0x2901('0x6e'),_0x2a68ad,JSON['stringify'](_0x26a877));process[_0x2901('0x6f')](_0x2901('0x70'));var _0x6e6854=_0x26a877['binding'];var _0x35947c=_[_0x2901('0x71')](_0x6e6854);var _0x52f985=_0x26a877[_0x2901('0x72')];var _0x79739c=path['join'](config['root'],_0x2901('0x73'),_0x52f985+'.csv');hasTZ=_[_0x2901('0x4d')](_0x6e6854)[_0x2901('0x74')]('dialTimezone');var _0x21df4b=_[_0x2901('0x4d')](_0x6e6854)[_0x2901('0x14')]();logger[_0x2901('0x54')]('header',_0x21df4b);db[_0x2901('0x75')]['findAll']({'raw':!![],'attributes':['id',_0x2901('0x76')]})[_0x2901('0x17')](function(_0x37f8c2){for(var _0x132e6b=0x0;_0x132e6b<_0x37f8c2[_0x2901('0x18')];_0x132e6b++){if(_0x37f8c2[_0x132e6b][_0x2901('0x76')]in _0x6e6854){contactItemTypes[_0x2901('0x19')](_0x37f8c2[_0x132e6b]);delete _0x35947c[_0x37f8c2[_0x132e6b][_0x2901('0x76')]];hasAdditionalPhones=!![];}for(var _0x12de32 in _0x6e6854){if(_0x37f8c2[_0x132e6b][_0x2901('0x76')]+_0x2901('0x77')===_0x12de32){phoneDescriptions[_0x2901('0x19')]({'itemTypeId':_0x37f8c2[_0x132e6b]['id'],'description':_0x12de32});delete _0x35947c[_0x12de32];}}}if(hasAdditionalPhones)_0x35947c[_0x2901('0x16')]='';var _0x364e43=_[_0x2901('0x4d')](_0x35947c)[_0x2901('0x14')]();logger[_0x2901('0x54')](_0x2901('0x78'),_0x364e43);fs[_0x2901('0x79')](_0x79739c,_0x364e43+'\x0a');Papa['parse'](fs['createReadStream'](_0x2a68ad),{'header':!![],'skipEmptyLines':!![],'step':function(_0x137652,_0x17f991){try{for(var _0x56ceb3=0x0,_0x53239f=[];_0x56ceb3<_0x137652[_0x2901('0x7a')][_0x2901('0x18')];_0x56ceb3++){stats[_0x2901('0x7b')]+=0x1;if(_0x137652[_0x2901('0x57')][_0x56ceb3]){handleError(_0x137652['data'][_0x56ceb3],_0x137652[_0x2901('0x57')][_0x56ceb3]);}else{var _0x37bd7a=[];var _0x319a72=[];var _0x5c5842={};for(var _0x554ffb in _0x6e6854){let _0x4ff4dd=contactItemTypes[_0x2901('0x7c')](_0x5c148f=>_0x5c148f[_0x2901('0x76')]===_0x554ffb);let _0x5e9931=contactItemTypes[_0x2901('0x7c')](_0x5af174=>_0x5af174['name']+_0x2901('0x77')===_0x554ffb);if(_[_0x2901('0x6a')](_0x4ff4dd)&&_[_0x2901('0x6a')](_0x5e9931)){if(_0x6e6854['hasOwnProperty'](_0x554ffb)){if(_0x137652['data'][_0x56ceb3][_0x6e6854[_0x554ffb]]){var _0x29f1e8=_[_0x2901('0x7d')](_0x137652[_0x2901('0x7a')][_0x56ceb3][_0x6e6854[_0x554ffb]][_0x2901('0x7e')](/"/g,'\x27'));switch(_0x554ffb){case _0x2901('0x40'):var _0x445c39=moment(_0x29f1e8,_0x2901('0xc'),!![]);if(_0x445c39[_0x2901('0x7f')]()){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a[_0x2901('0x19')](_0x2901('0x80'));}break;case _0x2901('0x41'):var _0x4b7636=parseInt(_0x29f1e8);_0x29f1e8=_[_0x2901('0x81')](_0x4b7636)||_0x4b7636<0x0||_0x4b7636>0x4?_0x424deb?0x3:0x2:_0x4b7636;_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');break;case _0x2901('0x2f'):var _0x2bff09=parseInt(_0x29f1e8);if(_[_0x2901('0x82')](_0x2bff09)&&_[_0x2901('0x74')](_0x27f9ef,_0x2bff09)){_0x53239f[_0x2901('0x19')]('\x22'+_0x2bff09+'\x22');}else{_0x37bd7a[_0x2901('0x19')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x29f1e8)){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a['push'](_0x2901('0x83'));}break;case _0x2901('0x84'):var _0x4ab137=moment(_0x29f1e8,_0x2901('0x85'),!![]);if(_0x4ab137['isValid']()){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a['push'](_0x2901('0x86'));}break;case _0x2901('0x69'):var _0x405652=shared['timezones'];var _0x516b2f=_0x405652[_0x29f1e8];if(!_[_0x2901('0x6a')](_0x516b2f)){var _0x24ede0=_0x516b2f[_0x2901('0x6b')];_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');_0x53239f['push']('\x22'+_0x24ede0+'\x22');}break;default:_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}}else{switch(_0x554ffb){case _0x2901('0x87'):case _0x2901('0xf'):_0x37bd7a['push'](_0x554ffb+_0x2901('0x88'));break;default:_0x53239f[_0x2901('0x19')]('\x22\x22');}}}}else{var _0x4a7847='';if(!_[_0x2901('0x6a')](_0x4ff4dd)){if(!_0x5c5842['hasOwnProperty'](_0x4ff4dd['id'])){if(!_[_0x2901('0x6a')](_0x137652[_0x2901('0x7a')][_0x56ceb3][_0x6e6854[_0x554ffb]])){var _0x29f1e8=_['trim'](_0x137652['data'][_0x56ceb3][_0x6e6854[_0x554ffb]][_0x2901('0x7e')](/"/g,'\x27'));var _0x1a887a=phoneDescriptions[_0x2901('0x7c')](_0x3239d6=>_0x3239d6['itemTypeId']===_0x4ff4dd['id']);if(!_[_0x2901('0x6a')](_0x1a887a)){var _0x10de5d=_[_0x2901('0x7d')](_0x137652['data'][_0x56ceb3][_0x6e6854[_0x1a887a[_0x2901('0x89')]]][_0x2901('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x10de5d))_0x29f1e8=_0x29f1e8+'§'+_0x10de5d;}if(_0x4a7847=='')_0x4a7847=_0x29f1e8;else _0x4a7847+='|'+_0x29f1e8;}_0x319a72[_0x2901('0x19')](_0x4ff4dd['id']+':'+_0x4a7847);_0x5c5842[_0x4ff4dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53239f['push']('\x22'+_0x319a72['join'](';')+'\x22');}if(_0x37bd7a[_0x2901('0x18')]){handleError(_0x137652[_0x2901('0x7a')][_0x56ceb3],{'code':'SystemRow','message':_0x37bd7a[_0x2901('0x14')]()});}else{fs[_0x2901('0x8a')](_0x79739c,_0x53239f[_0x2901('0x14')]()+'\x0a');}_0x53239f=[];}if(!(stats[_0x2901('0x7b')]%0xc8)){socket[_0x2901('0x8b')](_0x2901('0x8c')+_0x52f985,stats);stats[_0x2901('0x57')]=[];}}if(stopped){logger[_0x2901('0x54')](_0x2901('0x8d'));_0x17f991[_0x2901('0x8e')]();}}catch(_0x6c952a){handleError(_0x137652[_0x2901('0x7a')][_0x56ceb3],{'code':'SystemError','message':_0x6c952a[_0x2901('0x56')]});logger[_0x2901('0x55')](_0x2901('0x8f'),_0x6c952a[_0x2901('0x56')]);}},'complete':function(){try{var _0x4ae550=[];var _0x3b3c5f=[];var _0x17cc5a=_0x2901('0x39');if(_0x26a877[_0x2901('0x90')]&&_0x26a877[_0x2901('0x90')][_0x2901('0x18')]){_0x17cc5a='cm_contacts_'+_0x52f985;_0x4ae550[_0x2901('0x19')](_0x2901('0x91')+_0x17cc5a+_0x2901('0x92'));}tmp_campaigns='campaigns_'+_0x52f985;tmp_voice_queues=_0x2901('0x93')+_0x52f985;_0x3b3c5f['push'](_0x2901('0x91')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x3b3c5f[_0x2901('0x19')](_0x2901('0x91')+tmp_voice_queues+_0x2901('0x94'));BPromise[_0x2901('0x95')](_0x3b3c5f,handleTZQuery)[_0x2901('0x17')](function(_0x554fbd){updateTzCampaigns(_0x26a877[_0x2901('0x2c')])[_0x2901('0x17')](function(_0x5638d7){updateTzVoiceQueues(_0x26a877[_0x2901('0x2c')])[_0x2901('0x17')](function(_0x1cc4b0){if(hasTZ)_0x364e43=_0x364e43[_0x2901('0x7e')](_0x2901('0x69'),_0x2901('0x96'));var _0x59652e=util[_0x2901('0xb')](_0x2901('0x97'),_0x79739c,_0x17cc5a,_0x364e43,_0x26a877[_0x2901('0x2c')],_0x26a877[_0x2901('0x4e')]||null,NOW,NOW);if(_[_0x2901('0x6a')](_0x6e6854[_0x2901('0x40')])){_0x59652e+=_0x2901('0x98');}_0x4ae550['push'](_0x59652e);if(_0x26a877[_0x2901('0x90')]&&_0x26a877[_0x2901('0x90')]['length']){_0x4ae550['push'](insertCmContact(_0x26a877[_0x2901('0x2c')],_0x17cc5a,_0x26a877[_0x2901('0x90')],_0x6e6854));_0x4ae550[_0x2901('0x19')](_0x2901('0x99')+_0x17cc5a+';');}BPromise[_0x2901('0x95')](_0x4ae550,handleQuery)[_0x2901('0x17')](function(_0x19cb05){BPromise['all']([handleAdditionalPhones()])[_0x2901('0x17')](function(){_0x4ae550=[];for(var _0x497a79=0x0;_0x497a79\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x23f1,0x170));var _0x123f=function(_0xe6ba14,_0x3702ef){_0xe6ba14=_0xe6ba14-0x0;var _0x3fb603=_0x23f1[_0xe6ba14];return _0x3fb603;};'use strict';var fs=require('fs');var path=require(_0x123f('0x0'));var _=require(_0x123f('0x1'));var Papa=require('papaparse');var util=require(_0x123f('0x2'));var BPromise=require('bluebird');var moment=require(_0x123f('0x3'));var squel=require(_0x123f('0x4'));var Redis=require(_0x123f('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x123f('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0x123f('0x7'))(_0x123f('0x8'));config['redis']=_[_0x123f('0x9')](config[_0x123f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x123f('0xb'))(new Redis(config[_0x123f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x123f('0xc')](_0x123f('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x123f('0xc')](_0x123f('0xd'));function isEmail(_0x3e24dc){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))*$/[_0x123f('0xe')](_0x3e24dc);}function selectNotIn(_0x375565,_0x2df10d,_0x249768,_0x41e932,_0x44d42d){return squel[_0x123f('0xf')]()[_0x123f('0x10')](_0x123f('0x11'))[_0x123f('0x12')](_0x41e932)['join'](_0x2df10d,null,_0x2df10d+_0x123f('0x13')+_0x41e932+'.'+_0x249768)[_0x123f('0x14')](_0x41e932+'.'+_0x249768+_0x123f('0x15')+_0x375565+'.'+_0x249768)['where'](_0x2df10d+'.dialCheckDuplicateType\x20IN\x20('+_0x44d42d['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3cb8e1,_0x66100e){promisesAdditionalPhones=[];return db[_0x123f('0x16')][_0x123f('0x17')]({'raw':!![],'attributes':['id',_0x123f('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x123f('0x19')](function(_0x12d374){if(_0x12d374!==null){var _0x2ea358=[];for(var _0x1fc59d=0x0;_0x1fc59d<_0x12d374[_0x123f('0x1a')];_0x1fc59d++){var _0x4f8839=_0x12d374[_0x1fc59d];_0x2ea358[_0x123f('0x1b')](insertAdditionalPhones(_0x4f8839));}}Promise[_0x123f('0x1c')](_0x2ea358)['then'](function(){_0x3cb8e1({'val':0x1});});});});}function insertAdditionalPhones(_0x1be5af){return new Promise(function(_0x2dbc2a,_0x5d5a8c){var _0x216cc3=_0x1be5af[_0x123f('0x18')];var _0x2f2701=_0x216cc3[_0x123f('0x1d')](';');var _0x1b4f08=[];orderBy=0x0;for(var _0x49ec69=0x0;_0x49ec69<_0x2f2701[_0x123f('0x1a')];_0x49ec69++){_0x1b4f08[_0x123f('0x1b')](splitAdditionalPhone(_0x1be5af['id'],_0x2f2701[_0x49ec69]));}Promise[_0x123f('0x1c')](_0x1b4f08)[_0x123f('0x19')](function(){_0x2dbc2a({'val':_0x2f2701[_0x123f('0x1a')]});});});}function splitAdditionalPhone(_0x292581,_0x53bf3c){return new Promise(function(_0x3b8041,_0x3b9883){var _0x2a9c7d=_0x53bf3c['split'](':');var _0x1428a0=_0x2a9c7d[0x0];var _0x11192c=_0x2a9c7d[0x1];if(!_[_0x123f('0x1e')](_0x11192c)){var _0x54501f=_0x11192c[_0x123f('0x1d')]('|');var _0x23d456=[];for(var _0x1b29ca=0x0;_0x1b29ca<_0x54501f['length'];_0x1b29ca++){if(_0x54501f[_0x1b29ca]!==''){var _0x2cd600=_['filter'](promisesAdditionalPhones,{'contactId':_0x292581,'phone':_0x54501f[_0x1b29ca]});if(_0x2cd600[_0x123f('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x123f('0x1b')]({'contactId':_0x292581,'contactTypeId':_0x1428a0,'phone':_0x54501f[_0x1b29ca],'orderBy':orderBy});}}}_0x3b8041({'ok':0x1});}else _0x3b8041({'res':0x0});});}function createAdditionalPhone(_0x19d8e4,_0x5c5a12,_0x36f4db,_0x307174){var _0x538442='';var _0x61a47f='';var _0x3b563a=_0x36f4db[_0x123f('0x1d')]('§');_0x538442=_0x3b563a[0x0];if(_0x3b563a[_0x123f('0x1a')]==0x2)_0x61a47f=_0x3b563a[0x1];return new Promise(function(_0x53faff,_0x28b697){return db['CmContactHasItem'][_0x123f('0x1f')]({'where':{'CmContactId':_0x19d8e4,'item':_0x538442}})['then'](function(_0x174c19){if(_0x174c19){return db[_0x123f('0x20')][_0x123f('0x21')]({'ItemTypeId':_0x5c5a12,'description':_0x61a47f,'OrderBy':_0x307174},{'where':{'CmContactId':_0x19d8e4,'item':_0x538442}})[_0x123f('0x19')](function(_0x50fc77){_0x53faff({'res':_0x123f('0x22')});});}else{return db[_0x123f('0x20')]['create']({'CmContactId':_0x19d8e4,'item':_0x538442,'description':_0x61a47f,'ItemTypeId':_0x5c5a12,'OrderBy':_0x307174,'ItemClass':_0x123f('0x23')})[_0x123f('0x19')](function(_0x375dae){_0x53faff({'res':_0x123f('0x24')});});}});});}function insertCmHopper(_0x5c8f80,_0x184aa5,_0x232029,_0x5cc2b4,_0xbc1827){var _0x35e682=[_0x123f('0x25'),_0x123f('0x26'),'cm_contacts.id',_0x123f('0x27'),_0x184aa5+'.'+_0x5cc2b4,_0x123f('0x28'),_0x123f('0x29'),_0x123f('0x2a'),_0x123f('0x2b'),'\x22'+_0xbc1827+'\x22'];return squel[_0x123f('0x2c')]()['into'](_0x123f('0x2d'))[_0x123f('0x2e')]([_0x123f('0x11'),_0x123f('0x2f'),_0x123f('0x30'),_0x123f('0x31'),_0x5cc2b4,_0x123f('0x32'),_0x123f('0x33'),_0x123f('0x34'),_0x123f('0x35'),_0x123f('0x36')],squel['select']()['fields'](_0x35e682)['from'](_0x184aa5)['join'](_0x123f('0x37'),null,_0x123f('0x38')+_0x184aa5+_0x123f('0x39'))[_0x123f('0x3a')](_0x232029,null,_0x232029+_0x123f('0x13')+_0x184aa5+'.'+_0x5cc2b4)[_0x123f('0x14')](_0x184aa5+_0x123f('0x3b'),_0x5c8f80)[_0x123f('0x14')](_0x123f('0x3c'),NOW)[_0x123f('0x14')](_0x123f('0x3d'),selectNotIn(_0x184aa5,_0x232029,_0x5cc2b4,_0x123f('0x2d'),[_0x123f('0x3e'),_0x123f('0x3f')]))[_0x123f('0x14')](_0x123f('0x3d'),selectNotIn(_0x184aa5,_0x232029,_0x5cc2b4,_0x123f('0x2d'),[_0x123f('0x3e')])))['toString']();}function insertCmHopperBlack(_0xa514d4,_0x5b3332,_0x3fdf33,_0x12b56c){var _0x264423=[_0x123f('0x25'),_0x123f('0x40'),_0x123f('0x27'),_0x5b3332+'.'+_0x12b56c,'cm_contacts.createdAt',_0x123f('0x29')];return squel['insert']()['into'](_0x123f('0x41'))[_0x123f('0x2e')](['phone','ContactId',_0x123f('0x31'),_0x12b56c,'createdAt','updatedAt'],squel['select']()[_0x123f('0x42')](_0x264423)[_0x123f('0x12')](_0x5b3332)[_0x123f('0x3a')](_0x123f('0x37'),null,_0x123f('0x38')+_0x5b3332+'.CmListId')[_0x123f('0x3a')](_0x3fdf33,null,_0x3fdf33+_0x123f('0x13')+_0x5b3332+'.'+_0x12b56c)[_0x123f('0x14')](_0x5b3332+_0x123f('0x3b'),_0xa514d4)[_0x123f('0x14')](_0x123f('0x3c'),NOW)[_0x123f('0x14')](_0x123f('0x3d'),squel[_0x123f('0xf')]()[_0x123f('0x10')](_0x123f('0x11'))[_0x123f('0x12')](_0x123f('0x41'))[_0x123f('0x14')](_0x123f('0x43'),_0xa514d4)[_0x123f('0x14')](_0x12b56c+'\x20=\x20'+_0x5b3332+'.'+_0x12b56c)))['toString']();}function insertTzCmHopper(_0x36c3a2,_0x24f38f,_0x2b7bd3,_0x489e0e,_0x22efdf,_0xf68eb0){var _0x278352=[_0x123f('0x25'),_0x123f('0x44')+_0xf68eb0+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId',_0x24f38f+'.'+_0x489e0e,_0x123f('0x28'),_0x123f('0x29'),_0x123f('0x2a'),_0x123f('0x2b'),'\x22'+_0x22efdf+'\x22'];var _0x505db3=squel[_0x123f('0x2c')]()[_0x123f('0x45')]('cm_hopper')[_0x123f('0x2e')]([_0x123f('0x11'),_0x123f('0x2f'),_0x123f('0x30'),_0x123f('0x31'),_0x489e0e,'createdAt','updatedAt',_0x123f('0x34'),_0x123f('0x35'),'recallme'],squel[_0x123f('0xf')]()[_0x123f('0x42')](_0x278352)[_0x123f('0x12')](_0x24f38f)[_0x123f('0x3a')](_0x123f('0x37'),null,_0x123f('0x38')+_0x24f38f+_0x123f('0x39'))[_0x123f('0x3a')](_0x2b7bd3,null,_0x2b7bd3+_0x123f('0x13')+_0x24f38f+'.'+_0x489e0e)[_0x123f('0x3a')](_0xf68eb0,null,_0xf68eb0+'.id\x20=\x20'+_0x24f38f+'.'+_0x489e0e)[_0x123f('0x14')](_0x24f38f+_0x123f('0x3b'),_0x36c3a2)[_0x123f('0x14')](_0x123f('0x3c'),NOW)[_0x123f('0x14')](_0x123f('0x3d'),selectNotIn(_0x24f38f,_0x2b7bd3,_0x489e0e,_0x123f('0x2d'),[_0x123f('0x3e'),_0x123f('0x3f')]))['where'](_0x123f('0x3d'),selectNotIn(_0x24f38f,_0x2b7bd3,_0x489e0e,'cm_hopper',[_0x123f('0x3e')])))['toString']();return _0x505db3;}function insertTzCmHopperBlack(_0x28e823,_0xb67afa,_0x3e5ef6,_0x45e7f1){var _0x2dfdb6=[_0x123f('0x25'),_0x123f('0x40'),_0x123f('0x27'),_0xb67afa+'.'+_0x45e7f1,_0x123f('0x28'),_0x123f('0x29')];return squel[_0x123f('0x2c')]()[_0x123f('0x45')](_0x123f('0x41'))[_0x123f('0x2e')]([_0x123f('0x11'),_0x123f('0x30'),'ListId',_0x45e7f1,_0x123f('0x32'),'updatedAt'],squel[_0x123f('0xf')]()[_0x123f('0x42')](_0x2dfdb6)[_0x123f('0x12')](_0xb67afa)[_0x123f('0x3a')](_0x123f('0x37'),null,_0x123f('0x38')+_0xb67afa+_0x123f('0x39'))[_0x123f('0x3a')](_0x3e5ef6,null,_0x3e5ef6+'.id\x20=\x20'+_0xb67afa+'.'+_0x45e7f1)[_0x123f('0x14')](_0xb67afa+_0x123f('0x3b'),_0x28e823)[_0x123f('0x14')](_0x123f('0x3c'),NOW)[_0x123f('0x14')](_0x123f('0x3d'),squel[_0x123f('0xf')]()[_0x123f('0x10')]('phone')['from'](_0x123f('0x41'))[_0x123f('0x14')](_0x123f('0x43'),_0x28e823)['where'](_0x45e7f1+'\x20=\x20'+_0xb67afa+'.'+_0x45e7f1)))['toString']();}function insertCmHopperAdditionalPhones(_0x5b596e){var _0x11f22e=[_0x123f('0x46'),_0x123f('0x47'),_0x123f('0x48'),_0x123f('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x123f('0x2c')]()[_0x123f('0x45')](_0x123f('0x4a'))['fromQuery']([_0x123f('0x4b'),_0x123f('0x11'),_0x123f('0x4c'),_0x123f('0x32'),_0x123f('0x33')],squel[_0x123f('0xf')]()['fields'](_0x11f22e)[_0x123f('0x12')](_0x123f('0x2d'))[_0x123f('0x3a')](_0x123f('0x37'),null,_0x123f('0x4d'))[_0x123f('0x3a')](_0x123f('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x123f('0x14')](_0x123f('0x4f'),_0x5b596e)[_0x123f('0x14')](_0x123f('0x3c'),NOW))[_0x123f('0x50')]();}function insertCmContact(_0x4d445f,_0x1e1141,_0x3dbea2,_0x413243){var _0x3caf69=_[_0x123f('0x51')](_[_0x123f('0x52')](_0x413243),['ListId','CompanyId',_0x123f('0x32'),_0x123f('0x33'),_0x123f('0x53')]);return squel['insert']()[_0x123f('0x45')](_0x123f('0x37'))[_0x123f('0x2e')](_0x3caf69,squel[_0x123f('0xf')]()[_0x123f('0x42')](_0x3caf69)[_0x123f('0x12')](_0x1e1141)[_0x123f('0x14')]('('+_0x3dbea2[_0x123f('0x3a')](',')+_0x123f('0x54'),squel['select']()[_0x123f('0x42')](_0x3dbea2)[_0x123f('0x12')](_0x123f('0x37'))['where'](_0x123f('0x43'),_0x4d445f)['where'](_0x123f('0x55')))['where']('id\x20IN\x20?',squel[_0x123f('0xf')]()['field']('MIN(id)',_0x123f('0x56'))['from'](_0x1e1141)[_0x123f('0x57')](_0x3dbea2[_0x123f('0x3a')](','))))[_0x123f('0x50')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x281db0){logger[_0x123f('0x58')](_0x281db0[_0x123f('0x59')]);process[_0x123f('0x5a')](0x1);}function handleError(_0xc2be92,_0x50bc36){stats[_0x123f('0x5b')]['push']({'name':_0x50bc36[_0x123f('0x5c')],'message':_0x50bc36[_0x123f('0x59')],'row':_0xc2be92});}function handleQuery(_0x53eea4){logger[_0x123f('0x5d')](_0x53eea4);return db['sequelize']['query'](_0x53eea4)[_0x123f('0x5e')](function(_0x6e7899){results[_0x123f('0x1b')](_0x6e7899);})[_0x123f('0x5f')](function(_0x540335){logger['error'](_0x540335[_0x123f('0x59')]);});}function updateTzCampaigns(_0x2d0a9a){return new Promise(function(_0x24628e,_0x40c431){var _0x15ba15=squel[_0x123f('0xf')]()[_0x123f('0x42')]([_0x123f('0x60'),_0x123f('0x61')])['from'](_0x123f('0x62'))['join'](_0x123f('0x63'),null,_0x123f('0x64'))['where']('campaigns_has_cm_lists.CmListId='+_0x2d0a9a);db[_0x123f('0x65')][_0x123f('0x66')](_0x15ba15[_0x123f('0x50')]())['spread'](function(_0x1a022c){var _0x29f225=[];for(var _0x35e754=0x0;_0x35e754<_0x1a022c[_0x123f('0x1a')];_0x35e754++){_0x29f225['push'](getTimezoneData(_0x1a022c[_0x35e754],tmp_campaigns));}BPromise[_0x123f('0x1c')](_0x29f225)[_0x123f('0x19')](function(){_0x24628e({'val':0x1});});})[_0x123f('0x5f')](function(_0x441ae9){logger[_0x123f('0x58')](_0x441ae9[_0x123f('0x59')]);_0x24628e({'val':0x0});});});}function updateTzVoiceQueues(_0x3a9540){return new Promise(function(_0x5d9f3e,_0x2de300){var _0x13670f=squel[_0x123f('0xf')]()[_0x123f('0x42')]([_0x123f('0x67'),_0x123f('0x68')])[_0x123f('0x12')]('voice_queues')['join'](_0x123f('0x69'),null,_0x123f('0x6a'))[_0x123f('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x3a9540);db[_0x123f('0x65')][_0x123f('0x66')](_0x13670f[_0x123f('0x50')]())[_0x123f('0x5e')](function(_0x4a6f0d){var _0x5b2db1=[];for(var _0x463207=0x0;_0x463207<_0x4a6f0d[_0x123f('0x1a')];_0x463207++){_0x5b2db1['push'](getTimezoneData(_0x4a6f0d[_0x463207],tmp_voice_queues));}BPromise[_0x123f('0x1c')](_0x5b2db1)[_0x123f('0x19')](function(){_0x5d9f3e({'val':0x1});});})[_0x123f('0x5f')](function(_0x30d2a){logger[_0x123f('0x58')](_0x30d2a[_0x123f('0x59')]);_0x5d9f3e({'val':0x0});});});}function getTimezoneData(_0x3af5f6,_0x21a674){return new Promise(function(_0x68568,_0x11fcc5){var _0x3813f1=shared[_0x123f('0x6b')];var _0x31ed7e=_0x3813f1[_0x3af5f6['dialTimezone']];if(_[_0x123f('0x1e')](_0x31ed7e)){_0x68568({'ret':0x1});}else{var _0x53bae6=_0x31ed7e[_0x123f('0x6c')];var _0x252689=squel[_0x123f('0x2c')]()[_0x123f('0x45')](_0x21a674)[_0x123f('0x6d')]('id',_0x3af5f6['id'])[_0x123f('0x6d')](_0x123f('0x6e'),_0x53bae6)['set']('dialTimezone',_0x3af5f6[_0x123f('0x6f')])[_0x123f('0x50')]();return db[_0x123f('0x65')][_0x123f('0x66')](_0x252689)[_0x123f('0x5e')](function(_0x595182){_0x68568({'ret':0x1});})[_0x123f('0x5f')](function(_0x19ae36){logger[_0x123f('0x58')](_0x19ae36[_0x123f('0x59')]);_0x11fcc5({'ret':0x1});});}});}function handleTZQuery(_0x144ce8){logger[_0x123f('0x5d')](_0x144ce8);return db[_0x123f('0x65')]['query'](_0x144ce8)[_0x123f('0x5e')](function(_0x52bf78){})[_0x123f('0x5f')](function(_0x148cc4){logger['error'](_0x148cc4[_0x123f('0x59')]);});}function main(_0x560c51,_0x32a5b2,_0xec871b,_0x58d6dc){logger[_0x123f('0x5d')](_0x123f('0x70'),_0x560c51,JSON[_0x123f('0x71')](_0x32a5b2));process[_0x123f('0x72')](_0x123f('0x73'));var _0x3eba14=_0x32a5b2[_0x123f('0x74')];var _0x948051=_[_0x123f('0x75')](_0x3eba14);var _0x395029=_0x32a5b2['socket_timestamp'];var _0x2800b4=path['join'](config[_0x123f('0x76')],'server/files/tmp',_0x395029+'.csv');hasTZ=_['keys'](_0x3eba14)[_0x123f('0x77')](_0x123f('0x6f'));var _0x29dae4=_[_0x123f('0x52')](_0x3eba14)[_0x123f('0x3a')]();logger[_0x123f('0x5d')]('header',_0x29dae4);db[_0x123f('0x78')][_0x123f('0x17')]({'raw':!![],'attributes':['id','name']})[_0x123f('0x19')](function(_0x59d1bf){for(var _0x447415=0x0;_0x447415<_0x59d1bf[_0x123f('0x1a')];_0x447415++){if(_0x59d1bf[_0x447415]['name']in _0x3eba14){contactItemTypes[_0x123f('0x1b')](_0x59d1bf[_0x447415]);delete _0x948051[_0x59d1bf[_0x447415]['name']];hasAdditionalPhones=!![];}for(var _0x2e9bbf in _0x3eba14){if(_0x59d1bf[_0x447415][_0x123f('0x79')]+_0x123f('0x7a')===_0x2e9bbf){phoneDescriptions[_0x123f('0x1b')]({'itemTypeId':_0x59d1bf[_0x447415]['id'],'description':_0x2e9bbf});delete _0x948051[_0x2e9bbf];}}}if(hasAdditionalPhones)_0x948051[_0x123f('0x18')]='';var _0x3a7c77=_[_0x123f('0x52')](_0x948051)[_0x123f('0x3a')]();logger[_0x123f('0x5d')](_0x123f('0x7b'),_0x3a7c77);fs[_0x123f('0x7c')](_0x2800b4,_0x3a7c77+'\x0a');Papa[_0x123f('0x7d')](fs[_0x123f('0x7e')](_0x560c51),{'header':!![],'skipEmptyLines':!![],'step':function(_0xbc96c7,_0x9e59f7){try{for(var _0x45cbd3=0x0,_0x42f650=[];_0x45cbd3<_0xbc96c7[_0x123f('0x7f')]['length'];_0x45cbd3++){stats['rows']+=0x1;if(_0xbc96c7[_0x123f('0x5b')][_0x45cbd3]){handleError(_0xbc96c7[_0x123f('0x7f')][_0x45cbd3],_0xbc96c7[_0x123f('0x5b')][_0x45cbd3]);}else{var _0x47a1f0=[];var _0x3e0ee7=[];var _0x347a06={};for(var _0x230241 in _0x3eba14){let _0xe10e16=contactItemTypes['find'](_0x551495=>_0x551495[_0x123f('0x79')]===_0x230241);let _0x4687f5=contactItemTypes['find'](_0xc029c8=>_0xc029c8[_0x123f('0x79')]+_0x123f('0x7a')===_0x230241);if(_[_0x123f('0x1e')](_0xe10e16)&&_[_0x123f('0x1e')](_0x4687f5)){if(_0x3eba14[_0x123f('0x80')](_0x230241)){if(_0xbc96c7['data'][_0x45cbd3][_0x3eba14[_0x230241]]){var _0x92238a=_[_0x123f('0x81')](_0xbc96c7[_0x123f('0x7f')][_0x45cbd3][_0x3eba14[_0x230241]][_0x123f('0x82')](/"/g,'\x27'));switch(_0x230241){case _0x123f('0x2f'):var _0x310605=moment(_0x92238a,_0x123f('0xd'),!![]);if(_0x310605[_0x123f('0x83')]()){_0x42f650[_0x123f('0x1b')]('\x22'+_0x92238a+'\x22');}else{_0x47a1f0[_0x123f('0x1b')](_0x123f('0x84'));}break;case _0x123f('0x34'):var _0x18a4f9=parseInt(_0x92238a);_0x92238a=_[_0x123f('0x85')](_0x18a4f9)||_0x18a4f9<0x0||_0x18a4f9>0x4?_0x58d6dc?0x3:0x2:_0x18a4f9;_0x42f650[_0x123f('0x1b')]('\x22'+_0x92238a+'\x22');break;case'UserId':var _0x513681=parseInt(_0x92238a);if(_[_0x123f('0x86')](_0x513681)&&_[_0x123f('0x77')](_0xec871b,_0x513681)){_0x42f650[_0x123f('0x1b')]('\x22'+_0x513681+'\x22');}else{_0x47a1f0[_0x123f('0x1b')](_0x123f('0x87'));}break;case _0x123f('0x88'):if(isEmail(_0x92238a)){_0x42f650[_0x123f('0x1b')]('\x22'+_0x92238a+'\x22');}else{_0x47a1f0[_0x123f('0x1b')](_0x123f('0x89'));}break;case _0x123f('0x8a'):var _0x407013=moment(_0x92238a,_0x123f('0x8b'),!![]);if(_0x407013[_0x123f('0x83')]()){_0x42f650[_0x123f('0x1b')]('\x22'+_0x92238a+'\x22');}else{_0x47a1f0[_0x123f('0x1b')](_0x123f('0x8c'));}break;case'dialTimezone':var _0x59467b=shared[_0x123f('0x6b')];var _0x53de2f=_0x59467b[_0x92238a];if(!_['isNil'](_0x53de2f)){var _0x13aebf=_0x53de2f[_0x123f('0x6c')];_0x42f650[_0x123f('0x1b')]('\x22'+_0x92238a+'\x22');_0x42f650[_0x123f('0x1b')]('\x22'+_0x13aebf+'\x22');}break;default:_0x42f650['push']('\x22'+_0x92238a+'\x22');}}else{switch(_0x230241){case _0x123f('0x8d'):case _0x123f('0x11'):_0x47a1f0[_0x123f('0x1b')](_0x230241+'\x20not\x20specified');break;default:_0x42f650[_0x123f('0x1b')]('\x22\x22');}}}}else{var _0x36bd7a='';if(!_[_0x123f('0x1e')](_0xe10e16)){if(!_0x347a06[_0x123f('0x80')](_0xe10e16['id'])){if(!_['isNil'](_0xbc96c7[_0x123f('0x7f')][_0x45cbd3][_0x3eba14[_0x230241]])){var _0x92238a=_[_0x123f('0x81')](_0xbc96c7[_0x123f('0x7f')][_0x45cbd3][_0x3eba14[_0x230241]][_0x123f('0x82')](/"/g,'\x27'));var _0x2f2cc0=phoneDescriptions[_0x123f('0x8e')](_0x859a5d=>_0x859a5d[_0x123f('0x8f')]===_0xe10e16['id']);if(!_['isNil'](_0x2f2cc0)){var _0x320924=_[_0x123f('0x81')](_0xbc96c7[_0x123f('0x7f')][_0x45cbd3][_0x3eba14[_0x2f2cc0[_0x123f('0x90')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x320924))_0x92238a=_0x92238a+'§'+_0x320924;}if(_0x36bd7a=='')_0x36bd7a=_0x92238a;else _0x36bd7a+='|'+_0x92238a;}_0x3e0ee7[_0x123f('0x1b')](_0xe10e16['id']+':'+_0x36bd7a);_0x347a06[_0xe10e16['id']]=0x1;}}}}if(hasAdditionalPhones){_0x42f650[_0x123f('0x1b')]('\x22'+_0x3e0ee7[_0x123f('0x3a')](';')+'\x22');}if(_0x47a1f0[_0x123f('0x1a')]){handleError(_0xbc96c7[_0x123f('0x7f')][_0x45cbd3],{'code':_0x123f('0x91'),'message':_0x47a1f0[_0x123f('0x3a')]()});}else{fs[_0x123f('0x92')](_0x2800b4,_0x42f650['join']()+'\x0a');}_0x42f650=[];}if(!(stats[_0x123f('0x93')]%0xc8)){socket[_0x123f('0x94')](_0x123f('0x95')+_0x395029,stats);stats[_0x123f('0x5b')]=[];}}if(stopped){logger[_0x123f('0x5d')]('Abort\x20parser');_0x9e59f7[_0x123f('0x96')]();}}catch(_0x33e590){handleError(_0xbc96c7[_0x123f('0x7f')][_0x45cbd3],{'code':_0x123f('0x97'),'message':_0x33e590[_0x123f('0x59')]});logger[_0x123f('0x58')](_0x123f('0x98'),_0x33e590[_0x123f('0x59')]);}},'complete':function(){try{var _0x1d92ee=[];var _0x8e2170=[];var _0x8982e5='cm_contacts';if(_0x32a5b2[_0x123f('0x99')]&&_0x32a5b2[_0x123f('0x99')][_0x123f('0x1a')]){_0x8982e5='cm_contacts_'+_0x395029;_0x1d92ee[_0x123f('0x1b')](_0x123f('0x9a')+_0x8982e5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x123f('0x9b')+_0x395029;tmp_voice_queues=_0x123f('0x9c')+_0x395029;_0x8e2170[_0x123f('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x123f('0x9d'));_0x8e2170[_0x123f('0x1b')](_0x123f('0x9a')+tmp_voice_queues+_0x123f('0x9d'));BPromise[_0x123f('0x9e')](_0x8e2170,handleTZQuery)[_0x123f('0x19')](function(_0x2ac247){updateTzCampaigns(_0x32a5b2[_0x123f('0x31')])[_0x123f('0x19')](function(_0x3ff4dd){updateTzVoiceQueues(_0x32a5b2[_0x123f('0x31')])[_0x123f('0x19')](function(_0xac9fef){if(hasTZ)_0x3a7c77=_0x3a7c77[_0x123f('0x82')](_0x123f('0x6f'),_0x123f('0x9f'));var _0x2416e1=util[_0x123f('0xc')](_0x123f('0xa0'),_0x2800b4,_0x8982e5,_0x3a7c77,_0x32a5b2[_0x123f('0x31')],_0x32a5b2[_0x123f('0xa1')]||null,NOW,NOW);if(_[_0x123f('0x1e')](_0x3eba14['scheduledat'])){_0x2416e1+=',\x20scheduledAt\x20=\x20NOW()';}_0x1d92ee[_0x123f('0x1b')](_0x2416e1);if(_0x32a5b2[_0x123f('0x99')]&&_0x32a5b2[_0x123f('0x99')][_0x123f('0x1a')]){_0x1d92ee['push'](insertCmContact(_0x32a5b2[_0x123f('0x31')],_0x8982e5,_0x32a5b2[_0x123f('0x99')],_0x3eba14));_0x1d92ee[_0x123f('0x1b')]('DROP\x20TABLE\x20'+_0x8982e5+';');}BPromise[_0x123f('0x9e')](_0x1d92ee,handleQuery)[_0x123f('0x19')](function(_0xb8be54){BPromise[_0x123f('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x1d92ee=[];for(var _0x454222=0x0;_0x454222\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','redis','defaults'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x3fce,0x121));var _0xe3fc=function(_0x2a99e2,_0x1803e4){_0x2a99e2=_0x2a99e2-0x0;var _0x23fb5f=_0x3fce[_0x2a99e2];return _0x23fb5f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xe3fc('0x0'));var Papa=require(_0xe3fc('0x1'));var util=require(_0xe3fc('0x2'));var BPromise=require(_0xe3fc('0x3'));var moment=require(_0xe3fc('0x4'));var squel=require(_0xe3fc('0x5'));var Redis=require(_0xe3fc('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0xe3fc('0x7')]=_[_0xe3fc('0x8')](config['redis'],{'host':_0xe3fc('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3fc('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xe3fc('0xa'));var tempTableName=_0xe3fc('0xb')+moment()[_0xe3fc('0xc')](_0xe3fc('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x182656){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x182656);}function selectNotIn(_0x52b9ee,_0x339045,_0x37514d,_0x2c66e1,_0x5aeab2){return squel[_0xe3fc('0xe')]()[_0xe3fc('0xf')](_0xe3fc('0x10'))[_0xe3fc('0x11')](_0x2c66e1)[_0xe3fc('0x12')](_0x339045,null,_0x339045+_0xe3fc('0x13')+_0x2c66e1+'.'+_0x37514d)[_0xe3fc('0x14')](_0x2c66e1+'.'+_0x37514d+'\x20=\x20'+_0x52b9ee+'.'+_0x37514d)[_0xe3fc('0x14')](_0x339045+_0xe3fc('0x15')+_0x5aeab2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3f7ae2,_0x3d437f){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe3fc('0x16')](_0xe3fc('0x17')+tempTableName)['spread'](function(_0x4fa4d4){if(_0x4fa4d4!==null){var _0x5953ac=[];for(var _0x27b618=0x0;_0x27b618<_0x4fa4d4[_0xe3fc('0x18')];_0x27b618++){var _0x2f8cc9=_0x4fa4d4[_0x27b618];if(!_['isNil'](_0x2f8cc9['phone'])){if(!_[_0xe3fc('0x19')](_0x2f8cc9['AdditionalPhones']))_0x5953ac[_0xe3fc('0x1a')](insertAdditionalPhones(_0x2f8cc9));promisesContact[_0xe3fc('0x1a')]({'contact':_0x2f8cc9});}}}Promise[_0xe3fc('0x1b')](_0x5953ac)['then'](function(){_0x3f7ae2({'val':0x1});});})['catch'](function(_0x42140f){logger[_0xe3fc('0x1c')](_0x42140f[_0xe3fc('0x1d')]);});});}function insertAdditionalPhones(_0x5e74ab){return new Promise(function(_0x4472f7,_0xfac19f){var _0x498bd3=_0x5e74ab[_0xe3fc('0x1e')];if(_[_0xe3fc('0x19')](_0x498bd3))_0xfac19f({'val':0x0});else{var _0x55bc5a=_0x498bd3[_0xe3fc('0x1f')](';');var _0x457cef=[];orderBy=0x0;for(var _0x1e307a=0x0;_0x1e307a<_0x55bc5a['length'];_0x1e307a++){_0x457cef['push'](splitAdditionalPhone(_0x5e74ab['id'],_0x55bc5a[_0x1e307a]));}Promise[_0xe3fc('0x1b')](_0x457cef)[_0xe3fc('0x20')](function(){_0x4472f7({'val':_0x55bc5a['length']});});}});}function splitAdditionalPhone(_0x383f19,_0x2e9322){return new Promise(function(_0x3a8071,_0x177a14){var _0x47b2d6=_0x2e9322[_0xe3fc('0x1f')](':');var _0x54e294=_0x47b2d6[0x0];var _0x507656=_0x47b2d6[0x1];if(_0x507656!==''){var _0x5abdb3=_0x507656['split']('|');var _0x51dc35=[];for(var _0x16045e=0x0;_0x16045e<_0x5abdb3[_0xe3fc('0x18')];_0x16045e++){if(_0x5abdb3[_0x16045e]!==''){var _0x5d1cc3=_[_0xe3fc('0x21')](promisesAdditionalPhones,{'contactId':_0x383f19,'phone':_0x5abdb3[_0x16045e]});if(_0x5d1cc3[_0xe3fc('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x383f19,'contactTypeId':_0x54e294,'phone':_0x5abdb3[_0x16045e],'orderBy':orderBy});}}}_0x3a8071({'ok':0x1});}else _0x3a8071({'res':0x0});});}function createAdditionalPhone(_0x46f549,_0xc40376,_0x1ecb86,_0x3bc101){var _0x3d173e='';var _0x21ccdd='';var _0x396685=_0x1ecb86[_0xe3fc('0x1f')]('§');_0x3d173e=_0x396685[0x0];if(_0x396685[_0xe3fc('0x18')]==0x2)_0x21ccdd=_0x396685[0x1];return new Promise(function(_0xbb0f17,_0x30a897){return db[_0xe3fc('0x22')][_0xe3fc('0x23')]({'where':{'CmContactId':_0x46f549,'item':_0x3d173e}})[_0xe3fc('0x20')](function(_0x38ab54){if(_0x38ab54){return db[_0xe3fc('0x22')]['update']({'ItemTypeId':_0xc40376,'description':_0x21ccdd,'OrderBy':_0x3bc101},{'where':{'CmContactId':_0x46f549,'item':_0x3d173e}})[_0xe3fc('0x20')](function(_0x2f910e){_0xbb0f17({'res':_0xe3fc('0x24')});});}else{return db['CmContactHasItem'][_0xe3fc('0x25')]({'CmContactId':_0x46f549,'item':_0x3d173e,'ItemTypeId':_0xc40376,'description':_0x21ccdd,'OrderBy':_0x3bc101,'ItemClass':_0xe3fc('0x26')})[_0xe3fc('0x20')](function(_0x4a6202){_0xbb0f17({'res':_0xe3fc('0x27')});});}});});}function updateContact(_0x30c178){return new Promise(function(_0x41927b,_0x20ac90){var _0x3ebd5d=_0x30c178['id'];delete _0x30c178['id'];return db[_0xe3fc('0x28')]['update'](_0x30c178,{'where':{'id':_0x3ebd5d}})[_0xe3fc('0x20')](function(_0x3bb70d){updatedRows+=0x1;return db[_0xe3fc('0x29')][_0xe3fc('0x2a')]({'phone':_0x30c178[_0xe3fc('0x10')]},{'where':{'ContactId':_0x3ebd5d}})[_0xe3fc('0x20')](function(_0x411086){_0x41927b({'ret':'OK'});});});});}function insertCmHopper(_0x888634,_0x260cd3,_0x11c271,_0x794f2,_0x25edfd){var _0x24dae1=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0xe3fc('0x2b'),_0x260cd3+'.'+_0x794f2,_0xe3fc('0x2c'),_0xe3fc('0x2d'),_0xe3fc('0x2e'),_0xe3fc('0x2f'),'\x22'+_0x25edfd+'\x22'];return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x32'))['fromQuery']([_0xe3fc('0x10'),_0xe3fc('0x33'),'ContactId',_0xe3fc('0x34'),_0x794f2,_0xe3fc('0x35'),_0xe3fc('0x36'),_0xe3fc('0x37'),_0xe3fc('0x38'),'recallme'],squel[_0xe3fc('0xe')]()['fields'](_0x24dae1)['from'](_0x260cd3)[_0xe3fc('0x12')](_0xe3fc('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x260cd3+_0xe3fc('0x3a'))[_0xe3fc('0x12')](_0x11c271,null,_0x11c271+_0xe3fc('0x13')+_0x260cd3+'.'+_0x794f2)[_0xe3fc('0x14')](_0x260cd3+_0xe3fc('0x3b'),_0x888634)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3fc('0x14')](_0xe3fc('0x3c'),selectNotIn(_0x260cd3,_0x11c271,_0x794f2,_0xe3fc('0x32'),[_0xe3fc('0x3d'),_0xe3fc('0x3e')]))['where'](_0xe3fc('0x3c'),selectNotIn(_0x260cd3,_0x11c271,_0x794f2,_0xe3fc('0x32'),[_0xe3fc('0x3d')])))['toString']();}function insertCmHopperBlack(_0x4506e5,_0x5c7518,_0x38aed5,_0x3bf7da){var _0x428116=[_0xe3fc('0x3f'),_0xe3fc('0x40'),'cm_contacts.ListId',_0x5c7518+'.'+_0x3bf7da,_0xe3fc('0x2c'),_0xe3fc('0x2d')];return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x41'))['fromQuery']([_0xe3fc('0x10'),'ContactId','ListId',_0x3bf7da,'createdAt',_0xe3fc('0x36')],squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x428116)[_0xe3fc('0x11')](_0x5c7518)[_0xe3fc('0x12')](_0xe3fc('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x5c7518+_0xe3fc('0x3a'))['join'](_0x38aed5,null,_0x38aed5+_0xe3fc('0x13')+_0x5c7518+'.'+_0x3bf7da)[_0xe3fc('0x14')](_0x5c7518+_0xe3fc('0x3b'),_0x4506e5)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3fc('0x14')](_0xe3fc('0x3c'),squel[_0xe3fc('0xe')]()[_0xe3fc('0xf')](_0xe3fc('0x10'))[_0xe3fc('0x11')]('cm_hopper_black')['where'](_0xe3fc('0x43'),_0x4506e5)[_0xe3fc('0x14')](_0x3bf7da+_0xe3fc('0x44'),_0x5c7518+'.'+_0x3bf7da)))[_0xe3fc('0x45')]();}function insertCmHopperAdditionalPhones(_0x2910aa){var _0x3a14cc=['cm_hopper.id',_0xe3fc('0x46'),'cm_contact_has_items.OrderBy',_0xe3fc('0x47'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xe3fc('0x48'))[_0xe3fc('0x49')](['CmHopperId',_0xe3fc('0x10'),'OrderBy',_0xe3fc('0x35'),_0xe3fc('0x36')],squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x3a14cc)[_0xe3fc('0x11')](_0xe3fc('0x32'))['join']('cm_contacts',null,_0xe3fc('0x4a'))[_0xe3fc('0x12')](_0xe3fc('0x4b'),null,_0xe3fc('0x4c'))[_0xe3fc('0x14')](_0xe3fc('0x4d'),_0x2910aa)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xe3fc('0x45')]();}function insertCmContact(_0x7f7d82,_0x4454a0,_0x270a78,_0x5bcd1c){var _0x51faad=_['concat'](_[_0xe3fc('0x4e')](_0x5bcd1c),[_0xe3fc('0x34'),_0xe3fc('0x4f'),_0xe3fc('0x35'),_0xe3fc('0x36')]);return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x39'))[_0xe3fc('0x49')](_0x51faad,squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x51faad)[_0xe3fc('0x11')](_0x4454a0)[_0xe3fc('0x14')]('('+_0x270a78['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xe3fc('0x42')](_0x270a78)[_0xe3fc('0x11')](_0xe3fc('0x39'))['where']('ListId\x20=\x20?',_0x7f7d82))[_0xe3fc('0x14')](_0xe3fc('0x50'),squel[_0xe3fc('0xe')]()['field']('MIN(id)','min_id')[_0xe3fc('0x11')](_0x4454a0)['group'](_0x270a78['join'](','))))[_0xe3fc('0x45')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5ed9be){logger[_0xe3fc('0x1c')](_0x5ed9be[_0xe3fc('0x1d')]);process[_0xe3fc('0x51')](0x1);}function handleError(_0x2303df,_0x1bec32){stats['errors'][_0xe3fc('0x1a')]({'name':_0x1bec32[_0xe3fc('0x52')],'message':_0x1bec32['message'],'row':_0x2303df});}function handleQuery(_0x2a95e1){logger[_0xe3fc('0x53')](_0x2a95e1);return db[_0xe3fc('0x54')][_0xe3fc('0x16')](_0x2a95e1)[_0xe3fc('0x55')](function(_0x8661ce){results[_0xe3fc('0x1a')](_0x8661ce);})[_0xe3fc('0x56')](function(_0x3dbf21){logger[_0xe3fc('0x1c')](_0x3dbf21[_0xe3fc('0x1d')]);});}function main(_0xd08412,_0x27fa3a,_0x25f7bb,_0x10d3b6){logger[_0xe3fc('0x53')](_0xe3fc('0x57'),_0xd08412,JSON[_0xe3fc('0x58')](_0x27fa3a));process[_0xe3fc('0x59')]('start');var _0x2541a1=_0x27fa3a[_0xe3fc('0x5a')];var _0x3ae3bd=_['clone'](_0x2541a1);var _0x137d5e=_0x27fa3a['socket_timestamp'];var _0xb09348=path['join'](config['root'],_0xe3fc('0x5b'),_0x137d5e+_0xe3fc('0x5c'));logger[_0xe3fc('0x53')](_0xe3fc('0x5d'),_0x27fa3a);db['ContactItemType'][_0xe3fc('0x5e')]({'raw':!![],'attributes':['id',_0xe3fc('0x5f')]})[_0xe3fc('0x20')](function(_0x434c54){for(var _0x2c299d=0x0;_0x2c299d<_0x434c54[_0xe3fc('0x18')];_0x2c299d++){if(_0x434c54[_0x2c299d][_0xe3fc('0x5f')]in _0x2541a1){contactItemTypes['push'](_0x434c54[_0x2c299d]);delete _0x3ae3bd[_0x434c54[_0x2c299d][_0xe3fc('0x5f')]];hasAdditionalPhones=!![];}for(var _0x4f8ab3 in _0x2541a1){if(_0x434c54[_0x2c299d][_0xe3fc('0x5f')]+_0xe3fc('0x60')===_0x4f8ab3){phoneDescriptions[_0xe3fc('0x1a')]({'itemTypeId':_0x434c54[_0x2c299d]['id'],'description':_0x4f8ab3});delete _0x3ae3bd[_0x4f8ab3];}}}if(hasAdditionalPhones)_0x3ae3bd[_0xe3fc('0x1e')]='';var _0x17b0e7=_['keys'](_0x3ae3bd)[_0xe3fc('0x12')]();logger[_0xe3fc('0x53')](_0xe3fc('0x61'),_0x17b0e7);fs[_0xe3fc('0x62')](_0xb09348,_0x17b0e7+'\x0a');Papa[_0xe3fc('0x63')](fs[_0xe3fc('0x64')](_0xd08412),{'header':!![],'skipEmptyLines':!![],'step':function(_0x50cabf,_0x3c33de){try{for(var _0x3f4a05=0x0,_0x39a97c=[];_0x3f4a05<_0x50cabf[_0xe3fc('0x65')][_0xe3fc('0x18')];_0x3f4a05++){stats['rows']+=0x1;if(_0x50cabf[_0xe3fc('0x66')][_0x3f4a05]){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],_0x50cabf[_0xe3fc('0x66')][_0x3f4a05]);}else{var _0x59c5f9=[];var _0x15c834=[];var _0x84dcd0={};for(var _0x5d396f in _0x2541a1){let _0x44529b=contactItemTypes[_0xe3fc('0x67')](_0x46568c=>_0x46568c['name']===_0x5d396f);let _0x1d584b=contactItemTypes[_0xe3fc('0x67')](_0x544a62=>_0x544a62[_0xe3fc('0x5f')]+_0xe3fc('0x60')===_0x5d396f);if(_[_0xe3fc('0x19')](_0x44529b)&&_[_0xe3fc('0x19')](_0x1d584b)){if(_0x2541a1[_0xe3fc('0x68')](_0x5d396f)){if(_0x50cabf['data'][_0x3f4a05][_0x2541a1[_0x5d396f]]){var _0x1ee350=_[_0xe3fc('0x69')](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x5d396f]][_0xe3fc('0x6a')](/"/g,'\x27'));switch(_0x5d396f){case'scheduledat':var _0x491bf5=moment(_0x1ee350,_0xe3fc('0xa'),!![]);if(_0x491bf5[_0xe3fc('0x6b')]()){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x6c'));}break;case _0xe3fc('0x37'):var _0x1179ca=parseInt(_0x1ee350);_0x1ee350=_[_0xe3fc('0x6d')](_0x1179ca)||_0x1179ca<0x0||_0x1179ca>0x4?_0x10d3b6?0x3:0x2:_0x1179ca;_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');break;case _0xe3fc('0x38'):var _0x3550e9=parseInt(_0x1ee350);if(_['isNumber'](_0x3550e9)&&_[_0xe3fc('0x6e')](_0x25f7bb,_0x3550e9)){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x3550e9+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x6f'));}break;case _0xe3fc('0x70'):if(isEmail(_0x1ee350)){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1d41d1=moment(_0x1ee350,_0xe3fc('0x71'),!![]);if(_0x1d41d1[_0xe3fc('0x6b')]()){_0x39a97c['push']('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x72'));}break;default:_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}}else{switch(_0x5d396f){case _0xe3fc('0x73'):case'phone':_0x59c5f9['push'](_0x5d396f+_0xe3fc('0x74'));break;default:_0x39a97c[_0xe3fc('0x1a')]('\x22\x22');}}}}else{var _0x136360='';if(!_[_0xe3fc('0x19')](_0x44529b)){if(!_0x84dcd0[_0xe3fc('0x68')](_0x44529b['id'])){for(var _0x5c2c5d=0x0;_0x5c2c5d<_0x2541a1[_0x5d396f][_0xe3fc('0x18')];_0x5c2c5d++){var _0x1ee350=_['trim'](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x5d396f][_0x5c2c5d]][_0xe3fc('0x6a')](/"/g,'\x27'));var _0x3b0b0f=phoneDescriptions[_0xe3fc('0x67')](_0x2d8ff5=>_0x2d8ff5[_0xe3fc('0x75')]===_0x44529b['id']);if(!_[_0xe3fc('0x19')](_0x3b0b0f)){var _0xb29841=_['trim'](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x3b0b0f[_0xe3fc('0x76')]][0x0]][_0xe3fc('0x6a')](/"/g,'\x27'));if(!_[_0xe3fc('0x19')](_0xb29841))_0x1ee350=_0x1ee350+'§'+_0xb29841;}if(_0x136360=='')_0x136360=_0x1ee350;else _0x136360+='|'+_0x1ee350;}_0x15c834[_0xe3fc('0x1a')](_0x44529b['id']+':'+_0x136360);_0x84dcd0[_0x44529b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x15c834[_0xe3fc('0x12')](';')+'\x22');}if(_0x59c5f9['length']){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],{'code':'SystemRow','message':_0x59c5f9['join']()});}else{fs[_0xe3fc('0x77')](_0xb09348,_0x39a97c[_0xe3fc('0x12')]()+'\x0a');}_0x39a97c=[];}if(!(stats['rows']%0xc8)){socket[_0xe3fc('0x78')]('contact:import:'+_0x137d5e,stats);stats[_0xe3fc('0x66')]=[];}}if(stopped){logger[_0xe3fc('0x53')](_0xe3fc('0x79'));_0x3c33de[_0xe3fc('0x7a')]();}}catch(_0x749800){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],{'code':'SystemError','message':_0x749800['message']});logger['error'](_0xe3fc('0x7b'),_0x749800['message']);}},'complete':function(){try{var _0x347e2f=[];var _0x588019=tempTableName;_0x347e2f[_0xe3fc('0x1a')](_0xe3fc('0x7c')+_0x588019+_0xe3fc('0x7d'));logger[_0xe3fc('0x53')]('CIS\x20len',contactItemTypes['length']);var _0x4ddf58=util[_0xe3fc('0xc')](_0xe3fc('0x7e'),_0xb09348,_0x588019,_0x17b0e7,_0x27fa3a[_0xe3fc('0x34')],_0x27fa3a[_0xe3fc('0x4f')]||null,NOW,NOW);if(_[_0xe3fc('0x19')](_0x2541a1[_0xe3fc('0x33')])){_0x4ddf58+=_0xe3fc('0x7f');}_0x347e2f['push'](_0x4ddf58);BPromise[_0xe3fc('0x80')](_0x347e2f,handleQuery)[_0xe3fc('0x20')](function(_0x22124c){BPromise[_0xe3fc('0x1b')]([handleAdditionalPhones()])[_0xe3fc('0x20')](function(){_0x347e2f=[];for(var _0x114185=0x0;_0x114185_0x49486e[_0xd0c8('0x6b')]===_0x10a3e4);let _0x5d470f=contactItemTypes[_0xd0c8('0x72')](_0x2b4f22=>_0x2b4f22[_0xd0c8('0x6b')]+_0xd0c8('0x6c')===_0x10a3e4);if(_['isNil'](_0x4ee581)&&_['isNil'](_0x5d470f)){if(_0x5da021[_0xd0c8('0x73')](_0x10a3e4)){if(_0x4a65af[_0xd0c8('0x70')][_0x5296f2][_0x5da021[_0x10a3e4]]){var _0x3dadab=_[_0xd0c8('0x74')](_0x4a65af['data'][_0x5296f2][_0x5da021[_0x10a3e4]][_0xd0c8('0x75')](/"/g,'\x27'));switch(_0x10a3e4){case _0xd0c8('0x35'):var _0x269194=moment(_0x3dadab,_0xd0c8('0xa'),!![]);if(_0x269194[_0xd0c8('0x76')]()){_0x56697f[_0xd0c8('0x18')]('\x22'+_0x3dadab+'\x22');}else{_0x1fcb2d['push'](_0xd0c8('0x77'));}break;case _0xd0c8('0x78'):var _0x1028a3=parseInt(_0x3dadab);_0x3dadab=_[_0xd0c8('0x79')](_0x1028a3)||_0x1028a3<0x0||_0x1028a3>0x4?_0x4346e7?0x3:0x2:_0x1028a3;_0x56697f[_0xd0c8('0x18')]('\x22'+_0x3dadab+'\x22');break;case'UserId':var _0x17e574=parseInt(_0x3dadab);if(_['isNumber'](_0x17e574)&&_[_0xd0c8('0x7a')](_0x115b91,_0x17e574)){_0x56697f[_0xd0c8('0x18')]('\x22'+_0x17e574+'\x22');}else{_0x1fcb2d[_0xd0c8('0x18')](_0xd0c8('0x7b'));}break;case _0xd0c8('0x7c'):if(isEmail(_0x3dadab)){_0x56697f[_0xd0c8('0x18')]('\x22'+_0x3dadab+'\x22');}else{_0x1fcb2d[_0xd0c8('0x18')]('email\x20wrong\x20format');}break;case _0xd0c8('0x7d'):var _0x2c02cc=moment(_0x3dadab,_0xd0c8('0x7e'),!![]);if(_0x2c02cc['isValid']()){_0x56697f[_0xd0c8('0x18')]('\x22'+_0x3dadab+'\x22');}else{_0x1fcb2d['push'](_0xd0c8('0x7f'));}break;default:_0x56697f[_0xd0c8('0x18')]('\x22'+_0x3dadab+'\x22');}}else{switch(_0x10a3e4){case'firstName':case'phone':_0x1fcb2d[_0xd0c8('0x18')](_0x10a3e4+'\x20not\x20specified');break;default:_0x56697f[_0xd0c8('0x18')]('\x22\x22');}}}}else{var _0x1d8bce='';if(!_[_0xd0c8('0x16')](_0x4ee581)){if(!_0x5c2571[_0xd0c8('0x73')](_0x4ee581['id'])){for(var _0x3f848b=0x0;_0x3f848b<_0x5da021[_0x10a3e4][_0xd0c8('0x1f')];_0x3f848b++){var _0x3dadab=_['trim'](_0x4a65af[_0xd0c8('0x70')][_0x5296f2][_0x5da021[_0x10a3e4][_0x3f848b]]['replace'](/"/g,'\x27'));var _0xa8e576=phoneDescriptions['find'](_0x5b09c5=>_0x5b09c5[_0xd0c8('0x80')]===_0x4ee581['id']);if(!_[_0xd0c8('0x16')](_0xa8e576)){var _0x5f0b8f=_[_0xd0c8('0x74')](_0x4a65af[_0xd0c8('0x70')][_0x5296f2][_0x5da021[_0xa8e576[_0xd0c8('0x81')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xd0c8('0x16')](_0x5f0b8f))_0x3dadab=_0x3dadab+'§'+_0x5f0b8f;}if(_0x1d8bce=='')_0x1d8bce=_0x3dadab;else _0x1d8bce+='|'+_0x3dadab;}_0xd95db2[_0xd0c8('0x18')](_0x4ee581['id']+':'+_0x1d8bce);_0x5c2571[_0x4ee581['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56697f[_0xd0c8('0x18')]('\x22'+_0xd95db2[_0xd0c8('0x11')](';')+'\x22');}if(_0x1fcb2d[_0xd0c8('0x1f')]){handleError(_0x4a65af[_0xd0c8('0x70')][_0x5296f2],{'code':'SystemRow','message':_0x1fcb2d[_0xd0c8('0x11')]()});}else{fs[_0xd0c8('0x82')](_0x17e2f5,_0x56697f[_0xd0c8('0x11')]()+'\x0a');}_0x56697f=[];}if(!(stats[_0xd0c8('0x71')]%0xc8)){socket['emit'](_0xd0c8('0x83')+_0x302f0c,stats);stats[_0xd0c8('0x84')]=[];}}if(stopped){logger[_0xd0c8('0x5f')](_0xd0c8('0x85'));_0x5486af['abort']();}}catch(_0x15d212){handleError(_0x4a65af['data'][_0x5296f2],{'code':'SystemError','message':_0x15d212[_0xd0c8('0x1c')]});logger['error'](_0xd0c8('0x86'),_0x15d212[_0xd0c8('0x1c')]);}},'complete':function(){try{var _0x1cc44b=[];var _0x4a965c=tempTableName;_0x1cc44b[_0xd0c8('0x18')](_0xd0c8('0x87')+_0x4a965c+_0xd0c8('0x88'));logger[_0xd0c8('0x5f')](_0xd0c8('0x89'),contactItemTypes['length']);var _0x149563=util[_0xd0c8('0x9')](_0xd0c8('0x8a'),_0x17e2f5,_0x4a965c,_0x4ea1c8,_0x5c09c2[_0xd0c8('0x36')],_0x5c09c2['CompanyId']||null,NOW,NOW);if(_[_0xd0c8('0x16')](_0x5da021[_0xd0c8('0x35')])){_0x149563+=_0xd0c8('0x8b');}_0x1cc44b[_0xd0c8('0x18')](_0x149563);BPromise[_0xd0c8('0x8c')](_0x1cc44b,handleQuery)['then'](function(_0x456c20){BPromise[_0xd0c8('0x20')]([handleAdditionalPhones()])[_0xd0c8('0x19')](function(){_0x1cc44b=[];for(var _0x2cd90d=0x0;_0x2cd90d\x20\x20');}var _0x32b807=path['join'](config[_0xd0c8('0x67')],_0xd0c8('0x68'),process[_0xd0c8('0x95')][0x2]);if(!fs[_0xd0c8('0x96')](_0x32b807)){throw new Error(_0xd0c8('0x97'));}var _0x169780={};try{_0x169780=JSON[_0xd0c8('0x6e')](process[_0xd0c8('0x95')][0x3]);if(!_0x169780[_0xd0c8('0x65')]){throw new Error(_0xd0c8('0x98'));}var _0x26f35f=0x0;if(_0x169780[_0xd0c8('0x65')][_0xd0c8('0x39')]){_0x26f35f=0x1;}if(!_0x169780[_0xd0c8('0x36')]){throw new Error(_0xd0c8('0x99'));}}catch(_0x496dbd){throw new Error('body\x20id\x20mandatory');}var _0xc82143=[];try{_0xc82143=_[_0xd0c8('0x9a')](JSON[_0xd0c8('0x6e')](process['argv'][0x4]),'id');}catch(_0x725cfa){logger[_0xd0c8('0x5f')](_0xd0c8('0x9b'));}main(_0x32b807,_0x169780,_0xc82143,_0x26f35f);}validate();process['on'](_0xd0c8('0x9c'),handleStop);process['on'](_0xd0c8('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9765f99..6790c3e 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 _0x9d6f=['destcalleridnum','membername','starttime','endtime','Duration','duration','Billable\x20Time','getSubjects','string','voice','toLowerCase','inbound','variable','push','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Talk\x20Time','talktime','Called\x20Number'];(function(_0x54b8ed,_0x4e258c){var _0x379242=function(_0x42700f){while(--_0x42700f){_0x54b8ed['push'](_0x54b8ed['shift']());}};_0x379242(++_0x4e258c);}(_0x9d6f,0x166));var _0xf9d6=function(_0x23d4c7,_0x13f8cc){_0x23d4c7=_0x23d4c7-0x0;var _0x339704=_0x9d6f[_0x23d4c7];return _0x339704;};'use strict';exports[_0xf9d6('0x0')]=function(_0x49471f,_0x42a96c){var _0x5f1aac=[{'type':_0xf9d6('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x49471f['toLowerCase']()){case _0xf9d6('0x2'):switch(_0x42a96c[_0xf9d6('0x3')]()){case _0xf9d6('0x4'):_0x5f1aac['push']({'type':_0xf9d6('0x5'),'content':'','variableName':'queue'});_0x5f1aac[_0xf9d6('0x6')]({'type':_0xf9d6('0x5'),'content':'','variableName':'calleridnum'});break;case _0xf9d6('0x7'):_0x5f1aac[_0xf9d6('0x6')]({'type':_0xf9d6('0x1'),'content':_0xf9d6('0x8'),'variableName':null});_0x5f1aac['push']({'type':_0xf9d6('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x5f1aac;};exports['getDescriptions']=function(_0x5bcf65,_0x3eb20d){var _0x2205a7=[];switch(_0x5bcf65[_0xf9d6('0x3')]()){case'voice':switch(_0x3eb20d[_0xf9d6('0x3')]()){case _0xf9d6('0x4'):_0x2205a7=[{'type':_0xf9d6('0x1'),'content':_0xf9d6('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0xb'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0xc')},{'type':'keyValue','content':'','key':_0xf9d6('0xd'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0xe')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0xf'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x10')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x11'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x12')},{'type':'keyValue','content':'','key':_0xf9d6('0x13'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x14')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x15'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x16')},{'type':_0xf9d6('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x17'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x18')},{'type':_0xf9d6('0xa'),'content':'','key':'Agent\x20Number','keyType':_0xf9d6('0x5'),'variableName':'destcalleridnum'},{'type':_0xf9d6('0x1'),'content':_0xf9d6('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x1a'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x16')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x1b'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x1c')},{'type':_0xf9d6('0xa'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xf9d6('0xa'),'content':'','key':'Hold\x20Time','keyType':_0xf9d6('0x5'),'variableName':'holdtime'},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x1d'),'keyType':_0xf9d6('0x5'),'variableName':_0xf9d6('0x1e')}];break;case _0xf9d6('0x7'):_0x2205a7=[{'type':_0xf9d6('0x1'),'content':_0xf9d6('0x9'),'variableName':null},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x1f'),'keyType':'variable','keyContent':'','variableName':_0xf9d6('0x20')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0xf9d6('0x21')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x13'),'keyType':_0xf9d6('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x15'),'keyType':_0xf9d6('0x5'),'keyContent':'','variableName':_0xf9d6('0x22')},{'type':_0xf9d6('0x1'),'content':_0xf9d6('0x19')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xf9d6('0x5'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0xf9d6('0x5'),'keyContent':'','variableName':_0xf9d6('0x23')},{'type':_0xf9d6('0xa'),'content':'','key':_0xf9d6('0x24'),'keyType':_0xf9d6('0x5'),'keyContent':'','variableName':_0xf9d6('0x25')},{'type':'keyValue','content':'','key':_0xf9d6('0x26'),'keyType':_0xf9d6('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x2205a7;}; \ No newline at end of file +var _0xd392=['agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','calleridnum','outbound','push','Outbound\x20Call','destcalleridnum','getDescriptions','string','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','Queue','uniqueid','Date'];(function(_0x57f7be,_0x54f0d9){var _0x23f3a9=function(_0x2001ab){while(--_0x2001ab){_0x57f7be['push'](_0x57f7be['shift']());}};_0x23f3a9(++_0x54f0d9);}(_0xd392,0xfd));var _0x2d39=function(_0x4dbb0e,_0x217dab){_0x4dbb0e=_0x4dbb0e-0x0;var _0xe8eb64=_0xd392[_0x4dbb0e];return _0xe8eb64;};'use strict';exports[_0x2d39('0x0')]=function(_0x324ba4,_0x4808b7){var _0xf24c31=[{'type':'string','content':_0x2d39('0x1'),'variableName':null}];switch(_0x324ba4[_0x2d39('0x2')]()){case _0x2d39('0x3'):switch(_0x4808b7[_0x2d39('0x2')]()){case _0x2d39('0x4'):_0xf24c31['push']({'type':_0x2d39('0x5'),'content':'','variableName':_0x2d39('0x6')});_0xf24c31['push']({'type':_0x2d39('0x5'),'content':'','variableName':_0x2d39('0x7')});break;case _0x2d39('0x8'):_0xf24c31[_0x2d39('0x9')]({'type':'string','content':_0x2d39('0xa'),'variableName':null});_0xf24c31['push']({'type':_0x2d39('0x5'),'content':'','variableName':_0x2d39('0xb')});break;}}return _0xf24c31;};exports[_0x2d39('0xc')]=function(_0x4f13a2,_0x4c5be8){var _0x30e9c6=[];switch(_0x4f13a2['toLowerCase']()){case _0x2d39('0x3'):switch(_0x4c5be8[_0x2d39('0x2')]()){case _0x2d39('0x4'):_0x30e9c6=[{'type':_0x2d39('0xd'),'content':_0x2d39('0xe'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x2d39('0xf'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x7')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x11'),'keyType':_0x2d39('0x5'),'variableName':'calleridname'},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x12'),'keyType':'variable','variableName':_0x2d39('0x13')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x14'),'keyType':_0x2d39('0x5'),'variableName':'queue'},{'type':_0x2d39('0x10'),'content':'','key':'UniqueId','keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x15')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x16'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x17')},{'type':'string','content':_0x2d39('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x2d39('0x10'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x2d39('0x19')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x1a'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0xb')},{'type':_0x2d39('0xd'),'content':_0x2d39('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x17')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x1c'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x1d')},{'type':_0x2d39('0x10'),'content':'','key':'Agent\x20Complete','keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x1e')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x1f'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x20')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x21'),'keyType':_0x2d39('0x5'),'variableName':_0x2d39('0x22')}];break;case _0x2d39('0x8'):_0x30e9c6=[{'type':_0x2d39('0xd'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x23'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0xb')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x24'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0x25')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x26'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0x15')},{'type':_0x2d39('0x10'),'content':'','key':'Date','keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0x27')},{'type':_0x2d39('0xd'),'content':_0x2d39('0x1b')},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x28'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0x29')},{'type':'keyValue','content':'','key':_0x2d39('0x2a'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x2d39('0x10'),'content':'','key':_0x2d39('0x2b'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':_0x2d39('0x2c')},{'type':'keyValue','content':'','key':_0x2d39('0x2d'),'keyType':_0x2d39('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x30e9c6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 525f433..a1208e1 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 _0x0b9b=['fax','mobile','lodash','./sql-utils','./utils','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','where','default','filter','user','read','tags','checkAccountsRestrictions','i.id','ids','tag','count','length','clause','order','forEach','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','clone','omit','html','phone'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x0b9b,0x1ca));var _0xb0b9=function(_0x10cfc3,_0x3ed223){_0x10cfc3=_0x10cfc3-0x0;var _0x4545ca=_0x0b9b[_0x10cfc3];return _0x4545ca;};'use strict';var _=require(_0xb0b9('0x0'));var sqlUtils=require(_0xb0b9('0x1'));var utils=require(_0xb0b9('0x2'));exports['findAll']=function(_0x5b225b,_0x1a0d95,_0x3ccf1d,_0x12b101,_0x1316a4){var _0x4f1c7d={'count':0x0,'rows':[]};var _0x3449f2=sqlUtils[_0xb0b9('0x3')](_0x5b225b,_0x3ccf1d,_0x1a0d95);if(_0x3449f2){return Promise[_0xb0b9('0x4')](_0x4f1c7d);}var _0x330991=sqlUtils[_0xb0b9('0x5')](_0x5b225b);var _0x2c0a14={};return Promise[_0xb0b9('0x4')]()[_0xb0b9('0x6')](function(){if(_0x1a0d95[_0xb0b9('0x7')]){return sqlUtils[_0xb0b9('0x8')](_0x1a0d95[_0xb0b9('0x7')],_0x1316a4);}else{return sqlUtils[_0xb0b9('0x9')](_0x5b225b,_0x1a0d95,_0x1316a4);}})[_0xb0b9('0x6')](function(_0x3945db){_0x330991['where'](_0x3945db[_0xb0b9('0xa')]);_0x330991[_0xb0b9('0xb')](_0x3945db['contact']);_0x330991[_0xb0b9('0xb')](_0x3945db[_0xb0b9('0xc')]);_0x330991[_0xb0b9('0xb')](_0x3945db['fields']);_0x330991[_0xb0b9('0xb')](_0x3945db[_0xb0b9('0xd')]);_0x330991[_0xb0b9('0xb')](_0x3945db[_0xb0b9('0xe')]);_0x330991['having'](_0x3945db[_0xb0b9('0xf')]);_0x2c0a14=_0x3945db[_0xb0b9('0x10')];return sqlUtils[_0xb0b9('0x11')](_0x5b225b,_0x3ccf1d,_0x1a0d95);})[_0xb0b9('0x6')](function(_0x53ef61){_0x330991['where'](_0x53ef61);_0x330991['group'](_0xb0b9('0x12'));var _0x3bf551=_0x1a0d95[_0xb0b9('0x7')]?_0x2c0a14[_0xb0b9('0x13')]:_0x1a0d95[_0xb0b9('0x14')];return sqlUtils['countFilteredInteractions'](_0x330991,_0x3bf551);})[_0xb0b9('0x6')](function(_0x5175be){_0x4f1c7d[_0xb0b9('0x15')]=_0x5175be[_0xb0b9('0x16')];if(_0x4f1c7d[_0xb0b9('0x15')]===0x0){return[];}_0x330991['having'](_0x2c0a14[_0xb0b9('0x17')]);if(_0x12b101[_0xb0b9('0x18')]){_0x12b101[_0xb0b9('0x18')][_0xb0b9('0x19')](function(_0x2eaddf){var _0x389685=_0x2eaddf[0x0]==='contactName'?_0x2eaddf[0x0]:'i.'+_0x2eaddf[0x0];_0x330991[_0xb0b9('0x18')](_0x389685,_0x2eaddf[0x1]==='DESC'?![]:!![]);if(_0x2eaddf[0x0]==='closed'){var _0x440198=sqlUtils[_0xb0b9('0x1a')](_0x5b225b,_0x1a0d95);_0x330991[_0xb0b9('0x18')](_0x440198,_0x2eaddf[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0xb0b9('0x1b')](_0x5b225b,_0x330991,_0x1a0d95,_0x12b101);})[_0xb0b9('0x6')](function(_0x1b3918){_0x4f1c7d[_0xb0b9('0x1c')]=_0x1b3918;return _0x4f1c7d;})[_0xb0b9('0x1d')](function(_0x94d143){throw _0x94d143;});};exports[_0xb0b9('0x1e')]=function(_0x1a769f,_0x288e20){return function(_0x7729b0,_0x459154,_0x1fc244){var _0x845921=_0x7729b0[_0xb0b9('0xe')];var _0x5bd9c8={};var _0x364a0e=_0x7729b0[_0xb0b9('0x1f')];if(_0x5bd9c8){_0x5bd9c8=_[_0xb0b9('0x20')](_0x7729b0[_0xb0b9('0xa')]);_0x5bd9c8=_[_0xb0b9('0x21')](_0x5bd9c8,[_0xb0b9('0xa'),_0xb0b9('0x22'),_0xb0b9('0x23'),_0xb0b9('0x24'),_0xb0b9('0x25')]);}utils['updateUser'](_0x845921,_0x5bd9c8,_0x364a0e,_0x1a769f,_0x288e20);_0x1fc244(null);};}; \ No newline at end of file +var _0x823d=['phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','then','parseQueryParameters','where','body','contact','fields','filter','user','having','tags','checkAccountsRestrictions','group','i.id','ids','tag','count','length','clause','order','forEach','contactName','closed','getClosedOrderClause','DESC','getFilteredInteractions','catch','tracked','clone','html'];(function(_0x5ebc7f,_0x74ab0d){var _0x3d0960=function(_0x21dd69){while(--_0x21dd69){_0x5ebc7f['push'](_0x5ebc7f['shift']());}};_0x3d0960(++_0x74ab0d);}(_0x823d,0x79));var _0xd823=function(_0x47643e,_0x337374){_0x47643e=_0x47643e-0x0;var _0x2aa5db=_0x823d[_0x47643e];return _0x2aa5db;};'use strict';var _=require(_0xd823('0x0'));var sqlUtils=require(_0xd823('0x1'));var utils=require(_0xd823('0x2'));exports[_0xd823('0x3')]=function(_0x49412f,_0x580b16,_0x1c04e0,_0x42fe25,_0x5526ae){var _0x578729={'count':0x0,'rows':[]};var _0x54fbc1=sqlUtils[_0xd823('0x4')](_0x49412f,_0x1c04e0,_0x580b16);if(_0x54fbc1){return Promise[_0xd823('0x5')](_0x578729);}var _0x4a93f1=sqlUtils['getInteractionsQuery'](_0x49412f);var _0x16b19d={};return Promise['resolve']()[_0xd823('0x6')](function(){if(_0x580b16['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x580b16['search'],_0x5526ae);}else{return sqlUtils[_0xd823('0x7')](_0x49412f,_0x580b16,_0x5526ae);}})[_0xd823('0x6')](function(_0x8f890e){_0x4a93f1[_0xd823('0x8')](_0x8f890e[_0xd823('0x9')]);_0x4a93f1['where'](_0x8f890e[_0xd823('0xa')]);_0x4a93f1[_0xd823('0x8')](_0x8f890e['default']);_0x4a93f1[_0xd823('0x8')](_0x8f890e[_0xd823('0xb')]);_0x4a93f1[_0xd823('0x8')](_0x8f890e[_0xd823('0xc')]);_0x4a93f1[_0xd823('0x8')](_0x8f890e[_0xd823('0xd')]);_0x4a93f1[_0xd823('0xe')](_0x8f890e['read']);_0x16b19d=_0x8f890e[_0xd823('0xf')];return sqlUtils[_0xd823('0x10')](_0x49412f,_0x1c04e0,_0x580b16);})['then'](function(_0x1eddf6){_0x4a93f1[_0xd823('0x8')](_0x1eddf6);_0x4a93f1[_0xd823('0x11')](_0xd823('0x12'));var _0x3117fc=_0x580b16['search']?_0x16b19d[_0xd823('0x13')]:_0x580b16[_0xd823('0x14')];return sqlUtils['countFilteredInteractions'](_0x4a93f1,_0x3117fc);})[_0xd823('0x6')](function(_0x1b7b31){_0x578729[_0xd823('0x15')]=_0x1b7b31[_0xd823('0x16')];if(_0x578729['count']===0x0){return[];}_0x4a93f1['having'](_0x16b19d[_0xd823('0x17')]);if(_0x42fe25['order']){_0x42fe25[_0xd823('0x18')][_0xd823('0x19')](function(_0x3048dc){var _0x289cc9=_0x3048dc[0x0]===_0xd823('0x1a')?_0x3048dc[0x0]:'i.'+_0x3048dc[0x0];_0x4a93f1[_0xd823('0x18')](_0x289cc9,_0x3048dc[0x1]==='DESC'?![]:!![]);if(_0x3048dc[0x0]===_0xd823('0x1b')){var _0x4deb18=sqlUtils[_0xd823('0x1c')](_0x49412f,_0x580b16);_0x4a93f1[_0xd823('0x18')](_0x4deb18,_0x3048dc[0x1]===_0xd823('0x1d')?![]:!![]);}});}return sqlUtils[_0xd823('0x1e')](_0x49412f,_0x4a93f1,_0x580b16,_0x42fe25);})['then'](function(_0x18ae62){_0x578729['rows']=_0x18ae62;return _0x578729;})[_0xd823('0x1f')](function(_0x383781){throw _0x383781;});};exports[_0xd823('0x20')]=function(_0x11a7eb,_0x1bb411){return function(_0x2d9f89,_0x2383f0,_0x25ae9b){var _0x779a68=_0x2d9f89[_0xd823('0xd')];var _0xda49b8={};var _0x332d72=_0x2d9f89['query'];if(_0xda49b8){_0xda49b8=_[_0xd823('0x21')](_0x2d9f89['body']);_0xda49b8=_['omit'](_0xda49b8,['body',_0xd823('0x22'),_0xd823('0x23'),_0xd823('0x24'),_0xd823('0x25')]);}utils[_0xd823('0x26')](_0x779a68,_0xda49b8,_0x332d72,_0x11a7eb,_0x1bb411);_0x25ae9b(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 6a54ab9..d4faa06 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d94=['left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','from','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','find','buildExpression','type','text','start','value','end','unreadMessages','and','operator','$substring','split','contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','read','tag','filter','get','chat','Websites','resolve','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','Account.email','contactName','i.id','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','limit','offset','groupBy','findOne','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','exports','lodash','../parsers/advancedSearch','../parsers/qs','./utils','getAccountFK','role','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.'];(function(_0x20add0,_0x2fe127){var _0x44e35a=function(_0x5a815d){while(--_0x5a815d){_0x20add0['push'](_0x20add0['shift']());}};_0x44e35a(++_0x2fe127);}(_0x7d94,0x8c));var _0x47d9=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x7d94[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0x47d9('0x0'));var squel=require('squel');var as=require(_0x47d9('0x1'));var qs=require(_0x47d9('0x2'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0x47d9('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x960595,_0x1081e9,_0x25f0ef){var _0x3fbdbd=![];var _0xe871f8=utils[_0x47d9('0x4')](_0x960595);if(_0x1081e9[_0x47d9('0x5')]===_0x47d9('0x6')&&!_0x25f0ef['search']&&!_0x25f0ef[_0xe871f8]){_0x3fbdbd=!![];}return _0x3fbdbd;}function getTagsQuery(){return squel[_0x47d9('0x7')]()[_0x47d9('0x8')]('id')['field'](_0x47d9('0x9'))[_0x47d9('0x8')](_0x47d9('0xa'))['from'](_0x47d9('0xb'));}function getUsersQuery(_0x56e8ab,_0x308d78){var _0x10f59e=utils[_0x47d9('0xc')](_0x56e8ab);var _0x5dd917=_0x47d9('0xd')+_0x56e8ab+'_interactions';var _0x4bdeac=squel[_0x47d9('0x7')]()[_0x47d9('0x8')](_0x47d9('0xe'))['field'](_0x47d9('0xf'))[_0x47d9('0x8')](_0x47d9('0x10')+_0x10f59e)['from'](_0x5dd917,'ui')[_0x47d9('0x11')](_0x47d9('0x12'),'u',_0x47d9('0x13'));if(_0x308d78['length']>0x0){_0x4bdeac[_0x47d9('0x14')](_0x47d9('0x10')+_0x10f59e+_0x47d9('0x15'),_[_0x47d9('0x16')](_0x308d78,'id'));}return _0x4bdeac;}function getInteractionsQuery(_0x518433){var _0x50d2d0=utils[_0x47d9('0x17')](_0x518433);var _0x5bdbcb=utils[_0x47d9('0x4')](_0x518433);var _0x2ad8eb=utils['getInteractionFK'](_0x518433);return squel[_0x47d9('0x7')]()[_0x47d9('0x18')](_0x50d2d0[_0x47d9('0x19')],'i')[_0x47d9('0x11')]('cm_contacts','c',_0x47d9('0x1a'))[_0x47d9('0x11')](_0x47d9('0x12'),'o',_0x47d9('0x1b'))[_0x47d9('0x11')](_0x50d2d0[_0x47d9('0x1c')],'a',_0x47d9('0x1d')+_0x5bdbcb)['left_join'](_0x50d2d0[_0x47d9('0x1e')],'me',_0x47d9('0x1f')+_0x2ad8eb+_0x47d9('0x20'))['left_join'](_0x50d2d0[_0x47d9('0x21')],'it',_0x47d9('0x22')+_0x2ad8eb+'\x20=\x20i.id')[_0x47d9('0x11')](_0x47d9('0xb'),'t',_0x47d9('0x23'));}function getSqlClauses(){var _0x2ce602={'body':squel[_0x47d9('0x24')](),'contact':squel[_0x47d9('0x24')](),'default':squel['expr'](),'fields':squel[_0x47d9('0x24')](),'filter':squel[_0x47d9('0x24')](),'read':squel[_0x47d9('0x24')](),'tags':{'clause':squel[_0x47d9('0x24')](),'ids':null},'user':squel[_0x47d9('0x24')]()};return _0x2ce602;}function parseTagParameter(_0x12e32a){var _0x5a4492=squel[_0x47d9('0x24')]();if(_0x12e32a){var _0x1bd1a7=utils[_0x47d9('0x25')](_0x12e32a);_0x1bd1a7[_0x47d9('0x26')](function(_0x14442d){_0x5a4492['or'](_0x47d9('0x27'),'%,'+_0x14442d+',%');});}return _0x5a4492;}function parseReadParameter(_0x524b9c){var _0x1ec7b9='';if(_0x524b9c){_0x1ec7b9=_0x47d9('0x28');if(_0x524b9c==='1'){_0x1ec7b9=_0x1ec7b9[_0x47d9('0x29')](_0x47d9('0x2a'),'=');}else{_0x1ec7b9=_0x1ec7b9[_0x47d9('0x29')](_0x47d9('0x2a'),'>');}}return _0x1ec7b9;}function parseSearchFilter(_0x48b22c,_0x3c7230){var _0x5127d3=squel['expr']();if(_0x3c7230){var _0x3a6ece=_0x3c7230[_0x47d9('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x47d9('0x2b')](_0x3a6ece)){_0x5127d3['or'](_0x47d9('0x2c'),_0x3a6ece+'%');if([_0x47d9('0x2d'),_0x47d9('0x2e')][_0x47d9('0x2f')](_0x48b22c)){_0x5127d3['or'](_0x47d9('0x30'),_0x3a6ece+'%');}else if(_0x48b22c===_0x47d9('0x31')){_0x5127d3['or']('i.fax\x20LIKE\x20?',_0x3a6ece+'%');}else if(_0x48b22c===_0x47d9('0x32')){_0x5127d3['or'](_0x47d9('0x33'),_0x3a6ece+'%');}}else if(_0x48b22c===_0x47d9('0x34')&&qs[_0x47d9('0x35')](_0x3a6ece)){_0x5127d3['or'](_0x47d9('0x36'),_0x3a6ece+'%');}else{if(_0x48b22c==='mail'){_0x5127d3['or'](_0x47d9('0x37'),qs['getFullTextValue'](_0x3a6ece,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3a6ece));}else if(_0x48b22c!==_0x47d9('0x31')){_0x5127d3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3a6ece));}_0x5127d3['or'](_0x47d9('0x38'),qs['getFullTextValue'](_0x3a6ece,!![]),null);}}return _0x5127d3;}function parseAdvancedSearchFilter(_0x489cc3,_0x1c2751){var _0x3d562e=getSqlClauses();var _0x3fb733=as[_0x47d9('0x39')](_0x489cc3);var _0x46dc85=_0x3fb733[_0x47d9('0x3a')];for(var _0x48f019=0x0;_0x48f019<_0x3fb733['conditions'][_0x47d9('0x3b')];_0x48f019++){var _0x803cf0=_0x3fb733['conditions'][_0x48f019];var _0x1732e5='i';var _0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x803cf0[_0x47d9('0x8')]]);if(_0x427d6d){var _0x4715f0=as[_0x47d9('0x3d')](_0x1732e5,_0x427d6d[_0x47d9('0x3e')],_0x803cf0);_0x3d562e['default'][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0['value'][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x42')]);}else{switch(_0x803cf0['field']){case _0x47d9('0x43'):var _0x3808e7=parseReadParameter(_0x803cf0[_0x47d9('0x41')]);_0x3d562e['read'][_0x47d9('0x44')](_0x3808e7);break;case'Contact':if(_0x803cf0[_0x47d9('0x45')]===_0x47d9('0x46')){if(_0x803cf0[_0x47d9('0x41')][_0x47d9('0x47')]('\x20')['length']>0x1){_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x47d9('0x38'),qs[_0x47d9('0x49')](_0x803cf0[_0x47d9('0x41')],!![]),null);}else{var _0x3b87c2='%'+_0x803cf0[_0x47d9('0x41')]+'%';_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x47d9('0x4a'),_0x3b87c2,_0x3b87c2,_0x3b87c2);}}else{_0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x47d9('0x4b')]);_0x803cf0[_0x47d9('0x8')]='ContactId';_0x4715f0=as['buildExpression'](_0x1732e5,_0x427d6d['type'],_0x803cf0);_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0['value'][_0x47d9('0x42')]);}break;case'Tag':var _0xaf379d=_0x803cf0[_0x47d9('0x41')][_0x47d9('0x47')](',')[_0x47d9('0x16')](function(_0x3b5f0a){return Number(_0x3b5f0a);});var _0x1ccaaf=parseTagParameter(_0xaf379d);_0x3d562e[_0x47d9('0x4c')][_0x47d9('0x4d')][_0x47d9('0x44')](_0x1ccaaf);_0x3d562e[_0x47d9('0x4c')][_0x47d9('0x4e')]=_0xaf379d;break;case _0x47d9('0x4f'):if(_0x803cf0[_0x47d9('0x45')]===_0x47d9('0x46')){_0x3d562e[_0x47d9('0x50')][_0x46dc85](_0x47d9('0x51'),'%'+_0x803cf0[_0x47d9('0x41')]+'%',null);}else{_0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x47d9('0x52')]);_0x803cf0[_0x47d9('0x8')]='UserId';_0x4715f0=as['buildExpression'](_0x1732e5,_0x427d6d['type'],_0x803cf0);_0x3d562e['user'][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')]['end']);}break;case _0x47d9('0x53'):case _0x47d9('0x54'):_0x4715f0=as['buildExpression']('me',null,_0x803cf0);_0x3d562e[_0x47d9('0x53')][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x42')]);break;}}}return _0x3d562e;}function parseModelFields(_0x55335a,_0x389566,_0x12c6c9){var _0x4b389c=utils[_0x47d9('0x4')](_0x55335a);var _0x7e468=squel[_0x47d9('0x24')]();var _0x5f4056=_(_0x389566)[_0x47d9('0x55')]()[_0x47d9('0x16')](function(_0x33cd7d){return _[_0x47d9('0x56')](_0x12c6c9,[_0x47d9('0x9'),_0x33cd7d])?_0x33cd7d:undefined;})['compact']()[_0x47d9('0x41')]();if(_0x5f4056[_0x47d9('0x3b')]>0x0){_0x5f4056[_0x47d9('0x26')](function(_0x4f88a8){if(_0x4f88a8===_0x4b389c){_0x7e468[_0x47d9('0x44')]('i.'+_0x4b389c+_0x47d9('0x15'),[][_0x47d9('0x57')](_0x389566[_0x4f88a8]));}else if(_0x4f88a8===_0x47d9('0x58')){var _0x3811a1=JSON['parse'](_0x389566[_0x4f88a8])[_0x47d9('0x59')];var _0x591a6a=JSON['parse'](_0x389566[_0x4f88a8])[_0x47d9('0x5a')];_0x7e468[_0x47d9('0x44')](_0x47d9('0x5b'),_0x3811a1,_0x591a6a);}else{if(_0x389566[_0x4f88a8]==='null'){_0x7e468['and']('i.'+_0x4f88a8+_0x47d9('0x5c'));}else{_0x7e468[_0x47d9('0x44')]('i.'+_0x4f88a8+_0x47d9('0x5d'),_0x389566[_0x4f88a8]);}}});}return _0x7e468;}function parseQueryParameters(_0x2d6a5f,_0x315eef,_0x16f26e){var _0x5d0438=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x2d6a5f,_0x315eef,_0x16f26e);})[_0x47d9('0x5e')](function(_0x469059){_0x5d0438[_0x47d9('0x5f')][_0x47d9('0x44')](_0x469059);return parseReadParameter(_0x315eef['read']);})[_0x47d9('0x5e')](function(_0x37f16b){_0x5d0438[_0x47d9('0x60')]['and'](_0x37f16b);return parseTagParameter(_0x315eef[_0x47d9('0x61')]);})[_0x47d9('0x5e')](function(_0x273969){_0x5d0438[_0x47d9('0x4c')]['clause'][_0x47d9('0x44')](_0x273969);return parseSearchFilter(_0x2d6a5f,_0x315eef[_0x47d9('0x62')]);})[_0x47d9('0x5e')](function(_0x3952a3){_0x5d0438['filter']=_0x3952a3;return _0x5d0438;});}function checkAccountsRestrictions(_0x5424b3,_0x152b8d,_0x50f79d){var _0x5c4d9f=utils[_0x47d9('0x4')](_0x5424b3);var _0x38238c=_0x47d9('0x63')+_['capitalize'](_0x5424b3)+(_0x5424b3===_0x47d9('0x64')?_0x47d9('0x65'):'Accounts');var _0x1ebb63=squel[_0x47d9('0x24')]();return Promise[_0x47d9('0x66')]()[_0x47d9('0x5e')](function(){if(_0x50f79d['search']&&_0x152b8d[_0x47d9('0x5')]===_0x47d9('0x6')){return _0x152b8d[_0x38238c]({'attributes':['id'],'raw':!![]});}})[_0x47d9('0x5e')](function(_0xa4c575){if(_0xa4c575){if(_0xa4c575[_0x47d9('0x3b')]===0x0){_0x1ebb63[_0x47d9('0x44')]('i.'+_0x5c4d9f+_0x47d9('0x5c'));}else{_0x1ebb63[_0x47d9('0x44')]('i.'+_0x5c4d9f+'\x20IN\x20?',_[_0x47d9('0x16')](_0xa4c575,'id'));}}else if(!_0x50f79d[_0x5c4d9f]){_0x1ebb63['and']('i.'+_0x5c4d9f+_0x47d9('0x67'));}})[_0x47d9('0x5e')](function(){return _0x1ebb63;});}function getClosedOrderClause(_0x441f61,_0x4d9bce){var _0x44c0ad='';var _0x32fa0a=['i.thirdDisposition',_0x47d9('0x68'),_0x47d9('0x69')];if(_0x441f61===_0x47d9('0x34')){_0x32fa0a[_0x47d9('0x6a')]('i.substatus');}if(_0x4d9bce['closed']==='0'&&_0x441f61===_0x47d9('0x34')){_0x44c0ad=_0x47d9('0x6b');}else{if(_0x4d9bce[_0x47d9('0x6c')]==='1'){_0x32fa0a[_0x47d9('0x6d')]();}_0x44c0ad=_0x47d9('0x6e')+_0x32fa0a[_0x47d9('0x6f')](',\x20')+')';}return _0x44c0ad;}function getFilteredInteractions(_0x319383,_0x4d4066,_0x34d1b7,_0x3e1561){var _0x500aaa=utils['getInteractionFK'](_0x319383);var _0x57c1c3=_['capitalize'](_0x319383)+_0x47d9('0x70');var _0x27b4ac=[];var _0x407d60=getTagsQuery();var _0x12bb99={'type':db[_0x47d9('0x71')][_0x47d9('0x72')][_0x47d9('0x73')],'raw':!![]};var _0x2acb85=[];var _0x7b2a11=[];return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x407d60[_0x47d9('0x76')](),_0x12bb99)['then'](function(_0x216ad7){_0x27b4ac=_[_0x47d9('0x77')](_0x216ad7,'id');_0x12bb99=_['merge'](_0x12bb99,{'model':db[_0x57c1c3],'mapToModel':!![],'nest':!![]});if(_0x34d1b7[_0x47d9('0x5f')]){_0x3e1561['attributes'][_0x47d9('0x26')](function(_0xf74e55){_0x4d4066['field']('i.'+_0xf74e55);});}else{_0x4d4066['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x78'),_0x47d9('0x79'));_0x4d4066[_0x47d9('0x8')]('a.mandatoryDisposition',_0x47d9('0x7a'));if(_0x319383===_0x47d9('0x34')){_0x4d4066[_0x47d9('0x8')]('a.email',_0x47d9('0x7b'));_0x4d4066[_0x47d9('0x8')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x47d9('0x7c'));_0x4d4066['field'](_0x47d9('0x7d'));_0x4d4066[_0x47d9('0x8')]('i.createdAt');_0x4d4066['field'](_0x47d9('0x7e'));_0x4d4066['field']('i.closed');_0x4d4066['field'](_0x47d9('0x7f'));_0x4d4066[_0x47d9('0x8')]('i.attach');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x80'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x81'));_0x4d4066[_0x47d9('0x8')]('i.subject');_0x4d4066['field'](_0x47d9('0x69'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x68'));_0x4d4066[_0x47d9('0x8')]('i.thirdDisposition');_0x4d4066['field'](_0x47d9('0x6b'));_0x4d4066[_0x47d9('0x8')]('i.to');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x82'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x83'));_0x4d4066[_0x47d9('0x8')]('i.UserId');}else if(_0x319383===_0x47d9('0x32')){_0x4d4066[_0x47d9('0x8')](_0x47d9('0x84'),_0x47d9('0x7c'));}else{_0x4d4066[_0x47d9('0x8')](_0x47d9('0x85'),'contactName');}if(_0x319383!==_0x47d9('0x34')){_0x4d4066[_0x47d9('0x8')](_0x47d9('0x86'));}_0x4d4066[_0x47d9('0x8')](_0x47d9('0x87'),_0x47d9('0x88'));_0x4d4066[_0x47d9('0x8')]('c.lastName','Contact.lastName');_0x4d4066['field'](_0x47d9('0x89'),_0x47d9('0x8a'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8b'),_0x47d9('0x8c'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8d'),_0x47d9('0x8e'));_0x4d4066['field']('c.fax','Contact.fax');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8f'),_0x47d9('0x90'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x91'),_0x47d9('0x92'));_0x4d4066[_0x47d9('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3e1561[_0x47d9('0x93')]){_0x4d4066[_0x47d9('0x93')](_0x3e1561[_0x47d9('0x93')]);}if(_0x3e1561['offset']){_0x4d4066[_0x47d9('0x94')](_0x3e1561[_0x47d9('0x94')]);}return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x4d4066['toString'](),_0x12bb99);})[_0x47d9('0x5e')](function(_0x97226d){_0x2acb85=_0x97226d;var _0x2b8179=getUsersQuery(_0x319383,_0x2acb85);return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x2b8179[_0x47d9('0x76')](),_0x12bb99);})[_0x47d9('0x5e')](function(_0x7159a4){_0x7b2a11=_[_0x47d9('0x95')](_0x7159a4,_0x500aaa);if(_0x319383===_0x47d9('0x34')){return db['Setting'][_0x47d9('0x96')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x47d9('0x5e')](function(_0x3e8af7){var _0x467c77=_0x3e8af7?_0x3e8af7[_0x47d9('0x97')]:undefined;var _0x43ad53=_0x2acb85[_0x47d9('0x16')](function(_0x53aba2){return updateInteraction(_0x53aba2,_0x27b4ac,_0x7b2a11,_0x467c77);});return Promise[_0x47d9('0x98')](_0x43ad53);});}function countFilteredInteractions(_0x1a7ebc,_0x519531){var _0x233845=_0x1a7ebc['clone']();_0x233845[_0x47d9('0x8')](_0x47d9('0x99'));_0x233845[_0x47d9('0x8')](_0x47d9('0x9a'),'unreadMessages');var _0x3e0ef4=utils[_0x47d9('0x25')](_0x519531);if(!_[_0x47d9('0x9b')](_0x3e0ef4)){_0x233845[_0x47d9('0x14')]('t.id\x20IN\x20?',_0x3e0ef4);}var _0x56f006={'type':db[_0x47d9('0x71')][_0x47d9('0x72')][_0x47d9('0x73')],'raw':!![]};return db['sequelize'][_0x47d9('0x75')](_0x233845[_0x47d9('0x76')](),_0x56f006);}module[_0x47d9('0x9c')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2afb=['attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','o.internal','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','all','clone','COUNT(*)','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','agent','select','field','name','color','getInteractionFK','user_has_','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','fax','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','compact','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','filter','get','capitalize','chat','Accounts','resolve','role','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','shift','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','fields'];(function(_0x1cb1e3,_0x41e279){var _0x18d694=function(_0x4dc61d){while(--_0x4dc61d){_0x1cb1e3['push'](_0x1cb1e3['shift']());}};_0x18d694(++_0x41e279);}(_0x2afb,0xcc));var _0xb2af=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x2afb[_0xb98d8d];return _0x489b15;};'use strict';var _=require(_0xb2af('0x0'));var squel=require(_0xb2af('0x1'));var as=require(_0xb2af('0x2'));var qs=require(_0xb2af('0x3'));var updateInteraction=require(_0xb2af('0x4'))[_0xb2af('0x5')];var utils=require(_0xb2af('0x6'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x49b0ad,_0x555fe3,_0xbb07a5){var _0xcec457=![];var _0x34a746=utils[_0xb2af('0x7')](_0x49b0ad);if(_0x555fe3['role']===_0xb2af('0x8')&&!_0xbb07a5['search']&&!_0xbb07a5[_0x34a746]){_0xcec457=!![];}return _0xcec457;}function getTagsQuery(){return squel[_0xb2af('0x9')]()[_0xb2af('0xa')]('id')[_0xb2af('0xa')](_0xb2af('0xb'))[_0xb2af('0xa')](_0xb2af('0xc'))['from']('tools_tags');}function getUsersQuery(_0x3b2042,_0x398579){var _0x4a535a=utils[_0xb2af('0xd')](_0x3b2042);var _0x472f2b=_0xb2af('0xe')+_0x3b2042+'_interactions';var _0x436643=squel[_0xb2af('0x9')]()[_0xb2af('0xa')](_0xb2af('0xf'))[_0xb2af('0xa')](_0xb2af('0x10'))[_0xb2af('0xa')](_0xb2af('0x11')+_0x4a535a)[_0xb2af('0x12')](_0x472f2b,'ui')[_0xb2af('0x13')](_0xb2af('0x14'),'u',_0xb2af('0x15'));if(_0x398579[_0xb2af('0x16')]>0x0){_0x436643[_0xb2af('0x17')](_0xb2af('0x11')+_0x4a535a+_0xb2af('0x18'),_[_0xb2af('0x19')](_0x398579,'id'));}return _0x436643;}function getInteractionsQuery(_0x3d5a35){var _0x537f93=utils[_0xb2af('0x1a')](_0x3d5a35);var _0x218e73=utils[_0xb2af('0x7')](_0x3d5a35);var _0x2a5a10=utils[_0xb2af('0xd')](_0x3d5a35);return squel[_0xb2af('0x9')]()[_0xb2af('0x12')](_0x537f93[_0xb2af('0x1b')],'i')[_0xb2af('0x13')]('cm_contacts','c',_0xb2af('0x1c'))['left_join'](_0xb2af('0x14'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x537f93['accounts'],'a',_0xb2af('0x1d')+_0x218e73)[_0xb2af('0x13')](_0x537f93['messages'],'me','me.'+_0x2a5a10+_0xb2af('0x1e'))['left_join'](_0x537f93['interactionsTags'],'it',_0xb2af('0x1f')+_0x2a5a10+_0xb2af('0x1e'))[_0xb2af('0x13')](_0xb2af('0x20'),'t',_0xb2af('0x21'));}function getSqlClauses(){var _0x13293f={'body':squel['expr'](),'contact':squel[_0xb2af('0x22')](),'default':squel[_0xb2af('0x22')](),'fields':squel[_0xb2af('0x22')](),'filter':squel[_0xb2af('0x22')](),'read':squel[_0xb2af('0x22')](),'tags':{'clause':squel[_0xb2af('0x22')](),'ids':null},'user':squel[_0xb2af('0x22')]()};return _0x13293f;}function parseTagParameter(_0x51574f){var _0x50f03f=squel['expr']();if(_0x51574f){var _0x709324=utils[_0xb2af('0x23')](_0x51574f);_0x709324[_0xb2af('0x24')](function(_0x3803f9){_0x50f03f['or'](_0xb2af('0x25'),'%,'+_0x3803f9+',%');});}return _0x50f03f;}function parseReadParameter(_0xe9e998){var _0x3f736a='';if(_0xe9e998){_0x3f736a=_0xb2af('0x26');if(_0xe9e998==='1'){_0x3f736a=_0x3f736a[_0xb2af('0x27')](_0xb2af('0x28'),'=');}else{_0x3f736a=_0x3f736a['replace'](_0xb2af('0x28'),'>');}}return _0x3f736a;}function parseSearchFilter(_0x3f7aed,_0x373836){var _0x3bb250=squel[_0xb2af('0x22')]();if(_0x373836){var _0x4cebc4=_0x373836[_0xb2af('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb2af('0x29')](_0x4cebc4)){_0x3bb250['or'](_0xb2af('0x2a'),_0x4cebc4+'%');if([_0xb2af('0x2b'),_0xb2af('0x2c')]['includes'](_0x3f7aed)){_0x3bb250['or']('i.phone\x20LIKE\x20?',_0x4cebc4+'%');}else if(_0x3f7aed===_0xb2af('0x2d')){_0x3bb250['or']('i.fax\x20LIKE\x20?',_0x4cebc4+'%');}else if(_0x3f7aed===_0xb2af('0x2e')){_0x3bb250['or'](_0xb2af('0x2f'),_0x4cebc4+'%');}}else if(_0x3f7aed==='mail'&&qs[_0xb2af('0x30')](_0x4cebc4)){_0x3bb250['or'](_0xb2af('0x31'),_0x4cebc4+'%');}else{if(_0x3f7aed===_0xb2af('0x32')){_0x3bb250['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb2af('0x33')](_0x4cebc4,!![]))['or'](_0xb2af('0x34'),qs['getFullTextValue'](_0x4cebc4));}else if(_0x3f7aed!==_0xb2af('0x2d')){_0x3bb250['or'](_0xb2af('0x35'),qs[_0xb2af('0x33')](_0x4cebc4));}_0x3bb250['or'](_0xb2af('0x36'),qs[_0xb2af('0x33')](_0x4cebc4,!![]),null);}}return _0x3bb250;}function parseAdvancedSearchFilter(_0x5e99eb,_0x4f6a67){var _0x33d855=getSqlClauses();var _0x4a8d3d=as[_0xb2af('0x37')](_0x5e99eb);var _0x43c991=_0x4a8d3d[_0xb2af('0x38')];for(var _0x82a418=0x0;_0x82a418<_0x4a8d3d['conditions'][_0xb2af('0x16')];_0x82a418++){var _0x2d5883=_0x4a8d3d[_0xb2af('0x39')][_0x82a418];var _0x382561='i';var _0xe2bb5b=_[_0xb2af('0x3a')](_0x4f6a67,[_0xb2af('0xb'),_0x2d5883[_0xb2af('0xa')]]);if(_0xe2bb5b){var _0x14375a=as[_0xb2af('0x3b')](_0x382561,_0xe2bb5b[_0xb2af('0x3c')],_0x2d5883);_0x33d855[_0xb2af('0x3d')][_0x43c991](_0x14375a[_0xb2af('0x3e')],_0x14375a[_0xb2af('0x3f')][_0xb2af('0x40')],_0x14375a[_0xb2af('0x3f')][_0xb2af('0x41')]);}else{switch(_0x2d5883[_0xb2af('0xa')]){case _0xb2af('0x42'):var _0x4b67bf=parseReadParameter(_0x2d5883['value']);_0x33d855[_0xb2af('0x43')][_0xb2af('0x44')](_0x4b67bf);break;case _0xb2af('0x45'):if(_0x2d5883[_0xb2af('0x46')]===_0xb2af('0x47')){if(_0x2d5883[_0xb2af('0x3f')]['split']('\x20')[_0xb2af('0x16')]>0x1){_0x33d855[_0xb2af('0x48')][_0x43c991](_0xb2af('0x36'),qs['getFullTextValue'](_0x2d5883['value'],!![]),null);}else{var _0x508a56='%'+_0x2d5883[_0xb2af('0x3f')]+'%';_0x33d855[_0xb2af('0x48')][_0x43c991](_0xb2af('0x49'),_0x508a56,_0x508a56,_0x508a56);}}else{_0xe2bb5b=_['find'](_0x4f6a67,[_0xb2af('0xb'),_0xb2af('0x4a')]);_0x2d5883[_0xb2af('0xa')]=_0xb2af('0x4a');_0x14375a=as[_0xb2af('0x3b')](_0x382561,_0xe2bb5b[_0xb2af('0x3c')],_0x2d5883);_0x33d855[_0xb2af('0x48')][_0x43c991](_0x14375a[_0xb2af('0x3e')],_0x14375a['value']['start'],_0x14375a[_0xb2af('0x3f')][_0xb2af('0x41')]);}break;case _0xb2af('0x4b'):var _0x1de3bd=_0x2d5883[_0xb2af('0x3f')]['split'](',')[_0xb2af('0x19')](function(_0x3bd8fc){return Number(_0x3bd8fc);});var _0x184996=parseTagParameter(_0x1de3bd);_0x33d855[_0xb2af('0x4c')][_0xb2af('0x4d')]['and'](_0x184996);_0x33d855[_0xb2af('0x4c')][_0xb2af('0x4e')]=_0x1de3bd;break;case _0xb2af('0x4f'):if(_0x2d5883[_0xb2af('0x46')]===_0xb2af('0x47')){_0x33d855[_0xb2af('0x50')][_0x43c991](_0xb2af('0x51'),'%'+_0x2d5883[_0xb2af('0x3f')]+'%',null);}else{_0xe2bb5b=_[_0xb2af('0x3a')](_0x4f6a67,[_0xb2af('0xb'),_0xb2af('0x52')]);_0x2d5883[_0xb2af('0xa')]=_0xb2af('0x52');_0x14375a=as[_0xb2af('0x3b')](_0x382561,_0xe2bb5b[_0xb2af('0x3c')],_0x2d5883);_0x33d855[_0xb2af('0x50')][_0x43c991](_0x14375a[_0xb2af('0x3e')],_0x14375a[_0xb2af('0x3f')][_0xb2af('0x40')],_0x14375a[_0xb2af('0x3f')]['end']);}break;case _0xb2af('0x53'):case _0xb2af('0x54'):_0x14375a=as['buildExpression']('me',null,_0x2d5883);_0x33d855[_0xb2af('0x53')][_0x43c991](_0x14375a[_0xb2af('0x3e')],_0x14375a['value'][_0xb2af('0x40')],_0x14375a[_0xb2af('0x3f')][_0xb2af('0x41')]);break;}}}return _0x33d855;}function parseModelFields(_0x4d6ba1,_0x321761,_0x39a748){var _0x22d9cb=utils[_0xb2af('0x7')](_0x4d6ba1);var _0x4d7f7e=squel['expr']();var _0x5df036=_(_0x321761)[_0xb2af('0x55')]()['map'](function(_0x28ccb3){return _['some'](_0x39a748,[_0xb2af('0xb'),_0x28ccb3])?_0x28ccb3:undefined;})[_0xb2af('0x56')]()[_0xb2af('0x3f')]();if(_0x5df036[_0xb2af('0x16')]>0x0){_0x5df036[_0xb2af('0x24')](function(_0x189039){if(_0x189039===_0x22d9cb){_0x4d7f7e['and']('i.'+_0x22d9cb+_0xb2af('0x18'),[][_0xb2af('0x57')](_0x321761[_0x189039]));}else if(_0x189039===_0xb2af('0x58')){var _0x4f2d79=JSON['parse'](_0x321761[_0x189039])[_0xb2af('0x59')];var _0x435853=JSON[_0xb2af('0x5a')](_0x321761[_0x189039])['$lte'];_0x4d7f7e[_0xb2af('0x44')](_0xb2af('0x5b'),_0x4f2d79,_0x435853);}else{if(_0x321761[_0x189039]===_0xb2af('0x5c')){_0x4d7f7e[_0xb2af('0x44')]('i.'+_0x189039+'\x20IS\x20NULL');}else{_0x4d7f7e[_0xb2af('0x44')]('i.'+_0x189039+_0xb2af('0x5d'),_0x321761[_0x189039]);}}});}return _0x4d7f7e;}function parseQueryParameters(_0x221d1e,_0x210375,_0x4ea320){var _0x5f39cb=getSqlClauses();return Promise['resolve']()[_0xb2af('0x5e')](function(){return parseModelFields(_0x221d1e,_0x210375,_0x4ea320);})[_0xb2af('0x5e')](function(_0x2fd57c){_0x5f39cb['fields'][_0xb2af('0x44')](_0x2fd57c);return parseReadParameter(_0x210375[_0xb2af('0x43')]);})[_0xb2af('0x5e')](function(_0x2175ef){_0x5f39cb[_0xb2af('0x43')][_0xb2af('0x44')](_0x2175ef);return parseTagParameter(_0x210375['tag']);})['then'](function(_0x4e3971){_0x5f39cb[_0xb2af('0x4c')][_0xb2af('0x4d')][_0xb2af('0x44')](_0x4e3971);return parseSearchFilter(_0x221d1e,_0x210375[_0xb2af('0x5f')]);})[_0xb2af('0x5e')](function(_0x15e7b5){_0x5f39cb[_0xb2af('0x5f')]=_0x15e7b5;return _0x5f39cb;});}function checkAccountsRestrictions(_0x36ede8,_0x56cd7f,_0x33fc2c){var _0xaa6ad2=utils[_0xb2af('0x7')](_0x36ede8);var _0x19caf0=_0xb2af('0x60')+_[_0xb2af('0x61')](_0x36ede8)+(_0x36ede8===_0xb2af('0x62')?'Websites':_0xb2af('0x63'));var _0x2bd20f=squel[_0xb2af('0x22')]();return Promise[_0xb2af('0x64')]()[_0xb2af('0x5e')](function(){if(_0x33fc2c['search']&&_0x56cd7f[_0xb2af('0x65')]==='agent'){return _0x56cd7f[_0x19caf0]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x197eca){if(_0x197eca){if(_0x197eca['length']===0x0){_0x2bd20f[_0xb2af('0x44')]('i.'+_0xaa6ad2+_0xb2af('0x66'));}else{_0x2bd20f[_0xb2af('0x44')]('i.'+_0xaa6ad2+_0xb2af('0x18'),_[_0xb2af('0x19')](_0x197eca,'id'));}}else if(!_0x33fc2c[_0xaa6ad2]){_0x2bd20f[_0xb2af('0x44')]('i.'+_0xaa6ad2+_0xb2af('0x67'));}})[_0xb2af('0x5e')](function(){return _0x2bd20f;});}function getClosedOrderClause(_0x5135e0,_0x2fffa2){var _0xfa02a2='';var _0x278f1a=[_0xb2af('0x68'),_0xb2af('0x69'),_0xb2af('0x6a')];if(_0x5135e0===_0xb2af('0x32')){_0x278f1a['unshift']('i.substatus');}if(_0x2fffa2['closed']==='0'&&_0x5135e0==='mail'){_0xfa02a2=_0xb2af('0x6b');}else{if(_0x2fffa2['closed']==='1'){_0x278f1a[_0xb2af('0x6c')]();}_0xfa02a2='CONCAT_WS(\x27\x27,\x20'+_0x278f1a['join'](',\x20')+')';}return _0xfa02a2;}function getFilteredInteractions(_0x57a1da,_0x4190fd,_0x2e5151,_0x20bd8){var _0x35bc1a=utils[_0xb2af('0xd')](_0x57a1da);var _0x53d118=_[_0xb2af('0x61')](_0x57a1da)+_0xb2af('0x6d');var _0x3d4d0b=[];var _0x5573d9=getTagsQuery();var _0x453dee={'type':db[_0xb2af('0x6e')][_0xb2af('0x6f')][_0xb2af('0x70')],'raw':!![]};var _0x18ce8d=[];var _0x4146cc=[];return db[_0xb2af('0x71')][_0xb2af('0x72')](_0x5573d9[_0xb2af('0x73')](),_0x453dee)[_0xb2af('0x5e')](function(_0x26983f){_0x3d4d0b=_[_0xb2af('0x74')](_0x26983f,'id');_0x453dee=_['merge'](_0x453dee,{'model':db[_0x53d118],'mapToModel':!![],'nest':!![]});if(_0x2e5151[_0xb2af('0x75')]){_0x20bd8[_0xb2af('0x76')]['forEach'](function(_0x21134e){_0x4190fd[_0xb2af('0xa')]('i.'+_0x21134e);});}else{_0x4190fd[_0xb2af('0xa')](_0xb2af('0x77'),'unreadMessages');_0x4190fd[_0xb2af('0xa')](_0xb2af('0x78'),_0xb2af('0x79'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x7a'),_0xb2af('0x7b'));if(_0x57a1da==='mail'){_0x4190fd['field'](_0xb2af('0x7c'),_0xb2af('0x7d'));_0x4190fd['field'](_0xb2af('0x7e'),_0xb2af('0x7f'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x80'));_0x4190fd[_0xb2af('0xa')]('i.createdAt');_0x4190fd[_0xb2af('0xa')](_0xb2af('0x81'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x82'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x83'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x84'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x85'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x86'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x87'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x6a'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x69'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x68'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x6b'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x88'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x89'));_0x4190fd['field'](_0xb2af('0x8a'));_0x4190fd['field'](_0xb2af('0x8b'));}else if(_0x57a1da===_0xb2af('0x2e')){_0x4190fd[_0xb2af('0xa')](_0xb2af('0x8c'),'contactName');}else{_0x4190fd['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x57a1da!==_0xb2af('0x32')){_0x4190fd[_0xb2af('0xa')](_0xb2af('0x8d'));}_0x4190fd[_0xb2af('0xa')](_0xb2af('0x8e'),_0xb2af('0x8f'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x90'),_0xb2af('0x91'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x92'),'Contact.email');_0x4190fd['field']('c.phone',_0xb2af('0x93'));_0x4190fd[_0xb2af('0xa')](_0xb2af('0x94'),'Contact.mobile');_0x4190fd['field']('c.fax','Contact.fax');_0x4190fd['field']('o.fullname','Owner.fullname');_0x4190fd[_0xb2af('0xa')](_0xb2af('0x95'),_0xb2af('0x96'));_0x4190fd[_0xb2af('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb2af('0x97'));}if(_0x20bd8['limit']){_0x4190fd[_0xb2af('0x98')](_0x20bd8[_0xb2af('0x98')]);}if(_0x20bd8[_0xb2af('0x99')]){_0x4190fd['offset'](_0x20bd8['offset']);}return db[_0xb2af('0x71')]['query'](_0x4190fd['toString'](),_0x453dee);})['then'](function(_0x2a16e7){_0x18ce8d=_0x2a16e7;var _0x3d6905=getUsersQuery(_0x57a1da,_0x18ce8d);return db['sequelize'][_0xb2af('0x72')](_0x3d6905[_0xb2af('0x73')](),_0x453dee);})[_0xb2af('0x5e')](function(_0x34e9ef){_0x4146cc=_[_0xb2af('0x9a')](_0x34e9ef,_0x35bc1a);if(_0x57a1da==='mail'){return db[_0xb2af('0x9b')][_0xb2af('0x9c')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xb2af('0x5e')](function(_0x508ea5){var _0x5cfd74=_0x508ea5?_0x508ea5['enableEmailPreview']:undefined;var _0x3cb4fc=_0x18ce8d[_0xb2af('0x19')](function(_0x3deb59){return updateInteraction(_0x3deb59,_0x3d4d0b,_0x4146cc,_0x5cfd74);});return Promise[_0xb2af('0x9d')](_0x3cb4fc);});}function countFilteredInteractions(_0x4ea67c,_0x58553d){var _0x23802c=_0x4ea67c[_0xb2af('0x9e')]();_0x23802c[_0xb2af('0xa')](_0xb2af('0x9f'));_0x23802c[_0xb2af('0xa')](_0xb2af('0x77'),'unreadMessages');var _0x3ece5d=utils[_0xb2af('0x23')](_0x58553d);if(!_[_0xb2af('0xa0')](_0x3ece5d)){_0x23802c[_0xb2af('0x17')]('t.id\x20IN\x20?',_0x3ece5d);}var _0x550bb7={'type':db[_0xb2af('0x6e')][_0xb2af('0x6f')][_0xb2af('0x70')],'raw':!![]};return db[_0xb2af('0x71')][_0xb2af('0x72')](_0x23802c['toString'](),_0x550bb7);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 6102d4d..6314104 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x636f=['plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x636f,0x1e5));var _0xf636=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x636f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x536f4a,_0x57f573){return new Promise(function(_0x5ba271,_0x2a8614){try{var _0xcde100=[];if(_0x57f573[_0x536f4a]){_0xcde100=_0x57f573[_0x536f4a]['map'](function(_0x42d746){return{'id':_0x42d746['id'],'fullname':_0x42d746[_0xf636('0x0')]};});}return _0x5ba271(_0xcde100);}catch(_0x2a9d24){_0x2a8614(_0x2a9d24);}});}function getInteractionTags(_0x1f3701,_0x521e15){var _0x21f703=[];if(_0x1f3701){_0x1f3701['split'](',')[_0xf636('0x1')](function(_0xe4cc12){_0x21f703[_0xf636('0x2')](_0x521e15[_0xe4cc12]);});}return _0x21f703;}function updateWaitingCounter(_0x30effc){if(_0x30effc[_0xf636('0x3')]){_0x30effc['waiting']-=0x1;}}function updateInteractionCounters(_0x4ffdd1){_0x4ffdd1[_0xf636('0x3')]=0x0;_0x4ffdd1[_0xf636('0x4')]=0x0;_0x4ffdd1[_0xf636('0x5')]=0x0;_0x4ffdd1[_0xf636('0x6')]=0x0;_0x4ffdd1[_0xf636('0x7')]=0x0;_0x4ffdd1[_0xf636('0x8')]=0x0;if(_0x4ffdd1[_0xf636('0x9')]){if(_0x4ffdd1[_0xf636('0xa')]===_0xf636('0x7')){_0x4ffdd1[_0xf636('0x7')]+=0x1;updateWaitingCounter(_0x4ffdd1);}if(_0x4ffdd1['UserId']){_0x4ffdd1['answered']+=0x1;if(_0x4ffdd1[_0xf636('0x4')]){_0x4ffdd1[_0xf636('0x4')]-=0x1;}}else{if(_0x4ffdd1[_0xf636('0xa')]){_0x4ffdd1[_0xf636('0x6')]+=0x1;updateWaitingCounter(_0x4ffdd1);}}}else{if(!_0x4ffdd1[_0xf636('0xb')]){_0x4ffdd1[_0xf636('0x3')]+=0x1;}if(_0x4ffdd1['UserId']){_0x4ffdd1[_0xf636('0x4')]+=0x1;updateWaitingCounter(_0x4ffdd1);}}_0x4ffdd1[_0xf636('0x8')]+=0x1;return _0x4ffdd1;}function getLastMessageText(_0x637da3){return db[_0xf636('0xc')][_0xf636('0xd')]({'where':{'$and':[{'MailInteractionId':_0x637da3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf636('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf636('0xf')],'order':_0xf636('0x10'),'raw':!![]})[_0xf636('0x11')](function(_0x2aa761){if(_0x2aa761&&_0x2aa761[_0xf636('0xf')]){_0x637da3[_0xf636('0x12')]=_[_0xf636('0x13')](_0x2aa761['plainBody']);}return _0x637da3;})[_0xf636('0x14')](function(_0x55389a){throw _0x55389a;});}exports[_0xf636('0x15')]=function(_0x37ee56,_0x356cf1,_0x4501e4,_0x27b457){return new Promise(function(_0x5d6329,_0x24f47c){return getInteractionUsers(_0x37ee56['id'],_0x4501e4)[_0xf636('0x11')](function(_0x34ce6d){_0x37ee56[_0xf636('0x16')]=_0x34ce6d;return getInteractionTags(_0x37ee56[_0xf636('0x17')],_0x356cf1);})[_0xf636('0x11')](function(_0x127959){_0x37ee56[_0xf636('0x18')]=_0x127959;delete _0x37ee56[_0xf636('0x17')];return updateInteractionCounters(_0x37ee56);})['then'](function(_0x2f18a7){if(_0x27b457){return getLastMessageText(_0x2f18a7);}else{return _0x2f18a7;}})['then'](function(_0x2f855c){_0x5d6329(_0x2f855c);})['catch'](function(_0x51af15){_0x24f47c(_0x51af15);});});}; \ No newline at end of file +var _0xec17=['split','forEach','push','waiting','talking','answered','abandoned','total','disposition','UserId','MailMessage','out','plainBody','-id','then','catch','updateInteraction','TagIds','Tags','lodash','map','fullname'];(function(_0x426d47,_0x1c90f7){var _0x488f5c=function(_0x58d456){while(--_0x58d456){_0x426d47['push'](_0x426d47['shift']());}};_0x488f5c(++_0x1c90f7);}(_0xec17,0x173));var _0x7ec1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xec17[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7ec1('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4e2d45,_0x3a14d1){return new Promise(function(_0x26377c,_0x1428b9){try{var _0xbe2a81=[];if(_0x3a14d1[_0x4e2d45]){_0xbe2a81=_0x3a14d1[_0x4e2d45][_0x7ec1('0x1')](function(_0x2eb91e){return{'id':_0x2eb91e['id'],'fullname':_0x2eb91e[_0x7ec1('0x2')]};});}return _0x26377c(_0xbe2a81);}catch(_0x283805){_0x1428b9(_0x283805);}});}function getInteractionTags(_0x576664,_0x418ba9){var _0x565e73=[];if(_0x576664){_0x576664[_0x7ec1('0x3')](',')[_0x7ec1('0x4')](function(_0x30cf34){_0x565e73[_0x7ec1('0x5')](_0x418ba9[_0x30cf34]);});}return _0x565e73;}function updateWaitingCounter(_0x5780c2){if(_0x5780c2['waiting']){_0x5780c2[_0x7ec1('0x6')]-=0x1;}}function updateInteractionCounters(_0x47be00){_0x47be00['waiting']=0x0;_0x47be00[_0x7ec1('0x7')]=0x0;_0x47be00[_0x7ec1('0x8')]=0x0;_0x47be00['unmanaged']=0x0;_0x47be00[_0x7ec1('0x9')]=0x0;_0x47be00[_0x7ec1('0xa')]=0x0;if(_0x47be00['closed']){if(_0x47be00[_0x7ec1('0xb')]===_0x7ec1('0x9')){_0x47be00[_0x7ec1('0x9')]+=0x1;updateWaitingCounter(_0x47be00);}if(_0x47be00[_0x7ec1('0xc')]){_0x47be00[_0x7ec1('0x8')]+=0x1;if(_0x47be00[_0x7ec1('0x7')]){_0x47be00[_0x7ec1('0x7')]-=0x1;}}else{if(_0x47be00[_0x7ec1('0xb')]){_0x47be00['unmanaged']+=0x1;updateWaitingCounter(_0x47be00);}}}else{if(!_0x47be00[_0x7ec1('0xc')]){_0x47be00[_0x7ec1('0x6')]+=0x1;}if(_0x47be00[_0x7ec1('0xc')]){_0x47be00[_0x7ec1('0x7')]+=0x1;updateWaitingCounter(_0x47be00);}}_0x47be00[_0x7ec1('0xa')]+=0x1;return _0x47be00;}function getLastMessageText(_0x247fbd){return db[_0x7ec1('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x247fbd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7ec1('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7ec1('0xf')],'order':_0x7ec1('0x10'),'raw':!![]})[_0x7ec1('0x11')](function(_0x57c91a){if(_0x57c91a&&_0x57c91a[_0x7ec1('0xf')]){_0x247fbd['lastMsgText']=_['trimStart'](_0x57c91a[_0x7ec1('0xf')]);}return _0x247fbd;})[_0x7ec1('0x12')](function(_0x32202e){throw _0x32202e;});}exports[_0x7ec1('0x13')]=function(_0x2fee2c,_0x4406fa,_0x34d67e,_0xb6319c){return new Promise(function(_0x120b47,_0x67af94){return getInteractionUsers(_0x2fee2c['id'],_0x34d67e)[_0x7ec1('0x11')](function(_0xcd9f4a){_0x2fee2c['Users']=_0xcd9f4a;return getInteractionTags(_0x2fee2c[_0x7ec1('0x14')],_0x4406fa);})[_0x7ec1('0x11')](function(_0x43c155){_0x2fee2c[_0x7ec1('0x15')]=_0x43c155;delete _0x2fee2c[_0x7ec1('0x14')];return updateInteractionCounters(_0x2fee2c);})[_0x7ec1('0x11')](function(_0x45ccf9){if(_0xb6319c){return getLastMessageText(_0x45ccf9);}else{return _0x45ccf9;}})['then'](function(_0x178396){_0x120b47(_0x178396);})['catch'](function(_0x1736f1){_0x67af94(_0x1736f1);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index b80da7a..0c7e65c 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b61=['accounts','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites'];(function(_0xaf9071,_0x2173b8){var _0x349556=function(_0x43afe0){while(--_0x43afe0){_0xaf9071['push'](_0xaf9071['shift']());}};_0x349556(++_0x2173b8);}(_0x2b61,0x1ed));var _0x12b6=function(_0x24942b,_0x4310e2){_0x24942b=_0x24942b-0x0;var _0x335545=_0x2b61[_0x24942b];return _0x335545;};'use strict';var _=require(_0x12b6('0x0'));var db=require(_0x12b6('0x1'))['db'];var loggers={'openchannel':require(_0x12b6('0x2'))(_0x12b6('0x3')),'mail':require('../../config/logger')(_0x12b6('0x4')),'fax':require(_0x12b6('0x2'))(_0x12b6('0x5')),'sms':require('../../config/logger')(_0x12b6('0x6')),'chat':require(_0x12b6('0x2'))(_0x12b6('0x7')),'whatsapp':require(_0x12b6('0x2'))(_0x12b6('0x8'))};function getAccountFK(_0x11f6f3){return _[_0x12b6('0x9')](_0x11f6f3)+(_0x11f6f3===_0x12b6('0xa')?_0x12b6('0xb'):_0x12b6('0xc'))+'Id';}function getInteractionFK(_0x5b10d1){return _[_0x12b6('0x9')](_0x5b10d1)+_0x12b6('0xd');}function getInteractionId(_0xf2ad40,_0x2a5a68,_0x4c0cf9){if(_0xf2ad40&&_0xf2ad40[_[_0x12b6('0xe')](_0x4c0cf9)+_0x12b6('0xd')]){return _0xf2ad40[_[_0x12b6('0xe')](_0x4c0cf9)+'InteractionId'];}else if(_0xf2ad40&&_0xf2ad40['id']){return _0xf2ad40['id'];}else if(_0x2a5a68&&_0x2a5a68['id']){return _0x2a5a68['id'];}else{return _0x12b6('0xf');}}function getInteractionsTables(_0x4d25c4){return{'accounts':_0x4d25c4+'_'+(_0x4d25c4===_0x12b6('0xa')?_0x12b6('0x10'):_0x12b6('0x11')),'interactions':_0x4d25c4+'_interactions','interactionsTags':_0x4d25c4+_0x12b6('0x12'),'messages':_0x4d25c4+'_messages','userInteractions':'user_has_'+_0x4d25c4+'_interactions'};}function getSelectedTags(_0x4f564e){var _0xf7fcc7=[];if(_0x4f564e){_0xf7fcc7=Array[_0x12b6('0x13')](_0x4f564e)?_0x4f564e:[_0x4f564e];}return _0xf7fcc7;}function log(_0x1f1207,_0x21f623,_0x20a132,_0x45525b,_0xe0dc90,_0x23f872){loggers[_0xe0dc90[_0x12b6('0x14')]()][_0x1f1207](_0x12b6('0x15'),_0x23f872[_0x12b6('0x16')](),_0x21f623?_0x21f623['id']:null,_0x21f623?_0x21f623[_0x12b6('0x17')]:null,_0x21f623?_0x21f623[_0x12b6('0x18')]:null,getInteractionId(_0x20a132,_0x45525b,_0xe0dc90),_0x20a132?JSON[_0x12b6('0x19')](_0x20a132):_0x12b6('0x1a'));}function updateUser(_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a){db[_['upperFirst'](_0x59a894)+_0x12b6('0x1b')][_0x12b6('0x1c')]({'where':{'id':getInteractionId(_0x248295,_0x8c0821,_0x59a894)}})['then'](function(_0x5da035){if(_0x5da035){return _0x5da035[_0x12b6('0x1d')]({'UserId':_0x5354b6?_0x5354b6['id']:null});}})[_0x12b6('0x1e')](function(_0x11152b){if(_0x11152b){log(_0x12b6('0x1f'),_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a);}})['catch'](function(){log(_0x12b6('0x20'),_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a);});}module[_0x12b6('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6a4e=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','then','update','info','catch','error','exports','lodash','../../mysqldb'];(function(_0xe0c0d2,_0x500878){var _0x1fbf02=function(_0xe187ee){while(--_0xe187ee){_0xe0c0d2['push'](_0xe0c0d2['shift']());}};_0x1fbf02(++_0x500878);}(_0x6a4e,0x10e));var _0xe6a4=function(_0x5f338f,_0x3cecff){_0x5f338f=_0x5f338f-0x0;var _0x161b41=_0x6a4e[_0x5f338f];return _0x161b41;};'use strict';var _=require(_0xe6a4('0x0'));var db=require(_0xe6a4('0x1'))['db'];var loggers={'openchannel':require(_0xe6a4('0x2'))(_0xe6a4('0x3')),'mail':require(_0xe6a4('0x2'))(_0xe6a4('0x4')),'fax':require(_0xe6a4('0x2'))(_0xe6a4('0x5')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')(_0xe6a4('0x6')),'whatsapp':require(_0xe6a4('0x2'))(_0xe6a4('0x7'))};function getAccountFK(_0x3ee0b7){return _[_0xe6a4('0x8')](_0x3ee0b7)+(_0x3ee0b7===_0xe6a4('0x9')?_0xe6a4('0xa'):_0xe6a4('0xb'))+'Id';}function getInteractionFK(_0x148cce){return _[_0xe6a4('0x8')](_0x148cce)+_0xe6a4('0xc');}function getInteractionId(_0xa9ebea,_0x54813c,_0xa510df){if(_0xa9ebea&&_0xa9ebea[_[_0xe6a4('0xd')](_0xa510df)+'InteractionId']){return _0xa9ebea[_[_0xe6a4('0xd')](_0xa510df)+'InteractionId'];}else if(_0xa9ebea&&_0xa9ebea['id']){return _0xa9ebea['id'];}else if(_0x54813c&&_0x54813c['id']){return _0x54813c['id'];}else{return _0xe6a4('0xe');}}function getInteractionsTables(_0x4a720d){return{'accounts':_0x4a720d+'_'+(_0x4a720d===_0xe6a4('0x9')?'websites':_0xe6a4('0xf')),'interactions':_0x4a720d+_0xe6a4('0x10'),'interactionsTags':_0x4a720d+_0xe6a4('0x11'),'messages':_0x4a720d+_0xe6a4('0x12'),'userInteractions':_0xe6a4('0x13')+_0x4a720d+_0xe6a4('0x10')};}function getSelectedTags(_0x2d6479){var _0x596892=[];if(_0x2d6479){_0x596892=Array[_0xe6a4('0x14')](_0x2d6479)?_0x2d6479:[_0x2d6479];}return _0x596892;}function log(_0x143f25,_0xe3b83b,_0x3ddc7b,_0x5ba8eb,_0xac99f2,_0x1537f1){loggers[_0xac99f2[_0xe6a4('0x15')]()][_0x143f25](_0xe6a4('0x16'),_0x1537f1[_0xe6a4('0x17')](),_0xe3b83b?_0xe3b83b['id']:null,_0xe3b83b?_0xe3b83b[_0xe6a4('0x18')]:null,_0xe3b83b?_0xe3b83b[_0xe6a4('0x19')]:null,getInteractionId(_0x3ddc7b,_0x5ba8eb,_0xac99f2),_0x3ddc7b?JSON[_0xe6a4('0x1a')](_0x3ddc7b):'null');}function updateUser(_0x3e4586,_0x5a9b3c,_0x4ffaca,_0x5118d9,_0x8f1449){db[_[_0xe6a4('0xd')](_0x5118d9)+_0xe6a4('0x1b')]['findOne']({'where':{'id':getInteractionId(_0x5a9b3c,_0x4ffaca,_0x5118d9)}})[_0xe6a4('0x1c')](function(_0x5e0793){if(_0x5e0793){return _0x5e0793[_0xe6a4('0x1d')]({'UserId':_0x3e4586?_0x3e4586['id']:null});}})[_0xe6a4('0x1c')](function(_0xef8496){if(_0xef8496){log(_0xe6a4('0x1e'),_0x3e4586,_0x5a9b3c,_0x4ffaca,_0x5118d9,_0x8f1449);}})[_0xe6a4('0x1f')](function(){log(_0xe6a4('0x20'),_0x3e4586,_0x5a9b3c,_0x4ffaca,_0x5118d9,_0x8f1449);});}module[_0xe6a4('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 2111894..7b29184 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 _0x9c15=['users','User','admin','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x583394,_0x127bfd){var _0x591c6f=function(_0x21f6a5){while(--_0x21f6a5){_0x583394['push'](_0x583394['shift']());}};_0x591c6f(++_0x127bfd);}(_0x9c15,0x7c));var _0x59c1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9c15[_0x3947c9];return _0x2e7871;};'use strict';var crypto=require(_0x59c1('0x0'));var util=require(_0x59c1('0x1'));var compose=require(_0x59c1('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x59c1('0x3'));function getValueFromLicense(_0x315248,_0x322a2f){if(_0x315248&&_0x322a2f){if(_0x322a2f['data1']&&_0x322a2f['license']){var _0x3961ee=_0x322a2f[_0x59c1('0x4')];var _0x22341b=_0x322a2f[_0x59c1('0x5')];var _0x5da562=_0x3961ee[_0x59c1('0x6')]('-')[0x4];var _0x50315d=_0x3961ee[_0x59c1('0x6')]('-')[0x0];var _0x32952c=crypto['createDecipher'](_0x59c1('0x7'),util[_0x59c1('0x8')](_0x59c1('0x9'),_0x5da562,_0x3961ee,_0x50315d));var _0x4968ce=_0x32952c[_0x59c1('0xa')](_0x22341b,'base64','utf8');_0x4968ce+=_0x32952c['final']('utf8');var _0x45940f=JSON[_0x59c1('0xb')](_0x4968ce);return _0x45940f[_0x59c1('0xc')](_0x315248)?_0x45940f[_0x315248]:null;}}return null;}function isLimit(_0x5377f2,_0x2bb3c0,_0x4867af,_0x4e7cc0){var _0x202b54=_0x2bb3c0;return compose()[_0x59c1('0xd')](function(_0x3d0198,_0x2abb4d,_0x34c3b1){return db['License'][_0x59c1('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x88d3e9){var _0x1c0464=getValueFromLicense(_0x5377f2,_0x88d3e9);return _0x1c0464?_0x1c0464:_0x202b54;})[_0x59c1('0xf')](function(_0x43306a){_0x202b54=_0x43306a;return _0x4867af['count'](_0x4e7cc0);})['then'](function(_0x3bd2c2){if(_0x3bd2c2>=_0x202b54){return _0x2abb4d[_0x59c1('0x10')](0x193)[_0x59c1('0x11')]({'message':util[_0x59c1('0x8')](_0x59c1('0x12'),_0x5377f2)});}_0x34c3b1();})[_0x59c1('0x13')](function(_0x35de71){_0x34c3b1(_0x35de71);});});}function isUserLimit(){return isLimit(_0x59c1('0x14'),0x1,db[_0x59c1('0x15')],{'where':{'$or':[{'role':_0x59c1('0x16')},{'role':'user'}]}});}exports[_0x59c1('0x17')]=isUserLimit; \ No newline at end of file +var _0xab0e=['findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License'];(function(_0x586ce3,_0x4a4c47){var _0x428d5b=function(_0x2bee4c){while(--_0x2bee4c){_0x586ce3['push'](_0x586ce3['shift']());}};_0x428d5b(++_0x4a4c47);}(_0xab0e,0x1e5));var _0xeab0=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xab0e[_0x16b9ed];return _0x66b1f8;};'use strict';var crypto=require('crypto');var util=require(_0xeab0('0x0'));var compose=require(_0xeab0('0x1'));var db=require(_0xeab0('0x2'))['db'];var config=require(_0xeab0('0x3'));function getValueFromLicense(_0x257171,_0x94a94d){if(_0x257171&&_0x94a94d){if(_0x94a94d[_0xeab0('0x4')]&&_0x94a94d[_0xeab0('0x5')]){var _0x3f7a46=_0x94a94d['data1'];var _0x441d89=_0x94a94d[_0xeab0('0x5')];var _0x35326d=_0x3f7a46[_0xeab0('0x6')]('-')[0x4];var _0x4e3be0=_0x3f7a46[_0xeab0('0x6')]('-')[0x0];var _0x3ec623=crypto[_0xeab0('0x7')](_0xeab0('0x8'),util[_0xeab0('0x9')](_0xeab0('0xa'),_0x35326d,_0x3f7a46,_0x4e3be0));var _0x1d84d7=_0x3ec623[_0xeab0('0xb')](_0x441d89,_0xeab0('0xc'),_0xeab0('0xd'));_0x1d84d7+=_0x3ec623[_0xeab0('0xe')](_0xeab0('0xd'));var _0x1a60ec=JSON[_0xeab0('0xf')](_0x1d84d7);return _0x1a60ec[_0xeab0('0x10')](_0x257171)?_0x1a60ec[_0x257171]:null;}}return null;}function isLimit(_0x17d96e,_0x528371,_0x357a0e,_0x22572d){var _0x4b3d9a=_0x528371;return compose()[_0xeab0('0x11')](function(_0x53148d,_0x39d43e,_0x43255c){return db[_0xeab0('0x12')][_0xeab0('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xeab0('0x14')](function(_0x483b9f){var _0xc4192e=getValueFromLicense(_0x17d96e,_0x483b9f);return _0xc4192e?_0xc4192e:_0x4b3d9a;})['then'](function(_0x4968cd){_0x4b3d9a=_0x4968cd;return _0x357a0e[_0xeab0('0x15')](_0x22572d);})[_0xeab0('0x14')](function(_0x3f5d05){if(_0x3f5d05>=_0x4b3d9a){return _0x39d43e[_0xeab0('0x16')](0x193)[_0xeab0('0x17')]({'message':util[_0xeab0('0x9')](_0xeab0('0x18'),_0x17d96e)});}_0x43255c();})[_0xeab0('0x19')](function(_0x16aa11){_0x43255c(_0x16aa11);});});}function isUserLimit(){return isLimit(_0xeab0('0x1a'),0x1,db['User'],{'where':{'$or':[{'role':_0xeab0('0x1b')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a6e04c1..b9337b2 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 _0x114d=['\x20IS\x20NULL)','$in','$notIn','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','DATE','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','shift','forEach','filter','indexOf','map','push','buildExpression','$eq','operator','value','includes','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20'];(function(_0x13b9b5,_0x298e69){var _0x154263=function(_0x3c7442){while(--_0x3c7442){_0x13b9b5['push'](_0x13b9b5['shift']());}};_0x154263(++_0x298e69);}(_0x114d,0xc1));var _0xd114=function(_0x18c197,_0x21eaf2){_0x18c197=_0x18c197-0x0;var _0x3424b2=_0x114d[_0x18c197];return _0x3424b2;};'use strict';var _=require(_0xd114('0x0'));var moment=require(_0xd114('0x1'));exports[_0xd114('0x2')]=function(_0x5ece9f){var _0x1ca0ed={'conditions':[]};_0x1ca0ed[_0xd114('0x3')]=_[_0xd114('0x4')](_0x5ece9f,_0xd114('0x5'))?'or':_0xd114('0x6');var _0x3faff6=_0x5ece9f['replace'](_0xd114('0x7'),'')[_0xd114('0x8')](_0xd114('0x5'),'')[_0xd114('0x9')]('||');for(var _0x4c4de2=0x0;_0x4c4de2<_0x3faff6['length'];_0x4c4de2++){var _0x33c715=_0x3faff6[_0x4c4de2][_0xd114('0x9')](':=');var _0xef359a=_0x33c715[0x0];var _0x581017=_0x33c715[_0xd114('0xa')](0x1);_0x581017['forEach'](function(_0x505ceb){var _0x464d92=_0x505ceb[_0xd114('0x9')]('[')[_0xd114('0xb')]();var _0x49e426=_0x505ceb['match'](/\[(.*?)\]/g);_0x49e426[_0xd114('0xc')](function(_0x3f1629){var _0x5bd3d4=_0x3f1629[_0xd114('0x9')]('[')[_0xd114('0xd')](function(_0x5cfde8){return _0x5cfde8[_0xd114('0xe')](']')>-0x1;})[_0xd114('0xf')](function(_0x55b511){return _0x55b511[_0xd114('0x9')](']')[0x0];})[0x0];_0x1ca0ed['conditions'][_0xd114('0x10')]({'field':_0xef359a,'operator':_0x464d92,'value':_0x5bd3d4});});});}return _0x1ca0ed;};exports[_0xd114('0x11')]=function(_0x2b4cb9,_0x5eefce,_0x1e7cf0){var _0x581ca8={};if(_0x5eefce==='DATE'){if(_0x1e7cf0['operator']===_0xd114('0x12')){_0x1e7cf0[_0xd114('0x13')]='$between';_0x1e7cf0[_0xd114('0x14')]+=','+_0x1e7cf0[_0xd114('0x14')];}else if(_[_0xd114('0x15')](['$gt','$lte'],_0x1e7cf0[_0xd114('0x13')])){_0x1e7cf0[_0xd114('0x14')]=moment(_0x1e7cf0['value'])['add'](0x1,'days')[_0xd114('0x16')](_0xd114('0x17'));}}if(_0x1e7cf0[_0xd114('0x18')]){_0x5eefce=_0x1e7cf0[_0xd114('0x18')];_0x581ca8[_0xd114('0x19')]=_0xd114('0x1a')+_0x2b4cb9+'.'+_0x1e7cf0[_0xd114('0x1b')]+_0xd114('0x1c')+_0x1e7cf0[_0xd114('0x18')]+')\x20'+parseOperator(_0x1e7cf0[_0xd114('0x13')]);}else{_0x581ca8[_0xd114('0x19')]=_0x2b4cb9+'.'+_0x1e7cf0['field']+'\x20'+parseOperator(_0x1e7cf0[_0xd114('0x13')]);}if(_['includes']([_0xd114('0x1d'),'$notIn'],_0x1e7cf0[_0xd114('0x13')]))_0x581ca8['text']='('+_0x581ca8['text']+_0xd114('0x1e')+_0x2b4cb9+'.'+_0x1e7cf0['field']+_0xd114('0x1f');_0x581ca8[_0xd114('0x14')]=parseValue(_0x5eefce,_0x1e7cf0[_0xd114('0x13')],_0x1e7cf0[_0xd114('0x14')]);return _0x581ca8;};function parseOperator(_0xd540b7){var _0x1d93f6;switch(_0xd540b7){case _0xd114('0x20'):_0x1d93f6='IN\x20?';break;case _0xd114('0x21'):_0x1d93f6='NOT\x20IN\x20?';break;case _0xd114('0x12'):_0x1d93f6=_0xd114('0x22');break;case _0xd114('0x1d'):_0x1d93f6=_0xd114('0x23');break;case _0xd114('0x24'):case _0xd114('0x25'):case _0xd114('0x26'):_0x1d93f6=_0xd114('0x27');break;case _0xd114('0x28'):_0x1d93f6='<\x20?';break;case _0xd114('0x29'):_0x1d93f6=_0xd114('0x2a');break;case _0xd114('0x2b'):_0x1d93f6=_0xd114('0x2c');break;case _0xd114('0x2d'):_0x1d93f6=_0xd114('0x2e');break;case'$between':_0x1d93f6=_0xd114('0x2f');break;}return _0x1d93f6;}function parseValue(_0x1226fa,_0x2618ab,_0x1bf65c){var _0xe619b6={'start':undefined,'end':undefined};switch(_0x2618ab){case'$in':case _0xd114('0x21'):_0xe619b6[_0xd114('0x30')]=_0x1bf65c[_0xd114('0x9')](',');break;case _0xd114('0x24'):_0xe619b6['start']='%'+_0x1bf65c+'%';break;case _0xd114('0x25'):_0xe619b6['start']=_0x1bf65c+'%';break;case'$endsWith':_0xe619b6[_0xd114('0x30')]='%'+_0x1bf65c;break;case _0xd114('0x31'):var _0xe8181a=_0x1bf65c[_0xd114('0x9')](',');var _0x1bf65c=_0xe8181a[_0xd114('0xb')]();var _0x3fec57=_0xe8181a[_0xd114('0x32')]();if(_0x1226fa===_0xd114('0x33')){_0x1bf65c=moment(_0x1bf65c)[_0xd114('0x34')](0x0,!![])[_0xd114('0x16')]();_0x3fec57=moment(_0x3fec57)[_0xd114('0x34')](0x0,!![])[_0xd114('0x35')](0x17,'hours')['add'](0x3b,_0xd114('0x36'))['add'](0x3b,_0xd114('0x37'))[_0xd114('0x16')]();}_0xe619b6={'start':_0x1bf65c,'end':_0x3fec57};break;default:_0xe619b6[_0xd114('0x30')]=_0x1bf65c;break;}return _0xe619b6;} \ No newline at end of file +var _0xa5ef=['operator','$eq','value','$gt','$lte','add','days','format','castTo','CAST(','field','\x20AS\x20','text','includes','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','$between','pop','utcOffset','hours','minutes','seconds','lodash','moment','[$or]','and','replace','split','length','shift','forEach','filter','indexOf','map','push','buildExpression','DATE'];(function(_0x438434,_0x36f21f){var _0x3b97c9=function(_0x1ecb7b){while(--_0x1ecb7b){_0x438434['push'](_0x438434['shift']());}};_0x3b97c9(++_0x36f21f);}(_0xa5ef,0x129));var _0xfa5e=function(_0x1b2f27,_0x499b97){_0x1b2f27=_0x1b2f27-0x0;var _0x1a8e6b=_0xa5ef[_0x1b2f27];return _0x1a8e6b;};'use strict';var _=require(_0xfa5e('0x0'));var moment=require(_0xfa5e('0x1'));exports['parseSearch']=function(_0x16c812){var _0x1ecec7={'conditions':[]};_0x1ecec7['sqlOperator']=_['startsWith'](_0x16c812,_0xfa5e('0x2'))?'or':_0xfa5e('0x3');var _0x357f79=_0x16c812[_0xfa5e('0x4')]('[$and]','')[_0xfa5e('0x4')](_0xfa5e('0x2'),'')[_0xfa5e('0x5')]('||');for(var _0x4073a7=0x0;_0x4073a7<_0x357f79[_0xfa5e('0x6')];_0x4073a7++){var _0x502799=_0x357f79[_0x4073a7][_0xfa5e('0x5')](':=');var _0x14fd89=_0x502799[0x0];var _0xfc75a6=_0x502799['slice'](0x1);_0xfc75a6['forEach'](function(_0x4edcb2){var _0x24d474=_0x4edcb2['split']('[')[_0xfa5e('0x7')]();var _0x38aca8=_0x4edcb2['match'](/\[(.*?)\]/g);_0x38aca8[_0xfa5e('0x8')](function(_0x4b76f8){var _0x127e21=_0x4b76f8[_0xfa5e('0x5')]('[')[_0xfa5e('0x9')](function(_0xec4591){return _0xec4591[_0xfa5e('0xa')](']')>-0x1;})[_0xfa5e('0xb')](function(_0x32f515){return _0x32f515[_0xfa5e('0x5')](']')[0x0];})[0x0];_0x1ecec7['conditions'][_0xfa5e('0xc')]({'field':_0x14fd89,'operator':_0x24d474,'value':_0x127e21});});});}return _0x1ecec7;};exports[_0xfa5e('0xd')]=function(_0x4e8f14,_0x58ad93,_0x4eb6e9){var _0x26ac21={};if(_0x58ad93===_0xfa5e('0xe')){if(_0x4eb6e9[_0xfa5e('0xf')]===_0xfa5e('0x10')){_0x4eb6e9[_0xfa5e('0xf')]='$between';_0x4eb6e9[_0xfa5e('0x11')]+=','+_0x4eb6e9[_0xfa5e('0x11')];}else if(_['includes']([_0xfa5e('0x12'),_0xfa5e('0x13')],_0x4eb6e9[_0xfa5e('0xf')])){_0x4eb6e9[_0xfa5e('0x11')]=moment(_0x4eb6e9[_0xfa5e('0x11')])[_0xfa5e('0x14')](0x1,_0xfa5e('0x15'))[_0xfa5e('0x16')]('YYYY-MM-DD');}}if(_0x4eb6e9[_0xfa5e('0x17')]){_0x58ad93=_0x4eb6e9[_0xfa5e('0x17')];_0x26ac21['text']=_0xfa5e('0x18')+_0x4e8f14+'.'+_0x4eb6e9[_0xfa5e('0x19')]+_0xfa5e('0x1a')+_0x4eb6e9[_0xfa5e('0x17')]+')\x20'+parseOperator(_0x4eb6e9[_0xfa5e('0xf')]);}else{_0x26ac21[_0xfa5e('0x1b')]=_0x4e8f14+'.'+_0x4eb6e9[_0xfa5e('0x19')]+'\x20'+parseOperator(_0x4eb6e9[_0xfa5e('0xf')]);}if(_[_0xfa5e('0x1c')]([_0xfa5e('0x1d'),'$notIn'],_0x4eb6e9[_0xfa5e('0xf')]))_0x26ac21[_0xfa5e('0x1b')]='('+_0x26ac21[_0xfa5e('0x1b')]+_0xfa5e('0x1e')+_0x4e8f14+'.'+_0x4eb6e9[_0xfa5e('0x19')]+'\x20IS\x20NULL)';_0x26ac21['value']=parseValue(_0x58ad93,_0x4eb6e9[_0xfa5e('0xf')],_0x4eb6e9[_0xfa5e('0x11')]);return _0x26ac21;};function parseOperator(_0x115f4d){var _0x5d3ba2;switch(_0x115f4d){case _0xfa5e('0x1f'):_0x5d3ba2=_0xfa5e('0x20');break;case _0xfa5e('0x21'):_0x5d3ba2=_0xfa5e('0x22');break;case _0xfa5e('0x10'):_0x5d3ba2=_0xfa5e('0x23');break;case _0xfa5e('0x1d'):_0x5d3ba2=_0xfa5e('0x24');break;case _0xfa5e('0x25'):case _0xfa5e('0x26'):case'$endsWith':_0x5d3ba2=_0xfa5e('0x27');break;case'$lt':_0x5d3ba2=_0xfa5e('0x28');break;case _0xfa5e('0x12'):_0x5d3ba2='>\x20?';break;case'$lte':_0x5d3ba2=_0xfa5e('0x29');break;case _0xfa5e('0x2a'):_0x5d3ba2='>=\x20?';break;case'$between':_0x5d3ba2=_0xfa5e('0x2b');break;}return _0x5d3ba2;}function parseValue(_0x45197d,_0x3a61a9,_0x46721e){var _0x436f17={'start':undefined,'end':undefined};switch(_0x3a61a9){case'$in':case _0xfa5e('0x21'):_0x436f17[_0xfa5e('0x2c')]=_0x46721e['split'](',');break;case'$substring':_0x436f17[_0xfa5e('0x2c')]='%'+_0x46721e+'%';break;case _0xfa5e('0x26'):_0x436f17[_0xfa5e('0x2c')]=_0x46721e+'%';break;case _0xfa5e('0x2d'):_0x436f17['start']='%'+_0x46721e;break;case _0xfa5e('0x2e'):var _0xcc1582=_0x46721e[_0xfa5e('0x5')](',');var _0x46721e=_0xcc1582[_0xfa5e('0x7')]();var _0x1dbecf=_0xcc1582[_0xfa5e('0x2f')]();if(_0x45197d===_0xfa5e('0xe')){_0x46721e=moment(_0x46721e)[_0xfa5e('0x30')](0x0,!![])[_0xfa5e('0x16')]();_0x1dbecf=moment(_0x1dbecf)[_0xfa5e('0x30')](0x0,!![])[_0xfa5e('0x14')](0x17,_0xfa5e('0x31'))['add'](0x3b,_0xfa5e('0x32'))['add'](0x3b,_0xfa5e('0x33'))[_0xfa5e('0x16')]();}_0x436f17={'start':_0x46721e,'end':_0x1dbecf};break;default:_0x436f17['start']=_0x46721e;break;}return _0x436f17;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b9886f9..15d3396 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 _0x88cf=['uniqueid','isArray','offset','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','isObject','isString','hasOwnProperty','omit','^[+]?[0-9]*$','match','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','object','value','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','name'];(function(_0xcca7a0,_0x303572){var _0x3ed88e=function(_0x1a07ae){while(--_0x1a07ae){_0xcca7a0['push'](_0xcca7a0['shift']());}};_0x3ed88e(++_0x303572);}(_0x88cf,0x1c6));var _0xf88c=function(_0x3d8d7e,_0x2eebd){_0x3d8d7e=_0x3d8d7e-0x0;var _0x476c55=_0x88cf[_0x3d8d7e];return _0x476c55;};'use strict';var _=require(_0xf88c('0x0'));var sequelize=require(_0xf88c('0x1'));var moment=require(_0xf88c('0x2'));var db=require(_0xf88c('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2040c5){var _0x112ab7=['ne'];try{var _0x59f610=JSON[_0xf88c('0x4')](_0x2040c5);var _0x574ecc=Object[_0xf88c('0x5')](_0x59f610)[0x0];return _0x112ab7[_0xf88c('0x6')](_0x574ecc);}catch(_0xc7159d){return![];}}function getOperatorValue(_0x2ca1bd){var _0x570395=JSON[_0xf88c('0x4')](_0x2ca1bd);var _0x5426c0=Object[_0xf88c('0x5')](_0x570395)[0x0];var _0xddd64d=_0x570395[_0x5426c0];return{['$'+_0x5426c0]:_0xddd64d};}function parseIncludeModel(_0x257dd9){var _0x4eca06=JSON[_0xf88c('0x4')](_0x257dd9);return{'model':db[_0x4eca06[_0xf88c('0x7')]],'as':_0x4eca06[_0xf88c('0x8')],'attributes':_0x4eca06[_0xf88c('0x9')],'raw':_0x4eca06[_0xf88c('0xa')]};}exports['fields']=function(_0x5d9d10){var _0x1eb646=null;if(_0x5d9d10){_0x1eb646=_0x5d9d10[_0xf88c('0xb')](',');}return _0x1eb646;};exports['filters']=function(_0x91be0b,_0x726e9f){var _0x225430={};if(!_[_0xf88c('0xc')](_0x91be0b)){_[_0xf88c('0xd')](_0x91be0b,function(_0x3312df,_0x2d8af7){try{if(_0x726e9f){var _0x2fbef8=_[_0xf88c('0xe')](_0x726e9f,{'name':_0x2d8af7})||{};if(hasSequelizeOperator(_0x3312df)){_0x225430[_0x2d8af7]=getOperatorValue(_0x3312df);}else if(_0x2fbef8[_0xf88c('0xf')]===_0xf88c('0x10')&&_['isPlainObject'](_0x3312df)){var _0x197b1e=JSON[_0xf88c('0x4')](_0x3312df);var _0x53bc28={'$gte':moment(moment(_0x197b1e[_0xf88c('0x11')])[_0xf88c('0x12')](_0xf88c('0x13')))[_0xf88c('0x14')]()[_0xf88c('0x12')](),'$lte':moment(moment(_0x197b1e['$lte'])[_0xf88c('0x12')](_0xf88c('0x13')))['utc']()['subtract'](0x1,'s')[_0xf88c('0x12')]()};_0x225430[_0x2d8af7]=_0x53bc28;}else if(_0x2fbef8[_0xf88c('0x15')]===_0xf88c('0x16')){_0x225430[_0x2d8af7]=_0x3312df;}else{_0x225430[_0x2d8af7]=_['isArray'](_0x3312df)?_0x3312df:JSON[_0xf88c('0x4')](_0x3312df);}}else{_0x225430[_0x2d8af7]=_[_0xf88c('0x17')](_0x3312df)?_0x3312df:JSON[_0xf88c('0x4')](_0x3312df);}}catch(_0x3c87fe){_0x225430[_0x2d8af7]=_0x3312df[_0xf88c('0xb')](',');}});}return _0x225430;};exports['limit']=function(_0x264fca){_0x264fca=parseInt(_0x264fca,0xa);if(!_0x264fca||_0x264fca<0x0){_0x264fca=LIMIT_VALUE;}return _0x264fca;};exports[_0xf88c('0x18')]=function(_0x3bfa2b){_0x3bfa2b=parseInt(_0x3bfa2b,0xa);if(!_0x3bfa2b||_0x3bfa2b<0x0){_0x3bfa2b=0x0;}return _0x3bfa2b;};exports['sort']=function(_0x15e868){var _0x3aee46,_0x1cad8e=null;if(_0x15e868){_0x3aee46=_0x15e868[_0xf88c('0xb')](',');_0x1cad8e=_[_0xf88c('0x19')](_0x3aee46,function(_0x150704){if(_0x150704[_0xf88c('0x1a')]('-')===0x0){return[_0x150704===_0xf88c('0x1b')?sequelize[_0xf88c('0x1c')](sequelize[_0xf88c('0x1d')](_0xf88c('0x1b')),'unsigned'):_0x150704[_0xf88c('0x1e')](0x1),_0xf88c('0x1f')];}else{return[_0x150704==='priority'?sequelize['cast'](sequelize[_0xf88c('0x1d')]('priority'),_0xf88c('0x20')):_0x150704,_0xf88c('0x21')];}});}return _0x1cad8e;};exports['omit']=function(_0x39b0ba,_0x365d76){if(_['isEmpty'](_0x39b0ba)){return _0x39b0ba;}if(_[_0xf88c('0x17')](_0x39b0ba)){for(var _0x4cc7ac=0x0;_0x4cc7ac<_0x39b0ba[_0xf88c('0x22')];_0x4cc7ac+=0x1){_0x39b0ba[_0x4cc7ac]=this['omit'](_0x39b0ba[_0x4cc7ac],_0x365d76);}return _0x39b0ba;}if(!_[_0xf88c('0x23')](_0x39b0ba)){return _0x39b0ba;}if(_[_0xf88c('0x24')](_0x365d76)){_0x365d76=[_0x365d76];}if(!_[_0xf88c('0x17')](_0x365d76)){return _0x39b0ba;}for(var _0xba7be=0x0;_0xba7be<_0x365d76[_0xf88c('0x22')];_0xba7be+=0x1){_['unset'](_0x39b0ba,_0x365d76[_0xba7be]);}for(var _0x46c384 in _0x39b0ba){if(_0x39b0ba[_0xf88c('0x25')](_0x46c384)){_0x39b0ba[_0x46c384]=this[_0xf88c('0x26')](_0x39b0ba[_0x46c384],_0x365d76);}}return _0x39b0ba;};exports['isNumeric']=function(_0x3ede23){return _0x3ede23['match'](RegExp(_0xf88c('0x27')))?!![]:![];};exports['isEmail']=function(_0x376eab){return _0x376eab[_0xf88c('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x46ec1e,_0x2922d9){var _0x4a9a01=[];var _0x3de374=/[ `!@#$%^&*()_\-?~]/;var _0x5dfeae=_0x2922d9?_0xf88c('0x29'):_0xf88c('0x2a');_0x46ec1e['split'](/[ ,]+/)[_0xf88c('0x2b')](function(_0x11c8b9){_0x11c8b9=_0x11c8b9[_0xf88c('0x2c')](/([^:]")"+/g,'$1');_0x11c8b9='+'+_0x11c8b9+'*';var _0xa6d3d5=_0x11c8b9[_0xf88c('0x28')](_0x3de374);if(_0xa6d3d5){_0x11c8b9='\x22'+_0x11c8b9+'\x22';}_0x4a9a01[_0xf88c('0x2d')](_0x11c8b9);});_0x5dfeae=_0x5dfeae[_0xf88c('0x2c')]('{EXPR}',_0x4a9a01[_0xf88c('0x2e')]('\x20'));return _0x5dfeae;};exports[_0xf88c('0x2f')]=function(_0x5e3a50,_0x2e3328,_0x39fce3){var _0x5ef49d={},_0x23e41c={};if(_0x2e3328['query']['$id']){_0x2e3328[_0xf88c('0x30')]['id']=_0x2e3328[_0xf88c('0x30')][_0xf88c('0x31')];delete _0x2e3328[_0xf88c('0x30')]['$id'];}_0x5ef49d['model']=_[_0xf88c('0x19')](_0x5e3a50,_0xf88c('0x15'));_0x5ef49d[_0xf88c('0x30')]=_['keys'](_0x2e3328[_0xf88c('0x30')]);_0x5ef49d[_0xf88c('0x32')]=_[_0xf88c('0x33')](_0x5ef49d[_0xf88c('0x7')],_0x5ef49d[_0xf88c('0x30')]);_0x23e41c[_0xf88c('0x34')]=_[_0xf88c('0x33')](_0x5ef49d['model'],this[_0xf88c('0x9')](_0x2e3328['query'][_0xf88c('0x9')]));_0x23e41c[_0xf88c('0x34')]=_0x23e41c[_0xf88c('0x34')][_0xf88c('0x22')]?_0x23e41c[_0xf88c('0x34')]:_0x5ef49d['model'];if(!_0x2e3328[_0xf88c('0x30')][_0xf88c('0x25')](_0xf88c('0x35'))){_0x23e41c['limit']=this['limit'](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x36')]);_0x23e41c['offset']=this[_0xf88c('0x18')](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x18')]);}_0x23e41c[_0xf88c('0x37')]=this[_0xf88c('0x38')](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x38')]);_0x23e41c[_0xf88c('0x39')]=this[_0xf88c('0x32')](_[_0xf88c('0x3a')](_0x2e3328['query'],_0x5ef49d[_0xf88c('0x32')]),_0x5e3a50);if(_0x2e3328[_0xf88c('0x30')][_0xf88c('0x3b')]){var _0x3f20cc=_0x5e3a50;var _0x957125=_0x2e3328['query'][_0xf88c('0x3b')];if(typeof _0x957125===_0xf88c('0x3c')){_0x3f20cc=_['filter'](_0x5e3a50,function(_0x530223){return _[_0xf88c('0x6')](_0x957125['columns'],_0x530223['name']);});_0x957125=_0x957125[_0xf88c('0x3d')];}_0x23e41c[_0xf88c('0x39')]=_[_0xf88c('0x3e')](_0x23e41c[_0xf88c('0x39')],{'$or':_[_0xf88c('0x19')](_0x3f20cc,function(_0xeff2c1){if(_0xeff2c1['type']!==_0xf88c('0x3f')){if(_0x39fce3){return sequelize['where'](sequelize['fn'](_0xf88c('0x40'),sequelize['col'](_0xeff2c1[_0xf88c('0x15')])),{'$like':sequelize['fn'](_0xf88c('0x40'),'%'+_0x2e3328[_0xf88c('0x30')]['filter']+'%')});}else{var _0x2ae5e5={};_0x2ae5e5[_0xeff2c1[_0xf88c('0x15')]]={'$like':'%'+_0x2e3328[_0xf88c('0x30')][_0xf88c('0x3b')]+'%'};return _0x2ae5e5;}}})});}_0x23e41c=_[_0xf88c('0x3e')]({},_0x23e41c,_0x2e3328[_0xf88c('0x41')]);return _0x23e41c;};exports[_0xf88c('0x42')]=function(_0x2eed9d){var _0x17cbe1=[];if(_0x2eed9d[_0xf88c('0x43')]){_0x17cbe1[_0xf88c('0x2d')]({'all':!![]});}else if(_0x2eed9d[_0xf88c('0x42')]){if(Array[_0xf88c('0x17')](_0x2eed9d[_0xf88c('0x42')])){_0x17cbe1=Object['keys'](_0x2eed9d[_0xf88c('0x42')])[_0xf88c('0x19')](function(_0x12bb9d){return parseIncludeModel(_0x2eed9d['include'][_0x12bb9d]);});}else{var _0x884917=parseIncludeModel(_0x2eed9d[_0xf88c('0x42')]);_0x17cbe1['push'](_0x884917);}}return _0x17cbe1;}; \ No newline at end of file +var _0x4b47=['omit','isEmpty','length','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','$id','query','intersection','attributes','model','hasOwnProperty','nolimit','limit','order','where','pick','filter','columns','value','merge','VIRTUAL','lower','options','include','lodash','moment','../../mysqldb','parse','includes','keys','alias','fields','split','filters','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','offset','sort','map','cast','col','priority','unsigned','substr','DESC','ASC'];(function(_0x12e98d,_0x513d9b){var _0x522793=function(_0x30cd5a){while(--_0x30cd5a){_0x12e98d['push'](_0x12e98d['shift']());}};_0x522793(++_0x513d9b);}(_0x4b47,0x1b4));var _0x74b4=function(_0x2a829f,_0x1b0c15){_0x2a829f=_0x2a829f-0x0;var _0x5737c3=_0x4b47[_0x2a829f];return _0x5737c3;};'use strict';var _=require(_0x74b4('0x0'));var sequelize=require('sequelize');var moment=require(_0x74b4('0x1'));var db=require(_0x74b4('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4469a4){var _0x1f5100=['ne'];try{var _0x1f9dac=JSON[_0x74b4('0x3')](_0x4469a4);var _0x565f6b=Object['keys'](_0x1f9dac)[0x0];return _0x1f5100[_0x74b4('0x4')](_0x565f6b);}catch(_0x8459c3){return![];}}function getOperatorValue(_0x4dc737){var _0x4cd397=JSON['parse'](_0x4dc737);var _0x43b434=Object[_0x74b4('0x5')](_0x4cd397)[0x0];var _0x1ebbb8=_0x4cd397[_0x43b434];return{['$'+_0x43b434]:_0x1ebbb8};}function parseIncludeModel(_0x318a0a){var _0x239853=JSON['parse'](_0x318a0a);return{'model':db[_0x239853['model']],'as':_0x239853[_0x74b4('0x6')],'attributes':_0x239853[_0x74b4('0x7')],'raw':_0x239853['raw']};}exports['fields']=function(_0x52c215){var _0x3372e9=null;if(_0x52c215){_0x3372e9=_0x52c215[_0x74b4('0x8')](',');}return _0x3372e9;};exports[_0x74b4('0x9')]=function(_0x400d6f,_0x4c3193){var _0x30c59f={};if(!_['isEmpty'](_0x400d6f)){_[_0x74b4('0xa')](_0x400d6f,function(_0x50bda5,_0x1d1e36){try{if(_0x4c3193){var _0x2b8beb=_[_0x74b4('0xb')](_0x4c3193,{'name':_0x1d1e36})||{};if(hasSequelizeOperator(_0x50bda5)){_0x30c59f[_0x1d1e36]=getOperatorValue(_0x50bda5);}else if(_0x2b8beb[_0x74b4('0xc')]==='DATE'&&_[_0x74b4('0xd')](_0x50bda5)){var _0x2489aa=JSON['parse'](_0x50bda5);var _0x2b3c3b={'$gte':moment(moment(_0x2489aa[_0x74b4('0xe')])[_0x74b4('0xf')](_0x74b4('0x10')))['utc']()[_0x74b4('0xf')](),'$lte':moment(moment(_0x2489aa[_0x74b4('0x11')])['format']('YYYY-MM-DD'))[_0x74b4('0x12')]()[_0x74b4('0x13')](0x1,'s')[_0x74b4('0xf')]()};_0x30c59f[_0x1d1e36]=_0x2b3c3b;}else if(_0x2b8beb[_0x74b4('0x14')]===_0x74b4('0x15')){_0x30c59f[_0x1d1e36]=_0x50bda5;}else{_0x30c59f[_0x1d1e36]=_[_0x74b4('0x16')](_0x50bda5)?_0x50bda5:JSON[_0x74b4('0x3')](_0x50bda5);}}else{_0x30c59f[_0x1d1e36]=_[_0x74b4('0x16')](_0x50bda5)?_0x50bda5:JSON[_0x74b4('0x3')](_0x50bda5);}}catch(_0x2fcbb7){_0x30c59f[_0x1d1e36]=_0x50bda5['split'](',');}});}return _0x30c59f;};exports['limit']=function(_0x3d74d4){_0x3d74d4=parseInt(_0x3d74d4,0xa);if(!_0x3d74d4||_0x3d74d4<0x0){_0x3d74d4=LIMIT_VALUE;}return _0x3d74d4;};exports[_0x74b4('0x17')]=function(_0x49f5e4){_0x49f5e4=parseInt(_0x49f5e4,0xa);if(!_0x49f5e4||_0x49f5e4<0x0){_0x49f5e4=0x0;}return _0x49f5e4;};exports[_0x74b4('0x18')]=function(_0x599a93){var _0x4e93e3,_0x36815a=null;if(_0x599a93){_0x4e93e3=_0x599a93[_0x74b4('0x8')](',');_0x36815a=_[_0x74b4('0x19')](_0x4e93e3,function(_0x1c3a20){if(_0x1c3a20['indexOf']('-')===0x0){return[_0x1c3a20==='priority'?sequelize[_0x74b4('0x1a')](sequelize[_0x74b4('0x1b')](_0x74b4('0x1c')),_0x74b4('0x1d')):_0x1c3a20[_0x74b4('0x1e')](0x1),_0x74b4('0x1f')];}else{return[_0x1c3a20==='priority'?sequelize['cast'](sequelize[_0x74b4('0x1b')](_0x74b4('0x1c')),'unsigned'):_0x1c3a20,_0x74b4('0x20')];}});}return _0x36815a;};exports[_0x74b4('0x21')]=function(_0x3f8019,_0x1a710a){if(_[_0x74b4('0x22')](_0x3f8019)){return _0x3f8019;}if(_['isArray'](_0x3f8019)){for(var _0x4fd6e5=0x0;_0x4fd6e5<_0x3f8019[_0x74b4('0x23')];_0x4fd6e5+=0x1){_0x3f8019[_0x4fd6e5]=this[_0x74b4('0x21')](_0x3f8019[_0x4fd6e5],_0x1a710a);}return _0x3f8019;}if(!_['isObject'](_0x3f8019)){return _0x3f8019;}if(_['isString'](_0x1a710a)){_0x1a710a=[_0x1a710a];}if(!_[_0x74b4('0x16')](_0x1a710a)){return _0x3f8019;}for(var _0x223238=0x0;_0x223238<_0x1a710a['length'];_0x223238+=0x1){_['unset'](_0x3f8019,_0x1a710a[_0x223238]);}for(var _0x5a96f9 in _0x3f8019){if(_0x3f8019['hasOwnProperty'](_0x5a96f9)){_0x3f8019[_0x5a96f9]=this['omit'](_0x3f8019[_0x5a96f9],_0x1a710a);}}return _0x3f8019;};exports[_0x74b4('0x24')]=function(_0x11592f){return _0x11592f['match'](RegExp(_0x74b4('0x25')))?!![]:![];};exports[_0x74b4('0x26')]=function(_0xe583d2){return _0xe583d2[_0x74b4('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x74b4('0x28')]=function(_0x512c5f,_0x1fa370){var _0x43659f=[];var _0x54014e=/[ `!@#$%^&*()_\-?~]/;var _0x16c52e=_0x1fa370?_0x74b4('0x29'):_0x74b4('0x2a');_0x512c5f[_0x74b4('0x8')](/[ ,]+/)[_0x74b4('0x2b')](function(_0x11e83d){_0x11e83d=_0x11e83d[_0x74b4('0x2c')](/([^:]")"+/g,'$1');_0x11e83d='+'+_0x11e83d+'*';var _0x5828f0=_0x11e83d[_0x74b4('0x27')](_0x54014e);if(_0x5828f0){_0x11e83d='\x22'+_0x11e83d+'\x22';}_0x43659f[_0x74b4('0x2d')](_0x11e83d);});_0x16c52e=_0x16c52e[_0x74b4('0x2c')]('{EXPR}',_0x43659f[_0x74b4('0x2e')]('\x20'));return _0x16c52e;};exports[_0x74b4('0x2f')]=function(_0x1020f8,_0x2bc40e,_0x1b0b04){var _0x3f2105={},_0x490edd={};if(_0x2bc40e['query'][_0x74b4('0x30')]){_0x2bc40e[_0x74b4('0x31')]['id']=_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x30')];delete _0x2bc40e[_0x74b4('0x31')][_0x74b4('0x30')];}_0x3f2105['model']=_[_0x74b4('0x19')](_0x1020f8,_0x74b4('0x14'));_0x3f2105['query']=_[_0x74b4('0x5')](_0x2bc40e[_0x74b4('0x31')]);_0x3f2105[_0x74b4('0x9')]=_['intersection'](_0x3f2105['model'],_0x3f2105['query']);_0x490edd['attributes']=_[_0x74b4('0x32')](_0x3f2105['model'],this[_0x74b4('0x7')](_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x7')]));_0x490edd[_0x74b4('0x33')]=_0x490edd['attributes'][_0x74b4('0x23')]?_0x490edd[_0x74b4('0x33')]:_0x3f2105[_0x74b4('0x34')];if(!_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x35')](_0x74b4('0x36'))){_0x490edd[_0x74b4('0x37')]=this[_0x74b4('0x37')](_0x2bc40e[_0x74b4('0x31')]['limit']);_0x490edd['offset']=this[_0x74b4('0x17')](_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x17')]);}_0x490edd[_0x74b4('0x38')]=this[_0x74b4('0x18')](_0x2bc40e[_0x74b4('0x31')]['sort']);_0x490edd[_0x74b4('0x39')]=this[_0x74b4('0x9')](_[_0x74b4('0x3a')](_0x2bc40e[_0x74b4('0x31')],_0x3f2105[_0x74b4('0x9')]),_0x1020f8);if(_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x3b')]){var _0x575e71=_0x1020f8;var _0xbaf0ad=_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x3b')];if(typeof _0xbaf0ad==='object'){_0x575e71=_['filter'](_0x1020f8,function(_0x23e194){return _[_0x74b4('0x4')](_0xbaf0ad[_0x74b4('0x3c')],_0x23e194['name']);});_0xbaf0ad=_0xbaf0ad[_0x74b4('0x3d')];}_0x490edd[_0x74b4('0x39')]=_[_0x74b4('0x3e')](_0x490edd[_0x74b4('0x39')],{'$or':_[_0x74b4('0x19')](_0x575e71,function(_0x462b41){if(_0x462b41[_0x74b4('0xc')]!==_0x74b4('0x3f')){if(_0x1b0b04){return sequelize[_0x74b4('0x39')](sequelize['fn'](_0x74b4('0x40'),sequelize[_0x74b4('0x1b')](_0x462b41['name'])),{'$like':sequelize['fn'](_0x74b4('0x40'),'%'+_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x3b')]+'%')});}else{var _0x988eb3={};_0x988eb3[_0x462b41[_0x74b4('0x14')]]={'$like':'%'+_0x2bc40e[_0x74b4('0x31')][_0x74b4('0x3b')]+'%'};return _0x988eb3;}}})});}_0x490edd=_[_0x74b4('0x3e')]({},_0x490edd,_0x2bc40e[_0x74b4('0x41')]);return _0x490edd;};exports[_0x74b4('0x42')]=function(_0x48fad4){var _0x53c621=[];if(_0x48fad4['includeAll']){_0x53c621[_0x74b4('0x2d')]({'all':!![]});}else if(_0x48fad4[_0x74b4('0x42')]){if(Array['isArray'](_0x48fad4[_0x74b4('0x42')])){_0x53c621=Object[_0x74b4('0x5')](_0x48fad4[_0x74b4('0x42')])[_0x74b4('0x19')](function(_0x559643){return parseIncludeModel(_0x48fad4[_0x74b4('0x42')][_0x559643]);});}else{var _0x177594=parseIncludeModel(_0x48fad4[_0x74b4('0x42')]);_0x53c621[_0x74b4('0x2d')](_0x177594);}}return _0x53c621;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 957bcb8..273985c 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b05=['smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','../../mysqldb','client','http','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','error','result','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','includes','User','name','fullname','chatPause','faxPause','mailPause','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','whatsappPause','chatCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0x1d9a5c,_0x25cdee){var _0x6966d9=function(_0x56e9da){while(--_0x56e9da){_0x1d9a5c['push'](_0x1d9a5c['shift']());}};_0x6966d9(++_0x25cdee);}(_0x9b05,0x121));var _0x59b0=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x9b05[_0x53056c];return _0x5cec88;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x59b0('0x0'))['db'];var amiClient=jayson[_0x59b0('0x1')][_0x59b0('0x2')]({'port':0x232a});var routingClient=jayson[_0x59b0('0x1')][_0x59b0('0x2')]({'port':0x232c});function isAgentPaused(_0x5eb6ee,_0x59873f){var _0xc1c5d5=[_0x5eb6ee['chatPause'],_0x5eb6ee['faxPause'],_0x5eb6ee['mailPause'],_0x5eb6ee[_0x59b0('0x3')],_0x5eb6ee[_0x59b0('0x4')],_0x5eb6ee[_0x59b0('0x5')],_0x5eb6ee['whatsappPause']];if(!_0x59873f)return _['every'](_0xc1c5d5);var _0x3cfe58=_[_0x59b0('0x6')](_0xc1c5d5);return _0x3cfe58[_0x59b0('0x7')]>0x0&&_0x3cfe58[_0x59b0('0x7')]<_0xc1c5d5['length']?!![]:![];}function isIdle(_0x45a10f){return _0x45a10f===_0x59b0('0x8')||_0x45a10f===_0x59b0('0x9')||_0x45a10f===_0x59b0('0xa')||_0x45a10f===_0x59b0('0xb')||_[_0x59b0('0xc')](_0x45a10f);}function isAgentIdle(_0x567a1e){if(_0x567a1e['voiceStatus']!==_0x59b0('0x8')&&_0x567a1e[_0x59b0('0x5')]){_0x567a1e[_0x59b0('0xd')]=_0x59b0('0xe');return![];}return _[_0x59b0('0xf')]([_0x567a1e[_0x59b0('0x10')],_0x567a1e[_0x59b0('0x11')],_0x567a1e[_0x59b0('0x12')],_0x567a1e[_0x59b0('0x13')],_0x567a1e['smsStatus'],_0x567a1e[_0x59b0('0xd')],_0x567a1e[_0x59b0('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x59b0('0x15')]('Agents',{})['then'](function(_0x184078){if(_0x184078[_0x59b0('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4e7af8=_0x184078[_0x59b0('0x17')];return routingClient[_0x59b0('0x15')](_0x59b0('0x18'),{})[_0x59b0('0x19')](function(_0x43e3d5){if(_0x43e3d5[_0x59b0('0x16')]){throw new Error(_0x59b0('0x1a'));}var _0x541e00=_0x43e3d5['result'];return _['merge']({},_0x4e7af8,_0x541e00);});})[_0x59b0('0x1b')](function(_0x1e0a12){throw _0x1e0a12;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x2e5e9f){var _0xdd75c6=_0x59b0('0x9');if(isAgentPaused(_0x2e5e9f))_0xdd75c6=_0x59b0('0xe');else if(isAgentPaused(_0x2e5e9f,!![]))_0xdd75c6='*pause';else if(isAgentIdle(_0x2e5e9f))_0xdd75c6='idle';else _0xdd75c6=_0x59b0('0x1c');return _0xdd75c6;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x502b80,_0x4d7106){var _0x260fc8=_[_0x59b0('0x1d')](_0x502b80)?_0x502b80:[_0x502b80];var _0x13b0e1=_[_0x59b0('0x1e')](_0x4d7106)+_0x59b0('0x1f');var _0x38b2ed=_[_0x59b0('0x20')](_0x260fc8,function(_0x48416c){return db[_0x13b0e1][_0x59b0('0x21')]({'where':{'id':_0x48416c}})[_0x59b0('0x19')](function(_0x157d1a){if(!_0x157d1a)return[];return _0x157d1a[_0x59b0('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x59b0('0x23')](_0x38b2ed)['then'](function(_0x37fcbd){var _0x13fdd8=_(_0x37fcbd)[_0x59b0('0x24')]()['map']('id')['uniq']()['value']();return _0x13fdd8;});}exports[_0x59b0('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x29f1d3,_0x35442c,_0x4d867a){try{if(_0x35442c['length']>0x0){_0x29f1d3=_0x29f1d3[_0x59b0('0x6')](function(_0x450f0c){return _0x35442c[_0x59b0('0x26')](_0x450f0c['id']);});}var _0x1d7429=_0x29f1d3[_0x59b0('0x6')](function(_0x336ca4){var _0x2d501f=_0x59b0('0x1c');if(isAgentIdle(_0x336ca4)){_0x2d501f='idle';}return _0x2d501f===_0x4d867a;});return _[_0x59b0('0x20')](_0x1d7429,'id');}catch(_0x41972d){throw _0x41972d;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b9f70,_0x1fee75,_0x2c8aa4){return Promise['resolve']()[_0x59b0('0x19')](function(){if(_0x1fee75[_0x59b0('0x7')]>0x0){_0x2b9f70=_0x2b9f70[_0x59b0('0x6')](function(_0x318d82){return _0x1fee75['includes'](_0x318d82['id']);});}return _0x2b9f70;})[_0x59b0('0x19')](function(){return db[_0x59b0('0x27')]['findAll']({'attributes':['id',_0x59b0('0x28'),_0x59b0('0x29'),_0x59b0('0x2a'),_0x59b0('0x2b'),_0x59b0('0x2c'),_0x59b0('0x3'),_0x59b0('0x4'),_0x59b0('0x5'),'whatsappPause',_0x59b0('0x2d')],'where':{'id':{'$in':_[_0x59b0('0x20')](_0x2b9f70,'id')}},'raw':!![]});})[_0x59b0('0x19')](function(_0x2bb66b){return _0x2bb66b[_0x59b0('0x20')](function(_0x44de7e){var _0x2cfc8c=_[_0x59b0('0x2e')](_0x2b9f70,['id',_0x44de7e['id']]);var _0x5a9610=filterAgentAttributes(_0x2cfc8c);_[_0x59b0('0x2f')](_0x44de7e,_0x5a9610);_0x44de7e[_0x59b0('0x30')]=getAgentStatus(_0x44de7e);return _0x44de7e;});})['then'](function(_0x3defed){var _0x3c4c8a=sortAgentsByStatus(_0x3defed,_0x2c8aa4);return _['map'](_0x3c4c8a,'id');})[_0x59b0('0x1b')](function(_0x2654b1){throw _0x2654b1;});}exports[_0x59b0('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x440c28){var _0x287e26={'fields':[],'order':null};var _0x5192dc=_0x440c28[_0x59b0('0x32')](',');_0x287e26['fields']=_['filter'](_0x5192dc,function(_0x126e02){if(!_0x126e02[_0x59b0('0x26')](_0x59b0('0x30'))){return!![];}_0x287e26[_0x59b0('0x33')]=_[_0x59b0('0x34')](_0x126e02,'-')?'DESC':_0x59b0('0x35');return![];});return _0x287e26;}exports[_0x59b0('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x4a4e6e){if(!_0x4a4e6e){_0x4a4e6e=_0x59b0('0x37');}if(_0x4a4e6e[_0x59b0('0x26')](_0x59b0('0x29'))&&!_0x4a4e6e[_0x59b0('0x26')](_0x59b0('0x38'))){var _0x1ccca9=_0x4a4e6e[_0x59b0('0x39')](0x0,_0x4a4e6e[_0x59b0('0x3a')](_0x59b0('0x29')));_0x4a4e6e+=','+_0x1ccca9+_0x59b0('0x38');}return _0x4a4e6e;}exports[_0x59b0('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x245528,_0x323fdb){var _0x34a9fd=_0x245528[_0x59b0('0x3c')](function(_0x1758a7,_0x2c32a2){if(_0x1758a7['globalStatus']===_0x2c32a2['globalStatus']){if(_0x1758a7[_0x59b0('0x30')]===_0x59b0('0xe')){if(_0x323fdb===_0x59b0('0x3d')){return(_0x1758a7['pauseType']||'')<(_0x2c32a2[_0x59b0('0x2d')]||'')||_0x1758a7[_0x59b0('0x29')]['toLowerCase']()>_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?0x1:-0x1;}else{return(_0x1758a7[_0x59b0('0x2d')]||'')<(_0x2c32a2['pauseType']||'')||_0x1758a7[_0x59b0('0x29')][_0x59b0('0x3e')]()>_0x2c32a2['fullname'][_0x59b0('0x3e')]()?-0x1:0x1;}}else{if(_0x323fdb===_0x59b0('0x3d')){return _0x1758a7[_0x59b0('0x29')]['toLowerCase']()<_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?0x1:-0x1;}else{return _0x1758a7[_0x59b0('0x29')]['toLowerCase']()<_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?-0x1:0x1;}}}else{if(_0x323fdb==='DESC'){return _0x1758a7[_0x59b0('0x30')]<_0x2c32a2['globalStatus']?0x1:-0x1;}else{return _0x1758a7[_0x59b0('0x30')]<_0x2c32a2[_0x59b0('0x30')]?-0x1:0x1;}}});return _0x34a9fd;}exports[_0x59b0('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x15638b){var _0x21c90d=[_0x59b0('0x40'),_0x59b0('0x41'),'lastLoginAt',_0x59b0('0x42'),_0x59b0('0x2d'),'lastPauseAt','internal',_0x59b0('0x43'),'chatPause',_0x59b0('0x3'),_0x59b0('0x2c'),'smsPause',_0x59b0('0x44'),_0x59b0('0x2b'),_0x59b0('0x5'),_0x59b0('0x45'),'openchannelCapacity',_0x59b0('0x46'),'smsCapacity',_0x59b0('0x47'),'faxCapacity',_0x59b0('0x48'),_0x59b0('0x49'),_0x59b0('0x4a'),_0x59b0('0x4b'),'whatsappCurrentCapacity',_0x59b0('0x4c'),_0x59b0('0x10'),_0x59b0('0x13'),'mailStatus','smsStatus',_0x59b0('0x14'),_0x59b0('0x11'),'voiceStatus',_0x59b0('0x4d'),_0x59b0('0x4e'),'mailStatusTime',_0x59b0('0x4f'),'whatsappStatusTime',_0x59b0('0x50'),_0x59b0('0x51'),_0x59b0('0x52'),_0x59b0('0x53'),_0x59b0('0x54'),_0x59b0('0x55'),_0x59b0('0x56'),_0x59b0('0x57')];var _0x52e874=[_0x59b0('0x2a'),'openchannelPause',_0x59b0('0x2c'),_0x59b0('0x4'),_0x59b0('0x44'),_0x59b0('0x2b'),_0x59b0('0x5'),_0x59b0('0x41')];var _0x862ea4=_(_0x15638b)[_0x59b0('0x58')](_0x52e874)[_0x59b0('0x59')](_0x21c90d)['value']();return _0x862ea4;}exports[_0x59b0('0x5a')]=filterAgentAttributes; \ No newline at end of file +var _0x2f4d=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','idle','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','startCase','getAgents','all','uniq','value','includes','busy','map','resolve','User','name','fullname','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','fullname,internal','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity'];(function(_0x5252bd,_0x394481){var _0x4737df=function(_0xd04190){while(--_0xd04190){_0x5252bd['push'](_0x5252bd['shift']());}};_0x4737df(++_0x394481);}(_0x2f4d,0xbe));var _0xd2f4=function(_0x4cd447,_0x2eabb0){_0x4cd447=_0x4cd447-0x0;var _0x4810ab=_0x2f4d[_0x4cd447];return _0x4810ab;};'use strict';var _=require(_0xd2f4('0x0'));var jayson=require(_0xd2f4('0x1'));var db=require(_0xd2f4('0x2'))['db'];var amiClient=jayson['client'][_0xd2f4('0x3')]({'port':0x232a});var routingClient=jayson[_0xd2f4('0x4')]['http']({'port':0x232c});function isAgentPaused(_0x840c77,_0x24fffd){var _0x282397=[_0x840c77[_0xd2f4('0x5')],_0x840c77[_0xd2f4('0x6')],_0x840c77['mailPause'],_0x840c77[_0xd2f4('0x7')],_0x840c77[_0xd2f4('0x8')],_0x840c77[_0xd2f4('0x9')],_0x840c77[_0xd2f4('0xa')]];if(!_0x24fffd)return _[_0xd2f4('0xb')](_0x282397);var _0x3a60b8=_[_0xd2f4('0xc')](_0x282397);return _0x3a60b8['length']>0x0&&_0x3a60b8[_0xd2f4('0xd')]<_0x282397[_0xd2f4('0xd')]?!![]:![];}function isIdle(_0x18f607){return _0x18f607==='idle'||_0x18f607===_0xd2f4('0xe')||_0x18f607===_0xd2f4('0xf')||_0x18f607===_0xd2f4('0x10')||_['isNil'](_0x18f607);}function isAgentIdle(_0xff463b){if(_0xff463b['voiceStatus']!==_0xd2f4('0x11')&&_0xff463b[_0xd2f4('0x9')]){_0xff463b[_0xd2f4('0x12')]=_0xd2f4('0x13');return![];}return _[_0xd2f4('0xb')]([_0xff463b[_0xd2f4('0x14')],_0xff463b[_0xd2f4('0x15')],_0xff463b[_0xd2f4('0x16')],_0xff463b[_0xd2f4('0x17')],_0xff463b[_0xd2f4('0x18')],_0xff463b['voiceStatus'],_0xff463b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xd2f4('0x19')](_0xd2f4('0x1a'),{})[_0xd2f4('0x1b')](function(_0x532c44){if(_0x532c44['error']){throw new Error(_0xd2f4('0x1c'));}var _0x52ce60=_0x532c44['result'];return routingClient[_0xd2f4('0x19')](_0xd2f4('0x1a'),{})[_0xd2f4('0x1b')](function(_0x10e4b2){if(_0x10e4b2[_0xd2f4('0x1d')]){throw new Error(_0xd2f4('0x1e'));}var _0x593686=_0x10e4b2[_0xd2f4('0x1f')];return _[_0xd2f4('0x20')]({},_0x52ce60,_0x593686);});})[_0xd2f4('0x21')](function(_0x9e5484){throw _0x9e5484;});}exports[_0xd2f4('0x22')]=getRealtimeAgents;function getAgentStatus(_0xfd574){var _0x24b9c5='unknown';if(isAgentPaused(_0xfd574))_0x24b9c5='pause';else if(isAgentPaused(_0xfd574,!![]))_0x24b9c5='*pause';else if(isAgentIdle(_0xfd574))_0x24b9c5=_0xd2f4('0x11');else _0x24b9c5='busy';return _0x24b9c5;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x5b7bbf,_0x5d845c){var _0x128b64=_['isArray'](_0x5b7bbf)?_0x5b7bbf:[_0x5b7bbf];var _0x5262d1=_[_0xd2f4('0x23')](_0x5d845c)+'Queue';var _0xe9e2af=_['map'](_0x128b64,function(_0x4b6670){return db[_0x5262d1]['findOne']({'where':{'id':_0x4b6670}})['then'](function(_0x1081b0){if(!_0x1081b0)return[];return _0x1081b0[_0xd2f4('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd2f4('0x25')](_0xe9e2af)['then'](function(_0x596374){var _0x102bcc=_(_0x596374)['flatten']()['map']('id')[_0xd2f4('0x26')]()[_0xd2f4('0x27')]();return _0x102bcc;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x57d801,_0x267741,_0x401fe3){try{if(_0x267741[_0xd2f4('0xd')]>0x0){_0x57d801=_0x57d801[_0xd2f4('0xc')](function(_0x5502fe){return _0x267741[_0xd2f4('0x28')](_0x5502fe['id']);});}var _0x420b3b=_0x57d801['filter'](function(_0x13cb20){var _0x5ab1a4=_0xd2f4('0x29');if(isAgentIdle(_0x13cb20)){_0x5ab1a4=_0xd2f4('0x11');}return _0x5ab1a4===_0x401fe3;});return _[_0xd2f4('0x2a')](_0x420b3b,'id');}catch(_0x240b24){throw _0x240b24;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x25115f,_0x237632,_0x2cfd7b){return Promise[_0xd2f4('0x2b')]()['then'](function(){if(_0x237632[_0xd2f4('0xd')]>0x0){_0x25115f=_0x25115f['filter'](function(_0x488c93){return _0x237632[_0xd2f4('0x28')](_0x488c93['id']);});}return _0x25115f;})[_0xd2f4('0x1b')](function(){return db[_0xd2f4('0x2c')]['findAll']({'attributes':['id',_0xd2f4('0x2d'),_0xd2f4('0x2e'),'chatPause',_0xd2f4('0x6'),_0xd2f4('0x2f'),_0xd2f4('0x7'),'smsPause',_0xd2f4('0x9'),_0xd2f4('0xa'),_0xd2f4('0x30')],'where':{'id':{'$in':_[_0xd2f4('0x2a')](_0x25115f,'id')}},'raw':!![]});})[_0xd2f4('0x1b')](function(_0x6c798){return _0x6c798[_0xd2f4('0x2a')](function(_0x47c13d){var _0x73e31e=_['find'](_0x25115f,['id',_0x47c13d['id']]);var _0x3e125d=filterAgentAttributes(_0x73e31e);_['merge'](_0x47c13d,_0x3e125d);_0x47c13d[_0xd2f4('0x31')]=getAgentStatus(_0x47c13d);return _0x47c13d;});})['then'](function(_0x574691){var _0x5a21c2=sortAgentsByStatus(_0x574691,_0x2cfd7b);return _[_0xd2f4('0x2a')](_0x5a21c2,'id');})[_0xd2f4('0x21')](function(_0x16709a){throw _0x16709a;});}exports[_0xd2f4('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x6b8a33){var _0x1fb8b0={'fields':[],'order':null};var _0x55d917=_0x6b8a33[_0xd2f4('0x33')](',');_0x1fb8b0[_0xd2f4('0x34')]=_[_0xd2f4('0xc')](_0x55d917,function(_0x50e536){if(!_0x50e536[_0xd2f4('0x28')](_0xd2f4('0x31'))){return!![];}_0x1fb8b0[_0xd2f4('0x35')]=_[_0xd2f4('0x36')](_0x50e536,'-')?_0xd2f4('0x37'):'ASC';return![];});return _0x1fb8b0;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x4cc04d){if(!_0x4cc04d){_0x4cc04d=_0xd2f4('0x38');}if(_0x4cc04d[_0xd2f4('0x28')]('fullname')&&!_0x4cc04d['includes'](_0xd2f4('0x39'))){var _0x525948=_0x4cc04d[_0xd2f4('0x3a')](0x0,_0x4cc04d[_0xd2f4('0x3b')](_0xd2f4('0x2e')));_0x4cc04d+=','+_0x525948+_0xd2f4('0x39');}return _0x4cc04d;}exports[_0xd2f4('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x16ac72,_0x20bef2){var _0x476d03=_0x16ac72['sort'](function(_0x410c68,_0x51c6a4){if(_0x410c68['globalStatus']===_0x51c6a4[_0xd2f4('0x31')]){if(_0x410c68[_0xd2f4('0x31')]===_0xd2f4('0x13')){if(_0x20bef2===_0xd2f4('0x37')){return(_0x410c68[_0xd2f4('0x30')]||'')<(_0x51c6a4[_0xd2f4('0x30')]||'')||_0x410c68[_0xd2f4('0x2e')]['toLowerCase']()>_0x51c6a4[_0xd2f4('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x410c68[_0xd2f4('0x30')]||'')<(_0x51c6a4[_0xd2f4('0x30')]||'')||_0x410c68[_0xd2f4('0x2e')][_0xd2f4('0x3d')]()>_0x51c6a4[_0xd2f4('0x2e')][_0xd2f4('0x3d')]()?-0x1:0x1;}}else{if(_0x20bef2===_0xd2f4('0x37')){return _0x410c68[_0xd2f4('0x2e')][_0xd2f4('0x3d')]()<_0x51c6a4[_0xd2f4('0x2e')][_0xd2f4('0x3d')]()?0x1:-0x1;}else{return _0x410c68[_0xd2f4('0x2e')]['toLowerCase']()<_0x51c6a4[_0xd2f4('0x2e')][_0xd2f4('0x3d')]()?-0x1:0x1;}}}else{if(_0x20bef2===_0xd2f4('0x37')){return _0x410c68['globalStatus']<_0x51c6a4['globalStatus']?0x1:-0x1;}else{return _0x410c68[_0xd2f4('0x31')]<_0x51c6a4['globalStatus']?-0x1:0x1;}}});return _0x476d03;}exports[_0xd2f4('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x2b3063){var _0x3adc6e=[_0xd2f4('0x3f'),_0xd2f4('0x40'),_0xd2f4('0x41'),'lastPauseAt','pauseType','lastPauseAt',_0xd2f4('0x39'),'address',_0xd2f4('0x5'),_0xd2f4('0x7'),'mailPause',_0xd2f4('0x8'),_0xd2f4('0xa'),'faxPause',_0xd2f4('0x9'),_0xd2f4('0x42'),_0xd2f4('0x43'),_0xd2f4('0x44'),_0xd2f4('0x45'),_0xd2f4('0x46'),_0xd2f4('0x47'),_0xd2f4('0x48'),_0xd2f4('0x49'),_0xd2f4('0x4a'),'smsCurrentCapacity',_0xd2f4('0x4b'),_0xd2f4('0x4c'),_0xd2f4('0x14'),_0xd2f4('0x17'),_0xd2f4('0x16'),'smsStatus','whatsappStatus',_0xd2f4('0x15'),_0xd2f4('0x12'),_0xd2f4('0x4d'),_0xd2f4('0x4e'),_0xd2f4('0x4f'),'smsStatusTime',_0xd2f4('0x50'),'faxStatusTime','voiceStatusTime','queue',_0xd2f4('0x51'),_0xd2f4('0x52'),'phoneBarEnableScreenRecordingByAgent',_0xd2f4('0x53'),_0xd2f4('0x54')];var _0x3a2823=[_0xd2f4('0x5'),_0xd2f4('0x7'),_0xd2f4('0x2f'),_0xd2f4('0x8'),'whatsappPause','faxPause',_0xd2f4('0x9'),'online'];var _0x229ad1=_(_0x2b3063)[_0xd2f4('0x55')](_0x3a2823)['pick'](_0x3adc6e)[_0xd2f4('0x27')]();return _0x229ad1;}exports[_0xd2f4('0x56')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 5ba1d29..ba14438 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x298e=['startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','get','loggedIn','outbound','pTalking','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','talking','unavailable','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice'];(function(_0x221888,_0x1d2891){var _0x18bc6c=function(_0x485060){while(--_0x485060){_0x221888['push'](_0x221888['shift']());}};_0x18bc6c(++_0x1d2891);}(_0x298e,0x1ef));var _0xe298=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x298e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe298('0x0'));var jayson=require(_0xe298('0x1'));var util=require(_0xe298('0x2'));var amiClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232a});var routingClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe298('0x5'),'loggedIn',_0xe298('0x6'),_0xe298('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe298('0x8'),_0xe298('0x9'),'invalid',_0xe298('0xa'),'notInUse',_0xe298('0xb'),_0xe298('0xc'),'ringInUse',_0xe298('0xd'),_0xe298('0xe'),_0xe298('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0xe298('0x10'),_0xe298('0x11'),_0xe298('0x12'),_0xe298('0x13'),_0xe298('0x14'),_0xe298('0x15'),'erlangCalls','erlangCallToSecond',_0xe298('0x16'),_0xe298('0x17'),_0xe298('0x18'),_0xe298('0x19'),_0xe298('0x1a'),_0xe298('0x1b'),_0xe298('0x1c'),_0xe298('0x1d'),_0xe298('0x1e'),_0xe298('0x1f'),_0xe298('0x20'),_0xe298('0x21')];function getRealtimeQueues(_0x4aa75e,_0x35b313){var _0xf24fc0=_0x35b313===_0xe298('0x22')?amiClient:routingClient;return _0xf24fc0['request'](_[_0xe298('0x23')](_0x35b313)+_0xe298('0x24'),_0x4aa75e)[_0xe298('0x25')](function(_0x5ed73d){if(_0x5ed73d['error'])throw new Error(util[_0xe298('0x26')](_0xe298('0x27'),_0x35b313));return _0x5ed73d[_0xe298('0x28')];})[_0xe298('0x29')](function(_0x212e4a){throw _0x212e4a;});}exports[_0xe298('0x2a')]=getRealtimeQueues;function initializeQueues(_0x33f9c9,_0x34169f,_0x4006e1,_0x2dfca3){var _0x1a056f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4006e1===_0xe298('0x22')){if(_0x2dfca3===_0xe298('0x2b')){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2dfca3==='outbound'){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x33f9c9['map'](function(_0x169c2e){var _0xf63556=_0x169c2e[_0xe298('0x2d')]({'plain':!![]});_0xf63556['paused']=0x0;_0xf63556[_0xe298('0xa')]=0x0;_0xf63556[_0xe298('0x2e')]=0x0;_0xf63556['available']=0x0;_0xf63556[_0xe298('0x7')]=0x0;if(_0x4006e1===_0xe298('0x22')){_0xf63556[_0xe298('0xd')]=0x0;_0xf63556[_0xe298('0x8')]=0x0;if(_0x2dfca3===_0xe298('0x2f')){_0xf63556[_0xe298('0x30')]=0x0;_0xf63556[_0xe298('0x31')]=0x0;}}var _0x15389a=_['find'](_0x34169f,['id',_0xf63556['id']]);if(_0x15389a){_[_0xe298('0x32')](_0xf63556,_[_0xe298('0x33')](_0x15389a,_0x1a056f));}return _0xf63556;});}exports[_0xe298('0x34')]=initializeQueues; \ No newline at end of file +var _0x29c2=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','get','available','outbound','find','merge','pick','initializeQueues','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','unknown','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x50c46f,_0x2d4f76){var _0x3a92a6=function(_0x1830ef){while(--_0x1830ef){_0x50c46f['push'](_0x50c46f['shift']());}};_0x3a92a6(++_0x2d4f76);}(_0x29c2,0x7f));var _0x229c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x29c2[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var jayson=require(_0x229c('0x0'));var util=require(_0x229c('0x1'));var amiClient=jayson[_0x229c('0x2')][_0x229c('0x3')]({'port':0x232a});var routingClient=jayson[_0x229c('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x229c('0x4'),_0x229c('0x5'),_0x229c('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x229c('0x7'),_0x229c('0x8'),_0x229c('0x9'),_0x229c('0xa'),'notInUse',_0x229c('0xb'),_0x229c('0xc'),_0x229c('0xd'),'talking','unavailable',_0x229c('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x229c('0xf'),_0x229c('0x10'),'message','statusMessage',_0x229c('0x11'),_0x229c('0x12'),_0x229c('0x13'),_0x229c('0x14'),_0x229c('0x15'),_0x229c('0x16'),_0x229c('0x17'),_0x229c('0x18'),_0x229c('0x19'),_0x229c('0x1a'),_0x229c('0x1b'),'dialPredictiveIntervalMinThreshold',_0x229c('0x1c'),_0x229c('0x1d'),_0x229c('0x1e'),_0x229c('0x1f'),_0x229c('0x20'),'predictiveIntervalAvgHoldtime',_0x229c('0x21')];function getRealtimeQueues(_0x34ecf0,_0x381587){var _0x5bfb98=_0x381587===_0x229c('0x22')?amiClient:routingClient;return _0x5bfb98[_0x229c('0x23')](_[_0x229c('0x24')](_0x381587)+_0x229c('0x25'),_0x34ecf0)[_0x229c('0x26')](function(_0x5adf48){if(_0x5adf48[_0x229c('0x27')])throw new Error(util[_0x229c('0x28')](_0x229c('0x29'),_0x381587));return _0x5adf48[_0x229c('0x2a')];})[_0x229c('0x2b')](function(_0xa024a4){throw _0xa024a4;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x2667f3,_0x2e0291,_0x10f9f2,_0x56bdd1){var _0x115069=DEFAULT_QUEUE_ATTRIBUTES;if(_0x10f9f2===_0x229c('0x22')){if(_0x56bdd1===_0x229c('0x2c')){_0x115069=_0x115069[_0x229c('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x56bdd1==='outbound'){_0x115069=_0x115069[_0x229c('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2667f3['map'](function(_0x5e13f7){var _0x184044=_0x5e13f7[_0x229c('0x2e')]({'plain':!![]});_0x184044[_0x229c('0x5')]=0x0;_0x184044['loggedInDb']=0x0;_0x184044[_0x229c('0x4')]=0x0;_0x184044[_0x229c('0x2f')]=0x0;_0x184044['waiting']=0x0;if(_0x10f9f2===_0x229c('0x22')){_0x184044['talking']=0x0;_0x184044['busy']=0x0;if(_0x56bdd1===_0x229c('0x30')){_0x184044['pTalking']=0x0;_0x184044['originated']=0x0;}}var _0x731a91=_[_0x229c('0x31')](_0x2e0291,['id',_0x184044['id']]);if(_0x731a91){_[_0x229c('0x32')](_0x184044,_[_0x229c('0x33')](_0x731a91,_0x115069));}return _0x184044;});}exports[_0x229c('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e6759a4..479380c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a901a01..d143e27 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 _0x668f=['substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','createHash','digest','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','md5','update'];(function(_0x471cec,_0x5394b6){var _0x166300=function(_0xca113e){while(--_0xca113e){_0x471cec['push'](_0x471cec['shift']());}};_0x166300(++_0x5394b6);}(_0x668f,0x1dd));var _0xf668=function(_0x1e4df1,_0x208905){_0x1e4df1=_0x1e4df1-0x0;var _0x584edf=_0x668f[_0x1e4df1];return _0x584edf;};'use strict';var _=require(_0xf668('0x0'));var os=require('os');var crypto=require(_0xf668('0x1'));var machine=require(_0xf668('0x2'));var exec=require(_0xf668('0x3'))['execSync'];var config=require(_0xf668('0x4'));function getInterfaces(){var _0x1e9917=[];var _0x1387b3=os[_0xf668('0x5')]();var _0x54fb5a=_['orderBy'](_[_0xf668('0x6')](_0x1387b3));for(var _0x1aaa17=0x0;_0x1aaa17<_0x54fb5a['length'];_0x1aaa17++){var _0x59996c=_0x1387b3[_0x54fb5a[_0x1aaa17]]['filter'](function(_0xc46f15){return _0xc46f15['family']==='IPv4'&&_0xc46f15[_0xf668('0x7')]===![];});_0x1e9917=_0x1e9917[_0xf668('0x8')](_0x59996c);}return _0x1e9917;}function getFirstInterface(){var _0x5bab95=_[_0xf668('0x9')](getInterfaces());return{'macAddress':_0x5bab95&&_0x5bab95['mac']?_0x5bab95[_0xf668('0xa')]:_0xf668('0xb'),'ipAddress':_0x5bab95&&_0x5bab95[_0xf668('0xc')]?_0x5bab95[_0xf668('0xc')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4a4117=_['orderBy'](os[_0xf668('0xd')]()[_0xf668('0xe')](function(_0x418b6a){return _0x418b6a['model'];}))['join'](':');return crypto[_0xf668('0xf')]('md5')['update'](_0x4a4117)[_0xf668('0x10')](_0xf668('0x11'));}exports[_0xf668('0x12')]=function(){var _0x4ff54e=os[_0xf668('0x13')]();var _0x4fd8c=/[0-9a-f-]{36}/;if(config[_0xf668('0x14')]&&_0x4fd8c['test'](config[_0xf668('0x14')])){return config[_0xf668('0x14')];}else if(_0x4ff54e==='win32'){return exec(_0xf668('0x15'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x57377c=getFirstInterface();var _0x89453e=getCPUhash();var _0x72952d=_0x89453e+'|'+os[_0xf668('0x16')]()+'|'+_0x57377c[_0xf668('0x17')]+'|'+_0x57377c[_0xf668('0x18')];var _0x280eab=crypto[_0xf668('0xf')](_0xf668('0x19'))[_0xf668('0x1a')](_0x72952d)[_0xf668('0x10')]('hex');return _0x280eab['substring'](0x0,0x8)+'-'+_0x280eab[_0xf668('0x1b')](0x8,0xc)+'-'+_0x280eab[_0xf668('0x1b')](0xc,0x10)+'-'+_0x280eab['substring'](0x10,0x14)+'-'+_0x280eab[_0xf668('0x1b')](0x14);}}; \ No newline at end of file +var _0xf662=['cpus','model','join','createHash','digest','hex','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','md5','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface'];(function(_0x37e92a,_0xc00ec){var _0x18128c=function(_0x154501){while(--_0x154501){_0x37e92a['push'](_0x37e92a['shift']());}};_0x18128c(++_0xc00ec);}(_0xf662,0xc0));var _0x2f66=function(_0x4e7fbe,_0x585460){_0x4e7fbe=_0x4e7fbe-0x0;var _0x2e2277=_0xf662[_0x4e7fbe];return _0x2e2277;};'use strict';var _=require(_0x2f66('0x0'));var os=require('os');var crypto=require(_0x2f66('0x1'));var machine=require(_0x2f66('0x2'));var exec=require(_0x2f66('0x3'))['execSync'];var config=require(_0x2f66('0x4'));function getInterfaces(){var _0x552cb4=[];var _0x5bd411=os[_0x2f66('0x5')]();var _0x2c8a20=_[_0x2f66('0x6')](_[_0x2f66('0x7')](_0x5bd411));for(var _0x146e64=0x0;_0x146e64<_0x2c8a20[_0x2f66('0x8')];_0x146e64++){var _0x536f36=_0x5bd411[_0x2c8a20[_0x146e64]]['filter'](function(_0x90a342){return _0x90a342[_0x2f66('0x9')]===_0x2f66('0xa')&&_0x90a342[_0x2f66('0xb')]===![];});_0x552cb4=_0x552cb4[_0x2f66('0xc')](_0x536f36);}return _0x552cb4;}function getFirstInterface(){var _0x44da7d=_[_0x2f66('0xd')](getInterfaces());return{'macAddress':_0x44da7d&&_0x44da7d[_0x2f66('0xe')]?_0x44da7d[_0x2f66('0xe')]:_0x2f66('0xf'),'ipAddress':_0x44da7d&&_0x44da7d[_0x2f66('0x10')]?_0x44da7d['address']:'127.0.0.1'};}exports[_0x2f66('0x11')]=getFirstInterface;function getCPUhash(){var _0x402bf7=_[_0x2f66('0x6')](os[_0x2f66('0x12')]()['map'](function(_0x5cd14c){return _0x5cd14c[_0x2f66('0x13')];}))[_0x2f66('0x14')](':');return crypto[_0x2f66('0x15')]('md5')['update'](_0x402bf7)[_0x2f66('0x16')](_0x2f66('0x17'));}exports['getUuid']=function(){var _0x428223=os[_0x2f66('0x18')]();var _0x50b936=/[0-9a-f-]{36}/;if(config[_0x2f66('0x19')]&&_0x50b936[_0x2f66('0x1a')](config[_0x2f66('0x19')])){return config[_0x2f66('0x19')];}else if(_0x428223==='win32'){return exec(_0x2f66('0x1b'),{'encoding':'utf8'})[_0x2f66('0x1c')]('\x0d\x0a','');}else{var _0x1bfe79=getFirstInterface();var _0x4fe24f=getCPUhash();var _0x5eb43b=_0x4fe24f+'|'+os[_0x2f66('0x1d')]()+'|'+_0x1bfe79[_0x2f66('0x1e')]+'|'+_0x1bfe79[_0x2f66('0x1f')];var _0x4ab6eb=crypto[_0x2f66('0x15')](_0x2f66('0x20'))[_0x2f66('0x21')](_0x5eb43b)[_0x2f66('0x16')](_0x2f66('0x17'));return _0x4ab6eb[_0x2f66('0x22')](0x0,0x8)+'-'+_0x4ab6eb['substring'](0x8,0xc)+'-'+_0x4ab6eb[_0x2f66('0x22')](0xc,0x10)+'-'+_0x4ab6eb[_0x2f66('0x22')](0x10,0x14)+'-'+_0x4ab6eb[_0x2f66('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e02c848..0db785f 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 _0x7371=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x7371,0x14c));var _0x1737=function(_0x5012c3,_0x45c477){_0x5012c3=_0x5012c3-0x0;var _0xfded74=_0x7371[_0x5012c3];return _0xfded74;};'use strict';var util=require(_0x1737('0x0'));var moment=require(_0x1737('0x1'));var rp=require('request-promise');var BPromise=require(_0x1737('0x2'));var pkginfo=require(_0x1737('0x3'))(module,_0x1737('0x4'));var db=require(_0x1737('0x5'))['db'];var encryptor=require(_0x1737('0x6'));var hardware=require('./hardware');var logger=require(_0x1737('0x7'))(_0x1737('0x8'));var HOST=_0x1737('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x593f16){return new BPromise(function(_0x526564,_0xabd7be){var _0x45bc50=util[_0x1737('0xa')](_0x1737('0xb'),HOST,_0x593f16,module[_0x1737('0xc')][_0x1737('0x4')]);if(oldToken){_0x45bc50=util[_0x1737('0xa')](_0x1737('0xd'),HOST,_0x593f16,module[_0x1737('0xc')][_0x1737('0x4')],oldToken);}var _0x7b3e48={'uri':_0x45bc50,'method':_0x1737('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x7b3e48)[_0x1737('0xf')](function(_0x255edc){_0x526564(_0x255edc);})[_0x1737('0x10')](function(_0x5dc2f8){_0xabd7be(_0x5dc2f8);});});}function manageLicense(_0x24be43,_0x597de6){var _0x28f571=_0x597de6[_0x1737('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x28f571[_0x1737('0x12')]!==_0x24be43&&!_0x28f571[_0x1737('0x13')]){oldToken=_0x28f571[_0x1737('0x12')];}httpRequest(_0x24be43)[_0x1737('0xf')](function(_0x4ac727){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ac727['active']){isOldTokenSent=![];if(!_0x28f571[_0x1737('0x8')]&&_0x28f571[_0x1737('0x8')]!=_0x4ac727[_0x1737('0x8')]||_0x28f571[_0x1737('0x8')]&&_0x28f571['data2']){logger[_0x1737('0x14')](_0x1737('0x15'));}if(_0x28f571[_0x1737('0x8')]&&!_0x28f571[_0x1737('0x13')]&&_0x28f571['license']!=_0x4ac727[_0x1737('0x8')]){logger[_0x1737('0x14')](_0x1737('0x16'));}if(_0x28f571[_0x1737('0x8')]&&!_0x28f571[_0x1737('0x13')]&&_0x28f571[_0x1737('0x8')]==_0x4ac727[_0x1737('0x8')]){return _0x597de6;}return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':_0x4ac727[_0x1737('0x8')]});}else{if(_0x4ac727['license']||_0x28f571[_0x1737('0x8')]){if(!_0x28f571['data2']){if(_0x28f571[_0x1737('0x12')]==_0x24be43){GRAY_PERIOD_REASON=_0x1737('0x18');logger[_0x1737('0x14')](_0x1737('0x19'));}else{GRAY_PERIOD_REASON=_0x1737('0x1a');logger[_0x1737('0x14')](_0x1737('0x1b'),_0x28f571[_0x1737('0x12')],_0x24be43);}logger[_0x1737('0x14')](_0x1737('0x1c'),GRAY_PERIOD_REASON[_0x1737('0x1d')](),moment()[_0x1737('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x597de6[_0x1737('0x17')]({'data2':encryptor[_0x1737('0x1e')](moment()[_0x1737('0xa')](_0x1737('0x1f')))});}else{if(moment()['diff'](encryptor[_0x1737('0x20')](_0x28f571['data2']),_0x1737('0x21'))>DAYS){logger[_0x1737('0x14')](_0x1737('0x22'),moment()[_0x1737('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':null});}}}else{if(_0x28f571['data1']!=_0x24be43){logger['info'](_0x1737('0x1b'),_0x28f571['data1'],_0x24be43);return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':null});}}}return _0x597de6;})[_0x1737('0xf')](function(_0x50a0a8){_0x597de6=_0x50a0a8;})[_0x1737('0x10')](function(_0x4d52c4){logger['error'](_0x4d52c4['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x1737('0x23')](),_0x597de6);},TIME);});}function defaultLicense(){var _0x30ed8d=hardware[_0x1737('0x23')]();if(_0x30ed8d){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x30ed8d}})[_0x1737('0x24')](function(_0xc4c5df,_0x4cfa86){logger['info'](_0x1737('0x25'),_0x30ed8d);manageLicense(_0x30ed8d,_0xc4c5df);})[_0x1737('0x10')](function(_0x1ec716){logger[_0x1737('0x26')](_0x1ec716[_0x1737('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x82df=['catch','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','exports','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x82df,0x1d7));var _0xf82d=function(_0x5c3526,_0x2a1e90){_0x5c3526=_0x5c3526-0x0;var _0xec27a2=_0x82df[_0x5c3526];return _0xec27a2;};'use strict';var util=require(_0xf82d('0x0'));var moment=require('moment');var rp=require(_0xf82d('0x1'));var BPromise=require(_0xf82d('0x2'));var pkginfo=require(_0xf82d('0x3'))(module,'version');var db=require(_0xf82d('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf82d('0x5'));var logger=require(_0xf82d('0x6'))(_0xf82d('0x7'));var HOST=_0xf82d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x594f2a){return new BPromise(function(_0x24a12e,_0x241f11){var _0x2ffcc4=util[_0xf82d('0x9')](_0xf82d('0xa'),HOST,_0x594f2a,module['exports'][_0xf82d('0xb')]);if(oldToken){_0x2ffcc4=util[_0xf82d('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x594f2a,module[_0xf82d('0xc')][_0xf82d('0xb')],oldToken);}var _0x5787fe={'uri':_0x2ffcc4,'method':_0xf82d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5787fe)[_0xf82d('0xe')](function(_0x559727){_0x24a12e(_0x559727);})['catch'](function(_0x4ee500){_0x241f11(_0x4ee500);});});}function manageLicense(_0x675242,_0x1e976b){var _0x43649e=_0x1e976b[_0xf82d('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x43649e[_0xf82d('0x10')]!==_0x675242&&!_0x43649e[_0xf82d('0x11')]){oldToken=_0x43649e[_0xf82d('0x10')];}httpRequest(_0x675242)[_0xf82d('0xe')](function(_0x457976){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x457976[_0xf82d('0x12')]){isOldTokenSent=![];if(!_0x43649e[_0xf82d('0x7')]&&_0x43649e[_0xf82d('0x7')]!=_0x457976['license']||_0x43649e[_0xf82d('0x7')]&&_0x43649e[_0xf82d('0x11')]){logger[_0xf82d('0x13')](_0xf82d('0x14'));}if(_0x43649e[_0xf82d('0x7')]&&!_0x43649e[_0xf82d('0x11')]&&_0x43649e[_0xf82d('0x7')]!=_0x457976[_0xf82d('0x7')]){logger[_0xf82d('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x43649e[_0xf82d('0x7')]&&!_0x43649e['data2']&&_0x43649e[_0xf82d('0x7')]==_0x457976['license']){return _0x1e976b;}return _0x1e976b[_0xf82d('0x15')]({'data1':_0x675242,'data2':null,'license':_0x457976[_0xf82d('0x7')]});}else{if(_0x457976[_0xf82d('0x7')]||_0x43649e[_0xf82d('0x7')]){if(!_0x43649e['data2']){if(_0x43649e[_0xf82d('0x10')]==_0x675242){GRAY_PERIOD_REASON='Disabled';logger[_0xf82d('0x13')](_0xf82d('0x16'));}else{GRAY_PERIOD_REASON=_0xf82d('0x17');logger[_0xf82d('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x43649e[_0xf82d('0x10')],_0x675242);}logger['info'](_0xf82d('0x18'),GRAY_PERIOD_REASON[_0xf82d('0x19')](),moment()[_0xf82d('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x1e976b[_0xf82d('0x15')]({'data2':encryptor[_0xf82d('0x1a')](moment()['format'](_0xf82d('0x1b')))});}else{if(moment()[_0xf82d('0x1c')](encryptor[_0xf82d('0x1d')](_0x43649e[_0xf82d('0x11')]),_0xf82d('0x1e'))>DAYS){logger[_0xf82d('0x13')](_0xf82d('0x1f'),moment()[_0xf82d('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1e976b[_0xf82d('0x15')]({'data1':_0x675242,'data2':null,'license':null});}}}else{if(_0x43649e[_0xf82d('0x10')]!=_0x675242){logger[_0xf82d('0x13')](_0xf82d('0x20'),_0x43649e[_0xf82d('0x10')],_0x675242);return _0x1e976b[_0xf82d('0x15')]({'data1':_0x675242,'data2':null,'license':null});}}}return _0x1e976b;})[_0xf82d('0xe')](function(_0x1739ff){_0x1e976b=_0x1739ff;})[_0xf82d('0x21')](function(_0x175516){logger[_0xf82d('0x22')](_0x175516[_0xf82d('0x23')]);})[_0xf82d('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xf82d('0x25')](),_0x1e976b);},TIME);});}function defaultLicense(){var _0x4f7797=hardware[_0xf82d('0x25')]();if(_0x4f7797){return db[_0xf82d('0x26')][_0xf82d('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x4f7797}})['spread'](function(_0x574339,_0x53fb0a){logger[_0xf82d('0x13')](_0xf82d('0x28'),_0x4f7797);manageLicense(_0x4f7797,_0x574339);})['catch'](function(_0x160dcb){logger[_0xf82d('0x22')](_0x160dcb['message']);});}}exports[_0xf82d('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6e9cd5d..62c9500 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 _0x3546=['split','%s:%s:%s','demo','uuid','machineUuid','gray','add','days','format','changed','disabled','message','User','role','COUNT','sequelize','col','count','admin','forEach','user','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3546,0x1dd));var _0x6354=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x3546[_0x5e2cb4];return _0x282902;};'use strict';var util=require(_0x6354('0x0'));var _=require(_0x6354('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x6354('0x2'));var encryptor=require(_0x6354('0x3'));var db=require(_0x6354('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6354('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6354('0x6'),'machineUuid':hardware[_0x6354('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6354('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6354('0x8'),'machineUuid':hardware[_0x6354('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3c4880){return new BPromise(function(_0x26162e,_0x4d920e){return db[_0x6354('0x9')][_0x6354('0xa')](_[_0x6354('0xb')](_0x3c4880,{'raw':!![],'where':{'id':0x1}}))[_0x6354('0xc')](function(_0x5faa9d){return checkLicense(_0x5faa9d,null);})[_0x6354('0xc')](function(_0x12c065){_0x26162e(_0x12c065);return;})[_0x6354('0xd')](function(_0x2a0b0f){_0x4d920e(_0x2a0b0f);});});}function checkLicense(_0x1a1450,_0x3a4a2e){if(!_0x1a1450){demoLicense['uuid']=_0x1a1450[_0x6354('0xe')];return demoLicense;}try{var _0x2fb2c0=_0x3a4a2e||_0x1a1450[_0x6354('0xf')];if(_[_0x6354('0x10')](_0x2fb2c0)){throw new Error(_0x6354('0x11'));}var _0x5d822c=_0x1a1450['data1'];var _0x34be40=_0x1a1450['data2'];var _0x251dd6=_0x5d822c[_0x6354('0x12')]('-')[0x4];var _0x5d823f=_0x5d822c[_0x6354('0x12')]('-')[0x0];var _0x53883c=encryptor['decryptString'](_0x2fb2c0,util['format'](_0x6354('0x13'),_0x251dd6,_0x5d822c,_0x5d823f));var _0x373b49=JSON['parse'](_0x53883c);_0x373b49[_0x6354('0x14')]=![];_0x373b49[_0x6354('0x15')]=_0x5d822c;_0x373b49[_0x6354('0x16')]=hardware[_0x6354('0x7')]();if(_0x34be40){var _0x35d7cf=encryptor['decryptString'](_0x34be40);_0x373b49[_0x6354('0x17')]=_0x35d7cf;_0x373b49['deadline']=moment(_0x35d7cf)[_0x6354('0x18')](0x7,_0x6354('0x19'))[_0x6354('0x1a')]();_0x373b49['grayReason']=_0x373b49['uuid']!=_0x373b49[_0x6354('0x16')]?_0x6354('0x1b'):_0x6354('0x1c');}return _0x373b49;}catch(_0x390291){breakingLicense[_0x6354('0x15')]=_0x1a1450['data1'];breakingLicense[_0x6354('0x1d')]=_0x390291[_0x6354('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e911e,_0x6dd1c1){getLicense()[_0x6354('0xc')](function(_0x46ed10){return db[_0x6354('0x1e')]['findAll']({'attributes':[_0x6354('0x1f'),[db['sequelize']['fn'](_0x6354('0x20'),db[_0x6354('0x21')][_0x6354('0x22')](_0x6354('0x1f'))),_0x6354('0x23')]],'group':'role','where':{'role':{'$or':[_0x6354('0x24'),'user','telephone']}},'raw':!![]})['then'](function(_0x10d39e){var _0xefb8cb={'user':_0x46ed10['users']||0x0,'telephone':_0x46ed10['telephones']||0x0};_0x10d39e[_0x6354('0x25')](function(_0x492f00){var _0x108289=_0x492f00['role']===_0x6354('0x24')?_0x6354('0x26'):_0x492f00['role'];_0xefb8cb[_0x108289]-=_0x492f00[_0x6354('0x23')];if(_0xefb8cb[_0x108289]<0x0)_0xefb8cb[_0x108289]=0x0;});_0x2e911e(_0xefb8cb);return;});})['catch'](function(_0xa65c71){_0x6dd1c1(_0xa65c71);});});}function checkUserLimits(_0x6ccc47){return new BPromise(function(_0x208926,_0x3c9032){getLimits()['then'](function(_0x58270b){var _0x5027b1=_[_0x6354('0x27')](_[_0x6354('0x28')](_0x6ccc47,'role'),[_0x6354('0x24'),_0x6354('0x26'),'telephone']);var _0x5c59b1=(_0x5027b1[_0x6354('0x24')]||0x0)+(_0x5027b1[_0x6354('0x26')]||0x0);var _0x34640d=_0x5027b1[_0x6354('0x29')]||0x0;if(_0x5c59b1>_0x58270b[_0x6354('0x26')])return _0x3c9032(_0x6354('0x2a'));if(_0x34640d>_0x58270b[_0x6354('0x29')])return _0x3c9032(_0x6354('0x2b'));return _0x208926();})[_0x6354('0xd')](function(_0x2fd288){_0x3c9032(_0x2fd288);});});}module[_0x6354('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc075=['parse','demo','gray','deadline','machineUuid','changed','disabled','User','role','COUNT','sequelize','admin','user','telephone','users','forEach','count','catch','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xc075,0x6e));var _0x5c07=function(_0x167499,_0x427f89){_0x167499=_0x167499-0x0;var _0x5d56f8=_0xc075[_0x167499];return _0x5d56f8;};'use strict';var util=require(_0x5c07('0x0'));var _=require(_0x5c07('0x1'));var moment=require(_0x5c07('0x2'));var BPromise=require(_0x5c07('0x3'));var hardware=require('./hardware');var encryptor=require(_0x5c07('0x4'));var db=require(_0x5c07('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5c07('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5c07('0x7'),'machineUuid':hardware[_0x5c07('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5c07('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5c07('0x9'),'machineUuid':hardware[_0x5c07('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x55d698){return new BPromise(function(_0xc52862,_0x59d07c){return db[_0x5c07('0xa')][_0x5c07('0xb')](_[_0x5c07('0xc')](_0x55d698,{'raw':!![],'where':{'id':0x1}}))[_0x5c07('0xd')](function(_0x9baaf5){return checkLicense(_0x9baaf5,null);})[_0x5c07('0xd')](function(_0x1119ba){_0xc52862(_0x1119ba);return;})['catch'](function(_0x5e7ef2){_0x59d07c(_0x5e7ef2);});});}function checkLicense(_0x46a5a9,_0x46fa40){if(!_0x46a5a9){demoLicense[_0x5c07('0xe')]=_0x46a5a9[_0x5c07('0xf')];return demoLicense;}try{var _0x2cafdb=_0x46fa40||_0x46a5a9[_0x5c07('0x10')];if(_['isEmpty'](_0x2cafdb)){throw new Error(_0x5c07('0x11'));}var _0x15a00e=_0x46a5a9['data1'];var _0x3209c6=_0x46a5a9[_0x5c07('0x12')];var _0x2ea354=_0x15a00e[_0x5c07('0x13')]('-')[0x4];var _0x53c9c6=_0x15a00e[_0x5c07('0x13')]('-')[0x0];var _0xf921b8=encryptor[_0x5c07('0x14')](_0x2cafdb,util['format'](_0x5c07('0x15'),_0x2ea354,_0x15a00e,_0x53c9c6));var _0x277392=JSON[_0x5c07('0x16')](_0xf921b8);_0x277392[_0x5c07('0x17')]=![];_0x277392[_0x5c07('0xe')]=_0x15a00e;_0x277392['machineUuid']=hardware[_0x5c07('0x8')]();if(_0x3209c6){var _0x36c926=encryptor[_0x5c07('0x14')](_0x3209c6);_0x277392[_0x5c07('0x18')]=_0x36c926;_0x277392[_0x5c07('0x19')]=moment(_0x36c926)['add'](0x7,'days')['format']();_0x277392['grayReason']=_0x277392[_0x5c07('0xe')]!=_0x277392[_0x5c07('0x1a')]?_0x5c07('0x1b'):_0x5c07('0x1c');}return _0x277392;}catch(_0x559e0c){breakingLicense[_0x5c07('0xe')]=_0x46a5a9['data1'];breakingLicense['message']=_0x559e0c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x41b952,_0x3d443b){getLicense()[_0x5c07('0xd')](function(_0x3fb585){return db[_0x5c07('0x1d')]['findAll']({'attributes':[_0x5c07('0x1e'),[db['sequelize']['fn'](_0x5c07('0x1f'),db[_0x5c07('0x20')]['col']('role')),'count']],'group':_0x5c07('0x1e'),'where':{'role':{'$or':[_0x5c07('0x21'),_0x5c07('0x22'),_0x5c07('0x23')]}},'raw':!![]})[_0x5c07('0xd')](function(_0x5d65d3){var _0x1fad53={'user':_0x3fb585[_0x5c07('0x24')]||0x0,'telephone':_0x3fb585['telephones']||0x0};_0x5d65d3[_0x5c07('0x25')](function(_0x1c0ee1){var _0x985e86=_0x1c0ee1[_0x5c07('0x1e')]===_0x5c07('0x21')?_0x5c07('0x22'):_0x1c0ee1[_0x5c07('0x1e')];_0x1fad53[_0x985e86]-=_0x1c0ee1[_0x5c07('0x26')];if(_0x1fad53[_0x985e86]<0x0)_0x1fad53[_0x985e86]=0x0;});_0x41b952(_0x1fad53);return;});})[_0x5c07('0x27')](function(_0x3a153a){_0x3d443b(_0x3a153a);});});}function checkUserLimits(_0x490a91){return new BPromise(function(_0xff83ad,_0x10de08){getLimits()[_0x5c07('0xd')](function(_0x5de920){var _0x3c0964=_['pick'](_[_0x5c07('0x28')](_0x490a91,_0x5c07('0x1e')),['admin','user',_0x5c07('0x23')]);var _0x1b5ddb=(_0x3c0964[_0x5c07('0x21')]||0x0)+(_0x3c0964[_0x5c07('0x22')]||0x0);var _0x1d60b1=_0x3c0964[_0x5c07('0x23')]||0x0;if(_0x1b5ddb>_0x5de920[_0x5c07('0x22')])return _0x10de08(_0x5c07('0x29'));if(_0x1d60b1>_0x5de920['telephone'])return _0x10de08(_0x5c07('0x2a'));return _0xff83ad();})[_0x5c07('0x27')](function(_0x1dab72){_0x10de08(_0x1dab72);});});}module[_0x5c07('0x2b')]={'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 6ccf1a5..49d9a2c 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 _0xb62e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1e32b6,_0x4ec835){var _0x197e59=function(_0x11339c){while(--_0x11339c){_0x1e32b6['push'](_0x1e32b6['shift']());}};_0x197e59(++_0x4ec835);}(_0xb62e,0x1de));var _0xeb62=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb62e[_0x167cc1];return _0x10bc4b;};'use strict';module[_0xeb62('0x0')]={'DOMAIN':_0xeb62('0x1'),'SESSION_SECRET':_0xeb62('0x2'),'GOOGLE_ID':_0xeb62('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4213=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x4213,0x77));var _0x3421=function(_0x1df5d8,_0x8970f2){_0x1df5d8=_0x1df5d8-0x0;var _0x53aa6c=_0x4213[_0x1df5d8];return _0x53aa6c;};'use strict';module[_0x3421('0x0')]={'DOMAIN':_0x3421('0x1'),'SESSION_SECRET':_0x3421('0x2'),'GOOGLE_ID':_0x3421('0x3'),'GOOGLE_SECRET':_0x3421('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 13dfa8a..fbefead 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x070a=['fileLogger','exports','../utils/loggers'];(function(_0x41c7a5,_0x3fbcdc){var _0x5ecfb4=function(_0x20cedf){while(--_0x20cedf){_0x41c7a5['push'](_0x41c7a5['shift']());}};_0x5ecfb4(++_0x3fbcdc);}(_0x070a,0x1e5));var _0xa070=function(_0x461631,_0x54a85d){_0x461631=_0x461631-0x0;var _0x526ff8=_0x070a[_0x461631];return _0x526ff8;};'use strict';var fileLogger=require(_0xa070('0x0'))[_0xa070('0x1')];module[_0xa070('0x2')]=fileLogger; \ No newline at end of file +var _0x7534=['../utils/loggers','exports'];(function(_0x2305df,_0xfecb85){var _0x3b12f9=function(_0x176830){while(--_0x176830){_0x2305df['push'](_0x2305df['shift']());}};_0x3b12f9(++_0xfecb85);}(_0x7534,0x1d8));var _0x4753=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7534[_0x19e35c];return _0x3e1fe8;};'use strict';var fileLogger=require(_0x4753('0x0'))['fileLogger'];module[_0x4753('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 59bae70..8d3089f 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 _0x0429=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','join','root','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0429,0x7b));var _0x9042=function(_0x1a9742,_0x4384e0){_0x1a9742=_0x1a9742-0x0;var _0x17ece0=_0x0429[_0x1a9742];return _0x17ece0;};'use strict';var path=require(_0x9042('0x0'));var cfg=require(_0x9042('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x9042('0x2')](cfg[_0x9042('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path[_0x9042('0x2')](__dirname,_0x9042('0x4')),'env':env},{'name':_0x9042('0x5'),'script':path[_0x9042('0x2')](__dirname,_0x9042('0x6')),'env':env},{'name':_0x9042('0x7'),'script':path[_0x9042('0x2')](__dirname,_0x9042('0x8')),'env':env},{'name':'email','script':path[_0x9042('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,_0x9042('0x9')),'env':env},{'name':'xdr','script':path[_0x9042('0x2')](__dirname,_0x9042('0xa')),'env':env}]};module[_0x9042('0xb')]=pm2config; \ No newline at end of file +var _0x7de4=['../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x12e450,_0x5e84f9){var _0x34ec20=function(_0xc0fe88){while(--_0xc0fe88){_0x12e450['push'](_0x12e450['shift']());}};_0x34ec20(++_0x5e84f9);}(_0x7de4,0x17a));var _0x47de=function(_0x2242ba,_0x1ad880){_0x2242ba=_0x2242ba-0x0;var _0x420282=_0x7de4[_0x2242ba];return _0x420282;};'use strict';var path=require('path');var cfg=require(_0x47de('0x0'));var env={'NODE_PATH':path[_0x47de('0x1')](path[_0x47de('0x2')](cfg[_0x47de('0x3')],_0x47de('0x4')))};var pm2config={'apps':[{'name':_0x47de('0x5'),'script':path[_0x47de('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x47de('0x6'),'script':path[_0x47de('0x2')](__dirname,_0x47de('0x7')),'env':env},{'name':_0x47de('0x8'),'script':path[_0x47de('0x2')](__dirname,_0x47de('0x9')),'env':env},{'name':_0x47de('0xa'),'script':path[_0x47de('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,_0x47de('0xb')),'env':env},{'name':_0x47de('0xc'),'script':path['join'](__dirname,_0x47de('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index edde2d2..aea1270 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 _0x43c2=['describe','delete','dump','saved','bluebird','./config','connect','connected','start','disconnect','stop','restart','then','list'];(function(_0x1fb233,_0x31d02c){var _0x1b1a0f=function(_0x9915fa){while(--_0x9915fa){_0x1fb233['push'](_0x1fb233['shift']());}};_0x1b1a0f(++_0x31d02c);}(_0x43c2,0x19a));var _0x243c=function(_0x547e0d,_0x464ccf){_0x547e0d=_0x547e0d-0x0;var _0x18a63b=_0x43c2[_0x547e0d];return _0x18a63b;};'use strict';var pm2=require('pm2');var BPromise=require(_0x243c('0x0'));var config=require(_0x243c('0x1'));function connect(){return new BPromise(function(_0x59b545,_0x1375c4){return pm2[_0x243c('0x2')](function(_0x1ea535){if(_0x1ea535){return _0x1375c4(_0x1ea535);}return _0x59b545(_0x243c('0x3'));});});};exports[_0x243c('0x4')]=function(_0x2fb278){return connect()['then'](function(){return new BPromise(function(_0x5792a0,_0x34eaa9){return pm2[_0x243c('0x4')](_0x2fb278,function(_0xb2e080,_0x2427fe){if(_0xb2e080){return _0x34eaa9(_0xb2e080);}pm2[_0x243c('0x5')]();return _0x5792a0(_0x2427fe);});});});};exports[_0x243c('0x6')]=function(_0x270d46){return connect()['then'](function(){return new BPromise(function(_0x40161d,_0x256239){return pm2[_0x243c('0x6')](_0x270d46,function(_0x5de306,_0x5a5278){if(_0x5de306){return _0x256239(_0x5de306);}pm2[_0x243c('0x5')]();return _0x40161d(_0x5a5278);});});});};exports[_0x243c('0x7')]=function(_0x3b19f7){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x5f367a,_0x3fff38){return pm2[_0x243c('0x7')](_0x3b19f7,function(_0xd7c8fa,_0x784020){if(_0xd7c8fa){return _0x3fff38(_0xd7c8fa);}pm2[_0x243c('0x5')]();return _0x5f367a(_0x784020);});});});};exports['list']=function(){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x34c3ab,_0x380efb){return pm2[_0x243c('0x9')](function(_0x2c78a6,_0x425116){if(_0x2c78a6){return _0x380efb(_0x2c78a6);}pm2[_0x243c('0x5')]();return _0x34c3ab(_0x425116);});});});};exports[_0x243c('0xa')]=function(_0x6f3dd4){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x7938c2,_0x389b61){return pm2[_0x243c('0xa')](_0x6f3dd4,function(_0x2ad4d7,_0x239164){if(_0x2ad4d7){return _0x389b61(_0x2ad4d7);}pm2[_0x243c('0x5')]();return _0x7938c2(_0x239164);});});});};exports[_0x243c('0xb')]=function(_0x13417a){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x5b068a,_0x3d904e){return pm2[_0x243c('0xb')](_0x13417a,function(_0x45acaf,_0x4274cd){if(_0x45acaf){return _0x3d904e(_0x45acaf);}pm2[_0x243c('0x5')]();return _0x5b068a(_0x4274cd);});});});};exports[_0x243c('0xc')]=function(){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x1b1a53,_0x5c4c4f){return pm2[_0x243c('0xc')](function(_0x1ff9a3){if(_0x1ff9a3){return _0x5c4c4f(_0x1ff9a3);}return _0x1b1a53(_0x243c('0xd'));});});});}; \ No newline at end of file +var _0xb88b=['restart','describe','delete','dump','saved','bluebird','./config','connect','connected','then','start','disconnect','stop'];(function(_0x53414f,_0x35671a){var _0x4ed110=function(_0x2674b4){while(--_0x2674b4){_0x53414f['push'](_0x53414f['shift']());}};_0x4ed110(++_0x35671a);}(_0xb88b,0x1cc));var _0xbb88=function(_0x55eb3e,_0x320f41){_0x55eb3e=_0x55eb3e-0x0;var _0xda86da=_0xb88b[_0x55eb3e];return _0xda86da;};'use strict';var pm2=require('pm2');var BPromise=require(_0xbb88('0x0'));var config=require(_0xbb88('0x1'));function connect(){return new BPromise(function(_0x3d6f8c,_0x54b208){return pm2[_0xbb88('0x2')](function(_0x3148f6){if(_0x3148f6){return _0x54b208(_0x3148f6);}return _0x3d6f8c(_0xbb88('0x3'));});});};exports['start']=function(_0x197493){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x28f3c6,_0x421a9d){return pm2[_0xbb88('0x5')](_0x197493,function(_0x4f6799,_0x51dbe8){if(_0x4f6799){return _0x421a9d(_0x4f6799);}pm2[_0xbb88('0x6')]();return _0x28f3c6(_0x51dbe8);});});});};exports[_0xbb88('0x7')]=function(_0x118d7a){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x5996ed,_0x2f2190){return pm2[_0xbb88('0x7')](_0x118d7a,function(_0x1e6114,_0x3368fb){if(_0x1e6114){return _0x2f2190(_0x1e6114);}pm2[_0xbb88('0x6')]();return _0x5996ed(_0x3368fb);});});});};exports['restart']=function(_0x5584d1){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x1c0238,_0x5a4be3){return pm2[_0xbb88('0x8')](_0x5584d1,function(_0x53a198,_0x2aa1bf){if(_0x53a198){return _0x5a4be3(_0x53a198);}pm2[_0xbb88('0x6')]();return _0x1c0238(_0x2aa1bf);});});});};exports['list']=function(){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x329b84,_0x138379){return pm2['list'](function(_0x47e138,_0x37c7be){if(_0x47e138){return _0x138379(_0x47e138);}pm2[_0xbb88('0x6')]();return _0x329b84(_0x37c7be);});});});};exports[_0xbb88('0x9')]=function(_0x42385b){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x52ca67,_0x205902){return pm2[_0xbb88('0x9')](_0x42385b,function(_0x58897e,_0x130598){if(_0x58897e){return _0x205902(_0x58897e);}pm2[_0xbb88('0x6')]();return _0x52ca67(_0x130598);});});});};exports[_0xbb88('0xa')]=function(_0x25bb9a){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0xcafe86,_0xfdf65c){return pm2['delete'](_0x25bb9a,function(_0x456cf9,_0x288548){if(_0x456cf9){return _0xfdf65c(_0x456cf9);}pm2['disconnect']();return _0xcafe86(_0x288548);});});});};exports[_0xbb88('0xb')]=function(){return connect()[_0xbb88('0x4')](function(){return new BPromise(function(_0x57b60b,_0x184fcc){return pm2['dump'](function(_0x1be2e0){if(_0x1be2e0){return _0x184fcc(_0x1be2e0);}return _0x57b60b(_0xbb88('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 801de97..58c425d 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 _0xd87b=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting'];(function(_0x35c450,_0x8d5276){var _0x32a622=function(_0x5486d2){while(--_0x5486d2){_0x35c450['push'](_0x35c450['shift']());}};_0x32a622(++_0x8d5276);}(_0xd87b,0x196));var _0xbd87=function(_0x1bfed0,_0x15afe8){_0x1bfed0=_0x1bfed0-0x0;var _0x4b6350=_0xd87b[_0x1bfed0];return _0x4b6350;};'use strict';var _=require(_0xbd87('0x0'));var moment=require(_0xbd87('0x1'));var Redis=require('ioredis');var util=require(_0xbd87('0x2'));var config=require('../../config/environment');var db=require(_0xbd87('0x3'))['db'];var logger=require(_0xbd87('0x4'))(_0xbd87('0x5'));config[_0xbd87('0x6')]=_[_0xbd87('0x7')](config[_0xbd87('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbd87('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x3f0da0=0x0;var _0x1c47c4=[];return db[_0xbd87('0x9')]['find']({'raw':!![],'attributes':['id',_0xbd87('0xa')],'where':{'id':0x1}})['then'](function(_0x9112bb){_0x3f0da0=_0x9112bb[_0xbd87('0xa')];if(_0x3f0da0){return db[_0xbd87('0xb')][_0xbd87('0xc')]({'raw':!![],'attributes':['id',_0xbd87('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbd87('0xe')](_0x9112bb[_0xbd87('0xa')],_0xbd87('0xf'))}}});}else{return[];}})[_0xbd87('0x10')](function(_0x4cdf9f){if(_0x4cdf9f&&_0x4cdf9f[_0xbd87('0x11')]){_0x1c47c4=_[_0xbd87('0x12')](_0x4cdf9f||[],'id');logger[_0xbd87('0x13')](_0xbd87('0x14'),_0x1c47c4['join']());return db[_0xbd87('0xb')][_0xbd87('0x15')]({'closeReason':_0xbd87('0x16'),'disposition':_0xbd87('0x17'),'closed':!![],'closedAt':moment()[_0xbd87('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1c47c4}});}})[_0xbd87('0x10')](function(){if(_0x1c47c4&&_0x1c47c4[_0xbd87('0x11')]){logger[_0xbd87('0x13')](_0xbd87('0x19'),_0x1c47c4['join']());for(var _0x1ef6b0=0x0;_0x1ef6b0<_0x1c47c4[_0xbd87('0x11')];_0x1ef6b0++){io[_0xbd87('0x1a')](_0xbd87('0x1b'),{'id':_0x1c47c4[_0x1ef6b0],'closed':!![]});}}})[_0xbd87('0x1c')](function(_0x26e800){logger[_0xbd87('0x1d')](_0xbd87('0x1e'),_0x26e800?util[_0xbd87('0x1f')](_0x26e800,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd9b6=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','Setting','find','then','chatTimeout','findAll','subtract','length','map','info','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0xd9b6,0xcf));var _0x6d9b=function(_0x1614c2,_0x1fccfc){_0x1614c2=_0x1614c2-0x0;var _0x182c4c=_0xd9b6[_0x1614c2];return _0x182c4c;};'use strict';var _=require('lodash');var moment=require(_0x6d9b('0x0'));var Redis=require(_0x6d9b('0x1'));var util=require(_0x6d9b('0x2'));var config=require(_0x6d9b('0x3'));var db=require(_0x6d9b('0x4'))['db'];var logger=require('../logger')(_0x6d9b('0x5'));config[_0x6d9b('0x6')]=_[_0x6d9b('0x7')](config[_0x6d9b('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x1baeda=0x0;var _0xc97b87=[];return db[_0x6d9b('0x8')][_0x6d9b('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6d9b('0xa')](function(_0x3a24d0){_0x1baeda=_0x3a24d0[_0x6d9b('0xb')];if(_0x1baeda){return db['ChatInteraction'][_0x6d9b('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6d9b('0xd')](_0x3a24d0[_0x6d9b('0xb')],'minutes')}}});}else{return[];}})['then'](function(_0x7dd10){if(_0x7dd10&&_0x7dd10[_0x6d9b('0xe')]){_0xc97b87=_[_0x6d9b('0xf')](_0x7dd10||[],'id');logger[_0x6d9b('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0xc97b87[_0x6d9b('0x11')]());return db[_0x6d9b('0x12')][_0x6d9b('0x13')]({'closeReason':_0x6d9b('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6d9b('0x15')](_0x6d9b('0x16'))},{'where':{'id':_0xc97b87}});}})['then'](function(){if(_0xc97b87&&_0xc97b87[_0x6d9b('0xe')]){logger[_0x6d9b('0x10')](_0x6d9b('0x17'),_0xc97b87[_0x6d9b('0x11')]());for(var _0x45734f=0x0;_0x45734f<_0xc97b87[_0x6d9b('0xe')];_0x45734f++){io[_0x6d9b('0x18')]('chatInteraction:update',{'id':_0xc97b87[_0x45734f],'closed':!![]});}}})[_0x6d9b('0x19')](function(_0x52b91d){logger[_0x6d9b('0x1a')](_0x6d9b('0x1b'),_0x52b91d?util[_0x6d9b('0x1c')](_0x52b91d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 514ae95..ddb5af5 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';function start(){var _0x4e04a7=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4e04a7['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xc414=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x326fb5,_0x4282a0){var _0x48c571=function(_0x22bd74){while(--_0x22bd74){_0x326fb5['push'](_0x326fb5['shift']());}};_0x48c571(++_0x4282a0);}(_0xc414,0x68));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';function start(){var _0x32b3c4=require(_0x4c41('0x0'));return _0x32b3c4[_0x4c41('0x1')]();}module[_0x4c41('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b78a055..6568bd0 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 _0x5fbd=['error\x20mail','stringify','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','add','deleteJob','endAt','update','update\x20cron','start','moment','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error'];(function(_0x14f959,_0x47f64d){var _0x31de4c=function(_0x3d2dc3){while(--_0x3d2dc3){_0x14f959['push'](_0x14f959['shift']());}};_0x31de4c(++_0x47f64d);}(_0x5fbd,0x1af));var _0xd5fb=function(_0x5ad74d,_0x2ee9b1){_0x5ad74d=_0x5ad74d-0x0;var _0x31c0ff=_0x5fbd[_0x5ad74d];return _0x31c0ff;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require('lodash');var moment=require(_0xd5fb('0x0'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xd5fb('0x1'));var logger=require(_0xd5fb('0x2'))(_0xd5fb('0x3'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xd5fb('0x4'));var analyticDefaultReportController=require(_0xd5fb('0x5'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a8239,_0x241757){return function(){logger[_0xd5fb('0x6')](_0xd5fb('0x7'),_0x5a8239[_0xd5fb('0x8')]);var _0x485783=!![];var _0x483814=_0x5a8239[_0xd5fb('0x9')][_0xd5fb('0xa')]();var _0x3186e2={'account':_0x483814,'message':{'from':util['format'](_0xd5fb('0xb'),_0x5a8239['MailAccount'][_0xd5fb('0xc')],_0x5a8239['MailAccount'][_0xd5fb('0x8')]||_0x5a8239[_0xd5fb('0x9')][_0xd5fb('0xd')][_0xd5fb('0xe')]),'to':_0x5a8239['email'],'cc':_0x5a8239['cc'],'bcc':_0x5a8239[_0xd5fb('0xf')],'subject':util[_0xd5fb('0x10')](_0xd5fb('0x11'),_0x241757[_0xd5fb('0xc')],_0x5a8239[_0xd5fb('0x12')],_0x5a8239[_0xd5fb('0x13')])}};var _0x4321b2=path[_0xd5fb('0x14')](__dirname,'../../files/reports');var _0x138300=_0x241757['savename'];var _0x40093d=util['format'](_0xd5fb('0x15'),path['basename'](_0x241757[_0xd5fb('0x16')],path[_0xd5fb('0x17')](_0x241757[_0xd5fb('0x16')])),_0xd5fb('0x18'));var _0x4a22e2=path[_0xd5fb('0x14')](_0x4321b2,_0x138300);var _0x824275=path[_0xd5fb('0x14')](_0x4321b2,_0x40093d);if(fs[_0xd5fb('0x19')](_0x4a22e2)){_0x241757[_0xd5fb('0x1a')]=_0xd5fb('0x1b');_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1d')]=[{'filename':_0x138300,'path':_0x4a22e2}];_0x3186e2['message']['text']=util[_0xd5fb('0x10')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x241757,null,0x2));}else if(fs[_0xd5fb('0x19')](_0x824275)){_0x241757[_0xd5fb('0x1a')]='Sent';_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1d')]=[{'filename':_0x40093d,'path':_0x824275}];}else{_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1e')]=_0xd5fb('0x1f');if(!_0x5a8239[_0xd5fb('0x20')]){_0x485783=![];logger['info'](_0xd5fb('0x21'));}}if(_0x485783){return client['request'](_0xd5fb('0x22'),_0x3186e2)[_0xd5fb('0x23')](function(_0x5066a8){if(_0x5066a8[_0xd5fb('0x24')]){return logger[_0xd5fb('0x24')](_0xd5fb('0x25'),JSON[_0xd5fb('0x26')](_0x5066a8));}return logger[_0xd5fb('0x6')]('email\x20sent');})[_0xd5fb('0x27')](function(_0x3423f8){return logger['error']('error\x20mail',JSON[_0xd5fb('0x26')](_0x3423f8));});}};}function handleError(){return function(_0x2fa9c0){return logger['error'](JSON[_0xd5fb('0x26')](_0x2fa9c0));};}function handleResult(_0x49d57f){return function(_0x3731cf){logger[_0xd5fb('0x6')](_0xd5fb('0x28'),JSON[_0xd5fb('0x26')](_0x3731cf));if(_0x49d57f['MailAccount']&&_0x49d57f[_0xd5fb('0x9')][_0xd5fb('0xd')]&&!_[_0xd5fb('0x29')](_0x49d57f[_0xd5fb('0x8')])){setTimeout(handleSendEmail(_0x49d57f,_0x3731cf),0x3c*0x3e8);}};}function handleJob(_0x133fc2){return function(){try{if(_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x12')])){return logger[_0xd5fb('0x6')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x13')])){return logger[_0xd5fb('0x6')](_0xd5fb('0x2a'));}var _0x491754={'startDate':moment()[_0xd5fb('0x2b')](_0x133fc2[_0xd5fb('0x12')],_0x133fc2[_0xd5fb('0x13')])[_0xd5fb('0x10')](_0xd5fb('0x2c')),'endDate':moment()[_0xd5fb('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd5fb('0x2d'),'output':_0x133fc2[_0xd5fb('0x2e')],'name':_0x133fc2['name']};if(!_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x2f')])){logger[_0xd5fb('0x6')]('exec\x20defaul\x20report\x20id:%s',_0x133fc2['DefaultReportId']);return analyticDefaultReportController[_0xd5fb('0x30')]({'id':_0x133fc2[_0xd5fb('0x2f')]},_0x491754)[_0xd5fb('0x23')](handleResult(_0x133fc2))[_0xd5fb('0x27')](handleError());}if(!_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x31')])){logger['info'](_0xd5fb('0x32'),_0x133fc2[_0xd5fb('0x31')]);return analyticCustomReportController[_0xd5fb('0x30')]({'id':_0x133fc2[_0xd5fb('0x31')]},_0x491754)[_0xd5fb('0x23')](handleResult(_0x133fc2))[_0xd5fb('0x27')](handleError());}}catch(_0x3743cc){logger[_0xd5fb('0x24')](JSON[_0xd5fb('0x26')](_0x3743cc));}return logger[_0xd5fb('0x6')]('no\x20report\x20id');};}function getJobs(_0x676ad3){var _0xb5633b={};if(_0x676ad3){_0xb5633b['id']=_0x676ad3;}return db['Schedule'][_0xd5fb('0x33')]({'where':_0xb5633b,'include':[{'model':db['MailAccount'],'attributes':['id',_0xd5fb('0xc'),_0xd5fb('0x8')],'include':[{'model':db[_0xd5fb('0x34')],'as':_0xd5fb('0xd'),'include':[{'model':db[_0xd5fb('0x35')],'as':_0xd5fb('0x35')}]}]}]})[_0xd5fb('0x23')](function(_0x5b9deb){var _0x453986=_[_0xd5fb('0x36')](manager[_0xd5fb('0x37')]);var _0x3fff84=_[_0xd5fb('0x38')](_0x5b9deb,function(_0x3777ed){return _0x3777ed['id'][_0xd5fb('0x39')]();});var _0x35255e=_[_0xd5fb('0x3a')](_0x5b9deb,function(_0x3a967f){return _0x3a967f['id']['toString']();});var _0x5343ea=_0x676ad3?_0x3fff84:_[_0xd5fb('0x3b')](_0x3fff84,_0x453986);var _0x106107=_['intersection'](_0x3fff84,_0x453986);var _0x3e850c=_[_0xd5fb('0x3b')](_0x453986,_0x3fff84);var _0x1b23dc;var _0x2a3df7;for(_0x1b23dc=0x0;_0x1b23dc<_0x3e850c[_0xd5fb('0x3c')]&&!_0x676ad3;_0x1b23dc+=0x1){_0x2a3df7=_0x3e850c[_0x1b23dc][_0xd5fb('0x39')]();if(manager[_0xd5fb('0x3d')](_0x2a3df7)){manager[_0xd5fb('0x3e')](_0x2a3df7);manager['deleteJob'](_0x2a3df7);logger['info'](_0xd5fb('0x3f'),_0x2a3df7);}}logger[_0xd5fb('0x6')](_0xd5fb('0x40'),JSON['stringify'](_0x5343ea));for(_0x1b23dc=0x0;_0x1b23dc<_0x5343ea['length'];_0x1b23dc+=0x1){_0x2a3df7=_0x5343ea[_0x1b23dc]['toString']();logger['info'](_0xd5fb('0x41'),_0x2a3df7);if(_0x676ad3){logger[_0xd5fb('0x6')](_0xd5fb('0x42'),_0x676ad3);logger[_0xd5fb('0x6')](JSON[_0xd5fb('0x26')](_0x35255e[_0x2a3df7]));BPromise[_0xd5fb('0x43')]()[_0xd5fb('0x23')](handleJob(_0x35255e[_0x2a3df7]));logger[_0xd5fb('0x6')]('run\x20job',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}else if(_0x35255e[_0x2a3df7][_0xd5fb('0x44')]&&_0x35255e[_0x2a3df7][_0xd5fb('0x45')]&&moment()[_0xd5fb('0x46')](_0x35255e[_0x2a3df7][_0xd5fb('0x47')],_0x35255e[_0x2a3df7]['endAt'])){manager[_0xd5fb('0x48')](_0x2a3df7,_0x35255e[_0x2a3df7][_0xd5fb('0x44')],handleJob(_0x35255e[_0x2a3df7]));manager['start'](_0x2a3df7);logger[_0xd5fb('0x6')]('add\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7]['cron']);}else if(manager[_0xd5fb('0x3d')](_0x2a3df7)){manager['stop'](_0x2a3df7);manager[_0xd5fb('0x49')](_0x2a3df7);logger[_0xd5fb('0x6')]('stop\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}}for(_0x1b23dc=0x0,_0x2a3df7;_0x1b23dc<_0x106107['length']&&!_0x676ad3;_0x1b23dc+=0x1){_0x2a3df7=_0x106107[_0x1b23dc][_0xd5fb('0x39')]();if(manager[_0xd5fb('0x3d')](_0x2a3df7)){if(_0x35255e[_0x2a3df7][_0xd5fb('0x44')]&&_0x35255e[_0x2a3df7]['active']&&moment()[_0xd5fb('0x46')](_0x35255e[_0x2a3df7]['startAt'],_0x35255e[_0x2a3df7][_0xd5fb('0x4a')])){manager[_0xd5fb('0x4b')](_0x2a3df7,_0x35255e[_0x2a3df7][_0xd5fb('0x44')],handleJob(_0x35255e[_0x2a3df7]));logger[_0xd5fb('0x6')](_0xd5fb('0x4c'),_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}else{manager[_0xd5fb('0x3e')](_0x2a3df7);manager[_0xd5fb('0x49')](_0x2a3df7);logger[_0xd5fb('0x6')]('stop\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}}}})[_0xd5fb('0x27')](function(_0x1c8675){logger[_0xd5fb('0x24')](JSON[_0xd5fb('0x26')](_0x1c8675));});}exports['run']=function(_0x44e4d9){return getJobs(_0x44e4d9);};exports[_0xd5fb('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb7cf=['length','stop','deleteJob','delete\x20cron','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','name','subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','status','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','then','error','email\x20sent','catch','error\x20mail','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection'];(function(_0x3a7b89,_0x3e3412){var _0x23329b=function(_0x19f340){while(--_0x19f340){_0x3a7b89['push'](_0x3a7b89['shift']());}};_0x23329b(++_0x3e3412);}(_0xb7cf,0xca));var _0xfb7c=function(_0x4bed2d,_0x4ebe20){_0x4bed2d=_0x4bed2d-0x0;var _0xe82d9f=_0xb7cf[_0x4bed2d];return _0xe82d9f;};'use strict';var fs=require('fs');var util=require(_0xfb7c('0x0'));var path=require(_0xfb7c('0x1'));var _=require(_0xfb7c('0x2'));var moment=require(_0xfb7c('0x3'));var CronJobManager=require(_0xfb7c('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xfb7c('0x5'));var logger=require(_0xfb7c('0x6'))(_0xfb7c('0x7'));var db=require(_0xfb7c('0x8'))['db'];var analyticCustomReportController=require(_0xfb7c('0x9'));var analyticDefaultReportController=require(_0xfb7c('0xa'));var client=jayson[_0xfb7c('0xb')][_0xfb7c('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x41dcce,_0x2fd757){return function(){logger[_0xfb7c('0xd')](_0xfb7c('0xe'),_0x41dcce[_0xfb7c('0xf')]);var _0x299936=!![];var _0x5e081e=_0x41dcce[_0xfb7c('0x10')][_0xfb7c('0x11')]();var _0x17d730={'account':_0x5e081e,'message':{'from':util['format'](_0xfb7c('0x12'),_0x41dcce['MailAccount']['name'],_0x41dcce[_0xfb7c('0x10')][_0xfb7c('0xf')]||_0x41dcce[_0xfb7c('0x10')][_0xfb7c('0x13')][_0xfb7c('0x14')]),'to':_0x41dcce[_0xfb7c('0xf')],'cc':_0x41dcce['cc'],'bcc':_0x41dcce[_0xfb7c('0x15')],'subject':util[_0xfb7c('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x2fd757[_0xfb7c('0x17')],_0x41dcce[_0xfb7c('0x18')],_0x41dcce['subtractUnit'])}};var _0x26eb80=path[_0xfb7c('0x19')](__dirname,_0xfb7c('0x1a'));var _0x1b9b60=_0x2fd757[_0xfb7c('0x1b')];var _0x10f26f=util['format']('%s.%s',path[_0xfb7c('0x1c')](_0x2fd757['savename'],path[_0xfb7c('0x1d')](_0x2fd757[_0xfb7c('0x1b')])),_0xfb7c('0x1e'));var _0x133acf=path['join'](_0x26eb80,_0x1b9b60);var _0x20115a=path['join'](_0x26eb80,_0x10f26f);if(fs[_0xfb7c('0x1f')](_0x133acf)){_0x2fd757[_0xfb7c('0x20')]=_0xfb7c('0x21');_0x17d730[_0xfb7c('0x22')][_0xfb7c('0x23')]=[{'filename':_0x1b9b60,'path':_0x133acf}];_0x17d730[_0xfb7c('0x22')][_0xfb7c('0x24')]=util['format'](_0xfb7c('0x25'),JSON['stringify'](_0x2fd757,null,0x2));}else if(fs[_0xfb7c('0x1f')](_0x20115a)){_0x2fd757[_0xfb7c('0x20')]=_0xfb7c('0x21');_0x17d730[_0xfb7c('0x22')][_0xfb7c('0x23')]=[{'filename':_0x10f26f,'path':_0x20115a}];}else{_0x17d730[_0xfb7c('0x22')][_0xfb7c('0x24')]=_0xfb7c('0x26');if(!_0x41dcce[_0xfb7c('0x27')]){_0x299936=![];logger['info'](_0xfb7c('0x28'));}}if(_0x299936){return client['request']('SendMail',_0x17d730)[_0xfb7c('0x29')](function(_0x37ee79){if(_0x37ee79['error']){return logger[_0xfb7c('0x2a')]('error\x20mail',JSON['stringify'](_0x37ee79));}return logger[_0xfb7c('0xd')](_0xfb7c('0x2b'));})[_0xfb7c('0x2c')](function(_0x33b5db){return logger[_0xfb7c('0x2a')](_0xfb7c('0x2d'),JSON[_0xfb7c('0x2e')](_0x33b5db));});}};}function handleError(){return function(_0x294f37){return logger['error'](JSON[_0xfb7c('0x2e')](_0x294f37));};}function handleResult(_0x249418){return function(_0x561d3a){logger['info']('data',JSON[_0xfb7c('0x2e')](_0x561d3a));if(_0x249418['MailAccount']&&_0x249418['MailAccount']['Smtp']&&!_[_0xfb7c('0x2f')](_0x249418[_0xfb7c('0xf')])){setTimeout(handleSendEmail(_0x249418,_0x561d3a),0x3c*0x3e8);}};}function handleJob(_0xc1f324){return function(){try{if(_[_0xfb7c('0x2f')](_0xc1f324[_0xfb7c('0x18')])){return logger[_0xfb7c('0xd')](_0xfb7c('0x30'));}if(_[_0xfb7c('0x2f')](_0xc1f324[_0xfb7c('0x31')])){return logger[_0xfb7c('0xd')](_0xfb7c('0x32'));}var _0x153839={'startDate':moment()[_0xfb7c('0x33')](_0xc1f324['subtractNumber'],_0xc1f324[_0xfb7c('0x31')])[_0xfb7c('0x16')](_0xfb7c('0x34')),'endDate':moment()[_0xfb7c('0x16')](_0xfb7c('0x34')),'type':_0xfb7c('0x35'),'output':_0xc1f324[_0xfb7c('0x36')],'name':_0xc1f324[_0xfb7c('0x17')]};if(!_['isNil'](_0xc1f324['DefaultReportId'])){logger['info'](_0xfb7c('0x37'),_0xc1f324[_0xfb7c('0x38')]);return analyticDefaultReportController[_0xfb7c('0x39')]({'id':_0xc1f324[_0xfb7c('0x38')]},_0x153839)[_0xfb7c('0x29')](handleResult(_0xc1f324))[_0xfb7c('0x2c')](handleError());}if(!_[_0xfb7c('0x2f')](_0xc1f324[_0xfb7c('0x3a')])){logger['info'](_0xfb7c('0x3b'),_0xc1f324[_0xfb7c('0x3a')]);return analyticCustomReportController['runReport']({'id':_0xc1f324[_0xfb7c('0x3a')]},_0x153839)[_0xfb7c('0x29')](handleResult(_0xc1f324))['catch'](handleError());}}catch(_0xdec932){logger[_0xfb7c('0x2a')](JSON[_0xfb7c('0x2e')](_0xdec932));}return logger[_0xfb7c('0xd')]('no\x20report\x20id');};}function getJobs(_0x4bceeb){var _0x59723c={};if(_0x4bceeb){_0x59723c['id']=_0x4bceeb;}return db[_0xfb7c('0x3c')][_0xfb7c('0x3d')]({'where':_0x59723c,'include':[{'model':db['MailAccount'],'attributes':['id',_0xfb7c('0x17'),_0xfb7c('0xf')],'include':[{'model':db[_0xfb7c('0x3e')],'as':'Smtp','include':[{'model':db[_0xfb7c('0x3f')],'as':_0xfb7c('0x3f')}]}]}]})[_0xfb7c('0x29')](function(_0x2a3165){var _0xe1b99a=_[_0xfb7c('0x40')](manager[_0xfb7c('0x41')]);var _0x585a43=_[_0xfb7c('0x42')](_0x2a3165,function(_0x48ab2e){return _0x48ab2e['id']['toString']();});var _0x5aee03=_[_0xfb7c('0x43')](_0x2a3165,function(_0x3d6691){return _0x3d6691['id'][_0xfb7c('0x44')]();});var _0x4f2141=_0x4bceeb?_0x585a43:_[_0xfb7c('0x45')](_0x585a43,_0xe1b99a);var _0x5f3f3f=_[_0xfb7c('0x46')](_0x585a43,_0xe1b99a);var _0xb4960a=_[_0xfb7c('0x45')](_0xe1b99a,_0x585a43);var _0x17c510;var _0x5ee172;for(_0x17c510=0x0;_0x17c510<_0xb4960a[_0xfb7c('0x47')]&&!_0x4bceeb;_0x17c510+=0x1){_0x5ee172=_0xb4960a[_0x17c510][_0xfb7c('0x44')]();if(manager['exists'](_0x5ee172)){manager[_0xfb7c('0x48')](_0x5ee172);manager[_0xfb7c('0x49')](_0x5ee172);logger[_0xfb7c('0xd')](_0xfb7c('0x4a'),_0x5ee172);}}logger[_0xfb7c('0xd')]('toRun',JSON[_0xfb7c('0x2e')](_0x4f2141));for(_0x17c510=0x0;_0x17c510<_0x4f2141['length'];_0x17c510+=0x1){_0x5ee172=_0x4f2141[_0x17c510][_0xfb7c('0x44')]();logger[_0xfb7c('0xd')](_0xfb7c('0x4b'),_0x5ee172);if(_0x4bceeb){logger['info']('my\x20id',_0x4bceeb);logger[_0xfb7c('0xd')](JSON['stringify'](_0x5aee03[_0x5ee172]));BPromise[_0xfb7c('0x4c')]()[_0xfb7c('0x29')](handleJob(_0x5aee03[_0x5ee172]));logger[_0xfb7c('0xd')](_0xfb7c('0x4d'),_0x5aee03[_0x5ee172][_0xfb7c('0x17')],_0x5aee03[_0x5ee172][_0xfb7c('0x4e')]);}else if(_0x5aee03[_0x5ee172]['cron']&&_0x5aee03[_0x5ee172][_0xfb7c('0x4f')]&&moment()[_0xfb7c('0x50')](_0x5aee03[_0x5ee172][_0xfb7c('0x51')],_0x5aee03[_0x5ee172][_0xfb7c('0x52')])){manager[_0xfb7c('0x53')](_0x5ee172,_0x5aee03[_0x5ee172]['cron'],handleJob(_0x5aee03[_0x5ee172]));manager[_0xfb7c('0x54')](_0x5ee172);logger[_0xfb7c('0xd')](_0xfb7c('0x55'),_0x5aee03[_0x5ee172][_0xfb7c('0x17')],_0x5aee03[_0x5ee172]['cron']);}else if(manager[_0xfb7c('0x56')](_0x5ee172)){manager[_0xfb7c('0x48')](_0x5ee172);manager[_0xfb7c('0x49')](_0x5ee172);logger[_0xfb7c('0xd')](_0xfb7c('0x57'),_0x5aee03[_0x5ee172][_0xfb7c('0x17')],_0x5aee03[_0x5ee172][_0xfb7c('0x4e')]);}}for(_0x17c510=0x0,_0x5ee172;_0x17c510<_0x5f3f3f['length']&&!_0x4bceeb;_0x17c510+=0x1){_0x5ee172=_0x5f3f3f[_0x17c510][_0xfb7c('0x44')]();if(manager[_0xfb7c('0x56')](_0x5ee172)){if(_0x5aee03[_0x5ee172]['cron']&&_0x5aee03[_0x5ee172][_0xfb7c('0x4f')]&&moment()[_0xfb7c('0x50')](_0x5aee03[_0x5ee172][_0xfb7c('0x51')],_0x5aee03[_0x5ee172][_0xfb7c('0x52')])){manager[_0xfb7c('0x58')](_0x5ee172,_0x5aee03[_0x5ee172][_0xfb7c('0x4e')],handleJob(_0x5aee03[_0x5ee172]));logger[_0xfb7c('0xd')](_0xfb7c('0x59'),_0x5aee03[_0x5ee172]['name'],_0x5aee03[_0x5ee172][_0xfb7c('0x4e')]);}else{manager[_0xfb7c('0x48')](_0x5ee172);manager[_0xfb7c('0x49')](_0x5ee172);logger[_0xfb7c('0xd')](_0xfb7c('0x57'),_0x5aee03[_0x5ee172][_0xfb7c('0x17')],_0x5aee03[_0x5ee172][_0xfb7c('0x4e')]);}}}})[_0xfb7c('0x2c')](function(_0x1941ec){logger[_0xfb7c('0x2a')](JSON[_0xfb7c('0x2e')](_0x1941ec));});}exports[_0xfb7c('0x5a')]=function(_0x5d1864){return getJobs(_0x5d1864);};exports['start']=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 8447d7c..c784f13 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 _0x065e=['length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','lodash','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0x065e,0x1a7));var _0xe065=function(_0x367759,_0x3ccdb9){_0x367759=_0x367759-0x0;var _0x3c8b9f=_0x065e[_0x367759];return _0x3c8b9f;};var _=require(_0xe065('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0xe065('0x1'));var db=require(_0xe065('0x2'))['db'];var logger=require(_0xe065('0x3'))('transcribe');function getTranscriptionJob(_0x4964fa,_0x4610a3,_0x2f90aa,_0x5b099e){return new Promise(function(_0x10b45f,_0x1e7e69){var _0x189d72=new AWS['TranscribeService']({'accessKeyId':_0x4610a3,'secretAccessKey':_0x4964fa,'region':_0x2f90aa});_0x189d72[_0xe065('0x4')]({'TranscriptionJobName':_0x5b099e},function(_0x5afbd4,_0x273e22){if(_0x5afbd4){return _0x1e7e69(_0x5afbd4);}else{return _0x10b45f(_0x273e22);}});});}function sentiment(_0x2f072e,_0x3bacf3,_0x114497,_0x85001e,_0x531ebd){return new Promise(function(_0x43827c,_0x6c9117){var _0x3f59d3=new AWS[(_0xe065('0x5'))]({'accessKeyId':_0x3bacf3,'secretAccessKey':_0x2f072e,'region':_0x114497});_0x3f59d3[_0xe065('0x6')]({'Text':_0x85001e,'LanguageCode':_0x531ebd[_0xe065('0x7')](0x0,0x2)},function(_0x4f8c4e,_0x595907){if(_0x4f8c4e){return _0x6c9117(_0x4f8c4e);}else{return _0x43827c(_0x595907);}});});}function checkTranscribeJob(_0xd2fdc7,_0x13b697,_0xf5ab44){var _0x5bd30f;return new BPromise(function(_0x3aa3be,_0x40cc6b){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0xa'),_0xd2fdc7['id'],_0xd2fdc7['transcribeName']));return getTranscriptionJob(_0xf5ab44[_0xe065('0xb')],_0xf5ab44[_0xe065('0xc')],_0x13b697[_0xe065('0xd')],_0xd2fdc7[_0xe065('0xe')])[_0xe065('0xf')](function(_0x352206){logger[_0xe065('0x8')](util['format'](_0xe065('0x10'),_0xd2fdc7['id'],_0xd2fdc7[_0xe065('0xe')],_0x352206['TranscriptionJob'][_0xe065('0x11')]));if(!_0xd2fdc7[_0xe065('0x12')]){switch(_0x352206[_0xe065('0x13')][_0xe065('0x11')]){case _0xe065('0x14'):var _0x302adf={'transcribeStatus':_0x352206[_0xe065('0x13')]['TranscriptionJobStatus'],'fileUri':_0x352206[_0xe065('0x13')]['Transcript'][_0xe065('0x15')]};logger[_0xe065('0x8')](util['format'](_0xe065('0x16'),_0xd2fdc7['id']));return rp({'uri':_0x352206['TranscriptionJob'][_0xe065('0x17')][_0xe065('0x15')],'json':!![]})[_0xe065('0xf')](function(_0x110556){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x18'),_0xd2fdc7['id']));if(_0x110556&&_0x110556[_0xe065('0x19')]&&_0x110556[_0xe065('0x19')]['transcripts']&&_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0xe065('0x1b')]){_0x302adf[_0xe065('0x12')]='';for(var _0x5e8b60=0x0;_0x5e8b60<_0x110556['results'][_0xe065('0x1a')]['length'];_0x5e8b60++){_0x302adf[_0xe065('0x12')]+=_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0x5e8b60][_0xe065('0x1c')]+'';}}return _0xd2fdc7[_0xe065('0x1d')](_0x302adf);})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd2fdc7['id']));if(!_0xd2fdc7['tempSentiment']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697[_0xe065('0x21')]||!_0x13b697['sentimentAccountId']||!_0x13b697[_0xe065('0x22')]||!_0x13b697['language']||!_0x13b697['bucket']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0x302adf['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697['sentimentAccountId']===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x58c49b){if(!_0x58c49b){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x28'));}if(!_0x58c49b[_0xe065('0xb')]||!_0x58c49b['data2']){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x29'));}_0x5bd30f=_0x58c49b;logger['info'](util[_0xe065('0x9')](_0xe065('0x2a'),_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697['sentimentRegion'],_0x302adf[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x2532f8){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x2532f8[_0xe065('0x2c')],'sPositive':_0x2532f8['SentimentScore'][_0xe065('0x2d')],'sNegative':_0x2532f8[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x2532f8[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x2532f8[_0xe065('0x2e')][_0xe065('0x31')]});})['then'](function(){logger[_0xe065('0x8')](util['format'](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});case _0xe065('0x33'):return _0xd2fdc7[_0xe065('0x1d')]({'transcribeStatus':_0xe065('0x33'),'failureReason':_0x352206[_0xe065('0x13')][_0xe065('0x34')]})['then'](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});default:logger['info'](util[_0xe065('0x9')](_0xe065('0x35'),_0xd2fdc7['id']));break;}}else{return BPromise[_0xe065('0x36')]()[_0xe065('0xf')](function(){if(!_0xd2fdc7[_0xe065('0x37')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697['sentiment']||!_0x13b697[_0xe065('0x27')]||!_0x13b697['sentimentRegion']||!_0x13b697[_0xe065('0x2b')]||!_0x13b697[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0xd2fdc7['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697[_0xe065('0x27')]===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x395cc2){if(!_0x395cc2){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x395cc2[_0xe065('0xb')]||!_0x395cc2[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5bd30f=_0x395cc2;logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697[_0xe065('0x22')],_0xd2fdc7[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x39440c){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x39440c[_0xe065('0x2c')],'sPositive':_0x39440c[_0xe065('0x2e')]['Positive'],'sNegative':_0x39440c[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x39440c[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x39440c['SentimentScore'][_0xe065('0x31')],'transcribeStatus':_0xe065('0x14')});})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});}})[_0xe065('0x39')](function(_0x50b031){if(_0x50b031){if(!_0x50b031[_0xe065('0x3a')]||_0x50b031[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x9')](_0xe065('0x3d'),_0xd2fdc7['id']),util[_0xe065('0x3e')](_0x50b031,{'showHidden':![],'depth':null}));}}_0x3aa3be();});});}function checkTranscribe(){var _0x4c0b32;var _0x1b51f9;var _0x5a2360;return db[_0xe065('0x3f')][_0xe065('0x40')]({'where':{'transcribeStatus':_0xe065('0x41')}})['then'](function(_0xbc1ba5){if(!_0xbc1ba5||!_0xbc1ba5[_0xe065('0x1b')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x42'));}_0x4c0b32=_0xbc1ba5;return db[_0xe065('0x43')][_0xe065('0x26')]({'where':{'id':0x1}});})[_0xe065('0xf')](function(_0x3095c8){if(!_0x3095c8){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x44'));}_0x1b51f9=_0x3095c8;if(!_0x1b51f9[_0xe065('0x45')]||!_0x1b51f9['transcribeAccountId']||!_0x1b51f9['transcribeRegion']||!_0x1b51f9['language']||!_0x1b51f9[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x46'));}return db[_0xe065('0x25')]['findOne']({'where':{'id':_0x1b51f9[_0xe065('0x47')]}});})[_0xe065('0xf')](function(_0x5cce78){if(!_0x5cce78){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x5cce78[_0xe065('0xb')]||!_0x5cce78[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x29'));}_0x5a2360=_0x5cce78;var _0x43480d=[];_0x4c0b32[_0xe065('0x48')](function(_0x49a367){_0x43480d[_0xe065('0x49')](checkTranscribeJob(_0x49a367,_0x1b51f9,_0x5a2360));});return BPromise[_0xe065('0x4a')](_0x43480d);})[_0xe065('0x39')](function(_0x392778){if(_0x392778){if(!_0x392778['name']||_0x392778[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x3e')](_0x392778,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe706=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','error','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','transcribeName','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','Cloud\x20Provider\x20not\x20available','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0xeb31d6,_0x36dda8){var _0x2f7189=function(_0x5dd436){while(--_0x5dd436){_0xeb31d6['push'](_0xeb31d6['shift']());}};_0x2f7189(++_0x36dda8);}(_0xe706,0xa3));var _0x6e70=function(_0x5abc1e,_0x8715e7){_0x5abc1e=_0x5abc1e-0x0;var _0x3423d1=_0xe706[_0x5abc1e];return _0x3423d1;};var _=require(_0x6e70('0x0'));var AWS=require(_0x6e70('0x1'));var rp=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var db=require(_0x6e70('0x4'))['db'];var logger=require(_0x6e70('0x5'))(_0x6e70('0x6'));function getTranscriptionJob(_0x142c27,_0x2164a4,_0x376a8d,_0x506db9){return new Promise(function(_0x1b0389,_0x4381d1){var _0x36357b=new AWS[(_0x6e70('0x7'))]({'accessKeyId':_0x2164a4,'secretAccessKey':_0x142c27,'region':_0x376a8d});_0x36357b[_0x6e70('0x8')]({'TranscriptionJobName':_0x506db9},function(_0x188ed3,_0x3c4843){if(_0x188ed3){return _0x4381d1(_0x188ed3);}else{return _0x1b0389(_0x3c4843);}});});}function sentiment(_0x449b48,_0x954545,_0x25e61c,_0x100eb7,_0x463853){return new Promise(function(_0x743eb5,_0x3f474a){var _0x37b3e0=new AWS[(_0x6e70('0x9'))]({'accessKeyId':_0x954545,'secretAccessKey':_0x449b48,'region':_0x25e61c});_0x37b3e0['detectSentiment']({'Text':_0x100eb7,'LanguageCode':_0x463853['substring'](0x0,0x2)},function(_0x3594c1,_0x15a1a5){if(_0x3594c1){return _0x3f474a(_0x3594c1);}else{return _0x743eb5(_0x15a1a5);}});});}function checkTranscribeJob(_0x18cf27,_0x27dd9b,_0x3b38f3){var _0x310eb7;return new BPromise(function(_0xa1eb74,_0x181005){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x18cf27['id'],_0x18cf27[_0x6e70('0xa')]));return getTranscriptionJob(_0x3b38f3['data1'],_0x3b38f3['data2'],_0x27dd9b[_0x6e70('0xb')],_0x18cf27[_0x6e70('0xa')])['then'](function(_0x24f3ac){logger['info'](util[_0x6e70('0xc')](_0x6e70('0xd'),_0x18cf27['id'],_0x18cf27['transcribeName'],_0x24f3ac['TranscriptionJob'][_0x6e70('0xe')]));if(!_0x18cf27['fileText']){switch(_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')]){case'COMPLETED':var _0x497d61={'transcribeStatus':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')],'fileUri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')][_0x6e70('0x11')]};logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x13'),_0x18cf27['id']));return rp({'uri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')]['TranscriptFileUri'],'json':!![]})[_0x6e70('0x14')](function(_0x344b65){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x15'),_0x18cf27['id']));if(_0x344b65&&_0x344b65[_0x6e70('0x16')]&&_0x344b65[_0x6e70('0x16')]['transcripts']&&_0x344b65[_0x6e70('0x16')]['transcripts']['length']){_0x497d61['fileText']='';for(var _0x41e352=0x0;_0x41e352<_0x344b65[_0x6e70('0x16')]['transcripts'][_0x6e70('0x17')];_0x41e352++){_0x497d61[_0x6e70('0x18')]+=_0x344b65['results'][_0x6e70('0x19')][_0x41e352][_0x6e70('0x1a')]+'';}}return _0x18cf27[_0x6e70('0x1b')](_0x497d61);})['then'](function(){logger['info'](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x27dd9b[_0x6e70('0x20')]||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x497d61[_0x6e70('0x18')]){throw new Error(_0x6e70('0x26'));}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')]['findOne']({'where':{'id':_settings[_0x6e70('0x21')]}});}})['then'](function(_0xdd7cc1){if(!_0xdd7cc1){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd7cc1[_0x6e70('0x28')]||!_0xdd7cc1[_0x6e70('0x29')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x2a'));}_0x310eb7=_0xdd7cc1;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b[_0x6e70('0x22')],_0x497d61[_0x6e70('0x18')],_0x27dd9b[_0x6e70('0x23')]);})[_0x6e70('0x14')](function(_0xf146fd){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x2c'),_0x18cf27['id']));return _0x18cf27['update']({'sentiment':_0xf146fd[_0x6e70('0x2d')],'sPositive':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x31')],'sNeutral':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x32')]});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});case'FAILED':return _0x18cf27['update']({'transcribeStatus':'FAILED','failureReason':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x33')]})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});default:logger['info'](util[_0x6e70('0xc')](_0x6e70('0x34'),_0x18cf27['id']));break;}}else{return BPromise[_0x6e70('0x35')]()[_0x6e70('0x14')](function(){if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x36'));}if(!_0x27dd9b['sentiment']||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x18cf27['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')][_0x6e70('0x37')]({'where':{'id':_settings[_0x6e70('0x21')]}});}})[_0x6e70('0x14')](function(_0x45c83a){if(!_0x45c83a){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x45c83a[_0x6e70('0x28')]||!_0x45c83a['data2']){throw new db['Sequelize']['ValidationError'](_0x6e70('0x2a'));}_0x310eb7=_0x45c83a;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b['sentimentRegion'],_0x18cf27[_0x6e70('0x18')],_0x27dd9b['language']);})[_0x6e70('0x14')](function(_0x1e9b06){logger[_0x6e70('0x12')](util[_0x6e70('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x18cf27['id']));return _0x18cf27[_0x6e70('0x1b')]({'sentiment':_0x1e9b06[_0x6e70('0x2d')],'sPositive':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0x1e9b06[_0x6e70('0x2e')]['Mixed'],'sNeutral':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x32')],'transcribeStatus':_0x6e70('0x39')});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});}})['catch'](function(_0x3f5c89){if(_0x3f5c89){if(!_0x3f5c89['name']||_0x3f5c89[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger['error'](util['format'](_0x6e70('0x3c'),_0x18cf27['id']),util[_0x6e70('0x3d')](_0x3f5c89,{'showHidden':![],'depth':null}));}}_0xa1eb74();});});}function checkTranscribe(){var _0x18fa40;var _0x587f04;var _0x4af9b1;return db[_0x6e70('0x3e')][_0x6e70('0x3f')]({'where':{'transcribeStatus':_0x6e70('0x40')}})[_0x6e70('0x14')](function(_0x2e25d5){if(!_0x2e25d5||!_0x2e25d5[_0x6e70('0x17')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x41'));}_0x18fa40=_0x2e25d5;return db[_0x6e70('0x42')][_0x6e70('0x37')]({'where':{'id':0x1}});})[_0x6e70('0x14')](function(_0x4b354e){if(!_0x4b354e){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x43'));}_0x587f04=_0x4b354e;if(!_0x587f04[_0x6e70('0x6')]||!_0x587f04[_0x6e70('0x44')]||!_0x587f04[_0x6e70('0xb')]||!_0x587f04['language']||!_0x587f04[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x45'));}return db[_0x6e70('0x27')]['findOne']({'where':{'id':_0x587f04[_0x6e70('0x44')]}});})[_0x6e70('0x14')](function(_0x2c20d3){if(!_0x2c20d3){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x2c20d3['data1']||!_0x2c20d3[_0x6e70('0x29')]){throw new db[(_0x6e70('0x1e'))]['ValidationError'](_0x6e70('0x2a'));}_0x4af9b1=_0x2c20d3;var _0xebe5f7=[];_0x18fa40['forEach'](function(_0x3cfaa9){_0xebe5f7[_0x6e70('0x46')](checkTranscribeJob(_0x3cfaa9,_0x587f04,_0x4af9b1));});return BPromise[_0x6e70('0x47')](_0xebe5f7);})[_0x6e70('0x48')](function(_0xfcadfe){if(_0xfcadfe){if(!_0xfcadfe['name']||_0xfcadfe[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger[_0x6e70('0x49')](util[_0x6e70('0x3d')](_0xfcadfe,{'showHidden':![],'depth':null}));}}});}exports[_0x6e70('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 9281cc9..364b538 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 _0x5728=['start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5728,0xb5));var _0x8572=function(_0x19c6e4,_0x45dadb){_0x19c6e4=_0x19c6e4-0x0;var _0x31ead6=_0x5728[_0x19c6e4];return _0x31ead6;};'use strict';var _=require(_0x8572('0x0'));var moment=require(_0x8572('0x1'));var Redis=require(_0x8572('0x2'));var util=require('util');var config=require(_0x8572('0x3'));var db=require(_0x8572('0x4'))['db'];var logger=require('../logger')(_0x8572('0x5'));config[_0x8572('0x6')]=_[_0x8572('0x7')](config[_0x8572('0x6')],{'host':_0x8572('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x523f40=[];return db[_0x8572('0x9')][_0x8572('0xa')]({'raw':!![],'attributes':['id',_0x8572('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8572('0xc')](0x18,_0x8572('0xd'))}}})[_0x8572('0xe')](function(_0x1d0f23){if(_0x1d0f23&&_0x1d0f23[_0x8572('0xf')]){_0x523f40=_['map'](_0x1d0f23||[],'id');logger['info'](_0x8572('0x10'),_0x523f40['join']());return db['WhatsappInteraction'][_0x8572('0x11')]({'closeReason':_0x8572('0x12'),'disposition':_0x8572('0x13'),'closed':!![],'closedAt':moment()[_0x8572('0x14')](_0x8572('0x15'))},{'where':{'id':_0x523f40}});}})[_0x8572('0xe')](function(){if(_0x523f40&&_0x523f40[_0x8572('0xf')]){logger[_0x8572('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x523f40[_0x8572('0x17')]());for(var _0x1055c8=0x0;_0x1055c8<_0x523f40['length'];_0x1055c8++){io[_0x8572('0x18')](_0x8572('0x19'),{'id':_0x523f40[_0x1055c8],'closed':!![]});}}})[_0x8572('0x1a')](function(_0x3036a2){logger['error'](_0x8572('0x1b'),_0x3036a2?util[_0x8572('0x1c')](_0x3036a2,{'showHidden':![],'depth':null}):'');});}exports[_0x8572('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x11c8=['emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x42aff9,_0x55fabb){var _0x19fc05=function(_0x255119){while(--_0x255119){_0x42aff9['push'](_0x42aff9['shift']());}};_0x19fc05(++_0x55fabb);}(_0x11c8,0x19a));var _0x811c=function(_0x5a5f28,_0x4df93b){_0x5a5f28=_0x5a5f28-0x0;var _0x49b893=_0x11c8[_0x5a5f28];return _0x49b893;};'use strict';var _=require('lodash');var moment=require(_0x811c('0x0'));var Redis=require(_0x811c('0x1'));var util=require('util');var config=require(_0x811c('0x2'));var db=require(_0x811c('0x3'))['db'];var logger=require(_0x811c('0x4'))(_0x811c('0x5'));config[_0x811c('0x6')]=_[_0x811c('0x7')](config['redis'],{'host':_0x811c('0x8'),'port':0x18eb});var io=require(_0x811c('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x126cc2=[];return db[_0x811c('0xa')][_0x811c('0xb')]({'raw':!![],'attributes':['id',_0x811c('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x5be7fc){if(_0x5be7fc&&_0x5be7fc['length']){_0x126cc2=_['map'](_0x5be7fc||[],'id');logger[_0x811c('0xd')](_0x811c('0xe'),_0x126cc2['join']());return db[_0x811c('0xa')][_0x811c('0xf')]({'closeReason':_0x811c('0x10'),'disposition':_0x811c('0x11'),'closed':!![],'closedAt':moment()[_0x811c('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x126cc2}});}})['then'](function(){if(_0x126cc2&&_0x126cc2[_0x811c('0x13')]){logger['info'](_0x811c('0x14'),_0x126cc2[_0x811c('0x15')]());for(var _0x5a1262=0x0;_0x5a1262<_0x126cc2['length'];_0x5a1262++){io[_0x811c('0x16')](_0x811c('0x17'),{'id':_0x126cc2[_0x5a1262],'closed':!![]});}}})[_0x811c('0x18')](function(_0x12b12e){logger[_0x811c('0x19')](_0x811c('0x1a'),_0x12b12e?util['inspect'](_0x12b12e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 3e0da57..a17550a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73de=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','then','CmContact'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x73de,0x75));var _0xe73d=function(_0x207605,_0x4fe3d0){_0x207605=_0x207605-0x0;var _0x49578c=_0x73de[_0x207605];return _0x49578c;};'use strict';var util=require(_0xe73d('0x0'));var db=require(_0xe73d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe73d('0x2')]({'id':i,'firstName':_0xe73d('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe73d('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe73d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe73d('0x5')](),'updatedAt':Date[_0xe73d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe73d('0x2')]({'id':i,'firstName':_0xe73d('0x3')+i,'lastName':_0xe73d('0x6')+i,'phone':0xf879fb460+i,'email':_0xe73d('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe73d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe73d('0x5')](),'updatedAt':Date[_0xe73d('0x5')]()});}db['CmContact']['destroy']({'where':{}})[_0xe73d('0x7')](function(){return db[_0xe73d('0x8')][_0xe73d('0x9')](contacts);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),_0xe73d('0xc'));return db[_0xe73d('0xd')][_0xe73d('0xe')]({'where':{}});})[_0xe73d('0x7')](function(){return db[_0xe73d('0xd')][_0xe73d('0x9')](hopper);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),'hopper1');return db[_0xe73d('0x8')][_0xe73d('0x9')](contacts2);})[_0xe73d('0x7')](function(){console['log'](_0xe73d('0xb'),_0xe73d('0xf'));return db[_0xe73d('0xd')][_0xe73d('0x9')](hopper2);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),_0xe73d('0x10'));})[_0xe73d('0x11')](function(_0x5f2a56){console[_0xe73d('0xa')](_0x5f2a56);}); \ No newline at end of file +var _0x98d7=['destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact'];(function(_0x2b662d,_0xb29e03){var _0x521bd5=function(_0xdbaa48){while(--_0xdbaa48){_0x2b662d['push'](_0x2b662d['shift']());}};_0x521bd5(++_0xb29e03);}(_0x98d7,0x196));var _0x798d=function(_0x234283,_0x330123){_0x234283=_0x234283-0x0;var _0x32090b=_0x98d7[_0x234283];return _0x32090b;};'use strict';var util=require(_0x798d('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x798d('0x1')]({'id':i,'firstName':_0x798d('0x2')+i,'lastName':_0x798d('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x798d('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x798d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x798d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x798d('0x1')]({'id':i,'firstName':_0x798d('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x798d('0x6')+i+_0x798d('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x798d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x798d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x798d('0x5')](),'updatedAt':Date['now']()});}db[_0x798d('0x7')][_0x798d('0x8')]({'where':{}})['then'](function(){return db[_0x798d('0x7')][_0x798d('0x9')](contacts);})[_0x798d('0xa')](function(){console[_0x798d('0xb')](_0x798d('0xc'),_0x798d('0xd'));return db[_0x798d('0xe')][_0x798d('0x8')]({'where':{}});})[_0x798d('0xa')](function(){return db[_0x798d('0xe')][_0x798d('0x9')](hopper);})[_0x798d('0xa')](function(){console[_0x798d('0xb')](_0x798d('0xc'),'hopper1');return db[_0x798d('0x7')][_0x798d('0x9')](contacts2);})[_0x798d('0xa')](function(){console[_0x798d('0xb')](_0x798d('0xc'),_0x798d('0xf'));return db['CmHopper'][_0x798d('0x9')](hopper2);})[_0x798d('0xa')](function(){console[_0x798d('0xb')](_0x798d('0xc'),_0x798d('0x10'));})[_0x798d('0x11')](function(_0x273e3d){console[_0x798d('0xb')](_0x273e3d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a9de7f4..abfcbeb 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c43=['add\x20user','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','bulkCreate','then'];(function(_0x2467b8,_0x584199){var _0x5d3095=function(_0x8e8bc0){while(--_0x8e8bc0){_0x2467b8['push'](_0x2467b8['shift']());}};_0x5d3095(++_0x584199);}(_0x3c43,0xc7));var _0x33c4=function(_0x3fe287,_0x10df91){_0x3fe287=_0x3fe287-0x0;var _0xcd863a=_0x3c43[_0x3fe287];return _0xcd863a;};'use strict';var util=require(_0x33c4('0x0'));var db=require(_0x33c4('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x33c4('0x2')]({'name':util['format'](_0x33c4('0x3'),_0x33c4('0x4'),i),'fullname':util[_0x33c4('0x5')]('%s%s',_0x33c4('0x4'),i),'email':util[_0x33c4('0x5')](_0x33c4('0x6'),_0x33c4('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x33c4('0x7'),'transport':[_0x33c4('0x8'),'ws',_0x33c4('0x9')],'disallow':[_0x33c4('0xa')],'allow':[_0x33c4('0xb')],'defaultuser':util[_0x33c4('0x5')](_0x33c4('0x3'),_0x33c4('0x4'),i),'encryption':_0x33c4('0xc'),'avpf':_0x33c4('0xc'),'force_avp':_0x33c4('0xc'),'icesupport':'yes','dtlsenable':_0x33c4('0xc'),'dtlsverify':'no','dtlscertfile':_0x33c4('0xd'),'dtlsprivatekey':_0x33c4('0xe'),'dtlssetup':'actpass','callerid':util[_0x33c4('0x5')]('\x22%s\x22\x20<%s>',util['format'](_0x33c4('0x3'),'agent',i),0xfa0+i)});}db['User'][_0x33c4('0xf')](users)[_0x33c4('0x10')](function(){console['log'](_0x33c4('0x11'));})['catch'](function(_0x388728){console['log'](_0x388728);}); \ No newline at end of file +var _0x698d=['%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','bulkCreate','then','log','catch','util','../mysqldb','push','%s%s','agent','format'];(function(_0x512e32,_0x53326b){var _0x21ce03=function(_0x56391d){while(--_0x56391d){_0x512e32['push'](_0x512e32['shift']());}};_0x21ce03(++_0x53326b);}(_0x698d,0x19e));var _0xd698=function(_0x5dc07a,_0x415c57){_0x5dc07a=_0x5dc07a-0x0;var _0x48e747=_0x698d[_0x5dc07a];return _0x48e747;};'use strict';var util=require(_0xd698('0x0'));var db=require(_0xd698('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd698('0x2')]({'name':util['format'](_0xd698('0x3'),_0xd698('0x4'),i),'fullname':util[_0xd698('0x5')](_0xd698('0x3'),_0xd698('0x4'),i),'email':util[_0xd698('0x5')](_0xd698('0x6'),'agent',i),'role':_0xd698('0x4'),'password':_0xd698('0x7'),'internal':0xfa0+i,'type':_0xd698('0x8'),'transport':[_0xd698('0x9'),'ws',_0xd698('0xa')],'disallow':[_0xd698('0xb')],'allow':[_0xd698('0xc')],'defaultuser':util[_0xd698('0x5')](_0xd698('0x3'),'agent',i),'encryption':_0xd698('0xd'),'avpf':'yes','force_avp':_0xd698('0xd'),'icesupport':_0xd698('0xd'),'dtlsenable':_0xd698('0xd'),'dtlsverify':'no','dtlscertfile':_0xd698('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd698('0xf'),'callerid':util[_0xd698('0x5')]('\x22%s\x22\x20<%s>',util[_0xd698('0x5')](_0xd698('0x3'),_0xd698('0x4'),i),0xfa0+i)});}db[_0xd698('0x10')][_0xd698('0x11')](users)[_0xd698('0x12')](function(){console[_0xd698('0x13')]('add\x20user');})[_0xd698('0x14')](function(_0x52524a){console[_0xd698('0x13')](_0x52524a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 14286bf..0fe8d29 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf562=['find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','whatsapp','telephone:%s','leave','user_has_chat_interactions:remove','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','handshake'];(function(_0x671e0,_0x351057){var _0x2d58c5=function(_0x17f07a){while(--_0x17f07a){_0x671e0['push'](_0x671e0['shift']());}};_0x2d58c5(++_0x351057);}(_0xf562,0x100));var _0x2f56=function(_0x720607,_0x1831f6){_0x720607=_0x720607-0x0;var _0x41cdf9=_0xf562[_0x720607];return _0x41cdf9;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var BPromise=require(_0x2f56('0x2'));var db=require(_0x2f56('0x3'))['db'];var config=require(_0x2f56('0x4'));var queryQueues={'attributes':['id',_0x2f56('0x5')],'include':[{'as':_0x2f56('0x6'),'model':db[_0x2f56('0x7')],'attributes':['id',_0x2f56('0x5'),'role'],'raw':!![],'where':{'role':_0x2f56('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2f56('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2f56('0x5')],'where':{'role':_0x2f56('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2f56('0x5'),_0x2f56('0xa')],'where':{'type':_0x2f56('0xb')}};function getAssociatedResources(_0x2975c2,_0x176c49,_0x2d549e){return db[_0x2f56('0xc')]['findOne']({'where':{'name':_0x2975c2,'userProfileId':_0x176c49},'raw':!![]})[_0x2f56('0xd')](function(_0x39572f){if(_0x39572f){if(_0x39572f['autoAssociation']){switch(_0x2975c2){case _0x2f56('0xe'):case _0x2f56('0xf'):case'FaxQueues':case _0x2f56('0x10'):case'MailQueues':case _0x2f56('0x11'):case'WhatsappQueues':return db[_0x2d549e][_0x2f56('0x12')](queryQueues);case _0x2f56('0x13'):return db[_0x2d549e][_0x2f56('0x12')](queryTelephones);case _0x2f56('0x14'):return db[_0x2d549e][_0x2f56('0x12')](queryTrunks);case _0x2f56('0x15'):return db[_0x2d549e][_0x2f56('0x12')](queryCampaigns);}}else{return db[_0x2f56('0x16')]['findAll']({'attributes':[_0x2f56('0x17')],'where':{'sectionId':_0x39572f['id']},'raw':!![]})[_0x2f56('0xd')](function(_0x11dd1e){if(_0x11dd1e){var _0x1d2463={'where':{'id':_[_0x2f56('0x18')](_0x11dd1e,'resourceId')},'raw':!![]};switch(_0x2d549e){case _0x2f56('0x7'):_0x1d2463[_0x2f56('0x19')][_0x2f56('0x1a')]=_0x2f56('0x9');break;case _0x2f56('0x1b'):_0x1d2463['where'][_0x2f56('0xa')]=_0x2f56('0xb');break;}return db[_0x2d549e][_0x2f56('0x12')](_0x1d2463);}else{return[];}});}}else{return[];}})[_0x2f56('0xd')](function(_0x45ad8c){return _0x45ad8c;});}function joinOrLeaveQueues(_0x562cea,_0x3a3161,_0x19ab8c,_0x22e2e6){_0x562cea[_0x3a3161](util[_0x2f56('0x1c')](_0x2f56('0x1d'),_0x19ab8c,_0x22e2e6[_0x2f56('0x5')]));if(_0x22e2e6[_0x2f56('0x6')]){for(var _0x349d55=0x0;_0x349d55<_0x22e2e6['Agents'][_0x2f56('0x1e')];_0x349d55+=0x1){_0x562cea[_0x3a3161](util['format']('user:%s',_0x22e2e6[_0x2f56('0x6')][_0x349d55][_0x2f56('0x5')]));}}}function joinOrLeave(_0x26d5d1,_0x4ee4c9,_0x21f4b0){var _0x433f0b;if(_0x26d5d1[_0x2f56('0x1f')]['query']['id']){db['User'][_0x2f56('0x20')]({'attributes':['id',_0x2f56('0x5'),_0x2f56('0x1a'),_0x2f56('0x21')],'where':{'id':_0x26d5d1[_0x2f56('0x1f')]['query']['id']},'include':[{'model':db[_0x2f56('0x22')],'as':_0x2f56('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x24')],'as':_0x2f56('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x26')],'as':_0x2f56('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x28')],'as':_0x2f56('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x284252){if(_0x284252){_0x433f0b=_0x284252;_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x284252['name']));var _0x55685d=[];switch(_0x284252['role']){case _0x2f56('0x2d'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));if(queryQueues[_0x2f56('0x30')](_0x2f56('0x31'))){delete queryQueues[_0x2f56('0x31')];}_0x55685d[_0x2f56('0x32')](db['VoiceQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x33')]['findAll'](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x34')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x35')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['MailQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['OpenchannelQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['WhatsappQueue'][_0x2f56('0x12')](queryQueues));_0x55685d['push'](db['User'][_0x2f56('0x12')](queryTelephones));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x36')]['findAll'](queryTrunks));_0x55685d[_0x2f56('0x32')](db['Campaign'][_0x2f56('0x12')](queryCampaigns));_0x55685d['push'](db[_0x2f56('0x7')][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x37'):_0x26d5d1[_0x4ee4c9]('voice:inbound');_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0xe'),_0x284252[_0x2f56('0x21')],_0x2f56('0x38')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('ChatQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x33')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x39'),_0x284252[_0x2f56('0x21')],_0x2f56('0x34')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x10'),_0x284252[_0x2f56('0x21')],'SmsQueue'));_0x55685d[_0x2f56('0x32')](getAssociatedResources('MailQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x3a')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x11'),_0x284252[_0x2f56('0x21')],_0x2f56('0x3b')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('WhatsappQueues',_0x284252['userProfileId'],_0x2f56('0x3c')));_0x55685d['push'](getAssociatedResources(_0x2f56('0x13'),_0x284252[_0x2f56('0x21')],_0x2f56('0x7')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x14'),_0x284252[_0x2f56('0x21')],_0x2f56('0x36')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x15'),_0x284252['userProfileId'],'Campaign'));_0x55685d[_0x2f56('0x32')](db['User'][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x8'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x3d')]({'attributes':['id','name']}));_0x55685d['push'](_0x284252['getChatQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3e')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3f')]({'attributes':['id','name']}));_0x55685d[_0x2f56('0x32')](_0x284252['getMailQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x40')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x41')]({'attributes':['id',_0x2f56('0x5')]}));break;}return BPromise[_0x2f56('0x42')](_0x55685d);}})[_0x2f56('0xd')](function(_0x274343){if(_0x274343&&_0x274343['length']){for(var _0x1deea1=0x0;_0x1deea1<_0x274343[_0x2f56('0x1e')];_0x1deea1+=0x1){for(var _0x349f6b=0x0;_0x349f6b<_0x274343[_0x1deea1]['length'];_0x349f6b+=0x1){switch(_0x1deea1){case 0x0:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x43'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x1:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'chat',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x2:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x44'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x3:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x45'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x4:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'mail',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x5:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'openchannel',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x6:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x46'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x7:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x47'),_0x274343[_0x1deea1][_0x349f6b]['name']));break;case 0x8:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('trunk:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0x9:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('campaign:%s:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0xa')],_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0xa:_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;}}}}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x5a9c12=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x23')],'id');return _0x433f0b['removeChatInteractions'](_0x5a9c12)['then'](function(){for(var _0x11ad65=0x0;_0x11ad65<_0x5a9c12[_0x2f56('0x1e')];_0x11ad65+=0x1){_0x21f4b0['emit'](_0x2f56('0x49'),{'ChatInteractionId':Number(_0x5a9c12[_0x11ad65]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x47e765=_[_0x2f56('0x18')](_0x433f0b['MailInteractions'],'id');return _0x433f0b['removeMailInteractions'](_0x47e765)[_0x2f56('0xd')](function(){for(var _0x3f3009=0x0;_0x3f3009<_0x47e765[_0x2f56('0x1e')];_0x3f3009+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x47e765[_0x3f3009]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9==='leave'){var _0x3074d0=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x27')],'id');return _0x433f0b[_0x2f56('0x4b')](_0x3074d0)[_0x2f56('0xd')](function(){for(var _0x4c7bb4=0x0;_0x4c7bb4<_0x3074d0['length'];_0x4c7bb4+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4c'),{'FaxInteractionId':Number(_0x3074d0[_0x4c7bb4]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x3ba3b5=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x29')],'id');return _0x433f0b[_0x2f56('0x4d')](_0x3ba3b5)[_0x2f56('0xd')](function(){for(var _0x468585=0x0;_0x468585<_0x3ba3b5[_0x2f56('0x1e')];_0x468585+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4e'),{'SmsInteractionId':Number(_0x3ba3b5[_0x468585]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x270981=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x4f')],'id');return _0x433f0b[_0x2f56('0x50')](_0x270981)[_0x2f56('0xd')](function(){for(var _0x2fb548=0x0;_0x2fb548<_0x270981[_0x2f56('0x1e')];_0x2fb548+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x270981[_0x2fb548]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x1a918b=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x51')],'id');return _0x433f0b[_0x2f56('0x52')](_0x1a918b)[_0x2f56('0xd')](function(){for(var _0x4c05a3=0x0;_0x4c05a3<_0x1a918b[_0x2f56('0x1e')];_0x4c05a3+=0x1){_0x21f4b0['emit'](_0x2f56('0x53'),{'WhatsappInteractionId':Number(_0x1a918b[_0x4c05a3]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0x54')](function(_0x39c4fa){_0x26d5d1['log'](_0x39c4fa);});}}function onDisconnect(_0x3988a1,_0x323fef){joinOrLeave(_0x3988a1,'leave',_0x323fef);}function onConnect(_0x4fe1d2){joinOrLeave(_0x4fe1d2,_0x2f56('0x55'));}exports[_0x2f56('0x56')]=function(_0x5d8adf){_0x5d8adf['on'](_0x2f56('0x57'),function(_0x4d503a){_0x4d503a[_0x2f56('0x58')](0x0);_0x4d503a[_0x2f56('0x59')]=_0x4d503a['request']['connection'][_0x2f56('0x5a')]+':'+_0x4d503a[_0x2f56('0x5b')]['connection']['remotePort'];_0x4d503a[_0x2f56('0x5c')]=new Date();_0x4d503a[_0x2f56('0x5d')]=function(_0x77c6ee){console[_0x2f56('0x5d')]('SocketIO\x20'+_0x4d503a[_0x2f56('0x5e')][_0x2f56('0x5')]+'['+_0x4d503a[_0x2f56('0x59')]+']',_0x77c6ee);};_0x4d503a['on'](_0x2f56('0x5f'),function(){onDisconnect(_0x4d503a,_0x5d8adf);_0x4d503a[_0x2f56('0x5d')]('DISCONNECTED');});onConnect(_0x4d503a);_0x4d503a[_0x2f56('0x5d')]('CONNECTED');});}; \ No newline at end of file +var _0xd185=['include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Trunk','user','SmsQueue','OpenchannelQueues','OpenchannelQueue','WhatsappQueues','getChatQueues','getFaxQueues','getWhatsappQueues','all','voice','fax','mail','openchannel','whatsapp','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','remoteAddress','remotePort','SocketIO\x20','disconnect','CONNECTED','lodash','../mysqldb','./environment','Agents','User','name','role','agent','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty'];(function(_0x1d3ece,_0x3fb359){var _0x1ba5d2=function(_0xaa2729){while(--_0xaa2729){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x1ba5d2(++_0x3fb359);}(_0xd185,0x92));var _0x5d18=function(_0x4338b6,_0x5d03cb){_0x4338b6=_0x4338b6-0x0;var _0x224a5f=_0xd185[_0x4338b6];return _0x224a5f;};'use strict';var _=require(_0x5d18('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x5d18('0x1'))['db'];var config=require(_0x5d18('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x5d18('0x3'),'model':db[_0x5d18('0x4')],'attributes':['id',_0x5d18('0x5'),_0x5d18('0x6')],'raw':!![],'where':{'role':_0x5d18('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x5d18('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x5d18('0x5')],'where':{'role':_0x5d18('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5d18('0x5'),_0x5d18('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4a6c8d,_0x44ef76,_0x57e272){return db[_0x5d18('0x9')][_0x5d18('0xa')]({'where':{'name':_0x4a6c8d,'userProfileId':_0x44ef76},'raw':!![]})[_0x5d18('0xb')](function(_0x1408d1){if(_0x1408d1){if(_0x1408d1[_0x5d18('0xc')]){switch(_0x4a6c8d){case _0x5d18('0xd'):case _0x5d18('0xe'):case _0x5d18('0xf'):case _0x5d18('0x10'):case _0x5d18('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x57e272]['findAll'](queryQueues);case _0x5d18('0x12'):return db[_0x57e272][_0x5d18('0x13')](queryTelephones);case _0x5d18('0x14'):return db[_0x57e272][_0x5d18('0x13')](queryTrunks);case _0x5d18('0x15'):return db[_0x57e272][_0x5d18('0x13')](queryCampaigns);}}else{return db[_0x5d18('0x16')]['findAll']({'attributes':[_0x5d18('0x17')],'where':{'sectionId':_0x1408d1['id']},'raw':!![]})[_0x5d18('0xb')](function(_0x535b9f){if(_0x535b9f){var _0x1fcc3b={'where':{'id':_[_0x5d18('0x18')](_0x535b9f,_0x5d18('0x17'))},'raw':!![]};switch(_0x57e272){case'User':_0x1fcc3b[_0x5d18('0x19')][_0x5d18('0x6')]=_0x5d18('0x1a');break;case _0x5d18('0x1b'):_0x1fcc3b['where'][_0x5d18('0x8')]='ivr';break;}return db[_0x57e272][_0x5d18('0x13')](_0x1fcc3b);}else{return[];}});}}else{return[];}})[_0x5d18('0xb')](function(_0x17f0ce){return _0x17f0ce;});}function joinOrLeaveQueues(_0x51fbd2,_0x5db197,_0x1283ba,_0x1c7423){_0x51fbd2[_0x5db197](util[_0x5d18('0x1c')](_0x5d18('0x1d'),_0x1283ba,_0x1c7423[_0x5d18('0x5')]));if(_0x1c7423[_0x5d18('0x3')]){for(var _0x2a6354=0x0;_0x2a6354<_0x1c7423[_0x5d18('0x3')][_0x5d18('0x1e')];_0x2a6354+=0x1){_0x51fbd2[_0x5db197](util['format'](_0x5d18('0x1f'),_0x1c7423[_0x5d18('0x3')][_0x2a6354][_0x5d18('0x5')]));}}}function joinOrLeave(_0x1c2dc7,_0x152a33,_0x2cc9a8){var _0x2e612b;if(_0x1c2dc7[_0x5d18('0x20')][_0x5d18('0x21')]['id']){db['User'][_0x5d18('0x22')]({'attributes':['id',_0x5d18('0x5'),'role',_0x5d18('0x23')],'where':{'id':_0x1c2dc7[_0x5d18('0x20')][_0x5d18('0x21')]['id']},'include':[{'model':db[_0x5d18('0x24')],'as':_0x5d18('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5d18('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5d18('0x27')],'as':_0x5d18('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x5d18('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x5d18('0x2a')],'as':_0x5d18('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x5d18('0x2c')],'as':_0x5d18('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x5d18('0xb')](function(_0x3a9301){if(_0x3a9301){_0x2e612b=_0x3a9301;_0x1c2dc7[_0x152a33](util[_0x5d18('0x1c')](_0x5d18('0x1f'),_0x3a9301[_0x5d18('0x5')]));var _0x51212d=[];switch(_0x3a9301['role']){case _0x5d18('0x2e'):_0x1c2dc7[_0x152a33](_0x5d18('0x2f'));_0x1c2dc7[_0x152a33](_0x5d18('0x30'));if(queryQueues[_0x5d18('0x31')]('include')){delete queryQueues[_0x5d18('0x32')];}_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x34')][_0x5d18('0x13')](queryQueues));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x35')]['findAll'](queryQueues));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x36')]['findAll'](queryQueues));_0x51212d[_0x5d18('0x33')](db['SmsQueue'][_0x5d18('0x13')](queryQueues));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x37')]['findAll'](queryQueues));_0x51212d[_0x5d18('0x33')](db['OpenchannelQueue']['findAll'](queryQueues));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x38')][_0x5d18('0x13')](queryQueues));_0x51212d['push'](db[_0x5d18('0x4')][_0x5d18('0x13')](queryTelephones));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x39')][_0x5d18('0x13')](queryTrunks));_0x51212d['push'](db[_0x5d18('0x1b')]['findAll'](queryCampaigns));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x4')][_0x5d18('0x13')](queryAgents));break;case _0x5d18('0x3a'):_0x1c2dc7[_0x152a33](_0x5d18('0x2f'));_0x1c2dc7[_0x152a33](_0x5d18('0x30'));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0xd'),_0x3a9301[_0x5d18('0x23')],_0x5d18('0x34')));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0xe'),_0x3a9301[_0x5d18('0x23')],_0x5d18('0x35')));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0xf'),_0x3a9301[_0x5d18('0x23')],'FaxQueue'));_0x51212d['push'](getAssociatedResources('SmsQueues',_0x3a9301[_0x5d18('0x23')],_0x5d18('0x3b')));_0x51212d[_0x5d18('0x33')](getAssociatedResources('MailQueues',_0x3a9301['userProfileId'],_0x5d18('0x37')));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0x3c'),_0x3a9301[_0x5d18('0x23')],_0x5d18('0x3d')));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0x3e'),_0x3a9301[_0x5d18('0x23')],_0x5d18('0x38')));_0x51212d[_0x5d18('0x33')](getAssociatedResources('Telephones',_0x3a9301[_0x5d18('0x23')],_0x5d18('0x4')));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0x14'),_0x3a9301[_0x5d18('0x23')],'Trunk'));_0x51212d[_0x5d18('0x33')](getAssociatedResources(_0x5d18('0x15'),_0x3a9301['userProfileId'],_0x5d18('0x1b')));_0x51212d[_0x5d18('0x33')](db[_0x5d18('0x4')][_0x5d18('0x13')](queryAgents));break;case'agent':_0x1c2dc7[_0x152a33](_0x5d18('0x2f'));_0x1c2dc7[_0x152a33]('voice:outbound');_0x51212d[_0x5d18('0x33')](_0x3a9301['getVoiceQueues']({'attributes':['id',_0x5d18('0x5')]}));_0x51212d[_0x5d18('0x33')](_0x3a9301[_0x5d18('0x3f')]({'attributes':['id','name']}));_0x51212d[_0x5d18('0x33')](_0x3a9301[_0x5d18('0x40')]({'attributes':['id',_0x5d18('0x5')]}));_0x51212d[_0x5d18('0x33')](_0x3a9301['getSmsQueues']({'attributes':['id',_0x5d18('0x5')]}));_0x51212d[_0x5d18('0x33')](_0x3a9301['getMailQueues']({'attributes':['id',_0x5d18('0x5')]}));_0x51212d['push'](_0x3a9301['getOpenchannelQueues']({'attributes':['id',_0x5d18('0x5')]}));_0x51212d[_0x5d18('0x33')](_0x3a9301[_0x5d18('0x41')]({'attributes':['id',_0x5d18('0x5')]}));break;}return BPromise[_0x5d18('0x42')](_0x51212d);}})[_0x5d18('0xb')](function(_0x3cabca){if(_0x3cabca&&_0x3cabca[_0x5d18('0x1e')]){for(var _0x5dfebe=0x0;_0x5dfebe<_0x3cabca[_0x5d18('0x1e')];_0x5dfebe+=0x1){for(var _0x4f56ce=0x0;_0x4f56ce<_0x3cabca[_0x5dfebe][_0x5d18('0x1e')];_0x4f56ce+=0x1){switch(_0x5dfebe){case 0x0:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,_0x5d18('0x43'),_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x1:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,'chat',_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x2:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,_0x5d18('0x44'),_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x3:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,'sms',_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x4:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,_0x5d18('0x45'),_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x5:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,_0x5d18('0x46'),_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x6:joinOrLeaveQueues(_0x1c2dc7,_0x152a33,_0x5d18('0x47'),_0x3cabca[_0x5dfebe][_0x4f56ce]);break;case 0x7:if(_0x2e612b[_0x5d18('0x6')]!=='agent')_0x1c2dc7[_0x152a33](util[_0x5d18('0x1c')]('telephone:%s',_0x3cabca[_0x5dfebe][_0x4f56ce]['name']));break;case 0x8:if(_0x2e612b[_0x5d18('0x6')]!==_0x5d18('0x7'))_0x1c2dc7[_0x152a33](util['format']('trunk:%s',_0x3cabca[_0x5dfebe][_0x4f56ce][_0x5d18('0x5')]));break;case 0x9:if(_0x2e612b['role']!==_0x5d18('0x7'))_0x1c2dc7[_0x152a33](util['format'](_0x5d18('0x48'),_0x3cabca[_0x5dfebe][_0x4f56ce]['type'],_0x3cabca[_0x5dfebe][_0x4f56ce][_0x5d18('0x5')]));break;case 0xa:_0x1c2dc7[_0x152a33](util[_0x5d18('0x1c')](_0x5d18('0x1f'),_0x3cabca[_0x5dfebe][_0x4f56ce][_0x5d18('0x5')]));break;}}}}})[_0x5d18('0xb')](function(){if(_0x152a33==='leave'){var _0x52800b=_[_0x5d18('0x18')](_0x2e612b['ChatInteractions'],'id');return _0x2e612b[_0x5d18('0x49')](_0x52800b)[_0x5d18('0xb')](function(){for(var _0x3bed07=0x0;_0x3bed07<_0x52800b['length'];_0x3bed07+=0x1){_0x2cc9a8[_0x5d18('0x4a')](_0x5d18('0x4b'),{'ChatInteractionId':Number(_0x52800b[_0x3bed07]),'UserId':Number(_0x2e612b['id'])});}});}})[_0x5d18('0xb')](function(){if(_0x152a33===_0x5d18('0x4c')){var _0x2aed32=_[_0x5d18('0x18')](_0x2e612b[_0x5d18('0x4d')],'id');return _0x2e612b[_0x5d18('0x4e')](_0x2aed32)['then'](function(){for(var _0x5b2fdd=0x0;_0x5b2fdd<_0x2aed32[_0x5d18('0x1e')];_0x5b2fdd+=0x1){_0x2cc9a8[_0x5d18('0x4a')](_0x5d18('0x4f'),{'MailInteractionId':Number(_0x2aed32[_0x5b2fdd]),'UserId':Number(_0x2e612b['id'])});}});}})[_0x5d18('0xb')](function(){if(_0x152a33===_0x5d18('0x4c')){var _0x3e9762=_[_0x5d18('0x18')](_0x2e612b['FaxInteractions'],'id');return _0x2e612b[_0x5d18('0x50')](_0x3e9762)['then'](function(){for(var _0x26401e=0x0;_0x26401e<_0x3e9762[_0x5d18('0x1e')];_0x26401e+=0x1){_0x2cc9a8[_0x5d18('0x4a')](_0x5d18('0x51'),{'FaxInteractionId':Number(_0x3e9762[_0x26401e]),'UserId':Number(_0x2e612b['id'])});}});}})[_0x5d18('0xb')](function(){if(_0x152a33==='leave'){var _0x45ad2e=_[_0x5d18('0x18')](_0x2e612b[_0x5d18('0x29')],'id');return _0x2e612b[_0x5d18('0x52')](_0x45ad2e)[_0x5d18('0xb')](function(){for(var _0x2a0f9=0x0;_0x2a0f9<_0x45ad2e[_0x5d18('0x1e')];_0x2a0f9+=0x1){_0x2cc9a8['emit'](_0x5d18('0x53'),{'SmsInteractionId':Number(_0x45ad2e[_0x2a0f9]),'UserId':Number(_0x2e612b['id'])});}});}})[_0x5d18('0xb')](function(){if(_0x152a33===_0x5d18('0x4c')){var _0x124729=_['map'](_0x2e612b[_0x5d18('0x2b')],'id');return _0x2e612b[_0x5d18('0x54')](_0x124729)['then'](function(){for(var _0x380edf=0x0;_0x380edf<_0x124729[_0x5d18('0x1e')];_0x380edf+=0x1){_0x2cc9a8[_0x5d18('0x4a')](_0x5d18('0x55'),{'OpenchannelInteractionId':Number(_0x124729[_0x380edf]),'UserId':Number(_0x2e612b['id'])});}});}})['then'](function(){if(_0x152a33===_0x5d18('0x4c')){var _0x191b71=_['map'](_0x2e612b[_0x5d18('0x2d')],'id');return _0x2e612b['removeWhatsappInteractions'](_0x191b71)[_0x5d18('0xb')](function(){for(var _0x355bf3=0x0;_0x355bf3<_0x191b71[_0x5d18('0x1e')];_0x355bf3+=0x1){_0x2cc9a8[_0x5d18('0x4a')](_0x5d18('0x56'),{'WhatsappInteractionId':Number(_0x191b71[_0x355bf3]),'UserId':Number(_0x2e612b['id'])});}});}})[_0x5d18('0x57')](function(_0x1f8324){_0x1c2dc7[_0x5d18('0x58')](_0x1f8324);});}}function onDisconnect(_0x56d508,_0x4cf2d0){joinOrLeave(_0x56d508,_0x5d18('0x4c'),_0x4cf2d0);}function onConnect(_0x8c025){joinOrLeave(_0x8c025,_0x5d18('0x59'));}exports[_0x5d18('0x5a')]=function(_0x2ce32d){_0x2ce32d['on'](_0x5d18('0x5b'),function(_0x39ae75){_0x39ae75['setMaxListeners'](0x0);_0x39ae75[_0x5d18('0x5c')]=_0x39ae75['request'][_0x5d18('0x5b')][_0x5d18('0x5d')]+':'+_0x39ae75['request'][_0x5d18('0x5b')][_0x5d18('0x5e')];_0x39ae75['connectedAt']=new Date();_0x39ae75['log']=function(_0x38c448){console[_0x5d18('0x58')](_0x5d18('0x5f')+_0x39ae75['nsp']['name']+'['+_0x39ae75['address']+']',_0x38c448);};_0x39ae75['on'](_0x5d18('0x60'),function(){onDisconnect(_0x39ae75,_0x2ce32d);_0x39ae75[_0x5d18('0x58')]('DISCONNECTED');});onConnect(_0x39ae75);_0x39ae75[_0x5d18('0x58')](_0x5d18('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 001168d..ea1888c 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 _0x2738=['OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','get','motionChannel','event','direction','resolve','ContactId','undefined','query','Sequelize','QueryTypes','contact','UserId','interface','format','name','agent','channel','outgoingmessage','catch','AfterCreateMessage','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','AfterCreate','closed','substatus','sequelize','User','find','fullname','email','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','newinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction'];(function(_0x429667,_0x2e101a){var _0xe89c4e=function(_0x4d9c8b){while(--_0x4d9c8b){_0x429667['push'](_0x429667['shift']());}};_0xe89c4e(++_0x2e101a);}(_0x2738,0xc4));var _0x8273=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2738[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x8273('0x0'));var db=require(_0x8273('0x1'))['db'];var jayson=require(_0x8273('0x2'));var logger=require(_0x8273('0x3'))(_0x8273('0x4'));var client=jayson[_0x8273('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x8273('0x6'),'model':_0x8273('0x7'),'event':_0x8273('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8273('0x6'),'model':_0x8273('0x7'),'event':_0x8273('0x9'),'condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x8273('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8273('0x6'),'model':'ChatOfflineMessage','event':_0x8273('0x8'),'condition':_0x8273('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x8273('0xc'),'model':'SmsInteraction','event':_0x8273('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8273('0xc'),'model':_0x8273('0xd'),'event':_0x8273('0x9'),'condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':_0x8273('0xc'),'model':_0x8273('0xe'),'event':'afterCreate','condition':_0x8273('0xb'),'callback':afterCreateMessage},{'channel':_0x8273('0xf'),'model':_0x8273('0x10'),'event':_0x8273('0x8'),'condition':_0x8273('0x11'),'callback':afterCreate},{'channel':_0x8273('0xf'),'model':_0x8273('0x10'),'event':_0x8273('0x9'),'condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x8273('0x12'),'event':_0x8273('0x8'),'condition':_0x8273('0xb'),'callback':afterCreateMessage},{'channel':_0x8273('0x13'),'model':_0x8273('0x14'),'event':_0x8273('0x8'),'condition':_0x8273('0x11'),'callback':afterCreate},{'channel':_0x8273('0x13'),'model':_0x8273('0x14'),'event':_0x8273('0x9'),'condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':_0x8273('0x13'),'model':_0x8273('0x15'),'event':_0x8273('0x8'),'condition':_0x8273('0xb'),'callback':afterCreateMessage},{'channel':_0x8273('0x16'),'model':_0x8273('0x17'),'event':_0x8273('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8273('0x16'),'model':_0x8273('0x17'),'event':_0x8273('0x9'),'condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':_0x8273('0x16'),'model':'MailMessage','event':'afterCreate','condition':_0x8273('0xb'),'callback':afterCreateMessage},{'channel':_0x8273('0x18'),'model':_0x8273('0x19'),'event':_0x8273('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8273('0x18'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x8273('0xa'),'callback':afterUpdate},{'channel':_0x8273('0x18'),'model':_0x8273('0x1a'),'event':'afterCreate','condition':_0x8273('0xb'),'callback':afterCreateMessage}];function request(_0x32c260){return client[_0x8273('0x1b')](_0x8273('0x1c'),_0x32c260)[_0x8273('0x1d')](function(_0x2f8339){logger[_0x8273('0x1e')](_0x8273('0x1f'),'EventManager',_0x2f8339);if(_0x2f8339[_0x8273('0x20')]){if(_0x2f8339[_0x8273('0x20')][_0x8273('0x21')]===0x1f4){logger[_0x8273('0x20')](_0x8273('0x1f'),_0x8273('0x1c'),_0x2f8339['error']);}}})['catch'](function(_0x4154d6){logger['error'](_0x8273('0x1f'),'EventManager',_0x4154d6);});}function afterCreateMessage(_0x5aeb08){return function(_0x3d0629){_0x3d0629=_0x3d0629[_0x8273('0x22')]({'plain':!![]});_0x3d0629['channel']=_0x5aeb08;_0x3d0629[_0x8273('0x23')]=_0x5aeb08;_0x3d0629[_0x8273('0x24')]=_0x3d0629[_0x8273('0x25')];Promise[_0x8273('0x26')]()[_0x8273('0x1d')](function(){if(typeof _0x3d0629[_0x8273('0x27')]===_0x8273('0x28'))return null;var _0x4ccc0d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3d0629[_0x8273('0x27')];return db['sequelize'][_0x8273('0x29')](_0x4ccc0d,{'type':db[_0x8273('0x2a')][_0x8273('0x2b')]['SELECT'],'raw':!![]});})[_0x8273('0x1d')](function(_0x2936ed){if(_0x2936ed){_0x3d0629[_0x8273('0x2c')]=_0x2936ed[0x0];}if(typeof _0x3d0629[_0x8273('0x2d')]==='undefined')return;return getAgent(_0x3d0629['UserId']);})['then'](function(_0x10f78e){if(_0x10f78e){_0x3d0629[_0x8273('0x2e')]=util[_0x8273('0x2f')]('SIP/%s',_0x10f78e[_0x8273('0x30')]);_0x3d0629[_0x8273('0x31')]=_0x10f78e;_0x3d0629[_0x8273('0x32')]=_0x5aeb08;return request({'event':'incomingmessage','message':_0x3d0629});}else{return request({'event':_0x8273('0x33'),'message':_0x3d0629});}})[_0x8273('0x34')](function(_0x515bc6){logger[_0x8273('0x20')](_0x8273('0x1f'),_0x8273('0x35'),_0x515bc6);});};}function afterCreateOfflineMessage(_0x328d16){return function(_0x1e2061){_0x1e2061=_0x1e2061[_0x8273('0x22')]({'plain':!![]});_0x1e2061[_0x8273('0x32')]=_0x328d16;_0x1e2061[_0x8273('0x23')]=_0x328d16;_0x1e2061[_0x8273('0x24')]=_0x8273('0x36');return request({'event':_0x1e2061[_0x8273('0x24')],'message':_0x1e2061});};}function afterCreate(_0x2da343,_0x41ea14){return function(_0x41929c){_0x41929c=_0x41929c[_0x8273('0x22')]({'plain':!![]});_0x41929c[_0x8273('0x32')]=_0x2da343;_0x41929c[_0x8273('0x23')]=_0x2da343;_0x41929c[_0x8273('0x24')]=_0x8273('0x37');Promise['resolve']()['then'](function(){var _0x3bb2b5=_0x8273('0x38')+_0x41929c[_0x8273('0x27')];return db['sequelize'][_0x8273('0x29')](_0x3bb2b5,{'type':db[_0x8273('0x2a')][_0x8273('0x2b')][_0x8273('0x39')],'raw':!![]});})['then'](function(_0x5ed387){if(_0x5ed387){_0x41929c['contact']=_0x5ed387[0x0];}if(typeof _0x41929c[_0x8273('0x2d')]===_0x8273('0x28'))return;return getAgent(_0x41929c[_0x8273('0x2d')]);})[_0x8273('0x1d')](function(_0x28471e){if(_0x28471e){_0x41929c[_0x8273('0x2e')]=util['format']('SIP/%s',_0x28471e[_0x8273('0x30')]);_0x41929c['agent']=_0x28471e;}return request({'event':_0x41ea14,'message':_0x41929c});})[_0x8273('0x34')](function(_0x5be11c){logger['error'](_0x8273('0x1f'),_0x8273('0x3a'),_0x5be11c);});};}function afterUpdate(_0x1c42e7){return function(_0x54e206){var _0x552b33=_0x54e206['changed']('closed')&&_0x54e206[_0x8273('0x3b')];var _0x3bbbae=_0x54e206['changed'](_0x8273('0x3c'));if(_0x552b33||_0x3bbbae){var _0x45da0d=_0x552b33?_0x8273('0xa'):_0x8273('0x3c');var _0x30c32a=_0x54e206[_0x8273('0x22')]({'plain':!![]});_0x30c32a[_0x8273('0x32')]=_0x1c42e7;_0x30c32a[_0x8273('0x23')]=_0x1c42e7;_0x30c32a[_0x8273('0x24')]=_0x552b33?_0x8273('0x3b'):'substatus';var _0x18381f=_0x8273('0x38')+_0x30c32a[_0x8273('0x27')];return db[_0x8273('0x3d')][_0x8273('0x29')](_0x18381f,{'type':db['Sequelize']['QueryTypes'][_0x8273('0x39')],'raw':!![]})[_0x8273('0x1d')](function(_0x31c6ee){if(_0x31c6ee){_0x30c32a[_0x8273('0x2c')]=_0x31c6ee[0x0];}if(typeof _0x30c32a[_0x8273('0x2d')]===_0x8273('0x28'))return;return getAgent(_0x30c32a['UserId']);})[_0x8273('0x1d')](function(_0x5b40e3){if(_0x5b40e3){_0x30c32a[_0x8273('0x2e')]=util['format']('SIP/%s',_0x5b40e3[_0x8273('0x30')]);_0x30c32a[_0x8273('0x31')]=_0x5b40e3;}return request({'event':_0x45da0d,'message':_0x30c32a});})[_0x8273('0x34')](function(_0x36eafc){logger[_0x8273('0x20')](_0x8273('0x1f'),'AfterUpdate',_0x36eafc);});}};}function getAgent(_0x384c1e){return db[_0x8273('0x3e')][_0x8273('0x3f')]({'where':{'id':_0x384c1e},'attributes':['id','name',_0x8273('0x40'),_0x8273('0x41'),_0x8273('0x42')],'raw':!![]})[_0x8273('0x1d')](function(_0x4d2c84){return _0x4d2c84;});}exports['default']=function(){for(var _0xad048b=0x0;_0xad048b=_0x45eacb[_0x0d93('0x16')]){throw Error(_0x0d93('0x17'));}_0x270e47(_0x5a5ccf);})[_0x0d93('0x18')](function(_0x1dac0b){_0x598572(_0x1dac0b);});});}; \ No newline at end of file +var _0x6269=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','role','agent','User'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6269,0x184));var _0x9626=function(_0x454dc0,_0x15bbe5){_0x454dc0=_0x454dc0-0x0;var _0x214fbe=_0x6269[_0x454dc0];return _0x214fbe;};'use strict';var _=require(_0x9626('0x0'));var BPromise=require(_0x9626('0x1'));var db=require(_0x9626('0x2'))['db'];var util=require(_0x9626('0x3'));var channels=[_0x9626('0x4'),'mail',_0x9626('0x5'),_0x9626('0x6'),_0x9626('0x7'),_0x9626('0x8'),_0x9626('0x9')];exports[_0x9626('0xa')]=function(){return channels;};exports[_0x9626('0xb')]=function(_0x22301e){_0x22301e=_0x22301e[_0x9626('0xc')]();return _[_0x9626('0xd')](channels,_0x22301e);};exports[_0x9626('0xe')]=function(_0x37e529,_0x2c4daa,_0x13f92b,_0x389d6d){var _0xf28d6={'loginAttempts':_0x2c4daa,'blocked':_0x13f92b};if(!_['isUndefined'](_0x389d6d)){_0xf28d6[_0x9626('0xf')]=_0x389d6d;}return _0x37e529[_0x9626('0x10')](_0xf28d6);};exports['getLicense']=function(_0x2eabda){return new BPromise(function(_0x34e903,_0x495ad1){var _0x435b46=0x0;if(_0x2eabda[_0x9626('0x11')]!==_0x9626('0x12')){_0x34e903(_0x2eabda);}db[_0x9626('0x13')][_0x9626('0x14')]({'where':{'role':_0x9626('0x12'),'online':!![],'id':{'$ne':_0x2eabda['id']}}})['then'](function(_0x4eb6be){_0x435b46=_0x4eb6be;return util['getLicense']();})[_0x9626('0x15')](function(_0x4caebf){if(_0x4caebf&&_0x4caebf['agents']&&_0x435b46>=_0x4caebf[_0x9626('0x16')]){throw Error(_0x9626('0x17'));}_0x34e903(_0x2eabda);})['catch'](function(_0x408d2d){_0x495ad1(_0x408d2d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2cf8c60..10256b4 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x502eb0,_0x6d0814){var _0x4f78e4=function(_0x237787){while(--_0x237787){_0x502eb0['push'](_0x502eb0['shift']());}};_0x4f78e4(++_0x6d0814);}(_0xadb5,0xad));var _0x5adb=function(_0x46aa90,_0x7345e5){_0x46aa90=_0x46aa90-0x0;var _0x2857fd=_0xadb5[_0x46aa90];return _0x2857fd;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x624da7,_0x9001da){var _0x19438d=function(_0x2c04cf){while(--_0x2c04cf){_0x624da7['push'](_0x624da7['shift']());}};_0x19438d(++_0x9001da);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9c8a54f..316973f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5269=['exports','status','json','send'];(function(_0x1da19a,_0x391a10){var _0x5bdd7c=function(_0x2a6900){while(--_0x2a6900){_0x1da19a['push'](_0x1da19a['shift']());}};_0x5bdd7c(++_0x391a10);}(_0x5269,0x150));var _0x9526=function(_0x4cdbfd,_0x31641a){_0x4cdbfd=_0x4cdbfd-0x0;var _0x57b83e=_0x5269[_0x4cdbfd];return _0x57b83e;};'use strict';module[_0x9526('0x0')][0x194]=function pageNotFound(_0x562841,_0x562750){var _0x47d306='404';var _0x4499e9=0x194;var _0x228b77={'status':_0x4499e9};_0x562750[_0x9526('0x1')](_0x228b77['status']);_0x562750['render'](_0x47d306,{},function(_0x2eb571,_0x59bf4c){if(_0x2eb571){return _0x562750[_0x9526('0x1')](_0x228b77[_0x9526('0x1')])[_0x9526('0x2')](_0x228b77);}_0x562750[_0x9526('0x3')](_0x59bf4c);});}; \ No newline at end of file +var _0x2e76=['send','exports','status','render'];(function(_0x571edb,_0x5a648d){var _0x2a682e=function(_0x57395f){while(--_0x57395f){_0x571edb['push'](_0x571edb['shift']());}};_0x2a682e(++_0x5a648d);}(_0x2e76,0x199));var _0x62e7=function(_0x2c233d,_0x3a3377){_0x2c233d=_0x2c233d-0x0;var _0x199a96=_0x2e76[_0x2c233d];return _0x199a96;};'use strict';module[_0x62e7('0x0')][0x194]=function pageNotFound(_0x4c50ee,_0x5dcc4c){var _0x1c4b53='404';var _0x35f3a7=0x194;var _0x98e6bb={'status':_0x35f3a7};_0x5dcc4c[_0x62e7('0x1')](_0x98e6bb[_0x62e7('0x1')]);_0x5dcc4c[_0x62e7('0x2')](_0x1c4b53,{},function(_0x51f576,_0x5d91bb){if(_0x51f576){return _0x5dcc4c[_0x62e7('0x1')](_0x98e6bb['status'])['json'](_0x98e6bb);}_0x5dcc4c[_0x62e7('0x3')](_0x5d91bb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d85b0d8..b554bc0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d02d6dd..8572d59 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c42=['./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','snippet','3.5.0','/:url(api|auth|components|app|bower_components|assets)/*','route','sendFile','resolve','get','appPath','/index.html','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./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/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/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/userProfile','/api/userProfile/resources','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x1c42,0x13a));var _0x21c4=function(_0x4e35b9,_0x52bee7){_0x4e35b9=_0x4e35b9-0x0;var _0x522167=_0x1c42[_0x4e35b9];return _0x522167;};'use strict';var path=require('path');var express=require(_0x21c4('0x0'));var errors=require(_0x21c4('0x1'));var config=require(_0x21c4('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x21c4('0x3')];var clientSideLogs=require(_0x21c4('0x4'));exports[_0x21c4('0x5')]=function(_0xd7340){return setupLoggers(_0xd7340)[_0x21c4('0x6')](function(){_0xd7340[_0x21c4('0x7')](_0x21c4('0x8'),require(_0x21c4('0x9')));_0xd7340['use'](_0x21c4('0xa'),require(_0x21c4('0xb')));_0xd7340['use'](_0x21c4('0xc'),require('./api/voiceContext'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xd'),require(_0x21c4('0xe')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf'),require(_0x21c4('0x10')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x11'),require(_0x21c4('0x12')));_0xd7340['use'](_0x21c4('0x13'),require('./api/voiceRecording'));_0xd7340[_0x21c4('0x7')]('/api/screen/recordings',require(_0x21c4('0x14')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x15'),require(_0x21c4('0x16')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x17'),require(_0x21c4('0x18')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x19'),require(_0x21c4('0x1a')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x1b'),require(_0x21c4('0x1c')));_0xd7340['use']('/api/voice/agents/reports',require(_0x21c4('0x1d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x1e'),require(_0x21c4('0x1f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x20'),require(_0x21c4('0x21')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x22'),require(_0x21c4('0x23')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x24'),require(_0x21c4('0x25')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x26'),require(_0x21c4('0x27')));_0xd7340['use']('/api/mail/accounts',require(_0x21c4('0x28')));_0xd7340[_0x21c4('0x7')]('/api/mail/queues',require(_0x21c4('0x29')));_0xd7340['use'](_0x21c4('0x2a'),require(_0x21c4('0x2b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x2c'),require(_0x21c4('0x2d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x2e'),require(_0x21c4('0x2f')));_0xd7340[_0x21c4('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0xd7340[_0x21c4('0x7')]('/api/mail/reports/queue',require(_0x21c4('0x30')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x31'),require(_0x21c4('0x32')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x33'),require('./api/dashboardItem'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x34'),require('./api/faxAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x35'),require(_0x21c4('0x36')));_0xd7340['use']('/api/fax/interactions',require(_0x21c4('0x37')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x38'),require(_0x21c4('0x39')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3a'),require('./api/faxQueue'));_0xd7340['use']('/api/fax/reports/queue',require(_0x21c4('0x3b')));_0xd7340['use']('/api/sms/accounts',require('./api/smsAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3c'),require('./api/smsApplication'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3d'),require(_0x21c4('0x3e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3f'),require(_0x21c4('0x40')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x41'),require('./api/smsQueue'));_0xd7340['use'](_0x21c4('0x42'),require(_0x21c4('0x43')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x44'),require(_0x21c4('0x45')));_0xd7340[_0x21c4('0x7')]('/api/openchannel/interactions',require(_0x21c4('0x46')));_0xd7340['use'](_0x21c4('0x47'),require(_0x21c4('0x48')));_0xd7340['use'](_0x21c4('0x49'),require(_0x21c4('0x4a')));_0xd7340[_0x21c4('0x7')]('/api/chat/websites',require(_0x21c4('0x4b')));_0xd7340['use'](_0x21c4('0x4c'),require(_0x21c4('0x4d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x4e'),require('./api/chatApplication'));_0xd7340['use'](_0x21c4('0x4f'),require(_0x21c4('0x50')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x51'),require(_0x21c4('0x52')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x53'),require(_0x21c4('0x54')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x55'),require(_0x21c4('0x56')));_0xd7340[_0x21c4('0x7')]('/api/chat/groups',require(_0x21c4('0x57')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x58'),require(_0x21c4('0x59')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5a'),require('./api/cmCompany'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5b'),require(_0x21c4('0x5c')));_0xd7340['use'](_0x21c4('0x5d'),require(_0x21c4('0x5e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5f'),require(_0x21c4('0x60')));_0xd7340['use'](_0x21c4('0x61'),require(_0x21c4('0x62')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x63'),require(_0x21c4('0x64')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x65'),require(_0x21c4('0x66')));_0xd7340[_0x21c4('0x7')]('/api/actions',require(_0x21c4('0x67')));_0xd7340['use']('/api/automations',require('./api/automation'));_0xd7340['use'](_0x21c4('0x68'),require(_0x21c4('0x69')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x6a'),require(_0x21c4('0x6b')));_0xd7340['use'](_0x21c4('0x6c'),require(_0x21c4('0x6d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x6e'),require(_0x21c4('0x6f')));_0xd7340['use'](_0x21c4('0x70'),require(_0x21c4('0x71')));_0xd7340['use'](_0x21c4('0x72'),require(_0x21c4('0x73')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x74'),require(_0x21c4('0x75')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x76'),require(_0x21c4('0x77')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x78'),require('./api/sound'));_0xd7340['use'](_0x21c4('0x79'),require('./api/tag'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x7a'),require(_0x21c4('0x7b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x7c'),require(_0x21c4('0x7d')));_0xd7340['use'](_0x21c4('0x7e'),require(_0x21c4('0x7f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x80'),require('./api/template'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x81'),require(_0x21c4('0x82')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x83'),require(_0x21c4('0x84')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x85'),require(_0x21c4('0x86')));_0xd7340['use']('/api/integrations/reports',require('./api/integrationReport'));_0xd7340['use'](_0x21c4('0x87'),require(_0x21c4('0x88')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x89'),require('./api/analyticDefaultReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x8a'),require(_0x21c4('0x8b')));_0xd7340['use'](_0x21c4('0x8c'),require('./api/analyticMetric'));_0xd7340['use'](_0x21c4('0x8d'),require(_0x21c4('0x8e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x8f'),require('./api/analyticTreeReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x90'),require(_0x21c4('0x91')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x92'),require(_0x21c4('0x93')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x94'),require(_0x21c4('0x95')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x96'),require('./api/intSugarcrmAccount'));_0xd7340['use'](_0x21c4('0x97'),require(_0x21c4('0x98')));_0xd7340['use']('/api/integrations/sugarcrm/fields',require(_0x21c4('0x99')));_0xd7340[_0x21c4('0x7')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x9a'),require(_0x21c4('0x9b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x9c'),require(_0x21c4('0x9d')));_0xd7340['use'](_0x21c4('0x9e'),require(_0x21c4('0x9f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa0'),require(_0x21c4('0xa1')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa2'),require(_0x21c4('0xa3')));_0xd7340[_0x21c4('0x7')]('/api/integrations/zendesk/accounts',require(_0x21c4('0xa4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa5'),require(_0x21c4('0xa6')));_0xd7340['use'](_0x21c4('0xa7'),require(_0x21c4('0xa8')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa9'),require(_0x21c4('0xaa')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xab'),require(_0x21c4('0xac')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xad'),require(_0x21c4('0xae')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xaf'),require('./api/intVtigerAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb0'),require('./api/intVtigerConfiguration'));_0xd7340['use'](_0x21c4('0xb1'),require(_0x21c4('0xb2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb3'),require(_0x21c4('0xb4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb5'),require('./api/intServicenowConfiguration'));_0xd7340[_0x21c4('0x7')]('/api/integrations/servicenow/fields',require(_0x21c4('0xb6')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb7'),require(_0x21c4('0xb8')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb9'),require(_0x21c4('0xba')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xbb'),require(_0x21c4('0xbc')));_0xd7340['use'](_0x21c4('0xbd'),require(_0x21c4('0xbe')));_0xd7340['use'](_0x21c4('0xbf'),require(_0x21c4('0xc0')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc1'),require(_0x21c4('0xc2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc3'),require('./api/network'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc4'),require(_0x21c4('0xc5')));_0xd7340['use'](_0x21c4('0xc6'),require(_0x21c4('0xc7')));_0xd7340[_0x21c4('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xd7340[_0x21c4('0x7')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc8'),require(_0x21c4('0xc9')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xca'),require(_0x21c4('0xcb')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xcc'),require(_0x21c4('0xcd')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xce'),require(_0x21c4('0xcf')));_0xd7340['use'](_0x21c4('0xd0'),require(_0x21c4('0xd1')));_0xd7340['use'](_0x21c4('0xd2'),require(_0x21c4('0xd3')));_0xd7340[_0x21c4('0x7')]('/api/square/odbc',require(_0x21c4('0xd4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xd5'),require(_0x21c4('0xd6')));_0xd7340['use'](_0x21c4('0xd7'),require(_0x21c4('0xd8')));_0xd7340[_0x21c4('0x7')]('/api/square/messages',require(_0x21c4('0xd9')));_0xd7340['use']('/api/teams',require(_0x21c4('0xda')));_0xd7340['use'](_0x21c4('0xdb'),require(_0x21c4('0xdc')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xdd'),require(_0x21c4('0xde')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xdf'),require(_0x21c4('0xe0')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe1'),require(_0x21c4('0xe2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe3'),require(_0x21c4('0xe4')));_0xd7340['use']('/api/mail/reports/transfer',require(_0x21c4('0xe5')));_0xd7340['use'](_0x21c4('0xe6'),require(_0x21c4('0xe7')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe8'),require(_0x21c4('0xe9')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xea'),require(_0x21c4('0xeb')));_0xd7340['use'](_0x21c4('0xec'),require(_0x21c4('0xed')));_0xd7340['use'](_0x21c4('0xee'),require('./api/cmList'));_0xd7340[_0x21c4('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0xd7340['use']('/api/userProfiles',require(_0x21c4('0xef')));_0xd7340[_0x21c4('0x7')]('/api/userProfile/sections',require('./api/userProfileSection'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf0'),require('./api/userProfileResource'));_0xd7340[_0x21c4('0x7')]('/api/userNotifications',require('./api/userNotification'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf1'),require('./api/whatsappAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf2'),require(_0x21c4('0xf3')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf4'),require('./api/whatsappInteraction'));_0xd7340['use']('/api/whatsapp/messages',require(_0x21c4('0xf5')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf6'),require(_0x21c4('0xf7')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf8'),require(_0x21c4('0xf9')));_0xd7340[_0x21c4('0x7')]('/api/whatsapp/queues',require(_0x21c4('0xfa')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xfb'),require(_0x21c4('0xfc')));_0xd7340['use'](_0x21c4('0xfd'),require(_0x21c4('0xfe')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xff'),require(_0x21c4('0x100')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x101'),require(_0x21c4('0x102')));_0xd7340['use'](_0x21c4('0x103'),require(_0x21c4('0x104')));_0xd7340[_0x21c4('0x7')]('/api/auth/activedirectory',require(_0x21c4('0x105')));_0xd7340['use'](_0x21c4('0x106'),require(_0x21c4('0x107')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x108'),require(_0x21c4('0x109')));_0xd7340['use'](_0x21c4('0x10a'),require('./api/version'));_0xd7340[_0x21c4('0x7')]('/api/system',require('./api/system'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x10b'),require(_0x21c4('0x10c')));_0xd7340['use'](_0x21c4('0x10d'),require('./api/webbar'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x10e'),clientSideLogs);_0xd7340['use']('/apidoc',express[_0x21c4('0x10f')](path[_0x21c4('0x110')](config[_0x21c4('0x111')],_0x21c4('0x112'))));_0xd7340['use'](_0x21c4('0x113'),express[_0x21c4('0x10f')](path['join'](config['root'],_0x21c4('0x113'))));_0xd7340['use']('/demo',express[_0x21c4('0x10f')](path['join'](config[_0x21c4('0x111')],_0x21c4('0x114'))));_0xd7340['use']('/snippet',express[_0x21c4('0x10f')](path[_0x21c4('0x110')](config[_0x21c4('0x111')],_0x21c4('0x115'),_0x21c4('0x116'))));_0xd7340[_0x21c4('0x7')]('/plugins',express[_0x21c4('0x10f')](path['join'](config['root'],'/server/files/plugins')));_0xd7340['route'](_0x21c4('0x117'))['get'](errors[0x194]);_0xd7340[_0x21c4('0x118')]('/*')['get'](function(_0x415dbd,_0x32011d){_0x32011d[_0x21c4('0x119')](path[_0x21c4('0x11a')](_0xd7340[_0x21c4('0x11b')](_0x21c4('0x11c'))+_0x21c4('0x11d')));});return _0xd7340;});}; \ No newline at end of file +var _0x4a47=['/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./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/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/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/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','/api/users','./api/user','use','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition'];(function(_0x455066,_0x2f7063){var _0x233a05=function(_0x3a24ef){while(--_0x3a24ef){_0x455066['push'](_0x455066['shift']());}};_0x233a05(++_0x2f7063);}(_0x4a47,0xb5));var _0x74a4=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x4a47[_0x2bd1ec];return _0x2f7577;};'use strict';var path=require(_0x74a4('0x0'));var express=require(_0x74a4('0x1'));var errors=require(_0x74a4('0x2'));var config=require(_0x74a4('0x3'));var setupLoggers=require(_0x74a4('0x4'))['setupLoggers'];var clientSideLogs=require(_0x74a4('0x5'));exports['default']=function(_0x2aa3d1){return setupLoggers(_0x2aa3d1)[_0x74a4('0x6')](function(){_0x2aa3d1['use'](_0x74a4('0x7'),require(_0x74a4('0x8')));_0x2aa3d1[_0x74a4('0x9')]('/api/voice/chanspy',require(_0x74a4('0xa')));_0x2aa3d1['use'](_0x74a4('0xb'),require('./api/voiceContext'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xc'),require(_0x74a4('0xd')));_0x2aa3d1[_0x74a4('0x9')]('/api/voice/mohs',require(_0x74a4('0xe')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf'),require(_0x74a4('0x10')));_0x2aa3d1['use'](_0x74a4('0x11'),require(_0x74a4('0x12')));_0x2aa3d1[_0x74a4('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x13'),require(_0x74a4('0x14')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x15'),require(_0x74a4('0x16')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x17'),require(_0x74a4('0x18')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x19'),require(_0x74a4('0x1a')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x1b'),require(_0x74a4('0x1c')));_0x2aa3d1[_0x74a4('0x9')]('/api/voice/queues/reports',require(_0x74a4('0x1d')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x1e'),require(_0x74a4('0x1f')));_0x2aa3d1['use'](_0x74a4('0x20'),require(_0x74a4('0x21')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x22'),require('./api/voiceTransferReport'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x23'),require('./api/mailServerOut'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x24'),require('./api/mailAccount'));_0x2aa3d1['use'](_0x74a4('0x25'),require(_0x74a4('0x26')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x27'),require('./api/mailSubstatus'));_0x2aa3d1[_0x74a4('0x9')]('/api/mail/interactions',require('./api/mailInteraction'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x28'),require(_0x74a4('0x29')));_0x2aa3d1['use'](_0x74a4('0x2a'),require(_0x74a4('0x2b')));_0x2aa3d1['use'](_0x74a4('0x2c'),require(_0x74a4('0x2d')));_0x2aa3d1['use'](_0x74a4('0x2e'),require(_0x74a4('0x2f')));_0x2aa3d1[_0x74a4('0x9')]('/api/dashboards/items',require(_0x74a4('0x30')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x31'),require(_0x74a4('0x32')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x33'),require('./api/faxApplication'));_0x2aa3d1['use'](_0x74a4('0x34'),require('./api/faxInteraction'));_0x2aa3d1[_0x74a4('0x9')]('/api/fax/messages',require(_0x74a4('0x35')));_0x2aa3d1['use']('/api/fax/queues',require(_0x74a4('0x36')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x37'),require('./api/faxQueueReport'));_0x2aa3d1['use']('/api/sms/accounts',require('./api/smsAccount'));_0x2aa3d1['use']('/api/sms/applications',require(_0x74a4('0x38')));_0x2aa3d1['use'](_0x74a4('0x39'),require(_0x74a4('0x3a')));_0x2aa3d1[_0x74a4('0x9')]('/api/sms/messages',require(_0x74a4('0x3b')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x3c'),require(_0x74a4('0x3d')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x3e'),require(_0x74a4('0x3f')));_0x2aa3d1[_0x74a4('0x9')]('/api/openchannel/applications',require(_0x74a4('0x40')));_0x2aa3d1[_0x74a4('0x9')]('/api/openchannel/interactions',require(_0x74a4('0x41')));_0x2aa3d1['use']('/api/openchannel/messages',require(_0x74a4('0x42')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x43'),require(_0x74a4('0x44')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x45'),require(_0x74a4('0x46')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x47'),require('./api/openchannelQueueReport'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x48'),require(_0x74a4('0x49')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x4a'),require('./api/chatInteraction'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x4b'),require('./api/chatMessage'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x4c'),require(_0x74a4('0x4d')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x4e'),require(_0x74a4('0x4f')));_0x2aa3d1['use'](_0x74a4('0x50'),require(_0x74a4('0x51')));_0x2aa3d1['use'](_0x74a4('0x52'),require(_0x74a4('0x53')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x54'),require(_0x74a4('0x55')));_0x2aa3d1['use'](_0x74a4('0x56'),require(_0x74a4('0x57')));_0x2aa3d1['use'](_0x74a4('0x58'),require(_0x74a4('0x59')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x5a'),require('./api/cmHopperBlack'));_0x2aa3d1['use'](_0x74a4('0x5b'),require('./api/cmHopperFinal'));_0x2aa3d1['use'](_0x74a4('0x5c'),require(_0x74a4('0x5d')));_0x2aa3d1[_0x74a4('0x9')]('/api/cm/custom_fields',require(_0x74a4('0x5e')));_0x2aa3d1[_0x74a4('0x9')]('/api/actions',require(_0x74a4('0x5f')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x60'),require(_0x74a4('0x61')));_0x2aa3d1['use'](_0x74a4('0x62'),require(_0x74a4('0x63')));_0x2aa3d1['use'](_0x74a4('0x64'),require(_0x74a4('0x65')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x66'),require(_0x74a4('0x67')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x68'),require(_0x74a4('0x69')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x6a'),require(_0x74a4('0x6b')));_0x2aa3d1['use'](_0x74a4('0x6c'),require('./api/cdr'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x6d'),require(_0x74a4('0x6e')));_0x2aa3d1['use'](_0x74a4('0x6f'),require(_0x74a4('0x70')));_0x2aa3d1['use'](_0x74a4('0x71'),require(_0x74a4('0x72')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x73'),require(_0x74a4('0x74')));_0x2aa3d1['use']('/api/contact_item_types',require('./api/contactItemType'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x75'),require(_0x74a4('0x76')));_0x2aa3d1['use'](_0x74a4('0x77'),require(_0x74a4('0x78')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x79'),require('./api/template'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x7a'),require('./api/trigger'));_0x2aa3d1['use'](_0x74a4('0x7b'),require(_0x74a4('0x7c')));_0x2aa3d1['use'](_0x74a4('0x7d'),require(_0x74a4('0x7e')));_0x2aa3d1['use'](_0x74a4('0x7f'),require(_0x74a4('0x80')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x81'),require(_0x74a4('0x82')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x83'),require(_0x74a4('0x84')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x85'),require(_0x74a4('0x86')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x87'),require(_0x74a4('0x88')));_0x2aa3d1['use'](_0x74a4('0x89'),require('./api/analyticFieldReport'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x8a'),require(_0x74a4('0x8b')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x8c'),require(_0x74a4('0x8d')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x8e'),require('./api/intSalesforceConfiguration'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x8f'),require('./api/intSalesforceField'));_0x2aa3d1[_0x74a4('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x74a4('0x90')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x91'),require(_0x74a4('0x92')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x93'),require(_0x74a4('0x94')));_0x2aa3d1['use'](_0x74a4('0x95'),require(_0x74a4('0x96')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x97'),require(_0x74a4('0x98')));_0x2aa3d1['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x2aa3d1['use'](_0x74a4('0x99'),require(_0x74a4('0x9a')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x9b'),require(_0x74a4('0x9c')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x9d'),require(_0x74a4('0x9e')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x9f'),require(_0x74a4('0xa0')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xa1'),require(_0x74a4('0xa2')));_0x2aa3d1['use'](_0x74a4('0xa3'),require(_0x74a4('0xa4')));_0x2aa3d1['use']('/api/integrations/freshdesk/accounts',require(_0x74a4('0xa5')));_0x2aa3d1['use'](_0x74a4('0xa6'),require(_0x74a4('0xa7')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xa8'),require(_0x74a4('0xa9')));_0x2aa3d1['use']('/api/integrations/vtiger/accounts',require(_0x74a4('0xaa')));_0x2aa3d1['use'](_0x74a4('0xab'),require('./api/intVtigerConfiguration'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xac'),require(_0x74a4('0xad')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xae'),require(_0x74a4('0xaf')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xb0'),require('./api/intServicenowConfiguration'));_0x2aa3d1['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x2aa3d1['use']('/api/integrations/dynamics365/accounts',require(_0x74a4('0xb1')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xb2'),require('./api/intDynamics365Configuration'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xb3'),require(_0x74a4('0xb4')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xb5'),require(_0x74a4('0xb6')));_0x2aa3d1[_0x74a4('0x9')]('/api/integrations/freshsales/configurations',require(_0x74a4('0xb7')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xb8'),require(_0x74a4('0xb9')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xba'),require(_0x74a4('0xbb')));_0x2aa3d1['use'](_0x74a4('0xbc'),require(_0x74a4('0xbd')));_0x2aa3d1[_0x74a4('0x9')]('/api/chat/internal/messages',require(_0x74a4('0xbe')));_0x2aa3d1['use'](_0x74a4('0xbf'),require(_0x74a4('0xc0')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xc1'),require(_0x74a4('0xc2')));_0x2aa3d1[_0x74a4('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xc3'),require(_0x74a4('0xc4')));_0x2aa3d1['use'](_0x74a4('0xc5'),require(_0x74a4('0xc6')));_0x2aa3d1['use'](_0x74a4('0xc7'),require(_0x74a4('0xc8')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xc9'),require('./api/jscriptyProject'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xca'),require(_0x74a4('0xcb')));_0x2aa3d1['use'](_0x74a4('0xcc'),require(_0x74a4('0xcd')));_0x2aa3d1[_0x74a4('0x9')]('/api/square/projects',require(_0x74a4('0xce')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xcf'),require(_0x74a4('0xd0')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xd1'),require(_0x74a4('0xd2')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xd3'),require(_0x74a4('0xd4')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xd5'),require(_0x74a4('0xd6')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xd7'),require(_0x74a4('0xd8')));_0x2aa3d1['use']('/api/migrations',require(_0x74a4('0xd9')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xda'),require(_0x74a4('0xdb')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xdc'),require(_0x74a4('0xdd')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xde'),require(_0x74a4('0xdf')));_0x2aa3d1['use'](_0x74a4('0xe0'),require('./api/chatTransferReport'));_0x2aa3d1[_0x74a4('0x9')]('/api/fax/reports/transfer',require(_0x74a4('0xe1')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xe2'),require('./api/openchannelTransferReport'));_0x2aa3d1[_0x74a4('0x9')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x2aa3d1[_0x74a4('0x9')]('/api/cm/lists',require(_0x74a4('0xe3')));_0x2aa3d1['use'](_0x74a4('0xe4'),require(_0x74a4('0xe5')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xe6'),require(_0x74a4('0xe7')));_0x2aa3d1[_0x74a4('0x9')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xe8'),require('./api/userProfileResource'));_0x2aa3d1[_0x74a4('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x2aa3d1[_0x74a4('0x9')]('/api/whatsapp/accounts',require(_0x74a4('0xe9')));_0x2aa3d1['use'](_0x74a4('0xea'),require('./api/whatsappApplication'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xeb'),require(_0x74a4('0xec')));_0x2aa3d1[_0x74a4('0x9')]('/api/whatsapp/messages',require(_0x74a4('0xed')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xee'),require(_0x74a4('0xef')));_0x2aa3d1['use'](_0x74a4('0xf0'),require('./api/whatsappTransferReport'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf1'),require(_0x74a4('0xf2')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf3'),require('./api/cloudProvider'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf4'),require(_0x74a4('0xf5')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf6'),require(_0x74a4('0xf7')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xf8'),require(_0x74a4('0xf9')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xfa'),require(_0x74a4('0xfb')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xfc'),require(_0x74a4('0xfd')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0xfe'),require(_0x74a4('0xff')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x100'),require('./api/rpc'));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x101'),require(_0x74a4('0x102')));_0x2aa3d1['use'](_0x74a4('0x103'),require(_0x74a4('0x104')));_0x2aa3d1['use']('/api/pm2',require(_0x74a4('0x105')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x106'),require(_0x74a4('0x107')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x108'),clientSideLogs);_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x109'),express[_0x74a4('0x10a')](path[_0x74a4('0x10b')](config['root'],_0x74a4('0x109'))));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x10c'),express[_0x74a4('0x10a')](path[_0x74a4('0x10b')](config[_0x74a4('0x10d')],_0x74a4('0x10c'))));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x10e'),express['static'](path[_0x74a4('0x10b')](config['root'],'/demo')));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x10f'),express['static'](path[_0x74a4('0x10b')](config[_0x74a4('0x10d')],_0x74a4('0x110'),_0x74a4('0x111'))));_0x2aa3d1[_0x74a4('0x9')](_0x74a4('0x112'),express[_0x74a4('0x10a')](path[_0x74a4('0x10b')](config['root'],_0x74a4('0x113'))));_0x2aa3d1['route'](_0x74a4('0x114'))[_0x74a4('0x115')](errors[0x194]);_0x2aa3d1[_0x74a4('0x116')]('/*')[_0x74a4('0x115')](function(_0xc687ba,_0x4f8aa7){_0x4f8aa7[_0x74a4('0x117')](path[_0x74a4('0x118')](_0x2aa3d1[_0x74a4('0x115')](_0x74a4('0x119'))+_0x74a4('0x11a')));});return _0x2aa3d1;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2c09336..8f7d49b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fd1=['../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0x9860e6,_0x238ca3){var _0x49ec8f=function(_0x3c41cd){while(--_0x3c41cd){_0x9860e6['push'](_0x9860e6['shift']());}};_0x49ec8f(++_0x238ca3);}(_0x1fd1,0xaa));var _0x11fd=function(_0x4ef308,_0x6d0531){_0x4ef308=_0x4ef308-0x0;var _0x1f3af2=_0x1fd1[_0x4ef308];return _0x1f3af2;};'use strict';var jayson=require('jayson/promise');var _=require(_0x11fd('0x0'));var config=require(_0x11fd('0x1'));exports[_0x11fd('0x2')]=function(){return new Promise(function(_0x117b4d,_0x5d9036){var _0x4bc4a4={};_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/user/user.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/voiceExtension/voiceExtension.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/voiceQueue/voiceQueue.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x4')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x5')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x6')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x7')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/memberReport/memberReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/trunk/trunk.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x8')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x9')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/mailServerIn/mailServerIn.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0xa')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/mailQueue/mailQueue.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xb')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xc')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xd')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xe')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0xf')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x10')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/faxInteraction/faxInteraction.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x11')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/faxQueue/faxQueue.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x12')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x13')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/smsInteraction/smsInteraction.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x14')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x15')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x16')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x17')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x18')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x19')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1a')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1b')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/chatMessage/chatMessage.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1c')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1d')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopper/cmHopper.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1e')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1f')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x20')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/pause/pause.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x21')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x22')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/template/template.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/trigger/trigger.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x23')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x24')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x25')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x26')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x27')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x28')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x29')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x2a')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x2b')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2c')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2d')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2e')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2f')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/squareOdbc/squareOdbc.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x30')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x31')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x32')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x33')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x34')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x35')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x36')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x37')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x38')));var _0xaff737=jayson[_0x11fd('0x39')](_0x4bc4a4)['http']();var _0x23165d=config[_0x11fd('0x3a')][_0x11fd('0x3b')]||config['port']+0x1;var _0x21a66a=config[_0x11fd('0x3a')]['ip']||_0x11fd('0x3c');_0xaff737['on'](_0x11fd('0x3d'),function(_0x3ce080){return _0x5d9036(_0x3ce080);});_0xaff737[_0x11fd('0x2')](_0x23165d,_0x21a66a,function(){console['log'](_0x11fd('0x3e'),_0x21a66a,_0x23165d);require(_0x11fd('0x3f'))[_0x11fd('0x40')]();return _0x117b4d(_0x11fd('0x41')+_0x21a66a+':'+_0x23165d);});});}; \ No newline at end of file +var _0xe364=['../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x2d0156,_0xa3d18d){var _0x3b9f33=function(_0x7bfebb){while(--_0x7bfebb){_0x2d0156['push'](_0x2d0156['shift']());}};_0x3b9f33(++_0xa3d18d);}(_0xe364,0x1ed));var _0x4e36=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0xe364[_0x405385];return _0x43837b;};'use strict';var jayson=require(_0x4e36('0x0'));var _=require('lodash');var config=require(_0x4e36('0x1'));exports[_0x4e36('0x2')]=function(){return new Promise(function(_0x38190d,_0x4cccca){var _0x2fe167={};_0x2fe167=_['merge'](_0x2fe167,require('../api/user/user.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x4')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x5')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/voiceRecording/voiceRecording.rpc'));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x6')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x7')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x8')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x9')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xa')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/trunk/trunk.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xb')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xc')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xd')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xe')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0xf')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x10')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x11')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x12')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x13')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x14')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x15')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x16')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x17')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x18')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x19')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x1a')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x1b')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x1c')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x1d')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x1e')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x1f')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x20')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x21')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/chatQueue/chatQueue.rpc'));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x22')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x23')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x24')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x25')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x26')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x27')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x28')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x29')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x2a')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x2b')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x2c')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x2d')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x2e')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x2f')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x30')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x31')));_0x2fe167=_['merge'](_0x2fe167,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x32')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x33')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x34')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x35')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x36')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x37')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x38')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/setting/setting.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x39')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x3a')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x3b')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x3c')));_0x2fe167=_['merge'](_0x2fe167,require(_0x4e36('0x3d')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x3e')));_0x2fe167=_['merge'](_0x2fe167,require('../api/plugin/plugin.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x3f')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x40')));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2fe167=_[_0x4e36('0x3')](_0x2fe167,require(_0x4e36('0x41')));var _0x205a89=jayson[_0x4e36('0x42')](_0x2fe167)['http']();var _0x27d1da=config[_0x4e36('0x43')][_0x4e36('0x44')]||config[_0x4e36('0x44')]+0x1;var _0x375564=config[_0x4e36('0x43')]['ip']||_0x4e36('0x45');_0x205a89['on'](_0x4e36('0x46'),function(_0x383dcd){return _0x4cccca(_0x383dcd);});_0x205a89[_0x4e36('0x2')](_0x27d1da,_0x375564,function(){console[_0x4e36('0x47')](_0x4e36('0x48'),_0x375564,_0x27d1da);require(_0x4e36('0x49'))[_0x4e36('0x4a')]();return _0x38190d('RPC\x20listening\x20on\x20'+_0x375564+':'+_0x27d1da);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0b3507c..11ad4f1 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 _0x14b2=['sendRequest','sync','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','ready','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','code','close','emit','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','write','destroy','prototype'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x14b2,0x1a1));var _0x214b=function(_0x3859be,_0x65cb87){_0x3859be=_0x3859be-0x0;var _0x5d7246=_0x14b2[_0x3859be];return _0x5d7246;};'use strict';var util=require(_0x214b('0x0'));var _=require(_0x214b('0x1'));var EventEmitter=require('events')[_0x214b('0x2')];var AGIReply=require(_0x214b('0x3'));var AGIError=require(_0x214b('0x4'));function AGIChannel(_0x10fe02){var _0x51ec4f=this,_0x1f27f5=new AGIReply(),_0x445396=![],_0x51b647={};EventEmitter['call'](_0x51ec4f);_0x10fe02[_0x214b('0x5')](_0x214b('0x6'));_0x10fe02[_0x214b('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1f27f5[_0x214b('0x5')](_0x214b('0x6'));_0x1f27f5['on'](_0x214b('0x8'),function(_0x4cd18e){for(var _0x3dff9b in _0x4cd18e){_0x51ec4f[_0x3dff9b]=_0x4cd18e[_0x3dff9b];}_0x51ec4f['emit'](_0x214b('0x9'));});_0x1f27f5['on']('line',function(_0x322c4c){if(_0x322c4c['toLowerCase']()=='hangup'){_0x51ec4f['emit'](_0x214b('0xa'));return;}if(_0x322c4c[_0x214b('0xb')](0x0,0xb)=='520-Invalid'){_0x445396=!![];}if(_0x445396){_0x51b647['rx']+=_0x322c4c+'\x0a';if(_0x322c4c[_0x214b('0xc')](_0x214b('0xd'))!=-0x1){_0x445396=![];}}else{_0x51b647['rx']=_0x322c4c;}if(_0x445396){return;}if(typeof _0x51b647['cb']==_0x214b('0xe')){var _0x5f3d32=_0x51b647['rx']['substring'](0x0,0x3),_0x2af1df=null,_0x5e65ae=null;_0x5f3d32=parseInt(_0x5f3d32);if(isNaN(_0x5f3d32)){_0x51b647['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x214b('0xf')});return;}if(_0x5f3d32!=0xc8){_0x51b647['cb'](null,{'code':_0x5f3d32,'result':-0x1,'extra':'KO'});return;}_0x2af1df=_0x51b647['rx'][_0x214b('0xb')](0x4)[_0x214b('0x10')](_0x214b('0x11'),'');if(_0x2af1df[_0x214b('0x12')]('\x20')!=-0x1){_0x2af1df=_0x2af1df[_0x214b('0x13')](0x0,_0x2af1df['indexOf']('\x20'));}if(_[_0x214b('0x14')](_0x2af1df,'-1')){_0x2af1df=parseInt(_0x2af1df);}_0x5e65ae=_0x51b647['rx']['split']('\x20');if(_0x5e65ae[_0x214b('0x15')]==0x3){_0x5e65ae=_0x5e65ae[0x2][_0x214b('0xb')](0x1,_0x5e65ae[0x2][_0x214b('0x15')]-0x1);}else if(_0x5e65ae['length']>0x3){var _0x4d2557=/\((.+)\)/;var _0x395f35=_0x51b647['rx']['match'](_0x4d2557);if(_0x395f35){_0x5e65ae=_0x395f35[0x1];}else{_0x5e65ae=null;}}else{_0x5e65ae=null;}_0x51b647['cb'](null,{'code':_0x5f3d32,'result':_0x2af1df,'extra':_0x5e65ae});}});_0x10fe02['on'](_0x214b('0x16'),function(_0xbe4932){_0x51ec4f['emit'](_0x214b('0x16'),new AGIError('E_AGI_SOCKET_ERROR',_0xbe4932[_0x214b('0x17')]));});_0x10fe02['on'](_0x214b('0x18'),function(){_0x51ec4f[_0x214b('0x19')]('close',new AGIError(_0x214b('0x1a')));});_0x10fe02['on'](_0x214b('0x1b'),function(){_0x51ec4f[_0x214b('0x19')](_0x214b('0x1b'),new AGIError(_0x214b('0x1c')));_0x10fe02['destroy']();});_0x10fe02['pipe'](_0x1f27f5);this[_0x214b('0x1d')]=function(_0x369dea,_0x23b470){var _0x369dea=_0x369dea||'',_0x23b470=typeof _0x23b470==_0x214b('0xe')?_0x23b470:new Function();_0x51b647={'tx':_0x369dea,'rx':'','cb':_0x23b470};_0x10fe02[_0x214b('0x1e')](_0x369dea+'\x0a');},this[_0x214b('0x18')]=function(){_0x10fe02[_0x214b('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x214b('0x20')][_0x214b('0x21')]=function(_0x7ad1cc){return this[_0x214b('0x1d')][_0x214b('0x22')](this,_0x7ad1cc);};AGIChannel[_0x214b('0x20')][_0x214b('0x23')]=function(){return this[_0x214b('0x21')](_0x214b('0x24'));};AGIChannel[_0x214b('0x20')][_0x214b('0x25')]=function(_0x5a0aea,_0x5e82cb,_0x454bff){_0x5a0aea=_0x5a0aea===undefined?_0x214b('0x26'):_0x5a0aea;_0x5e82cb=_0x5e82cb===undefined?'5':_0x5e82cb;_0x454bff=_0x454bff===undefined?'1':_0x454bff;return this[_0x214b('0x21')](util[_0x214b('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5a0aea,_0x5e82cb*0x3e8,_0x454bff));};AGIChannel[_0x214b('0x20')][_0x214b('0x28')]=function(_0x586879){_0x586879=_0x586879||'NO\x20MESSAGE';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x29'),_0x586879));};AGIChannel['prototype'][_0x214b('0x2a')]=function(_0x4f449f,_0x59d6d9){if(_[_0x214b('0x2b')](_0x59d6d9)){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2c'),_0x4f449f,_0x59d6d9[_0x214b('0x2d')](',')));}return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2c'),_0x4f449f,_0x59d6d9));};AGIChannel['prototype']['setContext']=function(_0x170bbc){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2e'),_0x170bbc));};AGIChannel['prototype']['setExtension']=function(_0x32381a){return this[_0x214b('0x21')](util['format'](_0x214b('0x2f'),_0x32381a));};AGIChannel[_0x214b('0x20')][_0x214b('0x30')]=function(_0xec2cd5){return this[_0x214b('0x21')](util['format'](_0x214b('0x31'),_0xec2cd5));};AGIChannel[_0x214b('0x20')]['hangup']=function(){return this[_0x214b('0x21')]('HANGUP');};AGIChannel['prototype'][_0x214b('0x32')]=function(_0x4832fb,_0x1fd14b){var _0x5c11a4=_[_0x214b('0x33')](_0x1fd14b)||_[_0x214b('0x34')](_0x1fd14b)?_0x1fd14b[_0x214b('0x35')]():_0x1fd14b;return this['sendRequest'](util[_0x214b('0x27')](_0x214b('0x36'),_0x4832fb,_0x5c11a4?_0x5c11a4[_0x214b('0x35')]()[_0x214b('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x214b('0x20')]['sayNumber']=function(_0x4613e5,_0x11b171){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x37'),_0x4613e5,_0x11b171));};AGIChannel[_0x214b('0x20')][_0x214b('0x38')]=function(_0x599270,_0x2e0c69){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x39'),_0x599270,_0x2e0c69));};AGIChannel[_0x214b('0x20')]['sayPhonetic']=function(_0x5af434,_0x509a3b){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x3a'),_0x5af434,_0x509a3b));};AGIChannel[_0x214b('0x20')][_0x214b('0x3b')]=function(_0x49aef2,_0x3d0540,_0x1b36be){_0x3d0540=_0x3d0540||this[_0x214b('0x3c')];_0x1b36be=_0x1b36be||0x1;this[_0x214b('0x3d')](_0x49aef2);this[_0x214b('0x3e')](_0x3d0540);this[_0x214b('0x30')](_0x1b36be);return this['noop'](util[_0x214b('0x27')](_0x214b('0x3f'),_0x49aef2,_0x3d0540,_0x1b36be));};AGIChannel[_0x214b('0x20')][_0x214b('0x40')]=function(_0x4f06cc){return this[_0x214b('0x21')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x4f06cc));};AGIChannel[_0x214b('0x20')][_0x214b('0x41')]=function(_0x451ed0,_0x3457a1,_0x3162a6,_0x33f2e2,_0x565e0a,_0x48c54f){_0x3457a1=_0x3457a1||_0x214b('0x42');_0x3162a6=_0x3162a6||'';_0x33f2e2=_0x33f2e2===undefined?-0x1:_0x33f2e2==='-1'?-0x1:_0x33f2e2*0x3e8;_0x565e0a=_0x565e0a===undefined?'':'s='+_0x565e0a;_0x48c54f=_0x48c54f?_0x214b('0x43'):'';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x44'),_0x451ed0,_0x3457a1,_0x3162a6,_0x33f2e2,_0x48c54f,_0x565e0a));};AGIChannel[_0x214b('0x20')][_0x214b('0x45')]=function(_0xfe3a26,_0x2ffec0){_0x2ffec0=_0x2ffec0||'';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x46'),_0xfe3a26,_0x2ffec0));};AGIChannel['prototype'][_0x214b('0x47')]=function(_0x282cce){return this['exec']('AGI',_0x282cce);};AGIChannel[_0x214b('0x20')]['wait']=function(_0xaab10f){return this['exec'](_0x214b('0x48'),_0xaab10f);};AGIChannel[_0x214b('0x20')][_0x214b('0x16')]=function(_0x22e38c,_0x47ff5d){this[_0x214b('0x28')](util[_0x214b('0x27')](_0x214b('0x49'),_0x22e38c['id'],_0x22e38c[_0x214b('0x4a')],_0x47ff5d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x8a9a=['SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','continueAt','extension','setContext','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','line','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sync','answer','sendRequest','ANSWER','prototype','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber'];(function(_0x583057,_0x5546cd){var _0x19aecf=function(_0x1a08fe){while(--_0x1a08fe){_0x583057['push'](_0x583057['shift']());}};_0x19aecf(++_0x5546cd);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x8a9a[_0x1caf6a];return _0x1bf493;};'use strict';var util=require('util');var _=require(_0xa8a9('0x0'));var EventEmitter=require(_0xa8a9('0x1'))[_0xa8a9('0x2')];var AGIReply=require(_0xa8a9('0x3'));var AGIError=require(_0xa8a9('0x4'));function AGIChannel(_0x16c7af){var _0x2d782d=this,_0x9570dc=new AGIReply(),_0x3fcb8c=![],_0xe5e64b={};EventEmitter[_0xa8a9('0x5')](_0x2d782d);_0x16c7af[_0xa8a9('0x6')]('utf8');_0x16c7af[_0xa8a9('0x7')](0x8*0x3c*0x3c*0x3e8);_0x9570dc['setEncoding'](_0xa8a9('0x8'));_0x9570dc['on'](_0xa8a9('0x9'),function(_0x1477b0){for(var _0x3b1f45 in _0x1477b0){_0x2d782d[_0x3b1f45]=_0x1477b0[_0x3b1f45];}_0x2d782d[_0xa8a9('0xa')]('ready');});_0x9570dc['on'](_0xa8a9('0xb'),function(_0x50071a){if(_0x50071a['toLowerCase']()==_0xa8a9('0xc')){_0x2d782d['emit'](_0xa8a9('0xc'));return;}if(_0x50071a[_0xa8a9('0xd')](0x0,0xb)=='520-Invalid'){_0x3fcb8c=!![];}if(_0x3fcb8c){_0xe5e64b['rx']+=_0x50071a+'\x0a';if(_0x50071a[_0xa8a9('0xe')](_0xa8a9('0xf'))!=-0x1){_0x3fcb8c=![];}}else{_0xe5e64b['rx']=_0x50071a;}if(_0x3fcb8c){return;}if(typeof _0xe5e64b['cb']==_0xa8a9('0x10')){var _0x28d881=_0xe5e64b['rx']['substring'](0x0,0x3),_0x35b204=null,_0x248774=null;_0x28d881=parseInt(_0x28d881);if(isNaN(_0x28d881)){_0xe5e64b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa8a9('0x11')});return;}if(_0x28d881!=0xc8){_0xe5e64b['cb'](null,{'code':_0x28d881,'result':-0x1,'extra':'KO'});return;}_0x35b204=_0xe5e64b['rx'][_0xa8a9('0xd')](0x4)[_0xa8a9('0x12')]('result=','');if(_0x35b204['indexOf']('\x20')!=-0x1){_0x35b204=_0x35b204[_0xa8a9('0x13')](0x0,_0x35b204[_0xa8a9('0x14')]('\x20'));}if(_[_0xa8a9('0x15')](_0x35b204,'-1')){_0x35b204=parseInt(_0x35b204);}_0x248774=_0xe5e64b['rx']['split']('\x20');if(_0x248774[_0xa8a9('0x16')]==0x3){_0x248774=_0x248774[0x2][_0xa8a9('0xd')](0x1,_0x248774[0x2]['length']-0x1);}else if(_0x248774['length']>0x3){var _0x1039c9=/\((.+)\)/;var _0x15d58c=_0xe5e64b['rx'][_0xa8a9('0x17')](_0x1039c9);if(_0x15d58c){_0x248774=_0x15d58c[0x1];}else{_0x248774=null;}}else{_0x248774=null;}_0xe5e64b['cb'](null,{'code':_0x28d881,'result':_0x35b204,'extra':_0x248774});}});_0x16c7af['on'](_0xa8a9('0x18'),function(_0x46a89d){_0x2d782d[_0xa8a9('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x46a89d[_0xa8a9('0x19')]));});_0x16c7af['on']('close',function(){_0x2d782d['emit'](_0xa8a9('0x1a'),new AGIError(_0xa8a9('0x1b')));});_0x16c7af['on'](_0xa8a9('0x1c'),function(){_0x2d782d[_0xa8a9('0xa')](_0xa8a9('0x1c'),new AGIError(_0xa8a9('0x1d')));_0x16c7af[_0xa8a9('0x1e')]();});_0x16c7af[_0xa8a9('0x1f')](_0x9570dc);this[_0xa8a9('0x20')]=function(_0x59d315,_0x102301){var _0x59d315=_0x59d315||'',_0x102301=typeof _0x102301=='function'?_0x102301:new Function();_0xe5e64b={'tx':_0x59d315,'rx':'','cb':_0x102301};_0x16c7af[_0xa8a9('0x21')](_0x59d315+'\x0a');},this[_0xa8a9('0x1a')]=function(){_0x16c7af['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xcca967){return this['command'][_0xa8a9('0x22')](this,_0xcca967);};AGIChannel['prototype'][_0xa8a9('0x23')]=function(){return this[_0xa8a9('0x24')](_0xa8a9('0x25'));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x27')]=function(_0x34d84a,_0x489159,_0x3c210b){_0x34d84a=_0x34d84a===undefined?'beep':_0x34d84a;_0x489159=_0x489159===undefined?'5':_0x489159;_0x3c210b=_0x3c210b===undefined?'1':_0x3c210b;return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x29'),_0x34d84a,_0x489159*0x3e8,_0x3c210b));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x2a')]=function(_0x343c80){_0x343c80=_0x343c80||'NO\x20MESSAGE';return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x2b'),_0x343c80));};AGIChannel['prototype'][_0xa8a9('0x2c')]=function(_0x3f2f30,_0x4af312){if(_['isArray'](_0x4af312)){return this['sendRequest'](util['format'](_0xa8a9('0x2d'),_0x3f2f30,_0x4af312['join'](',')));}return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x2d'),_0x3f2f30,_0x4af312));};AGIChannel[_0xa8a9('0x26')]['setContext']=function(_0x5365f1){return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x2e'),_0x5365f1));};AGIChannel['prototype'][_0xa8a9('0x2f')]=function(_0x70e02d){return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x30'),_0x70e02d));};AGIChannel['prototype'][_0xa8a9('0x31')]=function(_0x209258){return this[_0xa8a9('0x24')](util['format'](_0xa8a9('0x32'),_0x209258));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0xa8a9('0x33'));};AGIChannel['prototype'][_0xa8a9('0x34')]=function(_0xaf9b6b,_0x1c065e){var _0x4ee5a8=_[_0xa8a9('0x35')](_0x1c065e)||_[_0xa8a9('0x36')](_0x1c065e)?_0x1c065e['toString']():_0x1c065e;return this['sendRequest'](util[_0xa8a9('0x28')](_0xa8a9('0x37'),_0xaf9b6b,_0x4ee5a8?_0x4ee5a8['toString']()[_0xa8a9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa8a9('0x26')]['sayNumber']=function(_0xef7228,_0x3545ea){return this[_0xa8a9('0x24')](util['format'](_0xa8a9('0x38'),_0xef7228,_0x3545ea));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x39')]=function(_0x555e9d,_0x280b9d){return this['sendRequest'](util[_0xa8a9('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x555e9d,_0x280b9d));};AGIChannel[_0xa8a9('0x26')]['sayPhonetic']=function(_0x2c9e79,_0x1144d3){return this['sendRequest'](util[_0xa8a9('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2c9e79,_0x1144d3));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x3a')]=function(_0x475a0a,_0x1aaeda,_0xb2534b){_0x1aaeda=_0x1aaeda||this[_0xa8a9('0x3b')];_0xb2534b=_0xb2534b||0x1;this[_0xa8a9('0x3c')](_0x475a0a);this['setExtension'](_0x1aaeda);this[_0xa8a9('0x31')](_0xb2534b);return this[_0xa8a9('0x2a')](util[_0xa8a9('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x475a0a,_0x1aaeda,_0xb2534b));};AGIChannel['prototype']['getVariable']=function(_0x38b323){return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x3d'),_0x38b323));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x3e')]=function(_0x7eb45,_0x2f5650,_0x4cbc17,_0xdaa921,_0x2368c7,_0xaa92f1){_0x2f5650=_0x2f5650||_0xa8a9('0x3f');_0x4cbc17=_0x4cbc17||'';_0xdaa921=_0xdaa921===undefined?-0x1:_0xdaa921==='-1'?-0x1:_0xdaa921*0x3e8;_0x2368c7=_0x2368c7===undefined?'':'s='+_0x2368c7;_0xaa92f1=_0xaa92f1?_0xa8a9('0x40'):'';return this[_0xa8a9('0x24')](util['format'](_0xa8a9('0x41'),_0x7eb45,_0x2f5650,_0x4cbc17,_0xdaa921,_0xaa92f1,_0x2368c7));};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x42')]=function(_0x5a218a,_0x18b8b1){_0x18b8b1=_0x18b8b1||'';return this[_0xa8a9('0x24')](util[_0xa8a9('0x28')](_0xa8a9('0x43'),_0x5a218a,_0x18b8b1));};AGIChannel['prototype'][_0xa8a9('0x44')]=function(_0x5ccba7){return this[_0xa8a9('0x2c')](_0xa8a9('0x45'),_0x5ccba7);};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x46')]=function(_0x38b9c0){return this[_0xa8a9('0x2c')]('WAIT',_0x38b9c0);};AGIChannel[_0xa8a9('0x26')][_0xa8a9('0x18')]=function(_0x4f6786,_0x319fd7){this['noop'](util[_0xa8a9('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4f6786['id'],_0x4f6786[_0xa8a9('0x47')],_0x319fd7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa8a9('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0857be8..c3f4317 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 _0xfb18=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x42184d,_0x264f92){var _0x144722=function(_0x4926d8){while(--_0x4926d8){_0x42184d['push'](_0x42184d['shift']());}};_0x144722(++_0x264f92);}(_0xfb18,0xf7));var _0x8fb1=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xfb18[_0x6f1a87];return _0x2495c7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8fb1('0x0'),'E_AGI_ARGUMENT_PORT':_0x8fb1('0x1'),'E_AGI_SERVER_ERROR':_0x8fb1('0x2'),'E_AGI_SERVER_CLOSE':_0x8fb1('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8fb1('0x4'),'E_AGI_SOCKET_CLOSE':_0x8fb1('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x8fb1('0x6'),'E_AGI_COMMAND_EMPTY':_0x8fb1('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8fb1('0x8')};function AGIError(_0x3811db){var _0x3811db=_0x3811db||null,_0x279514=_0x279514||[],_0x173afe=0x1,_0x12a6f3='';if(!error[_0x3811db]){_0x3811db=_0x8fb1('0x9');}_0x279514['push'](error[_0x3811db]);while(arguments[_0x173afe]){_0x279514['push'](arguments[_0x173afe]);_0x173afe++;}_0x12a6f3=util[_0x8fb1('0xa')][_0x8fb1('0xb')](util,_0x279514);this[_0x8fb1('0xc')]=_0x12a6f3;this[_0x8fb1('0xd')]=_0x3811db;}module[_0x8fb1('0xe')]=AGIError; \ No newline at end of file +var _0x83c3=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name'];(function(_0x294184,_0x52c0ff){var _0x2420a7=function(_0x7b0a8c){while(--_0x7b0a8c){_0x294184['push'](_0x294184['shift']());}};_0x2420a7(++_0x52c0ff);}(_0x83c3,0xef));var _0x383c=function(_0xa115c0,_0x50ce1b){_0xa115c0=_0xa115c0-0x0;var _0x4bc842=_0x83c3[_0xa115c0];return _0x4bc842;};'use strict';var util=require(_0x383c('0x0'));var error={'E_AGI_UNDEFINED':_0x383c('0x1'),'E_AGI_ARGUMENT_PORT':_0x383c('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x383c('0x3'),'E_AGI_SOCKET_ERROR':_0x383c('0x4'),'E_AGI_SOCKET_CLOSE':_0x383c('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x383c('0x6'),'E_AGI_COMMAND_EMPTY':_0x383c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x383c('0x8')};function AGIError(_0x26e222){var _0x26e222=_0x26e222||null,_0x55cabe=_0x55cabe||[],_0x1f1a50=0x1,_0x1a3a65='';if(!error[_0x26e222]){_0x26e222=_0x383c('0x9');}_0x55cabe['push'](error[_0x26e222]);while(arguments[_0x1f1a50]){_0x55cabe[_0x383c('0xa')](arguments[_0x1f1a50]);_0x1f1a50++;}_0x1a3a65=util[_0x383c('0xb')]['apply'](util,_0x55cabe);this['message']=_0x1a3a65;this[_0x383c('0xc')]=_0x26e222;}module[_0x383c('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index cf9c9fa..9367c26 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ae=['projectUpdate','E_AGI_SERVER_ERROR','lodash','EventEmitter','ioredis','../../config/environment','defaults','localhost','subscribe','emit','error','message','parse'];(function(_0x3fa2c6,_0xe09fe1){var _0x4a2f3b=function(_0x4de419){while(--_0x4de419){_0x3fa2c6['push'](_0x3fa2c6['shift']());}};_0x4a2f3b(++_0xe09fe1);}(_0x54ae,0x1bc));var _0xe54a=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x54ae[_0x5ebc04];return _0x17845c;};'use strict';var _=require(_0xe54a('0x0'));var EventEmitter=require('events')[_0xe54a('0x1')];var Redis=require(_0xe54a('0x2'));var AGIError=require('./error');var config=require(_0xe54a('0x3'));config['redis']=_[_0xe54a('0x4')](config['redis'],{'host':_0xe54a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xe54a('0x6')]('agi',function(_0xe1edf2){if(_0xe1edf2)return eventEmitter[_0xe54a('0x7')](_0xe54a('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xe1edf2));});sub['on'](_0xe54a('0x9'),function(_0x5bb77b,_0x56bc6e){if(_0x5bb77b!=='agi')return;try{var _0x453052=JSON[_0xe54a('0xa')](_0x56bc6e);eventEmitter['emit'](_0xe54a('0xb'),_0x453052);}catch(_0x2f13ce){eventEmitter['emit'](_0xe54a('0x8'),new AGIError(_0xe54a('0xc'),_0x2f13ce));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x49a4=['lodash','../../config/environment','redis','defaults','subscribe','emit','error','E_AGI_SERVER_ERROR','agi','parse','projectUpdate','exports'];(function(_0x5afdfb,_0x36d8b2){var _0x549009=function(_0x28cc78){while(--_0x28cc78){_0x5afdfb['push'](_0x5afdfb['shift']());}};_0x549009(++_0x36d8b2);}(_0x49a4,0xfc));var _0x449a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49a4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x449a('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x449a('0x1'));config[_0x449a('0x2')]=_[_0x449a('0x3')](config[_0x449a('0x2')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x449a('0x4')]('agi',function(_0x5497fa){if(_0x5497fa)return eventEmitter[_0x449a('0x5')](_0x449a('0x6'),new AGIError(_0x449a('0x7'),_0x5497fa));});sub['on']('message',function(_0x23ac45,_0x2efcbe){if(_0x23ac45!==_0x449a('0x8'))return;try{var _0x3e9821=JSON[_0x449a('0x9')](_0x2efcbe);eventEmitter['emit'](_0x449a('0xa'),_0x3e9821);}catch(_0xb7effb){eventEmitter[_0x449a('0x5')](_0x449a('0x6'),new AGIError(_0x449a('0x7'),_0xb7effb));}});module[_0x449a('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d6a09ab..40804ec 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 _0x4030=['relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','size'];(function(_0x2ef051,_0x2cc659){var _0x52ef6b=function(_0x1feaf9){while(--_0x1feaf9){_0x2ef051['push'](_0x2ef051['shift']());}};_0x52ef6b(++_0x2cc659);}(_0x4030,0x135));var _0x0403=function(_0x5d85ec,_0x4f6f1c){_0x5d85ec=_0x5d85ec-0x0;var _0xa01f0d=_0x4030[_0x5d85ec];return _0xa01f0d;};'use strict';var _=require(_0x0403('0x0'));var logger=require(_0x0403('0x1'))(_0x0403('0x2'));var verticesWithRetry=['menu',_0x0403('0x3'),_0x0403('0x4')];var Graph=function(){this[_0x0403('0x5')]={};this[_0x0403('0x6')]={};this[_0x0403('0x7')]=0x0;};Graph['prototype'][_0x0403('0x8')]=function(_0x780b02){this[_0x0403('0x5')][_0x780b02['id']]=_0x780b02;this[_0x0403('0x6')][_0x780b02['id']]=[];};Graph[_0x0403('0x9')]['addEdge']=function(_0x30625c,_0x2dd632,_0x24d550){this[_0x0403('0x6')][_0x30625c]['push']({'target':_0x2dd632,'condition':_0x24d550});this[_0x0403('0x7')]+=0x1;};Graph[_0x0403('0x9')][_0x0403('0xa')]=function(){return _['size'](this[_0x0403('0x5')]);};Graph[_0x0403('0x9')][_0x0403('0xb')]=function(){return this[_0x0403('0x7')];};Graph[_0x0403('0x9')][_0x0403('0xc')]=function(_0x186e0e){return this[_0x0403('0x5')][_0x186e0e];};Graph['prototype']['traverseBFS']=function(_0x47a551,_0x92f25d){if(!this[_0x0403('0x5')][_0x47a551]){return logger[_0x0403('0xd')](_0x0403('0xe'));}var _0x56ff9a=_0x92f25d(this[_0x0403('0x5')][_0x47a551]);if(!_0x56ff9a){return logger[_0x0403('0xd')](_0x0403('0xf'));}if(this[_0x0403('0x6')][_0x47a551][_0x0403('0x10')]===0x0){return logger[_0x0403('0xd')](_0x0403('0x11'));}for(var _0x3e37d4=0x0,_0x262870=[],_0x31b8b2=![];_0x3e37d4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','voice'];(function(_0x1f6952,_0x54ee78){var _0x2e59ee=function(_0x398e0a){while(--_0x398e0a){_0x1f6952['push'](_0x1f6952['shift']());}};_0x2e59ee(++_0x54ee78);}(_0x9f3d,0x124));var _0xd9f3=function(_0x51c513,_0x39e49b){_0x51c513=_0x51c513-0x0;var _0x476a7c=_0x9f3d[_0x51c513];return _0x476a7c;};'use strict';var _=require(_0xd9f3('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0xd9f3('0x1'));var logger=require(_0xd9f3('0x2'))('agi');var utilLicense=require(_0xd9f3('0x3'));var rpc=require('./rpc');var Project=require(_0xd9f3('0x4'));var AGIEmitter=require('./events')[_0xd9f3('0x5')];var projects=[];config['agi']=_[_0xd9f3('0x6')](config[_0xd9f3('0x7')],{'ip':_0xd9f3('0x8'),'port':0x11dd});AGIEmitter['on'](_0xd9f3('0x9'),projectUpdateHandler);function connectionHandler(_0x4211dc){process[_0xd9f3('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4211dc);agiHandler(_0x4211dc);}catch(_0x8f8659){logger[_0xd9f3('0xb')](_0x8f8659[_0xd9f3('0xc')]);}});});}function projectUpdateHandler(_0x2dd94f){try{var _0x48c1c9=_[_0xd9f3('0xd')](projects,['id',_0x2dd94f['id']]);if(_0x48c1c9>-0x1){if(_0x2dd94f[_0xd9f3('0xe')]===!![]){projects['splice'](_0x48c1c9,0x1);}else{projects[_0x48c1c9]=_0x2dd94f;}}else{projects[_0xd9f3('0xf')](_0x2dd94f);}}catch(_0x2859f2){logger[_0xd9f3('0xb')](_0x2859f2[_0xd9f3('0xc')]);}}function listeningHandler(){console[_0xd9f3('0x10')](_0xd9f3('0x11'),config[_0xd9f3('0x7')][_0xd9f3('0x12')]);logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xd9f3('0x7')]['port']));}function errorHandler(_0x14168b){if(_0x14168b&&_0x14168b[_0xd9f3('0x15')]&&_0x14168b[_0xd9f3('0x16')]){logger['error'](util[_0xd9f3('0x14')](_0xd9f3('0x17'),_0x14168b['name'],_0x14168b['message']));}else{logger[_0xd9f3('0xb')](util['format'](_0xd9f3('0x18'),_0x14168b[_0xd9f3('0xc')]));}}function closeHandler(){logger[_0xd9f3('0x13')](util['format'](_0xd9f3('0x19'),this['arg_1'],this[_0xd9f3('0x1a')],this[_0xd9f3('0x1b')],this[_0xd9f3('0x1c')],this[_0xd9f3('0x1d')]));try{createSquareReport(this);}catch(_0x46b98b){logger['error'](_0x46b98b[_0xd9f3('0xc')]);}}function timeoutHandler(){logger['info'](util[_0xd9f3('0x14')](_0xd9f3('0x1e'),this[_0xd9f3('0x1f')],this[_0xd9f3('0x1a')],this[_0xd9f3('0x1b')],this['dnid'],this[_0xd9f3('0x1d')]));}function hangupHandler(){logger[_0xd9f3('0x13')](util['format'](_0xd9f3('0x20'),this['arg_1'],this[_0xd9f3('0x1a')],this['callerid'],this['dnid'],this[_0xd9f3('0x1d')]));this[_0xd9f3('0x21')]=!![];}function createSquareReport(_0x58f3d8,_0x508efb){rpc[_0xd9f3('0x22')](_0x58f3d8)[_0xd9f3('0x23')](function(_0x4ce91d){if(_0x508efb){_0x508efb(null,_0x4ce91d);}})[_0xd9f3('0x24')](function(_0x1745f4){if(_0x508efb){_0x508efb(null,_0x1745f4);}});}function setChannelVariables(_0x41b22b){for(var _0x5ea94c in _0x41b22b){if(_0x41b22b['hasOwnProperty'](_0x5ea94c)){if(_0x5ea94c[_0xd9f3('0x25')](_0xd9f3('0x26'))===0x0){_0x41b22b[_0x5ea94c[_0xd9f3('0x27')](0x4)]=_0x41b22b[_0x5ea94c];delete _0x41b22b[_0x5ea94c];}}}}function agiHandler(_0x2753ef){logger[_0xd9f3('0x28')](_0xd9f3('0x29'),JSON['stringify'](_0x2753ef,null,0x2));logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')](_0xd9f3('0x2a'),_0x2753ef[_0xd9f3('0x1f')],_0x2753ef['calleridname'],_0x2753ef['callerid'],_0x2753ef['dnid'],_0x2753ef['uniqueid']));_0x2753ef['on'](_0xd9f3('0xb'),errorHandler);_0x2753ef['on'](_0xd9f3('0x2b'),closeHandler);_0x2753ef['on'](_0xd9f3('0x2c'),timeoutHandler);_0x2753ef['evtHangup']=![];_0x2753ef['on']('hangup',hangupHandler);var _0x36de6b=_['find'](projects,[_0xd9f3('0x15'),_0x2753ef[_0xd9f3('0x1f')]]);if(!_0x36de6b)return Project[_0xd9f3('0x2d')](_0x2753ef);if(!_0x36de6b[_0xd9f3('0x2e')])return Project[_0xd9f3('0x2f')](_0x2753ef);return Project[_0xd9f3('0x30')](_0x36de6b,_0x2753ef);}function main(){var _0x4411eb;return utilLicense['getLicense']()[_0xd9f3('0x23')](function(_0x58323e){if(!_0x58323e)return;if(_0x58323e[_0xd9f3('0x31')]){if(_0x58323e['callysquare']&&_0x58323e['callysquare']>0x0){logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x58323e[_0xd9f3('0x32')]));_0x4411eb=_0x58323e[_0xd9f3('0x32')];}else{logger[_0xd9f3('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd9f3('0x13')](_0xd9f3('0x33'));_0x4411eb=-0x1;}})[_0xd9f3('0x23')](function(){return Project[_0xd9f3('0x34')]();})['then'](function(_0x2a98ff){projects=_0x2a98ff;return;})[_0xd9f3('0x24')](function(_0x29c4bd){logger[_0xd9f3('0xb')](_0xd9f3('0x35'),_0x29c4bd[_0xd9f3('0xc')]);})['finally'](function(){var _0x40614f=require(_0xd9f3('0x36'))(config[_0xd9f3('0x7')][_0xd9f3('0x12')],config['agi']['ip'],_0x4411eb);_0x40614f['on'](_0xd9f3('0xb'),errorHandler);_0x40614f['on'](_0xd9f3('0x37'),listeningHandler);_0x40614f['on'](_0xd9f3('0x38'),connectionHandler);_0x40614f['on'](_0xd9f3('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0xc634=['[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','port','listening','connection','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','EventEmitter','agi','127.0.0.1','projectUpdate','error','findIndex','deleted','splice','stack','log','info','format','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xc634,0x139));var _0x4c63=function(_0x3d686e,_0x2d1c24){_0x3d686e=_0x3d686e-0x0;var _0x27cad7=_0xc634[_0x3d686e];return _0x27cad7;};'use strict';var _=require('lodash');var syncho=require(_0x4c63('0x0'));var util=require(_0x4c63('0x1'));var config=require(_0x4c63('0x2'));var logger=require(_0x4c63('0x3'))('agi');var utilLicense=require(_0x4c63('0x4'));var rpc=require(_0x4c63('0x5'));var Project=require(_0x4c63('0x6'));var AGIEmitter=require('./events')[_0x4c63('0x7')];var projects=[];config['agi']=_['defaults'](config[_0x4c63('0x8')],{'ip':_0x4c63('0x9'),'port':0x11dd});AGIEmitter['on'](_0x4c63('0xa'),projectUpdateHandler);function connectionHandler(_0x327c48){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x327c48);agiHandler(_0x327c48);}catch(_0x121621){logger[_0x4c63('0xb')](_0x121621['stack']);}});});}function projectUpdateHandler(_0x304174){try{var _0x2016ba=_[_0x4c63('0xc')](projects,['id',_0x304174['id']]);if(_0x2016ba>-0x1){if(_0x304174[_0x4c63('0xd')]===!![]){projects[_0x4c63('0xe')](_0x2016ba,0x1);}else{projects[_0x2016ba]=_0x304174;}}else{projects['push'](_0x304174);}}catch(_0x3cc994){logger[_0x4c63('0xb')](_0x3cc994[_0x4c63('0xf')]);}}function listeningHandler(){console[_0x4c63('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x4c63('0x8')]['port']);logger[_0x4c63('0x11')](util[_0x4c63('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4c63('0x8')]['ip'],config[_0x4c63('0x8')]['port']));}function errorHandler(_0x3010a1){if(_0x3010a1&&_0x3010a1['name']&&_0x3010a1[_0x4c63('0x13')]){logger[_0x4c63('0xb')](util['format'](_0x4c63('0x14'),_0x3010a1[_0x4c63('0x15')],_0x3010a1[_0x4c63('0x13')]));}else{logger['error'](util[_0x4c63('0x12')](_0x4c63('0x16'),_0x3010a1[_0x4c63('0xf')]));}}function closeHandler(){logger[_0x4c63('0x11')](util['format'](_0x4c63('0x17'),this[_0x4c63('0x18')],this[_0x4c63('0x19')],this[_0x4c63('0x1a')],this[_0x4c63('0x1b')],this[_0x4c63('0x1c')]));try{createSquareReport(this);}catch(_0x47c465){logger[_0x4c63('0xb')](_0x47c465[_0x4c63('0xf')]);}}function timeoutHandler(){logger[_0x4c63('0x11')](util['format'](_0x4c63('0x1d'),this['arg_1'],this[_0x4c63('0x19')],this[_0x4c63('0x1a')],this[_0x4c63('0x1b')],this[_0x4c63('0x1c')]));}function hangupHandler(){logger['info'](util[_0x4c63('0x12')](_0x4c63('0x1e'),this[_0x4c63('0x18')],this[_0x4c63('0x19')],this[_0x4c63('0x1a')],this[_0x4c63('0x1b')],this[_0x4c63('0x1c')]));this[_0x4c63('0x1f')]=!![];}function createSquareReport(_0x2658f4,_0x19a659){rpc[_0x4c63('0x20')](_0x2658f4)[_0x4c63('0x21')](function(_0x5cbe34){if(_0x19a659){_0x19a659(null,_0x5cbe34);}})['catch'](function(_0x430869){if(_0x19a659){_0x19a659(null,_0x430869);}});}function setChannelVariables(_0x393b89){for(var _0x22b88a in _0x393b89){if(_0x393b89[_0x4c63('0x22')](_0x22b88a)){if(_0x22b88a[_0x4c63('0x23')](_0x4c63('0x24'))===0x0){_0x393b89[_0x22b88a[_0x4c63('0x25')](0x4)]=_0x393b89[_0x22b88a];delete _0x393b89[_0x22b88a];}}}}function agiHandler(_0x36b51f){logger[_0x4c63('0x26')]('variables',JSON[_0x4c63('0x27')](_0x36b51f,null,0x2));logger[_0x4c63('0x11')](util[_0x4c63('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36b51f[_0x4c63('0x18')],_0x36b51f[_0x4c63('0x19')],_0x36b51f['callerid'],_0x36b51f[_0x4c63('0x1b')],_0x36b51f[_0x4c63('0x1c')]));_0x36b51f['on']('error',errorHandler);_0x36b51f['on'](_0x4c63('0x28'),closeHandler);_0x36b51f['on'](_0x4c63('0x29'),timeoutHandler);_0x36b51f[_0x4c63('0x1f')]=![];_0x36b51f['on'](_0x4c63('0x2a'),hangupHandler);var _0x392ef7=_[_0x4c63('0x2b')](projects,[_0x4c63('0x15'),_0x36b51f[_0x4c63('0x18')]]);if(!_0x392ef7)return Project[_0x4c63('0x2c')](_0x36b51f);if(!_0x392ef7[_0x4c63('0x2d')])return Project[_0x4c63('0x2e')](_0x36b51f);return Project[_0x4c63('0x2f')](_0x392ef7,_0x36b51f);}function main(){var _0x1f9405;return utilLicense[_0x4c63('0x30')]()[_0x4c63('0x21')](function(_0x4723eb){if(!_0x4723eb)return;if(_0x4723eb[_0x4c63('0x31')]){if(_0x4723eb['callysquare']&&_0x4723eb[_0x4c63('0x32')]>0x0){logger[_0x4c63('0x11')](util[_0x4c63('0x12')](_0x4c63('0x33'),_0x4723eb['callysquare']));_0x1f9405=_0x4723eb[_0x4c63('0x32')];}else{logger[_0x4c63('0x11')](_0x4c63('0x34'));}}else{logger[_0x4c63('0x11')](_0x4c63('0x35'));_0x1f9405=-0x1;}})[_0x4c63('0x21')](function(){return Project[_0x4c63('0x36')]();})[_0x4c63('0x21')](function(_0x101840){projects=_0x101840;return;})[_0x4c63('0x37')](function(_0x32d233){logger[_0x4c63('0xb')](_0x4c63('0x38'),_0x32d233[_0x4c63('0xf')]);})[_0x4c63('0x39')](function(){var _0x382544=require('./server')(config['agi'][_0x4c63('0x3a')],config[_0x4c63('0x8')]['ip'],_0x1f9405);_0x382544['on'](_0x4c63('0xb'),errorHandler);_0x382544['on'](_0x4c63('0x3b'),listeningHandler);_0x382544['on'](_0x4c63('0x3c'),connectionHandler);_0x382544['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 957538c..283ccb8 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 _0xb1b0=['request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb1b0,0x1cb));var _0x0b1b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1b0[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0b1b('0x0'));var client=jayson[_0x0b1b('0x1')][_0x0b1b('0x2')]({'port':0x232b});function request(_0x58b8b0,_0x3fd938){return new BPromise(function(_0x51c141,_0x1541a9){return client[_0x0b1b('0x3')](_0x58b8b0,_0x3fd938)[_0x0b1b('0x4')](function(_0x32f3ff){if(_0x32f3ff[_0x0b1b('0x5')]){return _0x1541a9(_0x32f3ff[_0x0b1b('0x5')][_0x0b1b('0x6')]);}else{return _0x51c141(_0x32f3ff[_0x0b1b('0x7')]);}})[_0x0b1b('0x8')](function(_0x224a62){return _0x1541a9(_0x224a62);});});}exports[_0x0b1b('0x9')]=function(_0x5889d6,_0x2e914a){return request(_0x0b1b('0xa'),{'account':_0x5889d6,'message':_0x2e914a});}; \ No newline at end of file +var _0xe360=['http','request','then','error','message','result','catch','sendMailMessage','SendMail','client'];(function(_0xff7971,_0x3f2822){var _0x14e06b=function(_0x190479){while(--_0x190479){_0xff7971['push'](_0xff7971['shift']());}};_0x14e06b(++_0x3f2822);}(_0xe360,0xc7));var _0x0e36=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xe360[_0x117f4c];return _0x2b24e9;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x0e36('0x0')][_0x0e36('0x1')]({'port':0x232b});function request(_0x448a0a,_0x112928){return new BPromise(function(_0x5aeb9a,_0x495ae4){return client[_0x0e36('0x2')](_0x448a0a,_0x112928)[_0x0e36('0x3')](function(_0x540e1d){if(_0x540e1d[_0x0e36('0x4')]){return _0x495ae4(_0x540e1d[_0x0e36('0x4')][_0x0e36('0x5')]);}else{return _0x5aeb9a(_0x540e1d[_0x0e36('0x6')]);}})[_0x0e36('0x7')](function(_0x1631f5){return _0x495ae4(_0x1631f5);});});}exports[_0x0e36('0x8')]=function(_0x3ced5a,_0x1ad57c){return request(_0x0e36('0x9'),{'account':_0x3ced5a,'message':_0x1ad57c});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 6063761..2db6949 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x304d=['agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge','toJson','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','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','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','agi','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack'];(function(_0x46fca9,_0x5e6e9e){var _0x40327a=function(_0x2582f6){while(--_0x2582f6){_0x46fca9['push'](_0x46fca9['shift']());}};_0x40327a(++_0x5e6e9e);}(_0x304d,0x121));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var moment=require(_0xd304('0x1'));var parser=require(_0xd304('0x2'));var util=require(_0xd304('0x3'));var logger=require('../../config/logger')(_0xd304('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xd304('0x5'));var Vertices=require(_0xd304('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xd304('0x7')]()[_0xd304('0x8')](function(_0x3b1df9){logger['error'](_0xd304('0x9'),_0x3b1df9[_0xd304('0xa')]);return[];});}function addVertex(_0x4b956,_0x32ce0b,_0x44be28){_0x32ce0b[_0xd304('0xb')]=_0x44be28;if(_0x32ce0b[_0xd304('0xc')](_0xd304('0xd'))){_0x32ce0b[_0xd304('0xe')]=parseInt(_0x32ce0b[_0xd304('0xd')],0xa);}_0x4b956[_0xd304('0xf')](_['omit'](_0x32ce0b,_0xd304('0x10')));}function initGraph(_0x4968de,_0x3ad8e6){var _0x2002b0=new Graph();for(var _0x438303 in _0x4968de){if(_0x4968de['hasOwnProperty'](_0x438303)){if(_['isArray'](_0x4968de[_0x438303])){for(var _0x82b2a1=0x0;_0x82b2a1<_0x4968de[_0x438303][_0xd304('0x11')];_0x82b2a1+=0x1){addVertex(_0x2002b0,_0x4968de[_0x438303][_0x82b2a1],_0x438303);}}else{addVertex(_0x2002b0,_0x4968de[_0x438303],_0x438303);}}}for(var _0x57ce35=0x0;_0x57ce35<_0x3ad8e6[_0xd304('0x11')];_0x57ce35+=0x1){if(_0x3ad8e6[_0x57ce35][_0xd304('0x12')]&&_0x3ad8e6[_0x57ce35][_0xd304('0x13')]){_0x2002b0[_0xd304('0x14')](_0x3ad8e6[_0x57ce35]['source'],_0x3ad8e6[_0x57ce35]['target'],_0x3ad8e6[_0x57ce35]['value']);}}return _0x2002b0;}function getRoot(_0x1aa55a){return parser[_0xd304('0x15')](_0x1aa55a,{'object':!![]})['mxGraphModel'][_0xd304('0x16')];}function inspect(_0x237d29){return util[_0xd304('0x17')](_0x237d29,{'showHidden':![],'depth':null});}function initialize(_0x12fe57,_0xa7482e){var _0x182075=getRoot(_0x12fe57['production']);if(!_0x182075||!_0x182075[_0xd304('0x18')])return;var _0x493214,_0x2c309c,_0x4a7e8e;logger[_0xd304('0x19')](_0xd304('0x16'),JSON[_0xd304('0x1a')](_0x182075,null,0x2));_0xa7482e[_0xd304('0x1b')]=moment()[_0xd304('0x1c')](_0xd304('0x1d'));_0x493214=initGraph(_['omit'](_0x182075,_0xd304('0x10')),_0x182075['mxCell']);_0x2c309c=new Vertices(_0xa7482e,rpc,mailRpc);logger[_0xd304('0x1e')](util[_0xd304('0x1c')](_0xd304('0x1f'),_0xa7482e[_0xd304('0x20')],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e[_0xd304('0x24')]));_0x493214[_0xd304('0x25')](_0x182075[_0xd304('0x18')]['id'],function(_0x5c91a6){try{_0x5c91a6=_0x2c309c[_0xd304('0x26')](_0x5c91a6);logger['debug']('vertex',JSON[_0xd304('0x1a')](_0x5c91a6,null,0x2));if(_0x5c91a6[_0xd304('0xb')]==='gotoc'){logger[_0xd304('0x1e')](_0xd304('0x27'));_0xa7482e[_0xd304('0x28')]=_0x5c91a6[_0xd304('0x28')]||_0xa7482e[_0xd304('0x28')];_0xa7482e[_0xd304('0x29')]=_0x5c91a6['extension'];_0xa7482e[_0xd304('0x2a')]=_0x5c91a6[_0xd304('0x2a')]?_0x5c91a6[_0xd304('0x2a')]-0x1:0x1;return null;}else if(_0x5c91a6&&_0x2c309c[_0x5c91a6[_0xd304('0xb')]]){_0x4a7e8e=_0x2c309c[_0x5c91a6[_0xd304('0xb')]](_0x5c91a6);logger[_0xd304('0x1e')](_0xd304('0x2b'),JSON['stringify'](_0x4a7e8e,null,0x2));if(_0x4a7e8e&&_0x4a7e8e[_0xd304('0x2c')]===AGI_CODE_SUCCESS&&_0x4a7e8e[_0xd304('0x2d')]!==AGI_RESULT_ERROR&&!_0xa7482e[_0xd304('0x2e')]){logger[_0xd304('0x19')]('response',inspect(_0x4a7e8e));return _[_0xd304('0x2f')](_0x4a7e8e[_0xd304('0x2d')])?null:_0x4a7e8e[_0xd304('0x2d')]['toString']();}else{logger['error'](_0xd304('0x2b'),inspect(_0x4a7e8e));return null;}}else{logger[_0xd304('0x30')](_0xd304('0x31'));return null;}}catch(_0x3d02de){logger[_0xd304('0x30')](_0x3d02de[_0xd304('0xa')]);return null;}});if(_0x182075[_0xd304('0x32')]){logger['info'](util['format'](_0xd304('0x33'),_0xa7482e[_0xd304('0x20')],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e['uniqueid']));_0x493214[_0xd304('0x25')](_0x182075[_0xd304('0x32')]['id'],function(_0x46e0c6){try{_0x46e0c6=_0x2c309c[_0xd304('0x26')](_0x46e0c6);logger[_0xd304('0x19')](_0xd304('0x34'),JSON[_0xd304('0x1a')](_0x46e0c6,null,0x2));if(_0x46e0c6&&_0x2c309c[_0x46e0c6[_0xd304('0xb')]]){_0x4a7e8e=_0x2c309c[_0x46e0c6[_0xd304('0xb')]](_0x46e0c6);if(_0x4a7e8e){logger[_0xd304('0x19')](_0xd304('0x2b'),inspect(_0x4a7e8e));return _[_0xd304('0x2f')](_0x4a7e8e[_0xd304('0x2d')])?null:_0x4a7e8e['result'][_0xd304('0x35')]();}else{logger[_0xd304('0x30')](_0xd304('0x2b'),inspect(_0x4a7e8e));return null;}}else{logger[_0xd304('0x30')](_0xd304('0x31'));return null;}}catch(_0x2f8e7c){logger[_0xd304('0x30')](_0x2f8e7c[_0xd304('0xa')]);return null;}});}logger[_0xd304('0x1e')](util[_0xd304('0x1c')](_0xd304('0x36'),_0xa7482e['arg_1'],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e[_0xd304('0x24')]));logger['info'](util[_0xd304('0x1c')](_0xd304('0x37'),_0xa7482e['context'],_0xa7482e[_0xd304('0x29')],parseInt(_0xa7482e[_0xd304('0x2a')],0xa)+0x1));_0xa7482e[_0xd304('0x38')](_0xa7482e[_0xd304('0x28')],_0xa7482e['extension'],parseInt(_0xa7482e[_0xd304('0x2a')],0xa)+0x1);_0xa7482e[_0xd304('0x39')]();}function handleNotFound(_0x4ab210){logger[_0xd304('0x30')](util[_0xd304('0x1c')](_0xd304('0x3a'),_0x4ab210['arg_1']));_0x4ab210['continueAt'](_0x4ab210[_0xd304('0x28')],_0x4ab210['extension'],parseInt(_0x4ab210[_0xd304('0x2a')],0xa)+0x1);_0x4ab210[_0xd304('0x39')]();}function handleUnpublished(_0x1a4699){logger[_0xd304('0x30')](util[_0xd304('0x1c')]('Project\x20%s\x20not\x20published',_0x1a4699['arg_1']));_0x1a4699['continueAt'](_0x1a4699[_0xd304('0x28')],_0x1a4699['extension'],parseInt(_0x1a4699['priority'],0xa)+0x1);_0x1a4699[_0xd304('0x39')]();}module[_0xd304('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x412e=['agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','addVertex','omit','mxCell','length','target','addEdge','source','value','toJson','mxGraphModel','inspect','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','traverseBFS','start','clear','stringify','gotoc','context','extension','priority','response','code','evtHangup','isUndefined','result','arg_1','callerid','uniqueid','vertex','toString','agicommand\x20not\x20found','stack','[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','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x412e,0xb3));var _0xe412=function(_0xd33d44,_0x398fa4){_0xd33d44=_0xd33d44-0x0;var _0x3c1655=_0x412e[_0xd33d44];return _0x3c1655;};'use strict';var _=require('lodash');var moment=require(_0xe412('0x0'));var parser=require(_0xe412('0x1'));var util=require(_0xe412('0x2'));var logger=require(_0xe412('0x3'))(_0xe412('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xe412('0x5'));var Graph=require(_0xe412('0x6'));var Vertices=require(_0xe412('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe412('0x8')]()[_0xe412('0x9')](function(_0x5c44f8){logger[_0xe412('0xa')](_0xe412('0xb'),_0x5c44f8['stack']);return[];});}function addVertex(_0x2eeefd,_0xa9f994,_0x3bca61){_0xa9f994[_0xe412('0xc')]=_0x3bca61;if(_0xa9f994[_0xe412('0xd')]('retry')){_0xa9f994['maxRetry']=parseInt(_0xa9f994['retry'],0xa);}_0x2eeefd[_0xe412('0xe')](_[_0xe412('0xf')](_0xa9f994,_0xe412('0x10')));}function initGraph(_0x5a966e,_0x130398){var _0x298dd8=new Graph();for(var _0x1c244d in _0x5a966e){if(_0x5a966e['hasOwnProperty'](_0x1c244d)){if(_['isArray'](_0x5a966e[_0x1c244d])){for(var _0x500cb6=0x0;_0x500cb6<_0x5a966e[_0x1c244d]['length'];_0x500cb6+=0x1){addVertex(_0x298dd8,_0x5a966e[_0x1c244d][_0x500cb6],_0x1c244d);}}else{addVertex(_0x298dd8,_0x5a966e[_0x1c244d],_0x1c244d);}}}for(var _0x33085c=0x0;_0x33085c<_0x130398[_0xe412('0x11')];_0x33085c+=0x1){if(_0x130398[_0x33085c]['source']&&_0x130398[_0x33085c][_0xe412('0x12')]){_0x298dd8[_0xe412('0x13')](_0x130398[_0x33085c][_0xe412('0x14')],_0x130398[_0x33085c][_0xe412('0x12')],_0x130398[_0x33085c][_0xe412('0x15')]);}}return _0x298dd8;}function getRoot(_0x40e30b){return parser[_0xe412('0x16')](_0x40e30b,{'object':!![]})[_0xe412('0x17')]['root'];}function inspect(_0x1b6f35){return util[_0xe412('0x18')](_0x1b6f35,{'showHidden':![],'depth':null});}function initialize(_0x424afa,_0x444ce3){var _0x1c308e=getRoot(_0x424afa['production']);if(!_0x1c308e||!_0x1c308e['start'])return;var _0x3899a6,_0x449551,_0x1c3aff;logger[_0xe412('0x19')](_0xe412('0x1a'),JSON['stringify'](_0x1c308e,null,0x2));_0x444ce3[_0xe412('0x1b')]=moment()['format'](_0xe412('0x1c'));_0x3899a6=initGraph(_[_0xe412('0xf')](_0x1c308e,_0xe412('0x10')),_0x1c308e[_0xe412('0x10')]);_0x449551=new Vertices(_0x444ce3,rpc,mailRpc);logger[_0xe412('0x1d')](util[_0xe412('0x1e')](_0xe412('0x1f'),_0x444ce3['arg_1'],_0x444ce3[_0xe412('0x20')],_0x444ce3['callerid'],_0x444ce3[_0xe412('0x21')],_0x444ce3['uniqueid']));_0x3899a6[_0xe412('0x22')](_0x1c308e[_0xe412('0x23')]['id'],function(_0x466669){try{_0x466669=_0x449551[_0xe412('0x24')](_0x466669);logger[_0xe412('0x19')]('vertex',JSON[_0xe412('0x25')](_0x466669,null,0x2));if(_0x466669['agicommand']===_0xe412('0x26')){logger[_0xe412('0x1d')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x444ce3[_0xe412('0x27')]=_0x466669[_0xe412('0x27')]||_0x444ce3['context'];_0x444ce3[_0xe412('0x28')]=_0x466669[_0xe412('0x28')];_0x444ce3[_0xe412('0x29')]=_0x466669[_0xe412('0x29')]?_0x466669[_0xe412('0x29')]-0x1:0x1;return null;}else if(_0x466669&&_0x449551[_0x466669[_0xe412('0xc')]]){_0x1c3aff=_0x449551[_0x466669[_0xe412('0xc')]](_0x466669);logger[_0xe412('0x1d')](_0xe412('0x2a'),JSON[_0xe412('0x25')](_0x1c3aff,null,0x2));if(_0x1c3aff&&_0x1c3aff[_0xe412('0x2b')]===AGI_CODE_SUCCESS&&_0x1c3aff['result']!==AGI_RESULT_ERROR&&!_0x444ce3[_0xe412('0x2c')]){logger[_0xe412('0x19')](_0xe412('0x2a'),inspect(_0x1c3aff));return _[_0xe412('0x2d')](_0x1c3aff[_0xe412('0x2e')])?null:_0x1c3aff['result']['toString']();}else{logger[_0xe412('0xa')]('response',inspect(_0x1c3aff));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x2a57b6){logger[_0xe412('0xa')](_0x2a57b6['stack']);return null;}});if(_0x1c308e['finally']){logger['info'](util[_0xe412('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x444ce3[_0xe412('0x2f')],_0x444ce3['calleridname'],_0x444ce3[_0xe412('0x30')],_0x444ce3[_0xe412('0x21')],_0x444ce3[_0xe412('0x31')]));_0x3899a6[_0xe412('0x22')](_0x1c308e['finally']['id'],function(_0x521a93){try{_0x521a93=_0x449551[_0xe412('0x24')](_0x521a93);logger['debug'](_0xe412('0x32'),JSON[_0xe412('0x25')](_0x521a93,null,0x2));if(_0x521a93&&_0x449551[_0x521a93[_0xe412('0xc')]]){_0x1c3aff=_0x449551[_0x521a93['agicommand']](_0x521a93);if(_0x1c3aff){logger[_0xe412('0x19')](_0xe412('0x2a'),inspect(_0x1c3aff));return _[_0xe412('0x2d')](_0x1c3aff['result'])?null:_0x1c3aff['result'][_0xe412('0x33')]();}else{logger[_0xe412('0xa')](_0xe412('0x2a'),inspect(_0x1c3aff));return null;}}else{logger[_0xe412('0xa')](_0xe412('0x34'));return null;}}catch(_0xef52bf){logger[_0xe412('0xa')](_0xef52bf[_0xe412('0x35')]);return null;}});}logger[_0xe412('0x1d')](util['format'](_0xe412('0x36'),_0x444ce3[_0xe412('0x2f')],_0x444ce3[_0xe412('0x20')],_0x444ce3[_0xe412('0x30')],_0x444ce3['dnid'],_0x444ce3[_0xe412('0x31')]));logger['info'](util['format'](_0xe412('0x37'),_0x444ce3[_0xe412('0x27')],_0x444ce3[_0xe412('0x28')],parseInt(_0x444ce3['priority'],0xa)+0x1));_0x444ce3[_0xe412('0x38')](_0x444ce3[_0xe412('0x27')],_0x444ce3[_0xe412('0x28')],parseInt(_0x444ce3['priority'],0xa)+0x1);_0x444ce3[_0xe412('0x39')]();}function handleNotFound(_0x1488db){logger[_0xe412('0xa')](util['format'](_0xe412('0x3a'),_0x1488db[_0xe412('0x2f')]));_0x1488db[_0xe412('0x38')](_0x1488db['context'],_0x1488db[_0xe412('0x28')],parseInt(_0x1488db[_0xe412('0x29')],0xa)+0x1);_0x1488db[_0xe412('0x39')]();}function handleUnpublished(_0x18781f){logger['error'](util[_0xe412('0x1e')](_0xe412('0x3b'),_0x18781f['arg_1']));_0x18781f[_0xe412('0x38')](_0x18781f['context'],_0x18781f['extension'],parseInt(_0x18781f['priority'],0xa)+0x1);_0x18781f[_0xe412('0x39')]();}module[_0xe412('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d9ea652..2439049 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 _0x417f=['indexOf','substring','length','slice','trim','headers','emit','line','exports','stream','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString'];(function(_0x1adab0,_0x4da95){var _0x4320b8=function(_0x4757a0){while(--_0x4757a0){_0x1adab0['push'](_0x1adab0['shift']());}};_0x4320b8(++_0x4da95);}(_0x417f,0x91));var _0xf417=function(_0x486fe0,_0x2ee124){_0x486fe0=_0x486fe0-0x0;var _0x5c7539=_0x417f[_0x486fe0];return _0x5c7539;};'use strict';var util=require('util');var Transform=require(_0xf417('0x0'))['Transform'];function AGIReply(_0x4d3b76){Transform[_0xf417('0x1')](this,_0x4d3b76);this[_0xf417('0x2')]='';this[_0xf417('0x3')]=![];}util[_0xf417('0x4')](AGIReply,Transform);AGIReply[_0xf417('0x5')]['_transform']=function(_0x58da0a,_0x4b42d2,_0x4b920a){var _0x389e25='\x0a',_0x4f9722=['\x0a\x0a',_0xf417('0x6')],_0x3a3cb3=-0x1,_0xf67ea4=-0x1,_0x3d9fd5='',_0x3f3396=0x0,_0x315f8a='',_0x2378c2='';this[_0xf417('0x2')]+=_0x58da0a[_0xf417('0x7')]();_0x315f8a=this[_0xf417('0x2')];if(!this[_0xf417('0x3')]){_0x3f3396=0x0;while(_0x4f9722[_0x3f3396]){while((_0xf67ea4=_0x315f8a[_0xf417('0x8')](_0x4f9722[_0x3f3396]))!=-0x1){_0x3d9fd5=_0x4f9722[_0x3f3396];_0x2378c2=_0x315f8a[_0xf417('0x9')](0x0,_0xf67ea4);_0x315f8a=_0x315f8a[_0xf417('0x9')](_0xf67ea4+_0x3d9fd5[_0xf417('0xa')]);var _0xca4a50=_0x2378c2['split'](_0x389e25),_0x23ffa1=0x0,_0x1ea4f7={},_0x39c65c='',_0x1f0300='',_0x2489ea=-0x1;while(_0xca4a50[_0x23ffa1]){_0x2489ea=_0xca4a50[_0x23ffa1][_0xf417('0x8')](':');if(_0x2489ea!=-0x1){_0x39c65c=_0xca4a50[_0x23ffa1][_0xf417('0xb')](0x0,_0x2489ea)[_0xf417('0xc')]();_0x1f0300=_0xca4a50[_0x23ffa1][_0xf417('0xb')](_0x2489ea+0x1)[_0xf417('0xc')]();if(_0x39c65c['length']>0x0){_0x1ea4f7[_0x39c65c]=_0x1f0300;}}else{}_0x23ffa1++;}this['emit'](_0xf417('0xd'),_0x1ea4f7);this['_inBody']=!![];}_0x3f3396++;}this[_0xf417('0x2')]=_0x315f8a;}else{while((_0x3a3cb3=_0x315f8a[_0xf417('0x8')](_0x389e25))!=-0x1){_0x2378c2=_0x315f8a['substring'](0x0,_0x3a3cb3);this[_0xf417('0xe')](_0xf417('0xf'),_0x2378c2);_0x315f8a=_0x315f8a[_0xf417('0x9')](_0x3a3cb3+_0x389e25[_0xf417('0xa')]);}this[_0xf417('0x2')]=_0x315f8a;}_0x4b920a();};module[_0xf417('0x10')]=AGIReply; \ No newline at end of file +var _0x3da0=['_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','split','slice','trim','emit','headers','_inBody','util','stream','Transform','call'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x3da0,0x1e9));var _0x03da=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x3da0[_0x1ce236];return _0x241819;};'use strict';var util=require(_0x03da('0x0'));var Transform=require(_0x03da('0x1'))[_0x03da('0x2')];function AGIReply(_0x49ec80){Transform[_0x03da('0x3')](this,_0x49ec80);this[_0x03da('0x4')]='';this['_inBody']=![];}util[_0x03da('0x5')](AGIReply,Transform);AGIReply[_0x03da('0x6')][_0x03da('0x7')]=function(_0x31c947,_0x349f65,_0x36c6e0){var _0x13dd8d='\x0a',_0x56364a=['\x0a\x0a',_0x03da('0x8')],_0x2df992=-0x1,_0x3476b4=-0x1,_0x4e0d4f='',_0x789ccd=0x0,_0x3aaf75='',_0x1eb78c='';this['_localBuffer']+=_0x31c947['toString']();_0x3aaf75=this['_localBuffer'];if(!this['_inBody']){_0x789ccd=0x0;while(_0x56364a[_0x789ccd]){while((_0x3476b4=_0x3aaf75[_0x03da('0x9')](_0x56364a[_0x789ccd]))!=-0x1){_0x4e0d4f=_0x56364a[_0x789ccd];_0x1eb78c=_0x3aaf75['substring'](0x0,_0x3476b4);_0x3aaf75=_0x3aaf75[_0x03da('0xa')](_0x3476b4+_0x4e0d4f['length']);var _0x52daa=_0x1eb78c[_0x03da('0xb')](_0x13dd8d),_0x510c4b=0x0,_0x372ac5={},_0x44996f='',_0x453dc2='',_0x4e50d6=-0x1;while(_0x52daa[_0x510c4b]){_0x4e50d6=_0x52daa[_0x510c4b][_0x03da('0x9')](':');if(_0x4e50d6!=-0x1){_0x44996f=_0x52daa[_0x510c4b][_0x03da('0xc')](0x0,_0x4e50d6)['trim']();_0x453dc2=_0x52daa[_0x510c4b]['slice'](_0x4e50d6+0x1)[_0x03da('0xd')]();if(_0x44996f['length']>0x0){_0x372ac5[_0x44996f]=_0x453dc2;}}else{}_0x510c4b++;}this[_0x03da('0xe')](_0x03da('0xf'),_0x372ac5);this[_0x03da('0x10')]=!![];}_0x789ccd++;}this['_localBuffer']=_0x3aaf75;}else{while((_0x2df992=_0x3aaf75[_0x03da('0x9')](_0x13dd8d))!=-0x1){_0x1eb78c=_0x3aaf75[_0x03da('0xa')](0x0,_0x2df992);this[_0x03da('0xe')]('line',_0x1eb78c);_0x3aaf75=_0x3aaf75[_0x03da('0xa')](_0x2df992+_0x13dd8d['length']);}this[_0x03da('0x4')]=_0x3aaf75;}_0x36c6e0();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6526cc2..512dfaf 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 _0x34e5=['CloudProvider','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','createSquareRecording','createCmContact','ShowCmHopper','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','moment','client','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp'];(function(_0x4189cf,_0x33d5b9){var _0xe9b93d=function(_0x1717e7){while(--_0x1717e7){_0x4189cf['push'](_0x4189cf['shift']());}};_0xe9b93d(++_0x33d5b9);}(_0x34e5,0x172));var _0x534e=function(_0x424ffd,_0x3ad04d){_0x424ffd=_0x424ffd-0x0;var _0x5e0e89=_0x34e5[_0x424ffd];return _0x5e0e89;};'use strict';var _=require('lodash');var moment=require(_0x534e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x534e('0x1')][_0x534e('0x2')]({'port':0x2329});function request(_0x425ae8,_0x246650){return new Promise(function(_0x83eb2d,_0x50b790){return client[_0x534e('0x3')](_0x425ae8,_0x246650)[_0x534e('0x4')](function(_0x3c772f){if(_0x3c772f[_0x534e('0x5')]){return _0x50b790(_0x3c772f[_0x534e('0x5')][_0x534e('0x6')]);}else{return _0x83eb2d(_0x3c772f[_0x534e('0x7')]);}})['catch'](function(_0x24d562){return _0x50b790(_0x24d562);});});}exports[_0x534e('0x8')]=function(){return request(_0x534e('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x534e('0xa')]=function(_0x4c495c){return request(_0x534e('0xb'),{'options':{'raw':![],'where':{'name':_0x4c495c},'attributes':['production']}});};exports[_0x534e('0xc')]=function(_0x310b6d){return request(_0x534e('0xd'),{'options':{'raw':![],'where':{'id':_0x310b6d},'include':[{'model':'MailServerOut','as':_0x534e('0xe'),'include':[{'model':_0x534e('0xf'),'as':_0x534e('0xf')}]}],'attributes':['id',_0x534e('0x10'),_0x534e('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x31d764){return request(_0x534e('0xb'),{'options':{'where':{'id':_0x31d764},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x12')]=function(_0x359565){return request(_0x534e('0x13'),{'options':{'where':{'id':_0x359565},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x14')]=function(_0x536c9e){return request('ShowVariable',{'options':{'where':{'id':_0x536c9e},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x15')]=function(_0x5bdae2){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5bdae2},'attributes':[_0x534e('0x16')]}});};exports[_0x534e('0x17')]=function(_0x9297b6){return request(_0x534e('0x18'),{'options':{'where':{'id':_0x9297b6},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x19')]=function(_0x100751){return request('GetContactByPhone',{'options':{'where':{'phone':_0x100751[_0x534e('0x1a')]},'attributes':['id']}});};exports[_0x534e('0x1b')]=function(_0x466d74){return request(_0x534e('0x1c'),{'options':{'where':{'id':_0x466d74},'attributes':[_0x534e('0x10')]}});};exports['getSoundById']=function(_0x3f1697){return request(_0x534e('0x1d'),{'options':{'where':{'id':_0x3f1697},'attributes':[_0x534e('0x1e')]}});};exports[_0x534e('0x1f')]=function(_0x4724f9){return request(_0x534e('0x20'),{'options':{'raw':![],'where':{'id':_0x4724f9},'include':[{'model':_0x534e('0x21'),'as':_0x534e('0x22')}]}});};exports[_0x534e('0x23')]=function(_0x5e086a){return request(_0x534e('0x24'),{'options':{'where':{'id':_0x5e086a},'attributes':['id',_0x534e('0x10')]}});};exports[_0x534e('0x25')]=function(_0x4a09ed){return request(_0x534e('0x26'),{'body':_0x4a09ed});};exports[_0x534e('0x27')]=function(_0xf60d40){return request(_0x534e('0x28'),{'body':_0xf60d40});};exports['createSquareReport']=function(_0x42beee){return request('CreateSquareReport',{'body':_[_0x534e('0x29')](_0x42beee,{'project_name':_0x42beee[_0x534e('0x2a')],'prev_project_name':_0x42beee[_0x534e('0x2b')]||'','is_subproject':_0x42beee[_0x534e('0x2b')]?!![]:![],'leaveAt':moment()[_0x534e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x534e('0x2d')]=function(_0x443f85){return request('CreateSquareRecording',{'body':_0x443f85});};exports['createSquareMessage']=function(_0x3abacf){return request('CreateSquareMessage',{'body':_0x3abacf});};exports[_0x534e('0x2e')]=function(_0x3c5c11){return request(_0x534e('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3c5c11[_0x534e('0x1a')],'ListId':_0x3c5c11[_0x534e('0x30')]}}})[_0x534e('0x4')](function(_0x5253b5){if(_0x5253b5){return _0x5253b5;}return request('CreateCmContact',{'body':_0x3c5c11});});};exports['getPauseById']=function(_0x32ae10){return request(_0x534e('0x31'),{'options':{'where':{'id':_0x32ae10},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x32')]=function(_0x423502,_0x1efb5b){return request(_0x534e('0x33'),{'body':{'interface':_0x1efb5b},'options':{'where':_0x423502}});};exports[_0x534e('0x34')]=function(_0x533d62,_0x312744,_0x2867c9){return request(_0x534e('0x35'),{'body':{'type':_0x312744,'uniqueid':_0x2867c9},'options':{'where':_0x533d62}});};exports['agentUnpause']=function(_0x170ff6){return request(_0x534e('0x36'),{'body':{},'options':{'where':_0x170ff6}});};exports['agentLogout']=function(_0x2c01a0){return request('LogoutUser',{'body':{},'options':{'where':_0x2c01a0}});}; \ No newline at end of file +var _0xa1db=['message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','LogoutUser','lodash','moment','jayson/promise','client','request','then','error'];(function(_0x574dea,_0x4cf209){var _0x3ed444=function(_0x3423a2){while(--_0x3423a2){_0x574dea['push'](_0x574dea['shift']());}};_0x3ed444(++_0x4cf209);}(_0xa1db,0xb0));var _0xba1d=function(_0x4555c2,_0x138d83){_0x4555c2=_0x4555c2-0x0;var _0x492d1d=_0xa1db[_0x4555c2];return _0x492d1d;};'use strict';var _=require(_0xba1d('0x0'));var moment=require(_0xba1d('0x1'));var jayson=require(_0xba1d('0x2'));var client=jayson[_0xba1d('0x3')]['http']({'port':0x2329});function request(_0x4ae0dd,_0x476b7f){return new Promise(function(_0x281396,_0x5c8c8b){return client[_0xba1d('0x4')](_0x4ae0dd,_0x476b7f)[_0xba1d('0x5')](function(_0x2c84cd){if(_0x2c84cd[_0xba1d('0x6')]){return _0x5c8c8b(_0x2c84cd[_0xba1d('0x6')][_0xba1d('0x7')]);}else{return _0x281396(_0x2c84cd[_0xba1d('0x8')]);}})[_0xba1d('0x9')](function(_0x3ce8c6){return _0x5c8c8b(_0x3ce8c6);});});}exports[_0xba1d('0xa')]=function(){return request(_0xba1d('0xb'),{'options':{'raw':![],'attributes':['id',_0xba1d('0xc'),_0xba1d('0xd')]}});};exports['getSquareProject']=function(_0x13e642){return request(_0xba1d('0xe'),{'options':{'raw':![],'where':{'name':_0x13e642},'attributes':[_0xba1d('0xd')]}});};exports[_0xba1d('0xf')]=function(_0x2e503f){return request(_0xba1d('0x10'),{'options':{'raw':![],'where':{'id':_0x2e503f},'include':[{'model':_0xba1d('0x11'),'as':_0xba1d('0x12'),'include':[{'model':'CloudProvider','as':_0xba1d('0x13')}]}],'attributes':['id',_0xba1d('0xc'),_0xba1d('0x14')],'smtp':!![]}});};exports[_0xba1d('0x15')]=function(_0x17faf0){return request('ShowSquareProject',{'options':{'where':{'id':_0x17faf0},'attributes':['name']}});};exports[_0xba1d('0x16')]=function(_0x36af42){return request(_0xba1d('0x17'),{'options':{'where':{'id':_0x36af42},'attributes':[_0xba1d('0xc')]}});};exports[_0xba1d('0x18')]=function(_0x126602){return request('ShowVariable',{'options':{'where':{'id':_0x126602},'attributes':['name']}});};exports[_0xba1d('0x19')]=function(_0x24dfc5){return request(_0xba1d('0x1a'),{'options':{'where':{'id':_0x24dfc5},'attributes':['dsn']}});};exports[_0xba1d('0x1b')]=function(_0x59180c){return request(_0xba1d('0x1c'),{'options':{'where':{'id':_0x59180c},'attributes':[_0xba1d('0xc')]}});};exports[_0xba1d('0x1d')]=function(_0x4179e2){return request('GetContactByPhone',{'options':{'where':{'phone':_0x4179e2[_0xba1d('0x1e')]},'attributes':['id']}});};exports[_0xba1d('0x1f')]=function(_0x34149b){return request(_0xba1d('0x20'),{'options':{'where':{'id':_0x34149b},'attributes':[_0xba1d('0xc')]}});};exports[_0xba1d('0x21')]=function(_0x5cac0c){return request(_0xba1d('0x22'),{'options':{'where':{'id':_0x5cac0c},'attributes':[_0xba1d('0x23')]}});};exports[_0xba1d('0x24')]=function(_0x39b8de){return request(_0xba1d('0x25'),{'options':{'raw':![],'where':{'id':_0x39b8de},'include':[{'model':_0xba1d('0x26'),'as':_0xba1d('0x27')}]}});};exports[_0xba1d('0x28')]=function(_0x27d37c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x27d37c},'attributes':['id',_0xba1d('0xc')]}});};exports[_0xba1d('0x29')]=function(_0x44eb3a){return request('CreateSmsMessage',{'body':_0x44eb3a});};exports[_0xba1d('0x2a')]=function(_0x31511b){return request(_0xba1d('0x2b'),{'body':_0x31511b});};exports[_0xba1d('0x2c')]=function(_0x394cd2){return request(_0xba1d('0x2d'),{'body':_[_0xba1d('0x2e')](_0x394cd2,{'project_name':_0x394cd2[_0xba1d('0x2f')],'prev_project_name':_0x394cd2['arg_2']||'','is_subproject':_0x394cd2['arg_2']?!![]:![],'leaveAt':moment()[_0xba1d('0x30')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xba1d('0x31')]=function(_0x479593){return request('CreateSquareRecording',{'body':_0x479593});};exports['createSquareMessage']=function(_0x351373){return request(_0xba1d('0x32'),{'body':_0x351373});};exports[_0xba1d('0x33')]=function(_0x1501aa){return request(_0xba1d('0x34'),{'options':{'raw':![],'where':{'phone':_0x1501aa[_0xba1d('0x1e')],'ListId':_0x1501aa[_0xba1d('0x35')]}}})[_0xba1d('0x5')](function(_0xf38f05){if(_0xf38f05){return _0xf38f05;}return request(_0xba1d('0x36'),{'body':_0x1501aa});});};exports[_0xba1d('0x37')]=function(_0x304a08){return request('ShowPause',{'options':{'where':{'id':_0x304a08},'attributes':[_0xba1d('0xc')]}});};exports[_0xba1d('0x38')]=function(_0x4303e8,_0x39b42c){return request(_0xba1d('0x39'),{'body':{'interface':_0x39b42c},'options':{'where':_0x4303e8}});};exports[_0xba1d('0x3a')]=function(_0x3eb28b,_0x55c222,_0x34b238){return request('PauseUser',{'body':{'type':_0x55c222,'uniqueid':_0x34b238},'options':{'where':_0x3eb28b}});};exports[_0xba1d('0x3b')]=function(_0x18087d){return request('UnpauseUser',{'body':{},'options':{'where':_0x18087d}});};exports['agentLogout']=function(_0x5a402b){return request(_0xba1d('0x3c'),{'body':{},'options':{'where':_0x5a402b}});}; \ 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 78bc215..4b83adb 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 _0x5e8d=['./polly','./lex','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x870f88,_0x3612ef){_0x870f88=_0x870f88-0x0;var _0x3d3ec9=_0x5e8d[_0x870f88];return _0x3d3ec9;};var polly=require(_0xd5e8('0x0'));var lex=require(_0xd5e8('0x1'));module[_0xd5e8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1261=['./lex','exports'];(function(_0x1d99b0,_0x5d2410){var _0x43131f=function(_0x3f95dd){while(--_0x3f95dd){_0x1d99b0['push'](_0x1d99b0['shift']());}};_0x43131f(++_0x5d2410);}(_0x1261,0x144));var _0x1126=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x1261[_0x2074db];return _0x27324c;};var polly=require('./polly');var lex=require(_0x1126('0x0'));module[_0x1126('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 5c362ec..082d159 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 _0x96cc=['./lib/api'];(function(_0x342d20,_0x28a8be){var _0x502ef7=function(_0x4b8868){while(--_0x4b8868){_0x342d20['push'](_0x342d20['shift']());}};_0x502ef7(++_0x28a8be);}(_0x96cc,0x16c));var _0xc96c=function(_0x37e85e,_0x5bc431){_0x37e85e=_0x37e85e-0x0;var _0x160915=_0x96cc[_0x37e85e];return _0x160915;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ No newline at end of file +var _0xda3f=['exports'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xda3f,0xec));var _0xfda3=function(_0x483975,_0x27c531){_0x483975=_0x483975-0x0;var _0xb13e61=_0xda3f[_0x483975];return _0xb13e61;};'use strict';var lex=require('./lib/api');module[_0xfda3('0x0')]=function(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693){return lex(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693);}; \ 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 a907e33..50d0ddc 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(_0x2ddd31,_0x31f22d){var _0x414fb6=function(_0x122ee9){while(--_0x122ee9){_0x2ddd31['push'](_0x2ddd31['shift']());}};_0x414fb6(++_0x31f22d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x2646d4,_0x145df0){var _0x3baa30=function(_0x112b7e){while(--_0x112b7e){_0x2646d4['push'](_0x2646d4['shift']());}};_0x3baa30(++_0x145df0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 79e0d1f..ad27fd6 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 _0x9d0a=['./lib/api','exports'];(function(_0x516e99,_0x509258){var _0x5802f4=function(_0x11f8fe){while(--_0x11f8fe){_0x516e99['push'](_0x516e99['shift']());}};_0x5802f4(++_0x509258);}(_0x9d0a,0x114));var _0xa9d0=function(_0x18ae8f,_0x25f684){_0x18ae8f=_0x18ae8f-0x0;var _0x43e219=_0x9d0a[_0x18ae8f];return _0x43e219;};'use strict';var polly=require(_0xa9d0('0x0'));module[_0xa9d0('0x1')]=function(_0x2641bd,_0x41b9ef,_0x4f70df,_0x2bd438,_0x373172,_0x1ab37e,_0xbf7efd){return polly(_0x2641bd,_0x41b9ef,_0x4f70df,_0x2bd438,_0x373172,_0x1ab37e,_0xbf7efd);}; \ No newline at end of file +var _0x4e28=['exports','./lib/api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4e28,0x103));var _0x84e2=function(_0x3c5d15,_0x3e9c2b){_0x3c5d15=_0x3c5d15-0x0;var _0x8f4d1f=_0x4e28[_0x3c5d15];return _0x8f4d1f;};'use strict';var polly=require(_0x84e2('0x0'));module[_0x84e2('0x1')]=function(_0x4a78d1,_0x30faf0,_0x529208,_0x1f45ca,_0x3dceb0,_0x5231af,_0x568d47){return polly(_0x4a78d1,_0x30faf0,_0x529208,_0x1f45ca,_0x3dceb0,_0x5231af,_0x568d47);}; \ 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 553454f..9a49560 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 _0xa82c=['path','bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xa82c,0x1b9));var _0xca82=function(_0x2fc5a3,_0x54973f){_0x2fc5a3=_0x2fc5a3-0x0;var _0x12302b=_0xa82c[_0x2fc5a3];return _0x12302b;};'use strict';var fs=require('fs');var path=require(_0xca82('0x0'));var BPromise=require(_0xca82('0x1'));var rs=require(_0xca82('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x2143f2,_0x1c2404,_0x4d23cd){return new BPromise(function(_0x31f13c,_0x352bcb){_0x2143f2[_0xca82('0x3')](_0x1c2404,function(_0x266084,_0xe503c9){if(_0x266084){_0x352bcb(_0x266084);}else if(_0xe503c9){if(_0xe503c9[_0xca82('0x4')]instanceof Buffer){fs['writeFile'](_0x4d23cd,_0xe503c9[_0xca82('0x4')],function(_0x2ebbdd){if(_0x2ebbdd){_0x352bcb(_0x2ebbdd);}else{_0x31f13c();}});}else{_0x352bcb(new Error(_0xca82('0x5')));}}else{_0x352bcb(new Error(_0xca82('0x6')));}});});}module['exports']=function(_0xea0187,_0x5872e6,_0x1c311b,_0x4c6343,_0x2e4272,_0x1aebaf,_0x11c6de){var _0x1d378b=new AWS[(_0xca82('0x7'))]({'accessKeyId':_0xea0187,'secretAccessKey':_0x5872e6,'region':_0x1c311b});var _0x4fcfd0={'Text':_0x2e4272,'TextType':_0x1aebaf||'text','OutputFormat':_0xca82('0x8'),'VoiceId':_0x4c6343};return pollyResult(_0x1d378b,_0x4fcfd0,_0x11c6de);}; \ No newline at end of file +var _0x7a9a=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7a9a,0x1ee));var _0xa7a9=function(_0xfc96f6,_0x324451){_0xfc96f6=_0xfc96f6-0x0;var _0x12c4ed=_0x7a9a[_0xfc96f6];return _0x12c4ed;};'use strict';var fs=require('fs');var path=require(_0xa7a9('0x0'));var BPromise=require(_0xa7a9('0x1'));var rs=require(_0xa7a9('0x2'));var AWS=require(_0xa7a9('0x3'));function pollyResult(_0x5de3db,_0x30fd3c,_0x26f349){return new BPromise(function(_0x3d2e97,_0x323b6a){_0x5de3db[_0xa7a9('0x4')](_0x30fd3c,function(_0x29eb26,_0x448971){if(_0x29eb26){_0x323b6a(_0x29eb26);}else if(_0x448971){if(_0x448971[_0xa7a9('0x5')]instanceof Buffer){fs['writeFile'](_0x26f349,_0x448971[_0xa7a9('0x5')],function(_0x4ae4d1){if(_0x4ae4d1){_0x323b6a(_0x4ae4d1);}else{_0x3d2e97();}});}else{_0x323b6a(new Error(_0xa7a9('0x6')));}}else{_0x323b6a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xa7a9('0x7')]=function(_0x539562,_0x49878e,_0x113bf8,_0x3d8bd7,_0x27c3c9,_0x293117,_0x11f1f3){var _0x49ef7d=new AWS[(_0xa7a9('0x8'))]({'accessKeyId':_0x539562,'secretAccessKey':_0x49878e,'region':_0x113bf8});var _0x383517={'Text':_0x27c3c9,'TextType':_0x293117||_0xa7a9('0x9'),'OutputFormat':'mp3','VoiceId':_0x3d8bd7};return pollyResult(_0x49ef7d,_0x383517,_0x11f1f3);}; \ 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 03b6761..22c33ad 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 _0x1d84=['./lib/api','exports'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x1d84,0xf4));var _0x41d8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1d84[_0x5f309e];return _0x487b5e;};'use strict';var asr=require(_0x41d8('0x0'));module[_0x41d8('0x1')]=function(_0x3a755a,_0x315312,_0x585877,_0x211be4){return asr(_0x3a755a,_0x315312,_0x585877);}; \ No newline at end of file +var _0x57d3=['./lib/api','exports'];(function(_0x552fff,_0x483dc8){var _0x4a54cf=function(_0x795f8c){while(--_0x795f8c){_0x552fff['push'](_0x552fff['shift']());}};_0x4a54cf(++_0x483dc8);}(_0x57d3,0x92));var _0x357d=function(_0x1f022b,_0x359fd7){_0x1f022b=_0x1f022b-0x0;var _0x58a5f6=_0x57d3[_0x1f022b];return _0x58a5f6;};'use strict';var asr=require(_0x357d('0x0'));module[_0x357d('0x1')]=function(_0x421c51,_0x560fb0,_0x5525d8,_0x130f01){return asr(_0x421c51,_0x560fb0,_0x5525d8);}; \ 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 de9266a..a8f2197 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 _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0x11bc49,_0x4d9761){var _0x23820f=function(_0x5a520f){while(--_0x5a520f){_0x11bc49['push'](_0x11bc49['shift']());}};_0x23820f(++_0x4d9761);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x802fe1,_0x15435e){_0x802fe1=_0x802fe1-0x0;var _0x3f5fe1=_0xa7b4[_0x802fe1];return _0x3f5fe1;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'json':!![]});});}; \ No newline at end of file +var _0x0487=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x1f3291,_0x92f6b1){var _0x40e2e4=function(_0x22f78f){while(--_0x22f78f){_0x1f3291['push'](_0x1f3291['shift']());}};_0x40e2e4(++_0x92f6b1);}(_0x0487,0x14f));var _0x7048=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x0487[_0x34021d];return _0x16597b;};'use strict';var url=require(_0x7048('0x0'));var BPromise=require(_0x7048('0x1'));var fs=require('fs');var host=_0x7048('0x2');module[_0x7048('0x3')]=function(_0x2d6c45,_0xa0ecc,_0x4e824e){return new BPromise(function(_0x2adc11,_0x4e8f94){var _0xf80df7;if(typeof _0x2d6c45!==_0x7048('0x4')||_0x2d6c45[_0x7048('0x5')]===0x0){return _0x4e8f94(_0x7048('0x6'));}if(typeof _0xa0ecc!=='string'||_0xa0ecc[_0x7048('0x5')]===0x0){return _0x4e8f94(_0x7048('0x7'));}if(typeof _0x4e824e!==_0x7048('0x8')&&(typeof _0x4e824e!=='string'||_0x4e824e[_0x7048('0x5')]===0x0)){return _0x4e8f94('lang\x20should\x20be\x20a\x20string');}try{_0xf80df7=fs[_0x7048('0x9')](_0x2d6c45)[_0x7048('0xa')](_0x7048('0xb'));}catch(_0x162940){return _0x4e8f94(_0x162940);}return _0x2adc11({'method':_0x7048('0xc'),'uri':host+_0x7048('0xd')+_0xa0ecc,'body':{'config':{'encoding':_0x7048('0xe'),'sampleRateHertz':'8000','languageCode':_0x4e824e},'audio':{'content':_0xf80df7}},'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 b1af4c1..10cb4be 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 _0x2705=['exports','./asr'];(function(_0x548657,_0x479937){var _0x8e3ae5=function(_0x552d84){while(--_0x552d84){_0x548657['push'](_0x548657['shift']());}};_0x8e3ae5(++_0x479937);}(_0x2705,0xf7));var _0x5270=function(_0x54098d,_0x37543e){_0x54098d=_0x54098d-0x0;var _0x5a7174=_0x2705[_0x54098d];return _0x5a7174;};var asr=require(_0x5270('0x0'));module[_0x5270('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'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 1845fe1..9619d55 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 _0x372b=['toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','alternatives','transcript','confidence','join','googleASR\x20transcription','name','googleDialogflow','textRequest','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','unlink','error','download\x20error','pipe','protocol','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','then','chmodSync','777','readFileSync'];(function(_0x11f731,_0x5e822e){var _0x3a9fb7=function(_0x14c1d0){while(--_0x14c1d0){_0x11f731['push'](_0x11f731['shift']());}};_0x3a9fb7(++_0x5e822e);}(_0x372b,0x1f3));var _0xb372=function(_0x4e7d41,_0x4b9296){_0x4e7d41=_0x4e7d41-0x0;var _0x1a9382=_0x372b[_0x4e7d41];return _0x1a9382;};'use strict';var apiai=require(_0xb372('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xb372('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xb372('0x2'));var md5=require(_0xb372('0x3'));var path=require(_0xb372('0x4'));var querystring=require(_0xb372('0x5'));var rp=require(_0xb372('0x6'));var rs=require(_0xb372('0x7'));var sox=require(_0xb372('0x8'));var tts=require(_0xb372('0x9'));var urlParse=require(_0xb372('0xa'))[_0xb372('0xb')];var util=require('util');var aws=require(_0xb372('0xc'));var google=require(_0xb372('0xd'));var sestek=require(_0xb372('0xe'));var tilde=require(_0xb372('0xf'));var logger=require(_0xb372('0x10'))(_0xb372('0x11'));var ISPEECH_API=_0xb372('0x12');function downloadFile(_0x221c62,_0x47b715){return new BPromise(function(_0x15b86e,_0x69b271){var _0x5886b9=urlParse(_0x221c62);var _0x376b3b=_0x5886b9['protocol']===_0xb372('0x13')?https:http;var _0x387f3b={'host':_0x5886b9[_0xb372('0x14')],'path':_0x5886b9[_0xb372('0x4')],'headers':{'user-agent':_0xb372('0x15')}};_0x376b3b[_0xb372('0x16')](_0x387f3b,function(_0x5c0bb7){if(_0x5c0bb7[_0xb372('0x17')]!==0xc8){logger['error'](_0xb372('0x18')+_0x221c62+_0xb372('0x19')+_0x5c0bb7['statusCode']+'\x20('+_0x5c0bb7[_0xb372('0x1a')]+')');_0x69b271(new Error(_0xb372('0x18')+_0x221c62+_0xb372('0x19')+_0x5c0bb7['statusCode']+'\x20('+_0x5c0bb7[_0xb372('0x1a')]+')'));return;}var _0x2d8017=fs[_0xb372('0x1b')](_0x47b715);_0x2d8017['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x2d8017['close'](_0x15b86e);});_0x2d8017['on']('error',function(_0xceb078){fs[_0xb372('0x1c')](_0x47b715);logger[_0xb372('0x1d')](_0xb372('0x1e'),_0xceb078);_0x69b271(_0xceb078);});_0x5c0bb7[_0xb372('0x1f')](_0x2d8017);})['on'](_0xb372('0x1d'),function(_0x563645){logger['error'](_0x563645);_0x69b271(_0x563645);})['end']();});}function uploadFile(_0x3cbdc4){return new BPromise(function(_0xc4373b,_0x422797){var _0x5512b9=urlParse(_0x3cbdc4);var _0x15be22=_0x5512b9[_0xb372('0x20')]===_0xb372('0x13')?https:http;var _0x1e12b4={'host':_0x5512b9[_0xb372('0x14')],'path':_0x5512b9['path'],'headers':{'user-agent':_0xb372('0x15')}};_0x15be22['get'](_0x1e12b4,function(_0x538587){if(_0x538587['statusCode']!==0xc8){_0x422797(new Error('request\x20to\x20'+_0x3cbdc4+'\x20failed,\x20status\x20code\x20=\x20'+_0x538587[_0xb372('0x17')]+'\x20('+_0x538587[_0xb372('0x1a')]+')'));return;}var _0x2fdcd5='';_0x538587['on'](_0xb372('0x21'),function(_0x5207c6){_0x2fdcd5+=_0x5207c6;});_0x538587['on'](_0xb372('0x22'),function(){_0xc4373b(_0x2fdcd5);});})['on']('error',function(_0x29c4be){_0x422797(_0x29c4be);})[_0xb372('0x22')]();});}function convertFile(_0x269240,_0x375e7a){return new BPromise(function(_0x2cb201,_0x3a7564){var _0x2e98d5=sox[_0xb372('0x23')](_0x269240,_0x375e7a,{'sampleRate':0x1f40,'format':_0xb372('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e98d5['on'](_0xb372('0x1d'),function(_0x230914){logger[_0xb372('0x1d')](_0xb372('0x25'),_0x230914);_0x3a7564(_0x230914);});_0x2e98d5['on'](_0xb372('0x22'),function(){logger[_0xb372('0x26')](_0xb372('0x27'));_0x2cb201();});_0x2e98d5[_0xb372('0x28')]();});}function base64Decode(_0x19cb2b,_0x1cb409){var _0x3c1fc0=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+'.wav');fs[_0xb372('0x2c')](_0x3c1fc0,_0x19cb2b,'base64');return convertFile(_0x3c1fc0,_0x1cb409)[_0xb372('0x2d')](function(){try{fs[_0xb372('0x1c')](_0x3c1fc0);fs[_0xb372('0x2e')](_0x1cb409,_0xb372('0x2f'));}catch(_0x1be445){logger[_0xb372('0x1d')](_0x1be445);}return _0x1cb409['split']('.')[0x0];});}function base64Encode(_0x3f3be9){var _0x4187a9=fs[_0xb372('0x30')](_0x3f3be9);return new Buffer(_0x4187a9)[_0xb372('0x31')](_0xb372('0x32'));}exports[_0xb372('0x33')]=function(_0x42d509,_0x371258,_0x460549,_0x2cbcbc,_0x530ea7,_0x1b33b7){var _0x29ce69,_0x25af01;var _0x1c9c6e=_0xb372('0x34');var _0xc351d7='?key='+_0x42d509;var _0x18b397={};if(_0x371258===_0xb372('0x35')){_0x18b397[_0xb372('0x36')]={'ssml':_0x460549};}else{_0x18b397[_0xb372('0x36')]={'text':_0x460549};};_0x18b397[_0xb372('0x37')]={'languageCode':_0x2cbcbc,'ssmlGender':_0x530ea7};_0x18b397[_0xb372('0x38')]={'audioEncoding':_0xb372('0x39'),'sampleRateHertz':0x1f40};var _0x3dd9db={'url':_0x1c9c6e+_0xb372('0x3a')+_0xc351d7,'method':_0xb372('0x3b'),'json':!![],'body':_0x18b397};return rp(_0x3dd9db)[_0xb372('0x2d')](function(_0x23099a){return new BPromise(function(_0x52258d,_0x5a5631){_0x29ce69=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0x4a5c74=Buffer[_0xb372('0x3d')](_0x23099a[_0xb372('0x3e')],'base64');return fs[_0xb372('0x3f')](_0x29ce69,_0x4a5c74,function(_0x145e86){_0x5a5631(_0x145e86);},function(_0xe61d9a){fs['chmodSync'](_0x29ce69,_0xb372('0x2f'));_0x52258d(_0xe61d9a);});});})[_0xb372('0x2d')](function(_0x1e95da){_0x25af01=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x29ce69,_0x25af01);})['then'](function(){try{fs[_0xb372('0x1c')](_0x29ce69);fs[_0xb372('0x2e')](_0x25af01,_0xb372('0x2f'));}catch(_0x3b8b23){logger['error'](_0x3b8b23);}logger[_0xb372('0x26')](_0xb372('0x41'),_0x25af01[_0xb372('0x42')]('.')[0x0]);return _0x25af01['split']('.')[0x0];});};exports['googleTTS']=function(_0x4e6166,_0x133921){var _0x1d4f9b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x18b594,_0x53886b;var _0x172dfe;var _0x4db2a0={'encoding':_0xb372('0x43'),'method':'POST','timeout':0x2710,'url':_0x1d4f9b,'headers':{'Content-Type':_0xb372('0x44')},'body':_0xb372('0x45')+encodeURIComponent(JSON[_0xb372('0x46')]([[[_0xb372('0x47'),JSON[_0xb372('0x46')]([_0x4e6166,_0x133921||'en',![],_0xb372('0x48')]),null,'generic']]]))};return rp(_0x4db2a0)[_0xb372('0x2d')](function(_0x263006){try{_0x172dfe=eval(_0x263006[_0xb372('0x49')](0x5))[0x0][0x2];}catch(_0xba1c31){throw new Error(_0xb372('0x4a')+_0x263006[_0xb372('0x21')]);}if(!_0x172dfe){if(_0x4e6166['length']>0xc8){throw new Error(_0xb372('0x4b'));}else{throw new Error(_0xb372('0x4c')+_0x133921+_0xb372('0x4d'));}}try{_0x172dfe=eval(_0x172dfe)[0x0];}catch(_0x5c16e0){throw new Error(_0xb372('0x4a')+res[_0xb372('0x21')]);}const _0x1e3ce0=_0x172dfe;_0x18b594=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));fs[_0xb372('0x2c')](_0x18b594,_0x172dfe,{'encoding':'base64'});_0x53886b=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x18b594,_0x53886b);})[_0xb372('0x2d')](function(){try{fs['unlink'](_0x18b594);fs[_0xb372('0x2e')](_0x53886b,_0xb372('0x2f'));}catch(_0x30ce0d){logger[_0xb372('0x1d')](_0x30ce0d);}logger[_0xb372('0x26')]('goggleTTS\x20path',_0x53886b[_0xb372('0x42')]('.')[0x0]);return _0x53886b[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x4e')]=function(_0x2883b1,_0x154031,_0x30cb7c){return google[_0xb372('0x4f')](_0x2883b1,_0x154031,_0x30cb7c)[_0xb372('0x2d')](function(_0x5a6348){logger[_0xb372('0x26')](_0x5a6348['uri']);return rp(_0x5a6348);})[_0xb372('0x2d')](function(_0xacad64){var _0x1d1eb5='';var _0x1c00d9=0x0;try{fs[_0xb372('0x1c')](_0x2883b1);}catch(_0x466e49){logger[_0xb372('0x1d')](_0x466e49);}if(_0xacad64&&_0xacad64[_0xb372('0x50')]){_0x1d1eb5=_0xacad64[_0xb372('0x50')]['map'](function(_0x519caf){return _0x519caf&&_0x519caf['alternatives'][0x0]&&_0x519caf[_0xb372('0x51')][0x0]['transcript']?_0x519caf[_0xb372('0x51')][0x0][_0xb372('0x52')]:'';})['join']('\x0a');_0x1c00d9=_0xacad64[_0xb372('0x50')]['map'](function(_0x42c1d8){return _0x42c1d8&&_0x42c1d8['alternatives'][0x0]&&_0x42c1d8['alternatives'][0x0][_0xb372('0x53')]?_0x42c1d8['alternatives'][0x0][_0xb372('0x53')]:0x0;})[_0xb372('0x54')]('\x0a');}logger[_0xb372('0x26')](_0xb372('0x55'),_0x1d1eb5);logger[_0xb372('0x26')]('googleASR\x20confidence',_0x1c00d9);return{'transcript':_0x1d1eb5,'confidence':_0x1c00d9};})['catch'](function(_0x182761){logger['error']('[%s]\x20%s:%s',_0x182761[_0xb372('0x17')],_0x182761[_0xb372('0x56')],_0x182761['message']);});};exports[_0xb372('0x57')]=function(_0x49c07b,_0xc67225,_0x1b172f,_0x5352ec){var _0x508923=apiai(_0xc67225,{'language':_0x5352ec||'en'});return _0x508923[_0xb372('0x58')](_0x1b172f,{'sessionId':md5(_0x49c07b)})['then'](function(_0x4f6934){logger[_0xb372('0x26')](JSON[_0xb372('0x46')](_0x4f6934));return{'source':_0x4f6934['result'][_0xb372('0x59')],'resolvedQuery':_0x4f6934['result'][_0xb372('0x5a')],'action':_0x4f6934[_0xb372('0x5b')][_0xb372('0x5c')],'actionIncomplete':_0x4f6934['result'][_0xb372('0x5d')],'speech':_0x4f6934[_0xb372('0x5b')][_0xb372('0x5e')][_0xb372('0x5f')],'score':_0x4f6934[_0xb372('0x5b')][_0xb372('0x60')],'statusCode':_0x4f6934['status'][_0xb372('0x61')],'endConversation':_0x4f6934[_0xb372('0x5b')][_0xb372('0x62')][_0xb372('0x63')]||![],'isFallbackIntent':_0x4f6934[_0xb372('0x5b')][_0xb372('0x62')][_0xb372('0x64')]};});};exports[_0xb372('0x65')]=function(_0xe8e4f,_0x3ac053,_0x2bb5f7,_0x9b48a7,_0x4d9e1a,_0x21cc7e){var _0x3517cd=_0x9b48a7[_0xb372('0x66')](/\\n/g,'\x0a');var _0x590282={'credentials':{'private_key':_0x3517cd,'client_email':_0x2bb5f7}};var _0x548905=new dialogflow[(_0xb372('0x67'))](_0x590282);var _0x5e8c6a=_0x548905[_0xb372('0x68')](_0x3ac053,md5(_0xe8e4f));var _0x42b990={'session':_0x5e8c6a,'queryInput':{'text':{'text':_0x4d9e1a,'languageCode':_0x21cc7e}}};return _0x548905[_0xb372('0x69')](_0x42b990)[_0xb372('0x2d')](function(_0x1720cb){if(_0x1720cb&&_0x1720cb[_0xb372('0x6a')]){logger[_0xb372('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0xb372('0x46')](_0x1720cb));var _0x9fdc35=_0x1720cb[0x0];if(_0x9fdc35){var _0x2969b3={'action':_0x9fdc35['queryResult'][_0xb372('0x5c')],'allRequiredParamsPresent':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x6c')],'endConversation':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x6d')]&&_0x9fdc35[_0xb372('0x6b')]['diagnosticInfo'][_0xb372('0x6e')]?_0x9fdc35['queryResult'][_0xb372('0x6d')]['fields'][_0xb372('0x6f')][_0xb372('0x70')]:![],'fulfillmentText':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x71')],'intentName':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x56')],'intentDisplayName':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x73')],'isFallbackIntent':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x74')],'languageCode':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x75')],'queryText':_0x9fdc35[_0xb372('0x6b')]['queryText'],'responseId':_0x9fdc35[_0xb372('0x76')],'score':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x77')],'speech':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x71')],'providerResponse':JSON[_0xb372('0x46')](_0x1720cb)};return _0x2969b3;}}});};exports[_0xb372('0x78')]=function(_0xb6eb4d,_0x1c1149,_0x3de42d,_0x10b96b){return tilde[_0xb372('0x4f')](_0xb6eb4d,_0x1c1149,_0x3de42d,_0x10b96b)[_0xb372('0x2d')](function(_0x3276d7){try{fs['unlink'](_0xb6eb4d);}catch(_0x464db8){logger['error'](_0x464db8);}logger[_0xb372('0x26')]('Tilde\x20ASR\x20transcription',_0x3276d7[_0xb372('0x52')]);logger['info'](_0xb372('0x79'),_0x3276d7[_0xb372('0x53')]);return _0x3276d7;});};exports[_0xb372('0x7a')]=function(_0x1b5645,_0x4471de,_0x2060c5,_0x3290e8,_0x2b560b,_0x4f51c3){var _0xc46fde=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0x12a209;return aws[_0xb372('0x7b')](_0x1b5645,_0x4471de,_0x2060c5,_0x3290e8,_0x2b560b,_0x4f51c3,_0xc46fde)[_0xb372('0x2d')](function(){_0x12a209=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+'.wav');return convertFile(_0xc46fde,_0x12a209);})['then'](function(){try{fs[_0xb372('0x1c')](_0xc46fde);fs['chmodSync'](_0x12a209,_0xb372('0x2f'));}catch(_0x16108b){logger[_0xb372('0x1d')](_0x16108b);}return _0x12a209[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x7c')]=function(_0x1d71e7,_0x500ab2,_0x24a0dd,_0x76d6dd,_0x4f0311,_0x1519ee){return aws[_0xb372('0x7d')](_0x1d71e7,_0x500ab2,_0x24a0dd,_0x76d6dd,_0x4f0311,_0x1519ee)[_0xb372('0x2d')](function(_0x262d48){logger[_0xb372('0x26')](JSON[_0xb372('0x46')](_0x262d48));return _0x262d48;});};exports[_0xb372('0x7e')]=function(_0x561cd9,_0x462f33,_0x457c07,_0x520644){var _0x57c9bc=util[_0xb372('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x561cd9,encodeURIComponent(_0x462f33),_0x457c07,_0x520644);var _0x3d227a=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0xe95a74;return downloadFile(_0x57c9bc,_0x3d227a)[_0xb372('0x2d')](function(){_0xe95a74=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x3d227a,_0xe95a74);})[_0xb372('0x2d')](function(){try{fs[_0xb372('0x1c')](_0x3d227a);fs[_0xb372('0x2e')](_0xe95a74,_0xb372('0x2f'));}catch(_0xca44b5){logger['error'](_0xca44b5);}return _0xe95a74[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x80')]=function(_0x1cc834,_0x3e334c,_0x82d618,_0x4864df){var _0x2cc4c9=util[_0xb372('0x7f')](_0xb372('0x81'),ISPEECH_API,_0x3e334c,_0x82d618,base64Encode(_0x1cc834),_0x4864df?util['format']('model=%s',encodeURIComponent(_0x4864df)):'freeform=3');return uploadFile(_0x2cc4c9)[_0xb372('0x2d')](function(_0x37b604){return querystring[_0xb372('0xb')](_0x37b604);});};exports['sestekNDA']=function(_0x41ffcd,_0x21fae9){return sestek[_0xb372('0x82')](_0x41ffcd,_0x21fae9)['then'](function(_0x3f2fc9){logger[_0xb372('0x26')](JSON['stringify'](_0x3f2fc9));var _0x69b1cc={'speech':_0x3f2fc9[_0xb372('0x83')],'action':_0x3f2fc9['channelData']?_0x3f2fc9[_0xb372('0x84')][_0xb372('0x85')]:undefined,'actiondata':_0x3f2fc9[_0xb372('0x84')]?_0x3f2fc9[_0xb372('0x84')]['CustomActionData']:undefined};if(_0x3f2fc9[_0xb372('0x84')]&&_0x3f2fc9[_0xb372('0x84')][_0xb372('0x86')]){return base64Decode(_0x3f2fc9[_0xb372('0x84')]['AudioFromTts'][_0xb372('0x87')],path['resolve'](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x40')))['then'](function(_0x1b091){_0x69b1cc[_0xb372('0x88')]=_0x1b091;return _0x69b1cc;});}return _0x69b1cc;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x1752=['voice','audioConfig','MP3','POST','.mp3','from','writeFile','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','base64','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','name','message','googleDialogflow','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','googleDialogflowV2','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','boolValue','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','lex','ispeechTTS','format','777','ispeechASR','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','path','querystring','request-promise','sox','google-tts-api','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','input'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x1752,0x1d4));var _0x2175=function(_0xbe99d1,_0x40b6bf){_0xbe99d1=_0xbe99d1-0x0;var _0x55a727=_0x1752[_0xbe99d1];return _0x55a727;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x2175('0x0'));var dialogflow=require(_0x2175('0x1'));var fs=require('fs');var http=require(_0x2175('0x2'));var https=require(_0x2175('0x3'));var md5=require('md5');var path=require(_0x2175('0x4'));var querystring=require(_0x2175('0x5'));var rp=require(_0x2175('0x6'));var rs=require('randomstring');var sox=require(_0x2175('0x7'));var tts=require(_0x2175('0x8'));var urlParse=require('url')['parse'];var util=require(_0x2175('0x9'));var aws=require(_0x2175('0xa'));var google=require('./google');var sestek=require(_0x2175('0xb'));var tilde=require(_0x2175('0xc'));var logger=require(_0x2175('0xd'))(_0x2175('0xe'));var ISPEECH_API=_0x2175('0xf');function downloadFile(_0x4270be,_0xfa3819){return new BPromise(function(_0x41ce9f,_0x5992c1){var _0x30f378=urlParse(_0x4270be);var _0x55690c=_0x30f378[_0x2175('0x10')]===_0x2175('0x11')?https:http;var _0x3fbe1e={'host':_0x30f378[_0x2175('0x12')],'path':_0x30f378['path'],'headers':{'user-agent':_0x2175('0x13')}};_0x55690c[_0x2175('0x14')](_0x3fbe1e,function(_0x1c8aba){if(_0x1c8aba['statusCode']!==0xc8){logger[_0x2175('0x15')]('request\x20to\x20'+_0x4270be+_0x2175('0x16')+_0x1c8aba[_0x2175('0x17')]+'\x20('+_0x1c8aba[_0x2175('0x18')]+')');_0x5992c1(new Error(_0x2175('0x19')+_0x4270be+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c8aba[_0x2175('0x17')]+'\x20('+_0x1c8aba['statusMessage']+')'));return;}var _0x1969ac=fs['createWriteStream'](_0xfa3819);_0x1969ac['on'](_0x2175('0x1a'),function(){logger[_0x2175('0x1b')](_0x2175('0x1c'));_0x1969ac[_0x2175('0x1d')](_0x41ce9f);});_0x1969ac['on'](_0x2175('0x15'),function(_0x3923e0){fs[_0x2175('0x1e')](_0xfa3819);logger['error'](_0x2175('0x1f'),_0x3923e0);_0x5992c1(_0x3923e0);});_0x1c8aba[_0x2175('0x20')](_0x1969ac);})['on'](_0x2175('0x15'),function(_0x18e090){logger[_0x2175('0x15')](_0x18e090);_0x5992c1(_0x18e090);})[_0x2175('0x21')]();});}function uploadFile(_0x5a3e3d){return new BPromise(function(_0x3598eb,_0x156bb5){var _0x4c483d=urlParse(_0x5a3e3d);var _0x5e95ce=_0x4c483d['protocol']===_0x2175('0x11')?https:http;var _0x14f519={'host':_0x4c483d[_0x2175('0x12')],'path':_0x4c483d[_0x2175('0x4')],'headers':{'user-agent':_0x2175('0x13')}};_0x5e95ce[_0x2175('0x14')](_0x14f519,function(_0x37904a){if(_0x37904a['statusCode']!==0xc8){_0x156bb5(new Error('request\x20to\x20'+_0x5a3e3d+_0x2175('0x16')+_0x37904a[_0x2175('0x17')]+'\x20('+_0x37904a[_0x2175('0x18')]+')'));return;}var _0x30416e='';_0x37904a['on'](_0x2175('0x22'),function(_0x783b0d){_0x30416e+=_0x783b0d;});_0x37904a['on'](_0x2175('0x21'),function(){_0x3598eb(_0x30416e);});})['on']('error',function(_0x322b6b){_0x156bb5(_0x322b6b);})[_0x2175('0x21')]();});}function convertFile(_0x2e93f7,_0x3a8af3){return new BPromise(function(_0x3d1fc3,_0x2add5a){var _0x141524=sox[_0x2175('0x23')](_0x2e93f7,_0x3a8af3,{'sampleRate':0x1f40,'format':_0x2175('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x141524['on']('error',function(_0x244463){logger[_0x2175('0x15')](_0x2175('0x25'),_0x244463);_0x2add5a(_0x244463);});_0x141524['on'](_0x2175('0x21'),function(){logger[_0x2175('0x1b')](_0x2175('0x26'));_0x3d1fc3();});_0x141524[_0x2175('0x27')]();});}function base64Decode(_0x423ea3,_0x58ea95){var _0x997583=path[_0x2175('0x28')](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x2b'));fs[_0x2175('0x2c')](_0x997583,_0x423ea3,'base64');return convertFile(_0x997583,_0x58ea95)[_0x2175('0x2d')](function(){try{fs['unlink'](_0x997583);fs[_0x2175('0x2e')](_0x58ea95,'777');}catch(_0x41c7dc){logger[_0x2175('0x15')](_0x41c7dc);}return _0x58ea95[_0x2175('0x2f')]('.')[0x0];});}function base64Encode(_0x5597ac){var _0x5aead9=fs[_0x2175('0x30')](_0x5597ac);return new Buffer(_0x5aead9)['toString']('base64');}exports['googleCloudTTS']=function(_0x596387,_0x248b18,_0x1b3a52,_0x3f71d0,_0xbbb254,_0x50a4bf){var _0x165302,_0x1f85b5;var _0x1bbb11=_0x2175('0x31');var _0x391bc3=_0x2175('0x32')+_0x596387;var _0x1f79ff={};if(_0x248b18==='ssml'){_0x1f79ff[_0x2175('0x33')]={'ssml':_0x1b3a52};}else{_0x1f79ff[_0x2175('0x33')]={'text':_0x1b3a52};};_0x1f79ff[_0x2175('0x34')]={'languageCode':_0x3f71d0,'ssmlGender':_0xbbb254};_0x1f79ff[_0x2175('0x35')]={'audioEncoding':_0x2175('0x36'),'sampleRateHertz':0x1f40};var _0x1f472d={'url':_0x1bbb11+'text:synthesize'+_0x391bc3,'method':_0x2175('0x37'),'json':!![],'body':_0x1f79ff};return rp(_0x1f472d)[_0x2175('0x2d')](function(_0x43ded4){return new BPromise(function(_0xbca201,_0x7c2b25){_0x165302=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x2175('0x38'));var _0x4ddc70=Buffer[_0x2175('0x39')](_0x43ded4['audioContent'],'base64');return fs[_0x2175('0x3a')](_0x165302,_0x4ddc70,function(_0x1eca00){_0x7c2b25(_0x1eca00);},function(_0x1806fc){fs[_0x2175('0x2e')](_0x165302,'777');_0xbca201(_0x1806fc);});});})['then'](function(_0xa78a11){_0x1f85b5=path['resolve'](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x2b'));return convertFile(_0x165302,_0x1f85b5);})[_0x2175('0x2d')](function(){try{fs[_0x2175('0x1e')](_0x165302);fs[_0x2175('0x2e')](_0x1f85b5,'777');}catch(_0x2fa909){logger[_0x2175('0x15')](_0x2fa909);}logger['info']('googleCloudTTS\x20path',_0x1f85b5[_0x2175('0x2f')]('.')[0x0]);return _0x1f85b5['split']('.')[0x0];});};exports[_0x2175('0x3b')]=function(_0x5cdd29,_0x3829da){var _0x3e8ebe='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x2722fb,_0x1bae75;var _0x1b7110;var _0x14d837={'encoding':_0x2175('0x3c'),'method':_0x2175('0x37'),'timeout':0x2710,'url':_0x3e8ebe,'headers':{'Content-Type':_0x2175('0x3d')},'body':_0x2175('0x3e')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON['stringify']([_0x5cdd29,_0x3829da||'en',![],_0x2175('0x3f')]),null,'generic']]]))};return rp(_0x14d837)['then'](function(_0x2f6b55){try{_0x1b7110=eval(_0x2f6b55[_0x2175('0x40')](0x5))[0x0][0x2];}catch(_0x486cf6){throw new Error(_0x2175('0x41')+_0x2f6b55[_0x2175('0x22')]);}if(!_0x1b7110){if(_0x5cdd29[_0x2175('0x42')]>0xc8){throw new Error(_0x2175('0x43'));}else{throw new Error(_0x2175('0x44')+_0x3829da+_0x2175('0x45'));}}try{_0x1b7110=eval(_0x1b7110)[0x0];}catch(_0x244964){throw new Error(_0x2175('0x41')+res['data']);}const _0x343f23=_0x1b7110;_0x2722fb=path['resolve'](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x38'));fs[_0x2175('0x2c')](_0x2722fb,_0x1b7110,{'encoding':_0x2175('0x46')});_0x1bae75=path['resolve'](__dirname,_0x2175('0x29'),rs['generate'](0x4)+_0x2175('0x2b'));return convertFile(_0x2722fb,_0x1bae75);})[_0x2175('0x2d')](function(){try{fs[_0x2175('0x1e')](_0x2722fb);fs['chmodSync'](_0x1bae75,'777');}catch(_0x444fe8){logger[_0x2175('0x15')](_0x444fe8);}logger[_0x2175('0x1b')]('goggleTTS\x20path',_0x1bae75['split']('.')[0x0]);return _0x1bae75[_0x2175('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x2a8d53,_0x1167c9,_0x5d5b7e){return google[_0x2175('0x47')](_0x2a8d53,_0x1167c9,_0x5d5b7e)[_0x2175('0x2d')](function(_0x597142){logger['info'](_0x597142[_0x2175('0x48')]);return rp(_0x597142);})[_0x2175('0x2d')](function(_0x511a40){var _0x30c308='';var _0x253afe=0x0;try{fs[_0x2175('0x1e')](_0x2a8d53);}catch(_0x396c7e){logger[_0x2175('0x15')](_0x396c7e);}if(_0x511a40&&_0x511a40[_0x2175('0x49')]){_0x30c308=_0x511a40[_0x2175('0x49')][_0x2175('0x4a')](function(_0xa666c6){return _0xa666c6&&_0xa666c6[_0x2175('0x4b')][0x0]&&_0xa666c6[_0x2175('0x4b')][0x0][_0x2175('0x4c')]?_0xa666c6[_0x2175('0x4b')][0x0][_0x2175('0x4c')]:'';})['join']('\x0a');_0x253afe=_0x511a40[_0x2175('0x49')][_0x2175('0x4a')](function(_0x39ec63){return _0x39ec63&&_0x39ec63[_0x2175('0x4b')][0x0]&&_0x39ec63[_0x2175('0x4b')][0x0][_0x2175('0x4d')]?_0x39ec63[_0x2175('0x4b')][0x0][_0x2175('0x4d')]:0x0;})[_0x2175('0x4e')]('\x0a');}logger[_0x2175('0x1b')](_0x2175('0x4f'),_0x30c308);logger[_0x2175('0x1b')]('googleASR\x20confidence',_0x253afe);return{'transcript':_0x30c308,'confidence':_0x253afe};})['catch'](function(_0x4b10bc){logger[_0x2175('0x15')]('[%s]\x20%s:%s',_0x4b10bc[_0x2175('0x17')],_0x4b10bc[_0x2175('0x50')],_0x4b10bc[_0x2175('0x51')]);});};exports[_0x2175('0x52')]=function(_0x36ef71,_0x31547d,_0x54a851,_0x4b8096){var _0x1fbf75=apiai(_0x31547d,{'language':_0x4b8096||'en'});return _0x1fbf75[_0x2175('0x53')](_0x54a851,{'sessionId':md5(_0x36ef71)})[_0x2175('0x2d')](function(_0x58d219){logger['info'](JSON[_0x2175('0x54')](_0x58d219));return{'source':_0x58d219[_0x2175('0x55')]['source'],'resolvedQuery':_0x58d219['result'][_0x2175('0x56')],'action':_0x58d219[_0x2175('0x55')][_0x2175('0x57')],'actionIncomplete':_0x58d219[_0x2175('0x55')][_0x2175('0x58')],'speech':_0x58d219[_0x2175('0x55')][_0x2175('0x59')]['speech'],'score':_0x58d219['result'][_0x2175('0x5a')],'statusCode':_0x58d219[_0x2175('0x5b')][_0x2175('0x5c')],'endConversation':_0x58d219[_0x2175('0x55')][_0x2175('0x5d')][_0x2175('0x5e')]||![],'isFallbackIntent':_0x58d219[_0x2175('0x55')][_0x2175('0x5d')]['isFallbackIntent']};});};exports[_0x2175('0x5f')]=function(_0x5e55d4,_0x391e13,_0x2cc3b9,_0x305d6d,_0x39b92f,_0x58e3c2){var _0x152975=_0x305d6d['replace'](/\\n/g,'\x0a');var _0x179f71={'credentials':{'private_key':_0x152975,'client_email':_0x2cc3b9}};var _0x1e7c50=new dialogflow['SessionsClient'](_0x179f71);var _0x5e342a=_0x1e7c50[_0x2175('0x60')](_0x391e13,md5(_0x5e55d4));var _0x5546e2={'session':_0x5e342a,'queryInput':{'text':{'text':_0x39b92f,'languageCode':_0x58e3c2}}};return _0x1e7c50[_0x2175('0x61')](_0x5546e2)['then'](function(_0x15057e){if(_0x15057e&&_0x15057e[_0x2175('0x42')]){logger[_0x2175('0x1b')]('Dialogflow\x20V2\x20response:',JSON[_0x2175('0x54')](_0x15057e));var _0x3c381b=_0x15057e[0x0];if(_0x3c381b){var _0x278cea={'action':_0x3c381b['queryResult'][_0x2175('0x57')],'allRequiredParamsPresent':_0x3c381b['queryResult']['allRequiredParamsPresent'],'endConversation':_0x3c381b[_0x2175('0x62')][_0x2175('0x63')]&&_0x3c381b[_0x2175('0x62')][_0x2175('0x63')][_0x2175('0x64')]?_0x3c381b[_0x2175('0x62')][_0x2175('0x63')][_0x2175('0x64')]['end_conversation'][_0x2175('0x65')]:![],'fulfillmentText':_0x3c381b[_0x2175('0x62')]['fulfillmentText'],'intentName':_0x3c381b[_0x2175('0x62')]['intent']['name'],'intentDisplayName':_0x3c381b[_0x2175('0x62')]['intent'][_0x2175('0x66')],'isFallbackIntent':_0x3c381b[_0x2175('0x62')]['intent'][_0x2175('0x67')],'languageCode':_0x3c381b[_0x2175('0x62')][_0x2175('0x68')],'queryText':_0x3c381b[_0x2175('0x62')][_0x2175('0x69')],'responseId':_0x3c381b[_0x2175('0x6a')],'score':_0x3c381b[_0x2175('0x62')][_0x2175('0x6b')],'speech':_0x3c381b[_0x2175('0x62')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x15057e)};return _0x278cea;}}});};exports[_0x2175('0x6c')]=function(_0x3087b3,_0x5d8f66,_0x493e66,_0x5b0645){return tilde[_0x2175('0x47')](_0x3087b3,_0x5d8f66,_0x493e66,_0x5b0645)[_0x2175('0x2d')](function(_0x29eb91){try{fs['unlink'](_0x3087b3);}catch(_0x41a114){logger[_0x2175('0x15')](_0x41a114);}logger['info'](_0x2175('0x6d'),_0x29eb91[_0x2175('0x4c')]);logger[_0x2175('0x1b')]('Tilde\x20ASR\x20confidence',_0x29eb91[_0x2175('0x4d')]);return _0x29eb91;});};exports['awsPolly']=function(_0x5e23d4,_0x4cc0f3,_0x29dd30,_0x5b2bce,_0x1d70de,_0x3cc630){var _0x32960f=path['resolve'](__dirname,'tmp',rs[_0x2175('0x2a')](0x4)+_0x2175('0x38'));var _0x5f395d;return aws[_0x2175('0x6e')](_0x5e23d4,_0x4cc0f3,_0x29dd30,_0x5b2bce,_0x1d70de,_0x3cc630,_0x32960f)[_0x2175('0x2d')](function(){_0x5f395d=path[_0x2175('0x28')](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+'.wav');return convertFile(_0x32960f,_0x5f395d);})['then'](function(){try{fs[_0x2175('0x1e')](_0x32960f);fs['chmodSync'](_0x5f395d,'777');}catch(_0x4dc777){logger[_0x2175('0x15')](_0x4dc777);}return _0x5f395d[_0x2175('0x2f')]('.')[0x0];});};exports[_0x2175('0x6f')]=function(_0x44b4a3,_0x451762,_0x4f4242,_0x5dd9f4,_0x3300cf,_0x368b41){return aws[_0x2175('0x70')](_0x44b4a3,_0x451762,_0x4f4242,_0x5dd9f4,_0x3300cf,_0x368b41)['then'](function(_0x3b3c7e){logger[_0x2175('0x1b')](JSON[_0x2175('0x54')](_0x3b3c7e));return _0x3b3c7e;});};exports[_0x2175('0x71')]=function(_0x33f656,_0x37ec89,_0x55a575,_0x1d885b){var _0x1afa71=util[_0x2175('0x72')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x33f656,encodeURIComponent(_0x37ec89),_0x55a575,_0x1d885b);var _0x513786=path[_0x2175('0x28')](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x38'));var _0x3eff6a;return downloadFile(_0x1afa71,_0x513786)[_0x2175('0x2d')](function(){_0x3eff6a=path[_0x2175('0x28')](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x2b'));return convertFile(_0x513786,_0x3eff6a);})[_0x2175('0x2d')](function(){try{fs[_0x2175('0x1e')](_0x513786);fs[_0x2175('0x2e')](_0x3eff6a,_0x2175('0x73'));}catch(_0xdcb5b6){logger['error'](_0xdcb5b6);}return _0x3eff6a['split']('.')[0x0];});};exports[_0x2175('0x74')]=function(_0x1d5bc7,_0x1523e1,_0x939d1d,_0x3e6313){var _0x3cd5c8=util[_0x2175('0x72')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1523e1,_0x939d1d,base64Encode(_0x1d5bc7),_0x3e6313?util[_0x2175('0x72')](_0x2175('0x75'),encodeURIComponent(_0x3e6313)):_0x2175('0x76'));return uploadFile(_0x3cd5c8)[_0x2175('0x2d')](function(_0x1c5a07){return querystring[_0x2175('0x77')](_0x1c5a07);});};exports[_0x2175('0x78')]=function(_0x23869d,_0x3ce776){return sestek[_0x2175('0x79')](_0x23869d,_0x3ce776)[_0x2175('0x2d')](function(_0x31df51){logger[_0x2175('0x1b')](JSON[_0x2175('0x54')](_0x31df51));var _0x494d0={'speech':_0x31df51[_0x2175('0x7a')],'action':_0x31df51[_0x2175('0x7b')]?_0x31df51[_0x2175('0x7b')][_0x2175('0x7c')]:undefined,'actiondata':_0x31df51[_0x2175('0x7b')]?_0x31df51[_0x2175('0x7b')][_0x2175('0x7d')]:undefined};if(_0x31df51[_0x2175('0x7b')]&&_0x31df51[_0x2175('0x7b')]['AudioFromTts']){return base64Decode(_0x31df51[_0x2175('0x7b')][_0x2175('0x7e')][_0x2175('0x7f')],path[_0x2175('0x28')](__dirname,_0x2175('0x29'),rs[_0x2175('0x2a')](0x4)+_0x2175('0x2b')))[_0x2175('0x2d')](function(_0x1ed2ac){_0x494d0[_0x2175('0x80')]=_0x1ed2ac;return _0x494d0;});}return _0x494d0;});};exports[_0x2175('0x81')]=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 423c1dc..a8d0b7d 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 _0x76d7=['./nda'];(function(_0x167a28,_0x3a056f){var _0x2314f9=function(_0x2b8a0a){while(--_0x2b8a0a){_0x167a28['push'](_0x167a28['shift']());}};_0x2314f9(++_0x3a056f);}(_0x76d7,0x1c3));var _0x776d=function(_0x21a44e,_0x203f07){_0x21a44e=_0x21a44e-0x0;var _0x5f1638=_0x76d7[_0x21a44e];return _0x5f1638;};var nda=require(_0x776d('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xb4ed=['./nda'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0xb4ed,0x1f4));var _0xdb4e=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xb4ed[_0x438912];return _0x18112f;};var nda=require(_0xdb4e('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ac21af1..c358654 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 _0x851a=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','/token','username','password','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x851a,0x19b));var _0xa851=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x851a[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0xa851('0x0'));var url=require('url');var logger=require(_0xa851('0x1'))(_0xa851('0x2'));module[_0xa851('0x3')]=function(_0x52489c,_0xd7442b){var _0x1af5fd={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b['ndauth_url'],_0xa851('0x6')),'form':{'grant_type':'password','username':_0xd7442b[_0xa851('0x7')],'password':_0xd7442b[_0xa851('0x8')]},'json':!![]};return rp(_0x1af5fd)[_0xa851('0x9')](function(_0x551e16){var _0x3e1e9d={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b[_0xa851('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0xd7442b[_0xa851('0xb')]||_0xa851('0xc'),'channelId':'Nda','conversation':{'id':_0x52489c[_0xa851('0xd')]},'from':{'id':_0x52489c[_0xa851('0xe')],'name':_0x52489c[_0xa851('0xf')]},'recipient':{'id':_0x52489c[_0xa851('0x10')],'name':_0x52489c[_0xa851('0x11')]},'text':_0xd7442b[_0xa851('0x12')],'channelData':{}},'headers':{'Authorization':_0xa851('0x13')+_0x551e16[_0xa851('0x14')]},'json':!![]};if(_0xd7442b[_0xa851('0x15')]){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x18')]=_0xd7442b[_0xa851('0x15')];}if(_0xd7442b[_0xa851('0x19')]=='1'){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa851('0x1b')};}if(_0xd7442b['custom_action']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1c')]=_0xd7442b[_0xa851('0x1d')];if(_0xd7442b['custom_action_data']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1e')]=_0xd7442b[_0xa851('0x1f')];}}logger[_0xa851('0x20')](JSON['stringify'](_0x3e1e9d));return rp(_0x3e1e9d);});}; \ No newline at end of file +var _0xe7b9=['ndaactivity_type','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','resolve','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x3277ff,_0x4407f4){var _0x36d6d3=function(_0x254c4b){while(--_0x254c4b){_0x3277ff['push'](_0x3277ff['shift']());}};_0x36d6d3(++_0x4407f4);}(_0xe7b9,0x170));var _0x9e7b=function(_0x4ee1fd,_0x7d71f7){_0x4ee1fd=_0x4ee1fd-0x0;var _0x156d26=_0xe7b9[_0x4ee1fd];return _0x156d26;};'use strict';var rp=require(_0x9e7b('0x0'));var url=require(_0x9e7b('0x1'));var logger=require(_0x9e7b('0x2'))('agi');module['exports']=function(_0x1de4b2,_0x95234f){var _0x567eb6={'method':'POST','uri':url[_0x9e7b('0x3')](_0x95234f['ndauth_url'],_0x9e7b('0x4')),'form':{'grant_type':'password','username':_0x95234f['username'],'password':_0x95234f[_0x9e7b('0x5')]},'json':!![]};return rp(_0x567eb6)[_0x9e7b('0x6')](function(_0x13a37d){var _0x5ed982={'method':_0x9e7b('0x7'),'uri':url[_0x9e7b('0x3')](_0x95234f[_0x9e7b('0x8')],_0x9e7b('0x9')),'body':{'type':_0x95234f[_0x9e7b('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x1de4b2['uniqueid']},'from':{'id':_0x1de4b2[_0x9e7b('0xb')],'name':_0x1de4b2[_0x9e7b('0xc')]},'recipient':{'id':_0x1de4b2[_0x9e7b('0xd')],'name':_0x1de4b2[_0x9e7b('0xe')]},'text':_0x95234f[_0x9e7b('0xf')],'channelData':{}},'headers':{'Authorization':_0x9e7b('0x10')+_0x13a37d['access_token']},'json':!![]};if(_0x95234f[_0x9e7b('0x11')]){_0x5ed982[_0x9e7b('0x12')][_0x9e7b('0x13')][_0x9e7b('0x14')]=_0x95234f['project'];}if(_0x95234f[_0x9e7b('0x15')]=='1'){_0x5ed982['body'][_0x9e7b('0x13')][_0x9e7b('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x95234f['custom_action']){_0x5ed982[_0x9e7b('0x12')][_0x9e7b('0x13')][_0x9e7b('0x17')]=_0x95234f['custom_action'];if(_0x95234f[_0x9e7b('0x18')]){_0x5ed982[_0x9e7b('0x12')][_0x9e7b('0x13')][_0x9e7b('0x19')]=_0x95234f[_0x9e7b('0x18')];}}logger[_0x9e7b('0x1a')](JSON['stringify'](_0x5ed982));return rp(_0x5ed982);});}; \ 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 b7795b7..f2a253f 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 _0x7857=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7857,0x140));var _0x7785=function(_0x5c58b8,_0x3101d3){_0x5c58b8=_0x5c58b8-0x0;var _0x19264e=_0x7857[_0x5c58b8];return _0x19264e;};'use strict';var asr=require('./lib/api');module[_0x7785('0x0')]=function(_0x3705b3,_0x57d1e8,_0x7bab53,_0x35d344){return asr(_0x3705b3,_0x57d1e8,_0x7bab53,_0x35d344);}; \ No newline at end of file +var _0x2f56=['exports','./lib/api'];(function(_0x5aad42,_0x13df01){var _0x36d4d7=function(_0x326247){while(--_0x326247){_0x5aad42['push'](_0x5aad42['shift']());}};_0x36d4d7(++_0x13df01);}(_0x2f56,0x1cf));var _0x62f5=function(_0x3a07b8,_0xb29b2a){_0x3a07b8=_0x3a07b8-0x0;var _0x47d341=_0x2f56[_0x3a07b8];return _0x47d341;};'use strict';var asr=require(_0x62f5('0x0'));module[_0x62f5('0x1')]=function(_0x41d066,_0x61aea2,_0x49ad60,_0x3e5a0b){return asr(_0x41d066,_0x61aea2,_0x49ad60,_0x3e5a0b);}; \ 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 d00b345..9f6252f 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 _0x6dc9=['unix','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','lodash','crypto','../../../../../../config/logger','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'];(function(_0x1b1a41,_0x37fdba){var _0x2ef3b7=function(_0x4ee4e0){while(--_0x4ee4e0){_0x1b1a41['push'](_0x1b1a41['shift']());}};_0x2ef3b7(++_0x37fdba);}(_0x6dc9,0x16b));var _0x96dc=function(_0x43d887,_0x56462c){_0x43d887=_0x43d887-0x0;var _0x5bbfb7=_0x6dc9[_0x43d887];return _0x5bbfb7;};'use strict';var BPromise=require(_0x96dc('0x0'));var _=require(_0x96dc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x96dc('0x2'));var logger=require(_0x96dc('0x3'))(_0x96dc('0x4'));module[_0x96dc('0x5')]=function(_0x135b38,_0x3533f2,_0x28a588,_0x1669d3){return new BPromise(function(_0x3a1808,_0x5104bf){logger['info'](_0x96dc('0x6'),_0x1669d3||_0x96dc('0x7'));var _0x1712b5=new WebSocket(_0x1669d3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x54fa6a='';var _0x36e4ad='0';var _0x15f8d1='1';var _0x4b9716=_0x96dc('0x8');function _0x293a93(_0x457532){var _0x44ea13=crypto[_0x96dc('0x9')](_0x96dc('0xa'));_0x44ea13[_0x96dc('0xb')](_0x457532);return _0x44ea13[_0x96dc('0xc')](_0x96dc('0xd'));}function _0x5c8a6d(){try{logger[_0x96dc('0xe')]('Open\x20Tilde\x20ASR\x20socket');var _0x464c0e=moment()[_0x96dc('0xf')]();var _0x1ef4c2=_0x293a93(_0x464c0e+_0x3533f2+_0x28a588);_0x1712b5[_0x96dc('0x10')](JSON[_0x96dc('0x11')]({'appID':_0x3533f2,'timestamp':_0x464c0e,'appKey':_0x1ef4c2}));var _0x3f32e1=fs[_0x96dc('0x12')](_0x135b38);_0x3f32e1['on'](_0x96dc('0x13'),function(_0x218963){_0x1712b5[_0x96dc('0x10')](_0x218963);});_0x3f32e1['on']('close',function(){_0x1712b5[_0x96dc('0x10')](_0x96dc('0x14'));});}catch(_0x431eb4){logger['error'](_0x96dc('0x15'),JSON[_0x96dc('0x11')](_0x431eb4));_0x1712b5[_0x96dc('0x16')]();}}function _0x3caaa0(_0x37a83c){try{if(_0x37a83c){var _0x41e8a7=JSON[_0x96dc('0x17')](_0x37a83c);switch(_0x41e8a7[_0x96dc('0x18')]){case 0x0:if(_0x41e8a7[_0x96dc('0x19')]){if(_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x96dc('0x11')](_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1b')]));_0x54fa6a=_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1b')][0x0]['transcript'];_0x36e4ad=_0x41e8a7['result']['hypotheses'][0x0][_0x96dc('0x1c')];_0x15f8d1='0';_0x4b9716=_0x96dc('0x1d');_0x1712b5['terminate']();}}break;case 0x1:logger[_0x96dc('0xe')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x15f8d1='1';_0x4b9716=_0x96dc('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x15f8d1='2';_0x4b9716=_0x96dc('0x1e');break;case 0x9:logger[_0x96dc('0xe')](_0x96dc('0x1f'));_0x15f8d1='9';_0x4b9716=_0x96dc('0x1f');break;case 0xa:logger['info'](_0x96dc('0x20'));_0x15f8d1='10';_0x4b9716=_0x96dc('0x20');break;case 0xb:logger['info'](_0x96dc('0x21'));_0x15f8d1='11';_0x4b9716=_0x96dc('0x21');}}}catch(_0x126a8a){logger['error'](_0x96dc('0x22'),JSON[_0x96dc('0x11')](_0x126a8a));_0x1712b5[_0x96dc('0x16')]();}}function _0xade7b9(){logger[_0x96dc('0xe')](_0x96dc('0x23'));_0x3a1808({'transcript':_0x54fa6a,'confidence':_0x36e4ad,'status':_0x15f8d1,'status_message':_0x4b9716});}function _0x16bd1a(_0xc0f180){logger[_0x96dc('0x24')](_0x96dc('0x25'));if(!_[_0x96dc('0x26')](_0xc0f180)){logger[_0x96dc('0x24')](_[_0x96dc('0x27')](_0xc0f180)?JSON[_0x96dc('0x11')](_0xc0f180):_0xc0f180);}}_0x1712b5['on'](_0x96dc('0x28'),_0x5c8a6d);_0x1712b5['on']('message',_0x3caaa0);_0x1712b5['on'](_0x96dc('0x29'),_0xade7b9);_0x1712b5['on'](_0x96dc('0x24'),_0x16bd1a);});}; \ No newline at end of file +var _0xbbdc=['close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0xbbdc,0x144));var _0xcbbd=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0xbbdc[_0x40b2ed];return _0x18397d;};'use strict';var BPromise=require(_0xcbbd('0x0'));var _=require(_0xcbbd('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcbbd('0x2'));var crypto=require(_0xcbbd('0x3'));var logger=require(_0xcbbd('0x4'))(_0xcbbd('0x5'));module['exports']=function(_0x7c968f,_0x47be41,_0x594e22,_0xdc42d8){return new BPromise(function(_0x3b123d,_0x91d360){logger[_0xcbbd('0x6')]('Tilde\x20URI',_0xdc42d8||_0xcbbd('0x7'));var _0x16c203=new WebSocket(_0xdc42d8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1ac9dd='';var _0x195485='0';var _0x1758d7='1';var _0x1eef46=_0xcbbd('0x8');function _0xb02953(_0x266a15){var _0x28ef0f=crypto[_0xcbbd('0x9')](_0xcbbd('0xa'));_0x28ef0f[_0xcbbd('0xb')](_0x266a15);return _0x28ef0f[_0xcbbd('0xc')](_0xcbbd('0xd'));}function _0x322eea(){try{logger[_0xcbbd('0x6')](_0xcbbd('0xe'));var _0x18b05f=moment()[_0xcbbd('0xf')]();var _0x5725c4=_0xb02953(_0x18b05f+_0x47be41+_0x594e22);_0x16c203[_0xcbbd('0x10')](JSON[_0xcbbd('0x11')]({'appID':_0x47be41,'timestamp':_0x18b05f,'appKey':_0x5725c4}));var _0x568a02=fs[_0xcbbd('0x12')](_0x7c968f);_0x568a02['on'](_0xcbbd('0x13'),function(_0x141650){_0x16c203['send'](_0x141650);});_0x568a02['on'](_0xcbbd('0x14'),function(){_0x16c203[_0xcbbd('0x10')](_0xcbbd('0x15'));});}catch(_0x20e73e){logger[_0xcbbd('0x16')](_0xcbbd('0x17'),JSON[_0xcbbd('0x11')](_0x20e73e));_0x16c203['terminate']();}}function _0x475342(_0x26e119){try{if(_0x26e119){var _0x206109=JSON[_0xcbbd('0x18')](_0x26e119);switch(_0x206109[_0xcbbd('0x19')]){case 0x0:if(_0x206109[_0xcbbd('0x1a')]){if(_0x206109[_0xcbbd('0x1a')][_0xcbbd('0x1b')]){logger[_0xcbbd('0x6')](_0xcbbd('0x1c'),JSON[_0xcbbd('0x11')](_0x206109[_0xcbbd('0x1a')][_0xcbbd('0x1d')]));_0x1ac9dd=_0x206109[_0xcbbd('0x1a')][_0xcbbd('0x1d')][0x0][_0xcbbd('0x1e')];_0x195485=_0x206109[_0xcbbd('0x1a')][_0xcbbd('0x1d')][0x0][_0xcbbd('0x1f')];_0x1758d7='0';_0x1eef46=_0xcbbd('0x20');_0x16c203[_0xcbbd('0x21')]();}}break;case 0x1:logger[_0xcbbd('0x6')](_0xcbbd('0x8'));_0x1758d7='1';_0x1eef46=_0xcbbd('0x8');break;case 0x2:logger[_0xcbbd('0x6')](_0xcbbd('0x22'));_0x1758d7='2';_0x1eef46='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xcbbd('0x6')](_0xcbbd('0x23'));_0x1758d7='9';_0x1eef46=_0xcbbd('0x23');break;case 0xa:logger[_0xcbbd('0x6')](_0xcbbd('0x24'));_0x1758d7='10';_0x1eef46=_0xcbbd('0x24');break;case 0xb:logger[_0xcbbd('0x6')](_0xcbbd('0x25'));_0x1758d7='11';_0x1eef46=_0xcbbd('0x25');}}}catch(_0x208684){logger[_0xcbbd('0x16')](_0xcbbd('0x26'),JSON[_0xcbbd('0x11')](_0x208684));_0x16c203[_0xcbbd('0x21')]();}}function _0xe5ca36(){logger['info'](_0xcbbd('0x27'));_0x3b123d({'transcript':_0x1ac9dd,'confidence':_0x195485,'status':_0x1758d7,'status_message':_0x1eef46});}function _0x51b692(_0x1d6f94){logger[_0xcbbd('0x16')](_0xcbbd('0x28'));if(!_['isNil'](_0x1d6f94)){logger[_0xcbbd('0x16')](_['isObject'](_0x1d6f94)?JSON['stringify'](_0x1d6f94):_0x1d6f94);}}_0x16c203['on'](_0xcbbd('0x29'),_0x322eea);_0x16c203['on'](_0xcbbd('0x2a'),_0x475342);_0x16c203['on'](_0xcbbd('0x14'),_0xe5ca36);_0x16c203['on'](_0xcbbd('0x16'),_0x51b692);});}; \ 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 65c389f..79e3d42 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 _0x1725=['./asr'];(function(_0x5e7991,_0x58639b){var _0x41cb40=function(_0x164f53){while(--_0x164f53){_0x5e7991['push'](_0x5e7991['shift']());}};_0x41cb40(++_0x58639b);}(_0x1725,0xdb));var _0x5172=function(_0x22bd32,_0x3df5b2){_0x22bd32=_0x22bd32-0x0;var _0x15715c=_0x1725[_0x22bd32];return _0x15715c;};var asr=require(_0x5172('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xb869=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb869,0x11f));var _0x9b86=function(_0x4a5456,_0x39e5fb){_0x4a5456=_0x4a5456-0x0;var _0x20b214=_0xb869[_0x4a5456];return _0x20b214;};var asr=require(_0x9b86('0x0'));module[_0x9b86('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 37950bb..859c63d 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xe706,0xa3));var _0x6e70=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0xe706[_0x59db19];return _0x5f0f09;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0xe706,0xa3));var _0x6e70=function(_0xfafe54,_0x23c9a6){_0xfafe54=_0xfafe54-0x0;var _0x4ab8e6=_0xe706[_0xfafe54];return _0x4ab8e6;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c5d0252..099c1d7 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 _0x99c9=['google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','replaceAllVariables','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','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','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','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','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','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','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','parse','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','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_text_type','awsLex','aws_bot_name','googleASR'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x99c9,0x13c));var _0x999c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x99c9[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var util=require(_0x999c('0x0'));var _=require(_0x999c('0x1'));var sh=require(_0x999c('0x2'));var odbc=require(_0x999c('0x3'))();var rs=require(_0x999c('0x4'));var moment=require(_0x999c('0x5'));var Mustache=require(_0x999c('0x6'));var rp=require('request-promise');var logger=require(_0x999c('0x7'))(_0x999c('0x8'));var config=require(_0x999c('0x9'));var scripts=require(_0x999c('0xa'));var FILES_PATH=_0x999c('0xb');var recursiveMapAttributes=[_0x999c('0xc'),_0x999c('0xd')];var verticesWithRetry=[_0x999c('0xe'),_0x999c('0xf'),_0x999c('0x10')];var AGIVertices=function(_0x329252,_0x3c58ba,_0x32984f){this[_0x999c('0x11')]=_0x329252;this['rpc']=_0x3c58ba;this[_0x999c('0x12')]=_0x32984f;};AGIVertices[_0x999c('0x13')]['getVariable']=function(_0x5b5436,_0x140c4b){this[_0x999c('0x14')][_0x999c('0x15')](_0x5b5436)[_0x999c('0x16')](function(_0xc334b2){_0x140c4b(null,_0xc334b2?_0xc334b2[_0x999c('0x17')]:![]);})[_0x999c('0x18')](function(_0x2e5f7e){_0x140c4b(_0x2e5f7e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x19')]=function(_0x85f4a0,_0x4c3209){this[_0x999c('0x14')][_0x999c('0x1a')](_0x85f4a0)['then'](function(_0x54a2fa){_0x4c3209(null,_0x54a2fa?_0x54a2fa['name']:![]);})[_0x999c('0x18')](function(_0xb3e981){_0x4c3209(_0xb3e981);});};AGIVertices[_0x999c('0x13')][_0x999c('0x1b')]=function(_0x2a6667,_0x5d5d12){this[_0x999c('0x14')][_0x999c('0x1c')](_0x2a6667)[_0x999c('0x16')](function(_0xc05363){_0x5d5d12(null,_0xc05363?_0xc05363[_0x999c('0x17')]:![]);})['catch'](function(_0x1b327f){_0x5d5d12(_0x1b327f);});};AGIVertices[_0x999c('0x13')][_0x999c('0x1d')]=function(_0xd63ef8,_0x32c66c){this['rpc'][_0x999c('0x1e')](_0xd63ef8)[_0x999c('0x16')](function(_0x26abbb){_0x32c66c(null,_0x26abbb?_0x26abbb[_0x999c('0x1f')]:![]);})[_0x999c('0x18')](function(_0x1219d6){_0x32c66c(_0x1219d6);});};AGIVertices['prototype'][_0x999c('0x20')]=function(_0x200392,_0x24f637){this[_0x999c('0x14')][_0x999c('0x21')](_0x200392)[_0x999c('0x16')](function(_0x12d8f3){_0x24f637(null,_0x12d8f3?_0x12d8f3[_0x999c('0x17')]:![]);})[_0x999c('0x18')](function(_0x281720){_0x24f637(_0x281720);});};AGIVertices[_0x999c('0x13')]['getTrunk']=function(_0x448682,_0x1862ee){this[_0x999c('0x14')][_0x999c('0x22')](_0x448682)[_0x999c('0x16')](function(_0x15d102){_0x1862ee(null,_0x15d102?_0x15d102['name']:![]);})[_0x999c('0x18')](function(_0x43293f){_0x1862ee(_0x43293f);});};AGIVertices[_0x999c('0x13')]['getSound']=function(_0x1abac6,_0x4413c5){var _0x53953d=this;this[_0x999c('0x14')]['getSoundById'](_0x1abac6)['then'](function(_0xedf57d){_0x4413c5(null,_0xedf57d?_0x53953d[_0x999c('0x23')](_0xedf57d[_0x999c('0x24')]):![]);})[_0x999c('0x18')](function(_0x3737e9){_0x4413c5(_0x3737e9);});};AGIVertices[_0x999c('0x13')][_0x999c('0x25')]=function(_0x76dc32,_0x352c25){this[_0x999c('0x14')]['getMailAccountById'](_0x76dc32)[_0x999c('0x16')](function(_0x192976){_0x352c25(null,_0x192976?_0x192976:![]);})[_0x999c('0x18')](function(_0x361501){_0x352c25(_0x361501);});};AGIVertices[_0x999c('0x13')][_0x999c('0x26')]=function(_0x4427b4,_0x362735,_0x538221){this['mailRpc'][_0x999c('0x26')](_0x4427b4,_0x362735)[_0x999c('0x16')](function(){_0x538221(null);})[_0x999c('0x18')](function(_0x3872b7){_0x538221(_0x3872b7);});};AGIVertices['prototype'][_0x999c('0x27')]=function(_0xe28e45,_0x46815d){this[_0x999c('0x14')]['getIntervalById'](_0xe28e45)['then'](function(_0x21d6df){if(_0x21d6df){if(_0x21d6df[_0x999c('0x28')]){_0x46815d(null,[_0x21d6df[_0x999c('0x29')]]);}else{_0x46815d(null,_[_0x999c('0x2a')](_0x21d6df[_0x999c('0x2b')],_0x999c('0x29')));}}else{_0x46815d(null,![]);}})[_0x999c('0x18')](function(_0x4d5060){_0x46815d(_0x4d5060);});};AGIVertices['prototype']['getSoundPath']=function(_0x604646){return util[_0x999c('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x604646);};AGIVertices['prototype']['getQueryOdbc']=function(_0x3d5534,_0x10fcf3,_0x15dc10){odbc[_0x999c('0x2d')](_0x3d5534,function(_0x5b5b2a){if(_0x5b5b2a){logger[_0x999c('0x2e')](_0x999c('0x2f'),_0x5b5b2a);_0x15dc10(_0x5b5b2a);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x999c('0x30')](_0x10fcf3,function(_0x5ac869,_0x2878f5){if(_0x5ac869){logger['info'](_0x999c('0x31'),_0x10fcf3);_0x15dc10(_0x5ac869);}else{logger[_0x999c('0x32')](_0x999c('0x33'),_0x10fcf3);odbc[_0x999c('0x34')](function(_0x59029b){if(_0x59029b){logger['error'](_0x999c('0x35'),_0x59029b);}_0x15dc10(null,_0x2878f5);});}});}});};AGIVertices[_0x999c('0x13')][_0x999c('0x36')]=function(_0xf26ba3,_0x5e21b6){this[_0x999c('0x14')][_0x999c('0x37')](_0xf26ba3)[_0x999c('0x16')](function(_0x5fa1de){_0x5e21b6(null,_0x5fa1de?_0x5fa1de:![]);})['catch'](function(_0x192e50){_0x5e21b6(_0x192e50);});};AGIVertices['prototype'][_0x999c('0x38')]=function(_0x1513b2,_0x4829ab){this[_0x999c('0x14')][_0x999c('0x38')](_0x1513b2)[_0x999c('0x16')](function(_0x224251){_0x4829ab(null,_0x224251);})[_0x999c('0x18')](function(_0x2de6c7){_0x4829ab(_0x2de6c7);});};AGIVertices[_0x999c('0x13')][_0x999c('0x39')]=function(_0x4ef478,_0x563e11,_0x499095){this['rpc'][_0x999c('0x39')]({'uniqueid':this[_0x999c('0x11')][_0x999c('0x3a')],'node':_0x4ef478[_0x999c('0x3b')],'application':_0x4ef478[_0x999c('0x3c')],'data':_0x563e11||null,'project_name':this['channel'][_0x999c('0x3d')],'callerid':this[_0x999c('0x11')][_0x999c('0x3e')]})[_0x999c('0x16')](function(_0x9d708e){if(_0x499095){_0x499095(null,_0x9d708e);}})['catch'](function(_0x40fca1){if(_0x499095){_0x499095(_0x40fca1);}});};AGIVertices[_0x999c('0x13')][_0x999c('0x3f')]=function(_0x30e226,_0x28b9de,_0x3edb17,_0x3bfffb){this[_0x999c('0x14')][_0x999c('0x3f')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x999c('0x11')][_0x999c('0x3e')],'calleridname':this[_0x999c('0x11')][_0x999c('0x40')],'context':this[_0x999c('0x11')][_0x999c('0x41')],'extension':this[_0x999c('0x11')][_0x999c('0x42')],'priority':this[_0x999c('0x11')][_0x999c('0x43')],'accountcode':this[_0x999c('0x11')]['accountcode'],'dnid':this[_0x999c('0x11')][_0x999c('0x44')],'projectName':this[_0x999c('0x11')][_0x999c('0x3d')],'saveName':_0x28b9de,'filename':_0x30e226[_0x999c('0x45')]||_0x28b9de,'savePath':_0x3edb17})[_0x999c('0x16')](function(_0x11f3bf){_0x3bfffb(null,_0x11f3bf);})[_0x999c('0x18')](function(_0x55eb16){_0x3bfffb(_0x55eb16);});};AGIVertices[_0x999c('0x13')][_0x999c('0x46')]=function(_0x39a0bb,_0x20500c,_0x331d5d,_0x2db35a,_0x12eb3d){this['rpc']['createSquareMessage']({'uniqueid':this[_0x999c('0x11')][_0x999c('0x3a')],'body':_0x39a0bb,'direction':_0x20500c,'providerName':_0x331d5d,'providerResponse':_0x2db35a})[_0x999c('0x16')](function(_0x30aeec){if(_0x12eb3d){_0x12eb3d(null,_0x30aeec);}})[_0x999c('0x18')](function(_0x57327c){if(_0x12eb3d){_0x12eb3d(_0x57327c);}});};AGIVertices[_0x999c('0x13')][_0x999c('0x47')]=function(_0x38b75a,_0x11cc72){this['rpc'][_0x999c('0x47')]({'firstName':_['isEmpty'](_0x38b75a[_0x999c('0x17')])||_[_0x999c('0x48')](_0x38b75a[_0x999c('0x17')])?_0x999c('0x49')+Math[_0x999c('0x4a')]():_0x38b75a[_0x999c('0x17')],'lastName':_[_0x999c('0x4b')](_0x38b75a['lastName'])||_[_0x999c('0x48')](_0x38b75a[_0x999c('0x4c')])?null:_0x38b75a[_0x999c('0x4c')],'phone':_0x38b75a['phone'],'ListId':_0x38b75a[_0x999c('0x4d')],'scheduledat':_0x38b75a[_0x999c('0x4e')],'callbackUniqueid':this[_0x999c('0x11')]['uniqueid'],'tags':_0x999c('0x4f'),'description':'Callback\x20scheduled\x20at\x20'+_0x38b75a[_0x999c('0x4e')][_0x999c('0x50')](),'priority':_0x38b75a[_0x999c('0x51')]})[_0x999c('0x16')](function(_0x565fdb){_0x11cc72(null,_0x565fdb);})[_0x999c('0x18')](function(_0x5420bd){_0x11cc72(_0x5420bd);});};AGIVertices['prototype'][_0x999c('0x52')]=function(_0x117502,_0x5410ec){this[_0x999c('0x14')]['getPauseById'](_0x117502)[_0x999c('0x16')](function(_0xe89a71){_0x5410ec(null,_0xe89a71?_0xe89a71['name']:![]);})[_0x999c('0x18')](function(_0x1fd7c6){_0x5410ec(_0x1fd7c6);});};AGIVertices[_0x999c('0x13')][_0x999c('0x53')]=function(_0x237524,_0x2da455,_0xfb30cc){var _0x3fce90={'role':_0x999c('0x54')};_0x3fce90[_0x237524]=this['channel'][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x53')](_0x3fce90,_0x2da455,this[_0x999c('0x11')][_0x999c('0x3a')])[_0x999c('0x16')](function(_0x536494){_0xfb30cc(null,_['isNil'](_0x536494)?![]:!![]);})['catch'](function(_0x4a6b73){logger[_0x999c('0x2e')](_0x4a6b73);_0xfb30cc(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x55')]=function(_0x4d4236,_0x3569e8){var _0x5a2033={'role':_0x999c('0x54')};_0x5a2033[_0x4d4236]=this['channel'][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x55')](_0x5a2033)[_0x999c('0x16')](function(_0x1988ef){_0x3569e8(null,_['isNil'](_0x1988ef)?![]:!![]);})[_0x999c('0x18')](function(_0x2e2976){logger[_0x999c('0x2e')](_0x2e2976);_0x3569e8(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x56')]=function(_0x24fdcf,_0x1907f4){var _0x4d4c33={'role':_0x999c('0x54')};_0x4d4c33[_0x24fdcf]=this[_0x999c('0x11')][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x56')](_0x4d4c33)[_0x999c('0x16')](function(_0x3a9a0d){_0x1907f4(null,_['isNil'](_0x3a9a0d)?![]:!![]);})[_0x999c('0x18')](function(_0xd2d105){logger['error'](_0xd2d105);_0x1907f4(null,![]);});};AGIVertices['prototype'][_0x999c('0x57')]=function(_0x141a60,_0x3c233c){var _0x5e57d0={'role':_0x999c('0x54')};_0x5e57d0[_0x141a60]=this[_0x999c('0x11')][_0x999c('0x3e')];var _0x251b3f=_0x141a60!=_0x999c('0x58')?util[_0x999c('0x2c')]('%s/%s@from-sip/n',_0x999c('0x59'),this['channel'][_0x999c('0x3e')]):undefined;this[_0x999c('0x14')][_0x999c('0x57')](_0x5e57d0,_0x251b3f)[_0x999c('0x16')](function(_0x1e034e){_0x3c233c(null,_[_0x999c('0x48')](_0x1e034e)?![]:!![]);})[_0x999c('0x18')](function(_0x39aa48){logger[_0x999c('0x2e')](_0x39aa48);_0x3c233c(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x5a')]=function(_0x3905f1,_0xb1178c){sh['exec'](_[_0x999c('0x5b')](_0x3905f1),function(_0x1c9a78,_0x55ce3a){var _0x1066c8=_0x55ce3a[_0x999c('0x5c')](/(\r\n|\n|\r)/gm,'');_0xb1178c(null,_0x1066c8);});};AGIVertices[_0x999c('0x13')]['googleCloudTTS']=function(_0x2e0a60,_0xd83bc6){scripts[_0x999c('0x5d')](_0x2e0a60[_0x999c('0x5e')],_0x2e0a60[_0x999c('0x5f')]||'text',_0x2e0a60[_0x999c('0x60')],_0x2e0a60[_0x999c('0x61')]||_0x999c('0x62'),_0x2e0a60[_0x999c('0x63')]||_0x999c('0x64'),_0x2e0a60[_0x999c('0x65')]||_0x999c('0x66'))[_0x999c('0x16')](function(_0x4f99ad){_0xd83bc6(null,_0x4f99ad);})[_0x999c('0x18')](function(_0x3b6ce6){_0xd83bc6(_0x3b6ce6);});};AGIVertices['prototype']['googleTTS']=function(_0x2ac0be,_0x1c8e89){scripts[_0x999c('0x67')](_0x2ac0be[_0x999c('0x60')],_0x2ac0be['google_tts_language']||'en',0x1)[_0x999c('0x16')](function(_0x38c05f){_0x1c8e89(null,_0x38c05f);})[_0x999c('0x18')](function(_0x480e91){_0x1c8e89(_0x480e91);});};AGIVertices[_0x999c('0x13')]['restAPI']=function(_0x2c1b7d,_0x90eb9a){var _0x5d3c9f={'uri':_0x2c1b7d[_0x999c('0x68')],'method':_0x2c1b7d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c1b7d[_0x999c('0x69')])===_0x999c('0x6a')&&parseInt(_0x2c1b7d[_0x999c('0x69')])>=0x1?parseInt(_0x2c1b7d[_0x999c('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x999c('0x6b')]([_0x999c('0x6c'),_0x999c('0x6d')],_0x5d3c9f[_0x999c('0x6e')][_0x999c('0x6f')]())){try{_0x5d3c9f[_0x999c('0x70')]=_0x2c1b7d[_0x999c('0xd')]?JSON['parse'](_0x2c1b7d[_0x999c('0xd')]):{};}catch(_0x22b391){logger[_0x999c('0x2e')](_0x999c('0x71'),_0x22b391);}}try{_0x5d3c9f[_0x999c('0x72')]=_0x2c1b7d[_0x999c('0xc')]?JSON['parse'](_0x2c1b7d['rawHeaders']):{};}catch(_0x21dbbc){logger[_0x999c('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x21dbbc);}if(_0x2c1b7d[_0x999c('0x73')]){try{var _0x2714f9=require(_0x2c1b7d[_0x999c('0x73')])['sync'](this,_0x5d3c9f);_0x5d3c9f[_0x999c('0x74')]=Mustache['render'](_0x2c1b7d[_0x999c('0x68')],_0x2714f9,{},['$$','$$']);if(_0x5d3c9f[_0x999c('0x72')]){_0x5d3c9f[_0x999c('0x72')]=JSON[_0x999c('0x75')](Mustache[_0x999c('0x76')](JSON[_0x999c('0x77')](_0x5d3c9f[_0x999c('0x72')]),_0x2714f9,{},['$$','$$']));}if(_0x5d3c9f[_0x999c('0x70')]){_0x5d3c9f['body']=JSON['parse'](Mustache['render'](JSON[_0x999c('0x77')](_0x5d3c9f[_0x999c('0x70')]),_0x2714f9,{},['$$','$$']));}}catch(_0x179493){logger[_0x999c('0x2e')](_0x999c('0x78'),_0x179493);}}rp(_0x5d3c9f)[_0x999c('0x16')](function(_0x462bea){var _0x482164={'statusCode':_0x462bea[_0x999c('0x79')]||0xc8,'statusMessage':_0x462bea[_0x999c('0x7a')]||'OK','headers':_0x462bea[_0x999c('0x72')]||{},'body':_0x462bea[_0x999c('0x70')]||{}};_0x90eb9a(null,_0x482164);})[_0x999c('0x18')](function(_0x5493fb){var _0x2bfb6e={'statusCode':_0x5493fb['statusCode']||0x1f4,'statusMessage':_0x5493fb[_0x999c('0x7b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5493fb['options']['headers']||{},'body':_0x5493fb[_0x999c('0x7c')]['body']||{}};_0x90eb9a(null,_0x2bfb6e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x7d')]=function(_0xebac9f,_0x57c1c6){scripts[_0x999c('0x7d')](this[_0x999c('0x11')][_0x999c('0x3a')],_0xebac9f[_0x999c('0x7e')],_0xebac9f[_0x999c('0x60')],_0xebac9f[_0x999c('0x7f')]||'en')[_0x999c('0x16')](function(_0x20676c){_0x57c1c6(null,_0x20676c);})[_0x999c('0x18')](function(_0xf38234){_0x57c1c6(_0xf38234);});};AGIVertices['prototype'][_0x999c('0x80')]=function(_0x353d2b,_0x59d43e){scripts[_0x999c('0x80')](this['channel'][_0x999c('0x3a')],_0x353d2b['dialogflowV2_project_id'],_0x353d2b[_0x999c('0x81')],_0x353d2b['private_key'],_0x353d2b[_0x999c('0x60')],_0x353d2b[_0x999c('0x82')]||'en')[_0x999c('0x16')](function(_0x599283){_0x59d43e(null,_0x599283);})[_0x999c('0x18')](function(_0x119a3a){_0x59d43e(_0x119a3a);});};AGIVertices[_0x999c('0x13')][_0x999c('0x83')]=function(_0x5c958a,_0x3ceb51){scripts[_0x999c('0x83')](this['channel'],_0x5c958a)['then'](function(_0x5e4ea8){_0x3ceb51(null,_0x5e4ea8);})['catch'](function(_0x498567){_0x3ceb51(_0x498567);});};AGIVertices[_0x999c('0x13')][_0x999c('0x84')]=function(_0x38765b,_0x192fa4){scripts[_0x999c('0x84')](_0x38765b[_0x999c('0x7e')],_0x38765b['text'],_0x38765b[_0x999c('0x85')]||'en-US',_0x38765b[_0x999c('0x86')])[_0x999c('0x16')](function(_0x41b2a7){_0x192fa4(null,_0x41b2a7);})[_0x999c('0x18')](function(_0x59ac21){_0x192fa4(_0x59ac21);});};AGIVertices[_0x999c('0x13')]['ispeechASR']=function(_0x5e2064,_0x36ff56,_0xdadb6f){scripts[_0x999c('0x87')](_0x36ff56,_0x5e2064[_0x999c('0x7e')],_0x5e2064[_0x999c('0x88')]||_0x999c('0x62'),this[_0x999c('0x89')](_0x5e2064[_0x999c('0x8a')])?_0x5e2064[_0x999c('0x8a')]:undefined)['then'](function(_0x5490f4){_0xdadb6f(null,_0x5490f4);})[_0x999c('0x18')](function(_0x53809e){_0xdadb6f(_0x53809e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x8b')]=function(_0x1d27d6,_0x566fab){scripts[_0x999c('0x8b')](_0x1d27d6[_0x999c('0x8c')],_0x1d27d6[_0x999c('0x8d')],_0x1d27d6[_0x999c('0x8e')],_0x1d27d6['aws_polly_voice']||'Amy',_0x1d27d6['text'],_0x1d27d6[_0x999c('0x8f')]||_0x999c('0x60'))[_0x999c('0x16')](function(_0x22afef){_0x566fab(null,_0x22afef);})[_0x999c('0x18')](function(_0x123a8f){_0x566fab(_0x123a8f);});};AGIVertices[_0x999c('0x13')][_0x999c('0x90')]=function(_0x30f80f,_0x532ce4){scripts[_0x999c('0x90')](this[_0x999c('0x11')]['uniqueid'],_0x30f80f[_0x999c('0x8c')],_0x30f80f[_0x999c('0x8d')],_0x30f80f['aws_lex_region'],_0x30f80f[_0x999c('0x60')],_0x30f80f[_0x999c('0x91')])['then'](function(_0xe1b93e){_0x532ce4(null,_0xe1b93e);})[_0x999c('0x18')](function(_0x1e1ee4){_0x532ce4(_0x1e1ee4);});};AGIVertices[_0x999c('0x13')][_0x999c('0x92')]=function(_0x3a23b6,_0x31d350,_0x5852f3){scripts['googleASR'](_0x31d350,_0x3a23b6[_0x999c('0x7e')],_0x3a23b6[_0x999c('0x93')]||_0x999c('0x62'))[_0x999c('0x16')](function(_0x1a72f1){_0x5852f3(null,_0x1a72f1);})['catch'](function(_0x5bce18){_0x5852f3(_0x5bce18);});};AGIVertices[_0x999c('0x13')][_0x999c('0x94')]=function(_0x505039,_0x352c27,_0x5127ae){scripts[_0x999c('0x94')](_0x352c27,_0x505039[_0x999c('0x95')],_0x505039[_0x999c('0x96')],_0x505039[_0x999c('0x74')])['then'](function(_0x4bcdc7){_0x5127ae(null,_0x4bcdc7);})[_0x999c('0x18')](function(_0x487912){_0x5127ae(_0x487912);});};AGIVertices[_0x999c('0x13')]['clear']=function(_0x42121d){var _0x591266=_['includes'](verticesWithRetry,_0x42121d['agicommand'])?_0x42121d:_[_0x999c('0x97')](_0x42121d);for(var _0x3031ee in _0x591266){if(_0x591266[_0x999c('0x98')](_0x3031ee)){if(_0x591266[_0x3031ee]&&_[_0x999c('0x99')](_0x591266[_0x3031ee])){if(_[_0x999c('0x6b')](recursiveMapAttributes,_0x3031ee)){_0x591266[_0x3031ee]=this[_0x999c('0x9a')](_0x591266[_0x3031ee]);}else{_0x591266[_0x3031ee]=this['replaceAllVariables'](_0x591266[_0x3031ee]);}}}}return _0x591266;};AGIVertices[_0x999c('0x13')]['recursiveNodeIndex']=function(_0x2605f2){for(var _0x3051e8 in _0x2605f2){if(_0x2605f2['hasOwnProperty'](_0x3051e8)){if(_[_0x999c('0x9b')](_0x2605f2[_0x3051e8])){this[_0x999c('0x9c')](_0x2605f2[_0x3051e8]);}else if(_[_0x999c('0x9d')](_0x2605f2[_0x3051e8])){for(var _0x1f68dd=0x0;_0x1f68dd<_0x2605f2[_0x3051e8]['length'];_0x1f68dd++){this['recursiveNodeIndex'](_0x2605f2[_0x3051e8][_0x1f68dd]);}}else if(_[_0x999c('0x99')](_0x2605f2[_0x3051e8])){_0x2605f2[_0x3051e8]=this[_0x999c('0x9e')](_0x2605f2[_0x3051e8]);}}}};AGIVertices[_0x999c('0x13')][_0x999c('0x9f')]=function(_0x172181,_0x9f5a0a){for(var _0x4821ff in _0x172181){if(_0x172181[_0x999c('0x98')](_0x4821ff)){if(_['isPlainObject'](_0x172181[_0x4821ff])){if(!_[_0x999c('0x4b')](_0x172181[_0x4821ff])){this[_0x999c('0x9f')](_0x172181[_0x4821ff],util[_0x999c('0x2c')](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff));}}else if(_[_0x999c('0x9d')](_0x172181[_0x4821ff])){for(var _0xaefb8a=0x0;_0xaefb8a<_0x172181[_0x4821ff][_0x999c('0xa1')];_0xaefb8a++){this[_0x999c('0x9f')](_0x172181[_0x4821ff][_0xaefb8a],util['format'](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff+'['+_0xaefb8a+']'));}}else{if(!_[_0x999c('0x48')](_0x172181[_0x4821ff])){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff),_0x172181[_0x4821ff]);}}}}};AGIVertices[_0x999c('0x13')][_0x999c('0x9a')]=function(_0x49fbef){try{var _0xa77743=JSON[_0x999c('0x75')](_0x49fbef);this['recursiveNodeIndex'](_0xa77743);return JSON[_0x999c('0x77')](_0xa77743);}catch(_0x32520d){return this[_0x999c('0x9e')](_0x49fbef);}};AGIVertices['prototype'][_0x999c('0x9e')]=function(_0x3286f9){var _0x5c30e7=_0x3286f9[_0x999c('0xa3')]('{');for(var _0x47a5d3=0x1;_0x47a5d3<_0x5c30e7['length'];_0x47a5d3+=0x1){var _0x5e5adc=_0x5c30e7[_0x47a5d3][_0x999c('0xa3')]('}');if(_0x5e5adc[_0x999c('0xa1')]>0x1){_0x3286f9=_0x3286f9[_0x999c('0xa4')]('{'+_0x5e5adc[0x0]+'}',this[_0x999c('0x11')]['getVariable'](_0x5e5adc[0x0])[_0x999c('0xa5')]||_0x5e5adc[0x0]);}}if(_0x5c30e7['length']===0x1){return _0x3286f9[_0x999c('0x50')]();}return this[_0x999c('0x9e')](_0x3286f9);};AGIVertices[_0x999c('0x13')][_0x999c('0xa6')]=function(_0x73f91,_0x3e12fc){var _0x2cc2c6=this['channel'][_0x999c('0xa7')](_0x73f91);if(_0x2cc2c6[_0x999c('0xa8')]===-0x1){return _0x2cc2c6;}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xa9'),_0x3e12fc,_0x2cc2c6[_0x999c('0xa5')]));return this[_0x999c('0x11')][_0x999c('0xa2')](_0x3e12fc,_0x2cc2c6[_0x999c('0xa5')]);};AGIVertices['prototype']['isConfigured']=function(_0x1b8cd2){return _0x1b8cd2&&_0x1b8cd2!=='0'&&_0x1b8cd2!=='-1'&&_0x1b8cd2!=='';};AGIVertices['prototype']['maxRetry']=function(_0x183e6c){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x183e6c,'-');_0x183e6c[_0x999c('0xab')]=_0x183e6c[_0x999c('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x999c('0x13')][_0x999c('0xad')]=function(_0x1a0316){logger[_0x999c('0x32')](util['format'](_0x999c('0xae'),_0x1a0316['label']));if(!this[_0x999c('0x89')](_0x1a0316[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x10306c='\x22'+_0x1a0316[_0x999c('0x60')]+'\x22';if(this[_0x999c('0x89')](_0x1a0316[_0x999c('0x7c')])){_0x10306c+=','+_0x1a0316[_0x999c('0x7c')];}var _0x12cce3=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xb2'),_0x10306c);if(_0x12cce3[_0x999c('0xa8')]===-0x1){return _0x12cce3;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x10306c));};AGIVertices[_0x999c('0x13')][_0x999c('0xb3')]=function(_0x5035f5){logger[_0x999c('0x32')](util['format'](_0x999c('0xb4'),_0x5035f5[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x5035f5[_0x999c('0xb5')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20grammar\x20configured');}var _0x5ab1db=_0x5035f5[_0x999c('0xb5')];if(this[_0x999c('0x89')](_0x5035f5['options'])){_0x5ab1db+=','+_0x5035f5['options'];}var _0x14dfe2=this[_0x999c('0x11')]['exec'](_0x999c('0xb6'),_0x5ab1db);if(_0x14dfe2[_0x999c('0xa8')]===-0x1){return _0x14dfe2;}var _0x328b02=this[_0x999c('0xa6')](_0x999c('0xb7'),_0x999c('0xb8'));if(_0x328b02[_0x999c('0xa8')]===-0x1){return _0x328b02;}var _0x3d2c9c=this[_0x999c('0xa6')](_0x999c('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x3d2c9c['result']===-0x1){return _0x3d2c9c;}var _0x101cab=this[_0x999c('0xa6')](_0x999c('0xba'),_0x999c('0xbb'));if(_0x101cab[_0x999c('0xa8')]===-0x1){return _0x101cab;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x5ab1db));};AGIVertices[_0x999c('0x13')][_0x999c('0x8')]=function(_0x6a8c16){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xbd'),_0x6a8c16[_0x999c('0x3b')]));return this[_0x999c('0x11')]['agi']([_0x6a8c16[_0x999c('0xbe')],_0x6a8c16['args']]);};AGIVertices[_0x999c('0x13')][_0x999c('0xbf')]=function(_0x5457a8){logger[_0x999c('0x32')](util['format'](_0x999c('0xc0'),_0x5457a8[_0x999c('0x3b')]));if(this[_0x999c('0x89')](_0x5457a8['timeout'])){logger['info'](util[_0x999c('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x5457a8['timeout']));var _0x3fdba4=this['channel'][_0x999c('0xc1')](_0x5457a8['timeout']);if(_0x3fdba4[_0x999c('0xa8')]===-0x1){return _0x3fdba4;}}return this['channel']['answer']();};AGIVertices[_0x999c('0x13')][_0x999c('0x4f')]=function(_0x19c379){logger[_0x999c('0x32')](util['format'](_0x999c('0xc2'),_0x19c379['label']));if(!this[_0x999c('0x89')](_0x19c379['list_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x19c379,'no\x20list\x20selected');}_0x19c379[_0x999c('0x4e')]=moment();if(this[_0x999c('0x89')](_0x19c379['delay'])){_0x19c379['scheduledAt']=moment()['add'](_0x19c379[_0x999c('0xc3')],_0x999c('0xc4'));}if(!this[_0x999c('0x89')](_0x19c379['callback_priority'])){_0x19c379[_0x999c('0x51')]=0x2;}this[_0x999c('0x47')][_0x999c('0xaa')](this,_0x19c379);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc5'),_0x19c379['phone'],_0x19c379[_0x999c('0x4d')],_0x19c379['scheduledAt']));};AGIVertices['prototype'][_0x999c('0xc6')]=function(_0xcd7120){logger[_0x999c('0x32')](util['format'](_0x999c('0xc7'),_0xcd7120[_0x999c('0x3b')]));var _0x4714c6=this[_0x999c('0x11')][_0x999c('0xb1')](_0xcd7120[_0x999c('0xc8')],_0xcd7120[_0x999c('0x7c')]);if(_0x4714c6[_0x999c('0xa8')]===-0x1){return _0x4714c6;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc9'),_0xcd7120[_0x999c('0xc8')],_0xcd7120[_0x999c('0x7c')]));};AGIVertices['prototype'][_0x999c('0xca')]=function(_0x4855b3){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xcb'),_0x4855b3[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x4855b3[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x397459='\x22'+_0x4855b3['text']+'\x22';if(this[_0x999c('0x89')](_0x4855b3['options'])){_0x397459+=','+_0x4855b3[_0x999c('0x7c')];}var _0xdbfafa=this['channel'][_0x999c('0xb1')](_0x999c('0xb2'),_0x397459);if(_0xdbfafa[_0x999c('0xa8')]===-0x1){return _0xdbfafa;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x397459));};AGIVertices['prototype'][_0x999c('0xcc')]=function(_0x2bdb8b){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xcd'),_0x2bdb8b[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x2bdb8b['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x16c7ea='\x22'+_0x2bdb8b['text']+'\x22';if(this[_0x999c('0x89')](_0x2bdb8b[_0x999c('0x7c')])){_0x16c7ea+=','+_0x2bdb8b[_0x999c('0x7c')];}var _0x388bc9=this[_0x999c('0x11')]['exec'](_0x999c('0xb2'),_0x16c7ea);if(_0x388bc9['result']===-0x1){return _0x388bc9;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xce'),_0x16c7ea));};AGIVertices[_0x999c('0x13')][_0x999c('0xcf')]=function(_0x209bdf){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x209bdf['label']));if(!this[_0x999c('0x89')](_0x209bdf[_0x999c('0xb5')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x2541ab=_0x209bdf[_0x999c('0xb5')];if(this['isConfigured'](_0x209bdf[_0x999c('0x7c')])){_0x2541ab+=','+_0x209bdf[_0x999c('0x7c')];}var _0x3492e1=this[_0x999c('0x11')]['exec'](_0x999c('0xb6'),_0x2541ab);if(_0x3492e1['result']===-0x1){return _0x3492e1;}var _0x4d738b=this[_0x999c('0xa6')](_0x999c('0xb7'),_0x999c('0xd0'));if(_0x4d738b[_0x999c('0xa8')]===-0x1){return _0x4d738b;}var _0x18de3a=this[_0x999c('0xa6')](_0x999c('0xb9'),_0x999c('0xd1'));if(_0x18de3a['result']===-0x1){return _0x18de3a;}var _0x3b0c37=this[_0x999c('0xa6')]('RECOG_INSTANCE()',_0x999c('0xd2'));if(_0x3b0c37[_0x999c('0xa8')]===-0x1){return _0x3b0c37;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x2541ab));};AGIVertices[_0x999c('0x13')][_0x999c('0xd3')]=function(_0x55797f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xd4'),_0x55797f[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x55797f['grammar'])){return this['channel'][_0x999c('0xaf')]('no\x20grammar\x20configured');}var _0x11be94=_0x55797f[_0x999c('0xb5')];if(this['isConfigured'](_0x55797f[_0x999c('0x7c')])){_0x11be94+=','+_0x55797f[_0x999c('0x7c')];}var _0x2054ea=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xb6'),_0x11be94);if(_0x2054ea[_0x999c('0xa8')]===-0x1){return _0x2054ea;}var _0x47e529=this[_0x999c('0xa6')]('RECOG_CONFIDENCE()',_0x999c('0xd5'));if(_0x47e529['result']===-0x1){return _0x47e529;}var _0x158ad6=this[_0x999c('0xa6')](_0x999c('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0x158ad6['result']===-0x1){return _0x158ad6;}var _0x343835=this[_0x999c('0xa6')](_0x999c('0xba'),_0x999c('0xd6'));if(_0x343835[_0x999c('0xa8')]===-0x1){return _0x343835;}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x11be94));};AGIVertices['prototype'][_0x999c('0xd7')]=function(_0x478000){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x478000[_0x999c('0x3b')]));if(!this['isConfigured'](_0x478000['odbc_id'])){return this['channel'][_0x999c('0x2e')](_0x478000,_0x999c('0xd8'));}var _0x5d56da=this['getSquareOdbc']['sync'](this,_0x478000['odbc_id']);if(!_0x5d56da){return this['channel'][_0x999c('0x2e')](_0x478000,_0x999c('0xd9'));}if(!this['isConfigured'](_0x478000[_0x999c('0x30')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x478000,_0x999c('0xda'));}var _0x2ba1e3=_0x478000[_0x999c('0x30')][_0x999c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x999c('0xaf')](util['format']('query:\x20%s',_0x2ba1e3));var _0x251819=this[_0x999c('0xdb')][_0x999c('0xaa')](this,_0x5d56da,_0x2ba1e3);this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x478000,_0x2ba1e3);if(!this[_0x999c('0x89')](_0x478000[_0x999c('0xdc')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xdd'));}var _0xd2bb81=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x478000['variable_id']);if(!_0xd2bb81){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x478000,_0x999c('0xde'));}var _0x946492=this;_0x251819[_0x999c('0xdf')](function(_0x2e04c3,_0x175f22){Object[_0x999c('0xe0')](_0x2e04c3)['forEach'](function(_0x1298e1){_0x946492['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xe1'),_0xd2bb81,_0x175f22,_0x1298e1),_0x2e04c3[_0x1298e1]);});});this['channel'][_0x999c('0xa2')](util['format'](_0x999c('0xe2'),_0xd2bb81),_0x251819[_0x999c('0xa1')]);return this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0xe3'),_0xd2bb81));};AGIVertices[_0x999c('0x13')][_0x999c('0xe4')]=function(_0x44fb81){logger[_0x999c('0xe5')](util[_0x999c('0x2c')](_0x999c('0xe6'),_0x44fb81[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x44fb81[_0x999c('0xe7')])){return this['channel']['error'](_0x44fb81,_0x999c('0xe8'));}var _0x21652b=this['getUser'][_0x999c('0xaa')](this,_0x44fb81[_0x999c('0xe7')]);if(!_0x21652b){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x44fb81,'no\x20user\x20found');}var _0x218e7d=this[_0x999c('0x11')]['exec'](_0x999c('0xe9'),[util[_0x999c('0x2c')](_0x999c('0xea'),_0x21652b),_0x44fb81['timeout'],_0x44fb81[_0x999c('0xeb')],_0x44fb81[_0x999c('0x68')]]);if(_0x218e7d['result']===-0x1){return _0x218e7d;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xec'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x40d747){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xed'),_0x40d747[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x40d747[_0x999c('0x7e')])){return this[_0x999c('0x11')]['noop'](_0x999c('0xee'));}if(!this[_0x999c('0x89')](_0x40d747[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0x40d747);this['createSquareMessage'](_0x40d747[_0x999c('0x60')],'in','','');this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0xf0'),_0x40d747['text']));var _0x18bb3b=this[_0x999c('0x7d')][_0x999c('0xaa')](this,_0x40d747);if(_0x18bb3b){for(var _0x2a13c3 in _0x18bb3b){if(_0x18bb3b[_0x999c('0x98')](_0x2a13c3)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xf1'),_0x2a13c3[_0x999c('0x6f')]()),_0x18bb3b[_0x2a13c3]);}}this[_0x999c('0x46')](_0x18bb3b[_0x999c('0xf2')],'out','dialogflow','');return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xf3'),_0x18bb3b[_0x999c('0xf2')]));}return this[_0x999c('0x11')]['error'](_0x40d747,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0xf4')]=function(_0x8b0662){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xf5'),_0x8b0662[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x8b0662['dialogflowV2_project_id'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xf6'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x81')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20client_email\x20configured');}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0xf7')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xf8'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x82')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xf9'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20text\x20configured');}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0x8b0662);this[_0x999c('0x46')](_0x8b0662[_0x999c('0x60')],'in','','');this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xfa'),_0x8b0662[_0x999c('0x60')]));var _0x3477ee=this[_0x999c('0x80')][_0x999c('0xaa')](this,_0x8b0662);if(_0x3477ee){for(var _0x1dbe76 in _0x3477ee){if(_0x3477ee['hasOwnProperty'](_0x1dbe76)){if(_0x1dbe76!==_0x999c('0xfb')){this['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xf1'),_0x1dbe76[_0x999c('0x6f')]()),_0x3477ee[_0x1dbe76]);}}}this['createSquareMessage'](_0x3477ee[_0x999c('0xf2')],_0x999c('0xfc'),_0x999c('0xf4'),_0x3477ee['providerResponse']);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('DialogflowV2\x20Result\x20%s',_0x3477ee['speech']));}return this[_0x999c('0x11')][_0x999c('0x2e')](_0x8b0662,_0x999c('0xfd'));};AGIVertices[_0x999c('0x13')][_0x999c('0xfe')]=function(_0x3d622a){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3d622a[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x3d622a['ndauth_url'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xff'));}if(!this[_0x999c('0x89')](_0x3d622a['username'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x100'));}if(!this['isConfigured'](_0x3d622a['password'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x101'));}if(!this[_0x999c('0x89')](_0x3d622a[_0x999c('0x102')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this['createSquareDetailsReport'](_0x3d622a);this[_0x999c('0x46')](_0x3d622a[_0x999c('0x60')],'in','','');this['channel'][_0x999c('0xaf')](util['format'](_0x999c('0x103'),_0x3d622a[_0x999c('0x60')]));var _0x23ea9e=this[_0x999c('0x83')][_0x999c('0xaa')](this,_0x3d622a);if(_0x23ea9e){for(var _0x43481a in _0x23ea9e){if(_0x23ea9e[_0x999c('0x98')](_0x43481a)){this[_0x999c('0x11')]['setVariable'](util[_0x999c('0x2c')](_0x999c('0x104'),_0x43481a[_0x999c('0x6f')]()),_0x23ea9e[_0x43481a]);}}this['createSquareMessage'](_0x23ea9e[_0x999c('0xf2')],_0x999c('0xfc'),_0x999c('0xfe'),'');if(_0x23ea9e['audiofile']){this[_0x999c('0x11')]['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x23ea9e[_0x999c('0x105')]));var _0x3788d6=this['channel']['streamFile'](_0x23ea9e['audiofile']);try{fs[_0x999c('0x106')](_0x23ea9e['audiofile']+'.wav');}catch(_0x3274df){logger[_0x999c('0x2e')](_0x3274df);}return _0x3788d6;}else{return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x107'),_0x23ea9e[_0x999c('0xf2')]));}}return this['channel'][_0x999c('0x2e')](_0x3d622a,_0x999c('0x108'));};AGIVertices[_0x999c('0x13')][_0x999c('0x109')]=function(_0x392b34){logger['info'](util[_0x999c('0x2c')](_0x999c('0x10a'),_0x392b34[_0x999c('0x3b')]));return this[_0x999c('0x11')]['noop']('end');};AGIVertices[_0x999c('0x13')][_0x999c('0x10b')]=function(_0x5bf09c){logger['info'](util[_0x999c('0x2c')](_0x999c('0x10c'),_0x5bf09c[_0x999c('0x3b')]));var _0x6fed01='';if(_0x5bf09c['trunk_id']){if(!this[_0x999c('0x89')](_0x5bf09c['trunk_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x5bf09c,'no\x20trunk\x20selected');}else{var _0x506ee9=parseInt(_0x5bf09c['trunk_id'],0xa);if(isNaN(_0x506ee9)){_0x6fed01=_0x5bf09c[_0x999c('0x10d')];}else{_0x6fed01=this[_0x999c('0x10e')][_0x999c('0xaa')](this,_0x5bf09c[_0x999c('0x10d')]);if(!_0x6fed01){return this['channel'][_0x999c('0x2e')](_0x5bf09c,_0x999c('0x10f'));}}}}else if(_0x5bf09c['trunk_name']){_0x6fed01=_0x5bf09c[_0x999c('0x110')];}else{return this[_0x999c('0x11')]['error'](_0x5bf09c,_0x999c('0x111'));}var _0xc24259=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xe9'),[util[_0x999c('0x2c')](_0x999c('0x112'),_0x6fed01,_0x5bf09c['phone']),_0x5bf09c['timeout'],_0x5bf09c[_0x999c('0xeb')],_0x5bf09c[_0x999c('0x68')]]);if(_0xc24259['result']===-0x1){return _0xc24259;}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xec'),_0x999c('0xe9')));};AGIVertices[_0x999c('0x13')][_0x999c('0x113')]=function(_0x1bdefa){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x114'),_0x1bdefa['label']));return this['channel'][_0x999c('0xaf')](_0x999c('0x113'));};AGIVertices[_0x999c('0x13')][_0x999c('0xf')]=function(_0x102815){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x102815[_0x999c('0x3b')]));if(_0x102815['retry']===0x0){return this[_0x999c('0xac')](_0x102815);}_0x102815[_0x999c('0xab')]-=0x1;if(!this[_0x999c('0x89')](_0x102815[_0x999c('0x115')])){return this['channel']['error'](_0x102815,_0x999c('0x116'));}var _0x22c70f=this[_0x999c('0x117')]['sync'](this,_0x102815[_0x999c('0x115')]);if(!_0x22c70f){return this['channel'][_0x999c('0x2e')](_0x102815,_0x999c('0x118'));}if(!this['isConfigured'](_0x102815['variable_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x29d9c6=this[_0x999c('0x11')][_0x999c('0x119')](_0x22c70f,_0x102815[_0x999c('0x11a')],_0x102815[_0x999c('0x11b')]);var _0x3fdf8a=_0x29d9c6['result']?_0x29d9c6['result'][_0x999c('0x50')]():'';logger['info'](_0x999c('0x11c'),JSON[_0x999c('0x77')](_0x29d9c6));if(_0x29d9c6[_0x999c('0xa8')]===-0x1){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x3fdf8a);return _0x29d9c6;}else if(_0x29d9c6[_0x999c('0xa5')]===_0x999c('0x69')){_0x29d9c6[_0x999c('0xa8')]=_0x3fdf8a['length']>=parseInt(_0x102815[_0x999c('0x11d')])?'x':'i';}else{_0x29d9c6['result']=_0x3fdf8a['length']>=parseInt(_0x102815[_0x999c('0x11d')])&&_0x3fdf8a[_0x999c('0xa1')]<=parseInt(_0x102815[_0x999c('0x11b')])?'x':'i';}var _0x26b57b=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x102815[_0x999c('0xdc')]);if(!_0x26b57b){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x102815,_0x999c('0xde'));}this[_0x999c('0x11')][_0x999c('0xa2')](_0x26b57b,_0x3fdf8a);if(this[_0x999c('0x89')](_0x102815['hiddendigitsnum'])){var _0x4ddb18=parseInt(_0x102815[_0x999c('0x11e')],0xa);var _0x2859d2=rs[_0x999c('0x11f')]({'charset':'*','length':_0x4ddb18});var _0x172766=_0x3fdf8a[_0x999c('0xa1')];if(_0x172766>0x0){if(_0x172766>_0x4ddb18){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x102815[_0x999c('0x120')]===_0x999c('0x121')?_0x2859d2+_0x3fdf8a[_0x999c('0x122')](_0x4ddb18):_0x3fdf8a[_0x999c('0x122')](0x0,_0x172766-_0x4ddb18)+_0x2859d2);}else{this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,rs['generate']({'charset':'*','length':_0x172766}));}}else{this['createSquareDetailsReport']['sync'](this,_0x102815,'');}}else{this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x3fdf8a);}return _0x29d9c6;};AGIVertices['prototype'][_0x999c('0x10')]=function(_0x26cd3f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x123'),_0x26cd3f[_0x999c('0x3b')]));return this[_0x999c('0xf')](_0x26cd3f);};AGIVertices[_0x999c('0x13')][_0x999c('0x124')]=function(_0x5b95d4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x125'),_0x5b95d4[_0x999c('0x3b')]));this[_0x999c('0x39')]['sync'](this,_0x5b95d4,_0x5b95d4['goalname']);return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x126'),_0x5b95d4[_0x999c('0x127')]));};AGIVertices['prototype'][_0x999c('0x128')]=function(_0x452ae4){logger['info'](util[_0x999c('0x2c')](_0x999c('0x129'),_0x452ae4[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x452ae4[_0x999c('0x8c')])||!this[_0x999c('0x89')](_0x452ae4[_0x999c('0x8d')])){return this[_0x999c('0x11')]['noop'](_0x999c('0x12a'));}if(!this['isConfigured'](_0x452ae4[_0x999c('0x60')])){return this['channel'][_0x999c('0xaf')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x12b'),_0x452ae4[_0x999c('0x60')]));var _0x46ba24=this[_0x999c('0x8b')][_0x999c('0xaa')](this,_0x452ae4);if(_0x46ba24){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x12c'),_0x46ba24));var _0xe17572=this[_0x999c('0x11')][_0x999c('0x12d')](_0x46ba24);try{fs[_0x999c('0x106')](_0x46ba24+_0x999c('0x12e'));}catch(_0x8c0153){logger[_0x999c('0x2e')](_0x8c0153);}return _0xe17572;}return this['channel'][_0x999c('0x2e')](_0x452ae4,_0x999c('0x12f'));};AGIVertices[_0x999c('0x13')][_0x999c('0x130')]=function(_0xf67038){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x131'),_0xf67038['label']));if(!this[_0x999c('0x89')](_0xf67038[_0x999c('0x8c')])||!this[_0x999c('0x89')](_0xf67038[_0x999c('0x8d')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x12a'));}if(!this[_0x999c('0x89')](_0xf67038[_0x999c('0x91')])){return this[_0x999c('0x11')]['noop'](_0x999c('0x132'));}if(!this['isConfigured'](_0xf67038[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0xf67038);this[_0x999c('0x46')](_0xf67038[_0x999c('0x60')],'in','','');this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x133'),_0xf67038[_0x999c('0x60')]));var _0x285222=this[_0x999c('0x90')][_0x999c('0xaa')](this,_0xf67038);if(_0x285222){for(var _0x19c26e in _0x285222){if(_0x285222[_0x999c('0x98')](_0x19c26e)&&_[_0x999c('0x99')](_0x285222[_0x19c26e])){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x134'),_0x19c26e[_0x999c('0x6f')]()),_0x285222[_0x19c26e]);}}if(_[_0x999c('0x48')](_0x285222[_0x999c('0x7b')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x285222[_0x999c('0x7b')],_0x999c('0xfc'),'amazonlex','');return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x135'),_0x285222[_0x999c('0x7b')]));}}return this[_0x999c('0x11')]['error'](_0xf67038,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0x136')]=function(_0x331057){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x137'),_0x331057['label'],_0x331057['timeout']));if(!this[_0x999c('0x89')](_0x331057[_0x999c('0x7e')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xee'));}var _0x45bdcd=_0x999c('0x138');var _0x57222b=util[_0x999c('0x2c')](_0x999c('0x139'),FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x212dee=util[_0x999c('0x2c')](_0x999c('0xa0'),_0x57222b,_0x45bdcd);var _0x585f91=!![];if(_0x331057['beep']===_0x999c('0x13a')){_0x585f91=![];}var _0x48a090=this[_0x999c('0x11')][_0x999c('0x13b')](_0x57222b,_0x45bdcd,_0x331057[_0x999c('0x13c')],_0x331057[_0x999c('0x69')],undefined,_0x585f91);if(_0x48a090[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x13d'),_0x212dee));var _0x54eee0=this[_0x999c('0x92')][_0x999c('0xaa')](this,_0x331057,_0x212dee);if(_0x54eee0){for(var _0x2d523e in _0x54eee0){if(_0x54eee0[_0x999c('0x98')](_0x2d523e)){this['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x13e'),_0x2d523e['toUpperCase']()),_0x54eee0[_0x2d523e]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x13f'),JSON[_0x999c('0x77')](_0x54eee0)));}}return _0x48a090;};AGIVertices['prototype'][_0x999c('0x140')]=function(_0x41c534){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x141'),_0x41c534['label']));if(!this[_0x999c('0x89')](_0x41c534[_0x999c('0x95')])){return this['channel'][_0x999c('0xaf')](_0x999c('0x142'));}if(!this['isConfigured'](_0x41c534['appsecret'])){return this[_0x999c('0x11')]['noop'](_0x999c('0x143'));}var _0xcd56ee=_0x999c('0x138');var _0x15aabb=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x549161=util[_0x999c('0x2c')](_0x999c('0xa0'),_0x15aabb,_0xcd56ee);var _0x26888e=!![];if(_0x41c534['beep']===_0x999c('0x13a')){_0x26888e=![];}var _0x130614=this[_0x999c('0x11')]['recordFile'](_0x15aabb,_0xcd56ee,_0x41c534[_0x999c('0x13c')],_0x41c534['timeout'],undefined,_0x26888e);if(_0x130614[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x144'),_0x549161));var _0x2c7542=this[_0x999c('0x94')][_0x999c('0xaa')](this,_0x41c534,_0x549161);if(_0x2c7542){for(var _0x1cb9ac in _0x2c7542){if(_0x2c7542[_0x999c('0x98')](_0x1cb9ac)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x145'),_0x1cb9ac[_0x999c('0x6f')]()),_0x2c7542[_0x1cb9ac]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x146'),JSON[_0x999c('0x77')](_0x2c7542)));}}return _0x130614;};AGIVertices[_0x999c('0x13')][_0x999c('0x147')]=function(_0x544e1e){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x544e1e[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x148')](_0x544e1e[_0x999c('0x41')],_0x544e1e[_0x999c('0x42')],_0x544e1e[_0x999c('0x43')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x149')]=function(_0x312b4a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x14a'),_0x312b4a[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x312b4a['condition'])){return this[_0x999c('0x11')]['error'](_0x312b4a,'no\x20condition\x20configured');}try{var _0x3b1e51=eval(_0x312b4a['condition'])?_0x999c('0x14b'):_0x999c('0x14c');this[_0x999c('0x11')][_0x999c('0xaf')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x312b4a[_0x999c('0x14d')],_0x3b1e51));return{'code':0xc8,'result':_0x3b1e51};}catch(_0x28c944){return{'code':0xc8,'result':_0x999c('0x14c')};}};AGIVertices[_0x999c('0x13')][_0x999c('0x14e')]=function(_0x266c10){logger['info'](util[_0x999c('0x2c')](_0x999c('0x14f'),_0x266c10[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x266c10[_0x999c('0x150')])){return this[_0x999c('0x11')]['error'](_0x266c10,_0x999c('0x151'));}var _0x50540a=this[_0x999c('0x27')]['sync'](this,_0x266c10['interval_id']);if(!_0x50540a){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x266c10,_0x999c('0x152'));}for(var _0x3400a9=0x0;_0x3400a9<_0x50540a[_0x999c('0xa1')];_0x3400a9+=0x1){var _0x3c2b33=this[_0x999c('0x11')][_0x999c('0xa7')](util[_0x999c('0x2c')]('IFTIME(%s?true:false)',_0x50540a[_0x3400a9]));if(_0x3c2b33[_0x999c('0xa8')]===-0x1){return _0x3c2b33;}logger['info'](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],_0x3c2b33['extra']));if(_0x3c2b33[_0x999c('0xa5')]===_0x999c('0x14b')){logger['info'](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],_0x999c('0x14b')));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],'true'));return{'code':0xc8,'result':_0x999c('0x14b')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('IFTIME\x20%s\x20%s',_0x50540a[_0x3400a9],_0x999c('0x14c')));this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],'false'));}}return{'code':0xc8,'result':_0x999c('0x14c')};};AGIVertices[_0x999c('0x13')][_0x999c('0x154')]=function(_0x28404c){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x155'),_0x28404c[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x154')]();};AGIVertices[_0x999c('0x13')]['ispeechasr']=function(_0x334749){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x156'),_0x334749[_0x999c('0x3b')]));if(!this['isConfigured'](_0x334749[_0x999c('0x7e')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20key\x20configured');}var _0x4964ad=_0x999c('0x138');var _0xe82c1a=util['format'](_0x999c('0x139'),FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x512b41=util[_0x999c('0x2c')](_0x999c('0xa0'),_0xe82c1a,_0x4964ad);var _0x982e0b=!![];if(_0x334749[_0x999c('0x157')]===_0x999c('0x13a')){_0x982e0b=![];}var _0x577985=this[_0x999c('0x11')]['recordFile'](_0xe82c1a,_0x4964ad,_0x334749[_0x999c('0x13c')],_0x334749[_0x999c('0x69')],undefined,_0x982e0b);if(_0x577985[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x158'),_0x512b41));var _0x28758e=this['ispeechASR'][_0x999c('0xaa')](this,_0x334749,_0x512b41);if(_0x28758e){for(var _0x564753 in _0x28758e){if(_0x28758e[_0x999c('0x98')](_0x564753)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')]('ISPEECH_ASR_%s',_0x564753['toUpperCase']()),_0x28758e[_0x564753]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x159'),JSON[_0x999c('0x77')](_0x28758e)));}}return _0x577985;};AGIVertices[_0x999c('0x13')]['ispeechtts']=function(_0x22657){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x15a'),_0x22657['label']));if(!this[_0x999c('0x89')](_0x22657['key'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xee'));}if(!this['isConfigured'](_0x22657[_0x999c('0x60')])){return this[_0x999c('0x11')]['noop'](_0x999c('0xb0'));}this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x15b'),_0x22657['text']));var _0x5c1242=this['ispeechTTS'][_0x999c('0xaa')](this,_0x22657);if(_0x5c1242){this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x158'),_0x5c1242));var _0x3e2781=this[_0x999c('0x11')]['streamFile'](_0x5c1242,_0x22657[_0x999c('0x13c')]);try{fs[_0x999c('0x106')](_0x5c1242+_0x999c('0x12e'));}catch(_0x2fa34c){logger['error'](_0x2fa34c);}return _0x3e2781;}return this[_0x999c('0x11')]['error'](_0x22657,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0x15c')]=function(_0x4adff5){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x15d'),_0x4adff5[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x4adff5[_0x999c('0x15e')])){return this['channel'][_0x999c('0x2e')](_0x4adff5,_0x999c('0x15f'));}logger[_0x999c('0x32')](util['format'](_0x999c('0x160'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));var _0x351c77=this['agentLogin'][_0x999c('0xaa')](this,_0x4adff5[_0x999c('0x15e')]);if(_0x351c77){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x999c('0x164')]=function(_0x46b0b6){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x165'),_0x46b0b6[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x46b0b6[_0x999c('0x15e')])){return this[_0x999c('0x11')]['error'](_0x46b0b6,_0x999c('0x15f'));}logger['info'](util['format'](_0x999c('0x160'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));var _0x3f353a=this[_0x999c('0x56')][_0x999c('0xaa')](this,_0x46b0b6[_0x999c('0x15e')]);if(_0x3f353a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')]['callerid'],_0x46b0b6['findBy']));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6['findBy']));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices['prototype'][_0x999c('0x167')]=function(_0x3c10ff){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x168'),_0x3c10ff['label']));if(!this['isConfigured'](_0x3c10ff[_0x999c('0x169')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3c10ff,'no\x20operation\x20configured');}this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x16a'),_0x3c10ff['operation']));var _0x50dba8=eval(_0x3c10ff[_0x999c('0x169')]);if(!this['isConfigured'](_0x3c10ff[_0x999c('0xdc')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xdd'));}var _0x249e27=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x3c10ff[_0x999c('0xdc')]);if(!_0x249e27){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3c10ff,_0x999c('0xde'));}if(_[_0x999c('0x9d')](_0x50dba8)){var _0x580e2e=this;_0x50dba8['forEach'](function(_0x1d0db7,_0x26d854){_0x580e2e[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x16b'),_0x249e27,_0x26d854),_0x1d0db7);});return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x16c'),_0x249e27));}else{return this[_0x999c('0x11')]['setVariable'](_0x249e27,_0x50dba8);}};AGIVertices['prototype'][_0x999c('0xe')]=function(_0x2cf44d){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x16d'),_0x2cf44d[_0x999c('0x3b')]));if(_0x2cf44d[_0x999c('0xab')]===0x0){return this['maxRetry'](_0x2cf44d);}_0x2cf44d[_0x999c('0xab')]-=0x1;if(!this[_0x999c('0x89')](_0x2cf44d['file_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x2cf44d,_0x999c('0x116'));}var _0x3c5ca7=this[_0x999c('0x117')][_0x999c('0xaa')](this,_0x2cf44d[_0x999c('0x115')]);if(!_0x3c5ca7){return this[_0x999c('0x11')]['error'](_0x2cf44d,_0x999c('0x118'));}var _0x51e31d=this['channel'][_0x999c('0x119')](_0x3c5ca7,_0x2cf44d[_0x999c('0x11a')],_0x2cf44d[_0x999c('0x16e')]);var _0x2f7e4a=_0x51e31d[_0x999c('0xa8')];if(_0x51e31d['result']===-0x1){this['createSquareDetailsReport'][_0x999c('0xaa')](this,_0x2cf44d,'-1');return _0x51e31d;}else if(_0x51e31d[_0x999c('0xa5')]===_0x999c('0x69')){_0x51e31d[_0x999c('0xa8')]=_0x51e31d['result'][_0x999c('0xa1')]>0x0?_0x51e31d[_0x999c('0xa8')]:'t';}else if(_[_0x999c('0x4b')](_0x51e31d[_0x999c('0xa8')])){_0x51e31d[_0x999c('0xa8')]='#';_0x2f7e4a='#';}if(!this[_0x999c('0x89')](_0x2cf44d[_0x999c('0xdc')])){this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xdd'));}else{var _0x34d861=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x2cf44d[_0x999c('0xdc')]);if(!_0x34d861){return this['channel']['error'](_0x2cf44d,_0x999c('0xde'));}this[_0x999c('0x11')]['setVariable'](_0x34d861,_0x2f7e4a);}this[_0x999c('0x39')]['sync'](this,_0x2cf44d,_0x2f7e4a);return _0x51e31d;};AGIVertices['prototype'][_0x999c('0xaf')]=function(_0x1a5a09){logger['info'](util['format'](_0x999c('0x16f'),_0x1a5a09[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0xaf')](_0x1a5a09['output']||_0x1a5a09['label']);};AGIVertices[_0x999c('0x13')][_0x999c('0x170')]=function(_0x1b17c4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x171'),_0x1b17c4[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x1b17c4['findBy'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x1b17c4,_0x999c('0x15f'));}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x160'),this[_0x999c('0x11')]['callerid'],_0x1b17c4[_0x999c('0x15e')]));var _0x243102=this[_0x999c('0x52')][_0x999c('0xaa')](this,_0x1b17c4[_0x999c('0x172')]);var _0x48c61c=this['agentPause'][_0x999c('0xaa')](this,_0x1b17c4[_0x999c('0x15e')],_0x243102);if(_0x48c61c){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x161'),this['channel'][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger['info'](util['format'](_0x999c('0x163'),this['channel'][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices[_0x999c('0x13')][_0x999c('0x173')]=function(_0x56dad0){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x174'),_0x56dad0[_0x999c('0x3b')]));if(!this['isConfigured'](_0x56dad0[_0x999c('0x115')])){return this[_0x999c('0x11')]['error'](_0x56dad0,_0x999c('0x116'));}var _0x61d278=this[_0x999c('0x117')][_0x999c('0xaa')](this,_0x56dad0[_0x999c('0x115')]);if(!_0x61d278){return this['channel']['error'](_0x56dad0,_0x999c('0x118'));}var _0x1784f8=this[_0x999c('0x11')]['exec'](_0x999c('0x175'),[_0x61d278,_0x56dad0[_0x999c('0xeb')]]);if(_0x1784f8[_0x999c('0xa8')]===-0x1){return _0x1784f8;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20%s\x20%s',_0x999c('0x175'),_0x61d278));};AGIVertices[_0x999c('0x13')][_0x999c('0x176')]=function(_0x34d590){logger[_0x999c('0x32')](util['format'](_0x999c('0x177'),_0x34d590[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x34d590['queue_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x34d590,_0x999c('0x178'));}var _0xd62ace='';var _0x56ebc7=parseInt(_0x34d590[_0x999c('0x179')],0xa);if(isNaN(_0x56ebc7)){_0xd62ace=_0x34d590[_0x999c('0x179')];}else{_0xd62ace=this[_0x999c('0x19')]['sync'](this,_0x34d590[_0x999c('0x179')]);if(!_0xd62ace){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x34d590,_0x999c('0x17a'));}}var _0x5159c8='';if(this[_0x999c('0x89')](_0x34d590['file_id'])){var _0xb53ab1=this['getSound'][_0x999c('0xaa')](this,_0x34d590[_0x999c('0x115')]);if(_0xb53ab1){_0x5159c8=_0xb53ab1;}}this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x34d590,_0xd62ace);if(_0x34d590[_0x999c('0xeb')]['indexOf']('x')<0x0){_0x34d590['opts']+='x';}if(_0x34d590[_0x999c('0xeb')]['indexOf']('X')<0x0){_0x34d590[_0x999c('0xeb')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0xd62ace?_0xd62ace[_0x999c('0x17b')]():'');var _0x52c0ad=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0x17c'),[_0xd62ace,_0x34d590[_0x999c('0xeb')],_0x34d590[_0x999c('0x68')],_0x5159c8,_0x34d590[_0x999c('0x69')],_0x34d590[_0x999c('0x8')],_0x34d590[_0x999c('0x17d')],_0x34d590[_0x999c('0x17e')],'',_0x34d590['position']]);if(_0x52c0ad[_0x999c('0xa8')]===-0x1){return _0x52c0ad;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc9'),_0x999c('0x17c'),_0xd62ace));};AGIVertices[_0x999c('0x13')][_0x999c('0x17f')]=function(_0x44a84a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x180'),_0x44a84a[_0x999c('0x3b')]));var _0x23d66e=_0x44a84a['recordingFormat']||_0x999c('0x138');var _0x1286b9=util[_0x999c('0x2c')](_0x999c('0x181'),this[_0x999c('0x11')][_0x999c('0x3a')],rs[_0x999c('0x11f')](0x5));var _0x3c5773=util[_0x999c('0x2c')](_0x999c('0x182'),FILES_PATH,_0x1286b9,_0x23d66e);var _0x3648a4=util['format'](_0x999c('0x139'),FILES_PATH,_0x1286b9);this[_0x999c('0x3f')][_0x999c('0xaa')](this,_0x44a84a,_0x1286b9,_0x3c5773);this[_0x999c('0x11')][_0x999c('0xa2')](_0x999c('0x183'),_0x1286b9);logger[_0x999c('0x32')](_0x999c('0x184'),_0x3648a4,_0x23d66e,_0x44a84a['escape_digits'],_0x44a84a['timeout']);return this[_0x999c('0x11')][_0x999c('0x13b')](_0x3648a4,_0x23d66e,_0x44a84a['escape_digits'],_0x44a84a['timeout'],undefined,!![]);};AGIVertices[_0x999c('0x13')][_0x999c('0x185')]=function(_0x3e388f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x186'),_0x3e388f[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x3e388f[_0x999c('0x68')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x187'));}var _0x5e49ff=this[_0x999c('0x188')][_0x999c('0xaa')](this,_0x3e388f);logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x189'),util[_0x999c('0x18a')](_0x5e49ff,{'showHidden':![],'depth':null})));if(!this[_0x999c('0x89')](_0x3e388f['variable_id'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x18b'));}var _0x172017=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x3e388f[_0x999c('0xdc')]);if(!_0x172017){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3e388f,_0x999c('0xde'));}this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x18c'),_0x172017),_0x5e49ff[_0x999c('0x79')]?_0x5e49ff[_0x999c('0x79')]:_0x999c('0x18d'));this[_0x999c('0x11')]['setVariable'](util[_0x999c('0x2c')](_0x999c('0x18e'),_0x172017),_0x5e49ff[_0x999c('0x7a')]?_0x5e49ff[_0x999c('0x7a')]:'OK');if(_0x5e49ff['body']){try{this[_0x999c('0x9f')](_0x5e49ff[_0x999c('0x70')],_0x172017);}catch(_0x95500b){logger[_0x999c('0x2e')](util[_0x999c('0x2c')](_0x999c('0x18f'),_0x172017));}}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xe3'),_0x172017));};AGIVertices[_0x999c('0x13')]['saydigits']=function(_0x3309f9){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x190'),_0x3309f9[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x191')](_0x3309f9[_0x999c('0x192')][_0x999c('0x5c')](/\s+/g,''),_0x3309f9[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x194')]=function(_0x439345){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x195'),_0x439345['label']));return this[_0x999c('0x11')][_0x999c('0x196')](_0x439345[_0x999c('0x6a')][_0x999c('0x5c')](/\s+/g,''),_0x439345[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x197')]=function(_0x1cb4dc){logger['info'](util[_0x999c('0x2c')](_0x999c('0x198'),_0x1cb4dc[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x199')](_0x1cb4dc[_0x999c('0x60')],_0x1cb4dc[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x19a')]=function(_0x4081c0){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4081c0[_0x999c('0x3b')]));if(!this['isConfigured'](_0x4081c0[_0x999c('0x19b')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x19c'));}var _0x43225a=this[_0x999c('0x25')][_0x999c('0xaa')](this,_0x4081c0[_0x999c('0x19b')]);if(!_0x43225a||!_0x43225a[_0x999c('0x19d')]){return this[_0x999c('0x11')]['error'](_0x4081c0,'no\x20mail\x20account\x20found');}var _0x2ceb53={'from':util[_0x999c('0x2c')](_0x999c('0x19e'),_0x43225a[_0x999c('0x17')],_0x43225a[_0x999c('0x19f')]||_0x43225a['Smtp'][_0x999c('0x1a0')]),'to':_0x4081c0['to']||'','cc':_0x4081c0['cc']||'','bcc':_0x4081c0['bcc']||'','subject':_0x4081c0[_0x999c('0x1a1')],'html':_0x4081c0[_0x999c('0x60')],'text':_0x4081c0[_0x999c('0x60')]};if(this[_0x999c('0x89')](_0x4081c0['template_id'])){}logger[_0x999c('0xe5')](_0x999c('0x1a2'),JSON[_0x999c('0x77')](_0x2ceb53));this['createSquareDetailsReport'][_0x999c('0xaa')](this,_0x4081c0,_0x4081c0[_0x999c('0x19b')]);this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x1a3'),_0x43225a[_0x999c('0x17')]));this[_0x999c('0x26')][_0x999c('0xaa')](this,_0x43225a['smtpOptions'],_0x2ceb53);return this[_0x999c('0x11')][_0x999c('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x999c('0x13')][_0x999c('0x1a4')]=function(_0xedf544){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1a5'),_0xedf544['label']));return this['channel'][_0x999c('0xaf')](_0x999c('0x1a6'));};AGIVertices[_0x999c('0x13')]['sendSMS']=function(_0x5f0d48){logger[_0x999c('0x32')](util['format'](_0x999c('0x1a7'),_0x5f0d48[_0x999c('0x3b')]));if(!this['isConfigured'](_0x5f0d48[_0x999c('0x1a8')])){return this['channel'][_0x999c('0xaf')]('no\x20sms\x20account\x20configured');}var _0x573dea=this['getSmsAccount']['sync'](this,_0x5f0d48['sms_account_id']);if(!_0x573dea){return this['channel']['error'](_0x5f0d48,_0x999c('0x1a9'));}var _0xb094bf={'body':_0x5f0d48[_0x999c('0x1aa')],'phone':_0x5f0d48['to']||'','SmsAccountId':_0x573dea['id']};logger['debug'](_0x999c('0x1ab'),JSON['stringify'](_0xb094bf));this[_0x999c('0x39')]['sync'](this,_0x5f0d48,_0x5f0d48['sms_account_id']);this['channel']['noop'](util[_0x999c('0x2c')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x573dea[_0x999c('0x17')]));this[_0x999c('0x38')][_0x999c('0xaa')](this,_0xb094bf);return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1ac'));};AGIVertices[_0x999c('0x13')]['set']=function(_0x25086e){logger['info'](util[_0x999c('0x2c')](_0x999c('0x1ad'),_0x25086e[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x25086e[_0x999c('0xdc')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x25086e,_0x999c('0x1ae'));}var _0x1aa957=this['getVariable'][_0x999c('0xaa')](this,_0x25086e[_0x999c('0xdc')]);if(!_0x1aa957){return this[_0x999c('0x11')]['error'](_0x25086e,_0x999c('0xde'));}return this[_0x999c('0x11')][_0x999c('0xa2')](_0x1aa957,_0x25086e['variable_value']);};AGIVertices[_0x999c('0x13')][_0x999c('0x1af')]=function(_0x31dbc4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1b0'),_0x31dbc4['label']));this['channel'][_0x999c('0xaf')](_0x999c('0x1b1'));var _0x37d49b=this[_0x999c('0x11')][_0x999c('0xa7')](_0x999c('0x1b2'));if(!_[_0x999c('0x4b')](_0x37d49b[_0x999c('0xa5')])){this[_0x999c('0x11')][_0x999c('0x3a')]=_0x37d49b[_0x999c('0xa5')];}if(_0x31dbc4[_0x999c('0xbf')]===_0x999c('0x1b3')){this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1b4'));return this['channel'][_0x999c('0xbf')]();}return this[_0x999c('0x11')][_0x999c('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x999c('0x13')][_0x999c('0x1b5')]=function(_0xc55237){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1b6'),_0xc55237[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0xc55237[_0x999c('0x1b7')])){return this['channel']['error'](_0xc55237,_0x999c('0x1b8'));}var _0x4f52f9=this['getSquareProject'][_0x999c('0xaa')](this,_0xc55237[_0x999c('0x1b7')]);if(!this['isConfigured'](_0x4f52f9)){return this[_0x999c('0x11')][_0x999c('0x2e')](_0xc55237,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0xc55237[_0x999c('0x1b7')]));}if(_0x4f52f9===this[_0x999c('0x11')]['arg_1']){return this['channel'][_0x999c('0x2e')](_0xc55237,_0x999c('0x1b9'));}this[_0x999c('0x39')][_0x999c('0xaa')](this,_0xc55237,_0x4f52f9);var _0x38f992=this[_0x999c('0x11')]['exec'](_0x999c('0x1ba'),util[_0x999c('0x2c')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x999c('0x8')][_0x999c('0x1bb')]||'127.0.0.1',_0x4f52f9,this[_0x999c('0x11')]['arg_1']));if(_0x38f992[_0x999c('0xa8')]===-0x1){return _0x38f992;}return this['channel'][_0x999c('0xaf')](util['format'](_0x999c('0xc9'),_0x999c('0x1ba'),_0x4f52f9));};AGIVertices[_0x999c('0x13')]['system']=function(_0xa4b49b){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xa4b49b['label']));var _0x4f96e5=this[_0x999c('0x5a')][_0x999c('0xaa')](this,_0xa4b49b[_0x999c('0xbe')]);this[_0x999c('0x39')][_0x999c('0xaa')](this,_0xa4b49b,_0xa4b49b[_0x999c('0xbe')]);if(this['isConfigured'](_0xa4b49b['variable_id'])){var _0x2b6f06=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0xa4b49b['variable_id']);if(_0x2b6f06){this[_0x999c('0x11')]['setVariable'](_0x2b6f06,_0x4f96e5);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1bc'),_0xa4b49b[_0x999c('0xbe')],_0x2b6f06));}}return this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x1bd'),_0xa4b49b[_0x999c('0xbe')]));};AGIVertices[_0x999c('0x13')][_0x999c('0x1be')]=function(_0x4a3f5d){logger['info'](util[_0x999c('0x2c')](_0x999c('0x1bf'),_0x4a3f5d[_0x999c('0x3b')]));_0x4a3f5d[_0x999c('0x60')]=_0x4a3f5d[_0x999c('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4a3f5d[_0x999c('0x5e')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1c0'));}if(!this[_0x999c('0x89')](_0x4a3f5d['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x1c1'),_0x4a3f5d['text']));var _0x1d953e=this['googleCloudTTS'][_0x999c('0xaa')](this,_0x4a3f5d);if(_0x1d953e){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1c2'),_0x1d953e));var _0x275ffa=this[_0x999c('0x11')][_0x999c('0x12d')](_0x1d953e);try{fs['unlink'](_0x1d953e+_0x999c('0x12e'));}catch(_0x258147){logger[_0x999c('0x2e')](_0x258147);}return _0x275ffa;}return this['channel'][_0x999c('0x2e')](_0x4a3f5d,_0x999c('0x1c3'));};AGIVertices[_0x999c('0x13')]['tts']=function(_0x4fe562){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4fe562['label']));_0x4fe562['text']=_0x4fe562['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x999c('0x89')](_0x4fe562['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1c4'),_0x4fe562[_0x999c('0x60')]));var _0x456af8=this[_0x999c('0x67')][_0x999c('0xaa')](this,_0x4fe562);if(_0x456af8){this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x1c5'),_0x456af8));var _0xdeef9b=this[_0x999c('0x11')][_0x999c('0x12d')](_0x456af8);try{fs[_0x999c('0x106')](_0x456af8+_0x999c('0x12e'));}catch(_0x20e56e){logger[_0x999c('0x2e')](_0x20e56e);}return _0xdeef9b;}return this['channel'][_0x999c('0x2e')](_0x4fe562,_0x999c('0x1c6'));};AGIVertices[_0x999c('0x13')][_0x999c('0x1c7')]=function(_0x1567b8){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1567b8[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x1567b8[_0x999c('0x15e')])){return this['channel'][_0x999c('0x2e')](_0x1567b8,'no\x20find\x20by\x20configured');}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x160'),this['channel'][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));var _0x11c683=this[_0x999c('0x55')]['sync'](this,_0x1567b8[_0x999c('0x15e')]);if(_0x11c683){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x161'),this['channel']['callerid'],_0x1567b8['findBy']));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x999c('0x11')]['callerid'],_0x1567b8[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices[_0x999c('0x13')]['voicemail']=function(_0x36ca62){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1c8'),_0x36ca62['label']));var _0x1dc7a4=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0x1c9'),[_0x36ca62[_0x999c('0x1ca')],_0x36ca62['options']]);if(_0x1dc7a4[_0x999c('0xa8')]===-0x1){return _0x1dc7a4;}return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0xc9'),_0x999c('0x1c9'),_0x36ca62[_0x999c('0x1ca')]));};AGIVertices[_0x999c('0x13')][_0x999c('0x1cb')]=function(_0x342fb2){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1cc'),_0x342fb2['label']));if(!this[_0x999c('0x89')](_0x342fb2[_0x999c('0xdc')])){return this['channel'][_0x999c('0x2e')](_0x342fb2,_0x999c('0x1ae'));}var _0x1b1c51=this[_0x999c('0xa7')]['sync'](this,_0x342fb2['variable_id']);if(!_0x1b1c51){return this['channel'][_0x999c('0x2e')](_0x342fb2,_0x999c('0xde'));}var _0x1215ac=this[_0x999c('0x11')][_0x999c('0xa7')](_0x1b1c51);return{'code':0xc8,'result':_0x1215ac[_0x999c('0xa5')]?_0x1215ac['extra']:'-'};};String[_0x999c('0x13')]['replaceAll']=function(_0xa5faf8,_0x25d1a2){return this[_0x999c('0xa3')](_0xa5faf8)[_0x999c('0x1cd')](_0x25d1a2);};module[_0x999c('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x31af=['DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','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','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','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','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','debug','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','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','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','exports','util','lodash','shelljs','moment','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','replace','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x31af,0xde));var _0xf31a=function(_0x273149,_0x507bc9){_0x273149=_0x273149-0x0;var _0x1e2c73=_0x31af[_0x273149];return _0x1e2c73;};'use strict';var fs=require('fs');var util=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));var sh=require(_0xf31a('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xf31a('0x3'));var Mustache=require('mustache');var rp=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xf31a('0x8');var recursiveMapAttributes=[_0xf31a('0x9'),_0xf31a('0xa')];var verticesWithRetry=[_0xf31a('0xb'),'getdigits',_0xf31a('0xc')];var AGIVertices=function(_0xe5778a,_0x410d44,_0xee6b4a){this['channel']=_0xe5778a;this[_0xf31a('0xd')]=_0x410d44;this[_0xf31a('0xe')]=_0xee6b4a;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x10')]=function(_0xf2e284,_0x5165aa){this[_0xf31a('0xd')][_0xf31a('0x11')](_0xf2e284)[_0xf31a('0x12')](function(_0x3f0cc8){_0x5165aa(null,_0x3f0cc8?_0x3f0cc8['name']:![]);})[_0xf31a('0x13')](function(_0x26b85e){_0x5165aa(_0x26b85e);});};AGIVertices['prototype'][_0xf31a('0x14')]=function(_0x46345c,_0x46bdd3){this[_0xf31a('0xd')][_0xf31a('0x15')](_0x46345c)[_0xf31a('0x12')](function(_0x1d2d07){_0x46bdd3(null,_0x1d2d07?_0x1d2d07[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x22522c){_0x46bdd3(_0x22522c);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x17')]=function(_0x3439ba,_0xccfd8b){this[_0xf31a('0xd')]['getSquareProjectById'](_0x3439ba)[_0xf31a('0x12')](function(_0x27e161){_0xccfd8b(null,_0x27e161?_0x27e161[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x4c3589){_0xccfd8b(_0x4c3589);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18')]=function(_0x204dc2,_0x208da3){this[_0xf31a('0xd')]['getSquareOdbcById'](_0x204dc2)[_0xf31a('0x12')](function(_0xd3ac94){_0x208da3(null,_0xd3ac94?_0xd3ac94['dsn']:![]);})[_0xf31a('0x13')](function(_0x504d13){_0x208da3(_0x504d13);});};AGIVertices['prototype'][_0xf31a('0x19')]=function(_0x7ce891,_0x54f9b5){this['rpc']['getUserById'](_0x7ce891)[_0xf31a('0x12')](function(_0x1e4dea){_0x54f9b5(null,_0x1e4dea?_0x1e4dea['name']:![]);})[_0xf31a('0x13')](function(_0x2a8a22){_0x54f9b5(_0x2a8a22);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a')]=function(_0x4c46d9,_0x5d8083){this[_0xf31a('0xd')][_0xf31a('0x1b')](_0x4c46d9)['then'](function(_0x4e115c){_0x5d8083(null,_0x4e115c?_0x4e115c['name']:![]);})['catch'](function(_0x14c82e){_0x5d8083(_0x14c82e);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1c')]=function(_0x595db6,_0x2281c5){var _0x2ace06=this;this[_0xf31a('0xd')][_0xf31a('0x1d')](_0x595db6)[_0xf31a('0x12')](function(_0x5a55c6){_0x2281c5(null,_0x5a55c6?_0x2ace06[_0xf31a('0x1e')](_0x5a55c6[_0xf31a('0x1f')]):![]);})['catch'](function(_0x52da7d){_0x2281c5(_0x52da7d);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x20')]=function(_0x5c842e,_0x1bcfe6){this[_0xf31a('0xd')][_0xf31a('0x21')](_0x5c842e)['then'](function(_0x1d4d9b){_0x1bcfe6(null,_0x1d4d9b?_0x1d4d9b:![]);})[_0xf31a('0x13')](function(_0x289f27){_0x1bcfe6(_0x289f27);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x22')]=function(_0x19807c,_0x53ffb6,_0xcdf92){this[_0xf31a('0xe')][_0xf31a('0x22')](_0x19807c,_0x53ffb6)[_0xf31a('0x12')](function(){_0xcdf92(null);})[_0xf31a('0x13')](function(_0x42d1a6){_0xcdf92(_0x42d1a6);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x23')]=function(_0x17c5dc,_0x137ea4){this[_0xf31a('0xd')][_0xf31a('0x24')](_0x17c5dc)[_0xf31a('0x12')](function(_0x25cd42){if(_0x25cd42){if(_0x25cd42[_0xf31a('0x25')]){_0x137ea4(null,[_0x25cd42[_0xf31a('0x26')]]);}else{_0x137ea4(null,_[_0xf31a('0x27')](_0x25cd42[_0xf31a('0x28')],_0xf31a('0x26')));}}else{_0x137ea4(null,![]);}})['catch'](function(_0x2d81f3){_0x137ea4(_0x2d81f3);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1e')]=function(_0x424db8){return util[_0xf31a('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x424db8);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x2a')]=function(_0xe8e0e0,_0x5820e6,_0x474cfc){odbc[_0xf31a('0x2b')](_0xe8e0e0,function(_0xe141dd){if(_0xe141dd){logger[_0xf31a('0x2c')](_0xf31a('0x2d'),_0xe141dd);_0x474cfc(_0xe141dd);}else{logger['info'](_0xf31a('0x2e'));odbc['query'](_0x5820e6,function(_0x44321d,_0x129409){if(_0x44321d){logger['info'](_0xf31a('0x2f'),_0x5820e6);_0x474cfc(_0x44321d);}else{logger[_0xf31a('0x30')](_0xf31a('0x31'),_0x5820e6);odbc['close'](function(_0x5d1176){if(_0x5d1176){logger[_0xf31a('0x2c')](_0xf31a('0x32'),_0x5d1176);}_0x474cfc(null,_0x129409);});}});}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x33')]=function(_0x2a240d,_0x46587e){this[_0xf31a('0xd')][_0xf31a('0x34')](_0x2a240d)['then'](function(_0x3b4aef){_0x46587e(null,_0x3b4aef?_0x3b4aef:![]);})[_0xf31a('0x13')](function(_0x4ac009){_0x46587e(_0x4ac009);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x35')]=function(_0x1085c2,_0x44b30b){this['rpc'][_0xf31a('0x35')](_0x1085c2)[_0xf31a('0x12')](function(_0x306415){_0x44b30b(null,_0x306415);})[_0xf31a('0x13')](function(_0x529814){_0x44b30b(_0x529814);});};AGIVertices[_0xf31a('0xf')]['createSquareDetailsReport']=function(_0x303066,_0x172e1c,_0x1ef487){this['rpc'][_0xf31a('0x36')]({'uniqueid':this['channel'][_0xf31a('0x37')],'node':_0x303066[_0xf31a('0x38')],'application':_0x303066[_0xf31a('0x39')],'data':_0x172e1c||null,'project_name':this[_0xf31a('0x3a')][_0xf31a('0x3b')],'callerid':this[_0xf31a('0x3a')][_0xf31a('0x3c')]})[_0xf31a('0x12')](function(_0x344649){if(_0x1ef487){_0x1ef487(null,_0x344649);}})['catch'](function(_0x1a9f36){if(_0x1ef487){_0x1ef487(_0x1a9f36);}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x3d')]=function(_0x38d568,_0x82885d,_0x12cf9b,_0x2a2459){this['rpc']['createSquareRecording']({'uniqueid':this[_0xf31a('0x3a')][_0xf31a('0x37')],'callerid':this[_0xf31a('0x3a')][_0xf31a('0x3c')],'calleridname':this[_0xf31a('0x3a')][_0xf31a('0x3e')],'context':this['channel'][_0xf31a('0x3f')],'extension':this[_0xf31a('0x3a')][_0xf31a('0x40')],'priority':this[_0xf31a('0x3a')][_0xf31a('0x41')],'accountcode':this[_0xf31a('0x3a')]['accountcode'],'dnid':this[_0xf31a('0x3a')][_0xf31a('0x42')],'projectName':this[_0xf31a('0x3a')][_0xf31a('0x3b')],'saveName':_0x82885d,'filename':_0x38d568[_0xf31a('0x43')]||_0x82885d,'savePath':_0x12cf9b})[_0xf31a('0x12')](function(_0x20bd0c){_0x2a2459(null,_0x20bd0c);})[_0xf31a('0x13')](function(_0x1f8161){_0x2a2459(_0x1f8161);});};AGIVertices[_0xf31a('0xf')]['createSquareMessage']=function(_0x2f1b64,_0x4d17fc,_0x423768,_0x3f8b9b,_0xa9b74c){this[_0xf31a('0xd')][_0xf31a('0x44')]({'uniqueid':this[_0xf31a('0x3a')][_0xf31a('0x37')],'body':_0x2f1b64,'direction':_0x4d17fc,'providerName':_0x423768,'providerResponse':_0x3f8b9b})[_0xf31a('0x12')](function(_0x4aaa57){if(_0xa9b74c){_0xa9b74c(null,_0x4aaa57);}})[_0xf31a('0x13')](function(_0x416227){if(_0xa9b74c){_0xa9b74c(_0x416227);}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x45')]=function(_0x3877f8,_0x8c6795){this['rpc'][_0xf31a('0x45')]({'firstName':_[_0xf31a('0x46')](_0x3877f8[_0xf31a('0x16')])||_[_0xf31a('0x47')](_0x3877f8[_0xf31a('0x16')])?_0xf31a('0x48')+Math[_0xf31a('0x49')]():_0x3877f8[_0xf31a('0x16')],'lastName':_[_0xf31a('0x46')](_0x3877f8[_0xf31a('0x4a')])||_[_0xf31a('0x47')](_0x3877f8[_0xf31a('0x4a')])?null:_0x3877f8['lastName'],'phone':_0x3877f8[_0xf31a('0x4b')],'ListId':_0x3877f8[_0xf31a('0x4c')],'scheduledat':_0x3877f8[_0xf31a('0x4d')],'callbackUniqueid':this['channel'][_0xf31a('0x37')],'tags':'callback','description':_0xf31a('0x4e')+_0x3877f8[_0xf31a('0x4d')][_0xf31a('0x4f')](),'priority':_0x3877f8[_0xf31a('0x50')]})['then'](function(_0x89bdd){_0x8c6795(null,_0x89bdd);})[_0xf31a('0x13')](function(_0x2ebd69){_0x8c6795(_0x2ebd69);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x51')]=function(_0x10eb82,_0x5579c6){this[_0xf31a('0xd')]['getPauseById'](_0x10eb82)['then'](function(_0x5d2700){_0x5579c6(null,_0x5d2700?_0x5d2700[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x501409){_0x5579c6(_0x501409);});};AGIVertices['prototype'][_0xf31a('0x52')]=function(_0x292b58,_0xfd1cf7,_0x4bc18c){var _0x4b9586={'role':_0xf31a('0x53')};_0x4b9586[_0x292b58]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this[_0xf31a('0xd')][_0xf31a('0x52')](_0x4b9586,_0xfd1cf7,this[_0xf31a('0x3a')]['uniqueid'])[_0xf31a('0x12')](function(_0x4e8669){_0x4bc18c(null,_[_0xf31a('0x47')](_0x4e8669)?![]:!![]);})[_0xf31a('0x13')](function(_0x73c0a1){logger['error'](_0x73c0a1);_0x4bc18c(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x54')]=function(_0x24be18,_0xcf0f0b){var _0x122b6d={'role':_0xf31a('0x53')};_0x122b6d[_0x24be18]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this['rpc'][_0xf31a('0x54')](_0x122b6d)['then'](function(_0x29aeb9){_0xcf0f0b(null,_['isNil'](_0x29aeb9)?![]:!![]);})[_0xf31a('0x13')](function(_0x11cd2b){logger[_0xf31a('0x2c')](_0x11cd2b);_0xcf0f0b(null,![]);});};AGIVertices[_0xf31a('0xf')]['agentLogout']=function(_0x3e109a,_0x21548d){var _0x694196={'role':_0xf31a('0x53')};_0x694196[_0x3e109a]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this[_0xf31a('0xd')][_0xf31a('0x55')](_0x694196)[_0xf31a('0x12')](function(_0xb2e809){_0x21548d(null,_[_0xf31a('0x47')](_0xb2e809)?![]:!![]);})[_0xf31a('0x13')](function(_0x41f206){logger['error'](_0x41f206);_0x21548d(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x56')]=function(_0x55695a,_0x4558d8){var _0x37b704={'role':'agent'};_0x37b704[_0x55695a]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];var _0x50e484=_0x55695a!='internal'?util['format']('%s/%s@from-sip/n',_0xf31a('0x57'),this[_0xf31a('0x3a')][_0xf31a('0x3c')]):undefined;this[_0xf31a('0xd')][_0xf31a('0x56')](_0x37b704,_0x50e484)[_0xf31a('0x12')](function(_0x560b8d){_0x4558d8(null,_[_0xf31a('0x47')](_0x560b8d)?![]:!![]);})[_0xf31a('0x13')](function(_0x12e5a1){logger[_0xf31a('0x2c')](_0x12e5a1);_0x4558d8(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x58')]=function(_0x12dca4,_0x2bcc4f){sh[_0xf31a('0x59')](_['trim'](_0x12dca4),function(_0x7e978c,_0x53b8e0){var _0x293e14=_0x53b8e0[_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'');_0x2bcc4f(null,_0x293e14);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5e7abf,_0x81361f){scripts['googleCloudTTS'](_0x5e7abf[_0xf31a('0x5b')],_0x5e7abf[_0xf31a('0x5c')]||'text',_0x5e7abf[_0xf31a('0x5d')],_0x5e7abf[_0xf31a('0x5e')]||'en-US',_0x5e7abf['ssmlGender']||_0xf31a('0x5f'),_0x5e7abf['audioEncoding']||_0xf31a('0x60'))[_0xf31a('0x12')](function(_0x4eab0e){_0x81361f(null,_0x4eab0e);})['catch'](function(_0x3fc2bb){_0x81361f(_0x3fc2bb);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x61')]=function(_0x5787e8,_0x49986e){scripts['googleTTS'](_0x5787e8[_0xf31a('0x5d')],_0x5787e8['google_tts_language']||'en',0x1)['then'](function(_0x49435b){_0x49986e(null,_0x49435b);})[_0xf31a('0x13')](function(_0x48de0c){_0x49986e(_0x48de0c);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x62')]=function(_0x38e3c7,_0x22bb77){var _0x4452a6={'uri':_0x38e3c7[_0xf31a('0x63')],'method':_0x38e3c7[_0xf31a('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x38e3c7[_0xf31a('0x65')])===_0xf31a('0x66')&&parseInt(_0x38e3c7[_0xf31a('0x65')])>=0x1?parseInt(_0x38e3c7[_0xf31a('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xf31a('0x67'),'PUT'],_0x4452a6['method'][_0xf31a('0x68')]())){try{_0x4452a6[_0xf31a('0x69')]=_0x38e3c7[_0xf31a('0xa')]?JSON[_0xf31a('0x6a')](_0x38e3c7[_0xf31a('0xa')]):{};}catch(_0x2b3019){logger[_0xf31a('0x2c')](_0xf31a('0x6b'),_0x2b3019);}}try{_0x4452a6['headers']=_0x38e3c7[_0xf31a('0x9')]?JSON[_0xf31a('0x6a')](_0x38e3c7[_0xf31a('0x9')]):{};}catch(_0x4933e0){logger[_0xf31a('0x2c')](_0xf31a('0x6c'),_0x4933e0);}if(_0x38e3c7['computedVariables']){try{var _0x31b51a=require(_0x38e3c7[_0xf31a('0x6d')])[_0xf31a('0x6e')](this,_0x4452a6);_0x4452a6[_0xf31a('0x6f')]=Mustache[_0xf31a('0x70')](_0x38e3c7[_0xf31a('0x63')],_0x31b51a,{},['$$','$$']);if(_0x4452a6['headers']){_0x4452a6[_0xf31a('0x71')]=JSON[_0xf31a('0x6a')](Mustache[_0xf31a('0x70')](JSON[_0xf31a('0x72')](_0x4452a6['headers']),_0x31b51a,{},['$$','$$']));}if(_0x4452a6['body']){_0x4452a6[_0xf31a('0x69')]=JSON[_0xf31a('0x6a')](Mustache[_0xf31a('0x70')](JSON[_0xf31a('0x72')](_0x4452a6[_0xf31a('0x69')]),_0x31b51a,{},['$$','$$']));}}catch(_0x3a772d){logger['error'](_0xf31a('0x73'),_0x3a772d);}}rp(_0x4452a6)[_0xf31a('0x12')](function(_0x1fd44e){var _0xba3819={'statusCode':_0x1fd44e[_0xf31a('0x74')]||0xc8,'statusMessage':_0x1fd44e[_0xf31a('0x75')]||'OK','headers':_0x1fd44e[_0xf31a('0x71')]||{},'body':_0x1fd44e[_0xf31a('0x69')]||{}};_0x22bb77(null,_0xba3819);})['catch'](function(_0x583d4a){var _0x55a76e={'statusCode':_0x583d4a[_0xf31a('0x74')]||0x1f4,'statusMessage':_0x583d4a[_0xf31a('0x76')]||_0xf31a('0x77'),'headers':_0x583d4a['options'][_0xf31a('0x71')]||{},'body':_0x583d4a[_0xf31a('0x78')][_0xf31a('0x69')]||{}};_0x22bb77(null,_0x55a76e);});};AGIVertices[_0xf31a('0xf')]['googleDialogflow']=function(_0x573fbd,_0x381d42){scripts['googleDialogflow'](this[_0xf31a('0x3a')]['uniqueid'],_0x573fbd[_0xf31a('0x79')],_0x573fbd[_0xf31a('0x5d')],_0x573fbd[_0xf31a('0x7a')]||'en')[_0xf31a('0x12')](function(_0xd21867){_0x381d42(null,_0xd21867);})['catch'](function(_0x351733){_0x381d42(_0x351733);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x7b')]=function(_0x50bbba,_0x1fdb59){scripts[_0xf31a('0x7b')](this[_0xf31a('0x3a')]['uniqueid'],_0x50bbba[_0xf31a('0x7c')],_0x50bbba[_0xf31a('0x7d')],_0x50bbba[_0xf31a('0x7e')],_0x50bbba[_0xf31a('0x5d')],_0x50bbba['dialogflowV2_language']||'en')[_0xf31a('0x12')](function(_0x31b6ee){_0x1fdb59(null,_0x31b6ee);})['catch'](function(_0x512855){_0x1fdb59(_0x512855);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x7f')]=function(_0x5515e6,_0x1b5c7e){scripts['sestekNDA'](this[_0xf31a('0x3a')],_0x5515e6)[_0xf31a('0x12')](function(_0x3bf3f4){_0x1b5c7e(null,_0x3bf3f4);})['catch'](function(_0x3c7519){_0x1b5c7e(_0x3c7519);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x80')]=function(_0xbf3985,_0x1b28c5){scripts[_0xf31a('0x80')](_0xbf3985[_0xf31a('0x79')],_0xbf3985['text'],_0xbf3985['ispeech_tts_language']||'en-US',_0xbf3985[_0xf31a('0x81')])[_0xf31a('0x12')](function(_0x2bba06){_0x1b28c5(null,_0x2bba06);})[_0xf31a('0x13')](function(_0x360baf){_0x1b28c5(_0x360baf);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x82')]=function(_0xe178c3,_0x163780,_0x4bd014){scripts[_0xf31a('0x82')](_0x163780,_0xe178c3[_0xf31a('0x79')],_0xe178c3[_0xf31a('0x83')]||_0xf31a('0x84'),this[_0xf31a('0x85')](_0xe178c3[_0xf31a('0x86')])?_0xe178c3[_0xf31a('0x86')]:undefined)[_0xf31a('0x12')](function(_0x168ebe){_0x4bd014(null,_0x168ebe);})[_0xf31a('0x13')](function(_0x394a38){_0x4bd014(_0x394a38);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x87')]=function(_0x4e3223,_0x3849d9){scripts[_0xf31a('0x87')](_0x4e3223['aws_access_key_id'],_0x4e3223[_0xf31a('0x88')],_0x4e3223[_0xf31a('0x89')],_0x4e3223[_0xf31a('0x8a')]||_0xf31a('0x8b'),_0x4e3223['text'],_0x4e3223['aws_text_type']||_0xf31a('0x5d'))[_0xf31a('0x12')](function(_0x11d390){_0x3849d9(null,_0x11d390);})[_0xf31a('0x13')](function(_0x4ea997){_0x3849d9(_0x4ea997);});};AGIVertices['prototype']['awsLex']=function(_0x5815f3,_0x46d39a){scripts[_0xf31a('0x8c')](this[_0xf31a('0x3a')][_0xf31a('0x37')],_0x5815f3[_0xf31a('0x8d')],_0x5815f3[_0xf31a('0x88')],_0x5815f3[_0xf31a('0x8e')],_0x5815f3[_0xf31a('0x5d')],_0x5815f3[_0xf31a('0x8f')])[_0xf31a('0x12')](function(_0x17183b){_0x46d39a(null,_0x17183b);})[_0xf31a('0x13')](function(_0x109b70){_0x46d39a(_0x109b70);});};AGIVertices['prototype'][_0xf31a('0x90')]=function(_0x1452e0,_0x4a3959,_0x4c79bd){scripts['googleASR'](_0x4a3959,_0x1452e0[_0xf31a('0x79')],_0x1452e0[_0xf31a('0x91')]||'en-US')[_0xf31a('0x12')](function(_0x524d15){_0x4c79bd(null,_0x524d15);})[_0xf31a('0x13')](function(_0x41a9f9){_0x4c79bd(_0x41a9f9);});};AGIVertices[_0xf31a('0xf')]['tildeASR']=function(_0x1b7365,_0x2f00d0,_0x43015d){scripts['tildeASR'](_0x2f00d0,_0x1b7365[_0xf31a('0x92')],_0x1b7365[_0xf31a('0x93')],_0x1b7365['uri'])[_0xf31a('0x12')](function(_0x9b47e5){_0x43015d(null,_0x9b47e5);})[_0xf31a('0x13')](function(_0x5c0ce2){_0x43015d(_0x5c0ce2);});};AGIVertices['prototype'][_0xf31a('0x94')]=function(_0x5a6036){var _0x26dcc3=_[_0xf31a('0x95')](verticesWithRetry,_0x5a6036['agicommand'])?_0x5a6036:_[_0xf31a('0x96')](_0x5a6036);for(var _0x44e8dc in _0x26dcc3){if(_0x26dcc3[_0xf31a('0x97')](_0x44e8dc)){if(_0x26dcc3[_0x44e8dc]&&_['isString'](_0x26dcc3[_0x44e8dc])){if(_['includes'](recursiveMapAttributes,_0x44e8dc)){_0x26dcc3[_0x44e8dc]=this[_0xf31a('0x98')](_0x26dcc3[_0x44e8dc]);}else{_0x26dcc3[_0x44e8dc]=this['replaceAllVariables'](_0x26dcc3[_0x44e8dc]);}}}}return _0x26dcc3;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x99')]=function(_0x48c0f6){for(var _0x340d5a in _0x48c0f6){if(_0x48c0f6[_0xf31a('0x97')](_0x340d5a)){if(_[_0xf31a('0x9a')](_0x48c0f6[_0x340d5a])){this[_0xf31a('0x99')](_0x48c0f6[_0x340d5a]);}else if(_[_0xf31a('0x9b')](_0x48c0f6[_0x340d5a])){for(var _0x24de43=0x0;_0x24de43<_0x48c0f6[_0x340d5a][_0xf31a('0x9c')];_0x24de43++){this[_0xf31a('0x99')](_0x48c0f6[_0x340d5a][_0x24de43]);}}else if(_['isString'](_0x48c0f6[_0x340d5a])){_0x48c0f6[_0x340d5a]=this[_0xf31a('0x9d')](_0x48c0f6[_0x340d5a]);}}}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x9e')]=function(_0x5ae195,_0x47fa1e){for(var _0x44872a in _0x5ae195){if(_0x5ae195[_0xf31a('0x97')](_0x44872a)){if(_[_0xf31a('0x9a')](_0x5ae195[_0x44872a])){if(!_[_0xf31a('0x46')](_0x5ae195[_0x44872a])){this['saveRestApiResult'](_0x5ae195[_0x44872a],util[_0xf31a('0x29')]('%s.%s',_0x47fa1e,_0x44872a));}}else if(_[_0xf31a('0x9b')](_0x5ae195[_0x44872a])){for(var _0x1b9f29=0x0;_0x1b9f29<_0x5ae195[_0x44872a][_0xf31a('0x9c')];_0x1b9f29++){this[_0xf31a('0x9e')](_0x5ae195[_0x44872a][_0x1b9f29],util['format'](_0xf31a('0x9f'),_0x47fa1e,_0x44872a+'['+_0x1b9f29+']'));}}else{if(!_['isNil'](_0x5ae195[_0x44872a])){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x47fa1e,_0x44872a),_0x5ae195[_0x44872a]);}}}}};AGIVertices[_0xf31a('0xf')]['replaceObjectAllVariables']=function(_0x1a08bb){try{var _0x84220=JSON[_0xf31a('0x6a')](_0x1a08bb);this['recursiveNodeIndex'](_0x84220);return JSON[_0xf31a('0x72')](_0x84220);}catch(_0x1c5fc1){return this[_0xf31a('0x9d')](_0x1a08bb);}};AGIVertices[_0xf31a('0xf')]['replaceAllVariables']=function(_0x2adb41){var _0x2bb68e=_0x2adb41['split']('{');for(var _0x54de42=0x1;_0x54de42<_0x2bb68e['length'];_0x54de42+=0x1){var _0x24f3f2=_0x2bb68e[_0x54de42][_0xf31a('0xa1')]('}');if(_0x24f3f2[_0xf31a('0x9c')]>0x1){_0x2adb41=_0x2adb41[_0xf31a('0xa2')]('{'+_0x24f3f2[0x0]+'}',this[_0xf31a('0x3a')]['getVariable'](_0x24f3f2[0x0])[_0xf31a('0xa3')]||_0x24f3f2[0x0]);}}if(_0x2bb68e[_0xf31a('0x9c')]===0x1){return _0x2adb41[_0xf31a('0x4f')]();}return this['replaceAllVariables'](_0x2adb41);};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa4')]=function(_0x1008c4,_0x109240){var _0x4c6cb0=this['channel']['getVariable'](_0x1008c4);if(_0x4c6cb0[_0xf31a('0xa5')]===-0x1){return _0x4c6cb0;}logger[_0xf31a('0x30')](util['format'](_0xf31a('0xa6'),_0x109240,_0x4c6cb0[_0xf31a('0xa3')]));return this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x109240,_0x4c6cb0['extra']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x85')]=function(_0x15d0bf){return _0x15d0bf&&_0x15d0bf!=='0'&&_0x15d0bf!=='-1'&&_0x15d0bf!=='';};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa7')]=function(_0x15702f){this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x15702f,'-');_0x15702f['retry']=_0x15702f[_0xf31a('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa8')]=function(_0x4a4945){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xa9'),_0x4a4945[_0xf31a('0x38')]));if(!this['isConfigured'](_0x4a4945[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0x5fa7c9='\x22'+_0x4a4945['text']+'\x22';if(this['isConfigured'](_0x4a4945[_0xf31a('0x78')])){_0x5fa7c9+=','+_0x4a4945[_0xf31a('0x78')];}var _0x3a5582=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0x5fa7c9);if(_0x3a5582[_0xf31a('0xa5')]===-0x1){return _0x3a5582;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xad'),_0x5fa7c9));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xae')]=function(_0x15ba20){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xaf'),_0x15ba20[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x15ba20[_0xf31a('0xb0')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xb1'));}var _0x443594=_0x15ba20[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x15ba20[_0xf31a('0x78')])){_0x443594+=','+_0x15ba20['options'];}var _0x31dea5=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xb2'),_0x443594);if(_0x31dea5[_0xf31a('0xa5')]===-0x1){return _0x31dea5;}var _0x32837f=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xf31a('0xb3'));if(_0x32837f[_0xf31a('0xa5')]===-0x1){return _0x32837f;}var _0x589f59=this[_0xf31a('0xa4')](_0xf31a('0xb4'),_0xf31a('0xb5'));if(_0x589f59[_0xf31a('0xa5')]===-0x1){return _0x589f59;}var _0x537cf9=this[_0xf31a('0xa4')](_0xf31a('0xb6'),_0xf31a('0xb7'));if(_0x537cf9[_0xf31a('0xa5')]===-0x1){return _0x537cf9;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x443594));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x6')]=function(_0xa357eb){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xb9'),_0xa357eb['label']));return this['channel'][_0xf31a('0x6')]([_0xa357eb['command'],_0xa357eb['args']]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0xba')]=function(_0x179f62){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbb'),_0x179f62['label']));if(this[_0xf31a('0x85')](_0x179f62['timeout'])){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbc'),_0x179f62[_0xf31a('0x65')]));var _0x3637c2=this['channel'][_0xf31a('0xbd')](_0x179f62[_0xf31a('0x65')]);if(_0x3637c2[_0xf31a('0xa5')]===-0x1){return _0x3637c2;}}return this[_0xf31a('0x3a')][_0xf31a('0xba')]();};AGIVertices['prototype'][_0xf31a('0xbe')]=function(_0x8cce99){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbf'),_0x8cce99[_0xf31a('0x38')]));if(!this['isConfigured'](_0x8cce99['list_id'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x8cce99,'no\x20list\x20selected');}_0x8cce99[_0xf31a('0x4d')]=moment();if(this[_0xf31a('0x85')](_0x8cce99[_0xf31a('0xc0')])){_0x8cce99[_0xf31a('0x4d')]=moment()[_0xf31a('0xc1')](_0x8cce99['delay'],_0xf31a('0xc2'));}if(!this['isConfigured'](_0x8cce99[_0xf31a('0x50')])){_0x8cce99[_0xf31a('0x50')]=0x2;}this['createCmContact'][_0xf31a('0x6e')](this,_0x8cce99);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xc3'),_0x8cce99[_0xf31a('0x4b')],_0x8cce99['list_id'],_0x8cce99[_0xf31a('0x4d')]));};AGIVertices['prototype']['custom_app']=function(_0x3c8549){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xc4'),_0x3c8549[_0xf31a('0x38')]));var _0x89fcd4=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0x3c8549['application'],_0x3c8549['options']);if(_0x89fcd4[_0xf31a('0xa5')]===-0x1){return _0x89fcd4;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xc5'),_0x3c8549[_0xf31a('0xc6')],_0x3c8549[_0xf31a('0x78')]));};AGIVertices[_0xf31a('0xf')]['lumenvoxtts']=function(_0x476865){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xc7'),_0x476865[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x476865[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0xc49c9f='\x22'+_0x476865['text']+'\x22';if(this[_0xf31a('0x85')](_0x476865['options'])){_0xc49c9f+=','+_0x476865[_0xf31a('0x78')];}var _0x246d4f=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0xc49c9f);if(_0x246d4f[_0xf31a('0xa5')]===-0x1){return _0x246d4f;}return this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0xad'),_0xc49c9f));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xc8')]=function(_0x519b33){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xc9'),_0x519b33['label']));if(!this['isConfigured'](_0x519b33['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0x17e99c='\x22'+_0x519b33[_0xf31a('0x5d')]+'\x22';if(this[_0xf31a('0x85')](_0x519b33[_0xf31a('0x78')])){_0x17e99c+=','+_0x519b33[_0xf31a('0x78')];}var _0x5d833a=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0x17e99c);if(_0x5d833a['result']===-0x1){return _0x5d833a;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xad'),_0x17e99c));};AGIVertices[_0xf31a('0xf')]['lumenvoxasr']=function(_0x45fac1){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x45fac1[_0xf31a('0x38')]));if(!this['isConfigured'](_0x45fac1[_0xf31a('0xb0')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xb1'));}var _0x742459=_0x45fac1[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x45fac1[_0xf31a('0x78')])){_0x742459+=','+_0x45fac1[_0xf31a('0x78')];}var _0x4bfd2f=this['channel'][_0xf31a('0x59')](_0xf31a('0xb2'),_0x742459);if(_0x4bfd2f[_0xf31a('0xa5')]===-0x1){return _0x4bfd2f;}var _0x111e1c=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xf31a('0xca'));if(_0x111e1c[_0xf31a('0xa5')]===-0x1){return _0x111e1c;}var _0x4ad44e=this['getAndSetVariable'](_0xf31a('0xb4'),_0xf31a('0xcb'));if(_0x4ad44e['result']===-0x1){return _0x4ad44e;}var _0x5853a2=this[_0xf31a('0xa4')](_0xf31a('0xb6'),_0xf31a('0xcc'));if(_0x5853a2[_0xf31a('0xa5')]===-0x1){return _0x5853a2;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x742459));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xcd')]=function(_0x220e22){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xce'),_0x220e22[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x220e22['grammar'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xb1'));}var _0x18fd3a=_0x220e22[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x220e22[_0xf31a('0x78')])){_0x18fd3a+=','+_0x220e22['options'];}var _0x4dfd79=this['channel'][_0xf31a('0x59')](_0xf31a('0xb2'),_0x18fd3a);if(_0x4dfd79[_0xf31a('0xa5')]===-0x1){return _0x4dfd79;}var _0x4d7636=this[_0xf31a('0xa4')](_0xf31a('0xcf'),_0xf31a('0xd0'));if(_0x4d7636[_0xf31a('0xa5')]===-0x1){return _0x4d7636;}var _0x41a050=this[_0xf31a('0xa4')](_0xf31a('0xb4'),_0xf31a('0xd1'));if(_0x41a050[_0xf31a('0xa5')]===-0x1){return _0x41a050;}var _0x3b5e73=this[_0xf31a('0xa4')](_0xf31a('0xb6'),'SESTEK_ASR_INSTANCE');if(_0x3b5e73[_0xf31a('0xa5')]===-0x1){return _0x3b5e73;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x18fd3a));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xd2')]=function(_0x464b28){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x464b28[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x464b28['odbc_id'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd3'));}var _0xb6a6bf=this[_0xf31a('0x18')][_0xf31a('0x6e')](this,_0x464b28[_0xf31a('0xd4')]);if(!_0xb6a6bf){return this['channel']['error'](_0x464b28,_0xf31a('0xd5'));}if(!this[_0xf31a('0x85')](_0x464b28['query'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd6'));}var _0x4b5097=_0x464b28['query'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xd7'),_0x4b5097));var _0x5a2e07=this[_0xf31a('0x2a')][_0xf31a('0x6e')](this,_0xb6a6bf,_0x4b5097);this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x464b28,_0x4b5097);if(!this['isConfigured'](_0x464b28[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18ffef=this[_0xf31a('0x10')]['sync'](this,_0x464b28['variable_id']);if(!_0x18ffef){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd9'));}var _0xee640c=this;_0x5a2e07['forEach'](function(_0xaa6e9c,_0x1ab500){Object[_0xf31a('0xda')](_0xaa6e9c)[_0xf31a('0xdb')](function(_0x446a40){_0xee640c['channel'][_0xf31a('0xa0')](util['format'](_0xf31a('0xdc'),_0x18ffef,_0x1ab500,_0x446a40),_0xaa6e9c[_0x446a40]);});});this['channel'][_0xf31a('0xa0')](util['format'](_0xf31a('0xdd'),_0x18ffef),_0x5a2e07[_0xf31a('0x9c')]);return this[_0xf31a('0x3a')]['noop'](util['format'](_0xf31a('0xde'),_0x18ffef));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xdf')]=function(_0x46ef98){logger['debug'](util['format'](_0xf31a('0xe0'),_0x46ef98[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x46ef98['sip_id'])){return this['channel'][_0xf31a('0x2c')](_0x46ef98,_0xf31a('0xe1'));}var _0x5a85bd=this['getUser'][_0xf31a('0x6e')](this,_0x46ef98[_0xf31a('0xe2')]);if(!_0x5a85bd){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x46ef98,_0xf31a('0xe3'));}var _0x3665f9=this['channel'][_0xf31a('0x59')](_0xf31a('0xe4'),[util[_0xf31a('0x29')](_0xf31a('0xe5'),_0x5a85bd),_0x46ef98[_0xf31a('0x65')],_0x46ef98[_0xf31a('0xe6')],_0x46ef98[_0xf31a('0x63')]]);if(_0x3665f9[_0xf31a('0xa5')]===-0x1){return _0x3665f9;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xe7'),_0xf31a('0xe4')));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xe8')]=function(_0x485b7e){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xe9'),_0x485b7e[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x485b7e[_0xf31a('0x79')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xea'));}if(!this['isConfigured'](_0x485b7e[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this[_0xf31a('0x3a')][_0xf31a('0xeb')]=!![];this['createSquareDetailsReport'](_0x485b7e);this[_0xf31a('0x44')](_0x485b7e[_0xf31a('0x5d')],'in','','');this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xec'),_0x485b7e[_0xf31a('0x5d')]));var _0x29e6ef=this['googleDialogflow'][_0xf31a('0x6e')](this,_0x485b7e);if(_0x29e6ef){for(var _0x3cb272 in _0x29e6ef){if(_0x29e6ef[_0xf31a('0x97')](_0x3cb272)){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0xed'),_0x3cb272[_0xf31a('0x68')]()),_0x29e6ef[_0x3cb272]);}}this[_0xf31a('0x44')](_0x29e6ef[_0xf31a('0xee')],'out',_0xf31a('0xe8'),'');return this[_0xf31a('0x3a')]['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x29e6ef[_0xf31a('0xee')]));}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x485b7e,_0xf31a('0xef'));};AGIVertices[_0xf31a('0xf')]['dialogflowV2']=function(_0x299697){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x299697[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x7c')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xf0'));}if(!this[_0xf31a('0x85')](_0x299697['client_email'])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xf1'));}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x7e')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xf2'));}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0xf3')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20anguage\x20configured');}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x5d')])){return this['channel']['noop'](_0xf31a('0xab'));}this['channel']['bot']=!![];this[_0xf31a('0x36')](_0x299697);this[_0xf31a('0x44')](_0x299697[_0xf31a('0x5d')],'in','','');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xf4'),_0x299697[_0xf31a('0x5d')]));var _0x4cabb4=this['googleDialogflowV2'][_0xf31a('0x6e')](this,_0x299697);if(_0x4cabb4){for(var _0x3dcfad in _0x4cabb4){if(_0x4cabb4[_0xf31a('0x97')](_0x3dcfad)){if(_0x3dcfad!=='providerResponse'){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')]('DIALOGFLOW_%s',_0x3dcfad[_0xf31a('0x68')]()),_0x4cabb4[_0x3dcfad]);}}}this['createSquareMessage'](_0x4cabb4[_0xf31a('0xee')],_0xf31a('0xf5'),_0xf31a('0xf6'),_0x4cabb4['providerResponse']);return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')]('DialogflowV2\x20Result\x20%s',_0x4cabb4['speech']));}return this[_0xf31a('0x3a')]['error'](_0x299697,_0xf31a('0xf7'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xf8')]=function(_0x5bcf58){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xf9'),_0x5bcf58[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfa')])){return this['channel'][_0xf31a('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfb')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xfc'));}if(!this['isConfigured'](_0x5bcf58['password'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xfd'));}if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfe')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}this[_0xf31a('0x3a')][_0xf31a('0xeb')]=!![];this[_0xf31a('0x36')](_0x5bcf58);this[_0xf31a('0x44')](_0x5bcf58['text'],'in','','');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xff'),_0x5bcf58['text']));var _0x459b01=this['sestekNDA'][_0xf31a('0x6e')](this,_0x5bcf58);if(_0x459b01){for(var _0x4a9818 in _0x459b01){if(_0x459b01[_0xf31a('0x97')](_0x4a9818)){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x100'),_0x4a9818[_0xf31a('0x68')]()),_0x459b01[_0x4a9818]);}}this[_0xf31a('0x44')](_0x459b01['speech'],'out','sesteknda','');if(_0x459b01[_0xf31a('0x101')]){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x102'),_0x459b01[_0xf31a('0x101')]));var _0x194566=this[_0xf31a('0x3a')][_0xf31a('0x103')](_0x459b01[_0xf31a('0x101')]);try{fs['unlink'](_0x459b01[_0xf31a('0x101')]+_0xf31a('0x104'));}catch(_0x587685){logger['error'](_0x587685);}return _0x194566;}else{return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('SestekNDA\x20Result\x20%s',_0x459b01[_0xf31a('0xee')]));}}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x5bcf58,_0xf31a('0x105'));};AGIVertices[_0xf31a('0xf')]['end']=function(_0x102b28){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x106'),_0x102b28[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x107'));};AGIVertices[_0xf31a('0xf')]['ext_dial']=function(_0x53ea86){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x108'),_0x53ea86[_0xf31a('0x38')]));var _0x225b0b='';if(_0x53ea86['trunk_id']){if(!this[_0xf31a('0x85')](_0x53ea86[_0xf31a('0x109')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x53ea86,_0xf31a('0x10a'));}else{var _0x3a5b8e=parseInt(_0x53ea86['trunk_id'],0xa);if(isNaN(_0x3a5b8e)){_0x225b0b=_0x53ea86[_0xf31a('0x109')];}else{_0x225b0b=this[_0xf31a('0x1a')][_0xf31a('0x6e')](this,_0x53ea86[_0xf31a('0x109')]);if(!_0x225b0b){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x53ea86,_0xf31a('0x10b'));}}}}else if(_0x53ea86['trunk_name']){_0x225b0b=_0x53ea86[_0xf31a('0x10c')];}else{return this[_0xf31a('0x3a')]['error'](_0x53ea86,_0xf31a('0x10a'));}var _0x28a62b=this['channel']['exec'](_0xf31a('0xe4'),[util[_0xf31a('0x29')](_0xf31a('0x10d'),_0x225b0b,_0x53ea86['phone']),_0x53ea86[_0xf31a('0x65')],_0x53ea86['opts'],_0x53ea86[_0xf31a('0x63')]]);if(_0x28a62b[_0xf31a('0xa5')]===-0x1){return _0x28a62b;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xe7'),_0xf31a('0xe4')));};AGIVertices['prototype']['finally']=function(_0x34693f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x10e'),_0x34693f['label']));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x10f'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x110')]=function(_0x24e01e){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x111'),_0x24e01e[_0xf31a('0x38')]));if(_0x24e01e[_0xf31a('0x112')]===0x0){return this[_0xf31a('0xa7')](_0x24e01e);}_0x24e01e[_0xf31a('0x112')]-=0x1;if(!this[_0xf31a('0x85')](_0x24e01e[_0xf31a('0x113')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x24e01e,_0xf31a('0x114'));}var _0x1735fa=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x24e01e[_0xf31a('0x113')]);if(!_0x1735fa){return this[_0xf31a('0x3a')]['error'](_0x24e01e,_0xf31a('0x115'));}if(!this[_0xf31a('0x85')](_0x24e01e['variable_id'])){return this['channel'][_0xf31a('0x2c')](_0xf31a('0x116'));}var _0x3563aa=this[_0xf31a('0x3a')][_0xf31a('0x117')](_0x1735fa,_0x24e01e[_0xf31a('0x118')],_0x24e01e[_0xf31a('0x119')]);var _0x4a79c6=_0x3563aa['result']?_0x3563aa[_0xf31a('0xa5')][_0xf31a('0x4f')]():'';logger[_0xf31a('0x30')](_0xf31a('0x11a'),JSON[_0xf31a('0x72')](_0x3563aa));if(_0x3563aa[_0xf31a('0xa5')]===-0x1){this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x4a79c6);return _0x3563aa;}else if(_0x3563aa[_0xf31a('0xa3')]===_0xf31a('0x65')){_0x3563aa[_0xf31a('0xa5')]=_0x4a79c6['length']>=parseInt(_0x24e01e[_0xf31a('0x11b')])?'x':'i';}else{_0x3563aa[_0xf31a('0xa5')]=_0x4a79c6['length']>=parseInt(_0x24e01e[_0xf31a('0x11b')])&&_0x4a79c6[_0xf31a('0x9c')]<=parseInt(_0x24e01e[_0xf31a('0x119')])?'x':'i';}var _0x4191bf=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x24e01e[_0xf31a('0xd8')]);if(!_0x4191bf){return this['channel'][_0xf31a('0x2c')](_0x24e01e,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x4191bf,_0x4a79c6);if(this[_0xf31a('0x85')](_0x24e01e[_0xf31a('0x11c')])){var _0x6f634f=parseInt(_0x24e01e[_0xf31a('0x11c')],0xa);var _0x43eff1=rs[_0xf31a('0x11d')]({'charset':'*','length':_0x6f634f});var _0x28b525=_0x4a79c6[_0xf31a('0x9c')];if(_0x28b525>0x0){if(_0x28b525>_0x6f634f){this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x24e01e[_0xf31a('0x11e')]===_0xf31a('0x11f')?_0x43eff1+_0x4a79c6[_0xf31a('0x120')](_0x6f634f):_0x4a79c6['substr'](0x0,_0x28b525-_0x6f634f)+_0x43eff1);}else{this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x24e01e,rs[_0xf31a('0x11d')]({'charset':'*','length':_0x28b525}));}}else{this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x24e01e,'');}}else{this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x4a79c6);}return _0x3563aa;};AGIVertices[_0xf31a('0xf')][_0xf31a('0xc')]=function(_0x46adac){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x46adac[_0xf31a('0x38')]));return this['getdigits'](_0x46adac);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x121')]=function(_0x3fc459){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x122'),_0x3fc459[_0xf31a('0x38')]));this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x3fc459,_0x3fc459[_0xf31a('0x123')]);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x124'),_0x3fc459[_0xf31a('0x123')]));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x125')]=function(_0x3a5748){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x126'),_0x3a5748[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x3a5748['aws_access_key_id'])||!this['isConfigured'](_0x3a5748[_0xf31a('0x88')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x127'));}if(!this[_0xf31a('0x85')](_0x3a5748[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Trying\x20aws\x20Polly\x20%s',_0x3a5748['text']));var _0x1381b7=this[_0xf31a('0x87')][_0xf31a('0x6e')](this,_0x3a5748);if(_0x1381b7){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x1381b7));var _0x3165a3=this['channel'][_0xf31a('0x103')](_0x1381b7);try{fs[_0xf31a('0x128')](_0x1381b7+_0xf31a('0x104'));}catch(_0x4db0ca){logger[_0xf31a('0x2c')](_0x4db0ca);}return _0x3165a3;}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x3a5748,_0xf31a('0x129'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x12a')]=function(_0x67e4c8){logger['info'](util['format'](_0xf31a('0x12b'),_0x67e4c8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x8d')])||!this['isConfigured'](_0x67e4c8[_0xf31a('0x88')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0x127'));}if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x8f')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x12c'));}if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this['channel'][_0xf31a('0xeb')]=!![];this[_0xf31a('0x36')](_0x67e4c8);this[_0xf31a('0x44')](_0x67e4c8[_0xf31a('0x5d')],'in','','');this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x67e4c8[_0xf31a('0x5d')]));var _0x531ad4=this['awsLex'][_0xf31a('0x6e')](this,_0x67e4c8);if(_0x531ad4){for(var _0x50bb77 in _0x531ad4){if(_0x531ad4[_0xf31a('0x97')](_0x50bb77)&&_['isString'](_0x531ad4[_0x50bb77])){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x12d'),_0x50bb77[_0xf31a('0x68')]()),_0x531ad4[_0x50bb77]);}}if(_[_0xf31a('0x47')](_0x531ad4[_0xf31a('0x76')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x12e'));}else{this[_0xf31a('0x44')](_0x531ad4[_0xf31a('0x76')],_0xf31a('0xf5'),_0xf31a('0x12f'),'');return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x531ad4[_0xf31a('0x76')]));}}return this[_0xf31a('0x3a')]['error'](_0x67e4c8,_0xf31a('0x130'));};AGIVertices[_0xf31a('0xf')]['googleasr']=function(_0x886812){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x131'),_0x886812['label'],_0x886812['timeout']));if(!this[_0xf31a('0x85')](_0x886812[_0xf31a('0x79')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xea'));}var _0x84479f=_0xf31a('0x132');var _0x1dc508=util['format'](_0xf31a('0x133'),FILES_PATH,rs[_0xf31a('0x11d')](0x4));var _0x129676=util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x1dc508,_0x84479f);var _0x8ea211=!![];if(_0x886812['beep']===_0xf31a('0x134')){_0x8ea211=![];}var _0x3f15c0=this[_0xf31a('0x3a')]['recordFile'](_0x1dc508,_0x84479f,_0x886812[_0xf31a('0x135')],_0x886812[_0xf31a('0x65')],undefined,_0x8ea211);if(_0x3f15c0[_0xf31a('0xa5')]!==-0x1){this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x136'),_0x129676));var _0xf62ad7=this[_0xf31a('0x90')]['sync'](this,_0x886812,_0x129676);if(_0xf62ad7){for(var _0x511a35 in _0xf62ad7){if(_0xf62ad7[_0xf31a('0x97')](_0x511a35)){this['channel']['setVariable'](util[_0xf31a('0x29')](_0xf31a('0x137'),_0x511a35[_0xf31a('0x68')]()),_0xf62ad7[_0x511a35]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x138'),JSON['stringify'](_0xf62ad7)));}}return _0x3f15c0;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x139')]=function(_0x5512ca){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x13a'),_0x5512ca['label']));if(!this['isConfigured'](_0x5512ca[_0xf31a('0x92')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x13b'));}if(!this['isConfigured'](_0x5512ca[_0xf31a('0x93')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x13c'));}var _0xf9267b=_0xf31a('0x132');var _0xb9e2b3=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,rs['generate'](0x4));var _0x3a2b4f=util[_0xf31a('0x29')]('%s.%s',_0xb9e2b3,_0xf9267b);var _0x5e2c5b=!![];if(_0x5512ca['beep']===_0xf31a('0x134')){_0x5e2c5b=![];}var _0x215363=this[_0xf31a('0x3a')][_0xf31a('0x13d')](_0xb9e2b3,_0xf9267b,_0x5512ca[_0xf31a('0x135')],_0x5512ca['timeout'],undefined,_0x5e2c5b);if(_0x215363[_0xf31a('0xa5')]!==-0x1){this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x13e'),_0x3a2b4f));var _0x2fd020=this[_0xf31a('0x13f')][_0xf31a('0x6e')](this,_0x5512ca,_0x3a2b4f);if(_0x2fd020){for(var _0x2f0da1 in _0x2fd020){if(_0x2fd020[_0xf31a('0x97')](_0x2f0da1)){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x140'),_0x2f0da1['toUpperCase']()),_0x2fd020[_0x2f0da1]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x141'),JSON[_0xf31a('0x72')](_0x2fd020)));}}return _0x215363;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x142')]=function(_0x58e32b){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x143'),_0x58e32b['label']));return this[_0xf31a('0x3a')][_0xf31a('0x144')](_0x58e32b[_0xf31a('0x3f')],_0x58e32b[_0xf31a('0x40')],_0x58e32b[_0xf31a('0x41')]);};AGIVertices['prototype']['gotoif']=function(_0xffbaf5){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x145'),_0xffbaf5[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0xffbaf5[_0xf31a('0x146')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0xffbaf5,'no\x20condition\x20configured');}try{var _0x26f96e=eval(_0xffbaf5[_0xf31a('0x146')])?_0xf31a('0x147'):_0xf31a('0x148');this['channel'][_0xf31a('0xaa')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0xffbaf5['condition'],_0x26f96e));return{'code':0xc8,'result':_0x26f96e};}catch(_0x28adf3){return{'code':0xc8,'result':_0xf31a('0x148')};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x149')]=function(_0x21be35){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x14a'),_0x21be35[_0xf31a('0x38')]));if(!this['isConfigured'](_0x21be35[_0xf31a('0x14b')])){return this[_0xf31a('0x3a')]['error'](_0x21be35,'no\x20interval\x20configured');}var _0x3307c8=this['getIntervals'][_0xf31a('0x6e')](this,_0x21be35['interval_id']);if(!_0x3307c8){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x21be35,_0xf31a('0x14c'));}for(var _0x30fa6b=0x0;_0x30fa6b<_0x3307c8[_0xf31a('0x9c')];_0x30fa6b+=0x1){var _0x272237=this[_0xf31a('0x3a')][_0xf31a('0x10')](util[_0xf31a('0x29')](_0xf31a('0x14d'),_0x3307c8[_0x30fa6b]));if(_0x272237[_0xf31a('0xa5')]===-0x1){return _0x272237;}logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0x272237['extra']));if(_0x272237[_0xf31a('0xa3')]===_0xf31a('0x147')){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('IFTIME\x20%s\x20%s',_0x3307c8[_0x30fa6b],_0xf31a('0x147')));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x147')));return{'code':0xc8,'result':_0xf31a('0x147')};}else{logger['info'](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x148')));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x148')));}}return{'code':0xc8,'result':_0xf31a('0x148')};};AGIVertices[_0xf31a('0xf')][_0xf31a('0x14f')]=function(_0x5c1261){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x150'),_0x5c1261[_0xf31a('0x38')]));return this[_0xf31a('0x3a')]['hangup']();};AGIVertices[_0xf31a('0xf')]['ispeechasr']=function(_0x2051b8){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x151'),_0x2051b8['label']));if(!this[_0xf31a('0x85')](_0x2051b8[_0xf31a('0x79')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xea'));}var _0xb15a4=_0xf31a('0x132');var _0x40350d=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,rs[_0xf31a('0x11d')](0x4));var _0x183cad=util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x40350d,_0xb15a4);var _0x5d710d=!![];if(_0x2051b8[_0xf31a('0x152')]===_0xf31a('0x134')){_0x5d710d=![];}var _0x490c16=this[_0xf31a('0x3a')][_0xf31a('0x13d')](_0x40350d,_0xb15a4,_0x2051b8[_0xf31a('0x135')],_0x2051b8[_0xf31a('0x65')],undefined,_0x5d710d);if(_0x490c16[_0xf31a('0xa5')]!==-0x1){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x153'),_0x183cad));var _0x29b2f3=this[_0xf31a('0x82')]['sync'](this,_0x2051b8,_0x183cad);if(_0x29b2f3){for(var _0x36c8e7 in _0x29b2f3){if(_0x29b2f3[_0xf31a('0x97')](_0x36c8e7)){this[_0xf31a('0x3a')]['setVariable'](util['format'](_0xf31a('0x154'),_0x36c8e7['toUpperCase']()),_0x29b2f3[_0x36c8e7]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x155'),JSON['stringify'](_0x29b2f3)));}}return _0x490c16;};AGIVertices['prototype'][_0xf31a('0x156')]=function(_0x3cfe88){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3cfe88[_0xf31a('0x38')]));if(!this['isConfigured'](_0x3cfe88[_0xf31a('0x79')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xea'));}if(!this[_0xf31a('0x85')](_0x3cfe88['text'])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this['channel'][_0xf31a('0xaa')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x3cfe88[_0xf31a('0x5d')]));var _0x3119c8=this['ispeechTTS'][_0xf31a('0x6e')](this,_0x3cfe88);if(_0x3119c8){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x153'),_0x3119c8));var _0x28ab2b=this[_0xf31a('0x3a')]['streamFile'](_0x3119c8,_0x3cfe88[_0xf31a('0x135')]);try{fs[_0xf31a('0x128')](_0x3119c8+'.wav');}catch(_0x10b685){logger[_0xf31a('0x2c')](_0x10b685);}return _0x28ab2b;}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x3cfe88,_0xf31a('0x157'));};AGIVertices['prototype']['login']=function(_0x4d45cc){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x158'),_0x4d45cc[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x4d45cc[_0xf31a('0x159')])){return this[_0xf31a('0x3a')]['error'](_0x4d45cc,_0xf31a('0x15a'));}logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15b'),this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));var _0x50fdac=this['agentLogin'][_0xf31a('0x6e')](this,_0x4d45cc[_0xf31a('0x159')]);if(_0x50fdac){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x15c'),this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));this['channel']['noop'](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4d45cc['findBy']));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15e'),this['channel'][_0xf31a('0x3c')],_0x4d45cc['findBy']));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices[_0xf31a('0xf')]['logout']=function(_0x21f4fa){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x160'),_0x21f4fa[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x21f4fa[_0xf31a('0x159')])){return this[_0xf31a('0x3a')]['error'](_0x21f4fa,_0xf31a('0x15a'));}logger['info'](util[_0xf31a('0x29')](_0xf31a('0x15b'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));var _0x40cba5=this[_0xf31a('0x55')][_0xf31a('0x6e')](this,_0x21f4fa[_0xf31a('0x159')]);if(_0x40cba5){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa['findBy']));this[_0xf31a('0x3a')]['noop'](util['format'](_0xf31a('0x15c'),this['channel'][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15e'),this['channel'][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa['findBy']));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x161')]=function(_0x1558f3){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x162'),_0x1558f3[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x1558f3[_0xf31a('0x163')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x1558f3,_0xf31a('0x164'));}this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x165'),_0x1558f3[_0xf31a('0x163')]));var _0x2cb546=eval(_0x1558f3[_0xf31a('0x163')]);if(!this['isConfigured'](_0x1558f3[_0xf31a('0xd8')])){return this['channel'][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x19e610=this['getVariable'][_0xf31a('0x6e')](this,_0x1558f3[_0xf31a('0xd8')]);if(!_0x19e610){return this[_0xf31a('0x3a')]['error'](_0x1558f3,_0xf31a('0xd9'));}if(_[_0xf31a('0x9b')](_0x2cb546)){var _0x2ef83a=this;_0x2cb546['forEach'](function(_0x459ca3,_0x410a61){_0x2ef83a[_0xf31a('0x3a')][_0xf31a('0xa0')](util['format']('%s[%s]',_0x19e610,_0x410a61),_0x459ca3);});return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x166'),_0x19e610));}else{return this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x19e610,_0x2cb546);}};AGIVertices['prototype'][_0xf31a('0xb')]=function(_0x31615d){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x167'),_0x31615d[_0xf31a('0x38')]));if(_0x31615d['retry']===0x0){return this[_0xf31a('0xa7')](_0x31615d);}_0x31615d[_0xf31a('0x112')]-=0x1;if(!this[_0xf31a('0x85')](_0x31615d[_0xf31a('0x113')])){return this['channel'][_0xf31a('0x2c')](_0x31615d,_0xf31a('0x114'));}var _0x2b156c=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x31615d[_0xf31a('0x113')]);if(!_0x2b156c){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x31615d,'no\x20file\x20audio\x20found');}var _0x2e2369=this[_0xf31a('0x3a')]['getData'](_0x2b156c,_0x31615d[_0xf31a('0x118')],_0x31615d['digit']);var _0x1933c4=_0x2e2369['result'];if(_0x2e2369['result']===-0x1){this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x31615d,'-1');return _0x2e2369;}else if(_0x2e2369[_0xf31a('0xa3')]==='timeout'){_0x2e2369[_0xf31a('0xa5')]=_0x2e2369[_0xf31a('0xa5')]['length']>0x0?_0x2e2369[_0xf31a('0xa5')]:'t';}else if(_[_0xf31a('0x46')](_0x2e2369[_0xf31a('0xa5')])){_0x2e2369[_0xf31a('0xa5')]='#';_0x1933c4='#';}if(!this[_0xf31a('0x85')](_0x31615d['variable_id'])){this['channel'][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x18de39=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x31615d['variable_id']);if(!_0x18de39){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x31615d,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x18de39,_0x1933c4);}this[_0xf31a('0x36')]['sync'](this,_0x31615d,_0x1933c4);return _0x2e2369;};AGIVertices[_0xf31a('0xf')][_0xf31a('0xaa')]=function(_0x2618f7){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x168'),_0x2618f7[_0xf31a('0x38')]));return this['channel']['noop'](_0x2618f7[_0xf31a('0x169')]||_0x2618f7[_0xf31a('0x38')]);};AGIVertices['prototype'][_0xf31a('0x16a')]=function(_0x2693c9){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x16b'),_0x2693c9[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x2693c9[_0xf31a('0x159')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x2693c9,_0xf31a('0x15a'));}logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15b'),this[_0xf31a('0x3a')]['callerid'],_0x2693c9[_0xf31a('0x159')]));var _0x5412da=this[_0xf31a('0x51')]['sync'](this,_0x2693c9[_0xf31a('0x16c')]);var _0x1aa5dd=this[_0xf31a('0x52')][_0xf31a('0x6e')](this,_0x2693c9[_0xf31a('0x159')],_0x5412da);if(_0x1aa5dd){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf31a('0x3a')]['callerid'],_0x2693c9['findBy']));this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0x15c'),this['channel']['callerid'],_0x2693c9[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15e'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x2693c9[_0xf31a('0x159')]));this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x2693c9[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices['prototype']['playback']=function(_0x66ee66){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x16d'),_0x66ee66['label']));if(!this['isConfigured'](_0x66ee66['file_id'])){return this[_0xf31a('0x3a')]['error'](_0x66ee66,_0xf31a('0x114'));}var _0x3e5147=this[_0xf31a('0x1c')]['sync'](this,_0x66ee66[_0xf31a('0x113')]);if(!_0x3e5147){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x66ee66,_0xf31a('0x115'));}var _0x128e6c=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0x16e'),[_0x3e5147,_0x66ee66[_0xf31a('0xe6')]]);if(_0x128e6c['result']===-0x1){return _0x128e6c;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('Executed\x20command\x20%s\x20%s',_0xf31a('0x16e'),_0x3e5147));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x16f')]=function(_0x59caf0){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x59caf0[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x59caf0[_0xf31a('0x170')])){return this['channel'][_0xf31a('0x2c')](_0x59caf0,_0xf31a('0x171'));}var _0x23708e='';var _0x309517=parseInt(_0x59caf0[_0xf31a('0x170')],0xa);if(isNaN(_0x309517)){_0x23708e=_0x59caf0['queue_id'];}else{_0x23708e=this[_0xf31a('0x14')][_0xf31a('0x6e')](this,_0x59caf0['queue_id']);if(!_0x23708e){return this['channel'][_0xf31a('0x2c')](_0x59caf0,_0xf31a('0x172'));}}var _0x4fb692='';if(this[_0xf31a('0x85')](_0x59caf0[_0xf31a('0x113')])){var _0x1a7e26=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x59caf0[_0xf31a('0x113')]);if(_0x1a7e26){_0x4fb692=_0x1a7e26;}}this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x59caf0,_0x23708e);if(_0x59caf0[_0xf31a('0xe6')][_0xf31a('0x173')]('x')<0x0){_0x59caf0[_0xf31a('0xe6')]+='x';}if(_0x59caf0['opts']['indexOf']('X')<0x0){_0x59caf0[_0xf31a('0xe6')]+='X';}this[_0xf31a('0x3a')]['setVariable'](_0xf31a('0x174'),_0x23708e?_0x23708e[_0xf31a('0x175')]():'');var _0x569ebc=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0x176'),[_0x23708e,_0x59caf0[_0xf31a('0xe6')],_0x59caf0[_0xf31a('0x63')],_0x4fb692,_0x59caf0[_0xf31a('0x65')],_0x59caf0[_0xf31a('0x6')],_0x59caf0[_0xf31a('0x177')],_0x59caf0[_0xf31a('0x178')],'',_0x59caf0[_0xf31a('0x179')]]);if(_0x569ebc[_0xf31a('0xa5')]===-0x1){return _0x569ebc;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x176'),_0x23708e));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x17a')]=function(_0x5b6262){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x17b'),_0x5b6262['label']));var _0x9731aa=_0x5b6262[_0xf31a('0x17c')]||_0xf31a('0x132');var _0x4f3510=util['format'](_0xf31a('0x17d'),this[_0xf31a('0x3a')]['uniqueid'],rs[_0xf31a('0x11d')](0x5));var _0x94a2cc=util[_0xf31a('0x29')](_0xf31a('0x17e'),FILES_PATH,_0x4f3510,_0x9731aa);var _0x1099a6=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,_0x4f3510);this[_0xf31a('0x3d')][_0xf31a('0x6e')](this,_0x5b6262,_0x4f3510,_0x94a2cc);this['channel'][_0xf31a('0xa0')](_0xf31a('0x17f'),_0x4f3510);logger[_0xf31a('0x30')](_0xf31a('0x180'),_0x1099a6,_0x9731aa,_0x5b6262[_0xf31a('0x181')],_0x5b6262[_0xf31a('0x65')]);return this['channel'][_0xf31a('0x13d')](_0x1099a6,_0x9731aa,_0x5b6262['escape_digits'],_0x5b6262[_0xf31a('0x65')],undefined,!![]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x182')]=function(_0x34e20e){logger['info'](util['format'](_0xf31a('0x183'),_0x34e20e['label']));if(!this[_0xf31a('0x85')](_0x34e20e[_0xf31a('0x63')])){return this['channel']['noop'](_0xf31a('0x184'));}var _0x2488c8=this[_0xf31a('0x62')]['sync'](this,_0x34e20e);logger['info'](util[_0xf31a('0x29')](_0xf31a('0x185'),util[_0xf31a('0x186')](_0x2488c8,{'showHidden':![],'depth':null})));if(!this[_0xf31a('0x85')](_0x34e20e[_0xf31a('0xd8')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0x187'));}var _0x45dc76=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x34e20e[_0xf31a('0xd8')]);if(!_0x45dc76){return this['channel'][_0xf31a('0x2c')](_0x34e20e,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x188'),_0x45dc76),_0x2488c8[_0xf31a('0x74')]?_0x2488c8['statusCode']:_0xf31a('0x189'));this[_0xf31a('0x3a')]['setVariable'](util[_0xf31a('0x29')]('%s_STATUS_MESSAGE',_0x45dc76),_0x2488c8[_0xf31a('0x75')]?_0x2488c8[_0xf31a('0x75')]:'OK');if(_0x2488c8[_0xf31a('0x69')]){try{this['saveRestApiResult'](_0x2488c8[_0xf31a('0x69')],_0x45dc76);}catch(_0x109201){logger[_0xf31a('0x2c')](util[_0xf31a('0x29')](_0xf31a('0x18a'),_0x45dc76));}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xde'),_0x45dc76));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18b')]=function(_0x4c7384){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x18c'),_0x4c7384[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x18d')](_0x4c7384['digits']['replace'](/\s+/g,''),_0x4c7384['escape_digits']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18e')]=function(_0x15d31b){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x18f'),_0x15d31b[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x190')](_0x15d31b[_0xf31a('0x66')][_0xf31a('0x5a')](/\s+/g,''),_0x15d31b['escape_digits']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x191')]=function(_0x39cc18){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x192'),_0x39cc18[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x193')](_0x39cc18[_0xf31a('0x5d')],_0x39cc18[_0xf31a('0x181')]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x194')]=function(_0x440ba7){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x195'),_0x440ba7['label']));if(!this['isConfigured'](_0x440ba7[_0xf31a('0x196')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x197'));}var _0x418d07=this[_0xf31a('0x20')]['sync'](this,_0x440ba7[_0xf31a('0x196')]);if(!_0x418d07||!_0x418d07[_0xf31a('0x198')]){return this['channel'][_0xf31a('0x2c')](_0x440ba7,_0xf31a('0x199'));}var _0x557249={'from':util[_0xf31a('0x29')](_0xf31a('0x19a'),_0x418d07[_0xf31a('0x16')],_0x418d07[_0xf31a('0x19b')]||_0x418d07[_0xf31a('0x198')]['user']),'to':_0x440ba7['to']||'','cc':_0x440ba7['cc']||'','bcc':_0x440ba7['bcc']||'','subject':_0x440ba7[_0xf31a('0x19c')],'html':_0x440ba7[_0xf31a('0x5d')],'text':_0x440ba7[_0xf31a('0x5d')]};if(this[_0xf31a('0x85')](_0x440ba7[_0xf31a('0x19d')])){}logger['debug'](_0xf31a('0x19e'),JSON[_0xf31a('0x72')](_0x557249));this[_0xf31a('0x36')]['sync'](this,_0x440ba7,_0x440ba7[_0xf31a('0x196')]);this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x19f'),_0x418d07[_0xf31a('0x16')]));this[_0xf31a('0x22')][_0xf31a('0x6e')](this,_0x418d07['smtpOptions'],_0x557249);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a0'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a1')]=function(_0x569a6b){logger['info'](util['format'](_0xf31a('0x1a2'),_0x569a6b['label']));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a3'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a4')]=function(_0x296075){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1a5'),_0x296075[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x296075[_0xf31a('0x1a6')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a7'));}var _0x3cd5ac=this['getSmsAccount'][_0xf31a('0x6e')](this,_0x296075[_0xf31a('0x1a6')]);if(!_0x3cd5ac){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x296075,'no\x20sms\x20account\x20found');}var _0x514362={'body':_0x296075[_0xf31a('0x1a8')],'phone':_0x296075['to']||'','SmsAccountId':_0x3cd5ac['id']};logger[_0xf31a('0x1a9')]('sendSMS\x20message',JSON['stringify'](_0x514362));this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x296075,_0x296075['sms_account_id']);this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1aa'),_0x3cd5ac['name']));this[_0xf31a('0x35')][_0xf31a('0x6e')](this,_0x514362);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1ab'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1ac')]=function(_0x2ae0e0){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1ad'),_0x2ae0e0[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x2ae0e0[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x2ae0e0,_0xf31a('0x1ae'));}var _0x8e81dc=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x2ae0e0[_0xf31a('0xd8')]);if(!_0x8e81dc){return this[_0xf31a('0x3a')]['error'](_0x2ae0e0,_0xf31a('0xd9'));}return this[_0xf31a('0x3a')]['setVariable'](_0x8e81dc,_0x2ae0e0[_0xf31a('0x1af')]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1b0')]=function(_0x5bbccd){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x5bbccd[_0xf31a('0x38')]));this[_0xf31a('0x3a')]['noop'](_0xf31a('0x1b1'));var _0x1192f3=this[_0xf31a('0x3a')][_0xf31a('0x10')](_0xf31a('0x1b2'));if(!_['isEmpty'](_0x1192f3['extra'])){this['channel'][_0xf31a('0x37')]=_0x1192f3['extra'];}if(_0x5bbccd[_0xf31a('0xba')]===_0xf31a('0x1b3')){this[_0xf31a('0x3a')][_0xf31a('0xaa')]('Answer');return this[_0xf31a('0x3a')][_0xf31a('0xba')]();}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1b4'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1b5')]=function(_0x294cf8){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x1b6'),_0x294cf8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x294cf8[_0xf31a('0x1b7')])){return this[_0xf31a('0x3a')]['error'](_0x294cf8,_0xf31a('0x1b8'));}var _0x42ffd6=this[_0xf31a('0x17')][_0xf31a('0x6e')](this,_0x294cf8[_0xf31a('0x1b7')]);if(!this['isConfigured'](_0x42ffd6)){return this['channel'][_0xf31a('0x2c')](_0x294cf8,util['format'](_0xf31a('0x1b9'),_0x294cf8[_0xf31a('0x1b7')]));}if(_0x42ffd6===this[_0xf31a('0x3a')][_0xf31a('0x3b')]){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x294cf8,_0xf31a('0x1ba'));}this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x294cf8,_0x42ffd6);var _0x126901=this['channel'][_0xf31a('0x59')](_0xf31a('0x1bb'),util['format'](_0xf31a('0x1bc'),config['agi'][_0xf31a('0x1bd')]||'127.0.0.1',_0x42ffd6,this[_0xf31a('0x3a')][_0xf31a('0x3b')]));if(_0x126901[_0xf31a('0xa5')]===-0x1){return _0x126901;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x1bb'),_0x42ffd6));};AGIVertices['prototype'][_0xf31a('0x1be')]=function(_0x2ea979){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x1bf'),_0x2ea979[_0xf31a('0x38')]));var _0x383f01=this['shellCommand'][_0xf31a('0x6e')](this,_0x2ea979['command']);this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x2ea979,_0x2ea979[_0xf31a('0x1c0')]);if(this[_0xf31a('0x85')](_0x2ea979[_0xf31a('0xd8')])){var _0xe930da=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x2ea979[_0xf31a('0xd8')]);if(_0xe930da){this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0xe930da,_0x383f01);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c1'),_0x2ea979[_0xf31a('0x1c0')],_0xe930da));}}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x1c2'),_0x2ea979[_0xf31a('0x1c0')]));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1c3')]=function(_0x51b382){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1c4'),_0x51b382['label']));_0x51b382[_0xf31a('0x5d')]=_0x51b382['text'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf31a('0x85')](_0x51b382[_0xf31a('0x5b')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1c5'));}if(!this['isConfigured'](_0x51b382['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x51b382[_0xf31a('0x5d')]));var _0xc942ee=this[_0xf31a('0x1c6')][_0xf31a('0x6e')](this,_0x51b382);if(_0xc942ee){this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c7'),_0xc942ee));var _0x3d5b41=this[_0xf31a('0x3a')][_0xf31a('0x103')](_0xc942ee);try{fs[_0xf31a('0x128')](_0xc942ee+_0xf31a('0x104'));}catch(_0x32ff03){logger[_0xf31a('0x2c')](_0x32ff03);}return _0x3d5b41;}return this['channel']['error'](_0x51b382,_0xf31a('0x1c8'));};AGIVertices['prototype']['tts']=function(_0x3cfd1f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3cfd1f[_0xf31a('0x38')]));_0x3cfd1f[_0xf31a('0x5d')]=_0x3cfd1f['text'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf31a('0x85')](_0x3cfd1f['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c9'),_0x3cfd1f['text']));var _0xfccba=this[_0xf31a('0x61')][_0xf31a('0x6e')](this,_0x3cfd1f);if(_0xfccba){this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x1ca'),_0xfccba));var _0x2c6bfb=this['channel'][_0xf31a('0x103')](_0xfccba);try{fs[_0xf31a('0x128')](_0xfccba+_0xf31a('0x104'));}catch(_0x19bf75){logger['error'](_0x19bf75);}return _0x2c6bfb;}return this['channel'][_0xf31a('0x2c')](_0x3cfd1f,_0xf31a('0x1cb'));};AGIVertices['prototype'][_0xf31a('0x1cc')]=function(_0x4c18d8){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1cd'),_0x4c18d8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x4c18d8[_0xf31a('0x159')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x4c18d8,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf31a('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4c18d8['findBy']));var _0x20a68f=this[_0xf31a('0x54')]['sync'](this,_0x4c18d8[_0xf31a('0x159')]);if(_0x20a68f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15c'),this['channel'][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x15c'),this[_0xf31a('0x3a')]['callerid'],_0x4c18d8[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1ce')]=function(_0x1ce36f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1cf'),_0x1ce36f[_0xf31a('0x38')]));var _0x2bc116=this[_0xf31a('0x3a')][_0xf31a('0x59')]('VOICEMAIL',[_0x1ce36f[_0xf31a('0x1d0')],_0x1ce36f[_0xf31a('0x78')]]);if(_0x2bc116['result']===-0x1){return _0x2bc116;}return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x1d1'),_0x1ce36f[_0xf31a('0x1d0')]));};AGIVertices['prototype'][_0xf31a('0x1d2')]=function(_0x18e356){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1d3'),_0x18e356[_0xf31a('0x38')]));if(!this['isConfigured'](_0x18e356[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')]['error'](_0x18e356,_0xf31a('0x1ae'));}var _0x490496=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x18e356[_0xf31a('0xd8')]);if(!_0x490496){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x18e356,_0xf31a('0xd9'));}var _0x133263=this[_0xf31a('0x3a')]['getVariable'](_0x490496);return{'code':0xc8,'result':_0x133263[_0xf31a('0xa3')]?_0x133263['extra']:'-'};};String[_0xf31a('0xf')][_0xf31a('0xa2')]=function(_0x30d5bc,_0x66eb48){return this[_0xf31a('0xa1')](_0x30d5bc)['join'](_0x66eb48);};module[_0xf31a('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e959253..e1f57a8 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 _0x0a6b=['syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','interface','channels','queue','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','error','[ACW][START]\x20%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','[ACW][syncHangupRequest]\x20%s','message','[ACW][syncHangup]\x20%s','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect'];(function(_0x39c12e,_0x585534){var _0x58dbf4=function(_0xd35390){while(--_0xd35390){_0x39c12e['push'](_0x39c12e['shift']());}};_0x58dbf4(++_0x585534);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x29b7a6,_0x71a735){_0x29b7a6=_0x29b7a6-0x0;var _0x1add01=_0x0a6b[_0x29b7a6];return _0x1add01;};'use strict';var _=require(_0xb0a6('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xb0a6('0x1'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xb0a6('0x2'));function Acw(_0x13dc41){this[_0xb0a6('0x3')]=_0x13dc41['voiceQueues'];this[_0xb0a6('0x4')]=_0x13dc41['agents'];this[_0xb0a6('0x5')]=_0x13dc41[_0xb0a6('0x5')];this['channels']={};ami['on'](_0xb0a6('0x6'),this[_0xb0a6('0x7')][_0xb0a6('0x8')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xb0a6('0x9'),this[_0xb0a6('0xa')][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xb'),this['syncAgentRingNoAnswer'][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xc'),this['syncAttendedTransfer'][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xd'),this[_0xb0a6('0xe')][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xf'),this[_0xb0a6('0x10')][_0xb0a6('0x8')](this));}function getDiff(_0x425b97){var _0x392f48=moment()[_0xb0a6('0x11')](0x0);var _0x513853=moment(_0x425b97)[_0xb0a6('0x11')](0x0);return _0x392f48['diff'](_0x513853,_0xb0a6('0x12'));}Acw['prototype'][_0xb0a6('0x13')]=function(_0x59730e,_0x1d837f){var _0x382c2f=this;var _0x93243e=getDiff(_0x382c2f['timers'][_0x59730e]['lastPauseAt']);clearTimeout(_0x382c2f[_0xb0a6('0x5')][_0x59730e][_0xb0a6('0x14')]);_0x382c2f[_0xb0a6('0x5')][_0x59730e][_0xb0a6('0x14')]=![];return RpcVoiceAgentReport[_0xb0a6('0x15')]({'acwtime':_0x93243e},_0x382c2f[_0xb0a6('0x5')][_0x59730e]['uniqueid'],_0x59730e)[_0xb0a6('0x16')](function(_0x883503){logger[_0xb0a6('0x17')](_0xb0a6('0x18'),_0x1d837f,_0x93243e,_0x883503);})[_0xb0a6('0x19')](function(_0x30ac04){logger['error'](_0xb0a6('0x1a'),_0x1d837f,_0x30ac04);})[_0xb0a6('0x1b')](function(){delete _0x382c2f[_0xb0a6('0x5')][_0x59730e];});};Acw[_0xb0a6('0x1c')][_0xb0a6('0x1d')]=function(_0x10e56b){try{var _0x27db00=this;var _0x16e053=this['channels'][_0x10e56b][_0xb0a6('0x1e')];var _0x5c6e66=this[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x20')];var _0x4997df=this['voiceQueues'][_0x5c6e66];var _0x10d753=![];var _0x14993f='ACW';if(_0x4997df[_0xb0a6('0x21')]&&_0x4997df[_0xb0a6('0x22')][_0xb0a6('0x23')]){_0x10d753=!![];_0x14993f=_0x4997df[_0xb0a6('0x22')]['name'];}if(!_0x27db00['agents'][_0x16e053]){return Promise[_0xb0a6('0x24')]();}return RpcUser[_0xb0a6('0x25')](_0x27db00[_0xb0a6('0x4')][_0x16e053]['id'])['then'](function(_0x23bec3){if(!_0x23bec3||_0x23bec3[_0xb0a6('0x26')]){logger[_0xb0a6('0x17')](_0xb0a6('0x27'),_0x10e56b,_0x16e053,_0x5c6e66);return;}logger[_0xb0a6('0x17')](_0xb0a6('0x28'),_0x10e56b,_0x16e053,_0x5c6e66);var _0x94d47f=_0x27db00[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x29')]&&_0x27db00['channels'][_0x10e56b][_0xb0a6('0x2a')]?_0x27db00[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x2a')]:_0x10e56b;return RpcUser['savePause'](_0x27db00[_0xb0a6('0x4')][_0x16e053],_0x14993f,_0x94d47f);})['then'](function(_0x131e46){if(_0x10d753||!_0x131e46){return;}_0x27db00[_0xb0a6('0x5')][_0x16e053]={};logger[_0xb0a6('0x17')](_0xb0a6('0x2b'),_0x10e56b,_0x27db00[_0xb0a6('0x3')][_0x5c6e66][_0xb0a6('0x2c')],_0x16e053,_0x5c6e66);_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x14')]=setTimeout(_0x27db00[_0xb0a6('0x2d')][_0xb0a6('0x8')](_0x27db00,_0x16e053),_0x27db00['voiceQueues'][_0x5c6e66]['acwTimeout']*0x3e8);_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x2e')]=moment()[_0xb0a6('0x2f')](_0xb0a6('0x30'));_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x31')]=_0x10e56b;_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x20')]=_0x5c6e66;_0x27db00['timers'][_0x16e053][_0xb0a6('0x13')]=_0x27db00[_0xb0a6('0x13')]['bind'](_0x27db00,_0x16e053,_0x10e56b);})[_0xb0a6('0x19')](function(){logger[_0xb0a6('0x32')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x10e56b,_0x27db00['voiceQueues'][_0x5c6e66][_0xb0a6('0x2c')],_0x16e053,_0x5c6e66);})[_0xb0a6('0x1b')](function(){delete _0x27db00[_0xb0a6('0x1f')][_0x10e56b];});}catch(_0x13ebd8){logger[_0xb0a6('0x32')](_0xb0a6('0x33'),_0x13ebd8['message']);}};Acw[_0xb0a6('0x1c')]['stopAcw']=function(_0x317143){try{var _0x29b609=this;if(_0x29b609['timers'][_0x317143]){_0x29b609['timers'][_0x317143]['timer']=![];var _0x3c4f52=_0x29b609[_0xb0a6('0x5')][_0x317143][_0xb0a6('0x31')];var _0x236cc4=_0x29b609[_0xb0a6('0x5')][_0x317143]['queue'];var _0x40b3de=_0x29b609[_0xb0a6('0x3')][_0x236cc4][_0xb0a6('0x2c')];logger[_0xb0a6('0x17')]('[%s][TIMER][STOP][AGENT:%s]',_0x3c4f52,_0x317143);RpcUser[_0xb0a6('0x34')](this[_0xb0a6('0x4')][_0x317143]);RpcVoiceAgentReport[_0xb0a6('0x15')]({'acwtime':_0x40b3de,'agentacw':!![]},_0x3c4f52,_0x317143)[_0xb0a6('0x16')](function(_0x1366fd){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x3c4f52,_0x40b3de,_0x1366fd);})[_0xb0a6('0x19')](function(_0x1ae542){logger[_0xb0a6('0x32')](_0xb0a6('0x1a'),_0x3c4f52,_0x1ae542);});}else{logger[_0xb0a6('0x32')](_0xb0a6('0x35'),_0x317143);if(_0x29b609[_0xb0a6('0x5')]){logger[_0xb0a6('0x17')]('[ACW][TIMERS]',JSON[_0xb0a6('0x36')](_0x29b609[_0xb0a6('0x5')]));}}}catch(_0x381067){logger[_0xb0a6('0x32')](_0xb0a6('0x37'),_0x381067['message']);}};Acw[_0xb0a6('0x1c')]['syncAgentConnect']=function(_0xaf5ef8){try{if(this['voiceQueues'][_0xaf5ef8[_0xb0a6('0x20')]]&&(this['voiceQueues'][_0xaf5ef8[_0xb0a6('0x20')]][_0xb0a6('0x1')]||this[_0xb0a6('0x3')][_0xaf5ef8[_0xb0a6('0x20')]][_0xb0a6('0x21')])){if(this[_0xb0a6('0x4')][_0xaf5ef8[_0xb0a6('0x1e')]]){this[_0xb0a6('0x1f')][_0xaf5ef8[_0xb0a6('0x31')]]={'queue':_0xaf5ef8[_0xb0a6('0x20')],'interface':_0xaf5ef8[_0xb0a6('0x1e')],'destlinkedid':_0xaf5ef8[_0xb0a6('0x2a')]};}}}catch(_0x4fa815){logger[_0xb0a6('0x32')](_0xb0a6('0x38'),_0x4fa815['message']);}};Acw[_0xb0a6('0x1c')]['syncAgentConnectPreview']=function(_0x3334e9){try{if(this[_0xb0a6('0x3')][_0x3334e9[_0xb0a6('0x20')]]&&(this['voiceQueues'][_0x3334e9[_0xb0a6('0x20')]][_0xb0a6('0x1')]||this[_0xb0a6('0x3')][_0x3334e9[_0xb0a6('0x20')]][_0xb0a6('0x21')])){if(this[_0xb0a6('0x4')][_0x3334e9[_0xb0a6('0x1e')]]){this[_0xb0a6('0x1f')][_0x3334e9['uniqueid']]={'queue':_0x3334e9[_0xb0a6('0x20')],'interface':_0x3334e9[_0xb0a6('0x1e')]};}}}catch(_0x47645a){logger[_0xb0a6('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x47645a['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x4fb43a){try{if(this['channels'][_0x4fb43a['uniqueid']]&&_[_0xb0a6('0x39')](this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x31')]][_0xb0a6('0x29')])){logger[_0xb0a6('0x17')](_0xb0a6('0x3a'),_0x4fb43a[_0xb0a6('0x31')]);this[_0xb0a6('0x1d')](_0x4fb43a[_0xb0a6('0x31')]);}else if(this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x3b')]]&&_[_0xb0a6('0x39')](this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x3b')]][_0xb0a6('0x29')])){logger[_0xb0a6('0x17')]('[%s][HANGUP:LINKEDID]',_0x4fb43a[_0xb0a6('0x3b')]);this[_0xb0a6('0x1d')](_0x4fb43a[_0xb0a6('0x3b')]);}}catch(_0x272176){logger[_0xb0a6('0x32')](_0xb0a6('0x3c'),_0x272176[_0xb0a6('0x3d')]);}};Acw[_0xb0a6('0x1c')][_0xb0a6('0xa')]=function(_0x516e0c){try{if(this['channels'][_0x516e0c[_0xb0a6('0x31')]]&&this[_0xb0a6('0x1f')][_0x516e0c[_0xb0a6('0x31')]]['attended']){logger[_0xb0a6('0x17')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x516e0c[_0xb0a6('0x31')]);this[_0xb0a6('0x1d')](_0x516e0c['uniqueid']);}else if(this[_0xb0a6('0x1f')][_0x516e0c[_0xb0a6('0x3b')]]&&this['channels'][_0x516e0c[_0xb0a6('0x3b')]]['attended']){logger[_0xb0a6('0x17')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x516e0c[_0xb0a6('0x3b')]);this[_0xb0a6('0x1d')](_0x516e0c['linkedid']);}}catch(_0x329524){logger[_0xb0a6('0x32')](_0xb0a6('0x3e'),_0x329524[_0xb0a6('0x3d')]);}};Acw[_0xb0a6('0x1c')]['syncAttendedTransfer']=function(_0x3251dc){try{if(!_['isNil'](this[_0xb0a6('0x1f')][_0x3251dc['transfereeuniqueid']])){this['startAcw'](_0x3251dc[_0xb0a6('0x3f')]);if(this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']]){this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']][_0xb0a6('0x29')]=!![];this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x40')]]=this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']];delete this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x41')]];}}else if(!_[_0xb0a6('0x42')](this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x40')]])){this[_0xb0a6('0x1d')](_0x3251dc['transfertargetuniqueid']);if(this['channels'][_0x3251dc[_0xb0a6('0x43')]]){this['channels'][_0x3251dc[_0xb0a6('0x43')]][_0xb0a6('0x29')]=!![];this[_0xb0a6('0x1f')][_0x3251dc['transfereeuniqueid']]=this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x43')]];delete this['channels'][_0x3251dc[_0xb0a6('0x43')]];}}}catch(_0x2164bf){logger[_0xb0a6('0x32')](_0xb0a6('0x44'),_0x2164bf[_0xb0a6('0x3d')]);}};Acw['prototype'][_0xb0a6('0xe')]=function(_0x1e317b){try{if(this['channels'][_0x1e317b[_0xb0a6('0x45')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x46'),JSON[_0xb0a6('0x36')](_0x1e317b[_0xb0a6('0x45')]));this[_0xb0a6('0x1d')](_0x1e317b[_0xb0a6('0x45')]);}else if(this[_0xb0a6('0x1f')][_0x1e317b[_0xb0a6('0x47')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x48'),JSON[_0xb0a6('0x36')](_0x1e317b['transfererlinkedid']));this[_0xb0a6('0x1d')](_0x1e317b['transfererlinkedid']);}}catch(_0x2fb107){logger[_0xb0a6('0x32')](_0xb0a6('0x49'),_0x2fb107[_0xb0a6('0x3d')]);}};Acw['prototype'][_0xb0a6('0x4a')]=function(_0x1363e9){try{if(this[_0xb0a6('0x3')][_0x1363e9[_0xb0a6('0x20')]]&&this[_0xb0a6('0x3')][_0x1363e9[_0xb0a6('0x20')]][_0xb0a6('0x4b')]===_0xb0a6('0x4c')){if(this[_0xb0a6('0x4')][_0x1363e9[_0xb0a6('0x1e')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x4d'),_0x1363e9[_0xb0a6('0x31')],_0x1363e9[_0xb0a6('0x1e')],_0x1363e9[_0xb0a6('0x20')]);return RpcUser[_0xb0a6('0x4e')](this[_0xb0a6('0x4')][_0x1363e9[_0xb0a6('0x1e')]],'Auto-Pause',_0x1363e9[_0xb0a6('0x31')]);}}}catch(_0x2aabb1){logger[_0xb0a6('0x32')](_0xb0a6('0x4f'),_0x2aabb1[_0xb0a6('0x3d')]);}};module[_0xb0a6('0x50')]=Acw; \ No newline at end of file +var _0xf494=['linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','custom:agentConnectPreview','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','resolve','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw'];(function(_0x4b6ca3,_0x187471){var _0x516c1f=function(_0x4c9a26){while(--_0x4c9a26){_0x4b6ca3['push'](_0x4b6ca3['shift']());}};_0x516c1f(++_0x187471);}(_0xf494,0x1c6));var _0x4f49=function(_0x4fc026,_0x66bb48){_0x4fc026=_0x4fc026-0x0;var _0xf1c6ea=_0xf494[_0x4fc026];return _0xf1c6ea;};'use strict';var _=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var ami=require(_0x4f49('0x2'));var logger=require('../../../config/logger')(_0x4f49('0x3'));var RpcUser=require(_0x4f49('0x4'));var RpcVoiceAgentReport=require(_0x4f49('0x5'));function Acw(_0x25677c){this[_0x4f49('0x6')]=_0x25677c[_0x4f49('0x6')];this[_0x4f49('0x7')]=_0x25677c[_0x4f49('0x7')];this[_0x4f49('0x8')]=_0x25677c[_0x4f49('0x8')];this[_0x4f49('0x9')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x4f49('0xa')](this));ami['on'](_0x4f49('0xb'),this[_0x4f49('0xc')][_0x4f49('0xa')](this));ami['on'](_0x4f49('0xd'),this[_0x4f49('0xe')][_0x4f49('0xa')](this));ami['on'](_0x4f49('0xf'),this['syncAgentRingNoAnswer'][_0x4f49('0xa')](this));ami['on'](_0x4f49('0x10'),this['syncAttendedTransfer'][_0x4f49('0xa')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4f49('0xa')](this));ami['on'](_0x4f49('0x11'),this['syncAgentConnectPreview'][_0x4f49('0xa')](this));}function getDiff(_0x111a8b){var _0x1b9145=moment()[_0x4f49('0x12')](0x0);var _0x1a0f1e=moment(_0x111a8b)[_0x4f49('0x12')](0x0);return _0x1b9145[_0x4f49('0x13')](_0x1a0f1e,'seconds');}Acw[_0x4f49('0x14')][_0x4f49('0x15')]=function(_0x415e83,_0x5878f4){var _0x5bdfaf=this;var _0x2f0a0d=getDiff(_0x5bdfaf[_0x4f49('0x8')][_0x415e83][_0x4f49('0x16')]);clearTimeout(_0x5bdfaf['timers'][_0x415e83][_0x4f49('0x17')]);_0x5bdfaf[_0x4f49('0x8')][_0x415e83][_0x4f49('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x2f0a0d},_0x5bdfaf['timers'][_0x415e83]['uniqueid'],_0x415e83)['then'](function(_0xb2081a){logger[_0x4f49('0x18')](_0x4f49('0x19'),_0x5878f4,_0x2f0a0d,_0xb2081a);})[_0x4f49('0x1a')](function(_0x5793ac){logger[_0x4f49('0x1b')](_0x4f49('0x1c'),_0x5878f4,_0x5793ac);})[_0x4f49('0x1d')](function(){delete _0x5bdfaf[_0x4f49('0x8')][_0x415e83];});};Acw[_0x4f49('0x14')]['startAcw']=function(_0x3e7e28){try{var _0x357446=this;var _0x3ae590=this['channels'][_0x3e7e28][_0x4f49('0x1e')];var _0x1d70a7=this[_0x4f49('0x9')][_0x3e7e28][_0x4f49('0x1f')];var _0x9d30aa=this[_0x4f49('0x6')][_0x1d70a7];var _0x559d98=![];var _0x4e9041=_0x4f49('0x20');if(_0x9d30aa[_0x4f49('0x21')]&&_0x9d30aa['mandatoryDispositionPause'][_0x4f49('0x22')]){_0x559d98=!![];_0x4e9041=_0x9d30aa[_0x4f49('0x23')][_0x4f49('0x22')];}if(!_0x357446['agents'][_0x3ae590]){return Promise[_0x4f49('0x24')]();}return RpcUser[_0x4f49('0x25')](_0x357446[_0x4f49('0x7')][_0x3ae590]['id'])[_0x4f49('0x26')](function(_0xfefbab){if(!_0xfefbab||_0xfefbab[_0x4f49('0x27')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x3e7e28,_0x3ae590,_0x1d70a7);return;}logger[_0x4f49('0x18')](_0x4f49('0x28'),_0x3e7e28,_0x3ae590,_0x1d70a7);var _0x605c91=_0x357446['channels'][_0x3e7e28][_0x4f49('0x29')]&&_0x357446[_0x4f49('0x9')][_0x3e7e28][_0x4f49('0x2a')]?_0x357446['channels'][_0x3e7e28]['destlinkedid']:_0x3e7e28;return RpcUser[_0x4f49('0x2b')](_0x357446[_0x4f49('0x7')][_0x3ae590],_0x4e9041,_0x605c91);})[_0x4f49('0x26')](function(_0x5e7076){if(_0x559d98||!_0x5e7076){return;}_0x357446[_0x4f49('0x8')][_0x3ae590]={};logger[_0x4f49('0x18')](_0x4f49('0x2c'),_0x3e7e28,_0x357446[_0x4f49('0x6')][_0x1d70a7][_0x4f49('0x2d')],_0x3ae590,_0x1d70a7);_0x357446[_0x4f49('0x8')][_0x3ae590][_0x4f49('0x17')]=setTimeout(_0x357446[_0x4f49('0x2e')][_0x4f49('0xa')](_0x357446,_0x3ae590),_0x357446[_0x4f49('0x6')][_0x1d70a7][_0x4f49('0x2d')]*0x3e8);_0x357446[_0x4f49('0x8')][_0x3ae590][_0x4f49('0x16')]=moment()[_0x4f49('0x2f')](_0x4f49('0x30'));_0x357446[_0x4f49('0x8')][_0x3ae590][_0x4f49('0x31')]=_0x3e7e28;_0x357446[_0x4f49('0x8')][_0x3ae590][_0x4f49('0x1f')]=_0x1d70a7;_0x357446['timers'][_0x3ae590][_0x4f49('0x15')]=_0x357446[_0x4f49('0x15')][_0x4f49('0xa')](_0x357446,_0x3ae590,_0x3e7e28);})[_0x4f49('0x1a')](function(){logger[_0x4f49('0x1b')](_0x4f49('0x2c'),_0x3e7e28,_0x357446[_0x4f49('0x6')][_0x1d70a7][_0x4f49('0x2d')],_0x3ae590,_0x1d70a7);})[_0x4f49('0x1d')](function(){delete _0x357446[_0x4f49('0x9')][_0x3e7e28];});}catch(_0x44e6a0){logger[_0x4f49('0x1b')](_0x4f49('0x32'),_0x44e6a0['message']);}};Acw[_0x4f49('0x14')][_0x4f49('0x2e')]=function(_0x36000a){try{var _0x26014f=this;if(_0x26014f[_0x4f49('0x8')][_0x36000a]){_0x26014f[_0x4f49('0x8')][_0x36000a][_0x4f49('0x17')]=![];var _0x25fdf8=_0x26014f[_0x4f49('0x8')][_0x36000a][_0x4f49('0x31')];var _0x173b6e=_0x26014f[_0x4f49('0x8')][_0x36000a][_0x4f49('0x1f')];var _0x889445=_0x26014f['voiceQueues'][_0x173b6e][_0x4f49('0x2d')];logger[_0x4f49('0x18')]('[%s][TIMER][STOP][AGENT:%s]',_0x25fdf8,_0x36000a);RpcUser[_0x4f49('0x33')](this[_0x4f49('0x7')][_0x36000a]);RpcVoiceAgentReport['update']({'acwtime':_0x889445,'agentacw':!![]},_0x25fdf8,_0x36000a)[_0x4f49('0x26')](function(_0x1dd1a6){logger[_0x4f49('0x18')](_0x4f49('0x19'),_0x25fdf8,_0x889445,_0x1dd1a6);})[_0x4f49('0x1a')](function(_0x3d5cf2){logger[_0x4f49('0x1b')]('[%s][UPDATE][ERRORS:%s]',_0x25fdf8,_0x3d5cf2);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x36000a);if(_0x26014f[_0x4f49('0x8')]){logger[_0x4f49('0x18')](_0x4f49('0x34'),JSON[_0x4f49('0x35')](_0x26014f[_0x4f49('0x8')]));}}}catch(_0x1ecf6c){logger[_0x4f49('0x1b')](_0x4f49('0x36'),_0x1ecf6c[_0x4f49('0x37')]);}};Acw['prototype']['syncAgentConnect']=function(_0x412395){try{if(this[_0x4f49('0x6')][_0x412395[_0x4f49('0x1f')]]&&(this['voiceQueues'][_0x412395[_0x4f49('0x1f')]]['acw']||this['voiceQueues'][_0x412395[_0x4f49('0x1f')]][_0x4f49('0x21')])){if(this[_0x4f49('0x7')][_0x412395['interface']]){this[_0x4f49('0x9')][_0x412395[_0x4f49('0x31')]]={'queue':_0x412395['queue'],'interface':_0x412395[_0x4f49('0x1e')],'destlinkedid':_0x412395['destlinkedid']};}}}catch(_0x29adbf){logger[_0x4f49('0x1b')](_0x4f49('0x38'),_0x29adbf['message']);}};Acw[_0x4f49('0x14')][_0x4f49('0x39')]=function(_0x33bb04){try{if(this[_0x4f49('0x6')][_0x33bb04[_0x4f49('0x1f')]]&&(this[_0x4f49('0x6')][_0x33bb04[_0x4f49('0x1f')]][_0x4f49('0x3')]||this[_0x4f49('0x6')][_0x33bb04[_0x4f49('0x1f')]]['mandatoryDisposition'])){if(this[_0x4f49('0x7')][_0x33bb04[_0x4f49('0x1e')]]){this['channels'][_0x33bb04[_0x4f49('0x31')]]={'queue':_0x33bb04['queue'],'interface':_0x33bb04[_0x4f49('0x1e')]};}}}catch(_0x41c580){logger[_0x4f49('0x1b')](_0x4f49('0x3a'),_0x41c580['message']);}};Acw[_0x4f49('0x14')][_0x4f49('0xc')]=function(_0x37bafa){try{if(this[_0x4f49('0x9')][_0x37bafa[_0x4f49('0x31')]]&&_[_0x4f49('0x3b')](this[_0x4f49('0x9')][_0x37bafa[_0x4f49('0x31')]][_0x4f49('0x29')])){logger[_0x4f49('0x18')](_0x4f49('0x3c'),_0x37bafa[_0x4f49('0x31')]);this[_0x4f49('0x3d')](_0x37bafa[_0x4f49('0x31')]);}else if(this[_0x4f49('0x9')][_0x37bafa[_0x4f49('0x3e')]]&&_['isUndefined'](this['channels'][_0x37bafa[_0x4f49('0x3e')]][_0x4f49('0x29')])){logger[_0x4f49('0x18')](_0x4f49('0x3f'),_0x37bafa[_0x4f49('0x3e')]);this[_0x4f49('0x3d')](_0x37bafa[_0x4f49('0x3e')]);}}catch(_0x51c756){logger[_0x4f49('0x1b')]('[ACW][syncHangupRequest]\x20%s',_0x51c756[_0x4f49('0x37')]);}};Acw[_0x4f49('0x14')][_0x4f49('0xe')]=function(_0x1f1c04){try{if(this['channels'][_0x1f1c04[_0x4f49('0x31')]]&&this['channels'][_0x1f1c04['uniqueid']][_0x4f49('0x29')]){logger[_0x4f49('0x18')](_0x4f49('0x40'),_0x1f1c04[_0x4f49('0x31')]);this['startAcw'](_0x1f1c04['uniqueid']);}else if(this[_0x4f49('0x9')][_0x1f1c04[_0x4f49('0x3e')]]&&this['channels'][_0x1f1c04[_0x4f49('0x3e')]]['attended']){logger['info'](_0x4f49('0x41'),_0x1f1c04['linkedid']);this[_0x4f49('0x3d')](_0x1f1c04['linkedid']);}}catch(_0xccd455){logger[_0x4f49('0x1b')](_0x4f49('0x42'),_0xccd455[_0x4f49('0x37')]);}};Acw[_0x4f49('0x14')][_0x4f49('0x43')]=function(_0x14cf1b){try{if(!_[_0x4f49('0x44')](this['channels'][_0x14cf1b[_0x4f49('0x45')]])){this['startAcw'](_0x14cf1b[_0x4f49('0x45')]);if(this[_0x4f49('0x9')][_0x14cf1b[_0x4f49('0x46')]]){this[_0x4f49('0x9')][_0x14cf1b[_0x4f49('0x46')]][_0x4f49('0x29')]=!![];this['channels'][_0x14cf1b[_0x4f49('0x47')]]=this[_0x4f49('0x9')][_0x14cf1b['secondtransfereruniqueid']];delete this['channels'][_0x14cf1b[_0x4f49('0x46')]];}}else if(!_[_0x4f49('0x44')](this[_0x4f49('0x9')][_0x14cf1b[_0x4f49('0x47')]])){this[_0x4f49('0x3d')](_0x14cf1b['transfertargetuniqueid']);if(this[_0x4f49('0x9')][_0x14cf1b['origtransfereruniqueid']]){this[_0x4f49('0x9')][_0x14cf1b[_0x4f49('0x48')]][_0x4f49('0x29')]=!![];this['channels'][_0x14cf1b[_0x4f49('0x45')]]=this[_0x4f49('0x9')][_0x14cf1b[_0x4f49('0x48')]];delete this[_0x4f49('0x9')][_0x14cf1b['origtransfereruniqueid']];}}}catch(_0x22df72){logger[_0x4f49('0x1b')]('[ACW][syncAttendedTransfer]\x20%s',_0x22df72[_0x4f49('0x37')]);}};Acw[_0x4f49('0x14')][_0x4f49('0x49')]=function(_0x35b29f){try{if(this[_0x4f49('0x9')][_0x35b29f[_0x4f49('0x4a')]]){logger[_0x4f49('0x18')](_0x4f49('0x4b'),JSON['stringify'](_0x35b29f[_0x4f49('0x4a')]));this[_0x4f49('0x3d')](_0x35b29f[_0x4f49('0x4a')]);}else if(this[_0x4f49('0x9')][_0x35b29f[_0x4f49('0x4c')]]){logger[_0x4f49('0x18')](_0x4f49('0x4d'),JSON['stringify'](_0x35b29f[_0x4f49('0x4c')]));this['startAcw'](_0x35b29f[_0x4f49('0x4c')]);}}catch(_0x2b491c){logger[_0x4f49('0x1b')](_0x4f49('0x4e'),_0x2b491c[_0x4f49('0x37')]);}};Acw[_0x4f49('0x14')][_0x4f49('0x4f')]=function(_0x297698){try{if(this[_0x4f49('0x6')][_0x297698[_0x4f49('0x1f')]]&&this['voiceQueues'][_0x297698[_0x4f49('0x1f')]][_0x4f49('0x50')]===_0x4f49('0x51')){if(this[_0x4f49('0x7')][_0x297698['interface']]){logger['info'](_0x4f49('0x52'),_0x297698['uniqueid'],_0x297698[_0x4f49('0x1e')],_0x297698[_0x4f49('0x1f')]);return RpcUser[_0x4f49('0x2b')](this[_0x4f49('0x7')][_0x297698[_0x4f49('0x1e')]],_0x4f49('0x53'),_0x297698[_0x4f49('0x31')]);}}}catch(_0x275179){logger[_0x4f49('0x1b')](_0x4f49('0x54'),_0x275179[_0x4f49('0x37')]);}};module[_0x4f49('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index deca96d..64cb176 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 _0xcc90=['keepConnected','Action','promisify','action','format','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionQueueSummary','catch','[ami.js][fullybooted]','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc90,0x69));var _0x0cc9=function(_0x2e7a54,_0x35254a){_0x2e7a54=_0x2e7a54-0x0;var _0x18b127=_0xcc90[_0x2e7a54];return _0x18b127;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var logger=require(_0x0cc9('0x2'))(_0x0cc9('0x3'));var config=require(_0x0cc9('0x4'));var ami=new Manager(config[_0x0cc9('0x5')][_0x0cc9('0x6')],config['asterisk']['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')][_0x0cc9('0x8')],!![]);ami[_0x0cc9('0x9')]();ami[_0x0cc9('0xa')]=BPromise[_0x0cc9('0xb')](ami[_0x0cc9('0xc')]);function error(_0x3f2140){logger['error'](util[_0x0cc9('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')]['port'],util[_0x0cc9('0xe')](_0x3f2140,![],null)));}function close(){logger[_0x0cc9('0xf')](util[_0x0cc9('0xd')](_0x0cc9('0x10'),config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x0cc9('0x11')});};};ami[_0x0cc9('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x0cc9('0x13')]=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x15')});};};ami[_0x0cc9('0x16')]=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x17')});};};function connect(){logger['info'](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x0cc9('0x7')],config['asterisk']['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));ami[_0x0cc9('0x18')]('error',error);ami[_0x0cc9('0x18')](_0x0cc9('0x19'),close);}ami['on'](_0x0cc9('0x1a'),connect);ami['on'](_0x0cc9('0x1b'),function(_0x594023){logger[_0x0cc9('0x1c')](util[_0x0cc9('0xd')](_0x0cc9('0x1d'),config[_0x0cc9('0x5')][_0x0cc9('0x7')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x0cc9('0xe')](_0x594023,![],null)));});ami['on'](_0x0cc9('0x1e'),function(){logger['info'](util[_0x0cc9('0xd')](_0x0cc9('0x1f'),config['asterisk'][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));return Promise[_0x0cc9('0x20')]()['then'](ami[_0x0cc9('0x21')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x12')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x13')]())['then'](ami[_0x0cc9('0x23')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x16')]())[_0x0cc9('0x24')](function(_0xa35736){logger['error'](_0x0cc9('0x25'),util[_0x0cc9('0xe')](_0xa35736,{'showHidden':![],'depth':null}));});});ami[_0x0cc9('0x18')](_0x0cc9('0xf'),error);ami[_0x0cc9('0x18')]('close',close);module['exports']=ami; \ No newline at end of file +var _0xcad1=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionCoreShowChannels','util','../../config/logger','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xcad1,0xa2));var _0x1cad=function(_0x1a53df,_0x1af726){_0x1a53df=_0x1a53df-0x0;var _0x22be9a=_0xcad1[_0x1a53df];return _0x22be9a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x1cad('0x0'));var logger=require(_0x1cad('0x1'))('ami');var config=require(_0x1cad('0x2'));var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0x1cad('0x3')][_0x1cad('0x4')],config['asterisk'][_0x1cad('0x5')],!![]);ami[_0x1cad('0x6')]();ami[_0x1cad('0x7')]=BPromise[_0x1cad('0x8')](ami[_0x1cad('0x9')]);function error(_0x34c12b){logger[_0x1cad('0xa')](util[_0x1cad('0xb')](_0x1cad('0xc'),config[_0x1cad('0x3')][_0x1cad('0x4')],config['asterisk']['ip'],config[_0x1cad('0x3')][_0x1cad('0xd')],util[_0x1cad('0xe')](_0x34c12b,![],null)));}function close(){logger[_0x1cad('0xa')](util[_0x1cad('0xb')](_0x1cad('0xf'),config[_0x1cad('0x3')][_0x1cad('0x4')],config[_0x1cad('0x3')]['ip'],config[_0x1cad('0x3')][_0x1cad('0xd')]));}ami[_0x1cad('0x10')]=function(){return function(){return ami[_0x1cad('0x7')]({'action':_0x1cad('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x1cad('0x12')});};};ami[_0x1cad('0x13')]=function(){return function(){return ami[_0x1cad('0x7')]({'action':_0x1cad('0x14')});};};ami[_0x1cad('0x15')]=function(){return function(){return ami['Action']({'action':_0x1cad('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x1cad('0x7')]({'action':_0x1cad('0x17')});};};function connect(){logger['info'](util[_0x1cad('0xb')](_0x1cad('0x18'),config['asterisk']['username'],config[_0x1cad('0x3')]['ip'],config['asterisk'][_0x1cad('0xd')]));ami[_0x1cad('0x19')](_0x1cad('0xa'),error);ami['once'](_0x1cad('0x1a'),close);}ami['on'](_0x1cad('0x1b'),connect);ami['on'](_0x1cad('0x1c'),function(_0x398ed9){logger[_0x1cad('0x1d')](util[_0x1cad('0xb')](_0x1cad('0x1e'),config[_0x1cad('0x3')][_0x1cad('0x4')],config[_0x1cad('0x3')]['ip'],config[_0x1cad('0x3')][_0x1cad('0xd')],util[_0x1cad('0xe')](_0x398ed9,![],null)));});ami['on'](_0x1cad('0x1f'),function(){logger['info'](util[_0x1cad('0xb')](_0x1cad('0x20'),config[_0x1cad('0x3')][_0x1cad('0x4')],config[_0x1cad('0x3')]['ip'],config[_0x1cad('0x3')]['port']));return Promise['resolve']()[_0x1cad('0x21')](ami['actionSipShowRegistry']())['then'](ami[_0x1cad('0x22')]())['then'](ami[_0x1cad('0x13')]())[_0x1cad('0x21')](ami[_0x1cad('0x15')]())[_0x1cad('0x21')](ami[_0x1cad('0x23')]())['catch'](function(_0x2dd34c){logger[_0x1cad('0xa')]('[ami.js][fullybooted]',util[_0x1cad('0xe')](_0x2dd34c,{'showHidden':![],'depth':null}));});});ami['once'](_0x1cad('0xa'),error);ami[_0x1cad('0x19')](_0x1cad('0x1a'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8cd33f9..a9ee67f 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x4aa741,_0x5134c1){var _0x272370=function(_0x1aa778){while(--_0x1aa778){_0x4aa741['push'](_0x4aa741['shift']());}};_0x272370(++_0x5134c1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5dbc41,_0x4ccc71){_0x5dbc41=_0x5dbc41-0x0;var _0x2238be=_0xf4eb[_0x5dbc41];return _0x2238be;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'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/index.js b/server/services/ami/dialer/index.js index 65951d8..6779003 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 _0xe1d3=['phone','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','UserId','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','checkContactBlack','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','checkContactEmpty','[actionOriginatePredictive]\x20','abandonmentRate','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','exports','moment','./utils','../preview/util/util','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/queueCallerAbandon','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','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\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','name','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','then','content','indexOf','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','catch','resetActiveCalls','syncCampaigns','campaigns','isIVRCampaign','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','type','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','ivr','droptime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','countabandonedretry','countglobal','voiceQueue','dialAbandonedRetryFrequency','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','pick','idHopper','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','createStateFinal','dialMachineRetryFrequency','[syncHangupInAMDIvr]','Machine','membername','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','map','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xe1d3,0xc7));var _0x3e1d=function(_0x5c85fb,_0x3ee344){_0x5c85fb=_0x5c85fb-0x0;var _0x17df0d=_0xe1d3[_0x5c85fb];return _0x17df0d;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require(_0x3e1d('0x0'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x3e1d('0x1'));var hopperUtils=require('./utils/hopper');var ut=require(_0x3e1d('0x2'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x3e1d('0x3'));var loggerBooked=require(_0x3e1d('0x4'))('booked');var loggerPredictive=require(_0x3e1d('0x4'))(_0x3e1d('0x5'));var loggerPredictiveCalls=require(_0x3e1d('0x4'))(_0x3e1d('0x6'));var loggerSyncQueueSummary=require(_0x3e1d('0x4'))(_0x3e1d('0x7'));var ami=require('../ami');config[_0x3e1d('0x8')]=_[_0x3e1d('0x9')](config[_0x3e1d('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e1d('0x8')]));var cmHopper=require(_0x3e1d('0xa'));var voiceQueueRt=require(_0x3e1d('0xb'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x3e1d('0xc'));var Action=require(_0x3e1d('0xd'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x3e1d('0xe'));var Hangup=require('./models/hangup');var ipAgi=process[_0x3e1d('0xf')][_0x3e1d('0x10')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x3e1d('0x11')]=function(_0x2b4bef){this[_0x3e1d('0x12')]=this[_0x3e1d('0x12')]?this[_0x3e1d('0x12')][_0x3e1d('0x13')](_0x2b4bef):_0x2b4bef();};function Dialer(_0x14f791,_0x3c4161){this[_0x3e1d('0x14')]=new Sequence();this[_0x3e1d('0x15')]=_0x3c4161;this[_0x3e1d('0x16')]=_0x14f791[_0x3e1d('0x16')];this['campaigns']=_0x14f791['campaigns'];this['agents']=_0x14f791[_0x3e1d('0x17')];this['trunks']=_0x14f791[_0x3e1d('0x18')];this[_0x3e1d('0x19')]=config[_0x3e1d('0x19')]||0x2;this[_0x3e1d('0x1a')]={};this[_0x3e1d('0x1b')]={};this[_0x3e1d('0x1c')]={};this['uniqueId']={};this[_0x3e1d('0x1d')]={};this[_0x3e1d('0x1e')]={};this[_0x3e1d('0x1f')]={};this[_0x3e1d('0x20')]={};this[_0x3e1d('0x21')]={};this[_0x3e1d('0x22')]={};this[_0x3e1d('0x23')]={};ami['on'](_0x3e1d('0x24'),this['syncAgentConnect'][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x26'),this[_0x3e1d('0x27')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x28'),this[_0x3e1d('0x29')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x2a'),this[_0x3e1d('0x2b')]['bind'](this));ami['on'](_0x3e1d('0x2c'),this['syncQueueSummary'][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x2d'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x3e1d('0x2e'),this[_0x3e1d('0x2f')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x30'),this[_0x3e1d('0x31')][_0x3e1d('0x25')](this));ami['on']('varset',this['syncVarSet'][_0x3e1d('0x25')](this));ami['on']('queuemember',this[_0x3e1d('0x32')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x33'),this[_0x3e1d('0x34')][_0x3e1d('0x25')](this));this[_0x3e1d('0x35')]();this[_0x3e1d('0x36')]();RpcSetting['getSettings']()['then'](function(_0x33854e){previewRecallmeReminderInterval=_0x33854e[_0x3e1d('0x37')];});}function isNotNull(_0x34f258){return _0x34f258!==null&&!_[_0x3e1d('0x38')](_0x34f258);}function msgResponse(_0x513e6f,_0x1a753b,_0x3b6b8b){return{'action':_0x513e6f,'response':_0x1a753b,'message':_0x3b6b8b,'stack':_0x3b6b8b};}function emit(_0x4dd1e9,_0x3c8e4e,_0x30369a){io['to'](_0x4dd1e9)[_0x3e1d('0x39')](_0x3c8e4e,_0x30369a);}function emitOutboundVoiceQueueSummary(_0x216eb0){if(_0x216eb0['type']==='outbound'){logger[_0x3e1d('0x3a')](_0x3e1d('0x3b'),util[_0x3e1d('0x3c')](_0x216eb0,{'showHidden':![],'depth':null}));emit(util[_0x3e1d('0x3d')](_0x3e1d('0x3e'),_0x216eb0['name']),'voice_queue:save',_0x216eb0);}}function checkGetDataPredictive(_0x2e85a2){if(isNotNull(_0x2e85a2)&&!_[_0x3e1d('0x3f')](_0x2e85a2)){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x41'));loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x42'),_0x2e85a2[_0x3e1d('0x43')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x44'),_0x2e85a2[_0x3e1d('0x45')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x46'),_0x2e85a2[_0x3e1d('0x47')]);loggerPredictive['info'](_0x3e1d('0x48'),_0x2e85a2[_0x3e1d('0x49')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4a'),_0x2e85a2[_0x3e1d('0x4b')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4c'),_0x2e85a2[_0x3e1d('0x4d')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));if(_0x2e85a2[_0x3e1d('0x43')]>0x0){if(!_['isUndefined'](_0x2e85a2['predictiveIntervalAvgTalktime'])&&_0x2e85a2[_0x3e1d('0x4d')]>0x0){return!![];}loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4f'));if(!_[_0x3e1d('0x38')](_0x2e85a2['predictiveIntervalAvgHoldtime'])&&_0x2e85a2[_0x3e1d('0x4b')]>0x0){return!![];}loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x50'));}else{loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x51'));}}else{loggerPredictive[_0x3e1d('0x40')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x19ee97){return function(_0x12b9da){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x52'));loggerPredictive['info'](_0x3e1d('0x53'),_0x12b9da[_0x3e1d('0x54')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x55'),_0x12b9da[_0x3e1d('0x56')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x57'),_0x12b9da['erlangAbandonmentRate']);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x58'),_0x12b9da['erlangBusyFactor']);loggerPredictive['info'](_0x3e1d('0x57'),_0x12b9da['erlangAbandonmentRate']);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));_[_0x3e1d('0x59')](_0x19ee97,_0x12b9da);};}function ifInterval(_0x27a615,_0x1774f){if(_[_0x3e1d('0x38')](_0x1774f)){return![];}return utils[_0x3e1d('0x5a')](undefined,_0x1774f)<_0x27a615*0x3c;}function clearPredictiveAttributes(_0x5b5f8f){if(_0x5b5f8f[_0x3e1d('0x1f')]){_0x5b5f8f[_0x3e1d('0x1f')]=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f['name'],_0x3e1d('0x5b'));}if(_0x5b5f8f[_0x3e1d('0x1e')]){_0x5b5f8f['startPredictive']=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f[_0x3e1d('0x5c')],'startPredictive\x20value\x20cleared');}if(_0x5b5f8f[_0x3e1d('0x5d')]){clearInterval(_0x5b5f8f[_0x3e1d('0x5d')]);_0x5b5f8f[_0x3e1d('0x5d')]=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f[_0x3e1d('0x5c')],_0x3e1d('0x5e'));}}function loggerCatchPredictive(_0x326aa6,_0x4b977b){return function(_0x2218d7){loggerPredictive[_0x3e1d('0x5f')](_0x4b977b[_0x3e1d('0x5c')],_0x326aa6);loggerPredictive[_0x3e1d('0x5f')](_0x2218d7[_0x3e1d('0x60')]);clearPredictiveAttributes(_0x4b977b);};}function loggerCatch(_0x3e45cd){return function(_0x3d79f2){logger[_0x3e1d('0x5f')](_0x3e45cd,util[_0x3e1d('0x3c')](_0x3d79f2,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1b50fd,_0x27d045,_0x5edb5e){return function(_0x4b3029){utils[_0x3e1d('0x61')](_0x27d045,_0x5edb5e,0x0);_0x27d045[_0x3e1d('0x62')]=0x0;logger[_0x3e1d('0x5f')](_0x1b50fd,util[_0x3e1d('0x3c')](_0x4b3029,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5341a5){return function(_0xa31683){if(isNotNull(_0xa31683)&&isNotNull(_0xa31683[0x0])){if(_0xa31683[0x0][_0x3e1d('0x63')]>0x0){_0x5341a5[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x66')];logger[_0x3e1d('0x40')](_0x3e1d('0x67')+_0x5341a5[_0x3e1d('0x5c')],_0xa31683[0x0][_0x3e1d('0x63')],_0x3e1d('0x68'));}else{_0x5341a5[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x69')];logger[_0x3e1d('0x40')]('[getContactDialer2][Empty]'+_0x5341a5[_0x3e1d('0x5c')]);}}};}function createObjHistory(_0x4c7dee,_0x55afb8,_0x22973e,_0x2631d2,_0x234b2b){_0x4c7dee[_0x3e1d('0x64')]=_0x22973e;var _0x30f59e=new Action(_0x4c7dee,_0x55afb8);var _0x481a08=new History(_0x30f59e);_0x481a08['state']=_0x2631d2;_0x481a08[_0x3e1d('0x6a')]=_0x234b2b;_0x481a08['endtime']=_0x30f59e['starttime'];return _0x481a08;}function unlockQueueStatus(_0x10de34,_0x2cf19b){setTimeout(function(){if(_[_0x3e1d('0x38')](_0x10de34[_0x3e1d('0x6b')])){loggerBooked[_0x3e1d('0x5f')](_0x3e1d('0x6c'),_0x2cf19b);}_0x10de34['queueStatusComplete']=!![];loggerBooked[_0x3e1d('0x40')](_0x3e1d('0x6d'),_0x2cf19b,JSON[_0x3e1d('0x6e')](_['pick'](_0x10de34,[_0x3e1d('0x5c'),_0x3e1d('0x6b')])));},0x1f3);}function checkInterval(_0x4e3293){return function(){if(!isNotNull(_0x4e3293[_0x3e1d('0x6f')])){_0x4e3293[_0x3e1d('0x64')]=utils['CAMPAIGN_STATUS'][_0x3e1d('0x70')];throw _0x4e3293[_0x3e1d('0x5c')]+_0x3e1d('0x71');}if(!isNotNull(_0x4e3293[_0x3e1d('0x6f')][_0x3e1d('0x72')])){_0x4e3293[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];throw _0x4e3293['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x3e1d('0x3f')](_0x4e3293[_0x3e1d('0x6f')][_0x3e1d('0x72')]))){_0x4e3293[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];throw _0x4e3293[_0x3e1d('0x5c')]+_0x3e1d('0x71');}};}function checkIsIVRCampaignActive(_0x57c8aa){return function(){if(!utils[_0x3e1d('0x73')](_0x57c8aa)){_0x57c8aa[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')]['INACTIVE'];throw _0x57c8aa[_0x3e1d('0x5c')]+_0x3e1d('0x74');}};}function emitCampaignSummary(_0x35d2d6){if(utils['isIVRCampaign'](_0x35d2d6)){emit(util[_0x3e1d('0x3d')](_0x3e1d('0x75'),_0x35d2d6['name']),_0x3e1d('0x76'),_0x35d2d6);}}function loggerCatchQueueSummary(_0x1ba805,_0x256ccc){return function(_0xa761ff){clearPredictiveAttributes(_0x256ccc);emitCampaignSummary(_0x256ccc);loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x1ba805,util[_0x3e1d('0x3c')](_0xa761ff,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4c0ea2){if(_0x4c0ea2[_0x3e1d('0x77')]){if(_0x4c0ea2[_0x3e1d('0x78')]===0x0){_0x4c0ea2[_0x3e1d('0x77')]=![];_0x4c0ea2[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x79')];loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x7a'),_0x4c0ea2['name'],_0x3e1d('0x7b'));}else{_0x4c0ea2[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x7c')];loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x7a'),_0x4c0ea2['name'],_0x3e1d('0x7d'));}emitCampaignSummary(_0x4c0ea2);}}function myreject(_0x50b4e3){return function(_0x52ef07){return _0x50b4e3(msgResponse(_0x3e1d('0x7e'),_0x3e1d('0x7f'),JSON['stringify'](_0x52ef07)));};}Dialer[_0x3e1d('0x80')][_0x3e1d('0x81')]=function(_0x3d5e79){return!_[_0x3e1d('0x38')](_0x3d5e79)&&_0x3d5e79&&!_[_0x3e1d('0x38')](_0x3d5e79[_0x3e1d('0x5c')])&&!_['isUndefined'](_0x3d5e79['active'])&&_0x3d5e79[_0x3e1d('0x82')]&&(this[_0x3e1d('0x18')][util[_0x3e1d('0x3d')](_0x3e1d('0x83'),_0x3d5e79[_0x3e1d('0x5c')])][_0x3e1d('0x84')]===_0x3e1d('0x85')||this['trunks'][util['format'](_0x3e1d('0x83'),_0x3d5e79['name'])][_0x3e1d('0x84')]==='unmonitored');};Dialer[_0x3e1d('0x80')][_0x3e1d('0x86')]=function(_0x21c9e9){var _0xf40a7f=this;return function(){if(!_0xf40a7f[_0x3e1d('0x81')](_0x21c9e9[_0x3e1d('0x87')])){if(!_0xf40a7f[_0x3e1d('0x81')](_0x21c9e9[_0x3e1d('0x88')])){_0x21c9e9[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x89')];throw _0x21c9e9[_0x3e1d('0x5c')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x3e1d('0x8a')]=function(_0x2b6ce5,_0x53e33e,_0x45ca3b,_0x34d261){var _0x34b4db=this;return function(){var _0x1c46e3=!![];return _0x34b4db[_0x3e1d('0x8b')](_0x2b6ce5,_0x53e33e,_0x45ca3b,_0x34d261,_0x1c46e3);};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x8c')]=function(_0x1f824e,_0x282f25,_0x31b735,_0x3e13db){var _0x43fe5e=this;return function(){var _0x30b650=![];return _0x43fe5e[_0x3e1d('0x8b')](_0x1f824e['Intervals'],_0x282f25,_0x31b735,_0x3e13db,_0x30b650);};};Dialer[_0x3e1d('0x80')]['ifTimeIvr']=function(_0x4edc2b,_0x42d026,_0x254409,_0x5dc634,_0x373456){var _0xccaa93=[];return new Promise(function(_0x4b9062,_0xb3016c){if(!isNotNull(_0x4edc2b)){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),_0x3e1d('0x8e'),_0x254409+_0x3e1d('0x8f')));}if(_['isEmpty'](_0x4edc2b)){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x90')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),'Failure',_0x254409+_0x3e1d('0x91')));}if(_0x42d026&&_[_0x3e1d('0x38')](config[_0x3e1d('0x92')][_0x42d026])){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x93')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),_0x3e1d('0x8e'),_0x254409+_0x3e1d('0x94')+_0x42d026));}if(_[_0x3e1d('0x95')](_0x4edc2b)){for(var _0x4ecff3=0x0;_0x4ecff3<_0x4edc2b[_0x3e1d('0x96')];_0x4ecff3+=0x1){_0xccaa93[_0x3e1d('0x97')](ami['Action']({'action':_0x3e1d('0x98'),'command':util[_0x3e1d('0x3d')](_0x3e1d('0x99'),_0x4edc2b[_0x4ecff3][_0x3e1d('0x9a')],!_[_0x3e1d('0x38')](config['timezones'][_0x42d026])?_0x42d026:'')})[_0x3e1d('0x9b')](function(_0x4f1c0e){return _0x4f1c0e[_0x3e1d('0x9c')][_0x3e1d('0x9d')]('true')>=0x0;})['catch'](myreject(_0xb3016c)));}}else{_0xccaa93[_0x3e1d('0x97')](ami[_0x3e1d('0x9e')]({'action':_0x3e1d('0x98'),'command':util[_0x3e1d('0x3d')](_0x3e1d('0x99'),_0x4edc2b,!_['isUndefined'](config[_0x3e1d('0x92')][_0x42d026])?_0x42d026:'')})['then'](function(_0x3a2685){return _0x3a2685[_0x3e1d('0x9c')][_0x3e1d('0x9d')]('true')>=0x0;})['catch'](myreject(_0xb3016c)));}Promise[_0x3e1d('0x9f')](_0xccaa93)[_0x3e1d('0x9b')](function(_0x10160e){var _0x4517db=_[_0x3e1d('0xa0')](_0x10160e);if(_0x4517db){return _0x4b9062(_0x4517db);}else{_0x5dc634['message']=_0x373456?utils['CAMPAIGN_STATUS'][_0x3e1d('0xa1')]:utils['CAMPAIGN_STATUS'][_0x3e1d('0xa2')];return _0xb3016c(msgResponse(_0x3e1d('0xa3'),_0x3e1d('0x8e'),_0x3e1d('0xa4')+_0x373456+'\x20'+_0x254409+_0x3e1d('0xa5')+util[_0x3e1d('0x3c')](_0x4edc2b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x42d026));}})[_0x3e1d('0xa6')](function(_0x2da611){return _0xb3016c(msgResponse('ifTime',_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x2da611)));});});};Dialer[_0x3e1d('0x80')]['loopCampaigns']=function(){var _0x313fab=this;return cmHopper[_0x3e1d('0xa7')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x313fab[_0x3e1d('0xa8')]();},0x3e8);});};Dialer[_0x3e1d('0x80')][_0x3e1d('0xa8')]=function(){var _0xf0a345=this;var _0x15080b;for(var _0x138c4f in this[_0x3e1d('0xa9')]){if(typeof this[_0x3e1d('0xa9')][_0x138c4f]!=='undefined'){_0x15080b=this[_0x3e1d('0xa9')][_0x138c4f];if(utils[_0x3e1d('0xaa')](_0x15080b)&&utils[_0x3e1d('0x73')](_0x15080b)){_0x15080b[_0x3e1d('0x77')]=!![];Promise[_0x3e1d('0xab')]()['then'](checkIsIVRCampaignActive(_0x15080b))['then'](checkInterval(_0x15080b))[_0x3e1d('0x9b')](_0xf0a345[_0x3e1d('0x86')](_0x15080b))[_0x3e1d('0x9b')](_0xf0a345[_0x3e1d('0x8a')](_0x15080b['dialGlobalInterval'],_0x15080b[_0x3e1d('0xac')],_0x15080b['name'],_0x15080b))[_0x3e1d('0x9b')](_0xf0a345['checkIfTimeIntervals'](_0x15080b['Interval'],_0x15080b[_0x3e1d('0xac')],_0x15080b[_0x3e1d('0x5c')],_0x15080b))['then'](_0xf0a345[_0x3e1d('0xad')](_0x15080b))[_0x3e1d('0xa6')](loggerCatchQueueSummary(_0x3e1d('0xae'),_0x15080b));}else{notSendMessagesCampaign(_0x15080b);}}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0xaf')]=function(_0x4707ba){if(_0x4707ba['dialMethod']!==_0x3e1d('0x5')){clearPredictiveAttributes(_0x4707ba);}switch(_0x4707ba[_0x3e1d('0xb0')]){case _0x3e1d('0xb1'):this[_0x3e1d('0xb2')](_0x4707ba,0x1);break;case'power':this[_0x3e1d('0xb2')](_0x4707ba,_0x4707ba[_0x3e1d('0xb3')]);break;case'predictive':this[_0x3e1d('0x5')](_0x4707ba);break;case _0x3e1d('0xb4'):this['handlePower'](_0x4707ba,0x1);break;default:logger[_0x3e1d('0x5f')](_0x3e1d('0xb5'),_0x4707ba[_0x3e1d('0x5c')],_0x3e1d('0xb6'));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x8d')]=function(_0x54370d,_0x51fce7){var _0xad2575=_0x54370d[_0x3e1d('0xac')];var _0x529ca7=_0x51fce7?_0x54370d['dialGlobalInterval']:_0x54370d[_0x3e1d('0x6f')][_0x3e1d('0x72')];logger[_0x3e1d('0xb7')]('Dialer::ifTime()',_0x529ca7,_0xad2575,_0x54370d[_0x3e1d('0x5c')],util['format'](_0x3e1d('0xb8'),_0x54370d['name'],_0x54370d['id']));var _0x7de256=null;return Interval[_0x3e1d('0xb9')](_0x529ca7,_0xad2575)['then'](function(_0x228b9f){if(_0x228b9f===!![]){return _0x228b9f;}else{_0x54370d[_0x3e1d('0x64')]=_0x51fce7?utils[_0x3e1d('0x65')][_0x3e1d('0xa1')]:utils[_0x3e1d('0x65')][_0x3e1d('0xa2')];_0x7de256=msgResponse('[ifTime][promiseAll]',_0x3e1d('0x8e'),'Global:\x20'+_0x51fce7+'\x20'+_0x54370d[_0x3e1d('0x5c')]+_0x3e1d('0xa5')+util['inspect'](_0x529ca7,{'showHidden':![],'depth':null})+_0x3e1d('0xba')+_0xad2575);}if(_0x7de256!==null){logger[_0x3e1d('0xb7')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x7de256);_0x7de256['isGlobal']=_0x51fce7;throw _0x7de256;}})[_0x3e1d('0xa6')](function(_0x2661bf){logger[_0x3e1d('0x5f')](_0x3e1d('0xbb'),_0x2661bf);throw msgResponse(_0x3e1d('0x7e'),_0x3e1d('0x7f'),util[_0x3e1d('0x3c')](_0x2661bf,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x3e1d('0xbc')]=function(_0x1f19fe){if(this['voiceQueues'][_0x1f19fe[_0x3e1d('0xbd')]]){if(this[_0x3e1d('0xbe')][_0x1f19fe[_0x3e1d('0xbf')]]&&this[_0x3e1d('0xbe')][_0x1f19fe[_0x3e1d('0xbf')]][_0x3e1d('0xc0')]!=='ivr'){this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0x1f19fe['queue']]);this[_0x3e1d('0xbe')][_0x1f19fe['uniqueid']]['answertime']=moment()['format'](_0x3e1d('0xc2'));}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x2b')]=function(_0x472094){var _0x2e5c3f=this[_0x3e1d('0xbe')][_0x472094[_0x3e1d('0xbf')]];if(this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]]){if(_0x2e5c3f&&_0x2e5c3f['type']!=='ivr'){delete this[_0x3e1d('0xbe')][_0x472094[_0x3e1d('0xbf')]];this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc3')]+=0x1;var _0x1f3746=new AgentComplete(_0x2e5c3f,_0x472094);if(_0x472094['reason']==='agent'){_0x1f3746[_0x3e1d('0xc4')]=this['voiceQueues'][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc5')]&&this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc6')]?moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2')):undefined;}hopperUtils[_0x3e1d('0xc7')](_0x1f3746)[_0x3e1d('0xa6')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x3e1d('0xc8')](_0x1f3746)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xc9')));}}};Dialer['prototype'][_0x3e1d('0x27')]=function(_0x87d050){var _0x56286b=this[_0x3e1d('0xbe')][_0x87d050[_0x3e1d('0xbf')]];var _0x2b7138=this;var _0x32eadb=![];var _0x309e24;var _0x11e878;if(this[_0x3e1d('0x16')][_0x87d050['queue']]){if(_0x56286b&&_0x56286b['type']!==_0x3e1d('0xca')){delete this['uniqueId'][_0x87d050[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]);_0x56286b['droptime']=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));var _0x3863e7=new QueueCallerAbandon(_0x56286b,_0x87d050);if(utils['getSeconds'](_0x56286b[_0x3e1d('0xcb')],_0x56286b['responsetime'])>=_0x56286b['dialQueueTimeout']){this['voiceQueues'][_0x87d050['queue']][_0x3e1d('0x47')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xcc')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xcd')]+=0x1;_0x3863e7[_0x3e1d('0xce')]=0xa;_0x3863e7[_0x3e1d('0x6a')]='Drop';_0x3863e7[_0x3e1d('0xcf')]=_0x3e1d('0xd0');_0x3863e7[_0x3e1d('0xc4')]=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xc5')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3863e7[_0x3e1d('0xd1')]+=0x1;_0x3863e7['countglobal']+=0x1;_0x309e24=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xd2')];_0x11e878=this[_0x3e1d('0x16')][_0x87d050['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3e1d('0xd3')](_0x3863e7,_0x3863e7[_0x3e1d('0xce')],_0x56286b['voiceQueue'])['then'](function(_0x211758){_0x32eadb=_0x211758[_0x3e1d('0xd4')]==0x1;if(_0x3863e7[_0x3e1d('0xd1')]>=_0x2b7138[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xd5')]){_0x2b7138['queueCallerAbandonCreateState'](_0x3863e7,_0x211758['additional']);}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countdropretry':_0x3863e7['countdropretry'],'scheduledat':moment()[_0x3e1d('0xd7')](_0x2b7138[_0x3e1d('0x16')][_0x87d050['queue']]['dialDropRetryFrequency'],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x56286b[_0x3e1d('0xd9')],'ListId':_0x56286b[_0x3e1d('0xda')],'VoiceQueueId':_0x56286b['VoiceQueueId']||undefined,'CampaignId':_0x56286b[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xdc')));var _0x3e1303=new History(_0x3863e7);_0x3e1303[_0x3e1d('0xce')]=0xa;_0x3e1303[_0x3e1d('0x6a')]=_0x3e1d('0xdd');_0x3e1303[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1303[_0x3e1d('0xdf')]=_0x3e1303[_0x3e1d('0xde')];_0x3e1303[_0x3e1d('0xe0')]=_0x3863e7['calleridname'];_0x3e1303[_0x3e1d('0xe1')]=_0x3863e7['calleridnum'];hopperUtils[_0x3e1d('0xc7')](_0x3e1303)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe2')));}})[_0x3e1d('0x9b')](function(){if(_0x32eadb)hopperUtils['swapAdditionalPhones'](_0x3863e7,_0x309e24,_0x11e878)[_0x3e1d('0x9b')](function(){return 0x1;});});}else{this['voiceQueues'][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0x49')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3863e7['state']=0xb;_0x3863e7[_0x3e1d('0x6a')]='Abandoned';_0x3863e7[_0x3e1d('0xcf')]='CALLEREXIT';_0x3863e7[_0x3e1d('0xe3')]+=0x1;_0x3863e7[_0x3e1d('0xe4')]+=0x1;_0x309e24=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]['dialAbandonedRetryFrequency'];_0x11e878=this[_0x3e1d('0x16')][_0x87d050['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x3863e7,_0x3863e7[_0x3e1d('0xce')],_0x56286b[_0x3e1d('0xe5')])['then'](function(_0x376652){if(_0x3863e7[_0x3e1d('0xe3')]>=_0x2b7138['voiceQueues'][_0x87d050[_0x3e1d('0xbd')]]['dialAbandonedMaxRetry']){_0x2b7138['queueCallerAbandonCreateState'](_0x3863e7,_0x376652[_0x3e1d('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3863e7[_0x3e1d('0xe3')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x2b7138[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xe6')],'minutes')[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x56286b[_0x3e1d('0xd9')],'ListId':_0x56286b[_0x3e1d('0xda')],'VoiceQueueId':_0x56286b[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x56286b['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe8')));var _0x32a265=new History(_0x3863e7);_0x32a265[_0x3e1d('0xce')]=0xb;_0x32a265['statedesc']='Abandoned';_0x32a265[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));_0x32a265[_0x3e1d('0xdf')]=_0x32a265['starttime'];_0x32a265[_0x3e1d('0xe0')]=_0x3863e7[_0x3e1d('0xe0')];_0x32a265[_0x3e1d('0xe1')]=_0x3863e7['calleridnum'];hopperUtils[_0x3e1d('0xc7')](_0x32a265)['catch'](loggerCatch(_0x3e1d('0xe9')));}})[_0x3e1d('0x9b')](function(){if(_0x32eadb)hopperUtils[_0x3e1d('0xea')](_0x3863e7,_0x309e24,_0x11e878)[_0x3e1d('0x9b')](function(){return 0x1;});});}}}};Dialer[_0x3e1d('0x80')]['syncNewExten']=function(_0x1a75ce){if(this[_0x3e1d('0x1b')][_0x1a75ce[_0x3e1d('0xbf')]]){this[_0x3e1d('0x1b')][_0x1a75ce[_0x3e1d('0xbf')]][_0x3e1d('0xeb')]=_0x1a75ce['channel'];}if(this[_0x3e1d('0xbe')][_0x1a75ce[_0x3e1d('0xbf')]]){this[_0x3e1d('0xbe')][_0x1a75ce[_0x3e1d('0xbf')]][_0x3e1d('0xeb')]=_0x1a75ce[_0x3e1d('0xeb')];}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x32')]=function(_0x26766a){if(!this[_0x3e1d('0x1b')][_0x26766a['actionid']]){return;}var _0x284fdf=this[_0x3e1d('0x16')][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]][_0x3e1d('0xed')]||_0x3e1d('0xee');if(_0x284fdf==='roundrobin'){if(this['actions'][_0x26766a[_0x3e1d('0xec')]]&&_[_0x3e1d('0xef')](this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xf0')])&&_0x26766a['status']==='1'&&_0x26766a[_0x3e1d('0xf1')]==='0'){if(this['agents'][_0x26766a['stateinterface']]){if(!this[_0x3e1d('0x17')][_0x26766a['stateinterface']][_0x3e1d('0xf0')]){this[_0x3e1d('0x17')][_0x26766a['stateinterface']][_0x3e1d('0xf0')]=!![];this[_0x3e1d('0x1b')][_0x26766a['actionid']][_0x3e1d('0xf0')]=!![];this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xf2')]=_0x26766a[_0x3e1d('0xf2')];}}}}else if(_0x284fdf===_0x3e1d('0xee')){if(this['actions'][_0x26766a[_0x3e1d('0xec')]]){if(this[_0x3e1d('0x17')][_0x26766a[_0x3e1d('0xf2')]]){this['actions'][_0x26766a['actionid']]['stateinterface']=_0x26766a['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]])){this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]=[];}this['queueBooked'][this['actions'][_0x26766a[_0x3e1d('0xec')]]['queue']][_0x3e1d('0x97')](_[_0x3e1d('0x59')](_[_0x3e1d('0xf3')](this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]],[_0x3e1d('0xf4'),_0x3e1d('0xf2')]),{'status':_0x26766a[_0x3e1d('0x84')],'paused':_0x26766a['paused']}));}}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x34')]=function(_0x2068ab){if(!this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]){return;}var _0x22d434=this;var _0x2e5c86=this['voiceQueues'][this['actions'][_0x2068ab['actionid']][_0x3e1d('0xbd')]];var _0x411473=_0x2e5c86['strategy']||_0x3e1d('0xee');if(_0x411473===_0x3e1d('0xf5')){if(this['actions'][_0x2068ab['actionid']]&&this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xf2')]){this['preview'][_0x3e1d('0xf6')](this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xf4')],this['actions'][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xf2')])[_0x3e1d('0xa6')](function(_0xf51727){logger[_0x3e1d('0x5f')](_0x3e1d('0xf7'),util['inspect'](_0xf51727,{'showHidden':![],'depth':null}));})[_0x3e1d('0x13')](function(){_0x22d434[_0x3e1d('0xc1')](_0x22d434[_0x3e1d('0x16')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]);_0x22d434['agents'][_0x22d434[_0x3e1d('0x1b')][_0x2068ab['actionid']]['stateinterface']]['locked']=![];delete _0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]];unlockQueueStatus(_0x2e5c86);});}else{this['updateOriginated'](this[_0x3e1d('0x16')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]]);hopperUtils[_0x3e1d('0xd6')]({'active':![],'ContactId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xd9')],'ListId':this['actions'][_0x2068ab['actionid']][_0x3e1d('0xda')],'VoiceQueueId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xe7')]||undefined,'CampaignId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']]['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xf8')));delete this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]];unlockQueueStatus(_0x2e5c86);}}else if(_0x411473===_0x3e1d('0xee')){var _0x492dda;if(this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]&&!_[_0x3e1d('0x3f')](this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]])){if(this[_0x3e1d('0x22')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]){this[_0x3e1d('0x22')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]=this['queueBookedRR'][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]['queue']]?this[_0x3e1d('0x22')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]:this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]?this['queueBooked'][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]][_0x3e1d('0xf9')]||0x0:0x0;}this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]][_0x3e1d('0xf9')]=this[_0x3e1d('0x22')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]['queue']];for(var _0x33915e=0x0;_0x33915e=_0x589afe[_0x3e1d('0x11c')]){_0x354fd6[_0x3e1d('0x11d')](_0x57cd6c,_0x32ea7a,_0x20c599,_0x3e1d('0x11e'));}else{if(_0x57cd6c[_0x3e1d('0x11f')]>=_0x589afe['dialMachineMaxRetry']){_0x354fd6[_0x3e1d('0x120')](_0x57cd6c,_0x32ea7a,_0x20c599,'reason\x2019\x20machine....');}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countmachineretry':_0x57cd6c[_0x3e1d('0x11f')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x589afe[_0x3e1d('0x121')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x57cd6c['ContactId'],'ListId':_0x57cd6c[_0x3e1d('0xda')],'VoiceQueueId':_0x57cd6c[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x57cd6c[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch('[rescheduleContact][Machine]'));_0x32ea7a({'reschedule':0x1});}}});}if(_0x4ffe01[_0x3e1d('0xc0')]===_0x3e1d('0xca')&&this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]][_0x3e1d('0x10c')]&&_0x4e5458[_0x3e1d('0x117')]==='HANGUP'){delete this[_0x3e1d('0xbe')][_0x4e5458[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]);_0x507078=new Hangup(_0x4ffe01,_0x4e5458);_0x507078[_0x3e1d('0xce')]=0x12;_0x507078['statedesc']=_0x3e1d('0x10f');_0x507078['membername']=_0x3e1d('0x110');ami[_0x3e1d('0x39')](_0x3e1d('0x111'),ut['buildObj'](_0x507078,_0x3e1d('0x113')));this['saveInDb'](_0x507078,'[syncHangupInAMDIvr][createHistory]',_0x3e1d('0x122'));}if(_0x4ffe01[_0x3e1d('0xc0')]==='ivr'&&this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]['dialAMDActive']&&_0x4e5458[_0x3e1d('0x117')]==='MACHINE'){return new Promise(function(_0x3a4080,_0x294b4d){delete _0x354fd6[_0x3e1d('0xbe')][_0x4e5458[_0x3e1d('0xbf')]];_0x354fd6[_0x3e1d('0xc1')](_0x354fd6['campaigns'][_0x4ffe01['queue']]);_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]][_0x3e1d('0xc3')]+=0x1;_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x19069a=_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]];var _0x2fa1d1=new Hangup(_0x4ffe01,_0x4e5458);_0x2fa1d1[_0x3e1d('0xce')]=0x13;_0x2fa1d1[_0x3e1d('0x6a')]=_0x3e1d('0x123');_0x2fa1d1[_0x3e1d('0x124')]=_0x3e1d('0x110');_0x2fa1d1['countmachineretry']+=0x1;_0x2fa1d1[_0x3e1d('0xe4')]+=0x1;_0x2fa1d1[_0x3e1d('0x113')]=!![];ami[_0x3e1d('0x39')](_0x3e1d('0x111'),ut[_0x3e1d('0x112')](_0x2fa1d1,_0x3e1d('0x113')));hopperUtils[_0x3e1d('0xc7')](_0x2fa1d1)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x118')));if(_0x2fa1d1['countbusyretry']+_0x2fa1d1[_0x3e1d('0x11a')]+_0x2fa1d1['countnoanswerretry']+_0x2fa1d1['countnosuchnumberretry']+_0x2fa1d1['countdropretry']+_0x2fa1d1[_0x3e1d('0xe3')]+_0x2fa1d1[_0x3e1d('0x11f')]+_0x2fa1d1[_0x3e1d('0x11b')]>=_0x19069a[_0x3e1d('0x11c')]){_0x354fd6['stateGlobal'](_0x2fa1d1,_0x3a4080,_0x294b4d,_0x3e1d('0x11e'));}else{if(_0x2fa1d1[_0x3e1d('0x11f')]>=_0x19069a['dialMachineMaxRetry']){_0x354fd6['createStateFinal'](_0x2fa1d1,_0x3a4080,_0x294b4d,_0x3e1d('0x125'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2fa1d1[_0x3e1d('0x11f')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x19069a[_0x3e1d('0x121')],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x2fa1d1[_0x3e1d('0xd9')],'ListId':_0x2fa1d1['ListId'],'VoiceQueueId':_0x2fa1d1[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x2fa1d1[_0x3e1d('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3a4080({'reschedule':0x1});}}});}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x2f')]=function(_0x63e443){var _0xd8db0e=this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];var _0x306124;if(_0xd8db0e&&_0xd8db0e[_0x3e1d('0xc0')]===_0x3e1d('0xca')){delete this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0xa9')][_0xd8db0e[_0x3e1d('0xbd')]]);this['campaigns'][_0xd8db0e[_0x3e1d('0xbd')]][_0x3e1d('0x126')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);hopperUtils['createHistory'](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x127')));hopperUtils[_0x3e1d('0xc8')](_0x306124)['catch'](loggerCatch(_0x3e1d('0x128')));}if(_0xd8db0e&&_0xd8db0e['type']!==_0x3e1d('0xca')&&isNotNull(this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]['dialQueueProject'])){delete this['uniqueId'][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0xd8db0e['queue']]);this['voiceQueues'][_0xd8db0e['queue']][_0x3e1d('0xc3')]+=0x1;this[_0x3e1d('0x16')][_0xd8db0e['queue']][_0x3e1d('0x10e')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);_0x306124['state']=0x10;_0x306124[_0x3e1d('0x6a')]=_0x3e1d('0x129');_0x306124['membername']='AGI';hopperUtils[_0x3e1d('0xc7')](_0x306124)[_0x3e1d('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3e1d('0xc8')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x128')));}if(_0xd8db0e&&_0xd8db0e[_0x3e1d('0xc0')]!==_0x3e1d('0xca')&&!isNotNull(this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]['dialQueueProject'])){delete this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]);this['voiceQueues'][_0xd8db0e[_0x3e1d('0xbd')]][_0x3e1d('0x12a')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);_0x306124['state']=0xc;_0x306124[_0x3e1d('0x6a')]=_0x63e443[_0x3e1d('0x12b')];_0x306124[_0x3e1d('0x124')]=_0x3e1d('0x12c');hopperUtils[_0x3e1d('0xc7')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x127')));hopperUtils[_0x3e1d('0xc8')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x128')));}};Dialer['prototype'][_0x3e1d('0x7')]=function(_0x30f20f){var _0x2938ab=this;if(!_0x2938ab[_0x3e1d('0x23')][_0x30f20f['name']]){_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]]={'running':![]};}else if(_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]]['running']===!![]){return;}else if(_0x2938ab['queuesSummary'][_0x30f20f['name']][_0x3e1d('0x12d')]===![]){_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=!![];}var _0x16003d=_0x2938ab['voiceQueues'][_0x30f20f[_0x3e1d('0x5c')]];var _0x54034b=_0x16003d[_0x3e1d('0x64')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x5441e0=utils[_0x3e1d('0x12e')](_0x16003d);_0x16003d[_0x3e1d('0x12f')]=utils[_0x3e1d('0x130')](_0x16003d,_0x2938ab[_0x3e1d('0x18')]);Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](function(){if(_0x16003d['statusMessage']===utils[_0x3e1d('0x65')][_0x3e1d('0x79')]){if(_0x54034b){clearPredictiveAttributes(_0x16003d);_0x30f20f[_0x3e1d('0x1e')]=undefined;_0x30f20f[_0x3e1d('0x1f')]=undefined;}if(_0x16003d[_0x3e1d('0x12f')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x30f20f[_0x3e1d('0x131')]=0x0;_0x30f20f[_0x3e1d('0xf1')]=0x0;_0x30f20f[_0x3e1d('0x132')]=0x0;_0x30f20f[_0x3e1d('0x133')]=0x0;_0x30f20f['pTalking']=0x0;}}else if(_0x16003d[_0x3e1d('0x12f')]===utils[_0x3e1d('0x65')][_0x3e1d('0x134')]&&!_0x5441e0){return _0x2938ab[_0x3e1d('0x8d')](_0x16003d,!![])['then'](function(){return _0x2938ab[_0x3e1d('0x8d')](_0x16003d,![]);})['then'](function(){return _0x2938ab[_0x3e1d('0xaf')](_0x16003d);})[_0x3e1d('0xa6')](function(_0x1ded6d){loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x135'),util[_0x3e1d('0x3c')](_0x1ded6d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x16003d);});}else{clearPredictiveAttributes(_0x16003d);}})[_0x3e1d('0x9b')](function(){var _0x1173bf=_0x30f20f[_0x3e1d('0x136')](_0x16003d);if(_0x1173bf||_0x16003d[_0x3e1d('0x137')]){_0x16003d['queueSummaryCountersUpdated']=![];_0x30f20f['updateReportFromOutboundQueue'](_0x16003d);Object[_0x3e1d('0x138')](_0x16003d,_0x30f20f);emitOutboundVoiceQueueSummary(_0x30f20f);}_0x2938ab[_0x3e1d('0x23')][_0x16003d[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=![];})[_0x3e1d('0xa6')](function(_0x2d259e){logger[_0x3e1d('0x5f')](_0x3e1d('0x135'),util[_0x3e1d('0x3c')](_0x2d259e,{'showHidden':![],'depth':null}));_0x2938ab[_0x3e1d('0x23')][_0x16003d[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=![];});};Dialer[_0x3e1d('0x80')]['syncQueueSummaryComplete']=_[_0x3e1d('0x139')](function(){var _0x3846a3=_[_0x3e1d('0x13a')](this[_0x3e1d('0x16')],function(_0x495c66){return _0x495c66['dialPreviewRecallmeReminder'];});var _0x3c4ce2=_[_0x3e1d('0x13a')](this[_0x3e1d('0x17')],function(_0x4cb2cf){return _0x4cb2cf['online']&&_0x4cb2cf[_0x3e1d('0x84')]===_0x3e1d('0x85');});if(_0x3846a3[_0x3e1d('0x96')]>0x0&&_0x3c4ce2['length']>0x0){return Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](cmHopper['handlePreviewRecallNotifications'](_[_0x3e1d('0x13b')](_0x3846a3,'id'),previewRecallmeReminderInterval,_[_0x3e1d('0x13b')](_0x3c4ce2,'id')))[_0x3e1d('0x9b')](function(_0x4ee34a){for(var _0x4565b2=0x0;_0x4565b2<_0x4ee34a[_0x3e1d('0x96')];_0x4565b2++){var _0x3b0521=_0x4ee34a[_0x4565b2]['Agent'][_0x3e1d('0x5c')];if(_0x3b0521)io['to'](util[_0x3e1d('0x3d')](_0x3e1d('0x13c'),_0x3b0521))[_0x3e1d('0x39')]('user:dialPreviewRecallReminder',{'hopper':_0x4ee34a[_0x4565b2]});}})[_0x3e1d('0xa6')](function(_0x172259){logger[_0x3e1d('0x5f')](_0x3e1d('0x13d'),_0x172259);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3e1d('0x80')]['loopClearZombieChannels']=function(){var _0x31de54=this;setInterval(function(){_0x31de54[_0x3e1d('0x13e')](_0x31de54[_0x3e1d('0xbe')],_0x3e1d('0x13f'));_0x31de54['clearZombieChannels'](_0x31de54[_0x3e1d('0x1b')],'[actions]');},0x32c8);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x13e')]=function(_0x59ea5d,_0x40cdb4){var _0x5bd565=this;for(var _0x478481 in _0x59ea5d){if(typeof _0x59ea5d[_0x478481]!==_0x3e1d('0x140')){this[_0x3e1d('0x14')]['enqueue'](function(){if(!_[_0x3e1d('0xef')](_0x59ea5d[_0x478481])){return ami['Action']({'action':_0x3e1d('0x84'),'channel':_0x59ea5d[_0x478481][_0x3e1d('0xeb')]})[_0x3e1d('0xa6')](function(_0x362811){if(_0x362811[_0x3e1d('0x64')]===_0x3e1d('0x141')){setTimeout(function(){if(_0x59ea5d[_0x478481]&&_0x59ea5d[_0x478481][_0x3e1d('0xc0')]!=='ivr'){_0x5bd565[_0x3e1d('0xc1')](_0x5bd565[_0x3e1d('0x16')][_0x59ea5d[_0x478481][_0x3e1d('0xbd')]]);logger[_0x3e1d('0x5f')](_0x3e1d('0x142'),_0x40cdb4,_0x478481,_0x59ea5d[_0x478481][_0x3e1d('0xbd')]);delete _0x59ea5d[_0x478481];}if(_0x59ea5d[_0x478481]&&_0x59ea5d[_0x478481][_0x3e1d('0xc0')]===_0x3e1d('0xca')){_0x5bd565['updateOriginated'](_0x5bd565['campaigns'][_0x59ea5d[_0x478481][_0x3e1d('0xbd')]]);logger[_0x3e1d('0x5f')](_0x3e1d('0x143'),_0x40cdb4,_0x478481,_0x59ea5d[_0x478481]['queue']);delete _0x59ea5d[_0x478481];}},0x2328);}});}});}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x144')]=function(_0x259c11){return Promise[_0x3e1d('0xab')]()['then'](voiceQueueRt[_0x3e1d('0x144')](_0x259c11))['catch'](loggerCatch(_0x3e1d('0x145')));};Dialer[_0x3e1d('0x80')][_0x3e1d('0xc1')]=function(_0x2a8d8a){if(!_[_0x3e1d('0x38')](_0x2a8d8a)&&_0x2a8d8a!==null){if(typeof _0x2a8d8a['originated']!==_0x3e1d('0x140')){if(_0x2a8d8a[_0x3e1d('0x78')]>0x0){_0x2a8d8a['originated']-=0x1;}else{logger[_0x3e1d('0x5f')](_0x3e1d('0x146'));}}}else{logger[_0x3e1d('0x5f')](_0x3e1d('0x147'));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x148')]=function(_0x22ffa0,_0x51378a){var _0x364961=this;return function(_0x983ef9){_0x364961[_0x3e1d('0xc1')](_0x51378a);logger[_0x3e1d('0x5f')](_0x22ffa0,util[_0x3e1d('0x3c')](_0x983ef9,{'showHidden':![],'depth':null}));};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x149')]=function(_0x3bbb41,_0x3285f1,_0x36581a){var _0x31fc2e={'state':0x19,'statedesc':_0x3e1d('0x14a')};this[_0x3e1d('0xc1')](_0x3285f1);this[_0x3e1d('0x114')](_['merge'](_0x31fc2e,_['pick'](_0x36581a,[_0x3e1d('0xd9'),'ListId','UserId',_0x3e1d('0xe7'),'CampaignId'])),_0x3e1d('0x14b'),_0x3e1d('0x14c'));logger[_0x3e1d('0x5f')](_0x3bbb41);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x114')]=function(_0x35710a,_0x17c08c,_0x346c51){hopperUtils[_0x3e1d('0xc7')](_0x35710a)[_0x3e1d('0xa6')](loggerCatch(_0x17c08c));hopperUtils['moveContactManagedDialer'](_0x35710a)[_0x3e1d('0xa6')](loggerCatch(_0x346c51));};Dialer[_0x3e1d('0x80')][_0x3e1d('0x14d')]=function(_0x11823b,_0x5b10d9){hopperUtils['createHistory'](_0x11823b)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x14e')));if(_0x5b10d9==0x0){hopperUtils[_0x3e1d('0xc8')](_0x11823b)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x14f')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x1df70f){return Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](cmHopper['handlePreviewRecallNotifications'](_0x1df70f['id'],previewRecallmeReminderInterval))[_0x3e1d('0x9b')](function(_0x40101d){for(var _0x4087de=0x0;_0x4087de<_0x40101d['length'];_0x4087de++){var _0x40acd8=_0x40101d[_0x4087de][_0x3e1d('0x150')][_0x3e1d('0x5c')];if(_0x40acd8)io['to'](util['format'](_0x3e1d('0x13c'),_0x40acd8))['emit'](_0x3e1d('0x151'),{'hopper':_0x40101d[_0x4087de]});}})[_0x3e1d('0xa6')](function(){});};Dialer[_0x3e1d('0x80')][_0x3e1d('0xad')]=function(_0x1237f2){var _0x4872d2=this;return function(){_0x4872d2[_0x3e1d('0x152')](_0x1237f2);};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x153')]=function(_0x27dc7b,_0x1e77d7){var _0x17593c=this;var _0x3adeb4=uuid['v4']();this[_0x3e1d('0x1b')][_0x3adeb4]=new Action(_0x27dc7b,_0x1e77d7,_0x3adeb4);return new Promise(function(_0x218f09,_0x3b7b81){if(_[_0x3e1d('0x38')](_0x27dc7b)&&typeof _0x27dc7b!==_0x3e1d('0x154')){return _0x3b7b81(msgResponse('originate',_0x3e1d('0x8e'),_0x3e1d('0x155')));}if(_[_0x3e1d('0x38')](_0x1e77d7[_0x3e1d('0x156')])||_0x1e77d7[_0x3e1d('0x156')]===null){return _0x3b7b81(msgResponse('originate',_0x3e1d('0x8e'),_0x3e1d('0x157')));}var _0x488cdc={'XMD-CALLERID':_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x158')](),'XMD-AGI':_0x27dc7b[_0x3e1d('0x159')]?util[_0x3e1d('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27dc7b[_0x3e1d('0x159')]):_0x3e1d('0x15a'),'XMD-AGIAFTER':_0x27dc7b[_0x3e1d('0xc5')]?util['format'](_0x3e1d('0x15b'),ipAgi,_0x27dc7b[_0x3e1d('0xc5')]):_0x3e1d('0x15a'),'XMD-QUEUE':utils[_0x3e1d('0x15c')](_0x27dc7b)?util[_0x3e1d('0x3d')](_0x3e1d('0x15d'),_0x27dc7b[_0x3e1d('0x5c')],_0x27dc7b['dialQueueOptions']||'',_0x27dc7b['dialAgiAfterHangupAgent']?'c':'',_0x27dc7b['dialQueueTimeout']||0x3):_0x3e1d('0x15a'),'XMD-CONTACTID':_0x1e77d7['ContactId'],'XMD-CDRTYPE':_0x3e1d('0x3'),'CALLERID(all)':_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x158')](),'XMD-AMD':_0x27dc7b[_0x3e1d('0x10c')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x3e1d('0x15e')};if(_0x27dc7b[_0x3e1d('0x10c')]){_0x488cdc[_0x3e1d('0x15f')]=_0x27dc7b[_0x3e1d('0x160')]||0x9c4;_0x488cdc[_0x3e1d('0x161')]=_0x27dc7b[_0x3e1d('0x162')]||0x5dc;_0x488cdc[_0x3e1d('0x163')]=_0x27dc7b[_0x3e1d('0x164')]||0x320;_0x488cdc[_0x3e1d('0x165')]=_0x27dc7b[_0x3e1d('0x166')]||0x1388;_0x488cdc[_0x3e1d('0x167')]=_0x27dc7b[_0x3e1d('0x168')]||0x64;_0x488cdc[_0x3e1d('0x169')]=_0x27dc7b[_0x3e1d('0x16a')]||0x32;_0x488cdc[_0x3e1d('0x16b')]=_0x27dc7b[_0x3e1d('0x16c')]||0x3;_0x488cdc['XMD-AMDSILENCETHRESHOLD']=_0x27dc7b[_0x3e1d('0x16d')]||0x100;_0x488cdc['XMD-AMDMAXIMUMWORDLENGTH']=_0x27dc7b[_0x3e1d('0x16e')]||0x1388;}if(utils['isOutboundQueue'](_0x27dc7b)){_0x488cdc[_0x3e1d('0x16f')]=_0x1e77d7[_0x3e1d('0xe7')];}else{_0x488cdc[_0x3e1d('0x170')]=_0x1e77d7[_0x3e1d('0xdb')];}var _0x3b3194=utils[_0x3e1d('0x171')](_0x1e77d7[_0x3e1d('0x172')]);Object['assign'](_0x488cdc,_0x3b3194);var _0x510a93=_0x17593c[_0x3e1d('0x81')](_0x27dc7b[_0x3e1d('0x87')])?utils[_0x3e1d('0x173')](_0x27dc7b[_0x3e1d('0x87')]['callerid'],_0x27dc7b[_0x3e1d('0x174')],_0x27dc7b[_0x3e1d('0x175')]>0x0?utils[_0x3e1d('0x176')](_0x27dc7b[_0x3e1d('0x177')],_0x27dc7b[_0x3e1d('0x175')]):_0x27dc7b[_0x3e1d('0x177')]):utils[_0x3e1d('0x173')](_[_0x3e1d('0xef')](_0x27dc7b['TrunkBackup'])?_0x27dc7b[_0x3e1d('0x87')][_0x3e1d('0x178')]:_0x27dc7b[_0x3e1d('0x88')]['callerid'],_0x27dc7b[_0x3e1d('0x174')],_0x27dc7b[_0x3e1d('0x175')]>0x0?utils[_0x3e1d('0x176')](_0x27dc7b[_0x3e1d('0x177')],_0x27dc7b[_0x3e1d('0x175')]):_0x27dc7b[_0x3e1d('0x177')]);if(_0x510a93){_0x488cdc[_0x3e1d('0x179')]=_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x17a')]=utils[_0x3e1d('0x17b')](_0x510a93);_0x488cdc[_0x3e1d('0x17c')]=_0x1e77d7[_0x3e1d('0x156')];}_0x27dc7b[_0x3e1d('0x17d')]=_0x488cdc;return ami[_0x3e1d('0x9e')]({'actionid':_0x3adeb4,'action':_0x3e1d('0x17e'),'channel':_0x17593c[_0x3e1d('0x81')](_0x27dc7b[_0x3e1d('0x87')])?util[_0x3e1d('0x3d')](_0x3e1d('0x17f'),_0x27dc7b[_0x3e1d('0x87')][_0x3e1d('0x5c')],isNotNull(_0x27dc7b[_0x3e1d('0x180')])?_0x27dc7b[_0x3e1d('0x180')]['trim']()||'':'',_0x27dc7b[_0x3e1d('0x181')]>0x0?_0x1e77d7['phone']['substring'](_0x27dc7b[_0x3e1d('0x181')]):_0x1e77d7[_0x3e1d('0x156')]):util['format'](_0x3e1d('0x17f'),_['isNil'](_0x27dc7b[_0x3e1d('0x88')])?_0x27dc7b['Trunk'][_0x3e1d('0x5c')]:_0x27dc7b[_0x3e1d('0x88')][_0x3e1d('0x5c')],isNotNull(_0x27dc7b[_0x3e1d('0x180')])?_0x27dc7b[_0x3e1d('0x180')][_0x3e1d('0x182')]()||'':'',_0x27dc7b[_0x3e1d('0x181')]>0x0?_0x1e77d7[_0x3e1d('0x156')]['substring'](_0x27dc7b['dialCutDigit']):_0x1e77d7[_0x3e1d('0x156')]),'callerid':_0x510a93,'Exten':_0x3e1d('0x15e'),'Context':'from-sip','Priority':'1','variable':_0x488cdc,'timeout':(_0x27dc7b[_0x3e1d('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3adeb4})[_0x3e1d('0x9b')](function(_0x3ecfc4){return _0x218f09(_0x3ecfc4);})['catch'](function(_0x2ebfe5){_0x27dc7b[_0x3e1d('0x184')]+=0x1;var _0x113ac9=new History(_0x17593c[_0x3e1d('0x1b')][_0x3adeb4]);logger['error'](util[_0x3e1d('0x3d')](_0x3e1d('0x185'),JSON[_0x3e1d('0x6e')](_0x2ebfe5)));_0x113ac9[_0x3e1d('0xce')]=0xe;_0x113ac9['statedesc']='OriginateError';_0x113ac9[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));_0x113ac9[_0x3e1d('0xdf')]=_0x113ac9[_0x3e1d('0xde')];hopperUtils[_0x3e1d('0xc7')](_0x113ac9)[_0x3e1d('0xa6')](loggerCatch('[originate][error]'));_0x17593c[_0x3e1d('0xc8')](_0x113ac9)[_0x3e1d('0xa6')](loggerCatch('[originate][error]'))[_0x3e1d('0x13')](function(){delete _0x17593c[_0x3e1d('0x1b')][_0x3adeb4];return _0x3b7b81(msgResponse(_0x3e1d('0x17e'),_0x3e1d('0x7f'),_0x3e1d('0x186')));});});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x187')]=function(_0x42edd0,_0x1dd21c,_0x505636){var _0x502c68=new History(_0x1dd21c);if(_0x502c68[_0x3e1d('0x119')]+_0x502c68[_0x3e1d('0x11a')]+_0x502c68[_0x3e1d('0x188')]+_0x502c68[_0x3e1d('0x189')]+_0x502c68[_0x3e1d('0xd1')]+_0x502c68[_0x3e1d('0xe3')]+_0x502c68[_0x3e1d('0x11f')]+_0x502c68['countagentrejectretry']>=_0x505636[_0x3e1d('0x11c')]-0x1){return!![];}switch(_0x42edd0){case 0x3:if(_0x502c68[_0x3e1d('0x188')]>=_0x505636[_0x3e1d('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x502c68[_0x3e1d('0x188')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x18b')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68['ListId'],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18c')));break;case 0x5:if(_0x502c68[_0x3e1d('0x119')]>=_0x505636['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x502c68[_0x3e1d('0x119')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636['dialBusyRetryFrequency'],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18d')));break;case 0x8:if(_0x502c68[_0x3e1d('0x11a')]>=_0x505636['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countcongestionretry':_0x502c68['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x18e')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18f')));break;case 0x0:if(_0x502c68['countnosuchnumberretry']>=_0x505636[_0x3e1d('0x190')]-0x1){return!![];}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countnosuchnumberretry':_0x502c68['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x191')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x192')));}break;case 0xa:if(_0x502c68[_0x3e1d('0xd1')]>=_0x505636['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countdropretry':_0x502c68[_0x3e1d('0xd1')]+=0x1,'scheduledat':moment()['add'](_0x505636['dialDropRetryFrequency'],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xdc')));break;case 0xb:if(_0x502c68[_0x3e1d('0xe3')]>=_0x505636[_0x3e1d('0x193')]-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countabandonedretry':_0x502c68['countabandonedretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0xe6')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68['ListId'],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe8')));break;case 0x13:if(_0x502c68['countmachineretry']>=_0x505636['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countmachineretry':_0x502c68[_0x3e1d('0x11f')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x121')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68['ContactId'],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x194')));break;case 0x14:if(_0x502c68[_0x3e1d('0x11b')]>=_0x505636[_0x3e1d('0x195')]-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countagentrejectretry':_0x502c68['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x196')],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x502c68['ContactId'],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x197')));break;default:return!![];}};Dialer['prototype'][_0x3e1d('0x107')]=function(_0x412b94,_0x286814,_0x5717a0){var _0x58ed05=this;var _0x980cec=new History(_0x412b94);var _0x4cd3a5=![];var _0x2d960c;var _0x19992f;return new Promise(function(_0x608e52,_0x2f5b02){if(_['isUndefined'](_0x286814)&&typeof _0x286814!==_0x3e1d('0x154')){return _0x2f5b02(msgResponse(_0x3e1d('0x198'),_0x3e1d('0x8e'),_0x3e1d('0x199')));}if(_['isUndefined'](_0x5717a0)&&typeof _0x5717a0!==_0x3e1d('0x154')){return _0x2f5b02(msgResponse(_0x3e1d('0x198'),_0x3e1d('0x8e'),_0x3e1d('0x19a')));}hopperUtils['verifyAdditionalPhones'](_0x980cec,_0x5717a0[_0x3e1d('0x19b')],_0x286814)['then'](function(_0x57778c){if(_0x57778c[_0x3e1d('0xd4')]==0x1)_0x4cd3a5=!![];switch(_0x5717a0[_0x3e1d('0x19b')]){case'0':_0x286814['outboundNoSuchCallsDay']+=0x1;_0x980cec[_0x3e1d('0xce')]=0x0;_0x980cec['statedesc']=_0x3e1d('0x19c');_0x980cec[_0x3e1d('0x189')]+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;ami['emit'](_0x3e1d('0x19d'),ut[_0x3e1d('0x112')](_0x412b94,'nosuchnumber'));_0x2d960c=_0x286814[_0x3e1d('0x191')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils['createHistory'](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x118')));if(_0x58ed05[_0x3e1d('0x187')](0x0,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x189')]>=_0x286814['dialNoSuchNumberMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x19f'));}else{_0x58ed05['stateGlobal'](_0x980cec,_0x608e52,_0x2f5b02,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x286814[_0x3e1d('0x1a0')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x3;_0x980cec[_0x3e1d('0x6a')]='NoAnswer';_0x980cec[_0x3e1d('0x188')]+=0x1;_0x980cec['countglobal']+=0x1;var _0xb8388a=ut[_0x3e1d('0x1a1')](_0x412b94,_0x286814);ami['emit'](_0x3e1d('0x1a2'),_0xb8388a);_0x2d960c=_0x286814[_0x3e1d('0x18b')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1a3')));if(_0x58ed05['checkRetriveMax'](0x3,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x188')]>=_0x286814['dialNoAnswerMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1a4'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x286814[_0x3e1d('0x1a5')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x5;_0x980cec[_0x3e1d('0x6a')]='Busy';_0x980cec['countbusyretry']+=0x1;_0x980cec['countglobal']+=0x1;ami[_0x3e1d('0x39')]('custom:agentbusy',ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1a6')));_0x2d960c=_0x286814[_0x3e1d('0x1a7')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils['createHistory'](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1a8')));if(_0x58ed05['checkRetriveMax'](0x5,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x119')]>=_0x286814[_0x3e1d('0x1a9')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1aa'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1aa'));}}break;case'8':_0x286814[_0x3e1d('0x1ab')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x8;_0x980cec[_0x3e1d('0x6a')]=_0x3e1d('0x1ac');_0x980cec['countcongestionretry']+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0x18e')];_0x19992f=_0x286814[_0x3e1d('0x19e')];ami[_0x3e1d('0x39')]('custom:agentcongestion',ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1ad')));hopperUtils[_0x3e1d('0xc7')](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x1ae')));if(_0x58ed05[_0x3e1d('0x187')](0x8,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec['countcongestionretry']>=_0x286814['dialCongestionMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1af'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,'reason\x208\x20congestion');}}break;case'11':_0x286814[_0x3e1d('0x1b0')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0xb;_0x980cec[_0x3e1d('0x6a')]=_0x3e1d('0x1b1');_0x980cec[_0x3e1d('0xe3')]+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0xe6')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe9')));if(_0x58ed05[_0x3e1d('0x187')](0xb,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0xe3')]>=_0x286814[_0x3e1d('0x193')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b2'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b2'));}}break;case'20':_0x286814['outboundRejectCallsDay']+=0x1;_0x980cec['state']=0x14;_0x980cec['statedesc']=_0x3e1d('0x1b3');_0x980cec['countagentrejectretry']+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0x196')];_0x19992f=_0x286814[_0x3e1d('0x19e')];ami[_0x3e1d('0x39')](_0x3e1d('0x1b4'),ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1b5')));hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1b6')));if(_0x58ed05[_0x3e1d('0x187')](0x14,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x11b')]>=_0x286814[_0x3e1d('0x195')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b7'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b7'));}}break;default:_0x286814[_0x3e1d('0x12a')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0xc;_0x980cec[_0x3e1d('0x6a')]=_0x5717a0[_0x3e1d('0x19b')];_0x2d960c=_0x286814[_0x3e1d('0x196')];_0x19992f=_0x286814['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x1b8')));if(_0x58ed05[_0x3e1d('0x187')](_0x5717a0['reason'],_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x119')]+_0x980cec['countcongestionretry']+_0x980cec[_0x3e1d('0x188')]+_0x980cec[_0x3e1d('0x189')]+_0x980cec[_0x3e1d('0xd1')]+_0x980cec[_0x3e1d('0xe3')]+_0x980cec['countmachineretry']+_0x980cec['countagentrejectretry']>=_0x286814[_0x3e1d('0x11c')]){_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x5717a0[_0x3e1d('0x19b')]);}else{_0x58ed05['createStateFinal'](_0x980cec,_0x608e52,_0x2f5b02,_0x5717a0['reason']);}}}})[_0x3e1d('0x9b')](function(){if(_0x4cd3a5){hopperUtils[_0x3e1d('0xea')](_0x980cec,_0x2d960c,_0x19992f)['then'](function(){return _0x608e52(0x1);});}});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x11d')]=function(_0x57c086,_0x326770,_0x552e87,_0x3edbfe){var _0x3c967f=new Final(_0x57c086);_0x3c967f[_0x3e1d('0xce')]=0xf;_0x3c967f[_0x3e1d('0x6a')]=_0x3e1d('0x1b9');this[_0x3e1d('0x120')](_0x3c967f,_0x326770,_0x552e87,_0x3edbfe);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x120')]=function(_0xbc78f5,_0x3c3952,_0x454489,_0x36b111){hopperUtils[_0x3e1d('0xc8')](_0xbc78f5)[_0x3e1d('0x9b')](function(){return _0x3c3952(msgResponse(_0x3e1d('0x198'),'Success',_0x36b111));})['catch'](function(){return _0x454489(msgResponse(_0x3e1d('0x1ba'),_0x3e1d('0x8e'),_0x3e1d('0x1bb')));});};Dialer[_0x3e1d('0x80')]['predictive']=function(_0x53bd03){var _0x232a33=_0x53bd03[_0x3e1d('0x1bc')]/0x64;var _0x495019=_0x53bd03[_0x3e1d('0xcc')]/(_0x53bd03[_0x3e1d('0xcc')]+_0x53bd03[_0x3e1d('0xc3')]);var _0x57e65=Math[_0x3e1d('0x1bd')](_0x53bd03[_0x3e1d('0x1be')]*(_0x53bd03[_0x3e1d('0x1bf')]/0x64));var _0x4e6484=Math[_0x3e1d('0x1bd')](_0x53bd03[_0x3e1d('0x1be')]*(_0x53bd03[_0x3e1d('0x1c0')]/0x64));var _0xb5d715=_0x53bd03[_0x3e1d('0x131')]+_0x53bd03[_0x3e1d('0x133')];var _0x3d1536=Math[_0x3e1d('0x1c1')](_0x53bd03[_0x3e1d('0x54')]*_0x53bd03[_0x3e1d('0x1c2')]*_0x53bd03[_0x3e1d('0x1c3')]*_0x53bd03[_0x3e1d('0x1c4')]);if(_['isUndefined'](_0x53bd03[_0x3e1d('0x1f')])){if(!_['isUndefined'](_0x53bd03[_0x3e1d('0x1e')])){_0x53bd03[_0x3e1d('0x1e')]=undefined;loggerPredictive[_0x3e1d('0x5f')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x3e1d('0x38')](_0x53bd03['handlePredictive'])){loggerPredictive[_0x3e1d('0x5f')](_0x3e1d('0x1c5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x53bd03[_0x3e1d('0x5d')]);_0x53bd03[_0x3e1d('0x5d')]=undefined;}_0x53bd03[_0x3e1d('0x1f')]=moment()['format'](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],'collection\x20data\x20in\x20progressive\x20at',_0x53bd03[_0x3e1d('0x1f')]);this[_0x3e1d('0xb2')](_0x53bd03,0x1);}else if(ifInterval(_0x53bd03['dialPredictiveInterval'],_0x53bd03[_0x3e1d('0x1f')])){this[_0x3e1d('0xb2')](_0x53bd03,0x1);loggerPredictiveCalls[_0x3e1d('0x40')](_0x3e1d('0x1c6'),_0x53bd03[_0x3e1d('0x1f')],_0x53bd03[_0x3e1d('0x5c')]);_0x53bd03[_0x3e1d('0x54')]=0x0;_0x53bd03[_0x3e1d('0xcd')]=0x0;}else if(_0x232a33<_0x495019&&_0x53bd03['dialPredictiveOptimization']===_0x3e1d('0x1c7')){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x1c8'),_0x3e1d('0x1c9'),_0x495019,_0x3e1d('0x1f'),_0x53bd03['name']);}else if(_0x3d1536<_0x53bd03[_0x3e1d('0xcd')]&&_0x53bd03[_0x3e1d('0x1ca')]===_0x3e1d('0x1c7')){clearPredictiveAttributes(_0x53bd03);loggerPredictive['info'](_0x3e1d('0x1cb'),_0x3e1d('0x1cc'),_0x3d1536,_0x3e1d('0x1cd'),_0x53bd03[_0x3e1d('0xcd')],_0x3e1d('0x1f'),_0x53bd03['name']);}else if(!ifInterval(_0x53bd03[_0x3e1d('0x1ce')],_0x53bd03[_0x3e1d('0x1f')])&&_[_0x3e1d('0x38')](_0x53bd03['startPredictive'])&&!_['isUndefined'](_0x53bd03[_0x3e1d('0x1f')])){_0x53bd03[_0x3e1d('0x1e')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],_0x3e1d('0x1cf'),_0x53bd03[_0x3e1d('0x1e')]);hopperUtils[_0x3e1d('0x1d0')](_0x53bd03['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x53bd03))['then'](mergeDataErlangB(_0x53bd03))[_0x3e1d('0x9b')](this[_0x3e1d('0x1d1')](_0x53bd03))[_0x3e1d('0xa6')](loggerCatchPredictive(_0x3e1d('0x1d2'),_0x53bd03));}else if(!ifInterval(_0x53bd03[_0x3e1d('0x1ce')],_0x53bd03['startPredictive'])){_0x53bd03[_0x3e1d('0xcd')]=0x0;_0x53bd03[_0x3e1d('0x1e')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03['name'],_0x3e1d('0x1d3'),_0x53bd03['startPredictive']);clearInterval(_0x53bd03[_0x3e1d('0x5d')]);_0x53bd03[_0x3e1d('0x5d')]=undefined;hopperUtils[_0x3e1d('0x1d0')](_0x53bd03[_0x3e1d('0x1ce')])[_0x3e1d('0x9b')](this[_0x3e1d('0x1d4')](_0x53bd03))[_0x3e1d('0x9b')](mergeDataErlangB(_0x53bd03))[_0x3e1d('0x9b')](this[_0x3e1d('0x1d1')](_0x53bd03))[_0x3e1d('0xa6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x53bd03));}else if(_0x53bd03['predictiveIntervalAvailable']&&_0xb5d715<_0x53bd03[_0x3e1d('0x1be')]-_0x4e6484){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xb5d715,_0x3e1d('0x1d5'),_0x53bd03['predictiveIntervalAvailable'],'-',_0x4e6484,'=',_0x53bd03[_0x3e1d('0x1be')]-_0x4e6484,')');}else if(_0x53bd03['predictiveIntervalAvailable']&&_0xb5d715>_0x53bd03[_0x3e1d('0x1be')]+_0x57e65){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],_0x3e1d('0x1d6'),_0xb5d715,_0x3e1d('0x1d7'),_0x53bd03[_0x3e1d('0x1be')],'+',_0x57e65,'=',_0x53bd03[_0x3e1d('0x1be')]+_0x57e65,')');}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1d4')]=function(_0x458d5c){var _0x24ca6b=this;return function(_0x425508){return new Promise(function(_0x6a2b89,_0x36e7d1){_[_0x3e1d('0x59')](_0x458d5c,_0x425508[0x0]);if(checkGetDataPredictive(_0x425508[0x0])){var _0x599305=_0x458d5c[_0x3e1d('0x1be')]=_0x458d5c[_0x3e1d('0x133')]+_0x458d5c[_0x3e1d('0x131')];var _0x342be3=_0x458d5c[_0x3e1d('0x1ce')]*0x3c;var _0x30df7f=_0x425508[0x0][_0x3e1d('0x4d')]+_0x425508[0x0][_0x3e1d('0x4b')];var _0xcff4c3=(_0x425508[0x0][_0x3e1d('0x45')]+_0x425508[0x0][_0x3e1d('0x47')]+_0x425508[0x0][_0x3e1d('0x49')])/_0x425508[0x0]['predictiveIntervalTotalCalls'];_0x458d5c[_0x3e1d('0x1c3')]=_0xcff4c3>0x0?_0xcff4c3:0x1;switch(_0x458d5c[_0x3e1d('0x1ca')]){case'dropRate':var _0xa7d44f=_0x458d5c[_0x3e1d('0x1bc')]/0x64;return _0x24ca6b['abandonmentRate'](_0x599305,_0x342be3,_0x30df7f,_0xcff4c3,_0xa7d44f)[_0x3e1d('0x9b')](function(_0xdc925c){return _0x6a2b89(_0xdc925c);});case _0x3e1d('0x1d8'):var _0x4b6308=_0x458d5c[_0x3e1d('0x1bc')]/0x64;return _0x24ca6b[_0x3e1d('0x1d9')](_0x599305,_0x342be3,_0x30df7f,_0xcff4c3,_0x4b6308)[_0x3e1d('0x9b')](function(_0xa19e14){return _0x6a2b89(_0xa19e14);});default:return _0x36e7d1(msgResponse(_0x3e1d('0x1da'),_0x3e1d('0x8e'),_0x3e1d('0x1db')));}}else{return _0x36e7d1(msgResponse(_0x3e1d('0x1da'),_0x3e1d('0x8e'),_0x3e1d('0x1dc')));}});};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1dd')]=function(_0x2e2aba){var _0x5e4cf7=this;return function(_0x2b859b){return new Promise(function(_0x1cedb7,_0x6c468b){_[_0x3e1d('0x59')](_0x2e2aba,_0x2b859b[0x0]);if(checkGetDataPredictive(_0x2b859b[0x0])){loggerPredictive[_0x3e1d('0x40')](JSON[_0x3e1d('0x6e')](_0x2b859b[0x0]));if(_0x2e2aba[_0x3e1d('0x1ca')]==='dropRate'){return _0x5e4cf7[_0x3e1d('0x144')](_0x2e2aba['id'])[_0x3e1d('0x9b')](function(_0xfa5ec8){var _0x19708f=_0x2e2aba[_0x3e1d('0x1de')]-_0xfa5ec8[0x0][_0x3e1d('0x1df')];var _0x6c72e8=_0x2e2aba[_0x3e1d('0x1ce')]*0x3c;var _0x36466b=_0x2b859b[0x0][_0x3e1d('0x4d')]+_0x2b859b[0x0][_0x3e1d('0x4b')];var _0x234d4a=(_0x2b859b[0x0][_0x3e1d('0x45')]+_0x2b859b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2b859b[0x0][_0x3e1d('0x49')])/_0x2b859b[0x0][_0x3e1d('0x43')];var _0x36306e=_0x2e2aba[_0x3e1d('0x1bc')]/0x64;_0x2e2aba[_0x3e1d('0x1e0')]=_0xfa5ec8[0x0][_0x3e1d('0x1df')]||0x0;_0x2e2aba['predictiveIntervalHitRate']=_0x234d4a>0x0?_0x234d4a:0x1;return _0x5e4cf7['abandonmentRate'](_0x19708f,_0x6c72e8,_0x36466b,_0x234d4a,_0x36306e);})[_0x3e1d('0x9b')](function(_0x2dc5ba){return _0x1cedb7(_0x2dc5ba);})['catch'](function(_0x4ac7f7){return _0x6c468b(msgResponse(_0x3e1d('0x1e1'),_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x4ac7f7)));});}if(_0x2e2aba[_0x3e1d('0x1ca')]==='agentBusyFactor'){return _0x5e4cf7[_0x3e1d('0x144')](_0x2e2aba['id'])[_0x3e1d('0x9b')](function(_0x1d5a03){var _0x12d2b4=_0x2e2aba['loggedIn']-_0x1d5a03[0x0]['outboundQueuePauses'];var _0x2df508=_0x2e2aba[_0x3e1d('0x1ce')]*0x3c;var _0x12dfab=_0x2b859b[0x0][_0x3e1d('0x4d')]+_0x2b859b[0x0]['predictiveIntervalAvgHoldtime'];var _0x338755=(_0x2b859b[0x0][_0x3e1d('0x45')]+_0x2b859b[0x0][_0x3e1d('0x47')]+_0x2b859b[0x0][_0x3e1d('0x49')])/_0x2b859b[0x0]['predictiveIntervalTotalCalls'];var _0x230d73=_0x2e2aba['dialPredictiveOptimizationPercentage']/0x64;_0x2e2aba[_0x3e1d('0x1e0')]=_0x1d5a03[0x0][_0x3e1d('0x1df')]||0x0;_0x2e2aba['predictiveIntervalHitRate']=_0x338755>0x0?_0x338755:0x1;return _0x5e4cf7[_0x3e1d('0x1d9')](_0x12d2b4,_0x2df508,_0x12dfab,_0x338755,_0x230d73);})['then'](function(_0x940d67){return _0x1cedb7(_0x940d67);})[_0x3e1d('0xa6')](function(_0x5c75be){return _0x6c468b(msgResponse(_0x3e1d('0x1e1'),_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x5c75be)));});}}else{return _0x6c468b(msgResponse('[getDataPredictive]',_0x3e1d('0x8e'),_0x3e1d('0x1dc')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x25a06b){var _0x490174=this;return function(){var _0x30a3bf=0x0;var _0x577d78=Math['floor'](_0x25a06b[_0x3e1d('0x56')]*0x3e8);if(_0x577d78>0x0){_0x577d78=_0x577d78<0x64?0x64:_0x577d78;loggerPredictive[_0x3e1d('0x40')](_0x25a06b[_0x3e1d('0x5c')],_0x3e1d('0x1e2'),_0x577d78,_0x3e1d('0x1e3'));_0x25a06b['handlePredictive']=setInterval(function(){_0x490174[_0x3e1d('0x5d')](_0x25a06b);loggerPredictiveCalls[_0x3e1d('0x40')](_0x3e1d('0x1e4'),_0x30a3bf+=0x1);},_0x577d78);}else{loggerPredictive[_0x3e1d('0x40')](_0x25a06b[_0x3e1d('0x5c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x54f48a,_0x300c11){var _0x11b158=this;return function(_0xd80842){if(_[_0x3e1d('0x3f')](_0xd80842)){if(_[_0x3e1d('0xef')](_0x300c11[_0x3e1d('0x1e5')])||!_0x300c11['recallme']){if(_0x54f48a['dialMethod']===_0x3e1d('0xb4')){_0x54f48a[_0x3e1d('0x6b')]=_[_0x3e1d('0x38')](_0x54f48a[_0x3e1d('0x6b')])?!![]:_0x54f48a['queueStatusComplete'];var _0x32c157=uuid['v4']();_0x11b158['actions'][_0x32c157]=new Action(_0x54f48a,_0x300c11,_0x32c157);loggerBooked[_0x3e1d('0x40')]('[booked][checkContactBlack]',_0x32c157,_0x3e1d('0x1e6'),JSON[_0x3e1d('0x6e')](_0x54f48a['queueStatusComplete']),'Queue:\x20',_0x54f48a[_0x3e1d('0x5c')]);if(_0x54f48a['queueStatusComplete']){_0x54f48a['queueStatusComplete']=![];_0x11b158[_0x3e1d('0x21')][_0x11b158['actions'][_0x32c157][_0x3e1d('0xbd')]]=[];ami['Action']({'actionid':_0x32c157,'action':'queuestatus','queue':_0x54f48a['name']})[_0x3e1d('0xa6')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x11b158['actions'][_0x32c157][_0x3e1d('0xd9')],'ListId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xda')],'VoiceQueueId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xe7')]||undefined,'CampaignId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1e7')));delete _0x11b158['actions'][_0x32c157];});}else{loggerBooked['info'](_0x3e1d('0x1e8'),JSON['stringify'](_0x54f48a[_0x3e1d('0x6b')]),_0x3e1d('0x1e9'),_0x54f48a['name']);_0x11b158[_0x3e1d('0xc1')](_0x54f48a);hopperUtils[_0x3e1d('0xd6')]({'active':![],'ContactId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xd9')],'ListId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xda')],'VoiceQueueId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xe7')]||undefined,'CampaignId':_0x11b158[_0x3e1d('0x1b')][_0x32c157]['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1e7')));delete _0x11b158[_0x3e1d('0x1b')][_0x32c157];}}else{return _0x11b158[_0x3e1d('0x153')](_0x54f48a,_0x300c11);}}else{if(utils[_0x3e1d('0x5a')](undefined,_0x300c11[_0x3e1d('0x1ea')])<_0x54f48a[_0x3e1d('0x1eb')]*0x3c){if(_0x300c11[_0x3e1d('0x150')]&&!_0x300c11[_0x3e1d('0x150')][_0x3e1d('0x1ec')]){_0x11b158[_0x3e1d('0x15')][_0x3e1d('0xf6')](_0x300c11['id'])[_0x3e1d('0x13')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);});}else{hopperUtils[_0x3e1d('0x1ed')]({'active':![]},_0x300c11['id'],0x1)[_0x3e1d('0x13')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);});}}else{_0x54f48a[_0x3e1d('0x1ee')]+=0x1;_0x11b158[_0x3e1d('0xc1')](_0x54f48a);if(_0x54f48a[_0x3e1d('0x1ef')]){hopperUtils[_0x3e1d('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x300c11[_0x3e1d('0xd9')],'ListId':_0x300c11[_0x3e1d('0xda')],'VoiceQueueId':_0x300c11['VoiceQueueId']||undefined,'CampaignId':_0x300c11[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x3e1d('0xc7')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f0')],0x17,'RecallInQueue'))[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1f1')));}else{_0x11b158[_0x3e1d('0x114')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f2')],0x16,_0x3e1d('0x1f3')),_0x3e1d('0x1f4'),_0x3e1d('0x1f5'));}}}}else{_0x54f48a[_0x3e1d('0x1f6')]+=0x1;_0x11b158[_0x3e1d('0x114')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f7')],0xd,_0x3e1d('0x1f8')),'[Originate][historyBlacklist]',_0x3e1d('0x1f9'));throw _0x3e1d('0x1fa');}};};Dialer['prototype']['handleIvr']=function(_0x386175){var _0x26c8dc=this;var _0x3517a3=_0x386175[_0x3e1d('0x1fb')]-_0x386175['originated'];emitCampaignSummary(_0x386175);if(_0x3517a3>0x0&&_0x386175[_0x3e1d('0x62')]==0x0){if(_0x3517a3>this[_0x3e1d('0x19')]){_0x3517a3=this['maxNumberOriginate'];}_0x386175[_0x3e1d('0x62')]=0x1;hopperUtils[_0x3e1d('0x1fc')](_0x386175,_0x3517a3)[_0x3e1d('0x9b')](function(_0xbbb528){_0x386175[_0x3e1d('0x62')]=0x0;if(_0xbbb528){if(!utils['checkContactEmpty'](_0xbbb528)){_0x386175[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x69')];logger[_0x3e1d('0x40')]('[getContactCampaign2][Empty]'+_0x386175[_0x3e1d('0x5c')]);}else{_0x386175['originated']+=_0xbbb528[_0x3e1d('0x96')];_0x386175[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x1fd')];for(var _0x503672=0x0;_0x503672<_0xbbb528['length'];_0x503672+=0x1){_0x386175[_0x3e1d('0x1fe')]+=0x1;if(_[_0x3e1d('0xef')](_0xbbb528[_0x503672])||_['isNil'](_0xbbb528[_0x503672][_0x3e1d('0x172')])||_[_0x3e1d('0xef')](_0xbbb528[_0x503672]['phone'])){_0x26c8dc[_0x3e1d('0x149')]('[actionOriginate]\x20',_0x386175,_0xbbb528[_0x503672]);}else{hopperUtils[_0x3e1d('0x1ff')](_[_0x3e1d('0xf3')](_0xbbb528[_0x503672],['CampaignId',_0x3e1d('0x156')]))[_0x3e1d('0x9b')](_0x26c8dc['checkContactBlack'](_0x386175,_0xbbb528[_0x503672]))[_0x3e1d('0xa6')](_0x26c8dc[_0x3e1d('0x148')]('[actionOriginateIvr]\x20',_0x386175));}}}}})['catch'](loggerGetContactDialer(_0x3e1d('0x200'),_0x386175,_0x3517a3));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0xb2')]=function(_0x41cad3,_0x456cc5){var _0x51abb2=this;var _0x2f598d=[];if(_0x456cc5<0x1||_0x41cad3['dialMethod']===_0x3e1d('0xb4')){_0x456cc5=0x1;}var _0x2a96d3=Math[_0x3e1d('0x1c1')](_0x41cad3[_0x3e1d('0x131')]*_0x456cc5)-_0x41cad3[_0x3e1d('0x78')];if(_0x41cad3[_0x3e1d('0x201')]>0x0){var _0x3a75d3=_0x41cad3[_0x3e1d('0x201')]-_0x41cad3[_0x3e1d('0x78')]-_0x41cad3[_0x3e1d('0x133')]-_0x41cad3[_0x3e1d('0x202')];if(_0x2a96d3>_0x3a75d3){_0x2a96d3=_0x3a75d3;}}if(_0x2a96d3>0x0&&_0x41cad3[_0x3e1d('0x62')]==0x0){if(_0x41cad3['dialMethod']==='booked'){_0x2a96d3=0x1;}if(_0x2a96d3>this[_0x3e1d('0x19')]){_0x2a96d3=this[_0x3e1d('0x19')];}for(var _0x387ffb in this[_0x3e1d('0x17')]){if(typeof this['agents'][_0x387ffb]!=='undefined'){if(this[_0x3e1d('0x17')][_0x387ffb][_0x3e1d('0xce')]===_0x3e1d('0x203')&&this[_0x3e1d('0x17')][_0x387ffb]['status']==='reachable'){_0x2f598d['push'](this['agents'][_0x387ffb]['id']);}}}_0x41cad3[_0x3e1d('0x62')]=0x1;hopperUtils[_0x3e1d('0x204')](_0x41cad3,_0x2f598d,_0x2a96d3)[_0x3e1d('0x9b')](function(_0x521677){_0x41cad3[_0x3e1d('0x62')]=0x0;if(_0x521677){if(!utils['checkContactEmpty'](_0x521677)){hopperUtils[_0x3e1d('0x205')](_0x41cad3)['then'](sendMessageReschedule(_0x41cad3))[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x206')));}else{_0x41cad3[_0x3e1d('0x78')]+=_0x521677[_0x3e1d('0x96')];_0x41cad3[_0x3e1d('0x64')]=_0x41cad3[_0x3e1d('0xb0')]===_0x3e1d('0xb4')?utils['CAMPAIGN_STATUS'][_0x3e1d('0x134')]:utils['CAMPAIGN_STATUS'][_0x3e1d('0x1fd')];for(var _0x2bde70=0x0;_0x2bde70<_0x521677['length'];_0x2bde70+=0x1){if(_['isNil'](_0x521677[_0x2bde70])||_[_0x3e1d('0xef')](_0x521677[_0x2bde70][_0x3e1d('0x172')])||_['isNil'](_0x521677[_0x2bde70][_0x3e1d('0x156')])){_0x51abb2[_0x3e1d('0x149')]('[actionOriginate]\x20',_0x41cad3,_0x521677[_0x2bde70]);}else{hopperUtils[_0x3e1d('0x207')](_[_0x3e1d('0xf3')](_0x521677[_0x2bde70],['VoiceQueueId',_0x3e1d('0x156')]))['then'](_0x51abb2[_0x3e1d('0x208')](_0x41cad3,_0x521677[_0x2bde70]))[_0x3e1d('0xa6')](_0x51abb2['loggerHandler'](_0x3e1d('0x209'),_0x41cad3));}}}}})[_0x3e1d('0xa6')](loggerGetContactDialer(_0x3e1d('0x20a'),_0x41cad3,_0x2a96d3));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x5d')]=function(_0x395839){if(_0x395839[_0x3e1d('0x201')]>0x0){var _0x250f0e=_0x395839[_0x3e1d('0x201')]-_0x395839[_0x3e1d('0x78')]-_0x395839[_0x3e1d('0x133')];if(_0x250f0e>0x0&&_0x395839['temp']==0x0){this[_0x3e1d('0x20b')](_0x395839);}else{loggerPredictiveCalls[_0x3e1d('0x40')]('[handlePredictive][limitChannel]');}}else{this[_0x3e1d('0x20b')](_0x395839);}};Dialer['prototype'][_0x3e1d('0x20b')]=function(_0xd9976d){var _0x5df307=this;var _0x200d60=[];_0xd9976d[_0x3e1d('0x78')]+=0x1;for(var _0x36fb07 in this['agents']){if(typeof this[_0x3e1d('0x17')][_0x36fb07]!==_0x3e1d('0x140')){if(this['agents'][_0x36fb07][_0x3e1d('0xce')]===_0x3e1d('0x203')&&this[_0x3e1d('0x17')][_0x36fb07][_0x3e1d('0x84')]===_0x3e1d('0x85')){_0x200d60[_0x3e1d('0x97')](this[_0x3e1d('0x17')][_0x36fb07]['id']);}}}_0xd9976d[_0x3e1d('0x62')]=0x1;return this[_0x3e1d('0x204')](_0xd9976d['id'],_0x200d60,0x1,_0xd9976d['dialOrderByScheduledAt'],_0xd9976d)[_0x3e1d('0x9b')](function(_0xdba3d2){_0xd9976d[_0x3e1d('0x62')]=0x1;if(_0xdba3d2){if(!utils[_0x3e1d('0x20c')](_0xdba3d2)){utils[_0x3e1d('0x61')](_0xd9976d,0x1,0x0);return hopperUtils[_0x3e1d('0x205')](_0xd9976d)[_0x3e1d('0x9b')](sendMessageReschedule(_0xd9976d))['catch'](loggerCatch(_0x3e1d('0x206')));}else{_0xd9976d[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x1fd')];if(_[_0x3e1d('0xef')](_0xdba3d2[0x0])||_['isNil'](_0xdba3d2[0x0][_0x3e1d('0x172')])||_[_0x3e1d('0xef')](_0xdba3d2[0x0]['phone'])){_0x5df307[_0x3e1d('0x149')](_0x3e1d('0x209'),_0xd9976d,_0xdba3d2[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0xdba3d2[0x0],['VoiceQueueId',_0x3e1d('0x156')]))[_0x3e1d('0x9b')](_0x5df307['checkContactBlack'](_0xd9976d,_0xdba3d2[0x0]))['catch'](_0x5df307[_0x3e1d('0x148')](_0x3e1d('0x20d'),_0xd9976d));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0xd9976d,0x1));};Dialer[_0x3e1d('0x80')][_0x3e1d('0x20e')]=function(_0x1fba22,_0x19bdf9,_0x441bdc,_0xa22204,_0x2bc0ca,_0x3a33bd){loggerPredictive[_0x3e1d('0x40')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x3e1d('0x40')]('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',_0x1fba22);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x20f'),_0x19bdf9);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x210'),_0x441bdc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x211'),_0xa22204);loggerPredictive['info'](_0x3e1d('0x212'),_0x2bc0ca);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));return new Promise(function(_0x342b63,_0x42e84c){if(_0x1fba22<=0x0||isNaN(_0x1fba22)){return _0x42e84c(msgResponse('[abandonmentRate]',_0x3e1d('0x7f'),'m\x20=\x20'+_0x1fba22));}if(_0x441bdc<=0x0||isNaN(_0x441bdc)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),'Error','Ts\x20=\x20'+_0x441bdc));}if(_0xa22204<=0x0||isNaN(_0xa22204)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),_0x3e1d('0x7f'),'p\x20=\x20'+_0xa22204));}if(_0x19bdf9<=0x0||isNaN(_0x19bdf9)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),_0x3e1d('0x7f'),_0x3e1d('0x214')+_0x19bdf9));}if(_0x2bc0ca<=0x0||isNaN(_0x2bc0ca)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),'Error',_0x3e1d('0x215')+_0x2bc0ca));}_0x3a33bd=_0x3a33bd||0x0;var _0x2c70c7=0x1/_0x441bdc;var _0x2135c5=0x0;var _0x5e5b3e=0x0;var _0x12b82b=0x0;var _0x4c3bec=0x0;for(var _0x3c8e68=0x0;_0x12b82b<_0x2bc0ca;_0x3c8e68+=0x1){_0x5e5b3e=_0x3c8e68/_0x19bdf9;_0x2135c5=(_0xa22204*_0x5e5b3e+_0x3a33bd)/_0x2c70c7;_0x12b82b=utils['erlangb'](_0x2135c5,_0x1fba22);_0x4c3bec=_0x2135c5/_0x1fba22*(0x1-utils[_0x3e1d('0x216')](_0x2135c5,_0x1fba22));}return _0x342b63({'erlangCalls':_0x3c8e68,'erlangCallToSecond':_0x19bdf9/_0x3c8e68,'erlangAbandonmentRate':_0x12b82b,'erlangBusyFactor':_0x4c3bec});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1d9')]=function(_0x5d1327,_0x2956fc,_0x9d744f,_0x3069bc,_0x3a49d0,_0xf41ba7){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x217'));loggerPredictive[_0x3e1d('0x40')]('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',_0x5d1327);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x20f'),_0x2956fc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x210'),_0x9d744f);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x211'),_0x3069bc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x218'),_0x3a49d0);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));return new Promise(function(_0x202f38,_0xb88739){if(_0x5d1327<=0x0||isNaN(_0x5d1327)){return _0xb88739(msgResponse(_0x3e1d('0x219'),_0x3e1d('0x7f'),'m\x20=\x20'+_0x5d1327));}if(_0x9d744f<=0x0||isNaN(_0x9d744f)){return _0xb88739(msgResponse(_0x3e1d('0x219'),_0x3e1d('0x7f'),_0x3e1d('0x21a')+_0x9d744f));}if(_0x3069bc<=0x0||isNaN(_0x3069bc)){return _0xb88739(msgResponse('[busyFactor]',_0x3e1d('0x7f'),_0x3e1d('0x21b')+_0x3069bc));}if(_0x2956fc<=0x0||isNaN(_0x2956fc)){return _0xb88739(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x2956fc));}if(_0x3a49d0<=0x0||isNaN(_0x3a49d0)){return _0xb88739(msgResponse(_0x3e1d('0x219'),'Error','Umin\x20=\x20'+_0x3a49d0));}_0xf41ba7=_0xf41ba7||0x0;var _0x3b7ee5=0x1/_0x9d744f;var _0x13302d=0x0;var _0x4f4ae3=0x0;var _0x3d3611=0x0;var _0x82c09f=0x0;for(var _0x4ece90=0x0;_0x82c09f<_0x3a49d0;_0x4ece90+=0x1){_0x4f4ae3=_0x4ece90/_0x2956fc;_0x13302d=(_0x3069bc*_0x4f4ae3+_0xf41ba7)/_0x3b7ee5;_0x3d3611=utils[_0x3e1d('0x216')](_0x13302d,_0x5d1327);_0x82c09f=_0x13302d/_0x5d1327*(0x1-utils[_0x3e1d('0x216')](_0x13302d,_0x5d1327));}return _0x202f38({'erlangCalls':_0x4ece90,'erlangCallToSecond':_0x2956fc/_0x4ece90,'erlangAbandonmentRate':_0x3d3611,'erlangBusyFactor':_0x82c09f});});};module[_0x3e1d('0x21c')]=Dialer; \ No newline at end of file +var _0xee42=['object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject2','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','stateGlobal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','run','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','enqueue','tail','finally','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','handlePredictive','debug','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','prototype','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','iftime\x20%s,%s','interval','content','indexOf','catch','Action','true','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','campaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','silly','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','Error','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','syncAgentComplete','outboundAnswerCallsDay','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','minutes','[rescheduleContact][Abandoned]','actions','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','pick','idHopper','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','getQueue','response','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','countbusyretry','dialGlobalMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','checkPreviewRecallReminder','handleIvr'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee42,0xcd));var _0x2ee4=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xee42[_0x47a349];return _0x18ab75;};'use strict';var util=require(_0x2ee4('0x0'));var _=require(_0x2ee4('0x1'));var uuid=require(_0x2ee4('0x2'));var moment=require(_0x2ee4('0x3'));var rr=require('rr');var Redis=require(_0x2ee4('0x4'));var utils=require(_0x2ee4('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x2ee4('0x6'));var config=require(_0x2ee4('0x7'));var logger=require('../../../config/logger')(_0x2ee4('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require('../../../config/logger')(_0x2ee4('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0x2ee4('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x2ee4('0xb'));var ami=require(_0x2ee4('0xc'));config['redis']=_[_0x2ee4('0xd')](config['redis'],{'host':_0x2ee4('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2ee4('0xf')]));var cmHopper=require(_0x2ee4('0x10'));var voiceQueueRt=require(_0x2ee4('0x11'));var RpcSetting=require(_0x2ee4('0x12'));var Interval=require(_0x2ee4('0x13'));var Action=require(_0x2ee4('0x14'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x2ee4('0x15'));var QueueCallerAbandon=require(_0x2ee4('0x16'));var Hangup=require(_0x2ee4('0x17'));var ipAgi=process[_0x2ee4('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x2ee4('0x19')]=function(_0x309346){this[_0x2ee4('0x1a')]=this[_0x2ee4('0x1a')]?this[_0x2ee4('0x1a')][_0x2ee4('0x1b')](_0x309346):_0x309346();};function Dialer(_0x15f13b,_0x418a0f){this['sequence']=new Sequence();this[_0x2ee4('0x1c')]=_0x418a0f;this[_0x2ee4('0x1d')]=_0x15f13b[_0x2ee4('0x1d')];this['campaigns']=_0x15f13b['campaigns'];this[_0x2ee4('0x1e')]=_0x15f13b['agents'];this[_0x2ee4('0x1f')]=_0x15f13b['trunks'];this['maxNumberOriginate']=config[_0x2ee4('0x20')]||0x2;this[_0x2ee4('0x21')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0x2ee4('0x22')]={};this[_0x2ee4('0x23')]={};this['startProgressive']={};this[_0x2ee4('0x24')]={};this[_0x2ee4('0x25')]={};this[_0x2ee4('0x26')]={};this[_0x2ee4('0x27')]={};ami['on']('agentconnect',this[_0x2ee4('0x28')][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x2a'),this[_0x2ee4('0x2b')][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x2c'),this[_0x2ee4('0x2d')]['bind'](this));ami['on'](_0x2ee4('0x2e'),this['syncAgentComplete'][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x2f'),this[_0x2ee4('0xb')][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x30'),this[_0x2ee4('0x31')]['bind'](this));ami['on']('hangup',this[_0x2ee4('0x32')][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x33'),this['syncNewExten'][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x34'),this[_0x2ee4('0x35')][_0x2ee4('0x29')](this));ami['on'](_0x2ee4('0x36'),this[_0x2ee4('0x37')]['bind'](this));ami['on'](_0x2ee4('0x38'),this[_0x2ee4('0x39')][_0x2ee4('0x29')](this));this[_0x2ee4('0x3a')]();this[_0x2ee4('0x3b')]();RpcSetting[_0x2ee4('0x3c')]()[_0x2ee4('0x3d')](function(_0x3b0e24){previewRecallmeReminderInterval=_0x3b0e24[_0x2ee4('0x3e')];});}function isNotNull(_0x51c151){return _0x51c151!==null&&!_['isUndefined'](_0x51c151);}function msgResponse(_0x4fb3f8,_0x51e87f,_0x402829){return{'action':_0x4fb3f8,'response':_0x51e87f,'message':_0x402829,'stack':_0x402829};}function emit(_0x5e3437,_0x38a0b5,_0x2f5bac){io['to'](_0x5e3437)[_0x2ee4('0x3f')](_0x38a0b5,_0x2f5bac);}function emitOutboundVoiceQueueSummary(_0x3473ba){if(_0x3473ba[_0x2ee4('0x40')]===_0x2ee4('0x41')){logger['debug'](_0x2ee4('0x42'),util[_0x2ee4('0x43')](_0x3473ba,{'showHidden':![],'depth':null}));emit(util[_0x2ee4('0x44')](_0x2ee4('0x45'),_0x3473ba[_0x2ee4('0x46')]),_0x2ee4('0x47'),_0x3473ba);}}function checkGetDataPredictive(_0x4e687a){if(isNotNull(_0x4e687a)&&!_[_0x2ee4('0x48')](_0x4e687a)){loggerPredictive['info'](_0x2ee4('0x49'));loggerPredictive['info'](_0x2ee4('0x4a'),_0x4e687a['predictiveIntervalTotalCalls']);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x4c'),_0x4e687a[_0x2ee4('0x4d')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x4e'),_0x4e687a[_0x2ee4('0x4f')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x50'),_0x4e687a['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x51'),_0x4e687a[_0x2ee4('0x52')]);loggerPredictive['info'](_0x2ee4('0x53'),_0x4e687a[_0x2ee4('0x54')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x55'));if(_0x4e687a[_0x2ee4('0x56')]>0x0){if(!_['isUndefined'](_0x4e687a[_0x2ee4('0x54')])&&_0x4e687a[_0x2ee4('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x2ee4('0x57'));if(!_[_0x2ee4('0x58')](_0x4e687a[_0x2ee4('0x52')])&&_0x4e687a[_0x2ee4('0x52')]>0x0){return!![];}loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x59'));}else{loggerPredictive['info'](_0x2ee4('0x5a'));}}else{loggerPredictive[_0x2ee4('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1e34e4){return function(_0x33cf1b){loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x5b'));loggerPredictive[_0x2ee4('0x4b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33cf1b[_0x2ee4('0x5c')]);loggerPredictive[_0x2ee4('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33cf1b[_0x2ee4('0x5d')]);loggerPredictive['info'](_0x2ee4('0x5e'),_0x33cf1b[_0x2ee4('0x5f')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x60'),_0x33cf1b[_0x2ee4('0x61')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x5e'),_0x33cf1b[_0x2ee4('0x5f')]);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x55'));_[_0x2ee4('0x62')](_0x1e34e4,_0x33cf1b);};}function ifInterval(_0x42dda0,_0x536c9d){if(_[_0x2ee4('0x58')](_0x536c9d)){return![];}return utils[_0x2ee4('0x63')](undefined,_0x536c9d)<_0x42dda0*0x3c;}function clearPredictiveAttributes(_0x12c3ea){if(_0x12c3ea['startProgressive']){_0x12c3ea[_0x2ee4('0x64')]=undefined;loggerPredictive['debug'](_0x12c3ea['name'],'startProgressive\x20value\x20cleared');}if(_0x12c3ea['startPredictive']){_0x12c3ea[_0x2ee4('0x23')]=undefined;loggerPredictive['debug'](_0x12c3ea[_0x2ee4('0x46')],'startPredictive\x20value\x20cleared');}if(_0x12c3ea[_0x2ee4('0x65')]){clearInterval(_0x12c3ea['handlePredictive']);_0x12c3ea['handlePredictive']=undefined;loggerPredictive[_0x2ee4('0x66')](_0x12c3ea[_0x2ee4('0x46')],_0x2ee4('0x67'));}}function loggerCatchPredictive(_0x5ac18a,_0x3d92c4){return function(_0x2d0bd4){loggerPredictive[_0x2ee4('0x68')](_0x3d92c4[_0x2ee4('0x46')],_0x5ac18a);loggerPredictive[_0x2ee4('0x68')](_0x2d0bd4[_0x2ee4('0x69')]);clearPredictiveAttributes(_0x3d92c4);};}function loggerCatch(_0x530fe3){return function(_0x2f79e0){logger[_0x2ee4('0x68')](_0x530fe3,util[_0x2ee4('0x43')](_0x2f79e0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x57fe19,_0x13c08b,_0x347a47){return function(_0x57a04e){utils[_0x2ee4('0x6a')](_0x13c08b,_0x347a47,0x0);_0x13c08b[_0x2ee4('0x6b')]=0x0;logger[_0x2ee4('0x68')](_0x57fe19,util[_0x2ee4('0x43')](_0x57a04e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1a4631){return function(_0x4a398d){if(isNotNull(_0x4a398d)&&isNotNull(_0x4a398d[0x0])){if(_0x4a398d[0x0][_0x2ee4('0x6c')]>0x0){_0x1a4631['message']=utils[_0x2ee4('0x6d')][_0x2ee4('0x6e')];logger[_0x2ee4('0x4b')](_0x2ee4('0x6f')+_0x1a4631[_0x2ee4('0x46')],_0x4a398d[0x0]['contactsRescheduled'],_0x2ee4('0x70'));}else{_0x1a4631[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x72')];logger['info'](_0x2ee4('0x73')+_0x1a4631[_0x2ee4('0x46')]);}}};}function createObjHistory(_0x2d9f18,_0x31bc3d,_0x881c20,_0x3e722c,_0x499786){_0x2d9f18[_0x2ee4('0x71')]=_0x881c20;var _0x621555=new Action(_0x2d9f18,_0x31bc3d);var _0x5b0c99=new History(_0x621555);_0x5b0c99[_0x2ee4('0x74')]=_0x3e722c;_0x5b0c99['statedesc']=_0x499786;_0x5b0c99[_0x2ee4('0x75')]=_0x621555[_0x2ee4('0x76')];return _0x5b0c99;}function unlockQueueStatus(_0x22a879,_0x321b4a){setTimeout(function(){if(_[_0x2ee4('0x58')](_0x22a879[_0x2ee4('0x77')])){loggerBooked[_0x2ee4('0x68')]('[unlockQueueStatus][undefined]',_0x321b4a);}_0x22a879[_0x2ee4('0x77')]=!![];loggerBooked[_0x2ee4('0x4b')](_0x2ee4('0x78'),_0x321b4a,JSON[_0x2ee4('0x79')](_['pick'](_0x22a879,['name',_0x2ee4('0x77')])));},0x1f3);}function checkInterval(_0x5e199b){return function(){if(!isNotNull(_0x5e199b[_0x2ee4('0x7a')])){_0x5e199b[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x7b')];throw _0x5e199b[_0x2ee4('0x46')]+_0x2ee4('0x7c');}if(!isNotNull(_0x5e199b[_0x2ee4('0x7a')][_0x2ee4('0x7d')])){_0x5e199b[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x7b')];throw _0x5e199b[_0x2ee4('0x46')]+_0x2ee4('0x7c');}if(!isNotNull(_[_0x2ee4('0x48')](_0x5e199b[_0x2ee4('0x7a')][_0x2ee4('0x7d')]))){_0x5e199b[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x7b')];throw _0x5e199b[_0x2ee4('0x46')]+_0x2ee4('0x7c');}};}function checkIsIVRCampaignActive(_0x4f9207){return function(){if(!utils['isIVRCampaignActive'](_0x4f9207)){_0x4f9207['message']=utils[_0x2ee4('0x6d')][_0x2ee4('0x7e')];throw _0x4f9207[_0x2ee4('0x46')]+_0x2ee4('0x7f');}};}function emitCampaignSummary(_0x10146d){if(utils[_0x2ee4('0x80')](_0x10146d)){emit(util[_0x2ee4('0x44')](_0x2ee4('0x81'),_0x10146d[_0x2ee4('0x46')]),'campaign:save',_0x10146d);}}function loggerCatchQueueSummary(_0x5d5a1a,_0x405591){return function(_0x5e0820){clearPredictiveAttributes(_0x405591);emitCampaignSummary(_0x405591);loggerSyncQueueSummary['debug'](_0x5d5a1a,util[_0x2ee4('0x43')](_0x5e0820,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x35a7ba){if(_0x35a7ba[_0x2ee4('0x82')]){if(_0x35a7ba[_0x2ee4('0x83')]===0x0){_0x35a7ba[_0x2ee4('0x82')]=![];_0x35a7ba[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x7e')];loggerSyncQueueSummary[_0x2ee4('0x66')](_0x2ee4('0x84'),_0x35a7ba[_0x2ee4('0x46')],_0x2ee4('0x85'));}else{_0x35a7ba[_0x2ee4('0x71')]=utils['CAMPAIGN_STATUS'][_0x2ee4('0x86')];loggerSyncQueueSummary[_0x2ee4('0x66')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x35a7ba[_0x2ee4('0x46')],_0x2ee4('0x87'));}emitCampaignSummary(_0x35a7ba);}}function myreject(_0x12e30e){return function(_0x2d81da){return _0x12e30e(msgResponse(_0x2ee4('0x88'),'Error',JSON[_0x2ee4('0x79')](_0x2d81da)));};}Dialer['prototype'][_0x2ee4('0x89')]=function(_0x29264e){return!_['isUndefined'](_0x29264e)&&_0x29264e&&!_['isUndefined'](_0x29264e[_0x2ee4('0x46')])&&!_[_0x2ee4('0x58')](_0x29264e[_0x2ee4('0x8a')])&&_0x29264e[_0x2ee4('0x8a')]&&(this[_0x2ee4('0x1f')][util['format'](_0x2ee4('0x8b'),_0x29264e[_0x2ee4('0x46')])][_0x2ee4('0x8c')]==='reachable'||this[_0x2ee4('0x1f')][util[_0x2ee4('0x44')](_0x2ee4('0x8b'),_0x29264e[_0x2ee4('0x46')])][_0x2ee4('0x8c')]===_0x2ee4('0x8d'));};Dialer['prototype'][_0x2ee4('0x8e')]=function(_0x3f6216){var _0x5ac4a8=this;return function(){if(!_0x5ac4a8[_0x2ee4('0x89')](_0x3f6216[_0x2ee4('0x8f')])){if(!_0x5ac4a8[_0x2ee4('0x89')](_0x3f6216['TrunkBackup'])){_0x3f6216[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x90')];throw _0x3f6216[_0x2ee4('0x46')]+_0x2ee4('0x91');}}};};Dialer[_0x2ee4('0x92')][_0x2ee4('0x93')]=function(_0x1909ea,_0x568e03,_0x141716,_0x2ce584){var _0x1ad6ff=this;return function(){var _0x2c169e=!![];return _0x1ad6ff[_0x2ee4('0x94')](_0x1909ea,_0x568e03,_0x141716,_0x2ce584,_0x2c169e);};};Dialer[_0x2ee4('0x92')][_0x2ee4('0x95')]=function(_0x6e26fe,_0x312df8,_0x1d9aa6,_0x3f1481){var _0x568fef=this;return function(){var _0x18874f=![];return _0x568fef[_0x2ee4('0x94')](_0x6e26fe[_0x2ee4('0x7d')],_0x312df8,_0x1d9aa6,_0x3f1481,_0x18874f);};};Dialer['prototype'][_0x2ee4('0x94')]=function(_0x51ee96,_0x4f43d4,_0x2b7ee4,_0x593bb0,_0x36229b){var _0x8fb91e=[];return new Promise(function(_0x223d05,_0x2eb538){if(!isNotNull(_0x51ee96)){_0x593bb0[_0x2ee4('0x71')]=utils['CAMPAIGN_STATUS'][_0x2ee4('0x7b')];return _0x2eb538(msgResponse('ifTime','Failure',_0x2b7ee4+_0x2ee4('0x96')));}if(_['isEmpty'](_0x51ee96)){_0x593bb0[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x97')];return _0x2eb538(msgResponse(_0x2ee4('0x98'),'Failure',_0x2b7ee4+'\x20Intervals\x20is\x20empty\x20'));}if(_0x4f43d4&&_[_0x2ee4('0x58')](config[_0x2ee4('0x99')][_0x4f43d4])){_0x593bb0['message']=utils['CAMPAIGN_STATUS'][_0x2ee4('0x9a')];return _0x2eb538(msgResponse('ifTime',_0x2ee4('0x9b'),_0x2b7ee4+_0x2ee4('0x9c')+_0x4f43d4));}if(_[_0x2ee4('0x9d')](_0x51ee96)){for(var _0xd8eb54=0x0;_0xd8eb54<_0x51ee96[_0x2ee4('0x9e')];_0xd8eb54+=0x1){_0x8fb91e[_0x2ee4('0x9f')](ami['Action']({'action':'command','command':util[_0x2ee4('0x44')](_0x2ee4('0xa0'),_0x51ee96[_0xd8eb54][_0x2ee4('0xa1')],!_[_0x2ee4('0x58')](config[_0x2ee4('0x99')][_0x4f43d4])?_0x4f43d4:'')})['then'](function(_0x2f3b13){return _0x2f3b13[_0x2ee4('0xa2')][_0x2ee4('0xa3')]('true')>=0x0;})[_0x2ee4('0xa4')](myreject(_0x2eb538)));}}else{_0x8fb91e[_0x2ee4('0x9f')](ami[_0x2ee4('0xa5')]({'action':'command','command':util[_0x2ee4('0x44')](_0x2ee4('0xa0'),_0x51ee96,!_[_0x2ee4('0x58')](config['timezones'][_0x4f43d4])?_0x4f43d4:'')})[_0x2ee4('0x3d')](function(_0x17ec98){return _0x17ec98[_0x2ee4('0xa2')]['indexOf'](_0x2ee4('0xa6'))>=0x0;})[_0x2ee4('0xa4')](myreject(_0x2eb538)));}Promise['all'](_0x8fb91e)[_0x2ee4('0x3d')](function(_0x31edda){var _0x135211=_[_0x2ee4('0xa7')](_0x31edda);if(_0x135211){return _0x223d05(_0x135211);}else{_0x593bb0[_0x2ee4('0x71')]=_0x36229b?utils[_0x2ee4('0x6d')][_0x2ee4('0xa8')]:utils[_0x2ee4('0x6d')][_0x2ee4('0xa9')];return _0x2eb538(msgResponse(_0x2ee4('0xaa'),'Failure',_0x2ee4('0xab')+_0x36229b+'\x20'+_0x2b7ee4+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2ee4('0x43')](_0x51ee96,{'showHidden':![],'depth':null})+_0x2ee4('0xac')+_0x4f43d4));}})[_0x2ee4('0xa4')](function(_0x27618c){return _0x2eb538(msgResponse(_0x2ee4('0x98'),'Failure',JSON['stringify'](_0x27618c)));});});};Dialer['prototype'][_0x2ee4('0x3a')]=function(){var _0x56ef2e=this;return cmHopper[_0x2ee4('0xad')]({'active':![]},{'where':{'active':!![]}})[_0x2ee4('0x3d')](function(){setInterval(function(){_0x56ef2e['syncCampaigns']();},0x3e8);});};Dialer[_0x2ee4('0x92')][_0x2ee4('0xae')]=function(){var _0x5eefae=this;var _0x354785;for(var _0x43a863 in this['campaigns']){if(typeof this[_0x2ee4('0xaf')][_0x43a863]!==_0x2ee4('0xb0')){_0x354785=this[_0x2ee4('0xaf')][_0x43a863];if(utils[_0x2ee4('0x80')](_0x354785)&&utils['isIVRCampaignActive'](_0x354785)){_0x354785[_0x2ee4('0x82')]=!![];Promise[_0x2ee4('0xb1')]()[_0x2ee4('0x3d')](checkIsIVRCampaignActive(_0x354785))[_0x2ee4('0x3d')](checkInterval(_0x354785))[_0x2ee4('0x3d')](_0x5eefae[_0x2ee4('0x8e')](_0x354785))[_0x2ee4('0x3d')](_0x5eefae['checkIfTime'](_0x354785[_0x2ee4('0xb2')],_0x354785[_0x2ee4('0xb3')],_0x354785[_0x2ee4('0x46')],_0x354785))[_0x2ee4('0x3d')](_0x5eefae[_0x2ee4('0x95')](_0x354785['Interval'],_0x354785['dialTimezone'],_0x354785['name'],_0x354785))[_0x2ee4('0x3d')](_0x5eefae[_0x2ee4('0xb4')](_0x354785))['catch'](loggerCatchQueueSummary(_0x2ee4('0xb5'),_0x354785));}else{notSendMessagesCampaign(_0x354785);}}}};Dialer[_0x2ee4('0x92')][_0x2ee4('0xb6')]=function(_0x1a7ce7){if(_0x1a7ce7[_0x2ee4('0xb7')]!=='predictive'){clearPredictiveAttributes(_0x1a7ce7);}switch(_0x1a7ce7[_0x2ee4('0xb7')]){case _0x2ee4('0xb8'):this[_0x2ee4('0xb9')](_0x1a7ce7,0x1);break;case _0x2ee4('0xba'):this[_0x2ee4('0xb9')](_0x1a7ce7,_0x1a7ce7[_0x2ee4('0xbb')]);break;case _0x2ee4('0x9'):this['predictive'](_0x1a7ce7);break;case _0x2ee4('0xbc'):this[_0x2ee4('0xb9')](_0x1a7ce7,0x1);break;default:logger['error'](_0x2ee4('0xbd'),_0x1a7ce7[_0x2ee4('0x46')],'method\x20not\x20recognized');}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x98')]=function(_0x3f0baf,_0x33b599){var _0x5e95da=_0x3f0baf[_0x2ee4('0xb3')];var _0x40eb45=_0x33b599?_0x3f0baf[_0x2ee4('0xb2')]:_0x3f0baf[_0x2ee4('0x7a')][_0x2ee4('0x7d')];logger[_0x2ee4('0xbe')]('Dialer::ifTime()',_0x40eb45,_0x5e95da,_0x3f0baf[_0x2ee4('0x46')],util[_0x2ee4('0x44')](_0x2ee4('0xbf'),_0x3f0baf[_0x2ee4('0x46')],_0x3f0baf['id']));var _0x18189d=null;return Interval['intervalIftime'](_0x40eb45,_0x5e95da)[_0x2ee4('0x3d')](function(_0x2cf876){if(_0x2cf876===!![]){return _0x2cf876;}else{_0x3f0baf[_0x2ee4('0x71')]=_0x33b599?utils[_0x2ee4('0x6d')][_0x2ee4('0xa8')]:utils[_0x2ee4('0x6d')][_0x2ee4('0xa9')];_0x18189d=msgResponse('[ifTime][promiseAll]',_0x2ee4('0x9b'),_0x2ee4('0xab')+_0x33b599+'\x20'+_0x3f0baf[_0x2ee4('0x46')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2ee4('0x43')](_0x40eb45,{'showHidden':![],'depth':null})+_0x2ee4('0xac')+_0x5e95da);}if(_0x18189d!==null){logger[_0x2ee4('0xbe')](_0x2ee4('0xc0'),_0x18189d);_0x18189d['isGlobal']=_0x33b599;throw _0x18189d;}})['catch'](function(_0x1504b3){logger[_0x2ee4('0x68')]('AMI\x20IfTime',_0x1504b3);throw msgResponse(_0x2ee4('0x88'),_0x2ee4('0xc1'),util[_0x2ee4('0x43')](_0x1504b3,{'showHidden':![],'depth':null}));});};Dialer[_0x2ee4('0x92')][_0x2ee4('0x28')]=function(_0x35da24){if(this['voiceQueues'][_0x35da24[_0x2ee4('0xc2')]]){if(this[_0x2ee4('0xc3')][_0x35da24[_0x2ee4('0xc4')]]&&this[_0x2ee4('0xc3')][_0x35da24[_0x2ee4('0xc4')]]['type']!==_0x2ee4('0xc5')){this[_0x2ee4('0xc6')](this[_0x2ee4('0x1d')][_0x35da24[_0x2ee4('0xc2')]]);this[_0x2ee4('0xc3')][_0x35da24['uniqueid']][_0x2ee4('0xc7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2ee4('0x92')][_0x2ee4('0xc8')]=function(_0xbcc68f){var _0x2a4802=this['uniqueId'][_0xbcc68f[_0x2ee4('0xc4')]];if(this[_0x2ee4('0x1d')][_0xbcc68f[_0x2ee4('0xc2')]]){if(_0x2a4802&&_0x2a4802['type']!==_0x2ee4('0xc5')){delete this[_0x2ee4('0xc3')][_0xbcc68f[_0x2ee4('0xc4')]];this[_0x2ee4('0x1d')][_0xbcc68f[_0x2ee4('0xc2')]][_0x2ee4('0xc9')]+=0x1;var _0x932461=new AgentComplete(_0x2a4802,_0xbcc68f);if(_0xbcc68f['reason']==='agent'){_0x932461[_0x2ee4('0xca')]=this['voiceQueues'][_0xbcc68f['queue']]['dialQueueProject2']&&this[_0x2ee4('0x1d')][_0xbcc68f[_0x2ee4('0xc2')]][_0x2ee4('0xcb')]?moment()[_0x2ee4('0x44')](_0x2ee4('0xcc')):undefined;}hopperUtils[_0x2ee4('0xcd')](_0x932461)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0xce')));hopperUtils[_0x2ee4('0xcf')](_0x932461)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0xd0')));}}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x2b')]=function(_0x1c2f84){var _0x2d78fc=this[_0x2ee4('0xc3')][_0x1c2f84['uniqueid']];var _0x321886=this;var _0x2893aa=![];var _0x35416d;var _0x593785;if(this[_0x2ee4('0x1d')][_0x1c2f84['queue']]){if(_0x2d78fc&&_0x2d78fc['type']!==_0x2ee4('0xc5')){delete this[_0x2ee4('0xc3')][_0x1c2f84['uniqueid']];this[_0x2ee4('0xc6')](this[_0x2ee4('0x1d')][_0x1c2f84['queue']]);_0x2d78fc[_0x2ee4('0xd1')]=moment()[_0x2ee4('0x44')](_0x2ee4('0xcc'));var _0x3c0cb9=new QueueCallerAbandon(_0x2d78fc,_0x1c2f84);if(utils[_0x2ee4('0x63')](_0x2d78fc[_0x2ee4('0xd1')],_0x2d78fc[_0x2ee4('0xd2')])>=_0x2d78fc[_0x2ee4('0xd3')]){this[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0x4f')]+=0x1;this['voiceQueues'][_0x1c2f84[_0x2ee4('0xc2')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x2ee4('0x1d')][_0x1c2f84['queue']][_0x2ee4('0xd4')]+=0x1;_0x3c0cb9[_0x2ee4('0x74')]=0xa;_0x3c0cb9[_0x2ee4('0xd5')]=_0x2ee4('0xd6');_0x3c0cb9[_0x2ee4('0xd7')]=_0x2ee4('0xd8');_0x3c0cb9[_0x2ee4('0xca')]=this[_0x2ee4('0x1d')][_0x1c2f84['queue']]['dialQueueProject2']?moment()[_0x2ee4('0x44')](_0x2ee4('0xcc')):undefined;_0x3c0cb9[_0x2ee4('0xd9')]+=0x1;_0x3c0cb9[_0x2ee4('0xda')]+=0x1;_0x35416d=this[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xdb')];_0x593785=this['voiceQueues'][_0x1c2f84['queue']][_0x2ee4('0xdc')];hopperUtils[_0x2ee4('0xdd')](_0x3c0cb9,_0x3c0cb9[_0x2ee4('0x74')],_0x2d78fc[_0x2ee4('0xde')])[_0x2ee4('0x3d')](function(_0x52a5d7){_0x2893aa=_0x52a5d7[_0x2ee4('0xdf')]==0x1;if(_0x3c0cb9[_0x2ee4('0xd9')]>=_0x321886[_0x2ee4('0x1d')][_0x1c2f84['queue']][_0x2ee4('0xe0')]){_0x321886[_0x2ee4('0xe1')](_0x3c0cb9,_0x52a5d7[_0x2ee4('0xdf')]);}else{hopperUtils[_0x2ee4('0xe2')]({'active':![],'countdropretry':_0x3c0cb9[_0x2ee4('0xd9')],'scheduledat':moment()[_0x2ee4('0xe3')](_0x321886[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xdb')],'minutes')[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d78fc[_0x2ee4('0xe4')],'ListId':_0x2d78fc[_0x2ee4('0xe5')],'VoiceQueueId':_0x2d78fc['VoiceQueueId']||undefined,'CampaignId':_0x2d78fc[_0x2ee4('0xe6')]||undefined})['catch'](loggerCatch(_0x2ee4('0xe7')));var _0x290d19=new History(_0x3c0cb9);_0x290d19[_0x2ee4('0x74')]=0xa;_0x290d19['statedesc']=_0x2ee4('0xd6');_0x290d19[_0x2ee4('0x76')]=moment()[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x290d19[_0x2ee4('0x75')]=_0x290d19['starttime'];_0x290d19[_0x2ee4('0xe8')]=_0x3c0cb9[_0x2ee4('0xe8')];_0x290d19[_0x2ee4('0xe9')]=_0x3c0cb9[_0x2ee4('0xe9')];hopperUtils[_0x2ee4('0xcd')](_0x290d19)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x2ee4('0x3d')](function(){if(_0x2893aa)hopperUtils[_0x2ee4('0xea')](_0x3c0cb9,_0x35416d,_0x593785)[_0x2ee4('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xeb')]+=0x1;this[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xec')]+=0x1;_0x3c0cb9[_0x2ee4('0x74')]=0xb;_0x3c0cb9[_0x2ee4('0xd5')]=_0x2ee4('0xed');_0x3c0cb9[_0x2ee4('0xd7')]=_0x2ee4('0xee');_0x3c0cb9['countabandonedretry']+=0x1;_0x3c0cb9[_0x2ee4('0xda')]+=0x1;_0x35416d=this['voiceQueues'][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xef')];_0x593785=this[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xdc')];hopperUtils[_0x2ee4('0xdd')](_0x3c0cb9,_0x3c0cb9[_0x2ee4('0x74')],_0x2d78fc['voiceQueue'])['then'](function(_0x3d2fb4){if(_0x3c0cb9['countabandonedretry']>=_0x321886['voiceQueues'][_0x1c2f84[_0x2ee4('0xc2')]]['dialAbandonedMaxRetry']){_0x321886[_0x2ee4('0xe1')](_0x3c0cb9,_0x3d2fb4[_0x2ee4('0xdf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3c0cb9[_0x2ee4('0xf0')],'scheduledat':moment()[_0x2ee4('0xe3')](_0x321886[_0x2ee4('0x1d')][_0x1c2f84[_0x2ee4('0xc2')]][_0x2ee4('0xef')],_0x2ee4('0xf1'))[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0x2d78fc[_0x2ee4('0xe4')],'ListId':_0x2d78fc[_0x2ee4('0xe5')],'VoiceQueueId':_0x2d78fc['VoiceQueueId']||undefined,'CampaignId':_0x2d78fc[_0x2ee4('0xe6')]||undefined})['catch'](loggerCatch(_0x2ee4('0xf2')));var _0xc309d5=new History(_0x3c0cb9);_0xc309d5[_0x2ee4('0x74')]=0xb;_0xc309d5[_0x2ee4('0xd5')]=_0x2ee4('0xed');_0xc309d5['starttime']=moment()['format'](_0x2ee4('0xcc'));_0xc309d5[_0x2ee4('0x75')]=_0xc309d5[_0x2ee4('0x76')];_0xc309d5[_0x2ee4('0xe8')]=_0x3c0cb9['calleridname'];_0xc309d5[_0x2ee4('0xe9')]=_0x3c0cb9[_0x2ee4('0xe9')];hopperUtils[_0x2ee4('0xcd')](_0xc309d5)[_0x2ee4('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x2893aa)hopperUtils['swapAdditionalPhones'](_0x3c0cb9,_0x35416d,_0x593785)[_0x2ee4('0x3d')](function(){return 0x1;});});}}}};Dialer[_0x2ee4('0x92')]['syncNewExten']=function(_0x295943){if(this[_0x2ee4('0xf3')][_0x295943['uniqueid']]){this[_0x2ee4('0xf3')][_0x295943['uniqueid']][_0x2ee4('0xf4')]=_0x295943[_0x2ee4('0xf4')];}if(this[_0x2ee4('0xc3')][_0x295943[_0x2ee4('0xc4')]]){this[_0x2ee4('0xc3')][_0x295943[_0x2ee4('0xc4')]][_0x2ee4('0xf4')]=_0x295943['channel'];}};Dialer[_0x2ee4('0x92')]['syncQueueMember']=function(_0x59b9ed){if(!this[_0x2ee4('0xf3')][_0x59b9ed[_0x2ee4('0xf5')]]){return;}var _0xd4d474=this['voiceQueues'][this[_0x2ee4('0xf3')][_0x59b9ed['actionid']][_0x2ee4('0xc2')]][_0x2ee4('0xf6')]||'rrmemory';if(_0xd4d474===_0x2ee4('0xf7')){if(this[_0x2ee4('0xf3')][_0x59b9ed[_0x2ee4('0xf5')]]&&_[_0x2ee4('0xf8')](this[_0x2ee4('0xf3')][_0x59b9ed['actionid']][_0x2ee4('0xf9')])&&_0x59b9ed[_0x2ee4('0x8c')]==='1'&&_0x59b9ed[_0x2ee4('0xfa')]==='0'){if(this['agents'][_0x59b9ed[_0x2ee4('0xfb')]]){if(!this[_0x2ee4('0x1e')][_0x59b9ed[_0x2ee4('0xfb')]][_0x2ee4('0xf9')]){this['agents'][_0x59b9ed['stateinterface']][_0x2ee4('0xf9')]=!![];this[_0x2ee4('0xf3')][_0x59b9ed[_0x2ee4('0xf5')]][_0x2ee4('0xf9')]=!![];this['actions'][_0x59b9ed[_0x2ee4('0xf5')]][_0x2ee4('0xfb')]=_0x59b9ed[_0x2ee4('0xfb')];}}}}else if(_0xd4d474===_0x2ee4('0xfc')){if(this[_0x2ee4('0xf3')][_0x59b9ed[_0x2ee4('0xf5')]]){if(this[_0x2ee4('0x1e')][_0x59b9ed[_0x2ee4('0xfb')]]){this[_0x2ee4('0xf3')][_0x59b9ed['actionid']][_0x2ee4('0xfb')]=_0x59b9ed['stateinterface'];if(_[_0x2ee4('0xf8')](this[_0x2ee4('0x25')][this[_0x2ee4('0xf3')][_0x59b9ed['actionid']][_0x2ee4('0xc2')]])){this[_0x2ee4('0x25')][this[_0x2ee4('0xf3')][_0x59b9ed['actionid']]['queue']]=[];}this[_0x2ee4('0x25')][this['actions'][_0x59b9ed[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]][_0x2ee4('0x9f')](_[_0x2ee4('0x62')](_[_0x2ee4('0xfd')](this[_0x2ee4('0xf3')][_0x59b9ed[_0x2ee4('0xf5')]],[_0x2ee4('0xfe'),_0x2ee4('0xfb')]),{'status':_0x59b9ed[_0x2ee4('0x8c')],'paused':_0x59b9ed['paused']}));}}}};Dialer['prototype'][_0x2ee4('0x39')]=function(_0x48d15b){if(!this['actions'][_0x48d15b[_0x2ee4('0xf5')]]){return;}var _0x4979e2=this;var _0x114a0f=this['voiceQueues'][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]];var _0xb791e1=_0x114a0f[_0x2ee4('0xf6')]||'rrmemory';if(_0xb791e1===_0x2ee4('0xf7')){if(this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]]&&this['actions'][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xfb')]){this[_0x2ee4('0x1c')]['run'](this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xfe')],this[_0x2ee4('0xf3')][_0x48d15b['actionid']]['stateinterface'])['catch'](function(_0x3f39c9){logger['error'](_0x2ee4('0xff'),util[_0x2ee4('0x43')](_0x3f39c9,{'showHidden':![],'depth':null}));})[_0x2ee4('0x1b')](function(){_0x4979e2[_0x2ee4('0xc6')](_0x4979e2['voiceQueues'][_0x4979e2[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]);_0x4979e2[_0x2ee4('0x1e')][_0x4979e2[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xfb')]][_0x2ee4('0xf9')]=![];delete _0x4979e2['actions'][_0x48d15b[_0x2ee4('0xf5')]];unlockQueueStatus(_0x114a0f);});}else{this[_0x2ee4('0xc6')](this[_0x2ee4('0x1d')][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]);hopperUtils[_0x2ee4('0xe2')]({'active':![],'ContactId':this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]]['ContactId'],'ListId':this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xe5')],'VoiceQueueId':this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0x100')]||undefined,'CampaignId':this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]];unlockQueueStatus(_0x114a0f);}}else if(_0xb791e1===_0x2ee4('0xfc')){var _0x23c09b;if(this['actions'][_0x48d15b[_0x2ee4('0xf5')]]&&!_[_0x2ee4('0x48')](this[_0x2ee4('0x25')][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]])){if(this[_0x2ee4('0x26')][_0x4979e2[_0x2ee4('0xf3')][_0x48d15b['actionid']][_0x2ee4('0xc2')]]){this[_0x2ee4('0x26')][_0x4979e2[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]=this['queueBookedRR'][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]?this['queueBookedRR'][this['actions'][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]:this[_0x2ee4('0x25')][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]]?this['queueBooked'][this['actions'][_0x48d15b['actionid']][_0x2ee4('0xc2')]][_0x2ee4('0x101')]||0x0:0x0;}this['queueBooked'][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]][_0x2ee4('0x101')]=this['queueBookedRR'][this[_0x2ee4('0xf3')][_0x48d15b[_0x2ee4('0xf5')]][_0x2ee4('0xc2')]];for(var _0x41258f=0x0;_0x41258f=_0xfa2929['dialGlobalMaxRetry']){_0x1bf14a['stateGlobal'](_0x3910ae,_0x459463,_0x231c5d,_0x2ee4('0x124'));}else{if(_0x3910ae['countmachineretry']>=_0xfa2929[_0x2ee4('0x125')]){_0x1bf14a[_0x2ee4('0x126')](_0x3910ae,_0x459463,_0x231c5d,_0x2ee4('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3910ae['countmachineretry'],'scheduledat':moment()['add'](_0xfa2929[_0x2ee4('0x128')],_0x2ee4('0xf1'))[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0x3910ae['ContactId'],'ListId':_0x3910ae[_0x2ee4('0xe5')],'VoiceQueueId':_0x3910ae[_0x2ee4('0x100')]||undefined,'CampaignId':_0x3910ae['CampaignId']||undefined})[_0x2ee4('0xa4')](loggerCatch('[rescheduleContact][Machine]'));_0x459463({'reschedule':0x1});}}});}if(_0x4a650d[_0x2ee4('0x40')]===_0x2ee4('0xc5')&&this[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]][_0x2ee4('0x112')]&&_0x3b360f[_0x2ee4('0x113')]===_0x2ee4('0x114')){delete this[_0x2ee4('0xc3')][_0x3b360f[_0x2ee4('0xc4')]];this[_0x2ee4('0xc6')](this[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]]);_0x1f265f=new Hangup(_0x4a650d,_0x3b360f);_0x1f265f[_0x2ee4('0x74')]=0x12;_0x1f265f[_0x2ee4('0xd5')]=_0x2ee4('0x116');_0x1f265f[_0x2ee4('0x117')]=_0x2ee4('0x118');ami['emit'](_0x2ee4('0x119'),ut[_0x2ee4('0x11a')](_0x1f265f,_0x2ee4('0x11f')));this['saveInDb'](_0x1f265f,_0x2ee4('0x129'),'[syncHangupInAMDIvr]');}if(_0x4a650d['type']===_0x2ee4('0xc5')&&this[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]]['dialAMDActive']&&_0x3b360f[_0x2ee4('0x113')]===_0x2ee4('0x11c')){return new Promise(function(_0x3a6727,_0x2f2059){delete _0x1bf14a[_0x2ee4('0xc3')][_0x3b360f[_0x2ee4('0xc4')]];_0x1bf14a[_0x2ee4('0xc6')](_0x1bf14a[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]]);_0x1bf14a[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]]['outboundAnswerCallsDay']+=0x1;_0x1bf14a[_0x2ee4('0xaf')][_0x4a650d[_0x2ee4('0xc2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4695c6=_0x1bf14a['campaigns'][_0x4a650d[_0x2ee4('0xc2')]];var _0x2c3091=new Hangup(_0x4a650d,_0x3b360f);_0x2c3091[_0x2ee4('0x74')]=0x13;_0x2c3091[_0x2ee4('0xd5')]=_0x2ee4('0x11d');_0x2c3091[_0x2ee4('0x117')]=_0x2ee4('0x118');_0x2c3091[_0x2ee4('0x11e')]+=0x1;_0x2c3091[_0x2ee4('0xda')]+=0x1;_0x2c3091[_0x2ee4('0x11f')]=!![];ami[_0x2ee4('0x3f')](_0x2ee4('0x119'),ut['buildObj'](_0x2c3091,_0x2ee4('0x11f')));hopperUtils[_0x2ee4('0xcd')](_0x2c3091)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x120')));if(_0x2c3091[_0x2ee4('0x12a')]+_0x2c3091[_0x2ee4('0x121')]+_0x2c3091[_0x2ee4('0x122')]+_0x2c3091[_0x2ee4('0x123')]+_0x2c3091[_0x2ee4('0xd9')]+_0x2c3091[_0x2ee4('0xf0')]+_0x2c3091[_0x2ee4('0x11e')]+_0x2c3091['countagentrejectretry']>=_0x4695c6[_0x2ee4('0x12b')]){_0x1bf14a['stateGlobal'](_0x2c3091,_0x3a6727,_0x2f2059,_0x2ee4('0x124'));}else{if(_0x2c3091[_0x2ee4('0x11e')]>=_0x4695c6[_0x2ee4('0x125')]){_0x1bf14a[_0x2ee4('0x126')](_0x2c3091,_0x3a6727,_0x2f2059,'reason\x2019\x20machine....');}else{hopperUtils[_0x2ee4('0xe2')]({'active':![],'countmachineretry':_0x2c3091[_0x2ee4('0x11e')],'scheduledat':moment()['add'](_0x4695c6[_0x2ee4('0x128')],_0x2ee4('0xf1'))[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0x2c3091[_0x2ee4('0xe4')],'ListId':_0x2c3091[_0x2ee4('0xe5')],'VoiceQueueId':_0x2c3091[_0x2ee4('0x100')]||undefined,'CampaignId':_0x2c3091[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12c')));_0x3a6727({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2ee4('0x32')]=function(_0x320b83){var _0x497521=this[_0x2ee4('0xc3')][_0x320b83[_0x2ee4('0xc4')]];var _0x13657e;if(_0x497521&&_0x497521[_0x2ee4('0x40')]===_0x2ee4('0xc5')){delete this['uniqueId'][_0x320b83['uniqueid']];this['updateOriginated'](this[_0x2ee4('0xaf')][_0x497521[_0x2ee4('0xc2')]]);this[_0x2ee4('0xaf')][_0x497521[_0x2ee4('0xc2')]][_0x2ee4('0x12d')]+=0x1;_0x13657e=new Hangup(_0x497521,_0x320b83);hopperUtils[_0x2ee4('0xcd')](_0x13657e)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12e')));hopperUtils['moveContactManagedDialer'](_0x13657e)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12f')));}if(_0x497521&&_0x497521[_0x2ee4('0x40')]!==_0x2ee4('0xc5')&&isNotNull(this['voiceQueues'][_0x497521[_0x2ee4('0xc2')]]['dialQueueProject'])){delete this[_0x2ee4('0xc3')][_0x320b83[_0x2ee4('0xc4')]];this[_0x2ee4('0xc6')](this[_0x2ee4('0x1d')][_0x497521[_0x2ee4('0xc2')]]);this[_0x2ee4('0x1d')][_0x497521[_0x2ee4('0xc2')]][_0x2ee4('0xc9')]+=0x1;this[_0x2ee4('0x1d')][_0x497521['queue']][_0x2ee4('0x115')]+=0x1;_0x13657e=new Hangup(_0x497521,_0x320b83);_0x13657e[_0x2ee4('0x74')]=0x10;_0x13657e[_0x2ee4('0xd5')]=_0x2ee4('0x130');_0x13657e['membername']=_0x2ee4('0x131');hopperUtils['createHistory'](_0x13657e)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12e')));hopperUtils['moveContactManagedDialer'](_0x13657e)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12f')));}if(_0x497521&&_0x497521[_0x2ee4('0x40')]!=='ivr'&&!isNotNull(this[_0x2ee4('0x1d')][_0x497521[_0x2ee4('0xc2')]][_0x2ee4('0x132')])){delete this[_0x2ee4('0xc3')][_0x320b83[_0x2ee4('0xc4')]];this[_0x2ee4('0xc6')](this[_0x2ee4('0x1d')][_0x497521[_0x2ee4('0xc2')]]);this['voiceQueues'][_0x497521[_0x2ee4('0xc2')]][_0x2ee4('0x133')]+=0x1;_0x13657e=new Hangup(_0x497521,_0x320b83);_0x13657e[_0x2ee4('0x74')]=0xc;_0x13657e[_0x2ee4('0xd5')]=_0x320b83[_0x2ee4('0x134')];_0x13657e[_0x2ee4('0x117')]=_0x2ee4('0x135');hopperUtils['createHistory'](_0x13657e)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x12e')));hopperUtils[_0x2ee4('0xcf')](_0x13657e)[_0x2ee4('0xa4')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2ee4('0x92')]['syncQueueSummary']=function(_0x13bd67){var _0x4bfb7a=this;if(!_0x4bfb7a['queuesSummary'][_0x13bd67[_0x2ee4('0x46')]]){_0x4bfb7a['queuesSummary'][_0x13bd67[_0x2ee4('0x46')]]={'running':![]};}else if(_0x4bfb7a[_0x2ee4('0x27')][_0x13bd67[_0x2ee4('0x46')]][_0x2ee4('0x136')]===!![]){return;}else if(_0x4bfb7a[_0x2ee4('0x27')][_0x13bd67[_0x2ee4('0x46')]][_0x2ee4('0x136')]===![]){_0x4bfb7a[_0x2ee4('0x27')][_0x13bd67[_0x2ee4('0x46')]]['running']=!![];}var _0x4c0aaf=_0x4bfb7a[_0x2ee4('0x1d')][_0x13bd67['name']];var _0x18b0a3=_0x4c0aaf[_0x2ee4('0x71')]!==utils[_0x2ee4('0x6d')][_0x2ee4('0x7e')];var _0x2dfec2=utils['isPreviewCampaign'](_0x4c0aaf);_0x4c0aaf['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x4c0aaf,_0x4bfb7a[_0x2ee4('0x1f')]);Promise['resolve']()[_0x2ee4('0x3d')](function(){if(_0x4c0aaf[_0x2ee4('0x137')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x18b0a3){clearPredictiveAttributes(_0x4c0aaf);_0x13bd67[_0x2ee4('0x23')]=undefined;_0x13bd67[_0x2ee4('0x64')]=undefined;}if(_0x4c0aaf[_0x2ee4('0x137')]===utils[_0x2ee4('0x6d')][_0x2ee4('0x7e')]){_0x13bd67['available']=0x0;_0x13bd67[_0x2ee4('0xfa')]=0x0;_0x13bd67[_0x2ee4('0x138')]=0x0;_0x13bd67[_0x2ee4('0x139')]=0x0;_0x13bd67[_0x2ee4('0x13a')]=0x0;}}else if(_0x4c0aaf[_0x2ee4('0x137')]===utils[_0x2ee4('0x6d')][_0x2ee4('0x13b')]&&!_0x2dfec2){return _0x4bfb7a[_0x2ee4('0x98')](_0x4c0aaf,!![])[_0x2ee4('0x3d')](function(){return _0x4bfb7a[_0x2ee4('0x98')](_0x4c0aaf,![]);})[_0x2ee4('0x3d')](function(){return _0x4bfb7a['checkDialMethod'](_0x4c0aaf);})[_0x2ee4('0xa4')](function(_0x9fa8df){loggerSyncQueueSummary[_0x2ee4('0x66')](_0x2ee4('0x13c'),util[_0x2ee4('0x43')](_0x9fa8df,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4c0aaf);});}else{clearPredictiveAttributes(_0x4c0aaf);}})[_0x2ee4('0x3d')](function(){var _0x35b844=_0x13bd67[_0x2ee4('0x13d')](_0x4c0aaf);if(_0x35b844||_0x4c0aaf[_0x2ee4('0x13e')]){_0x4c0aaf[_0x2ee4('0x13e')]=![];_0x13bd67[_0x2ee4('0x13f')](_0x4c0aaf);Object['assign'](_0x4c0aaf,_0x13bd67);emitOutboundVoiceQueueSummary(_0x13bd67);}_0x4bfb7a[_0x2ee4('0x27')][_0x4c0aaf[_0x2ee4('0x46')]][_0x2ee4('0x136')]=![];})[_0x2ee4('0xa4')](function(_0x466fb4){logger[_0x2ee4('0x68')](_0x2ee4('0x13c'),util[_0x2ee4('0x43')](_0x466fb4,{'showHidden':![],'depth':null}));_0x4bfb7a[_0x2ee4('0x27')][_0x4c0aaf[_0x2ee4('0x46')]]['running']=![];});};Dialer['prototype'][_0x2ee4('0x31')]=_[_0x2ee4('0x140')](function(){var _0x46f842=_[_0x2ee4('0x141')](this[_0x2ee4('0x1d')],function(_0x19bb12){return _0x19bb12[_0x2ee4('0x142')];});var _0xc174e8=_[_0x2ee4('0x141')](this['agents'],function(_0x336e31){return _0x336e31['online']&&_0x336e31[_0x2ee4('0x8c')]===_0x2ee4('0x143');});if(_0x46f842[_0x2ee4('0x9e')]>0x0&&_0xc174e8[_0x2ee4('0x9e')]>0x0){return Promise[_0x2ee4('0xb1')]()[_0x2ee4('0x3d')](cmHopper[_0x2ee4('0x144')](_[_0x2ee4('0x145')](_0x46f842,'id'),previewRecallmeReminderInterval,_[_0x2ee4('0x145')](_0xc174e8,'id')))['then'](function(_0x205438){for(var _0x447cdc=0x0;_0x447cdc<_0x205438[_0x2ee4('0x9e')];_0x447cdc++){var _0x1becd2=_0x205438[_0x447cdc][_0x2ee4('0x146')]['name'];if(_0x1becd2)io['to'](util[_0x2ee4('0x44')](_0x2ee4('0x147'),_0x1becd2))[_0x2ee4('0x3f')](_0x2ee4('0x148'),{'hopper':_0x205438[_0x447cdc]});}})['catch'](function(_0x14b5e0){logger[_0x2ee4('0x68')]('checkPreviewRecallReminder',_0x14b5e0);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x2ee4('0x3b')]=function(){var _0x4c73d6=this;setInterval(function(){_0x4c73d6['clearZombieChannels'](_0x4c73d6['uniqueId'],'[uniqueid]');_0x4c73d6[_0x2ee4('0x149')](_0x4c73d6[_0x2ee4('0xf3')],_0x2ee4('0x14a'));},0x32c8);};Dialer[_0x2ee4('0x92')][_0x2ee4('0x149')]=function(_0x2ab343,_0x3f245c){var _0x5eef83=this;for(var _0x596f8b in _0x2ab343){if(typeof _0x2ab343[_0x596f8b]!==_0x2ee4('0xb0')){this[_0x2ee4('0x14b')]['enqueue'](function(){if(!_[_0x2ee4('0xf8')](_0x2ab343[_0x596f8b])){return ami[_0x2ee4('0xa5')]({'action':_0x2ee4('0x8c'),'channel':_0x2ab343[_0x596f8b][_0x2ee4('0xf4')]})[_0x2ee4('0xa4')](function(_0x4cfd59){if(_0x4cfd59[_0x2ee4('0x71')]===_0x2ee4('0x14c')){setTimeout(function(){if(_0x2ab343[_0x596f8b]&&_0x2ab343[_0x596f8b][_0x2ee4('0x40')]!=='ivr'){_0x5eef83[_0x2ee4('0xc6')](_0x5eef83[_0x2ee4('0x1d')][_0x2ab343[_0x596f8b][_0x2ee4('0xc2')]]);logger[_0x2ee4('0x68')](_0x2ee4('0x14d'),_0x3f245c,_0x596f8b,_0x2ab343[_0x596f8b]['queue']);delete _0x2ab343[_0x596f8b];}if(_0x2ab343[_0x596f8b]&&_0x2ab343[_0x596f8b][_0x2ee4('0x40')]===_0x2ee4('0xc5')){_0x5eef83['updateOriginated'](_0x5eef83[_0x2ee4('0xaf')][_0x2ab343[_0x596f8b][_0x2ee4('0xc2')]]);logger[_0x2ee4('0x68')](_0x2ee4('0x14e'),_0x3f245c,_0x596f8b,_0x2ab343[_0x596f8b][_0x2ee4('0xc2')]);delete _0x2ab343[_0x596f8b];}},0x2328);}});}});}}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x14f')]=function(_0x5ced05){return Promise['resolve']()[_0x2ee4('0x3d')](voiceQueueRt[_0x2ee4('0x14f')](_0x5ced05))[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x150')));};Dialer['prototype'][_0x2ee4('0xc6')]=function(_0x2368b6){if(!_['isUndefined'](_0x2368b6)&&_0x2368b6!==null){if(typeof _0x2368b6['originated']!==_0x2ee4('0xb0')){if(_0x2368b6[_0x2ee4('0x83')]>0x0){_0x2368b6['originated']-=0x1;}else{logger[_0x2ee4('0x68')](_0x2ee4('0x151'));}}}else{logger[_0x2ee4('0x68')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x152')]=function(_0xa165cf,_0x372634){var _0x3b637c=this;return function(_0x326de9){_0x3b637c['updateOriginated'](_0x372634);logger[_0x2ee4('0x68')](_0xa165cf,util[_0x2ee4('0x43')](_0x326de9,{'showHidden':![],'depth':null}));};};Dialer[_0x2ee4('0x92')][_0x2ee4('0x153')]=function(_0x292116,_0x335a19,_0x47e0af){var _0x2db8e9={'state':0x19,'statedesc':_0x2ee4('0x154')};this[_0x2ee4('0xc6')](_0x335a19);this[_0x2ee4('0x155')](_[_0x2ee4('0x62')](_0x2db8e9,_[_0x2ee4('0xfd')](_0x47e0af,[_0x2ee4('0xe4'),_0x2ee4('0xe5'),_0x2ee4('0x156'),_0x2ee4('0x100'),'CampaignId'])),_0x2ee4('0x157'),_0x2ee4('0x158'));logger[_0x2ee4('0x68')](_0x292116);};Dialer[_0x2ee4('0x92')][_0x2ee4('0x155')]=function(_0x229047,_0x24ddac,_0x34cdb6){hopperUtils[_0x2ee4('0xcd')](_0x229047)[_0x2ee4('0xa4')](loggerCatch(_0x24ddac));hopperUtils[_0x2ee4('0xcf')](_0x229047)[_0x2ee4('0xa4')](loggerCatch(_0x34cdb6));};Dialer[_0x2ee4('0x92')]['queueCallerAbandonCreateState']=function(_0x5a6c3f,_0x410b95){hopperUtils[_0x2ee4('0xcd')](_0x5a6c3f)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0xce')));if(_0x410b95==0x0){hopperUtils[_0x2ee4('0xcf')](_0x5a6c3f)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x2ee4('0x159')]=function(_0x35b8e9){return Promise['resolve']()[_0x2ee4('0x3d')](cmHopper[_0x2ee4('0x144')](_0x35b8e9['id'],previewRecallmeReminderInterval))[_0x2ee4('0x3d')](function(_0x32b0b2){for(var _0x4f88d7=0x0;_0x4f88d7<_0x32b0b2[_0x2ee4('0x9e')];_0x4f88d7++){var _0x2beeb9=_0x32b0b2[_0x4f88d7]['Agent'][_0x2ee4('0x46')];if(_0x2beeb9)io['to'](util[_0x2ee4('0x44')](_0x2ee4('0x147'),_0x2beeb9))[_0x2ee4('0x3f')](_0x2ee4('0x148'),{'hopper':_0x32b0b2[_0x4f88d7]});}})[_0x2ee4('0xa4')](function(){});};Dialer[_0x2ee4('0x92')][_0x2ee4('0xb4')]=function(_0x45d7cf){var _0x259056=this;return function(){_0x259056[_0x2ee4('0x15a')](_0x45d7cf);};};Dialer[_0x2ee4('0x92')]['actionOriginate']=function(_0x59eb11,_0x43224e){var _0x5aefea=this;var _0x1792e6=uuid['v4']();this['actions'][_0x1792e6]=new Action(_0x59eb11,_0x43224e,_0x1792e6);return new Promise(function(_0x396ba4,_0x2d91d7){if(_['isUndefined'](_0x59eb11)&&typeof _0x59eb11!==_0x2ee4('0x15b')){return _0x2d91d7(msgResponse(_0x2ee4('0x15c'),_0x2ee4('0x9b'),_0x2ee4('0x15d')));}if(_['isUndefined'](_0x43224e['phone'])||_0x43224e[_0x2ee4('0x15e')]===null){return _0x2d91d7(msgResponse(_0x2ee4('0x15c'),_0x2ee4('0x9b'),_0x2ee4('0x15f')));}var _0x544452={'XMD-CALLERID':_0x5aefea[_0x2ee4('0xf3')][_0x1792e6][_0x2ee4('0x160')](),'XMD-AGI':_0x59eb11[_0x2ee4('0x132')]?util[_0x2ee4('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x59eb11[_0x2ee4('0x132')]):'NONE','XMD-AGIAFTER':_0x59eb11[_0x2ee4('0x161')]?util[_0x2ee4('0x44')](_0x2ee4('0x162'),ipAgi,_0x59eb11[_0x2ee4('0x161')]):_0x2ee4('0x163'),'XMD-QUEUE':utils[_0x2ee4('0x164')](_0x59eb11)?util[_0x2ee4('0x44')](_0x2ee4('0x165'),_0x59eb11[_0x2ee4('0x46')],_0x59eb11[_0x2ee4('0x166')]||'',_0x59eb11[_0x2ee4('0xcb')]?'c':'',_0x59eb11['dialQueueTimeout']||0x3):_0x2ee4('0x163'),'XMD-CONTACTID':_0x43224e[_0x2ee4('0xe4')],'XMD-CDRTYPE':_0x2ee4('0x8'),'CALLERID(all)':_0x5aefea[_0x2ee4('0xf3')][_0x1792e6][_0x2ee4('0x160')](),'XMD-AMD':_0x59eb11['dialAMDActive']?'ACTIVE':_0x2ee4('0x163'),'XMD-DESTINATION':_0x2ee4('0x111')};if(_0x59eb11['dialAMDActive']){_0x544452['XMD-AMDINITIALSILENCE']=_0x59eb11[_0x2ee4('0x167')]||0x9c4;_0x544452[_0x2ee4('0x168')]=_0x59eb11[_0x2ee4('0x169')]||0x5dc;_0x544452[_0x2ee4('0x16a')]=_0x59eb11[_0x2ee4('0x16b')]||0x320;_0x544452[_0x2ee4('0x16c')]=_0x59eb11[_0x2ee4('0x16d')]||0x1388;_0x544452[_0x2ee4('0x16e')]=_0x59eb11[_0x2ee4('0x16f')]||0x64;_0x544452[_0x2ee4('0x170')]=_0x59eb11[_0x2ee4('0x171')]||0x32;_0x544452[_0x2ee4('0x172')]=_0x59eb11[_0x2ee4('0x173')]||0x3;_0x544452[_0x2ee4('0x174')]=_0x59eb11[_0x2ee4('0x175')]||0x100;_0x544452[_0x2ee4('0x176')]=_0x59eb11['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x2ee4('0x164')](_0x59eb11)){_0x544452[_0x2ee4('0x177')]=_0x43224e['VoiceQueueId'];}else{_0x544452[_0x2ee4('0x178')]=_0x43224e[_0x2ee4('0xe6')];}var _0x345142=utils[_0x2ee4('0x179')](_0x43224e[_0x2ee4('0x17a')]);Object[_0x2ee4('0x17b')](_0x544452,_0x345142);var _0x7edc08=_0x5aefea['isTrunkReachable'](_0x59eb11[_0x2ee4('0x8f')])?utils[_0x2ee4('0x17c')](_0x59eb11[_0x2ee4('0x8f')][_0x2ee4('0x17d')],_0x59eb11[_0x2ee4('0x17e')],_0x59eb11[_0x2ee4('0x17f')]>0x0?utils[_0x2ee4('0x180')](_0x59eb11[_0x2ee4('0x181')],_0x59eb11[_0x2ee4('0x17f')]):_0x59eb11[_0x2ee4('0x181')]):utils['getCallerId'](_[_0x2ee4('0xf8')](_0x59eb11[_0x2ee4('0x182')])?_0x59eb11[_0x2ee4('0x8f')][_0x2ee4('0x17d')]:_0x59eb11[_0x2ee4('0x182')]['callerid'],_0x59eb11['dialOriginateCallerIdName'],_0x59eb11[_0x2ee4('0x17f')]>0x0?utils[_0x2ee4('0x180')](_0x59eb11[_0x2ee4('0x181')],_0x59eb11['dialRandomLastDigitCallerIdNumber']):_0x59eb11[_0x2ee4('0x181')]);if(_0x7edc08){_0x544452[_0x2ee4('0x183')]=_0x5aefea['actions'][_0x1792e6][_0x2ee4('0x184')]=utils[_0x2ee4('0x185')](_0x7edc08);_0x544452[_0x2ee4('0x186')]=_0x43224e[_0x2ee4('0x15e')];}_0x59eb11['variables']=_0x544452;return ami[_0x2ee4('0xa5')]({'actionid':_0x1792e6,'action':_0x2ee4('0x15c'),'channel':_0x5aefea[_0x2ee4('0x89')](_0x59eb11[_0x2ee4('0x8f')])?util[_0x2ee4('0x44')](_0x2ee4('0x187'),_0x59eb11['Trunk'][_0x2ee4('0x46')],isNotNull(_0x59eb11['dialPrefix'])?_0x59eb11[_0x2ee4('0x188')]['trim']()||'':'',_0x59eb11[_0x2ee4('0x189')]>0x0?_0x43224e[_0x2ee4('0x15e')][_0x2ee4('0x18a')](_0x59eb11[_0x2ee4('0x189')]):_0x43224e[_0x2ee4('0x15e')]):util['format'](_0x2ee4('0x187'),_[_0x2ee4('0xf8')](_0x59eb11['TrunkBackup'])?_0x59eb11[_0x2ee4('0x8f')][_0x2ee4('0x46')]:_0x59eb11[_0x2ee4('0x182')][_0x2ee4('0x46')],isNotNull(_0x59eb11[_0x2ee4('0x188')])?_0x59eb11[_0x2ee4('0x188')][_0x2ee4('0x18b')]()||'':'',_0x59eb11[_0x2ee4('0x189')]>0x0?_0x43224e[_0x2ee4('0x15e')][_0x2ee4('0x18a')](_0x59eb11['dialCutDigit']):_0x43224e[_0x2ee4('0x15e')]),'callerid':_0x7edc08,'Exten':_0x2ee4('0x111'),'Context':_0x2ee4('0x18c'),'Priority':'1','variable':_0x544452,'timeout':(_0x59eb11[_0x2ee4('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1792e6})[_0x2ee4('0x3d')](function(_0x2c3c32){return _0x396ba4(_0x2c3c32);})['catch'](function(_0x55c775){_0x59eb11['outboundOriginateFailureCallsDay']+=0x1;var _0x4f0880=new History(_0x5aefea[_0x2ee4('0xf3')][_0x1792e6]);logger[_0x2ee4('0x68')](util[_0x2ee4('0x44')]('[originateError]:\x20%s',JSON[_0x2ee4('0x79')](_0x55c775)));_0x4f0880[_0x2ee4('0x74')]=0xe;_0x4f0880['statedesc']=_0x2ee4('0x18e');_0x4f0880[_0x2ee4('0x76')]=moment()[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f0880[_0x2ee4('0x75')]=_0x4f0880['starttime'];hopperUtils[_0x2ee4('0xcd')](_0x4f0880)[_0x2ee4('0xa4')](loggerCatch('[originate][error]'));_0x5aefea['moveContactManagedDialer'](_0x4f0880)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x18f')))[_0x2ee4('0x1b')](function(){delete _0x5aefea[_0x2ee4('0xf3')][_0x1792e6];return _0x2d91d7(msgResponse(_0x2ee4('0x15c'),_0x2ee4('0xc1'),_0x2ee4('0x190')));});});});};Dialer[_0x2ee4('0x92')][_0x2ee4('0x191')]=function(_0x4c4d18,_0x61979a,_0x37ddc7){var _0xe1db2e=new History(_0x61979a);if(_0xe1db2e[_0x2ee4('0x12a')]+_0xe1db2e[_0x2ee4('0x121')]+_0xe1db2e[_0x2ee4('0x122')]+_0xe1db2e[_0x2ee4('0x123')]+_0xe1db2e['countdropretry']+_0xe1db2e[_0x2ee4('0xf0')]+_0xe1db2e[_0x2ee4('0x11e')]+_0xe1db2e[_0x2ee4('0x192')]>=_0x37ddc7['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4c4d18){case 0x3:if(_0xe1db2e[_0x2ee4('0x122')]>=_0x37ddc7['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countnoanswerretry':_0xe1db2e['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x37ddc7[_0x2ee4('0x193')],_0x2ee4('0xf1'))['format'](_0x2ee4('0xcc')),'ContactId':_0xe1db2e[_0x2ee4('0xe4')],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x194')));break;case 0x5:if(_0xe1db2e[_0x2ee4('0x12a')]>=_0x37ddc7[_0x2ee4('0x195')]-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countbusyretry':_0xe1db2e[_0x2ee4('0x12a')]+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7[_0x2ee4('0x196')],_0x2ee4('0xf1'))[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xe1db2e[_0x2ee4('0xe4')],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e['CampaignId']||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x197')));break;case 0x8:if(_0xe1db2e[_0x2ee4('0x121')]>=_0x37ddc7[_0x2ee4('0x198')]-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countcongestionretry':_0xe1db2e[_0x2ee4('0x121')]+=0x1,'scheduledat':moment()['add'](_0x37ddc7['dialCongestionRetryFrequency'],_0x2ee4('0xf1'))[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xe1db2e[_0x2ee4('0xe4')],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})['catch'](loggerCatch(_0x2ee4('0x199')));break;case 0x0:if(_0xe1db2e[_0x2ee4('0x123')]>=_0x37ddc7[_0x2ee4('0x19a')]-0x1){return!![];}else{hopperUtils[_0x2ee4('0xe2')]({'active':![],'countnosuchnumberretry':_0xe1db2e['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7[_0x2ee4('0x19b')],_0x2ee4('0xf1'))[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0xe1db2e[_0x2ee4('0xe4')],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x19c')));}break;case 0xa:if(_0xe1db2e['countdropretry']>=_0x37ddc7[_0x2ee4('0xe0')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xe1db2e[_0x2ee4('0xd9')]+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7[_0x2ee4('0xdb')],_0x2ee4('0xf1'))[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xe1db2e['ContactId'],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0xe7')));break;case 0xb:if(_0xe1db2e[_0x2ee4('0xf0')]>=_0x37ddc7['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countabandonedretry':_0xe1db2e[_0x2ee4('0xf0')]+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7[_0x2ee4('0xef')],_0x2ee4('0xf1'))[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0xe1db2e[_0x2ee4('0xe4')],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0xf2')));break;case 0x13:if(_0xe1db2e[_0x2ee4('0x11e')]>=_0x37ddc7[_0x2ee4('0x125')]-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countmachineretry':_0xe1db2e['countmachineretry']+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7['dialMachineRetryFrequency'],'minutes')[_0x2ee4('0x44')](_0x2ee4('0xcc')),'ContactId':_0xe1db2e['ContactId'],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e[_0x2ee4('0x100')]||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xe1db2e[_0x2ee4('0x192')]>=_0x37ddc7[_0x2ee4('0x19d')]-0x1){return!![];}hopperUtils[_0x2ee4('0xe2')]({'active':![],'countagentrejectretry':_0xe1db2e[_0x2ee4('0x192')]+=0x1,'scheduledat':moment()[_0x2ee4('0xe3')](_0x37ddc7['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x2ee4('0xcc')),'ContactId':_0xe1db2e['ContactId'],'ListId':_0xe1db2e[_0x2ee4('0xe5')],'VoiceQueueId':_0xe1db2e['VoiceQueueId']||undefined,'CampaignId':_0xe1db2e[_0x2ee4('0xe6')]||undefined})['catch'](loggerCatch(_0x2ee4('0x19e')));break;default:return!![];}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x19f')]=function(_0x15db3e,_0x358d2e,_0xa822f2){var _0x1eebd3=this;var _0x641eec=new History(_0x15db3e);var _0x74428c=![];var _0x4fbadd;var _0x3d1a07;return new Promise(function(_0x27e610,_0x387da2){if(_[_0x2ee4('0x58')](_0x358d2e)&&typeof _0x358d2e!=='object'){return _0x387da2(msgResponse('[callProgressDetecting]',_0x2ee4('0x9b'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0xa822f2)&&typeof _0xa822f2!=='object'){return _0x387da2(msgResponse(_0x2ee4('0x1a0'),_0x2ee4('0x9b'),_0x2ee4('0x1a1')));}hopperUtils[_0x2ee4('0xdd')](_0x641eec,_0xa822f2[_0x2ee4('0x1a2')],_0x358d2e)['then'](function(_0x19bdd7){if(_0x19bdd7[_0x2ee4('0xdf')]==0x1)_0x74428c=!![];switch(_0xa822f2[_0x2ee4('0x1a2')]){case'0':_0x358d2e['outboundNoSuchCallsDay']+=0x1;_0x641eec['state']=0x0;_0x641eec['statedesc']=_0x2ee4('0x1a3');_0x641eec[_0x2ee4('0x123')]+=0x1;_0x641eec[_0x2ee4('0xda')]+=0x1;ami['emit'](_0x2ee4('0x1a4'),ut['buildObj'](_0x15db3e,_0x2ee4('0x1a5')));_0x4fbadd=_0x358d2e[_0x2ee4('0x19b')];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];hopperUtils['createHistory'](_0x641eec)['catch'](loggerCatch(_0x2ee4('0x120')));if(_0x1eebd3[_0x2ee4('0x191')](0x0,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec[_0x2ee4('0x123')]>=_0x358d2e[_0x2ee4('0x19a')]){_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,'reason\x200\x20no\x20such\x20number....');}else{_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1a7'));}}break;case'3':_0x358d2e[_0x2ee4('0x1a8')]+=0x1;_0x641eec[_0x2ee4('0x74')]=0x3;_0x641eec['statedesc']=_0x2ee4('0x1a9');_0x641eec['countnoanswerretry']+=0x1;_0x641eec[_0x2ee4('0xda')]+=0x1;var _0x44b5f7=ut[_0x2ee4('0x1aa')](_0x15db3e,_0x358d2e);ami[_0x2ee4('0x3f')](_0x2ee4('0x1ab'),_0x44b5f7);_0x4fbadd=_0x358d2e['dialNoAnswerRetryFrequency'];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];hopperUtils['createHistory'](_0x641eec)[_0x2ee4('0xa4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1eebd3['checkRetriveMax'](0x3,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec['countnoanswerretry']>=_0x358d2e[_0x2ee4('0x1ac')]){_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1ad'));}else{_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1ad'));}}break;case'5':_0x358d2e['outboundBusyCallsDay']+=0x1;_0x641eec[_0x2ee4('0x74')]=0x5;_0x641eec[_0x2ee4('0xd5')]='Busy';_0x641eec['countbusyretry']+=0x1;_0x641eec['countglobal']+=0x1;ami[_0x2ee4('0x3f')](_0x2ee4('0x1ae'),ut['buildObj'](_0x15db3e,_0x2ee4('0x1af')));_0x4fbadd=_0x358d2e[_0x2ee4('0x196')];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];hopperUtils['createHistory'](_0x641eec)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1b0')));if(_0x1eebd3[_0x2ee4('0x191')](0x5,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec[_0x2ee4('0x12a')]>=_0x358d2e['dialBusyMaxRetry']){_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,'reason\x205\x20busy');}else{_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1b1'));}}break;case'8':_0x358d2e[_0x2ee4('0x1b2')]+=0x1;_0x641eec[_0x2ee4('0x74')]=0x8;_0x641eec[_0x2ee4('0xd5')]='Congestion';_0x641eec[_0x2ee4('0x121')]+=0x1;_0x641eec[_0x2ee4('0xda')]+=0x1;_0x4fbadd=_0x358d2e['dialCongestionRetryFrequency'];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];ami[_0x2ee4('0x3f')](_0x2ee4('0x1b3'),ut[_0x2ee4('0x11a')](_0x15db3e,_0x2ee4('0x1b4')));hopperUtils[_0x2ee4('0xcd')](_0x641eec)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1b5')));if(_0x1eebd3[_0x2ee4('0x191')](0x8,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec[_0x2ee4('0x121')]>=_0x358d2e[_0x2ee4('0x198')]){_0x1eebd3['createStateFinal'](_0x641eec,_0x27e610,_0x387da2,'reason\x208\x20congestion');}else{_0x1eebd3['stateGlobal'](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1b6'));}}break;case'11':_0x358d2e[_0x2ee4('0x1b7')]+=0x1;_0x641eec['state']=0xb;_0x641eec[_0x2ee4('0xd5')]=_0x2ee4('0xed');_0x641eec[_0x2ee4('0xf0')]+=0x1;_0x641eec[_0x2ee4('0xda')]+=0x1;_0x4fbadd=_0x358d2e[_0x2ee4('0xef')];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];hopperUtils['createHistory'](_0x641eec)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1b8')));if(_0x1eebd3['checkRetriveMax'](0xb,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec[_0x2ee4('0xf0')]>=_0x358d2e[_0x2ee4('0x1b9')]){_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1ba'));}else{_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1ba'));}}break;case'20':_0x358d2e[_0x2ee4('0x1bb')]+=0x1;_0x641eec[_0x2ee4('0x74')]=0x14;_0x641eec[_0x2ee4('0xd5')]='AgentReject';_0x641eec[_0x2ee4('0x192')]+=0x1;_0x641eec[_0x2ee4('0xda')]+=0x1;_0x4fbadd=_0x358d2e[_0x2ee4('0x1bc')];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];ami['emit']('custom:agentreject',ut[_0x2ee4('0x11a')](_0x15db3e,_0x2ee4('0x1bd')));hopperUtils[_0x2ee4('0xcd')](_0x641eec)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1be')));if(_0x1eebd3['checkRetriveMax'](0x14,_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec[_0x2ee4('0x192')]>=_0x358d2e[_0x2ee4('0x19d')]){_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,_0x2ee4('0x1bf'));}else{_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,'reason\x2020\x20agentreject');}}break;default:_0x358d2e[_0x2ee4('0x133')]+=0x1;_0x641eec['state']=0xc;_0x641eec[_0x2ee4('0xd5')]=_0xa822f2[_0x2ee4('0x1a2')];_0x4fbadd=_0x358d2e['dialAgentRejectRetryFrequency'];_0x3d1a07=_0x358d2e[_0x2ee4('0xdc')];hopperUtils['createHistory'](_0x641eec)[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1c0')));if(_0x1eebd3[_0x2ee4('0x191')](_0xa822f2[_0x2ee4('0x1a2')],_0x15db3e,_0x358d2e)&&!_0x74428c){if(_0x641eec['countbusyretry']+_0x641eec[_0x2ee4('0x121')]+_0x641eec[_0x2ee4('0x122')]+_0x641eec[_0x2ee4('0x123')]+_0x641eec['countdropretry']+_0x641eec[_0x2ee4('0xf0')]+_0x641eec[_0x2ee4('0x11e')]+_0x641eec['countagentrejectretry']>=_0x358d2e[_0x2ee4('0x12b')]){_0x1eebd3[_0x2ee4('0x1a6')](_0x641eec,_0x27e610,_0x387da2,_0xa822f2[_0x2ee4('0x1a2')]);}else{_0x1eebd3[_0x2ee4('0x126')](_0x641eec,_0x27e610,_0x387da2,_0xa822f2[_0x2ee4('0x1a2')]);}}}})[_0x2ee4('0x3d')](function(){if(_0x74428c){hopperUtils[_0x2ee4('0xea')](_0x641eec,_0x4fbadd,_0x3d1a07)[_0x2ee4('0x3d')](function(){return _0x27e610(0x1);});}});});};Dialer['prototype'][_0x2ee4('0x1a6')]=function(_0x1e0171,_0x5f063e,_0xb356bb,_0x12a638){var _0x3b70a5=new Final(_0x1e0171);_0x3b70a5[_0x2ee4('0x74')]=0xf;_0x3b70a5[_0x2ee4('0xd5')]=_0x2ee4('0x1c1');this[_0x2ee4('0x126')](_0x3b70a5,_0x5f063e,_0xb356bb,_0x12a638);};Dialer[_0x2ee4('0x92')][_0x2ee4('0x126')]=function(_0x47531c,_0x33681e,_0x39b547,_0x8ae3b9){hopperUtils[_0x2ee4('0xcf')](_0x47531c)[_0x2ee4('0x3d')](function(){return _0x33681e(msgResponse('[callProgressDetecting]',_0x2ee4('0x10d'),_0x8ae3b9));})[_0x2ee4('0xa4')](function(){return _0x39b547(msgResponse(_0x2ee4('0x1c2'),_0x2ee4('0x9b'),_0x2ee4('0x1c3')));});};Dialer['prototype'][_0x2ee4('0x9')]=function(_0x585659){var _0xb77308=_0x585659[_0x2ee4('0x1c4')]/0x64;var _0xb31d1b=_0x585659[_0x2ee4('0x1c5')]/(_0x585659[_0x2ee4('0x1c5')]+_0x585659[_0x2ee4('0xc9')]);var _0x329df5=Math[_0x2ee4('0x1c6')](_0x585659[_0x2ee4('0x1c7')]*(_0x585659[_0x2ee4('0x1c8')]/0x64));var _0x121e89=Math['round'](_0x585659[_0x2ee4('0x1c7')]*(_0x585659[_0x2ee4('0x1c9')]/0x64));var _0x19bd4c=_0x585659[_0x2ee4('0x1ca')]+_0x585659['talking'];var _0x2ee217=Math[_0x2ee4('0x1cb')](_0x585659[_0x2ee4('0x5c')]*_0x585659[_0x2ee4('0x5f')]*_0x585659[_0x2ee4('0x1cc')]*_0x585659[_0x2ee4('0x1cd')]);if(_['isUndefined'](_0x585659[_0x2ee4('0x64')])){if(!_[_0x2ee4('0x58')](_0x585659[_0x2ee4('0x23')])){_0x585659[_0x2ee4('0x23')]=undefined;loggerPredictive['error'](_0x2ee4('0x1ce'),_0x2ee4('0x1cf'));}if(!_[_0x2ee4('0x58')](_0x585659[_0x2ee4('0x65')])){loggerPredictive[_0x2ee4('0x68')](_0x2ee4('0x1ce'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x585659['handlePredictive']);_0x585659['handlePredictive']=undefined;}_0x585659[_0x2ee4('0x64')]=moment()[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2ee4('0x4b')](_0x585659[_0x2ee4('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x585659[_0x2ee4('0x64')]);this['handlePower'](_0x585659,0x1);}else if(ifInterval(_0x585659['dialPredictiveInterval'],_0x585659[_0x2ee4('0x64')])){this[_0x2ee4('0xb9')](_0x585659,0x1);loggerPredictiveCalls[_0x2ee4('0x4b')](_0x2ee4('0x1d0'),_0x585659[_0x2ee4('0x64')],_0x585659[_0x2ee4('0x46')]);_0x585659['erlangCalls']=0x0;_0x585659[_0x2ee4('0xd4')]=0x0;}else if(_0xb77308<_0xb31d1b&&_0x585659[_0x2ee4('0x1d1')]===_0x2ee4('0x1d2')){clearPredictiveAttributes(_0x585659);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x1d3'),_0x2ee4('0x1d4'),_0xb31d1b,_0x2ee4('0x64'),_0x585659[_0x2ee4('0x46')]);}else if(_0x2ee217<_0x585659['predictiveIntervalErlangCallsDroppedCalls']&&_0x585659[_0x2ee4('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x585659);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x1d5'),'Max\x20Drop\x20',_0x2ee217,'Drop\x20in\x20this\x20interval',_0x585659[_0x2ee4('0xd4')],_0x2ee4('0x64'),_0x585659[_0x2ee4('0x46')]);}else if(!ifInterval(_0x585659[_0x2ee4('0x1d6')],_0x585659['startProgressive'])&&_[_0x2ee4('0x58')](_0x585659[_0x2ee4('0x23')])&&!_[_0x2ee4('0x58')](_0x585659[_0x2ee4('0x64')])){_0x585659[_0x2ee4('0x23')]=moment()[_0x2ee4('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2ee4('0x4b')](_0x585659['name'],_0x2ee4('0x1d7'),_0x585659[_0x2ee4('0x23')]);hopperUtils[_0x2ee4('0x1d8')](_0x585659[_0x2ee4('0x1d6')])['then'](this[_0x2ee4('0x1d9')](_0x585659))['then'](mergeDataErlangB(_0x585659))['then'](this[_0x2ee4('0x1da')](_0x585659))[_0x2ee4('0xa4')](loggerCatchPredictive(_0x2ee4('0x1db'),_0x585659));}else if(!ifInterval(_0x585659[_0x2ee4('0x1d6')],_0x585659[_0x2ee4('0x23')])){_0x585659[_0x2ee4('0xd4')]=0x0;_0x585659['startPredictive']=moment()['format'](_0x2ee4('0xcc'));loggerPredictive[_0x2ee4('0x4b')](_0x585659['name'],_0x2ee4('0x1dc'),_0x585659['startPredictive']);clearInterval(_0x585659['handlePredictive']);_0x585659[_0x2ee4('0x65')]=undefined;hopperUtils[_0x2ee4('0x1d8')](_0x585659['dialPredictiveInterval'])[_0x2ee4('0x3d')](this['getDataPredictive'](_0x585659))[_0x2ee4('0x3d')](mergeDataErlangB(_0x585659))[_0x2ee4('0x3d')](this[_0x2ee4('0x1da')](_0x585659))[_0x2ee4('0xa4')](loggerCatchPredictive(_0x2ee4('0x1dd'),_0x585659));}else if(_0x585659[_0x2ee4('0x1c7')]&&_0x19bd4c<_0x585659['predictiveIntervalAvailable']-_0x121e89){clearPredictiveAttributes(_0x585659);loggerPredictive[_0x2ee4('0x4b')](_0x585659[_0x2ee4('0x46')],_0x2ee4('0x1de'),_0x19bd4c,_0x2ee4('0x1df'),_0x585659['predictiveIntervalAvailable'],'-',_0x121e89,'=',_0x585659['predictiveIntervalAvailable']-_0x121e89,')');}else if(_0x585659[_0x2ee4('0x1c7')]&&_0x19bd4c>_0x585659['predictiveIntervalAvailable']+_0x329df5){clearPredictiveAttributes(_0x585659);loggerPredictive['info'](_0x585659[_0x2ee4('0x46')],_0x2ee4('0x1de'),_0x19bd4c,_0x2ee4('0x1e0'),_0x585659[_0x2ee4('0x1c7')],'+',_0x329df5,'=',_0x585659['predictiveIntervalAvailable']+_0x329df5,')');}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x1d9')]=function(_0x3ed8ab){var _0x8c3c55=this;return function(_0xc75bb){return new Promise(function(_0x26c940,_0x430e90){_[_0x2ee4('0x62')](_0x3ed8ab,_0xc75bb[0x0]);if(checkGetDataPredictive(_0xc75bb[0x0])){var _0x19b2b9=_0x3ed8ab[_0x2ee4('0x1c7')]=_0x3ed8ab[_0x2ee4('0x139')]+_0x3ed8ab[_0x2ee4('0x1ca')];var _0x3e454d=_0x3ed8ab[_0x2ee4('0x1d6')]*0x3c;var _0x46edf6=_0xc75bb[0x0][_0x2ee4('0x54')]+_0xc75bb[0x0][_0x2ee4('0x52')];var _0x2be67b=(_0xc75bb[0x0][_0x2ee4('0x4d')]+_0xc75bb[0x0][_0x2ee4('0x4f')]+_0xc75bb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xc75bb[0x0][_0x2ee4('0x56')];_0x3ed8ab[_0x2ee4('0x1cc')]=_0x2be67b>0x0?_0x2be67b:0x1;switch(_0x3ed8ab[_0x2ee4('0x1d1')]){case _0x2ee4('0x1d2'):var _0x110cba=_0x3ed8ab[_0x2ee4('0x1c4')]/0x64;return _0x8c3c55[_0x2ee4('0x1e1')](_0x19b2b9,_0x3e454d,_0x46edf6,_0x2be67b,_0x110cba)[_0x2ee4('0x3d')](function(_0x1c2118){return _0x26c940(_0x1c2118);});case _0x2ee4('0x1e2'):var _0x4815f5=_0x3ed8ab[_0x2ee4('0x1c4')]/0x64;return _0x8c3c55[_0x2ee4('0x1e3')](_0x19b2b9,_0x3e454d,_0x46edf6,_0x2be67b,_0x4815f5)[_0x2ee4('0x3d')](function(_0x319eba){return _0x26c940(_0x319eba);});default:return _0x430e90(msgResponse(_0x2ee4('0x1e4'),_0x2ee4('0x9b'),_0x2ee4('0x1e5')));}}else{return _0x430e90(msgResponse(_0x2ee4('0x1e4'),_0x2ee4('0x9b'),_0x2ee4('0x1e6')));}});};};Dialer[_0x2ee4('0x92')][_0x2ee4('0x1e7')]=function(_0x361cc7){var _0x542ee1=this;return function(_0x26ec4d){return new Promise(function(_0x4f5e3b,_0x29807e){_['merge'](_0x361cc7,_0x26ec4d[0x0]);if(checkGetDataPredictive(_0x26ec4d[0x0])){loggerPredictive[_0x2ee4('0x4b')](JSON['stringify'](_0x26ec4d[0x0]));if(_0x361cc7['dialPredictiveOptimization']==='dropRate'){return _0x542ee1[_0x2ee4('0x14f')](_0x361cc7['id'])['then'](function(_0x98a643){var _0xdfea04=_0x361cc7[_0x2ee4('0x1e8')]-_0x98a643[0x0][_0x2ee4('0x1e9')];var _0x469816=_0x361cc7[_0x2ee4('0x1d6')]*0x3c;var _0x457292=_0x26ec4d[0x0]['predictiveIntervalAvgTalktime']+_0x26ec4d[0x0][_0x2ee4('0x52')];var _0x1c2e2b=(_0x26ec4d[0x0][_0x2ee4('0x4d')]+_0x26ec4d[0x0][_0x2ee4('0x4f')]+_0x26ec4d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x26ec4d[0x0][_0x2ee4('0x56')];var _0x245c67=_0x361cc7[_0x2ee4('0x1c4')]/0x64;_0x361cc7[_0x2ee4('0x1ea')]=_0x98a643[0x0][_0x2ee4('0x1e9')]||0x0;_0x361cc7['predictiveIntervalHitRate']=_0x1c2e2b>0x0?_0x1c2e2b:0x1;return _0x542ee1[_0x2ee4('0x1e1')](_0xdfea04,_0x469816,_0x457292,_0x1c2e2b,_0x245c67);})[_0x2ee4('0x3d')](function(_0x54ac0b){return _0x4f5e3b(_0x54ac0b);})[_0x2ee4('0xa4')](function(_0x318f4c){return _0x29807e(msgResponse(_0x2ee4('0x1eb'),_0x2ee4('0x9b'),JSON[_0x2ee4('0x79')](_0x318f4c)));});}if(_0x361cc7['dialPredictiveOptimization']===_0x2ee4('0x1e2')){return _0x542ee1[_0x2ee4('0x14f')](_0x361cc7['id'])[_0x2ee4('0x3d')](function(_0x598502){var _0x33f2ff=_0x361cc7[_0x2ee4('0x1e8')]-_0x598502[0x0]['outboundQueuePauses'];var _0x771dba=_0x361cc7['dialPredictiveInterval']*0x3c;var _0x46f6f7=_0x26ec4d[0x0]['predictiveIntervalAvgTalktime']+_0x26ec4d[0x0][_0x2ee4('0x52')];var _0x106dad=(_0x26ec4d[0x0][_0x2ee4('0x4d')]+_0x26ec4d[0x0][_0x2ee4('0x4f')]+_0x26ec4d[0x0][_0x2ee4('0xeb')])/_0x26ec4d[0x0][_0x2ee4('0x56')];var _0x57a4b1=_0x361cc7[_0x2ee4('0x1c4')]/0x64;_0x361cc7[_0x2ee4('0x1ea')]=_0x598502[0x0]['outboundQueuePauses']||0x0;_0x361cc7['predictiveIntervalHitRate']=_0x106dad>0x0?_0x106dad:0x1;return _0x542ee1[_0x2ee4('0x1e3')](_0x33f2ff,_0x771dba,_0x46f6f7,_0x106dad,_0x57a4b1);})[_0x2ee4('0x3d')](function(_0x45775a){return _0x4f5e3b(_0x45775a);})['catch'](function(_0x110b32){return _0x29807e(msgResponse(_0x2ee4('0x1eb'),_0x2ee4('0x9b'),JSON[_0x2ee4('0x79')](_0x110b32)));});}}else{return _0x29807e(msgResponse(_0x2ee4('0x1e4'),_0x2ee4('0x9b'),_0x2ee4('0x1e6')));}});};};Dialer['prototype'][_0x2ee4('0x1da')]=function(_0x28b9ae){var _0x4adbb6=this;return function(){var _0xee6592=0x0;var _0x5514d9=Math[_0x2ee4('0x1cb')](_0x28b9ae[_0x2ee4('0x5d')]*0x3e8);if(_0x5514d9>0x0){_0x5514d9=_0x5514d9<0x64?0x64:_0x5514d9;loggerPredictive['info'](_0x28b9ae[_0x2ee4('0x46')],_0x2ee4('0x1ec'),_0x5514d9,_0x2ee4('0x1ed'));_0x28b9ae[_0x2ee4('0x65')]=setInterval(function(){_0x4adbb6[_0x2ee4('0x65')](_0x28b9ae);loggerPredictiveCalls[_0x2ee4('0x4b')](_0x2ee4('0x1ee'),_0xee6592+=0x1);},_0x5514d9);}else{loggerPredictive[_0x2ee4('0x4b')](_0x28b9ae[_0x2ee4('0x46')],_0x2ee4('0x1ef'));}};};Dialer[_0x2ee4('0x92')][_0x2ee4('0x1f0')]=function(_0x5c6377,_0x33eb71){var _0x13249d=this;return function(_0x3a12b6){if(_[_0x2ee4('0x48')](_0x3a12b6)){if(_[_0x2ee4('0xf8')](_0x33eb71[_0x2ee4('0x156')])||!_0x33eb71[_0x2ee4('0x1f1')]){if(_0x5c6377[_0x2ee4('0xb7')]==='booked'){_0x5c6377['queueStatusComplete']=_[_0x2ee4('0x58')](_0x5c6377[_0x2ee4('0x77')])?!![]:_0x5c6377[_0x2ee4('0x77')];var _0x3ba96a=uuid['v4']();_0x13249d[_0x2ee4('0xf3')][_0x3ba96a]=new Action(_0x5c6377,_0x33eb71,_0x3ba96a);loggerBooked[_0x2ee4('0x4b')](_0x2ee4('0x1f2'),_0x3ba96a,_0x2ee4('0x1f3'),JSON['stringify'](_0x5c6377['queueStatusComplete']),_0x2ee4('0x1f4'),_0x5c6377[_0x2ee4('0x46')]);if(_0x5c6377[_0x2ee4('0x77')]){_0x5c6377[_0x2ee4('0x77')]=![];_0x13249d[_0x2ee4('0x25')][_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0xc2')]]=[];ami[_0x2ee4('0xa5')]({'actionid':_0x3ba96a,'action':_0x2ee4('0x1f5'),'queue':_0x5c6377[_0x2ee4('0x46')]})[_0x2ee4('0xa4')](function(){_0x13249d[_0x2ee4('0xc6')](_0x5c6377);hopperUtils[_0x2ee4('0xe2')]({'active':![],'ContactId':_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0xe4')],'ListId':_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0xe5')],'VoiceQueueId':_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0x100')]||undefined,'CampaignId':_0x13249d['actions'][_0x3ba96a][_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1f6')));delete _0x13249d[_0x2ee4('0xf3')][_0x3ba96a];});}else{loggerBooked[_0x2ee4('0x4b')](_0x2ee4('0x1f7'),JSON[_0x2ee4('0x79')](_0x5c6377['queueStatusComplete']),_0x2ee4('0x1f4'),_0x5c6377[_0x2ee4('0x46')]);_0x13249d[_0x2ee4('0xc6')](_0x5c6377);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0xe4')],'ListId':_0x13249d[_0x2ee4('0xf3')][_0x3ba96a][_0x2ee4('0xe5')],'VoiceQueueId':_0x13249d['actions'][_0x3ba96a][_0x2ee4('0x100')]||undefined,'CampaignId':_0x13249d['actions'][_0x3ba96a][_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x1f6')));delete _0x13249d['actions'][_0x3ba96a];}}else{return _0x13249d[_0x2ee4('0x1f8')](_0x5c6377,_0x33eb71);}}else{if(utils[_0x2ee4('0x63')](undefined,_0x33eb71[_0x2ee4('0x1f9')])<_0x5c6377['dialRecallMeTimeout']*0x3c){if(_0x33eb71['Agent']&&!_0x33eb71['Agent']['voicePause']){_0x13249d[_0x2ee4('0x1c')][_0x2ee4('0x1fa')](_0x33eb71['id'])[_0x2ee4('0x1b')](function(){_0x13249d[_0x2ee4('0xc6')](_0x5c6377);});}else{hopperUtils[_0x2ee4('0x1fb')]({'active':![]},_0x33eb71['id'],0x1)[_0x2ee4('0x1b')](function(){_0x13249d[_0x2ee4('0xc6')](_0x5c6377);});}}else{_0x5c6377[_0x2ee4('0x1fc')]+=0x1;_0x13249d[_0x2ee4('0xc6')](_0x5c6377);if(_0x5c6377[_0x2ee4('0x1fd')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33eb71[_0x2ee4('0xe4')],'ListId':_0x33eb71[_0x2ee4('0xe5')],'VoiceQueueId':_0x33eb71[_0x2ee4('0x100')]||undefined,'CampaignId':_0x33eb71[_0x2ee4('0xe6')]||undefined})[_0x2ee4('0xa4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x2ee4('0xcd')](createObjHistory(_0x5c6377,_0x33eb71,utils[_0x2ee4('0x6d')][_0x2ee4('0x1fe')],0x17,_0x2ee4('0x1ff')))['catch'](loggerCatch(_0x2ee4('0x200')));}else{_0x13249d['saveInDb'](createObjHistory(_0x5c6377,_0x33eb71,utils[_0x2ee4('0x6d')][_0x2ee4('0x201')],0x16,_0x2ee4('0x202')),_0x2ee4('0x203'),_0x2ee4('0x204'));}}}}else{_0x5c6377[_0x2ee4('0x205')]+=0x1;_0x13249d['saveInDb'](createObjHistory(_0x5c6377,_0x33eb71,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),_0x2ee4('0x206'),'[Originate][MoveBlacklist]');throw _0x2ee4('0x207');}};};Dialer['prototype'][_0x2ee4('0x15a')]=function(_0x2c9326){var _0xe73806=this;var _0x101b01=_0x2c9326[_0x2ee4('0x208')]-_0x2c9326[_0x2ee4('0x83')];emitCampaignSummary(_0x2c9326);if(_0x101b01>0x0&&_0x2c9326[_0x2ee4('0x6b')]==0x0){if(_0x101b01>this[_0x2ee4('0x20')]){_0x101b01=this[_0x2ee4('0x20')];}_0x2c9326[_0x2ee4('0x6b')]=0x1;hopperUtils[_0x2ee4('0x209')](_0x2c9326,_0x101b01)[_0x2ee4('0x3d')](function(_0x36471a){_0x2c9326[_0x2ee4('0x6b')]=0x0;if(_0x36471a){if(!utils[_0x2ee4('0x20a')](_0x36471a)){_0x2c9326['message']=utils[_0x2ee4('0x6d')][_0x2ee4('0x72')];logger[_0x2ee4('0x4b')](_0x2ee4('0x20b')+_0x2c9326['name']);}else{_0x2c9326[_0x2ee4('0x83')]+=_0x36471a[_0x2ee4('0x9e')];_0x2c9326[_0x2ee4('0x71')]=utils[_0x2ee4('0x6d')][_0x2ee4('0x20c')];for(var _0x6c543e=0x0;_0x6c543e<_0x36471a['length'];_0x6c543e+=0x1){_0x2c9326['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x36471a[_0x6c543e])||_[_0x2ee4('0xf8')](_0x36471a[_0x6c543e][_0x2ee4('0x17a')])||_[_0x2ee4('0xf8')](_0x36471a[_0x6c543e][_0x2ee4('0x15e')])){_0xe73806[_0x2ee4('0x153')](_0x2ee4('0x20d'),_0x2c9326,_0x36471a[_0x6c543e]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x2ee4('0xfd')](_0x36471a[_0x6c543e],[_0x2ee4('0xe6'),_0x2ee4('0x15e')]))[_0x2ee4('0x3d')](_0xe73806[_0x2ee4('0x1f0')](_0x2c9326,_0x36471a[_0x6c543e]))[_0x2ee4('0xa4')](_0xe73806[_0x2ee4('0x152')]('[actionOriginateIvr]\x20',_0x2c9326));}}}}})[_0x2ee4('0xa4')](loggerGetContactDialer(_0x2ee4('0x20e'),_0x2c9326,_0x101b01));}};Dialer[_0x2ee4('0x92')][_0x2ee4('0xb9')]=function(_0x4df6a8,_0x1fda2e){var _0x4e1230=this;var _0x512507=[];if(_0x1fda2e<0x1||_0x4df6a8[_0x2ee4('0xb7')]===_0x2ee4('0xbc')){_0x1fda2e=0x1;}var _0x19168d=Math[_0x2ee4('0x1cb')](_0x4df6a8[_0x2ee4('0x1ca')]*_0x1fda2e)-_0x4df6a8[_0x2ee4('0x83')];if(_0x4df6a8[_0x2ee4('0x20f')]>0x0){var _0x3dae4d=_0x4df6a8[_0x2ee4('0x20f')]-_0x4df6a8[_0x2ee4('0x83')]-_0x4df6a8[_0x2ee4('0x139')]-_0x4df6a8[_0x2ee4('0x13a')];if(_0x19168d>_0x3dae4d){_0x19168d=_0x3dae4d;}}if(_0x19168d>0x0&&_0x4df6a8['temp']==0x0){if(_0x4df6a8['dialMethod']===_0x2ee4('0xbc')){_0x19168d=0x1;}if(_0x19168d>this['maxNumberOriginate']){_0x19168d=this[_0x2ee4('0x20')];}for(var _0x40d6cd in this[_0x2ee4('0x1e')]){if(typeof this[_0x2ee4('0x1e')][_0x40d6cd]!==_0x2ee4('0xb0')){if(this[_0x2ee4('0x1e')][_0x40d6cd][_0x2ee4('0x74')]===_0x2ee4('0x210')&&this[_0x2ee4('0x1e')][_0x40d6cd][_0x2ee4('0x8c')]===_0x2ee4('0x143')){_0x512507[_0x2ee4('0x9f')](this['agents'][_0x40d6cd]['id']);}}}_0x4df6a8[_0x2ee4('0x6b')]=0x1;hopperUtils[_0x2ee4('0x211')](_0x4df6a8,_0x512507,_0x19168d)[_0x2ee4('0x3d')](function(_0x5c1355){_0x4df6a8['temp']=0x0;if(_0x5c1355){if(!utils['checkContactEmpty'](_0x5c1355)){hopperUtils['countReScheduled'](_0x4df6a8)['then'](sendMessageReschedule(_0x4df6a8))[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x212')));}else{_0x4df6a8[_0x2ee4('0x83')]+=_0x5c1355['length'];_0x4df6a8[_0x2ee4('0x71')]=_0x4df6a8['dialMethod']==='booked'?utils[_0x2ee4('0x6d')][_0x2ee4('0x13b')]:utils[_0x2ee4('0x6d')][_0x2ee4('0x20c')];for(var _0x47120b=0x0;_0x47120b<_0x5c1355[_0x2ee4('0x9e')];_0x47120b+=0x1){if(_[_0x2ee4('0xf8')](_0x5c1355[_0x47120b])||_[_0x2ee4('0xf8')](_0x5c1355[_0x47120b]['Contact'])||_['isNil'](_0x5c1355[_0x47120b][_0x2ee4('0x15e')])){_0x4e1230['emptyContact'](_0x2ee4('0x20d'),_0x4df6a8,_0x5c1355[_0x47120b]);}else{hopperUtils[_0x2ee4('0x213')](_[_0x2ee4('0xfd')](_0x5c1355[_0x47120b],[_0x2ee4('0x100'),_0x2ee4('0x15e')]))[_0x2ee4('0x3d')](_0x4e1230[_0x2ee4('0x1f0')](_0x4df6a8,_0x5c1355[_0x47120b]))[_0x2ee4('0xa4')](_0x4e1230[_0x2ee4('0x152')](_0x2ee4('0x20d'),_0x4df6a8));}}}}})[_0x2ee4('0xa4')](loggerGetContactDialer(_0x2ee4('0x214'),_0x4df6a8,_0x19168d));}};Dialer[_0x2ee4('0x92')][_0x2ee4('0x65')]=function(_0x8de6b3){if(_0x8de6b3['dialLimitQueue']>0x0){var _0x4e6c0e=_0x8de6b3[_0x2ee4('0x20f')]-_0x8de6b3[_0x2ee4('0x83')]-_0x8de6b3[_0x2ee4('0x139')];if(_0x4e6c0e>0x0&&_0x8de6b3['temp']==0x0){this[_0x2ee4('0x215')](_0x8de6b3);}else{loggerPredictiveCalls[_0x2ee4('0x4b')](_0x2ee4('0x216'));}}else{this[_0x2ee4('0x215')](_0x8de6b3);}};Dialer['prototype'][_0x2ee4('0x215')]=function(_0x12b355){var _0x435632=this;var _0x1125c0=[];_0x12b355[_0x2ee4('0x83')]+=0x1;for(var _0x1c34a0 in this[_0x2ee4('0x1e')]){if(typeof this['agents'][_0x1c34a0]!==_0x2ee4('0xb0')){if(this[_0x2ee4('0x1e')][_0x1c34a0][_0x2ee4('0x74')]===_0x2ee4('0x210')&&this['agents'][_0x1c34a0][_0x2ee4('0x8c')]===_0x2ee4('0x143')){_0x1125c0[_0x2ee4('0x9f')](this[_0x2ee4('0x1e')][_0x1c34a0]['id']);}}}_0x12b355[_0x2ee4('0x6b')]=0x1;return this['getContactDialer'](_0x12b355['id'],_0x1125c0,0x1,_0x12b355[_0x2ee4('0x217')],_0x12b355)[_0x2ee4('0x3d')](function(_0x15fb75){_0x12b355[_0x2ee4('0x6b')]=0x1;if(_0x15fb75){if(!utils[_0x2ee4('0x20a')](_0x15fb75)){utils['checkContactLowerLimitOriginate'](_0x12b355,0x1,0x0);return hopperUtils['countReScheduled'](_0x12b355)['then'](sendMessageReschedule(_0x12b355))[_0x2ee4('0xa4')](loggerCatch(_0x2ee4('0x212')));}else{_0x12b355['message']=utils['CAMPAIGN_STATUS'][_0x2ee4('0x20c')];if(_[_0x2ee4('0xf8')](_0x15fb75[0x0])||_[_0x2ee4('0xf8')](_0x15fb75[0x0]['Contact'])||_[_0x2ee4('0xf8')](_0x15fb75[0x0]['phone'])){_0x435632[_0x2ee4('0x153')](_0x2ee4('0x20d'),_0x12b355,_0x15fb75[0x0]);}else{return hopperUtils[_0x2ee4('0x213')](_[_0x2ee4('0xfd')](_0x15fb75[0x0],[_0x2ee4('0x100'),_0x2ee4('0x15e')]))['then'](_0x435632[_0x2ee4('0x1f0')](_0x12b355,_0x15fb75[0x0]))[_0x2ee4('0xa4')](_0x435632[_0x2ee4('0x152')]('[actionOriginatePredictive]\x20',_0x12b355));}}}})[_0x2ee4('0xa4')](loggerGetContactDialer(_0x2ee4('0x218'),_0x12b355,0x1));};Dialer['prototype'][_0x2ee4('0x1e1')]=function(_0x35899f,_0x4dcb64,_0x555b74,_0x6013ae,_0x1e8ed5,_0x46edd8){loggerPredictive[_0x2ee4('0x4b')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x219'),_0x35899f);loggerPredictive['info'](_0x2ee4('0x21a'),_0x4dcb64);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x21b'),_0x555b74);loggerPredictive[_0x2ee4('0x4b')]('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',_0x6013ae);loggerPredictive['info'](_0x2ee4('0x21c'),_0x1e8ed5);loggerPredictive[_0x2ee4('0x4b')]('---------------------------');return new Promise(function(_0x62d802,_0x128422){if(_0x35899f<=0x0||isNaN(_0x35899f)){return _0x128422(msgResponse(_0x2ee4('0x21d'),'Error',_0x2ee4('0x21e')+_0x35899f));}if(_0x555b74<=0x0||isNaN(_0x555b74)){return _0x128422(msgResponse(_0x2ee4('0x21d'),_0x2ee4('0xc1'),'Ts\x20=\x20'+_0x555b74));}if(_0x6013ae<=0x0||isNaN(_0x6013ae)){return _0x128422(msgResponse(_0x2ee4('0x21d'),_0x2ee4('0xc1'),_0x2ee4('0x21f')+_0x6013ae));}if(_0x4dcb64<=0x0||isNaN(_0x4dcb64)){return _0x128422(msgResponse(_0x2ee4('0x21d'),_0x2ee4('0xc1'),_0x2ee4('0x220')+_0x4dcb64));}if(_0x1e8ed5<=0x0||isNaN(_0x1e8ed5)){return _0x128422(msgResponse('[abandonmentRate]','Error',_0x2ee4('0x221')+_0x1e8ed5));}_0x46edd8=_0x46edd8||0x0;var _0x1059d3=0x1/_0x555b74;var _0x344969=0x0;var _0x3b8626=0x0;var _0xe6db67=0x0;var _0x1ef0b0=0x0;for(var _0x297a42=0x0;_0xe6db67<_0x1e8ed5;_0x297a42+=0x1){_0x3b8626=_0x297a42/_0x4dcb64;_0x344969=(_0x6013ae*_0x3b8626+_0x46edd8)/_0x1059d3;_0xe6db67=utils['erlangb'](_0x344969,_0x35899f);_0x1ef0b0=_0x344969/_0x35899f*(0x1-utils[_0x2ee4('0x222')](_0x344969,_0x35899f));}return _0x62d802({'erlangCalls':_0x297a42,'erlangCallToSecond':_0x4dcb64/_0x297a42,'erlangAbandonmentRate':_0xe6db67,'erlangBusyFactor':_0x1ef0b0});});};Dialer[_0x2ee4('0x92')][_0x2ee4('0x1e3')]=function(_0x22513c,_0xd5fe63,_0x7e8cb4,_0x3af208,_0xeecd51,_0xfd1331){loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x223'));loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x219'),_0x22513c);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x21a'),_0xd5fe63);loggerPredictive[_0x2ee4('0x4b')]('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',_0x7e8cb4);loggerPredictive['info'](_0x2ee4('0x224'),_0x3af208);loggerPredictive['info'](_0x2ee4('0x225'),_0xeecd51);loggerPredictive[_0x2ee4('0x4b')](_0x2ee4('0x55'));return new Promise(function(_0x21150d,_0x4a166b){if(_0x22513c<=0x0||isNaN(_0x22513c)){return _0x4a166b(msgResponse('[busyFactor]',_0x2ee4('0xc1'),_0x2ee4('0x21e')+_0x22513c));}if(_0x7e8cb4<=0x0||isNaN(_0x7e8cb4)){return _0x4a166b(msgResponse(_0x2ee4('0x226'),'Error','Ts\x20=\x20'+_0x7e8cb4));}if(_0x3af208<=0x0||isNaN(_0x3af208)){return _0x4a166b(msgResponse(_0x2ee4('0x226'),_0x2ee4('0xc1'),_0x2ee4('0x21f')+_0x3af208));}if(_0xd5fe63<=0x0||isNaN(_0xd5fe63)){return _0x4a166b(msgResponse(_0x2ee4('0x226'),_0x2ee4('0xc1'),_0x2ee4('0x220')+_0xd5fe63));}if(_0xeecd51<=0x0||isNaN(_0xeecd51)){return _0x4a166b(msgResponse(_0x2ee4('0x226'),_0x2ee4('0xc1'),'Umin\x20=\x20'+_0xeecd51));}_0xfd1331=_0xfd1331||0x0;var _0x26a5c4=0x1/_0x7e8cb4;var _0x24dc6f=0x0;var _0x2a1fda=0x0;var _0x5b8e24=0x0;var _0x1a6afe=0x0;for(var _0x424642=0x0;_0x1a6afe<_0xeecd51;_0x424642+=0x1){_0x2a1fda=_0x424642/_0xd5fe63;_0x24dc6f=(_0x3af208*_0x2a1fda+_0xfd1331)/_0x26a5c4;_0x5b8e24=utils[_0x2ee4('0x222')](_0x24dc6f,_0x22513c);_0x1a6afe=_0x24dc6f/_0x22513c*(0x1-utils[_0x2ee4('0x222')](_0x24dc6f,_0x22513c));}return _0x21150d({'erlangCalls':_0x424642,'erlangCallToSecond':_0xd5fe63/_0x424642,'erlangAbandonmentRate':_0x5b8e24,'erlangBusyFactor':_0x1a6afe});});};module[_0x2ee4('0x227')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 2caf1c1..625b448 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe8e=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','voiceQueue','getQueue','exports','util','lodash','isNil','string','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfe8e,0x1b2));var _0xefe8=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xfe8e[_0x1b8e60];return _0x363363;};'use strict';var util=require(_0xefe8('0x0'));var _=require(_0xefe8('0x1'));var moment=require('moment');function checkNameSurname(_0x28f0ba,_0x399bc0,_0x4b0ea8){var _0xdbf2f='';if(!_[_0xefe8('0x2')](_0x399bc0)&&'string'===typeof _0x399bc0){_0xdbf2f+=_0x399bc0;}if(!_['isNil'](_0x4b0ea8)&&_0xefe8('0x3')===typeof _0x4b0ea8){_0xdbf2f+='\x20'+_0x4b0ea8;}if(_0xdbf2f!==''){return _0xdbf2f;}return _0x28f0ba;}function Action(_0x348817,_0x1fa4de,_0xf4958f){this['voiceQueue']=_0x348817;this[_0xefe8('0x4')]=_0xf4958f||undefined;this[_0xefe8('0x5')]=checkNameSurname(_0x1fa4de[_0xefe8('0x6')][_0xefe8('0x7')],_0x1fa4de[_0xefe8('0x6')]['firstName'],_0x1fa4de[_0xefe8('0x6')][_0xefe8('0x8')]);this['number']=_0x1fa4de[_0xefe8('0x7')];this[_0xefe8('0x9')]=_0x348817[_0xefe8('0x5')];this[_0xefe8('0xa')]=_0x1fa4de[_0xefe8('0xa')]||![];this[_0xefe8('0xb')]=_0x348817[_0xefe8('0xb')];this[_0xefe8('0xc')]=_0x348817[_0xefe8('0xc')]||0x3;this['scheduledat']=_0x1fa4de[_0xefe8('0xd')];this[_0xefe8('0xe')]=_0x1fa4de[_0xefe8('0xe')];this[_0xefe8('0xf')]=_0x1fa4de['countcongestionretry'];this[_0xefe8('0x10')]=_0x1fa4de['countnoanswerretry'];this[_0xefe8('0x11')]=_0x1fa4de[_0xefe8('0x11')];this[_0xefe8('0x12')]=_0x1fa4de[_0xefe8('0x12')];this['countabandonedretry']=_0x1fa4de['countabandonedretry'];this[_0xefe8('0x13')]=_0x1fa4de[_0xefe8('0x13')];this[_0xefe8('0x14')]=_0x1fa4de[_0xefe8('0x14')];this[_0xefe8('0x15')]=_0x1fa4de[_0xefe8('0x15')];this['ListId']=_0x1fa4de['ListId'];this[_0xefe8('0x16')]=_0x1fa4de['UserId'];this[_0xefe8('0x17')]=_0x1fa4de[_0xefe8('0x17')];this['CampaignId']=_0x1fa4de['CampaignId'];this[_0xefe8('0x18')]=_0x1fa4de['id'];this[_0xefe8('0x19')]=_0x1fa4de[_0xefe8('0x6')]['firstName']||'';this[_0xefe8('0x1a')]=moment()[_0xefe8('0x1b')](_0xefe8('0x1c'));this[_0xefe8('0x1d')]=_0x1fa4de[_0xefe8('0x1d')];this[_0xefe8('0x1e')]=_0x1fa4de['callbackuniqueid'];this['callbackat']=_0x1fa4de[_0xefe8('0x1f')];this[_0xefe8('0x20')]=_0x1fa4de[_0xefe8('0x20')];this[_0xefe8('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0xefe8('0x22')]=function(){return util[_0xefe8('0x1b')](_0xefe8('0x23'),this['name'],this['voiceQueue'][_0xefe8('0x24')]>0x0?this[_0xefe8('0x25')][_0xefe8('0x26')](this[_0xefe8('0x27')][_0xefe8('0x24')]):this[_0xefe8('0x25')]);};Action['prototype'][_0xefe8('0x28')]=function(){return this[_0xefe8('0x9')];};module[_0xefe8('0x29')]=Action; \ No newline at end of file +var _0xdd0b=['callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x4071f9,_0x115be0){var _0x6cb8d8=function(_0x19524b){while(--_0x19524b){_0x4071f9['push'](_0x4071f9['shift']());}};_0x6cb8d8(++_0x115be0);}(_0xdd0b,0x1a9));var _0xbdd0=function(_0x85fb17,_0x13664f){_0x85fb17=_0x85fb17-0x0;var _0x3a3a25=_0xdd0b[_0x85fb17];return _0x3a3a25;};'use strict';var util=require(_0xbdd0('0x0'));var _=require(_0xbdd0('0x1'));var moment=require(_0xbdd0('0x2'));function checkNameSurname(_0x4dd547,_0x499446,_0x1c0e0e){var _0x3bb1ff='';if(!_[_0xbdd0('0x3')](_0x499446)&&_0xbdd0('0x4')===typeof _0x499446){_0x3bb1ff+=_0x499446;}if(!_['isNil'](_0x1c0e0e)&&_0xbdd0('0x4')===typeof _0x1c0e0e){_0x3bb1ff+='\x20'+_0x1c0e0e;}if(_0x3bb1ff!==''){return _0x3bb1ff;}return _0x4dd547;}function Action(_0x2cfb82,_0x263f6e,_0x6e0503){this[_0xbdd0('0x5')]=_0x2cfb82;this[_0xbdd0('0x6')]=_0x6e0503||undefined;this[_0xbdd0('0x7')]=checkNameSurname(_0x263f6e['Contact'][_0xbdd0('0x8')],_0x263f6e[_0xbdd0('0x9')][_0xbdd0('0xa')],_0x263f6e[_0xbdd0('0x9')][_0xbdd0('0xb')]);this[_0xbdd0('0xc')]=_0x263f6e['phone'];this[_0xbdd0('0xd')]=_0x2cfb82[_0xbdd0('0x7')];this[_0xbdd0('0xe')]=_0x263f6e[_0xbdd0('0xe')]||![];this['type']=_0x2cfb82[_0xbdd0('0xf')];this['dialQueueTimeout']=_0x2cfb82['dialQueueTimeout']||0x3;this[_0xbdd0('0x10')]=_0x263f6e[_0xbdd0('0x10')];this[_0xbdd0('0x11')]=_0x263f6e[_0xbdd0('0x11')];this[_0xbdd0('0x12')]=_0x263f6e[_0xbdd0('0x12')];this['countnoanswerretry']=_0x263f6e[_0xbdd0('0x13')];this['countnosuchnumberretry']=_0x263f6e[_0xbdd0('0x14')];this[_0xbdd0('0x15')]=_0x263f6e[_0xbdd0('0x15')];this['countabandonedretry']=_0x263f6e[_0xbdd0('0x16')];this[_0xbdd0('0x17')]=_0x263f6e[_0xbdd0('0x17')];this[_0xbdd0('0x18')]=_0x263f6e[_0xbdd0('0x18')];this['ContactId']=_0x263f6e[_0xbdd0('0x19')];this[_0xbdd0('0x1a')]=_0x263f6e['ListId'];this[_0xbdd0('0x1b')]=_0x263f6e[_0xbdd0('0x1b')];this[_0xbdd0('0x1c')]=_0x263f6e[_0xbdd0('0x1c')];this[_0xbdd0('0x1d')]=_0x263f6e[_0xbdd0('0x1d')];this[_0xbdd0('0x1e')]=_0x263f6e['id'];this[_0xbdd0('0x1f')]=_0x263f6e['Contact'][_0xbdd0('0xa')]||'';this['starttime']=moment()['format'](_0xbdd0('0x20'));this[_0xbdd0('0x21')]=_0x263f6e[_0xbdd0('0x21')];this[_0xbdd0('0x22')]=_0x263f6e[_0xbdd0('0x22')];this[_0xbdd0('0x23')]=_0x263f6e[_0xbdd0('0x23')];this[_0xbdd0('0x24')]=_0x263f6e[_0xbdd0('0x24')];this['originatecalleridnum']='';this[_0xbdd0('0x25')]='';}Action[_0xbdd0('0x26')][_0xbdd0('0x27')]=function(){return util[_0xbdd0('0x28')](_0xbdd0('0x29'),this[_0xbdd0('0x7')],this[_0xbdd0('0x5')][_0xbdd0('0x2a')]>0x0?this['number'][_0xbdd0('0x2b')](this[_0xbdd0('0x5')][_0xbdd0('0x2a')]):this['number']);};Action[_0xbdd0('0x26')][_0xbdd0('0x2c')]=function(){return this[_0xbdd0('0xd')];};module[_0xbdd0('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index ff1fd45..1145c1f 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf339=['calleridname','calleridnum','number','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','getSeconds','talktime','endtime','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0xf339,0x1e9));var _0x9f33=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xf339[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x9f33('0x0'));var utils=require(_0x9f33('0x1'));function AgentComplete(_0x42ac6c,_0x4e423a){this['state']=0x4;this[_0x9f33('0x2')]='Answer';this[_0x9f33('0x3')]=_0x42ac6c[_0x9f33('0x3')];this[_0x9f33('0x4')]=_0x42ac6c['type'];this[_0x9f33('0x5')]=_0x42ac6c[_0x9f33('0x4')]===_0x9f33('0x6')?_0x9f33('0x7'):_0x42ac6c['type'];this['countbusyretry']=_0x42ac6c[_0x9f33('0x8')];this['countcongestionretry']=_0x42ac6c[_0x9f33('0x9')];this[_0x9f33('0xa')]=_0x42ac6c[_0x9f33('0xa')];this[_0x9f33('0xb')]=_0x42ac6c['countbusyretry']+_0x42ac6c['countcongestionretry']+_0x42ac6c[_0x9f33('0xa')]+_0x42ac6c['countnosuchnumberretry']+_0x42ac6c[_0x9f33('0xc')]+_0x42ac6c['countabandonedretry']+_0x42ac6c['countmachineretry']+_0x42ac6c['countagentrejectretry'];this[_0x9f33('0xd')]=_0x42ac6c[_0x9f33('0xd')];this[_0x9f33('0xc')]=_0x42ac6c[_0x9f33('0xc')];this['countabandonedretry']=_0x42ac6c[_0x9f33('0xe')];this['countmachineretry']=_0x42ac6c[_0x9f33('0xf')];this[_0x9f33('0x10')]=_0x42ac6c[_0x9f33('0x10')];this[_0x9f33('0x11')]=_0x4e423a['uniqueid'];this[_0x9f33('0x12')]=_0x42ac6c['name'];this[_0x9f33('0x13')]=_0x42ac6c[_0x9f33('0x14')];this['starttime']=_0x42ac6c['starttime'];this['responsetime']=_0x42ac6c['responsetime'];this[_0x9f33('0x15')]=_0x42ac6c[_0x9f33('0x15')];this['endtime']=moment()[_0x9f33('0x16')](_0x9f33('0x17'));this['ringtime']=utils['getSeconds'](_0x42ac6c['responsetime'],_0x42ac6c['starttime']);this[_0x9f33('0x18')]=utils[_0x9f33('0x19')](_0x42ac6c['answertime'],_0x42ac6c['responsetime']);this[_0x9f33('0x1a')]=utils[_0x9f33('0x19')](this[_0x9f33('0x1b')],_0x42ac6c[_0x9f33('0x15')]);this[_0x9f33('0x7')]=_0x4e423a['queue'];this['membername']=_0x4e423a['membername'];this[_0x9f33('0x1c')]=_0x4e423a[_0x9f33('0x1c')];this['callback']=_0x42ac6c[_0x9f33('0x1d')];this[_0x9f33('0x1e')]=_0x42ac6c['callbackuniqueid'];this['callbackat']=_0x42ac6c[_0x9f33('0x1f')];this[_0x9f33('0x20')]=_0x42ac6c[_0x9f33('0x20')];this['ContactId']=_0x42ac6c['ContactId'];this[_0x9f33('0x21')]=_0x42ac6c[_0x9f33('0x21')];this[_0x9f33('0x22')]=_0x42ac6c['UserId'];this[_0x9f33('0x23')]=_0x42ac6c[_0x9f33('0x23')];this[_0x9f33('0x24')]=_0x42ac6c['CampaignId'];this['originatecalleridnum']=_0x42ac6c[_0x9f33('0x25')]||'';this['originatecalleridname']=_0x42ac6c[_0x9f33('0x26')]||'';this['agiafterat']=_0x42ac6c['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file +var _0x68ce=['UserId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x533981,_0x637755){var _0x3efd60=function(_0x543a9c){while(--_0x543a9c){_0x533981['push'](_0x533981['shift']());}};_0x3efd60(++_0x637755);}(_0x68ce,0x86));var _0xe68c=function(_0x275804,_0x1690bb){_0x275804=_0x275804-0x0;var _0x5cf3a4=_0x68ce[_0x275804];return _0x5cf3a4;};'use strict';var moment=require(_0xe68c('0x0'));var utils=require(_0xe68c('0x1'));function AgentComplete(_0x3a0256,_0x35c742){this[_0xe68c('0x2')]=0x4;this['statedesc']=_0xe68c('0x3');this[_0xe68c('0x4')]=_0x3a0256[_0xe68c('0x4')];this[_0xe68c('0x5')]=_0x3a0256[_0xe68c('0x5')];this[_0xe68c('0x6')]=_0x3a0256[_0xe68c('0x5')]===_0xe68c('0x7')?_0xe68c('0x8'):_0x3a0256['type'];this[_0xe68c('0x9')]=_0x3a0256[_0xe68c('0x9')];this['countcongestionretry']=_0x3a0256[_0xe68c('0xa')];this['countnoanswerretry']=_0x3a0256[_0xe68c('0xb')];this[_0xe68c('0xc')]=_0x3a0256[_0xe68c('0x9')]+_0x3a0256['countcongestionretry']+_0x3a0256[_0xe68c('0xb')]+_0x3a0256[_0xe68c('0xd')]+_0x3a0256[_0xe68c('0xe')]+_0x3a0256[_0xe68c('0xf')]+_0x3a0256[_0xe68c('0x10')]+_0x3a0256[_0xe68c('0x11')];this[_0xe68c('0xd')]=_0x3a0256['countnosuchnumberretry'];this[_0xe68c('0xe')]=_0x3a0256['countdropretry'];this[_0xe68c('0xf')]=_0x3a0256[_0xe68c('0xf')];this[_0xe68c('0x10')]=_0x3a0256['countmachineretry'];this[_0xe68c('0x11')]=_0x3a0256[_0xe68c('0x11')];this[_0xe68c('0x12')]=_0x35c742[_0xe68c('0x12')];this[_0xe68c('0x13')]=_0x3a0256[_0xe68c('0x14')];this[_0xe68c('0x15')]=_0x3a0256[_0xe68c('0x16')];this[_0xe68c('0x17')]=_0x3a0256['starttime'];this[_0xe68c('0x18')]=_0x3a0256[_0xe68c('0x18')];this[_0xe68c('0x19')]=_0x3a0256[_0xe68c('0x19')];this[_0xe68c('0x1a')]=moment()[_0xe68c('0x1b')](_0xe68c('0x1c'));this[_0xe68c('0x1d')]=utils[_0xe68c('0x1e')](_0x3a0256[_0xe68c('0x18')],_0x3a0256[_0xe68c('0x17')]);this['holdtime']=utils[_0xe68c('0x1e')](_0x3a0256['answertime'],_0x3a0256[_0xe68c('0x18')]);this[_0xe68c('0x1f')]=utils[_0xe68c('0x1e')](this[_0xe68c('0x1a')],_0x3a0256[_0xe68c('0x19')]);this[_0xe68c('0x8')]=_0x35c742[_0xe68c('0x8')];this[_0xe68c('0x20')]=_0x35c742[_0xe68c('0x20')];this['reason']=_0x35c742['reason'];this[_0xe68c('0x21')]=_0x3a0256[_0xe68c('0x21')];this[_0xe68c('0x22')]=_0x3a0256[_0xe68c('0x22')];this['callbackat']=_0x3a0256[_0xe68c('0x23')];this['recallme']=_0x3a0256[_0xe68c('0x24')];this['ContactId']=_0x3a0256[_0xe68c('0x25')];this['ListId']=_0x3a0256['ListId'];this[_0xe68c('0x26')]=_0x3a0256[_0xe68c('0x26')];this['VoiceQueueId']=_0x3a0256['VoiceQueueId'];this[_0xe68c('0x27')]=_0x3a0256[_0xe68c('0x27')];this[_0xe68c('0x28')]=_0x3a0256[_0xe68c('0x28')]||'';this['originatecalleridname']=_0x3a0256['originatecalleridname']||'';this[_0xe68c('0x29')]=_0x3a0256[_0xe68c('0x29')];}module[_0xe68c('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index ab9a5d7..4633074 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ac2=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry'];(function(_0x3fc2e3,_0x109f38){var _0x248e01=function(_0xb72b9e){while(--_0xb72b9e){_0x3fc2e3['push'](_0x3fc2e3['shift']());}};_0x248e01(++_0x109f38);}(_0x4ac2,0xd2));var _0x24ac=function(_0x4a56a7,_0x5f295c){_0x4a56a7=_0x4a56a7-0x0;var _0x10463c=_0x4ac2[_0x4a56a7];return _0x10463c;};'use strict';function Final(_0x252535){this[_0x24ac('0x0')]=_0x252535[_0x24ac('0x0')];this[_0x24ac('0x1')]=_0x252535[_0x24ac('0x1')];this[_0x24ac('0x2')]=_0x252535['type'];this['campaigntype']=_0x252535[_0x24ac('0x2')]===_0x24ac('0x3')?_0x24ac('0x4'):_0x252535['type'];this[_0x24ac('0x5')]=_0x252535[_0x24ac('0x5')];this[_0x24ac('0x6')]=_0x252535[_0x24ac('0x6')];this[_0x24ac('0x7')]=_0x252535[_0x24ac('0x7')];this[_0x24ac('0x8')]=_0x252535[_0x24ac('0x5')]+_0x252535['countcongestionretry']+_0x252535[_0x24ac('0x7')]+_0x252535['countnosuchnumberretry']+_0x252535[_0x24ac('0x9')]+_0x252535[_0x24ac('0xa')]+_0x252535[_0x24ac('0xb')]+_0x252535['countagentrejectretry'];this[_0x24ac('0xc')]=_0x252535[_0x24ac('0xc')];this[_0x24ac('0x9')]=_0x252535[_0x24ac('0x9')];this['countabandonedretry']=_0x252535[_0x24ac('0xa')];this['countmachineretry']=_0x252535[_0x24ac('0xb')];this[_0x24ac('0xd')]=_0x252535[_0x24ac('0xd')];this['queue']=_0x252535['queue'];this[_0x24ac('0xe')]=_0x252535['calleridname'];this[_0x24ac('0xf')]=_0x252535[_0x24ac('0xf')];this[_0x24ac('0x10')]=_0x252535[_0x24ac('0x10')];this[_0x24ac('0x11')]=_0x252535[_0x24ac('0x11')];this[_0x24ac('0x12')]=_0x252535['responsetime'];this[_0x24ac('0x13')]=_0x252535[_0x24ac('0x13')]||0x0;this[_0x24ac('0x14')]=_0x252535['holdtime']||0x0;this['talktime']=_0x252535[_0x24ac('0x15')]||0x0;this[_0x24ac('0x16')]=_0x252535[_0x24ac('0x16')];this[_0x24ac('0x17')]=_0x252535['callbackuniqueid'];this[_0x24ac('0x18')]=_0x252535[_0x24ac('0x18')];this[_0x24ac('0x19')]=_0x252535[_0x24ac('0x19')];this[_0x24ac('0x1a')]=_0x252535[_0x24ac('0x1a')];this[_0x24ac('0x1b')]=_0x252535['ListId'];this[_0x24ac('0x1c')]=_0x252535[_0x24ac('0x1c')];this['VoiceQueueId']=_0x252535[_0x24ac('0x1d')];this[_0x24ac('0x1e')]=_0x252535[_0x24ac('0x1e')];this[_0x24ac('0x1f')]=_0x252535[_0x24ac('0x1f')]||'';this[_0x24ac('0x20')]=_0x252535['originatecalleridname']||'';this[_0x24ac('0x21')]=_0x252535[_0x24ac('0x21')];this[_0x24ac('0x22')]=_0x252535[_0x24ac('0x22')];}module[_0x24ac('0x23')]=Final; \ No newline at end of file +var _0x219a=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x219a,0x14e));var _0xa219=function(_0x17423a,_0x361196){_0x17423a=_0x17423a-0x0;var _0x38276d=_0x219a[_0x17423a];return _0x38276d;};'use strict';function Final(_0x507955){this[_0xa219('0x0')]=_0x507955[_0xa219('0x0')];this[_0xa219('0x1')]=_0x507955['scheduledat'];this[_0xa219('0x2')]=_0x507955[_0xa219('0x2')];this[_0xa219('0x3')]=_0x507955[_0xa219('0x2')]===_0xa219('0x4')?_0xa219('0x5'):_0x507955['type'];this['countbusyretry']=_0x507955['countbusyretry'];this[_0xa219('0x6')]=_0x507955[_0xa219('0x6')];this['countnoanswerretry']=_0x507955[_0xa219('0x7')];this[_0xa219('0x8')]=_0x507955[_0xa219('0x9')]+_0x507955[_0xa219('0x6')]+_0x507955[_0xa219('0x7')]+_0x507955[_0xa219('0xa')]+_0x507955['countdropretry']+_0x507955[_0xa219('0xb')]+_0x507955[_0xa219('0xc')]+_0x507955[_0xa219('0xd')];this[_0xa219('0xa')]=_0x507955[_0xa219('0xa')];this[_0xa219('0xe')]=_0x507955[_0xa219('0xe')];this[_0xa219('0xb')]=_0x507955[_0xa219('0xb')];this['countmachineretry']=_0x507955[_0xa219('0xc')];this[_0xa219('0xd')]=_0x507955[_0xa219('0xd')];this['queue']=_0x507955[_0xa219('0x5')];this['calleridname']=_0x507955[_0xa219('0xf')];this[_0xa219('0x10')]=_0x507955[_0xa219('0x10')];this['starttime']=_0x507955['starttime'];this[_0xa219('0x11')]=_0x507955[_0xa219('0x11')];this['endtime']=_0x507955[_0xa219('0x11')];this[_0xa219('0x12')]=_0x507955[_0xa219('0x12')]||0x0;this[_0xa219('0x13')]=_0x507955[_0xa219('0x13')]||0x0;this[_0xa219('0x14')]=_0x507955['talktime']||0x0;this['callback']=_0x507955[_0xa219('0x15')];this[_0xa219('0x16')]=_0x507955[_0xa219('0x16')];this[_0xa219('0x17')]=_0x507955[_0xa219('0x17')];this['recallme']=_0x507955[_0xa219('0x18')];this[_0xa219('0x19')]=_0x507955[_0xa219('0x19')];this[_0xa219('0x1a')]=_0x507955[_0xa219('0x1a')];this[_0xa219('0x1b')]=_0x507955[_0xa219('0x1b')];this[_0xa219('0x1c')]=_0x507955[_0xa219('0x1c')];this['CampaignId']=_0x507955[_0xa219('0x1d')];this[_0xa219('0x1e')]=_0x507955[_0xa219('0x1e')]||'';this[_0xa219('0x1f')]=_0x507955[_0xa219('0x1f')]||'';this[_0xa219('0x20')]=_0x507955[_0xa219('0x20')];this[_0xa219('0x21')]=_0x507955['statedesc'];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 41c476c..a6ab0ca 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5ba=['holdtime','talktime','endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0x28f9b4,_0x940a3f){var _0x4d67f7=function(_0x164fd6){while(--_0x164fd6){_0x28f9b4['push'](_0x28f9b4['shift']());}};_0x4d67f7(++_0x940a3f);}(_0xb5ba,0x1e9));var _0xab5b=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb5ba[_0x3740fe];return _0x55492b;};'use strict';var moment=require('moment');var utils=require(_0xab5b('0x0'));function Hangup(_0x29e146,_0x524611){this['state']=0x4;this['statedesc']=_0xab5b('0x1');this[_0xab5b('0x2')]=_0x29e146[_0xab5b('0x2')];this[_0xab5b('0x3')]=_0x29e146[_0xab5b('0x3')];this['campaigntype']=_0x29e146[_0xab5b('0x3')]===_0xab5b('0x4')?_0xab5b('0x5'):_0x29e146[_0xab5b('0x3')];this['amd']=_0x29e146[_0xab5b('0x6')]||![];this[_0xab5b('0x7')]=_0x29e146[_0xab5b('0x7')];this[_0xab5b('0x8')]=_0x29e146['countcongestionretry'];this[_0xab5b('0x9')]=_0x29e146[_0xab5b('0x9')];this[_0xab5b('0xa')]=_0x29e146[_0xab5b('0x7')]+_0x29e146[_0xab5b('0x8')]+_0x29e146['countnoanswerretry']+_0x29e146['countnosuchnumberretry']+_0x29e146[_0xab5b('0xb')]+_0x29e146[_0xab5b('0xc')]+_0x29e146[_0xab5b('0xd')]+_0x29e146[_0xab5b('0xe')];this['countnosuchnumberretry']=_0x29e146[_0xab5b('0xf')];this[_0xab5b('0xb')]=_0x29e146[_0xab5b('0xb')];this['countabandonedretry']=_0x29e146[_0xab5b('0xc')];this['countmachineretry']=_0x29e146[_0xab5b('0xd')];this[_0xab5b('0xe')]=_0x29e146[_0xab5b('0xe')];this[_0xab5b('0x10')]=_0x524611[_0xab5b('0x10')];this[_0xab5b('0x11')]=_0x29e146[_0xab5b('0x12')];this[_0xab5b('0x13')]=_0x29e146[_0xab5b('0x14')];this[_0xab5b('0x15')]=_0x29e146['starttime'];this[_0xab5b('0x16')]=_0x29e146['responsetime'];this['endtime']=moment()[_0xab5b('0x17')](_0xab5b('0x18'));this[_0xab5b('0x19')]=utils[_0xab5b('0x1a')](_0x29e146[_0xab5b('0x16')],_0x29e146['starttime']);this[_0xab5b('0x1b')]=0x0;this[_0xab5b('0x1c')]=utils[_0xab5b('0x1a')](this[_0xab5b('0x1d')],_0x29e146['responsetime']);this[_0xab5b('0x5')]=_0x29e146[_0xab5b('0x5')];this[_0xab5b('0x1e')]=_0xab5b('0x1f');this[_0xab5b('0x20')]=_0x524611['cause-txt'];this[_0xab5b('0x21')]=_0x29e146[_0xab5b('0x21')];this[_0xab5b('0x22')]=_0x29e146[_0xab5b('0x22')];this[_0xab5b('0x23')]=_0x29e146[_0xab5b('0x23')];this[_0xab5b('0x24')]=_0x29e146[_0xab5b('0x24')];this[_0xab5b('0x25')]=_0x29e146['ContactId'];this[_0xab5b('0x26')]=_0x29e146['ListId'];this[_0xab5b('0x27')]=_0x29e146[_0xab5b('0x27')];this[_0xab5b('0x28')]=_0x29e146[_0xab5b('0x28')];this[_0xab5b('0x29')]=_0x29e146[_0xab5b('0x29')];}module[_0xab5b('0x2a')]=Hangup; \ No newline at end of file +var _0x1ae0=['countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry'];(function(_0x30a2d1,_0x45908a){var _0x1711c9=function(_0x2430c8){while(--_0x2430c8){_0x30a2d1['push'](_0x30a2d1['shift']());}};_0x1711c9(++_0x45908a);}(_0x1ae0,0x1d4));var _0x01ae=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0x1ae0[_0x18a16d];return _0x21cf0c;};'use strict';var moment=require(_0x01ae('0x0'));var utils=require('../utils');function Hangup(_0x55f216,_0x38ee04){this[_0x01ae('0x1')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x55f216[_0x01ae('0x2')];this['type']=_0x55f216[_0x01ae('0x3')];this[_0x01ae('0x4')]=_0x55f216[_0x01ae('0x3')]===_0x01ae('0x5')?'queue':_0x55f216['type'];this[_0x01ae('0x6')]=_0x55f216[_0x01ae('0x6')]||![];this[_0x01ae('0x7')]=_0x55f216[_0x01ae('0x7')];this[_0x01ae('0x8')]=_0x55f216[_0x01ae('0x8')];this[_0x01ae('0x9')]=_0x55f216['countnoanswerretry'];this[_0x01ae('0xa')]=_0x55f216[_0x01ae('0x7')]+_0x55f216[_0x01ae('0x8')]+_0x55f216[_0x01ae('0x9')]+_0x55f216['countnosuchnumberretry']+_0x55f216['countdropretry']+_0x55f216[_0x01ae('0xb')]+_0x55f216['countmachineretry']+_0x55f216['countagentrejectretry'];this[_0x01ae('0xc')]=_0x55f216[_0x01ae('0xc')];this[_0x01ae('0xd')]=_0x55f216[_0x01ae('0xd')];this['countabandonedretry']=_0x55f216[_0x01ae('0xb')];this[_0x01ae('0xe')]=_0x55f216['countmachineretry'];this['countagentrejectretry']=_0x55f216['countagentrejectretry'];this[_0x01ae('0xf')]=_0x38ee04[_0x01ae('0xf')];this['calleridname']=_0x55f216[_0x01ae('0x10')];this[_0x01ae('0x11')]=_0x55f216[_0x01ae('0x12')];this[_0x01ae('0x13')]=_0x55f216[_0x01ae('0x13')];this['responsetime']=_0x55f216[_0x01ae('0x14')];this[_0x01ae('0x15')]=moment()[_0x01ae('0x16')](_0x01ae('0x17'));this[_0x01ae('0x18')]=utils[_0x01ae('0x19')](_0x55f216[_0x01ae('0x14')],_0x55f216[_0x01ae('0x13')]);this[_0x01ae('0x1a')]=0x0;this[_0x01ae('0x1b')]=utils[_0x01ae('0x19')](this['endtime'],_0x55f216['responsetime']);this['queue']=_0x55f216[_0x01ae('0x1c')];this['membername']=_0x01ae('0x1d');this['reason']=_0x38ee04['cause-txt'];this[_0x01ae('0x1e')]=_0x55f216['callback'];this[_0x01ae('0x1f')]=_0x55f216[_0x01ae('0x1f')];this[_0x01ae('0x20')]=_0x55f216[_0x01ae('0x20')];this[_0x01ae('0x21')]=_0x55f216['recallme'];this[_0x01ae('0x22')]=_0x55f216[_0x01ae('0x22')];this[_0x01ae('0x23')]=_0x55f216[_0x01ae('0x23')];this[_0x01ae('0x24')]=_0x55f216['UserId'];this[_0x01ae('0x25')]=_0x55f216[_0x01ae('0x25')];this[_0x01ae('0x26')]=_0x55f216[_0x01ae('0x26')];}module[_0x01ae('0x27')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 36e50ba..346f36e 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd626=['outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','state','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd626,0x124));var _0x6d62=function(_0x2c98fe,_0x2fe375){_0x2c98fe=_0x2c98fe-0x0;var _0x29c444=_0xd626[_0x2c98fe];return _0x29c444;};'use strict';var utils=require(_0x6d62('0x0'));function History(_0x167f92){this[_0x6d62('0x1')]=_0x167f92['uniqueid'];this[_0x6d62('0x2')]=_0x167f92[_0x6d62('0x2')]||undefined;this[_0x6d62('0x3')]=_0x167f92[_0x6d62('0x3')];this[_0x6d62('0x4')]=_0x167f92[_0x6d62('0x3')]===_0x6d62('0x5')?_0x6d62('0x6'):_0x167f92[_0x6d62('0x3')];this[_0x6d62('0x7')]=_0x167f92[_0x6d62('0x7')];this['countcongestionretry']=_0x167f92[_0x6d62('0x8')];this['countnoanswerretry']=_0x167f92['countnoanswerretry'];this[_0x6d62('0x9')]=_0x167f92['countbusyretry']+_0x167f92[_0x6d62('0x8')]+_0x167f92[_0x6d62('0xa')]+_0x167f92[_0x6d62('0xb')]+_0x167f92[_0x6d62('0xc')]+_0x167f92[_0x6d62('0xd')]+_0x167f92[_0x6d62('0xe')]+_0x167f92[_0x6d62('0xf')];this[_0x6d62('0xb')]=_0x167f92['countnosuchnumberretry'];this[_0x6d62('0xc')]=_0x167f92[_0x6d62('0xc')];this[_0x6d62('0xd')]=_0x167f92[_0x6d62('0xd')];this['countmachineretry']=_0x167f92[_0x6d62('0xe')];this['countagentrejectretry']=_0x167f92[_0x6d62('0xf')];this[_0x6d62('0x6')]=_0x167f92[_0x6d62('0x6')];this['calleridname']=_0x167f92['name'];this['calleridnum']=_0x167f92[_0x6d62('0x10')];this[_0x6d62('0x11')]=_0x167f92[_0x6d62('0x11')];this[_0x6d62('0x12')]=_0x167f92[_0x6d62('0x12')];this[_0x6d62('0x13')]=_0x167f92[_0x6d62('0x12')];this[_0x6d62('0x14')]=utils['getSeconds'](_0x167f92[_0x6d62('0x12')],_0x167f92[_0x6d62('0x11')]);this[_0x6d62('0x15')]=0x0;this[_0x6d62('0x16')]=0x0;this[_0x6d62('0x17')]=_0x167f92[_0x6d62('0x17')];this[_0x6d62('0x18')]=_0x167f92['callbackuniqueid'];this['callbackat']=_0x167f92[_0x6d62('0x19')];this[_0x6d62('0x1a')]=_0x167f92[_0x6d62('0x1a')];this['ContactId']=_0x167f92[_0x6d62('0x1b')];this['ListId']=_0x167f92[_0x6d62('0x1c')];this[_0x6d62('0x1d')]=_0x167f92['UserId'];this['VoiceQueueId']=_0x167f92['VoiceQueueId'];this['CampaignId']=_0x167f92['CampaignId'];this[_0x6d62('0x1e')]=_0x167f92[_0x6d62('0x1e')]||'';this[_0x6d62('0x1f')]=_0x167f92[_0x6d62('0x1f')]||'';this[_0x6d62('0x20')]=_0x167f92[_0x6d62('0x20')];this['statedesc']=_0x167f92['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x82c1=['endtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','number','starttime','responsetime'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x82c1,0xb2));var _0x182c=function(_0x4741dc,_0x2aca6b){_0x4741dc=_0x4741dc-0x0;var _0x2df144=_0x82c1[_0x4741dc];return _0x2df144;};'use strict';var utils=require(_0x182c('0x0'));function History(_0x27f95a){this[_0x182c('0x1')]=_0x27f95a[_0x182c('0x1')];this[_0x182c('0x2')]=_0x27f95a[_0x182c('0x2')]||undefined;this[_0x182c('0x3')]=_0x27f95a[_0x182c('0x3')];this['campaigntype']=_0x27f95a[_0x182c('0x3')]===_0x182c('0x4')?'queue':_0x27f95a[_0x182c('0x3')];this['countbusyretry']=_0x27f95a[_0x182c('0x5')];this[_0x182c('0x6')]=_0x27f95a[_0x182c('0x6')];this[_0x182c('0x7')]=_0x27f95a[_0x182c('0x7')];this[_0x182c('0x8')]=_0x27f95a[_0x182c('0x5')]+_0x27f95a['countcongestionretry']+_0x27f95a[_0x182c('0x7')]+_0x27f95a[_0x182c('0x9')]+_0x27f95a[_0x182c('0xa')]+_0x27f95a[_0x182c('0xb')]+_0x27f95a['countmachineretry']+_0x27f95a[_0x182c('0xc')];this['countnosuchnumberretry']=_0x27f95a[_0x182c('0x9')];this[_0x182c('0xa')]=_0x27f95a['countdropretry'];this['countabandonedretry']=_0x27f95a['countabandonedretry'];this[_0x182c('0xd')]=_0x27f95a[_0x182c('0xd')];this[_0x182c('0xc')]=_0x27f95a[_0x182c('0xc')];this[_0x182c('0xe')]=_0x27f95a[_0x182c('0xe')];this[_0x182c('0xf')]=_0x27f95a['name'];this[_0x182c('0x10')]=_0x27f95a[_0x182c('0x11')];this[_0x182c('0x12')]=_0x27f95a[_0x182c('0x12')];this[_0x182c('0x13')]=_0x27f95a[_0x182c('0x13')];this[_0x182c('0x14')]=_0x27f95a[_0x182c('0x13')];this['ringtime']=utils[_0x182c('0x15')](_0x27f95a[_0x182c('0x13')],_0x27f95a[_0x182c('0x12')]);this['holdtime']=0x0;this[_0x182c('0x16')]=0x0;this[_0x182c('0x17')]=_0x27f95a[_0x182c('0x17')];this[_0x182c('0x18')]=_0x27f95a[_0x182c('0x18')];this['callbackat']=_0x27f95a[_0x182c('0x19')];this[_0x182c('0x1a')]=_0x27f95a[_0x182c('0x1a')];this['ContactId']=_0x27f95a['ContactId'];this[_0x182c('0x1b')]=_0x27f95a[_0x182c('0x1b')];this[_0x182c('0x1c')]=_0x27f95a['UserId'];this['VoiceQueueId']=_0x27f95a['VoiceQueueId'];this['CampaignId']=_0x27f95a['CampaignId'];this[_0x182c('0x1d')]=_0x27f95a['originatecalleridnum']||'';this[_0x182c('0x1e')]=_0x27f95a['originatecalleridname']||'';this[_0x182c('0x1f')]=_0x27f95a[_0x182c('0x1f')];this[_0x182c('0x20')]=_0x27f95a['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index edf6cdf..a5e4ada 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e43=['responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x2e69fb,_0x4359e3){var _0x4d2404=function(_0x5667b5){while(--_0x5667b5){_0x2e69fb['push'](_0x2e69fb['shift']());}};_0x4d2404(++_0x4359e3);}(_0x1e43,0x98));var _0x31e4=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x1e43[_0x1ceb7b];return _0x57c016;};'use strict';var utils=require(_0x31e4('0x0'));function QueueCallerAbandon(_0x65e473,_0xa2ce82){this[_0x31e4('0x1')]=_0x65e473[_0x31e4('0x1')];this[_0x31e4('0x2')]=_0x65e473[_0x31e4('0x2')];this[_0x31e4('0x3')]=_0x65e473[_0x31e4('0x2')]==='outbound'?_0x31e4('0x4'):_0x65e473['type'];this['countbusyretry']=_0x65e473[_0x31e4('0x5')];this[_0x31e4('0x6')]=_0x65e473[_0x31e4('0x6')];this[_0x31e4('0x7')]=_0x65e473[_0x31e4('0x7')];this[_0x31e4('0x8')]=_0x65e473[_0x31e4('0x5')]+_0x65e473[_0x31e4('0x6')]+_0x65e473['countnoanswerretry']+_0x65e473[_0x31e4('0x9')]+_0x65e473[_0x31e4('0xa')]+_0x65e473[_0x31e4('0xb')]+_0x65e473[_0x31e4('0xc')]+_0x65e473['countagentrejectretry'];this['countnosuchnumberretry']=_0x65e473['countnosuchnumberretry'];this[_0x31e4('0xa')]=_0x65e473[_0x31e4('0xa')];this[_0x31e4('0xb')]=_0x65e473['countabandonedretry'];this[_0x31e4('0xc')]=_0x65e473[_0x31e4('0xc')];this[_0x31e4('0xd')]=_0x65e473[_0x31e4('0xd')];this[_0x31e4('0xe')]=_0xa2ce82['uniqueid'];this[_0x31e4('0xf')]=_0x65e473[_0x31e4('0x10')];this[_0x31e4('0x11')]=_0x65e473[_0x31e4('0x12')];this[_0x31e4('0x13')]=_0x65e473['starttime'];this[_0x31e4('0x14')]=_0x65e473['responsetime'];this[_0x31e4('0x15')]=_0x65e473[_0x31e4('0x15')];this[_0x31e4('0x16')]=_0x65e473[_0x31e4('0x16')];this[_0x31e4('0x17')]=this[_0x31e4('0x15')];this[_0x31e4('0x18')]=utils[_0x31e4('0x19')](_0x65e473[_0x31e4('0x14')],_0x65e473[_0x31e4('0x13')]);this['holdtime']=utils[_0x31e4('0x19')](this[_0x31e4('0x15')],_0x65e473[_0x31e4('0x14')]);this[_0x31e4('0x1a')]=0x0;this[_0x31e4('0x4')]=_0xa2ce82[_0x31e4('0x4')];this[_0x31e4('0x1b')]=_0xa2ce82[_0x31e4('0x1c')];this[_0x31e4('0x1d')]=_0xa2ce82[_0x31e4('0x1d')];this['callback']=_0x65e473[_0x31e4('0x1e')];this[_0x31e4('0x1f')]=_0x65e473[_0x31e4('0x1f')];this[_0x31e4('0x20')]=_0x65e473[_0x31e4('0x20')];this['recallme']=_0x65e473[_0x31e4('0x21')];this[_0x31e4('0x22')]=_0x65e473[_0x31e4('0x22')];this['ListId']=_0x65e473['ListId'];this[_0x31e4('0x23')]=_0x65e473[_0x31e4('0x23')];this['VoiceQueueId']=_0x65e473['VoiceQueueId'];this[_0x31e4('0x24')]=_0x65e473[_0x31e4('0x24')];this[_0x31e4('0x25')]=_0x65e473[_0x31e4('0x25')]||'';this[_0x31e4('0x26')]=_0x65e473[_0x31e4('0x26')]||'';this[_0x31e4('0x27')]=_0x65e473[_0x31e4('0x27')];this[_0x31e4('0x28')]=_0x65e473['state'];this[_0x31e4('0x29')]=_0x65e473[_0x31e4('0x29')];}module[_0x31e4('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xd961=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xd961,0x132));var _0x1d96=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xd961[_0xe8129c];return _0x709fc5;};'use strict';var utils=require(_0x1d96('0x0'));function QueueCallerAbandon(_0x9a49e5,_0x39c826){this[_0x1d96('0x1')]=_0x9a49e5[_0x1d96('0x1')];this[_0x1d96('0x2')]=_0x9a49e5[_0x1d96('0x2')];this[_0x1d96('0x3')]=_0x9a49e5['type']==='outbound'?_0x1d96('0x4'):_0x9a49e5['type'];this[_0x1d96('0x5')]=_0x9a49e5[_0x1d96('0x5')];this['countcongestionretry']=_0x9a49e5[_0x1d96('0x6')];this[_0x1d96('0x7')]=_0x9a49e5[_0x1d96('0x7')];this['countglobal']=_0x9a49e5[_0x1d96('0x5')]+_0x9a49e5[_0x1d96('0x6')]+_0x9a49e5[_0x1d96('0x7')]+_0x9a49e5[_0x1d96('0x8')]+_0x9a49e5[_0x1d96('0x9')]+_0x9a49e5[_0x1d96('0xa')]+_0x9a49e5[_0x1d96('0xb')]+_0x9a49e5['countagentrejectretry'];this[_0x1d96('0x8')]=_0x9a49e5['countnosuchnumberretry'];this[_0x1d96('0x9')]=_0x9a49e5[_0x1d96('0x9')];this[_0x1d96('0xa')]=_0x9a49e5[_0x1d96('0xa')];this[_0x1d96('0xb')]=_0x9a49e5[_0x1d96('0xb')];this[_0x1d96('0xc')]=_0x9a49e5[_0x1d96('0xc')];this['uniqueid']=_0x39c826[_0x1d96('0xd')];this['calleridname']=_0x9a49e5['name'];this[_0x1d96('0xe')]=_0x9a49e5['number'];this[_0x1d96('0xf')]=_0x9a49e5[_0x1d96('0xf')];this[_0x1d96('0x10')]=_0x9a49e5[_0x1d96('0x10')];this[_0x1d96('0x11')]=_0x9a49e5[_0x1d96('0x11')];this[_0x1d96('0x12')]=_0x9a49e5[_0x1d96('0x12')];this[_0x1d96('0x13')]=this[_0x1d96('0x11')];this[_0x1d96('0x14')]=utils['getSeconds'](_0x9a49e5['responsetime'],_0x9a49e5[_0x1d96('0xf')]);this[_0x1d96('0x15')]=utils[_0x1d96('0x16')](this['droptime'],_0x9a49e5[_0x1d96('0x10')]);this[_0x1d96('0x17')]=0x0;this['queue']=_0x39c826[_0x1d96('0x4')];this[_0x1d96('0x18')]=_0x39c826['connectedlinename'];this['reason']=_0x39c826[_0x1d96('0x19')];this[_0x1d96('0x1a')]=_0x9a49e5['callback'];this['callbackuniqueid']=_0x9a49e5[_0x1d96('0x1b')];this[_0x1d96('0x1c')]=_0x9a49e5[_0x1d96('0x1c')];this['recallme']=_0x9a49e5[_0x1d96('0x1d')];this[_0x1d96('0x1e')]=_0x9a49e5[_0x1d96('0x1e')];this[_0x1d96('0x1f')]=_0x9a49e5[_0x1d96('0x1f')];this[_0x1d96('0x20')]=_0x9a49e5['UserId'];this['VoiceQueueId']=_0x9a49e5['VoiceQueueId'];this['CampaignId']=_0x9a49e5[_0x1d96('0x21')];this[_0x1d96('0x22')]=_0x9a49e5['originatecalleridnum']||'';this[_0x1d96('0x23')]=_0x9a49e5['originatecalleridname']||'';this[_0x1d96('0x24')]=_0x9a49e5[_0x1d96('0x24')];this['state']=_0x9a49e5[_0x1d96('0x25')];this['statedesc']=_0x9a49e5['statedesc'];}module[_0x1d96('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 3ed4acd..b8f2f26 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffd6=['[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','catch','temp','error','[getContactDialer]','dialOrderByScheduledAt'];(function(_0x2ace90,_0x16f0b5){var _0x557d70=function(_0x32e122){while(--_0x32e122){_0x2ace90['push'](_0x2ace90['shift']());}};_0x557d70(++_0x16f0b5);}(_0xffd6,0x97));var _0x6ffd=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xffd6[_0xa3c06b];return _0x33aa1d;};'use strict';var util=require(_0x6ffd('0x0'));var logger=require(_0x6ffd('0x1'))(_0x6ffd('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6ffd('0x3'));var cmHopperHistory=require(_0x6ffd('0x4'));function inspectError(_0x39fd49){return util['inspect'](_0x39fd49,{'showHidden':![],'depth':null});}function getContactDialer(_0x1d12e3,_0x173979,_0x3b8a46){return cmHopper[_0x6ffd('0x5')](_0x1d12e3['id'],_0x173979,_0x3b8a46,_0x1d12e3['dialOrderByScheduledAt'])[_0x6ffd('0x6')](function(_0xeefe34){_0x1d12e3[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0x9'),inspectError(_0xeefe34));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x455dda,_0x417f34){return cmHopper['getContactDialerIvr'](_0x455dda['id'],_0x417f34,_0x455dda[_0x6ffd('0xa')])[_0x6ffd('0x6')](function(_0x23f7f2){_0x455dda[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0xb'),inspectError(_0x23f7f2));});}exports[_0x6ffd('0xc')]=getContactDialerIvr;function countReScheduled(_0x5892e1){return cmHopper[_0x6ffd('0xd')](_0x5892e1)[_0x6ffd('0x6')](function(_0x5e8d6d){logger[_0x6ffd('0x8')](_0x6ffd('0xe'),inspectError(_0x5e8d6d));});}exports[_0x6ffd('0xd')]=countReScheduled;function rescheduleContact(_0x1a00d9){return cmHopper['rescheduleContact'](_0x1a00d9)[_0x6ffd('0x6')](function(_0x594cb3){logger[_0x6ffd('0x8')]('[rescheduleContact]',inspectError(_0x594cb3));});}exports[_0x6ffd('0xf')]=rescheduleContact;function unlockContact(_0x261ed7,_0x45db49,_0x5d8aff){return cmHopper[_0x6ffd('0x10')](_0x261ed7,_0x45db49,_0x5d8aff)[_0x6ffd('0x6')](function(_0x350c94){logger[_0x6ffd('0x8')](_0x6ffd('0x11'),inspectError(_0x350c94));});}exports[_0x6ffd('0x10')]=unlockContact;function moveContactManagedDialer(_0x3f38e7){return cmHopper[_0x6ffd('0x12')](_0x3f38e7)['catch'](function(_0x11a609){logger['error']('[moveContactManagedDialer]',inspectError(_0x11a609));});}exports[_0x6ffd('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x359d09){return cmHopperBlack['checkIsBlackList'](_0x359d09)[_0x6ffd('0x6')](function(_0x4612a3){logger['error']('[checkIsBlackList]',inspectError(_0x4612a3));});}exports[_0x6ffd('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1c9d19){return cmHopperBlack['checkIsBlackListIvr'](_0x1c9d19)[_0x6ffd('0x6')](function(_0x39f25c){logger[_0x6ffd('0x8')]('[checkIsBlackListIvr]',inspectError(_0x39f25c));});}exports[_0x6ffd('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2efeb5,_0x50896b,_0x356c9c){return cmHopperAdditionalPhone[_0x6ffd('0x15')](_0x2efeb5,_0x50896b,_0x356c9c)['catch'](function(_0x31fb22){logger[_0x6ffd('0x8')](_0x6ffd('0x16'),inspectError(_0x31fb22));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x46631e,_0x3e5726,_0x46b03f){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46631e,_0x3e5726,_0x46b03f)[_0x6ffd('0x6')](function(_0x5a55e2){logger[_0x6ffd('0x8')](_0x6ffd('0x17'),inspectError(_0x5a55e2));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x520258){return cmHopperHistory[_0x6ffd('0x18')](_0x520258)[_0x6ffd('0x6')](function(_0x1934d4){logger['error']('[avgHandleTime]',inspectError(_0x1934d4));});}exports[_0x6ffd('0x18')]=avgHandleTime;function createHistory(_0x48feb4){return cmHopperHistory[_0x6ffd('0x19')](_0x48feb4)[_0x6ffd('0x6')](function(_0x51fdb6){logger[_0x6ffd('0x8')](_0x6ffd('0x1a'),inspectError(_0x51fdb6));});}exports[_0x6ffd('0x19')]=createHistory; \ No newline at end of file +var _0x8f9d=['[createHistory]','createHistory','util','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','[getContactDialer]','error','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime'];(function(_0x397a8b,_0x5438ca){var _0x54054f=function(_0x21f8c8){while(--_0x21f8c8){_0x397a8b['push'](_0x397a8b['shift']());}};_0x54054f(++_0x5438ca);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xd8f9('0x0'));var logger=require('../../../../config/logger')(_0xd8f9('0x1'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0xd8f9('0x2'));var cmHopperBlack=require(_0xd8f9('0x3'));var cmHopperHistory=require(_0xd8f9('0x4'));function inspectError(_0x354c26){return util[_0xd8f9('0x5')](_0x354c26,{'showHidden':![],'depth':null});}function getContactDialer(_0x1b82b8,_0x1d6420,_0x5941ce){return cmHopper[_0xd8f9('0x6')](_0x1b82b8['id'],_0x1d6420,_0x5941ce,_0x1b82b8[_0xd8f9('0x7')])[_0xd8f9('0x8')](function(_0x241aaa){_0x1b82b8[_0xd8f9('0x9')]=0x0;logger['error'](_0xd8f9('0xa'),inspectError(_0x241aaa));});}exports[_0xd8f9('0x6')]=getContactDialer;function getContactDialerIvr(_0x4957ae,_0x33c31e){return cmHopper['getContactDialerIvr'](_0x4957ae['id'],_0x33c31e,_0x4957ae['dialOrderByScheduledAt'])[_0xd8f9('0x8')](function(_0x3d0bea){_0x4957ae[_0xd8f9('0x9')]=0x0;logger[_0xd8f9('0xb')](_0xd8f9('0xc'),inspectError(_0x3d0bea));});}exports[_0xd8f9('0xd')]=getContactDialerIvr;function countReScheduled(_0x14c630){return cmHopper['countReScheduled'](_0x14c630)[_0xd8f9('0x8')](function(_0x56e0d6){logger[_0xd8f9('0xb')](_0xd8f9('0xe'),inspectError(_0x56e0d6));});}exports[_0xd8f9('0xf')]=countReScheduled;function rescheduleContact(_0x5b01ce){return cmHopper[_0xd8f9('0x10')](_0x5b01ce)[_0xd8f9('0x8')](function(_0x4cfebf){logger[_0xd8f9('0xb')]('[rescheduleContact]',inspectError(_0x4cfebf));});}exports[_0xd8f9('0x10')]=rescheduleContact;function unlockContact(_0x1525d6,_0x234901,_0x10369c){return cmHopper[_0xd8f9('0x11')](_0x1525d6,_0x234901,_0x10369c)[_0xd8f9('0x8')](function(_0x566448){logger['error']('[unlockContact]',inspectError(_0x566448));});}exports[_0xd8f9('0x11')]=unlockContact;function moveContactManagedDialer(_0xc6a825){return cmHopper['moveContactManagedDialer'](_0xc6a825)[_0xd8f9('0x8')](function(_0x47bdea){logger[_0xd8f9('0xb')]('[moveContactManagedDialer]',inspectError(_0x47bdea));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x58956e){return cmHopperBlack[_0xd8f9('0x12')](_0x58956e)['catch'](function(_0x37a252){logger[_0xd8f9('0xb')](_0xd8f9('0x13'),inspectError(_0x37a252));});}exports[_0xd8f9('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x3b141a){return cmHopperBlack[_0xd8f9('0x14')](_0x3b141a)['catch'](function(_0x1de3cc){logger[_0xd8f9('0xb')](_0xd8f9('0x15'),inspectError(_0x1de3cc));});}exports[_0xd8f9('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1bf210,_0x318d6a,_0x4c5808){return cmHopperAdditionalPhone[_0xd8f9('0x16')](_0x1bf210,_0x318d6a,_0x4c5808)[_0xd8f9('0x8')](function(_0x1fcd45){logger[_0xd8f9('0xb')](_0xd8f9('0x17'),inspectError(_0x1fcd45));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xcc9b18,_0x1d6796,_0x28854a){return cmHopperAdditionalPhone[_0xd8f9('0x18')](_0xcc9b18,_0x1d6796,_0x28854a)[_0xd8f9('0x8')](function(_0x9e1d6d){logger[_0xd8f9('0xb')](_0xd8f9('0x19'),inspectError(_0x9e1d6d));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x464a6a){return cmHopperHistory[_0xd8f9('0x1a')](_0x464a6a)[_0xd8f9('0x8')](function(_0x58a3ca){logger['error']('[avgHandleTime]',inspectError(_0x58a3ca));});}exports[_0xd8f9('0x1a')]=avgHandleTime;function createHistory(_0x2c25c2){return cmHopperHistory['createHistory'](_0x2c25c2)[_0xd8f9('0x8')](function(_0x210cd1){logger['error'](_0xd8f9('0x1b'),inspectError(_0x210cd1));});}exports[_0xd8f9('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 3b51c8f..61c881d 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5265=['Intervals','isEmpty','SIP/','reachable','unmonitored','name','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','string','\x22%s\x22\x20<%s>','format','isUndefined','getCallerId','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','ivr','type','outbound','dialActive','active','isIVRCampaignActive','milliseconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','dialTimezone','dialGlobalInterval','Interval'];(function(_0x32d01e,_0x5123d1){var _0x25f8a6=function(_0x477c0b){while(--_0x477c0b){_0x32d01e['push'](_0x32d01e['shift']());}};_0x25f8a6(++_0x5123d1);}(_0x5265,0x115));var _0x5526=function(_0x489420,_0x5e2e0c){_0x489420=_0x489420-0x0;var _0x23cae5=_0x5265[_0x489420];return _0x23cae5;};'use strict';var _=require(_0x5526('0x0'));var moment=require(_0x5526('0x1'));var util=require(_0x5526('0x2'));var logger=require(_0x5526('0x3'))(_0x5526('0x4'));var timezones=require(_0x5526('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x5526('0x6'),'BLACKLIST':_0x5526('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x5526('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x5526('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x5526('0xa'),'NO_AVAILABLE_CONTACTS':_0x5526('0xb'),'NULL_INTERVAL':_0x5526('0xc'),'OVERTIME_INTERVAL':_0x5526('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x5526('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x5526('0xf'),'RUNNING':_0x5526('0x10'),'UNKNOWN_TIMEZONE':_0x5526('0x11'),'UNREACHABLE_TRUNK':_0x5526('0x12')};exports[_0x5526('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x49e178){return _0x49e178['dialMethod']===_0x5526('0x14');}exports[_0x5526('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x30b4f7){return _0x30b4f7['type']===_0x5526('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x410098){return _0x410098[_0x5526('0x17')]===_0x5526('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x214e06){return _0x214e06[_0x5526('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x3f5534){return _0x3f5534[_0x5526('0x1a')];}exports[_0x5526('0x1b')]=isIVRCampaignActive;function getSeconds(_0x4117f3,_0x2b5c98){var _0x5035ef=moment(_0x4117f3)[_0x5526('0x1c')](0x0);var _0x312018=moment(_0x2b5c98)[_0x5526('0x1c')](0x0);return _0x5035ef['diff'](_0x312018,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x414cc7,_0x1f538c){var _0x3ec045=![];var _0x27f7f4=_0x414cc7[_0x5526('0x1d')]!==_0x1f538c[_0x5526('0x1d')]||_0x414cc7[_0x5526('0x19')]!==_0x1f538c[_0x5526('0x19')]||_0x414cc7[_0x5526('0x1e')]!==_0x1f538c[_0x5526('0x1e')];var _0x33a18a=_0x414cc7['available']!==_0x1f538c[_0x5526('0x1f')]||_0x414cc7[_0x5526('0x20')]!==_0x1f538c[_0x5526('0x20')]||_0x414cc7[_0x5526('0x21')]!==_0x1f538c['loggedInDb']||_0x414cc7[_0x5526('0x22')]!==_0x1f538c['paused']||_0x414cc7[_0x5526('0x23')]!==_0x1f538c['talking']||_0x414cc7[_0x5526('0x24')]!==_0x1f538c[_0x5526('0x24')]||_0x414cc7['waiting']!==_0x1f538c[_0x5526('0x25')]||_0x414cc7['inUse']!==_0x1f538c['inUse']||_0x414cc7[_0x5526('0x26')]!==_0x1f538c[_0x5526('0x26')];if(_0x414cc7['Trunk']&&_0x1f538c['Trunk']){_0x3ec045=_0x414cc7[_0x5526('0x27')]['name']!==_0x1f538c[_0x5526('0x27')]['name']||_0x414cc7[_0x5526('0x27')][_0x5526('0x1a')]!==_0x1f538c[_0x5526('0x27')][_0x5526('0x1a')];}return _0x27f7f4||_0x33a18a||_0x3ec045;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5d316f){var _0xcd7f8=null;var _0x5318ad=_0x5d316f[_0x5526('0x28')];if(_['isNil'](_0x5d316f[_0x5526('0x29')])||_['isNil'](_0x5d316f[_0x5526('0x2a')])||_['isNil'](_0x5d316f[_0x5526('0x2a')][_0x5526('0x2b')])){_0xcd7f8=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x5526('0x2c')](_0x5d316f[_0x5526('0x29')])||_[_0x5526('0x2c')](_0x5d316f['Interval'][_0x5526('0x2b')])){_0xcd7f8=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x5318ad&&!timezones[_0x5318ad]){_0xcd7f8=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0xcd7f8;}function checkAnyValidTrunk(_0x5e5b2c,_0x50a67e){var _0x3ff681=null;var _0x40c9f2=_0x5526('0x2d');var _0x40fe6e=[_0x5526('0x2e'),_0x5526('0x2f')];var _0x1e96fd=!![];if(_0x5e5b2c[_0x5526('0x27')]&&_0x5e5b2c[_0x5526('0x27')][_0x5526('0x1a')]){_0x40c9f2+=_0x5e5b2c[_0x5526('0x27')][_0x5526('0x30')];_0x3ff681=_0x50a67e[_0x40c9f2];_0x1e96fd=_0x40fe6e[_0x5526('0x31')](_0x3ff681[_0x5526('0x32')]);}else if(_0x5e5b2c[_0x5526('0x33')]&&_0x5e5b2c[_0x5526('0x33')][_0x5526('0x1a')]){_0x40c9f2+=_0x5e5b2c[_0x5526('0x33')][_0x5526('0x30')];_0x3ff681=_0x50a67e[_0x40c9f2];_0x1e96fd=_0x40fe6e[_0x5526('0x31')](_0x3ff681[_0x5526('0x32')]);}return _0x1e96fd;}function getQueueCampaignStatusMessage(_0x3a33f4,_0x2ae5d7){var _0x98f36f=CAMPAIGN_STATUS['ACTIVE'];var _0x34e39f=isPreviewCampaign(_0x3a33f4);if(!isQueueCampaignActive(_0x3a33f4)){if(_0x34e39f){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x34')];}else{if(_0x3a33f4[_0x5526('0x26')]===0x0&&_0x3a33f4['talking']===0x0&&_0x3a33f4[_0x5526('0x25')]===0x0&&(_0x3a33f4[_0x5526('0x24')]||0x0)===0x0){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x34')];}else{_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x35')];}}}else if(_0x3a33f4[_0x5526('0x20')]===0x0){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x36')];}else if(!checkAnyValidTrunk(_0x3a33f4,_0x2ae5d7)){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x37')];}else if(!isPreviewCampaign(_0x3a33f4)){var _0x4f5fba=checkAnyValidQueueCampaignInterval(_0x3a33f4);if(_0x4f5fba){_0x98f36f=_0x4f5fba;}}return _0x98f36f;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x419a4b){var _0x37fade=CAMPAIGN_STATUS[_0x5526('0x35')];if(_0x419a4b[_0x5526('0x26')]===0x0&&_0x419a4b[_0x5526('0x23')]===0x0&&_0x419a4b['waiting']===0x0&&(_0x419a4b[_0x5526('0x24')]||0x0)===0x0){_0x37fade=CAMPAIGN_STATUS[_0x5526('0x34')];}return _0x37fade;}exports[_0x5526('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3a0f2f){var _0x48ce6a=_0x3a0f2f['match'](/"(.*?)"/);return _0x48ce6a?_0x48ce6a[0x1]:_0x3a0f2f;}exports[_0x5526('0x39')]=extractCalleridName;function getCallerId(_0x313583,_0x2fb62b,_0x29b68c){if(!_['isUndefined'](_0x29b68c)&&typeof _0x29b68c===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x29b68c)){if(!_['isUndefined'](_0x2fb62b)&&typeof _0x2fb62b===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x2fb62b)){return util['format'](_0x5526('0x3b'),_0x2fb62b,_0x29b68c);}return util[_0x5526('0x3c')](_0x5526('0x3b'),_0x29b68c,_0x29b68c);}if(!_[_0x5526('0x3d')](_0x313583)&&typeof _0x313583===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x313583)){return _0x313583;}return'\x22\x22\x20<>';}exports[_0x5526('0x3e')]=getCallerId;function getCallerIdRandom(_0xba173e,_0x180bef){var _0x5f6907;var _0x53a827;var _0x914446;if(_0x180bef<=0x0){_0x180bef=0x1;}_0x5f6907=new RegExp('\x5cw{0,'+_0x180bef+'}$');_0x53a827=Math[_0x5526('0x3f')](0xa,_0x180bef-0x1);_0x914446=Math[_0x5526('0x3f')](0xa,_0x180bef)-0x1;return util[_0x5526('0x3c')]('%s',_[_0x5526('0x40')](_0xba173e,_0x5f6907,_[_0x5526('0x41')](_0x53a827,_0x914446)[_0x5526('0x42')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x476f04){if(_0x476f04[_0x5526('0x26')]&&_0x476f04[_0x5526('0x26')]>0x0){_0x476f04['originated']-=0x1;}else{logger[_0x5526('0x43')](_0x5526('0x44'));}}exports[_0x5526('0x45')]=decrementOriginate;function checkContactEmpty(_0x3506fe){return _0x3506fe&&_0x3506fe[_0x5526('0x46')]>0x0;}exports[_0x5526('0x47')]=checkContactEmpty;function erlangb(_0x227327,_0x21ae64){if(_0x21ae64===0x0){return 0x0;}var _0x49bae3=0x1;for(var _0x5b4e48=0x1;_0x5b4e48<=_0x21ae64;_0x5b4e48+=0x1){_0x49bae3=0x1+_0x49bae3*_0x5b4e48/_0x227327;}return 0x1/_0x49bae3;}exports[_0x5526('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x5a4054,_0x470b0a,_0x43d5a4){if(_0x470b0a>_0x43d5a4){for(var _0x4b8599=0x0;_0x4b8599<_0x470b0a-_0x43d5a4;_0x4b8599+=0x1){decrementOriginate(_0x5a4054);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1cc9d9){var _0xd610e8={};var _0x1ded30=['id',_0x5526('0x49'),'description',_0x5526('0x4a'),_0x5526('0x4b')];if(_0x1cc9d9){for(var _0x566c38 in _0x1cc9d9){if(typeof _0x1cc9d9[_0x566c38]!==_0x5526('0x4c')){if(!_['isNil'](_0x1cc9d9[_0x566c38])&&!_0x1ded30['includes'](_0x566c38)){_0xd610e8[util['format']('%s%s',_0x5526('0x4d'),_0x566c38[_0x5526('0x4e')]())]=_0x1cc9d9[_0x566c38];}}}}return _0xd610e8;}exports[_0x5526('0x4f')]=setXMDContactVariables; \ No newline at end of file +var _0xbd24=['isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','milliseconds','seconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','reachable','unmonitored','includes','status','TrunkBackup','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','INACTIVE','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','description','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','preview'];(function(_0x332264,_0x15ad59){var _0x214cd2=function(_0xfd3d65){while(--_0xfd3d65){_0x332264['push'](_0x332264['shift']());}};_0x214cd2(++_0x15ad59);}(_0xbd24,0x97));var _0x4bd2=function(_0x24f1ff,_0x4014c9){_0x24f1ff=_0x24f1ff-0x0;var _0x349109=_0xbd24[_0x24f1ff];return _0x349109;};'use strict';var _=require('lodash');var moment=require(_0x4bd2('0x0'));var util=require(_0x4bd2('0x1'));var logger=require(_0x4bd2('0x2'))(_0x4bd2('0x3'));var timezones=require(_0x4bd2('0x4'))[_0x4bd2('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x4bd2('0x6'),'BLACKLIST':_0x4bd2('0x7'),'CONTACTS_RESCHEDULED':_0x4bd2('0x8'),'DEACTIVATED':_0x4bd2('0x9'),'DISACTIVED':_0x4bd2('0xa'),'EMPTY_INTERVAL':_0x4bd2('0xb'),'INACTIVE':_0x4bd2('0xc'),'NO_AGENTS_LOGGED':_0x4bd2('0xd'),'NO_AVAILABLE_CONTACTS':_0x4bd2('0xe'),'NULL_INTERVAL':_0x4bd2('0xf'),'OVERTIME_INTERVAL':_0x4bd2('0x10'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4bd2('0x11'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x4bd2('0x12'),'UNREACHABLE_TRUNK':_0x4bd2('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x21b0e0){return _0x21b0e0['dialMethod']===_0x4bd2('0x14');}exports[_0x4bd2('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x365977){return _0x365977[_0x4bd2('0x16')]===_0x4bd2('0x17');}exports[_0x4bd2('0x18')]=isIVRCampaign;function isOutboundQueue(_0x305ff3){return _0x305ff3[_0x4bd2('0x16')]===_0x4bd2('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x229e56){return _0x229e56[_0x4bd2('0x1a')];}exports[_0x4bd2('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x54f392){return _0x54f392['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x52266a,_0x3d38c7){var _0x473ec5=moment(_0x52266a)[_0x4bd2('0x1c')](0x0);var _0x1e67e5=moment(_0x3d38c7)[_0x4bd2('0x1c')](0x0);return _0x473ec5['diff'](_0x1e67e5,_0x4bd2('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x18f440,_0x36899a){var _0x13a0d2=![];var _0x9208c7=_0x18f440[_0x4bd2('0x1e')]!==_0x36899a[_0x4bd2('0x1e')]||_0x18f440[_0x4bd2('0x1a')]!==_0x36899a['dialActive']||_0x18f440[_0x4bd2('0x1f')]!==_0x36899a['message'];var _0x490d74=_0x18f440[_0x4bd2('0x20')]!==_0x36899a[_0x4bd2('0x20')]||_0x18f440['loggedIn']!==_0x36899a[_0x4bd2('0x21')]||_0x18f440[_0x4bd2('0x22')]!==_0x36899a[_0x4bd2('0x22')]||_0x18f440[_0x4bd2('0x23')]!==_0x36899a[_0x4bd2('0x23')]||_0x18f440[_0x4bd2('0x24')]!==_0x36899a['talking']||_0x18f440[_0x4bd2('0x25')]!==_0x36899a['pTalking']||_0x18f440[_0x4bd2('0x26')]!==_0x36899a[_0x4bd2('0x26')]||_0x18f440[_0x4bd2('0x27')]!==_0x36899a[_0x4bd2('0x27')]||_0x18f440[_0x4bd2('0x28')]!==_0x36899a[_0x4bd2('0x28')];if(_0x18f440[_0x4bd2('0x29')]&&_0x36899a[_0x4bd2('0x29')]){_0x13a0d2=_0x18f440['Trunk'][_0x4bd2('0x2a')]!==_0x36899a[_0x4bd2('0x29')]['name']||_0x18f440['Trunk']['active']!==_0x36899a[_0x4bd2('0x29')][_0x4bd2('0x2b')];}return _0x9208c7||_0x490d74||_0x13a0d2;}exports[_0x4bd2('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x59fac7){var _0x2c01f4=null;var _0x1f4fed=_0x59fac7[_0x4bd2('0x2d')];if(_[_0x4bd2('0x2e')](_0x59fac7[_0x4bd2('0x2f')])||_[_0x4bd2('0x2e')](_0x59fac7[_0x4bd2('0x30')])||_[_0x4bd2('0x2e')](_0x59fac7[_0x4bd2('0x30')][_0x4bd2('0x31')])){_0x2c01f4=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x4bd2('0x32')](_0x59fac7[_0x4bd2('0x2f')])||_[_0x4bd2('0x32')](_0x59fac7[_0x4bd2('0x30')][_0x4bd2('0x31')])){_0x2c01f4=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1f4fed&&!timezones[_0x1f4fed]){_0x2c01f4=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x2c01f4;}function checkAnyValidTrunk(_0x135374,_0x4ef3ba){var _0x1ff3d1=null;var _0x22ae14='SIP/';var _0x28ebc4=[_0x4bd2('0x33'),_0x4bd2('0x34')];var _0x5c34a8=!![];if(_0x135374[_0x4bd2('0x29')]&&_0x135374['Trunk'][_0x4bd2('0x2b')]){_0x22ae14+=_0x135374['Trunk'][_0x4bd2('0x2a')];_0x1ff3d1=_0x4ef3ba[_0x22ae14];_0x5c34a8=_0x28ebc4[_0x4bd2('0x35')](_0x1ff3d1[_0x4bd2('0x36')]);}else if(_0x135374[_0x4bd2('0x37')]&&_0x135374[_0x4bd2('0x37')][_0x4bd2('0x2b')]){_0x22ae14+=_0x135374[_0x4bd2('0x37')]['name'];_0x1ff3d1=_0x4ef3ba[_0x22ae14];_0x5c34a8=_0x28ebc4[_0x4bd2('0x35')](_0x1ff3d1['status']);}return _0x5c34a8;}function getQueueCampaignStatusMessage(_0x45b4fe,_0x232fd3){var _0x4ff4e6=CAMPAIGN_STATUS[_0x4bd2('0x6')];var _0xd04666=isPreviewCampaign(_0x45b4fe);if(!isQueueCampaignActive(_0x45b4fe)){if(_0xd04666){_0x4ff4e6=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x45b4fe[_0x4bd2('0x28')]===0x0&&_0x45b4fe[_0x4bd2('0x24')]===0x0&&_0x45b4fe[_0x4bd2('0x26')]===0x0&&(_0x45b4fe[_0x4bd2('0x25')]||0x0)===0x0){_0x4ff4e6=CAMPAIGN_STATUS['INACTIVE'];}else{_0x4ff4e6=CAMPAIGN_STATUS[_0x4bd2('0x38')];}}}else if(_0x45b4fe['loggedIn']===0x0){_0x4ff4e6=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x45b4fe,_0x232fd3)){_0x4ff4e6=CAMPAIGN_STATUS[_0x4bd2('0x39')];}else if(!isPreviewCampaign(_0x45b4fe)){var _0x53a5c5=checkAnyValidQueueCampaignInterval(_0x45b4fe);if(_0x53a5c5){_0x4ff4e6=_0x53a5c5;}}return _0x4ff4e6;}exports[_0x4bd2('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xf1cb60){var _0x264388=CAMPAIGN_STATUS[_0x4bd2('0x38')];if(_0xf1cb60[_0x4bd2('0x28')]===0x0&&_0xf1cb60[_0x4bd2('0x24')]===0x0&&_0xf1cb60['waiting']===0x0&&(_0xf1cb60[_0x4bd2('0x25')]||0x0)===0x0){_0x264388=CAMPAIGN_STATUS[_0x4bd2('0x3b')];}return _0x264388;}exports[_0x4bd2('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3971ca){var _0x477e64=_0x3971ca[_0x4bd2('0x3d')](/"(.*?)"/);return _0x477e64?_0x477e64[0x1]:_0x3971ca;}exports[_0x4bd2('0x3e')]=extractCalleridName;function getCallerId(_0x466b4b,_0x3b0d09,_0x579963){if(!_[_0x4bd2('0x3f')](_0x579963)&&typeof _0x579963===_0x4bd2('0x40')&&!_['isEmpty'](_0x579963)){if(!_[_0x4bd2('0x3f')](_0x3b0d09)&&typeof _0x3b0d09===_0x4bd2('0x40')&&!_['isEmpty'](_0x3b0d09)){return util[_0x4bd2('0x41')](_0x4bd2('0x42'),_0x3b0d09,_0x579963);}return util[_0x4bd2('0x41')](_0x4bd2('0x42'),_0x579963,_0x579963);}if(!_[_0x4bd2('0x3f')](_0x466b4b)&&typeof _0x466b4b===_0x4bd2('0x40')&&!_[_0x4bd2('0x32')](_0x466b4b)){return _0x466b4b;}return _0x4bd2('0x43');}exports[_0x4bd2('0x44')]=getCallerId;function getCallerIdRandom(_0xb996c3,_0x141e8c){var _0x28618a;var _0x170ad9;var _0x1071cc;if(_0x141e8c<=0x0){_0x141e8c=0x1;}_0x28618a=new RegExp(_0x4bd2('0x45')+_0x141e8c+'}$');_0x170ad9=Math[_0x4bd2('0x46')](0xa,_0x141e8c-0x1);_0x1071cc=Math[_0x4bd2('0x46')](0xa,_0x141e8c)-0x1;return util[_0x4bd2('0x41')]('%s',_['replace'](_0xb996c3,_0x28618a,_[_0x4bd2('0x47')](_0x170ad9,_0x1071cc)[_0x4bd2('0x48')]()));}exports[_0x4bd2('0x49')]=getCallerIdRandom;function decrementOriginate(_0x210719){if(_0x210719[_0x4bd2('0x28')]&&_0x210719[_0x4bd2('0x28')]>0x0){_0x210719[_0x4bd2('0x28')]-=0x1;}else{logger['error'](_0x4bd2('0x4a'));}}exports[_0x4bd2('0x4b')]=decrementOriginate;function checkContactEmpty(_0x5a1946){return _0x5a1946&&_0x5a1946[_0x4bd2('0x4c')]>0x0;}exports[_0x4bd2('0x4d')]=checkContactEmpty;function erlangb(_0x12ee30,_0x130137){if(_0x130137===0x0){return 0x0;}var _0x16fed9=0x1;for(var _0x3d1017=0x1;_0x3d1017<=_0x130137;_0x3d1017+=0x1){_0x16fed9=0x1+_0x16fed9*_0x3d1017/_0x12ee30;}return 0x1/_0x16fed9;}exports[_0x4bd2('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x32e2ca,_0x4e8aee,_0xf7c6bf){if(_0x4e8aee>_0xf7c6bf){for(var _0x1fb864=0x0;_0x1fb864<_0x4e8aee-_0xf7c6bf;_0x1fb864+=0x1){decrementOriginate(_0x32e2ca);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x20f8c5){var _0x4d488b={};var _0x2ad9de=['id',_0x4bd2('0x4f'),_0x4bd2('0x50'),'tags',_0x4bd2('0x51')];if(_0x20f8c5){for(var _0x54c711 in _0x20f8c5){if(typeof _0x20f8c5[_0x54c711]!==_0x4bd2('0x52')){if(!_[_0x4bd2('0x2e')](_0x20f8c5[_0x54c711])&&!_0x2ad9de[_0x4bd2('0x35')](_0x54c711)){_0x4d488b[util['format']('%s%s',_0x4bd2('0x53'),_0x54c711[_0x4bd2('0x54')]())]=_0x20f8c5[_0x54c711];}}}}return _0x4d488b;}exports[_0x4bd2('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 62f6c38..2bb3175 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(_0x3da443,_0x2b8a4d){var _0x1060dd=function(_0x4b1ecc){while(--_0x4b1ecc){_0x3da443['push'](_0x3da443['shift']());}};_0x1060dd(++_0x2b8a4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x1269b6,_0x55de58){var _0x22857d=function(_0x356e39){while(--_0x356e39){_0x1269b6['push'](_0x1269b6['shift']());}};_0x22857d(++_0x55de58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 ebe6cb9..cad80b8 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 _0xa48f=['logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20'];(function(_0x527882,_0x31c2e7){var _0x574bd8=function(_0x40c03c){while(--_0x40c03c){_0x527882['push'](_0x527882['shift']());}};_0x574bd8(++_0x31c2e7);}(_0xa48f,0x11a));var _0xfa48=function(_0x5d0db1,_0x5f401b){_0x5d0db1=_0x5d0db1-0x0;var _0x2ea0c0=_0xa48f[_0x5d0db1];return _0x2ea0c0;};'use strict';var util=require(_0xfa48('0x0'));var _=require('lodash');var BPromise=require(_0xfa48('0x1'));var uuid=require(_0xfa48('0x2'));var moment=require(_0xfa48('0x3'));var path=require(_0xfa48('0x4'));var tiff2pdf=require(_0xfa48('0x5'));var gs=require('./util/gs');var logger=require(_0xfa48('0x6'))(_0xfa48('0x7'));var ami=require(_0xfa48('0x8'));var rpcDb=require(_0xfa48('0x9'));var Channel=require(_0xfa48('0xa'));var ut=require('./util/util');var Action=require(_0xfa48('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xfa48('0xc'));function Fax(_0x4ea197){this[_0xfa48('0xd')]={};this['faxAccounts']=_0x4ea197[_0xfa48('0xe')];this[_0xfa48('0xf')]=_0x4ea197['trunks'];this[_0xfa48('0x10')]={};ami['on'](_0xfa48('0x11'),this[_0xfa48('0x12')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x14'),this[_0xfa48('0x15')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x16'),this[_0xfa48('0x17')]['bind'](this));ami['on'](_0xfa48('0x18'),this['syncNewExten'][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x19'),this[_0xfa48('0x1a')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x1b'),this['syncReceiveFax'][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x1c'),this[_0xfa48('0x1d')]['bind'](this));ami['on'](_0xfa48('0x1e'),this['syncOriginateResponse'][_0xfa48('0x13')](this));}Fax[_0xfa48('0x1f')][_0xfa48('0x12')]=function(_0x5cda10){if(_0x5cda10[_0xfa48('0x20')]===_0xfa48('0x21')){for(var _0x27bdc9 in this[_0xfa48('0xe')]){if(this[_0xfa48('0xe')][_0xfa48('0x22')](_0x27bdc9)){if(_0x5cda10[_0xfa48('0x23')]===this[_0xfa48('0xe')][_0x27bdc9][_0xfa48('0x24')]){this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]]={};this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]][_0xfa48('0x26')]=_0x5cda10[_0xfa48('0x26')];this[_0xfa48('0xd')][_0x5cda10['uniqueid']]['id']=this['faxAccounts'][_0x27bdc9]['id'];this[_0xfa48('0xd')][_0x5cda10['uniqueid']][_0xfa48('0x27')]=this[_0xfa48('0xe')][_0x27bdc9]['name'];logger[_0xfa48('0x28')](_0x5cda10[_0xfa48('0x25')],_0xfa48('0x29'));}}}}if(this[_0xfa48('0x10')][_0x5cda10[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]]={};this[_0xfa48('0xd')][_0x5cda10['uniqueid']][_0xfa48('0x26')]=_0x5cda10[_0xfa48('0x26')];logger['info'](_0x5cda10[_0xfa48('0x25')],_0xfa48('0x29'));}};Fax[_0xfa48('0x1f')][_0xfa48('0x15')]=function(_0x31cf06){if(this[_0xfa48('0xd')][_0x31cf06[_0xfa48('0x25')]]){for(var _0x1ac1d0 in _0x31cf06[_0xfa48('0x2a')]){if(_0x31cf06[_0xfa48('0x2a')]['hasOwnProperty'](_0x1ac1d0)){this['channels'][_0x31cf06['uniqueid']][_0x1ac1d0]=_0x31cf06[_0xfa48('0x2b')];}}}};Fax['prototype'][_0xfa48('0x17')]=function(_0x288258){if(this['channels'][_0x288258[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0x288258['uniqueid']]['channelstate']=_0x288258[_0xfa48('0x2c')];this[_0xfa48('0xd')][_0x288258[_0xfa48('0x25')]][_0xfa48('0x2d')]=_0x288258[_0xfa48('0x2d')];}};Fax[_0xfa48('0x1f')][_0xfa48('0x2e')]=function(_0x522d13){if(this['channels'][_0x522d13[_0xfa48('0x25')]]){for(var _0x106ea6 in _0x522d13[_0xfa48('0x2a')]){if(_0x522d13[_0xfa48('0x2a')][_0xfa48('0x22')](_0x106ea6)){this[_0xfa48('0xd')][_0x522d13[_0xfa48('0x25')]][_0x106ea6]=_0x522d13[_0xfa48('0x2b')];}}}};Fax['prototype'][_0xfa48('0x1a')]=function(_0xd5a5f1){if(this['channels'][_0xd5a5f1[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0xd5a5f1[_0xfa48('0x25')]][_0xfa48('0x2f')]=_0xd5a5f1[_0xfa48('0x2f')];this[_0xfa48('0xd')][_0xd5a5f1[_0xfa48('0x25')]]['status']=_0xd5a5f1[_0xfa48('0x30')];this['channels'][_0xd5a5f1[_0xfa48('0x25')]][_0xfa48('0x24')]=_0xd5a5f1[_0xfa48('0x24')];this['channels'][_0xd5a5f1['uniqueid']][_0xfa48('0x31')]=_0xd5a5f1[_0xfa48('0x31')];logger['info'](_0xd5a5f1[_0xfa48('0x25')],_0xfa48('0x32'));}};Fax[_0xfa48('0x1f')][_0xfa48('0x33')]=function(_0x16d98b){var _0xe52592=this;if(this[_0xfa48('0xd')][_0x16d98b['uniqueid']]){var _0x2a917b=this['channels'][_0x16d98b[_0xfa48('0x25')]]['id'];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x34')]=_0x16d98b[_0xfa48('0x34')];this['channels'][_0x16d98b[_0xfa48('0x25')]]['pagestransferred']=_0x16d98b[_0xfa48('0x35')];this[_0xfa48('0xd')][_0x16d98b['uniqueid']][_0xfa48('0x24')]=_0x16d98b['localstationid'];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x36')]=_0x16d98b[_0xfa48('0x36')];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]]['transferrate']=_0x16d98b[_0xfa48('0x37')];this['channels'][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x31')]=_0x16d98b['filename'];this[_0xfa48('0xd')][_0x16d98b['uniqueid']][_0xfa48('0x38')]=_0x16d98b[_0xfa48('0x38')];if(this[_0xfa48('0xd')][_0x16d98b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x16d98b['filename'],_0xfa48('0x39'),function(_0x385cf8){logger[_0xfa48('0x28')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x3a'),_0x385cf8[_0xfa48('0x3b')]);attachment[_0xfa48('0x3c')]({'name':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])['name'],'basename':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])[_0xfa48('0x27')]+_0xfa48('0x3e'),'type':_0xfa48('0x3f')})[_0xfa48('0x40')](function(_0x25d558){faxAccount[_0xfa48('0x41')](_0x2a917b,{'from':_0x16d98b['calleridnum'],'mapKey':'fax','body':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])[_0xfa48('0x27')]+_0xfa48('0x3e'),'AttachmentId':_0x25d558['id']})[_0xfa48('0x42')](function(_0x5b1d99){logger[_0xfa48('0x43')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x44'),JSON[_0xfa48('0x45')](_0x5b1d99));});})['catch'](function(_0x287448){logger[_0xfa48('0x43')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x46'),JSON[_0xfa48('0x45')](_0x287448));});});}logger['info'](_0x16d98b[_0xfa48('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0xfa48('0x47')]=function(_0xb2e25b){if(this[_0xfa48('0x10')][_0xb2e25b[_0xfa48('0x25')]]){_['merge'](this['channels'][_0xb2e25b[_0xfa48('0x25')]],_[_0xfa48('0x48')](_0xb2e25b,[_0xfa48('0x49'),_0xfa48('0x4a')]));}};function updateStatus(_0x4fa617){if(_0x4fa617[_0xfa48('0x4b')]){faxMessage[_0xfa48('0x4c')](_0x4fa617[_0xfa48('0x4b')],{'failMessage':_0xfa48('0x4d')})[_0xfa48('0x40')](function(_0x178cf0){ut[_0xfa48('0x4e')]('[Fax][Message][Error][Updated]',_0x178cf0);})['catch'](function(_0x5eba2a){ut[_0xfa48('0x4e')](_0xfa48('0x4f'),_0x5eba2a);});}else{ut['logger'](_0xfa48('0x50'));}}Fax[_0xfa48('0x1f')]['updateStatus']=function(_0x49125f,_0x9587e,_0x327119){var _0x44cb6a=this;var _0x142572={};if(_0x9587e){_0x142572={'read':_0x9587e};}else{_0x142572={'failMessage':_0x327119};}if(this[_0xfa48('0x10')][_0x49125f][_0xfa48('0x4b')]){faxMessage[_0xfa48('0x4c')](this['actions'][_0x49125f]['AttachmentId'],_0x142572)['then'](function(_0x414eae){ut['logger']('[Fax][Message][Updated]',_0x414eae);})[_0xfa48('0x42')](function(_0x49f97c){ut[_0xfa48('0x4e')](_0xfa48('0x51'),_0x49f97c);})[_0xfa48('0x52')](function(){delete _0x44cb6a[_0xfa48('0xd')][_0x49125f];delete _0x44cb6a['actions'][_0x49125f];});}else{ut[_0xfa48('0x4e')](_0xfa48('0x53'));delete this[_0xfa48('0xd')][_0x49125f];delete this[_0xfa48('0x10')][_0x49125f];}};Fax[_0xfa48('0x1f')]['syncHangup']=function(_0xa19416){var _0x456413=this;if(this[_0xfa48('0xd')][_0xa19416['uniqueid']]){if(this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]]['id']=this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]['id'];this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x27')]=this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x27')];}logger[_0xfa48('0x28')](_0xa19416[_0xfa48('0x25')],this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]?'\x20hangup\x20sendFile\x20':_0xfa48('0x54'),JSON[_0xfa48('0x45')](this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]]));if(this['actions'][_0xa19416[_0xfa48('0x25')]]){if(this['channels'][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x55')]>0x0&&this[_0xfa48('0xd')][_0xa19416['uniqueid']][_0xfa48('0x19')]===_0xfa48('0x56')){this[_0xfa48('0x57')](_0xa19416[_0xfa48('0x25')],!![]);}else{this[_0xfa48('0x57')](_0xa19416['uniqueid'],![],this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x58')]?_0xfa48('0x59')+this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x58')]:_0xfa48('0x5a'));}}}};Fax[_0xfa48('0x1f')][_0xfa48('0x5b')]=function(_0x273b46){var _0x31ad48=this;return new BPromise(function(_0x3b47ff,_0x5d2867){_0x31ad48[_0xfa48('0x5c')](_0x273b46,_0x31ad48[_0xfa48('0xe')][_0x273b46[_0xfa48('0x5d')]])['then'](function(_0x40bec7){ut[_0xfa48('0x4e')](_0xfa48('0x5e'),_0x40bec7);_0x3b47ff(ut[_0xfa48('0x3b')](_0xfa48('0x5f')));})[_0xfa48('0x42')](function(_0x2b9425){ut[_0xfa48('0x4e')](_0xfa48('0x60'),_0x2b9425);updateStatus(_0x273b46);_0x5d2867(ut[_0xfa48('0x3b')]('Fax\x20failed'));});});};Fax[_0xfa48('0x1f')][_0xfa48('0x61')]=function(_0x30b0d8){var _0x2000ab=this;return new BPromise(function(_0x5429e8,_0x156742){var _0x14c635=_0x2000ab[_0xfa48('0x62')](_0x2000ab[_0xfa48('0xe')][_0x30b0d8[_0xfa48('0x5d')]]['Trunk'],_0x30b0d8);if(_0x14c635[_0xfa48('0x63')]){_0x5429e8(ut[_0xfa48('0x3b')](_0xfa48('0x64')));}else{_0x156742(ut[_0xfa48('0x3b')](_0x14c635['message']));}});};function originate(_0x35f123,_0x26f251,_0x28ec0c){return new BPromise(function(_0x1f8116,_0x8743ce){if(_0x28ec0c){var _0xaf7975=util[_0xfa48('0x65')](_0xfa48('0x66'),path[_0xfa48('0x3d')](_0x35f123[_0xfa48('0x4')])['name'],_0x35f123['path']);gs[_0xfa48('0x67')](_0xaf7975)[_0xfa48('0x40')](function(){_0x35f123[_0xfa48('0x4')]=util[_0xfa48('0x65')]('%s/%s.tif',path['parse'](_0x35f123[_0xfa48('0x4')])[_0xfa48('0x68')],path[_0xfa48('0x3d')](_0x35f123['path'])[_0xfa48('0x27')]);_0x26f251[_0xfa48('0x69')]=_0x35f123[_0xfa48('0x4')];ut['logger'](_0xfa48('0x6a'),'');ami[_0xfa48('0x6b')](ut[_0xfa48('0x6c')](_0x35f123,_0x26f251))[_0xfa48('0x40')](function(_0x4b7daf){_0x1f8116(_0x4b7daf);})['catch'](function(_0x60c8ea){_0x8743ce(_0x60c8ea);});})[_0xfa48('0x42')](function(_0x42116e){_0x8743ce(_0x42116e);});}else{ami[_0xfa48('0x6b')](ut[_0xfa48('0x6c')](_0x35f123,_0x26f251))[_0xfa48('0x40')](function(_0x468e7d){_0x1f8116(_0x468e7d);})[_0xfa48('0x42')](function(_0x34e7c5){_0x8743ce(_0x34e7c5);});}});}Fax[_0xfa48('0x1f')][_0xfa48('0x5c')]=function(_0xa19419,_0x4d6267){var _0x4b69ea=this;return new BPromise(function(_0x10e0a7,_0x40425e){var _0x22b285=uuid['v4']();var _0x5da9e8=ut[_0xfa48('0x6d')](_0xa19419,_0x4d6267);_0x4b69ea[_0xfa48('0x10')][_0x22b285]=new Action(_0x22b285,_0x4d6267,_0xa19419);var _0x508182=_0x4b69ea[_0xfa48('0x10')][_0x22b285];if(path[_0xfa48('0x3d')](_0xa19419['path'])[_0xfa48('0x6e')]===_0xfa48('0x3e')){originate(_0x508182,_0x5da9e8,!![])[_0xfa48('0x40')](function(_0x377afc){_0x10e0a7(_0x377afc);})[_0xfa48('0x42')](function(_0x100b20){_0x40425e(_0x100b20);});}else{originate(_0x508182,_0x5da9e8,![])['then'](function(_0xb5354b){_0x10e0a7(_0xb5354b);})[_0xfa48('0x42')](function(_0x59ea85){_0x40425e(_0x59ea85);});}});};Fax[_0xfa48('0x1f')][_0xfa48('0x6f')]=function(_0x43544f){return!_[_0xfa48('0x70')](_0x43544f)&&!_[_0xfa48('0x70')](_0x43544f[_0xfa48('0x27')])&&!_[_0xfa48('0x70')](_0x43544f[_0xfa48('0x71')])&&_0x43544f['active']&&!_[_0xfa48('0x70')](this[_0xfa48('0xf')][util['format'](_0xfa48('0x72'),_0x43544f[_0xfa48('0x27')])])&&!_['isNil'](this[_0xfa48('0xf')][util[_0xfa48('0x65')](_0xfa48('0x72'),_0x43544f['name'])][_0xfa48('0x30')])&&(this[_0xfa48('0xf')][util[_0xfa48('0x65')]('SIP/%s',_0x43544f[_0xfa48('0x27')])][_0xfa48('0x30')]==='reachable'||this[_0xfa48('0xf')][util[_0xfa48('0x65')](_0xfa48('0x72'),_0x43544f[_0xfa48('0x27')])][_0xfa48('0x30')]===_0xfa48('0x73'));};Fax[_0xfa48('0x1f')][_0xfa48('0x62')]=function(_0x456ddc,_0x455a6d){if(!this[_0xfa48('0x6f')](_0x456ddc)){ut['logger'](_0xfa48('0x74'),_[_0xfa48('0x70')](_0x456ddc)?'':_0x456ddc[_0xfa48('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xfa48('0x70')](_0x455a6d[_0xfa48('0x7')])){ut[_0xfa48('0x4e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xfa48('0x45')](_0x455a6d));return{'isValid':![],'message':_0xfa48('0x75')};}if(_[_0xfa48('0x70')](_0x455a6d[_0xfa48('0x4')])){ut[_0xfa48('0x4e')](_0xfa48('0x76'),JSON[_0xfa48('0x45')](_0x455a6d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xfa48('0x77')]=Fax; \ No newline at end of file +var _0x7d67=['reason','update','AttachmentId','logger','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','exten','uniqueid','channel','channels','\x20syncNewchannel\x20','actions','info','variable','channelstate','channelstatedesc','hasOwnProperty','value','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','name','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response'];(function(_0x21e420,_0x47f90f){var _0x186644=function(_0x4bf637){while(--_0x4bf637){_0x21e420['push'](_0x21e420['shift']());}};_0x186644(++_0x47f90f);}(_0x7d67,0xaa));var _0x77d6=function(_0x30b3fe,_0x50098c){_0x30b3fe=_0x30b3fe-0x0;var _0x1937dc=_0x7d67[_0x30b3fe];return _0x1937dc;};'use strict';var util=require(_0x77d6('0x0'));var _=require(_0x77d6('0x1'));var BPromise=require('bluebird');var uuid=require(_0x77d6('0x2'));var moment=require(_0x77d6('0x3'));var path=require(_0x77d6('0x4'));var tiff2pdf=require(_0x77d6('0x5'));var gs=require('./util/gs');var logger=require(_0x77d6('0x6'))(_0x77d6('0x7'));var ami=require(_0x77d6('0x8'));var rpcDb=require(_0x77d6('0x9'));var Channel=require(_0x77d6('0xa'));var ut=require(_0x77d6('0xb'));var Action=require(_0x77d6('0xc'));var faxAccount=require(_0x77d6('0xd'));var attachment=require(_0x77d6('0xe'));var faxMessage=require(_0x77d6('0xf'));function Fax(_0x455704){this['channels']={};this['faxAccounts']=_0x455704['faxAccounts'];this['trunks']=_0x455704['trunks'];this['actions']={};ami['on'](_0x77d6('0x10'),this[_0x77d6('0x11')][_0x77d6('0x12')](this));ami['on'](_0x77d6('0x13'),this[_0x77d6('0x14')][_0x77d6('0x12')](this));ami['on']('newstate',this['syncNewState'][_0x77d6('0x12')](this));ami['on'](_0x77d6('0x15'),this[_0x77d6('0x16')][_0x77d6('0x12')](this));ami['on'](_0x77d6('0x17'),this['syncFaxStatus'][_0x77d6('0x12')](this));ami['on'](_0x77d6('0x18'),this[_0x77d6('0x19')][_0x77d6('0x12')](this));ami['on'](_0x77d6('0x1a'),this[_0x77d6('0x1b')]['bind'](this));ami['on'](_0x77d6('0x1c'),this[_0x77d6('0x1d')][_0x77d6('0x12')](this));}Fax[_0x77d6('0x1e')]['syncNewchannel']=function(_0x3451d5){if(_0x3451d5[_0x77d6('0x1f')]===_0x77d6('0x20')){for(var _0x2e39bf in this['faxAccounts']){if(this[_0x77d6('0x21')]['hasOwnProperty'](_0x2e39bf)){if(_0x3451d5[_0x77d6('0x22')]===this[_0x77d6('0x21')][_0x2e39bf]['localstationid']){this['channels'][_0x3451d5[_0x77d6('0x23')]]={};this['channels'][_0x3451d5['uniqueid']][_0x77d6('0x24')]=_0x3451d5[_0x77d6('0x24')];this[_0x77d6('0x25')][_0x3451d5[_0x77d6('0x23')]]['id']=this['faxAccounts'][_0x2e39bf]['id'];this[_0x77d6('0x25')][_0x3451d5[_0x77d6('0x23')]]['name']=this['faxAccounts'][_0x2e39bf]['name'];logger['info'](_0x3451d5[_0x77d6('0x23')],_0x77d6('0x26'));}}}}if(this[_0x77d6('0x27')][_0x3451d5[_0x77d6('0x23')]]){this[_0x77d6('0x25')][_0x3451d5[_0x77d6('0x23')]]={};this['channels'][_0x3451d5['uniqueid']][_0x77d6('0x24')]=_0x3451d5[_0x77d6('0x24')];logger[_0x77d6('0x28')](_0x3451d5[_0x77d6('0x23')],_0x77d6('0x26'));}};Fax['prototype']['syncVarSet']=function(_0x1298cd){if(this[_0x77d6('0x25')][_0x1298cd[_0x77d6('0x23')]]){for(var _0x4d8b5d in _0x1298cd[_0x77d6('0x29')]){if(_0x1298cd[_0x77d6('0x29')]['hasOwnProperty'](_0x4d8b5d)){this['channels'][_0x1298cd[_0x77d6('0x23')]][_0x4d8b5d]=_0x1298cd['value'];}}}};Fax['prototype']['syncNewState']=function(_0x3973bf){if(this[_0x77d6('0x25')][_0x3973bf[_0x77d6('0x23')]]){this[_0x77d6('0x25')][_0x3973bf[_0x77d6('0x23')]]['channelstate']=_0x3973bf[_0x77d6('0x2a')];this[_0x77d6('0x25')][_0x3973bf['uniqueid']]['channelstatedesc']=_0x3973bf[_0x77d6('0x2b')];}};Fax[_0x77d6('0x1e')][_0x77d6('0x16')]=function(_0x42c121){if(this[_0x77d6('0x25')][_0x42c121[_0x77d6('0x23')]]){for(var _0x2540fc in _0x42c121[_0x77d6('0x29')]){if(_0x42c121[_0x77d6('0x29')][_0x77d6('0x2c')](_0x2540fc)){this[_0x77d6('0x25')][_0x42c121[_0x77d6('0x23')]][_0x2540fc]=_0x42c121[_0x77d6('0x2d')];}}}};Fax[_0x77d6('0x1e')][_0x77d6('0x2e')]=function(_0x1c949e){if(this['channels'][_0x1c949e[_0x77d6('0x23')]]){this['channels'][_0x1c949e[_0x77d6('0x23')]][_0x77d6('0x2f')]=_0x1c949e[_0x77d6('0x2f')];this['channels'][_0x1c949e[_0x77d6('0x23')]][_0x77d6('0x30')]=_0x1c949e[_0x77d6('0x30')];this[_0x77d6('0x25')][_0x1c949e[_0x77d6('0x23')]][_0x77d6('0x31')]=_0x1c949e[_0x77d6('0x31')];this[_0x77d6('0x25')][_0x1c949e[_0x77d6('0x23')]][_0x77d6('0x32')]=_0x1c949e[_0x77d6('0x32')];logger[_0x77d6('0x28')](_0x1c949e[_0x77d6('0x23')],_0x77d6('0x33'));}};Fax[_0x77d6('0x1e')][_0x77d6('0x19')]=function(_0x209747){var _0x82a831=this;if(this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]]){var _0x2ee7ab=this['channels'][_0x209747['uniqueid']]['id'];this[_0x77d6('0x25')][_0x209747['uniqueid']][_0x77d6('0x34')]=_0x209747['remotestationid'];this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]]['pagestransferred']=_0x209747[_0x77d6('0x35')];this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]][_0x77d6('0x31')]=_0x209747[_0x77d6('0x31')];this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]][_0x77d6('0x36')]=_0x209747[_0x77d6('0x36')];this[_0x77d6('0x25')][_0x209747['uniqueid']][_0x77d6('0x37')]=_0x209747['transferrate'];this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]][_0x77d6('0x32')]=_0x209747[_0x77d6('0x32')];this[_0x77d6('0x25')][_0x209747[_0x77d6('0x23')]]['calleridnum']=_0x209747[_0x77d6('0x38')];if(this[_0x77d6('0x25')][_0x209747['uniqueid']][_0x77d6('0x35')]>0x0){tiff2pdf(_0x209747[_0x77d6('0x32')],_0x77d6('0x39'),function(_0x2ed9c5){logger[_0x77d6('0x28')](_0x209747[_0x77d6('0x23')],_0x77d6('0x3a'),_0x2ed9c5[_0x77d6('0x3b')]);attachment['create']({'name':path[_0x77d6('0x3c')](_0x209747['filename'])[_0x77d6('0x3d')],'basename':path[_0x77d6('0x3c')](_0x209747[_0x77d6('0x32')])[_0x77d6('0x3d')]+_0x77d6('0x3e'),'type':_0x77d6('0x3f')})[_0x77d6('0x40')](function(_0x1bf71f){faxAccount[_0x77d6('0x41')](_0x2ee7ab,{'from':_0x209747[_0x77d6('0x38')],'mapKey':_0x77d6('0x7'),'body':path[_0x77d6('0x3c')](_0x209747[_0x77d6('0x32')])[_0x77d6('0x3d')]+_0x77d6('0x3e'),'AttachmentId':_0x1bf71f['id']})[_0x77d6('0x42')](function(_0x270893){logger[_0x77d6('0x43')](_0x209747[_0x77d6('0x23')],_0x77d6('0x44'),JSON[_0x77d6('0x45')](_0x270893));});})[_0x77d6('0x42')](function(_0x437a71){logger[_0x77d6('0x43')](_0x209747['uniqueid'],_0x77d6('0x46'),JSON[_0x77d6('0x45')](_0x437a71));});});}logger[_0x77d6('0x28')](_0x209747[_0x77d6('0x23')],_0x77d6('0x46'));}};Fax['prototype'][_0x77d6('0x1d')]=function(_0xa52cb6){if(this['actions'][_0xa52cb6[_0x77d6('0x23')]]){_[_0x77d6('0x47')](this[_0x77d6('0x25')][_0xa52cb6['uniqueid']],_[_0x77d6('0x48')](_0xa52cb6,[_0x77d6('0x49'),_0x77d6('0x4a')]));}};function updateStatus(_0x3c0d4d){if(_0x3c0d4d['AttachmentId']){faxMessage[_0x77d6('0x4b')](_0x3c0d4d[_0x77d6('0x4c')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x77d6('0x40')](function(_0x158240){ut[_0x77d6('0x4d')]('[Fax][Message][Error][Updated]',_0x158240);})[_0x77d6('0x42')](function(_0x314d4a){ut[_0x77d6('0x4d')]('[Fax][Message][Error][NoUpdate1]',_0x314d4a);});}else{ut[_0x77d6('0x4d')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x77d6('0x1e')][_0x77d6('0x4e')]=function(_0x278ac8,_0x239274,_0x33e292){var _0x141bf3=this;var _0x53dabd={};if(_0x239274){_0x53dabd={'read':_0x239274};}else{_0x53dabd={'failMessage':_0x33e292};}if(this['actions'][_0x278ac8][_0x77d6('0x4c')]){faxMessage[_0x77d6('0x4b')](this[_0x77d6('0x27')][_0x278ac8][_0x77d6('0x4c')],_0x53dabd)[_0x77d6('0x40')](function(_0x16bdec){ut[_0x77d6('0x4d')]('[Fax][Message][Updated]',_0x16bdec);})[_0x77d6('0x42')](function(_0x20ee2a){ut[_0x77d6('0x4d')](_0x77d6('0x4f'),_0x20ee2a);})[_0x77d6('0x50')](function(){delete _0x141bf3[_0x77d6('0x25')][_0x278ac8];delete _0x141bf3[_0x77d6('0x27')][_0x278ac8];});}else{ut[_0x77d6('0x4d')]('[Fax][Message][NoUpdate2]');delete this[_0x77d6('0x25')][_0x278ac8];delete this[_0x77d6('0x27')][_0x278ac8];}};Fax[_0x77d6('0x1e')][_0x77d6('0x1b')]=function(_0x32c801){var _0x465bbe=this;if(this[_0x77d6('0x25')][_0x32c801[_0x77d6('0x23')]]){if(this['actions'][_0x32c801[_0x77d6('0x23')]]){this[_0x77d6('0x25')][_0x32c801[_0x77d6('0x23')]]['id']=this[_0x77d6('0x27')][_0x32c801['uniqueid']]['id'];this[_0x77d6('0x25')][_0x32c801[_0x77d6('0x23')]][_0x77d6('0x3d')]=this['actions'][_0x32c801['uniqueid']][_0x77d6('0x3d')];}logger[_0x77d6('0x28')](_0x32c801[_0x77d6('0x23')],this[_0x77d6('0x27')][_0x32c801[_0x77d6('0x23')]]?'\x20hangup\x20sendFile\x20':_0x77d6('0x51'),JSON['stringify'](this['channels'][_0x32c801[_0x77d6('0x23')]]));if(this[_0x77d6('0x27')][_0x32c801[_0x77d6('0x23')]]){if(this['channels'][_0x32c801['uniqueid']][_0x77d6('0x52')]>0x0&&this[_0x77d6('0x25')][_0x32c801[_0x77d6('0x23')]][_0x77d6('0x17')]===_0x77d6('0x53')){this['updateStatus'](_0x32c801[_0x77d6('0x23')],!![]);}else{this[_0x77d6('0x4e')](_0x32c801[_0x77d6('0x23')],![],this[_0x77d6('0x25')][_0x32c801[_0x77d6('0x23')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x32c801['uniqueid']][_0x77d6('0x54')]:_0x77d6('0x55'));}}}};Fax[_0x77d6('0x1e')][_0x77d6('0x56')]=function(_0xd7d3d5){var _0x162e50=this;return new BPromise(function(_0x3d1aad,_0x3c94e6){_0x162e50[_0x77d6('0x57')](_0xd7d3d5,_0x162e50['faxAccounts'][_0xd7d3d5[_0x77d6('0x58')]])['then'](function(_0x346ec6){ut[_0x77d6('0x4d')](_0x77d6('0x59'),_0x346ec6);_0x3d1aad(ut[_0x77d6('0x3b')](_0x77d6('0x5a')));})[_0x77d6('0x42')](function(_0x16046d){ut[_0x77d6('0x4d')]('[Fax][execOriginate][failure]',_0x16046d);updateStatus(_0xd7d3d5);_0x3c94e6(ut[_0x77d6('0x3b')](_0x77d6('0x5b')));});});};Fax['prototype'][_0x77d6('0x5c')]=function(_0x44b491){var _0x4572cd=this;return new BPromise(function(_0x39fa8f,_0x3d00bd){var _0x2be929=_0x4572cd[_0x77d6('0x5d')](_0x4572cd[_0x77d6('0x21')][_0x44b491[_0x77d6('0x58')]][_0x77d6('0x5e')],_0x44b491);if(_0x2be929['isValid']){_0x39fa8f(ut[_0x77d6('0x3b')](_0x77d6('0x5f')));}else{_0x3d00bd(ut[_0x77d6('0x3b')](_0x2be929[_0x77d6('0x3b')]));}});};function originate(_0x8da085,_0x393acc,_0x19997e){return new BPromise(function(_0x481db4,_0x43c59d){if(_0x19997e){var _0x32816f=util[_0x77d6('0x60')](_0x77d6('0x61'),path[_0x77d6('0x3c')](_0x8da085[_0x77d6('0x4')])[_0x77d6('0x3d')],_0x8da085[_0x77d6('0x4')]);gs[_0x77d6('0x62')](_0x32816f)[_0x77d6('0x40')](function(){_0x8da085['path']=util[_0x77d6('0x60')](_0x77d6('0x63'),path['parse'](_0x8da085[_0x77d6('0x4')])[_0x77d6('0x64')],path[_0x77d6('0x3c')](_0x8da085[_0x77d6('0x4')])[_0x77d6('0x3d')]);_0x393acc[_0x77d6('0x65')]=_0x8da085[_0x77d6('0x4')];ut['logger'](_0x77d6('0x66'),'');ami['Action'](ut[_0x77d6('0x67')](_0x8da085,_0x393acc))[_0x77d6('0x40')](function(_0x5bcfb3){_0x481db4(_0x5bcfb3);})[_0x77d6('0x42')](function(_0x33ba51){_0x43c59d(_0x33ba51);});})['catch'](function(_0x4bc1d1){_0x43c59d(_0x4bc1d1);});}else{ami[_0x77d6('0x68')](ut[_0x77d6('0x67')](_0x8da085,_0x393acc))['then'](function(_0x537b05){_0x481db4(_0x537b05);})[_0x77d6('0x42')](function(_0x1d5232){_0x43c59d(_0x1d5232);});}});}Fax[_0x77d6('0x1e')]['execOriginate']=function(_0x2293f9,_0x2cb263){var _0xf35c72=this;return new BPromise(function(_0x32398a,_0x21954a){var _0x187e00=uuid['v4']();var _0xecc4c4=ut[_0x77d6('0x69')](_0x2293f9,_0x2cb263);_0xf35c72[_0x77d6('0x27')][_0x187e00]=new Action(_0x187e00,_0x2cb263,_0x2293f9);var _0x35d319=_0xf35c72['actions'][_0x187e00];if(path[_0x77d6('0x3c')](_0x2293f9[_0x77d6('0x4')])[_0x77d6('0x6a')]==='.pdf'){originate(_0x35d319,_0xecc4c4,!![])[_0x77d6('0x40')](function(_0x51a436){_0x32398a(_0x51a436);})[_0x77d6('0x42')](function(_0x3a962a){_0x21954a(_0x3a962a);});}else{originate(_0x35d319,_0xecc4c4,![])[_0x77d6('0x40')](function(_0x517bb5){_0x32398a(_0x517bb5);})[_0x77d6('0x42')](function(_0x361a15){_0x21954a(_0x361a15);});}});};Fax[_0x77d6('0x1e')][_0x77d6('0x6b')]=function(_0x1c078){return!_[_0x77d6('0x6c')](_0x1c078)&&!_[_0x77d6('0x6c')](_0x1c078[_0x77d6('0x3d')])&&!_[_0x77d6('0x6c')](_0x1c078[_0x77d6('0x6d')])&&_0x1c078[_0x77d6('0x6d')]&&!_[_0x77d6('0x6c')](this[_0x77d6('0x6e')][util[_0x77d6('0x60')]('SIP/%s',_0x1c078[_0x77d6('0x3d')])])&&!_[_0x77d6('0x6c')](this[_0x77d6('0x6e')][util[_0x77d6('0x60')](_0x77d6('0x6f'),_0x1c078['name'])][_0x77d6('0x30')])&&(this[_0x77d6('0x6e')][util[_0x77d6('0x60')](_0x77d6('0x6f'),_0x1c078[_0x77d6('0x3d')])]['status']===_0x77d6('0x70')||this['trunks'][util['format'](_0x77d6('0x6f'),_0x1c078['name'])]['status']===_0x77d6('0x71'));};Fax[_0x77d6('0x1e')][_0x77d6('0x5d')]=function(_0x48bf21,_0x2fd28d){if(!this[_0x77d6('0x6b')](_0x48bf21)){ut['logger'](_0x77d6('0x72'),_[_0x77d6('0x6c')](_0x48bf21)?'':_0x48bf21[_0x77d6('0x3d')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x77d6('0x73')};}if(_['isNil'](_0x2fd28d['fax'])){ut[_0x77d6('0x4d')](_0x77d6('0x74'),JSON[_0x77d6('0x45')](_0x2fd28d));return{'isValid':![],'message':_0x77d6('0x75')};}if(_[_0x77d6('0x6c')](_0x2fd28d[_0x77d6('0x4')])){ut[_0x77d6('0x4d')](_0x77d6('0x76'),JSON['stringify'](_0x2fd28d));return{'isValid':![],'message':_0x77d6('0x77')};}return{'isValid':!![],'message':_0x77d6('0x78')};};module[_0x77d6('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 78a4241..33ab6dc 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 _0xe395=['[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe395,0x88));var _0x5e39=function(_0x4d5aba,_0x976c34){_0x4d5aba=_0x4d5aba-0x0;var _0x1e1042=_0xe395[_0x4d5aba];return _0x1e1042;};'use strict';var util=require(_0x5e39('0x0'));var BPromise=require(_0x5e39('0x1'));var logger=require(_0x5e39('0x2'))(_0x5e39('0x3'));var _=require('lodash');var faxAccount=require(_0x5e39('0x4'));function loggerCatch(_0x3fec4b){return function(_0x37f99d){logger[_0x5e39('0x5')](_0x3fec4b,util['inspect'](_0x37f99d,{'showHidden':![],'depth':null}));};}exports[_0x5e39('0x6')]=function(_0x9f6d97,_0x138846){return BPromise['resolve']()[_0x5e39('0x7')](faxAccount[_0x5e39('0x6')](_0x9f6d97,_0x138846))['catch'](loggerCatch(_0x5e39('0x8')));}; \ No newline at end of file +var _0xe5ec=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0xe5ec,0x199));var _0xce5e=function(_0x514846,_0x34ac8d){_0x514846=_0x514846-0x0;var _0x2627a8=_0xe5ec[_0x514846];return _0x2627a8;};'use strict';var util=require(_0xce5e('0x0'));var BPromise=require(_0xce5e('0x1'));var logger=require(_0xce5e('0x2'))(_0xce5e('0x3'));var _=require(_0xce5e('0x4'));var faxAccount=require(_0xce5e('0x5'));function loggerCatch(_0x285ca1){return function(_0x5dff6f){logger[_0xce5e('0x6')](_0x285ca1,util[_0xce5e('0x7')](_0x5dff6f,{'showHidden':![],'depth':null}));};}exports[_0xce5e('0x8')]=function(_0x3d6eeb,_0x54abab){return BPromise[_0xce5e('0x9')]()[_0xce5e('0xa')](faxAccount[_0xce5e('0x8')](_0x3d6eeb,_0x54abab))['catch'](loggerCatch(_0xce5e('0xb')));}; \ 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 a2e30d1..6b69b17 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 _0x1f60=['Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info'];(function(_0x551904,_0x18af84){var _0xc4fa7f=function(_0x5970e1){while(--_0x5970e1){_0x551904['push'](_0x551904['shift']());}};_0xc4fa7f(++_0x18af84);}(_0x1f60,0x1e2));var _0x01f6=function(_0x5a2798,_0x37840f){_0x5a2798=_0x5a2798-0x0;var _0x8d1d45=_0x1f60[_0x5a2798];return _0x8d1d45;};'use strict';var util=require(_0x01f6('0x0'));var logger=require(_0x01f6('0x1'))(_0x01f6('0x2'));var BPromise=require(_0x01f6('0x3'));var exec=require(_0x01f6('0x4'))[_0x01f6('0x5')];exports[_0x01f6('0x6')]=function(_0x23ffd6){return new BPromise(function(_0x248900,_0x5cd1cd){exec(_0x23ffd6,function(_0x335741,_0xa7af1c,_0x4d1625){logger[_0x01f6('0x7')]('Exec\x20gs',_0xa7af1c);if(_0x335741){logger[_0x01f6('0x7')](_0x01f6('0x8'),_0x01f6('0x9'),util['inspect'](_0x335741,{'showHidden':![],'depth':null}),_0xa7af1c,_0x4d1625);_0x5cd1cd(_0x335741);}_0x248900(_0xa7af1c);});});}; \ No newline at end of file +var _0xd0ce=['Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','execute','info'];(function(_0x37a5d2,_0x125bae){var _0x351ac8=function(_0x584dca){while(--_0x584dca){_0x37a5d2['push'](_0x37a5d2['shift']());}};_0x351ac8(++_0x125bae);}(_0xd0ce,0x16b));var _0xed0c=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0xd0ce[_0x52598d];return _0x170309;};'use strict';var util=require('util');var logger=require(_0xed0c('0x0'))(_0xed0c('0x1'));var BPromise=require(_0xed0c('0x2'));var exec=require('child_process')['exec'];exports[_0xed0c('0x3')]=function(_0x4b60a9){return new BPromise(function(_0x4729a4,_0x126722){exec(_0x4b60a9,function(_0x69cfe2,_0x560c1b,_0x172ac8){logger[_0xed0c('0x4')]('Exec\x20gs',_0x560c1b);if(_0x69cfe2){logger[_0xed0c('0x4')](_0xed0c('0x5'),_0xed0c('0x6'),util[_0xed0c('0x7')](_0x69cfe2,{'showHidden':![],'depth':null}),_0x560c1b,_0x172ac8);_0x126722(_0x69cfe2);}_0x4729a4(_0x560c1b);});});}; \ 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 c9bf10d..10be007 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 _0x3be1=['ecm','headerinfo','maxrate','\x22%s\x22','gateway','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','inspect'];(function(_0x2cc52b,_0xd6096c){var _0x1c0b5f=function(_0x31435c){while(--_0x31435c){_0x2cc52b['push'](_0x2cc52b['shift']());}};_0x1c0b5f(++_0xd6096c);}(_0x3be1,0x72));var _0x13be=function(_0x2e9709,_0x172b8a){_0x2e9709=_0x2e9709-0x0;var _0x7a7d13=_0x3be1[_0x2e9709];return _0x7a7d13;};'use strict';var util=require('util');var _=require(_0x13be('0x0'));var moment=require(_0x13be('0x1'));var logger=require(_0x13be('0x2'))(_0x13be('0x3'));exports[_0x13be('0x4')]=function(_0x15f952){return{'message':_0x15f952};};exports['logger']=function(_0x2fec66,_0x52cb70){logger['info'](_0x2fec66,util[_0x13be('0x5')](_0x52cb70,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5dbe29,_0x1e78c6){var _0x28a2e1={'XMF-ECM':_0x1e78c6[_0x13be('0x6')],'XMF-HEADERINFO':_0x1e78c6[_0x13be('0x7')],'XMF-MINRATE':_0x1e78c6['minrate'],'XMF-MAXRATE':_0x1e78c6[_0x13be('0x8')],'XMF-MODEM':util['format'](_0x13be('0x9'),_0x1e78c6['modem']),'XMF-GATEWAY':_0x1e78c6[_0x13be('0xa')],'XMF-FAXDETECT':_0x1e78c6['faxdetect'],'XMF-T38TIMEOUT':_0x1e78c6[_0x13be('0xb')],'XMF-LOCALSTATIONID':_0x1e78c6[_0x13be('0xc')],'XMF-PATH':_0x5dbe29[_0x13be('0xd')]};return _0x28a2e1;};exports['variablesAction']=function(_0x44eb31,_0x73af3b){return{'actionid':_0x44eb31[_0x13be('0xe')],'action':_0x13be('0xf'),'channel':_0x44eb31[_0x13be('0x10')],'Exten':_0x13be('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0x13be('0x12')](_0x13be('0x13'),_0x44eb31[_0x13be('0x7')]?_0x44eb31['headerinfo']:'',_0x44eb31[_0x13be('0xc')]),'variable':_0x73af3b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x44eb31[_0x13be('0xe')]};}; \ No newline at end of file +var _0x01cf=['faxdetect','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway'];(function(_0x4b20c1,_0xa13194){var _0x11ac6e=function(_0x4218fc){while(--_0x4218fc){_0x4b20c1['push'](_0x4b20c1['shift']());}};_0x11ac6e(++_0xa13194);}(_0x01cf,0x141));var _0xf01c=function(_0x3197cc,_0x550679){_0x3197cc=_0x3197cc-0x0;var _0x19e2cd=_0x01cf[_0x3197cc];return _0x19e2cd;};'use strict';var util=require(_0xf01c('0x0'));var _=require(_0xf01c('0x1'));var moment=require(_0xf01c('0x2'));var logger=require(_0xf01c('0x3'))(_0xf01c('0x4'));exports[_0xf01c('0x5')]=function(_0x5d1054){return{'message':_0x5d1054};};exports[_0xf01c('0x6')]=function(_0x2a17e5,_0x459f50){logger[_0xf01c('0x7')](_0x2a17e5,util[_0xf01c('0x8')](_0x459f50,{'showHidden':![],'depth':null}));};exports[_0xf01c('0x9')]=function(_0x31cd5,_0x4c3b2c){var _0x168d1f={'XMF-ECM':_0x4c3b2c['ecm'],'XMF-HEADERINFO':_0x4c3b2c[_0xf01c('0xa')],'XMF-MINRATE':_0x4c3b2c[_0xf01c('0xb')],'XMF-MAXRATE':_0x4c3b2c[_0xf01c('0xc')],'XMF-MODEM':util[_0xf01c('0xd')](_0xf01c('0xe'),_0x4c3b2c[_0xf01c('0xf')]),'XMF-GATEWAY':_0x4c3b2c[_0xf01c('0x10')],'XMF-FAXDETECT':_0x4c3b2c[_0xf01c('0x11')],'XMF-T38TIMEOUT':_0x4c3b2c['t38timeout'],'XMF-LOCALSTATIONID':_0x4c3b2c[_0xf01c('0x12')],'XMF-PATH':_0x31cd5[_0xf01c('0x13')]};return _0x168d1f;};exports[_0xf01c('0x14')]=function(_0x4de9f7,_0x3f2918){return{'actionid':_0x4de9f7['uniqueid'],'action':_0xf01c('0x15'),'channel':_0x4de9f7[_0xf01c('0x16')],'Exten':_0xf01c('0x17'),'Context':_0xf01c('0x18'),'Priority':'1','callerid':util[_0xf01c('0xd')](_0xf01c('0x19'),_0x4de9f7[_0xf01c('0xa')]?_0x4de9f7[_0xf01c('0xa')]:'',_0x4de9f7['localstationid']),'variable':_0x3f2918,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4de9f7['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0ebaf09..8ebe58d 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 _0x4c94=['initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory'];(function(_0x214763,_0x4701ff){var _0x136bdc=function(_0x4e0985){while(--_0x4e0985){_0x214763['push'](_0x214763['shift']());}};_0x136bdc(++_0x4701ff);}(_0x4c94,0x83));var _0x44c9=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x4c94[_0x3826ad];return _0x17b900;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0x44c9('0x0'));var Realtime=require(_0x44c9('0x1'));var Report=require(_0x44c9('0x2'));var Acw=require(_0x44c9('0x3'));var Trigger=require(_0x44c9('0x4'));var Dialer=require(_0x44c9('0x5'));var Preview=require(_0x44c9('0x6'));var Fax=require(_0x44c9('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x44c9('0x8'));var voiceQueueReport=require(_0x44c9('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x44c9('0xa'));var cmHopperHistory=require(_0x44c9('0xb'));var campaign=require(_0x44c9('0xc'));var voiceExtension=require(_0x44c9('0xd'));var faxAccount=require(_0x44c9('0xe'));var zendesk=require(_0x44c9('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x44c9('0x10'));var zoho=require(_0x44c9('0x11'));var vtiger=require(_0x44c9('0x12'));var freshsales=require(_0x44c9('0x13'));var servicenow=require(_0x44c9('0x14'));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(_0x44c9('0x15'))(_0x44c9('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x44c9('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x44c9('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x44c9('0x18')]()[_0x44c9('0x19')](user[_0x44c9('0x1a')]())[_0x44c9('0x19')](realtime['initAgents']())[_0x44c9('0x19')](user[_0x44c9('0x1b')]())[_0x44c9('0x19')](realtime[_0x44c9('0x1c')]())[_0x44c9('0x19')](trunk[_0x44c9('0x1d')]())['then'](realtime[_0x44c9('0x1e')]())[_0x44c9('0x19')](voiceQueue[_0x44c9('0x1f')]())[_0x44c9('0x19')](realtime[_0x44c9('0x20')]())[_0x44c9('0x19')](trigger[_0x44c9('0x21')]())[_0x44c9('0x19')](realtime[_0x44c9('0x22')]())[_0x44c9('0x19')](template[_0x44c9('0x23')]())['then'](realtime[_0x44c9('0x24')]())[_0x44c9('0x19')](zendesk['getZendeskAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x25')]())[_0x44c9('0x19')](salesforce[_0x44c9('0x26')]())[_0x44c9('0x19')](realtime[_0x44c9('0x27')]())[_0x44c9('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x28')]())['then'](freshdesk[_0x44c9('0x29')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0x44c9('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x44c9('0x19')](zoho['getZohoAccounts']())[_0x44c9('0x19')](realtime['initZohoAccounts']())['then'](vtiger[_0x44c9('0x2b')]())[_0x44c9('0x19')](realtime[_0x44c9('0x2c')]())['then'](freshsales['getFreshsalesAccounts']())[_0x44c9('0x19')](realtime['initFreshsalesAccounts']())[_0x44c9('0x19')](servicenow[_0x44c9('0x2d')]())[_0x44c9('0x19')](realtime['initServicenowAccounts']())[_0x44c9('0x19')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x44c9('0x2e')]())['then'](campaign['getCampaigns']())['then'](realtime[_0x44c9('0x2f')]())[_0x44c9('0x19')](voiceExtension[_0x44c9('0x30')]())[_0x44c9('0x19')](realtime[_0x44c9('0x31')]())['then'](faxAccount['getFaxAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x32')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x44c9('0x18')]()[_0x44c9('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x44c9('0x19')](realtime[_0x44c9('0x33')]())[_0x44c9('0x19')](cmHopperHistory[_0x44c9('0x34')]())[_0x44c9('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x44c9('0x19')](cmHopperHistory[_0x44c9('0x35')]())[_0x44c9('0x19')](realtime[_0x44c9('0x36')]())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x44c9('0x37')]())[_0x44c9('0x38')](function(_0x4adb24){logger[_0x44c9('0x39')](_0x44c9('0x3a'),util[_0x44c9('0x3b')](_0x4adb24,{'showHidden':![],'depth':null}));});}function main(){return server[_0x44c9('0x3c')](realtime,preview,fax)[_0x44c9('0x19')](function(){return initRealtime();})[_0x44c9('0x19')](function(){return initParams();})[_0x44c9('0x19')](function(){report[_0x44c9('0x3d')]();setInterval(initRealtime,0x1388);})[_0x44c9('0x38')](function(_0x40cdc2){logger['error']('[index.js][main]',util[_0x44c9('0x3b')](_0x40cdc2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xdc19=['catch','error','[index.js][initParams]','inspect','listen','sync','util','moment','./server','./realtime','./acw','./dialer','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','../../config/logger','ami','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xdc19,0x14b));var _0x9dc1=function(_0x46ac39,_0x3d2ba9){_0x46ac39=_0x46ac39-0x0;var _0x4bebb7=_0xdc19[_0x46ac39];return _0x4bebb7;};'use strict';var util=require(_0x9dc1('0x0'));var moment=require(_0x9dc1('0x1'));var server=require(_0x9dc1('0x2'));var Realtime=require(_0x9dc1('0x3'));var Report=require('./report');var Acw=require(_0x9dc1('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x9dc1('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x9dc1('0x6'));var voiceCallReport=require(_0x9dc1('0x7'));var trunk=require(_0x9dc1('0x8'));var trigger=require(_0x9dc1('0x9'));var template=require(_0x9dc1('0xa'));var cmHopperHistory=require(_0x9dc1('0xb'));var campaign=require(_0x9dc1('0xc'));var voiceExtension=require(_0x9dc1('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9dc1('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x9dc1('0xf'));var freshdesk=require(_0x9dc1('0x10'));var desk=require(_0x9dc1('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x9dc1('0x12'));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(_0x9dc1('0x13'))(_0x9dc1('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9dc1('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x9dc1('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x9dc1('0x16')]()[_0x9dc1('0x17')](user[_0x9dc1('0x18')]())[_0x9dc1('0x17')](realtime['initAgents']())[_0x9dc1('0x17')](user[_0x9dc1('0x19')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x1a')]())[_0x9dc1('0x17')](trunk['getTrunks']())[_0x9dc1('0x17')](realtime[_0x9dc1('0x1b')]())[_0x9dc1('0x17')](voiceQueue[_0x9dc1('0x1c')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x1d')]())[_0x9dc1('0x17')](trigger[_0x9dc1('0x1e')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x1f')]())['then'](template['getTemplates']())['then'](realtime[_0x9dc1('0x20')]())[_0x9dc1('0x17')](zendesk[_0x9dc1('0x21')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x22')]())[_0x9dc1('0x17')](salesforce[_0x9dc1('0x23')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x24')]())['then'](sugarcrm[_0x9dc1('0x25')]())['then'](realtime[_0x9dc1('0x26')]())[_0x9dc1('0x17')](freshdesk[_0x9dc1('0x27')]())[_0x9dc1('0x17')](realtime['initFreshdeskAccounts']())[_0x9dc1('0x17')](desk[_0x9dc1('0x28')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x29')]())[_0x9dc1('0x17')](zoho['getZohoAccounts']())[_0x9dc1('0x17')](realtime['initZohoAccounts']())[_0x9dc1('0x17')](vtiger[_0x9dc1('0x2a')]())['then'](realtime[_0x9dc1('0x2b')]())[_0x9dc1('0x17')](freshsales[_0x9dc1('0x2c')]())['then'](realtime[_0x9dc1('0x2d')]())['then'](servicenow[_0x9dc1('0x2e')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x2f')]())['then'](dynamics365[_0x9dc1('0x30')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x31')]())[_0x9dc1('0x17')](campaign[_0x9dc1('0x32')]())[_0x9dc1('0x17')](realtime['initCampaigns']())[_0x9dc1('0x17')](voiceExtension[_0x9dc1('0x33')]())[_0x9dc1('0x17')](realtime['initVoiceExtensions']())[_0x9dc1('0x17')](faxAccount[_0x9dc1('0x34')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x35')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x9dc1('0x17')](voiceQueueReport[_0x9dc1('0x36')]())['then'](realtime[_0x9dc1('0x37')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x9dc1('0x38')]())[_0x9dc1('0x17')](voiceCallReport[_0x9dc1('0x39')]())[_0x9dc1('0x17')](realtime[_0x9dc1('0x3a')]())[_0x9dc1('0x3b')](function(_0x4e9bc3){logger[_0x9dc1('0x3c')](_0x9dc1('0x3d'),util[_0x9dc1('0x3e')](_0x4e9bc3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9dc1('0x3f')](realtime,preview,fax)[_0x9dc1('0x17')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x9dc1('0x17')](function(){report[_0x9dc1('0x40')]();setInterval(initRealtime,0x1388);})[_0x9dc1('0x3b')](function(_0x2dc449){logger[_0x9dc1('0x3c')]('[index.js][main]',util[_0x9dc1('0x3e')](_0x2dc449,{'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 c5cf976..a0b6c83 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 _0x53d5=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','statePause','toNumber','user:ami:update','user:presence','exports','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x55d52e,_0x285816){var _0x4bfed4=function(_0x1f10b5){while(--_0x1f10b5){_0x55d52e['push'](_0x55d52e['shift']());}};_0x4bfed4(++_0x285816);}(_0x53d5,0x1cc));var _0x553d=function(_0x505a68,_0xa297b7){_0x505a68=_0x505a68-0x0;var _0x4caac6=_0x53d5[_0x505a68];return _0x4caac6;};'use strict';var _=require(_0x553d('0x0'));var util=require(_0x553d('0x1'));var moment=require(_0x553d('0x2'));var Redis=require(_0x553d('0x3'));var config=require(_0x553d('0x4'));config[_0x553d('0x5')]=_[_0x553d('0x6')](config['redis'],{'host':_0x553d('0x7'),'port':0x18eb});var io=require(_0x553d('0x8'))(new Redis(config[_0x553d('0x5')]));function Agent(_0x1c3955){this['id']=_0x1c3955['id']||0x0;this[_0x553d('0x9')]=_0x1c3955['name']||'';this[_0x553d('0xa')]=_0x1c3955[_0x553d('0xa')]||'';this[_0x553d('0xb')]=_0x1c3955[_0x553d('0xb')]||'';this[_0x553d('0xc')]=_0x1c3955[_0x553d('0xc')]||'';this[_0x553d('0xd')]=_0x553d('0xe');this[_0x553d('0xf')]=0x0;this[_0x553d('0x10')]=_0x553d('0xe');this[_0x553d('0x11')]='';this['phone']='';this['mobile']='';this[_0x553d('0x12')]='';this['online']=_0x1c3955[_0x553d('0x13')]||![];this[_0x553d('0x14')]=_0x553d('0xe');this[_0x553d('0x15')]=0x0;this[_0x553d('0x16')]='';this[_0x553d('0x17')]='';this[_0x553d('0x18')]=![];this[_0x553d('0x19')]=![];}Agent[_0x553d('0x1a')][_0x553d('0x1b')]=function(_0x3cb13c){if(!_0x3cb13c[_0x553d('0xd')]){return;}var _0x52ded8=null;var _0x2dc357=_0x3cb13c['state'][_0x553d('0x1c')]();switch(_0x2dc357){case _0x553d('0x1d'):_0x2dc357=_0x553d('0x1e');break;case'inuse':_0x2dc357='talking';break;}if(this[_0x553d('0x14')]!==_0x2dc357||_0x3cb13c[_0x553d('0x1f')]){_0x52ded8=_[_0x553d('0x20')](moment()['format']('x'));}var _0x2ab468={'id':this['id'],'name':this[_0x553d('0x9')],'email':this[_0x553d('0xa')],'accountcode':this[_0x553d('0xb')],'fullname':this[_0x553d('0xc')],'state':this[_0x553d('0xd')],'stateTime':this[_0x553d('0xf')],'status':this[_0x553d('0x10')],'address':this[_0x553d('0x11')],'voiceStatus':_0x2dc357||this[_0x553d('0x14')],'voiceStatusTime':_0x52ded8||this[_0x553d('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x553d('0x17')],'interface':this[_0x553d('0x12')],'onhold':this['onhold']};if(this[_0x553d('0x14')]!==_0x2dc357){this[_0x553d('0x14')]=_0x2dc357;io['to'](util['format']('user:%s',_0x2ab468['name']))['emit'](_0x553d('0x21'),_0x2ab468);io['emit'](_0x553d('0x22'),_0x2ab468);}};module[_0x553d('0x23')]=Agent; \ No newline at end of file +var _0xac9d=['format','user:%s','emit','user:ami:update','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','onhold'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xac9d,0x14d));var _0xdac9=function(_0x14ee69,_0x436a8a){_0x14ee69=_0x14ee69-0x0;var _0x4d5664=_0xac9d[_0x14ee69];return _0x4d5664;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var Redis=require(_0xdac9('0x3'));var config=require(_0xdac9('0x4'));config[_0xdac9('0x5')]=_[_0xdac9('0x6')](config[_0xdac9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xdac9('0x7'))(new Redis(config['redis']));function Agent(_0x3d56ae){this['id']=_0x3d56ae['id']||0x0;this[_0xdac9('0x8')]=_0x3d56ae[_0xdac9('0x8')]||'';this[_0xdac9('0x9')]=_0x3d56ae[_0xdac9('0x9')]||'';this[_0xdac9('0xa')]=_0x3d56ae['accountcode']||'';this[_0xdac9('0xb')]=_0x3d56ae['fullname']||'';this[_0xdac9('0xc')]=_0xdac9('0xd');this[_0xdac9('0xe')]=0x0;this[_0xdac9('0xf')]=_0xdac9('0xd');this[_0xdac9('0x10')]='';this[_0xdac9('0x11')]='';this[_0xdac9('0x12')]='';this[_0xdac9('0x13')]='';this['online']=_0x3d56ae[_0xdac9('0x14')]||![];this[_0xdac9('0x15')]='unknown';this[_0xdac9('0x16')]=0x0;this[_0xdac9('0x17')]='';this[_0xdac9('0x18')]='';this['onhold']=![];this[_0xdac9('0x19')]=![];}Agent[_0xdac9('0x1a')][_0xdac9('0x1b')]=function(_0x5f0bbd){if(!_0x5f0bbd['state']){return;}var _0x52cbd4=null;var _0x3d9fcf=_0x5f0bbd['state'][_0xdac9('0x1c')]();switch(_0x3d9fcf){case _0xdac9('0x1d'):_0x3d9fcf=_0xdac9('0x1e');break;case _0xdac9('0x1f'):_0x3d9fcf=_0xdac9('0x20');break;}if(this[_0xdac9('0x15')]!==_0x3d9fcf||_0x5f0bbd[_0xdac9('0x21')]){_0x52cbd4=_[_0xdac9('0x22')](moment()['format']('x'));}var _0x283343={'id':this['id'],'name':this[_0xdac9('0x8')],'email':this['email'],'accountcode':this[_0xdac9('0xa')],'fullname':this[_0xdac9('0xb')],'state':this[_0xdac9('0xc')],'stateTime':this[_0xdac9('0xe')],'status':this['status'],'address':this['address'],'voiceStatus':_0x3d9fcf||this[_0xdac9('0x15')],'voiceStatusTime':_0x52cbd4||this[_0xdac9('0x16')],'voiceStatusCallerIdNumber':this[_0xdac9('0x17')],'voiceStatusQueue':this[_0xdac9('0x18')],'interface':this['interface'],'onhold':this[_0xdac9('0x23')]};if(this[_0xdac9('0x15')]!==_0x3d9fcf){this[_0xdac9('0x15')]=_0x3d9fcf;io['to'](util[_0xdac9('0x24')](_0xdac9('0x25'),_0x283343[_0xdac9('0x8')]))[_0xdac9('0x26')](_0xdac9('0x27'),_0x283343);io[_0xdac9('0x26')](_0xdac9('0x28'),_0x283343);}};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 c53bef5..4093bba 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 _0x357e=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone'];(function(_0x492d02,_0x49e61e){var _0x339033=function(_0x7a96e7){while(--_0x7a96e7){_0x492d02['push'](_0x492d02['shift']());}};_0x339033(++_0x49e61e);}(_0x357e,0x1f3));var _0xe357=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x357e[_0x31a371];return _0x2a5bd6;};'use strict';function Campaign(_0x4bebc5){this['id']=_0x4bebc5['id']||0x0;this['name']=_0x4bebc5[_0xe357('0x0')]||'';this[_0xe357('0x1')]=_0x4bebc5[_0xe357('0x1')]||_0xe357('0x2');this[_0xe357('0x3')]=0x0;this[_0xe357('0x4')]=0x0;this[_0xe357('0x5')]=0x0;this[_0xe357('0x6')]=0x0;this[_0xe357('0x7')]='';this[_0xe357('0x8')]=!![];this[_0xe357('0x9')]=_0x4bebc5[_0xe357('0x9')];this['limitCalls']=_0x4bebc5['limitCalls'];this[_0xe357('0xa')]=_0x4bebc5['dialTimezone']||null;this[_0xe357('0xb')]=_0x4bebc5[_0xe357('0xb')]?_0x4bebc5[_0xe357('0xb')]:null;this[_0xe357('0xc')]=_0x4bebc5[_0xe357('0xc')];this[_0xe357('0xd')]=_0x4bebc5[_0xe357('0xd')];this[_0xe357('0xe')]=_0x4bebc5[_0xe357('0xe')]||0x1e;this[_0xe357('0xf')]=_0x4bebc5[_0xe357('0xf')];this['dialCongestionRetryFrequency']=_0x4bebc5[_0xe357('0x10')];this[_0xe357('0x11')]=_0x4bebc5[_0xe357('0x11')];this['dialBusyRetryFrequency']=_0x4bebc5[_0xe357('0x12')];this['dialNoAnswerMaxRetry']=_0x4bebc5[_0xe357('0x13')];this[_0xe357('0x14')]=_0x4bebc5['dialNoAnswerRetryFrequency'];this[_0xe357('0x15')]=_0x4bebc5['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x4bebc5[_0xe357('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4bebc5[_0xe357('0x17')]||0x96;this[_0xe357('0x18')]=_0x4bebc5[_0xe357('0x18')]||0x3;this[_0xe357('0x19')]=_0x4bebc5[_0xe357('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x4bebc5[_0xe357('0x1a')]||0x3;this[_0xe357('0x1b')]=_0x4bebc5[_0xe357('0x1b')]||0x96;this[_0xe357('0x1c')]=_0x4bebc5[_0xe357('0x1c')]||0x3;this[_0xe357('0x1d')]=_0x4bebc5[_0xe357('0x1d')]||0x96;this['dialAgentRejectMaxRetry']=_0x4bebc5[_0xe357('0x1e')]||0x3;this[_0xe357('0x1f')]=_0x4bebc5[_0xe357('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x4bebc5[_0xe357('0x20')]||_0xe357('0x21');this[_0xe357('0x22')]=_0x4bebc5[_0xe357('0x22')]||undefined;this[_0xe357('0x23')]=_0x4bebc5[_0xe357('0x23')]||undefined;this[_0xe357('0x24')]=_0x4bebc5[_0xe357('0x24')]||undefined;this['TrunkBackup']=_0x4bebc5['TrunkBackup']?_0x4bebc5['TrunkBackup']:undefined;this[_0xe357('0x25')]=_0x4bebc5[_0xe357('0x25')]?_0x4bebc5[_0xe357('0x25')]:undefined;this[_0xe357('0x26')]=_0x4bebc5['Interval']?_0x4bebc5[_0xe357('0x26')]:undefined;this[_0xe357('0x27')]=_0x4bebc5[_0xe357('0x27')]?_0x4bebc5[_0xe357('0x27')]:undefined;this['dialQueueProject']=_0x4bebc5[_0xe357('0x27')]?_0x4bebc5[_0xe357('0x27')][_0xe357('0x0')]:undefined;this[_0xe357('0x28')]=_0x4bebc5[_0xe357('0x28')]||![];this[_0xe357('0x29')]=_0x4bebc5[_0xe357('0x29')];this[_0xe357('0x2a')]=_0x4bebc5[_0xe357('0x2a')];this['dialAMDAfterGreetingSilence']=_0x4bebc5[_0xe357('0x2b')];this[_0xe357('0x2c')]=_0x4bebc5['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4bebc5[_0xe357('0x2d')];this[_0xe357('0x2e')]=_0x4bebc5[_0xe357('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x4bebc5[_0xe357('0x2f')];this[_0xe357('0x30')]=_0x4bebc5[_0xe357('0x30')];this[_0xe357('0x31')]=_0x4bebc5['dialAMDMaximumWordLength'];}module[_0xe357('0x32')]=Campaign; \ No newline at end of file +var _0xe38d=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xe38d,0x1bd));var _0xde38=function(_0x21f332,_0x409070){_0x21f332=_0x21f332-0x0;var _0x1536bd=_0xe38d[_0x21f332];return _0x1536bd;};'use strict';function Campaign(_0x45ab69){this['id']=_0x45ab69['id']||0x0;this[_0xde38('0x0')]=_0x45ab69[_0xde38('0x0')]||'';this['type']=_0x45ab69['type']||_0xde38('0x1');this[_0xde38('0x2')]=0x0;this['temp']=0x0;this[_0xde38('0x3')]=0x0;this[_0xde38('0x4')]=0x0;this['message']='';this[_0xde38('0x5')]=!![];this['active']=_0x45ab69[_0xde38('0x6')];this[_0xde38('0x7')]=_0x45ab69[_0xde38('0x7')];this['dialTimezone']=_0x45ab69[_0xde38('0x8')]||null;this[_0xde38('0x9')]=_0x45ab69[_0xde38('0x9')]?_0x45ab69[_0xde38('0x9')]:null;this[_0xde38('0xa')]=_0x45ab69['dialOriginateCallerIdName'];this[_0xde38('0xb')]=_0x45ab69[_0xde38('0xb')];this['dialOriginateTimeout']=_0x45ab69[_0xde38('0xc')]||0x1e;this[_0xde38('0xd')]=_0x45ab69[_0xde38('0xd')];this[_0xde38('0xe')]=_0x45ab69[_0xde38('0xe')];this[_0xde38('0xf')]=_0x45ab69[_0xde38('0xf')];this[_0xde38('0x10')]=_0x45ab69[_0xde38('0x10')];this[_0xde38('0x11')]=_0x45ab69['dialNoAnswerMaxRetry'];this[_0xde38('0x12')]=_0x45ab69[_0xde38('0x12')];this['dialGlobalMaxRetry']=_0x45ab69['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x45ab69['dialNoSuchNumberMaxRetry']||0x3;this[_0xde38('0x13')]=_0x45ab69[_0xde38('0x13')]||0x96;this[_0xde38('0x14')]=_0x45ab69[_0xde38('0x14')]||0x3;this[_0xde38('0x15')]=_0x45ab69[_0xde38('0x15')]||0x96;this[_0xde38('0x16')]=_0x45ab69[_0xde38('0x16')]||0x3;this[_0xde38('0x17')]=_0x45ab69[_0xde38('0x17')]||0x96;this[_0xde38('0x18')]=_0x45ab69[_0xde38('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x45ab69[_0xde38('0x19')]||0x96;this[_0xde38('0x1a')]=_0x45ab69[_0xde38('0x1a')]||0x3;this[_0xde38('0x1b')]=_0x45ab69[_0xde38('0x1b')]||0x96;this[_0xde38('0x1c')]=_0x45ab69[_0xde38('0x1c')]||_0xde38('0x1d');this[_0xde38('0x1e')]=_0x45ab69[_0xde38('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x45ab69[_0xde38('0x1f')]||undefined;this[_0xde38('0x20')]=_0x45ab69[_0xde38('0x20')]||undefined;this[_0xde38('0x21')]=_0x45ab69[_0xde38('0x21')]?_0x45ab69['TrunkBackup']:undefined;this[_0xde38('0x22')]=_0x45ab69[_0xde38('0x22')]?_0x45ab69[_0xde38('0x22')]:undefined;this[_0xde38('0x23')]=_0x45ab69[_0xde38('0x23')]?_0x45ab69[_0xde38('0x23')]:undefined;this['SquareProject']=_0x45ab69[_0xde38('0x24')]?_0x45ab69['SquareProject']:undefined;this['dialQueueProject']=_0x45ab69['SquareProject']?_0x45ab69[_0xde38('0x24')][_0xde38('0x0')]:undefined;this[_0xde38('0x25')]=_0x45ab69[_0xde38('0x25')]||![];this[_0xde38('0x26')]=_0x45ab69[_0xde38('0x26')];this[_0xde38('0x27')]=_0x45ab69[_0xde38('0x27')];this[_0xde38('0x28')]=_0x45ab69[_0xde38('0x28')];this['dialAMDTotalAnalysisTime']=_0x45ab69[_0xde38('0x29')];this[_0xde38('0x2a')]=_0x45ab69[_0xde38('0x2a')];this[_0xde38('0x2b')]=_0x45ab69[_0xde38('0x2b')];this[_0xde38('0x2c')]=_0x45ab69[_0xde38('0x2c')];this['dialAMDSilenceThreshold']=_0x45ab69[_0xde38('0x2d')];this[_0xde38('0x2e')]=_0x45ab69[_0xde38('0x2e')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 116fc65..5476b3e 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 _0xe683=['calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','endtime','unmanaged','lastdata','duration','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x1c0dad,_0x430d03){var _0x42efa7=function(_0xa92943){while(--_0xa92943){_0x1c0dad['push'](_0x1c0dad['shift']());}};_0x42efa7(++_0x430d03);}(_0xe683,0x1d7));var _0x3e68=function(_0x533259,_0x1caf05){_0x533259=_0x533259-0x0;var _0x1a3fb7=_0xe683[_0x533259];return _0x1a3fb7;};'use strict';function Channel(){this[_0x3e68('0x0')]=null;this[_0x3e68('0x1')]='';this[_0x3e68('0x2')]='';this[_0x3e68('0x3')]=0x0;this[_0x3e68('0x4')]='';this[_0x3e68('0x5')]=undefined;this[_0x3e68('0x6')]=undefined;this[_0x3e68('0x7')]=0x0;this[_0x3e68('0x8')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x3e68('0x9')]=0x0;this[_0x3e68('0xa')]=![];this['answertime']=null;this[_0x3e68('0xb')]=null;this[_0x3e68('0xc')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x3e68('0xd')]='';this[_0x3e68('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3e68('0xf')]=null;this[_0x3e68('0x10')]=null;this['disposition']=null;this[_0x3e68('0x11')]=![];this[_0x3e68('0x12')]=null;this[_0x3e68('0x13')]=null;this[_0x3e68('0x14')]=[];this[_0x3e68('0x15')]=undefined;this[_0x3e68('0x16')]=undefined;this[_0x3e68('0x17')]=undefined;this['mohtime']=0x0;}module[_0x3e68('0x18')]=Channel; \ No newline at end of file +var _0x2884=['monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','linkedid','exten','answered','unmanaged','lastapplication','lastdata','billableseconds','holdtime','type'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0x2884,0x1eb));var _0x4288=function(_0x415b51,_0x1a29ee){_0x415b51=_0x415b51-0x0;var _0x1dd82c=_0x2884[_0x415b51];return _0x1dd82c;};'use strict';function Channel(){this[_0x4288('0x0')]=null;this['channel']='';this[_0x4288('0x1')]='';this[_0x4288('0x2')]=0x0;this[_0x4288('0x3')]='';this['connectedlinenum']=undefined;this[_0x4288('0x4')]=undefined;this[_0x4288('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x4288('0x6')]=0x0;this[_0x4288('0x7')]=0x0;this[_0x4288('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x4288('0x9')]=![];this['abandoned']=![];this[_0x4288('0xa')]='';this[_0x4288('0xb')]='';this['duration']=0x0;this[_0x4288('0xc')]=0x0;this[_0x4288('0xd')]=0x0;this[_0x4288('0xe')]=null;this['tag']=null;this['disposition']=null;this[_0x4288('0xf')]=![];this[_0x4288('0x10')]=null;this[_0x4288('0x11')]=null;this[_0x4288('0x12')]=[];this[_0x4288('0x13')]=undefined;this[_0x4288('0x14')]=undefined;this[_0x4288('0x15')]=undefined;this['mohtime']=0x0;}module[_0x4288('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 f0f52bf..9b0ace2 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 _0x936a=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x19d814,_0x176bb4){var _0x34e009=function(_0x159c77){while(--_0x159c77){_0x19d814['push'](_0x19d814['shift']());}};_0x34e009(++_0x176bb4);}(_0x936a,0x17e));var _0xa936=function(_0x1b4ef0,_0x41e144){_0x1b4ef0=_0x1b4ef0-0x0;var _0x3c851d=_0x936a[_0x1b4ef0];return _0x3c851d;};'use strict';function DeskAccount(_0x14f703){this['id']=_0x14f703['id']||0x0;this['name']=_0x14f703[_0xa936('0x0')]||'';this[_0xa936('0x1')]=_0x14f703[_0xa936('0x1')]||'';this[_0xa936('0x2')]=_0x14f703[_0xa936('0x2')]||'';this[_0xa936('0x3')]=_0x14f703[_0xa936('0x3')]||'';this[_0xa936('0x4')]=_0x14f703['password']||'';this[_0xa936('0x5')]=_0x14f703[_0xa936('0x5')]||'';this[_0xa936('0x6')]=_0x14f703[_0xa936('0x6')]||'';this[_0xa936('0x7')]=_0x14f703['token']||'';this[_0xa936('0x8')]=_0x14f703[_0xa936('0x8')]||'';this[_0xa936('0x9')]=_0x14f703[_0xa936('0x9')]||'';this[_0xa936('0xa')]=_0x14f703[_0xa936('0xa')]||'';this[_0xa936('0xb')]=_0x14f703[_0xa936('0xb')]||{};}module[_0xa936('0xc')]=DeskAccount; \ No newline at end of file +var _0x65b7=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x65b7,0x18b));var _0x765b=function(_0x5c5edf,_0x30cad6){_0x5c5edf=_0x5c5edf-0x0;var _0x4b83a9=_0x65b7[_0x5c5edf];return _0x4b83a9;};'use strict';function DeskAccount(_0x405ea5){this['id']=_0x405ea5['id']||0x0;this[_0x765b('0x0')]=_0x405ea5[_0x765b('0x0')]||'';this[_0x765b('0x1')]=_0x405ea5[_0x765b('0x1')]||'';this['remoteUri']=_0x405ea5[_0x765b('0x2')]||'';this[_0x765b('0x3')]=_0x405ea5[_0x765b('0x3')]||'';this[_0x765b('0x4')]=_0x405ea5[_0x765b('0x4')]||'';this[_0x765b('0x5')]=_0x405ea5[_0x765b('0x5')]||'';this[_0x765b('0x6')]=_0x405ea5['consumerSecret']||'';this[_0x765b('0x7')]=_0x405ea5[_0x765b('0x7')]||'';this[_0x765b('0x8')]=_0x405ea5[_0x765b('0x8')]||'';this['type']=_0x405ea5[_0x765b('0x9')]||'';this['serverUrl']=_0x405ea5['serverUrl']||'';this[_0x765b('0xa')]=_0x405ea5[_0x765b('0xa')]||{};}module[_0x765b('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 800e205..37bc0e8 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 _0xf7b5=['name','username','password','remoteUri','tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xf7b5,0x197));var _0x5f7b=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xf7b5[_0x2f3794];return _0x1c9fbe;};'use strict';function Dynamics365Account(_0x559a14){this['id']=_0x559a14['id']||0x0;this[_0x5f7b('0x0')]=_0x559a14[_0x5f7b('0x0')]||'';this[_0x5f7b('0x1')]=_0x559a14[_0x5f7b('0x1')]||'';this[_0x5f7b('0x2')]=_0x559a14['password']||'';this['remoteUri']=_0x559a14[_0x5f7b('0x3')]||'';this['tenantId']=_0x559a14[_0x5f7b('0x4')]||'';this[_0x5f7b('0x5')]=_0x559a14[_0x5f7b('0x5')]||'';this['clientSecret']=_0x559a14['clientSecret']||{};this[_0x5f7b('0x6')]=_0x559a14[_0x5f7b('0x6')]||'';this['modernAuthentication']=_0x559a14[_0x5f7b('0x7')]||![];this[_0x5f7b('0x8')]=_0x559a14['Configurations']||{};this[_0x5f7b('0x9')]=_0x559a14[_0x5f7b('0x9')]||{};}module[_0x5f7b('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x3f9e=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x339054,_0x2cb2b3){var _0x4560e9=function(_0x3cbe70){while(--_0x3cbe70){_0x339054['push'](_0x339054['shift']());}};_0x4560e9(++_0x2cb2b3);}(_0x3f9e,0xc8));var _0xe3f9=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0x3f9e[_0x34af74];return _0x12d74b;};'use strict';function Dynamics365Account(_0x459564){this['id']=_0x459564['id']||0x0;this['name']=_0x459564[_0xe3f9('0x0')]||'';this[_0xe3f9('0x1')]=_0x459564[_0xe3f9('0x1')]||'';this[_0xe3f9('0x2')]=_0x459564[_0xe3f9('0x2')]||'';this['remoteUri']=_0x459564[_0xe3f9('0x3')]||'';this[_0xe3f9('0x4')]=_0x459564[_0xe3f9('0x4')]||'';this['clientId']=_0x459564[_0xe3f9('0x5')]||'';this[_0xe3f9('0x6')]=_0x459564['clientSecret']||{};this['serverUrl']=_0x459564[_0xe3f9('0x7')]||'';this[_0xe3f9('0x8')]=_0x459564[_0xe3f9('0x8')]||![];this[_0xe3f9('0x9')]=_0x459564[_0xe3f9('0x9')]||{};this[_0xe3f9('0xa')]=_0x459564[_0xe3f9('0xa')]||{};}module[_0xe3f9('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a8bb8a7..66c1e8b 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 _0x9919=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem'];(function(_0x1a19dc,_0x2ce4e0){var _0x15c621=function(_0xbae736){while(--_0xbae736){_0x1a19dc['push'](_0x1a19dc['shift']());}};_0x15c621(++_0x2ce4e0);}(_0x9919,0x69));var _0x9991=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x9919[_0x519c88];return _0x4668d7;};'use strict';function FaxAccount(_0x21af18){this['id']=_0x21af18['id']||0x0;this[_0x9991('0x0')]=_0x21af18[_0x9991('0x0')]||'';this[_0x9991('0x1')]=_0x21af18[_0x9991('0x1')];this[_0x9991('0x2')]=_0x21af18[_0x9991('0x2')];this['headerinfo']=_0x21af18['headerinfo'];this[_0x9991('0x3')]=_0x21af18['localstationid'];this[_0x9991('0x4')]=_0x21af18[_0x9991('0x4')]||0x960;this[_0x9991('0x5')]=_0x21af18[_0x9991('0x5')]||0x3840;this[_0x9991('0x6')]=_0x21af18[_0x9991('0x6')]||'v17,v27,v29';this[_0x9991('0x7')]=_0x21af18[_0x9991('0x7')]||'no';this[_0x9991('0x8')]=_0x21af18['faxdetect']||'no';this[_0x9991('0x9')]=_0x21af18[_0x9991('0x9')]||0x1388;this[_0x9991('0xa')]=_0x21af18['tech']||_0x9991('0xb');this[_0x9991('0xc')]=_0x21af18[_0x9991('0xc')]?_0x21af18[_0x9991('0xc')]:undefined;this[_0x9991('0xd')]=_0x21af18[_0x9991('0xd')];this[_0x9991('0xe')]=_0x21af18[_0x9991('0xe')];}module[_0x9991('0xf')]=FaxAccount; \ No newline at end of file +var _0x9163=['SIP','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x44b2a4,_0x7e9f0d){var _0xe2786f=function(_0xbae807){while(--_0xbae807){_0x44b2a4['push'](_0x44b2a4['shift']());}};_0xe2786f(++_0x7e9f0d);}(_0x9163,0x8a));var _0x3916=function(_0x4995b5,_0x45b4eb){_0x4995b5=_0x4995b5-0x0;var _0x22050d=_0x9163[_0x4995b5];return _0x22050d;};'use strict';function FaxAccount(_0x1376af){this['id']=_0x1376af['id']||0x0;this[_0x3916('0x0')]=_0x1376af['name']||'';this['description']=_0x1376af[_0x3916('0x1')];this[_0x3916('0x2')]=_0x1376af[_0x3916('0x2')];this['headerinfo']=_0x1376af[_0x3916('0x3')];this[_0x3916('0x4')]=_0x1376af[_0x3916('0x4')];this['minrate']=_0x1376af[_0x3916('0x5')]||0x960;this[_0x3916('0x6')]=_0x1376af[_0x3916('0x6')]||0x3840;this[_0x3916('0x7')]=_0x1376af[_0x3916('0x7')]||'v17,v27,v29';this[_0x3916('0x8')]=_0x1376af[_0x3916('0x8')]||'no';this[_0x3916('0x9')]=_0x1376af[_0x3916('0x9')]||'no';this['t38timeout']=_0x1376af[_0x3916('0xa')]||0x1388;this[_0x3916('0xb')]=_0x1376af[_0x3916('0xb')]||_0x3916('0xc');this['Trunk']=_0x1376af['Trunk']?_0x1376af['Trunk']:undefined;this[_0x3916('0xd')]=_0x1376af[_0x3916('0xd')];this[_0x3916('0xe')]=_0x1376af[_0x3916('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index bddddd7..fa03ca5 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 _0x43c8=['Configurations','name','apiKey','token','remoteUri','serverUrl'];(function(_0x22c87a,_0x5681cc){var _0x29be08=function(_0x2b1cae){while(--_0x2b1cae){_0x22c87a['push'](_0x22c87a['shift']());}};_0x29be08(++_0x5681cc);}(_0x43c8,0x73));var _0x843c=function(_0x458727,_0x5d368c){_0x458727=_0x458727-0x0;var _0xe917d=_0x43c8[_0x458727];return _0xe917d;};'use strict';function FreshdeskAccount(_0x555ab3){this['id']=_0x555ab3['id']||0x0;this[_0x843c('0x0')]=_0x555ab3[_0x843c('0x0')]||'';this['username']=_0x555ab3['username']||'';this[_0x843c('0x1')]=_0x555ab3[_0x843c('0x2')]||'';this[_0x843c('0x3')]=_0x555ab3['remoteUri']||'';this['serverUrl']=_0x555ab3[_0x843c('0x4')]||'';this[_0x843c('0x5')]=_0x555ab3['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x577b=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0x577b,0x88));var _0xb577=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x577b[_0x432fca];return _0x3adba4;};'use strict';function FreshdeskAccount(_0x234418){this['id']=_0x234418['id']||0x0;this[_0xb577('0x0')]=_0x234418[_0xb577('0x0')]||'';this[_0xb577('0x1')]=_0x234418['username']||'';this[_0xb577('0x2')]=_0x234418['token']||'';this[_0xb577('0x3')]=_0x234418[_0xb577('0x3')]||'';this[_0xb577('0x4')]=_0x234418[_0xb577('0x4')]||'';this[_0xb577('0x5')]=_0x234418[_0xb577('0x5')]||{};}module[_0xb577('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e0cf527..70d46d8 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 _0x3a0f=['Configurations','name','apiKey','token','remoteUri','serverUrl'];(function(_0x45c7af,_0x1f9a61){var _0x414147=function(_0x46520d){while(--_0x46520d){_0x45c7af['push'](_0x45c7af['shift']());}};_0x414147(++_0x1f9a61);}(_0x3a0f,0x145));var _0xf3a0=function(_0x576f7a,_0x1e2dd1){_0x576f7a=_0x576f7a-0x0;var _0x533478=_0x3a0f[_0x576f7a];return _0x533478;};'use strict';function FreshsalesAccount(_0x6bb485){this['id']=_0x6bb485['id']||0x0;this['name']=_0x6bb485[_0xf3a0('0x0')]||'';this['username']=_0x6bb485['username']||'';this[_0xf3a0('0x1')]=_0x6bb485[_0xf3a0('0x2')]||'';this[_0xf3a0('0x3')]=_0x6bb485[_0xf3a0('0x3')]||'';this[_0xf3a0('0x4')]=_0x6bb485[_0xf3a0('0x4')]||'';this[_0xf3a0('0x5')]=_0x6bb485[_0xf3a0('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xc99e=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x22d941,_0x46f791){var _0x5bcdd0=function(_0x5c8e39){while(--_0x5c8e39){_0x22d941['push'](_0x22d941['shift']());}};_0x5bcdd0(++_0x46f791);}(_0xc99e,0x6e));var _0xec99=function(_0x271c0e,_0x2ff047){_0x271c0e=_0x271c0e-0x0;var _0x4d846a=_0xc99e[_0x271c0e];return _0x4d846a;};'use strict';function FreshsalesAccount(_0x3d87e9){this['id']=_0x3d87e9['id']||0x0;this[_0xec99('0x0')]=_0x3d87e9[_0xec99('0x0')]||'';this[_0xec99('0x1')]=_0x3d87e9[_0xec99('0x1')]||'';this[_0xec99('0x2')]=_0x3d87e9['token']||'';this[_0xec99('0x3')]=_0x3d87e9[_0xec99('0x3')]||'';this[_0xec99('0x4')]=_0x3d87e9[_0xec99('0x4')]||'';this[_0xec99('0x5')]=_0x3d87e9[_0xec99('0x5')]||{};}module[_0xec99('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3e4136a..ee6dde1 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 _0x9412=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','routealias','mohtime','variables','exports','inbound','uniqueid','queuecallerleaveAt','position','count'];(function(_0x120625,_0x38ed55){var _0x55dc01=function(_0x5d8b15){while(--_0x5d8b15){_0x120625['push'](_0x120625['shift']());}};_0x55dc01(++_0x38ed55);}(_0x9412,0x133));var _0x2941=function(_0x5d29d0,_0x4e46e3){_0x5d29d0=_0x5d29d0-0x0;var _0xb69951=_0x9412[_0x5d29d0];return _0xb69951;};'use strict';function QueueReport(){this['type']=_0x2941('0x0');this[_0x2941('0x1')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x2941('0x2')]=null;this[_0x2941('0x3')]=0x1;this[_0x2941('0x4')]=0x1;this[_0x2941('0x5')]=![];this[_0x2941('0x6')]=null;this[_0x2941('0x7')]=![];this[_0x2941('0x8')]=null;this[_0x2941('0x9')]=![];this['queuecallerexitAt']=null;this[_0x2941('0xa')]=0x1;this[_0x2941('0xb')]='';this[_0x2941('0xc')]='';this[_0x2941('0xd')]='';this['accountcode']='';this[_0x2941('0xe')]='';this[_0x2941('0xf')]='';this[_0x2941('0x10')]='';this[_0x2941('0x11')]=0x0;this[_0x2941('0x12')]=![];this['lastAssignedTo']='';this[_0x2941('0x13')]='voice';this[_0x2941('0x14')]=null;this[_0x2941('0x15')]=0x0;this[_0x2941('0x16')]={};}module[_0x2941('0x17')]=QueueReport; \ No newline at end of file +var _0xdb1d=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','voice','routealias','mohtime','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xb25301,_0x13cec1){var _0x26b05d=function(_0x39ff36){while(--_0x39ff36){_0xb25301['push'](_0xb25301['shift']());}};_0x26b05d(++_0x13cec1);}(_0xdb1d,0x91));var _0xddb1=function(_0x1e8240,_0x277664){_0x1e8240=_0x1e8240-0x0;var _0x3d7948=_0xdb1d[_0x1e8240];return _0x3d7948;};'use strict';function QueueReport(){this[_0xddb1('0x0')]='inbound';this[_0xddb1('0x1')]='';this[_0xddb1('0x2')]='';this[_0xddb1('0x3')]='';this[_0xddb1('0x4')]='';this['queuecallerjoinAt']=null;this[_0xddb1('0x5')]=null;this['position']=0x1;this[_0xddb1('0x6')]=0x1;this[_0xddb1('0x7')]=![];this[_0xddb1('0x8')]=null;this[_0xddb1('0x9')]=![];this[_0xddb1('0xa')]=null;this[_0xddb1('0xb')]=![];this[_0xddb1('0xc')]=null;this[_0xddb1('0xd')]=0x1;this[_0xddb1('0xe')]='';this[_0xddb1('0xf')]='';this[_0xddb1('0x10')]='';this[_0xddb1('0x11')]='';this[_0xddb1('0x12')]='';this[_0xddb1('0x13')]='';this[_0xddb1('0x14')]='';this[_0xddb1('0x15')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['motionChannel']=_0xddb1('0x16');this[_0xddb1('0x17')]=null;this[_0xddb1('0x18')]=0x0;this['variables']={};}module[_0xddb1('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b88ee91..dcbb3b6 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 _0xea0f=['type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xea0f,0x73));var _0xfea0=function(_0x2330d8,_0x48ee0c){_0x2330d8=_0x2330d8-0x0;var _0x4e363d=_0xea0f[_0x2330d8];return _0x4e363d;};'use strict';function SalesforceAccount(_0x455bfa){this['id']=_0x455bfa['id']||0x0;this[_0xfea0('0x0')]=_0x455bfa[_0xfea0('0x0')]||'';this['username']=_0x455bfa['username']||'';this[_0xfea0('0x1')]=_0x455bfa[_0xfea0('0x1')]||'';this[_0xfea0('0x2')]=_0x455bfa['password']||'';this['clientId']=_0x455bfa[_0xfea0('0x3')]||'';this[_0xfea0('0x4')]=_0x455bfa[_0xfea0('0x4')]||'';this[_0xfea0('0x5')]=_0x455bfa['securityToken']||'';this[_0xfea0('0x6')]=_0x455bfa['type']||_0xfea0('0x7');this[_0xfea0('0x8')]=_0x455bfa[_0xfea0('0x8')]||'';this[_0xfea0('0x9')]=_0x455bfa[_0xfea0('0x9')]||{};}module[_0xfea0('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xc401=['username','remoteUri','password','clientId','clientSecret','type','serverUrl','Configurations','exports','name'];(function(_0x2852d4,_0x175abb){var _0x2415d2=function(_0x1d96eb){while(--_0x1d96eb){_0x2852d4['push'](_0x2852d4['shift']());}};_0x2415d2(++_0x175abb);}(_0xc401,0x15d));var _0x1c40=function(_0x48cb39,_0x505b4c){_0x48cb39=_0x48cb39-0x0;var _0x49a2c5=_0xc401[_0x48cb39];return _0x49a2c5;};'use strict';function SalesforceAccount(_0x2aa026){this['id']=_0x2aa026['id']||0x0;this[_0x1c40('0x0')]=_0x2aa026[_0x1c40('0x0')]||'';this[_0x1c40('0x1')]=_0x2aa026[_0x1c40('0x1')]||'';this[_0x1c40('0x2')]=_0x2aa026[_0x1c40('0x2')]||'';this[_0x1c40('0x3')]=_0x2aa026[_0x1c40('0x3')]||'';this[_0x1c40('0x4')]=_0x2aa026['clientId']||'';this[_0x1c40('0x5')]=_0x2aa026[_0x1c40('0x5')]||'';this['securityToken']=_0x2aa026['securityToken']||'';this[_0x1c40('0x6')]=_0x2aa026[_0x1c40('0x6')]||'integrationTab';this[_0x1c40('0x7')]=_0x2aa026[_0x1c40('0x7')]||'';this['Configurations']=_0x2aa026[_0x1c40('0x8')]||{};}module[_0x1c40('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e4085a0..be46ebf 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 _0x0f7d=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x0f7d,0xd7));var _0xd0f7=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0x0f7d[_0x5466e0];return _0xf32c89;};'use strict';function ServicenowAccount(_0x4b5648){this['id']=_0x4b5648['id']||0x0;this['name']=_0x4b5648[_0xd0f7('0x0')]||'';this[_0xd0f7('0x1')]=_0x4b5648[_0xd0f7('0x1')]||'';this[_0xd0f7('0x2')]=_0x4b5648[_0xd0f7('0x2')]||'';this[_0xd0f7('0x3')]=_0x4b5648['remoteUri']||'';this[_0xd0f7('0x4')]=_0x4b5648['serverUrl']||'';this['Configurations']=_0x4b5648[_0xd0f7('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x33cd=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33cd,0xce));var _0xd33c=function(_0x3f7a28,_0x446e8b){_0x3f7a28=_0x3f7a28-0x0;var _0x5e3042=_0x33cd[_0x3f7a28];return _0x5e3042;};'use strict';function ServicenowAccount(_0xcbce46){this['id']=_0xcbce46['id']||0x0;this['name']=_0xcbce46[_0xd33c('0x0')]||'';this['username']=_0xcbce46[_0xd33c('0x1')]||'';this[_0xd33c('0x2')]=_0xcbce46[_0xd33c('0x2')]||'';this['remoteUri']=_0xcbce46[_0xd33c('0x3')]||'';this['serverUrl']=_0xcbce46[_0xd33c('0x4')]||'';this[_0xd33c('0x5')]=_0xcbce46[_0xd33c('0x5')]||{};}module[_0xd33c('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 4ccd153..f82c402 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 _0x6636=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5cc5eb,_0x14c888){var _0x27b727=function(_0x5a5940){while(--_0x5a5940){_0x5cc5eb['push'](_0x5cc5eb['shift']());}};_0x27b727(++_0x14c888);}(_0x6636,0x16b));var _0x6663=function(_0x325e67,_0x7d41f9){_0x325e67=_0x325e67-0x0;var _0x296615=_0x6636[_0x325e67];return _0x296615;};'use strict';function SugarcrmAccount(_0x35b47b){this['id']=_0x35b47b['id']||0x0;this[_0x6663('0x0')]=_0x35b47b['name']||'';this[_0x6663('0x1')]=_0x35b47b['username']||'';this[_0x6663('0x2')]=_0x35b47b['password']||'';this['remoteUri']=_0x35b47b[_0x6663('0x3')]||'';this[_0x6663('0x4')]=_0x35b47b[_0x6663('0x4')]||'';this['Configurations']=_0x35b47b[_0x6663('0x5')]||{};}module[_0x6663('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xbc1b=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbc1b,0x1e3));var _0xbbc1=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xbc1b[_0x22868f];return _0x97bc75;};'use strict';function SugarcrmAccount(_0x2398b0){this['id']=_0x2398b0['id']||0x0;this[_0xbbc1('0x0')]=_0x2398b0[_0xbbc1('0x0')]||'';this[_0xbbc1('0x1')]=_0x2398b0[_0xbbc1('0x1')]||'';this[_0xbbc1('0x2')]=_0x2398b0[_0xbbc1('0x2')]||'';this[_0xbbc1('0x3')]=_0x2398b0[_0xbbc1('0x3')]||'';this[_0xbbc1('0x4')]=_0x2398b0['serverUrl']||'';this[_0xbbc1('0x5')]=_0x2398b0['Configurations']||{};}module[_0xbbc1('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 6c83d31..b604ec2 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 _0x5d99=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x5d99,0x150));var _0x95d9=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x5d99[_0x5a92ad];return _0x2466f8;};'use strict';function Telephone(_0x3b6713){this['id']=_0x3b6713['id']||0x0;this[_0x95d9('0x0')]=_0x3b6713[_0x95d9('0x0')]||'';this[_0x95d9('0x1')]=_0x3b6713[_0x95d9('0x1')]||'';this[_0x95d9('0x2')]=_0x95d9('0x3');this[_0x95d9('0x4')]=0x0;this[_0x95d9('0x5')]=_0x95d9('0x3');this[_0x95d9('0x6')]='';}module[_0x95d9('0x7')]=Telephone; \ No newline at end of file +var _0xf6f6=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xf6f6,0x15e));var _0x6f6f=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xf6f6[_0x3e6b2f];return _0x323215;};'use strict';function Telephone(_0x586bbc){this['id']=_0x586bbc['id']||0x0;this['name']=_0x586bbc[_0x6f6f('0x0')]||'';this[_0x6f6f('0x1')]=_0x586bbc[_0x6f6f('0x1')]||'';this[_0x6f6f('0x2')]=_0x6f6f('0x3');this[_0x6f6f('0x4')]=0x0;this[_0x6f6f('0x5')]='unknown';this[_0x6f6f('0x6')]='';}module[_0x6f6f('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 6539446..b77e14a 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x14ad80,_0x14e853){var _0x3ee434=function(_0x280921){while(--_0x280921){_0x14ad80['push'](_0x14ad80['shift']());}};_0x3ee434(++_0x14e853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0xfe2327,_0x3667dd){var _0x880f87=function(_0x1b5c24){while(--_0x1b5c24){_0xfe2327['push'](_0xfe2327['shift']());}};_0x880f87(++_0x3667dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x38add1,_0x44b935){_0x38add1=_0x38add1-0x0;var _0x234c6f=_0xb10b[_0x38add1];return _0x234c6f;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5804761..5bb6c21 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3176bf,_0x4e6834){var _0x355328=function(_0x27ae38){while(--_0x27ae38){_0x3176bf['push'](_0x3176bf['shift']());}};_0x355328(++_0x4e6834);}(_0x8603,0x190));var _0x3860=function(_0x9c6c7d,_0x2d8484){_0x9c6c7d=_0x9c6c7d-0x0;var _0x433f1e=_0x8603[_0x9c6c7d];return _0x433f1e;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3eebec,_0x16bed1){var _0x4ebdb7=function(_0x584bd2){while(--_0x584bd2){_0x3eebec['push'](_0x3eebec['shift']());}};_0x4ebdb7(++_0x16bed1);}(_0x4fc2,0x111));var _0x24fc=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0x4fc2[_0x32a22d];return _0x302d10;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 29b006b..4d6ef2d 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 _0x5e34=['defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','split','port','domain','domainport','refresh','address'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5e34,0xb8));var _0x45e3=function(_0x247c9a,_0x37da12){_0x247c9a=_0x247c9a-0x0;var _0x29cf01=_0x5e34[_0x247c9a];return _0x29cf01;};'use strict';function Trunk(_0x21cee4){this['id']=_0x21cee4['id']||0x0;this['active']=_0x21cee4[_0x45e3('0x0')]||![];this['name']=_0x21cee4[_0x45e3('0x1')]||'';this['state']=_0x45e3('0x2');this[_0x45e3('0x3')]=0x0;this['status']=_0x45e3('0x2');this[_0x45e3('0x4')]=_0x21cee4[_0x45e3('0x4')]&&_0x21cee4[_0x45e3('0x4')][_0x45e3('0x5')](':')?_0x21cee4[_0x45e3('0x4')][_0x45e3('0x6')](':')[0x0]:'';this['host']='';this[_0x45e3('0x7')]='';this[_0x45e3('0x8')]='';this[_0x45e3('0x9')]='';this[_0x45e3('0xa')]='';this['stateRegistry']=_0x45e3('0x2');this['registrationtime']='';this[_0x45e3('0xb')]='';this[_0x45e3('0xc')]=_0x21cee4['defaultuser']||'';}module[_0x45e3('0xd')]=Trunk; \ No newline at end of file +var _0x572e=['domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','registry','split','host','port','domain'];(function(_0x3cffaf,_0x2d1111){var _0x5e4fd3=function(_0x3c4b8e){while(--_0x3c4b8e){_0x3cffaf['push'](_0x3cffaf['shift']());}};_0x5e4fd3(++_0x2d1111);}(_0x572e,0x1d7));var _0xe572=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x572e[_0x220dbb];return _0x2b77de;};'use strict';function Trunk(_0x565302){this['id']=_0x565302['id']||0x0;this[_0xe572('0x0')]=_0x565302[_0xe572('0x0')]||![];this['name']=_0x565302[_0xe572('0x1')]||'';this[_0xe572('0x2')]=_0xe572('0x3');this['stateTime']=0x0;this['status']=_0xe572('0x3');this[_0xe572('0x4')]=_0x565302[_0xe572('0x4')]&&_0x565302[_0xe572('0x4')]['indexOf'](':')?_0x565302['registry'][_0xe572('0x5')](':')[0x0]:'';this[_0xe572('0x6')]='';this[_0xe572('0x7')]='';this[_0xe572('0x8')]='';this[_0xe572('0x9')]='';this[_0xe572('0xa')]='';this[_0xe572('0xb')]=_0xe572('0x3');this[_0xe572('0xc')]='';this['address']='';this[_0xe572('0xd')]=_0x565302[_0xe572('0xd')]||'';}module[_0xe572('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bdb6afb..bb53263 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 _0xb619=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x1096f8,_0x11e492){var _0x59374f=function(_0x4496b4){while(--_0x4496b4){_0x1096f8['push'](_0x1096f8['shift']());}};_0x59374f(++_0x11e492);}(_0xb619,0x9c));var _0x9b61=function(_0x453b68,_0x30a13b){_0x453b68=_0x453b68-0x0;var _0x3aaa27=_0xb619[_0x453b68];return _0x3aaa27;};'use strict';function voiceExtension(_0x3723fb){this['id']=_0x3723fb['id']||0x0;this['exten']=_0x3723fb[_0x9b61('0x0')]||'';this['recordingFormat']=_0x3723fb[_0x9b61('0x1')]||'none';this[_0x9b61('0x2')]=_0x3723fb[_0x9b61('0x2')]||![];}module[_0x9b61('0x3')]=voiceExtension; \ No newline at end of file +var _0x59c2=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x59c2,0xff));var _0x259c=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x59c2[_0x1b828b];return _0x98da1a;};'use strict';function voiceExtension(_0x2bf995){this['id']=_0x2bf995['id']||0x0;this[_0x259c('0x0')]=_0x2bf995[_0x259c('0x0')]||'';this[_0x259c('0x1')]=_0x2bf995[_0x259c('0x1')]||_0x259c('0x2');this[_0x259c('0x3')]=_0x2bf995[_0x259c('0x3')]||![];}module[_0x259c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 3f348ef..46c99ba 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 _0xda2d=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0xda2d,0xb3));var _0xdda2=function(_0x2ed58b,_0x2a6b9d){_0x2ed58b=_0x2ed58b-0x0;var _0x1b0211=_0xda2d[_0x2ed58b];return _0x1b0211;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xdda2('0x0'),'gsm':_0xdda2('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xdda2('0x2'),'linear':'linear','random':_0xdda2('0x3'),'ringall':'ringall','rr':_0xdda2('0x4'),'rrmemory':_0xdda2('0x5'),'rrordered':_0xdda2('0x6'),'wrandom':_0xdda2('0x7')};function VoiceQueue(_0x3205a7){this['id']=_0x3205a7['id']||0x0;this['name']=_0x3205a7[_0xdda2('0x8')]||'';this[_0xdda2('0x9')]=_0x3205a7[_0xdda2('0x9')]||'';this[_0xdda2('0xa')]=_0x3205a7['type']||'inbound';this[_0xdda2('0xb')]=0x0;this[_0xdda2('0xc')]=0x0;this[_0xdda2('0xd')]=0x0;this[_0xdda2('0xe')]=0x0;this[_0xdda2('0xf')]=0x0;this[_0xdda2('0x10')]=0x0;this[_0xdda2('0x11')]=0x0;this[_0xdda2('0x12')]=0x0;this[_0xdda2('0x13')]=0x0;this['busy']=0x0;this[_0xdda2('0x14')]=0x0;this[_0xdda2('0x15')]=0x0;this['loggedIn']=0x0;this[_0xdda2('0x16')]=0x0;this[_0xdda2('0x17')]=0x0;this[_0xdda2('0x18')]=0x0;this[_0xdda2('0x19')]=0x0;this[_0xdda2('0x1a')]=0x0;this[_0xdda2('0x1b')]=0x0;this[_0xdda2('0x1c')]=0x0;this['unknown']=0x0;this[_0xdda2('0x1d')]=_0x3205a7[_0xdda2('0x1d')]||![];this['acwTimeout']=_0x3205a7[_0xdda2('0x1e')]||0xa;this[_0xdda2('0x1f')]=_0x3205a7[_0xdda2('0x1f')]||'no';this[_0xdda2('0x20')]=!![];this[_0xdda2('0x21')]='';this[_0xdda2('0x22')]='';this[_0xdda2('0x23')]=0x0;this[_0xdda2('0x24')]=0x0;this['dialTimezone']=_0x3205a7[_0xdda2('0x25')]||null;this['dialGlobalInterval']=_0x3205a7[_0xdda2('0x26')]?_0x3205a7['dialGlobalInterval']:null;this[_0xdda2('0x27')]=_0x3205a7[_0xdda2('0x27')];this[_0xdda2('0x28')]=_0x3205a7[_0xdda2('0x28')]||_0xdda2('0x29');this['dialLimitChannel']=_0x3205a7[_0xdda2('0x2a')]||0x0;this['dialLimitQueue']=_0x3205a7[_0xdda2('0x2b')]||0x0;this[_0xdda2('0x2c')]=_0x3205a7[_0xdda2('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x3205a7['dialPredictiveOptimization']||_0xdda2('0x2d');this[_0xdda2('0x2e')]=_0x3205a7['dialPredictiveOptimizationPercentage']||0.03;this[_0xdda2('0x2f')]=_0x3205a7[_0xdda2('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x3205a7['dialOriginateCallerIdName']||'anonymous';this[_0xdda2('0x30')]=_0x3205a7[_0xdda2('0x30')]||_0xdda2('0x31');this[_0xdda2('0x32')]=_0x3205a7[_0xdda2('0x32')]||0x1e;this['dialQueueOptions']=_0x3205a7[_0xdda2('0x33')]||'tTxX';this[_0xdda2('0x34')]=_0x3205a7[_0xdda2('0x34')]||0x3;this[_0xdda2('0x35')]=_0x3205a7[_0xdda2('0x35')]||undefined;this[_0xdda2('0x36')]=_0x3205a7[_0xdda2('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x3205a7[_0xdda2('0x37')]||0x96;this[_0xdda2('0x38')]=_0x3205a7[_0xdda2('0x38')]||0x3;this['dialBusyRetryFrequency']=_0x3205a7[_0xdda2('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x3205a7['dialNoAnswerMaxRetry']||0x3;this[_0xdda2('0x3a')]=_0x3205a7[_0xdda2('0x3a')]||0x96;this[_0xdda2('0x3b')]=_0x3205a7[_0xdda2('0x3b')]||0x3;this[_0xdda2('0x3c')]=_0x3205a7['dialNoSuchNumberRetryFrequency']||0x96;this[_0xdda2('0x3d')]=_0x3205a7[_0xdda2('0x3d')]||0x3;this[_0xdda2('0x3e')]=_0x3205a7[_0xdda2('0x3e')]||0x96;this[_0xdda2('0x3f')]=_0x3205a7[_0xdda2('0x3f')]||0x3;this[_0xdda2('0x40')]=_0x3205a7[_0xdda2('0x40')]||0x96;this[_0xdda2('0x41')]=_0x3205a7[_0xdda2('0x41')]||0x3;this['dialMachineRetryFrequency']=_0x3205a7[_0xdda2('0x42')]||0x96;this[_0xdda2('0x43')]=_0x3205a7['dialAgentRejectMaxRetry']||0x3;this[_0xdda2('0x44')]=_0x3205a7[_0xdda2('0x44')]||0x96;this[_0xdda2('0x45')]=_0x3205a7[_0xdda2('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x3205a7[_0xdda2('0x46')]||0x4;this[_0xdda2('0x47')]=_0x3205a7[_0xdda2('0x47')]?_0x3205a7['Trunk']:undefined;this[_0xdda2('0x48')]=_0x3205a7['TrunkBackup']?_0x3205a7[_0xdda2('0x48')]:undefined;this['dialPrefix']=_0x3205a7[_0xdda2('0x49')]||undefined;this[_0xdda2('0x4a')]=_0x3205a7['Interval']?_0x3205a7['Interval']:undefined;this[_0xdda2('0x4b')]=_0x3205a7[_0xdda2('0x4b')]||'DESC';this[_0xdda2('0x4c')]=_0x3205a7[_0xdda2('0x4c')]||undefined;this[_0xdda2('0x4d')]=_0x3205a7[_0xdda2('0x4d')]||undefined;this[_0xdda2('0x4e')]=strategy[_0x3205a7[_0xdda2('0x4e')]];this[_0xdda2('0x4f')]=!![];this[_0xdda2('0x50')]=_0x3205a7['dialAMDActive']||![];this[_0xdda2('0x51')]=_0x3205a7[_0xdda2('0x51')];this[_0xdda2('0x52')]=_0x3205a7[_0xdda2('0x52')];this[_0xdda2('0x53')]=_0x3205a7[_0xdda2('0x53')];this[_0xdda2('0x54')]=_0x3205a7[_0xdda2('0x54')];this[_0xdda2('0x55')]=_0x3205a7[_0xdda2('0x55')];this[_0xdda2('0x56')]=_0x3205a7[_0xdda2('0x56')];this['dialAMDMaximumNumberOfWords']=_0x3205a7[_0xdda2('0x57')];this['dialAMDSilenceThreshold']=_0x3205a7[_0xdda2('0x58')];this[_0xdda2('0x59')]=_0x3205a7[_0xdda2('0x59')];this[_0xdda2('0x5a')]=0x0;this[_0xdda2('0x5b')]=0x0;this[_0xdda2('0x5c')]=_0x3205a7[_0xdda2('0x5c')];this[_0xdda2('0x5d')]=0x0;this[_0xdda2('0x5e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xdda2('0x5f')]=0x0;this[_0xdda2('0x60')]=0x0;this[_0xdda2('0x61')]=0x0;this[_0xdda2('0x62')]=0x0;this[_0xdda2('0x63')]=0x0;this[_0xdda2('0x64')]=0x0;this[_0xdda2('0x65')]=0x0;this[_0xdda2('0x66')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xdda2('0x67')]=0x0;this[_0xdda2('0x68')]=0x0;this[_0xdda2('0x69')]=undefined;this[_0xdda2('0x6a')]=undefined;this[_0xdda2('0x6b')]=undefined;this[_0xdda2('0x6c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xdda2('0x6d')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xdda2('0x6e')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xdda2('0x6f')]=0x0;this[_0xdda2('0x70')]=_0x3205a7[_0xdda2('0x71')]||0x14;this[_0xdda2('0x72')]=_0x3205a7[_0xdda2('0x71')]||0xa;this[_0xdda2('0x73')]=0x0;this[_0xdda2('0x74')]=0x0;this[_0xdda2('0x75')]=0x1;this['erlangCalls']=0x0;this[_0xdda2('0x76')]=0x0;this[_0xdda2('0x77')]=0x0;this[_0xdda2('0x78')]=0x0;this['dialRecallMeTimeout']=_0x3205a7[_0xdda2('0x79')]||0x1e;this[_0xdda2('0x7a')]=_0x3205a7[_0xdda2('0x7a')]||![];this[_0xdda2('0x7b')]=!!_0x3205a7['dialPreviewAutoRecallMe']||![];this[_0xdda2('0x7c')]=!!_0x3205a7[_0xdda2('0x7c')]||![];this['dialQueueProject2']=_0x3205a7['dialQueueProject2']||undefined;this[_0xdda2('0x7d')]=_0x3205a7[_0xdda2('0x7d')]||![];this[_0xdda2('0x7e')]=_0x3205a7[_0xdda2('0x7e')]||![];this[_0xdda2('0x9')]=monitorFormat[_0x3205a7[_0xdda2('0x9')]]?monitorFormat[_0x3205a7[_0xdda2('0x9')]]:undefined;this[_0xdda2('0x7f')]=_0x3205a7[_0xdda2('0x7f')]||![];this[_0xdda2('0x80')]=_0x3205a7[_0xdda2('0x80')]?_0x3205a7[_0xdda2('0x80')]:undefined;this[_0xdda2('0x81')]=![];}module[_0xdda2('0x82')]=VoiceQueue; \ No newline at end of file +var _0xf88f=['dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xf88f,0x1bb));var _0xff88=function(_0x139ea8,_0x3faf65){_0x139ea8=_0x139ea8-0x0;var _0x165231=_0xf88f[_0x139ea8];return _0x165231;};'use strict';var monitorFormat={'wav':_0xff88('0x0'),'wav49':_0xff88('0x1'),'gsm':_0xff88('0x2')};var strategy={'fewestcalls':_0xff88('0x3'),'leastrecent':_0xff88('0x4'),'linear':_0xff88('0x5'),'random':_0xff88('0x6'),'ringall':'ringall','rr':_0xff88('0x7'),'rrmemory':_0xff88('0x8'),'rrordered':_0xff88('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x38e1df){this['id']=_0x38e1df['id']||0x0;this[_0xff88('0xa')]=_0x38e1df[_0xff88('0xa')]||'';this[_0xff88('0xb')]=_0x38e1df[_0xff88('0xb')]||'';this[_0xff88('0xc')]=_0x38e1df['type']||_0xff88('0xd');this[_0xff88('0xe')]=0x0;this[_0xff88('0xf')]=0x0;this[_0xff88('0x10')]=0x0;this[_0xff88('0x11')]=0x0;this[_0xff88('0x12')]=0x0;this[_0xff88('0x13')]=0x0;this[_0xff88('0x14')]=0x0;this[_0xff88('0x15')]=0x0;this[_0xff88('0x16')]=0x0;this[_0xff88('0x17')]=0x0;this[_0xff88('0x18')]=0x0;this[_0xff88('0x19')]=0x0;this[_0xff88('0x1a')]=0x0;this[_0xff88('0x1b')]=0x0;this['onHold']=0x0;this[_0xff88('0x1c')]=0x0;this[_0xff88('0x1d')]=0x0;this[_0xff88('0x1e')]=0x0;this['talking']=0x0;this[_0xff88('0x1f')]=0x0;this[_0xff88('0x20')]=0x0;this[_0xff88('0x21')]=_0x38e1df[_0xff88('0x21')]||![];this[_0xff88('0x22')]=_0x38e1df[_0xff88('0x22')]||0xa;this[_0xff88('0x23')]=_0x38e1df[_0xff88('0x23')]||'no';this['sendMessageOneNotActive']=!![];this[_0xff88('0x24')]='';this[_0xff88('0x25')]='';this['originated']=0x0;this['temp']=0x0;this[_0xff88('0x26')]=_0x38e1df[_0xff88('0x26')]||null;this['dialGlobalInterval']=_0x38e1df[_0xff88('0x27')]?_0x38e1df[_0xff88('0x27')]:null;this['dialActive']=_0x38e1df[_0xff88('0x28')];this[_0xff88('0x29')]=_0x38e1df[_0xff88('0x29')]||_0xff88('0x2a');this[_0xff88('0x2b')]=_0x38e1df[_0xff88('0x2b')]||0x0;this[_0xff88('0x2c')]=_0x38e1df['dialLimitQueue']||0x0;this[_0xff88('0x2d')]=_0x38e1df[_0xff88('0x2d')]||0x1;this[_0xff88('0x2e')]=_0x38e1df[_0xff88('0x2e')]||_0xff88('0x2f');this[_0xff88('0x30')]=_0x38e1df['dialPredictiveOptimizationPercentage']||0.03;this[_0xff88('0x31')]=_0x38e1df[_0xff88('0x31')]||0x258;this[_0xff88('0x32')]=_0x38e1df[_0xff88('0x32')]||_0xff88('0x33');this[_0xff88('0x34')]=_0x38e1df[_0xff88('0x34')]||'anonymous';this[_0xff88('0x35')]=_0x38e1df[_0xff88('0x35')]||0x1e;this['dialQueueOptions']=_0x38e1df[_0xff88('0x36')]||_0xff88('0x37');this[_0xff88('0x38')]=_0x38e1df['dialQueueTimeout']||0x3;this[_0xff88('0x39')]=_0x38e1df[_0xff88('0x39')]||undefined;this['dialCongestionMaxRetry']=_0x38e1df[_0xff88('0x3a')]||0x3;this[_0xff88('0x3b')]=_0x38e1df['dialCongestionRetryFrequency']||0x96;this[_0xff88('0x3c')]=_0x38e1df[_0xff88('0x3c')]||0x3;this[_0xff88('0x3d')]=_0x38e1df[_0xff88('0x3d')]||0x96;this[_0xff88('0x3e')]=_0x38e1df[_0xff88('0x3e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x38e1df[_0xff88('0x3f')]||0x96;this[_0xff88('0x40')]=_0x38e1df['dialNoSuchNumberMaxRetry']||0x3;this[_0xff88('0x41')]=_0x38e1df[_0xff88('0x41')]||0x96;this[_0xff88('0x42')]=_0x38e1df[_0xff88('0x42')]||0x3;this[_0xff88('0x43')]=_0x38e1df[_0xff88('0x43')]||0x96;this['dialAbandonedMaxRetry']=_0x38e1df[_0xff88('0x44')]||0x3;this[_0xff88('0x45')]=_0x38e1df[_0xff88('0x45')]||0x96;this['dialMachineMaxRetry']=_0x38e1df[_0xff88('0x46')]||0x3;this[_0xff88('0x47')]=_0x38e1df[_0xff88('0x47')]||0x96;this['dialAgentRejectMaxRetry']=_0x38e1df['dialAgentRejectMaxRetry']||0x3;this[_0xff88('0x48')]=_0x38e1df[_0xff88('0x48')]||0x96;this[_0xff88('0x49')]=_0x38e1df[_0xff88('0x49')]||0x3;this[_0xff88('0x4a')]=_0x38e1df[_0xff88('0x4a')]||0x4;this[_0xff88('0x4b')]=_0x38e1df[_0xff88('0x4b')]?_0x38e1df[_0xff88('0x4b')]:undefined;this[_0xff88('0x4c')]=_0x38e1df[_0xff88('0x4c')]?_0x38e1df['TrunkBackup']:undefined;this[_0xff88('0x4d')]=_0x38e1df['dialPrefix']||undefined;this[_0xff88('0x4e')]=_0x38e1df[_0xff88('0x4e')]?_0x38e1df['Interval']:undefined;this[_0xff88('0x4f')]=_0x38e1df[_0xff88('0x4f')]||_0xff88('0x50');this['dialRandomLastDigitCallerIdNumber']=_0x38e1df[_0xff88('0x51')]||undefined;this[_0xff88('0x52')]=_0x38e1df[_0xff88('0x52')]||undefined;this[_0xff88('0x53')]=strategy[_0x38e1df[_0xff88('0x53')]];this[_0xff88('0x54')]=!![];this[_0xff88('0x55')]=_0x38e1df[_0xff88('0x55')]||![];this[_0xff88('0x56')]=_0x38e1df[_0xff88('0x56')];this['dialAMDGreeting']=_0x38e1df['dialAMDGreeting'];this[_0xff88('0x57')]=_0x38e1df[_0xff88('0x57')];this[_0xff88('0x58')]=_0x38e1df[_0xff88('0x58')];this['dialAMDMinWordLength']=_0x38e1df[_0xff88('0x59')];this[_0xff88('0x5a')]=_0x38e1df[_0xff88('0x5a')];this[_0xff88('0x5b')]=_0x38e1df[_0xff88('0x5b')];this[_0xff88('0x5c')]=_0x38e1df[_0xff88('0x5c')];this[_0xff88('0x5d')]=_0x38e1df['dialAMDMaximumWordLength'];this[_0xff88('0x5e')]=0x0;this['pTalking']=0x0;this[_0xff88('0x5f')]=_0x38e1df[_0xff88('0x5f')];this[_0xff88('0x60')]=0x0;this[_0xff88('0x61')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xff88('0x62')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xff88('0x63')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xff88('0x64')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xff88('0x65')]=0x0;this[_0xff88('0x66')]=0x0;this[_0xff88('0x67')]=0x0;this[_0xff88('0x68')]=0x0;this[_0xff88('0x69')]=0x0;this[_0xff88('0x6a')]=undefined;this['startPredictive']=undefined;this[_0xff88('0x6b')]=undefined;this[_0xff88('0x6c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xff88('0x6d')]=0x0;this[_0xff88('0x6e')]=0x0;this[_0xff88('0x6f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xff88('0x70')]=0x0;this[_0xff88('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x38e1df[_0xff88('0x72')]||0x14;this[_0xff88('0x73')]=_0x38e1df[_0xff88('0x72')]||0xa;this[_0xff88('0x74')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xff88('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0xff88('0x76')]=0x0;this[_0xff88('0x77')]=0x0;this['dialRecallMeTimeout']=_0x38e1df[_0xff88('0x78')]||0x1e;this[_0xff88('0x79')]=_0x38e1df['dialRecallInQueue']||![];this[_0xff88('0x7a')]=!!_0x38e1df[_0xff88('0x7a')]||![];this[_0xff88('0x7b')]=!!_0x38e1df[_0xff88('0x7b')]||![];this['dialQueueProject2']=_0x38e1df[_0xff88('0x7c')]||undefined;this['dialAgiAfterHangupClient']=_0x38e1df[_0xff88('0x7d')]||![];this[_0xff88('0x7e')]=_0x38e1df[_0xff88('0x7e')]||![];this[_0xff88('0xb')]=monitorFormat[_0x38e1df['monitor_format']]?monitorFormat[_0x38e1df[_0xff88('0xb')]]:undefined;this[_0xff88('0x7f')]=_0x38e1df[_0xff88('0x7f')]||![];this[_0xff88('0x80')]=_0x38e1df[_0xff88('0x80')]?_0x38e1df['mandatoryDispositionPause']:undefined;this[_0xff88('0x81')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 34dba56..e8adaa7 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93bb=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','total','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay'];(function(_0x21bc24,_0x1b6d5b){var _0x41a486=function(_0x5c56da){while(--_0x5c56da){_0x21bc24['push'](_0x21bc24['shift']());}};_0x41a486(++_0x1b6d5b);}(_0x93bb,0x135));var _0xb93b=function(_0x159212,_0x188d2e){_0x159212=_0x159212-0x0;var _0x4a8cfd=_0x93bb[_0x159212];return _0x4a8cfd;};'use strict';var INBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3'),_0xb93b('0x4'),_0xb93b('0x5'),_0xb93b('0x6')];var OUTBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x7'),_0xb93b('0x8'),'loggedIn',_0xb93b('0x2'),_0xb93b('0x9'),'outboundAbandonedCallsDay',_0xb93b('0xa'),_0xb93b('0xb'),'outboundBusyCallsDay',_0xb93b('0xc'),_0xb93b('0xd'),_0xb93b('0xe'),_0xb93b('0xf'),_0xb93b('0x10'),_0xb93b('0x11'),_0xb93b('0x3'),_0xb93b('0x12'),_0xb93b('0x5'),_0xb93b('0x13'),_0xb93b('0x14'),'total',_0xb93b('0x6')];function VoiceQueueSummary(_0xc5385a){this['id']=_0xc5385a['id'];this[_0xb93b('0x15')]=_0xc5385a[_0xb93b('0x15')];this['strategy']=_0xc5385a[_0xb93b('0x16')];this[_0xb93b('0x17')]=_0xc5385a[_0xb93b('0x17')]||0x0;this[_0xb93b('0x7')]=_0xc5385a[_0xb93b('0x7')]||0x0;this[_0xb93b('0x0')]=_0xc5385a[_0xb93b('0x0')]||0x0;this['busy']=_0xc5385a[_0xb93b('0x18')]||0x0;this[_0xb93b('0x8')]=_0xc5385a[_0xb93b('0x8')]||0x0;this[_0xb93b('0x19')]=_0xc5385a[_0xb93b('0x19')]||0x0;this[_0xb93b('0x1')]=_0xc5385a['loggedIn']||0x0;this[_0xb93b('0x2')]=_0xc5385a['loggedInDb']||0x0;this[_0xb93b('0x1a')]=_0xc5385a[_0xb93b('0x1a')]||0x0;this[_0xb93b('0x1b')]=_0xc5385a[_0xb93b('0x1b')]||0x0;this[_0xb93b('0x3')]=_0xc5385a[_0xb93b('0x3')]||0x0;this['ringing']=_0xc5385a[_0xb93b('0x4')]||0x0;this[_0xb93b('0x1c')]=_0xc5385a[_0xb93b('0x1c')];this[_0xb93b('0x13')]=_0xc5385a[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0xc5385a['sumDuration'];this['sumHoldTime']=_0xc5385a['sumHoldTime']||0x0;this['talking']=_0xc5385a[_0xb93b('0x5')]||0x0;this['total']=_0xc5385a['total']||0x0;this[_0xb93b('0x1d')]=_0xc5385a[_0xb93b('0x1d')];this[_0xb93b('0x1e')]=_0xc5385a['unavailable']||0x0;this[_0xb93b('0x1f')]=_0xc5385a[_0xb93b('0x1f')]||0x0;this['unmanaged']=_0xc5385a[_0xb93b('0x20')]||0x0;this[_0xb93b('0x6')]=_0xc5385a[_0xb93b('0x6')]||0x0;if(_0xc5385a[_0xb93b('0x1d')]===_0xb93b('0x21')){this[_0xb93b('0x12')]=_0xc5385a['pTalking']||0x0;this[_0xb93b('0x22')]=_0xc5385a[_0xb93b('0x22')];this[_0xb93b('0x23')]=_0xc5385a[_0xb93b('0x23')];this['dialOriginateCallerIdName']=_0xc5385a[_0xb93b('0x24')];this[_0xb93b('0x25')]=_0xc5385a[_0xb93b('0x25')];this[_0xb93b('0x26')]=_0xc5385a[_0xb93b('0x26')];this[_0xb93b('0x27')]=_0xc5385a[_0xb93b('0x27')];this['temp']=_0xc5385a[_0xb93b('0x28')];this['outboundAnswerAgiCallsDay']=_0xc5385a[_0xb93b('0x29')];this[_0xb93b('0xa')]=_0xc5385a[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0xc5385a[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0xc5385a[_0xb93b('0x2a')];this[_0xb93b('0xc')]=_0xc5385a[_0xb93b('0xc')];this['outboundDropCallsDayACS']=_0xc5385a['outboundDropCallsDayACS'];this[_0xb93b('0x2b')]=_0xc5385a[_0xb93b('0x2b')];this[_0xb93b('0x2c')]=_0xc5385a['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0xc5385a[_0xb93b('0xd')];this[_0xb93b('0xe')]=_0xc5385a[_0xb93b('0xe')];this['outboundOriginateFailureCallsDay']=_0xc5385a['outboundOriginateFailureCallsDay'];this[_0xb93b('0xf')]=_0xc5385a[_0xb93b('0xf')];this[_0xb93b('0x10')]=_0xc5385a[_0xb93b('0x10')];this[_0xb93b('0x11')]=_0xc5385a[_0xb93b('0x11')];this[_0xb93b('0x2d')]=_0xc5385a['predictiveIntervalAnsweredCalls'];this[_0xb93b('0x2e')]=_0xc5385a[_0xb93b('0x2e')];this[_0xb93b('0x2f')]=_0xc5385a[_0xb93b('0x2f')];this[_0xb93b('0x30')]=_0xc5385a[_0xb93b('0x30')];this[_0xb93b('0x31')]=_0xc5385a['predictiveIntervalDroppedCallsTimeout'];this[_0xb93b('0x32')]=_0xc5385a[_0xb93b('0x32')];this[_0xb93b('0x33')]=_0xc5385a[_0xb93b('0x33')];this[_0xb93b('0x34')]=_0xc5385a[_0xb93b('0x34')];this[_0xb93b('0x35')]=_0xc5385a['predictiveIntervalMultiplicativeFactor'];this[_0xb93b('0x36')]=_0xc5385a[_0xb93b('0x36')];this[_0xb93b('0x37')]=_0xc5385a[_0xb93b('0x37')];this[_0xb93b('0x38')]=_0xc5385a[_0xb93b('0x38')];this[_0xb93b('0x9')]=_0xc5385a[_0xb93b('0x9')];this[_0xb93b('0x39')]=_0xc5385a[_0xb93b('0x39')];this[_0xb93b('0x3a')]=_0xc5385a[_0xb93b('0x3a')];this[_0xb93b('0x3b')]=_0xc5385a[_0xb93b('0x3b')];this['erlangBusyFactor']=_0xc5385a[_0xb93b('0x3c')];this[_0xb93b('0x3d')]=_0xc5385a['startPredictive'];this[_0xb93b('0x3e')]=_0xc5385a[_0xb93b('0x3e')];this[_0xb93b('0x3f')]=_0xc5385a[_0xb93b('0x3f')];this[_0xb93b('0x40')]=_0xc5385a[_0xb93b('0x40')];}if(_0xc5385a['Trunk']){this[_0xb93b('0x41')]={'id':_0xc5385a[_0xb93b('0x41')]['id'],'name':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x15')],'active':_0xc5385a['Trunk']['active'],'callerid':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x42')]};}}VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x44')]=function(_0x53aaaa,_0x3396d7,_0x4b7f03,_0x14cea3){this['loggedInDb']=0x0;this[_0xb93b('0x5')]=0x0;this[_0xb93b('0x3')]=0x0;this[_0xb93b('0x1f')]=0x0;this[_0xb93b('0x1b')]=0x0;this[_0xb93b('0x8')]=0x0;this[_0xb93b('0x18')]=0x0;this[_0xb93b('0x19')]=0x0;this['unavailable']=0x0;this[_0xb93b('0x4')]=0x0;this['ringInUse']=0x0;this[_0xb93b('0x1a')]=0x0;if(_0x4b7f03){if(_0x4b7f03['available']){this['available']=Number(_0x4b7f03[_0xb93b('0x0')]);}if(_0x4b7f03[_0xb93b('0x45')]){this[_0xb93b('0x1')]=Number(_0x4b7f03[_0xb93b('0x45')]);}if(_0x4b7f03[_0xb93b('0x46')]){this['waiting']=Number(_0x4b7f03['callers']);}}for(var _0x321fb0=0x0;_0x321fb0<_0x53aaaa[_0xb93b('0x47')];_0x321fb0++){var _0x1a5560=_0x3396d7['SIP/'+_0x53aaaa[_0x321fb0][_0xb93b('0x15')]];if(_0x1a5560&&_0x1a5560[_0xb93b('0x48')]){this['loggedInDb']+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x49')]==='1'){this[_0xb93b('0x5')]+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x3')]==='1'&&!['2','7','8'][_0xb93b('0x4a')](_0x53aaaa[_0x321fb0]['status'])){this[_0xb93b('0x3')]+=0x1;}switch(_0x53aaaa[_0x321fb0][_0xb93b('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xb93b('0x1b')]+=0x1;break;case'2':this[_0xb93b('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xb93b('0x1e')]+=0x1;break;case'6':this[_0xb93b('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xb93b('0x1a')]+=0x1;break;}}if(this[_0xb93b('0x23')]===_0xb93b('0x4c')){var _0x2f62be=Object[_0xb93b('0x4d')](_0x14cea3);for(var _0x2b47d4=0x0;_0x2b47d4<_0x2f62be['length'];_0x2b47d4++){var _0x15bd64=_0x2f62be[_0x2b47d4];var _0x456702=_0x14cea3[_0x15bd64];if(_0x456702['queue']===this[_0xb93b('0x15')]&&_0x456702['type']===_0xb93b('0x4e')&&_0x456702[_0xb93b('0x4f')]===_0xb93b('0x50')){this[_0xb93b('0x5')]+=0x1;}}if(this[_0xb93b('0x5')]>this['inUse']){this['talking']=this[_0xb93b('0x8')];}this[_0xb93b('0x12')]=0x0;}return this;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x51')]=function(_0x1e667e){var _0x3ae118=![];if(_0x1e667e){_0x3ae118=INBOUND_COUNTERS[_0xb93b('0x52')](function(_0x49797b){return this[_0x49797b]!==_0x1e667e[_0x49797b];},this);}return _0x3ae118;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x88c27e){var _0x4b60bf=![];var _0x56cc48=![];var _0x53cf62=![];if(_0x88c27e){_0x4b60bf=this[_0xb93b('0x23')]!==_0x88c27e[_0xb93b('0x23')]||this[_0xb93b('0x22')]!==_0x88c27e[_0xb93b('0x22')]||this['message']!==_0x88c27e['message']||this[_0xb93b('0x40')]!==_0x88c27e[_0xb93b('0x40')];_0x56cc48=OUTBOUND_COUNTERS[_0xb93b('0x52')](function(_0x1dcfba){return this[_0x1dcfba]!==_0x88c27e[_0x1dcfba];},this);if(this[_0xb93b('0x41')]&&_0x88c27e[_0xb93b('0x41')]){_0x53cf62=this['Trunk'][_0xb93b('0x15')]!==_0x88c27e[_0xb93b('0x41')]['name']||this['Trunk']['active']!==_0x88c27e[_0xb93b('0x41')][_0xb93b('0x53')];}}return _0x4b60bf||_0x56cc48||_0x53cf62;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x54')]=function(_0x1b3976){this['answered']=_0x1b3976[_0xb93b('0x7')];this[_0xb93b('0x3f')]=_0x1b3976[_0xb93b('0x3f')];this['statusMessage']=_0x1b3976[_0xb93b('0x40')];this[_0xb93b('0x9')]=_0x1b3976[_0xb93b('0x9')];this['outboundAbandonedCallsDay']=_0x1b3976['outboundAbandonedCallsDay'];this[_0xb93b('0xa')]=_0x1b3976[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0x1b3976[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0x1b3976['outboundBusyCallsDay'];this[_0xb93b('0xc')]=_0x1b3976[_0xb93b('0xc')];this[_0xb93b('0xd')]=_0x1b3976[_0xb93b('0xd')];this['outboundNoSuchCallsDay']=_0x1b3976[_0xb93b('0xe')];this[_0xb93b('0xf')]=_0x1b3976['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x1b3976[_0xb93b('0x10')];this['outboundUnknownCallsDay']=_0x1b3976[_0xb93b('0x11')];this[_0xb93b('0x13')]=_0x1b3976[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0x1b3976['sumDuration'];this[_0xb93b('0x55')]=_0x1b3976[_0xb93b('0x55')];if(this[_0xb93b('0x23')]===_0xb93b('0x56')){this[_0xb93b('0x12')]=_0x1b3976[_0xb93b('0x12')];}};module[_0xb93b('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x6f7b=['keys','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','callers','length','SIP/','online','status','booked'];(function(_0x481e8a,_0x141995){var _0x51a091=function(_0x229791){while(--_0x229791){_0x481e8a['push'](_0x481e8a['shift']());}};_0x51a091(++_0x141995);}(_0x6f7b,0x168));var _0xb6f7=function(_0x4bd7da,_0x418096){_0x4bd7da=_0x4bd7da-0x0;var _0xc73b7d=_0x6f7b[_0x4bd7da];return _0xc73b7d;};'use strict';var INBOUND_COUNTERS=['available',_0xb6f7('0x0'),_0xb6f7('0x1'),_0xb6f7('0x2'),_0xb6f7('0x3'),_0xb6f7('0x4'),_0xb6f7('0x5')];var OUTBOUND_COUNTERS=[_0xb6f7('0x6'),'answered',_0xb6f7('0x7'),'loggedIn',_0xb6f7('0x1'),_0xb6f7('0x8'),_0xb6f7('0x9'),_0xb6f7('0xa'),'outboundBlacklistCallsDay',_0xb6f7('0xb'),_0xb6f7('0xc'),_0xb6f7('0xd'),'outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay',_0xb6f7('0xe'),_0xb6f7('0x2'),_0xb6f7('0xf'),_0xb6f7('0x4'),_0xb6f7('0x10'),_0xb6f7('0x11'),_0xb6f7('0x12'),_0xb6f7('0x5')];function VoiceQueueSummary(_0x459869){this['id']=_0x459869['id'];this[_0xb6f7('0x13')]=_0x459869[_0xb6f7('0x13')];this[_0xb6f7('0x14')]=_0x459869[_0xb6f7('0x14')];this[_0xb6f7('0x15')]=_0x459869[_0xb6f7('0x15')]||0x0;this[_0xb6f7('0x16')]=_0x459869[_0xb6f7('0x16')]||0x0;this[_0xb6f7('0x6')]=_0x459869[_0xb6f7('0x6')]||0x0;this[_0xb6f7('0x17')]=_0x459869[_0xb6f7('0x17')]||0x0;this[_0xb6f7('0x7')]=_0x459869[_0xb6f7('0x7')]||0x0;this[_0xb6f7('0x18')]=_0x459869['invalid']||0x0;this[_0xb6f7('0x0')]=_0x459869[_0xb6f7('0x0')]||0x0;this[_0xb6f7('0x1')]=_0x459869[_0xb6f7('0x1')]||0x0;this['onHold']=_0x459869[_0xb6f7('0x19')]||0x0;this[_0xb6f7('0x1a')]=_0x459869[_0xb6f7('0x1a')]||0x0;this['paused']=_0x459869[_0xb6f7('0x2')]||0x0;this[_0xb6f7('0x3')]=_0x459869[_0xb6f7('0x3')]||0x0;this[_0xb6f7('0x1b')]=_0x459869[_0xb6f7('0x1b')];this[_0xb6f7('0x10')]=_0x459869[_0xb6f7('0x10')];this[_0xb6f7('0x11')]=_0x459869['sumDuration'];this[_0xb6f7('0x1c')]=_0x459869['sumHoldTime']||0x0;this[_0xb6f7('0x4')]=_0x459869[_0xb6f7('0x4')]||0x0;this['total']=_0x459869[_0xb6f7('0x12')]||0x0;this[_0xb6f7('0x1d')]=_0x459869[_0xb6f7('0x1d')];this[_0xb6f7('0x1e')]=_0x459869[_0xb6f7('0x1e')]||0x0;this['unknown']=_0x459869[_0xb6f7('0x1f')]||0x0;this[_0xb6f7('0x20')]=_0x459869[_0xb6f7('0x20')]||0x0;this[_0xb6f7('0x5')]=_0x459869[_0xb6f7('0x5')]||0x0;if(_0x459869[_0xb6f7('0x1d')]===_0xb6f7('0x21')){this['pTalking']=_0x459869[_0xb6f7('0xf')]||0x0;this[_0xb6f7('0x22')]=_0x459869[_0xb6f7('0x22')];this['dialMethod']=_0x459869[_0xb6f7('0x23')];this[_0xb6f7('0x24')]=_0x459869['dialOriginateCallerIdName'];this[_0xb6f7('0x25')]=_0x459869[_0xb6f7('0x25')];this[_0xb6f7('0x26')]=_0x459869[_0xb6f7('0x26')];this[_0xb6f7('0x27')]=_0x459869[_0xb6f7('0x27')];this[_0xb6f7('0x28')]=_0x459869['temp'];this['outboundAnswerAgiCallsDay']=_0x459869[_0xb6f7('0x29')];this['outboundAnswerCallsDay']=_0x459869['outboundAnswerCallsDay'];this[_0xb6f7('0x2a')]=_0x459869[_0xb6f7('0x2a')];this[_0xb6f7('0xb')]=_0x459869['outboundBusyCallsDay'];this[_0xb6f7('0xc')]=_0x459869['outboundCongestionCallsDay'];this[_0xb6f7('0x2b')]=_0x459869[_0xb6f7('0x2b')];this[_0xb6f7('0x2c')]=_0x459869['outboundDropCallsDayCallersExit'];this[_0xb6f7('0x2d')]=_0x459869['outboundDropCallsDayTimeout'];this[_0xb6f7('0xd')]=_0x459869[_0xb6f7('0xd')];this['outboundNoSuchCallsDay']=_0x459869[_0xb6f7('0x2e')];this[_0xb6f7('0x2f')]=_0x459869[_0xb6f7('0x2f')];this['outboundReCallsDay']=_0x459869[_0xb6f7('0x30')];this['outboundRejectCallsDay']=_0x459869[_0xb6f7('0x31')];this[_0xb6f7('0xe')]=_0x459869[_0xb6f7('0xe')];this[_0xb6f7('0x32')]=_0x459869[_0xb6f7('0x32')];this[_0xb6f7('0x33')]=_0x459869[_0xb6f7('0x33')];this[_0xb6f7('0x34')]=_0x459869[_0xb6f7('0x34')];this[_0xb6f7('0x35')]=_0x459869['predictiveIntervalDroppedCallsCallersExit'];this[_0xb6f7('0x36')]=_0x459869[_0xb6f7('0x36')];this[_0xb6f7('0x37')]=_0x459869[_0xb6f7('0x37')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x459869[_0xb6f7('0x38')];this[_0xb6f7('0x39')]=_0x459869[_0xb6f7('0x39')];this['predictiveIntervalMultiplicativeFactor']=_0x459869[_0xb6f7('0x3a')];this[_0xb6f7('0x3b')]=_0x459869[_0xb6f7('0x3b')];this[_0xb6f7('0x3c')]=_0x459869[_0xb6f7('0x3c')];this[_0xb6f7('0x3d')]=_0x459869[_0xb6f7('0x3d')];this[_0xb6f7('0x8')]=_0x459869[_0xb6f7('0x8')];this['erlangCalls']=_0x459869[_0xb6f7('0x3e')];this[_0xb6f7('0x3f')]=_0x459869[_0xb6f7('0x3f')];this[_0xb6f7('0x40')]=_0x459869[_0xb6f7('0x40')];this[_0xb6f7('0x41')]=_0x459869[_0xb6f7('0x41')];this[_0xb6f7('0x42')]=_0x459869[_0xb6f7('0x42')];this[_0xb6f7('0x43')]=_0x459869[_0xb6f7('0x43')];this['message']=_0x459869[_0xb6f7('0x44')];this[_0xb6f7('0x45')]=_0x459869[_0xb6f7('0x45')];}if(_0x459869[_0xb6f7('0x46')]){this['Trunk']={'id':_0x459869[_0xb6f7('0x46')]['id'],'name':_0x459869[_0xb6f7('0x46')][_0xb6f7('0x13')],'active':_0x459869[_0xb6f7('0x46')][_0xb6f7('0x47')],'callerid':_0x459869[_0xb6f7('0x46')][_0xb6f7('0x48')]};}}VoiceQueueSummary[_0xb6f7('0x49')]['createReport']=function(_0x328154,_0x5eb54e,_0x3e602f,_0x1ca6cf){this[_0xb6f7('0x1')]=0x0;this[_0xb6f7('0x4')]=0x0;this['paused']=0x0;this[_0xb6f7('0x1f')]=0x0;this[_0xb6f7('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xb6f7('0x18')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0xb6f7('0x1b')]=0x0;this[_0xb6f7('0x19')]=0x0;if(_0x3e602f){if(_0x3e602f['available']){this[_0xb6f7('0x6')]=Number(_0x3e602f[_0xb6f7('0x6')]);}if(_0x3e602f['loggedin']){this['loggedIn']=Number(_0x3e602f['loggedin']);}if(_0x3e602f[_0xb6f7('0x4a')]){this['waiting']=Number(_0x3e602f['callers']);}}for(var _0xb3bb9c=0x0;_0xb3bb9c<_0x328154[_0xb6f7('0x4b')];_0xb3bb9c++){var _0x49135c=_0x5eb54e[_0xb6f7('0x4c')+_0x328154[_0xb3bb9c]['name']];if(_0x49135c&&_0x49135c[_0xb6f7('0x4d')]){this[_0xb6f7('0x1')]+=0x1;}if(_0x328154[_0xb3bb9c]['incall']==='1'){this['talking']+=0x1;}if(_0x328154[_0xb3bb9c]['paused']==='1'&&!['2','7','8']['includes'](_0x328154[_0xb3bb9c][_0xb6f7('0x4e')])){this[_0xb6f7('0x2')]+=0x1;}switch(_0x328154[_0xb3bb9c][_0xb6f7('0x4e')]){case'0':this[_0xb6f7('0x1f')]+=0x1;break;case'1':this[_0xb6f7('0x1a')]+=0x1;break;case'2':this[_0xb6f7('0x7')]+=0x1;break;case'3':this[_0xb6f7('0x17')]+=0x1;break;case'4':this[_0xb6f7('0x18')]+=0x1;break;case'5':this[_0xb6f7('0x1e')]+=0x1;break;case'6':this[_0xb6f7('0x3')]+=0x1;break;case'7':this[_0xb6f7('0x1b')]+=0x1;break;case'8':this[_0xb6f7('0x19')]+=0x1;break;}}if(this['dialMethod']===_0xb6f7('0x4f')){var _0x5660aa=Object[_0xb6f7('0x50')](_0x1ca6cf);for(var _0xc2b4aa=0x0;_0xc2b4aa<_0x5660aa[_0xb6f7('0x4b')];_0xc2b4aa++){var _0x32f454=_0x5660aa[_0xc2b4aa];var _0x17d7fe=_0x1ca6cf[_0x32f454];if(_0x17d7fe['queue']===this[_0xb6f7('0x13')]&&_0x17d7fe[_0xb6f7('0x1d')]===_0xb6f7('0x51')&&_0x17d7fe['exten']===_0xb6f7('0x52')){this[_0xb6f7('0x4')]+=0x1;}}if(this[_0xb6f7('0x4')]>this[_0xb6f7('0x7')]){this[_0xb6f7('0x4')]=this[_0xb6f7('0x7')];}this[_0xb6f7('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xb6f7('0x53')]=function(_0x5e522b){var _0x1dae49=![];if(_0x5e522b){_0x1dae49=INBOUND_COUNTERS[_0xb6f7('0x54')](function(_0x3a2b2a){return this[_0x3a2b2a]!==_0x5e522b[_0x3a2b2a];},this);}return _0x1dae49;};VoiceQueueSummary[_0xb6f7('0x49')]['compareToOutboundQueue']=function(_0x510ec9){var _0x510c2e=![];var _0x35f2d7=![];var _0x21cac2=![];if(_0x510ec9){_0x510c2e=this[_0xb6f7('0x23')]!==_0x510ec9[_0xb6f7('0x23')]||this[_0xb6f7('0x22')]!==_0x510ec9[_0xb6f7('0x22')]||this['message']!==_0x510ec9[_0xb6f7('0x44')]||this[_0xb6f7('0x45')]!==_0x510ec9[_0xb6f7('0x45')];_0x35f2d7=OUTBOUND_COUNTERS[_0xb6f7('0x54')](function(_0x5f4e38){return this[_0x5f4e38]!==_0x510ec9[_0x5f4e38];},this);if(this[_0xb6f7('0x46')]&&_0x510ec9[_0xb6f7('0x46')]){_0x21cac2=this[_0xb6f7('0x46')][_0xb6f7('0x13')]!==_0x510ec9[_0xb6f7('0x46')][_0xb6f7('0x13')]||this[_0xb6f7('0x46')][_0xb6f7('0x47')]!==_0x510ec9[_0xb6f7('0x46')][_0xb6f7('0x47')];}}return _0x510c2e||_0x35f2d7||_0x21cac2;};VoiceQueueSummary['prototype'][_0xb6f7('0x55')]=function(_0x4aa969){this[_0xb6f7('0x16')]=_0x4aa969[_0xb6f7('0x16')];this[_0xb6f7('0x44')]=_0x4aa969[_0xb6f7('0x44')];this[_0xb6f7('0x45')]=_0x4aa969[_0xb6f7('0x45')];this[_0xb6f7('0x8')]=_0x4aa969[_0xb6f7('0x8')];this[_0xb6f7('0x9')]=_0x4aa969[_0xb6f7('0x9')];this[_0xb6f7('0xa')]=_0x4aa969['outboundAnswerCallsDay'];this[_0xb6f7('0x2a')]=_0x4aa969[_0xb6f7('0x2a')];this[_0xb6f7('0xb')]=_0x4aa969[_0xb6f7('0xb')];this[_0xb6f7('0xc')]=_0x4aa969['outboundCongestionCallsDay'];this[_0xb6f7('0xd')]=_0x4aa969[_0xb6f7('0xd')];this[_0xb6f7('0x2e')]=_0x4aa969[_0xb6f7('0x2e')];this['outboundReCallsDay']=_0x4aa969[_0xb6f7('0x30')];this[_0xb6f7('0x31')]=_0x4aa969['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x4aa969[_0xb6f7('0xe')];this[_0xb6f7('0x10')]=_0x4aa969[_0xb6f7('0x10')];this[_0xb6f7('0x11')]=_0x4aa969[_0xb6f7('0x11')];this['total']=_0x4aa969[_0xb6f7('0x12')];if(this[_0xb6f7('0x23')]===_0xb6f7('0x56')){this[_0xb6f7('0xf')]=_0x4aa969['pTalking'];}};module[_0xb6f7('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ec5ab58..e596462 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 _0x30d7=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x5db140,_0x2afc63){var _0x171133=function(_0x26b95a){while(--_0x26b95a){_0x5db140['push'](_0x5db140['shift']());}};_0x171133(++_0x2afc63);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x46d7fe){this['id']=_0x46d7fe['id']||0x0;this[_0x730d('0x0')]=_0x46d7fe[_0x730d('0x0')]||'';this[_0x730d('0x1')]=_0x46d7fe[_0x730d('0x1')]||'';this['accessKey']=_0x46d7fe[_0x730d('0x2')]||'';this[_0x730d('0x3')]=_0x46d7fe[_0x730d('0x3')]||'';this[_0x730d('0x4')]=_0x46d7fe[_0x730d('0x4')]||'';this['Configurations']=_0x46d7fe[_0x730d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x9be3=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9be3,0x130));var _0x39be=function(_0x56d344,_0x26fa8e){_0x56d344=_0x56d344-0x0;var _0x82e07c=_0x9be3[_0x56d344];return _0x82e07c;};'use strict';function VtigerAccount(_0x469d49){this['id']=_0x469d49['id']||0x0;this[_0x39be('0x0')]=_0x469d49[_0x39be('0x0')]||'';this[_0x39be('0x1')]=_0x469d49[_0x39be('0x1')]||'';this[_0x39be('0x2')]=_0x469d49[_0x39be('0x2')]||'';this['remoteUri']=_0x469d49[_0x39be('0x3')]||'';this[_0x39be('0x4')]=_0x469d49['serverUrl']||'';this[_0x39be('0x5')]=_0x469d49[_0x39be('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 97f62f6..07cb6a4 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 _0x3462=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x3462,0x10b));var _0x2346=function(_0x1a5469,_0x5035a1){_0x1a5469=_0x1a5469-0x0;var _0x3f59cd=_0x3462[_0x1a5469];return _0x3f59cd;};'use strict';function ZendeskAccount(_0x5d168a){this['id']=_0x5d168a['id']||0x0;this['name']=_0x5d168a[_0x2346('0x0')]||'';this[_0x2346('0x1')]=_0x5d168a[_0x2346('0x1')]||'';this[_0x2346('0x2')]=_0x5d168a[_0x2346('0x2')]||'';this[_0x2346('0x3')]=_0x5d168a['token']||'';this[_0x2346('0x4')]=_0x5d168a[_0x2346('0x4')]||'';this[_0x2346('0x5')]=_0x5d168a['authType']||'';this[_0x2346('0x6')]=_0x5d168a[_0x2346('0x6')]||_0x2346('0x7');this[_0x2346('0x8')]=_0x5d168a['serverUrl']||'';this[_0x2346('0x9')]=_0x5d168a['Configurations']||{};}module[_0x2346('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xfa6e=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x19a81d,_0x545ca2){var _0x44058d=function(_0x290dfa){while(--_0x290dfa){_0x19a81d['push'](_0x19a81d['shift']());}};_0x44058d(++_0x545ca2);}(_0xfa6e,0xe7));var _0xefa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa6e[_0x57b54c];return _0x59cc19;};'use strict';function ZendeskAccount(_0x5dd3b7){this['id']=_0x5dd3b7['id']||0x0;this[_0xefa6('0x0')]=_0x5dd3b7[_0xefa6('0x0')]||'';this[_0xefa6('0x1')]=_0x5dd3b7[_0xefa6('0x1')]||'';this[_0xefa6('0x2')]=_0x5dd3b7['password']||'';this['token']=_0x5dd3b7[_0xefa6('0x3')]||'';this[_0xefa6('0x4')]=_0x5dd3b7['remoteUri']||'';this[_0xefa6('0x5')]=_0x5dd3b7[_0xefa6('0x5')]||'';this[_0xefa6('0x6')]=_0x5dd3b7[_0xefa6('0x6')]||_0xefa6('0x7');this[_0xefa6('0x8')]=_0x5dd3b7[_0xefa6('0x8')]||'';this[_0xefa6('0x9')]=_0x5dd3b7[_0xefa6('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a5e24b8..3fc5e36 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 _0x05cd=['serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x561a26,_0x1f944b){var _0x1e7e34=function(_0x1961b0){while(--_0x1961b0){_0x561a26['push'](_0x561a26['shift']());}};_0x1e7e34(++_0x1f944b);}(_0x05cd,0x86));var _0xd05c=function(_0x50536d,_0x310e0d){_0x50536d=_0x50536d-0x0;var _0xd48d5c=_0x05cd[_0x50536d];return _0xd48d5c;};'use strict';function ZohoAccount(_0x19b1db){this['id']=_0x19b1db['id']||0x0;this[_0xd05c('0x0')]=_0x19b1db[_0xd05c('0x0')]||'';this[_0xd05c('0x1')]=_0x19b1db[_0xd05c('0x1')]||'';this[_0xd05c('0x2')]=_0x19b1db[_0xd05c('0x2')]||'';this[_0xd05c('0x3')]=_0x19b1db[_0xd05c('0x3')]||'';this[_0xd05c('0x4')]=_0x19b1db[_0xd05c('0x4')]||'';this[_0xd05c('0x5')]=_0x19b1db['clientSecret']||'';this['serverUrl']=_0x19b1db[_0xd05c('0x6')]||'';this['code']=_0x19b1db['code']||'';this[_0xd05c('0x7')]=_0x19b1db['refreshToken']||'';this[_0xd05c('0x8')]=_0x19b1db['Configurations']||{};}module[_0xd05c('0x9')]=ZohoAccount; \ No newline at end of file +var _0xa35c=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3ef7a1,_0x278194){var _0x4aa67e=function(_0x1e1cbb){while(--_0x1e1cbb){_0x3ef7a1['push'](_0x3ef7a1['shift']());}};_0x4aa67e(++_0x278194);}(_0xa35c,0x89));var _0xca35=function(_0x494f97,_0x13b338){_0x494f97=_0x494f97-0x0;var _0x814763=_0xa35c[_0x494f97];return _0x814763;};'use strict';function ZohoAccount(_0x5e4a9d){this['id']=_0x5e4a9d['id']||0x0;this['name']=_0x5e4a9d[_0xca35('0x0')]||'';this[_0xca35('0x1')]=_0x5e4a9d[_0xca35('0x1')]||'';this[_0xca35('0x2')]=_0x5e4a9d[_0xca35('0x2')]||'';this[_0xca35('0x3')]=_0x5e4a9d['zone']||'';this[_0xca35('0x4')]=_0x5e4a9d[_0xca35('0x4')]||'';this['clientSecret']=_0x5e4a9d[_0xca35('0x5')]||'';this[_0xca35('0x6')]=_0x5e4a9d['serverUrl']||'';this[_0xca35('0x7')]=_0x5e4a9d['code']||'';this[_0xca35('0x8')]=_0x5e4a9d[_0xca35('0x8')]||'';this[_0xca35('0x9')]=_0x5e4a9d[_0xca35('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6cc8ec8..ecbedd7 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 _0x1399=['type','queue','dialAnswer','Agent','name','channelAgent','membername','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','idContact'];(function(_0x5c14e3,_0x1c80e9){var _0x53e39d=function(_0x2da4e9){while(--_0x2da4e9){_0x5c14e3['push'](_0x5c14e3['shift']());}};_0x53e39d(++_0x1c80e9);}(_0x1399,0x16c));var _0x9139=function(_0x4ae32d,_0x256489){_0x4ae32d=_0x4ae32d-0x0;var _0x550537=_0x1399[_0x4ae32d];return _0x550537;};'use strict';var util=require(_0x9139('0x0'));var _=require(_0x9139('0x1'));var moment=require('moment');function checkNameSurname(_0x474911,_0x4f01ae,_0x10c98f){var _0x8bba08='';if(!_[_0x9139('0x2')](_0x4f01ae)&&_0x9139('0x3')===typeof _0x4f01ae){_0x8bba08+=_0x4f01ae;}if(!_[_0x9139('0x2')](_0x10c98f)&&_0x9139('0x3')===typeof _0x10c98f){_0x8bba08+='\x20'+_0x10c98f;}if(_0x8bba08!==''){return _0x8bba08;}return _0x474911;}function Action(_0x5ac80b,_0x54af2d,_0x8f086b,_0x11d2ed,_0x4d5d1e){this['uniqueid']=_0x8f086b||undefined;this[_0x9139('0x4')]=_0x5ac80b['id'];this['queue']=_0x54af2d['name'];this[_0x9139('0x5')]=_0x54af2d[_0x9139('0x5')];this['campaigntype']=_0x9139('0x6');this[_0x9139('0x7')]=![];this['membername']=_['isNil'](_0x5ac80b[_0x9139('0x8')])?undefined:_0x5ac80b[_0x9139('0x8')][_0x9139('0x9')];this[_0x9139('0xa')]=this[_0x9139('0xb')]?util['format']('SIP/%s',this['membername']):_0x11d2ed||undefined;this[_0x9139('0xc')]=checkNameSurname(_0x5ac80b['Contact'][_0x9139('0xd')],_0x5ac80b[_0x9139('0xe')][_0x9139('0xf')],_0x5ac80b[_0x9139('0xe')]['lastName']);this[_0x9139('0x10')]=_0x5ac80b['active']||![];this['calleridnum']=_0x5ac80b['phone'];this[_0x9139('0x11')]=_0x5ac80b[_0x9139('0x11')];this[_0x9139('0x12')]=_0x5ac80b[_0x9139('0x12')]||0x0;this[_0x9139('0x13')]=_0x5ac80b[_0x9139('0x13')]||0x0;this['countnoanswerretry']=_0x5ac80b['countnoanswerretry']||0x0;this[_0x9139('0x14')]=(_0x5ac80b[_0x9139('0x12')]||0x0)+(_0x5ac80b['countcongestionretry']||0x0)+(_0x5ac80b['countnoanswerretry']||0x0)+(_0x5ac80b[_0x9139('0x15')]||0x0)+(_0x5ac80b[_0x9139('0x16')]||0x0)+(_0x5ac80b['countabandonedretry']||0x0)+(_0x5ac80b[_0x9139('0x17')]||0x0)+(_0x5ac80b[_0x9139('0x18')]||0x0);this[_0x9139('0x15')]=_0x5ac80b[_0x9139('0x15')]||0x0;this[_0x9139('0x16')]=_0x5ac80b[_0x9139('0x16')]||0x0;this[_0x9139('0x19')]=_0x5ac80b[_0x9139('0x19')]||0x0;this[_0x9139('0x17')]=_0x5ac80b[_0x9139('0x17')]||0x0;this[_0x9139('0x18')]=_0x5ac80b[_0x9139('0x18')]||0x0;this[_0x9139('0x1a')]=_0x5ac80b[_0x9139('0x1a')];this[_0x9139('0x1b')]=_0x5ac80b[_0x9139('0x1b')];this[_0x9139('0x1c')]=_0x5ac80b[_0x9139('0x1c')];this[_0x9139('0x1d')]=_0x5ac80b['recallme'];this[_0x9139('0x1e')]=_0x5ac80b[_0x9139('0x1e')];this['ListId']=_0x5ac80b[_0x9139('0x1f')];this[_0x9139('0x20')]=_[_0x9139('0x2')](_0x5ac80b['Agent'])?_0x5ac80b[_0x9139('0x20')]:_0x5ac80b[_0x9139('0x8')]['id'];this['VoiceQueueId']=_0x5ac80b[_0x9139('0x21')];this[_0x9139('0x22')]='';this[_0x9139('0x23')]='';}Action['prototype'][_0x9139('0x24')]=function(){return util[_0x9139('0x25')](_0x9139('0x26'),this[_0x9139('0xc')],this[_0x9139('0x27')]);};module[_0x9139('0x28')]=Action; \ No newline at end of file +var _0x065e=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','calleridname','number','util','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry'];(function(_0x144c2d,_0x345929){var _0xf723a6=function(_0x5add12){while(--_0x5add12){_0x144c2d['push'](_0x144c2d['shift']());}};_0xf723a6(++_0x345929);}(_0x065e,0x1a7));var _0xe065=function(_0x16dde8,_0x351671){_0x16dde8=_0x16dde8-0x0;var _0xbf9268=_0x065e[_0x16dde8];return _0xbf9268;};'use strict';var util=require(_0xe065('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x59293c,_0x1c0754,_0x240146){var _0x163f28='';if(!_['isNil'](_0x1c0754)&&'string'===typeof _0x1c0754){_0x163f28+=_0x1c0754;}if(!_[_0xe065('0x1')](_0x240146)&&_0xe065('0x2')===typeof _0x240146){_0x163f28+='\x20'+_0x240146;}if(_0x163f28!==''){return _0x163f28;}return _0x59293c;}function Action(_0x5b099e,_0x10b45f,_0x1e7e69,_0x189d72,_0x52403a){this[_0xe065('0x3')]=_0x1e7e69||undefined;this['idContact']=_0x5b099e['id'];this[_0xe065('0x4')]=_0x10b45f[_0xe065('0x5')];this[_0xe065('0x6')]=_0x10b45f[_0xe065('0x6')];this[_0xe065('0x7')]='queue';this[_0xe065('0x8')]=![];this[_0xe065('0x9')]=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?undefined:_0x5b099e[_0xe065('0xa')][_0xe065('0x5')];this['channelAgent']=this['membername']?util[_0xe065('0xb')](_0xe065('0xc'),this[_0xe065('0x9')]):_0x189d72||undefined;this['calleridname']=checkNameSurname(_0x5b099e[_0xe065('0xd')][_0xe065('0xe')],_0x5b099e[_0xe065('0xd')][_0xe065('0xf')],_0x5b099e[_0xe065('0xd')]['lastName']);this[_0xe065('0x10')]=_0x5b099e[_0xe065('0x10')]||![];this[_0xe065('0x11')]=_0x5b099e[_0xe065('0xe')];this[_0xe065('0x12')]=_0x5b099e[_0xe065('0x12')];this[_0xe065('0x13')]=_0x5b099e['countbusyretry']||0x0;this[_0xe065('0x14')]=_0x5b099e[_0xe065('0x14')]||0x0;this['countnoanswerretry']=_0x5b099e[_0xe065('0x15')]||0x0;this[_0xe065('0x16')]=(_0x5b099e[_0xe065('0x13')]||0x0)+(_0x5b099e[_0xe065('0x14')]||0x0)+(_0x5b099e[_0xe065('0x15')]||0x0)+(_0x5b099e[_0xe065('0x17')]||0x0)+(_0x5b099e[_0xe065('0x18')]||0x0)+(_0x5b099e['countabandonedretry']||0x0)+(_0x5b099e[_0xe065('0x19')]||0x0)+(_0x5b099e['countagentrejectretry']||0x0);this[_0xe065('0x17')]=_0x5b099e[_0xe065('0x17')]||0x0;this['countdropretry']=_0x5b099e[_0xe065('0x18')]||0x0;this['countabandonedretry']=_0x5b099e[_0xe065('0x1a')]||0x0;this[_0xe065('0x19')]=_0x5b099e[_0xe065('0x19')]||0x0;this[_0xe065('0x1b')]=_0x5b099e[_0xe065('0x1b')]||0x0;this[_0xe065('0x1c')]=_0x5b099e[_0xe065('0x1c')];this[_0xe065('0x1d')]=_0x5b099e[_0xe065('0x1d')];this['callbackat']=_0x5b099e[_0xe065('0x1e')];this[_0xe065('0x1f')]=_0x5b099e[_0xe065('0x1f')];this[_0xe065('0x20')]=_0x5b099e['ContactId'];this['ListId']=_0x5b099e[_0xe065('0x21')];this['UserId']=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?_0x5b099e[_0xe065('0x22')]:_0x5b099e[_0xe065('0xa')]['id'];this[_0xe065('0x23')]=_0x5b099e[_0xe065('0x23')];this[_0xe065('0x24')]='';this[_0xe065('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0xe065('0xb')](_0xe065('0x26'),this[_0xe065('0x27')],this[_0xe065('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 70c3e88..03e6382 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 _0x8471=['object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','isTrunkReachable','active','SIP/%s','unmonitored','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','unlockContact','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','redis','defaults','localhost','socket.io-emitter','tail','finally','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','info','stringify','format','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','logger','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','logger2','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent'];(function(_0x2c53f2,_0xf57a6e){var _0x232260=function(_0x9c8bd1){while(--_0x9c8bd1){_0x2c53f2['push'](_0x2c53f2['shift']());}};_0x232260(++_0xf57a6e);}(_0x8471,0x67));var _0x1847=function(_0x2791d8,_0x57e8cb){_0x2791d8=_0x2791d8-0x0;var _0x1bee79=_0x8471[_0x2791d8];return _0x1bee79;};'use strict';var util=require(_0x1847('0x0'));var _=require('lodash');var uuid=require(_0x1847('0x1'));var moment=require(_0x1847('0x2'));var Redis=require(_0x1847('0x3'));var config=require(_0x1847('0x4'));var logger=require(_0x1847('0x5'))('preview');var loggerAction=require(_0x1847('0x5'))(_0x1847('0x6'));var ami=require(_0x1847('0x7'));var rpcDb=require(_0x1847('0x8'));var cmHopperAdditionalPhone=require(_0x1847('0x9'));var Action=require('./action');var ut=require(_0x1847('0xa'));var utils=require('../dialer/utils');config[_0x1847('0xb')]=_[_0x1847('0xc')](config['redis'],{'host':_0x1847('0xd'),'port':0x18eb});var io=require(_0x1847('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1ed5e7){this[_0x1847('0xf')]=this[_0x1847('0xf')]?this[_0x1847('0xf')][_0x1847('0x10')](_0x1ed5e7):_0x1ed5e7();};function Preview(_0xccab50){this['sequence']=new Sequence();this['campaignsPreview']=_0xccab50['voiceQueues'];this[_0x1847('0x11')]=_0xccab50[_0x1847('0x11')];this['actions']={};this[_0x1847('0x12')]=_0xccab50[_0x1847('0x12')];this[_0x1847('0x13')]=0x0;ami['on'](_0x1847('0x14'),this[_0x1847('0x15')]['bind'](this));ami['on'](_0x1847('0x16'),this[_0x1847('0x17')][_0x1847('0x18')](this));ami['on']('hanguprequest',this[_0x1847('0x19')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1a'),this['syncDialEnd']['bind'](this));ami['on']('newexten',this[_0x1847('0x1b')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1c'),this['syncVarSet']['bind'](this));ami['on'](_0x1847('0x1d'),this[_0x1847('0x1e')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1f'),this[_0x1847('0x20')]['bind'](this));this[_0x1847('0x21')](this[_0x1847('0x22')]);}function emit(_0x2ea4e9,_0x4e10bc,_0x17f721){io['to'](_0x2ea4e9)['emit'](_0x4e10bc,_0x17f721);}function emitVoiceQueueChannelRemove(_0x20f903){logger[_0x1847('0x23')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x1847('0x24')](_0x20f903));emit(util[_0x1847('0x25')]('voice:queue:%s',_0x20f903[_0x1847('0x26')]),_0x1847('0x27'),_0x20f903);io[_0x1847('0x28')](_0x1847('0x29'),_0x20f903);}function notSendMessagesQueue(_0xa3534a){if(_0xa3534a['sendMessageOneNotActive']){if(_0xa3534a[_0x1847('0x2a')]===0x0&&_0xa3534a[_0x1847('0x2b')]===0x0){_0xa3534a[_0x1847('0x2c')]=![];_0xa3534a[_0x1847('0x2d')]=0x0;_0xa3534a['paused']=0x0;_0xa3534a[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x30')];ut['logger'](_0x1847('0x31'),_0xa3534a[_0x1847('0x26')]+'\x20is\x20not\x20active');}else{_0xa3534a[_0x1847('0x2e')]=utils[_0x1847('0x2f')]['DEACTIVATED'];ut[_0x1847('0x32')](_0x1847('0x31'),_0xa3534a[_0x1847('0x26')]+_0x1847('0x33'));}}}Preview[_0x1847('0x34')][_0x1847('0x21')]=function(){var _0x53f377=this;setInterval(function(){_0x53f377['syncCampaigns']();},0x7cf);};Preview[_0x1847('0x34')][_0x1847('0x35')]=function(){var _0x25c561=this[_0x1847('0x22')];this[_0x1847('0x13')]+=0x1;for(var _0x52afbe in _0x25c561){if(_0x25c561['hasOwnProperty'](_0x52afbe)&&(_0x25c561[_0x52afbe][_0x1847('0x36')]===_0x1847('0x37')||_0x25c561[_0x52afbe][_0x1847('0x36')]===_0x1847('0x38'))&&_0x25c561[_0x52afbe][_0x1847('0x39')]===_0x1847('0x3a')){if(this[_0x1847('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x1847('0x3b')]();}}if(_0x25c561['hasOwnProperty'](_0x52afbe)&&_0x25c561[_0x52afbe]['dialMethod']===_0x1847('0x37')&&_0x25c561[_0x52afbe][_0x1847('0x39')]===_0x1847('0x3a')){if(_0x25c561[_0x52afbe][_0x1847('0x3c')]){this[_0x1847('0x3d')](_0x25c561[_0x52afbe]);if(_0x25c561[_0x52afbe]['dialPreviewAutoRecallMe'])this[_0x1847('0x3e')](_0x25c561[_0x52afbe]);}else{notSendMessagesQueue(_0x25c561[_0x52afbe]);}}}};Preview[_0x1847('0x34')][_0x1847('0x3f')]=function(_0x49c607){var _0x5c68a8=this;this[_0x1847('0x40')][_0x1847('0x41')](function(){if(!_[_0x1847('0x42')](_0x5c68a8[_0x1847('0x43')][_0x49c607])){loggerAction[_0x1847('0x23')](_0x1847('0x44'),_0x49c607,_0x1847('0x45'),_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue'],'originated:\x20',JSON[_0x1847('0x24')](_0x5c68a8['campaignsPreview'][_0x5c68a8['actions'][_0x49c607]['queue']][_0x1847('0x2a')]),_0x1847('0x46'),JSON[_0x1847('0x24')](_0x5c68a8[_0x1847('0x22')][_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]][_0x1847('0x2b')]),JSON[_0x1847('0x24')](_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x48')]),JSON[_0x1847('0x24')](_[_0x1847('0x49')](_0x5c68a8['actions'][_0x49c607],[_0x1847('0x4a'),_0x1847('0x4b'),_0x1847('0x4c'),_0x1847('0x4d')])));return ami[_0x1847('0x4e')]({'action':_0x1847('0x4f'),'channel':_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x50')]})[_0x1847('0x51')](function(_0x55e034){if(_0x55e034[_0x1847('0x2e')]===_0x1847('0x52')){setTimeout(function(){if(_0x5c68a8['actions'][_0x49c607]){ut['updateOriginated'](_0x5c68a8[_0x1847('0x22')][_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]],_0x1847('0x53'));if(_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x48')]===!![]){ut[_0x1847('0x54')](_0x5c68a8['campaignsPreview'][_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue']],'[clearZombieChannel]');ut[_0x1847('0x55')]('[Dialer][checkChannel][pTalking][Preview]'+_0x49c607,_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue']);}ut[_0x1847('0x55')](_0x1847('0x56')+_0x49c607,_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]);delete _0x5c68a8[_0x1847('0x43')][_0x49c607];}},0x2328);}});}});};Preview[_0x1847('0x34')][_0x1847('0x3b')]=function(){var _0x1d253d=this;loggerAction['info']('[action]',_[_0x1847('0x57')](this[_0x1847('0x43')]));for(var _0x474a43 in this[_0x1847('0x43')]){if(_0x1d253d[_0x1847('0x43')][_0x1847('0x58')](_0x474a43)){_0x1d253d[_0x1847('0x3f')](_0x474a43);}}};Preview[_0x1847('0x34')]['recallMe']=function(_0x17cf3a){var _0x2ec67f=this;rpcDb[_0x1847('0x59')](_0x17cf3a['id'],ut[_0x1847('0x5a')](this['agents']))[_0x1847('0x5b')](function(_0x10de2c){if(!_[_0x1847('0x42')](_0x10de2c)){for(var _0x4927d9=0x0;_0x4927d9<_0x10de2c[_0x1847('0x5c')];_0x4927d9+=0x1){if(ut[_0x1847('0x5d')](_0x10de2c[_0x4927d9][_0x1847('0x5e')])<_0x17cf3a['dialRecallMeTimeout']*0x3c){if(_0x10de2c[_0x4927d9][_0x1847('0x5f')]&&!_0x10de2c[_0x4927d9]['Agent'][_0x1847('0x60')]){_0x2ec67f[_0x1847('0x61')](_0x10de2c[_0x4927d9]['id'])[_0x1847('0x5b')](ut['logger2'](_0x1847('0x62')))['catch'](ut['logger2'](_0x1847('0x62')));}else{rpcDb['disableContact'](_0x10de2c[_0x4927d9]['id']);}}else{var _0x4c3725=new Action(_0x10de2c[_0x4927d9],_0x17cf3a);_0x4c3725[_0x1847('0x63')]=moment()[_0x1847('0x25')](_0x1847('0x64'));_0x17cf3a['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4c3725,0x17,_0x1847('0x65'));if(_0x17cf3a[_0x1847('0x66')]){rpcDb[_0x1847('0x67')](ut[_0x1847('0x68')](_0x10de2c[_0x4927d9]));rpcDb[_0x1847('0x69')](_0x4c3725,_0x1847('0x6a'));}else{ut[_0x1847('0x6b')](_0x4c3725,0x16,_0x1847('0x6c'));rpcDb[_0x1847('0x69')](_0x4c3725,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x4c3725,_0x1847('0x6d'));}}}}})[_0x1847('0x51')](ut[_0x1847('0x6e')](_0x1847('0x6f')));};Preview['prototype']['setMessage']=function(_0x3081a0){_0x3081a0[_0x1847('0x2c')]=!![];if(ut[_0x1847('0x70')](_0x3081a0[_0x1847('0x71')])){_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x72')];}else if(!ut[_0x1847('0x73')](_0x3081a0[_0x1847('0x3c')])){_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x30')];}else if(!this['isTrunkReachable'](_0x3081a0[_0x1847('0x74')])){if(!this['isTrunkReachable'](_0x3081a0[_0x1847('0x75')])){_0x3081a0[_0x1847('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x76')];}}else{_0x3081a0['message']=utils[_0x1847('0x2f')][_0x1847('0x76')];}};Preview['prototype'][_0x1847('0x77')]=function(_0x14ab2b,_0x34aa8b,_0xedd2db){var _0x17eb45=this;var _0x10ca77=this[_0x1847('0x43')][_0x34aa8b];var _0x38e17f=this['campaignsPreview'][_0x10ca77[_0x1847('0x47')]];var _0x4ef935;var _0x525069=![];var _0x27491a=0x2;var _0x74e673=0x3;if(_0x38e17f){switch(_0xedd2db){case'1':_0x38e17f[_0x1847('0x78')]+=0x1;_0x10ca77[_0x1847('0x79')]+=0x1;_0x10ca77['countglobal']=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x0,_0x1847('0x7b'));ami[_0x1847('0x28')](_0x1847('0x7c'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x7e')));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logNoSuch]');_0x17eb45[_0x1847('0x7f')](_0x10ca77,'0',_0x38e17f)['then'](function(_0x1e0e51){_0x525069=_0x1e0e51[_0x1847('0x80')]==0x1;_0x27491a=_0x38e17f[_0x1847('0x81')];_0x74e673=_0x38e17f[_0x1847('0x82')];if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0x86'));}else{if(_0x10ca77[_0x1847('0x79')]>=_0x38e17f[_0x1847('0x87')]){rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0x86'));}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,_0x1847('0x79'),_0x38e17f['dialNoSuchNumberRetryFrequency']),_0x10ca77['unlockAgent'],_0x10ca77[_0x1847('0x8a')]);}}delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];}else{_0x10ca77[_0x1847('0x79')]++;logger[_0x1847('0x23')](_0x1847('0x8c'),_0x10ca77[_0x1847('0x79')]);logger[_0x1847('0x23')]('id',_0x10ca77[_0x1847('0x8d')]);_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnosuchnumberretry':_0x10ca77[_0x1847('0x79')]}})['then'](function(){_0x17eb45['swapAdditionalPhones'](_0x10ca77,_0x27491a,_0x74e673)['then'](function(){});});}});break;case'ANSWER':var _0x143d7e=moment()['format'](_0x1847('0x64'));_0x10ca77[_0x1847('0x8f')]=_0x143d7e;_0x10ca77['answertime']=_0x143d7e;_0x10ca77[_0x1847('0x48')]=!![];_0x38e17f[_0x1847('0x2b')]+=0x1;logger[_0x1847('0x23')](_0x1847('0x90'),_0x10ca77[_0x1847('0x91')],'\x20Queue',_0x38e17f[_0x1847('0x26')],_0x1847('0x46'),_0x38e17f['pTalking']);ami[_0x1847('0x28')](_0x1847('0x92'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x93'),this[_0x1847('0x22')][_0x10ca77[_0x1847('0x47')]]));if(_0x38e17f[_0x1847('0x94')]){ami[_0x1847('0x28')](_0x1847('0x95'),ut[_0x1847('0x96')](_0x10ca77));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x10ca77,'complete',this[_0x1847('0x22')][_0x10ca77[_0x1847('0x47')]]));emitVoiceQueueChannelRemove(ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x97')));_0x38e17f[_0x1847('0x98')]+=0x1;_0x38e17f['total']+=0x1;_0x38e17f[_0x1847('0x99')]+=0x1;ut['decrementTalkink'](_0x38e17f,_0x1847('0x9a'));_0x10ca77[_0x1847('0x9b')]=ut['totalGlobal'](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x4,_0x1847('0x9c'));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0x9d'));rpcDb[_0x1847('0x9e')](_0x10ca77);_0x38e17f[_0x1847('0x9f')]+=_0x10ca77[_0x1847('0xa0')];_0x38e17f['sumBillable']+=_0x10ca77[_0x1847('0xa0')];logger[_0x1847('0x23')](_0x1847('0xa1'),_0x10ca77[_0x1847('0x91')],_0x1847('0xa2'),_0x38e17f['name'],_0x1847('0x46'),_0x38e17f[_0x1847('0x2b')]);delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];break;case'BUSY':_0x38e17f[_0x1847('0xa3')]+=0x1;_0x10ca77[_0x1847('0xa4')]+=0x1;_0x10ca77['countglobal']=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x5,_0x1847('0xa5'));_0x27491a=_0x38e17f[_0x1847('0xa6')];_0x74e673=_0x38e17f[_0x1847('0x82')];ami[_0x1847('0x28')](_0x1847('0xa7'),ut['buildObj'](_0x10ca77,_0x1847('0xa8')));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xa9'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'5',_0x38e17f)[_0x1847('0x5b')](function(_0x2a18b4){_0x525069=_0x2a18b4[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut['totalGlobal'](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xab'));}else{if(_0x10ca77[_0x1847('0xa4')]>=_0x38e17f['dialBusyMaxRetry']){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xa9'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xa4'),_0x38e17f[_0x1847('0xa6')]),_0x10ca77[_0x1847('0xac')],_0x10ca77['activeContact']);}}}else{_0x10ca77[_0x1847('0xa4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countbusyretry':_0x10ca77['countbusyretry']}})['then'](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case _0x1847('0xae'):_0x38e17f[_0x1847('0xaf')]+=0x1;_0x10ca77['countnoanswerretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut['logCustomer'](_0x10ca77,0x3,_0x1847('0xb0'));_0x27491a=_0x38e17f[_0x1847('0xb1')];_0x74e673=_0x38e17f[_0x1847('0x82')];var _0x37cb47=ut['buildNoAnswerEventPayload'](_0x10ca77,_0x38e17f);ami[_0x1847('0x28')]('custom:agentnoanswer',_0x37cb47);rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xb2'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'3',_0x38e17f)[_0x1847('0x5b')](function(_0x4d30d8){_0x525069=_0x4d30d8[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xb3'));}else{if(_0x10ca77[_0x1847('0xb4')]>=_0x38e17f[_0x1847('0xb5')]){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xb2'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xb4'),_0x38e17f[_0x1847('0xb1')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})['then'](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)['then'](function(){});});}});break;case'CONGESTION':_0x38e17f[_0x1847('0xb6')]+=0x1;_0x10ca77[_0x1847('0xb7')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x8,_0x1847('0xb8'));_0x27491a=_0x38e17f['dialCongestionRetryFrequency'];_0x74e673=_0x38e17f['callAdditionalPhoneAfterMin'];ami[_0x1847('0x28')](_0x1847('0xb9'),ut['buildObj'](_0x10ca77,'congestion'));rpcDb['createCustomerHistory'](_0x10ca77,_0x1847('0xba'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'8',_0x38e17f)['then'](function(_0x315593){_0x525069=_0x315593[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xbb'));}else{if(_0x10ca77['countcongestionretry']>=_0x38e17f[_0x1847('0xbc')]){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xba'));}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,'countcongestionretry',_0x38e17f['dialBusyRetryFrequency']),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77['countcongestionretry']++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countcongestionretry':_0x10ca77[_0x1847('0xb7')]}})[_0x1847('0x5b')](function(){_0x17eb45['swapAdditionalPhones'](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case _0x1847('0xbd'):_0x38e17f[_0x1847('0xbe')]+=0x1;_0x10ca77[_0x1847('0xbf')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x14,_0x1847('0xc0'));_0x27491a=_0x38e17f[_0x1847('0xc1')];_0x74e673=_0x38e17f[_0x1847('0x82')];ami['emit'](_0x1847('0xc2'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0xc3')));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xc4'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'20',_0x38e17f)[_0x1847('0x5b')](function(_0x32aa91){_0x525069=_0x32aa91[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut['totalGlobal'](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x4ef935,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x10ca77[_0x1847('0xbf')]>=_0x38e17f[_0x1847('0xc5')]){rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0xc6'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xbf'),_0x38e17f[_0x1847('0xc1')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case'ABANDONED':_0x38e17f[_0x1847('0xc7')]+=0x1;_0x10ca77['countabandonedretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0xb,_0x1847('0xc8'));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xc9'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'11',_0x38e17f)[_0x1847('0x5b')](function(_0xdf4807){_0x525069=_0xdf4807[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xc9'));}else{if(_0x10ca77[_0x1847('0xca')]>=_0x38e17f['dialAbandonedMaxRety']){rpcDb[_0x1847('0x85')](_0x10ca77,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,_0x1847('0xcb'),_0x38e17f[_0x1847('0xcc')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77['countnoanswerretry']}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case'18':_0x38e17f[_0x1847('0xcd')]+=0x1;_0x10ca77['countmachineretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut['logCustomer'](_0x10ca77,0x12,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);ami[_0x1847('0x28')](_0x1847('0xd0'),ut['buildObj'](_0x10ca77,'amd'));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xd1'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'18',_0x38e17f)[_0x1847('0x5b')](function(_0x1d69a0){_0x525069=_0x1d69a0[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut['cloneAction'](_0x10ca77,0x12,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xd1'));}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd1'));}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});delete this[_0x1847('0x43')][_0x14ab2b['linkedid']];break;case'19':_0x38e17f[_0x1847('0xcd')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut['totalGlobal'](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x13,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);ami[_0x1847('0x28')](_0x1847('0xd0'),ut['buildObj'](_0x10ca77,_0x1847('0xd2')));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][machine]');_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'18',_0x38e17f)['then'](function(_0x4f7e6f){_0x525069=_0x4f7e6f[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut['cloneAction'](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xd3'));}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd3'));}}else{_0x10ca77['countnoanswerretry']++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];break;default:if(_0x10ca77[_0x1847('0x48')]){ut[_0x1847('0x54')](_0x38e17f,_0x1847('0xd4'));ut[_0x1847('0x55')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x38e17f[_0x1847('0x26')],_0x14ab2b);}_0x38e17f['outboundUnknownCallsDay']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0xc,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);_0x27491a=_0x38e17f[_0x1847('0xc1')];_0x74e673=_0x38e17f[_0x1847('0x82')];rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logUnknown]');_0x17eb45[_0x1847('0x7f')](_0x10ca77,'20',_0x38e17f)[_0x1847('0x5b')](function(_0x2538d8){_0x525069=_0x2538d8['additional']==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut['cloneAction'](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd5'));}delete this['actions'][_0x14ab2b[_0x1847('0x8b')]];}else{_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});}});}if(!(_0x10ca77[_0x1847('0x48')]&&_0xedd2db==='16')){ut['updateOriginated'](_0x38e17f,'[callProgressDetectingCustomer]');logger[_0x1847('0x23')](_0x1847('0xd6'),_0x10ca77[_0x1847('0x91')],_0x1847('0xa2'),_0x38e17f[_0x1847('0x26')],_0x1847('0xd7'),_0x38e17f['originated']);}if(_0xedd2db!==_0x1847('0xd8')){delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0xd9')]];}_0x38e17f[_0x1847('0xda')]=!![];}};Preview[_0x1847('0x34')][_0x1847('0xdb')]=function(_0x256479,_0x441a22,_0x56e1f4){if(_['isUndefined'](_0x441a22)&&_0x1847('0xdc')!==typeof _0x441a22){return;}if(_[_0x1847('0xdd')](_0x56e1f4)&&_0x1847('0xdc')!==typeof _0x56e1f4){return;}switch(_0x56e1f4[_0x1847('0xde')]){case'0':ut[_0x1847('0xdf')](_0x256479,0x0,_0x1847('0x7b'));rpcDb['createAgentHistory'](_0x256479,_0x1847('0xe0'));break;case'3':ut[_0x1847('0xdf')](_0x256479,0x3,'NoAnswer');rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe2'));break;case'5':ut['logAgent'](_0x256479,0x5,_0x1847('0xa5'));rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe3'));break;case'8':ut['logAgent'](_0x256479,0x8,'Congestion');rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe4'));break;case'22':ut[_0x1847('0xdf')](_0x256479,0x16,_0x1847('0xe5'));rpcDb[_0x1847('0xe1')](_0x256479,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x1847('0xdf')](_0x256479,0xc,_0x56e1f4[_0x1847('0xde')]);rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe4'));}ut[_0x1847('0xe6')](_0x441a22,_0x1847('0xe7'));logger['info'](_0x1847('0xe8'),_0x256479[_0x1847('0x91')],_0x1847('0xa2'),_0x441a22[_0x1847('0x26')],'originated:\x20',_0x441a22[_0x1847('0x2a')]);delete this['actions'][_0x256479['uniqueid']];};Preview[_0x1847('0x34')][_0x1847('0x7f')]=function(_0x30fe8d,_0x46e622,_0x1f7b6a){return cmHopperAdditionalPhone[_0x1847('0x7f')](_0x30fe8d,_0x46e622,_0x1f7b6a)[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xe9')));};Preview['prototype'][_0x1847('0xad')]=function(_0x5baa29,_0x26af7d,_0x2f3d6e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5baa29,_0x26af7d,_0x2f3d6e)[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xea')));};Preview['prototype'][_0x1847('0x8e')]=function(_0x7a944e){return Promise[_0x1847('0xeb')]()['then'](cmHopperAdditionalPhone[_0x1847('0x8e')](_0x7a944e))[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xec')));};Preview[_0x1847('0x34')][_0x1847('0xed')]=function(_0x55cc92,_0x219934,_0xa96dc,_0x2c80cf,_0x28d2ea){var _0x4dc16d=this;return new Promise(function(_0x45b8ab,_0x337ed6){if(_[_0x1847('0x42')](_0x219934)||_['isNil'](_0x219934[_0x1847('0xee')])||_[_0x1847('0x42')](_0x219934[_0x1847('0xef')])||_[_0x1847('0x42')](_0x219934[_0x1847('0x4c')])){_0x337ed6(ut['message'](_0x1847('0xf0'),_0x2c80cf,_0x28d2ea));return;}var _0xda4547=uuid['v4']();var _0x1f5d04=_0x4dc16d['campaignsPreview'][_0x219934[_0x1847('0x45')][_0x1847('0x26')]];var _0x4089db=_0xa96dc?_0x4dc16d[_0x1847('0x12')][_0xa96dc]['id']:undefined;_0x4dc16d[_0x1847('0x43')][_0xda4547]=new Action(_0x219934,_0x1f5d04,_0xda4547,_0xa96dc,_0x4089db);var _0x5c3304=_0x4dc16d[_0x1847('0x43')][_0xda4547];_0x5c3304['unlockAgent']=_0x2c80cf;_0x5c3304['activeContact']=_0x28d2ea;_0x5c3304[_0x1847('0xf1')]=_0xa96dc;if(_[_0x1847('0xf2')](_0x55cc92)){_0x4dc16d[_0x1847('0xf3')](_0x5c3304,_0x1f5d04,_0x219934,_0xa96dc)[_0x1847('0x5b')](function(_0x1d8ef5){logger['info'](_0x1847('0xf4'),_0x1847('0xf5')+_0x5c3304[_0x1847('0x47')]+_0x1847('0xf6')+_0x5c3304[_0x1847('0x8d')],JSON[_0x1847('0x24')](_0x1d8ef5));ami[_0x1847('0x28')]('custom:agentcalled',ut[_0x1847('0x7d')](_0x5c3304,_0x1847('0xf7'),_0x4dc16d[_0x1847('0x22')][_0x5c3304[_0x1847('0x47')]]));_0x45b8ab(ut[_0x1847('0x2e')](_0x1847('0xf8')));})[_0x1847('0x51')](function(_0xaed1bc){ut['logger']('[Preview][execCall][failure]',_0xaed1bc);_0x337ed6(ut[_0x1847('0x2e')](_0x1847('0xf9'),_0x2c80cf,_0x28d2ea));});}else{_0x1f5d04[_0x1847('0xfa')]+=0x1;ut['logBlacklist'](_0x5c3304);rpcDb[_0x1847('0xfb')](_0x5c3304,_0x1847('0xfc'));delete _0x4dc16d['actions'][_0xda4547];_0x337ed6(ut[_0x1847('0x2e')]('Contact\x20in\x20black\x20List',_0x2c80cf,_0x28d2ea));}});};Preview[_0x1847('0x34')][_0x1847('0xfd')]=function(_0x4e9311){return!_[_0x1847('0x42')](_0x4e9311)&&!_['isNil'](_0x4e9311['name'])&&!_['isNil'](_0x4e9311[_0x1847('0xfe')])&&_0x4e9311[_0x1847('0xfe')]&&!_[_0x1847('0x42')](this[_0x1847('0x11')][util[_0x1847('0x25')]('SIP/%s',_0x4e9311[_0x1847('0x26')])])&&!_[_0x1847('0x42')](this[_0x1847('0x11')][util[_0x1847('0x25')](_0x1847('0xff'),_0x4e9311['name'])][_0x1847('0x4f')])&&(this[_0x1847('0x11')][util[_0x1847('0x25')](_0x1847('0xff'),_0x4e9311[_0x1847('0x26')])][_0x1847('0x4f')]==='reachable'||this[_0x1847('0x11')][util[_0x1847('0x25')]('SIP/%s',_0x4e9311['name'])][_0x1847('0x4f')]===_0x1847('0x100'));};Preview[_0x1847('0x34')][_0x1847('0x61')]=function(_0x257d4f,_0x5d73a7){return this['execRun'](_0x257d4f,_0x5d73a7)[_0x1847('0x5b')](function(_0xbf8649){return _['pick'](_0xbf8649,[_0x1847('0x2e')]);})[_0x1847('0x51')](function(_0xd10b64){if(_0xd10b64[_0x1847('0x101')]){rpcDb['unlockContact'](_0x257d4f);}if(_0xd10b64['active']){rpcDb[_0x1847('0x102')](_0x257d4f);}throw _['pick'](_0xd10b64,[_0x1847('0x2e')]);});};Preview[_0x1847('0x34')][_0x1847('0x103')]=function(_0x590abc,_0x33fa17){var _0x46a009=this;var _0x23bcb8,_0x490129;return rpcDb[_0x1847('0x104')](_0x590abc)[_0x1847('0x5b')](function(_0x48fdac){if(!_['isNil'](_0x48fdac[0x0])){_0x490129=_0x48fdac[0x0]['recallme']?![]:!![];_0x23bcb8=_0x48fdac[0x0][_0x1847('0x105')]?!![]:![];_0x23bcb8=_0x33fa17?!![]:_0x23bcb8;}var _0x19fe75=_0x46a009[_0x1847('0x106')](_0x48fdac);if(_0x19fe75['isValid']){rpcDb[_0x1847('0x107')](_['pick'](_0x48fdac[0x0],[_0x1847('0x4c'),'phone']))['then'](function(_0x3c8d51){_0x46a009[_0x1847('0xed')](_0x3c8d51,_0x48fdac[0x0],_0x33fa17,_0x490129,_0x23bcb8)['then'](function(_0x3ac66e){return _0x3ac66e;})[_0x1847('0x51')](function(_0x44cbe9){throw _0x44cbe9;});})[_0x1847('0x51')](function(_0x164e3b){ut[_0x1847('0x32')](_0x1847('0x108'),_0x164e3b);throw ut[_0x1847('0x2e')]('Call\x20unsuccessful',_0x490129,_0x23bcb8);});}else{throw ut[_0x1847('0x2e')](_0x19fe75[_0x1847('0x2e')],_0x490129,_0x23bcb8);}})[_0x1847('0x51')](function(_0x160bea){ut[_0x1847('0x32')](_0x1847('0x109'),_0x160bea);throw ut[_0x1847('0x2e')](_0x1847('0x10a'),![],!![]);});};Preview[_0x1847('0x34')][_0x1847('0x106')]=function(_0x5cddd2){if(_['isNil'](_0x5cddd2)||_[_0x1847('0xf2')](_0x5cddd2)||!_[_0x1847('0x42')](_0x5cddd2[0x0][_0x1847('0x5f')])&&_['isNil'](_0x5cddd2[0x0][_0x1847('0x5f')][_0x1847('0x26')])){ut['logger'](_0x1847('0x10b'),_0x5cddd2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x13f5e3=this['campaignsPreview'][_0x5cddd2[0x0][_0x1847('0x45')][_0x1847('0x26')]];_0x13f5e3[_0x1847('0x2e')]=utils['CAMPAIGN_STATUS'][_0x1847('0x76')];if(_[_0x1847('0x42')](_0x13f5e3)){ut[_0x1847('0x32')](_0x1847('0x10c'),_0x13f5e3);return{'isValid':![],'message':_0x1847('0x10d')};}if(!this['isTrunkReachable'](_0x13f5e3[_0x1847('0x74')])){ut[_0x1847('0x32')](_0x1847('0x10e'),'campaign\x20Name:\x20'+_0x13f5e3['name']+_0x1847('0x10f'));if(!this[_0x1847('0xfd')](_0x13f5e3['TrunkBackup'])){ut['logger'](_0x1847('0x10e'),_0x13f5e3[_0x1847('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x1847('0x110')};}}if(!ut[_0x1847('0x73')](_0x13f5e3[_0x1847('0x3c')])){ut[_0x1847('0x32')](_0x1847('0x111'),_0x13f5e3[_0x1847('0x26')]+_0x1847('0x112'));return{'isValid':![],'message':_0x1847('0x113')+_0x13f5e3[_0x1847('0x26')]+_0x1847('0x112')};}return{'isValid':!![],'message':_0x1847('0x114')};};Preview[_0x1847('0x34')]['execCall']=function(_0xad2275,_0x4f7b96,_0x10d150,_0x155262){var _0x50934e=this;return new Promise(function(_0x328caf,_0x41b836){var _0x570a8d=_0xad2275[_0x1847('0x91')];var _0x5b9c0d=_0x50934e[_0x1847('0xfd')](_0x4f7b96[_0x1847('0x74')])?util[_0x1847('0x25')](_0x1847('0x115'),_0x4f7b96[_0x1847('0x74')]['name'],_[_0x1847('0x42')](_0x4f7b96['dialPrefix'])?'':_0x4f7b96[_0x1847('0x116')][_0x1847('0x117')]()||'',_0x4f7b96[_0x1847('0x118')]>0x0?_0x10d150[_0x1847('0xef')][_0x1847('0x119')](_0x4f7b96[_0x1847('0x118')]):_0x10d150[_0x1847('0xef')]):util[_0x1847('0x25')](_0x1847('0x115'),_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x75')])?_0x4f7b96[_0x1847('0x74')][_0x1847('0x26')]:_0x4f7b96['TrunkBackup'][_0x1847('0x26')],_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x116')])?'':_0x4f7b96[_0x1847('0x116')][_0x1847('0x117')]()||'',_0x4f7b96[_0x1847('0x118')]>0x0?_0x10d150['phone']['substring'](_0x4f7b96[_0x1847('0x118')]):_0x10d150[_0x1847('0xef')]);var _0x1e4a0a=_0x50934e['isTrunkReachable'](_0x4f7b96['Trunk'])?ut[_0x1847('0x11a')](_0x4f7b96[_0x1847('0x74')][_0x1847('0x11b')],_0x4f7b96[_0x1847('0x11c')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x1847('0x11d')](_0x4f7b96[_0x1847('0x11e')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']):_0x4f7b96[_0x1847('0x11e')]):ut[_0x1847('0x11a')](_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x75')])?_0x4f7b96[_0x1847('0x74')][_0x1847('0x11b')]:_0x4f7b96['TrunkBackup']['callerid'],_0x4f7b96[_0x1847('0x11c')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x4f7b96[_0x1847('0x11e')],_0x4f7b96[_0x1847('0x11f')]):_0x4f7b96[_0x1847('0x11e')]);if(_0x1e4a0a){_0xad2275['originatecalleridname']=ut[_0x1847('0x120')](_0x1e4a0a);_0xad2275[_0x1847('0x121')]=ut[_0x1847('0x122')](_0x1e4a0a);}var _0x8a0fb8=ut[_0x1847('0x123')](_0x4f7b96,_0x10d150,_0x5b9c0d,_0x1e4a0a,_0x570a8d,_0xad2275);var _0x5f4111=utils[_0x1847('0x124')](_0x10d150['Contact']);Object[_0x1847('0x125')](_0x8a0fb8,_0x5f4111);_['merge'](_0xad2275,ut[_0x1847('0x126')](_0x8a0fb8));_0xad2275[_0x1847('0x63')]=moment()['format'](_0x1847('0x64'));_0x4f7b96['variables']=_0x8a0fb8;var _0x2c37e3=ut['variablesAction'](_0xad2275,_0x4f7b96,_0x8a0fb8,_0xad2275[_0x1847('0x8a')],_0x155262);return ami['Action'](_0x2c37e3)[_0x1847('0x5b')](function(_0x2d3360){_0x4f7b96[_0x1847('0x2a')]+=0x1;logger[_0x1847('0x23')](_0x1847('0x127'),_0x570a8d,_0x1847('0xa2'),_0x4f7b96[_0x1847('0x26')],_0x1847('0xd7'),_0x4f7b96[_0x1847('0x2a')]);_0x328caf(_0x2d3360);})[_0x1847('0x51')](function(_0xc37d5d){ut['logAgent'](_0xad2275,0xe,_0x1847('0x128'));rpcDb[_0x1847('0xe1')](_0xad2275,_0x1847('0x129'));_0x41b836(_0xc37d5d);});});};Preview[_0x1847('0x34')][_0x1847('0x1b')]=function(_0x55e64d){if(this[_0x1847('0x43')][_0x55e64d[_0x1847('0x8b')]]){this[_0x1847('0x43')][_0x55e64d[_0x1847('0x8b')]][_0x1847('0x50')]=_0x55e64d[_0x1847('0x50')];}};Preview[_0x1847('0x34')]['syncOriginateResponse']=function(_0x52bc8e){var _0x25711f=this;var _0x52050b=this[_0x1847('0x43')][_0x52bc8e[_0x1847('0x12a')]];if(_0x52050b){if(_0x52050b[_0x1847('0xf1')]&&this['agents'][_0x52050b[_0x1847('0xf1')]]){ut[_0x1847('0x12b')](_0x52050b,this[_0x1847('0x12')][_0x52050b[_0x1847('0xf1')]][_0x1847('0x26')],this[_0x1847('0x12')][_0x52050b['lookAgent']]['id']);}var _0x5efd58=_[_0x1847('0x12c')](_0x52050b);_0x5efd58['responsetime']=moment()[_0x1847('0x25')](_0x1847('0x64'));var _0x57794f=_0x25711f[_0x1847('0x22')][_0x52050b[_0x1847('0x47')]];if(ut['isFailure'](_0x52bc8e['response'])){if(_0x52050b[_0x1847('0xac')]){rpcDb['unlockContact'](_0x52050b[_0x1847('0x8d')]);}if(_0x52050b['activeContact']){rpcDb[_0x1847('0x102')](_0x52050b['idContact']);}ami[_0x1847('0x28')](_0x1847('0x12d'),ut['buildObj'](_0x52050b,_0x1847('0x12e'),this['campaignsPreview'][_0x52050b[_0x1847('0x47')]]));this['callProgressDetectingAgent'](_0x5efd58,_0x57794f,_0x52bc8e);}else{_0x52050b[_0x1847('0x63')]=moment()[_0x1847('0x25')](_0x1847('0x64'));ut[_0x1847('0xdf')](_0x5efd58,0x4,'Answer');rpcDb['createAgentHistory'](_0x5efd58,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1847('0x34')]['syncHangup']=function(_0x49fa07){var _0x527889=this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]];var _0x4d5f55;if(_0x527889){_0x4d5f55=this['campaignsPreview'][_0x527889['queue']];logger['info'](_0x1847('0x12f'),_0x49fa07[_0x1847('0x8b')],_0x1847('0xa2'),_0x4d5f55[_0x1847('0x26')],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);}if(this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]]&&_0x49fa07[_0x1847('0x8b')]!==_0x49fa07[_0x1847('0x91')]){if(_0x49fa07['cause']==='16'&&this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}else if(this['actions'][_0x49fa07[_0x1847('0x8b')]][_0x1847('0x48')]){logger[_0x1847('0x23')](_0x1847('0x131'),_0x49fa07['linkedid'],_0x49fa07[_0x1847('0x130')],_0x1847('0xa2'),_0x4d5f55[_0x1847('0x26')],'pTalking:\x20',_0x4d5f55[_0x1847('0x2b')]);this['callProgressDetectingCustomer'](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}}else if(_0x527889&&_['isNil'](_0x527889[_0x1847('0x132')])&&_0x4d5f55[_0x1847('0x133')]&&_0x49fa07[_0x1847('0x8b')]===_0x49fa07[_0x1847('0x91')]&&_[_0x1847('0x42')](_0x49fa07[_0x1847('0xde')])&&_0x49fa07[_0x1847('0x130')]==='16'&&_0x49fa07[_0x1847('0x134')]==='6'&&_[_0x1847('0xdd')](_0x527889[_0x1847('0x135')])){if(_0x527889['unlockAgent']){rpcDb[_0x1847('0x136')](_0x527889[_0x1847('0x8d')]);}if(_0x527889[_0x1847('0x8a')]){rpcDb[_0x1847('0x102')](_0x527889[_0x1847('0x8d')]);}_0x49fa07[_0x1847('0xde')]='22';this[_0x1847('0xdb')](_0x527889,_0x4d5f55,_0x49fa07);}else if(_0x527889&&_0x527889[_0x1847('0x135')]){if(_0x49fa07[_0x1847('0x130')]==='16'&&this[_0x1847('0x43')][_0x49fa07['linkedid']][_0x1847('0x48')]){logger['info']('[syncHangup][talking][transfer]',_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')],'\x20Queue',_0x4d5f55[_0x1847('0x26')],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);this[_0x1847('0x77')](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}else if(this['actions'][_0x49fa07[_0x1847('0x8b')]][_0x1847('0x48')]){logger[_0x1847('0x23')]('[syncHangup][talking][cause]',_0x49fa07[_0x1847('0x8b')],_0x49fa07['cause'],_0x1847('0xa2'),_0x4d5f55['name'],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);this[_0x1847('0x77')](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}}};Preview[_0x1847('0x34')]['syncDialEnd']=function(_0x5e5e6c){if(this[_0x1847('0x43')][_0x5e5e6c[_0x1847('0xd9')]]&&_0x5e5e6c[_0x1847('0xd9')]!==_0x5e5e6c['destuniqueid']){this['callProgressDetectingCustomer'](_0x5e5e6c,_0x5e5e6c[_0x1847('0xd9')],_0x5e5e6c[_0x1847('0xcf')]);}};Preview[_0x1847('0x34')]['syncHangupRequest']=function(_0x40df7b){if(this[_0x1847('0x43')][_0x40df7b[_0x1847('0x8b')]]&&_0x40df7b['linkedid']!==_0x40df7b[_0x1847('0x91')]&&!this[_0x1847('0x43')][_0x40df7b[_0x1847('0x8b')]][_0x1847('0x48')]){if(_0x40df7b['cause']==='1'){this[_0x1847('0x77')](_0x40df7b,_0x40df7b[_0x1847('0x8b')],_0x40df7b[_0x1847('0x130')]);}}};Preview[_0x1847('0x34')][_0x1847('0x137')]=function(_0x1bd103,_0x4ac2cc,_0x23266b){if(this['actions'][_0x1bd103]){if(_[_0x1847('0x42')](this[_0x1847('0x43')][_0x1bd103][_0x1847('0x138')])){this[_0x1847('0x43')][_0x1bd103]['variables']={};}this[_0x1847('0x43')][_0x1bd103][_0x1847('0x138')][_0x4ac2cc]=_0x23266b;}};Preview[_0x1847('0x34')][_0x1847('0x139')]=function(_0x2c8dd5){try{if(!_[_0x1847('0x42')](_0x2c8dd5)){if(ut[_0x1847('0x13a')](_[_0x1847('0x13b')](_0x2c8dd5[_0x1847('0x13c')])[0x0])){this['addVariable'](_0x2c8dd5[_0x1847('0x91')],_[_0x1847('0x13b')](_0x2c8dd5[_0x1847('0x13c')])[0x0],_0x2c8dd5[_0x1847('0x13d')]);}}}catch(_0x6ebc8a){logger[_0x1847('0x13e')](_0x1847('0x13f'),util['inspect'](_0x6ebc8a,{'showHidden':![],'depth':null}));}};Preview[_0x1847('0x34')][_0x1847('0x1e')]=function(_0x51fcf0){if(_0x51fcf0){if(this['actions'][_0x51fcf0[_0x1847('0x140')]]){this[_0x1847('0x43')][_0x51fcf0['transfertargetlinkedid']][_0x1847('0x135')]=!![];}}};Preview[_0x1847('0x34')][_0x1847('0x20')]=function(_0x50140d){if(_0x50140d){if(this[_0x1847('0x43')][_0x50140d[_0x1847('0x141')]]){this['actions'][_0x50140d[_0x1847('0x141')]][_0x1847('0x135')]=!![];}}};module[_0x1847('0x142')]=Preview; \ No newline at end of file +var _0x15bf=['[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','run','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','VoiceQueueId','checkInBlack','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridNumber','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','filterKey','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','type','outbound','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','isNil','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','ListId','Action','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','info','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','starttime','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','linkedid','actioncountonusuch','idContact','YYYY-MM-DD\x20HH:mm:ss','responsetime','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','activeContact','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','Global','dialCongestionMaxRetry','scheduledAt','countcongestionretry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry'];(function(_0x30355b,_0x133f13){var _0x3011c7=function(_0x57b9ca){while(--_0x57b9ca){_0x30355b['push'](_0x30355b['shift']());}};_0x3011c7(++_0x133f13);}(_0x15bf,0x7b));var _0xf15b=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x15bf[_0xa45395];return _0x3c83d2;};'use strict';var util=require(_0xf15b('0x0'));var _=require(_0xf15b('0x1'));var uuid=require('uuid');var moment=require(_0xf15b('0x2'));var Redis=require(_0xf15b('0x3'));var config=require(_0xf15b('0x4'));var logger=require(_0xf15b('0x5'))(_0xf15b('0x6'));var loggerAction=require(_0xf15b('0x5'))(_0xf15b('0x7'));var ami=require(_0xf15b('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xf15b('0x9'));var Action=require(_0xf15b('0xa'));var ut=require(_0xf15b('0xb'));var utils=require(_0xf15b('0xc'));config[_0xf15b('0xd')]=_['defaults'](config[_0xf15b('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xf15b('0xe'))(new Redis(config[_0xf15b('0xd')]));var Sequence=function(){};Sequence['prototype'][_0xf15b('0xf')]=function(_0x11368c){this['tail']=this[_0xf15b('0x10')]?this[_0xf15b('0x10')][_0xf15b('0x11')](_0x11368c):_0x11368c();};function Preview(_0x353a8c){this[_0xf15b('0x12')]=new Sequence();this[_0xf15b('0x13')]=_0x353a8c[_0xf15b('0x14')];this[_0xf15b('0x15')]=_0x353a8c['trunks'];this[_0xf15b('0x16')]={};this[_0xf15b('0x17')]=_0x353a8c['agents'];this[_0xf15b('0x18')]=0x0;ami['on'](_0xf15b('0x19'),this[_0xf15b('0x1a')][_0xf15b('0x1b')](this));ami['on'](_0xf15b('0x1c'),this[_0xf15b('0x1d')][_0xf15b('0x1b')](this));ami['on'](_0xf15b('0x1e'),this['syncHangupRequest'][_0xf15b('0x1b')](this));ami['on']('dialend',this[_0xf15b('0x1f')][_0xf15b('0x1b')](this));ami['on'](_0xf15b('0x20'),this[_0xf15b('0x21')][_0xf15b('0x1b')](this));ami['on'](_0xf15b('0x22'),this[_0xf15b('0x23')]['bind'](this));ami['on'](_0xf15b('0x24'),this['syncAttendedTransfer'][_0xf15b('0x1b')](this));ami['on']('blindtransfer',this[_0xf15b('0x25')][_0xf15b('0x1b')](this));this['loopCampaigns'](this[_0xf15b('0x13')]);}function emit(_0x219dae,_0x547c9b,_0x48b8ae){io['to'](_0x219dae)[_0xf15b('0x26')](_0x547c9b,_0x48b8ae);}function emitVoiceQueueChannelRemove(_0x4fde58){logger['info'](_0xf15b('0x27'),JSON[_0xf15b('0x28')](_0x4fde58));emit(util[_0xf15b('0x29')]('voice:queue:%s',_0x4fde58[_0xf15b('0x2a')]),_0xf15b('0x2b'),_0x4fde58);io['emit']('voice_queue_presence:remove',_0x4fde58);}function notSendMessagesQueue(_0x2c0f0d){if(_0x2c0f0d[_0xf15b('0x2c')]){if(_0x2c0f0d[_0xf15b('0x2d')]===0x0&&_0x2c0f0d[_0xf15b('0x2e')]===0x0){_0x2c0f0d[_0xf15b('0x2c')]=![];_0x2c0f0d[_0xf15b('0x2f')]=0x0;_0x2c0f0d[_0xf15b('0x30')]=0x0;_0x2c0f0d['message']=utils[_0xf15b('0x31')]['INACTIVE'];ut[_0xf15b('0x32')](_0xf15b('0x33'),_0x2c0f0d[_0xf15b('0x2a')]+_0xf15b('0x34'));}else{_0x2c0f0d[_0xf15b('0x35')]=utils[_0xf15b('0x31')][_0xf15b('0x36')];ut[_0xf15b('0x32')](_0xf15b('0x33'),_0x2c0f0d['name']+_0xf15b('0x37'));}}}Preview[_0xf15b('0x38')]['loopCampaigns']=function(){var _0x4f560c=this;setInterval(function(){_0x4f560c[_0xf15b('0x39')]();},0x7cf);};Preview[_0xf15b('0x38')][_0xf15b('0x39')]=function(){var _0x377db4=this[_0xf15b('0x13')];this[_0xf15b('0x18')]+=0x1;for(var _0x4f86b6 in _0x377db4){if(_0x377db4['hasOwnProperty'](_0x4f86b6)&&(_0x377db4[_0x4f86b6][_0xf15b('0x3a')]===_0xf15b('0x6')||_0x377db4[_0x4f86b6][_0xf15b('0x3a')]==='booked')&&_0x377db4[_0x4f86b6][_0xf15b('0x3b')]===_0xf15b('0x3c')){if(this[_0xf15b('0x18')]>0x7){this[_0xf15b('0x18')]=0x0;this[_0xf15b('0x3d')]();}}if(_0x377db4['hasOwnProperty'](_0x4f86b6)&&_0x377db4[_0x4f86b6][_0xf15b('0x3a')]===_0xf15b('0x6')&&_0x377db4[_0x4f86b6][_0xf15b('0x3b')]===_0xf15b('0x3c')){if(_0x377db4[_0x4f86b6][_0xf15b('0x3e')]){this['setMessage'](_0x377db4[_0x4f86b6]);if(_0x377db4[_0x4f86b6][_0xf15b('0x3f')])this['recallMe'](_0x377db4[_0x4f86b6]);}else{notSendMessagesQueue(_0x377db4[_0x4f86b6]);}}}};Preview[_0xf15b('0x38')]['clearZombieChannel']=function(_0x2d48d1){var _0x49e91d=this;this['sequence'][_0xf15b('0xf')](function(){if(!_[_0xf15b('0x40')](_0x49e91d['actions'][_0x2d48d1])){loggerAction['info']('[clearZombieChannels][talking]',_0x2d48d1,'Queue',_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')],_0xf15b('0x42'),JSON['stringify'](_0x49e91d['campaignsPreview'][_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')]][_0xf15b('0x2d')]),_0xf15b('0x43'),JSON['stringify'](_0x49e91d[_0xf15b('0x13')][_0x49e91d[_0xf15b('0x16')][_0x2d48d1]['queue']]['pTalking']),JSON[_0xf15b('0x28')](_0x49e91d[_0xf15b('0x16')][_0x2d48d1]['dialAnswer']),JSON[_0xf15b('0x28')](_[_0xf15b('0x44')](_0x49e91d[_0xf15b('0x16')][_0x2d48d1],[_0xf15b('0x45'),_0xf15b('0x46'),'VoiceQueueId',_0xf15b('0x47')])));return ami[_0xf15b('0x48')]({'action':'status','channel':_0x49e91d['actions'][_0x2d48d1][_0xf15b('0x49')]})[_0xf15b('0x4a')](function(_0x467c9e){if(_0x467c9e[_0xf15b('0x35')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x49e91d[_0xf15b('0x16')][_0x2d48d1]){ut[_0xf15b('0x4b')](_0x49e91d[_0xf15b('0x13')][_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')]],_0xf15b('0x4c'));if(_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x4d')]===!![]){ut[_0xf15b('0x4e')](_0x49e91d['campaignsPreview'][_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')]],_0xf15b('0x4c'));ut['loggerError'](_0xf15b('0x4f')+_0x2d48d1,_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')]);}ut[_0xf15b('0x50')](_0xf15b('0x51')+_0x2d48d1,_0x49e91d[_0xf15b('0x16')][_0x2d48d1][_0xf15b('0x41')]);delete _0x49e91d['actions'][_0x2d48d1];}},0x2328);}});}});};Preview[_0xf15b('0x38')][_0xf15b('0x3d')]=function(){var _0xcbb578=this;loggerAction[_0xf15b('0x52')](_0xf15b('0x53'),_[_0xf15b('0x54')](this[_0xf15b('0x16')]));for(var _0x4652a6 in this['actions']){if(_0xcbb578['actions']['hasOwnProperty'](_0x4652a6)){_0xcbb578[_0xf15b('0x55')](_0x4652a6);}}};Preview[_0xf15b('0x38')][_0xf15b('0x56')]=function(_0x4faea9){var _0x5dc66b=this;rpcDb[_0xf15b('0x57')](_0x4faea9['id'],ut['agentReadyId'](this[_0xf15b('0x17')]))[_0xf15b('0x58')](function(_0x53dadc){if(!_['isNil'](_0x53dadc)){for(var _0x365c4e=0x0;_0x365c4e<_0x53dadc[_0xf15b('0x59')];_0x365c4e+=0x1){if(ut[_0xf15b('0x5a')](_0x53dadc[_0x365c4e][_0xf15b('0x5b')])<_0x4faea9[_0xf15b('0x5c')]*0x3c){if(_0x53dadc[_0x365c4e][_0xf15b('0x5d')]&&!_0x53dadc[_0x365c4e][_0xf15b('0x5d')]['voicePause']){_0x5dc66b['run'](_0x53dadc[_0x365c4e]['id'])[_0xf15b('0x58')](ut[_0xf15b('0x5e')]('[RecallMe]'))[_0xf15b('0x4a')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x53dadc[_0x365c4e]['id']);}}else{var _0x550734=new Action(_0x53dadc[_0x365c4e],_0x4faea9);_0x550734[_0xf15b('0x5f')]=moment()[_0xf15b('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x4faea9[_0xf15b('0x60')]+=0x1;ut[_0xf15b('0x61')](_0x550734,0x17,'RecallInQueue');if(_0x4faea9['dialRecallInQueue']){rpcDb[_0xf15b('0x62')](ut[_0xf15b('0x63')](_0x53dadc[_0x365c4e]));rpcDb[_0xf15b('0x64')](_0x550734,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xf15b('0x61')](_0x550734,0x16,_0xf15b('0x65'));rpcDb[_0xf15b('0x64')](_0x550734,_0xf15b('0x66'));rpcDb[_0xf15b('0x67')](_0x550734,_0xf15b('0x66'));}}}}})[_0xf15b('0x4a')](ut[_0xf15b('0x5e')]('[getContactRecallMe]'));};Preview['prototype'][_0xf15b('0x68')]=function(_0x4b1fcb){_0x4b1fcb[_0xf15b('0x2c')]=!![];if(ut[_0xf15b('0x69')](_0x4b1fcb[_0xf15b('0x6a')])){_0x4b1fcb[_0xf15b('0x35')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0xf15b('0x6b')](_0x4b1fcb['dialActive'])){_0x4b1fcb[_0xf15b('0x35')]=utils['CAMPAIGN_STATUS'][_0xf15b('0x6c')];}else if(!this[_0xf15b('0x6d')](_0x4b1fcb['Trunk'])){if(!this[_0xf15b('0x6d')](_0x4b1fcb[_0xf15b('0x6e')])){_0x4b1fcb['message']=utils[_0xf15b('0x31')][_0xf15b('0x6f')];}else{_0x4b1fcb[_0xf15b('0x35')]=utils['CAMPAIGN_STATUS'][_0xf15b('0x70')];}}else{_0x4b1fcb[_0xf15b('0x35')]=utils[_0xf15b('0x31')][_0xf15b('0x70')];}};Preview[_0xf15b('0x38')][_0xf15b('0x71')]=function(_0x56843e,_0x8710f3,_0x58dc60){var _0x564eba=this;var _0xcbce73=this[_0xf15b('0x16')][_0x8710f3];var _0x3e56f1=this[_0xf15b('0x13')][_0xcbce73['queue']];var _0x4aeca4;var _0x5945af=![];var _0x401016=0x2;var _0x50bf74=0x3;if(_0x3e56f1){switch(_0x58dc60){case'1':_0x3e56f1['outboundNoSuchCallsDay']+=0x1;_0xcbce73[_0xf15b('0x72')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x0,_0xf15b('0x75'));ami[_0xf15b('0x26')](_0xf15b('0x76'),ut[_0xf15b('0x77')](_0xcbce73,'nosuchnumber'));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0x78'));_0x564eba[_0xf15b('0x79')](_0xcbce73,'0',_0x3e56f1)[_0xf15b('0x58')](function(_0x40c528){_0x5945af=_0x40c528['additional']==0x1;_0x401016=_0x3e56f1[_0xf15b('0x7a')];_0x50bf74=_0x3e56f1[_0xf15b('0x7b')];if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0xf,'Global');rpcDb[_0xf15b('0x67')](_0x4aeca4,_0xf15b('0x7e'));}else{if(_0xcbce73['countnosuchnumberretry']>=_0x3e56f1[_0xf15b('0x7f')]){rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0x7e'));}else{rpcDb[_0xf15b('0x80')](ut['scheduledAt'](_0xcbce73,'countnosuchnumberretry',_0x3e56f1[_0xf15b('0x7a')]),_0xcbce73['unlockAgent'],_0xcbce73['activeContact']);}}delete this[_0xf15b('0x16')][_0x56843e[_0xf15b('0x81')]];}else{_0xcbce73['countnosuchnumberretry']++;logger[_0xf15b('0x52')](_0xf15b('0x82'),_0xcbce73[_0xf15b('0x72')]);logger[_0xf15b('0x52')]('id',_0xcbce73[_0xf15b('0x83')]);_0x564eba['incrementPreviewCounters']({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countnosuchnumberretry':_0xcbce73[_0xf15b('0x72')]}})[_0xf15b('0x58')](function(){_0x564eba['swapAdditionalPhones'](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});});}});break;case'ANSWER':var _0x3d2edc=moment()['format'](_0xf15b('0x84'));_0xcbce73[_0xf15b('0x85')]=_0x3d2edc;_0xcbce73['answertime']=_0x3d2edc;_0xcbce73[_0xf15b('0x4d')]=!![];_0x3e56f1[_0xf15b('0x2e')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0xcbce73[_0xf15b('0x86')],_0xf15b('0x87'),_0x3e56f1[_0xf15b('0x2a')],_0xf15b('0x43'),_0x3e56f1['pTalking']);ami[_0xf15b('0x26')]('custom:agentconnect',ut['buildObj'](_0xcbce73,_0xf15b('0x88'),this[_0xf15b('0x13')][_0xcbce73['queue']]));if(_0x3e56f1['acw']){ami[_0xf15b('0x26')](_0xf15b('0x89'),ut[_0xf15b('0x8a')](_0xcbce73));}break;case'16':ami[_0xf15b('0x26')](_0xf15b('0x8b'),ut[_0xf15b('0x77')](_0xcbce73,'complete',this[_0xf15b('0x13')][_0xcbce73[_0xf15b('0x41')]]));emitVoiceQueueChannelRemove(ut[_0xf15b('0x77')](_0xcbce73,_0xf15b('0x8c')));_0x3e56f1['outboundAnswerCallsDay']+=0x1;_0x3e56f1[_0xf15b('0x8d')]+=0x1;_0x3e56f1[_0xf15b('0x8e')]+=0x1;ut['decrementTalkink'](_0x3e56f1,_0xf15b('0x8f'));_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x4,_0xf15b('0x90'));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0x91'));rpcDb['createCustomerFinal'](_0xcbce73,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0xcbce73);_0x3e56f1[_0xf15b('0x92')]+=_0xcbce73[_0xf15b('0x93')];_0x3e56f1[_0xf15b('0x94')]+=_0xcbce73['talktime'];logger['info'](_0xf15b('0x95'),_0xcbce73[_0xf15b('0x86')],_0xf15b('0x87'),_0x3e56f1[_0xf15b('0x2a')],'pTalking:\x20',_0x3e56f1[_0xf15b('0x2e')]);delete this[_0xf15b('0x16')][_0x56843e['linkedid']];break;case _0xf15b('0x96'):_0x3e56f1[_0xf15b('0x97')]+=0x1;_0xcbce73[_0xf15b('0x98')]+=0x1;_0xcbce73['countglobal']=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x5,_0xf15b('0x99'));_0x401016=_0x3e56f1[_0xf15b('0x9a')];_0x50bf74=_0x3e56f1[_0xf15b('0x7b')];ami[_0xf15b('0x26')]('custom:agentbusy',ut['buildObj'](_0xcbce73,_0xf15b('0x9b')));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0x9c'));_0x564eba['verifyAdditionalPhones'](_0xcbce73,'5',_0x3e56f1)['then'](function(_0xd8326a){_0x5945af=_0xd8326a[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0xf,'Global');rpcDb[_0xf15b('0x67')](_0x4aeca4,_0xf15b('0x9e'));}else{if(_0xcbce73[_0xf15b('0x98')]>=_0x3e56f1['dialBusyMaxRetry']){rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0x9c'));}else{rpcDb[_0xf15b('0x80')](ut['scheduledAt'](_0xcbce73,_0xf15b('0x98'),_0x3e56f1[_0xf15b('0x9a')]),_0xcbce73[_0xf15b('0x9f')],_0xcbce73[_0xf15b('0xa0')]);}}}else{_0xcbce73[_0xf15b('0x98')]++;_0x564eba[_0xf15b('0xa1')]({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countbusyretry':_0xcbce73['countbusyretry']}})[_0xf15b('0x58')](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});});}});break;case _0xf15b('0xa3'):_0x3e56f1[_0xf15b('0xa4')]+=0x1;_0xcbce73[_0xf15b('0xa5')]+=0x1;_0xcbce73['countglobal']=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x3,_0xf15b('0xa6'));_0x401016=_0x3e56f1[_0xf15b('0xa7')];_0x50bf74=_0x3e56f1['callAdditionalPhoneAfterMin'];var _0x578cdb=ut[_0xf15b('0xa8')](_0xcbce73,_0x3e56f1);ami[_0xf15b('0x26')](_0xf15b('0xa9'),_0x578cdb);rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xaa'));_0x564eba['verifyAdditionalPhones'](_0xcbce73,'3',_0x3e56f1)[_0xf15b('0x58')](function(_0x3447ec){_0x5945af=_0x3447ec['additional']==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut['cloneAction'](_0xcbce73,0xf,'Global');rpcDb[_0xf15b('0x67')](_0x4aeca4,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xcbce73[_0xf15b('0xa5')]>=_0x3e56f1[_0xf15b('0xab')]){rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0xaa'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xcbce73,_0xf15b('0xa5'),_0x3e56f1[_0xf15b('0xa7')]),_0xcbce73[_0xf15b('0x9f')],_0xcbce73['activeContact']);}}}else{_0xcbce73[_0xf15b('0xa5')]++;_0x564eba[_0xf15b('0xa1')]({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countnoanswerretry':_0xcbce73[_0xf15b('0xa5')]}})['then'](function(){_0x564eba['swapAdditionalPhones'](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});});}});break;case _0xf15b('0xac'):_0x3e56f1[_0xf15b('0xad')]+=0x1;_0xcbce73['countcongestionretry']+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x8,'Congestion');_0x401016=_0x3e56f1[_0xf15b('0xae')];_0x50bf74=_0x3e56f1[_0xf15b('0x7b')];ami[_0xf15b('0x26')]('custom:agentcongestion',ut[_0xf15b('0x77')](_0xcbce73,_0xf15b('0xaf')));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xb0'));_0x564eba[_0xf15b('0x79')](_0xcbce73,'8',_0x3e56f1)[_0xf15b('0x58')](function(_0x350ec1){_0x5945af=_0x350ec1['additional']==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0xf,_0xf15b('0xb1'));rpcDb[_0xf15b('0x67')](_0x4aeca4,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xcbce73['countcongestionretry']>=_0x3e56f1[_0xf15b('0xb2')]){rpcDb['createCustomerFinal'](_0xcbce73,_0xf15b('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0xf15b('0xb3')](_0xcbce73,_0xf15b('0xb4'),_0x3e56f1[_0xf15b('0x9a')]),_0xcbce73[_0xf15b('0x9f')],_0xcbce73[_0xf15b('0xa0')]);}}}else{_0xcbce73[_0xf15b('0xb4')]++;_0x564eba['incrementPreviewCounters']({'id':_0xcbce73['idContact'],'field':{'countcongestionretry':_0xcbce73[_0xf15b('0xb4')]}})[_0xf15b('0x58')](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)['then'](function(){});});}});break;case'CANCEL':_0x3e56f1[_0xf15b('0xb5')]+=0x1;_0xcbce73[_0xf15b('0xb6')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut[_0xf15b('0x61')](_0xcbce73,0x14,_0xf15b('0xb7'));_0x401016=_0x3e56f1['dialAgentRejectRetryFrequency'];_0x50bf74=_0x3e56f1[_0xf15b('0x7b')];ami[_0xf15b('0x26')](_0xf15b('0xb8'),ut[_0xf15b('0x77')](_0xcbce73,_0xf15b('0xb9')));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xba'));_0x564eba['verifyAdditionalPhones'](_0xcbce73,'20',_0x3e56f1)[_0xf15b('0x58')](function(_0x4dcc46){_0x5945af=_0x4dcc46[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0x14,_0xf15b('0xb7'));rpcDb['createCustomerFinal'](_0x4aeca4,_0xf15b('0xbb'));}else{if(_0xcbce73['countagentrejectretry']>=_0x3e56f1['dialAgentRejectMaxRetry']){rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0xbb'));}else{rpcDb[_0xf15b('0x80')](ut['scheduledAt'](_0xcbce73,_0xf15b('0xb6'),_0x3e56f1[_0xf15b('0xbc')]),_0xcbce73['unlockAgent'],_0xcbce73[_0xf15b('0xa0')]);}}}else{_0xcbce73[_0xf15b('0xa5')]++;_0x564eba[_0xf15b('0xa1')]({'id':_0xcbce73['idContact'],'field':{'countnoanswerretry':_0xcbce73[_0xf15b('0xa5')]}})[_0xf15b('0x58')](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)['then'](function(){});});}});break;case _0xf15b('0xbd'):_0x3e56f1['outboundAbandonedCallsDay']+=0x1;_0xcbce73[_0xf15b('0xbe')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut['totalGlobal'](_0xcbce73);ut['logCustomer'](_0xcbce73,0xb,'Abandoned');rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xbf'));_0x564eba['verifyAdditionalPhones'](_0xcbce73,'11',_0x3e56f1)['then'](function(_0x1b52e0){_0x5945af=_0x1b52e0[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0xf,'Global');rpcDb[_0xf15b('0x67')](_0x4aeca4,_0xf15b('0xbf'));}else{if(_0xcbce73[_0xf15b('0xc0')]>=_0x3e56f1['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0xcbce73,_0xf15b('0xbf'));}else{rpcDb[_0xf15b('0x80')](ut[_0xf15b('0xb3')](_0xcbce73,_0xf15b('0xbe'),_0x3e56f1[_0xf15b('0xc1')]),_0xcbce73[_0xf15b('0x9f')],_0xcbce73[_0xf15b('0xa0')]);}}}else{_0xcbce73['countnoanswerretry']++;_0x564eba[_0xf15b('0xa1')]({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countnoanswerretry':_0xcbce73[_0xf15b('0xa5')]}})[_0xf15b('0x58')](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});});}});break;case'18':_0x3e56f1[_0xf15b('0xc2')]+=0x1;_0xcbce73[_0xf15b('0xc3')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut['logCustomer'](_0xcbce73,0x12,_0x56843e['cause-txt']||_0x56843e[_0xf15b('0xc4')]);ami[_0xf15b('0x26')]('custom:amd',ut[_0xf15b('0x77')](_0xcbce73,'amd'));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xc5'));_0x564eba[_0xf15b('0x79')](_0xcbce73,'18',_0x3e56f1)['then'](function(_0x4a7a8c){_0x5945af=_0x4a7a8c[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut[_0xf15b('0x7d')](_0xcbce73,0x12,_0xf15b('0xb1'));rpcDb['createCustomerFinal'](_0x4aeca4,_0xf15b('0xc5'));}else{rpcDb[_0xf15b('0x67')](_0xcbce73,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0xcbce73[_0xf15b('0xa5')]++;_0x564eba[_0xf15b('0xa1')]({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countnoanswerretry':_0xcbce73[_0xf15b('0xa5')]}})['then'](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)['then'](function(){});});}});delete this[_0xf15b('0x16')][_0x56843e[_0xf15b('0x81')]];break;case'19':_0x3e56f1[_0xf15b('0xc2')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut['logCustomer'](_0xcbce73,0x13,_0x56843e[_0xf15b('0xc6')]||_0x56843e[_0xf15b('0xc4')]);ami[_0xf15b('0x26')](_0xf15b('0xc7'),ut[_0xf15b('0x77')](_0xcbce73,_0xf15b('0xc8')));rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xc9'));_0x564eba[_0xf15b('0x79')](_0xcbce73,'18',_0x3e56f1)[_0xf15b('0x58')](function(_0x321fd9){_0x5945af=_0x321fd9[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut['totalGlobal'](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut['cloneAction'](_0xcbce73,0xf,_0xf15b('0xb1'));rpcDb['createCustomerFinal'](_0x4aeca4,_0xf15b('0xc9'));}else{rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0xc9'));}}else{_0xcbce73[_0xf15b('0xa5')]++;_0x564eba['incrementPreviewCounters']({'id':_0xcbce73[_0xf15b('0x83')],'field':{'countnoanswerretry':_0xcbce73[_0xf15b('0xa5')]}})['then'](function(){_0x564eba[_0xf15b('0xa2')](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});});}});delete this['actions'][_0x56843e[_0xf15b('0x81')]];break;default:if(_0xcbce73[_0xf15b('0x4d')]){ut[_0xf15b('0x4e')](_0x3e56f1,'[default]');ut['loggerError'](_0xf15b('0xca')+_0x3e56f1[_0xf15b('0x2a')],_0x56843e);}_0x3e56f1[_0xf15b('0xc2')]+=0x1;_0xcbce73[_0xf15b('0x73')]=ut[_0xf15b('0x74')](_0xcbce73);ut['logCustomer'](_0xcbce73,0xc,_0x56843e[_0xf15b('0xc6')]||_0x56843e[_0xf15b('0xc4')]);_0x401016=_0x3e56f1[_0xf15b('0xbc')];_0x50bf74=_0x3e56f1[_0xf15b('0x7b')];rpcDb[_0xf15b('0x64')](_0xcbce73,_0xf15b('0xcb'));_0x564eba['verifyAdditionalPhones'](_0xcbce73,'20',_0x3e56f1)[_0xf15b('0x58')](function(_0x1bd350){_0x5945af=_0x1bd350[_0xf15b('0x9d')]==0x1;if(!_0x5945af){if(ut[_0xf15b('0x74')](_0xcbce73)>=_0x3e56f1[_0xf15b('0x7c')]){_0x4aeca4=ut['cloneAction'](_0xcbce73,0xf,'Global');rpcDb[_0xf15b('0x67')](_0x4aeca4,_0xf15b('0xcc'));}else{rpcDb[_0xf15b('0x67')](_0xcbce73,_0xf15b('0xcc'));}delete this['actions'][_0x56843e[_0xf15b('0x81')]];}else{_0x564eba['swapAdditionalPhones'](_0xcbce73,_0x401016,_0x50bf74)[_0xf15b('0x58')](function(){});}});}if(!(_0xcbce73[_0xf15b('0x4d')]&&_0x58dc60==='16')){ut[_0xf15b('0x4b')](_0x3e56f1,_0xf15b('0xcd'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0xcbce73[_0xf15b('0x86')],_0xf15b('0x87'),_0x3e56f1[_0xf15b('0x2a')],_0xf15b('0x42'),_0x3e56f1['originated']);}if(_0x58dc60!==_0xf15b('0xce')){delete this[_0xf15b('0x16')][_0x56843e[_0xf15b('0x81')]];delete this[_0xf15b('0x16')][_0x56843e[_0xf15b('0xcf')]];}_0x3e56f1[_0xf15b('0xd0')]=!![];}};Preview['prototype'][_0xf15b('0xd1')]=function(_0x4fe724,_0x56f821,_0x1a9f4b){if(_[_0xf15b('0xd2')](_0x56f821)&&_0xf15b('0xd3')!==typeof _0x56f821){return;}if(_[_0xf15b('0xd2')](_0x1a9f4b)&&_0xf15b('0xd3')!==typeof _0x1a9f4b){return;}switch(_0x1a9f4b[_0xf15b('0xd4')]){case'0':ut[_0xf15b('0xd5')](_0x4fe724,0x0,_0xf15b('0x75'));rpcDb[_0xf15b('0xd6')](_0x4fe724,_0xf15b('0xd7'));break;case'3':ut[_0xf15b('0xd5')](_0x4fe724,0x3,'NoAnswer');rpcDb[_0xf15b('0xd6')](_0x4fe724,_0xf15b('0xd8'));break;case'5':ut['logAgent'](_0x4fe724,0x5,_0xf15b('0x99'));rpcDb['createAgentHistory'](_0x4fe724,_0xf15b('0xd9'));break;case'8':ut[_0xf15b('0xd5')](_0x4fe724,0x8,_0xf15b('0xda'));rpcDb[_0xf15b('0xd6')](_0x4fe724,_0xf15b('0xdb'));break;case'22':ut[_0xf15b('0xd5')](_0x4fe724,0x16,_0xf15b('0xdc'));rpcDb[_0xf15b('0xd6')](_0x4fe724,_0xf15b('0xdd'));break;default:ut[_0xf15b('0xd5')](_0x4fe724,0xc,_0x1a9f4b[_0xf15b('0xd4')]);rpcDb[_0xf15b('0xd6')](_0x4fe724,_0xf15b('0xdb'));}ut[_0xf15b('0x4b')](_0x56f821,_0xf15b('0xde'));logger[_0xf15b('0x52')](_0xf15b('0xdf'),_0x4fe724[_0xf15b('0x86')],'\x20Queue',_0x56f821['name'],_0xf15b('0x42'),_0x56f821[_0xf15b('0x2d')]);delete this[_0xf15b('0x16')][_0x4fe724['uniqueid']];};Preview[_0xf15b('0x38')]['verifyAdditionalPhones']=function(_0x2d21f3,_0x2531a6,_0xdd380e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2d21f3,_0x2531a6,_0xdd380e)['catch'](logger[_0xf15b('0x52')](_0xf15b('0xe0')));};Preview[_0xf15b('0x38')][_0xf15b('0xa2')]=function(_0x528db5,_0x2e5913,_0x263e0b){return cmHopperAdditionalPhone[_0xf15b('0xa2')](_0x528db5,_0x2e5913,_0x263e0b)[_0xf15b('0x4a')](logger[_0xf15b('0x52')]('[swapAdditionalPhone]\x20'));};Preview['prototype']['incrementPreviewCounters']=function(_0x4b50e2){return Promise[_0xf15b('0xe1')]()['then'](cmHopperAdditionalPhone[_0xf15b('0xa1')](_0x4b50e2))[_0xf15b('0x4a')](logger[_0xf15b('0x52')]('[incrementPreviewCounters]\x20'));};Preview[_0xf15b('0x38')]['checkInBlack']=function(_0x5816c7,_0x288f77,_0x5e6ae7,_0x50f62d,_0x5e5d1f){var _0x43b6b9=this;return new Promise(function(_0x29cc83,_0x1aefe5){if(_[_0xf15b('0x40')](_0x288f77)||_[_0xf15b('0x40')](_0x288f77[_0xf15b('0xe2')])||_[_0xf15b('0x40')](_0x288f77[_0xf15b('0xe3')])||_[_0xf15b('0x40')](_0x288f77['VoiceQueueId'])){_0x1aefe5(ut['message'](_0xf15b('0xe4'),_0x50f62d,_0x5e5d1f));return;}var _0x1b3b21=uuid['v4']();var _0x31cb50=_0x43b6b9[_0xf15b('0x13')][_0x288f77[_0xf15b('0xe5')][_0xf15b('0x2a')]];var _0x205b85=_0x5e6ae7?_0x43b6b9[_0xf15b('0x17')][_0x5e6ae7]['id']:undefined;_0x43b6b9[_0xf15b('0x16')][_0x1b3b21]=new Action(_0x288f77,_0x31cb50,_0x1b3b21,_0x5e6ae7,_0x205b85);var _0x489514=_0x43b6b9[_0xf15b('0x16')][_0x1b3b21];_0x489514[_0xf15b('0x9f')]=_0x50f62d;_0x489514[_0xf15b('0xa0')]=_0x5e5d1f;_0x489514[_0xf15b('0xe6')]=_0x5e6ae7;if(_[_0xf15b('0xe7')](_0x5816c7)){_0x43b6b9[_0xf15b('0xe8')](_0x489514,_0x31cb50,_0x288f77,_0x5e6ae7)['then'](function(_0x474536){logger[_0xf15b('0x52')](_0xf15b('0xe9'),_0xf15b('0xea')+_0x489514['queue']+'\x20IdHopper:\x20'+_0x489514[_0xf15b('0x83')],JSON[_0xf15b('0x28')](_0x474536));ami[_0xf15b('0x26')](_0xf15b('0xeb'),ut[_0xf15b('0x77')](_0x489514,_0xf15b('0xec'),_0x43b6b9['campaignsPreview'][_0x489514[_0xf15b('0x41')]]));_0x29cc83(ut[_0xf15b('0x35')](_0xf15b('0xed')));})[_0xf15b('0x4a')](function(_0x3c64a6){ut[_0xf15b('0x32')](_0xf15b('0xee'),_0x3c64a6);_0x1aefe5(ut[_0xf15b('0x35')]('Call\x20failed',_0x50f62d,_0x5e5d1f));});}else{_0x31cb50[_0xf15b('0xef')]+=0x1;ut[_0xf15b('0xf0')](_0x489514);rpcDb['createHistory'](_0x489514,_0xf15b('0xf1'));delete _0x43b6b9[_0xf15b('0x16')][_0x1b3b21];_0x1aefe5(ut[_0xf15b('0x35')](_0xf15b('0xf2'),_0x50f62d,_0x5e5d1f));}});};Preview['prototype'][_0xf15b('0x6d')]=function(_0x2bc1cc){return!_[_0xf15b('0x40')](_0x2bc1cc)&&!_[_0xf15b('0x40')](_0x2bc1cc[_0xf15b('0x2a')])&&!_[_0xf15b('0x40')](_0x2bc1cc[_0xf15b('0xf3')])&&_0x2bc1cc[_0xf15b('0xf3')]&&!_[_0xf15b('0x40')](this[_0xf15b('0x15')][util['format']('SIP/%s',_0x2bc1cc[_0xf15b('0x2a')])])&&!_[_0xf15b('0x40')](this[_0xf15b('0x15')][util[_0xf15b('0x29')]('SIP/%s',_0x2bc1cc['name'])]['status'])&&(this[_0xf15b('0x15')][util[_0xf15b('0x29')](_0xf15b('0xf4'),_0x2bc1cc[_0xf15b('0x2a')])]['status']==='reachable'||this[_0xf15b('0x15')][util[_0xf15b('0x29')](_0xf15b('0xf4'),_0x2bc1cc[_0xf15b('0x2a')])][_0xf15b('0xf5')]==='unmonitored');};Preview['prototype'][_0xf15b('0xf6')]=function(_0xb07801,_0x5d8e05){return this[_0xf15b('0xf7')](_0xb07801,_0x5d8e05)[_0xf15b('0x58')](function(_0x3303ff){return _[_0xf15b('0x44')](_0x3303ff,[_0xf15b('0x35')]);})[_0xf15b('0x4a')](function(_0x153aa3){if(_0x153aa3[_0xf15b('0xf8')]){rpcDb[_0xf15b('0xf9')](_0xb07801);}if(_0x153aa3[_0xf15b('0xf3')]){rpcDb[_0xf15b('0xfa')](_0xb07801);}throw _[_0xf15b('0x44')](_0x153aa3,[_0xf15b('0x35')]);});};Preview[_0xf15b('0x38')]['execRun']=function(_0x1f0574,_0x24d521){var _0x322ea1=this;var _0x253f0d,_0x219993;return rpcDb[_0xf15b('0xfb')](_0x1f0574)[_0xf15b('0x58')](function(_0xf17f49){if(!_[_0xf15b('0x40')](_0xf17f49[0x0])){_0x219993=_0xf17f49[0x0][_0xf15b('0xfc')]?![]:!![];_0x253f0d=_0xf17f49[0x0][_0xf15b('0xfc')]?!![]:![];_0x253f0d=_0x24d521?!![]:_0x253f0d;}var _0x582bee=_0x322ea1[_0xf15b('0xfd')](_0xf17f49);if(_0x582bee['isValid']){rpcDb['checkIsBlackList'](_[_0xf15b('0x44')](_0xf17f49[0x0],[_0xf15b('0xfe'),_0xf15b('0xe3')]))[_0xf15b('0x58')](function(_0x20b29f){_0x322ea1[_0xf15b('0xff')](_0x20b29f,_0xf17f49[0x0],_0x24d521,_0x219993,_0x253f0d)[_0xf15b('0x58')](function(_0x2012d7){return _0x2012d7;})[_0xf15b('0x4a')](function(_0x347e3e){throw _0x347e3e;});})[_0xf15b('0x4a')](function(_0x110ff3){ut[_0xf15b('0x32')]('[Preview][checkIsBlackList]',_0x110ff3);throw ut['message']('Call\x20unsuccessful',_0x219993,_0x253f0d);});}else{throw ut[_0xf15b('0x35')](_0x582bee[_0xf15b('0x35')],_0x219993,_0x253f0d);}})[_0xf15b('0x4a')](function(_0x55baa2){ut[_0xf15b('0x32')](_0xf15b('0x100'),_0x55baa2);throw ut[_0xf15b('0x35')](_0xf15b('0x101'),![],!![]);});};Preview[_0xf15b('0x38')][_0xf15b('0xfd')]=function(_0x17f362){if(_[_0xf15b('0x40')](_0x17f362)||_[_0xf15b('0xe7')](_0x17f362)||!_[_0xf15b('0x40')](_0x17f362[0x0]['Agent'])&&_[_0xf15b('0x40')](_0x17f362[0x0]['Agent'][_0xf15b('0x2a')])){ut['logger'](_0xf15b('0x102'),_0x17f362);return{'isValid':![],'message':_0xf15b('0x103')};}var _0x1d6575=this[_0xf15b('0x13')][_0x17f362[0x0][_0xf15b('0xe5')]['name']];_0x1d6575[_0xf15b('0x35')]=utils[_0xf15b('0x31')][_0xf15b('0x70')];if(_[_0xf15b('0x40')](_0x1d6575)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x1d6575);return{'isValid':![],'message':_0xf15b('0x104')};}if(!this['isTrunkReachable'](_0x1d6575[_0xf15b('0x105')])){ut[_0xf15b('0x32')](_0xf15b('0x106'),'campaign\x20Name:\x20'+_0x1d6575[_0xf15b('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xf15b('0x6d')](_0x1d6575[_0xf15b('0x6e')])){ut[_0xf15b('0x32')](_0xf15b('0x106'),_0x1d6575['name']+_0xf15b('0x107'));return{'isValid':![],'message':_0xf15b('0x108')};}}if(!ut['isActive'](_0x1d6575[_0xf15b('0x3e')])){ut[_0xf15b('0x32')](_0xf15b('0x109'),_0x1d6575[_0xf15b('0x2a')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xf15b('0x10a')+_0x1d6575['name']+_0xf15b('0x10b')};}return{'isValid':!![],'message':_0xf15b('0x10c')};};Preview[_0xf15b('0x38')]['execCall']=function(_0x25cbd3,_0x527b31,_0xa9979e,_0x54955d){var _0x468b52=this;return new Promise(function(_0x28b36c,_0xc2778e){var _0x2ac4e9=_0x25cbd3[_0xf15b('0x86')];var _0x372a83=_0x468b52[_0xf15b('0x6d')](_0x527b31[_0xf15b('0x105')])?util[_0xf15b('0x29')](_0xf15b('0x10d'),_0x527b31[_0xf15b('0x105')][_0xf15b('0x2a')],_[_0xf15b('0x40')](_0x527b31[_0xf15b('0x10e')])?'':_0x527b31[_0xf15b('0x10e')][_0xf15b('0x10f')]()||'',_0x527b31['dialCutDigit']>0x0?_0xa9979e['phone']['substring'](_0x527b31[_0xf15b('0x110')]):_0xa9979e[_0xf15b('0xe3')]):util[_0xf15b('0x29')]('SIP/%s/%s%s',_['isNil'](_0x527b31[_0xf15b('0x6e')])?_0x527b31[_0xf15b('0x105')][_0xf15b('0x2a')]:_0x527b31[_0xf15b('0x6e')][_0xf15b('0x2a')],_['isNil'](_0x527b31[_0xf15b('0x10e')])?'':_0x527b31[_0xf15b('0x10e')]['trim']()||'',_0x527b31[_0xf15b('0x110')]>0x0?_0xa9979e[_0xf15b('0xe3')]['substring'](_0x527b31[_0xf15b('0x110')]):_0xa9979e['phone']);var _0x2a3857=_0x468b52[_0xf15b('0x6d')](_0x527b31[_0xf15b('0x105')])?ut[_0xf15b('0x111')](_0x527b31[_0xf15b('0x105')]['callerid'],_0x527b31[_0xf15b('0x112')],_0x527b31[_0xf15b('0x113')]>0x0?ut[_0xf15b('0x114')](_0x527b31[_0xf15b('0x115')],_0x527b31[_0xf15b('0x113')]):_0x527b31['dialOriginateCallerIdNumber']):ut[_0xf15b('0x111')](_['isNil'](_0x527b31[_0xf15b('0x6e')])?_0x527b31['Trunk']['callerid']:_0x527b31[_0xf15b('0x6e')][_0xf15b('0x116')],_0x527b31['dialOriginateCallerIdName'],_0x527b31['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xf15b('0x114')](_0x527b31['dialOriginateCallerIdNumber'],_0x527b31[_0xf15b('0x113')]):_0x527b31[_0xf15b('0x115')]);if(_0x2a3857){_0x25cbd3[_0xf15b('0x117')]=ut['extractCalleridName'](_0x2a3857);_0x25cbd3['originatecalleridnum']=ut[_0xf15b('0x118')](_0x2a3857);}var _0x82bfd2=ut['addVariables'](_0x527b31,_0xa9979e,_0x372a83,_0x2a3857,_0x2ac4e9,_0x25cbd3);var _0x3e68b6=utils[_0xf15b('0x119')](_0xa9979e[_0xf15b('0xe2')]);Object[_0xf15b('0x11a')](_0x82bfd2,_0x3e68b6);_[_0xf15b('0x11b')](_0x25cbd3,ut[_0xf15b('0x11c')](_0x82bfd2));_0x25cbd3[_0xf15b('0x5f')]=moment()['format'](_0xf15b('0x84'));_0x527b31[_0xf15b('0x11d')]=_0x82bfd2;var _0x33d571=ut[_0xf15b('0x11e')](_0x25cbd3,_0x527b31,_0x82bfd2,_0x25cbd3['activeContact'],_0x54955d);return ami[_0xf15b('0x48')](_0x33d571)['then'](function(_0x46be3a){_0x527b31[_0xf15b('0x2d')]+=0x1;logger['info'](_0xf15b('0x11f'),_0x2ac4e9,_0xf15b('0x87'),_0x527b31[_0xf15b('0x2a')],_0xf15b('0x42'),_0x527b31['originated']);_0x28b36c(_0x46be3a);})['catch'](function(_0x46da53){ut[_0xf15b('0xd5')](_0x25cbd3,0xe,'OriginateError');rpcDb[_0xf15b('0xd6')](_0x25cbd3,'[originateFailure][logOriginateFailure]');_0xc2778e(_0x46da53);});});};Preview[_0xf15b('0x38')]['syncNewExten']=function(_0x5a4c0a){if(this[_0xf15b('0x16')][_0x5a4c0a[_0xf15b('0x81')]]){this['actions'][_0x5a4c0a[_0xf15b('0x81')]][_0xf15b('0x49')]=_0x5a4c0a['channel'];}};Preview[_0xf15b('0x38')][_0xf15b('0x1a')]=function(_0x5a435a){var _0x2c06c2=this;var _0x108b7c=this[_0xf15b('0x16')][_0x5a435a[_0xf15b('0x120')]];if(_0x108b7c){if(_0x108b7c[_0xf15b('0xe6')]&&this[_0xf15b('0x17')][_0x108b7c[_0xf15b('0xe6')]]){ut[_0xf15b('0x121')](_0x108b7c,this['agents'][_0x108b7c[_0xf15b('0xe6')]][_0xf15b('0x2a')],this[_0xf15b('0x17')][_0x108b7c[_0xf15b('0xe6')]]['id']);}var _0x421e9a=_[_0xf15b('0x122')](_0x108b7c);_0x421e9a['responsetime']=moment()[_0xf15b('0x29')](_0xf15b('0x84'));var _0x1a5d23=_0x2c06c2[_0xf15b('0x13')][_0x108b7c['queue']];if(ut['isFailure'](_0x5a435a[_0xf15b('0x123')])){if(_0x108b7c['unlockAgent']){rpcDb[_0xf15b('0xf9')](_0x108b7c[_0xf15b('0x83')]);}if(_0x108b7c[_0xf15b('0xa0')]){rpcDb[_0xf15b('0xfa')](_0x108b7c['idContact']);}ami['emit'](_0xf15b('0x124'),ut['buildObj'](_0x108b7c,_0xf15b('0x125'),this[_0xf15b('0x13')][_0x108b7c[_0xf15b('0x41')]]));this[_0xf15b('0xd1')](_0x421e9a,_0x1a5d23,_0x5a435a);}else{_0x108b7c['starttime']=moment()['format'](_0xf15b('0x84'));ut['logAgent'](_0x421e9a,0x4,_0xf15b('0x90'));rpcDb[_0xf15b('0xd6')](_0x421e9a,_0xf15b('0x126'));}}};Preview[_0xf15b('0x38')]['syncHangup']=function(_0x50b6be){var _0x501737=this[_0xf15b('0x16')][_0x50b6be[_0xf15b('0x81')]];var _0x5e2812;if(_0x501737){_0x5e2812=this[_0xf15b('0x13')][_0x501737[_0xf15b('0x41')]];logger[_0xf15b('0x52')]('[syncHangup][talking]',_0x50b6be[_0xf15b('0x81')],_0xf15b('0x87'),_0x5e2812['name'],'pTalking:\x20',_0x5e2812[_0xf15b('0x2e')]);}if(this[_0xf15b('0x16')][_0x50b6be[_0xf15b('0x81')]]&&_0x50b6be[_0xf15b('0x81')]!==_0x50b6be[_0xf15b('0x86')]){if(_0x50b6be[_0xf15b('0x127')]==='16'&&this[_0xf15b('0x16')][_0x50b6be[_0xf15b('0x81')]][_0xf15b('0x4d')]){this['callProgressDetectingCustomer'](_0x50b6be,_0x50b6be[_0xf15b('0x81')],_0x50b6be[_0xf15b('0x127')]);}else if(this['actions'][_0x50b6be[_0xf15b('0x81')]][_0xf15b('0x4d')]){logger[_0xf15b('0x52')]('[syncHangup][talking][cause]',_0x50b6be['linkedid'],_0x50b6be[_0xf15b('0x127')],_0xf15b('0x87'),_0x5e2812[_0xf15b('0x2a')],_0xf15b('0x43'),_0x5e2812[_0xf15b('0x2e')]);this['callProgressDetectingCustomer'](_0x50b6be,_0x50b6be[_0xf15b('0x81')],_0x50b6be[_0xf15b('0x127')]);}}else if(_0x501737&&_[_0xf15b('0x40')](_0x501737[_0xf15b('0x128')])&&_0x5e2812[_0xf15b('0x129')]&&_0x50b6be['linkedid']===_0x50b6be[_0xf15b('0x86')]&&_[_0xf15b('0x40')](_0x50b6be[_0xf15b('0xd4')])&&_0x50b6be[_0xf15b('0x127')]==='16'&&_0x50b6be[_0xf15b('0x12a')]==='6'&&_['isUndefined'](_0x501737[_0xf15b('0x12b')])){if(_0x501737['unlockAgent']){rpcDb[_0xf15b('0xf9')](_0x501737[_0xf15b('0x83')]);}if(_0x501737[_0xf15b('0xa0')]){rpcDb[_0xf15b('0xfa')](_0x501737[_0xf15b('0x83')]);}_0x50b6be[_0xf15b('0xd4')]='22';this[_0xf15b('0xd1')](_0x501737,_0x5e2812,_0x50b6be);}else if(_0x501737&&_0x501737[_0xf15b('0x12b')]){if(_0x50b6be[_0xf15b('0x127')]==='16'&&this[_0xf15b('0x16')][_0x50b6be[_0xf15b('0x81')]][_0xf15b('0x4d')]){logger[_0xf15b('0x52')](_0xf15b('0x12c'),_0x50b6be[_0xf15b('0x81')],_0x50b6be['cause'],'\x20Queue',_0x5e2812['name'],_0xf15b('0x43'),_0x5e2812[_0xf15b('0x2e')]);this[_0xf15b('0x71')](_0x50b6be,_0x50b6be[_0xf15b('0x81')],_0x50b6be['cause']);}else if(this[_0xf15b('0x16')][_0x50b6be['linkedid']][_0xf15b('0x4d')]){logger[_0xf15b('0x52')](_0xf15b('0x12d'),_0x50b6be[_0xf15b('0x81')],_0x50b6be[_0xf15b('0x127')],'\x20Queue',_0x5e2812[_0xf15b('0x2a')],'pTalking:\x20',_0x5e2812[_0xf15b('0x2e')]);this['callProgressDetectingCustomer'](_0x50b6be,_0x50b6be['linkedid'],_0x50b6be[_0xf15b('0x127')]);}}};Preview[_0xf15b('0x38')][_0xf15b('0x1f')]=function(_0x22e374){if(this['actions'][_0x22e374[_0xf15b('0xcf')]]&&_0x22e374['destlinkedid']!==_0x22e374[_0xf15b('0x12e')]){this[_0xf15b('0x71')](_0x22e374,_0x22e374['destlinkedid'],_0x22e374[_0xf15b('0xc4')]);}};Preview[_0xf15b('0x38')]['syncHangupRequest']=function(_0x34a620){if(this['actions'][_0x34a620[_0xf15b('0x81')]]&&_0x34a620['linkedid']!==_0x34a620['uniqueid']&&!this[_0xf15b('0x16')][_0x34a620[_0xf15b('0x81')]][_0xf15b('0x4d')]){if(_0x34a620[_0xf15b('0x127')]==='1'){this['callProgressDetectingCustomer'](_0x34a620,_0x34a620[_0xf15b('0x81')],_0x34a620[_0xf15b('0x127')]);}}};Preview[_0xf15b('0x38')][_0xf15b('0x12f')]=function(_0x3aead1,_0x3de923,_0x3fb602){if(this['actions'][_0x3aead1]){if(_[_0xf15b('0x40')](this['actions'][_0x3aead1][_0xf15b('0x11d')])){this[_0xf15b('0x16')][_0x3aead1][_0xf15b('0x11d')]={};}this[_0xf15b('0x16')][_0x3aead1][_0xf15b('0x11d')][_0x3de923]=_0x3fb602;}};Preview['prototype']['syncVarSet']=function(_0x35ea02){try{if(!_['isNil'](_0x35ea02)){if(ut[_0xf15b('0x130')](_['keys'](_0x35ea02['variable'])[0x0])){this[_0xf15b('0x12f')](_0x35ea02[_0xf15b('0x86')],_['keys'](_0x35ea02[_0xf15b('0x131')])[0x0],_0x35ea02[_0xf15b('0x132')]);}}}catch(_0x932c11){logger[_0xf15b('0x133')](_0xf15b('0x134'),util[_0xf15b('0x135')](_0x932c11,{'showHidden':![],'depth':null}));}};Preview[_0xf15b('0x38')][_0xf15b('0x136')]=function(_0x5de412){if(_0x5de412){if(this[_0xf15b('0x16')][_0x5de412[_0xf15b('0x137')]]){this[_0xf15b('0x16')][_0x5de412[_0xf15b('0x137')]][_0xf15b('0x12b')]=!![];}}};Preview['prototype'][_0xf15b('0x25')]=function(_0x552930){if(_0x552930){if(this[_0xf15b('0x16')][_0x552930[_0xf15b('0x138')]]){this['actions'][_0x552930[_0xf15b('0x138')]]['transfer']=!![];}}};module[_0xf15b('0x139')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 09d10f0..4370f64 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 _0x6920=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6920,0x1c7));var _0x0692=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x6920[_0x1e2080];return _0x260111;};'use strict';var util=require(_0x0692('0x0'));var BPromise=require('bluebird');var logger=require(_0x0692('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x0692('0x2'));var cmHopperBlack=require(_0x0692('0x3'));var agentReportPreview=require(_0x0692('0x4'));var voiceQueueReport=require(_0x0692('0x5'));function loggerCatch(_0x25ac5a){return function(_0x44f17d){logger[_0x0692('0x6')](_0x25ac5a,util[_0x0692('0x7')](_0x44f17d,{'showHidden':![],'depth':null}));};}function create(_0x46f0cf){return cmHopperHistory[_0x0692('0x8')](_0x46f0cf)['catch'](loggerCatch(_0x0692('0x9')));}function createAgent(_0x51ffd6){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x51ffd6))[_0x0692('0xa')](loggerCatch(_0x0692('0x9')));}function moveContact(_0x4b3201){return cmHopper[_0x0692('0xb')](_0x4b3201,!![])[_0x0692('0xa')](loggerCatch(_0x0692('0xc')));}exports[_0x0692('0xd')]=function(_0x3e85ba){return cmHopperBlack[_0x0692('0xd')](_0x3e85ba)[_0x0692('0xa')](loggerCatch(_0x0692('0xe')));};exports[_0x0692('0xf')]=function(_0x2768d4){return BPromise[_0x0692('0x10')]()[_0x0692('0x11')](cmHopper[_0x0692('0xf')](_0x2768d4))[_0x0692('0xa')](loggerCatch(_0x0692('0x12')));};exports[_0x0692('0x8')]=function(_0x4de618,_0x4ade18){create(_0x4de618)[_0x0692('0xa')](loggerCatch(_0x4ade18));moveContact(_0x4de618)[_0x0692('0xa')](loggerCatch(_0x4ade18));};exports[_0x0692('0x13')]=function(_0x4f08fd,_0x39bb4e){createAgent(_0x4f08fd)[_0x0692('0xa')](loggerCatch(_0x39bb4e));};exports[_0x0692('0x14')]=function(_0x510829,_0x2463ef){create(_0x510829)[_0x0692('0xa')](loggerCatch(_0x2463ef));};exports[_0x0692('0x15')]=function(_0x36b533,_0x28db6f){moveContact(_0x36b533)[_0x0692('0xa')](loggerCatch(_0x28db6f));};exports['rescheduleContact']=function(_0x3c4eb5,_0x1c7acd,_0x2b29d1){if(_0x1c7acd){_0x3c4eb5['UserId']=null;}if(_0x2b29d1){_0x3c4eb5['active']=![];}return cmHopper[_0x0692('0x16')](_0x3c4eb5)[_0x0692('0xa')](loggerCatch(_0x0692('0x17')));};exports[_0x0692('0x18')]=function(_0x247a2d){return cmHopper['countReScheduled'](_0x247a2d)[_0x0692('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x0692('0x19')]=function(_0x238c66){return cmHopper['unlockContact']({'UserId':null},_0x238c66,0x1)[_0x0692('0xa')](loggerCatch(_0x0692('0x1a')));};exports[_0x0692('0x1b')]=function(_0x53d3ff){return cmHopper[_0x0692('0x19')]({'active':![]},_0x53d3ff,0x1)[_0x0692('0xa')](loggerCatch(_0x0692('0x1c')));};exports[_0x0692('0x1d')]=function(_0x397ca1){var _0x44ab81={};_0x44ab81[_0x0692('0x1e')]=_0x397ca1['type'];_0x44ab81[_0x0692('0x1f')]=_0x397ca1[_0x0692('0x1f')];_0x44ab81['calleridnum']=_0x397ca1[_0x0692('0x20')];_0x44ab81[_0x0692('0x21')]=_0x397ca1[_0x0692('0x21')];_0x44ab81[_0x0692('0x22')]=_0x397ca1[_0x0692('0x22')];_0x44ab81[_0x0692('0x23')]=_0x397ca1[_0x0692('0x24')];_0x44ab81['queuecallerleaveAt']=_0x397ca1[_0x0692('0x24')];_0x44ab81[_0x0692('0x25')]=0x1;_0x44ab81[_0x0692('0x26')]=_0x397ca1[_0x0692('0x27')];_0x44ab81[_0x0692('0x28')]=_0x397ca1[_0x0692('0x29')];_0x44ab81[_0x0692('0x2a')]=_0x0692('0x2b');_0x44ab81[_0x0692('0x2c')]=_0x0692('0x2d');_0x44ab81['holdtime']=0x0;_0x44ab81[_0x0692('0x2e')]=0x1;_0x44ab81[_0x0692('0x2f')]=_0x397ca1[_0x0692('0x29')];_0x44ab81[_0x0692('0x30')]=_0x0692('0x31');return BPromise[_0x0692('0x10')]()['then'](voiceQueueReport[_0x0692('0x32')](_0x44ab81))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0692('0x33')]=function(_0x343e59,_0x529cb2){return BPromise[_0x0692('0x10')]()[_0x0692('0x11')](cmHopper['getContactRecallMe'](_0x343e59,_0x529cb2))['catch'](loggerCatch(_0x0692('0x34')));};exports[_0x0692('0x35')]=function(_0x5c6896){return cmHopper[_0x0692('0x16')](_0x5c6896,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5304=['type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','resolve','[getContactPreview]\x20','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue'];(function(_0x179b74,_0x5dc97d){var _0x268f76=function(_0x19c8c2){while(--_0x19c8c2){_0x179b74['push'](_0x179b74['shift']());}};_0x268f76(++_0x5dc97d);}(_0x5304,0x1ed));var _0x4530=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x5304[_0x1e3c16];return _0x47a0c9;};'use strict';var util=require(_0x4530('0x0'));var BPromise=require(_0x4530('0x1'));var logger=require('../../../config/logger')(_0x4530('0x2'));var cmHopper=require(_0x4530('0x3'));var cmHopperHistory=require(_0x4530('0x4'));var cmHopperBlack=require(_0x4530('0x5'));var agentReportPreview=require(_0x4530('0x6'));var voiceQueueReport=require(_0x4530('0x7'));function loggerCatch(_0xfbacf7){return function(_0xcd8300){logger['error'](_0xfbacf7,util[_0x4530('0x8')](_0xcd8300,{'showHidden':![],'depth':null}));};}function create(_0x4e52b0){return cmHopperHistory['createHistory'](_0x4e52b0)[_0x4530('0x9')](loggerCatch(_0x4530('0xa')));}function createAgent(_0x35983b){return BPromise['resolve']()[_0x4530('0xb')](agentReportPreview[_0x4530('0xc')](_0x35983b))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x51ca2e){return cmHopper[_0x4530('0xd')](_0x51ca2e,!![])[_0x4530('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x4530('0xe')]=function(_0x249160){return cmHopperBlack[_0x4530('0xe')](_0x249160)['catch'](loggerCatch(_0x4530('0xf')));};exports['getContactPreview']=function(_0x1bfade){return BPromise[_0x4530('0x10')]()[_0x4530('0xb')](cmHopper['getContactPreview'](_0x1bfade))['catch'](loggerCatch(_0x4530('0x11')));};exports[_0x4530('0xc')]=function(_0x2f07b0,_0xb4cf45){create(_0x2f07b0)[_0x4530('0x9')](loggerCatch(_0xb4cf45));moveContact(_0x2f07b0)[_0x4530('0x9')](loggerCatch(_0xb4cf45));};exports['createAgentHistory']=function(_0x3c8d85,_0x59aacc){createAgent(_0x3c8d85)['catch'](loggerCatch(_0x59aacc));};exports['createCustomerHistory']=function(_0x3c2b1f,_0x3562c6){create(_0x3c2b1f)['catch'](loggerCatch(_0x3562c6));};exports[_0x4530('0x12')]=function(_0x33348c,_0x371149){moveContact(_0x33348c)['catch'](loggerCatch(_0x371149));};exports['rescheduleContact']=function(_0x15465a,_0x346c8a,_0x5aecbb){if(_0x346c8a){_0x15465a[_0x4530('0x13')]=null;}if(_0x5aecbb){_0x15465a[_0x4530('0x14')]=![];}return cmHopper[_0x4530('0x15')](_0x15465a)[_0x4530('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x4530('0x16')]=function(_0x172d24){return cmHopper[_0x4530('0x16')](_0x172d24)['catch'](loggerCatch(_0x4530('0x17')));};exports[_0x4530('0x18')]=function(_0x2800f5){return cmHopper[_0x4530('0x18')]({'UserId':null},_0x2800f5,0x1)[_0x4530('0x9')](loggerCatch(_0x4530('0x19')));};exports['disableContact']=function(_0x2c4cd8){return cmHopper[_0x4530('0x18')]({'active':![]},_0x2c4cd8,0x1)[_0x4530('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x4530('0x1a')]=function(_0x3a7dfb){var _0xf657da={};_0xf657da[_0x4530('0x1b')]=_0x3a7dfb[_0x4530('0x1b')];_0xf657da['uniqueid']=_0x3a7dfb[_0x4530('0x1c')];_0xf657da[_0x4530('0x1d')]=_0x3a7dfb['calleridnum'];_0xf657da[_0x4530('0x1e')]=_0x3a7dfb[_0x4530('0x1e')];_0xf657da[_0x4530('0x1f')]=_0x3a7dfb['queue'];_0xf657da['queuecallerjoinAt']=_0x3a7dfb[_0x4530('0x20')];_0xf657da[_0x4530('0x21')]=_0x3a7dfb[_0x4530('0x20')];_0xf657da['queuecallercomplete']=0x1;_0xf657da[_0x4530('0x22')]=_0x3a7dfb[_0x4530('0x23')];_0xf657da[_0x4530('0x24')]=_0x3a7dfb[_0x4530('0x25')];_0xf657da[_0x4530('0x26')]=_0x4530('0x27');_0xf657da[_0x4530('0x28')]=_0x4530('0x29');_0xf657da[_0x4530('0x2a')]=0x0;_0xf657da[_0x4530('0x2b')]=0x1;_0xf657da[_0x4530('0x2c')]=_0x3a7dfb['membername'];_0xf657da['queuecallerexitreason']=_0x4530('0x2d');return BPromise['resolve']()[_0x4530('0xb')](voiceQueueReport[_0x4530('0x2e')](_0xf657da))[_0x4530('0x9')](loggerCatch(_0x4530('0x2f')));};exports['getContactRecallMe']=function(_0x34a292,_0x50c015){return BPromise[_0x4530('0x10')]()[_0x4530('0xb')](cmHopper[_0x4530('0x30')](_0x34a292,_0x50c015))[_0x4530('0x9')](loggerCatch(_0x4530('0x31')));};exports[_0x4530('0x32')]=function(_0x391653){return cmHopper[_0x4530('0x15')](_0x391653,!![],!![])['catch'](loggerCatch(_0x4530('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 2cd4b1f..7d39d3d 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 _0xdf19=['ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','channelAgent','voice','buildObj','buildAcw','uniqueid','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','XCALLY_IP_AGI','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','isNil','addVariables','name','format','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','responsetime','logLookAgent','membername','UserId','logCustomer','answertime','getSeconds','isFailure','Failure','RECALL','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add'];(function(_0x566051,_0x1ccdaa){var _0x54b3cb=function(_0x2dadff){while(--_0x2dadff){_0x566051['push'](_0x566051['shift']());}};_0x54b3cb(++_0x1ccdaa);}(_0xdf19,0x151));var _0x9df1=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0xdf19[_0x1dd8f6];return _0xf083b7;};'use strict';var util=require(_0x9df1('0x0'));var _=require(_0x9df1('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x9df1('0x2'));var ipAgi=process['env'][_0x9df1('0x3')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x9df1('0x4')]=function(_0x3f1f86){return function(_0x4b10f5){logger[_0x9df1('0x5')](_0x3f1f86,util[_0x9df1('0x6')](_0x4b10f5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x42fb07,_0xd392c5){logger[_0x9df1('0x7')](_0x42fb07,util[_0x9df1('0x6')](_0xd392c5,{'showHidden':![],'depth':null}));};exports[_0x9df1('0x8')]=function(_0x1de9a6,_0x167817){logger[_0x9df1('0x5')](_0x1de9a6,util[_0x9df1('0x6')](_0x167817,{'showHidden':![],'depth':null}));};exports[_0x9df1('0x9')]=function(_0xd93a82){return function(_0x17647a){logger[_0x9df1('0x7')](_0xd93a82,util['inspect'](_0x17647a,{'showHidden':![],'depth':null}));};};exports[_0x9df1('0xa')]=function(_0x5f28f3,_0xcf6722,_0x2ca911){return{'message':_0x5f28f3,'unlock':_0xcf6722,'active':_0x2ca911};};exports[_0x9df1('0xb')]=function(_0x99082e,_0x391017,_0x35c9f2){if(!_['isUndefined'](_0x35c9f2)&&_0x9df1('0xc')===typeof _0x35c9f2&&!_[_0x9df1('0xd')](_0x35c9f2)){if(!_[_0x9df1('0xe')](_0x391017)&&'string'===typeof _0x391017&&!_[_0x9df1('0xd')](_0x391017)){return util['format']('\x22%s\x22\x20<%s>',_0x391017,_0x35c9f2);}return util['format']('\x22%s\x22\x20<%s>',_0x35c9f2,_0x35c9f2);}if(!_[_0x9df1('0xe')](_0x99082e)&&_0x9df1('0xc')===typeof _0x99082e&&!_[_0x9df1('0xd')](_0x99082e)){return _0x99082e;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x3463bf){if(_[_0x9df1('0xf')](_0x3463bf)){return![];}return _0x3463bf;};exports[_0x9df1('0x10')]=function(_0x28ecac,_0x557eff,_0xcbbfa3,_0x61e441,_0x1a978c,_0x2f95bb){var _0x4fc9e0={'XMD-QUEUE':_0x557eff['Queue']?_0x557eff['Queue'][_0x9df1('0x11')]:'','XMD-CALLERID':_0x61e441,'XMD-CALLERID-PREVIEW':_0x2f95bb?util[_0x9df1('0x12')](_0x9df1('0x13'),_0x2f95bb[_0x9df1('0x14')],_0x2f95bb[_0x9df1('0x15')]):_0x61e441,'XMD-DIALID':_0x1a978c,'XMD-CONTACTID':_0x557eff['ContactId'],'XMD-CDRTYPE':_0x9df1('0x16'),'CALLERID(all)':_0x61e441,'XMD-VOICEQUEUEID':_0x557eff['VoiceQueueId'],'XMD-DIALCHANNEL':_0xcbbfa3,'XMD-DIALTIMEOUT':_0x28ecac[_0x9df1('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x9df1('0x12')](_0x9df1('0x18'),_0x28ecac[_0x9df1('0x19')]?'g':'',_['isEmpty'](_0x28ecac[_0x9df1('0x1a')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x28ecac[_0x9df1('0x1b')]||'','XMD-AGI':_0x28ecac['dialQueueProject']?util[_0x9df1('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x28ecac[_0x9df1('0x1c')]):_0x9df1('0x1d'),'XMD-AGIAFTER':_0x28ecac['dialQueueProject2']?util[_0x9df1('0x12')](_0x9df1('0x1e'),ipAgi,_0x28ecac[_0x9df1('0x19')]):_0x9df1('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x2f95bb?_0x2f95bb[_0x9df1('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f95bb?_0x2f95bb[_0x9df1('0x20')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9df1('0x21')};if(!_[_0x9df1('0xd')](_0x28ecac[_0x9df1('0x1a')])){_0x4fc9e0[util['format']('%s',_0x9df1('0x22'))]=_0x28ecac[_0x9df1('0x1a')];_0x4fc9e0[util[_0x9df1('0x12')]('%s',_0x9df1('0x23'))]=_0x1a978c;}return _0x4fc9e0;};exports[_0x9df1('0x24')]=function(_0x38ff55){var _0x5d9976={};for(var _0x1eff4a in _0x38ff55){if(_0x38ff55[_0x9df1('0x25')](_0x1eff4a)){_0x5d9976[util[_0x9df1('0x12')]('%s',_[_0x9df1('0x26')](_0x1eff4a))]=_0x38ff55[_0x1eff4a];}}return{'variables':_0x5d9976};};exports[_0x9df1('0x27')]=function(_0x429ef6,_0x8d98f2){if(!_[_0x9df1('0xf')](_0x429ef6)){if(_0x429ef6[_0x9df1('0x25')](_0x9df1('0x28'))){if(_0x429ef6[_0x9df1('0x28')]>0x0){_0x429ef6[_0x9df1('0x28')]-=0x1;}else{logger['error'](_0x9df1('0x29'),_0x8d98f2);}}}else{logger[_0x9df1('0x5')](_0x9df1('0x2a'),_0x8d98f2);}};exports[_0x9df1('0x2b')]=function(_0x9c9c71){var _0x4e2d1f=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0x9c9c71['state']=0xd;_0x9c9c71[_0x9df1('0x2d')]=_0x9df1('0x2e');_0x9c9c71[_0x9df1('0x2f')]=_0x4e2d1f;_0x9c9c71['responsetime']=_0x4e2d1f;_0x9c9c71[_0x9df1('0x30')]=_0x4e2d1f;};exports[_0x9df1('0x31')]=function(_0xe13170,_0x287008,_0x2f5f11){var _0x49faa9=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0xe13170[_0x9df1('0x32')]=_0x287008;_0xe13170[_0x9df1('0x2d')]=_0x2f5f11;_0xe13170[_0x9df1('0x33')]=_0x49faa9;_0xe13170['ringtime']=utils['getSeconds'](_0xe13170[_0x9df1('0x33')],_0xe13170['starttime']);};exports[_0x9df1('0x34')]=function(_0x1d1420,_0x43b48f,_0xb4412){_0x1d1420[_0x9df1('0x35')]=_0x43b48f;_0x1d1420[_0x9df1('0x36')]=_0xb4412;};exports[_0x9df1('0x37')]=function(_0x21713d,_0xcd75eb,_0x286c4b){var _0x335c22=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0x21713d[_0x9df1('0x32')]=_0xcd75eb;_0x21713d[_0x9df1('0x2d')]=_0x286c4b;_0x21713d['responsetime']=_0x21713d[_0x9df1('0x33')]?_0x21713d[_0x9df1('0x33')]:_0x335c22;_0x21713d[_0x9df1('0x30')]=_0x21713d[_0x9df1('0x30')]?_0x21713d['endtime']:_0x335c22;_0x21713d['ringtime']=utils['getSeconds'](_0x21713d['responsetime']||0x0,_0x21713d[_0x9df1('0x2f')]||0x0);_0x21713d['talktime']=_0x21713d[_0x9df1('0x38')]?utils[_0x9df1('0x39')](_0x21713d[_0x9df1('0x30')],_0x21713d[_0x9df1('0x38')]):0x0;};exports[_0x9df1('0x3a')]=function(_0x434846){return _0x434846===_0x9df1('0x3b');};exports['variablesAction']=function(_0x22cf68,_0x22a9f3,_0x325288,_0x2159f4,_0x55c183){var _0x554685=_0x2159f4?_0x9df1('0x3c'):_0x22cf68[_0x9df1('0x14')];_0x554685=_0x55c183?'BOOKED':_0x554685;return{'actionid':_0x22cf68['uniqueid'],'action':'originate','channel':_0x22cf68['channelAgent'],'callerid':util[_0x9df1('0x12')]('\x22%s\x22\x20<%s>',_0x554685,_0x22cf68[_0x9df1('0x15')]),'Exten':_0x9df1('0x3d'),'Context':_0x9df1('0x3e'),'Priority':'1','variable':_0x325288,'timeout':(_0x22a9f3[_0x9df1('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22cf68['uniqueid']};};exports['totalGlobal']=function(_0x23b738){return _0x23b738[_0x9df1('0x40')]+_0x23b738[_0x9df1('0x41')]+_0x23b738[_0x9df1('0x42')]+_0x23b738['countagentrejectretry']+_0x23b738['countnosuchnumberretry'];};exports[_0x9df1('0x43')]=function(_0x7ded97){var _0x427450=_[_0x9df1('0x44')](_0x7ded97);_0x427450[_0x9df1('0x32')]=0xf;_0x427450['statedesc']=_0x9df1('0x45');return _0x427450;};exports[_0x9df1('0x46')]=function(_0x58f980,_0x326db3,_0x3cee59){var _0x341664={};_0x341664[_0x326db3]=_0x58f980[_0x326db3];_0x341664[_0x9df1('0x47')]=![];_0x341664[_0x9df1('0x48')]=moment()[_0x9df1('0x49')](_0x3cee59,'minutes')[_0x9df1('0x12')](_0x9df1('0x2c'));_0x341664[_0x9df1('0x4a')]=_0x58f980['ContactId'];_0x341664['ListId']=_0x58f980[_0x9df1('0x4b')];_0x341664[_0x9df1('0x4c')]=_0x58f980['VoiceQueueId']||undefined;return _0x341664;};exports['decrementTalkink']=function(_0x185266,_0x18c390){if(!_['isNil'](_0x185266)){if(_0x185266[_0x9df1('0x4d')]>0x0){_0x185266[_0x9df1('0x4d')]-=0x1;}else{logger['error'](_0x18c390,_0x9df1('0x4e'));}}else{logger['error'](_0x18c390,_0x9df1('0x4f'));}};exports['IsNotLoggedIn']=function(_0x596c6d){if(_0x596c6d<=0x0){return!![];}return![];};function buildObj(_0x54069d,_0x514833,_0x3dcfd2){_0x54069d['lastevent']=_0x514833;_0x54069d[_0x9df1('0x11')]=_0x54069d[_0x9df1('0x50')];_0x54069d[_0x9df1('0x51')]=_0x54069d[_0x9df1('0x52')];_0x54069d['motionChannel']=_0x9df1('0x53');if(_0x3dcfd2){_0x54069d['mandatoryDisposition']=_0x3dcfd2['mandatoryDisposition'];}return _0x54069d;}exports[_0x9df1('0x54')]=buildObj;exports[_0x9df1('0x55')]=function(_0x1274b9){var _0x6424bb={};_0x6424bb[_0x9df1('0x50')]=_0x1274b9['queue'];_0x6424bb['interface']=_0x1274b9['channelAgent'];_0x6424bb[_0x9df1('0x56')]=_0x1274b9[_0x9df1('0x56')];return _0x6424bb;};exports[_0x9df1('0x57')]=function(_0xc49a4b){var _0x514861=[];for(var _0x3fa9ac in _0xc49a4b){if(_0xc49a4b[_0x9df1('0x25')](_0x3fa9ac)){if(!_['isNil'](_0xc49a4b[_0x3fa9ac])&&_0xc49a4b[_0x3fa9ac]['state']===_0x9df1('0x58')&&_0xc49a4b[_0x3fa9ac][_0x9df1('0x59')]===_0x9df1('0x5a')){_0x514861[_0x9df1('0x5b')](_0xc49a4b[_0x3fa9ac]['id']);}}}return _0x514861;};exports[_0x9df1('0x5c')]=function(_0x4214a5){var _0x1097ae=moment()['milliseconds'](0x0);var _0x69c576=moment(_0x4214a5)[_0x9df1('0x5d')](0x0);return _0x1097ae[_0x9df1('0x5e')](_0x69c576,_0x9df1('0x5f'));};exports[_0x9df1('0x60')]=function(_0x34673e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34673e[_0x9df1('0x4a')],'ListId':_0x34673e[_0x9df1('0x4b')],'VoiceQueueId':_0x34673e[_0x9df1('0x4c')]||undefined,'CampaignId':_0x34673e['CampaignId']||undefined};};exports[_0x9df1('0x61')]=function(_0x2ce158){if(_0x2ce158==='uniqueid'||_0x2ce158===_0x9df1('0x62')||_0x2ce158===_0x9df1('0x50')||_0x2ce158===_0x9df1('0x63')||_0x2ce158===_0x9df1('0x64')||_0x2ce158===_0x9df1('0x65')||_0x2ce158==='membername'||_0x2ce158===_0x9df1('0x52')||_0x2ce158===_0x9df1('0x14')||_0x2ce158===_0x9df1('0x47')||_0x2ce158===_0x9df1('0x15')||_0x2ce158==='scheduledat'||_0x2ce158===_0x9df1('0x40')||_0x2ce158==='countcongestionretry'||_0x2ce158===_0x9df1('0x42')||_0x2ce158===_0x9df1('0x66')||_0x2ce158==='callback'||_0x2ce158==='callbackuniqueid'||_0x2ce158===_0x9df1('0x67')||_0x2ce158===_0x9df1('0x68')||_0x2ce158===_0x9df1('0x4a')||_0x2ce158==='ListId'||_0x2ce158===_0x9df1('0x36')||_0x2ce158===_0x9df1('0x4c')||_0x2ce158===_0x9df1('0x69')||_0x2ce158===_0x9df1('0x6a')||_0x2ce158===_0x9df1('0x6b')||_0x2ce158===_0x9df1('0x6c')||_0x2ce158==='xmd-listid'||_0x2ce158===_0x9df1('0x6d')||_0x2ce158==='xmd-dialtimeout'||_0x2ce158===_0x9df1('0x6e')||_0x2ce158===_0x9df1('0x6f')||_0x2ce158===_0x9df1('0x70')||_0x2ce158===_0x9df1('0x71')||_0x2ce158==='xmd-cdrtype'||_0x2ce158===_0x9df1('0x72')||_0x2ce158===_0x9df1('0x73')||_0x2ce158==='xmd-agi'||_0x2ce158===_0x9df1('0x74')||_0x2ce158===_0x9df1('0x75')||_0x2ce158===_0x9df1('0x76')||_0x2ce158===_0x9df1('0x77')||_0x2ce158===_0x9df1('0x78')||_0x2ce158===_0x9df1('0x79')||_0x2ce158===_0x9df1('0x7a')||_0x2ce158==='rtpaudioqosrttbridged'||_0x2ce158===_0x9df1('0x74')||_0x2ce158==='rtpaudioqosbridged'||_0x2ce158===_0x9df1('0x76')||_0x2ce158===_0x9df1('0x77')||_0x2ce158===_0x9df1('0x78')||_0x2ce158===_0x9df1('0x79')||_0x2ce158===_0x9df1('0x7a')||_0x2ce158===_0x9df1('0x7b')||_0x2ce158===_0x9df1('0x7c')||_0x2ce158==='bridgepvtcallid'||_0x2ce158===_0x9df1('0x32')||_0x2ce158===_0x9df1('0x2d')){return![];}return!![];};exports[_0x9df1('0x7d')]=function(_0x3a1862,_0x1711fc){var _0x4657cd,_0x3fb6c8,_0x5ade94;if(_0x1711fc<=0x0){_0x1711fc=0x1;}_0x4657cd=new RegExp(_0x9df1('0x7e')+_0x1711fc+'}$');_0x3fb6c8=Math[_0x9df1('0x7f')](0xa,_0x1711fc-0x1);_0x5ade94=Math[_0x9df1('0x7f')](0xa,_0x1711fc)-0x1;return util['format']('%s',_[_0x9df1('0x80')](_0x3a1862,_0x4657cd,_['random'](_0x3fb6c8,_0x5ade94)));};exports[_0x9df1('0x81')]=function(_0x51178f){var _0x3af85e=_0x51178f[_0x9df1('0x82')](/"(.*?)"/);return _0x3af85e?_0x3af85e[0x1]:_0x51178f;};exports[_0x9df1('0x83')]=function(_0x3aace8){var _0x4fd353=_0x3aace8[_0x9df1('0x82')](/<(.*?)>/);return _0x4fd353?_0x4fd353[0x1]:_0x3aace8;};function buildNoAnswerEventPayload(_0x457044,_0x1265e9){var _0x9c402c=buildObj(_0x457044,_0x9df1('0x84'));if(!_[_0x9df1('0xd')](_0x1265e9['variables'])){Object['keys'](_0x1265e9[_0x9df1('0x85')])[_0x9df1('0x86')](function(_0x39a184){_0x9c402c[_0x39a184[_0x9df1('0x87')]()]=_0x1265e9['variables'][_0x39a184];});}return _0x9c402c;}exports[_0x9df1('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x2e8c=['extractCalleridName','match','noanswer','variables','keys','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','isActive','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','statedesc','ringtime','UserId','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','channelAgent','agentReadyId','status','push','milliseconds','diff','seconds','CampaignId','idContact','type','campaigntype','dialAnswer','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','pow','random'];(function(_0x30962d,_0x21cfa2){var _0x21fc89=function(_0x4456c3){while(--_0x4456c3){_0x30962d['push'](_0x30962d['shift']());}};_0x21fc89(++_0x21cfa2);}(_0x2e8c,0x1a1));var _0xc2e8=function(_0x1a9914,_0x3665c3){_0x1a9914=_0x1a9914-0x0;var _0x56d997=_0x2e8c[_0x1a9914];return _0x56d997;};'use strict';var util=require(_0xc2e8('0x0'));var _=require(_0xc2e8('0x1'));var moment=require(_0xc2e8('0x2'));var logger=require(_0xc2e8('0x3'))(_0xc2e8('0x4'));var ipAgi=process[_0xc2e8('0x5')][_0xc2e8('0x6')]||_0xc2e8('0x7');var utils=require('../../dialer/utils');exports[_0xc2e8('0x8')]=function(_0xa8589b){return function(_0x5be103){logger[_0xc2e8('0x9')](_0xa8589b,util[_0xc2e8('0xa')](_0x5be103,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1e9379,_0x2854a3){logger[_0xc2e8('0xb')](_0x1e9379,util['inspect'](_0x2854a3,{'showHidden':![],'depth':null}));};exports[_0xc2e8('0xc')]=function(_0x3c9a8a,_0x1cfa4c){logger[_0xc2e8('0x9')](_0x3c9a8a,util['inspect'](_0x1cfa4c,{'showHidden':![],'depth':null}));};exports[_0xc2e8('0xd')]=function(_0x10ae0e){return function(_0x4d000a){logger['info'](_0x10ae0e,util[_0xc2e8('0xa')](_0x4d000a,{'showHidden':![],'depth':null}));};};exports[_0xc2e8('0xe')]=function(_0x2e52e9,_0x162686,_0x3fa678){return{'message':_0x2e52e9,'unlock':_0x162686,'active':_0x3fa678};};exports[_0xc2e8('0xf')]=function(_0x5e3a5a,_0x3f06c5,_0xb115c4){if(!_[_0xc2e8('0x10')](_0xb115c4)&&'string'===typeof _0xb115c4&&!_[_0xc2e8('0x11')](_0xb115c4)){if(!_[_0xc2e8('0x10')](_0x3f06c5)&&'string'===typeof _0x3f06c5&&!_[_0xc2e8('0x11')](_0x3f06c5)){return util['format']('\x22%s\x22\x20<%s>',_0x3f06c5,_0xb115c4);}return util[_0xc2e8('0x12')](_0xc2e8('0x13'),_0xb115c4,_0xb115c4);}if(!_[_0xc2e8('0x10')](_0x5e3a5a)&&_0xc2e8('0x14')===typeof _0x5e3a5a&&!_[_0xc2e8('0x11')](_0x5e3a5a)){return _0x5e3a5a;}return'\x22\x22\x20<>';};exports[_0xc2e8('0x15')]=function(_0x138944){if(_['isNil'](_0x138944)){return![];}return _0x138944;};exports[_0xc2e8('0x16')]=function(_0x5cf6ff,_0x25610c,_0xdec21,_0x4eb68a,_0x36b59b,_0x14aad2){var _0x126640={'XMD-QUEUE':_0x25610c['Queue']?_0x25610c[_0xc2e8('0x17')][_0xc2e8('0x18')]:'','XMD-CALLERID':_0x4eb68a,'XMD-CALLERID-PREVIEW':_0x14aad2?util[_0xc2e8('0x12')]('\x22%s\x22\x20<%s>',_0x14aad2['calleridname'],_0x14aad2[_0xc2e8('0x19')]):_0x4eb68a,'XMD-DIALID':_0x36b59b,'XMD-CONTACTID':_0x25610c[_0xc2e8('0x1a')],'XMD-CDRTYPE':_0xc2e8('0x1b'),'CALLERID(all)':_0x4eb68a,'XMD-VOICEQUEUEID':_0x25610c[_0xc2e8('0x1c')],'XMD-DIALCHANNEL':_0xdec21,'XMD-DIALTIMEOUT':_0x5cf6ff['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xc2e8('0x1d'),_0x5cf6ff['dialQueueProject2']?'g':'',_[_0xc2e8('0x11')](_0x5cf6ff[_0xc2e8('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5cf6ff[_0xc2e8('0x1f')]||'','XMD-AGI':_0x5cf6ff[_0xc2e8('0x20')]?util['format'](_0xc2e8('0x21'),ipAgi,_0x5cf6ff[_0xc2e8('0x20')]):'NONE','XMD-AGIAFTER':_0x5cf6ff[_0xc2e8('0x22')]?util[_0xc2e8('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5cf6ff['dialQueueProject2']):_0xc2e8('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x14aad2?_0x14aad2[_0xc2e8('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x14aad2?_0x14aad2['originatecalleridname']:'','XMD-DESTINATION':_0xc2e8('0x25'),'SIPADDHEADER':_0xc2e8('0x26')};if(!_[_0xc2e8('0x11')](_0x5cf6ff[_0xc2e8('0x1e')])){_0x126640[util[_0xc2e8('0x12')]('%s',_0xc2e8('0x27'))]=_0x5cf6ff[_0xc2e8('0x1e')];_0x126640[util[_0xc2e8('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x36b59b;}return _0x126640;};exports['toLowerVariables']=function(_0x5e248a){var _0x4d6ed8={};for(var _0x58dedb in _0x5e248a){if(_0x5e248a[_0xc2e8('0x28')](_0x58dedb)){_0x4d6ed8[util[_0xc2e8('0x12')]('%s',_[_0xc2e8('0x29')](_0x58dedb))]=_0x5e248a[_0x58dedb];}}return{'variables':_0x4d6ed8};};exports[_0xc2e8('0x2a')]=function(_0x4a9c73,_0x4c7348){if(!_[_0xc2e8('0x2b')](_0x4a9c73)){if(_0x4a9c73[_0xc2e8('0x28')](_0xc2e8('0x2c'))){if(_0x4a9c73[_0xc2e8('0x2c')]>0x0){_0x4a9c73[_0xc2e8('0x2c')]-=0x1;}else{logger['error'](_0xc2e8('0x2d'),_0x4c7348);}}}else{logger[_0xc2e8('0x9')](_0xc2e8('0x2e'),_0x4c7348);}};exports[_0xc2e8('0x2f')]=function(_0x523581){var _0x35a192=moment()[_0xc2e8('0x12')](_0xc2e8('0x30'));_0x523581[_0xc2e8('0x31')]=0xd;_0x523581['statedesc']='Blacklist';_0x523581[_0xc2e8('0x32')]=_0x35a192;_0x523581[_0xc2e8('0x33')]=_0x35a192;_0x523581[_0xc2e8('0x34')]=_0x35a192;};exports['logAgent']=function(_0x578de4,_0x551517,_0xf7e341){var _0xf54177=moment()[_0xc2e8('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x578de4[_0xc2e8('0x31')]=_0x551517;_0x578de4[_0xc2e8('0x35')]=_0xf7e341;_0x578de4['responsetime']=_0xf54177;_0x578de4[_0xc2e8('0x36')]=utils['getSeconds'](_0x578de4['responsetime'],_0x578de4[_0xc2e8('0x32')]);};exports['logLookAgent']=function(_0x2cc01c,_0x3b7104,_0x36788e){_0x2cc01c['membername']=_0x3b7104;_0x2cc01c[_0xc2e8('0x37')]=_0x36788e;};exports['logCustomer']=function(_0x4558c6,_0x1d90f3,_0x7b12ab){var _0x23eae9=moment()[_0xc2e8('0x12')](_0xc2e8('0x30'));_0x4558c6['state']=_0x1d90f3;_0x4558c6[_0xc2e8('0x35')]=_0x7b12ab;_0x4558c6['responsetime']=_0x4558c6[_0xc2e8('0x33')]?_0x4558c6[_0xc2e8('0x33')]:_0x23eae9;_0x4558c6[_0xc2e8('0x34')]=_0x4558c6[_0xc2e8('0x34')]?_0x4558c6['endtime']:_0x23eae9;_0x4558c6[_0xc2e8('0x36')]=utils[_0xc2e8('0x38')](_0x4558c6[_0xc2e8('0x33')]||0x0,_0x4558c6[_0xc2e8('0x32')]||0x0);_0x4558c6[_0xc2e8('0x39')]=_0x4558c6[_0xc2e8('0x3a')]?utils[_0xc2e8('0x38')](_0x4558c6['endtime'],_0x4558c6[_0xc2e8('0x3a')]):0x0;};exports[_0xc2e8('0x3b')]=function(_0x1abbde){return _0x1abbde===_0xc2e8('0x3c');};exports[_0xc2e8('0x3d')]=function(_0xdd4e93,_0x45b0d9,_0x21528c,_0x11ca3e,_0x3bd6bd){var _0x379be1=_0x11ca3e?'RECALL':_0xdd4e93[_0xc2e8('0x3e')];_0x379be1=_0x3bd6bd?_0xc2e8('0x3f'):_0x379be1;return{'actionid':_0xdd4e93[_0xc2e8('0x40')],'action':_0xc2e8('0x41'),'channel':_0xdd4e93['channelAgent'],'callerid':util[_0xc2e8('0x12')](_0xc2e8('0x13'),_0x379be1,_0xdd4e93[_0xc2e8('0x19')]),'Exten':_0xc2e8('0x25'),'Context':_0xc2e8('0x42'),'Priority':'1','variable':_0x21528c,'timeout':(_0x45b0d9[_0xc2e8('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0xdd4e93[_0xc2e8('0x40')]};};exports[_0xc2e8('0x44')]=function(_0x4373f7){return _0x4373f7[_0xc2e8('0x45')]+_0x4373f7[_0xc2e8('0x46')]+_0x4373f7['countnoanswerretry']+_0x4373f7[_0xc2e8('0x47')]+_0x4373f7[_0xc2e8('0x48')];};exports[_0xc2e8('0x49')]=function(_0x4c2e16){var _0x2a32b8=_[_0xc2e8('0x4a')](_0x4c2e16);_0x2a32b8[_0xc2e8('0x31')]=0xf;_0x2a32b8['statedesc']='Global';return _0x2a32b8;};exports[_0xc2e8('0x4b')]=function(_0x2ac5bd,_0x2337b9,_0x377592){var _0xf7b352={};_0xf7b352[_0x2337b9]=_0x2ac5bd[_0x2337b9];_0xf7b352[_0xc2e8('0x4c')]=![];_0xf7b352[_0xc2e8('0x4d')]=moment()[_0xc2e8('0x4e')](_0x377592,_0xc2e8('0x4f'))[_0xc2e8('0x12')](_0xc2e8('0x30'));_0xf7b352[_0xc2e8('0x1a')]=_0x2ac5bd['ContactId'];_0xf7b352[_0xc2e8('0x50')]=_0x2ac5bd[_0xc2e8('0x50')];_0xf7b352[_0xc2e8('0x1c')]=_0x2ac5bd['VoiceQueueId']||undefined;return _0xf7b352;};exports[_0xc2e8('0x51')]=function(_0x5504a9,_0x31d6dd){if(!_['isNil'](_0x5504a9)){if(_0x5504a9[_0xc2e8('0x52')]>0x0){_0x5504a9[_0xc2e8('0x52')]-=0x1;}else{logger['error'](_0x31d6dd,_0xc2e8('0x53'));}}else{logger[_0xc2e8('0x9')](_0x31d6dd,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0xa0e412){if(_0xa0e412<=0x0){return!![];}return![];};function buildObj(_0x25161f,_0x24ae59,_0x30f7f8){_0x25161f[_0xc2e8('0x54')]=_0x24ae59;_0x25161f[_0xc2e8('0x18')]=_0x25161f[_0xc2e8('0x55')];_0x25161f[_0xc2e8('0x56')]=_0x25161f['channelAgent'];_0x25161f[_0xc2e8('0x57')]=_0xc2e8('0x58');if(_0x30f7f8){_0x25161f[_0xc2e8('0x59')]=_0x30f7f8[_0xc2e8('0x59')];}return _0x25161f;}exports[_0xc2e8('0x5a')]=buildObj;exports['buildAcw']=function(_0x2dfef3){var _0x3bf38d={};_0x3bf38d[_0xc2e8('0x55')]=_0x2dfef3['queue'];_0x3bf38d['interface']=_0x2dfef3[_0xc2e8('0x5b')];_0x3bf38d[_0xc2e8('0x40')]=_0x2dfef3[_0xc2e8('0x40')];return _0x3bf38d;};exports[_0xc2e8('0x5c')]=function(_0x561892){var _0x2dacf0=[];for(var _0xf3bff1 in _0x561892){if(_0x561892[_0xc2e8('0x28')](_0xf3bff1)){if(!_[_0xc2e8('0x2b')](_0x561892[_0xf3bff1])&&_0x561892[_0xf3bff1][_0xc2e8('0x31')]==='not_inuse'&&_0x561892[_0xf3bff1][_0xc2e8('0x5d')]==='reachable'){_0x2dacf0[_0xc2e8('0x5e')](_0x561892[_0xf3bff1]['id']);}}}return _0x2dacf0;};exports['getDiff']=function(_0x1ba088){var _0x475f0e=moment()['milliseconds'](0x0);var _0x228689=moment(_0x1ba088)[_0xc2e8('0x5f')](0x0);return _0x475f0e[_0xc2e8('0x60')](_0x228689,_0xc2e8('0x61'));};exports['createBody']=function(_0x1998d9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1998d9['ContactId'],'ListId':_0x1998d9[_0xc2e8('0x50')],'VoiceQueueId':_0x1998d9[_0xc2e8('0x1c')]||undefined,'CampaignId':_0x1998d9[_0xc2e8('0x62')]||undefined};};exports['filterKey']=function(_0x357bfd){if(_0x357bfd===_0xc2e8('0x40')||_0x357bfd===_0xc2e8('0x63')||_0x357bfd===_0xc2e8('0x55')||_0x357bfd===_0xc2e8('0x64')||_0x357bfd===_0xc2e8('0x65')||_0x357bfd===_0xc2e8('0x66')||_0x357bfd===_0xc2e8('0x67')||_0x357bfd===_0xc2e8('0x5b')||_0x357bfd==='calleridname'||_0x357bfd===_0xc2e8('0x4c')||_0x357bfd===_0xc2e8('0x19')||_0x357bfd===_0xc2e8('0x4d')||_0x357bfd===_0xc2e8('0x45')||_0x357bfd==='countcongestionretry'||_0x357bfd===_0xc2e8('0x68')||_0x357bfd===_0xc2e8('0x69')||_0x357bfd===_0xc2e8('0x6a')||_0x357bfd===_0xc2e8('0x6b')||_0x357bfd==='callbackat'||_0x357bfd==='recallme'||_0x357bfd==='ContactId'||_0x357bfd===_0xc2e8('0x50')||_0x357bfd===_0xc2e8('0x37')||_0x357bfd===_0xc2e8('0x1c')||_0x357bfd==='sipcallid'||_0x357bfd===_0xc2e8('0x6c')||_0x357bfd===_0xc2e8('0x6d')||_0x357bfd==='xmd-phone'||_0x357bfd===_0xc2e8('0x6e')||_0x357bfd===_0xc2e8('0x6f')||_0x357bfd===_0xc2e8('0x70')||_0x357bfd==='xmd-dialoptions'||_0x357bfd===_0xc2e8('0x71')||_0x357bfd===_0xc2e8('0x72')||_0x357bfd===_0xc2e8('0x73')||_0x357bfd==='xmd-cdrtype'||_0x357bfd===_0xc2e8('0x74')||_0x357bfd===_0xc2e8('0x75')||_0x357bfd===_0xc2e8('0x76')||_0x357bfd===_0xc2e8('0x77')||_0x357bfd===_0xc2e8('0x78')||_0x357bfd===_0xc2e8('0x79')||_0x357bfd===_0xc2e8('0x7a')||_0x357bfd===_0xc2e8('0x7b')||_0x357bfd===_0xc2e8('0x7c')||_0x357bfd===_0xc2e8('0x7d')||_0x357bfd==='rtpaudioqosrttbridged'||_0x357bfd===_0xc2e8('0x77')||_0x357bfd==='rtpaudioqosbridged'||_0x357bfd===_0xc2e8('0x79')||_0x357bfd===_0xc2e8('0x7a')||_0x357bfd===_0xc2e8('0x7b')||_0x357bfd===_0xc2e8('0x7c')||_0x357bfd===_0xc2e8('0x7d')||_0x357bfd===_0xc2e8('0x7e')||_0x357bfd===_0xc2e8('0x7f')||_0x357bfd===_0xc2e8('0x80')||_0x357bfd==='state'||_0x357bfd===_0xc2e8('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1eeb71,_0x443c11){var _0x17265e,_0x436b92,_0x1a22eb;if(_0x443c11<=0x0){_0x443c11=0x1;}_0x17265e=new RegExp('\x5cw{0,'+_0x443c11+'}$');_0x436b92=Math[_0xc2e8('0x81')](0xa,_0x443c11-0x1);_0x1a22eb=Math[_0xc2e8('0x81')](0xa,_0x443c11)-0x1;return util[_0xc2e8('0x12')]('%s',_['replace'](_0x1eeb71,_0x17265e,_[_0xc2e8('0x82')](_0x436b92,_0x1a22eb)));};exports[_0xc2e8('0x83')]=function(_0x31e07d){var _0xbca068=_0x31e07d[_0xc2e8('0x84')](/"(.*?)"/);return _0xbca068?_0xbca068[0x1]:_0x31e07d;};exports['extractCalleridNumber']=function(_0x2b8082){var _0x432507=_0x2b8082['match'](/<(.*?)>/);return _0x432507?_0x432507[0x1]:_0x2b8082;};function buildNoAnswerEventPayload(_0x4b78a0,_0x41a212){var _0x395f6e=buildObj(_0x4b78a0,_0xc2e8('0x85'));if(!_[_0xc2e8('0x11')](_0x41a212[_0xc2e8('0x86')])){Object[_0xc2e8('0x87')](_0x41a212[_0xc2e8('0x86')])['forEach'](function(_0x5b5849){_0x395f6e[_0x5b5849[_0xc2e8('0x88')]()]=_0x41a212[_0xc2e8('0x86')][_0x5b5849];});}return _0x395f6e;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5f86725..a74ee2c 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 _0x09dc=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd'];(function(_0x37fb1f,_0x16836c){var _0x2313ab=function(_0x28599d){while(--_0x28599d){_0x37fb1f['push'](_0x37fb1f['shift']());}};_0x2313ab(++_0x16836c);}(_0x09dc,0x74));var _0xc09d=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x09dc[_0x315b61];return _0x3521e8;};'use strict';exports[_0xc09d('0x0')]={'queue':{'type':_0xc09d('0x1'),'required':!![]},'interface':{'type':_0xc09d('0x1'),'required':!![]},'membername':{'type':_0xc09d('0x1'),'required':!![]},'penalty':{'type':_0xc09d('0x2'),'required':![]},'paused':{'type':_0xc09d('0x3'),'required':![]}};exports[_0xc09d('0x4')]={'queue':{'type':_0xc09d('0x1'),'required':!![]},'interface':{'type':_0xc09d('0x1'),'required':!![]}};exports[_0xc09d('0x5')]={'interface':{'type':_0xc09d('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xc09d('0x1'),'required':![]}};exports[_0xc09d('0x6')]={'module':{'type':_0xc09d('0x1'),'required':![]}};exports[_0xc09d('0x7')]={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]}};exports[_0xc09d('0x8')]={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]},'filename':{'type':_0xc09d('0x1')},'format':{'type':_0xc09d('0x1')},'mixmonitorid':{'type':_0xc09d('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc09d('0x1'),'required':!![]},'context':{'type':_0xc09d('0x1')}}; \ No newline at end of file +var _0x6010=['voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queuepause','voicequeuechannel','voicechannel'];(function(_0x463934,_0x1e38ec){var _0x44c1a2=function(_0x2116d7){while(--_0x2116d7){_0x463934['push'](_0x463934['shift']());}};_0x44c1a2(++_0x1e38ec);}(_0x6010,0xfa));var _0x0601=function(_0x3c8f4e,_0xb53ea5){_0x3c8f4e=_0x3c8f4e-0x0;var _0x2e43d3=_0x6010[_0x3c8f4e];return _0x2e43d3;};'use strict';exports['queueadd']={'queue':{'type':_0x0601('0x0'),'required':!![]},'interface':{'type':_0x0601('0x0'),'required':!![]},'membername':{'type':_0x0601('0x0'),'required':!![]},'penalty':{'type':_0x0601('0x1'),'required':![]},'paused':{'type':_0x0601('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0601('0x0'),'required':!![]},'interface':{'type':_0x0601('0x0'),'required':!![]}};exports[_0x0601('0x3')]={'interface':{'type':_0x0601('0x0'),'required':!![]},'paused':{'type':_0x0601('0x2')},'reason':{'type':_0x0601('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x0601('0x0'),'required':![]}};exports[_0x0601('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0601('0x5')]={'uniqueid':{'type':_0x0601('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x0601('0x0')},'mixmonitorid':{'type':_0x0601('0x0')}};exports[_0x0601('0x6')]={'uniqueid':{'type':_0x0601('0x0'),'required':!![]}};exports[_0x0601('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x0601('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7b7bfa5..ce9530b 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x3e36ec,_0x404d8d){var _0x30ce00=function(_0x667858){while(--_0x667858){_0x3e36ec['push'](_0x3e36ec['shift']());}};_0x30ce00(++_0x404d8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xb10b[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x588589,_0x4e53f8){var _0xf5c893=function(_0x30942a){while(--_0x30942a){_0x588589['push'](_0x588589['shift']());}};_0xf5c893(++_0x4e53f8);}(_0xdb28,0x106));var _0x8db2=function(_0x3ffeb2,_0x3f92e9){_0x3ffeb2=_0x3ffeb2-0x0;var _0x236d65=_0xdb28[_0x3ffeb2];return _0x236d65;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index f0fde41..a53dced 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b13=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x4b13,0x90));var _0x34b1=function(_0x3bcea4,_0x59cab8){_0x3bcea4=_0x3bcea4-0x0;var _0x3ac6ce=_0x4b13[_0x3bcea4];return _0x3ac6ce;};'use strict';function mergeDBDataToRealtime(_0x4229ca,_0x59f4e4){var _0x576bff=Object[_0x34b1('0x0')]({},_0x4229ca);for(var _0x4a966d in _0x59f4e4){if(_0x576bff[_0x34b1('0x1')](_0x4a966d)){_0x576bff[_0x4a966d]=_0x59f4e4[_0x4a966d];}}return _0x576bff;}exports[_0x34b1('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x533a=['mergeDBDataToRealtime','assign'];(function(_0x1a3eb1,_0x5188d5){var _0x29efec=function(_0x34f0da){while(--_0x34f0da){_0x1a3eb1['push'](_0x1a3eb1['shift']());}};_0x29efec(++_0x5188d5);}(_0x533a,0x147));var _0xa533=function(_0x16dd47,_0xbdbafe){_0x16dd47=_0x16dd47-0x0;var _0xfc2bff=_0x533a[_0x16dd47];return _0xfc2bff;};'use strict';function mergeDBDataToRealtime(_0x82dc6a,_0x399967){var _0x488381=Object[_0xa533('0x0')]({},_0x82dc6a);for(var _0x387792 in _0x399967){if(_0x488381['hasOwnProperty'](_0x387792)){_0x488381[_0x387792]=_0x399967[_0x387792];}}return _0x488381;}exports[_0xa533('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5168fc2..240c65c 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 _0x8edd=['lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','length','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','findAgent','find','accountcode','name','interface','format','voiceQueueReport','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','internal','voiceCallReport','destination','exten','type','dialer'];(function(_0x22d257,_0x42e442){var _0x388bd5=function(_0x14adad){while(--_0x14adad){_0x22d257['push'](_0x22d257['shift']());}};_0x388bd5(++_0x42e442);}(_0x8edd,0x8e));var _0xd8ed=function(_0xd2c728,_0x18c2ef){_0xd2c728=_0xd2c728-0x0;var _0x410019=_0x8edd[_0xd2c728];return _0x410019;};'use strict';var _=require('lodash');var moment=require(_0xd8ed('0x0'));var util=require(_0xd8ed('0x1'));var config=require('../../../config/environment');var ami=require(_0xd8ed('0x2'));var RpcVoiceAgentReport=require(_0xd8ed('0x3'));var RpcVoiceCallReport=require(_0xd8ed('0x4'));var RpcVoiceDialReport=require(_0xd8ed('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xd8ed('0x6'));var RpcVoiceRecording=require(_0xd8ed('0x7'));var RpcVoiceTransferReport=require(_0xd8ed('0x8'));var VoiceQueueReport=require(_0xd8ed('0x9'));var VoiceCallReport=require(_0xd8ed('0xa'));var VoiceAgentReport=require(_0xd8ed('0xb'));var VoiceDialReport=require(_0xd8ed('0xc'));var UserReport=require(_0xd8ed('0xd'));function Report(_0x3f5ed7){this[_0xd8ed('0xe')]=_0x3f5ed7;this[_0xd8ed('0xf')]=_0x3f5ed7[_0xd8ed('0xf')];this[_0xd8ed('0x10')]=_0x3f5ed7[_0xd8ed('0x10')];}Report[_0xd8ed('0x11')][_0xd8ed('0x12')]=function(_0x59b05b){var _0x5ec1c3=new VoiceQueueReport(this[_0xd8ed('0xe')]);var _0x29a0be=new VoiceAgentReport(this['realtime']);var _0x35d152=new VoiceDialReport(this[_0xd8ed('0xe')]);var _0x92c98d=new VoiceCallReport(this[_0xd8ed('0xe')]);var _0x45b45f=new UserReport(this['realtime']);if(config[_0xd8ed('0x13')]&&config[_0xd8ed('0x13')][_0xd8ed('0x14')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x16'),this['voiceCallReport'][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x17'),this[_0xd8ed('0x18')][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x19'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0xd8ed('0x1a')][_0xd8ed('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0xd8ed('0x11')][_0xd8ed('0x1b')]=function(_0x1fbe1f){var _0x5876f6;_0x5876f6=_[_0xd8ed('0x1c')](this[_0xd8ed('0xf')],function(_0x52999c){return _0x52999c[_0xd8ed('0x1d')]==_0x1fbe1f||_0x52999c[_0xd8ed('0x1e')]==_0x1fbe1f;});if(_['isNil'](_0x5876f6)){var _0x4a91a3=_[_0xd8ed('0x1c')](this['telephones'],function(_0x2a1bc9){return _0x2a1bc9[_0xd8ed('0x1d')]==_0x1fbe1f||_0x2a1bc9[_0xd8ed('0x1e')]==_0x1fbe1f;});if(_0x4a91a3){_0x5876f6=_[_0xd8ed('0x1c')](this[_0xd8ed('0xf')],function(_0x566c9d){return _0x566c9d[_0xd8ed('0x1f')]==util[_0xd8ed('0x20')]('SIP/%s',_0x4a91a3[_0xd8ed('0x1e')]);});}}return _0x5876f6;};Report[_0xd8ed('0x11')][_0xd8ed('0x21')]=function(_0x34b077){for(var _0x3bcdc6=0x0;_0x3bcdc6<_0x34b077['length'];_0x3bcdc6+=0x1){var _0x3c0652=this[_0xd8ed('0x1b')](_0x34b077[_0x3bcdc6]['connectedlinenum']);if(_0x3c0652){_0x34b077[_0x3bcdc6][_0xd8ed('0x1d')]=_0x3c0652['accountcode'];_0x34b077[_0x3bcdc6][_0xd8ed('0x22')]=!![];_0x34b077[_0x3bcdc6][_0xd8ed('0x23')]=_0x3c0652[_0xd8ed('0x1e')];_0x34b077[_0x3bcdc6][_0xd8ed('0x1f')]=_[_0xd8ed('0x24')](_0x3c0652['interface'])?util['format']('SIP/%s',_0x3c0652['name']):_0x3c0652[_0xd8ed('0x1f')];if(_0x34b077[_0x3bcdc6][_0xd8ed('0x25')]){_0x34b077[_0x3bcdc6][_0xd8ed('0x26')]=moment()[_0xd8ed('0x20')](_0xd8ed('0x27'));}if(_0x34b077[_0x3bcdc6][_0xd8ed('0x28')]){_0x34b077[_0x3bcdc6][_0xd8ed('0x29')]=moment()[_0xd8ed('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xd8ed('0x21')](_0x34b077[_0x3bcdc6]);}RpcVoiceQueueReport[_0xd8ed('0x2a')](_0x34b077[_0x3bcdc6]);}};function extractCalleridNumber(_0x566a90){var _0x1b1f7d=_0x566a90[_0xd8ed('0x2b')](/<(.*?)>/);return _0x1b1f7d?_0x1b1f7d[0x1]:_0x566a90;}Report[_0xd8ed('0x11')][_0xd8ed('0x2c')]=function(_0x59699e){for(var _0x4c1703=0x0;_0x4c1703','calleridname','transfers','linkedid','uniqueid','blindTransfer','type','UserId'];(function(_0x36eb3a,_0x45bd2c){var _0x40a84d=function(_0x2f963b){while(--_0x2f963b){_0x36eb3a['push'](_0x36eb3a['shift']());}};_0x40a84d(++_0x45bd2c);}(_0x2883,0x130));var _0x3288=function(_0x2be98a,_0x29003a){_0x2be98a=_0x2be98a-0x0;var _0x47c911=_0x2883[_0x2be98a];return _0x47c911;};'use strict';var _=require('lodash');var moment=require(_0x3288('0x0'));var util=require(_0x3288('0x1'));var config=require(_0x3288('0x2'));var ami=require(_0x3288('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x3288('0x4'));var RpcVoiceDialReport=require(_0x3288('0x5'));var RpcMemberReport=require(_0x3288('0x6'));var RpcVoiceQueueReport=require(_0x3288('0x7'));var RpcVoiceRecording=require(_0x3288('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x3288('0x9'));var VoiceAgentReport=require(_0x3288('0xa'));var VoiceDialReport=require(_0x3288('0xb'));var UserReport=require(_0x3288('0xc'));function Report(_0x3ad3de){this['realtime']=_0x3ad3de;this[_0x3288('0xd')]=_0x3ad3de[_0x3288('0xd')];this[_0x3288('0xe')]=_0x3ad3de[_0x3288('0xe')];}Report[_0x3288('0xf')][_0x3288('0x10')]=function(_0x1f1196){var _0x1a138c=new VoiceQueueReport(this[_0x3288('0x11')]);var _0x2c288d=new VoiceAgentReport(this[_0x3288('0x11')]);var _0x5c7747=new VoiceDialReport(this['realtime']);var _0x17fa05=new VoiceCallReport(this['realtime']);var _0x1c1819=new UserReport(this[_0x3288('0x11')]);if(config[_0x3288('0x12')]&&config[_0x3288('0x12')][_0x3288('0x13')]){ami['on'](_0x3288('0x14'),this[_0x3288('0x15')][_0x3288('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x3288('0x17')][_0x3288('0x16')](this));ami['on'](_0x3288('0x18'),this['voiceAgentReport'][_0x3288('0x16')](this));ami['on'](_0x3288('0x19'),this['voiceDialReport'][_0x3288('0x16')](this));ami['on']('blindtransfer',this['blindTransfer']['bind'](this));ami['on'](_0x3288('0x1a'),this['attendedTransfer'][_0x3288('0x16')](this));}};Report['prototype'][_0x3288('0x1b')]=function(_0x263507){var _0xd35675;_0xd35675=_[_0x3288('0x1c')](this[_0x3288('0xd')],function(_0x1a88d5){return _0x1a88d5['accountcode']==_0x263507||_0x1a88d5['name']==_0x263507;});if(_[_0x3288('0x1d')](_0xd35675)){var _0x17687b=_[_0x3288('0x1c')](this[_0x3288('0xe')],function(_0x42c8da){return _0x42c8da[_0x3288('0x1e')]==_0x263507||_0x42c8da['name']==_0x263507;});if(_0x17687b){_0xd35675=_[_0x3288('0x1c')](this[_0x3288('0xd')],function(_0x46ba60){return _0x46ba60['interface']==util['format'](_0x3288('0x1f'),_0x17687b['name']);});}}return _0xd35675;};Report[_0x3288('0xf')][_0x3288('0x15')]=function(_0x4f2c4a){for(var _0xff245a=0x0;_0xff245a<_0x4f2c4a[_0x3288('0x20')];_0xff245a+=0x1){var _0xf32d09=this['findAgent'](_0x4f2c4a[_0xff245a]['connectedlinenum']);if(_0xf32d09){_0x4f2c4a[_0xff245a]['accountcode']=_0xf32d09[_0x3288('0x1e')];_0x4f2c4a[_0xff245a]['assigned']=!![];_0x4f2c4a[_0xff245a][_0x3288('0x21')]=_0xf32d09[_0x3288('0x22')];_0x4f2c4a[_0xff245a]['interface']=_['isNil'](_0xf32d09[_0x3288('0x23')])?util[_0x3288('0x24')](_0x3288('0x1f'),_0xf32d09[_0x3288('0x22')]):_0xf32d09[_0x3288('0x23')];if(_0x4f2c4a[_0xff245a]['queuecallercomplete']){_0x4f2c4a[_0xff245a][_0x3288('0x25')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f2c4a[_0xff245a][_0x3288('0x26')]){_0x4f2c4a[_0xff245a][_0x3288('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x3288('0x15')](_0x4f2c4a[_0xff245a]);}RpcVoiceQueueReport[_0x3288('0x28')](_0x4f2c4a[_0xff245a]);}};function extractCalleridNumber(_0x40af94){var _0x15acb6=_0x40af94[_0x3288('0x29')](/<(.*?)>/);return _0x15acb6?_0x15acb6[0x1]:_0x40af94;}Report[_0x3288('0xf')][_0x3288('0x2a')]=function(_0x119e8c){for(var _0x54530a=0x0;_0x54530a0x0?!![]:![];if(!_0x12fc52){return this[_0x8a71('0x1a')](this[_0x8a71('0x15')][_0x8a71('0x73')]);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x1c')]=function(_0x90ce01){var _0xd962ce=this[_0x8a71('0x15')]['id'];if(this[_0x8a71('0x15')]['queuestatus'][_0xd962ce]&&this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01[_0x8a71('0x67')]]){this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01['actionid']]['agents'][_0x8a71('0x74')](_0x90ce01);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x18')]=function(_0x3d22c5){var _0xd12f55=this;try{if(this['isNotNull'](_0x3d22c5)&&this['isNotNull'](_0x3d22c5[_0x8a71('0x6e')])){logger[_0x8a71('0x52')](_0x8a71('0x75'),util[_0x8a71('0x4b')](_0x3d22c5,{'showHidden':![],'depth':null}));var _0x13a0e1=this['voiceQueues'][_0x3d22c5['queue']];if(_0x13a0e1){logger[_0x8a71('0x52')](_0x8a71('0x76'),_0x13a0e1[_0x8a71('0x5f')]);this[_0x8a71('0x15')]['queues'][_0x13a0e1[_0x8a71('0x5f')]]={'summaryEvent':_0x3d22c5};this[_0x8a71('0x15')][_0x8a71('0x72')]+=0x1;return ami[_0x8a71('0x43')]({'action':_0x8a71('0x66'),'queue':_0x13a0e1['name']})[_0x8a71('0x64')](function(_0x98abbc){if(!_0xd12f55[_0x8a71('0x15')][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]]){_0xd12f55[_0x8a71('0x15')]['queuestatus'][_0x3d22c5[_0x8a71('0x67')]]={};}_0xd12f55['summary'][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]][_0x98abbc[_0x8a71('0x67')]]={'queue':_0x13a0e1['name'],'agents':[]};})[_0x8a71('0x46')](function(_0x47739d){throw _0x47739d;});}}}catch(_0x5850f9){logger[_0x8a71('0x49')]('[voiceQueueReport][queuesummary]',util[_0x8a71('0x4b')](_0x5850f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x28238a){if(this[_0x8a71('0x15')]['statusRequests']>0x0){this[_0x8a71('0x15')][_0x8a71('0x73')]=_0x28238a;return;}logger['debug'](_0x8a71('0x77'),util[_0x8a71('0x4b')](_0x28238a,{'showHidden':![],'depth':null}));this[_0x8a71('0x15')]=initializeSummary();ami['emit'](_0x8a71('0x78'),{});};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerJoin']=function(_0x30424f){try{if(this[_0x8a71('0x61')](_0x30424f)){logger[_0x8a71('0x52')](_0x8a71('0x79'),_0x30424f['uniqueid'],util[_0x8a71('0x4b')](_0x30424f,{'showHidden':![],'depth':null}));if(_[_0x8a71('0x7a')](this[_0x8a71('0xf')][_0x30424f['uniqueid']])){this['queueReports'][_0x30424f[_0x8a71('0x55')]]=[];}if(_[_0x8a71('0x7a')](this['channels'][_0x30424f['uniqueid']])){this[_0x8a71('0x12')][_0x30424f[_0x8a71('0x55')]]={};}var _0x55a1e8=new QueueReport();_0x55a1e8[_0x8a71('0x6e')]=_0x30424f[_0x8a71('0x6e')];_0x55a1e8['type']=this[_0x8a71('0x6d')][_0x55a1e8['queue']]&&this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]?this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]||_0x8a71('0x6f'):_0x8a71('0x6f');_0x55a1e8[_0x8a71('0x7b')]=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));_0x55a1e8[_0x8a71('0x7d')]=_0x30424f['position'];_0x55a1e8[_0x8a71('0x7e')]=_0x30424f['count'];_0x55a1e8['uniqueid']=_0x30424f[_0x8a71('0x55')];_0x55a1e8[_0x8a71('0x7f')]=this[_0x8a71('0x12')][_0x30424f['uniqueid']]['routealias'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x55a1e8[_0x8a71('0x6e')],_0x55a1e8[_0x8a71('0x5d')]);Object[_0x8a71('0x6c')](_0x55a1e8,_['pick'](_0x30424f,_[_0x8a71('0x80')](_0x55a1e8)));this[_0x8a71('0xf')][_0x30424f['uniqueid']][_0x8a71('0x74')](_0x55a1e8);this['channels'][_0x30424f[_0x8a71('0x55')]]=_0x55a1e8;this[_0x8a71('0x51')](_0x55a1e8,'queuecallerjoin');}}catch(_0x3c42e8){logger[_0x8a71('0x49')](_0x8a71('0x79'),_0x30424f[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x3c42e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerAbandon']=function(_0x5be44e){try{if(this[_0x8a71('0x61')](_0x5be44e)){logger['debug'](_0x8a71('0x81'),_0x5be44e[_0x8a71('0x55')],util['inspect'](_0x5be44e,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x5be44e['uniqueid']]){var _0x1e0cf6=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x5be44e[_0x8a71('0x55')]]);_0x1e0cf6[_0x8a71('0x3e')]=![];_0x1e0cf6[_0x8a71('0x83')]=null;_0x1e0cf6['holdtime']=_0x5be44e[_0x8a71('0x84')];_0x1e0cf6[_0x8a71('0x85')]=_0x5be44e[_0x8a71('0x85')];_0x1e0cf6[_0x8a71('0x21')]=!![];_0x1e0cf6[_0x8a71('0x86')]=moment()['format'](_0x8a71('0x7c'));_0x1e0cf6[_0x8a71('0x5a')]=_0x8a71('0x87');_0x1e0cf6[_0x8a71('0x88')]=null;logger[_0x8a71('0x89')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1e0cf6['queue'],_0x1e0cf6[_0x8a71('0x5d')]);this['channels'][_0x5be44e['uniqueid']]=_0x1e0cf6;this[_0x8a71('0x4f')](_0x1e0cf6,_0x8a71('0x21'));}}}catch(_0x125901){logger['error'](_0x8a71('0x81'),_0x5be44e['uniqueid'],util[_0x8a71('0x4b')](_0x125901,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x32ffaf){try{if(this[_0x8a71('0x61')](_0x32ffaf)){logger[_0x8a71('0x52')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x32ffaf,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x32ffaf[_0x8a71('0x55')]]){var _0x29a887=_[_0x8a71('0x82')](this['queueReports'][_0x32ffaf[_0x8a71('0x55')]]);_0x29a887[_0x8a71('0x8b')]=moment()['format'](_0x8a71('0x7c'));_0x29a887[_0x8a71('0x8c')]=_0x32ffaf[_0x8a71('0x8c')];_0x29a887[_0x8a71('0x8d')]=_0x32ffaf[_0x8a71('0x8d')];logger[_0x8a71('0x89')](_0x8a71('0x8e'),_0x29a887[_0x8a71('0x6e')],_0x29a887[_0x8a71('0x5d')],_0x32ffaf[_0x8a71('0x8c')],_0x32ffaf['connectedlinename']);this[_0x8a71('0x12')][_0x32ffaf['uniqueid']]=_0x29a887;this[_0x8a71('0x51')](_0x29a887,_0x8a71('0x23'));}}}catch(_0x2ab6ba){logger[_0x8a71('0x49')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x2ab6ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentConnect']=function(_0x2abf32){try{if(this['isNotNull'](_0x2abf32)){logger[_0x8a71('0x52')](_0x8a71('0x8f'),_0x2abf32['uniqueid'],util[_0x8a71('0x4b')](_0x2abf32,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]){var _0x297b2f=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]);_0x297b2f['queuecallercomplete']=!![];_0x297b2f[_0x8a71('0x5a')]=_0x8a71('0x90');logger[_0x8a71('0x89')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x297b2f[_0x8a71('0x6e')],_0x297b2f[_0x8a71('0x5d')]);}}}catch(_0x149f39){logger[_0x8a71('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x2abf32[_0x8a71('0x55')],util['inspect'](_0x149f39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentComplete']=function(_0x56bb24){try{if(this[_0x8a71('0x61')](_0x56bb24)){logger[_0x8a71('0x52')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x56bb24,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x56bb24['uniqueid']]){var _0x5d1ecb=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]]);_0x5d1ecb[_0x8a71('0x21')]=![];_0x5d1ecb[_0x8a71('0x86')]=null;_0x5d1ecb['assigned']=!![];_0x5d1ecb[_0x8a71('0x88')]=_0x56bb24[_0x8a71('0x92')];_0x5d1ecb['holdtime']=_0x56bb24[_0x8a71('0x84')];_0x5d1ecb[_0x8a71('0x3e')]=!![];_0x5d1ecb[_0x8a71('0x3d')]=![];_0x5d1ecb[_0x8a71('0x93')]=null;if(!_0x5d1ecb[_0x8a71('0x94')]){if(_0x56bb24[_0x8a71('0x95')]==_0x8a71('0x94')){_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0x96');logger[_0x8a71('0x89')](_0x8a71('0x97'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb[_0x8a71('0x5d')]);}else{if(_['startsWith'](_0x56bb24['channel'][_0x8a71('0x98')](),'local/')){if(this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]]){var _0xf1b047=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24['linkedid']]);_0xf1b047[_0x8a71('0x3e')]=![];_0xf1b047[_0x8a71('0x3d')]=!![];_0xf1b047[_0x8a71('0x93')]=moment(_0x5d1ecb['queuecallerjoinAt'])[_0x8a71('0x9a')](_0x56bb24[_0x8a71('0x84')],_0x8a71('0x9b'))[_0x8a71('0x57')](_0x8a71('0x7c'));_0xf1b047[_0x8a71('0x5a')]=_0x8a71('0x9c');_0xf1b047[_0x8a71('0x94')]=!![];_0xf1b047[_0x8a71('0x9d')]='FORWARD';_0xf1b047[_0x8a71('0x9e')]=_0x56bb24['destexten'];_0xf1b047['transferuniqueid']=_0x56bb24[_0x8a71('0x55')];logger[_0x8a71('0x89')](_0x8a71('0x9f'),_0xf1b047['queue'],_0xf1b047[_0x8a71('0x5d')]);var _0x5ae501=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]];this[_0x8a71('0xf')][_0x56bb24['linkedid']]=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]];this[_0x8a71('0xf')][_0x56bb24['uniqueid']]=_0x5ae501;}}else{_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0xa0')+_0x56bb24[_0x8a71('0x95')][_0x8a71('0xa1')]();logger[_0x8a71('0x89')](_0x8a71('0xa2'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb['type'],_0x5d1ecb[_0x8a71('0x5a')]);}}}this['channels'][_0x56bb24['uniqueid']]=_0x5d1ecb;}}}catch(_0x58e1e1){logger[_0x8a71('0x49')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x58e1e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x29')]=function(_0x4b3a10){try{if(this[_0x8a71('0x61')](_0x4b3a10)){logger['debug'](_0x8a71('0xa3'),_0x4b3a10[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x4b3a10,{'showHidden':![],'depth':null}));this['addVariable'](_0x4b3a10[_0x8a71('0x55')],_[_0x8a71('0x80')](_0x4b3a10['variable'])[0x0],_0x4b3a10[_0x8a71('0xa4')]);if(this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]){var _0x356060=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]);if(_0x356060){if(this[_0x8a71('0x61')](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0x66')])){switch(_0x4b3a10['value']){case _0x8a71('0xa6'):_0x356060['queuecallerexit']=![];_0x356060['queuecallerexitAt']=null;break;case _0x8a71('0xa7'):_0x356060[_0x8a71('0xa8')]=_0x8a71('0xa9');_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));logger[_0x8a71('0x52')](_0x8a71('0xaa'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0x356060,{'showHidden':![],'depth':null}));ami[_0x8a71('0x56')](_0x8a71('0xab'),_0x356060);break;default:_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()['format'](_0x8a71('0x7c'));}_0x356060['queuecallerabandon']=![];_0x356060[_0x8a71('0x86')]=null;_0x356060[_0x8a71('0x5a')]=_0x4b3a10['value'];this['channels'][_0x4b3a10['uniqueid']]=_0x356060;this[_0x8a71('0x4f')](_0x356060,'varset');}else if(this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0xac')])){if(!_0x356060[_0x8a71('0x21')]){_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060[_0x8a71('0x5a')]=_0x8a71('0xad');_0x356060[_0x8a71('0x8b')]=moment()[_0x8a71('0x57')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a71('0x12')][_0x4b3a10[_0x8a71('0x55')]]=_0x356060;}}logger['info'](_0x8a71('0xae'),_0x4b3a10[_0x8a71('0x55')],_0x356060[_0x8a71('0x6e')],_0x356060[_0x8a71('0x5d')],_['keys'](_0x4b3a10[_0x8a71('0xa5')])[0x0],_0x4b3a10[_0x8a71('0xa4')]);_0x356060['variables']=this[_0x8a71('0x16')][_0x4b3a10[_0x8a71('0x55')]];}}}}catch(_0xd3f68d){logger[_0x8a71('0x49')](_0x8a71('0xa3'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0xd3f68d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xaf')]=function(_0x23d442,_0x165f82,_0x2fd9f9){var _0x2f02c0=[_0x8a71('0xb0'),'rtpaudioqosbridged',_0x8a71('0xb1'),'rtpaudioqosjitterbridged',_0x8a71('0xb2'),_0x8a71('0xb3'),_0x8a71('0xb4'),'rtpaudioqosrttbridged',_0x8a71('0xb5'),_0x8a71('0xb6'),_0x8a71('0xb7'),'bridgepvtcallid',_0x8a71('0xb8'),_0x8a71('0xb9'),_0x8a71('0xba'),_0x8a71('0xbb'),_0x8a71('0x92'),'memberpenalty',_0x8a71('0xbc')];if(!_[_0x8a71('0x42')](_0x165f82)&&!_[_0x8a71('0xbd')](_0x2f02c0,_0x165f82)){if(_[_0x8a71('0x7a')](this[_0x8a71('0x16')][_0x23d442])){this[_0x8a71('0x16')][_0x23d442]={};}this[_0x8a71('0x16')][_0x23d442][_0x165f82]=_0x2fd9f9;}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xbe')]=function(_0x573191,_0x276f0e,_0x4e1200){try{var _0xaefae5={};if(this['queueReports'][_0x573191]){for(var _0x3b7448=0x0;_0x3b74480x0?!![]:![];if(!_0xf85761){return this[_0xf8c5('0x6c')](this[_0xf8c5('0x14')][_0xf8c5('0x6d')]);}};VoiceQueueReport['prototype'][_0xf8c5('0x1a')]=function(_0xa7742e){var _0x359daa=this[_0xf8c5('0x14')]['id'];if(this[_0xf8c5('0x14')][_0xf8c5('0x61')][_0x359daa]&&this[_0xf8c5('0x14')][_0xf8c5('0x61')][_0x359daa][_0xa7742e['actionid']]){this[_0xf8c5('0x14')][_0xf8c5('0x61')][_0x359daa][_0xa7742e[_0xf8c5('0x60')]][_0xf8c5('0xf')]['push'](_0xa7742e);}};VoiceQueueReport[_0xf8c5('0xb')][_0xf8c5('0x16')]=function(_0x2c680c){var _0x9d84c3=this;try{if(this['isNotNull'](_0x2c680c)&&this[_0xf8c5('0x59')](_0x2c680c[_0xf8c5('0x4c')])){logger[_0xf8c5('0x48')](_0xf8c5('0x6e'),util[_0xf8c5('0x40')](_0x2c680c,{'showHidden':![],'depth':null}));var _0x15e7d6=this[_0xf8c5('0x12')][_0x2c680c['queue']];if(_0x15e7d6){logger[_0xf8c5('0x48')](_0xf8c5('0x6f'),_0x15e7d6['name']);this['summary'][_0xf8c5('0x5d')][_0x15e7d6[_0xf8c5('0x57')]]={'summaryEvent':_0x2c680c};this['summary'][_0xf8c5('0x6b')]+=0x1;return ami['Action']({'action':_0xf8c5('0x61'),'queue':_0x15e7d6['name']})[_0xf8c5('0x5f')](function(_0x5b9f29){if(!_0x9d84c3['summary'][_0xf8c5('0x61')][_0x2c680c['actionid']]){_0x9d84c3[_0xf8c5('0x14')][_0xf8c5('0x61')][_0x2c680c[_0xf8c5('0x60')]]={};}_0x9d84c3[_0xf8c5('0x14')][_0xf8c5('0x61')][_0x2c680c['actionid']][_0x5b9f29['actionid']]={'queue':_0x15e7d6[_0xf8c5('0x57')],'agents':[]};})[_0xf8c5('0x3c')](function(_0x4de89f){throw _0x4de89f;});}}}catch(_0x18d9c5){logger[_0xf8c5('0x3e')](_0xf8c5('0x62'),util[_0xf8c5('0x40')](_0x18d9c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8c5('0xb')][_0xf8c5('0x6c')]=function(_0x38cbec){if(this[_0xf8c5('0x14')][_0xf8c5('0x6b')]>0x0){this[_0xf8c5('0x14')]['completeEvent']=_0x38cbec;return;}logger['debug'](_0xf8c5('0x70'),util['inspect'](_0x38cbec,{'showHidden':![],'depth':null}));this[_0xf8c5('0x14')]=initializeSummary();ami[_0xf8c5('0x46')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xf8c5('0xb')][_0xf8c5('0x71')]=function(_0x371c31){try{if(this['isNotNull'](_0x371c31)){logger[_0xf8c5('0x48')](_0xf8c5('0x72'),_0x371c31[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x371c31,{'showHidden':![],'depth':null}));if(_[_0xf8c5('0x5a')](this[_0xf8c5('0x41')][_0x371c31['uniqueid']])){this[_0xf8c5('0x41')][_0x371c31[_0xf8c5('0x4f')]]=[];}if(_[_0xf8c5('0x5a')](this[_0xf8c5('0x10')][_0x371c31['uniqueid']])){this[_0xf8c5('0x10')][_0x371c31[_0xf8c5('0x4f')]]={};}var _0x5090b3=new QueueReport();_0x5090b3['queue']=_0x371c31[_0xf8c5('0x4c')];_0x5090b3['type']=this['voiceQueues'][_0x5090b3[_0xf8c5('0x4c')]]&&this[_0xf8c5('0x12')][_0x5090b3[_0xf8c5('0x4c')]][_0xf8c5('0x55')]?this[_0xf8c5('0x12')][_0x5090b3[_0xf8c5('0x4c')]][_0xf8c5('0x55')]||_0xf8c5('0x69'):'inbound';_0x5090b3[_0xf8c5('0x73')]=moment()[_0xf8c5('0x4b')](_0xf8c5('0x74'));_0x5090b3[_0xf8c5('0x75')]=_0x371c31[_0xf8c5('0x75')];_0x5090b3[_0xf8c5('0x76')]=_0x371c31[_0xf8c5('0x76')];_0x5090b3[_0xf8c5('0x4f')]=_0x371c31[_0xf8c5('0x4f')];_0x5090b3[_0xf8c5('0x77')]=this['channels'][_0x371c31['uniqueid']]['routealias'];logger[_0xf8c5('0x78')](_0xf8c5('0x79'),_0x5090b3[_0xf8c5('0x4c')],_0x5090b3[_0xf8c5('0x55')]);Object['assign'](_0x5090b3,_[_0xf8c5('0x7a')](_0x371c31,_['keys'](_0x5090b3)));this[_0xf8c5('0x41')][_0x371c31[_0xf8c5('0x4f')]][_0xf8c5('0x7b')](_0x5090b3);this[_0xf8c5('0x10')][_0x371c31[_0xf8c5('0x4f')]]=_0x5090b3;this[_0xf8c5('0x47')](_0x5090b3,'queuecallerjoin');}}catch(_0x2294a6){logger[_0xf8c5('0x3e')](_0xf8c5('0x72'),_0x371c31[_0xf8c5('0x4f')],util['inspect'](_0x2294a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf8c5('0x1e')]=function(_0x102af5){try{if(this['isNotNull'](_0x102af5)){logger['debug'](_0xf8c5('0x7c'),_0x102af5[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x102af5,{'showHidden':![],'depth':null}));if(this[_0xf8c5('0x41')][_0x102af5[_0xf8c5('0x4f')]]){var _0x15efb6=_[_0xf8c5('0x7d')](this['queueReports'][_0x102af5[_0xf8c5('0x4f')]]);_0x15efb6[_0xf8c5('0x7e')]=![];_0x15efb6[_0xf8c5('0x7f')]=null;_0x15efb6['holdtime']=_0x102af5[_0xf8c5('0x80')];_0x15efb6[_0xf8c5('0x81')]=_0x102af5[_0xf8c5('0x81')];_0x15efb6[_0xf8c5('0x1d')]=!![];_0x15efb6[_0xf8c5('0x82')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15efb6[_0xf8c5('0x50')]='ABANDONED';_0x15efb6[_0xf8c5('0x83')]=null;logger[_0xf8c5('0x78')](_0xf8c5('0x84'),_0x15efb6[_0xf8c5('0x4c')],_0x15efb6[_0xf8c5('0x55')]);this[_0xf8c5('0x10')][_0x102af5[_0xf8c5('0x4f')]]=_0x15efb6;this[_0xf8c5('0x44')](_0x15efb6,_0xf8c5('0x1d'));}}}catch(_0x416203){logger[_0xf8c5('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x102af5['uniqueid'],util['inspect'](_0x416203,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf8c5('0x20')]=function(_0x496497){try{if(this[_0xf8c5('0x59')](_0x496497)){logger[_0xf8c5('0x48')](_0xf8c5('0x85'),_0x496497[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x496497,{'showHidden':![],'depth':null}));if(this[_0xf8c5('0x41')][_0x496497[_0xf8c5('0x4f')]]){var _0x3b14a5=_[_0xf8c5('0x7d')](this[_0xf8c5('0x41')][_0x496497[_0xf8c5('0x4f')]]);_0x3b14a5[_0xf8c5('0x86')]=moment()['format'](_0xf8c5('0x74'));_0x3b14a5[_0xf8c5('0x87')]=_0x496497[_0xf8c5('0x87')];_0x3b14a5[_0xf8c5('0x88')]=_0x496497['connectedlinename'];logger[_0xf8c5('0x78')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3b14a5[_0xf8c5('0x4c')],_0x3b14a5[_0xf8c5('0x55')],_0x496497[_0xf8c5('0x87')],_0x496497[_0xf8c5('0x88')]);this[_0xf8c5('0x10')][_0x496497[_0xf8c5('0x4f')]]=_0x3b14a5;this[_0xf8c5('0x47')](_0x3b14a5,_0xf8c5('0x1f'));}}}catch(_0x17106b){logger[_0xf8c5('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x496497[_0xf8c5('0x4f')],util['inspect'](_0x17106b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8c5('0xb')][_0xf8c5('0x89')]=function(_0x30788f){try{if(this[_0xf8c5('0x59')](_0x30788f)){logger[_0xf8c5('0x48')](_0xf8c5('0x8a'),_0x30788f[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x30788f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30788f['uniqueid']]){var _0x50e3da=_['last'](this[_0xf8c5('0x41')][_0x30788f[_0xf8c5('0x4f')]]);_0x50e3da[_0xf8c5('0x7e')]=!![];_0x50e3da[_0xf8c5('0x50')]=_0xf8c5('0x8b');logger[_0xf8c5('0x78')](_0xf8c5('0x8c'),_0x50e3da[_0xf8c5('0x4c')],_0x50e3da[_0xf8c5('0x55')]);}}}catch(_0x1a985a){logger[_0xf8c5('0x3e')](_0xf8c5('0x8a'),_0x30788f[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x1a985a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf8c5('0x21')]=function(_0x4c006b){try{if(this[_0xf8c5('0x59')](_0x4c006b)){logger[_0xf8c5('0x48')](_0xf8c5('0x8d'),_0x4c006b[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x4c006b,{'showHidden':![],'depth':null}));if(this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x4f')]]){var _0x467fce=_['last'](this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x4f')]]);_0x467fce[_0xf8c5('0x1d')]=![];_0x467fce[_0xf8c5('0x82')]=null;_0x467fce['assigned']=!![];_0x467fce[_0xf8c5('0x83')]=_0x4c006b[_0xf8c5('0x8e')];_0x467fce[_0xf8c5('0x80')]=_0x4c006b[_0xf8c5('0x80')];_0x467fce[_0xf8c5('0x7e')]=!![];_0x467fce[_0xf8c5('0x37')]=![];_0x467fce[_0xf8c5('0x8f')]=null;if(!_0x467fce[_0xf8c5('0x90')]){if(_0x4c006b[_0xf8c5('0x91')]==_0xf8c5('0x90')){_0x467fce[_0xf8c5('0x50')]='COMPLETED';logger[_0xf8c5('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x467fce[_0xf8c5('0x4c')],_0x467fce[_0xf8c5('0x55')]);}else{if(_[_0xf8c5('0x92')](_0x4c006b[_0xf8c5('0x3b')][_0xf8c5('0x93')](),_0xf8c5('0x94'))){if(this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x95')]]){var _0x59dd9e=_[_0xf8c5('0x7d')](this[_0xf8c5('0x41')][_0x4c006b['linkedid']]);_0x59dd9e[_0xf8c5('0x7e')]=![];_0x59dd9e[_0xf8c5('0x37')]=!![];_0x59dd9e[_0xf8c5('0x8f')]=moment(_0x467fce[_0xf8c5('0x73')])['add'](_0x4c006b[_0xf8c5('0x80')],'seconds')[_0xf8c5('0x4b')](_0xf8c5('0x74'));_0x59dd9e[_0xf8c5('0x50')]=_0xf8c5('0x96');_0x59dd9e[_0xf8c5('0x90')]=!![];_0x59dd9e[_0xf8c5('0x97')]=_0xf8c5('0x98');_0x59dd9e[_0xf8c5('0x99')]=_0x4c006b['destexten'];_0x59dd9e[_0xf8c5('0x9a')]=_0x4c006b[_0xf8c5('0x4f')];logger[_0xf8c5('0x78')](_0xf8c5('0x9b'),_0x59dd9e[_0xf8c5('0x4c')],_0x59dd9e[_0xf8c5('0x55')]);var _0x272b6b=this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x95')]];this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x95')]]=this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x4f')]];this[_0xf8c5('0x41')][_0x4c006b[_0xf8c5('0x4f')]]=_0x272b6b;}}else{_0x467fce['queuecallerexitreason']=_0xf8c5('0x9c')+_0x4c006b[_0xf8c5('0x91')][_0xf8c5('0x9d')]();logger[_0xf8c5('0x78')](_0xf8c5('0x9e'),_0x467fce[_0xf8c5('0x4c')],_0x467fce[_0xf8c5('0x55')],_0x467fce['queuecallerexitreason']);}}}this[_0xf8c5('0x10')][_0x4c006b[_0xf8c5('0x4f')]]=_0x467fce;}}}catch(_0x282191){logger[_0xf8c5('0x3e')](_0xf8c5('0x8d'),_0x4c006b[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x282191,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8c5('0xb')][_0xf8c5('0x22')]=function(_0x5045eb){try{if(this['isNotNull'](_0x5045eb)){logger[_0xf8c5('0x48')](_0xf8c5('0x9f'),_0x5045eb[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x5045eb,{'showHidden':![],'depth':null}));this['addVariable'](_0x5045eb[_0xf8c5('0x4f')],_[_0xf8c5('0xa0')](_0x5045eb['variable'])[0x0],_0x5045eb[_0xf8c5('0xa1')]);if(this[_0xf8c5('0x41')][_0x5045eb['uniqueid']]){var _0x204afe=_[_0xf8c5('0x7d')](this['queueReports'][_0x5045eb[_0xf8c5('0x4f')]]);if(_0x204afe){if(this[_0xf8c5('0x59')](_0x5045eb[_0xf8c5('0xa2')])&&this[_0xf8c5('0x59')](_0x5045eb[_0xf8c5('0xa2')][_0xf8c5('0x61')])){switch(_0x5045eb[_0xf8c5('0xa1')]){case _0xf8c5('0xa3'):_0x204afe[_0xf8c5('0x37')]=![];_0x204afe[_0xf8c5('0x8f')]=null;break;case _0xf8c5('0xa4'):_0x204afe['lastevent']=_0xf8c5('0xa5');_0x204afe['queuecallerexit']=!![];_0x204afe['queuecallerexitAt']=moment()[_0xf8c5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x204afe[_0xf8c5('0x86')]=moment()[_0xf8c5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5045eb[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x204afe,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x204afe);break;default:_0x204afe[_0xf8c5('0x37')]=!![];_0x204afe[_0xf8c5('0x8f')]=moment()[_0xf8c5('0x4b')](_0xf8c5('0x74'));_0x204afe[_0xf8c5('0x86')]=moment()[_0xf8c5('0x4b')](_0xf8c5('0x74'));}_0x204afe['queuecallerabandon']=![];_0x204afe['queuecallerabandonAt']=null;_0x204afe['queuecallerexitreason']=_0x5045eb[_0xf8c5('0xa1')];this['channels'][_0x5045eb['uniqueid']]=_0x204afe;this[_0xf8c5('0x44')](_0x204afe,_0xf8c5('0xa6'));}else if(this['isNotNull'](_0x5045eb['variable'])&&this[_0xf8c5('0x59')](_0x5045eb['variable'][_0xf8c5('0xa7')])){if(!_0x204afe[_0xf8c5('0x1d')]){_0x204afe[_0xf8c5('0x37')]=!![];_0x204afe[_0xf8c5('0x8f')]=moment()['format'](_0xf8c5('0x74'));_0x204afe[_0xf8c5('0x50')]=_0xf8c5('0xa8');_0x204afe[_0xf8c5('0x86')]=moment()[_0xf8c5('0x4b')](_0xf8c5('0x74'));this[_0xf8c5('0x10')][_0x5045eb['uniqueid']]=_0x204afe;}}logger['info'](_0xf8c5('0xa9'),_0x5045eb[_0xf8c5('0x4f')],_0x204afe['queue'],_0x204afe[_0xf8c5('0x55')],_[_0xf8c5('0xa0')](_0x5045eb[_0xf8c5('0xa2')])[0x0],_0x5045eb[_0xf8c5('0xa1')]);_0x204afe[_0xf8c5('0x42')]=this[_0xf8c5('0x42')][_0x5045eb[_0xf8c5('0x4f')]];}}}}catch(_0x5362de){logger[_0xf8c5('0x3e')]('[%s][voiceQueueReport][varset]',_0x5045eb[_0xf8c5('0x4f')],util[_0xf8c5('0x40')](_0x5362de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8c5('0xb')]['addVariable']=function(_0x1cddcb,_0x299657,_0x4f9020){var _0xc1acba=[_0xf8c5('0xaa'),_0xf8c5('0xab'),_0xf8c5('0xac'),_0xf8c5('0xad'),_0xf8c5('0xae'),_0xf8c5('0xaf'),_0xf8c5('0xb0'),_0xf8c5('0xb1'),'sipcallid','sipuri',_0xf8c5('0xb2'),_0xf8c5('0xb3'),'membercalls','memberdynamic','memberinterface',_0xf8c5('0xb4'),'membername','memberpenalty','memberrealtime'];if(!_['isNil'](_0x299657)&&!_[_0xf8c5('0xb5')](_0xc1acba,_0x299657)){if(_[_0xf8c5('0x5a')](this['variables'][_0x1cddcb])){this[_0xf8c5('0x42')][_0x1cddcb]={};}this['variables'][_0x1cddcb][_0x299657]=_0x4f9020;}};VoiceQueueReport['prototype'][_0xf8c5('0xb6')]=function(_0x2f7de0,_0x244920,_0xd7fb1e){try{var _0x2a3d6e={};if(this[_0xf8c5('0x41')][_0x2f7de0]){for(var _0x1cd7b6=0x0;_0x1cd7b6=0x0?moment(_0x423c26['endtime'])['diff'](_0x423c26[_0xb824('0x18')],_0xb824('0xf')):null,'data1':_0xb824('0x1a'),'data2':_0x423c26[_0xb824('0x14')],'data3':_0x423c26[_0xb824('0x12')],'data4':_0x423c26[_0xb824('0x1b')]||null,'role':_0xb824('0x1c'),'internal':_0x423c26[_0xb824('0x14')]?_[_0xb824('0x15')](_0x423c26[_0xb824('0x14')]):undefined,'uniqueid':_0x423c26[_0xb824('0x1d')]},'log':_0xb824('0x16')});}; \ No newline at end of file +var _0xee4d=['diff','seconds','calleridnum','queue','agent','accountcode','toNumber','uniqueid','membername','starttime','endtime','exten','dialstring','moment','lodash','util','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt'];(function(_0x2b3153,_0x2df12e){var _0x4a0841=function(_0x19722d){while(--_0x19722d){_0x2b3153['push'](_0x2b3153['shift']());}};_0x4a0841(++_0x2df12e);}(_0xee4d,0xb5));var _0xdee4=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xee4d[_0x397cfb];return _0x15fed9;};'use strict';var moment=require(_0xdee4('0x0'));var _=require(_0xdee4('0x1'));var util=require(_0xdee4('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x5aca20){var _0x4c912e=_0x5aca20[_0xdee4('0x3')]||_0x5aca20[_0xdee4('0x4')];return client[_0xdee4('0x5')](_0xdee4('0x6'),{'body':{'channel':_0xdee4('0x7'),'membername':_0x5aca20['lastAssignedTo'],'interface':_[_0xdee4('0x8')](_0x5aca20[_0xdee4('0x9')])?util[_0xdee4('0xa')](_0xdee4('0xb'),_0x5aca20[_0xdee4('0xc')]):_0x5aca20['interface'],'type':_0xdee4('0xd'),'enterAt':_0x5aca20[_0xdee4('0xe')],'exitAt':_0x4c912e,'duration':moment(_0x4c912e)[_0xdee4('0xf')](_0x5aca20[_0xdee4('0xe')],_0xdee4('0x10')),'data1':'inbound','data2':_0x5aca20[_0xdee4('0x11')],'data3':_0x5aca20['exten'],'data4':null,'data5':_0x5aca20[_0xdee4('0x12')],'role':_0xdee4('0x13'),'internal':_0x5aca20[_0xdee4('0x14')]?_[_0xdee4('0x15')](_0x5aca20[_0xdee4('0x14')]):undefined,'uniqueid':_0x5aca20[_0xdee4('0x16')]},'log':_0xdee4('0x6')});};exports['voiceDialReport']=function(_0x3f3246){return client[_0xdee4('0x5')](_0xdee4('0x6'),{'body':{'channel':_0xdee4('0x7'),'membername':_0x3f3246[_0xdee4('0x17')],'interface':_0x3f3246['interface'],'type':'TALKING','enterAt':_0x3f3246[_0xdee4('0x18')],'exitAt':_0x3f3246['endtime'],'duration':moment(_0x3f3246['endtime'])[_0xdee4('0xf')](_0x3f3246[_0xdee4('0x18')],'seconds')>=0x0?moment(_0x3f3246[_0xdee4('0x19')])[_0xdee4('0xf')](_0x3f3246[_0xdee4('0x18')],_0xdee4('0x10')):null,'data1':'outbound','data2':_0x3f3246[_0xdee4('0x14')],'data3':_0x3f3246[_0xdee4('0x1a')],'data4':_0x3f3246[_0xdee4('0x1b')]||null,'role':_0xdee4('0x13'),'internal':_0x3f3246[_0xdee4('0x14')]?_[_0xdee4('0x15')](_0x3f3246[_0xdee4('0x14')]):undefined,'uniqueid':_0x3f3246[_0xdee4('0x16')]},'log':_0xdee4('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 86cc71b..0bf47a3 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 _0x5a1c=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x565e69,_0x3461b5){var _0x5e4884=function(_0x1cd2f9){while(--_0x1cd2f9){_0x565e69['push'](_0x565e69['shift']());}};_0x5e4884(++_0x3461b5);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x35bad7,_0x3e6e33){_0x35bad7=_0x35bad7-0x0;var _0x52f8ce=_0x5a1c[_0x35bad7];return _0x52f8ce;};'use strict';var client=require(_0xc5a1('0x0'));exports[_0xc5a1('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5a1('0x2'),'previewRecallmeReminderInterval']},'log':_0xc5a1('0x3')});}; \ No newline at end of file +var _0x9656=['ShowSetting','previewRecallmeReminderInterval','../client','Request'];(function(_0x2fbe5f,_0x4c5c13){var _0x21db60=function(_0x467893){while(--_0x467893){_0x2fbe5f['push'](_0x2fbe5f['shift']());}};_0x21db60(++_0x4c5c13);}(_0x9656,0x15e));var _0x6965=function(_0x387051,_0x11809e){_0x387051=_0x387051-0x0;var _0x77e2fa=_0x9656[_0x387051];return _0x77e2fa;};'use strict';var client=require(_0x6965('0x0'));exports['getSettings']=function(){return client[_0x6965('0x1')](_0x6965('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6965('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 25c063f..626d6a5 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 _0x0289=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x427435,_0x4e76ec){var _0x2442a0=function(_0x182282){while(--_0x182282){_0x427435['push'](_0x427435['shift']());}};_0x2442a0(++_0x4e76ec);}(_0x0289,0x14c));var _0x9028=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0x0289[_0x10a889];return _0x3b5ed3;};'use strict';var client=require(_0x9028('0x0'));exports[_0x9028('0x1')]=function(_0x516441){return function(_0x41b478){return client[_0x9028('0x2')](_0x9028('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9028('0x4'),_0x9028('0x5')]},'log':_0x9028('0x3')});};}; \ No newline at end of file +var _0xad6b=['../client','getTemplates','Request','GetTemplate','html'];(function(_0x14de1a,_0x4bf6fa){var _0x4960de=function(_0x307b3e){while(--_0x307b3e){_0x14de1a['push'](_0x14de1a['shift']());}};_0x4960de(++_0x4bf6fa);}(_0xad6b,0x159));var _0xbad6=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xad6b[_0x5f309e];return _0x487b5e;};'use strict';var client=require(_0xbad6('0x0'));exports[_0xbad6('0x1')]=function(_0x5ecd00){return function(_0x623e9){return client[_0xbad6('0x2')](_0xbad6('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xbad6('0x4')]},'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 05cab0a..efe1588 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 _0x9064=['GetTrigger','name','channel','Condition','AllConditions','operator','value','AnyConditions','field','Action','action','data2','data3','data4','data6','data7','getTriggers','Request'];(function(_0x4e38db,_0x153522){var _0x106544=function(_0x1fd495){while(--_0x1fd495){_0x4e38db['push'](_0x4e38db['shift']());}};_0x106544(++_0x153522);}(_0x9064,0x178));var _0x4906=function(_0x1537d0,_0x2bf71d){_0x1537d0=_0x1537d0-0x0;var _0x4d4bfe=_0x9064[_0x1537d0];return _0x4d4bfe;};'use strict';var client=require('../client');exports[_0x4906('0x0')]=function(_0x394842){return function(_0x4e0361){return client[_0x4906('0x1')](_0x4906('0x2'),{'options':{'raw':![],'attributes':['id',_0x4906('0x3'),_0x4906('0x4'),'status'],'include':[{'model':_0x4906('0x5'),'as':_0x4906('0x6'),'attributes':['id','field',_0x4906('0x7'),_0x4906('0x8')]},{'model':'Condition','as':_0x4906('0x9'),'attributes':['id',_0x4906('0xa'),_0x4906('0x7'),_0x4906('0x8')]},{'model':_0x4906('0xb'),'as':'Actions','attributes':['id',_0x4906('0xc'),'data1',_0x4906('0xd'),_0x4906('0xe'),_0x4906('0xf'),'data5',_0x4906('0x10'),_0x4906('0x11')]}]},'log':_0x4906('0x2')});};}; \ No newline at end of file +var _0x02e3=['field','operator','value','AnyConditions','Action','Actions','action','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status'];(function(_0x23ad16,_0x40c45a){var _0x435bc2=function(_0x172c5e){while(--_0x172c5e){_0x23ad16['push'](_0x23ad16['shift']());}};_0x435bc2(++_0x40c45a);}(_0x02e3,0xe8));var _0x302e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x02e3[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x302e('0x0'));exports[_0x302e('0x1')]=function(_0x1570ef){return function(_0x35668d){return client['Request'](_0x302e('0x2'),{'options':{'raw':![],'attributes':['id',_0x302e('0x3'),_0x302e('0x4'),_0x302e('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x302e('0x6'),_0x302e('0x7'),_0x302e('0x8')]},{'model':'Condition','as':_0x302e('0x9'),'attributes':['id',_0x302e('0x6'),_0x302e('0x7'),_0x302e('0x8')]},{'model':_0x302e('0xa'),'as':_0x302e('0xb'),'attributes':['id',_0x302e('0xc'),'data1','data2','data3',_0x302e('0xd'),_0x302e('0xe'),_0x302e('0xf'),_0x302e('0x10')]}]},'log':_0x302e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8f252ad..83adb6e 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 _0x8d98=['name','registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x540732,_0x304900){var _0x305c2a=function(_0xef391a){while(--_0xef391a){_0x540732['push'](_0x540732['shift']());}};_0x305c2a(++_0x304900);}(_0x8d98,0x1a7));var _0x88d9=function(_0x2043e4,_0x5bb36f){_0x2043e4=_0x2043e4-0x0;var _0x309ffb=_0x8d98[_0x2043e4];return _0x309ffb;};'use strict';var client=require(_0x88d9('0x0'));exports[_0x88d9('0x1')]=function(_0x407a59){return function(_0x442ccd){return client['Request'](_0x88d9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x88d9('0x3'),_0x88d9('0x4'),_0x88d9('0x5')]},'log':_0x88d9('0x2')});};}; \ No newline at end of file +var _0xbf65=['getTrunks','GetTrunk','name','defaultuser','../client'];(function(_0x5c17ab,_0x1c429b){var _0x15c452=function(_0x4370eb){while(--_0x4370eb){_0x5c17ab['push'](_0x5c17ab['shift']());}};_0x15c452(++_0x1c429b);}(_0xbf65,0x158));var _0x5bf6=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbf65[_0x101e7b];return _0x4995c0;};'use strict';var client=require(_0x5bf6('0x0'));exports[_0x5bf6('0x1')]=function(_0x501a17){return function(_0x1bfd13){return client['Request'](_0x5bf6('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5bf6('0x3'),'registry',_0x5bf6('0x4')]},'log':_0x5bf6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f558b66..4bcba8a 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x299c38,_0x421b9f){var _0x501076=function(_0x47ba54){while(--_0x47ba54){_0x299c38['push'](_0x299c38['shift']());}};_0x501076(++_0x421b9f);}(_0x70e0,0x17b));var _0x070e=function(_0x274f3b,_0x4d8b0f){_0x274f3b=_0x274f3b-0x0;var _0x17db5b=_0x70e0[_0x274f3b];return _0x17db5b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1a3f00,_0x4a5bbc){var _0xeb53c7=function(_0x34a6b8){while(--_0x34a6b8){_0x1a3f00['push'](_0x1a3f00['shift']());}};_0xeb53c7(++_0x4a5bbc);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 192f659..6b28f3f 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 _0xba9a=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba9a,0x17e));var _0xaba9=function(_0x294d7f,_0x4dc59d){_0x294d7f=_0x294d7f-0x0;var _0x1156b5=_0xba9a[_0x294d7f];return _0x1156b5;};'use strict';var client=require('../client');exports[_0xaba9('0x0')]=function(_0x327547){return client[_0xaba9('0x1')](_0xaba9('0x2'),{'body':_0x327547,'log':_0xaba9('0x2')});};exports[_0xaba9('0x3')]=function(_0x4ccc09,_0x1ba32e,_0x33326f){return client[_0xaba9('0x1')]('UpdateVoiceAgentReport',{'body':_0x4ccc09,'options':{'where':{'uniqueid':_0x1ba32e,'interface':_0x33326f,'agentcomplete':!![]}},'log':_0xaba9('0x4')});}; \ No newline at end of file +var _0x1bd1=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x4b5be4,_0x444152){var _0x488ca2=function(_0x148c61){while(--_0x148c61){_0x4b5be4['push'](_0x4b5be4['shift']());}};_0x488ca2(++_0x444152);}(_0x1bd1,0x131));var _0x11bd=function(_0x51d810,_0x30b6c3){_0x51d810=_0x51d810-0x0;var _0x2ad77b=_0x1bd1[_0x51d810];return _0x2ad77b;};'use strict';var client=require(_0x11bd('0x0'));exports[_0x11bd('0x1')]=function(_0x470651){return client[_0x11bd('0x2')](_0x11bd('0x3'),{'body':_0x470651,'log':_0x11bd('0x3')});};exports[_0x11bd('0x4')]=function(_0x51f89b,_0x243f2d,_0x372ab5){return client[_0x11bd('0x2')](_0x11bd('0x5'),{'body':_0x51f89b,'options':{'where':{'uniqueid':_0x243f2d,'interface':_0x372ab5,'agentcomplete':!![]}},'log':_0x11bd('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 490203d..9c4b414 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 _0xcf55=['../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','lodash'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xcf55,0x1b7));var _0x5cf5=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xcf55[_0x4ada50];return _0x3d85d5;};'use strict';var moment=require(_0x5cf5('0x0'));var util=require('util');var _=require(_0x5cf5('0x1'));var client=require(_0x5cf5('0x2'));exports[_0x5cf5('0x3')]=function(_0x175951){return client[_0x5cf5('0x4')](_0x5cf5('0x5'),{'body':_['merge'](_0x175951,{'source':_0x175951[_0x5cf5('0x6')],'destinationcontext':_0x175951[_0x5cf5('0x7')],'callerid':_0x175951[_0x5cf5('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x5cf5('0x5')});};exports[_0x5cf5('0x9')]=function(){return function(){return client[_0x5cf5('0x4')](_0x5cf5('0xa'),{'options':{'where':{'type':[_0x5cf5('0xb')],'createdAt':{'$between':[moment()[_0x5cf5('0xc')](_0x5cf5('0xd'))[_0x5cf5('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5cf5('0xf')]('day')[_0x5cf5('0xe')](_0x5cf5('0x10'))]}},'attributes':[_0x5cf5('0x11'),'disposition',_0x5cf5('0x12'),_0x5cf5('0x13')]},'log':_0x5cf5('0x14')});};}; \ No newline at end of file +var _0x89f9=['util','lodash','../client','create','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x3527e5,_0x3a0bcf){var _0x1cfe72=function(_0x51acd1){while(--_0x51acd1){_0x3527e5['push'](_0x3527e5['shift']());}};_0x1cfe72(++_0x3a0bcf);}(_0x89f9,0x153));var _0x989f=function(_0x2dfd4f,_0x2fc0f5){_0x2dfd4f=_0x2dfd4f-0x0;var _0x439afe=_0x89f9[_0x2dfd4f];return _0x439afe;};'use strict';var moment=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var _=require(_0x989f('0x2'));var client=require(_0x989f('0x3'));exports[_0x989f('0x4')]=function(_0x27ae62){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0x27ae62,{'source':_0x27ae62[_0x989f('0x5')],'destinationcontext':_0x27ae62[_0x989f('0x6')],'callerid':_0x27ae62[_0x989f('0x7')],'amaflags':_0x989f('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x989f('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x989f('0xa')],'createdAt':{'$between':[moment()[_0x989f('0xb')](_0x989f('0xc'))[_0x989f('0xd')](_0x989f('0xe')),moment()[_0x989f('0xf')](_0x989f('0xc'))['format'](_0x989f('0xe'))]}},'attributes':[_0x989f('0x10'),_0x989f('0x11'),_0x989f('0x12'),'billableseconds']},'log':_0x989f('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5a9e80b..453289a 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 _0x054c=['../client','create','CreateVoiceDialReport'];(function(_0x36141e,_0x584aad){var _0x115fba=function(_0x49b235){while(--_0x49b235){_0x36141e['push'](_0x36141e['shift']());}};_0x115fba(++_0x584aad);}(_0x054c,0x1dd));var _0xc054=function(_0x2c4c00,_0x2b0f28){_0x2c4c00=_0x2c4c00-0x0;var _0x1cc943=_0x054c[_0x2c4c00];return _0x1cc943;};'use strict';var client=require(_0xc054('0x0'));exports[_0xc054('0x1')]=function(_0x3f23b7){return client['Request'](_0xc054('0x2'),{'body':_0x3f23b7,'log':_0xc054('0x2')});}; \ No newline at end of file +var _0x070f=['CreateVoiceDialReport'];(function(_0x56c2d3,_0x245571){var _0x21b228=function(_0xa12d00){while(--_0xa12d00){_0x56c2d3['push'](_0x56c2d3['shift']());}};_0x21b228(++_0x245571);}(_0x070f,0x12d));var _0xf070=function(_0x153159,_0x46d0a5){_0x153159=_0x153159-0x0;var _0x4691fc=_0x070f[_0x153159];return _0x4691fc;};'use strict';var client=require('../client');exports['create']=function(_0x3ec0be){return client['Request'](_0xf070('0x0'),{'body':_0x3ec0be,'log':_0xf070('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2bd7843..ce5462c 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 _0x6f7a=['../client','getVoiceExtensions','Request','GetVoiceExtension','recordingFormat'];(function(_0x5b3f83,_0x2801c5){var _0x47ee75=function(_0x40509a){while(--_0x40509a){_0x5b3f83['push'](_0x5b3f83['shift']());}};_0x47ee75(++_0x2801c5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2087b4,_0x1b050e){_0x2087b4=_0x2087b4-0x0;var _0x27c480=_0x6f7a[_0x2087b4];return _0x27c480;};'use strict';var client=require(_0xa6f7('0x0'));exports[_0xa6f7('0x1')]=function(){return function(){return client[_0xa6f7('0x2')](_0xa6f7('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xa6f7('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa6f7('0x1')});};}; \ No newline at end of file +var _0x1be1=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x452bb7,_0x780087){var _0x287506=function(_0x32ff7f){while(--_0x32ff7f){_0x452bb7['push'](_0x452bb7['shift']());}};_0x287506(++_0x780087);}(_0x1be1,0x192));var _0x11be=function(_0x33825f,_0x15a216){_0x33825f=_0x33825f-0x0;var _0x47908a=_0x1be1[_0x33825f];return _0x47908a;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x11be('0x0')](_0x11be('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x11be('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x11be('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 51fe2cf..d588f64 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 _0x70ae=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x70ae,0xad));var _0xe70a=function(_0x395b75,_0x5e4170){_0x395b75=_0x395b75-0x0;var _0x21f76c=_0x70ae[_0x395b75];return _0x21f76c;};'use strict';var client=require(_0xe70a('0x0'));exports[_0xe70a('0x1')]=function(){return function(){return client[_0xe70a('0x2')](_0xe70a('0x3'),{'options':{'raw':![],'attributes':['id',_0xe70a('0x4'),_0xe70a('0x5'),'acwTimeout','autopause',_0xe70a('0x6'),'type',_0xe70a('0x7'),'dialMethod',_0xe70a('0x8'),_0xe70a('0x9'),_0xe70a('0xa'),_0xe70a('0xb'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xe70a('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xe70a('0xd'),_0xe70a('0xe'),_0xe70a('0xf'),_0xe70a('0x10'),_0xe70a('0x11'),'dialBusyMaxRetry',_0xe70a('0x12'),_0xe70a('0x13'),_0xe70a('0x14'),_0xe70a('0x15'),_0xe70a('0x16'),'dialGlobalInterval',_0xe70a('0x17'),'dialCheckDuplicateType',_0xe70a('0x18'),'dialAMDInitialSilence',_0xe70a('0x19'),'dialAMDAfterGreetingSilence',_0xe70a('0x1a'),_0xe70a('0x1b'),'dialAMDBetweenWordsSilence',_0xe70a('0x1c'),_0xe70a('0x1d'),'dialAMDMaximumWordLength',_0xe70a('0x1e'),'dialRecallMeTimeout','dialRecallInQueue',_0xe70a('0x1f'),'dialAgiAfterHangupAgent',_0xe70a('0x20'),_0xe70a('0x21'),_0xe70a('0x6'),'strategy',_0xe70a('0x22'),_0xe70a('0x23'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xe70a('0x24'),_0xe70a('0x25'),_0xe70a('0x26'),'dialAbandonedRetryFrequency',_0xe70a('0x27'),_0xe70a('0x28'),_0xe70a('0x29'),_0xe70a('0x2a'),_0xe70a('0x2b'),_0xe70a('0x2c'),_0xe70a('0x2d'),_0xe70a('0x2e'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xe70a('0x2f'),'as':_0xe70a('0x2f'),'attributes':['id',_0xe70a('0x4'),'callerid','active']},{'model':_0xe70a('0x30'),'as':_0xe70a('0x31'),'attributes':['id',_0xe70a('0x4')]},{'model':_0xe70a('0x2f'),'as':'TrunkBackup','attributes':['id',_0xe70a('0x4'),_0xe70a('0x32'),_0xe70a('0x33')]},{'model':_0xe70a('0x34'),'as':'Interval','attributes':['id',_0xe70a('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xe70a('0x4'),_0xe70a('0x35')]}]}]},'log':_0xe70a('0x1')});};}; \ No newline at end of file +var _0x4730=['dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x1422dd,_0x4465cf){var _0x304e54=function(_0xb46c63){while(--_0xb46c63){_0x1422dd['push'](_0x1422dd['shift']());}};_0x304e54(++_0x4465cf);}(_0x4730,0xa4));var _0x0473=function(_0xc6b011,_0x5d1f19){_0xc6b011=_0xc6b011-0x0;var _0x420171=_0x4730[_0xc6b011];return _0x420171;};'use strict';var client=require(_0x0473('0x0'));exports[_0x0473('0x1')]=function(){return function(){return client[_0x0473('0x2')](_0x0473('0x3'),{'options':{'raw':![],'attributes':['id',_0x0473('0x4'),_0x0473('0x5'),_0x0473('0x6'),_0x0473('0x7'),_0x0473('0x8'),'type',_0x0473('0x9'),_0x0473('0xa'),_0x0473('0xb'),_0x0473('0xc'),_0x0473('0xd'),_0x0473('0xe'),_0x0473('0xf'),_0x0473('0x10'),_0x0473('0x11'),_0x0473('0x12'),_0x0473('0x13'),_0x0473('0x14'),_0x0473('0x15'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x0473('0x16'),_0x0473('0x17'),_0x0473('0x18'),_0x0473('0x19'),_0x0473('0x1a'),_0x0473('0x1b'),_0x0473('0x1c'),'dialPrefix','dialCheckDuplicateType',_0x0473('0x1d'),_0x0473('0x1e'),_0x0473('0x1f'),_0x0473('0x20'),_0x0473('0x21'),'dialAMDMinWordLength',_0x0473('0x22'),_0x0473('0x23'),_0x0473('0x24'),_0x0473('0x25'),_0x0473('0x26'),'dialRecallMeTimeout','dialRecallInQueue',_0x0473('0x27'),_0x0473('0x28'),_0x0473('0x29'),_0x0473('0x2a'),'monitor_format','strategy',_0x0473('0x2b'),_0x0473('0x2c'),_0x0473('0x2d'),_0x0473('0x2e'),_0x0473('0x2f'),_0x0473('0x30'),_0x0473('0x31'),_0x0473('0x32'),_0x0473('0x33'),_0x0473('0x34'),'dialAgentRejectMaxRetry',_0x0473('0x35'),_0x0473('0x36'),_0x0473('0x37'),_0x0473('0x38'),_0x0473('0x39'),_0x0473('0x3a')],'include':[{'model':_0x0473('0x3b'),'as':_0x0473('0x3b'),'attributes':['id','name','callerid',_0x0473('0x3c')]},{'model':_0x0473('0x3d'),'as':_0x0473('0x3e'),'attributes':['id',_0x0473('0x4')]},{'model':_0x0473('0x3b'),'as':_0x0473('0x3f'),'attributes':['id',_0x0473('0x4'),'callerid','active']},{'model':_0x0473('0x40'),'as':_0x0473('0x40'),'attributes':['id',_0x0473('0x4')],'include':[{'model':'Interval','as':_0x0473('0x41'),'attributes':['id','name',_0x0473('0x42')]}]}]},'log':_0x0473('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 791cbdb..ef089e9 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(_0x2d7b3f,_0x5c6735){var _0x3eb39d=function(_0x55c1ab){while(--_0x55c1ab){_0x2d7b3f['push'](_0x2d7b3f['shift']());}};_0x3eb39d(++_0x5c6735);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x58fb64,_0x4b5129){var _0x1b2519=function(_0x2d497a){while(--_0x2d497a){_0x58fb64['push'](_0x58fb64['shift']());}};_0x1b2519(++_0x4b5129);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 a1d980d..b3822ae 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 _0xca05=['getVoiceQueueRtPauses','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca05,0x7f));var _0x5ca0=function(_0xc2c0c3,_0x2bf8a9){_0xc2c0c3=_0xc2c0c3-0x0;var _0x292acf=_0xca05[_0xc2c0c3];return _0x292acf;};'use strict';var client=require(_0x5ca0('0x0'));exports[_0x5ca0('0x1')]=function(_0x6f2f85){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x6f2f85,'paused':!![]},'raw':!![]},'log':_0x5ca0('0x1')});};}; \ No newline at end of file +var _0xa2cb=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x2f9f3c,_0x3c1af4){var _0x633062=function(_0x1640d0){while(--_0x1640d0){_0x2f9f3c['push'](_0x2f9f3c['shift']());}};_0x633062(++_0x3c1af4);}(_0xa2cb,0x6e));var _0xba2c=function(_0x265519,_0x116ebb){_0x265519=_0x265519-0x0;var _0x4c14cb=_0xa2cb[_0x265519];return _0x4c14cb;};'use strict';var client=require(_0xba2c('0x0'));exports['getVoiceQueueRtPauses']=function(_0x50d5b0){return function(){return client[_0xba2c('0x1')](_0xba2c('0x2'),{'options':{'where':{'VoiceQueueId':_0x50d5b0,'paused':!![]},'raw':!![]},'log':_0xba2c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f3c3e55..451af08 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(_0x4d731f,_0x27ef41){var _0x215b83=function(_0x469304){while(--_0x469304){_0x4d731f['push'](_0x4d731f['shift']());}};_0x215b83(++_0x27ef41);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2dbc3b,_0xef845f){var _0x554d1a=function(_0x2601e2){while(--_0x2601e2){_0x2dbc3b['push'](_0x2dbc3b['shift']());}};_0x554d1a(++_0xef845f);}(_0x7a54,0x106));var _0x47a5=function(_0x2b95db,_0x480754){_0x2b95db=_0x2b95db-0x0;var _0x2df751=_0x7a54[_0x2b95db];return _0x2df751;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index aa725e7..8546558 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 _0x9c72=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode'];(function(_0x38da7c,_0x646a68){var _0x98dfc4=function(_0x35933c){while(--_0x35933c){_0x38da7c['push'](_0x38da7c['shift']());}};_0x98dfc4(++_0x646a68);}(_0x9c72,0xcd));var _0x29c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c72[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x29c7('0x0')]={};exports[_0x29c7('0x1')]=function(_0x8c64bd){return client[_0x29c7('0x2')](_0x29c7('0x3'),{'body':{'result':_0x8c64bd[_0x29c7('0x4')],'transfererchannel':_0x8c64bd[_0x29c7('0x5')],'transferercalleridnum':_0x8c64bd[_0x29c7('0x6')],'transferercalleridname':_0x8c64bd[_0x29c7('0x7')],'transfererconnectedlinenum':_0x8c64bd['transfererconnectedlinenum'],'transfererconnectedlinename':_0x8c64bd[_0x29c7('0x8')],'transfereraccountcode':_0x8c64bd[_0x29c7('0x9')],'transferercontext':_0x8c64bd[_0x29c7('0xa')],'transfererexten':_0x8c64bd[_0x29c7('0xb')],'transfererlinkedid':_0x8c64bd[_0x29c7('0xc')],'transfereechannel':_0x8c64bd[_0x29c7('0xd')],'transfereecalleridnum':_0x8c64bd[_0x29c7('0xe')],'transfereecalleridname':_0x8c64bd[_0x29c7('0xf')],'transfereeconnectedlinenum':_0x8c64bd[_0x29c7('0x10')],'transfereeconnectedlinename':_0x8c64bd[_0x29c7('0x11')],'transfereeaccountcode':_0x8c64bd[_0x29c7('0x12')],'transfereecontext':_0x8c64bd[_0x29c7('0x13')],'transfereeexten':_0x8c64bd['transfereeexten'],'transfereelinkedid':_0x8c64bd[_0x29c7('0x14')],'isexternal':_0x8c64bd[_0x29c7('0x15')],'context':_0x8c64bd[_0x29c7('0x16')],'extension':_0x8c64bd[_0x29c7('0x17')],'type':_0x29c7('0x18')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0xfb21e5){return client[_0x29c7('0x2')](_0x29c7('0x3'),{'body':{'result':_0xfb21e5[_0x29c7('0x4')],'transfererchannel':_0xfb21e5[_0x29c7('0x19')],'transferercalleridnum':_0xfb21e5[_0x29c7('0x1a')],'transferercalleridname':_0xfb21e5[_0x29c7('0x1b')],'transfererconnectedlinenum':_0xfb21e5[_0x29c7('0x1c')],'transfererconnectedlinename':_0xfb21e5[_0x29c7('0x1d')],'transfereraccountcode':_0xfb21e5[_0x29c7('0x1e')],'transferercontext':_0xfb21e5[_0x29c7('0x1f')],'transfererexten':_0xfb21e5['secondtransfererexten'],'transfererlinkedid':_0xfb21e5[_0x29c7('0x20')],'transfereechannel':_0xfb21e5[_0x29c7('0x21')],'transfereecalleridnum':_0xfb21e5[_0x29c7('0x22')],'transfereecalleridname':_0xfb21e5[_0x29c7('0x23')],'transfereeconnectedlinenum':_0xfb21e5[_0x29c7('0x24')],'transfereeconnectedlinename':_0xfb21e5['transfertargetconnectedlinename'],'transfereeaccountcode':_0xfb21e5['transfertargetaccountcode'],'transfereecontext':_0xfb21e5[_0x29c7('0x25')],'transfereeexten':_0xfb21e5[_0x29c7('0x26')],'transfereelinkedid':_0xfb21e5[_0x29c7('0x27')],'isexternal':_0xfb21e5[_0x29c7('0x15')],'context':_0xfb21e5[_0x29c7('0x28')],'extension':_0xfb21e5[_0x29c7('0x29')],'type':_0x29c7('0x2a')},'log':_0x29c7('0x3')});}; \ No newline at end of file +var _0x0095=['origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x10e0f1,_0x8a833e){var _0x4f4614=function(_0x2a84a0){while(--_0x2a84a0){_0x10e0f1['push'](_0x10e0f1['shift']());}};_0x4f4614(++_0x8a833e);}(_0x0095,0x1c6));var _0x5009=function(_0x2265b0,_0x279abe){_0x2265b0=_0x2265b0-0x0;var _0xc4900b=_0x0095[_0x2265b0];return _0xc4900b;};'use strict';var client=require(_0x5009('0x0'));exports[_0x5009('0x1')]={};exports[_0x5009('0x2')]=function(_0x1a4af7){return client[_0x5009('0x3')](_0x5009('0x4'),{'body':{'result':_0x1a4af7[_0x5009('0x5')],'transfererchannel':_0x1a4af7[_0x5009('0x6')],'transferercalleridnum':_0x1a4af7['transferercalleridnum'],'transferercalleridname':_0x1a4af7['transferercalleridname'],'transfererconnectedlinenum':_0x1a4af7[_0x5009('0x7')],'transfererconnectedlinename':_0x1a4af7[_0x5009('0x8')],'transfereraccountcode':_0x1a4af7[_0x5009('0x9')],'transferercontext':_0x1a4af7[_0x5009('0xa')],'transfererexten':_0x1a4af7[_0x5009('0xb')],'transfererlinkedid':_0x1a4af7[_0x5009('0xc')],'transfereechannel':_0x1a4af7['transfereechannel'],'transfereecalleridnum':_0x1a4af7['transfereecalleridnum'],'transfereecalleridname':_0x1a4af7[_0x5009('0xd')],'transfereeconnectedlinenum':_0x1a4af7[_0x5009('0xe')],'transfereeconnectedlinename':_0x1a4af7[_0x5009('0xf')],'transfereeaccountcode':_0x1a4af7[_0x5009('0x10')],'transfereecontext':_0x1a4af7['transfereecontext'],'transfereeexten':_0x1a4af7['transfereeexten'],'transfereelinkedid':_0x1a4af7[_0x5009('0x11')],'isexternal':_0x1a4af7[_0x5009('0x12')],'context':_0x1a4af7[_0x5009('0x13')],'extension':_0x1a4af7[_0x5009('0x14')],'type':'blind'},'log':_0x5009('0x4')});};exports[_0x5009('0x15')]=function(_0x5c8cb5){return client[_0x5009('0x3')](_0x5009('0x4'),{'body':{'result':_0x5c8cb5[_0x5009('0x5')],'transfererchannel':_0x5c8cb5[_0x5009('0x16')],'transferercalleridnum':_0x5c8cb5[_0x5009('0x17')],'transferercalleridname':_0x5c8cb5[_0x5009('0x18')],'transfererconnectedlinenum':_0x5c8cb5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5c8cb5[_0x5009('0x19')],'transfereraccountcode':_0x5c8cb5[_0x5009('0x1a')],'transferercontext':_0x5c8cb5['secondtransferercontext'],'transfererexten':_0x5c8cb5[_0x5009('0x1b')],'transfererlinkedid':_0x5c8cb5[_0x5009('0x1c')],'transfereechannel':_0x5c8cb5[_0x5009('0x1d')],'transfereecalleridnum':_0x5c8cb5[_0x5009('0x1e')],'transfereecalleridname':_0x5c8cb5[_0x5009('0x1f')],'transfereeconnectedlinenum':_0x5c8cb5[_0x5009('0x20')],'transfereeconnectedlinename':_0x5c8cb5[_0x5009('0x21')],'transfereeaccountcode':_0x5c8cb5[_0x5009('0x22')],'transfereecontext':_0x5c8cb5[_0x5009('0x23')],'transfereeexten':_0x5c8cb5[_0x5009('0x24')],'transfereelinkedid':_0x5c8cb5[_0x5009('0x25')],'isexternal':_0x5c8cb5[_0x5009('0x12')],'context':_0x5c8cb5[_0x5009('0x26')],'extension':_0x5c8cb5[_0x5009('0x27')],'type':_0x5009('0x28')},'log':_0x5009('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2e0de7d..950c7b6 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0xaafe34,_0x207ba9){var _0x4c4468=function(_0x3cb01d){while(--_0x3cb01d){_0xaafe34['push'](_0xaafe34['shift']());}};_0x4c4468(++_0x207ba9);}(_0x7a54,0x106));var _0x47a5=function(_0xcbd842,_0x3aa012){_0xcbd842=_0xcbd842-0x0;var _0x2af4ba=_0x7a54[_0xcbd842];return _0x2af4ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4dcc46,_0x101a08){var _0x4c3814=function(_0x41a92c){while(--_0x41a92c){_0x4dcc46['push'](_0x4dcc46['shift']());}};_0x4c3814(++_0x101a08);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c4024,_0x1fb7c9){_0x3c4024=_0x3c4024-0x0;var _0x20f126=_0xb10b[_0x3c4024];return _0x20f126;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 5e3e6e2..20eabcd 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 _0x22be=['destcalleridname','','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','Unknown'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x22be,0x15c));var _0xe22b=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x22be[_0x170772];return _0x3ef69c;};'use strict';var _=require('lodash');var BPromise=require(_0xe22b('0x0'));var Redis=require('ioredis');var util=require(_0xe22b('0x1'));var config=require(_0xe22b('0x2'));var logger=require(_0xe22b('0x3'))(_0xe22b('0x4'));var cmContactRpc=require(_0xe22b('0x5'));config['redis']=_[_0xe22b('0x6')](config[_0xe22b('0x7')],{'host':_0xe22b('0x8'),'port':0x18eb});var io=require(_0xe22b('0x9'))(new Redis(config[_0xe22b('0x7')]));function emit(_0x427ec1,_0x29f99e,_0x2bf021,_0xfa1745,_0x772ed9){logger[_0xe22b('0xa')](_0xe22b('0xb'),_0x427ec1,_0x29f99e['id'],_0x2bf021,_0xfa1745,JSON['stringify'](_0x772ed9));io['to'](_0x2bf021)[_0xe22b('0xc')](_0xfa1745,_0x772ed9);}exports['exec']=function(_0x277159,_0x26925f,_0x16fc68,_0x2c54ea){var _0x1a3df9,_0x5785a9;var _0x174571={};var _0x5537be;var _0x255607=Number(_0x16fc68['data1']);var _0x31f89f=_0x16fc68[_0xe22b('0xd')]?Boolean(Number(_0x16fc68[_0xe22b('0xd')])):![];var _0x37779c;var _0x276203=![];if(!_['isNil'](_0x16fc68[_0xe22b('0xe')])){if(_0x16fc68[_0xe22b('0xe')]=='1')_0x276203=!![];}if(!_0x276203){if(_0x2c54ea['xmd-contactid']){_0x174571['id']=_0x2c54ea[_0xe22b('0xf')];}}if(!_0x174571['id']){_0x174571[_0xe22b('0x10')]=_0x255607;_0x37779c=_0x16fc68[_0xe22b('0x11')]&&_0x16fc68['data3']!=='0'?_0x16fc68[_0xe22b('0x11')][_0xe22b('0x12')](','):[_0xe22b('0x13')];_0x174571[_0xe22b('0x14')]=_[_0xe22b('0x15')](_0x37779c,function(_0x4f43f0){var _0x355088={};_0x355088[_0x4f43f0]=_0x2c54ea['routeId']?_0x2c54ea[_0xe22b('0x16')]:_0x2c54ea[_0xe22b('0x17')];return _0x355088;});_0x5537be=_0x2c54ea[_0xe22b('0x18')]?_0x2c54ea['destcalleridnum']:_0x2c54ea[_0xe22b('0x17')];}var _0x4510a9=['id',_0xe22b('0x19'),_0xe22b('0x1a'),_0xe22b('0x13'),_0xe22b('0x1b'),_0xe22b('0x1c'),_0xe22b('0x10'),_0xe22b('0x1d'),_0xe22b('0x1e'),'updatedAt'];var _0xc6c9b7=_[_0xe22b('0x1f')](_0x4510a9,_0x37779c);BPromise['resolve']()[_0xe22b('0x20')](cmContactRpc[_0xe22b('0x21')]({'attributes':_0xc6c9b7,'where':_0x174571,'phone':_0x5537be}))[_0xe22b('0x20')](function(_0x169e8c){_0x5785a9=_0x169e8c;if(!_[_0xe22b('0x22')](_0x5785a9)){if(_0x5785a9[_0xe22b('0x23')]===0x1){_0x1a3df9=_0x5785a9[0x0];logger['info'](_0xe22b('0x24'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_0x1a3df9['id']);}else{logger[_0xe22b('0xa')](_0xe22b('0x26'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_[_0xe22b('0x15')](_0x5785a9,'id')[_0xe22b('0x27')](','));}return;}else{logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);var _0x4293a1={'ListId':_0x255607};var _0x5f2a2e=_0x16fc68[_0xe22b('0x28')]&&_0x16fc68[_0xe22b('0x28')]!=='0'?_0x16fc68[_0xe22b('0x28')]:'phone';if(_0x31f89f){logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);_0x4293a1[_0x5f2a2e]=_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])?_0x2c54ea['calleridnum']:_0x2c54ea[_0xe22b('0x16')];if(_['isNil'](_0x2c54ea['routeId'])){_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2a')]&&_0x2c54ea[_0xe22b('0x2a')]!==''?_0x2c54ea[_0xe22b('0x2a')]:_0xe22b('0x2b');}else{_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2c')]&&_0x2c54ea['destcalleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2c')]:_0xe22b('0x2b');}return BPromise[_0xe22b('0x2e')]()['then'](cmContactRpc[_0xe22b('0x2f')](_0x4293a1))['then'](function(_0x168b1b){_0x1a3df9=_0x168b1b;_0x5785a9[_0xe22b('0x30')](_0x168b1b);if(_0x1a3df9){logger['info'](_0xe22b('0x31'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_0x1a3df9['id']);}return;});}else{logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);_0x4293a1[_0x5f2a2e]=_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])?_0x2c54ea[_0xe22b('0x17')]:_0x2c54ea[_0xe22b('0x16')];if(_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])){_0x4293a1[_0xe22b('0x19')]=_0x2c54ea['calleridname']&&_0x2c54ea['calleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2a')]:'Unknown';}else{_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2c')]&&_0x2c54ea['destcalleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2c')]:'Unknown';}_0x1a3df9=_0x4293a1;_0x5785a9[_0xe22b('0x30')](_0x4293a1);return;}}})['then'](function(){if(_0x277159){emit(_0x2c54ea['uniqueid'],_0x26925f,util[_0xe22b('0x32')](_0xe22b('0x33'),_0x277159['name']),util['format'](_0xe22b('0x34'),_0x16fc68[_0xe22b('0x35')][_0xe22b('0x36')]()),{'evt':_[_0xe22b('0x37')](_0x2c54ea,{'autoCreate':_0x31f89f}),'contact':_0x1a3df9===undefined?{}:_0x1a3df9,'contacts':_0x5785a9['length']===0x0?undefined:_0x5785a9});}});}; \ No newline at end of file +var _0x9265=['lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x9265,0x1ee));var _0x5926=function(_0x166c81,_0x1070d2){_0x166c81=_0x166c81-0x0;var _0x4333df=_0x9265[_0x166c81];return _0x4333df;};'use strict';var _=require(_0x5926('0x0'));var BPromise=require('bluebird');var Redis=require(_0x5926('0x1'));var util=require(_0x5926('0x2'));var config=require(_0x5926('0x3'));var logger=require(_0x5926('0x4'))(_0x5926('0x5'));var cmContactRpc=require(_0x5926('0x6'));config[_0x5926('0x7')]=_['defaults'](config['redis'],{'host':_0x5926('0x8'),'port':0x18eb});var io=require(_0x5926('0x9'))(new Redis(config['redis']));function emit(_0x328cb1,_0x34ec48,_0x4431c3,_0x3fcf56,_0xa28292){logger[_0x5926('0xa')](_0x5926('0xb'),_0x328cb1,_0x34ec48['id'],_0x4431c3,_0x3fcf56,JSON[_0x5926('0xc')](_0xa28292));io['to'](_0x4431c3)[_0x5926('0xd')](_0x3fcf56,_0xa28292);}exports[_0x5926('0xe')]=function(_0x54f192,_0x386426,_0x58f0d0,_0x312e51){var _0x5b9d3a,_0x309435;var _0x1726c6={};var _0x751b95;var _0x3e89c8=Number(_0x58f0d0['data1']);var _0xafcd5=_0x58f0d0['data2']?Boolean(Number(_0x58f0d0[_0x5926('0xf')])):![];var _0x47a711;var _0x7e7578=![];if(!_['isNil'](_0x58f0d0['data5'])){if(_0x58f0d0[_0x5926('0x10')]=='1')_0x7e7578=!![];}if(!_0x7e7578){if(_0x312e51[_0x5926('0x11')]){_0x1726c6['id']=_0x312e51[_0x5926('0x11')];}}if(!_0x1726c6['id']){_0x1726c6[_0x5926('0x12')]=_0x3e89c8;_0x47a711=_0x58f0d0[_0x5926('0x13')]&&_0x58f0d0[_0x5926('0x13')]!=='0'?_0x58f0d0[_0x5926('0x13')][_0x5926('0x14')](','):[_0x5926('0x15')];_0x1726c6[_0x5926('0x16')]=_[_0x5926('0x17')](_0x47a711,function(_0x18430e){var _0xeab5ec={};_0xeab5ec[_0x18430e]=_0x312e51[_0x5926('0x18')]?_0x312e51['destcalleridnum']:_0x312e51[_0x5926('0x19')];return _0xeab5ec;});_0x751b95=_0x312e51['routeId']?_0x312e51[_0x5926('0x1a')]:_0x312e51[_0x5926('0x19')];}var _0x465f13=['id',_0x5926('0x1b'),_0x5926('0x1c'),_0x5926('0x15'),_0x5926('0x1d'),_0x5926('0x1e'),_0x5926('0x12'),_0x5926('0x1f'),_0x5926('0x20'),_0x5926('0x21')];var _0x312b69=_['union'](_0x465f13,_0x47a711);BPromise[_0x5926('0x22')]()[_0x5926('0x23')](cmContactRpc[_0x5926('0x24')]({'attributes':_0x312b69,'where':_0x1726c6,'phone':_0x751b95}))[_0x5926('0x23')](function(_0x4a931c){_0x309435=_0x4a931c;if(!_['isEmpty'](_0x309435)){if(_0x309435[_0x5926('0x25')]===0x1){_0x5b9d3a=_0x309435[0x0];logger['info'](_0x5926('0x26'),_0x312e51['uniqueid'],_0x386426['id'],_0x5b9d3a['id']);}else{logger[_0x5926('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x312e51[_0x5926('0x27')],_0x386426['id'],_[_0x5926('0x17')](_0x309435,'id')[_0x5926('0x28')](','));}return;}else{logger[_0x5926('0xa')](_0x5926('0x29'),_0x312e51[_0x5926('0x27')],_0x386426['id']);var _0x3f1bc2={'ListId':_0x3e89c8};var _0x55666a=_0x58f0d0[_0x5926('0x2a')]&&_0x58f0d0[_0x5926('0x2a')]!=='0'?_0x58f0d0[_0x5926('0x2a')]:'phone';if(_0xafcd5){logger[_0x5926('0xa')](_0x5926('0x2b'),_0x312e51[_0x5926('0x27')],_0x386426['id']);_0x3f1bc2[_0x55666a]=_[_0x5926('0x2c')](_0x312e51[_0x5926('0x18')])?_0x312e51[_0x5926('0x19')]:_0x312e51[_0x5926('0x1a')];if(_[_0x5926('0x2c')](_0x312e51[_0x5926('0x18')])){_0x3f1bc2[_0x5926('0x1b')]=_0x312e51['calleridname']&&_0x312e51[_0x5926('0x2d')]!==_0x5926('0x2e')?_0x312e51[_0x5926('0x2d')]:'Unknown';}else{_0x3f1bc2[_0x5926('0x1b')]=_0x312e51[_0x5926('0x2f')]&&_0x312e51[_0x5926('0x2f')]!==_0x5926('0x2e')?_0x312e51['destcalleridname']:_0x5926('0x30');}return BPromise['resolve']()[_0x5926('0x23')](cmContactRpc[_0x5926('0x31')](_0x3f1bc2))['then'](function(_0x3ff738){_0x5b9d3a=_0x3ff738;_0x309435[_0x5926('0x32')](_0x3ff738);if(_0x5b9d3a){logger[_0x5926('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x312e51[_0x5926('0x27')],_0x386426['id'],_0x5b9d3a['id']);}return;});}else{logger[_0x5926('0xa')](_0x5926('0x33'),_0x312e51[_0x5926('0x27')],_0x386426['id']);_0x3f1bc2[_0x55666a]=_[_0x5926('0x2c')](_0x312e51[_0x5926('0x18')])?_0x312e51[_0x5926('0x19')]:_0x312e51[_0x5926('0x1a')];if(_[_0x5926('0x2c')](_0x312e51['routeId'])){_0x3f1bc2[_0x5926('0x1b')]=_0x312e51[_0x5926('0x2d')]&&_0x312e51['calleridname']!==''?_0x312e51[_0x5926('0x2d')]:_0x5926('0x30');}else{_0x3f1bc2[_0x5926('0x1b')]=_0x312e51[_0x5926('0x2f')]&&_0x312e51[_0x5926('0x2f')]!==''?_0x312e51[_0x5926('0x2f')]:_0x5926('0x30');}_0x5b9d3a=_0x3f1bc2;_0x309435[_0x5926('0x32')](_0x3f1bc2);return;}}})[_0x5926('0x23')](function(){if(_0x54f192){emit(_0x312e51[_0x5926('0x27')],_0x386426,util[_0x5926('0x34')](_0x5926('0x35'),_0x54f192[_0x5926('0x36')]),util[_0x5926('0x34')]('trigger:%s',_0x58f0d0[_0x5926('0x37')][_0x5926('0x38')]()),{'evt':_[_0x5926('0x39')](_0x312e51,{'autoCreate':_0xafcd5}),'contact':_0x5b9d3a===undefined?{}:_0x5b9d3a,'contacts':_0x309435[_0x5926('0x25')]===0x0?undefined:_0x309435});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8e98050..5fb68d1 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 _0xc5ce=['created','equals','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','emit','info','prototype','motionChannel','debug','inspect','interface','checkTriggers','hasOwnProperty','status','merge','variables','Actions','action','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data4','location','uriLocation','data5','windowHeight','600','winApplication','winArguments','data3','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','exec','queue','urlforward','parse','search','channel','AllConditions','every','checkConditions','AnyConditions','length','some','checkTrigger:\x20trigger','field','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','undefined','offlineMessage'];(function(_0x46f4f5,_0x5dc62f){var _0x39458d=function(_0x30fd49){while(--_0x30fd49){_0x46f4f5['push'](_0x46f4f5['shift']());}};_0x39458d(++_0x5dc62f);}(_0xc5ce,0x7d));var _0xec5c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc5ce[_0x68c979];return _0x4f0001;};'use strict';var util=require('util');var _=require(_0xec5c('0x0'));var url=require('url');var Mustache=require(_0xec5c('0x1'));var Redis=require(_0xec5c('0x2'));var urlforward=require(_0xec5c('0x3'));var integration=require(_0xec5c('0x4'));var cmContact=require(_0xec5c('0x5'));var script=require('./script');var config=require(_0xec5c('0x6'));var logger=require(_0xec5c('0x7'))(_0xec5c('0x8'));var ami=require(_0xec5c('0x9'));config[_0xec5c('0xa')]=_[_0xec5c('0xb')](config[_0xec5c('0xa')],{'host':_0xec5c('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xec5c('0xa')]));var operators={'equals':function(_0x407713,_0x281fa8){return _0x407713==_0x281fa8;},'not_equals':function(_0x236966,_0x214d60){return _0x236966!=_0x214d60;}};var barAndWebActions=[_0xec5c('0xd'),'url',_0xec5c('0xe')];function Trigger(_0x5d0bb3){this[_0xec5c('0xf')]=_0x5d0bb3['triggers'];this[_0xec5c('0x10')]=_0x5d0bb3[_0xec5c('0x10')];this['voiceQueues']=_0x5d0bb3['voiceQueues'];this[_0xec5c('0x11')]=_0x5d0bb3[_0xec5c('0x11')];this['voiceExtensions']=_0x5d0bb3[_0xec5c('0x12')];this['zendeskAccounts']=_0x5d0bb3[_0xec5c('0x13')];this[_0xec5c('0x14')]=_0x5d0bb3[_0xec5c('0x14')];this[_0xec5c('0x15')]=_0x5d0bb3[_0xec5c('0x15')];this[_0xec5c('0x16')]=_0x5d0bb3['sugarcrmAccounts'];this[_0xec5c('0x17')]=_0x5d0bb3['zohoAccounts'];this[_0xec5c('0x18')]=_0x5d0bb3['deskAccounts'];this[_0xec5c('0x19')]=_0x5d0bb3[_0xec5c('0x19')];this[_0xec5c('0x1a')]=_0x5d0bb3[_0xec5c('0x1a')];this[_0xec5c('0x1b')]=_0x5d0bb3[_0xec5c('0x1b')];this[_0xec5c('0x1c')]=_0x5d0bb3[_0xec5c('0x1c')];this[_0xec5c('0x1d')]={'zendesk':this[_0xec5c('0x13')],'salesforce':this[_0xec5c('0x15')],'freshdesk':this[_0xec5c('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xec5c('0x17')],'desk':this[_0xec5c('0x18')],'vtiger':this[_0xec5c('0x19')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xec5c('0x1c')],'servicenow':this[_0xec5c('0x1a')]};ami['on'](_0xec5c('0x1e'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on']('custom:agentconnect',this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x21'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x22'),this[_0xec5c('0x1f')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x23'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x24'),this['syncCustomEvent'][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x25'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x26'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x27'),this[_0xec5c('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x28'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x29'),this['syncAgentDial'][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x2a'),this[_0xec5c('0x2b')][_0xec5c('0x20')](this));ami['on']('custom:dialend',this[_0xec5c('0x2b')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x2c'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x2d'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x2e'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x2f'),this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on'](_0xec5c('0x30'),this[_0xec5c('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xec5c('0x1f')][_0xec5c('0x20')](this));ami['on']('custom:offlineMessage',this[_0xec5c('0x1f')][_0xec5c('0x20')](this));}Trigger['prototype'][_0xec5c('0x31')]=function(_0x17ad7c,_0xc9326d,_0x2bf68b){logger[_0xec5c('0x32')](_0x17ad7c,_0xc9326d,JSON['stringify'](_0x2bf68b));io['to'](_0x17ad7c)[_0xec5c('0x31')](_0xc9326d,_0x2bf68b);};Trigger[_0xec5c('0x33')][_0xec5c('0x1f')]=function(_0x3f50c9){var _0x26fcb9=_['clone'](_0x3f50c9);if(typeof _0x26fcb9[_0xec5c('0x34')]==='undefined'){_0x26fcb9[_0xec5c('0x34')]='voice';}logger[_0xec5c('0x35')](_0xec5c('0x1f'),util[_0xec5c('0x36')](_0x26fcb9,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x26fcb9);};Trigger[_0xec5c('0x33')][_0xec5c('0x2b')]=function(_0x2d94e1){if(this[_0xec5c('0x10')][_0x2d94e1[_0xec5c('0x37')]]){this['syncCustomEvent'](_0x2d94e1);}};Trigger[_0xec5c('0x33')][_0xec5c('0x38')]=function(_0x954779){var _0x13f655;for(var _0x4bd8f3 in this['triggers']){if(this['triggers'][_0xec5c('0x39')](_0x4bd8f3)){if(this['triggers'][_0x4bd8f3][_0xec5c('0x3a')]){_0x13f655=this['checkTrigger'](this[_0xec5c('0xf')][_0x4bd8f3],_0x954779);if(_0x13f655){_[_0xec5c('0x3b')](_0x954779,_0x954779[_0xec5c('0x3c')]);for(var _0x570e7c=0x0,_0x68aa16,_0x17d225,_0x2e766e;_0x570e7c0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0xb0e72e,_0x22bbe6){var _0x139abd=function(_0x56afd6){while(--_0x56afd6){_0xb0e72e['push'](_0xb0e72e['shift']());}};_0x139abd(++_0x22bbe6);}(_0x3e74,0x175));var _0x43e7=function(_0x42750a,_0x458fb0){_0x42750a=_0x42750a-0x0;var _0x1947a1=_0x3e74[_0x42750a];return _0x1947a1;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e449da0..d52a836 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 _0x6d3e=['isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','/systemusers(','Bearer\x20','body','odata-entityid','substring','lastIndexOf','enduserId','catch','destcalleridnum','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','idField','indexOf','content','ticketType','incident','assign','getString','/contacts(','phonecall','callDirection','queue','phonecalls','Subjects','headers','ticketId','format','user:%s','emit','stripTrailingSlash','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','data7','data2','resolve','CloudProvider','data5','POST','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','length','internalemailaddress'];(function(_0x596e28,_0x48bb02){var _0x503a36=function(_0x1731b3){while(--_0x1731b3){_0x596e28['push'](_0x596e28['shift']());}};_0x503a36(++_0x48bb02);}(_0x6d3e,0xac));var _0xe6d3=function(_0x4b11d8,_0x14aba9){_0x4b11d8=_0x4b11d8-0x0;var _0x3c09d5=_0x6d3e[_0x4b11d8];return _0x3c09d5;};'use strict';var _=require(_0xe6d3('0x0'));var rp=require(_0xe6d3('0x1'));var util=require(_0xe6d3('0x2'));var intUtil=require(_0xe6d3('0x3'));var md5=require('md5');var Redis=require(_0xe6d3('0x4'));var logger=require(_0xe6d3('0x5'))(_0xe6d3('0x6'));var config=require(_0xe6d3('0x7'));config[_0xe6d3('0x8')]=_['defaults'](config[_0xe6d3('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe6d3('0x9'))(new Redis(config[_0xe6d3('0x8')]));function getAuthToken(_0x1f71b5,_0x851f54,_0x2bab17){if(_0x1f71b5[_0xe6d3('0xa')]){_0x1f71b5['remoteUri']=_0x1f71b5['CloudProvider'][_0xe6d3('0xb')];_0x1f71b5['tenantId']=_0x1f71b5['CloudProvider'][_0xe6d3('0xc')];return Promise[_0xe6d3('0xd')](_0x1f71b5[_0xe6d3('0xe')][_0xe6d3('0xf')]);}var _0x5173fa={'method':_0xe6d3('0x10'),'uri':_0x851f54,'form':{'client_id':_0x1f71b5[_0xe6d3('0x11')],'resource':_0x1f71b5['remoteUri'],'username':_0x1f71b5[_0xe6d3('0x12')],'password':_0x1f71b5[_0xe6d3('0x13')],'grant_type':_0xe6d3('0x13'),'client_secret':_0x1f71b5['clientSecret']},'json':!![]};return rp(_0x5173fa)[_0xe6d3('0x14')](function(_0x5d5976){return _0x5d5976[_0xe6d3('0x15')];})['catch'](function(_0x47e35c){logger[_0xe6d3('0x16')]('['+[_0x2bab17[_0xe6d3('0x17')]()]+_0xe6d3('0x18'));return _0x47e35c[_0xe6d3('0x19')];});}function getUser(_0x4091aa,_0x3a7147,_0x3c462f,_0x53109e,_0x52243b,_0x3c725e){return new Promise(function(_0x7ca83c,_0x2b6df1){return getAuthToken(_0x3a7147,_0x53109e,_0x3c725e)['then'](function(_0x1d0ee2){var _0x5c5312={'method':'GET','uri':_0x52243b+_0xe6d3('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x1d0ee2,'OData-Version':_0xe6d3('0x1b')},'json':!![]};return rp(_0x5c5312);})[_0xe6d3('0x14')](function(_0x358223){var _0x2f5d70=_0x358223[_0xe6d3('0x1c')];var _0x10bc39=![];var _0x55382f=null;if(!_[_0xe6d3('0x1d')](_0x3c462f)){if(intUtil['validateEmail'](_0x3c462f[_0xe6d3('0x1e')])){_0x4091aa[_0xe6d3('0x1f')]=_0x3c462f[_0xe6d3('0x1e')];for(_0x55382f=0x0;_0x55382f<_0x2f5d70[_0xe6d3('0x20')];_0x55382f++){if(_0x2f5d70[_0x55382f][_0xe6d3('0x21')]===_0x3c462f[_0xe6d3('0x1e')]&&!_0x2f5d70[_0x55382f][_0xe6d3('0x22')]){_0x10bc39=!![];logger[_0xe6d3('0x23')]('['+[_0x3c725e['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2f5d70[_0x55382f][_0xe6d3('0x24')]+'!');_0x4091aa[_0xe6d3('0x25')]=_0x2f5d70[_0x55382f]['systemuserid'];}}}}if(!_0x10bc39){logger[_0xe6d3('0x23')]('['+[_0x3c725e[_0xe6d3('0x17')]()]+_0xe6d3('0x26'));_0x4091aa[_0xe6d3('0x1f')]=_0x3a7147['username'];for(_0x55382f=0x0;_0x55382f<_0x2f5d70[_0xe6d3('0x20')];_0x55382f++){if(_0x2f5d70[_0x55382f]['internalemailaddress']===_0x3a7147[_0xe6d3('0x12')]){_0x4091aa[_0xe6d3('0x25')]=_0x2f5d70[_0x55382f][_0xe6d3('0x24')];}}}_0x7ca83c(_0x4091aa);})['catch'](function(_0x3ab286){_0x2b6df1(_0x3ab286['message']);});});}function createEndUser(_0x98ef77,_0x3b7090,_0x4b085b,_0x26b09f,_0x36bcb8,_0x5d04d7,_0x5044b9){return new Promise(function(_0x5e5631,_0x5639dc){return getAuthToken(_0x3b7090,_0x4b085b,_0x5d04d7)[_0xe6d3('0x14')](function(_0x36eddf){var _0xb83068=_0x5d04d7[_0xe6d3('0x27')]()===_0xe6d3('0x28')?_0x36bcb8['destcalleridnum']:_0x36bcb8[_0xe6d3('0x29')];var _0x50c723={'method':'POST','uri':_0x26b09f+'contacts','body':{'fullname':_0xb83068,'firstname':_0xb83068,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe6d3('0x2a')+_0x98ef77[_0xe6d3('0x25')]+')'},'headers':{'Authorization':_0xe6d3('0x2b')+_0x36eddf,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x50c723[_0xe6d3('0x2c')][_0x5044b9]=_0xb83068;return rp(_0x50c723);})[_0xe6d3('0x14')](function(_0x2e5b63){var _0x17b1d7=_0x2e5b63['headers'][_0xe6d3('0x2d')];var _0x47ef82=_0x17b1d7[_0xe6d3('0x2e')](_0x17b1d7[_0xe6d3('0x2f')]('(')+0x1,_0x17b1d7[_0xe6d3('0x2f')](')'));_0x98ef77[_0xe6d3('0x30')]=_0x47ef82;_0x5e5631(_0x98ef77);})[_0xe6d3('0x31')](function(_0x11ccf2){_0x5639dc(_0x11ccf2[_0xe6d3('0x19')]);});});}function getEndUser(_0x499874,_0x244da0,_0x2213d9,_0x2a7a0c,_0x4c6eb6,_0x46958f,_0x31775e,_0x7097c5){var _0x113c39=_0x46958f['toLowerCase']()==='outbound'?_0x4c6eb6[_0xe6d3('0x32')]:_0x4c6eb6[_0xe6d3('0x29')];return getAuthToken(_0x244da0,_0x2213d9,_0x46958f)['then'](function(_0x29d926){_0x7097c5=_0x7097c5?_0x7097c5:'telephone1';var _0x1b46ef={'method':_0xe6d3('0x33'),'uri':_0x2a7a0c+_0xe6d3('0x34')+_0x7097c5+'&$filter='+_0x7097c5+_0xe6d3('0x35')+_0x113c39[_0xe6d3('0x36')]('+',_0xe6d3('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x29d926,'If-None-Match':null,'OData-Version':_0xe6d3('0x1b')},'json':!![]};return rp(_0x1b46ef);})[_0xe6d3('0x14')](function(_0x452581){var _0xd12d7b=![];if(!_0x452581)return _0xd12d7b;var _0x4fde2a=_0x452581['value'];for(var _0x456155=0x0;_0x456155<_0x4fde2a[_0xe6d3('0x20')];_0x456155++){if(_0x4fde2a[_0x456155][_0x7097c5]===_0x113c39){_0xd12d7b=!![];_0x499874['enduserId']=_0x4fde2a[_0x456155][_0xe6d3('0x38')];}}return _0xd12d7b;})['then'](function(_0xc16898){if(_0xc16898)return _0x499874;if(_0x31775e===_0xe6d3('0x39')){logger['info']('['+[_0x46958f['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x499874;}return createEndUser(_0x499874,_0x244da0,_0x2213d9,_0x2a7a0c,_0x4c6eb6,_0x46958f,_0x7097c5)[_0xe6d3('0x14')](function(_0x16f871){logger[_0xe6d3('0x23')]('['+[_0x46958f[_0xe6d3('0x17')]()]+_0xe6d3('0x3a'),_0x16f871[_0xe6d3('0x30')]);return _0x16f871;});});}function getCustomFields(_0x31543b,_0x307ca4,_0x6b7898){var _0x3ad573={};if(_0x31543b[_0xe6d3('0x20')]>0x0){_[_0xe6d3('0x3b')](_0x31543b,function(_0x3bf9f1){if(_[_0xe6d3('0x3c')](['string',_0xe6d3('0x3d')],_0x3bf9f1[_0xe6d3('0x3e')])&&_0x3bf9f1['nameField']&&!_0x3bf9f1['customField']){var _0x1e1342=_0x3bf9f1[_0xe6d3('0x3f')][_0xe6d3('0x27')]();var _0x51f344=_0x1e1342[_0xe6d3('0x2e')](0x0,_0x1e1342[_0xe6d3('0x40')]('_'));var _0x428518=_0x1e1342[_0xe6d3('0x2e')](_0x1e1342[_0xe6d3('0x40')]('_')+0x1);if(_0x51f344===_0x6b7898){_0x3ad573[_0x428518]=_0x3bf9f1[_0xe6d3('0x41')];}}});}return _0x3ad573;}function getTicket(_0x1d1859,_0x7e2aca,_0x259d7f,_0x5afae8,_0xfcb0d4,_0x143d9f,_0x5f4dca){return new Promise(function(_0x2a1a68,_0x3da6bb){var _0x43bab0;return getAuthToken(_0x7e2aca,_0x259d7f,_0x5f4dca)[_0xe6d3('0x14')](function(_0x59d2a3){if(_0x143d9f[_0xe6d3('0x42')]===_0xe6d3('0x43')){_0x43bab0={'method':'POST','uri':_0x5afae8+'incidents','body':Object[_0xe6d3('0x44')]({},{'title':intUtil['getString'](_0x143d9f['Subjects'],_0xfcb0d4,'\x20'),'description':intUtil[_0xe6d3('0x45')](_0x143d9f['Descriptions'],_0xfcb0d4,'\x0a'),'customerid_contact@odata.bind':_0x1d1859[_0xe6d3('0x30')]?_0xe6d3('0x46')+_0x1d1859[_0xe6d3('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1d1859[_0xe6d3('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x143d9f['Fields'],_0xfcb0d4,_0x143d9f[_0xe6d3('0x42')])),'headers':{'Authorization':_0xe6d3('0x2b')+_0x59d2a3,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x143d9f['ticketType']===_0xe6d3('0x47')){var _0x54e266=_0x1d1859[_0xe6d3('0x30')]?[{'partyid_systemuser@odata.bind':_0xe6d3('0x2a')+_0x1d1859[_0xe6d3('0x25')]+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xe6d3('0x46')+_0x1d1859['enduserId']+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1d1859[_0xe6d3('0x25')]+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x2:0x1}];_0x43bab0={'method':_0xe6d3('0x10'),'uri':_0x5afae8+_0xe6d3('0x4a'),'body':Object['assign']({},{'subject':intUtil[_0xe6d3('0x45')](_0x143d9f[_0xe6d3('0x4b')],_0xfcb0d4,'\x20'),'phonenumber':String(_0xfcb0d4[_0xe6d3('0x29')]),'description':intUtil[_0xe6d3('0x45')](_0x143d9f['Descriptions'],_0xfcb0d4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d1859['enduserId']?_0xe6d3('0x46')+_0x1d1859[_0xe6d3('0x30')]+')':undefined,'ownerid@odata.bind':_0xe6d3('0x2a')+_0x1d1859[_0xe6d3('0x25')]+')','directioncode':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?![]:!![],'phonecall_activity_parties':_0x54e266},getCustomFields(_0x143d9f['Fields'],_0xfcb0d4,_0x143d9f[_0xe6d3('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x59d2a3,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43bab0);})[_0xe6d3('0x14')](function(_0x2ad2e7){var _0x3c0d1c=_0x2ad2e7[_0xe6d3('0x4c')][_0xe6d3('0x2d')];var _0x3d501b=_0x3c0d1c[_0xe6d3('0x2e')](_0x3c0d1c[_0xe6d3('0x2f')]('(')+0x1,_0x3c0d1c[_0xe6d3('0x2f')](')'));_0x1d1859[_0xe6d3('0x4d')]=_0x3d501b;_0x2a1a68(_0x1d1859);})[_0xe6d3('0x31')](function(_0x5ad3ba){_0x3da6bb(_0x5ad3ba['message']);});});}function emit(_0x35bb6b,_0x3add03,_0x2c5d88,_0x338235){var _0x96d7a4={'uri':util[_0xe6d3('0x4e')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x35bb6b,_0x2c5d88,_0x338235)};io['to'](util[_0xe6d3('0x4e')](_0xe6d3('0x4f'),_0x3add03))[_0xe6d3('0x50')]('trigger:browser:url',_0x96d7a4);}exports['cs']=function(_0x3ec24f,_0x59881f,_0x339078,_0x432d2c,_0x43bcbd,_0x31b0e1,_0x12ebdf,_0x5216e7){var _0x4aea5d={};_0x31b0e1['remoteUri']=_0x31b0e1[_0xe6d3('0xa')]?intUtil[_0xe6d3('0x51')](_0x31b0e1[_0xe6d3('0xe')][_0xe6d3('0xb')]):intUtil[_0xe6d3('0x51')](_0x31b0e1[_0xe6d3('0x52')]);_0x31b0e1['serverUrl']=intUtil['stripTrailingSlash'](_0x31b0e1[_0xe6d3('0x53')]);_0x4aea5d[_0xe6d3('0x48')]=_0x5216e7===_0xe6d3('0x49')||_0x5216e7===_0xe6d3('0x54')?_0xe6d3('0x49'):_0xe6d3('0x28');var _0x2158d9=_0x31b0e1[_0xe6d3('0xa')]?util['format']('%s/api/data/v9.0/',_0x31b0e1[_0xe6d3('0xe')][_0xe6d3('0xb')]):util[_0xe6d3('0x4e')](_0xe6d3('0x55'),_0x31b0e1[_0xe6d3('0x52')]);var _0x5a0ec0=util[_0xe6d3('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x31b0e1[_0xe6d3('0x56')]);var _0x177ff8=util[_0xe6d3('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31b0e1[_0xe6d3('0x53')],_0x59881f[_0xe6d3('0x57')],md5(_0x59881f[_0xe6d3('0x57')]));if(_0x43bcbd&&_0x43bcbd[_0xe6d3('0x58')]){logger[_0xe6d3('0x23')](_0xe6d3('0x59'),_0xe6d3('0x5a'));_0x59881f['recordingURL']=_0x177ff8;}else if(_0x12ebdf&&_0x12ebdf[_0xe6d3('0x5b')]&&_0x12ebdf[_0xe6d3('0x5b')]!==_0xe6d3('0x5c')){logger[_0xe6d3('0x23')](_0xe6d3('0x5d'),'Recording\x20is\x20enabled!');_0x59881f[_0xe6d3('0x5e')]=_0x177ff8;}else{_0x59881f[_0xe6d3('0x5e')]='';}return getUser(_0x4aea5d,_0x31b0e1,_0x432d2c,_0x5a0ec0,_0x2158d9,_0x5216e7)[_0xe6d3('0x14')](function(_0x2c61d8){logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x2c61d8[_0xe6d3('0x25')]);logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x5f'),_0x2c61d8[_0xe6d3('0x1f')]);return getEndUser(_0x2c61d8,_0x31b0e1,_0x5a0ec0,_0x2158d9,_0x59881f,_0x5216e7,_0x339078['moduleCreate'],_0x339078['additionalSearchContact']);})[_0xe6d3('0x14')](function(_0x150a07){logger['info']('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x150a07['enduserId']);logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x60'),_0x59881f[_0xe6d3('0x29')]);return getTicket(_0x150a07,_0x31b0e1,_0x5a0ec0,_0x2158d9,_0x59881f,_0x339078,_0x5216e7);})[_0xe6d3('0x14')](function(_0x3709de){logger['info'](util[_0xe6d3('0x4e')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x61'),_0x339078[_0xe6d3('0x42')],_0x3709de['ticketId']));logger['info'](util['format']('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x62'),_0x5216e7));if(_0x5216e7!==_0xe6d3('0x54')&&_0x339078[_0xe6d3('0x63')]){logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+']',_0xe6d3('0x64'));emit(_0x31b0e1[_0xe6d3('0x52')],_0x432d2c[_0xe6d3('0x65')],_0x339078['ticketType'],_0x3709de['ticketId']);}})['catch'](function(_0x158337){logger['error']('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x158337[_0xe6d3('0x19')]);console[_0xe6d3('0x16')](_0xe6d3('0x66'),_0x158337);});}; \ No newline at end of file +var _0x05b4=['substring','lastIndexOf','enduserId','toLowerCase','telephone1','GET','&$filter=','\x20eq\x20\x27','replace','%2b','includes','string','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Fields','phonecall','callDirection','/contacts(','queue','phonecalls','Subjects','Descriptions','headers','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','tenantId','resolve','data5','POST','clientId','remoteUri','username','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x05b4,0x1e4));var _0x405b=function(_0xbaa98c,_0x269aee){_0xbaa98c=_0xbaa98c-0x0;var _0x7986c6=_0x05b4[_0xbaa98c];return _0x7986c6;};'use strict';var _=require(_0x405b('0x0'));var rp=require('request-promise');var util=require(_0x405b('0x1'));var intUtil=require('./util');var md5=require(_0x405b('0x2'));var Redis=require(_0x405b('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x405b('0x4'));config[_0x405b('0x5')]=_['defaults'](config['redis'],{'host':_0x405b('0x6'),'port':0x18eb});var io=require(_0x405b('0x7'))(new Redis(config['redis']));function getAuthToken(_0x3aa074,_0x4bc371,_0x2b48a0){if(_0x3aa074[_0x405b('0x8')]){_0x3aa074['remoteUri']=_0x3aa074[_0x405b('0x9')]['data7'];_0x3aa074[_0x405b('0xa')]=_0x3aa074[_0x405b('0x9')]['data2'];return Promise[_0x405b('0xb')](_0x3aa074['CloudProvider'][_0x405b('0xc')]);}var _0x3e095a={'method':_0x405b('0xd'),'uri':_0x4bc371,'form':{'client_id':_0x3aa074[_0x405b('0xe')],'resource':_0x3aa074[_0x405b('0xf')],'username':_0x3aa074[_0x405b('0x10')],'password':_0x3aa074[_0x405b('0x11')],'grant_type':_0x405b('0x11'),'client_secret':_0x3aa074['clientSecret']},'json':!![]};return rp(_0x3e095a)[_0x405b('0x12')](function(_0x36cdf0){return _0x36cdf0['access_token'];})[_0x405b('0x13')](function(_0x429fcc){logger[_0x405b('0x14')]('['+[_0x2b48a0[_0x405b('0x15')]()]+_0x405b('0x16'));return _0x429fcc[_0x405b('0x17')];});}function getUser(_0x293680,_0x5de052,_0x1eb9e0,_0x290001,_0x5c0907,_0x56363f){return new Promise(function(_0x10bc3b,_0x3b7fc4){return getAuthToken(_0x5de052,_0x290001,_0x56363f)[_0x405b('0x12')](function(_0x3a4b7a){var _0x32e19d={'method':'GET','uri':_0x5c0907+_0x405b('0x18'),'headers':{'Authorization':_0x405b('0x19')+_0x3a4b7a,'OData-Version':_0x405b('0x1a')},'json':!![]};return rp(_0x32e19d);})[_0x405b('0x12')](function(_0x6599db){var _0x4ebea4=_0x6599db[_0x405b('0x1b')];var _0x2d90cb=![];var _0x657c2b=null;if(!_[_0x405b('0x1c')](_0x1eb9e0)){if(intUtil[_0x405b('0x1d')](_0x1eb9e0[_0x405b('0x1e')])){_0x293680[_0x405b('0x1f')]=_0x1eb9e0[_0x405b('0x1e')];for(_0x657c2b=0x0;_0x657c2b<_0x4ebea4['length'];_0x657c2b++){if(_0x4ebea4[_0x657c2b][_0x405b('0x20')]===_0x1eb9e0[_0x405b('0x1e')]&&!_0x4ebea4[_0x657c2b][_0x405b('0x21')]){_0x2d90cb=!![];logger[_0x405b('0x22')]('['+[_0x56363f['toUpperCase']()]+_0x405b('0x23')+_0x4ebea4[_0x657c2b][_0x405b('0x24')]+'!');_0x293680[_0x405b('0x25')]=_0x4ebea4[_0x657c2b][_0x405b('0x24')];}}}}if(!_0x2d90cb){logger[_0x405b('0x22')]('['+[_0x56363f[_0x405b('0x15')]()]+_0x405b('0x26'));_0x293680['userEmail']=_0x5de052[_0x405b('0x10')];for(_0x657c2b=0x0;_0x657c2b<_0x4ebea4[_0x405b('0x27')];_0x657c2b++){if(_0x4ebea4[_0x657c2b]['internalemailaddress']===_0x5de052[_0x405b('0x10')]){_0x293680[_0x405b('0x25')]=_0x4ebea4[_0x657c2b][_0x405b('0x24')];}}}_0x10bc3b(_0x293680);})['catch'](function(_0x24dc9c){_0x3b7fc4(_0x24dc9c['message']);});});}function createEndUser(_0x178351,_0x57a40b,_0x1adce9,_0x192642,_0x426aca,_0xaf2006,_0x550162){return new Promise(function(_0x5b59f5,_0x58aba0){return getAuthToken(_0x57a40b,_0x1adce9,_0xaf2006)['then'](function(_0x132512){var _0x32966f=_0xaf2006['toLowerCase']()===_0x405b('0x28')?_0x426aca[_0x405b('0x29')]:_0x426aca[_0x405b('0x2a')];var _0x21eb0e={'method':_0x405b('0xd'),'uri':_0x192642+_0x405b('0x2b'),'body':{'fullname':_0x32966f,'firstname':_0x32966f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x405b('0x2c')+_0x178351[_0x405b('0x25')]+')'},'headers':{'Authorization':_0x405b('0x19')+_0x132512,'OData-Version':_0x405b('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x21eb0e[_0x405b('0x2d')][_0x550162]=_0x32966f;return rp(_0x21eb0e);})[_0x405b('0x12')](function(_0x444697){var _0xb570bd=_0x444697['headers']['odata-entityid'];var _0x210cf0=_0xb570bd[_0x405b('0x2e')](_0xb570bd[_0x405b('0x2f')]('(')+0x1,_0xb570bd[_0x405b('0x2f')](')'));_0x178351[_0x405b('0x30')]=_0x210cf0;_0x5b59f5(_0x178351);})['catch'](function(_0x342c3e){_0x58aba0(_0x342c3e['message']);});});}function getEndUser(_0x280965,_0x537bde,_0xb1d89c,_0x50224a,_0x4d7b0b,_0x2082ef,_0xb21338,_0x13a182){var _0x4182d8=_0x2082ef[_0x405b('0x31')]()===_0x405b('0x28')?_0x4d7b0b[_0x405b('0x29')]:_0x4d7b0b[_0x405b('0x2a')];return getAuthToken(_0x537bde,_0xb1d89c,_0x2082ef)[_0x405b('0x12')](function(_0x5ce1a5){_0x13a182=_0x13a182?_0x13a182:_0x405b('0x32');var _0x215a00={'method':_0x405b('0x33'),'uri':_0x50224a+'contacts?$select='+_0x13a182+_0x405b('0x34')+_0x13a182+_0x405b('0x35')+_0x4182d8[_0x405b('0x36')]('+',_0x405b('0x37'))+'\x27','headers':{'Authorization':_0x405b('0x19')+_0x5ce1a5,'If-None-Match':null,'OData-Version':_0x405b('0x1a')},'json':!![]};return rp(_0x215a00);})[_0x405b('0x12')](function(_0x3e1d4d){var _0x45d031=![];if(!_0x3e1d4d)return _0x45d031;var _0x528203=_0x3e1d4d[_0x405b('0x1b')];for(var _0x6e9135=0x0;_0x6e9135<_0x528203['length'];_0x6e9135++){if(_0x528203[_0x6e9135][_0x13a182]===_0x4182d8){_0x45d031=!![];_0x280965[_0x405b('0x30')]=_0x528203[_0x6e9135]['contactid'];}}return _0x45d031;})['then'](function(_0x5b1947){if(_0x5b1947)return _0x280965;if(_0xb21338==='nothing'){logger[_0x405b('0x22')]('['+[_0x2082ef['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x280965;}return createEndUser(_0x280965,_0x537bde,_0xb1d89c,_0x50224a,_0x4d7b0b,_0x2082ef,_0x13a182)['then'](function(_0x47b8ba){logger[_0x405b('0x22')]('['+[_0x2082ef['toUpperCase']()]+']\x20Enduser\x20created!',_0x47b8ba[_0x405b('0x30')]);return _0x47b8ba;});});}function getCustomFields(_0x59f2b7,_0x2079e0,_0x26173b){var _0x5eb355={};if(_0x59f2b7['length']>0x0){_['forEach'](_0x59f2b7,function(_0x4f462f){if(_[_0x405b('0x38')]([_0x405b('0x39'),'picklist'],_0x4f462f['type'])&&_0x4f462f[_0x405b('0x3a')]&&!_0x4f462f[_0x405b('0x3b')]){var _0x2c3eae=_0x4f462f[_0x405b('0x3c')][_0x405b('0x31')]();var _0x5b5a2c=_0x2c3eae[_0x405b('0x2e')](0x0,_0x2c3eae['indexOf']('_'));var _0x11cfe2=_0x2c3eae[_0x405b('0x2e')](_0x2c3eae[_0x405b('0x3d')]('_')+0x1);if(_0x5b5a2c===_0x26173b){_0x5eb355[_0x11cfe2]=_0x4f462f[_0x405b('0x3e')];}}});}return _0x5eb355;}function getTicket(_0x66a9a0,_0x5ce411,_0x232de9,_0x2162e2,_0xcbaa96,_0x317695,_0x190446){return new Promise(function(_0x4bcf3a,_0x4a8285){var _0x8bac14;return getAuthToken(_0x5ce411,_0x232de9,_0x190446)[_0x405b('0x12')](function(_0x26d732){if(_0x317695[_0x405b('0x3f')]==='incident'){_0x8bac14={'method':_0x405b('0xd'),'uri':_0x2162e2+_0x405b('0x40'),'body':Object[_0x405b('0x41')]({},{'title':intUtil[_0x405b('0x42')](_0x317695['Subjects'],_0xcbaa96,'\x20'),'description':intUtil[_0x405b('0x42')](_0x317695['Descriptions'],_0xcbaa96,'\x0a'),'customerid_contact@odata.bind':_0x66a9a0[_0x405b('0x30')]?'/contacts('+_0x66a9a0['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x66a9a0[_0x405b('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x317695[_0x405b('0x43')],_0xcbaa96,_0x317695['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x26d732,'OData-Version':_0x405b('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x317695['ticketType']===_0x405b('0x44')){var _0x48c2a2=_0x66a9a0[_0x405b('0x30')]?[{'partyid_systemuser@odata.bind':_0x405b('0x2c')+_0x66a9a0['userId']+')','participationtypemask':_0x66a9a0[_0x405b('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x405b('0x46')+_0x66a9a0[_0x405b('0x30')]+')','participationtypemask':_0x66a9a0[_0x405b('0x45')]===_0x405b('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x405b('0x2c')+_0x66a9a0[_0x405b('0x25')]+')','participationtypemask':_0x66a9a0[_0x405b('0x45')]===_0x405b('0x47')?0x2:0x1}];_0x8bac14={'method':_0x405b('0xd'),'uri':_0x2162e2+_0x405b('0x48'),'body':Object[_0x405b('0x41')]({},{'subject':intUtil['getString'](_0x317695[_0x405b('0x49')],_0xcbaa96,'\x20'),'phonenumber':String(_0xcbaa96['calleridnum']),'description':intUtil[_0x405b('0x42')](_0x317695[_0x405b('0x4a')],_0xcbaa96,'\x0a'),'regardingobjectid_contact@odata.bind':_0x66a9a0[_0x405b('0x30')]?_0x405b('0x46')+_0x66a9a0['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x66a9a0[_0x405b('0x25')]+')','directioncode':_0x66a9a0['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x48c2a2},getCustomFields(_0x317695[_0x405b('0x43')],_0xcbaa96,_0x317695[_0x405b('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x26d732,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x8bac14);})[_0x405b('0x12')](function(_0x13b40b){var _0x508ae6=_0x13b40b[_0x405b('0x4b')][_0x405b('0x4c')];var _0x1c41a9=_0x508ae6['substring'](_0x508ae6['lastIndexOf']('(')+0x1,_0x508ae6['lastIndexOf'](')'));_0x66a9a0[_0x405b('0x4d')]=_0x1c41a9;_0x4bcf3a(_0x66a9a0);})[_0x405b('0x13')](function(_0x3e2181){_0x4a8285(_0x3e2181[_0x405b('0x17')]);});});}function emit(_0x10c7f5,_0x1bb922,_0x150051,_0x2fee57){var _0x20adce={'uri':util['format'](_0x405b('0x4e'),_0x10c7f5,_0x150051,_0x2fee57)};io['to'](util[_0x405b('0x4f')](_0x405b('0x50'),_0x1bb922))['emit'](_0x405b('0x51'),_0x20adce);}exports['cs']=function(_0x3d4d14,_0x113ab1,_0x3adf84,_0xcd9c20,_0x4772dc,_0x397736,_0x221fab,_0x5722a4){var _0x25ba69={};_0x397736[_0x405b('0xf')]=_0x397736[_0x405b('0x8')]?intUtil[_0x405b('0x52')](_0x397736[_0x405b('0x9')][_0x405b('0x53')]):intUtil['stripTrailingSlash'](_0x397736[_0x405b('0xf')]);_0x397736[_0x405b('0x54')]=intUtil[_0x405b('0x52')](_0x397736[_0x405b('0x54')]);_0x25ba69[_0x405b('0x45')]=_0x5722a4==='queue'||_0x5722a4===_0x405b('0x55')?_0x405b('0x47'):_0x405b('0x28');var _0x1bde8b=_0x397736[_0x405b('0x8')]?util['format'](_0x405b('0x56'),_0x397736['CloudProvider']['data7']):util[_0x405b('0x4f')](_0x405b('0x56'),_0x397736[_0x405b('0xf')]);var _0x19b2fd=util[_0x405b('0x4f')](_0x405b('0x57'),_0x397736['tenantId']);var _0x17ae49=util[_0x405b('0x4f')](_0x405b('0x58'),_0x397736[_0x405b('0x54')],_0x113ab1[_0x405b('0x59')],md5(_0x113ab1[_0x405b('0x59')]));if(_0x4772dc&&_0x4772dc[_0x405b('0x5a')]){logger[_0x405b('0x22')](_0x405b('0x5b'),_0x405b('0x5c'));_0x113ab1[_0x405b('0x5d')]=_0x17ae49;}else if(_0x221fab&&_0x221fab[_0x405b('0x5e')]&&_0x221fab[_0x405b('0x5e')]!==_0x405b('0x5f')){logger[_0x405b('0x22')](_0x405b('0x60'),_0x405b('0x5c'));_0x113ab1['recordingURL']=_0x17ae49;}else{_0x113ab1[_0x405b('0x5d')]='';}return getUser(_0x25ba69,_0x397736,_0xcd9c20,_0x19b2fd,_0x1bde8b,_0x5722a4)[_0x405b('0x12')](function(_0xe2847b){logger[_0x405b('0x22')]('['+_0x5722a4[_0x405b('0x15')]()+']\x20The\x20User\x20ID\x20is:',_0xe2847b[_0x405b('0x25')]);logger['info']('['+_0x5722a4[_0x405b('0x15')]()+_0x405b('0x61'),_0xe2847b[_0x405b('0x1f')]);return getEndUser(_0xe2847b,_0x397736,_0x19b2fd,_0x1bde8b,_0x113ab1,_0x5722a4,_0x3adf84[_0x405b('0x62')],_0x3adf84['additionalSearchContact']);})[_0x405b('0x12')](function(_0x568bd5){logger[_0x405b('0x22')]('['+_0x5722a4['toUpperCase']()+_0x405b('0x63'),_0x568bd5[_0x405b('0x30')]);logger['info']('['+_0x5722a4[_0x405b('0x15')]()+_0x405b('0x64'),_0x113ab1[_0x405b('0x2a')]);return getTicket(_0x568bd5,_0x397736,_0x19b2fd,_0x1bde8b,_0x113ab1,_0x3adf84,_0x5722a4);})['then'](function(_0x138639){logger[_0x405b('0x22')](util[_0x405b('0x4f')]('['+_0x5722a4[_0x405b('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3adf84['ticketType'],_0x138639[_0x405b('0x4d')]));logger[_0x405b('0x22')](util[_0x405b('0x4f')]('['+_0x5722a4[_0x405b('0x15')]()+_0x405b('0x65'),_0x5722a4));if(_0x5722a4!==_0x405b('0x55')&&_0x3adf84[_0x405b('0x66')]){logger[_0x405b('0x22')]('['+_0x5722a4[_0x405b('0x15')]()+']',_0x405b('0x67'));emit(_0x397736['remoteUri'],_0xcd9c20['name'],_0x3adf84[_0x405b('0x3f')],_0x138639[_0x405b('0x4d')]);}})[_0x405b('0x13')](function(_0x370d26){logger['error']('['+_0x5722a4[_0x405b('0x15')]()+_0x405b('0x68'),_0x370d26[_0x405b('0x17')]);console['error'](_0x405b('0x69'),_0x370d26);});}; \ 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 9f8d614..23aef02 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 _0x9eef=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','user:%s','unmanaged','toUpperCase','lastevent','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','then','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','toLowerCase','content','includes','customField','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x749cfd,_0x16a571){var _0x5b9c4e=function(_0x448683){while(--_0x448683){_0x749cfd['push'](_0x749cfd['shift']());}};_0x5b9c4e(++_0x16a571);}(_0x9eef,0xd7));var _0xf9ee=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x9eef[_0x365e54];return _0x13317a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf9ee('0x0'));var util=require(_0xf9ee('0x1'));var Redis=require(_0xf9ee('0x2'));var intUtil=require(_0xf9ee('0x3'));var config=require(_0xf9ee('0x4'));var logger=require(_0xf9ee('0x5'))(_0xf9ee('0x6'));config[_0xf9ee('0x7')]=_[_0xf9ee('0x8')](config[_0xf9ee('0x7')],{'host':_0xf9ee('0x9'),'port':0x18eb});var io=require(_0xf9ee('0xa'))(new Redis(config[_0xf9ee('0x7')]));var headers={'Content-Type':_0xf9ee('0xb'),'Accept':_0xf9ee('0xb')};function emit(_0x1645fc,_0x47a549,_0x510751){io['to'](_0x1645fc)['emit'](_0x47a549,_0x510751);}function getTicket(_0x2803b6,_0x2fe28d,_0x5c579e,_0xa76aa8,_0x573136){logger['info']('Creating\x20new\x20ticket...');var _0x2e775b=_[_0xf9ee('0xc')]({'responder_id':_0x2fe28d['id'],'requester_id':_0x5c579e['id'],'name':util[_0xf9ee('0xd')](_0xf9ee('0xe'),_0x573136[_0xf9ee('0xf')]),'phone':_0x573136[_0xf9ee('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf9ee('0x11')](_0xa76aa8['Subjects'],_0x573136,'\x20'),'description':intUtil[_0xf9ee('0x11')](_0xa76aa8['Descriptions'],_0x573136,_0xf9ee('0x12')),'tags':getTags(_0xa76aa8[_0xf9ee('0x13')],_0xf9ee('0x14'))},getCustomFields(_0xa76aa8[_0xf9ee('0x15')],_0x573136));_0x2e775b[_0xf9ee('0x16')]=_[_0xf9ee('0x17')](_[_0xf9ee('0x18')](_0x2e775b[_0xf9ee('0x16')],'id'),_0xf9ee('0x19'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x1a'),_0x2803b6[_0xf9ee('0x1b')]),'method':_0xf9ee('0x1c'),'body':_0x2e775b})['then'](function(_0x3c33bf){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));return _0x3c33bf;});}function getUser(_0x124df1,_0x19ee5d){if(intUtil['validateEmail'](_0x19ee5d)){return request({'uri':util['format'](_0xf9ee('0x1f'),_0x124df1[_0xf9ee('0x1b')]),'qs':{'email':_0x19ee5d}})['then'](function(_0x3cc322){if(_0x3cc322[_0xf9ee('0x20')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x21'));return _['find'](_0x3cc322,function(_0x369eef){return _0x369eef[_0xf9ee('0x22')][_0xf9ee('0x23')]===_0x19ee5d;});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x24'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x25'),_0x124df1[_0xf9ee('0x1b')])})['then'](function(_0x7aea61){logger[_0xf9ee('0x1d')](_0xf9ee('0x26'));return _0x7aea61;});}});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x27'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x25'),_0x124df1[_0xf9ee('0x1b')])})['then'](function(_0x50dd51){logger[_0xf9ee('0x1d')](_0xf9ee('0x26'));return _0x50dd51;});}}function getEndUser(_0x921806,_0x12fdd4,_0x33d9d7){logger[_0xf9ee('0x1d')]('Searching\x20enduser\x20with\x20phone',_0x33d9d7);return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x28'),_0x921806['remoteUri']),'qs':{'phone':_0x33d9d7}})[_0xf9ee('0x29')](function(_0x3370b2){if(_0x3370b2[_0xf9ee('0x20')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x2a'));return _[_0xf9ee('0x2b')](_0x3370b2,{'phone':_0x33d9d7});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x2c'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x28'),_0x921806[_0xf9ee('0x1b')]),'method':_0xf9ee('0x1c'),'body':{'name':_0x12fdd4,'phone':_0x33d9d7}})[_0xf9ee('0x29')](function(_0x5e2f12){logger['info'](_0xf9ee('0x2d'));return _0x5e2f12;});}});}function getAuth(_0x411ffe){return util[_0xf9ee('0xd')](_0xf9ee('0x2e'),new Buffer(_0x411ffe[_0xf9ee('0x2f')]+':X')[_0xf9ee('0x30')](_0xf9ee('0x31')));}function request(_0x1e6621){logger['debug'](_0xf9ee('0x32'),JSON[_0xf9ee('0x33')](_0x1e6621));return rp(_['defaults'](_0x1e6621,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c579a,_0x57270d){var _0x58c660=[];if(_0x3c579a&&_0x3c579a['length']>0x0){_0x58c660=_[_0xf9ee('0x34')](_0x3c579a,_0x57270d);}return _0x58c660;}function getCustomFields(_0x12808a,_0x540b65){var _0xc27255=[];var _0x1c86fc={'custom_fields':[]};if(_0x12808a['length']>0x0){_[_0xf9ee('0x35')](_0x12808a,function(_0x47d673){if(_['includes']([_0xf9ee('0x36'),_0xf9ee('0x37')],_0x47d673[_0xf9ee('0x38')])&&_0x47d673[_0xf9ee('0x39')]&&!_0x47d673['customField']){_0x1c86fc[_0x47d673['nameField'][_0xf9ee('0x3a')]()]=_0x47d673[_0xf9ee('0x3b')][_0xf9ee('0x30')]();}else if(_[_0xf9ee('0x3c')]([_0xf9ee('0x36'),_0xf9ee('0x37')],_0x47d673[_0xf9ee('0x38')])&&_0x47d673['idField']&&_0x47d673[_0xf9ee('0x3d')]){_0x1c86fc[_0xf9ee('0x16')][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x47d673[_0xf9ee('0x3b')][_0xf9ee('0x30')]()});}else if(_0x47d673[_0xf9ee('0x38')]===_0xf9ee('0x40')&&_0x47d673[_0xf9ee('0x41')]&&_0x47d673[_0xf9ee('0x3f')]&&_0x47d673[_0xf9ee('0x3d')]){_0x540b65[_0x47d673[_0xf9ee('0x41')]]&&_0x1c86fc[_0xf9ee('0x16')][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x540b65[_0x47d673[_0xf9ee('0x41')]][_0xf9ee('0x30')]()});}else if(_0x47d673[_0xf9ee('0x38')]===_0xf9ee('0x42')&&_0x47d673['Variable']&&_0x47d673[_0xf9ee('0x43')][_0xf9ee('0x14')]&&_0x47d673[_0xf9ee('0x3f')]&&_0x47d673[_0xf9ee('0x3d')]){_0x540b65[_0x47d673['Variable']['name']['toLowerCase']()]&&_0x1c86fc['custom_fields'][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x540b65[_0x47d673[_0xf9ee('0x43')][_0xf9ee('0x14')][_0xf9ee('0x3a')]()][_0xf9ee('0x30')]()});}});}return _0x1c86fc;}exports[_0xf9ee('0x44')]=function(_0x2b8cca,_0x303c62,_0x53b20b,_0x217fe8,_0x20b3a2,_0x534e29){var _0x2a6d75,_0xc40971;_0x534e29[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0x534e29[_0xf9ee('0x1b')]);_0x534e29[_0xf9ee('0x46')]=intUtil[_0xf9ee('0x45')](_0x534e29[_0xf9ee('0x46')]);if(_0x20b3a2&&_0x20b3a2[_0xf9ee('0x47')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x48'),'Recording\x20is\x20enabled!');_0x303c62['recordingURL']=util['format'](_0xf9ee('0x49'),_0x534e29['serverUrl'],_0x303c62[_0xf9ee('0x4a')],md5(_0x303c62[_0xf9ee('0x4a')]));}else{_0x303c62[_0xf9ee('0x4b')]='';}headers[_0xf9ee('0x4c')]=getAuth(_0x534e29);return getUser(_0x534e29,_0x217fe8[_0xf9ee('0x23')])['then'](function(_0x36d3ae){_0x2a6d75=_0x36d3ae;logger['info'](_0xf9ee('0x4d'),_0x2a6d75['id']);return getEndUser(_0x534e29,_0x303c62['calleridname'],_0x303c62[_0xf9ee('0x10')]);})[_0xf9ee('0x29')](function(_0x4cefb3){_0xc40971=_0x4cefb3;logger[_0xf9ee('0x1d')](_0xf9ee('0x4e'),_0xc40971['id']);return getTicket(_0x534e29,_0x2a6d75,_0xc40971,_0x53b20b,_0x303c62);})[_0xf9ee('0x29')](function(_0x4a4b34){if(_0x4a4b34&&_0x4a4b34['id']){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));logger['info'](_0xf9ee('0x4f'),_0x4a4b34['id']);logger[_0xf9ee('0x1d')](_0xf9ee('0x48'),_0xf9ee('0x50'));emit(util[_0xf9ee('0xd')]('user:%s',_0x217fe8[_0xf9ee('0x14')]),_0xf9ee('0x51'),{'uri':util[_0xf9ee('0xd')](_0xf9ee('0x52'),_0x534e29[_0xf9ee('0x1b')],_0x4a4b34['id'])});}})[_0xf9ee('0x53')](function(_0x4b25f4){logger[_0xf9ee('0x54')](_0xf9ee('0x48'),JSON[_0xf9ee('0x33')](_0x4b25f4));});};exports[_0xf9ee('0x55')]=function(_0x3071a8,_0xd29bd0,_0x56fc3f,_0x53b23f,_0x48cfba,_0x4b8bb0,_0x23741d){var _0x377d53,_0x362295;_0x4b8bb0[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0x4b8bb0[_0xf9ee('0x1b')]);_0x4b8bb0['serverUrl']=intUtil[_0xf9ee('0x45')](_0x4b8bb0['serverUrl']);if(_0x23741d&&_0x23741d[_0xf9ee('0x56')]&&_0x23741d[_0xf9ee('0x56')]!==_0xf9ee('0x57')){logger[_0xf9ee('0x1d')](_0xf9ee('0x58'),_0xf9ee('0x59'));_0xd29bd0[_0xf9ee('0x4b')]=util[_0xf9ee('0xd')](_0xf9ee('0x49'),_0x4b8bb0[_0xf9ee('0x46')],_0xd29bd0['uniqueid'],md5(_0xd29bd0[_0xf9ee('0x4a')]));}headers[_0xf9ee('0x4c')]=getAuth(_0x4b8bb0);return getUser(_0x4b8bb0,_0x53b23f[_0xf9ee('0x23')])[_0xf9ee('0x29')](function(_0x523652){_0x377d53=_0x523652;logger[_0xf9ee('0x1d')](_0xf9ee('0x4d'),_0x377d53['id']);return getEndUser(_0x4b8bb0,_0xd29bd0[_0xf9ee('0x5a')],_0xd29bd0[_0xf9ee('0x5b')]);})[_0xf9ee('0x29')](function(_0x5e4ea4){_0x362295=_0x5e4ea4;logger['info'](_0xf9ee('0x4e'),_0x362295['id']);return getTicket(_0x4b8bb0,_0x377d53,_0x362295,_0x56fc3f,_0xd29bd0);})[_0xf9ee('0x29')](function(_0x45c53e){if(_0x45c53e&&_0x45c53e['id']){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x45c53e['id']);logger[_0xf9ee('0x1d')](_0xf9ee('0x58'),_0xf9ee('0x50'));emit(util['format'](_0xf9ee('0x5c'),_0x53b23f[_0xf9ee('0x14')]),_0xf9ee('0x51'),{'uri':util[_0xf9ee('0xd')]('%s/helpdesk/tickets/%d',_0x4b8bb0[_0xf9ee('0x1b')],_0x45c53e['id'])});}})[_0xf9ee('0x53')](function(_0x45dd17){logger[_0xf9ee('0x54')]('[OUTBOUND]',JSON[_0xf9ee('0x33')](_0x45dd17));});};exports[_0xf9ee('0x5d')]=function(_0x5eb0a8,_0x23c323,_0x560c86,_0x2146e6,_0x3e1ca1,_0xf33063){var _0x42ddf0,_0x2bf981;_0xf33063[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0xf33063[_0xf9ee('0x1b')]);_0xf33063[_0xf9ee('0x46')]=intUtil[_0xf9ee('0x45')](_0xf33063[_0xf9ee('0x46')]);if(_0x3e1ca1&&_0x3e1ca1['monitor_format']){logger[_0xf9ee('0x1d')]('['+_0x23c323['lastevent'][_0xf9ee('0x5e')]()+']','Recording\x20is\x20enabled!');_0x23c323[_0xf9ee('0x4b')]=util[_0xf9ee('0xd')](_0xf9ee('0x49'),_0xf33063['serverUrl'],_0x23c323[_0xf9ee('0x4a')],md5(_0x23c323[_0xf9ee('0x4a')]));}else{_0x23c323[_0xf9ee('0x4b')]='';}headers[_0xf9ee('0x4c')]=getAuth(_0xf33063);return getUser(_0xf33063,'')[_0xf9ee('0x29')](function(_0x224bce){_0x42ddf0=_0x224bce;logger['info'](_0xf9ee('0x4d'),_0x42ddf0['id']);return getEndUser(_0xf33063,_0x23c323[_0xf9ee('0xf')],_0x23c323[_0xf9ee('0x10')]);})['then'](function(_0x3d4b45){_0x2bf981=_0x3d4b45;logger[_0xf9ee('0x1d')](_0xf9ee('0x4e'),_0x2bf981['id']);return getTicket(_0xf33063,_0x42ddf0,_0x2bf981,_0x560c86,_0x23c323);})['then'](function(_0x52e3c4){if(_0x52e3c4){logger[_0xf9ee('0x1d')]('Ticket\x20created!');logger[_0xf9ee('0x1d')](_0xf9ee('0x4f'),_0x52e3c4['id']);}})[_0xf9ee('0x53')](function(_0xd9b4d4){logger[_0xf9ee('0x54')]('['+_0x23c323[_0xf9ee('0x5f')][_0xf9ee('0x5e')]()+']',JSON[_0xf9ee('0x33')](_0xd9b4d4));});}; \ No newline at end of file +var _0x19e7=['Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','catch','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','redis','localhost','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','name','Fields','keyBy','custom_fields','value','format','POST','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','debug','[HTTP]','stringify','defaults','string','picklist','type','nameField','toString','idField','customField','push','variableName'];(function(_0x49c597,_0x702c14){var _0x70cb4f=function(_0x3df8bb){while(--_0x3df8bb){_0x49c597['push'](_0x49c597['shift']());}};_0x70cb4f(++_0x702c14);}(_0x19e7,0x112));var _0x719e=function(_0x4da6e2,_0x2af1c8){_0x4da6e2=_0x4da6e2-0x0;var _0x4a9caf=_0x19e7[_0x4da6e2];return _0x4a9caf;};'use strict';var _=require('lodash');var rp=require(_0x719e('0x0'));var md5=require(_0x719e('0x1'));var util=require(_0x719e('0x2'));var Redis=require(_0x719e('0x3'));var intUtil=require('./util');var config=require(_0x719e('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0x719e('0x5')]=_['defaults'](config['redis'],{'host':_0x719e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x719e('0x7'),'Accept':_0x719e('0x7')};function emit(_0x30a95d,_0x36c27c,_0x2ba32e){io['to'](_0x30a95d)[_0x719e('0x8')](_0x36c27c,_0x2ba32e);}function getTicket(_0xfa3f08,_0x5d5216,_0x46fa2e,_0x4893b3,_0x3701e0){logger[_0x719e('0x9')]('Creating\x20new\x20ticket...');var _0x27194a=_[_0x719e('0xa')]({'responder_id':_0x5d5216['id'],'requester_id':_0x46fa2e['id'],'name':util['format'](_0x719e('0xb'),_0x3701e0[_0x719e('0xc')]),'phone':_0x3701e0[_0x719e('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4893b3[_0x719e('0xe')],_0x3701e0,'\x20'),'description':intUtil['getString'](_0x4893b3[_0x719e('0xf')],_0x3701e0,_0x719e('0x10')),'tags':getTags(_0x4893b3['Tags'],_0x719e('0x11'))},getCustomFields(_0x4893b3[_0x719e('0x12')],_0x3701e0));_0x27194a['custom_fields']=_['mapValues'](_[_0x719e('0x13')](_0x27194a[_0x719e('0x14')],'id'),_0x719e('0x15'));return request({'uri':util[_0x719e('0x16')]('%s/api/v2/tickets',_0xfa3f08['remoteUri']),'method':_0x719e('0x17'),'body':_0x27194a})['then'](function(_0x1426d6){logger[_0x719e('0x9')]('Ticket\x20created!');return _0x1426d6;});}function getUser(_0x1f3381,_0x2a6484){if(intUtil[_0x719e('0x18')](_0x2a6484)){return request({'uri':util[_0x719e('0x16')](_0x719e('0x19'),_0x1f3381[_0x719e('0x1a')]),'qs':{'email':_0x2a6484}})[_0x719e('0x1b')](function(_0x14c7a9){if(_0x14c7a9[_0x719e('0x1c')]){logger[_0x719e('0x9')](_0x719e('0x1d'));return _[_0x719e('0x1e')](_0x14c7a9,function(_0x159a75){return _0x159a75[_0x719e('0x1f')][_0x719e('0x20')]===_0x2a6484;});}else{logger[_0x719e('0x9')](_0x719e('0x21'));return request({'uri':util[_0x719e('0x16')](_0x719e('0x22'),_0x1f3381[_0x719e('0x1a')])})[_0x719e('0x1b')](function(_0x7c366b){logger[_0x719e('0x9')](_0x719e('0x23'));return _0x7c366b;});}});}else{logger[_0x719e('0x9')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x719e('0x16')]('%s/api/v2/agents/me',_0x1f3381[_0x719e('0x1a')])})[_0x719e('0x1b')](function(_0x3dc73f){logger[_0x719e('0x9')](_0x719e('0x23'));return _0x3dc73f;});}}function getEndUser(_0x2cb8d0,_0x38e9ec,_0xf6e7d0){logger[_0x719e('0x9')]('Searching\x20enduser\x20with\x20phone',_0xf6e7d0);return request({'uri':util[_0x719e('0x16')](_0x719e('0x24'),_0x2cb8d0[_0x719e('0x1a')]),'qs':{'phone':_0xf6e7d0}})[_0x719e('0x1b')](function(_0x6c06f8){if(_0x6c06f8[_0x719e('0x1c')]){logger[_0x719e('0x9')](_0x719e('0x25'));return _[_0x719e('0x1e')](_0x6c06f8,{'phone':_0xf6e7d0});}else{logger[_0x719e('0x9')](_0x719e('0x26'));return request({'uri':util['format']('%s/api/v2/contacts',_0x2cb8d0[_0x719e('0x1a')]),'method':_0x719e('0x17'),'body':{'name':_0x38e9ec,'phone':_0xf6e7d0}})['then'](function(_0x19761b){logger['info'](_0x719e('0x27'));return _0x19761b;});}});}function getAuth(_0x40dad0){return util[_0x719e('0x16')](_0x719e('0x28'),new Buffer(_0x40dad0['apiKey']+':X')['toString']('base64'));}function request(_0x88813a){logger[_0x719e('0x29')](_0x719e('0x2a'),JSON[_0x719e('0x2b')](_0x88813a));return rp(_[_0x719e('0x2c')](_0x88813a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1c6752,_0x22b415){var _0x46c806=[];if(_0x1c6752&&_0x1c6752['length']>0x0){_0x46c806=_['map'](_0x1c6752,_0x22b415);}return _0x46c806;}function getCustomFields(_0x3ed703,_0x48d395){var _0x9b2ebe=[];var _0x321770={'custom_fields':[]};if(_0x3ed703[_0x719e('0x1c')]>0x0){_['forEach'](_0x3ed703,function(_0x31686a){if(_['includes']([_0x719e('0x2d'),_0x719e('0x2e')],_0x31686a[_0x719e('0x2f')])&&_0x31686a[_0x719e('0x30')]&&!_0x31686a['customField']){_0x321770[_0x31686a[_0x719e('0x30')]['toLowerCase']()]=_0x31686a['content'][_0x719e('0x31')]();}else if(_['includes']([_0x719e('0x2d'),_0x719e('0x2e')],_0x31686a['type'])&&_0x31686a[_0x719e('0x32')]&&_0x31686a[_0x719e('0x33')]){_0x321770[_0x719e('0x14')][_0x719e('0x34')]({'id':_0x31686a['idField'],'value':_0x31686a['content'][_0x719e('0x31')]()});}else if(_0x31686a['type']==='variable'&&_0x31686a[_0x719e('0x35')]&&_0x31686a['idField']&&_0x31686a['customField']){_0x48d395[_0x31686a[_0x719e('0x35')]]&&_0x321770[_0x719e('0x14')][_0x719e('0x34')]({'id':_0x31686a['idField'],'value':_0x48d395[_0x31686a[_0x719e('0x35')]][_0x719e('0x31')]()});}else if(_0x31686a[_0x719e('0x2f')]==='customVariable'&&_0x31686a[_0x719e('0x36')]&&_0x31686a[_0x719e('0x36')][_0x719e('0x11')]&&_0x31686a['idField']&&_0x31686a[_0x719e('0x33')]){_0x48d395[_0x31686a['Variable']['name'][_0x719e('0x37')]()]&&_0x321770[_0x719e('0x14')][_0x719e('0x34')]({'id':_0x31686a['idField'],'value':_0x48d395[_0x31686a[_0x719e('0x36')]['name'][_0x719e('0x37')]()][_0x719e('0x31')]()});}});}return _0x321770;}exports[_0x719e('0x38')]=function(_0x2aeca6,_0x3b830c,_0x26cdcc,_0x47cf47,_0x109261,_0x41212c){var _0x5284a7,_0x556d76;_0x41212c['remoteUri']=intUtil[_0x719e('0x39')](_0x41212c[_0x719e('0x1a')]);_0x41212c[_0x719e('0x3a')]=intUtil[_0x719e('0x39')](_0x41212c[_0x719e('0x3a')]);if(_0x109261&&_0x109261[_0x719e('0x3b')]){logger[_0x719e('0x9')]('[QUEUE]',_0x719e('0x3c'));_0x3b830c['recordingURL']=util[_0x719e('0x16')](_0x719e('0x3d'),_0x41212c[_0x719e('0x3a')],_0x3b830c['uniqueid'],md5(_0x3b830c['uniqueid']));}else{_0x3b830c[_0x719e('0x3e')]='';}headers[_0x719e('0x3f')]=getAuth(_0x41212c);return getUser(_0x41212c,_0x47cf47[_0x719e('0x20')])[_0x719e('0x1b')](function(_0x1a2175){_0x5284a7=_0x1a2175;logger[_0x719e('0x9')](_0x719e('0x40'),_0x5284a7['id']);return getEndUser(_0x41212c,_0x3b830c[_0x719e('0xc')],_0x3b830c[_0x719e('0xd')]);})[_0x719e('0x1b')](function(_0x511486){_0x556d76=_0x511486;logger[_0x719e('0x9')](_0x719e('0x41'),_0x556d76['id']);return getTicket(_0x41212c,_0x5284a7,_0x556d76,_0x26cdcc,_0x3b830c);})['then'](function(_0x3db94e){if(_0x3db94e&&_0x3db94e['id']){logger[_0x719e('0x9')](_0x719e('0x42'));logger[_0x719e('0x9')](_0x719e('0x43'),_0x3db94e['id']);logger[_0x719e('0x9')](_0x719e('0x44'),_0x719e('0x45'));emit(util[_0x719e('0x16')]('user:%s',_0x47cf47[_0x719e('0x11')]),_0x719e('0x46'),{'uri':util[_0x719e('0x16')](_0x719e('0x47'),_0x41212c[_0x719e('0x1a')],_0x3db94e['id'])});}})['catch'](function(_0x45cb12){logger[_0x719e('0x48')](_0x719e('0x44'),JSON['stringify'](_0x45cb12));});};exports['outbound']=function(_0xf5e22d,_0x5ba73c,_0x2ae03f,_0x4c61af,_0x20e0e4,_0x260e67,_0xc074ce){var _0x4c8ce2,_0x1b8c0c;_0x260e67[_0x719e('0x1a')]=intUtil[_0x719e('0x39')](_0x260e67[_0x719e('0x1a')]);_0x260e67['serverUrl']=intUtil['stripTrailingSlash'](_0x260e67[_0x719e('0x3a')]);if(_0xc074ce&&_0xc074ce[_0x719e('0x49')]&&_0xc074ce[_0x719e('0x49')]!==_0x719e('0x4a')){logger['info'](_0x719e('0x4b'),_0x719e('0x3c'));_0x5ba73c[_0x719e('0x3e')]=util[_0x719e('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x260e67['serverUrl'],_0x5ba73c['uniqueid'],md5(_0x5ba73c[_0x719e('0x4c')]));}headers['Authorization']=getAuth(_0x260e67);return getUser(_0x260e67,_0x4c61af[_0x719e('0x20')])[_0x719e('0x1b')](function(_0x580247){_0x4c8ce2=_0x580247;logger[_0x719e('0x9')](_0x719e('0x40'),_0x4c8ce2['id']);return getEndUser(_0x260e67,_0x5ba73c[_0x719e('0x4d')],_0x5ba73c['destcalleridnum']);})['then'](function(_0xb72e0a){_0x1b8c0c=_0xb72e0a;logger[_0x719e('0x9')]('The\x20Enduser\x20ID\x20is:',_0x1b8c0c['id']);return getTicket(_0x260e67,_0x4c8ce2,_0x1b8c0c,_0x2ae03f,_0x5ba73c);})['then'](function(_0x1dae57){if(_0x1dae57&&_0x1dae57['id']){logger[_0x719e('0x9')](_0x719e('0x42'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1dae57['id']);logger[_0x719e('0x9')](_0x719e('0x4b'),_0x719e('0x45'));emit(util['format']('user:%s',_0x4c61af['name']),'trigger:browser:url',{'uri':util[_0x719e('0x16')](_0x719e('0x47'),_0x260e67[_0x719e('0x1a')],_0x1dae57['id'])});}})[_0x719e('0x4e')](function(_0x38cecc){logger[_0x719e('0x48')](_0x719e('0x4b'),JSON[_0x719e('0x2b')](_0x38cecc));});};exports[_0x719e('0x4f')]=function(_0x525224,_0x3257b2,_0x3d71e3,_0x401e90,_0x373319,_0xd5c12b){var _0x26b19d,_0x47b73d;_0xd5c12b[_0x719e('0x1a')]=intUtil[_0x719e('0x39')](_0xd5c12b['remoteUri']);_0xd5c12b[_0x719e('0x3a')]=intUtil[_0x719e('0x39')](_0xd5c12b[_0x719e('0x3a')]);if(_0x373319&&_0x373319[_0x719e('0x3b')]){logger['info']('['+_0x3257b2[_0x719e('0x50')][_0x719e('0x51')]()+']',_0x719e('0x3c'));_0x3257b2[_0x719e('0x3e')]=util[_0x719e('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd5c12b['serverUrl'],_0x3257b2[_0x719e('0x4c')],md5(_0x3257b2[_0x719e('0x4c')]));}else{_0x3257b2[_0x719e('0x3e')]='';}headers[_0x719e('0x3f')]=getAuth(_0xd5c12b);return getUser(_0xd5c12b,'')[_0x719e('0x1b')](function(_0x276b5a){_0x26b19d=_0x276b5a;logger[_0x719e('0x9')](_0x719e('0x40'),_0x26b19d['id']);return getEndUser(_0xd5c12b,_0x3257b2['calleridname'],_0x3257b2[_0x719e('0xd')]);})[_0x719e('0x1b')](function(_0x136341){_0x47b73d=_0x136341;logger['info'](_0x719e('0x41'),_0x47b73d['id']);return getTicket(_0xd5c12b,_0x26b19d,_0x47b73d,_0x3d71e3,_0x3257b2);})['then'](function(_0x59fa66){if(_0x59fa66){logger['info'](_0x719e('0x42'));logger['info'](_0x719e('0x43'),_0x59fa66['id']);}})[_0x719e('0x4e')](function(_0x4ec1df){logger[_0x719e('0x48')]('['+_0x3257b2[_0x719e('0x50')][_0x719e('0x51')]()+']',JSON[_0x719e('0x2b')](_0x4ec1df));});}; \ 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 b52c340..785abf8 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 _0xef30=['Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','headers','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','GET','/api/selector/owners','info','users','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:'];(function(_0x399e3b,_0x5dd3d2){var _0x28c6a4=function(_0x7d77c1){while(--_0x7d77c1){_0x399e3b['push'](_0x399e3b['shift']());}};_0x28c6a4(++_0x5dd3d2);}(_0xef30,0x129));var _0x0ef3=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xef30[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x0ef3('0x0'));var rp=require(_0x0ef3('0x1'));var md5=require(_0x0ef3('0x2'));var util=require(_0x0ef3('0x3'));var moment=require(_0x0ef3('0x4'));var Promise=require(_0x0ef3('0x5'));var Redis=require(_0x0ef3('0x6'));var intUtil=require(_0x0ef3('0x7'));var config=require(_0x0ef3('0x8'));var logger=require('../../../../config/logger')(_0x0ef3('0x9'));config[_0x0ef3('0xa')]=_[_0x0ef3('0xb')](config[_0x0ef3('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0ef3('0xa')]));function getAdminId(_0x262555,_0x5a04f2,_0x92f3aa,_0x535c4f){return new Promise(function(_0x111243,_0x5e2e23){var _0x5a64a9=![];var _0xb64aac={'method':_0x0ef3('0xc'),'uri':_0x535c4f+_0x0ef3('0xd'),'json':!![]};_0xb64aac['headers']=_0x92f3aa;logger[_0x0ef3('0xe')]('Getting\x20admin\x20information');return rp(_0xb64aac)['then'](function(_0x5522a5){if(_0x5522a5){var _0x5816d2=_0x5522a5[_0x0ef3('0xf')];var _0x3bbf36=null;for(_0x3bbf36=0x0;_0x3bbf36<_0x5816d2['length'];_0x3bbf36++){if(_0x5816d2[_0x3bbf36][_0x0ef3('0x10')]===_0x262555['adminEmail']){_0x262555[_0x0ef3('0x11')]=_0x5816d2[_0x3bbf36]['id'];_0x5a64a9=!![];}}if(_0x5a64a9){logger[_0x0ef3('0xe')]('Admin\x20found:',_0x262555[_0x0ef3('0x11')]);_0x111243(_0x262555);}else{_0x5e2e23({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5e2e23({'statusCode':0x194,'message':_0x0ef3('0x12')});}})[_0x0ef3('0x13')](function(_0x1e5bc5){logger[_0x0ef3('0x14')]('['+[_0x5a04f2[_0x0ef3('0x15')]()]+']',_0x1e5bc5[_0x0ef3('0x16')]);_0x5e2e23(_0x1e5bc5);});});}function getUser(_0x1b8ec6,_0x5531da,_0x31108e){return function(_0x1b2100){return new Promise(function(_0x8e2da9,_0x5b1d0b){var _0x285265={'method':'GET','uri':_0x31108e+_0x0ef3('0xd'),'json':!![]};_0x285265['headers']=_0x5531da;logger['info'](_0x0ef3('0x17'));return rp(_0x285265)[_0x0ef3('0x18')](function(_0x3001a0){if(_0x3001a0){var _0x598f98=_0x3001a0[_0x0ef3('0xf')];var _0x38ae3d=![];var _0x56604d=null;if(_0x1b2100['agentEmail']!==null){logger[_0x0ef3('0xe')](_0x0ef3('0x19'),_0x1b2100[_0x0ef3('0x1a')]);_0x1b2100[_0x0ef3('0x1b')]=_0x1b2100[_0x0ef3('0x1a')];for(_0x56604d=0x0;_0x56604d<_0x598f98['length'];_0x56604d++){if(_0x598f98[_0x56604d][_0x0ef3('0x10')]===_0x1b2100[_0x0ef3('0x1a')]){_0x38ae3d=!![];_0x1b2100[_0x0ef3('0x1c')]=_0x598f98[_0x56604d]['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x1d'),_0x1b2100[_0x0ef3('0x1c')]);}}}if(!_0x38ae3d){logger[_0x0ef3('0xe')](_0x0ef3('0x1e'));_0x1b2100['userEmail']=_0x1b2100[_0x0ef3('0x1f')];_0x1b2100[_0x0ef3('0x1c')]=_0x1b2100[_0x0ef3('0x11')];_0x38ae3d=!![];}if(_0x38ae3d){_0x8e2da9(_0x1b2100);}else{_0x5b1d0b({'statusCode':0x194,'message':_0x0ef3('0x12')});}}else{_0x5b1d0b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0ef3('0x13')](function(_0xebe3a8){logger[_0x0ef3('0x14')]('['+[_0x1b8ec6[_0x0ef3('0x15')]()]+']',_0xebe3a8[_0x0ef3('0x16')]);_0x5b1d0b(_0xebe3a8);});});};}function searchContact(_0x47cca0,_0x14b2ec,_0x289081,_0x18c342){return new Promise(function(_0x5ebf3a,_0x229f24){var _0x310465={'method':'GET','headers':_0x14b2ec,'uri':_0x47cca0+_0x0ef3('0x20')+_0x18c342+_0x0ef3('0x21')+_0x289081+_0x0ef3('0x22'),'json':!![]};rp(_0x310465)[_0x0ef3('0x18')](function(_0x1dc02d){var _0x29843b=_['find'](_0x1dc02d['contacts'][_0x0ef3('0x23')],[_0x289081,_0x18c342]);_0x5ebf3a(_0x29843b);})['catch'](function(_0x4d3d35){_0x229f24(_0x4d3d35);});});}function getEndUser(_0x1063a5,_0x574560,_0x21c85b){return function(_0x44148f){return new Promise(function(_0x24fca3,_0xe035a4){logger['info'](util['format'](_0x0ef3('0x24'),_0x44148f[_0x0ef3('0x25')]));searchContact(_0x21c85b,_0x574560,_0x0ef3('0x26'),_0x44148f['contactNumber'])[_0x0ef3('0x18')](function(_0x1d6545){if(_0x1d6545){_0x44148f[_0x0ef3('0x27')]=_0x1d6545['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x28'),_0x44148f['endUserId']);return _0x24fca3(_0x44148f);}searchContact(_0x21c85b,_0x574560,_0x0ef3('0x29'),_0x44148f[_0x0ef3('0x25')])[_0x0ef3('0x18')](function(_0xf1008d){if(_0xf1008d){_0x44148f[_0x0ef3('0x27')]=_0xf1008d['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x2a'),_0x44148f[_0x0ef3('0x27')]);return _0x24fca3(_0x44148f);}createEndUser(_0x44148f,_0x1063a5,_0x574560,_0x21c85b)[_0x0ef3('0x18')](function(_0x477e4b){logger[_0x0ef3('0xe')](_0x0ef3('0x2b'),_0x477e4b['endUserId']);return _0x24fca3(_0x477e4b);});});})[_0x0ef3('0x13')](function(_0x2e4482){_0xe035a4(_0x2e4482);});});};}function createEndUser(_0x22e819,_0x32cfbf,_0x3f7b18,_0x305721){return new Promise(function(_0x45fcb9,_0x7061d){var _0x275d46=moment();var _0x36e1ff={'method':_0x0ef3('0x2c'),'uri':_0x305721+_0x0ef3('0x2d'),'body':{'contact':{'last_name':_0x22e819[_0x0ef3('0x25')],'work_number':_0x22e819['contactNumber'],'mobile_number':_0x22e819[_0x0ef3('0x25')],'owner_id':_0x22e819[_0x0ef3('0x1c')],'created_at':_0x275d46[_0x0ef3('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x36e1ff['headers']=_0x3f7b18;logger[_0x0ef3('0xe')](_0x0ef3('0x2f'));return rp(_0x36e1ff)[_0x0ef3('0x18')](function(_0x5ceae9){_0x22e819[_0x0ef3('0x27')]=_0x5ceae9[_0x0ef3('0x30')]['id'];_0x45fcb9(_0x22e819);})['catch'](function(_0x5e7ab8){logger[_0x0ef3('0x14')]('['+[_0x32cfbf[_0x0ef3('0x15')]()]+']',_0x5e7ab8[_0x0ef3('0x16')]);_0x7061d(_0x5e7ab8['message']);});});}function getTicket(_0x20fb31,_0x1e115f,_0x19374b,_0x5ceef5,_0x201c36){return function(_0x41b1d){logger[_0x0ef3('0xe')](_0x0ef3('0x31'));return new Promise(function(_0x351ddd,_0xd9d381){var _0x48c4f3=moment();var _0x7398e4={'method':'POST','uri':_0x19374b+'/api/tasks','body':{'title':intUtil[_0x0ef3('0x32')](_0x5ceef5[_0x0ef3('0x33')],_0x201c36,'\x20'),'description':intUtil[_0x0ef3('0x32')](_0x5ceef5[_0x0ef3('0x34')],_0x201c36,'\x0a'),'owner_id':_0x41b1d[_0x0ef3('0x1c')],'creater_id':_0x41b1d['adminId'],'targetable_id':_0x41b1d[_0x0ef3('0x27')],'targetable_type':_0x0ef3('0x35'),'created_at':_0x48c4f3[_0x0ef3('0x2e')](_0x0ef3('0x36')),'due_date':_0x48c4f3[_0x0ef3('0x37')](0x1e,'m')['format'](_0x0ef3('0x36'))},'json':!![]};_0x7398e4[_0x0ef3('0x38')]=_0x1e115f;return rp(_0x7398e4)[_0x0ef3('0x18')](function(_0x317bb4){_0x41b1d[_0x0ef3('0x39')]=_0x317bb4[_0x0ef3('0x3a')]['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x3b'),_0x41b1d[_0x0ef3('0x39')]);_0x351ddd(_0x41b1d);})['catch'](function(_0x3ba9ed){logger['error']('['+[_0x20fb31[_0x0ef3('0x15')]()]+']',_0x3ba9ed[_0x0ef3('0x16')]);_0xd9d381(_0x3ba9ed[_0x0ef3('0x16')]);});});};}function emit(_0x198d58,_0x1865f1,_0x6cafc1){var _0x402243={'uri':_0x198d58+_0x0ef3('0x3c')+_0x6cafc1};io['to'](util[_0x0ef3('0x2e')](_0x0ef3('0x3d'),_0x1865f1))[_0x0ef3('0x3e')]('trigger:browser:url',_0x402243);}exports['cs']=function(_0x4e4a84,_0x5a6549,_0x1c4699,_0x4f6d3a,_0x394371,_0x299e93,_0x44bf24,_0x5bf24d){var _0x4c519b={};var _0x116750={'Authorization':_0x0ef3('0x3f')+_0x299e93[_0x0ef3('0x40')]};_0x299e93[_0x0ef3('0x41')]=intUtil[_0x0ef3('0x42')](_0x299e93[_0x0ef3('0x41')]);_0x299e93[_0x0ef3('0x43')]=intUtil['stripTrailingSlash'](_0x299e93[_0x0ef3('0x43')]);var _0xd21825=_0x299e93[_0x0ef3('0x41')];_0x4c519b[_0x0ef3('0x1f')]=_0x299e93[_0x0ef3('0x44')];_0x4c519b['contactNumber']=_0x5bf24d[_0x0ef3('0x45')]()===_0x0ef3('0x46')?_0x5a6549[_0x0ef3('0x47')]:_0x5a6549['calleridnum'];_0x4c519b[_0x0ef3('0x48')]=_0x5bf24d===_0x0ef3('0x49')||_0x5bf24d===_0x0ef3('0x4a')?_0x0ef3('0x49'):_0x0ef3('0x46');if(_0x4f6d3a){_0x4c519b['agentEmail']=_0x4f6d3a[_0x0ef3('0x10')];}var _0x51e50d=util[_0x0ef3('0x2e')](_0x0ef3('0x4b'),_0x299e93[_0x0ef3('0x43')],_0x5a6549[_0x0ef3('0x4c')],md5(_0x5a6549[_0x0ef3('0x4c')]));if(_0x394371&&_0x394371['monitor_format']){logger[_0x0ef3('0xe')]('[QUEUE]',_0x0ef3('0x4d'));_0x5a6549[_0x0ef3('0x4e')]=_0x51e50d;}else if(_0x44bf24&&_0x44bf24[_0x0ef3('0x4f')]&&_0x44bf24[_0x0ef3('0x4f')]!==_0x0ef3('0x50')){logger[_0x0ef3('0xe')](_0x0ef3('0x51'),_0x0ef3('0x4d'));_0x5a6549[_0x0ef3('0x4e')]=_0x51e50d;}else{_0x5a6549[_0x0ef3('0x4e')]='';}return getAdminId(_0x4c519b,_0x5bf24d,_0x116750,_0xd21825)[_0x0ef3('0x18')](getUser(_0x5bf24d,_0x116750,_0xd21825))[_0x0ef3('0x18')](getEndUser(_0x5bf24d,_0x116750,_0xd21825))[_0x0ef3('0x18')](getTicket(_0x5bf24d,_0x116750,_0xd21825,_0x1c4699,_0x5a6549))[_0x0ef3('0x18')](function(_0x125d09){logger[_0x0ef3('0xe')](util[_0x0ef3('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x125d09[_0x0ef3('0x39')]));if(_0x5bf24d!==_0x0ef3('0x4a')){logger[_0x0ef3('0xe')]('['+[_0x5bf24d[_0x0ef3('0x15')]()]+']',_0x0ef3('0x52'));emit(_0xd21825,_0x4f6d3a[_0x0ef3('0x53')],_0x125d09['endUserId']);}})[_0x0ef3('0x13')](function(_0x4db300){logger[_0x0ef3('0x14')]('['+[_0x5bf24d[_0x0ef3('0x15')]()]+_0x0ef3('0x54'),util['inspect'](_0x4db300,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x29ca=['then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','userId','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Contact','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','userEmail','User\x20found:','Admin\x20selected','/api/lookup?q=','&f='];(function(_0x581c91,_0x1f9302){var _0x4665e3=function(_0x135a8a){while(--_0x135a8a){_0x581c91['push'](_0x581c91['shift']());}};_0x4665e3(++_0x1f9302);}(_0x29ca,0xca));var _0xa29c=function(_0x37b9ad,_0x179adf){_0x37b9ad=_0x37b9ad-0x0;var _0x6264e2=_0x29ca[_0x37b9ad];return _0x6264e2;};'use strict';var _=require('lodash');var rp=require(_0xa29c('0x0'));var md5=require(_0xa29c('0x1'));var util=require(_0xa29c('0x2'));var moment=require(_0xa29c('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xa29c('0x4'));var logger=require(_0xa29c('0x5'))(_0xa29c('0x6'));config[_0xa29c('0x7')]=_[_0xa29c('0x8')](config[_0xa29c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa29c('0x9'))(new Redis(config[_0xa29c('0x7')]));function getAdminId(_0x1f2cef,_0x540e61,_0x161973,_0x5f3560){return new Promise(function(_0x21c52c,_0x215b93){var _0x26d356=![];var _0x455783={'method':_0xa29c('0xa'),'uri':_0x5f3560+_0xa29c('0xb'),'json':!![]};_0x455783['headers']=_0x161973;logger[_0xa29c('0xc')]('Getting\x20admin\x20information');return rp(_0x455783)['then'](function(_0x4b19c6){if(_0x4b19c6){var _0x1431ab=_0x4b19c6[_0xa29c('0xd')];var _0x57bee5=null;for(_0x57bee5=0x0;_0x57bee5<_0x1431ab[_0xa29c('0xe')];_0x57bee5++){if(_0x1431ab[_0x57bee5][_0xa29c('0xf')]===_0x1f2cef[_0xa29c('0x10')]){_0x1f2cef[_0xa29c('0x11')]=_0x1431ab[_0x57bee5]['id'];_0x26d356=!![];}}if(_0x26d356){logger[_0xa29c('0xc')](_0xa29c('0x12'),_0x1f2cef[_0xa29c('0x11')]);_0x21c52c(_0x1f2cef);}else{_0x215b93({'statusCode':0x194,'message':_0xa29c('0x13')});}}else{_0x215b93({'statusCode':0x194,'message':_0xa29c('0x13')});}})[_0xa29c('0x14')](function(_0x188bfa){logger[_0xa29c('0x15')]('['+[_0x540e61[_0xa29c('0x16')]()]+']',_0x188bfa[_0xa29c('0x17')]);_0x215b93(_0x188bfa);});});}function getUser(_0x1a024d,_0x5d9c9b,_0x498b42){return function(_0x5ca1dc){return new Promise(function(_0xb3b99f,_0x26589c){var _0x26528c={'method':'GET','uri':_0x498b42+_0xa29c('0xb'),'json':!![]};_0x26528c[_0xa29c('0x18')]=_0x5d9c9b;logger['info'](_0xa29c('0x19'));return rp(_0x26528c)['then'](function(_0x1a783e){if(_0x1a783e){var _0x25b025=_0x1a783e[_0xa29c('0xd')];var _0x47d0e5=![];var _0x5e1e8f=null;if(_0x5ca1dc[_0xa29c('0x1a')]!==null){logger[_0xa29c('0xc')]('Getting\x20user\x20with\x20email',_0x5ca1dc[_0xa29c('0x1a')]);_0x5ca1dc[_0xa29c('0x1b')]=_0x5ca1dc[_0xa29c('0x1a')];for(_0x5e1e8f=0x0;_0x5e1e8f<_0x25b025[_0xa29c('0xe')];_0x5e1e8f++){if(_0x25b025[_0x5e1e8f]['email']===_0x5ca1dc[_0xa29c('0x1a')]){_0x47d0e5=!![];_0x5ca1dc['userId']=_0x25b025[_0x5e1e8f]['id'];logger[_0xa29c('0xc')](_0xa29c('0x1c'),_0x5ca1dc['userId']);}}}if(!_0x47d0e5){logger[_0xa29c('0xc')](_0xa29c('0x1d'));_0x5ca1dc[_0xa29c('0x1b')]=_0x5ca1dc['adminEmail'];_0x5ca1dc['userId']=_0x5ca1dc[_0xa29c('0x11')];_0x47d0e5=!![];}if(_0x47d0e5){_0xb3b99f(_0x5ca1dc);}else{_0x26589c({'statusCode':0x194,'message':_0xa29c('0x13')});}}else{_0x26589c({'statusCode':0x194,'message':_0xa29c('0x13')});}})[_0xa29c('0x14')](function(_0x41891d){logger['error']('['+[_0x1a024d[_0xa29c('0x16')]()]+']',_0x41891d['message']);_0x26589c(_0x41891d);});});};}function searchContact(_0x212f81,_0x5e530d,_0x4b363f,_0x7ecad6){return new Promise(function(_0x2f3fde,_0x6ceeaa){var _0x3c18dd={'method':_0xa29c('0xa'),'headers':_0x5e530d,'uri':_0x212f81+_0xa29c('0x1e')+_0x7ecad6+_0xa29c('0x1f')+_0x4b363f+'&entities=contact','json':!![]};rp(_0x3c18dd)[_0xa29c('0x20')](function(_0x84faa4){var _0x45fc7b=_[_0xa29c('0x21')](_0x84faa4[_0xa29c('0x22')][_0xa29c('0x22')],[_0x4b363f,_0x7ecad6]);_0x2f3fde(_0x45fc7b);})[_0xa29c('0x14')](function(_0x3e9d44){_0x6ceeaa(_0x3e9d44);});});}function getEndUser(_0x3528ce,_0x54d42b,_0x55c508){return function(_0xc834a2){return new Promise(function(_0x5e3ec6,_0x307f6f){logger['info'](util[_0xa29c('0x23')](_0xa29c('0x24'),_0xc834a2[_0xa29c('0x25')]));searchContact(_0x55c508,_0x54d42b,_0xa29c('0x26'),_0xc834a2['contactNumber'])['then'](function(_0x5b6881){if(_0x5b6881){_0xc834a2[_0xa29c('0x27')]=_0x5b6881['id'];logger['info'](_0xa29c('0x28'),_0xc834a2[_0xa29c('0x27')]);return _0x5e3ec6(_0xc834a2);}searchContact(_0x55c508,_0x54d42b,_0xa29c('0x29'),_0xc834a2[_0xa29c('0x25')])[_0xa29c('0x20')](function(_0x2915f5){if(_0x2915f5){_0xc834a2[_0xa29c('0x27')]=_0x2915f5['id'];logger[_0xa29c('0xc')]('Contact\x20found\x20work_number:',_0xc834a2['endUserId']);return _0x5e3ec6(_0xc834a2);}createEndUser(_0xc834a2,_0x3528ce,_0x54d42b,_0x55c508)[_0xa29c('0x20')](function(_0x4b25c9){logger[_0xa29c('0xc')]('Contact\x20created:',_0x4b25c9[_0xa29c('0x27')]);return _0x5e3ec6(_0x4b25c9);});});})['catch'](function(_0x2473d8){_0x307f6f(_0x2473d8);});});};}function createEndUser(_0x3105a7,_0x17f5aa,_0x43152a,_0x525f20){return new Promise(function(_0xe3c239,_0x372847){var _0x5eb245=moment();var _0x5a7092={'method':'POST','uri':_0x525f20+'/api/contacts','body':{'contact':{'last_name':_0x3105a7[_0xa29c('0x25')],'work_number':_0x3105a7[_0xa29c('0x25')],'mobile_number':_0x3105a7[_0xa29c('0x25')],'owner_id':_0x3105a7[_0xa29c('0x2a')],'created_at':_0x5eb245[_0xa29c('0x23')](_0xa29c('0x2b'))}},'json':!![]};_0x5a7092[_0xa29c('0x18')]=_0x43152a;logger[_0xa29c('0xc')](_0xa29c('0x2c'));return rp(_0x5a7092)['then'](function(_0x12f1f0){_0x3105a7[_0xa29c('0x27')]=_0x12f1f0[_0xa29c('0x2d')]['id'];_0xe3c239(_0x3105a7);})[_0xa29c('0x14')](function(_0x1606c6){logger[_0xa29c('0x15')]('['+[_0x17f5aa[_0xa29c('0x16')]()]+']',_0x1606c6[_0xa29c('0x17')]);_0x372847(_0x1606c6[_0xa29c('0x17')]);});});}function getTicket(_0x45a005,_0xabbd8c,_0xcc601,_0xc6299f,_0x37ed48){return function(_0x58bae9){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x59e385,_0x50ab7c){var _0x2af657=moment();var _0x5040e3={'method':_0xa29c('0x2e'),'uri':_0xcc601+_0xa29c('0x2f'),'body':{'title':intUtil[_0xa29c('0x30')](_0xc6299f[_0xa29c('0x31')],_0x37ed48,'\x20'),'description':intUtil[_0xa29c('0x30')](_0xc6299f['Descriptions'],_0x37ed48,'\x0a'),'owner_id':_0x58bae9[_0xa29c('0x2a')],'creater_id':_0x58bae9['adminId'],'targetable_id':_0x58bae9[_0xa29c('0x27')],'targetable_type':_0xa29c('0x32'),'created_at':_0x2af657[_0xa29c('0x23')](_0xa29c('0x2b')),'due_date':_0x2af657['add'](0x1e,'m')[_0xa29c('0x23')](_0xa29c('0x2b'))},'json':!![]};_0x5040e3[_0xa29c('0x18')]=_0xabbd8c;return rp(_0x5040e3)[_0xa29c('0x20')](function(_0x552c9c){_0x58bae9[_0xa29c('0x33')]=_0x552c9c[_0xa29c('0x34')]['id'];logger[_0xa29c('0xc')](_0xa29c('0x35'),_0x58bae9[_0xa29c('0x33')]);_0x59e385(_0x58bae9);})[_0xa29c('0x14')](function(_0x2869d7){logger[_0xa29c('0x15')]('['+[_0x45a005[_0xa29c('0x16')]()]+']',_0x2869d7[_0xa29c('0x17')]);_0x50ab7c(_0x2869d7[_0xa29c('0x17')]);});});};}function emit(_0x12dd06,_0xac3ac9,_0xd0899a){var _0x47dc74={'uri':_0x12dd06+'/contacts/'+_0xd0899a};io['to'](util[_0xa29c('0x23')]('user:%s',_0xac3ac9))[_0xa29c('0x36')](_0xa29c('0x37'),_0x47dc74);}exports['cs']=function(_0x1f6a6c,_0x4c0d58,_0x4ff7c3,_0x60d671,_0xef6564,_0x1dbd4e,_0x49aa96,_0x2b9d4a){var _0x2df22e={};var _0x58cab7={'Authorization':_0xa29c('0x38')+_0x1dbd4e['apiKey']};_0x1dbd4e[_0xa29c('0x39')]=intUtil[_0xa29c('0x3a')](_0x1dbd4e[_0xa29c('0x39')]);_0x1dbd4e[_0xa29c('0x3b')]=intUtil['stripTrailingSlash'](_0x1dbd4e[_0xa29c('0x3b')]);var _0x15390c=_0x1dbd4e[_0xa29c('0x39')];_0x2df22e['adminEmail']=_0x1dbd4e['username'];_0x2df22e[_0xa29c('0x25')]=_0x2b9d4a[_0xa29c('0x3c')]()===_0xa29c('0x3d')?_0x4c0d58[_0xa29c('0x3e')]:_0x4c0d58[_0xa29c('0x3f')];_0x2df22e[_0xa29c('0x40')]=_0x2b9d4a==='queue'||_0x2b9d4a===_0xa29c('0x41')?_0xa29c('0x42'):_0xa29c('0x3d');if(_0x60d671){_0x2df22e[_0xa29c('0x1a')]=_0x60d671[_0xa29c('0xf')];}var _0xf31511=util[_0xa29c('0x23')](_0xa29c('0x43'),_0x1dbd4e['serverUrl'],_0x4c0d58[_0xa29c('0x44')],md5(_0x4c0d58[_0xa29c('0x44')]));if(_0xef6564&&_0xef6564[_0xa29c('0x45')]){logger[_0xa29c('0xc')]('[QUEUE]',_0xa29c('0x46'));_0x4c0d58[_0xa29c('0x47')]=_0xf31511;}else if(_0x49aa96&&_0x49aa96[_0xa29c('0x48')]&&_0x49aa96[_0xa29c('0x48')]!=='none'){logger[_0xa29c('0xc')](_0xa29c('0x49'),_0xa29c('0x46'));_0x4c0d58['recordingURL']=_0xf31511;}else{_0x4c0d58['recordingURL']='';}return getAdminId(_0x2df22e,_0x2b9d4a,_0x58cab7,_0x15390c)['then'](getUser(_0x2b9d4a,_0x58cab7,_0x15390c))[_0xa29c('0x20')](getEndUser(_0x2b9d4a,_0x58cab7,_0x15390c))[_0xa29c('0x20')](getTicket(_0x2b9d4a,_0x58cab7,_0x15390c,_0x4ff7c3,_0x4c0d58))['then'](function(_0x398a03){logger[_0xa29c('0xc')](util['format'](_0xa29c('0x4a'),_0x398a03[_0xa29c('0x33')]));if(_0x2b9d4a!=='unmanaged'){logger['info']('['+[_0x2b9d4a[_0xa29c('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x15390c,_0x60d671[_0xa29c('0x4b')],_0x398a03[_0xa29c('0x27')]);}})[_0xa29c('0x14')](function(_0xc7188){logger[_0xa29c('0x15')]('['+[_0x2b9d4a['toUpperCase']()]+_0xa29c('0x4c'),util[_0xa29c('0x4d')](_0xc7188,{'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 e9a94ec..79d263a 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 _0xad90=['freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','dynamics365'];(function(_0x274be0,_0x90ddea){var _0x4c92c4=function(_0x1f68b7){while(--_0x1f68b7){_0x274be0['push'](_0x274be0['shift']());}};_0x4c92c4(++_0x90ddea);}(_0xad90,0xab));var _0x0ad9=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xad90[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x0ad9('0x0'));var util=require(_0x0ad9('0x1'));var zendesk=require(_0x0ad9('0x2'));var salesforce=require(_0x0ad9('0x3'));var sugarcrm=require(_0x0ad9('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x0ad9('0x5'));var desk=require('./desk');var vtiger=require(_0x0ad9('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x0ad9('0x7'));var freshsales=require(_0x0ad9('0x8'));var integrations=['zendesk','salesforce',_0x0ad9('0x9'),_0x0ad9('0xa'),_0x0ad9('0xb'),_0x0ad9('0xc'),'vtiger',_0x0ad9('0xd'),_0x0ad9('0xe'),_0x0ad9('0xf')];exports['exec']=function(_0x2d5878,_0x145acf,_0x2cf912,_0x45a421,_0x225237,_0x28ab38){if(_0x2cf912){if(_[_0x0ad9('0x10')](integrations,_0x2d5878[_0x0ad9('0x11')]['toLowerCase']())){try{var _0x4f80f5=null;var _0x2a5d58='';var _0x3cf238=_0x2cf912[_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')]()];if(_0x3cf238){var _0x2700f8=_0x3cf238[_0x2d5878[_0x0ad9('0x13')]];if(_0x2700f8){var _0x16aad1=_[_0x0ad9('0x14')](_0x2700f8[_0x0ad9('0x15')],{'id':parseInt(_0x2d5878[_0x0ad9('0x16')],0xa)});if(_0x16aad1){if(_0x45a421){if(_0x225237&&_0x145acf[_0x0ad9('0x17')]){_0x2a5d58=_0x0ad9('0x17');}else if(_0x145acf['routeId']){_0x2a5d58=_0x0ad9('0x18');}else{console[_0x0ad9('0x19')](_0x0ad9('0x1a'),_0x145acf);}}else{_0x2a5d58=_0x0ad9('0x1b');}switch(_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')]()){case'zendesk':zendesk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x1c'):salesforce[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x9'):sugarcrm[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xa'):freshdesk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xb'):zoho[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xc'):desk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x1d'):vtiger[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xe'):freshsales['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;case'servicenow':servicenow['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;case _0x0ad9('0xd'):dynamics365['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;default:console[_0x0ad9('0x19')](_0x0ad9('0x1e'));}}else{_0x4f80f5=require(_0x0ad9('0x1f'))(_0x2d5878['data1']['toLowerCase']());_0x4f80f5[_0x0ad9('0x20')](_0x0ad9('0x21'),util['format'](_0x0ad9('0x22'),_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')](),_0x2d5878[_0x0ad9('0x16')]));}}else{_0x4f80f5=require(_0x0ad9('0x1f'))(_0x2d5878['data1']['toLowerCase']());_0x4f80f5[_0x0ad9('0x20')]('[EXEC]',util[_0x0ad9('0x23')](_0x0ad9('0x24'),_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')](),_0x2d5878[_0x0ad9('0x13')]));}}else{}}catch(_0x125fc1){console[_0x0ad9('0x20')](_0x125fc1);}}}}; \ No newline at end of file +var _0xde55=['./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','data2','find','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data3','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xde55,0xd6));var _0x5de5=function(_0x4678c5,_0x4381fb){_0x4678c5=_0x4678c5-0x0;var _0x438802=_0xde55[_0x4678c5];return _0x438802;};'use strict';var _=require(_0x5de5('0x0'));var util=require(_0x5de5('0x1'));var zendesk=require(_0x5de5('0x2'));var salesforce=require(_0x5de5('0x3'));var sugarcrm=require(_0x5de5('0x4'));var freshdesk=require(_0x5de5('0x5'));var zoho=require(_0x5de5('0x6'));var desk=require('./desk');var vtiger=require(_0x5de5('0x7'));var servicenow=require(_0x5de5('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5de5('0x9'));var integrations=[_0x5de5('0xa'),_0x5de5('0xb'),_0x5de5('0xc'),_0x5de5('0xd'),_0x5de5('0xe'),_0x5de5('0xf'),_0x5de5('0x10'),_0x5de5('0x11'),_0x5de5('0x12'),_0x5de5('0x13')];exports['exec']=function(_0x5c8eea,_0x5d61eb,_0x51f00f,_0x128915,_0x137b44,_0x2c6f15){if(_0x51f00f){if(_[_0x5de5('0x14')](integrations,_0x5c8eea['data1'][_0x5de5('0x15')]())){try{var _0x3c382d=null;var _0x676e36='';var _0x1b316a=_0x51f00f[_0x5c8eea['data1'][_0x5de5('0x15')]()];if(_0x1b316a){var _0xb63473=_0x1b316a[_0x5c8eea[_0x5de5('0x16')]];if(_0xb63473){var _0x58144a=_[_0x5de5('0x17')](_0xb63473['Configurations'],{'id':parseInt(_0x5c8eea['data3'],0xa)});if(_0x58144a){if(_0x128915){if(_0x137b44&&_0x5d61eb[_0x5de5('0x18')]){_0x676e36=_0x5de5('0x18');}else if(_0x5d61eb[_0x5de5('0x19')]){_0x676e36=_0x5de5('0x1a');}else{console[_0x5de5('0x1b')](_0x5de5('0x1c'),_0x5d61eb);}}else{_0x676e36=_0x5de5('0x1d');}switch(_0x5c8eea[_0x5de5('0x1e')]['toLowerCase']()){case _0x5de5('0xa'):zendesk[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0xb'):salesforce[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0xc'):sugarcrm[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0xd'):freshdesk[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0xe'):zoho[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case'desk':desk[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0x10'):vtiger[_0x676e36](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15);break;case _0x5de5('0x12'):freshsales['cs'](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15,_0x676e36);break;case'servicenow':servicenow['cs'](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15,_0x676e36);break;case _0x5de5('0x11'):dynamics365['cs'](_0x5c8eea,_0x5d61eb,_0x58144a,_0x128915,_0x137b44,_0xb63473,_0x2c6f15,_0x676e36);break;default:console[_0x5de5('0x1b')](_0x5de5('0x1f'));}}else{_0x3c382d=require(_0x5de5('0x20'))(_0x5c8eea[_0x5de5('0x1e')]['toLowerCase']());_0x3c382d[_0x5de5('0x21')](_0x5de5('0x22'),util[_0x5de5('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5c8eea[_0x5de5('0x1e')][_0x5de5('0x15')](),_0x5c8eea[_0x5de5('0x24')]));}}else{_0x3c382d=require('../../../../config/logger')(_0x5c8eea['data1'][_0x5de5('0x15')]());_0x3c382d[_0x5de5('0x21')]('[EXEC]',util[_0x5de5('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x5c8eea['data1']['toLowerCase'](),_0x5c8eea[_0x5de5('0x16')]));}}else{}}catch(_0x371872){console[_0x5de5('0x21')](_0x371872);}}}}; \ 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 38a102b..924c29d 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 _0x3419=['request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Account','first','Phone','attributes','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.','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','idField','toString','variableName','customVariable','name','Variable','toLowerCase','password','securityToken','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','catch','unmanaged','isNil','calleridnum','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x3419,0xfd));var _0x9341=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x3419[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x9341('0x0'));var rp=require(_0x9341('0x1'));var moment=require(_0x9341('0x2'));var BPromise=require('bluebird');var md5=require(_0x9341('0x3'));var jsforce=require(_0x9341('0x4'));var util=require(_0x9341('0x5'));var Redis=require(_0x9341('0x6'));var intUtil=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var logger=require('../../../../config/logger')(_0x9341('0x9'));config[_0x9341('0xa')]=_[_0x9341('0xb')](config['redis'],{'host':_0x9341('0xc'),'port':0x18eb});var io=require(_0x9341('0xd'))(new Redis(config[_0x9341('0xa')]));function emit(_0x314c1e,_0x372fbf,_0x24d9dc){io['to'](_0x314c1e)['emit'](_0x372fbf,_0x24d9dc);}function getTicket(_0x192502,_0xa37eeb,_0x477ee5,_0x247005,_0x153369,_0x14eb8c,_0x4acb43,_0x2f2e93){var _0x407997=Object[_0x9341('0xe')]({},{'OwnerId':_0xa37eeb['id'],'Subject':intUtil['getString'](_0x247005[_0x9341('0xf')],_0x153369,'\x20'),'Description':intUtil[_0x9341('0x10')](_0x247005[_0x9341('0x11')],_0x153369,'\x0a')},getCustomFields(_0x14eb8c,_0x153369));if(_0x477ee5){if(_0x247005[_0x9341('0x12')]===_0x9341('0x13')){_0x407997[_0x9341('0x14')]=moment[_0x9341('0x15')]();_0x407997[_0x9341('0x16')]=![];_0x407997[_0x9341('0x17')]=![];if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x19')||_0x477ee5[_0x9341('0x18')]===_0x9341('0x1a')){_0x407997[_0x9341('0x1b')]=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1c')){_0x407997[_0x9341('0x1d')]=_0x477ee5['id'];}}else if(_0x247005['ticketType']===_0x9341('0x1e')){if(_0x477ee5['endUserType']==='contact'){_0x407997[_0x9341('0x1f')]=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1c')){_0x407997['AccountId']=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1a')&&_0x247005['leadId']){_0x407997[_0x247005[_0x9341('0x20')]]=_0x477ee5['id'];}else{logger[_0x9341('0x21')](_0x9341('0x22'));}}}return _0x4acb43['sobject'](_0x247005[_0x9341('0x12')])[_0x9341('0x23')](_0x407997);}function getUser(_0x4a569d,_0x132acb,_0x94ca19){if(!_['isNil'](_0x132acb)&&intUtil['validateEmail'](_0x132acb)){var _0xb24185={'Email':_0x132acb};var _0x1886d2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x94ca19[_0x9341('0x24')](_0x9341('0x25'))[_0x9341('0x26')](_0xb24185,_0x1886d2)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x1027bb){if(_0x1027bb['length']){var _0x4cb102=_['find'](_0x1027bb,function(_0x4d2179){return _0x4d2179[_0x9341('0x29')]===_0x132acb;});if(_0x4cb102){logger[_0x9341('0x21')](_0x9341('0x2a'),_0x132acb);return BPromise[_0x9341('0x2b')]({'id':_0x4cb102['Id'],'name':_0x4cb102[_0x9341('0x2c')]});}}else{logger[_0x9341('0x21')](_0x9341('0x2d'),_0x132acb);return _0x94ca19[_0x9341('0x2e')]()[_0x9341('0x28')](function(_0x1ab12c){return BPromise['resolve']({'id':_0x1ab12c[_0x9341('0x2f')],'name':_0x1ab12c[_0x9341('0x30')]});});}});}else{logger[_0x9341('0x21')](_0x9341('0x2d'),_0x132acb);return _0x94ca19[_0x9341('0x2e')]()[_0x9341('0x28')](function(_0xb50147){return BPromise['resolve']({'id':_0xb50147[_0x9341('0x2f')],'name':_0xb50147[_0x9341('0x30')]});});}}function getEndUser(_0x9bfe09,_0x37ca7d,_0x521bfe,_0x2bd253,_0x1fb5d8){var _0x4fcd76={'$or':{'Phone':_0x2bd253}};var _0x314494={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x9341('0x21')](_0x9341('0x31'),_0x2bd253,_0x37ca7d[_0x9341('0x32')]);switch(_0x37ca7d['moduleSearch']){case'contact_lead':var _0x38e01b=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchContact']){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x34')]]=_0x2bd253;_[_0x9341('0x35')](_0x38e01b[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))[_0x9341('0x26')](_0x38e01b,_0x314494)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x26b2a2){if(_0x26b2a2&&_0x26b2a2[_0x9341('0x38')]){return _0x26b2a2;}else{var _0x361367=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchLead']){var _0x33bc69={};_0x33bc69[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_['merge'](_0x361367[_0x9341('0x36')],_0x33bc69);}return _0x1fb5d8[_0x9341('0x24')]('Lead')[_0x9341('0x26')](_0x361367,_0x314494);}});case _0x9341('0x3a'):var _0x35189e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x3b')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x3b')]]=_0x2bd253;_[_0x9341('0x35')](_0x35189e[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')]('Account')['find'](_0x35189e,_0x314494)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x12c6d3){if(_0x12c6d3&&_0x12c6d3[_0x9341('0x38')]){return _0x12c6d3;}else{var _0x34d77e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x34')]){var _0x2db7cb={};_0x2db7cb[_0x37ca7d[_0x9341('0x34')]]=_0x2bd253;_[_0x9341('0x35')](_0x34d77e[_0x9341('0x36')],_0x2db7cb);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))['find'](_0x34d77e,_0x314494)[_0x9341('0x28')](function(_0x1776e9){if(_0x1776e9&&_0x1776e9[_0x9341('0x38')]){return _0x1776e9;}else{var _0xcb955c=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchLead']){var _0x33d949={};_0x33d949[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_['merge'](_0xcb955c[_0x9341('0x36')],_0x33d949);}return _0x1fb5d8['sobject']('Lead')[_0x9341('0x26')](_0xcb955c,_0x314494);}});}});case _0x9341('0x19'):var _0x38e01b=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x34')]){var _0x51f822={};_0x51f822[_0x37ca7d['additionalSearchContact']]=_0x2bd253;_[_0x9341('0x35')](_0x38e01b[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))[_0x9341('0x26')](_0x38e01b,_0x314494)[_0x9341('0x27')]();case _0x9341('0x1a'):var _0x241f06=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x39')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_[_0x9341('0x35')](_0x241f06[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x3c'))['find'](_0x241f06,_0x314494);case _0x9341('0x1c'):var _0x35189e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x3b')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x3b')]]=_0x2bd253;_[_0x9341('0x35')](_0x35189e[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x3d'))[_0x9341('0x26')](_0x35189e,_0x314494);default:return null;}})[_0x9341('0x28')](function(_0x5ef280){if(_0x5ef280&&_0x5ef280[_0x9341('0x38')]){var _0x20c5d2=_[_0x9341('0x3e')](_0x5ef280);if(_0x20c5d2){return BPromise[_0x9341('0x2b')]({'id':_0x20c5d2['Id'],'name':_0x20c5d2[_0x9341('0x2c')],'phone':_0x20c5d2[_0x9341('0x3f')],'endUserType':_0x20c5d2[_0x9341('0x40')][_0x9341('0x41')]['toLowerCase']()});}}})['then'](function(_0x1ef1dd){if(_0x1ef1dd){logger['info'](_0x9341('0x42'),_0x1ef1dd[_0x9341('0x18')],_0x2bd253);return BPromise[_0x9341('0x2b')](_0x1ef1dd);}else{logger[_0x9341('0x21')](_0x9341('0x43'),_0x2bd253);var _0x478e73={'Phone':_0x2bd253};if(_0x37ca7d['moduleCreate']){if(_0x37ca7d[_0x9341('0x44')]==='contact'){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73['LastName']=_0x521bfe!==_0x9341('0x46')?_0x521bfe:util[_0x9341('0x47')]('Caller\x20-\x20%s',_0x2bd253);}else if(_0x37ca7d[_0x9341('0x44')]==='lead'){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73[_0x9341('0x48')]=_0x521bfe!==_0x9341('0x46')?_0x521bfe:util[_0x9341('0x47')](_0x9341('0x49'),_0x2bd253);_0x478e73[_0x9341('0x4a')]=_0x9341('0x4b');}else if(_0x37ca7d['moduleCreate']===_0x9341('0x1c')){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73[_0x9341('0x2c')]=_0x521bfe!==''?_0x521bfe:util[_0x9341('0x47')](_0x9341('0x49'),_0x2bd253);}else{return null;}}return _0x1fb5d8[_0x9341('0x24')](_['upperFirst'](_0x37ca7d[_0x9341('0x44')]))['create'](_0x478e73)[_0x9341('0x28')](function(_0x3e71a2){return BPromise[_0x9341('0x2b')]({'id':_0x3e71a2['id'],'endUserType':_0x37ca7d[_0x9341('0x44')]});});}});}function getCustomFields(_0x81f627,_0x3f479e){var _0x34687e={};if(_0x81f627[_0x9341('0x38')]>0x0){_[_0x9341('0x4c')](_0x81f627,function(_0x1d3f30){if(_[_0x9341('0x4d')](['string','picklist'],_0x1d3f30[_0x9341('0x41')])&&_0x1d3f30[_0x9341('0x4e')]){_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x1d3f30['content'][_0x9341('0x4f')]();}else if(_0x1d3f30[_0x9341('0x41')]==='variable'&&_0x1d3f30[_0x9341('0x50')]&&_0x1d3f30['idField']){_0x3f479e[_0x1d3f30[_0x9341('0x50')]]&&(_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x3f479e[_0x1d3f30[_0x9341('0x50')]]['toString']());}else if(_0x1d3f30[_0x9341('0x41')]===_0x9341('0x51')&&_0x1d3f30['Variable']&&_0x1d3f30['Variable'][_0x9341('0x52')]&&_0x1d3f30['idField']){_0x3f479e[_0x1d3f30[_0x9341('0x53')][_0x9341('0x52')][_0x9341('0x54')]()]&&(_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x3f479e[_0x1d3f30[_0x9341('0x53')]['name']['toLowerCase']()][_0x9341('0x4f')]());}});}return _0x34687e;}function getConnection(_0x4a5dd7){var _0x2ad8c6=_0x4a5dd7[_0x9341('0x55')]['concat'](_0x4a5dd7[_0x9341('0x56')]);var _0x3e6823=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4a5dd7['remoteUri']||_0x9341('0x57'),'clientId':_0x4a5dd7[_0x9341('0x58')],'clientSecret':_0x4a5dd7['clientSecret']}});return _0x3e6823[_0x9341('0x59')](_0x4a5dd7[_0x9341('0x5a')],_0x2ad8c6)[_0x9341('0x28')](function(){logger[_0x9341('0x21')](_0x9341('0x5b'));return _0x3e6823;});}exports[_0x9341('0x5c')]=function(_0x2a26ca,_0x311ab4,_0x26d281,_0x9dc535,_0xf206bb,_0x3029ba){var _0x11c0e1,_0x159692,_0x28c5a3,_0x3f0d37;_0x3029ba[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x3029ba[_0x9341('0x5d')]);_0x3029ba[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x3029ba[_0x9341('0x5f')]);if(_0xf206bb&&_0xf206bb[_0x9341('0x60')]){logger[_0x9341('0x21')](_0x9341('0x61'),'Recording\x20is\x20enabled!');_0x311ab4[_0x9341('0x62')]=util[_0x9341('0x47')](_0x9341('0x63'),_0x3029ba['serverUrl'],_0x311ab4['uniqueid'],md5(_0x311ab4[_0x9341('0x64')]));}else{_0x311ab4[_0x9341('0x62')]='';}return getConnection(_0x3029ba)['then'](function(_0x44dc4f){_0x3f0d37=_0x44dc4f;return getUser(_0x3029ba,_0x9dc535[_0x9341('0x65')],_0x3f0d37);})[_0x9341('0x28')](function(_0x3d4240){_0x11c0e1=_0x3d4240;return getEndUser(_0x3029ba,_0x26d281,_0x311ab4[_0x9341('0x66')],_0x311ab4['calleridnum'],_0x3f0d37);})['then'](function(_0x46613e){_0x159692=_0x46613e;return getTicket(_0x3029ba,_0x11c0e1,_0x159692,_0x26d281,_0x311ab4,_0x26d281['Fields'],_0x3f0d37,_0x9341('0x5c'));})[_0x9341('0x28')](function(_0x1d0830){_0x28c5a3=_0x1d0830;logger[_0x9341('0x21')](_0x9341('0x67'),_0x28c5a3['id']);logger[_0x9341('0x21')](_0x9341('0x68'),_0x28c5a3['id'],_0x9dc535[_0x9341('0x52')],_0x3029ba[_0x9341('0x41')]);switch(_0x3029ba[_0x9341('0x41')]){case _0x9341('0x69'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x9dc535['name']),_0x9341('0x6b'),{'recordId':_0x28c5a3['id']});break;case _0x9341('0x6c'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x9dc535['name']),_0x9341('0x6d'),{'uri':util[_0x9341('0x47')](_0x9341('0x6e'),_0x3f0d37['instanceUrl'],_0x28c5a3['id'])});break;default:logger[_0x9341('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x3c374a){logger['error'](_0x9341('0x61'),_0x3c374a);});};exports[_0x9341('0x70')]=function(_0x200497,_0x363edb,_0xa5cccf,_0x4b7c03,_0x30a9d1,_0x5ebd4a,_0x3b5240){var _0x4b846c,_0x50b27f,_0xe4fb85,_0x23ac0b;_0x5ebd4a[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x5ebd4a[_0x9341('0x5d')]);_0x5ebd4a[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x5ebd4a[_0x9341('0x5f')]);if(_0x3b5240&&_0x3b5240['recordingFormat']&&_0x3b5240[_0x9341('0x71')]!==_0x9341('0x72')){logger['info']('[OUTBOUND]',_0x9341('0x73'));_0x363edb['recordingURL']=util[_0x9341('0x47')](_0x9341('0x63'),_0x5ebd4a[_0x9341('0x5d')],_0x363edb[_0x9341('0x64')],md5(_0x363edb[_0x9341('0x64')]));}return getConnection(_0x5ebd4a)[_0x9341('0x28')](function(_0x215ebb){_0x23ac0b=_0x215ebb;return getUser(_0x5ebd4a,_0x4b7c03[_0x9341('0x65')],_0x23ac0b);})[_0x9341('0x28')](function(_0x5464b0){_0x4b846c=_0x5464b0;return getEndUser(_0x5ebd4a,_0xa5cccf,_0x363edb[_0x9341('0x74')],_0x363edb['destcalleridnum'],_0x23ac0b);})[_0x9341('0x28')](function(_0x44d2c0){_0x50b27f=_0x44d2c0;return getTicket(_0x5ebd4a,_0x4b846c,_0x50b27f,_0xa5cccf,_0x363edb,_0xa5cccf[_0x9341('0x75')],_0x23ac0b,_0x9341('0x70'));})[_0x9341('0x28')](function(_0x5f2ac5){_0xe4fb85=_0x5f2ac5;logger[_0x9341('0x21')](_0x9341('0x76'),_0xe4fb85['id']);logger[_0x9341('0x21')](_0x9341('0x77'),_0xe4fb85['id'],_0x4b7c03['name'],_0x5ebd4a[_0x9341('0x41')]);switch(_0x5ebd4a[_0x9341('0x41')]){case _0x9341('0x69'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x4b7c03[_0x9341('0x52')]),_0x9341('0x6b'),{'recordId':_0xe4fb85['id']});break;case _0x9341('0x6c'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x4b7c03[_0x9341('0x52')]),_0x9341('0x6d'),{'uri':util['format']('%s/%s/e',_0x23ac0b['instanceUrl'],_0xe4fb85['id'])});break;default:logger[_0x9341('0x6f')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x9341('0x78')](function(_0x8c2e09){logger[_0x9341('0x6f')]('[OUTBOUND]',_0x8c2e09);});};exports[_0x9341('0x79')]=function(_0x2a0ad8,_0x5b74cc,_0x1a1da7,_0x1a958c,_0x5de181,_0x1cd81d){var _0xbcf0e9,_0xd99683,_0x161c88,_0xf51064;_0x1cd81d[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x1cd81d[_0x9341('0x5d')]);_0x1cd81d[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x1cd81d[_0x9341('0x5f')]);if(_0x5de181&&_0x5de181[_0x9341('0x60')]){logger[_0x9341('0x21')]('['+_0x5b74cc['lastevent']['toUpperCase']()+']',_0x9341('0x73'));_0x5b74cc[_0x9341('0x62')]=util[_0x9341('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cd81d[_0x9341('0x5d')],_0x5b74cc['uniqueid'],md5(_0x5b74cc[_0x9341('0x64')]));}else{_0x5b74cc[_0x9341('0x62')]='';}return getConnection(_0x1cd81d)[_0x9341('0x28')](function(_0x431a15){_0xf51064=_0x431a15;if(!_[_0x9341('0x7a')](_0x1a958c)){return getUser(_0x1cd81d,_0x1a958c['name'],_0xf51064);}else{return getUser(_0x1cd81d,null,_0xf51064);}})[_0x9341('0x28')](function(_0x1ce816){_0xbcf0e9=_0x1ce816;return getEndUser(_0x1cd81d,_0x1a1da7,_0x5b74cc[_0x9341('0x66')],_0x5b74cc[_0x9341('0x7b')],_0xf51064);})['then'](function(_0x3d134c){_0xd99683=_0x3d134c;return getTicket(_0x1cd81d,_0xbcf0e9,_0xd99683,_0x1a1da7,_0x5b74cc,_0x1a1da7[_0x9341('0x75')],_0xf51064);})[_0x9341('0x28')](function(_0x53cb6b){_0x161c88=_0x53cb6b;logger[_0x9341('0x21')]('['+_0x5b74cc['lastevent'][_0x9341('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x161c88['id']);logger[_0x9341('0x21')]('['+_0x5b74cc[_0x9341('0x7d')][_0x9341('0x7c')]()+_0x9341('0x7e'),_0x1cd81d[_0x9341('0x41')]);})['catch'](function(_0x1764a8){logger[_0x9341('0x6f')]('['+_0x5b74cc[_0x9341('0x7d')][_0x9341('0x7c')]()+']',_0x1764a8);});}; \ No newline at end of file +var _0x3703=['display_name','identity','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','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','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','isNil','validateEmail','sobject','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x3703,0xcb));var _0x3370=function(_0x4605a6,_0x4ee25f){_0x4605a6=_0x4605a6-0x0;var _0x18bc7a=_0x3703[_0x4605a6];return _0x18bc7a;};'use strict';var _=require(_0x3370('0x0'));var rp=require('request-promise');var moment=require(_0x3370('0x1'));var BPromise=require('bluebird');var md5=require(_0x3370('0x2'));var jsforce=require(_0x3370('0x3'));var util=require(_0x3370('0x4'));var Redis=require('ioredis');var intUtil=require(_0x3370('0x5'));var config=require(_0x3370('0x6'));var logger=require('../../../../config/logger')('salesforce');config[_0x3370('0x7')]=_['defaults'](config[_0x3370('0x7')],{'host':_0x3370('0x8'),'port':0x18eb});var io=require(_0x3370('0x9'))(new Redis(config['redis']));function emit(_0x22f72e,_0xfe0f1e,_0x14601d){io['to'](_0x22f72e)[_0x3370('0xa')](_0xfe0f1e,_0x14601d);}function getTicket(_0x4cbe7d,_0xd881e0,_0x7afc09,_0x33ff7f,_0x3310ff,_0x50b951,_0x4a3d07,_0x322130){var _0xe3b7fa=Object[_0x3370('0xb')]({},{'OwnerId':_0xd881e0['id'],'Subject':intUtil[_0x3370('0xc')](_0x33ff7f[_0x3370('0xd')],_0x3310ff,'\x20'),'Description':intUtil[_0x3370('0xc')](_0x33ff7f[_0x3370('0xe')],_0x3310ff,'\x0a')},getCustomFields(_0x50b951,_0x3310ff));if(_0x7afc09){if(_0x33ff7f[_0x3370('0xf')]===_0x3370('0x10')){_0xe3b7fa[_0x3370('0x11')]=moment[_0x3370('0x12')]();_0xe3b7fa['IsReminderSet']=![];_0xe3b7fa[_0x3370('0x13')]=![];if(_0x7afc09[_0x3370('0x14')]===_0x3370('0x15')||_0x7afc09[_0x3370('0x14')]==='lead'){_0xe3b7fa[_0x3370('0x16')]=_0x7afc09['id'];}else if(_0x7afc09[_0x3370('0x14')]===_0x3370('0x17')){_0xe3b7fa[_0x3370('0x18')]=_0x7afc09['id'];}}else if(_0x33ff7f['ticketType']===_0x3370('0x19')){if(_0x7afc09[_0x3370('0x14')]==='contact'){_0xe3b7fa[_0x3370('0x1a')]=_0x7afc09['id'];}else if(_0x7afc09[_0x3370('0x14')]===_0x3370('0x17')){_0xe3b7fa[_0x3370('0x1b')]=_0x7afc09['id'];}else if(_0x7afc09[_0x3370('0x14')]===_0x3370('0x1c')&&_0x33ff7f[_0x3370('0x1d')]){_0xe3b7fa[_0x33ff7f[_0x3370('0x1d')]]=_0x7afc09['id'];}else{logger[_0x3370('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4a3d07['sobject'](_0x33ff7f[_0x3370('0xf')])['create'](_0xe3b7fa);}function getUser(_0x464d71,_0x427c80,_0x127c79){if(!_[_0x3370('0x1f')](_0x427c80)&&intUtil[_0x3370('0x20')](_0x427c80)){var _0x1a478e={'Email':_0x427c80};var _0x4b03d8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x127c79[_0x3370('0x21')]('User')[_0x3370('0x22')](_0x1a478e,_0x4b03d8)[_0x3370('0x23')]()[_0x3370('0x24')](function(_0x550e04){if(_0x550e04[_0x3370('0x25')]){var _0x5976c0=_[_0x3370('0x22')](_0x550e04,function(_0x285171){return _0x285171[_0x3370('0x26')]===_0x427c80;});if(_0x5976c0){logger[_0x3370('0x1e')]('Agent\x20%s\x20found.',_0x427c80);return BPromise[_0x3370('0x27')]({'id':_0x5976c0['Id'],'name':_0x5976c0[_0x3370('0x28')]});}}else{logger[_0x3370('0x1e')](_0x3370('0x29'),_0x427c80);return _0x127c79['identity']()[_0x3370('0x24')](function(_0x50e14b){return BPromise[_0x3370('0x27')]({'id':_0x50e14b[_0x3370('0x2a')],'name':_0x50e14b[_0x3370('0x2b')]});});}});}else{logger[_0x3370('0x1e')](_0x3370('0x29'),_0x427c80);return _0x127c79[_0x3370('0x2c')]()[_0x3370('0x24')](function(_0x254dc5){return BPromise[_0x3370('0x27')]({'id':_0x254dc5['user_id'],'name':_0x254dc5[_0x3370('0x2b')]});});}}function getEndUser(_0x3799d7,_0x418878,_0x53a3bc,_0x536051,_0x305cc7){var _0x1bd83c={'$or':{'Phone':_0x536051}};var _0x9a11c4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3370('0x27')]()['then'](function(){logger[_0x3370('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x536051,_0x418878[_0x3370('0x2d')]);switch(_0x418878['moduleSearch']){case _0x3370('0x2e'):var _0x1e8518=_['cloneDeep'](_0x1bd83c);if(_0x418878[_0x3370('0x2f')]){var _0x42d1a6={};_0x42d1a6[_0x418878[_0x3370('0x2f')]]=_0x536051;_[_0x3370('0x30')](_0x1e8518['$or'],_0x42d1a6);}return _0x305cc7['sobject'](_0x3370('0x31'))[_0x3370('0x22')](_0x1e8518,_0x9a11c4)[_0x3370('0x23')]()[_0x3370('0x24')](function(_0x49401a){if(_0x49401a&&_0x49401a['length']){return _0x49401a;}else{var _0x204601=_[_0x3370('0x32')](_0x1bd83c);if(_0x418878[_0x3370('0x33')]){var _0x3a1dd9={};_0x3a1dd9[_0x418878[_0x3370('0x33')]]=_0x536051;_[_0x3370('0x30')](_0x204601[_0x3370('0x34')],_0x3a1dd9);}return _0x305cc7[_0x3370('0x21')](_0x3370('0x35'))[_0x3370('0x22')](_0x204601,_0x9a11c4);}});case'account_contact_lead':var _0x58b7cf=_['cloneDeep'](_0x1bd83c);if(_0x418878[_0x3370('0x36')]){var _0x42d1a6={};_0x42d1a6[_0x418878[_0x3370('0x36')]]=_0x536051;_['merge'](_0x58b7cf[_0x3370('0x34')],_0x42d1a6);}return _0x305cc7[_0x3370('0x21')](_0x3370('0x37'))[_0x3370('0x22')](_0x58b7cf,_0x9a11c4)['execute']()['then'](function(_0x3d767d){if(_0x3d767d&&_0x3d767d[_0x3370('0x25')]){return _0x3d767d;}else{var _0x578330=_[_0x3370('0x32')](_0x1bd83c);if(_0x418878[_0x3370('0x2f')]){var _0x15f377={};_0x15f377[_0x418878[_0x3370('0x2f')]]=_0x536051;_['merge'](_0x578330['$or'],_0x15f377);}return _0x305cc7[_0x3370('0x21')]('Contact')[_0x3370('0x22')](_0x578330,_0x9a11c4)[_0x3370('0x24')](function(_0x347e8e){if(_0x347e8e&&_0x347e8e[_0x3370('0x25')]){return _0x347e8e;}else{var _0x4dcd40=_['cloneDeep'](_0x1bd83c);if(_0x418878[_0x3370('0x33')]){var _0x3d39c1={};_0x3d39c1[_0x418878[_0x3370('0x33')]]=_0x536051;_[_0x3370('0x30')](_0x4dcd40[_0x3370('0x34')],_0x3d39c1);}return _0x305cc7[_0x3370('0x21')]('Lead')[_0x3370('0x22')](_0x4dcd40,_0x9a11c4);}});}});case'contact':var _0x1e8518=_[_0x3370('0x32')](_0x1bd83c);if(_0x418878['additionalSearchContact']){var _0x42d1a6={};_0x42d1a6[_0x418878[_0x3370('0x2f')]]=_0x536051;_[_0x3370('0x30')](_0x1e8518[_0x3370('0x34')],_0x42d1a6);}return _0x305cc7[_0x3370('0x21')]('Contact')['find'](_0x1e8518,_0x9a11c4)[_0x3370('0x23')]();case _0x3370('0x1c'):var _0x5484f7=_[_0x3370('0x32')](_0x1bd83c);if(_0x418878['additionalSearchLead']){var _0x42d1a6={};_0x42d1a6[_0x418878[_0x3370('0x33')]]=_0x536051;_[_0x3370('0x30')](_0x5484f7[_0x3370('0x34')],_0x42d1a6);}return _0x305cc7[_0x3370('0x21')](_0x3370('0x35'))[_0x3370('0x22')](_0x5484f7,_0x9a11c4);case'account':var _0x58b7cf=_[_0x3370('0x32')](_0x1bd83c);if(_0x418878[_0x3370('0x36')]){var _0x42d1a6={};_0x42d1a6[_0x418878[_0x3370('0x36')]]=_0x536051;_['merge'](_0x58b7cf[_0x3370('0x34')],_0x42d1a6);}return _0x305cc7[_0x3370('0x21')](_0x3370('0x37'))[_0x3370('0x22')](_0x58b7cf,_0x9a11c4);default:return null;}})['then'](function(_0x388bea){if(_0x388bea&&_0x388bea[_0x3370('0x25')]){var _0x47e7ff=_[_0x3370('0x38')](_0x388bea);if(_0x47e7ff){return BPromise[_0x3370('0x27')]({'id':_0x47e7ff['Id'],'name':_0x47e7ff[_0x3370('0x28')],'phone':_0x47e7ff[_0x3370('0x39')],'endUserType':_0x47e7ff['attributes'][_0x3370('0x3a')]['toLowerCase']()});}}})['then'](function(_0x4da6ea){if(_0x4da6ea){logger[_0x3370('0x1e')](_0x3370('0x3b'),_0x4da6ea['endUserType'],_0x536051);return BPromise['resolve'](_0x4da6ea);}else{logger[_0x3370('0x1e')](_0x3370('0x3c'),_0x536051);var _0x1b3dc4={'Phone':_0x536051};if(_0x418878['moduleCreate']){if(_0x418878[_0x3370('0x3d')]===_0x3370('0x15')){logger[_0x3370('0x1e')](_0x3370('0x3e'),_0x536051,_0x418878[_0x3370('0x3d')]);_0x1b3dc4[_0x3370('0x3f')]=_0x53a3bc!==_0x3370('0x40')?_0x53a3bc:util[_0x3370('0x41')]('Caller\x20-\x20%s',_0x536051);}else if(_0x418878[_0x3370('0x3d')]===_0x3370('0x1c')){logger[_0x3370('0x1e')](_0x3370('0x3e'),_0x536051,_0x418878[_0x3370('0x3d')]);_0x1b3dc4[_0x3370('0x3f')]=_0x53a3bc!==_0x3370('0x40')?_0x53a3bc:util[_0x3370('0x41')]('Caller\x20-\x20%s',_0x536051);_0x1b3dc4['Company']=_0x3370('0x42');}else if(_0x418878[_0x3370('0x3d')]===_0x3370('0x17')){logger[_0x3370('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x536051,_0x418878[_0x3370('0x3d')]);_0x1b3dc4[_0x3370('0x28')]=_0x53a3bc!==_0x3370('0x40')?_0x53a3bc:util[_0x3370('0x41')](_0x3370('0x43'),_0x536051);}else{return null;}}return _0x305cc7[_0x3370('0x21')](_[_0x3370('0x44')](_0x418878[_0x3370('0x3d')]))['create'](_0x1b3dc4)['then'](function(_0x5ba125){return BPromise[_0x3370('0x27')]({'id':_0x5ba125['id'],'endUserType':_0x418878['moduleCreate']});});}});}function getCustomFields(_0xaa59e8,_0x249b61){var _0xdbce09={};if(_0xaa59e8['length']>0x0){_[_0x3370('0x45')](_0xaa59e8,function(_0x5efd92){if(_[_0x3370('0x46')]([_0x3370('0x47'),_0x3370('0x48')],_0x5efd92[_0x3370('0x3a')])&&_0x5efd92[_0x3370('0x49')]){_0xdbce09[_0x5efd92['idField']]=_0x5efd92[_0x3370('0x4a')][_0x3370('0x4b')]();}else if(_0x5efd92[_0x3370('0x3a')]===_0x3370('0x4c')&&_0x5efd92['variableName']&&_0x5efd92[_0x3370('0x49')]){_0x249b61[_0x5efd92[_0x3370('0x4d')]]&&(_0xdbce09[_0x5efd92[_0x3370('0x49')]]=_0x249b61[_0x5efd92[_0x3370('0x4d')]]['toString']());}else if(_0x5efd92[_0x3370('0x3a')]==='customVariable'&&_0x5efd92[_0x3370('0x4e')]&&_0x5efd92['Variable'][_0x3370('0x4f')]&&_0x5efd92[_0x3370('0x49')]){_0x249b61[_0x5efd92[_0x3370('0x4e')][_0x3370('0x4f')][_0x3370('0x50')]()]&&(_0xdbce09[_0x5efd92['idField']]=_0x249b61[_0x5efd92[_0x3370('0x4e')]['name'][_0x3370('0x50')]()][_0x3370('0x4b')]());}});}return _0xdbce09;}function getConnection(_0x4132ed){var _0x4d1b10=_0x4132ed[_0x3370('0x51')][_0x3370('0x52')](_0x4132ed[_0x3370('0x53')]);var _0x52b64e=new jsforce[(_0x3370('0x54'))]({'oauth2':{'loginUrl':_0x4132ed[_0x3370('0x55')]||'https://login.salesforce.com','clientId':_0x4132ed['clientId'],'clientSecret':_0x4132ed['clientSecret']}});return _0x52b64e['login'](_0x4132ed[_0x3370('0x56')],_0x4d1b10)[_0x3370('0x24')](function(){logger[_0x3370('0x1e')](_0x3370('0x57'));return _0x52b64e;});}exports[_0x3370('0x58')]=function(_0x34e2ad,_0x2592ed,_0x2f23db,_0x528fe6,_0x2c4f44,_0x4b66ea){var _0x32de0e,_0x1b60b5,_0x5396f5,_0x331a24;_0x4b66ea[_0x3370('0x59')]=intUtil[_0x3370('0x5a')](_0x4b66ea[_0x3370('0x59')]);_0x4b66ea[_0x3370('0x55')]=intUtil[_0x3370('0x5a')](_0x4b66ea[_0x3370('0x55')]);if(_0x2c4f44&&_0x2c4f44[_0x3370('0x5b')]){logger[_0x3370('0x1e')](_0x3370('0x5c'),_0x3370('0x5d'));_0x2592ed[_0x3370('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b66ea[_0x3370('0x59')],_0x2592ed[_0x3370('0x5f')],md5(_0x2592ed['uniqueid']));}else{_0x2592ed[_0x3370('0x5e')]='';}return getConnection(_0x4b66ea)[_0x3370('0x24')](function(_0x13e6fa){_0x331a24=_0x13e6fa;return getUser(_0x4b66ea,_0x528fe6[_0x3370('0x60')],_0x331a24);})[_0x3370('0x24')](function(_0x3e1120){_0x32de0e=_0x3e1120;return getEndUser(_0x4b66ea,_0x2f23db,_0x2592ed[_0x3370('0x61')],_0x2592ed[_0x3370('0x62')],_0x331a24);})[_0x3370('0x24')](function(_0x2c141e){_0x1b60b5=_0x2c141e;return getTicket(_0x4b66ea,_0x32de0e,_0x1b60b5,_0x2f23db,_0x2592ed,_0x2f23db[_0x3370('0x63')],_0x331a24,_0x3370('0x58'));})['then'](function(_0x385076){_0x5396f5=_0x385076;logger[_0x3370('0x1e')](_0x3370('0x64'),_0x5396f5['id']);logger['info'](_0x3370('0x65'),_0x5396f5['id'],_0x528fe6[_0x3370('0x4f')],_0x4b66ea[_0x3370('0x3a')]);switch(_0x4b66ea[_0x3370('0x3a')]){case _0x3370('0x66'):emit(util[_0x3370('0x41')](_0x3370('0x67'),_0x528fe6[_0x3370('0x4f')]),_0x3370('0x68'),{'recordId':_0x5396f5['id']});break;case _0x3370('0x69'):emit(util['format'](_0x3370('0x67'),_0x528fe6[_0x3370('0x4f')]),_0x3370('0x6a'),{'uri':util[_0x3370('0x41')](_0x3370('0x6b'),_0x331a24[_0x3370('0x6c')],_0x5396f5['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x68c886){logger[_0x3370('0x6d')](_0x3370('0x5c'),_0x68c886);});};exports[_0x3370('0x6e')]=function(_0x1b448d,_0x4126ab,_0x4f8c43,_0x495811,_0x1ecb5f,_0xe74256,_0x220f5b){var _0x334943,_0x44832d,_0x5c68fc,_0x3f03d5;_0xe74256[_0x3370('0x59')]=intUtil[_0x3370('0x5a')](_0xe74256[_0x3370('0x59')]);_0xe74256[_0x3370('0x55')]=intUtil['stripTrailingSlash'](_0xe74256['remoteUri']);if(_0x220f5b&&_0x220f5b[_0x3370('0x6f')]&&_0x220f5b['recordingFormat']!==_0x3370('0x70')){logger[_0x3370('0x1e')](_0x3370('0x71'),_0x3370('0x5d'));_0x4126ab[_0x3370('0x5e')]=util['format'](_0x3370('0x72'),_0xe74256[_0x3370('0x59')],_0x4126ab[_0x3370('0x5f')],md5(_0x4126ab[_0x3370('0x5f')]));}return getConnection(_0xe74256)['then'](function(_0x5dd889){_0x3f03d5=_0x5dd889;return getUser(_0xe74256,_0x495811[_0x3370('0x60')],_0x3f03d5);})[_0x3370('0x24')](function(_0x2bbb06){_0x334943=_0x2bbb06;return getEndUser(_0xe74256,_0x4f8c43,_0x4126ab[_0x3370('0x73')],_0x4126ab[_0x3370('0x74')],_0x3f03d5);})[_0x3370('0x24')](function(_0x1e943d){_0x44832d=_0x1e943d;return getTicket(_0xe74256,_0x334943,_0x44832d,_0x4f8c43,_0x4126ab,_0x4f8c43[_0x3370('0x63')],_0x3f03d5,_0x3370('0x6e'));})[_0x3370('0x24')](function(_0x47f752){_0x5c68fc=_0x47f752;logger[_0x3370('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5c68fc['id']);logger[_0x3370('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5c68fc['id'],_0x495811['name'],_0xe74256['type']);switch(_0xe74256[_0x3370('0x3a')]){case _0x3370('0x66'):emit(util[_0x3370('0x41')](_0x3370('0x67'),_0x495811[_0x3370('0x4f')]),_0x3370('0x68'),{'recordId':_0x5c68fc['id']});break;case _0x3370('0x69'):emit(util[_0x3370('0x41')](_0x3370('0x67'),_0x495811[_0x3370('0x4f')]),'trigger:browser:url',{'uri':util[_0x3370('0x41')](_0x3370('0x6b'),_0x3f03d5['instanceUrl'],_0x5c68fc['id'])});break;default:logger[_0x3370('0x6d')](_0x3370('0x71'),_0x3370('0x75'));}})[_0x3370('0x76')](function(_0x283025){logger[_0x3370('0x6d')](_0x3370('0x71'),_0x283025);});};exports['unmanaged']=function(_0x31320a,_0x455bc3,_0x3ae890,_0x5c1215,_0x51152c,_0x299017){var _0x190e4d,_0x141b30,_0x41623a,_0x641ae1;_0x299017[_0x3370('0x59')]=intUtil[_0x3370('0x5a')](_0x299017[_0x3370('0x59')]);_0x299017[_0x3370('0x55')]=intUtil[_0x3370('0x5a')](_0x299017['remoteUri']);if(_0x51152c&&_0x51152c['monitor_format']){logger[_0x3370('0x1e')]('['+_0x455bc3['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x455bc3[_0x3370('0x5e')]=util['format'](_0x3370('0x72'),_0x299017['serverUrl'],_0x455bc3['uniqueid'],md5(_0x455bc3[_0x3370('0x5f')]));}else{_0x455bc3['recordingURL']='';}return getConnection(_0x299017)[_0x3370('0x24')](function(_0x328a33){_0x641ae1=_0x328a33;if(!_[_0x3370('0x1f')](_0x5c1215)){return getUser(_0x299017,_0x5c1215['name'],_0x641ae1);}else{return getUser(_0x299017,null,_0x641ae1);}})[_0x3370('0x24')](function(_0x148061){_0x190e4d=_0x148061;return getEndUser(_0x299017,_0x3ae890,_0x455bc3[_0x3370('0x61')],_0x455bc3[_0x3370('0x62')],_0x641ae1);})[_0x3370('0x24')](function(_0x4995d6){_0x141b30=_0x4995d6;return getTicket(_0x299017,_0x190e4d,_0x141b30,_0x3ae890,_0x455bc3,_0x3ae890[_0x3370('0x63')],_0x641ae1);})[_0x3370('0x24')](function(_0x276a43){_0x41623a=_0x276a43;logger[_0x3370('0x1e')]('['+_0x455bc3[_0x3370('0x77')][_0x3370('0x78')]()+_0x3370('0x79'),_0x41623a['id']);logger[_0x3370('0x1e')]('['+_0x455bc3['lastevent'][_0x3370('0x78')]()+_0x3370('0x7a'),_0x299017[_0x3370('0x3a')]);})[_0x3370('0x76')](function(_0xe2617e){logger[_0x3370('0x6d')]('['+_0x455bc3[_0x3370('0x77')][_0x3370('0x78')]()+']',_0xe2617e);});}; \ 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 d921c97..c366854 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 _0x2820=['username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','includes','picklist','type','nameField','toLowerCase','toString','idField','content','variable','variableName','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x2820,0x1c4));var _0x0282=function(_0x51da50,_0x2dacc8){_0x51da50=_0x51da50-0x0;var _0x117660=_0x2820[_0x51da50];return _0x117660;};'use strict';var _=require(_0x0282('0x0'));var Promise=require('bluebird');var rp=require(_0x0282('0x1'));var util=require(_0x0282('0x2'));var md5=require(_0x0282('0x3'));var Redis=require(_0x0282('0x4'));var intUtil=require('./util');var config=require(_0x0282('0x5'));var logger=require(_0x0282('0x6'))(_0x0282('0x7'));config[_0x0282('0x8')]=_[_0x0282('0x9')](config[_0x0282('0x8')],{'host':_0x0282('0xa'),'port':0x18eb});var io=require(_0x0282('0xb'))(new Redis(config[_0x0282('0x8')]));function getAdminUser(_0x117ea6,_0x1b3737,_0x417707,_0x5c5723,_0x47199d,_0x3decbd){return new Promise(function(_0x23dd9b,_0x4a749e){var _0x47ffb4={'method':_0x0282('0xc'),'uri':_0x5c5723+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x47199d+'&'+_0x3decbd,'auth':_0x1b3737,'json':!![]};return rp(_0x47ffb4)['then'](function(_0x347b75){if(_0x347b75[_0x0282('0xd')][_0x0282('0xe')]>0x0){_0x417707[_0x0282('0xf')]=_0x347b75[_0x0282('0xd')][0x0][_0x0282('0x10')];}logger['info']('['+[_0x117ea6['toUpperCase']()]+_0x0282('0x11'),_0x417707);_0x23dd9b(_0x417707);})[_0x0282('0x12')](function(_0x4f2927){logger[_0x0282('0x13')]('['+[_0x117ea6[_0x0282('0x14')]()]+']',_0x4f2927[_0x0282('0x15')]);_0x4a749e(_0x4f2927['message']);});});}function getUser(_0x51089f,_0x47d0a7,_0xca9ef5,_0xe12a99,_0x399634){return function(_0x3e15a8){logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x3e15a8);return new Promise(function(_0xf309e7,_0x364f9e){if(intUtil['validateEmail'](_0x3e15a8[_0x0282('0x17')])){var _0x69c71a={'method':_0x0282('0xc'),'uri':_0xca9ef5+_0x0282('0x18')+_0x3e15a8[_0x0282('0x17')]+'&'+_0xe12a99+'&'+_0x399634,'auth':_0x47d0a7,'json':!![]};logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x19'),_0x69c71a);return rp(_0x69c71a)[_0x0282('0x1a')](function(_0x5a302d){logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1b'),_0x5a302d);if(_0x5a302d[_0x0282('0xd')][_0x0282('0xe')]>0x0&&String(_0x5a302d[_0x0282('0xd')][0x0]['active'])===_0x0282('0x1c')){_0x3e15a8[_0x0282('0x1d')]=_0x5a302d[_0x0282('0xd')][0x0][_0x0282('0x10')];}else{_0x3e15a8[_0x0282('0x1d')]=_0x3e15a8[_0x0282('0xf')];_0x3e15a8[_0x0282('0x17')]=_0x3e15a8['adminEmail'];}logger['info']('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1e'),_0x3e15a8);_0xf309e7(_0x3e15a8);})[_0x0282('0x12')](function(_0x81ce27){logger[_0x0282('0x13')]('['+[_0x51089f[_0x0282('0x14')]()]+']',_0x81ce27['message']);_0x364f9e(_0x81ce27['message']);});}else{logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1f'));_0x3e15a8[_0x0282('0x1d')]=_0x3e15a8[_0x0282('0xf')];_0x3e15a8[_0x0282('0x17')]=_0x3e15a8[_0x0282('0x20')];_0xf309e7(_0x3e15a8);}});};}function createEndUser(_0x25d26f,_0x482ee0,_0x45c1fb,_0x4e13ae,_0x2bc5e0){logger[_0x0282('0x16')]('['+[_0x25d26f[_0x0282('0x14')]()]+_0x0282('0x21'),_0x45c1fb);return new Promise(function(_0x348cbe,_0x2dbb70){var _0xbd21d7={'method':'POST','uri':_0x4e13ae+_0x0282('0x22')+_0x2bc5e0,'body':{'user_name':_0x45c1fb[_0x0282('0x23')],'roles':'user','first_name':_0x45c1fb['endUserNumber'],'active':_0x0282('0x1c'),'date_format':_0x0282('0x24'),'phone':_0x45c1fb['endUserNumber']},'auth':_0x482ee0,'json':!![]};return rp(_0xbd21d7)[_0x0282('0x1a')](function(_0x9171bb){logger['info']('['+[_0x25d26f[_0x0282('0x14')]()]+_0x0282('0x25'),_0x9171bb['result']);_0x45c1fb['endUserId']=_0x9171bb[_0x0282('0xd')][_0x0282('0x10')];_0x348cbe(_0x45c1fb);})[_0x0282('0x12')](function(_0x56d625){logger[_0x0282('0x13')]('['+[_0x25d26f[_0x0282('0x14')]()]+']',_0x56d625[_0x0282('0x15')]);_0x2dbb70(_0x56d625[_0x0282('0x15')]);});});}function getEndUser(_0x5d398e,_0x305153,_0x12469c,_0x3e9463,_0x2edc95){return function(_0x32771){logger['info']('['+[_0x5d398e[_0x0282('0x14')]()]+_0x0282('0x26'),_0x32771);return new Promise(function(_0xb405ea,_0x44f024){var _0x516de5={'method':'GET','uri':_0x12469c+_0x0282('0x27')+_0x32771[_0x0282('0x23')]+'&'+_0x3e9463+'&'+_0x2edc95,'auth':_0x305153,'json':!![]};return rp(_0x516de5)[_0x0282('0x1a')](function(_0x46afd8){if(_0x46afd8[_0x0282('0xd')][_0x0282('0xe')]>0x0){_0x32771[_0x0282('0x28')]=_0x46afd8['result'][0x0][_0x0282('0x10')];logger[_0x0282('0x16')]('['+[_0x5d398e[_0x0282('0x14')]()]+'],\x20getEndUser\x20crm',_0x32771);_0xb405ea(_0x32771);}else{return createEndUser(_0x5d398e,_0x305153,_0x32771,_0x12469c,_0x3e9463)[_0x0282('0x1a')](function(_0x239a0d){logger['info']('['+[_0x5d398e[_0x0282('0x14')]()]+_0x0282('0x29'),_0x239a0d);_0xb405ea(_0x239a0d);});}})[_0x0282('0x12')](function(_0x21275f){logger[_0x0282('0x13')]('['+[_0x5d398e[_0x0282('0x14')]()]+']',_0x21275f[_0x0282('0x15')]);_0x44f024(_0x21275f[_0x0282('0x15')]);});});};}function getCustomFields(_0x5e4af9,_0x3d1b6e){var _0x333f41={};if(_0x5e4af9[_0x0282('0xe')]>0x0){_['forEach'](_0x5e4af9,function(_0x2626e3){if(_[_0x0282('0x2a')](['string',_0x0282('0x2b')],_0x2626e3[_0x0282('0x2c')])&&_0x2626e3[_0x0282('0x2d')]&&!_0x2626e3['customField']){_0x333f41[_0x2626e3[_0x0282('0x2d')][_0x0282('0x2e')]()]=_0x2626e3['content'][_0x0282('0x2f')]();}else if(_[_0x0282('0x2a')](['string','picklist'],_0x2626e3[_0x0282('0x2c')])&&_0x2626e3[_0x0282('0x30')]&&_0x2626e3['customField']){_0x333f41[_0x2626e3[_0x0282('0x30')][_0x0282('0x2e')]()]=_0x2626e3[_0x0282('0x31')][_0x0282('0x2f')]();}else if(_0x2626e3['type']===_0x0282('0x32')&&_0x2626e3[_0x0282('0x33')]&&_0x2626e3['idField']&&_0x2626e3[_0x0282('0x34')]){_0x333f41[_0x2626e3['idField'][_0x0282('0x2e')]()]=_0x3d1b6e[_0x2626e3['variableName']][_0x0282('0x2f')]();}else if(_0x2626e3['type']===_0x0282('0x35')&&_0x2626e3[_0x0282('0x36')]&&_0x2626e3[_0x0282('0x36')][_0x0282('0x37')]&&_0x2626e3[_0x0282('0x30')]&&_0x2626e3[_0x0282('0x34')]){_0x333f41[_0x2626e3['idField']['toLowerCase']()]=_0x3d1b6e[_0x2626e3[_0x0282('0x36')][_0x0282('0x37')][_0x0282('0x2e')]()][_0x0282('0x2f')]();}});}return _0x333f41;}function getTicket(_0x16f2d9,_0x1ae84e,_0x31b845,_0x5e2837,_0x42ca88,_0x17da5a){return function(_0x35da57){logger[_0x0282('0x16')]('['+[_0x16f2d9['toUpperCase']()]+_0x0282('0x38'),_0x35da57);return new Promise(function(_0x1587e7,_0x4e1d94){var _0xa18a1d=_0x16f2d9[_0x0282('0x2e')]()===_0x0282('0x39')?_0x35da57['userId']:_0x35da57[_0x0282('0x28')];var _0x1203f2={'method':_0x0282('0x3a'),'uri':_0x31b845+'incident'+'?'+_0x17da5a,'body':Object[_0x0282('0x3b')]({},{'active':_0x0282('0x1c'),'caller_id':_0xa18a1d,'assigned_to':_0x35da57[_0x0282('0x1d')],'short_description':intUtil[_0x0282('0x3c')](_0x5e2837[_0x0282('0x3d')],_0x42ca88,'\x20'),'description':intUtil[_0x0282('0x3c')](_0x5e2837[_0x0282('0x3e')],_0x42ca88,'\x0a')},getCustomFields(_0x5e2837['Fields'],_0x42ca88)),'auth':_0x1ae84e,'json':!![]};return rp(_0x1203f2)[_0x0282('0x1a')](function(_0x1fafe1){logger[_0x0282('0x16')]('['+[_0x16f2d9[_0x0282('0x14')]()]+_0x0282('0x3f'),_0x1fafe1['result']);_0x35da57[_0x0282('0x40')]=_0x1fafe1[_0x0282('0xd')][_0x0282('0x10')];_0x35da57[_0x0282('0x41')]=_0x1fafe1[_0x0282('0xd')]['number'];logger['info']('['+[_0x16f2d9[_0x0282('0x14')]()]+_0x0282('0x42'),_0x35da57);_0x1587e7(_0x35da57);})[_0x0282('0x12')](function(_0x20a24a){logger[_0x0282('0x13')]('['+[_0x16f2d9[_0x0282('0x14')]()]+']',_0x20a24a[_0x0282('0x15')]);_0x4e1d94(_0x20a24a[_0x0282('0x15')]);});});};}function createRemoteTag(_0x295135,_0x4ebd46,_0x460011,_0x3b4a3a){return new Promise(function(_0x3293a4,_0x574b66){var _0x1b8e9f={'method':_0x0282('0x3a'),'uri':_0x460011+_0x0282('0x43')+'?'+_0x3b4a3a,'body':{'short_description':_0x295135,'global':!![],'active':!![],'name':_0x295135},'auth':_0x4ebd46,'json':!![]};return rp(_0x1b8e9f)[_0x0282('0x1a')](function(_0x583ecb){var _0x3f3719=_0x583ecb[_0x0282('0xd')][_0x0282('0x10')];_0x3293a4(_0x3f3719);});});}function getRemoteTag(_0x2f6459,_0xaf5a0c,_0x15d10b,_0x378142,_0x48a76c){return new Promise(function(_0x2a022a,_0x1ee757){var _0x352a03={'method':_0x0282('0xc'),'uri':_0x15d10b+'label'+_0x0282('0x44')+_0x2f6459+'&'+_0x378142,'auth':_0xaf5a0c,'json':!![]};return rp(_0x352a03)[_0x0282('0x1a')](function(_0x5db0d8){if(_0x5db0d8['result'][_0x0282('0xe')]>0x0){var _0x5d461d=_0x5db0d8[_0x0282('0xd')][0x0][_0x0282('0x10')];_0x2a022a(_0x5d461d);}else{return createRemoteTag(_0x2f6459,_0xaf5a0c,_0x15d10b,_0x378142)['then'](function(_0x535082){_0x2a022a(_0x535082);});}});});}function assignTagToIncident(_0x22d22f,_0x4fe5bc,_0x3e7545,_0x3f50ef,_0x2f1700){return new Promise(function(_0x2566a8,_0x745829){var _0x34745e={'method':_0x0282('0x3a'),'uri':_0x3e7545+_0x0282('0x45')+'?'+_0x2f1700,'body':{'label':_0x22d22f,'table':_0x0282('0x46'),'id_type':_0x0282('0x47'),'table_key':_0x3f50ef['ticketId'],'title':'Incident\x20-\x20'+_0x3f50ef[_0x0282('0x41')],'id_display':_0x3f50ef['ticketNumber']},'auth':_0x4fe5bc,'json':!![]};return rp(_0x34745e)[_0x0282('0x1a')](function(_0x3973a9){_0x2566a8();})[_0x0282('0x12')](function(){_0x2566a8();});});}function manageTags(_0x1b2158,_0x148451,_0x174e4e,_0x2d2125,_0x31e233,_0x3684cf,_0x384556){return new Promise(function(_0x5a39f1,_0x3edac1){var _0x25036a=[];_0x148451[_0x0282('0x48')](function(_0xf98b8b){_0x25036a[_0x0282('0x49')](getRemoteTag(_0xf98b8b,_0x174e4e,_0x2d2125,_0x3684cf,_0x384556));});return Promise[_0x0282('0x4a')](_0x25036a)[_0x0282('0x1a')](function(_0x1c4b59){if(_0x1c4b59[_0x0282('0xe')]){logger['info']('['+[_0x1b2158[_0x0282('0x14')]()]+_0x0282('0x4b'),_0x1c4b59);var _0x497924=[];_0x1c4b59['forEach'](function(_0x4d2a35){_0x497924[_0x0282('0x49')](assignTagToIncident(_0x4d2a35,_0x174e4e,_0x2d2125,_0x31e233,_0x3684cf));});return Promise[_0x0282('0x4a')](_0x497924)[_0x0282('0x1a')](function(){_0x5a39f1();})[_0x0282('0x12')](function(){_0x5a39f1();});}else{_0x5a39f1();}});});}function getTags(_0x444f75,_0xe1f508,_0x5866e1,_0x40b408,_0x58d2c7,_0x87f5b2){return function(_0x58c611){return new Promise(function(_0x7d4257,_0x117d19){var _0xd5604=[];var _0x4b5254=_0x40b408['Tags'];if(_0x4b5254&&_0x4b5254[_0x0282('0xe')]>0x0){_0xd5604=_[_0x0282('0x4c')](_0x4b5254,_0x0282('0x37'));}if(_0xd5604[_0x0282('0xe')]>0x0){return manageTags(_0x444f75,_0xd5604,_0xe1f508,_0x5866e1,_0x58c611,_0x58d2c7,_0x87f5b2)[_0x0282('0x1a')](function(){_0x7d4257(_0x58c611);});}else{_0x7d4257(_0x58c611);}});};}function emit(_0xc515eb,_0x159fc7,_0x5a64fa){var _0x5aa798='%26sysparm_record_target%3Dincident'+_0x0282('0x4d')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x0282('0x4e');var _0x519e9d={'uri':_0xc515eb+_0x0282('0x4f')+_0x5a64fa+_0x5aa798};io['to'](util[_0x0282('0x50')](_0x0282('0x51'),_0x159fc7))['emit'](_0x0282('0x52'),_0x519e9d);}exports['cs']=function(_0x5ef81b,_0x3f6268,_0x1b160c,_0x3f65fa,_0x2e599d,_0x49d946,_0xc66efd,_0x12b60a){var _0x2e1177={};var _0x54028b={'user':_0x49d946[_0x0282('0x53')],'pass':_0x49d946[_0x0282('0x54')]};var _0x4ecfff='sysparm_limit=1';var _0x5a7ede=_0x0282('0x55');_0x49d946[_0x0282('0x56')]=intUtil[_0x0282('0x57')](_0x49d946[_0x0282('0x56')]);_0x49d946[_0x0282('0x58')]=intUtil[_0x0282('0x57')](_0x49d946['serverUrl']);var _0x4a2647=util[_0x0282('0x50')](_0x0282('0x59'),_0x49d946['remoteUri']);_0x2e1177[_0x0282('0x17')]=!_['isNil'](_0x3f65fa)?_0x3f65fa[_0x0282('0x5a')]:null;_0x2e1177[_0x0282('0x20')]=_0x49d946[_0x0282('0x5a')];_0x2e1177[_0x0282('0x23')]=_0x12b60a['toLowerCase']()===_0x0282('0x39')?_0x3f6268[_0x0282('0x5b')]:_0x3f6268[_0x0282('0x5c')];_0x2e1177[_0x0282('0x5d')]=_0x12b60a===_0x0282('0x5e')||_0x12b60a===_0x0282('0x5f')?_0x0282('0x5e'):'outbound';var _0x1de037=util[_0x0282('0x50')](_0x0282('0x60'),_0x49d946[_0x0282('0x58')],_0x3f6268[_0x0282('0x61')],md5(_0x3f6268[_0x0282('0x61')]));if(_0x2e599d&&_0x2e599d[_0x0282('0x62')]){logger['info']('[QUEUE]',_0x0282('0x63'));_0x3f6268['recordingURL']=_0x1de037;}else if(_0xc66efd&&_0xc66efd[_0x0282('0x64')]&&_0xc66efd[_0x0282('0x64')]!==_0x0282('0x65')){logger[_0x0282('0x16')](_0x0282('0x66'),_0x0282('0x63'));_0x3f6268[_0x0282('0x67')]=_0x1de037;}else{_0x3f6268[_0x0282('0x67')]='';}return getAdminUser(_0x12b60a,_0x54028b,_0x2e1177,_0x4a2647,_0x5a7ede,_0x4ecfff)[_0x0282('0x1a')](getUser(_0x12b60a,_0x54028b,_0x4a2647,_0x5a7ede,_0x4ecfff))[_0x0282('0x1a')](getEndUser(_0x12b60a,_0x54028b,_0x4a2647,_0x5a7ede,_0x4ecfff))[_0x0282('0x1a')](getTicket(_0x12b60a,_0x54028b,_0x4a2647,_0x1b160c,_0x3f6268,_0x5a7ede))[_0x0282('0x1a')](function(_0x1d0418){logger[_0x0282('0x16')](util[_0x0282('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1d0418[_0x0282('0x40')]));logger[_0x0282('0x16')](util[_0x0282('0x50')](_0x0282('0x68'),_0x12b60a));if(_0x12b60a!==_0x0282('0x5f')){logger[_0x0282('0x16')]('['+[_0x12b60a[_0x0282('0x14')]()]+']',_0x0282('0x69'));emit(_0x49d946[_0x0282('0x56')],_0x3f65fa[_0x0282('0x37')],_0x1d0418[_0x0282('0x40')]);}})['catch'](function(_0x4c38fb){logger['error']('['+[_0x12b60a[_0x0282('0x14')]()]+_0x0282('0x6a'),util['inspect'](_0x4c38fb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x77c3=['format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','userId','adminEmail',']\x20using\x20admin\x20profile','POST','endUserNumber','true','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags'];(function(_0x54b7d1,_0x51504c){var _0x38ad9b=function(_0xc41503){while(--_0xc41503){_0x54b7d1['push'](_0x54b7d1['shift']());}};_0x38ad9b(++_0x51504c);}(_0x77c3,0x1b7));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x377c('0x0'));var Promise=require(_0x377c('0x1'));var rp=require(_0x377c('0x2'));var util=require(_0x377c('0x3'));var md5=require(_0x377c('0x4'));var Redis=require(_0x377c('0x5'));var intUtil=require(_0x377c('0x6'));var config=require(_0x377c('0x7'));var logger=require(_0x377c('0x8'))(_0x377c('0x9'));config[_0x377c('0xa')]=_[_0x377c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x377c('0xc'))(new Redis(config[_0x377c('0xa')]));function getAdminUser(_0x28f528,_0x2d04ee,_0x51ba04,_0x1115aa,_0x1fa774,_0x4c5621){return new Promise(function(_0xc0808e,_0x4cada1){var _0x508c18={'method':_0x377c('0xd'),'uri':_0x1115aa+_0x377c('0xe')+'&'+_0x1fa774+'&'+_0x4c5621,'auth':_0x2d04ee,'json':!![]};return rp(_0x508c18)[_0x377c('0xf')](function(_0xf33c4d){if(_0xf33c4d[_0x377c('0x10')]['length']>0x0){_0x51ba04[_0x377c('0x11')]=_0xf33c4d[_0x377c('0x10')][0x0][_0x377c('0x12')];}logger['info']('['+[_0x28f528[_0x377c('0x13')]()]+_0x377c('0x14'),_0x51ba04);_0xc0808e(_0x51ba04);})[_0x377c('0x15')](function(_0xeb0bb1){logger[_0x377c('0x16')]('['+[_0x28f528['toUpperCase']()]+']',_0xeb0bb1[_0x377c('0x17')]);_0x4cada1(_0xeb0bb1['message']);});});}function getUser(_0x266825,_0xdc3111,_0xccd501,_0x296e45,_0x39667d){return function(_0x1ce71f){logger[_0x377c('0x18')]('['+[_0x266825['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x1ce71f);return new Promise(function(_0xb0b9f2,_0x11c59e){if(intUtil[_0x377c('0x19')](_0x1ce71f[_0x377c('0x1a')])){var _0x54245d={'method':_0x377c('0xd'),'uri':_0xccd501+_0x377c('0x1b')+_0x1ce71f[_0x377c('0x1a')]+'&'+_0x296e45+'&'+_0x39667d,'auth':_0xdc3111,'json':!![]};logger[_0x377c('0x18')]('['+[_0x266825[_0x377c('0x13')]()]+_0x377c('0x1c'),_0x54245d);return rp(_0x54245d)[_0x377c('0xf')](function(_0x3453c2){logger[_0x377c('0x18')]('['+[_0x266825[_0x377c('0x13')]()]+'],\x20getUser\x20entity',_0x3453c2);if(_0x3453c2[_0x377c('0x10')][_0x377c('0x1d')]>0x0&&String(_0x3453c2[_0x377c('0x10')][0x0][_0x377c('0x1e')])==='true'){_0x1ce71f[_0x377c('0x1f')]=_0x3453c2[_0x377c('0x10')][0x0]['sys_id'];}else{_0x1ce71f[_0x377c('0x1f')]=_0x1ce71f[_0x377c('0x11')];_0x1ce71f[_0x377c('0x1a')]=_0x1ce71f[_0x377c('0x20')];}logger[_0x377c('0x18')]('['+[_0x266825[_0x377c('0x13')]()]+'],\x20getUser\x20crm',_0x1ce71f);_0xb0b9f2(_0x1ce71f);})[_0x377c('0x15')](function(_0x290fdf){logger['error']('['+[_0x266825[_0x377c('0x13')]()]+']',_0x290fdf[_0x377c('0x17')]);_0x11c59e(_0x290fdf[_0x377c('0x17')]);});}else{logger[_0x377c('0x18')]('['+[_0x266825['toUpperCase']()]+_0x377c('0x21'));_0x1ce71f[_0x377c('0x1f')]=_0x1ce71f[_0x377c('0x11')];_0x1ce71f[_0x377c('0x1a')]=_0x1ce71f['adminEmail'];_0xb0b9f2(_0x1ce71f);}});};}function createEndUser(_0x5f5658,_0x295f2e,_0xa79713,_0x83573e,_0x4f7c89){logger['info']('['+[_0x5f5658[_0x377c('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0xa79713);return new Promise(function(_0x3fd058,_0x239bf7){var _0x53408d={'method':_0x377c('0x22'),'uri':_0x83573e+'sys_user?'+_0x4f7c89,'body':{'user_name':_0xa79713[_0x377c('0x23')],'roles':'user','first_name':_0xa79713['endUserNumber'],'active':_0x377c('0x24'),'date_format':_0x377c('0x25'),'phone':_0xa79713[_0x377c('0x23')]},'auth':_0x295f2e,'json':!![]};return rp(_0x53408d)[_0x377c('0xf')](function(_0x1c5ddc){logger[_0x377c('0x18')]('['+[_0x5f5658[_0x377c('0x13')]()]+'],\x20EndUser\x20schema',_0x1c5ddc[_0x377c('0x10')]);_0xa79713[_0x377c('0x26')]=_0x1c5ddc['result'][_0x377c('0x12')];_0x3fd058(_0xa79713);})[_0x377c('0x15')](function(_0x4a7513){logger['error']('['+[_0x5f5658['toUpperCase']()]+']',_0x4a7513[_0x377c('0x17')]);_0x239bf7(_0x4a7513['message']);});});}function getEndUser(_0x43499d,_0x4e8893,_0x324fb7,_0x5efdcb,_0x57a758){return function(_0x4147cb){logger[_0x377c('0x18')]('['+[_0x43499d[_0x377c('0x13')]()]+_0x377c('0x27'),_0x4147cb);return new Promise(function(_0x39b64e,_0x4d5163){var _0x2f8bb9={'method':'GET','uri':_0x324fb7+_0x377c('0x28')+_0x4147cb[_0x377c('0x23')]+'&'+_0x5efdcb+'&'+_0x57a758,'auth':_0x4e8893,'json':!![]};return rp(_0x2f8bb9)[_0x377c('0xf')](function(_0x6e8429){if(_0x6e8429[_0x377c('0x10')]['length']>0x0){_0x4147cb[_0x377c('0x26')]=_0x6e8429['result'][0x0][_0x377c('0x12')];logger['info']('['+[_0x43499d['toUpperCase']()]+_0x377c('0x29'),_0x4147cb);_0x39b64e(_0x4147cb);}else{return createEndUser(_0x43499d,_0x4e8893,_0x4147cb,_0x324fb7,_0x5efdcb)['then'](function(_0x45b042){logger[_0x377c('0x18')]('['+[_0x43499d[_0x377c('0x13')]()]+_0x377c('0x2a'),_0x45b042);_0x39b64e(_0x45b042);});}})[_0x377c('0x15')](function(_0x411aed){logger['error']('['+[_0x43499d[_0x377c('0x13')]()]+']',_0x411aed['message']);_0x4d5163(_0x411aed[_0x377c('0x17')]);});});};}function getCustomFields(_0x57fdbe,_0x424ff0){var _0xba86e0={};if(_0x57fdbe[_0x377c('0x1d')]>0x0){_[_0x377c('0x2b')](_0x57fdbe,function(_0x1b4c29){if(_[_0x377c('0x2c')]([_0x377c('0x2d'),_0x377c('0x2e')],_0x1b4c29[_0x377c('0x2f')])&&_0x1b4c29['nameField']&&!_0x1b4c29[_0x377c('0x30')]){_0xba86e0[_0x1b4c29[_0x377c('0x31')][_0x377c('0x32')]()]=_0x1b4c29[_0x377c('0x33')][_0x377c('0x34')]();}else if(_[_0x377c('0x2c')](['string','picklist'],_0x1b4c29[_0x377c('0x2f')])&&_0x1b4c29['idField']&&_0x1b4c29[_0x377c('0x30')]){_0xba86e0[_0x1b4c29[_0x377c('0x35')][_0x377c('0x32')]()]=_0x1b4c29['content'][_0x377c('0x34')]();}else if(_0x1b4c29[_0x377c('0x2f')]===_0x377c('0x36')&&_0x1b4c29[_0x377c('0x37')]&&_0x1b4c29[_0x377c('0x35')]&&_0x1b4c29[_0x377c('0x30')]){_0xba86e0[_0x1b4c29[_0x377c('0x35')][_0x377c('0x32')]()]=_0x424ff0[_0x1b4c29[_0x377c('0x37')]][_0x377c('0x34')]();}else if(_0x1b4c29[_0x377c('0x2f')]===_0x377c('0x38')&&_0x1b4c29[_0x377c('0x39')]&&_0x1b4c29['Variable'][_0x377c('0x3a')]&&_0x1b4c29[_0x377c('0x35')]&&_0x1b4c29['customField']){_0xba86e0[_0x1b4c29[_0x377c('0x35')][_0x377c('0x32')]()]=_0x424ff0[_0x1b4c29[_0x377c('0x39')][_0x377c('0x3a')][_0x377c('0x32')]()][_0x377c('0x34')]();}});}return _0xba86e0;}function getTicket(_0x1022b6,_0x548da1,_0x17eea7,_0x41ca4c,_0x56e7fa,_0x52b982){return function(_0x7e41f9){logger[_0x377c('0x18')]('['+[_0x1022b6[_0x377c('0x13')]()]+_0x377c('0x3b'),_0x7e41f9);return new Promise(function(_0xc099f2,_0x295157){var _0x2edbd2=_0x1022b6[_0x377c('0x32')]()===_0x377c('0x3c')?_0x7e41f9[_0x377c('0x1f')]:_0x7e41f9[_0x377c('0x26')];var _0x3001f4={'method':_0x377c('0x22'),'uri':_0x17eea7+_0x377c('0x3d')+'?'+_0x52b982,'body':Object['assign']({},{'active':_0x377c('0x24'),'caller_id':_0x2edbd2,'assigned_to':_0x7e41f9[_0x377c('0x1f')],'short_description':intUtil[_0x377c('0x3e')](_0x41ca4c[_0x377c('0x3f')],_0x56e7fa,'\x20'),'description':intUtil[_0x377c('0x3e')](_0x41ca4c['Descriptions'],_0x56e7fa,'\x0a')},getCustomFields(_0x41ca4c[_0x377c('0x40')],_0x56e7fa)),'auth':_0x548da1,'json':!![]};return rp(_0x3001f4)[_0x377c('0xf')](function(_0xe9e5a5){logger[_0x377c('0x18')]('['+[_0x1022b6['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0xe9e5a5[_0x377c('0x10')]);_0x7e41f9[_0x377c('0x41')]=_0xe9e5a5[_0x377c('0x10')][_0x377c('0x12')];_0x7e41f9[_0x377c('0x42')]=_0xe9e5a5['result'][_0x377c('0x43')];logger[_0x377c('0x18')]('['+[_0x1022b6[_0x377c('0x13')]()]+_0x377c('0x44'),_0x7e41f9);_0xc099f2(_0x7e41f9);})[_0x377c('0x15')](function(_0x39ca48){logger['error']('['+[_0x1022b6[_0x377c('0x13')]()]+']',_0x39ca48[_0x377c('0x17')]);_0x295157(_0x39ca48[_0x377c('0x17')]);});});};}function createRemoteTag(_0x274987,_0x26407b,_0x302bec,_0x57f1e5){return new Promise(function(_0x15eb52,_0x1b570d){var _0x112d0a={'method':_0x377c('0x22'),'uri':_0x302bec+_0x377c('0x45')+'?'+_0x57f1e5,'body':{'short_description':_0x274987,'global':!![],'active':!![],'name':_0x274987},'auth':_0x26407b,'json':!![]};return rp(_0x112d0a)['then'](function(_0x8faeb2){var _0x2d66ff=_0x8faeb2[_0x377c('0x10')][_0x377c('0x12')];_0x15eb52(_0x2d66ff);});});}function getRemoteTag(_0x44844d,_0x394692,_0x15a293,_0x578bba,_0x50902e){return new Promise(function(_0x57a493,_0x2f5a4a){var _0x1d4019={'method':_0x377c('0xd'),'uri':_0x15a293+_0x377c('0x45')+'?sysparm_query=name%3D'+_0x44844d+'&'+_0x578bba,'auth':_0x394692,'json':!![]};return rp(_0x1d4019)[_0x377c('0xf')](function(_0xfcf920){if(_0xfcf920['result'][_0x377c('0x1d')]>0x0){var _0x560fb5=_0xfcf920[_0x377c('0x10')][0x0][_0x377c('0x12')];_0x57a493(_0x560fb5);}else{return createRemoteTag(_0x44844d,_0x394692,_0x15a293,_0x578bba)[_0x377c('0xf')](function(_0x2fa5bf){_0x57a493(_0x2fa5bf);});}});});}function assignTagToIncident(_0x5b53b6,_0x3438b3,_0x1c1ae9,_0x2496bc,_0x3efddc){return new Promise(function(_0x47e68b,_0x270f32){var _0x95465f={'method':_0x377c('0x22'),'uri':_0x1c1ae9+'label_entry'+'?'+_0x3efddc,'body':{'label':_0x5b53b6,'table':'incident','id_type':_0x377c('0x46'),'table_key':_0x2496bc[_0x377c('0x41')],'title':_0x377c('0x47')+_0x2496bc['ticketNumber'],'id_display':_0x2496bc[_0x377c('0x42')]},'auth':_0x3438b3,'json':!![]};return rp(_0x95465f)[_0x377c('0xf')](function(_0x452c79){_0x47e68b();})[_0x377c('0x15')](function(){_0x47e68b();});});}function manageTags(_0x52bc7d,_0x4931c3,_0x72eb9e,_0x379d5e,_0x5a3343,_0xfc8778,_0x1230e8){return new Promise(function(_0x1e3e46,_0xe09a9c){var _0xbbe85e=[];_0x4931c3[_0x377c('0x2b')](function(_0x50cab8){_0xbbe85e['push'](getRemoteTag(_0x50cab8,_0x72eb9e,_0x379d5e,_0xfc8778,_0x1230e8));});return Promise[_0x377c('0x48')](_0xbbe85e)['then'](function(_0xbd20c2){if(_0xbd20c2[_0x377c('0x1d')]){logger[_0x377c('0x18')]('['+[_0x52bc7d[_0x377c('0x13')]()]+_0x377c('0x49'),_0xbd20c2);var _0x5429d6=[];_0xbd20c2[_0x377c('0x2b')](function(_0x3245c0){_0x5429d6[_0x377c('0x4a')](assignTagToIncident(_0x3245c0,_0x72eb9e,_0x379d5e,_0x5a3343,_0xfc8778));});return Promise[_0x377c('0x48')](_0x5429d6)[_0x377c('0xf')](function(){_0x1e3e46();})[_0x377c('0x15')](function(){_0x1e3e46();});}else{_0x1e3e46();}});});}function getTags(_0x25978d,_0x22e105,_0x8853e8,_0xa2c0cb,_0x4936f8,_0xe28f7){return function(_0x2dfb6d){return new Promise(function(_0x471266,_0x278c25){var _0x33317f=[];var _0x54633c=_0xa2c0cb[_0x377c('0x4b')];if(_0x54633c&&_0x54633c[_0x377c('0x1d')]>0x0){_0x33317f=_['map'](_0x54633c,'name');}if(_0x33317f[_0x377c('0x1d')]>0x0){return manageTags(_0x25978d,_0x33317f,_0x22e105,_0x8853e8,_0x2dfb6d,_0x4936f8,_0xe28f7)[_0x377c('0xf')](function(){_0x471266(_0x2dfb6d);});}else{_0x471266(_0x2dfb6d);}});};}function emit(_0x6eab24,_0x13efa2,_0x47b493){var _0x5f0075='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x5b4ce9={'uri':_0x6eab24+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x47b493+_0x5f0075};io['to'](util[_0x377c('0x4c')](_0x377c('0x4d'),_0x13efa2))[_0x377c('0x4e')](_0x377c('0x4f'),_0x5b4ce9);}exports['cs']=function(_0x14b341,_0x561cd8,_0x5d6138,_0x3e9042,_0x462234,_0x468f11,_0x1fe61b,_0x486da9){var _0x4cf37c={};var _0x35311d={'user':_0x468f11['username'],'pass':_0x468f11[_0x377c('0x50')]};var _0x58b0e1=_0x377c('0x51');var _0x14beaa=_0x377c('0x52');_0x468f11[_0x377c('0x53')]=intUtil[_0x377c('0x54')](_0x468f11[_0x377c('0x53')]);_0x468f11[_0x377c('0x55')]=intUtil['stripTrailingSlash'](_0x468f11[_0x377c('0x55')]);var _0xe6858c=util[_0x377c('0x4c')]('%s/api/now/table/',_0x468f11[_0x377c('0x53')]);_0x4cf37c[_0x377c('0x1a')]=!_[_0x377c('0x56')](_0x3e9042)?_0x3e9042[_0x377c('0x57')]:null;_0x4cf37c[_0x377c('0x20')]=_0x468f11['email'];_0x4cf37c['endUserNumber']=_0x486da9[_0x377c('0x32')]()===_0x377c('0x3c')?_0x561cd8[_0x377c('0x58')]:_0x561cd8[_0x377c('0x59')];_0x4cf37c[_0x377c('0x5a')]=_0x486da9===_0x377c('0x5b')||_0x486da9===_0x377c('0x5c')?_0x377c('0x5b'):'outbound';var _0x58659d=util[_0x377c('0x4c')](_0x377c('0x5d'),_0x468f11['serverUrl'],_0x561cd8['uniqueid'],md5(_0x561cd8['uniqueid']));if(_0x462234&&_0x462234[_0x377c('0x5e')]){logger[_0x377c('0x18')]('[QUEUE]',_0x377c('0x5f'));_0x561cd8[_0x377c('0x60')]=_0x58659d;}else if(_0x1fe61b&&_0x1fe61b[_0x377c('0x61')]&&_0x1fe61b[_0x377c('0x61')]!=='none'){logger[_0x377c('0x18')](_0x377c('0x62'),_0x377c('0x5f'));_0x561cd8[_0x377c('0x60')]=_0x58659d;}else{_0x561cd8[_0x377c('0x60')]='';}return getAdminUser(_0x486da9,_0x35311d,_0x4cf37c,_0xe6858c,_0x14beaa,_0x58b0e1)[_0x377c('0xf')](getUser(_0x486da9,_0x35311d,_0xe6858c,_0x14beaa,_0x58b0e1))['then'](getEndUser(_0x486da9,_0x35311d,_0xe6858c,_0x14beaa,_0x58b0e1))[_0x377c('0xf')](getTicket(_0x486da9,_0x35311d,_0xe6858c,_0x5d6138,_0x561cd8,_0x14beaa))[_0x377c('0xf')](function(_0x36a289){logger[_0x377c('0x18')](util[_0x377c('0x4c')](_0x377c('0x63'),_0x36a289['ticketId']));logger['info'](util['format'](_0x377c('0x64'),_0x486da9));if(_0x486da9!==_0x377c('0x5c')){logger[_0x377c('0x18')]('['+[_0x486da9[_0x377c('0x13')]()]+']',_0x377c('0x65'));emit(_0x468f11[_0x377c('0x53')],_0x3e9042[_0x377c('0x3a')],_0x36a289[_0x377c('0x41')]);}})[_0x377c('0x15')](function(_0xa305e9){logger[_0x377c('0x16')]('['+[_0x486da9[_0x377c('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x377c('0x66')](_0xa305e9,{'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 b074e1e..2a20a02 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 _0xab34=['username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%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','The\x20Ticket\x20ID\x20is:','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...','user:%s','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','error','lastevent','toUpperCase','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','name','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','get_server_info','isNil','Getting\x20agent\x20with\x20name','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','toString','variable','customField','push','customVariable','Variable','custom_fields','POST','login'];(function(_0x50eb7e,_0x159fee){var _0x2e0ef8=function(_0x402ddc){while(--_0x402ddc){_0x50eb7e['push'](_0x50eb7e['shift']());}};_0x2e0ef8(++_0x159fee);}(_0xab34,0xa5));var _0x4ab3=function(_0x4457a1,_0x2946c4){_0x4457a1=_0x4457a1-0x0;var _0x46134e=_0xab34[_0x4457a1];return _0x46134e;};'use strict';var _=require(_0x4ab3('0x0'));var rp=require('request-promise');var BPromise=require(_0x4ab3('0x1'));var md5=require(_0x4ab3('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x4ab3('0x3'));var config=require(_0x4ab3('0x4'));var logger=require(_0x4ab3('0x5'))(_0x4ab3('0x6'));config[_0x4ab3('0x7')]=_[_0x4ab3('0x8')](config[_0x4ab3('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ab3('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x59d076,_0x1a960b,_0x4aac85){io['to'](_0x59d076)[_0x4ab3('0x9')](_0x1a960b,_0x4aac85);}function getTicket(_0xff46e4,_0x8ec4d7,_0x416c8c,_0x1e7d8f,_0x414d3d,_0x5658a5,_0x4c2c57,_0x4bea50){logger[_0x4ab3('0xa')](_0x4ab3('0xb'));var _0x480395=new Date();var _0x2207b3=[{'name':'name','value':intUtil[_0x4ab3('0xc')](_0x1e7d8f[_0x4ab3('0xd')],_0x414d3d,'\x20')},{'name':_0x4ab3('0xe'),'value':_0x8ec4d7['id']},{'name':_0x4ab3('0xf'),'value':_0x8ec4d7['id']},{'name':_0x4ab3('0x10'),'value':intUtil[_0x4ab3('0xc')](_0x1e7d8f['Descriptions'],_0x414d3d,'\x0a')},{'name':'date_start','value':_0x480395[_0x4ab3('0x11')]()[_0x4ab3('0x12')](0x0,0x13)[_0x4ab3('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4ab3('0x14'),'value':'15'},{'name':_0x4ab3('0x15'),'value':_0x416c8c['id']},{'name':_0x4ab3('0x16'),'value':'Contacts'},{'name':_0x4ab3('0x17'),'value':_0x416c8c[_0x4ab3('0x18')]},{'name':'direction','value':_0x4bea50}];if(_0x5658a5[_0x4ab3('0x19')]){_[_0x4ab3('0x1a')](_0x5658a5,function(_0x5ce415){if(_0x414d3d[_0x5ce415[_0x4ab3('0x1b')]]){_0x2207b3['push']({'name':_0x5ce415[_0x4ab3('0x1c')],'value':_0x414d3d[_0x5ce415[_0x4ab3('0x1b')]]});}});}return request({'form':{'method':_0x4ab3('0x1d'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x4c2c57['id'],'module_name':'Calls','name_value_list':_0x2207b3})}});}function getAuth(_0x28414a){return util[_0x4ab3('0x20')](_0x4ab3('0x21'),new Buffer(_0x28414a['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x4c4614){return request({'form':{'method':_0x4ab3('0x22'),'input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x4c4614['id']})}});}function getUser(_0xa1ab8a,_0x2c9b0f,_0x19685d){if(!_[_0x4ab3('0x23')](_0x2c9b0f)){logger[_0x4ab3('0xa')](_0x4ab3('0x24'),_0x2c9b0f);return request({'form':{'method':'get_entry_list','input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x19685d['id'],'module_name':'Employees','query':util[_0x4ab3('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2c9b0f),'order_by':'','offset':'0','select_fields':['id',_0x4ab3('0x18'),_0x4ab3('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1e3451){if(_0x1e3451['entry_list'][_0x4ab3('0x19')]){var _0x3d8a63=_[_0x4ab3('0x26')](_0x1e3451[_0x4ab3('0x27')],function(_0x5d2625){return _0x5d2625[_0x4ab3('0x28')][_0x4ab3('0x25')][_0x4ab3('0x29')]===_0x2c9b0f;});if(_0x3d8a63){logger[_0x4ab3('0xa')](_0x4ab3('0x2a'));return BPromise[_0x4ab3('0x2b')]({'id':_0x3d8a63[_0x4ab3('0x28')]['id']['value'],'name':_0x3d8a63[_0x4ab3('0x28')][_0x4ab3('0x18')]['value']});}}logger[_0x4ab3('0xa')](_0x4ab3('0x2c'));return BPromise[_0x4ab3('0x2b')]({'id':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x2d')][_0x4ab3('0x29')],'name':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x25')][_0x4ab3('0x29')]});});}else{logger[_0x4ab3('0xa')](_0x4ab3('0x2e'));return BPromise[_0x4ab3('0x2b')]({'id':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x2d')]['value'],'name':_0x19685d['name_value_list'][_0x4ab3('0x25')][_0x4ab3('0x29')]});}}function getEndUser(_0x5e49f5,_0x5cd6fb,_0x2aca6b,_0x8321d9){logger['info'](_0x4ab3('0x2f'),_0x2aca6b);return request({'form':{'method':_0x4ab3('0x30'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x8321d9['id'],'module_name':_0x4ab3('0x31'),'query':util[_0x4ab3('0x20')](_0x4ab3('0x32'),_0x2aca6b),'order_by':'','offset':'0','select_fields':['id',_0x4ab3('0x18'),_0x4ab3('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ab3('0x34')](function(_0x3b55c2){if(_0x3b55c2[_0x4ab3('0x27')][_0x4ab3('0x19')]){var _0x53c2cb=_[_0x4ab3('0x26')](_0x3b55c2['entry_list'],function(_0x3500be){return _0x3500be[_0x4ab3('0x28')][_0x4ab3('0x33')][_0x4ab3('0x29')]===_0x2aca6b;});if(_0x53c2cb){logger['info']('Enduser\x20found!');return BPromise[_0x4ab3('0x2b')]({'id':_0x53c2cb[_0x4ab3('0x28')]['id'][_0x4ab3('0x29')],'name':_0x53c2cb[_0x4ab3('0x28')][_0x4ab3('0x18')]['value'],'phone':_0x53c2cb[_0x4ab3('0x28')][_0x4ab3('0x33')][_0x4ab3('0x29')]});}}else{logger[_0x4ab3('0xa')](_0x4ab3('0x35'));return request({'form':{'method':_0x4ab3('0x1d'),'input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x8321d9['id'],'module_name':_0x4ab3('0x31'),'name_value_list':[{'name':_0x4ab3('0x36'),'value':_0x5cd6fb!==_0x4ab3('0x37')?_0x5cd6fb:util[_0x4ab3('0x20')](_0x4ab3('0x38'),_0x2aca6b)},{'name':_0x4ab3('0x33'),'value':_0x2aca6b}]})}})['then'](function(_0x16b474){logger[_0x4ab3('0xa')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x16b474['id'],'name':_0x16b474[_0x4ab3('0x27')][_0x4ab3('0x36')][_0x4ab3('0x29')],'phone':_0x16b474['entry_list'][_0x4ab3('0x33')][_0x4ab3('0x29')]});});}});}function request(_0x4ff1bc){logger[_0x4ab3('0x39')](_0x4ab3('0x3a'),JSON[_0x4ab3('0x1f')](_0x4ff1bc));return rp(_[_0x4ab3('0x3b')](def,_0x4ff1bc));}function getTags(_0x9433f,_0x2d259f){var _0x290f1b=[];if(_0x9433f&&_0x9433f[_0x4ab3('0x19')]>0x0){_0x290f1b=_[_0x4ab3('0x3c')](_0x9433f,_0x2d259f);}return _0x290f1b;}function getCustomFields(_0x44b10f,_0x573337){var _0x394ce8=[];var _0x305b87={'custom_fields':[]};if(_0x44b10f[_0x4ab3('0x19')]>0x0){_[_0x4ab3('0x1a')](_0x44b10f,function(_0x32fcaa){if(_0x32fcaa[_0x4ab3('0x3d')]===_0x4ab3('0x3e')&&_0x32fcaa[_0x4ab3('0x3f')]&&!_0x32fcaa['customField']){_0x305b87[_0x32fcaa['nameField'][_0x4ab3('0x40')]()]=_0x32fcaa[_0x4ab3('0x41')][_0x4ab3('0x42')]();}else if(_0x32fcaa['type']==='string'&&_0x32fcaa[_0x4ab3('0x1c')]&&_0x32fcaa['customField']){_0x305b87['custom_fields']['push']({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x32fcaa[_0x4ab3('0x41')][_0x4ab3('0x42')]()});}else if(_0x32fcaa[_0x4ab3('0x3d')]===_0x4ab3('0x43')&&_0x32fcaa[_0x4ab3('0x1b')]&&_0x32fcaa[_0x4ab3('0x1c')]&&_0x32fcaa[_0x4ab3('0x44')]){_0x573337[_0x32fcaa[_0x4ab3('0x1b')]]&&_0x305b87['custom_fields'][_0x4ab3('0x45')]({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x573337[_0x32fcaa['variableName']][_0x4ab3('0x42')]()});}else if(_0x32fcaa['type']===_0x4ab3('0x46')&&_0x32fcaa[_0x4ab3('0x47')]&&_0x32fcaa[_0x4ab3('0x47')][_0x4ab3('0x18')]&&_0x32fcaa['idField']&&_0x32fcaa[_0x4ab3('0x44')]){_0x573337[_0x32fcaa['Variable'][_0x4ab3('0x18')]['toLowerCase']()]&&_0x305b87[_0x4ab3('0x48')][_0x4ab3('0x45')]({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x573337[_0x32fcaa[_0x4ab3('0x47')][_0x4ab3('0x18')][_0x4ab3('0x40')]()]['toString']()});}});}return _0x305b87;}function getConnection(_0x284fd5){return request({'method':_0x4ab3('0x49'),'form':{'method':_0x4ab3('0x4a'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'user_auth':{'user_name':_0x284fd5[_0x4ab3('0x4b')],'password':_0x284fd5['password'],'encryption':_0x4ab3('0x4c')},'application':_0x4ab3('0x4d')})}})[_0x4ab3('0x34')](function(_0x28a19d){var _0x3b1efe=_0x28a19d;if(_0x3b1efe['id']){def[_0x4ab3('0x4e')]=_0x3b1efe['id'];return BPromise[_0x4ab3('0x2b')](_0x3b1efe);}else{throw new Error(util[_0x4ab3('0x20')](_0x4ab3('0x4f'),_0x284fd5['id']));}});}function setRelationship(_0x4e54a1,_0x31cad6,_0x3d3d3b,_0x4ed5b1){return request({'form':{'method':_0x4ab3('0x50'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON['stringify']({'session':_0x4e54a1['id'],'module_name':_0x4ab3('0x51'),'module_id':_0x3d3d3b['id'],'link_field_name':_0x4ed5b1,'related_ids':[_0x31cad6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4ab3('0x52')]=function(_0x116e9f,_0x3e02f0,_0x4536e2,_0x356f96,_0x4bd503,_0x546706){var _0x301288,_0xef3427,_0x4f2749,_0x1a78d6;_0x546706[_0x4ab3('0x53')]=intUtil[_0x4ab3('0x54')](_0x546706['remoteUri']);_0x546706['serverUrl']=intUtil['stripTrailingSlash'](_0x546706[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x546706[_0x4ab3('0x53')]);if(_0x4bd503&&_0x4bd503[_0x4ab3('0x57')]){logger[_0x4ab3('0xa')]('[QUEUE]',_0x4ab3('0x58'));_0x3e02f0[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x546706['serverUrl'],_0x3e02f0['uniqueid'],md5(_0x3e02f0[_0x4ab3('0x5b')]));}else{_0x3e02f0[_0x4ab3('0x59')]='';}return getConnection(_0x546706)[_0x4ab3('0x34')](function(_0x7523fc){_0x1a78d6=_0x7523fc;return getUser(_0x546706,_0x356f96['name'],_0x1a78d6);})[_0x4ab3('0x34')](function(_0x202d56){_0x301288=_0x202d56;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x301288['id']);return getEndUser(_0x546706,_0x3e02f0[_0x4ab3('0x5d')],_0x3e02f0[_0x4ab3('0x5e')],_0x1a78d6);})[_0x4ab3('0x34')](function(_0x555bcc){_0xef3427=_0x555bcc;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0xef3427['id']);return getTicket(_0x546706,_0x301288,_0xef3427,_0x4536e2,_0x3e02f0,_0x4536e2[_0x4ab3('0x60')],_0x1a78d6,_0x4ab3('0x61'));})['then'](function(_0x379009){_0x4f2749=_0x379009;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger[_0x4ab3('0xa')](_0x4ab3('0x62'),_0x4f2749['id']);return setRelationship(_0x1a78d6,_0x301288,_0x4f2749,_0x4ab3('0x63'));})[_0x4ab3('0x34')](function(){return setRelationship(_0x1a78d6,_0xef3427,_0x4f2749,_0x4ab3('0x64'));})[_0x4ab3('0x34')](function(){return getServerInfo(_0x1a78d6);})['then'](function(_0x336c86){var _0x1ee223=parseInt(_0x336c86[_0x4ab3('0x65')][_0x4ab3('0x66')](0x0));var _0x523b01=util[_0x4ab3('0x20')](_0x4ab3('0x67'),_0x546706[_0x4ab3('0x53')],_0x4f2749['id']);if(_0x1ee223>0x6){_0x523b01=util[_0x4ab3('0x20')](_0x4ab3('0x68'),_0x546706[_0x4ab3('0x53')],_0x4f2749['id']);}logger['info'](_0x4ab3('0x69'),_0x4ab3('0x6a'));emit(util[_0x4ab3('0x20')](_0x4ab3('0x6b'),_0x356f96[_0x4ab3('0x18')]),'trigger:browser:url',{'uri':_0x523b01});})[_0x4ab3('0x6c')](function(_0x46bed4){logger['error'](_0x4ab3('0x69'),JSON[_0x4ab3('0x1f')](_0x46bed4));});};exports[_0x4ab3('0x6d')]=function(_0x216e81,_0x4cf67f,_0x86b149,_0x732680,_0x8e6ccc,_0x329ff5,_0x1ede25){var _0x3519ec,_0x98bdc2,_0xff0c4e,_0x49742c;_0x329ff5[_0x4ab3('0x53')]=intUtil['stripTrailingSlash'](_0x329ff5['remoteUri']);_0x329ff5['serverUrl']=intUtil[_0x4ab3('0x54')](_0x329ff5[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x329ff5[_0x4ab3('0x53')]);if(_0x1ede25&&_0x1ede25[_0x4ab3('0x6e')]&&_0x1ede25[_0x4ab3('0x6e')]!==_0x4ab3('0x6f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4cf67f[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x329ff5[_0x4ab3('0x55')],_0x4cf67f[_0x4ab3('0x5b')],md5(_0x4cf67f[_0x4ab3('0x5b')]));}return getConnection(_0x329ff5)[_0x4ab3('0x34')](function(_0x594fa3){_0x49742c=_0x594fa3;return getUser(_0x329ff5,_0x732680[_0x4ab3('0x18')],_0x49742c);})[_0x4ab3('0x34')](function(_0x1fd449){_0x3519ec=_0x1fd449;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x3519ec['id']);return getEndUser(_0x329ff5,_0x4cf67f[_0x4ab3('0x70')],_0x4cf67f[_0x4ab3('0x71')],_0x49742c);})[_0x4ab3('0x34')](function(_0x1aa1e3){_0x98bdc2=_0x1aa1e3;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0x98bdc2['id']);return getTicket(_0x329ff5,_0x3519ec,_0x98bdc2,_0x86b149,_0x4cf67f,_0x86b149['Fields'],_0x49742c,_0x4ab3('0x72'));})[_0x4ab3('0x34')](function(_0x2eabc2){_0xff0c4e=_0x2eabc2;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger[_0x4ab3('0xa')]('The\x20Ticket\x20ID\x20is:',_0xff0c4e['id']);return setRelationship(_0x49742c,_0x3519ec,_0xff0c4e,_0x4ab3('0x63'));})['then'](function(){return setRelationship(_0x49742c,_0x98bdc2,_0xff0c4e,'contacts');})['then'](function(){return getServerInfo(_0x49742c);})[_0x4ab3('0x34')](function(_0x299dc1){var _0x1bc036=parseInt(_0x299dc1[_0x4ab3('0x65')][_0x4ab3('0x66')](0x0));var _0x124882=util[_0x4ab3('0x20')](_0x4ab3('0x67'),_0x329ff5[_0x4ab3('0x53')],_0xff0c4e['id']);if(_0x1bc036>0x6){_0x124882=util['format'](_0x4ab3('0x68'),_0x329ff5['remoteUri'],_0xff0c4e['id']);}logger['info'](_0x4ab3('0x73'),_0x4ab3('0x6a'));emit(util[_0x4ab3('0x20')]('user:%s',_0x732680[_0x4ab3('0x18')]),_0x4ab3('0x74'),{'uri':_0x124882});})['catch'](function(_0x5b39ae){logger[_0x4ab3('0x75')](_0x4ab3('0x73'),JSON[_0x4ab3('0x1f')](_0x5b39ae));});};exports['unmanaged']=function(_0x2b71ff,_0x129893,_0x13b018,_0x54a1bb,_0x3e11a6,_0x3937c0){var _0x1f08b7,_0x993246,_0x5f4dcb,_0x404bf7;_0x3937c0[_0x4ab3('0x53')]=intUtil[_0x4ab3('0x54')](_0x3937c0[_0x4ab3('0x53')]);_0x3937c0[_0x4ab3('0x55')]=intUtil[_0x4ab3('0x54')](_0x3937c0[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x3937c0[_0x4ab3('0x53')]);if(_0x3e11a6&&_0x3e11a6[_0x4ab3('0x57')]){logger['info']('['+_0x129893[_0x4ab3('0x76')][_0x4ab3('0x77')]()+']',_0x4ab3('0x58'));_0x129893[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x3937c0[_0x4ab3('0x55')],_0x129893[_0x4ab3('0x5b')],md5(_0x129893[_0x4ab3('0x5b')]));}else{_0x129893[_0x4ab3('0x59')]='';}return getConnection(_0x3937c0)[_0x4ab3('0x34')](function(_0x2532a8){_0x404bf7=_0x2532a8;if(!_[_0x4ab3('0x23')](_0x54a1bb)){return getUser(_0x3937c0,_0x54a1bb[_0x4ab3('0x18')],_0x404bf7);}else{return getUser(_0x3937c0,null,_0x404bf7);}})[_0x4ab3('0x34')](function(_0x3d9ab5){_0x1f08b7=_0x3d9ab5;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x1f08b7['id']);return getEndUser(_0x3937c0,_0x129893['calleridname'],_0x129893[_0x4ab3('0x5e')],_0x404bf7);})[_0x4ab3('0x34')](function(_0x386fc0){_0x993246=_0x386fc0;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0x993246['id']);return getTicket(_0x3937c0,_0x1f08b7,_0x993246,_0x13b018,_0x129893,_0x13b018[_0x4ab3('0x60')],_0x404bf7,_0x4ab3('0x61'));})[_0x4ab3('0x34')](function(_0x5d31b6){_0x5f4dcb=_0x5d31b6;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger['info'](_0x4ab3('0x62'),_0x5f4dcb['id']);return setRelationship(_0x404bf7,_0x1f08b7,_0x5f4dcb,_0x4ab3('0x63'));})[_0x4ab3('0x34')](function(){return setRelationship(_0x404bf7,_0x993246,_0x5f4dcb,_0x4ab3('0x64'));})[_0x4ab3('0x34')](function(){return getServerInfo(_0x404bf7);})[_0x4ab3('0x6c')](function(_0x313cc1){logger[_0x4ab3('0x75')]('['+_0x129893['lastevent']['toUpperCase']()+']',JSON[_0x4ab3('0x1f')](_0x313cc1));});}; \ No newline at end of file +var _0x3492=['getString','created_by','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','length','variableName','JSON','stringify','Calls','Basic\x20%s','toString','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','format','Enduser\x20created.','[HTTP]','map','forEach','string','nameField','customField','content','type','idField','custom_fields','push','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','%s/service/v4_1/rest.php','recordingFormat','none','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','isNil','calleridnum','lodash','bluebird','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','POST','emit','Creating\x20new\x20ticket...','name'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x3492,0x149));var _0x2349=function(_0x261f2e,_0x105c96){_0x261f2e=_0x261f2e-0x0;var _0x3b8b4d=_0x3492[_0x261f2e];return _0x3b8b4d;};'use strict';var _=require(_0x2349('0x0'));var rp=require('request-promise');var BPromise=require(_0x2349('0x1'));var md5=require('md5');var util=require(_0x2349('0x2'));var Redis=require(_0x2349('0x3'));var intUtil=require(_0x2349('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2349('0x5'))(_0x2349('0x6'));config[_0x2349('0x7')]=_[_0x2349('0x8')](config[_0x2349('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2349('0x7')]));var def={'method':_0x2349('0x9'),'json':!![]};function emit(_0x55aec0,_0x57ea30,_0x5a7f6c){io['to'](_0x55aec0)[_0x2349('0xa')](_0x57ea30,_0x5a7f6c);}function getTicket(_0x597eb2,_0x126e07,_0x5c246c,_0x3cbc82,_0x15c2fe,_0x55df24,_0x1db435,_0x321edb){logger['info'](_0x2349('0xb'));var _0x1a12f6=new Date();var _0x297885=[{'name':_0x2349('0xc'),'value':intUtil[_0x2349('0xd')](_0x3cbc82['Subjects'],_0x15c2fe,'\x20')},{'name':'assigned_user_id','value':_0x126e07['id']},{'name':_0x2349('0xe'),'value':_0x126e07['id']},{'name':'description','value':intUtil[_0x2349('0xd')](_0x3cbc82[_0x2349('0xf')],_0x15c2fe,'\x0a')},{'name':_0x2349('0x10'),'value':_0x1a12f6[_0x2349('0x11')]()[_0x2349('0x12')](0x0,0x13)[_0x2349('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x2349('0x14'),'value':'15'},{'name':_0x2349('0x15'),'value':_0x5c246c['id']},{'name':_0x2349('0x16'),'value':'Contacts'},{'name':_0x2349('0x17'),'value':_0x5c246c['name']},{'name':_0x2349('0x18'),'value':_0x321edb}];if(_0x55df24[_0x2349('0x19')]){_['forEach'](_0x55df24,function(_0xc4dc55){if(_0x15c2fe[_0xc4dc55[_0x2349('0x1a')]]){_0x297885['push']({'name':_0xc4dc55['idField'],'value':_0x15c2fe[_0xc4dc55['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x2349('0x1b'),'response_type':_0x2349('0x1b'),'rest_data':JSON[_0x2349('0x1c')]({'session':_0x1db435['id'],'module_name':_0x2349('0x1d'),'name_value_list':_0x297885})}});}function getAuth(_0x49c7ce){return util['format'](_0x2349('0x1e'),new Buffer(_0x49c7ce['apiKey']+':X')[_0x2349('0x1f')]('base64'));}function getServerInfo(_0x4902b2){return request({'form':{'method':_0x2349('0x20'),'input_type':_0x2349('0x1b'),'response_type':'JSON','rest_data':JSON[_0x2349('0x1c')]({'session':_0x4902b2['id']})}});}function getUser(_0x142312,_0x49d54a,_0x2896cd){if(!_['isNil'](_0x49d54a)){logger[_0x2349('0x21')](_0x2349('0x22'),_0x49d54a);return request({'form':{'method':_0x2349('0x23'),'input_type':_0x2349('0x1b'),'response_type':_0x2349('0x1b'),'rest_data':JSON[_0x2349('0x1c')]({'session':_0x2896cd['id'],'module_name':_0x2349('0x24'),'query':util['format'](_0x2349('0x25'),_0x49d54a),'order_by':'','offset':'0','select_fields':['id',_0x2349('0xc'),_0x2349('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3a217b){if(_0x3a217b['entry_list'][_0x2349('0x19')]){var _0x79f221=_['find'](_0x3a217b[_0x2349('0x27')],function(_0x2dd422){return _0x2dd422[_0x2349('0x28')][_0x2349('0x26')]['value']===_0x49d54a;});if(_0x79f221){logger[_0x2349('0x21')](_0x2349('0x29'));return BPromise[_0x2349('0x2a')]({'id':_0x79f221['name_value_list']['id'][_0x2349('0x2b')],'name':_0x79f221[_0x2349('0x28')][_0x2349('0xc')][_0x2349('0x2b')]});}}logger[_0x2349('0x21')](_0x2349('0x2c'));return BPromise[_0x2349('0x2a')]({'id':_0x2896cd[_0x2349('0x28')]['user_id']['value'],'name':_0x2896cd[_0x2349('0x28')][_0x2349('0x26')]['value']});});}else{logger[_0x2349('0x21')](_0x2349('0x2d'));return BPromise[_0x2349('0x2a')]({'id':_0x2896cd[_0x2349('0x28')]['user_id'][_0x2349('0x2b')],'name':_0x2896cd[_0x2349('0x28')][_0x2349('0x26')][_0x2349('0x2b')]});}}function getEndUser(_0x4fdb8d,_0x2148fd,_0x30209d,_0x5a96e7){logger[_0x2349('0x21')]('Searching\x20enduser\x20with\x20phone',_0x30209d);return request({'form':{'method':_0x2349('0x23'),'input_type':_0x2349('0x1b'),'response_type':_0x2349('0x1b'),'rest_data':JSON['stringify']({'session':_0x5a96e7['id'],'module_name':_0x2349('0x2e'),'query':util['format'](_0x2349('0x2f'),_0x30209d),'order_by':'','offset':'0','select_fields':['id','name',_0x2349('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2349('0x31')](function(_0x25d167){if(_0x25d167[_0x2349('0x27')][_0x2349('0x19')]){var _0x5ac4bc=_['find'](_0x25d167[_0x2349('0x27')],function(_0x281974){return _0x281974[_0x2349('0x28')][_0x2349('0x30')][_0x2349('0x2b')]===_0x30209d;});if(_0x5ac4bc){logger['info'](_0x2349('0x32'));return BPromise[_0x2349('0x2a')]({'id':_0x5ac4bc[_0x2349('0x28')]['id']['value'],'name':_0x5ac4bc[_0x2349('0x28')][_0x2349('0xc')][_0x2349('0x2b')],'phone':_0x5ac4bc['name_value_list'][_0x2349('0x30')][_0x2349('0x2b')]});}}else{logger['info'](_0x2349('0x33'));return request({'form':{'method':_0x2349('0x34'),'input_type':_0x2349('0x1b'),'response_type':_0x2349('0x1b'),'rest_data':JSON[_0x2349('0x1c')]({'session':_0x5a96e7['id'],'module_name':_0x2349('0x2e'),'name_value_list':[{'name':_0x2349('0x35'),'value':_0x2148fd!==''?_0x2148fd:util[_0x2349('0x36')]('Caller\x20-\x20%s',_0x30209d)},{'name':_0x2349('0x30'),'value':_0x30209d}]})}})[_0x2349('0x31')](function(_0x47bb3e){logger['info'](_0x2349('0x37'));return BPromise[_0x2349('0x2a')]({'id':_0x47bb3e['id'],'name':_0x47bb3e[_0x2349('0x27')]['first_name'][_0x2349('0x2b')],'phone':_0x47bb3e[_0x2349('0x27')][_0x2349('0x30')][_0x2349('0x2b')]});});}});}function request(_0x506d39){logger['debug'](_0x2349('0x38'),JSON[_0x2349('0x1c')](_0x506d39));return rp(_['merge'](def,_0x506d39));}function getTags(_0x40a123,_0x35f672){var _0x44787b=[];if(_0x40a123&&_0x40a123[_0x2349('0x19')]>0x0){_0x44787b=_[_0x2349('0x39')](_0x40a123,_0x35f672);}return _0x44787b;}function getCustomFields(_0x4c43d2,_0xcc143){var _0x465f75=[];var _0xa32157={'custom_fields':[]};if(_0x4c43d2[_0x2349('0x19')]>0x0){_[_0x2349('0x3a')](_0x4c43d2,function(_0x3d4c09){if(_0x3d4c09['type']===_0x2349('0x3b')&&_0x3d4c09[_0x2349('0x3c')]&&!_0x3d4c09[_0x2349('0x3d')]){_0xa32157[_0x3d4c09[_0x2349('0x3c')]['toLowerCase']()]=_0x3d4c09[_0x2349('0x3e')][_0x2349('0x1f')]();}else if(_0x3d4c09[_0x2349('0x3f')]===_0x2349('0x3b')&&_0x3d4c09[_0x2349('0x40')]&&_0x3d4c09['customField']){_0xa32157[_0x2349('0x41')][_0x2349('0x42')]({'id':_0x3d4c09['idField'],'value':_0x3d4c09['content'][_0x2349('0x1f')]()});}else if(_0x3d4c09[_0x2349('0x3f')]==='variable'&&_0x3d4c09['variableName']&&_0x3d4c09[_0x2349('0x40')]&&_0x3d4c09['customField']){_0xcc143[_0x3d4c09[_0x2349('0x1a')]]&&_0xa32157['custom_fields'][_0x2349('0x42')]({'id':_0x3d4c09[_0x2349('0x40')],'value':_0xcc143[_0x3d4c09[_0x2349('0x1a')]][_0x2349('0x1f')]()});}else if(_0x3d4c09[_0x2349('0x3f')]===_0x2349('0x43')&&_0x3d4c09[_0x2349('0x44')]&&_0x3d4c09['Variable']['name']&&_0x3d4c09[_0x2349('0x40')]&&_0x3d4c09[_0x2349('0x3d')]){_0xcc143[_0x3d4c09['Variable']['name'][_0x2349('0x45')]()]&&_0xa32157[_0x2349('0x41')][_0x2349('0x42')]({'id':_0x3d4c09[_0x2349('0x40')],'value':_0xcc143[_0x3d4c09[_0x2349('0x44')]['name'][_0x2349('0x45')]()][_0x2349('0x1f')]()});}});}return _0xa32157;}function getConnection(_0x3bbe43){return request({'method':_0x2349('0x9'),'form':{'method':_0x2349('0x46'),'input_type':_0x2349('0x1b'),'response_type':_0x2349('0x1b'),'rest_data':JSON[_0x2349('0x1c')]({'user_auth':{'user_name':_0x3bbe43[_0x2349('0x47')],'password':_0x3bbe43[_0x2349('0x48')],'encryption':_0x2349('0x49')},'application':_0x2349('0x4a')})}})[_0x2349('0x31')](function(_0x507daf){var _0x2dbfb6=_0x507daf;if(_0x2dbfb6['id']){def[_0x2349('0x4b')]=_0x2dbfb6['id'];return BPromise[_0x2349('0x2a')](_0x2dbfb6);}else{throw new Error(util[_0x2349('0x36')]('Account\x20%d\x20is\x20not\x20valid',_0x3bbe43['id']));}});}function setRelationship(_0x323aab,_0x5ce974,_0x1a8ecb,_0x5d5387){return request({'form':{'method':_0x2349('0x4c'),'input_type':'JSON','response_type':_0x2349('0x1b'),'rest_data':JSON[_0x2349('0x1c')]({'session':_0x323aab['id'],'module_name':_0x2349('0x1d'),'module_id':_0x1a8ecb['id'],'link_field_name':_0x5d5387,'related_ids':[_0x5ce974['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2349('0x4d')]=function(_0x5b4aab,_0x2cd855,_0x105a3e,_0x19a723,_0xc7648c,_0x2d60b6){var _0x8a9897,_0x29e54b,_0x3c24e1,_0x16e78f;_0x2d60b6[_0x2349('0x4e')]=intUtil[_0x2349('0x4f')](_0x2d60b6[_0x2349('0x4e')]);_0x2d60b6[_0x2349('0x50')]=intUtil[_0x2349('0x4f')](_0x2d60b6[_0x2349('0x50')]);def[_0x2349('0x51')]=util['format']('%s/service/v4_1/rest.php',_0x2d60b6[_0x2349('0x4e')]);if(_0xc7648c&&_0xc7648c[_0x2349('0x52')]){logger[_0x2349('0x21')](_0x2349('0x53'),_0x2349('0x54'));_0x2cd855[_0x2349('0x55')]=util['format'](_0x2349('0x56'),_0x2d60b6[_0x2349('0x50')],_0x2cd855[_0x2349('0x57')],md5(_0x2cd855[_0x2349('0x57')]));}else{_0x2cd855[_0x2349('0x55')]='';}return getConnection(_0x2d60b6)[_0x2349('0x31')](function(_0x52f7bd){_0x16e78f=_0x52f7bd;return getUser(_0x2d60b6,_0x19a723[_0x2349('0xc')],_0x16e78f);})[_0x2349('0x31')](function(_0x4b8958){_0x8a9897=_0x4b8958;logger[_0x2349('0x21')](_0x2349('0x58'),_0x8a9897['id']);return getEndUser(_0x2d60b6,_0x2cd855[_0x2349('0x59')],_0x2cd855['calleridnum'],_0x16e78f);})[_0x2349('0x31')](function(_0x4d45b2){_0x29e54b=_0x4d45b2;logger[_0x2349('0x21')](_0x2349('0x5a'),_0x29e54b['id']);return getTicket(_0x2d60b6,_0x8a9897,_0x29e54b,_0x105a3e,_0x2cd855,_0x105a3e[_0x2349('0x5b')],_0x16e78f,_0x2349('0x5c'));})['then'](function(_0x17f5a6){_0x3c24e1=_0x17f5a6;logger[_0x2349('0x21')](_0x2349('0x5d'));logger[_0x2349('0x21')]('The\x20Ticket\x20ID\x20is:',_0x3c24e1['id']);return setRelationship(_0x16e78f,_0x8a9897,_0x3c24e1,_0x2349('0x5e'));})['then'](function(){return setRelationship(_0x16e78f,_0x29e54b,_0x3c24e1,_0x2349('0x5f'));})[_0x2349('0x31')](function(){return getServerInfo(_0x16e78f);})[_0x2349('0x31')](function(_0x58bfe8){var _0x38b034=parseInt(_0x58bfe8[_0x2349('0x60')][_0x2349('0x61')](0x0));var _0x288e1d=util[_0x2349('0x36')](_0x2349('0x62'),_0x2d60b6[_0x2349('0x4e')],_0x3c24e1['id']);if(_0x38b034>0x6){_0x288e1d=util['format'](_0x2349('0x63'),_0x2d60b6[_0x2349('0x4e')],_0x3c24e1['id']);}logger[_0x2349('0x21')]('[QUEUE]',_0x2349('0x64'));emit(util[_0x2349('0x36')](_0x2349('0x65'),_0x19a723['name']),_0x2349('0x66'),{'uri':_0x288e1d});})[_0x2349('0x67')](function(_0x144160){logger[_0x2349('0x68')](_0x2349('0x53'),JSON['stringify'](_0x144160));});};exports['outbound']=function(_0x10075e,_0x1d17f6,_0x47831c,_0x2aff93,_0x1fcae5,_0x23f306,_0x110e0c){var _0x28a0d0,_0x224783,_0x18ac37,_0x39a1e1;_0x23f306[_0x2349('0x4e')]=intUtil['stripTrailingSlash'](_0x23f306[_0x2349('0x4e')]);_0x23f306[_0x2349('0x50')]=intUtil[_0x2349('0x4f')](_0x23f306[_0x2349('0x50')]);def['uri']=util['format'](_0x2349('0x69'),_0x23f306[_0x2349('0x4e')]);if(_0x110e0c&&_0x110e0c[_0x2349('0x6a')]&&_0x110e0c[_0x2349('0x6a')]!==_0x2349('0x6b')){logger[_0x2349('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1d17f6[_0x2349('0x55')]=util['format'](_0x2349('0x56'),_0x23f306['serverUrl'],_0x1d17f6[_0x2349('0x57')],md5(_0x1d17f6[_0x2349('0x57')]));}return getConnection(_0x23f306)[_0x2349('0x31')](function(_0x317252){_0x39a1e1=_0x317252;return getUser(_0x23f306,_0x2aff93[_0x2349('0xc')],_0x39a1e1);})['then'](function(_0x107508){_0x28a0d0=_0x107508;logger[_0x2349('0x21')](_0x2349('0x58'),_0x28a0d0['id']);return getEndUser(_0x23f306,_0x1d17f6['destcalleridname'],_0x1d17f6['destcalleridnum'],_0x39a1e1);})[_0x2349('0x31')](function(_0x14f6ca){_0x224783=_0x14f6ca;logger['info']('The\x20Enduser\x20ID\x20is:',_0x224783['id']);return getTicket(_0x23f306,_0x28a0d0,_0x224783,_0x47831c,_0x1d17f6,_0x47831c['Fields'],_0x39a1e1,'Outbound');})[_0x2349('0x31')](function(_0x1f1b9a){_0x18ac37=_0x1f1b9a;logger['info'](_0x2349('0x5d'));logger[_0x2349('0x21')](_0x2349('0x6c'),_0x18ac37['id']);return setRelationship(_0x39a1e1,_0x28a0d0,_0x18ac37,_0x2349('0x5e'));})[_0x2349('0x31')](function(){return setRelationship(_0x39a1e1,_0x224783,_0x18ac37,_0x2349('0x5f'));})[_0x2349('0x31')](function(){return getServerInfo(_0x39a1e1);})[_0x2349('0x31')](function(_0x212c56){var _0x1a3aa6=parseInt(_0x212c56[_0x2349('0x60')][_0x2349('0x61')](0x0));var _0x39a604=util[_0x2349('0x36')](_0x2349('0x62'),_0x23f306[_0x2349('0x4e')],_0x18ac37['id']);if(_0x1a3aa6>0x6){_0x39a604=util['format'](_0x2349('0x63'),_0x23f306['remoteUri'],_0x18ac37['id']);}logger['info']('[OUTBOUND]',_0x2349('0x64'));emit(util['format'](_0x2349('0x65'),_0x2aff93[_0x2349('0xc')]),_0x2349('0x66'),{'uri':_0x39a604});})[_0x2349('0x67')](function(_0xaf9fe7){logger['error'](_0x2349('0x6d'),JSON['stringify'](_0xaf9fe7));});};exports[_0x2349('0x6e')]=function(_0x5bb8b4,_0x26265b,_0x1f3258,_0x27a760,_0x10915b,_0x50f208){var _0x5d6ab1,_0x6afc5b,_0x5b3a19,_0x117546;_0x50f208[_0x2349('0x4e')]=intUtil['stripTrailingSlash'](_0x50f208[_0x2349('0x4e')]);_0x50f208[_0x2349('0x50')]=intUtil[_0x2349('0x4f')](_0x50f208[_0x2349('0x50')]);def[_0x2349('0x51')]=util[_0x2349('0x36')]('%s/service/v4_1/rest.php',_0x50f208[_0x2349('0x4e')]);if(_0x10915b&&_0x10915b[_0x2349('0x52')]){logger['info']('['+_0x26265b[_0x2349('0x6f')]['toUpperCase']()+']',_0x2349('0x54'));_0x26265b[_0x2349('0x55')]=util['format'](_0x2349('0x56'),_0x50f208[_0x2349('0x50')],_0x26265b[_0x2349('0x57')],md5(_0x26265b['uniqueid']));}else{_0x26265b[_0x2349('0x55')]='';}return getConnection(_0x50f208)[_0x2349('0x31')](function(_0x22b627){_0x117546=_0x22b627;if(!_[_0x2349('0x70')](_0x27a760)){return getUser(_0x50f208,_0x27a760[_0x2349('0xc')],_0x117546);}else{return getUser(_0x50f208,null,_0x117546);}})[_0x2349('0x31')](function(_0x354f8a){_0x5d6ab1=_0x354f8a;logger[_0x2349('0x21')](_0x2349('0x58'),_0x5d6ab1['id']);return getEndUser(_0x50f208,_0x26265b[_0x2349('0x59')],_0x26265b[_0x2349('0x71')],_0x117546);})[_0x2349('0x31')](function(_0x4e59f4){_0x6afc5b=_0x4e59f4;logger[_0x2349('0x21')](_0x2349('0x5a'),_0x6afc5b['id']);return getTicket(_0x50f208,_0x5d6ab1,_0x6afc5b,_0x1f3258,_0x26265b,_0x1f3258[_0x2349('0x5b')],_0x117546,_0x2349('0x5c'));})[_0x2349('0x31')](function(_0x491abd){_0x5b3a19=_0x491abd;logger[_0x2349('0x21')](_0x2349('0x5d'));logger[_0x2349('0x21')]('The\x20Ticket\x20ID\x20is:',_0x5b3a19['id']);return setRelationship(_0x117546,_0x5d6ab1,_0x5b3a19,_0x2349('0x5e'));})[_0x2349('0x31')](function(){return setRelationship(_0x117546,_0x6afc5b,_0x5b3a19,_0x2349('0x5f'));})[_0x2349('0x31')](function(){return getServerInfo(_0x117546);})['catch'](function(_0x2dbc90){logger['error']('['+_0x26265b[_0x2349('0x6f')]['toUpperCase']()+']',JSON[_0x2349('0x1c')](_0x2dbc90));});}; \ 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 0495e86..53619fa 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 _0xb336=['string','push','content','variableName','toString','Variable','name','toLowerCase','type','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','slice','substring','lastIndexOf','isNil','test','util','getString','length','sortBy'];(function(_0x19362a,_0x126dfe){var _0x39c212=function(_0x65d587){while(--_0x65d587){_0x19362a['push'](_0x19362a['shift']());}};_0x39c212(++_0x126dfe);}(_0xb336,0x168));var _0x6b33=function(_0x3b221d,_0x460fea){_0x3b221d=_0x3b221d-0x0;var _0x3d9cf0=_0xb336[_0x3b221d];return _0x3d9cf0;};'use strict';var _=require('lodash');var util=require(_0x6b33('0x0'));exports[_0x6b33('0x1')]=function(_0x36a567,_0x14e829,_0x4bb4d1){var _0x1c9380=[];if(_0x36a567[_0x6b33('0x2')]>0x0){var _0x3bac0f=_[_0x6b33('0x3')](_0x36a567,['id']);for(var _0x549887=0x0;_0x549887<_0x3bac0f[_0x6b33('0x2')];_0x549887++){var _0x237f8c=_0x3bac0f[_0x549887];if(_0x237f8c['type']===_0x6b33('0x4')){_0x1c9380[_0x6b33('0x5')](_0x237f8c[_0x6b33('0x6')]);}else if(_0x237f8c['type']==='variable'&&_0x237f8c['variableName']){_0x14e829[_0x237f8c[_0x6b33('0x7')]]&&_0x1c9380[_0x6b33('0x5')](_0x14e829[_0x237f8c['variableName']][_0x6b33('0x8')]());}else if(_0x237f8c['type']==='customVariable'&&_0x237f8c[_0x6b33('0x9')]&&_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]){_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]['toLowerCase']()]&&_0x1c9380['push'](_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')][_0x6b33('0xb')]()][_0x6b33('0x8')]());}else if(_0x237f8c[_0x6b33('0xc')]===_0x6b33('0xd')){if(_0x237f8c[_0x6b33('0xe')]===_0x6b33('0x4')&&_0x237f8c[_0x6b33('0xf')]){_0x1c9380['push'](util[_0x6b33('0x10')](_0x6b33('0x11'),_0x237f8c[_0x6b33('0xf')],_0x237f8c[_0x6b33('0x12')]));}else if(_0x237f8c[_0x6b33('0xe')]==='variable'&&_0x237f8c[_0x6b33('0x7')]&&_0x237f8c[_0x6b33('0xf')]){_0x14e829[_0x237f8c[_0x6b33('0x7')]]&&_0x1c9380[_0x6b33('0x5')](util['format'](_0x6b33('0x11'),_0x237f8c[_0x6b33('0xf')],_0x14e829[_0x237f8c[_0x6b33('0x7')]]));}else if(_0x237f8c[_0x6b33('0xe')]===_0x6b33('0x13')&&_0x237f8c[_0x6b33('0x9')]&&_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]&&_0x237f8c[_0x6b33('0xf')]){_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')][_0x6b33('0xb')]()]&&_0x1c9380[_0x6b33('0x5')](util[_0x6b33('0x10')]('%s:\x20%s',_0x237f8c['key'],_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]['toLowerCase']()]));}}}}return _0x1c9380[_0x6b33('0x14')](_0x4bb4d1);};exports['stripTrailingSlash']=function(_0x4c4f86){var _0x4200a0=_0x4c4f86[_0x6b33('0x15')](-0x1);if(_0x4200a0==='/'){_0x4c4f86=_0x4c4f86[_0x6b33('0x16')](0x0,_0x4c4f86[_0x6b33('0x17')](_0x4200a0));}return _0x4c4f86;};exports['validateEmail']=function(_0xca8f36){if(!_[_0x6b33('0x18')](_0xca8f36)&&_0xca8f36!==''){var _0x5a8b85=/^(([^<>()\[\]\\.,;:\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 _0x5a8b85[_0x6b33('0x19')](String(_0xca8f36)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xb548=['%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length','sortBy','string','push','content','variable','variableName','type','customVariable','Variable','name','toLowerCase','toString','keyType','key','format'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb548,0x75));var _0x8b54=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xb548[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0x8b54('0x0'));var util=require('util');exports[_0x8b54('0x1')]=function(_0x55efec,_0x53a5af,_0x455bf7){var _0x51c1f7=[];if(_0x55efec[_0x8b54('0x2')]>0x0){var _0x2011e4=_[_0x8b54('0x3')](_0x55efec,['id']);for(var _0x58e6ca=0x0;_0x58e6ca<_0x2011e4[_0x8b54('0x2')];_0x58e6ca++){var _0x18c6d4=_0x2011e4[_0x58e6ca];if(_0x18c6d4['type']===_0x8b54('0x4')){_0x51c1f7[_0x8b54('0x5')](_0x18c6d4[_0x8b54('0x6')]);}else if(_0x18c6d4['type']===_0x8b54('0x7')&&_0x18c6d4[_0x8b54('0x8')]){_0x53a5af[_0x18c6d4['variableName']]&&_0x51c1f7['push'](_0x53a5af[_0x18c6d4[_0x8b54('0x8')]]['toString']());}else if(_0x18c6d4[_0x8b54('0x9')]===_0x8b54('0xa')&&_0x18c6d4[_0x8b54('0xb')]&&_0x18c6d4[_0x8b54('0xb')][_0x8b54('0xc')]){_0x53a5af[_0x18c6d4[_0x8b54('0xb')][_0x8b54('0xc')][_0x8b54('0xd')]()]&&_0x51c1f7[_0x8b54('0x5')](_0x53a5af[_0x18c6d4[_0x8b54('0xb')][_0x8b54('0xc')][_0x8b54('0xd')]()][_0x8b54('0xe')]());}else if(_0x18c6d4[_0x8b54('0x9')]==='keyValue'){if(_0x18c6d4[_0x8b54('0xf')]===_0x8b54('0x4')&&_0x18c6d4[_0x8b54('0x10')]){_0x51c1f7[_0x8b54('0x5')](util[_0x8b54('0x11')](_0x8b54('0x12'),_0x18c6d4[_0x8b54('0x10')],_0x18c6d4[_0x8b54('0x13')]));}else if(_0x18c6d4[_0x8b54('0xf')]===_0x8b54('0x7')&&_0x18c6d4[_0x8b54('0x8')]&&_0x18c6d4['key']){_0x53a5af[_0x18c6d4[_0x8b54('0x8')]]&&_0x51c1f7[_0x8b54('0x5')](util[_0x8b54('0x11')](_0x8b54('0x12'),_0x18c6d4[_0x8b54('0x10')],_0x53a5af[_0x18c6d4['variableName']]));}else if(_0x18c6d4['keyType']===_0x8b54('0xa')&&_0x18c6d4['Variable']&&_0x18c6d4[_0x8b54('0xb')]['name']&&_0x18c6d4[_0x8b54('0x10')]){_0x53a5af[_0x18c6d4[_0x8b54('0xb')][_0x8b54('0xc')]['toLowerCase']()]&&_0x51c1f7['push'](util[_0x8b54('0x11')](_0x8b54('0x12'),_0x18c6d4[_0x8b54('0x10')],_0x53a5af[_0x18c6d4[_0x8b54('0xb')]['name'][_0x8b54('0xd')]()]));}}}}return _0x51c1f7[_0x8b54('0x14')](_0x455bf7);};exports[_0x8b54('0x15')]=function(_0x34518e){var _0x4dce58=_0x34518e[_0x8b54('0x16')](-0x1);if(_0x4dce58==='/'){_0x34518e=_0x34518e[_0x8b54('0x17')](0x0,_0x34518e[_0x8b54('0x18')](_0x4dce58));}return _0x34518e;};exports[_0x8b54('0x19')]=function(_0x20522a){if(!_['isNil'](_0x20522a)&&_0x20522a!==''){var _0x4dd3e2=/^(([^<>()\[\]\\.,;:\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 _0x4dd3e2[_0x8b54('0x1a')](String(_0x20522a)[_0x8b54('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 e6e0ea6..1067b81 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x16ef78,_0x251f60){var _0x352117=function(_0x668cd8){while(--_0x668cd8){_0x16ef78['push'](_0x16ef78['shift']());}};_0x352117(++_0x251f60);}(_0xe706,0xa3));var _0x6e70=function(_0x378a48,_0x5b012f){_0x378a48=_0x378a48-0x0;var _0x1538c5=_0xe706[_0x378a48];return _0x1538c5;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4af6a3d..703348e 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 _0x9f18=['destcalleridnum','[OUTBOUND]','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','then','info','ticket','validateEmail','%s/search.json','remoteUri','format','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','destcalleridname'];(function(_0x53b7ca,_0x7b041d){var _0x4a64bd=function(_0x2f2d03){while(--_0x2f2d03){_0x53b7ca['push'](_0x53b7ca['shift']());}};_0x4a64bd(++_0x7b041d);}(_0x9f18,0xe0));var _0x89f1=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x9f18[_0x207a02];return _0xd995c3;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x89f1('0x0'));var util=require(_0x89f1('0x1'));var Redis=require(_0x89f1('0x2'));var intUtil=require(_0x89f1('0x3'));var config=require(_0x89f1('0x4'));var logger=require(_0x89f1('0x5'))('zendesk');config[_0x89f1('0x6')]=_['defaults'](config['redis'],{'host':_0x89f1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x89f1('0x6')]));function emit(_0x2574ca,_0x30f704,_0x10f4db){io['to'](_0x2574ca)[_0x89f1('0x8')](_0x30f704,_0x10f4db);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x43b9e7,_0xbe5b8f,_0x208059,_0x512c37,_0x73d74b){logger['info'](_0x89f1('0x9'));return request({'uri':util['format'](_0x89f1('0xa'),_0x43b9e7['remoteUri']),'method':_0x89f1('0xb'),'body':{'ticket':_[_0x89f1('0xc')]({'requester_id':_0x208059['id'],'submitter_id':_0xbe5b8f?_0xbe5b8f['id']:undefined,'assignee_id':_0xbe5b8f?_0xbe5b8f['id']:undefined,'tags':getTags(_0x512c37[_0x89f1('0xd')],'name'),'subject':intUtil[_0x89f1('0xe')](_0x512c37[_0x89f1('0xf')],_0x73d74b,'\x20'),'description':intUtil['getString'](_0x512c37['Descriptions'],_0x73d74b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x89f1('0xe')](_0x512c37[_0x89f1('0x10')],_0x73d74b,'\x0a')}},getCustomFields(_0x512c37['Fields'],_0x73d74b))}})[_0x89f1('0x11')](function(_0x49aa2b){logger[_0x89f1('0x12')]('Ticket\x20created!');return _0x49aa2b[_0x89f1('0x13')];});}function getUser(_0x4eb578,_0x3b7689){if(intUtil[_0x89f1('0x14')](_0x3b7689)){logger[_0x89f1('0x12')]('Getting\x20agent\x20with\x20email',_0x3b7689);return request({'uri':util['format'](_0x89f1('0x15'),_0x4eb578[_0x89f1('0x16')]),'qs':{'query':util[_0x89f1('0x17')](_0x89f1('0x18'),_0x3b7689)}})[_0x89f1('0x11')](function(_0x2f8d57){if(_0x2f8d57['count']){logger[_0x89f1('0x12')](_0x89f1('0x19'));return _[_0x89f1('0x1a')](_0x2f8d57['results'],{'email':_0x3b7689,'role':_0x89f1('0x1b')});}else{logger[_0x89f1('0x12')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x89f1('0x17')]('%s/users/me.json',_0x4eb578['remoteUri'])})[_0x89f1('0x11')](function(_0x3df17b){logger['info'](_0x89f1('0x1c'));return _0x3df17b['user'];});}});}else{logger[_0x89f1('0x12')](_0x89f1('0x1d'));return request({'uri':util[_0x89f1('0x17')]('%s/users/me.json',_0x4eb578['remoteUri'])})['then'](function(_0x17c88c){logger['info'](_0x89f1('0x1c'));return _0x17c88c[_0x89f1('0x1e')];});}}function getEndUser(_0x51b106,_0x4f3257,_0x472569){logger[_0x89f1('0x12')]('Searching\x20enduser\x20with\x20phone',_0x472569);return request({'uri':util[_0x89f1('0x17')](_0x89f1('0x15'),_0x51b106[_0x89f1('0x16')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x472569)}})[_0x89f1('0x11')](function(_0x20626d){var _0x281889;if(_0x20626d[_0x89f1('0x1f')][_0x89f1('0x20')]){_0x20626d[_0x89f1('0x1f')]=_[_0x89f1('0x21')](_0x20626d[_0x89f1('0x1f')],{'suspended':![],'role':_0x89f1('0x22')});if(_0x20626d['results']['length']){_0x281889=_[_0x89f1('0x23')](_0x20626d[_0x89f1('0x1f')]);}}if(_0x281889){logger[_0x89f1('0x12')](_0x89f1('0x24'));return _0x281889;}else{logger[_0x89f1('0x12')](_0x89f1('0x25'));return request({'uri':util[_0x89f1('0x17')](_0x89f1('0x26'),_0x51b106[_0x89f1('0x16')]),'method':_0x89f1('0xb'),'body':{'user':{'role':_0x89f1('0x22'),'name':util[_0x89f1('0x17')]('Caller\x20-\x20%s',_0x4f3257||_0x472569),'phone':_0x472569}}})[_0x89f1('0x11')](function(_0x2967de){logger['info'](_0x89f1('0x27'));return _0x2967de[_0x89f1('0x1e')];});}});}function getAuth(_0x5f1393){var _0x34c6dc;if(_0x5f1393['authType']===_0x89f1('0x28')){_0x34c6dc=util['format'](_0x89f1('0x29'),_0x5f1393[_0x89f1('0x2a')],_0x5f1393[_0x89f1('0x28')]);}else if(_0x5f1393[_0x89f1('0x2b')]===_0x89f1('0x2c')){_0x34c6dc=util[_0x89f1('0x17')](_0x89f1('0x2d'),_0x5f1393[_0x89f1('0x2a')],_0x5f1393[_0x89f1('0x2c')]);}return util[_0x89f1('0x17')](_0x89f1('0x2e'),new Buffer(_0x34c6dc)[_0x89f1('0x2f')]('base64'));}function request(_0x2dbe21){logger[_0x89f1('0x30')](_0x89f1('0x31'),JSON[_0x89f1('0x32')](_0x2dbe21));return rp(_[_0x89f1('0x33')](_0x2dbe21,{'method':_0x89f1('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1fb2fc,_0x412228){var _0x53841d=[];if(_0x1fb2fc&&_0x1fb2fc[_0x89f1('0x20')]>0x0){_0x53841d=_[_0x89f1('0x35')](_0x1fb2fc,_0x412228);}return _0x53841d;}function getCustomFields(_0x20eac2,_0x27c950){var _0x55a4b9=[];var _0x1a83ef={'custom_fields':[]};if(_0x20eac2[_0x89f1('0x20')]>0x0){_['forEach'](_0x20eac2,function(_0x1b7673){if(_[_0x89f1('0x36')]([_0x89f1('0x37'),_0x89f1('0x38')],_0x1b7673[_0x89f1('0x39')])&&_0x1b7673[_0x89f1('0x3a')]&&!_0x1b7673['customField']){_0x1a83ef[_0x1b7673[_0x89f1('0x3a')][_0x89f1('0x3b')]()]=_0x1b7673[_0x89f1('0x3c')]['toString']();}else if(_[_0x89f1('0x36')]([_0x89f1('0x37'),_0x89f1('0x38')],_0x1b7673[_0x89f1('0x39')])&&_0x1b7673[_0x89f1('0x3d')]&&_0x1b7673[_0x89f1('0x3e')]){_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673['idField'],'value':_0x1b7673[_0x89f1('0x3c')][_0x89f1('0x2f')]()});}else if(_0x1b7673[_0x89f1('0x39')]==='variable'&&_0x1b7673[_0x89f1('0x41')]&&_0x1b7673['idField']&&_0x1b7673['customField']){_0x27c950[_0x1b7673['variableName']]&&_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673[_0x89f1('0x3d')],'value':_0x27c950[_0x1b7673['variableName']][_0x89f1('0x2f')]()});}else if(_0x1b7673[_0x89f1('0x39')]===_0x89f1('0x42')&&_0x1b7673[_0x89f1('0x43')]&&_0x1b7673[_0x89f1('0x43')][_0x89f1('0x44')]&&_0x1b7673['idField']&&_0x1b7673[_0x89f1('0x3e')]){_0x27c950[_0x1b7673[_0x89f1('0x43')][_0x89f1('0x44')][_0x89f1('0x3b')]()]&&_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673['idField'],'value':_0x27c950[_0x1b7673['Variable'][_0x89f1('0x44')][_0x89f1('0x3b')]()][_0x89f1('0x2f')]()});}});}return _0x1a83ef;}exports[_0x89f1('0x45')]=function(_0x3c6fec,_0x5ca10c,_0x14b25e,_0x5006e1,_0x9d8bc1,_0x569c5b){var _0x32cc74,_0x47a002;_0x569c5b[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x569c5b[_0x89f1('0x16')]);_0x569c5b[_0x89f1('0x47')]=intUtil[_0x89f1('0x46')](_0x569c5b[_0x89f1('0x47')]);if(_0x9d8bc1&&_0x9d8bc1[_0x89f1('0x48')]){logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x4a'));_0x5ca10c[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x569c5b[_0x89f1('0x47')],_0x5ca10c[_0x89f1('0x4d')],md5(_0x5ca10c[_0x89f1('0x4d')]));}else{_0x5ca10c['recordingURL']='';}headers[_0x89f1('0x4e')]=getAuth(_0x569c5b);return getUser(_0x569c5b,_0x5006e1[_0x89f1('0x4f')])[_0x89f1('0x11')](function(_0x2e7474){_0x32cc74=_0x2e7474;logger['info'](_0x89f1('0x50'),_0x32cc74['id']);return getEndUser(_0x569c5b,_0x5ca10c[_0x89f1('0x51')],_0x5ca10c['calleridnum']);})['then'](function(_0x12f004){_0x47a002=_0x12f004;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x47a002['id']);return getTicket(_0x569c5b,_0x32cc74,_0x47a002,_0x14b25e,_0x5ca10c);})['then'](function(_0x11cf01){if(_0x11cf01){logger[_0x89f1('0x12')](_0x89f1('0x53'),_0x11cf01['id']);switch(_0x569c5b['type']){case _0x89f1('0x54'):logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x55'));return request({'uri':util[_0x89f1('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x569c5b[_0x89f1('0x16')],_0x32cc74['id'],_0x11cf01['id']),'method':'POST'});case _0x89f1('0x56'):logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x57'));emit(util[_0x89f1('0x17')](_0x89f1('0x58'),_0x5006e1[_0x89f1('0x44')]),_0x89f1('0x59'),{'uri':util[_0x89f1('0x17')](_0x89f1('0x5a'),_0x569c5b[_0x89f1('0x16')][_0x89f1('0x5b')](_0x89f1('0x5c'),''),_0x11cf01['id'])});break;default:logger[_0x89f1('0x5d')]('[QUEUE]',_0x89f1('0x5e'));}}})['catch'](function(_0x9fc324){logger['error'](_0x89f1('0x5f'),util[_0x89f1('0x60')](_0x9fc324,{'showHidden':!![],'depth':null}));});};exports[_0x89f1('0x61')]=function(_0x5764cc,_0x3c492a,_0x35f4d8,_0x34bb0b,_0x3922af,_0x2e10ac,_0x2ff2db){var _0x2a2b39,_0x20331d;_0x2e10ac[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x2e10ac[_0x89f1('0x16')]);_0x2e10ac['serverUrl']=intUtil[_0x89f1('0x46')](_0x2e10ac[_0x89f1('0x47')]);if(_0x2ff2db&&_0x2ff2db['recordingFormat']&&_0x2ff2db[_0x89f1('0x62')]!=='none'){logger[_0x89f1('0x12')]('[OUTBOUND]',_0x89f1('0x4a'));_0x3c492a[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x2e10ac[_0x89f1('0x47')],_0x3c492a[_0x89f1('0x4d')],md5(_0x3c492a[_0x89f1('0x4d')]));}headers['Authorization']=getAuth(_0x2e10ac);return getUser(_0x2e10ac,_0x34bb0b[_0x89f1('0x4f')])[_0x89f1('0x11')](function(_0x5889de){_0x2a2b39=_0x5889de;logger['info'](_0x89f1('0x50'),_0x2a2b39['id']);return getEndUser(_0x2e10ac,_0x3c492a[_0x89f1('0x63')],_0x3c492a[_0x89f1('0x64')]);})[_0x89f1('0x11')](function(_0x786cff){_0x20331d=_0x786cff;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x20331d['id']);return getTicket(_0x2e10ac,_0x2a2b39,_0x20331d,_0x35f4d8,_0x3c492a);})[_0x89f1('0x11')](function(_0x39c026){if(_0x39c026){logger['info'](_0x89f1('0x53'),_0x39c026['id']);switch(_0x2e10ac['type']){case _0x89f1('0x54'):logger['info']('[OUTBOUND]',_0x89f1('0x55'));return request({'uri':util[_0x89f1('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2e10ac[_0x89f1('0x16')],_0x2a2b39['id'],_0x39c026['id']),'method':_0x89f1('0xb')});case'newTab':logger['info'](_0x89f1('0x65'),_0x89f1('0x57'));emit(util['format'](_0x89f1('0x58'),_0x34bb0b[_0x89f1('0x44')]),_0x89f1('0x59'),{'uri':util[_0x89f1('0x17')]('%s/agent/tickets/%s',_0x2e10ac[_0x89f1('0x16')][_0x89f1('0x5b')]('/api/v2',''),_0x39c026['id'])});break;default:logger[_0x89f1('0x5d')](_0x89f1('0x65'),_0x89f1('0x5e'));}}})[_0x89f1('0x66')](function(_0x2df2a5){logger['error'](_0x89f1('0x67'),util[_0x89f1('0x60')](_0x2df2a5,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x58fd1e,_0xec71e8,_0x27406,_0x241be2,_0x13adde,_0x58961f){var _0x14dbe4,_0x4d18e2;_0x58961f[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x58961f['remoteUri']);_0x58961f[_0x89f1('0x47')]=intUtil['stripTrailingSlash'](_0x58961f['serverUrl']);if(_0x13adde&&_0x13adde['monitor_format']){logger[_0x89f1('0x12')]('['+_0xec71e8[_0x89f1('0x68')][_0x89f1('0x69')]()+']',_0x89f1('0x4a'));_0xec71e8[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x58961f['serverUrl'],_0xec71e8[_0x89f1('0x4d')],md5(_0xec71e8['uniqueid']));}else{_0xec71e8['recordingURL']='';}headers[_0x89f1('0x4e')]=getAuth(_0x58961f);return getUser(_0x58961f)['then'](function(_0x5eac76){_0x14dbe4=_0x5eac76;logger[_0x89f1('0x12')](_0x89f1('0x50'),_0x14dbe4['id']);return getEndUser(_0x58961f,_0xec71e8[_0x89f1('0x51')],_0xec71e8[_0x89f1('0x6a')]);})['then'](function(_0x32d49e){_0x4d18e2=_0x32d49e;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x4d18e2['id']);return getTicket(_0x58961f,_0x14dbe4,_0x4d18e2,_0x27406,_0xec71e8);})['then'](function(_0x5d2315){if(_0x5d2315){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5d2315['id']);}})['catch'](function(_0x501b30){logger[_0x89f1('0x5d')]('['+_0xec71e8[_0x89f1('0x68')][_0x89f1('0x69')]()+']'+_0x89f1('0x6b'),util['inspect'](_0x501b30,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2b56=['The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/logger','zendesk','defaults','localhost','redis','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','info','Agent\x20found!','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','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','debug','[HTTP]','GET','map','picklist','type','customField','toLowerCase','content','toString','includes','push','idField','variableName','customVariable','Variable','custom_fields','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email'];(function(_0x40458f,_0x517249){var _0x2c2053=function(_0x15702e){while(--_0x15702e){_0x40458f['push'](_0x40458f['shift']());}};_0x2c2053(++_0x517249);}(_0x2b56,0x160));var _0x62b5=function(_0x8fc552,_0x140e98){_0x8fc552=_0x8fc552-0x0;var _0x2da60b=_0x2b56[_0x8fc552];return _0x2da60b;};'use strict';var _=require(_0x62b5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x62b5('0x1'));var Redis=require(_0x62b5('0x2'));var intUtil=require(_0x62b5('0x3'));var config=require('../../../../config/environment');var logger=require(_0x62b5('0x4'))(_0x62b5('0x5'));config['redis']=_[_0x62b5('0x6')](config['redis'],{'host':_0x62b5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x62b5('0x8')]));function emit(_0x376010,_0x328962,_0x3802c2){io['to'](_0x376010)['emit'](_0x328962,_0x3802c2);}var headers={'Content-Type':'application/json','Accept':_0x62b5('0x9')};function getTicket(_0x512cff,_0x1d61e5,_0x912e9d,_0x2a4eaa,_0x59a8a5){logger['info'](_0x62b5('0xa'));return request({'uri':util['format'](_0x62b5('0xb'),_0x512cff[_0x62b5('0xc')]),'method':_0x62b5('0xd'),'body':{'ticket':_[_0x62b5('0xe')]({'requester_id':_0x912e9d['id'],'submitter_id':_0x1d61e5?_0x1d61e5['id']:undefined,'assignee_id':_0x1d61e5?_0x1d61e5['id']:undefined,'tags':getTags(_0x2a4eaa[_0x62b5('0xf')],_0x62b5('0x10')),'subject':intUtil[_0x62b5('0x11')](_0x2a4eaa[_0x62b5('0x12')],_0x59a8a5,'\x20'),'description':intUtil[_0x62b5('0x11')](_0x2a4eaa[_0x62b5('0x13')],_0x59a8a5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2a4eaa[_0x62b5('0x13')],_0x59a8a5,'\x0a')}},getCustomFields(_0x2a4eaa['Fields'],_0x59a8a5))}})[_0x62b5('0x14')](function(_0x5c64da){logger['info'](_0x62b5('0x15'));return _0x5c64da[_0x62b5('0x16')];});}function getUser(_0x170489,_0x1aad42){if(intUtil[_0x62b5('0x17')](_0x1aad42)){logger['info'](_0x62b5('0x18'),_0x1aad42);return request({'uri':util[_0x62b5('0x19')](_0x62b5('0x1a'),_0x170489[_0x62b5('0xc')]),'qs':{'query':util[_0x62b5('0x19')](_0x62b5('0x1b'),_0x1aad42)}})['then'](function(_0x365919){if(_0x365919['count']){logger[_0x62b5('0x1c')](_0x62b5('0x1d'));return _[_0x62b5('0x1e')](_0x365919[_0x62b5('0x1f')],{'email':_0x1aad42,'role':_0x62b5('0x20')});}else{logger[_0x62b5('0x1c')](_0x62b5('0x21'));return request({'uri':util['format'](_0x62b5('0x22'),_0x170489['remoteUri'])})['then'](function(_0x46dec9){logger[_0x62b5('0x1c')](_0x62b5('0x23'));return _0x46dec9[_0x62b5('0x24')];});}});}else{logger[_0x62b5('0x1c')](_0x62b5('0x21'));return request({'uri':util[_0x62b5('0x19')](_0x62b5('0x22'),_0x170489[_0x62b5('0xc')])})[_0x62b5('0x14')](function(_0x39ec56){logger[_0x62b5('0x1c')](_0x62b5('0x23'));return _0x39ec56[_0x62b5('0x24')];});}}function getEndUser(_0xa66717,_0xf9fbdb,_0x2c3081){logger[_0x62b5('0x1c')](_0x62b5('0x25'),_0x2c3081);return request({'uri':util['format'](_0x62b5('0x1a'),_0xa66717['remoteUri']),'qs':{'query':util[_0x62b5('0x19')](_0x62b5('0x26'),_0x2c3081)}})[_0x62b5('0x14')](function(_0x2d7251){var _0x4f7be0;if(_0x2d7251['results'][_0x62b5('0x27')]){_0x2d7251['results']=_[_0x62b5('0x28')](_0x2d7251['results'],{'suspended':![],'role':_0x62b5('0x29')});if(_0x2d7251[_0x62b5('0x1f')][_0x62b5('0x27')]){_0x4f7be0=_[_0x62b5('0x2a')](_0x2d7251[_0x62b5('0x1f')]);}}if(_0x4f7be0){logger[_0x62b5('0x1c')]('Enduser\x20found!');return _0x4f7be0;}else{logger[_0x62b5('0x1c')](_0x62b5('0x2b'));return request({'uri':util[_0x62b5('0x19')]('%s/users.json',_0xa66717['remoteUri']),'method':_0x62b5('0xd'),'body':{'user':{'role':_0x62b5('0x29'),'name':util[_0x62b5('0x19')](_0x62b5('0x2c'),_0xf9fbdb||_0x2c3081),'phone':_0x2c3081}}})[_0x62b5('0x14')](function(_0x78c7ba){logger['info'](_0x62b5('0x2d'));return _0x78c7ba['user'];});}});}function getAuth(_0x37147b){var _0x2ac838;if(_0x37147b['authType']==='password'){_0x2ac838=util[_0x62b5('0x19')](_0x62b5('0x2e'),_0x37147b['username'],_0x37147b['password']);}else if(_0x37147b[_0x62b5('0x2f')]===_0x62b5('0x30')){_0x2ac838=util['format'](_0x62b5('0x31'),_0x37147b[_0x62b5('0x32')],_0x37147b[_0x62b5('0x30')]);}return util[_0x62b5('0x19')](_0x62b5('0x33'),new Buffer(_0x2ac838)['toString']('base64'));}function request(_0x3b767d){logger[_0x62b5('0x34')](_0x62b5('0x35'),JSON['stringify'](_0x3b767d));return rp(_[_0x62b5('0x6')](_0x3b767d,{'method':_0x62b5('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x371fdd,_0x5953dc){var _0x520af6=[];if(_0x371fdd&&_0x371fdd[_0x62b5('0x27')]>0x0){_0x520af6=_[_0x62b5('0x37')](_0x371fdd,_0x5953dc);}return _0x520af6;}function getCustomFields(_0x4debc8,_0x1808c6){var _0x201b6c=[];var _0x3a56f4={'custom_fields':[]};if(_0x4debc8[_0x62b5('0x27')]>0x0){_['forEach'](_0x4debc8,function(_0xf0cde5){if(_['includes'](['string',_0x62b5('0x38')],_0xf0cde5[_0x62b5('0x39')])&&_0xf0cde5['nameField']&&!_0xf0cde5[_0x62b5('0x3a')]){_0x3a56f4[_0xf0cde5['nameField'][_0x62b5('0x3b')]()]=_0xf0cde5[_0x62b5('0x3c')][_0x62b5('0x3d')]();}else if(_[_0x62b5('0x3e')](['string',_0x62b5('0x38')],_0xf0cde5[_0x62b5('0x39')])&&_0xf0cde5['idField']&&_0xf0cde5[_0x62b5('0x3a')]){_0x3a56f4['custom_fields'][_0x62b5('0x3f')]({'id':_0xf0cde5[_0x62b5('0x40')],'value':_0xf0cde5[_0x62b5('0x3c')][_0x62b5('0x3d')]()});}else if(_0xf0cde5[_0x62b5('0x39')]==='variable'&&_0xf0cde5[_0x62b5('0x41')]&&_0xf0cde5[_0x62b5('0x40')]&&_0xf0cde5[_0x62b5('0x3a')]){_0x1808c6[_0xf0cde5[_0x62b5('0x41')]]&&_0x3a56f4['custom_fields'][_0x62b5('0x3f')]({'id':_0xf0cde5['idField'],'value':_0x1808c6[_0xf0cde5[_0x62b5('0x41')]][_0x62b5('0x3d')]()});}else if(_0xf0cde5[_0x62b5('0x39')]===_0x62b5('0x42')&&_0xf0cde5[_0x62b5('0x43')]&&_0xf0cde5[_0x62b5('0x43')]['name']&&_0xf0cde5['idField']&&_0xf0cde5[_0x62b5('0x3a')]){_0x1808c6[_0xf0cde5['Variable'][_0x62b5('0x10')][_0x62b5('0x3b')]()]&&_0x3a56f4[_0x62b5('0x44')][_0x62b5('0x3f')]({'id':_0xf0cde5[_0x62b5('0x40')],'value':_0x1808c6[_0xf0cde5[_0x62b5('0x43')][_0x62b5('0x10')][_0x62b5('0x3b')]()][_0x62b5('0x3d')]()});}});}return _0x3a56f4;}exports[_0x62b5('0x45')]=function(_0xea0e87,_0xed5707,_0x375ead,_0x23b43c,_0x4d56e8,_0x46fa8a){var _0x567aa7,_0x3c2874;_0x46fa8a[_0x62b5('0xc')]=intUtil['stripTrailingSlash'](_0x46fa8a[_0x62b5('0xc')]);_0x46fa8a[_0x62b5('0x46')]=intUtil[_0x62b5('0x47')](_0x46fa8a[_0x62b5('0x46')]);if(_0x4d56e8&&_0x4d56e8[_0x62b5('0x48')]){logger['info'](_0x62b5('0x49'),_0x62b5('0x4a'));_0xed5707[_0x62b5('0x4b')]=util[_0x62b5('0x19')](_0x62b5('0x4c'),_0x46fa8a[_0x62b5('0x46')],_0xed5707[_0x62b5('0x4d')],md5(_0xed5707['uniqueid']));}else{_0xed5707[_0x62b5('0x4b')]='';}headers[_0x62b5('0x4e')]=getAuth(_0x46fa8a);return getUser(_0x46fa8a,_0x23b43c[_0x62b5('0x4f')])[_0x62b5('0x14')](function(_0x14277e){_0x567aa7=_0x14277e;logger[_0x62b5('0x1c')](_0x62b5('0x50'),_0x567aa7['id']);return getEndUser(_0x46fa8a,_0xed5707[_0x62b5('0x51')],_0xed5707['calleridnum']);})[_0x62b5('0x14')](function(_0x5b70a6){_0x3c2874=_0x5b70a6;logger['info'](_0x62b5('0x52'),_0x3c2874['id']);return getTicket(_0x46fa8a,_0x567aa7,_0x3c2874,_0x375ead,_0xed5707);})[_0x62b5('0x14')](function(_0x46171c){if(_0x46171c){logger['info'](_0x62b5('0x53'),_0x46171c['id']);switch(_0x46fa8a['type']){case _0x62b5('0x54'):logger[_0x62b5('0x1c')](_0x62b5('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x62b5('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x46fa8a[_0x62b5('0xc')],_0x567aa7['id'],_0x46171c['id']),'method':_0x62b5('0xd')});case _0x62b5('0x55'):logger['info'](_0x62b5('0x49'),_0x62b5('0x56'));emit(util[_0x62b5('0x19')](_0x62b5('0x57'),_0x23b43c['name']),_0x62b5('0x58'),{'uri':util[_0x62b5('0x19')](_0x62b5('0x59'),_0x46fa8a[_0x62b5('0xc')][_0x62b5('0x5a')](_0x62b5('0x5b'),''),_0x46171c['id'])});break;default:logger['error'](_0x62b5('0x49'),_0x62b5('0x5c'));}}})[_0x62b5('0x5d')](function(_0x315506){logger[_0x62b5('0x5e')](_0x62b5('0x5f'),util[_0x62b5('0x60')](_0x315506,{'showHidden':!![],'depth':null}));});};exports[_0x62b5('0x61')]=function(_0xc2ec48,_0x20aae5,_0x3d3d44,_0x326bab,_0x326b19,_0x13728e,_0xbcb6c5){var _0x4c76fb,_0x185c7b;_0x13728e[_0x62b5('0xc')]=intUtil[_0x62b5('0x47')](_0x13728e[_0x62b5('0xc')]);_0x13728e['serverUrl']=intUtil[_0x62b5('0x47')](_0x13728e['serverUrl']);if(_0xbcb6c5&&_0xbcb6c5[_0x62b5('0x62')]&&_0xbcb6c5[_0x62b5('0x62')]!==_0x62b5('0x63')){logger[_0x62b5('0x1c')](_0x62b5('0x64'),'Recording\x20is\x20enabled!');_0x20aae5['recordingURL']=util[_0x62b5('0x19')](_0x62b5('0x4c'),_0x13728e[_0x62b5('0x46')],_0x20aae5[_0x62b5('0x4d')],md5(_0x20aae5[_0x62b5('0x4d')]));}headers['Authorization']=getAuth(_0x13728e);return getUser(_0x13728e,_0x326bab[_0x62b5('0x4f')])[_0x62b5('0x14')](function(_0x3e6072){_0x4c76fb=_0x3e6072;logger[_0x62b5('0x1c')]('The\x20User\x20ID\x20is:',_0x4c76fb['id']);return getEndUser(_0x13728e,_0x20aae5[_0x62b5('0x65')],_0x20aae5[_0x62b5('0x66')]);})[_0x62b5('0x14')](function(_0x306db2){_0x185c7b=_0x306db2;logger[_0x62b5('0x1c')](_0x62b5('0x52'),_0x185c7b['id']);return getTicket(_0x13728e,_0x4c76fb,_0x185c7b,_0x3d3d44,_0x20aae5);})['then'](function(_0x1e0817){if(_0x1e0817){logger['info'](_0x62b5('0x53'),_0x1e0817['id']);switch(_0x13728e['type']){case _0x62b5('0x54'):logger[_0x62b5('0x1c')](_0x62b5('0x64'),_0x62b5('0x67'));return request({'uri':util[_0x62b5('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x13728e['remoteUri'],_0x4c76fb['id'],_0x1e0817['id']),'method':_0x62b5('0xd')});case _0x62b5('0x55'):logger[_0x62b5('0x1c')](_0x62b5('0x64'),_0x62b5('0x56'));emit(util[_0x62b5('0x19')]('user:%s',_0x326bab['name']),_0x62b5('0x58'),{'uri':util[_0x62b5('0x19')](_0x62b5('0x59'),_0x13728e[_0x62b5('0xc')][_0x62b5('0x5a')](_0x62b5('0x5b'),''),_0x1e0817['id'])});break;default:logger[_0x62b5('0x5e')](_0x62b5('0x64'),_0x62b5('0x5c'));}}})[_0x62b5('0x5d')](function(_0x531e8b){logger[_0x62b5('0x5e')](_0x62b5('0x68'),util['inspect'](_0x531e8b,{'showHidden':!![],'depth':null}));});};exports[_0x62b5('0x69')]=function(_0xa1c72f,_0x30bcf3,_0xee0c47,_0x10fe10,_0x2248f7,_0x26e21f){var _0x4e20d,_0x45568f;_0x26e21f[_0x62b5('0xc')]=intUtil['stripTrailingSlash'](_0x26e21f['remoteUri']);_0x26e21f[_0x62b5('0x46')]=intUtil[_0x62b5('0x47')](_0x26e21f[_0x62b5('0x46')]);if(_0x2248f7&&_0x2248f7[_0x62b5('0x48')]){logger[_0x62b5('0x1c')]('['+_0x30bcf3['lastevent'][_0x62b5('0x6a')]()+']',_0x62b5('0x4a'));_0x30bcf3[_0x62b5('0x4b')]=util[_0x62b5('0x19')](_0x62b5('0x4c'),_0x26e21f['serverUrl'],_0x30bcf3['uniqueid'],md5(_0x30bcf3[_0x62b5('0x4d')]));}else{_0x30bcf3[_0x62b5('0x4b')]='';}headers[_0x62b5('0x4e')]=getAuth(_0x26e21f);return getUser(_0x26e21f)[_0x62b5('0x14')](function(_0x5e8b60){_0x4e20d=_0x5e8b60;logger[_0x62b5('0x1c')](_0x62b5('0x50'),_0x4e20d['id']);return getEndUser(_0x26e21f,_0x30bcf3[_0x62b5('0x51')],_0x30bcf3['calleridnum']);})['then'](function(_0x5c3663){_0x45568f=_0x5c3663;logger[_0x62b5('0x1c')](_0x62b5('0x52'),_0x45568f['id']);return getTicket(_0x26e21f,_0x4e20d,_0x45568f,_0xee0c47,_0x30bcf3);})[_0x62b5('0x14')](function(_0x390b0a){if(_0x390b0a){logger[_0x62b5('0x1c')](_0x62b5('0x53'),_0x390b0a['id']);}})['catch'](function(_0x231db3){logger[_0x62b5('0x5e')]('['+_0x30bcf3['lastevent'][_0x62b5('0x6a')]()+']'+_0x62b5('0x6b'),util[_0x62b5('0x60')](_0x231db3,{'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 2082c95..b691b15 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 _0x09a8=['monitor_format','toUpperCase','calleridnum','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isBefore','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','isNil','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','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...','profile','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','host','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged'];(function(_0x357408,_0x2c8640){var _0x39ebc3=function(_0x418e9c){while(--_0x418e9c){_0x357408['push'](_0x357408['shift']());}};_0x39ebc3(++_0x2c8640);}(_0x09a8,0x13d));var _0x809a=function(_0x4b6026,_0x194b58){_0x4b6026=_0x4b6026-0x0;var _0x13868d=_0x09a8[_0x4b6026];return _0x13868d;};'use strict';var _=require(_0x809a('0x0'));var rp=require('request-promise');var md5=require(_0x809a('0x1'));var util=require(_0x809a('0x2'));var intUtil=require(_0x809a('0x3'));var moment=require(_0x809a('0x4'));var Redis=require(_0x809a('0x5'));var BPromise=require(_0x809a('0x6'));var config=require(_0x809a('0x7'));var logger=require('../../../../config/logger')(_0x809a('0x8'));config['redis']=_[_0x809a('0x9')](config[_0x809a('0xa')],{'host':_0x809a('0xb'),'port':0x18eb});var io=require(_0x809a('0xc'))(new Redis(config[_0x809a('0xa')]));function emit(_0x471df1,_0x12a947,_0x213b18){io['to'](_0x471df1)['emit'](_0x12a947,_0x213b18);}function request(_0x15adc8){logger['debug']('[HTTP]',JSON[_0x809a('0xd')](_0x15adc8));return rp(_0x15adc8);}function getCustomFields(_0x3fcaa0,_0x1fe021){var _0x40b170={};if(_0x3fcaa0[_0x809a('0xe')]>0x0){_[_0x809a('0xf')](_0x3fcaa0,function(_0x2e9404){if(_['includes']([_0x809a('0x10'),_0x809a('0x11')],_0x2e9404[_0x809a('0x12')])&&_0x2e9404['idField']){_0x40b170[_0x2e9404[_0x809a('0x13')]]=_0x2e9404[_0x809a('0x14')][_0x809a('0x15')]();}else if(_0x2e9404[_0x809a('0x12')]===_0x809a('0x16')&&_0x2e9404[_0x809a('0x17')]&&_0x2e9404[_0x809a('0x13')]&&_0x1fe021[_0x2e9404['variableName']]){_0x40b170[_0x2e9404[_0x809a('0x13')]]=_0x1fe021[_0x2e9404['variableName']][_0x809a('0x15')]();}else if(_0x2e9404[_0x809a('0x12')]===_0x809a('0x18')&&_0x2e9404[_0x809a('0x19')]&&_0x2e9404[_0x809a('0x19')]['name']&&_0x2e9404['idField']&&_0x1fe021[_0x2e9404[_0x809a('0x19')][_0x809a('0x1a')][_0x809a('0x1b')]()]){_0x40b170[_0x2e9404['idField']]=_0x1fe021[_0x2e9404[_0x809a('0x19')][_0x809a('0x1a')][_0x809a('0x1b')]()][_0x809a('0x15')]();}});}return _0x40b170;}function getName(_0x2e0aef){if(_0x2e0aef['indexOf']('\x20')>0x0){var _0x5d6598=_0x2e0aef[_0x809a('0x1c')](/ (.+)/);if(_0x5d6598[0x1]){return _0x5d6598;}}return[_0x2e0aef,_0x2e0aef];}var accountsTokens={};function getAccessToken(_0x4a3451){return new Promise(function(_0x4aff73,_0x18e678){if(!_['isNil'](accountsTokens[_0x4a3451['id']])&&!_['isNil'](accountsTokens[_0x4a3451['id']]['access_token'])){if(moment()[_0x809a('0x1d')](accountsTokens[_0x4a3451['id']]['expires_in'])){_0x4aff73(accountsTokens[_0x4a3451['id']][_0x809a('0x1e')]);}}var _0x4913b1;switch(_0x4a3451[_0x809a('0x1f')]){case'US':_0x4913b1=_0x809a('0x20');break;case'AU':_0x4913b1=_0x809a('0x21');break;case'EU':_0x4913b1='https://accounts.zoho.eu';break;case'IN':_0x4913b1='https://accounts.zoho.in';break;case'CN':_0x4913b1='https://accounts.zoho.com.cn';break;default:_0x4913b1=_0x809a('0x22');break;}var _0x1c88bd={'method':_0x809a('0x23'),'uri':_0x4913b1+_0x809a('0x24'),'qs':{'refresh_token':_0x4a3451[_0x809a('0x25')],'client_id':_0x4a3451[_0x809a('0x26')],'client_secret':_0x4a3451[_0x809a('0x27')],'grant_type':_0x809a('0x28')},'json':!![]};return rp(_0x1c88bd)[_0x809a('0x29')](function(_0x37e32d){accountsTokens[_0x4a3451['id']]={'access_token':_0x37e32d['access_token'],'expires_in':moment()[_0x809a('0x2a')](_0x37e32d[_0x809a('0x2b')],_0x809a('0x2c'))};_0x4aff73(_0x37e32d['access_token']);})['catch'](function(_0x2f0b45){logger[_0x809a('0x2d')](_0x809a('0x2e'),_0x2f0b45[_0x809a('0x2f')]);_0x18e678(_0x2f0b45);});});}function getUser(_0x427836,_0x2e95d1,_0x242920,_0x5264e7){logger[_0x809a('0x30')](_0x809a('0x31'));return request({'method':_0x809a('0x32'),'uri':util[_0x809a('0x33')](_0x809a('0x34'),_0x2e95d1),'qs':{'type':_0x809a('0x35')},'headers':{'Authorization':_0x809a('0x36')+_0x427836},'json':!![]})[_0x809a('0x29')](function(_0x5c1506){if(_0x5c1506[_0x809a('0x37')]){var _0x5e9c06=-0x1;if(_[_0x809a('0x38')](_0x5c1506[_0x809a('0x37')])){if(!_['isNil'](_0x5264e7)){_0x5e9c06=_['findIndex'](_0x5c1506[_0x809a('0x37')],function(_0x5a17ce){return _0x5a17ce[_0x809a('0x39')]===_0x5264e7;});}if(_0x5e9c06>=0x0){logger['info'](_0x809a('0x3a'));}else{logger[_0x809a('0x30')](_0x809a('0x3b'));_0x5e9c06=_[_0x809a('0x3c')](_0x5c1506['users'],function(_0x306fca){return _0x306fca['profile'][_0x809a('0x1a')]==='Administrator';});}return _0x5c1506[_0x809a('0x37')][_0x5e9c06];}else{if(_0x5c1506['user']['profile'][_0x809a('0x1a')]===_0x809a('0x3d')){logger[_0x809a('0x30')](_0x809a('0x3b'));user=_0x5c1506['user'];return user;}else{logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](_0x5c1506));throw new Error(_0x809a('0x3f')+JSON['stringify'](_0x5c1506));}}}else{logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](_0x5c1506));throw new Error(_0x809a('0x3f')+JSON['stringify'](_0x5c1506));}})[_0x809a('0x40')](function(_0x45461b){console[_0x809a('0x2d')](_0x45461b);});}function getZohoUser(_0x57e36c,_0xcd34c1){return new BPromise(function(_0x34c329,_0x5d6700){request(_0x57e36c)[_0x809a('0x29')](function(_0x3a046f){var _0x158d69=null;if(_0x3a046f){_0x158d69=_0x3a046f[_0x809a('0x41')][0x0];_0x158d69[_0x809a('0x42')]=_0xcd34c1;}_0x34c329(_0x158d69);})['catch'](function(_0x3231ed){_0x5d6700(_0x3231ed);});});}function createEndUser(_0x381c86,_0x4c13c3,_0x37f7fa,_0x366216,_0x2cb817,_0x80222f){var _0x37f7fa=getName(_0x37f7fa);return request({'method':_0x809a('0x23'),'uri':_0x809a('0x43')+_0x4c13c3+_0x809a('0x44')+_[_0x809a('0x45')](_0x80222f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x37f7fa[0x1],'First_Name':_0x37f7fa[0x0],'Phone':_0x366216,'Owner':{'name':!_['isNil'](_0x2cb817['role'][_0x809a('0x1a')])?_0x2cb817[_0x809a('0x46')][_0x809a('0x1a')]:!_[_0x809a('0x47')](_0x2cb817[_0x809a('0x48')])?_0x2cb817[_0x809a('0x48')]+'\x20'+_0x2cb817['last_name']:_0x2cb817[_0x809a('0x49')],'id':_0x2cb817['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x381c86},'json':!![]})['then'](function(_0x89c6c2){if(_0x89c6c2&&_0x89c6c2[_0x809a('0x41')][0x0][_0x809a('0x4a')]===_0x809a('0x4b')){var _0x1fc528=_0x89c6c2['data'][0x0][_0x809a('0x4c')];_0x1fc528['enduserType']=_[_0x809a('0x45')](_0x80222f[_0x809a('0x4d')])+'s';return _0x1fc528;}logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](data));throw new Error(_0x809a('0x4e')+JSON['stringify'](data));})[_0x809a('0x40')](function(_0x958a3a){console[_0x809a('0x4f')]('CREATE\x20ERROR',_0x958a3a);});}function getEndUser(_0xa2cdc8,_0x5a6312,_0x364a00,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df){var _0x5388b0={'method':'GET','uri':'','headers':{'Authorization':_0x809a('0x36')+_0xa2cdc8},'json':!![]};switch(_0x3db9df[_0x809a('0x50')]){case _0x809a('0x51'):_0x5388b0[_0x809a('0x52')]=_0x809a('0x43')+_0x5a6312+_0x809a('0x53')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x54'))[_0x809a('0x29')](function(_0x2394c6){if(_0x2394c6)return _0x2394c6;_0x5388b0[_0x809a('0x52')]=_0x809a('0x43')+_0x5a6312+_0x809a('0x55')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x56'))['then'](function(_0x205179){if(_0x205179)return _0x205179;if(_0x3db9df[_0x809a('0x4d')]!=_0x809a('0x57')){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});});break;case _0x809a('0x58'):_0x5388b0[_0x809a('0x52')]='https://www.zohoapis.'+_0x5a6312+_0x809a('0x53')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x54'))[_0x809a('0x29')](function(_0xaab3e0){if(_0xaab3e0)return _0xaab3e0;if(_0x3db9df[_0x809a('0x4d')]!=_0x809a('0x57')){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});break;case _0x809a('0x59'):_0x5388b0[_0x809a('0x52')]='https://www.zohoapis.'+_0x5a6312+_0x809a('0x55')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x56'))[_0x809a('0x29')](function(_0x527785){if(_0x527785)return _0x527785;if(_0x3db9df[_0x809a('0x4d')]!='nothing'){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});break;}}function getCall(_0x359858,_0x41f232,_0x4b5c2d,_0x3e4a23,_0xe63d9,_0x4be3ed,_0x42f520,_0x4ff42a){logger[_0x809a('0x30')](_0x809a('0x5a'));var _0x126581={};_0x126581['Owner']={'name':!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x46')][_0x809a('0x1a')])&&!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x5b')][_0x809a('0x1a')])&&_0x3e4a23[_0x809a('0x5b')][_0x809a('0x1a')]==='administrator'?_0x3e4a23[_0x809a('0x46')][_0x809a('0x1a')]:!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x48')])?_0x3e4a23[_0x809a('0x48')]+'\x20'+_0x3e4a23[_0x809a('0x49')]:_0x3e4a23[_0x809a('0x49')],'id':_0x3e4a23['id']};_0x126581[_0x809a('0x5c')]=intUtil[_0x809a('0x5d')](_0x4be3ed[_0x809a('0x5e')],_0x42f520,'\x20');_0x126581['Description']=intUtil['getString'](_0x4be3ed[_0x809a('0x5f')],_0x42f520,'\x0a');if(_0xe63d9[_0x809a('0x42')]===_0x809a('0x54')){_0x126581[_0x809a('0x60')]={'name':!_[_0x809a('0x47')](_0xe63d9[_0x809a('0x61')])?_0xe63d9[_0x809a('0x61')]:!_[_0x809a('0x47')](_0xe63d9['First_Name'])?_0xe63d9[_0x809a('0x62')]+'\x20'+_0xe63d9[_0x809a('0x63')]:_0xe63d9[_0x809a('0x63')],'id':_0xe63d9['id']};}if(_0xe63d9['enduserType']===_0x809a('0x56')){_0x126581[_0x809a('0x64')]={'name':!_[_0x809a('0x47')](_0xe63d9[_0x809a('0x61')])?_0xe63d9['Full_Name']:!_[_0x809a('0x47')](_0xe63d9['First_Name'])?_0xe63d9[_0x809a('0x62')]+'\x20'+_0xe63d9['Last_Name']:_0xe63d9[_0x809a('0x63')],'id':_0xe63d9['id']};_0x126581['$se_module']=_[_0x809a('0x45')](_0xe63d9['enduserType']);}if(_0x42f520[_0x809a('0x65')]){_0x126581[_0x809a('0x66')]=moment[_0x809a('0x67')](parseInt(_0x42f520['talktime'])*0x3e8)[_0x809a('0x33')]('mm:ss');}else if(_0x42f520['answertime']&&_0x42f520[_0x809a('0x68')]){_0x126581[_0x809a('0x66')]=moment[_0x809a('0x67')](moment(_0x42f520[_0x809a('0x68')],_0x809a('0x69'))[_0x809a('0x6a')](moment(_0x42f520[_0x809a('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x809a('0x6c'));}switch(_0x42f520[_0x809a('0x6d')]){case _0x809a('0x6e'):_0x126581[_0x809a('0x6f')]=_0x809a('0x70');break;case _0x809a('0x71'):case _0x809a('0x72'):_0x126581['Call_Result']=_0x809a('0x73');break;case _0x809a('0x74'):_0x126581[_0x809a('0x6f')]=_0x809a('0x75');break;case _0x809a('0x76'):_0x126581[_0x809a('0x6f')]=_0x809a('0x77');break;case _0x809a('0x78'):_0x126581['Call_Result']=_0x809a('0x79');default:}_0x126581[_0x809a('0x7a')]=(_0x4ff42a===_0x809a('0x7b')?moment(_0x42f520[_0x809a('0x6b')])[_0x809a('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x42f520['agentcalledAt'])[_0x809a('0x33')](_0x809a('0x69')))||moment()[_0x809a('0x33')](_0x809a('0x69'));_0x126581[_0x809a('0x7c')]=_0x4ff42a||_0x809a('0x7d');_0x126581=_[_0x809a('0x7e')](_0x126581,getCustomFields(_0x4be3ed[_0x809a('0x7f')],_0x42f520));return request({'method':'POST','uri':_0x809a('0x43')+_0x41f232+_0x809a('0x80'),'headers':{'Authorization':_0x809a('0x36')+_0x359858},'body':{'data':[_0x126581]},'json':!![]})[_0x809a('0x29')](function(_0x285bbd){if(_0x285bbd&&_0x285bbd[_0x809a('0x41')][0x0]['code']===_0x809a('0x4b')){logger[_0x809a('0x30')](_0x809a('0x81'));return{'id':_0x285bbd[_0x809a('0x41')][0x0][_0x809a('0x4c')]['id']};}})[_0x809a('0x40')](function(_0x2e2e53){logger[_0x809a('0x30')](_0x809a('0x82'),_0x2e2e53[_0x809a('0x2f')]);console[_0x809a('0x4f')](_0x809a('0x82'),_0x2e2e53);});}exports[_0x809a('0x83')]=function(_0x27b87c,_0x45845a,_0x37926f,_0x4bcfb8,_0x58c6f2,_0x4834da){var _0xfbdfc3,_0x43c47c,_0x262edb;_0x4834da['host']=intUtil[_0x809a('0x84')](_0x4834da['host']);_0x4834da[_0x809a('0x85')]=intUtil['stripTrailingSlash'](_0x4834da[_0x809a('0x85')]);if(_0x58c6f2&&_0x58c6f2['monitor_format']){logger[_0x809a('0x30')](_0x809a('0x86'),_0x809a('0x87'));_0x45845a[_0x809a('0x88')]=_0x4834da[_0x809a('0x85')]+_0x809a('0x89')+_0x45845a['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x45845a[_0x809a('0x8a')]);}else{_0x45845a[_0x809a('0x88')]='';}var _0x438b59=_0x4834da[_0x809a('0x8b')]===_0x809a('0x8c')?'eu':'com';return getAccessToken(_0x4834da)['then'](function(_0x2c24a1){_0x262edb=_0x2c24a1;return getUser(_0x262edb,_0x438b59,_0x4834da,_0x4bcfb8[_0x809a('0x39')]);})[_0x809a('0x29')](function(_0xabfbf9){_0xfbdfc3=_0xabfbf9;logger['info'](_0x809a('0x8d'),_0xfbdfc3['id']);return getEndUser(_0x262edb,_0x438b59,_0x4834da,_0x45845a[_0x809a('0x8e')],_0x45845a['calleridnum'],_0xfbdfc3,_0x37926f);})[_0x809a('0x29')](function(_0x58b88c){_0x43c47c=_0x58b88c;return getCall(_0x262edb,_0x438b59,_0x4834da,_0xfbdfc3,_0x43c47c,_0x37926f,_0x45845a,_0x809a('0x7d'));})['then'](function(_0x5929df){if(_0x5929df){logger[_0x809a('0x30')]('The\x20Call\x20ID\x20is:',_0x5929df['id']);logger['info'](_0x809a('0x86'),_0x809a('0x8f'));emit(util['format'](_0x809a('0x90'),_0x4bcfb8['name']),'trigger:browser:url',{'uri':_0x809a('0x91')+_0x4834da[_0x809a('0x8b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5929df['id']});}})[_0x809a('0x40')](function(_0x46eeaa){logger[_0x809a('0x2d')](_0x809a('0x86'),JSON[_0x809a('0xd')](_0x46eeaa));});};exports[_0x809a('0x7b')]=function(_0x1e94b6,_0x439dee,_0x32d7bf,_0x470178,_0x5bbb1e,_0x96e0dc,_0x26cd2c){var _0x450aee,_0x3453bb,_0x209a45;_0x96e0dc['host']=intUtil[_0x809a('0x84')](_0x96e0dc[_0x809a('0x8b')]);_0x96e0dc[_0x809a('0x85')]=intUtil['stripTrailingSlash'](_0x96e0dc[_0x809a('0x85')]);if(_0x26cd2c&&_0x26cd2c[_0x809a('0x92')]&&_0x26cd2c[_0x809a('0x92')]!==_0x809a('0x93')){logger[_0x809a('0x30')]('[OUTBOUND]',_0x809a('0x87'));_0x439dee[_0x809a('0x88')]=_0x96e0dc[_0x809a('0x85')]+_0x809a('0x89')+_0x439dee['uniqueid']+_0x809a('0x94')+md5(_0x439dee[_0x809a('0x8a')]);}var _0x12d3a8=_0x96e0dc[_0x809a('0x8b')]===_0x809a('0x8c')?'eu':'com';return getAccessToken(_0x96e0dc)[_0x809a('0x29')](function(_0x1d5407){_0x209a45=_0x1d5407;return getUser(_0x209a45,_0x12d3a8,_0x96e0dc,_0x470178[_0x809a('0x39')]);})['then'](function(_0x3acd95){_0x450aee=_0x3acd95;logger['info'](_0x809a('0x8d'),_0x450aee['id']);return getEndUser(_0x209a45,_0x12d3a8,_0x96e0dc,_0x439dee[_0x809a('0x95')],_0x439dee[_0x809a('0x96')],_0x450aee,_0x32d7bf);})[_0x809a('0x29')](function(_0x26d980){_0x3453bb=_0x26d980;return getCall(_0x209a45,_0x12d3a8,_0x96e0dc,_0x450aee,_0x3453bb,_0x32d7bf,_0x439dee,'Outbound');})[_0x809a('0x29')](function(_0x4dc21b){if(_0x4dc21b){logger[_0x809a('0x30')](_0x809a('0x97'),_0x4dc21b['id']);logger[_0x809a('0x30')](_0x809a('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x809a('0x90'),_0x470178[_0x809a('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x96e0dc[_0x809a('0x8b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4dc21b['id']});}})[_0x809a('0x40')](function(_0x4b89f1){logger['error']('[OUTBOUND]',JSON[_0x809a('0xd')](_0x4b89f1));});};exports[_0x809a('0x99')]=function(_0x4793c8,_0x4e9754,_0x39c605,_0x51a978,_0x3dd4f1,_0x319d1c){var _0x406765,_0x484343,_0x528909;_0x319d1c[_0x809a('0x8b')]=intUtil['stripTrailingSlash'](_0x319d1c[_0x809a('0x8b')]);_0x319d1c[_0x809a('0x85')]=intUtil[_0x809a('0x84')](_0x319d1c['serverUrl']);if(_0x3dd4f1&&_0x3dd4f1[_0x809a('0x9a')]){logger[_0x809a('0x30')]('['+_0x4e9754['lastevent'][_0x809a('0x9b')]()+']',_0x809a('0x87'));_0x4e9754[_0x809a('0x88')]=_0x319d1c[_0x809a('0x85')]+_0x809a('0x89')+_0x4e9754[_0x809a('0x8a')]+_0x809a('0x94')+md5(_0x4e9754['uniqueid']);}else{_0x4e9754[_0x809a('0x88')]='';}var _0xea764d=_0x319d1c[_0x809a('0x8b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x319d1c)[_0x809a('0x29')](function(_0x450a19){_0x528909=_0x450a19;return getUser(_0x528909,_0xea764d,_0x319d1c);})['then'](function(_0x1a5608){_0x406765=_0x1a5608;logger[_0x809a('0x30')](_0x809a('0x8d'),_0x406765['id']);return getEndUser(_0x528909,_0xea764d,_0x319d1c,_0x4e9754[_0x809a('0x8e')],_0x4e9754[_0x809a('0x9c')],_0x406765,_0x39c605);})[_0x809a('0x29')](function(_0x4f1f3d){_0x484343=_0x4f1f3d;return getCall(_0x528909,_0xea764d,_0x319d1c,_0x406765,_0x484343,_0x39c605,_0x4e9754,_0x809a('0x7d'));})[_0x809a('0x29')](function(_0x5721df){if(_0x5721df){logger[_0x809a('0x30')]('The\x20Call\x20ID\x20is:',_0x5721df['id']);}})['catch'](function(_0x45f611){logger[_0x809a('0x2d')]('['+_0x4e9754['lastevent'][_0x809a('0x9b')]()+']',JSON[_0x809a('0xd')](_0x45f611));});}; \ No newline at end of file +var _0x336a=['/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','Outbound','trigger:browser:url','unmanaged','toUpperCase','com','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','forEach','includes','picklist','type','idField','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','data','SUCCESS','details','log','CREATE\x20ERROR','GET','moduleSearch','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','profile','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','format','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x336a,0xa3));var _0xa336=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x336a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa336('0x0'));var rp=require(_0xa336('0x1'));var md5=require(_0xa336('0x2'));var util=require('util');var intUtil=require(_0xa336('0x3'));var moment=require(_0xa336('0x4'));var Redis=require(_0xa336('0x5'));var BPromise=require('bluebird');var config=require(_0xa336('0x6'));var logger=require(_0xa336('0x7'))(_0xa336('0x8'));config[_0xa336('0x9')]=_[_0xa336('0xa')](config['redis'],{'host':_0xa336('0xb'),'port':0x18eb});var io=require(_0xa336('0xc'))(new Redis(config[_0xa336('0x9')]));function emit(_0x527ad8,_0x1fdd6e,_0x3f94e4){io['to'](_0x527ad8)[_0xa336('0xd')](_0x1fdd6e,_0x3f94e4);}function request(_0x1c7a09){logger['debug']('[HTTP]',JSON[_0xa336('0xe')](_0x1c7a09));return rp(_0x1c7a09);}function getCustomFields(_0x95f27d,_0xb45d10){var _0x35608d={};if(_0x95f27d[_0xa336('0xf')]>0x0){_[_0xa336('0x10')](_0x95f27d,function(_0x65a6c0){if(_[_0xa336('0x11')](['string',_0xa336('0x12')],_0x65a6c0[_0xa336('0x13')])&&_0x65a6c0[_0xa336('0x14')]){_0x35608d[_0x65a6c0[_0xa336('0x14')]]=_0x65a6c0['content']['toString']();}else if(_0x65a6c0[_0xa336('0x13')]===_0xa336('0x15')&&_0x65a6c0[_0xa336('0x16')]&&_0x65a6c0[_0xa336('0x14')]&&_0xb45d10[_0x65a6c0[_0xa336('0x16')]]){_0x35608d[_0x65a6c0[_0xa336('0x14')]]=_0xb45d10[_0x65a6c0[_0xa336('0x16')]]['toString']();}else if(_0x65a6c0[_0xa336('0x13')]===_0xa336('0x17')&&_0x65a6c0[_0xa336('0x18')]&&_0x65a6c0['Variable']['name']&&_0x65a6c0[_0xa336('0x14')]&&_0xb45d10[_0x65a6c0[_0xa336('0x18')][_0xa336('0x19')][_0xa336('0x1a')]()]){_0x35608d[_0x65a6c0[_0xa336('0x14')]]=_0xb45d10[_0x65a6c0[_0xa336('0x18')][_0xa336('0x19')][_0xa336('0x1a')]()][_0xa336('0x1b')]();}});}return _0x35608d;}function getName(_0x3f6718){if(_0x3f6718[_0xa336('0x1c')]('\x20')>0x0){var _0x2d6953=_0x3f6718[_0xa336('0x1d')](/ (.+)/);if(_0x2d6953[0x1]){return _0x2d6953;}}return[_0x3f6718,_0x3f6718];}var accountsTokens={};function getAccessToken(_0x53360d){return new Promise(function(_0x2eddb9,_0x421ae7){if(!_['isNil'](accountsTokens[_0x53360d['id']])&&!_[_0xa336('0x1e')](accountsTokens[_0x53360d['id']][_0xa336('0x1f')])){if(moment()[_0xa336('0x20')](accountsTokens[_0x53360d['id']][_0xa336('0x21')])){_0x2eddb9(accountsTokens[_0x53360d['id']][_0xa336('0x1f')]);}}var _0x38f23f;switch(_0x53360d[_0xa336('0x22')]){case'US':_0x38f23f='https://accounts.zoho.com';break;case'AU':_0x38f23f='https://accounts.zoho.com.au';break;case'EU':_0x38f23f='https://accounts.zoho.eu';break;case'IN':_0x38f23f='https://accounts.zoho.in';break;case'CN':_0x38f23f='https://accounts.zoho.com.cn';break;default:_0x38f23f=_0xa336('0x23');break;}var _0x745266={'method':_0xa336('0x24'),'uri':_0x38f23f+_0xa336('0x25'),'qs':{'refresh_token':_0x53360d[_0xa336('0x26')],'client_id':_0x53360d[_0xa336('0x27')],'client_secret':_0x53360d[_0xa336('0x28')],'grant_type':_0xa336('0x29')},'json':!![]};return rp(_0x745266)[_0xa336('0x2a')](function(_0x13b593){accountsTokens[_0x53360d['id']]={'access_token':_0x13b593[_0xa336('0x1f')],'expires_in':moment()['add'](_0x13b593[_0xa336('0x21')],_0xa336('0x2b'))};_0x2eddb9(_0x13b593[_0xa336('0x1f')]);})[_0xa336('0x2c')](function(_0x8ed503){logger[_0xa336('0x2d')](_0xa336('0x2e'),_0x8ed503[_0xa336('0x2f')]);_0x421ae7(_0x8ed503);});});}function getUser(_0x45c7f2,_0x1df68d,_0x7f5d00,_0x32f4f0){logger[_0xa336('0x30')](_0xa336('0x31'));return request({'method':'GET','uri':util['format'](_0xa336('0x32'),_0x1df68d),'qs':{'type':_0xa336('0x33')},'headers':{'Authorization':_0xa336('0x34')+_0x45c7f2},'json':!![]})['then'](function(_0x32b29f){if(_0x32b29f['users']){var _0x9681a7=-0x1;if(_[_0xa336('0x35')](_0x32b29f[_0xa336('0x36')])){if(!_['isNil'](_0x32f4f0)){_0x9681a7=_[_0xa336('0x37')](_0x32b29f[_0xa336('0x36')],function(_0x350bab){return _0x350bab[_0xa336('0x38')]===_0x32f4f0;});}if(_0x9681a7>=0x0){logger['info'](_0xa336('0x39'));}else{logger[_0xa336('0x30')](_0xa336('0x3a'));_0x9681a7=_[_0xa336('0x37')](_0x32b29f[_0xa336('0x36')],function(_0x31f80e){return _0x31f80e['profile'][_0xa336('0x19')]==='Administrator';});}return _0x32b29f[_0xa336('0x36')][_0x9681a7];}else{if(_0x32b29f[_0xa336('0x3b')]['profile'][_0xa336('0x19')]==='Administrator'){logger[_0xa336('0x30')](_0xa336('0x3a'));user=_0x32b29f[_0xa336('0x3b')];return user;}else{logger[_0xa336('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xa336('0xe')](_0x32b29f));throw new Error(_0xa336('0x3c')+JSON[_0xa336('0xe')](_0x32b29f));}}}else{logger['error'](_0xa336('0x3d'),JSON[_0xa336('0xe')](_0x32b29f));throw new Error(_0xa336('0x3c')+JSON[_0xa336('0xe')](_0x32b29f));}})[_0xa336('0x2c')](function(_0x3f5525){console[_0xa336('0x2d')](_0x3f5525);});}function getZohoUser(_0xc91847,_0x13e3e2){return new BPromise(function(_0x133bbb,_0x5623ee){request(_0xc91847)[_0xa336('0x2a')](function(_0x1225e4){var _0x135d2a=null;if(_0x1225e4){_0x135d2a=_0x1225e4['data'][0x0];_0x135d2a[_0xa336('0x3e')]=_0x13e3e2;}_0x133bbb(_0x135d2a);})['catch'](function(_0x47d158){_0x5623ee(_0x47d158);});});}function createEndUser(_0x573a59,_0xbfd269,_0x2020bb,_0x5f315e,_0x3b23a2,_0x3f61a6){var _0x2020bb=getName(_0x2020bb);return request({'method':_0xa336('0x24'),'uri':_0xa336('0x3f')+_0xbfd269+'/crm/v2/'+_[_0xa336('0x40')](_0x3f61a6[_0xa336('0x41')])+'s','body':{'data':[{'Last_Name':_0x2020bb[0x1],'First_Name':_0x2020bb[0x0],'Phone':_0x5f315e,'Owner':{'name':!_[_0xa336('0x1e')](_0x3b23a2[_0xa336('0x42')]['name'])?_0x3b23a2[_0xa336('0x42')][_0xa336('0x19')]:!_[_0xa336('0x1e')](_0x3b23a2['first_name'])?_0x3b23a2[_0xa336('0x43')]+'\x20'+_0x3b23a2['last_name']:_0x3b23a2['last_name'],'id':_0x3b23a2['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x573a59},'json':!![]})[_0xa336('0x2a')](function(_0x2fa9e2){if(_0x2fa9e2&&_0x2fa9e2[_0xa336('0x44')][0x0]['code']===_0xa336('0x45')){var _0x447776=_0x2fa9e2[_0xa336('0x44')][0x0][_0xa336('0x46')];_0x447776[_0xa336('0x3e')]=_[_0xa336('0x40')](_0x3f61a6[_0xa336('0x41')])+'s';return _0x447776;}logger[_0xa336('0x2d')](_0xa336('0x3d'),JSON[_0xa336('0xe')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa336('0x2c')](function(_0xc293e6){console[_0xa336('0x47')](_0xa336('0x48'),_0xc293e6);});}function getEndUser(_0x28b243,_0x2682c6,_0x5ab137,_0x15d927,_0x32517b,_0x4ce221,_0x40cb65){var _0x1931c0={'method':_0xa336('0x49'),'uri':'','headers':{'Authorization':_0xa336('0x34')+_0x28b243},'json':!![]};switch(_0x40cb65[_0xa336('0x4a')]){case'contact_lead':_0x1931c0[_0xa336('0x4b')]=_0xa336('0x3f')+_0x2682c6+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x32517b+'))';return getZohoUser(_0x1931c0,'Contacts')['then'](function(_0xc99f08){if(_0xc99f08)return _0xc99f08;_0x1931c0[_0xa336('0x4b')]=_0xa336('0x3f')+_0x2682c6+_0xa336('0x4c')+_0x32517b+'))';return getZohoUser(_0x1931c0,_0xa336('0x4d'))[_0xa336('0x2a')](function(_0xeda1d1){if(_0xeda1d1)return _0xeda1d1;if(_0x40cb65[_0xa336('0x41')]!=_0xa336('0x4e')){return createEndUser(_0x28b243,_0x2682c6,_0x15d927,_0x32517b,_0x4ce221,_0x40cb65);}else{return{};}});});break;case _0xa336('0x4f'):_0x1931c0[_0xa336('0x4b')]='https://www.zohoapis.'+_0x2682c6+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x32517b+'))';return getZohoUser(_0x1931c0,_0xa336('0x50'))[_0xa336('0x2a')](function(_0x372a48){if(_0x372a48)return _0x372a48;if(_0x40cb65['moduleCreate']!=_0xa336('0x4e')){return createEndUser(_0x28b243,_0x2682c6,_0x15d927,_0x32517b,_0x4ce221,_0x40cb65);}else{return{};}});break;case _0xa336('0x51'):_0x1931c0['uri']=_0xa336('0x3f')+_0x2682c6+_0xa336('0x4c')+_0x32517b+'))';return getZohoUser(_0x1931c0,_0xa336('0x4d'))[_0xa336('0x2a')](function(_0x515c0d){if(_0x515c0d)return _0x515c0d;if(_0x40cb65[_0xa336('0x41')]!=_0xa336('0x4e')){return createEndUser(_0x28b243,_0x2682c6,_0x15d927,_0x32517b,_0x4ce221,_0x40cb65);}else{return{};}});break;}}function getCall(_0x33c8a3,_0x1d6e05,_0x23038c,_0x14a93e,_0x451efb,_0x338166,_0x13fed1,_0x26c91f){logger[_0xa336('0x30')](_0xa336('0x52'));var _0x348749={};_0x348749[_0xa336('0x53')]={'name':!_[_0xa336('0x1e')](_0x14a93e[_0xa336('0x42')][_0xa336('0x19')])&&!_[_0xa336('0x1e')](_0x14a93e['profile'][_0xa336('0x19')])&&_0x14a93e[_0xa336('0x54')][_0xa336('0x19')]===_0xa336('0x55')?_0x14a93e[_0xa336('0x42')][_0xa336('0x19')]:!_['isNil'](_0x14a93e[_0xa336('0x43')])?_0x14a93e[_0xa336('0x43')]+'\x20'+_0x14a93e[_0xa336('0x56')]:_0x14a93e['last_name'],'id':_0x14a93e['id']};_0x348749[_0xa336('0x57')]=intUtil[_0xa336('0x58')](_0x338166[_0xa336('0x59')],_0x13fed1,'\x20');_0x348749[_0xa336('0x5a')]=intUtil[_0xa336('0x58')](_0x338166[_0xa336('0x5b')],_0x13fed1,'\x0a');if(_0x451efb['enduserType']===_0xa336('0x50')){_0x348749[_0xa336('0x5c')]={'name':!_['isNil'](_0x451efb['Full_Name'])?_0x451efb['Full_Name']:!_[_0xa336('0x1e')](_0x451efb[_0xa336('0x5d')])?_0x451efb[_0xa336('0x5d')]+'\x20'+_0x451efb[_0xa336('0x5e')]:_0x451efb[_0xa336('0x5e')],'id':_0x451efb['id']};}if(_0x451efb[_0xa336('0x3e')]===_0xa336('0x4d')){_0x348749[_0xa336('0x5f')]={'name':!_[_0xa336('0x1e')](_0x451efb['Full_Name'])?_0x451efb[_0xa336('0x60')]:!_['isNil'](_0x451efb['First_Name'])?_0x451efb['First_Name']+'\x20'+_0x451efb[_0xa336('0x5e')]:_0x451efb[_0xa336('0x5e')],'id':_0x451efb['id']};_0x348749[_0xa336('0x61')]=_[_0xa336('0x40')](_0x451efb[_0xa336('0x3e')]);}if(_0x13fed1[_0xa336('0x62')]){_0x348749['Call_Duration']=moment[_0xa336('0x63')](parseInt(_0x13fed1[_0xa336('0x62')])*0x3e8)[_0xa336('0x64')]('mm:ss');}else if(_0x13fed1[_0xa336('0x65')]&&_0x13fed1['endtime']){_0x348749[_0xa336('0x66')]=moment['utc'](moment(_0x13fed1[_0xa336('0x67')],_0xa336('0x68'))[_0xa336('0x69')](moment(_0x13fed1[_0xa336('0x6a')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x13fed1[_0xa336('0x6b')]){case'called':_0x348749[_0xa336('0x6c')]=_0xa336('0x6d');break;case'complete':case _0xa336('0x6e'):_0x348749[_0xa336('0x6c')]=_0xa336('0x6f');break;case _0xa336('0x70'):_0x348749[_0xa336('0x6c')]=_0xa336('0x71');break;case'abandoned':_0x348749['Call_Result']=_0xa336('0x72');break;case _0xa336('0x73'):_0x348749[_0xa336('0x6c')]=_0xa336('0x74');default:}_0x348749[_0xa336('0x75')]=(_0x26c91f===_0xa336('0x76')?moment(_0x13fed1['starttime'])[_0xa336('0x64')](_0xa336('0x68')):moment(_0x13fed1[_0xa336('0x77')])[_0xa336('0x64')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xa336('0x68'));_0x348749[_0xa336('0x78')]=_0x26c91f||_0xa336('0x79');_0x348749=_[_0xa336('0x7a')](_0x348749,getCustomFields(_0x338166[_0xa336('0x7b')],_0x13fed1));return request({'method':_0xa336('0x24'),'uri':_0xa336('0x3f')+_0x1d6e05+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33c8a3},'body':{'data':[_0x348749]},'json':!![]})[_0xa336('0x2a')](function(_0x507ad4){if(_0x507ad4&&_0x507ad4['data'][0x0]['code']===_0xa336('0x45')){logger[_0xa336('0x30')](_0xa336('0x7c'));return{'id':_0x507ad4[_0xa336('0x44')][0x0][_0xa336('0x46')]['id']};}})['catch'](function(_0x40f3ad){logger['info'](_0xa336('0x7d'),_0x40f3ad[_0xa336('0x2f')]);console['log']('err',_0x40f3ad);});}exports[_0xa336('0x7e')]=function(_0x254fb2,_0xcc959a,_0x4b85fd,_0x2eec10,_0x48de67,_0x228291){var _0x3e9ba2,_0x853f98,_0x365a92;_0x228291[_0xa336('0x7f')]=intUtil[_0xa336('0x80')](_0x228291[_0xa336('0x7f')]);_0x228291[_0xa336('0x81')]=intUtil['stripTrailingSlash'](_0x228291[_0xa336('0x81')]);if(_0x48de67&&_0x48de67[_0xa336('0x82')]){logger[_0xa336('0x30')](_0xa336('0x83'),_0xa336('0x84'));_0xcc959a[_0xa336('0x85')]=_0x228291[_0xa336('0x81')]+'/api/voice/recordings/'+_0xcc959a[_0xa336('0x86')]+_0xa336('0x87')+md5(_0xcc959a[_0xa336('0x86')]);}else{_0xcc959a[_0xa336('0x85')]='';}var _0x37cf2f=_0x228291[_0xa336('0x7f')]===_0xa336('0x88')?'eu':'com';return getAccessToken(_0x228291)[_0xa336('0x2a')](function(_0x58421f){_0x365a92=_0x58421f;return getUser(_0x365a92,_0x37cf2f,_0x228291,_0x2eec10[_0xa336('0x38')]);})[_0xa336('0x2a')](function(_0x7d3626){_0x3e9ba2=_0x7d3626;logger[_0xa336('0x30')]('The\x20User\x20ID\x20is:',_0x3e9ba2['id']);return getEndUser(_0x365a92,_0x37cf2f,_0x228291,_0xcc959a[_0xa336('0x89')],_0xcc959a[_0xa336('0x8a')],_0x3e9ba2,_0x4b85fd);})[_0xa336('0x2a')](function(_0x52b043){_0x853f98=_0x52b043;return getCall(_0x365a92,_0x37cf2f,_0x228291,_0x3e9ba2,_0x853f98,_0x4b85fd,_0xcc959a,_0xa336('0x79'));})[_0xa336('0x2a')](function(_0x36d593){if(_0x36d593){logger['info'](_0xa336('0x8b'),_0x36d593['id']);logger['info'](_0xa336('0x83'),_0xa336('0x8c'));emit(util[_0xa336('0x64')](_0xa336('0x8d'),_0x2eec10[_0xa336('0x19')]),'trigger:browser:url',{'uri':_0xa336('0x8e')+_0x228291['host']+_0xa336('0x8f')+_0x36d593['id']});}})['catch'](function(_0x3ec98f){logger[_0xa336('0x2d')]('[QUEUE]',JSON[_0xa336('0xe')](_0x3ec98f));});};exports[_0xa336('0x76')]=function(_0x109904,_0x4d9c8d,_0x22e1c1,_0x20c19a,_0x22ac0e,_0x25f393,_0x10470a){var _0x1a3b41,_0x5c3ddf,_0x3fad17;_0x25f393[_0xa336('0x7f')]=intUtil['stripTrailingSlash'](_0x25f393[_0xa336('0x7f')]);_0x25f393['serverUrl']=intUtil['stripTrailingSlash'](_0x25f393[_0xa336('0x81')]);if(_0x10470a&&_0x10470a[_0xa336('0x90')]&&_0x10470a['recordingFormat']!==_0xa336('0x91')){logger[_0xa336('0x30')](_0xa336('0x92'),'Recording\x20is\x20enabled!');_0x4d9c8d[_0xa336('0x85')]=_0x25f393[_0xa336('0x81')]+_0xa336('0x93')+_0x4d9c8d[_0xa336('0x86')]+_0xa336('0x87')+md5(_0x4d9c8d[_0xa336('0x86')]);}var _0x3e843=_0x25f393['host']===_0xa336('0x88')?'eu':'com';return getAccessToken(_0x25f393)['then'](function(_0x41078e){_0x3fad17=_0x41078e;return getUser(_0x3fad17,_0x3e843,_0x25f393,_0x20c19a[_0xa336('0x38')]);})[_0xa336('0x2a')](function(_0x33bd30){_0x1a3b41=_0x33bd30;logger['info'](_0xa336('0x94'),_0x1a3b41['id']);return getEndUser(_0x3fad17,_0x3e843,_0x25f393,_0x4d9c8d[_0xa336('0x95')],_0x4d9c8d['destcalleridnum'],_0x1a3b41,_0x22e1c1);})[_0xa336('0x2a')](function(_0x1167e3){_0x5c3ddf=_0x1167e3;return getCall(_0x3fad17,_0x3e843,_0x25f393,_0x1a3b41,_0x5c3ddf,_0x22e1c1,_0x4d9c8d,_0xa336('0x96'));})[_0xa336('0x2a')](function(_0x17fa90){if(_0x17fa90){logger[_0xa336('0x30')](_0xa336('0x8b'),_0x17fa90['id']);logger[_0xa336('0x30')](_0xa336('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa336('0x64')](_0xa336('0x8d'),_0x20c19a[_0xa336('0x19')]),_0xa336('0x97'),{'uri':'https://crm.'+_0x25f393[_0xa336('0x7f')]+_0xa336('0x8f')+_0x17fa90['id']});}})[_0xa336('0x2c')](function(_0x17526d){logger[_0xa336('0x2d')](_0xa336('0x92'),JSON[_0xa336('0xe')](_0x17526d));});};exports[_0xa336('0x98')]=function(_0x4bc598,_0x323de8,_0x246d72,_0x19b9a1,_0x7682e7,_0x4aebd0){var _0x103e10,_0x7b1a7c,_0x45422f;_0x4aebd0[_0xa336('0x7f')]=intUtil[_0xa336('0x80')](_0x4aebd0['host']);_0x4aebd0[_0xa336('0x81')]=intUtil[_0xa336('0x80')](_0x4aebd0['serverUrl']);if(_0x7682e7&&_0x7682e7[_0xa336('0x82')]){logger[_0xa336('0x30')]('['+_0x323de8['lastevent'][_0xa336('0x99')]()+']',_0xa336('0x84'));_0x323de8['recordingURL']=_0x4aebd0['serverUrl']+_0xa336('0x93')+_0x323de8[_0xa336('0x86')]+_0xa336('0x87')+md5(_0x323de8[_0xa336('0x86')]);}else{_0x323de8[_0xa336('0x85')]='';}var _0x438e9=_0x4aebd0['host']==='zoho.eu'?'eu':_0xa336('0x9a');return getAccessToken(_0x4aebd0)[_0xa336('0x2a')](function(_0x40328d){_0x45422f=_0x40328d;return getUser(_0x45422f,_0x438e9,_0x4aebd0);})[_0xa336('0x2a')](function(_0x2aacef){_0x103e10=_0x2aacef;logger['info'](_0xa336('0x94'),_0x103e10['id']);return getEndUser(_0x45422f,_0x438e9,_0x4aebd0,_0x323de8[_0xa336('0x89')],_0x323de8['calleridnum'],_0x103e10,_0x246d72);})[_0xa336('0x2a')](function(_0x98af28){_0x7b1a7c=_0x98af28;return getCall(_0x45422f,_0x438e9,_0x4aebd0,_0x103e10,_0x7b1a7c,_0x246d72,_0x323de8,_0xa336('0x79'));})[_0xa336('0x2a')](function(_0x234fcd){if(_0x234fcd){logger[_0xa336('0x30')](_0xa336('0x8b'),_0x234fcd['id']);}})['catch'](function(_0x530af8){logger[_0xa336('0x2d')]('['+_0x323de8[_0xa336('0x6b')]['toUpperCase']()+']',JSON[_0xa336('0xe')](_0x530af8));});}; \ 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 b6d53a8..a746b19 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 _0xf8d6=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','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'];(function(_0x100836,_0x1d9c5f){var _0x19ab99=function(_0x5f549b){while(--_0x5f549b){_0x100836['push'](_0x100836['shift']());}};_0x19ab99(++_0x1d9c5f);}(_0xf8d6,0x11b));var _0x6f8d=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xf8d6[_0x590a38];return _0xf36626;};'use strict';var util=require(_0x6f8d('0x0'));var sh=require(_0x6f8d('0x1'));var Mustache=require(_0x6f8d('0x2'));var logger=require(_0x6f8d('0x3'))(_0x6f8d('0x4'));exports[_0x6f8d('0x5')]=function(_0x35c9b5,_0x2150fc){var _0x43a276=_0x35c9b5['data2']?_0x35c9b5[_0x6f8d('0x6')]:_0x6f8d('0x7');var _0x295b39=_0x35c9b5[_0x6f8d('0x8')]?Mustache[_0x6f8d('0x9')](_0x35c9b5['data3'],_0x2150fc):_0x2150fc;sh[_0x6f8d('0x5')](_0x295b39,function(_0x44ede1,_0x5704fe,_0x54d7f9){if(_0x44ede1!==0x0){logger[_0x6f8d('0xa')](util[_0x6f8d('0xb')](_0x6f8d('0xc'),_0x43a276,_0x295b39,_0x44ede1,_0x54d7f9));}else{logger[_0x6f8d('0xd')](util[_0x6f8d('0xb')](_0x6f8d('0xe'),_0x43a276,_0x295b39,_0x5704fe));}});}; \ No newline at end of file +var _0xaca2=['format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','exec','error'];(function(_0x15b28b,_0x396631){var _0x1da9f9=function(_0xd977e){while(--_0xd977e){_0x15b28b['push'](_0x15b28b['shift']());}};_0x1da9f9(++_0x396631);}(_0xaca2,0x121));var _0x2aca=function(_0x337229,_0x390e5e){_0x337229=_0x337229-0x0;var _0x5c639a=_0xaca2[_0x337229];return _0x5c639a;};'use strict';var util=require(_0x2aca('0x0'));var sh=require(_0x2aca('0x1'));var Mustache=require(_0x2aca('0x2'));var logger=require(_0x2aca('0x3'))(_0x2aca('0x4'));exports['exec']=function(_0x26afef,_0x49ba4e){var _0x3c137e=_0x26afef[_0x2aca('0x5')]?_0x26afef['data2']:_0x2aca('0x6');var _0x354a55=_0x26afef[_0x2aca('0x7')]?Mustache['render'](_0x26afef[_0x2aca('0x7')],_0x49ba4e):_0x49ba4e;sh[_0x2aca('0x8')](_0x354a55,function(_0x4c2bd0,_0x19062f,_0x3546f6){if(_0x4c2bd0!==0x0){logger[_0x2aca('0x9')](util[_0x2aca('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3c137e,_0x354a55,_0x4c2bd0,_0x3546f6));}else{logger[_0x2aca('0xb')](util['format'](_0x2aca('0xc'),_0x3c137e,_0x354a55,_0x19062f));}});}; \ 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 4a51e16..590066d 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 _0x66e4=['request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','PUT','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','%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','message'];(function(_0x472d55,_0x38460b){var _0x372767=function(_0x47c1ea){while(--_0x47c1ea){_0x472d55['push'](_0x472d55['shift']());}};_0x372767(++_0x38460b);}(_0x66e4,0xd9));var _0x466e=function(_0x2e84c6,_0x3c9eb1){_0x2e84c6=_0x2e84c6-0x0;var _0x349a23=_0x66e4[_0x2e84c6];return _0x349a23;};'use strict';var rp=require(_0x466e('0x0'));var util=require(_0x466e('0x1'));var _=require(_0x466e('0x2'));var Mustache=require(_0x466e('0x3'));var logger=require('../../../../config/logger')(_0x466e('0x4'));exports[_0x466e('0x5')]=function(_0xce1591,_0x16337c){var _0x6d66ce,_0x5ce9e7;var _0x5a0f28={'method':_0xce1591[_0x466e('0x6')][_0x466e('0x7')](),'uri':Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0x9')],_0x16337c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xce1591[_0x466e('0xa')])===_0x466e('0xb')&&parseInt(_0xce1591[_0x466e('0xa')])>=0x1&&parseInt(_0xce1591[_0x466e('0xa')])<=0xa?parseInt(_0xce1591[_0x466e('0xa')])*0x3e8:0x5*0x3e8};try{_0x5a0f28['headers']=_0xce1591[_0x466e('0xc')]?JSON['parse'](Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0xc')],_0x16337c)):{};}catch(_0x24bc22){logger[_0x466e('0xd')](_0x24bc22[_0x466e('0xe')]);}switch(_0xce1591[_0x466e('0x6')][_0x466e('0x7')]()){case _0x466e('0xf'):case _0x466e('0x10'):_0x6d66ce=null;_0x5a0f28['qs']=_0x16337c;break;case'POST':case _0x466e('0x11'):if(_0xce1591[_0x466e('0x12')]){try{_0x6d66ce=JSON[_0x466e('0x13')](Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0x12')],_0x16337c));_0x5a0f28['body']=_0x6d66ce;}catch(_0x5c4f1a){logger[_0x466e('0xd')](_0x5c4f1a['stack']);logger[_0x466e('0xd')](_0x466e('0x14'));}}else{_0x6d66ce=_0x16337c;_0x5a0f28[_0x466e('0x15')]=_0x6d66ce;}break;}logger[_0x466e('0x16')](util['format'](_0x466e('0x17'),_0xce1591['data1'],_0xce1591[_0x466e('0x9')],JSON[_0x466e('0x18')](_0x5a0f28)));rp(_0x5a0f28)['then'](function(_0x488ae5){_0x6d66ce=!_[_0x466e('0x19')](_0x6d66ce)?',\x20request\x20body:\x20'+_0x6d66ce:'';_0x5ce9e7=typeof _0x488ae5[_0x466e('0x15')]===_0x466e('0x1a')?JSON[_0x466e('0x18')](_0x488ae5[_0x466e('0x15')]):_0x488ae5[_0x466e('0x15')];logger[_0x466e('0x16')](util['format'](_0x466e('0x1b'),_0xce1591['data1'],_0xce1591['data2'],_0x488ae5[_0x466e('0x1c')],_0x5ce9e7));})['catch'](function(_0x432495){logger[_0x466e('0xd')](util['format'](_0x466e('0x1d'),_0xce1591[_0x466e('0x6')],_0xce1591[_0x466e('0x9')],_0x432495[_0x466e('0x1c')],_0x432495['name'],_0x432495[_0x466e('0x1e')]));});}; \ No newline at end of file +var _0x2709=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','parse','toUpperCase','GET','DELETE','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode'];(function(_0x53b95f,_0x4b586f){var _0x459a0e=function(_0x540be8){while(--_0x540be8){_0x53b95f['push'](_0x53b95f['shift']());}};_0x459a0e(++_0x4b586f);}(_0x2709,0x136));var _0x9270=function(_0x1323fe,_0x37829e){_0x1323fe=_0x1323fe-0x0;var _0x1d8489=_0x2709[_0x1323fe];return _0x1d8489;};'use strict';var rp=require(_0x9270('0x0'));var util=require(_0x9270('0x1'));var _=require(_0x9270('0x2'));var Mustache=require(_0x9270('0x3'));var logger=require(_0x9270('0x4'))(_0x9270('0x5'));exports[_0x9270('0x6')]=function(_0x31eb4b,_0x176c0e){var _0x4f4494,_0x2eed69;var _0x223640={'method':_0x31eb4b[_0x9270('0x7')]['toUpperCase'](),'uri':Mustache[_0x9270('0x8')](_0x31eb4b[_0x9270('0x9')],_0x176c0e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x31eb4b[_0x9270('0xa')])===_0x9270('0xb')&&parseInt(_0x31eb4b[_0x9270('0xa')])>=0x1&&parseInt(_0x31eb4b[_0x9270('0xa')])<=0xa?parseInt(_0x31eb4b[_0x9270('0xa')])*0x3e8:0x5*0x3e8};try{_0x223640[_0x9270('0xc')]=_0x31eb4b[_0x9270('0xd')]?JSON[_0x9270('0xe')](Mustache[_0x9270('0x8')](_0x31eb4b[_0x9270('0xd')],_0x176c0e)):{};}catch(_0x4033cb){logger['error'](_0x4033cb['stack']);}switch(_0x31eb4b['data1'][_0x9270('0xf')]()){case _0x9270('0x10'):case _0x9270('0x11'):_0x4f4494=null;_0x223640['qs']=_0x176c0e;break;case _0x9270('0x12'):case'PUT':if(_0x31eb4b[_0x9270('0x13')]){try{_0x4f4494=JSON[_0x9270('0xe')](Mustache[_0x9270('0x8')](_0x31eb4b[_0x9270('0x13')],_0x176c0e));_0x223640[_0x9270('0x14')]=_0x4f4494;}catch(_0x7b120e){logger[_0x9270('0x15')](_0x7b120e[_0x9270('0x16')]);logger[_0x9270('0x15')](_0x9270('0x17'));}}else{_0x4f4494=_0x176c0e;_0x223640[_0x9270('0x14')]=_0x4f4494;}break;}logger['info'](util[_0x9270('0x18')](_0x9270('0x19'),_0x31eb4b[_0x9270('0x7')],_0x31eb4b['data2'],JSON[_0x9270('0x1a')](_0x223640)));rp(_0x223640)[_0x9270('0x1b')](function(_0x18c3b3){_0x4f4494=!_['isNil'](_0x4f4494)?',\x20request\x20body:\x20'+_0x4f4494:'';_0x2eed69=typeof _0x18c3b3['body']==='object'?JSON[_0x9270('0x1a')](_0x18c3b3[_0x9270('0x14')]):_0x18c3b3[_0x9270('0x14')];logger['info'](util[_0x9270('0x18')](_0x9270('0x1c'),_0x31eb4b[_0x9270('0x7')],_0x31eb4b['data2'],_0x18c3b3[_0x9270('0x1d')],_0x2eed69));})[_0x9270('0x1e')](function(_0x563dfa){logger[_0x9270('0x15')](util['format'](_0x9270('0x1f'),_0x31eb4b[_0x9270('0x7')],_0x31eb4b['data2'],_0x563dfa[_0x9270('0x1d')],_0x563dfa[_0x9270('0x20')],_0x563dfa[_0x9270('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8233a5e..59af57c 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 _0xc551=['result','catch','exports','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc551,0x1d7));var _0x1c55=function(_0x245e3a,_0x240cea){_0x245e3a=_0x245e3a-0x0;var _0x528311=_0xc551[_0x245e3a];return _0x528311;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1c55('0x0'));var logger=require(_0x1c55('0x1'))(_0x1c55('0x2'));var client=jayson['client'][_0x1c55('0x3')]({'port':0x2329});client[_0x1c55('0x4')]=function(_0x5f5b62,_0x5b1658){return new BPromise(function(_0x57c6b9,_0x2243f5){return client[_0x1c55('0x5')](_0x5f5b62,_0x5b1658)[_0x1c55('0x6')](function(_0x4c6835){logger['debug'](_0x1c55('0x7'),_0x1c55('0x2'),_0x5f5b62,_0x5b1658,_0x4c6835);if(_0x4c6835[_0x1c55('0x8')]){logger[_0x1c55('0x8')]('rpc',_0x1c55('0x2'),_0x5f5b62,_0x4c6835[_0x1c55('0x8')]['message'],_0x5b1658);return _0x2243f5(_0x4c6835[_0x1c55('0x8')][_0x1c55('0x9')]);}else{return _0x57c6b9(_0x4c6835[_0x1c55('0xa')]);}})[_0x1c55('0xb')](function(_0x45fb85){logger[_0x1c55('0x8')](_0x1c55('0x7'),_0x1c55('0x2'),_0x5f5b62,_0x45fb85,_0x5b1658);return _0x2243f5(_0x45fb85);});});};module[_0x1c55('0xc')]=client; \ No newline at end of file +var _0xcac9=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x14c907,_0x406f2f){var _0x1cfec2=function(_0x48dcc0){while(--_0x48dcc0){_0x14c907['push'](_0x14c907['shift']());}};_0x1cfec2(++_0x406f2f);}(_0xcac9,0x1df));var _0x9cac=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xcac9[_0x3203a1];return _0x24215e;};'use strict';var jayson=require(_0x9cac('0x0'));var BPromise=require('bluebird');var logger=require(_0x9cac('0x1'))(_0x9cac('0x2'));var client=jayson[_0x9cac('0x3')][_0x9cac('0x4')]({'port':0x2329});client[_0x9cac('0x5')]=function(_0x51f954,_0x5547e6){return new BPromise(function(_0x28a763,_0x1c4d35){return client[_0x9cac('0x6')](_0x51f954,_0x5547e6)[_0x9cac('0x7')](function(_0x27b598){logger[_0x9cac('0x8')](_0x9cac('0x9'),_0x9cac('0x2'),_0x51f954,_0x5547e6,_0x27b598);if(_0x27b598['error']){logger[_0x9cac('0xa')](_0x9cac('0x9'),_0x9cac('0x2'),_0x51f954,_0x27b598[_0x9cac('0xa')][_0x9cac('0xb')],_0x5547e6);return _0x1c4d35(_0x27b598[_0x9cac('0xa')]['message']);}else{return _0x28a763(_0x27b598[_0x9cac('0xc')]);}})[_0x9cac('0xd')](function(_0x456094){logger[_0x9cac('0xa')](_0x9cac('0x9'),_0x9cac('0x2'),_0x51f954,_0x456094,_0x5547e6);return _0x1c4d35(_0x456094);});});};module[_0x9cac('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a55ce4a..f4c25b9 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 _0xb0c0=['Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','loginMailFrequency','catch','error'];(function(_0x294ba1,_0x20188f){var _0x176a81=function(_0x1e3037){while(--_0x1e3037){_0x294ba1['push'](_0x294ba1['shift']());}};_0x176a81(++_0x20188f);}(_0xb0c0,0x7f));var _0x0b0c=function(_0x34f26b,_0x1c400b){_0x34f26b=_0x34f26b-0x0;var _0x568071=_0xb0c0[_0x34f26b];return _0x568071;};'use strict';var server=require(_0x0b0c('0x0'));var Realtime=require(_0x0b0c('0x1'));var EmailChannel=require(_0x0b0c('0x2'));var mailAccount=require(_0x0b0c('0x3'));var setting=require(_0x0b0c('0x4'));var logger=require(_0x0b0c('0x5'))(_0x0b0c('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0b0c('0x7')]()['then'](mailAccount[_0x0b0c('0x8')]())['then'](realtime['initMailAccounts']())[_0x0b0c('0x9')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0b0c('0x9')](function(){return initRealtime();})[_0x0b0c('0x9')](function(){return setting['getSettings']();})[_0x0b0c('0x9')](function(_0x42da5a){return setInterval(initRealtime,_0x42da5a[_0x0b0c('0xa')]*0x3e8);})[_0x0b0c('0xb')](function(_0x4307bd){logger[_0x0b0c('0xc')](_0x0b0c('0xd'),_0x4307bd);});}main(); \ No newline at end of file +var _0x5261=['resolve','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount','./rpc/setting','../../config/logger'];(function(_0x189219,_0x17562e){var _0x168043=function(_0x53b540){while(--_0x53b540){_0x189219['push'](_0x189219['shift']());}};_0x168043(++_0x17562e);}(_0x5261,0x10a));var _0x1526=function(_0x561489,_0xa78278){_0x561489=_0x561489-0x0;var _0x455a06=_0x5261[_0x561489];return _0x455a06;};'use strict';var server=require(_0x1526('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x1526('0x1'));var setting=require(_0x1526('0x2'));var logger=require(_0x1526('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x1526('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x1526('0x5')](realtime[_0x1526('0x6')]())[_0x1526('0x5')](function(){email[_0x1526('0x7')](realtime[_0x1526('0x8')]);return realtime;});}function main(){return server[_0x1526('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x1526('0x5')](function(){return setting[_0x1526('0xa')]();})[_0x1526('0x5')](function(_0x3bb386){return setInterval(initRealtime,_0x3bb386[_0x1526('0xb')]*0x3e8);})[_0x1526('0xc')](function(_0x349e4b){logger[_0x1526('0xd')](_0x1526('0xe'),_0x349e4b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 26de43b..21cc791 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 _0xdf87=['Smtp','exports','lodash','bluebird','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','imapAccounts','smtp','emit','mailAccounts','name','key','active','Imap','messageStatus','total','isNil','stringify','md5','prototype','refresh','service','custom','provider','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','send','verifySmtp','verify','verified'];(function(_0x4febcd,_0x141f0c){var _0x253421=function(_0x4768dc){while(--_0x4768dc){_0x4febcd['push'](_0x4febcd['shift']());}};_0x253421(++_0x141f0c);}(_0xdf87,0x1e2));var _0x7df8=function(_0xbf8c84,_0xc878c){_0xbf8c84=_0xbf8c84-0x0;var _0x456334=_0xdf87[_0xbf8c84];return _0x456334;};'use strict';var _=require(_0x7df8('0x0'));var moment=require('moment');var BPromise=require(_0x7df8('0x1'));var md5=require('md5');var Redis=require(_0x7df8('0x2'));var config=require('../../../config/environment');var logger=require(_0x7df8('0x3'))(_0x7df8('0x4'));config[_0x7df8('0x5')]=_[_0x7df8('0x6')](config['redis'],{'host':_0x7df8('0x7'),'port':0x18eb});var io=require(_0x7df8('0x8'))(new Redis(config[_0x7df8('0x5')]));var EmailImap=require(_0x7df8('0x9'));var EmailSmtp=require(_0x7df8('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x8035b1){logger['info'](_0x7df8('0xb'));this['mailAccounts']=_0x8035b1['mailAccounts'];this[_0x7df8('0xc')]={};this[_0x7df8('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x7df8('0xe')]=function(_0x2b0c15){var _0x28b396=this[_0x7df8('0xf')][_0x2b0c15];var _0x57fb9f={'id':_0x28b396['id'],'name':_0x28b396[_0x7df8('0x10')],'key':_0x28b396[_0x7df8('0x11')],'active':_0x28b396[_0x7df8('0x12')],'Imap':{'status':_0x28b396[_0x7df8('0x13')]['status'],'messageStatus':_0x28b396[_0x7df8('0x13')][_0x7df8('0x14')],'total':_0x28b396['Imap'][_0x7df8('0x15')]}};if(_[_0x7df8('0x16')](md5Accounts[_0x2b0c15])){md5Accounts[_0x2b0c15]={};}var _0x28d994=md5(JSON[_0x7df8('0x17')](_0x57fb9f));if(md5Accounts[_0x2b0c15][_0x7df8('0x18')]!==_0x28d994){md5Accounts[_0x2b0c15][_0x7df8('0x18')]=_0x28d994;io[_0x7df8('0xe')]('mailAccount:update',_0x57fb9f);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x1a')]=function(_0x43f412){for(var _0x270323 in _0x43f412){if(_0x43f412['hasOwnProperty'](_0x270323)){if(_0x43f412[_0x270323][_0x7df8('0x13')]&&_0x43f412[_0x270323][_0x7df8('0x12')]){var _0x124dda=_0x43f412[_0x270323][_0x7df8('0x13')];if(!_0x124dda[_0x7df8('0x1b')]&&_0x43f412[_0x270323]['provider']!==_0x7df8('0x1c'))_0x124dda[_0x7df8('0x1b')]=_0x43f412[_0x270323][_0x7df8('0x1d')];if(!this[_0x7df8('0xc')][_0x7df8('0x1e')](_0x124dda['id'])){this[_0x7df8('0xc')][_0x124dda['id']]=new EmailImap(_0x124dda,_0x43f412[_0x270323]['email']);this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x1f'),this[_0x7df8('0x20')][_0x7df8('0x21')](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x4'),this[_0x7df8('0x22')]['bind'](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x23'),this[_0x7df8('0x24')][_0x7df8('0x21')](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on']('error',this[_0x7df8('0x25')][_0x7df8('0x21')](this,_0x270323));}}else{if(_[_0x7df8('0x16')](this[_0x7df8('0xf')][_0x270323][_0x7df8('0x13')])){this['mailAccounts'][_0x270323][_0x7df8('0x13')]={};}this[_0x7df8('0xf')][_0x270323][_0x7df8('0x13')][_0x7df8('0x26')]='disabled';this['mailAccounts'][_0x270323][_0x7df8('0x13')][_0x7df8('0x14')]='';this[_0x7df8('0xe')](_0x270323);}}}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x20')]=function(_0x20a1f8,_0x5194b2){if(this[_0x7df8('0xf')][_0x20a1f8]){this[_0x7df8('0xf')][_0x20a1f8]['Imap'][_0x7df8('0x26')]=_0x7df8('0x27');this[_0x7df8('0xf')][_0x20a1f8][_0x7df8('0x13')][_0x7df8('0x14')]=_0x5194b2[_0x7df8('0x10')];if(_0x5194b2[_0x7df8('0x28')]){this[_0x7df8('0xf')][_0x20a1f8][_0x7df8('0x13')]['total']=_0x5194b2[_0x7df8('0x28')][_0x7df8('0x15')];}return this[_0x7df8('0xe')](_0x20a1f8);}};EmailChannel['prototype'][_0x7df8('0x22')]=function(_0x1a567e,_0x1e72a3){logger['info'](_0x7df8('0x29'),_0x1e72a3[_0x7df8('0x2a')],_0x1e72a3[_0x7df8('0x2b')],_0x1e72a3[_0x7df8('0x2c')],_0x1a567e);if(this[_0x7df8('0xf')][_0x1a567e]){return mailAccount[_0x7df8('0x2d')](_0x1a567e,_0x1e72a3)[_0x7df8('0x2e')](function(_0x1e5c98){if(_0x1e5c98){logger[_0x7df8('0x2f')](_0x7df8('0x30'));}})[_0x7df8('0x31')](function(_0x2cedbd){logger['error'](_0x7df8('0x32'),JSON[_0x7df8('0x17')](_0x2cedbd));});}};EmailChannel[_0x7df8('0x19')]['handleImapEnd']=function(_0x330c18){if(this[_0x7df8('0xf')][_0x330c18]&&this['mailAccounts'][_0x330c18][_0x7df8('0x13')]){if(this[_0x7df8('0xc')][this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')]['id']]){delete this[_0x7df8('0xc')][this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')]['id']];}this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')][_0x7df8('0x33')]=moment();this[_0x7df8('0xe')](_0x330c18);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x25')]=function(_0x3501c3,_0x360b22){if(this[_0x7df8('0xf')][_0x3501c3]){this['mailAccounts'][_0x3501c3][_0x7df8('0x13')]['status']=_0x7df8('0x34');this[_0x7df8('0xf')][_0x3501c3]['Imap']['messageStatus']=_0x360b22;return this['emit'](_0x3501c3);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x35')]=function(_0x56ed96,_0x5a4f9a){return this[_0x7df8('0xd')][_0x7df8('0x36')](_0x56ed96,_0x5a4f9a);};EmailChannel[_0x7df8('0x19')][_0x7df8('0x37')]=function(_0x54d4d9){var _0x194f78=this;if(this[_0x7df8('0xf')][_0x54d4d9['id']]){if(_[_0x7df8('0x16')](this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'])){this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp']={};}this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'][_0x7df8('0x33')]=moment();return new BPromise(function(_0x1fb2c5,_0x1969f3){return _0x194f78[_0x7df8('0xd')][_0x7df8('0x38')](_0x54d4d9)[_0x7df8('0x2e')](function(_0x12c65a){_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'][_0x7df8('0x26')]=_0x7df8('0x39');_0x194f78['mailAccounts'][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x14')]='';_0x194f78[_0x7df8('0xe')](_0x54d4d9['id']);_0x1fb2c5(_0x12c65a);})[_0x7df8('0x31')](function(_0xa0148e){_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x26')]='error';_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x14')]=_0xa0148e;_0x194f78[_0x7df8('0xe')](_0x54d4d9['id']);_0x1969f3(_0xa0148e);});});}return this[_0x7df8('0xd')][_0x7df8('0x38')](_0x54d4d9);};module[_0x7df8('0x3b')]=EmailChannel; \ No newline at end of file +var _0x70ac=['socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','bind','handleImapEmail','handleImapEnd','handleImapError','status','disabled','prototype','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','Smtp','verify','then','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x70ac,0x1b8));var _0xc70a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x70ac[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var moment=require(_0xc70a('0x0'));var BPromise=require(_0xc70a('0x1'));var md5=require(_0xc70a('0x2'));var Redis=require(_0xc70a('0x3'));var config=require(_0xc70a('0x4'));var logger=require('../../../config/logger')(_0xc70a('0x5'));config[_0xc70a('0x6')]=_[_0xc70a('0x7')](config[_0xc70a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc70a('0x8'))(new Redis(config[_0xc70a('0x6')]));var EmailImap=require(_0xc70a('0x9'));var EmailSmtp=require(_0xc70a('0xa'));var mailAccount=require(_0xc70a('0xb'));var md5Accounts={};function EmailChannel(_0x41ad33){logger[_0xc70a('0xc')](_0xc70a('0xd'));this['mailAccounts']=_0x41ad33[_0xc70a('0xe')];this[_0xc70a('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xc70a('0x10')]=function(_0x455611){var _0x45f9aa=this[_0xc70a('0xe')][_0x455611];var _0x35f86e={'id':_0x45f9aa['id'],'name':_0x45f9aa[_0xc70a('0x11')],'key':_0x45f9aa[_0xc70a('0x12')],'active':_0x45f9aa[_0xc70a('0x13')],'Imap':{'status':_0x45f9aa['Imap']['status'],'messageStatus':_0x45f9aa[_0xc70a('0x14')][_0xc70a('0x15')],'total':_0x45f9aa[_0xc70a('0x14')][_0xc70a('0x16')]}};if(_[_0xc70a('0x17')](md5Accounts[_0x455611])){md5Accounts[_0x455611]={};}var _0x128694=md5(JSON[_0xc70a('0x18')](_0x35f86e));if(md5Accounts[_0x455611]['md5']!==_0x128694){md5Accounts[_0x455611][_0xc70a('0x2')]=_0x128694;io['emit']('mailAccount:update',_0x35f86e);}};EmailChannel['prototype'][_0xc70a('0x19')]=function(_0x540572){for(var _0x3f066d in _0x540572){if(_0x540572[_0xc70a('0x1a')](_0x3f066d)){if(_0x540572[_0x3f066d][_0xc70a('0x14')]&&_0x540572[_0x3f066d][_0xc70a('0x13')]){var _0x391a3e=_0x540572[_0x3f066d][_0xc70a('0x14')];if(!_0x391a3e['service']&&_0x540572[_0x3f066d][_0xc70a('0x1b')]!==_0xc70a('0x1c'))_0x391a3e[_0xc70a('0x1d')]=_0x540572[_0x3f066d][_0xc70a('0x1b')];if(!this[_0xc70a('0xf')][_0xc70a('0x1a')](_0x391a3e['id'])){this[_0xc70a('0xf')][_0x391a3e['id']]=new EmailImap(_0x391a3e,_0x540572[_0x3f066d]['email']);this['imapAccounts'][_0x391a3e['id']]['on'](_0xc70a('0x1e'),this[_0xc70a('0x1f')][_0xc70a('0x20')](this,_0x3f066d));this[_0xc70a('0xf')][_0x391a3e['id']]['on'](_0xc70a('0x5'),this[_0xc70a('0x21')][_0xc70a('0x20')](this,_0x3f066d));this[_0xc70a('0xf')][_0x391a3e['id']]['on']('end',this[_0xc70a('0x22')]['bind'](this,_0x3f066d));this[_0xc70a('0xf')][_0x391a3e['id']]['on']('error',this[_0xc70a('0x23')]['bind'](this,_0x3f066d));}}else{if(_[_0xc70a('0x17')](this[_0xc70a('0xe')][_0x3f066d][_0xc70a('0x14')])){this[_0xc70a('0xe')][_0x3f066d][_0xc70a('0x14')]={};}this[_0xc70a('0xe')][_0x3f066d]['Imap'][_0xc70a('0x24')]=_0xc70a('0x25');this[_0xc70a('0xe')][_0x3f066d][_0xc70a('0x14')][_0xc70a('0x15')]='';this[_0xc70a('0x10')](_0x3f066d);}}}};EmailChannel[_0xc70a('0x26')]['handleImapBox']=function(_0x795bcc,_0x49d216){if(this[_0xc70a('0xe')][_0x795bcc]){this['mailAccounts'][_0x795bcc][_0xc70a('0x14')][_0xc70a('0x24')]=_0xc70a('0x27');this[_0xc70a('0xe')][_0x795bcc][_0xc70a('0x14')][_0xc70a('0x15')]=_0x49d216[_0xc70a('0x11')];if(_0x49d216[_0xc70a('0x28')]){this[_0xc70a('0xe')][_0x795bcc][_0xc70a('0x14')][_0xc70a('0x16')]=_0x49d216[_0xc70a('0x28')][_0xc70a('0x16')];}return this[_0xc70a('0x10')](_0x795bcc);}};EmailChannel[_0xc70a('0x26')][_0xc70a('0x21')]=function(_0x4e12cb,_0x1f3aad){logger[_0xc70a('0xc')](_0xc70a('0x29'),_0x1f3aad[_0xc70a('0x2a')],_0x1f3aad[_0xc70a('0x2b')],_0x1f3aad[_0xc70a('0x2c')],_0x4e12cb);if(this[_0xc70a('0xe')][_0x4e12cb]){return mailAccount['notify'](_0x4e12cb,_0x1f3aad)['then'](function(_0x5b74d6){if(_0x5b74d6){logger[_0xc70a('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xc70a('0x2d')](function(_0x3fa77c){logger[_0xc70a('0x2e')](_0xc70a('0x2f'),JSON[_0xc70a('0x18')](_0x3fa77c));});}};EmailChannel[_0xc70a('0x26')][_0xc70a('0x22')]=function(_0x39cd5b){if(this['mailAccounts'][_0x39cd5b]&&this['mailAccounts'][_0x39cd5b]['Imap']){if(this[_0xc70a('0xf')][this[_0xc70a('0xe')][_0x39cd5b]['Imap']['id']]){delete this[_0xc70a('0xf')][this[_0xc70a('0xe')][_0x39cd5b][_0xc70a('0x14')]['id']];}this[_0xc70a('0xe')][_0x39cd5b][_0xc70a('0x14')][_0xc70a('0x30')]=moment();this[_0xc70a('0x10')](_0x39cd5b);}};EmailChannel[_0xc70a('0x26')]['handleImapError']=function(_0x54dc2f,_0x2d36ad){if(this[_0xc70a('0xe')][_0x54dc2f]){this[_0xc70a('0xe')][_0x54dc2f][_0xc70a('0x14')]['status']=_0xc70a('0x2e');this['mailAccounts'][_0x54dc2f][_0xc70a('0x14')][_0xc70a('0x15')]=_0x2d36ad;return this[_0xc70a('0x10')](_0x54dc2f);}};EmailChannel['prototype']['sendMail']=function(_0x21e216,_0x5f13b5){return this[_0xc70a('0x31')][_0xc70a('0x32')](_0x21e216,_0x5f13b5);};EmailChannel[_0xc70a('0x26')]['verifySmtp']=function(_0x5c0085){var _0x3f77eb=this;if(this['mailAccounts'][_0x5c0085['id']]){if(_[_0xc70a('0x17')](this[_0xc70a('0xe')][_0x5c0085['id']][_0xc70a('0x33')])){this['mailAccounts'][_0x5c0085['id']][_0xc70a('0x33')]={};}this[_0xc70a('0xe')][_0x5c0085['id']][_0xc70a('0x33')][_0xc70a('0x30')]=moment();return new BPromise(function(_0x227941,_0x3eb8d6){return _0x3f77eb[_0xc70a('0x31')][_0xc70a('0x34')](_0x5c0085)[_0xc70a('0x35')](function(_0x34c0df){_0x3f77eb[_0xc70a('0xe')][_0x5c0085['id']]['Smtp']['status']=_0xc70a('0x36');_0x3f77eb[_0xc70a('0xe')][_0x5c0085['id']]['Smtp'][_0xc70a('0x15')]='';_0x3f77eb['emit'](_0x5c0085['id']);_0x227941(_0x34c0df);})[_0xc70a('0x2d')](function(_0x584f63){_0x3f77eb['mailAccounts'][_0x5c0085['id']][_0xc70a('0x33')][_0xc70a('0x24')]=_0xc70a('0x2e');_0x3f77eb[_0xc70a('0xe')][_0x5c0085['id']][_0xc70a('0x33')][_0xc70a('0x15')]=_0x584f63;_0x3f77eb[_0xc70a('0x10')](_0x5c0085['id']);_0x3eb8d6(_0x584f63);});});}return this[_0xc70a('0x31')][_0xc70a('0x34')](_0x5c0085);};module[_0xc70a('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e68d25b..c4ec593 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 _0x64e6=['generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','autotls','required','handleReady','handleOpenBox','emit','box','readUnseen','search','UNSEEN','length','fetch','handleFetchError','handleCloseBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','Iconv','events','email','mailbox','account','getAccount','once','bind','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x64e6,0xcd));var _0x664e=function(_0x6494a3,_0x35cfc1){_0x6494a3=_0x6494a3-0x0;var _0x1f9bc4=_0x64e6[_0x6494a3];return _0x1f9bc4;};'use strict';var _=require('lodash');var util=require(_0x664e('0x0'));var Imap=require(_0x664e('0x1'));var simpleParser=require(_0x664e('0x2'))[_0x664e('0x3')];var Iconv=require('iconv')[_0x664e('0x4')];var EventEmitter=require(_0x664e('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x664e('0x6'));function EmailImap(_0x4d634c,_0x2e3184){this[_0x664e('0x7')]=_0x4d634c['mailbox'];this[_0x664e('0x8')]=this[_0x664e('0x9')](_0x4d634c,_0x2e3184);this[_0x664e('0x1')]=new Imap(this[_0x664e('0x8')]);this[_0x664e('0x1')][_0x664e('0xa')]('ready',this['handleReady'][_0x664e('0xb')](this));this[_0x664e('0x1')][_0x664e('0xa')](_0x664e('0xc'),this[_0x664e('0xd')][_0x664e('0xb')](this));this['imap']['on'](_0x664e('0xe'),this[_0x664e('0xf')]['bind'](this));this[_0x664e('0x1')]['connect']();}util[_0x664e('0x10')](EmailImap,EventEmitter);EmailImap[_0x664e('0x11')][_0x664e('0x9')]=function(_0x55d989,_0x243848){var _0x4837bd={'connTimeout':_0x55d989[_0x664e('0x12')]?_0x55d989[_0x664e('0x12')]*0x3e8:0x2710,'authTimeout':_0x55d989[_0x664e('0x13')]?_0x55d989[_0x664e('0x13')]*0x3e8:0x1388};if(_0x55d989[_0x664e('0x14')]){_0x4837bd[_0x664e('0x15')]=_0x55d989[_0x664e('0x15')];if(_0x55d989[_0x664e('0x16')]){_0x4837bd['xoauth2']=utils[_0x664e('0x17')](_0x55d989[_0x664e('0x18')]['data5'],_0x55d989[_0x664e('0x15')]);}else{_0x4837bd['password']=_0x55d989[_0x664e('0x19')];}}else{if(_0x55d989[_0x664e('0x1a')]){_0x4837bd[_0x664e('0x15')]=_0x55d989[_0x664e('0x15')];_0x4837bd[_0x664e('0x19')]=_0x55d989['password'];}}_0x4837bd[_0x664e('0x6')]=_0x243848||_0x55d989[_0x664e('0x15')]||'anonymous@xcally.com';_0x4837bd[_0x664e('0x1b')]=_0x55d989['host'];_0x4837bd[_0x664e('0x1c')]=_0x55d989[_0x664e('0x1c')]||0x3e1;if(_0x55d989[_0x664e('0x1d')]){_0x4837bd[_0x664e('0x1d')]=!![];}else{_0x4837bd['tls']=![];_0x4837bd[_0x664e('0x1e')]=_0x664e('0x1f');}return _0x4837bd;};EmailImap[_0x664e('0x11')][_0x664e('0x20')]=function(){this[_0x664e('0x1')]['openBox'](this[_0x664e('0x7')],![],this[_0x664e('0x21')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0x21')]=function(_0x79cc62,_0x540a60){if(_0x79cc62){this[_0x664e('0xf')](_0x79cc62,!![]);}else{this[_0x664e('0x22')](_0x664e('0x23'),_0x540a60);this[_0x664e('0x24')]();}};EmailImap[_0x664e('0x11')]['handleCloseBox']=function(_0x2363bb){if(_0x2363bb){this[_0x664e('0xf')](_0x2363bb,!![]);}else{this['imap'][_0x664e('0xc')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x664e('0x1')][_0x664e('0x25')]([_0x664e('0x26')],this['handleReadUnseen'][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')]['handleReadUnseen']=function(_0x41025d,_0x4cb38f){if(_0x41025d){this[_0x664e('0xf')](_0x41025d,!![]);}else{if(_0x4cb38f[_0x664e('0x27')]){try{var _0x289b50=this[_0x664e('0x1')][_0x664e('0x28')](_0x4cb38f,{'bodies':'','markSeen':!![]});_0x289b50['on']('message',this['handleFetchMessage']['bind'](this));_0x289b50[_0x664e('0xa')](_0x664e('0xe'),this[_0x664e('0x29')][_0x664e('0xb')](this));_0x289b50['once'](_0x664e('0xc'),this['handleFetchEnd'][_0x664e('0xb')](this));}catch(_0xf18e7b){logger[_0x664e('0xe')](_0xf18e7b);}}else{this[_0x664e('0x1')]['closeBox'](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));}}};EmailImap['prototype'][_0x664e('0x2b')]=function(_0xacd7b3){_0xacd7b3['on'](_0x664e('0x2c'),this['handleMessageBody']['bind'](this));_0xacd7b3['once'](_0x664e('0x2d'),this['handleMessageAttributes']['bind'](this));_0xacd7b3[_0x664e('0xa')](_0x664e('0xc'),this[_0x664e('0x2e')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0x2f')]=function(_0x4557f6){simpleParser(_0x4557f6,{'Iconv':Iconv},this[_0x664e('0x30')]['bind'](this));};EmailImap[_0x664e('0x11')][_0x664e('0x31')]=function(){};EmailImap[_0x664e('0x11')][_0x664e('0x2e')]=function(){};EmailImap['prototype'][_0x664e('0x30')]=function(_0x174d10,_0x2039a4){if(_0x174d10){logger[_0x664e('0xe')](_0x174d10);}else{var _0x28ca4a=this;utils[_0x664e('0x32')](this['account'],_0x2039a4,function(_0x4fbf66){_0x28ca4a[_0x664e('0x22')](_0x664e('0x6'),_0x4fbf66);});}};EmailImap[_0x664e('0x11')]['handleFetchEnd']=function(){this[_0x664e('0x1')][_0x664e('0x33')](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));};EmailImap['prototype'][_0x664e('0x29')]=function(_0xb6ccec){this[_0x664e('0xf')](_0xb6ccec);this[_0x664e('0x1')][_0x664e('0x33')](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0xd')]=function(){this[_0x664e('0x22')](_0x664e('0xc'));};EmailImap[_0x664e('0x11')][_0x664e('0xf')]=function(_0x4a4aaf,_0x471750){logger[_0x664e('0xe')]('handleError',this[_0x664e('0x8')][_0x664e('0x6')],JSON[_0x664e('0x34')](_0x4a4aaf));var _0x30122d='';if(_0x4a4aaf){if(_0x4a4aaf[_0x664e('0x35')]){_0x30122d=_0x4a4aaf[_0x664e('0x35')];}else{for(var _0x362ea4 in _0x4a4aaf){if(_0x4a4aaf[_0x664e('0x36')](_0x362ea4)){_0x30122d+=_[_0x664e('0x37')](_0x362ea4)+':\x20'+_0x4a4aaf[_0x362ea4]+'\x0a';}}}}if(_0x471750){this['imap'][_0x664e('0xc')]();}else{this['emit'](_0x664e('0xe'),_0x30122d);this[_0x664e('0x22')]('end');}};module[_0x664e('0x38')]=EmailImap; \ No newline at end of file +var _0x281f=['UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','exports','mailparser','iconv','Iconv','events','EventEmitter','./utils','mailbox','getAccount','account','imap','once','handleReady','handleEnd','bind','error','connect','prototype','connTimeout','authTimeout','user','modernAuthentication','CloudProvider','data5','password','email','host','port','tls','autotls','openBox','handleOpenBox','handleError','emit','box','end','readUnseen','search'];(function(_0xad95c0,_0x496021){var _0x1b30bd=function(_0x3a8c95){while(--_0x3a8c95){_0xad95c0['push'](_0xad95c0['shift']());}};_0x1b30bd(++_0x496021);}(_0x281f,0x171));var _0xf281=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x281f[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require('util');var Imap=require('imap');var simpleParser=require(_0xf281('0x0'))['simpleParser'];var Iconv=require(_0xf281('0x1'))[_0xf281('0x2')];var EventEmitter=require(_0xf281('0x3'))[_0xf281('0x4')];var utils=require(_0xf281('0x5'));var logger=require('../../../config/logger')('email');function EmailImap(_0x333e96,_0x17febf){this['mailbox']=_0x333e96[_0xf281('0x6')];this['account']=this[_0xf281('0x7')](_0x333e96,_0x17febf);this['imap']=new Imap(this[_0xf281('0x8')]);this[_0xf281('0x9')][_0xf281('0xa')]('ready',this[_0xf281('0xb')]['bind'](this));this['imap'][_0xf281('0xa')]('end',this[_0xf281('0xc')][_0xf281('0xd')](this));this[_0xf281('0x9')]['on'](_0xf281('0xe'),this['handleError'][_0xf281('0xd')](this));this[_0xf281('0x9')][_0xf281('0xf')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xf281('0x10')][_0xf281('0x7')]=function(_0x221944,_0x34b279){var _0x116e2a={'connTimeout':_0x221944[_0xf281('0x11')]?_0x221944[_0xf281('0x11')]*0x3e8:0x2710,'authTimeout':_0x221944['authTimeout']?_0x221944[_0xf281('0x12')]*0x3e8:0x1388};if(_0x221944['service']){_0x116e2a[_0xf281('0x13')]=_0x221944[_0xf281('0x13')];if(_0x221944[_0xf281('0x14')]){_0x116e2a['xoauth2']=utils['generateXOAuth2Token'](_0x221944[_0xf281('0x15')][_0xf281('0x16')],_0x221944[_0xf281('0x13')]);}else{_0x116e2a[_0xf281('0x17')]=_0x221944['password'];}}else{if(_0x221944['authentication']){_0x116e2a[_0xf281('0x13')]=_0x221944['user'];_0x116e2a['password']=_0x221944['password'];}}_0x116e2a[_0xf281('0x18')]=_0x34b279||_0x221944[_0xf281('0x13')]||'anonymous@xcally.com';_0x116e2a[_0xf281('0x19')]=_0x221944[_0xf281('0x19')];_0x116e2a['port']=_0x221944[_0xf281('0x1a')]||0x3e1;if(_0x221944[_0xf281('0x1b')]){_0x116e2a['tls']=!![];}else{_0x116e2a[_0xf281('0x1b')]=![];_0x116e2a[_0xf281('0x1c')]='required';}return _0x116e2a;};EmailImap['prototype'][_0xf281('0xb')]=function(){this['imap'][_0xf281('0x1d')](this[_0xf281('0x6')],![],this[_0xf281('0x1e')][_0xf281('0xd')](this));};EmailImap['prototype'][_0xf281('0x1e')]=function(_0x3826c7,_0x1dede9){if(_0x3826c7){this[_0xf281('0x1f')](_0x3826c7,!![]);}else{this[_0xf281('0x20')](_0xf281('0x21'),_0x1dede9);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x117b43){if(_0x117b43){this['handleError'](_0x117b43,!![]);}else{this[_0xf281('0x9')][_0xf281('0x22')]();}};EmailImap['prototype'][_0xf281('0x23')]=function(){this[_0xf281('0x9')][_0xf281('0x24')]([_0xf281('0x25')],this[_0xf281('0x26')][_0xf281('0xd')](this));};EmailImap[_0xf281('0x10')][_0xf281('0x26')]=function(_0x2abf68,_0x4066da){if(_0x2abf68){this['handleError'](_0x2abf68,!![]);}else{if(_0x4066da[_0xf281('0x27')]){try{var _0x201a6b=this['imap'][_0xf281('0x28')](_0x4066da,{'bodies':'','markSeen':!![]});_0x201a6b['on'](_0xf281('0x29'),this[_0xf281('0x2a')]['bind'](this));_0x201a6b[_0xf281('0xa')](_0xf281('0xe'),this[_0xf281('0x2b')]['bind'](this));_0x201a6b[_0xf281('0xa')](_0xf281('0x22'),this[_0xf281('0x2c')][_0xf281('0xd')](this));}catch(_0x3b801d){logger[_0xf281('0xe')](_0x3b801d);}}else{this[_0xf281('0x9')][_0xf281('0x2d')](!![],this[_0xf281('0x2e')][_0xf281('0xd')](this));}}};EmailImap[_0xf281('0x10')]['handleFetchMessage']=function(_0x1558b8){_0x1558b8['on'](_0xf281('0x2f'),this['handleMessageBody'][_0xf281('0xd')](this));_0x1558b8[_0xf281('0xa')](_0xf281('0x30'),this[_0xf281('0x31')][_0xf281('0xd')](this));_0x1558b8['once']('end',this[_0xf281('0x32')][_0xf281('0xd')](this));};EmailImap[_0xf281('0x10')][_0xf281('0x33')]=function(_0x4381c9){simpleParser(_0x4381c9,{'Iconv':Iconv},this[_0xf281('0x34')][_0xf281('0xd')](this));};EmailImap['prototype'][_0xf281('0x31')]=function(){};EmailImap['prototype'][_0xf281('0x32')]=function(){};EmailImap[_0xf281('0x10')][_0xf281('0x34')]=function(_0x18dfe3,_0x350842){if(_0x18dfe3){logger[_0xf281('0xe')](_0x18dfe3);}else{var _0x37a008=this;utils[_0xf281('0x35')](this[_0xf281('0x8')],_0x350842,function(_0xf85054){_0x37a008['emit'](_0xf281('0x18'),_0xf85054);});}};EmailImap[_0xf281('0x10')][_0xf281('0x2c')]=function(){this[_0xf281('0x9')][_0xf281('0x2d')](!![],this[_0xf281('0x2e')][_0xf281('0xd')](this));};EmailImap[_0xf281('0x10')][_0xf281('0x2b')]=function(_0x40983d){this[_0xf281('0x1f')](_0x40983d);this[_0xf281('0x9')][_0xf281('0x2d')](!![],this['handleCloseBox'][_0xf281('0xd')](this));};EmailImap['prototype'][_0xf281('0xc')]=function(){this['emit']('end');};EmailImap[_0xf281('0x10')][_0xf281('0x1f')]=function(_0x5ebc8d,_0x506aa0){logger['error'](_0xf281('0x1f'),this[_0xf281('0x8')][_0xf281('0x18')],JSON['stringify'](_0x5ebc8d));var _0x3a9405='';if(_0x5ebc8d){if(_0x5ebc8d['textCode']){_0x3a9405=_0x5ebc8d[_0xf281('0x36')];}else{for(var _0x52b066 in _0x5ebc8d){if(_0x5ebc8d[_0xf281('0x37')](_0x52b066)){_0x3a9405+=_[_0xf281('0x38')](_0x52b066)+':\x20'+_0x5ebc8d[_0x52b066]+'\x0a';}}}}if(_0x506aa0){this[_0xf281('0x9')][_0xf281('0x22')]();}else{this[_0xf281('0x20')]('error',_0x3a9405);this[_0xf281('0x20')](_0xf281('0x22'));}};module[_0xf281('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d6f9691..f549a93 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 _0x9dde=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9dde,0xeb));var _0xe9dd=function(_0x12d769,_0x47a127){_0x12d769=_0x12d769-0x0;var _0x35987b=_0x9dde[_0x12d769];return _0x35987b;};'use strict';var nodemailer=require(_0xe9dd('0x0'));var inlineBase64=require(_0xe9dd('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xe9dd('0x2')]=function(_0x3b7e4a,_0x13be42){return new Promise(function(_0x4d62f5,_0x18f6f4){var _0x400d5e=nodemailer[_0xe9dd('0x3')](_0x3b7e4a);_0x400d5e[_0xe9dd('0x4')]('compile',inlineBase64());_0x400d5e[_0xe9dd('0x5')](_0x13be42,function(_0x1c6338,_0xf47f0){if(_0x1c6338){_0x18f6f4(_0x1c6338[_0xe9dd('0x6')]());}else{_0x4d62f5(_0xf47f0);}});});};EmailSmtp['prototype'][_0xe9dd('0x7')]=function(_0x4cba6d){return new Promise(function(_0x511c5a,_0x34d3c1){var _0x428fad=nodemailer['createTransport'](_0x4cba6d);_0x428fad['verify'](function(_0x422447,_0x23d082){if(_0x422447){_0x34d3c1(_0x422447['toString']());}else{if(_0x23d082){_0x511c5a(_0x23d082);}else{_0x34d3c1(_0xe9dd('0x8'));}}});});};module[_0xe9dd('0x9')]=EmailSmtp; \ No newline at end of file +var _0xc2e1=['createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','prototype','send'];(function(_0x1df09f,_0x434e9c){var _0xcca1fa=function(_0x48b2ef){while(--_0x48b2ef){_0x1df09f['push'](_0x1df09f['shift']());}};_0xcca1fa(++_0x434e9c);}(_0xc2e1,0x139));var _0x1c2e=function(_0x12e455,_0x581732){_0x12e455=_0x12e455-0x0;var _0x5d5ce7=_0xc2e1[_0x12e455];return _0x5d5ce7;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x1c2e('0x0')][_0x1c2e('0x1')]=function(_0x470d50,_0x12f60c){return new Promise(function(_0xae8310,_0x373623){var _0x5d7d35=nodemailer[_0x1c2e('0x2')](_0x470d50);_0x5d7d35[_0x1c2e('0x3')](_0x1c2e('0x4'),inlineBase64());_0x5d7d35[_0x1c2e('0x5')](_0x12f60c,function(_0xd39565,_0xc93cc2){if(_0xd39565){_0x373623(_0xd39565[_0x1c2e('0x6')]());}else{_0xae8310(_0xc93cc2);}});});};EmailSmtp['prototype'][_0x1c2e('0x7')]=function(_0x5e241c){return new Promise(function(_0x461ddd,_0x1787ad){var _0x4d133b=nodemailer['createTransport'](_0x5e241c);_0x4d133b['verify'](function(_0x36862f,_0x53081d){if(_0x36862f){_0x1787ad(_0x36862f['toString']());}else{if(_0x53081d){_0x461ddd(_0x53081d);}else{_0x1787ad(_0x1c2e('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index fd602dd..bdf274a 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 _0xe3df=['join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length'];(function(_0x3b3bd7,_0x58e72e){var _0x414c31=function(_0x57453a){while(--_0x57453a){_0x3b3bd7['push'](_0x3b3bd7['shift']());}};_0x414c31(++_0x58e72e);}(_0xe3df,0x87));var _0xfe3d=function(_0x2e1997,_0x364eff){_0x2e1997=_0x2e1997-0x0;var _0x2e3dda=_0xe3df[_0x2e1997];return _0x2e3dda;};'use strict';var _=require(_0xfe3d('0x0'));var moment=require(_0xfe3d('0x1'));var random=require(_0xfe3d('0x2'));var fs=require('fs');var path=require(_0xfe3d('0x3'));var util=require(_0xfe3d('0x4'));var tnef=require(_0xfe3d('0x5'));var logger=require(_0xfe3d('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x1dfc9b){var _0x418038=_[_0xfe3d('0x7')](_0x1dfc9b[_0xfe3d('0x8')]);return _0x418038&&_0x418038['address']?_0x418038[_0xfe3d('0x9')]:_0xfe3d('0xa')+random[_0xfe3d('0xb')](0x6)+_0xfe3d('0xc');}function getFirstName(_0x1d9d10){var _0x5212a0=_['head'](_0x1d9d10[_0xfe3d('0x8')]);if(_0x5212a0&&_0x5212a0['name']){if(_0x5212a0['name']==_0x5212a0[_0xfe3d('0x9')]){return _0x5212a0[_0xfe3d('0xd')][_0xfe3d('0xe')](0x0,_0x5212a0[_0xfe3d('0xd')][_0xfe3d('0xf')]('@'));}var _0x3d5753=_0x5212a0[_0xfe3d('0xd')]['split'](/\s+/);return _0x3d5753[_0xfe3d('0x10')]>0x1?_0x3d5753['slice'](0x0,-0x1)[_0xfe3d('0x11')]('\x20'):_0x5212a0[_0xfe3d('0xd')];}return _0xfe3d('0x12');}function getLastName(_0xdcd8e8){var _0x2e434b=_[_0xfe3d('0x7')](_0xdcd8e8[_0xfe3d('0x8')]);if(_0x2e434b&&_0x2e434b[_0xfe3d('0xd')]){var _0x49e096=_0x2e434b[_0xfe3d('0xd')]['split'](/\s+/);return _0x49e096[_0xfe3d('0x10')]>0x1?_0x49e096[_0xfe3d('0x13')]():'';}return'';}function getMails(_0xeee022,_0x417b45){var _0x3e48b2='';for(var _0x59f90c=0x0;_0x59f90c<_0x417b45[_0xfe3d('0x8')]['length'];_0x59f90c+=0x1){if(_0x417b45['value'][_0x59f90c][_0xfe3d('0x9')]!==_0xeee022){if(!_[_0xfe3d('0x14')](_0x3e48b2)){_0x3e48b2+=',';}_0x3e48b2+=_0x417b45[_0xfe3d('0x8')][_0x59f90c]['name']||_0x417b45[_0xfe3d('0x8')][_0x59f90c]['address']||'';_0x3e48b2+='\x20<';_0x3e48b2+=_0x417b45[_0xfe3d('0x8')][_0x59f90c][_0xfe3d('0x9')]?_0x417b45[_0xfe3d('0x8')][_0x59f90c][_0xfe3d('0x9')]:'anonymous'+random['generate'](0x6)+_0xfe3d('0xc');_0x3e48b2+='>';}}return _0x3e48b2;}function parseEmail(_0x503d56,_0x4edb87,_0x454e8c){if(_0x4edb87[_0xfe3d('0x15')]){var _0x1a60b3=/)<[^<]*)*<\/script>/gi;while(_0x1a60b3[_0xfe3d('0x16')](_0x4edb87[_0xfe3d('0x15')])){_0x4edb87['html']=_0x4edb87[_0xfe3d('0x15')]['replace'](_0x1a60b3,'');}if(_0x4edb87[_0xfe3d('0x15')][_0xfe3d('0x17')](_0xfe3d('0x18'))){var _0x51ecd1=[];_0x4edb87[_0xfe3d('0x19')]['forEach'](_0x3e095e=>{_0x51ecd1[_0xfe3d('0x1a')](_0x3e095e[_0xfe3d('0x1b')]);});var _0x1c07a0=/]+>/g;var _0x28ee65=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x437814=_0x4edb87[_0xfe3d('0x15')][_0xfe3d('0x1c')](_0x28ee65,'_SRC');var _0xceb226=_0x437814[_0xfe3d('0x1c')](_0x1c07a0,_0xfe3d('0x1d'));for(let _0x5046eb=0x0;_0x5046eb<_0x51ecd1[_0xfe3d('0x10')];_0x5046eb++){var _0x12b2c8=_0xceb226[_0xfe3d('0x1c')]('_IMG',_0xfe3d('0x1e')+_0x51ecd1[_0x5046eb]+_0xfe3d('0x1f'));_0xceb226=_0x12b2c8;}_0x4edb87['html']=_0xceb226;}_0x454e8c[_0xfe3d('0x20')]=_0x4edb87[_0xfe3d('0x15')];}else{_0x454e8c[_0xfe3d('0x20')]=_0x4edb87[_0xfe3d('0x21')];}if(_0x454e8c[_0xfe3d('0x20')]){_0x454e8c[_0xfe3d('0x20')]=_0x454e8c[_0xfe3d('0x20')]['replace'](/0x0){var _0x276477=[_0xfe3d('0x32'),_0xfe3d('0x33'),_0xfe3d('0x34')];for(var _0x53cf96=0x0;_0x53cf96<_0x4edb87[_0xfe3d('0x31')][_0xfe3d('0x10')];_0x53cf96++){var _0xabd6d8=_['indexOf'](_0x276477,_0x4edb87[_0xfe3d('0x31')][_0x53cf96][_0xfe3d('0x35')]);if(_0xabd6d8>=0x0){_0x454e8c[_0xfe3d('0x36')]=!![];}}}return _0x454e8c;}exports['parser']=function(_0x5a3d60,_0xe958a4,_0x2fa91b){var _0x3262f0={'from':getAddress(_0xe958a4['from']),'firstName':getFirstName(_0xe958a4[_0xfe3d('0x37')]),'lastName':getLastName(_0xe958a4[_0xfe3d('0x37')]),'mapKey':_0xfe3d('0x23'),'message':{'from':getMails(_0x5a3d60[_0xfe3d('0x23')],_0xe958a4['from']),'to':_0x5a3d60[_0xfe3d('0x23')],'cc':'','subject':_0xe958a4['subject']||'','messageId':_0xe958a4[_0xfe3d('0x38')],'inReplyTo':_0xe958a4[_0xfe3d('0x39')],'sentAt':moment(_0xe958a4[_0xfe3d('0x3a')])['format'](_0xfe3d('0x3b')),'attach':![],'attachments':[]}};if(!_0xe958a4[_0xfe3d('0x15')]&&!_0xe958a4['textAsHtml']){var _0xd24643=_[_0xfe3d('0x3c')](_0xe958a4[_0xfe3d('0x19')],{'contentType':_0xfe3d('0x3d')});if(_0xd24643[_0xfe3d('0x10')]){logger[_0xfe3d('0x3e')](util['format'](_0xfe3d('0x3f'),_0xe958a4['messageId']));tnef[_0xfe3d('0x40')](_[_0xfe3d('0x41')](_0xd24643)[_0xfe3d('0x2f')],function(_0x37c46f,_0x467700){if(_0x467700){_0xe958a4[_0xfe3d('0x15')]=_0x467700[_0xfe3d('0x42')]||'

Empty\x20message

';if(_0x467700[_0xfe3d('0x43')]){for(var _0x56075d=0x0;_0x56075d<_0x467700[_0xfe3d('0x43')][_0xfe3d('0x10')];_0x56075d++){var _0x2320f0=_0x467700['Attachments'][_0x56075d];_0x3262f0['message'][_0xfe3d('0x19')]['push']({'filename':_0x2320f0[_0xfe3d('0x44')],'content':Buffer[_0xfe3d('0x37')](_0x2320f0[_0xfe3d('0x45')])});}}}_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));});}else{_0xe958a4[_0xfe3d('0x15')]=_0xfe3d('0x46');_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));}}else{_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));}};exports[_0xfe3d('0x47')]=function(_0x2cfa61,_0x50d61f){var _0x54c0f0=[_0xfe3d('0x48')+(_0x50d61f||''),'auth=Bearer\x20'+_0x2cfa61,'',''];return Buffer[_0xfe3d('0x37')](_0x54c0f0['join'](''),_0xfe3d('0x49'))[_0xfe3d('0x4a')](_0xfe3d('0x4b'));}; \ No newline at end of file +var _0x1a82=['info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','Title','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','value','address','anonymous','generate','@xcally.com','head','name','indexOf','split','length','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x149c24['slice'](0x0,-0x1)['join']('\x20'):_0x15c1bd[_0x21a8('0xd')];}return _0x21a8('0x11');}function getLastName(_0x2f5f02){var _0x4677d4=_['head'](_0x2f5f02[_0x21a8('0x7')]);if(_0x4677d4&&_0x4677d4[_0x21a8('0xd')]){var _0x6e45b7=_0x4677d4['name'][_0x21a8('0xf')](/\s+/);return _0x6e45b7[_0x21a8('0x10')]>0x1?_0x6e45b7[_0x21a8('0x12')]():'';}return'';}function getMails(_0xbf63a9,_0xddfe33){var _0x1b1ca6='';for(var _0x2f2487=0x0;_0x2f2487<_0xddfe33[_0x21a8('0x7')]['length'];_0x2f2487+=0x1){if(_0xddfe33[_0x21a8('0x7')][_0x2f2487][_0x21a8('0x8')]!==_0xbf63a9){if(!_[_0x21a8('0x13')](_0x1b1ca6)){_0x1b1ca6+=',';}_0x1b1ca6+=_0xddfe33['value'][_0x2f2487][_0x21a8('0xd')]||_0xddfe33[_0x21a8('0x7')][_0x2f2487]['address']||'';_0x1b1ca6+='\x20<';_0x1b1ca6+=_0xddfe33[_0x21a8('0x7')][_0x2f2487][_0x21a8('0x8')]?_0xddfe33['value'][_0x2f2487][_0x21a8('0x8')]:_0x21a8('0x9')+random[_0x21a8('0xa')](0x6)+'@xcally.com';_0x1b1ca6+='>';}}return _0x1b1ca6;}function parseEmail(_0x55a6cf,_0x515164,_0x40c3e2){if(_0x515164[_0x21a8('0x14')]){var _0xad74a9=/)<[^<]*)*<\/script>/gi;while(_0xad74a9[_0x21a8('0x15')](_0x515164[_0x21a8('0x14')])){_0x515164[_0x21a8('0x14')]=_0x515164[_0x21a8('0x14')][_0x21a8('0x16')](_0xad74a9,'');}if(_0x515164[_0x21a8('0x14')][_0x21a8('0x17')](_0x21a8('0x18'))){var _0x2b300b=[];_0x515164[_0x21a8('0x19')][_0x21a8('0x1a')](_0x254385=>{_0x2b300b[_0x21a8('0x1b')](_0x254385[_0x21a8('0x1c')]);});var _0x101696=/]+>/g;var _0x4bd94a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x42837e=_0x515164[_0x21a8('0x14')][_0x21a8('0x16')](_0x4bd94a,'_SRC');var _0x20d41c=_0x42837e[_0x21a8('0x16')](_0x101696,_0x21a8('0x1d'));for(let _0x23bb02=0x0;_0x23bb02<_0x2b300b[_0x21a8('0x10')];_0x23bb02++){var _0x5e88ca=_0x20d41c[_0x21a8('0x16')]('_IMG',_0x21a8('0x1e')+_0x2b300b[_0x23bb02]+'\x20]');_0x20d41c=_0x5e88ca;}_0x515164[_0x21a8('0x14')]=_0x20d41c;}_0x40c3e2[_0x21a8('0x1f')]=_0x515164[_0x21a8('0x14')];}else{_0x40c3e2[_0x21a8('0x1f')]=_0x515164[_0x21a8('0x20')];}if(_0x40c3e2[_0x21a8('0x1f')]){_0x40c3e2[_0x21a8('0x1f')]=_0x40c3e2[_0x21a8('0x1f')][_0x21a8('0x16')](/0x0){var _0x452565=[_0x21a8('0x31'),_0x21a8('0x32'),_0x21a8('0x33')];for(var _0x229202=0x0;_0x229202<_0x515164[_0x21a8('0x30')][_0x21a8('0x10')];_0x229202++){var _0x23b522=_[_0x21a8('0xe')](_0x452565,_0x515164['headerLines'][_0x229202]['line']);if(_0x23b522>=0x0){_0x40c3e2['isAutoreply']=!![];}}}return _0x40c3e2;}exports[_0x21a8('0x34')]=function(_0x55605c,_0x19bcb8,_0x59861d){var _0x374a48={'from':getAddress(_0x19bcb8[_0x21a8('0x35')]),'firstName':getFirstName(_0x19bcb8[_0x21a8('0x35')]),'lastName':getLastName(_0x19bcb8['from']),'mapKey':_0x21a8('0x6'),'message':{'from':getMails(_0x55605c['email'],_0x19bcb8[_0x21a8('0x35')]),'to':_0x55605c[_0x21a8('0x6')],'cc':'','subject':_0x19bcb8[_0x21a8('0x36')]||'','messageId':_0x19bcb8['messageId'],'inReplyTo':_0x19bcb8[_0x21a8('0x37')],'sentAt':moment(_0x19bcb8['date'])[_0x21a8('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x19bcb8[_0x21a8('0x14')]&&!_0x19bcb8[_0x21a8('0x20')]){var _0x2ad367=_['filter'](_0x19bcb8[_0x21a8('0x19')],{'contentType':'application/ms-tnef'});if(_0x2ad367[_0x21a8('0x10')]){logger[_0x21a8('0x38')](util[_0x21a8('0x2a')](_0x21a8('0x39'),_0x19bcb8['messageId']));tnef['parseBuffer'](_['first'](_0x2ad367)[_0x21a8('0x2e')],function(_0x4af583,_0x5dc891){if(_0x5dc891){_0x19bcb8[_0x21a8('0x14')]=_0x5dc891[_0x21a8('0x3a')]||_0x21a8('0x3b');if(_0x5dc891[_0x21a8('0x3c')]){for(var _0x585d06=0x0;_0x585d06<_0x5dc891[_0x21a8('0x3c')]['length'];_0x585d06++){var _0x5db5d3=_0x5dc891[_0x21a8('0x3c')][_0x585d06];_0x374a48[_0x21a8('0x22')][_0x21a8('0x19')][_0x21a8('0x1b')]({'filename':_0x5db5d3[_0x21a8('0x3d')],'content':Buffer['from'](_0x5db5d3['Data'])});}}}_0x59861d(parseEmail(_0x55605c,_0x19bcb8,_0x374a48));});}else{_0x19bcb8[_0x21a8('0x14')]='

Empty\x20message

';_0x59861d(parseEmail(_0x55605c,_0x19bcb8,_0x374a48));}}else{_0x59861d(parseEmail(_0x55605c,_0x19bcb8,_0x374a48));}};exports['generateXOAuth2Token']=function(_0x2525fa,_0x282b60){var _0x5e4ee1=['user='+(_0x282b60||''),_0x21a8('0x3e')+_0x2525fa,'',''];return Buffer[_0x21a8('0x35')](_0x5e4ee1[_0x21a8('0x2c')](''),_0x21a8('0x3f'))[_0x21a8('0x40')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7eaa3bf..89b1d1c 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 _0xaa24=['Service','key','SERV','active','Imap','Smtp','lodash','name'];(function(_0x347b73,_0x55d4b2){var _0x43e702=function(_0x9ac1){while(--_0x9ac1){_0x347b73['push'](_0x347b73['shift']());}};_0x43e702(++_0x55d4b2);}(_0xaa24,0x10e));var _0x4aa2=function(_0xb8bbf4,_0x136a2d){_0xb8bbf4=_0xb8bbf4-0x0;var _0x208a08=_0xaa24[_0xb8bbf4];return _0x208a08;};'use strict';var _=require(_0x4aa2('0x0'));function MailAccount(_0x246dc0){this['id']=_0x246dc0['id']||0x0;this[_0x4aa2('0x1')]=_0x246dc0[_0x4aa2('0x1')]||_0x4aa2('0x2');this[_0x4aa2('0x3')]=_0x246dc0[_0x4aa2('0x3')]||_0x4aa2('0x4');this[_0x4aa2('0x5')]=_0x246dc0[_0x4aa2('0x5')]||![];this['Imap']=_0x246dc0[_0x4aa2('0x6')]||[];this[_0x4aa2('0x7')]=_0x246dc0['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x29fc=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x3e0a1e,_0x1b7aa5){var _0x484e00=function(_0x1bd242){while(--_0x1bd242){_0x3e0a1e['push'](_0x3e0a1e['shift']());}};_0x484e00(++_0x1b7aa5);}(_0x29fc,0x19b));var _0xc29f=function(_0x40c4af,_0x2e3e82){_0x40c4af=_0x40c4af-0x0;var _0x3b0ceb=_0x29fc[_0x40c4af];return _0x3b0ceb;};'use strict';var _=require(_0xc29f('0x0'));function MailAccount(_0xe844ab){this['id']=_0xe844ab['id']||0x0;this['name']=_0xe844ab[_0xc29f('0x1')]||_0xc29f('0x2');this['key']=_0xe844ab[_0xc29f('0x3')]||_0xc29f('0x4');this[_0xc29f('0x5')]=_0xe844ab[_0xc29f('0x5')]||![];this[_0xc29f('0x6')]=_0xe844ab[_0xc29f('0x6')]||[];this['Smtp']=_0xe844ab[_0xc29f('0x7')]||[];}module[_0xc29f('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7d1ea67..5d75397 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 _0xabfb=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabfb,0x12f));var _0xbabf=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0xabfb[_0x411e71];return _0x226ae3;};'use strict';var _=require(_0xbabf('0x0'));var MailAccount=require(_0xbabf('0x1'));var Realtime=function(){this[_0xbabf('0x2')]={};};function freeIsNotKey(_0x2045de,_0x4850b8,_0x417eb2){var _0x1c9686=_[_0xbabf('0x3')](_0x2045de,function(_0x2a3fce,_0x390cc3){return _0x2a3fce[_0x417eb2];});for(var _0x6ab122 in _0x4850b8){if(_0x4850b8[_0xbabf('0x4')](_0x6ab122)){if(!_0x1c9686[_0x6ab122]){delete _0x4850b8[_0x6ab122];}}}}Realtime[_0xbabf('0x5')]['mergeFromDatabase']=function(_0x2d2729,_0x297ae0){for(var _0x332d24 in _0x297ae0){if(_0x2d2729['hasOwnProperty'](_0x332d24)){_0x2d2729[_0x332d24]=_0x297ae0[_0x332d24];}}};Realtime[_0xbabf('0x5')][_0xbabf('0x6')]=function(){var _0x32f060=this;return function(_0x16d59f){if(_0x16d59f){freeIsNotKey(_0x16d59f,_0x32f060['mailAccounts'],'id');for(var _0xf1a902=0x0,_0x16fac4={},_0x3d2565={};_0xf1a902<_0x16d59f[_0xbabf('0x7')];_0xf1a902+=0x1){_0x16fac4=_0x16d59f[_0xf1a902];if(_[_0xbabf('0x8')](_0x32f060['mailAccounts'][_0x16fac4['id']])){_0x32f060[_0xbabf('0x2')][_0x16fac4['id']]=new MailAccount(_0x16fac4);}else{_[_0xbabf('0x9')](_0x32f060[_0xbabf('0x2')][_0x16fac4['id']],_0x16fac4);}}}return _0x32f060[_0xbabf('0x2')];};};module[_0xbabf('0xa')]=Realtime; \ No newline at end of file +var _0x186c=['exports','lodash','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','isUndefined','merge'];(function(_0x4c587a,_0x17d523){var _0x1b0662=function(_0x401c19){while(--_0x401c19){_0x4c587a['push'](_0x4c587a['shift']());}};_0x1b0662(++_0x17d523);}(_0x186c,0x65));var _0xc186=function(_0x2135e6,_0x462678){_0x2135e6=_0x2135e6-0x0;var _0x4a6399=_0x186c[_0x2135e6];return _0x4a6399;};'use strict';var _=require(_0xc186('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xc186('0x1')]={};};function freeIsNotKey(_0x3fd4d7,_0x438de2,_0x523dfd){var _0x3fcb7a=_[_0xc186('0x2')](_0x3fd4d7,function(_0x526f74,_0xb6ef04){return _0x526f74[_0x523dfd];});for(var _0x4b8d66 in _0x438de2){if(_0x438de2['hasOwnProperty'](_0x4b8d66)){if(!_0x3fcb7a[_0x4b8d66]){delete _0x438de2[_0x4b8d66];}}}}Realtime[_0xc186('0x3')][_0xc186('0x4')]=function(_0x26f42a,_0x4853d2){for(var _0x3b8327 in _0x4853d2){if(_0x26f42a[_0xc186('0x5')](_0x3b8327)){_0x26f42a[_0x3b8327]=_0x4853d2[_0x3b8327];}}};Realtime[_0xc186('0x3')][_0xc186('0x6')]=function(){var _0x15bcc6=this;return function(_0xfa44b5){if(_0xfa44b5){freeIsNotKey(_0xfa44b5,_0x15bcc6[_0xc186('0x1')],'id');for(var _0x36e31c=0x0,_0x248cb0={},_0x264333={};_0x36e31c<_0xfa44b5['length'];_0x36e31c+=0x1){_0x248cb0=_0xfa44b5[_0x36e31c];if(_[_0xc186('0x7')](_0x15bcc6[_0xc186('0x1')][_0x248cb0['id']])){_0x15bcc6['mailAccounts'][_0x248cb0['id']]=new MailAccount(_0x248cb0);}else{_[_0xc186('0x8')](_0x15bcc6[_0xc186('0x1')][_0x248cb0['id']],_0x248cb0);}}}return _0x15bcc6[_0xc186('0x1')];};};module[_0xc186('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a9ff774..06f53b5 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 _0x1419=['service','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','email','active','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x4e90da,_0x15a81f){var _0x5279e4=function(_0x4c0b5a){while(--_0x4c0b5a){_0x4e90da['push'](_0x4e90da['shift']());}};_0x5279e4(++_0x15a81f);}(_0x1419,0x127));var _0x9141=function(_0x5080cb,_0x24f94e){_0x5080cb=_0x5080cb-0x0;var _0x15dbc2=_0x1419[_0x5080cb];return _0x15dbc2;};'use strict';var client=require(_0x9141('0x0'));exports[_0x9141('0x1')]=function(){return function(){return client[_0x9141('0x2')](_0x9141('0x3'),{'options':{'attributes':['id',_0x9141('0x4'),'provider','service',_0x9141('0x5'),_0x9141('0x6'),'key','ListId',_0x9141('0x7')],'raw':![],'include':[{'model':_0x9141('0x8'),'as':_0x9141('0x9'),'include':[{'model':_0x9141('0xa'),'attributes':['id',_0x9141('0x4'),_0x9141('0xb'),_0x9141('0xc'),_0x9141('0xd')],'as':_0x9141('0xa')}]},{'model':_0x9141('0xe'),'as':'Smtp','include':[{'model':_0x9141('0xa'),'attributes':['id',_0x9141('0x4'),_0x9141('0xb'),_0x9141('0xc'),_0x9141('0xd')],'as':_0x9141('0xa')}]}]},'log':_0x9141('0xf')});};};exports[_0x9141('0x10')]=function(_0x4495ad,_0xeea0f5){return client['Request'](_0x9141('0x11'),{'account':{'id':_0x4495ad},'body':_0xeea0f5,'log':_0x9141('0x11')});}; \ No newline at end of file +var _0x2678=['MailServerIn','Imap','CloudProvider','name','service','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','email','active','key','TemplateId'];(function(_0xb6160,_0x206fdb){var _0xce706e=function(_0x581daa){while(--_0x581daa){_0xb6160['push'](_0xb6160['shift']());}};_0xce706e(++_0x206fdb);}(_0x2678,0x1bb));var _0x8267=function(_0x819e56,_0x34fdd4){_0x819e56=_0x819e56-0x0;var _0x4e78dd=_0x2678[_0x819e56];return _0x4e78dd;};'use strict';var client=require('../client');exports[_0x8267('0x0')]=function(){return function(){return client[_0x8267('0x1')](_0x8267('0x2'),{'options':{'attributes':['id','name','provider','service',_0x8267('0x3'),_0x8267('0x4'),_0x8267('0x5'),'ListId',_0x8267('0x6')],'raw':![],'include':[{'model':_0x8267('0x7'),'as':_0x8267('0x8'),'include':[{'model':_0x8267('0x9'),'attributes':['id',_0x8267('0xa'),_0x8267('0xb'),_0x8267('0xc'),_0x8267('0xd')],'as':'CloudProvider'}]},{'model':_0x8267('0xe'),'as':_0x8267('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x8267('0xa'),_0x8267('0xb'),_0x8267('0xc'),_0x8267('0xd')],'as':_0x8267('0x9')}]}]},'log':'getMailAccount'});};};exports[_0x8267('0x10')]=function(_0x122cb6,_0x2d8da0){return client[_0x8267('0x1')](_0x8267('0x11'),{'account':{'id':_0x122cb6},'body':_0x2d8da0,'log':_0x8267('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 55c0982..4d9eab5 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 _0x5007=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x41d548,_0x2804b2){var _0xe4620f=function(_0x2b076e){while(--_0x2b076e){_0x41d548['push'](_0x41d548['shift']());}};_0xe4620f(++_0x2804b2);}(_0x5007,0x15d));var _0x7500=function(_0x404b40,_0x4497da){_0x404b40=_0x404b40-0x0;var _0x178f3c=_0x5007[_0x404b40];return _0x178f3c;};'use strict';var client=require(_0x7500('0x0'));exports[_0x7500('0x1')]=function(){return client[_0x7500('0x2')](_0x7500('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7500('0x4')]},'log':_0x7500('0x5')});}; \ No newline at end of file +var _0x0a96=['ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a96,0x183));var _0x60a9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0a96[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x60a9('0x0'));exports['getSettings']=function(){return client['Request'](_0x60a9('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x60a9('0x2')]},'log':_0x60a9('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 046bcc5..c268d80 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 2c20f6d..d289c19 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 _0x54a8=['websocket','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','sticky-session','ioredis','createServer','timeout','listen','port','socket.io'];(function(_0xcafd5b,_0x54669a){var _0x32c389=function(_0x2ac6d4){while(--_0x2ac6d4){_0xcafd5b['push'](_0xcafd5b['shift']());}};_0x32c389(++_0x54669a);}(_0x54a8,0x173));var _0x854a=function(_0x374214,_0x262429){_0x374214=_0x374214-0x0;var _0x402719=_0x54a8[_0x374214];return _0x402719;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x854a('0x0'));var Redis=require(_0x854a('0x1'));var config=require('../../config/environment');var app=express();var server=http[_0x854a('0x2')](app);server[_0x854a('0x3')]=0xdbba0;if(sticky[_0x854a('0x4')](server,config[_0x854a('0x5')])){var socketio=require(_0x854a('0x6'))(server,{'transports':[_0x854a('0x7'),'polling']});config[_0x854a('0x8')]=_[_0x854a('0x9')](config[_0x854a('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x854a('0xa')](require(_0x854a('0xb'))({'pubClient':new Redis(config[_0x854a('0x8')]),'subClient':new Redis(config[_0x854a('0x8')])}));require(_0x854a('0xc'))['default']();require(_0x854a('0xd'))[_0x854a('0xe')](socketio);require(_0x854a('0xf'))[_0x854a('0xe')](app);require(_0x854a('0x10'))[_0x854a('0xe')](app);}else{server[_0x854a('0x11')]('listening',function(){console[_0x854a('0x12')](_0x854a('0x13'),config['port']);});}exports=module[_0x854a('0x14')]=app; \ No newline at end of file +var _0xcbe1=['timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xcbe1,0x7f));var _0x1cbe=function(_0x1f20c1,_0x350567){_0x1f20c1=_0x1f20c1-0x0;var _0x548c58=_0xcbe1[_0x1f20c1];return _0x548c58;};'use strict';var _=require('lodash');var http=require(_0x1cbe('0x0'));var express=require(_0x1cbe('0x1'));var sticky=require(_0x1cbe('0x2'));var Redis=require(_0x1cbe('0x3'));var config=require(_0x1cbe('0x4'));var app=express();var server=http['createServer'](app);server[_0x1cbe('0x5')]=0xdbba0;if(sticky[_0x1cbe('0x6')](server,config[_0x1cbe('0x7')])){var socketio=require(_0x1cbe('0x8'))(server,{'transports':[_0x1cbe('0x9'),_0x1cbe('0xa')]});config['redis']=_['defaults'](config[_0x1cbe('0xb')],{'host':_0x1cbe('0xc'),'port':0x18eb});socketio[_0x1cbe('0xd')](require(_0x1cbe('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x1cbe('0xb')])}));require('../../config/triggers')[_0x1cbe('0xf')]();require(_0x1cbe('0x10'))['default'](socketio);require('../../config/express')[_0x1cbe('0xf')](app);require('../../routes')['default'](app);}else{server[_0x1cbe('0x11')](_0x1cbe('0x12'),function(){console[_0x1cbe('0x13')](_0x1cbe('0x14'),config['port']);});}exports=module[_0x1cbe('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 69f8934..e81c7ec 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 _0x3d2f=['catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x1114d6,_0x50f8cd){var _0x28b41d=function(_0x457530){while(--_0x457530){_0x1114d6['push'](_0x1114d6['shift']());}};_0x28b41d(++_0x50f8cd);}(_0x3d2f,0xc6));var _0xf3d2=function(_0x149cf0,_0x55c9a1){_0x149cf0=_0x149cf0-0x0;var _0x350d0d=_0x3d2f[_0x149cf0];return _0x350d0d;};'use strict';var jayson=require(_0xf3d2('0x0'));var BPromise=require(_0xf3d2('0x1'));var logger=require('../../config/logger')(_0xf3d2('0x2'));var client=jayson[_0xf3d2('0x3')][_0xf3d2('0x4')]({'port':0x2329});client[_0xf3d2('0x5')]=function(_0x36bcb6,_0x36fb14){return new BPromise(function(_0x172c0a,_0x2c6b1c){return client[_0xf3d2('0x6')](_0x36bcb6,_0x36fb14)[_0xf3d2('0x7')](function(_0x202cc3){logger[_0xf3d2('0x8')](_0xf3d2('0x9'),_0xf3d2('0x2'),_0x36bcb6,_0x36fb14,_0x202cc3);if(_0x202cc3[_0xf3d2('0xa')]){logger['error'](_0xf3d2('0x9'),'routing',_0x36bcb6,_0x202cc3[_0xf3d2('0xa')][_0xf3d2('0xb')],_0x36fb14);return _0x2c6b1c(_0x202cc3[_0xf3d2('0xa')][_0xf3d2('0xb')]);}else{return _0x172c0a(_0x202cc3['result']);}})[_0xf3d2('0xc')](function(_0x573137){logger[_0xf3d2('0xa')](_0xf3d2('0x9'),_0xf3d2('0x2'),_0x36bcb6,_0x573137,_0x36fb14);return _0x2c6b1c(_0x573137);});});};module[_0xf3d2('0xd')]=client; \ No newline at end of file +var _0x0313=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x40b213,_0x1f010f){var _0x4fc339=function(_0x5c01f6){while(--_0x5c01f6){_0x40b213['push'](_0x40b213['shift']());}};_0x4fc339(++_0x1f010f);}(_0x0313,0x124));var _0x3031=function(_0x95cdb7,_0x17216a){_0x95cdb7=_0x95cdb7-0x0;var _0x805773=_0x0313[_0x95cdb7];return _0x805773;};'use strict';var jayson=require(_0x3031('0x0'));var BPromise=require(_0x3031('0x1'));var logger=require(_0x3031('0x2'))(_0x3031('0x3'));var client=jayson[_0x3031('0x4')][_0x3031('0x5')]({'port':0x2329});client[_0x3031('0x6')]=function(_0x23b2a1,_0x1f1e47){return new BPromise(function(_0x3a4d44,_0x24fe9c){return client[_0x3031('0x7')](_0x23b2a1,_0x1f1e47)[_0x3031('0x8')](function(_0x1f055c){logger[_0x3031('0x9')](_0x3031('0xa'),_0x3031('0x3'),_0x23b2a1,_0x1f1e47,_0x1f055c);if(_0x1f055c[_0x3031('0xb')]){logger[_0x3031('0xb')](_0x3031('0xa'),_0x3031('0x3'),_0x23b2a1,_0x1f055c['error'][_0x3031('0xc')],_0x1f1e47);return _0x24fe9c(_0x1f055c[_0x3031('0xb')]['message']);}else{return _0x3a4d44(_0x1f055c[_0x3031('0xd')]);}})[_0x3031('0xe')](function(_0x3aa54f){logger[_0x3031('0xb')](_0x3031('0xa'),_0x3031('0x3'),_0x23b2a1,_0x3aa54f,_0x1f1e47);return _0x24fe9c(_0x3aa54f);});});};module[_0x3031('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 92fb567..4bf9e67 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 _0x3993=['getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals'];(function(_0x3eb1ec,_0x3e3684){var _0x331a42=function(_0x2f7f3e){while(--_0x2f7f3e){_0x3eb1ec['push'](_0x3eb1ec['shift']());}};_0x331a42(++_0x3e3684);}(_0x3993,0x72));var _0x3399=function(_0x29df67,_0x723968){_0x29df67=_0x29df67-0x0;var _0x3d18da=_0x3993[_0x29df67];return _0x3d18da;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x3399('0x0'));var interval=require(_0x3399('0x1'));var openchannelQueue=require(_0x3399('0x2'));var chatQueue=require(_0x3399('0x3'));var smsQueue=require(_0x3399('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x3399('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3399('0x6')]()['then'](user[_0x3399('0x7')]())[_0x3399('0x8')](realtime[_0x3399('0x9')]())['then'](interval[_0x3399('0xa')]())['then'](realtime[_0x3399('0xb')]())[_0x3399('0x8')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0x3399('0x8')](chatQueue[_0x3399('0xc')]())[_0x3399('0x8')](realtime[_0x3399('0xd')]())[_0x3399('0x8')](smsQueue[_0x3399('0xe')]())['then'](realtime['initSmsQueues']())[_0x3399('0x8')](mailQueue[_0x3399('0xf')]())[_0x3399('0x8')](realtime[_0x3399('0x10')]())[_0x3399('0x8')](faxQueue['getFaxQueues']())[_0x3399('0x8')](realtime[_0x3399('0x11')]())[_0x3399('0x8')](whatsappQueue['getWhatsappQueues']())[_0x3399('0x8')](realtime[_0x3399('0x12')]())[_0x3399('0x8')](function(){return realtime;});}function main(){return server[_0x3399('0x13')](realtime)['then'](function(_0x3eea3a){return initRealtime();})['then'](function(_0x50521d){return setInterval(initRealtime,0x1388);})[_0x3399('0x14')](function(_0x39c44c){console['log'](_0x39c44c);});}main(); \ No newline at end of file +var _0xb7a2=['initWhatsappQueues','listen','catch','log','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x4ad9af,_0x156833){var _0x5d5b75=function(_0x420f2e){while(--_0x420f2e){_0x4ad9af['push'](_0x4ad9af['shift']());}};_0x5d5b75(++_0x156833);}(_0xb7a2,0x77));var _0x2b7a=function(_0x2e41a4,_0x239dad){_0x2e41a4=_0x2e41a4-0x0;var _0x36344e=_0xb7a2[_0x2e41a4];return _0x36344e;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x2b7a('0x0'));var user=require(_0x2b7a('0x1'));var interval=require(_0x2b7a('0x2'));var openchannelQueue=require(_0x2b7a('0x3'));var chatQueue=require(_0x2b7a('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x2b7a('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x2b7a('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x2b7a('0x7')](user[_0x2b7a('0x8')]())[_0x2b7a('0x7')](realtime[_0x2b7a('0x9')]())[_0x2b7a('0x7')](interval[_0x2b7a('0xa')]())[_0x2b7a('0x7')](realtime['initIntervals']())[_0x2b7a('0x7')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x2b7a('0xb')]())[_0x2b7a('0x7')](chatQueue[_0x2b7a('0xc')]())[_0x2b7a('0x7')](realtime[_0x2b7a('0xd')]())['then'](smsQueue['getSmsQueues']())[_0x2b7a('0x7')](realtime[_0x2b7a('0xe')]())[_0x2b7a('0x7')](mailQueue['getMailQueues']())['then'](realtime[_0x2b7a('0xf')]())[_0x2b7a('0x7')](faxQueue[_0x2b7a('0x10')]())['then'](realtime[_0x2b7a('0x11')]())[_0x2b7a('0x7')](whatsappQueue[_0x2b7a('0x12')]())[_0x2b7a('0x7')](realtime[_0x2b7a('0x13')]())[_0x2b7a('0x7')](function(){return realtime;});}function main(){return server[_0x2b7a('0x14')](realtime)[_0x2b7a('0x7')](function(_0x14a541){return initRealtime();})[_0x2b7a('0x7')](function(_0x142a01){return setInterval(initRealtime,0x1388);})[_0x2b7a('0x15')](function(_0x1a8e5d){console[_0x2b7a('0x16')](_0x1a8e5d);});}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 153186d..cf5eec8 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x385fd3,_0x3680b6){var _0x27c543=function(_0x3610cc){while(--_0x3610cc){_0x385fd3['push'](_0x385fd3['shift']());}};_0x27c543(++_0x3680b6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x5fc3[_0x329437];return _0x3789d9;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x357170,_0xbc9fd){var _0x43c671=function(_0x5a7be3){while(--_0x5a7be3){_0x357170['push'](_0x357170['shift']());}};_0x43c671(++_0xbc9fd);}(_0xe14b,0x93));var _0xbe14=function(_0x22466,_0x3b1ca4){_0x22466=_0x22466-0x0;var _0x3ff4bc=_0xe14b[_0x22466];return _0x3ff4bc;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 38581e5..1b3cca2 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 _0xda05=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xda05,0xc0));var _0x5da0=function(_0x27247e,_0x2ef3a1){_0x27247e=_0x27247e-0x0;var _0x16015f=_0xda05[_0x27247e];return _0x16015f;};'use strict';var BPromise=require(_0x5da0('0x0'));var jayson=require(_0x5da0('0x1'));var client=jayson[_0x5da0('0x2')][_0x5da0('0x3')]({'port':0x232b});function request(_0x3a1cff,_0x30d5b6){return new BPromise(function(_0x206692,_0x2ecefd){return client[_0x5da0('0x4')](_0x3a1cff,_0x30d5b6)[_0x5da0('0x5')](function(_0x21f232){if(_0x21f232[_0x5da0('0x6')]){return _0x2ecefd(_0x21f232['error'][_0x5da0('0x7')]);}else{return _0x206692(_0x21f232['result']);}})[_0x5da0('0x8')](function(_0x2be4b9){return _0x2ecefd(_0x2be4b9);});});}exports[_0x5da0('0x9')]=function(_0x10463c,_0x4208f){return request(_0x5da0('0xa'),{'account':_0x10463c,'message':_0x4208f});}; \ No newline at end of file +var _0x7739=['sendMailMessage','jayson/promise','client','http','error','message','result'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7739,0x174));var _0x9773=function(_0x444834,_0x1f960a){_0x444834=_0x444834-0x0;var _0x649b13=_0x7739[_0x444834];return _0x649b13;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9773('0x0'));var client=jayson[_0x9773('0x1')][_0x9773('0x2')]({'port':0x232b});function request(_0x2026b4,_0x350178){return new BPromise(function(_0x31f243,_0x22f86e){return client['request'](_0x2026b4,_0x350178)['then'](function(_0x336833){if(_0x336833[_0x9773('0x3')]){return _0x22f86e(_0x336833[_0x9773('0x3')][_0x9773('0x4')]);}else{return _0x31f243(_0x336833[_0x9773('0x5')]);}})['catch'](function(_0x563f11){return _0x22f86e(_0x563f11);});});}exports[_0x9773('0x6')]=function(_0x4f3401,_0x5481f3){return request('SendMail',{'account':_0x4f3401,'message':_0x5481f3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d543ec1..e11184e 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 _0x0aee=['whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','Status','toNumber','format','online','smsPause','chatCurrentCapacity','faxStatus','faxStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','stringify','emit','user:routing:update','exports','lodash','moment','ioredis','defaults','localhost','socket.io-emitter','name','voicePause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0aee,0x11e));var _0xe0ae=function(_0x4c2687,_0x5c4f38){_0x4c2687=_0x4c2687-0x0;var _0x132287=_0x0aee[_0x4c2687];return _0x132287;};'use strict';var _=require(_0xe0ae('0x0'));var moment=require(_0xe0ae('0x1'));var md5=require('md5');var Redis=require(_0xe0ae('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe0ae('0x3')](config['redis'],{'host':_0xe0ae('0x4'),'port':0x18eb});var io=require(_0xe0ae('0x5'))(new Redis(config['redis']));function Agent(_0x2e1592){this['id']=_0x2e1592['id']||0x0;this[_0xe0ae('0x6')]=_0x2e1592['name']||'';this[_0xe0ae('0x7')]=_0x2e1592[_0xe0ae('0x7')]||![];this['chatPause']=_0x2e1592['chatPause']||![];this['mailPause']=_0x2e1592['mailPause']||![];this[_0xe0ae('0x8')]=_0x2e1592[_0xe0ae('0x8')]||![];this['smsPause']=_0x2e1592['smsPause']||![];this['openchannelPause']=_0x2e1592[_0xe0ae('0x9')]||![];this[_0xe0ae('0xa')]=_0xe0ae('0xb');this[_0xe0ae('0xc')]=0x0;this[_0xe0ae('0xd')]=_0x2e1592[_0xe0ae('0xd')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xe0ae('0xe')]='unknown';this[_0xe0ae('0xf')]=0x0;this['mailCapacity']=_0x2e1592[_0xe0ae('0x10')]||0x0;this[_0xe0ae('0x11')]=0x0;this['faxStatus']=_0xe0ae('0xb');this['faxStatusTime']=0x0;this[_0xe0ae('0x12')]=_0x2e1592['faxCapacity']||0x0;this[_0xe0ae('0x13')]=0x0;this['smsStatus']='unknown';this[_0xe0ae('0x14')]=0x0;this[_0xe0ae('0x15')]=_0x2e1592[_0xe0ae('0x15')]||0x0;this[_0xe0ae('0x16')]=0x0;this[_0xe0ae('0x17')]='unknown';this[_0xe0ae('0x18')]=0x0;this[_0xe0ae('0x19')]=_0x2e1592['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xe0ae('0xb');this['openchannelStatusTime']=0x0;this[_0xe0ae('0x1a')]=_0x2e1592[_0xe0ae('0x1a')]||0x0;this[_0xe0ae('0x1b')]=0x0;this[_0xe0ae('0x1c')]=![];this['busyQueue']=undefined;this[_0xe0ae('0x1d')]='';this[_0xe0ae('0x1e')]={};this[_0xe0ae('0x1f')]={};this[_0xe0ae('0x20')]={};this[_0xe0ae('0x21')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xe0ae('0x22')][_0xe0ae('0x23')]=function(_0xd1aa31){if(this[_0xd1aa31+_0xe0ae('0x24')]>0x0){if(this[_0xd1aa31+_0xe0ae('0x25')]>0x0&&this[_0xd1aa31+'CurrentCapacity']>=this[_0xd1aa31+'Capacity']){return'maxcapacity';}else{return _0xe0ae('0x26');}}else{return _0xe0ae('0x27');}};Agent[_0xe0ae('0x22')][_0xe0ae('0x28')]=function(){var _0x470a36=[_0xe0ae('0x29'),_0xe0ae('0x2a'),_0xe0ae('0x2b'),_0xe0ae('0x2c'),_0xe0ae('0x2d'),'whatsapp'];for(var _0x37fa72=0x0;_0x37fa72<_0x470a36['length'];_0x37fa72+=0x1){var _0x547e23=this[_0xe0ae('0x23')](_0x470a36[_0x37fa72]);if(this[_0x470a36[_0x37fa72]+_0xe0ae('0x2e')]!==_0x547e23){this[_0x470a36[_0x37fa72]+'StatusTime']=_[_0xe0ae('0x2f')](moment()[_0xe0ae('0x30')]('x'));}this[_0x470a36[_0x37fa72]+_0xe0ae('0x2e')]=_0x547e23;}var _0x38ad89={'id':this['id'],'name':this['name'],'online':this[_0xe0ae('0x31')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xe0ae('0x32')],'faxPause':this[_0xe0ae('0x8')],'openchannelPause':this[_0xe0ae('0x9')],'chatStatus':this[_0xe0ae('0xa')],'chatStatusTime':this[_0xe0ae('0xc')],'chatCapacity':this[_0xe0ae('0xd')],'chatCurrentCapacity':this[_0xe0ae('0x33')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xe0ae('0xf')],'mailCapacity':this[_0xe0ae('0x10')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xe0ae('0x34')],'faxStatusTime':this[_0xe0ae('0x35')],'faxCapacity':this[_0xe0ae('0x12')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xe0ae('0x14')],'smsCapacity':this[_0xe0ae('0x15')],'smsCurrentCapacity':this[_0xe0ae('0x16')],'whatsappStatus':this[_0xe0ae('0x17')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xe0ae('0x36')],'openchannelStatus':this[_0xe0ae('0x37')],'openchannelStatusTime':this[_0xe0ae('0x38')],'openchannelCapacity':this[_0xe0ae('0x1a')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xe0ae('0x1c')],'busyQueue':this[_0xe0ae('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xe0ae('0x1f')],'mailWaitingInteractions':this[_0xe0ae('0x20')],'openchannelWaitingInteractions':this[_0xe0ae('0x21')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5d6a4b=md5(JSON[_0xe0ae('0x3a')](_0x38ad89));if(this[_0xe0ae('0x1d')]!==_0x5d6a4b){this[_0xe0ae('0x1d')]=_0x5d6a4b;io[_0xe0ae('0x3b')](_0xe0ae('0x3c'),_0x38ad89);}};module[_0xe0ae('0x3d')]=Agent; \ No newline at end of file +var _0xba65=['lodash','moment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','CurrentCapacity','Capacity','maxcapacity','idle','prototype','mail','chat','openchannel','fax','sms','length','getChannelStatus','Status','toNumber','format','whatsappStatus','busy','faxWaitingInteractions','omit','user:routing:update'];(function(_0x3ad8b0,_0x4df9e4){var _0x12bc90=function(_0x31f1af){while(--_0x31f1af){_0x3ad8b0['push'](_0x3ad8b0['shift']());}};_0x12bc90(++_0x4df9e4);}(_0xba65,0xf8));var _0x5ba6=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xba65[_0x946518];return _0x909b69;};'use strict';var _=require(_0x5ba6('0x0'));var moment=require(_0x5ba6('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x5ba6('0x2')]=_[_0x5ba6('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ba6('0x2')]));function Agent(_0x38e9d7){this['id']=_0x38e9d7['id']||0x0;this[_0x5ba6('0x4')]=_0x38e9d7['name']||'';this[_0x5ba6('0x5')]=_0x38e9d7['online']||!![];this[_0x5ba6('0x6')]=_0x38e9d7[_0x5ba6('0x6')]||![];this[_0x5ba6('0x7')]=_0x38e9d7[_0x5ba6('0x7')]||![];this[_0x5ba6('0x8')]=_0x38e9d7[_0x5ba6('0x8')]||![];this['faxPause']=_0x38e9d7[_0x5ba6('0x9')]||![];this['smsPause']=_0x38e9d7[_0x5ba6('0xa')]||![];this[_0x5ba6('0xb')]=_0x38e9d7[_0x5ba6('0xb')]||![];this[_0x5ba6('0xc')]=_0x5ba6('0xd');this[_0x5ba6('0xe')]=0x0;this[_0x5ba6('0xf')]=_0x38e9d7[_0x5ba6('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x5ba6('0x10')]='unknown';this[_0x5ba6('0x11')]=0x0;this[_0x5ba6('0x12')]=_0x38e9d7['mailCapacity']||0x0;this[_0x5ba6('0x13')]=0x0;this[_0x5ba6('0x14')]='unknown';this[_0x5ba6('0x15')]=0x0;this[_0x5ba6('0x16')]=_0x38e9d7['faxCapacity']||0x0;this[_0x5ba6('0x17')]=0x0;this[_0x5ba6('0x18')]=_0x5ba6('0xd');this[_0x5ba6('0x19')]=0x0;this[_0x5ba6('0x1a')]=_0x38e9d7[_0x5ba6('0x1a')]||0x0;this[_0x5ba6('0x1b')]=0x0;this['whatsappStatus']=_0x5ba6('0xd');this[_0x5ba6('0x1c')]=0x0;this[_0x5ba6('0x1d')]=_0x38e9d7['whatsappCapacity']||0x0;this[_0x5ba6('0x1e')]=0x0;this[_0x5ba6('0x1f')]=_0x5ba6('0xd');this[_0x5ba6('0x20')]=0x0;this[_0x5ba6('0x21')]=_0x38e9d7[_0x5ba6('0x21')]||0x0;this[_0x5ba6('0x22')]=0x0;this['busy']=![];this[_0x5ba6('0x23')]=undefined;this[_0x5ba6('0x24')]={};this['faxWaitingInteractions']={};this[_0x5ba6('0x25')]={};this[_0x5ba6('0x26')]={};this[_0x5ba6('0x27')]={};this[_0x5ba6('0x28')]={};this[_0x5ba6('0x29')]();}Agent['prototype']['getChannelStatus']=function(_0x372937){if(this[_0x372937+_0x5ba6('0x2a')]>0x0){if(this[_0x372937+_0x5ba6('0x2b')]>0x0&&this[_0x372937+'CurrentCapacity']>=this[_0x372937+_0x5ba6('0x2b')]){return _0x5ba6('0x2c');}else{return'working';}}else{return _0x5ba6('0x2d');}};Agent[_0x5ba6('0x2e')][_0x5ba6('0x29')]=function(){var _0x3df458=[_0x5ba6('0x2f'),_0x5ba6('0x30'),_0x5ba6('0x31'),_0x5ba6('0x32'),_0x5ba6('0x33'),'whatsapp'];for(var _0x24b1b7=0x0;_0x24b1b7<_0x3df458[_0x5ba6('0x34')];_0x24b1b7+=0x1){var _0x51aa94=this[_0x5ba6('0x35')](_0x3df458[_0x24b1b7]);if(this[_0x3df458[_0x24b1b7]+_0x5ba6('0x36')]!==_0x51aa94){this[_0x3df458[_0x24b1b7]+'StatusTime']=_[_0x5ba6('0x37')](moment()[_0x5ba6('0x38')]('x'));}this[_0x3df458[_0x24b1b7]+_0x5ba6('0x36')]=_0x51aa94;}var _0x35ba3c={'id':this['id'],'name':this[_0x5ba6('0x4')],'online':this[_0x5ba6('0x5')],'voicePause':this[_0x5ba6('0x6')],'chatPause':this[_0x5ba6('0x7')],'mailPause':this['mailPause'],'smsPause':this[_0x5ba6('0xa')],'faxPause':this[_0x5ba6('0x9')],'openchannelPause':this[_0x5ba6('0xb')],'chatStatus':this[_0x5ba6('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x5ba6('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5ba6('0x10')],'mailStatusTime':this[_0x5ba6('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x5ba6('0x13')],'faxStatus':this[_0x5ba6('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x5ba6('0x18')],'smsStatusTime':this[_0x5ba6('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x5ba6('0x1b')],'whatsappStatus':this[_0x5ba6('0x39')],'whatsappStatusTime':this[_0x5ba6('0x1c')],'whatsappCapacity':this[_0x5ba6('0x1d')],'whatsappCurrentCapacity':this[_0x5ba6('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x5ba6('0x21')],'openchannelCurrentCapacity':this[_0x5ba6('0x22')],'busy':this[_0x5ba6('0x3a')],'busyQueue':this[_0x5ba6('0x23')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x5ba6('0x3b')],'mailWaitingInteractions':this[_0x5ba6('0x25')],'openchannelWaitingInteractions':this[_0x5ba6('0x26')],'smsWaitingInteractions':this[_0x5ba6('0x27')],'whatsappWaitingInteractions':this[_0x5ba6('0x28')]};if(!_['isEqual'](_[_0x5ba6('0x3c')](this,[_0x5ba6('0x5')]),_[_0x5ba6('0x3c')](_0x35ba3c,[_0x5ba6('0x5')]))){io['emit'](_0x5ba6('0x3d'),_0x35ba3c);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7373dcc..283a500 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 _0x4bd4=['chat:queue:%s','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','chatPause','paused','available','format'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x4bd4,0x1a6));var _0x44bd=function(_0x5ca64c,_0x208e45){_0x5ca64c=_0x5ca64c-0x0;var _0x2f5575=_0x4bd4[_0x5ca64c];return _0x2f5575;};'use strict';var _=require(_0x44bd('0x0'));var md5=require(_0x44bd('0x1'));var util=require('util');var Redis=require(_0x44bd('0x2'));var config=require(_0x44bd('0x3'));config[_0x44bd('0x4')]=_[_0x44bd('0x5')](config['redis'],{'host':_0x44bd('0x6'),'port':0x18eb});var io=require(_0x44bd('0x7'))(new Redis(config['redis']));function ChatQueue(_0xd1b41e){this['id']=_0xd1b41e['id']||0x0;this[_0x44bd('0x8')]=_0xd1b41e[_0x44bd('0x8')]||'';this['timeout']=_0xd1b41e[_0x44bd('0x9')]||0xa;this['strategy']=_0xd1b41e['strategy']||_0x44bd('0xa');this[_0x44bd('0xb')]=_0xd1b41e[_0x44bd('0xb')];this[_0x44bd('0xc')]={};this[_0x44bd('0xd')]=0x0;this[_0x44bd('0x1')]='';this[_0x44bd('0xe')]();this[_0x44bd('0xf')]();}ChatQueue[_0x44bd('0x10')][_0x44bd('0xe')]=function(){var _0x1d6f59=this[_0x44bd('0xc')][_0x44bd('0x11')];this[_0x44bd('0xc')]=_[_0x44bd('0x12')](this[_0x44bd('0xb')],'id');this[_0x44bd('0xc')][_0x44bd('0x11')]=_0x1d6f59;};ChatQueue['prototype'][_0x44bd('0xf')]=function(){this[_0x44bd('0x13')]=0x0;this['paused']=0x0;for(var _0x3862fe=0x0;_0x3862fe=0x0?this[_0x44bd('0x18')]:0x0;var _0x28ed4c={'id':this['id'],'available':this[_0x44bd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x44bd('0x8')],'paused':this['paused'],'waiting':this[_0x44bd('0xd')]};var _0x2a3790=md5(JSON['stringify'](_0x28ed4c));if(this[_0x44bd('0x1')]!==_0x2a3790){this[_0x44bd('0x1')]=_0x2a3790;io['to'](util[_0x44bd('0x19')](_0x44bd('0x1a'),_0x28ed4c[_0x44bd('0x8')]))['emit'](_0x44bd('0x1b'),_0x28ed4c);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x2191=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0x2191,0x190));var _0x1219=function(_0x3b4a98,_0x75da2a){_0x3b4a98=_0x3b4a98-0x0;var _0x16f7b9=_0x2191[_0x3b4a98];return _0x16f7b9;};'use strict';var _=require(_0x1219('0x0'));var md5=require(_0x1219('0x1'));var util=require('util');var Redis=require(_0x1219('0x2'));var config=require(_0x1219('0x3'));config[_0x1219('0x4')]=_[_0x1219('0x5')](config[_0x1219('0x4')],{'host':_0x1219('0x6'),'port':0x18eb});var io=require(_0x1219('0x7'))(new Redis(config[_0x1219('0x4')]));function ChatQueue(_0x51c642){this['id']=_0x51c642['id']||0x0;this[_0x1219('0x8')]=_0x51c642[_0x1219('0x8')]||'';this[_0x1219('0x9')]=_0x51c642['timeout']||0xa;this[_0x1219('0xa')]=_0x51c642['strategy']||_0x1219('0xb');this['Agents']=_0x51c642[_0x1219('0xc')];this[_0x1219('0xd')]={};this[_0x1219('0xe')]=0x0;this['md5']='';this[_0x1219('0xf')]();this[_0x1219('0x10')]();}ChatQueue[_0x1219('0x11')]['updateRouting']=function(){var _0x58e3d5=this['mapAgentsId'][_0x1219('0x12')];this[_0x1219('0xd')]=_[_0x1219('0x13')](this['Agents'],'id');this[_0x1219('0xd')][_0x1219('0x12')]=_0x58e3d5;};ChatQueue[_0x1219('0x11')][_0x1219('0x10')]=function(){this[_0x1219('0x14')]=0x0;this[_0x1219('0x15')]=0x0;for(var _0x20ba7f=0x0;_0x20ba7f=0x0?this['available']:0x0;var _0x429b9a={'id':this['id'],'available':this[_0x1219('0x17')],'loggedIn':this[_0x1219('0x14')],'name':this[_0x1219('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0xcfe99f=md5(JSON[_0x1219('0x18')](_0x429b9a));if(this[_0x1219('0x1')]!==_0xcfe99f){this[_0x1219('0x1')]=_0xcfe99f;io['to'](util[_0x1219('0x19')](_0x1219('0x1a'),_0x429b9a[_0x1219('0x8')]))[_0x1219('0x1b')]('chat_queue:save',_0x429b9a);}};module[_0x1219('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3e6e44c..e6d28dc 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 _0x3344=['length','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x5f424f,_0x122b66){var _0x9f4dbd=function(_0x530998){while(--_0x530998){_0x5f424f['push'](_0x5f424f['shift']());}};_0x9f4dbd(++_0x122b66);}(_0x3344,0x1a1));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4334('0x0'));var md5=require(_0x4334('0x1'));var util=require(_0x4334('0x2'));var Redis=require('ioredis');var config=require(_0x4334('0x3'));config[_0x4334('0x4')]=_[_0x4334('0x5')](config[_0x4334('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4334('0x6'))(new Redis(config['redis']));function FaxQueue(_0x324b14){this['id']=_0x324b14['id']||0x0;this[_0x4334('0x7')]=_0x324b14[_0x4334('0x7')]||'';this[_0x4334('0x8')]=_0x324b14['timeout']||0xa;this[_0x4334('0x9')]=_0x324b14[_0x4334('0x9')]||'beepall';this[_0x4334('0xa')]=_0x324b14[_0x4334('0xa')];this[_0x4334('0xb')]={};this['waiting']=0x0;this[_0x4334('0x1')]='';this[_0x4334('0xc')]();this[_0x4334('0xd')]();}FaxQueue[_0x4334('0xe')][_0x4334('0xc')]=function(){var _0x2604e8=this['mapAgentsId'][_0x4334('0xf')];this[_0x4334('0xb')]=_[_0x4334('0x10')](this[_0x4334('0xa')],'id');this[_0x4334('0xb')][_0x4334('0xf')]=_0x2604e8;};FaxQueue['prototype'][_0x4334('0xd')]=function(){this[_0x4334('0x11')]=0x0;this['paused']=0x0;for(var _0x20b106=0x0;_0x20b106=0x0?this[_0x4334('0x15')]:0x0;var _0x5400ef={'id':this['id'],'available':this[_0x4334('0x15')],'loggedIn':this[_0x4334('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4334('0x16')]};var _0x5df213=md5(JSON[_0x4334('0x17')](_0x5400ef));if(this[_0x4334('0x1')]!==_0x5df213){this[_0x4334('0x1')]=_0x5df213;io['to'](util[_0x4334('0x18')](_0x4334('0x19'),_0x5400ef[_0x4334('0x7')]))[_0x4334('0x1a')](_0x4334('0x1b'),_0x5400ef);}};module[_0x4334('0x1c')]=FaxQueue; \ No newline at end of file +var _0x3235=['Agents','mapAgentsId','md5','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','name','waiting','stringify','format','fax:queue:%s','emit','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0x5e9716,_0x395466){var _0x1bd3b0=function(_0x3edab4){while(--_0x3edab4){_0x5e9716['push'](_0x5e9716['shift']());}};_0x1bd3b0(++_0x395466);}(_0x3235,0xfb));var _0x5323=function(_0x3d4d91,_0x4ab437){_0x3d4d91=_0x3d4d91-0x0;var _0x995274=_0x3235[_0x3d4d91];return _0x995274;};'use strict';var _=require(_0x5323('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x5323('0x1'));var config=require(_0x5323('0x2'));config[_0x5323('0x3')]=_[_0x5323('0x4')](config[_0x5323('0x3')],{'host':_0x5323('0x5'),'port':0x18eb});var io=require(_0x5323('0x6'))(new Redis(config[_0x5323('0x3')]));function FaxQueue(_0x1136f2){this['id']=_0x1136f2['id']||0x0;this['name']=_0x1136f2['name']||'';this['timeout']=_0x1136f2[_0x5323('0x7')]||0xa;this[_0x5323('0x8')]=_0x1136f2[_0x5323('0x8')]||_0x5323('0x9');this[_0x5323('0xa')]=_0x1136f2[_0x5323('0xa')];this[_0x5323('0xb')]={};this['waiting']=0x0;this[_0x5323('0xc')]='';this['updateRouting']();this[_0x5323('0xd')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x61a912=this['mapAgentsId'][_0x5323('0xe')];this[_0x5323('0xb')]=_[_0x5323('0xf')](this[_0x5323('0xa')],'id');this[_0x5323('0xb')][_0x5323('0xe')]=_0x61a912;};FaxQueue[_0x5323('0x10')][_0x5323('0xd')]=function(){this[_0x5323('0x11')]=0x0;this[_0x5323('0x12')]=0x0;for(var _0xeffad7=0x0;_0xeffad7=0x0?this[_0x5323('0x16')]:0x0;var _0x516d1c={'id':this['id'],'available':this[_0x5323('0x16')],'loggedIn':this[_0x5323('0x11')],'name':this[_0x5323('0x17')],'paused':this['paused'],'waiting':this[_0x5323('0x18')]};var _0x253ea9=md5(JSON[_0x5323('0x19')](_0x516d1c));if(this[_0x5323('0xc')]!==_0x253ea9){this[_0x5323('0xc')]=_0x253ea9;io['to'](util[_0x5323('0x1a')](_0x5323('0x1b'),_0x516d1c[_0x5323('0x17')]))[_0x5323('0x1c')]('fax_queue:save',_0x516d1c);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0620044..6ae115c 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 _0xa1de=['name','Intervals','exports'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xa1de,0xae));var _0xea1d=function(_0x5cb5fc,_0x6cdda3){_0x5cb5fc=_0x5cb5fc-0x0;var _0x4b6fab=_0xa1de[_0x5cb5fc];return _0x4b6fab;};'use strict';function Interval(_0x5ab3cb){this['id']=_0x5ab3cb['id']||0x0;this['name']=_0x5ab3cb[_0xea1d('0x0')]||'';this[_0xea1d('0x1')]=_0x5ab3cb[_0xea1d('0x1')]||{};}module[_0xea1d('0x2')]=Interval; \ No newline at end of file +var _0x5972=['Intervals','name'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x5972,0x7b));var _0x2597=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5972[_0x618414];return _0x21c19a;};'use strict';function Interval(_0x1fd0c5){this['id']=_0x1fd0c5['id']||0x0;this[_0x2597('0x0')]=_0x1fd0c5[_0x2597('0x0')]||'';this[_0x2597('0x1')]=_0x1fd0c5[_0x2597('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 f6cbb79..beb2258 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 _0x7dd0=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util'];(function(_0x519ce2,_0x32362a){var _0x1a5464=function(_0x52492b){while(--_0x52492b){_0x519ce2['push'](_0x519ce2['shift']());}};_0x1a5464(++_0x32362a);}(_0x7dd0,0x79));var _0x07dd=function(_0x1ff340,_0x43e3e1){_0x1ff340=_0x1ff340-0x0;var _0x1be5ce=_0x7dd0[_0x1ff340];return _0x1be5ce;};'use strict';var _=require(_0x07dd('0x0'));var md5=require(_0x07dd('0x1'));var util=require(_0x07dd('0x2'));var Redis=require(_0x07dd('0x3'));var config=require(_0x07dd('0x4'));config[_0x07dd('0x5')]=_[_0x07dd('0x6')](config[_0x07dd('0x5')],{'host':_0x07dd('0x7'),'port':0x18eb});var io=require(_0x07dd('0x8'))(new Redis(config[_0x07dd('0x5')]));function MailQueue(_0x184655){this['id']=_0x184655['id']||0x0;this[_0x07dd('0x9')]=_0x184655[_0x07dd('0x9')]||'';this[_0x07dd('0xa')]=_0x184655[_0x07dd('0xa')]||0xa;this['strategy']=_0x184655[_0x07dd('0xb')]||_0x07dd('0xc');this[_0x07dd('0xd')]=_0x184655[_0x07dd('0xd')];this[_0x07dd('0xe')]={};this[_0x07dd('0xf')]=0x0;this['md5']='';this['updateRouting']();this[_0x07dd('0x10')]();}MailQueue[_0x07dd('0x11')]['updateRouting']=function(){var _0x55475c=this[_0x07dd('0xe')][_0x07dd('0x12')];this['mapAgentsId']=_[_0x07dd('0x13')](this[_0x07dd('0xd')],'id');this[_0x07dd('0xe')][_0x07dd('0x12')]=_0x55475c;};MailQueue[_0x07dd('0x11')]['updateRealtime']=function(){this[_0x07dd('0x14')]=0x0;this['paused']=0x0;for(var _0x12a7a0=0x0;_0x12a7a0=0x0?this[_0x07dd('0x18')]:0x0;var _0x2cf4e7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x07dd('0x14')],'name':this[_0x07dd('0x9')],'paused':this['paused'],'waiting':this[_0x07dd('0xf')]};var _0x23f724=md5(JSON[_0x07dd('0x19')](_0x2cf4e7));if(this[_0x07dd('0x1')]!==_0x23f724){this[_0x07dd('0x1')]=_0x23f724;io['to'](util[_0x07dd('0x1a')](_0x07dd('0x1b'),_0x2cf4e7['name']))[_0x07dd('0x1c')](_0x07dd('0x1d'),_0x2cf4e7);}};module[_0x07dd('0x1e')]=MailQueue; \ No newline at end of file +var _0x6910=['lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','exports'];(function(_0x7e247f,_0x469d63){var _0x344f84=function(_0x42604f){while(--_0x42604f){_0x7e247f['push'](_0x7e247f['shift']());}};_0x344f84(++_0x469d63);}(_0x6910,0x186));var _0x0691=function(_0x248be0,_0x189220){_0x248be0=_0x248be0-0x0;var _0x2cafb0=_0x6910[_0x248be0];return _0x2cafb0;};'use strict';var _=require(_0x0691('0x0'));var md5=require(_0x0691('0x1'));var util=require(_0x0691('0x2'));var Redis=require(_0x0691('0x3'));var config=require(_0x0691('0x4'));config['redis']=_['defaults'](config[_0x0691('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0691('0x6'))(new Redis(config[_0x0691('0x5')]));function MailQueue(_0x445a43){this['id']=_0x445a43['id']||0x0;this[_0x0691('0x7')]=_0x445a43[_0x0691('0x7')]||'';this[_0x0691('0x8')]=_0x445a43[_0x0691('0x8')]||0xa;this[_0x0691('0x9')]=_0x445a43['strategy']||_0x0691('0xa');this[_0x0691('0xb')]=_0x445a43[_0x0691('0xb')];this[_0x0691('0xc')]={};this[_0x0691('0xd')]=0x0;this['md5']='';this[_0x0691('0xe')]();this[_0x0691('0xf')]();}MailQueue[_0x0691('0x10')]['updateRouting']=function(){var _0x89329d=this['mapAgentsId'][_0x0691('0x11')];this[_0x0691('0xc')]=_[_0x0691('0x12')](this[_0x0691('0xb')],'id');this[_0x0691('0xc')][_0x0691('0x11')]=_0x89329d;};MailQueue[_0x0691('0x10')]['updateRealtime']=function(){this[_0x0691('0x13')]=0x0;this[_0x0691('0x14')]=0x0;for(var _0x1926b8=0x0;_0x1926b8=0x0?this[_0x0691('0x18')]:0x0;var _0x333a40={'id':this['id'],'available':this[_0x0691('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x0691('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4d5166=md5(JSON[_0x0691('0x19')](_0x333a40));if(this['md5']!==_0x4d5166){this[_0x0691('0x1')]=_0x4d5166;io['to'](util[_0x0691('0x1a')]('mail:queue:%s',_0x333a40[_0x0691('0x7')]))[_0x0691('0x1b')](_0x0691('0x1c'),_0x333a40);}};module[_0x0691('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4c52b6b..1a26925 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 _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(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x2ef3,0xba));var _0x32ef=function(_0x1ee9eb,_0x549c99){_0x1ee9eb=_0x1ee9eb-0x0;var _0x20a371=_0x2ef3[_0x1ee9eb];return _0x20a371;};'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 +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7a54,0x106));var _0x47a5=function(_0x16983f,_0x26ea5d){_0x16983f=_0x16983f-0x0;var _0x341de2=_0x7a54[_0x16983f];return _0x341de2;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 84c4541..6bee2f4 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 _0xdace=['sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','md5','format','sms:queue:%s','emit'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xdace,0xc5));var _0xedac=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xdace[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0xedac('0x0'));var md5=require('md5');var util=require(_0xedac('0x1'));var Redis=require(_0xedac('0x2'));var config=require(_0xedac('0x3'));config['redis']=_[_0xedac('0x4')](config[_0xedac('0x5')],{'host':_0xedac('0x6'),'port':0x18eb});var io=require(_0xedac('0x7'))(new Redis(config['redis']));function SmsQueue(_0x32b066){this['id']=_0x32b066['id']||0x0;this[_0xedac('0x8')]=_0x32b066[_0xedac('0x8')]||'';this['timeout']=_0x32b066[_0xedac('0x9')]||0xa;this[_0xedac('0xa')]=_0x32b066[_0xedac('0xa')]||'beepall';this[_0xedac('0xb')]=_0x32b066[_0xedac('0xb')];this[_0xedac('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xedac('0xd')]();this[_0xedac('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x4db2ad=this[_0xedac('0xc')]['_rr'];this[_0xedac('0xc')]=_['map'](this[_0xedac('0xb')],'id');this[_0xedac('0xc')][_0xedac('0xf')]=_0x4db2ad;};SmsQueue[_0xedac('0x10')][_0xedac('0xe')]=function(){this[_0xedac('0x11')]=0x0;this[_0xedac('0x12')]=0x0;for(var _0x11f0b0=0x0;_0x11f0b0=0x0?this['available']:0x0;var _0x4b2563={'id':this['id'],'available':this[_0xedac('0x15')],'loggedIn':this[_0xedac('0x11')],'name':this[_0xedac('0x8')],'paused':this[_0xedac('0x12')],'waiting':this['waiting']};var _0x4a699b=md5(JSON[_0xedac('0x16')](_0x4b2563));if(this[_0xedac('0x17')]!==_0x4a699b){this[_0xedac('0x17')]=_0x4a699b;io['to'](util[_0xedac('0x18')](_0xedac('0x19'),_0x4b2563[_0xedac('0x8')]))[_0xedac('0x1a')](_0xedac('0x1b'),_0x4b2563);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xc090=['map','_rr','loggedIn','paused','length','online','available','name','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting'];(function(_0x4ed4af,_0x4a1a9c){var _0x4191a3=function(_0x1616f0){while(--_0x1616f0){_0x4ed4af['push'](_0x4ed4af['shift']());}};_0x4191a3(++_0x4a1a9c);}(_0xc090,0x112));var _0x0c09=function(_0x77c3a7,_0xe80d7){_0x77c3a7=_0x77c3a7-0x0;var _0x328daa=_0xc090[_0x77c3a7];return _0x328daa;};'use strict';var _=require(_0x0c09('0x0'));var md5=require(_0x0c09('0x1'));var util=require(_0x0c09('0x2'));var Redis=require(_0x0c09('0x3'));var config=require(_0x0c09('0x4'));config[_0x0c09('0x5')]=_[_0x0c09('0x6')](config[_0x0c09('0x5')],{'host':_0x0c09('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c09('0x5')]));function SmsQueue(_0x31863d){this['id']=_0x31863d['id']||0x0;this['name']=_0x31863d['name']||'';this[_0x0c09('0x8')]=_0x31863d['timeout']||0xa;this[_0x0c09('0x9')]=_0x31863d[_0x0c09('0x9')]||_0x0c09('0xa');this['Agents']=_0x31863d[_0x0c09('0xb')];this[_0x0c09('0xc')]={};this['waiting']=0x0;this[_0x0c09('0x1')]='';this['updateRouting']();this[_0x0c09('0xd')]();}SmsQueue[_0x0c09('0xe')][_0x0c09('0xf')]=function(){var _0x33b883=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x0c09('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x0c09('0x11')]=_0x33b883;};SmsQueue['prototype'][_0x0c09('0xd')]=function(){this[_0x0c09('0x12')]=0x0;this[_0x0c09('0x13')]=0x0;for(var _0xeb18fb=0x0;_0xeb18fb=0x0?this[_0x0c09('0x16')]:0x0;var _0x1bc3fd={'id':this['id'],'available':this[_0x0c09('0x16')],'loggedIn':this[_0x0c09('0x12')],'name':this[_0x0c09('0x17')],'paused':this[_0x0c09('0x13')],'waiting':this['waiting']};var _0x8a9f49=md5(JSON[_0x0c09('0x18')](_0x1bc3fd));if(this['md5']!==_0x8a9f49){this['md5']=_0x8a9f49;io['to'](util[_0x0c09('0x19')](_0x0c09('0x1a'),_0x1bc3fd[_0x0c09('0x17')]))['emit'](_0x0c09('0x1b'),_0x1bc3fd);}};module[_0x0c09('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c47a74a..b0b7f23 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 _0xd4a7=['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','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify'];(function(_0x266a33,_0x579047){var _0xd679ce=function(_0x54b45b){while(--_0x54b45b){_0x266a33['push'](_0x266a33['shift']());}};_0xd679ce(++_0x579047);}(_0xd4a7,0x164));var _0x7d4a=function(_0x427f07,_0x129488){_0x427f07=_0x427f07-0x0;var _0x407c21=_0xd4a7[_0x427f07];return _0x407c21;};'use strict';var _=require(_0x7d4a('0x0'));var md5=require(_0x7d4a('0x1'));var util=require(_0x7d4a('0x2'));var Redis=require(_0x7d4a('0x3'));var config=require(_0x7d4a('0x4'));config[_0x7d4a('0x5')]=_[_0x7d4a('0x6')](config[_0x7d4a('0x5')],{'host':_0x7d4a('0x7'),'port':0x18eb});var io=require(_0x7d4a('0x8'))(new Redis(config[_0x7d4a('0x5')]));function WhatsappQueue(_0x3543a8){this['id']=_0x3543a8['id']||0x0;this[_0x7d4a('0x9')]=_0x3543a8['name']||'';this[_0x7d4a('0xa')]=_0x3543a8[_0x7d4a('0xa')]||0xa;this[_0x7d4a('0xb')]=_0x3543a8['strategy']||_0x7d4a('0xc');this['Agents']=_0x3543a8[_0x7d4a('0xd')];this[_0x7d4a('0xe')]={};this['waiting']=0x0;this[_0x7d4a('0x1')]='';this[_0x7d4a('0xf')]();this[_0x7d4a('0x10')]();}WhatsappQueue[_0x7d4a('0x11')][_0x7d4a('0xf')]=function(){var _0x463ba2=this[_0x7d4a('0xe')][_0x7d4a('0x12')];this[_0x7d4a('0xe')]=_[_0x7d4a('0x13')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x463ba2;};WhatsappQueue['prototype'][_0x7d4a('0x10')]=function(){this[_0x7d4a('0x14')]=0x0;this[_0x7d4a('0x15')]=0x0;for(var _0x1051fc=0x0;_0x1051fc=0x0?this[_0x7d4a('0x19')]:0x0;var _0x180017={'id':this['id'],'available':this[_0x7d4a('0x19')],'loggedIn':this[_0x7d4a('0x14')],'name':this['name'],'paused':this[_0x7d4a('0x15')],'waiting':this[_0x7d4a('0x1a')]};var _0x4ea1b6=md5(JSON[_0x7d4a('0x1b')](_0x180017));if(this['md5']!==_0x4ea1b6){this[_0x7d4a('0x1')]=_0x4ea1b6;io['to'](util['format'](_0x7d4a('0x1c'),_0x180017['name']))[_0x7d4a('0x1d')](_0x7d4a('0x1e'),_0x180017);}};module[_0x7d4a('0x1f')]=WhatsappQueue; \ No newline at end of file +var _0x2721=['whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','paused','length','online','loggedIn'];(function(_0xf561fd,_0x36f3d0){var _0x1dc399=function(_0xcdfd7){while(--_0xcdfd7){_0xf561fd['push'](_0xf561fd['shift']());}};_0x1dc399(++_0x36f3d0);}(_0x2721,0xe6));var _0x1272=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x2721[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x1272('0x0'));var md5=require(_0x1272('0x1'));var util=require(_0x1272('0x2'));var Redis=require(_0x1272('0x3'));var config=require(_0x1272('0x4'));config[_0x1272('0x5')]=_[_0x1272('0x6')](config[_0x1272('0x5')],{'host':_0x1272('0x7'),'port':0x18eb});var io=require(_0x1272('0x8'))(new Redis(config[_0x1272('0x5')]));function WhatsappQueue(_0x413137){this['id']=_0x413137['id']||0x0;this[_0x1272('0x9')]=_0x413137[_0x1272('0x9')]||'';this[_0x1272('0xa')]=_0x413137[_0x1272('0xa')]||0xa;this[_0x1272('0xb')]=_0x413137[_0x1272('0xb')]||_0x1272('0xc');this[_0x1272('0xd')]=_0x413137[_0x1272('0xd')];this[_0x1272('0xe')]={};this['waiting']=0x0;this[_0x1272('0x1')]='';this['updateRouting']();this[_0x1272('0xf')]();}WhatsappQueue[_0x1272('0x10')]['updateRouting']=function(){var _0xad3433=this['mapAgentsId'][_0x1272('0x11')];this[_0x1272('0xe')]=_['map'](this[_0x1272('0xd')],'id');this[_0x1272('0xe')][_0x1272('0x11')]=_0xad3433;};WhatsappQueue[_0x1272('0x10')][_0x1272('0xf')]=function(){this['loggedIn']=0x0;this[_0x1272('0x12')]=0x0;for(var _0x3a42d2=0x0;_0x3a42d2=0x0?this['available']:0x0;var _0x18ce7e={'id':this['id'],'available':this[_0x1272('0x17')],'loggedIn':this[_0x1272('0x15')],'name':this['name'],'paused':this[_0x1272('0x12')],'waiting':this['waiting']};var _0x5ad891=md5(JSON[_0x1272('0x18')](_0x18ce7e));if(this[_0x1272('0x1')]!==_0x5ad891){this['md5']=_0x5ad891;io['to'](util['format'](_0x1272('0x19'),_0x18ce7e['name']))['emit'](_0x1272('0x1a'),_0x18ce7e);}};module[_0x1272('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2d371e0..13570cb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x39235a,_0x429bfd){var _0x2bada9=function(_0x52b842){while(--_0x52b842){_0x39235a['push'](_0x39235a['shift']());}};_0x2bada9(++_0x429bfd);}(_0xb10b,0x12a));var _0xbb10=function(_0x53c5cf,_0x3ef208){_0x53c5cf=_0x53c5cf-0x0;var _0x3261aa=_0xb10b[_0x53c5cf];return _0x3261aa;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0ddb6c4..0e5e441 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 _0x76d5=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','update','Request'];(function(_0xdee740,_0x40916d){var _0x5bc51f=function(_0x573331){while(--_0x573331){_0xdee740['push'](_0xdee740['shift']());}};_0x5bc51f(++_0x40916d);}(_0x76d5,0x70));var _0x576d=function(_0x3c1e9e,_0x43fd56){_0x3c1e9e=_0x3c1e9e-0x0;var _0x53bac3=_0x76d5[_0x3c1e9e];return _0x53bac3;};'use strict';var client=require('../client');exports[_0x576d('0x0')]=function(_0x3ed882,_0x1332ca){return client[_0x576d('0x1')](_0x576d('0x2'),{'body':_0x1332ca,'options':{'where':{'id':_0x3ed882}},'log':_0x576d('0x3')});};exports[_0x576d('0x4')]=function(_0x65da34,_0x1a2e6d){return client[_0x576d('0x1')]('AddTagsToChatInteraction',{'body':_0x1a2e6d,'options':{'where':{'id':_0x65da34}},'log':_0x576d('0x5')});}; \ No newline at end of file +var _0xdd5f=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction'];(function(_0x7770df,_0x4cbfc3){var _0x2109fd=function(_0x13c1e9){while(--_0x13c1e9){_0x7770df['push'](_0x7770df['shift']());}};_0x2109fd(++_0x4cbfc3);}(_0xdd5f,0x1e7));var _0xfdd5=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xdd5f[_0x39e84d];return _0x1991bc;};'use strict';var client=require(_0xfdd5('0x0'));exports[_0xfdd5('0x1')]=function(_0x3cfbd1,_0x1a2def){return client['Request']('UpdateChatInteraction',{'body':_0x1a2def,'options':{'where':{'id':_0x3cfbd1}},'log':_0xfdd5('0x2')});};exports[_0xfdd5('0x3')]=function(_0x216bc2,_0xcf7750){return client[_0xfdd5('0x4')](_0xfdd5('0x5'),{'body':_0xcf7750,'options':{'where':{'id':_0x216bc2}},'log':_0xfdd5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 71f9fca..856ba42 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 _0xeb82=['CreateChatMessage','../client','Request'];(function(_0x4835b2,_0x3c93da){var _0x57d8a4=function(_0x4a5c0f){while(--_0x4a5c0f){_0x4835b2['push'](_0x4835b2['shift']());}};_0x57d8a4(++_0x3c93da);}(_0xeb82,0x1c9));var _0x2eb8=function(_0x359ea9,_0x405aeb){_0x359ea9=_0x359ea9-0x0;var _0x36ae73=_0xeb82[_0x359ea9];return _0x36ae73;};'use strict';var client=require(_0x2eb8('0x0'));exports['create']=function(_0x4b98ac){return client[_0x2eb8('0x1')](_0x2eb8('0x2'),{'body':_0x4b98ac,'log':'createChatMessage'});}; \ No newline at end of file +var _0x64aa=['create','Request','CreateChatMessage','../client'];(function(_0x309bde,_0x3ef7f5){var _0x5fa8bc=function(_0x521e70){while(--_0x521e70){_0x309bde['push'](_0x309bde['shift']());}};_0x5fa8bc(++_0x3ef7f5);}(_0x64aa,0xf3));var _0xa64a=function(_0x1deba7,_0x30f270){_0x1deba7=_0x1deba7-0x0;var _0x2dcc31=_0x64aa[_0x1deba7];return _0x2dcc31;};'use strict';var client=require(_0xa64a('0x0'));exports[_0xa64a('0x1')]=function(_0x3030eb){return client[_0xa64a('0x2')](_0xa64a('0x3'),{'body':_0x3030eb,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index acf0490..1940728 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 _0x861a=['User','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x861a,0x194));var _0xa861=function(_0x3f8f89,_0x4226e3){_0x3f8f89=_0x3f8f89-0x0;var _0x4d8adf=_0x861a[_0x3f8f89];return _0x4d8adf;};'use strict';var client=require(_0xa861('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa861('0x1')](_0xa861('0x2'),{'options':{'raw':![],'attributes':['id',_0xa861('0x3'),_0xa861('0x4'),_0xa861('0x5')],'include':[{'model':_0xa861('0x6'),'as':'Agents','attributes':['id',_0xa861('0x3'),_0xa861('0x7'),_0xa861('0x8')]}]},'log':_0xa861('0x9')});};}; \ No newline at end of file +var _0x4f17=['strategy','User','Agents','name','getChatQueues','../client','Request','GetChatQueue','timeout'];(function(_0x1edba7,_0x31d2ef){var _0xa33f93=function(_0x5a84a2){while(--_0x5a84a2){_0x1edba7['push'](_0x1edba7['shift']());}};_0xa33f93(++_0x31d2ef);}(_0x4f17,0x9e));var _0x74f1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4f17[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x74f1('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x74f1('0x1')](_0x74f1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x74f1('0x3'),_0x74f1('0x4')],'include':[{'model':_0x74f1('0x5'),'as':_0x74f1('0x6'),'attributes':['id',_0x74f1('0x7'),'online','chatPause']}]},'log':_0x74f1('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index bb2f04d..d9bfe1e 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 _0x7217=['update','Request','UpdateChatQueueReport','DESC','CreateChatQueueReport'];(function(_0x336cda,_0x3a7718){var _0x190b40=function(_0x2a0b94){while(--_0x2a0b94){_0x336cda['push'](_0x336cda['shift']());}};_0x190b40(++_0x3a7718);}(_0x7217,0xa9));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var client=require('../client');exports['create']=function(_0x3f36a3){return client['Request'](_0x7721('0x0'),{'body':_0x3f36a3,'log':_0x7721('0x0')});};exports[_0x7721('0x1')]=function(_0x18353b,_0x363be8){return client[_0x7721('0x2')](_0x7721('0x3'),{'body':_0x363be8,'options':{'where':{'uniqueid':_0x18353b},'order':[['id',_0x7721('0x4')]],'limit':0x1},'log':_0x7721('0x3')});}; \ No newline at end of file +var _0x097c=['../client','create','CreateChatQueueReport','update','Request','DESC','UpdateChatQueueReport'];(function(_0x94f80c,_0x28371f){var _0x2f1d6d=function(_0x3caa8f){while(--_0x3caa8f){_0x94f80c['push'](_0x94f80c['shift']());}};_0x2f1d6d(++_0x28371f);}(_0x097c,0x1d5));var _0xc097=function(_0x3762d5,_0x5a0aa9){_0x3762d5=_0x3762d5-0x0;var _0x465ba2=_0x097c[_0x3762d5];return _0x465ba2;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(_0x334a7c){return client['Request'](_0xc097('0x2'),{'body':_0x334a7c,'log':_0xc097('0x2')});};exports[_0xc097('0x3')]=function(_0x1b9efd,_0x5aa3c1){return client[_0xc097('0x4')]('UpdateChatQueueReport',{'body':_0x5aa3c1,'options':{'where':{'uniqueid':_0x1b9efd},'order':[['id',_0xc097('0x5')]],'limit':0x1},'log':_0xc097('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 926eb37..33fca17 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(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x7a54,0x106));var _0x47a5=function(_0x1c7c55,_0x4537ba){_0x1c7c55=_0x1c7c55-0x0;var _0x39b400=_0x7a54[_0x1c7c55];return _0x39b400;};'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(_0x52be4c,_0x5ef24f){var _0x477943=function(_0xac2200){while(--_0xac2200){_0x52be4c['push'](_0x52be4c['shift']());}};_0x477943(++_0x5ef24f);}(_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 7c610e4..21753b8 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 _0xf878=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x116e47,_0x2ee4d4){var _0xfcfb2a=function(_0x3f4a41){while(--_0x3f4a41){_0x116e47['push'](_0x116e47['shift']());}};_0xfcfb2a(++_0x2ee4d4);}(_0xf878,0x75));var _0x8f87=function(_0x1d1219,_0x51cfd2){_0x1d1219=_0x1d1219-0x0;var _0x31373a=_0xf878[_0x1d1219];return _0x31373a;};'use strict';var client=require(_0x8f87('0x0'));exports['create']=function(_0x106c4c){return client[_0x8f87('0x1')](_0x8f87('0x2'),{'body':_0x106c4c,'log':_0x8f87('0x3')});}; \ No newline at end of file +var _0x7a64=['CreateFaxMessage','createFaxMessage','Request'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7a64,0xc2));var _0x47a6=function(_0x15a6a9,_0x5a75f5){_0x15a6a9=_0x15a6a9-0x0;var _0x3fc116=_0x7a64[_0x15a6a9];return _0x3fc116;};'use strict';var client=require('../client');exports['create']=function(_0x3277f2){return client[_0x47a6('0x0')](_0x47a6('0x1'),{'body':_0x3277f2,'log':_0x47a6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5f62108..2e00b67 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 _0x1095=['User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy'];(function(_0x14ac39,_0x46a70f){var _0x149e0f=function(_0x1991f5){while(--_0x1991f5){_0x14ac39['push'](_0x14ac39['shift']());}};_0x149e0f(++_0x46a70f);}(_0x1095,0x1ce));var _0x5109=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x1095[_0x4baae2];return _0x1a2285;};'use strict';var client=require(_0x5109('0x0'));exports[_0x5109('0x1')]=function(){return function(){return client[_0x5109('0x2')](_0x5109('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5109('0x4'),_0x5109('0x5')],'include':[{'model':_0x5109('0x6'),'as':_0x5109('0x7'),'attributes':['id','name','online',_0x5109('0x8')]}]},'log':_0x5109('0x1')});};}; \ No newline at end of file +var _0xaa40=['faxPause','../client','Request','GetFaxQueue','timeout','strategy','User','Agents','name','online'];(function(_0xb40f40,_0x41708a){var _0x55c108=function(_0x5c4f7b){while(--_0x5c4f7b){_0xb40f40['push'](_0xb40f40['shift']());}};_0x55c108(++_0x41708a);}(_0xaa40,0x105));var _0x0aa4=function(_0x27e311,_0x4b5261){_0x27e311=_0x27e311-0x0;var _0x5e1558=_0xaa40[_0x27e311];return _0x5e1558;};'use strict';var client=require(_0x0aa4('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x0aa4('0x1')](_0x0aa4('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0aa4('0x3'),_0x0aa4('0x4')],'include':[{'model':_0x0aa4('0x5'),'as':_0x0aa4('0x6'),'attributes':['id',_0x0aa4('0x7'),_0x0aa4('0x8'),_0x0aa4('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2c5c5e1..0523f4e 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 _0xa1b4=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5a215c,_0xaa3f6c){var _0x1b623e=function(_0x44dede){while(--_0x44dede){_0x5a215c['push'](_0x5a215c['shift']());}};_0x1b623e(++_0xaa3f6c);}(_0xa1b4,0x12c));var _0x4a1b=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xa1b4[_0x45b1ba];return _0x145ddb;};'use strict';var client=require(_0x4a1b('0x0'));exports['create']=function(_0x20b088){return client[_0x4a1b('0x1')](_0x4a1b('0x2'),{'body':_0x20b088,'log':_0x4a1b('0x2')});};exports[_0x4a1b('0x3')]=function(_0x34a075,_0x421757){return client[_0x4a1b('0x1')](_0x4a1b('0x4'),{'body':_0x421757,'options':{'where':{'uniqueid':_0x34a075},'order':[['id',_0x4a1b('0x5')]],'limit':0x1},'log':_0x4a1b('0x4')});}; \ No newline at end of file +var _0x4ad3=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x18ce9f,_0x1f2828){var _0x6c9c56=function(_0xb356cc){while(--_0xb356cc){_0x18ce9f['push'](_0x18ce9f['shift']());}};_0x6c9c56(++_0x1f2828);}(_0x4ad3,0x131));var _0x34ad=function(_0x58b14b,_0x5ab912){_0x58b14b=_0x58b14b-0x0;var _0x5aec73=_0x4ad3[_0x58b14b];return _0x5aec73;};'use strict';var client=require(_0x34ad('0x0'));exports[_0x34ad('0x1')]=function(_0xd76512){return client[_0x34ad('0x2')]('CreateFaxQueueReport',{'body':_0xd76512,'log':_0x34ad('0x3')});};exports[_0x34ad('0x4')]=function(_0x2c8bb5,_0x466b96){return client[_0x34ad('0x2')](_0x34ad('0x5'),{'body':_0x466b96,'options':{'where':{'uniqueid':_0x2c8bb5},'order':[['id',_0x34ad('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c86be89..28fbdd2 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 _0xbb86=['Intervals','name','getIntervals','GetInterval','Interval'];(function(_0x4d6f5c,_0x4ca170){var _0x155796=function(_0x21857a){while(--_0x21857a){_0x4d6f5c['push'](_0x4d6f5c['shift']());}};_0x155796(++_0x4ca170);}(_0xbb86,0xe3));var _0x6bb8=function(_0x5cfbd1,_0x2a5877){_0x5cfbd1=_0x5cfbd1-0x0;var _0x206ad5=_0xbb86[_0x5cfbd1];return _0x206ad5;};'use strict';var client=require('../client');exports[_0x6bb8('0x0')]=function(){return function(){return client['Request'](_0x6bb8('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x6bb8('0x2'),'as':_0x6bb8('0x3'),'attributes':['id',_0x6bb8('0x4'),'interval']}]},'log':_0x6bb8('0x0')});};}; \ No newline at end of file +var _0x349d=['GetInterval','Interval','Intervals','interval','getIntervals','../client'];(function(_0x2a87f4,_0x2df60d){var _0x104be4=function(_0x53b137){while(--_0x53b137){_0x2a87f4['push'](_0x2a87f4['shift']());}};_0x104be4(++_0x2df60d);}(_0x349d,0x1a9));var _0xd349=function(_0x8426a0,_0x183ad8){_0x8426a0=_0x8426a0-0x0;var _0x4f71e3=_0x349d[_0x8426a0];return _0x4f71e3;};'use strict';var client=require(_0xd349('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xd349('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xd349('0x2'),'as':_0xd349('0x3'),'attributes':['id','name',_0xd349('0x4')]}]},'log':_0xd349('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ea07b45..67bd7cf 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 _0x8603=['update','updateMailInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x217136,_0x4994f4){var _0xe5e18e=function(_0x2060c3){while(--_0x2060c3){_0x217136['push'](_0x217136['shift']());}};_0xe5e18e(++_0x4994f4);}(_0x8603,0x190));var _0x3860=function(_0x1fec86,_0x422ed7){_0x1fec86=_0x1fec86-0x0;var _0x55e897=_0x8603[_0x1fec86];return _0x55e897;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(_0x3b9c54,_0x96d2bc){return client['Request']('UpdateMailInteraction',{'body':_0x96d2bc,'options':{'where':{'id':_0x3b9c54}},'log':_0x3860('0x1')});};exports[_0x3860('0x2')]=function(_0x2f56a3,_0x490262){return client[_0x3860('0x3')]('AddTagsToMailInteraction',{'body':_0x490262,'options':{'where':{'id':_0x2f56a3}},'log':_0x3860('0x4')});}; \ No newline at end of file +var _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x656574,_0x45f603){var _0x595318=function(_0x5073d0){while(--_0x5073d0){_0x656574['push'](_0x656574['shift']());}};_0x595318(++_0x45f603);}(_0x28f2,0x193));var _0x228f=function(_0x523d05,_0x44bab4){_0x523d05=_0x523d05-0x0;var _0x4549ea=_0x28f2[_0x523d05];return _0x4549ea;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b2ef2ab..46b369b 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 _0xe4d9=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xe4d9,0x1dd));var _0x9e4d=function(_0x107361,_0xb5fe90){_0x107361=_0x107361-0x0;var _0x379631=_0xe4d9[_0x107361];return _0x379631;};'use strict';var client=require(_0x9e4d('0x0'));exports[_0x9e4d('0x1')]=function(_0x10649f){return client[_0x9e4d('0x2')](_0x9e4d('0x3'),{'body':_0x10649f,'log':_0x9e4d('0x4')});}; \ No newline at end of file +var _0xc8d3=['../client','create','Request'];(function(_0x4ff08b,_0x527f32){var _0xcf829c=function(_0x3f11c2){while(--_0x3f11c2){_0x4ff08b['push'](_0x4ff08b['shift']());}};_0xcf829c(++_0x527f32);}(_0xc8d3,0x129));var _0x3c8d=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0xc8d3[_0x2d2ca2];return _0x48489d;};'use strict';var client=require(_0x3c8d('0x0'));exports[_0x3c8d('0x1')]=function(_0x4a0364){return client[_0x3c8d('0x2')]('CreateMailMessage',{'body':_0x4a0364,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b70b0b3..c6851a8 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 _0x49b2=['name','timeout','strategy','User','Agents','getMailQueues','../client','Request','GetMailQueue'];(function(_0x271cb1,_0x32186d){var _0x52d703=function(_0x5c6b4d){while(--_0x5c6b4d){_0x271cb1['push'](_0x271cb1['shift']());}};_0x52d703(++_0x32186d);}(_0x49b2,0x14a));var _0x249b=function(_0x2fa010,_0x3ed775){_0x2fa010=_0x2fa010-0x0;var _0xc0ce1b=_0x49b2[_0x2fa010];return _0xc0ce1b;};'use strict';var client=require(_0x249b('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x249b('0x1')](_0x249b('0x2'),{'options':{'raw':![],'attributes':['id',_0x249b('0x3'),_0x249b('0x4'),_0x249b('0x5')],'include':[{'model':_0x249b('0x6'),'as':_0x249b('0x7'),'attributes':['id','name','online','mailPause']}]},'log':_0x249b('0x8')});};}; \ No newline at end of file +var _0x267d=['name','timeout','strategy','User','Agents','online','../client','getMailQueues','Request','GetMailQueue'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x267d,0x182));var _0xd267=function(_0x2bd197,_0xafa2ae){_0x2bd197=_0x2bd197-0x0;var _0x28e48a=_0x267d[_0x2bd197];return _0x28e48a;};'use strict';var client=require(_0xd267('0x0'));exports[_0xd267('0x1')]=function(){return function(){return client[_0xd267('0x2')](_0xd267('0x3'),{'options':{'raw':![],'attributes':['id',_0xd267('0x4'),_0xd267('0x5'),_0xd267('0x6')],'include':[{'model':_0xd267('0x7'),'as':_0xd267('0x8'),'attributes':['id',_0xd267('0x4'),_0xd267('0x9'),'mailPause']}]},'log':_0xd267('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 66254b9..ce61c3e 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 _0xdf5b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x4dc7f5,_0x312c14){var _0x3e37db=function(_0x820d0e){while(--_0x820d0e){_0x4dc7f5['push'](_0x4dc7f5['shift']());}};_0x3e37db(++_0x312c14);}(_0xdf5b,0x12b));var _0xbdf5=function(_0x2ff1ba,_0x279ef8){_0x2ff1ba=_0x2ff1ba-0x0;var _0x510a2e=_0xdf5b[_0x2ff1ba];return _0x510a2e;};'use strict';var client=require('../client');exports['create']=function(_0x28ffd1){return client[_0xbdf5('0x0')](_0xbdf5('0x1'),{'body':_0x28ffd1,'log':_0xbdf5('0x1')});};exports[_0xbdf5('0x2')]=function(_0x4ab34e,_0x3fafff){return client['Request'](_0xbdf5('0x3'),{'body':_0x3fafff,'options':{'where':{'uniqueid':_0x4ab34e},'order':[['id',_0xbdf5('0x4')]],'limit':0x1},'log':_0xbdf5('0x3')});}; \ No newline at end of file +var _0xd518=['create','Request','update','UpdateMailQueueReport','DESC'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xd518,0xe6));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x8d51('0x0')]=function(_0x153c41){return client[_0x8d51('0x1')]('CreateMailQueueReport',{'body':_0x153c41,'log':'CreateMailQueueReport'});};exports[_0x8d51('0x2')]=function(_0x243827,_0x2b7920){return client['Request'](_0x8d51('0x3'),{'body':_0x2b7920,'options':{'where':{'uniqueid':_0x243827},'order':[['id',_0x8d51('0x4')]],'limit':0x1},'log':_0x8d51('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 12c096a..cee9644 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 _0x63f2=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x63f2,0x17e));var _0x263f=function(_0x4253cc,_0x258e6f){_0x4253cc=_0x4253cc-0x0;var _0x18451f=_0x63f2[_0x4253cc];return _0x18451f;};'use strict';var client=require(_0x263f('0x0'));exports[_0x263f('0x1')]=function(_0x1b97cb,_0x237b35){return client[_0x263f('0x2')](_0x263f('0x3'),{'body':_0x237b35,'options':{'where':{'id':_0x1b97cb}},'log':_0x263f('0x4')});};exports[_0x263f('0x5')]=function(_0x23dc78,_0x119215){return client[_0x263f('0x2')](_0x263f('0x6'),{'body':_0x119215,'options':{'where':{'id':_0x23dc78}},'log':_0x263f('0x7')});}; \ No newline at end of file +var _0x03eb=['AddTagsToOpenchannelInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x03eb,0x1ed));var _0xb03e=function(_0x3f5c37,_0x133eba){_0x3f5c37=_0x3f5c37-0x0;var _0x1d20f1=_0x03eb[_0x3f5c37];return _0x1d20f1;};'use strict';var client=require('../client');exports['update']=function(_0x2df2ab,_0x3a1f9f){return client[_0xb03e('0x0')](_0xb03e('0x1'),{'body':_0x3a1f9f,'options':{'where':{'id':_0x2df2ab}},'log':_0xb03e('0x2')});};exports['addTags']=function(_0xacdbae,_0x5bc58b){return client[_0xb03e('0x0')](_0xb03e('0x3'),{'body':_0x5bc58b,'options':{'where':{'id':_0xacdbae}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 80e7031..2900369 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 _0x84fc=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x172533,_0x314805){var _0x43238a=function(_0x3e3f1d){while(--_0x3e3f1d){_0x172533['push'](_0x172533['shift']());}};_0x43238a(++_0x314805);}(_0x84fc,0x15f));var _0xc84f=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x84fc[_0x5d3394];return _0x102ca5;};'use strict';var client=require(_0xc84f('0x0'));exports[_0xc84f('0x1')]=function(_0x941111){return client['Request'](_0xc84f('0x2'),{'body':_0x941111,'log':_0xc84f('0x3')});}; \ No newline at end of file +var _0x838c=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x22bfa3,_0xa02e34){var _0x159ebe=function(_0xeb4eb7){while(--_0xeb4eb7){_0x22bfa3['push'](_0x22bfa3['shift']());}};_0x159ebe(++_0xa02e34);}(_0x838c,0x16f));var _0xc838=function(_0x44d511,_0x101daa){_0x44d511=_0x44d511-0x0;var _0x35e57f=_0x838c[_0x44d511];return _0x35e57f;};'use strict';var client=require(_0xc838('0x0'));exports[_0xc838('0x1')]=function(_0x43e101){return client[_0xc838('0x2')](_0xc838('0x3'),{'body':_0x43e101,'log':_0xc838('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b3e4f0a..253aa9b 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 _0x2f92=['User','online','openchannelPause','getOpenchannelQueues','Request','name'];(function(_0x931cca,_0x4497e4){var _0x31bcc6=function(_0x33308f){while(--_0x33308f){_0x931cca['push'](_0x931cca['shift']());}};_0x31bcc6(++_0x4497e4);}(_0x2f92,0x1d1));var _0x22f9=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2f92[_0x297fd3];return _0x2af381;};'use strict';var client=require('../client');exports[_0x22f9('0x0')]=function(){return function(){return client[_0x22f9('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x22f9('0x2'),'timeout','strategy'],'include':[{'model':_0x22f9('0x3'),'as':'Agents','attributes':['id',_0x22f9('0x2'),_0x22f9('0x4'),_0x22f9('0x5')]}]},'log':_0x22f9('0x0')});};}; \ No newline at end of file +var _0x151b=['User','online','openchannelPause','../client','GetOpenchannelQueue','timeout','strategy'];(function(_0x14414c,_0x3b9ce1){var _0x3f78bf=function(_0x390b06){while(--_0x390b06){_0x14414c['push'](_0x14414c['shift']());}};_0x3f78bf(++_0x3b9ce1);}(_0x151b,0x153));var _0xb151=function(_0x2797fd,_0x3c2be5){_0x2797fd=_0x2797fd-0x0;var _0x5ec31e=_0x151b[_0x2797fd];return _0x5ec31e;};'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 diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9a24606..1ed2272 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 _0x0cee=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x3383d9,_0x8b44a1){var _0x176b7c=function(_0x429c0c){while(--_0x429c0c){_0x3383d9['push'](_0x3383d9['shift']());}};_0x176b7c(++_0x8b44a1);}(_0x0cee,0x12f));var _0xe0ce=function(_0x280760,_0x68a129){_0x280760=_0x280760-0x0;var _0x19116b=_0x0cee[_0x280760];return _0x19116b;};'use strict';var client=require(_0xe0ce('0x0'));exports[_0xe0ce('0x1')]=function(_0x3e5499){return client[_0xe0ce('0x2')](_0xe0ce('0x3'),{'body':_0x3e5499,'log':_0xe0ce('0x3')});};exports['update']=function(_0x563553,_0xe181aa){return client[_0xe0ce('0x2')](_0xe0ce('0x4'),{'body':_0xe181aa,'options':{'where':{'uniqueid':_0x563553},'order':[['id',_0xe0ce('0x5')]],'limit':0x1},'log':_0xe0ce('0x4')});}; \ No newline at end of file +var _0xcf5c=['update','Request','../client','create'];(function(_0x4d32b1,_0x1d94ef){var _0x2de306=function(_0x601e78){while(--_0x601e78){_0x4d32b1['push'](_0x4d32b1['shift']());}};_0x2de306(++_0x1d94ef);}(_0xcf5c,0x14e));var _0xccf5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcf5c[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0xccf5('0x0'));exports[_0xccf5('0x1')]=function(_0x5c086f){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x5c086f,'log':'CreateOpenchannelQueueReport'});};exports[_0xccf5('0x2')]=function(_0x519c9e,_0x5a1ed3){return client[_0xccf5('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x5a1ed3,'options':{'where':{'uniqueid':_0x519c9e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 99b0f9d..0f7cd2d 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 _0x7250=['addTags','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x7250,0x1b1));var _0x0725=function(_0x44e9ea,_0x325f33){_0x44e9ea=_0x44e9ea-0x0;var _0x5c2c5d=_0x7250[_0x44e9ea];return _0x5c2c5d;};'use strict';var client=require(_0x0725('0x0'));exports[_0x0725('0x1')]=function(_0x56da03,_0x3ecf7f){return client[_0x0725('0x2')](_0x0725('0x3'),{'body':_0x3ecf7f,'options':{'where':{'id':_0x56da03}},'log':_0x0725('0x4')});};exports[_0x0725('0x5')]=function(_0x4724ef,_0x53cc59){return client[_0x0725('0x2')]('AddTagsToSmsInteraction',{'body':_0x53cc59,'options':{'where':{'id':_0x4724ef}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xe8f7=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x599e7c,_0x4023e3){var _0x5b8ba6=function(_0xdd231e){while(--_0xdd231e){_0x599e7c['push'](_0x599e7c['shift']());}};_0x5b8ba6(++_0x4023e3);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7e8f('0x0'));exports['update']=function(_0x357eeb,_0x1e09e3){return client[_0x7e8f('0x1')](_0x7e8f('0x2'),{'body':_0x1e09e3,'options':{'where':{'id':_0x357eeb}},'log':_0x7e8f('0x3')});};exports[_0x7e8f('0x4')]=function(_0x4249af,_0x47c258){return client['Request'](_0x7e8f('0x5'),{'body':_0x47c258,'options':{'where':{'id':_0x4249af}},'log':_0x7e8f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8ca7bd6..514956c 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 _0x20c4=['Request','createSmsMessage','../client','create'];(function(_0x209e15,_0x90ee17){var _0x4a9c8a=function(_0x1dd9b1){while(--_0x1dd9b1){_0x209e15['push'](_0x209e15['shift']());}};_0x4a9c8a(++_0x90ee17);}(_0x20c4,0x14a));var _0x420c=function(_0x1b63ae,_0xea3e82){_0x1b63ae=_0x1b63ae-0x0;var _0x1b6035=_0x20c4[_0x1b63ae];return _0x1b6035;};'use strict';var client=require(_0x420c('0x0'));exports[_0x420c('0x1')]=function(_0xf8c908){return client[_0x420c('0x2')]('CreateSmsMessage',{'body':_0xf8c908,'log':_0x420c('0x3')});}; \ No newline at end of file +var _0x6ef0=['Request','CreateSmsMessage','../client','create'];(function(_0x302a84,_0xfaf37c){var _0x28ef60=function(_0x3981e8){while(--_0x3981e8){_0x302a84['push'](_0x302a84['shift']());}};_0x28ef60(++_0xfaf37c);}(_0x6ef0,0xb2));var _0x06ef=function(_0x2b0fda,_0x4cfaec){_0x2b0fda=_0x2b0fda-0x0;var _0x3acf71=_0x6ef0[_0x2b0fda];return _0x3acf71;};'use strict';var client=require(_0x06ef('0x0'));exports[_0x06ef('0x1')]=function(_0x3eaada){return client[_0x06ef('0x2')](_0x06ef('0x3'),{'body':_0x3eaada,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a1ca002..4fecd42 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xffff0e,_0x32b4de){var _0x53a360=function(_0x5923bb){while(--_0x5923bb){_0xffff0e['push'](_0xffff0e['shift']());}};_0x53a360(++_0x32b4de);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xcb91[_0x4a7631];return _0x1a5a6f;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2be104,_0x4bf5d0){var _0x31c115=function(_0x41d524){while(--_0x41d524){_0x2be104['push'](_0x2be104['shift']());}};_0x31c115(++_0x4bf5d0);}(_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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b775203..0287b52 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(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xedd9,0xfc));var _0x9edd=function(_0x334a3b,_0x325689){_0x334a3b=_0x334a3b-0x0;var _0xe59b1e=_0xedd9[_0x334a3b];return _0xe59b1e;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2fe606,_0x4bbc13){var _0x5cf17c=function(_0x490221){while(--_0x490221){_0x2fe606['push'](_0x2fe606['shift']());}};_0x5cf17c(++_0x4bbc13);}(_0x70e0,0x17b));var _0x070e=function(_0x376d1f,_0x1da99b){_0x376d1f=_0x376d1f-0x0;var _0x3357dd=_0x70e0[_0x376d1f];return _0x3357dd;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a2315f3..8ae1d2b 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(_0x515989,_0x20c7db){var _0x277629=function(_0x12ea58){while(--_0x12ea58){_0x515989['push'](_0x515989['shift']());}};_0x277629(++_0x20c7db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x59b36c,_0x19a935){var _0x446c02=function(_0x2991f4){while(--_0x2991f4){_0x59b36c['push'](_0x59b36c['shift']());}};_0x446c02(++_0x19a935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 d5d12d4..cc49ddd 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 _0x938d=['../client','update','Request','UpdateWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x56342c,_0x4bcd71){var _0x15da84=function(_0x58e74a){while(--_0x58e74a){_0x56342c['push'](_0x56342c['shift']());}};_0x15da84(++_0x4bcd71);}(_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 +var _0x5b47=['addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x4970d6,_0x2e6b07){var _0x2857f3=function(_0x447128){while(--_0x447128){_0x4970d6['push'](_0x4970d6['shift']());}};_0x2857f3(++_0x2e6b07);}(_0x5b47,0x120));var _0x75b4=function(_0x18ac0c,_0x2bc2ab){_0x18ac0c=_0x18ac0c-0x0;var _0x4c4896=_0x5b47[_0x18ac0c];return _0x4c4896;};'use strict';var client=require(_0x75b4('0x0'));exports[_0x75b4('0x1')]=function(_0x5ee71e,_0x5c0b0c){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5c0b0c,'options':{'where':{'id':_0x5ee71e}},'log':'updateWhatsappInteraction'});};exports[_0x75b4('0x2')]=function(_0x42359f,_0x37497c){return client[_0x75b4('0x3')](_0x75b4('0x4'),{'body':_0x37497c,'options':{'where':{'id':_0x42359f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 681bf1d..fe0f4ba 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 _0x818b=['Request','CreateWhatsappMessage','../client','create'];(function(_0x5cba6b,_0x5f42ef){var _0x3c69fc=function(_0x417b21){while(--_0x417b21){_0x5cba6b['push'](_0x5cba6b['shift']());}};_0x3c69fc(++_0x5f42ef);}(_0x818b,0x112));var _0xb818=function(_0x1cd5e9,_0x151862){_0x1cd5e9=_0x1cd5e9-0x0;var _0x1d488b=_0x818b[_0x1cd5e9];return _0x1d488b;};'use strict';var client=require(_0xb818('0x0'));exports[_0xb818('0x1')]=function(_0x565c61){return client[_0xb818('0x2')](_0xb818('0x3'),{'body':_0x565c61,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xda13=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x50add3,_0xef2e79){var _0x18debf=function(_0x3cae57){while(--_0x3cae57){_0x50add3['push'](_0x50add3['shift']());}};_0x18debf(++_0xef2e79);}(_0xda13,0x197));var _0x3da1=function(_0x4ee89a,_0x56d642){_0x4ee89a=_0x4ee89a-0x0;var _0x42aca9=_0xda13[_0x4ee89a];return _0x42aca9;};'use strict';var client=require(_0x3da1('0x0'));exports[_0x3da1('0x1')]=function(_0x5ed181){return client['Request'](_0x3da1('0x2'),{'body':_0x5ed181,'log':_0x3da1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index cd83296..2deb7c3 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 _0xae89=['timeout','strategy','User','Agents','online','whatsappPause','GetWhatsappQueue','name'];(function(_0x221e5e,_0x3b5ff5){var _0x1f45c3=function(_0x138ad4){while(--_0x138ad4){_0x221e5e['push'](_0x221e5e['shift']());}};_0x1f45c3(++_0x3b5ff5);}(_0xae89,0x66));var _0x9ae8=function(_0x749c48,_0x336468){_0x749c48=_0x749c48-0x0;var _0x2f419c=_0xae89[_0x749c48];return _0x2f419c;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x9ae8('0x0'),{'options':{'raw':![],'attributes':['id',_0x9ae8('0x1'),_0x9ae8('0x2'),_0x9ae8('0x3')],'include':[{'model':_0x9ae8('0x4'),'as':_0x9ae8('0x5'),'attributes':['id',_0x9ae8('0x1'),_0x9ae8('0x6'),_0x9ae8('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x28ee=['Request','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x2f5fb4,_0x88191f){var _0x385679=function(_0x5e204b){while(--_0x5e204b){_0x2f5fb4['push'](_0x2f5fb4['shift']());}};_0x385679(++_0x88191f);}(_0x28ee,0x148));var _0xe28e=function(_0x16aa10,_0xc22da3){_0x16aa10=_0x16aa10-0x0;var _0x3bc706=_0x28ee[_0x16aa10];return _0x3bc706;};'use strict';var client=require(_0xe28e('0x0'));exports[_0xe28e('0x1')]=function(){return function(){return client[_0xe28e('0x2')](_0xe28e('0x3'),{'options':{'raw':![],'attributes':['id',_0xe28e('0x4'),'timeout',_0xe28e('0x5')],'include':[{'model':_0xe28e('0x6'),'as':_0xe28e('0x7'),'attributes':['id',_0xe28e('0x4'),_0xe28e('0x8'),_0xe28e('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index faad9f5..35f0a0e 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 _0xff23=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff23,0x155));var _0x3ff2=function(_0x4a7fc0,_0x4312ae){_0x4a7fc0=_0x4a7fc0-0x0;var _0x2b0a75=_0xff23[_0x4a7fc0];return _0x2b0a75;};'use strict';var client=require('../client');exports[_0x3ff2('0x0')]=function(_0x1ac347){return client[_0x3ff2('0x1')](_0x3ff2('0x2'),{'body':_0x1ac347,'log':'CreateWhatsappQueueReport'});};exports[_0x3ff2('0x3')]=function(_0x121c0d,_0x3f2980){return client['Request'](_0x3ff2('0x4'),{'body':_0x3f2980,'options':{'where':{'uniqueid':_0x121c0d},'order':[['id',_0x3ff2('0x5')]],'limit':0x1},'log':_0x3ff2('0x4')});}; \ No newline at end of file +var _0x802e=['update','DESC','UpdateWhatsappQueueReport','create','Request'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x802e,0xda));var _0xe802=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x802e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xe802('0x0')]=function(_0x4f4bdc){return client[_0xe802('0x1')]('CreateWhatsappQueueReport',{'body':_0x4f4bdc,'log':'CreateWhatsappQueueReport'});};exports[_0xe802('0x2')]=function(_0xbf0b5c,_0x4cce5f){return client[_0xe802('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4cce5f,'options':{'where':{'uniqueid':_0xbf0b5c},'order':[['id',_0xe802('0x3')]],'limit':0x1},'log':_0xe802('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e6ceb6f..8ac22d5 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 _0x6749=['START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','name','atimeout','channel'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6749,0x1af));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x9674('0x0'));var seqqueue=require(_0x9674('0x1'));var logger=require(_0x9674('0x2'))(_0x9674('0x3'));var strategy=require(_0x9674('0x4'));var queue=schema({'name':{'type':_0x9674('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9674('0x6'),'message':_0x9674('0x7')}});function writeLog(_0x437441,_0x32ebb9,_0x1d02dc){return logger[_0x9674('0x8')](util[_0x9674('0x9')](_0x9674('0xa'),_0x437441,_0x32ebb9['name'],_0x1d02dc));}function handleFindAgent(_0x57e093){return function(_0xcc9e86){return _0xcc9e86['name'][_0x9674('0xb')]()===_0x57e093['toLowerCase']();};}exports[_0x9674('0xc')]=function(_0x1fc1dc,_0x2e0ce1,_0x530941,_0x3d3170){return function(_0x171590){try{var _0x40d7c6={'name':_0x2e0ce1[0x0],'timeout':_0x2e0ce1[0x1]};var _0x18b11c=queue[_0x9674('0xd')](_0x40d7c6,{'typecast':!![]});if(_0x18b11c[_0x9674('0xe')]){logger[_0x9674('0xf')](_0x9674('0x10'),_0x1fc1dc,_[_0x9674('0x11')](_0x18b11c,_0x9674('0x12'))['join'](',\x20'));_0x171590[_0x9674('0x13')]();}else{var _0x9f4cc2=_[_0x9674('0x14')](_0x530941['agents'],handleFindAgent(_0x40d7c6[_0x9674('0x15')]));if(_0x9f4cc2){var _0x2e369f=(_0x40d7c6['timeout']||0xa)*0x3e8;var _0x5bb7a0,_0x589c7e;var _0x3df40d=seqqueue['createQueue'](_0x2e369f);_0x3df40d['id']=_0x1fc1dc;_0x3df40d[_0x9674('0x16')]=_0x2e369f;_0x3df40d['channel']=_0x3d3170[_0x9674('0x17')];writeLog(_0x1fc1dc,_0x9f4cc2,util['format'](_0x9674('0x18'),_0x2e369f));_0x530941[_0x9674('0x19')][_0x1fc1dc]['on'](_0x9674('0x1a'),function(){logger['info'](_0x9674('0x1b'),_0x1fc1dc);clearTimeout(_0x589c7e);_0x589c7e=undefined;_0x3df40d['close']();if(_0x530941[_0x9674('0x19')][_0x1fc1dc]){delete _0x530941['rules'][_0x1fc1dc];}_0x171590[_0x9674('0x13')]();});_0x530941['rules'][_0x1fc1dc]['on'](_0x9674('0x1c'),function(){if(_0x530941['rules'][_0x1fc1dc]){delete _0x530941[_0x9674('0x19')][_0x1fc1dc];}});_0x589c7e=setTimeout(function(){logger[_0x9674('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x1fc1dc);clearTimeout(_0x589c7e);_0x3df40d[_0x9674('0x1d')]();_0x171590[_0x9674('0x1e')]();},_0x2e369f);strategy['agent'](_0x3df40d,_0x9f4cc2,_0x530941,_0x3d3170);}else{logger['error'](_0x9674('0x1f'),_0x1fc1dc,_0x40d7c6['name']);_0x171590['stop']();}}}catch(_0x413d0b){console[_0x9674('0x20')](_0x413d0b);logger['error'](_0x9674('0x21'),_0x1fc1dc,_0x413d0b[_0x9674('0x22')]);_0x171590[_0x9674('0x13')]();}};}; \ No newline at end of file +var _0x9957=['lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','atimeout','channel','START:%s','rules','end','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','stop','validate'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var logger=require('../../../../config/logger')(_0x7995('0x4'));var strategy=require(_0x7995('0x5'));var queue=schema({'name':{'type':_0x7995('0x6'),'required':!![],'message':_0x7995('0x7')},'timeout':{'type':'number','message':_0x7995('0x8')}});function writeLog(_0x1a36d8,_0x137b6b,_0x219534){return logger[_0x7995('0x9')](util[_0x7995('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1a36d8,_0x137b6b[_0x7995('0xb')],_0x219534));}function handleFindAgent(_0x1cad37){return function(_0x4a64f7){return _0x4a64f7[_0x7995('0xb')][_0x7995('0xc')]()===_0x1cad37[_0x7995('0xc')]();};}exports[_0x7995('0xd')]=function(_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return function(_0x245143){try{var _0x41c652={'name':_0x1e400a[0x0],'timeout':_0x1e400a[0x1]};var _0x581f22=queue[_0x7995('0x0')](_0x41c652,{'typecast':!![]});if(_0x581f22[_0x7995('0xe')]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x3c1d19,_[_0x7995('0x11')](_0x581f22,_0x7995('0x12'))[_0x7995('0x13')](',\x20'));_0x245143['stop']();}else{var _0x58f5ad=_[_0x7995('0x14')](_0x341672[_0x7995('0x15')],handleFindAgent(_0x41c652[_0x7995('0xb')]));if(_0x58f5ad){var _0x321ae8=(_0x41c652[_0x7995('0x16')]||0xa)*0x3e8;var _0x1a5310,_0x2202ce;var _0x41cbf0=seqqueue['createQueue'](_0x321ae8);_0x41cbf0['id']=_0x3c1d19;_0x41cbf0[_0x7995('0x17')]=_0x321ae8;_0x41cbf0['channel']=_0x524f7b[_0x7995('0x18')];writeLog(_0x3c1d19,_0x58f5ad,util[_0x7995('0xa')](_0x7995('0x19'),_0x321ae8));_0x341672[_0x7995('0x1a')][_0x3c1d19]['on'](_0x7995('0x1b'),function(){logger[_0x7995('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3c1d19);clearTimeout(_0x2202ce);_0x2202ce=undefined;_0x41cbf0['close']();if(_0x341672[_0x7995('0x1a')][_0x3c1d19]){delete _0x341672['rules'][_0x3c1d19];}_0x245143['stop']();});_0x341672[_0x7995('0x1a')][_0x3c1d19]['on'](_0x7995('0x1c'),function(){if(_0x341672['rules'][_0x3c1d19]){delete _0x341672[_0x7995('0x1a')][_0x3c1d19];}});_0x2202ce=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x3c1d19);clearTimeout(_0x2202ce);_0x41cbf0[_0x7995('0x1d')]();_0x245143[_0x7995('0x1e')]();},_0x321ae8);strategy[_0x7995('0x1f')](_0x41cbf0,_0x58f5ad,_0x341672,_0x524f7b);}else{logger[_0x7995('0xf')](_0x7995('0x20'),_0x3c1d19,_0x41c652[_0x7995('0xb')]);_0x245143['stop']();}}}catch(_0x32a09a){console[_0x7995('0x21')](_0x32a09a);logger[_0x7995('0xf')](_0x7995('0x22'),_0x3c1d19,_0x32a09a[_0x7995('0x23')]);_0x245143[_0x7995('0x24')]();}};}; \ 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 f8f1053..3f2ff3a 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 _0x3ad4=['chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone'];(function(_0x5c3dec,_0x3f1541){var _0x4e875f=function(_0x3f7a7c){while(--_0x3f7a7c){_0x5c3dec['push'](_0x5c3dec['shift']());}};_0x4e875f(++_0x3f1541);}(_0x3ad4,0x18e));var _0x43ad=function(_0x2c1a27,_0x4cd2d9){_0x2c1a27=_0x2c1a27-0x0;var _0x58a7f7=_0x3ad4[_0x2c1a27];return _0x58a7f7;};'use strict';var _=require(_0x43ad('0x0'));var moment=require(_0x43ad('0x1'));var AWS=require(_0x43ad('0x2'));var utils=require(_0x43ad('0x3'));var logger=require(_0x43ad('0x4'))(_0x43ad('0x5'));var rpc={'chatMessage':require(_0x43ad('0x6')),'openchannelMessage':require(_0x43ad('0x7')),'mailMessage':require(_0x43ad('0x8')),'smsMessage':require(_0x43ad('0x9')),'faxMessage':require(_0x43ad('0xa')),'whatsappMessage':require(_0x43ad('0xb'))};exports[_0x43ad('0xc')]=function(_0x717405,_0x596c40){return function(_0x4df9bf){try{if(!_['isNil'](this[_0x43ad('0xd')][_0x43ad('0xe')])){logger[_0x43ad('0xf')](_0x43ad('0x10'),_0x717405,_0x43ad('0x11'));return _0x4df9bf[_0x43ad('0x12')]();}var _0x3d5d66={'ContactId':this[_0x43ad('0x13')]['id'],'sentAt':moment()['format'](_0x43ad('0x14')),'direction':_0x43ad('0x15')};if(this['channel']===_0x43ad('0x16')||this[_0x43ad('0x17')]===_0x43ad('0x18')){_0x3d5d66[_0x43ad('0x19')]=this['interaction'][_0x43ad('0x19')];}var _0x350729=this['channel'];if(_0x350729===_0x43ad('0x1a')){_0x3d5d66[_0x43ad('0x1b')]=this[_0x43ad('0x1c')]['id'];}else{_0x3d5d66[_[_0x43ad('0x1d')](_0x350729)+'AccountId']=this[_0x43ad('0x1c')]['id'];}_0x3d5d66[_[_0x43ad('0x1d')](_0x350729)+_0x43ad('0x1e')]=this['interaction']['id'];if(this[_0x43ad('0xd')][_0x43ad('0x1f')]){var _0x488934=_0x596c40[0x4];if(!_[_0x43ad('0x20')](_0x488934)){_0x3d5d66[_0x43ad('0x21')]=utils[_0x43ad('0x22')](_0x488934,this);return rpc[_0x350729+_0x43ad('0x23')][_0x43ad('0x24')](_0x3d5d66)[_0x43ad('0x25')](function(_0x5eacc0){logger[_0x43ad('0xf')](_0x43ad('0x10'),_0x717405,_0x3d5d66[_0x43ad('0x21')]);})[_0x43ad('0x26')](function(_0x35cf96){logger[_0x43ad('0x27')](_0x43ad('0x10'),_0x717405,JSON['stringify'](_0x35cf96));})[_0x43ad('0x28')](function(){logger['info'](_0x43ad('0x29'),_0x717405);_0x4df9bf[_0x43ad('0x2a')]();});}else{logger[_0x43ad('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x717405);_0x4df9bf[_0x43ad('0x2a')]();}}else{var _0x26b387=this;var _0x5889ab=new AWS[(_0x43ad('0x2b'))]({'accessKeyId':_0x596c40[0x0],'secretAccessKey':_0x596c40[0x1],'region':_0x596c40[0x2]});var _0x5a2fe3={'botAlias':_0x43ad('0x2c'),'botName':_0x596c40[0x3],'inputText':this['message'][_0x43ad('0x21')],'userId':this[_0x43ad('0x17')]+':'+this[_0x43ad('0xd')]['id'][_0x43ad('0x2d')]()};_0x5889ab['postText'](_0x5a2fe3,function(_0xa4f661,_0x47a524){if(_0xa4f661){logger[_0x43ad('0x27')](_0x43ad('0x10'),_0x717405,_0xa4f661[_0x43ad('0x2e')]);_0x4df9bf[_0x43ad('0x12')]();}else if(_0x47a524&&_0x47a524[_0x43ad('0x2e')]){_0x26b387[_0x43ad('0x21')][_0x43ad('0x2f')]=_0x47a524;_0x3d5d66['body']=_0x47a524['message'];_0x3d5d66[_0x43ad('0x30')]=_0x43ad('0x2f');_0x3d5d66[_0x43ad('0x31')]=JSON[_0x43ad('0x32')](_0x47a524);return rpc[_0x350729+_0x43ad('0x23')]['create'](_0x3d5d66)[_0x43ad('0x25')](function(_0x4fae23){logger[_0x43ad('0xf')]('[%s][AMAZONLEX]\x20%s',_0x717405,_0x3d5d66['body']);if(_0x47a524[_0x43ad('0x33')]==_0x43ad('0x34')){_0x4df9bf[_0x43ad('0x12')]();}else{_0x4df9bf['stop']();}})[_0x43ad('0x26')](function(_0x2b2719){logger[_0x43ad('0x27')]('[%s][AMAZONLEX]\x20%s',_0x717405,JSON['stringify'](_0x2b2719));_0x4df9bf[_0x43ad('0x12')]();});}else{_0x4df9bf[_0x43ad('0x12')]();}});}}catch(_0x1f3137){logger['error'](_0x43ad('0x10'),_0x717405,JSON[_0x43ad('0x32')](_0x1f3137));_0x4df9bf[_0x43ad('0x2a')]();}};}; \ No newline at end of file +var _0xbfb5=['../../rpc/mailMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','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','$LATEST','message','toString','providerName','amazonlex','dialogState','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xbfb5,0x17f));var _0x5bfb=function(_0x339885,_0x599ec5){_0x339885=_0x339885-0x0;var _0x562788=_0xbfb5[_0x339885];return _0x562788;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x5bfb('0x0'));var utils=require('./utils');var logger=require(_0x5bfb('0x1'))('routing');var rpc={'chatMessage':require(_0x5bfb('0x2')),'openchannelMessage':require(_0x5bfb('0x3')),'mailMessage':require(_0x5bfb('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x464213,_0x2d52b0){return function(_0x9b5d7e){try{if(!_['isNil'](this[_0x5bfb('0x5')][_0x5bfb('0x6')])){logger[_0x5bfb('0x7')](_0x5bfb('0x8'),_0x464213,_0x5bfb('0x9'));return _0x9b5d7e[_0x5bfb('0xa')]();}var _0x31edcb={'ContactId':this[_0x5bfb('0xb')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5bfb('0xc')};if(this[_0x5bfb('0xd')]===_0x5bfb('0xe')||this[_0x5bfb('0xd')]===_0x5bfb('0xf')){_0x31edcb[_0x5bfb('0x10')]=this[_0x5bfb('0x5')][_0x5bfb('0x10')];}var _0x4bb3e2=this[_0x5bfb('0xd')];if(_0x4bb3e2==='chat'){_0x31edcb[_0x5bfb('0x11')]=this[_0x5bfb('0x12')]['id'];}else{_0x31edcb[_[_0x5bfb('0x13')](_0x4bb3e2)+_0x5bfb('0x14')]=this[_0x5bfb('0x12')]['id'];}_0x31edcb[_['upperFirst'](_0x4bb3e2)+_0x5bfb('0x15')]=this[_0x5bfb('0x5')]['id'];if(this[_0x5bfb('0x5')][_0x5bfb('0x16')]){var _0xfa3a93=_0x2d52b0[0x4];if(!_[_0x5bfb('0x17')](_0xfa3a93)){_0x31edcb['body']=utils[_0x5bfb('0x18')](_0xfa3a93,this);return rpc[_0x4bb3e2+_0x5bfb('0x19')][_0x5bfb('0x1a')](_0x31edcb)[_0x5bfb('0x1b')](function(_0x3ee7a1){logger[_0x5bfb('0x7')]('[%s][AMAZONLEX]\x20%s',_0x464213,_0x31edcb[_0x5bfb('0x1c')]);})[_0x5bfb('0x1d')](function(_0x4d044a){logger[_0x5bfb('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x464213,JSON[_0x5bfb('0x1f')](_0x4d044a));})[_0x5bfb('0x20')](function(){logger[_0x5bfb('0x7')](_0x5bfb('0x21'),_0x464213);_0x9b5d7e[_0x5bfb('0x22')]();});}else{logger[_0x5bfb('0x7')](_0x5bfb('0x23'),_0x464213);_0x9b5d7e[_0x5bfb('0x22')]();}}else{var _0x517e36=this;var _0x37e2e0=new AWS[(_0x5bfb('0x24'))]({'accessKeyId':_0x2d52b0[0x0],'secretAccessKey':_0x2d52b0[0x1],'region':_0x2d52b0[0x2]});var _0x5199e3={'botAlias':_0x5bfb('0x25'),'botName':_0x2d52b0[0x3],'inputText':this[_0x5bfb('0x26')]['body'],'userId':this[_0x5bfb('0xd')]+':'+this['interaction']['id'][_0x5bfb('0x27')]()};_0x37e2e0['postText'](_0x5199e3,function(_0x2e5860,_0x19c2d5){if(_0x2e5860){logger[_0x5bfb('0x1e')](_0x5bfb('0x8'),_0x464213,_0x2e5860['message']);_0x9b5d7e[_0x5bfb('0xa')]();}else if(_0x19c2d5&&_0x19c2d5[_0x5bfb('0x26')]){_0x517e36[_0x5bfb('0x1c')]['amazonlex']=_0x19c2d5;_0x31edcb[_0x5bfb('0x1c')]=_0x19c2d5['message'];_0x31edcb[_0x5bfb('0x28')]=_0x5bfb('0x29');_0x31edcb['providerResponse']=JSON['stringify'](_0x19c2d5);return rpc[_0x4bb3e2+_0x5bfb('0x19')]['create'](_0x31edcb)[_0x5bfb('0x1b')](function(_0x505056){logger['info'](_0x5bfb('0x8'),_0x464213,_0x31edcb['body']);if(_0x19c2d5[_0x5bfb('0x2a')]=='Failed'){_0x9b5d7e[_0x5bfb('0xa')]();}else{_0x9b5d7e[_0x5bfb('0x22')]();}})['catch'](function(_0x2eb3d4){logger[_0x5bfb('0x1e')](_0x5bfb('0x8'),_0x464213,JSON['stringify'](_0x2eb3d4));_0x9b5d7e[_0x5bfb('0xa')]();});}else{_0x9b5d7e[_0x5bfb('0xa')]();}});}}catch(_0x3fc745){logger[_0x5bfb('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x464213,JSON[_0x5bfb('0x1f')](_0x3fc745));_0x9b5d7e[_0x5bfb('0x22')]();}};}; \ 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 c0826d2..fd488ec 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 _0x8ae0=['isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','from','message','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','inReplyTo','html','','replace','headers','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','next','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail'];(function(_0x362d16,_0x31c1a2){var _0x5596de=function(_0x3e588b){while(--_0x3e588b){_0x362d16['push'](_0x362d16['shift']());}};_0x5596de(++_0x31c1a2);}(_0x8ae0,0xb1));var _0x08ae=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8ae0[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x08ae('0x0'));var moment=require(_0x08ae('0x1'));var utils=require(_0x08ae('0x2'));var logger=require(_0x08ae('0x3'))('routing');var rpc={'chatMessage':require(_0x08ae('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x08ae('0x5')),'smsMessage':require(_0x08ae('0x6')),'faxMessage':require(_0x08ae('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x08ae('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x08ae('0x9')),'faxInteraction':require(_0x08ae('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x08ae('0xb'));exports[_0x08ae('0xc')]=function(_0x3a3742,_0x53e20a,_0x11ab33,_0xc4e815){return function(_0x3a5d6e){try{var _0x11a214=this[_0x08ae('0xd')];if(_0x11a214===_0x08ae('0xe')&&_0xc4e815['body'][_0x08ae('0xf')]){logger[_0x08ae('0x10')](_0x08ae('0x11'),_0x3a3742,_0x08ae('0x12'));return _0x3a5d6e['next']();}if(_0x53e20a[0x0]==='1'&&(_[_0x08ae('0x13')](this[_0x08ae('0x14')][_0x08ae('0x15')])||!this[_0x08ae('0x14')]['created'])){logger['info'](_0x08ae('0x11'),_0x3a3742,'Autoreply\x20already\x20sent');return _0x3a5d6e['next']();}if(_0x53e20a[0x0]==='2'&&this[_0x08ae('0x14')]['autoreplyExecuted']){logger[_0x08ae('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a3742,_0x08ae('0x16'));return _0x3a5d6e['next']();}var _0x1492c9={'ContactId':this[_0x08ae('0x17')]['id'],'sentAt':moment()[_0x08ae('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x08ae('0x19')};if(this[_0x08ae('0xd')]==='mail'){_0x1492c9[_0x08ae('0x1a')]=utils[_0x08ae('0x1b')](_0x53e20a[0x2],this);}else{_0x1492c9[_0x08ae('0x1a')]=utils[_0x08ae('0x1b')](_0x53e20a[0x1],this);}if(this['message']){_0x1492c9['to']=this['message'][_0x08ae('0x1c')]||'';if(this[_0x08ae('0xd')]==='mail'&&_0x53e20a[0x1]==='1'){_0x1492c9['cc']=this[_0x08ae('0x1d')]['cc']||'';}_0x1492c9['from']=this[_0x08ae('0x1d')]['to']||'';_0x1492c9['phone']=this[_0x08ae('0x1d')]['phone']||'';_0x1492c9['read']=!![];if(this[_0x08ae('0x1d')][_0x08ae('0x1e')]){_0x1492c9[_0x08ae('0x1e')]='';_0x1492c9[_0x08ae('0x1e')]+=_[_0x08ae('0x1f')](this[_0x08ae('0x1d')][_0x08ae('0x1e')],_0x08ae('0x20'))?'':_0x08ae('0x21');_0x1492c9['subject']+=this[_0x08ae('0x1d')][_0x08ae('0x1e')];}}if(this[_0x08ae('0xd')]===_0x08ae('0x22')){_0x1492c9[_0x08ae('0x23')]=this['account']['id'];}else{_0x1492c9[_[_0x08ae('0x24')](this['channel'])+_0x08ae('0x25')]=this[_0x08ae('0x26')]['id'];}_0x1492c9[_[_0x08ae('0x24')](this[_0x08ae('0xd')])+'InteractionId']=this['interaction']['id'];var _0x1f289b=this['interaction'];if(rpc[this[_0x08ae('0xd')]+'Message']){if(this['channel']===_0x08ae('0xe')){_0x1492c9[_0x08ae('0x27')]=this[_0x08ae('0x1d')]['messageId'];_0x1492c9[_0x08ae('0x28')]=_0x08ae('0x29')+_[_0x08ae('0x2a')](_0x1492c9['body'],'';_0x1492c9[_0x08ae('0x2b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x08ae('0x2c'),'Precedence':'auto_reply'};return mailRpc[_0x08ae('0x2d')](this['account'][_0x08ae('0x2e')],_0x1492c9)[_0x08ae('0x2f')](function(_0x3821aa){logger[_0x08ae('0x10')](_0x08ae('0x30'),_0x3a3742);_0x1492c9[_0x08ae('0x31')]=_0x3821aa[_0x08ae('0x1d')][_0x08ae('0x31')];return rpc[_0x11a214+_0x08ae('0x32')]['create'](_0x1492c9);})[_0x08ae('0x2f')](function(_0x31e099){logger['info'](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x31e099));})[_0x08ae('0x34')](function(_0xf4730c){logger[_0x08ae('0x35')](_0x08ae('0x36'),_0x3a3742,JSON[_0x08ae('0x33')](_0xf4730c));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x53e20a[0x0]!=='2'||_0x1f289b[_0x08ae('0x37')])return;return rpc[_0x11a214+_0x08ae('0x38')][_0x08ae('0x39')](_0x1f289b['id'],{'autoreplyExecuted':!![]})[_0x08ae('0x2f')](function(_0x2ba29a){logger[_0x08ae('0x10')](_0x08ae('0x3a'),_0x3a3742,JSON[_0x08ae('0x33')](_0x2ba29a));})[_0x08ae('0x34')](function(_0xea9379){logger[_0x08ae('0x35')](_0x08ae('0x3b'),_0x3a3742,JSON['stringify'](_0xea9379));});})['then'](function(){_0x3a5d6e['next']();});});}else{return rpc[this['channel']+_0x08ae('0x32')][_0x08ae('0x3c')](_0x1492c9)[_0x08ae('0x2f')](function(){logger[_0x08ae('0x10')](_0x08ae('0x11'),_0x3a3742,_0x1492c9[_0x08ae('0x1a')]);})[_0x08ae('0x34')](function(_0x57ac50){logger[_0x08ae('0x35')](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x57ac50));})[_0x08ae('0x3d')](function(){Promise['resolve']()[_0x08ae('0x2f')](function(){if(_0x53e20a[0x0]!=='2'||_0x1f289b[_0x08ae('0x37')])return;return rpc[_0x11a214+_0x08ae('0x38')][_0x08ae('0x39')](_0x1f289b['id'],{'autoreplyExecuted':!![]})[_0x08ae('0x2f')](function(_0x55af4e){logger[_0x08ae('0x10')](_0x08ae('0x3a'),_0x3a3742,JSON[_0x08ae('0x33')](_0x55af4e));})[_0x08ae('0x34')](function(_0x1666a8){logger['error'](_0x08ae('0x3b'),_0x3a3742,JSON[_0x08ae('0x33')](_0x1666a8));});})[_0x08ae('0x2f')](function(){_0x3a5d6e[_0x08ae('0x3e')]();});});}}}catch(_0x190a70){logger[_0x08ae('0x35')](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x190a70));_0x3a5d6e[_0x08ae('0x3f')]();}};}; \ No newline at end of file +var _0x94b9=['','replace'];(function(_0x453f97,_0x510b3b){var _0x3fbd00=function(_0xa14fb){while(--_0xa14fb){_0x453f97['push'](_0x453f97['shift']());}};_0x3fbd00(++_0x510b3b);}(_0x94b9,0x196));var _0x994b=function(_0x3fbea8,_0x4876ae){_0x3fbea8=_0x3fbea8-0x0;var _0x4e7411=_0x94b9[_0x3fbea8];return _0x4e7411;};'use strict';var _=require(_0x994b('0x0'));var moment=require(_0x994b('0x1'));var utils=require(_0x994b('0x2'));var logger=require(_0x994b('0x3'))('routing');var rpc={'chatMessage':require(_0x994b('0x4')),'openchannelMessage':require(_0x994b('0x5')),'mailMessage':require(_0x994b('0x6')),'smsMessage':require(_0x994b('0x7')),'faxMessage':require(_0x994b('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x994b('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x994b('0xa')),'whatsappInteraction':require(_0x994b('0xb'))};var mailRpc=require(_0x994b('0xc'));exports[_0x994b('0xd')]=function(_0xe9b556,_0x37c5ed,_0x6ad679,_0x3c67be){return function(_0x3b86c3){try{var _0x408e5b=this[_0x994b('0xe')];if(_0x408e5b==='mail'&&_0x3c67be['body'][_0x994b('0xf')]){logger[_0x994b('0x10')](_0x994b('0x11'),_0xe9b556,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3b86c3[_0x994b('0x12')]();}if(_0x37c5ed[0x0]==='1'&&(_[_0x994b('0x13')](this[_0x994b('0x14')]['created'])||!this[_0x994b('0x14')]['created'])){logger[_0x994b('0x10')](_0x994b('0x11'),_0xe9b556,_0x994b('0x15'));return _0x3b86c3['next']();}if(_0x37c5ed[0x0]==='2'&&this[_0x994b('0x14')][_0x994b('0x16')]){logger[_0x994b('0x10')](_0x994b('0x17'),_0xe9b556,_0x994b('0x18'));return _0x3b86c3[_0x994b('0x12')]();}var _0x29707b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x994b('0x19')](_0x994b('0x1a')),'direction':_0x994b('0x1b')};if(this[_0x994b('0xe')]===_0x994b('0x1c')){_0x29707b['body']=utils[_0x994b('0x1d')](_0x37c5ed[0x2],this);}else{_0x29707b[_0x994b('0x1e')]=utils[_0x994b('0x1d')](_0x37c5ed[0x1],this);}if(this[_0x994b('0x1f')]){_0x29707b['to']=this[_0x994b('0x1f')]['from']||'';if(this[_0x994b('0xe')]==='mail'&&_0x37c5ed[0x1]==='1'){_0x29707b['cc']=this['message']['cc']||'';}_0x29707b[_0x994b('0x20')]=this[_0x994b('0x1f')]['to']||'';_0x29707b[_0x994b('0x21')]=this[_0x994b('0x1f')][_0x994b('0x21')]||'';_0x29707b[_0x994b('0x22')]=!![];if(this[_0x994b('0x1f')][_0x994b('0x23')]){_0x29707b[_0x994b('0x23')]='';_0x29707b[_0x994b('0x23')]+=_['startsWith'](this[_0x994b('0x1f')][_0x994b('0x23')],_0x994b('0x24'))?'':_0x994b('0x25');_0x29707b['subject']+=this['message']['subject'];}}if(this['channel']===_0x994b('0x26')){_0x29707b[_0x994b('0x27')]=this[_0x994b('0x28')]['id'];}else{_0x29707b[_[_0x994b('0x29')](this[_0x994b('0xe')])+_0x994b('0x2a')]=this[_0x994b('0x28')]['id'];}_0x29707b[_[_0x994b('0x29')](this[_0x994b('0xe')])+'InteractionId']=this[_0x994b('0x14')]['id'];var _0xec3f6c=this[_0x994b('0x14')];if(rpc[this[_0x994b('0xe')]+_0x994b('0x2b')]){if(this[_0x994b('0xe')]==='mail'){_0x29707b[_0x994b('0x2c')]=this[_0x994b('0x1f')][_0x994b('0x2d')];_0x29707b[_0x994b('0x2e')]=_0x994b('0x2f')+_[_0x994b('0x30')](_0x29707b[_0x994b('0x1e')],_0x994b('0x31'),_0x994b('0x32'))+'';_0x29707b[_0x994b('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x994b('0x34')};return mailRpc[_0x994b('0x35')](this[_0x994b('0x28')][_0x994b('0x36')],_0x29707b)[_0x994b('0x37')](function(_0x207238){logger[_0x994b('0x10')](_0x994b('0x38'),_0xe9b556);_0x29707b[_0x994b('0x2d')]=_0x207238[_0x994b('0x1f')]['messageId'];return rpc[_0x408e5b+'Message'][_0x994b('0x39')](_0x29707b);})[_0x994b('0x37')](function(_0x34adfe){logger[_0x994b('0x10')]('[%s][AUTOREPLY]\x20%s',_0xe9b556,JSON[_0x994b('0x3a')](_0x34adfe));})['catch'](function(_0x298966){logger[_0x994b('0x3b')](_0x994b('0x3c'),_0xe9b556,JSON[_0x994b('0x3a')](_0x298966));})[_0x994b('0x3d')](function(){Promise['resolve']()[_0x994b('0x37')](function(){if(_0x37c5ed[0x0]!=='2'||_0xec3f6c[_0x994b('0x16')])return;return rpc[_0x408e5b+'Interaction']['update'](_0xec3f6c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x12e05a){logger[_0x994b('0x10')](_0x994b('0x17'),_0xe9b556,JSON[_0x994b('0x3a')](_0x12e05a));})[_0x994b('0x3e')](function(_0x47bf25){logger[_0x994b('0x3b')](_0x994b('0x3f'),_0xe9b556,JSON[_0x994b('0x3a')](_0x47bf25));});})[_0x994b('0x37')](function(){_0x3b86c3[_0x994b('0x12')]();});});}else{return rpc[this[_0x994b('0xe')]+_0x994b('0x2b')][_0x994b('0x39')](_0x29707b)['then'](function(){logger[_0x994b('0x10')](_0x994b('0x11'),_0xe9b556,_0x29707b['body']);})[_0x994b('0x3e')](function(_0x2ba344){logger['error'](_0x994b('0x11'),_0xe9b556,JSON[_0x994b('0x3a')](_0x2ba344));})[_0x994b('0x3d')](function(){Promise[_0x994b('0x40')]()['then'](function(){if(_0x37c5ed[0x0]!=='2'||_0xec3f6c[_0x994b('0x16')])return;return rpc[_0x408e5b+'Interaction']['update'](_0xec3f6c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x180d05){logger[_0x994b('0x10')](_0x994b('0x17'),_0xe9b556,JSON[_0x994b('0x3a')](_0x180d05));})[_0x994b('0x3e')](function(_0x103b31){logger[_0x994b('0x3b')](_0x994b('0x3f'),_0xe9b556,JSON['stringify'](_0x103b31));});})[_0x994b('0x37')](function(){_0x3b86c3[_0x994b('0x12')]();});});}}}catch(_0x1b2180){logger[_0x994b('0x3b')](_0x994b('0x11'),_0xe9b556,JSON[_0x994b('0x3a')](_0x1b2180));_0x3b86c3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 5b8677f..1fb1087 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 _0xd5c0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger'];(function(_0x14a47c,_0x3f32fd){var _0xd43546=function(_0x5656a0){while(--_0x5656a0){_0x14a47c['push'](_0x14a47c['shift']());}};_0xd43546(++_0x3f32fd);}(_0xd5c0,0x157));var _0x0d5c=function(_0x57c662,_0x2c9ffe){_0x57c662=_0x57c662-0x0;var _0x216916=_0xd5c0[_0x57c662];return _0x216916;};'use strict';var moment=require(_0x0d5c('0x0'));var logger=require(_0x0d5c('0x1'))(_0x0d5c('0x2'));var rpc={'chatInteraction':require(_0x0d5c('0x3')),'openchannelInteraction':require(_0x0d5c('0x4')),'smsInteraction':require(_0x0d5c('0x5')),'mailInteraction':require(_0x0d5c('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0d5c('0x7'))};exports['consequence']=function(_0x283326,_0x1e9ca2,_0x45ec65,_0x1187df){return function(_0x21c384){try{logger[_0x0d5c('0x8')](_0x0d5c('0x9'),_0x283326,_0x1e9ca2[0x0]);var _0x148ab3={'closed':0x1,'closedAt':moment()[_0x0d5c('0xa')](_0x0d5c('0xb')),'closeReason':_0x0d5c('0xc'),'disposition':_0x1e9ca2[0x0]};if(rpc[_0x1187df[_0x0d5c('0xd')]+_0x0d5c('0xe')]){rpc[_0x1187df['channel']+_0x0d5c('0xe')][_0x0d5c('0xf')](_0x1187df[_0x0d5c('0x10')]['id'],_0x148ab3)['then'](function(_0x4af1cf){logger[_0x0d5c('0x8')](_0x0d5c('0x11'),_0x283326,_0x1187df[_0x0d5c('0x10')]['id']);})['catch'](function(_0x19f5bc){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON['stringify'](_0x19f5bc));})[_0x0d5c('0x14')](function(){_0x21c384['stop']();});}}catch(_0x1a8113){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON[_0x0d5c('0x15')](_0x1a8113));_0x21c384[_0x0d5c('0x16')]();}};}; \ No newline at end of file +var _0x50ac=['[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','catch','error'];(function(_0x53c533,_0x503be8){var _0x527129=function(_0x173a18){while(--_0x173a18){_0x53c533['push'](_0x53c533['shift']());}};_0x527129(++_0x503be8);}(_0x50ac,0x68));var _0xc50a=function(_0x1319ab,_0x4aadf5){_0x1319ab=_0x1319ab-0x0;var _0x11d131=_0x50ac[_0x1319ab];return _0x11d131;};'use strict';var moment=require('moment');var logger=require(_0xc50a('0x0'))('routing');var rpc={'chatInteraction':require(_0xc50a('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc50a('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc50a('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xc50a('0x4')]=function(_0x1f0fa2,_0x450b10,_0x16902a,_0x17b5e8){return function(_0x40715b){try{logger[_0xc50a('0x5')](_0xc50a('0x6'),_0x1f0fa2,_0x450b10[0x0]);var _0x156717={'closed':0x1,'closedAt':moment()[_0xc50a('0x7')](_0xc50a('0x8')),'closeReason':_0xc50a('0x9'),'disposition':_0x450b10[0x0]};if(rpc[_0x17b5e8[_0xc50a('0xa')]+_0xc50a('0xb')]){rpc[_0x17b5e8[_0xc50a('0xa')]+_0xc50a('0xb')][_0xc50a('0xc')](_0x17b5e8[_0xc50a('0xd')]['id'],_0x156717)['then'](function(_0x16892f){logger[_0xc50a('0x5')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1f0fa2,_0x17b5e8['interaction']['id']);})[_0xc50a('0xe')](function(_0x4933c6){logger[_0xc50a('0xf')](_0xc50a('0x10'),_0x1f0fa2,JSON[_0xc50a('0x11')](_0x4933c6));})[_0xc50a('0x12')](function(){_0x40715b['stop']();});}}catch(_0x500c1b){logger[_0xc50a('0xf')](_0xc50a('0x10'),_0x1f0fa2,JSON[_0xc50a('0x11')](_0x500c1b));_0x40715b[_0xc50a('0x13')]();}};}; \ 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 bde3851..a88cd8e 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 _0x6c99=['error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','body','interaction','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','endConversation','next','lodash','apiai-promise','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','created','isEmpty','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch'];(function(_0x1dc70e,_0x48031d){var _0x5c4472=function(_0x405b77){while(--_0x405b77){_0x1dc70e['push'](_0x1dc70e['shift']());}};_0x5c4472(++_0x48031d);}(_0x6c99,0x9b));var _0x96c9=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x6c99[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0x96c9('0x0'));var moment=require('moment');var apiai=require(_0x96c9('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x96c9('0x2')),'mailMessage':require(_0x96c9('0x3')),'smsMessage':require(_0x96c9('0x4')),'faxMessage':require(_0x96c9('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x96c9('0x6')]=function(_0x1a30b2,_0x4323be){return function(_0x31d79e){try{if(!_[_0x96c9('0x7')](this['interaction']['UserId'])){logger[_0x96c9('0x8')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,_0x96c9('0x9'));return _0x31d79e['next']();}var _0x2e05a5={'ContactId':this[_0x96c9('0xa')]['id'],'sentAt':moment()[_0x96c9('0xb')](_0x96c9('0xc')),'direction':'out'};if(this[_0x96c9('0xd')]===_0x96c9('0xe')||this[_0x96c9('0xd')]===_0x96c9('0xf')){_0x2e05a5[_0x96c9('0x10')]=this['interaction'][_0x96c9('0x10')];}var _0x196124=this[_0x96c9('0xd')];if(_0x196124===_0x96c9('0x11')){_0x2e05a5['ChatWebsiteId']=this['account']['id'];}else{_0x2e05a5[_[_0x96c9('0x12')](_0x196124)+_0x96c9('0x13')]=this[_0x96c9('0x14')]['id'];}_0x2e05a5[_[_0x96c9('0x12')](_0x196124)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x96c9('0x15')]){var _0x508568=_0x4323be[0x2];if(!_[_0x96c9('0x16')](_0x508568)){_0x2e05a5['body']=utils[_0x96c9('0x17')](_0x508568,this);return rpc[_0x196124+_0x96c9('0x18')][_0x96c9('0x19')](_0x2e05a5)[_0x96c9('0x1a')](function(_0x3bdf8f){logger['info'](_0x96c9('0x1b'),_0x1a30b2,_0x2e05a5['body']);})[_0x96c9('0x1c')](function(_0x433390){logger[_0x96c9('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,JSON['stringify'](_0x433390));})[_0x96c9('0x1e')](function(){logger[_0x96c9('0x8')](_0x96c9('0x1f'),_0x1a30b2);_0x31d79e[_0x96c9('0x20')]();});}else{logger[_0x96c9('0x8')](_0x96c9('0x21'),_0x1a30b2);_0x31d79e['stop']();}}else{var _0x101a25=this;var _0x3a7fc5=apiai(_0x4323be[0x0],{'language':_0x4323be[0x1]||'en'});return _0x3a7fc5['textRequest'](this[_0x96c9('0x22')][_0x96c9('0x23')],{'sessionId':md5(this[_0x96c9('0x24')]['id'])})['then'](function(_0x13e642){_0x101a25[_0x96c9('0x23')][_0x96c9('0x25')]=_0x13e642;_0x2e05a5[_0x96c9('0x23')]=_0x13e642[_0x96c9('0x26')][_0x96c9('0x27')][_0x96c9('0x28')];_0x2e05a5['providerName']=_0x96c9('0x25');_0x2e05a5[_0x96c9('0x29')]=JSON[_0x96c9('0x2a')](_0x13e642);return rpc[_0x196124+_0x96c9('0x18')][_0x96c9('0x19')](_0x2e05a5)[_0x96c9('0x1a')](function(_0x306ac6){logger[_0x96c9('0x8')](_0x96c9('0x1b'),_0x1a30b2,_0x2e05a5[_0x96c9('0x23')]);if(_0x13e642[_0x96c9('0x26')][_0x96c9('0x2b')][_0x96c9('0x2c')]){_0x31d79e['next']();}else{_0x31d79e[_0x96c9('0x20')]();}})[_0x96c9('0x1c')](function(_0x4cae5a){logger[_0x96c9('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,JSON['stringify'](_0x4cae5a));_0x31d79e[_0x96c9('0x2d')]();});})[_0x96c9('0x1c')](function(_0x3516eb){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,_0x3516eb[_0x96c9('0x22')]);_0x31d79e[_0x96c9('0x2d')]();});}}catch(_0x4408bd){logger[_0x96c9('0x1d')](_0x96c9('0x1b'),_0x1a30b2,JSON[_0x96c9('0x2a')](_0x4408bd));_0x31d79e['stop']();}};}; \ No newline at end of file +var _0x1c75=['speech','providerName','providerResponse','metadata','endConversation','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','sms','phone','chat','account','AccountId','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','info','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','dialogflow','result','fulfillment'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x1c75,0xce));var _0x51c7=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0x1c75[_0xb4e2df];return _0x5e95ba;};'use strict';var _=require(_0x51c7('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x51c7('0x1'));var logger=require(_0x51c7('0x2'))(_0x51c7('0x3'));var rpc={'chatMessage':require(_0x51c7('0x4')),'openchannelMessage':require(_0x51c7('0x5')),'mailMessage':require(_0x51c7('0x6')),'smsMessage':require(_0x51c7('0x7')),'faxMessage':require(_0x51c7('0x8')),'whatsappMessage':require(_0x51c7('0x9'))};exports[_0x51c7('0xa')]=function(_0x283d6b,_0x56b9a0){return function(_0x1feb9a){try{if(!_[_0x51c7('0xb')](this[_0x51c7('0xc')][_0x51c7('0xd')])){logger['info'](_0x51c7('0xe'),_0x283d6b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1feb9a[_0x51c7('0xf')]();}var _0x5692a7={'ContactId':this[_0x51c7('0x10')]['id'],'sentAt':moment()[_0x51c7('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x51c7('0x12')};if(this[_0x51c7('0x13')]===_0x51c7('0x14')||this['channel']==='whatsapp'){_0x5692a7['phone']=this[_0x51c7('0xc')][_0x51c7('0x15')];}var _0x224052=this['channel'];if(_0x224052===_0x51c7('0x16')){_0x5692a7['ChatWebsiteId']=this[_0x51c7('0x17')]['id'];}else{_0x5692a7[_['upperFirst'](_0x224052)+_0x51c7('0x18')]=this['account']['id'];}_0x5692a7[_[_0x51c7('0x19')](_0x224052)+_0x51c7('0x1a')]=this[_0x51c7('0xc')]['id'];if(this[_0x51c7('0xc')]['created']){var _0x177e14=_0x56b9a0[0x2];if(!_[_0x51c7('0x1b')](_0x177e14)){_0x5692a7[_0x51c7('0x1c')]=utils[_0x51c7('0x1d')](_0x177e14,this);return rpc[_0x224052+_0x51c7('0x1e')][_0x51c7('0x1f')](_0x5692a7)['then'](function(_0xe4cf49){logger[_0x51c7('0x20')](_0x51c7('0xe'),_0x283d6b,_0x5692a7['body']);})[_0x51c7('0x21')](function(_0x3ea444){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x283d6b,JSON[_0x51c7('0x22')](_0x3ea444));})[_0x51c7('0x23')](function(){logger[_0x51c7('0x20')](_0x51c7('0x24'),_0x283d6b);_0x1feb9a[_0x51c7('0x25')]();});}else{logger[_0x51c7('0x20')](_0x51c7('0x26'),_0x283d6b);_0x1feb9a['stop']();}}else{var _0x3dbfbc=this;var _0x11c83d=apiai(_0x56b9a0[0x0],{'language':_0x56b9a0[0x1]||'en'});return _0x11c83d['textRequest'](this[_0x51c7('0x27')]['body'],{'sessionId':md5(this[_0x51c7('0xc')]['id'])})[_0x51c7('0x28')](function(_0x414de0){_0x3dbfbc['body'][_0x51c7('0x29')]=_0x414de0;_0x5692a7[_0x51c7('0x1c')]=_0x414de0[_0x51c7('0x2a')][_0x51c7('0x2b')][_0x51c7('0x2c')];_0x5692a7[_0x51c7('0x2d')]='dialogflow';_0x5692a7[_0x51c7('0x2e')]=JSON['stringify'](_0x414de0);return rpc[_0x224052+_0x51c7('0x1e')][_0x51c7('0x1f')](_0x5692a7)[_0x51c7('0x28')](function(_0x1c29fb){logger[_0x51c7('0x20')](_0x51c7('0xe'),_0x283d6b,_0x5692a7[_0x51c7('0x1c')]);if(_0x414de0[_0x51c7('0x2a')][_0x51c7('0x2f')][_0x51c7('0x30')]){_0x1feb9a[_0x51c7('0xf')]();}else{_0x1feb9a[_0x51c7('0x25')]();}})['catch'](function(_0xc1688f){logger[_0x51c7('0x31')](_0x51c7('0xe'),_0x283d6b,JSON[_0x51c7('0x22')](_0xc1688f));_0x1feb9a['next']();});})[_0x51c7('0x21')](function(_0x5e90bc){logger[_0x51c7('0x31')](_0x51c7('0xe'),_0x283d6b,_0x5e90bc[_0x51c7('0x27')]);_0x1feb9a['next']();});}}catch(_0xa7ff09){logger['error'](_0x51c7('0xe'),_0x283d6b,JSON[_0x51c7('0x22')](_0xa7ff09));_0x1feb9a[_0x51c7('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2c526d3..430a962 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 _0x23c2=['DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','push','all','message','stack','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','ChatWebsiteId','AccountId','account','upperFirst','created','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x23c2,0x111));var _0x223c=function(_0x50e545,_0x342948){_0x50e545=_0x50e545-0x0;var _0x181af8=_0x23c2[_0x50e545];return _0x181af8;};'use strict';var _=require(_0x223c('0x0'));var dialogflow=require(_0x223c('0x1'));var md5=require(_0x223c('0x2'));var moment=require(_0x223c('0x3'));var Promise=require(_0x223c('0x4'));var logger=require('../../../../config/logger')(_0x223c('0x5'));var utils=require(_0x223c('0x6'));var rpc={'chatMessage':require(_0x223c('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x223c('0x8'))};function createMessage(_0x340982,_0xa3f59c,_0x1e2312,_0x4516a0){return new Promise(function(_0x26d0f9,_0x37057c){var _0x44e993=_['clone'](_0x1e2312);_0x44e993[_0x223c('0x9')]=_0x4516a0;return rpc[_0xa3f59c+_0x223c('0xa')][_0x223c('0xb')](_0x44e993)[_0x223c('0xc')](function(){logger[_0x223c('0xd')](_0x223c('0xe'),_0x340982,_0x44e993[_0x223c('0x9')]);_0x26d0f9();})[_0x223c('0xf')](function(_0x39533c){logger[_0x223c('0x10')](_0x223c('0xe'),_0x340982,JSON[_0x223c('0x11')](_0x39533c));_0x37057c(_0x39533c);});});}exports[_0x223c('0x12')]=function(_0x1b1fa7,_0x126180){return function(_0x318758){try{if(!_['isNil'](this['interaction'][_0x223c('0x13')])){logger['info'](_0x223c('0xe'),_0x1b1fa7,_0x223c('0x14'));return _0x318758[_0x223c('0x15')]();}var _0x36e4b2={'ContactId':this['contact']['id'],'sentAt':moment()[_0x223c('0x16')](_0x223c('0x17')),'direction':_0x223c('0x18')};if(this[_0x223c('0x19')]===_0x223c('0x1a')||this[_0x223c('0x19')]==='whatsapp'){_0x36e4b2[_0x223c('0x1b')]=this[_0x223c('0x1c')][_0x223c('0x1b')];}var _0x15c1c5=this['channel'];if(_0x15c1c5==='chat'){_0x36e4b2[_0x223c('0x1d')]=this['account']['id'];}else{_0x36e4b2[_['upperFirst'](_0x15c1c5)+_0x223c('0x1e')]=this[_0x223c('0x1f')]['id'];}_0x36e4b2[_[_0x223c('0x20')](_0x15c1c5)+'InteractionId']=this[_0x223c('0x1c')]['id'];if(this['interaction'][_0x223c('0x21')]){var _0x429d94=_0x126180[0x4];if(!_['isEmpty'](_0x429d94)){_0x36e4b2[_0x223c('0x9')]=utils['getMustacheRender'](_0x429d94,this);return rpc[_0x15c1c5+_0x223c('0xa')][_0x223c('0xb')](_0x36e4b2)[_0x223c('0xc')](function(_0x3914d7){logger['info'](_0x223c('0xe'),_0x1b1fa7,_0x36e4b2[_0x223c('0x9')]);})[_0x223c('0xf')](function(_0x5d4b05){logger['error'](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x5d4b05));})[_0x223c('0x22')](function(){logger[_0x223c('0xd')](_0x223c('0x23'),_0x1b1fa7);_0x318758[_0x223c('0x24')]();});}else{logger[_0x223c('0xd')](_0x223c('0x25'),_0x1b1fa7);_0x318758[_0x223c('0x24')]();}}else{var _0x21d613=this;var _0x4ce96b=_0x126180[0x2]['replace'](/\\n/g,'\x0a');var _0x23f4da={'credentials':{'private_key':_0x4ce96b,'client_email':_0x126180[0x1]}};var _0x33e93f=new dialogflow['SessionsClient'](_0x23f4da);var _0x10a223=_0x33e93f[_0x223c('0x26')](_0x126180[0x0],md5(_0x21d613['interaction']['id']));var _0x127cc1={'session':_0x10a223,'queryInput':{'text':{'text':_0x21d613['message'][_0x223c('0x9')],'languageCode':_0x126180[0x3]||'en'}}};return _0x33e93f['detectIntent'](_0x127cc1)[_0x223c('0xc')](function(_0x5cbdda){if(_0x5cbdda&&_0x5cbdda[_0x223c('0x27')]){_0x21d613['body']['dialogflowV2']=_0x5cbdda;var _0x401a5a=_0x5cbdda[0x0];var _0x26d38e=_0x401a5a[_0x223c('0x28')]['diagnosticInfo']&&_0x401a5a[_0x223c('0x28')][_0x223c('0x29')]['fields']?_0x401a5a['queryResult'][_0x223c('0x29')][_0x223c('0x2a')][_0x223c('0x2b')][_0x223c('0x2c')]:![];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_ACTION']=_0x401a5a[_0x223c('0x28')]['action'];_0x21d613[_0x223c('0x9')][_0x223c('0x2d')]=_0x401a5a[_0x223c('0x28')][_0x223c('0x2e')];_0x21d613['body'][_0x223c('0x2f')]=_0x401a5a[_0x223c('0x28')][_0x223c('0x29')]&&_0x401a5a[_0x223c('0x28')][_0x223c('0x29')][_0x223c('0x2a')]?_0x401a5a[_0x223c('0x28')][_0x223c('0x29')][_0x223c('0x2a')][_0x223c('0x2b')]['boolValue']:![];_0x21d613[_0x223c('0x9')][_0x223c('0x30')]=_0x401a5a['queryResult'][_0x223c('0x31')][_0x223c('0x32')];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x401a5a[_0x223c('0x28')][_0x223c('0x31')][_0x223c('0x33')];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x401a5a[_0x223c('0x28')][_0x223c('0x31')][_0x223c('0x34')];_0x21d613[_0x223c('0x9')][_0x223c('0x35')]=_0x401a5a['queryResult'][_0x223c('0x36')];_0x21d613[_0x223c('0x9')][_0x223c('0x37')]=_0x401a5a['queryResult'][_0x223c('0x38')];_0x21d613[_0x223c('0x9')][_0x223c('0x39')]=_0x401a5a['queryResult'][_0x223c('0x3a')];_0x36e4b2[_0x223c('0x3b')]=_0x223c('0x3c');_0x36e4b2[_0x223c('0x3d')]=JSON['stringify'](_0x5cbdda);var _0x2970e7=[];for(var _0xdcf0ef=0x0;_0xdcf0ef<_0x5cbdda[_0x223c('0x27')];_0xdcf0ef++){var _0x1a3e19=_0x5cbdda[_0xdcf0ef];if(_0x1a3e19&&_0x1a3e19[_0x223c('0x28')]&&_0x1a3e19['queryResult']['fulfillmentText']){_0x2970e7[_0x223c('0x3e')](createMessage(_0x1b1fa7,_0x15c1c5,_0x36e4b2,_0x1a3e19[_0x223c('0x28')]['fulfillmentText']));}}return Promise[_0x223c('0x3f')](_0x2970e7)[_0x223c('0xc')](function(){if(_0x26d38e){_0x318758[_0x223c('0x15')]();}else{_0x318758[_0x223c('0x24')]();}})[_0x223c('0xf')](function(_0x2d7535){logger[_0x223c('0x10')](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x2d7535));_0x318758[_0x223c('0x15')]();});}})[_0x223c('0xf')](function(_0x2f47f8){logger[_0x223c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b1fa7,_0x2f47f8[_0x223c('0x40')],_0x2f47f8[_0x223c('0x41')]);_0x318758[_0x223c('0x15')]();});}}catch(_0x236bbb){logger[_0x223c('0x10')](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x236bbb));_0x318758['stop']();}};}; \ No newline at end of file +var _0x900e=['UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','catch','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','action','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','all','message','stack','lodash','md5','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil'];(function(_0x2adafd,_0x3d8024){var _0x119013=function(_0x1d1207){while(--_0x1d1207){_0x2adafd['push'](_0x2adafd['shift']());}};_0x119013(++_0x3d8024);}(_0x900e,0x1e5));var _0xe900=function(_0x4f517f,_0x15e66f){_0x4f517f=_0x4f517f-0x0;var _0x48bc81=_0x900e[_0x4f517f];return _0x48bc81;};'use strict';var _=require(_0xe900('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xe900('0x1'));var moment=require('moment');var Promise=require(_0xe900('0x2'));var logger=require(_0xe900('0x3'))('routing');var utils=require(_0xe900('0x4'));var rpc={'chatMessage':require(_0xe900('0x5')),'openchannelMessage':require(_0xe900('0x6')),'mailMessage':require(_0xe900('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe900('0x8')),'whatsappMessage':require(_0xe900('0x9'))};function createMessage(_0xb3a128,_0x16ba42,_0x329de8,_0x1ffafe){return new Promise(function(_0x4e8f6c,_0x2da901){var _0x5e20a8=_['clone'](_0x329de8);_0x5e20a8[_0xe900('0xa')]=_0x1ffafe;return rpc[_0x16ba42+_0xe900('0xb')]['create'](_0x5e20a8)[_0xe900('0xc')](function(){logger[_0xe900('0xd')](_0xe900('0xe'),_0xb3a128,_0x5e20a8[_0xe900('0xa')]);_0x4e8f6c();})['catch'](function(_0x43eecf){logger[_0xe900('0xf')](_0xe900('0xe'),_0xb3a128,JSON[_0xe900('0x10')](_0x43eecf));_0x2da901(_0x43eecf);});});}exports[_0xe900('0x11')]=function(_0x4af40d,_0x159595){return function(_0x4e66ca){try{if(!_[_0xe900('0x12')](this['interaction'][_0xe900('0x13')])){logger[_0xe900('0xd')](_0xe900('0xe'),_0x4af40d,_0xe900('0x14'));return _0x4e66ca[_0xe900('0x15')]();}var _0xa5853={'ContactId':this[_0xe900('0x16')]['id'],'sentAt':moment()[_0xe900('0x17')](_0xe900('0x18')),'direction':'out'};if(this['channel']===_0xe900('0x19')||this[_0xe900('0x1a')]===_0xe900('0x1b')){_0xa5853['phone']=this[_0xe900('0x1c')][_0xe900('0x1d')];}var _0x1041e1=this['channel'];if(_0x1041e1===_0xe900('0x1e')){_0xa5853[_0xe900('0x1f')]=this[_0xe900('0x20')]['id'];}else{_0xa5853[_[_0xe900('0x21')](_0x1041e1)+_0xe900('0x22')]=this[_0xe900('0x20')]['id'];}_0xa5853[_['upperFirst'](_0x1041e1)+'InteractionId']=this[_0xe900('0x1c')]['id'];if(this[_0xe900('0x1c')][_0xe900('0x23')]){var _0x187ecf=_0x159595[0x4];if(!_[_0xe900('0x24')](_0x187ecf)){_0xa5853[_0xe900('0xa')]=utils[_0xe900('0x25')](_0x187ecf,this);return rpc[_0x1041e1+'Message']['create'](_0xa5853)[_0xe900('0xc')](function(_0x47c8aa){logger[_0xe900('0xd')](_0xe900('0xe'),_0x4af40d,_0xa5853[_0xe900('0xa')]);})[_0xe900('0x26')](function(_0x5871f1){logger[_0xe900('0xf')](_0xe900('0xe'),_0x4af40d,JSON['stringify'](_0x5871f1));})[_0xe900('0x27')](function(){logger[_0xe900('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4af40d);_0x4e66ca[_0xe900('0x28')]();});}else{logger[_0xe900('0xd')](_0xe900('0x29'),_0x4af40d);_0x4e66ca[_0xe900('0x28')]();}}else{var _0x289f3a=this;var _0x236f9a=_0x159595[0x2][_0xe900('0x2a')](/\\n/g,'\x0a');var _0x2627fd={'credentials':{'private_key':_0x236f9a,'client_email':_0x159595[0x1]}};var _0x19e27f=new dialogflow[(_0xe900('0x2b'))](_0x2627fd);var _0x433e9b=_0x19e27f['sessionPath'](_0x159595[0x0],md5(_0x289f3a[_0xe900('0x1c')]['id']));var _0x1bc0c3={'session':_0x433e9b,'queryInput':{'text':{'text':_0x289f3a['message'][_0xe900('0xa')],'languageCode':_0x159595[0x3]||'en'}}};return _0x19e27f[_0xe900('0x2c')](_0x1bc0c3)[_0xe900('0xc')](function(_0x3db48f){if(_0x3db48f&&_0x3db48f[_0xe900('0x2d')]){_0x289f3a[_0xe900('0xa')][_0xe900('0x2e')]=_0x3db48f;var _0xb618f=_0x3db48f[0x0];var _0x370bef=_0xb618f['queryResult'][_0xe900('0x2f')]&&_0xb618f[_0xe900('0x30')][_0xe900('0x2f')]['fields']?_0xb618f[_0xe900('0x30')][_0xe900('0x2f')][_0xe900('0x31')][_0xe900('0x32')]['boolValue']:![];_0x289f3a[_0xe900('0xa')]['DIALOGFLOWV2_ACTION']=_0xb618f[_0xe900('0x30')][_0xe900('0x33')];_0x289f3a[_0xe900('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0xb618f['queryResult'][_0xe900('0x34')];_0x289f3a[_0xe900('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0xb618f['queryResult'][_0xe900('0x2f')]&&_0xb618f[_0xe900('0x30')]['diagnosticInfo']['fields']?_0xb618f[_0xe900('0x30')]['diagnosticInfo'][_0xe900('0x31')][_0xe900('0x32')][_0xe900('0x35')]:![];_0x289f3a[_0xe900('0xa')][_0xe900('0x36')]=_0xb618f[_0xe900('0x30')][_0xe900('0x37')][_0xe900('0x38')];_0x289f3a[_0xe900('0xa')][_0xe900('0x39')]=_0xb618f[_0xe900('0x30')][_0xe900('0x37')][_0xe900('0x3a')];_0x289f3a[_0xe900('0xa')][_0xe900('0x3b')]=_0xb618f[_0xe900('0x30')][_0xe900('0x37')][_0xe900('0x3c')];_0x289f3a[_0xe900('0xa')][_0xe900('0x3d')]=_0xb618f[_0xe900('0x30')][_0xe900('0x3e')];_0x289f3a[_0xe900('0xa')][_0xe900('0x3f')]=_0xb618f[_0xe900('0x30')][_0xe900('0x40')];_0x289f3a[_0xe900('0xa')][_0xe900('0x41')]=_0xb618f['queryResult']['intentDetectionConfidence'];_0xa5853[_0xe900('0x42')]=_0xe900('0x2e');_0xa5853[_0xe900('0x43')]=JSON[_0xe900('0x10')](_0x3db48f);var _0x71fbf5=[];for(var _0x155f2d=0x0;_0x155f2d<_0x3db48f['length'];_0x155f2d++){var _0x375c9b=_0x3db48f[_0x155f2d];if(_0x375c9b&&_0x375c9b[_0xe900('0x30')]&&_0x375c9b[_0xe900('0x30')][_0xe900('0x44')]){_0x71fbf5['push'](createMessage(_0x4af40d,_0x1041e1,_0xa5853,_0x375c9b['queryResult'][_0xe900('0x44')]));}}return Promise[_0xe900('0x45')](_0x71fbf5)[_0xe900('0xc')](function(){if(_0x370bef){_0x4e66ca[_0xe900('0x15')]();}else{_0x4e66ca[_0xe900('0x28')]();}})[_0xe900('0x26')](function(_0x456110){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4af40d,JSON[_0xe900('0x10')](_0x456110));_0x4e66ca[_0xe900('0x15')]();});}})[_0xe900('0x26')](function(_0x5f5be3){logger[_0xe900('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x4af40d,_0x5f5be3[_0xe900('0x46')],_0x5f5be3[_0xe900('0x47')]);_0x4e66ca[_0xe900('0x15')]();});}}catch(_0x338a3c){logger[_0xe900('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x4af40d,JSON[_0xe900('0x10')](_0x338a3c));_0x4e66ca[_0xe900('0x28')]();}};}; \ 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 6baa92b..8a3bcd0 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 _0x7deb=['./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','join','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','html-to-text'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x7deb,0x1e5));var _0xb7de=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x7deb[_0x3227c1];return _0x31fd48;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xb7de('0x0'));var utils=require(_0xb7de('0x1'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xb7de('0x2'),'required':!![],'message':_0xb7de('0x3')},'priorityTrue':{'type':_0xb7de('0x4'),'message':_0xb7de('0x5')},'priorityFalse':{'type':_0xb7de('0x4'),'message':_0xb7de('0x6')}});exports[_0xb7de('0x7')]=function(_0x30e4e7,_0xabd37){return function(_0x5e66ff){try{var _0x491adc={'condition':htmlToText[_0xb7de('0x8')](utils[_0xb7de('0x9')](_0xabd37[0x0],this),{'wordwrap':![]})[_0xb7de('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xabd37[0x1],'priorityFalse':_0xabd37[0x2]};var _0x3a867c=gotoif[_0xb7de('0xb')](_0x491adc,{'typecast':!![]});if(_0x3a867c[_0xb7de('0xc')]){logger[_0xb7de('0xd')]('[%s][GOTOIF]\x20%s',_0x30e4e7,_['map'](_0x3a867c,'message')[_0xb7de('0xe')](',\x20'));_0x5e66ff[_0xb7de('0xf')]();}else{try{var _0x19d598=eval('('+_0x491adc['condition']+')');var _0x38c5b7=_0x19d598?_0x491adc['priorityTrue']:_0x491adc[_0xb7de('0x10')];logger[_0xb7de('0x11')](_0xb7de('0x12'),_0x30e4e7,_0x491adc['condition'],_0x19d598,_0x38c5b7||'next');if(_0x38c5b7){var _0x5f010b=_[_0xb7de('0x13')](_0x5e66ff[_0xb7de('0x14')](),{'p':_0x38c5b7});if(_0x5f010b>=0x0){logger[_0xb7de('0x11')](_0xb7de('0x15'),_0x30e4e7,_0x38c5b7||'next',_0x5f010b);_0x5e66ff[_0xb7de('0x16')](_0x5f010b);}else{logger[_0xb7de('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x30e4e7,_0x38c5b7||_0xb7de('0x16'));_0x5e66ff[_0xb7de('0xf')]();}}else{_0x5e66ff['next']();}}catch(_0x3ffc57){logger[_0xb7de('0xd')](_0xb7de('0x17'),_0x30e4e7,_0x3ffc57[_0xb7de('0x18')]);_0x5e66ff[_0xb7de('0xf')]();}}}catch(_0x3de380){logger['error'](_0xb7de('0x19'),_0x30e4e7,JSON[_0xb7de('0x1a')](_0x3de380));_0x5e66ff['stop']();}};}; \ No newline at end of file +var _0x899d=['number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number'];(function(_0x192a74,_0x4bb7cd){var _0x54f523=function(_0x2daf10){while(--_0x2daf10){_0x192a74['push'](_0x192a74['shift']());}};_0x54f523(++_0x4bb7cd);}(_0x899d,0x1c2));var _0xd899=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x899d[_0xfae23b];return _0x200640;};'use strict';var schema=require(_0xd899('0x0'));var _=require(_0xd899('0x1'));var htmlToText=require(_0xd899('0x2'));var utils=require(_0xd899('0x3'));var logger=require(_0xd899('0x4'))(_0xd899('0x5'));var gotoif=schema({'condition':{'type':_0xd899('0x6'),'required':!![],'message':_0xd899('0x7')},'priorityTrue':{'type':'number','message':_0xd899('0x8')},'priorityFalse':{'type':_0xd899('0x9'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xd899('0xa')]=function(_0x2e396e,_0x4dc778){return function(_0x44dc4e){try{var _0x383557={'condition':htmlToText[_0xd899('0xb')](utils[_0xd899('0xc')](_0x4dc778[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4dc778[0x1],'priorityFalse':_0x4dc778[0x2]};var _0x263220=gotoif[_0xd899('0x0')](_0x383557,{'typecast':!![]});if(_0x263220[_0xd899('0xd')]){logger[_0xd899('0xe')](_0xd899('0xf'),_0x2e396e,_[_0xd899('0x10')](_0x263220,_0xd899('0x11'))['join'](',\x20'));_0x44dc4e[_0xd899('0x12')]();}else{try{var _0x214446=eval('('+_0x383557[_0xd899('0x13')]+')');var _0x37735e=_0x214446?_0x383557[_0xd899('0x14')]:_0x383557['priorityFalse'];logger[_0xd899('0x15')](_0xd899('0x16'),_0x2e396e,_0x383557['condition'],_0x214446,_0x37735e||_0xd899('0x17'));if(_0x37735e){var _0xe7ad3d=_[_0xd899('0x18')](_0x44dc4e[_0xd899('0x19')](),{'p':_0x37735e});if(_0xe7ad3d>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2e396e,_0x37735e||'next',_0xe7ad3d);_0x44dc4e[_0xd899('0x17')](_0xe7ad3d);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2e396e,_0x37735e||_0xd899('0x17'));_0x44dc4e[_0xd899('0x12')]();}}else{_0x44dc4e[_0xd899('0x17')]();}}catch(_0x49480d){logger[_0xd899('0xe')](_0xd899('0x1a'),_0x2e396e,_0x49480d[_0xd899('0x11')]);_0x44dc4e['stop']();}}}catch(_0x46e77d){logger[_0xd899('0xe')](_0xd899('0xf'),_0x2e396e,JSON['stringify'](_0x46e77d));_0x44dc4e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 7de2bc5..8c77adb 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 _0x8624=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','stringify','validate','lodash','../../../../config/logger','number'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8624,0x95));var _0x4862=function(_0x3e37b3,_0x570305){_0x3e37b3=_0x3e37b3-0x0;var _0x47e724=_0x8624[_0x3e37b3];return _0x47e724;};'use strict';var schema=require(_0x4862('0x0'));var _=require(_0x4862('0x1'));var logger=require(_0x4862('0x2'))('routing');var gotop=schema({'priority':{'type':_0x4862('0x3'),'required':!![],'message':_0x4862('0x4')}});exports['consequence']=function(_0x56a4b0,_0x18fe4b){return function(_0x587162){try{var _0x2cccbc={'priority':_0x18fe4b[0x0]};var _0x494bff=gotop[_0x4862('0x0')](_0x2cccbc,{'typecast':!![]});if(_0x494bff[_0x4862('0x5')]){logger[_0x4862('0x6')](_0x4862('0x7'),_0x56a4b0,_[_0x4862('0x8')](_0x494bff,_0x4862('0x9'))['join'](',\x20'));_0x587162[_0x4862('0xa')]();}else{logger[_0x4862('0xb')](_0x4862('0xc'),_0x56a4b0,_0x2cccbc['priority']);if(_0x2cccbc[_0x4862('0xd')]){var _0x5310ba=_['findIndex'](_0x587162[_0x4862('0xe')](),{'p':_0x2cccbc[_0x4862('0xd')]});if(_0x5310ba>=0x0){logger[_0x4862('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x56a4b0,_0x2cccbc[_0x4862('0xd')]||_0x4862('0xf'),_0x5310ba);_0x587162[_0x4862('0xf')](_0x5310ba);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x56a4b0,_0x2cccbc[_0x4862('0xd')]||_0x4862('0xf'));_0x587162['stop']();}}else{_0x587162['next']();}}}catch(_0x4b7fc4){logger['error'](_0x4862('0x7'),_0x56a4b0,JSON[_0x4862('0x10')](_0x4b7fc4));_0x587162[_0x4862('0xa')]();}};}; \ No newline at end of file +var _0xe6af=['stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','map','message','join'];(function(_0x1427e9,_0x33c8f8){var _0x34edce=function(_0xbb40fa){while(--_0xbb40fa){_0x1427e9['push'](_0x1427e9['shift']());}};_0x34edce(++_0x33c8f8);}(_0xe6af,0x9d));var _0xfe6a=function(_0x31d9e5,_0x5ec033){_0x31d9e5=_0x31d9e5-0x0;var _0x41008a=_0xe6af[_0x31d9e5];return _0x41008a;};'use strict';var schema=require(_0xfe6a('0x0'));var _=require(_0xfe6a('0x1'));var logger=require(_0xfe6a('0x2'))(_0xfe6a('0x3'));var gotop=schema({'priority':{'type':_0xfe6a('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xfe6a('0x5')]=function(_0x1365ae,_0x4cab7b){return function(_0x3aa351){try{var _0x37ace5={'priority':_0x4cab7b[0x0]};var _0x340d3e=gotop[_0xfe6a('0x0')](_0x37ace5,{'typecast':!![]});if(_0x340d3e[_0xfe6a('0x6')]){logger[_0xfe6a('0x7')]('[%s][GOTOP]\x20%s',_0x1365ae,_[_0xfe6a('0x8')](_0x340d3e,_0xfe6a('0x9'))[_0xfe6a('0xa')](',\x20'));_0x3aa351[_0xfe6a('0xb')]();}else{logger[_0xfe6a('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x1365ae,_0x37ace5[_0xfe6a('0xd')]);if(_0x37ace5[_0xfe6a('0xd')]){var _0x4c551=_[_0xfe6a('0xe')](_0x3aa351[_0xfe6a('0xf')](),{'p':_0x37ace5[_0xfe6a('0xd')]});if(_0x4c551>=0x0){logger['info'](_0xfe6a('0x10'),_0x1365ae,_0x37ace5[_0xfe6a('0xd')]||'next',_0x4c551);_0x3aa351[_0xfe6a('0x11')](_0x4c551);}else{logger['info'](_0xfe6a('0x12'),_0x1365ae,_0x37ace5[_0xfe6a('0xd')]||_0xfe6a('0x11'));_0x3aa351[_0xfe6a('0xb')]();}}else{_0x3aa351['next']();}}}catch(_0x4a353b){logger[_0xfe6a('0x7')](_0xfe6a('0x13'),_0x1365ae,JSON[_0xfe6a('0x14')](_0x4a353b));_0x3aa351[_0xfe6a('0xb')]();}};}; \ 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 490853f..acde5c5 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 _0x9624=['[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','next','catch','error'];(function(_0x15fec1,_0x3684c1){var _0x5719e5=function(_0x4dd05c){while(--_0x4dd05c){_0x15fec1['push'](_0x15fec1['shift']());}};_0x5719e5(++_0x3684c1);}(_0x9624,0xc0));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4962('0x0'));var utils=require(_0x4962('0x1'));var logger=require(_0x4962('0x2'))(_0x4962('0x3'));var rpc={'chatMessage':require(_0x4962('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4962('0x5')),'smsMessage':require(_0x4962('0x6')),'faxMessage':require(_0x4962('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4962('0x8')]=function(_0x133128,_0x100ebc){return function(_0x3eb249){try{var _0x352f31={'body':utils[_0x4962('0x9')](_0x100ebc[0x0],this),'ContactId':this[_0x4962('0xa')]['id']};if(this[_0x4962('0xb')]==='chat'){_0x352f31[_0x4962('0xc')]=this[_0x4962('0xd')]['id'];}else{_0x352f31[_[_0x4962('0xe')](this['channel'])+'AccountId']=this[_0x4962('0xd')]['id'];}_0x352f31[_[_0x4962('0xe')](this[_0x4962('0xb')])+_0x4962('0xf')]=this[_0x4962('0x10')]['id'];if(rpc[this[_0x4962('0xb')]+_0x4962('0x11')]){return rpc[this[_0x4962('0xb')]+_0x4962('0x11')][_0x4962('0x12')](_0x352f31)[_0x4962('0x13')](function(_0x385f85){logger[_0x4962('0x14')]('[%s][MESSAGE]\x20%s',_0x133128,_0x352f31['body']);_0x3eb249[_0x4962('0x15')]();})[_0x4962('0x16')](function(_0x4c984a){logger[_0x4962('0x17')](_0x4962('0x18'),_0x133128,JSON[_0x4962('0x19')](_0x4c984a));_0x3eb249[_0x4962('0x1a')]();});}}catch(_0x291e69){logger[_0x4962('0x17')](_0x4962('0x18'),_0x133128,JSON[_0x4962('0x19')](_0x291e69));_0x3eb249[_0x4962('0x1a')]();}};}; \ No newline at end of file +var _0x4d11=['InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','account','AccountId','upperFirst'];(function(_0x2da3b0,_0x44ffed){var _0x14f347=function(_0x2edb49){while(--_0x2edb49){_0x2da3b0['push'](_0x2da3b0['shift']());}};_0x14f347(++_0x44ffed);}(_0x4d11,0x10f));var _0x14d1=function(_0x368c1d,_0x4683cd){_0x368c1d=_0x368c1d-0x0;var _0xface06=_0x4d11[_0x368c1d];return _0xface06;};'use strict';var _=require(_0x14d1('0x0'));var utils=require(_0x14d1('0x1'));var logger=require(_0x14d1('0x2'))(_0x14d1('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x14d1('0x4')),'mailMessage':require(_0x14d1('0x5')),'smsMessage':require(_0x14d1('0x6')),'faxMessage':require(_0x14d1('0x7')),'whatsappMessage':require(_0x14d1('0x8'))};exports['consequence']=function(_0x37537b,_0x269d89){return function(_0x23704b){try{var _0x4676a7={'body':utils[_0x14d1('0x9')](_0x269d89[0x0],this),'ContactId':this['contact']['id']};if(this[_0x14d1('0xa')]===_0x14d1('0xb')){_0x4676a7['ChatWebsiteId']=this[_0x14d1('0xc')]['id'];}else{_0x4676a7[_['upperFirst'](this['channel'])+_0x14d1('0xd')]=this[_0x14d1('0xc')]['id'];}_0x4676a7[_[_0x14d1('0xe')](this[_0x14d1('0xa')])+_0x14d1('0xf')]=this[_0x14d1('0x10')]['id'];if(rpc[this[_0x14d1('0xa')]+_0x14d1('0x11')]){return rpc[this[_0x14d1('0xa')]+_0x14d1('0x11')]['create'](_0x4676a7)['then'](function(_0x21421a){logger[_0x14d1('0x12')](_0x14d1('0x13'),_0x37537b,_0x4676a7[_0x14d1('0x14')]);_0x23704b[_0x14d1('0x15')]();})[_0x14d1('0x16')](function(_0x853226){logger[_0x14d1('0x17')](_0x14d1('0x13'),_0x37537b,JSON[_0x14d1('0x18')](_0x853226));_0x23704b[_0x14d1('0x19')]();});}}catch(_0xe851f9){logger[_0x14d1('0x17')](_0x14d1('0x13'),_0x37537b,JSON['stringify'](_0xe851f9));_0x23704b[_0x14d1('0x19')]();}};}; \ 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 48262f2..390b1e8 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 _0x1447=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger'];(function(_0x555aa9,_0x3a607f){var _0x20aecd=function(_0x28e2e9){while(--_0x28e2e9){_0x555aa9['push'](_0x555aa9['shift']());}};_0x20aecd(++_0x3a607f);}(_0x1447,0xb7));var _0x7144=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1447[_0x199572];return _0x13cfa3;};'use strict';var utils=require('./utils');var logger=require(_0x7144('0x0'))(_0x7144('0x1'));exports['consequence']=function(_0x18c634,_0x24d12e){return function(_0x28dc49){try{logger[_0x7144('0x2')](_0x7144('0x3'),_0x18c634,utils[_0x7144('0x4')](_0x24d12e[0x0],this));_0x28dc49[_0x7144('0x5')]();}catch(_0x78e332){logger[_0x7144('0x6')](_0x7144('0x3'),_0x18c634,JSON[_0x7144('0x7')](_0x78e332));_0x28dc49['stop']();}};}; \ No newline at end of file +var _0x6359=['getMustacheRender','next','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0xbac5cb,_0x1c8555){var _0x270c91=function(_0x5584f6){while(--_0x5584f6){_0xbac5cb['push'](_0xbac5cb['shift']());}};_0x270c91(++_0x1c8555);}(_0x6359,0xd3));var _0x9635=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6359[_0x19950b];return _0x3c6b41;};'use strict';var utils=require(_0x9635('0x0'));var logger=require('../../../../config/logger')(_0x9635('0x1'));exports[_0x9635('0x2')]=function(_0x22488c,_0x37c9ef){return function(_0x5dd723){try{logger[_0x9635('0x3')](_0x9635('0x4'),_0x22488c,utils[_0x9635('0x5')](_0x37c9ef[0x0],this));_0x5dd723[_0x9635('0x6')]();}catch(_0x2b0ef1){logger['error']('[%s][NOOP]\x20%s',_0x22488c,JSON[_0x9635('0x7')](_0x2b0ef1));_0x5dd723[_0x9635('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 00bca99..6ad2784 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 _0x67d0=['InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','push','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x67d0,0x1c7));var _0x067d=function(_0x36276d,_0x486003){_0x36276d=_0x36276d-0x0;var _0x56bf35=_0x67d0[_0x36276d];return _0x56bf35;};'use strict';var schema=require(_0x067d('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x067d('0x1'));var moment=require(_0x067d('0x2'));var Redis=require('ioredis');var config=require(_0x067d('0x3'));var logger=require(_0x067d('0x4'))(_0x067d('0x5'));var strategy=require('./strategy');config[_0x067d('0x6')]=_[_0x067d('0x7')](config['redis'],{'host':_0x067d('0x8'),'port':0x18eb});var io=require(_0x067d('0x9'))(new Redis(config[_0x067d('0x6')]));var attributes=['id',_0x067d('0xa'),_0x067d('0xb'),_0x067d('0xc'),'from',_0x067d('0xd')];function emit(_0x467aa8,_0x2f519b,_0x3ae5a0){io['to'](_0x467aa8)[_0x067d('0xe')](_0x2f519b,_0x3ae5a0);}function emitChannelQueueInteraction(_0x57a096,_0x51dcfa,_0x4d7fab,_0x30ee99,_0x55290a,_0x1d24f0,_0x3f70b1,_0x1839cf){var _0x468882=_[_0x067d('0xf')](_0x4d7fab);_0x468882[_0x067d('0xa')]=_0x1839cf;_0x468882['queue']=_0x51dcfa;_0x468882[_0x067d('0xb')]=_0x30ee99;_0x468882['id']=_0x55290a;if(_0x1d24f0){attributes[_0x067d('0x10')](_['capitalize'](_0x57a096)+'InteractionId');_0x3f70b1[util['format'](_0x067d('0x11'),_0x57a096)][_0x55290a]=_[_0x067d('0x12')](_0x468882,attributes);}else{delete _0x3f70b1[util[_0x067d('0x13')]('%sQueuesWaitingInteractions',_0x57a096)][_0x55290a];}emit(util['format']('%s:queue:%s',_0x57a096,_0x51dcfa),util[_0x067d('0x13')](_0x067d('0x14'),_0x57a096,_0x1d24f0?_0x067d('0x15'):'remove'),_[_0x067d('0x12')](_0x468882,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x067d('0x16')),'chatQueueReport':require(_0x067d('0x17')),'smsQueueReport':require(_0x067d('0x18')),'faxQueueReport':require(_0x067d('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x067d('0x1a')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x067d('0x1b')),'openchannelInteraction':require(_0x067d('0x1c')),'smsInteraction':require(_0x067d('0x1d')),'whatsappInteraction':require(_0x067d('0x1e'))};var queue=schema({'name':{'type':_0x067d('0x1f'),'required':!![],'message':_0x067d('0x20')},'timeout':{'type':_0x067d('0x21'),'message':_0x067d('0x22')}});function startRouting(_0x5c574f,_0x4e7d96,_0xd14075,_0x4bf972){if(_0x5c574f&&_0x4e7d96&&_0xd14075){_0x4e7d96[_0x067d('0x23')]+=0x1;var _0x4cd3de={'uniqueid':_0x5c574f,'from':_0xd14075[_0x067d('0x24')]?_0xd14075['body']['from']:'','joinAt':moment()['format'](_0x067d('0x25')),'ContactId':_0xd14075[_0x067d('0x26')]?_0xd14075[_0x067d('0x26')]['id']:null,'ListId':_0xd14075[_0x067d('0x27')]?_0xd14075[_0x067d('0x27')]['id']:null};_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+_0x067d('0x2a')]=_0x4e7d96['id']||null;_0x4cd3de[_['upperFirst'](_0xd14075['channel'])+_0x067d('0x2b')]=_0xd14075[_0x067d('0x2c')]?_0xd14075['interaction']['id']:null;_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+_0x067d('0x2d')]=_0xd14075[_0x067d('0x2e')]?_0xd14075[_0x067d('0x2e')]['id']:null;_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+(_0xd14075[_0x067d('0x29')]!==_0x067d('0x2f')?_0x067d('0x30'):_0x067d('0x31'))]=_0xd14075[_0x067d('0xb')]?_0xd14075[_0x067d('0xb')]['id']:null;logger[_0x067d('0x32')](util[_0x067d('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5c574f,_0x4e7d96[_0x067d('0x33')]));emitChannelQueueInteraction(_0xd14075[_0x067d('0x29')],_0x4e7d96[_0x067d('0x33')],_0x4cd3de,_0xd14075[_0x067d('0xb')][_0x067d('0x33')],_0xd14075[_0x067d('0x2e')]['id'],!![],_0x4bf972,_0x4e7d96['id']);if(rpc[_0xd14075[_0x067d('0x29')]+_0x067d('0x34')]){return rpc[_0xd14075[_0x067d('0x29')]+'QueueReport'][_0x067d('0x35')](_0x4cd3de)[_0x067d('0x36')](function(_0x15f9ec){logger[_0x067d('0x37')](_0x067d('0x38'),_0x15f9ec);});}}}function stopRouting(_0x2f1f24,_0x22018b,_0x13e1c6,_0x5665c0){if(_0x2f1f24&&_0x22018b){_0x22018b[_0x067d('0x23')]-=0x1;var _0x5b34bb={'leaveAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'acceptAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'reason':_0x067d('0x39')};logger[_0x067d('0x32')](util['format'](_0x067d('0x3a'),_0x2f1f24,_0x22018b[_0x067d('0x33')]));emitChannelQueueInteraction(_0x13e1c6['channel'],_0x22018b[_0x067d('0x33')],_0x13e1c6[_0x067d('0x24')],_0x13e1c6[_0x067d('0xb')]['name'],_0x13e1c6['message']['id'],![],_0x5665c0,_0x22018b['id']);return rpc[_0x13e1c6[_0x067d('0x29')]+_0x067d('0x3b')][_0x067d('0x3c')](_0x13e1c6[_0x067d('0x2c')]['id'],{'queueId':_0x22018b['id']})[_0x067d('0x3d')](function(){if(rpc[_0x13e1c6[_0x067d('0x29')]+'QueueReport']){return rpc[_0x13e1c6[_0x067d('0x29')]+_0x067d('0x34')][_0x067d('0x3c')](_0x2f1f24,_0x5b34bb)['catch'](function(_0x5a900f){logger[_0x067d('0x37')](_0x067d('0x3e'),_0x5a900f);});}});}}function endRouting(_0x265dea,_0x4f964a,_0x2cfea2,_0x451459){if(_0x265dea&&_0x4f964a){_0x4f964a[_0x067d('0x23')]-=0x1;var _0x3a1a38={'leaveAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'exitAt':moment()[_0x067d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x067d('0x3f')};logger[_0x067d('0x32')](util[_0x067d('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x265dea,_0x4f964a[_0x067d('0x33')]));emitChannelQueueInteraction(_0x2cfea2[_0x067d('0x29')],_0x4f964a[_0x067d('0x33')],_0x2cfea2['body'],_0x2cfea2[_0x067d('0xb')]['name'],_0x2cfea2[_0x067d('0x2e')]['id'],![],_0x451459);if(rpc[_0x2cfea2['channel']+'QueueReport']){return rpc[_0x2cfea2[_0x067d('0x29')]+_0x067d('0x34')][_0x067d('0x3c')](_0x265dea,_0x3a1a38)[_0x067d('0x36')](function(_0x291c3d){logger['error'](_0x067d('0x3e'),_0x291c3d);});}}}function handleFindQueue(_0x1109e1){return function(_0x403104){return _0x403104['name'][_0x067d('0x40')]()===_0x1109e1[_0x067d('0x40')]();};}exports[_0x067d('0x41')]=function(_0x3184ca,_0x422693,_0x30b269,_0x366392){return function(_0x1915e5){try{var _0x5e13c5={'name':_0x422693[0x0],'timeout':_0x422693[0x1]};var _0x141c6c=queue[_0x067d('0x0')](_0x5e13c5,{'typecast':!![]});if(_0x141c6c[_0x067d('0x42')]){logger[_0x067d('0x37')](_0x067d('0x43'),_0x3184ca,_[_0x067d('0x44')](_0x141c6c,_0x067d('0x2e'))[_0x067d('0x45')](',\x20'));_0x1915e5[_0x067d('0x46')]();}else{var _0x2b2b6e=_[_0x067d('0x47')](_0x30b269[_0x366392[_0x067d('0x29')]+'Queues'],handleFindQueue(_0x5e13c5[_0x067d('0x33')]));if(_0x2b2b6e){startRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);var _0x1d4fd8=(_0x2b2b6e[_0x067d('0x3f')]||0xa)*0x3e8;var _0x129adc=(_0x5e13c5['timeout']||0x14)*0x3e8;var _0x39595d;if(_0x1d4fd8>_0x129adc){_0x129adc=_0x1d4fd8;}var _0x2b996a=seqqueue[_0x067d('0x48')](_0x1d4fd8);_0x2b996a['id']=_0x3184ca;_0x2b996a['atimeout']=_0x1d4fd8;_0x2b996a[_0x067d('0x49')]=_0x129adc;_0x2b996a[_0x067d('0x29')]=_0x366392[_0x067d('0x29')];_0x30b269[_0x067d('0x4a')][_0x3184ca]['on'](_0x067d('0x4b'),function(){logger[_0x067d('0x32')](_0x067d('0x4c'),_0x3184ca);stopRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);clearTimeout(_0x39595d);_0x39595d=undefined;_0x2b996a['close'](!![]);if(_0x30b269['rules'][_0x3184ca]){delete _0x30b269[_0x067d('0x4a')][_0x3184ca];}_0x1915e5[_0x067d('0x46')]();});_0x30b269[_0x067d('0x4a')][_0x3184ca]['on']('complete',function(){if(_0x30b269['rules'][_0x3184ca]){delete _0x30b269[_0x067d('0x4a')][_0x3184ca];}});_0x39595d=setTimeout(function(){logger[_0x067d('0x32')](_0x067d('0x4d'),_0x3184ca);endRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);clearTimeout(_0x39595d);_0x2b996a['close'](!![]);_0x1915e5['next']();},_0x129adc);switch(_0x2b2b6e[_0x067d('0x4e')]){case'rrmemory':strategy[_0x067d('0x4f')](_0x2b996a,_0x2b2b6e,_0x30b269,_0x366392);break;default:strategy[_0x067d('0x50')](_0x2b996a,_0x2b2b6e,_0x30b269,_0x366392);}}else{logger[_0x067d('0x37')](_0x067d('0x51'),_0x3184ca,_0x5e13c5[_0x067d('0x33')]);_0x1915e5[_0x067d('0x46')]();}}}catch(_0x334063){logger[_0x067d('0x37')](_0x067d('0x43'),_0x3184ca,_0x334063[_0x067d('0x52')]);_0x1915e5[_0x067d('0x46')]();}};}; \ No newline at end of file +var _0xe649=['map','join','find','Queues','createQueue','atimeout','qtimeout','rules','end','close','stop','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','socket.io-emitter','account','from','joinAt','emit','clone','queue','push','capitalize','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update\x20queue\x20report','timeout','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xe649,0x6b));var _0x9e64=function(_0x5133c2,_0x49fa51){_0x5133c2=_0x5133c2-0x0;var _0x55b197=_0xe649[_0x5133c2];return _0x55b197;};'use strict';var schema=require(_0x9e64('0x0'));var _=require(_0x9e64('0x1'));var util=require(_0x9e64('0x2'));var seqqueue=require(_0x9e64('0x3'));var moment=require(_0x9e64('0x4'));var Redis=require(_0x9e64('0x5'));var config=require(_0x9e64('0x6'));var logger=require(_0x9e64('0x7'))(_0x9e64('0x8'));var strategy=require(_0x9e64('0x9'));config['redis']=_[_0x9e64('0xa')](config[_0x9e64('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x9e64('0xc'))(new Redis(config[_0x9e64('0xb')]));var attributes=['id','queue_id',_0x9e64('0xd'),'queue',_0x9e64('0xe'),_0x9e64('0xf')];function emit(_0x4d93c5,_0x4e773b,_0x78514d){io['to'](_0x4d93c5)[_0x9e64('0x10')](_0x4e773b,_0x78514d);}function emitChannelQueueInteraction(_0x247aa4,_0x321ab9,_0x418fc1,_0x17b0b8,_0x23fcd7,_0x187229,_0x2b4e75,_0xcb84e6){var _0x157069=_[_0x9e64('0x11')](_0x418fc1);_0x157069['queue_id']=_0xcb84e6;_0x157069[_0x9e64('0x12')]=_0x321ab9;_0x157069[_0x9e64('0xd')]=_0x17b0b8;_0x157069['id']=_0x23fcd7;if(_0x187229){attributes[_0x9e64('0x13')](_[_0x9e64('0x14')](_0x247aa4)+'InteractionId');_0x2b4e75[util['format'](_0x9e64('0x15'),_0x247aa4)][_0x23fcd7]=_['pick'](_0x157069,attributes);}else{delete _0x2b4e75[util[_0x9e64('0x16')](_0x9e64('0x15'),_0x247aa4)][_0x23fcd7];}emit(util[_0x9e64('0x16')](_0x9e64('0x17'),_0x247aa4,_0x321ab9),util['format'](_0x9e64('0x18'),_0x247aa4,_0x187229?_0x9e64('0x19'):'remove'),_[_0x9e64('0x1a')](_0x157069,attributes));}var rpc={'openchannelQueueReport':require(_0x9e64('0x1b')),'mailQueueReport':require(_0x9e64('0x1c')),'chatQueueReport':require(_0x9e64('0x1d')),'smsQueueReport':require(_0x9e64('0x1e')),'faxQueueReport':require(_0x9e64('0x1f')),'whatsappQueueReport':require(_0x9e64('0x20')),'chatInteraction':require(_0x9e64('0x21')),'faxInteraction':require(_0x9e64('0x22')),'mailInteraction':require(_0x9e64('0x23')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x9e64('0x24'))};var queue=schema({'name':{'type':_0x9e64('0x25'),'required':!![],'message':_0x9e64('0x26')},'timeout':{'type':'number','message':_0x9e64('0x27')}});function startRouting(_0x34d708,_0x4cdcb3,_0x540e80,_0x6cdd1b){if(_0x34d708&&_0x4cdcb3&&_0x540e80){_0x4cdcb3[_0x9e64('0x28')]+=0x1;var _0x4ed303={'uniqueid':_0x34d708,'from':_0x540e80[_0x9e64('0x29')]?_0x540e80[_0x9e64('0x29')][_0x9e64('0xe')]:'','joinAt':moment()['format'](_0x9e64('0x2a')),'ContactId':_0x540e80[_0x9e64('0x2b')]?_0x540e80[_0x9e64('0x2b')]['id']:null,'ListId':_0x540e80['list']?_0x540e80[_0x9e64('0x2c')]['id']:null};_0x4ed303[_[_0x9e64('0x2d')](_0x540e80[_0x9e64('0x2e')])+'QueueId']=_0x4cdcb3['id']||null;_0x4ed303[_[_0x9e64('0x2d')](_0x540e80['channel'])+_0x9e64('0x2f')]=_0x540e80[_0x9e64('0x30')]?_0x540e80['interaction']['id']:null;_0x4ed303[_[_0x9e64('0x2d')](_0x540e80[_0x9e64('0x2e')])+_0x9e64('0x31')]=_0x540e80['message']?_0x540e80[_0x9e64('0x32')]['id']:null;_0x4ed303[_[_0x9e64('0x2d')](_0x540e80[_0x9e64('0x2e')])+(_0x540e80['channel']!==_0x9e64('0x33')?'AccountId':'WebsiteId')]=_0x540e80[_0x9e64('0xd')]?_0x540e80['account']['id']:null;logger['info'](util[_0x9e64('0x16')](_0x9e64('0x34'),_0x34d708,_0x4cdcb3[_0x9e64('0x35')]));emitChannelQueueInteraction(_0x540e80['channel'],_0x4cdcb3['name'],_0x4ed303,_0x540e80['account'][_0x9e64('0x35')],_0x540e80[_0x9e64('0x32')]['id'],!![],_0x6cdd1b,_0x4cdcb3['id']);if(rpc[_0x540e80[_0x9e64('0x2e')]+'QueueReport']){return rpc[_0x540e80[_0x9e64('0x2e')]+_0x9e64('0x36')][_0x9e64('0x37')](_0x4ed303)[_0x9e64('0x38')](function(_0xbdf578){logger[_0x9e64('0x39')](_0x9e64('0x3a'),_0xbdf578);});}}}function stopRouting(_0x39c2bc,_0x19a671,_0xea6c67,_0x3c6df7){if(_0x39c2bc&&_0x19a671){_0x19a671['waiting']-=0x1;var _0x19d69c={'leaveAt':moment()[_0x9e64('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x9e64('0x2a')),'reason':_0x9e64('0x3b')};logger[_0x9e64('0x3c')](util[_0x9e64('0x16')](_0x9e64('0x3d'),_0x39c2bc,_0x19a671[_0x9e64('0x35')]));emitChannelQueueInteraction(_0xea6c67[_0x9e64('0x2e')],_0x19a671[_0x9e64('0x35')],_0xea6c67['body'],_0xea6c67[_0x9e64('0xd')][_0x9e64('0x35')],_0xea6c67[_0x9e64('0x32')]['id'],![],_0x3c6df7,_0x19a671['id']);return rpc[_0xea6c67['channel']+_0x9e64('0x3e')]['update'](_0xea6c67[_0x9e64('0x30')]['id'],{'queueId':_0x19a671['id']})[_0x9e64('0x3f')](function(){if(rpc[_0xea6c67[_0x9e64('0x2e')]+_0x9e64('0x36')]){return rpc[_0xea6c67[_0x9e64('0x2e')]+'QueueReport']['update'](_0x39c2bc,_0x19d69c)[_0x9e64('0x38')](function(_0x1dc88c){logger[_0x9e64('0x39')](_0x9e64('0x40'),_0x1dc88c);});}});}}function endRouting(_0x22864b,_0x5b109d,_0xf3c5ce,_0x455977){if(_0x22864b&&_0x5b109d){_0x5b109d[_0x9e64('0x28')]-=0x1;var _0x4cb192={'leaveAt':moment()[_0x9e64('0x16')](_0x9e64('0x2a')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9e64('0x41')};logger[_0x9e64('0x3c')](util[_0x9e64('0x16')]('[%s][END:QUEUE][NAME:%s]',_0x22864b,_0x5b109d[_0x9e64('0x35')]));emitChannelQueueInteraction(_0xf3c5ce[_0x9e64('0x2e')],_0x5b109d[_0x9e64('0x35')],_0xf3c5ce[_0x9e64('0x29')],_0xf3c5ce[_0x9e64('0xd')][_0x9e64('0x35')],_0xf3c5ce[_0x9e64('0x32')]['id'],![],_0x455977);if(rpc[_0xf3c5ce['channel']+'QueueReport']){return rpc[_0xf3c5ce[_0x9e64('0x2e')]+_0x9e64('0x36')][_0x9e64('0x42')](_0x22864b,_0x4cb192)[_0x9e64('0x38')](function(_0x3cff50){logger[_0x9e64('0x39')](_0x9e64('0x40'),_0x3cff50);});}}}function handleFindQueue(_0x1fd1c9){return function(_0x47ae34){return _0x47ae34[_0x9e64('0x35')][_0x9e64('0x43')]()===_0x1fd1c9[_0x9e64('0x43')]();};}exports[_0x9e64('0x44')]=function(_0x20cdd5,_0x1aa8d6,_0x315406,_0x39ac8f){return function(_0x24ceff){try{var _0x24cfb2={'name':_0x1aa8d6[0x0],'timeout':_0x1aa8d6[0x1]};var _0x5adec4=queue[_0x9e64('0x0')](_0x24cfb2,{'typecast':!![]});if(_0x5adec4[_0x9e64('0x45')]){logger['error'](_0x9e64('0x46'),_0x20cdd5,_[_0x9e64('0x47')](_0x5adec4,_0x9e64('0x32'))[_0x9e64('0x48')](',\x20'));_0x24ceff['stop']();}else{var _0x40f289=_[_0x9e64('0x49')](_0x315406[_0x39ac8f[_0x9e64('0x2e')]+_0x9e64('0x4a')],handleFindQueue(_0x24cfb2['name']));if(_0x40f289){startRouting(_0x20cdd5,_0x40f289,_0x39ac8f,_0x315406);var _0x3ba64f=(_0x40f289[_0x9e64('0x41')]||0xa)*0x3e8;var _0xf07b05=(_0x24cfb2['timeout']||0x14)*0x3e8;var _0x201b3b;if(_0x3ba64f>_0xf07b05){_0xf07b05=_0x3ba64f;}var _0x193745=seqqueue[_0x9e64('0x4b')](_0x3ba64f);_0x193745['id']=_0x20cdd5;_0x193745[_0x9e64('0x4c')]=_0x3ba64f;_0x193745[_0x9e64('0x4d')]=_0xf07b05;_0x193745[_0x9e64('0x2e')]=_0x39ac8f[_0x9e64('0x2e')];_0x315406[_0x9e64('0x4e')][_0x20cdd5]['on'](_0x9e64('0x4f'),function(){logger[_0x9e64('0x3c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x20cdd5);stopRouting(_0x20cdd5,_0x40f289,_0x39ac8f,_0x315406);clearTimeout(_0x201b3b);_0x201b3b=undefined;_0x193745[_0x9e64('0x50')](!![]);if(_0x315406[_0x9e64('0x4e')][_0x20cdd5]){delete _0x315406[_0x9e64('0x4e')][_0x20cdd5];}_0x24ceff[_0x9e64('0x51')]();});_0x315406['rules'][_0x20cdd5]['on'](_0x9e64('0x52'),function(){if(_0x315406[_0x9e64('0x4e')][_0x20cdd5]){delete _0x315406['rules'][_0x20cdd5];}});_0x201b3b=setTimeout(function(){logger[_0x9e64('0x3c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x20cdd5);endRouting(_0x20cdd5,_0x40f289,_0x39ac8f,_0x315406);clearTimeout(_0x201b3b);_0x193745[_0x9e64('0x50')](!![]);_0x24ceff[_0x9e64('0x53')]();},_0xf07b05);switch(_0x40f289[_0x9e64('0x54')]){case'rrmemory':strategy[_0x9e64('0x55')](_0x193745,_0x40f289,_0x315406,_0x39ac8f);break;default:strategy[_0x9e64('0x56')](_0x193745,_0x40f289,_0x315406,_0x39ac8f);}}else{logger[_0x9e64('0x39')](_0x9e64('0x57'),_0x20cdd5,_0x24cfb2['name']);_0x24ceff['stop']();}}}catch(_0x1899bb){logger[_0x9e64('0x39')](_0x9e64('0x46'),_0x20cdd5,_0x1899bb[_0x9e64('0x58')]);_0x24ceff[_0x9e64('0x51')]();}};}; \ 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 0b6dfd3..8d1d45a 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 _0x0fda=['lodash','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports'];(function(_0xe2b3bf,_0x8f706e){var _0x2ae4d3=function(_0x5b962b){while(--_0x5b962b){_0xe2b3bf['push'](_0xe2b3bf['shift']());}};_0x2ae4d3(++_0x8f706e);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x23b272,_0x452586){_0x23b272=_0x23b272-0x0;var _0x42df3b=_0x0fda[_0x23b272];return _0x42df3b;};'use strict';var _=require(_0xa0fd('0x0'));var uuid=require('uuid');var util=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var Agent=function(_0x2f71f3,_0x426242,_0xd8e73a,_0x13c734){this['notificationId']=uuid['v4']();this['squeue']=_0x2f71f3;this[_0xa0fd('0x4')]=_0x426242;this['realtime']=_0xd8e73a;this['routing']=_0x13c734;this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')][_0xa0fd('0x8')](this),this['handleTimeout'][_0xa0fd('0x8')](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0x9'),this[_0xa0fd('0xa')]['bind'](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0xb'),this[_0xa0fd('0xc')]['bind'](this));};Agent[_0xa0fd('0xd')][_0xa0fd('0x6')]=function(){this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')]['bind'](this),this['handleTimeout'][_0xa0fd('0x8')](this));};Agent[_0xa0fd('0xd')]['handleDrained']=function(){this[_0xa0fd('0xa')](!![]);};Agent[_0xa0fd('0xd')][_0xa0fd('0x7')]=function(){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);if(_['isNil'](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){logger['debug'](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}else{if(this[_0xa0fd('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],this[_0xa0fd('0x5')][_0xa0fd('0x13')],![])){this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']]['busy']=!![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util[_0xa0fd('0x15')](this[_0xa0fd('0x10')],this[_0xa0fd('0x3')],this[_0xa0fd('0x4')],this[_0xa0fd('0x5')][_0xa0fd('0x13')]);util[_0xa0fd('0x16')](this[_0xa0fd('0x17')],this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],null,this['routing']);util[_0xa0fd('0x18')](this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],_0xa0fd('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xa0fd('0x1a'),this['squeue']['id'],this[_0xa0fd('0x4')]['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}}};Agent['prototype'][_0xa0fd('0xa')]=function(_0x19c352){if(_[_0xa0fd('0x1b')](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){return logger[_0xa0fd('0xe')](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);}else{logger['debug'](_0xa0fd('0x1c'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],null,this['routing']);this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x1d')]=![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util['removeWaitingNotification'](this[_0xa0fd('0x10')],this['routing'],this[_0xa0fd('0x4')],this['squeue']['channel']);util[_0xa0fd('0x18')](this['squeue']['id'],this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],_0x19c352?_0xa0fd('0x1e'):'TIMEOUT');}if(!_0x19c352){setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}};function agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2){return new Agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2);}module[_0xa0fd('0x1f')]=agent; \ No newline at end of file +var _0x99e9=['prototype','handleRun','debug','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','notificationId','RINGING','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','writeLog','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','squeue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x4752ec,_0x221e82){var _0x314959=function(_0x520556){while(--_0x520556){_0x4752ec['push'](_0x4752ec['shift']());}};_0x314959(++_0x221e82);}(_0x99e9,0xb4));var _0x999e=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0x99e9[_0xe7d561];return _0x4c27f0;};'use strict';var _=require('lodash');var uuid=require(_0x999e('0x0'));var util=require(_0x999e('0x1'));var logger=require(_0x999e('0x2'))(_0x999e('0x3'));var Agent=function(_0x4aaeb4,_0x19a818,_0x2f803e,_0x3aac27){this['notificationId']=uuid['v4']();this[_0x999e('0x4')]=_0x4aaeb4;this['agent']=_0x19a818;this[_0x999e('0x5')]=_0x2f803e;this[_0x999e('0x3')]=_0x3aac27;this[_0x999e('0x4')][_0x999e('0x6')](this['handleRun'][_0x999e('0x7')](this),this[_0x999e('0x8')][_0x999e('0x7')](this));this[_0x999e('0x4')]['on'](_0x999e('0x9'),this[_0x999e('0x8')][_0x999e('0x7')](this));this[_0x999e('0x4')]['on'](_0x999e('0xa'),this[_0x999e('0xb')][_0x999e('0x7')](this));};Agent[_0x999e('0xc')][_0x999e('0x6')]=function(){this[_0x999e('0x4')][_0x999e('0x6')](this[_0x999e('0xd')][_0x999e('0x7')](this),this['handleTimeout'][_0x999e('0x7')](this));};Agent['prototype'][_0x999e('0xb')]=function(){this[_0x999e('0x8')](!![]);};Agent[_0x999e('0xc')]['handleRun']=function(){logger[_0x999e('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x999e('0x4')]['id'],this['agent']['id']);if(_['isNil'](this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']])){logger[_0x999e('0xe')](_0x999e('0x11'),this[_0x999e('0x4')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x999e('0x3')][_0x999e('0x12')]||util[_0x999e('0x13')](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']],this['squeue'][_0x999e('0x14')],![])){this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']][_0x999e('0x15')]=!![];this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']][_0x999e('0x16')]=undefined;util[_0x999e('0x17')](this[_0x999e('0x5')],this['routing'],this['agent'],this[_0x999e('0x4')][_0x999e('0x14')]);util['showNotification'](this[_0x999e('0x18')],this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']],null,this[_0x999e('0x3')]);util['writeLog'](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']],_0x999e('0x19')+(this[_0x999e('0x3')][_0x999e('0x12')]?':FORCED':''));}else{logger[_0x999e('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x999e('0x10')]['id']);setTimeout(this[_0x999e('0x6')][_0x999e('0x7')](this),0x3e8);}}};Agent['prototype'][_0x999e('0x8')]=function(_0x28f7ba){if(_[_0x999e('0x1a')](this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']])){return logger[_0x999e('0xe')](_0x999e('0x11'),this[_0x999e('0x4')]['id'],this[_0x999e('0x10')]['id']);}else{logger['debug'](_0x999e('0x1b'),this[_0x999e('0x4')]['id'],this[_0x999e('0x10')]['id']);util['hideNotification'](this[_0x999e('0x18')],this['squeue']['id'],this['realtime'][_0x999e('0xf')][this[_0x999e('0x10')]['id']],null,this['routing']);this['realtime'][_0x999e('0xf')][this[_0x999e('0x10')]['id']][_0x999e('0x15')]=![];this[_0x999e('0x5')]['agents'][this[_0x999e('0x10')]['id']][_0x999e('0x16')]=undefined;util[_0x999e('0x1c')](this[_0x999e('0x5')],this['routing'],this['agent'],this[_0x999e('0x4')]['channel']);util[_0x999e('0x1d')](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']],_0x28f7ba?_0x999e('0x1e'):_0x999e('0x1f'));}if(!_0x28f7ba){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x327866,_0x4aa98c,_0xa0c150,_0x5dac45){return new Agent(_0x327866,_0x4aa98c,_0xa0c150,_0x5dac45);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 10e8c95..d3da8c8 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 _0xc6ba=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil','Agents','length','realtime','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY'];(function(_0x37dc21,_0x2bae86){var _0x34dc9e=function(_0x351e38){while(--_0x351e38){_0x37dc21['push'](_0x37dc21['shift']());}};_0x34dc9e(++_0x2bae86);}(_0xc6ba,0xfa));var _0xac6b=function(_0xaf292,_0x31e428){_0xaf292=_0xaf292-0x0;var _0x6f52c=_0xc6ba[_0xaf292];return _0x6f52c;};'use strict';var _=require('lodash');var uuid=require(_0xac6b('0x0'));var util=require(_0xac6b('0x1'));var logger=require(_0xac6b('0x2'))(_0xac6b('0x3'));var Beepall=function(_0x3ff024,_0x15bb20,_0x2847e3,_0x4dfe6d){this[_0xac6b('0x4')]=uuid['v4']();this[_0xac6b('0x5')]=_0x3ff024;this[_0xac6b('0x6')]=_0x15bb20;this['realtime']=_0x2847e3;this[_0xac6b('0x3')]=_0x4dfe6d;this[_0xac6b('0x5')][_0xac6b('0x7')](this[_0xac6b('0x8')][_0xac6b('0x9')](this),this[_0xac6b('0xa')][_0xac6b('0x9')](this));this[_0xac6b('0x5')]['on']('timeout',this['handleTimeout'][_0xac6b('0x9')](this));this[_0xac6b('0x5')]['on'](_0xac6b('0xb'),this['handleDrained'][_0xac6b('0x9')](this));};Beepall[_0xac6b('0xc')][_0xac6b('0x7')]=function(){this[_0xac6b('0x5')][_0xac6b('0x7')](this[_0xac6b('0x8')][_0xac6b('0x9')](this),this[_0xac6b('0xa')][_0xac6b('0x9')](this));};Beepall[_0xac6b('0xc')][_0xac6b('0xd')]=function(){this[_0xac6b('0xa')](!![]);};Beepall[_0xac6b('0xc')][_0xac6b('0x8')]=function(){var _0x4d893d=!![];if(!_[_0xac6b('0xe')](this['queue'])&&!_[_0xac6b('0xe')](this[_0xac6b('0x6')][_0xac6b('0xf')])&&this[_0xac6b('0x6')][_0xac6b('0xf')][_0xac6b('0x10')]>0x0){for(var _0x1c1205=0x0,_0x14dc91;_0x1c12050x0){for(var _0x187b7d=0x0,_0x57b855;_0x187b7d0x0&&_0x26f49a[_0x27032e+_0x35a9('0x21')]>=_0x26f49a[_0x27032e+_0x35a9('0x20')]){writeLog(_0x2bf9ce,_0x26f49a,_0x27032e[_0x35a9('0x22')]()+_0x35a9('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x484212,_0x5dfc9f,_0x2de1e4,_0x555746,_0x3119a6){return sendNotification(!![],_0x484212,_0x5dfc9f,_0x2de1e4,_0x555746,_0x3119a6);};exports[_0x35a9('0x24')]=function(_0x5e3631,_0x22835a,_0x4cd0b3,_0x1fc384,_0x42b5bd){return sendNotification(![],_0x5e3631,_0x22835a,_0x4cd0b3,_0x1fc384,_0x42b5bd);};exports['checkWaitingNotifications']=function(_0x534455,_0x16ee46,_0x207444){var _0x3f90fa=_0x16ee46[_0x35a9('0x25')][_0x35a9('0x26')];if(!_0x3f90fa&&_0x207444){_0x3f90fa=_0x207444['id'];}var _0x15ac13=_[_0x35a9('0x27')](_0x534455[_0x16ee46[_0x35a9('0x28')]+'QueuesWaitingInteractions'],function(_0x39fa5a){var _0x23abfd=_[_0x35a9('0x29')](_0x16ee46[_0x35a9('0x28')])+_0x35a9('0x2a');return _0x39fa5a[_0x23abfd]===_0x16ee46[_0x35a9('0x25')]['id'];});if(!_0x15ac13&&_0x3f90fa&&_0x534455['agents'][_0x3f90fa]){_0x15ac13=_[_0x35a9('0x27')](_0x534455[_0x35a9('0x2b')][_0x3f90fa][_0x16ee46[_0x35a9('0x28')]+'WaitingInteractions'],function(_0x37bd4c){return _0x37bd4c['id']===_0x16ee46['interaction']['id'];});}return _0x15ac13;};exports[_0x35a9('0x2c')]=function(_0x40ea7a,_0xd53b5d,_0xc07d46,_0x1445f1){if(_0xc07d46&&_0xc07d46['id']&&_0x40ea7a[_0x35a9('0x2b')]&&_0x40ea7a['agents'][_0xc07d46['id']]){_0x40ea7a['agents'][_0xc07d46['id']][_0x1445f1+_0x35a9('0x2d')][_0xd53b5d[_0x35a9('0x15')]['id']]={'id':_0xd53b5d['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x294cfb,_0x569f7f,_0x5d4504,_0x58831e){if(_0x5d4504&&_0x5d4504['id']&&_0x294cfb[_0x35a9('0x2b')]&&_0x294cfb[_0x35a9('0x2b')][_0x5d4504['id']]){delete _0x294cfb['agents'][_0x5d4504['id']][_0x58831e+_0x35a9('0x2d')][_0x569f7f[_0x35a9('0x15')]['id']];}};exports[_0x35a9('0x2e')]=writeLog; \ No newline at end of file +var _0xb7cf=['redis','defaults','localhost','socket.io-emitter','format','name','emit','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','isAgentAvailable','busy','BUSY','online','Pause','Capacity','hasOwnProperty','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing'];(function(_0x19fe68,_0x349dc6){var _0x26aae0=function(_0x398ff3){while(--_0x398ff3){_0x19fe68['push'](_0x19fe68['shift']());}};_0x26aae0(++_0x349dc6);}(_0xb7cf,0xca));var _0xfb7c=function(_0x45d9bb,_0x2c0350){_0x45d9bb=_0x45d9bb-0x0;var _0x1a36e9=_0xb7cf[_0x45d9bb];return _0x1a36e9;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var utils=require(_0xfb7c('0x2'));var Redis=require(_0xfb7c('0x3'));var config=require(_0xfb7c('0x4'));var logger=require('../../../../../config/logger')(_0xfb7c('0x5'));config[_0xfb7c('0x6')]=_[_0xfb7c('0x7')](config[_0xfb7c('0x6')],{'host':_0xfb7c('0x8'),'port':0x18eb});var io=require(_0xfb7c('0x9'))(new Redis(config[_0xfb7c('0x6')]));function sendNotification(_0x135394,_0x41dcce,_0x2fd757,_0x3c21f3,_0x34b889,_0x289874){io['to'](util[_0xfb7c('0xa')]('user:%s',_0x3c21f3[_0xfb7c('0xb')]))[_0xfb7c('0xc')](_0xfb7c('0xd'),_0x3c21f3);var _0x577d42=_0x289874||{};var _0x595834=_0x2fd757['split']('.');var _0x4f0696={'uniqueid':_0x41dcce,'channel':_0x595834[0x0],'id':_0x595834[0x1],'title':_0x595834[0x0]+_0xfb7c('0xe'),'interactionId':_0x595834[0x2],'queue':_0x34b889?_0x34b889[_0xfb7c('0xb')]:null,'sound':_0x577d42[_0xfb7c('0xf')][_0xfb7c('0x10')],'shake':_0x577d42[_0xfb7c('0xf')][_0xfb7c('0x11')]};try{if(!_0x577d42[_0xfb7c('0x12')]){_0x577d42[_0xfb7c('0x12')]={};}if(_0x34b889){_0x577d42['body'][_0xfb7c('0x13')]=_0x34b889;}else if(_0x577d42[_0xfb7c('0x12')]['queue']){delete _0x577d42[_0xfb7c('0x12')][_0xfb7c('0x13')];}_0x4f0696[_0xfb7c('0x14')]=utils[_0xfb7c('0x15')](_0x577d42[_0xfb7c('0xf')][_0xfb7c('0x16')],_0x577d42);}catch(_0x536122){_0x4f0696['msg']=_0xfb7c('0x17');logger['error'](util[_0xfb7c('0xa')](_0xfb7c('0x18'),_0x41dcce,_0x536122[_0xfb7c('0x19')]));}io['to'](util[_0xfb7c('0xa')]('user:%s',_0x3c21f3[_0xfb7c('0xb')]))['emit'](util[_0xfb7c('0xa')](_0xfb7c('0x1a'),_0x135394?_0xfb7c('0x1b'):_0xfb7c('0x1c')),_0x4f0696);}function writeLog(_0x442c13,_0xb03af5,_0x4745f5){return logger['debug'](util[_0xfb7c('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x442c13,_0xb03af5[_0xfb7c('0xb')],_0x4745f5));}exports[_0xfb7c('0x1d')]=function(_0x8984cc,_0x286d25,_0x2f84ed,_0xe5caf1){if(_0x286d25[_0xfb7c('0x1e')]){writeLog(_0x8984cc,_0x286d25,_0xfb7c('0x1f'));return![];}if(!_0x286d25[_0xfb7c('0x20')]){writeLog(_0x8984cc,_0x286d25,'OFFLINE');return![];}if(_0x286d25[_0x2f84ed+_0xfb7c('0x21')]){writeLog(_0x8984cc,_0x286d25,'PAUSE');return![];}if(_0xe5caf1&&_0x286d25['hasOwnProperty'](_0x2f84ed+_0xfb7c('0x22'))&&_0x286d25[_0xfb7c('0x23')](_0x2f84ed+'CurrentCapacity')){if(_0x286d25[_0x2f84ed+_0xfb7c('0x22')]>0x0&&_0x286d25[_0x2f84ed+'CurrentCapacity']>=_0x286d25[_0x2f84ed+'Capacity']){writeLog(_0x8984cc,_0x286d25,_0x2f84ed[_0xfb7c('0x24')]()+_0xfb7c('0x25'));return![];}}return!![];};exports[_0xfb7c('0x26')]=function(_0x33b5db,_0x7a795,_0x39dbc7,_0x32a707,_0x294f37){return sendNotification(!![],_0x33b5db,_0x7a795,_0x39dbc7,_0x32a707,_0x294f37);};exports['hideNotification']=function(_0x29ed81,_0x249418,_0x561d3a,_0x57d4a2,_0x5d0824){return sendNotification(![],_0x29ed81,_0x249418,_0x561d3a,_0x57d4a2,_0x5d0824);};exports[_0xfb7c('0x27')]=function(_0x4d3029,_0x4a423a,_0x5c779d){var _0x10e338=_0x4a423a[_0xfb7c('0x28')][_0xfb7c('0x29')];if(!_0x10e338&&_0x5c779d){_0x10e338=_0x5c779d['id'];}var _0x2f1a20=_[_0xfb7c('0x2a')](_0x4d3029[_0x4a423a[_0xfb7c('0x2b')]+_0xfb7c('0x2c')],function(_0x25e1d7){var _0x29a21e=_[_0xfb7c('0x2d')](_0x4a423a[_0xfb7c('0x2b')])+_0xfb7c('0x2e');return _0x25e1d7[_0x29a21e]===_0x4a423a[_0xfb7c('0x28')]['id'];});if(!_0x2f1a20&&_0x10e338&&_0x4d3029['agents'][_0x10e338]){_0x2f1a20=_[_0xfb7c('0x2a')](_0x4d3029[_0xfb7c('0x2f')][_0x10e338][_0x4a423a[_0xfb7c('0x2b')]+_0xfb7c('0x30')],function(_0x139f15){return _0x139f15['id']===_0x4a423a[_0xfb7c('0x28')]['id'];});}return _0x2f1a20;};exports[_0xfb7c('0x31')]=function(_0x872367,_0x568372,_0x5cac22,_0x598a95){if(_0x5cac22&&_0x5cac22['id']&&_0x872367[_0xfb7c('0x2f')]&&_0x872367[_0xfb7c('0x2f')][_0x5cac22['id']]){_0x872367[_0xfb7c('0x2f')][_0x5cac22['id']][_0x598a95+_0xfb7c('0x30')][_0x568372[_0xfb7c('0x19')]['id']]={'id':_0x568372[_0xfb7c('0x28')]['id']};}};exports[_0xfb7c('0x32')]=function(_0x1b3528,_0x571b62,_0x16b57a,_0x15461c){if(_0x16b57a&&_0x16b57a['id']&&_0x1b3528['agents']&&_0x1b3528[_0xfb7c('0x2f')][_0x16b57a['id']]){delete _0x1b3528[_0xfb7c('0x2f')][_0x16b57a['id']][_0x15461c+'WaitingInteractions'][_0x571b62[_0xfb7c('0x19')]['id']];}};exports[_0xfb7c('0x33')]=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 c0f5bc7..3b00e7b 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 _0x49bb=['lodash','./utils','../../../../config/logger','routing','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x49bb,0xc6));var _0xb49b=function(_0x3180c8,_0x48ab2a){_0x3180c8=_0x3180c8-0x0;var _0x3b6865=_0x49bb[_0x3180c8];return _0x3b6865;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xb49b('0x0'));var utils=require(_0xb49b('0x1'));var logger=require(_0xb49b('0x2'))(_0xb49b('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x14aa98,_0xeede15){return function(_0x45f4b5){try{var _0x4c3502={'command':_0xeede15[0x0]};var _0x5526a7=system['validate'](_0x4c3502,{'typecast':!![]});if(_0x5526a7['length']){logger[_0xb49b('0x4')](_0xb49b('0x5'),_0x14aa98,_[_0xb49b('0x6')](_0x5526a7,_0xb49b('0x7'))[_0xb49b('0x8')](',\x20'));logger[_0xb49b('0x9')](_0xb49b('0xa'),_0x14aa98);_0x45f4b5[_0xb49b('0xb')]();}else{var _0x97d613=this;var _0x16d740=utils[_0xb49b('0xc')](_0xeede15[0x0],this);logger[_0xb49b('0x9')](_0xb49b('0xd'),_0x14aa98,_0x16d740);sh['exec'](_[_0xb49b('0xe')](_0x16d740),function(_0x31ec0f,_0x2b1ec9){logger[_0xb49b('0x9')](_0xb49b('0xf'),_0x14aa98,_0x31ec0f);if(_0x31ec0f==0x0){var _0x4de12a=_0x2b1ec9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xb49b('0x10')](_0xeede15[0x1])||_[_0xb49b('0x11')](_0xeede15[0x1])){logger[_0xb49b('0x9')](_0xb49b('0x12'),_0x14aa98);_0x97d613[_0xb49b('0x13')][_0xeede15[0x1]]=_0x4de12a;}else{logger[_0xb49b('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x14aa98,_0xeede15[0x1],_0x4de12a);_0x97d613[_0xb49b('0x13')][_0xeede15[0x1]]=_0x4de12a;}}_0x45f4b5[_0xb49b('0xb')]();});}}catch(_0x4df11e){logger[_0xb49b('0x4')](_0xb49b('0x5'),_0x14aa98,_[_0xb49b('0x14')](_0x4df11e)?JSON[_0xb49b('0x15')](_0x4df11e):_0x4df11e);logger[_0xb49b('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x14aa98);_0x45f4b5[_0xb49b('0xb')]();}};}; \ No newline at end of file +var _0x4aa1=['routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger'];(function(_0x1a884e,_0x144089){var _0x514492=function(_0x38099a){while(--_0x38099a){_0x1a884e['push'](_0x1a884e['shift']());}};_0x514492(++_0x144089);}(_0x4aa1,0x18b));var _0x14aa=function(_0x335ee8,_0x3cd30e){_0x335ee8=_0x335ee8-0x0;var _0x9d1cd8=_0x4aa1[_0x335ee8];return _0x9d1cd8;};'use strict';var schema=require(_0x14aa('0x0'));var sh=require(_0x14aa('0x1'));var _=require(_0x14aa('0x2'));var utils=require(_0x14aa('0x3'));var logger=require(_0x14aa('0x4'))(_0x14aa('0x5'));var system=schema({'command':{'type':_0x14aa('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x14aa('0x7')]=function(_0xb7bdee,_0x234a70){return function(_0x3f2820){try{var _0x1f547f={'command':_0x234a70[0x0]};var _0x259944=system[_0x14aa('0x0')](_0x1f547f,{'typecast':!![]});if(_0x259944[_0x14aa('0x8')]){logger[_0x14aa('0x9')](_0x14aa('0xa'),_0xb7bdee,_[_0x14aa('0xb')](_0x259944,_0x14aa('0xc'))[_0x14aa('0xd')](',\x20'));logger[_0x14aa('0xe')](_0x14aa('0xf'),_0xb7bdee);_0x3f2820['next']();}else{var _0x368e4a=this;var _0x2d2926=utils[_0x14aa('0x10')](_0x234a70[0x0],this);logger[_0x14aa('0xe')](_0x14aa('0x11'),_0xb7bdee,_0x2d2926);sh[_0x14aa('0x12')](_['trim'](_0x2d2926),function(_0x5898f1,_0x44e0d1){logger[_0x14aa('0xe')](_0x14aa('0x13'),_0xb7bdee,_0x5898f1);if(_0x5898f1==0x0){var _0x483ef5=_0x44e0d1['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x14aa('0x14')](_0x234a70[0x1])||_[_0x14aa('0x15')](_0x234a70[0x1])){logger[_0x14aa('0xe')](_0x14aa('0x16'),_0xb7bdee);_0x368e4a['body'][_0x234a70[0x1]]=_0x483ef5;}else{logger['info'](_0x14aa('0x17'),_0xb7bdee,_0x234a70[0x1],_0x483ef5);_0x368e4a['body'][_0x234a70[0x1]]=_0x483ef5;}}_0x3f2820['next']();});}}catch(_0x4d0d73){logger[_0x14aa('0x9')]('[%s][SYSTEM]\x20%s',_0xb7bdee,_[_0x14aa('0x18')](_0x4d0d73)?JSON['stringify'](_0x4d0d73):_0x4d0d73);logger[_0x14aa('0xe')](_0x14aa('0xf'),_0xb7bdee);_0x3f2820['next']();}};}; \ 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 789528a..1ab4637 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 _0x311f=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','catch','error','finally','stringify','info','validate','lodash','../../rpc/chatInteraction'];(function(_0x3fefac,_0x212363){var _0x52d655=function(_0x4e59e9){while(--_0x4e59e9){_0x3fefac['push'](_0x3fefac['shift']());}};_0x52d655(++_0x212363);}(_0x311f,0x126));var _0xf311=function(_0x58dce4,_0x31434c){_0x58dce4=_0x58dce4-0x0;var _0x5dfd88=_0x311f[_0x58dce4];return _0x5dfd88;};'use strict';var schema=require(_0xf311('0x0'));var _=require(_0xf311('0x1'));var rpc={'chatInteraction':require(_0xf311('0x2')),'openchannelInteraction':require(_0xf311('0x3')),'smsInteraction':require(_0xf311('0x4')),'mailInteraction':require(_0xf311('0x5')),'faxInteraction':require(_0xf311('0x6')),'whatsappInteraction':require(_0xf311('0x7'))};var logger=require(_0xf311('0x8'))(_0xf311('0x9'));var tag=schema({'tag':{'type':_0xf311('0xa'),'required':!![],'message':_0xf311('0xb')}});exports['consequence']=function(_0x3b1e23,_0x31eacb,_0x5ce777,_0x526917){return function(_0x4e742f){try{var _0x1224b8={'tag':_0x31eacb[0x0]};var _0x7afbe9=tag[_0xf311('0x0')](_0x1224b8,{'typecast':!![]});if(_0x7afbe9[_0xf311('0xc')]){logger['error'](_0xf311('0xd'),_0x3b1e23,_[_0xf311('0xe')](_0x7afbe9,'message')['join'](',\x20'));logger['info'](_0xf311('0xf'),_0x3b1e23);_0x4e742f[_0xf311('0x10')]();}else{var _0x4793e0={'ids':[_0x31eacb[0x0]]};if(rpc[_0x526917['channel']+_0xf311('0x11')]){rpc[_0x526917['channel']+_0xf311('0x11')][_0xf311('0x12')](_0x526917['interaction']['id'],_0x4793e0)['then'](function(_0x544bdf){logger['info'](_0xf311('0x13'),_0x3b1e23,_0x31eacb[0x1],_0x526917[_0xf311('0x14')],_0x526917[_0xf311('0x15')]['id']);})[_0xf311('0x16')](function(_0x437a81){logger[_0xf311('0x17')](_0xf311('0xd'),_0x3b1e23,JSON['stringify'](_0x437a81));logger['info'](_0xf311('0xf'),_0x3b1e23);})[_0xf311('0x18')](function(){_0x4e742f[_0xf311('0x10')]();});}}}catch(_0x4769a2){logger[_0xf311('0x17')](_0xf311('0xd'),_0x3b1e23,_['isObject'](_0x4769a2)?JSON[_0xf311('0x19')](_0x4769a2):_0x4769a2);logger[_0xf311('0x1a')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b1e23);_0x4e742f[_0xf311('0x10')]();}};}; \ No newline at end of file +var _0x48a2=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','interaction','catch','error','stringify','info','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing'];(function(_0x4b807d,_0xd913ab){var _0x3ba59d=function(_0x15a199){while(--_0x15a199){_0x4b807d['push'](_0x4b807d['shift']());}};_0x3ba59d(++_0xd913ab);}(_0x48a2,0xbd));var _0x248a=function(_0xb837f5,_0x3f80a9){_0xb837f5=_0xb837f5-0x0;var _0x357368=_0x48a2[_0xb837f5];return _0x357368;};'use strict';var schema=require(_0x248a('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x248a('0x1')),'openchannelInteraction':require(_0x248a('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x248a('0x3')),'faxInteraction':require(_0x248a('0x4')),'whatsappInteraction':require(_0x248a('0x5'))};var logger=require('../../../../config/logger')(_0x248a('0x6'));var tag=schema({'tag':{'type':_0x248a('0x7'),'required':!![],'message':_0x248a('0x8')}});exports[_0x248a('0x9')]=function(_0x4e1ba0,_0x43c49c,_0x579e21,_0x464ceb){return function(_0x1d0ef3){try{var _0x576246={'tag':_0x43c49c[0x0]};var _0x412239=tag[_0x248a('0x0')](_0x576246,{'typecast':!![]});if(_0x412239[_0x248a('0xa')]){logger['error'](_0x248a('0xb'),_0x4e1ba0,_[_0x248a('0xc')](_0x412239,_0x248a('0xd'))[_0x248a('0xe')](',\x20'));logger['info'](_0x248a('0xf'),_0x4e1ba0);_0x1d0ef3['next']();}else{var _0x56b0f6={'ids':[_0x43c49c[0x0]]};if(rpc[_0x464ceb[_0x248a('0x10')]+_0x248a('0x11')]){rpc[_0x464ceb[_0x248a('0x10')]+_0x248a('0x11')][_0x248a('0x12')](_0x464ceb['interaction']['id'],_0x56b0f6)[_0x248a('0x13')](function(_0x2ab086){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4e1ba0,_0x43c49c[0x1],_0x464ceb[_0x248a('0x10')],_0x464ceb[_0x248a('0x14')]['id']);})[_0x248a('0x15')](function(_0x1e6e7c){logger[_0x248a('0x16')]('[%s][TAG]\x20%s',_0x4e1ba0,JSON[_0x248a('0x17')](_0x1e6e7c));logger[_0x248a('0x18')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4e1ba0);})[_0x248a('0x19')](function(){_0x1d0ef3[_0x248a('0x1a')]();});}}}catch(_0x52a004){logger[_0x248a('0x16')](_0x248a('0xb'),_0x4e1ba0,_[_0x248a('0x1b')](_0x52a004)?JSON[_0x248a('0x17')](_0x52a004):_0x52a004);logger[_0x248a('0x18')](_0x248a('0xf'),_0x4e1ba0);_0x1d0ef3[_0x248a('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 615ddfd..7f83c24 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 _0x3ab6=['info','next','request-promise','../../../../config/logger','consequence','replace','includes','?params=','urlOnRing','title','jsonrpc','method','login','push','params','utf8','POST','then','parse','result','channelId=','&serviceId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','isObject','stop'];(function(_0x9ace37,_0x4d1159){var _0x23ecc0=function(_0xda11a){while(--_0xda11a){_0x9ace37['push'](_0x9ace37['shift']());}};_0x23ecc0(++_0x4d1159);}(_0x3ab6,0x16e));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x63ab('0x0'));var logger=require(_0x63ab('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0x63ab('0x2')]=function(_0x5e167c,_0x21f957){return function(_0x5ed95a){var _0x5039cf=_0x21f957[0xa];var _0x4afded=_0x21f957[0xb];var _0x508d3b=_0x21f957[0xc];var _0x46adc2=_0x21f957[0xd];var _0x1f3088=_0x21f957[0xe];var _0x2d7c74=_0x21f957[0xf][_0x63ab('0x3')](/\n/g,'\x20-\x20');var _0x58eba6=_0x21f957[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x63ab('0x4')](_0x4afded)){arr['push'](_0x4afded);var _0x14ccc8=_0x21f957[0x3];var _0x2a5df1=_0x21f957[0x4];var _0x2ca658=_0x21f957[0x1];var _0x5139e1=_0x21f957[0x0];var _0x2765ed={};_0x2765ed['urlOnAnswer']=_0x21f957[0x8]+_0x63ab('0x5')+_0x508d3b+'|'+_0x5039cf+'|'+_0x46adc2+'|'+_0x4afded+'|'+_0x1f3088;_0x2765ed[_0x63ab('0x6')]=_0x21f957[0x7]+'?params='+_0x508d3b+'|'+_0x5039cf+'|'+_0x46adc2+'|'+_0x4afded+'|'+_0x1f3088+'|'+_0x2d7c74+'|'+_0x58eba6;_0x2765ed[_0x63ab('0x7')]=_0x21f957[0x9];var _0x3247e6={};_0x3247e6[_0x63ab('0x8')]='2.0';_0x3247e6[_0x63ab('0x9')]=_0x63ab('0xa');var _0x5d3e98=[];_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x2]);_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x5]);_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x6]);_0x3247e6[_0x63ab('0xc')]=_0x5d3e98;_0x3247e6['id']=0x1;var _0x1e938d=JSON['stringify'](_0x3247e6);var _0x5f090f={'encoding':_0x63ab('0xd'),'method':_0x63ab('0xe'),'timeout':0x2710,'url':_0x14ccc8,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1e938d};return rp(_0x5f090f)[_0x63ab('0xf')](function(_0x445477){const _0x325647=JSON[_0x63ab('0x10')](_0x445477);if(!_0x325647[_0x63ab('0x11')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4cd5b2=_0x4afded;var _0x4f46e4=_0x63ab('0x12')+_0x2ca658+_0x63ab('0x13')+_0x5139e1+'&sessionId='+_0x4cd5b2+_0x63ab('0x14')+JSON[_0x63ab('0x15')](_0x2765ed);var _0x362a7e=_0x2a5df1+'?'+_0x4f46e4;return rp(_0x362a7e);})[_0x63ab('0xf')](function(_0x1a1de4){logger['info'](_0x63ab('0x16'),_0x5e167c,_0x1a1de4);_0x5ed95a['stop']();})[_0x63ab('0x17')](function(_0x2e7d7a){logger['error']('[%s][TVOX]\x20%s',_0x5e167c,_[_0x63ab('0x18')](_0x2e7d7a)?JSON[_0x63ab('0x15')](_0x2e7d7a):_0x2e7d7a);_0x5ed95a[_0x63ab('0x19')]();});}else{logger[_0x63ab('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5e167c);_0x5ed95a[_0x63ab('0x1b')]();}};}; \ No newline at end of file +var _0x98c6=['push','params','stringify','POST','application/json-rpc','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','replace','includes','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','login'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x98c6,0xea));var _0x698c=function(_0x52fbb4,_0x57c792){_0x52fbb4=_0x52fbb4-0x0;var _0x413ad7=_0x98c6[_0x52fbb4];return _0x413ad7;};'use strict';var rp=require(_0x698c('0x0'));var logger=require(_0x698c('0x1'))('routing');var _=require(_0x698c('0x2'));var arr=[];exports[_0x698c('0x3')]=function(_0x1aa68e,_0xf64061){return function(_0x2982ee){var _0x46aedc=_0xf64061[0xa];var _0x2d4b1b=_0xf64061[0xb];var _0x4b5812=_0xf64061[0xc];var _0x4540d3=_0xf64061[0xd];var _0xa8eb3a=_0xf64061[0xe];var _0x32cefd=_0xf64061[0xf]['replace'](/\n/g,_0x698c('0x4'));var _0x4f9eff=_0xf64061[0x10][_0x698c('0x5')](/\n/g,'\x20');if(!arr[_0x698c('0x6')](_0x2d4b1b)){arr['push'](_0x2d4b1b);var _0x57e0e0=_0xf64061[0x3];var _0x7b19c=_0xf64061[0x4];var _0x5b5210=_0xf64061[0x1];var _0x76aecf=_0xf64061[0x0];var _0xd6b164={};_0xd6b164[_0x698c('0x7')]=_0xf64061[0x8]+'?params='+_0x4b5812+'|'+_0x46aedc+'|'+_0x4540d3+'|'+_0x2d4b1b+'|'+_0xa8eb3a;_0xd6b164[_0x698c('0x8')]=_0xf64061[0x7]+_0x698c('0x9')+_0x4b5812+'|'+_0x46aedc+'|'+_0x4540d3+'|'+_0x2d4b1b+'|'+_0xa8eb3a+'|'+_0x32cefd+'|'+_0x4f9eff;_0xd6b164[_0x698c('0xa')]=_0xf64061[0x9];var _0x1102fd={};_0x1102fd[_0x698c('0xb')]='2.0';_0x1102fd[_0x698c('0xc')]=_0x698c('0xd');var _0x1f211f=[];_0x1f211f['push'](_0xf64061[0x2]);_0x1f211f[_0x698c('0xe')](_0xf64061[0x5]);_0x1f211f[_0x698c('0xe')](_0xf64061[0x6]);_0x1102fd[_0x698c('0xf')]=_0x1f211f;_0x1102fd['id']=0x1;var _0x340f9c=JSON[_0x698c('0x10')](_0x1102fd);var _0x20005f={'encoding':'utf8','method':_0x698c('0x11'),'timeout':0x2710,'url':_0x57e0e0,'headers':{'Content-Type':_0x698c('0x12')},'body':_0x340f9c};return rp(_0x20005f)['then'](function(_0x295878){const _0x100844=JSON[_0x698c('0x13')](_0x295878);if(!_0x100844['result'][_0x698c('0x14')]){throw new Error(_0x698c('0x15'));}var _0x1aa497=_0x2d4b1b;var _0x5bafa7='channelId='+_0x5b5210+_0x698c('0x16')+_0x76aecf+_0x698c('0x17')+_0x1aa497+'&data='+JSON['stringify'](_0xd6b164);var _0x168ffa=_0x7b19c+'?'+_0x5bafa7;return rp(_0x168ffa);})[_0x698c('0x18')](function(_0x44ae50){logger[_0x698c('0x19')](_0x698c('0x1a'),_0x1aa68e,_0x44ae50);_0x2982ee[_0x698c('0x1b')]();})['catch'](function(_0x2b301b){logger[_0x698c('0x1c')](_0x698c('0x1d'),_0x1aa68e,_['isObject'](_0x2b301b)?JSON[_0x698c('0x10')](_0x2b301b):_0x2b301b);_0x2982ee[_0x698c('0x1b')]();});}else{logger[_0x698c('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1aa68e);_0x2982ee[_0x698c('0x1e')]();}};}; \ 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 ed34b8c..25170d1 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x44ab4a,_0x3c1de4){var _0x938cb1=function(_0x1732ec){while(--_0x1732ec){_0x44ab4a['push'](_0x44ab4a['shift']());}};_0x938cb1(++_0x3c1de4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x52cdbf,_0x16854a){var _0x442be2=function(_0x5ed7cc){while(--_0x5ed7cc){_0x52cdbf['push'](_0x52cdbf['shift']());}};_0x442be2(++_0x16854a);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3ec42df..960189f 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 _0x6616=['../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','appdata','mail','push','dialogflow','split','slice','dialogflowv2','amazonlex','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','app','./interval','condition','./applications/','consequence','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6616,0x183));var _0x6661=function(_0xb6695a,_0xf61eff){_0xb6695a=_0xb6695a-0x0;var _0x323e3c=_0x6616[_0xb6695a];return _0x323e3c;};'use strict';var _=require('lodash');var util=require(_0x6661('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6661('0x1'));var utils=require(_0x6661('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6661('0x3'))(_0x6661('0x4'));var rpc={'openchannelQueueReport':require(_0x6661('0x5')),'mailQueueReport':require(_0x6661('0x6')),'chatQueueReport':require(_0x6661('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6661('0x8')),'whatsappQueueReport':require(_0x6661('0x9'))};var RuleEngine=require(_0x6661('0xa'));function getId(_0x254903,_0x10586a,_0x4ea778){return util[_0x6661('0xb')]('%s.%s.%s',_0x254903,_0x10586a||0x0,_0x4ea778||0x0);}function getIntervals(_0x20010f,_0x40aa71){var _0x4121f9=[];if(!_[_0x6661('0xc')](_0x40aa71[_0x6661('0xd')])&&!_[_0x6661('0xc')](_0x20010f[_0x40aa71[_0x6661('0xd')]])&&!_[_0x6661('0xc')](_0x20010f[_0x40aa71['IntervalId']][_0x6661('0xe')])){_0x4121f9=_['map'](_0x20010f[_0x40aa71[_0x6661('0xd')]]['Intervals'],_0x6661('0xf'));}else if(!_['isNil'](_0x40aa71[_0x6661('0xf')])){_0x4121f9=[_0x40aa71[_0x6661('0xf')]];}return _0x4121f9;}exports[_0x6661('0x10')]=function(_0x5d42a6){_0x5d42a6[_0x6661('0x11')]={};return new BPromise(function(_0x599281,_0x2f1ef4){var _0x32c3fa={'Start':function(_0x39cca5){var _0x5eb6f5=this;return new Promise(function(_0x3a1f70,_0x454667){if(_0x39cca5){try{var _0x2b5859=[];var _0x1f80b8=getId(_0x39cca5[_0x6661('0x12')],_0x39cca5[_0x6661('0x13')]?_0x39cca5[_0x6661('0x13')]['id']:0x0,_0x39cca5[_0x6661('0x14')]?_0x39cca5['interaction']['id']:0x0);var _0x456e38=sUtils[_0x6661('0x15')](_0x5d42a6,_0x39cca5);if(!_0x456e38&&_0x39cca5[_0x6661('0x16')]&&_[_0x6661('0x17')](_0x39cca5[_0x6661('0x16')])&&_0x39cca5[_0x6661('0x16')][_0x6661('0x18')]){for(var _0x4e0301=0x0;_0x4e0301<_0x39cca5['applications'][_0x6661('0x18')];_0x4e0301+=0x1){var _0x5e321c=_0x39cca5[_0x6661('0x16')][_0x4e0301];if(fs[_0x6661('0x19')](path[_0x6661('0x1a')](__dirname,_0x6661('0x16'),_0x5e321c['app']+_0x6661('0x1b')))){var _0x6e9b9c=[];switch(_0x5e321c['app'][_0x6661('0x1c')]()){case _0x6661('0x1d'):var _0x120207=_0x5e321c[_0x6661('0x1e')]['split'](',');if(_0x39cca5[_0x6661('0x12')]===_0x6661('0x1f')){_0x6e9b9c['push'](_0x120207[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x120207[0x1]);_0x6e9b9c[_0x6661('0x20')](_0x120207['slice'](0x2,_0x120207[_0x6661('0x18')])[_0x6661('0x1a')](','));}else{_0x6e9b9c[_0x6661('0x20')](_0x120207[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x120207['slice'](0x1,_0x120207['length'])[_0x6661('0x1a')](','));}break;case _0x6661('0x21'):var _0x4a2355=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x4a2355[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x4a2355[0x1]);_0x6e9b9c['push'](_0x4a2355[_0x6661('0x23')](0x2,_0x4a2355[_0x6661('0x18')])['join'](','));break;case _0x6661('0x24'):var _0x1ee9ce=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c['push'](_0x1ee9ce[0x0]);_0x6e9b9c['push'](_0x1ee9ce[0x1]);_0x6e9b9c[_0x6661('0x20')](_0x1ee9ce[0x2]);_0x6e9b9c['push'](_0x1ee9ce[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x1ee9ce[_0x6661('0x23')](0x4,_0x1ee9ce[_0x6661('0x18')])[_0x6661('0x1a')](','));break;case _0x6661('0x25'):var _0x18e8fb=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x18e8fb[0x0]);_0x6e9b9c['push'](_0x18e8fb[0x1]);_0x6e9b9c['push'](_0x18e8fb[0x2]);_0x6e9b9c['push'](_0x18e8fb[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x18e8fb[_0x6661('0x23')](0x4,_0x18e8fb[_0x6661('0x18')])['join'](','));break;case _0x6661('0x13'):_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x1e')]);break;case'tag':_0x6e9b9c['push'](_0x5e321c['TagId']);_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x1e')]);break;case _0x6661('0x26'):var _0x46964f=utils[_0x6661('0x27')](_0x39cca5['account'][_0x6661('0x28')],_0x39cca5);var _0x599ee2=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x1]);_0x6e9b9c['push'](_0x599ee2[0x2]);_0x6e9b9c['push'](_0x599ee2[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x4]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x5]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x6]);_0x6e9b9c['push'](_0x599ee2[0x7]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x8]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x9]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0xa]);_0x6e9b9c[_0x6661('0x20')](_0x39cca5['interaction']['id']);_0x6e9b9c[_0x6661('0x20')](_0x39cca5[_0x6661('0x13')]['id']);_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x29')]);_0x6e9b9c['push'](_0x39cca5[_0x6661('0x14')]['ContactId']);_0x6e9b9c[_0x6661('0x20')](_0x39cca5['body'][_0x6661('0x2a')]);_0x6e9b9c[_0x6661('0x20')](_0x46964f);break;default:_0x6e9b9c=_['isNil'](_0x5e321c[_0x6661('0x1e')])?[]:_0x5e321c['appdata'][_0x6661('0x22')](',');}var _0x469251={'id':util[_0x6661('0xb')]('%s:%s:%s',_0x1f80b8,_0x5e321c['id'],_0x5e321c[_0x6661('0x2b')]),'condition':require(_0x6661('0x2c'))[_0x6661('0x2d')](_0x1f80b8,getIntervals(_0x5d42a6['intervals'],_0x5e321c),_0x5d42a6),'consequence':require(_0x6661('0x2e')+_0x5e321c[_0x6661('0x2b')])[_0x6661('0x2f')](_0x1f80b8,_0x6e9b9c,_0x5d42a6,_0x39cca5),'p':_0x5e321c['priority']||0x0};logger[_0x6661('0x30')]('Push\x20new\x20rule',_0x469251['id'],_0x6661('0x31'),getIntervals(_0x5d42a6[_0x6661('0x32')],_0x5e321c)[_0x6661('0x1a')](_0x6661('0x33')));_0x2b5859[_0x6661('0x20')](_0x469251);}else{logger[_0x6661('0x34')](_0x6661('0x35'),path[_0x6661('0x1a')](__dirname,_0x6661('0x16'),_0x5e321c[_0x6661('0x2b')]+'.js'));}}_0x5d42a6['rules'][_0x1f80b8]=new RuleEngine(_0x2b5859);_0x5d42a6['rules'][_0x1f80b8][_0x6661('0x36')](_0x39cca5,function(_0x27980b){logger[_0x6661('0x30')](_0x6661('0x37'),JSON[_0x6661('0x38')](_0x27980b['matchPath']));if(_0x5d42a6['rules'][_0x1f80b8]){_0x5d42a6[_0x6661('0x11')][_0x1f80b8][_0x6661('0x39')](_0x6661('0x3a'));}});return _0x3a1f70({'code':0xc8,'message':_0x39cca5});}else{if(_0x456e38){logger['info'](util[_0x6661('0xb')]('Skipped\x20routing\x20for\x20%s',_0x1f80b8));}else{logger[_0x6661('0x30')](_0x6661('0x3b'));}return _0x3a1f70({'code':0xc8,'message':_0x39cca5});}}catch(_0x531b85){logger['error'](_0x531b85[_0x6661('0x3c')]);return _0x454667(_0x5eb6f5[_0x6661('0x34')](0x1f4,_0x531b85));}}return _0x454667('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c1d9e){var _0x2664a8=this;return new Promise(function(_0x2fd62c,_0x499c52){if(_0x2c1d9e[_0x6661('0x3d')]&&_0x2c1d9e[_0x6661('0x3d')]['id']){if(_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']]){_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']][_0x6661('0x3f')]=![];_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']][_0x6661('0x40')]=undefined;}}if(_0x2c1d9e[_0x6661('0x13')]&&_0x2c1d9e['message']['id']){try{var _0x13ffcd=getId(_0x2c1d9e[_0x6661('0x12')],_0x2c1d9e['message']?_0x2c1d9e['message']['id']:0x0,_0x2c1d9e['interaction']?_0x2c1d9e[_0x6661('0x14')]['id']:0x0);if(_0x5d42a6[_0x6661('0x11')][_0x13ffcd]){_0x5d42a6[_0x6661('0x11')][_0x13ffcd]['emit'](_0x6661('0x41'));if(rpc[_0x2c1d9e[_0x6661('0x12')]+_0x6661('0x42')]){rpc[_0x2c1d9e[_0x6661('0x12')]+'QueueReport'][_0x6661('0x43')](_0x13ffcd,{'UserId':_0x2c1d9e['message'][_0x6661('0x44')]})[_0x6661('0x45')](function(){logger[_0x6661('0x34')](_0x6661('0x46'));});}}return _0x2fd62c({'code':0xc8,'message':_0x2c1d9e});}catch(_0x2b88ce){logger[_0x6661('0x34')](_0x2b88ce[_0x6661('0x3c')]);return _0x499c52(_0x2664a8[_0x6661('0x34')](0x1f4,_0x2b88ce));}}logger['error']('message\x20is\x20empty');return _0x499c52(_0x2664a8[_0x6661('0x34')](0x1f4,_0x6661('0x47')));});},'RejectMessage':function(_0x3497a8){var _0x3e85b5=this;return new Promise(function(_0x4093dd,_0x139ead){if(_0x3497a8['agent']&&_0x3497a8[_0x6661('0x3d')]['id']){try{if(_0x5d42a6['agents'][_0x3497a8[_0x6661('0x3d')]['id']]){_0x5d42a6[_0x6661('0x3e')][_0x3497a8[_0x6661('0x3d')]['id']]['busy']=![];_0x5d42a6[_0x6661('0x3e')][_0x3497a8[_0x6661('0x3d')]['id']]['busyQueue']=undefined;}return _0x4093dd({'code':0xc8,'message':_0x3497a8});}catch(_0x1e18d1){logger[_0x6661('0x34')](_0x1e18d1[_0x6661('0x3c')]);return _0x139ead(_0x3e85b5[_0x6661('0x34')](0x1f4,_0x1e18d1));}}logger[_0x6661('0x34')](_0x6661('0x47'));return _0x139ead(_0x3e85b5[_0x6661('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3fc298){var _0x305993=this;return new Promise(function(_0x54b64a,_0x4a776b){if(_0x3fc298[_0x6661('0x12')]&&_0x3fc298[_0x6661('0x14')]&&_0x3fc298[_0x6661('0x14')]['id']){try{var _0x577a9a=getId(_0x3fc298['channel'],_0x3fc298[_0x6661('0x13')]?_0x3fc298['message']['id']:0x0,_0x3fc298[_0x6661('0x14')]?_0x3fc298['interaction']['id']:0x0);if(_0x5d42a6[_0x6661('0x11')][_0x577a9a]){_0x5d42a6[_0x6661('0x11')][_0x577a9a][_0x6661('0x39')](_0x6661('0x41'));}return _0x54b64a({'code':0xc8,'message':_0x3fc298});}catch(_0x118613){logger[_0x6661('0x34')](_0x118613['stack']);return _0x4a776b(_0x305993[_0x6661('0x34')](0x1f4,_0x118613));}}logger['error'](_0x6661('0x47'));return _0x4a776b(_0x305993['error'](0x1f4,_0x6661('0x47')));});},'AgentCapacity':function(_0x2594c7){var _0x555f6b=this;return new Promise(function(_0x527e7e,_0x396231){if(_0x5d42a6[_0x6661('0x3e')][_0x6661('0x48')](_0x2594c7['id'])){for(var _0x4f2605 in _0x2594c7['capacity']){if(_0x2594c7['capacity'][_0x6661('0x48')](_0x4f2605)){if(_0x5d42a6['agents'][_0x2594c7['id']][_0x6661('0x48')](_0x4f2605+'CurrentCapacity')){_0x5d42a6[_0x6661('0x3e')][_0x2594c7['id']][_0x4f2605+_0x6661('0x49')]=parseInt(_0x2594c7[_0x6661('0x4a')][_0x4f2605],0xa);}}}_0x5d42a6[_0x6661('0x3e')][_0x2594c7['id']][_0x6661('0x4b')]();return _0x527e7e({'code':0xc8,'message':_0x5d42a6['agents'][_0x2594c7['id']]});}else{return _0x396231(_0x555f6b[_0x6661('0x34')](0x1f4,_0x6661('0x4c')));}});},'Agents':function(_0x1a0dd9){return new Promise(function(_0x25c714){var _0x5dbb87=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x3e')]);if(_0x1a0dd9&&_0x1a0dd9['id']){var _0x27ef62=_[_0x6661('0x4e')](_0x5dbb87,function(_0x29229a){return _0x29229a['id']===_0x1a0dd9['id'];});_0x25c714(_0x27ef62);}else{_0x25c714({'count':_0x5dbb87[_0x6661('0x18')],'rows':_0x5dbb87});}});},'ChatQueues':function(){return new Promise(function(_0x51158f){var _0x563d41=[];for(var _0x728b16 in _0x5d42a6[_0x6661('0x4f')]){if(_0x5d42a6['chatQueues']['hasOwnProperty'](_0x728b16)){var _0xe9b82f=_0x5d42a6['chatQueues'][_0x728b16];var _0x2b8ce3={'id':_0xe9b82f['id'],'available':_0xe9b82f[_0x6661('0x50')],'loggedIn':_0xe9b82f[_0x6661('0x51')],'name':_0xe9b82f[_0x6661('0x52')],'paused':_0xe9b82f['paused'],'waiting':_0xe9b82f[_0x6661('0x53')]};_0x563d41[_0x6661('0x20')](_0x2b8ce3);}}_0x51158f({'count':_0x563d41[_0x6661('0x18')],'rows':_0x563d41});});},'MailQueues':function(){return new Promise(function(_0x7d6229){var _0x5e572b=[];for(var _0x690b0f in _0x5d42a6[_0x6661('0x54')]){if(_0x5d42a6[_0x6661('0x54')][_0x6661('0x48')](_0x690b0f)){var _0x669826=_0x5d42a6[_0x6661('0x54')][_0x690b0f];var _0x4bab0a={'id':_0x669826['id'],'available':_0x669826[_0x6661('0x50')],'loggedIn':_0x669826[_0x6661('0x51')],'name':_0x669826['name'],'paused':_0x669826[_0x6661('0x55')],'waiting':_0x669826[_0x6661('0x53')]};_0x5e572b[_0x6661('0x20')](_0x4bab0a);}}_0x7d6229({'count':_0x5e572b[_0x6661('0x18')],'rows':_0x5e572b});});},'OpenchannelQueues':function(){return new Promise(function(_0x16d96d){var _0x3fa8fb=[];for(var _0x1038ca in _0x5d42a6[_0x6661('0x56')]){if(_0x5d42a6[_0x6661('0x56')][_0x6661('0x48')](_0x1038ca)){var _0x534949=_0x5d42a6[_0x6661('0x56')][_0x1038ca];var _0x2f6ece={'id':_0x534949['id'],'available':_0x534949['available'],'loggedIn':_0x534949[_0x6661('0x51')],'name':_0x534949[_0x6661('0x52')],'paused':_0x534949[_0x6661('0x55')],'waiting':_0x534949[_0x6661('0x53')]};_0x3fa8fb[_0x6661('0x20')](_0x2f6ece);}}_0x16d96d({'count':_0x3fa8fb[_0x6661('0x18')],'rows':_0x3fa8fb});});},'SmsQueues':function(){return new Promise(function(_0x32422e){var _0x5b3b00=[];for(var _0x11db0b in _0x5d42a6[_0x6661('0x57')]){if(_0x5d42a6[_0x6661('0x57')][_0x6661('0x48')](_0x11db0b)){var _0xa2d9ad=_0x5d42a6[_0x6661('0x57')][_0x11db0b];var _0x271546={'id':_0xa2d9ad['id'],'available':_0xa2d9ad[_0x6661('0x50')],'loggedIn':_0xa2d9ad[_0x6661('0x51')],'name':_0xa2d9ad['name'],'paused':_0xa2d9ad[_0x6661('0x55')],'waiting':_0xa2d9ad['waiting']};_0x5b3b00['push'](_0x271546);}}_0x32422e({'count':_0x5b3b00[_0x6661('0x18')],'rows':_0x5b3b00});});},'FaxQueues':function(){return new Promise(function(_0x211861){var _0x1473f6=[];for(var _0x41afea in _0x5d42a6[_0x6661('0x58')]){if(_0x5d42a6['faxQueues'][_0x6661('0x48')](_0x41afea)){var _0x49e8d2=_0x5d42a6['faxQueues'][_0x41afea];var _0x413506={'id':_0x49e8d2['id'],'available':_0x49e8d2[_0x6661('0x50')],'loggedIn':_0x49e8d2[_0x6661('0x51')],'name':_0x49e8d2[_0x6661('0x52')],'paused':_0x49e8d2[_0x6661('0x55')],'waiting':_0x49e8d2[_0x6661('0x53')]};_0x1473f6[_0x6661('0x20')](_0x413506);}}_0x211861({'count':_0x1473f6[_0x6661('0x18')],'rows':_0x1473f6});});},'WhatsappQueues':function(){return new Promise(function(_0x83639f){var _0x4f4a20=[];for(var _0x4cda65 in _0x5d42a6[_0x6661('0x59')]){if(_0x5d42a6[_0x6661('0x59')][_0x6661('0x48')](_0x4cda65)){var _0x12d370=_0x5d42a6['whatsappQueues'][_0x4cda65];var _0x17812b={'id':_0x12d370['id'],'available':_0x12d370['available'],'loggedIn':_0x12d370['loggedIn'],'name':_0x12d370[_0x6661('0x52')],'paused':_0x12d370[_0x6661('0x55')],'waiting':_0x12d370[_0x6661('0x53')]};_0x4f4a20[_0x6661('0x20')](_0x17812b);}}_0x83639f({'count':_0x4f4a20[_0x6661('0x18')],'rows':_0x4f4a20});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ae1da){var _0x599958=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5a')]);_0x3ae1da({'count':_0x599958['length'],'rows':_0x599958});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x47c3f9){var _0x21d3f0=_[_0x6661('0x4d')](_0x5d42a6['mailQueuesWaitingInteractions']);_0x47c3f9({'count':_0x21d3f0[_0x6661('0x18')],'rows':_0x21d3f0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1c3dd1){var _0x5a3076=_['values'](_0x5d42a6[_0x6661('0x5b')]);_0x1c3dd1({'count':_0x5a3076[_0x6661('0x18')],'rows':_0x5a3076});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x26979d){var _0x196b66=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5c')]);_0x26979d({'count':_0x196b66['length'],'rows':_0x196b66});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x432736){var _0x26204e=_[_0x6661('0x4d')](_0x5d42a6['faxQueuesWaitingInteractions']);_0x432736({'count':_0x26204e[_0x6661('0x18')],'rows':_0x26204e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x17dd75){var _0x29bbfe=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5d')]);_0x17dd75({'count':_0x29bbfe['length'],'rows':_0x29bbfe});});}};var _0x3552ba=jayson[_0x6661('0x5e')](_0x32c3fa)['http']();_0x3552ba['on'](_0x6661('0x34'),function(_0x275858){logger[_0x6661('0x34')](JSON[_0x6661('0x38')](_0x275858));return _0x2f1ef4(_0x275858);});_0x3552ba[_0x6661('0x10')](0x232c,_0x6661('0x5f'),function(){console[_0x6661('0x60')](_0x6661('0x61'),0x232c);return _0x599281(_0x6661('0x62')+0x232c);});});}; \ No newline at end of file +var _0xc84c=['available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','length','existsSync','app','toLowerCase','split','push','slice','join','dialogflow','appdata','dialogflowv2','tag','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','channel','QueueReport','update','UserId','error','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues'];(function(_0x2ffd1f,_0x4374ad){var _0x25160f=function(_0x341382){while(--_0x341382){_0x2ffd1f['push'](_0x2ffd1f['shift']());}};_0x25160f(++_0x4374ad);}(_0xc84c,0xd4));var _0xcc84=function(_0x836fec,_0x291263){_0x836fec=_0x836fec-0x0;var _0x4c406c=_0xc84c[_0x836fec];return _0x4c406c;};'use strict';var _=require('lodash');var util=require(_0xcc84('0x0'));var path=require(_0xcc84('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcc84('0x2'));var utils=require(_0xcc84('0x3'));var sUtils=require(_0xcc84('0x4'));var logger=require(_0xcc84('0x5'))(_0xcc84('0x6'));var rpc={'openchannelQueueReport':require(_0xcc84('0x7')),'mailQueueReport':require(_0xcc84('0x8')),'chatQueueReport':require(_0xcc84('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xcc84('0xa')),'whatsappQueueReport':require(_0xcc84('0xb'))};var RuleEngine=require(_0xcc84('0xc'));function getId(_0x2771c2,_0xc33c69,_0x463ed5){return util[_0xcc84('0xd')](_0xcc84('0xe'),_0x2771c2,_0xc33c69||0x0,_0x463ed5||0x0);}function getIntervals(_0x3b58a8,_0x33ad0a){var _0x55e9e7=[];if(!_[_0xcc84('0xf')](_0x33ad0a[_0xcc84('0x10')])&&!_['isNil'](_0x3b58a8[_0x33ad0a[_0xcc84('0x10')]])&&!_[_0xcc84('0xf')](_0x3b58a8[_0x33ad0a[_0xcc84('0x10')]][_0xcc84('0x11')])){_0x55e9e7=_['map'](_0x3b58a8[_0x33ad0a[_0xcc84('0x10')]]['Intervals'],_0xcc84('0x12'));}else if(!_[_0xcc84('0xf')](_0x33ad0a[_0xcc84('0x12')])){_0x55e9e7=[_0x33ad0a[_0xcc84('0x12')]];}return _0x55e9e7;}exports[_0xcc84('0x13')]=function(_0x169b99){_0x169b99[_0xcc84('0x14')]={};return new BPromise(function(_0x419112,_0x5cbd35){var _0x36bda2={'Start':function(_0x381979){var _0x26051a=this;return new Promise(function(_0x1d744d,_0xf55fb){if(_0x381979){try{var _0x10cfa4=[];var _0x33bc1c=getId(_0x381979['channel'],_0x381979[_0xcc84('0x15')]?_0x381979[_0xcc84('0x15')]['id']:0x0,_0x381979[_0xcc84('0x16')]?_0x381979[_0xcc84('0x16')]['id']:0x0);var _0x53e6a2=sUtils[_0xcc84('0x17')](_0x169b99,_0x381979);if(!_0x53e6a2&&_0x381979[_0xcc84('0x18')]&&_['isArray'](_0x381979[_0xcc84('0x18')])&&_0x381979[_0xcc84('0x18')]['length']){for(var _0x15a222=0x0;_0x15a222<_0x381979[_0xcc84('0x18')][_0xcc84('0x19')];_0x15a222+=0x1){var _0x5ce83c=_0x381979[_0xcc84('0x18')][_0x15a222];if(fs[_0xcc84('0x1a')](path['join'](__dirname,_0xcc84('0x18'),_0x5ce83c[_0xcc84('0x1b')]+'.js'))){var _0x4e4d83=[];switch(_0x5ce83c['app'][_0xcc84('0x1c')]()){case'autoreply':var _0x57b7cc=_0x5ce83c['appdata'][_0xcc84('0x1d')](',');if(_0x381979['channel']==='mail'){_0x4e4d83[_0xcc84('0x1e')](_0x57b7cc[0x0]);_0x4e4d83[_0xcc84('0x1e')](_0x57b7cc[0x1]);_0x4e4d83[_0xcc84('0x1e')](_0x57b7cc[_0xcc84('0x1f')](0x2,_0x57b7cc['length'])[_0xcc84('0x20')](','));}else{_0x4e4d83[_0xcc84('0x1e')](_0x57b7cc[0x0]);_0x4e4d83[_0xcc84('0x1e')](_0x57b7cc[_0xcc84('0x1f')](0x1,_0x57b7cc[_0xcc84('0x19')])[_0xcc84('0x20')](','));}break;case _0xcc84('0x21'):var _0x556f06=_0x5ce83c[_0xcc84('0x22')][_0xcc84('0x1d')](',');_0x4e4d83['push'](_0x556f06[0x0]);_0x4e4d83['push'](_0x556f06[0x1]);_0x4e4d83[_0xcc84('0x1e')](_0x556f06['slice'](0x2,_0x556f06[_0xcc84('0x19')])[_0xcc84('0x20')](','));break;case _0xcc84('0x23'):var _0x32bdf5=_0x5ce83c[_0xcc84('0x22')]['split'](',');_0x4e4d83[_0xcc84('0x1e')](_0x32bdf5[0x0]);_0x4e4d83['push'](_0x32bdf5[0x1]);_0x4e4d83[_0xcc84('0x1e')](_0x32bdf5[0x2]);_0x4e4d83[_0xcc84('0x1e')](_0x32bdf5[0x3]);_0x4e4d83['push'](_0x32bdf5[_0xcc84('0x1f')](0x4,_0x32bdf5[_0xcc84('0x19')])[_0xcc84('0x20')](','));break;case'amazonlex':var _0x4ae447=_0x5ce83c['appdata'][_0xcc84('0x1d')](',');_0x4e4d83['push'](_0x4ae447[0x0]);_0x4e4d83[_0xcc84('0x1e')](_0x4ae447[0x1]);_0x4e4d83[_0xcc84('0x1e')](_0x4ae447[0x2]);_0x4e4d83[_0xcc84('0x1e')](_0x4ae447[0x3]);_0x4e4d83[_0xcc84('0x1e')](_0x4ae447[_0xcc84('0x1f')](0x4,_0x4ae447['length'])['join'](','));break;case'message':_0x4e4d83[_0xcc84('0x1e')](_0x5ce83c[_0xcc84('0x22')]);break;case _0xcc84('0x24'):_0x4e4d83[_0xcc84('0x1e')](_0x5ce83c['TagId']);_0x4e4d83[_0xcc84('0x1e')](_0x5ce83c[_0xcc84('0x22')]);break;case _0xcc84('0x25'):var _0x406247=utils[_0xcc84('0x26')](_0x381979[_0xcc84('0x27')]['notificationTemplate'],_0x381979);var _0x4cde20=_0x5ce83c[_0xcc84('0x22')][_0xcc84('0x1d')](',');_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x0]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x1]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x2]);_0x4e4d83['push'](_0x4cde20[0x3]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x4]);_0x4e4d83['push'](_0x4cde20[0x5]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x6]);_0x4e4d83['push'](_0x4cde20[0x7]);_0x4e4d83['push'](_0x4cde20[0x8]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0x9]);_0x4e4d83[_0xcc84('0x1e')](_0x4cde20[0xa]);_0x4e4d83[_0xcc84('0x1e')](_0x381979['interaction']['id']);_0x4e4d83[_0xcc84('0x1e')](_0x381979[_0xcc84('0x15')]['id']);_0x4e4d83['push'](_0x5ce83c[_0xcc84('0x28')]);_0x4e4d83[_0xcc84('0x1e')](_0x381979[_0xcc84('0x16')][_0xcc84('0x29')]);_0x4e4d83[_0xcc84('0x1e')](_0x381979[_0xcc84('0x2a')][_0xcc84('0x2a')]);_0x4e4d83[_0xcc84('0x1e')](_0x406247);break;default:_0x4e4d83=_['isNil'](_0x5ce83c[_0xcc84('0x22')])?[]:_0x5ce83c[_0xcc84('0x22')][_0xcc84('0x1d')](',');}var _0xf62908={'id':util[_0xcc84('0xd')](_0xcc84('0x2b'),_0x33bc1c,_0x5ce83c['id'],_0x5ce83c[_0xcc84('0x1b')]),'condition':require('./interval')['condition'](_0x33bc1c,getIntervals(_0x169b99[_0xcc84('0x2c')],_0x5ce83c),_0x169b99),'consequence':require('./applications/'+_0x5ce83c[_0xcc84('0x1b')])[_0xcc84('0x2d')](_0x33bc1c,_0x4e4d83,_0x169b99,_0x381979),'p':_0x5ce83c['priority']||0x0};logger[_0xcc84('0x2e')](_0xcc84('0x2f'),_0xf62908['id'],_0xcc84('0x30'),getIntervals(_0x169b99[_0xcc84('0x2c')],_0x5ce83c)['join'](_0xcc84('0x31')));_0x10cfa4['push'](_0xf62908);}else{logger['error'](_0xcc84('0x32'),path[_0xcc84('0x20')](__dirname,_0xcc84('0x18'),_0x5ce83c[_0xcc84('0x1b')]+_0xcc84('0x33')));}}_0x169b99[_0xcc84('0x14')][_0x33bc1c]=new RuleEngine(_0x10cfa4);_0x169b99[_0xcc84('0x14')][_0x33bc1c][_0xcc84('0x34')](_0x381979,function(_0x2c98e7){logger[_0xcc84('0x2e')](_0xcc84('0x35'),JSON[_0xcc84('0x36')](_0x2c98e7['matchPath']));if(_0x169b99[_0xcc84('0x14')][_0x33bc1c]){_0x169b99[_0xcc84('0x14')][_0x33bc1c]['emit'](_0xcc84('0x37'));}});return _0x1d744d({'code':0xc8,'message':_0x381979});}else{if(_0x53e6a2){logger[_0xcc84('0x2e')](util['format'](_0xcc84('0x38'),_0x33bc1c));}else{logger[_0xcc84('0x2e')](_0xcc84('0x39'));}return _0x1d744d({'code':0xc8,'message':_0x381979});}}catch(_0x5bcae2){logger['error'](_0x5bcae2[_0xcc84('0x3a')]);return _0xf55fb(_0x26051a['error'](0x1f4,_0x5bcae2));}}return _0xf55fb(_0xcc84('0x3b'));});},'AcceptMessage':function(_0x112a42){var _0x20f5c5=this;return new Promise(function(_0x33f231,_0x54c1ef){if(_0x112a42[_0xcc84('0x3c')]&&_0x112a42['agent']['id']){if(_0x169b99[_0xcc84('0x3d')][_0x112a42[_0xcc84('0x3c')]['id']]){_0x169b99[_0xcc84('0x3d')][_0x112a42['agent']['id']]['busy']=![];_0x169b99[_0xcc84('0x3d')][_0x112a42[_0xcc84('0x3c')]['id']][_0xcc84('0x3e')]=undefined;}}if(_0x112a42['message']&&_0x112a42[_0xcc84('0x15')]['id']){try{var _0x3cd039=getId(_0x112a42['channel'],_0x112a42[_0xcc84('0x15')]?_0x112a42['message']['id']:0x0,_0x112a42['interaction']?_0x112a42['interaction']['id']:0x0);if(_0x169b99[_0xcc84('0x14')][_0x3cd039]){_0x169b99['rules'][_0x3cd039][_0xcc84('0x3f')](_0xcc84('0x40'));if(rpc[_0x112a42[_0xcc84('0x41')]+'QueueReport']){rpc[_0x112a42[_0xcc84('0x41')]+_0xcc84('0x42')][_0xcc84('0x43')](_0x3cd039,{'UserId':_0x112a42[_0xcc84('0x15')][_0xcc84('0x44')]})['catch'](function(){logger[_0xcc84('0x45')](_0xcc84('0x46'));});}}return _0x33f231({'code':0xc8,'message':_0x112a42});}catch(_0xabd911){logger[_0xcc84('0x45')](_0xabd911[_0xcc84('0x3a')]);return _0x54c1ef(_0x20f5c5[_0xcc84('0x45')](0x1f4,_0xabd911));}}logger[_0xcc84('0x45')](_0xcc84('0x47'));return _0x54c1ef(_0x20f5c5['error'](0x1f4,_0xcc84('0x47')));});},'RejectMessage':function(_0x3306bf){var _0x5087d3=this;return new Promise(function(_0x4343e0,_0x5cb5ed){if(_0x3306bf[_0xcc84('0x3c')]&&_0x3306bf[_0xcc84('0x3c')]['id']){try{if(_0x169b99[_0xcc84('0x3d')][_0x3306bf[_0xcc84('0x3c')]['id']]){_0x169b99[_0xcc84('0x3d')][_0x3306bf[_0xcc84('0x3c')]['id']][_0xcc84('0x48')]=![];_0x169b99[_0xcc84('0x3d')][_0x3306bf[_0xcc84('0x3c')]['id']]['busyQueue']=undefined;}return _0x4343e0({'code':0xc8,'message':_0x3306bf});}catch(_0x236cec){logger[_0xcc84('0x45')](_0x236cec[_0xcc84('0x3a')]);return _0x5cb5ed(_0x5087d3[_0xcc84('0x45')](0x1f4,_0x236cec));}}logger['error'](_0xcc84('0x47'));return _0x5cb5ed(_0x5087d3[_0xcc84('0x45')](0x1f4,_0xcc84('0x47')));});},'AbandonInteraction':function(_0x7ec735){var _0x566a62=this;return new Promise(function(_0x12a49c,_0x32f7aa){if(_0x7ec735[_0xcc84('0x41')]&&_0x7ec735[_0xcc84('0x16')]&&_0x7ec735[_0xcc84('0x16')]['id']){try{var _0x4b8aac=getId(_0x7ec735[_0xcc84('0x41')],_0x7ec735[_0xcc84('0x15')]?_0x7ec735[_0xcc84('0x15')]['id']:0x0,_0x7ec735[_0xcc84('0x16')]?_0x7ec735[_0xcc84('0x16')]['id']:0x0);if(_0x169b99[_0xcc84('0x14')][_0x4b8aac]){_0x169b99[_0xcc84('0x14')][_0x4b8aac]['emit']('end');}return _0x12a49c({'code':0xc8,'message':_0x7ec735});}catch(_0x4cc203){logger[_0xcc84('0x45')](_0x4cc203[_0xcc84('0x3a')]);return _0x32f7aa(_0x566a62['error'](0x1f4,_0x4cc203));}}logger[_0xcc84('0x45')](_0xcc84('0x47'));return _0x32f7aa(_0x566a62[_0xcc84('0x45')](0x1f4,_0xcc84('0x47')));});},'AgentCapacity':function(_0x6a5a56){var _0x450117=this;return new Promise(function(_0x599a01,_0x35ed11){if(_0x169b99[_0xcc84('0x3d')][_0xcc84('0x49')](_0x6a5a56['id'])){for(var _0x1658e3 in _0x6a5a56[_0xcc84('0x4a')]){if(_0x6a5a56[_0xcc84('0x4a')][_0xcc84('0x49')](_0x1658e3)){if(_0x169b99['agents'][_0x6a5a56['id']]['hasOwnProperty'](_0x1658e3+_0xcc84('0x4b'))){_0x169b99[_0xcc84('0x3d')][_0x6a5a56['id']][_0x1658e3+'CurrentCapacity']=parseInt(_0x6a5a56[_0xcc84('0x4a')][_0x1658e3],0xa);}}}_0x169b99[_0xcc84('0x3d')][_0x6a5a56['id']][_0xcc84('0x4c')]();return _0x599a01({'code':0xc8,'message':_0x169b99[_0xcc84('0x3d')][_0x6a5a56['id']]});}else{return _0x35ed11(_0x450117[_0xcc84('0x45')](0x1f4,_0xcc84('0x4d')));}});},'Agents':function(_0x1424eb){return new Promise(function(_0x566935){var _0x201526=_['values'](_0x169b99['agents']);if(_0x1424eb&&_0x1424eb['id']){var _0x1df575=_['find'](_0x201526,function(_0x8bc55e){return _0x8bc55e['id']===_0x1424eb['id'];});_0x566935(_0x1df575);}else{_0x566935({'count':_0x201526[_0xcc84('0x19')],'rows':_0x201526});}});},'ChatQueues':function(){return new Promise(function(_0x72ddc0){var _0x2b5d11=[];for(var _0x136ef3 in _0x169b99[_0xcc84('0x4e')]){if(_0x169b99['chatQueues'][_0xcc84('0x49')](_0x136ef3)){var _0x3a55a1=_0x169b99['chatQueues'][_0x136ef3];var _0x3fa3d0={'id':_0x3a55a1['id'],'available':_0x3a55a1[_0xcc84('0x4f')],'loggedIn':_0x3a55a1[_0xcc84('0x50')],'name':_0x3a55a1['name'],'paused':_0x3a55a1[_0xcc84('0x51')],'waiting':_0x3a55a1[_0xcc84('0x52')]};_0x2b5d11[_0xcc84('0x1e')](_0x3fa3d0);}}_0x72ddc0({'count':_0x2b5d11['length'],'rows':_0x2b5d11});});},'MailQueues':function(){return new Promise(function(_0x442cf0){var _0x1e3410=[];for(var _0x59f5a0 in _0x169b99[_0xcc84('0x53')]){if(_0x169b99[_0xcc84('0x53')][_0xcc84('0x49')](_0x59f5a0)){var _0x3c3e34=_0x169b99[_0xcc84('0x53')][_0x59f5a0];var _0x4d8540={'id':_0x3c3e34['id'],'available':_0x3c3e34[_0xcc84('0x4f')],'loggedIn':_0x3c3e34[_0xcc84('0x50')],'name':_0x3c3e34['name'],'paused':_0x3c3e34[_0xcc84('0x51')],'waiting':_0x3c3e34[_0xcc84('0x52')]};_0x1e3410['push'](_0x4d8540);}}_0x442cf0({'count':_0x1e3410[_0xcc84('0x19')],'rows':_0x1e3410});});},'OpenchannelQueues':function(){return new Promise(function(_0x516a4d){var _0x4ba935=[];for(var _0x674ab1 in _0x169b99['openchannelQueues']){if(_0x169b99[_0xcc84('0x54')][_0xcc84('0x49')](_0x674ab1)){var _0x800581=_0x169b99['openchannelQueues'][_0x674ab1];var _0x5e2768={'id':_0x800581['id'],'available':_0x800581[_0xcc84('0x4f')],'loggedIn':_0x800581[_0xcc84('0x50')],'name':_0x800581[_0xcc84('0x55')],'paused':_0x800581[_0xcc84('0x51')],'waiting':_0x800581[_0xcc84('0x52')]};_0x4ba935[_0xcc84('0x1e')](_0x5e2768);}}_0x516a4d({'count':_0x4ba935['length'],'rows':_0x4ba935});});},'SmsQueues':function(){return new Promise(function(_0x2d9321){var _0x11446c=[];for(var _0x632c19 in _0x169b99[_0xcc84('0x56')]){if(_0x169b99[_0xcc84('0x56')][_0xcc84('0x49')](_0x632c19)){var _0x23d564=_0x169b99[_0xcc84('0x56')][_0x632c19];var _0x542682={'id':_0x23d564['id'],'available':_0x23d564[_0xcc84('0x4f')],'loggedIn':_0x23d564[_0xcc84('0x50')],'name':_0x23d564[_0xcc84('0x55')],'paused':_0x23d564['paused'],'waiting':_0x23d564[_0xcc84('0x52')]};_0x11446c['push'](_0x542682);}}_0x2d9321({'count':_0x11446c['length'],'rows':_0x11446c});});},'FaxQueues':function(){return new Promise(function(_0x13d3bf){var _0x24f56b=[];for(var _0x243951 in _0x169b99[_0xcc84('0x57')]){if(_0x169b99['faxQueues'][_0xcc84('0x49')](_0x243951)){var _0x53169d=_0x169b99[_0xcc84('0x57')][_0x243951];var _0x1d48b5={'id':_0x53169d['id'],'available':_0x53169d[_0xcc84('0x4f')],'loggedIn':_0x53169d[_0xcc84('0x50')],'name':_0x53169d[_0xcc84('0x55')],'paused':_0x53169d[_0xcc84('0x51')],'waiting':_0x53169d[_0xcc84('0x52')]};_0x24f56b['push'](_0x1d48b5);}}_0x13d3bf({'count':_0x24f56b[_0xcc84('0x19')],'rows':_0x24f56b});});},'WhatsappQueues':function(){return new Promise(function(_0x399c8e){var _0x40ea6e=[];for(var _0x5e059a in _0x169b99[_0xcc84('0x58')]){if(_0x169b99['whatsappQueues'][_0xcc84('0x49')](_0x5e059a)){var _0x459cb7=_0x169b99[_0xcc84('0x58')][_0x5e059a];var _0x5b5d9b={'id':_0x459cb7['id'],'available':_0x459cb7[_0xcc84('0x4f')],'loggedIn':_0x459cb7[_0xcc84('0x50')],'name':_0x459cb7[_0xcc84('0x55')],'paused':_0x459cb7[_0xcc84('0x51')],'waiting':_0x459cb7[_0xcc84('0x52')]};_0x40ea6e[_0xcc84('0x1e')](_0x5b5d9b);}}_0x399c8e({'count':_0x40ea6e['length'],'rows':_0x40ea6e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5255ba){var _0x2e20fe=_['values'](_0x169b99[_0xcc84('0x59')]);_0x5255ba({'count':_0x2e20fe['length'],'rows':_0x2e20fe});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5014e5){var _0x30bfcc=_[_0xcc84('0x5a')](_0x169b99[_0xcc84('0x5b')]);_0x5014e5({'count':_0x30bfcc[_0xcc84('0x19')],'rows':_0x30bfcc});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xebfb26){var _0x2167c1=_[_0xcc84('0x5a')](_0x169b99['openchannelQueuesWaitingInteractions']);_0xebfb26({'count':_0x2167c1[_0xcc84('0x19')],'rows':_0x2167c1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2be335){var _0x57b81a=_[_0xcc84('0x5a')](_0x169b99['smsQueuesWaitingInteractions']);_0x2be335({'count':_0x57b81a[_0xcc84('0x19')],'rows':_0x57b81a});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3305d5){var _0x3277d7=_[_0xcc84('0x5a')](_0x169b99['faxQueuesWaitingInteractions']);_0x3305d5({'count':_0x3277d7[_0xcc84('0x19')],'rows':_0x3277d7});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5cb397){var _0x27f0a8=_['values'](_0x169b99[_0xcc84('0x5c')]);_0x5cb397({'count':_0x27f0a8[_0xcc84('0x19')],'rows':_0x27f0a8});});}};var _0x187975=jayson[_0xcc84('0x5d')](_0x36bda2)[_0xcc84('0x5e')]();_0x187975['on'](_0xcc84('0x45'),function(_0x4ffbd8){logger[_0xcc84('0x45')](JSON[_0xcc84('0x36')](_0x4ffbd8));return _0x5cbd35(_0x4ffbd8);});_0x187975[_0xcc84('0x13')](0x232c,'127.0.0.1',function(){console[_0xcc84('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x419112(_0xcc84('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 811ed97..d52ba0a 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 _0x99e9=['lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','when','info','\x20|\x20'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x99e9,0x168));var _0x999e=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x99e9[_0x364cf8];return _0x6a59ee;};'use strict';var _=require(_0x999e('0x0'));var iftime=require(_0x999e('0x1'))[_0x999e('0x2')];var logger=require(_0x999e('0x3'))(_0x999e('0x4'));exports[_0x999e('0x5')]=function(_0x2beec7,_0x76fb02,_0x12dbbb){return function(_0x25da71){if(_0x12dbbb['rules']&&!_0x12dbbb[_0x999e('0x6')][_0x2beec7]){logger['info'](_0x999e('0x7'),_0x2beec7);return _0x25da71[_0x999e('0x8')]();}var _0x52821b=_0x76fb02[_0x999e('0x9')](function(_0x49cf89){return iftime(_0x49cf89);});var _0x5eff34=_[_0x999e('0xa')](_0x52821b);if(_0x5eff34){logger['info'](_0x999e('0xb'),_0x2beec7,_0x76fb02['join']('\x20|\x20'),_0x5eff34);_0x25da71[_0x999e('0xc')](_0x5eff34);}else{logger[_0x999e('0xd')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x2beec7,_0x76fb02['join'](_0x999e('0xe')));_0x25da71[_0x999e('0x8')]();}};}; \ No newline at end of file +var _0x114a=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','../../../utils/iftime','iftime','../../../config/logger','routing','condition'];(function(_0x12594e,_0x3286c1){var _0x4ea75b=function(_0x57173c){while(--_0x57173c){_0x12594e['push'](_0x12594e['shift']());}};_0x4ea75b(++_0x3286c1);}(_0x114a,0x12b));var _0xa114=function(_0xe1e126,_0x4d5bec){_0xe1e126=_0xe1e126-0x0;var _0x48250d=_0x114a[_0xe1e126];return _0x48250d;};'use strict';var _=require('lodash');var iftime=require(_0xa114('0x0'))[_0xa114('0x1')];var logger=require(_0xa114('0x2'))(_0xa114('0x3'));exports[_0xa114('0x4')]=function(_0x5b060e,_0x2406b2,_0x1f9037){return function(_0x574ca0){if(_0x1f9037[_0xa114('0x5')]&&!_0x1f9037['rules'][_0x5b060e]){logger[_0xa114('0x6')](_0xa114('0x7'),_0x5b060e);return _0x574ca0[_0xa114('0x8')]();}var _0x4a9299=_0x2406b2[_0xa114('0x9')](function(_0x50a719){return iftime(_0x50a719);});var _0x30d292=_[_0xa114('0xa')](_0x4a9299);if(_0x30d292){logger[_0xa114('0x6')](_0xa114('0xb'),_0x5b060e,_0x2406b2[_0xa114('0xc')](_0xa114('0xd')),_0x30d292);_0x574ca0[_0xa114('0xe')](_0x30d292);}else{logger['info'](_0xa114('0xf'),_0x5b060e,_0x2406b2[_0xa114('0xc')]('\x20|\x20'));_0x574ca0[_0xa114('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b973c4e..f794eb8 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 _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x15216f,_0x52a1b1){var _0x2e553e=function(_0x19366e){while(--_0x19366e){_0x15216f['push'](_0x15216f['shift']());}};_0x2e553e(++_0x52a1b1);}(_0x44a3,0x1a9));var _0x344a=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0x44a3[_0x178e71];return _0x3eec6c;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0x6c76=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','info','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','now','lastevent','called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','reason','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere'];(function(_0x35c2d1,_0xdf9722){var _0x5198dc=function(_0x22082a){while(--_0x22082a){_0x35c2d1['push'](_0x35c2d1['shift']());}};_0x5198dc(++_0xdf9722);}(_0x6c76,0x184));var _0x66c7=function(_0x27ba5e,_0x4066f9){_0x27ba5e=_0x27ba5e-0x0;var _0x5404ff=_0x6c76[_0x27ba5e];return _0x5404ff;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var utils=require(_0x66c7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x55604c,_0x203e75){utils[_0x66c7('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x55604c[_0x66c7('0x4')],_0x55604c[_0x66c7('0x5')],_0x55604c['queue'],_0x55604c[_0x66c7('0x6')],_0x55604c[_0x66c7('0x7')],_0x55604c['calleridnum'],_0x55604c[_0x66c7('0x8')],_0x55604c['lastevent']));if(_0x55604c['queue']){utils[_0x66c7('0x9')](_0x55604c[_0x66c7('0xa')])[_0x66c7('0xb')](function(_0x53a81c){if(_0x53a81c){_0x55604c[_0x66c7('0xc')]=_0x53a81c[_0x66c7('0xc')];_0x55604c[_0x66c7('0xd')]=_0x55604c[_0x66c7('0xe')]?_0x53a81c['acw']:![];_0x55604c[_0x66c7('0xf')]=_0x55604c[_0x66c7('0xd')]?_0x53a81c[_0x66c7('0x10')]:0x0;}utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);});}else{utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);}if(_0x203e75){delete transfers[_0x55604c['uniqueid']];}else{delete agents[_0x55604c[_0x66c7('0x13')]];}}exports[_0x66c7('0x14')]=function(_0x35cbc2){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2[_0x66c7('0x4')]),_0x35cbc2);agents[_0x35cbc2[_0x66c7('0x13')]]=_0x35cbc2;agents[_0x35cbc2[_0x66c7('0x13')]]['agentcalledAt']=utils[_0x66c7('0x18')]();agents[_0x35cbc2['destuniqueid']][_0x66c7('0x19')]=_0x66c7('0x1a');agents[_0x35cbc2[_0x66c7('0x13')]][_0x66c7('0x8')]=null;agents[_0x35cbc2[_0x66c7('0x13')]]['connectedlinename']=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35cbc2[_0x66c7('0x4')],agents[_0x35cbc2[_0x66c7('0x13')]]['membername'],_0x35cbc2['destuniqueid']));}catch(_0x256b0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2['uniqueid']),_0x256b0a);}};exports['agentringnoanswer']=function(_0x1853b2){try{if(!_[_0x66c7('0x1c')](agents[_0x1853b2[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x1d'),_0x1853b2['uniqueid']),_0x1853b2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1853b2[_0x66c7('0x4')],agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x1853b2[_0x66c7('0x13')]));agents[_0x1853b2['destuniqueid']][_0x66c7('0x1e')]=!![];agents[_0x1853b2[_0x66c7('0x13')]]['agentringnoanswerAt']=utils[_0x66c7('0x18')]();agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x1f');agents[_0x1853b2[_0x66c7('0x13')]]['reason']='timeout';agents[_0x1853b2['destuniqueid']][_0x66c7('0x20')]=_0x1853b2[_0x66c7('0x21')]?parseInt(_0x1853b2['ringtime'])/0x3e8:0x0;agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x22')]=0x0;unanswered[_0x66c7('0x23')](_0x1853b2[_0x66c7('0x13')]);}}catch(_0x36a830){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x1d'),_0x1853b2[_0x66c7('0x4')]),_0x36a830);}};exports[_0x66c7('0x24')]=function(_0x33be23){try{_[_0x66c7('0x25')](agents,function(_0x592f0e,_0x263b48){if(_0x592f0e['uniqueid']==_0x33be23[_0x66c7('0x4')]&&!_['includes'](unanswered,_0x592f0e[_0x66c7('0x13')])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x33be23);utils[_0x66c7('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x33be23[_0x66c7('0x4')],_0x592f0e[_0x66c7('0x6')],_0x592f0e[_0x66c7('0x13')]));_0x592f0e[_0x66c7('0x1e')]=!![];_0x592f0e[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x592f0e[_0x66c7('0x19')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x29')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x20')]=_0x33be23[_0x66c7('0x20')];_0x592f0e['talktime']=0x0;writeDB(_0x592f0e);}});}catch(_0x562283){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x562283);}};exports[_0x66c7('0x2a')]=function(_0x2bf7c2){try{if(agents[_0x2bf7c2[_0x66c7('0x13')]]){utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2[_0x66c7('0x4')]),_0x2bf7c2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x2c'),_0x2bf7c2[_0x66c7('0x4')],agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x2bf7c2[_0x66c7('0x13')]));agents[_0x2bf7c2[_0x66c7('0x13')]]['agentconnectAt']=utils['now']();agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x8')]=_0x2bf7c2[_0x66c7('0x8')];agents[_0x2bf7c2['destuniqueid']]['connectedlinename']=_0x2bf7c2[_0x66c7('0x2d')];agents[_0x2bf7c2[_0x66c7('0x13')]]['holdtime']=_0x2bf7c2[_0x66c7('0x21')];agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x19')]='connect';_[_0x66c7('0x25')](agents,function(_0x16b754,_0x9f6ca8){if(_0x16b754[_0x66c7('0x13')]!=_0x2bf7c2[_0x66c7('0x13')]&&_0x16b754[_0x66c7('0x4')]==_0x2bf7c2[_0x66c7('0x4')]){_0x16b754[_0x66c7('0x22')]=0x0;_0x16b754[_0x66c7('0x20')]=_0x2bf7c2['ringtime'];_0x16b754[_0x66c7('0x1e')]=!![];_0x16b754[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x16b754[_0x66c7('0x19')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x29')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x2f')]=_0x2bf7c2[_0x66c7('0x13')];_0x16b754[_0x66c7('0x30')]=_0x2bf7c2['membername'];writeDB(_0x16b754);}});}}catch(_0x5bb5fc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2['uniqueid']),_0x5bb5fc);}};exports['agentcomplete']=function(_0x34d002){try{if(!_[_0x66c7('0x1c')](agents[_0x34d002[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')]('[%s][agents][agentcomplete]',_0x34d002[_0x66c7('0x4')]),_0x34d002);utils['info'](util['format'](_0x66c7('0x31'),_0x34d002[_0x66c7('0x4')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x6')],_0x34d002['destuniqueid']));agents[_0x34d002['destuniqueid']][_0x66c7('0xe')]=!![];agents[_0x34d002['destuniqueid']]['agentcompleteAt']=utils[_0x66c7('0x18')]();agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x34d002['destuniqueid']][_0x66c7('0x33')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x34')]);agents[_0x34d002['destuniqueid']][_0x66c7('0x29')]=_0x34d002[_0x66c7('0x29')];agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x35');writeDB(agents[_0x34d002[_0x66c7('0x13')]]);}}catch(_0x2e3f06){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x36'),_0x34d002[_0x66c7('0x4')]),_0x2e3f06);}};exports[_0x66c7('0x37')]=function(_0x1386a2){try{if(!_[_0x66c7('0x1c')](agents[_0x1386a2[_0x66c7('0x38')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x39'),_0x1386a2[_0x66c7('0x4')]),_0x1386a2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x3a'),_0x1386a2[_0x66c7('0x4')],agents[_0x1386a2['transfereruniqueid']][_0x66c7('0x6')],agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')]));agents[_0x1386a2[_0x66c7('0x38')]]['transfer']=!![];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3b')]='blind';agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3c')]=_0x1386a2[_0x66c7('0x3d')];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3e')]=agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')];}}catch(_0x5cd4e9){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')]('[%s][agents][blindtransfer]',_0x1386a2[_0x66c7('0x4')]),_0x5cd4e9);}};exports[_0x66c7('0x3f')]=function(_0x3ef4cf){try{utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x3ef4cf);if(_0x3ef4cf[_0x66c7('0x41')]==_0x3ef4cf[_0x66c7('0x42')]){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x43')]])){utils[_0x66c7('0x3')](util['format'](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf['secondtransfereruniqueid']]['transfertype']=_0x66c7('0x46');agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x47')];agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x41')];}if(_0x3ef4cf[_0x66c7('0x48')]&&agents[_0x3ef4cf['transfereeuniqueid']]){agents[_0x3ef4cf['transfereeuniqueid']][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x48')]]=_['clone'](agents[_0x3ef4cf['transfereeuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x48')]]['calleridnum']=agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4b')]=agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x4b')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x34')]=utils['now']();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x48')]]['agententerreason']=0x2;}}else if(_0x3ef4cf[_0x66c7('0x43')]==_0x3ef4cf['secondtransfererlinkedid']){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x41')]])){utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['origtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3b')]='ATTENDED';agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x4d')];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x43')];}if(_0x3ef4cf[_0x66c7('0x4e')]&&agents[_0x3ef4cf[_0x66c7('0x4e')]]){agents[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x4e')]]=_[_0x66c7('0x4f')](agents[_0x3ef4cf['transfertargetuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4a')]=agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4b')]=agents[_0x3ef4cf[_0x66c7('0x41')]]['calleridname'];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x34')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x2;}}}catch(_0x21eb0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x21eb0a);}};exports[_0x66c7('0x50')]=function(_0x5bca99){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x5bca99);if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]===_0x66c7('0x1f')){if(_0x5bca99[_0x66c7('0x52')]==='21'){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=_0x66c7('0x53');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x53');}utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(agents[_0x5bca99['uniqueid']]);var _0x34d4f7=unanswered['indexOf'](_0x5bca99[_0x66c7('0x4')]);if(_0x34d4f7>-0x1){unanswered[_0x66c7('0x54')](_0x34d4f7,0x1);}}if(transfers[_0x5bca99[_0x66c7('0x4')]]){transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](transfers[_0x5bca99[_0x66c7('0x4')]]['agentcompleteAt'],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]='agent';transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]='complete';utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],transfers[_0x5bca99['uniqueid']]['reason'],transfers[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(transfers[_0x5bca99['uniqueid']],!![]);}if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();agents[_0x5bca99['uniqueid']][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x45')]?_0x66c7('0x45'):_0x66c7('0x56');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x35');utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]));writeDB(agents[_0x5bca99[_0x66c7('0x4')]]);}}catch(_0x331acc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x331acc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 470d5ab..3ca6b3d 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 _0x6c97=['destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','accountcode','destinationchannel','answertime','disposition','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','source','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s'];(function(_0x35f08f,_0x379e38){var _0xb220b8=function(_0x32a0d2){while(--_0x32a0d2){_0x35f08f['push'](_0x35f08f['shift']());}};_0xb220b8(++_0x379e38);}(_0x6c97,0x16b));var _0x76c9=function(_0x50bb53,_0x145dbc){_0x50bb53=_0x50bb53-0x0;var _0x4ad8a7=_0x6c97[_0x50bb53];return _0x4ad8a7;};'use strict';var _=require(_0x76c9('0x0'));var util=require(_0x76c9('0x1'));var utils=require('./utils');var dispositions=[_0x76c9('0x2'),_0x76c9('0x3'),_0x76c9('0x3'),'NO\x20ANSWER',_0x76c9('0x2'),_0x76c9('0x2'),_0x76c9('0x4'),_0x76c9('0x5'),_0x76c9('0x3'),_0x76c9('0x3'),_0x76c9('0x3')];var channels={};function writeDB(_0x2bcc49){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2bcc49['uniqueid'],_0x2bcc49[_0x76c9('0x8')],_0x2bcc49[_0x76c9('0x9')],_0x2bcc49[_0x76c9('0xa')],_0x2bcc49[_0x76c9('0xb')],_0x2bcc49[_0x76c9('0xc')],_0x2bcc49[_0x76c9('0xd')],_0x2bcc49[_0x76c9('0xe')]));if(_0x2bcc49['accountcode']){utils[_0x76c9('0xf')](_0x2bcc49['accountcode'])[_0x76c9('0x10')](function(_0x15c9d1){if(_0x15c9d1){_0x2bcc49[_0x76c9('0x11')]=_0x15c9d1['id'];}utils[_0x76c9('0x12')](_0x76c9('0x13'),_0x2bcc49);});}else{utils[_0x76c9('0x12')]('CreateVoiceCallReport',_0x2bcc49);}if(channels[_0x2bcc49[_0x76c9('0x14')]]){delete channels[_0x2bcc49[_0x76c9('0x14')]];}}exports['newchannel']=function(_0x300681){try{utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][newchannel]',_0x300681['uniqueid']),_0x300681);if(_0x300681[_0x76c9('0x14')]==_0x300681[_0x76c9('0x16')]&&_0x300681[_0x76c9('0x8')]!=_0x76c9('0x17')){utils[_0x76c9('0x6')](util['format'](_0x76c9('0x18'),_0x300681[_0x76c9('0x14')],_0x300681['context'],_0x300681[_0x76c9('0x19')]));channels[_0x300681['uniqueid']]={'uniqueid':_0x300681[_0x76c9('0x14')],'accountcode':_0x300681['accountcode'],'source':_0x300681['calleridnum'],'destination':_0x300681[_0x76c9('0x19')],'destinationcontext':_0x300681[_0x76c9('0x1a')],'channel':_0x300681[_0x76c9('0x8')],'starttime':utils[_0x76c9('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x1fd494){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x1d'),_0x300681[_0x76c9('0x14')]),_0x1fd494);}};exports[_0x76c9('0x1e')]=function(_0x2fec1a){try{utils[_0x76c9('0x15')](util[_0x76c9('0x7')](_0x76c9('0x1f'),_0x2fec1a['uniqueid']),_0x2fec1a);if(!_['isNil'](channels[_0x2fec1a[_0x76c9('0x14')]])&&_0x2fec1a[_0x76c9('0x20')]==0x6){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x21'),_0x2fec1a[_0x76c9('0x14')],_0x2fec1a[_0x76c9('0x1a')],_0x2fec1a[_0x76c9('0x8')]));if(_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x14')]][_0x76c9('0x23')])){channels[_0x2fec1a['uniqueid']][_0x76c9('0x23')]=utils[_0x76c9('0x1b')]();}}else if(!_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x16')]])&&_0x2fec1a['channelstate']==0x6&&_0x2fec1a[_0x76c9('0x1a')]!=_0x76c9('0x24')){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2fec1a[_0x76c9('0x14')],_0x2fec1a[_0x76c9('0x16')],_0x2fec1a['context'],_0x2fec1a['channel']));channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x25')]=_0x2fec1a[_0x76c9('0x25')];channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x26')]=_0x2fec1a['channel'];if(_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x16')]]['answertime'])){channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x27')]=utils['now']();}channels[_0x2fec1a['linkedid']][_0x76c9('0x28')]=dispositions[_['toNumber'](_0x2fec1a['channelstate'])]||_0x76c9('0x4');}}catch(_0x12bc28){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x1f'),_0x2fec1a[_0x76c9('0x14')]),_0x12bc28);}};exports['hangup']=function(_0x87a262){try{if(!_[_0x76c9('0x22')](channels[_0x87a262[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][hangup]',_0x87a262[_0x76c9('0x14')]),_0x87a262);if(_['isNil'](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')])){channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')]=_0x87a262[_0x76c9('0x2a')]+'\x20<'+_0x87a262[_0x76c9('0xc')]+'>';}utils['info'](util[_0x76c9('0x7')](_0x76c9('0x2b'),_0x87a262[_0x76c9('0x14')],channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')],_0x87a262['cause-txt']));channels[_0x87a262['uniqueid']][_0x76c9('0x2c')]=utils['now']();channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2d')]=utils[_0x76c9('0x2e')](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2c')],channels[_0x87a262['uniqueid']][_0x76c9('0x2f')]);channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x30')]=channels[_0x87a262[_0x76c9('0x14')]]['answertime']?utils['diffTime'](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2c')],channels[_0x87a262['uniqueid']][_0x76c9('0x27')]):0x0;writeDB(channels[_0x87a262[_0x76c9('0x14')]]);}}catch(_0x2473ef){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x31'),_0x87a262[_0x76c9('0x14')]),_0x2473ef);}};exports[_0x76c9('0x32')]=function(_0x1f1227){try{if(!_[_0x76c9('0x22')](channels[_0x1f1227[_0x76c9('0x33')]])){utils['debug'](util[_0x76c9('0x7')](_0x76c9('0x34'),_0x1f1227[_0x76c9('0x35')]),_0x1f1227);if(channels[_0x1f1227[_0x76c9('0x33')]]['channel']==_0x1f1227[_0x76c9('0x36')]){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x37'),_0x1f1227[_0x76c9('0x35')],_0x1f1227[_0x76c9('0x33')],_0x1f1227['secondtransfererchannel']));channels[_0x1f1227[_0x76c9('0x33')]]['destinationchannel']=_0x1f1227['secondtransfererchannel'];channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x38')]=_0x76c9('0x39');}else if(channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x8')]=_0x1f1227[_0x76c9('0x3a')]){utils[_0x76c9('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1f1227[_0x76c9('0x35')],_0x1f1227[_0x76c9('0x33')],_0x1f1227[_0x76c9('0x3b')]));channels[_0x1f1227[_0x76c9('0x33')]]['destinationchannel']=_0x1f1227[_0x76c9('0x3b')];channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x38')]='_attended';}}}catch(_0x5a091b){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x34'),_0x1f1227[_0x76c9('0x35')]),_0x5a091b);}};exports[_0x76c9('0x3c')]=function(_0x38c0ac){try{if(!_[_0x76c9('0x22')](channels[_0x38c0ac[_0x76c9('0x14')]])){utils['debug'](util[_0x76c9('0x7')](_0x76c9('0x3d'),_0x38c0ac[_0x76c9('0x14')]),_0x38c0ac);channels[_0x38c0ac[_0x76c9('0x14')]][_0x76c9('0x3e')]=utils[_0x76c9('0x1b')]();utils['info'](util[_0x76c9('0x7')](_0x76c9('0x3f'),_0x38c0ac[_0x76c9('0x14')],channels[_0x38c0ac[_0x76c9('0x14')]][_0x76c9('0x3e')]));}}catch(_0x57d49b){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x3d'),_0x38c0ac['uniqueid']),_0x57d49b);}};exports['musiconholdstop']=function(_0x582821){try{if(!_['isNil'](channels[_0x582821[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')](_0x76c9('0x40'),_0x582821['uniqueid']),_0x582821);if(!_[_0x76c9('0x22')](channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x3e')])){channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x41')]+=utils[_0x76c9('0x2e')](utils['now'](),channels[_0x582821['uniqueid']][_0x76c9('0x3e')]);utils[_0x76c9('0x6')](util['format'](_0x76c9('0x42'),_0x582821[_0x76c9('0x14')],channels[_0x582821['uniqueid']][_0x76c9('0x41')]));delete channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x3e')];}}}catch(_0x2817e7){utils[_0x76c9('0x1c')](util[_0x76c9('0x7')](_0x76c9('0x40'),_0x582821[_0x76c9('0x14')]),_0x2817e7);}};exports[_0x76c9('0x43')]=function(_0x1bb971){try{if(!_[_0x76c9('0x22')](channels[_0x1bb971[_0x76c9('0x14')]])){utils['debug'](util[_0x76c9('0x7')]('[%s][calls][varset]',_0x1bb971[_0x76c9('0x14')]),_0x1bb971);if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x44')])){utils['info'](util[_0x76c9('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1bb971[_0x76c9('0x14')],_0x1bb971['value']));channels[_0x1bb971['uniqueid']][_0x76c9('0x45')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')]['xmd-phone'])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x48'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x49')]=_0x1bb971[_0x76c9('0x46')];channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x29')]='\x22'+_0x1bb971[_0x76c9('0x46')]+_0x76c9('0x4a')+_0x1bb971[_0x76c9('0x46')]+'>';}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4b')])||!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4c')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x4d'),_0x1bb971[_0x76c9('0x14')],!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4b')])?_0x76c9('0x4b'):_0x76c9('0x4c'),_0x1bb971['value']));channels[_0x1bb971['uniqueid']][_0x76c9('0x29')]=_0x1bb971[_0x76c9('0x46')];}if(!_['isNil'](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4e')])||!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')]['xmcs-queue'])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x4d'),_0x1bb971[_0x76c9('0x14')],!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x4e')])?'xmd-queue':_0x76c9('0x4f'),_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x50')]=_0x76c9('0x51');channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x52')]=_0x1bb971[_0x76c9('0x46')];channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x9')]=!![];}if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x53')])){utils[_0x76c9('0x6')](util['format'](_0x76c9('0x54'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x55')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x56')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x57'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x58')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x59')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x5a')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x5b')])){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x5c'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x5b')]=_0x1bb971[_0x76c9('0x46')];}}}catch(_0x5585de){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x5d'),_0x1bb971['uniqueid']),_0x5585de);}};exports[_0x76c9('0x5e')]=function(_0x43c44b){try{if(!_[_0x76c9('0x22')](channels[_0x43c44b[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][newexten]',_0x43c44b[_0x76c9('0x14')]),_0x43c44b);utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x5f'),_0x43c44b[_0x76c9('0x14')],_0x43c44b[_0x76c9('0x60')],_0x43c44b[_0x76c9('0x61')]));if(_0x43c44b[_0x76c9('0x60')][_0x76c9('0x62')]()=='set'&&_[_0x76c9('0x63')](_0x43c44b[_0x76c9('0x61')][_0x76c9('0x62')](),_0x76c9('0x64'))){var _0x42669b=_0x43c44b[_0x76c9('0x61')][_0x76c9('0x65')]('=');var _0x56aee5=_0x42669b[0x0][_0x76c9('0x66')](_0x42669b[0x0]['lastIndexOf']('(')+0x1,_0x42669b[0x0][_0x76c9('0x67')](')'));var _0x20a940=_0x42669b[0x1];channels[_0x43c44b['uniqueid']][_0x56aee5]=_0x20a940;}if(!_['includes']([_0x76c9('0x68'),_0x76c9('0x69'),_0x76c9('0x6a'),'set',_0x76c9('0x6b')],_0x43c44b['application']['toLowerCase']())){channels[_0x43c44b['uniqueid']][_0x76c9('0x50')]=_0x43c44b[_0x76c9('0x60')];channels[_0x43c44b['uniqueid']]['lastdata']=_0x43c44b[_0x76c9('0x61')];}}}catch(_0x3a136d){utils[_0x76c9('0x1c')](util[_0x76c9('0x7')](_0x76c9('0x6c'),_0x43c44b[_0x76c9('0x14')]),_0x3a136d);}}; \ No newline at end of file +var _0x5923=['ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','application','appdata','toLowerCase','set','startsWith','split','includes','hangup','noop','gotoif','lastdata','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED'];(function(_0x1a509d,_0x52842c){var _0x47ae10=function(_0x48c6e1){while(--_0x48c6e1){_0x1a509d['push'](_0x1a509d['shift']());}};_0x47ae10(++_0x52842c);}(_0x5923,0x19c));var _0x3592=function(_0x28f1e,_0x23a273){_0x28f1e=_0x28f1e-0x0;var _0x3bcbe9=_0x5923[_0x28f1e];return _0x3bcbe9;};'use strict';var _=require(_0x3592('0x0'));var util=require(_0x3592('0x1'));var utils=require('./utils');var dispositions=[_0x3592('0x2'),_0x3592('0x3'),_0x3592('0x3'),'NO\x20ANSWER',_0x3592('0x2'),_0x3592('0x2'),_0x3592('0x4'),_0x3592('0x5'),'FAILED','FAILED',_0x3592('0x3')];var channels={};function writeDB(_0x12bd1d){utils[_0x3592('0x6')](util['format'](_0x3592('0x7'),_0x12bd1d['uniqueid'],_0x12bd1d[_0x3592('0x8')],_0x12bd1d['queue'],_0x12bd1d[_0x3592('0x9')],_0x12bd1d[_0x3592('0xa')],_0x12bd1d[_0x3592('0xb')],_0x12bd1d[_0x3592('0xc')],_0x12bd1d[_0x3592('0xd')]));if(_0x12bd1d[_0x3592('0xe')]){utils[_0x3592('0xf')](_0x12bd1d[_0x3592('0xe')])[_0x3592('0x10')](function(_0x451e7d){if(_0x451e7d){_0x12bd1d[_0x3592('0x11')]=_0x451e7d['id'];}utils[_0x3592('0x12')](_0x3592('0x13'),_0x12bd1d);});}else{utils[_0x3592('0x12')]('CreateVoiceCallReport',_0x12bd1d);}if(channels[_0x12bd1d['uniqueid']]){delete channels[_0x12bd1d[_0x3592('0x14')]];}}exports[_0x3592('0x15')]=function(_0x17799a){try{utils[_0x3592('0x16')](util['format'](_0x3592('0x17'),_0x17799a['uniqueid']),_0x17799a);if(_0x17799a[_0x3592('0x14')]==_0x17799a[_0x3592('0x18')]&&_0x17799a['channel']!='OutgoingSpoolFailed'){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x1a'),_0x17799a[_0x3592('0x14')],_0x17799a[_0x3592('0x1b')],_0x17799a[_0x3592('0x1c')]));channels[_0x17799a[_0x3592('0x14')]]={'uniqueid':_0x17799a[_0x3592('0x14')],'accountcode':_0x17799a[_0x3592('0xe')],'source':_0x17799a[_0x3592('0xb')],'destination':_0x17799a[_0x3592('0x1c')],'destinationcontext':_0x17799a[_0x3592('0x1b')],'channel':_0x17799a[_0x3592('0x8')],'starttime':utils[_0x3592('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3592('0x2'),'amaflags':_0x3592('0x1e')};}}catch(_0x2db7f8){utils[_0x3592('0x1f')](util[_0x3592('0x19')](_0x3592('0x17'),_0x17799a[_0x3592('0x14')]),_0x2db7f8);}};exports[_0x3592('0x20')]=function(_0x531786){try{utils[_0x3592('0x16')](util[_0x3592('0x19')](_0x3592('0x21'),_0x531786[_0x3592('0x14')]),_0x531786);if(!_['isNil'](channels[_0x531786[_0x3592('0x14')]])&&_0x531786[_0x3592('0x22')]==0x6){utils['info'](util[_0x3592('0x19')](_0x3592('0x23'),_0x531786['uniqueid'],_0x531786['context'],_0x531786[_0x3592('0x8')]));if(_['isNil'](channels[_0x531786[_0x3592('0x14')]][_0x3592('0x24')])){channels[_0x531786[_0x3592('0x14')]][_0x3592('0x24')]=utils[_0x3592('0x1d')]();}}else if(!_[_0x3592('0x25')](channels[_0x531786[_0x3592('0x18')]])&&_0x531786[_0x3592('0x22')]==0x6&&_0x531786['context']!=_0x3592('0x26')){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x27'),_0x531786[_0x3592('0x14')],_0x531786['linkedid'],_0x531786['context'],_0x531786[_0x3592('0x8')]));channels[_0x531786[_0x3592('0x18')]]['accountcode']=_0x531786[_0x3592('0xe')];channels[_0x531786[_0x3592('0x18')]][_0x3592('0x28')]=_0x531786[_0x3592('0x8')];if(_[_0x3592('0x25')](channels[_0x531786[_0x3592('0x18')]][_0x3592('0x29')])){channels[_0x531786[_0x3592('0x18')]][_0x3592('0x29')]=utils[_0x3592('0x1d')]();}channels[_0x531786[_0x3592('0x18')]][_0x3592('0x2a')]=dispositions[_[_0x3592('0x2b')](_0x531786[_0x3592('0x22')])]||'ANSWERED';}}catch(_0x1faa91){utils[_0x3592('0x1f')](util[_0x3592('0x19')](_0x3592('0x21'),_0x531786['uniqueid']),_0x1faa91);}};exports['hangup']=function(_0x3a4cfc){try{if(!_[_0x3592('0x25')](channels[_0x3a4cfc[_0x3592('0x14')]])){utils['debug'](util['format'](_0x3592('0x2c'),_0x3a4cfc[_0x3592('0x14')]),_0x3a4cfc);if(_[_0x3592('0x25')](channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x2d')])){channels[_0x3a4cfc['uniqueid']][_0x3592('0x2d')]=_0x3a4cfc[_0x3592('0x2e')]+'\x20<'+_0x3a4cfc[_0x3592('0xb')]+'>';}utils[_0x3592('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3a4cfc['uniqueid'],channels[_0x3a4cfc[_0x3592('0x14')]]['callerid'],_0x3a4cfc['cause-txt']));channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x2f')]=utils[_0x3592('0x1d')]();channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x30')]=utils[_0x3592('0x31')](channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x2f')],channels[_0x3a4cfc[_0x3592('0x14')]]['starttime']);channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x32')]=channels[_0x3a4cfc[_0x3592('0x14')]]['answertime']?utils[_0x3592('0x31')](channels[_0x3a4cfc['uniqueid']][_0x3592('0x2f')],channels[_0x3a4cfc[_0x3592('0x14')]][_0x3592('0x29')]):0x0;writeDB(channels[_0x3a4cfc[_0x3592('0x14')]]);}}catch(_0x164b27){utils['error'](util[_0x3592('0x19')](_0x3592('0x2c'),_0x3a4cfc['uniqueid']),_0x164b27);}};exports[_0x3592('0x33')]=function(_0x1aac12){try{if(!_[_0x3592('0x25')](channels[_0x1aac12[_0x3592('0x34')]])){utils['debug'](util[_0x3592('0x19')](_0x3592('0x35'),_0x1aac12[_0x3592('0x36')]),_0x1aac12);if(channels[_0x1aac12[_0x3592('0x34')]][_0x3592('0x8')]==_0x1aac12['transfereechannel']){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x37'),_0x1aac12['origtransfereruniqueid'],_0x1aac12[_0x3592('0x34')],_0x1aac12[_0x3592('0x38')]));channels[_0x1aac12[_0x3592('0x34')]]['destinationchannel']=_0x1aac12[_0x3592('0x38')];channels[_0x1aac12[_0x3592('0x34')]][_0x3592('0x39')]=_0x3592('0x3a');}else if(channels[_0x1aac12[_0x3592('0x34')]]['channel']=_0x1aac12[_0x3592('0x3b')]){utils[_0x3592('0x6')](util['format'](_0x3592('0x37'),_0x1aac12['origtransfereruniqueid'],_0x1aac12[_0x3592('0x34')],_0x1aac12[_0x3592('0x3c')]));channels[_0x1aac12[_0x3592('0x34')]][_0x3592('0x28')]=_0x1aac12[_0x3592('0x3c')];channels[_0x1aac12[_0x3592('0x34')]]['userfield']='_attended';}}}catch(_0x3f0aa3){utils['error'](util[_0x3592('0x19')]('[%s][calls][attendedtransfer]',_0x1aac12[_0x3592('0x36')]),_0x3f0aa3);}};exports[_0x3592('0x3d')]=function(_0x2d80d9){try{if(!_[_0x3592('0x25')](channels[_0x2d80d9[_0x3592('0x14')]])){utils['debug'](util[_0x3592('0x19')]('[%s][calls][musiconholdstart]',_0x2d80d9['uniqueid']),_0x2d80d9);channels[_0x2d80d9[_0x3592('0x14')]][_0x3592('0x3e')]=utils[_0x3592('0x1d')]();utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x3f'),_0x2d80d9['uniqueid'],channels[_0x2d80d9[_0x3592('0x14')]][_0x3592('0x3e')]));}}catch(_0x163a2f){utils[_0x3592('0x1f')](util[_0x3592('0x19')](_0x3592('0x40'),_0x2d80d9[_0x3592('0x14')]),_0x163a2f);}};exports['musiconholdstop']=function(_0x578310){try{if(!_[_0x3592('0x25')](channels[_0x578310[_0x3592('0x14')]])){utils[_0x3592('0x16')](util[_0x3592('0x19')](_0x3592('0x41'),_0x578310[_0x3592('0x14')]),_0x578310);if(!_[_0x3592('0x25')](channels[_0x578310['uniqueid']]['musiconholdstartAt'])){channels[_0x578310[_0x3592('0x14')]][_0x3592('0x42')]+=utils['diffTime'](utils['now'](),channels[_0x578310[_0x3592('0x14')]][_0x3592('0x3e')]);utils[_0x3592('0x6')](util[_0x3592('0x19')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x578310[_0x3592('0x14')],channels[_0x578310['uniqueid']]['mohtime']));delete channels[_0x578310[_0x3592('0x14')]][_0x3592('0x3e')];}}}catch(_0x550fb9){utils['error'](util[_0x3592('0x19')](_0x3592('0x41'),_0x578310[_0x3592('0x14')]),_0x550fb9);}};exports[_0x3592('0x43')]=function(_0x2ae42e){try{if(!_['isNil'](channels[_0x2ae42e['uniqueid']])){utils[_0x3592('0x16')](util['format'](_0x3592('0x44'),_0x2ae42e[_0x3592('0x14')]),_0x2ae42e);if(!_['isNil'](_0x2ae42e[_0x3592('0x45')][_0x3592('0x46')])){utils['info'](util[_0x3592('0x19')](_0x3592('0x47'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e['value']));channels[_0x2ae42e[_0x3592('0x14')]]['source']=_0x2ae42e[_0x3592('0x48')];}if(!_[_0x3592('0x25')](_0x2ae42e[_0x3592('0x45')][_0x3592('0x49')])){utils['info'](util[_0x3592('0x19')](_0x3592('0x4a'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e[_0x3592('0x48')]));channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x4b')]=_0x2ae42e[_0x3592('0x48')];channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x2d')]='\x22'+_0x2ae42e[_0x3592('0x48')]+'\x22\x20<'+_0x2ae42e[_0x3592('0x48')]+'>';}if(!_[_0x3592('0x25')](_0x2ae42e[_0x3592('0x45')]['xmd-callerid-preview'])||!_[_0x3592('0x25')](_0x2ae42e['variable'][_0x3592('0x4c')])){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x4d'),_0x2ae42e[_0x3592('0x14')],!_['isNil'](_0x2ae42e[_0x3592('0x45')][_0x3592('0x4e')])?_0x3592('0x4e'):_0x3592('0x4c'),_0x2ae42e[_0x3592('0x48')]));channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x2d')]=_0x2ae42e[_0x3592('0x48')];}if(!_[_0x3592('0x25')](_0x2ae42e[_0x3592('0x45')][_0x3592('0x4f')])||!_[_0x3592('0x25')](_0x2ae42e[_0x3592('0x45')][_0x3592('0x50')])){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x4d'),_0x2ae42e['uniqueid'],!_[_0x3592('0x25')](_0x2ae42e['variable'][_0x3592('0x4f')])?'xmd-queue':_0x3592('0x50'),_0x2ae42e['value']));channels[_0x2ae42e[_0x3592('0x14')]]['lastapplication']='Queue';channels[_0x2ae42e[_0x3592('0x14')]]['lastdata']=_0x2ae42e[_0x3592('0x48')];channels[_0x2ae42e[_0x3592('0x14')]]['queue']=!![];}if(!_['isNil'](_0x2ae42e[_0x3592('0x45')][_0x3592('0x51')])){utils[_0x3592('0x6')](util['format'](_0x3592('0x52'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e[_0x3592('0x48')]));channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x53')]=_0x2ae42e[_0x3592('0x48')];}if(!_[_0x3592('0x25')](_0x2ae42e[_0x3592('0x45')][_0x3592('0x54')])){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x55'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e['value']));channels[_0x2ae42e['uniqueid']]['type']=_0x2ae42e['value'];}if(!_['isNil'](_0x2ae42e['variable'][_0x3592('0x56')])){utils[_0x3592('0x6')](util['format'](_0x3592('0x57'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e[_0x3592('0x48')]));channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x58')]=_0x2ae42e[_0x3592('0x48')];}if(!_['isNil'](_0x2ae42e[_0x3592('0x45')]['sipcallid'])){utils[_0x3592('0x6')](util[_0x3592('0x19')](_0x3592('0x59'),_0x2ae42e[_0x3592('0x14')],_0x2ae42e[_0x3592('0x48')]));channels[_0x2ae42e[_0x3592('0x14')]][_0x3592('0x5a')]=_0x2ae42e[_0x3592('0x48')];}}}catch(_0x2e0b8d){utils[_0x3592('0x1f')](util['format'](_0x3592('0x44'),_0x2ae42e[_0x3592('0x14')]),_0x2e0b8d);}};exports[_0x3592('0x5b')]=function(_0x51e086){try{if(!_[_0x3592('0x25')](channels[_0x51e086[_0x3592('0x14')]])){utils[_0x3592('0x16')](util[_0x3592('0x19')]('[%s][calls][newexten]',_0x51e086['uniqueid']),_0x51e086);utils[_0x3592('0x6')](util[_0x3592('0x19')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x51e086[_0x3592('0x14')],_0x51e086[_0x3592('0x5c')],_0x51e086[_0x3592('0x5d')]));if(_0x51e086[_0x3592('0x5c')][_0x3592('0x5e')]()==_0x3592('0x5f')&&_[_0x3592('0x60')](_0x51e086[_0x3592('0x5d')][_0x3592('0x5e')](),'cdr')){var _0x2d23d6=_0x51e086[_0x3592('0x5d')][_0x3592('0x61')]('=');var _0xf5b96d=_0x2d23d6[0x0]['substring'](_0x2d23d6[0x0]['lastIndexOf']('(')+0x1,_0x2d23d6[0x0]['lastIndexOf'](')'));var _0x19f8f2=_0x2d23d6[0x1];channels[_0x51e086[_0x3592('0x14')]][_0xf5b96d]=_0x19f8f2;}if(!_[_0x3592('0x62')]([_0x3592('0x63'),_0x3592('0x64'),'execif',_0x3592('0x5f'),_0x3592('0x65')],_0x51e086['application']['toLowerCase']())){channels[_0x51e086['uniqueid']]['lastapplication']=_0x51e086[_0x3592('0x5c')];channels[_0x51e086['uniqueid']][_0x3592('0x66')]=_0x51e086['appdata'];}}}catch(_0x4d5657){utils[_0x3592('0x1f')](util[_0x3592('0x19')](_0x3592('0x67'),_0x51e086[_0x3592('0x14')]),_0x4d5657);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d59c61a..fd86670 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 _0x8662=['fullybooted','[core]\x20fullybooted','error','managerevent','./utils','info','[core]\x20connected'];(function(_0x5be99a,_0x416aba){var _0x4786f7=function(_0x2def91){while(--_0x2def91){_0x5be99a['push'](_0x5be99a['shift']());}};_0x4786f7(++_0x416aba);}(_0x8662,0x185));var _0x2866=function(_0x1d5dc7,_0x266ee5){_0x1d5dc7=_0x1d5dc7-0x0;var _0x6cd4f2=_0x8662[_0x1d5dc7];return _0x6cd4f2;};'use strict';var utils=require(_0x2866('0x0'));exports['connect']=function(){utils[_0x2866('0x1')](_0x2866('0x2'));};exports['shutdown']=function(){utils[_0x2866('0x1')]('[core]\x20shutdown');};exports[_0x2866('0x3')]=function(){utils['info'](_0x2866('0x4'));};exports['error']=function(_0x4213eb){utils[_0x2866('0x5')]('[core]\x20error',_0x4213eb);};exports['close']=function(){utils[_0x2866('0x1')]('[core]\x20close');};exports[_0x2866('0x6')]=function(_0x3d1b8c){}; \ No newline at end of file +var _0x6fe4=['shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x170c09,_0x322d12){var _0x16aa92=function(_0xc5ea0f){while(--_0xc5ea0f){_0x170c09['push'](_0x170c09['shift']());}};_0x16aa92(++_0x322d12);}(_0x6fe4,0x151));var _0x46fe=function(_0xc8ee10,_0x5a24f5){_0xc8ee10=_0xc8ee10-0x0;var _0x42fa0d=_0x6fe4[_0xc8ee10];return _0x42fa0d;};'use strict';var utils=require(_0x46fe('0x0'));exports[_0x46fe('0x1')]=function(){utils[_0x46fe('0x2')](_0x46fe('0x3'));};exports[_0x46fe('0x4')]=function(){utils['info'](_0x46fe('0x5'));};exports['fullybooted']=function(){utils['info'](_0x46fe('0x6'));};exports[_0x46fe('0x7')]=function(_0x219a26){utils[_0x46fe('0x7')](_0x46fe('0x8'),_0x219a26);};exports[_0x46fe('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0x46fe('0xa')]=function(_0x49456f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bdb131c..20d16e4 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 _0x74e8=['connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','calleridname','complete','duration','diffTime','billableseconds','endtime','lodash','util','./utils','info','uniqueid','channel','dialstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74e8,0x191));var _0x874e=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x74e8[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x874e('0x0'));var util=require(_0x874e('0x1'));var utils=require(_0x874e('0x2'));var dials={};function writeDB(_0x292c73){utils[_0x874e('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x292c73[_0x874e('0x4')],_0x292c73[_0x874e('0x5')],_0x292c73[_0x874e('0x6')],_0x292c73['calleridnum'],_0x292c73[_0x874e('0x7')],_0x292c73[_0x874e('0x8')]));utils[_0x874e('0x9')](_0x874e('0xa'),_0x292c73);delete dials[_0x292c73['uniqueid']];}exports[_0x874e('0xb')]=function(_0xf8ef1a){try{utils[_0x874e('0xc')](util[_0x874e('0xd')](_0x874e('0xe'),_0xf8ef1a['uniqueid']),_0xf8ef1a);utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0xf'),_0xf8ef1a[_0x874e('0x4')],_0xf8ef1a[_0x874e('0x10')],_0xf8ef1a[_0x874e('0x11')]));if(_0xf8ef1a['application'][_0x874e('0x12')]()==_0x874e('0x13')&&_[_0x874e('0x14')](_0xf8ef1a['appdata']['toLowerCase'](),'cdr(routeid)')){var _0x5c6bd5=_0xf8ef1a['appdata'][_0x874e('0x15')]('=');dials[_0xf8ef1a[_0x874e('0x4')]]={'routeId':_0x5c6bd5[0x1]};}}catch(_0x51132e){utils[_0x874e('0x16')](util[_0x874e('0xd')]('[%s][dials][newexten]',_0xf8ef1a[_0x874e('0x4')]),_0x51132e);}};exports[_0x874e('0x17')]=function(_0x4a0ab4){try{utils['debug'](util[_0x874e('0xd')](_0x874e('0x18'),_0x4a0ab4[_0x874e('0x4')]),_0x4a0ab4);if(!_['isNil'](_0x4a0ab4[_0x874e('0x19')][_0x874e('0x1a')])){utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0x1b'),_0x4a0ab4[_0x874e('0x4')],_0x4a0ab4[_0x874e('0x1c')]));dials[_0x4a0ab4[_0x874e('0x4')]]={'routeId':_0x4a0ab4[_0x874e('0x1c')]};}}catch(_0x37c463){utils[_0x874e('0x16')](util[_0x874e('0xd')](_0x874e('0x18'),_0x4a0ab4['uniqueid']),_0x37c463);}};exports[_0x874e('0x1d')]=function(_0x2543dc){try{if(!_[_0x874e('0x1e')](dials[_0x2543dc[_0x874e('0x4')]])){utils[_0x874e('0xc')](util['format']('[%s][dials][dialbegin]',_0x2543dc[_0x874e('0x4')]),_0x2543dc);dials[_0x2543dc[_0x874e('0x4')]]=_['assign'](dials[_0x2543dc[_0x874e('0x4')]],_0x2543dc);dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x1f')]=utils[_0x874e('0x20')]();dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x21')]=_0x874e('0x22');utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0x23'),_0x2543dc[_0x874e('0x4')],dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x1f')]));}}catch(_0xb5e78d){utils[_0x874e('0x16')](util[_0x874e('0xd')](_0x874e('0x24'),_0x2543dc['uniqueid']),_0xb5e78d);}};exports[_0x874e('0x25')]=function(_0x32b66c){try{if(!_[_0x874e('0x1e')](dials[_0x32b66c['uniqueid']])){utils[_0x874e('0xc')](util[_0x874e('0xd')](_0x874e('0x26'),_0x32b66c[_0x874e('0x4')]),_0x32b66c);dials[_0x32b66c['uniqueid']][_0x874e('0x8')]=_0x32b66c[_0x874e('0x8')];if(_0x32b66c[_0x874e('0x8')]==_0x874e('0x27')){dials[_0x32b66c['uniqueid']]=_['assign'](dials[_0x32b66c[_0x874e('0x4')]],_0x32b66c);dials[_0x32b66c[_0x874e('0x4')]]['answertime']=utils[_0x874e('0x20')]();dials[_0x32b66c[_0x874e('0x4')]][_0x874e('0x21')]='connect';utils[_0x874e('0x3')](util['format'](_0x874e('0x28'),_0x32b66c[_0x874e('0x4')],_0x32b66c[_0x874e('0x8')],dials[_0x32b66c['uniqueid']][_0x874e('0x29')]));}else{utils[_0x874e('0x3')](util['format'](_0x874e('0x2a'),_0x32b66c[_0x874e('0x4')],_0x32b66c[_0x874e('0x8')]));}}}catch(_0x4de957){utils[_0x874e('0x16')](util['format'](_0x874e('0x26'),_0x32b66c[_0x874e('0x4')]),_0x4de957);}};exports[_0x874e('0x2b')]=function(_0x4167c6){try{if(!_['isNil'](dials[_0x4167c6[_0x874e('0x4')]])){utils[_0x874e('0xc')](util[_0x874e('0xd')]('[%s][dials][hangup]',_0x4167c6[_0x874e('0x4')]),_0x4167c6);utils[_0x874e('0x3')](util[_0x874e('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4167c6[_0x874e('0x4')],_0x4167c6[_0x874e('0x2c')],_0x4167c6[_0x874e('0x2d')],_0x4167c6['cause-txt']));dials[_0x4167c6[_0x874e('0x4')]]=_['assign'](dials[_0x4167c6['uniqueid']],{'endtime':utils[_0x874e('0x20')](),'lastevent':_0x874e('0x2e')});dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x2f')]=utils['diffTime'](dials[_0x4167c6[_0x874e('0x4')]]['endtime'],dials[_0x4167c6['uniqueid']][_0x874e('0x1f')]);dials[_0x4167c6[_0x874e('0x4')]]['holdtime']=utils[_0x874e('0x30')](dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x29')]||dials[_0x4167c6[_0x874e('0x4')]]['endtime'],dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x1f')]);dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x31')]=dials[_0x4167c6['uniqueid']][_0x874e('0x29')]?utils[_0x874e('0x30')](dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x32')],dials[_0x4167c6[_0x874e('0x4')]]['answertime']):0x0;writeDB(dials[_0x4167c6[_0x874e('0x4')]]);}}catch(_0x12d6ae){utils['error'](util['format']('[%s][dials][hangup]',_0x4167c6[_0x874e('0x4')]),_0x12d6ae);}}; \ No newline at end of file +var _0xa390=['calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x5a259b,_0x4ac710){var _0x2de7ea=function(_0x2552db){while(--_0x2552db){_0x5a259b['push'](_0x5a259b['shift']());}};_0x2de7ea(++_0x4ac710);}(_0xa390,0xdb));var _0x0a39=function(_0x597ae3,_0x5b9563){_0x597ae3=_0x597ae3-0x0;var _0x7af9ed=_0xa390[_0x597ae3];return _0x7af9ed;};'use strict';var _=require(_0x0a39('0x0'));var util=require(_0x0a39('0x1'));var utils=require(_0x0a39('0x2'));var dials={};function writeDB(_0x32e5a2){utils['info'](util[_0x0a39('0x3')](_0x0a39('0x4'),_0x32e5a2[_0x0a39('0x5')],_0x32e5a2[_0x0a39('0x6')],_0x32e5a2['dialstring'],_0x32e5a2[_0x0a39('0x7')],_0x32e5a2[_0x0a39('0x8')],_0x32e5a2[_0x0a39('0x9')]));utils[_0x0a39('0xa')](_0x0a39('0xb'),_0x32e5a2);delete dials[_0x32e5a2[_0x0a39('0x5')]];}exports[_0x0a39('0xc')]=function(_0x4e0587){try{utils[_0x0a39('0xd')](util[_0x0a39('0x3')](_0x0a39('0xe'),_0x4e0587[_0x0a39('0x5')]),_0x4e0587);utils[_0x0a39('0xf')](util[_0x0a39('0x3')](_0x0a39('0x10'),_0x4e0587['uniqueid'],_0x4e0587[_0x0a39('0x11')],_0x4e0587[_0x0a39('0x12')]));if(_0x4e0587['application'][_0x0a39('0x13')]()==_0x0a39('0x14')&&_['startsWith'](_0x4e0587[_0x0a39('0x12')]['toLowerCase'](),_0x0a39('0x15'))){var _0x1b4092=_0x4e0587['appdata'][_0x0a39('0x16')]('=');dials[_0x4e0587[_0x0a39('0x5')]]={'routeId':_0x1b4092[0x1]};}}catch(_0x2781f4){utils[_0x0a39('0x17')](util[_0x0a39('0x3')]('[%s][dials][newexten]',_0x4e0587[_0x0a39('0x5')]),_0x2781f4);}};exports[_0x0a39('0x18')]=function(_0x2dcdcc){try{utils['debug'](util[_0x0a39('0x3')](_0x0a39('0x19'),_0x2dcdcc[_0x0a39('0x5')]),_0x2dcdcc);if(!_[_0x0a39('0x1a')](_0x2dcdcc[_0x0a39('0x1b')][_0x0a39('0x1c')])){utils[_0x0a39('0xf')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2dcdcc[_0x0a39('0x5')],_0x2dcdcc[_0x0a39('0x1d')]));dials[_0x2dcdcc[_0x0a39('0x5')]]={'routeId':_0x2dcdcc[_0x0a39('0x1d')]};}}catch(_0x38358f){utils[_0x0a39('0x17')](util[_0x0a39('0x3')](_0x0a39('0x19'),_0x2dcdcc[_0x0a39('0x5')]),_0x38358f);}};exports[_0x0a39('0x1e')]=function(_0x44a89a){try{if(!_['isNil'](dials[_0x44a89a[_0x0a39('0x5')]])){utils[_0x0a39('0xd')](util[_0x0a39('0x3')]('[%s][dials][dialbegin]',_0x44a89a[_0x0a39('0x5')]),_0x44a89a);dials[_0x44a89a['uniqueid']]=_[_0x0a39('0x1f')](dials[_0x44a89a[_0x0a39('0x5')]],_0x44a89a);dials[_0x44a89a[_0x0a39('0x5')]][_0x0a39('0x20')]=utils[_0x0a39('0x21')]();dials[_0x44a89a[_0x0a39('0x5')]][_0x0a39('0x22')]=_0x0a39('0x23');utils[_0x0a39('0xf')](util[_0x0a39('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x44a89a[_0x0a39('0x5')],dials[_0x44a89a[_0x0a39('0x5')]][_0x0a39('0x20')]));}}catch(_0x351113){utils[_0x0a39('0x17')](util[_0x0a39('0x3')](_0x0a39('0x24'),_0x44a89a[_0x0a39('0x5')]),_0x351113);}};exports[_0x0a39('0x25')]=function(_0x4247e1){try{if(!_['isNil'](dials[_0x4247e1['uniqueid']])){utils[_0x0a39('0xd')](util[_0x0a39('0x3')](_0x0a39('0x26'),_0x4247e1[_0x0a39('0x5')]),_0x4247e1);dials[_0x4247e1[_0x0a39('0x5')]][_0x0a39('0x9')]=_0x4247e1[_0x0a39('0x9')];if(_0x4247e1['dialstatus']==_0x0a39('0x27')){dials[_0x4247e1[_0x0a39('0x5')]]=_[_0x0a39('0x1f')](dials[_0x4247e1[_0x0a39('0x5')]],_0x4247e1);dials[_0x4247e1['uniqueid']][_0x0a39('0x28')]=utils[_0x0a39('0x21')]();dials[_0x4247e1['uniqueid']]['lastevent']=_0x0a39('0x29');utils['info'](util[_0x0a39('0x3')](_0x0a39('0x2a'),_0x4247e1[_0x0a39('0x5')],_0x4247e1[_0x0a39('0x9')],dials[_0x4247e1[_0x0a39('0x5')]]['answertime']));}else{utils[_0x0a39('0xf')](util[_0x0a39('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4247e1[_0x0a39('0x5')],_0x4247e1['dialstatus']));}}}catch(_0x4ae586){utils[_0x0a39('0x17')](util[_0x0a39('0x3')]('[%s][dials][dialend]',_0x4247e1['uniqueid']),_0x4ae586);}};exports[_0x0a39('0x2b')]=function(_0x2b4f9c){try{if(!_[_0x0a39('0x1a')](dials[_0x2b4f9c[_0x0a39('0x5')]])){utils[_0x0a39('0xd')](util[_0x0a39('0x3')](_0x0a39('0x2c'),_0x2b4f9c[_0x0a39('0x5')]),_0x2b4f9c);utils[_0x0a39('0xf')](util[_0x0a39('0x3')](_0x0a39('0x2d'),_0x2b4f9c[_0x0a39('0x5')],_0x2b4f9c['calleridnum'],_0x2b4f9c[_0x0a39('0x2e')],_0x2b4f9c[_0x0a39('0x2f')]));dials[_0x2b4f9c[_0x0a39('0x5')]]=_[_0x0a39('0x1f')](dials[_0x2b4f9c['uniqueid']],{'endtime':utils[_0x0a39('0x21')](),'lastevent':_0x0a39('0x30')});dials[_0x2b4f9c['uniqueid']][_0x0a39('0x31')]=utils[_0x0a39('0x32')](dials[_0x2b4f9c[_0x0a39('0x5')]][_0x0a39('0x33')],dials[_0x2b4f9c[_0x0a39('0x5')]][_0x0a39('0x20')]);dials[_0x2b4f9c[_0x0a39('0x5')]][_0x0a39('0x34')]=utils['diffTime'](dials[_0x2b4f9c['uniqueid']][_0x0a39('0x28')]||dials[_0x2b4f9c[_0x0a39('0x5')]][_0x0a39('0x33')],dials[_0x2b4f9c[_0x0a39('0x5')]][_0x0a39('0x20')]);dials[_0x2b4f9c['uniqueid']]['billableseconds']=dials[_0x2b4f9c[_0x0a39('0x5')]]['answertime']?utils[_0x0a39('0x32')](dials[_0x2b4f9c['uniqueid']][_0x0a39('0x33')],dials[_0x2b4f9c['uniqueid']]['answertime']):0x0;writeDB(dials[_0x2b4f9c[_0x0a39('0x5')]]);}}catch(_0x8e7bd7){utils[_0x0a39('0x17')](util[_0x0a39('0x3')](_0x0a39('0x2c'),_0x2b4f9c[_0x0a39('0x5')]),_0x8e7bd7);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ddcc9de..20aea7c 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 _0x3a39=['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]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]'];(function(_0x45157d,_0x3232cf){var _0x169cb7=function(_0x415e95){while(--_0x415e95){_0x45157d['push'](_0x45157d['shift']());}};_0x169cb7(++_0x3232cf);}(_0x3a39,0x9a));var _0x93a3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3a39[_0x3bf83f];return _0x22c4a9;};var AsteriskManager=require('asterisk-manager');var config=require(_0x93a3('0x0'));var utils=require(_0x93a3('0x1'));var util=require(_0x93a3('0x2'));var isXDREnabled=config[_0x93a3('0x3')]&&config[_0x93a3('0x3')][_0x93a3('0x4')]?!config[_0x93a3('0x3')][_0x93a3('0x4')]:!![];var isProduction=config[_0x93a3('0x5')]===_0x93a3('0x6')||![];var isLocalAsterisk=config[_0x93a3('0x3')]&&config[_0x93a3('0x3')][_0x93a3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x93a3('0x8')][_0x93a3('0x9')],config['asterisk']['ip'],config[_0x93a3('0x8')][_0x93a3('0xa')],config[_0x93a3('0x8')][_0x93a3('0xb')],!![]);ami[_0x93a3('0xc')]();if(!isXDREnabled){utils[_0x93a3('0xd')](_0x93a3('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x93a3('0xd')](_0x93a3('0xf'));}else{var agents=require(_0x93a3('0x10'));var calls=require('./calls.controller');var queues=require(_0x93a3('0x11'));var recordings=require(_0x93a3('0x12'));var members=require(_0x93a3('0x13'));var dials=require(_0x93a3('0x14'));var transfers=require(_0x93a3('0x15'));var core=require(_0x93a3('0x16'));ami['on']('connect',core['connect']);ami['on'](_0x93a3('0x17'),core['shutdown']);ami['on']('fullybooted',core[_0x93a3('0x18')]);ami['on'](_0x93a3('0x19'),core[_0x93a3('0x19')]);ami['on']('close',core[_0x93a3('0x1a')]);ami['on'](_0x93a3('0x1b'),core[_0x93a3('0x1b')]);ami['on'](_0x93a3('0x1c'),function(_0x49b408){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x1f'),_0x49b408[_0x93a3('0x20')]),_0x49b408);members[_0x93a3('0x1c')](_0x49b408);}catch(_0x1b3286){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x1f'),_0x49b408[_0x93a3('0x20')]),_0x1b3286);}});ami['on'](_0x93a3('0x21'),function(_0x2cb8f){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x22'),_0x2cb8f[_0x93a3('0x23')]),_0x2cb8f);agents['agentcalled'](_0x2cb8f);}catch(_0x222420){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][agentcalled]',_0x2cb8f[_0x93a3('0x23')]),_0x222420);}});ami['on'](_0x93a3('0x24'),function(_0x98c3e2){try{utils['debug'](util['format']('[%s][index][agentringnoanswer]',_0x98c3e2[_0x93a3('0x23')]),_0x98c3e2);agents['agentringnoanswer'](_0x98c3e2);}catch(_0xfdda38){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][agentringnoanswer]',_0x98c3e2[_0x93a3('0x23')]),_0xfdda38);}});ami['on']('agentconnect',function(_0xdd288f){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x25'),_0xdd288f[_0x93a3('0x23')]),_0xdd288f);agents[_0x93a3('0x26')](_0xdd288f);queues['agentconnect'](_0xdd288f);}catch(_0x160906){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x25'),_0xdd288f['uniqueid']),_0x160906);}});ami['on']('agentcomplete',function(_0xb2f280){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x27'),_0xb2f280[_0x93a3('0x23')]),_0xb2f280);agents[_0x93a3('0x28')](_0xb2f280);queues[_0x93a3('0x28')](_0xb2f280);members['agentcomplete'](_0xb2f280);}catch(_0x426ee8){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x27'),_0xb2f280[_0x93a3('0x23')]),_0x426ee8);}});ami['on'](_0x93a3('0x29'),function(_0x40c652){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x2a'),_0x40c652[_0x93a3('0x23')]),_0x40c652);agents['queuecallerabandon'](_0x40c652);queues[_0x93a3('0x29')](_0x40c652);}catch(_0x33278d){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x2a'),_0x40c652[_0x93a3('0x23')]),_0x33278d);}});ami['on'](_0x93a3('0x2b'),function(_0x251b96){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x2c'),_0x251b96[_0x93a3('0x23')]),_0x251b96);queues['queuecallerjoin'](_0x251b96);recordings[_0x93a3('0x2b')](_0x251b96);}catch(_0x5759ce){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x2c'),_0x251b96[_0x93a3('0x23')]),_0x5759ce);}});ami['on'](_0x93a3('0x2d'),function(_0x40e575){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x2e'),_0x40e575[_0x93a3('0x23')]),_0x40e575);queues['queuecallerleave'](_0x40e575);}catch(_0x3e351a){utils['error'](util['format']('[%s][index][queuecallerleave]',_0x40e575['uniqueid']),_0x3e351a);}});ami['on'](_0x93a3('0x2f'),function(_0x53520e){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x30'),_0x53520e[_0x93a3('0x23')]),_0x53520e);queues['musiconholdstart'](_0x53520e);calls[_0x93a3('0x2f')](_0x53520e);}catch(_0x514fe5){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x30'),_0x53520e[_0x93a3('0x23')]),_0x514fe5);}});ami['on']('musiconholdstop',function(_0x58c5f4){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x31'),_0x58c5f4['uniqueid']),_0x58c5f4);queues[_0x93a3('0x32')](_0x58c5f4);calls['musiconholdstop'](_0x58c5f4);}catch(_0x42633f){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x31'),_0x58c5f4[_0x93a3('0x23')]),_0x42633f);}});ami['on'](_0x93a3('0x33'),function(_0x3d4f4e){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x34'),_0x3d4f4e['uniqueid']),_0x3d4f4e);calls[_0x93a3('0x33')](_0x3d4f4e);recordings[_0x93a3('0x33')](_0x3d4f4e);}catch(_0x4b2440){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x34'),_0x3d4f4e[_0x93a3('0x23')]),_0x4b2440);}});ami['on'](_0x93a3('0x35'),function(_0x59c2b0){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')]('[%s][index][hangup]',_0x59c2b0[_0x93a3('0x23')]),_0x59c2b0);calls[_0x93a3('0x35')](_0x59c2b0);recordings[_0x93a3('0x35')](_0x59c2b0);dials[_0x93a3('0x35')](_0x59c2b0);agents[_0x93a3('0x35')](_0x59c2b0);queues[_0x93a3('0x35')](_0x59c2b0);}catch(_0x311314){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x36'),_0x59c2b0['uniqueid']),_0x311314);}});ami['on']('cdr',function(_0xb8c750){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x37'),_0xb8c750['uniqueid']),_0xb8c750);members['cdr'](_0xb8c750);}catch(_0x127b1f){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][cdr]',_0xb8c750[_0x93a3('0x23')]),_0x127b1f);}});ami['on'](_0x93a3('0x38'),function(_0xda727b){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0xda727b[_0x93a3('0x23')]),_0xda727b);queues['blindtransfer'](_0xda727b);agents[_0x93a3('0x38')](_0xda727b);transfers['blindtransfer'](_0xda727b);}catch(_0xcf8efc){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][blindtransfer]',_0xda727b[_0x93a3('0x23')]),_0xcf8efc);}});ami['on'](_0x93a3('0x39'),function(_0x306ea2){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][attendedtransfer]',_0x306ea2[_0x93a3('0x3a')]),_0x306ea2);queues['attendedtransfer'](_0x306ea2);transfers[_0x93a3('0x39')](_0x306ea2);agents['attendedtransfer'](_0x306ea2);calls[_0x93a3('0x39')](_0x306ea2);}catch(_0xd8aa8e){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x3b'),_0x306ea2[_0x93a3('0x3a')]),_0xd8aa8e);}});ami['on'](_0x93a3('0x3c'),function(_0x5b0632){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][varset]',_0x5b0632[_0x93a3('0x23')]),_0x5b0632);queues[_0x93a3('0x3c')](_0x5b0632);recordings[_0x93a3('0x3c')](_0x5b0632);calls[_0x93a3('0x3c')](_0x5b0632);dials[_0x93a3('0x3c')](_0x5b0632);}catch(_0x79956a){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x3d'),_0x5b0632[_0x93a3('0x23')]),_0x79956a);}});ami['on'](_0x93a3('0x3e'),function(_0x3ae738){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x3f'),_0x3ae738['uniqueid']),_0x3ae738);calls['newexten'](_0x3ae738);recordings[_0x93a3('0x3e')](_0x3ae738);dials['newexten'](_0x3ae738);}catch(_0x116b27){utils[_0x93a3('0x19')](util['format']('[%s][index][newexten]',_0x3ae738[_0x93a3('0x23')]),_0x116b27);}});ami['on'](_0x93a3('0x40'),function(_0xc2c43){try{utils['debug'](util['format'](_0x93a3('0x41'),_0xc2c43[_0x93a3('0x23')]),_0xc2c43);calls[_0x93a3('0x40')](_0xc2c43);recordings['newchannel'](_0xc2c43);}catch(_0xacb5b5){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x41'),_0xc2c43['uniqueid']),_0xacb5b5);}});ami['on'](_0x93a3('0x42'),function(_0xb5315f){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][dialbegin]',_0xb5315f[_0x93a3('0x23')]),_0xb5315f);dials[_0x93a3('0x42')](_0xb5315f);}catch(_0x176d67){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x43'),_0xb5315f[_0x93a3('0x23')]),_0x176d67);}});ami['on'](_0x93a3('0x44'),function(_0x314ba2){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x45'),_0x314ba2[_0x93a3('0x23')]),_0x314ba2);dials['dialend'](_0x314ba2);}catch(_0x548a43){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x45'),_0x314ba2['uniqueid']),_0x548a43);}});} \ No newline at end of file +var _0xb72c=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb72c,0xe9));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xcb72('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xcb72('0x1'));var isXDREnabled=config[_0xcb72('0x2')]&&config[_0xcb72('0x2')][_0xcb72('0x3')]?!config[_0xcb72('0x2')][_0xcb72('0x3')]:!![];var isProduction=config[_0xcb72('0x4')]===_0xcb72('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xcb72('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xcb72('0x6')][_0xcb72('0x7')],config[_0xcb72('0x6')]['ip'],config[_0xcb72('0x6')][_0xcb72('0x8')],config[_0xcb72('0x6')][_0xcb72('0x9')],!![]);ami[_0xcb72('0xa')]();if(!isXDREnabled){utils[_0xcb72('0xb')](_0xcb72('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xcb72('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xcb72('0xd'));var calls=require('./calls.controller');var queues=require(_0xcb72('0xe'));var recordings=require('./recordings.controller');var members=require(_0xcb72('0xf'));var dials=require('./dials.controller');var transfers=require(_0xcb72('0x10'));var core=require('./core.controller');ami['on'](_0xcb72('0x11'),core[_0xcb72('0x11')]);ami['on'](_0xcb72('0x12'),core[_0xcb72('0x12')]);ami['on'](_0xcb72('0x13'),core[_0xcb72('0x13')]);ami['on'](_0xcb72('0x14'),core[_0xcb72('0x14')]);ami['on'](_0xcb72('0x15'),core[_0xcb72('0x15')]);ami['on']('managerevent',core[_0xcb72('0x16')]);ami['on'](_0xcb72('0x17'),function(_0x34cd72){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x1a'),_0x34cd72['device']),_0x34cd72);members['devicestatechange'](_0x34cd72);}catch(_0x1ca103){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x1a'),_0x34cd72[_0xcb72('0x1b')]),_0x1ca103);}});ami['on'](_0xcb72('0x1c'),function(_0x3fd4e9){try{utils[_0xcb72('0x18')](util['format'](_0xcb72('0x1d'),_0x3fd4e9[_0xcb72('0x1e')]),_0x3fd4e9);agents[_0xcb72('0x1c')](_0x3fd4e9);}catch(_0x25076c){utils['error'](util[_0xcb72('0x19')](_0xcb72('0x1d'),_0x3fd4e9[_0xcb72('0x1e')]),_0x25076c);}});ami['on'](_0xcb72('0x1f'),function(_0x25011e){try{utils[_0xcb72('0x18')](util['format'](_0xcb72('0x20'),_0x25011e[_0xcb72('0x1e')]),_0x25011e);agents['agentringnoanswer'](_0x25011e);}catch(_0x1a4f6f){utils[_0xcb72('0x14')](util['format'](_0xcb72('0x20'),_0x25011e['uniqueid']),_0x1a4f6f);}});ami['on']('agentconnect',function(_0x12fe9e){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x21'),_0x12fe9e[_0xcb72('0x1e')]),_0x12fe9e);agents[_0xcb72('0x22')](_0x12fe9e);queues[_0xcb72('0x22')](_0x12fe9e);}catch(_0x565e1c){utils[_0xcb72('0x14')](util[_0xcb72('0x19')]('[%s][index][agentconnect]',_0x12fe9e[_0xcb72('0x1e')]),_0x565e1c);}});ami['on'](_0xcb72('0x23'),function(_0xc0effe){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x24'),_0xc0effe[_0xcb72('0x1e')]),_0xc0effe);agents['agentcomplete'](_0xc0effe);queues[_0xcb72('0x23')](_0xc0effe);members[_0xcb72('0x23')](_0xc0effe);}catch(_0x3da4ce){utils[_0xcb72('0x14')](util[_0xcb72('0x19')]('[%s][index][agentcomplete]',_0xc0effe[_0xcb72('0x1e')]),_0x3da4ce);}});ami['on'](_0xcb72('0x25'),function(_0x2d32e0){try{utils['debug'](util[_0xcb72('0x19')](_0xcb72('0x26'),_0x2d32e0[_0xcb72('0x1e')]),_0x2d32e0);agents['queuecallerabandon'](_0x2d32e0);queues[_0xcb72('0x25')](_0x2d32e0);}catch(_0x5ad845){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x26'),_0x2d32e0['uniqueid']),_0x5ad845);}});ami['on']('queuecallerjoin',function(_0x40bd27){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x27'),_0x40bd27[_0xcb72('0x1e')]),_0x40bd27);queues[_0xcb72('0x28')](_0x40bd27);recordings[_0xcb72('0x28')](_0x40bd27);}catch(_0x3d5364){utils['error'](util[_0xcb72('0x19')](_0xcb72('0x27'),_0x40bd27[_0xcb72('0x1e')]),_0x3d5364);}});ami['on'](_0xcb72('0x29'),function(_0x4273c8){try{utils['debug'](util[_0xcb72('0x19')](_0xcb72('0x2a'),_0x4273c8[_0xcb72('0x1e')]),_0x4273c8);queues[_0xcb72('0x29')](_0x4273c8);}catch(_0x468b0d){utils['error'](util['format'](_0xcb72('0x2a'),_0x4273c8[_0xcb72('0x1e')]),_0x468b0d);}});ami['on']('musiconholdstart',function(_0xc7b1bc){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x2b'),_0xc7b1bc[_0xcb72('0x1e')]),_0xc7b1bc);queues[_0xcb72('0x2c')](_0xc7b1bc);calls[_0xcb72('0x2c')](_0xc7b1bc);}catch(_0x2a4005){utils[_0xcb72('0x14')](util[_0xcb72('0x19')]('[%s][index][musiconholdstart]',_0xc7b1bc[_0xcb72('0x1e')]),_0x2a4005);}});ami['on'](_0xcb72('0x2d'),function(_0x2ad7f8){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x2e'),_0x2ad7f8['uniqueid']),_0x2ad7f8);queues[_0xcb72('0x2d')](_0x2ad7f8);calls['musiconholdstop'](_0x2ad7f8);}catch(_0x2aaf75){utils[_0xcb72('0x14')](util['format'](_0xcb72('0x2e'),_0x2ad7f8['uniqueid']),_0x2aaf75);}});ami['on'](_0xcb72('0x2f'),function(_0x3500dd){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x30'),_0x3500dd['uniqueid']),_0x3500dd);calls[_0xcb72('0x2f')](_0x3500dd);recordings[_0xcb72('0x2f')](_0x3500dd);}catch(_0x153ef0){utils['error'](util[_0xcb72('0x19')]('[%s][index][newstate]',_0x3500dd['uniqueid']),_0x153ef0);}});ami['on'](_0xcb72('0x31'),function(_0x1786f1){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x32'),_0x1786f1[_0xcb72('0x1e')]),_0x1786f1);calls['hangup'](_0x1786f1);recordings[_0xcb72('0x31')](_0x1786f1);dials[_0xcb72('0x31')](_0x1786f1);agents[_0xcb72('0x31')](_0x1786f1);queues['hangup'](_0x1786f1);}catch(_0x4975ea){utils['error'](util[_0xcb72('0x19')](_0xcb72('0x32'),_0x1786f1[_0xcb72('0x1e')]),_0x4975ea);}});ami['on'](_0xcb72('0x33'),function(_0x420c7c){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x34'),_0x420c7c['uniqueid']),_0x420c7c);members[_0xcb72('0x33')](_0x420c7c);}catch(_0x33e27f){utils['error'](util[_0xcb72('0x19')](_0xcb72('0x34'),_0x420c7c['uniqueid']),_0x33e27f);}});ami['on']('blindtransfer',function(_0x1a82e1){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x35'),_0x1a82e1['uniqueid']),_0x1a82e1);queues[_0xcb72('0x36')](_0x1a82e1);agents[_0xcb72('0x36')](_0x1a82e1);transfers[_0xcb72('0x36')](_0x1a82e1);}catch(_0x4ee52e){utils[_0xcb72('0x14')](util[_0xcb72('0x19')]('[%s][index][blindtransfer]',_0x1a82e1[_0xcb72('0x1e')]),_0x4ee52e);}});ami['on'](_0xcb72('0x37'),function(_0x116283){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x38'),_0x116283['origtransfereruniqueid']),_0x116283);queues['attendedtransfer'](_0x116283);transfers[_0xcb72('0x37')](_0x116283);agents['attendedtransfer'](_0x116283);calls[_0xcb72('0x37')](_0x116283);}catch(_0x551f8e){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x38'),_0x116283[_0xcb72('0x39')]),_0x551f8e);}});ami['on']('varset',function(_0x4216bf){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')]('[%s][index][varset]',_0x4216bf[_0xcb72('0x1e')]),_0x4216bf);queues[_0xcb72('0x3a')](_0x4216bf);recordings[_0xcb72('0x3a')](_0x4216bf);calls[_0xcb72('0x3a')](_0x4216bf);dials[_0xcb72('0x3a')](_0x4216bf);}catch(_0x38be17){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x3b'),_0x4216bf[_0xcb72('0x1e')]),_0x38be17);}});ami['on']('newexten',function(_0x5b268a){try{utils['debug'](util[_0xcb72('0x19')](_0xcb72('0x3c'),_0x5b268a[_0xcb72('0x1e')]),_0x5b268a);calls[_0xcb72('0x3d')](_0x5b268a);recordings[_0xcb72('0x3d')](_0x5b268a);dials[_0xcb72('0x3d')](_0x5b268a);}catch(_0x207b61){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x3c'),_0x5b268a['uniqueid']),_0x207b61);}});ami['on'](_0xcb72('0x3e'),function(_0x1de27f){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x3f'),_0x1de27f[_0xcb72('0x1e')]),_0x1de27f);calls[_0xcb72('0x3e')](_0x1de27f);recordings[_0xcb72('0x3e')](_0x1de27f);}catch(_0x201272){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x3f'),_0x1de27f[_0xcb72('0x1e')]),_0x201272);}});ami['on'](_0xcb72('0x40'),function(_0x4305a3){try{utils['debug'](util[_0xcb72('0x19')]('[%s][index][dialbegin]',_0x4305a3[_0xcb72('0x1e')]),_0x4305a3);dials[_0xcb72('0x40')](_0x4305a3);}catch(_0x5daab0){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x41'),_0x4305a3['uniqueid']),_0x5daab0);}});ami['on']('dialend',function(_0x316ed3){try{utils[_0xcb72('0x18')](util[_0xcb72('0x19')](_0xcb72('0x42'),_0x316ed3[_0xcb72('0x1e')]),_0x316ed3);dials['dialend'](_0x316ed3);}catch(_0xbd279f){utils[_0xcb72('0x14')](util[_0xcb72('0x19')](_0xcb72('0x42'),_0x316ed3[_0xcb72('0x1e')]),_0xbd279f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 27c7ef9..49ae178 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 _0x91d0=['some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','error','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split'];(function(_0x56ec48,_0x32fc3c){var _0x50953c=function(_0x2daf70){while(--_0x2daf70){_0x56ec48['push'](_0x56ec48['shift']());}};_0x50953c(++_0x32fc3c);}(_0x91d0,0xb6));var _0x091d=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x91d0[_0x58efa6];return _0x5d643c;};'use strict';var _=require('lodash');var util=require(_0x091d('0x0'));var utils=require(_0x091d('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x091d('0x2')];function writeDB(_0x55d26d){utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x5'),_0x55d26d[_0x091d('0x6')],_0x55d26d[_0x091d('0x7')],_0x55d26d['channel'],_0x55d26d[_0x091d('0x8')],_0x55d26d['membername'],_0x55d26d[_0x091d('0x9')]));if(_0x55d26d[_0x091d('0x7')]){utils[_0x091d('0xa')](_0x55d26d[_0x091d('0x7')])[_0x091d('0xb')](function(_0x53a64a){if(_0x53a64a){_0x55d26d[_0x091d('0xc')]=_0x53a64a[_0x091d('0xd')];_0x55d26d[_0x091d('0xe')]=_0x53a64a[_0x091d('0xe')];utils[_0x091d('0xf')](_0x091d('0x10'),_0x55d26d);}else{utils['getUserByName'](_0x55d26d[_0x091d('0x7')][_0x091d('0x11')]('/')[0x1])[_0x091d('0xb')](function(_0x200057){if(_0x200057){_0x55d26d[_0x091d('0xc')]=_0x200057[_0x091d('0xd')];_0x55d26d[_0x091d('0xe')]=_0x200057[_0x091d('0xe')];utils[_0x091d('0xf')](_0x091d('0x10'),_0x55d26d);}});}})['catch'](function(_0x16e8ed){utils['error'](util['format']('[%s][members][writeDB]',_0x55d26d[_0x091d('0x6')]),_0x16e8ed);});}delete members[_0x55d26d[_0x091d('0x7')]];}function startsWith(_0x4338c7,_0x564370){return _[_0x091d('0x12')](_0x4338c7,function(_0x31a577){return _[_0x091d('0x13')](_0x564370,_0x31a577);});}exports[_0x091d('0x14')]=function(_0x53e642){try{utils[_0x091d('0x15')](util['format']('[%s][members][devicestatechange]',members[_0x53e642[_0x091d('0x16')]]?members[_0x53e642[_0x091d('0x16')]][_0x091d('0x6')]:_0x53e642[_0x091d('0x16')]),_0x53e642);utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x17'),members[_0x53e642[_0x091d('0x16')]]?members[_0x53e642[_0x091d('0x16')]]['uniqueid']:_0x53e642['device'],_0x53e642[_0x091d('0x18')],_0x53e642[_0x091d('0x16')]));switch(_0x53e642['state']){case _0x091d('0x19'):case _0x091d('0x1a'):if(!startsWith(exclude,_0x53e642[_0x091d('0x16')])){members[_0x53e642['device']]={'channel':_0x091d('0x1b'),'interface':_0x53e642[_0x091d('0x16')],'type':_0x091d('0x1c'),'enterAt':utils[_0x091d('0x1d')](),'role':'agent'};}break;case _0x091d('0x1e'):if(!_[_0x091d('0x1f')](members[_0x53e642[_0x091d('0x16')]])){members[_0x53e642[_0x091d('0x16')]][_0x091d('0x20')]=utils[_0x091d('0x1d')]();members[_0x53e642[_0x091d('0x16')]]['duration']=utils[_0x091d('0x21')](members[_0x53e642[_0x091d('0x16')]][_0x091d('0x20')],members[_0x53e642[_0x091d('0x16')]][_0x091d('0x22')]);if(members[_0x53e642[_0x091d('0x16')]]['uniqueid']){writeDB(members[_0x53e642[_0x091d('0x16')]]);}}break;default:break;}}catch(_0x4fec4d){utils[_0x091d('0x23')](util[_0x091d('0x4')](_0x091d('0x24'),members[_0x53e642['device']]?members[_0x53e642[_0x091d('0x16')]][_0x091d('0x6')]:_0x53e642[_0x091d('0x16')]),_0x4fec4d);}};exports['agentcomplete']=function(_0x1a23a5){try{if(!_[_0x091d('0x1f')](members[_0x1a23a5['interface']])){utils[_0x091d('0x15')](util[_0x091d('0x4')](_0x091d('0x25'),_0x1a23a5['uniqueid']),_0x1a23a5);utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x26'),_0x1a23a5['uniqueid'],_0x1a23a5[_0x091d('0x7')],_0x1a23a5[_0x091d('0x27')]));members[_0x1a23a5['interface']]=_[_0x091d('0x28')](members[_0x1a23a5[_0x091d('0x7')]],{'data4':_0x1a23a5[_0x091d('0x27')],'uniqueid':_0x1a23a5['uniqueid']});}}catch(_0x100616){utils['error'](util[_0x091d('0x4')](_0x091d('0x25'),_0x1a23a5[_0x091d('0x6')]),_0x100616);}};exports[_0x091d('0x29')]=function(_0x4fb661){try{utils['debug'](util['format'](_0x091d('0x2a'),_0x4fb661['uniqueid']),_0x4fb661);if(_0x4fb661['channel']){var _0x4680fd=_0x4fb661[_0x091d('0x2b')][_0x091d('0x11')]('-')[0x0];if(!_[_0x091d('0x1f')](members[_0x4680fd])){members[_0x4680fd]=_['assign'](members[_0x4680fd],{'data1':members[_0x4680fd]['data1']||_0x4fb661['type'],'data2':members[_0x4680fd][_0x091d('0x8')]||_0x4fb661[_0x091d('0x2c')],'data3':members[_0x4680fd][_0x091d('0x2d')]||_0x4fb661[_0x091d('0x2e')],'uniqueid':members[_0x4680fd]['uniqueid']||_0x4fb661[_0x091d('0x6')]});utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x2f'),_0x4fb661[_0x091d('0x6')],members[_0x4680fd][_0x091d('0x30')],members[_0x4680fd][_0x091d('0x8')],members[_0x4680fd][_0x091d('0x2d')]));if(members[_0x4680fd][_0x091d('0x20')]){writeDB(members[_0x4680fd]);}}}if(_0x4fb661[_0x091d('0x31')]){var _0x594c30=_0x4fb661['destinationchannel'][_0x091d('0x11')]('-')[0x0];if(!_[_0x091d('0x1f')](members[_0x594c30])){members[_0x594c30]=_[_0x091d('0x28')](members[_0x594c30],{'data1':members[_0x594c30][_0x091d('0x30')]||_0x4fb661['type'],'data2':members[_0x594c30][_0x091d('0x8')]||_0x4fb661[_0x091d('0x2c')],'data3':members[_0x594c30][_0x091d('0x2d')]||_0x4fb661[_0x091d('0x2e')],'uniqueid':members[_0x594c30][_0x091d('0x6')]||_0x4fb661[_0x091d('0x6')]});utils[_0x091d('0x3')](util[_0x091d('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fb661[_0x091d('0x6')],members[_0x594c30][_0x091d('0x30')],members[_0x594c30][_0x091d('0x8')],members[_0x594c30][_0x091d('0x2d')]));if(members[_0x594c30][_0x091d('0x20')]){writeDB(members[_0x594c30]);}}}}catch(_0x3f636b){utils[_0x091d('0x23')](util[_0x091d('0x4')](_0x091d('0x2a'),_0x4fb661[_0x091d('0x6')]),_0x3f636b);}}; \ No newline at end of file +var _0x1acc=['assign','data1','type','source','data3','destination','data2','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','membername','getUserByInterface','then','internal','request','getUserByName','split','name','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','agentcomplete','debug','queue','cdr','[%s][members][cdr]','channel'];(function(_0x2740d7,_0x527aa8){var _0x1579fa=function(_0x19ebf1){while(--_0x19ebf1){_0x2740d7['push'](_0x2740d7['shift']());}};_0x1579fa(++_0x527aa8);}(_0x1acc,0x15f));var _0xc1ac=function(_0x8c40d8,_0x2533bc){_0x8c40d8=_0x8c40d8-0x0;var _0x54286d=_0x1acc[_0x8c40d8];return _0x54286d;};'use strict';var _=require('lodash');var util=require(_0xc1ac('0x0'));var utils=require('./utils');var members={};var exclude=[_0xc1ac('0x1'),_0xc1ac('0x2')];function writeDB(_0x4d1eb5){utils[_0xc1ac('0x3')](util[_0xc1ac('0x4')](_0xc1ac('0x5'),_0x4d1eb5['uniqueid'],_0x4d1eb5[_0xc1ac('0x6')],_0x4d1eb5['channel'],_0x4d1eb5['data2'],_0x4d1eb5[_0xc1ac('0x7')],_0x4d1eb5['type']));if(_0x4d1eb5[_0xc1ac('0x6')]){utils[_0xc1ac('0x8')](_0x4d1eb5[_0xc1ac('0x6')])[_0xc1ac('0x9')](function(_0x336d32){if(_0x336d32){_0x4d1eb5['membername']=_0x336d32['name'];_0x4d1eb5[_0xc1ac('0xa')]=_0x336d32[_0xc1ac('0xa')];utils[_0xc1ac('0xb')]('CreateMemberReport',_0x4d1eb5);}else{utils[_0xc1ac('0xc')](_0x4d1eb5[_0xc1ac('0x6')][_0xc1ac('0xd')]('/')[0x1])[_0xc1ac('0x9')](function(_0x14167c){if(_0x14167c){_0x4d1eb5[_0xc1ac('0x7')]=_0x14167c[_0xc1ac('0xe')];_0x4d1eb5[_0xc1ac('0xa')]=_0x14167c[_0xc1ac('0xa')];utils[_0xc1ac('0xb')](_0xc1ac('0xf'),_0x4d1eb5);}});}})[_0xc1ac('0x10')](function(_0x501a08){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')](_0xc1ac('0x12'),_0x4d1eb5[_0xc1ac('0x13')]),_0x501a08);});}delete members[_0x4d1eb5['interface']];}function startsWith(_0x27f2c7,_0x138019){return _[_0xc1ac('0x14')](_0x27f2c7,function(_0x2b51c6){return _[_0xc1ac('0x15')](_0x138019,_0x2b51c6);});}exports['devicestatechange']=function(_0x34f75a){try{utils['debug'](util[_0xc1ac('0x4')](_0xc1ac('0x16'),members[_0x34f75a['device']]?members[_0x34f75a['device']][_0xc1ac('0x13')]:_0x34f75a['device']),_0x34f75a);utils[_0xc1ac('0x3')](util[_0xc1ac('0x4')](_0xc1ac('0x17'),members[_0x34f75a[_0xc1ac('0x18')]]?members[_0x34f75a[_0xc1ac('0x18')]]['uniqueid']:_0x34f75a[_0xc1ac('0x18')],_0x34f75a[_0xc1ac('0x19')],_0x34f75a[_0xc1ac('0x18')]));switch(_0x34f75a[_0xc1ac('0x19')]){case _0xc1ac('0x1a'):case _0xc1ac('0x1b'):if(!startsWith(exclude,_0x34f75a[_0xc1ac('0x18')])){members[_0x34f75a[_0xc1ac('0x18')]]={'channel':_0xc1ac('0x1c'),'interface':_0x34f75a[_0xc1ac('0x18')],'type':_0xc1ac('0x1d'),'enterAt':utils[_0xc1ac('0x1e')](),'role':'agent'};}break;case _0xc1ac('0x1f'):if(!_[_0xc1ac('0x20')](members[_0x34f75a['device']])){members[_0x34f75a['device']][_0xc1ac('0x21')]=utils[_0xc1ac('0x1e')]();members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x22')]=utils['diffTime'](members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x21')],members[_0x34f75a[_0xc1ac('0x18')]]['enterAt']);if(members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x13')]){writeDB(members[_0x34f75a[_0xc1ac('0x18')]]);}}break;default:break;}}catch(_0x323568){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')](_0xc1ac('0x16'),members[_0x34f75a['device']]?members[_0x34f75a['device']][_0xc1ac('0x13')]:_0x34f75a[_0xc1ac('0x18')]),_0x323568);}};exports[_0xc1ac('0x23')]=function(_0x39e1ea){try{if(!_[_0xc1ac('0x20')](members[_0x39e1ea[_0xc1ac('0x6')]])){utils[_0xc1ac('0x24')](util[_0xc1ac('0x4')]('[%s][members][agentcomplete]',_0x39e1ea[_0xc1ac('0x13')]),_0x39e1ea);utils[_0xc1ac('0x3')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x39e1ea['uniqueid'],_0x39e1ea[_0xc1ac('0x6')],_0x39e1ea[_0xc1ac('0x25')]));members[_0x39e1ea[_0xc1ac('0x6')]]=_['assign'](members[_0x39e1ea['interface']],{'data4':_0x39e1ea['queue'],'uniqueid':_0x39e1ea[_0xc1ac('0x13')]});}}catch(_0x1e522f){utils['error'](util[_0xc1ac('0x4')]('[%s][members][agentcomplete]',_0x39e1ea[_0xc1ac('0x13')]),_0x1e522f);}};exports[_0xc1ac('0x26')]=function(_0x54302e){try{utils['debug'](util[_0xc1ac('0x4')](_0xc1ac('0x27'),_0x54302e[_0xc1ac('0x13')]),_0x54302e);if(_0x54302e[_0xc1ac('0x28')]){var _0x5ce7ea=_0x54302e['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x5ce7ea])){members[_0x5ce7ea]=_[_0xc1ac('0x29')](members[_0x5ce7ea],{'data1':members[_0x5ce7ea][_0xc1ac('0x2a')]||_0x54302e[_0xc1ac('0x2b')],'data2':members[_0x5ce7ea]['data2']||_0x54302e[_0xc1ac('0x2c')],'data3':members[_0x5ce7ea][_0xc1ac('0x2d')]||_0x54302e[_0xc1ac('0x2e')],'uniqueid':members[_0x5ce7ea][_0xc1ac('0x13')]||_0x54302e[_0xc1ac('0x13')]});utils['info'](util[_0xc1ac('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x54302e[_0xc1ac('0x13')],members[_0x5ce7ea][_0xc1ac('0x2a')],members[_0x5ce7ea][_0xc1ac('0x2f')],members[_0x5ce7ea]['data3']));if(members[_0x5ce7ea][_0xc1ac('0x21')]){writeDB(members[_0x5ce7ea]);}}}if(_0x54302e['destinationchannel']){var _0x110637=_0x54302e['destinationchannel']['split']('-')[0x0];if(!_[_0xc1ac('0x20')](members[_0x110637])){members[_0x110637]=_[_0xc1ac('0x29')](members[_0x110637],{'data1':members[_0x110637][_0xc1ac('0x2a')]||_0x54302e['type'],'data2':members[_0x110637][_0xc1ac('0x2f')]||_0x54302e[_0xc1ac('0x2c')],'data3':members[_0x110637][_0xc1ac('0x2d')]||_0x54302e[_0xc1ac('0x2e')],'uniqueid':members[_0x110637][_0xc1ac('0x13')]||_0x54302e[_0xc1ac('0x13')]});utils['info'](util[_0xc1ac('0x4')](_0xc1ac('0x30'),_0x54302e[_0xc1ac('0x13')],members[_0x110637][_0xc1ac('0x2a')],members[_0x110637][_0xc1ac('0x2f')],members[_0x110637][_0xc1ac('0x2d')]));if(members[_0x110637][_0xc1ac('0x21')]){writeDB(members[_0x110637]);}}}}catch(_0x9f9e19){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')]('[%s][members][cdr]',_0x54302e[_0xc1ac('0x13')]),_0x9f9e19);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7bfbd44..af6edbc 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 _0x8d7b=['TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleaveAt','holdtime','diffTime','count','connectedlinenum','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer'];(function(_0x53589e,_0x25aa75){var _0x3b3e0d=function(_0x1e0cc4){while(--_0x1e0cc4){_0x53589e['push'](_0x53589e['shift']());}};_0x3b3e0d(++_0x25aa75);}(_0x8d7b,0x15d));var _0xb8d7=function(_0x50cf73,_0x5501cb){_0x50cf73=_0x50cf73-0x0;var _0x4ec887=_0x8d7b[_0x50cf73];return _0x4ec887;};'use strict';var _=require(_0xb8d7('0x0'));var util=require(_0xb8d7('0x1'));var utils=require(_0xb8d7('0x2'));var queues={};function writeDB(_0x417581){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x417581[_0xb8d7('0x5')],_0x417581[_0xb8d7('0x6')],_0x417581['queue'],_0x417581[_0xb8d7('0x7')],_0x417581[_0xb8d7('0x8')],_0x417581[_0xb8d7('0x9')],_0x417581[_0xb8d7('0xa')]));if(_0x417581[_0xb8d7('0xb')]){utils[_0xb8d7('0xc')](_0x417581[_0xb8d7('0xb')])['then'](function(_0x887f52){if(_0x887f52){_0x417581[_0xb8d7('0xd')]=_0x887f52[_0xb8d7('0xd')];}utils[_0xb8d7('0xe')](_0xb8d7('0xf'),_0x417581);});}else{utils[_0xb8d7('0xe')]('CreateVoiceQueueReport',_0x417581);}if(_0x417581[_0xb8d7('0x10')]){delete queues[_0x417581[_0xb8d7('0x10')]];}else{delete queues[_0x417581[_0xb8d7('0x5')]];}}exports['queuecallerjoin']=function(_0x234340){try{utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x12'),_0x234340[_0xb8d7('0x5')]),_0x234340);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x13'),_0x234340[_0xb8d7('0x5')],_0x234340[_0xb8d7('0xb')],_0x234340[_0xb8d7('0x14')]));queues[_0x234340[_0xb8d7('0x5')]]=_[_0xb8d7('0x15')](_0x234340,{'originalposition':_0x234340[_0xb8d7('0x14')],'queuecallerjoinAt':utils[_0xb8d7('0x16')](),'mohtime':0x0});}catch(_0x51973e){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x12'),_0x234340['uniqueid']),_0x51973e);}};exports['hangup']=function(_0x298e67){try{if(!_['isNil'](queues[_0x298e67[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x18'),_0x298e67[_0xb8d7('0x5')]),_0x298e67);if(queues[_0x298e67[_0xb8d7('0x5')]]['queuecallerleaveAt']){if(!queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x19')]&&!queues[_0x298e67['uniqueid']][_0xb8d7('0x1a')]){queues[_0x298e67[_0xb8d7('0x5')]]['queuecallercomplete']=!![];queues[_0x298e67['uniqueid']][_0xb8d7('0x1b')]=utils['now']();queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0xa')]=_0xb8d7('0x1c');}utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x1d'),_0x298e67[_0xb8d7('0x5')],queues[_0x298e67[_0xb8d7('0x5')]]['name'],queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0xa')]));writeDB(queues[_0x298e67['uniqueid']]);}else if(queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x10')]){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x298e67[_0xb8d7('0x5')],queues[_0x298e67['uniqueid']][_0xb8d7('0x1e')],queues[_0x298e67[_0xb8d7('0x5')]]['transfereduniqueid']));queues[queues[_0x298e67[_0xb8d7('0x5')]]['transfereduniqueid']]=queues[_0x298e67['uniqueid']];queues[queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x10')]][_0xb8d7('0x1f')]=0x2;delete queues[_0x298e67[_0xb8d7('0x5')]];}}}catch(_0x2c2c6c){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x18'),_0x298e67[_0xb8d7('0x5')]),_0x2c2c6c);}};exports[_0xb8d7('0x20')]=function(_0x1be374){try{utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x21'),_0x1be374[_0xb8d7('0x5')]),_0x1be374);if(!_[_0xb8d7('0x22')](_0x1be374[_0xb8d7('0x23')][_0xb8d7('0x24')])&&_0x1be374[_0xb8d7('0x25')][_0xb8d7('0x26')]()!==_0xb8d7('0x27')){if(!_[_0xb8d7('0x22')](queues[_0x1be374[_0xb8d7('0x5')]])){queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x1be374['uniqueid']][_0xb8d7('0x1a')]=!![];queues[_0x1be374['uniqueid']]['queuecallerexitAt']=utils[_0xb8d7('0x16')]();queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexitreason']=_0x1be374[_0xb8d7('0x25')][_0xb8d7('0x26')]();utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x29'),_0x1be374[_0xb8d7('0x5')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x1be374['value'],queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1be374[_0xb8d7('0x5')]]);}}else if(!_['isNil'](_0x1be374['variable'][_0xb8d7('0x2a')])){if(!_[_0xb8d7('0x22')](queues[_0x1be374['uniqueid']])&&!queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x19')]){queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x1be374['uniqueid']][_0xb8d7('0x28')]=null;queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexit']=!![];queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=utils[_0xb8d7('0x16')]();queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0xa')]=_0xb8d7('0x2c');utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x2d'),_0x1be374[_0xb8d7('0x5')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x1be374[_0xb8d7('0x25')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0xa')]));}}}catch(_0x113d1){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x21'),_0x1be374[_0xb8d7('0x5')]),_0x113d1);}};exports[_0xb8d7('0x19')]=function(_0x5dde7){try{if(!_[_0xb8d7('0x22')](queues[_0x5dde7[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x2e'),_0x5dde7[_0xb8d7('0x5')]),_0x5dde7);queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x1a')]=![];queues[_0x5dde7[_0xb8d7('0x5')]]['queuecallerexitAt']=null;queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x19')]=!![];queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x28')]=utils['now']();queues[_0x5dde7['uniqueid']][_0xb8d7('0xa')]=_0xb8d7('0x2f');utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5dde7[_0xb8d7('0x5')],queues[_0x5dde7['uniqueid']][_0xb8d7('0x1e')],queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0xa')]));}}catch(_0x2f7832){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x2e'),_0x5dde7[_0xb8d7('0x5')]),_0x2f7832);}};exports[_0xb8d7('0x30')]=function(_0x13049f){try{if(!_['isNil'](queues[_0x13049f[_0xb8d7('0x5')]])){utils['debug'](util['format'](_0xb8d7('0x31'),_0x13049f[_0xb8d7('0x5')]),_0x13049f);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x32'),_0x13049f[_0xb8d7('0x5')],queues[_0x13049f['uniqueid']]['name'],_0x13049f['connectedlinenum'],_0x13049f['connectedlinename']));queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x30')]=!![];queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x33')]=utils[_0xb8d7('0x16')]();queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x34')]=utils[_0xb8d7('0x35')](queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x33')],queues[_0x13049f[_0xb8d7('0x5')]]['queuecallerjoinAt']);queues[_0x13049f['uniqueid']][_0xb8d7('0x14')]=_0x13049f[_0xb8d7('0x14')];queues[_0x13049f['uniqueid']]['count']=_0x13049f[_0xb8d7('0x36')];queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x37')]=_0x13049f['connectedlinenum'];queues[_0x13049f['uniqueid']][_0xb8d7('0x38')]=_0x13049f[_0xb8d7('0x38')];}}catch(_0x5e67ba){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x31'),_0x13049f['uniqueid']),_0x5e67ba);}};exports['agentconnect']=function(_0x1c946e){try{if(!_[_0xb8d7('0x22')](queues[_0x1c946e[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x39'),_0x1c946e[_0xb8d7('0x5')]),_0x1c946e);utils[_0xb8d7('0x3')](util['format'](_0xb8d7('0x3a'),_0x1c946e[_0xb8d7('0x5')],queues[_0x1c946e[_0xb8d7('0x5')]]['name'],_0x1c946e['membername'],_0x1c946e[_0xb8d7('0x3b')]));queues[_0x1c946e['uniqueid']][_0xb8d7('0x19')]=![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x19')]=![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x1c946e[_0xb8d7('0x5')]]['queuecallerexit']=![];queues[_0x1c946e[_0xb8d7('0x5')]]['queuecallerexitreason']=null;queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=null;queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x3c')]=!![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x9')]=_0x1c946e['destaccountcode'];queues[_0x1c946e[_0xb8d7('0x5')]]['lastAssignedTo']=_0x1c946e[_0xb8d7('0x3d')];}}catch(_0x1bd6cb){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x39'),_0x1c946e[_0xb8d7('0x5')]),_0x1bd6cb);}};exports[_0xb8d7('0x3e')]=function(_0x11aeaf){try{if(!_[_0xb8d7('0x22')](queues[_0x11aeaf['uniqueid']])){if(queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x33')]){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x3f'),_0x11aeaf[_0xb8d7('0x5')]),_0x11aeaf);queues[_0x11aeaf[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x19')]=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1a')]=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=null;queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x3c')]=!![];queues[_0x11aeaf[_0xb8d7('0x5')]]['lastAssignedTo']=_0x11aeaf[_0xb8d7('0x3d')];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x40')]=!![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1b')]=utils[_0xb8d7('0x16')]();if(_0x11aeaf[_0xb8d7('0x41')]==_0xb8d7('0x42')){if(!queues[_0x11aeaf['uniqueid']]['transfer']){queues[_0x11aeaf['uniqueid']][_0xb8d7('0xa')]=_0xb8d7('0x43');}}else{queues[_0x11aeaf['uniqueid']]['queuecallerexitreason']=_0xb8d7('0x44')+_0x11aeaf[_0xb8d7('0x41')][_0xb8d7('0x26')]();}utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x11aeaf[_0xb8d7('0x5')],queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x11aeaf[_0xb8d7('0x3d')],queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0xa')]));writeDB(queues[_0x11aeaf['uniqueid']]);}}}catch(_0x43648e){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x3f'),_0x11aeaf[_0xb8d7('0x5')]),_0x43648e);}};exports[_0xb8d7('0x45')]=function(_0x1d4285){try{if(!_[_0xb8d7('0x22')](queues[_0x1d4285[_0xb8d7('0x46')]])){utils[_0xb8d7('0x11')](util['format'](_0xb8d7('0x47'),_0x1d4285['uniqueid']),_0x1d4285);queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x42')]=!![];queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0x48')]=_0xb8d7('0x49');queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x4a')]=_0x1d4285[_0xb8d7('0x4b')];queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x4c')]=_0x1d4285[_0xb8d7('0x46')];queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0xa')]='BLINDTRANSFER';utils[_0xb8d7('0x3')](util['format'](_0xb8d7('0x4d'),_0x1d4285[_0xb8d7('0x5')],queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0x1e')],_0x1d4285[_0xb8d7('0x46')],_0x1d4285['extension']));}}catch(_0x3eb097){utils['error'](util[_0xb8d7('0x4')]('[%s][queues][blindtransfer]',_0x1d4285[_0xb8d7('0x5')]),_0x3eb097);}};exports[_0xb8d7('0x4e')]=function(_0x27fa44){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x27fa44[_0xb8d7('0x4f')]),_0x27fa44);if(_0x27fa44[_0xb8d7('0x4f')]==_0x27fa44[_0xb8d7('0x50')]){if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x51')]])){utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x52'),_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x1e')],_0x27fa44['origtransfererexten']));queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x42')]=!![];queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x48')]=_0xb8d7('0x53');queues[_0x27fa44[_0xb8d7('0x51')]]['transferexten']=_0x27fa44[_0xb8d7('0x54')];queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x4c')]=_0x27fa44[_0xb8d7('0x4f')];queues[_0x27fa44[_0xb8d7('0x51')]]['queuecallerexitreason']=_0xb8d7('0x55');}if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x50')]])){if(_0x27fa44[_0xb8d7('0x56')]&&queues[_0x27fa44[_0xb8d7('0x56')]]){queues[_0x27fa44[_0xb8d7('0x56')]]['queuecallerenterreason']=0x1;queues[_0x27fa44['transfereeuniqueid']]=_[_0xb8d7('0x57')](queues[_0x27fa44[_0xb8d7('0x56')]]);queues[_0x27fa44['transfereeuniqueid']][_0xb8d7('0x10')]=_0x27fa44['transfertargetuniqueid'];queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x1f')]=0x2;queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x8')]=queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x8')];queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x58')]=queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x58')];queues[_0x27fa44['transfereeuniqueid']][_0xb8d7('0x59')]=utils[_0xb8d7('0x16')]();queues[_0x27fa44[_0xb8d7('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x34')]=0x0;queues[_0x27fa44['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x5a'),_0x27fa44[_0xb8d7('0x4f')],queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x1e')],queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x8')],queues[_0x27fa44[_0xb8d7('0x46')]]['calleridname']));}else{utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44['origtransfererlinkedid']]['name'],_0x27fa44[_0xb8d7('0x51')]));queues[_0x27fa44[_0xb8d7('0x50')]]['transfereduniqueid']=_0x27fa44[_0xb8d7('0x51')];}}}else if(_0x27fa44[_0xb8d7('0x5b')]==_0x27fa44[_0xb8d7('0x51')]){if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x50')]])){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x5c'),_0x27fa44[_0xb8d7('0x4f')],queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x1e')],_0x27fa44[_0xb8d7('0x5b')],_0x27fa44[_0xb8d7('0x5d')]));queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x42')]=!![];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x48')]=_0xb8d7('0x53');queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x4a')]=_0x27fa44['secondtransfererexten'];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x4c')]=_0x27fa44[_0xb8d7('0x5b')];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0xa')]=_0xb8d7('0x55');}if(!_[_0xb8d7('0x22')](queues[_0x27fa44['secondtransfererlinkedid']])){if(_0x27fa44[_0xb8d7('0x5e')]&&queues[_0x27fa44[_0xb8d7('0x5e')]]){queues[_0x27fa44[_0xb8d7('0x5e')]][_0xb8d7('0x1f')]=0x1;queues[_0x27fa44[_0xb8d7('0x5f')]]=_[_0xb8d7('0x57')](queues[_0x27fa44[_0xb8d7('0x5e')]]);queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x10')]=_0x27fa44[_0xb8d7('0x5f')];queues[_0x27fa44[_0xb8d7('0x5f')]]['queuecallerenterreason']=0x2;queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x8')]=queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x8')];queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x58')]=queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x58')];queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x59')]=utils[_0xb8d7('0x16')]();queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x33')]=utils['now']();queues[_0x27fa44['transfertargetuniqueid']][_0xb8d7('0x34')]=0x0;queues[_0x27fa44[_0xb8d7('0x5f')]]['mohtime']=0x0;utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x1e')],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x10')],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x8')],queues[_0x27fa44['transfertargetuniqueid']]['calleridname']));}else{utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x60'),_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x51')]]['name'],_0x27fa44[_0xb8d7('0x50')]));queues[_0x27fa44[_0xb8d7('0x51')]]['transfereduniqueid']=_0x27fa44[_0xb8d7('0x50')];}}}}catch(_0x4d4da3){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x61'),_0x27fa44[_0xb8d7('0x4f')]),_0x4d4da3);}};exports[_0xb8d7('0x62')]=function(_0x3eff6a){try{if(!_['isNil'](queues[_0x3eff6a[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util['format'](_0xb8d7('0x63'),_0x3eff6a[_0xb8d7('0x5')]),_0x3eff6a);queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x64')]=utils[_0xb8d7('0x16')]();utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3eff6a[_0xb8d7('0x5')],queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x1e')],queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x64')]));}}catch(_0x293973){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x63'),_0x3eff6a[_0xb8d7('0x5')]),_0x293973);}};exports['musiconholdstop']=function(_0x34987e){try{if(!_['isNil'](queues[_0x34987e['uniqueid']])){if(!_[_0xb8d7('0x22')](queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')]('[%s][queues][musiconholdstop]',_0x34987e['uniqueid']),_0x34987e);queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x65')]+=utils[_0xb8d7('0x35')](utils[_0xb8d7('0x16')](),queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')]);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x66'),_0x34987e[_0xb8d7('0x5')],queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x1e')],queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x65')]));delete queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')];}}}catch(_0x1db3fc){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x67'),_0x34987e[_0xb8d7('0x5')]),_0x1db3fc);}}; \ No newline at end of file +var _0xc935=['info','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','queuestatus','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash'];(function(_0x48dc5f,_0x5bdbc8){var _0x296fb5=function(_0x2bfff6){while(--_0x2bfff6){_0x48dc5f['push'](_0x48dc5f['shift']());}};_0x296fb5(++_0x5bdbc8);}(_0xc935,0xc9));var _0x5c93=function(_0x5d38c4,_0x3e8e08){_0x5d38c4=_0x5d38c4-0x0;var _0xb9f2d=_0xc935[_0x5d38c4];return _0xb9f2d;};'use strict';var _=require(_0x5c93('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x13040b){utils[_0x5c93('0x1')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x13040b['uniqueid'],_0x13040b['channel'],_0x13040b[_0x5c93('0x2')],_0x13040b[_0x5c93('0x3')],_0x13040b['calleridnum'],_0x13040b[_0x5c93('0x4')],_0x13040b[_0x5c93('0x5')]));if(_0x13040b['queue']){utils[_0x5c93('0x6')](_0x13040b['queue'])[_0x5c93('0x7')](function(_0x530b65){if(_0x530b65){_0x13040b[_0x5c93('0x8')]=_0x530b65['type'];}utils[_0x5c93('0x9')](_0x5c93('0xa'),_0x13040b);});}else{utils['request'](_0x5c93('0xa'),_0x13040b);}if(_0x13040b[_0x5c93('0xb')]){delete queues[_0x13040b[_0x5c93('0xb')]];}else{delete queues[_0x13040b[_0x5c93('0xc')]];}}exports[_0x5c93('0xd')]=function(_0x13e677){try{utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x10'),_0x13e677['uniqueid']),_0x13e677);utils['info'](util[_0x5c93('0xf')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x13e677[_0x5c93('0xc')],_0x13e677[_0x5c93('0x2')],_0x13e677[_0x5c93('0x11')]));queues[_0x13e677[_0x5c93('0xc')]]=_[_0x5c93('0x12')](_0x13e677,{'originalposition':_0x13e677[_0x5c93('0x11')],'queuecallerjoinAt':utils[_0x5c93('0x13')](),'mohtime':0x0});}catch(_0x46ec64){utils[_0x5c93('0x14')](util[_0x5c93('0xf')]('[%s][queues][queuecallerjoin]',_0x13e677[_0x5c93('0xc')]),_0x46ec64);}};exports[_0x5c93('0x15')]=function(_0xc2e1b8){try{if(!_[_0x5c93('0x16')](queues[_0xc2e1b8[_0x5c93('0xc')]])){utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x17'),_0xc2e1b8[_0x5c93('0xc')]),_0xc2e1b8);if(queues[_0xc2e1b8[_0x5c93('0xc')]]['queuecallerleaveAt']){if(!queues[_0xc2e1b8['uniqueid']][_0x5c93('0x18')]&&!queues[_0xc2e1b8['uniqueid']][_0x5c93('0x19')]){queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0x1a')]=!![];queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0x1b')]=utils[_0x5c93('0x13')]();queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0x5')]=_0x5c93('0x1c');}utils[_0x5c93('0x1')](util[_0x5c93('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0xc2e1b8[_0x5c93('0xc')],queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0x1d')],queues[_0xc2e1b8['uniqueid']][_0x5c93('0x5')]));writeDB(queues[_0xc2e1b8[_0x5c93('0xc')]]);}else if(queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0xb')]){utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x1e'),_0xc2e1b8[_0x5c93('0xc')],queues[_0xc2e1b8[_0x5c93('0xc')]][_0x5c93('0x1d')],queues[_0xc2e1b8[_0x5c93('0xc')]]['transfereduniqueid']));queues[queues[_0xc2e1b8[_0x5c93('0xc')]]['transfereduniqueid']]=queues[_0xc2e1b8[_0x5c93('0xc')]];queues[queues[_0xc2e1b8['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0xc2e1b8[_0x5c93('0xc')]];}}}catch(_0x4cb7aa){utils['error'](util[_0x5c93('0xf')](_0x5c93('0x17'),_0xc2e1b8['uniqueid']),_0x4cb7aa);}};exports[_0x5c93('0x1f')]=function(_0x3600ae){try{utils[_0x5c93('0xe')](util[_0x5c93('0xf')]('[%s][queues][varset]',_0x3600ae[_0x5c93('0xc')]),_0x3600ae);if(!_[_0x5c93('0x16')](_0x3600ae['variable'][_0x5c93('0x20')])&&_0x3600ae[_0x5c93('0x21')][_0x5c93('0x22')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x3600ae['uniqueid']])){queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x18')]=![];queues[_0x3600ae['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3600ae[_0x5c93('0xc')]]['queuecallerexit']=!![];queues[_0x3600ae[_0x5c93('0xc')]]['queuecallerexitAt']=utils[_0x5c93('0x13')]();queues[_0x3600ae['uniqueid']][_0x5c93('0x5')]=_0x3600ae['value'][_0x5c93('0x22')]();utils[_0x5c93('0x1')](util['format'](_0x5c93('0x23'),_0x3600ae[_0x5c93('0xc')],queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x1d')],_0x3600ae['value'],queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x5')]));writeDB(queues[_0x3600ae[_0x5c93('0xc')]]);}}else if(!_['isNil'](_0x3600ae[_0x5c93('0x24')]['queueposition'])){if(!_[_0x5c93('0x16')](queues[_0x3600ae[_0x5c93('0xc')]])&&!queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x18')]){queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x18')]=![];queues[_0x3600ae['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3600ae['uniqueid']][_0x5c93('0x19')]=!![];queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x25')]=utils[_0x5c93('0x13')]();queues[_0x3600ae['uniqueid']][_0x5c93('0x5')]=_0x5c93('0x26');utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x27'),_0x3600ae[_0x5c93('0xc')],queues[_0x3600ae['uniqueid']]['name'],_0x3600ae[_0x5c93('0x21')],queues[_0x3600ae[_0x5c93('0xc')]][_0x5c93('0x5')]));}}}catch(_0x528c73){utils[_0x5c93('0x14')](util[_0x5c93('0xf')](_0x5c93('0x28'),_0x3600ae[_0x5c93('0xc')]),_0x528c73);}};exports[_0x5c93('0x18')]=function(_0x3a1a55){try{if(!_[_0x5c93('0x16')](queues[_0x3a1a55['uniqueid']])){utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x29'),_0x3a1a55[_0x5c93('0xc')]),_0x3a1a55);queues[_0x3a1a55[_0x5c93('0xc')]]['queuecallerexit']=![];queues[_0x3a1a55[_0x5c93('0xc')]][_0x5c93('0x25')]=null;queues[_0x3a1a55[_0x5c93('0xc')]][_0x5c93('0x18')]=!![];queues[_0x3a1a55['uniqueid']][_0x5c93('0x2a')]=utils[_0x5c93('0x13')]();queues[_0x3a1a55[_0x5c93('0xc')]][_0x5c93('0x5')]=_0x5c93('0x2b');utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x2c'),_0x3a1a55[_0x5c93('0xc')],queues[_0x3a1a55[_0x5c93('0xc')]][_0x5c93('0x1d')],queues[_0x3a1a55[_0x5c93('0xc')]][_0x5c93('0x5')]));}}catch(_0x100d1b){utils['error'](util[_0x5c93('0xf')](_0x5c93('0x29'),_0x3a1a55[_0x5c93('0xc')]),_0x100d1b);}};exports[_0x5c93('0x2d')]=function(_0x585996){try{if(!_[_0x5c93('0x16')](queues[_0x585996['uniqueid']])){utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x2e'),_0x585996[_0x5c93('0xc')]),_0x585996);utils[_0x5c93('0x1')](util[_0x5c93('0xf')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x585996[_0x5c93('0xc')],queues[_0x585996['uniqueid']]['name'],_0x585996[_0x5c93('0x2f')],_0x585996['connectedlinename']));queues[_0x585996[_0x5c93('0xc')]]['queuecallerleave']=!![];queues[_0x585996[_0x5c93('0xc')]][_0x5c93('0x30')]=utils[_0x5c93('0x13')]();queues[_0x585996['uniqueid']]['holdtime']=utils[_0x5c93('0x31')](queues[_0x585996[_0x5c93('0xc')]]['queuecallerleaveAt'],queues[_0x585996[_0x5c93('0xc')]][_0x5c93('0x32')]);queues[_0x585996[_0x5c93('0xc')]][_0x5c93('0x11')]=_0x585996[_0x5c93('0x11')];queues[_0x585996[_0x5c93('0xc')]][_0x5c93('0x33')]=_0x585996[_0x5c93('0x33')];queues[_0x585996[_0x5c93('0xc')]][_0x5c93('0x2f')]=_0x585996[_0x5c93('0x2f')];queues[_0x585996[_0x5c93('0xc')]]['connectedlinename']=_0x585996[_0x5c93('0x34')];}}catch(_0x36b14a){utils[_0x5c93('0x14')](util[_0x5c93('0xf')](_0x5c93('0x2e'),_0x585996[_0x5c93('0xc')]),_0x36b14a);}};exports[_0x5c93('0x35')]=function(_0x515e47){try{if(!_[_0x5c93('0x16')](queues[_0x515e47['uniqueid']])){utils['debug'](util[_0x5c93('0xf')](_0x5c93('0x36'),_0x515e47[_0x5c93('0xc')]),_0x515e47);utils[_0x5c93('0x1')](util['format'](_0x5c93('0x37'),_0x515e47[_0x5c93('0xc')],queues[_0x515e47[_0x5c93('0xc')]][_0x5c93('0x1d')],_0x515e47[_0x5c93('0x38')],_0x515e47[_0x5c93('0x39')]));queues[_0x515e47[_0x5c93('0xc')]][_0x5c93('0x18')]=![];queues[_0x515e47[_0x5c93('0xc')]][_0x5c93('0x18')]=![];queues[_0x515e47[_0x5c93('0xc')]]['queuecallerabandonAt']=null;queues[_0x515e47[_0x5c93('0xc')]][_0x5c93('0x19')]=![];queues[_0x515e47[_0x5c93('0xc')]]['queuecallerexitreason']=null;queues[_0x515e47['uniqueid']]['queuecallerexitAt']=null;queues[_0x515e47['uniqueid']][_0x5c93('0x3a')]=!![];queues[_0x515e47[_0x5c93('0xc')]][_0x5c93('0x4')]=_0x515e47[_0x5c93('0x39')];queues[_0x515e47[_0x5c93('0xc')]]['lastAssignedTo']=_0x515e47[_0x5c93('0x38')];}}catch(_0x28c187){utils['error'](util[_0x5c93('0xf')](_0x5c93('0x36'),_0x515e47[_0x5c93('0xc')]),_0x28c187);}};exports[_0x5c93('0x3b')]=function(_0x2359bc){try{if(!_[_0x5c93('0x16')](queues[_0x2359bc[_0x5c93('0xc')]])){if(queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x30')]){utils[_0x5c93('0xe')](util['format'](_0x5c93('0x3c'),_0x2359bc['uniqueid']),_0x2359bc);queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x18')]=![];queues[_0x2359bc[_0x5c93('0xc')]]['queuecallerabandon']=![];queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x2a')]=null;queues[_0x2359bc[_0x5c93('0xc')]]['queuecallerexit']=![];queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x25')]=null;queues[_0x2359bc['uniqueid']][_0x5c93('0x3a')]=!![];queues[_0x2359bc['uniqueid']][_0x5c93('0x3')]=_0x2359bc[_0x5c93('0x38')];queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x1a')]=!![];queues[_0x2359bc[_0x5c93('0xc')]]['queuecallercompleteAt']=utils['now']();if(_0x2359bc['reason']=='transfer'){if(!queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x3d')]){queues[_0x2359bc[_0x5c93('0xc')]]['queuecallerexitreason']=_0x5c93('0x3e');}}else{queues[_0x2359bc['uniqueid']][_0x5c93('0x5')]=_0x5c93('0x3f')+_0x2359bc['reason']['toUpperCase']();}utils['info'](util[_0x5c93('0xf')](_0x5c93('0x40'),_0x2359bc[_0x5c93('0xc')],queues[_0x2359bc['uniqueid']]['name'],_0x2359bc[_0x5c93('0x38')],queues[_0x2359bc[_0x5c93('0xc')]][_0x5c93('0x5')]));writeDB(queues[_0x2359bc['uniqueid']]);}}}catch(_0x21fa88){utils[_0x5c93('0x14')](util[_0x5c93('0xf')](_0x5c93('0x3c'),_0x2359bc[_0x5c93('0xc')]),_0x21fa88);}};exports[_0x5c93('0x41')]=function(_0x28cb37){try{if(!_['isNil'](queues[_0x28cb37['transfereeuniqueid']])){utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x42'),_0x28cb37['uniqueid']),_0x28cb37);queues[_0x28cb37['transfereeuniqueid']]['transfer']=!![];queues[_0x28cb37[_0x5c93('0x43')]][_0x5c93('0x44')]='BLIND';queues[_0x28cb37[_0x5c93('0x43')]][_0x5c93('0x45')]=_0x28cb37[_0x5c93('0x46')];queues[_0x28cb37[_0x5c93('0x43')]][_0x5c93('0x47')]=_0x28cb37[_0x5c93('0x43')];queues[_0x28cb37['transfereeuniqueid']][_0x5c93('0x5')]=_0x5c93('0x48');utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x49'),_0x28cb37['uniqueid'],queues[_0x28cb37[_0x5c93('0x43')]][_0x5c93('0x1d')],_0x28cb37['transfereeuniqueid'],_0x28cb37[_0x5c93('0x46')]));}}catch(_0x743f2f){utils[_0x5c93('0x14')](util[_0x5c93('0xf')](_0x5c93('0x42'),_0x28cb37[_0x5c93('0xc')]),_0x743f2f);}};exports[_0x5c93('0x4a')]=function(_0x5af05d){try{utils[_0x5c93('0xe')](util[_0x5c93('0xf')](_0x5c93('0x4b'),_0x5af05d['origtransfereruniqueid']),_0x5af05d);if(_0x5af05d['origtransfereruniqueid']==_0x5af05d[_0x5c93('0x4c')]){if(!_[_0x5c93('0x16')](queues[_0x5af05d['secondtransfererlinkedid']])){utils['info'](util[_0x5c93('0xf')](_0x5c93('0x4d'),_0x5af05d['origtransfereruniqueid'],queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x1d')],_0x5af05d['origtransfererexten']));queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x3d')]=!![];queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x44')]=_0x5c93('0x4f');queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x45')]=_0x5af05d[_0x5c93('0x50')];queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x47')]=_0x5af05d[_0x5c93('0x51')];queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x5')]=_0x5c93('0x52');}if(!_[_0x5c93('0x16')](queues[_0x5af05d[_0x5c93('0x4c')]])){if(_0x5af05d[_0x5c93('0x53')]&&queues[_0x5af05d[_0x5c93('0x53')]]){queues[_0x5af05d[_0x5c93('0x53')]]['queuecallerenterreason']=0x1;queues[_0x5af05d[_0x5c93('0x43')]]=_[_0x5c93('0x54')](queues[_0x5af05d[_0x5c93('0x53')]]);queues[_0x5af05d[_0x5c93('0x43')]]['transfereduniqueid']=_0x5af05d[_0x5c93('0x55')];queues[_0x5af05d[_0x5c93('0x43')]][_0x5c93('0x56')]=0x2;queues[_0x5af05d[_0x5c93('0x43')]][_0x5c93('0x57')]=queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x57')];queues[_0x5af05d[_0x5c93('0x43')]]['calleridname']=queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x58')];queues[_0x5af05d['transfereeuniqueid']][_0x5c93('0x32')]=utils[_0x5c93('0x13')]();queues[_0x5af05d[_0x5c93('0x43')]]['queuecallerleaveAt']=utils['now']();queues[_0x5af05d['transfereeuniqueid']]['holdtime']=0x0;queues[_0x5af05d[_0x5c93('0x43')]]['mohtime']=0x0;utils['info'](util[_0x5c93('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5af05d[_0x5c93('0x51')],queues[_0x5af05d['transfereeuniqueid']][_0x5c93('0x1d')],queues[_0x5af05d[_0x5c93('0x43')]][_0x5c93('0x57')],queues[_0x5af05d[_0x5c93('0x43')]][_0x5c93('0x58')]));}else{utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x59'),_0x5af05d[_0x5c93('0x51')],queues[_0x5af05d['origtransfererlinkedid']]['name'],_0x5af05d[_0x5c93('0x4e')]));queues[_0x5af05d[_0x5c93('0x4c')]]['transfereduniqueid']=_0x5af05d[_0x5c93('0x4e')];}}}else if(_0x5af05d[_0x5c93('0x5a')]==_0x5af05d[_0x5c93('0x4e')]){if(!_['isNil'](queues[_0x5af05d[_0x5c93('0x4c')]])){utils['info'](util['format'](_0x5c93('0x5b'),_0x5af05d['origtransfereruniqueid'],queues[_0x5af05d[_0x5c93('0x4c')]][_0x5c93('0x1d')],_0x5af05d[_0x5c93('0x5a')],_0x5af05d['secondtransfererexten']));queues[_0x5af05d[_0x5c93('0x4c')]][_0x5c93('0x3d')]=!![];queues[_0x5af05d[_0x5c93('0x4c')]]['transfertype']=_0x5c93('0x4f');queues[_0x5af05d[_0x5c93('0x4c')]][_0x5c93('0x45')]=_0x5af05d[_0x5c93('0x5c')];queues[_0x5af05d[_0x5c93('0x4c')]][_0x5c93('0x47')]=_0x5af05d[_0x5c93('0x5a')];queues[_0x5af05d[_0x5c93('0x4c')]]['queuecallerexitreason']=_0x5c93('0x52');}if(!_['isNil'](queues[_0x5af05d[_0x5c93('0x4e')]])){if(_0x5af05d[_0x5c93('0x5d')]&&queues[_0x5af05d[_0x5c93('0x5d')]]){queues[_0x5af05d['transfertargetlinkedid']][_0x5c93('0x56')]=0x1;queues[_0x5af05d['transfertargetuniqueid']]=_['clone'](queues[_0x5af05d[_0x5c93('0x5d')]]);queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0xb')]=_0x5af05d[_0x5c93('0x55')];queues[_0x5af05d['transfertargetuniqueid']][_0x5c93('0x56')]=0x2;queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0x57')]=queues[_0x5af05d[_0x5c93('0x4c')]][_0x5c93('0x57')];queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0x58')]=queues[_0x5af05d[_0x5c93('0x4c')]]['calleridname'];queues[_0x5af05d['transfertargetuniqueid']][_0x5c93('0x32')]=utils[_0x5c93('0x13')]();queues[_0x5af05d['transfertargetuniqueid']][_0x5c93('0x30')]=utils[_0x5c93('0x13')]();queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0x5e')]=0x0;queues[_0x5af05d['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x5f'),_0x5af05d['origtransfereruniqueid'],queues[_0x5af05d['transfertargetuniqueid']][_0x5c93('0x1d')],queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0xb')],queues[_0x5af05d[_0x5c93('0x55')]][_0x5c93('0x57')],queues[_0x5af05d['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util[_0x5c93('0xf')](_0x5c93('0x59'),_0x5af05d['origtransfereruniqueid'],queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0x1d')],_0x5af05d[_0x5c93('0x4c')]));queues[_0x5af05d[_0x5c93('0x4e')]][_0x5c93('0xb')]=_0x5af05d[_0x5c93('0x4c')];}}}}catch(_0x23a54f){utils[_0x5c93('0x14')](util['format'](_0x5c93('0x4b'),_0x5af05d[_0x5c93('0x51')]),_0x23a54f);}};exports[_0x5c93('0x60')]=function(_0x7ebe4d){try{if(!_[_0x5c93('0x16')](queues[_0x7ebe4d[_0x5c93('0xc')]])){utils['debug'](util[_0x5c93('0xf')]('[%s][queues][musiconholdstart]',_0x7ebe4d['uniqueid']),_0x7ebe4d);queues[_0x7ebe4d[_0x5c93('0xc')]]['musiconholdstartAt']=utils['now']();utils[_0x5c93('0x1')](util[_0x5c93('0xf')](_0x5c93('0x61'),_0x7ebe4d[_0x5c93('0xc')],queues[_0x7ebe4d[_0x5c93('0xc')]]['name'],queues[_0x7ebe4d[_0x5c93('0xc')]][_0x5c93('0x62')]));}}catch(_0x3a0b47){utils[_0x5c93('0x14')](util[_0x5c93('0xf')]('[%s][queues][musiconholdstart]',_0x7ebe4d[_0x5c93('0xc')]),_0x3a0b47);}};exports[_0x5c93('0x63')]=function(_0x382700){try{if(!_[_0x5c93('0x16')](queues[_0x382700[_0x5c93('0xc')]])){if(!_[_0x5c93('0x16')](queues[_0x382700[_0x5c93('0xc')]]['musiconholdstartAt'])){utils[_0x5c93('0xe')](util[_0x5c93('0xf')]('[%s][queues][musiconholdstop]',_0x382700[_0x5c93('0xc')]),_0x382700);queues[_0x382700[_0x5c93('0xc')]]['mohtime']+=utils[_0x5c93('0x31')](utils['now'](),queues[_0x382700[_0x5c93('0xc')]][_0x5c93('0x62')]);utils[_0x5c93('0x1')](util[_0x5c93('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x382700[_0x5c93('0xc')],queues[_0x382700[_0x5c93('0xc')]][_0x5c93('0x1d')],queues[_0x382700[_0x5c93('0xc')]]['mohtime']));delete queues[_0x382700[_0x5c93('0xc')]]['musiconholdstartAt'];}}}catch(_0x1e0d68){utils[_0x5c93('0x14')](util[_0x5c93('0xf')](_0x5c93('0x64'),_0x382700[_0x5c93('0xc')]),_0x1e0d68);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0fd4a89..8c44d9d 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 _0xd98d=['find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV'];(function(_0x1eabab,_0x23edd2){var _0x1e1972=function(_0x4949d9){while(--_0x4949d9){_0x1eabab['push'](_0x1eabab['shift']());}};_0x1e1972(++_0x23edd2);}(_0xd98d,0xe5));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require(_0xdd98('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4c1cae){utils[_0xdd98('0x2')](util['format'](_0xdd98('0x3'),_0x4c1cae[_0xdd98('0x4')]));if(_0x4c1cae[_0xdd98('0x5')]){utils['getUserByInternal'](_0x4c1cae[_0xdd98('0x5')])[_0xdd98('0x6')](function(_0x3a298f){if(_0x3a298f){_0x4c1cae[_0xdd98('0x7')]=_0x3a298f[_0xdd98('0x8')];_0x4c1cae[_0xdd98('0x9')]=_0x3a298f['id'];}utils[_0xdd98('0xa')]('CreateVoiceRecording',_0x4c1cae);});}else{utils[_0xdd98('0xa')](_0xdd98('0xb'),_0x4c1cae);}}exports[_0xdd98('0xc')]=function(_0x2b4860){try{utils[_0xdd98('0xd')](util['format'](_0xdd98('0xe'),_0x2b4860[_0xdd98('0x4')]),_0x2b4860);if(_0x2b4860[_0xdd98('0x4')]==_0x2b4860[_0xdd98('0xf')]){utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x11'),_0x2b4860['uniqueid'],_0x2b4860[_0xdd98('0x12')],_0x2b4860[_0xdd98('0x13')]));recordings[_0x2b4860[_0xdd98('0x4')]]={'uniqueid':_0x2b4860['uniqueid'],'accountcode':_0x2b4860[_0xdd98('0x5')],'exten':_0x2b4860[_0xdd98('0x13')],'context':_0x2b4860[_0xdd98('0x12')],'channel':_0x2b4860[_0xdd98('0x14')],'monitors':[]};}}catch(_0x534df5){utils[_0xdd98('0x15')](util['format'](_0xdd98('0xe'),_0x2b4860[_0xdd98('0x4')]),_0x534df5);}};exports[_0xdd98('0x16')]=function(_0x3a6990){try{utils[_0xdd98('0xd')](util['format'](_0xdd98('0x17'),_0x3a6990[_0xdd98('0x4')]),_0x3a6990);if(!_[_0xdd98('0x18')](recordings[_0x3a6990['uniqueid']])&&_0x3a6990[_0xdd98('0x19')]==0x6){utils[_0xdd98('0x2')](util['format'](_0xdd98('0x1a'),_0x3a6990['uniqueid'],_0x3a6990[_0xdd98('0x12')],_0x3a6990[_0xdd98('0x14')]));}else if(!_[_0xdd98('0x18')](recordings[_0x3a6990[_0xdd98('0xf')]])&&_0x3a6990[_0xdd98('0x19')]==0x6&&_0x3a6990[_0xdd98('0x12')]!=_0xdd98('0x1b')){utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x1c'),_0x3a6990[_0xdd98('0x4')],_0x3a6990[_0xdd98('0xf')],_0x3a6990[_0xdd98('0x12')],_0x3a6990['channel']));recordings[_0x3a6990['linkedid']][_0xdd98('0x5')]=_0x3a6990['accountcode'];}}catch(_0x12814c){utils['error'](util[_0xdd98('0x10')](_0xdd98('0x17'),_0x3a6990[_0xdd98('0x4')]),_0x12814c);}};exports[_0xdd98('0x1d')]=function(_0x52fa87){try{if(!_['isNil'](_0x52fa87[_0xdd98('0x1e')])&&!_['isNil'](_0x52fa87[_0xdd98('0x1e')][_0xdd98('0x1f')])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')](_0xdd98('0x20'),_0x52fa87[_0xdd98('0x4')]),_0x52fa87);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x21'),_0x52fa87[_0xdd98('0x4')],_0x52fa87[_0xdd98('0x1e')],_0x52fa87[_0xdd98('0x22')]));if(_[_0xdd98('0x23')](_0x52fa87['value'],_0xdd98('0x24'))){_0x52fa87[_0xdd98('0x22')]=_0x52fa87[_0xdd98('0x22')][_0xdd98('0x25')](_0xdd98('0x24'),_0xdd98('0x26'));}if(recordings[_0x52fa87[_0xdd98('0xf')]]){var _0xb8e342=_[_0xdd98('0x27')](recordings[_0x52fa87[_0xdd98('0xf')]][_0xdd98('0x28')],{'value':_0x52fa87['value']});if(_[_0xdd98('0x18')](_0xb8e342)){recordings[_0x52fa87[_0xdd98('0xf')]]['monitors'][_0xdd98('0x29')]({'value':_0x52fa87[_0xdd98('0x22')]});}}}}catch(_0x146dbf){utils[_0xdd98('0x15')](util[_0xdd98('0x10')]('[%s][recordings][varset]',_0x52fa87[_0xdd98('0x4')]),_0x146dbf);}};exports[_0xdd98('0x2a')]=function(_0x2d3ea2){try{if(!_[_0xdd98('0x18')](recordings[_0x2d3ea2['uniqueid']])){utils['debug'](util[_0xdd98('0x10')](_0xdd98('0x2b'),_0x2d3ea2[_0xdd98('0x4')]),_0x2d3ea2);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x2c'),_0x2d3ea2[_0xdd98('0x4')],_0x2d3ea2[_0xdd98('0x2d')],_0x2d3ea2['calleridname'],_0x2d3ea2[_0xdd98('0x2e')]));recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x2d')]=_0x2d3ea2[_0xdd98('0x2d')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x2f')]=_0x2d3ea2[_0xdd98('0x2f')];recordings[_0x2d3ea2['uniqueid']][_0xdd98('0x30')]=_0x2d3ea2[_0xdd98('0x30')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x31')]=_0x2d3ea2[_0xdd98('0x31')];if(recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x32')]==_0xdd98('0x33')&&recordings[_0x2d3ea2['uniqueid']]['accountcode']){recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x30')]=recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x5')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x31')]='';}recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x28')][_0xdd98('0x34')](function(_0x3c49c4){var _0x4de337=_[_0xdd98('0x35')](recordings[_0x2d3ea2[_0xdd98('0x4')]]);_0x4de337[_0xdd98('0x22')]=_0x3c49c4[_0xdd98('0x22')];writeDB(_0x4de337);});delete recordings[_0x2d3ea2[_0xdd98('0x4')]];}}catch(_0x4c1d0d){utils[_0xdd98('0x15')](util['format']('[%s][recordings][hangup]',_0x2d3ea2['uniqueid']),_0x4c1d0d);}};exports[_0xdd98('0x36')]=function(_0x429bdd){try{if(!_[_0xdd98('0x18')](recordings[_0x429bdd[_0xdd98('0x4')]])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')](_0xdd98('0x37'),_0x429bdd[_0xdd98('0x4')]),_0x429bdd);utils['info'](util[_0xdd98('0x10')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x429bdd[_0xdd98('0x4')],_0x429bdd[_0xdd98('0x38')],_0x429bdd['appdata']));if(_0x429bdd[_0xdd98('0x38')][_0xdd98('0x39')]()=='set'&&_[_0xdd98('0x3a')](_0x429bdd['appdata'][_0xdd98('0x39')](),'cdr')){var _0xde0f1c=_0x429bdd[_0xdd98('0x3b')][_0xdd98('0x3c')]('=');var _0x25e791=_0xde0f1c[0x0][_0xdd98('0x3d')](_0xde0f1c[0x0][_0xdd98('0x3e')]('(')+0x1,_0xde0f1c[0x0][_0xdd98('0x3e')](')'));var _0x4d327d=_0xde0f1c[0x1];recordings[_0x429bdd['uniqueid']][_0x25e791]=_0x4d327d;}}}catch(_0x4b085d){utils[_0xdd98('0x15')](util[_0xdd98('0x10')](_0xdd98('0x37'),_0x429bdd[_0xdd98('0x4')]),_0x4b085d);}};exports[_0xdd98('0x3f')]=function(_0x5c0003){try{if(!_['isNil'](recordings[_0x5c0003[_0xdd98('0x4')]])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')]('[%s][recordings][queuecallerjoin]',_0x5c0003[_0xdd98('0x4')]),_0x5c0003);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x40'),_0x5c0003[_0xdd98('0x4')],_0x5c0003[_0xdd98('0x41')]));recordings[_0x5c0003[_0xdd98('0x4')]][_0xdd98('0x41')]=_0x5c0003['queue'];}}catch(_0x564bd1){utils[_0xdd98('0x15')](util[_0xdd98('0x10')](_0xdd98('0x42'),_0x5c0003[_0xdd98('0x4')]),_0x564bd1);}}; \ No newline at end of file +var _0xc2ba=['.wav49','replace','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value'];(function(_0x19a36b,_0x4860e1){var _0x35f916=function(_0x409c84){while(--_0x409c84){_0x19a36b['push'](_0x19a36b['shift']());}};_0x35f916(++_0x4860e1);}(_0xc2ba,0x9f));var _0xac2b=function(_0x576786,_0x2b10b6){_0x576786=_0x576786-0x0;var _0x350e54=_0xc2ba[_0x576786];return _0x350e54;};'use strict';var _=require(_0xac2b('0x0'));var util=require(_0xac2b('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x37dc63){utils['info'](util[_0xac2b('0x2')](_0xac2b('0x3'),_0x37dc63[_0xac2b('0x4')]));if(_0x37dc63[_0xac2b('0x5')]){utils[_0xac2b('0x6')](_0x37dc63[_0xac2b('0x5')])['then'](function(_0x567c78){if(_0x567c78){_0x37dc63[_0xac2b('0x7')]=_0x567c78[_0xac2b('0x8')];_0x37dc63[_0xac2b('0x9')]=_0x567c78['id'];}utils[_0xac2b('0xa')](_0xac2b('0xb'),_0x37dc63);});}else{utils[_0xac2b('0xa')](_0xac2b('0xb'),_0x37dc63);}}exports[_0xac2b('0xc')]=function(_0x521021){try{utils[_0xac2b('0xd')](util[_0xac2b('0x2')](_0xac2b('0xe'),_0x521021['uniqueid']),_0x521021);if(_0x521021[_0xac2b('0x4')]==_0x521021[_0xac2b('0xf')]){utils[_0xac2b('0x10')](util[_0xac2b('0x2')](_0xac2b('0x11'),_0x521021[_0xac2b('0x4')],_0x521021[_0xac2b('0x12')],_0x521021[_0xac2b('0x13')]));recordings[_0x521021[_0xac2b('0x4')]]={'uniqueid':_0x521021[_0xac2b('0x4')],'accountcode':_0x521021[_0xac2b('0x5')],'exten':_0x521021[_0xac2b('0x13')],'context':_0x521021[_0xac2b('0x12')],'channel':_0x521021[_0xac2b('0x14')],'monitors':[]};}}catch(_0x4295fc){utils['error'](util[_0xac2b('0x2')](_0xac2b('0xe'),_0x521021['uniqueid']),_0x4295fc);}};exports[_0xac2b('0x15')]=function(_0x44bb79){try{utils[_0xac2b('0xd')](util[_0xac2b('0x2')]('[%s][recordings][newstate]',_0x44bb79[_0xac2b('0x4')]),_0x44bb79);if(!_[_0xac2b('0x16')](recordings[_0x44bb79[_0xac2b('0x4')]])&&_0x44bb79[_0xac2b('0x17')]==0x6){utils[_0xac2b('0x10')](util['format'](_0xac2b('0x18'),_0x44bb79[_0xac2b('0x4')],_0x44bb79[_0xac2b('0x12')],_0x44bb79[_0xac2b('0x14')]));}else if(!_['isNil'](recordings[_0x44bb79[_0xac2b('0xf')]])&&_0x44bb79['channelstate']==0x6&&_0x44bb79['context']!=_0xac2b('0x19')){utils[_0xac2b('0x10')](util[_0xac2b('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x44bb79[_0xac2b('0x4')],_0x44bb79['linkedid'],_0x44bb79['context'],_0x44bb79[_0xac2b('0x14')]));recordings[_0x44bb79['linkedid']][_0xac2b('0x5')]=_0x44bb79[_0xac2b('0x5')];}}catch(_0x3bb508){utils['error'](util[_0xac2b('0x2')](_0xac2b('0x1a'),_0x44bb79[_0xac2b('0x4')]),_0x3bb508);}};exports[_0xac2b('0x1b')]=function(_0x14fc56){try{if(!_[_0xac2b('0x16')](_0x14fc56[_0xac2b('0x1c')])&&!_[_0xac2b('0x16')](_0x14fc56[_0xac2b('0x1c')][_0xac2b('0x1d')])){utils['debug'](util['format'](_0xac2b('0x1e'),_0x14fc56[_0xac2b('0x4')]),_0x14fc56);utils[_0xac2b('0x10')](util[_0xac2b('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x14fc56[_0xac2b('0x4')],_0x14fc56['variable'],_0x14fc56['value']));if(_[_0xac2b('0x1f')](_0x14fc56[_0xac2b('0x20')],_0xac2b('0x21'))){_0x14fc56['value']=_0x14fc56[_0xac2b('0x20')][_0xac2b('0x22')](_0xac2b('0x21'),'.WAV');}if(recordings[_0x14fc56['linkedid']]){var _0x4ad088=_[_0xac2b('0x23')](recordings[_0x14fc56['linkedid']][_0xac2b('0x24')],{'value':_0x14fc56[_0xac2b('0x20')]});if(_[_0xac2b('0x16')](_0x4ad088)){recordings[_0x14fc56[_0xac2b('0xf')]][_0xac2b('0x24')][_0xac2b('0x25')]({'value':_0x14fc56[_0xac2b('0x20')]});}}}}catch(_0x8a6eb){utils[_0xac2b('0x26')](util[_0xac2b('0x2')]('[%s][recordings][varset]',_0x14fc56[_0xac2b('0x4')]),_0x8a6eb);}};exports[_0xac2b('0x27')]=function(_0x3aeb92){try{if(!_[_0xac2b('0x16')](recordings[_0x3aeb92[_0xac2b('0x4')]])){utils[_0xac2b('0xd')](util['format'](_0xac2b('0x28'),_0x3aeb92['uniqueid']),_0x3aeb92);utils[_0xac2b('0x10')](util['format'](_0xac2b('0x29'),_0x3aeb92[_0xac2b('0x4')],_0x3aeb92[_0xac2b('0x2a')],_0x3aeb92[_0xac2b('0x2b')],_0x3aeb92[_0xac2b('0x2c')]));recordings[_0x3aeb92['uniqueid']][_0xac2b('0x2a')]=_0x3aeb92['calleridnum'];recordings[_0x3aeb92['uniqueid']]['calleridname']=_0x3aeb92[_0xac2b('0x2b')];recordings[_0x3aeb92[_0xac2b('0x4')]][_0xac2b('0x2d')]=_0x3aeb92[_0xac2b('0x2d')];recordings[_0x3aeb92[_0xac2b('0x4')]][_0xac2b('0x2e')]=_0x3aeb92['connectedlinename'];if(recordings[_0x3aeb92['uniqueid']][_0xac2b('0x2f')]==_0xac2b('0x30')&&recordings[_0x3aeb92[_0xac2b('0x4')]][_0xac2b('0x5')]){recordings[_0x3aeb92['uniqueid']][_0xac2b('0x2d')]=recordings[_0x3aeb92[_0xac2b('0x4')]][_0xac2b('0x5')];recordings[_0x3aeb92[_0xac2b('0x4')]][_0xac2b('0x2e')]='';}recordings[_0x3aeb92[_0xac2b('0x4')]]['monitors'][_0xac2b('0x31')](function(_0x595992){var _0x4de8c1=_['clone'](recordings[_0x3aeb92['uniqueid']]);_0x4de8c1[_0xac2b('0x20')]=_0x595992[_0xac2b('0x20')];writeDB(_0x4de8c1);});delete recordings[_0x3aeb92[_0xac2b('0x4')]];}}catch(_0x2f4e49){utils[_0xac2b('0x26')](util[_0xac2b('0x2')](_0xac2b('0x28'),_0x3aeb92[_0xac2b('0x4')]),_0x2f4e49);}};exports['newexten']=function(_0x4b00df){try{if(!_[_0xac2b('0x16')](recordings[_0x4b00df[_0xac2b('0x4')]])){utils[_0xac2b('0xd')](util[_0xac2b('0x2')](_0xac2b('0x32'),_0x4b00df[_0xac2b('0x4')]),_0x4b00df);utils['info'](util[_0xac2b('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4b00df[_0xac2b('0x4')],_0x4b00df[_0xac2b('0x33')],_0x4b00df[_0xac2b('0x34')]));if(_0x4b00df['application'][_0xac2b('0x35')]()==_0xac2b('0x36')&&_[_0xac2b('0x37')](_0x4b00df[_0xac2b('0x34')][_0xac2b('0x35')](),_0xac2b('0x38'))){var _0x35a6c6=_0x4b00df[_0xac2b('0x34')][_0xac2b('0x39')]('=');var _0xa46840=_0x35a6c6[0x0][_0xac2b('0x3a')](_0x35a6c6[0x0][_0xac2b('0x3b')]('(')+0x1,_0x35a6c6[0x0][_0xac2b('0x3b')](')'));var _0x541fd4=_0x35a6c6[0x1];recordings[_0x4b00df[_0xac2b('0x4')]][_0xa46840]=_0x541fd4;}}}catch(_0x2a5600){utils['error'](util[_0xac2b('0x2')]('[%s][recordings][newexten]',_0x4b00df[_0xac2b('0x4')]),_0x2a5600);}};exports[_0xac2b('0x3c')]=function(_0x131f47){try{if(!_['isNil'](recordings[_0x131f47[_0xac2b('0x4')]])){utils[_0xac2b('0xd')](util[_0xac2b('0x2')](_0xac2b('0x3d'),_0x131f47['uniqueid']),_0x131f47);utils[_0xac2b('0x10')](util['format'](_0xac2b('0x3e'),_0x131f47[_0xac2b('0x4')],_0x131f47[_0xac2b('0x3f')]));recordings[_0x131f47[_0xac2b('0x4')]]['queue']=_0x131f47[_0xac2b('0x3f')];}}catch(_0x6eeff2){utils[_0xac2b('0x26')](util[_0xac2b('0x2')](_0xac2b('0x3d'),_0x131f47[_0xac2b('0x4')]),_0x6eeff2);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 90130c0..2895ea7 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 _0x9c13=['transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9c13,0x16a));var _0x39c1=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x9c13[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x39c1('0x0'));var util=require(_0x39c1('0x1'));var utils=require(_0x39c1('0x2'));function writeDB(_0x402a1c){utils[_0x39c1('0x3')](util['format'](_0x39c1('0x4'),_0x402a1c['type']===_0x39c1('0x5')?_0x402a1c[_0x39c1('0x6')]:_0x402a1c['uniqueid'],_0x402a1c[_0x39c1('0x7')]));utils[_0x39c1('0x8')](_0x39c1('0x9'),_0x402a1c);}exports[_0x39c1('0xa')]=function(_0x4d9311){try{utils[_0x39c1('0xb')](util['format'](_0x39c1('0xc'),_0x4d9311[_0x39c1('0xd')]),_0x4d9311);utils[_0x39c1('0x3')](util[_0x39c1('0xe')](_0x39c1('0xf'),_0x4d9311[_0x39c1('0xd')],_0x4d9311[_0x39c1('0x10')],_0x4d9311[_0x39c1('0x11')],_0x4d9311['transfereecalleridnum'],_0x4d9311['transfereecalleridname']));_0x4d9311['type']=_0x39c1('0x12');writeDB(_0x4d9311);}catch(_0x22911a){utils[_0x39c1('0x13')](util[_0x39c1('0xe')](_0x39c1('0xc'),_0x4d9311[_0x39c1('0xd')]),_0x22911a);}};exports[_0x39c1('0x14')]=function(_0x316ea4){try{utils['debug'](util[_0x39c1('0xe')]('[%s][transfers][attendedtransfer]',_0x316ea4[_0x39c1('0x6')]),_0x316ea4);utils[_0x39c1('0x3')](util[_0x39c1('0xe')](_0x39c1('0x15'),_0x316ea4[_0x39c1('0x6')],_0x316ea4[_0x39c1('0x16')],_0x316ea4[_0x39c1('0x17')],_0x316ea4[_0x39c1('0x18')],_0x316ea4[_0x39c1('0x19')]));_0x316ea4=_['assign'](_0x316ea4,{'transfererchannel':_0x316ea4['origtransfererchannel'],'transferercalleridnum':_0x316ea4[_0x39c1('0x16')],'transferercalleridname':_0x316ea4['origtransferercalleridname'],'transfererconnectedlinenum':_0x316ea4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x316ea4[_0x39c1('0x1a')],'transfereraccountcode':_0x316ea4[_0x39c1('0x1b')],'transferercontext':_0x316ea4[_0x39c1('0x1c')],'transfererexten':_0x316ea4[_0x39c1('0x1d')],'transfererlinkedid':_0x316ea4[_0x39c1('0x1e')],'context':_0x316ea4[_0x39c1('0x1f')],'extension':_0x316ea4[_0x39c1('0x20')],'type':_0x39c1('0x5')});if(_[_0x39c1('0x21')](_0x316ea4[_0x39c1('0x22')])){_0x316ea4=_[_0x39c1('0x23')](_0x316ea4,{'transfereechannel':_0x316ea4[_0x39c1('0x24')],'transfereecalleridnum':_0x316ea4[_0x39c1('0x18')],'transfereecalleridname':_0x316ea4['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x316ea4[_0x39c1('0x25')],'transfereeconnectedlinename':_0x316ea4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x316ea4[_0x39c1('0x26')],'transfereecontext':_0x316ea4[_0x39c1('0x27')],'transfereeexten':_0x316ea4[_0x39c1('0x28')],'transfereelinkedid':_0x316ea4[_0x39c1('0x29')]});}writeDB(_0x316ea4);}catch(_0x1e1074){utils[_0x39c1('0x13')](util[_0x39c1('0xe')]('[%s][transfers][attendedtransfer]',_0x316ea4[_0x39c1('0x6')]),_0x1e1074);}}; \ No newline at end of file +var _0x7f68=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','request','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7f68,0xcb));var _0x87f6=function(_0x35640f,_0x3351bb){_0x35640f=_0x35640f-0x0;var _0x508de1=_0x7f68[_0x35640f];return _0x508de1;};'use strict';var _=require('lodash');var util=require(_0x87f6('0x0'));var utils=require('./utils');function writeDB(_0x561a2d){utils[_0x87f6('0x1')](util[_0x87f6('0x2')](_0x87f6('0x3'),_0x561a2d['type']==='attended'?_0x561a2d[_0x87f6('0x4')]:_0x561a2d[_0x87f6('0x5')],_0x561a2d['type']));utils[_0x87f6('0x6')]('CreateVoiceTransferReport',_0x561a2d);}exports['blindtransfer']=function(_0x4abbf8){try{utils[_0x87f6('0x7')](util[_0x87f6('0x2')](_0x87f6('0x8'),_0x4abbf8['uniqueid']),_0x4abbf8);utils['info'](util[_0x87f6('0x2')](_0x87f6('0x9'),_0x4abbf8['uniqueid'],_0x4abbf8[_0x87f6('0xa')],_0x4abbf8['transferercalleridname'],_0x4abbf8[_0x87f6('0xb')],_0x4abbf8[_0x87f6('0xc')]));_0x4abbf8['type']=_0x87f6('0xd');writeDB(_0x4abbf8);}catch(_0x5df79a){utils[_0x87f6('0xe')](util['format'](_0x87f6('0x8'),_0x4abbf8[_0x87f6('0x5')]),_0x5df79a);}};exports['attendedtransfer']=function(_0x271503){try{utils[_0x87f6('0x7')](util['format'](_0x87f6('0xf'),_0x271503[_0x87f6('0x4')]),_0x271503);utils[_0x87f6('0x1')](util['format'](_0x87f6('0x10'),_0x271503[_0x87f6('0x4')],_0x271503[_0x87f6('0x11')],_0x271503[_0x87f6('0x12')],_0x271503['transfertargetcalleridnum'],_0x271503[_0x87f6('0x13')]));_0x271503=_[_0x87f6('0x14')](_0x271503,{'transfererchannel':_0x271503[_0x87f6('0x15')],'transferercalleridnum':_0x271503[_0x87f6('0x11')],'transferercalleridname':_0x271503['origtransferercalleridname'],'transfererconnectedlinenum':_0x271503[_0x87f6('0x16')],'transfererconnectedlinename':_0x271503[_0x87f6('0x17')],'transfereraccountcode':_0x271503[_0x87f6('0x18')],'transferercontext':_0x271503['secondtransferercontext'],'transfererexten':_0x271503[_0x87f6('0x19')],'transfererlinkedid':_0x271503[_0x87f6('0x1a')],'context':_0x271503[_0x87f6('0x1b')],'extension':_0x271503['origtransfererexten'],'type':_0x87f6('0x1c')});if(_[_0x87f6('0x1d')](_0x271503[_0x87f6('0x1e')])){_0x271503=_[_0x87f6('0x14')](_0x271503,{'transfereechannel':_0x271503[_0x87f6('0x1f')],'transfereecalleridnum':_0x271503[_0x87f6('0x20')],'transfereecalleridname':_0x271503['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x271503[_0x87f6('0x21')],'transfereeconnectedlinename':_0x271503['transfertargetconnectedlinename'],'transfereeaccountcode':_0x271503[_0x87f6('0x22')],'transfereecontext':_0x271503[_0x87f6('0x23')],'transfereeexten':_0x271503[_0x87f6('0x24')],'transfereelinkedid':_0x271503['transfertargetlinkedid']});}writeDB(_0x271503);}catch(_0x32e484){utils[_0x87f6('0xe')](util['format'](_0x87f6('0xf'),_0x271503['origtransfereruniqueid']),_0x32e484);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e99db6e..e012194 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 _0x8598=['seconds','diffTime','diff','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','inspect','debug','error','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','request','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','subtractTime','subtract'];(function(_0x4917de,_0x4cca9b){var _0x11d892=function(_0x59848d){while(--_0x59848d){_0x4917de['push'](_0x4917de['shift']());}};_0x11d892(++_0x4cca9b);}(_0x8598,0x17f));var _0x8859=function(_0x4257cf,_0x3cd364){_0x4257cf=_0x4257cf-0x0;var _0x5394a3=_0x8598[_0x4257cf];return _0x5394a3;};'use strict';var BPromise=require(_0x8859('0x0'));var jayson=require(_0x8859('0x1'));var moment=require(_0x8859('0x2'));var util=require(_0x8859('0x3'));var client=jayson[_0x8859('0x4')][_0x8859('0x5')]({'port':0x2329});var logger=require(_0x8859('0x6'))('xdr');exports['info']=function(_0x2afb9b,_0x103c87){logger['info'](_0x2afb9b,_0x103c87?util[_0x8859('0x7')](_0x103c87,{'showHidden':![],'depth':null}):'');};exports[_0x8859('0x8')]=function(_0x32fd65,_0x1c7527){logger[_0x8859('0x8')](_0x32fd65,_0x1c7527?util['inspect'](_0x1c7527,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x460a7a,_0x5e6bb5){logger[_0x8859('0x9')](_0x460a7a,_0x5e6bb5?util['inspect'](_0x5e6bb5,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x86a3cb,_0x16da0b){return client['request'](_0x86a3cb,{'body':_0x16da0b})[_0x8859('0xa')](function(_0xa31c74){logger[_0x8859('0x8')]('[utils][request]\x20name:%s',_0x86a3cb,_0xa31c74?util['inspect'](_0xa31c74,{'showHidden':![],'depth':null}):'');})[_0x8859('0xb')](function(_0x3f0132){logger[_0x8859('0x9')](_0x8859('0xc'),_0x86a3cb,_0x3f0132?util['inspect'](_0x3f0132,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4876f7){return client['request'](_0x8859('0xd'),{'options':{'raw':!![],'attributes':['id',_0x8859('0xe'),_0x8859('0xf'),'interface'],'where':_0x4876f7,'limit':0x1}})[_0x8859('0xa')](function(_0x3f5ffb){logger['debug'](_0x8859('0x10'),JSON[_0x8859('0x11')](_0x4876f7),_0x3f5ffb?util[_0x8859('0x7')](_0x3f5ffb,{'showHidden':![],'depth':null}):'');return _0x3f5ffb[_0x8859('0x12')][_0x8859('0x13')]?_0x3f5ffb[_0x8859('0x12')][0x0]:null;});}exports[_0x8859('0x14')]=function(_0x30c7e2){return new BPromise(function(_0x537f0f,_0x3c34f7){if(_0x30c7e2){return getUser({'internal':_0x30c7e2})[_0x8859('0xa')](function(_0x26b1f2){logger[_0x8859('0x15')](_0x8859('0x16'),_0x30c7e2,_0x26b1f2?_0x8859('0x17'):_0x8859('0x18'));return _0x537f0f(_0x26b1f2);})['catch'](function(_0x28d9a0){logger[_0x8859('0x9')](_0x8859('0x19'),_0x28d9a0?util[_0x8859('0x7')](_0x28d9a0,{'showHidden':![],'depth':null}):'');return _0x537f0f(null);});}return _0x537f0f(null);});};exports[_0x8859('0x1a')]=function(_0x4f0b8c){return new BPromise(function(_0x1b5c65,_0x5a10c7){if(_0x4f0b8c){return getUser({'interface':_0x4f0b8c})[_0x8859('0xa')](function(_0xf9b3d1){logger[_0x8859('0x15')](_0x8859('0x1b'),_0x4f0b8c,_0xf9b3d1?_0x8859('0x17'):_0x8859('0x18'));return _0x1b5c65(_0xf9b3d1);})['catch'](function(_0x3503e0){logger[_0x8859('0x9')]('[utils][getUserByInterface]',_0x3503e0?util[_0x8859('0x7')](_0x3503e0,{'showHidden':![],'depth':null}):'');return _0x1b5c65(null);});}return _0x1b5c65(null);});};exports[_0x8859('0x1c')]=function(_0x204a11){return new BPromise(function(_0xbbfca7,_0x19b092){if(_0x204a11){return getUser({'name':_0x204a11})['then'](function(_0x287d08){logger[_0x8859('0x15')]('[utils][getUserByName]\x20name:%s\x20%s',_0x204a11,_0x287d08?_0x8859('0x17'):'notfound');return _0xbbfca7(_0x287d08);})[_0x8859('0xb')](function(_0x974217){logger[_0x8859('0x9')](_0x8859('0x1d'),_0x974217?util[_0x8859('0x7')](_0x974217,{'showHidden':![],'depth':null}):'');return _0xbbfca7(null);});}return _0xbbfca7(null);});};exports['getVoiceQueueByName']=function(_0x5ae03a){return new BPromise(function(_0x23e056,_0x5544d5){if(_0x5ae03a){return client[_0x8859('0x1e')](_0x8859('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x8859('0xf'),'type',_0x8859('0x20'),_0x8859('0x21')],'where':{'name':_0x5ae03a},'limit':0x1}})[_0x8859('0xa')](function(_0x399013){logger['debug'](_0x8859('0x22'),_0x5ae03a,_0x399013?util[_0x8859('0x7')](_0x399013,{'showHidden':![],'depth':null}):'');logger['info'](_0x8859('0x23'),_0x5ae03a,_0x399013?_0x8859('0x17'):_0x8859('0x18'));return _0x23e056(_0x399013['result'][_0x8859('0x13')]?_0x399013['result'][0x0]:null);})[_0x8859('0xb')](function(_0x2de4f0){logger['error']('[utils][getVoiceQueueByName]',_0x2de4f0?util[_0x8859('0x7')](_0x2de4f0,{'showHidden':![],'depth':null}):'');return _0x23e056(null);});}return _0x23e056(null);});};exports['addTime']=function(_0x4a327d,_0x49d308){return moment(_0x4a327d)[_0x8859('0x24')](_0x49d308,'seconds')[_0x8859('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8859('0x26')]=function(_0x3f917a,_0xc63ced){return moment(_0x3f917a)[_0x8859('0x27')](_0xc63ced,_0x8859('0x28'))[_0x8859('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8859('0x29')]=function(_0xc068d6,_0x3dda26){return moment(_0xc068d6)[_0x8859('0x2a')](moment(_0x3dda26),_0x8859('0x28'));};exports['sumTime']=function(_0x43c595,_0x1e757b){return parseInt(_0x43c595,0xa)+parseInt(_0x1e757b,0xa);};exports[_0x8859('0x2b')]=function(){return moment()[_0x8859('0x25')](_0x8859('0x2c'));};exports[_0x8859('0x2d')]=function(_0x47708b,_0x37c125){if(_0x37c125){return moment(_0x47708b)[_0x8859('0x2d')](_0x37c125);}return!![];};exports[_0x8859('0x2e')]=function(_0x2858aa,_0x232249){if(_0x232249){return moment(_0x2858aa)[_0x8859('0x2e')](_0x232249);}else if(_0x2858aa){return!![];}return![];}; \ No newline at end of file +var _0x2229=['found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s'];(function(_0x7c668c,_0x120a37){var _0x1c0459=function(_0x36a685){while(--_0x36a685){_0x7c668c['push'](_0x7c668c['shift']());}};_0x1c0459(++_0x120a37);}(_0x2229,0xde));var _0x9222=function(_0x14dde2,_0x3ec312){_0x14dde2=_0x14dde2-0x0;var _0x31418c=_0x2229[_0x14dde2];return _0x31418c;};'use strict';var BPromise=require(_0x9222('0x0'));var jayson=require(_0x9222('0x1'));var moment=require('moment');var util=require(_0x9222('0x2'));var client=jayson[_0x9222('0x3')][_0x9222('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x9222('0x5'));exports[_0x9222('0x6')]=function(_0x1a3f06,_0x5eb30b){logger[_0x9222('0x6')](_0x1a3f06,_0x5eb30b?util[_0x9222('0x7')](_0x5eb30b,{'showHidden':![],'depth':null}):'');};exports[_0x9222('0x8')]=function(_0x4bfd26,_0x411a0e){logger[_0x9222('0x8')](_0x4bfd26,_0x411a0e?util[_0x9222('0x7')](_0x411a0e,{'showHidden':![],'depth':null}):'');};exports[_0x9222('0x9')]=function(_0x2ea9b7,_0x30d655){logger[_0x9222('0x9')](_0x2ea9b7,_0x30d655?util['inspect'](_0x30d655,{'showHidden':![],'depth':null}):'');};exports[_0x9222('0xa')]=function(_0x3a6623,_0x57d951){return client[_0x9222('0xa')](_0x3a6623,{'body':_0x57d951})['then'](function(_0x3162d8){logger[_0x9222('0x8')]('[utils][request]\x20name:%s',_0x3a6623,_0x3162d8?util[_0x9222('0x7')](_0x3162d8,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3f0835){logger['error'](_0x9222('0xb'),_0x3a6623,_0x3f0835?util[_0x9222('0x7')](_0x3f0835,{'showHidden':![],'depth':null}):'');});};function getUser(_0x38ecd8){return client[_0x9222('0xa')](_0x9222('0xc'),{'options':{'raw':!![],'attributes':['id',_0x9222('0xd'),_0x9222('0xe'),_0x9222('0xf')],'where':_0x38ecd8,'limit':0x1}})[_0x9222('0x10')](function(_0x356aca){logger[_0x9222('0x8')](_0x9222('0x11'),JSON[_0x9222('0x12')](_0x38ecd8),_0x356aca?util[_0x9222('0x7')](_0x356aca,{'showHidden':![],'depth':null}):'');return _0x356aca[_0x9222('0x13')][_0x9222('0x14')]?_0x356aca['result'][0x0]:null;});}exports[_0x9222('0x15')]=function(_0x276233){return new BPromise(function(_0xb2c0e4,_0x51d676){if(_0x276233){return getUser({'internal':_0x276233})[_0x9222('0x10')](function(_0x37f415){logger[_0x9222('0x6')](_0x9222('0x16'),_0x276233,_0x37f415?_0x9222('0x17'):_0x9222('0x18'));return _0xb2c0e4(_0x37f415);})[_0x9222('0x19')](function(_0xf87147){logger[_0x9222('0x9')](_0x9222('0x1a'),_0xf87147?util[_0x9222('0x7')](_0xf87147,{'showHidden':![],'depth':null}):'');return _0xb2c0e4(null);});}return _0xb2c0e4(null);});};exports[_0x9222('0x1b')]=function(_0x176274){return new BPromise(function(_0x3c293d,_0x5d0726){if(_0x176274){return getUser({'interface':_0x176274})['then'](function(_0x2b894d){logger[_0x9222('0x6')](_0x9222('0x1c'),_0x176274,_0x2b894d?'found':_0x9222('0x18'));return _0x3c293d(_0x2b894d);})['catch'](function(_0x5c7495){logger[_0x9222('0x9')](_0x9222('0x1d'),_0x5c7495?util[_0x9222('0x7')](_0x5c7495,{'showHidden':![],'depth':null}):'');return _0x3c293d(null);});}return _0x3c293d(null);});};exports[_0x9222('0x1e')]=function(_0x5186d4){return new BPromise(function(_0x7d9aaf,_0x31c2f7){if(_0x5186d4){return getUser({'name':_0x5186d4})[_0x9222('0x10')](function(_0x2f27e1){logger[_0x9222('0x6')](_0x9222('0x1f'),_0x5186d4,_0x2f27e1?_0x9222('0x17'):_0x9222('0x18'));return _0x7d9aaf(_0x2f27e1);})[_0x9222('0x19')](function(_0x4491b4){logger['error']('[utils][getUserByName]',_0x4491b4?util[_0x9222('0x7')](_0x4491b4,{'showHidden':![],'depth':null}):'');return _0x7d9aaf(null);});}return _0x7d9aaf(null);});};exports[_0x9222('0x20')]=function(_0x19216d){return new BPromise(function(_0x3452f1,_0x13746f){if(_0x19216d){return client[_0x9222('0xa')](_0x9222('0x21'),{'options':{'raw':!![],'attributes':['id','name',_0x9222('0x22'),_0x9222('0x23'),_0x9222('0x24')],'where':{'name':_0x19216d},'limit':0x1}})[_0x9222('0x10')](function(_0x48b169){logger['debug'](_0x9222('0x25'),_0x19216d,_0x48b169?util['inspect'](_0x48b169,{'showHidden':![],'depth':null}):'');logger['info'](_0x9222('0x26'),_0x19216d,_0x48b169?_0x9222('0x17'):_0x9222('0x18'));return _0x3452f1(_0x48b169[_0x9222('0x13')]['length']?_0x48b169[_0x9222('0x13')][0x0]:null);})[_0x9222('0x19')](function(_0x23cac9){logger[_0x9222('0x9')]('[utils][getVoiceQueueByName]',_0x23cac9?util[_0x9222('0x7')](_0x23cac9,{'showHidden':![],'depth':null}):'');return _0x3452f1(null);});}return _0x3452f1(null);});};exports['addTime']=function(_0x40562e,_0x19a3b9){return moment(_0x40562e)['add'](_0x19a3b9,'seconds')[_0x9222('0x27')](_0x9222('0x28'));};exports[_0x9222('0x29')]=function(_0x2af492,_0x54ee0f){return moment(_0x2af492)['subtract'](_0x54ee0f,'seconds')[_0x9222('0x27')](_0x9222('0x28'));};exports[_0x9222('0x2a')]=function(_0x464627,_0x3fc9ae){return moment(_0x464627)[_0x9222('0x2b')](moment(_0x3fc9ae),_0x9222('0x2c'));};exports[_0x9222('0x2d')]=function(_0x46cbd5,_0x4a5c51){return parseInt(_0x46cbd5,0xa)+parseInt(_0x4a5c51,0xa);};exports[_0x9222('0x2e')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9222('0x2f')]=function(_0x167239,_0x55b334){if(_0x55b334){return moment(_0x167239)[_0x9222('0x2f')](_0x55b334);}return!![];};exports['isBefore']=function(_0x1b91c4,_0x40fe8c){if(_0x40fe8c){return moment(_0x1b91c4)[_0x9222('0x30')](_0x40fe8c);}else if(_0x1b91c4){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index fb4f665..6c49d52 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad01=['catch','error','api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','maskSensitiveData','/var','log','join','client','role','name','ensureDir','user','then','no-user','data','timestamp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad01,0xac));var _0x1ad0=function(_0x157527,_0x41f908){_0x157527=_0x157527-0x0;var _0x2d56a1=_0xad01[_0x157527];return _0x2d56a1;};var fs=require(_0x1ad0('0x0'));var _=require(_0x1ad0('0x1'));var ewinston=require(_0x1ad0('0x2'));var path=require(_0x1ad0('0x3'));var util=require(_0x1ad0('0x4'));var fileLogger=require('./loggers')[_0x1ad0('0x5')];var safeTemplate=require('./safe-template')[_0x1ad0('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x1ad0('0x7')];function ClientSideLogger(){function _0x34196a(_0x5211f2){var _0x2e12cd=path['join'](_0x1ad0('0x8'),_0x1ad0('0x9'),'xcally');var _0xdf2222=path[_0x1ad0('0xa')](_0x1ad0('0xb'),_0x5211f2[_0x1ad0('0xc')]+'-'+_0x5211f2[_0x1ad0('0xd')]);return fs[_0x1ad0('0xe')](path['join'](_0x2e12cd,_0xdf2222))['then'](function(){var _0x112aac=fileLogger(_0x1ad0('0xb'),path[_0x1ad0('0xa')](_0x2e12cd,_0xdf2222));return _0x112aac;})['catch'](function(_0x31b7f9){throw _0x31b7f9;});}this['log']=function(_0xd2f87e,_0x4b4029,_0x244d51,_0x1c96c4){return _0x34196a(_0xd2f87e[_0x1ad0('0xf')])['then'](function(_0x626332){var _0x3e41cd=_0x626332[_0x4b4029];return _0x3e41cd;})[_0x1ad0('0x10')](function(_0x2b3af6){var _0x48424d=_0xd2f87e['user']?_0xd2f87e[_0x1ad0('0xf')]['id']:_0x1ad0('0x11');var _0x3675ab=_0x1c96c4[_0x1ad0('0x12')];var _0x140176=_0x1c96c4[_0x1ad0('0x13')];var _0x2c13fa=new Date(Number(_0x140176));return _0x2b3af6(_0x48424d,_0x2c13fa,_0x244d51,_0x3675ab);})[_0x1ad0('0x14')](function(_0x306971){fileLogger(_0x1ad0('0xb'))[_0x1ad0('0x15')](_0x306971);});};}function setupLoggers(_0x53ecf7){return new Promise(function(_0x51bb54){var _0x164fd2=new ClientSideLogger();var _0x113f8c=fileLogger(_0x1ad0('0x16'));var _0x1eb6e1=fileLogger('auth');_0x53ecf7[_0x1ad0('0x17')](_0x1ad0('0x18'),_0x164fd2);_0x53ecf7['use'](ewinston[_0x1ad0('0x19')]({'winstonInstance':_0x113f8c,'meta':![],'statusLevels':!![],'msg':function(_0x48bb41,_0x34c02e){var _0x235c5a=_0x1ad0('0x1a');if(!_[_0x1ad0('0x1b')](_0x48bb41['body'])){_0x235c5a+='\x20body=%s';var _0x47abc3=_0x48bb41['body'];maskSensitiveData(_0x47abc3);}return safeTemplate(util['format'](_0x235c5a,_0x48bb41[_0x1ad0('0x1c')],_0x48bb41[_0x1ad0('0x1d')][_0x1ad0('0x1e')]?_0x48bb41[_0x1ad0('0x1d')]['x-forwarded-for']:_0x48bb41[_0x1ad0('0x1f')][_0x1ad0('0x20')]||_0x48bb41['ip'],_0x48bb41[_0x1ad0('0x21')],_0x34c02e[_0x1ad0('0x22')],_0x34c02e[_0x1ad0('0x23')],_0x48bb41[_0x1ad0('0xf')]?_0x48bb41['user']['id']:null,_0x48bb41[_0x1ad0('0xf')]?_0x48bb41[_0x1ad0('0xf')][_0x1ad0('0xd')]:null,_0x48bb41[_0x1ad0('0xf')]?_0x48bb41[_0x1ad0('0xf')][_0x1ad0('0xc')]:null,_0x47abc3?util[_0x1ad0('0x24')](_0x47abc3,![],null):''));}}));_0x53ecf7[_0x1ad0('0x25')](ewinston[_0x1ad0('0x19')]({'winstonInstance':_0x1eb6e1,'meta':![],'statusLevels':!![],'msg':function(_0x129a64,_0x2a8209){var _0xd7c928=_0x1ad0('0x26');if(_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x28')]&&_0x129a64[_0x1ad0('0x27')]['agent_id']){_0xd7c928=_0x1ad0('0x29');}return util[_0x1ad0('0x2a')](_0xd7c928,_0x129a64[_0x1ad0('0x1c')],_0x129a64[_0x1ad0('0x1d')]['x-forwarded-for']?_0x129a64[_0x1ad0('0x1d')]['x-forwarded-for']:_0x129a64[_0x1ad0('0x1f')][_0x1ad0('0x20')]||_0x129a64['ip'],_0x129a64[_0x1ad0('0x21')],_0x2a8209[_0x1ad0('0x22')],_0x2a8209[_0x1ad0('0x23')],_0x129a64['user']?_0x129a64['user']['id']:null,_0x129a64[_0x1ad0('0xf')]?_0x129a64[_0x1ad0('0xf')][_0x1ad0('0xd')]:null,_0x129a64[_0x1ad0('0xf')]?_0x129a64[_0x1ad0('0xf')]['role']:null,_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')]['device']?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x28')]:_0x1ad0('0x2b'),_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2c')]?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2c')]:'',_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2d')]?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2d')]:'');},'ignoreRoute':function(_0x471edb){var _0x5e306b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e306b[_0x1ad0('0x2e')](_0x471edb[_0x1ad0('0x21')]);}}));return _0x51bb54();});}exports[_0x1ad0('0x2f')]=setupLoggers; \ No newline at end of file +var _0xe762=['no-user','data','timestamp','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','join','/var','log','client','role','name','then','catch','user'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xe762,0x156));var _0x2e76=function(_0x5948f7,_0x3ebd21){_0x5948f7=_0x5948f7-0x0;var _0x85f8db=_0xe762[_0x5948f7];return _0x85f8db;};var fs=require(_0x2e76('0x0'));var _=require(_0x2e76('0x1'));var ewinston=require(_0x2e76('0x2'));var path=require(_0x2e76('0x3'));var util=require(_0x2e76('0x4'));var fileLogger=require(_0x2e76('0x5'))[_0x2e76('0x6')];var safeTemplate=require(_0x2e76('0x7'))[_0x2e76('0x8')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x391c05(_0x15260c){var _0x535e57=path[_0x2e76('0x9')](_0x2e76('0xa'),_0x2e76('0xb'),'xcally');var _0x4b0ba8=path['join'](_0x2e76('0xc'),_0x15260c[_0x2e76('0xd')]+'-'+_0x15260c[_0x2e76('0xe')]);return fs['ensureDir'](path['join'](_0x535e57,_0x4b0ba8))[_0x2e76('0xf')](function(){var _0x4485b4=fileLogger(_0x2e76('0xc'),path[_0x2e76('0x9')](_0x535e57,_0x4b0ba8));return _0x4485b4;})[_0x2e76('0x10')](function(_0x548cdf){throw _0x548cdf;});}this[_0x2e76('0xb')]=function(_0x47b815,_0x453a44,_0x385482,_0x102dfc){return _0x391c05(_0x47b815[_0x2e76('0x11')])['then'](function(_0x50c545){var _0x58bd4e=_0x50c545[_0x453a44];return _0x58bd4e;})['then'](function(_0x599d42){var _0x547777=_0x47b815[_0x2e76('0x11')]?_0x47b815[_0x2e76('0x11')]['id']:_0x2e76('0x12');var _0x368d7a=_0x102dfc[_0x2e76('0x13')];var _0x1dfc8b=_0x102dfc[_0x2e76('0x14')];var _0xa3096e=new Date(Number(_0x1dfc8b));return _0x599d42(_0x547777,_0xa3096e,_0x385482,_0x368d7a);})[_0x2e76('0x10')](function(_0x4023be){fileLogger(_0x2e76('0xc'))[_0x2e76('0x15')](_0x4023be);});};}function setupLoggers(_0x550040){return new Promise(function(_0x4a5840){var _0x50a718=new ClientSideLogger();var _0x3b89e3=fileLogger(_0x2e76('0x16'));var _0x41e09b=fileLogger(_0x2e76('0x17'));_0x550040[_0x2e76('0x18')]('client-side-logger',_0x50a718);_0x550040[_0x2e76('0x19')](ewinston[_0x2e76('0x1a')]({'winstonInstance':_0x3b89e3,'meta':![],'statusLevels':!![],'msg':function(_0x59978e,_0x5814e9){var _0x514cee=_0x2e76('0x1b');if(!_['isEmpty'](_0x59978e[_0x2e76('0x1c')])){_0x514cee+='\x20body=%s';var _0x3599de=_0x59978e[_0x2e76('0x1c')];maskSensitiveData(_0x3599de);}return safeTemplate(util[_0x2e76('0x1d')](_0x514cee,_0x59978e[_0x2e76('0x1e')],_0x59978e[_0x2e76('0x1f')][_0x2e76('0x20')]?_0x59978e['headers'][_0x2e76('0x20')]:_0x59978e[_0x2e76('0x21')][_0x2e76('0x22')]||_0x59978e['ip'],_0x59978e[_0x2e76('0x23')],_0x5814e9['statusCode'],_0x5814e9[_0x2e76('0x24')],_0x59978e[_0x2e76('0x11')]?_0x59978e[_0x2e76('0x11')]['id']:null,_0x59978e[_0x2e76('0x11')]?_0x59978e[_0x2e76('0x11')]['name']:null,_0x59978e['user']?_0x59978e[_0x2e76('0x11')][_0x2e76('0xd')]:null,_0x3599de?util[_0x2e76('0x25')](_0x3599de,![],null):''));}}));_0x550040[_0x2e76('0x19')](ewinston[_0x2e76('0x1a')]({'winstonInstance':_0x41e09b,'meta':![],'statusLevels':!![],'msg':function(_0x5b6114,_0xcb0b3f){var _0x109a8c=_0x2e76('0x26');if(_0x5b6114[_0x2e76('0x1c')]&&_0x5b6114[_0x2e76('0x1c')][_0x2e76('0x27')]&&_0x5b6114[_0x2e76('0x1c')][_0x2e76('0x28')]){_0x109a8c=_0x2e76('0x29');}return util[_0x2e76('0x1d')](_0x109a8c,_0x5b6114[_0x2e76('0x1e')],_0x5b6114['headers'][_0x2e76('0x20')]?_0x5b6114[_0x2e76('0x1f')]['x-forwarded-for']:_0x5b6114[_0x2e76('0x21')][_0x2e76('0x22')]||_0x5b6114['ip'],_0x5b6114[_0x2e76('0x23')],_0xcb0b3f[_0x2e76('0x2a')],_0xcb0b3f[_0x2e76('0x24')],_0x5b6114[_0x2e76('0x11')]?_0x5b6114[_0x2e76('0x11')]['id']:null,_0x5b6114[_0x2e76('0x11')]?_0x5b6114[_0x2e76('0x11')]['name']:null,_0x5b6114[_0x2e76('0x11')]?_0x5b6114['user'][_0x2e76('0xd')]:null,_0x5b6114[_0x2e76('0x1c')]&&_0x5b6114[_0x2e76('0x1c')][_0x2e76('0x27')]?_0x5b6114[_0x2e76('0x1c')][_0x2e76('0x27')]:_0x2e76('0x2b'),_0x5b6114[_0x2e76('0x1c')]&&_0x5b6114['body']['agent_id']?_0x5b6114[_0x2e76('0x1c')][_0x2e76('0x28')]:'',_0x5b6114[_0x2e76('0x1c')]&&_0x5b6114[_0x2e76('0x1c')]['agent_name']?_0x5b6114[_0x2e76('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x4a0226){var _0xf9e687=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf9e687['test'](_0x4a0226['url']);}}));return _0x4a5840();});}exports[_0x2e76('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e5db77e..4c8f601 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf88e=['max','min','domCompare','monthCompare','test','length','padStart','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare'];(function(_0x1d48d1,_0x1ef482){var _0xb793b9=function(_0x38fe16){while(--_0x38fe16){_0x1d48d1['push'](_0x1d48d1['shift']());}};_0xb793b9(++_0x1ef482);}(_0xf88e,0x7d));var _0xef88=function(_0x3e7818,_0xa326f8){_0x3e7818=_0x3e7818-0x0;var _0x216f7e=_0xf88e[_0x3e7818];return _0x216f7e;};var _=require(_0xef88('0x0'));var moment=require(_0xef88('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x50ab7d){return _0x50ab7d[_0xef88('0x2')];})[_0xef88('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xef88('0x4');var EINVALID_DATE=_0xef88('0x5');function throwIfDateNotValid(_0x246096){if(!_0x246096['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xc3b597){var _0x4b175c=_0xc3b597[_0xef88('0x6')](':')[_0xef88('0x7')](function(_0x132cc8){return parseInt(_0x132cc8,0xa);});var _0x33f041=_0x4b175c[0x0];var _0x40da1e=_0x4b175c[0x1];if(_0x33f041<0x0||_0x33f041>0x17||_0x40da1e<0x0||_0x40da1e>0x3b){throw new Error(EINVALID_DATE);}return[_0x33f041,_0x40da1e];}function circularDoWInterval(_0x4dacfe,_0x34c983){if(_0x4dacfe===_0x34c983){return[_0x4dacfe];}else{var _0x2ab8ea=moment['locale']();moment[_0xef88('0x8')]('en');var _0x4813ce=moment[_0xef88('0x9')]()['map'](function(_0x53edd4){return _0x53edd4['toLowerCase']();});moment[_0xef88('0x8')](_0x2ab8ea);var _0x5a0852=_0x4813ce['indexOf'](_0x4dacfe);var _0x551233=_0x4813ce[_0xef88('0xa')](_0x34c983);if(_0x551233>_0x5a0852){return _0x4813ce[_0xef88('0xb')](_0x5a0852,_0x551233+0x1);}else{var _0x314699=_0x4813ce['slice'](0x0,_0x551233+0x1);var _0x458670=_0x4813ce['slice'](_0x5a0852);return _0x458670[_0xef88('0xc')](_0x314699);}}}module[_0xef88('0xd')][_0xef88('0xe')]=circularDoWInterval;function circularMonthInterval(_0x14fac8,_0x160cbe){if(_0x14fac8===_0x160cbe){return[_0x14fac8];}else{var _0xa2f321=moment[_0xef88('0x8')]();moment[_0xef88('0x8')]('en');var _0xe52ba0=moment[_0xef88('0xf')]()[_0xef88('0x7')](function(_0x1fa383){return _0x1fa383[_0xef88('0x10')]();});moment[_0xef88('0x8')](_0xa2f321);var _0x18a7f0=_0xe52ba0[_0xef88('0xa')](_0x14fac8);var _0x552fbf=_0xe52ba0[_0xef88('0xa')](_0x160cbe);if(_0x552fbf>_0x18a7f0){return _0xe52ba0['slice'](_0x18a7f0,_0x552fbf+0x1);}else{var _0x39dbd7=_0xe52ba0['slice'](0x0,_0x552fbf+0x1);var _0x1d6149=_0xe52ba0[_0xef88('0xb')](_0x18a7f0);return _0x1d6149[_0xef88('0xc')](_0x39dbd7);}}}module['exports'][_0xef88('0x11')]=circularMonthInterval;function parseDom(_0x2c044d){var _0x59aaef=parseInt(_0x2c044d,0xa);if(_0x59aaef<0x1||_0x59aaef>0x1f){throw new Error(EINVALID_DATE);}return _0x59aaef;}function timeCompare(_0x3f5056,_0x19eed4,_0x5a6d77){var _0x1a1a06=_0x3f5056[_0xef88('0x12')]();var _0x168dec=extractTime(_0x19eed4);var _0x123611=_0x168dec[0x0];var _0x45f64e=_0x168dec[0x1];var _0x485122=_0x3f5056[_0xef88('0x12')]()[_0xef88('0x13')](_0x123611)[_0xef88('0x14')](_0x45f64e);throwIfDateNotValid(_0x485122);var _0x6cc87=extractTime(_0x5a6d77);var _0x4fbbc3=_0x6cc87[0x0];var _0x2f2f71=_0x6cc87[0x1];var _0x539b5e=_0x3f5056['clone']()[_0xef88('0x13')](_0x4fbbc3)[_0xef88('0x14')](_0x2f2f71);throwIfDateNotValid(_0x539b5e);if(_0x539b5e[_0xef88('0x15')](_0x485122)){var _0x117543=_0x1a1a06[_0xef88('0x12')]()[_0xef88('0x16')](_0xef88('0x17'));var _0x675359=_0x1a1a06[_0xef88('0x12')]()[_0xef88('0x18')]('day');return _0x1a1a06[_0xef88('0x19')](_0x485122,_0x675359,undefined,'[]')||_0x1a1a06[_0xef88('0x19')](_0x117543,_0x539b5e,undefined,'[]');}else{return _0x1a1a06['isBetween'](_0x485122,_0x539b5e,undefined,'[]');}}module[_0xef88('0xd')][_0xef88('0x1a')]=timeCompare;function dowCompare(_0x2fd3ff,_0x33494e,_0xd7c890){var _0x557197=_0x2fd3ff[_0xef88('0x8')]('en')[_0xef88('0x1b')](_0xef88('0x1c'))[_0xef88('0x10')]();return circularDoWInterval(_0x33494e,_0xd7c890)[_0xef88('0x1d')](_0x557197);}module[_0xef88('0xd')][_0xef88('0x1e')]=dowCompare;function domCompare(_0x83fec9,_0x5ddb33,_0x52a48e){var _0x44787e=_0x83fec9['date']();if(_0x5ddb33===_0x52a48e){return _0x44787e===_0x5ddb33;}else{var _0x52dd0b=_0x83fec9['daysInMonth']();var _0x357246=_0x5ddb33<_0x52a48e;let _0x3acf9d=![];var _0x23835e=0x0;var _0x1543d0=0x0;if(_0x357246){_0x23835e=Math[_0xef88('0x1f')](0x1,_0x5ddb33);_0x1543d0=Math['min'](_0x52a48e,_0x52dd0b);_0x3acf9d=_0x44787e>=_0x23835e&&_0x44787e<=_0x1543d0;}else{_0x23835e=Math[_0xef88('0x20')](_0x5ddb33,_0x52dd0b);_0x1543d0=Math['max'](0x1,_0x52a48e);_0x3acf9d=_0x44787e>=_0x23835e||_0x44787e<=_0x1543d0;}return _0x3acf9d;}}module[_0xef88('0xd')][_0xef88('0x21')]=domCompare;function monthCompare(_0x4d793b,_0xa09ce6,_0x325c27){var _0x51b749=_0x4d793b[_0xef88('0x8')]('en')[_0xef88('0x1b')]('MMM')[_0xef88('0x10')]();return circularMonthInterval(_0xa09ce6,_0x325c27)[_0xef88('0x1d')](_0x51b749);}module[_0xef88('0xd')][_0xef88('0x22')]=monthCompare;function iftime(_0x4c4466,_0x26cbd2=moment['tz']['guess'](),_0x2320e8=moment()){if(!validateRx[_0xef88('0x23')](_0x4c4466)){throw new Error(EINVALID_STRING);}else{var _0xae73c3=(moment['isMoment'](_0x2320e8)?_0x2320e8[_0xef88('0x12')]():moment(_0x2320e8))['tz'](_0x26cbd2)[_0xef88('0x8')]('en');throwIfDateNotValid(_0xae73c3);var _0x34805c=_0x4c4466[_0xef88('0x6')](',');var _0x35d703=_0x34805c[0x0];var _0x3b6426=_0x34805c[0x1];var _0x2557fa=_0x34805c[0x2];var _0x2b8b06=_0x34805c[0x3];let _0x1a2857=!![];if(_0x35d703!=='*'){var _0x811300=_0x35d703['split']('-');var _0x18a381=_['padStart'](_0x811300[0x0],0x5,'0');var _0x55f712=_0x811300[_0xef88('0x24')]===0x2?_[_0xef88('0x25')](_0x811300[0x1],0x5,'0'):_0x18a381;_0x1a2857=timeCompare(_0xae73c3,_0x18a381,_0x55f712);}let _0x218e9f=!![];if(_0x3b6426!=='*'){var _0x8d6958=_0x3b6426[_0xef88('0x6')]('-');var _0x3de3bb=_0x8d6958[0x0];var _0x5171f=_0x8d6958['length']===0x2?_0x8d6958[0x1]:_0x3de3bb;_0x218e9f=dowCompare(_0xae73c3,_0x3de3bb,_0x5171f);}let _0x4ec62d=!![];if(_0x2557fa!=='*'){var _0x3e4893=_0x2557fa[_0xef88('0x6')]('-');var _0x217781=parseDom(_0x3e4893[0x0]);var _0x4d96cb=_0x3e4893[_0xef88('0x24')]===0x2?parseDom(_0x3e4893[0x1]):_0x217781;_0x4ec62d=domCompare(_0xae73c3,_0x217781,_0x4d96cb);}let _0x429cee=!![];if(_0x2b8b06!=='*'){var _0x41d15e=_0x2b8b06[_0xef88('0x6')]('-');var _0x8089a5=_0x41d15e[0x0];var _0x51ea4d=_0x41d15e[_0xef88('0x24')]===0x2?_0x41d15e[0x1]:_0x41d15e[0x0];_0x429cee=monthCompare(_0xae73c3,_0x8089a5,_0x51ea4d);}return _0x1a2857&&_0x218e9f&&_0x4ec62d&&_0x429cee;}}module[_0xef88('0xd')][_0xef88('0x26')]=iftime; \ No newline at end of file +var _0x331b=['map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','slice','monthsShort','indexOf','exports','circularMonthInterval','clone','minutes','hours','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','max','min','guess','test','isMoment','padStart','length','lodash','moment-timezone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x331b,0x170));var _0xb331=function(_0x238542,_0x49ec56){_0x238542=_0x238542-0x0;var _0x2cf608=_0x331b[_0x238542];return _0x2cf608;};var _=require(_0xb331('0x0'));var moment=require(_0xb331('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xb331('0x2')](function(_0x2e46d8){return _0x2e46d8[_0xb331('0x3')];})[_0xb331('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb331('0x5');var EINVALID_DATE=_0xb331('0x6');function throwIfDateNotValid(_0x499816){if(!_0x499816[_0xb331('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x329110){var _0x3adbd8=_0x329110[_0xb331('0x8')](':')[_0xb331('0x2')](function(_0x11ad3a){return parseInt(_0x11ad3a,0xa);});var _0x45f153=_0x3adbd8[0x0];var _0x36eedd=_0x3adbd8[0x1];if(_0x45f153<0x0||_0x45f153>0x17||_0x36eedd<0x0||_0x36eedd>0x3b){throw new Error(EINVALID_DATE);}return[_0x45f153,_0x36eedd];}function circularDoWInterval(_0x1c7b35,_0x53aa48){if(_0x1c7b35===_0x53aa48){return[_0x1c7b35];}else{var _0x330e98=moment['locale']();moment[_0xb331('0x9')]('en');var _0x27a9a2=moment[_0xb331('0xa')]()['map'](function(_0x3cb6f2){return _0x3cb6f2[_0xb331('0xb')]();});moment[_0xb331('0x9')](_0x330e98);var _0x56e3a3=_0x27a9a2['indexOf'](_0x1c7b35);var _0x3211b0=_0x27a9a2['indexOf'](_0x53aa48);if(_0x3211b0>_0x56e3a3){return _0x27a9a2[_0xb331('0xc')](_0x56e3a3,_0x3211b0+0x1);}else{var _0x4ed74a=_0x27a9a2['slice'](0x0,_0x3211b0+0x1);var _0x230293=_0x27a9a2[_0xb331('0xc')](_0x56e3a3);return _0x230293['concat'](_0x4ed74a);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x37619e,_0x44fd1a){if(_0x37619e===_0x44fd1a){return[_0x37619e];}else{var _0x49f894=moment['locale']();moment[_0xb331('0x9')]('en');var _0x225dd3=moment[_0xb331('0xd')]()[_0xb331('0x2')](function(_0x2ef841){return _0x2ef841['toLowerCase']();});moment[_0xb331('0x9')](_0x49f894);var _0x4634f0=_0x225dd3[_0xb331('0xe')](_0x37619e);var _0x36dfc1=_0x225dd3[_0xb331('0xe')](_0x44fd1a);if(_0x36dfc1>_0x4634f0){return _0x225dd3[_0xb331('0xc')](_0x4634f0,_0x36dfc1+0x1);}else{var _0x155bc4=_0x225dd3['slice'](0x0,_0x36dfc1+0x1);var _0x4ff74c=_0x225dd3[_0xb331('0xc')](_0x4634f0);return _0x4ff74c['concat'](_0x155bc4);}}}module[_0xb331('0xf')][_0xb331('0x10')]=circularMonthInterval;function parseDom(_0x12ce94){var _0x2fb005=parseInt(_0x12ce94,0xa);if(_0x2fb005<0x1||_0x2fb005>0x1f){throw new Error(EINVALID_DATE);}return _0x2fb005;}function timeCompare(_0x1f4ec0,_0x18a244,_0x55d621){var _0x1225b3=_0x1f4ec0[_0xb331('0x11')]();var _0x4cb631=extractTime(_0x18a244);var _0x1e0f59=_0x4cb631[0x0];var _0x39ef70=_0x4cb631[0x1];var _0x2410a6=_0x1f4ec0[_0xb331('0x11')]()['hours'](_0x1e0f59)[_0xb331('0x12')](_0x39ef70);throwIfDateNotValid(_0x2410a6);var _0x4a7369=extractTime(_0x55d621);var _0x5a42ed=_0x4a7369[0x0];var _0x5d91bc=_0x4a7369[0x1];var _0x25627e=_0x1f4ec0[_0xb331('0x11')]()[_0xb331('0x13')](_0x5a42ed)[_0xb331('0x12')](_0x5d91bc);throwIfDateNotValid(_0x25627e);if(_0x25627e[_0xb331('0x14')](_0x2410a6)){var _0x5a7f22=_0x1225b3['clone']()['startOf'](_0xb331('0x15'));var _0xa62a4f=_0x1225b3[_0xb331('0x11')]()[_0xb331('0x16')](_0xb331('0x15'));return _0x1225b3['isBetween'](_0x2410a6,_0xa62a4f,undefined,'[]')||_0x1225b3[_0xb331('0x17')](_0x5a7f22,_0x25627e,undefined,'[]');}else{return _0x1225b3[_0xb331('0x17')](_0x2410a6,_0x25627e,undefined,'[]');}}module['exports'][_0xb331('0x18')]=timeCompare;function dowCompare(_0x15b84a,_0x28c074,_0x596471){var _0x5f39a7=_0x15b84a[_0xb331('0x9')]('en')[_0xb331('0x19')](_0xb331('0x1a'))['toLowerCase']();return circularDoWInterval(_0x28c074,_0x596471)[_0xb331('0x1b')](_0x5f39a7);}module[_0xb331('0xf')]['dowCompare']=dowCompare;function domCompare(_0x4742ec,_0x24bd64,_0xbe0c97){var _0x8aba90=_0x4742ec[_0xb331('0x1c')]();if(_0x24bd64===_0xbe0c97){return _0x8aba90===_0x24bd64;}else{var _0x9e0195=_0x4742ec[_0xb331('0x1d')]();var _0x25991a=_0x24bd64<_0xbe0c97;let _0x91e45d=![];var _0x554bf5=0x0;var _0x54f414=0x0;if(_0x25991a){_0x554bf5=Math[_0xb331('0x1e')](0x1,_0x24bd64);_0x54f414=Math[_0xb331('0x1f')](_0xbe0c97,_0x9e0195);_0x91e45d=_0x8aba90>=_0x554bf5&&_0x8aba90<=_0x54f414;}else{_0x554bf5=Math[_0xb331('0x1f')](_0x24bd64,_0x9e0195);_0x54f414=Math[_0xb331('0x1e')](0x1,_0xbe0c97);_0x91e45d=_0x8aba90>=_0x554bf5||_0x8aba90<=_0x54f414;}return _0x91e45d;}}module[_0xb331('0xf')]['domCompare']=domCompare;function monthCompare(_0x2784ca,_0x380ed3,_0x193e9e){var _0x3ea40a=_0x2784ca[_0xb331('0x9')]('en')['format']('MMM')[_0xb331('0xb')]();return circularMonthInterval(_0x380ed3,_0x193e9e)[_0xb331('0x1b')](_0x3ea40a);}module[_0xb331('0xf')]['monthCompare']=monthCompare;function iftime(_0x2f4f53,_0x1474b2=moment['tz'][_0xb331('0x20')](),_0x19f257=moment()){if(!validateRx[_0xb331('0x21')](_0x2f4f53)){throw new Error(EINVALID_STRING);}else{var _0xcd6976=(moment[_0xb331('0x22')](_0x19f257)?_0x19f257[_0xb331('0x11')]():moment(_0x19f257))['tz'](_0x1474b2)[_0xb331('0x9')]('en');throwIfDateNotValid(_0xcd6976);var _0x1ecc52=_0x2f4f53[_0xb331('0x8')](',');var _0x1afcb9=_0x1ecc52[0x0];var _0x244e56=_0x1ecc52[0x1];var _0x3b1b75=_0x1ecc52[0x2];var _0x331274=_0x1ecc52[0x3];let _0x133c9d=!![];if(_0x1afcb9!=='*'){var _0x2e59e7=_0x1afcb9[_0xb331('0x8')]('-');var _0x1f21d2=_[_0xb331('0x23')](_0x2e59e7[0x0],0x5,'0');var _0x356826=_0x2e59e7[_0xb331('0x24')]===0x2?_[_0xb331('0x23')](_0x2e59e7[0x1],0x5,'0'):_0x1f21d2;_0x133c9d=timeCompare(_0xcd6976,_0x1f21d2,_0x356826);}let _0x101c19=!![];if(_0x244e56!=='*'){var _0x46b927=_0x244e56['split']('-');var _0x5a2b36=_0x46b927[0x0];var _0x48a7b4=_0x46b927[_0xb331('0x24')]===0x2?_0x46b927[0x1]:_0x5a2b36;_0x101c19=dowCompare(_0xcd6976,_0x5a2b36,_0x48a7b4);}let _0xef5165=!![];if(_0x3b1b75!=='*'){var _0x501150=_0x3b1b75[_0xb331('0x8')]('-');var _0x1be478=parseDom(_0x501150[0x0]);var _0x1a66ef=_0x501150['length']===0x2?parseDom(_0x501150[0x1]):_0x1be478;_0xef5165=domCompare(_0xcd6976,_0x1be478,_0x1a66ef);}let _0x7b81da=!![];if(_0x331274!=='*'){var _0x2bd56e=_0x331274[_0xb331('0x8')]('-');var _0x3f52a3=_0x2bd56e[0x0];var _0x332d66=_0x2bd56e[_0xb331('0x24')]===0x2?_0x2bd56e[0x1]:_0x2bd56e[0x0];_0x7b81da=monthCompare(_0xcd6976,_0x3f52a3,_0x332d66);}return _0x133c9d&&_0x101c19&&_0xef5165&&_0x7b81da;}}module[_0xb331('0xf')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index a79f137..c384561 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a2b=['level','toUpperCase','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','transports','%s-%s','File','warn','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','redBG\x20white','red','bold\x20yellow','white','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}'];(function(_0x2007a5,_0x3cb095){var _0x1d1261=function(_0x5b8c9d){while(--_0x5b8c9d){_0x2007a5['push'](_0x2007a5['shift']());}};_0x1d1261(++_0x3cb095);}(_0x3a2b,0xfc));var _0xb3a2=function(_0x207cb7,_0x1df34a){_0x207cb7=_0x207cb7-0x0;var _0x11581b=_0x3a2b[_0x207cb7];return _0x11581b;};'use strict';var path=require(_0xb3a2('0x0'));var util=require(_0xb3a2('0x1'));var moment=require('moment');var winston=require(_0xb3a2('0x2'));var config=require(_0xb3a2('0x3'));var debugLevel=config[_0xb3a2('0x4')]?config[_0xb3a2('0x4')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xb3a2('0x5'),'error':_0xb3a2('0x6'),'warn':_0xb3a2('0x7'),'info':_0xb3a2('0x8'),'print':'bold\x20white','success':'bold\x20green','http':_0xb3a2('0x9'),'verbose':_0xb3a2('0xa'),'debug':_0xb3a2('0xb'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4a8bf3,_0x4441da,_0x4e2d0a){var _0x71d918=_0x4a8bf3||_0xb3a2('0xc');return path[_0xb3a2('0xd')](_0x71d918,util[_0xb3a2('0xe')](_0xb3a2('0xf'),_0x4441da,_0x4e2d0a));}function formatter(_0x1b5ee5,_0x27e98b){_0x27e98b[_0xb3a2('0x10')]=_0x27e98b[_0xb3a2('0x10')][_0xb3a2('0x11')](/@@{/g,_0xb3a2('0x12'))['replace'](/}@@/g,_0xb3a2('0x13'))[_0xb3a2('0x11')](/@{/g,'{{')[_0xb3a2('0x11')](/}@/g,'}}');return util[_0xb3a2('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb3a2('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x27e98b[_0xb3a2('0x14')][_0xb3a2('0x15')](),_0x1b5ee5,_0x27e98b[_0xb3a2('0x10')]);}function fileFormat(_0x4c91de,_0x4e0664){_0x4e0664['message']=_0x4e0664['message'][_0xb3a2('0x11')](/@@{/g,_0xb3a2('0x12'))['replace'](/}@@/g,_0xb3a2('0x13'))[_0xb3a2('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x267d59=_0x4e0664[_0xb3a2('0x16')]&&Object['keys'](_0x4e0664['meta'])[_0xb3a2('0x17')]?'\x0a\x09'+JSON['stringify'](_0x4e0664[_0xb3a2('0x16')]):'';return util['format'](_0xb3a2('0x18'),moment()[_0xb3a2('0xe')](_0xb3a2('0x19')),_0x4e0664[_0xb3a2('0x14')]['toUpperCase'](),_0x4c91de,_0x4e0664[_0xb3a2('0x10')],_0x267d59);}function consoleLogger(){var _0x51f844=new winston[(_0xb3a2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb3a2('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x16000e){return formatter('',_0x16000e);}})]});return _0x51f844;}function fileLogger(_0x1d46c9,_0x53c785){var _0x502e45=new winston[(_0xb3a2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb3a2('0x1c'))]['File']({'name':util[_0xb3a2('0xe')](_0xb3a2('0x1d'),_0x1d46c9,'error'),'filename':getLogFileName(_0x53c785,_0x1d46c9,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4411ac){return fileFormat(_0x1d46c9,_0x4411ac);}}),new winston[(_0xb3a2('0x1c'))][(_0xb3a2('0x1e'))]({'name':util['format'](_0xb3a2('0x1d'),_0x1d46c9,debugLevel),'filename':getLogFileName(_0x53c785,_0x1d46c9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50aba9){return fileFormat(_0x1d46c9,_0x50aba9);}}),new winston[(_0xb3a2('0x1c'))][(_0xb3a2('0x1b'))]({'level':_0xb3a2('0x1f'),'json':![],'formatter':function(_0x49d537){return fileFormat(_0x1d46c9,_0x49d537);}})]});return _0x502e45;}exports[_0xb3a2('0x20')]=consoleLogger;exports[_0xb3a2('0x21')]=fileLogger; \ No newline at end of file +var _0xb424=['warn','File','%s-%s','error','fileLogger','path','util','moment','debugLevel','toLowerCase','info','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console'];(function(_0x172153,_0x39a461){var _0x2de58a=function(_0x3e551c){while(--_0x3e551c){_0x172153['push'](_0x172153['shift']());}};_0x2de58a(++_0x39a461);}(_0xb424,0x1c1));var _0x4b42=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xb424[_0x1ff575];return _0x48fc9e;};'use strict';var path=require(_0x4b42('0x0'));var util=require(_0x4b42('0x1'));var moment=require(_0x4b42('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x4b42('0x3')]?config[_0x4b42('0x3')][_0x4b42('0x4')]():_0x4b42('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x4b42('0x6'),'warn':'bold\x20yellow','info':'white','print':_0x4b42('0x7'),'success':_0x4b42('0x8'),'http':_0x4b42('0x9'),'verbose':_0x4b42('0xa'),'debug':_0x4b42('0xb'),'silly':_0x4b42('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4b75f3,_0x27b801,_0x26034f){var _0x1ca902=_0x4b75f3||_0x4b42('0xd');return path[_0x4b42('0xe')](_0x1ca902,util[_0x4b42('0xf')](_0x4b42('0x10'),_0x27b801,_0x26034f));}function formatter(_0x5a36e9,_0x5e13a1){_0x5e13a1[_0x4b42('0x11')]=_0x5e13a1[_0x4b42('0x11')][_0x4b42('0x12')](/@@{/g,_0x4b42('0x13'))['replace'](/}@@/g,_0x4b42('0x14'))[_0x4b42('0x12')](/@{/g,'{{')[_0x4b42('0x12')](/}@/g,'}}');return util[_0x4b42('0xf')](_0x4b42('0x15'),moment()['format'](_0x4b42('0x16')),_0x5e13a1['level'][_0x4b42('0x17')](),_0x5a36e9,_0x5e13a1[_0x4b42('0x11')]);}function fileFormat(_0x2e472e,_0x3b7e17){_0x3b7e17[_0x4b42('0x11')]=_0x3b7e17['message'][_0x4b42('0x12')](/@@{/g,'{{{')[_0x4b42('0x12')](/}@@/g,_0x4b42('0x14'))['replace'](/@{/g,'{{')[_0x4b42('0x12')](/}@/g,'}}');var _0x581d02=_0x3b7e17[_0x4b42('0x18')]&&Object[_0x4b42('0x19')](_0x3b7e17[_0x4b42('0x18')])[_0x4b42('0x1a')]?'\x0a\x09'+JSON[_0x4b42('0x1b')](_0x3b7e17['meta']):'';return util['format'](_0x4b42('0x1c'),moment()[_0x4b42('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3b7e17['level'][_0x4b42('0x17')](),_0x2e472e,_0x3b7e17[_0x4b42('0x11')],_0x581d02);}function consoleLogger(){var _0x4c692f=new winston[(_0x4b42('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4b42('0x1e'))][(_0x4b42('0x1f'))]({'level':_0x4b42('0x20'),'json':![],'formatter':function(_0x6d8e77){return formatter('',_0x6d8e77);}})]});return _0x4c692f;}function fileLogger(_0x4319af,_0x5c8269){var _0x43dba0=new winston[(_0x4b42('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4b42('0x1e'))][(_0x4b42('0x21'))]({'name':util[_0x4b42('0xf')](_0x4b42('0x22'),_0x4319af,_0x4b42('0x23')),'filename':getLogFileName(_0x5c8269,_0x4319af,'error'),'level':_0x4b42('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x138841){return fileFormat(_0x4319af,_0x138841);}}),new winston[(_0x4b42('0x1e'))][(_0x4b42('0x21'))]({'name':util[_0x4b42('0xf')]('%s-%s',_0x4319af,debugLevel),'filename':getLogFileName(_0x5c8269,_0x4319af,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x25ac69){return fileFormat(_0x4319af,_0x25ac69);}}),new winston[(_0x4b42('0x1e'))][(_0x4b42('0x1f'))]({'level':_0x4b42('0x20'),'json':![],'formatter':function(_0x315d0c){return fileFormat(_0x4319af,_0x315d0c);}})]});return _0x43dba0;}exports['consoleLogger']=consoleLogger;exports[_0x4b42('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 24b660d..50eb0a3 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x57ca,0x108));var _0xa57c=function(_0x2129f6,_0x19070c){_0x2129f6=_0x2129f6-0x0;var _0x51a54d=_0x57ca[_0x2129f6];return _0x51a54d;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x1e5db8,_0x44ef41){var _0x219a51=function(_0x5b86a3){while(--_0x5b86a3){_0x1e5db8['push'](_0x1e5db8['shift']());}};_0x219a51(++_0x44ef41);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f4394,_0x59a533){_0x3f4394=_0x3f4394-0x0;var _0xbf40b2=_0x2ef3[_0x3f4394];return _0xbf40b2;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 811be9b..932dab3 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x44fc8a,_0x3ddf68){var _0x114553=function(_0x576588){while(--_0x576588){_0x44fc8a['push'](_0x44fc8a['shift']());}};_0x114553(++_0x3ddf68);}(_0x8603,0x190));var _0x3860=function(_0x266247,_0x406437){_0x266247=_0x266247-0x0;var _0x335374=_0x8603[_0x266247];return _0x335374;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xefda=['replace','isArray','map','isPlainObject','reduce','exports','lodash','\x20}\x20}','string'];(function(_0x39b321,_0x3e47a3){var _0x32cf46=function(_0x1984f2){while(--_0x1984f2){_0x39b321['push'](_0x39b321['shift']());}};_0x32cf46(++_0x3e47a3);}(_0xefda,0x96));var _0xaefd=function(_0x3fec0e,_0x43ff55){_0x3fec0e=_0x3fec0e-0x0;var _0x441dbf=_0xefda[_0x3fec0e];return _0x441dbf;};var _=require(_0xaefd('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4ae616){return _0x4ae616==='{{'?'{\x20{\x20':_0xaefd('0x1');}function safeTemplate(_0x2ccc67){var _0x4ae272=_0x2ccc67;if(typeof _0x2ccc67===_0xaefd('0x2')){_0x4ae272=_0x2ccc67[_0xaefd('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xaefd('0x4')](_0x2ccc67)){_0x4ae272=_0x2ccc67[_0xaefd('0x5')](function(_0x1ef6b4){return safeTemplate(_0x1ef6b4);});}else if(_[_0xaefd('0x6')](_0x2ccc67)){_0x4ae272=Object['keys'](_0x2ccc67)[_0xaefd('0x7')](function(_0x3b9736,_0x24d10c){_0x3b9736[_0x24d10c]=safeTemplate(_0x2ccc67[_0x24d10c]);return _0x3b9736;},{});}return _0x4ae272;}module[_0xaefd('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 6fe0ee7..0f68612 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x990e=['info','writeJSON','resolve','exports','fs-extra','path','root','server/app.json','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated'];(function(_0x172f6b,_0x11669f){var _0x546c0f=function(_0x4a3171){while(--_0x4a3171){_0x172f6b['push'](_0x172f6b['shift']());}};_0x546c0f(++_0x11669f);}(_0x990e,0xc2));var _0xe990=function(_0x548a6c,_0x36f95a){_0x548a6c=_0x548a6c-0x0;var _0x29a0a2=_0x990e[_0x548a6c];return _0x29a0a2;};var fs=require(_0xe990('0x0'));var path=require(_0xe990('0x1'));var config=require('../config/environment');var root=config[_0xe990('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe990('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x5d78c5){let _0x11a8be=![];if(Array['isArray'](_0x5d78c5['apps'])){var _0x4ce8d8=_0x5d78c5[_0xe990('0x4')][_0xe990('0x5')](function(_0x2f82b4){return _0x2f82b4[_0xe990('0x6')]===_0xe990('0x7');});if(_0x4ce8d8>-0x1){var _0x2c886=_0x5d78c5[_0xe990('0x4')][_0x4ce8d8];if(typeof _0x2c886[_0xe990('0x8')][_0xe990('0x9')]!==_0xe990('0xa')){_0x2c886[_0xe990('0x8')][_0xe990('0x9')]=NODEPATH;_0x11a8be=!![];}}return{'appConfig':_0x5d78c5,'updated':_0x11a8be};}}function updateAppConfig(_0x47887e){return fs[_0xe990('0xb')](APP_JSON_PATH)[_0xe990('0xc')](function(_0x5d53a4){if(_0x5d53a4){return fs[_0xe990('0xd')](APP_JSON_PATH)[_0xe990('0xc')](function(_0x57c43b){var _0x714002=setLegacyLibsNodeEnvPath(_0x57c43b);if(_0x714002[_0xe990('0xe')]){_0x47887e[_0xe990('0xf')]('Updating\x20app.json');return fs[_0xe990('0x10')](APP_JSON_PATH,_0x57c43b,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe990('0x11')]();}});}module[_0xe990('0x12')]=updateAppConfig; \ No newline at end of file +var _0x4116=['isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4116,0x1b4));var _0x6411=function(_0x15b932,_0x39ba3f){_0x15b932=_0x15b932-0x0;var _0x28fa64=_0x4116[_0x15b932];return _0x28fa64;};var fs=require(_0x6411('0x0'));var path=require(_0x6411('0x1'));var config=require('../config/environment');var root=config[_0x6411('0x2')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0x6411('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x2c579c){let _0x37ea9a=![];if(Array[_0x6411('0x4')](_0x2c579c[_0x6411('0x5')])){var _0x58251c=_0x2c579c['apps'][_0x6411('0x6')](function(_0xb0813a){return _0xb0813a[_0x6411('0x7')]===_0x6411('0x8');});if(_0x58251c>-0x1){var _0x161d0d=_0x2c579c[_0x6411('0x5')][_0x58251c];if(typeof _0x161d0d[_0x6411('0x9')][_0x6411('0xa')]!==_0x6411('0xb')){_0x161d0d[_0x6411('0x9')][_0x6411('0xa')]=NODEPATH;_0x37ea9a=!![];}}return{'appConfig':_0x2c579c,'updated':_0x37ea9a};}}function updateAppConfig(_0x48ec49){return fs[_0x6411('0xc')](APP_JSON_PATH)[_0x6411('0xd')](function(_0x4327ac){if(_0x4327ac){return fs[_0x6411('0xe')](APP_JSON_PATH)[_0x6411('0xd')](function(_0x44a6ee){var _0x5e94d5=setLegacyLibsNodeEnvPath(_0x44a6ee);if(_0x5e94d5[_0x6411('0xf')]){_0x48ec49[_0x6411('0x10')](_0x6411('0x11'));return fs[_0x6411('0x12')](APP_JSON_PATH,_0x44a6ee,{'spaces':0x2});}else{return Promise[_0x6411('0x3')]();}});}else{return Promise[_0x6411('0x3')]();}});}module[_0x6411('0x13')]=updateAppConfig; \ No newline at end of file